@sma1lboy/rove 0.9.296 → 0.9.297-next.337

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.
Files changed (123) hide show
  1. package/dist/cli/{chunk-by8qsfpw.js → chunk-02dnpr84.js} +3 -6
  2. package/dist/cli/{chunk-yb90vkjq.js → chunk-02fvj8jj.js} +8 -8
  3. package/dist/cli/{chunk-01v7c774.js → chunk-05j6n3dy.js} +1 -1
  4. package/dist/cli/{chunk-w56terew.js → chunk-0b3mxres.js} +1 -1
  5. package/dist/cli/{chunk-xspfqx0x.js → chunk-0s0f2m0h.js} +1 -1
  6. package/dist/cli/{chunk-kvj8s9ck.js → chunk-0tz899zd.js} +1 -1
  7. package/dist/cli/{chunk-8cw8zznb.js → chunk-1dxpkpqv.js} +1 -1
  8. package/dist/cli/{chunk-f3283nz1.js → chunk-1mcwwjdt.js} +1 -1
  9. package/dist/cli/{chunk-8v27b5cc.js → chunk-1p9arh3n.js} +1 -1
  10. package/dist/cli/{chunk-cwzwkqtn.js → chunk-1t7nedq5.js} +1 -1
  11. package/dist/cli/{chunk-bpj7vk5n.js → chunk-1tn8kb6y.js} +1 -1
  12. package/dist/cli/{chunk-x0as3qp6.js → chunk-1x34sdat.js} +1 -1
  13. package/dist/cli/{chunk-qdatysve.js → chunk-27hpzddr.js} +1 -1
  14. package/dist/cli/{chunk-kpatnxjs.js → chunk-2gd3wnza.js} +1 -1
  15. package/dist/cli/{chunk-qjr36jpm.js → chunk-2gte2kv5.js} +1 -1
  16. package/dist/cli/{chunk-c0gdgahx.js → chunk-2j4nng9y.js} +1 -1
  17. package/dist/cli/{chunk-mb1tythq.js → chunk-32es1ykk.js} +3 -3
  18. package/dist/cli/{chunk-sfhj74g9.js → chunk-34ec6fs4.js} +1 -1
  19. package/dist/cli/{chunk-mz82b1jf.js → chunk-3spvd3vw.js} +1 -1
  20. package/dist/cli/{chunk-qcdznw50.js → chunk-3yx9cd91.js} +1 -1
  21. package/dist/cli/{chunk-xqp838p0.js → chunk-3zyngx03.js} +1 -1
  22. package/dist/cli/{chunk-zjxz2v8a.js → chunk-4gt29avz.js} +1 -1
  23. package/dist/cli/{chunk-n2hz851r.js → chunk-4zc1jvcc.js} +1 -1
  24. package/dist/cli/{chunk-sj4dmdzp.js → chunk-4zzn4s1m.js} +1 -1
  25. package/dist/cli/{chunk-entdmr95.js → chunk-53nvp1cm.js} +2 -2
  26. package/dist/cli/{chunk-k2xtg52k.js → chunk-5fwm8fn5.js} +1 -1
  27. package/dist/cli/{chunk-2bgb2810.js → chunk-5s9yshk7.js} +1 -1
  28. package/dist/cli/{chunk-a1scaehn.js → chunk-6bfhcy6k.js} +1 -1
  29. package/dist/cli/{chunk-kdf7cq06.js → chunk-6drheddc.js} +5 -5
  30. package/dist/cli/{chunk-z3k0wg31.js → chunk-76gh55cc.js} +1 -1
  31. package/dist/cli/{chunk-1er9syxh.js → chunk-78x0h05c.js} +1 -1
  32. package/dist/cli/{chunk-c5xnhy0v.js → chunk-7ay57tgs.js} +1 -1
  33. package/dist/cli/{chunk-b2p959ft.js → chunk-7rjq8mbj.js} +1 -1
  34. package/dist/cli/chunk-8g6sb0q6.js +3 -0
  35. package/dist/cli/chunk-95pc2w9m.js +3 -0
  36. package/dist/cli/{chunk-wrptfjk1.js → chunk-9h97cmm1.js} +1 -1
  37. package/dist/cli/chunk-a503k6ds.js +13 -0
  38. package/dist/cli/{chunk-9gevsmy4.js → chunk-a696vmsn.js} +1 -1
  39. package/dist/cli/{chunk-yb00yrvr.js → chunk-a6pwb5qf.js} +4 -4
  40. package/dist/cli/{chunk-4bcxnk94.js → chunk-amx9axkn.js} +1 -1
  41. package/dist/cli/{chunk-6wmx34ha.js → chunk-b4fbghz1.js} +1 -1
  42. package/dist/cli/{chunk-a95aghfk.js → chunk-bmwr7x5e.js} +2 -2
  43. package/dist/cli/{chunk-632n6mt1.js → chunk-c296xy6x.js} +1 -1
  44. package/dist/cli/{chunk-avf521sy.js → chunk-ckyjn0av.js} +1 -1
  45. package/dist/cli/{chunk-bkhbaqt1.js → chunk-cn6qc47w.js} +1 -1
  46. package/dist/cli/{chunk-wcnb5vbx.js → chunk-d89mvn1k.js} +1 -1
  47. package/dist/cli/{chunk-7cptm3td.js → chunk-db0kdm4z.js} +1 -1
  48. package/dist/cli/{chunk-p7mc1c1g.js → chunk-dqcedeaw.js} +1 -1
  49. package/dist/cli/{chunk-5hphve8z.js → chunk-dz2m3cjw.js} +1 -1
  50. package/dist/cli/{chunk-8wfz7gyp.js → chunk-fgb5ev6w.js} +1 -1
  51. package/dist/cli/{chunk-dxyy3ep8.js → chunk-fmmn895c.js} +1 -1
  52. package/dist/cli/{chunk-h4vsddk4.js → chunk-fpqj5vqe.js} +1 -1
  53. package/dist/cli/{chunk-hsx9fbx1.js → chunk-fsas0egj.js} +1 -1
  54. package/dist/cli/{chunk-jjc3v2zc.js → chunk-h0ezf1yg.js} +1 -1
  55. package/dist/cli/{chunk-6zjbhrq2.js → chunk-hda3rmst.js} +1 -1
  56. package/dist/cli/{chunk-h57gekkj.js → chunk-j25q6bz5.js} +1 -1
  57. package/dist/cli/{chunk-brz4hsbt.js → chunk-jf49gpeb.js} +1 -1
  58. package/dist/cli/{chunk-ywwg5zxs.js → chunk-jmfxkahq.js} +1 -1
  59. package/dist/cli/{chunk-btzp2e5y.js → chunk-jmvzdp0t.js} +1 -1
  60. package/dist/cli/{chunk-em5gq23f.js → chunk-ka790mbb.js} +1 -1
  61. package/dist/cli/{chunk-mx2smec1.js → chunk-kcta89jz.js} +1 -1
  62. package/dist/cli/{chunk-3n1cq57r.js → chunk-kffnz94v.js} +1 -1
  63. package/dist/cli/{chunk-0pgc4zqm.js → chunk-kqem8ygn.js} +3 -3
  64. package/dist/cli/{chunk-70k6jpa7.js → chunk-kzb5x0cp.js} +5 -5
  65. package/dist/cli/{chunk-xw1gayhz.js → chunk-m9zj97y6.js} +1 -1
  66. package/dist/cli/chunk-mavz1h73.js +3 -0
  67. package/dist/cli/{chunk-e3bqjaff.js → chunk-md3xyfxb.js} +1 -1
  68. package/dist/cli/{chunk-y21c6jk8.js → chunk-mx1r6k70.js} +1 -1
  69. package/dist/cli/{chunk-wf5q5wm0.js → chunk-mz19jng6.js} +1 -1
  70. package/dist/cli/{chunk-4hvacnnr.js → chunk-ng0kaekc.js} +1 -1
  71. package/dist/cli/{chunk-44bh467x.js → chunk-nweeyjqj.js} +1 -1
  72. package/dist/cli/{chunk-37shgbcw.js → chunk-p1x2bcng.js} +1 -1
  73. package/dist/cli/{chunk-7jc8e7zj.js → chunk-p3e2vcx8.js} +12 -12
  74. package/dist/cli/{chunk-dz562xtj.js → chunk-p6fc4mze.js} +1 -1
  75. package/dist/cli/{chunk-9vt2v6k4.js → chunk-pd05zqce.js} +1 -1
  76. package/dist/cli/{chunk-tqa7aw5p.js → chunk-pqtwx9ty.js} +1 -1
  77. package/dist/cli/chunk-q7t4bnjn.js +3 -0
  78. package/dist/cli/{chunk-paxy7y8f.js → chunk-q9avp4wf.js} +1 -1
  79. package/dist/cli/{chunk-h72tns53.js → chunk-qck7a377.js} +1 -1
  80. package/dist/cli/{chunk-5pd144sp.js → chunk-qg26tp0c.js} +1 -1
  81. package/dist/cli/chunk-qm3vt4ra.js +8 -0
  82. package/dist/cli/{chunk-qc40t7z9.js → chunk-r80x9m80.js} +1 -1
  83. package/dist/cli/{chunk-sc5xvzb1.js → chunk-rhhffhn7.js} +1 -1
  84. package/dist/cli/{chunk-8e6j2507.js → chunk-s0t989c7.js} +1 -1
  85. package/dist/cli/{chunk-3cqyw1z8.js → chunk-sjdngs0f.js} +1 -1
  86. package/dist/cli/{chunk-10yyd82a.js → chunk-sty6nxzc.js} +1 -1
  87. package/dist/cli/{chunk-qg92cfsh.js → chunk-t89b4n6d.js} +1 -1
  88. package/dist/cli/{chunk-e0xzwcb7.js → chunk-t9vt4259.js} +1 -1
  89. package/dist/cli/{chunk-4k0k6f9v.js → chunk-tefep7b1.js} +1 -1
  90. package/dist/cli/{chunk-knnnymss.js → chunk-v6ckw0fe.js} +1 -1
  91. package/dist/cli/{chunk-mf2p3p9k.js → chunk-vdgtsda7.js} +1 -1
  92. package/dist/cli/{chunk-8tr2kq1p.js → chunk-w1qr186f.js} +1 -1
  93. package/dist/cli/{chunk-4vbk9z6n.js → chunk-w2g26k38.js} +1 -1
  94. package/dist/cli/{chunk-m9ssmhrc.js → chunk-x62wqf3s.js} +1 -1
  95. package/dist/cli/{chunk-g5jc6c2d.js → chunk-x8jpnh1n.js} +1 -1
  96. package/dist/cli/{chunk-jhnpr3cj.js → chunk-xq05a8a5.js} +1 -1
  97. package/dist/cli/{chunk-7j7sdn4p.js → chunk-xxf4t4ge.js} +1 -1
  98. package/dist/cli/{chunk-rr0cjy1v.js → chunk-ybwqj9mp.js} +1 -1
  99. package/dist/cli/{chunk-fmmfb3gy.js → chunk-ygr4zb4r.js} +4 -4
  100. package/dist/cli/{chunk-k291yw81.js → chunk-yqgnceba.js} +1 -1
  101. package/dist/cli/{chunk-n1nt3zx9.js → chunk-yrczh9ct.js} +1 -1
  102. package/dist/cli/{chunk-ekpyyfnd.js → chunk-yrgprggb.js} +1 -1
  103. package/dist/cli/{chunk-4bs5vsz3.js → chunk-ytr5x20b.js} +1 -1
  104. package/dist/cli/{chunk-cjf4hwav.js → chunk-z3y6c62g.js} +1 -1
  105. package/dist/cli/{chunk-ysw51r58.js → chunk-z9g1axf4.js} +1 -1
  106. package/dist/cli/{chunk-v9d9tfsg.js → chunk-zdxbf065.js} +1 -1
  107. package/dist/cli/{chunk-s9j0sbmf.js → chunk-znknvm7g.js} +1 -1
  108. package/dist/cli/{chunk-m70jtmkt.js → chunk-zw0p1wxc.js} +1 -1
  109. package/dist/cli/index.js +4 -4
  110. package/dist/cli/pty-host-node.mjs +1 -1
  111. package/dist/cli/rove.js +3 -3
  112. package/dist/skills/rove/SKILL.md +6 -4
  113. package/dist/skills/rove/references/api-flags.md +2 -2
  114. package/dist/web/assets/{index-CnmLR3Eh.js → index-VLiA_Vij.js} +35 -35
  115. package/dist/web/assets/{term-mount-QawNA0jJ.js → term-mount-CEw0hxaB.js} +1 -1
  116. package/dist/web/index.html +1 -1
  117. package/package.json +1 -1
  118. package/dist/cli/chunk-2jan428s.js +0 -13
  119. package/dist/cli/chunk-5c591htx.js +0 -3
  120. package/dist/cli/chunk-bytqgcde.js +0 -8
  121. package/dist/cli/chunk-c70kbg4m.js +0 -3
  122. package/dist/cli/chunk-hw1aj9sk.js +0 -3
  123. package/dist/cli/chunk-mj9bzcm8.js +0 -3
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/term-mount-QawNA0jJ.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-CEw0hxaB.js","assets/term-mount-BrP-ENHg.css"])))=>i.map(i=>d[i]);
2
2
  var e=Object.defineProperty,t=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),n=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var r=`rove.bridge.token`;if(typeof window<`u`){let e=new URLSearchParams(window.location.hash.slice(1)).get(`token`);e&&(localStorage.setItem(r,e),history.replaceState(null,``,window.location.pathname+window.location.search))}function i(){return localStorage.getItem(r)}function a(e){localStorage.setItem(r,e)}function o(){localStorage.removeItem(r)}var s=t((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(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 N(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,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+j(a,u),c+=N(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+j(a,u++),c+=N(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return N(M(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 P(e,t,n){if(e==null)return e;var r=[],i=0;return N(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function ee(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 F=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)},I={map:P,forEach:function(e,t,n){P(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return P(e,function(){t++}),t},toArray:function(e){return P(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=I,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:ee}},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,F)}catch(e){F(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&&j(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&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(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,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),u=t(((e,t)=>{t.exports=l()})),d=t((e=>{var t=c();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=l(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=l(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)}},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.8`})),f=t(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=d()})),p=t((e=>{var t=u(),n=c(),r=f();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function d(e){if(o(e)!==e)throw Error(i(188))}function p(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return d(a),e;if(s===r)return d(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,l=a.child;l;){if(l===n){c=!0,n=a,r=s;break}if(l===r){c=!0,r=a,n=s;break}l=l.sibling}if(!c){for(l=s.child;l;){if(l===n){c=!0,n=s,r=a;break}if(l===r){c=!0,r=s,n=a;break}l=l.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function m(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=m(e),t!==null)return t;e=e.sibling}return null}var h=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),w=Symbol.for(`react.forward_ref`),T=Symbol.for(`react.suspense`),E=Symbol.for(`react.suspense_list`),D=Symbol.for(`react.memo`),O=Symbol.for(`react.lazy`),k=Symbol.for(`react.activity`),A=Symbol.for(`react.memo_cache_sentinel`),j=Symbol.iterator;function M(e){return typeof e!=`object`||!e?null:(e=j&&e[j]||e[`@@iterator`],typeof e==`function`?e:null)}var N=Symbol.for(`react.client.reference`);function P(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===N?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?P(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return P(e(t))}catch{}}return null}var ee=Array.isArray,F=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,te={pending:!1,data:null,method:null,action:null},ne=[],re=-1;function ie(e){return{current:e}}function ae(e){0>re||(e.current=ne[re],ne[re]=null,re--)}function L(e,t){re++,ne[re]=e.current,e.current=t}var oe=ie(null),R=ie(null),z=ie(null),se=ie(null);function ce(e,t){switch(L(z,t),L(R,e),L(oe,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Ud(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Ud(t),e=Wd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}ae(oe),L(oe,e)}function le(){ae(oe),ae(R),ae(z)}function ue(e){e.memoizedState!==null&&L(se,e);var t=oe.current,n=Wd(t,e.type);t!==n&&(L(R,e),L(oe,n))}function de(e){R.current===e&&(ae(oe),ae(R)),se.current===e&&(ae(se),ep._currentValue=te)}var fe,pe;function me(e){if(fe===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);fe=t&&t[1]||``,pe=-1<e.stack.indexOf(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+fe+e+pe}var he=!1;function ge(e,t){if(!e||he)return``;he=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
@@ -13,7 +13,7 @@ Error generating stack: `+e.message+`
13
13
  This worktree is at the PR's head ({head}, going into {base}). Read the change against {base} (git diff origin/{base}...HEAD), then tell me what you find: bugs, risks, missing tests, anything unclear. Do not push, comment on or approve the PR; report here.`}},st={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;在这里汇报。`}},ct=n({en:()=>lt,zh:()=>ut}),lt={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`}},ut={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} 条`}},dt=n({en:()=>ft,zh:()=>pt}),ft={settings:{title:`Settings`,open:`settings`,sections:{connectors:`Connectors`,appearance:`Appearance`,notifications:`Notifications`,snippets:`Snippets`,about:`About`,voice:`Voice`},groups:{preferences:`Preferences`,agents:`Agents and tools`,more:`More`},pages:{general:`Language, layout, and where Rove opens files and creates worktrees.`,appearance:`Theme, colours, and how tasks and panes look.`,notifications:`When Rove tells you a task finished or needs you.`,keys:`Rebind chords in your own file, and how the prefix guide behaves.`,engines:`The coding agents Rove can start, and how it plugs into them.`,autoRouting:`What each depth tier starts, and who picks the tier.`,voice:`Dictation: the recognizer that turns what you say into prompts.`,connectors:`Accounts Rove uses, here and on your other machines.`,plugins:`Built-in pages and registered plugins.`,about:`Versions, updates, and this browser.`,feedback:`Send a note to the Rove team.`,dev:`Experimental switches, restarts and resets.`,snippets:`Prompt text you reuse. Type @name in a prompt to insert it.`},connectors:{githubDescription:`Clone, push and open PRs on every machine with one GitHub account`,connect:`Connect`,disconnect:`Disconnect`,disconnectBody:`Signs this machine's gh out of GitHub, for every tool that uses gh and not only Rove. Other machines keep their own sign-ins.`,machines:`Machines`,thisMachine:`This machine`,machinesHint:`Each machine signs in to GitHub by itself. The mark says whether it uses the same account as this one.`,refresh:`Check again`,refreshing:`Checking…`,useRove:`Use Rove's account`,loginThere:`Log in there`,codeHint:`Enter this code at GitHub (click the code to copy it)`,openGithub:`Open github.com/login/device`,codeCopied:`Code copied`,syncing:`Signed in. Bringing the other machines along…`,loginFailed:`Sign-in failed: {error}`,dismiss:`Dismiss`,loading:`checking…`,markSame:`✓ same account`,markDifferent:`⚠ @{login}`,markSignedOut:`✗ signed out`,markNoGh:`gh is not installed`,markOutdated:`Rove there is outdated`,markOffline:`offline`,markDenied:`refuses credential changes`,markFailed:`could not check`,detail:`git over {protocol} · SSH key {ssh}`,synced:`{machine} now uses @{login}`},general:{groupInterface:`Interface`,groupFiles:`Worktrees`,groupTerminal:`Terminal`,tabStrip:`Tab strip`,scrollback:`Scrollback`},appearance:{groupColours:`Colours`,groupTasks:`Tasks and panes`,taskColorsNote:`Gives each task its own hue on the working border and in the list.`,colorblindNote:`Shows added and removed lines in blue and red instead of green and red.`,workingBorderNote:`The pane's border while the selected task is working.`,railGroup:`Task list`,railGroupProject:`By project`,railGroupState:`By state`,statusMark:`Task status`,statusMarkEngine:`Engine icon`,statusMarkBoth:`Icon and dots`,statusMarkDots:`Dots only`,previewWorking:`Working`,previewDone:`Finished, unread`,previewIdle:`Idle`,previewWaiting:`Waiting for you`,previewBroken:`Broken`,previewTitle:`Fix the login redirect`},notifications:{toastNote:`A popup in the corner of this page.`,volume:`Chime volume`},about:{groupRove:`Rove`,daemon:`Daemon`,daemonCurrent:`rove {version}, same build as this page`,daemonStale:"rove {version} is out of date; run `rove daemon restart`",updates:`Updates`,browser:`This browser`,browserHint:`Forget this browser's token. A login token is revoked on the host too.`,access:`Access`,signIn:`Sign-in`,signInMode:{open:`None`,password:`Password`,token:`Token link`},signInHint:{open:`A browser on this computer opens Rove with no link or password. Phones and other computers still need a token.`,password:`A browser without a token signs in with the password. Token links keep working.`,token:`Only the link rove printed, or a device token, gets in. Password sign-in is off.`},passwordSet:`Set a password`,passwordChange:`Change the password`,passwordHint:`At least {min} characters. It is stored hashed on this computer.`,passwordField:`New password`,passwordSave:`Save`,signOut:`Sign out`},engines:{enabled:`Offer {name} when picking an engine`,default:`Make {name} the default engine`,namePlaceholder:`Display name (blank = default)`,rename:`Rename`,reset:`Reset to defaults`,remove:`Remove engine`,save:`Save`,cancel:`Cancel`},plugins:{builtIn:`Built in`,builtInHint:`First-party pages. Turning one off removes its entry from the rail.`,registered:`Registered plugins`,empty:`No other plugins registered.`,linked:`linked`,unsupportedPlatform:`unsupported platform`,turnOn:`Install {name}`},feedback:{hint:"Files a public GitHub issue on the Rove repo, through `gh` on the machine running rove. Without a signed-in `gh` you get a prefilled link to open instead.",kindLabel:`Kind`,kindBug:`Bug`,kindIdea:`Idea`,kindQuestion:`Question`,titleLabel:`Title`,body:`What happened`,send:`File issue`,sent:`Filed issue #{number}`,notFiled:`Not filed yet. {hint}`,openLink:`Open the prefilled issue`,report:`Report a problem with an agent`,reportNote:`An agent asks what went wrong, drafts the issue with you and files it.`,reportFailed:`Could not start the conversation.`,reportPrompt:"You are helping the user report a problem with Rove itself (not their own project) as a GitHub issue. First ask what they were doing and what felt wrong: one to three short questions, one at a time. Then collect context: run `rove --version` and `rove daemon status`, and read the last ~50 lines of `${ROVE_HOME_DIR:-$HOME}/.rove/daemon.log` only if the problem could involve the daemon. Draft an issue title and body (what happened, what they expected, steps, relevant output) and show it to the user. Only after they say OK, file it with a heredoc: `rove feedback --kind bug|idea|question --title \"...\" --body-file - <<'EOF'` followed by the body and `EOF`. Then share the issue URL. If it prints a prefilled link instead (gh missing or signed out), give the user that link and tell them to run `gh auth login`."}},prefs:{languageHint:`Display language, shared with the TUI.`,soundHint:`chime, plus a desktop notification while this tab is in the background`,soundVolumeHint:`Plays the new level when you pick it.`,push:`Notify when this page is closed`,pushHint:`This browser gets a notification when a task finishes, needs you or fails, even with no Rove page open. Follows the cross-task switch.`,pushUnsupported:`This browser can't receive push here: it needs https (or localhost), and on iPhone/iPad the page added to the home screen.`,pushBlocked:`Notifications are blocked for this site; allow them in the browser's site settings.`,pushFailed:`Couldn't turn it on: {error}`,zenHint:`Hide the Files pane. The zen chip and ctrl+a z toggle it and write this same setting.`,editInTui:`Edit it in the TUI.`,tierModel:`model`,tierEdit:`Edit`,tierEffort:`Reasoning effort`,classifierConnection:`Classifier connection`,unset:`(none)`,modeAuto:`Auto (follow the browser)`,themePreviewHint:`Point at a theme to see this page in it; click to keep it. The TUI follows.`,themeUser:`yours`,themeInstalled:`Installed`,themeMoreHint:`Not installed yet: point to preview, click to install and switch.`,themeBrowse:`Browse {count} more from rove.run`,themeHide:`Hide themes from rove.run`,themeGet:`get`,themeInstalling:`installing…`,themeInstallFailed:`failed, retry`,themeAgent:`Make one with an agent`,themeAgentHint:`opens a Scratch session; reopen Settings to see what it wrote.`,themeAgentFailed:`couldn't open the session; try again.`,themeAgentPrompt:"Make me a new Rove color theme. Ask me first what look I want, unless I already said. Save it as one JSON file in {dir} (for example {dir}/my-theme.json); the file name is the theme's name. The format is in https://github.com/sma1lboy/rove/blob/main/docs/themes.md and the JSON schema is https://raw.githubusercontent.com/sma1lboy/rove/main/packages/rove/src/tui/context/theme/theme.schema.json. Start from https://raw.githubusercontent.com/sma1lboy/rove/main/packages/rove/src/tui/context/theme/claude.json, give each color slot a { dark, light } pair, and keep text readable on every background. When it's saved, run `rove theme list` to check it loads, then tell me the name: it appears in Settings → Appearance.",resetButton:`Reset`,resetHint:`Clears this Mac's saved settings and task list, restarts the Rove daemon, then reloads this page. Worktrees on disk and engine session history are not touched.`,resetBody:`Wipes ~/.config/rove/state.json and ~/.rove/tasks.json and restarts the daemon, then reloads this page with an empty task list. Worktrees on disk and engine session history are NOT touched.`,restartButton:`Restart`,restartHint:`Stops the Rove daemon and starts a fresh one; this page reconnects on its own. Running engine sessions live in the PTY host and survive it.`,restartBody:`Stops the Rove daemon and starts a fresh one, picking up daemon edits. This page reconnects in a few seconds. Running engine sessions survive.`,keysYaml:`The file is read on the Mac; changes apply when you come back to this page.`},keys:{editHint:`Click a key to record a new one, then press the key you want. To put it behind the prefix, press the prefix key first. The × removes it.`,reset:`Reset`,recordFor:`Record a key for {name}`,removeFor:`Remove the key for {name}`,pluginNoTask:`Select a task before using a plugin chord.`,pluginChords:`Plugin chords`,agent:`Change them with an agent`,agentHint:`opens a Scratch session; reopen Settings to see what it changed.`,agentFailed:`couldn't open the session; try again.`,agentPrompt:"Change my Rove keybindings. Ask me first what I want changed, unless I already said. Edit {path} (create it if it is missing; keep existing entries and comments you were not asked to change). The format, every binding id and its default chord are in https://github.com/sma1lboy/rove/blob/main/docs/KEYBINDINGS.md (see Customizing). Only use binding ids listed there; a direct override replaces that binding's whole chord list, and null unbinds. The file must stay valid YAML: check it parses (for example with `ruby -ryaml -e 'YAML.load_file(ARGV[0])' {path}` or any YAML parser you have). Rove reloads it live, and unknown ids or invalid chords are ignored with a warning, so when you are done tell me what you changed and ask me to reopen Settings → Keybindings: it lists every applied override and every warning."},pages:{attachTooLarge:`{name} is larger than 500 MB`,new:`[ new ]`,routinePause:`[ pause ]`,routineEnable:`[ enable ]`,delete:`[ delete ]`,routinesNeedYou:`NEEDS YOU`,routinesActive:`ACTIVE`,routinesPaused:`PAUSED`,laterStarts:`LATER`,laterCancel:`[ cancel ]`,laterFailed:`Did not start: {error}`,laterCancelFailed:`Could not cancel the start: {error}`,routineSchedule:`Schedule`,routineNext:`Next run`,routineProject:`Project`,routineDelivers:`Delivers to`,routineEngine:`Engine`,routineChangeEngine:`[ change ]`,routinePrompt:`PROMPT`,routineScript:`SCRIPT`,cronDown:`Decrease {field}`,cronUp:`Increase {field}`,storySave:`save`,storySaveStart:`save & start`,storyStart:`start`,attachHintTouch:`paste a path / a screenshot → inserts an image placeholder`}},pt={settings:{title:`设置`,open:`设置`,sections:{connectors:`连接器`,appearance:`外观`,notifications:`通知`,snippets:`片段`,about:`关于`,voice:`语音`},groups:{preferences:`偏好`,agents:`智能体与工具`,more:`更多`},pages:{general:`语言、布局,以及 Rove 在哪里打开文件、创建 worktree。`,appearance:`主题、颜色,以及任务和面板的外观。`,notifications:`任务完成或需要你时,Rove 怎么提醒。`,keys:`在你自己的文件里重绑快捷键,以及前缀引导的行为。`,engines:`Rove 能启动的编码智能体,以及它如何接入它们。`,autoRouting:`每个深度档位启动什么,以及由谁选择档位。`,voice:`口述:把你说的话变成提示词的识别器。`,connectors:`Rove 使用的账号,本机和你的其他机器。`,plugins:`内置页面和已注册的插件。`,about:`版本、更新,以及此浏览器。`,feedback:`给 Rove 团队留一条意见。`,dev:`实验开关、重启和重置。`,snippets:`常用的提示词文本。在提示词里输入 @名称 即可插入。`},connectors:{githubDescription:`用同一个 GitHub 账号在每台机器上克隆、推送和开 PR`,connect:`连接`,disconnect:`断开`,disconnectBody:`把这台机器的 gh 从 GitHub 退出登录,所有用 gh 的工具都会受影响,不只是 Rove。其他机器保持各自的登录。`,machines:`机器`,thisMachine:`本机`,machinesHint:`每台机器各自登录 GitHub。右边的标记表示它和本机用的是不是同一个账号。`,refresh:`重新检查`,refreshing:`检查中…`,useRove:`使用 Rove 的账号`,loginThere:`在那里登录`,codeHint:`到 GitHub 输入这个验证码(点击验证码可复制)`,openGithub:`打开 github.com/login/device`,codeCopied:`验证码已复制`,syncing:`已登录,正在同步其他机器…`,loginFailed:`登录失败:{error}`,dismiss:`关闭`,loading:`检查中…`,markSame:`✓ 同一账号`,markDifferent:`⚠ @{login}`,markSignedOut:`✗ 未登录`,markNoGh:`未安装 gh`,markOutdated:`那边的 Rove 版本过旧`,markOffline:`离线`,markDenied:`拒绝修改凭据`,markFailed:`无法检查`,detail:`git 走 {protocol} · SSH 密钥 {ssh}`,synced:`{machine} 现在使用 @{login}`},general:{groupInterface:`界面`,groupFiles:`Worktree`,groupTerminal:`终端`,tabStrip:`标签栏`,scrollback:`回滚行数`},appearance:{groupColours:`颜色`,groupTasks:`任务与面板`,taskColorsNote:`让每个任务在工作边框和列表里有自己的色调。`,colorblindNote:`新增和删除的行用蓝色和红色,而不是绿色和红色。`,workingBorderNote:`所选任务工作时,面板边框的样子。`,railGroup:`任务列表`,railGroupProject:`按项目`,railGroupState:`按状态`,statusMark:`任务状态`,statusMarkEngine:`引擎图标`,statusMarkBoth:`图标加点阵`,statusMarkDots:`只有点阵`,previewWorking:`正在跑`,previewDone:`完成未读`,previewIdle:`空闲`,previewWaiting:`等你回答`,previewBroken:`出错`,previewTitle:`修复登录跳转`},notifications:{toastNote:`本页角落里的弹出提示。`,volume:`提示音音量`},about:{groupRove:`Rove`,daemon:`守护进程`,daemonCurrent:`rove {version},与本页同一版本`,daemonStale:"rove {version} 版本过旧;运行 `rove daemon restart`",updates:`更新`,browser:`此浏览器`,browserHint:`忘掉此浏览器的令牌。登录得到的令牌也会在主机上吊销。`,access:`访问`,signIn:`登录方式`,signInMode:{open:`免登录`,password:`密码`,token:`Token 链接`},signInHint:{open:`本机浏览器不用链接或密码就能打开 Rove。手机和其他电脑仍然需要 token。`,password:`没有 token 的浏览器用密码登录。Token 链接照常可用。`,token:`只有 rove 打印的链接或设备 token 能进。密码登录关闭。`},passwordSet:`设置密码`,passwordChange:`修改密码`,passwordHint:`至少 {min} 个字符。以哈希形式存在本机。`,passwordField:`新密码`,passwordSave:`保存`,signOut:`退出登录`},engines:{enabled:`选引擎时列出 {name}`,default:`把 {name} 设为默认引擎`,namePlaceholder:`显示名称(留空 = 默认)`,rename:`重命名`,reset:`恢复默认`,remove:`移除引擎`,save:`保存`,cancel:`取消`},plugins:{builtIn:`内置`,builtInHint:`官方页面。关掉后,它在侧栏的入口会消失。`,registered:`已注册的插件`,empty:`没有其他已注册的插件。`,linked:`已链接`,unsupportedPlatform:`平台不支持`,turnOn:`安装 {name}`},feedback:{hint:"通过运行 rove 那台机器上的 `gh`,在 Rove 仓库提一个公开的 GitHub issue。没有登录 `gh` 时会给你一条预填好的链接。",kindLabel:`类型`,kindBug:`缺陷`,kindIdea:`想法`,kindQuestion:`问题`,titleLabel:`标题`,body:`发生了什么`,send:`提交 issue`,sent:`已提交 issue #{number}`,notFiled:`还没提交。{hint}`,openLink:`打开预填好的 issue`,report:`让 agent 帮我报告问题`,reportNote:`由 agent 问清哪里不对,和你一起起草 issue 并提交。`,reportFailed:`没能开始对话。`,reportPrompt:"你在帮用户把 Rove 本身的问题(不是他们自己项目的问题)提成一个 GitHub issue。先问清楚他们当时在做什么、哪里不对劲:一到三个简短的问题,一次问一个。然后收集上下文:运行 `rove --version` 和 `rove daemon status`,只有问题可能和 daemon 有关时才读 `${ROVE_HOME_DIR:-$HOME}/.rove/daemon.log` 的最后约 50 行。起草 issue 的标题和正文(发生了什么、期望什么、复现步骤、相关输出)并展示给用户。用户确认之后才提交,用 heredoc:`rove feedback --kind bug|idea|question --title \"...\" --body-file - <<'EOF'`,接正文,最后一行 `EOF`。然后把 issue 链接发给用户。如果输出的是预填链接(没装 gh 或没登录),把链接给用户,并告诉他运行 `gh auth login`。"}},prefs:{languageHint:`显示语言,与 TUI 共用同一设置。`,soundHint:`提示音;本页在后台时另发桌面通知`,soundVolumeHint:`选中后会播放新音量。`,push:`页面关闭时也通知`,pushHint:`任务完成、需要你或出错时,即使没有打开任何 Rove 页面,这个浏览器也会收到通知。跟随「跨任务通知」开关。`,pushUnsupported:`这个浏览器在这里收不到推送:需要 https(或 localhost),iPhone/iPad 上还要先把页面添加到主屏幕。`,pushBlocked:`这个网站的通知被浏览器屏蔽了,去浏览器的网站设置里允许。`,pushFailed:`没能开启:{error}`,zenHint:`收起文件栏。zen 按钮和 ctrl+a z 切换时会写入同一个设置。`,editInTui:`请在 TUI 中编辑`,tierModel:`模型`,tierEdit:`编辑`,tierEffort:`推理强度`,classifierConnection:`分类器连接`,unset:`(无)`,modeAuto:`自动(跟随浏览器)`,themePreviewHint:`鼠标指向一个主题,整页就换成它看看;点一下就定下来。TUI 也会跟着换。`,themeUser:`自装`,themeInstalled:`已安装`,themeMoreHint:`尚未安装:指向即预览,点一下安装并切换。`,themeBrowse:`浏览 rove.run 上的另外 {count} 个主题`,themeHide:`收起 rove.run 的主题`,themeGet:`安装`,themeInstalling:`安装中…`,themeInstallFailed:`失败,重试`,themeAgent:`让 agent 做一个`,themeAgentHint:`会开一个 Scratch 会话;做好后重新打开设置就能看到。`,themeAgentFailed:`会话没打开,再试一次。`,themeAgentPrompt:"帮我做一个新的 Rove 配色主题。先问我想要什么风格,除非我已经说过。把它存成 {dir} 下的一个 JSON 文件(比如 {dir}/my-theme.json),文件名就是主题名。格式说明见 https://github.com/sma1lboy/rove/blob/main/docs/themes.md,JSON schema 是 https://raw.githubusercontent.com/sma1lboy/rove/main/packages/rove/src/tui/context/theme/theme.schema.json。以 https://raw.githubusercontent.com/sma1lboy/rove/main/packages/rove/src/tui/context/theme/claude.json 为起点,每个颜色槽都给 { dark, light } 两个值,并保证文字在每种背景上都看得清。存好后运行 `rove theme list` 确认能加载,然后告诉我主题名:它会出现在 设置 → 外观 里。",resetButton:`重置`,resetHint:`清空这台 Mac 上保存的设置和任务列表,重启 Rove 守护进程,然后刷新本页。磁盘上的工作树和引擎会话历史不受影响。`,resetBody:`清空 ~/.config/rove/state.json 和 ~/.rove/tasks.json 并重启守护进程,然后刷新本页,任务列表为空。磁盘上的工作树和引擎会话历史不会被动。`,restartButton:`重启`,restartHint:`停止 Rove 守护进程并启动新的进程,本页会自动重连。运行中的引擎会话在 PTY 宿主里,不受影响。`,restartBody:`停止 Rove 守护进程并启动新的进程,载入守护进程的改动。本页几秒后自动重连,运行中的引擎会话不受影响。`,keysYaml:`该文件在 Mac 上读取,改动会在你回到本页时生效。`},keys:{editHint:`点一个按键开始录入,再按你想要的键。想放到 prefix 后面,就先按 prefix 键。× 是删掉它。`,reset:`恢复默认`,recordFor:`为「{name}」录入按键`,removeFor:`删掉「{name}」的按键`,pluginNoTask:`使用插件快捷键前请先选中一个任务。`,pluginChords:`插件快捷键`,agent:`让 agent 来改`,agentHint:`会开一个 Scratch 会话;改好后重新打开设置就能看到。`,agentFailed:`会话没打开,再试一次。`,agentPrompt:"帮我改 Rove 的快捷键。先问我想改什么,除非我已经说过。编辑 {path}(不存在就新建;没让你改的条目和注释都保留)。格式、每个 binding id 及其默认按键见 https://github.com/sma1lboy/rove/blob/main/docs/KEYBINDINGS.md(Customizing 一节)。只用那里列出的 binding id;直接覆盖会替换该 binding 的整个按键列表,null 表示解绑。文件必须保持合法 YAML:确认它能解析(比如 `ruby -ryaml -e 'YAML.load_file(ARGV[0])' {path}`,或任何你有的 YAML 解析器)。Rove 会实时重新加载它,未知 id 或无效按键会被忽略并给出警告,所以改完后告诉我改了什么,并请我重新打开 设置 → 快捷键:那里会列出所有生效的覆盖和所有警告。"},pages:{attachTooLarge:`{name} 超过 500 MB`,new:`[ 新建 ]`,routinePause:`[ 暂停 ]`,routineEnable:`[ 启用 ]`,delete:`[ 删除 ]`,routinesNeedYou:`需要处理`,routinesActive:`运行中`,routinesPaused:`已暂停`,laterStarts:`稍后启动`,laterCancel:`[ 取消 ]`,laterFailed:`没有启动:{error}`,laterCancelFailed:`取消失败:{error}`,routineSchedule:`调度`,routineNext:`下次执行`,routineProject:`项目`,routineDelivers:`投递到`,routineEngine:`引擎`,routineChangeEngine:`[ 更换 ]`,routinePrompt:`提示词`,routineScript:`脚本`,cronDown:`减小{field}`,cronUp:`增大{field}`,storySave:`保存`,storySaveStart:`保存并启动`,storyStart:`启动`,attachHintTouch:`粘贴路径 / 截图 → 插入图片占位行`}},mt=n({en:()=>ht,zh:()=>gt}),ht={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`}},gt={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:`终端末尾`}},_t=n({en:()=>vt,zh:()=>yt}),vt={usage:{title:`Usage`,receipt:`Usage receipt`,total:`Total tokens`,thanks:`Thank you, burn again soon`,open:`Open usage`,range:`last {days} days · tokens are input + output`,perDay:`Per day`,byModel:`By engine and model`,topTasks:`Top tasks`,quota:`Quota`,turns:`{count} turns`,loading:`Loading…`,empty:`No turns recorded in this window.`,failed:`Could not read usage: {error}`,cutoff:`The daemon returns at most {count} turns: {day} and earlier are partial.`,noReader:`{engines}: no turn reader, so their work is not counted here.`,removedTask:`(removed task)`,full:`at this pace full around {time}, before it resets`,lasts:`at this pace it lasts until the reset`}},yt={usage:{title:`用量`,receipt:`用量小票`,total:`合计 token`,thanks:`谢谢惠顾,欢迎再烧`,open:`打开用量`,range:`最近 {days} 天 · token 为输入加输出`,perDay:`按天`,byModel:`按引擎和模型`,topTasks:`用量最高的任务`,quota:`额度`,turns:`{count} 轮`,loading:`加载中…`,empty:`这段时间没有记录到任何一轮。`,failed:`无法读取用量:{error}`,cutoff:`守护进程最多返回 {count} 轮:{day} 及更早的数据不完整。`,noReader:`{engines}:没有轮次读取器,这里不统计它们的工作。`,removedTask:`(已删除的任务)`,full:`按当前速度约 {time} 用完,早于重置时间`,lasts:`按当前速度可撑到重置`}},bt=n({en:()=>xt,zh:()=>St}),xt={voice:{say:`Say`,stop:`Stop {time}`,release:`Release {time}`,working:`Hearing…`,hint:`Dictate: tap to start and stop, or hold to talk and let go`,slideToSend:`Slide up to send`,tipSend:`Let go to send`,hold:`Hold to talk`,holdOrType:`Hold to talk, tap to type`,learned:`Learned {pairs}`,learnedPair:`{spoken} → {term}`,undo:`undo`,unlearned:`Forgotten`,unlearnFailed:`Couldn't undo: the voice sidecar isn't answering`,setup:{dictation:`Dictation`,backend:{off:`Off`,local:`On this Mac`,cloud:`Cloud`},unavailable:`This Rove cannot set up dictation`,offHint:`The mic is hidden. Nothing runs in the background.`,localNeeded:`Install the model below; the mic shows once it is ready.`,localInstalling:`Installing the model; the mic shows once it is ready.`,cloudNeeded:`Save an endpoint below to turn dictation on.`,ready:`{model} · ready`,starting:`Starting…`,localTitle:`Whisper large-v3`,localHint:`Runs on this Mac's GPU, about 3.5 GB to download. Audio never leaves the Mac.`,install:`Install`,installing:`Installing…`,installed:`Installed, about 4 GB on disk.`,failed:`Install failed: {line}`,uninstall:`Uninstall`,uninstallAsk:`Remove the model?`,cancel:`Cancel`,cloudTitle:`Cloud endpoint`,cloudHint:`Any OpenAI-compatible /audio/transcriptions service. The audio and your terms go there; the key stays on the Mac.`,baseURL:`Base URL`,model:`Model`,apiKey:`API key`,keySaved:`Saved; leave empty to keep it`,save:`Save`,saveAndUse:`Save and use`,forget:`Forget`,forgetAsk:`Remove the endpoint and its key?`}}},St={voice:{say:`说`,stop:`停 {time}`,release:`松手 {time}`,working:`在听…`,hint:`口述:点一下开始、再点一下结束,或按住说话、松手结束`,slideToSend:`上滑发送`,tipSend:`松手发送`,hold:`按住说话`,holdOrType:`按住说话,轻点打字`,learned:`记住了 {pairs}`,learnedPair:`{spoken} → {term}`,undo:`撤销`,unlearned:`已撤销`,unlearnFailed:`没能撤销:语音服务没有响应`,setup:{dictation:`语音输入`,backend:{off:`关闭`,local:`本机`,cloud:`云端`},unavailable:`这个 Rove 无法设置语音输入`,offHint:`不显示麦克风,后台也不运行任何东西。`,localNeeded:`在下面安装模型,就绪后显示麦克风。`,localInstalling:`正在安装模型,就绪后显示麦克风。`,cloudNeeded:`在下面保存一个服务地址后开启。`,ready:`{model} · 就绪`,starting:`启动中…`,localTitle:`Whisper large-v3`,localHint:`在这台 Mac 的 GPU 上运行,约需下载 3.5 GB。音频不离开这台 Mac。`,install:`安装`,installing:`安装中…`,installed:`已安装,约占 4 GB 磁盘。`,failed:`安装失败:{line}`,uninstall:`卸载`,uninstallAsk:`删除模型?`,cancel:`取消`,cloudTitle:`云端服务`,cloudHint:`任何兼容 OpenAI /audio/transcriptions 的服务。音频和你的术语会发到那里;密钥只存在这台 Mac 上。`,baseURL:`Base URL`,model:`模型`,apiKey:`API 密钥`,keySaved:`已保存;留空则保留原密钥`,save:`保存`,saveAndUse:`保存并使用`,forget:`删除`,forgetAsk:`删除这个服务地址和密钥?`}}},Ct=n({en:()=>wt,zh:()=>Tt}),wt={workspace:{pickTask:`pick a task on the left`,noTabs:`no open sessions in this task`,startEngine:`Start {engine}`,startSession:`Start session`,tabNotLive:`this tab has no running session`,restored:`restored session, read-only until reopened`,exited:`session ended (exit {code})`,attachFailed:`could not open this session: {message}`,reopen:`Reopen session`,reopening:`Reopening…`,reopenFailed:`could not reopen this session: {message}`,engineExited:`engine exited (code {code})`,retry:`Retry`,engineSettings:`Settings → Engines`,usageLimitUntil:`usage limit reached — rove resumes this task at {time}`,resumeQuota:`resume now`,resumingQuota:`resuming…`,usageLimit:`usage limit reached`,dismiss:`Dismiss`,openTask:`Open`},tab:{shell:`shell`,engine:`engine`},firstRun:{title:`All your coding agents, in one place`,body:`When one runs out of quota, switch the task to another. Agents talk to each other directly, and every task gets its own worktree and branch.`,start:`Start your first task`},status:{connecting:`connecting`,retrying:`reconnecting, attempt {count}`,retry:`retry now`,backlog:`Backlog`,inProgress:`In progress`,inReview:`In review`,done:`Done`,canceled:`Canceled`,error:`Error`},connect:{title:`open the link rove printed`,body:"Run `rove --web` and open the link it prints, or paste it here.",placeholder:`http://127.0.0.1:7878/#token=…`,submit:`connect`,invalid:"that is not a `rove --web` link",failing:"can't reach rove. Is `rove --web` still running? After `--rotate-token`, open the new link.",forget:`forget this link`,notConnected:`not connected to rove — reconnecting (the view refreshes on its own)`},relay:{unpaired:"open the relay link that `rove --web --preset relay` printed on your computer",connecting:`connecting to your computer through the relay…`,loading:`loading rove…`,offline:"your computer is not answering on this relay. Is `rove --web --preset relay` still running? After `--rotate-relay`, open the new link. Reload to retry.",failed:`can't reach your computer through the relay ({error}). Reload to retry.`},login:{title:`sign in`,body:`Enter this Rove's password.`,field:`password`,submit:`sign in`,checking:`checking…`,wrong:`that did not work`,locked:`too many tries from here; try again in {minutes} min`,lockedHost:"password login is locked; run `rove --web --unlock` on the host",unreachable:"can't reach rove. Is `rove --web` still running?"},layout:{splitTooSmall:`Not enough room to split here`,railFold:`Fold the task list`,navBack:`Back`,navForward:`Forward`,railUnfold:`Unfold the task list`,dropUploading:`Uploading {name}…`,pasteNoImage:`No image on this browser's clipboard`,pasteNoAccess:`Can't read this browser's clipboard: {error}`,pasteNeedsHttps:`the page needs https or localhost`,refreshTimeout:"The daemon did not come back on the new build in time; check `rove daemon status`",railResize:`Drag to resize the task list, click to fold it, double-click to reset`,composerPlaceholder:`Message the agent`,composerSend:`Send`,composerAttach:`Attach a file`,composerNotSent:`Not sent: {reason}`,composerOldBridge:`This Mac's rove --web is older than this page; restart it to send from here.`,composerAtMenu:`The agent is waiting on a choice. Answer it with the 1–4 and ⏎ keys below; your message is kept.`,termKeys:`Terminal keys`,termKeyUp:`Up arrow`,termKeyDown:`Down arrow`,termKeyLeft:`Left arrow`,termKeyRight:`Right arrow`,termKeyInterrupt:`Ctrl+C, interrupt`,termKeyEnter:`Enter`,narrowTerminal:`Terminal`}},Tt={workspace:{pickTask:`从左边选一个任务`,noTabs:`这个任务没有打开的会话`,startEngine:`启动 {engine}`,startSession:`启动会话`,tabNotLive:`这个标签没有在运行的会话`,restored:`已恢复的会话,重新打开前只读`,exited:`会话已结束(退出码 {code})`,attachFailed:`打不开这个会话:{message}`,reopen:`重新打开会话`,reopening:`正在重新打开…`,reopenFailed:`重新打开失败:{message}`,engineExited:`引擎已退出(退出码 {code})`,retry:`重试`,engineSettings:`设置 → 引擎`,usageLimitUntil:`已达到用量上限 —— rove 会在 {time} 自动继续这个任务`,resumeQuota:`现在继续`,resumingQuota:`正在继续…`,usageLimit:`已达到用量上限`,dismiss:`忽略`,openTask:`打开`},tab:{shell:`终端`,engine:`引擎`},firstRun:{title:`所有编程 agent,都在一个地方`,body:`一个额度用完了,换另一个接着干;agent 之间直接对话。每个任务有独立的 worktree 和分支,互不覆盖。`,start:`开始第一个任务`},status:{connecting:`连接中`,retrying:`重连中,第 {count} 次`,retry:`立即重试`,backlog:`待办`,inProgress:`进行中`,inReview:`待评审`,done:`已完成`,canceled:`已取消`,error:`出错`},connect:{title:`打开 rove 打印的链接`,body:"运行 `rove --web`,打开它打印的链接,或者把链接粘贴到这里。",placeholder:`http://127.0.0.1:7878/#token=…`,submit:`连接`,invalid:"这不是 `rove --web` 打印的链接",failing:"连不上 rove。`rove --web` 还在运行吗?用过 `--rotate-token` 的话,请打开新的链接。",forget:`忘掉这个链接`,notConnected:`没有连上 rove,正在重连(连上后这里会自动刷新)`},relay:{unpaired:"打开电脑上 `rove --web --preset relay` 打印的 relay 链接",connecting:`正在通过 relay 连接你的电脑…`,loading:`正在加载 rove…`,offline:"你的电脑没有在这个 relay 上应答。`rove --web --preset relay` 还在运行吗?用过 `--rotate-relay` 的话,请打开新的链接。刷新重试。",failed:`无法通过 relay 连到你的电脑({error})。刷新重试。`},login:{title:`登录`,body:`输入这台 Rove 的密码。`,field:`密码`,submit:`登录`,checking:`验证中…`,wrong:`登录失败`,locked:`这里尝试次数过多;{minutes} 分钟后再试`,lockedHost:"密码登录已锁定;在主机上运行 `rove --web --unlock`",unreachable:"连不上 rove。`rove --web` 还在运行吗?"},layout:{splitTooSmall:`这里放不下分屏了`,railFold:`折叠任务列表`,navBack:`后退`,navForward:`前进`,railUnfold:`展开任务列表`,dropUploading:`正在上传 {name}…`,pasteNoImage:`浏览器剪贴板里没有图片`,pasteNoAccess:`读不到浏览器剪贴板:{error}`,pasteNeedsHttps:`页面要走 https 或 localhost`,refreshTimeout:"守护进程没能及时以新版本重新上线,请检查 `rove daemon status`",railResize:`拖动调整任务列表宽度,单击折叠,双击还原`,composerPlaceholder:`给 agent 发消息`,composerSend:`发送`,composerAttach:`附加文件`,composerNotSent:`没发出去:{reason}`,composerOldBridge:`这台 Mac 上的 rove --web 比页面旧,重启它之后才能从这里发送。`,composerAtMenu:`agent 正在等你选择。用下方的 1–4 和 ⏎ 键回答;你的消息已保留。`,termKeys:`终端按键`,termKeyUp:`上方向键`,termKeyDown:`下方向键`,termKeyLeft:`左方向键`,termKeyRight:`右方向键`,termKeyInterrupt:`Ctrl+C 中断`,termKeyEnter:`回车`,narrowTerminal:`终端`}},Et=[nt,Ct,We,Xe,dt,Re,$e,ct,_t,mt,qe,Fe,at,Ve,bt],Dt=Object.assign({},...Et.map(e=>e.en)),Ot={en:Dt,zh:Object.assign({},...Et.map(e=>e.zh))};function kt(){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 At=v(kt());function jt(){let e=typeof document>`u`?void 0:document.documentElement;e&&(e.lang=At.get()===`zh`?`zh-CN`:`en`)}jt(),At.subscribe(jt);function Mt(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 Nt(e,t){return t?e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??e)):e}function B(e,t){return Nt(Mt(Ot[At.get()],e)??Mt(Dt,e)??e,t)}function Pt(e,t,n){return Nt(Mt(e[At.get()],t)??Mt(e.en,t)??t,n)}function V(){return y(At)}function Ft(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 It=(...e)=>e.filter(Boolean).join(` `),Lt=`text-meta leading-[inherit]`,Rt=`font-normal normal-nums`,zt=`touch:relative touch:after:absolute touch:after:content-['']`,Bt=`flex h-full flex-col`,Vt=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))_minmax(0,1fr)_minmax(0,var(--panel-w,33%))]`,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(` `),Ht=[`relative narrow-content:hidden narrow-back:col-1 narrow-back:row-1 touch:select-none touch:touch-callout-none`,`wide:overflow-x-clip wide:pt-8.5 wide:[&>:not([data-grip])]:min-w-(--rail-open-w)`,`rail-folded:absolute rail-folded:inset-y-1.5 rail-folded:left-1.5 rail-folded:z-6 rail-folded:col-1 rail-folded:row-1 rail-folded:box-border rail-folded:w-(--rail-open-w) rail-folded:-translate-x-[calc(100%+12px)] rail-folded:rounded-md rail-folded:border-hairline rail-folded:border-line rail-folded:bg-surface rail-folded:shadow-none rail-folded:transition-[translate] rail-folded:duration-200 rail-folded:ease-snap rail-folded:motion-reduce:transition-none rail-folded:[&>:not([data-grip])]:min-w-0`,`rail-peek:translate-none rail-peek:shadow-dialog`].join(` `),Ut=`rail-folded:col-2 panel-expanded:invisible panel-expanded:col-2 narrow-sidebar:hidden narrow-back:z-1 narrow-back:col-1 narrow-back:translate-x-(--back-x) narrow-back:bg-paper narrow-back:shadow-dialog`,Wt=`rail-folded:col-3 panel-expanded:z-2 panel-expanded:col-[2/-1] panel-expanded:bg-paper panel-expanded:pl-2`,Gt=`${zt} touch:after:-inset-x-1.5 touch:after:-inset-y-3`,Kt=`flex items-center gap-2`,qt=`flex min-w-0 items-baseline gap-1.5 px-1.5 py-0.5 text-meta font-bold ${zt} touch:after:-inset-2.5 touch:after:-bottom-1`,Jt=`flex items-center rounded-sm px-2.5 py-1.5 text-muted aria-selected:bg-inset aria-selected:text-ink [&_svg]:size-4 ${zt} touch:after:-inset-x-px touch:after:-top-2 touch:after:-bottom-1.5`,Yt=`keys-only m-0 overflow-hidden px-3.5 py-1 text-meta text-ellipsis whitespace-nowrap`,Xt=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`}`,Zt=`relative min-w-0 flex-1`,Qt={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)]`]},$t=(e,t)=>Qt[e][+!!t],en=(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?$t(`left`,t.active):``} ${t.top?$t(`top`,t.active):``} ${t.left||t.top?r:``}`:e===`rail`?`${n} ${$t(`left`,t.active)} ${r} ${t.top?`[--mt:6px]`:``}`:e===`rule`?`${n} ${$t(`top`,t.active)} ${r} ${t.left?`[--ml:8px]`:``}`:n},tn=(e,t)=>`absolute right-2 z-3 bg-paper px-1 font-mono text-meta ${Rt} ${e?`-top-2`:`top-0.5`} ${t?`text-accent`:`text-subtle`}`,nn=`hidden gap-1 overflow-x-auto scrollbar-none [border-top:var(--hairline)_solid_var(--line)] bg-surface px-1.5 py-1 touch:flex`,rn=e=>`h-10 min-w-max touch-manipulation [flex:1_1_0] rounded-sm border-hairline bg-inset px-0.5 py-0 font-mono text-meta ${Rt} ${e?`border-accent text-accent`:`border-line text-ink`}`,an=`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`,on=`min-w-[3ch] text-accent`,sn=`mb-1.5 flex justify-between gap-4`,cn=`columns-[2_220px] gap-x-5`,ln=`mb-2 break-inside-avoid`,un=`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`,dn=`mx-0 my-2 overflow-x-hidden overflow-y-auto scrollbar-none`,fn=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 ${Rt} whitespace-pre text-ink touch:py-2.5 ${e?`is-selected bg-hover`:``}`,pn=`min-w-0 overflow-hidden text-ellipsis`,mn=`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`,hn=`flex justify-between gap-4`,gn=`flex flex-col items-end ${Lt}`,_n=`mt-2 max-h-[52vh] overflow-y-auto`,vn=`mb-2.5`,yn=`m-0 mb-1 font-sans text-meta font-bold normal-nums text-accent`,bn=`flex gap-3 py-px ${Lt}`,xn=`min-w-[14ch] text-ink`,Sn=`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`,Cn=`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 ${Rt} text-ink shadow-popover`,wn=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]`}`,Tn=`m-auto font-mono text-meta ${Rt} text-subtle`,En=`${Tn} flex flex-col items-center gap-3 [&_p]:m-0`,Dn=`workspace isolate row-1 flex min-h-0 min-w-0 flex-col gap-1.5 px-1 pt-2 pb-1`,On=`flex min-h-0 flex-1 overflow-hidden rounded-md border-hairline border-line bg-paper focus-within:border-focus`,kn=`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`,An=`relative flex min-w-0 flex-1 flex-col`,jn=`relative flex min-h-0 min-w-0 flex-1 flex-col`,Mn=`term-host relative min-h-0 min-w-0 flex-1 touch-none overflow-clip`,Nn=`pointer-events-none absolute inset-0 z-5 h-full w-full`,Pn=`relative h-full [&.is-leaving]:pointer-events-none [&.is-leaving]:absolute [&.is-leaving]:inset-0 [&.is-leaving]:z-6`,Fn=`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)]`,In=e=>`absolute right-2.5 bottom-2.5 z-5 flex max-w-[calc(100%-20px)] flex-wrap items-center gap-x-3 gap-y-1 rounded-sm border-hairline border-line bg-inset px-2.5 py-1.25 font-mono text-meta ${Rt} ${e?`text-error`:`text-muted`} [&_.link:disabled]:pointer-events-none [&_.link:disabled]:opacity-60 [&_button]:whitespace-nowrap`,Ln=`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 ${Rt} whitespace-nowrap text-muted`,Rn=e=>`size-1.5 rounded-full ${e?`bg-warning`:`bg-subtle`}`,zn=`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`,Bn=`col-span-3 grid cursor-pointer grid-cols-subgrid items-center text-left hover:text-ink`,Vn={ok:`text-muted`,warn:`text-warning`,crit:`text-error`},Hn={ok:`text-success`,warn:`text-warning`,crit:`text-error`},Un=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-[''] ${Hn[e]??Hn.ok}`,Wn=`font-mono text-title font-bold normal-nums tracking-[0.02em] whitespace-nowrap`,Gn=`text-accent`,Kn=`grid h-full place-items-center p-6`,qn=`flex w-[min(460px,100%)] flex-col gap-3 rounded-md border-hairline border-line bg-surface p-6 [&_p]:m-0`,Jn=`flex flex-col gap-2 p-3.5 text-left font-sans text-meta ${Rt} leading-[1.5]`,Yn=`flex-none fill-none stroke-current [stroke-linecap:round] [stroke-linejoin:round] [stroke-width:1.25]`,Xn=(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`}`,Zn=`absolute top-2 left-[calc(--spacing(2)+var(--shell-inset-left,0px))] z-7 flex items-center gap-0.5`,Qn=`[&.is-resizing_iframe]:pointer-events-none`,$n=e=>`side-panel ${Wt} relative row-1 flex min-h-0 min-w-0 flex-col ${Qn} ${e?`flex-1 p-0`:`pt-2 pr-1 pb-1 pl-0`}`,er=`grid min-h-0 flex-1 grid-rows-[minmax(0,1fr)] [--divider:5px] ${Qn}`,tr=`side-col row-1 flex min-h-0 min-w-0 flex-col`,nr=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`}`,rr=`min-w-0 flex-1 truncate px-2 text-ink`,ir=`flex min-w-0 flex-1 items-center gap-0.5`,ar=`scrollbar-none flex min-w-0 gap-0.5 overflow-x-auto`,or=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`}`,sr=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`}`,cr=`truncate`,lr=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`}`,ur=`ml-auto flex gap-0.5`,dr=`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-['']`,fr=`side-view flex min-h-0 min-w-0 flex-1 flex-col [&[hidden]]:hidden`,pr=`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`,mr=`flex min-h-0 flex-1 flex-col gap-1.5`,hr=`flex items-center gap-0.5 [&_svg]:flex-none`,gr=`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`,_r=`min-w-0 flex-1 rounded-sm border-none bg-paper`,vr=`relative flex min-h-0 min-w-0 flex-1`,yr=`absolute inset-0 size-full cursor-crosshair touch-none fill-none stroke-accent [stroke-linecap:round] [stroke-linejoin:round] [stroke-width:2.5]`,br=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})),H=t(((e,t)=>{t.exports=br()}))(),xr=({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`,Sr={link:`text-accent hover:underline`,filled:xr(),danger:xr({danger:!0}),action:`rounded-sm border-hairline border-line bg-inset px-3 py-1.5 font-sans text-meta text-ink hover:border-line-active hover:bg-menu active:scale-97 motion-reduce:active:scale-none disabled:cursor-default disabled:opacity-50 touch:min-h-10 focus-visible:outline-1 focus-visible:outline-offset-1 focus-visible:outline-focus`,floating:`whitespace-nowrap rounded-sm border-hairline border-line-active bg-surface px-2 py-0.5 font-mono text-meta text-ink shadow-popover`,row:``,pill:`inline-flex flex-none items-center gap-1.5 whitespace-nowrap font-mono text-meta text-muted hover:text-ink aria-[current=true]:text-accent`,icon:Xn({small:!0}),iconOn:Xn({small:!0,on:!0}),card:`flex min-w-0 flex-col gap-1.5 rounded-sm border-hairline p-1.5 text-left focus-visible:outline-1 focus-visible:outline-offset-1 focus-visible:outline-focus`},Cr={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 U({variant:e=`link`,hit:t=e===`link`?`roomy`:`none`,className:n,type:r=`button`,...i}){return(0,H.jsx)(`button`,{type:r,className:It(Sr[e],Cr[t],n),...i})}var wr=`mx-2.5 my-3 font-mono text-meta text-subtle`,Tr=`font-sans text-meta text-subtle`,Er=`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`,Dr=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`:``}`,Or=`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`,kr=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`}`,W=`m-0 font-sans text-meta font-medium normal-nums`,Ar=`link text-accent [&:hover]:underline touch-hit`,jr=`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`,Mr=`${jr} w-full px-2.5 py-2`,Nr=`actions flex items-center justify-end gap-3.5`;function Pr({failing:e=!1}){V();let[t,n]=(0,h.useState)(``),[r,i]=(0,h.useState)(!1);return(0,H.jsx)(`div`,{className:Kn,children:(0,H.jsxs)(`form`,{className:qn,onSubmit:e=>{e.preventDefault();let n=Ft(t);if(!n){i(!0);return}a(n),window.location.reload()},children:[(0,H.jsxs)(`span`,{className:Wn,children:[(0,H.jsx)(`span`,{className:Gn,children:`[`}),` rove `,(0,H.jsx)(`span`,{className:Gn,children:`]`})]}),(0,H.jsx)(`h1`,{className:`${W} text-muted`,children:B(`connect.title`)}),(0,H.jsx)(`p`,{className:e?`text-error`:`text-muted`,children:B(e?`connect.failing`:`connect.body`)}),(0,H.jsx)(`input`,{className:Mr,autoFocus:!0,spellCheck:!1,placeholder:B(`connect.placeholder`),value:t,onChange:e=>{n(e.target.value),i(!1)}}),r&&(0,H.jsx)(`p`,{className:`text-error`,children:B(`connect.invalid`)}),(0,H.jsxs)(`div`,{className:Nr,children:[e&&(0,H.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>{o(),window.location.reload()},children:B(`connect.forget`)}),(0,H.jsx)(`button`,{type:`submit`,className:xr(),children:B(`connect.submit`)})]})]})})}var Fr=`flex flex-col gap-1.5`,Ir=`min-h-18 max-h-[50vh] leading-[1.45]`,Lr=`flex flex-wrap gap-1.5`,Rr=(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`}`}`,zr=`m-0 list-none p-0`,Br=`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`,Vr=(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`,Hr=`flex items-center justify-between gap-3`,Ur=`m-0 min-w-0 font-sans text-title leading-[1.4] font-semibold normal-nums text-ink wrap-anywhere`,Wr=`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-['']`,Gr=`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`,Kr=(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`,qr=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`:``}`,Jr=`font-mono text-meta normal-nums`,Yr=e=>`${Jr} ${e.danger&&e.selected?`text-inherit`:e.selected?`text-muted`:`text-subtle`} touch:hidden!`,Xr=e=>`${Jr} ${e?`text-ink`:`text-subtle`}`,Zr=`${Jr} text-accent`,Qr=`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`,$r=`flex cursor-default items-baseline gap-x-3`,ei=`min-w-0 flex-1`,ti=`flex-none whitespace-nowrap font-mono`,ni=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`,ri=`text-subtle`,ii=`flex items-baseline justify-between gap-3`,ai=`mt-1`,oi=`m-0 flex list-none flex-col gap-0.5 p-0`,si=`flex min-w-0 items-baseline gap-2.5`,ci=`flex-none font-mono text-meta font-normal normal-nums min-w-[3ch] text-right text-subtle`,li=`flex items-baseline gap-1`,ui=`min-w-0 flex-1`,di=`flex-none min-w-[calc(9ch+0.5rem)] whitespace-nowrap pr-2 text-right font-mono text-meta`,fi=`font-mono [&:hover]:text-accent`,pi={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`},mi=`bg-hover cursor-grabbing scale-[1.02] motion-reduce:scale-none`;function hi(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?mi: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`:``} ${t} ${pi[e.size??`row`]} ${n}`}var gi=`row-title min-w-0 flex-1 truncate`,_i=`row-title min-w-0 flex-auto truncate text-(length:--fs-title)`,vi=`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`,yi=`w-[1ch] flex-none text-center font-mono`,bi=`grid w-[2ch] flex-none place-items-center font-mono text-subtle`,xi=`flex flex-none gap-1.5 font-mono text-meta`;function G(e){return e instanceof Error?e.message:String(e)}function Si(e){V();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(),z())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,H.jsx)(`div`,{className:Br,onMouseDown:e=>e.target===e.currentTarget&&z(),children:(0,H.jsxs)(`dialog`,{ref:t,tabIndex:-1,open:!0,className:Vr(e.wide),"aria-label":e.title,children:[(0,H.jsxs)(`div`,{className:Hr,children:[(0,H.jsx)(`h1`,{className:Ur,children:e.title}),(0,H.jsx)(`button`,{type:`button`,className:Wr,"aria-label":B(`dialog.close`),title:B(`dialog.close`),onClick:z,children:`×`})]}),e.children]})})}function Ci(){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(),z()}catch(e){r(G(e))}finally{t(!1)}}}}function wi(e){let[t,n]=(0,h.useState)(e.initial??``),{busy:r,error:i,submit:a}=Ci();return(0,H.jsx)(Si,{title:e.title,children:(0,H.jsxs)(`form`,{className:Gr,onSubmit:n=>{n.preventDefault(),(t.trim()||e.allowEmpty)&&a(()=>e.onSubmit(t.trim()))},children:[e.multiline?(0,H.jsx)(`textarea`,{className:`${Mr} ${Ir}`,"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,H.jsx)(`input`,{className:Mr,"aria-label":e.title,autoFocus:!0,spellCheck:!1,value:t,onChange:e=>n(e.target.value),onFocus:e=>e.currentTarget.select()}),i&&(0,H.jsx)(`p`,{className:`text-error`,children:i}),(0,H.jsx)(Di,{busy:r,submitLabel:e.submitLabel})]})})}function Ti(e){let{busy:t,error:n,setError:r,submit:i}=Ci(),[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(G(n))),n}});return(0,H.jsx)(Si,{title:a&&e.escalate?.title||e.title,children:(0,H.jsxs)(`div`,{className:Gr,children:[(0,H.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,H.jsx)(`p`,{className:`text-error`,children:n}),(0,H.jsxs)(`div`,{className:Nr,children:[(0,H.jsx)(`button`,{type:`button`,className:Ar,onClick:z,children:B(`dialog.cancel`)}),e.secondary&&!a&&(0,H.jsx)(`button`,{type:`button`,className:xr({danger:!0}),disabled:t,onClick:()=>f(!0),children:e.secondary.label}),(0,H.jsx)(`button`,{ref:d,type:`button`,className:xr({danger:!0}),disabled:t,onClick:()=>f(!1),children:a&&e.escalate?e.escalate.label:e.confirmLabel})]})]})})}function Ei(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}=Ci(),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,H.jsx)(Si,{title:e.title,children:(0,H.jsxs)(`div`,{className:Gr,children:[(0,H.jsx)(`ul`,{className:zr,children:e.choices.map((t,a)=>(0,H.jsx)(`li`,{children:(0,H.jsxs)(`button`,{type:`button`,"aria-pressed":t.value===e.current,disabled:i,className:hi({selected:a===n}),onMouseEnter:()=>r(a),onClick:()=>s(t.value),children:[(0,H.jsx)(`span`,{className:`${yi} text-accent`,children:t.value===e.current?`●`:` `}),(0,H.jsx)(`span`,{className:gi,children:t.label})]})},t.value))}),a&&(0,H.jsx)(`p`,{className:`text-error`,children:a})]})})}function Di({busy:e,submitLabel:t}){return(0,H.jsxs)(`div`,{className:Nr,children:[(0,H.jsx)(`button`,{type:`button`,className:Ar,onClick:z,children:B(`dialog.cancel`)}),(0,H.jsx)(`button`,{type:`submit`,className:xr(),disabled:e,children:t})]})}function K(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 Oi={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`}},ki={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:`提交`}},Ai={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"}},ji={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"}},Mi={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."}},Ni={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`,然后重试。"}},Pi={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`}},Fi={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} 在这台机器上不可用——去 设置 → 自动路由 重新指定`}},Ii={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`},Li={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} 里已有补全配置 — 未改动`},Ri={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`},zi={title:`快速任务 · {repoLabel}`,promptLabel:`提示词`,promptPlaceholder:`这个任务要做什么?`,attemptsLabel:`尝试次数`,engineLabel:`引擎`,branchLabel:`分支`,legend:`enter 创建 · tab 切换字段 · ctrl+e 引擎 · ctrl+v 附件 · esc 取消`,startedRound:`已启动 {count} 个尝试`,roundPartial:`已启动 {ok}/{count} 个尝试 —— {failed} 个失败`},Bi={cancel:`cancel`,forgetProjectTitle:`Remove project "{title}"?`,forgetProjectBody:"Forgets it from the projects list and closes the sessions in its main checkout. The repo, its branches, worktrees, and any tasks under it stay on disk — re-add it with `rove add`.",forgetProjectConfirm:`remove`,deleteTitle:`Remove session "{title}"?`,deleteTitleDir:`Remove session "{title}"?`,deleteBodyDir:`Ends this session and closes all its tabs. Nothing on disk changes: the folder and its files stay.`,deleteBodyMain:`Ends this session and closes all its tabs. The project stays in your list and nothing on disk changes: the repo, its branches and worktrees stay.`,deleteBodyTask:`Ends this session, closes all its tabs and removes its worktree folder. The git branch stays.`,deleteBodyTaskBranch:`Ends this session, closes all its tabs and removes its worktree folder, and its git branch if it is merged. An unmerged branch stays.`,deleteConfirm:`remove`,childrenTitle:`"{title}" has {count} child tasks`,childrenBody:`Promote moves them up one level and keeps their worktrees and sessions. Remove with children removes them too.`,childrenPromote:`promote children`,childrenCascade:`remove with children`,childrenBodyMain:`Ends this session and closes its tabs; nothing on disk changes. Its child tasks keep running unless you delete them too.`,childrenKeepMain:`remove session`,childrenCascadeMain:`remove with children`,forceDeleteTitle:`"{title}" has uncommitted changes`,forceDeleteConfirm:`force remove`,legacyAdoptTitle:`Remove {count} sessions Rove added by itself?`,legacyAdoptBody:`An older Rove added a session whenever a worktree was created outside it. It no longer does. These look like leftovers:
16
+ 这个 worktree 在该 PR 的头部({head},合入 {base})。对照 {base} 阅读改动(git diff origin/{base}...HEAD),然后告诉我你的发现:bug、风险、缺失的测试、不清楚的地方。不要推送、评论或批准这个 PR;在这里汇报。`}},ct=n({en:()=>lt,zh:()=>ut}),lt={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`}},ut={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} 条`}},dt=n({en:()=>ft,zh:()=>pt}),ft={settings:{title:`Settings`,open:`settings`,sections:{connectors:`Connectors`,appearance:`Appearance`,notifications:`Notifications`,snippets:`Snippets`,about:`About`,voice:`Voice`},groups:{preferences:`Preferences`,agents:`Agents and tools`,more:`More`},pages:{general:`Language, layout, and where Rove opens files and creates worktrees.`,appearance:`Theme, colours, and how tasks and panes look.`,notifications:`When Rove tells you a task finished or needs you.`,keys:`Rebind chords in your own file, and how the prefix guide behaves.`,engines:`The coding agents Rove can start, and how it plugs into them.`,autoRouting:`What each depth tier starts, and who picks the tier.`,voice:`Dictation: the recognizer that turns what you say into prompts.`,connectors:`Accounts Rove uses, here and on your other machines.`,plugins:`Built-in pages and registered plugins.`,about:`Versions, updates, and this browser.`,feedback:`Send a note to the Rove team.`,dev:`Experimental switches, restarts and resets.`,snippets:`Prompt text you reuse. Type @name in a prompt to insert it.`},connectors:{githubDescription:`Clone, push and open PRs on every machine with one GitHub account`,connect:`Connect`,disconnect:`Disconnect`,disconnectBody:`Signs this machine's gh out of GitHub, for every tool that uses gh and not only Rove. Other machines keep their own sign-ins.`,machines:`Machines`,thisMachine:`This machine`,machinesHint:`Each machine signs in to GitHub by itself. The mark says whether it uses the same account as this one.`,refresh:`Check again`,refreshing:`Checking…`,useRove:`Use Rove's account`,loginThere:`Log in there`,codeHint:`Enter this code at GitHub (click the code to copy it)`,openGithub:`Open github.com/login/device`,codeCopied:`Code copied`,syncing:`Signed in. Bringing the other machines along…`,loginFailed:`Sign-in failed: {error}`,dismiss:`Dismiss`,loading:`checking…`,markSame:`✓ same account`,markDifferent:`⚠ @{login}`,markSignedOut:`✗ signed out`,markNoGh:`gh is not installed`,markOutdated:`Rove there is outdated`,markOffline:`offline`,markDenied:`refuses credential changes`,markFailed:`could not check`,detail:`git over {protocol} · SSH key {ssh}`,synced:`{machine} now uses @{login}`},general:{groupInterface:`Interface`,groupFiles:`Worktrees`,groupTerminal:`Terminal`,tabStrip:`Tab strip`,scrollback:`Scrollback`},appearance:{groupColours:`Colours`,groupTasks:`Tasks and panes`,taskColorsNote:`Gives each task its own hue on the working border and in the list.`,colorblindNote:`Shows added and removed lines in blue and red instead of green and red.`,workingBorderNote:`The pane's border while the selected task is working.`,railGroup:`Task list`,railGroupProject:`By project`,railGroupState:`By state`,statusMark:`Task status`,statusMarkEngine:`Engine icon`,statusMarkBoth:`Icon and dots`,statusMarkDots:`Dots only`,previewWorking:`Working`,previewDone:`Finished, unread`,previewIdle:`Idle`,previewWaiting:`Waiting for you`,previewBroken:`Broken`,previewTitle:`Fix the login redirect`},notifications:{toastNote:`A popup in the corner of this page.`,volume:`Chime volume`},about:{groupRove:`Rove`,daemon:`Daemon`,daemonCurrent:`rove {version}, same build as this page`,daemonStale:"rove {version} is out of date; run `rove daemon restart`",updates:`Updates`,browser:`This browser`,browserHint:`Forget this browser's token. A login token is revoked on the host too.`,access:`Access`,signIn:`Sign-in`,signInMode:{open:`None`,password:`Password`,token:`Token link`},signInHint:{open:`A browser on this computer opens Rove with no link or password. Phones and other computers still need a token.`,password:`A browser without a token signs in with the password. Token links keep working.`,token:`Only the link rove printed, or a device token, gets in. Password sign-in is off.`},passwordSet:`Set a password`,passwordChange:`Change the password`,passwordHint:`At least {min} characters. It is stored hashed on this computer.`,passwordField:`New password`,passwordSave:`Save`,signOut:`Sign out`},engines:{enabled:`Offer {name} when picking an engine`,default:`Make {name} the default engine`,namePlaceholder:`Display name (blank = default)`,rename:`Rename`,reset:`Reset to defaults`,remove:`Remove engine`,save:`Save`,cancel:`Cancel`},plugins:{builtIn:`Built in`,builtInHint:`First-party pages. Turning one off removes its entry from the rail.`,registered:`Registered plugins`,empty:`No other plugins registered.`,linked:`linked`,unsupportedPlatform:`unsupported platform`,turnOn:`Install {name}`},feedback:{hint:"Files a public GitHub issue on the Rove repo, through `gh` on the machine running rove. Without a signed-in `gh` you get a prefilled link to open instead.",kindLabel:`Kind`,kindBug:`Bug`,kindIdea:`Idea`,kindQuestion:`Question`,titleLabel:`Title`,body:`What happened`,send:`File issue`,sent:`Filed issue #{number}`,notFiled:`Not filed yet. {hint}`,openLink:`Open the prefilled issue`,report:`Report a problem with an agent`,reportNote:`An agent asks what went wrong, drafts the issue with you and files it.`,reportFailed:`Could not start the conversation.`,reportPrompt:"You are helping the user report a problem with Rove itself (not their own project) as a GitHub issue. First ask what they were doing and what felt wrong: one to three short questions, one at a time. Then collect context: run `rove --version` and `rove daemon status`, and read the last ~50 lines of `${ROVE_HOME_DIR:-$HOME}/.rove/daemon.log` only if the problem could involve the daemon. Draft an issue title and body (what happened, what they expected, steps, relevant output) and show it to the user. Only after they say OK, file it with a heredoc: `rove feedback --kind bug|idea|question --title \"...\" --body-file - <<'EOF'` followed by the body and `EOF`. Then share the issue URL. If it prints a prefilled link instead (gh missing or signed out), give the user that link and tell them to run `gh auth login`."}},prefs:{languageHint:`Display language, shared with the TUI.`,soundHint:`chime, plus a desktop notification while this tab is in the background`,soundVolumeHint:`Plays the new level when you pick it.`,push:`Notify when this page is closed`,pushHint:`This browser gets a notification when a task finishes, needs you or fails, even with no Rove page open. Follows the cross-task switch.`,pushUnsupported:`This browser can't receive push here: it needs https (or localhost), and on iPhone/iPad the page added to the home screen.`,pushBlocked:`Notifications are blocked for this site; allow them in the browser's site settings.`,pushFailed:`Couldn't turn it on: {error}`,zenHint:`Hide the Files pane. The zen chip and ctrl+a z toggle it and write this same setting.`,editInTui:`Edit it in the TUI.`,tierModel:`model`,tierEdit:`Edit`,tierEffort:`Reasoning effort`,classifierConnection:`Classifier connection`,unset:`(none)`,modeAuto:`Auto (follow the browser)`,themePreviewHint:`Point at a theme to see this page in it; click to keep it. The TUI follows.`,themeUser:`yours`,themeInstalled:`Installed`,themeMoreHint:`Not installed yet: point to preview, click to install and switch.`,themeBrowse:`Browse {count} more from rove.run`,themeHide:`Hide themes from rove.run`,themeGet:`get`,themeInstalling:`installing…`,themeInstallFailed:`failed, retry`,themeAgent:`Make one with an agent`,themeAgentHint:`opens a Scratch session; reopen Settings to see what it wrote.`,themeAgentFailed:`couldn't open the session; try again.`,themeAgentPrompt:"Make me a new Rove color theme. Ask me first what look I want, unless I already said. Save it as one JSON file in {dir} (for example {dir}/my-theme.json); the file name is the theme's name. The format is in https://github.com/sma1lboy/rove/blob/main/docs/themes.md and the JSON schema is https://raw.githubusercontent.com/sma1lboy/rove/main/packages/rove/src/tui/context/theme/theme.schema.json. Start from https://raw.githubusercontent.com/sma1lboy/rove/main/packages/rove/src/tui/context/theme/claude.json, give each color slot a { dark, light } pair, and keep text readable on every background. When it's saved, run `rove theme list` to check it loads, then tell me the name: it appears in Settings → Appearance.",resetButton:`Reset`,resetHint:`Clears this Mac's saved settings and task list, restarts the Rove daemon, then reloads this page. Worktrees on disk and engine session history are not touched.`,resetBody:`Wipes ~/.config/rove/state.json and ~/.rove/tasks.json and restarts the daemon, then reloads this page with an empty task list. Worktrees on disk and engine session history are NOT touched.`,restartButton:`Restart`,restartHint:`Stops the Rove daemon and starts a fresh one; this page reconnects on its own. Running engine sessions live in the PTY host and survive it.`,restartBody:`Stops the Rove daemon and starts a fresh one, picking up daemon edits. This page reconnects in a few seconds. Running engine sessions survive.`,keysYaml:`The file is read on the Mac; changes apply when you come back to this page.`},keys:{editHint:`Click a key to record a new one, then press the key you want. To put it behind the prefix, press the prefix key first. The × removes it.`,reset:`Reset`,recordFor:`Record a key for {name}`,removeFor:`Remove the key for {name}`,pluginNoTask:`Select a task before using a plugin chord.`,pluginChords:`Plugin chords`,agent:`Change them with an agent`,agentHint:`opens a Scratch session; reopen Settings to see what it changed.`,agentFailed:`couldn't open the session; try again.`,agentPrompt:"Change my Rove keybindings. Ask me first what I want changed, unless I already said. Edit {path} (create it if it is missing; keep existing entries and comments you were not asked to change). The format, every binding id and its default chord are in https://github.com/sma1lboy/rove/blob/main/docs/KEYBINDINGS.md (see Customizing). Only use binding ids listed there; a direct override replaces that binding's whole chord list, and null unbinds. The file must stay valid YAML: check it parses (for example with `ruby -ryaml -e 'YAML.load_file(ARGV[0])' {path}` or any YAML parser you have). Rove reloads it live, and unknown ids or invalid chords are ignored with a warning, so when you are done tell me what you changed and ask me to reopen Settings → Keybindings: it lists every applied override and every warning."},pages:{attachTooLarge:`{name} is larger than 500 MB`,new:`[ new ]`,routinePause:`[ pause ]`,routineEnable:`[ enable ]`,delete:`[ delete ]`,routinesNeedYou:`NEEDS YOU`,routinesActive:`ACTIVE`,routinesPaused:`PAUSED`,laterStarts:`LATER`,laterCancel:`[ cancel ]`,laterFailed:`Did not start: {error}`,laterCancelFailed:`Could not cancel the start: {error}`,routineSchedule:`Schedule`,routineNext:`Next run`,routineProject:`Project`,routineDelivers:`Delivers to`,routineEngine:`Engine`,routineChangeEngine:`[ change ]`,routinePrompt:`PROMPT`,routineScript:`SCRIPT`,cronDown:`Decrease {field}`,cronUp:`Increase {field}`,storySave:`save`,storySaveStart:`save & start`,storyStart:`start`,attachHintTouch:`paste a path / a screenshot → inserts an image placeholder`}},pt={settings:{title:`设置`,open:`设置`,sections:{connectors:`连接器`,appearance:`外观`,notifications:`通知`,snippets:`片段`,about:`关于`,voice:`语音`},groups:{preferences:`偏好`,agents:`智能体与工具`,more:`更多`},pages:{general:`语言、布局,以及 Rove 在哪里打开文件、创建 worktree。`,appearance:`主题、颜色,以及任务和面板的外观。`,notifications:`任务完成或需要你时,Rove 怎么提醒。`,keys:`在你自己的文件里重绑快捷键,以及前缀引导的行为。`,engines:`Rove 能启动的编码智能体,以及它如何接入它们。`,autoRouting:`每个深度档位启动什么,以及由谁选择档位。`,voice:`口述:把你说的话变成提示词的识别器。`,connectors:`Rove 使用的账号,本机和你的其他机器。`,plugins:`内置页面和已注册的插件。`,about:`版本、更新,以及此浏览器。`,feedback:`给 Rove 团队留一条意见。`,dev:`实验开关、重启和重置。`,snippets:`常用的提示词文本。在提示词里输入 @名称 即可插入。`},connectors:{githubDescription:`用同一个 GitHub 账号在每台机器上克隆、推送和开 PR`,connect:`连接`,disconnect:`断开`,disconnectBody:`把这台机器的 gh 从 GitHub 退出登录,所有用 gh 的工具都会受影响,不只是 Rove。其他机器保持各自的登录。`,machines:`机器`,thisMachine:`本机`,machinesHint:`每台机器各自登录 GitHub。右边的标记表示它和本机用的是不是同一个账号。`,refresh:`重新检查`,refreshing:`检查中…`,useRove:`使用 Rove 的账号`,loginThere:`在那里登录`,codeHint:`到 GitHub 输入这个验证码(点击验证码可复制)`,openGithub:`打开 github.com/login/device`,codeCopied:`验证码已复制`,syncing:`已登录,正在同步其他机器…`,loginFailed:`登录失败:{error}`,dismiss:`关闭`,loading:`检查中…`,markSame:`✓ 同一账号`,markDifferent:`⚠ @{login}`,markSignedOut:`✗ 未登录`,markNoGh:`未安装 gh`,markOutdated:`那边的 Rove 版本过旧`,markOffline:`离线`,markDenied:`拒绝修改凭据`,markFailed:`无法检查`,detail:`git 走 {protocol} · SSH 密钥 {ssh}`,synced:`{machine} 现在使用 @{login}`},general:{groupInterface:`界面`,groupFiles:`Worktree`,groupTerminal:`终端`,tabStrip:`标签栏`,scrollback:`回滚行数`},appearance:{groupColours:`颜色`,groupTasks:`任务与面板`,taskColorsNote:`让每个任务在工作边框和列表里有自己的色调。`,colorblindNote:`新增和删除的行用蓝色和红色,而不是绿色和红色。`,workingBorderNote:`所选任务工作时,面板边框的样子。`,railGroup:`任务列表`,railGroupProject:`按项目`,railGroupState:`按状态`,statusMark:`任务状态`,statusMarkEngine:`引擎图标`,statusMarkBoth:`图标加点阵`,statusMarkDots:`只有点阵`,previewWorking:`正在跑`,previewDone:`完成未读`,previewIdle:`空闲`,previewWaiting:`等你回答`,previewBroken:`出错`,previewTitle:`修复登录跳转`},notifications:{toastNote:`本页角落里的弹出提示。`,volume:`提示音音量`},about:{groupRove:`Rove`,daemon:`守护进程`,daemonCurrent:`rove {version},与本页同一版本`,daemonStale:"rove {version} 版本过旧;运行 `rove daemon restart`",updates:`更新`,browser:`此浏览器`,browserHint:`忘掉此浏览器的令牌。登录得到的令牌也会在主机上吊销。`,access:`访问`,signIn:`登录方式`,signInMode:{open:`免登录`,password:`密码`,token:`Token 链接`},signInHint:{open:`本机浏览器不用链接或密码就能打开 Rove。手机和其他电脑仍然需要 token。`,password:`没有 token 的浏览器用密码登录。Token 链接照常可用。`,token:`只有 rove 打印的链接或设备 token 能进。密码登录关闭。`},passwordSet:`设置密码`,passwordChange:`修改密码`,passwordHint:`至少 {min} 个字符。以哈希形式存在本机。`,passwordField:`新密码`,passwordSave:`保存`,signOut:`退出登录`},engines:{enabled:`选引擎时列出 {name}`,default:`把 {name} 设为默认引擎`,namePlaceholder:`显示名称(留空 = 默认)`,rename:`重命名`,reset:`恢复默认`,remove:`移除引擎`,save:`保存`,cancel:`取消`},plugins:{builtIn:`内置`,builtInHint:`官方页面。关掉后,它在侧栏的入口会消失。`,registered:`已注册的插件`,empty:`没有其他已注册的插件。`,linked:`已链接`,unsupportedPlatform:`平台不支持`,turnOn:`安装 {name}`},feedback:{hint:"通过运行 rove 那台机器上的 `gh`,在 Rove 仓库提一个公开的 GitHub issue。没有登录 `gh` 时会给你一条预填好的链接。",kindLabel:`类型`,kindBug:`缺陷`,kindIdea:`想法`,kindQuestion:`问题`,titleLabel:`标题`,body:`发生了什么`,send:`提交 issue`,sent:`已提交 issue #{number}`,notFiled:`还没提交。{hint}`,openLink:`打开预填好的 issue`,report:`让 agent 帮我报告问题`,reportNote:`由 agent 问清哪里不对,和你一起起草 issue 并提交。`,reportFailed:`没能开始对话。`,reportPrompt:"你在帮用户把 Rove 本身的问题(不是他们自己项目的问题)提成一个 GitHub issue。先问清楚他们当时在做什么、哪里不对劲:一到三个简短的问题,一次问一个。然后收集上下文:运行 `rove --version` 和 `rove daemon status`,只有问题可能和 daemon 有关时才读 `${ROVE_HOME_DIR:-$HOME}/.rove/daemon.log` 的最后约 50 行。起草 issue 的标题和正文(发生了什么、期望什么、复现步骤、相关输出)并展示给用户。用户确认之后才提交,用 heredoc:`rove feedback --kind bug|idea|question --title \"...\" --body-file - <<'EOF'`,接正文,最后一行 `EOF`。然后把 issue 链接发给用户。如果输出的是预填链接(没装 gh 或没登录),把链接给用户,并告诉他运行 `gh auth login`。"}},prefs:{languageHint:`显示语言,与 TUI 共用同一设置。`,soundHint:`提示音;本页在后台时另发桌面通知`,soundVolumeHint:`选中后会播放新音量。`,push:`页面关闭时也通知`,pushHint:`任务完成、需要你或出错时,即使没有打开任何 Rove 页面,这个浏览器也会收到通知。跟随「跨任务通知」开关。`,pushUnsupported:`这个浏览器在这里收不到推送:需要 https(或 localhost),iPhone/iPad 上还要先把页面添加到主屏幕。`,pushBlocked:`这个网站的通知被浏览器屏蔽了,去浏览器的网站设置里允许。`,pushFailed:`没能开启:{error}`,zenHint:`收起文件栏。zen 按钮和 ctrl+a z 切换时会写入同一个设置。`,editInTui:`请在 TUI 中编辑`,tierModel:`模型`,tierEdit:`编辑`,tierEffort:`推理强度`,classifierConnection:`分类器连接`,unset:`(无)`,modeAuto:`自动(跟随浏览器)`,themePreviewHint:`鼠标指向一个主题,整页就换成它看看;点一下就定下来。TUI 也会跟着换。`,themeUser:`自装`,themeInstalled:`已安装`,themeMoreHint:`尚未安装:指向即预览,点一下安装并切换。`,themeBrowse:`浏览 rove.run 上的另外 {count} 个主题`,themeHide:`收起 rove.run 的主题`,themeGet:`安装`,themeInstalling:`安装中…`,themeInstallFailed:`失败,重试`,themeAgent:`让 agent 做一个`,themeAgentHint:`会开一个 Scratch 会话;做好后重新打开设置就能看到。`,themeAgentFailed:`会话没打开,再试一次。`,themeAgentPrompt:"帮我做一个新的 Rove 配色主题。先问我想要什么风格,除非我已经说过。把它存成 {dir} 下的一个 JSON 文件(比如 {dir}/my-theme.json),文件名就是主题名。格式说明见 https://github.com/sma1lboy/rove/blob/main/docs/themes.md,JSON schema 是 https://raw.githubusercontent.com/sma1lboy/rove/main/packages/rove/src/tui/context/theme/theme.schema.json。以 https://raw.githubusercontent.com/sma1lboy/rove/main/packages/rove/src/tui/context/theme/claude.json 为起点,每个颜色槽都给 { dark, light } 两个值,并保证文字在每种背景上都看得清。存好后运行 `rove theme list` 确认能加载,然后告诉我主题名:它会出现在 设置 → 外观 里。",resetButton:`重置`,resetHint:`清空这台 Mac 上保存的设置和任务列表,重启 Rove 守护进程,然后刷新本页。磁盘上的工作树和引擎会话历史不受影响。`,resetBody:`清空 ~/.config/rove/state.json 和 ~/.rove/tasks.json 并重启守护进程,然后刷新本页,任务列表为空。磁盘上的工作树和引擎会话历史不会被动。`,restartButton:`重启`,restartHint:`停止 Rove 守护进程并启动新的进程,本页会自动重连。运行中的引擎会话在 PTY 宿主里,不受影响。`,restartBody:`停止 Rove 守护进程并启动新的进程,载入守护进程的改动。本页几秒后自动重连,运行中的引擎会话不受影响。`,keysYaml:`该文件在 Mac 上读取,改动会在你回到本页时生效。`},keys:{editHint:`点一个按键开始录入,再按你想要的键。想放到 prefix 后面,就先按 prefix 键。× 是删掉它。`,reset:`恢复默认`,recordFor:`为「{name}」录入按键`,removeFor:`删掉「{name}」的按键`,pluginNoTask:`使用插件快捷键前请先选中一个任务。`,pluginChords:`插件快捷键`,agent:`让 agent 来改`,agentHint:`会开一个 Scratch 会话;改好后重新打开设置就能看到。`,agentFailed:`会话没打开,再试一次。`,agentPrompt:"帮我改 Rove 的快捷键。先问我想改什么,除非我已经说过。编辑 {path}(不存在就新建;没让你改的条目和注释都保留)。格式、每个 binding id 及其默认按键见 https://github.com/sma1lboy/rove/blob/main/docs/KEYBINDINGS.md(Customizing 一节)。只用那里列出的 binding id;直接覆盖会替换该 binding 的整个按键列表,null 表示解绑。文件必须保持合法 YAML:确认它能解析(比如 `ruby -ryaml -e 'YAML.load_file(ARGV[0])' {path}`,或任何你有的 YAML 解析器)。Rove 会实时重新加载它,未知 id 或无效按键会被忽略并给出警告,所以改完后告诉我改了什么,并请我重新打开 设置 → 快捷键:那里会列出所有生效的覆盖和所有警告。"},pages:{attachTooLarge:`{name} 超过 500 MB`,new:`[ 新建 ]`,routinePause:`[ 暂停 ]`,routineEnable:`[ 启用 ]`,delete:`[ 删除 ]`,routinesNeedYou:`需要处理`,routinesActive:`运行中`,routinesPaused:`已暂停`,laterStarts:`稍后启动`,laterCancel:`[ 取消 ]`,laterFailed:`没有启动:{error}`,laterCancelFailed:`取消失败:{error}`,routineSchedule:`调度`,routineNext:`下次执行`,routineProject:`项目`,routineDelivers:`投递到`,routineEngine:`引擎`,routineChangeEngine:`[ 更换 ]`,routinePrompt:`提示词`,routineScript:`脚本`,cronDown:`减小{field}`,cronUp:`增大{field}`,storySave:`保存`,storySaveStart:`保存并启动`,storyStart:`启动`,attachHintTouch:`粘贴路径 / 截图 → 插入图片占位行`}},mt=n({en:()=>ht,zh:()=>gt}),ht={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`}},gt={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:`终端末尾`}},_t=n({en:()=>vt,zh:()=>yt}),vt={usage:{title:`Usage`,receipt:`Usage receipt`,total:`Total tokens`,thanks:`Thank you, burn again soon`,open:`Open usage`,range:`last {days} days · tokens are input + output`,perDay:`Per day`,byModel:`By engine and model`,topTasks:`Top tasks`,quota:`Quota`,turns:`{count} turns`,loading:`Loading…`,empty:`No turns recorded in this window.`,failed:`Could not read usage: {error}`,cutoff:`The daemon returns at most {count} turns: {day} and earlier are partial.`,noReader:`{engines}: no turn reader, so their work is not counted here.`,removedTask:`(removed task)`,full:`at this pace full around {time}, before it resets`,lasts:`at this pace it lasts until the reset`}},yt={usage:{title:`用量`,receipt:`用量小票`,total:`合计 token`,thanks:`谢谢惠顾,欢迎再烧`,open:`打开用量`,range:`最近 {days} 天 · token 为输入加输出`,perDay:`按天`,byModel:`按引擎和模型`,topTasks:`用量最高的任务`,quota:`额度`,turns:`{count} 轮`,loading:`加载中…`,empty:`这段时间没有记录到任何一轮。`,failed:`无法读取用量:{error}`,cutoff:`守护进程最多返回 {count} 轮:{day} 及更早的数据不完整。`,noReader:`{engines}:没有轮次读取器,这里不统计它们的工作。`,removedTask:`(已删除的任务)`,full:`按当前速度约 {time} 用完,早于重置时间`,lasts:`按当前速度可撑到重置`}},bt=n({en:()=>xt,zh:()=>St}),xt={voice:{say:`Say`,stop:`Stop {time}`,release:`Release {time}`,working:`Hearing…`,hint:`Dictate: tap to start and stop, or hold to talk and let go`,slideToSend:`Slide up to send`,tipSend:`Let go to send`,hold:`Hold to talk`,holdOrType:`Hold to talk, tap to type`,learned:`Learned {pairs}`,learnedPair:`{spoken} → {term}`,undo:`undo`,unlearned:`Forgotten`,unlearnFailed:`Couldn't undo: the voice sidecar isn't answering`,setup:{dictation:`Dictation`,backend:{off:`Off`,local:`On this Mac`,cloud:`Cloud`},unavailable:`This Rove cannot set up dictation`,offHint:`The mic is hidden. Nothing runs in the background.`,localNeeded:`Install the model below; the mic shows once it is ready.`,localInstalling:`Installing the model; the mic shows once it is ready.`,cloudNeeded:`Save an endpoint below to turn dictation on.`,ready:`{model} · ready`,starting:`Starting…`,localTitle:`Whisper large-v3`,localHint:`Runs on this Mac's GPU, about 3.5 GB to download. Audio never leaves the Mac.`,install:`Install`,installing:`Installing…`,installed:`Installed, about 4 GB on disk.`,failed:`Install failed: {line}`,uninstall:`Uninstall`,uninstallAsk:`Remove the model?`,cancel:`Cancel`,cloudTitle:`Cloud endpoint`,cloudHint:`Any OpenAI-compatible /audio/transcriptions service. The audio and your terms go there; the key stays on the Mac.`,baseURL:`Base URL`,model:`Model`,apiKey:`API key`,keySaved:`Saved; leave empty to keep it`,save:`Save`,saveAndUse:`Save and use`,forget:`Forget`,forgetAsk:`Remove the endpoint and its key?`}}},St={voice:{say:`说`,stop:`停 {time}`,release:`松手 {time}`,working:`在听…`,hint:`口述:点一下开始、再点一下结束,或按住说话、松手结束`,slideToSend:`上滑发送`,tipSend:`松手发送`,hold:`按住说话`,holdOrType:`按住说话,轻点打字`,learned:`记住了 {pairs}`,learnedPair:`{spoken} → {term}`,undo:`撤销`,unlearned:`已撤销`,unlearnFailed:`没能撤销:语音服务没有响应`,setup:{dictation:`语音输入`,backend:{off:`关闭`,local:`本机`,cloud:`云端`},unavailable:`这个 Rove 无法设置语音输入`,offHint:`不显示麦克风,后台也不运行任何东西。`,localNeeded:`在下面安装模型,就绪后显示麦克风。`,localInstalling:`正在安装模型,就绪后显示麦克风。`,cloudNeeded:`在下面保存一个服务地址后开启。`,ready:`{model} · 就绪`,starting:`启动中…`,localTitle:`Whisper large-v3`,localHint:`在这台 Mac 的 GPU 上运行,约需下载 3.5 GB。音频不离开这台 Mac。`,install:`安装`,installing:`安装中…`,installed:`已安装,约占 4 GB 磁盘。`,failed:`安装失败:{line}`,uninstall:`卸载`,uninstallAsk:`删除模型?`,cancel:`取消`,cloudTitle:`云端服务`,cloudHint:`任何兼容 OpenAI /audio/transcriptions 的服务。音频和你的术语会发到那里;密钥只存在这台 Mac 上。`,baseURL:`Base URL`,model:`模型`,apiKey:`API 密钥`,keySaved:`已保存;留空则保留原密钥`,save:`保存`,saveAndUse:`保存并使用`,forget:`删除`,forgetAsk:`删除这个服务地址和密钥?`}}},Ct=n({en:()=>wt,zh:()=>Tt}),wt={workspace:{pickTask:`pick a task on the left`,noTabs:`no open sessions in this task`,startEngine:`Start {engine}`,startSession:`Start session`,tabNotLive:`this tab has no running session`,restored:`restored session, read-only until reopened`,exited:`session ended (exit {code})`,attachFailed:`could not open this session: {message}`,reopen:`Reopen session`,reopening:`Reopening…`,reopenFailed:`could not reopen this session: {message}`,engineExited:`engine exited (code {code})`,retry:`Retry`,engineSettings:`Settings → Engines`,usageLimitUntil:`usage limit reached — rove resumes this task at {time}`,resumeQuota:`resume now`,resumingQuota:`resuming…`,usageLimit:`usage limit reached`,dismiss:`Dismiss`,openTask:`Open`},tab:{shell:`shell`,engine:`engine`},firstRun:{title:`All your coding agents, in one place`,body:`When one runs out of quota, switch the task to another. Agents talk to each other directly, and every task gets its own worktree and branch.`,start:`Start your first task`},status:{connecting:`connecting`,retrying:`reconnecting, attempt {count}`,retry:`retry now`,backlog:`Backlog`,inProgress:`In progress`,inReview:`In review`,done:`Done`,canceled:`Canceled`,error:`Error`},connect:{title:`open the link rove printed`,body:"Run `rove --web` and open the link it prints, or paste it here.",placeholder:`http://127.0.0.1:7878/#token=…`,submit:`connect`,invalid:"that is not a `rove --web` link",failing:"can't reach rove. Is `rove --web` still running? After `--rotate-token`, open the new link.",forget:`forget this link`,notConnected:`not connected to rove — reconnecting (the view refreshes on its own)`},relay:{unpaired:"open the relay link that `rove --web --preset relay` printed on your computer",connecting:`connecting to your computer through the relay…`,loading:`loading rove…`,offline:"your computer is not answering on this relay. Is `rove --web --preset relay` still running? After `--rotate-relay`, open the new link. Reload to retry.",failed:`can't reach your computer through the relay ({error}). Reload to retry.`},login:{title:`sign in`,body:`Enter this Rove's password.`,field:`password`,submit:`sign in`,checking:`checking…`,wrong:`that did not work`,locked:`too many tries from here; try again in {minutes} min`,lockedHost:"password login is locked; run `rove --web --unlock` on the host",unreachable:"can't reach rove. Is `rove --web` still running?"},layout:{splitTooSmall:`Not enough room to split here`,railFold:`Fold the task list`,navBack:`Back`,navForward:`Forward`,railUnfold:`Unfold the task list`,dropUploading:`Uploading {name}…`,pasteNoImage:`No image on this browser's clipboard`,pasteNoAccess:`Can't read this browser's clipboard: {error}`,pasteNeedsHttps:`the page needs https or localhost`,refreshTimeout:"The daemon did not come back on the new build in time; check `rove daemon status`",railResize:`Drag to resize the task list, click to fold it, double-click to reset`,composerPlaceholder:`Message the agent`,composerSend:`Send`,composerAttach:`Attach a file`,composerNotSent:`Not sent: {reason}`,composerOldBridge:`This Mac's rove --web is older than this page; restart it to send from here.`,composerAtMenu:`The agent is waiting on a choice. Answer it with the 1–4 and ⏎ keys below; your message is kept.`,termKeys:`Terminal keys`,termKeyUp:`Up arrow`,termKeyDown:`Down arrow`,termKeyLeft:`Left arrow`,termKeyRight:`Right arrow`,termKeyInterrupt:`Ctrl+C, interrupt`,termKeyEnter:`Enter`,narrowTerminal:`Terminal`}},Tt={workspace:{pickTask:`从左边选一个任务`,noTabs:`这个任务没有打开的会话`,startEngine:`启动 {engine}`,startSession:`启动会话`,tabNotLive:`这个标签没有在运行的会话`,restored:`已恢复的会话,重新打开前只读`,exited:`会话已结束(退出码 {code})`,attachFailed:`打不开这个会话:{message}`,reopen:`重新打开会话`,reopening:`正在重新打开…`,reopenFailed:`重新打开失败:{message}`,engineExited:`引擎已退出(退出码 {code})`,retry:`重试`,engineSettings:`设置 → 引擎`,usageLimitUntil:`已达到用量上限 —— rove 会在 {time} 自动继续这个任务`,resumeQuota:`现在继续`,resumingQuota:`正在继续…`,usageLimit:`已达到用量上限`,dismiss:`忽略`,openTask:`打开`},tab:{shell:`终端`,engine:`引擎`},firstRun:{title:`所有编程 agent,都在一个地方`,body:`一个额度用完了,换另一个接着干;agent 之间直接对话。每个任务有独立的 worktree 和分支,互不覆盖。`,start:`开始第一个任务`},status:{connecting:`连接中`,retrying:`重连中,第 {count} 次`,retry:`立即重试`,backlog:`待办`,inProgress:`进行中`,inReview:`待评审`,done:`已完成`,canceled:`已取消`,error:`出错`},connect:{title:`打开 rove 打印的链接`,body:"运行 `rove --web`,打开它打印的链接,或者把链接粘贴到这里。",placeholder:`http://127.0.0.1:7878/#token=…`,submit:`连接`,invalid:"这不是 `rove --web` 打印的链接",failing:"连不上 rove。`rove --web` 还在运行吗?用过 `--rotate-token` 的话,请打开新的链接。",forget:`忘掉这个链接`,notConnected:`没有连上 rove,正在重连(连上后这里会自动刷新)`},relay:{unpaired:"打开电脑上 `rove --web --preset relay` 打印的 relay 链接",connecting:`正在通过 relay 连接你的电脑…`,loading:`正在加载 rove…`,offline:"你的电脑没有在这个 relay 上应答。`rove --web --preset relay` 还在运行吗?用过 `--rotate-relay` 的话,请打开新的链接。刷新重试。",failed:`无法通过 relay 连到你的电脑({error})。刷新重试。`},login:{title:`登录`,body:`输入这台 Rove 的密码。`,field:`密码`,submit:`登录`,checking:`验证中…`,wrong:`登录失败`,locked:`这里尝试次数过多;{minutes} 分钟后再试`,lockedHost:"密码登录已锁定;在主机上运行 `rove --web --unlock`",unreachable:"连不上 rove。`rove --web` 还在运行吗?"},layout:{splitTooSmall:`这里放不下分屏了`,railFold:`折叠任务列表`,navBack:`后退`,navForward:`前进`,railUnfold:`展开任务列表`,dropUploading:`正在上传 {name}…`,pasteNoImage:`浏览器剪贴板里没有图片`,pasteNoAccess:`读不到浏览器剪贴板:{error}`,pasteNeedsHttps:`页面要走 https 或 localhost`,refreshTimeout:"守护进程没能及时以新版本重新上线,请检查 `rove daemon status`",railResize:`拖动调整任务列表宽度,单击折叠,双击还原`,composerPlaceholder:`给 agent 发消息`,composerSend:`发送`,composerAttach:`附加文件`,composerNotSent:`没发出去:{reason}`,composerOldBridge:`这台 Mac 上的 rove --web 比页面旧,重启它之后才能从这里发送。`,composerAtMenu:`agent 正在等你选择。用下方的 1–4 和 ⏎ 键回答;你的消息已保留。`,termKeys:`终端按键`,termKeyUp:`上方向键`,termKeyDown:`下方向键`,termKeyLeft:`左方向键`,termKeyRight:`右方向键`,termKeyInterrupt:`Ctrl+C 中断`,termKeyEnter:`回车`,narrowTerminal:`终端`}},Et=[nt,Ct,We,Xe,dt,Re,$e,ct,_t,mt,qe,Fe,at,Ve,bt],Dt=Object.assign({},...Et.map(e=>e.en)),Ot={en:Dt,zh:Object.assign({},...Et.map(e=>e.zh))};function kt(){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 At=v(kt());function jt(){let e=typeof document>`u`?void 0:document.documentElement;e&&(e.lang=At.get()===`zh`?`zh-CN`:`en`)}jt(),At.subscribe(jt);function Mt(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 Nt(e,t){return t?e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??e)):e}function B(e,t){return Nt(Mt(Ot[At.get()],e)??Mt(Dt,e)??e,t)}function Pt(e,t,n){return Nt(Mt(e[At.get()],t)??Mt(e.en,t)??t,n)}function V(){return y(At)}function Ft(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 It=(...e)=>e.filter(Boolean).join(` `),Lt=`text-meta leading-[inherit]`,Rt=`font-normal normal-nums`,zt=`touch:relative touch:after:absolute touch:after:content-['']`,Bt=`flex h-full flex-col`,Vt=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))_minmax(0,1fr)_minmax(0,var(--panel-w,33%))]`,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(` `),Ht=[`relative narrow-content:hidden narrow-back:col-1 narrow-back:row-1 touch:select-none touch:touch-callout-none`,`wide:overflow-x-clip wide:pt-8.5 wide:[&>:not([data-grip])]:min-w-(--rail-open-w)`,`rail-folded:absolute rail-folded:inset-y-1.5 rail-folded:left-1.5 rail-folded:z-6 rail-folded:col-1 rail-folded:row-1 rail-folded:box-border rail-folded:w-(--rail-open-w) rail-folded:-translate-x-[calc(100%+12px)] rail-folded:rounded-md rail-folded:border-hairline rail-folded:border-line rail-folded:bg-surface rail-folded:shadow-none rail-folded:transition-[translate] rail-folded:duration-200 rail-folded:ease-snap rail-folded:motion-reduce:transition-none rail-folded:[&>:not([data-grip])]:min-w-0`,`rail-peek:translate-none rail-peek:shadow-dialog`].join(` `),Ut=`rail-folded:col-2 panel-expanded:invisible panel-expanded:col-2 narrow-sidebar:hidden narrow-back:z-1 narrow-back:col-1 narrow-back:translate-x-(--back-x) narrow-back:bg-paper narrow-back:shadow-dialog`,Wt=`rail-folded:col-3 panel-expanded:z-2 panel-expanded:col-[2/-1] panel-expanded:bg-paper panel-expanded:pl-2`,Gt=`${zt} touch:after:-inset-x-1.5 touch:after:-inset-y-3`,Kt=`flex items-center gap-2`,qt=`flex min-w-0 items-baseline gap-1.5 px-1.5 py-0.5 text-meta font-bold ${zt} touch:after:-inset-2.5 touch:after:-bottom-1`,Jt=`flex items-center rounded-sm px-2.5 py-1.5 text-muted aria-selected:bg-inset aria-selected:text-ink [&_svg]:size-4 ${zt} touch:after:-inset-x-px touch:after:-top-2 touch:after:-bottom-1.5`,Yt=`keys-only m-0 overflow-hidden px-3.5 py-1 text-meta text-ellipsis whitespace-nowrap`,Xt=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`}`,Zt=`relative min-w-0 flex-1`,Qt={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)]`]},$t=(e,t)=>Qt[e][+!!t],en=(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?$t(`left`,t.active):``} ${t.top?$t(`top`,t.active):``} ${t.left||t.top?r:``}`:e===`rail`?`${n} ${$t(`left`,t.active)} ${r} ${t.top?`[--mt:6px]`:``}`:e===`rule`?`${n} ${$t(`top`,t.active)} ${r} ${t.left?`[--ml:8px]`:``}`:n},tn=(e,t)=>`absolute right-2 z-3 bg-paper px-1 font-mono text-meta ${Rt} ${e?`-top-2`:`top-0.5`} ${t?`text-accent`:`text-subtle`}`,nn=`hidden gap-1 overflow-x-auto scrollbar-none [border-top:var(--hairline)_solid_var(--line)] bg-surface px-1.5 py-1 touch:flex`,rn=e=>`h-10 min-w-max touch-manipulation [flex:1_1_0] rounded-sm border-hairline bg-inset px-0.5 py-0 font-mono text-meta ${Rt} ${e?`border-accent text-accent`:`border-line text-ink`}`,an=`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`,on=`min-w-[3ch] text-accent`,sn=`mb-1.5 flex justify-between gap-4`,cn=`columns-[2_220px] gap-x-5`,ln=`mb-2 break-inside-avoid`,un=`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`,dn=`mx-0 my-2 overflow-x-hidden overflow-y-auto scrollbar-none`,fn=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 ${Rt} whitespace-pre text-ink touch:py-2.5 ${e?`is-selected bg-hover`:``}`,pn=`min-w-0 overflow-hidden text-ellipsis`,mn=`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`,hn=`flex justify-between gap-4`,gn=`flex flex-col items-end ${Lt}`,_n=`mt-2 max-h-[52vh] overflow-y-auto`,vn=`mb-2.5`,yn=`m-0 mb-1 font-sans text-meta font-bold normal-nums text-accent`,bn=`flex gap-3 py-px ${Lt}`,xn=`min-w-[14ch] text-ink`,Sn=`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`,Cn=`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 ${Rt} text-ink shadow-popover`,wn=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]`}`,Tn=`m-auto font-mono text-meta ${Rt} text-subtle`,En=`${Tn} flex flex-col items-center gap-3 [&_p]:m-0`,Dn=`workspace isolate row-1 flex min-h-0 min-w-0 flex-col gap-1.5 px-1 pt-2 pb-1`,On=`flex min-h-0 flex-1 overflow-hidden rounded-md border-hairline border-line bg-paper focus-within:border-focus`,kn=`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`,An=`relative flex min-w-0 flex-1 flex-col`,jn=`relative flex min-h-0 min-w-0 flex-1 flex-col`,Mn=`term-host relative min-h-0 min-w-0 flex-1 touch-none overflow-clip`,Nn=`pointer-events-none absolute inset-0 z-5 h-full w-full`,Pn=`relative h-full [&.is-leaving]:pointer-events-none [&.is-leaving]:absolute [&.is-leaving]:inset-0 [&.is-leaving]:z-6`,Fn=`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)]`,In=e=>`absolute right-2.5 bottom-2.5 z-5 flex max-w-[calc(100%-20px)] flex-wrap items-center gap-x-3 gap-y-1 rounded-sm border-hairline border-line bg-inset px-2.5 py-1.25 font-mono text-meta ${Rt} ${e?`text-error`:`text-muted`} [&_.link:disabled]:pointer-events-none [&_.link:disabled]:opacity-60 [&_button]:whitespace-nowrap`,Ln=`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 ${Rt} whitespace-nowrap text-muted`,Rn=e=>`size-1.5 rounded-full ${e?`bg-warning`:`bg-subtle`}`,zn=`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`,Bn=`col-span-3 grid cursor-pointer grid-cols-subgrid items-center text-left hover:text-ink`,Vn={ok:`text-muted`,warn:`text-warning`,crit:`text-error`},Hn={ok:`text-success`,warn:`text-warning`,crit:`text-error`},Un=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-[''] ${Hn[e]??Hn.ok}`,Wn=`font-mono text-title font-bold normal-nums tracking-[0.02em] whitespace-nowrap`,Gn=`text-accent`,Kn=`grid h-full place-items-center p-6`,qn=`flex w-[min(460px,100%)] flex-col gap-3 rounded-md border-hairline border-line bg-surface p-6 [&_p]:m-0`,Jn=`flex flex-col gap-2 p-3.5 text-left font-sans text-meta ${Rt} leading-[1.5]`,Yn=`flex-none fill-none stroke-current [stroke-linecap:round] [stroke-linejoin:round] [stroke-width:1.25]`,Xn=(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`}`,Zn=`absolute top-2 left-[calc(--spacing(2)+var(--shell-inset-left,0px))] z-7 flex items-center gap-0.5`,Qn=`[&.is-resizing_iframe]:pointer-events-none`,$n=e=>`side-panel ${Wt} relative row-1 flex min-h-0 min-w-0 flex-col ${Qn} ${e?`flex-1 p-0`:`pt-2 pr-1 pb-1 pl-0`}`,er=`grid min-h-0 flex-1 grid-rows-[minmax(0,1fr)] [--divider:5px] ${Qn}`,tr=`side-col row-1 flex min-h-0 min-w-0 flex-col`,nr=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`}`,rr=`min-w-0 flex-1 truncate px-2 text-ink`,ir=`flex min-w-0 flex-1 items-center gap-0.5`,ar=`scrollbar-none flex min-w-0 gap-0.5 overflow-x-auto`,or=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`}`,sr=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`}`,cr=`truncate`,lr=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`}`,ur=`ml-auto flex gap-0.5`,dr=`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-['']`,fr=`side-view flex min-h-0 min-w-0 flex-1 flex-col [&[hidden]]:hidden`,pr=`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`,mr=`flex min-h-0 flex-1 flex-col gap-1.5`,hr=`flex items-center gap-0.5 [&_svg]:flex-none`,gr=`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`,_r=`min-w-0 flex-1 rounded-sm border-none bg-paper`,vr=`relative flex min-h-0 min-w-0 flex-1`,yr=`absolute inset-0 size-full cursor-crosshair touch-none fill-none stroke-accent [stroke-linecap:round] [stroke-linejoin:round] [stroke-width:2.5]`,br=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})),H=t(((e,t)=>{t.exports=br()}))(),xr=({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`,Sr={link:`text-accent hover:underline`,filled:xr(),danger:xr({danger:!0}),action:`rounded-sm border-hairline border-line bg-inset px-3 py-1.5 font-sans text-meta text-ink hover:border-line-active hover:bg-menu active:scale-97 motion-reduce:active:scale-none disabled:cursor-default disabled:opacity-50 touch:min-h-10 focus-visible:outline-1 focus-visible:outline-offset-1 focus-visible:outline-focus`,floating:`whitespace-nowrap rounded-sm border-hairline border-line-active bg-surface px-2 py-0.5 font-mono text-meta text-ink shadow-popover`,row:``,pill:`inline-flex flex-none items-center gap-1.5 whitespace-nowrap font-mono text-meta text-muted hover:text-ink aria-[current=true]:text-accent`,icon:Xn({small:!0}),iconOn:Xn({small:!0,on:!0}),card:`flex min-w-0 flex-col gap-1.5 rounded-sm border-hairline p-1.5 text-left focus-visible:outline-1 focus-visible:outline-offset-1 focus-visible:outline-focus`},Cr={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 U({variant:e=`link`,hit:t=e===`link`?`roomy`:`none`,className:n,type:r=`button`,...i}){return(0,H.jsx)(`button`,{type:r,className:It(Sr[e],Cr[t],n),...i})}var wr=`mx-2.5 my-3 font-mono text-meta text-subtle`,Tr=`font-sans text-meta text-subtle`,Er=`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`,Dr=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`:``}`,Or=`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`,kr=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`}`,W=`m-0 font-sans text-meta font-medium normal-nums`,Ar=`link text-accent [&:hover]:underline touch-hit`,jr=`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`,Mr=`${jr} w-full px-2.5 py-2`,Nr=`actions flex items-center justify-end gap-3.5`;function Pr({failing:e=!1}){V();let[t,n]=(0,h.useState)(``),[r,i]=(0,h.useState)(!1);return(0,H.jsx)(`div`,{className:Kn,children:(0,H.jsxs)(`form`,{className:qn,onSubmit:e=>{e.preventDefault();let n=Ft(t);if(!n){i(!0);return}a(n),window.location.reload()},children:[(0,H.jsxs)(`span`,{className:Wn,children:[(0,H.jsx)(`span`,{className:Gn,children:`[`}),` rove `,(0,H.jsx)(`span`,{className:Gn,children:`]`})]}),(0,H.jsx)(`h1`,{className:`${W} text-muted`,children:B(`connect.title`)}),(0,H.jsx)(`p`,{className:e?`text-error`:`text-muted`,children:B(e?`connect.failing`:`connect.body`)}),(0,H.jsx)(`input`,{className:Mr,autoFocus:!0,spellCheck:!1,placeholder:B(`connect.placeholder`),value:t,onChange:e=>{n(e.target.value),i(!1)}}),r&&(0,H.jsx)(`p`,{className:`text-error`,children:B(`connect.invalid`)}),(0,H.jsxs)(`div`,{className:Nr,children:[e&&(0,H.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>{o(),window.location.reload()},children:B(`connect.forget`)}),(0,H.jsx)(`button`,{type:`submit`,className:xr(),children:B(`connect.submit`)})]})]})})}var Fr=`flex flex-col gap-1.5`,Ir=`min-h-18 max-h-[50vh] leading-[1.45]`,Lr=`flex flex-wrap gap-1.5`,Rr=(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`}`}`,zr=`m-0 list-none p-0`,Br=`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`,Vr=(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`,Hr=`flex items-center justify-between gap-3`,Ur=`m-0 min-w-0 font-sans text-title leading-[1.4] font-semibold normal-nums text-ink wrap-anywhere`,Wr=`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-['']`,Gr=`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`,Kr=(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`,qr=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`:``}`,Jr=`font-mono text-meta normal-nums`,Yr=e=>`${Jr} ${e.danger&&e.selected?`text-inherit`:e.selected?`text-muted`:`text-subtle`} touch:hidden!`,Xr=e=>`${Jr} ${e?`text-ink`:`text-subtle`}`,Zr=`${Jr} text-accent`,Qr=`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`,$r=`flex cursor-default items-baseline gap-x-3`,ei=`min-w-0 flex-1`,ti=`flex-none whitespace-nowrap font-mono`,ni=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`,ri=`text-subtle`,ii=`flex items-baseline justify-between gap-3`,ai=`mt-1`,oi=`m-0 flex list-none flex-col gap-0.5 p-0`,si=`flex min-w-0 items-baseline gap-2.5`,ci=`flex-none font-mono text-meta font-normal normal-nums min-w-[3ch] text-right text-subtle`,li=`flex items-baseline gap-1`,ui=`min-w-0 flex-1`,di=`flex-none min-w-[calc(9ch+0.5rem)] whitespace-nowrap pr-2 text-right font-mono text-meta`,fi=`font-mono [&:hover]:text-accent`,pi={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`},mi=`bg-hover cursor-grabbing scale-[1.02] motion-reduce:scale-none`;function hi(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?mi: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`:``} ${t} ${pi[e.size??`row`]} ${n}`}var gi=`row-title min-w-0 flex-1 truncate`,_i=`row-title min-w-0 flex-auto truncate text-(length:--fs-title)`,vi=`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`,yi=`w-[1ch] flex-none text-center font-mono`,bi=`grid w-[2ch] flex-none place-items-center font-mono text-subtle`,xi=`flex flex-none gap-1.5 font-mono text-meta`;function G(e){return e instanceof Error?e.message:String(e)}function Si(e){V();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(),z())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,H.jsx)(`div`,{className:Br,onMouseDown:e=>e.target===e.currentTarget&&z(),children:(0,H.jsxs)(`dialog`,{ref:t,tabIndex:-1,open:!0,className:Vr(e.wide),"aria-label":e.title,children:[(0,H.jsxs)(`div`,{className:Hr,children:[(0,H.jsx)(`h1`,{className:Ur,children:e.title}),(0,H.jsx)(`button`,{type:`button`,className:Wr,"aria-label":B(`dialog.close`),title:B(`dialog.close`),onClick:z,children:`×`})]}),e.children]})})}function Ci(){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(),z()}catch(e){r(G(e))}finally{t(!1)}}}}function wi(e){let[t,n]=(0,h.useState)(e.initial??``),{busy:r,error:i,submit:a}=Ci();return(0,H.jsx)(Si,{title:e.title,children:(0,H.jsxs)(`form`,{className:Gr,onSubmit:n=>{n.preventDefault(),(t.trim()||e.allowEmpty)&&a(()=>e.onSubmit(t.trim()))},children:[e.multiline?(0,H.jsx)(`textarea`,{className:`${Mr} ${Ir}`,"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,H.jsx)(`input`,{className:Mr,"aria-label":e.title,autoFocus:!0,spellCheck:!1,value:t,onChange:e=>n(e.target.value),onFocus:e=>e.currentTarget.select()}),i&&(0,H.jsx)(`p`,{className:`text-error`,children:i}),(0,H.jsx)(Di,{busy:r,submitLabel:e.submitLabel})]})})}function Ti(e){let{busy:t,error:n,setError:r,submit:i}=Ci(),[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(G(n))),n}});return(0,H.jsx)(Si,{title:a&&e.escalate?.title||e.title,children:(0,H.jsxs)(`div`,{className:Gr,children:[(0,H.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,H.jsx)(`p`,{className:`text-error`,children:n}),(0,H.jsxs)(`div`,{className:Nr,children:[(0,H.jsx)(`button`,{type:`button`,className:Ar,onClick:z,children:B(`dialog.cancel`)}),e.secondary&&!a&&(0,H.jsx)(`button`,{type:`button`,className:xr({danger:!0}),disabled:t,onClick:()=>f(!0),children:e.secondary.label}),(0,H.jsx)(`button`,{ref:d,type:`button`,className:xr({danger:!0}),disabled:t,onClick:()=>f(!1),children:a&&e.escalate?e.escalate.label:e.confirmLabel})]})]})})}function Ei(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}=Ci(),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,H.jsx)(Si,{title:e.title,children:(0,H.jsxs)(`div`,{className:Gr,children:[(0,H.jsx)(`ul`,{className:zr,children:e.choices.map((t,a)=>(0,H.jsx)(`li`,{children:(0,H.jsxs)(`button`,{type:`button`,"aria-pressed":t.value===e.current,disabled:i,className:hi({selected:a===n}),onMouseEnter:()=>r(a),onClick:()=>s(t.value),children:[(0,H.jsx)(`span`,{className:`${yi} text-accent`,children:t.value===e.current?`●`:` `}),(0,H.jsx)(`span`,{className:gi,children:t.label})]})},t.value))}),a&&(0,H.jsx)(`p`,{className:`text-error`,children:a})]})})}function Di({busy:e,submitLabel:t}){return(0,H.jsxs)(`div`,{className:Nr,children:[(0,H.jsx)(`button`,{type:`button`,className:Ar,onClick:z,children:B(`dialog.cancel`)}),(0,H.jsx)(`button`,{type:`submit`,className:xr(),disabled:e,children:t})]})}function K(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 Oi={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`}},ki={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:`提交`}},Ai={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"}},ji={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"}},Mi={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."}},Ni={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`,然后重试。"}},Pi={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`}},Fi={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} 在这台机器上不可用——去 设置 → 自动路由 重新指定`}},Ii={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`},Li={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} 里已有补全配置 — 未改动`},Ri={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`},zi={title:`快速任务 · {repoLabel}`,promptLabel:`提示词`,promptPlaceholder:`这个任务要做什么?`,attemptsLabel:`尝试次数`,engineLabel:`引擎`,branchLabel:`分支`,legend:`enter 创建 · tab 切换字段 · ctrl+e 引擎 · ctrl+v 附件 · esc 取消`,startedRound:`已启动 {count} 个尝试`,roundPartial:`已启动 {ok}/{count} 个尝试 —— {failed} 个失败`},Bi={cancel:`cancel`,forgetProjectTitle:`Remove project "{title}"?`,forgetProjectBody:"Forgets it from the projects list. The repo, its branches, worktrees and the sessions under it stay — 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.`,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`,forceDeleteTitle:`"{title}" has uncommitted changes`,forceDeleteConfirm:`force remove`,legacyAdoptTitle:`Remove {count} sessions Rove added by itself?`,legacyAdoptBody:`An older Rove added a session whenever a worktree was created outside it. It no longer does. These look like leftovers:
17
17
  {list}
18
18
 
19
19
  An agent can list them, remove the ones you confirm, and take out any old Rove worktree hook still in your settings.`,legacyAdoptMore:`… and {count} more`,legacyAdoptClean:`ask an agent`,legacyAdoptLater:`not now`,legacyAdoptNever:`don't ask again`,legacyAdoptSessionTitle:`Remove leftover sessions`,legacyAdoptPrompt:`An older Rove version added sessions to the sidebar by itself whenever a git worktree was created outside Rove. These look like leftovers:
@@ -22,7 +22,7 @@ An agent can list them, remove the ones you confirm, and take out any old Rove w
22
22
 
23
23
  Show me this list and ask which ones to remove, then wait for my answer. For each one I confirm, first run \`git -C <path> status --short\`. If it has uncommitted changes, tell me and ask again. Otherwise run \`rove api delete --task-id <id> --wait\`. Remove nothing I did not confirm, and never pass --force.
24
24
 
25
- Then look for the hook that older version installed. Check my engine settings files, both the global ones and the ones in each repo above, for any hook whose command runs \`rove hook worktree-created\`. Show me each entry you find and its file, and remove it only after I confirm. Leave every other hook as it is.`,legacyAdoptFailed:`Couldn't start the cleanup session: {message}`},Vi={cancel:`取消`,forgetProjectTitle:`从列表中移除项目「{title}」?`,forgetProjectBody:"把它从项目列表里忘掉,并结束它主 checkout 里的会话。仓库、分支、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:`强制移除`,legacyAdoptTitle:`移除 {count} 个 Rove 自己加进来的会话?`,legacyAdoptBody:`旧版 Rove 会在别处创建 worktree 时自动加一个会话,现在已经不会了。下面这些看起来是当时留下的:
25
+ Then look for the hook that older version installed. Check my engine settings files, both the global ones and the ones in each repo above, for any hook whose command runs \`rove hook worktree-created\`. Show me each entry you find and its file, and remove it only after I confirm. Leave every other hook as it is.`,legacyAdoptFailed:`Couldn't start the cleanup session: {message}`},Vi={cancel:`取消`,forgetProjectTitle:`从列表中移除项目「{title}」?`,forgetProjectBody:"把它从项目列表里移除。仓库、分支、worktree 以及它下面的会话都会保留,之后可以用 `rove add` 重新加回来。",forgetProjectConfirm:`移除`,deleteTitle:`移除会话「{title}」?`,deleteTitleDir:`移除会话「{title}」?`,deleteBodyDir:`结束这个会话,关闭它的所有标签页。磁盘上什么都不动:文件夹和里面的文件都会保留。`,deleteBodyTask:`结束这个会话,关闭它的所有标签页,并删除它的 worktree 文件夹。git 分支会保留。`,deleteBodyTaskBranch:`结束这个会话,关闭它的所有标签页,删除它的 worktree 文件夹,以及已合并的 git 分支。未合并的分支会保留。`,deleteConfirm:`移除`,childrenTitle:`「{title}」有 {count} 个子任务`,childrenBody:`提升会把它们上移一级,并保留它们的 worktree 和会话。连同子任务移除会把它们一并移除。`,childrenPromote:`提升子任务`,childrenCascade:`连同子任务移除`,forceDeleteTitle:`「{title}」有未提交的改动`,forceDeleteConfirm:`强制移除`,legacyAdoptTitle:`移除 {count} 个 Rove 自己加进来的会话?`,legacyAdoptBody:`旧版 Rove 会在别处创建 worktree 时自动加一个会话,现在已经不会了。下面这些看起来是当时留下的:
26
26
  {list}
27
27
 
28
28
  可以交给 agent:它先列出来,你确认哪些就删哪些,并把设置里还留着的旧版 Rove worktree hook 一起清掉。`,legacyAdoptMore:`……还有 {count} 个`,legacyAdoptClean:`交给 agent`,legacyAdoptLater:`以后再说`,legacyAdoptNever:`不再提示`,legacyAdoptSessionTitle:`移除残留会话`,legacyAdoptPrompt:`旧版 Rove 会在 Rove 之外创建 git worktree 时自动往侧栏加会话。下面这些看起来是当时留下的:
@@ -31,53 +31,53 @@ Then look for the hook that older version installed. Check my engine settings fi
31
31
 
32
32
  先把这份清单给我看,问我要删哪些,然后等我回答。对我确认的每一个,先运行 \`git -C <path> status --short\`;有未提交的改动就告诉我并再问一次,没有就运行 \`rove api delete --task-id <id> --wait\`。我没确认的一个都不要删,也不要加 --force。
33
33
 
34
- 然后找一下那个旧版本装的 hook。检查我的引擎设置文件,包括全局的和上面每个仓库里的,找命令里运行 \`rove hook worktree-created\` 的 hook。把找到的每一条连同所在文件给我看,我确认后再删。其他 hook 一律不动。`,legacyAdoptFailed:`清理会话没能启动:{message}`},Hi={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}`,noDiskSpace:`The disk is full, so the checkout could not be created. Free some space, then try again.`,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: {error}`,deleteFailed:`Couldn't delete "{title}": {error}`,createFailed:`Couldn't create the task: {error}`,engineStartFailed:`Task created; engine did not start`,engineStartRetry:`{error}. Press ⏎ on the task to retry.`,forkFailed:`Couldn't fork the task: {error}`,forkLeftBehind:`Started from the last commit — uncommitted work stays in the original task ({reason})`,childFailed:`Couldn't start the new conversation: {error}`,renameFailed:`Couldn't rename the task: {error}`,renameBranchFailed:`Couldn't rename the branch: {error}`,switchEngineFailed:`Couldn't switch the engine: {error}`,setStatusFailed:`Couldn't set the status: {error}`,pinFailed:`Couldn't change the pin: {error}`,moveFailed:`Couldn't move the task: {error}`,moveToProjectFailed:`Couldn't move the task to that project: {error}`,movedToProject:`Moved to {project}`,issueChatFailed:`Couldn't start the issue chat: {error}`,inboxMarkReadFailed:`Couldn't mark it read: {error}`,inboxDismissFailed:`Couldn't dismiss it: {error}`,engineSwitched:`Engine → {engine} (applies on reopen)`,statusSet:`Status → {status}`},Ui={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}`,noDiskSpace:`磁盘空间不足,没法创建工作目录。清理出一些空间后再重试。`,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}」失败:{error}`,createFailed:`创建任务失败:{error}`,engineStartFailed:`任务已创建,引擎没有启动`,engineStartRetry:`{error}。在任务上按 ⏎ 重试。`,forkFailed:`fork 任务失败:{error}`,forkLeftBehind:`已从最近一次提交开始——未提交的改动留在原任务里({reason})`,childFailed:`无法开始新对话:{error}`,renameFailed:`重命名任务失败:{error}`,renameBranchFailed:`重命名分支失败:{error}`,switchEngineFailed:`切换引擎失败:{error}`,setStatusFailed:`设置状态失败:{error}`,pinFailed:`修改置顶状态失败:{error}`,moveFailed:`移动任务失败:{error}`,moveToProjectFailed:`移到该项目失败:{error}`,movedToProject:`已移到 {project}`,issueChatFailed:`启动议题会话失败:{error}`,inboxMarkReadFailed:`标记为已读失败:{error}`,inboxDismissFailed:`忽略失败:{error}`,engineSwitched:`引擎 → {engine}(重新打开后生效)`,statusSet:`状态 → {status}`},Wi={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`,muteNotifications:`Mute notifications`,unmuteNotifications:`Unmute notifications`,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}`,restored:`Restored {title}`,busyTitle:`Archive while it's working?`,busyBody:`An engine in {title} is still working or waiting on you. Archiving stops 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:Bi,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:Hi},Gi={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:`合入基础分支`,muteNotifications:`静音通知`,unmuteNotifications:`取消静音通知`,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:Vi,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:Ui},Ki={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.`}},qi={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、暂停的任务)会立即结束。`}},Ji={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. Restart Rove to run v{latest}; this page reloads itself when it is back.`,webRestart:`Restart Rove`,webRestarting:`Restarting Rove… this page reloads itself when it is back.`,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`}},Yi={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:`已安装。重启 Rove 后运行 v{latest};恢复后页面会自动刷新。`,webRestart:`重启 Rove`,webRestarting:`正在重启 Rove… 恢复后页面会自动刷新。`,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 关闭`}},Xi={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}`}},Zi={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} 恢复`}},Qi={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:{}},$i={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:{}},ea={common:{en:Oi,zh:ki},doctor:{en:Ai,zh:ji},files:{en:Mi,zh:Ni},newTask:{en:Pi,zh:Fi},onboarding:{en:Ii,zh:Li},quickTask:{en:Ri,zh:zi},tasks:{en:Wi,zh:Gi},terminal:{en:Ki,zh:qi},update:{en:Ji,zh:Yi},workspace:{en:Xi,zh:Zi},worktrees:{en:Qi,zh:$i}};function ta(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 q(e,t,n){let r=ea[e],i=ta(r[At.get()],t)??ta(r.en,t)??t;return n?i.replace(/\{(\w+)\}/g,(e,t)=>String(n[t]??e)):i}var na=[{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`}],ra=[{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`}}],ia=[{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`}}],aa=[{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:`→`}},...na,...ra,...ia,{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`}],oa={ctrl:`⌃`,control:`⌃`,alt:`⌥`,opt:`⌥`,option:`⌥`,shift:`⇧`,cmd:`⌘`,command:`⌘`,meta:`⌘`,super:`⌘`},sa={enter:`⏎`,return:`⏎`,esc:`⎋`,escape:`⎋`,space:`␣`,up:`↑`,down:`↓`,left:`←`,right:`→`,backspace:`⌫`,delete:`⌦`,del:`⌦`,pgup:`⇞`,pageup:`⇞`,pgdn:`⇟`,pagedown:`⇟`,home:`↖`,end:`↘`};function ca(e,t){if(e.includes(`/`))return e.split(`/`).map(e=>ca(e,t)).join(`/`);let n=e.toLowerCase();return n===`tab`?`tab`:sa[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 la(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(`+`)?la(e,t):ca(e,!0)}`}let i=n.split(`+`);if(i.length===1)return ca(i[0]??``,!1);let a=i[i.length-1]??``;return`${i.slice(0,-1).map(e=>oa[e.toLowerCase().trim()]??e).join(``)} ${ca(a,!0)}`}var ua={path:``,exists:!1,rows:[],prefix:{key:`ctrl+a`,firstStrokes:[`ctrl+a`],timeoutMs:5e3},plugins:[],applied:[],warnings:[]},da=v(ua),fa=new Map(aa.map(e=>[e.id,{keys:[...e.keys],prefixKeys:e.prefixKeys&&[...e.prefixKeys],hint:e.hint&&{...e.hint}}]));function pa(e){for(let e of aa){let t=fa.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=aa.find(e=>e.id===t.id);e&&(e.keys=[...t.keys],e.prefixKeys=t.prefixKeys&&[...t.prefixKeys],e.hint=t.hint&&{...t.hint})}da.set(e)}async function ma(e){try{pa(await e.request(`keybindings.get`))}catch{}}function ha(e){let t=y(e.conn).hello;(0,h.useEffect)(()=>{if(!t)return;let n=()=>void ma(e);return n(),window.addEventListener(`focus`,n),()=>window.removeEventListener(`focus`,n)},[t,e])}var ga=()=>da.get().prefix.key,_a=()=>{let e=ga();return e===null?``:la(e)};function va(e,t=`direct`){let n=aa.find(t=>t.id===e),r=t===`prefix`?n?.prefixKeys?.[0]:n?.keys[0];return r===void 0?void 0:la(r)}var ya=e=>aa.find(t=>t.id===e)?.keys??[];function ba(e){let t=_a(),n=va(e,`prefix`);return t&&n?`${t} ${n}`:``}var xa=e=>fa.get(e)?.prefixKeys??[];function Sa(e,t){let n=da.get().rows.find(t=>t.id===e),r=fa.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 Ca(e,t){for(let n of t){let t=e.find(e=>e.chord===n);if(t)return t}}function wa(e){return!e.dialog&&e.page!==`worktrees`&&e.page!==`update`}var Ta=v({stale:!1,daemonVersion:null,bridgeVersion:null}),Ea=2e4;async function Da(e){try{let t=await e.request(`daemon.info`);return Ta.set({stale:t.stale,daemonVersion:t.daemonVersion,bridgeVersion:t.bridgeVersion}),t.stale}catch{return Ta.get().stale}}function Oa(e){(0,h.useEffect)(()=>{let t=e.onOpen(()=>void Da(e)),n=K(Ea,()=>void Da(e));return()=>{t(),n()}},[e])}function ka(e){if(!Ta.get().stale){L(q(`update`,`refresh.alreadyCurrent`),`error`);return}C.set((0,H.jsx)(Ti,{title:q(`update`,`refresh.confirmTitle`),body:q(`update`,`refresh.confirmBody`),confirmLabel:q(`update`,`refresh.confirmLabel`),onConfirm:async()=>{await e.request(`daemon.restart`),L(q(`update`,`refresh.relaunching`));for(let t=0;t<20;t++)if(await new Promise(e=>window.setTimeout(e,1e3)),!await Da(e))return;throw Error(B(`layout.refreshTimeout`))}}))}function Aa({onRefresh:e}){V();let{stale:t,daemonVersion:n,bridgeVersion:r}=y(Ta);if(y(da),!t)return null;let i=q(`update`,`skew.hint`,{daemon:n?`v${n}`:q(`update`,`skew.olderBuild`),clientVersion:r??``,keys:ba(`app.refresh`)});return(0,H.jsxs)(`div`,{className:`mono ${Sn}`,role:`alert`,children:[(0,H.jsx)(`b`,{children:q(`update`,`skew.title`)}),(0,H.jsx)(`span`,{children:i}),(0,H.jsx)(`button`,{type:`button`,className:Ar,onClick:e,children:q(`update`,`refresh.confirmLabel`)})]})}var ja=[`info`,`success`,`warning`,`error`,`muted`],Ma=4e3,Na=4e3,Pa=/^[A-Za-z0-9._:-]{1,64}$/,Fa={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 Ia(e){return typeof e==`string`&&ja.includes(e)}function La(e){return e===0||e===1||e===2||e===3}var Ra=class extends Error{};function za(e){let t=0,n=new Set,r=(e,i,a)=>{if(a>12)throw new Ra(`${i}: deeper than 12`);if(++t>400)throw new Ra(`more than 400 elements`);if(!e||typeof e!=`object`||Array.isArray(e))throw new Ra(`${i}: not an element`);let o=e,s=o.type;if(s!==`box`&&s!==`text`&&s!==`button`&&s!==`input`)throw new Ra(`${i}: unknown element ${JSON.stringify(s)}`);for(let e of Object.keys(o))if(!Fa[s].has(e))throw new Ra(`${i}: ${s} has no prop "${e}"`);if(o.tone!==void 0&&!Ia(o.tone))throw new Ra(`${i}: tone must be one of ${ja.join(`, `)}`);if(s===`text`){if(typeof o.text!=`string`||o.text.length>4e3)throw new Ra(`${i}: text must be a string of at most ${Ma} chars`);if(o.bold!==void 0&&typeof o.bold!=`boolean`)throw new Ra(`${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`||!Pa.test(o.key))throw new Ra(`${i}: bad ${s} key`);if(n.has(o.key))throw new Ra(`${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 Ra(`${i}: ${e} must be a string of at most ${Na} 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 Ra(`${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 Ra(`${i}: direction must be "row" or "column"`);for(let e of[`gap`,`padding`])if(o[e]!==void 0&&!La(o[e]))throw new Ra(`${i}: ${e} must be 0-3`);if(o.border!==void 0&&typeof o.border!=`boolean`)throw new Ra(`${i}: border must be boolean`);if(!Array.isArray(o.children))throw new Ra(`${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 Ra)return{ok:!1,error:e.message};throw e}}function Ba(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=za(t.tree);r.ok&&n.push({plugin:t.plugin,id:t.id,title:t.title,tree:r.tree})}return n}function Va(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 Ha(e,t){return e!==null&&t!==null&&e.plugin===t.plugin&&e.pane===t.pane&&e.key===t.key}function Ua(e,t){return e.find(e=>Ha(e,t))??e[0]??null}function Wa(e,t,n){if(e.length===0)return null;let r=e.findIndex(e=>Ha(e,t));return r<0?e[0]??null:e[(r+n+e.length)%e.length]??null}function Ga(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 Ka(e,t){return{...e,rev:t.rev,tasks:Ga(e.tasks,t.tasks),...t.archived?{archived:Ga(e.archived??[],t.archived)}:{},...t.attention?{attention:t.attention}:{},...t.gates?{gates:t.gates}:{}}}function qa(e){return!!e&&typeof e==`object`&&typeof e.from==`number`}var Ja=(e,t)=>n=>({...n,tasks:n.tasks.map(n=>n.id===e?{...n,...t}:n)}),Ya=(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 Xa(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 Za=(e,t)=>n=>{let r=t?n.tasks:n.archived??[],i=Xa(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}},Qa=(e,t)=>n=>{let r=[...n.tasks,...n.archived??[]],i=t?Xa(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)}:{}}},$a={"task.pin":(e,t)=>Ja(e,{pinned:t.pinned===!0}),"task.keep":(e,t)=>Ja(e,{kept:t.kept===!0}),"task.setStatus":(e,t)=>Ja(e,{status:t.status}),"task.rename":(e,t)=>Ya(e,String(t.title)),"task.archive":(e,t)=>Za(e,t.archived===!0),"task.delete":(e,t)=>Qa(e,t.cascade===!0)};Object.keys($a);function eo(e,t){return $a[e]?.(String(t.taskId),t)??null}var to=`rove.web.selection`,no=`null`,ro=300;function io(){try{let e=JSON.parse(localStorage.getItem(to)??`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 J(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 ao(e){return!!e&&typeof e==`object`&&`tasks`in e&&Array.isArray(e.tasks)}var oo=`rove.web.visits`,so=20;function co(){try{let e=JSON.parse(localStorage.getItem(oo)??`[]`);return Array.isArray(e)?e.filter(e=>!!e&&typeof e==`object`&&typeof e.taskId==`string`):[]}catch{return[]}}function lo(e,t){if(t)return e?.tasks.find(e=>e.id===t)??e?.archived?.find(e=>e.id===t)}function uo(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 fo=class{client;tasks=v(null);remote=v([]);tabs=v({});tabsSettled=v(!1);mods=v([]);installedMods=v(new Set);selection=v(io());visits=v(co());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=no;taskShown=!0;viewingExtras=()=>({});constructor(e){this.client=e,e.onOpen(()=>{this.resync(),this.viewingSent=no,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=>{ao(e)&&this.acceptTasks(e)}),e.on(`tasks.patch`,e=>{let t=this.served;t&&qa(e)&&e.from===t.rev?this.acceptTasks(Ka(t,e)):this.resync()}),e.on(`tabs`,e=>this.scheduleTabRefresh(J(e))),e.on(`mods`,e=>this.mods.set(Ba(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??po(n)?.id??null};this.selection.set(r),localStorage.setItem(to,JSON.stringify(r));let i=[{...r,at:Date.now()},...this.visits.get().filter(e=>e.taskId!==r.taskId||e.tabId!==r.tabId)].slice(0,so);this.visits.set(i),localStorage.setItem(oo,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=no)}))}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,L(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=eo(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&&lo(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=uo(r,n.tasks,this.selection.get(),this.visits.get());i?.taskId?this.commitSelection(i.taskId,i.tabId):i&&(this.selection.set(i),localStorage.setItem(to,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+ro-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 po(e){return e.find(e=>e.alive!==!1)??e[0]}function mo({model:e}){let t=y(e.selection),n=y(e.tasks),r=y(e.remote),i=lo(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 ho=[`sidebar`,`workspace`,`files`];function go(e,t,n){let r=ho.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 _o=`.split-leaf.is-active textarea.xterm-helper-textarea`,vo={sidebar:[`.rail`,`.rail`],workspace:[`.workspace`,_o],files:[`.side-panel`,`.side-view:not([hidden]) :is([tabindex='0'], input)`]};function yo(){for(let e of document.querySelectorAll(_o))if(e.closest(`[data-stream]`)?.getClientRects().length)return e;return null}function bo(){let e=yo();return e?.focus(),e!==null}function xo(e){let t=go(Object.keys(vo).find(e=>document.activeElement?.closest(vo[e][0]))??`sidebar`,e,{filesVisible:document.querySelector(vo.files[0])!==null});t&&document.querySelector(vo[t][1])?.focus()}var So=[];function Co(e){So.push(e)}var wo={workspace:`workspace`,sidebar:`sidebar`,files:`files`,terminal:`terminal`};function To(){let e=So.flatMap(e=>e()),t=new Set(e.filter(e=>!e.prefix).map(e=>e.id)),n=e.map(e=>{let t=Sa(e.id,e.prefix?`prefix`:`direct`);return t?{...e,chords:t}:e});for(let r of e){let e=r.prefix?Sa(r.id,`direct`):void 0;if(!e||e.length===0||t.has(r.id))continue;t.add(r.id);let i=aa.find(e=>e.id===r.id)?.scope??`global`;n.push({...r,prefix:!1,chords:e,...wo[i]?{surface:wo[i]}:{}})}return n}function Eo(e,t){return!e.surface||e.surface===t||t===`terminal`&&e.surface===`workspace`}function Do(e,t){return e.surface===t?0:e.surface?1:2}function Oo(){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 ko(e,t){let n=new Set,r=new Set;for(let i of To())!Eo(i,t)||i.live?.(e)===!1||(i.prefix?r:n).add(i.id);return{direct:n,prefix:r,inputPassthrough:t===`terminal`}}function Ao(){let e=new Set(To().map(e=>e.id));return aa.filter(t=>e.has(t.id))}var jo=new Map,Mo=v(null);function No(e){return jo.set(e.stream,e),()=>{jo.get(e.stream)===e&&jo.delete(e.stream),Mo.get()===e&&Mo.set(null)}}function Po(e){return jo.get(e)}Co(()=>[{id:`terminal.scroll-up`,chords:[`ctrl+pageup`],prefix:!1,surface:`terminal`,run:()=>Mo.get()?.scrollPages(-1)},{id:`terminal.scroll-down`,chords:[`ctrl+pagedown`],prefix:!1,surface:`terminal`,run:()=>Mo.get()?.scrollPages(1)},{id:`terminal.reset`,chords:[`f5`],prefix:!1,surface:`terminal`,run:()=>Mo.get()?.reset()}]);var Fo={INPUT:!0,TEXTAREA:!0,SELECT:!0},Io=`.rail, .side-panel, dialog, [role=dialog], [role=menu], [role=listbox]`;function Lo(e){return!e||e.tagName===`BODY`||e.tagName===`HTML`?`none`:e.closest(`.xterm`)?`terminal`:Fo[e.tagName]===!0||e.isContentEditable?`field`:e.closest(Io)?`pane`:`loose`}function Ro(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 zo(){(0,h.useEffect)(()=>{let e=e=>{if(e.key!==`Escape`)return;let t=yo(),n=document.activeElement;if(!Ro(e,Lo(n instanceof HTMLElement?n:null),{overlay:C.get()!==null||S.get()!==null||O.get()!==null||F.get()!==null,terminal:t!==null}))return;let r=t?.closest(`[data-stream]`)?.dataset.stream,i=r?Po(r):void 0;!t||!i||(e.preventDefault(),t.focus(),i.input(`\x1B`))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[])}var Bo=Reflect.get(globalThis,`__roveRelay`);function Vo(e,t){return Bo?Bo.fetch(e,t):fetch(e,t)}function Ho(e,t){return Bo?new Bo.WebSocket(e,t):new WebSocket(e,t)}var Uo=class extends Error{code;detail;constructor(e,t,n){super(t),this.code=e,this.detail=n}},Wo=[500,1e3,2e3,4e3,8e3,15e3],Go=4e3,Ko=1e4,qo=class{url;token;conn=v({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,Go),this.request(`hello`).then(()=>this.clearDeadline(),e=>{e instanceof Uo&&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 Uo(`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=Ho(this.url,this.token?[`rove.v1`,`rove.bearer.${this.token}`]:[`rove.v1`]);this.ws=e,this.armDeadline(e,Ko),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 Uo(`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=Wo[Math.min(n-1,Wo.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 Uo(i,a,r))}retryNow(){this.retryTimer!==null&&(window.clearTimeout(this.retryTimer),this.connect())}};function Jo(){return`${window.location.protocol===`https:`?`wss:`:`ws:`}//${window.location.host}/ws`}function Yo(e){return e instanceof Uo&&e.code===`NOT_CONNECTED`?B(`workspace.connect.notConnected`):e instanceof Error?e.message:String(e)}var Xo=`rove.web.legacyAdopt.dismissed`,Zo=6,Qo=!1,$o=e=>e.replace(/[\\/]+$/,``).split(/[\\/]/).at(-1)??e;function es(){try{return localStorage.getItem(Xo)===`1`}catch{return!1}}function ts(){try{localStorage.setItem(Xo,`1`)}catch{}}function ns(e){let t=e.slice(0,Zo).map(e=>` ${$o(e.repo)}/${e.title}`);return e.length>Zo&&t.push(` ${q(`tasks`,`confirm.legacyAdoptMore`,{count:e.length-Zo})}`),t.join(`
34
+ 然后找一下那个旧版本装的 hook。检查我的引擎设置文件,包括全局的和上面每个仓库里的,找命令里运行 \`rove hook worktree-created\` 的 hook。把找到的每一条连同所在文件给我看,我确认后再删。其他 hook 一律不动。`,legacyAdoptFailed:`清理会话没能启动:{message}`},Hi={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}`,noDiskSpace:`The disk is full, so the checkout could not be created. Free some space, then try again.`,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: {error}`,deleteFailed:`Couldn't delete "{title}": {error}`,createFailed:`Couldn't create the task: {error}`,engineStartFailed:`Task created; engine did not start`,engineStartRetry:`{error}. Press ⏎ on the task to retry.`,forkFailed:`Couldn't fork the task: {error}`,forkLeftBehind:`Started from the last commit — uncommitted work stays in the original task ({reason})`,childFailed:`Couldn't start the new conversation: {error}`,renameFailed:`Couldn't rename the task: {error}`,renameBranchFailed:`Couldn't rename the branch: {error}`,switchEngineFailed:`Couldn't switch the engine: {error}`,setStatusFailed:`Couldn't set the status: {error}`,pinFailed:`Couldn't change the pin: {error}`,moveFailed:`Couldn't move the task: {error}`,moveToProjectFailed:`Couldn't move the task to that project: {error}`,movedToProject:`Moved to {project}`,issueChatFailed:`Couldn't start the issue chat: {error}`,inboxMarkReadFailed:`Couldn't mark it read: {error}`,inboxDismissFailed:`Couldn't dismiss it: {error}`,engineSwitched:`Engine → {engine} (applies on reopen)`,statusSet:`Status → {status}`},Ui={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}`,noDiskSpace:`磁盘空间不足,没法创建工作目录。清理出一些空间后再重试。`,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}」失败:{error}`,createFailed:`创建任务失败:{error}`,engineStartFailed:`任务已创建,引擎没有启动`,engineStartRetry:`{error}。在任务上按 ⏎ 重试。`,forkFailed:`fork 任务失败:{error}`,forkLeftBehind:`已从最近一次提交开始——未提交的改动留在原任务里({reason})`,childFailed:`无法开始新对话:{error}`,renameFailed:`重命名任务失败:{error}`,renameBranchFailed:`重命名分支失败:{error}`,switchEngineFailed:`切换引擎失败:{error}`,setStatusFailed:`设置状态失败:{error}`,pinFailed:`修改置顶状态失败:{error}`,moveFailed:`移动任务失败:{error}`,moveToProjectFailed:`移到该项目失败:{error}`,movedToProject:`已移到 {project}`,issueChatFailed:`启动议题会话失败:{error}`,inboxMarkReadFailed:`标记为已读失败:{error}`,inboxDismissFailed:`忽略失败:{error}`,engineSwitched:`引擎 → {engine}(重新打开后生效)`,statusSet:`状态 → {status}`},Wi={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`,moveProjectUp:`Move up`,moveProjectDown:`Move down`,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`,muteNotifications:`Mute notifications`,unmuteNotifications:`Unmute notifications`,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}`,restored:`Restored {title}`,busyTitle:`Archive while it's working?`,busyBody:`An engine in {title} is still working or waiting on you. Archiving stops 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:Bi,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:Hi},Gi={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:`移到顶部`,moveProjectUp:`上移`,moveProjectDown:`下移`,runAgain:`重新运行`,setStatus:`设置状态`,moveToProject:`移到其他项目…`,copyId:`复制任务 ID`,copyBranch:`复制分支名`,copyPath:`复制路径`,openEditor:`在编辑器中打开`,renameBranch:`重命名分支`,changeEngine:`切换引擎`,fixChecks:`修复失败的检查`,rerunChecks:`重新运行失败的检查`,syncBase:`同步基础分支`,resolveConflicts:`让 agent 解决冲突`,land:`合入基础分支`,muteNotifications:`静音通知`,unmuteNotifications:`取消静音通知`,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:Vi,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:Ui},Ki={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.`}},qi={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、暂停的任务)会立即结束。`}},Ji={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. Restart Rove to run v{latest}; this page reloads itself when it is back.`,webRestart:`Restart Rove`,webRestarting:`Restarting Rove… this page reloads itself when it is back.`,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`}},Yi={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:`已安装。重启 Rove 后运行 v{latest};恢复后页面会自动刷新。`,webRestart:`重启 Rove`,webRestarting:`正在重启 Rove… 恢复后页面会自动刷新。`,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 关闭`}},Xi={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}`}},Zi={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} 恢复`}},Qi={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:{}},$i={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:{}},ea={common:{en:Oi,zh:ki},doctor:{en:Ai,zh:ji},files:{en:Mi,zh:Ni},newTask:{en:Pi,zh:Fi},onboarding:{en:Ii,zh:Li},quickTask:{en:Ri,zh:zi},tasks:{en:Wi,zh:Gi},terminal:{en:Ki,zh:qi},update:{en:Ji,zh:Yi},workspace:{en:Xi,zh:Zi},worktrees:{en:Qi,zh:$i}};function ta(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 q(e,t,n){let r=ea[e],i=ta(r[At.get()],t)??ta(r.en,t)??t;return n?i.replace(/\{(\w+)\}/g,(e,t)=>String(n[t]??e)):i}var na=[{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`}],ra=[{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`}}],ia=[{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`}}],aa=[{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:`→`}},...na,...ra,...ia,{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`}],oa={ctrl:`⌃`,control:`⌃`,alt:`⌥`,opt:`⌥`,option:`⌥`,shift:`⇧`,cmd:`⌘`,command:`⌘`,meta:`⌘`,super:`⌘`},sa={enter:`⏎`,return:`⏎`,esc:`⎋`,escape:`⎋`,space:`␣`,up:`↑`,down:`↓`,left:`←`,right:`→`,backspace:`⌫`,delete:`⌦`,del:`⌦`,pgup:`⇞`,pageup:`⇞`,pgdn:`⇟`,pagedown:`⇟`,home:`↖`,end:`↘`};function ca(e,t){if(e.includes(`/`))return e.split(`/`).map(e=>ca(e,t)).join(`/`);let n=e.toLowerCase();return n===`tab`?`tab`:sa[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 la(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(`+`)?la(e,t):ca(e,!0)}`}let i=n.split(`+`);if(i.length===1)return ca(i[0]??``,!1);let a=i[i.length-1]??``;return`${i.slice(0,-1).map(e=>oa[e.toLowerCase().trim()]??e).join(``)} ${ca(a,!0)}`}var ua={path:``,exists:!1,rows:[],prefix:{key:`ctrl+a`,firstStrokes:[`ctrl+a`],timeoutMs:5e3},plugins:[],applied:[],warnings:[]},da=v(ua),fa=new Map(aa.map(e=>[e.id,{keys:[...e.keys],prefixKeys:e.prefixKeys&&[...e.prefixKeys],hint:e.hint&&{...e.hint}}]));function pa(e){for(let e of aa){let t=fa.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=aa.find(e=>e.id===t.id);e&&(e.keys=[...t.keys],e.prefixKeys=t.prefixKeys&&[...t.prefixKeys],e.hint=t.hint&&{...t.hint})}da.set(e)}async function ma(e){try{pa(await e.request(`keybindings.get`))}catch{}}function ha(e){let t=y(e.conn).hello;(0,h.useEffect)(()=>{if(!t)return;let n=()=>void ma(e);return n(),window.addEventListener(`focus`,n),()=>window.removeEventListener(`focus`,n)},[t,e])}var ga=()=>da.get().prefix.key,_a=()=>{let e=ga();return e===null?``:la(e)};function va(e,t=`direct`){let n=aa.find(t=>t.id===e),r=t===`prefix`?n?.prefixKeys?.[0]:n?.keys[0];return r===void 0?void 0:la(r)}var ya=e=>aa.find(t=>t.id===e)?.keys??[];function ba(e){let t=_a(),n=va(e,`prefix`);return t&&n?`${t} ${n}`:``}var xa=e=>fa.get(e)?.prefixKeys??[];function Sa(e,t){let n=da.get().rows.find(t=>t.id===e),r=fa.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 Ca(e,t){for(let n of t){let t=e.find(e=>e.chord===n);if(t)return t}}function wa(e){return!e.dialog&&e.page!==`worktrees`&&e.page!==`update`}var Ta=v({stale:!1,daemonVersion:null,bridgeVersion:null}),Ea=2e4;async function Da(e){try{let t=await e.request(`daemon.info`);return Ta.set({stale:t.stale,daemonVersion:t.daemonVersion,bridgeVersion:t.bridgeVersion}),t.stale}catch{return Ta.get().stale}}function Oa(e){(0,h.useEffect)(()=>{let t=e.onOpen(()=>void Da(e)),n=K(Ea,()=>void Da(e));return()=>{t(),n()}},[e])}function ka(e){if(!Ta.get().stale){L(q(`update`,`refresh.alreadyCurrent`),`error`);return}C.set((0,H.jsx)(Ti,{title:q(`update`,`refresh.confirmTitle`),body:q(`update`,`refresh.confirmBody`),confirmLabel:q(`update`,`refresh.confirmLabel`),onConfirm:async()=>{await e.request(`daemon.restart`),L(q(`update`,`refresh.relaunching`));for(let t=0;t<20;t++)if(await new Promise(e=>window.setTimeout(e,1e3)),!await Da(e))return;throw Error(B(`layout.refreshTimeout`))}}))}function Aa({onRefresh:e}){V();let{stale:t,daemonVersion:n,bridgeVersion:r}=y(Ta);if(y(da),!t)return null;let i=q(`update`,`skew.hint`,{daemon:n?`v${n}`:q(`update`,`skew.olderBuild`),clientVersion:r??``,keys:ba(`app.refresh`)});return(0,H.jsxs)(`div`,{className:`mono ${Sn}`,role:`alert`,children:[(0,H.jsx)(`b`,{children:q(`update`,`skew.title`)}),(0,H.jsx)(`span`,{children:i}),(0,H.jsx)(`button`,{type:`button`,className:Ar,onClick:e,children:q(`update`,`refresh.confirmLabel`)})]})}var ja=[`info`,`success`,`warning`,`error`,`muted`],Ma=4e3,Na=4e3,Pa=/^[A-Za-z0-9._:-]{1,64}$/,Fa={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 Ia(e){return typeof e==`string`&&ja.includes(e)}function La(e){return e===0||e===1||e===2||e===3}var Ra=class extends Error{};function za(e){let t=0,n=new Set,r=(e,i,a)=>{if(a>12)throw new Ra(`${i}: deeper than 12`);if(++t>400)throw new Ra(`more than 400 elements`);if(!e||typeof e!=`object`||Array.isArray(e))throw new Ra(`${i}: not an element`);let o=e,s=o.type;if(s!==`box`&&s!==`text`&&s!==`button`&&s!==`input`)throw new Ra(`${i}: unknown element ${JSON.stringify(s)}`);for(let e of Object.keys(o))if(!Fa[s].has(e))throw new Ra(`${i}: ${s} has no prop "${e}"`);if(o.tone!==void 0&&!Ia(o.tone))throw new Ra(`${i}: tone must be one of ${ja.join(`, `)}`);if(s===`text`){if(typeof o.text!=`string`||o.text.length>4e3)throw new Ra(`${i}: text must be a string of at most ${Ma} chars`);if(o.bold!==void 0&&typeof o.bold!=`boolean`)throw new Ra(`${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`||!Pa.test(o.key))throw new Ra(`${i}: bad ${s} key`);if(n.has(o.key))throw new Ra(`${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 Ra(`${i}: ${e} must be a string of at most ${Na} 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 Ra(`${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 Ra(`${i}: direction must be "row" or "column"`);for(let e of[`gap`,`padding`])if(o[e]!==void 0&&!La(o[e]))throw new Ra(`${i}: ${e} must be 0-3`);if(o.border!==void 0&&typeof o.border!=`boolean`)throw new Ra(`${i}: border must be boolean`);if(!Array.isArray(o.children))throw new Ra(`${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 Ra)return{ok:!1,error:e.message};throw e}}function Ba(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=za(t.tree);r.ok&&n.push({plugin:t.plugin,id:t.id,title:t.title,tree:r.tree})}return n}function Va(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 Ha(e,t){return e!==null&&t!==null&&e.plugin===t.plugin&&e.pane===t.pane&&e.key===t.key}function Ua(e,t){return e.find(e=>Ha(e,t))??e[0]??null}function Wa(e,t,n){if(e.length===0)return null;let r=e.findIndex(e=>Ha(e,t));return r<0?e[0]??null:e[(r+n+e.length)%e.length]??null}function Ga(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 Ka(e,t){return{...e,rev:t.rev,tasks:Ga(e.tasks,t.tasks),...t.archived?{archived:Ga(e.archived??[],t.archived)}:{},...t.attention?{attention:t.attention}:{},...t.gates?{gates:t.gates}:{}}}function qa(e){return!!e&&typeof e==`object`&&typeof e.from==`number`}var Ja=(e,t)=>n=>({...n,tasks:n.tasks.map(n=>n.id===e?{...n,...t}:n)}),Ya=(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 Xa(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 Za=(e,t)=>n=>{let r=t?n.tasks:n.archived??[],i=Xa(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}},Qa=(e,t)=>n=>{let r=[...n.tasks,...n.archived??[]],i=t?Xa(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)}:{}}},$a={"task.pin":(e,t)=>Ja(e,{pinned:t.pinned===!0}),"task.keep":(e,t)=>Ja(e,{kept:t.kept===!0}),"task.setStatus":(e,t)=>Ja(e,{status:t.status}),"task.rename":(e,t)=>Ya(e,String(t.title)),"task.archive":(e,t)=>Za(e,t.archived===!0),"task.delete":(e,t)=>Qa(e,t.cascade===!0)};Object.keys($a);function eo(e,t){return $a[e]?.(String(t.taskId),t)??null}var to=`rove.web.selection`,no=`null`,ro=300;function io(){try{let e=JSON.parse(localStorage.getItem(to)??`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 J(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 ao(e){return!!e&&typeof e==`object`&&`tasks`in e&&Array.isArray(e.tasks)}var oo=`rove.web.visits`,so=20;function co(){try{let e=JSON.parse(localStorage.getItem(oo)??`[]`);return Array.isArray(e)?e.filter(e=>!!e&&typeof e==`object`&&typeof e.taskId==`string`):[]}catch{return[]}}function lo(e,t){if(t)return e?.tasks.find(e=>e.id===t)??e?.archived?.find(e=>e.id===t)}function uo(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 fo=class{client;tasks=v(null);remote=v([]);tabs=v({});tabsSettled=v(!1);mods=v([]);installedMods=v(new Set);selection=v(io());visits=v(co());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=no;taskShown=!0;viewingExtras=()=>({});constructor(e){this.client=e,e.onOpen(()=>{this.resync(),this.viewingSent=no,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=>{ao(e)&&this.acceptTasks(e)}),e.on(`tasks.patch`,e=>{let t=this.served;t&&qa(e)&&e.from===t.rev?this.acceptTasks(Ka(t,e)):this.resync()}),e.on(`tabs`,e=>this.scheduleTabRefresh(J(e))),e.on(`mods`,e=>this.mods.set(Ba(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??po(n)?.id??null};this.selection.set(r),localStorage.setItem(to,JSON.stringify(r));let i=[{...r,at:Date.now()},...this.visits.get().filter(e=>e.taskId!==r.taskId||e.tabId!==r.tabId)].slice(0,so);this.visits.set(i),localStorage.setItem(oo,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=no)}))}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,L(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=eo(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&&lo(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=uo(r,n.tasks,this.selection.get(),this.visits.get());i?.taskId?this.commitSelection(i.taskId,i.tabId):i&&(this.selection.set(i),localStorage.setItem(to,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+ro-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 po(e){return e.find(e=>e.alive!==!1)??e[0]}function mo({model:e}){let t=y(e.selection),n=y(e.tasks),r=y(e.remote),i=lo(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 ho=[`sidebar`,`workspace`,`files`];function go(e,t,n){let r=ho.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 _o=`.split-leaf.is-active textarea.xterm-helper-textarea`,vo={sidebar:[`.rail`,`.rail`],workspace:[`.workspace`,_o],files:[`.side-panel`,`.side-view:not([hidden]) :is([tabindex='0'], input)`]};function yo(){for(let e of document.querySelectorAll(_o))if(e.closest(`[data-stream]`)?.getClientRects().length)return e;return null}function bo(){let e=yo();return e?.focus(),e!==null}function xo(e){let t=go(Object.keys(vo).find(e=>document.activeElement?.closest(vo[e][0]))??`sidebar`,e,{filesVisible:document.querySelector(vo.files[0])!==null});t&&document.querySelector(vo[t][1])?.focus()}var So=[];function Co(e){So.push(e)}var wo={workspace:`workspace`,sidebar:`sidebar`,files:`files`,terminal:`terminal`};function To(){let e=So.flatMap(e=>e()),t=new Set(e.filter(e=>!e.prefix).map(e=>e.id)),n=e.map(e=>{let t=Sa(e.id,e.prefix?`prefix`:`direct`);return t?{...e,chords:t}:e});for(let r of e){let e=r.prefix?Sa(r.id,`direct`):void 0;if(!e||e.length===0||t.has(r.id))continue;t.add(r.id);let i=aa.find(e=>e.id===r.id)?.scope??`global`;n.push({...r,prefix:!1,chords:e,...wo[i]?{surface:wo[i]}:{}})}return n}function Eo(e,t){return!e.surface||e.surface===t||t===`terminal`&&e.surface===`workspace`}function Do(e,t){return e.surface===t?0:e.surface?1:2}function Oo(){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 ko(e,t){let n=new Set,r=new Set;for(let i of To())!Eo(i,t)||i.live?.(e)===!1||(i.prefix?r:n).add(i.id);return{direct:n,prefix:r,inputPassthrough:t===`terminal`}}function Ao(){let e=new Set(To().map(e=>e.id));return aa.filter(t=>e.has(t.id))}var jo=new Map,Mo=v(null);function No(e){return jo.set(e.stream,e),()=>{jo.get(e.stream)===e&&jo.delete(e.stream),Mo.get()===e&&Mo.set(null)}}function Po(e){return jo.get(e)}Co(()=>[{id:`terminal.scroll-up`,chords:[`ctrl+pageup`],prefix:!1,surface:`terminal`,run:()=>Mo.get()?.scrollPages(-1)},{id:`terminal.scroll-down`,chords:[`ctrl+pagedown`],prefix:!1,surface:`terminal`,run:()=>Mo.get()?.scrollPages(1)},{id:`terminal.reset`,chords:[`f5`],prefix:!1,surface:`terminal`,run:()=>Mo.get()?.reset()}]);var Fo={INPUT:!0,TEXTAREA:!0,SELECT:!0},Io=`.rail, .side-panel, dialog, [role=dialog], [role=menu], [role=listbox]`;function Lo(e){return!e||e.tagName===`BODY`||e.tagName===`HTML`?`none`:e.closest(`.xterm`)?`terminal`:Fo[e.tagName]===!0||e.isContentEditable?`field`:e.closest(Io)?`pane`:`loose`}function Ro(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 zo(){(0,h.useEffect)(()=>{let e=e=>{if(e.key!==`Escape`)return;let t=yo(),n=document.activeElement;if(!Ro(e,Lo(n instanceof HTMLElement?n:null),{overlay:C.get()!==null||S.get()!==null||O.get()!==null||F.get()!==null,terminal:t!==null}))return;let r=t?.closest(`[data-stream]`)?.dataset.stream,i=r?Po(r):void 0;!t||!i||(e.preventDefault(),t.focus(),i.input(`\x1B`))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[])}var Bo=Reflect.get(globalThis,`__roveRelay`);function Vo(e,t){return Bo?Bo.fetch(e,t):fetch(e,t)}function Ho(e,t){return Bo?new Bo.WebSocket(e,t):new WebSocket(e,t)}var Uo=class extends Error{code;detail;constructor(e,t,n){super(t),this.code=e,this.detail=n}},Wo=[500,1e3,2e3,4e3,8e3,15e3],Go=4e3,Ko=1e4,qo=class{url;token;conn=v({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,Go),this.request(`hello`).then(()=>this.clearDeadline(),e=>{e instanceof Uo&&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 Uo(`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=Ho(this.url,this.token?[`rove.v1`,`rove.bearer.${this.token}`]:[`rove.v1`]);this.ws=e,this.armDeadline(e,Ko),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 Uo(`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=Wo[Math.min(n-1,Wo.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 Uo(i,a,r))}retryNow(){this.retryTimer!==null&&(window.clearTimeout(this.retryTimer),this.connect())}};function Jo(){return`${window.location.protocol===`https:`?`wss:`:`ws:`}//${window.location.host}/ws`}function Yo(e){return e instanceof Uo&&e.code===`NOT_CONNECTED`?B(`workspace.connect.notConnected`):e instanceof Error?e.message:String(e)}var Xo=`rove.web.legacyAdopt.dismissed`,Zo=6,Qo=!1,$o=e=>e.replace(/[\\/]+$/,``).split(/[\\/]/).at(-1)??e;function es(){try{return localStorage.getItem(Xo)===`1`}catch{return!1}}function ts(){try{localStorage.setItem(Xo,`1`)}catch{}}function ns(e){let t=e.slice(0,Zo).map(e=>` ${$o(e.repo)}/${e.title}`);return e.length>Zo&&t.push(` ${q(`tasks`,`confirm.legacyAdoptMore`,{count:e.length-Zo})}`),t.join(`
35
35
  `)}function rs(e){return q(`tasks`,`confirm.legacyAdoptPrompt`,{list:e.map(e=>`- ${e.id} · ${e.title} · ${e.worktreePath}`).join(`
36
36
  `)})}async function is(e){if(Qo||es())return;Qo=!0;let{tasks:t}=await e.client.request(`worktree.legacyAdopted`,{}).catch(()=>({tasks:[]}));t.length!==0&&C.get()===null&&C.set((0,H.jsx)(as,{model:e,tasks:t}))}function as(e){let[t,n]=(0,h.useState)(!1),[r,i]=(0,h.useState)(null),a=async()=>{n(!0),i(null);try{let{taskId:t}=await e.model.client.request(`worktree.legacyCleanup`,{title:q(`tasks`,`confirm.legacyAdoptSessionTitle`),prompt:rs(e.tasks)});z(),e.model.selectWhenListed(t)}catch(e){i(q(`tasks`,`confirm.legacyAdoptFailed`,{message:Yo(e)}))}finally{n(!1)}};return(0,H.jsx)(Si,{title:q(`tasks`,`confirm.legacyAdoptTitle`,{count:e.tasks.length}),children:(0,H.jsxs)(`div`,{className:Gr,children:[(0,H.jsx)(`p`,{className:`text-muted whitespace-pre-wrap`,children:q(`tasks`,`confirm.legacyAdoptBody`,{list:ns(e.tasks)})}),r&&(0,H.jsx)(`p`,{className:`text-error`,children:r}),(0,H.jsxs)(`div`,{className:Nr,children:[(0,H.jsx)(U,{onClick:()=>{ts(),z()},children:q(`tasks`,`confirm.legacyAdoptNever`)}),(0,H.jsx)(U,{onClick:z,children:q(`tasks`,`confirm.legacyAdoptLater`)}),(0,H.jsx)(U,{variant:`filled`,disabled:t,autoFocus:!0,onClick:()=>void a(),children:q(`tasks`,`confirm.legacyAdoptClean`)})]})]})})}function os(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 ss(e=Vo){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 cs(e=Vo){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 ls(e,t=Vo){try{let n=await t(`/login`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({password:e}),credentials:`omit`}),r=os(n.status,await n.json().catch(()=>null));return r.kind===`ok`&&a(r.token),r}catch{return{kind:`unreachable`}}}async function us(e=Vo){let t=i();o(),t&&await e(`/logout`,{method:`POST`,headers:{Authorization:`Bearer ${t}`}}).catch(()=>{})}function ds(e){if(!e)return null;switch(e.kind){case`ok`:return null;case`wrong`:return B(`login.wrong`);case`locked`:return B(`login.locked`,{minutes:e.minutes});case`lockedHost`:return B(`login.lockedHost`);case`unreachable`:return B(`login.unreachable`)}}function fs(){V();let[e,t]=(0,h.useState)(``),[n,r]=(0,h.useState)(!1),[i,a]=(0,h.useState)(null),o=ds(i);return(0,H.jsx)(`div`,{className:Kn,children:(0,H.jsxs)(`form`,{className:qn,onSubmit:async i=>{if(i.preventDefault(),n||!e)return;r(!0);let o=await ls(e);if(o.kind===`ok`){window.location.reload();return}t(``),a(o),r(!1)},children:[(0,H.jsxs)(`span`,{className:Wn,children:[(0,H.jsx)(`span`,{className:Gn,children:`[`}),` rove `,(0,H.jsx)(`span`,{className:Gn,children:`]`})]}),(0,H.jsx)(`h1`,{className:`${W} text-muted`,children:B(`login.title`)}),(0,H.jsx)(`p`,{className:`text-muted`,children:B(`login.body`)}),(0,H.jsx)(`input`,{className:Mr,type:`password`,autoComplete:`current-password`,"aria-label":B(`login.field`),placeholder:B(`login.field`),autoFocus:!0,value:e,disabled:n,onChange:e=>{t(e.target.value),a(null)}}),o&&(0,H.jsx)(`p`,{className:`text-error`,role:`alert`,children:o}),(0,H.jsx)(`div`,{className:Nr,children:(0,H.jsx)(`button`,{type:`submit`,className:xr(),disabled:n||!e,children:B(n?`login.checking`:`login.submit`)})})]})})}function ps(e){return(0,H.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,H.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 ms=120;function hs(e,t,n,r=e-t){return e+t+8<=n?e:Math.max(8,Math.min(r,n-t-8))}function gs(e){let{item:t}=e;return(0,H.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:qr({selected:e.selected,open:e.open,danger:t.danger}),onMouseEnter:e.onEnter,onMouseLeave:e.onLeave,onClick:e.onPick,children:[(0,H.jsx)(`span`,{children:t.label}),t.children?(0,H.jsx)(ps,{right:!0,className:Xr(!!(e.selected||e.open))}):t.checked?(0,H.jsx)(`span`,{className:Zr,"aria-hidden":!0,children:`✓`}):t.key&&(0,H.jsx)(`span`,{className:Yr({selected:e.selected,danger:t.danger}),children:t.key})]})}function _s(){let e=y(S),[t,n]=(0,h.useState)(0),[r,i]=(0,h.useState)(null),[a,o]=(0,h.useState)(-1),[s,c]=(0,h.useState)(!1),l=(0,h.useRef)(null),u=(0,h.useRef)(null),d=(0,h.useRef)([]),f=(0,h.useRef)(void 0),[p,m]=(0,h.useState)({x:0,y:0}),[g,_]=(0,h.useState)({x:0,y:0});if((0,h.useLayoutEffect)(()=>{if(!e||!l.current)return;n(e.start??(e.fromKeyboard?0:-1)),i(null),c(!1);let{width:t,height:r}=l.current.getBoundingClientRect(),a=e.right===void 0?e.x:Math.max(e.right-l.current.offsetWidth,0);m({x:hs(a,t,window.innerWidth),y:hs(e.y,r,window.innerHeight)});let o=e.target;return o?.setAttribute(`data-menu-open`,``),()=>o?.removeAttribute(`data-menu-open`)},[e]),(0,h.useLayoutEffect)(()=>{let e=r===null?null:d.current[r];if(!e||!l.current||!u.current)return;let t=l.current.getBoundingClientRect(),n=e.getBoundingClientRect(),{width:i,height:a}=u.current.getBoundingClientRect();_({x:hs(t.right+2,i,window.innerWidth,t.left-i-2),y:hs(n.top-5,a,window.innerHeight,n.bottom+5-a)})},[r]),(0,h.useEffect)(()=>()=>window.clearTimeout(f.current),[]),(0,h.useEffect)(()=>{if(!e)return;let d=e.items,f=r===null?[]:d[r]?.children??[],p=()=>S.set(null),m=e=>{e?.run&&(p(),e.run())},h=(e,t,n)=>e(e=>n===1?e>=t?0:e+1:e<=0?t:e-1),g=e=>{let l=e.key;if(s&&r!==null){let t=f.length-1;if(l===`Escape`||l===`ArrowLeft`||l===`h`)i(null),c(!1);else if(l===`ArrowDown`||l===`j`)h(o,t,1);else if(l===`ArrowUp`||l===`k`)h(o,t,-1);else if(l===`Home`)o(0);else if(l===`End`)o(t);else if(l===`Enter`)m(f[a]);else return;e.preventDefault(),e.stopPropagation();return}let u=d.length-1,g=d[t],_=()=>{i(t),c(!0),o(0)};if(l===`Escape`)p();else if(l===`ArrowDown`||l===`j`)h(n,u,1);else if(l===`ArrowUp`||l===`k`)h(n,u,-1);else if(l===`Home`)n(0);else if(l===`End`)n(u);else if((l===`ArrowRight`||l===`l`)&&g?.children)_();else if(l===`Enter`)g?.children?_():m(g);else return;e.preventDefault(),e.stopPropagation()},_=e=>{e.target instanceof Node&&(l.current?.contains(e.target)||u.current?.contains(e.target))||p()};return window.addEventListener(`keydown`,g,!0),window.addEventListener(`mousedown`,_),()=>{window.removeEventListener(`keydown`,g,!0),window.removeEventListener(`mousedown`,_)}},[e,t,r,a,s]),!e)return null;let v=r===null?null:e.items[r]?.children,b=e=>{e.run&&(S.set(null),e.run())},x=e=>{window.clearTimeout(f.current),i(e),c(!1),o(-1)};return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{ref:l,className:Kr(),role:`menu`,style:{left:p.x,top:p.y,minWidth:e.minWidth},children:e.items.map((a,o)=>(0,H.jsxs)(h.Fragment,{children:[o>0&&a.section!==e.items[o-1]?.section&&(0,H.jsx)(`hr`,{className:`-mx-1 my-1 h-px flex-none border-none bg-line`}),(0,H.jsx)(gs,{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),ms):i(null)},onLeave:()=>{window.clearTimeout(f.current),o!==r&&n(-1)},onPick:()=>a.children?x(o):b(a)})]},a.label))}),v&&(0,H.jsx)(`div`,{ref:u,className:Kr(!0),role:`menu`,style:{left:g.x,top:g.y},children:v.map((e,t)=>(0,H.jsx)(gs,{item:e,selected:t===a,onEnter:()=>{o(t),c(!0)},onLeave:()=>o(-1),onPick:()=>b(e)},e.label))})]})}function vs(){let e=y(C),t=y(T);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(_s,{}),e,(0,H.jsx)(`div`,{className:Qr,"aria-live":`polite`,children:t.map(e=>{let t=`${ni(e.tone===`error`)} ${e.leaving?`is-leaving`:``}`,n=e.action;return n?(0,H.jsxs)(`div`,{className:`${t} ${$r}`,children:[(0,H.jsx)(`span`,{className:ei,children:e.text}),(0,H.jsx)(U,{className:ti,onClick:()=>{R(e.id),n.run()},children:`[ ${n.label} ]`})]},e.id):(0,H.jsx)(`button`,{type:`button`,className:t,onClick:()=>R(e.id),children:e.text},e.id)})})]})}function ys(e){return e.urls[e.at]??``}function bs(e){try{return new URL(e).host.replace(/^www\./,``)}catch{return e}}function xs(){return{kind:`browser`,tabs:[{id:`t1`,urls:[],at:-1}],active:`t1`,recent:[`t1`],next:2}}function Ss(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 Cs(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=As(t,e.id)??t}return t}function ws(e,t){let n=`t${e.next}`,r={id:n,urls:t,at:t.length-1};return Cs(Ss({...e,tabs:[...e.tabs,r],next:e.next+1},n))}function Ts(e){return ws(e,[])}function Es(e,t){return{...e,tabs:e.tabs.map(e=>e.id===t.id?t:e)}}function Ds(e,t,n){let r=e.tabs.find(e=>e.id===t);if(!r||ys(r)===n)return e;let i=[...r.urls.slice(0,r.at+1),n].slice(-30);return Es(e,{...r,urls:i,at:i.length-1})}function Os(e,t,n){let r=e.tabs.find(e=>e.id===t);return!r||n===r.at||n<0||n>=r.urls.length?e:Es(e,{...r,at:n})}function ks(e,t){let n=e.tabs.find(e=>ys(e)===t);if(n)return Ss(e,n.id);let r=e.tabs.find(e=>ys(e)===``);return r?Ds(Ss(e,r.id),r.id,t):ws(e,[t])}function As(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 js(e,t){return e.tabs.some(e=>e.id===t)?As(e,t):e}function Ms(e,t){let n=e.tabs.find(e=>e.id===t);return n?{...e,tabs:[n],active:t,recent:[t]}:e}function Ns(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 Ps(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 Fs=[`quota`,`files`,`file`,`diff`,`chat`,`browser`],Is=1e3;function Ls(){return{columns:[{kind:`files`}],weights:{}}}function Rs(e,t){return e.columns.find(e=>e.kind===t)}function zs(e){return e.slice(e.lastIndexOf(`/`)+1)}function Bs(e,t){return{...e,columns:e.columns.map(e=>e.kind===t.kind?t:e)}}function Vs(e){return[...e].sort((e,t)=>Fs.indexOf(e.kind)-Fs.indexOf(t.kind))}function Hs(e,t){return{...e,columns:Vs([...e.columns,t])}}function Us(e,t){return Rs(e,t)||t===`file`?e:Hs(e,t===`diff`?{kind:t,path:`.`,scope:`working`}:t===`browser`?xs():{kind:t})}function Ws(e,t,n){let r=n===void 0?{kind:`file`,path:t}:{kind:`file`,path:t,at:n},i=Rs(e,`file`);return i?i.kind===`file`&&i.path===t&&(n===void 0||i.at===n)?e:Bs(e,r):Hs(e,r)}function Gs(e,t,n,r){let i=r===void 0?{kind:`diff`,path:t,scope:n}:{kind:`diff`,path:t,scope:n,at:r},a=Rs(e,`diff`);return a?a.kind===`diff`&&a.path===t&&a.scope===n&&(r===void 0||a.at===r)?e:Bs(e,i):Hs(e,i)}function Ks(e,t){let n=Rs(e,`browser`);return n?.kind===`browser`?Bs(e,ks(n,t)):Hs(e,ks(xs(),t))}function qs(e,t){if(!Rs(e,t))return e;let{[t]:n,...r}=e.weights;return{columns:e.columns.filter(e=>e.kind!==t),weights:r}}function Js(e,t){let n=Rs(e,`browser`);if(n?.kind!==`browser`)return e;let r=t(n);return r===n?e:r?Bs(e,r):qs(e,`browser`)}function Ys(e,t,n,r=!1){if(t&&Rs(e,n)){let t=qs(e,n);return{panel:t,open:t.columns.length>0}}if(r){let t=e.columns.filter(e=>e.kind===n);return{panel:Us({...e,columns:t},n),open:!0}}return{panel:Us(e,n),open:!0}}function Xs(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*Is)}function Zs(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 Qs(e){return Object.keys(e.weights).length===0?e:{...e,weights:{}}}function $s(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 ec=Fs.filter(e=>e!==`chat`&&e!==`file`),tc=v(`terminal`),nc=`rove.web.panelWidth`,rc=`rove.web.panelOpen`,ic=v((()=>{let e=Number(localStorage.getItem(nc));return Number.isFinite(e)&&e>0?e:null})());ic.subscribe(()=>{let e=ic.get();e===null?localStorage.removeItem(nc):localStorage.setItem(nc,String(Math.round(e)))}),ic.subscribe(le);var ac=v(localStorage.getItem(rc)===`1`);ac.subscribe(()=>localStorage.setItem(rc,ac.get()?`1`:`0`));var oc=v(!1);ac.subscribe(()=>{ac.get()||oc.set(!1)});function sc(e,t,n=window.innerWidth){let r=Math.max(280,n-t-320);return Math.max(280,Math.min(r,Math.round(e)))}var cc=[`files`,`diff`,`browser`];function lc(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.taskId==`string`&&t.taskId!==``&&cc.includes(t.view)&&typeof t.at==`number`&&(t.url===void 0||typeof t.url==`string`)&&(t.path===void 0||typeof t.path==`string`)}function uc(e){return e.narrow?{panel:!1,panelOpen:!1,narrow:!0}:{panel:!0,panelOpen:e.panelOpen&&!e.zen,narrow:!1}}function dc(e,t){return{tab:e.path?e.view===`files`?`file`:`diff`:e.view,...e.view===`browser`&&e.url?{url:e.url}:{},...e.view!==`browser`&&e.path?{path:e.path}:{},show:t.taskId===e.taskId&&!t.narrow}}function fc(e,t,n){return t.url?Ks(e,t.url):t.path?t.tab===`file`?Ws(e,t.path,n):Gs(e,t.path,`working`,n):Us(e,t.tab)}var pc=[`files`,`chat`,`diff`,`browser`,`quota`],mc=e=>e===`branch`||e===`task`?e:`working`;function hc(e){if(!e||typeof e!=`object`)return null;let t=e;return t.kind===`files`||t.kind===`chat`||t.kind===`quota`?{kind:t.kind}:t.kind===`file`&&typeof t.path==`string`&&t.path!==``&&t.path!==`.`?{kind:`file`,path:t.path}:t.kind===`diff`&&typeof t.path==`string`&&t.path!==``?{kind:`diff`,path:t.path,scope:mc(t.scope)}:t.kind===`browser`?Ps(t.tabs,t.active,t.recent,t.next):null}function gc(e,t){if(!e||typeof e!=`object`)return{};let n=e,r=t.flatMap(({kind:e})=>{let t=n[e];return typeof t==`number`&&Number.isFinite(t)&&t>0?[[e,t]]:[]});return Object.fromEntries(r)}function _c(e){let t=[e.top,e.bottom].map(e=>e&&typeof e==`object`&&`tabs`in e&&Array.isArray(e.tabs)?e.tabs:null);return t[0]?{tabs:t.flatMap(e=>e??[]).filter(e=>!!e&&typeof e==`object`&&/^t\d+$/.test(String(e.id))),recent:Array.isArray(e.recent)?e.recent.filter(e=>typeof e==`string`):[]}:null}function vc(e){let t=_c(e);if(!t)return null;let n=[...new Set(t.tabs.map(e=>e.kind))],r=[];for(let i of n){if((i===`files`||i===`chat`||i===`quota`)&&r.push({kind:i}),i===`diff`){let e=t.tabs.filter(e=>e.kind===`diff`&&typeof e.path==`string`&&e.path!==``),n=[...t.recent].reverse().map(t=>e.find(e=>e.id===t)).find(e=>e)??e[0];n&&r.push({kind:`diff`,path:n.path,scope:mc(n.scope)})}if(i===`browser`){let n=Ps(t.tabs.filter(e=>e.kind===`browser`),void 0,t.recent,e.next);n&&r.push(n)}}return{columns:Vs(r),weights:{}}}function yc(e){if(!e||typeof e!=`object`)return null;let t=e;if(!Array.isArray(t.columns))return vc(t);let n=[];for(let e of t.columns){let t=hc(e);t&&!n.some(e=>e.kind===t.kind)&&n.push(t)}return{columns:Vs(n),weights:gc(t.weights,n)}}function bc(e,t){let n=Ls(),r=typeof t==`string`&&t!==``?t:``;return e!==`browser`&&!r?n:{...n,columns:[...n.columns,r?ks(xs(),r):xs()]}}function xc(e){try{let t=JSON.parse(e??`{}`);return t&&typeof t==`object`&&!Array.isArray(t)?Object.entries(t):[]}catch{return[]}}function Sc(e,t,n){let r=Object.fromEntries(Object.entries(e).filter(([e])=>e!==t));r[t]=n;for(let e of Object.keys(r).slice(0,-50))delete r[e];return r}function Cc(e,t){let n={};for(let[t,r]of xc(e)){let e=yc(r);e&&(n[t]=e)}let r=new Map(xc(t.tab).filter(([,e])=>pc.includes(e))),i=new Map(xc(t.url)),a=[...new Set([...r.keys(),...i.keys()])].filter(e=>!(e in n));n={...Object.fromEntries(a.map(e=>[e,bc(r.get(e),i.get(e))])),...n};for(let e of Object.keys(n).slice(0,-50))delete n[e];return n}var wc=`rove.web.panels`,Tc=`rove.web.panelTab`,Ec=`rove.web.panelUrl`;function Dc(){let e={tab:localStorage.getItem(Tc),url:localStorage.getItem(Ec)},t=Cc(localStorage.getItem(wc),e);return(e.tab!==null||e.url!==null)&&(localStorage.setItem(wc,JSON.stringify(t)),localStorage.removeItem(Tc),localStorage.removeItem(Ec)),t}var Oc=v(Dc()),kc={columns:[],weights:{}};function Ac(e){return y(Oc)[e]??kc}function jc(e){let t=Ac(e??``),n=y(ac),r=y(F)!==null,i=y(O)!==null;return n&&!r&&!i&&(e===null||t.columns.length>0)}function Mc(e){return!ac.get()||F.get()!==null||O.get()!==null?!1:e===null||(Oc.get()[e]??kc).columns.length>0}var Nc=e=>Oc.subscribe(e);function Pc(e,t){let n=Oc.get()[e]??kc,r=t(n);if(r===n)return;let i=Sc(Oc.get(),e,r);Oc.set(i),localStorage.setItem(wc,JSON.stringify(i))}function Fc(e,t){Pc(e,e=>Us(e,t)),ac.set(!0),be()&&tc.set(t)}function Ic(e,t){let n=ac.get(),r=Ys(Oc.get()[e]??kc,n&&!N.get(),t,!n);Pc(e,()=>r.panel),r.open?ac.set(!0):oc.set(!1),r.open&&N.get()&&N.set(!1)}function Lc(e){Pc(e.taskId,t=>Gs(t,e.path,e.scope)),ac.set(!0),N.get()&&N.set(!1),be()&&tc.set(`diff`)}function Rc(e,t){Pc(e,e=>Ws(e,t)),ac.set(!0),N.get()&&N.set(!1),be()&&tc.set(`file`)}function zc(e,t){Pc(e,e=>Ks(e,t)),ac.set(!0),N.get()&&N.set(!1),be()&&tc.set(`browser`)}function Bc(e,t){let n=Oc.get()[e]??kc;!be()&&n.columns.length===0&&oc.set(!1),be()&&tc.get()===t&&!Rs(n,t)&&Fc(e,`files`)}function Vc(e,t){Pc(e,e=>qs(e,t)),Bc(e,t)}function Hc(e,t){Pc(e,e=>Js(e,t)),Bc(e,`browser`)}function Uc(e,t){Hc(e,e=>js(e,t))}function Wc(e,t){let n=dc(e,{taskId:t,narrow:be()});Pc(e.taskId,t=>fc(t,n,e.at)),n.show&&(ac.set(!0),N.get()&&N.set(!1))}var Gc={Enter:`return`," ":`space`,Escape:`escape`,ArrowUp:`up`,ArrowDown:`down`,ArrowLeft:`left`,ArrowRight:`right`,PageUp:`pageup`,PageDown:`pagedown`};function Kc(e){if(e.altKey&&e.code){let t=/^Key([A-Z])$/.exec(e.code);if(t?.[1])return t[1].toLowerCase();let n=/^Digit(\d)$/.exec(e.code);if(n?.[1])return n[1]}return Gc[e.key]??e.key.toLowerCase()}function qc(e){let t=Kc(e),n=t===`return`?[`return`,`enter`]:[t],r=[];e.ctrlKey&&r.push(`ctrl`),e.metaKey&&r.push(`cmd`),e.altKey&&r.push(`alt`);let i=t.length===1;return e.shiftKey&&!i&&r.push(`shift`),r.length===0?e.shiftKey&&i?[...n.map(e=>`shift+${e}`),...n]:n:e.shiftKey&&i?[]:n.map(e=>`${r.join(`+`)}+${e}`)}function Jc(e){return e.startsWith(`shift+`)&&e.length===7?e.slice(6).toUpperCase():e}var Yc=new Map(aa.map(e=>[e.id,{keys:[...e.keys],prefixKeys:e.prefixKeys&&[...e.prefixKeys],hint:e.hint?{...e.hint}:void 0}]));function Xc(){return aa.map(e=>{let t=Yc.get(e.id);return{id:e.id,scope:e.scope,category:e.category,...e.bareKeys?{bareKeys:!0}:{},keys:[...t?.keys??[]],...t?.prefixKeys?{prefixKeys:[...t.prefixKeys]}:{},...t?.hint?{hint:{...t.hint}}:{}}})}var Zc=new Map(aa.map(e=>[e.id,e]));function Qc(e){return Zc.get(e)}function $c(e,t){if(!e)return!0;let n=e.toLowerCase(),r=t.toLowerCase(),i=0;for(let e=0;e<r.length&&i<n.length;e++)r.charCodeAt(e)===n.charCodeAt(i)&&i++;return i===n.length}function el(e){let t=[],n=new Map;for(let r of e){let e=n.get(r.category);e||(e=[],n.set(r.category,e),t.push({category:r.category,rows:e})),e.push(r)}return t}function tl(e){return e.hint?.keys??e.keys[0]}function nl(e){let t=Qc(e);if(!t)return null;let n=tl(t);return n&&n.length>0?n:null}function rl(e){return e.keys.length>0?e.hint?.keys??e.keys[0]??null:e.prefixKeys?.length?null:e.hint?.keys??null}function il(e,t){return e.scope===`global`?!0:t===null?!1:e.scope===t||t===`terminal`&&e.scope===`workspace`}function al(e,t,n,r){let i=[],a=[],o=[],s=new Map;for(let c of e){let e=rl(c),l=il(c,t),u=r?r.direct.has(c.id):l,d=r?r.prefix.has(c.id):l;if(e){let t={binding:c,primary:e,aliases:c.keys.filter(t=>t!==e)};if(u&&(l||c.presentation===`onePress`))c.presentation===`onePress`?a.push(t):i.push(t);else if(!l&&c.scope!==`global`){let e=s.get(c.scope);e?e.push(t):s.set(c.scope,[t])}}n&&d&&c.prefixKeys?.length&&o.push({binding:c,primary:`${n} + ${c.prefixKeys[0]}`,aliases:c.prefixKeys.slice(1).map(e=>`${n} + ${e}`)})}let c=[];i.length&&c.push({kind:`here`,scope:t??void 0,rows:i}),a.length&&c.push({kind:`direct`,rows:a}),o.length&&c.push({kind:`prefix`,rows:o});for(let[e,t]of s)c.push({kind:`other`,scope:e,rows:t});return c}var ol={global:`Global`,sidebar:`Sidebar`,workspace:`Workspace`,files:`Files`,inbox:`Inbox`,terminal:`Terminal`};function sl(e){return e?ol[e]:`Global`}function cl(e){return[`kanban.open`,`automations.open`,`workItems.open`].includes(e)?`Views`:e.startsWith(`focus.`)?`Navigation`:e.startsWith(`inbox.`)||e.startsWith(`attention.`)?`Attention`:e.startsWith(`chat.tab.`)||e.startsWith(`chat.session.`)?`Sessions`:e.startsWith(`chat.fork.`)||e.startsWith(`task.`)?`Tasks`:e.startsWith(`settings.`)||e===`workspace.zenToggle`?`Tools`:Qc(e)?.category??`Global`}function ll(e,t,n){let r=e.trim();return $c(r,t)||$c(r,n)}var ul={title:`Rove — keybindings`,palette:`Search commands`,search:`Type an action name or chord…`,filter:`/ filter actions`,noResults:`No matching actions. Try another name or clear the filter.`,run:`↑↓ select · enter run · esc cancel`,reportProblem:`Report a problem`,reportPrompt:"You are helping the user report a problem with Rove itself (not their own project) as a GitHub issue. First ask what they were doing and what felt wrong: one to three short questions, one at a time. Then collect context: run `rove --version` and `rove daemon status`, and read the last ~50 lines of {logPath} only if the problem could involve the daemon. Draft an issue title and body (what happened, what they expected, steps, relevant output) and show it to the user. Only after they say OK, file it with a heredoc: `rove feedback --kind bug|idea|question --title \"...\" --body-file - <<'EOF'` followed by the body and `EOF`. Then share the issue URL. If it prints a prefilled link instead (gh missing or signed out), give the user that link and tell them to run `gh auth login`.",unavailable:`This action is no longer available. Close and reopen the palette.`,esc:`esc`,scrollKeys:`↑↓ ⇞⇟ scroll`,commandLayer:`{prefix} — more Rove commands`,escCancel:`esc cancel`,directLayer:`Hold ctrl — Rove shortcuts`,releaseCtrl:`release ctrl to close`,overflow:`… F1 for all shortcuts`,moreCommandsPrefix:`More commands (prefix)`,focused:`Focused: {surface}`,allBindings:`All keybinding contexts`,grammar:`Use keys here · one-press Rove shortcuts · {prefix} for more commands · right-click a row for its menu`,disabled:`prefix disabled`,here:`HERE — only in {surface}`,direct:`ONE PRESS — Rove shortcuts`,afterPrefix:`AFTER PREFIX — more Rove commands`,otherPane:`OTHER PANE — {surface}`,marks:{rows:`MARKS — task and tab rows`,inbox:`MARKS — tab strip and Inbox`,pr:`MARKS — pull request chip`},mark:{spinner:`working: an engine turn or a task job is running`,needsInput:`waiting on your answer: a permission prompt or a question`,attention:`needs you: an error, a rate limit, an exited engine or a failed deletion`,unseen:`a turn finished and you have not looked yet`,idle:`quiet`,subagent:`running subagents, in front of the branch`,remote:`the task lives on another machine`,done:`the turn finished`,rateLimited:`rate limited; it resumes on its own`,dead:`the engine process exited`,routineFailed:`a routine run failed`,conflict:`merge conflicts`,checksFailing:`checks failing`,checksPassing:`checks passing`}},dl={title:`Rove — 快捷键`,palette:`搜索命令`,search:`输入操作名称或快捷键…`,filter:`/ 筛选操作`,noResults:`没有匹配的操作。请换个名称或清空筛选。`,run:`↑↓ 选择 · enter 执行 · esc 取消`,reportProblem:`报告问题`,reportPrompt:"你在帮用户把 Rove 本身的问题(不是他们自己项目的问题)提成一个 GitHub issue。先问清楚他们当时在做什么、哪里不对劲:一到三个简短的问题,一次问一个。然后收集上下文:运行 `rove --version` 和 `rove daemon status`,只有问题可能和 daemon 有关时才读 {logPath} 的最后约 50 行。起草 issue 的标题和正文(发生了什么、期望什么、复现步骤、相关输出)并展示给用户。用户确认之后才提交,用 heredoc:`rove feedback --kind bug|idea|question --title \"...\" --body-file - <<'EOF'`,接正文,最后一行 `EOF`。然后把 issue 链接发给用户。如果输出的是预填链接(没装 gh 或没登录),把链接给用户,并告诉他运行 `gh auth login`。",unavailable:`此操作已不可用。请关闭并重新打开命令面板。`,esc:`esc`,scrollKeys:`↑↓ ⇞⇟ 滚动`,commandLayer:`{prefix} — 更多 Rove 命令`,escCancel:`esc 取消`,directLayer:`按住 ctrl — Rove 快捷键`,releaseCtrl:`松开 ctrl 关闭`,overflow:`… 按 F1 查看全部快捷键`,moreCommandsPrefix:`更多命令(prefix)`,focused:`当前焦点:{surface}`,allBindings:`所有快捷键上下文`,grammar:`当前区域直接按 · Rove 单次快捷键 · {prefix} 打开更多命令 · 右键任务行打开菜单`,disabled:`Prefix 已禁用`,here:`当前区域 — 仅在{surface}`,direct:`一次按下 — Rove 快捷键`,afterPrefix:`按下 Prefix 后 — 更多 Rove 命令`,otherPane:`其他区域 — {surface}`,marks:{rows:`标记 — 任务行和标签行`,inbox:`标记 — 标签栏和收件箱`,pr:`标记 — PR 标记`},mark:{spinner:`运行中:引擎正在执行一轮,或任务作业正在运行`,needsInput:`等你回答:权限确认或提问`,attention:`需要你处理:出错、限流、引擎已退出或删除失败`,unseen:`一轮已结束,你还没看过`,idle:`空闲`,subagent:`正在运行的子代理,显示在分支名前`,remote:`任务在另一台机器上`,done:`这一轮已结束`,rateLimited:`被限流,会自动恢复`,dead:`引擎进程已退出`,routineFailed:`例行任务运行失败`,conflict:`存在合并冲突`,checksFailing:`检查未通过`,checksPassing:`检查已通过`}},fl={status:{commands:`{key} commands`,help:`{key} help`,sidebar:`{key} sidebar`,settings:`settings`},pane:{move:`move`,open:`open`,collapse:`collapse`,diff:`diff`}},pl={status:{commands:`{key} 命令`,help:`{key} 帮助`,sidebar:`{key} 侧栏`,settings:`设置`},pane:{move:`移动`,open:`打开`,collapse:`折叠`,diff:`差异`}},ml={category:{Global:`Global`,Sidebar:`Sidebar`,Workspace:`Workspace`,Navigation:`Navigation`,"Tasks pane":`Tasks pane`,Files:`Files`,Terminal:`Terminal`,Views:`Views`,Tasks:`Tasks`,Sessions:`Sessions`,Attention:`Attention`,Tools:`Tools`,"Diff review":`Diff review`,Inbox:`Inbox`},desc:{"palette.open":`Search commands`,"help.open":`Show keybindings help`,"task.new":`New task`,"task.new.global":`New task`,"task.openEditor":`Open active Task directory in editor`,"task.moveMode":`Reorder sidebar rows (then j/k — tab, task, or project)`,"settings.open":`Open settings`,"app.refresh":`Refresh Rove onto the installed build (after an update)`,"settings.open.sidebar":`Open settings`,"inbox.show":`Open Inbox`,"worktrees.open.sidebar":`Open worktrees`,"kanban.open":`Open kanban (issues board)`,"automations.open":`Open routines (scheduled tasks)`,"workItems.open":`Open GitHub issues (external tracker)`,"app.quit":`Quit (with confirm)`,"focus.sidebar":`Back to sidebar (tasks)`,"focus.previous":`Focus previous pane (files → workspace → sidebar)`,"focus.next":`Focus next pane (sidebar → workspace → files)`,"workspace.zenToggle":`Toggle zen mode`,"view.redraw":`Redraw the screen`,"attention.next":`Jump to the next Inbox item`,"sidebar.nav":`Move cursor up/down`,"sidebar.select":`Open the selected task`,"sidebar.tree.open":`Open the row under the cursor`,"sidebar.goto":`Top / bottom of list (gg or shift-G)`,"sidebar.rename":`Rename task`,"sidebar.localMerge":`Reorder row (Shift+M, then j/k — tab, task, or project)`,"sidebar.pin":`Pin / unpin task at top (Shift+P)`,"sidebar.sort":`Cycle task sort (default → recent → attention → name)`,"sidebar.delete":`Remove session (with confirm)`,"sidebar.search.enter":`Search tasks (fuzzy filter)`,"sidebar.search.nav":`Move highlight in search results`,"sidebar.search.submit":`Select search match and exit search`,"sidebar.search.cancel":`Cancel search (restore prior selection)`,"tasks.openWorktree":`Open selected Task directory in your editor`,"tasks.renameBranch":`Rename the selected task's git branch`,"tasks.cycleEngine":`Cycle engine vendor — applies on reopen`,"tasks.update":`Open the update page (when a new version is available)`,"tasks.focusEngine":`Focus the engine pane of the current window`,"chat.tab.new":`New conversation here (a child task sharing this directory)`,"chat.tab.chooseEngine":`New conversation — engine/shell picker with destination + context toggles`,"chat.tab.fork":`Continue this chat in a new child task (same directory, keeps the conversation)`,"chat.fork.new":`Quick-fork: create child task seeded with current repo/branch/model`,"chat.tab.close":`Close chat tab`,"chat.tab.rename":`Rename active chat tab`,"chat.tab.cycle-next":`Next chat tab`,"chat.tab.cycle-prev":`Previous chat tab`,"chat.tab.goto":`Go to chat tab N`,"workspace.split.right":`Split right`,"workspace.split.down":`Split down`,"workspace.split.focus-next":`Focus next split`,"workspace.split.close":`Close active split (tab when unsplit)`,"workspace.split.rename":`Rename active split (tab when unsplit)`,"workspace.reopenSession":`Reopen a session in a task whose tabs are all closed`,"files.nav":`Move cursor up/down`,"files.hierarchy":`Collapse / expand tree level`,"files.open":`Open file in configured editor (diff when supported)`,"files.tab":`Switch tab (cycle All / Changes)`,"files.refresh":`Refresh`,"files.scope":`Toggle Changes scope (working ↔ branch vs base)`,"files.diff":`Open a read-only diff in a workspace tab`,"files.diffAll":`Open the whole worktree's diff in one workspace tab`,"files.openExternal":`Open file in system default app (audio / video / pdf preview)`,"files.mention":`Inject @<path> mention into the engine pane`,"files.createPR":`Ask the agent to create a PR from the current task`,"files.fixChecks":`Ask the agent to fix the failing PR checks`,"files.syncBase":`Merge the base branch into this task's worktree`,"diff.review.cursor":`Move the line cursor over the diff`,"diff.review.range":`Toggle range anchor at the cursor`,"diff.review.note":`Add a review note at the cursor`,"diff.review.send":`Send all unsent review notes to the engine`,"diff.review.drop":`Drop the review note the cursor sits inside`,"diff.review.reload":`Reload the previewed file from disk`,"inbox.nav":`Move through Inbox items`,"inbox.open":`Open the selected Inbox item`,"inbox.delete":`Ack the selected Inbox item`,"inbox.deleteAll":`Ack every ATTENTION item`,"terminal.scroll-up":`Scroll scrollback up`,"terminal.scroll-down":`Scroll scrollback down`,"terminal.reset":`Reset terminal — kill the current shell and respawn`}},hl={category:{Global:`全局`,Sidebar:`侧边栏`,Workspace:`工作区`,Navigation:`导航`,"Tasks pane":`任务面板`,Files:`文件`,Terminal:`终端`,Views:`视图`,Tasks:`任务`,Sessions:`会话`,Attention:`提醒`,Tools:`工具`,"Diff review":`差异审阅`,Inbox:`收件箱`},desc:{"palette.open":`搜索命令`,"help.open":`显示快捷键帮助`,"task.new":`新建任务`,"task.new.global":`新建任务`,"task.openEditor":`在编辑器中打开当前 Task 的目录`,"task.moveMode":`调整侧边栏行顺序(然后 j/k——tab / 任务 / 项目)`,"settings.open":`打开设置`,"app.refresh":`让 Rove 刷新到已安装的版本(更新之后)`,"settings.open.sidebar":`打开设置`,"inbox.show":`打开收件箱`,"worktrees.open.sidebar":`打开 worktrees`,"kanban.open":`打开看板(issues)`,"automations.open":`打开例行任务(定时任务)`,"workItems.open":`打开 GitHub issues(外部跟踪器)`,"app.quit":`退出(需确认)`,"focus.sidebar":`返回侧边栏(任务列表)`,"focus.previous":`聚焦上一个面板(文件 → 工作区 → 侧边栏)`,"focus.next":`聚焦下一个面板(侧边栏 → 工作区 → 文件)`,"workspace.zenToggle":`切换禅模式`,"view.redraw":`重绘屏幕`,"attention.next":`跳到下一个收件箱条目`,"sidebar.nav":`上下移动光标`,"sidebar.select":`打开选中的任务`,"sidebar.tree.open":`打开光标所在行`,"sidebar.goto":`跳到列表顶部 / 底部(gg 或 shift-G)`,"sidebar.rename":`重命名任务`,"sidebar.localMerge":`调整当前行顺序(Shift+M,然后 j/k——tab / 任务 / 项目)`,"sidebar.pin":`置顶 / 取消置顶任务(Shift+P)`,"sidebar.sort":`切换任务排序方式(默认 → 最近 → 关注 → 名称)`,"sidebar.delete":`移除会话(需确认)`,"sidebar.search.enter":`搜索任务(模糊过滤)`,"sidebar.search.nav":`在搜索结果中移动高亮`,"sidebar.search.submit":`选中搜索匹配项并退出搜索`,"sidebar.search.cancel":`取消搜索(恢复之前的选中项)`,"tasks.openWorktree":`在编辑器中打开选中 Task 的目录`,"tasks.renameBranch":`重命名选中任务的 git 分支`,"tasks.cycleEngine":`循环切换引擎厂商——重新打开后生效`,"tasks.update":`打开更新页面(有新版本时)`,"tasks.focusEngine":`聚焦当前窗口的引擎面板`,"chat.tab.new":`在此新建对话(共享当前目录的子任务)`,"chat.tab.chooseEngine":`新建对话 —— 选择引擎或 shell,可切换落点与上下文`,"chat.tab.fork":`把当前对话接到新子任务(同一目录,带上已有对话)`,"chat.fork.new":`快速派生:以当前仓库/分支/模型创建子任务`,"chat.tab.close":`关闭聊天标签页`,"chat.tab.rename":`重命名当前聊天标签页`,"chat.tab.cycle-next":`下一个聊天标签页`,"chat.tab.cycle-prev":`上一个聊天标签页`,"chat.tab.goto":`跳到第 N 个聊天标签页`,"workspace.split.right":`向右分屏`,"workspace.split.down":`向下分屏`,"workspace.split.focus-next":`聚焦下一个分屏`,"workspace.split.close":`关闭当前分屏(未分屏时关闭标签页)`,"workspace.split.rename":`重命名当前分屏(未分屏时重命名标签页)`,"workspace.reopenSession":`在标签页全部关闭的任务中重新打开会话`,"files.nav":`上下移动光标`,"files.hierarchy":`折叠 / 展开树层级`,"files.open":`在已配置的编辑器中打开文件(支持时显示 diff)`,"files.tab":`切换标签页(循环 全部 / 变更)`,"files.refresh":`刷新`,"files.scope":`切换变更范围(工作区 ↔ 分支对比 base)`,"files.diff":`在工作区标签页中打开只读 diff`,"files.diffAll":`把整个 worktree 的 diff 打开在一个工作区标签页里`,"files.openExternal":`在系统默认应用中打开文件(音频 / 视频 / pdf 预览)`,"files.mention":`将 @<path> 提及注入引擎面板`,"files.createPR":`让 agent 从当前任务创建 PR`,"files.fixChecks":`让 agent 修复失败的 PR 检查`,"files.syncBase":`把基础分支合并进该任务的工作树`,"diff.review.cursor":`在 diff 中移动行光标`,"diff.review.range":`在光标处切换范围锚点`,"diff.review.note":`在光标处添加审阅备注`,"diff.review.send":`将所有未发送的审阅备注发给引擎`,"diff.review.drop":`删除光标所在的评审备注`,"diff.review.reload":`从磁盘重新加载当前预览的文件`,"inbox.nav":`在收件箱条目之间移动`,"inbox.open":`打开选中的收件箱条目`,"inbox.delete":`将选中的收件箱条目标为已阅`,"inbox.deleteAll":`将所有待处理条目标为已阅`,"terminal.scroll-up":`向上滚动回滚`,"terminal.scroll-down":`向下滚动回滚`,"terminal.reset":`重置终端——关闭当前 shell 并重新启动`}};function gl(e,t){let n=e;for(let e of t.split(`.`)){if(!n||typeof n!=`object`||!(e in n))return;n=Reflect.get(n,e)}return typeof n==`string`?n:void 0}function _l(e,t){return At.get()===`zh`?t:e}function vl(e,t){return t?e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??e)):e}var yl=(e,t)=>vl(gl(_l(ul,dl),e)??gl(ul,e)??e,t),bl=(e,t)=>vl(gl(_l(fl,pl),e)??gl(fl,e)??e,t),xl=(e,t)=>vl(gl(_l(Ki,qi),e)??gl(Ki,e)??e,t);function Sl(e){return _l(ml,hl).desc[e]??ml.desc[e]??e}function Cl(e){let t=Sl(e),n=t.search(/\s—\s|——/);return n>0?t.slice(0,n):t}function wl(e){return _l(ml,hl).category[e]??e}var Tl=(e,t)=>vl(gl(_l(Xi,Zi),e)??gl(Xi,e)??e,t),El=(e,t)=>vl(gl(_l(Wi,Gi),e)??gl(Wi,e)??e,t),Dl=e=>e.split(` + `).map(e=>la(e)).join(` + `);function Ol(e){let t=wl(sl(e.scope));return e.kind===`here`?yl(`here`,{surface:t}):e.kind===`direct`?yl(`direct`):e.kind===`prefix`?yl(`afterPrefix`):yl(`otherPane`,{surface:t})}function kl(e){let t=document.activeElement instanceof HTMLElement?document.activeElement:null;C.set((0,H.jsx)(Al,{model:e,surface:Oo(),origin:t}))}function Al({model:e,surface:t,origin:n}){V();let r=y(da),[i,a]=(0,h.useState)(!1),[o,s]=(0,h.useState)(``),c=(0,h.useRef)(null),l=(0,h.useMemo)(()=>ko(e,t),[e,t]),u=(0,h.useMemo)(()=>al(Ao(),t===`terminal`?`terminal`:t,ga(),l),[l,t,r]).map(e=>({...e,rows:e.rows.filter(e=>ll(o,Sl(e.binding.id),e.primary))})).filter(e=>e.rows.length>0);return(0,h.useEffect)(()=>()=>n?.focus(),[n]),(0,h.useEffect)(()=>{let e=c.current,t=t=>{if(!e||t.ctrlKey||t.metaKey||t.altKey)return;let n=e.clientHeight;if(t.key===`ArrowUp`)e.scrollBy({top:-24});else if(t.key===`ArrowDown`)e.scrollBy({top:24});else if(t.key===`PageUp`)e.scrollBy({top:-n});else if(t.key===`PageDown`)e.scrollBy({top:n});else if(t.key===`Home`)e.scrollTo({top:0});else if(t.key===`End`)e.scrollTo({top:e.scrollHeight});else if(!i&&t.key===`?`)z();else if(!i&&t.key===`/`)a(!0);else return;t.preventDefault()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[i]),(0,H.jsx)(Si,{title:yl(`title`),wide:!0,children:(0,H.jsxs)(`div`,{className:`${Gr} help`,children:[(0,H.jsxs)(`div`,{className:hn,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`text-muted`,children:t?yl(`focused`,{surface:wl(sl(t))}):yl(`allBindings`)}),(0,H.jsx)(`p`,{className:`text-muted`,children:yl(`grammar`,{prefix:_a()})})]}),(0,H.jsxs)(`div`,{className:gn,children:[(0,H.jsx)(`span`,{className:`subtle`,children:yl(`scrollKeys`)}),(0,H.jsx)(`button`,{type:`button`,className:Ar,onClick:z,children:yl(`esc`)})]})]}),i?(0,H.jsx)(`input`,{className:Mr,autoFocus:!0,spellCheck:!1,value:o,placeholder:yl(`search`),onChange:e=>{s(e.target.value),c.current?.scrollTo({top:0})}}):(0,H.jsx)(`p`,{className:`text-muted`,children:yl(`filter`)}),u.length===0&&(0,H.jsx)(`p`,{className:`text-muted`,children:yl(`noResults`)}),(0,H.jsx)(`div`,{className:_n,ref:c,children:u.map((e,t)=>(0,H.jsxs)(`section`,{className:vn,children:[(0,H.jsx)(`h2`,{className:yn,children:Ol(e)}),e.rows.map(t=>(0,H.jsxs)(`div`,{className:bn,children:[(0,H.jsx)(`span`,{className:`mono ${xn}`,children:Dl(t.primary)}),(0,H.jsx)(`span`,{className:`flex-1`,children:Sl(t.binding.id)}),t.aliases.length>0&&(0,H.jsx)(`span`,{className:`text-muted`,children:`(${t.aliases.map(Dl).join(`, `)})`})]},`${e.kind}-${t.binding.id}`))]},`${e.kind}-${e.scope??t}`))})]})})}function jl(e){switch(e){case`permission_needed`:return{glyph:`?`,tone:`warning`,stateKey:`inbox.state.needsInput`};case`turn_complete`:return{glyph:`✓`,tone:`success`,stateKey:`inbox.state.done`};case`rate_limited`:return{glyph:`◷`,tone:`warning`,stateKey:`inbox.state.rateLimited`};case`dead`:return{glyph:`†`,tone:`attention`,stateKey:`inbox.state.dead`};case`decision_needed`:return{glyph:`?`,tone:`warning`,stateKey:`inbox.state.decision`};case`routine_failed`:return{glyph:`↻`,tone:`attention`,stateKey:`inbox.state.routineFailed`};case`report_missing`:return{glyph:`!`,tone:`warning`,stateKey:`inbox.state.reportMissing`};default:return{glyph:`!`,tone:`attention`,stateKey:`inbox.state.error`}}}function Ml(e){let t=Math.max(0,Math.round(e/1e3));if(t<60)return`${t}s`;let n=Math.round(t/60);if(n<60)return`${n}m`;let r=Math.round(n/60);return r<48?`${r}h`:`${Math.round(r/24)}d`}var Nl=e=>e===`routine_failed`,Pl=e=>`${e.taskId??``}:${e.tabId??``}`;function Fl(e,t){let n=new Map(t.map((e,t)=>[e,t])),r=e=>+(e.state===`turn_complete`),i=e=>n.get(e.taskId??``)??2**53-1;return[...e].sort((e,t)=>r(e)-r(t)||e.at-t.at||i(e)-i(t)||Pl(e).localeCompare(Pl(t)))}function Il(e,t,n){let r=new Set(t),i=Fl(e,t).filter(e=>e.taskId===null||r.has(e.taskId));if(i.length===0)return null;let a=n.taskId===null?-1:i.findIndex(e=>Pl(e)===Pl(n));return a<0||i.length===1?i[0]??null:i[(a+1)%i.length]??null}function Ll(e){let t=(e.terminal?.tail??[]).map(e=>e.trimEnd()),n=t.length;for(;n>0&&t[n-1]===``;)n--;let r=0;for(;r<n&&t[r]===``;)r++;return t.slice(Math.max(r,n-12),n)}async function Y(e,t,n=!1){let r=`attention.dismiss`,i;if(Nl(t.state)){if(!t.automationId)return;r=`attention.dismissRoutine`,i={automationId:t.automationId}}else{if(t.gateId||t.state===`decision_needed`||t.state===`report_missing`&&!n||t.taskId===null)return;i={taskId:t.taskId,...t.tabId?{tabId:t.tabId}:{},...t.deliveryId?{deliveryId:t.deliveryId}:{}}}await e.client.request(r,i).catch(e=>L(String(e),`error`))}function Rl(e,t){Y(e,t),z(),k.set(t.automationId??null),O.set(`routines`)}var zl=524288e3,Bl=1048576;function Vl(e,t){return/\.pdf$/i.test(e)?`pdf[${t}]`:/\.(png|jpe?g|gif|webp)$/i.test(e)?`images[${t}]`:`files[${t}]`}function Hl(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 Ul(e,t){let n=e.replace(/\s+$/,``),r=Hl(e);for(let e of t){let t=`${Vl(e,r)}: ${e}`;n=n.length>0?`${n}\n${t}`:t,r+=1}return n}function Wl(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 Gl(e,t){if(t.size>524288e3)throw Error(B(`pages.attachTooLarge`,{name:t.name}));let n={mime:t.type,name:t.name},r=async(e,n)=>Wl(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+Bl,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 Kl(e,t){return(await Gl(e,t)).path}function ql(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 Jl=`size-14 rounded-sm border-hairline border-line object-cover`;function Yl({name:e,thumb:t}){if(t)return(0,H.jsx)(`img`,{src:t,alt:``,draggable:!1,className:Jl});let n=e.includes(`.`)?e.split(`.`).pop()??``:``;return(0,H.jsx)(`span`,{className:`${Jl} flex items-center justify-center font-mono text-meta uppercase text-muted`,children:n.slice(0,4)||`file`})}function Xl({item:e,onRemove:t}){let[n]=(0,h.useState)(e.pending);return(0,H.jsxs)(`li`,{className:`group relative size-14 shrink-0 ${n?`motion-safe:animate-rise-in`:``}`,title:`${e.name} · ${ql(e.size)}`,children:[(0,H.jsx)(`div`,{className:`transition-opacity duration-150 motion-reduce:transition-none ${e.pending?`opacity-50`:``}`,children:(0,H.jsx)(Yl,{...e})}),(0,H.jsx)(`button`,{type:`button`,"aria-label":B(`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 Zl({items:e,onRemove:t}){return e.length===0?null:(0,H.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,H.jsx)(Xl,{item:e,onRemove:t},e.id))})}function Ql(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 $l(e){return(0,H.jsxs)(`label`,{className:e.className,title:e.title,children:[e.children,(0,H.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 eu={image:`images`,pdf:`pdf`};function tu(e,t){let n=t.filter(e=>e.path!==void 0);return n.length===0?e:`${e}\n\n${n.map((e,t)=>`${eu[e.kind??`image`]??`files`}[${t}]: ${e.path}`).join(`
37
37
  `)}`}var nu=112;async function ru(e){if(e.type.startsWith(`image/`))try{let t=await createImageBitmap(e),n=Math.min(1,nu/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 iu(e){if(!e)return[];try{let t=JSON.parse(sessionStorage.getItem(e)??`[]`);return Array.isArray(t)?t:[]}catch{return[]}}var au=0;function ou(e,t,n){let[r,i]=(0,h.useState)(()=>iu(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()}-${au++}`,i=await ru(n);s(e=>[...e,{id:r,name:n.name,size:n.size,mime:n.type,...i?{thumb:i}:{}}]);try{let t=await Gl(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 su(e){return(0,H.jsx)(Zl,{items:e.attachments.map(e=>({...e,pending:e.path===void 0})),onRemove:e.onRemove})}function cu(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,H.jsx)(`div`,{ref:t,className:Lr,"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,H.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:Rr(t.id===e.value,t.dim),title:t.title,onClick:()=>e.onChange(t.id),children:t.label},t.id))})}function lu(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(hover: none) and (pointer: coarse)`).matches}var uu=/^(?:enter|return|tab|esc|space|shift|ctrl\+\S+|cmd\+\S+|alt\+\S+|[↑↓←→]+(?:\/[↑↓←→]+)?|[b-hj-z](?:\/[b-hj-z])?)(?:\/\S+)?(?:\s|$)/i;function du(e){return e.split(`·`).map(e=>e.trim()).filter(e=>e&&!uu.test(e)).join(` · `)}function fu(e){return lu()?du(e):e}function pu(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 mu(e){let t=gu(e);return t<0||t===e.length-1?{base:e,dir:``}:{base:e.slice(t+1),dir:e.slice(0,t+1)}}function hu(e){return/^(?:[A-Za-z]:(?:[\\/]|$)|\\\\)/.test(e)}function gu(e){return hu(e)||/^~\\/.test(e)?Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`)):e.lastIndexOf(`/`)}function _u(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>e.toLowerCase().includes(n)):e}function vu(e){return e.startsWith(`~`)||e.includes(`/`)||hu(e)}function yu(e,t){return t?e===`~`?t:e.startsWith(`~/`)||e.startsWith(`~\\`)?t+e.slice(1):e:e}function bu(e){let t=hu(e),n=t&&/^[A-Za-z]:/.test(e)?3:1,r=e.length;for(;r>n&&(e[r-1]===`/`||t&&e[r-1]===`\\`);)r--;return e.slice(0,r)}var xu=/^(?:(?:https?|ssh|git):\/\/[A-Za-z0-9[]\S*|[A-Za-z0-9._-]+@[A-Za-z0-9][A-Za-z0-9.-]*:\S+)$/i,Su=/^[A-Za-z0-9][A-Za-z0-9-]{0,38}\/(?![.]+(?:git)?$)[A-Za-z0-9._-]{1,100}$/i;function Cu(e){let t=e.trim();return xu.test(t)||Su.test(t)?t:null}var wu=/^(?:https?:\/\/(?:www\.)?github\.com\/|(?:ssh:\/\/)?git@github\.com[:/])/i;function Tu(e){let t=e.trim(),n=t.replace(wu,``);if(n===t)return Su.test(t)?t.replace(/\.git$/i,``).toLowerCase():null;let[r,i]=n.split(/[/?#]/),a=i?.replace(/\.git$/i,``);return r&&a?`${r}/${a}`.toLowerCase():null}function Eu(e,t){return e.filter(e=>e.enabled!==!1||e.id===t)}function Du(e,t){return(e.find(e=>e.id===t)??e.find(e=>e.ready!==!1)??e[0])?.id??``}function Ou(e,t){return!e||e.acceptsModel===!1?[]:[{id:``,label:t},...(e.models??[]).map(e=>({id:e.id,label:e.label??e.id}))]}function ku(e,t,n){return t?e.find(e=>e.id===t)?.label??t:n}function Au(e,t){return e.includes(t)?e.length>1?e.filter(e=>e!==t):e:[...e,t]}function ju(e){let[t,n,...r]=e;return!t||!n?t??``:r.length>0?`${t} + ${n} +${r.length}`:`${t} + ${n}`}function Mu(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 Nu(e){let[t,...n]=e;if(!t)return``;let r=mu(t).base;return n.length>0?`${r} +${n.length}`:r}function Pu(e,t){return e.includes(t)?e.filter(e=>e!==t):e.length>=8?e:[...e,t]}function Fu(e,t){if(!/^[1-9]$/.test(e))return null;let n=Number(e)-1;return n<t?n:null}function Iu(e){let[t,...n]=e.repos;if(!t)throw Error(`no repo`);let r=e.at?pu(e.prompt):``,i=(e.engines?.length??0)>1;return{repo:t.repo,...t.baseRef?{baseBranch:t.baseRef}:{},...n.length>0?{extraRepos:n.map(e=>({repo:e.repo,...e.baseRef?{baseRef:e.baseRef}:{}}))}:{},...!i&&n.length>0&&e.branch?{branch:e.branch}:{},...e.at?{scheduleAt:e.at.toISOString(),schedulePrompt:e.prompt}:e.prompt?{prompt:e.prompt}:{},...r?{title:r}:{},...i?{agents:(e.engines??[]).map(e=>`${e}:1`).join(`,`)}:{},...!i&&e.engine?{engine:e.engine}:{},...!i&&e.engine&&e.commandFrom?{commandFrom:e.commandFrom}:{},...!i&&e.model?{model:e.model}:{}}}async function Lu(e,t,n,r=``){let i=t?{engine:t}:{},{taskId:a}=await e(`task.openScratch`,{...i,...r?{model:r}:{}});return await e(`tab.new`,{taskId:a,kind:`engine`,...i,prompt:n.trim()}),a}async function Ru(e,t,n,r,i=r.trim(),a,o=``){let s=n?{engine:n}:{},c=r.trim()?pu(r):``,{taskId:l}=await e(`task.openCheckout`,{repo:t,...s,...c?{title:c}:{},...o?{model:o}:{},...a?{scheduleAt:a.toISOString(),schedulePrompt:i}:{}});if(!(a||!l))return await e(`tab.new`,{taskId:l,kind:`engine`,...s,prompt:i}),l}function zu(e,t){let n=e.querySelector(`[data-field="${t}"]`);(n?.matches(`input, textarea`)?n:n?.querySelector(`[tabindex='0']`))?.focus()}function Bu(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&&zu(e,a)}var Vu=new WeakMap,Hu=200,Uu=e=>`client`in e?e.client:e,Wu=(e,t)=>t?`${e} ${JSON.stringify(t)}`:e;function X(e,t,n){return Vu.get(Uu(e))?.get(Wu(t,n))}function Gu(e,t,n,r){let i=Uu(e),a=Vu.get(i)??new Map,o=Wu(t,n);a.delete(o),a.set(o,r),Vu.set(i,a);for(let e of a.keys()){if(a.size<=Hu)break;a.delete(e)}return r}function Ku(e,t,n){return Uu(e).request(t,n).then(r=>Gu(e,t,n,r))}function qu(e,t,n){return n&&n!==`leaf-1`?`${e}::${t}::${n}`:`${e}::${t}`}var Ju=`rove.web.engines`;function Yu(){try{let e=JSON.parse(localStorage.getItem(Ju)??`null`);return Array.isArray(e)?{engines:e}:void 0}catch{return}}function Xu(e){try{localStorage.setItem(Ju,JSON.stringify(e))}catch{}}function Zu(e,t,n){let r=t?{repo:t}:{},[i]=(0,h.useState)(()=>{let t=X(e,`engines.list`,r)??X(e,`engines.list`)??Yu(),i=t?Eu(t.engines):[];return{offered:i,engine:t?Du(i,n??t.preferred):``}}),[a,o]=(0,h.useState)(i.offered),[s,c]=(0,h.useState)(i.engine);return(0,h.useEffect)(()=>e.client.onOpen(()=>{Ku(e,`engines.list`,r).then(e=>{Xu(e.engines);let t=Eu(e.engines);o(t),c(Du(t,n??e.preferred))}).catch(()=>{})}),[e]),{engines:a,engine:s,setEngine:c}}var Qu=`shell`,$u=`pane:`,ed=e=>e.startsWith($u),td=e=>e.slice(5);function nd(e){let[t,n]=(0,h.useState)(()=>X(e,`plugin.panes`)?.panes??[]);return(0,h.useEffect)(()=>{Ku(e,`plugin.panes`).then(e=>n(e.panes)).catch(()=>n([]))},[e]),t}function rd(e){let t=[...e.engines,...e.withShell?[{id:Qu,name:B(`tab.shell`)}]:[],...(e.panes??[]).map(e=>({id:$u+e.id,name:e.title}))];return(0,H.jsx)(cu,{label:B(`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?B(`newTask.notReady`):void 0}))})}function id(e,t){return ad(e,t,{kind:`engine`,latest:!0}).catch(e=>L(String(e),`error`))}async function ad(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 Po(qu(t,r))?.reattach(),e.select(t,r)}async function od(e){await ad(e,(await e.client.request(`task.openScratch`,{})).taskId,{kind:`shell`})}var sd=[`1`,`2`,`3`,`4`,`5`],cd=[`tab`,`fork`,`scratch`],ld=[`message`,`attempts`,`engine`,`fork-base`,`destination`];function ud(e){V();let{model:t,taskId:n}=e,r=t.tasks.get()?.tasks.find(e=>e.id===n),i=Zu(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}=Ci(),{attachments:b,attach:x,remove:S,ready:C}=ou(t,v),w=s===`fresh`&&a!==`fork`,T=a===`tab`&&s===`fresh`,E=nd(t),D=i.engine===`shell`&&!w||ed(i.engine)&&!T?``:i.engine,O=D===Qu,k=ed(D),A=a===`fork`,j=(e,t)=>{let n=e===`scratch`&&t===`continue`&&a===`scratch`?`tab`:e;o(n),c(n===`scratch`?`fresh`:t)},M=()=>{let r=t.selection.get();return e.sourceTabId??(r.taskId===n?r.tabId:null)??`tab-1`},N=()=>t.tasks.get()?.tasks.find(e=>e.id===n)?.tabStatus?.[M()]?.reason===`dead`,P=async()=>{let e=await t.client.request(`tab.handoff`,{taskId:n,tabId:M()});if(e.kind===`handoff`&&e.prompt)return e.prompt;throw Error(e.kind===`no-transcript`?q(`terminal`,`tab.noTranscriptToHandOff`,{engine:e.engine??``}):q(`terminal`,`tab.nothingToFork`))},ee=()=>y(async()=>{let e=s===`continue`&&a===`tab`&&!O&&!k&&N(),i=[s===`continue`&&!e?await P():``,tu(l.trim(),await C())].filter(Boolean).join(`
38
38
 
39
- `);if(a===`scratch`){let e=await t.client.request(`task.openScratch`,O?{}:{engine:D});O?await ad(t,e.taskId,{kind:`shell`}):t.selectWhenListed(e.taskId)}else if(A){if(!r)throw Error(q(`terminal`,`tab.tabGone`));if(!l.trim())throw Error(B(`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=Mu(e);if(!t)throw e;L(e instanceof Error?e.message:String(e),`error`),ge(t);return}a.forkRefused&&L(B(`taskops.forkLeftBehind`,{reason:a.forkRefused}));let o=a.taskIds[0];a.groupId?ge(a.groupId):o&&t.selectWhenListed(o)}else if(O)await ad(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:td(D),...r?{tabId:r}:{}});await t.refreshTabsNow(n),t.select(n,i.tabId)}else await ad(t,n,{kind:`engine`,engine:D,prompt:i,...e?{replaceTab:M()}:{}})});return(0,H.jsx)(Si,{title:q(`terminal`,`tab.newChat.title`),wide:!0,children:(0,H.jsxs)(`form`,{className:Gr,onKeyDown:e=>{if(e.key===`Tab`&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&(A||!e.shiftKey))e.preventDefault(),e.stopPropagation(),A?Bu(e.currentTarget,ld,e.shiftKey?-1:1):j(cd[(cd.indexOf(a)+1)%cd.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(),j(a,s===`fresh`?`continue`:`fresh`)):e.key===`Enter`&&A&&e.target.closest(`[data-field=attempts], [data-field=engine]`)&&(e.preventDefault(),e.currentTarget.requestSubmit())},onSubmit:e=>{e.preventDefault(),ee()},onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault(),x(Array.from(e.dataTransfer.files))},children:[(0,H.jsxs)(`div`,{className:Fr,children:[(0,H.jsx)(`span`,{className:`${W} text-muted`,children:q(`terminal`,`tab.newChat.engine`)}),(0,H.jsx)(rd,{engines:i.engines,value:D,onChange:i.setEngine,withShell:w,panes:T?E:[]})]}),(0,H.jsxs)(`div`,{className:Fr,children:[(0,H.jsx)(`span`,{className:`${W} text-muted`,children:q(`terminal`,`tab.newChat.destLabel`)}),(0,H.jsx)(cu,{label:q(`terminal`,`tab.newChat.destLabel`),field:`destination`,value:a,onChange:e=>j(e,s),choices:cd.map(e=>({id:e,label:q(`terminal`,`tab.newChat.dest${e===`tab`?`Tab`:e===`fork`?`Fork`:`Scratch`}`)}))})]}),(0,H.jsxs)(`div`,{className:Fr,children:[(0,H.jsxs)(`span`,{className:`${W} text-muted`,children:[q(`terminal`,`tab.newChat.ctxLabel`),` `,(0,H.jsx)(`span`,{className:`keys-only`,children:`ctrl+f`})]}),(0,H.jsx)(cu,{label:q(`terminal`,`tab.newChat.ctxLabel`),field:`context`,value:s,onChange:e=>j(a,e===`continue`?`continue`:`fresh`),choices:[`fresh`,`continue`].map(e=>({id:e,label:q(`terminal`,`tab.newChat.ctx${e===`fresh`?`Fresh`:`Continue`}`)}))})]}),A&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:q(`quickTask`,`attemptsLabel`)}),(0,H.jsx)(cu,{label:q(`quickTask`,`attemptsLabel`),field:`attempts`,value:d,onChange:f,choices:sd.map(e=>({id:e,label:e}))})]}),(0,H.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:B(`taskops.forkBranch`)}),(0,H.jsx)(`input`,{className:Mr,"data-field":`fork-base`,spellCheck:!1,value:p,onChange:e=>m(e.target.value)})]})]}),!O&&!k&&a!==`scratch`&&(0,H.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:B(`newChat.prompt`)}),(0,H.jsx)(`textarea`,{className:`${Mr} min-h-18 max-h-[50vh] leading-[1.45]`,"data-field":`message`,autoFocus:!0,rows:4,placeholder:B(`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,H.jsx)(su,{attachments:b,onRemove:S}),lu()?(0,H.jsx)(`p`,{className:`text-muted`,children:B(`pages.attachHintTouch`)}):(0,H.jsx)(`p`,{className:`keys-only mx-0 mt-2 mb-0 ${Tr}`,children:q(`quickTask`,`legend`)}),_&&(0,H.jsx)(`p`,{className:`text-error`,children:_}),(0,H.jsx)(Di,{busy:g,submitLabel:B(`newChat.start`)})]})})}var dd=e=>e.split(`/`).filter(Boolean).pop()??e;function fd(e,t,n=``){let r=dd(e),i=t.filter(t=>(t.repo!==e||t.host!==n)&&dd(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 pd=e=>e.startsWith(`root:`)?null:e.split(`/`).slice(-2).join(`/`);function md(e,t){let n=dd(e.repo),r=t.filter(t=>t!==e&&dd(t.repo)===n);if(r.length===0)return n;let i=e.repoId,a=i?pd(i):null;return i&&a?r.some(e=>e.repoId&&e.repoId!==i&&pd(e.repoId)===a)?i:a:fd(e.repo,[e,...r].map(e=>({repo:e.repo,host:``})))}var hd=/\s+#\d+\/\d+$/,gd=(e,t)=>(e.createdAt??``).localeCompare(t.createdAt??``)||e.id.localeCompare(t.id),_d=e=>e.groupId&&e.kind!==`main`?`${e.machine?.id??``}\0${e.groupId}`:null;function vd(e){let t=new Map;for(let n of e){let e=_d(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(gd);return t}function yd(e){return(e[0]?.label??``).replace(hd,``)}function bd(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 Z=[`default`,`recent`,`attention`,`name`],xd={folded:new Set,opened:new Set},Sd=e=>{let t=Date.parse(e??``);return Number.isFinite(t)?t:0},Cd=e=>Sd(e.updatedAt??e.createdAt),wd=e=>Sd(e.createdAt),Td=(e,t)=>wd(t)-wd(e)||t.id.localeCompare(e.id),Ed=(e,t)=>Cd(t)-Cd(e)||t.id.localeCompare(e.id),Dd=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`}),Od={default:null,recent:Td,attention:(e,t)=>e.rank-t.rank||Ed(e,t),name:(e,t)=>Dd.compare(e.label.trim(),t.label.trim())||e.id.localeCompare(t.id)},kd=`~scratch`,Ad=e=>e.kind===`dir`&&(e.scratch===!0||e.noProject===!0);function jd(e,t){return[...e].sort((e,t)=>(e.order??e.rank)-(t.order??t.rank)).sort(Pd(Od[t]))}function Md(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=Ad(e)?kd:e.repo,n=r.get(t);n?n.push(e):r.set(t,[e])}let i=Od[t],a=[...r].map(([e,t])=>{let n=t.sort(Pd(i));if(e===`~scratch`&&t.every(Ad))return{repo:``,label:B(`rail.noProject`),tasks:n,key:kd,noProject:!0};let r=t.find(e=>e.repoId)?.repoId;return{repo:e,label:dd(e),tasks:n,...r?{repoId:r}:{}}});return[...a.filter(e=>e.noProject),...a.filter(e=>!e.noProject)]}var Nd=e=>e.kind===`main`?0:e.pinned?1:2,Pd=e=>(t,n)=>Nd(t)-Nd(n)||(e?e(t,n):0);function Fd(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 Id(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)||Fd(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 Ld(e,t,n=[]){for(let r of e.get(t)??[])n.push(r.id),Ld(e,r.id,n);return n}function Rd(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 zd(e,t=``,n=xd,r=0,i=!0){let a=t.trim(),o=(...e)=>e.some(e=>e!==``&&$c(a,e)),{children:s,nested:c}=Id(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,dd(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?Ld(s,t.id):[],m=u!==void 0&&a===``&&Rd(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?vd(t):new Map,o=new Set;for(let i of t){let t=_d(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:yd(s),tasks:s,depth:Math.min(l,3),...c.machine?{machine:c.machine.id}:{}});let u=bd(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 Bd=e=>Math.max(0,...e.tasks.map(wd));function Vd(e){let t=e.tasks.filter(e=>!e.routine),n=e.remote.filter(e=>!e.routine),r=[...Md(t,e.sort).map(e=>({group:e})),...e.machines.flatMap(t=>Md(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?kd:t??(e.machine===void 0?n:`${e.machine}\0${n}`),a=i.get(r);a?a.push(e):i.set(r,[e])}let a=Od[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(Pd(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:md(e,s)])),l=s.map(e=>({...e,label:c.get(e)??e.label}));return e.sort===`recent`&&l.sort((e,t)=>Bd(t)-Bd(e)),e.sort===`name`&&l.sort((e,t)=>Dd.compare(e.label,t.label)),l.sort((e,t)=>Number(t.noProject===!0)-Number(e.noProject===!0)),{rows:zd(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 Hd(e){return e.title??e.engineName??(e.kind===`engine`?B(`tab.engine`):B(`tab.shell`))}function Ud(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 Wd(e){return e.kind===`leaf`?[e]:e.children.flatMap(Wd)}function Gd(e){return!!e&&Wd(e.root).length>1}function Kd(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 qd(e,t,n=1){let r=Wd(e.root).map(e=>e.id),i=r.indexOf(t);return r[(Math.max(0,i)+n+r.length)%r.length]??t}function Jd(e,t){let n=new Map,r=new Map;for(let i of Wd(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 Yd(e,t,n){return e.kind===`engine`&&Wd(t.root).some(e=>e.id===n&&e.own)}function Xd(e){return e.alive!==!1||!!e.split&&!Wd(e.split.root).some(e=>e.own)}function Zd(e){return Wd(e.root).map(e=>e.id).join(`,`)}function Qd(e){return!(e instanceof HTMLElement)||e.closest(`.xterm`)?!1:e.isContentEditable||[`INPUT`,`TEXTAREA`,`SELECT`].includes(e.tagName)}function $d(e){return e instanceof HTMLElement&&!!e.closest(`.rail, button, a`)}var ef=e=>e.tabs.get()[e.selection.get().taskId??``]??[];function tf(e){let{taskId:t,tabId:n}=e.selection.get(),r=ef(e);return{taskId:t,tabs:r,at:r.findIndex(e=>e.id===n)}}function nf(e,t){let{taskId:n,tabs:r}=tf(e),i=r[t];!n||!i||e.select(n,i.id)}function rf(e){let{taskId:t,tabs:n,at:r}=tf(e),i=n[r];!t||!i||C.set((0,H.jsx)(wi,{title:B(`menu.renameTab`),initial:Hd(i),submitLabel:B(`dialog.save`),onSubmit:async n=>{await e.renameTab(t,i.id,n)}}))}var af=e=>!!e.selection.get().taskId,of=e=>ef(e).length>0,sf=[{id:`help.open`,chords:[`f1`],prefix:!1,run:kl},{id:`focus.next`,chords:[`f4`],prefix:!1,run:()=>xo(1)},{id:`chat.tab.chooseEngine`,chords:[`ctrl+e`],prefix:!1,surface:`workspace`,live:af,run:e=>{let{taskId:t}=e.selection.get();t&&C.set((0,H.jsx)(ud,{model:e,taskId:t}))}},{id:`chat.tab.rename`,chords:[`f2`],prefix:!1,surface:`workspace`,live:e=>{let{tabs:t,at:n}=tf(e);return!!t[n]&&!Gd(t[n]?.split)},run:rf},{id:`chat.tab.cycle-next`,chords:[`ctrl+]`],prefix:!1,surface:`workspace`,live:of,run:e=>nf(e,(tf(e).at+1)%ef(e).length)},{id:`chat.tab.cycle-prev`,chords:[`ctrl+[`],prefix:!1,surface:`workspace`,live:of,run:e=>nf(e,(tf(e).at-1+ef(e).length)%ef(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:of,run:(e,t=``)=>{let n=To().find(e=>e.id===`chat.tab.goto`&&!e.prefix)?.chords.indexOf(t)??-1;n>=0&&nf(e,n)}},{id:`attention.next`,chords:[`f7`],prefix:!1,run:e=>lf(e)}];Co(()=>sf);function cf(e){(0,h.useEffect)(()=>{let t=t=>{if(C.get()||Qd(t.target))return;let n=O.get();if(n===`worktrees`)return;let r=Oo()??(af(e)?`workspace`:`sidebar`),{taskId:i}=e.selection.get();if(!n&&i&&!t.ctrlKey&&!t.shiftKey&&!t.metaKey&&!t.altKey&&t.key===`Enter`&&!of(e)&&!$d(t.target)){t.preventDefault(),t.stopPropagation(),C.set((0,H.jsx)(ud,{model:e,taskId:i}));return}let a=qc(t),o=To().filter(t=>!t.prefix&&!t.native&&t.chords.some(e=>a.includes(e))&&Eo(t,r)&&!(n&&t.surface)&&t.live?.(e)!==!1).sort((e,t)=>Do(e,r)-Do(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 lf(e){let t=e.tasks.get();if(!t)return;let n=Il(t.attention,t.tasks.map(e=>e.id),e.selection.get());if(!n){L(B(`inbox.empty`));return}if(Nl(n.state)){Rl(e,n);return}n.taskId!==null&&(e.select(n.taskId,n.tabId),Y(e,n))}async function uf(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){L(B(`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){L(G(e),`error`)}}function df(e){(0,h.useEffect)(()=>{let t=t=>{let n=da.get().plugins;if(n.length===0||!wa({dialog:C.get()!==null,page:O.get()})||Qd(t.target))return;let r=Ca(n,qc(t));r&&(t.preventDefault(),t.stopImmediatePropagation(),uf(e,r))};return window.addEventListener(`keydown`,t,{capture:!0}),()=>window.removeEventListener(`keydown`,t,{capture:!0})},[e])}var ff=`prefix.moreCommands`,pf=/^ctrl\+[^+]+$/;function mf(e){return pf.test(e)?e.slice(5):null}function hf(e){let t=Qc(e.bindingId);if(!t)return null;if(e.reachability.direct.has(e.bindingId)){let e=t.keys[0];if(e)return la(e)}if(e.prefixKey&&e.reachability.prefix.has(e.bindingId)){let n=t.prefixKeys?.[0];if(n)return`${la(e.prefixKey)} ${la(n)}`}return null}function gf(e,t){let n=aa.filter(t=>e.direct.has(t.id)).flatMap(e=>{let t=e.keys.flatMap(e=>mf(e)??[]);return t.length>2?[{stroke:`${t[0]}-${t.at(-1)}`,action:e.id}]:t.map(t=>({stroke:t,action:e.id}))}),r=t?mf(t):null;return r&&e.prefix.size>0&&n.push({stroke:r,action:ff}),n}var _f=4e3,vf=180,yf=_f,bf=v({guide:null,entries:[]}),xf=1;function Sf(e,t){let n={id:xf++,stroke:e,action:t,at:Date.now()};bf.set({guide:null,entries:[...bf.get().entries,n].slice(-3)})}var Cf=`modulepreload`,wf=function(e){return`/`+e},Tf={},Ef=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=wf(t,n),t=s(t),t in Tf)return;Tf[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`:Cf,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)})},Df=8,Of=32,kf=3e3,Af=100,jf=new WeakMap,Mf=null;function Nf(e){let t=jf.get(e);return t||(t={entries:new Map,snapshots:new Map,left:null},jf.set(e,t)),t}function Pf(){return Mf||(Mf=document.createElement(`div`),Mf.style.display=`none`,document.body.append(Mf)),Mf}function Ff(e,t,n){e.snapshots.delete(t),e.snapshots.set(t,n);for(let t of e.snapshots.keys()){if(e.snapshots.size<=Of)break;e.snapshots.delete(t)}}function If(e,t,n){e.entries.delete(t.key),t.leaving!==null&&window.clearTimeout(t.leaving),t.leaving=null,n?Ff(e,t.key,t.handle.snapshot()):e.snapshots.delete(t.key),t.handle.dispose(),t.box.remove()}function Lf(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-Df)))If(e,n,!0)}function Rf(e,t){return Nf(e).entries.get(t)?.handle??null}function zf(e,t,n,r){return Nf(e).entries.get(qu(t,n,r))?.slot.parkedAt!=null}async function Bf(e,t){let n=Nf(e.client),r=qu(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,Wf(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:()=>Vf(n,i)}}let a=document.createElement(`div`);a.className=Pn,e.host.append(a),Hf(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 Ef(async()=>{let{mountTerminal:e}=await import(`./term-mount-QawNA0jJ.js`);return{mountTerminal:e}},__vite__mapDeps([0,1])),d=u({...e,el:a,snapshot:l,onPainted:()=>Wf(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&&If(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:()=>Vf(n,f)}}function Vf(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(),Pf().append(t.box),e.left=t,Lf(e))}function Hf(e,t){let n=e.left;e.left=null,!(!n||n.slot.parkedAt===null||performance.now()-n.slot.parkedAt>Af)&&e.entries.get(n.key)===n&&(n.box.classList.add(`is-leaving`),t.append(n.box),n.leaving=window.setTimeout(()=>Uf(e,n),kf))}function Uf(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&&Pf().append(t.box))}function Wf(e){for(let t of e.entries.values())Uf(e,t)}async function Gf(e,t,n){return Ll(await e.request(`output.read`,{taskId:t,tab:n,source:`terminal`,limit:12}))}async function Kf(e,t,n,r){try{let i=await e.client.request(`tab.send`,{taskId:t,tabId:n,prompt:r});return i.delivered?!0:(L(B(`layout.composerNotSent`,{reason:i.reason??``}),`error`),!1)}catch(e){let t=e instanceof Uo?e.code:void 0;return L(t===`UNKNOWN_OP`?B(`layout.composerOldBridge`):t===`AWAITING_PERMISSION`?B(`layout.composerAtMenu`):e instanceof Error?e.message:String(e),`error`),!1}}async function qf(e,t,n,r){let{client:i}=e,a=qu(t,n),o=Po(a)!==void 0||zf(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 L(e instanceof Error?e.message:String(e),`error`),!1}finally{o||await i.request(`term.detach`,{stream:a}).catch(()=>{})}}async function Jf(e,t,n){try{return(await e.client.request(`gate.answer`,{gateId:t,...n})).delivered||L(B(`inbox.gateKept`)),!0}catch(e){return L(e instanceof Error?e.message:String(e),`error`),!1}}var Yf=(e,t,n)=>({id:e,cap:t,bytes:e=>`\x1b${e?`O`:`[`}${n}`}),Xf={id:`enter`,cap:`⏎`,bytes:()=>`\r`},Zf=[{id:`esc`,cap:`esc`,bytes:()=>`\x1B`},{id:`tab`,cap:`tab`,bytes:()=>` `},{id:`backtab`,cap:`⇧tab`,bytes:()=>`\x1B[Z`},{id:`interrupt`,cap:`^C`,bytes:()=>``},Yf(`up`,`↑`,`A`),Yf(`down`,`↓`,`B`),Yf(`left`,`←`,`D`),Yf(`right`,`→`,`C`),Xf],Qf=e=>({id:`option-${e}`,cap:String(e),bytes:()=>String(e)}),$f=[Qf(1),Qf(2),Qf(3),Qf(4),Xf];function ep(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 tp=`\x1B[27;2;13~`;function np(e){return e.key!==`Enter`||!e.shiftKey||e.ctrlKey||e.metaKey||e.altKey?!1:!e.isComposing&&e.keyCode!==229}function rp(e){return e.type!==`keydown`||e.key.toLowerCase()!==`c`||e.altKey?null:e.metaKey||e.ctrlKey&&e.shiftKey?`copy`:e.ctrlKey?`interrupt-or-copy`:null}var ip=`mx-2.5 mt-0.5 mb-1.5 flex min-w-0 flex-col gap-1.5 font-mono text-meta`,ap=2e3;function op(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 Gf(e.client,t,n);r&&i(a)}catch{r&&i(e=>e??[])}r&&(a=window.setTimeout(o,ap))};return o(),()=>{r=!1,window.clearTimeout(a)}},[e,t,n,a]),{lines:r,refresh:()=>o(e=>e+1)}}function sp(e){V();let{model:t,taskId:n,tabId:r,mode:i,gate:a}=e,{lines:o,refresh:s}=op(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?Jf(t,a.id,{text:e}):r?Kf(t,n,r,e):Promise.resolve(!1))&&u(``)};return(0,H.jsxs)(`div`,{className:ip,children:[a&&(0,H.jsx)(`p`,{className:`m-0 whitespace-pre-wrap wrap-anywhere text-ink`,children:a.question}),r&&(0,H.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?B(`inbox.noOutput`):o.join(`
40
- `)}),i===`gate`&&a&&(0,H.jsx)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:a.options.map(e=>(0,H.jsxs)(U,{disabled:d,title:e.detail,onClick:()=>void p(()=>Jf(t,a.id,{option:e.key})),children:[`[ `,e.key===a.recommended?`★ `:``,e.label,` ]`]},e.key))}),i===`menu`&&r&&(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[$f.map(e=>(0,H.jsxs)(U,{disabled:d,onClick:()=>void p(()=>qf(t,n,r,e.bytes(!1))),children:[`[ `,e.cap,` ]`]},e.id)),(0,H.jsx)(U,{onClick:e.onOpenTab,children:B(`inbox.openTab`)})]}),(i===`reply`||i===`gate`)&&(0,H.jsxs)(`form`,{className:`flex min-w-0 items-center gap-2`,onSubmit:e=>{e.preventDefault(),m()},children:[(0,H.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:B(`inbox.replyPlaceholder`),"aria-label":B(`inbox.replyPlaceholder`),autoComplete:`off`,enterKeyHint:`send`,onChange:e=>u(e.target.value)}),(0,H.jsx)(U,{type:`submit`,disabled:d||l.trim()===``,children:B(`inbox.send`)})]})]})}function cp({text:e}){return(0,H.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,H.jsx)(`span`,{children:e},e))})}var lp={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`},up={accent:`text-accent`,muted:`text-subtle`,attention:`text-error`,warning:`text-warning`,success:`text-success`,info:`text-accent`,ink:`text-ink`},dp=6;function fp(e,t){return e?`${e.repo.split(`/`).filter(Boolean).pop()??e.repo} › ${e.label}`:t}function pp({model:e}){V();let t=y(e.tasks),n=y(e.visits),r=y(e.tabs),[i,a]=(0,h.useState)(0),[o,s]=(0,h.useState)(null),[c,l]=(0,h.useState)(Date.now());(0,h.useEffect)(()=>{let e=window.setInterval(()=>l(Date.now()),3e4);return()=>window.clearInterval(e)},[]);let u=new Map((t?.tasks??[]).map(e=>[e.id,e])),d=(e,t)=>e&&t&&r[e]?.find(e=>e.id===t)?.title||``,f=Fl(t?.attention??[],t?.tasks.map(e=>e.id)??[]).map((e,t)=>{let n=e.taskId?u.get(e.taskId):void 0;return{key:`a${t}:${e.taskId}:${e.tabId}`,section:`attention`,taskId:e.taskId,tabId:e.tabId,identity:fp(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,dp).map(e=>({key:`r:${e.taskId}:${e.tabId}`,section:`recent`,taskId:e.taskId,tabId:e.tabId,identity:fp(u.get(e.taskId),e.taskId),subtitle:d(e.taskId,e.tabId)||u.get(e.taskId)?.branch||``,at:e.at})),g=[...f,...m],_=g[Math.min(i,g.length-1)],v=t=>{if(t.attention&&Nl(t.attention.state))return Rl(e,t.attention);t.attention&&Y(e,t.attention),t.taskId&&u.has(t.taskId)&&(e.select(t.taskId,t.tabId),z())},b=()=>void Promise.all(f.map(t=>t.attention&&Y(e,t.attention,!0)));(0,h.useEffect)(()=>{let t=t=>{if(!(t.target instanceof HTMLElement&&t.target.closest(`input, textarea`))){if(t.key===`ArrowDown`||t.key===`j`)a(e=>Math.min(g.length-1,e+1));else if(t.key===`ArrowUp`||t.key===`k`)a(e=>Math.max(0,e-1));else if(t.key===`Enter`&&_)v(_);else if(t.key===`d`&&_?.attention)Y(e,_.attention,!0);else if(t.key===`D`)b();else return;t.preventDefault()}};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)});let x=n=>{let r=n.attention?jl(n.attention.state):null,i=n===_,l=n.attention,d=n.taskId?u.get(n.taskId):void 0,f=l?.gateId?t?.gates?.find(e=>e.id===l.gateId&&e.status===`open`):void 0,p=n.tabId??f?.tabId??null,m=!!l&&!!d&&!d.machine&&!Nl(l.state)&&(!l.gateId||!!f)&&(!!p||!!f),h=l?.state===`permission_needed`||!!p&&d?.tabStatus?.[p]?.kind===`needs-input`,y=f?`gate`:l?.state===`dead`?`readonly`:h?`menu`:`reply`,b=`${n.taskId}:${n.tabId}:${l?.gateId??``}`,x=m&&o===b;return(0,H.jsxs)(`li`,{children:[(0,H.jsxs)(`div`,{className:li,children:[(0,H.jsxs)(`button`,{type:`button`,className:`${hi({selected:i,stack:!0})} ${ui}`,onMouseEnter:()=>a(g.indexOf(n)),onClick:()=>v(n),children:[(0,H.jsxs)(`span`,{className:si,children:[(0,H.jsx)(`span`,{className:gi,children:n.identity}),r&&(0,H.jsxs)(`span`,{className:`flex-none font-mono text-meta font-normal normal-nums ${up[r.tone]}`,children:[r.glyph,` `,B(r.stateKey)]}),(0,H.jsx)(`span`,{className:ci,children:Ml(c-n.at)})]}),n.subtitle&&(0,H.jsx)(`span`,{className:`truncate font-mono text-meta font-normal normal-nums text-muted`,children:n.subtitle})]}),m?(0,H.jsx)(U,{className:di,"aria-expanded":x,onClick:()=>{a(g.indexOf(n)),s(x?null:b)},children:B(x?`inbox.hide`:`inbox.reply`)}):(0,H.jsx)(`span`,{"aria-hidden":!0,className:di})]}),x&&n.taskId&&(0,H.jsx)(sp,{model:e,taskId:n.taskId,tabId:p,mode:y,gate:f,onOpenTab:()=>v(n)})]},n.key)};return(0,H.jsx)(Si,{title:B(`inbox.title`),wide:!0,children:(0,H.jsxs)(`div`,{className:Gr,children:[(0,H.jsxs)(`div`,{className:ii,children:[(0,H.jsx)(`p`,{className:`${W} text-muted ${ri} touch:hidden!`,children:(0,H.jsx)(cp,{text:B(`inbox.hints`)})}),f.length>0&&(0,H.jsx)(U,{className:`flex-none min-w-[calc(9ch+0.5rem)] whitespace-nowrap pr-2 text-right font-mono text-meta`,onClick:b,children:B(`inbox.ackAll`)})]}),(0,H.jsx)(`h2`,{className:`${W} text-muted ${ai}`,children:B(`inbox.attention`)}),f.length===0?(0,H.jsx)(`p`,{className:`mono text-muted`,children:B(`inbox.empty`)}):(0,H.jsx)(`ul`,{className:oi,children:f.map(x)}),m.length>0&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`h2`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted mt-1`,children:B(`inbox.recent`)}),(0,H.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-0.5 p-0`,children:m.map(x)})]})]})})}var mp=`rove.prefs`,hp={locale:`en`,theme:`claude`,themeMode:`dark`,transparent:!0,focusAccent:`primary`,splitStyle:`line`,railFold:`glyphs`,workingBorder:`flow`,taskColors:`on`,glyphSet:`braille`,colorblind:`off`,runningTitle:`shimmer`,statusMark:`both`,statusMarkNoticeSeen:!0,railSort:`recent`,railGroup:`project`,toast:!0,sound:!0,soundVolume:.4,crossTask:!0,finishedAlerts:!0,keyHints:!0,zen:!0,editorKind:`auto`,worktreeBase:`default`,scrollbackRows:1e3,tabStrip:`never`,prefixTap:`local`,remoteProjects:!1,autoStatus:!1,dispatcher:!1,updateChannel:`latest`,updateNotify:!0};function gp(){try{let e=JSON.parse(localStorage.getItem(mp)??`null`);if(e&&typeof e==`object`&&`prefs`in e&&`themes`in e){let t=e;return{...t,prefs:{...hp,...t.prefs},loaded:!0}}}catch{}return{loaded:!1,prefs:hp,options:{},info:{editorCustomSet:!1,worktreeCustomPath:``},themes:[],glyphSets:{}}}var _p=v(gp());function vp(e){(e.locale===`en`||e.locale===`zh`)&&At.set(e.locale)}vp(_p.get().prefs);function yp(e){let t={loaded:!0,prefs:e.prefs,options:e.options,info:e.info,themes:e.themes,glyphSets:e.glyphSets};_p.set(t),vp(t.prefs),localStorage.setItem(mp,JSON.stringify(t))}var bp=null;async function xp(e){bp=e,yp(await e.request(`prefs.get`))}async function Sp(e,t,n){let r=_p.get();_p.set({...r,prefs:{...r.prefs,[t]:n}}),vp(_p.get().prefs);try{let r=await e.request(`prefs.set`,{key:t,value:n});yp({..._p.get(),prefs:r.prefs})}catch(e){_p.set(r),vp(r.prefs),L(e instanceof Error?e.message:String(e),`error`)}}function Cp(e,t){if(bp)return void Sp(bp,e,t);let n=_p.get();_p.set({...n,prefs:{...n.prefs,[e]:t}})}function wp(){return y(_p)}function Tp(e,t){let n=e.options[t];return Array.isArray(n)?n:[]}var Ep=[`project`,`state`],Dp=`rove.railGroup`,Op=v(Ep.find(e=>e===localStorage.getItem(Dp))??`project`);function kp(e){e!==Op.get()&&(Op.set(e),localStorage.setItem(Dp,e))}_p.subscribe(()=>{let{loaded:e,prefs:t}=_p.get();e&&Ep.includes(t.railGroup)&&kp(t.railGroup)});function Ap(e){kp(e),Cp(`railGroup`,e)}var jp=`rove.activeSortMode`;function Mp(){let e=localStorage.getItem(jp);return Z.find(t=>t===e)??`recent`}var Np=v(Mp());function Pp(e){e!==Np.get()&&(Np.set(e),localStorage.setItem(jp,e))}_p.subscribe(()=>{let{loaded:e,prefs:t}=_p.get();e&&Z.includes(t.railSort)&&Pp(t.railSort)});function Fp(e){Pp(e),Cp(`railSort`,e)}function Ip(){Fp(Z[(Z.indexOf(Np.get())+1)%Z.length]??`default`)}var Lp=v(!1),Rp=v(null);function zp(e){e&&(Np.get()!=="default"||Op.get()===`state`)&&(Fp(`default`),Ap(`project`),L(q(`tasks`,`sort.reorderSwitched`))),e||Rp.set(null),Lp.set(e)}async function Bp(e,t,n){let r=n<0?`up`:`down`;try{await e.client.request(`task.move`,{taskId:t.task.id,direction:r})}catch(e){L(q(`tasks`,`toast.moveFailed`,{error:e instanceof Error?e.message:String(e)}),`error`)}}async function Vp(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){L(q(`tasks`,`toast.moveFailed`,{error:e instanceof Error?e.message:String(e)}),`error`)}}var Hp=`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`,Up=`flex min-h-0 flex-1 flex-col items-center justify-center gap-1.5 overflow-hidden text-center keyboard:hidden`,Wp=`relative mx-auto flex w-full max-w-[104ch] flex-none flex-col gap-2 keyboard:mt-auto`,Gp=`pointer-events-none absolute bottom-full left-0 mb-2 flex flex-col gap-1`,Kp=`flex flex-col gap-2 rounded-md border-hairline border-line bg-surface px-3 py-2.5 focus-within:border-line-active`,qp=`flex flex-wrap items-center justify-end gap-1.5`,Jp=`max-h-[40vh] min-h-[4.5em] w-full bg-transparent text-ink [border:0] [outline:0]`,Yp=`flex items-center gap-1.5 px-1`,Xp=`flex min-w-0 items-center gap-1.5`,Zp=`${Xp} group/end ml-auto narrow:ml-0`,Qp=(e=!1)=>`flex h-7 min-w-7 cursor-pointer items-center justify-center rounded-sm px-1 has-[:disabled]:opacity-60 disabled:opacity-60 [&:hover]:bg-hover [&:hover]:text-ink ${e?`text-accent`:`text-muted`}`,$p=`size-3.25 flex-none fill-none stroke-current [stroke-linecap:round] [stroke-linejoin:round] [stroke-width:1.3]`,em=`narrow:sr-only`,tm=(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`}`,nm=`disabled:cursor-default disabled:opacity-60`,rm=e=>`${tm(e)} min-w-[9ch] justify-center ${nm}`,im=`touch-none select-none [-webkit-touch-callout:none]`,am=`group/chip relative inline-flex`,om=`flex min-h-0 flex-col gap-1 overflow-x-hidden overflow-y-auto p-1.5 [outline:0]`,sm=`flex min-h-0 flex-col overflow-x-hidden overflow-y-auto`,cm=`sticky top-0 z-1 m-0 bg-surface px-1.5 pt-1.5 pb-0.5 text-left`,lm=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`:``}`,um=`flex-[0_0_1.5ch] text-accent`,dm=`ml-auto pl-3 inline-flex items-center gap-1`,fm=`min-w-0 overflow-hidden text-ellipsis whitespace-nowrap`,pm=`${fm} narrow:max-w-[13ch]`,mm=`${fm} [direction:rtl]`,hm=`flex-none whitespace-nowrap`,gm=`mx-2 my-1`,_m=`flex flex-col gap-0.5 px-1.5 py-0.5`,vm=`min-w-[36ch]`,ym=`flex items-center gap-1.5 p-1.5`;function bm(){return(0,H.jsx)(`svg`,{className:$p,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,H.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 xm(){return(0,H.jsxs)(`svg`,{className:$p,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,H.jsx)(`circle`,{cx:`4.5`,cy:`3.5`,r:`1.5`}),(0,H.jsx)(`circle`,{cx:`4.5`,cy:`12.5`,r:`1.5`}),(0,H.jsx)(`circle`,{cx:`11.5`,cy:`5`,r:`1.5`}),(0,H.jsx)(`path`,{d:`M4.5 5v6M11.5 6.5c0 3-7 2-7 4.5`})]})}function Sm(e){return e instanceof Error?e.message:String(e)}function Cm(e){return/no space left on device|ENOSPC|disk quota exceeded/i.test(Sm(e))}var wm=`-my-0.75 -mr-0.5 ml-0 flex flex-none self-stretch`,Tm=`before:absolute before:top-0 before:left-1 before:content-[''] before:[border-left:var(--hairline)_solid_var(--line-active)]`,Em={blank:``,pipe:`${Tm} before:bottom-0`,tee:`${Tm} before:bottom-0`,elbow:`${Tm} before:right-0 before:bottom-1/2 before:rounded-bl-[6px] before:[border-bottom:var(--hairline)_solid_var(--line-active)]`},Dm=e=>`relative w-3 ${Em[e]}`,Om=`-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`,km=`inline-flex items-center gap-1`,Am=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`:``}`,jm=`inline-flex flex-none items-center text-subtle`,Mm=`group/rail rail @container row-1 flex min-h-0 flex-col focus:outline-none ${Ht}`,Nm=`flex min-w-0 items-center gap-2.5 overflow-hidden px-3.5 pt-3.5 pb-2.5 whitespace-nowrap`,Pm=`flex gap-1 px-3.5 pb-2 text-meta`,Fm=`min-w-0 flex-1 border-none bg-transparent p-0 text-ink [font:inherit] outline-none placeholder:text-subtle`,Im=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`:``}`,Lm=`group-focus-within/rail:[box-shadow:inset_0_0_0_1px_var(--focus)]`,Rm=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?`cursor-grab [&>button:first-child]:cursor-grab`:``} ${e.moving?`bg-accent-soft after:font-mono after:text-meta after:font-medium after:normal-nums after:text-accent after:content-['move']`:``}`,zm=`touch:relative touch:after:absolute touch:after:-inset-x-1.5 touch:after:-inset-y-3 touch:after:content-['']`,Bm=`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 ${zm}`,Vm=e=>e?``:`opacity-0 group-hover/head:opacity-100 group-focus-visible/toggle:opacity-100 touch:opacity-100`,Hm=`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 ${zm}`,Um=`-mr-[4.5px] ${Hm}`,Wm=`ml-auto ${Hm}`,Gm=1e4;function Km(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 qm(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}${Km(t,n).slice((t.hostLabel||t.alias).length)}`}function Jm(e,t,n){if(e.kind!==`task`||e.machine===void 0)return null;let r=e.machine;return qm(r,t.find(e=>e.alias===r),n,e.task.machine?.label)}function Ym({label:e}){return(0,H.jsx)(`span`,{className:jm,title:e,role:`img`,"aria-label":e,children:(0,H.jsx)(`svg`,{viewBox:`0 0 16 16`,width:`12`,height:`12`,"aria-hidden":`true`,children:(0,H.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 Xm({host:e,onMachines:t}){return V(),(0,H.jsxs)(`div`,{className:Jn,children:[(0,H.jsx)(`p`,{className:`text-muted`,children:q(`tasks`,`machine.filesElsewhere`,{host:e})}),(0,H.jsx)(`p`,{className:`text-muted`,children:q(`tasks`,`machine.filesHint`,{host:e})}),(0,H.jsx)(`div`,{children:(0,H.jsx)(U,{hit:`tight`,onClick:t,children:B(`machines.open`)})})]})}function Zm(e){let t=y(e.client.conn),n=y(e.remote),[r,i]=(0,h.useState)(()=>X(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=()=>Ku(e,`machines.list`).then(e=>n&&i(e.machines),()=>{});r();let a=K(Gm,r);return()=>{n=!1,a()}},[e.client,t.state,a]),r}function Qm(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,H.jsxs)(`span`,{ref:i,className:am,onKeyDown:e=>{e.key!==`Escape`||!t||(e.preventDefault(),e.stopPropagation(),s())},children:[(0,H.jsx)(`button`,{ref:a,type:`button`,className:tm(),"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,H.jsx)(`div`,{ref:o,className:`absolute bottom-[calc(100%+6px)] left-0 z-20 flex max-h-[min(50vh,420px)] max-w-[min(52ch,calc(100vw-16px))] min-w-[min(34ch,calc(100vw-16px))] flex-col overflow-hidden rounded-md border-hairline border-line-active bg-surface shadow-popover group-[&]/end:group-last-of-type/chip:right-0 group-[&]/end:group-last-of-type/chip:left-auto`,children:e.children(s)})]})}function $m(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,H.jsxs)(`div`,{className:om,children:[(0,H.jsx)(`input`,{className:mn,autoFocus:!0,spellCheck:!1,placeholder:e.placeholder,value:e.query,onChange:t=>{n(0),e.onQuery(t.target.value)},onKeyDown:t=>{if(!t.nativeEvent.isComposing){if(t.key===`ArrowDown`||t.key===`ArrowUp`)t.preventDefault(),n(Math.max(0,Math.min(r.length-1,i+(t.key===`ArrowDown`?1:-1))));else if(t.key===`Enter`){t.preventDefault();let n=r[i];n&&e.onPick(n.key,t.shiftKey||t.metaKey||t.ctrlKey)}}}}),(0,H.jsxs)(`div`,{className:sm,children:[r.length===0&&(0,H.jsx)(`p`,{className:`mx-2 my-1 text-muted`,children:e.empty}),r.map((t,r)=>(0,H.jsxs)(h.Fragment,{children:[e.moreLabel&&t===e.more?.[0]&&(0,H.jsx)(`p`,{className:`mx-2 mt-2 mb-0.5 text-muted`,children:e.moreLabel}),t.ruled&&r>0&&(0,H.jsx)(`div`,{className:`mx-2 my-1 flex-none border-t-hairline border-t-line`}),(0,H.jsxs)(`button`,{type:`button`,"aria-current":t.checked===!0,ref:r===i?a:void 0,tabIndex:-1,title:t.title,className:lm({cursor:r===i}),onMouseMove:()=>n(r),onClick:n=>e.onPick(t.key,n.shiftKey||n.metaKey||n.ctrlKey),children:[(0,H.jsx)(`span`,{className:um,children:t.checked?`✓`:``}),(0,H.jsx)(`span`,{className:hm,children:t.text}),t.dim&&(0,H.jsx)(`span`,{className:`ml-auto pl-3 text-muted ${t.dimPath?mm:`min-w-0 overflow-hidden text-ellipsis whitespace-nowrap`}`,children:t.dimPath?(0,H.jsx)(`bdi`,{children:t.dim}):t.dim})]})]},t.key))]}),e.hint&&(0,H.jsx)(`p`,{className:`m-0 flex-none border-t-hairline border-t-line px-2 pt-1.5 pb-0.5 text-subtle`,children:e.hint})]})}function eh(e){return(0,H.jsxs)(`button`,{type:`button`,role:e.multi?`menuitemcheckbox`:`menuitemradio`,"aria-checked":e.checked,tabIndex:-1,disabled:e.option.disabled,className:lm({cursor:e.cursor,dim:e.option.dim}),onMouseMove:e.onHover,onClick:e.onPick,children:[(0,H.jsx)(`span`,{className:um,children:e.checked?`✓`:``}),(0,H.jsx)(`span`,{children:e.option.label}),!e.checked&&e.digit!==void 0&&!e.option.disabled&&(0,H.jsx)(`span`,{className:`ml-auto pl-3 text-muted`,children:e.digit})]})}function th(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,H.jsxs)(`div`,{ref:r,role:`menu`,tabIndex:-1,className:om,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?Fu(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,H.jsxs)(`button`,{type:`button`,className:`${cm} ${W} text-muted`,tabIndex:-1,onClick:e.onBack,children:[`‹ `,e.heading]}):(0,H.jsx)(`p`,{className:`${cm} ${W} text-muted`,children:e.heading}),e.options.map((r,i)=>(0,H.jsx)(eh,{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 nh(e){return(0,H.jsxs)(`div`,{className:`${om} ${vm}`,children:[(0,H.jsx)(`p`,{className:`${cm} ${W} text-muted`,children:B(`newSession.branches`)}),(0,H.jsxs)(`label`,{className:_m,children:[(0,H.jsx)(`span`,{className:`text-muted`,children:B(`newSession.branchName`)}),(0,H.jsx)(`input`,{className:Mr,autoFocus:!0,spellCheck:!1,placeholder:B(`newSession.branchNamePlaceholder`),value:e.branch,onChange:t=>e.onBranch(t.target.value)})]}),e.repos.map(t=>(0,H.jsxs)(`label`,{className:_m,children:[(0,H.jsxs)(`span`,{children:[t.name,t.primary&&(0,H.jsxs)(`span`,{className:`text-muted`,children:[` `,B(`newSession.primary`)]})]}),(0,H.jsx)(`select`,{className:Mr,"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,H.jsx)(`option`,{value:e,children:e},e))})]},t.path))]})}function rh(e){return e.replace(/\.git$/,``).split(/[/:]/).filter(Boolean).slice(-2).join(`/`)}function ih(e){return e.id.startsWith(`root:`)?e.primary??e.checkouts[0]??e.id:e.id}function ah(e,t){if(!e)return null;let n=t.find(t=>t.id===e||t.checkouts.includes(e));return n?{ref:ih(n),clone:!1}:e.startsWith(`/`)?{ref:e,clone:!1}:null}function oh(e,t,n){let r=t.toLowerCase();return n?e.some(e=>e.toLowerCase()===`github.com/${r}`):e.some(e=>mu(e).base.toLowerCase()===(r.split(`/`)[1]??``))}function sh(e,t,n){let r=t.find(t=>t.id===e||t.checkouts.includes(e))?.id??e,i=n.find(e=>e.id===r);return i?{ref:ih(i),clone:!1}:r.startsWith(`root:`)||r.startsWith(`/`)?null:{ref:r,clone:!0}}function ch(e,t){let n=new Set(t.filter(e=>e.installed!==!1).map(e=>e.id)),r=new Set(t.length>0?e.filter(e=>!n.has(e.id)).map(e=>e.id):[]),i=new Set(e.map(e=>e.id)),a=t.filter(e=>n.has(e.id)&&!i.has(e.id)).map(e=>({id:e.id,name:e.name??e.id}));return{rows:[...e,...a],missing:r}}function lh(e){return{repo:e.pick.ref,machine:e.machine,...e.pick.clone?{clone:!0}:{},...e.baseRef?{baseBranch:e.baseRef}:{},...e.prompt?{prompt:e.prompt}:{},...e.engine?{engine:e.engine}:{},...e.engineThere?{engineThere:!0}:{},...!e.engineThere&&e.model?{model:e.model}:{}}}var uh=1.2,dh=.3,fh=20,ph=.35,mh=.25,hh=.12,gh=2,_h=1,vh={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}},yh=Array.from({length:9},(e,t)=>Math.hypot(t%3-1,Math.floor(t/3)-1));function bh(e){return ph+.65*(.5+.5*Math.cos(2*Math.PI*e/uh))}function xh(e,t,n,r=1){switch(e){case`working`:{let e=t*80/1e3/r;return yh.map(t=>bh(e-t*dh))}case`waiting`:{let e=[0,1,4,5].includes(Math.floor(t/r)%fh);return Array(9).fill(e?mh:1)}default:{let t=vh[e],r=Array(9).fill(hh);return t?.dots.forEach((e,i)=>{let a=Math.min(Math.max(n-i*_h,0),gh)/gh;r[e]=t.bright*a+hh*(1-a)}),r}}}function Sh(e,t){let n=vh[e];return!n||t<(n.dots.length-1)*_h+gh}var Ch={working:`info`,waiting:`warning`,error:`attention`,done:`success`,idle:`muted`},wh={prOpen:``,prMerged:``,prClosed:``};function Th(e){let t=Eh(e);return{look:t,tone:Ch[t]}}function Eh(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 Dh(e){return e.rowStatus?.kind===`needs-input`||e.rowStatus?.kind===`attention`}var Oh={busy:0,attention:1,"needs-input":2,running:3,unseen:4,idle:5};function kh(e){let t;for(let{rowStatus:n}of e)n&&(!t||Oh[n.kind]<Oh[t.kind]||n.kind===t.kind&&n.since>t.since)&&(t=n);return t}function Ah(e,t,n){if(!e)return null;if(e.lifecycle===`merged`)return{glyph:wh.prMerged,tone:n?`text-muted`:`text-merged`,state:`merged`};if(e.lifecycle===`closed`)return{glyph:wh.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:wh.prOpen,tone:i,state:`open`,...r?{checks:r}:{}}}function jh(e){return Ah(e.pr,e.prChip,e.prChipStale===!0)}function Mh(e){return Ah(e,(e.mergeable??``).toUpperCase()===`CONFLICTING`?`conflict`:e.checkState===`failing`?`failing`:e.checkState===`passing`?`passing`:null,!1)}function Nh(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 Ph=3,Fh=new Set,Ih;function Lh(e,t){let n=typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches,r=1/0,i=e.held+t-e.step,a=Sh(e.look,n?r:i);return xh(e.look,t,n?r:i,n?Ph:1).forEach((t,n)=>{let r=e.el.children[n].style;r.opacity=t.toFixed(3)}),a}function Rh(){let e=Math.floor(performance.now()/80);for(let t of Fh)Lh(t,e)||Fh.delete(t);zh()}function zh(){Ih=Fh.size?window.setTimeout(Rh,80-performance.now()%80+2):void 0}function Bh(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 Lh(a,r)&&(Fh.add(a),Ih===void 0&&zh()),()=>{Fh.delete(a)}}function Vh({status:e}){let{look:t,tone:n}=Th(e);return(0,H.jsx)(Wh,{look:t,tone:n,since:e?.since??0},t)}var Hh=e=>e===`muted`?`text-muted`:e===`ink`?`text-ink`:lp[e];function Uh(){return(0,H.jsx)(Wh,{look:`working`,tone:`info`,since:Date.now()})}function Wh({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?Bh(t,e,i):void 0},[e,i]),(0,H.jsx)(`span`,{ref:r,className:`inline-grid flex-none grid-cols-[repeat(3,3px)] auto-rows-[3px] gap-px self-center ${Hh(t)}`,"aria-hidden":`true`,children:Array.from({length:9},(e,t)=>(0,H.jsx)(`i`,{className:`rounded-full bg-current opacity-12`},t))})}var Gh={offline:`newSession.remoteOffline`,outdated:`newSession.remoteOutdated`},Kh=`local`,qh=`auto`,Jh=`rove.newSession.autoMachine`;function Yh(){try{return localStorage.getItem(Jh)===`1`}catch{return!1}}var Xh=(e,t)=>Ku(e,`machines.repos`,{machine:t});function Zh(e,t){let n=t.filter(e=>e.state===`online`).map(e=>e.alias).join(`
41
- `);(0,h.useEffect)(()=>{for(let t of n?[Kh,...n.split(`
42
- `)]:[])Xh(e,t).catch(()=>{})},[e,n])}function Qh(e,t){let[n,r]=(0,h.useState)(null);return(0,h.useEffect)(()=>{if(!t)return;let n=!1;return Ku(e,`machines.engines`,{machine:t}).then(e=>!n&&r({machine:t,reply:e})).catch(()=>{}),()=>{n=!0}},[e,t]),t?(n?.machine===t?n.reply:X(e,`machines.engines`,{machine:t}))?.engines??[]:[]}function $h(e,t,n){let r=ch(n.engines,Qh(e,t)),i=r.rows.filter(e=>!r.missing.has(e.id)),a=i.some(e=>e.id===n.engine)?n.engine:i[0]?.id??n.engine;return{engines:r.rows,engine:a,setEngine:n.setEngine,missing:t?r.missing:void 0}}function eg(e,t,n){let[r,i]=(0,h.useState)(null),a=ng(e,r?.from??``);return(0,h.useEffect)(()=>{!r||!a.loaded||!t.loaded||(t.problem||n(sh(r.ref,a.repos,t.repos)),i(null))},[r,a,t,n]),(e,t)=>i(e&&t?{from:e,ref:t}:null)}function tg(e,t,n){let r=Zm(e),[i,a]=(0,h.useState)(t.machine??``),[o,s]=(0,h.useState)(()=>!t.machine&&Yh()),c=ng(e,i),[l,u]=(0,h.useState)(!1),d=$h(e,l?i:``,n);Zh(e,r);let[f,p]=(0,h.useState)(null),[m,g]=(0,h.useState)(``),_=eg(e,c,e=>p(t=>t??e));return(0,h.useEffect)(()=>{!i||!c.loaded||i!==t.machine||p(e=>e??ah(t.repo,c.repos))},[c.loaded]),{machines:r,machine:i,auto:o,remote:i!==``,machineName:r.find(e=>e.alias===i)?.hostLabel||i,remoteList:c,engineThere:l,setEngineThere:u,shown:d,pick:f,setPick:p,base:m,setBase:g,switchTo(e,t){let n=e===`auto`?``:e;s(e===qh);try{localStorage.setItem(Jh,e===`auto`?`1`:`0`)}catch{}_(n&&(i||`local`),i?f?.ref:t),a(n),p(null),g(``)}}}function ng(e,t){V();let[n,r]=(0,h.useState)(null);if((0,h.useEffect)(()=>{if(!t)return;let n=!1;return Xh(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=X(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:B(`newSession.remoteFailed`,{machine:t,message:i?.failed??``})};let s=o.reason?Gh[o.reason]:void 0,c=o.reason?s?B(s,{machine:t}):B(`newSession.remoteFailed`,{machine:t,message:o.message??o.reason}):``;return{repos:o.repos,loaded:!0,problem:c}}function rg(e,t){return t.problem?t.problem:t.loaded?B(`newSession.remoteNone`,{machine:e}):B(`newSession.remoteLoading`,{machine:e})}function ig(){return(0,H.jsxs)(`svg`,{className:$p,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,H.jsx)(`rect`,{x:`2`,y:`3`,width:`12`,height:`8`,rx:`1`}),(0,H.jsx)(`path`,{d:`M5.5 13.5h5M8 11v2.5`})]})}function ag(e){let t=(V()===`zh`?Gi:Wi).machine,n=e.machines.find(t=>t.alias===e.value),r=e.value===`auto`?B(`newSession.machineAuto`):e.value?n?.hostLabel||e.value:B(`newSession.thisMachine`);return(0,H.jsx)(Qm,{field:`machine`,title:B(`newSession.machine`),label:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(ig,{}),(0,H.jsx)(`span`,{className:em,children:r})]}),children:n=>(0,H.jsx)(th,{heading:B(`newSession.machine`),options:[{id:qh,label:B(`newSession.machineAuto`)},{id:``,label:B(`newSession.thisMachine`)},...e.machines.map(e=>({id:e.alias,label:Km(e,t),disabled:e.state!==`online`}))],footer:e.value===`auto`?(0,H.jsx)(`p`,{className:`${gm} text-muted`,children:B(`newSession.machineAutoNote`)}):null,value:e.value,digits:!0,onPick:t=>{e.onPick(t),n()}})})}function og(e){let{machine:t}=e;return(0,H.jsx)(th,{heading:B(`newSession.agentPlace`),options:[{id:``,label:B(`newSession.thisMachine`)},{id:`there`,label:t}],value:e.there?`there`:``,digits:!0,onBack:e.onBack,onPick:t=>e.onPick(t!==``),footer:(0,H.jsx)(`p`,{className:`${gm} text-muted`,children:B(e.there?`newSession.agentThereNote`:`newSession.agentHereNote`,{machine:t})})})}function sg(e){let[t,n]=(0,h.useState)(``),r=t.trim();return(0,H.jsx)(Qm,{field:`branch`,title:B(`newSession.branch`),label:e.value||B(`newSession.branch`),children:i=>(0,H.jsx)($m,{placeholder:B(`newSession.branchTypeRef`),empty:``,rows:[{key:``,text:B(`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 cg(e,t){return(await e.client.request(`task.spawn`,lh(t))).taskIds[0]}function lg(e){let{progress:t,error:n}=e;return!t&&!n?null:(0,H.jsxs)(`div`,{className:Gp,children:[t&&(0,H.jsxs)(`p`,{className:`m-0 flex items-center gap-2 text-muted`,"data-field":`clone-progress`,children:[(0,H.jsx)(Uh,{}),(0,H.jsx)(`span`,{className:`running-shimmer:bg-[linear-gradient(90deg,var(--ink)_0%,var(--ink)_35%,var(--accent)_50%,var(--ink)_65%,var(--ink)_100%)] running-shimmer:bg-size-[300%_100%] running-shimmer:bg-clip-text running-shimmer:text-transparent running-shimmer:animate-shimmer`,children:t})]}),n&&!Cm(n)&&(0,H.jsxs)(`p`,{className:`m-0 text-error`,children:[`※ `,n]}),n&&Cm(n)&&(0,H.jsxs)(`p`,{className:`pointer-events-auto m-0 text-error`,"data-field":`no-disk-space`,children:[`※ `,q(`tasks`,`toast.noDiskSpace`),` `,(0,H.jsx)(U,{hit:`tight`,disabled:e.busy,onClick:e.onRetry,children:B(`newSession.retry`)})]})]})}function ug(e){return e instanceof Uo&&e.code===`CLONE_FAILED`?q(`newTask`,`error.cloneFailed`,{error:e.message}):e instanceof Error?e.message:String(e)}function dg({on:e,...t}){return(0,H.jsx)(`button`,{type:`button`,className:`${tm(e)} ${nm}`,"aria-pressed":e,...t})}function fg(e){let[t,n]=(0,h.useState)(``);if(e.ungrouped)return null;if(e.remote)return e.remotePick&&(0,H.jsx)(sg,{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=_u(s?.branches??[],t).map(e=>({key:e,text:e,checked:e===(i[o]||s?.current)})),u=r.map(t=>({path:t,name:mu(t).base,primary:t===o,branches:e.probes[t]?.branches??[],current:e.probes[t]?.current??``,base:i[t]??``}));return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(dg,{on:!a,disabled:r.length>1||e.plain,title:e.plain?B(`newSession.worktreeNoGit`):r.length>1?B(`newSession.worktreeMulti`):B(a?`newSession.worktreeOff`:`newSession.worktreeOn`),onClick:e.onToggleWorktree,children:[(0,H.jsx)(xm,{}),(0,H.jsx)(`span`,{className:em,children:B(`newSession.worktree`)})]}),r.length>1?(0,H.jsx)(Qm,{field:`branch`,title:B(`newSession.branches`),label:B(`newSession.branches`),children:()=>(0,H.jsx)(nh,{repos:u,branch:e.branchName,onBranch:e.onBranchName,onBase:e.onBase})}):!a&&s?.ok&&c&&(0,H.jsx)(Qm,{field:`branch`,title:B(`newSession.branch`),label:c,children:r=>(0,H.jsx)($m,{placeholder:B(`newSession.branchSearch`),empty:B(`newSession.branchEmpty`),rows:l,query:t,onQuery:n,onPick:t=>{e.onBase(o,t),n(``),r()}})})]})}var pg=`rove.web.newSession.prompt`,mg=`rove.web.newSession.attachments`,hg=sessionStorage.getItem(pg)??``;function gg(){return hg}function _g(e){hg=e;try{sessionStorage.setItem(pg,e)}catch{}}function vg(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=Au(a,t);r(n),n[0]&&n[0]!==e.engine&&e.setEngine(n[0])}}}function yg(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,H.jsx)(Qm,{field:`engine`,title:B(`newSession.engine`),label:ju(i)||B(`newSession.engine`),children:i=>(0,H.jsx)(th,{heading:B(`newSession.engine`),options:r.map(t=>{if(!e.missing)return{id:t.id,label:t.name,dim:t.ready===!1};let n=e.missing.has(t.id);return{id:t.id,label:n?B(`newSession.engineMissing`,{engine:t.name}):t.name,disabled:n}}),value:n.engine,...t.comparing?{values:t.ids}:{},onPick:e=>{if(t.comparing)return t.toggle(e);n.setEngine(e),i()},footer:e.available&&r.length>1?(0,H.jsx)(U,{className:`mx-2 mt-1 mb-0.5 self-start font-mono`,"data-field":`compare-engines`,hit:`tight`,onClick:()=>t.setComparing(!t.comparing),children:B(t.comparing?`compare.oneEngine`:`compare.severalEngines`)}):null})})}function bg(e){return(0,H.jsx)(Qm,{field:`model`,title:B(`newSession.model`),label:ku(e.models,e.model,B(`newSession.modelDefault`)),children:t=>(0,H.jsx)(th,{heading:B(`newSession.modelHeading`),options:e.models,value:e.model,digits:!0,onPick:n=>{e.onModel(n),t()}})})}var xg=6e4,Sg=/^(?:(today|tomorrow|今天|明天)\s*)?(\d{1,2})(?::(\d{2}))?\s*(am|pm)?$/i,Cg=/^\+\s*(?:(\d+)\s*h)?\s*(?:(\d+)\s*m)?$/i;function wg(e,t){let n=e.trim(),r=Cg.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*xg):null}let i=Sg.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 Tg(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 Eg(e){let[t,n]=(0,h.useState)(``),r=()=>{let n=wg(t,new Date);if(!n)return e.onInvalid(B(`newSession.laterBad`));e.onSchedule(n)};return(0,H.jsxs)(`div`,{className:ym,children:[(0,H.jsx)(`input`,{className:`${Mr} min-w-0 flex-1`,value:t,placeholder:B(`newSession.laterPlaceholder`),"aria-label":B(`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,H.jsx)(U,{variant:`filled`,disabled:!t.trim(),onClick:r,children:B(`newSession.laterConfirm`)})]})}function Dg(e){let[t,n]=(0,h.useState)(`root`),r=e.agentPlace;return(0,H.jsx)(Qm,{field:`more`,title:B(`newSession.more`),label:(0,H.jsx)(`span`,{"aria-hidden":`true`,children:`⋯`}),onClose:()=>n(`root`),children:i=>t===`later`?(0,H.jsxs)(`div`,{className:om,children:[(0,H.jsxs)(`button`,{type:`button`,className:`${cm} ${W} text-muted`,onClick:()=>n(`root`),children:[`‹ `,B(`newSession.later`)]}),(0,H.jsx)(Eg,{onBack:()=>n(`root`),onInvalid:e.onInvalid,onSchedule:t=>{i(),e.onLater?.(t)}})]}):t===`agent`&&r?(0,H.jsx)(og,{...r,onBack:()=>n(`root`),onPick:e=>{r.onPick(e),i()}}):(0,H.jsxs)(`div`,{role:`menu`,className:om,children:[r&&(0,H.jsx)(Og,{label:B(`newSession.agentPlace`),dim:r.there?r.machine:B(`newSession.thisMachine`),sub:!0,disabled:e.busy,onClick:()=>n(`agent`)}),e.onLater&&(0,H.jsx)(Og,{label:B(`newSession.later`),sub:!0,disabled:e.busy,onClick:()=>n(`later`)})]})})}function Og(e){return(0,H.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`${lm({cursor:!1})} [&:hover:not(:disabled)]:bg-hover`,disabled:e.disabled,onClick:e.onClick,children:[(0,H.jsx)(`span`,{className:fm,children:e.label}),(e.dim!==void 0||e.sub)&&(0,H.jsxs)(`span`,{className:`${dm} text-muted`,children:[e.dim,e.sub&&(0,H.jsx)(ps,{right:!0})]})]})}var kg=128,Ag=80,jg=3,Mg=2,Ng=kg/2,Pg=Ag/2,Fg=25,Ig=(1-1.2/Fg)**2,Lg=1e3/30,Rg=7,zg=0,Bg=1,Vg=2,Hg=3,Ug=4,Wg=[``,`--color-subtle`,`--color-muted`,`--color-ink`,`--color-accent`],Gg=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5],Kg=Array.from({length:64},(e,t)=>{let n=t%8,r=t>>3;return(4*(Gg[(r&3)*4+(n&3)]??0)+([0,2,3,1][(r>>2)*2+(n>>2)]??0)+.5)/64}),qg=(e,t)=>Kg[(t&7)*8+(e&7)]??1,Jg=[{radius:1.55,lift:.3,roll:-.42,speed:.9,phase:.4,ink:Ug},{radius:1.95,lift:.22,roll:.3,speed:-.55,phase:2.6,ink:Hg},{radius:2.4,lift:.36,roll:-.12,speed:.38,phase:4.4,ink:Hg}],Yg=1.9,Xg=[[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 Zg(e,t){e.fill(zg);let n=(t,n,r)=>{t>=0&&t<kg&&n>=0&&n<Ag&&(e[n*kg+t]=r)};for(let[e,r,i]of Xg)Math.sin(t*.8+i)>-.5&&n(e,r,Bg);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<Ag;e++)for(let t=0;t<kg;t++){let s=(t+.5-Ng)/Fg,u=(e+.5-Pg)/Fg,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)>qg(t,e)?n(t,e,h>.4?Hg:Vg):p>Ig&&n(t,e,Bg)}for(let e of Jg){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(Ng+s*Fg),Math.floor(Pg+c*Fg),l]},o=Math.round(Math.PI*e.radius*Fg);for(let e=0;e<o;e++){let t=a(e/o*Math.PI*2);t&&!t[2]&&n(t[0],t[1],Bg)}let s=e.phase+t*e.speed,c=.5/(e.radius*Fg),l=-Math.sign(e.speed)*c;for(let e=Yg/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,zg)}for(let t=Yg/c;t>0;t--){let r=a(s+t*l),i=1-t*c/Yg;r&&i>qg(r[0],r[1])&&n(r[0],r[1],i>.6?e.ink:Vg)}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 Qg(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=Bg;e<=Ug;e++){n.fillStyle=a.getPropertyValue(Wg[e]??``)||a.color;for(let r=0;r<t.length;r++)t[r]===e&&n.fillRect(r%kg*jg,Math.floor(r/kg)*jg,Mg,Mg)}}function $g(){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){Zg(n,Rg),Qg(t,n);return}let r=0,i=0,a=e=>{r=requestAnimationFrame(a),!(e-i<Lg)&&(i=e,Zg(n,e/1e3),Qg(t,n))};return r=requestAnimationFrame(a),()=>cancelAnimationFrame(r)},[]),(0,H.jsx)(`div`,{"aria-hidden":`true`,className:`mb-3 max-w-full`,children:(0,H.jsx)(`canvas`,{ref:e,width:384,height:240,"data-plate":`rove`,className:`h-auto w-96 max-w-full text-muted`})})}var e_=`clone:`;function t_(e){let{model:t,saved:n,picked:r,primary:i,home:a,query:o,remote:s}=e,[c,l]=(0,h.useState)(()=>X(t,`github.repos`)??null);(0,h.useEffect)(()=>{let e=!1,n=t.client.onOpen(()=>{Ku(t,`github.repos`).then(t=>!e&&l(t)).catch(()=>!e&&l(e=>e??{repos:[],reason:`failed`}))});return()=>{e=!0,n()}},[t]);let u=o.trim(),d=u.toLowerCase(),f=Tu(u),p=n.filter(e=>e.toLowerCase().includes(d)||f!==null&&`/${mu(e).base.toLowerCase()}`===f.slice(f.indexOf(`/`))),m=B(`newSession.noFolder`),g=e.ungrouped&&(!u||m.toLowerCase().includes(u.toLowerCase()))?[{key:kd,text:m,checked:e.ungrouped.on}]:[],_=p.map((e,t)=>{let{base:n,dir:a}=mu(e);return{key:e,text:n,dim:e===i&&r.length>1?`${B(`newSession.primary`)}, ${a}`:a,dimPath:!0,title:e,checked:r.includes(e),ruled:t===0&&g.length>0}}),v=Cu(u),y=v&&(v.includes(`:`)||p.length===0)?v:null,b=!y&&vu(u)&&!n.includes(u)&&(!s||u.startsWith(`/`))?bu(yu(u,a)):``,x=(c?.repos??[]).filter(e=>e.nameWithOwner.toLowerCase().includes(f??d)).filter(e=>!oh(n,e.nameWithOwner,s!==void 0)).sort((e,t)=>Number(t.nameWithOwner.toLowerCase()===f)-Number(e.nameWithOwner.toLowerCase()===f)).map(t=>({key:e_+t.nameWithOwner,text:t.nameWithOwner,dim:t.description,title:t.description,checked:e.cloning===t.nameWithOwner})),S=f!==null&&!/^(?:ssh:|git@)/i.test(u)&&x[0]?.text.toLowerCase()===f?null:y?{key:e_+y,text:s?B(`newSession.cloneRowOn`,{source:y,machine:s.name}):B(`newSession.cloneRow`,{source:y})}:b?{key:b,text:b,checked:r.includes(b)}:null;return(0,H.jsx)($m,{placeholder:B(s?`newSession.repoSearchRemote`:`newSession.repoSearch`),empty:s?.empty??B(`newSession.repoEmpty`),rows:s?.blocked?[]:[...g,..._],query:o,onQuery:e.onQuery,extra:s?.blocked?null:S,more:s?.blocked?[]:x,moreLabel:B(`newSession.githubGroup`),hint:s?void 0:B(`newSession.repoMultiHint`),onPick:(t,n)=>{if(t===`~scratch`)return e.ungrouped?.pick(),e.close();if(!t.startsWith(`clone:`))return e.onToggle(t,n);e.onClone(t.slice(6)),e.close()}})}function n_(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 r_(e,t){return e?[e,...(t.extras??[]).map(e=>e.repo)]:[]}function i_(e,t){return e?{...t.baseBranch?{[e]:t.baseBranch}:{},...Object.fromEntries((t.extras??[]).flatMap(e=>e.baseRef?[[e.repo,e.baseRef]]:[]))}:{}}function a_(e){return[e.machine??``,e.repo??``,e.ungrouped?`u`:``,e.retryOf?.id??``,e.baseBranch??``,e.worktree===void 0?``:String(e.worktree)].join(`\0`)}function o_(e,t){return e.retryOf&&e.engine&&e.engine===t?e.retryOf.id:void 0}async function s_(e,t){try{let{task:n}=await e.client.request(`task.get`,{taskId:t.id});if(!n.prompt)return void L(B(`menu.retryNoPrompt`),`error`);te(n_(t,{...n,prompt:n.prompt}))}catch(e){L(G(e),`error`)}}function c_(e,t){let n=async n=>{await e.act(`task.archive`,{taskId:t.id,archived:!0,...n?{force:n}:{}}),L(q(`tasks`,`archive.done`,{title:t.label}))};C.set((0,H.jsx)(Ti,{title:B(`newSession.retryArchiveTitle`,{title:t.label}),body:B(`newSession.retryArchiveBody`),confirmLabel:q(`tasks`,`menu.archive`),onConfirm:()=>n(!1),escalate:{when:e=>e instanceof Uo&&e.code===`TASK_BUSY`,label:q(`tasks`,`archive.busyConfirm`),title:q(`tasks`,`archive.busyTitle`),body:()=>q(`tasks`,`archive.busyBody`,{title:t.label}),run:()=>n(!0)}}))}var l_=v([]),u_=()=>y(l_);async function d_(e){l_.set((await e.request(`snippets.get`)).snippets)}async function f_(e,t){l_.set((await e.request(`snippets.save`,{name:t.name,text:t.text})).snippets)}async function p_(e,t){l_.set((await e.request(`snippets.remove`,{name:t})).snippets)}var m_=/^[A-Za-z0-9][\w-]{0,31}$/;function h_(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 g_(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 __(e,t,n){return{text:e.slice(0,t.start)+n.text+e.slice(t.end),caret:t.start+n.text.length}}var v_=e=>e.split(`
43
- `,1)[0]??``;function y_(e){return(0,H.jsx)(`ul`,{className:`${Or} ${e.className}`,children:e.items.map((t,n)=>(0,H.jsx)(`li`,{children:(0,H.jsxs)(U,{variant:`row`,tabIndex:-1,"aria-pressed":n===e.at,className:kr({cursor:n===e.at,accent:!1}),onMouseDown:t=>{t.preventDefault(),e.onPick(n)},children:[(0,H.jsxs)(`span`,{className:`text-accent`,children:[`@`,t.name]}),(0,H.jsxs)(`span`,{className:`text-muted`,children:[` `,v_(t.text)]})]})},t.name))})}function b_(e){let t=u_(),[n,r]=(0,h.useState)(0),[i,a]=(0,h.useState)(0),[o,s]=(0,h.useState)(null),c=(0,h.useRef)(null),l=h_(e.value,Math.min(n,e.value.length)),u=l?g_(t,l.query):[],d=l!==null&&u.length>0&&o!==l.start,f=Math.min(i,Math.max(0,u.length-1));(0,h.useLayoutEffect)(()=>{let t=c.current,n=e.area.current;t===null||!n||(c.current=null,n.setSelectionRange(t,t),r(t))});let p=t=>{let n=u[t];if(!l||!n)return;let r=__(e.value,l,n);c.current=r.caret,a(0),e.onChange(r.text)},m=e=>{if(!d||e.nativeEvent.isComposing)return!1;if(e.key===`ArrowDown`||e.key===`ArrowUp`)a(Math.max(0,Math.min(u.length-1,f+(e.key===`ArrowDown`?1:-1))));else if(e.key===`Tab`&&!e.shiftKey||e.key===`Enter`&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey)p(f);else if(e.key===`Escape`)s(l?.start??null),e.stopPropagation();else return!1;return e.preventDefault(),!0};return{list:d?(0,H.jsx)(y_,{items:u,at:f,className:e.listClassName??``,onPick:p}):null,field:{onChange:t=>{r(t.target.selectionStart),a(0),e.onChange(t.target.value)},onSelect:e=>r(e.currentTarget.selectionStart),onKeyDown:t=>{m(t)||!e.onEnter||t.key!==`Enter`||t.shiftKey||t.nativeEvent.isComposing||(t.preventDefault(),e.onEnter())}}}}var x_=`relative hidden [border-top:var(--hairline)_solid_var(--line)] bg-surface px-3 pt-2.5 pb-3.5 touch:flex`,S_=`absolute inset-x-3 bottom-full z-5 mb-1`,C_=`absolute inset-x-3 bottom-full z-6 mb-1`,w_=`flex min-w-0 flex-1 items-center gap-2.5`,T_=`flex h-11 min-w-0 flex-1 items-center rounded-[12px] border-hairline border-line bg-inset focus-within:border-focus has-[textarea:disabled]:opacity-60`,E_=`h-full min-w-0 flex-1 resize-none bg-transparent py-0 pr-3.5 pl-3.5 font-sans text-display leading-[42px] text-ink outline-none [border:0] has-[+button]:pr-0`,D_=`transition-transform duration-100 active:scale-94 motion-reduce:transition-none motion-reduce:active:scale-none`,O_=`transition-[scale,background-color,border-color,color] duration-150 active:scale-[0.98] motion-reduce:transition-none motion-reduce:active:scale-none`,k_=`flex size-11 shrink-0 items-center justify-center rounded-[12px] border-hairline border-accent text-accent touch-manipulation disabled:border-line disabled:text-muted disabled:opacity-60 ${D_}`,A_=`flex size-11 shrink-0 cursor-pointer items-center justify-center rounded-[10px] touch-manipulation active:bg-inset disabled:opacity-60 has-[:disabled]:opacity-60 ${D_}`,j_=`size-4.5 flex-none fill-none stroke-current stroke-[1.5] [stroke-linecap:round] [stroke-linejoin:round]`,M_=(e=!1)=>`${A_} -mr-1.5 -ml-3.25 ${e?`text-accent`:`text-muted`}`,N_=e=>`${A_} ${e?`text-accent`:`text-muted`}`,P_=(e,t)=>`relative z-6 flex h-11 min-w-0 flex-1 items-center gap-2.5 rounded-[12px] border-hairline px-3.5 font-sans touch-manipulation disabled:text-muted ${O_} ${t?`border-accent bg-accent text-paper`:e?`border-accent bg-accent-soft text-accent`:`border-line bg-inset text-ink`}`;function F_({d:e}){return(0,H.jsx)(`svg`,{viewBox:`0 0 16 16`,className:j_,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:e})})}var I_=`M8 1.5a2.5 2.5 0 0 1 2.5 2.5v4.5a2.5 2.5 0 0 1-5 0V4A2.5 2.5 0 0 1 8 1.5zM3 8a5 5 0 0 0 10 0M8 13v1.5`,L_=`M8 13V3M3.5 7.5 8 3l4.5 4.5`;function R_(){return(0,H.jsx)(F_,{d:`M10.5 4.5 5.8 9.2a1.4 1.4 0 0 0 2 2l5-5a2.8 2.8 0 0 0-4-4l-5.2 5.2a4.2 4.2 0 0 0 6 6L13 9`})}function z_(e){return(0,H.jsxs)(`button`,{type:`submit`,className:k_,title:e.label,disabled:e.disabled,children:[(0,H.jsx)(`span`,{className:`sr-only`,children:e.label}),(0,H.jsx)(F_,{d:L_})]})}function B_(e,t){let n=(0,h.useRef)(e);e!==null&&(n.current=e);let r=e===null,[i,a]=(0,h.useState)(r);return(0,h.useEffect)(()=>{if(!r)return a(!1);let e=window.setTimeout(()=>a(!0),t);return()=>window.clearTimeout(e)},[r,t]),{shown:e??(i?null:n.current),leaving:r&&!i}}function V_(e){return typeof Intl.Segmenter==`function`?[...new Intl.Segmenter(void 0,{granularity:`word`}).segment(e)].map(e=>e.segment):e.split(/(\s+)/)}function H_({level:e,seconds:t,wide:n}){let r=n?120:80,i=(0,h.useRef)([]),a=(0,h.useRef)(-1);t!==a.current&&(a.current=t,i.current=[...i.current,e].slice(-r));let o=[...Array(r-i.current.length).fill(0),...i.current];return(0,H.jsx)(`span`,{className:`flex min-w-0 flex-1 items-center justify-end overflow-hidden ${n?`h-10 gap-[3px]`:`h-5.5 gap-[2.5px]`}`,"aria-hidden":`true`,children:o.map((e,t)=>(0,H.jsx)(`i`,{className:`block h-full flex-none rounded-full bg-current transition-transform duration-100 ease-linear motion-reduce:transition-none ${n?`w-[3px]`:`w-[2.5px]`}`,style:{transform:`scaleY(${Math.max(n?.08:.12,Math.min(1,e*10))})`}},t))})}function U_(){return(0,H.jsx)(`span`,{className:`inline-flex items-center gap-[3px] align-middle`,"aria-hidden":`true`,children:[0,160,320].map(e=>(0,H.jsx)(`i`,{className:`block size-1 rounded-full bg-current motion-safe:animate-dot`,style:{animationDelay:`${e}ms`}},e))})}var W_=`pointer-events-none absolute inset-x-0 bottom-full z-6 mb-2.5 flex min-h-17 origin-bottom items-center rounded-[16px] border-hairline bg-surface px-4 py-3 text-left shadow-dialog transition-colors duration-150`;function G_({bubble:e,leaving:t}){return(0,H.jsx)(`span`,{className:`${W_} ${t?`motion-safe:animate-sink-out`:`motion-safe:animate-bubble-in`} ${e.armed?`border-accent`:`border-line`}`,children:e.text?(0,H.jsx)(`span`,{className:`flex max-h-[5.8em] min-w-0 flex-1 flex-col justify-end overflow-hidden font-sans text-display leading-[1.45] transition-colors duration-150 motion-safe:animate-fade-in ${e.waiting?`text-muted`:`text-ink`}`,children:(0,H.jsx)(`span`,{children:V_(e.text).map((e,t)=>(0,H.jsx)(`span`,{className:`motion-safe:animate-fade-in`,children:e},t))})},`words`):(0,H.jsx)(`span`,{className:`flex min-w-0 flex-1 text-accent`,children:(0,H.jsx)(H_,{level:e.level,seconds:e.seconds,wide:!0})},`wave`)})}var K_=`flex min-w-0 flex-1 items-center gap-2.5 motion-safe:animate-fade-in`;function q_(e){let{state:t}=e,n=t.phase===`recording`,r=t.phase===`transcribing`,i=e.slide!==void 0,a=n&&t.held,o=(0,h.useRef)(``);n&&(o.current=t.partial);let{shown:s,leaving:c}=B_(i&&(a||(n||r)&&o.current!==``)?{text:o.current,armed:a&&t.armed,waiting:!a,level:t.level,seconds:t.seconds}:null,140),l=s&&(0,H.jsx)(G_,{bubble:s,leaving:c}),u=(0,H.jsxs)(`span`,{className:`${K_} justify-center gap-2 text-body`,children:[e.working.replace(/…$/,``),(0,H.jsx)(U_,{})]},`working`);return r||n&&i&&!a?(0,H.jsxs)(H.Fragment,{children:[l,u]}):n?(0,H.jsxs)(H.Fragment,{children:[l,(0,H.jsxs)(`span`,{className:K_,children:[(0,H.jsx)(`span`,{className:`size-2 flex-none rounded-full bg-current`,style:{opacity:.3+Math.min(1,t.level*10)*.7}}),(0,H.jsx)(`span`,{className:`flex-none font-mono text-body normal-nums`,children:t.time}),i?(0,H.jsxs)(`span`,{className:`ml-auto flex flex-none items-center gap-1 text-body motion-safe:animate-fade-in ${t.armed?`font-semibold`:`opacity-80`}`,children:[(0,H.jsx)(`svg`,{viewBox:`0 0 16 16`,className:`size-4 flex-none fill-none stroke-current stroke-[1.5]`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:L_})}),t.armed?e.release:e.slide]},String(t.armed)):t.partial?(0,H.jsx)(`span`,{className:`flex min-w-0 flex-1 justify-end overflow-hidden whitespace-nowrap text-meta`,children:t.partial}):(0,H.jsx)(H_,{level:t.level,seconds:t.seconds})]},`take`)]}):(0,H.jsxs)(H.Fragment,{children:[l,(0,H.jsxs)(`span`,{className:`${K_} justify-center gap-2 text-display`,children:[(0,H.jsx)(`span`,{className:`flex text-muted`,children:(0,H.jsx)(F_,{d:I_})}),e.idle]},`idle`)]})}function J_({state:e}){return e.phase===`recording`?(0,H.jsx)(`span`,{className:`font-mono text-meta normal-nums`,children:e.time}):e.phase===`transcribing`?(0,H.jsx)(`span`,{className:`font-mono text-meta`,children:`…`}):(0,H.jsx)(F_,{d:I_})}function Y_(e){return e.hold?(0,H.jsx)(q_,{state:e.state,idle:e.idle,working:e.working}):(0,H.jsx)(J_,{state:e.state})}function X_(e){return(0,H.jsxs)(`form`,{className:x_,"data-composer":e.composerKey,onSubmit:t=>{t.preventDefault(),e.onSend()},children:[e.attached&&(0,H.jsx)(`div`,{className:S_,children:e.attached}),e.suggest&&(0,H.jsx)(`div`,{className:C_,children:e.suggest}),(0,H.jsxs)(`div`,{className:w_,children:[e.attach,e.voice??(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:T_,children:[(0,H.jsx)(`textarea`,{ref:e.fieldRef,className:E_,rows:1,value:e.value,placeholder:e.placeholder,disabled:e.busy,enterKeyHint:`send`,onChange:e.onChange,onSelect:e.onSelect,onKeyDown:e.onKeyDown,onPaste:e.onPaste,onBlur:e.onBlur}),e.dictate]}),(0,H.jsx)(z_,{label:e.sendLabel,disabled:e.busy||!e.ready})]})]})]})}var Z_=`/dictation-worklet.js`,Q_=60,$_=16e3,ev=.004,tv={phase:`idle`,seconds:0,level:0,error:null,partial:``},nv=1e3,rv=class{step;emitted=0;consumed=0;constructor(e){this.step=e}push(e){let t=e.reduce((e,t)=>e+t.length,0),n=new Float32Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;let i=this.consumed+t,a=[];for(let e=Math.floor(this.emitted*this.step);e<i;e=Math.floor(this.emitted*this.step)){let t=Math.max(-1,Math.min(1,n[e-this.consumed]??0));a.push(Math.round(t*32767)),this.emitted++}return this.consumed=i,Int16Array.from(a)}};function iv(e){let t=new Uint8Array(e.length*2),n=new DataView(t.buffer);for(let t=0;t<e.length;t++)n.setInt16(t*2,e[t],!0);return t}function av(e,t){let n=new rv(t/$_).push(e),r=Math.max(1,n.length),i=new Uint8Array(44+r*2),a=new DataView(i.buffer),o=(e,t)=>{for(let n=0;n<t.length;n++)a.setUint8(e+n,t.charCodeAt(n))};return o(0,`RIFF`),a.setUint32(4,36+r*2,!0),o(8,`WAVEfmt `),a.setUint32(16,16,!0),a.setUint16(20,1,!0),a.setUint16(22,1,!0),a.setUint32(24,$_,!0),a.setUint32(28,$_*2,!0),a.setUint16(32,2,!0),a.setUint16(34,16,!0),o(36,`data`),a.setUint32(40,r*2,!0),i.set(iv(n),44),i}function ov(e){for(let t of e.getTracks())t.stop();return null}function sv(e){let t=Array(e.length);for(let n=0;n<e.length;n++)t[n]=e[n].toString(16).padStart(2,`0`);return t.join(``)}var cv=class{client;scope;view=v(tv);stream=null;context=null;node=null;chunks=[];timer=null;capTimer=null;peak=0;recent=0;session=0;live=null;liveTimer=null;constructor(e,t){this.client=e,this.scope=t}get recording(){return this.view.get().phase===`recording`}async toggle(){return this.recording?this.stop():this.start()}async start(e=!1){if(this.view.get().phase!==`idle`&&this.view.get().phase!==`error`)return null;let t=++this.session;this.live=null,this.view.set({...tv,phase:`recording`});try{let n=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0}});if(t!==this.session)return ov(n);this.stream=n;let r=new AudioContext;if(this.context=r,await r.audioWorklet.addModule(Z_),t!==this.session)return null;let i=r.createMediaStreamSource(n);this.node=new AudioWorkletNode(r,`rove-capture`),this.chunks=[],this.peak=0,this.recent=0,this.node.port.onmessage=e=>{let t=e.data;this.chunks.push(t);let n=0;for(let e=0;e<t.length;e++)n+=t[e]*t[e];let r=Math.sqrt(n/Math.max(1,t.length));this.peak=Math.max(this.peak,r),this.recent=Math.max(this.recent,r)},i.connect(this.node);let a=r.createGain();a.gain.value=0,this.node.connect(a),a.connect(r.destination);let o=Date.now();return this.timer=window.setInterval(()=>{this.view.set({...this.view.get(),seconds:(Date.now()-o)/1e3,level:this.recent}),this.recent=0},100),this.capTimer=window.setTimeout(()=>void this.stop(),Q_*1e3),e&&(this.live={id:`${Date.now().toString(36)}${Math.random().toString(36).slice(2,10)}`,resample:new rv(r.sampleRate/$_),sent:0,seq:0,inFlight:null,dead:!1},this.liveTimer=window.setInterval(()=>void this.pump(!1),nv)),null}catch(e){return t===this.session?(this.release(),this.fail(e),null):null}}async pump(e){let t=this.live;if(!t||t.dead||t.inFlight&&!e||(t.inFlight&&await t.inFlight.catch(()=>{}),t.dead))return null;let n=this.chunks.slice(t.sent);t.sent+=n.length;let r=t.seq++,i=r===0?this.scope():null,a=this.client.request(`voice.stream`,{session:t.id,seq:r,pcm:sv(iv(t.resample.push(n))),final:e,...i?{context:i.draft,taskId:i.taskId,tabId:i.tabId}:{}});t.inFlight=a;try{let n=await a;if(e)return n;let r=this.view.get();this.live===t&&r.phase===`recording`&&typeof n.partial==`string`&&this.view.set({...r,partial:n.partial})}catch{t.dead=!0}finally{t.inFlight===a&&(t.inFlight=null)}return null}async stop(){if(this.view.get().phase!==`recording`)return null;let e=this.context?.sampleRate??$_,t=this.chunks;this.view.set({...this.view.get(),phase:`transcribing`,level:0}),this.release();let n=av(t,e),r=(n.length-44)/2/$_;if(r<.3||this.peak<ev)return this.live=null,this.view.set(tv),{text:``,seconds:r,ms:0,reason:`silent`};try{let e=this.live?await this.pump(!0):null;this.live=null;let t=e??await this.transcribeWhole(n);return this.view.set(tv),t}catch(e){return this.live=null,this.fail(e),null}}transcribeWhole(e){let t=this.scope();return this.client.request(`voice.transcribe`,{wav:sv(e),context:t.draft,taskId:t.taskId,tabId:t.tabId})}fail(e){this.view.set({...tv,phase:`error`,error:e instanceof Error?e.message:String(e)})}cancel(){this.view.get().phase===`recording`&&(this.release(),this.live=null,this.view.set(tv))}release(){this.session++,this.timer!==null&&window.clearInterval(this.timer),this.capTimer!==null&&window.clearTimeout(this.capTimer),this.liveTimer!==null&&window.clearInterval(this.liveTimer),this.timer=null,this.capTimer=null,this.liveTimer=null,this.node?.port.close(),this.node=null;for(let e of this.stream?.getTracks()??[])e.stop();this.stream=null,this.context?.close().catch(()=>{}),this.context=null}},lv=e=>`0:${String(Math.floor(e)).padStart(2,`0`)}`,uv=300,dv=48,fv=()=>navigator.vibrate?.(8),pv=new WeakMap,mv=new WeakSet;function hv(e){let t=pv.get(e);return t||(t=v(null),pv.set(e,t)),t}function gv(e,t){hv(e).set(t)}var _v=e=>e.available??(e.ready===!0||(e.model??null)!==null);function vv(e){let t=hv(e),n=y(t);return(0,h.useEffect)(()=>{mv.has(e)||(mv.add(e),e.onOpen(()=>{e.request(`voice.status`).then(e=>t.set(_v(e)),()=>t.set(!1))}))},[e,t]),n}var yv=e=>lu()&&hv(e).get()!==!1;function bv(e){V();let t=(0,h.useRef)(e);t.current=e;let n=(0,h.useRef)(null);n.current===null&&(n.current=new cv(e.client,()=>t.current.context()));let r=y(n.current.view),i=vv(e.client),a=(0,h.useRef)(null),o=(0,h.useRef)(!1),[s,c]=(0,h.useState)(null);(0,h.useEffect)(()=>()=>{a.current&&window.clearTimeout(a.current.timer),n.current?.cancel()},[]);let l=(e,n)=>{if(!e?.text)return;let{onSend:r,onText:i}=t.current;n&&r?r(e.text):i(e.text)},u=()=>void n.current?.toggle().then(e=>l(e,!1)),d=e=>{if(e.button!==0)return;e.currentTarget.setPointerCapture(e.pointerId);let t={y:e.clientY,timer:0,held:!1,armed:!1,started:null};(r.phase===`idle`||r.phase===`error`)&&(t.timer=window.setTimeout(()=>{t.held=!0,t.started=n.current?.start(!0)??null,c({armed:!1}),fv()},uv)),a.current=t},f=e=>{let n=a.current;if(!n?.held||!t.current.onSend)return;let r=n.y-e.clientY>dv;r!==n.armed&&(n.armed=r,c({armed:r}),fv())},p=async()=>{let e=a.current;if(a.current=null,e){if(window.clearTimeout(e.timer),o.current=e.held,!e.held)return t.current.onTap?void 0:u();c(null),await e.started,l(await n.current?.stop()??null,e.armed)}},m=async()=>{let e=a.current;a.current=null,e&&(window.clearTimeout(e.timer),e.held&&(c(null),await e.started,n.current?.cancel()))},g=r.phase===`recording`?B(s?`voice.release`:`voice.stop`,{time:lv(r.seconds)}):r.phase===`transcribing`?B(`voice.working`):e.idle??B(`voice.say`),_=r.phase===`recording`,v=s?.armed??!1;return i===!0?(0,H.jsx)(`button`,{type:`button`,className:`${(e.look??rm)(_,v)} ${im}`,disabled:e.disabled||r.phase===`transcribing`,title:r.error??B(`voice.hint`),"aria-label":e.face?g:void 0,onPointerDown:d,onPointerMove:f,onPointerUp:()=>void p(),onPointerCancel:()=>void m(),onContextMenu:e=>e.preventDefault(),onClick:t=>{let n=o.current;if(o.current=!1,e.onTap)return n?void 0:e.onTap();t.detail===0&&u()},children:e.face?e.face({phase:r.phase,time:lv(r.seconds),seconds:r.seconds,level:r.level,held:s!==null,armed:v,partial:r.partial}):(0,H.jsxs)(H.Fragment,{children:[g,_&&(0,H.jsx)(`span`,{className:`inline-flex items-center`,"aria-hidden":`true`,children:(0,H.jsx)(`span`,{className:`size-1.5 rounded-full bg-current`,style:{opacity:.25+Math.min(1,r.level*12)*.75}})})]})}):null}function xv(e,t){I(e,void 0,t)}function Sv(){I(void 0,void 0,void 0,void 0,!0)}var Cv=`rove.web.newSession.worktree`;function wv({model:e,seed:t}){let n=t.repo;V();let r=y(e.selection).taskId,i=e.tasks.get()?.tasks.find(e=>e.id===r)?.repo,a=Zu(e,n??i,t.engine),o=X(e,`repos.list`)?.repos,s=e=>t.ungrouped?void 0:(t.machine?void 0:n)??i??e?.[0],[c,l]=(0,h.useState)(o??[]),[u,d]=(0,h.useState)(()=>X(e,`fs.subdirs`,{path:`~/`})?.home??``),[f,p]=(0,h.useState)(()=>r_(s(o),t)),[m,g]=(0,h.useState)(()=>Object.fromEntries(f.flatMap(t=>{let n=X(e,`repo.probe`,{path:t});return n?[[t,n]]:[]}))),_=(0,h.useRef)(new Set),[v,b]=(0,h.useState)(t.ungrouped===!0),[x,S]=(0,h.useState)(null),C=()=>{b(!0),p([]),S(null)},[w,T]=(0,h.useState)(()=>i_(s(o),t)),[E,D]=(0,h.useState)(``),[O,k]=(0,h.useState)(``),[A,j]=(0,h.useState)(()=>(t.prompt!==void 0&&_g(t.prompt),gg())),M=e=>{_g(e),j(e)},[N,P]=(0,h.useState)(``),[ee,I]=(0,h.useState)(!1),[te,ne]=(0,h.useState)(``),[re,ie]=(0,h.useState)(()=>t.worktree??localStorage.getItem(Cv)!==`0`),ae=e=>{localStorage.setItem(Cv,e?`1`:`0`),ie(e)},[oe,R]=(0,h.useState)(null),z=(0,h.useRef)(()=>{}),{attachments:se,attach:ce,remove:le,ready:ue,clear:de}=ou(e,R,mg),fe=(0,h.useRef)(null),pe=vv(e.client),me=lu()&&pe===!0,he=e=>{let t=fe.current,n=t?.selectionStart??A.length,r=t?.selectionEnd??A.length,i=n>0&&!/\s$/.test(A.slice(0,n))?` `:``;M(`${A.slice(0,n)}${i}${e}${A.slice(r)}`);let a=n+i.length+e.length;requestAnimationFrame(()=>{me||t?.focus(),t?.setSelectionRange(a,a)})},_e=tg(e,{machine:t.machine,repo:n},a),{machines:ve,machine:ye,remote:be,machineName:xe,remoteList:Se,engineThere:Ce,shown:we}=_e,{pick:Te,setPick:Ee,base:De,setBase:Oe}=_e,ke=be?null:Ql(e=>void ce(e)),Ae=we.engine;(0,h.useEffect)(()=>e.client.onOpen(()=>{Promise.all([Ku(e,`repos.list`),Ku(e,`fs.subdirs`,{path:`~/`})]).then(([e,n])=>{l(e.repos),d(n.home);let r=s(e.repos);p(e=>e.length>0||!r?e:r_(r,t)),T(e=>({...e,...i_(r,t)}))}).catch(()=>{})}),[e,n]);let je=f.some(e=>m[e]?.git===!1),Me=!be&&(!re||je)&&f.length===1,Ne=f[0]??``;(0,h.useEffect)(()=>{for(let t of f)_.current.has(t)||(_.current.add(t),Ku(e,`repo.probe`,{path:t}).then(e=>g(n=>({...n,[t]:e}))).catch(()=>{}))},[e,f]),(0,h.useEffect)(()=>{yv(e.client)||fe.current?.focus()},[e.client]);let Pe=!be&&!v&&!Me,Fe=vg(we,Pe),Ie=a.engines.find(e=>e.id===Ae),Le=we.engines.find(e=>e.id===Ae)?.name??Ae,Re=Ou(Ie,B(`newSession.modelDefault`)),ze=Re.some(e=>e.id===N)?N:``,Be=async t=>{ne(B(`newSession.cloning`,{source:t}));let n=await e.client.request(`repo.clone`,{url:t},ne);return l(e=>e.includes(n.path)?e:[...e,n.path]),p([n.path]),S(null),n.path},Ve=async()=>{if(!Te)return R(B(`newSession.needRepo`));if(!A.trim())return R(B(`newSession.needPrompt`));let n=we.missing?.has(Ae)&&Le;if(n)return R(B(`newSession.engineMissingOn`,{engine:n,machine:xe}));I(!0),ne(Te.clone?B(`newSession.cloningOn`,{source:rh(Te.ref),machine:xe}):B(`newSession.startingOn`,{machine:xe}));try{let n=await cg(e,{pick:Te,machine:ye,engine:Ae,prompt:A.trim(),baseRef:De,engineThere:Ce,model:ze});_g(``),F.set(null),n&&e.selectWhenListed(n),t.retryOf&&n&&c_(e,t.retryOf)}catch(e){R(ug(e))}finally{I(!1),ne(``)}},He=async n=>{if(z.current=()=>void He(n),R(null),be)return Ve();if(!Ne&&!v&&!x)return R(B(`newSession.needRepo`));if(!A.trim())return R(B(`newSession.needPrompt`));I(!0);let r=tu(A.trim(),await ue());try{let i=x?[await Be(x)]:f,a=await Promise.all(i.map(t=>e.client.request(`repo.probe`,{path:t}))),o=a.find(e=>!e.ok);if(o)throw Error(o.reason??o.repo);let s=a.some(e=>e.git===!1);if(s&&a.length>1)throw Error(B(`newSession.plainMulti`));let c,l;if(v)c=await Lu(e.client.request.bind(e.client),Ae,A,ze);else if(i.length===1&&!re||s)c=await Ru(e.client.request.bind(e.client),a[0]?.repo??i[0]??``,Ae,A,r,n,ze);else{let o=o_(t,Ae),s=_e.auto&&!n&&i.length===1&&Fe.ids.length<=1&&se.length===0&&!o,u=await e.client.request(`task.spawn`,{...Iu({repos:i.map((e,t)=>({repo:a[t]?.repo??e,baseRef:w[e]??``})),branch:E.trim(),engine:Ae,commandFrom:o,engines:n?[]:Fe.ids,prompt:r,...n?{at:n}:{},model:ze}),...s?{machine:qh}:{}});u.machine&&L(B(`newSession.startedOn`,{machine:u.machine})),c=u.taskIds[0],l=u.groupId}n&&L(B(`newSession.laterSet`,{time:Tg(n)})),_g(``),de(),F.set(null),l?ge(l):c&&e.selectWhenListed(c),t.retryOf&&c&&c_(e,t.retryOf)}catch(e){let t=Mu(e);t?(_g(``),de(),F.set(null),L(e instanceof Error?e.message:String(e),`error`),ge(t)):R(ug(e))}finally{I(!1),ne(``)}},Ue=b_({value:A,onChange:M,area:fe,onEnter:()=>void He()}),We=e=>{_e.switchTo(e,Ne),k(``),R(null),b(!1)};return(0,H.jsxs)(`div`,{className:Hp,children:[(0,H.jsxs)(`div`,{className:Up,children:[(0,H.jsx)($g,{}),(0,H.jsx)(`h1`,{className:`m-0 font-sans text-title font-semibold text-accent`,children:B(`newSession.title`)}),(0,H.jsx)(`p`,{className:`m-0 text-muted narrow:hidden`,children:B(`newSession.tagline`)})]}),(0,H.jsxs)(`form`,{className:Wp,onSubmit:e=>{e.preventDefault(),He()},children:[(0,H.jsxs)(`div`,{className:Kp,...ke?.drop,children:[!be&&(0,H.jsx)(su,{attachments:se,onRemove:le}),(0,H.jsx)(`textarea`,{ref:fe,className:Jp,rows:4,spellCheck:!1,placeholder:B(`newSession.placeholder`),value:A,disabled:ee,onPaste:ke?.onPaste,...Ue.field}),Ue.list,(0,H.jsxs)(`div`,{className:qp,children:[ke&&(0,H.jsxs)($l,{className:(me?M_:Qp)(se.length>0),title:B(`newSession.attachHint`),disabled:ee,onFiles:ce,children:[(0,H.jsx)(`span`,{className:`sr-only`,children:B(`newSession.attach`)}),(0,H.jsx)(R_,{})]}),(0,H.jsx)(bv,{client:e.client,context:()=>({draft:[A.slice(-300),Ne,E,Te?.ref??``].filter(Boolean).join(`
44
- `)}),onText:he,disabled:ee,look:me?P_:Qp,idle:me?B(`voice.hold`):void 0,face:e=>(0,H.jsx)(Y_,{state:e,hold:me,idle:B(`voice.hold`),working:B(`voice.working`)})}),!me&&(0,H.jsx)(`span`,{className:`flex-1`}),me&&(0,H.jsx)(z_,{label:B(`newSession.start`),disabled:ee}),!me&&(0,H.jsx)(`button`,{type:`submit`,className:xr(),disabled:ee,children:B(`newSession.start`)})]})]}),(0,H.jsxs)(`div`,{className:Yp,children:[(0,H.jsxs)(`div`,{className:Xp,children:[ve.length>0&&(0,H.jsx)(ag,{machines:ve,value:_e.auto?`auto`:ye,onPick:We}),(0,H.jsx)(Qm,{field:`repo`,title:!be&&f.length>1?B(`newSession.repoCount`,{count:f.length}):B(`newSession.repo`),label:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(bm,{}),(0,H.jsx)(`span`,{className:pm,children:(be?Te?.clone?rh(Te.ref):Nu(Te?[Te.ref]:[]):x?rh(x):Nu(f))||B(v?`newSession.noFolder`:`newSession.repo`)})]}),children:t=>(0,H.jsx)(t_,{model:e,saved:be?Se.repos.map(ih):c,picked:be?Te?[Te.ref]:[]:f,primary:be?``:Ne,home:be?``:u,query:O,onQuery:k,onToggle:(e,n)=>{if(R(null),!be)return b(!1),S(null),n?p(t=>Pu(t,e)):(p([e]),t());Ee({ref:e,clone:!1}),t()},onClone:e=>{if(R(null),be)return Ee({ref:e,clone:!0});S(e),p([]),b(!1),k(``)},cloning:be?void 0:x??void 0,close:t,remote:be?{name:xe,empty:rg(ye,Se),blocked:Se.problem!==``}:void 0,ungrouped:be?void 0:{on:v,pick:C}})}),(0,H.jsx)(fg,{remote:be,remotePick:Te,remoteBase:De,onRemoteBase:Oe,ungrouped:v,inPlace:Me,plain:je,onToggleWorktree:()=>ae(!re),repos:f,probes:m,bases:w,onBase:(e,t)=>T(n=>({...n,[e]:t})),branchName:E,onBranchName:D})]}),(0,H.jsxs)(`div`,{className:Zp,children:[(0,H.jsx)(yg,{choice:we,picks:Fe,available:Pe,missing:we.missing}),!(be&&Ce)&&!Fe.comparing&&Re.length>0&&(0,H.jsx)(bg,{models:Re,model:ze,onModel:P}),(0,H.jsx)(Dg,{busy:ee,onLater:!be&&!v&&!Fe.comparing?e=>void He(e):void 0,onInvalid:R,agentPlace:be?{machine:xe,there:Ce,onPick:_e.setEngineThere}:void 0})]})]}),(0,H.jsx)(lg,{progress:ee?te:``,error:oe,busy:ee,onRetry:()=>z.current()})]})]})}var Tv=[`needs`,`working`,`ready`,`idle`],Ev=`~state:`;function Dv(e){switch(e.rowStatus?.kind){case`attention`:case`needs-input`:case`unseen`:return`needs`;case`busy`:case`running`:return`working`}switch(e.group){case`waiting-on-you`:return`needs`;case`working`:return`working`;case`landing`:case`ready-for-review`:return`ready`}return e.pr?.lifecycle===`open`||e.status===`done`?`ready`:`idle`}var Ov=e=>e&&e.kind!==`main`&&!Ad(e)?dd(e.repo):void 0;function kv(e,t){let n=jd(e,t.sort),{children:r,nested:i}=Id([{repo:``,label:``,tasks:n}]),a=n.filter(e=>!i.has(e.id)),o=vd(a),s=e=>{let t=[],n=new Set,i=e=>{if(!n.has(e.id)){n.add(e.id),t.push(e);for(let t of r.get(e.id)??[])i(t)}};return i(e),t},c=new Map;for(let e of a){let t=_d(e),n=((t===null?void 0:o.get(t))??[e]).map(s),r=n.flat().map(Dv).reduce((e,t)=>Tv.indexOf(t)<Tv.indexOf(e)?t:e);for(let e of n)for(let t of e)c.set(t.id,r)}return Tv.flatMap(e=>{let t=n.filter(t=>c.get(t.id)===e);return t.length===0?[]:[{repo:``,label:B(`rail.state.${e}`),key:`${Ev}${e}`,tasks:t}]})}function Av(e){let t=new Set(e.machines.map(e=>e.alias));return{rows:jv(zd(kv([...e.tasks.filter(e=>!e.routine),...e.remote.filter(e=>!e.routine&&e.machine!==void 0&&t.has(e.machine.id))],e),e.query,e.fold).map(e=>{if(e.kind!==`project`)return e;let t=e.id.slice(`project:${Ev}`.length);return{id:`state:${t}`,kind:`state`,state:t,label:e.label,count:0}})),groups:[]}}function jv(e){let t=new Map,n=``;for(let r of e)r.kind===`state`?n=r.id:r.kind===`task`&&t.set(n,(t.get(n)??0)+1);return e.map(e=>e.kind===`state`?{...e,count:t.get(e.id)??0}:e)}var Mv=new Set([`refused`,`timeout`,`host-key-changed`,`host-key-unverified`,`auth-denied`,`unresolved`,`ssh-failed`,`no-rove`,`no-daemon`,`bad-status`,`handshake`,`no-forwarding`,`lost`]);function Nv(e){return e&&Mv.has(e)?`machines.reason.${e}`:null}function Pv(e,t){return e.filter(e=>e.machine?.id===t&&!e.routine&&!e.deleting)}function Fv(e){let t=Tv.map(e=>({state:e,tasks:[]}));for(let n of e)t[Tv.indexOf(Dv(n))]?.tasks.push(n);return t.filter(e=>e.tasks.length>0)}var Iv=`flex flex-col font-mono text-meta`,Lv=`flex flex-col gap-1 border-t-hairline border-line py-2.5 first:border-t-0 first:pt-0`,Rv=`flex flex-wrap items-baseline gap-x-2.5 gap-y-0.5`,zv=`min-w-0 text-ink wrap-anywhere`,Bv=`m-0 text-muted wrap-anywhere`,Vv=`flex flex-wrap gap-x-3.5 gap-y-1 pt-0.5 whitespace-nowrap`,Hv=`mt-1.5 mb-0.5 text-subtle`,Uv=`flex min-w-0 items-baseline gap-2 pl-2`,Wv=`min-w-0 flex-1 truncate text-left`,Gv=`min-w-0 max-w-[55%] flex-none truncate text-muted`;function Kv(e){C.set((0,H.jsx)(Xv,{model:e}))}function qv({model:e,tasks:t}){let n=t=>{z(),e.select(t.id),pe()};return Fv(t).map(e=>(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`${Hv} m-0`,children:B(`rail.state.${e.state}`)}),e.tasks.map(e=>(0,H.jsxs)(U,{variant:`row`,className:`${Uv} w-full rounded-sm py-0.5 hover:bg-hover`,onClick:()=>n(e),children:[(0,H.jsx)(`span`,{className:Wv,children:e.label}),(0,H.jsx)(`span`,{className:Gv,children:e.branch})]},e.id))]},e.state))}function Jv({model:e,alias:t}){let[n,r]=(0,h.useState)(null);return(0,h.useEffect)(()=>{let n=!0;return Ku(e,`machines.repos`,{machine:t}).then(e=>n&&r(e),e=>n&&r({failed:e instanceof Error?e.message:String(e)})),()=>{n=!1}},[e,t]),n?`failed`in n?(0,H.jsx)(`p`,{className:Bv,children:B(`machines.reposFailed`,{message:n.failed})}):n.reason?(0,H.jsx)(`p`,{className:Bv,children:B(`machines.reposFailed`,{message:n.message??n.reason})}):n.repos.length===0?(0,H.jsx)(`p`,{className:Bv,children:B(`machines.noRepos`)}):n.repos.map(e=>(0,H.jsxs)(`div`,{className:Uv,children:[(0,H.jsx)(`span`,{className:Wv,children:e.id}),(0,H.jsx)(`span`,{className:Gv,title:e.primary??e.checkouts[0],children:e.primary??e.checkouts[0]??``})]},e.id)):(0,H.jsx)(`p`,{className:Bv,children:B(`machines.loading`)})}function Yv(e){let{model:t,row:n,tasks:r,words:i}=e,[a,o]=(0,h.useState)(null),s=n.state===`online`,c=Nv(n.reason),l=Fv(r).map(e=>`${e.tasks.length} ${B(`rail.state.${e.state}`)}`),u=e=>o(a===e?null:e),[d,f]=(0,h.useState)({busy:!1});return(0,H.jsxs)(`section`,{className:Lv,children:[(0,H.jsxs)(`div`,{className:Rv,children:[(0,H.jsx)(`span`,{className:`${zv} ${s?``:lp.warning}`,children:Km(n,i)}),(0,H.jsx)(`span`,{className:`text-muted`,children:l.length>0?l.join(` · `):B(`machines.noTasks`)})]}),c&&(0,H.jsx)(`p`,{className:`m-0 text-muted wrap-anywhere`,children:B(c)}),(d.busy||d.note)&&(0,H.jsx)(`p`,{className:`m-0 text-muted wrap-anywhere`,children:d.busy?B(`machines.updating`):d.note}),(0,H.jsxs)(`div`,{className:Vv,children:[n.behind&&(0,H.jsx)(U,{hit:`tight`,disabled:d.busy,onClick:()=>{f({busy:!0}),t.client.request(`machines.update`,{machine:n.alias}).then(e=>f({busy:!1,note:e.ok?B(e.result.changed?`machines.updated`:`machines.upToDate`,{from:e.result.from??`?`,to:e.result.to??`?`}):B(`machines.updateFailed`,{message:e.message})}),e=>f({busy:!1,note:B(`machines.updateFailed`,{message:e instanceof Error?e.message:String(e)})}))},children:B(`machines.update`)}),s&&(0,H.jsx)(U,{hit:`tight`,onClick:()=>{z(),xv(void 0,n.alias)},children:B(`machines.newHere`)}),r.length>0&&(0,H.jsx)(U,{hit:`tight`,"aria-expanded":a===`tasks`,onClick:()=>u(`tasks`),children:B(a===`tasks`?`machines.hide`:`machines.tasks`)}),s&&(0,H.jsx)(U,{hit:`tight`,"aria-expanded":a===`repos`,onClick:()=>u(`repos`),children:B(a===`repos`?`machines.hide`:`machines.repos`)})]}),a===`tasks`&&(0,H.jsx)(qv,{model:t,tasks:r}),a===`repos`&&(0,H.jsx)(Jv,{model:t,alias:n.alias})]})}function Xv({model:e}){let t=V(),n=Zm(e),r=y(e.remote),i=(t===`zh`?Gi:Wi).machine;return(0,H.jsx)(Si,{title:B(`machines.title`),wide:!0,children:(0,H.jsxs)(`div`,{className:`${Gr} ${Iv}`,children:[n.length===0&&(0,H.jsx)(`p`,{className:`m-0 text-muted wrap-anywhere`,children:B(`machines.none`)}),n.map(t=>(0,H.jsx)(Yv,{model:e,row:t,tasks:Pv(r,t.alias),words:i},t.alias))]})})}function Zv(e,t,n=300){let r=0,i,a=()=>{r++,i?.(),i=void 0};return{stop:a,run:o=>{a();let s=o.trim();if(s.length<2){t({kind:`idle`});return}let c=r,l=setTimeout(()=>{t({kind:`searching`}),e(s).then(e=>c===r&&t({kind:`done`,query:s,reply:e}),e=>c===r&&t({kind:`failed`,message:e instanceof Error?e.message:String(e)}))},n);i=()=>clearTimeout(l)}}}var Qv=`mx-1.5 mt-2 mb-0.5 font-mono text-meta font-semibold normal-nums text-subtle first:mt-0`,$v=`mx-1.5 my-1 text-meta text-muted [overflow-wrap:anywhere]`,ey=e=>`flex w-full min-w-0 cursor-pointer flex-col gap-0.5 rounded-sm px-1.5 py-1.5 text-left text-ink [font:inherit] touch:py-2.5 ${e?`is-selected bg-hover`:``}`,ty=`flex min-w-0 items-baseline gap-2`,ny=`min-w-0 flex-1 truncate text-body`,ry=`whitespace-nowrap text-meta text-muted`,iy=`text-meta text-muted [overflow-wrap:anywhere]`,ay=`rounded-xs bg-accent/25 text-ink`;function oy(e,t){let[n,r]=(0,h.useState)({kind:`idle`});return(0,h.useEffect)(()=>{let n=Zv(t=>e.client.request(`sessions.search`,{query:t}),r);return n.run(t),n.stop},[e,t]),n}function sy(e,t){let n=[],r=e.toLowerCase(),i=t.toLowerCase(),a=0;for(let t=r.indexOf(i);i&&t>=0;t=r.indexOf(i,t+i.length))t>a&&n.push(e.slice(a,t)),n.push({hit:e.slice(t,t+i.length),at:t}),a=t+i.length;return n.push(e.slice(a)),n.map(e=>typeof e==`string`?e:(0,H.jsx)(`mark`,{className:ay,children:e.hit},e.at))}function cy({children:e}){return(0,H.jsx)(`h3`,{className:Qv,children:e})}function ly({children:e,error:t}){return(0,H.jsx)(`p`,{className:`${$v} ${t?`text-error`:``}`,children:e})}function uy(e){return(0,H.jsx)(U,{variant:`row`,className:ey(e.selected),onMouseEnter:e.onHover,onClick:e.onOpen,children:(0,H.jsxs)(`span`,{className:ty,children:[(0,H.jsx)(`span`,{className:ny,children:e.title}),(0,H.jsx)(`span`,{className:ry,children:e.repo})]})})}function dy(e){let{hit:t}=e;return(0,H.jsxs)(U,{variant:`row`,className:ey(e.selected),onMouseEnter:e.onHover,onClick:e.onOpen,children:[(0,H.jsxs)(`span`,{className:ty,children:[(0,H.jsx)(`span`,{className:ny,children:t.title}),(0,H.jsxs)(`span`,{className:ry,children:[B(t.role===`user`?`search.you`:`search.agent`),` · `,Ml(Date.now()-Date.parse(t.at))]})]}),(0,H.jsx)(`span`,{className:iy,children:sy(t.snippet,e.query)})]})}async function fy(e,t){let{taskId:n}=await e.client.request(`task.openScratch`);await ad(e,n,{kind:`engine`,prompt:t}),z()}function py(e){return fy(e,B(`settings.feedback.reportPrompt`))}var my=v(`issues`);function hy(e,t,n){return{repo:e.repo,baseBranch:t,prompt:n,worktree:!0}}function gy(e){let t=e.todos;return!t||t.length===0?null:{done:t.filter(e=>e.done).length,total:t.length}}function _y(e){return(e.todos??[]).filter(e=>!e.done)}var vy=/LAND_CONFLICT/,yy=/MAIN_CHECKOUT_DIRTY/,by=/SYNC_CONFLICT(?:: )?(.*)/,xy=/SYNC_WORKTREE_DIRTY(?:: )?(.*)/;function Sy(e){let t=G(e);return vy.test(t)?q(`worktrees`,`land.conflict`,{files:t}):yy.test(t)?q(`worktrees`,`land.dirtyBase`):q(`worktrees`,`land.failed`,{error:t})}async function Cy(e,t,n){if(t.machine){wy(e,t,t.machine.label,n);return}let r;try{r=await e.client.request(`task.landPreflight`,{taskId:t.id})}catch(e){L(q(`worktrees`,`land.failed`,{error:G(e)}),`error`);return}if(r.refusal){L(r.refusal===`MAIN_CHECKOUT_DIRTY`?q(`worktrees`,`land.dirtyBase`):q(`worktrees`,`land.failed`,{error:r.message??r.refusal}),`error`);return}let i=t.branch||t.title,a=_y(e.tasks.get()?.tasks.find(e=>e.id===t.id)??{}).length;C.set((0,H.jsx)(Ti,{title:q(`worktrees`,`land.confirmTitle`),body:[q(`worktrees`,r.ahead===1?`land.confirmBodyOne`:`land.confirmBody`,{branch:i,landedOn:r.landedOn,commits:r.ahead??`?`}),...a>0?[B(`files.landTodos`,{count:a})]:[]].join(`
39
+ `);if(a===`scratch`){let e=await t.client.request(`task.openScratch`,O?{}:{engine:D});O?await ad(t,e.taskId,{kind:`shell`}):t.selectWhenListed(e.taskId)}else if(A){if(!r)throw Error(q(`terminal`,`tab.tabGone`));if(!l.trim())throw Error(B(`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=Mu(e);if(!t)throw e;L(e instanceof Error?e.message:String(e),`error`),ge(t);return}a.forkRefused&&L(B(`taskops.forkLeftBehind`,{reason:a.forkRefused}));let o=a.taskIds[0];a.groupId?ge(a.groupId):o&&t.selectWhenListed(o)}else if(O)await ad(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:td(D),...r?{tabId:r}:{}});await t.refreshTabsNow(n),t.select(n,i.tabId)}else await ad(t,n,{kind:`engine`,engine:D,prompt:i,...e?{replaceTab:M()}:{}})});return(0,H.jsx)(Si,{title:q(`terminal`,`tab.newChat.title`),wide:!0,children:(0,H.jsxs)(`form`,{className:Gr,onKeyDown:e=>{if(e.key===`Tab`&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&(A||!e.shiftKey))e.preventDefault(),e.stopPropagation(),A?Bu(e.currentTarget,ld,e.shiftKey?-1:1):j(cd[(cd.indexOf(a)+1)%cd.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(),j(a,s===`fresh`?`continue`:`fresh`)):e.key===`Enter`&&A&&e.target.closest(`[data-field=attempts], [data-field=engine]`)&&(e.preventDefault(),e.currentTarget.requestSubmit())},onSubmit:e=>{e.preventDefault(),ee()},onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault(),x(Array.from(e.dataTransfer.files))},children:[(0,H.jsxs)(`div`,{className:Fr,children:[(0,H.jsx)(`span`,{className:`${W} text-muted`,children:q(`terminal`,`tab.newChat.engine`)}),(0,H.jsx)(rd,{engines:i.engines,value:D,onChange:i.setEngine,withShell:w,panes:T?E:[]})]}),(0,H.jsxs)(`div`,{className:Fr,children:[(0,H.jsx)(`span`,{className:`${W} text-muted`,children:q(`terminal`,`tab.newChat.destLabel`)}),(0,H.jsx)(cu,{label:q(`terminal`,`tab.newChat.destLabel`),field:`destination`,value:a,onChange:e=>j(e,s),choices:cd.map(e=>({id:e,label:q(`terminal`,`tab.newChat.dest${e===`tab`?`Tab`:e===`fork`?`Fork`:`Scratch`}`)}))})]}),(0,H.jsxs)(`div`,{className:Fr,children:[(0,H.jsxs)(`span`,{className:`${W} text-muted`,children:[q(`terminal`,`tab.newChat.ctxLabel`),` `,(0,H.jsx)(`span`,{className:`keys-only`,children:`ctrl+f`})]}),(0,H.jsx)(cu,{label:q(`terminal`,`tab.newChat.ctxLabel`),field:`context`,value:s,onChange:e=>j(a,e===`continue`?`continue`:`fresh`),choices:[`fresh`,`continue`].map(e=>({id:e,label:q(`terminal`,`tab.newChat.ctx${e===`fresh`?`Fresh`:`Continue`}`)}))})]}),A&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:q(`quickTask`,`attemptsLabel`)}),(0,H.jsx)(cu,{label:q(`quickTask`,`attemptsLabel`),field:`attempts`,value:d,onChange:f,choices:sd.map(e=>({id:e,label:e}))})]}),(0,H.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:B(`taskops.forkBranch`)}),(0,H.jsx)(`input`,{className:Mr,"data-field":`fork-base`,spellCheck:!1,value:p,onChange:e=>m(e.target.value)})]})]}),!O&&!k&&a!==`scratch`&&(0,H.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:B(`newChat.prompt`)}),(0,H.jsx)(`textarea`,{className:`${Mr} min-h-18 max-h-[50vh] leading-[1.45]`,"data-field":`message`,autoFocus:!0,rows:4,placeholder:B(`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,H.jsx)(su,{attachments:b,onRemove:S}),lu()?(0,H.jsx)(`p`,{className:`text-muted`,children:B(`pages.attachHintTouch`)}):(0,H.jsx)(`p`,{className:`keys-only mx-0 mt-2 mb-0 ${Tr}`,children:q(`quickTask`,`legend`)}),_&&(0,H.jsx)(`p`,{className:`text-error`,children:_}),(0,H.jsx)(Di,{busy:g,submitLabel:B(`newChat.start`)})]})})}var dd=e=>e.split(`/`).filter(Boolean).pop()??e;function fd(e,t,n=``){let r=dd(e),i=t.filter(t=>(t.repo!==e||t.host!==n)&&dd(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 pd=e=>e.startsWith(`root:`)?null:e.split(`/`).slice(-2).join(`/`);function md(e,t){let n=dd(e.repo),r=t.filter(t=>t!==e&&dd(t.repo)===n);if(r.length===0)return n;let i=e.repoId,a=i?pd(i):null;return i&&a?r.some(e=>e.repoId&&e.repoId!==i&&pd(e.repoId)===a)?i:a:fd(e.repo,[e,...r].map(e=>({repo:e.repo,host:``})))}var hd=/\s+#\d+\/\d+$/,gd=(e,t)=>(e.createdAt??``).localeCompare(t.createdAt??``)||e.id.localeCompare(t.id),_d=e=>e.groupId?`${e.machine?.id??``}\0${e.groupId}`:null;function vd(e){let t=new Map;for(let n of e){let e=_d(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(gd);return t}function yd(e){return(e[0]?.label??``).replace(hd,``)}function bd(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 Z=[`default`,`recent`,`attention`,`name`],xd={folded:new Set,opened:new Set},Sd=e=>{let t=Date.parse(e??``);return Number.isFinite(t)?t:0},Cd=e=>Sd(e.updatedAt??e.createdAt),wd=e=>Sd(e.createdAt),Td=(e,t)=>wd(t)-wd(e)||t.id.localeCompare(e.id),Ed=(e,t)=>Cd(t)-Cd(e)||t.id.localeCompare(e.id),Dd=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`}),Od={default:null,recent:Td,attention:(e,t)=>e.rank-t.rank||Ed(e,t),name:(e,t)=>Dd.compare(e.label.trim(),t.label.trim())||e.id.localeCompare(t.id)},kd=`~scratch`,Ad=e=>e.kind===`dir`&&(e.scratch===!0||e.noProject===!0);function jd(e,t){return[...e].sort((e,t)=>(e.order??e.rank)-(t.order??t.rank)).sort(Pd(Od[t]))}function Md(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=Ad(e)?kd:e.repo,n=r.get(t);n?n.push(e):r.set(t,[e])}let i=Od[t],a=[...r].map(([e,t])=>{let n=t.sort(Pd(i));if(e===`~scratch`&&t.every(Ad))return{repo:``,label:B(`rail.noProject`),tasks:n,key:kd,noProject:!0};let r=t.find(e=>e.repoId)?.repoId;return{repo:e,label:dd(e),tasks:n,...r?{repoId:r}:{}}});return[...a.filter(e=>e.noProject),...a.filter(e=>!e.noProject)]}var Nd=e=>+!e.pinned,Pd=e=>(t,n)=>Nd(t)-Nd(n)||(e?e(t,n):0);function Fd(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 Id(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)||Fd(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 Ld(e,t,n=[]){for(let r of e.get(t)??[])n.push(r.id),Ld(e,r.id,n);return n}function Rd(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 zd(e,t=``,n=xd,r=0,i=!0){let a=t.trim(),o=(...e)=>e.some(e=>e!==``&&$c(a,e)),{children:s,nested:c}=Id(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,dd(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?Ld(s,t.id):[],m=u!==void 0&&a===``&&Rd(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?vd(t):new Map,o=new Set;for(let i of t){let t=_d(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:yd(s),tasks:s,depth:Math.min(l,3),...c.machine?{machine:c.machine.id}:{}});let u=bd(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 Bd=e=>Math.max(0,...e.tasks.map(wd));function Vd(e){let t=e.tasks.filter(e=>!e.routine),n=e.remote.filter(e=>!e.routine),r=[...Md(t,e.sort).map(e=>({group:e})),...e.machines.flatMap(t=>Md(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?kd:t??(e.machine===void 0?n:`${e.machine}\0${n}`),a=i.get(r);a?a.push(e):i.set(r,[e])}let a=Od[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(Pd(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:md(e,s)])),l=s.map(e=>({...e,label:c.get(e)??e.label}));return e.sort===`recent`&&l.sort((e,t)=>Bd(t)-Bd(e)),e.sort===`name`&&l.sort((e,t)=>Dd.compare(e.label,t.label)),l.sort((e,t)=>Number(t.noProject===!0)-Number(e.noProject===!0)),{rows:zd(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 Hd(e){return e.title??e.engineName??(e.kind===`engine`?B(`tab.engine`):B(`tab.shell`))}function Ud(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 Wd(e){return e.kind===`leaf`?[e]:e.children.flatMap(Wd)}function Gd(e){return!!e&&Wd(e.root).length>1}function Kd(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 qd(e,t,n=1){let r=Wd(e.root).map(e=>e.id),i=r.indexOf(t);return r[(Math.max(0,i)+n+r.length)%r.length]??t}function Jd(e,t){let n=new Map,r=new Map;for(let i of Wd(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 Yd(e,t,n){return e.kind===`engine`&&Wd(t.root).some(e=>e.id===n&&e.own)}function Xd(e){return e.alive!==!1||!!e.split&&!Wd(e.split.root).some(e=>e.own)}function Zd(e){return Wd(e.root).map(e=>e.id).join(`,`)}function Qd(e){return!(e instanceof HTMLElement)||e.closest(`.xterm`)?!1:e.isContentEditable||[`INPUT`,`TEXTAREA`,`SELECT`].includes(e.tagName)}function $d(e){return e instanceof HTMLElement&&!!e.closest(`.rail, button, a`)}var ef=e=>e.tabs.get()[e.selection.get().taskId??``]??[];function tf(e){let{taskId:t,tabId:n}=e.selection.get(),r=ef(e);return{taskId:t,tabs:r,at:r.findIndex(e=>e.id===n)}}function nf(e,t){let{taskId:n,tabs:r}=tf(e),i=r[t];!n||!i||e.select(n,i.id)}function rf(e){let{taskId:t,tabs:n,at:r}=tf(e),i=n[r];!t||!i||C.set((0,H.jsx)(wi,{title:B(`menu.renameTab`),initial:Hd(i),submitLabel:B(`dialog.save`),onSubmit:async n=>{await e.renameTab(t,i.id,n)}}))}var af=e=>!!e.selection.get().taskId,of=e=>ef(e).length>0,sf=[{id:`help.open`,chords:[`f1`],prefix:!1,run:kl},{id:`focus.next`,chords:[`f4`],prefix:!1,run:()=>xo(1)},{id:`chat.tab.chooseEngine`,chords:[`ctrl+e`],prefix:!1,surface:`workspace`,live:af,run:e=>{let{taskId:t}=e.selection.get();t&&C.set((0,H.jsx)(ud,{model:e,taskId:t}))}},{id:`chat.tab.rename`,chords:[`f2`],prefix:!1,surface:`workspace`,live:e=>{let{tabs:t,at:n}=tf(e);return!!t[n]&&!Gd(t[n]?.split)},run:rf},{id:`chat.tab.cycle-next`,chords:[`ctrl+]`],prefix:!1,surface:`workspace`,live:of,run:e=>nf(e,(tf(e).at+1)%ef(e).length)},{id:`chat.tab.cycle-prev`,chords:[`ctrl+[`],prefix:!1,surface:`workspace`,live:of,run:e=>nf(e,(tf(e).at-1+ef(e).length)%ef(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:of,run:(e,t=``)=>{let n=To().find(e=>e.id===`chat.tab.goto`&&!e.prefix)?.chords.indexOf(t)??-1;n>=0&&nf(e,n)}},{id:`attention.next`,chords:[`f7`],prefix:!1,run:e=>lf(e)}];Co(()=>sf);function cf(e){(0,h.useEffect)(()=>{let t=t=>{if(C.get()||Qd(t.target))return;let n=O.get();if(n===`worktrees`)return;let r=Oo()??(af(e)?`workspace`:`sidebar`),{taskId:i}=e.selection.get();if(!n&&i&&!t.ctrlKey&&!t.shiftKey&&!t.metaKey&&!t.altKey&&t.key===`Enter`&&!of(e)&&!$d(t.target)){t.preventDefault(),t.stopPropagation(),C.set((0,H.jsx)(ud,{model:e,taskId:i}));return}let a=qc(t),o=To().filter(t=>!t.prefix&&!t.native&&t.chords.some(e=>a.includes(e))&&Eo(t,r)&&!(n&&t.surface)&&t.live?.(e)!==!1).sort((e,t)=>Do(e,r)-Do(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 lf(e){let t=e.tasks.get();if(!t)return;let n=Il(t.attention,t.tasks.map(e=>e.id),e.selection.get());if(!n){L(B(`inbox.empty`));return}if(Nl(n.state)){Rl(e,n);return}n.taskId!==null&&(e.select(n.taskId,n.tabId),Y(e,n))}async function uf(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){L(B(`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){L(G(e),`error`)}}function df(e){(0,h.useEffect)(()=>{let t=t=>{let n=da.get().plugins;if(n.length===0||!wa({dialog:C.get()!==null,page:O.get()})||Qd(t.target))return;let r=Ca(n,qc(t));r&&(t.preventDefault(),t.stopImmediatePropagation(),uf(e,r))};return window.addEventListener(`keydown`,t,{capture:!0}),()=>window.removeEventListener(`keydown`,t,{capture:!0})},[e])}var ff=`prefix.moreCommands`,pf=/^ctrl\+[^+]+$/;function mf(e){return pf.test(e)?e.slice(5):null}function hf(e){let t=Qc(e.bindingId);if(!t)return null;if(e.reachability.direct.has(e.bindingId)){let e=t.keys[0];if(e)return la(e)}if(e.prefixKey&&e.reachability.prefix.has(e.bindingId)){let n=t.prefixKeys?.[0];if(n)return`${la(e.prefixKey)} ${la(n)}`}return null}function gf(e,t){let n=aa.filter(t=>e.direct.has(t.id)).flatMap(e=>{let t=e.keys.flatMap(e=>mf(e)??[]);return t.length>2?[{stroke:`${t[0]}-${t.at(-1)}`,action:e.id}]:t.map(t=>({stroke:t,action:e.id}))}),r=t?mf(t):null;return r&&e.prefix.size>0&&n.push({stroke:r,action:ff}),n}var _f=4e3,vf=180,yf=_f,bf=v({guide:null,entries:[]}),xf=1;function Sf(e,t){let n={id:xf++,stroke:e,action:t,at:Date.now()};bf.set({guide:null,entries:[...bf.get().entries,n].slice(-3)})}var Cf=`modulepreload`,wf=function(e){return`/`+e},Tf={},Ef=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=wf(t,n),t=s(t),t in Tf)return;Tf[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`:Cf,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)})},Df=8,Of=32,kf=3e3,Af=100,jf=new WeakMap,Mf=null;function Nf(e){let t=jf.get(e);return t||(t={entries:new Map,snapshots:new Map,left:null},jf.set(e,t)),t}function Pf(){return Mf||(Mf=document.createElement(`div`),Mf.style.display=`none`,document.body.append(Mf)),Mf}function Ff(e,t,n){e.snapshots.delete(t),e.snapshots.set(t,n);for(let t of e.snapshots.keys()){if(e.snapshots.size<=Of)break;e.snapshots.delete(t)}}function If(e,t,n){e.entries.delete(t.key),t.leaving!==null&&window.clearTimeout(t.leaving),t.leaving=null,n?Ff(e,t.key,t.handle.snapshot()):e.snapshots.delete(t.key),t.handle.dispose(),t.box.remove()}function Lf(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-Df)))If(e,n,!0)}function Rf(e,t){return Nf(e).entries.get(t)?.handle??null}function zf(e,t,n,r){return Nf(e).entries.get(qu(t,n,r))?.slot.parkedAt!=null}async function Bf(e,t){let n=Nf(e.client),r=qu(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,Wf(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:()=>Vf(n,i)}}let a=document.createElement(`div`);a.className=Pn,e.host.append(a),Hf(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 Ef(async()=>{let{mountTerminal:e}=await import(`./term-mount-CEw0hxaB.js`);return{mountTerminal:e}},__vite__mapDeps([0,1])),d=u({...e,el:a,snapshot:l,onPainted:()=>Wf(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&&If(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:()=>Vf(n,f)}}function Vf(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(),Pf().append(t.box),e.left=t,Lf(e))}function Hf(e,t){let n=e.left;e.left=null,!(!n||n.slot.parkedAt===null||performance.now()-n.slot.parkedAt>Af)&&e.entries.get(n.key)===n&&(n.box.classList.add(`is-leaving`),t.append(n.box),n.leaving=window.setTimeout(()=>Uf(e,n),kf))}function Uf(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&&Pf().append(t.box))}function Wf(e){for(let t of e.entries.values())Uf(e,t)}async function Gf(e,t,n){return Ll(await e.request(`output.read`,{taskId:t,tab:n,source:`terminal`,limit:12}))}async function Kf(e,t,n,r){try{let i=await e.client.request(`tab.send`,{taskId:t,tabId:n,prompt:r});return i.delivered?!0:(L(B(`layout.composerNotSent`,{reason:i.reason??``}),`error`),!1)}catch(e){let t=e instanceof Uo?e.code:void 0;return L(t===`UNKNOWN_OP`?B(`layout.composerOldBridge`):t===`AWAITING_PERMISSION`?B(`layout.composerAtMenu`):e instanceof Error?e.message:String(e),`error`),!1}}async function qf(e,t,n,r){let{client:i}=e,a=qu(t,n),o=Po(a)!==void 0||zf(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 L(e instanceof Error?e.message:String(e),`error`),!1}finally{o||await i.request(`term.detach`,{stream:a}).catch(()=>{})}}async function Jf(e,t,n){try{return(await e.client.request(`gate.answer`,{gateId:t,...n})).delivered||L(B(`inbox.gateKept`)),!0}catch(e){return L(e instanceof Error?e.message:String(e),`error`),!1}}var Yf=(e,t,n)=>({id:e,cap:t,bytes:e=>`\x1b${e?`O`:`[`}${n}`}),Xf={id:`enter`,cap:`⏎`,bytes:()=>`\r`},Zf=[{id:`esc`,cap:`esc`,bytes:()=>`\x1B`},{id:`tab`,cap:`tab`,bytes:()=>` `},{id:`backtab`,cap:`⇧tab`,bytes:()=>`\x1B[Z`},{id:`interrupt`,cap:`^C`,bytes:()=>``},Yf(`up`,`↑`,`A`),Yf(`down`,`↓`,`B`),Yf(`left`,`←`,`D`),Yf(`right`,`→`,`C`),Xf],Qf=e=>({id:`option-${e}`,cap:String(e),bytes:()=>String(e)}),$f=[Qf(1),Qf(2),Qf(3),Qf(4),Xf];function ep(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 tp=`\x1B[27;2;13~`;function np(e){return e.key!==`Enter`||!e.shiftKey||e.ctrlKey||e.metaKey||e.altKey?!1:!e.isComposing&&e.keyCode!==229}function rp(e){return e.type!==`keydown`||e.key.toLowerCase()!==`c`||e.altKey?null:e.metaKey||e.ctrlKey&&e.shiftKey?`copy`:e.ctrlKey?`interrupt-or-copy`:null}var ip=`mx-2.5 mt-0.5 mb-1.5 flex min-w-0 flex-col gap-1.5 font-mono text-meta`,ap=2e3;function op(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 Gf(e.client,t,n);r&&i(a)}catch{r&&i(e=>e??[])}r&&(a=window.setTimeout(o,ap))};return o(),()=>{r=!1,window.clearTimeout(a)}},[e,t,n,a]),{lines:r,refresh:()=>o(e=>e+1)}}function sp(e){V();let{model:t,taskId:n,tabId:r,mode:i,gate:a}=e,{lines:o,refresh:s}=op(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?Jf(t,a.id,{text:e}):r?Kf(t,n,r,e):Promise.resolve(!1))&&u(``)};return(0,H.jsxs)(`div`,{className:ip,children:[a&&(0,H.jsx)(`p`,{className:`m-0 whitespace-pre-wrap wrap-anywhere text-ink`,children:a.question}),r&&(0,H.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?B(`inbox.noOutput`):o.join(`
40
+ `)}),i===`gate`&&a&&(0,H.jsx)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:a.options.map(e=>(0,H.jsxs)(U,{disabled:d,title:e.detail,onClick:()=>void p(()=>Jf(t,a.id,{option:e.key})),children:[`[ `,e.key===a.recommended?`★ `:``,e.label,` ]`]},e.key))}),i===`menu`&&r&&(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[$f.map(e=>(0,H.jsxs)(U,{disabled:d,onClick:()=>void p(()=>qf(t,n,r,e.bytes(!1))),children:[`[ `,e.cap,` ]`]},e.id)),(0,H.jsx)(U,{onClick:e.onOpenTab,children:B(`inbox.openTab`)})]}),(i===`reply`||i===`gate`)&&(0,H.jsxs)(`form`,{className:`flex min-w-0 items-center gap-2`,onSubmit:e=>{e.preventDefault(),m()},children:[(0,H.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:B(`inbox.replyPlaceholder`),"aria-label":B(`inbox.replyPlaceholder`),autoComplete:`off`,enterKeyHint:`send`,onChange:e=>u(e.target.value)}),(0,H.jsx)(U,{type:`submit`,disabled:d||l.trim()===``,children:B(`inbox.send`)})]})]})}function cp({text:e}){return(0,H.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,H.jsx)(`span`,{children:e},e))})}var lp={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`},up={accent:`text-accent`,muted:`text-subtle`,attention:`text-error`,warning:`text-warning`,success:`text-success`,info:`text-accent`,ink:`text-ink`},dp=6;function fp(e,t){return e?`${e.repo.split(`/`).filter(Boolean).pop()??e.repo} › ${e.label}`:t}function pp({model:e}){V();let t=y(e.tasks),n=y(e.visits),r=y(e.tabs),[i,a]=(0,h.useState)(0),[o,s]=(0,h.useState)(null),[c,l]=(0,h.useState)(Date.now());(0,h.useEffect)(()=>{let e=window.setInterval(()=>l(Date.now()),3e4);return()=>window.clearInterval(e)},[]);let u=new Map((t?.tasks??[]).map(e=>[e.id,e])),d=(e,t)=>e&&t&&r[e]?.find(e=>e.id===t)?.title||``,f=Fl(t?.attention??[],t?.tasks.map(e=>e.id)??[]).map((e,t)=>{let n=e.taskId?u.get(e.taskId):void 0;return{key:`a${t}:${e.taskId}:${e.tabId}`,section:`attention`,taskId:e.taskId,tabId:e.tabId,identity:fp(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,dp).map(e=>({key:`r:${e.taskId}:${e.tabId}`,section:`recent`,taskId:e.taskId,tabId:e.tabId,identity:fp(u.get(e.taskId),e.taskId),subtitle:d(e.taskId,e.tabId)||u.get(e.taskId)?.branch||``,at:e.at})),g=[...f,...m],_=g[Math.min(i,g.length-1)],v=t=>{if(t.attention&&Nl(t.attention.state))return Rl(e,t.attention);t.attention&&Y(e,t.attention),t.taskId&&u.has(t.taskId)&&(e.select(t.taskId,t.tabId),z())},b=()=>void Promise.all(f.map(t=>t.attention&&Y(e,t.attention,!0)));(0,h.useEffect)(()=>{let t=t=>{if(!(t.target instanceof HTMLElement&&t.target.closest(`input, textarea`))){if(t.key===`ArrowDown`||t.key===`j`)a(e=>Math.min(g.length-1,e+1));else if(t.key===`ArrowUp`||t.key===`k`)a(e=>Math.max(0,e-1));else if(t.key===`Enter`&&_)v(_);else if(t.key===`d`&&_?.attention)Y(e,_.attention,!0);else if(t.key===`D`)b();else return;t.preventDefault()}};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)});let x=n=>{let r=n.attention?jl(n.attention.state):null,i=n===_,l=n.attention,d=n.taskId?u.get(n.taskId):void 0,f=l?.gateId?t?.gates?.find(e=>e.id===l.gateId&&e.status===`open`):void 0,p=n.tabId??f?.tabId??null,m=!!l&&!!d&&!d.machine&&!Nl(l.state)&&(!l.gateId||!!f)&&(!!p||!!f),h=l?.state===`permission_needed`||!!p&&d?.tabStatus?.[p]?.kind===`needs-input`,y=f?`gate`:l?.state===`dead`?`readonly`:h?`menu`:`reply`,b=`${n.taskId}:${n.tabId}:${l?.gateId??``}`,x=m&&o===b;return(0,H.jsxs)(`li`,{children:[(0,H.jsxs)(`div`,{className:li,children:[(0,H.jsxs)(`button`,{type:`button`,className:`${hi({selected:i,stack:!0})} ${ui}`,onMouseEnter:()=>a(g.indexOf(n)),onClick:()=>v(n),children:[(0,H.jsxs)(`span`,{className:si,children:[(0,H.jsx)(`span`,{className:gi,children:n.identity}),r&&(0,H.jsxs)(`span`,{className:`flex-none font-mono text-meta font-normal normal-nums ${up[r.tone]}`,children:[r.glyph,` `,B(r.stateKey)]}),(0,H.jsx)(`span`,{className:ci,children:Ml(c-n.at)})]}),n.subtitle&&(0,H.jsx)(`span`,{className:`truncate font-mono text-meta font-normal normal-nums text-muted`,children:n.subtitle})]}),m?(0,H.jsx)(U,{className:di,"aria-expanded":x,onClick:()=>{a(g.indexOf(n)),s(x?null:b)},children:B(x?`inbox.hide`:`inbox.reply`)}):(0,H.jsx)(`span`,{"aria-hidden":!0,className:di})]}),x&&n.taskId&&(0,H.jsx)(sp,{model:e,taskId:n.taskId,tabId:p,mode:y,gate:f,onOpenTab:()=>v(n)})]},n.key)};return(0,H.jsx)(Si,{title:B(`inbox.title`),wide:!0,children:(0,H.jsxs)(`div`,{className:Gr,children:[(0,H.jsxs)(`div`,{className:ii,children:[(0,H.jsx)(`p`,{className:`${W} text-muted ${ri} touch:hidden!`,children:(0,H.jsx)(cp,{text:B(`inbox.hints`)})}),f.length>0&&(0,H.jsx)(U,{className:`flex-none min-w-[calc(9ch+0.5rem)] whitespace-nowrap pr-2 text-right font-mono text-meta`,onClick:b,children:B(`inbox.ackAll`)})]}),(0,H.jsx)(`h2`,{className:`${W} text-muted ${ai}`,children:B(`inbox.attention`)}),f.length===0?(0,H.jsx)(`p`,{className:`mono text-muted`,children:B(`inbox.empty`)}):(0,H.jsx)(`ul`,{className:oi,children:f.map(x)}),m.length>0&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`h2`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted mt-1`,children:B(`inbox.recent`)}),(0,H.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-0.5 p-0`,children:m.map(x)})]})]})})}var mp=`rove.prefs`,hp={locale:`en`,theme:`claude`,themeMode:`dark`,transparent:!0,focusAccent:`primary`,splitStyle:`line`,railFold:`glyphs`,workingBorder:`flow`,taskColors:`on`,glyphSet:`braille`,colorblind:`off`,runningTitle:`shimmer`,statusMark:`both`,statusMarkNoticeSeen:!0,railSort:`recent`,railGroup:`project`,toast:!0,sound:!0,soundVolume:.4,crossTask:!0,finishedAlerts:!0,keyHints:!0,zen:!0,editorKind:`auto`,worktreeBase:`default`,scrollbackRows:1e3,tabStrip:`never`,prefixTap:`local`,remoteProjects:!1,autoStatus:!1,dispatcher:!1,updateChannel:`latest`,updateNotify:!0};function gp(){try{let e=JSON.parse(localStorage.getItem(mp)??`null`);if(e&&typeof e==`object`&&`prefs`in e&&`themes`in e){let t=e;return{...t,prefs:{...hp,...t.prefs},loaded:!0}}}catch{}return{loaded:!1,prefs:hp,options:{},info:{editorCustomSet:!1,worktreeCustomPath:``},themes:[],glyphSets:{}}}var _p=v(gp());function vp(e){(e.locale===`en`||e.locale===`zh`)&&At.set(e.locale)}vp(_p.get().prefs);function yp(e){let t={loaded:!0,prefs:e.prefs,options:e.options,info:e.info,themes:e.themes,glyphSets:e.glyphSets};_p.set(t),vp(t.prefs),localStorage.setItem(mp,JSON.stringify(t))}var bp=null;async function xp(e){bp=e,yp(await e.request(`prefs.get`))}async function Sp(e,t,n){let r=_p.get();_p.set({...r,prefs:{...r.prefs,[t]:n}}),vp(_p.get().prefs);try{let r=await e.request(`prefs.set`,{key:t,value:n});yp({..._p.get(),prefs:r.prefs})}catch(e){_p.set(r),vp(r.prefs),L(e instanceof Error?e.message:String(e),`error`)}}function Cp(e,t){if(bp)return void Sp(bp,e,t);let n=_p.get();_p.set({...n,prefs:{...n.prefs,[e]:t}})}function wp(){return y(_p)}function Tp(e,t){let n=e.options[t];return Array.isArray(n)?n:[]}var Ep=[`project`,`state`],Dp=`rove.railGroup`,Op=v(Ep.find(e=>e===localStorage.getItem(Dp))??`project`);function kp(e){e!==Op.get()&&(Op.set(e),localStorage.setItem(Dp,e))}_p.subscribe(()=>{let{loaded:e,prefs:t}=_p.get();e&&Ep.includes(t.railGroup)&&kp(t.railGroup)});function Ap(e){kp(e),Cp(`railGroup`,e)}var jp=`rove.activeSortMode`;function Mp(){let e=localStorage.getItem(jp);return Z.find(t=>t===e)??`recent`}var Np=v(Mp());function Pp(e){e!==Np.get()&&(Np.set(e),localStorage.setItem(jp,e))}_p.subscribe(()=>{let{loaded:e,prefs:t}=_p.get();e&&Z.includes(t.railSort)&&Pp(t.railSort)});function Fp(e){Pp(e),Cp(`railSort`,e)}function Ip(){Fp(Z[(Z.indexOf(Np.get())+1)%Z.length]??`default`)}var Lp=v(!1);function Rp(e){e&&(Np.get()!=="default"||Op.get()===`state`)&&(Fp(`default`),Ap(`project`),L(q(`tasks`,`sort.reorderSwitched`))),Lp.set(e)}async function zp(e,t,n){let r=n<0?`up`:`down`;try{await e.client.request(`task.move`,{taskId:t.task.id,direction:r})}catch(e){L(q(`tasks`,`toast.moveFailed`,{error:e instanceof Error?e.message:String(e)}),`error`)}}async function Bp(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){L(q(`tasks`,`toast.moveFailed`,{error:e instanceof Error?e.message:String(e)}),`error`)}}var Vp=`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`,Hp=`flex min-h-0 flex-1 flex-col items-center justify-center gap-1.5 overflow-hidden text-center keyboard:hidden`,Up=`relative mx-auto flex w-full max-w-[104ch] flex-none flex-col gap-2 keyboard:mt-auto`,Wp=`pointer-events-none absolute bottom-full left-0 mb-2 flex flex-col gap-1`,Gp=`flex flex-col gap-2 rounded-md border-hairline border-line bg-surface px-3 py-2.5 focus-within:border-line-active`,Kp=`flex flex-wrap items-center justify-end gap-1.5`,qp=`max-h-[40vh] min-h-[4.5em] w-full bg-transparent text-ink [border:0] [outline:0]`,Jp=`flex items-center gap-1.5 px-1`,Yp=`flex min-w-0 items-center gap-1.5`,Xp=`${Yp} group/end ml-auto narrow:ml-0`,Zp=(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`}`,Qp=`size-3.25 flex-none fill-none stroke-current [stroke-linecap:round] [stroke-linejoin:round] [stroke-width:1.3]`,$p=`narrow:sr-only`,em=(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`}`,tm=`disabled:cursor-default disabled:opacity-60`,nm=e=>`${em(e)} min-w-[9ch] justify-center ${tm}`,rm=`touch-none select-none [-webkit-touch-callout:none]`,im=`group/chip relative inline-flex`,am=`flex min-h-0 flex-col gap-1 overflow-x-hidden overflow-y-auto p-1.5 [outline:0]`,om=`flex min-h-0 flex-col overflow-x-hidden overflow-y-auto`,sm=`sticky top-0 z-1 m-0 bg-surface px-1.5 pt-1.5 pb-0.5 text-left`,cm=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`:``}`,lm=`flex-[0_0_1.5ch] text-accent`,um=`ml-auto pl-3 inline-flex items-center gap-1`,dm=`min-w-0 overflow-hidden text-ellipsis whitespace-nowrap`,fm=`${dm} narrow:max-w-[13ch]`,pm=`${dm} [direction:rtl]`,mm=`flex-none whitespace-nowrap`,hm=`mx-2 my-1`,gm=`flex flex-col gap-0.5 px-1.5 py-0.5`,_m=`min-w-[36ch]`,vm=`flex items-center gap-1.5 p-1.5`;function ym(){return(0,H.jsx)(`svg`,{className:Qp,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,H.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 bm(){return(0,H.jsxs)(`svg`,{className:Qp,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,H.jsx)(`circle`,{cx:`4.5`,cy:`3.5`,r:`1.5`}),(0,H.jsx)(`circle`,{cx:`4.5`,cy:`12.5`,r:`1.5`}),(0,H.jsx)(`circle`,{cx:`11.5`,cy:`5`,r:`1.5`}),(0,H.jsx)(`path`,{d:`M4.5 5v6M11.5 6.5c0 3-7 2-7 4.5`})]})}function xm(e){return e instanceof Error?e.message:String(e)}function Sm(e){return/no space left on device|ENOSPC|disk quota exceeded/i.test(xm(e))}var Cm=`-my-0.75 -mr-0.5 ml-0 flex flex-none self-stretch`,wm=`before:absolute before:top-0 before:left-1 before:content-[''] before:[border-left:var(--hairline)_solid_var(--line-active)]`,Tm={blank:``,pipe:`${wm} before:bottom-0`,tee:`${wm} before:bottom-0`,elbow:`${wm} before:right-0 before:bottom-1/2 before:rounded-bl-[6px] before:[border-bottom:var(--hairline)_solid_var(--line-active)]`},Em=e=>`relative w-3 ${Tm[e]}`,Dm=`-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`,Om=`inline-flex items-center gap-1`,km=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`:``}`,Am=`inline-flex flex-none items-center text-subtle`,jm=`group/rail rail @container row-1 flex min-h-0 flex-col focus:outline-none ${Ht}`,Mm=`flex min-w-0 items-center gap-2.5 overflow-hidden px-3.5 pt-3.5 pb-2.5 whitespace-nowrap`,Nm=`flex gap-1 px-3.5 pb-2 text-meta`,Pm=`min-w-0 flex-1 border-none bg-transparent p-0 text-ink [font:inherit] outline-none placeholder:text-subtle`,Fm=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`:``}`,Im=`group-focus-within/rail:[box-shadow:inset_0_0_0_1px_var(--focus)]`,Lm=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?`cursor-grab [&>button:first-child]:cursor-grab`:``} ${e.moving?`bg-accent-soft after:font-mono after:text-meta after:font-medium after:normal-nums after:text-accent after:content-['move']`:``}`,Rm=`touch:relative touch:after:absolute touch:after:-inset-x-1.5 touch:after:-inset-y-3 touch:after:content-['']`,zm=`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 ${Rm}`,Bm=e=>e?``:`opacity-0 group-hover/head:opacity-100 group-focus-visible/toggle:opacity-100 touch:opacity-100`,Vm=`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 ${Rm}`,Hm=`-mr-[4.5px] ${Vm}`,Um=`ml-auto ${Vm}`,Wm=1e4;function Gm(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 Km(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}${Gm(t,n).slice((t.hostLabel||t.alias).length)}`}function qm(e,t,n){if(e.kind!==`task`||e.machine===void 0)return null;let r=e.machine;return Km(r,t.find(e=>e.alias===r),n,e.task.machine?.label)}function Jm({label:e}){return(0,H.jsx)(`span`,{className:Am,title:e,role:`img`,"aria-label":e,children:(0,H.jsx)(`svg`,{viewBox:`0 0 16 16`,width:`12`,height:`12`,"aria-hidden":`true`,children:(0,H.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 Ym({host:e,onMachines:t}){return V(),(0,H.jsxs)(`div`,{className:Jn,children:[(0,H.jsx)(`p`,{className:`text-muted`,children:q(`tasks`,`machine.filesElsewhere`,{host:e})}),(0,H.jsx)(`p`,{className:`text-muted`,children:q(`tasks`,`machine.filesHint`,{host:e})}),(0,H.jsx)(`div`,{children:(0,H.jsx)(U,{hit:`tight`,onClick:t,children:B(`machines.open`)})})]})}function Xm(e){let t=y(e.client.conn),n=y(e.remote),[r,i]=(0,h.useState)(()=>X(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=()=>Ku(e,`machines.list`).then(e=>n&&i(e.machines),()=>{});r();let a=K(Wm,r);return()=>{n=!1,a()}},[e.client,t.state,a]),r}function Zm(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,H.jsxs)(`span`,{ref:i,className:im,onKeyDown:e=>{e.key!==`Escape`||!t||(e.preventDefault(),e.stopPropagation(),s())},children:[(0,H.jsx)(`button`,{ref:a,type:`button`,className:em(),"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,H.jsx)(`div`,{ref:o,className:`absolute bottom-[calc(100%+6px)] left-0 z-20 flex max-h-[min(50vh,420px)] max-w-[min(52ch,calc(100vw-16px))] min-w-[min(34ch,calc(100vw-16px))] flex-col overflow-hidden rounded-md border-hairline border-line-active bg-surface shadow-popover group-[&]/end:group-last-of-type/chip:right-0 group-[&]/end:group-last-of-type/chip:left-auto`,children:e.children(s)})]})}function Qm(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,H.jsxs)(`div`,{className:am,children:[(0,H.jsx)(`input`,{className:mn,autoFocus:!0,spellCheck:!1,placeholder:e.placeholder,value:e.query,onChange:t=>{n(0),e.onQuery(t.target.value)},onKeyDown:t=>{if(!t.nativeEvent.isComposing){if(t.key===`ArrowDown`||t.key===`ArrowUp`)t.preventDefault(),n(Math.max(0,Math.min(r.length-1,i+(t.key===`ArrowDown`?1:-1))));else if(t.key===`Enter`){t.preventDefault();let n=r[i];n&&e.onPick(n.key,t.shiftKey||t.metaKey||t.ctrlKey)}}}}),(0,H.jsxs)(`div`,{className:om,children:[r.length===0&&(0,H.jsx)(`p`,{className:`mx-2 my-1 text-muted`,children:e.empty}),r.map((t,r)=>(0,H.jsxs)(h.Fragment,{children:[e.moreLabel&&t===e.more?.[0]&&(0,H.jsx)(`p`,{className:`mx-2 mt-2 mb-0.5 text-muted`,children:e.moreLabel}),t.ruled&&r>0&&(0,H.jsx)(`div`,{className:`mx-2 my-1 flex-none border-t-hairline border-t-line`}),(0,H.jsxs)(`button`,{type:`button`,"aria-current":t.checked===!0,ref:r===i?a:void 0,tabIndex:-1,title:t.title,className:cm({cursor:r===i}),onMouseMove:()=>n(r),onClick:n=>e.onPick(t.key,n.shiftKey||n.metaKey||n.ctrlKey),children:[(0,H.jsx)(`span`,{className:lm,children:t.checked?`✓`:``}),(0,H.jsx)(`span`,{className:mm,children:t.text}),t.dim&&(0,H.jsx)(`span`,{className:`ml-auto pl-3 text-muted ${t.dimPath?pm:`min-w-0 overflow-hidden text-ellipsis whitespace-nowrap`}`,children:t.dimPath?(0,H.jsx)(`bdi`,{children:t.dim}):t.dim})]})]},t.key))]}),e.hint&&(0,H.jsx)(`p`,{className:`m-0 flex-none border-t-hairline border-t-line px-2 pt-1.5 pb-0.5 text-subtle`,children:e.hint})]})}function $m(e){return(0,H.jsxs)(`button`,{type:`button`,role:e.multi?`menuitemcheckbox`:`menuitemradio`,"aria-checked":e.checked,tabIndex:-1,disabled:e.option.disabled,className:cm({cursor:e.cursor,dim:e.option.dim}),onMouseMove:e.onHover,onClick:e.onPick,children:[(0,H.jsx)(`span`,{className:lm,children:e.checked?`✓`:``}),(0,H.jsx)(`span`,{children:e.option.label}),!e.checked&&e.digit!==void 0&&!e.option.disabled&&(0,H.jsx)(`span`,{className:`ml-auto pl-3 text-muted`,children:e.digit})]})}function eh(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,H.jsxs)(`div`,{ref:r,role:`menu`,tabIndex:-1,className:am,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?Fu(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,H.jsxs)(`button`,{type:`button`,className:`${sm} ${W} text-muted`,tabIndex:-1,onClick:e.onBack,children:[`‹ `,e.heading]}):(0,H.jsx)(`p`,{className:`${sm} ${W} text-muted`,children:e.heading}),e.options.map((r,i)=>(0,H.jsx)($m,{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 th(e){return(0,H.jsxs)(`div`,{className:`${am} ${_m}`,children:[(0,H.jsx)(`p`,{className:`${sm} ${W} text-muted`,children:B(`newSession.branches`)}),(0,H.jsxs)(`label`,{className:gm,children:[(0,H.jsx)(`span`,{className:`text-muted`,children:B(`newSession.branchName`)}),(0,H.jsx)(`input`,{className:Mr,autoFocus:!0,spellCheck:!1,placeholder:B(`newSession.branchNamePlaceholder`),value:e.branch,onChange:t=>e.onBranch(t.target.value)})]}),e.repos.map(t=>(0,H.jsxs)(`label`,{className:gm,children:[(0,H.jsxs)(`span`,{children:[t.name,t.primary&&(0,H.jsxs)(`span`,{className:`text-muted`,children:[` `,B(`newSession.primary`)]})]}),(0,H.jsx)(`select`,{className:Mr,"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,H.jsx)(`option`,{value:e,children:e},e))})]},t.path))]})}function nh(e){return e.replace(/\.git$/,``).split(/[/:]/).filter(Boolean).slice(-2).join(`/`)}function rh(e){return e.id.startsWith(`root:`)?e.primary??e.checkouts[0]??e.id:e.id}function ih(e,t){if(!e)return null;let n=t.find(t=>t.id===e||t.checkouts.includes(e));return n?{ref:rh(n),clone:!1}:e.startsWith(`/`)?{ref:e,clone:!1}:null}function ah(e,t,n){let r=t.toLowerCase();return n?e.some(e=>e.toLowerCase()===`github.com/${r}`):e.some(e=>mu(e).base.toLowerCase()===(r.split(`/`)[1]??``))}function oh(e,t,n){let r=t.find(t=>t.id===e||t.checkouts.includes(e))?.id??e,i=n.find(e=>e.id===r);return i?{ref:rh(i),clone:!1}:r.startsWith(`root:`)||r.startsWith(`/`)?null:{ref:r,clone:!0}}function sh(e,t){let n=new Set(t.filter(e=>e.installed!==!1).map(e=>e.id)),r=new Set(t.length>0?e.filter(e=>!n.has(e.id)).map(e=>e.id):[]),i=new Set(e.map(e=>e.id)),a=t.filter(e=>n.has(e.id)&&!i.has(e.id)).map(e=>({id:e.id,name:e.name??e.id}));return{rows:[...e,...a],missing:r}}function ch(e){return{repo:e.pick.ref,machine:e.machine,...e.pick.clone?{clone:!0}:{},...e.baseRef?{baseBranch:e.baseRef}:{},...e.prompt?{prompt:e.prompt}:{},...e.engine?{engine:e.engine}:{},...e.engineThere?{engineThere:!0}:{},...!e.engineThere&&e.model?{model:e.model}:{}}}var lh=1.2,uh=.3,dh=20,fh=.35,ph=.25,mh=.12,hh=2,gh=1,_h={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}},vh=Array.from({length:9},(e,t)=>Math.hypot(t%3-1,Math.floor(t/3)-1));function yh(e){return fh+.65*(.5+.5*Math.cos(2*Math.PI*e/lh))}function bh(e,t,n,r=1){switch(e){case`working`:{let e=t*80/1e3/r;return vh.map(t=>yh(e-t*uh))}case`waiting`:{let e=[0,1,4,5].includes(Math.floor(t/r)%dh);return Array(9).fill(e?ph:1)}default:{let t=_h[e],r=Array(9).fill(mh);return t?.dots.forEach((e,i)=>{let a=Math.min(Math.max(n-i*gh,0),hh)/hh;r[e]=t.bright*a+mh*(1-a)}),r}}}function xh(e,t){let n=_h[e];return!n||t<(n.dots.length-1)*gh+hh}var Sh={working:`info`,waiting:`warning`,error:`attention`,done:`success`,idle:`muted`},Ch={prOpen:``,prMerged:``,prClosed:``};function wh(e){let t=Th(e);return{look:t,tone:Sh[t]}}function Th(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 Eh(e){return e.rowStatus?.kind===`needs-input`||e.rowStatus?.kind===`attention`}var Dh={busy:0,attention:1,"needs-input":2,running:3,unseen:4,idle:5};function Oh(e){let t;for(let{rowStatus:n}of e)n&&(!t||Dh[n.kind]<Dh[t.kind]||n.kind===t.kind&&n.since>t.since)&&(t=n);return t}function kh(e,t,n){if(!e)return null;if(e.lifecycle===`merged`)return{glyph:Ch.prMerged,tone:n?`text-muted`:`text-merged`,state:`merged`};if(e.lifecycle===`closed`)return{glyph:Ch.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:Ch.prOpen,tone:i,state:`open`,...r?{checks:r}:{}}}function Ah(e){return kh(e.pr,e.prChip,e.prChipStale===!0)}function jh(e){return kh(e,(e.mergeable??``).toUpperCase()===`CONFLICTING`?`conflict`:e.checkState===`failing`?`failing`:e.checkState===`passing`?`passing`:null,!1)}function Mh(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 Nh=3,Ph=new Set,Fh;function Ih(e,t){let n=typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches,r=1/0,i=e.held+t-e.step,a=xh(e.look,n?r:i);return bh(e.look,t,n?r:i,n?Nh:1).forEach((t,n)=>{let r=e.el.children[n].style;r.opacity=t.toFixed(3)}),a}function Lh(){let e=Math.floor(performance.now()/80);for(let t of Ph)Ih(t,e)||Ph.delete(t);Rh()}function Rh(){Fh=Ph.size?window.setTimeout(Lh,80-performance.now()%80+2):void 0}function zh(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 Ih(a,r)&&(Ph.add(a),Fh===void 0&&Rh()),()=>{Ph.delete(a)}}function Bh({status:e}){let{look:t,tone:n}=wh(e);return(0,H.jsx)(Uh,{look:t,tone:n,since:e?.since??0},t)}var Vh=e=>e===`muted`?`text-muted`:e===`ink`?`text-ink`:lp[e];function Hh(){return(0,H.jsx)(Uh,{look:`working`,tone:`info`,since:Date.now()})}function Uh({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?zh(t,e,i):void 0},[e,i]),(0,H.jsx)(`span`,{ref:r,className:`inline-grid flex-none grid-cols-[repeat(3,3px)] auto-rows-[3px] gap-px self-center ${Vh(t)}`,"aria-hidden":`true`,children:Array.from({length:9},(e,t)=>(0,H.jsx)(`i`,{className:`rounded-full bg-current opacity-12`},t))})}var Wh={offline:`newSession.remoteOffline`,outdated:`newSession.remoteOutdated`},Gh=`local`,Kh=`auto`,qh=`rove.newSession.autoMachine`;function Jh(){try{return localStorage.getItem(qh)===`1`}catch{return!1}}var Yh=(e,t)=>Ku(e,`machines.repos`,{machine:t});function Xh(e,t){let n=t.filter(e=>e.state===`online`).map(e=>e.alias).join(`
41
+ `);(0,h.useEffect)(()=>{for(let t of n?[Gh,...n.split(`
42
+ `)]:[])Yh(e,t).catch(()=>{})},[e,n])}function Zh(e,t){let[n,r]=(0,h.useState)(null);return(0,h.useEffect)(()=>{if(!t)return;let n=!1;return Ku(e,`machines.engines`,{machine:t}).then(e=>!n&&r({machine:t,reply:e})).catch(()=>{}),()=>{n=!0}},[e,t]),t?(n?.machine===t?n.reply:X(e,`machines.engines`,{machine:t}))?.engines??[]:[]}function Qh(e,t,n){let r=sh(n.engines,Zh(e,t)),i=r.rows.filter(e=>!r.missing.has(e.id)),a=i.some(e=>e.id===n.engine)?n.engine:i[0]?.id??n.engine;return{engines:r.rows,engine:a,setEngine:n.setEngine,missing:t?r.missing:void 0}}function $h(e,t,n){let[r,i]=(0,h.useState)(null),a=tg(e,r?.from??``);return(0,h.useEffect)(()=>{!r||!a.loaded||!t.loaded||(t.problem||n(oh(r.ref,a.repos,t.repos)),i(null))},[r,a,t,n]),(e,t)=>i(e&&t?{from:e,ref:t}:null)}function eg(e,t,n){let r=Xm(e),[i,a]=(0,h.useState)(t.machine??``),[o,s]=(0,h.useState)(()=>!t.machine&&Jh()),c=tg(e,i),[l,u]=(0,h.useState)(!1),d=Qh(e,l?i:``,n);Xh(e,r);let[f,p]=(0,h.useState)(null),[m,g]=(0,h.useState)(``),_=$h(e,c,e=>p(t=>t??e));return(0,h.useEffect)(()=>{!i||!c.loaded||i!==t.machine||p(e=>e??ih(t.repo,c.repos))},[c.loaded]),{machines:r,machine:i,auto:o,remote:i!==``,machineName:r.find(e=>e.alias===i)?.hostLabel||i,remoteList:c,engineThere:l,setEngineThere:u,shown:d,pick:f,setPick:p,base:m,setBase:g,switchTo(e,t){let n=e===`auto`?``:e;s(e===Kh);try{localStorage.setItem(qh,e===`auto`?`1`:`0`)}catch{}_(n&&(i||`local`),i?f?.ref:t),a(n),p(null),g(``)}}}function tg(e,t){V();let[n,r]=(0,h.useState)(null);if((0,h.useEffect)(()=>{if(!t)return;let n=!1;return Yh(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=X(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:B(`newSession.remoteFailed`,{machine:t,message:i?.failed??``})};let s=o.reason?Wh[o.reason]:void 0,c=o.reason?s?B(s,{machine:t}):B(`newSession.remoteFailed`,{machine:t,message:o.message??o.reason}):``;return{repos:o.repos,loaded:!0,problem:c}}function ng(e,t){return t.problem?t.problem:t.loaded?B(`newSession.remoteNone`,{machine:e}):B(`newSession.remoteLoading`,{machine:e})}function rg(){return(0,H.jsxs)(`svg`,{className:Qp,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,H.jsx)(`rect`,{x:`2`,y:`3`,width:`12`,height:`8`,rx:`1`}),(0,H.jsx)(`path`,{d:`M5.5 13.5h5M8 11v2.5`})]})}function ig(e){let t=(V()===`zh`?Gi:Wi).machine,n=e.machines.find(t=>t.alias===e.value),r=e.value===`auto`?B(`newSession.machineAuto`):e.value?n?.hostLabel||e.value:B(`newSession.thisMachine`);return(0,H.jsx)(Zm,{field:`machine`,title:B(`newSession.machine`),label:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(rg,{}),(0,H.jsx)(`span`,{className:$p,children:r})]}),children:n=>(0,H.jsx)(eh,{heading:B(`newSession.machine`),options:[{id:Kh,label:B(`newSession.machineAuto`)},{id:``,label:B(`newSession.thisMachine`)},...e.machines.map(e=>({id:e.alias,label:Gm(e,t),disabled:e.state!==`online`}))],footer:e.value===`auto`?(0,H.jsx)(`p`,{className:`${hm} text-muted`,children:B(`newSession.machineAutoNote`)}):null,value:e.value,digits:!0,onPick:t=>{e.onPick(t),n()}})})}function ag(e){let{machine:t}=e;return(0,H.jsx)(eh,{heading:B(`newSession.agentPlace`),options:[{id:``,label:B(`newSession.thisMachine`)},{id:`there`,label:t}],value:e.there?`there`:``,digits:!0,onBack:e.onBack,onPick:t=>e.onPick(t!==``),footer:(0,H.jsx)(`p`,{className:`${hm} text-muted`,children:B(e.there?`newSession.agentThereNote`:`newSession.agentHereNote`,{machine:t})})})}function og(e){let[t,n]=(0,h.useState)(``),r=t.trim();return(0,H.jsx)(Zm,{field:`branch`,title:B(`newSession.branch`),label:e.value||B(`newSession.branch`),children:i=>(0,H.jsx)(Qm,{placeholder:B(`newSession.branchTypeRef`),empty:``,rows:[{key:``,text:B(`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 sg(e,t){return(await e.client.request(`task.spawn`,ch(t))).taskIds[0]}function cg(e){let{progress:t,error:n}=e;return!t&&!n?null:(0,H.jsxs)(`div`,{className:Wp,children:[t&&(0,H.jsxs)(`p`,{className:`m-0 flex items-center gap-2 text-muted`,"data-field":`clone-progress`,children:[(0,H.jsx)(Hh,{}),(0,H.jsx)(`span`,{className:`running-shimmer:bg-[linear-gradient(90deg,var(--ink)_0%,var(--ink)_35%,var(--accent)_50%,var(--ink)_65%,var(--ink)_100%)] running-shimmer:bg-size-[300%_100%] running-shimmer:bg-clip-text running-shimmer:text-transparent running-shimmer:animate-shimmer`,children:t})]}),n&&!Sm(n)&&(0,H.jsxs)(`p`,{className:`m-0 text-error`,children:[`※ `,n]}),n&&Sm(n)&&(0,H.jsxs)(`p`,{className:`pointer-events-auto m-0 text-error`,"data-field":`no-disk-space`,children:[`※ `,q(`tasks`,`toast.noDiskSpace`),` `,(0,H.jsx)(U,{hit:`tight`,disabled:e.busy,onClick:e.onRetry,children:B(`newSession.retry`)})]})]})}function lg(e){return e instanceof Uo&&e.code===`CLONE_FAILED`?q(`newTask`,`error.cloneFailed`,{error:e.message}):e instanceof Error?e.message:String(e)}function ug({on:e,...t}){return(0,H.jsx)(`button`,{type:`button`,className:`${em(e)} ${tm}`,"aria-pressed":e,...t})}function dg(e){let[t,n]=(0,h.useState)(``);if(e.ungrouped)return null;if(e.remote)return e.remotePick&&(0,H.jsx)(og,{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=_u(s?.branches??[],t).map(e=>({key:e,text:e,checked:e===(i[o]||s?.current)})),u=r.map(t=>({path:t,name:mu(t).base,primary:t===o,branches:e.probes[t]?.branches??[],current:e.probes[t]?.current??``,base:i[t]??``}));return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(ug,{on:!a,disabled:r.length>1||e.plain,title:e.plain?B(`newSession.worktreeNoGit`):r.length>1?B(`newSession.worktreeMulti`):B(a?`newSession.worktreeOff`:`newSession.worktreeOn`),onClick:e.onToggleWorktree,children:[(0,H.jsx)(bm,{}),(0,H.jsx)(`span`,{className:$p,children:B(`newSession.worktree`)})]}),r.length>1?(0,H.jsx)(Zm,{field:`branch`,title:B(`newSession.branches`),label:B(`newSession.branches`),children:()=>(0,H.jsx)(th,{repos:u,branch:e.branchName,onBranch:e.onBranchName,onBase:e.onBase})}):!a&&s?.ok&&c&&(0,H.jsx)(Zm,{field:`branch`,title:B(`newSession.branch`),label:c,children:r=>(0,H.jsx)(Qm,{placeholder:B(`newSession.branchSearch`),empty:B(`newSession.branchEmpty`),rows:l,query:t,onQuery:n,onPick:t=>{e.onBase(o,t),n(``),r()}})})]})}var fg=`rove.web.newSession.prompt`,pg=`rove.web.newSession.attachments`,mg=sessionStorage.getItem(fg)??``;function hg(){return mg}function gg(e){mg=e;try{sessionStorage.setItem(fg,e)}catch{}}function _g(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=Au(a,t);r(n),n[0]&&n[0]!==e.engine&&e.setEngine(n[0])}}}function vg(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,H.jsx)(Zm,{field:`engine`,title:B(`newSession.engine`),label:ju(i)||B(`newSession.engine`),children:i=>(0,H.jsx)(eh,{heading:B(`newSession.engine`),options:r.map(t=>{if(!e.missing)return{id:t.id,label:t.name,dim:t.ready===!1};let n=e.missing.has(t.id);return{id:t.id,label:n?B(`newSession.engineMissing`,{engine:t.name}):t.name,disabled:n}}),value:n.engine,...t.comparing?{values:t.ids}:{},onPick:e=>{if(t.comparing)return t.toggle(e);n.setEngine(e),i()},footer:e.available&&r.length>1?(0,H.jsx)(U,{className:`mx-2 mt-1 mb-0.5 self-start font-mono`,"data-field":`compare-engines`,hit:`tight`,onClick:()=>t.setComparing(!t.comparing),children:B(t.comparing?`compare.oneEngine`:`compare.severalEngines`)}):null})})}function yg(e){return(0,H.jsx)(Zm,{field:`model`,title:B(`newSession.model`),label:ku(e.models,e.model,B(`newSession.modelDefault`)),children:t=>(0,H.jsx)(eh,{heading:B(`newSession.modelHeading`),options:e.models,value:e.model,digits:!0,onPick:n=>{e.onModel(n),t()}})})}var bg=6e4,xg=/^(?:(today|tomorrow|今天|明天)\s*)?(\d{1,2})(?::(\d{2}))?\s*(am|pm)?$/i,Sg=/^\+\s*(?:(\d+)\s*h)?\s*(?:(\d+)\s*m)?$/i;function Cg(e,t){let n=e.trim(),r=Sg.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*bg):null}let i=xg.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 wg(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 Tg(e){let[t,n]=(0,h.useState)(``),r=()=>{let n=Cg(t,new Date);if(!n)return e.onInvalid(B(`newSession.laterBad`));e.onSchedule(n)};return(0,H.jsxs)(`div`,{className:vm,children:[(0,H.jsx)(`input`,{className:`${Mr} min-w-0 flex-1`,value:t,placeholder:B(`newSession.laterPlaceholder`),"aria-label":B(`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,H.jsx)(U,{variant:`filled`,disabled:!t.trim(),onClick:r,children:B(`newSession.laterConfirm`)})]})}function Eg(e){let[t,n]=(0,h.useState)(`root`),r=e.agentPlace;return(0,H.jsx)(Zm,{field:`more`,title:B(`newSession.more`),label:(0,H.jsx)(`span`,{"aria-hidden":`true`,children:`⋯`}),onClose:()=>n(`root`),children:i=>t===`later`?(0,H.jsxs)(`div`,{className:am,children:[(0,H.jsxs)(`button`,{type:`button`,className:`${sm} ${W} text-muted`,onClick:()=>n(`root`),children:[`‹ `,B(`newSession.later`)]}),(0,H.jsx)(Tg,{onBack:()=>n(`root`),onInvalid:e.onInvalid,onSchedule:t=>{i(),e.onLater?.(t)}})]}):t===`agent`&&r?(0,H.jsx)(ag,{...r,onBack:()=>n(`root`),onPick:e=>{r.onPick(e),i()}}):(0,H.jsxs)(`div`,{role:`menu`,className:am,children:[r&&(0,H.jsx)(Dg,{label:B(`newSession.agentPlace`),dim:r.there?r.machine:B(`newSession.thisMachine`),sub:!0,disabled:e.busy,onClick:()=>n(`agent`)}),e.onLater&&(0,H.jsx)(Dg,{label:B(`newSession.later`),sub:!0,disabled:e.busy,onClick:()=>n(`later`)})]})})}function Dg(e){return(0,H.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`${cm({cursor:!1})} [&:hover:not(:disabled)]:bg-hover`,disabled:e.disabled,onClick:e.onClick,children:[(0,H.jsx)(`span`,{className:dm,children:e.label}),(e.dim!==void 0||e.sub)&&(0,H.jsxs)(`span`,{className:`${um} text-muted`,children:[e.dim,e.sub&&(0,H.jsx)(ps,{right:!0})]})]})}var Og=128,kg=80,Ag=3,jg=2,Mg=Og/2,Ng=kg/2,Pg=25,Fg=(1-1.2/Pg)**2,Ig=1e3/30,Lg=7,Rg=0,zg=1,Bg=2,Vg=3,Hg=4,Ug=[``,`--color-subtle`,`--color-muted`,`--color-ink`,`--color-accent`],Wg=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5],Gg=Array.from({length:64},(e,t)=>{let n=t%8,r=t>>3;return(4*(Wg[(r&3)*4+(n&3)]??0)+([0,2,3,1][(r>>2)*2+(n>>2)]??0)+.5)/64}),Kg=(e,t)=>Gg[(t&7)*8+(e&7)]??1,qg=[{radius:1.55,lift:.3,roll:-.42,speed:.9,phase:.4,ink:Hg},{radius:1.95,lift:.22,roll:.3,speed:-.55,phase:2.6,ink:Vg},{radius:2.4,lift:.36,roll:-.12,speed:.38,phase:4.4,ink:Vg}],Jg=1.9,Yg=[[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 Xg(e,t){e.fill(Rg);let n=(t,n,r)=>{t>=0&&t<Og&&n>=0&&n<kg&&(e[n*Og+t]=r)};for(let[e,r,i]of Yg)Math.sin(t*.8+i)>-.5&&n(e,r,zg);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<kg;e++)for(let t=0;t<Og;t++){let s=(t+.5-Mg)/Pg,u=(e+.5-Ng)/Pg,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)>Kg(t,e)?n(t,e,h>.4?Vg:Bg):p>Fg&&n(t,e,zg)}for(let e of qg){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(Mg+s*Pg),Math.floor(Ng+c*Pg),l]},o=Math.round(Math.PI*e.radius*Pg);for(let e=0;e<o;e++){let t=a(e/o*Math.PI*2);t&&!t[2]&&n(t[0],t[1],zg)}let s=e.phase+t*e.speed,c=.5/(e.radius*Pg),l=-Math.sign(e.speed)*c;for(let e=Jg/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,Rg)}for(let t=Jg/c;t>0;t--){let r=a(s+t*l),i=1-t*c/Jg;r&&i>Kg(r[0],r[1])&&n(r[0],r[1],i>.6?e.ink:Bg)}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 Zg(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=zg;e<=Hg;e++){n.fillStyle=a.getPropertyValue(Ug[e]??``)||a.color;for(let r=0;r<t.length;r++)t[r]===e&&n.fillRect(r%Og*Ag,Math.floor(r/Og)*Ag,jg,jg)}}function Qg(){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){Xg(n,Lg),Zg(t,n);return}let r=0,i=0,a=e=>{r=requestAnimationFrame(a),!(e-i<Ig)&&(i=e,Xg(n,e/1e3),Zg(t,n))};return r=requestAnimationFrame(a),()=>cancelAnimationFrame(r)},[]),(0,H.jsx)(`div`,{"aria-hidden":`true`,className:`mb-3 max-w-full`,children:(0,H.jsx)(`canvas`,{ref:e,width:384,height:240,"data-plate":`rove`,className:`h-auto w-96 max-w-full text-muted`})})}var $g=`clone:`;function e_(e){let{model:t,saved:n,picked:r,primary:i,home:a,query:o,remote:s}=e,[c,l]=(0,h.useState)(()=>X(t,`github.repos`)??null);(0,h.useEffect)(()=>{let e=!1,n=t.client.onOpen(()=>{Ku(t,`github.repos`).then(t=>!e&&l(t)).catch(()=>!e&&l(e=>e??{repos:[],reason:`failed`}))});return()=>{e=!0,n()}},[t]);let u=o.trim(),d=u.toLowerCase(),f=Tu(u),p=n.filter(e=>e.toLowerCase().includes(d)||f!==null&&`/${mu(e).base.toLowerCase()}`===f.slice(f.indexOf(`/`))),m=B(`newSession.noFolder`),g=e.ungrouped&&(!u||m.toLowerCase().includes(u.toLowerCase()))?[{key:kd,text:m,checked:e.ungrouped.on}]:[],_=p.map((e,t)=>{let{base:n,dir:a}=mu(e);return{key:e,text:n,dim:e===i&&r.length>1?`${B(`newSession.primary`)}, ${a}`:a,dimPath:!0,title:e,checked:r.includes(e),ruled:t===0&&g.length>0}}),v=Cu(u),y=v&&(v.includes(`:`)||p.length===0)?v:null,b=!y&&vu(u)&&!n.includes(u)&&(!s||u.startsWith(`/`))?bu(yu(u,a)):``,x=(c?.repos??[]).filter(e=>e.nameWithOwner.toLowerCase().includes(f??d)).filter(e=>!ah(n,e.nameWithOwner,s!==void 0)).sort((e,t)=>Number(t.nameWithOwner.toLowerCase()===f)-Number(e.nameWithOwner.toLowerCase()===f)).map(t=>({key:$g+t.nameWithOwner,text:t.nameWithOwner,dim:t.description,title:t.description,checked:e.cloning===t.nameWithOwner})),S=f!==null&&!/^(?:ssh:|git@)/i.test(u)&&x[0]?.text.toLowerCase()===f?null:y?{key:$g+y,text:s?B(`newSession.cloneRowOn`,{source:y,machine:s.name}):B(`newSession.cloneRow`,{source:y})}:b?{key:b,text:b,checked:r.includes(b)}:null;return(0,H.jsx)(Qm,{placeholder:B(s?`newSession.repoSearchRemote`:`newSession.repoSearch`),empty:s?.empty??B(`newSession.repoEmpty`),rows:s?.blocked?[]:[...g,..._],query:o,onQuery:e.onQuery,extra:s?.blocked?null:S,more:s?.blocked?[]:x,moreLabel:B(`newSession.githubGroup`),hint:s?void 0:B(`newSession.repoMultiHint`),onPick:(t,n)=>{if(t===`~scratch`)return e.ungrouped?.pick(),e.close();if(!t.startsWith(`clone:`))return e.onToggle(t,n);e.onClone(t.slice(6)),e.close()}})}function t_(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 n_(e,t){return e?[e,...(t.extras??[]).map(e=>e.repo)]:[]}function r_(e,t){return e?{...t.baseBranch?{[e]:t.baseBranch}:{},...Object.fromEntries((t.extras??[]).flatMap(e=>e.baseRef?[[e.repo,e.baseRef]]:[]))}:{}}function i_(e){return[e.machine??``,e.repo??``,e.ungrouped?`u`:``,e.retryOf?.id??``,e.baseBranch??``,e.worktree===void 0?``:String(e.worktree)].join(`\0`)}function a_(e,t){return e.retryOf&&e.engine&&e.engine===t?e.retryOf.id:void 0}async function o_(e,t){try{let{task:n}=await e.client.request(`task.get`,{taskId:t.id});if(!n.prompt)return void L(B(`menu.retryNoPrompt`),`error`);te(t_(t,{...n,prompt:n.prompt}))}catch(e){L(G(e),`error`)}}function s_(e,t){let n=async n=>{await e.act(`task.archive`,{taskId:t.id,archived:!0,...n?{force:n}:{}}),L(q(`tasks`,`archive.done`,{title:t.label}))};C.set((0,H.jsx)(Ti,{title:B(`newSession.retryArchiveTitle`,{title:t.label}),body:B(`newSession.retryArchiveBody`),confirmLabel:q(`tasks`,`menu.archive`),onConfirm:()=>n(!1),escalate:{when:e=>e instanceof Uo&&e.code===`TASK_BUSY`,label:q(`tasks`,`archive.busyConfirm`),title:q(`tasks`,`archive.busyTitle`),body:()=>q(`tasks`,`archive.busyBody`,{title:t.label}),run:()=>n(!0)}}))}var c_=v([]),l_=()=>y(c_);async function u_(e){c_.set((await e.request(`snippets.get`)).snippets)}async function d_(e,t){c_.set((await e.request(`snippets.save`,{name:t.name,text:t.text})).snippets)}async function f_(e,t){c_.set((await e.request(`snippets.remove`,{name:t})).snippets)}var p_=/^[A-Za-z0-9][\w-]{0,31}$/;function m_(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 h_(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 g_(e,t,n){return{text:e.slice(0,t.start)+n.text+e.slice(t.end),caret:t.start+n.text.length}}var __=e=>e.split(`
43
+ `,1)[0]??``;function v_(e){return(0,H.jsx)(`ul`,{className:`${Or} ${e.className}`,children:e.items.map((t,n)=>(0,H.jsx)(`li`,{children:(0,H.jsxs)(U,{variant:`row`,tabIndex:-1,"aria-pressed":n===e.at,className:kr({cursor:n===e.at,accent:!1}),onMouseDown:t=>{t.preventDefault(),e.onPick(n)},children:[(0,H.jsxs)(`span`,{className:`text-accent`,children:[`@`,t.name]}),(0,H.jsxs)(`span`,{className:`text-muted`,children:[` `,__(t.text)]})]})},t.name))})}function y_(e){let t=l_(),[n,r]=(0,h.useState)(0),[i,a]=(0,h.useState)(0),[o,s]=(0,h.useState)(null),c=(0,h.useRef)(null),l=m_(e.value,Math.min(n,e.value.length)),u=l?h_(t,l.query):[],d=l!==null&&u.length>0&&o!==l.start,f=Math.min(i,Math.max(0,u.length-1));(0,h.useLayoutEffect)(()=>{let t=c.current,n=e.area.current;t===null||!n||(c.current=null,n.setSelectionRange(t,t),r(t))});let p=t=>{let n=u[t];if(!l||!n)return;let r=g_(e.value,l,n);c.current=r.caret,a(0),e.onChange(r.text)},m=e=>{if(!d||e.nativeEvent.isComposing)return!1;if(e.key===`ArrowDown`||e.key===`ArrowUp`)a(Math.max(0,Math.min(u.length-1,f+(e.key===`ArrowDown`?1:-1))));else if(e.key===`Tab`&&!e.shiftKey||e.key===`Enter`&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey)p(f);else if(e.key===`Escape`)s(l?.start??null),e.stopPropagation();else return!1;return e.preventDefault(),!0};return{list:d?(0,H.jsx)(v_,{items:u,at:f,className:e.listClassName??``,onPick:p}):null,field:{onChange:t=>{r(t.target.selectionStart),a(0),e.onChange(t.target.value)},onSelect:e=>r(e.currentTarget.selectionStart),onKeyDown:t=>{m(t)||!e.onEnter||t.key!==`Enter`||t.shiftKey||t.nativeEvent.isComposing||(t.preventDefault(),e.onEnter())}}}}var b_=`relative hidden [border-top:var(--hairline)_solid_var(--line)] bg-surface px-3 pt-2.5 pb-3.5 touch:flex`,x_=`absolute inset-x-3 bottom-full z-5 mb-1`,S_=`absolute inset-x-3 bottom-full z-6 mb-1`,C_=`flex min-w-0 flex-1 items-center gap-2.5`,w_=`flex h-11 min-w-0 flex-1 items-center rounded-[12px] border-hairline border-line bg-inset focus-within:border-focus has-[textarea:disabled]:opacity-60`,T_=`h-full min-w-0 flex-1 resize-none bg-transparent py-0 pr-3.5 pl-3.5 font-sans text-display leading-[42px] text-ink outline-none [border:0] has-[+button]:pr-0`,E_=`transition-transform duration-100 active:scale-94 motion-reduce:transition-none motion-reduce:active:scale-none`,D_=`transition-[scale,background-color,border-color,color] duration-150 active:scale-[0.98] motion-reduce:transition-none motion-reduce:active:scale-none`,O_=`flex size-11 shrink-0 items-center justify-center rounded-[12px] border-hairline border-accent text-accent touch-manipulation disabled:border-line disabled:text-muted disabled:opacity-60 ${E_}`,k_=`flex size-11 shrink-0 cursor-pointer items-center justify-center rounded-[10px] touch-manipulation active:bg-inset disabled:opacity-60 has-[:disabled]:opacity-60 ${E_}`,A_=`size-4.5 flex-none fill-none stroke-current stroke-[1.5] [stroke-linecap:round] [stroke-linejoin:round]`,j_=(e=!1)=>`${k_} -mr-1.5 -ml-3.25 ${e?`text-accent`:`text-muted`}`,M_=e=>`${k_} ${e?`text-accent`:`text-muted`}`,N_=(e,t)=>`relative z-6 flex h-11 min-w-0 flex-1 items-center gap-2.5 rounded-[12px] border-hairline px-3.5 font-sans touch-manipulation disabled:text-muted ${D_} ${t?`border-accent bg-accent text-paper`:e?`border-accent bg-accent-soft text-accent`:`border-line bg-inset text-ink`}`;function P_({d:e}){return(0,H.jsx)(`svg`,{viewBox:`0 0 16 16`,className:A_,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:e})})}var F_=`M8 1.5a2.5 2.5 0 0 1 2.5 2.5v4.5a2.5 2.5 0 0 1-5 0V4A2.5 2.5 0 0 1 8 1.5zM3 8a5 5 0 0 0 10 0M8 13v1.5`,I_=`M8 13V3M3.5 7.5 8 3l4.5 4.5`;function L_(){return(0,H.jsx)(P_,{d:`M10.5 4.5 5.8 9.2a1.4 1.4 0 0 0 2 2l5-5a2.8 2.8 0 0 0-4-4l-5.2 5.2a4.2 4.2 0 0 0 6 6L13 9`})}function R_(e){return(0,H.jsxs)(`button`,{type:`submit`,className:O_,title:e.label,disabled:e.disabled,children:[(0,H.jsx)(`span`,{className:`sr-only`,children:e.label}),(0,H.jsx)(P_,{d:I_})]})}function z_(e,t){let n=(0,h.useRef)(e);e!==null&&(n.current=e);let r=e===null,[i,a]=(0,h.useState)(r);return(0,h.useEffect)(()=>{if(!r)return a(!1);let e=window.setTimeout(()=>a(!0),t);return()=>window.clearTimeout(e)},[r,t]),{shown:e??(i?null:n.current),leaving:r&&!i}}function B_(e){return typeof Intl.Segmenter==`function`?[...new Intl.Segmenter(void 0,{granularity:`word`}).segment(e)].map(e=>e.segment):e.split(/(\s+)/)}function V_({level:e,seconds:t,wide:n}){let r=n?120:80,i=(0,h.useRef)([]),a=(0,h.useRef)(-1);t!==a.current&&(a.current=t,i.current=[...i.current,e].slice(-r));let o=[...Array(r-i.current.length).fill(0),...i.current];return(0,H.jsx)(`span`,{className:`flex min-w-0 flex-1 items-center justify-end overflow-hidden ${n?`h-10 gap-[3px]`:`h-5.5 gap-[2.5px]`}`,"aria-hidden":`true`,children:o.map((e,t)=>(0,H.jsx)(`i`,{className:`block h-full flex-none rounded-full bg-current transition-transform duration-100 ease-linear motion-reduce:transition-none ${n?`w-[3px]`:`w-[2.5px]`}`,style:{transform:`scaleY(${Math.max(n?.08:.12,Math.min(1,e*10))})`}},t))})}function H_(){return(0,H.jsx)(`span`,{className:`inline-flex items-center gap-[3px] align-middle`,"aria-hidden":`true`,children:[0,160,320].map(e=>(0,H.jsx)(`i`,{className:`block size-1 rounded-full bg-current motion-safe:animate-dot`,style:{animationDelay:`${e}ms`}},e))})}var U_=`pointer-events-none absolute inset-x-0 bottom-full z-6 mb-2.5 flex min-h-17 origin-bottom items-center rounded-[16px] border-hairline bg-surface px-4 py-3 text-left shadow-dialog transition-colors duration-150`;function W_({bubble:e,leaving:t}){return(0,H.jsx)(`span`,{className:`${U_} ${t?`motion-safe:animate-sink-out`:`motion-safe:animate-bubble-in`} ${e.armed?`border-accent`:`border-line`}`,children:e.text?(0,H.jsx)(`span`,{className:`flex max-h-[5.8em] min-w-0 flex-1 flex-col justify-end overflow-hidden font-sans text-display leading-[1.45] transition-colors duration-150 motion-safe:animate-fade-in ${e.waiting?`text-muted`:`text-ink`}`,children:(0,H.jsx)(`span`,{children:B_(e.text).map((e,t)=>(0,H.jsx)(`span`,{className:`motion-safe:animate-fade-in`,children:e},t))})},`words`):(0,H.jsx)(`span`,{className:`flex min-w-0 flex-1 text-accent`,children:(0,H.jsx)(V_,{level:e.level,seconds:e.seconds,wide:!0})},`wave`)})}var G_=`flex min-w-0 flex-1 items-center gap-2.5 motion-safe:animate-fade-in`;function K_(e){let{state:t}=e,n=t.phase===`recording`,r=t.phase===`transcribing`,i=e.slide!==void 0,a=n&&t.held,o=(0,h.useRef)(``);n&&(o.current=t.partial);let{shown:s,leaving:c}=z_(i&&(a||(n||r)&&o.current!==``)?{text:o.current,armed:a&&t.armed,waiting:!a,level:t.level,seconds:t.seconds}:null,140),l=s&&(0,H.jsx)(W_,{bubble:s,leaving:c}),u=(0,H.jsxs)(`span`,{className:`${G_} justify-center gap-2 text-body`,children:[e.working.replace(/…$/,``),(0,H.jsx)(H_,{})]},`working`);return r||n&&i&&!a?(0,H.jsxs)(H.Fragment,{children:[l,u]}):n?(0,H.jsxs)(H.Fragment,{children:[l,(0,H.jsxs)(`span`,{className:G_,children:[(0,H.jsx)(`span`,{className:`size-2 flex-none rounded-full bg-current`,style:{opacity:.3+Math.min(1,t.level*10)*.7}}),(0,H.jsx)(`span`,{className:`flex-none font-mono text-body normal-nums`,children:t.time}),i?(0,H.jsxs)(`span`,{className:`ml-auto flex flex-none items-center gap-1 text-body motion-safe:animate-fade-in ${t.armed?`font-semibold`:`opacity-80`}`,children:[(0,H.jsx)(`svg`,{viewBox:`0 0 16 16`,className:`size-4 flex-none fill-none stroke-current stroke-[1.5]`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:I_})}),t.armed?e.release:e.slide]},String(t.armed)):t.partial?(0,H.jsx)(`span`,{className:`flex min-w-0 flex-1 justify-end overflow-hidden whitespace-nowrap text-meta`,children:t.partial}):(0,H.jsx)(V_,{level:t.level,seconds:t.seconds})]},`take`)]}):(0,H.jsxs)(H.Fragment,{children:[l,(0,H.jsxs)(`span`,{className:`${G_} justify-center gap-2 text-display`,children:[(0,H.jsx)(`span`,{className:`flex text-muted`,children:(0,H.jsx)(P_,{d:F_})}),e.idle]},`idle`)]})}function q_({state:e}){return e.phase===`recording`?(0,H.jsx)(`span`,{className:`font-mono text-meta normal-nums`,children:e.time}):e.phase===`transcribing`?(0,H.jsx)(`span`,{className:`font-mono text-meta`,children:`…`}):(0,H.jsx)(P_,{d:F_})}function J_(e){return e.hold?(0,H.jsx)(K_,{state:e.state,idle:e.idle,working:e.working}):(0,H.jsx)(q_,{state:e.state})}function Y_(e){return(0,H.jsxs)(`form`,{className:b_,"data-composer":e.composerKey,onSubmit:t=>{t.preventDefault(),e.onSend()},children:[e.attached&&(0,H.jsx)(`div`,{className:x_,children:e.attached}),e.suggest&&(0,H.jsx)(`div`,{className:S_,children:e.suggest}),(0,H.jsxs)(`div`,{className:C_,children:[e.attach,e.voice??(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:w_,children:[(0,H.jsx)(`textarea`,{ref:e.fieldRef,className:T_,rows:1,value:e.value,placeholder:e.placeholder,disabled:e.busy,enterKeyHint:`send`,onChange:e.onChange,onSelect:e.onSelect,onKeyDown:e.onKeyDown,onPaste:e.onPaste,onBlur:e.onBlur}),e.dictate]}),(0,H.jsx)(R_,{label:e.sendLabel,disabled:e.busy||!e.ready})]})]})]})}var X_=`/dictation-worklet.js`,Z_=60,Q_=16e3,$_=.004,ev={phase:`idle`,seconds:0,level:0,error:null,partial:``},tv=1e3,nv=class{step;emitted=0;consumed=0;constructor(e){this.step=e}push(e){let t=e.reduce((e,t)=>e+t.length,0),n=new Float32Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;let i=this.consumed+t,a=[];for(let e=Math.floor(this.emitted*this.step);e<i;e=Math.floor(this.emitted*this.step)){let t=Math.max(-1,Math.min(1,n[e-this.consumed]??0));a.push(Math.round(t*32767)),this.emitted++}return this.consumed=i,Int16Array.from(a)}};function rv(e){let t=new Uint8Array(e.length*2),n=new DataView(t.buffer);for(let t=0;t<e.length;t++)n.setInt16(t*2,e[t],!0);return t}function iv(e,t){let n=new nv(t/Q_).push(e),r=Math.max(1,n.length),i=new Uint8Array(44+r*2),a=new DataView(i.buffer),o=(e,t)=>{for(let n=0;n<t.length;n++)a.setUint8(e+n,t.charCodeAt(n))};return o(0,`RIFF`),a.setUint32(4,36+r*2,!0),o(8,`WAVEfmt `),a.setUint32(16,16,!0),a.setUint16(20,1,!0),a.setUint16(22,1,!0),a.setUint32(24,Q_,!0),a.setUint32(28,Q_*2,!0),a.setUint16(32,2,!0),a.setUint16(34,16,!0),o(36,`data`),a.setUint32(40,r*2,!0),i.set(rv(n),44),i}function av(e){for(let t of e.getTracks())t.stop();return null}function ov(e){let t=Array(e.length);for(let n=0;n<e.length;n++)t[n]=e[n].toString(16).padStart(2,`0`);return t.join(``)}var sv=class{client;scope;view=v(ev);stream=null;context=null;node=null;chunks=[];timer=null;capTimer=null;peak=0;recent=0;session=0;live=null;liveTimer=null;constructor(e,t){this.client=e,this.scope=t}get recording(){return this.view.get().phase===`recording`}async toggle(){return this.recording?this.stop():this.start()}async start(e=!1){if(this.view.get().phase!==`idle`&&this.view.get().phase!==`error`)return null;let t=++this.session;this.live=null,this.view.set({...ev,phase:`recording`});try{let n=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0}});if(t!==this.session)return av(n);this.stream=n;let r=new AudioContext;if(this.context=r,await r.audioWorklet.addModule(X_),t!==this.session)return null;let i=r.createMediaStreamSource(n);this.node=new AudioWorkletNode(r,`rove-capture`),this.chunks=[],this.peak=0,this.recent=0,this.node.port.onmessage=e=>{let t=e.data;this.chunks.push(t);let n=0;for(let e=0;e<t.length;e++)n+=t[e]*t[e];let r=Math.sqrt(n/Math.max(1,t.length));this.peak=Math.max(this.peak,r),this.recent=Math.max(this.recent,r)},i.connect(this.node);let a=r.createGain();a.gain.value=0,this.node.connect(a),a.connect(r.destination);let o=Date.now();return this.timer=window.setInterval(()=>{this.view.set({...this.view.get(),seconds:(Date.now()-o)/1e3,level:this.recent}),this.recent=0},100),this.capTimer=window.setTimeout(()=>void this.stop(),Z_*1e3),e&&(this.live={id:`${Date.now().toString(36)}${Math.random().toString(36).slice(2,10)}`,resample:new nv(r.sampleRate/Q_),sent:0,seq:0,inFlight:null,dead:!1},this.liveTimer=window.setInterval(()=>void this.pump(!1),tv)),null}catch(e){return t===this.session?(this.release(),this.fail(e),null):null}}async pump(e){let t=this.live;if(!t||t.dead||t.inFlight&&!e||(t.inFlight&&await t.inFlight.catch(()=>{}),t.dead))return null;let n=this.chunks.slice(t.sent);t.sent+=n.length;let r=t.seq++,i=r===0?this.scope():null,a=this.client.request(`voice.stream`,{session:t.id,seq:r,pcm:ov(rv(t.resample.push(n))),final:e,...i?{context:i.draft,taskId:i.taskId,tabId:i.tabId}:{}});t.inFlight=a;try{let n=await a;if(e)return n;let r=this.view.get();this.live===t&&r.phase===`recording`&&typeof n.partial==`string`&&this.view.set({...r,partial:n.partial})}catch{t.dead=!0}finally{t.inFlight===a&&(t.inFlight=null)}return null}async stop(){if(this.view.get().phase!==`recording`)return null;let e=this.context?.sampleRate??Q_,t=this.chunks;this.view.set({...this.view.get(),phase:`transcribing`,level:0}),this.release();let n=iv(t,e),r=(n.length-44)/2/Q_;if(r<.3||this.peak<$_)return this.live=null,this.view.set(ev),{text:``,seconds:r,ms:0,reason:`silent`};try{let e=this.live?await this.pump(!0):null;this.live=null;let t=e??await this.transcribeWhole(n);return this.view.set(ev),t}catch(e){return this.live=null,this.fail(e),null}}transcribeWhole(e){let t=this.scope();return this.client.request(`voice.transcribe`,{wav:ov(e),context:t.draft,taskId:t.taskId,tabId:t.tabId})}fail(e){this.view.set({...ev,phase:`error`,error:e instanceof Error?e.message:String(e)})}cancel(){this.view.get().phase===`recording`&&(this.release(),this.live=null,this.view.set(ev))}release(){this.session++,this.timer!==null&&window.clearInterval(this.timer),this.capTimer!==null&&window.clearTimeout(this.capTimer),this.liveTimer!==null&&window.clearInterval(this.liveTimer),this.timer=null,this.capTimer=null,this.liveTimer=null,this.node?.port.close(),this.node=null;for(let e of this.stream?.getTracks()??[])e.stop();this.stream=null,this.context?.close().catch(()=>{}),this.context=null}},cv=e=>`0:${String(Math.floor(e)).padStart(2,`0`)}`,lv=300,uv=48,dv=()=>navigator.vibrate?.(8),fv=new WeakMap,pv=new WeakSet;function mv(e){let t=fv.get(e);return t||(t=v(null),fv.set(e,t)),t}function hv(e,t){mv(e).set(t)}var gv=e=>e.available??(e.ready===!0||(e.model??null)!==null);function _v(e){let t=mv(e),n=y(t);return(0,h.useEffect)(()=>{pv.has(e)||(pv.add(e),e.onOpen(()=>{e.request(`voice.status`).then(e=>t.set(gv(e)),()=>t.set(!1))}))},[e,t]),n}var vv=e=>lu()&&mv(e).get()!==!1;function yv(e){V();let t=(0,h.useRef)(e);t.current=e;let n=(0,h.useRef)(null);n.current===null&&(n.current=new sv(e.client,()=>t.current.context()));let r=y(n.current.view),i=_v(e.client),a=(0,h.useRef)(null),o=(0,h.useRef)(!1),[s,c]=(0,h.useState)(null);(0,h.useEffect)(()=>()=>{a.current&&window.clearTimeout(a.current.timer),n.current?.cancel()},[]);let l=(e,n)=>{if(!e?.text)return;let{onSend:r,onText:i}=t.current;n&&r?r(e.text):i(e.text)},u=()=>void n.current?.toggle().then(e=>l(e,!1)),d=e=>{if(e.button!==0)return;e.currentTarget.setPointerCapture(e.pointerId);let t={y:e.clientY,timer:0,held:!1,armed:!1,started:null};(r.phase===`idle`||r.phase===`error`)&&(t.timer=window.setTimeout(()=>{t.held=!0,t.started=n.current?.start(!0)??null,c({armed:!1}),dv()},lv)),a.current=t},f=e=>{let n=a.current;if(!n?.held||!t.current.onSend)return;let r=n.y-e.clientY>uv;r!==n.armed&&(n.armed=r,c({armed:r}),dv())},p=async()=>{let e=a.current;if(a.current=null,e){if(window.clearTimeout(e.timer),o.current=e.held,!e.held)return t.current.onTap?void 0:u();c(null),await e.started,l(await n.current?.stop()??null,e.armed)}},m=async()=>{let e=a.current;a.current=null,e&&(window.clearTimeout(e.timer),e.held&&(c(null),await e.started,n.current?.cancel()))},g=r.phase===`recording`?B(s?`voice.release`:`voice.stop`,{time:cv(r.seconds)}):r.phase===`transcribing`?B(`voice.working`):e.idle??B(`voice.say`),_=r.phase===`recording`,v=s?.armed??!1;return i===!0?(0,H.jsx)(`button`,{type:`button`,className:`${(e.look??nm)(_,v)} ${rm}`,disabled:e.disabled||r.phase===`transcribing`,title:r.error??B(`voice.hint`),"aria-label":e.face?g:void 0,onPointerDown:d,onPointerMove:f,onPointerUp:()=>void p(),onPointerCancel:()=>void m(),onContextMenu:e=>e.preventDefault(),onClick:t=>{let n=o.current;if(o.current=!1,e.onTap)return n?void 0:e.onTap();t.detail===0&&u()},children:e.face?e.face({phase:r.phase,time:cv(r.seconds),seconds:r.seconds,level:r.level,held:s!==null,armed:v,partial:r.partial}):(0,H.jsxs)(H.Fragment,{children:[g,_&&(0,H.jsx)(`span`,{className:`inline-flex items-center`,"aria-hidden":`true`,children:(0,H.jsx)(`span`,{className:`size-1.5 rounded-full bg-current`,style:{opacity:.25+Math.min(1,r.level*12)*.75}})})]})}):null}function bv(e,t){I(e,void 0,t)}function xv(){I(void 0,void 0,void 0,void 0,!0)}var Sv=`rove.web.newSession.worktree`;function Cv({model:e,seed:t}){let n=t.repo;V();let r=y(e.selection).taskId,i=e.tasks.get()?.tasks.find(e=>e.id===r)?.repo,a=Zu(e,n??i,t.engine),o=X(e,`repos.list`)?.repos,s=e=>t.ungrouped?void 0:(t.machine?void 0:n)??i??e?.[0],[c,l]=(0,h.useState)(o??[]),[u,d]=(0,h.useState)(()=>X(e,`fs.subdirs`,{path:`~/`})?.home??``),[f,p]=(0,h.useState)(()=>n_(s(o),t)),[m,g]=(0,h.useState)(()=>Object.fromEntries(f.flatMap(t=>{let n=X(e,`repo.probe`,{path:t});return n?[[t,n]]:[]}))),_=(0,h.useRef)(new Set),[v,b]=(0,h.useState)(t.ungrouped===!0),[x,S]=(0,h.useState)(null),C=()=>{b(!0),p([]),S(null)},[w,T]=(0,h.useState)(()=>r_(s(o),t)),[E,D]=(0,h.useState)(``),[O,k]=(0,h.useState)(``),[A,j]=(0,h.useState)(()=>(t.prompt!==void 0&&gg(t.prompt),hg())),M=e=>{gg(e),j(e)},[N,P]=(0,h.useState)(``),[ee,I]=(0,h.useState)(!1),[te,ne]=(0,h.useState)(``),[re,ie]=(0,h.useState)(()=>t.worktree??localStorage.getItem(Sv)!==`0`),ae=e=>{localStorage.setItem(Sv,e?`1`:`0`),ie(e)},[oe,R]=(0,h.useState)(null),z=(0,h.useRef)(()=>{}),{attachments:se,attach:ce,remove:le,ready:ue,clear:de}=ou(e,R,pg),fe=(0,h.useRef)(null),pe=_v(e.client),me=lu()&&pe===!0,he=e=>{let t=fe.current,n=t?.selectionStart??A.length,r=t?.selectionEnd??A.length,i=n>0&&!/\s$/.test(A.slice(0,n))?` `:``;M(`${A.slice(0,n)}${i}${e}${A.slice(r)}`);let a=n+i.length+e.length;requestAnimationFrame(()=>{me||t?.focus(),t?.setSelectionRange(a,a)})},_e=eg(e,{machine:t.machine,repo:n},a),{machines:ve,machine:ye,remote:be,machineName:xe,remoteList:Se,engineThere:Ce,shown:we}=_e,{pick:Te,setPick:Ee,base:De,setBase:Oe}=_e,ke=be?null:Ql(e=>void ce(e)),Ae=we.engine;(0,h.useEffect)(()=>e.client.onOpen(()=>{Promise.all([Ku(e,`repos.list`),Ku(e,`fs.subdirs`,{path:`~/`})]).then(([e,n])=>{l(e.repos),d(n.home);let r=s(e.repos);p(e=>e.length>0||!r?e:n_(r,t)),T(e=>({...e,...r_(r,t)}))}).catch(()=>{})}),[e,n]);let je=f.some(e=>m[e]?.git===!1),Me=!be&&(!re||je)&&f.length===1,Ne=f[0]??``;(0,h.useEffect)(()=>{for(let t of f)_.current.has(t)||(_.current.add(t),Ku(e,`repo.probe`,{path:t}).then(e=>g(n=>({...n,[t]:e}))).catch(()=>{}))},[e,f]),(0,h.useEffect)(()=>{vv(e.client)||fe.current?.focus()},[e.client]);let Pe=!be&&!v&&!Me,Fe=_g(we,Pe),Ie=a.engines.find(e=>e.id===Ae),Le=we.engines.find(e=>e.id===Ae)?.name??Ae,Re=Ou(Ie,B(`newSession.modelDefault`)),ze=Re.some(e=>e.id===N)?N:``,Be=async t=>{ne(B(`newSession.cloning`,{source:t}));let n=await e.client.request(`repo.clone`,{url:t},ne);return l(e=>e.includes(n.path)?e:[...e,n.path]),p([n.path]),S(null),n.path},Ve=async()=>{if(!Te)return R(B(`newSession.needRepo`));if(!A.trim())return R(B(`newSession.needPrompt`));let n=we.missing?.has(Ae)&&Le;if(n)return R(B(`newSession.engineMissingOn`,{engine:n,machine:xe}));I(!0),ne(Te.clone?B(`newSession.cloningOn`,{source:nh(Te.ref),machine:xe}):B(`newSession.startingOn`,{machine:xe}));try{let n=await sg(e,{pick:Te,machine:ye,engine:Ae,prompt:A.trim(),baseRef:De,engineThere:Ce,model:ze});gg(``),F.set(null),n&&e.selectWhenListed(n),t.retryOf&&n&&s_(e,t.retryOf)}catch(e){R(lg(e))}finally{I(!1),ne(``)}},He=async n=>{if(z.current=()=>void He(n),R(null),be)return Ve();if(!Ne&&!v&&!x)return R(B(`newSession.needRepo`));if(!A.trim())return R(B(`newSession.needPrompt`));I(!0);let r=tu(A.trim(),await ue());try{let i=x?[await Be(x)]:f,a=await Promise.all(i.map(t=>e.client.request(`repo.probe`,{path:t}))),o=a.find(e=>!e.ok);if(o)throw Error(o.reason??o.repo);let s=a.some(e=>e.git===!1);if(s&&a.length>1)throw Error(B(`newSession.plainMulti`));let c,l;if(v)c=await Lu(e.client.request.bind(e.client),Ae,A,ze);else if(i.length===1&&!re||s)c=await Ru(e.client.request.bind(e.client),a[0]?.repo??i[0]??``,Ae,A,r,n,ze);else{let o=a_(t,Ae),s=_e.auto&&!n&&i.length===1&&Fe.ids.length<=1&&se.length===0&&!o,u=await e.client.request(`task.spawn`,{...Iu({repos:i.map((e,t)=>({repo:a[t]?.repo??e,baseRef:w[e]??``})),branch:E.trim(),engine:Ae,commandFrom:o,engines:n?[]:Fe.ids,prompt:r,...n?{at:n}:{},model:ze}),...s?{machine:Kh}:{}});u.machine&&L(B(`newSession.startedOn`,{machine:u.machine})),c=u.taskIds[0],l=u.groupId}n&&L(B(`newSession.laterSet`,{time:wg(n)})),gg(``),de(),F.set(null),l?ge(l):c&&e.selectWhenListed(c),t.retryOf&&c&&s_(e,t.retryOf)}catch(e){let t=Mu(e);t?(gg(``),de(),F.set(null),L(e instanceof Error?e.message:String(e),`error`),ge(t)):R(lg(e))}finally{I(!1),ne(``)}},Ue=y_({value:A,onChange:M,area:fe,onEnter:()=>void He()}),We=e=>{_e.switchTo(e,Ne),k(``),R(null),b(!1)};return(0,H.jsxs)(`div`,{className:Vp,children:[(0,H.jsxs)(`div`,{className:Hp,children:[(0,H.jsx)(Qg,{}),(0,H.jsx)(`h1`,{className:`m-0 font-sans text-title font-semibold text-accent`,children:B(`newSession.title`)}),(0,H.jsx)(`p`,{className:`m-0 text-muted narrow:hidden`,children:B(`newSession.tagline`)})]}),(0,H.jsxs)(`form`,{className:Up,onSubmit:e=>{e.preventDefault(),He()},children:[(0,H.jsxs)(`div`,{className:Gp,...ke?.drop,children:[!be&&(0,H.jsx)(su,{attachments:se,onRemove:le}),(0,H.jsx)(`textarea`,{ref:fe,className:qp,rows:4,spellCheck:!1,placeholder:B(`newSession.placeholder`),value:A,disabled:ee,onPaste:ke?.onPaste,...Ue.field}),Ue.list,(0,H.jsxs)(`div`,{className:Kp,children:[ke&&(0,H.jsxs)($l,{className:(me?j_:Zp)(se.length>0),title:B(`newSession.attachHint`),disabled:ee,onFiles:ce,children:[(0,H.jsx)(`span`,{className:`sr-only`,children:B(`newSession.attach`)}),(0,H.jsx)(L_,{})]}),(0,H.jsx)(yv,{client:e.client,context:()=>({draft:[A.slice(-300),Ne,E,Te?.ref??``].filter(Boolean).join(`
44
+ `)}),onText:he,disabled:ee,look:me?N_:Zp,idle:me?B(`voice.hold`):void 0,face:e=>(0,H.jsx)(J_,{state:e,hold:me,idle:B(`voice.hold`),working:B(`voice.working`)})}),!me&&(0,H.jsx)(`span`,{className:`flex-1`}),me&&(0,H.jsx)(R_,{label:B(`newSession.start`),disabled:ee}),!me&&(0,H.jsx)(`button`,{type:`submit`,className:xr(),disabled:ee,children:B(`newSession.start`)})]})]}),(0,H.jsxs)(`div`,{className:Jp,children:[(0,H.jsxs)(`div`,{className:Yp,children:[ve.length>0&&(0,H.jsx)(ig,{machines:ve,value:_e.auto?`auto`:ye,onPick:We}),(0,H.jsx)(Zm,{field:`repo`,title:!be&&f.length>1?B(`newSession.repoCount`,{count:f.length}):B(`newSession.repo`),label:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(ym,{}),(0,H.jsx)(`span`,{className:fm,children:(be?Te?.clone?nh(Te.ref):Nu(Te?[Te.ref]:[]):x?nh(x):Nu(f))||B(v?`newSession.noFolder`:`newSession.repo`)})]}),children:t=>(0,H.jsx)(e_,{model:e,saved:be?Se.repos.map(rh):c,picked:be?Te?[Te.ref]:[]:f,primary:be?``:Ne,home:be?``:u,query:O,onQuery:k,onToggle:(e,n)=>{if(R(null),!be)return b(!1),S(null),n?p(t=>Pu(t,e)):(p([e]),t());Ee({ref:e,clone:!1}),t()},onClone:e=>{if(R(null),be)return Ee({ref:e,clone:!0});S(e),p([]),b(!1),k(``)},cloning:be?void 0:x??void 0,close:t,remote:be?{name:xe,empty:ng(ye,Se),blocked:Se.problem!==``}:void 0,ungrouped:be?void 0:{on:v,pick:C}})}),(0,H.jsx)(dg,{remote:be,remotePick:Te,remoteBase:De,onRemoteBase:Oe,ungrouped:v,inPlace:Me,plain:je,onToggleWorktree:()=>ae(!re),repos:f,probes:m,bases:w,onBase:(e,t)=>T(n=>({...n,[e]:t})),branchName:E,onBranchName:D})]}),(0,H.jsxs)(`div`,{className:Xp,children:[(0,H.jsx)(vg,{choice:we,picks:Fe,available:Pe,missing:we.missing}),!(be&&Ce)&&!Fe.comparing&&Re.length>0&&(0,H.jsx)(yg,{models:Re,model:ze,onModel:P}),(0,H.jsx)(Eg,{busy:ee,onLater:!be&&!v&&!Fe.comparing?e=>void He(e):void 0,onInvalid:R,agentPlace:be?{machine:xe,there:Ce,onPick:_e.setEngineThere}:void 0})]})]}),(0,H.jsx)(cg,{progress:ee?te:``,error:oe,busy:ee,onRetry:()=>z.current()})]})]})}var wv=[`needs`,`working`,`ready`,`idle`],Tv=`~state:`;function Ev(e){switch(e.rowStatus?.kind){case`attention`:case`needs-input`:case`unseen`:return`needs`;case`busy`:case`running`:return`working`}switch(e.group){case`waiting-on-you`:return`needs`;case`working`:return`working`;case`landing`:case`ready-for-review`:return`ready`}return e.pr?.lifecycle===`open`||e.status===`done`?`ready`:`idle`}var Dv=e=>e&&!Ad(e)?dd(e.repo):void 0;function Ov(e,t){let n=jd(e,t.sort),{children:r,nested:i}=Id([{repo:``,label:``,tasks:n}]),a=n.filter(e=>!i.has(e.id)),o=vd(a),s=e=>{let t=[],n=new Set,i=e=>{if(!n.has(e.id)){n.add(e.id),t.push(e);for(let t of r.get(e.id)??[])i(t)}};return i(e),t},c=new Map;for(let e of a){let t=_d(e),n=((t===null?void 0:o.get(t))??[e]).map(s),r=n.flat().map(Ev).reduce((e,t)=>wv.indexOf(t)<wv.indexOf(e)?t:e);for(let e of n)for(let t of e)c.set(t.id,r)}return wv.flatMap(e=>{let t=n.filter(t=>c.get(t.id)===e);return t.length===0?[]:[{repo:``,label:B(`rail.state.${e}`),key:`${Tv}${e}`,tasks:t}]})}function kv(e){let t=new Set(e.machines.map(e=>e.alias));return{rows:Av(zd(Ov([...e.tasks.filter(e=>!e.routine),...e.remote.filter(e=>!e.routine&&e.machine!==void 0&&t.has(e.machine.id))],e),e.query,e.fold).map(e=>{if(e.kind!==`project`)return e;let t=e.id.slice(`project:${Tv}`.length);return{id:`state:${t}`,kind:`state`,state:t,label:e.label,count:0}})),groups:[]}}function Av(e){let t=new Map,n=``;for(let r of e)r.kind===`state`?n=r.id:r.kind===`task`&&t.set(n,(t.get(n)??0)+1);return e.map(e=>e.kind===`state`?{...e,count:t.get(e.id)??0}:e)}var jv=new Set([`refused`,`timeout`,`host-key-changed`,`host-key-unverified`,`auth-denied`,`unresolved`,`ssh-failed`,`no-rove`,`no-daemon`,`bad-status`,`handshake`,`no-forwarding`,`lost`]);function Mv(e){return e&&jv.has(e)?`machines.reason.${e}`:null}function Nv(e,t){return e.filter(e=>e.machine?.id===t&&!e.routine&&!e.deleting)}function Pv(e){let t=wv.map(e=>({state:e,tasks:[]}));for(let n of e)t[wv.indexOf(Ev(n))]?.tasks.push(n);return t.filter(e=>e.tasks.length>0)}var Fv=`flex flex-col font-mono text-meta`,Iv=`flex flex-col gap-1 border-t-hairline border-line py-2.5 first:border-t-0 first:pt-0`,Lv=`flex flex-wrap items-baseline gap-x-2.5 gap-y-0.5`,Rv=`min-w-0 text-ink wrap-anywhere`,zv=`m-0 text-muted wrap-anywhere`,Bv=`flex flex-wrap gap-x-3.5 gap-y-1 pt-0.5 whitespace-nowrap`,Vv=`mt-1.5 mb-0.5 text-subtle`,Hv=`flex min-w-0 items-baseline gap-2 pl-2`,Uv=`min-w-0 flex-1 truncate text-left`,Wv=`min-w-0 max-w-[55%] flex-none truncate text-muted`;function Gv(e){C.set((0,H.jsx)(Yv,{model:e}))}function Kv({model:e,tasks:t}){let n=t=>{z(),e.select(t.id),pe()};return Pv(t).map(e=>(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`${Vv} m-0`,children:B(`rail.state.${e.state}`)}),e.tasks.map(e=>(0,H.jsxs)(U,{variant:`row`,className:`${Hv} w-full rounded-sm py-0.5 hover:bg-hover`,onClick:()=>n(e),children:[(0,H.jsx)(`span`,{className:Uv,children:e.label}),(0,H.jsx)(`span`,{className:Wv,children:e.branch})]},e.id))]},e.state))}function qv({model:e,alias:t}){let[n,r]=(0,h.useState)(null);return(0,h.useEffect)(()=>{let n=!0;return Ku(e,`machines.repos`,{machine:t}).then(e=>n&&r(e),e=>n&&r({failed:e instanceof Error?e.message:String(e)})),()=>{n=!1}},[e,t]),n?`failed`in n?(0,H.jsx)(`p`,{className:zv,children:B(`machines.reposFailed`,{message:n.failed})}):n.reason?(0,H.jsx)(`p`,{className:zv,children:B(`machines.reposFailed`,{message:n.message??n.reason})}):n.repos.length===0?(0,H.jsx)(`p`,{className:zv,children:B(`machines.noRepos`)}):n.repos.map(e=>(0,H.jsxs)(`div`,{className:Hv,children:[(0,H.jsx)(`span`,{className:Uv,children:e.id}),(0,H.jsx)(`span`,{className:Wv,title:e.primary??e.checkouts[0],children:e.primary??e.checkouts[0]??``})]},e.id)):(0,H.jsx)(`p`,{className:zv,children:B(`machines.loading`)})}function Jv(e){let{model:t,row:n,tasks:r,words:i}=e,[a,o]=(0,h.useState)(null),s=n.state===`online`,c=Mv(n.reason),l=Pv(r).map(e=>`${e.tasks.length} ${B(`rail.state.${e.state}`)}`),u=e=>o(a===e?null:e),[d,f]=(0,h.useState)({busy:!1});return(0,H.jsxs)(`section`,{className:Iv,children:[(0,H.jsxs)(`div`,{className:Lv,children:[(0,H.jsx)(`span`,{className:`${Rv} ${s?``:lp.warning}`,children:Gm(n,i)}),(0,H.jsx)(`span`,{className:`text-muted`,children:l.length>0?l.join(` · `):B(`machines.noTasks`)})]}),c&&(0,H.jsx)(`p`,{className:`m-0 text-muted wrap-anywhere`,children:B(c)}),(d.busy||d.note)&&(0,H.jsx)(`p`,{className:`m-0 text-muted wrap-anywhere`,children:d.busy?B(`machines.updating`):d.note}),(0,H.jsxs)(`div`,{className:Bv,children:[n.behind&&(0,H.jsx)(U,{hit:`tight`,disabled:d.busy,onClick:()=>{f({busy:!0}),t.client.request(`machines.update`,{machine:n.alias}).then(e=>f({busy:!1,note:e.ok?B(e.result.changed?`machines.updated`:`machines.upToDate`,{from:e.result.from??`?`,to:e.result.to??`?`}):B(`machines.updateFailed`,{message:e.message})}),e=>f({busy:!1,note:B(`machines.updateFailed`,{message:e instanceof Error?e.message:String(e)})}))},children:B(`machines.update`)}),s&&(0,H.jsx)(U,{hit:`tight`,onClick:()=>{z(),bv(void 0,n.alias)},children:B(`machines.newHere`)}),r.length>0&&(0,H.jsx)(U,{hit:`tight`,"aria-expanded":a===`tasks`,onClick:()=>u(`tasks`),children:B(a===`tasks`?`machines.hide`:`machines.tasks`)}),s&&(0,H.jsx)(U,{hit:`tight`,"aria-expanded":a===`repos`,onClick:()=>u(`repos`),children:B(a===`repos`?`machines.hide`:`machines.repos`)})]}),a===`tasks`&&(0,H.jsx)(Kv,{model:t,tasks:r}),a===`repos`&&(0,H.jsx)(qv,{model:t,alias:n.alias})]})}function Yv({model:e}){let t=V(),n=Xm(e),r=y(e.remote),i=(t===`zh`?Gi:Wi).machine;return(0,H.jsx)(Si,{title:B(`machines.title`),wide:!0,children:(0,H.jsxs)(`div`,{className:`${Gr} ${Fv}`,children:[n.length===0&&(0,H.jsx)(`p`,{className:`m-0 text-muted wrap-anywhere`,children:B(`machines.none`)}),n.map(t=>(0,H.jsx)(Jv,{model:e,row:t,tasks:Nv(r,t.alias),words:i},t.alias))]})})}function Xv(e,t,n=300){let r=0,i,a=()=>{r++,i?.(),i=void 0};return{stop:a,run:o=>{a();let s=o.trim();if(s.length<2){t({kind:`idle`});return}let c=r,l=setTimeout(()=>{t({kind:`searching`}),e(s).then(e=>c===r&&t({kind:`done`,query:s,reply:e}),e=>c===r&&t({kind:`failed`,message:e instanceof Error?e.message:String(e)}))},n);i=()=>clearTimeout(l)}}}var Zv=`mx-1.5 mt-2 mb-0.5 font-mono text-meta font-semibold normal-nums text-subtle first:mt-0`,Qv=`mx-1.5 my-1 text-meta text-muted [overflow-wrap:anywhere]`,$v=e=>`flex w-full min-w-0 cursor-pointer flex-col gap-0.5 rounded-sm px-1.5 py-1.5 text-left text-ink [font:inherit] touch:py-2.5 ${e?`is-selected bg-hover`:``}`,ey=`flex min-w-0 items-baseline gap-2`,ty=`min-w-0 flex-1 truncate text-body`,ny=`whitespace-nowrap text-meta text-muted`,ry=`text-meta text-muted [overflow-wrap:anywhere]`,iy=`rounded-xs bg-accent/25 text-ink`;function ay(e,t){let[n,r]=(0,h.useState)({kind:`idle`});return(0,h.useEffect)(()=>{let n=Xv(t=>e.client.request(`sessions.search`,{query:t}),r);return n.run(t),n.stop},[e,t]),n}function oy(e,t){let n=[],r=e.toLowerCase(),i=t.toLowerCase(),a=0;for(let t=r.indexOf(i);i&&t>=0;t=r.indexOf(i,t+i.length))t>a&&n.push(e.slice(a,t)),n.push({hit:e.slice(t,t+i.length),at:t}),a=t+i.length;return n.push(e.slice(a)),n.map(e=>typeof e==`string`?e:(0,H.jsx)(`mark`,{className:iy,children:e.hit},e.at))}function sy({children:e}){return(0,H.jsx)(`h3`,{className:Zv,children:e})}function cy({children:e,error:t}){return(0,H.jsx)(`p`,{className:`${Qv} ${t?`text-error`:``}`,children:e})}function ly(e){return(0,H.jsx)(U,{variant:`row`,className:$v(e.selected),onMouseEnter:e.onHover,onClick:e.onOpen,children:(0,H.jsxs)(`span`,{className:ey,children:[(0,H.jsx)(`span`,{className:ty,children:e.title}),(0,H.jsx)(`span`,{className:ny,children:e.repo})]})})}function uy(e){let{hit:t}=e;return(0,H.jsxs)(U,{variant:`row`,className:$v(e.selected),onMouseEnter:e.onHover,onClick:e.onOpen,children:[(0,H.jsxs)(`span`,{className:ey,children:[(0,H.jsx)(`span`,{className:ty,children:t.title}),(0,H.jsxs)(`span`,{className:ny,children:[B(t.role===`user`?`search.you`:`search.agent`),` · `,Ml(Date.now()-Date.parse(t.at))]})]}),(0,H.jsx)(`span`,{className:ry,children:oy(t.snippet,e.query)})]})}async function dy(e,t){let{taskId:n}=await e.client.request(`task.openScratch`);await ad(e,n,{kind:`engine`,prompt:t}),z()}function fy(e){return dy(e,B(`settings.feedback.reportPrompt`))}var py=v(`issues`);function my(e,t,n){return{repo:e.repo,baseBranch:t,prompt:n,worktree:!0}}function hy(e){let t=e.todos;return!t||t.length===0?null:{done:t.filter(e=>e.done).length,total:t.length}}function gy(e){return(e.todos??[]).filter(e=>!e.done)}var _y=/LAND_CONFLICT/,vy=/MAIN_CHECKOUT_DIRTY/,yy=/SYNC_CONFLICT(?:: )?(.*)/,by=/SYNC_WORKTREE_DIRTY(?:: )?(.*)/;function xy(e){let t=G(e);return _y.test(t)?q(`worktrees`,`land.conflict`,{files:t}):vy.test(t)?q(`worktrees`,`land.dirtyBase`):q(`worktrees`,`land.failed`,{error:t})}async function Sy(e,t,n){if(t.machine){Cy(e,t,t.machine.label,n);return}let r;try{r=await e.client.request(`task.landPreflight`,{taskId:t.id})}catch(e){L(q(`worktrees`,`land.failed`,{error:G(e)}),`error`);return}if(r.refusal){L(r.refusal===`MAIN_CHECKOUT_DIRTY`?q(`worktrees`,`land.dirtyBase`):q(`worktrees`,`land.failed`,{error:r.message??r.refusal}),`error`);return}let i=t.branch||t.title,a=gy(e.tasks.get()?.tasks.find(e=>e.id===t.id)??{}).length;C.set((0,H.jsx)(Ti,{title:q(`worktrees`,`land.confirmTitle`),body:[q(`worktrees`,r.ahead===1?`land.confirmBodyOne`:`land.confirmBody`,{branch:i,landedOn:r.landedOn,commits:r.ahead??`?`}),...a>0?[B(`files.landTodos`,{count:a})]:[]].join(`
45
45
 
46
- `),confirmLabel:q(`worktrees`,`land.button`),onConfirm:async()=>{try{let r=await e.client.request(`task.land`,{taskId:t.id});L(q(`worktrees`,`land.done`,{branch:i,landedOn:r.landedOn,commit:r.commit.slice(0,8)})),n?.()}catch(e){throw Error(Sy(e))}}}))}function wy(e,t,n,r){let i=t.branch||t.title;C.set((0,H.jsx)(Ti,{title:B(`taskops.publishTitle`),body:B(`taskops.publishBody`,{branch:i,host:n}),confirmLabel:B(`taskops.publishButton`),onConfirm:async()=>{let n=await e.client.request(`task.land`,{taskId:t.id}),a=n.published?.prUrl;a?L(B(`taskops.publishedPr`,{branch:i,url:a})):L(B(`taskops.publishedNoPr`,{branch:i,reason:Ey(n.published?.prError??``)}),`error`),r?.()}}))}async function Ty(e,t){try{let n=await e.client.request(`task.syncBase`,{taskId:t});L(q(`tasks`,n.alreadyCurrent?`sync.alreadyCurrent`:`sync.done`,{base:n.baseRef}))}catch(e){let t=G(e),n=by.exec(t),r=xy.exec(t);L(n?q(`tasks`,`sync.conflict`,{files:n[1]?.trim()||`?`}):r?q(`tasks`,`sync.dirty`,{files:r[1]?.trim()||`?`}):q(`tasks`,`sync.failed`,{error:t}),`error`)}}function Ey(e){return e.split(`
47
- `).find(e=>e.trim().length>0)?.trim()??e.trim()}async function Dy(e,t,n){try{let r=await e.client.request(`task.fixChecks`,e.engineTarget(t));r.outcome===`unavailable`?L(q(`files`,`toast.ciChecksUnavailable`,{detail:Ey(r.detail??``)}),`error`):r.outcome===`none`?L(q(`files`,`toast.ciNoFailingChecks`),`error`):L(n)}catch(e){L(G(e),`error`)}}async function Oy(e,t){try{let n=await e.client.request(`task.openEditor`,{taskId:t});n.outcome===`noEditor`?L(q(`tasks`,`toast.noEditor`),`error`):n.outcome===`failed`&&L(q(`tasks`,`toast.openWorktreeFailed`,{label:n.label??``}),`error`)}catch(e){L(Cm(e)?q(`tasks`,`toast.noDiskSpace`):q(`tasks`,`toast.worktreeErrorGeneric`,{message:G(e)}),`error`)}}function ky(e,t){let n=e.tasks.get();return[...n?.tasks??[],...n?.archived??[]].filter(e=>e.parentTaskId===t)}function Ay(e,t){let n=ky(e,t.id),r=n.length>0,i=n=>e.act(`task.delete`,{taskId:t.id,...n}).then(()=>{}),a=e=>`${q(`worktrees`,`delete.forceBody`,{branch:t.branch||t.title})}\n\n${q(`worktrees`,`delete.forceReason`,{reason:G(e).replace(`task ${t.id} `,``)})}`,o=async e=>{i(e).catch(n=>{if(e.force||!(n instanceof Uo)||n.code!==`DIRTY_WORKTREE`){L(G(n),`error`);return}C.set((0,H.jsx)(Ti,{title:q(`tasks`,`confirm.forceDeleteTitle`,{title:t.label}),body:a(n),confirmLabel:q(`tasks`,`confirm.forceDeleteConfirm`),onConfirm:()=>o({...e,force:!0})}))})};return(0,H.jsx)(Ti,{title:r?q(`tasks`,`confirm.childrenTitle`,{title:t.label,count:String(n.length)}):q(`tasks`,t.kind===`dir`?`confirm.deleteTitleDir`:`confirm.deleteTitle`,{title:t.label}),body:r?q(`tasks`,`confirm.childrenBody`):q(`tasks`,t.kind===`dir`?`confirm.deleteBodyDir`:`confirm.deleteBodyTask`),confirmLabel:q(`tasks`,r?`confirm.childrenPromote`:`confirm.deleteConfirm`),onConfirm:()=>o({}),...r?{secondary:{label:q(`tasks`,`confirm.childrenCascade`),onConfirm:()=>o({cascade:!0})}}:{}})}function jy(e,t){let n=ky(e,t.id),r=n.length>0,i=t.label,a=async()=>{let{tabs:n}=await e.client.request(`task.tabs`,{taskId:t.id});for(let r of n)await e.closeTab(t.id,r.id)},o,s=async t=>{for(let r of n)try{await e.act(`task.delete`,{taskId:r.id,cascade:!0,...t?{force:!0}:{}})}catch(e){throw o=r.title,e}await a()};return(0,H.jsx)(Ti,{title:r?q(`tasks`,`confirm.childrenTitle`,{title:i,count:String(n.length)}):q(`tasks`,`confirm.deleteTitleDir`,{title:i}),body:q(`tasks`,r?`confirm.childrenBodyMain`:`confirm.deleteBodyMain`),confirmLabel:q(`tasks`,r?`confirm.childrenKeepMain`:`confirm.deleteConfirm`),onConfirm:a,...r?{secondary:{label:q(`tasks`,`confirm.childrenCascadeMain`),onConfirm:()=>s(!1)}}:{},escalate:{when:e=>e instanceof Uo&&e.code===`DIRTY_WORKTREE`,label:q(`tasks`,`confirm.forceDeleteConfirm`),title:q(`tasks`,`confirm.forceDeleteTitle`,{title:i}),body:e=>`${q(`worktrees`,`delete.forceBody`,{branch:o??i})}\n\n${G(e)}`,run:()=>s(!0)}})}async function My(e,t){let n=t.archived!==!0,r=t.label,i=async i=>{await e.act(`task.archive`,{taskId:t.id,archived:n,...i?{force:!0}:{}}),L(q(`tasks`,n?`archive.done`:`archive.restored`,{title:r}))};try{await i(!1)}catch(e){if(n&&e instanceof Uo&&e.code===`TASK_BUSY`){C.set((0,H.jsx)(Ti,{title:q(`tasks`,`archive.busyTitle`),body:q(`tasks`,`archive.busyBody`,{title:r}),confirmLabel:q(`tasks`,`archive.busyConfirm`),onConfirm:()=>i(!0)}));return}L(q(`tasks`,n?`archive.failed`:`archive.restoreFailed`,{error:G(e)}),`error`)}}function Ny(e,t,n){return(0,H.jsx)(Ti,{title:q(`tasks`,`confirm.forgetProjectTitle`,{title:n}),body:q(`tasks`,`confirm.forgetProjectBody`),confirmLabel:q(`tasks`,`confirm.forgetProjectConfirm`),onConfirm:async()=>{try{await e.client.request(`project.forget`,{repo:t})}catch(e){throw Error(q(`tasks`,`toast.forgetProjectFailed`,{error:G(e)}))}}})}var Py=v(null),Fy=0;function Iy(e,t){Py.set({taskId:e,hit:t,nonce:++Fy}),Fc(e,`chat`),N.get()&&N.set(!1)}var Ly=10;function Ry(e,t){let n=e=>e.surface===t?0:e.surface?1:2,r=To().filter(n=>Eo(n,t)&&n.live?.(e)!==!1).map((e,t)=>({command:e,index:t})).sort((e,t)=>n(e.command)-n(t.command)||Number(e.command.prefix)-Number(t.command.prefix)||e.index-t.index),i=new Set,a=[];for(let{command:e}of r){let t=e.chords[0];!t||e.id===`palette.open`||i.has(e.id)||(i.add(e.id),a.push({command:e,name:Sl(e.id),raw:e.prefix?`${ga()} + ${t}`:t}))}return a}function zy(e){let t=document.activeElement instanceof HTMLElement?document.activeElement:null;C.set((0,H.jsx)(Vy,{model:e,surface:Oo(),origin:t}))}var By=8;function Vy({model:e,surface:t,origin:n}){V();let[r,i]=(0,h.useState)(``),[a,o]=(0,h.useState)(0),s=(0,h.useRef)(null),c=y(da),l=y(e.tasks),u=y(e.remote),d=(0,h.useMemo)(()=>Ry(e,t),[e,t,c]).filter(e=>ll(r,e.name,e.raw)),f=(Zm(e).length>0?[{name:B(`machines.title`)}]:[]).filter(e=>ll(r,e.name,``)),p=[{name:B(`settings.feedback.report`)}].filter(e=>ll(r,e.name,``)),m=r.trim(),g=m===``?[]:[...l?.tasks??[],...u,...l?.archived??[]].filter(e=>!e.routine&&!e.deleting&&[e.label,e.title,e.branch,dd(e.repo)].some(e=>e!==``&&$c(m,e))).slice(0,By),_=y(e.installedMods).has(`issues`),v=[{id:`usage`,name:B(`usage.title`)},..._?[{id:`issues`,name:B(`reviewQueue.palette`),source:`reviews`}]:[]].filter(e=>m===``||$c(m,e.name)),b=oy(e,r),x=b.kind===`done`?b.reply.matches:[],S=[...d.map(e=>({kind:`command`,row:e})),...v.map(e=>({kind:`page`,...e})),...f.map(e=>({kind:`machines`,...e})),...p.map(e=>({kind:`report`,...e})),...g.map(e=>({kind:`task`,task:e})),...x.map(e=>({kind:`hit`,hit:e}))],C=Math.min(a,Math.max(0,S.length-1));(0,h.useEffect)(()=>()=>n?.focus(),[n]),(0,h.useEffect)(()=>{s.current?.querySelector(`.is-selected`)?.scrollIntoView({block:`nearest`})},[C]);let w=t=>{if(t.kind===`machines`){Kv(e);return}if(z(),n?.focus(),t.kind===`report`){py(e).catch(()=>L(B(`settings.feedback.reportFailed`),`error`));return}if(t.kind===`command`){t.row.command.live?.(e)===!1?L(yl(`unavailable`),`error`):t.row.command.run(e);return}if(t.kind===`page`){t.source&&my.set(t.source),he(t.id);return}t.kind===`task`&&t.task.archived&&My(e,t.task),t.kind===`task`?e.select(t.task.id):e.select(t.hit.taskId,t.hit.tabId??null),pe(),t.kind===`hit`&&Iy(t.hit.taskId,t.hit)},T=e=>{if(e.key===`ArrowDown`)o(Math.min(S.length-1,C+1));else if(e.key===`ArrowUp`)o(Math.max(0,C-1));else if(e.key===`Enter`){let e=S[C];e&&w(e)}else return;e.preventDefault()},E=m!==``&&(g.length>0||m.length>=2),D=0,O=()=>D++;return(0,H.jsx)(Si,{title:yl(`palette`),wide:!0,children:(0,H.jsxs)(`div`,{className:`${Gr} palette`,onKeyDown:T,children:[(0,H.jsx)(`input`,{className:mn,autoFocus:!0,spellCheck:!1,value:r,placeholder:yl(`search`),onChange:e=>{i(e.target.value),o(0)}}),(0,H.jsxs)(`div`,{className:dn,ref:s,style:{maxHeight:`${(E?18:Ly)*1.9}em`},children:[S.length===0&&b.kind!==`searching`&&(0,H.jsx)(`p`,{className:`text-muted`,children:yl(`noResults`)}),E&&d.length>0&&(0,H.jsx)(cy,{children:B(`search.commands`)}),d.map(e=>{let t=O();return(0,H.jsx)(`button`,{type:`button`,className:fn(t===C),title:e.name,onMouseEnter:()=>o(t),onClick:()=>w({kind:`command`,row:e}),children:(0,H.jsx)(`span`,{className:pn,children:`${t===C?`› `:` `}${e.name}`})},e.command.id)}),v.map(e=>{let t=O();return(0,H.jsx)(U,{variant:`row`,className:fn(t===C),title:e.name,onMouseEnter:()=>o(t),onClick:()=>w({kind:`page`,...e}),children:(0,H.jsx)(`span`,{className:pn,children:`${t===C?`› `:` `}${e.name}`})},e.id)}),f.map(e=>{let t=O();return(0,H.jsx)(U,{variant:`row`,className:fn(t===C),title:e.name,onMouseEnter:()=>o(t),onClick:()=>w({kind:`machines`,...e}),children:(0,H.jsx)(`span`,{className:pn,children:`${t===C?`› `:` `}${e.name}`})},`machines`)}),p.map(e=>{let t=O();return(0,H.jsx)(U,{variant:`row`,className:fn(t===C),title:e.name,onMouseEnter:()=>o(t),onClick:()=>w({kind:`report`,...e}),children:(0,H.jsx)(`span`,{className:pn,children:`${t===C?`› `:` `}${e.name}`})},`report`)}),g.length>0&&(0,H.jsx)(cy,{children:B(`search.tasks`)}),g.map(e=>{let t=O();return(0,H.jsx)(uy,{title:e.label,repo:e.archived?B(`search.archived`,{repo:dd(e.repo)}):dd(e.repo),selected:t===C,onHover:()=>o(t),onOpen:()=>w({kind:`task`,task:e})},e.id)}),b.kind!==`idle`&&(0,H.jsx)(cy,{children:B(`search.inConversations`)}),b.kind===`searching`&&(0,H.jsx)(ly,{children:B(`search.searching`)}),b.kind===`failed`&&(0,H.jsx)(ly,{error:!0,children:b.message}),b.kind===`done`&&x.length===0&&(0,H.jsx)(ly,{children:B(`search.none`,{query:b.query})}),x.map(e=>{let t=O();return(0,H.jsx)(dy,{hit:e,query:b.kind===`done`?b.query:``,selected:t===C,onHover:()=>o(t),onOpen:()=>w({kind:`hit`,hit:e})},`${e.taskId}:${e.tabId??``}:${e.at}:${t}`)}),b.kind===`done`&&b.reply.truncated&&(0,H.jsx)(ly,{children:B(`search.truncated`)}),b.kind===`done`&&b.reply.skipped.length>0&&(0,H.jsx)(ly,{children:B(`search.skipped`,{count:b.reply.skipped.length})})]}),(0,H.jsx)(`p`,{className:`keys-only text-muted`,children:yl(`run`)})]})})}var Hy=v(null);function Uy(e){let t=(document.activeElement?.closest(`.rail`)==null?null:Hy.get())??e.selection.get().taskId;return e.tasks.get()?.tasks.find(e=>e.id===t)??null}var Wy=[`latest`,`next`,`nightly`],Gy={autoRouting:{title:`Auto routing`,hint:"Routing by depth: a task says how deep the work is — swift, standard, deep — and this table says which engine, model and reasoning effort that depth runs on. Pick a depth in the new-task dialog (or `rove api add --tier`) and Rove fills those three fields from the row; you still see them and can change them before the task starts. enter (or click) a row to point it somewhere else, with the same picker a task uses. A row whose target cannot start says why here, not at launch.",unconfigured:`Auto routing is off: a depth has nowhere to route — its engine is blank. Point it somewhere below, or remove the empty autoRouting.<tier>.engine from state.json.`,engineDefault:`engine default`,ready:`● ready`,unavailable:`! unavailable — {reason}`,classifierTitle:`Classifier`,classifierHint:"The rows above say what each depth RUNS. This says who CHOOSES one: switch it on and `rove api add --tier auto` reads the task's first message and picks the depth for you. It is off by default, it is never required, and it can never fail a create — no key, no network, a timeout, or an answer it is not confident enough about all leave you on the depth you would have had.",classifierDataFlow:"! Turning the classifier on sends the task's first message to a third party that is NOT the engine vendor you picked — TypeSafe System One for `jev`, or whatever address you point `custom` at. It reads the text before your engine does. Nothing leaves this machine while it is off.",classifierLabel:`Choose with`,classifierOff:`off`,classifierCustomLabel:`custom`,classifierOffHint:`— nothing is sent anywhere`,classifierJevHint:`— TypeSafe System One, billed to your own key`,classifierCustomHint:`— your endpoint: POST the text, answer with a depth and a confidence`,endpointLabel:`Endpoint`,endpointUnset:`(none — enter one, then set Choose with to custom)`,endpointTitle:`Custom classifier endpoint`,endpointField:`URL`,endpointInvalidTitle:`Not a URL`,endpointInvalidBody:`The endpoint has to start with https://, or http:// for a loopback address (127.0.0.1, localhost, ::1) — over a network, plain http would carry the task's first 1,200 characters in cleartext. Leave it empty to clear it.`,thresholdLabel:`Confidence floor`,thresholdHint:`— below this, the depth is left alone`,thresholdTitle:`Confidence floor`,thresholdField:`0 to 1`,thresholdInvalidTitle:`Not a confidence`,thresholdInvalidBody:`The floor is a number between 0 and 1. 0.5 is the shipped default.`,keyLabel:`API key`,keyStored:`stored {hint} — enter to replace, empty to clear`,keyFromEnv:"from ${env} — the environment wins over a stored key",keyNone:`not set — enter to paste one`,keyTitle:`{env}`,keyPlaceholder:`paste the key; leave empty to clear the stored one`,keySaved:`● key stored in ~/.rove/secrets.json (owner-only, never in state.json)`,keyCustomUnused:`● no Authorization header is sent to a custom endpoint — set autoRouting.classifierCustomKeyEnv to the variable holding its key if it needs one`,keyNoVariableTitle:`No key variable for this endpoint`,keyNoVariableBody:`A custom classifier endpoint is sent no Authorization header until autoRouting.classifierCustomKeyEnv names the variable its key lives in. Set that first — a key stored under a name nothing reads is a key at rest for no purpose.`,keyWriteFailedTitle:`Key not saved`,keyWriteFailedBody:`~/.rove/secrets.json could not be written: {reason}. Check directory permissions and disk space, then save again.`,keyMissing:`! no key — nothing is chosen and tasks keep their usual depth`,keyPresentEnv:"● key read from ${env} in this process's environment"}},Ky={autoRouting:{title:`自动路由`,hint:"按深度路由:任务说明这活有多深——轻快、标准、深入——这张表说明那一档跑在哪个引擎、哪个模型、哪个推理强度上。在新建任务对话框里选一档(或 `rove api add --tier`),Rove 就照那一行填进这三个字段;任务启动前你仍然看得见、改得了。enter(或点击)某一行,用和任务一样的选择器把它指到别处。目标起不来的行会在这里说明原因,而不是等到启动时才炸。",unconfigured:`自动路由已关闭:有一档无处可去——它的引擎是空的。在下面把它指到某个引擎,或从 state.json 里删掉空的 autoRouting.<tier>.engine。`,engineDefault:`引擎默认`,ready:`● 可用`,unavailable:`! 不可用——{reason}`,classifierTitle:`分类器`,classifierHint:"上面几行说的是每一档**跑什么**,这里决定**由谁来选**:打开之后,`rove api add --tier auto` 会读任务的第一句话替你选档。默认关着,从来不是必需的,也永远不会让建 task 失败——没 key、断网、超时、或者它自己没把握,都只是让你停在本来就会用的那一档上。",classifierDataFlow:"! 打开分类器,任务的第一句话会发给一个**不是你选的那个引擎厂商**的第三方——`jev` 是 TypeSafe System One,`custom` 是你自己填的地址。它比你的引擎更早读到这段文字。关着的时候什么都不发。",classifierLabel:`选档方式`,classifierOff:`关`,classifierCustomLabel:`自定义`,classifierOffHint:`——不向任何地方发送`,classifierJevHint:`——TypeSafe System One,走你自己的 key 计费`,classifierCustomHint:`——你自己的接口:POST 那段文本,返回一个档位加一个置信度`,endpointLabel:`接口地址`,endpointUnset:`(未填——先填一个,再把「选档方式」切到自定义)`,endpointTitle:`自定义分类器接口`,endpointField:`URL`,endpointInvalidTitle:`不是一个 URL`,endpointInvalidBody:`接口地址要以 https:// 开头;http:// 只在回环地址(127.0.0.1、localhost、::1)上接受——发到网络上的话,明文 http 会把任务的前 1200 个字符原样带走。留空则清除。`,thresholdLabel:`置信度下限`,thresholdHint:`——低于这个值就不动档位`,thresholdTitle:`置信度下限`,thresholdField:`0 到 1`,thresholdInvalidTitle:`不是一个置信度`,thresholdInvalidBody:`下限是 0 到 1 之间的数。出厂默认 0.5。`,keyLabel:`API key`,keyStored:`已存 {hint}——enter 可替换,留空清除`,keyFromEnv:"来自环境变量 ${env}——环境变量优先于存起来的那个",keyNone:`未设置——enter 粘贴一个`,keyTitle:`{env}`,keyPlaceholder:`粘贴 key;留空则清除已存的那个`,keySaved:`● key 存在 ~/.rove/secrets.json(仅本人可读,不会进 state.json)`,keyCustomUnused:`● 自定义接口不会收到 Authorization 头——它若需要凭据,把 autoRouting.classifierCustomKeyEnv 指向存它的变量`,keyNoVariableTitle:`这个接口还没有 key 变量`,keyNoVariableBody:`在 autoRouting.classifierCustomKeyEnv 指定存 key 的变量之前,自定义分类器接口不会收到任何 Authorization 头。先设那个——存在一个没人读的名字下面的 key,只是白白落在盘上。`,keyWriteFailedTitle:`key 没存下`,keyWriteFailedBody:`写不了 ~/.rove/secrets.json:{reason}。请检查目录权限和磁盘空间,再次保存。`,keyMissing:`! 没有 key——不会替你选档,任务保持原来的档位`,keyPresentEnv:"● key 来自本进程环境变量 ${env}"}},qy={dev:{reset:`Reset UI state`,resetHint:`Clears ~/.config/rove/state.json and ~/.rove/tasks.json, then quits Rove — relaunch to start fresh. Working session list, pane sizes, theme, model picks all reset. Worktrees on disk and engine session history are not touched.`,resetButton:`[enter] Reset`,restart:`Restart backend`,restartHint:`Stops the Rove daemon and relaunches this window on the installed build — picks up daemon / orchestrator / engine edits without quitting by hand. Running engine sessions live in the PTY host and survive it; other attached Rove windows reconnect on their own.`,restartButton:`[enter] Restart`,reload:`Reload settings`,reloadHint:"Applies hand edits to ~/.config/rove/state.json (from `rove config`) to this window without a restart.",reloadButton:`[enter] Reload`,reloadDone:`Reloaded: {count} changed.`,reloadUnchanged:`Already matches state.json; nothing changed.`,reloadFailed:`state.json could not be read, nothing changed: {error}`,doctorHint:"Daemon wedged or unresponsive? Restart backend above does it from here; from a shell it is `rove daemon restart`. Hosted engine sessions stay alive across a daemon restart.",experimental:`Experimental`,remoteHint:"Remote projects (SSH): register a project whose git worktrees live on another host, driven from this local Rove. Unfinished — Hosted PTY engine launch over SSH is not implemented, and file/diff panes still degrade. Enables `rove add --remote`.",remote:`Remote projects`,autoStatusHint:`Auto status flow: a backlog task moves to in_progress when its engine starts a turn, and new sessions get a system-prompt note telling the agent to set in_review itself when the work is done. Never touches done/canceled.`,autoStatus:`Auto status flow`,dispatcherHint:"Field-notes dispatcher: task sessions file one-line gotchas (`rove api note`), the daemon forwards each to the repo's main session, and that session relays them to the in-flight tasks that benefit (`rove api dispatch`). Web-hosted sessions receive the relays today.",dispatcher:`Field-notes dispatcher`}},Jy={dev:{reset:`重置 UI 状态`,resetHint:`清空 ~/.config/rove/state.json 和 ~/.rove/tasks.json,然后退出 Rove——重新启动即可从头开始。工作会话列表、面板尺寸、主题、模型选择都会重置。磁盘上的 worktree 和引擎会话历史不受影响。`,resetButton:`[enter] 重置`,restart:`重启后端`,restartHint:`停止 Rove daemon,并以已安装的版本重新启动当前窗口——无需手动退出即可应用 daemon / orchestrator / engine 的改动。正在运行的引擎会话由 PTY host 托管,不受影响;其他已连接的 Rove 窗口会自行重连。`,restartButton:`[enter] 重启`,reload:`重新加载设置`,reloadHint:"把对 ~/.config/rove/state.json 的手动修改(来自 `rove config`)应用到当前窗口,无需重启。",reloadButton:`[enter] 重新加载`,reloadDone:`已重新加载:{count} 项有变化。`,reloadUnchanged:`已与 state.json 一致,没有变化。`,reloadFailed:`无法读取 state.json,未做任何改动:{error}`,doctorHint:"daemon 卡住或无响应?上面的「重启后端」就能在这里完成;在 shell 里则是 `rove daemon restart`。Hosted PTY 引擎会话不会因 daemon 重启而退出。",experimental:`实验性`,remoteHint:"远程项目(SSH):注册一个 git worktree + 引擎都通过 SSH 跑在另一台主机上、由本地 Rove 驱动的项目。尚未完成——文件/diff 面板对远程仍会降级。启用 `rove add --remote`。",remote:`远程项目`,autoStatusHint:`自动状态流转:backlog 任务在其引擎开始一轮时移到 in_progress,新会话会拿到一条系统提示,告诉 agent 完成后自行设为 in_review。绝不触碰 done/canceled。`,autoStatus:`自动状态流转`,dispatcherHint:"现场笔记调度器:任务会话提交一行经验(`rove api note`),daemon 将每条转发给仓库的主会话,主会话再把它们转达给能受益的进行中任务(`rove api dispatch`)。目前由 Web 托管的会话会收到转达。",dispatcher:`现场笔记调度器`}},Yy={engines:{title:`Engines`,hint:`Engines Rove can start on this machine. New tasks start with the default engine; switch an engine off to stop offering it.`,keys:`space available · d default · enter launch command · r rename · x reset/remove`,customTag:`custom`,available:`available`,off:`off`,defaultMark:`default`,makeDefault:`Make default`,status:{checking:`Checking…`,unknown:`Status unknown`,ready:`Ready`,notInstalled:`Not installed`,notOnPath:`Not on PATH`,signIn:`Sign in needed`,integrationMissing:`Integration not installed`,integrationOutdated:`Integration outdated`,integrationBlocked:`Integration blocked`},detail:{program:`Program`,command:`Command`,signIn:`Sign-in`,reporting:`Live status`,adapter:`Adapter`,programFound:`{binary} found at {path}.`,programMissing:`{binary} is not on PATH. Install the engine's CLI, or point its launch command at it.`,programUnknown:`Rove could not check for {binary}.`,commandDefault:`{command} (the default)`,commandCustom:`{command} (yours)`,signedIn:`Signed in.`,signedInAs:`Signed in as {who}.`,apiKey:`An API key is configured.`,token:`A token is configured ({source}).`,signedOut:`Not signed in. Sign in with the engine's own CLI.`,signInUnknown:`Rove can't see whether this engine is signed in.`,signInFailed:`Sign-in check failed: {error}`,hooksInstalled:`Rove's hooks are installed, so tabs report their state as it changes.`,hooksOutdated:`Rove's hooks are from an older version; reinstall them under Engine integrations.`,hooksMissing:`Rove's hooks are not installed; install them under Engine integrations.`,hooksAwaitEngine:`Rove's hooks can be installed once the engine is.`,hooksUnsupported:`This engine has no hooks for Rove to install.`,hooksBlocked:`Rove can't write its hooks into {file}: {reason}`,hooksBlockedHere:`Rove can't write its hooks into the engine's config: {reason}`,markersYes:`It leaves turn-complete markers that Rove reads back.`,markersNo:`It leaves no turn-complete markers.`,screenYes:`Screen rules cover what the hooks don't.`,screenNo:`No screen rules.`,screenNotNeeded:`No screen rules; the hooks report everything.`,adapterDeclared:`Borrows the {protocol} adapter.`,adapterGeneric:`Generic adapter: no transcript reader, sign-in check or resume.`,skill:`Rove skill`,skillInstalled:`Installed in {dir}.`,skillInstalledHere:`Installed and current.`,skillOutdated:`From an older Rove; reinstall it under Rove agent skill.`,skillMissing:`Not installed; install it under Rove agent skill.`},skill:{title:`Rove agent skill`,hint:`Teaches the agent in each engine to drive Rove itself (rove api): start tasks, read other sessions, message them.`,install:`Install ({count})`,noEngines:`No engine here takes the skill`,failed:`Install failed: {reason}`,bannerTitle:`ROVE SKILL NOT INSTALLED`,bannerHint:`{engines} can't drive Rove yet (start tasks, read other sessions). Click here to install.`,bannerHintWeb:`{engines} can't drive Rove yet (start tasks, read other sessions).`},integrations:{title:`Engine integrations`,hint:`Hooks Rove writes into each engine's own config, so a tab shows working, waiting or done the moment it happens.`,summary:`{installed} of {total} installed`,install:`Install missing ({count})`,upToDate:`All up to date`,remove:`Remove all ({count})`,noneInstalled:`Nothing to remove`},addEngine:`+ Add engine`,launchCommandTitle:`{name} launch command`,displayNameTitle:`{name} display name (blank = default)`,addTitle:`Add engine`,addStepTitle:`Add engine · {id}`,protocolTitle:`Add engine · {id} — protocol`,protocolNone:`None — generic adapter`,protocolFooter:`↑↓ choose · enter pick · esc cancel`,protocolRow:`protocol {protocol}`,protocolGeneric:`generic`,idPlaceholder:`lowercase slug, e.g. aider`,commandPlaceholder:`e.g. aider --model sonnet`,hookTrustHint:`Open {command} in the engine and approve hooks yourself. Written hooks are not proof of trust.`,readiness:`CLI: {cli} · login: {login} · hooks: {hooks}`,cliReady:`available`,cliMissing:`missing; install the engine CLI`,loginReady:`detected`,loginMissing:`sign in with the engine CLI`,readinessUnknown:`not observable`,hooksWritten:`written`,hooksMissing:`not written; Settings → Engines`,hooksOutdated:`outdated; Settings → Engines`,hookWaiting:`No hook event received yet. After approval, send a short prompt to verify activity.`,hookReceived:`Hook event recorded for this tab. Send a short prompt to check current reporting; current trust is not inferred.`,readinessFailed:`Readiness check unavailable; run rove doctor. No authorization is inferred.`},accounts:{checking:`Checking…`,notLoggedIn:`○ Not logged in`,loggedIn:`● Logged in: {email}`,apiKeyConfigured:`● API key configured`,chatgptLogin:`● ChatGPT login: {email}`,tokenConfigured:`● Token configured ({source})`,detected:`● Login detected`}},Xy={engines:{title:`引擎`,hint:`Rove 能在这台机器上启动的引擎。新任务默认用「默认」引擎;关掉某个引擎,选引擎时就不再列出它。`,keys:`space 可用 · d 设为默认 · enter 启动命令 · r 重命名 · x 重置/移除`,customTag:`自定义`,available:`可用`,off:`已关`,defaultMark:`默认`,makeDefault:`设为默认`,status:{checking:`检查中…`,unknown:`状态未知`,ready:`就绪`,notInstalled:`未安装`,notOnPath:`不在 PATH 上`,signIn:`需要登录`,integrationMissing:`未安装接入`,integrationOutdated:`接入已过期`,integrationBlocked:`接入被拒绝`},detail:{program:`程序`,command:`命令`,signIn:`登录`,reporting:`实时状态`,adapter:`适配器`,programFound:`{binary} 位于 {path}。`,programMissing:`{binary} 不在 PATH 上。请安装引擎 CLI,或把启动命令指向它。`,programUnknown:`Rove 无法检查 {binary}。`,commandDefault:`{command}(默认)`,commandCustom:`{command}(自定义)`,signedIn:`已登录。`,signedInAs:`已登录:{who}。`,apiKey:`已配置 API key。`,token:`已配置 Token({source})。`,signedOut:`未登录。请用引擎自己的命令行登录。`,signInUnknown:`Rove 无法得知该引擎是否已登录。`,signInFailed:`登录检查失败:{error}`,hooksInstalled:`Rove 的钩子已安装,标签页的状态会实时上报。`,hooksOutdated:`Rove 的钩子来自旧版本;请在「引擎接入」里重新安装。`,hooksMissing:`Rove 的钩子未安装;请在「引擎接入」里安装。`,hooksAwaitEngine:`引擎安装后才能装 Rove 的钩子。`,hooksUnsupported:`该引擎没有可供 Rove 安装的钩子。`,hooksBlocked:`Rove 无法把钩子写入 {file}:{reason}`,hooksBlockedHere:`Rove 无法把钩子写入引擎配置:{reason}`,markersYes:`它会留下回合完成标记,Rove 可以读回。`,markersNo:`它不留下回合完成标记。`,screenYes:`读屏规则兜底钩子覆盖不到的状态。`,screenNo:`没有读屏规则。`,screenNotNeeded:`没有读屏规则;钩子已报全所有状态。`,adapterDeclared:`借用 {protocol} 适配器。`,adapterGeneric:`通用适配器:没有会话记录读取、登录检查和恢复。`,skill:`Rove 技能`,skillInstalled:`已安装在 {dir}。`,skillInstalledHere:`已安装,是最新版。`,skillOutdated:`来自旧版 Rove;请在「Rove 智能体技能」里重新安装。`,skillMissing:`未安装;请在「Rove 智能体技能」里安装。`},skill:{title:`Rove 智能体技能`,hint:`教会各引擎里的智能体自己操作 Rove(rove api):开任务、读其他会话、给它们发消息。`,install:`安装({count})`,noEngines:`这台机器上没有能装技能的引擎`,failed:`安装失败:{reason}`,bannerTitle:`ROVE 技能未安装`,bannerHint:`{engines} 还不能操作 Rove(开任务、读其他会话)。点这里安装。`,bannerHintWeb:`{engines} 还不能操作 Rove(开任务、读其他会话)。`},integrations:{title:`引擎接入`,hint:`Rove 写进各引擎自身配置的钩子,让标签页在工作、等待、完成的那一刻就显示出来。`,summary:`已安装 {installed}/{total}`,install:`安装缺失的({count})`,upToDate:`全部已是最新`,remove:`全部移除({count})`,noneInstalled:`没有可移除的`},addEngine:`+ 添加引擎`,launchCommandTitle:`{name} 的启动命令`,displayNameTitle:`{name} 的显示名称(留空 = 默认)`,addTitle:`添加引擎`,addStepTitle:`添加引擎 · {id}`,protocolTitle:`添加引擎 · {id} —— 协议`,protocolNone:`无 —— 通用适配器`,protocolFooter:`↑↓ 选择 · enter 确认 · esc 取消`,protocolRow:`协议 {protocol}`,protocolGeneric:`通用`,idPlaceholder:`小写短名,如 aider`,commandPlaceholder:`如 aider --model sonnet`,hookTrustHint:`在引擎中打开 {command},由你自行批准 hooks。写入不代表已授权。`,readiness:`CLI:{cli} · 登录:{login} · hooks:{hooks}`,cliReady:`可用`,cliMissing:`缺失;请安装引擎 CLI`,loginReady:`已检测到`,loginMissing:`请通过引擎 CLI 登录`,readinessUnknown:`无法观测`,hooksWritten:`已写入`,hooksMissing:`未写入;设置 → 引擎`,hooksOutdated:`已过时;设置 → 引擎`,hookWaiting:`尚未收到 hook 事件。授权后发送一条简短提示,验证活动状态。`,hookReceived:`已记录此标签页的 hook 事件。发送简短提示以检查当前上报;不据此推断当前授权。`,readinessFailed:`无法检查就绪状态;请运行 rove doctor。不会据此推断已授权。`},accounts:{checking:`检查中…`,notLoggedIn:`○ 未登录`,loggedIn:`● 已登录: {email}`,apiKeyConfigured:`● 已配置 API key`,chatgptLogin:`● ChatGPT 登录: {email}`,tokenConfigured:`● 已配置 Token ({source})`,detected:`● 检测到登录`}},Zy={plugins:{title:`Plugins`,hint:"Rove's first-party mods first: enter (or click) installs or uninstalls one, and uninstalling keeps its data on disk. Then the plugins registered in ~/.rove/plugins.json: enter toggles one on or off — the daemon watches the file, so the change applies live. Rows indented under a plugin are the settings it declares; enter edits one, and the value reaches the plugin on its next run. Install and remove them from the shell: `rove plugin install <owner/repo>`, `rove plugin link <dir>`.",empty:"Kanban and Issues are first-party mods: enter (or click) installs one. No other plugins registered; add one with `rove plugin install <owner/repo>` — browse the `rove-plugin` topic on GitHub.",sourceLink:`linked {path}`,sourceGithub:`{spec}`,sourceBuiltIn:`first-party mod · not installed`,sourceBuiltInInstalled:`first-party mod · installed`,updateAvailable:`update available — rove plugin update`,declares:`{actions} actions · {events} events · {panes} panes`,declaresWithEngines:`{actions} actions · {events} events · {panes} panes · {engines} engines`,declaresPages:`· {pages} pages`,pageFailed:`page {detail}`,manifestUnreadable:`manifest unreadable; check the rove-plugin.toml path and TOML syntax`,unsupportedPlatform:`· not supported on this platform`,noHooks:`· no hooks declared`,lastRun:`· last run {label} {status} {ago} ago`,neverRun:`· never run`,runOk:`ok`,runRunning:`still running`,runFailed:"failed to start; inspect `rove plugin log <id>`",runExit:`exit {code}`,settingUnset:`(unset — enter to edit)`,settingInvalidTitle:`Not a number`,settingInvalidBody:`{label} only accepts a number. Keeping the previous value.`},marketplace:{title:`Marketplace`,hint:"Plugins published under the `rove-plugin` topic on GitHub, most-starred first. enter (or click) shows what the install would run and asks before running any of it. The listing is re-queried each time you open this section.",loading:`Searching GitHub…`,empty:`No plugins listed.`,offline:`GitHub is unreachable — showing first-party plugins only. Re-open this section to retry.`,installedTag:`installed`,firstParty:`first-party`,preparing:`cloning {ref}…`,installing:`building and registering {name}…`,installed:`installed {id} v{version} — it is enabled, and appears under Plugins.`,cancelled:`install cancelled; nothing was run.`,failed:`install failed: {error}. Check the build output and retry from Marketplace.`,alreadyInstalled:`already installed as {id} — manage it under Plugins.`,confirmTitle:`Install {name}?`,confirmInstall:`install`,previewSource:`source: {source}`,previewCommands:`Commands this plugin declares:`,previewNoCommands:`This plugin declares no commands.`,previewWarning:`warning: {warning}`,previewTrust:`Installing runs the build commands above, and the rest run later on the events they declare. They run as you, with your environment, and nothing is sandboxed.`}},Qy={plugins:{title:`插件`,hint:"先列 Rove 官方 mod:enter(或点击)安装或卸载,卸载后数据仍留在磁盘上。再列在 ~/.rove/plugins.json 里注册的插件:enter 切换启用/禁用——daemon 监听该文件,改动实时生效。插件下方缩进的行是它声明的设置项,enter 编辑,新值在插件下次运行时生效。安装与移除在 shell 里做:`rove plugin install <owner/repo>`、`rove plugin link <dir>`。",empty:"Kanban 和 Issues 是官方 mod:enter(或点击)安装。尚未注册其他插件;用 `rove plugin install <owner/repo>` 安装一个——可在 GitHub 的 `rove-plugin` 话题下浏览。",sourceLink:`本地链接 {path}`,sourceGithub:`{spec}`,sourceBuiltIn:`官方 mod · 未安装`,sourceBuiltInInstalled:`官方 mod · 已安装`,updateAvailable:`有新版本 — rove plugin update`,declares:`{actions} 个动作 · {events} 个事件 · {panes} 个面板`,declaresWithEngines:`{actions} 个动作 · {events} 个事件 · {panes} 个面板 · {engines} 个引擎`,declaresPages:`· {pages} 个页面`,pageFailed:`页面 {detail}`,manifestUnreadable:`manifest 无法解析;请检查rove-plugin.toml 的路径和 TOML 语法`,unsupportedPlatform:`· 不支持当前平台`,noHooks:`· 未声明钩子`,lastRun:`· 上次运行 {label} {status} {ago}前`,neverRun:`· 尚未运行过`,runOk:`成功`,runRunning:`仍在运行`,runFailed:"启动失败;请查看 `rove plugin log <id>`",runExit:`退出码 {code}`,settingUnset:`(未设置 — enter 编辑)`,settingInvalidTitle:`不是数字`,settingInvalidBody:`{label} 只接受数字,保留原值。`},marketplace:{title:`插件市场`,hint:"GitHub 上 `rove-plugin` 话题下发布的插件,按 star 数排序。enter(或点击)会先列出安装会执行的命令,确认后才真正执行。每次进入本区块都会重新查询列表。",loading:`正在搜索 GitHub…`,empty:`列表为空。`,offline:`GitHub 不可达——只显示首方插件。重新进入本区块可再试一次。`,installedTag:`已安装`,firstParty:`首方`,preparing:`正在克隆 {ref}…`,installing:`正在构建并注册 {name}…`,installed:`已安装 {id} v{version}——已启用,可在「插件」区块管理。`,cancelled:`已取消安装,没有执行任何命令。`,failed:`安装失败:{error}。请检查构建输出,再从插件市场重试。`,alreadyInstalled:`已安装为 {id}——在「插件」区块管理。`,confirmTitle:`安装 {name}?`,confirmInstall:`安装`,previewSource:`来源:{source}`,previewCommands:`该插件声明的命令:`,previewNoCommands:`该插件未声明任何命令。`,previewWarning:`警告:{warning}`,previewTrust:`安装会执行上面的 build 命令,其余命令会在它们声明的事件发生时执行。它们以你的身份、带你的环境变量运行,没有任何沙箱。`}},$y={en:{appearance:{enabled:`On`,disabled:`Off`,borderFlow:`Flowing gradient`,borderStill:`Still`,glyphsBraille:`Braille`,glyphsStarburst:`Starburst (needs a font with the Dingbats block)`,glyphsAscii:`ASCII`,titleShimmer:`Shimmer`,titleStill:`Still`,preview:`Workspace preview`,tasks:`Tasks`,terminal:`Terminal`,files:`Files`,testsPassed:`Tests passed`,transparent:`Transparent background`,opaque:`Opaque background`,modeDark:`Dark`,modeLight:`Light`,modeAuto:`Auto (follow the terminal)`,openHint:`Enter to choose an option and preview it.`,chooseHint:`↑/↓ or j/k preview · enter apply · esc cancel`},title:`Settings`,esc:`esc`,nav:{default:`j/k pick · h/l switch level · enter activate · esc close`,keys:`j/k pick · enter record a key · backspace default · x unbind · esc close`,feedback:`tab next field · enter sends on Send · esc close`},sections:{general:`General`,engines:`Engines`,autoRouting:`Auto routing`,plugins:`Plugins`,marketplace:`Marketplace`,keys:`Keybindings`,feedback:`Feedback`,dev:`Dev`},general:{usage:`USAGE`,theme:`Theme`,themeMode:`Mode`,themeHint:`l to enter list · j/k to highlight · enter to apply`,language:`Language`,languageHint:`Display language for Rove's UI. l to enter list · j/k to highlight · enter to apply.`,transparent:`Transparent background`,transparentHint:`Drops the renderer's bg fill so the host terminal shows through. enter toggles.`,on:`[x] on`,off:`[ ] off`,focusAccent:`Focus accent`,focusAccentHint:`Color of focused pane title, ▌ marker, and split borders.`,accentPrimary:`Primary (brand accent)`,accentSuccess:`Success (legacy green)`,accentInfo:`Info (cool blue)`,appearance:`Appearance`,appearanceHint:`How split panes draw.`,splitStyle:`Split panes`,workingBorder:`Working border`,taskColors:`Task colors`,glyphSet:`State glyphs`,colorblind:`Colorblind diff colours`,runningTitle:`Running title`,splitBox:`Box frames`,splitLine:`Divider line`,splitRail:`Accent rail`,splitRule:`Top rule`,notifications:`Notifications`,notificationsHint:`When a background tab finishes or pauses on an approval.`,toast:`Toast`,toastHint:`bottom-right popup`,sound:`Sound`,soundHint:`bell + chime + an OSC 9 desktop notification (rides SSH)`,soundVolume:`Chime volume — {percent}%`,soundVolumeHint:`enter cycles; applies to the next chime`,crossTask:`Cross-task`,crossTaskHint:`also for a task you switched away from`,finishedAlerts:`Finished turns`,finishedAlertsHint:`off: only approvals and errors alert; the unread dot stays`,keyHints:`Keyboard hints`,keyHintsHint:`The status-bar reminder and the first-use hints in the sidebar and files panes.`,keyHintsShow:`Show keyboard hints`,keyHintsShowHint:`re-enabling relights hints dismissed by use`,zen:`Zen mode`,zenHint:"The `zen` chip and `prefix`+z hide Files, keeping the Tasks rail and workspace.",zenDefaultOn:`Start in zen mode`,updates:`Updates`,updatesHint:`Stable is the default channel; next previews the coming release; nightly is built from main every day.`,updateChannelTitle:`Release channel`,updateChannel:`Channel: {channel}`,updateChannelHint:"enter cycles stable / next / nightly; `rove update` follows it",updateChannelName:{latest:`stable`,next:`next preview`,nightly:`nightly preview`},updateNotify:`Notify on updates`,updateNotifyHint:`new versions on this channel; off hides the update chip, and checking by hand still reports`,updateCheck:`[ Check for updates ]`,updateCheckHint:`asks npm for the newest release on this channel right now`,updateCheckButton:`Check for updates`,updateChecking:`Checking…`,updateOpenPage:`Open Update page`,updateOpenPageRow:`[ Open Update page ]`,railFold:`Folded task rail`,railFoldHint:`What the rail shows once folded away from its corner control.`,railFoldRow:`Folded rail shows: {style}`,railFoldRowHint:`enter cycles`,railFoldGlyphs:`status glyphs`,railFoldInitials:`glyph + initials`,railFoldHairline:`colour band only`,editor:`Editor`,editorHint:`What enter opens a file with in the file tree — diff mode when the editor supports it, the read-only preview when it isn't installed.`,editorRow:`editor: < {kind} >`,editorRowHint:`auto follows $VISUAL / $EDITOR, else nvim / vim / emacs / nano`,editorCustom:`custom: {cmd}`,editorCustomUnset:`(unset — enter to edit)`,worktree:`Worktree location`,worktreeHint:`Where new task worktrees are created. New tasks only.`,worktreeBase:`location: < {kind} >`,worktreeBaseHint:"custom takes `~`, a relative path, or a leading `$project_dir`",worktreeKindDefault:`default ~/.rove/worktrees`,worktreeKindNext:`next to project`,worktreeKindCustom:`custom`,worktreeCustom:`custom: {path}`,worktreeCustomUnset:`(unset — enter to edit)`,worktreeBaseTitle:`Custom worktree location (blank = default; $project_dir = project root)`,worktreeBaseField:`PATH`,editorCustomTitle:`Custom editor command (use {file} for the path)`,worktreeBaseInvalidTitle:`Can't use that worktree location`,worktreeBaseTokenBody:`{token} only expands as the leading path segment (e.g. {token}/../rove-worktrees). Keeping the previous setting.`,worktreeBaseUnusableBody:`{path} isn't usable ({error}). Keeping the previous setting — pick a writable directory.`,terminal:`Terminal`,terminalHint:`Applies to terminals opened after the change.`,scrollbackRow:`scrollback: {rows} rows`,scrollbackRowHint:`100–100000 · larger costs proportionally more CPU per redraw`,scrollbackTitle:`Terminal scrollback rows (100–100000)`,scrollbackField:`ROWS`,scrollbackInvalidTitle:`Not a number`,scrollbackInvalidBody:`Scrollback must be a number of rows (e.g. 1000). Keeping the previous setting.`,tabStripRow:`tab strip: {mode}`,tabStripMode:{never:`off — the sidebar tree lists tabs`,multipleOnly:`only with 2+ tabs`,always:`always`}},field:{command:`COMMAND`,name:`NAME`,id:`ID`},action:{save:`save`,next:`next`,add:`add`},reset:{title:`Reset UI state?`,body:`Wipes ~/.config/rove/state.json and ~/.rove/tasks.json, then quits Rove — relaunch for a fresh start with an empty working session list. Worktrees on disk and engine session history are NOT touched.`,done:`Rove: UI state reset. Relaunch Rove to start fresh.`,failedTitle:`UI state was not reset`,failedBody:`Could not write the settings file. Your settings and tasks have been kept. Try resetting again.`},restart:{title:`Restart backend?`,body:`Stops the daemon and relaunches this Rove on the installed build, so daemon / orchestrator / engine edits take effect. Running engine sessions live in the PTY host and keep going; open tabs come back. Any other attached windows reconnect on their own.`,done:`Rove: restarting the backend...`},stateWrite:{failedTitle:`Settings were not saved`,failedBody:`{file} could not be written ({keys}). Check its directory permissions and free disk space, then save again.`},...Gy,...Yy,...Zy,keybindings:{title:`Keybindings`,hint:`Press enter on a binding, then the key you want. To put it behind the prefix, press the prefix key first. Changes are saved to the file below and apply at once.`,configFile:`Config file`,notCreated:` (not created yet)`,prefixTitle:`Command layer ({prefix})`,prefixHint:`Bare keys act in the focused pane; a small one-press set covers frequent Rove actions; {prefix} opens the command layer ({timeout}ms second-stroke window). Prefix bindings keep their pane scope and modal rules.`,tapPresentation:`Prefix tap`,tapPresentationHint:`Choose whether the complete guide also marks controls already on screen.`,tapPresentationLocal:`On-screen entries + complete guide (default)`,tapPresentationGuide:`Complete guide only`,prefixDisabled:`disabled`,prefixKey:`Prefix key`,recording:`press the new key… (esc cancels)`,recordingPrefix:`{prefix}, then… (esc cancels)`,recordingSlot:`press the key for {slot}… (esc cancels)`,unbound:`(unbound)`,defaultKeys:`default: {keys}`,warnings:`Warnings`},feedback:{title:`Feedback`,hint:"Files a GitHub issue on the Rove repo through `gh`. Requires `gh auth login`; without it you get a prefilled link to open.",titleLabel:`title`,titlePlaceholder:`Short summary`,descriptionLabel:`description`,descriptionPlaceholder:`What happened? (enter for a new line · tab to Send)`,send:`[enter] File a GitHub issue`,submitting:`submitting...`,sent:`filed #{number}: {url}`,notFiled:`not filed: {hint}
46
+ `),confirmLabel:q(`worktrees`,`land.button`),onConfirm:async()=>{try{let r=await e.client.request(`task.land`,{taskId:t.id});L(q(`worktrees`,`land.done`,{branch:i,landedOn:r.landedOn,commit:r.commit.slice(0,8)})),n?.()}catch(e){throw Error(xy(e))}}}))}function Cy(e,t,n,r){let i=t.branch||t.title;C.set((0,H.jsx)(Ti,{title:B(`taskops.publishTitle`),body:B(`taskops.publishBody`,{branch:i,host:n}),confirmLabel:B(`taskops.publishButton`),onConfirm:async()=>{let n=await e.client.request(`task.land`,{taskId:t.id}),a=n.published?.prUrl;a?L(B(`taskops.publishedPr`,{branch:i,url:a})):L(B(`taskops.publishedNoPr`,{branch:i,reason:Ty(n.published?.prError??``)}),`error`),r?.()}}))}async function wy(e,t){try{let n=await e.client.request(`task.syncBase`,{taskId:t});L(q(`tasks`,n.alreadyCurrent?`sync.alreadyCurrent`:`sync.done`,{base:n.baseRef}))}catch(e){let t=G(e),n=yy.exec(t),r=by.exec(t);L(n?q(`tasks`,`sync.conflict`,{files:n[1]?.trim()||`?`}):r?q(`tasks`,`sync.dirty`,{files:r[1]?.trim()||`?`}):q(`tasks`,`sync.failed`,{error:t}),`error`)}}function Ty(e){return e.split(`
47
+ `).find(e=>e.trim().length>0)?.trim()??e.trim()}async function Ey(e,t,n){try{let r=await e.client.request(`task.fixChecks`,e.engineTarget(t));r.outcome===`unavailable`?L(q(`files`,`toast.ciChecksUnavailable`,{detail:Ty(r.detail??``)}),`error`):r.outcome===`none`?L(q(`files`,`toast.ciNoFailingChecks`),`error`):L(n)}catch(e){L(G(e),`error`)}}async function Dy(e,t){try{let n=await e.client.request(`task.openEditor`,{taskId:t});n.outcome===`noEditor`?L(q(`tasks`,`toast.noEditor`),`error`):n.outcome===`failed`&&L(q(`tasks`,`toast.openWorktreeFailed`,{label:n.label??``}),`error`)}catch(e){L(Sm(e)?q(`tasks`,`toast.noDiskSpace`):q(`tasks`,`toast.worktreeErrorGeneric`,{message:G(e)}),`error`)}}function Oy(e,t){let n=e.tasks.get();return[...n?.tasks??[],...n?.archived??[]].filter(e=>e.parentTaskId===t)}function ky(e,t){let n=Oy(e,t.id),r=n.length>0,i=n=>e.act(`task.delete`,{taskId:t.id,...n}).then(()=>{}),a=e=>`${q(`worktrees`,`delete.forceBody`,{branch:t.branch||t.title})}\n\n${q(`worktrees`,`delete.forceReason`,{reason:G(e).replace(`task ${t.id} `,``)})}`,o=async e=>{i(e).catch(n=>{if(e.force||!(n instanceof Uo)||n.code!==`DIRTY_WORKTREE`){L(G(n),`error`);return}C.set((0,H.jsx)(Ti,{title:q(`tasks`,`confirm.forceDeleteTitle`,{title:t.label}),body:a(n),confirmLabel:q(`tasks`,`confirm.forceDeleteConfirm`),onConfirm:()=>o({...e,force:!0})}))})};return(0,H.jsx)(Ti,{title:r?q(`tasks`,`confirm.childrenTitle`,{title:t.label,count:String(n.length)}):q(`tasks`,t.kind===`dir`?`confirm.deleteTitleDir`:`confirm.deleteTitle`,{title:t.label}),body:r?q(`tasks`,`confirm.childrenBody`):q(`tasks`,t.kind===`dir`?`confirm.deleteBodyDir`:`confirm.deleteBodyTask`),confirmLabel:q(`tasks`,r?`confirm.childrenPromote`:`confirm.deleteConfirm`),onConfirm:()=>o({}),...r?{secondary:{label:q(`tasks`,`confirm.childrenCascade`),onConfirm:()=>o({cascade:!0})}}:{}})}async function Ay(e,t){let n=t.archived!==!0,r=t.label,i=async i=>{await e.act(`task.archive`,{taskId:t.id,archived:n,...i?{force:!0}:{}}),L(q(`tasks`,n?`archive.done`:`archive.restored`,{title:r}))};try{await i(!1)}catch(e){if(n&&e instanceof Uo&&e.code===`TASK_BUSY`){C.set((0,H.jsx)(Ti,{title:q(`tasks`,`archive.busyTitle`),body:q(`tasks`,`archive.busyBody`,{title:r}),confirmLabel:q(`tasks`,`archive.busyConfirm`),onConfirm:()=>i(!0)}));return}L(q(`tasks`,n?`archive.failed`:`archive.restoreFailed`,{error:G(e)}),`error`)}}function jy(e,t,n){return(0,H.jsx)(Ti,{title:q(`tasks`,`confirm.forgetProjectTitle`,{title:n}),body:q(`tasks`,`confirm.forgetProjectBody`),confirmLabel:q(`tasks`,`confirm.forgetProjectConfirm`),onConfirm:async()=>{try{await e.client.request(`project.forget`,{repo:t})}catch(e){throw Error(q(`tasks`,`toast.forgetProjectFailed`,{error:G(e)}))}}})}var My=v(null),Ny=0;function Py(e,t){My.set({taskId:e,hit:t,nonce:++Ny}),Fc(e,`chat`),N.get()&&N.set(!1)}var Fy=10;function Iy(e,t){let n=e=>e.surface===t?0:e.surface?1:2,r=To().filter(n=>Eo(n,t)&&n.live?.(e)!==!1).map((e,t)=>({command:e,index:t})).sort((e,t)=>n(e.command)-n(t.command)||Number(e.command.prefix)-Number(t.command.prefix)||e.index-t.index),i=new Set,a=[];for(let{command:e}of r){let t=e.chords[0];!t||e.id===`palette.open`||i.has(e.id)||(i.add(e.id),a.push({command:e,name:Sl(e.id),raw:e.prefix?`${ga()} + ${t}`:t}))}return a}function Ly(e){let t=document.activeElement instanceof HTMLElement?document.activeElement:null;C.set((0,H.jsx)(zy,{model:e,surface:Oo(),origin:t}))}var Ry=8;function zy({model:e,surface:t,origin:n}){V();let[r,i]=(0,h.useState)(``),[a,o]=(0,h.useState)(0),s=(0,h.useRef)(null),c=y(da),l=y(e.tasks),u=y(e.remote),d=(0,h.useMemo)(()=>Iy(e,t),[e,t,c]).filter(e=>ll(r,e.name,e.raw)),f=(Xm(e).length>0?[{name:B(`machines.title`)}]:[]).filter(e=>ll(r,e.name,``)),p=[{name:B(`settings.feedback.report`)}].filter(e=>ll(r,e.name,``)),m=r.trim(),g=m===``?[]:[...l?.tasks??[],...u,...l?.archived??[]].filter(e=>!e.routine&&!e.deleting&&[e.label,e.title,e.branch,dd(e.repo)].some(e=>e!==``&&$c(m,e))).slice(0,Ry),_=y(e.installedMods).has(`issues`),v=[{id:`usage`,name:B(`usage.title`)},..._?[{id:`issues`,name:B(`reviewQueue.palette`),source:`reviews`}]:[]].filter(e=>m===``||$c(m,e.name)),b=ay(e,r),x=b.kind===`done`?b.reply.matches:[],S=[...d.map(e=>({kind:`command`,row:e})),...v.map(e=>({kind:`page`,...e})),...f.map(e=>({kind:`machines`,...e})),...p.map(e=>({kind:`report`,...e})),...g.map(e=>({kind:`task`,task:e})),...x.map(e=>({kind:`hit`,hit:e}))],C=Math.min(a,Math.max(0,S.length-1));(0,h.useEffect)(()=>()=>n?.focus(),[n]),(0,h.useEffect)(()=>{s.current?.querySelector(`.is-selected`)?.scrollIntoView({block:`nearest`})},[C]);let w=t=>{if(t.kind===`machines`){Gv(e);return}if(z(),n?.focus(),t.kind===`report`){fy(e).catch(()=>L(B(`settings.feedback.reportFailed`),`error`));return}if(t.kind===`command`){t.row.command.live?.(e)===!1?L(yl(`unavailable`),`error`):t.row.command.run(e);return}if(t.kind===`page`){t.source&&py.set(t.source),he(t.id);return}t.kind===`task`&&t.task.archived&&Ay(e,t.task),t.kind===`task`?e.select(t.task.id):e.select(t.hit.taskId,t.hit.tabId??null),pe(),t.kind===`hit`&&Py(t.hit.taskId,t.hit)},T=e=>{if(e.key===`ArrowDown`)o(Math.min(S.length-1,C+1));else if(e.key===`ArrowUp`)o(Math.max(0,C-1));else if(e.key===`Enter`){let e=S[C];e&&w(e)}else return;e.preventDefault()},E=m!==``&&(g.length>0||m.length>=2),D=0,O=()=>D++;return(0,H.jsx)(Si,{title:yl(`palette`),wide:!0,children:(0,H.jsxs)(`div`,{className:`${Gr} palette`,onKeyDown:T,children:[(0,H.jsx)(`input`,{className:mn,autoFocus:!0,spellCheck:!1,value:r,placeholder:yl(`search`),onChange:e=>{i(e.target.value),o(0)}}),(0,H.jsxs)(`div`,{className:dn,ref:s,style:{maxHeight:`${(E?18:Fy)*1.9}em`},children:[S.length===0&&b.kind!==`searching`&&(0,H.jsx)(`p`,{className:`text-muted`,children:yl(`noResults`)}),E&&d.length>0&&(0,H.jsx)(sy,{children:B(`search.commands`)}),d.map(e=>{let t=O();return(0,H.jsx)(`button`,{type:`button`,className:fn(t===C),title:e.name,onMouseEnter:()=>o(t),onClick:()=>w({kind:`command`,row:e}),children:(0,H.jsx)(`span`,{className:pn,children:`${t===C?`› `:` `}${e.name}`})},e.command.id)}),v.map(e=>{let t=O();return(0,H.jsx)(U,{variant:`row`,className:fn(t===C),title:e.name,onMouseEnter:()=>o(t),onClick:()=>w({kind:`page`,...e}),children:(0,H.jsx)(`span`,{className:pn,children:`${t===C?`› `:` `}${e.name}`})},e.id)}),f.map(e=>{let t=O();return(0,H.jsx)(U,{variant:`row`,className:fn(t===C),title:e.name,onMouseEnter:()=>o(t),onClick:()=>w({kind:`machines`,...e}),children:(0,H.jsx)(`span`,{className:pn,children:`${t===C?`› `:` `}${e.name}`})},`machines`)}),p.map(e=>{let t=O();return(0,H.jsx)(U,{variant:`row`,className:fn(t===C),title:e.name,onMouseEnter:()=>o(t),onClick:()=>w({kind:`report`,...e}),children:(0,H.jsx)(`span`,{className:pn,children:`${t===C?`› `:` `}${e.name}`})},`report`)}),g.length>0&&(0,H.jsx)(sy,{children:B(`search.tasks`)}),g.map(e=>{let t=O();return(0,H.jsx)(ly,{title:e.label,repo:e.archived?B(`search.archived`,{repo:dd(e.repo)}):dd(e.repo),selected:t===C,onHover:()=>o(t),onOpen:()=>w({kind:`task`,task:e})},e.id)}),b.kind!==`idle`&&(0,H.jsx)(sy,{children:B(`search.inConversations`)}),b.kind===`searching`&&(0,H.jsx)(cy,{children:B(`search.searching`)}),b.kind===`failed`&&(0,H.jsx)(cy,{error:!0,children:b.message}),b.kind===`done`&&x.length===0&&(0,H.jsx)(cy,{children:B(`search.none`,{query:b.query})}),x.map(e=>{let t=O();return(0,H.jsx)(uy,{hit:e,query:b.kind===`done`?b.query:``,selected:t===C,onHover:()=>o(t),onOpen:()=>w({kind:`hit`,hit:e})},`${e.taskId}:${e.tabId??``}:${e.at}:${t}`)}),b.kind===`done`&&b.reply.truncated&&(0,H.jsx)(cy,{children:B(`search.truncated`)}),b.kind===`done`&&b.reply.skipped.length>0&&(0,H.jsx)(cy,{children:B(`search.skipped`,{count:b.reply.skipped.length})})]}),(0,H.jsx)(`p`,{className:`keys-only text-muted`,children:yl(`run`)})]})})}var By=v(null);function Vy(e){let t=(document.activeElement?.closest(`.rail`)==null?null:By.get())??e.selection.get().taskId;return e.tasks.get()?.tasks.find(e=>e.id===t)??null}var Hy=[`latest`,`next`,`nightly`],Uy={autoRouting:{title:`Auto routing`,hint:"Routing by depth: a task says how deep the work is — swift, standard, deep — and this table says which engine, model and reasoning effort that depth runs on. Pick a depth in the new-task dialog (or `rove api add --tier`) and Rove fills those three fields from the row; you still see them and can change them before the task starts. enter (or click) a row to point it somewhere else, with the same picker a task uses. A row whose target cannot start says why here, not at launch.",unconfigured:`Auto routing is off: a depth has nowhere to route — its engine is blank. Point it somewhere below, or remove the empty autoRouting.<tier>.engine from state.json.`,engineDefault:`engine default`,ready:`● ready`,unavailable:`! unavailable — {reason}`,classifierTitle:`Classifier`,classifierHint:"The rows above say what each depth RUNS. This says who CHOOSES one: switch it on and `rove api add --tier auto` reads the task's first message and picks the depth for you. It is off by default, it is never required, and it can never fail a create — no key, no network, a timeout, or an answer it is not confident enough about all leave you on the depth you would have had.",classifierDataFlow:"! Turning the classifier on sends the task's first message to a third party that is NOT the engine vendor you picked — TypeSafe System One for `jev`, or whatever address you point `custom` at. It reads the text before your engine does. Nothing leaves this machine while it is off.",classifierLabel:`Choose with`,classifierOff:`off`,classifierCustomLabel:`custom`,classifierOffHint:`— nothing is sent anywhere`,classifierJevHint:`— TypeSafe System One, billed to your own key`,classifierCustomHint:`— your endpoint: POST the text, answer with a depth and a confidence`,endpointLabel:`Endpoint`,endpointUnset:`(none — enter one, then set Choose with to custom)`,endpointTitle:`Custom classifier endpoint`,endpointField:`URL`,endpointInvalidTitle:`Not a URL`,endpointInvalidBody:`The endpoint has to start with https://, or http:// for a loopback address (127.0.0.1, localhost, ::1) — over a network, plain http would carry the task's first 1,200 characters in cleartext. Leave it empty to clear it.`,thresholdLabel:`Confidence floor`,thresholdHint:`— below this, the depth is left alone`,thresholdTitle:`Confidence floor`,thresholdField:`0 to 1`,thresholdInvalidTitle:`Not a confidence`,thresholdInvalidBody:`The floor is a number between 0 and 1. 0.5 is the shipped default.`,keyLabel:`API key`,keyStored:`stored {hint} — enter to replace, empty to clear`,keyFromEnv:"from ${env} — the environment wins over a stored key",keyNone:`not set — enter to paste one`,keyTitle:`{env}`,keyPlaceholder:`paste the key; leave empty to clear the stored one`,keySaved:`● key stored in ~/.rove/secrets.json (owner-only, never in state.json)`,keyCustomUnused:`● no Authorization header is sent to a custom endpoint — set autoRouting.classifierCustomKeyEnv to the variable holding its key if it needs one`,keyNoVariableTitle:`No key variable for this endpoint`,keyNoVariableBody:`A custom classifier endpoint is sent no Authorization header until autoRouting.classifierCustomKeyEnv names the variable its key lives in. Set that first — a key stored under a name nothing reads is a key at rest for no purpose.`,keyWriteFailedTitle:`Key not saved`,keyWriteFailedBody:`~/.rove/secrets.json could not be written: {reason}. Check directory permissions and disk space, then save again.`,keyMissing:`! no key — nothing is chosen and tasks keep their usual depth`,keyPresentEnv:"● key read from ${env} in this process's environment"}},Wy={autoRouting:{title:`自动路由`,hint:"按深度路由:任务说明这活有多深——轻快、标准、深入——这张表说明那一档跑在哪个引擎、哪个模型、哪个推理强度上。在新建任务对话框里选一档(或 `rove api add --tier`),Rove 就照那一行填进这三个字段;任务启动前你仍然看得见、改得了。enter(或点击)某一行,用和任务一样的选择器把它指到别处。目标起不来的行会在这里说明原因,而不是等到启动时才炸。",unconfigured:`自动路由已关闭:有一档无处可去——它的引擎是空的。在下面把它指到某个引擎,或从 state.json 里删掉空的 autoRouting.<tier>.engine。`,engineDefault:`引擎默认`,ready:`● 可用`,unavailable:`! 不可用——{reason}`,classifierTitle:`分类器`,classifierHint:"上面几行说的是每一档**跑什么**,这里决定**由谁来选**:打开之后,`rove api add --tier auto` 会读任务的第一句话替你选档。默认关着,从来不是必需的,也永远不会让建 task 失败——没 key、断网、超时、或者它自己没把握,都只是让你停在本来就会用的那一档上。",classifierDataFlow:"! 打开分类器,任务的第一句话会发给一个**不是你选的那个引擎厂商**的第三方——`jev` 是 TypeSafe System One,`custom` 是你自己填的地址。它比你的引擎更早读到这段文字。关着的时候什么都不发。",classifierLabel:`选档方式`,classifierOff:`关`,classifierCustomLabel:`自定义`,classifierOffHint:`——不向任何地方发送`,classifierJevHint:`——TypeSafe System One,走你自己的 key 计费`,classifierCustomHint:`——你自己的接口:POST 那段文本,返回一个档位加一个置信度`,endpointLabel:`接口地址`,endpointUnset:`(未填——先填一个,再把「选档方式」切到自定义)`,endpointTitle:`自定义分类器接口`,endpointField:`URL`,endpointInvalidTitle:`不是一个 URL`,endpointInvalidBody:`接口地址要以 https:// 开头;http:// 只在回环地址(127.0.0.1、localhost、::1)上接受——发到网络上的话,明文 http 会把任务的前 1200 个字符原样带走。留空则清除。`,thresholdLabel:`置信度下限`,thresholdHint:`——低于这个值就不动档位`,thresholdTitle:`置信度下限`,thresholdField:`0 到 1`,thresholdInvalidTitle:`不是一个置信度`,thresholdInvalidBody:`下限是 0 到 1 之间的数。出厂默认 0.5。`,keyLabel:`API key`,keyStored:`已存 {hint}——enter 可替换,留空清除`,keyFromEnv:"来自环境变量 ${env}——环境变量优先于存起来的那个",keyNone:`未设置——enter 粘贴一个`,keyTitle:`{env}`,keyPlaceholder:`粘贴 key;留空则清除已存的那个`,keySaved:`● key 存在 ~/.rove/secrets.json(仅本人可读,不会进 state.json)`,keyCustomUnused:`● 自定义接口不会收到 Authorization 头——它若需要凭据,把 autoRouting.classifierCustomKeyEnv 指向存它的变量`,keyNoVariableTitle:`这个接口还没有 key 变量`,keyNoVariableBody:`在 autoRouting.classifierCustomKeyEnv 指定存 key 的变量之前,自定义分类器接口不会收到任何 Authorization 头。先设那个——存在一个没人读的名字下面的 key,只是白白落在盘上。`,keyWriteFailedTitle:`key 没存下`,keyWriteFailedBody:`写不了 ~/.rove/secrets.json:{reason}。请检查目录权限和磁盘空间,再次保存。`,keyMissing:`! 没有 key——不会替你选档,任务保持原来的档位`,keyPresentEnv:"● key 来自本进程环境变量 ${env}"}},Gy={dev:{reset:`Reset UI state`,resetHint:`Clears ~/.config/rove/state.json and ~/.rove/tasks.json, then quits Rove — relaunch to start fresh. Working session list, pane sizes, theme, model picks all reset. Worktrees on disk and engine session history are not touched.`,resetButton:`[enter] Reset`,restart:`Restart backend`,restartHint:`Stops the Rove daemon and relaunches this window on the installed build — picks up daemon / orchestrator / engine edits without quitting by hand. Running engine sessions live in the PTY host and survive it; other attached Rove windows reconnect on their own.`,restartButton:`[enter] Restart`,reload:`Reload settings`,reloadHint:"Applies hand edits to ~/.config/rove/state.json (from `rove config`) to this window without a restart.",reloadButton:`[enter] Reload`,reloadDone:`Reloaded: {count} changed.`,reloadUnchanged:`Already matches state.json; nothing changed.`,reloadFailed:`state.json could not be read, nothing changed: {error}`,doctorHint:"Daemon wedged or unresponsive? Restart backend above does it from here; from a shell it is `rove daemon restart`. Hosted engine sessions stay alive across a daemon restart.",experimental:`Experimental`,remoteHint:"Remote projects (SSH): register a project whose git worktrees live on another host, driven from this local Rove. Unfinished — Hosted PTY engine launch over SSH is not implemented, and file/diff panes still degrade. Enables `rove add --remote`.",remote:`Remote projects`,autoStatusHint:`Auto status flow: a backlog task moves to in_progress when its engine starts a turn, and new sessions get a system-prompt note telling the agent to set in_review itself when the work is done. Never touches done/canceled.`,autoStatus:`Auto status flow`,dispatcherHint:"Field-notes dispatcher: task sessions file one-line gotchas (`rove api note`), and every session of that repo that starts later is handed them.",dispatcher:`Field-notes dispatcher`}},Ky={dev:{reset:`重置 UI 状态`,resetHint:`清空 ~/.config/rove/state.json 和 ~/.rove/tasks.json,然后退出 Rove——重新启动即可从头开始。工作会话列表、面板尺寸、主题、模型选择都会重置。磁盘上的 worktree 和引擎会话历史不受影响。`,resetButton:`[enter] 重置`,restart:`重启后端`,restartHint:`停止 Rove daemon,并以已安装的版本重新启动当前窗口——无需手动退出即可应用 daemon / orchestrator / engine 的改动。正在运行的引擎会话由 PTY host 托管,不受影响;其他已连接的 Rove 窗口会自行重连。`,restartButton:`[enter] 重启`,reload:`重新加载设置`,reloadHint:"把对 ~/.config/rove/state.json 的手动修改(来自 `rove config`)应用到当前窗口,无需重启。",reloadButton:`[enter] 重新加载`,reloadDone:`已重新加载:{count} 项有变化。`,reloadUnchanged:`已与 state.json 一致,没有变化。`,reloadFailed:`无法读取 state.json,未做任何改动:{error}`,doctorHint:"daemon 卡住或无响应?上面的「重启后端」就能在这里完成;在 shell 里则是 `rove daemon restart`。Hosted PTY 引擎会话不会因 daemon 重启而退出。",experimental:`实验性`,remoteHint:"远程项目(SSH):注册一个 git worktree + 引擎都通过 SSH 跑在另一台主机上、由本地 Rove 驱动的项目。尚未完成——文件/diff 面板对远程仍会降级。启用 `rove add --remote`。",remote:`远程项目`,autoStatusHint:`自动状态流转:backlog 任务在其引擎开始一轮时移到 in_progress,新会话会拿到一条系统提示,告诉 agent 完成后自行设为 in_review。绝不触碰 done/canceled。`,autoStatus:`自动状态流转`,dispatcherHint:"现场笔记调度器:任务会话提交一行经验(`rove api note`),之后在该仓库启动的每个会话都会拿到这些笔记。",dispatcher:`现场笔记调度器`}},qy={engines:{title:`Engines`,hint:`Engines Rove can start on this machine. New tasks start with the default engine; switch an engine off to stop offering it.`,keys:`space available · d default · enter launch command · r rename · x reset/remove`,customTag:`custom`,available:`available`,off:`off`,defaultMark:`default`,makeDefault:`Make default`,status:{checking:`Checking…`,unknown:`Status unknown`,ready:`Ready`,notInstalled:`Not installed`,notOnPath:`Not on PATH`,signIn:`Sign in needed`,integrationMissing:`Integration not installed`,integrationOutdated:`Integration outdated`,integrationBlocked:`Integration blocked`},detail:{program:`Program`,command:`Command`,signIn:`Sign-in`,reporting:`Live status`,adapter:`Adapter`,programFound:`{binary} found at {path}.`,programMissing:`{binary} is not on PATH. Install the engine's CLI, or point its launch command at it.`,programUnknown:`Rove could not check for {binary}.`,commandDefault:`{command} (the default)`,commandCustom:`{command} (yours)`,signedIn:`Signed in.`,signedInAs:`Signed in as {who}.`,apiKey:`An API key is configured.`,token:`A token is configured ({source}).`,signedOut:`Not signed in. Sign in with the engine's own CLI.`,signInUnknown:`Rove can't see whether this engine is signed in.`,signInFailed:`Sign-in check failed: {error}`,hooksInstalled:`Rove's hooks are installed, so tabs report their state as it changes.`,hooksOutdated:`Rove's hooks are from an older version; reinstall them under Engine integrations.`,hooksMissing:`Rove's hooks are not installed; install them under Engine integrations.`,hooksAwaitEngine:`Rove's hooks can be installed once the engine is.`,hooksUnsupported:`This engine has no hooks for Rove to install.`,hooksBlocked:`Rove can't write its hooks into {file}: {reason}`,hooksBlockedHere:`Rove can't write its hooks into the engine's config: {reason}`,markersYes:`It leaves turn-complete markers that Rove reads back.`,markersNo:`It leaves no turn-complete markers.`,screenYes:`Screen rules cover what the hooks don't.`,screenNo:`No screen rules.`,screenNotNeeded:`No screen rules; the hooks report everything.`,adapterDeclared:`Borrows the {protocol} adapter.`,adapterGeneric:`Generic adapter: no transcript reader, sign-in check or resume.`,skill:`Rove skill`,skillInstalled:`Installed in {dir}.`,skillInstalledHere:`Installed and current.`,skillOutdated:`From an older Rove; reinstall it under Rove agent skill.`,skillMissing:`Not installed; install it under Rove agent skill.`},skill:{title:`Rove agent skill`,hint:`Teaches the agent in each engine to drive Rove itself (rove api): start tasks, read other sessions, message them.`,install:`Install ({count})`,noEngines:`No engine here takes the skill`,failed:`Install failed: {reason}`,bannerTitle:`ROVE SKILL NOT INSTALLED`,bannerHint:`{engines} can't drive Rove yet (start tasks, read other sessions). Click here to install.`,bannerHintWeb:`{engines} can't drive Rove yet (start tasks, read other sessions).`},integrations:{title:`Engine integrations`,hint:`Hooks Rove writes into each engine's own config, so a tab shows working, waiting or done the moment it happens.`,summary:`{installed} of {total} installed`,install:`Install missing ({count})`,upToDate:`All up to date`,remove:`Remove all ({count})`,noneInstalled:`Nothing to remove`},addEngine:`+ Add engine`,launchCommandTitle:`{name} launch command`,displayNameTitle:`{name} display name (blank = default)`,addTitle:`Add engine`,addStepTitle:`Add engine · {id}`,protocolTitle:`Add engine · {id} — protocol`,protocolNone:`None — generic adapter`,protocolFooter:`↑↓ choose · enter pick · esc cancel`,protocolRow:`protocol {protocol}`,protocolGeneric:`generic`,idPlaceholder:`lowercase slug, e.g. aider`,commandPlaceholder:`e.g. aider --model sonnet`,hookTrustHint:`Open {command} in the engine and approve hooks yourself. Written hooks are not proof of trust.`,readiness:`CLI: {cli} · login: {login} · hooks: {hooks}`,cliReady:`available`,cliMissing:`missing; install the engine CLI`,loginReady:`detected`,loginMissing:`sign in with the engine CLI`,readinessUnknown:`not observable`,hooksWritten:`written`,hooksMissing:`not written; Settings → Engines`,hooksOutdated:`outdated; Settings → Engines`,hookWaiting:`No hook event received yet. After approval, send a short prompt to verify activity.`,hookReceived:`Hook event recorded for this tab. Send a short prompt to check current reporting; current trust is not inferred.`,readinessFailed:`Readiness check unavailable; run rove doctor. No authorization is inferred.`},accounts:{checking:`Checking…`,notLoggedIn:`○ Not logged in`,loggedIn:`● Logged in: {email}`,apiKeyConfigured:`● API key configured`,chatgptLogin:`● ChatGPT login: {email}`,tokenConfigured:`● Token configured ({source})`,detected:`● Login detected`}},Jy={engines:{title:`引擎`,hint:`Rove 能在这台机器上启动的引擎。新任务默认用「默认」引擎;关掉某个引擎,选引擎时就不再列出它。`,keys:`space 可用 · d 设为默认 · enter 启动命令 · r 重命名 · x 重置/移除`,customTag:`自定义`,available:`可用`,off:`已关`,defaultMark:`默认`,makeDefault:`设为默认`,status:{checking:`检查中…`,unknown:`状态未知`,ready:`就绪`,notInstalled:`未安装`,notOnPath:`不在 PATH 上`,signIn:`需要登录`,integrationMissing:`未安装接入`,integrationOutdated:`接入已过期`,integrationBlocked:`接入被拒绝`},detail:{program:`程序`,command:`命令`,signIn:`登录`,reporting:`实时状态`,adapter:`适配器`,programFound:`{binary} 位于 {path}。`,programMissing:`{binary} 不在 PATH 上。请安装引擎 CLI,或把启动命令指向它。`,programUnknown:`Rove 无法检查 {binary}。`,commandDefault:`{command}(默认)`,commandCustom:`{command}(自定义)`,signedIn:`已登录。`,signedInAs:`已登录:{who}。`,apiKey:`已配置 API key。`,token:`已配置 Token({source})。`,signedOut:`未登录。请用引擎自己的命令行登录。`,signInUnknown:`Rove 无法得知该引擎是否已登录。`,signInFailed:`登录检查失败:{error}`,hooksInstalled:`Rove 的钩子已安装,标签页的状态会实时上报。`,hooksOutdated:`Rove 的钩子来自旧版本;请在「引擎接入」里重新安装。`,hooksMissing:`Rove 的钩子未安装;请在「引擎接入」里安装。`,hooksAwaitEngine:`引擎安装后才能装 Rove 的钩子。`,hooksUnsupported:`该引擎没有可供 Rove 安装的钩子。`,hooksBlocked:`Rove 无法把钩子写入 {file}:{reason}`,hooksBlockedHere:`Rove 无法把钩子写入引擎配置:{reason}`,markersYes:`它会留下回合完成标记,Rove 可以读回。`,markersNo:`它不留下回合完成标记。`,screenYes:`读屏规则兜底钩子覆盖不到的状态。`,screenNo:`没有读屏规则。`,screenNotNeeded:`没有读屏规则;钩子已报全所有状态。`,adapterDeclared:`借用 {protocol} 适配器。`,adapterGeneric:`通用适配器:没有会话记录读取、登录检查和恢复。`,skill:`Rove 技能`,skillInstalled:`已安装在 {dir}。`,skillInstalledHere:`已安装,是最新版。`,skillOutdated:`来自旧版 Rove;请在「Rove 智能体技能」里重新安装。`,skillMissing:`未安装;请在「Rove 智能体技能」里安装。`},skill:{title:`Rove 智能体技能`,hint:`教会各引擎里的智能体自己操作 Rove(rove api):开任务、读其他会话、给它们发消息。`,install:`安装({count})`,noEngines:`这台机器上没有能装技能的引擎`,failed:`安装失败:{reason}`,bannerTitle:`ROVE 技能未安装`,bannerHint:`{engines} 还不能操作 Rove(开任务、读其他会话)。点这里安装。`,bannerHintWeb:`{engines} 还不能操作 Rove(开任务、读其他会话)。`},integrations:{title:`引擎接入`,hint:`Rove 写进各引擎自身配置的钩子,让标签页在工作、等待、完成的那一刻就显示出来。`,summary:`已安装 {installed}/{total}`,install:`安装缺失的({count})`,upToDate:`全部已是最新`,remove:`全部移除({count})`,noneInstalled:`没有可移除的`},addEngine:`+ 添加引擎`,launchCommandTitle:`{name} 的启动命令`,displayNameTitle:`{name} 的显示名称(留空 = 默认)`,addTitle:`添加引擎`,addStepTitle:`添加引擎 · {id}`,protocolTitle:`添加引擎 · {id} —— 协议`,protocolNone:`无 —— 通用适配器`,protocolFooter:`↑↓ 选择 · enter 确认 · esc 取消`,protocolRow:`协议 {protocol}`,protocolGeneric:`通用`,idPlaceholder:`小写短名,如 aider`,commandPlaceholder:`如 aider --model sonnet`,hookTrustHint:`在引擎中打开 {command},由你自行批准 hooks。写入不代表已授权。`,readiness:`CLI:{cli} · 登录:{login} · hooks:{hooks}`,cliReady:`可用`,cliMissing:`缺失;请安装引擎 CLI`,loginReady:`已检测到`,loginMissing:`请通过引擎 CLI 登录`,readinessUnknown:`无法观测`,hooksWritten:`已写入`,hooksMissing:`未写入;设置 → 引擎`,hooksOutdated:`已过时;设置 → 引擎`,hookWaiting:`尚未收到 hook 事件。授权后发送一条简短提示,验证活动状态。`,hookReceived:`已记录此标签页的 hook 事件。发送简短提示以检查当前上报;不据此推断当前授权。`,readinessFailed:`无法检查就绪状态;请运行 rove doctor。不会据此推断已授权。`},accounts:{checking:`检查中…`,notLoggedIn:`○ 未登录`,loggedIn:`● 已登录: {email}`,apiKeyConfigured:`● 已配置 API key`,chatgptLogin:`● ChatGPT 登录: {email}`,tokenConfigured:`● 已配置 Token ({source})`,detected:`● 检测到登录`}},Yy={plugins:{title:`Plugins`,hint:"Rove's first-party mods first: enter (or click) installs or uninstalls one, and uninstalling keeps its data on disk. Then the plugins registered in ~/.rove/plugins.json: enter toggles one on or off — the daemon watches the file, so the change applies live. Rows indented under a plugin are the settings it declares; enter edits one, and the value reaches the plugin on its next run. Install and remove them from the shell: `rove plugin install <owner/repo>`, `rove plugin link <dir>`.",empty:"Kanban and Issues are first-party mods: enter (or click) installs one. No other plugins registered; add one with `rove plugin install <owner/repo>` — browse the `rove-plugin` topic on GitHub.",sourceLink:`linked {path}`,sourceGithub:`{spec}`,sourceBuiltIn:`first-party mod · not installed`,sourceBuiltInInstalled:`first-party mod · installed`,updateAvailable:`update available — rove plugin update`,declares:`{actions} actions · {events} events · {panes} panes`,declaresWithEngines:`{actions} actions · {events} events · {panes} panes · {engines} engines`,declaresPages:`· {pages} pages`,pageFailed:`page {detail}`,manifestUnreadable:`manifest unreadable; check the rove-plugin.toml path and TOML syntax`,unsupportedPlatform:`· not supported on this platform`,noHooks:`· no hooks declared`,lastRun:`· last run {label} {status} {ago} ago`,neverRun:`· never run`,runOk:`ok`,runRunning:`still running`,runFailed:"failed to start; inspect `rove plugin log <id>`",runExit:`exit {code}`,settingUnset:`(unset — enter to edit)`,settingInvalidTitle:`Not a number`,settingInvalidBody:`{label} only accepts a number. Keeping the previous value.`},marketplace:{title:`Marketplace`,hint:"Plugins published under the `rove-plugin` topic on GitHub, most-starred first. enter (or click) shows what the install would run and asks before running any of it. The listing is re-queried each time you open this section.",loading:`Searching GitHub…`,empty:`No plugins listed.`,offline:`GitHub is unreachable — showing first-party plugins only. Re-open this section to retry.`,installedTag:`installed`,firstParty:`first-party`,preparing:`cloning {ref}…`,installing:`building and registering {name}…`,installed:`installed {id} v{version} — it is enabled, and appears under Plugins.`,cancelled:`install cancelled; nothing was run.`,failed:`install failed: {error}. Check the build output and retry from Marketplace.`,alreadyInstalled:`already installed as {id} — manage it under Plugins.`,confirmTitle:`Install {name}?`,confirmInstall:`install`,previewSource:`source: {source}`,previewCommands:`Commands this plugin declares:`,previewNoCommands:`This plugin declares no commands.`,previewWarning:`warning: {warning}`,previewTrust:`Installing runs the build commands above, and the rest run later on the events they declare. They run as you, with your environment, and nothing is sandboxed.`}},Xy={plugins:{title:`插件`,hint:"先列 Rove 官方 mod:enter(或点击)安装或卸载,卸载后数据仍留在磁盘上。再列在 ~/.rove/plugins.json 里注册的插件:enter 切换启用/禁用——daemon 监听该文件,改动实时生效。插件下方缩进的行是它声明的设置项,enter 编辑,新值在插件下次运行时生效。安装与移除在 shell 里做:`rove plugin install <owner/repo>`、`rove plugin link <dir>`。",empty:"Kanban 和 Issues 是官方 mod:enter(或点击)安装。尚未注册其他插件;用 `rove plugin install <owner/repo>` 安装一个——可在 GitHub 的 `rove-plugin` 话题下浏览。",sourceLink:`本地链接 {path}`,sourceGithub:`{spec}`,sourceBuiltIn:`官方 mod · 未安装`,sourceBuiltInInstalled:`官方 mod · 已安装`,updateAvailable:`有新版本 — rove plugin update`,declares:`{actions} 个动作 · {events} 个事件 · {panes} 个面板`,declaresWithEngines:`{actions} 个动作 · {events} 个事件 · {panes} 个面板 · {engines} 个引擎`,declaresPages:`· {pages} 个页面`,pageFailed:`页面 {detail}`,manifestUnreadable:`manifest 无法解析;请检查rove-plugin.toml 的路径和 TOML 语法`,unsupportedPlatform:`· 不支持当前平台`,noHooks:`· 未声明钩子`,lastRun:`· 上次运行 {label} {status} {ago}前`,neverRun:`· 尚未运行过`,runOk:`成功`,runRunning:`仍在运行`,runFailed:"启动失败;请查看 `rove plugin log <id>`",runExit:`退出码 {code}`,settingUnset:`(未设置 — enter 编辑)`,settingInvalidTitle:`不是数字`,settingInvalidBody:`{label} 只接受数字,保留原值。`},marketplace:{title:`插件市场`,hint:"GitHub 上 `rove-plugin` 话题下发布的插件,按 star 数排序。enter(或点击)会先列出安装会执行的命令,确认后才真正执行。每次进入本区块都会重新查询列表。",loading:`正在搜索 GitHub…`,empty:`列表为空。`,offline:`GitHub 不可达——只显示首方插件。重新进入本区块可再试一次。`,installedTag:`已安装`,firstParty:`首方`,preparing:`正在克隆 {ref}…`,installing:`正在构建并注册 {name}…`,installed:`已安装 {id} v{version}——已启用,可在「插件」区块管理。`,cancelled:`已取消安装,没有执行任何命令。`,failed:`安装失败:{error}。请检查构建输出,再从插件市场重试。`,alreadyInstalled:`已安装为 {id}——在「插件」区块管理。`,confirmTitle:`安装 {name}?`,confirmInstall:`安装`,previewSource:`来源:{source}`,previewCommands:`该插件声明的命令:`,previewNoCommands:`该插件未声明任何命令。`,previewWarning:`警告:{warning}`,previewTrust:`安装会执行上面的 build 命令,其余命令会在它们声明的事件发生时执行。它们以你的身份、带你的环境变量运行,没有任何沙箱。`}},Zy={en:{appearance:{enabled:`On`,disabled:`Off`,borderFlow:`Flowing gradient`,borderStill:`Still`,glyphsBraille:`Braille`,glyphsStarburst:`Starburst (needs a font with the Dingbats block)`,glyphsAscii:`ASCII`,titleShimmer:`Shimmer`,titleStill:`Still`,preview:`Workspace preview`,tasks:`Tasks`,terminal:`Terminal`,files:`Files`,testsPassed:`Tests passed`,transparent:`Transparent background`,opaque:`Opaque background`,modeDark:`Dark`,modeLight:`Light`,modeAuto:`Auto (follow the terminal)`,openHint:`Enter to choose an option and preview it.`,chooseHint:`↑/↓ or j/k preview · enter apply · esc cancel`},title:`Settings`,esc:`esc`,nav:{default:`j/k pick · h/l switch level · enter activate · esc close`,keys:`j/k pick · enter record a key · backspace default · x unbind · esc close`,feedback:`tab next field · enter sends on Send · esc close`},sections:{general:`General`,engines:`Engines`,autoRouting:`Auto routing`,plugins:`Plugins`,marketplace:`Marketplace`,keys:`Keybindings`,feedback:`Feedback`,dev:`Dev`},general:{usage:`USAGE`,theme:`Theme`,themeMode:`Mode`,themeHint:`l to enter list · j/k to highlight · enter to apply`,language:`Language`,languageHint:`Display language for Rove's UI. l to enter list · j/k to highlight · enter to apply.`,transparent:`Transparent background`,transparentHint:`Drops the renderer's bg fill so the host terminal shows through. enter toggles.`,on:`[x] on`,off:`[ ] off`,focusAccent:`Focus accent`,focusAccentHint:`Color of focused pane title, ▌ marker, and split borders.`,accentPrimary:`Primary (brand accent)`,accentSuccess:`Success (legacy green)`,accentInfo:`Info (cool blue)`,appearance:`Appearance`,appearanceHint:`How split panes draw.`,splitStyle:`Split panes`,workingBorder:`Working border`,taskColors:`Task colors`,glyphSet:`State glyphs`,colorblind:`Colorblind diff colours`,runningTitle:`Running title`,splitBox:`Box frames`,splitLine:`Divider line`,splitRail:`Accent rail`,splitRule:`Top rule`,notifications:`Notifications`,notificationsHint:`When a background tab finishes or pauses on an approval.`,toast:`Toast`,toastHint:`bottom-right popup`,sound:`Sound`,soundHint:`bell + chime + an OSC 9 desktop notification (rides SSH)`,soundVolume:`Chime volume — {percent}%`,soundVolumeHint:`enter cycles; applies to the next chime`,crossTask:`Cross-task`,crossTaskHint:`also for a task you switched away from`,finishedAlerts:`Finished turns`,finishedAlertsHint:`off: only approvals and errors alert; the unread dot stays`,keyHints:`Keyboard hints`,keyHintsHint:`The status-bar reminder and the first-use hints in the sidebar and files panes.`,keyHintsShow:`Show keyboard hints`,keyHintsShowHint:`re-enabling relights hints dismissed by use`,zen:`Zen mode`,zenHint:"The `zen` chip and `prefix`+z hide Files, keeping the Tasks rail and workspace.",zenDefaultOn:`Start in zen mode`,updates:`Updates`,updatesHint:`Stable is the default channel; next previews the coming release; nightly is built from main every day.`,updateChannelTitle:`Release channel`,updateChannel:`Channel: {channel}`,updateChannelHint:"enter cycles stable / next / nightly; `rove update` follows it",updateChannelName:{latest:`stable`,next:`next preview`,nightly:`nightly preview`},updateNotify:`Notify on updates`,updateNotifyHint:`new versions on this channel; off hides the update chip, and checking by hand still reports`,updateCheck:`[ Check for updates ]`,updateCheckHint:`asks npm for the newest release on this channel right now`,updateCheckButton:`Check for updates`,updateChecking:`Checking…`,updateOpenPage:`Open Update page`,updateOpenPageRow:`[ Open Update page ]`,railFold:`Folded task rail`,railFoldHint:`What the rail shows once folded away from its corner control.`,railFoldRow:`Folded rail shows: {style}`,railFoldRowHint:`enter cycles`,railFoldGlyphs:`status glyphs`,railFoldInitials:`glyph + initials`,railFoldHairline:`colour band only`,editor:`Editor`,editorHint:`What enter opens a file with in the file tree — diff mode when the editor supports it, the read-only preview when it isn't installed.`,editorRow:`editor: < {kind} >`,editorRowHint:`auto follows $VISUAL / $EDITOR, else nvim / vim / emacs / nano`,editorCustom:`custom: {cmd}`,editorCustomUnset:`(unset — enter to edit)`,worktree:`Worktree location`,worktreeHint:`Where new task worktrees are created. New tasks only.`,worktreeBase:`location: < {kind} >`,worktreeBaseHint:"custom takes `~`, a relative path, or a leading `$project_dir`",worktreeKindDefault:`default ~/.rove/worktrees`,worktreeKindNext:`next to project`,worktreeKindCustom:`custom`,worktreeCustom:`custom: {path}`,worktreeCustomUnset:`(unset — enter to edit)`,worktreeBaseTitle:`Custom worktree location (blank = default; $project_dir = project root)`,worktreeBaseField:`PATH`,editorCustomTitle:`Custom editor command (use {file} for the path)`,worktreeBaseInvalidTitle:`Can't use that worktree location`,worktreeBaseTokenBody:`{token} only expands as the leading path segment (e.g. {token}/../rove-worktrees). Keeping the previous setting.`,worktreeBaseUnusableBody:`{path} isn't usable ({error}). Keeping the previous setting — pick a writable directory.`,terminal:`Terminal`,terminalHint:`Applies to terminals opened after the change.`,scrollbackRow:`scrollback: {rows} rows`,scrollbackRowHint:`100–100000 · larger costs proportionally more CPU per redraw`,scrollbackTitle:`Terminal scrollback rows (100–100000)`,scrollbackField:`ROWS`,scrollbackInvalidTitle:`Not a number`,scrollbackInvalidBody:`Scrollback must be a number of rows (e.g. 1000). Keeping the previous setting.`,tabStripRow:`tab strip: {mode}`,tabStripMode:{never:`off — the sidebar tree lists tabs`,multipleOnly:`only with 2+ tabs`,always:`always`}},field:{command:`COMMAND`,name:`NAME`,id:`ID`},action:{save:`save`,next:`next`,add:`add`},reset:{title:`Reset UI state?`,body:`Wipes ~/.config/rove/state.json and ~/.rove/tasks.json, then quits Rove — relaunch for a fresh start with an empty working session list. Worktrees on disk and engine session history are NOT touched.`,done:`Rove: UI state reset. Relaunch Rove to start fresh.`,failedTitle:`UI state was not reset`,failedBody:`Could not write the settings file. Your settings and tasks have been kept. Try resetting again.`},restart:{title:`Restart backend?`,body:`Stops the daemon and relaunches this Rove on the installed build, so daemon / orchestrator / engine edits take effect. Running engine sessions live in the PTY host and keep going; open tabs come back. Any other attached windows reconnect on their own.`,done:`Rove: restarting the backend...`},stateWrite:{failedTitle:`Settings were not saved`,failedBody:`{file} could not be written ({keys}). Check its directory permissions and free disk space, then save again.`},...Uy,...qy,...Yy,keybindings:{title:`Keybindings`,hint:`Press enter on a binding, then the key you want. To put it behind the prefix, press the prefix key first. Changes are saved to the file below and apply at once.`,configFile:`Config file`,notCreated:` (not created yet)`,prefixTitle:`Command layer ({prefix})`,prefixHint:`Bare keys act in the focused pane; a small one-press set covers frequent Rove actions; {prefix} opens the command layer ({timeout}ms second-stroke window). Prefix bindings keep their pane scope and modal rules.`,tapPresentation:`Prefix tap`,tapPresentationHint:`Choose whether the complete guide also marks controls already on screen.`,tapPresentationLocal:`On-screen entries + complete guide (default)`,tapPresentationGuide:`Complete guide only`,prefixDisabled:`disabled`,prefixKey:`Prefix key`,recording:`press the new key… (esc cancels)`,recordingPrefix:`{prefix}, then… (esc cancels)`,recordingSlot:`press the key for {slot}… (esc cancels)`,unbound:`(unbound)`,defaultKeys:`default: {keys}`,warnings:`Warnings`},feedback:{title:`Feedback`,hint:"Files a GitHub issue on the Rove repo through `gh`. Requires `gh auth login`; without it you get a prefilled link to open.",titleLabel:`title`,titlePlaceholder:`Short summary`,descriptionLabel:`description`,descriptionPlaceholder:`What happened? (enter for a new line · tab to Send)`,send:`[enter] File a GitHub issue`,submitting:`submitting...`,sent:`filed #{number}: {url}`,notFiled:`not filed: {hint}
48
48
  {url}`,error:`error: {message}
49
- {hint}`},...qy},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})。请检查目录权限和磁盘空间,再次保存。`},...Ky,...Xy,...Qy,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}
49
+ {hint}`},...Gy},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})。请检查目录权限和磁盘空间,再次保存。`},...Wy,...Jy,...Xy,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}
50
50
  {url}`,error:`错误:{message}
51
- {hint}`},...Jy}},eb={en:Wi,zh:Gi};function Q(e,t){return Pt($y,e,t)}function tb(e,t){return Pt(eb,e,t)}function nb({label:e,value:t,picks:n,onPick:r}){return(0,H.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,H.jsx)(`button`,{type:`button`,"aria-pressed":n,className:It(`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 rb({label:e,value:t,picks:n,onPick:r}){let i=(0,h.useRef)(!1),a=e=>{let i=e.getBoundingClientRect();S.set({x:i.left,y:i.bottom+4,right:i.right,minWidth:i.width,start:Math.max(n.findIndex(e=>e.value===t),0),target:e,items:n.map(n=>({label:n.label,checked:n.value===t,run:()=>{e.focus(),n.value!==t&&r(n.value)}}))})};return(0,H.jsxs)(`button`,{type:`button`,"aria-label":`${e}: ${n.find(e=>e.value===t)?.label??t}`,"aria-haspopup":`menu`,className:`relative inline-flex max-w-full min-w-0 items-center rounded-sm border-hairline border-line bg-inset py-1.5 pr-7 pl-2.5 text-left font-sans text-meta text-ink hover:border-line-active focus-visible:border-line-active focus-visible:outline-none data-menu-open:border-line-active touch:min-h-10`,onMouseDown:e=>{i.current=e.currentTarget.hasAttribute(`data-menu-open`)},onClick:e=>{i.current||a(e.currentTarget),i.current=!1},onKeyDown:e=>{(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),a(e.currentTarget))},children:[(0,H.jsx)(`span`,{className:`min-w-0 truncate`,children:n.find(e=>e.value===t)?.label??t}),(0,H.jsx)(ps,{className:`pointer-events-none absolute top-1/2 right-2.5 -translate-y-1/2 text-subtle`})]})}var ib=`${Br} w-narrow:pt-0`,ab=`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:translate-x-[var(--back-x,0px)] w-narrow:pb-[env(safe-area-inset-bottom)] short:h-[calc(100dvh-24px)]`,ob=`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`,sb=e=>`hidden flex-none items-center ${e?`px-5`:`px-4`} py-3 text-left font-mono text-meta font-bold text-accent w-narrow:flex touch:min-h-11`,cb=e=>`flex min-h-0 min-w-0 flex-1 flex-col ${e?`absolute inset-0 z-1 translate-x-(--back-x) bg-surface [padding:inherit] shadow-dialog`:``}`,lb=`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`,ub=`m-0 px-2 pb-0.5 font-sans text-title font-semibold normal-nums text-ink`,db=`flex flex-col gap-0.5`,fb=`m-0 px-2 pb-1 font-mono text-meta font-normal text-subtle`,pb=(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`}`,mb=`ml-auto hidden text-subtle w-narrow:block`,hb=`flex flex-col`,gb=`flex min-w-0 flex-wrap gap-x-4 text-meta`,_b=`inline-flex min-h-6.5 min-w-0 items-center gap-2`,vb=`block h-7 w-36 rounded-md border-hairline border-line bg-paper`,yb=`m-0 pb-2 text-meta text-subtle`,bb=`flex flex-col border-t-hairline border-t-line [&>*]:border-b-hairline [&>*]:border-b-line`,xb=`flex items-center justify-between gap-x-6 gap-y-2 py-3 w-narrow:flex-col w-narrow:items-stretch`,Sb=`flex items-center justify-between gap-x-6 py-3`,Cb=`flex flex-col gap-3 py-3`,wb=`flex min-w-0 flex-1 flex-col gap-0.5`,Tb=`text-body text-ink`,Eb=`text-meta text-muted [&_a]:text-accent`,Db=`max-w-90 min-w-0 truncate font-mono text-meta text-muted [overflow-wrap:anywhere]`,Ob=`m-0 py-3 text-body text-muted`,kb=`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`,Ab=`${kb} w-24 text-right`,jb=`flex flex-col gap-1.5`,Mb=`text-meta font-medium text-muted`,Nb=`min-h-30 max-h-[50vh] leading-[1.45]`,Pb=`flex flex-wrap items-center justify-end gap-2.5`,Fb=`flex items-center gap-2.5 rounded-sm bg-inset px-3 py-2 text-meta`,Ib=`grid grid-cols-[minmax(0,1fr)_104px_72px] items-center gap-3`,Lb=`flex flex-col`,Rb=`${Ib} pb-1.5 pl-7.5 font-sans text-meta font-medium normal-nums text-subtle [&>span:not(:first-child)]:text-center`,zb=`border-b-hairline border-b-line first:border-t-hairline first:border-t-line`,Bb=`${Ib} group/eng rounded-sm py-1.5 pr-1 pl-0`,Vb=`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`,Hb=e=>`mx-0.5 ${e?`text-muted`:`text-subtle`}`,Ub=`flex min-w-0 flex-col gap-0.5`,Wb=e=>`truncate text-body leading-[inherit] font-medium ${e?`text-muted`:`text-ink`}`,Gb=`ml-2 text-meta leading-[inherit] font-normal text-subtle`,Kb={ready:`bg-success`,attention:`bg-warning`,error:`bg-error`,absent:`bg-subtle`},qb=e=>`inline-flex items-center gap-1.5 text-meta leading-[inherit] ${e===`error`?`text-error`:`text-muted`}`,Jb=e=>`size-1.75 flex-none rounded-full ${Kb[e]}`,Yb=`flex justify-center`,Xb=`rounded-full bg-accent-soft px-2.5 py-0.5 font-sans text-meta font-medium normal-nums capitalize text-accent`,Zb=`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`,Qb=`mt-0 mr-1 mb-3 ml-7 flex flex-col gap-2.5 px-1.5 py-1`,$b=`m-0 grid grid-cols-[max-content_minmax(0,1fr)] gap-x-3.5 gap-y-1.5 text-meta leading-[1.5]`,ex=`text-subtle`,tx=e=>`m-0 wrap-anywhere ${e?`text-warning`:`text-ink`}`,nx=`flex items-center gap-2`,rx=`flex-1 px-2 py-1.25`,ix=`text-meta leading-[inherit] text-success`,ax=`flex items-center gap-3 py-2.5`,ox=`flex min-w-0 flex-1 flex-col gap-0.5`,sx=(e=!1)=>`overflow-hidden text-ellipsis text-meta text-muted ${e?`whitespace-normal`:`whitespace-nowrap`}`,cx=`flex flex-col gap-1 py-3`,lx=`flex items-baseline gap-3`,ux=`flex flex-col gap-2.5 pt-2`,dx=`grid grid-cols-[repeat(auto-fill,minmax(96px,1fr))] gap-2`,fx=`m-0 pb-1.5 text-meta font-medium text-subtle`,px=e=>e?`border-accent bg-accent-soft`:`border-line hover:bg-hover`,mx=`flex h-9 overflow-hidden rounded-xs border-hairline`,hx=`flex w-2/5 flex-col gap-0.75 p-1`,gx=`flex min-w-0 flex-1 flex-col gap-0.75 p-1`,_x=`h-0.75 rounded-xs`,vx=`mt-auto flex gap-0.75`,yx=`size-1 rounded-xs`,bx=`flex min-w-0 items-baseline gap-1.5 font-sans text-meta`,xx=`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`,Sx=`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 Cx({on:e,...t}){return(0,H.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,className:xx,...t,children:(0,H.jsx)(`span`,{className:Sx})})}function wx(e){return(0,H.jsxs)(`section`,{className:hb,children:[e.title&&(0,H.jsx)(`h2`,{className:`m-0 pb-1.5 font-sans text-meta font-medium normal-nums text-muted`,children:e.title}),e.hint&&(0,H.jsx)(`p`,{className:`m-0 pb-2 text-meta text-subtle`,children:e.hint}),(0,H.jsx)(`div`,{className:bb,children:e.children})]})}function Tx(e){let t=(0,H.jsxs)(`div`,{className:wb,children:[(0,H.jsx)(`span`,{id:e.labelId,className:Tb,children:e.label}),e.hint&&(0,H.jsx)(`span`,{className:`text-meta text-muted [&_a]:text-accent`,children:e.hint}),e.sample&&(0,H.jsx)(`span`,{className:`mt-1.5 flex min-w-0`,children:e.sample})]});return e.stack?(0,H.jsxs)(`div`,{className:Cb,children:[t,e.children]}):(0,H.jsxs)(`div`,{className:e.inline?Sb:xb,children:[t,e.children&&(0,H.jsx)(`div`,{className:`flex min-w-0 flex-none items-center justify-end gap-2 w-narrow:justify-start`,children:e.children})]})}function Ex(e){let t=(0,h.useId)();return(0,H.jsx)(Tx,{label:e.label,hint:e.hint,labelId:t,inline:!0,children:(0,H.jsx)(Cx,{on:e.checked,"aria-labelledby":t,disabled:e.disabled,onClick:()=>e.onChange(!e.checked)})})}var Dx=36;function Ox(e){let t=e.picks.length<=4&&e.picks.reduce((e,t)=>e+t.label.length,0)<=Dx?nb:rb;return(0,H.jsx)(Tx,{label:e.label,hint:e.hint,sample:e.sample,children:(0,H.jsx)(t,{label:e.label,value:e.value,picks:e.picks,onPick:e.onPick})})}function kx(e){return(0,H.jsx)(Tx,{label:e.label,hint:e.note,children:(0,H.jsx)(`span`,{className:Db,children:e.value})})}var Ax=`page min-h-0 flex-1 rounded-md border-hairline border-line bg-paper px-4.5 py-3.5 focus:outline-none`,jx=`${Ax} overflow-y-auto`,Mx=`page-title mx-0 mt-0 mb-1.5 font-sans text-title font-bold normal-nums`,Nx=`flex items-baseline justify-between gap-4 [&_.page-title]:m-0`,Px=e=>`min-w-0 truncate text-meta ${e?``:`leading-[inherit]`}`,Fx=`flex flex-wrap items-center gap-2`,Ix={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`},Lx=`mt-2.5 flex flex-col gap-1.5`,Rx=e=>`flex cursor-pointer flex-col gap-0.5 rounded-sm px-2.5 py-1.5 ${e?`bg-menu`:``}`,zx=`flex min-w-0 items-baseline gap-2.5`,Bx=`whitespace-nowrap text-muted`,Vx=`flex gap-2.5 pl-[4ch] text-meta leading-[inherit] text-muted`,Hx=`min-w-0 flex-1 truncate`,Ux=`flex flex-col px-1.5 pb-2`,Wx=`flex flex-col border-t-hairline border-t-line px-1.5 py-1.5`,Gx=`relative flex flex-col`,Kx=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`}`,qx=`ml-auto -mr-[4.5px] w-5 text-center font-sans text-display leading-none font-normal text-accent normal-nums`,Jx=`mr-[7px] size-3.5 flex-none fill-none stroke-current stroke-[1.75] [stroke-linecap:round] [stroke-linejoin:round]`,Yx=`flex items-baseline justify-between`,Xx=`[&_b]:mr-2.5`,Zx=`${Ax} flex flex-col overflow-hidden`,Qx=`min-h-0 flex-1 overflow-y-auto`,$x=`whitespace-nowrap text-[length:var(--fs-meta)] text-warning`,eS=`rail-tight:hidden`,tS=`[&_h2]:mx-0 [&_h2]:mt-3.5 [&_h2]:mb-1 [&_h2]:text-[length:var(--fs-body)]`,nS=`max-h-[55vh] overflow-x-hidden overflow-y-auto`,rS=`mr-auto text-[length:var(--fs-meta)]`,iS=`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`,aS=`mt-3`,oS=e=>`rounded-sm px-2 py-1.25 ${e?`bg-menu`:``}`,sS=`flex items-baseline gap-2 text-[length:var(--fs-body)]`,cS=`flex items-baseline justify-between gap-2`,lS=`font-mono`,uS=`truncate`,dS=`mt-4 text-[length:var(--fs-meta)]`;function fS(e){return e.replace(/\[`[0-9a-f]{7,40}`\]\([^)]*\)\s*/g,``).replace(/\s+[—-]\s+\[@[^\]]+\]\([^)]*\)\s*$/,``).trim()}function pS(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:fS(e.text)}:e)}var mS=/\[([^\]]+)\]\((https?:\/\/[^)\s]+)\)|`([^`]+)`|\*\*([^*]+)\*\*/g;function hS(e){let t=[],n=0;for(let r of e.matchAll(mS)){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,H.jsx)(`a`,{href:s,target:`_blank`,rel:`noopener noreferrer`,children:hS(o)},i)):c===void 0?l!==void 0&&t.push((0,H.jsx)(`b`,{children:l},i)):t.push((0,H.jsx)(`code`,{children:c},i)),n=i+a.length}return n<e.length&&t.push(e.slice(n)),t}function gS({body:e}){let t=pS(e),n=[],r=[],i=()=>{r.length>0&&n.push((0,H.jsx)(`ul`,{children:r},`ul-${n.length}`)),r=[]};for(let e of t){if(e.kind===`item`){r.push((0,H.jsx)(`li`,{children:hS(e.text)},e.id));continue}i(),n.push(e.kind===`heading`?(0,H.jsx)(`h3`,{children:e.text},e.id):(0,H.jsx)(`p`,{children:hS(e.text)},e.id))}return i(),(0,H.jsx)(`div`,{className:iS,children:n})}var _S=v(null),vS=v(!1),yS=(e,t)=>e.replace(/\{(\w+)\}/g,(e,n)=>t[n]??e),bS=e=>`https://github.com/Sma1lboy/rove/releases/tag/v${e}`;function xS(){return V()===`zh`?Yi:Ji}function SS(e,t){return e.request(`update.check`,{force:!0,locale:At.get(),channel:t}).then(e=>(_S.set(e),!0),()=>!1)}function CS(){let e=xS(),t=y(_S),{prefs:n}=wp();return!n.updateNotify||!t?.info?.hasUpdate?null:(0,H.jsxs)(`button`,{type:`button`,className:`${W} text-muted ${$x} ${Gt}`,title:yS(e.chip,{version:t.info.latest}),onClick:()=>he(`update`),children:[`↑`,(0,H.jsxs)(`span`,{className:eS,children:[` `,t.info.latest]})]})}function wS({notes:e}){return e.map(e=>(0,H.jsxs)(`section`,{className:tS,children:[(0,H.jsxs)(`h2`,{className:`mono`,children:[`v`,e.version]}),(0,H.jsx)(gS,{body:e.body})]},e.version))}var TS=1e3;function ES(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,TS):i(!1))},()=>t&&i(!1));return o(),()=>{t=!1,clearTimeout(a)}},[e,r]),{run:t,setRun:n,poll:()=>i(!0)}}function DS({client:e}){let t=xS(),n=y(_S),[r,i]=(0,h.useState)(!1),[a,o]=(0,h.useState)(null),{run:s,setRun:c,poll:l}=ES(e),u=(0,h.useRef)(null);(0,h.useEffect)(()=>{u.current?.focus(),SS(e).finally(()=>i(!0))},[e]);let d=n?.info??null,f=n?.current??``,p=d?.latest??f,m=d?.hasUpdate===!0,g=r&&d===null,_=r&&d!==null&&!m,v=n?.notes??[],b=v[0]?.url??(p?bS(p):null),x=s?.code===0,[S,C]=(0,h.useState)(!1),w=m&&!s?.running&&!x,T=n=>{if(n===`close`)return O.set(null);if(n===`restart`){if(!x||S)return;C(!0),e.request(`update.restart`,{}).catch(e=>e instanceof Uo&&C(!1));return}if(n===`update`){if(!w)return;o(null),e.request(`update.run`,{}).then(e=>{c(e.status),l()},e=>{if(e instanceof Uo&&e.code===`BUSY`)return l();o(yS(t.webStartFailed,{error:e instanceof Error?e.message:String(e)}))});return}o(b&&window.open(b,`_blank`,`noopener`)!==null?t.statusReleaseOpened:t.statusReleaseError)};return(0,h.useEffect)(()=>{!r||!vS.get()||(vS.set(!1),m&&T(`update`))},[r,m]),(0,H.jsxs)(`div`,{className:Zx,tabIndex:0,ref:u,onKeyDown:e=>{if(e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.toLowerCase()===`c`&&!window.getSelection()?.toString())return e.preventDefault(),T(`close`);if(!(e.metaKey||e.ctrlKey||e.altKey)){if(e.key===`Enter`&&e.target===u.current)T(x?`restart`:w?`update`:`release`);else if(e.key===`Enter`)return;else if(e.key===`u`)T(`update`);else if(e.key===`r`)T(`release`);else if(e.key===`q`||e.key===`Escape`)T(`close`);else return;e.preventDefault()}},children:[(0,H.jsxs)(`div`,{className:Qx,children:[(0,H.jsxs)(`div`,{className:Yx,children:[(0,H.jsx)(`h1`,{className:Mx,children:t.pageTitle}),(0,H.jsx)(`button`,{type:`button`,className:`${Ar} mono`,onClick:()=>T(`close`),children:lu()?B(`dialog.close`):t.closeHint})]}),(0,H.jsxs)(`p`,{className:`mono ${Xx}`,children:[(0,H.jsx)(`span`,{className:`text-muted`,children:t.current}),` `,(0,H.jsxs)(`b`,{children:[`v`,f]}),` `,(0,H.jsx)(`span`,{className:`text-muted`,children:t.latest}),` `,g?(0,H.jsx)(`b`,{className:`text-muted`,children:t.latestUnknown}):r?(0,H.jsxs)(`b`,{className:m?`text-warning`:`text-success`,children:[`v`,p]}):(0,H.jsx)(`span`,{className:`text-muted`,children:`…`})]}),g&&(0,H.jsx)(`p`,{className:`text-muted`,children:t.registryRetry}),_&&(0,H.jsx)(`p`,{className:`text-success`,children:t.upToDate}),a&&(0,H.jsx)(`p`,{className:`mono text-accent`,children:a}),s&&(0,H.jsxs)(H.Fragment,{children:[s.output&&(0,H.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:s.output}),(0,H.jsx)(`p`,{className:`mono ${s.running?`text-muted`:s.code===0?`text-success`:`text-error`}`,children:s.running?yS(t.webRunning,{command:s.command}):s.code===0?S?t.webRestarting:yS(t.webInstalled,{latest:p}):yS(t.updateFailed,{code:String(s.code)})})]}),m&&(0,H.jsx)(`p`,{className:`mono text-muted`,children:yS(t.changesSectionHeader,{from:f,to:p})}),!r&&(0,H.jsx)(`p`,{className:`text-muted`,children:t.loadingNotes}),r&&m&&v.length===0&&(0,H.jsx)(`p`,{className:`text-muted`,children:t.notesUnavailable}),(0,H.jsx)(wS,{notes:v})]}),(0,H.jsxs)(`div`,{className:`${Nr} pt-2.5`,children:[b?(0,H.jsx)(`a`,{className:Ar,href:b,target:`_blank`,rel:`noopener noreferrer`,"aria-keyshortcuts":`r`,children:t.actions.openRelease}):(0,H.jsx)(`span`,{className:`text-muted`,children:t.releaseUrlUnavailable}),x&&(0,H.jsx)(U,{variant:`filled`,disabled:S,onClick:()=>T(`restart`),children:t.webRestart}),w&&(0,H.jsx)(U,{variant:`filled`,"aria-keyshortcuts":`u`,onClick:()=>T(`update`),children:t.actions.updateNow})]})]})}var OS=`rove.whatsNewSeenVersion`,kS=e=>e.split(/[.-]/).slice(0,3).map(Number),AS=(e,t)=>{let[n,r]=[kS(e),kS(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 jS(e,t){let n=localStorage.getItem(OS);localStorage.setItem(OS,t),!(!n||!AS(t,n))&&e.request(`release.notes`,{version:t.replace(/-.*$/,``),locale:At.get()}).then(e=>C.set((0,H.jsx)(MS,{from:n,to:t,notes:e.notes})),()=>C.set((0,H.jsx)(MS,{from:n,to:t,notes:null})))}function MS(e){let t=xS(),n=(0,h.useRef)(null);return(0,h.useEffect)(()=>n.current?.focus(),[]),(0,h.useEffect)(()=>{let e=e=>{e.key===`q`&&C.set(null)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,H.jsxs)(Si,{title:t.whatsNew.title,wide:!0,children:[(0,H.jsx)(`p`,{className:`text-muted`,children:yS(t.whatsNew.upgraded,{from:e.from,to:e.to})}),(0,H.jsx)(`div`,{className:nS,children:e.notes?(0,H.jsx)(gS,{body:e.notes.body}):(0,H.jsx)(`p`,{className:`text-muted`,children:t.whatsNew.notesUnavailable})}),(0,H.jsxs)(`div`,{className:Nr,children:[(0,H.jsx)(`span`,{className:`mono text-muted ${rS} touch:hidden!`,children:B(`whatsNew.keys`)}),(0,H.jsx)(`a`,{className:Ar,href:e.notes?.url??bS(e.to),target:`_blank`,rel:`noopener noreferrer`,children:B(`whatsNew.openRelease`)}),(0,H.jsx)(`button`,{ref:n,type:`button`,className:xr(),onClick:()=>C.set(null),children:B(`whatsNew.continue`)})]})]})}var NS=(e,t)=>e.replace(`{version}`,t);function PS({client:e}){let t=xS(),n=y(_S),{prefs:r}=wp(),[i,a]=(0,h.useState)(`idle`),o=()=>{a(`checking`),SS(e,r.updateChannel).then(e=>a(e?`done`:`failed`))},s=t=>{a(`idle`),Sp(e,`updateChannel`,t)},c=n?.info??null,l=i===`failed`||i===`done`&&c===null,u=i===`done`&&n&&c?c.hasUpdate?NS(t.available,c.latest):t.upToDate:l?t.latestUnknown:void 0,d=l?`text-muted`:c?.hasUpdate?`text-warning`:`text-success`;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Ox,{label:Q(`general.updateChannelTitle`),hint:Q(`general.updatesHint`),value:r.updateChannel,picks:Wy.map(e=>({value:e,label:Q(`general.updateChannelName.${e}`)})),onPick:s}),(0,H.jsx)(Ex,{label:Q(`general.updateNotify`),hint:Q(`general.updateNotifyHint`),checked:r.updateNotify,onChange:t=>void Sp(e,`updateNotify`,t)}),(0,H.jsxs)(Tx,{label:Q(`general.updates`),hint:Q(`general.updateCheckHint`),children:[i===`done`&&c?.hasUpdate&&(0,H.jsx)(U,{variant:`action`,onClick:()=>he(`update`),children:Q(`general.updateOpenPage`)}),(0,H.jsx)(U,{variant:`action`,disabled:i===`checking`,onClick:o,children:Q(i===`checking`?`general.updateChecking`:`general.updateCheckButton`)})]}),u&&(0,H.jsx)(Tx,{label:(0,H.jsx)(`span`,{className:d,children:u}),hint:c?.hasUpdate?(0,H.jsx)(`code`,{className:`font-mono`,children:`rove update`}):void 0,children:i===`done`&&n&&c&&(0,H.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 FS({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,H.jsxs)(wx,{title:B(`settings.about.access`),children:[(0,H.jsx)(Ox,{label:B(`settings.about.signIn`),hint:B(`settings.about.signInHint.${f}`),value:f,picks:t.modes.map(e=>({value:e,label:B(`settings.about.signInMode.${e}`)})),onPick:e=>{e===`password`&&!t.hasPassword?i(!0):d(e)}}),f===`password`&&(0,H.jsxs)(Tx,{label:B(t.hasPassword?`settings.about.passwordChange`:`settings.about.passwordSet`),hint:c??B(`settings.about.passwordHint`,{min:t.minPassword}),children:[(0,H.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":B(`settings.about.passwordField`),placeholder:B(`settings.about.passwordField`),value:o,onChange:e=>s(e.target.value),onKeyDown:e=>e.key===`Enter`&&!p&&void d(`password`,o)}),(0,H.jsx)(U,{variant:`action`,disabled:p,onClick:()=>void d(`password`,o),children:B(`settings.about.passwordSave`)})]})]})}function IS({client:e}){let[t,n]=(0,h.useState)(()=>X(e,`daemon.info`)??null);return(0,h.useEffect)(()=>{Ku(e,`daemon.info`).then(n,()=>n(null))},[e]),(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(wx,{title:B(`settings.about.groupRove`),children:[t?.daemonVersion&&(0,H.jsx)(Tx,{label:B(`settings.about.daemon`),hint:B(t.stale?`settings.about.daemonStale`:`settings.about.daemonCurrent`,{version:t.daemonVersion})}),(0,H.jsx)(PS,{client:e})]}),(0,H.jsx)(FS,{client:e}),(0,H.jsx)(wx,{title:B(`settings.about.browser`),children:(0,H.jsx)(Tx,{label:B(`settings.about.signOut`),hint:B(`settings.about.browserHint`),children:(0,H.jsx)(U,{variant:`action`,onClick:()=>void us().then(()=>window.location.reload()),children:B(`settings.about.signOut`)})})})]})}var LS=e=>new Map((e?.engines??[]).flatMap(e=>e.icon?[[e.id,e.icon]]:[]));function RS(e){let[t,n]=(0,h.useState)(()=>LS(X(e,`engines.list`))),r=y(e.tasks)!==null;return(0,h.useEffect)(()=>{r&&Ku(e,`engines.list`).then(e=>n(LS(e))).catch(()=>{})},[e,r]),t}var zS=[`both`,`engine`,`dots`];function BS(){return wp().prefs.statusMark??`both`}function VS(e,t){Sp(e,`statusMark`,t)}var HS=`block size-4 flex-none translate-y-px`,US=`animate-mark-pulse motion-reduce:[animation-duration:4.8s]`;function WS(e){let t=e.status?.look;if(t===`waiting`||t===`error`)return(0,H.jsx)(`span`,{className:`${HS} text-center font-mono text-meta leading-4 font-semibold ${up[e.status?.tone??`muted`]}`,"aria-hidden":`true`,children:t===`waiting`?`?`:`!`});let n=e.status&&(t===`idle`?`text-muted`:up[e.status.tone]);return(0,H.jsx)(`svg`,{className:`${HS} ${n??(e.icon?`text-ink`:`text-muted`)} ${t===`working`?US:``}`,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,H.jsx)(`path`,{d:e.d,fill:n?`currentColor`:e.fill??`currentColor`,fillRule:e.evenodd?`evenodd`:void 0},e.d)):(0,H.jsx)(`circle`,{cx:`7`,cy:`7`,r:`4.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.2`})})}var GS=[{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 KS({model:e}){let t=BS(),[n]=[...RS(e).values()];return(0,H.jsx)(`span`,{className:gb,"aria-hidden":`true`,children:GS.map(({label:e,status:r})=>(0,H.jsxs)(`span`,{className:_b,children:[t!==`dots`&&(0,H.jsx)(WS,{icon:n,status:t===`engine`?Th(r):void 0}),(0,H.jsx)(`span`,{className:`text-ink`,children:B(e)}),t!==`engine`&&(0,H.jsx)(Vh,{status:r})]},e))})}function qS(){return(0,H.jsx)(`span`,{className:`${_b} ${_i} ${vi}`,"aria-hidden":`true`,children:B(`settings.appearance.previewTitle`)})}function JS(){return(0,H.jsx)(`span`,{className:`${vb} ${kn}`,"aria-hidden":`true`})}function YS(e,t){return e===`auto`?t?`dark`:`light`:e}function XS(e,t,n){let r=e.find(e=>e.name===t)??e.find(e=>e.name===`claude`);return r?r[n]:null}var ZS=e=>[1,3,5].map(t=>Number.parseInt(e.slice(t,t+2),16));function QS(e){let[t=0,n=0,r=0]=ZS(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 $S(e,t){let[n=0,r=0]=[QS(e),QS(t)].sort((e,t)=>t-e);return(n+.05)/(r+.05)}var eC=4.5,tC=1.1;function nC(e,t,n){let r=e=>t.every(t=>$S(e,t)>=n(t));if(r(e))return e;let i=ZS(e),a=QS(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 rC(e){let t=[e.background,e.backgroundPanel,e.backgroundElement,e.backgroundMenu],n=nC(e.diffLineNumber,t,()=>eC);return{muted:nC(e.textMuted,t,e=>Math.max(eC,$S(n,e)*tC)),subtle:n}}function iC(e,t){let n=t.colorblind===`on`,r=rC(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 aC(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 oC=v(null),sC=v(null),cC=v(null);function lC({theme:e,mode:t}){let n=e[t],r=(e,t)=>({background:e,width:t});return(0,H.jsxs)(`span`,{className:mx,style:{background:n.background,borderColor:n.border},"aria-hidden":!0,children:[(0,H.jsxs)(`span`,{className:hx,style:{background:n.backgroundPanel},children:[(0,H.jsx)(`span`,{className:_x,style:r(n.primary,`70%`)}),(0,H.jsx)(`span`,{className:_x,style:r(n.textMuted,`85%`)}),(0,H.jsx)(`span`,{className:_x,style:r(n.textMuted,`55%`)})]}),(0,H.jsxs)(`span`,{className:gx,children:[(0,H.jsx)(`span`,{className:_x,style:r(n.text,`90%`)}),(0,H.jsx)(`span`,{className:_x,style:r(n.textMuted,`65%`)}),(0,H.jsx)(`span`,{className:_x,style:r(n.accent??n.primary,`40%`)}),(0,H.jsx)(`span`,{className:vx,children:[n.success,n.warning,n.error,n.info].map((e,t)=>(0,H.jsx)(`span`,{className:yx,style:{background:e}},t))})]})]})}function uC(e){return(0,H.jsxs)(U,{variant:`card`,"aria-pressed":e.active,className:px(e.active),onMouseEnter:()=>sC.set(e.theme),onFocus:()=>sC.set(e.theme),onClick:e.onClick,children:[(0,H.jsx)(lC,{theme:e.theme,mode:e.mode}),(0,H.jsxs)(`span`,{className:bx,children:[(0,H.jsx)(`span`,{className:`truncate text-ink`,children:e.theme.name}),e.tag&&(0,H.jsx)(`span`,{className:`text-subtle`,children:e.tag})]})]})}function dC({children:e}){return(0,H.jsx)(`div`,{className:dx,onMouseLeave:()=>sC.set(null),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||sC.set(null)},children:e})}function fC(e){let{model:t}=e,{client:n}=t,r=y(cC),[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)(()=>()=>sC.set(null),[]),(0,h.useEffect)(()=>void xp(n).catch(()=>void 0),[n]),(0,h.useEffect)(()=>{cC.get()===null&&n.request(`theme.hosted`).then(e=>cC.set(e),()=>cC.set({themes:[],dir:null}))},[n]);let f=e=>{l(!1),fy(t,B(`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 xp(n),await Sp(n,`theme`,e)}catch{s(e)}finally{a(null)}},g=new Set(e.themes.map(e=>e.name)),_=(r?.themes??[]).filter(e=>!g.has(e.name));return(0,H.jsxs)(Tx,{label:e.label,hint:B(`prefs.themePreviewHint`),stack:!0,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:fx,children:B(`prefs.themeInstalled`)}),(0,H.jsx)(dC,{children:e.themes.map(t=>(0,H.jsx)(uC,{theme:t,mode:e.mode,active:t.name===e.value,tag:t.bundled?void 0:B(`prefs.themeUser`),onClick:()=>t.name!==e.value&&void Sp(n,`theme`,t.name)},t.name))})]}),_.length>0&&(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(U,{className:`inline-flex items-center gap-1.5`,"aria-expanded":u,onClick:()=>d(!u),children:[(0,H.jsx)(ps,{right:!u}),u?B(`prefs.themeHide`):B(`prefs.themeBrowse`,{count:_.length})]}),u&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{className:`m-0 pb-1.5 text-meta font-medium text-subtle mt-2.5`,children:B(`prefs.themeMoreHint`)}),(0,H.jsx)(dC,{children:_.map(t=>(0,H.jsx)(uC,{theme:t,mode:e.mode,active:!1,tag:i===t.name?B(`prefs.themeInstalling`):o===t.name?B(`prefs.themeInstallFailed`):B(`prefs.themeGet`),onClick:()=>i===null&&void m(t.name)},t.name))})]})]}),p&&(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2.5`,children:[(0,H.jsx)(U,{variant:`action`,onClick:()=>f(p),children:B(`prefs.themeAgent`)}),(0,H.jsx)(`span`,{className:`text-meta text-muted [&_a]:text-accent`,children:B(c?`prefs.themeAgentFailed`:`prefs.themeAgentHint`)})]})]})}var pC=v({}),mC=``,hC=`(prefers-color-scheme: dark)`;function gC(e){let t=window.matchMedia(hC);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)}function _C(){return(0,h.useSyncExternalStore)(gC,()=>window.matchMedia(hC).matches)}function vC(){let e=_C();return YS(wp().prefs.themeMode,e)}function yC(e){let t=vC(),n=wp();(0,h.useEffect)(()=>{if(!n.loaded||n.prefs.taskColors!==`on`)return;let r=`${n.prefs.theme}/${t}`;r!==mC&&(mC=r,pC.set({}));let i=()=>{let i=pC.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=>{mC===r&&pC.set({...pC.get(),...e.colors})}).catch(()=>void 0)};return i(),e.tasks.subscribe(i)},[e,t,n.loaded,n.prefs.taskColors,n.prefs.theme])}function bC(e){let t=wp(),n=y(pC);return e&&t.prefs.taskColors===`on`?n[e]:void 0}var xC={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`},runningTitle:{shimmer:`appearance.titleShimmer`,still:`appearance.titleStill`}},SC={engine:`settings.appearance.statusMarkEngine`,both:`settings.appearance.statusMarkBoth`,dots:`settings.appearance.statusMarkDots`};function CC({model:e}){let{client:t}=e,n=wp(),r=vC(),i=y(Op),a=BS(),o=(e,n)=>void Sp(t,e,n),s=(e,t,r,i)=>(0,H.jsx)(Ox,{label:Q(t),hint:r,sample:i,value:n.prefs[e],picks:Tp(n,e).map(t=>({value:t,label:e===`themeMode`&&t===`auto`?B(`prefs.modeAuto`):Q(xC[e]?.[String(t)]??String(t))})),onPick:t=>o(e,t)}),c=(e,t,r)=>(0,H.jsx)(Ex,{label:Q(t),hint:r,checked:n.prefs[e]===`on`,onChange:t=>o(e,t?`on`:`off`)});return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(wx,{children:[(0,H.jsx)(fC,{model:e,label:Q(`general.theme`),themes:n.themes,value:n.prefs.theme,mode:r}),s(`themeMode`,`general.themeMode`)]}),(0,H.jsxs)(wx,{title:B(`settings.appearance.groupColours`),children:[s(`focusAccent`,`general.focusAccent`,Q(`general.focusAccentHint`)),c(`taskColors`,`general.taskColors`,B(`settings.appearance.taskColorsNote`)),c(`colorblind`,`general.colorblind`,B(`settings.appearance.colorblindNote`))]}),(0,H.jsxs)(wx,{title:B(`settings.appearance.groupTasks`),children:[s(`workingBorder`,`general.workingBorder`,B(`settings.appearance.workingBorderNote`),(0,H.jsx)(JS,{})),s(`runningTitle`,`general.runningTitle`,void 0,(0,H.jsx)(qS,{})),s(`splitStyle`,`general.splitStyle`),s(`railFold`,`general.railFold`,Q(`general.railFoldHint`)),(0,H.jsx)(Ox,{label:B(`settings.appearance.railGroup`),value:i,picks:Ep.map(e=>({value:e,label:B(e===`state`?`settings.appearance.railGroupState`:`settings.appearance.railGroupProject`)})),onPick:Ap}),(0,H.jsx)(Ox,{label:B(`settings.appearance.statusMark`),sample:(0,H.jsx)(KS,{model:e}),value:a,picks:zS.map(e=>({value:e,label:B(SC[e])})),onPick:e=>VS(t,e)})]})]})}function wC(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 TC=e=>e===``?{}:{machine:e},EC=2e3,DC=e=>e?.login?.state===`pending`||e?.login?.state===`syncing`;function OC(e){let{client:t}=e,n=Zm(e),[r,i]=(0,h.useState)({}),[a,o]=(0,h.useState)(!1),s=(0,h.useMemo)(()=>{let e={};for(let i of[``,...n.map(e=>e.alias)]){let n=r[i]??X(t,`github.status`,TC(i));n&&(e[i]=n)}return e},[r,n,t]),c=n.flatMap(e=>e.state===`online`?[e.alias]:[]).join(`
51
+ {hint}`},...Ky}},Qy={en:Wi,zh:Gi};function Q(e,t){return Pt(Zy,e,t)}function $y(e,t){return Pt(Qy,e,t)}function eb({label:e,value:t,picks:n,onPick:r}){return(0,H.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,H.jsx)(`button`,{type:`button`,"aria-pressed":n,className:It(`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 tb({label:e,value:t,picks:n,onPick:r}){let i=(0,h.useRef)(!1),a=e=>{let i=e.getBoundingClientRect();S.set({x:i.left,y:i.bottom+4,right:i.right,minWidth:i.width,start:Math.max(n.findIndex(e=>e.value===t),0),target:e,items:n.map(n=>({label:n.label,checked:n.value===t,run:()=>{e.focus(),n.value!==t&&r(n.value)}}))})};return(0,H.jsxs)(`button`,{type:`button`,"aria-label":`${e}: ${n.find(e=>e.value===t)?.label??t}`,"aria-haspopup":`menu`,className:`relative inline-flex max-w-full min-w-0 items-center rounded-sm border-hairline border-line bg-inset py-1.5 pr-7 pl-2.5 text-left font-sans text-meta text-ink hover:border-line-active focus-visible:border-line-active focus-visible:outline-none data-menu-open:border-line-active touch:min-h-10`,onMouseDown:e=>{i.current=e.currentTarget.hasAttribute(`data-menu-open`)},onClick:e=>{i.current||a(e.currentTarget),i.current=!1},onKeyDown:e=>{(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),a(e.currentTarget))},children:[(0,H.jsx)(`span`,{className:`min-w-0 truncate`,children:n.find(e=>e.value===t)?.label??t}),(0,H.jsx)(ps,{className:`pointer-events-none absolute top-1/2 right-2.5 -translate-y-1/2 text-subtle`})]})}var nb=`${Br} w-narrow:pt-0`,rb=`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:translate-x-[var(--back-x,0px)] w-narrow:pb-[env(safe-area-inset-bottom)] short:h-[calc(100dvh-24px)]`,ib=`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`,ab=e=>`hidden flex-none items-center ${e?`px-5`:`px-4`} py-3 text-left font-mono text-meta font-bold text-accent w-narrow:flex touch:min-h-11`,ob=e=>`flex min-h-0 min-w-0 flex-1 flex-col ${e?`absolute inset-0 z-1 translate-x-(--back-x) bg-surface [padding:inherit] shadow-dialog`:``}`,sb=`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`,cb=`m-0 px-2 pb-0.5 font-sans text-title font-semibold normal-nums text-ink`,lb=`flex flex-col gap-0.5`,ub=`m-0 px-2 pb-1 font-mono text-meta font-normal text-subtle`,db=(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`}`,fb=`ml-auto hidden text-subtle w-narrow:block`,pb=`flex flex-col`,mb=`flex min-w-0 flex-wrap gap-x-4 text-meta`,hb=`inline-flex min-h-6.5 min-w-0 items-center gap-2`,gb=`block h-7 w-36 rounded-md border-hairline border-line bg-paper`,_b=`m-0 pb-2 text-meta text-subtle`,vb=`flex flex-col border-t-hairline border-t-line [&>*]:border-b-hairline [&>*]:border-b-line`,yb=`flex items-center justify-between gap-x-6 gap-y-2 py-3 w-narrow:flex-col w-narrow:items-stretch`,bb=`flex items-center justify-between gap-x-6 py-3`,xb=`flex flex-col gap-3 py-3`,Sb=`flex min-w-0 flex-1 flex-col gap-0.5`,Cb=`text-body text-ink`,wb=`text-meta text-muted [&_a]:text-accent`,Tb=`max-w-90 min-w-0 truncate font-mono text-meta text-muted [overflow-wrap:anywhere]`,Eb=`m-0 py-3 text-body text-muted`,Db=`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`,Ob=`${Db} w-24 text-right`,kb=`flex flex-col gap-1.5`,Ab=`text-meta font-medium text-muted`,jb=`min-h-30 max-h-[50vh] leading-[1.45]`,Mb=`flex flex-wrap items-center justify-end gap-2.5`,Nb=`flex items-center gap-2.5 rounded-sm bg-inset px-3 py-2 text-meta`,Pb=`grid grid-cols-[minmax(0,1fr)_104px_72px] items-center gap-3`,Fb=`flex flex-col`,Ib=`${Pb} pb-1.5 pl-7.5 font-sans text-meta font-medium normal-nums text-subtle [&>span:not(:first-child)]:text-center`,Lb=`border-b-hairline border-b-line first:border-t-hairline first:border-t-line`,Rb=`${Pb} group/eng rounded-sm py-1.5 pr-1 pl-0`,zb=`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`,Bb=e=>`mx-0.5 ${e?`text-muted`:`text-subtle`}`,Vb=`flex min-w-0 flex-col gap-0.5`,Hb=e=>`truncate text-body leading-[inherit] font-medium ${e?`text-muted`:`text-ink`}`,Ub=`ml-2 text-meta leading-[inherit] font-normal text-subtle`,Wb={ready:`bg-success`,attention:`bg-warning`,error:`bg-error`,absent:`bg-subtle`},Gb=e=>`inline-flex items-center gap-1.5 text-meta leading-[inherit] ${e===`error`?`text-error`:`text-muted`}`,Kb=e=>`size-1.75 flex-none rounded-full ${Wb[e]}`,qb=`flex justify-center`,Jb=`rounded-full bg-accent-soft px-2.5 py-0.5 font-sans text-meta font-medium normal-nums capitalize text-accent`,Yb=`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`,Xb=`mt-0 mr-1 mb-3 ml-7 flex flex-col gap-2.5 px-1.5 py-1`,Zb=`m-0 grid grid-cols-[max-content_minmax(0,1fr)] gap-x-3.5 gap-y-1.5 text-meta leading-[1.5]`,Qb=`text-subtle`,$b=e=>`m-0 wrap-anywhere ${e?`text-warning`:`text-ink`}`,ex=`flex items-center gap-2`,tx=`flex-1 px-2 py-1.25`,nx=`text-meta leading-[inherit] text-success`,rx=`flex items-center gap-3 py-2.5`,ix=`flex min-w-0 flex-1 flex-col gap-0.5`,ax=(e=!1)=>`overflow-hidden text-ellipsis text-meta text-muted ${e?`whitespace-normal`:`whitespace-nowrap`}`,ox=`flex flex-col gap-1 py-3`,sx=`flex items-baseline gap-3`,cx=`flex flex-col gap-2.5 pt-2`,lx=`grid grid-cols-[repeat(auto-fill,minmax(96px,1fr))] gap-2`,ux=`m-0 pb-1.5 text-meta font-medium text-subtle`,dx=e=>e?`border-accent bg-accent-soft`:`border-line hover:bg-hover`,fx=`flex h-9 overflow-hidden rounded-xs border-hairline`,px=`flex w-2/5 flex-col gap-0.75 p-1`,mx=`flex min-w-0 flex-1 flex-col gap-0.75 p-1`,hx=`h-0.75 rounded-xs`,gx=`mt-auto flex gap-0.75`,_x=`size-1 rounded-xs`,vx=`flex min-w-0 items-baseline gap-1.5 font-sans text-meta`,yx=`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`,bx=`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 xx({on:e,...t}){return(0,H.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,className:yx,...t,children:(0,H.jsx)(`span`,{className:bx})})}function Sx(e){return(0,H.jsxs)(`section`,{className:pb,children:[e.title&&(0,H.jsx)(`h2`,{className:`m-0 pb-1.5 font-sans text-meta font-medium normal-nums text-muted`,children:e.title}),e.hint&&(0,H.jsx)(`p`,{className:`m-0 pb-2 text-meta text-subtle`,children:e.hint}),(0,H.jsx)(`div`,{className:vb,children:e.children})]})}function Cx(e){let t=(0,H.jsxs)(`div`,{className:Sb,children:[(0,H.jsx)(`span`,{id:e.labelId,className:Cb,children:e.label}),e.hint&&(0,H.jsx)(`span`,{className:`text-meta text-muted [&_a]:text-accent`,children:e.hint}),e.sample&&(0,H.jsx)(`span`,{className:`mt-1.5 flex min-w-0`,children:e.sample})]});return e.stack?(0,H.jsxs)(`div`,{className:xb,children:[t,e.children]}):(0,H.jsxs)(`div`,{className:e.inline?bb:yb,children:[t,e.children&&(0,H.jsx)(`div`,{className:`flex min-w-0 flex-none items-center justify-end gap-2 w-narrow:justify-start`,children:e.children})]})}function wx(e){let t=(0,h.useId)();return(0,H.jsx)(Cx,{label:e.label,hint:e.hint,labelId:t,inline:!0,children:(0,H.jsx)(xx,{on:e.checked,"aria-labelledby":t,disabled:e.disabled,onClick:()=>e.onChange(!e.checked)})})}var Tx=36;function Ex(e){let t=e.picks.length<=4&&e.picks.reduce((e,t)=>e+t.label.length,0)<=Tx?eb:tb;return(0,H.jsx)(Cx,{label:e.label,hint:e.hint,sample:e.sample,children:(0,H.jsx)(t,{label:e.label,value:e.value,picks:e.picks,onPick:e.onPick})})}function Dx(e){return(0,H.jsx)(Cx,{label:e.label,hint:e.note,children:(0,H.jsx)(`span`,{className:Tb,children:e.value})})}var Ox=`page min-h-0 flex-1 rounded-md border-hairline border-line bg-paper px-4.5 py-3.5 focus:outline-none`,kx=`${Ox} overflow-y-auto`,Ax=`page-title mx-0 mt-0 mb-1.5 font-sans text-title font-bold normal-nums`,jx=`flex items-baseline justify-between gap-4 [&_.page-title]:m-0`,Mx=e=>`min-w-0 truncate text-meta ${e?``:`leading-[inherit]`}`,Nx=`flex flex-wrap items-center gap-2`,Px={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`},Fx=`mt-2.5 flex flex-col gap-1.5`,Ix=e=>`flex cursor-pointer flex-col gap-0.5 rounded-sm px-2.5 py-1.5 ${e?`bg-menu`:``}`,Lx=`flex min-w-0 items-baseline gap-2.5`,Rx=`whitespace-nowrap text-muted`,zx=`flex gap-2.5 pl-[4ch] text-meta leading-[inherit] text-muted`,Bx=`min-w-0 flex-1 truncate`,Vx=`flex flex-col px-1.5 pb-2`,Hx=`flex flex-col border-t-hairline border-t-line px-1.5 py-1.5`,Ux=`relative flex flex-col`,Wx=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`}`,Gx=`ml-auto -mr-[4.5px] w-5 text-center font-sans text-display leading-none font-normal text-accent normal-nums`,Kx=`mr-[7px] size-3.5 flex-none fill-none stroke-current stroke-[1.75] [stroke-linecap:round] [stroke-linejoin:round]`,qx=`flex items-baseline justify-between`,Jx=`[&_b]:mr-2.5`,Yx=`${Ox} flex flex-col overflow-hidden`,Xx=`min-h-0 flex-1 overflow-y-auto`,Zx=`whitespace-nowrap text-[length:var(--fs-meta)] text-warning`,Qx=`rail-tight:hidden`,$x=`[&_h2]:mx-0 [&_h2]:mt-3.5 [&_h2]:mb-1 [&_h2]:text-[length:var(--fs-body)]`,eS=`max-h-[55vh] overflow-x-hidden overflow-y-auto`,tS=`mr-auto text-[length:var(--fs-meta)]`,nS=`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`,rS=`mt-3`,iS=e=>`rounded-sm px-2 py-1.25 ${e?`bg-menu`:``}`,aS=`flex items-baseline gap-2 text-[length:var(--fs-body)]`,oS=`flex items-baseline justify-between gap-2`,sS=`font-mono`,cS=`truncate`,lS=`mt-4 text-[length:var(--fs-meta)]`;function uS(e){return e.replace(/\[`[0-9a-f]{7,40}`\]\([^)]*\)\s*/g,``).replace(/\s+[—-]\s+\[@[^\]]+\]\([^)]*\)\s*$/,``).trim()}function dS(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:uS(e.text)}:e)}var fS=/\[([^\]]+)\]\((https?:\/\/[^)\s]+)\)|`([^`]+)`|\*\*([^*]+)\*\*/g;function pS(e){let t=[],n=0;for(let r of e.matchAll(fS)){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,H.jsx)(`a`,{href:s,target:`_blank`,rel:`noopener noreferrer`,children:pS(o)},i)):c===void 0?l!==void 0&&t.push((0,H.jsx)(`b`,{children:l},i)):t.push((0,H.jsx)(`code`,{children:c},i)),n=i+a.length}return n<e.length&&t.push(e.slice(n)),t}function mS({body:e}){let t=dS(e),n=[],r=[],i=()=>{r.length>0&&n.push((0,H.jsx)(`ul`,{children:r},`ul-${n.length}`)),r=[]};for(let e of t){if(e.kind===`item`){r.push((0,H.jsx)(`li`,{children:pS(e.text)},e.id));continue}i(),n.push(e.kind===`heading`?(0,H.jsx)(`h3`,{children:e.text},e.id):(0,H.jsx)(`p`,{children:pS(e.text)},e.id))}return i(),(0,H.jsx)(`div`,{className:nS,children:n})}var hS=v(null),gS=v(!1),_S=(e,t)=>e.replace(/\{(\w+)\}/g,(e,n)=>t[n]??e),vS=e=>`https://github.com/Sma1lboy/rove/releases/tag/v${e}`;function yS(){return V()===`zh`?Yi:Ji}function bS(e,t){return e.request(`update.check`,{force:!0,locale:At.get(),channel:t}).then(e=>(hS.set(e),!0),()=>!1)}function xS(){let e=yS(),t=y(hS),{prefs:n}=wp();return!n.updateNotify||!t?.info?.hasUpdate?null:(0,H.jsxs)(`button`,{type:`button`,className:`${W} text-muted ${Zx} ${Gt}`,title:_S(e.chip,{version:t.info.latest}),onClick:()=>he(`update`),children:[`↑`,(0,H.jsxs)(`span`,{className:Qx,children:[` `,t.info.latest]})]})}function SS({notes:e}){return e.map(e=>(0,H.jsxs)(`section`,{className:$x,children:[(0,H.jsxs)(`h2`,{className:`mono`,children:[`v`,e.version]}),(0,H.jsx)(mS,{body:e.body})]},e.version))}var CS=1e3;function wS(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,CS):i(!1))},()=>t&&i(!1));return o(),()=>{t=!1,clearTimeout(a)}},[e,r]),{run:t,setRun:n,poll:()=>i(!0)}}function TS({client:e}){let t=yS(),n=y(hS),[r,i]=(0,h.useState)(!1),[a,o]=(0,h.useState)(null),{run:s,setRun:c,poll:l}=wS(e),u=(0,h.useRef)(null);(0,h.useEffect)(()=>{u.current?.focus(),bS(e).finally(()=>i(!0))},[e]);let d=n?.info??null,f=n?.current??``,p=d?.latest??f,m=d?.hasUpdate===!0,g=r&&d===null,_=r&&d!==null&&!m,v=n?.notes??[],b=v[0]?.url??(p?vS(p):null),x=s?.code===0,[S,C]=(0,h.useState)(!1),w=m&&!s?.running&&!x,T=n=>{if(n===`close`)return O.set(null);if(n===`restart`){if(!x||S)return;C(!0),e.request(`update.restart`,{}).catch(e=>e instanceof Uo&&C(!1));return}if(n===`update`){if(!w)return;o(null),e.request(`update.run`,{}).then(e=>{c(e.status),l()},e=>{if(e instanceof Uo&&e.code===`BUSY`)return l();o(_S(t.webStartFailed,{error:e instanceof Error?e.message:String(e)}))});return}o(b&&window.open(b,`_blank`,`noopener`)!==null?t.statusReleaseOpened:t.statusReleaseError)};return(0,h.useEffect)(()=>{!r||!gS.get()||(gS.set(!1),m&&T(`update`))},[r,m]),(0,H.jsxs)(`div`,{className:Yx,tabIndex:0,ref:u,onKeyDown:e=>{if(e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.toLowerCase()===`c`&&!window.getSelection()?.toString())return e.preventDefault(),T(`close`);if(!(e.metaKey||e.ctrlKey||e.altKey)){if(e.key===`Enter`&&e.target===u.current)T(x?`restart`:w?`update`:`release`);else if(e.key===`Enter`)return;else if(e.key===`u`)T(`update`);else if(e.key===`r`)T(`release`);else if(e.key===`q`||e.key===`Escape`)T(`close`);else return;e.preventDefault()}},children:[(0,H.jsxs)(`div`,{className:Xx,children:[(0,H.jsxs)(`div`,{className:qx,children:[(0,H.jsx)(`h1`,{className:Ax,children:t.pageTitle}),(0,H.jsx)(`button`,{type:`button`,className:`${Ar} mono`,onClick:()=>T(`close`),children:lu()?B(`dialog.close`):t.closeHint})]}),(0,H.jsxs)(`p`,{className:`mono ${Jx}`,children:[(0,H.jsx)(`span`,{className:`text-muted`,children:t.current}),` `,(0,H.jsxs)(`b`,{children:[`v`,f]}),` `,(0,H.jsx)(`span`,{className:`text-muted`,children:t.latest}),` `,g?(0,H.jsx)(`b`,{className:`text-muted`,children:t.latestUnknown}):r?(0,H.jsxs)(`b`,{className:m?`text-warning`:`text-success`,children:[`v`,p]}):(0,H.jsx)(`span`,{className:`text-muted`,children:`…`})]}),g&&(0,H.jsx)(`p`,{className:`text-muted`,children:t.registryRetry}),_&&(0,H.jsx)(`p`,{className:`text-success`,children:t.upToDate}),a&&(0,H.jsx)(`p`,{className:`mono text-accent`,children:a}),s&&(0,H.jsxs)(H.Fragment,{children:[s.output&&(0,H.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:s.output}),(0,H.jsx)(`p`,{className:`mono ${s.running?`text-muted`:s.code===0?`text-success`:`text-error`}`,children:s.running?_S(t.webRunning,{command:s.command}):s.code===0?S?t.webRestarting:_S(t.webInstalled,{latest:p}):_S(t.updateFailed,{code:String(s.code)})})]}),m&&(0,H.jsx)(`p`,{className:`mono text-muted`,children:_S(t.changesSectionHeader,{from:f,to:p})}),!r&&(0,H.jsx)(`p`,{className:`text-muted`,children:t.loadingNotes}),r&&m&&v.length===0&&(0,H.jsx)(`p`,{className:`text-muted`,children:t.notesUnavailable}),(0,H.jsx)(SS,{notes:v})]}),(0,H.jsxs)(`div`,{className:`${Nr} pt-2.5`,children:[b?(0,H.jsx)(`a`,{className:Ar,href:b,target:`_blank`,rel:`noopener noreferrer`,"aria-keyshortcuts":`r`,children:t.actions.openRelease}):(0,H.jsx)(`span`,{className:`text-muted`,children:t.releaseUrlUnavailable}),x&&(0,H.jsx)(U,{variant:`filled`,disabled:S,onClick:()=>T(`restart`),children:t.webRestart}),w&&(0,H.jsx)(U,{variant:`filled`,"aria-keyshortcuts":`u`,onClick:()=>T(`update`),children:t.actions.updateNow})]})]})}var ES=`rove.whatsNewSeenVersion`,DS=e=>e.split(/[.-]/).slice(0,3).map(Number),OS=(e,t)=>{let[n,r]=[DS(e),DS(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 kS(e,t){let n=localStorage.getItem(ES);localStorage.setItem(ES,t),!(!n||!OS(t,n))&&e.request(`release.notes`,{version:t.replace(/-.*$/,``),locale:At.get()}).then(e=>C.set((0,H.jsx)(AS,{from:n,to:t,notes:e.notes})),()=>C.set((0,H.jsx)(AS,{from:n,to:t,notes:null})))}function AS(e){let t=yS(),n=(0,h.useRef)(null);return(0,h.useEffect)(()=>n.current?.focus(),[]),(0,h.useEffect)(()=>{let e=e=>{e.key===`q`&&C.set(null)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,H.jsxs)(Si,{title:t.whatsNew.title,wide:!0,children:[(0,H.jsx)(`p`,{className:`text-muted`,children:_S(t.whatsNew.upgraded,{from:e.from,to:e.to})}),(0,H.jsx)(`div`,{className:eS,children:e.notes?(0,H.jsx)(mS,{body:e.notes.body}):(0,H.jsx)(`p`,{className:`text-muted`,children:t.whatsNew.notesUnavailable})}),(0,H.jsxs)(`div`,{className:Nr,children:[(0,H.jsx)(`span`,{className:`mono text-muted ${tS} touch:hidden!`,children:B(`whatsNew.keys`)}),(0,H.jsx)(`a`,{className:Ar,href:e.notes?.url??vS(e.to),target:`_blank`,rel:`noopener noreferrer`,children:B(`whatsNew.openRelease`)}),(0,H.jsx)(`button`,{ref:n,type:`button`,className:xr(),onClick:()=>C.set(null),children:B(`whatsNew.continue`)})]})]})}var jS=(e,t)=>e.replace(`{version}`,t);function MS({client:e}){let t=yS(),n=y(hS),{prefs:r}=wp(),[i,a]=(0,h.useState)(`idle`),o=()=>{a(`checking`),bS(e,r.updateChannel).then(e=>a(e?`done`:`failed`))},s=t=>{a(`idle`),Sp(e,`updateChannel`,t)},c=n?.info??null,l=i===`failed`||i===`done`&&c===null,u=i===`done`&&n&&c?c.hasUpdate?jS(t.available,c.latest):t.upToDate:l?t.latestUnknown:void 0,d=l?`text-muted`:c?.hasUpdate?`text-warning`:`text-success`;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Ex,{label:Q(`general.updateChannelTitle`),hint:Q(`general.updatesHint`),value:r.updateChannel,picks:Hy.map(e=>({value:e,label:Q(`general.updateChannelName.${e}`)})),onPick:s}),(0,H.jsx)(wx,{label:Q(`general.updateNotify`),hint:Q(`general.updateNotifyHint`),checked:r.updateNotify,onChange:t=>void Sp(e,`updateNotify`,t)}),(0,H.jsxs)(Cx,{label:Q(`general.updates`),hint:Q(`general.updateCheckHint`),children:[i===`done`&&c?.hasUpdate&&(0,H.jsx)(U,{variant:`action`,onClick:()=>he(`update`),children:Q(`general.updateOpenPage`)}),(0,H.jsx)(U,{variant:`action`,disabled:i===`checking`,onClick:o,children:Q(i===`checking`?`general.updateChecking`:`general.updateCheckButton`)})]}),u&&(0,H.jsx)(Cx,{label:(0,H.jsx)(`span`,{className:d,children:u}),hint:c?.hasUpdate?(0,H.jsx)(`code`,{className:`font-mono`,children:`rove update`}):void 0,children:i===`done`&&n&&c&&(0,H.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 NS({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,H.jsxs)(Sx,{title:B(`settings.about.access`),children:[(0,H.jsx)(Ex,{label:B(`settings.about.signIn`),hint:B(`settings.about.signInHint.${f}`),value:f,picks:t.modes.map(e=>({value:e,label:B(`settings.about.signInMode.${e}`)})),onPick:e=>{e===`password`&&!t.hasPassword?i(!0):d(e)}}),f===`password`&&(0,H.jsxs)(Cx,{label:B(t.hasPassword?`settings.about.passwordChange`:`settings.about.passwordSet`),hint:c??B(`settings.about.passwordHint`,{min:t.minPassword}),children:[(0,H.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":B(`settings.about.passwordField`),placeholder:B(`settings.about.passwordField`),value:o,onChange:e=>s(e.target.value),onKeyDown:e=>e.key===`Enter`&&!p&&void d(`password`,o)}),(0,H.jsx)(U,{variant:`action`,disabled:p,onClick:()=>void d(`password`,o),children:B(`settings.about.passwordSave`)})]})]})}function PS({client:e}){let[t,n]=(0,h.useState)(()=>X(e,`daemon.info`)??null);return(0,h.useEffect)(()=>{Ku(e,`daemon.info`).then(n,()=>n(null))},[e]),(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(Sx,{title:B(`settings.about.groupRove`),children:[t?.daemonVersion&&(0,H.jsx)(Cx,{label:B(`settings.about.daemon`),hint:B(t.stale?`settings.about.daemonStale`:`settings.about.daemonCurrent`,{version:t.daemonVersion})}),(0,H.jsx)(MS,{client:e})]}),(0,H.jsx)(NS,{client:e}),(0,H.jsx)(Sx,{title:B(`settings.about.browser`),children:(0,H.jsx)(Cx,{label:B(`settings.about.signOut`),hint:B(`settings.about.browserHint`),children:(0,H.jsx)(U,{variant:`action`,onClick:()=>void us().then(()=>window.location.reload()),children:B(`settings.about.signOut`)})})})]})}var FS=e=>new Map((e?.engines??[]).flatMap(e=>e.icon?[[e.id,e.icon]]:[]));function IS(e){let[t,n]=(0,h.useState)(()=>FS(X(e,`engines.list`))),r=y(e.tasks)!==null;return(0,h.useEffect)(()=>{r&&Ku(e,`engines.list`).then(e=>n(FS(e))).catch(()=>{})},[e,r]),t}var LS=[`both`,`engine`,`dots`];function RS(){return wp().prefs.statusMark??`both`}function zS(e,t){Sp(e,`statusMark`,t)}var BS=`block size-4 flex-none translate-y-px`,VS=`animate-mark-pulse motion-reduce:[animation-duration:4.8s]`;function HS(e){let t=e.status?.look;if(t===`waiting`||t===`error`)return(0,H.jsx)(`span`,{className:`${BS} text-center font-mono text-meta leading-4 font-semibold ${up[e.status?.tone??`muted`]}`,"aria-hidden":`true`,children:t===`waiting`?`?`:`!`});let n=e.status&&(t===`idle`?`text-muted`:up[e.status.tone]);return(0,H.jsx)(`svg`,{className:`${BS} ${n??(e.icon?`text-ink`:`text-muted`)} ${t===`working`?VS:``}`,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,H.jsx)(`path`,{d:e.d,fill:n?`currentColor`:e.fill??`currentColor`,fillRule:e.evenodd?`evenodd`:void 0},e.d)):(0,H.jsx)(`circle`,{cx:`7`,cy:`7`,r:`4.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.2`})})}var US=[{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 WS({model:e}){let t=RS(),[n]=[...IS(e).values()];return(0,H.jsx)(`span`,{className:mb,"aria-hidden":`true`,children:US.map(({label:e,status:r})=>(0,H.jsxs)(`span`,{className:hb,children:[t!==`dots`&&(0,H.jsx)(HS,{icon:n,status:t===`engine`?wh(r):void 0}),(0,H.jsx)(`span`,{className:`text-ink`,children:B(e)}),t!==`engine`&&(0,H.jsx)(Bh,{status:r})]},e))})}function GS(){return(0,H.jsx)(`span`,{className:`${hb} ${_i} ${vi}`,"aria-hidden":`true`,children:B(`settings.appearance.previewTitle`)})}function KS(){return(0,H.jsx)(`span`,{className:`${gb} ${kn}`,"aria-hidden":`true`})}function qS(e,t){return e===`auto`?t?`dark`:`light`:e}function JS(e,t,n){let r=e.find(e=>e.name===t)??e.find(e=>e.name===`claude`);return r?r[n]:null}var YS=e=>[1,3,5].map(t=>Number.parseInt(e.slice(t,t+2),16));function XS(e){let[t=0,n=0,r=0]=YS(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 ZS(e,t){let[n=0,r=0]=[XS(e),XS(t)].sort((e,t)=>t-e);return(n+.05)/(r+.05)}var QS=4.5,$S=1.1;function eC(e,t,n){let r=e=>t.every(t=>ZS(e,t)>=n(t));if(r(e))return e;let i=YS(e),a=XS(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 tC(e){let t=[e.background,e.backgroundPanel,e.backgroundElement,e.backgroundMenu],n=eC(e.diffLineNumber,t,()=>QS);return{muted:eC(e.textMuted,t,e=>Math.max(QS,ZS(n,e)*$S)),subtle:n}}function nC(e,t){let n=t.colorblind===`on`,r=tC(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 rC(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 iC=v(null),aC=v(null),oC=v(null);function sC({theme:e,mode:t}){let n=e[t],r=(e,t)=>({background:e,width:t});return(0,H.jsxs)(`span`,{className:fx,style:{background:n.background,borderColor:n.border},"aria-hidden":!0,children:[(0,H.jsxs)(`span`,{className:px,style:{background:n.backgroundPanel},children:[(0,H.jsx)(`span`,{className:hx,style:r(n.primary,`70%`)}),(0,H.jsx)(`span`,{className:hx,style:r(n.textMuted,`85%`)}),(0,H.jsx)(`span`,{className:hx,style:r(n.textMuted,`55%`)})]}),(0,H.jsxs)(`span`,{className:mx,children:[(0,H.jsx)(`span`,{className:hx,style:r(n.text,`90%`)}),(0,H.jsx)(`span`,{className:hx,style:r(n.textMuted,`65%`)}),(0,H.jsx)(`span`,{className:hx,style:r(n.accent??n.primary,`40%`)}),(0,H.jsx)(`span`,{className:gx,children:[n.success,n.warning,n.error,n.info].map((e,t)=>(0,H.jsx)(`span`,{className:_x,style:{background:e}},t))})]})]})}function cC(e){return(0,H.jsxs)(U,{variant:`card`,"aria-pressed":e.active,className:dx(e.active),onMouseEnter:()=>aC.set(e.theme),onFocus:()=>aC.set(e.theme),onClick:e.onClick,children:[(0,H.jsx)(sC,{theme:e.theme,mode:e.mode}),(0,H.jsxs)(`span`,{className:vx,children:[(0,H.jsx)(`span`,{className:`truncate text-ink`,children:e.theme.name}),e.tag&&(0,H.jsx)(`span`,{className:`text-subtle`,children:e.tag})]})]})}function lC({children:e}){return(0,H.jsx)(`div`,{className:lx,onMouseLeave:()=>aC.set(null),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||aC.set(null)},children:e})}function uC(e){let{model:t}=e,{client:n}=t,r=y(oC),[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)(()=>()=>aC.set(null),[]),(0,h.useEffect)(()=>void xp(n).catch(()=>void 0),[n]),(0,h.useEffect)(()=>{oC.get()===null&&n.request(`theme.hosted`).then(e=>oC.set(e),()=>oC.set({themes:[],dir:null}))},[n]);let f=e=>{l(!1),dy(t,B(`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 xp(n),await Sp(n,`theme`,e)}catch{s(e)}finally{a(null)}},g=new Set(e.themes.map(e=>e.name)),_=(r?.themes??[]).filter(e=>!g.has(e.name));return(0,H.jsxs)(Cx,{label:e.label,hint:B(`prefs.themePreviewHint`),stack:!0,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:ux,children:B(`prefs.themeInstalled`)}),(0,H.jsx)(lC,{children:e.themes.map(t=>(0,H.jsx)(cC,{theme:t,mode:e.mode,active:t.name===e.value,tag:t.bundled?void 0:B(`prefs.themeUser`),onClick:()=>t.name!==e.value&&void Sp(n,`theme`,t.name)},t.name))})]}),_.length>0&&(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(U,{className:`inline-flex items-center gap-1.5`,"aria-expanded":u,onClick:()=>d(!u),children:[(0,H.jsx)(ps,{right:!u}),u?B(`prefs.themeHide`):B(`prefs.themeBrowse`,{count:_.length})]}),u&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{className:`m-0 pb-1.5 text-meta font-medium text-subtle mt-2.5`,children:B(`prefs.themeMoreHint`)}),(0,H.jsx)(lC,{children:_.map(t=>(0,H.jsx)(cC,{theme:t,mode:e.mode,active:!1,tag:i===t.name?B(`prefs.themeInstalling`):o===t.name?B(`prefs.themeInstallFailed`):B(`prefs.themeGet`),onClick:()=>i===null&&void m(t.name)},t.name))})]})]}),p&&(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2.5`,children:[(0,H.jsx)(U,{variant:`action`,onClick:()=>f(p),children:B(`prefs.themeAgent`)}),(0,H.jsx)(`span`,{className:`text-meta text-muted [&_a]:text-accent`,children:B(c?`prefs.themeAgentFailed`:`prefs.themeAgentHint`)})]})]})}var dC=v({}),fC=``,pC=`(prefers-color-scheme: dark)`;function mC(e){let t=window.matchMedia(pC);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)}function hC(){return(0,h.useSyncExternalStore)(mC,()=>window.matchMedia(pC).matches)}function gC(){let e=hC();return qS(wp().prefs.themeMode,e)}function _C(e){let t=gC(),n=wp();(0,h.useEffect)(()=>{if(!n.loaded||n.prefs.taskColors!==`on`)return;let r=`${n.prefs.theme}/${t}`;r!==fC&&(fC=r,dC.set({}));let i=()=>{let i=dC.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=>{fC===r&&dC.set({...dC.get(),...e.colors})}).catch(()=>void 0)};return i(),e.tasks.subscribe(i)},[e,t,n.loaded,n.prefs.taskColors,n.prefs.theme])}function vC(e){let t=wp(),n=y(dC);return e&&t.prefs.taskColors===`on`?n[e]:void 0}var yC={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`},runningTitle:{shimmer:`appearance.titleShimmer`,still:`appearance.titleStill`}},bC={engine:`settings.appearance.statusMarkEngine`,both:`settings.appearance.statusMarkBoth`,dots:`settings.appearance.statusMarkDots`};function xC({model:e}){let{client:t}=e,n=wp(),r=gC(),i=y(Op),a=RS(),o=(e,n)=>void Sp(t,e,n),s=(e,t,r,i)=>(0,H.jsx)(Ex,{label:Q(t),hint:r,sample:i,value:n.prefs[e],picks:Tp(n,e).map(t=>({value:t,label:e===`themeMode`&&t===`auto`?B(`prefs.modeAuto`):Q(yC[e]?.[String(t)]??String(t))})),onPick:t=>o(e,t)}),c=(e,t,r)=>(0,H.jsx)(wx,{label:Q(t),hint:r,checked:n.prefs[e]===`on`,onChange:t=>o(e,t?`on`:`off`)});return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(Sx,{children:[(0,H.jsx)(uC,{model:e,label:Q(`general.theme`),themes:n.themes,value:n.prefs.theme,mode:r}),s(`themeMode`,`general.themeMode`)]}),(0,H.jsxs)(Sx,{title:B(`settings.appearance.groupColours`),children:[s(`focusAccent`,`general.focusAccent`,Q(`general.focusAccentHint`)),c(`taskColors`,`general.taskColors`,B(`settings.appearance.taskColorsNote`)),c(`colorblind`,`general.colorblind`,B(`settings.appearance.colorblindNote`))]}),(0,H.jsxs)(Sx,{title:B(`settings.appearance.groupTasks`),children:[s(`workingBorder`,`general.workingBorder`,B(`settings.appearance.workingBorderNote`),(0,H.jsx)(KS,{})),s(`runningTitle`,`general.runningTitle`,void 0,(0,H.jsx)(GS,{})),s(`splitStyle`,`general.splitStyle`),s(`railFold`,`general.railFold`,Q(`general.railFoldHint`)),(0,H.jsx)(Ex,{label:B(`settings.appearance.railGroup`),value:i,picks:Ep.map(e=>({value:e,label:B(e===`state`?`settings.appearance.railGroupState`:`settings.appearance.railGroupProject`)})),onPick:Ap}),(0,H.jsx)(Ex,{label:B(`settings.appearance.statusMark`),sample:(0,H.jsx)(WS,{model:e}),value:a,picks:LS.map(e=>({value:e,label:B(bC[e])})),onPick:e=>zS(t,e)})]})]})}function SC(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 CC=e=>e===``?{}:{machine:e},wC=2e3,TC=e=>e?.login?.state===`pending`||e?.login?.state===`syncing`;function EC(e){let{client:t}=e,n=Xm(e),[r,i]=(0,h.useState)({}),[a,o]=(0,h.useState)(!1),s=(0,h.useMemo)(()=>{let e={};for(let i of[``,...n.map(e=>e.alias)]){let n=r[i]??X(t,`github.status`,CC(i));n&&(e[i]=n)}return e},[r,n,t]),c=n.flatMap(e=>e.state===`online`?[e.alias]:[]).join(`
52
52
  `),l=(0,h.useMemo)(()=>c?c.split(`
53
- `):[],[c]),u=(0,h.useRef)(new Set),d=(0,h.useCallback)(async e=>{let n=await Ku(t,`github.status`,TC(e)).catch(e=>({status:null,reason:`failed`,message:G(e)}));i(t=>({...t,[e]:n}))},[t]),f=(0,h.useCallback)(async()=>{o(!0);try{await Promise.all([``,...l].map(d))}finally{o(!1)}},[d,l]);return(0,h.useEffect)(()=>{f()},[f]),(0,h.useEffect)(()=>{let e=new Set(Object.entries(s).flatMap(([e,t])=>DC(t.status)?[e]:[])),t=[...u.current].some(t=>!e.has(t));if(u.current=e,t&&f(),e.size===0)return;let n=window.setTimeout(()=>{for(let t of e)d(t)},EC);return()=>window.clearTimeout(n)},[s,d,f]),{machines:n,probes:s,refreshing:a,refresh:f,probe:d,act:(0,h.useCallback)(async(e,n)=>{try{let r=await t.request(e,n);return r.ok||L(r.message,`error`),r}catch(e){return L(G(e),`error`),null}},[t])}}var kC={same:`markSame`,different:`markDifferent`,signedOut:`markSignedOut`,noGh:`markNoGh`,outdated:`markOutdated`,offline:`markOffline`,denied:`markDenied`,failed:`markFailed`},AC=(e,t)=>B(`settings.connectors.${e}`,t),jC={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 MC(e,t){return e===`loading`?AC(`loading`):AC(kC[e],{login:t?.account??``})}function NC(e){if(!e?.gh)return``;let t=e.ssh.ok?`✓ ${e.ssh.user??``}`.trim():`✗`;return AC(`detail`,{protocol:e.protocol??`—`,ssh:t})}function PC(){return(0,H.jsx)(`svg`,{className:`size-7 flex-none`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,H.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 FC(e){navigator.clipboard.writeText(e).then(()=>L(AC(`codeCopied`)),()=>{})}function IC({login:e,onCancel:t}){return e.state===`failed`?(0,H.jsxs)(`div`,{className:Fb,children:[(0,H.jsx)(`span`,{className:`text-muted`,children:AC(`loginFailed`,{error:e.error??``})}),(0,H.jsx)(U,{className:`ml-auto`,onClick:t,children:AC(`dismiss`)})]}):e.state===`syncing`?(0,H.jsx)(`div`,{className:Fb,children:(0,H.jsx)(`span`,{className:`text-muted`,children:AC(`syncing`)})}):(0,H.jsxs)(`div`,{className:Fb,children:[e.code?(0,H.jsxs)(H.Fragment,{children:[(0,H.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:AC(`codeHint`),onClick:()=>FC(e.code??``),children:e.code}),(0,H.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,children:AC(`openGithub`)})]}):(0,H.jsx)(`span`,{className:`text-muted`,children:AC(`loading`)}),(0,H.jsx)(U,{className:`ml-auto`,onClick:t,children:B(`dialog.cancel`)})]})}function LC(e){let t=wC(e.probe,e.machine,e.rove),n=e.probe?.status??null,r=DC(n),i=t===`different`||t===`signedOut`,a=n?.login;return(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:ax,children:[(0,H.jsxs)(`div`,{className:ox,children:[(0,H.jsx)(`span`,{className:Tb,children:e.name}),(0,H.jsx)(`span`,{className:sx(),title:[n?.authDetail,n?.ssh.detail].filter(Boolean).join(`, `)||void 0,children:NC(n)})]}),(0,H.jsx)(`span`,{className:`whitespace-nowrap text-meta ${jC[t]}`,title:e.probe?.message,children:MC(t,n)}),e.onSync&&i&&e.rove&&!r&&(0,H.jsx)(U,{variant:`action`,disabled:e.busy,onClick:e.onSync,children:AC(`useRove`)}),e.onLogin&&i&&!r&&(0,H.jsx)(U,{variant:`action`,disabled:e.busy,onClick:e.onLogin,children:AC(`loginThere`)})]}),a&&(0,H.jsx)(`div`,{className:`pb-3`,children:(0,H.jsx)(IC,{login:a,onCancel:e.onCancel})})]})}function RC({model:e}){let{machines:t,probes:n,refreshing:r,refresh:i,probe:a,act:o}=OC(e),[s,c]=(0,h.useState)(null),[l,u]=(0,h.useState)(!1),d=n[``],f=d?.status?.account??null,p=DC(d?.status),m=async(e,t)=>{c(e);try{await t()}finally{c(null)}},g=e=>m(e,async()=>{await o(`github.login`,e===``?{}:{machine:e}),await a(e)}),_=e=>m(e,async()=>{await o(`github.login`,e===``?{cancel:!0}:{machine:e,cancel:!0}),await a(e)}),v=e=>m(e,async()=>{(await o(`github.sync`,{machine:e}))?.ok&&L(AC(`synced`,{machine:e,login:f??``})),await a(e)}),y=()=>m(``,async()=>{(await o(`github.logout`,{}))?.ok&&u(!1),await i()});return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(wx,{children:(0,H.jsxs)(`div`,{children:[(0,H.jsx)(Tx,{label:(0,H.jsxs)(`span`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(PC,{}),(0,H.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,H.jsx)(`span`,{children:`GitHub`}),(0,H.jsx)(`span`,{className:Eb,children:AC(`githubDescription`)})]})]}),children:f?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`span`,{className:Db,children:[`@`,f]}),(0,H.jsx)(U,{variant:`action`,disabled:s!==null,onClick:()=>u(!0),children:AC(`disconnect`)})]}):d?!p&&(0,H.jsx)(U,{variant:`filled`,disabled:s!==null,onClick:()=>void g(``),children:AC(`connect`)}):(0,H.jsx)(`span`,{className:`text-meta text-muted`,children:AC(`loading`)})}),l&&(0,H.jsx)(`div`,{className:`pb-3`,children:(0,H.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,H.jsx)(`p`,{children:AC(`disconnectBody`)}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2.5`,children:[(0,H.jsx)(U,{onClick:()=>u(!1),children:B(`dialog.cancel`)}),(0,H.jsx)(U,{variant:`danger`,disabled:s!==null,onClick:()=>void y(),children:AC(`disconnect`)})]})]})}),!f&&d?.status?.login&&(0,H.jsx)(`div`,{className:`pb-3`,children:(0,H.jsx)(IC,{login:d.status.login,onCancel:()=>void _(``)})})]})}),(f||!d)&&(0,H.jsxs)(wx,{title:AC(`machines`),hint:AC(`machinesHint`),children:[(0,H.jsx)(LC,{name:AC(`thisMachine`),probe:d,machine:null,rove:f,busy:s!==null,onCancel:()=>void _(``)}),t.map(e=>(0,H.jsx)(LC,{name:e.alias,probe:n[e.alias],machine:e.state,rove:f,busy:s!==null,onSync:()=>void v(e.alias),onLogin:()=>void g(e.alias),onCancel:()=>void _(e.alias)},e.alias)),(0,H.jsx)(`div`,{className:`py-2.5`,children:(0,H.jsx)(U,{variant:`action`,disabled:r,onClick:()=>void i(),children:AC(r?`refreshing`:`refresh`)})})]})]})}function zC({model:e}){return(0,H.jsx)(RC,{model:e})}var BC=[{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 VC({client:e}){let{prefs:t}=wp(),[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`),L(Q(`restart.done`)),r(null)}catch(e){L(G(e),`error`)}finally{a(!1)}}},s=(e,t,a,s,c)=>(0,H.jsxs)(`div`,{children:[(0,H.jsx)(Tx,{label:t,hint:a,children:(0,H.jsx)(U,{variant:`action`,onClick:()=>r(e),children:s})}),n===e&&(0,H.jsx)(`div`,{className:`pb-3`,children:(0,H.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,H.jsx)(`strong`,{children:Q(`${e}.title`)}),(0,H.jsx)(`p`,{children:B(e===`reset`?`prefs.resetBody`:`prefs.restartBody`)}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2.5`,children:[(0,H.jsx)(U,{onClick:()=>r(null),children:B(`dialog.cancel`)}),(0,H.jsx)(U,{variant:c?`danger`:`filled`,disabled:i,onClick:()=>void o(),children:s})]})]})})]});return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(wx,{title:Q(`dev.experimental`),children:BC.map(n=>(0,H.jsx)(Ex,{label:Q(n.label),hint:Q(n.hint),checked:t[n.key],onChange:t=>void Sp(e,n.key,t)},n.key))}),(0,H.jsxs)(wx,{hint:Q(`dev.doctorHint`),children:[s(`restart`,Q(`dev.restart`),B(`prefs.restartHint`),B(`prefs.restartButton`),!1),s(`reset`,Q(`dev.reset`),B(`prefs.resetHint`),B(`prefs.resetButton`),!0)]})]})}function HC(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 UC=v([]),WC=3e4;function GC(e){return e.request(`skill.missing`).then(e=>UC.set(e.engines),()=>{})}function KC(e){(0,h.useEffect)(()=>{let t=e.onOpen(()=>void GC(e)),n=K(WC,()=>void GC(e));return()=>{t(),n()}},[e])}function qC(e){return e.request(`skill.install`).then(e=>{e.error&&L(Q(`engines.skill.failed`,{reason:e.error}),`error`)}).catch(e=>L(G(e),`error`)).then(()=>GC(e))}function JC(e){return HC({binaryFound:e.binaryFound,login:e.login,hooks:e.hooks,configIssue:e.configIssue,commandChosen:e.custom||e.customized})}var YC={ready:`ready`,attention:`attention`,error:`error`,absent:`absent`,unknown:`absent`};function XC({client:e}){let[t,n]=(0,h.useState)(()=>X(e,`engines.settings`)?.engines??null),[r,i]=(0,h.useState)(null),a=(0,h.useCallback)(()=>Ku(e,`engines.settings`).then(e=>n(e.engines),e=>L(G(e),`error`)),[e]);(0,h.useEffect)(()=>{a()},[a]);let o=(t,n={})=>void e.request(t,n).then(a).catch(e=>L(G(e),`error`));return t?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`p`,{className:yb,children:Q(`engines.hint`)}),(0,H.jsxs)(`div`,{className:Lb,children:[(0,H.jsxs)(`div`,{className:Rb,"aria-hidden":`true`,children:[(0,H.jsx)(`span`,{}),(0,H.jsx)(`span`,{children:Q(`engines.defaultMark`)}),(0,H.jsx)(`span`,{children:Q(`engines.available`)})]}),t.map(e=>(0,H.jsx)(ZC,{engine:e,open:r===e.id,onToggleOpen:()=>i(r===e.id?null:e.id),run:o},e.id))]})]}),(0,H.jsx)(ew,{engines:t,run:o}),(0,H.jsx)(tw,{engines:t,client:e,reload:a})]}):(0,H.jsx)(`p`,{className:Ob,children:B(`preview.loading`)})}function ZC(e){let{engine:t,run:n}=e,r=(0,h.useId)(),i=JC(t),a=t.binaryFound===!1;return(0,H.jsxs)(`div`,{className:zb,children:[(0,H.jsxs)(`div`,{className:Bb,children:[(0,H.jsxs)(`button`,{type:`button`,className:Vb,"aria-expanded":e.open,"aria-controls":r,onClick:e.onToggleOpen,children:[(0,H.jsx)(ps,{right:!e.open,className:Hb(e.open)}),(0,H.jsxs)(`span`,{className:Ub,children:[(0,H.jsxs)(`span`,{className:Wb(!t.enabled),children:[t.name,t.renamedFrom?(0,H.jsx)(`span`,{className:Gb,children:t.renamedFrom}):null,t.custom&&!t.renamedFrom?(0,H.jsx)(`span`,{className:Gb,children:Q(`engines.customTag`)}):null]}),(0,H.jsxs)(`span`,{className:qb(YC[i.tone]),children:[(0,H.jsx)(`span`,{className:Jb(YC[i.tone]),"aria-hidden":`true`}),Q(i.key.slice(9))]})]})]}),(0,H.jsx)(`div`,{className:Yb,children:t.isDefault?(0,H.jsx)(`span`,{className:Xb,children:Q(`engines.defaultMark`)}):t.canBeDefault&&!a?(0,H.jsx)(`button`,{type:`button`,className:Zb,"aria-label":B(`settings.engines.default`,{name:t.name}),onClick:()=>n(`engine.setDefault`,{id:t.id}),children:Q(`engines.makeDefault`)}):null}),a?(0,H.jsx)(`span`,{}):(0,H.jsx)(Cx,{on:t.enabled,"aria-label":B(`settings.engines.enabled`,{name:t.name}),onClick:()=>n(`engine.setEnabled`,{id:t.id,enabled:!t.enabled})})]}),e.open?(0,H.jsx)($C,{id:r,engine:t,run:n}):null]})}function QC(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 $C(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=[QC(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,H.jsxs)(`div`,{id:e.id,className:Qb,children:[(0,H.jsxs)(`dl`,{className:$b,children:[(0,H.jsx)(`dt`,{className:ex,children:Q(`engines.detail.program`)}),(0,H.jsx)(`dd`,{className:tx(t.binaryFound===!1),children:a}),(0,H.jsx)(`dt`,{className:ex,children:Q(`engines.detail.signIn`)}),(0,H.jsx)(`dd`,{className:tx(t.login===`no`),children:o}),(0,H.jsx)(`dt`,{className:ex,children:Q(`engines.detail.reporting`)}),(0,H.jsx)(`dd`,{className:tx(!1),children:s.map(e=>(0,H.jsx)(`span`,{className:`block`,children:e},e))}),t.skill===`unsupported`?null:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{className:ex,children:Q(`engines.detail.skill`)}),(0,H.jsx)(`dd`,{className:tx(t.skill!==`installed`),children:Q(t.skill===`installed`?`engines.detail.skillInstalledHere`:t.skill===`outdated`?`engines.detail.skillOutdated`:`engines.detail.skillMissing`)})]}),t.custom?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{className:ex,children:Q(`engines.detail.adapter`)}),(0,H.jsx)(`dd`,{className:tx(!1),children:t.protocol?Q(`engines.detail.adapterDeclared`,{protocol:t.protocol}):Q(`engines.detail.adapterGeneric`)})]}):null]}),r===null?(0,H.jsxs)(`div`,{className:nx,children:[(0,H.jsx)(U,{variant:`action`,onClick:()=>i(t.name),children:B(`settings.engines.rename`)}),t.custom||t.customized?(0,H.jsx)(U,{variant:`action`,onClick:()=>n(`engine.reset`,{id:t.id}),children:t.custom?B(`settings.engines.remove`):B(`settings.engines.reset`)}):null]}):(0,H.jsxs)(`form`,{className:nx,onSubmit:e=>{e.preventDefault(),n(`engine.rename`,{id:t.id,name:r}),i(null)},children:[(0,H.jsx)(`input`,{className:`${jr} w-full ${rx}`,autoFocus:!0,value:r,"aria-label":B(`settings.engines.rename`),placeholder:B(`settings.engines.namePlaceholder`),onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),i(null))}}),(0,H.jsx)(U,{variant:`filled`,type:`submit`,children:B(`settings.engines.save`)}),(0,H.jsx)(U,{variant:`action`,onClick:()=>i(null),children:B(`settings.engines.cancel`)})]})]})}function ew({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,H.jsx)(wx,{title:Q(`engines.integrations.title`),hint:Q(`engines.integrations.hint`),children:(0,H.jsx)(Tx,{label:Q(`engines.integrations.summary`,{installed:i,total:r.length}),children:(0,H.jsxs)(`div`,{className:Pb,children:[a>0?(0,H.jsx)(U,{variant:`filled`,onClick:()=>t(`engines.hooks.install`),children:Q(`engines.integrations.install`,{count:a})}):(0,H.jsx)(`span`,{className:ix,children:Q(`engines.integrations.upToDate`)}),o>0?(0,H.jsx)(U,{variant:`action`,onClick:()=>t(`engines.hooks.uninstall`),children:Q(`engines.integrations.remove`,{count:o})}):null]})})})}function tw(e){let t=e.engines.filter(e=>e.skill!==`unsupported`),n=t.filter(e=>e.skill===`installed`).length,r=t.length-n;return(0,H.jsx)(wx,{title:Q(`engines.skill.title`),hint:Q(`engines.skill.hint`),children:(0,H.jsx)(Tx,{label:t.length>0?Q(`engines.integrations.summary`,{installed:n,total:t.length}):Q(`engines.skill.noEngines`),children:r>0?(0,H.jsx)(U,{variant:`filled`,onClick:()=>void qC(e.client).then(e.reload),children:Q(`engines.skill.install`,{count:r})}):t.length>0?(0,H.jsx)(`span`,{className:ix,children:Q(`engines.integrations.upToDate`)}):null})})}var nw={bug:`settings.feedback.kindBug`,idea:`settings.feedback.kindIdea`,question:`settings.feedback.kindQuestion`};function rw({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,H.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=>L(G(e),`error`)).finally(()=>c(!1)))},children:[(0,H.jsx)(`p`,{className:`m-0 ${Eb}`,children:B(`settings.feedback.hint`)}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,H.jsx)(`div`,{className:Pb,children:(0,H.jsx)(U,{variant:`action`,type:`button`,onClick:()=>{f(!1),py(e).catch(()=>f(!0))},children:B(`settings.feedback.report`)})}),(0,H.jsx)(`p`,{className:`m-0 ${Eb}`,children:B(d?`settings.feedback.reportFailed`:`settings.feedback.reportNote`)})]}),(0,H.jsxs)(`label`,{className:jb,children:[(0,H.jsx)(`span`,{className:Mb,children:B(`settings.feedback.kindLabel`)}),(0,H.jsx)(`select`,{className:`${kb} w-full`,value:t,onChange:e=>n(e.target.value),children:Object.keys(nw).map(e=>(0,H.jsx)(`option`,{value:e,children:B(nw[e])},e))})]}),(0,H.jsxs)(`label`,{className:jb,children:[(0,H.jsx)(`span`,{className:Mb,children:B(`settings.feedback.titleLabel`)}),(0,H.jsx)(`input`,{className:`${kb} w-full`,value:r,onChange:e=>i(e.target.value)})]}),(0,H.jsxs)(`label`,{className:jb,children:[(0,H.jsx)(`span`,{className:Mb,children:B(`settings.feedback.body`)}),(0,H.jsx)(`textarea`,{className:`${kb} ${Nb} w-full`,rows:6,value:a,onChange:e=>o(e.target.value)})]}),l&&(0,H.jsxs)(`p`,{className:`m-0 text-meta text-muted [&_a]:text-accent break-words`,children:[l.filed?B(`settings.feedback.sent`,{number:l.number??0}):B(`settings.feedback.notFiled`,{hint:l.hint??``}),` `,(0,H.jsx)(`a`,{className:`underline`,href:l.url,target:`_blank`,rel:`noreferrer`,children:l.filed?l.url:B(`settings.feedback.openLink`)})]}),(0,H.jsx)(`div`,{className:Pb,children:(0,H.jsx)(U,{variant:`filled`,type:`submit`,disabled:s||!r.trim()||!a.trim(),children:B(`settings.feedback.send`)})})]})}var iw=[{value:`en`,label:`English`},{value:`zh`,label:`中文`}],aw={default:`general.worktreeKindDefault`,nextToProject:`general.worktreeKindNext`,custom:`general.worktreeKindCustom`};function ow({model:e}){let{client:t}=e,n=wp(),{prefs:r,info:i}=n,a=(e,n)=>void Sp(t,e,n),o=[`default`,`nextToProject`];(i.worktreeCustomPath||r.worktreeBase===`custom`)&&o.push(`custom`);let s=o.map(e=>({value:e,label:Q(aw[e])}));return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(wx,{title:B(`settings.general.groupInterface`),children:[(0,H.jsx)(Ox,{label:Q(`general.language`),hint:B(`prefs.languageHint`),value:r.locale,picks:iw,onPick:e=>a(`locale`,e)}),(0,H.jsx)(Ex,{label:Q(`general.keyHintsShow`),hint:Q(`general.keyHintsHint`),checked:r.keyHints,onChange:e=>a(`keyHints`,e)}),(0,H.jsx)(Ex,{label:Q(`general.zenDefaultOn`),hint:B(`prefs.zenHint`),checked:r.zen,onChange:e=>a(`zen`,e)}),(0,H.jsx)(Ox,{label:B(`settings.general.tabStrip`),value:r.tabStrip,picks:Tp(n,`tabStrip`).map(e=>({value:e,label:Q(`general.tabStripMode.${e}`)})),onPick:e=>a(`tabStrip`,e)})]}),(0,H.jsx)(wx,{title:B(`settings.general.groupFiles`),children:(0,H.jsx)(Ox,{label:Q(`general.worktree`),hint:Q(`general.worktreeHint`),value:r.worktreeBase,picks:s,onPick:e=>a(`worktreeBase`,e)})}),(0,H.jsx)(wx,{title:B(`settings.general.groupTerminal`),hint:Q(`general.terminalHint`),children:(0,H.jsx)(sw,{client:t})})]})}function sw({client:e}){let t=wp(),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,H.jsx)(Tx,{label:B(`settings.general.scrollback`),hint:Q(`general.scrollbackRowHint`),children:(0,H.jsx)(`input`,{className:Ab,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)):Sp(e,`scrollbackRows`,o)},onKeyDown:e=>e.key===`Enter`&&e.currentTarget.blur()})})}var cw=`prefix.key`;function lw(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 uw(){return el(Xc().filter(e=>e.keys.length>0||e.prefixKeys!==void 0)).flatMap(e=>[...e.rows])}[...Array.from({length:12},(e,t)=>`f${t+1}`)];function dw(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 fw={"sidebar.goto":dw(`top (double-tap)`,`bottom`),"sidebar.nav":dw(`down`,`up`),"files.nav":dw(`down`,`up`),"diff.review.cursor":dw(`down`,`up`),"sidebar.search.nav":dw(`down`,`up`),"files.hierarchy":dw(`collapse`,`expand`),"files.tab":dw(`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 pw(e){return fw[e]?.slots??[]}var mw=`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`,hw={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`},gw=`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 _w(e){return(0,H.jsxs)(`span`,{className:It(mw,hw[e.tone??`idle`]),children:[(0,H.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,H.jsx)(`button`,{type:`button`,"aria-label":e.removeLabel,className:It(gw,!e.removeShown&&`opacity-0`),onClick:e.onRemove,children:`×`})]})}var vw=new Set([`app.quit`,`view.redraw`]),yw=el(uw().filter(e=>!vw.has(e.id)));function bw(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 ma(e)}catch(e){L(G(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`?[]:da.get().prefix.firstStrokes,i=lw(t,qc(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,pw(e).length),got:[],prefixArmed:!1})},save:(e,t)=>void o(e,t)}}function xw(e,t){if(e.prefixArmed)return Q(`keybindings.recordingPrefix`,{prefix:t});let n=pw(e.id)[e.got.length];return n?Q(`keybindings.recordingSlot`,{slot:n}):Q(`keybindings.recording`)}function Sw(e){let{editor:t,id:n}=e,r=()=>t.record(n),i=B(`keys.recordFor`,{name:e.name});if(t.recording?.id===n)return(0,H.jsx)(_w,{tone:`active`,label:i,onPress:r,children:xw(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,H.jsx)(_w,{tone:`empty`,label:i,onPress:r,children:Q(`keybindings.unbound`)}):(0,H.jsxs)(H.Fragment,{children:[e.direct.length>0&&(0,H.jsx)(_w,{tone:a,label:i,onPress:r,onRemove:()=>t.save(n,{direct:[]}),removeLabel:B(`keys.removeFor`,{name:e.name}),removeShown:o,children:e.direct.join(` / `)}),s.length>0&&(0,H.jsx)(_w,{tone:a,label:i,onPress:r,onRemove:()=>t.save(n,{prefix:[]}),removeLabel:B(`keys.removeFor`,{name:e.name}),removeShown:o,children:s.map(t=>`${e.prefixName} ${t}`).join(` / `)})]})}function Cw(e,t,n,r){let i=e.notice?.id===t?e.notice.lines:[];return i.length>0?(0,H.jsx)(`span`,{className:`text-warning`,children:i.join(` `)}):n===null?r:(0,H.jsxs)(`span`,{className:`inline-flex flex-wrap items-baseline gap-x-2`,children:[Q(`keybindings.defaultKeys`,{keys:n}),(0,H.jsx)(U,{hit:`tight`,onClick:()=>e.save(t,{direct:`default`,prefix:`default`}),children:B(`keys.reset`)})]})}function ww({editor:e,keys:t}){let n=t.prefix.key??Q(`keybindings.prefixDisabled`),r=(e,t=[])=>[...e,...t.map(e=>`${n} ${e}`)].join(` / `);return(0,H.jsx)(H.Fragment,{children:yw.map(i=>(0,H.jsx)(wx,{title:wl(i.category),children:i.rows.map(i=>{let a=t.rows.find(e=>e.id===i.id),o=Sl(i.id);return(0,H.jsx)(Tx,{label:o,hint:Cw(e,i.id,a?r(i.keys,i.prefixKeys):null),children:(0,H.jsx)(Sw,{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 Tw({model:e}){let{client:t}=e,{prefs:n}=wp(),r=y(da),[i,a]=(0,h.useState)(!1);(0,h.useEffect)(()=>void ma(t),[t]);let o=r.prefix.key??Q(`keybindings.prefixDisabled`),s=bw(t),c=ua.prefix.firstStrokes,l=r.prefix.firstStrokes.join()!==c.join();return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(wx,{hint:B(`keys.editHint`),children:[(0,H.jsx)(Ox,{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 Sp(t,`prefixTap`,e)}),(0,H.jsx)(Tx,{label:Q(`keybindings.prefixTitle`,{prefix:o}),hint:Cw(s,cw,l?c.join(` / `):null,Q(`keybindings.prefixHint`,{prefix:o,timeout:r.prefix.timeoutMs})),children:(0,H.jsx)(Sw,{editor:s,id:cw,name:Q(`keybindings.prefixKey`),direct:r.prefix.firstStrokes,prefixName:o,changed:l})})]}),r.warnings.length>0&&(0,H.jsx)(wx,{title:Q(`keybindings.warnings`),children:r.warnings.map(e=>(0,H.jsx)(Tx,{label:(0,H.jsx)(`span`,{className:`text-warning`,children:e})},e))}),(0,H.jsx)(ww,{editor:s,keys:r}),r.plugins.length>0&&(0,H.jsx)(wx,{title:B(`keys.pluginChords`),children:r.plugins.map(e=>(0,H.jsx)(Tx,{label:(0,H.jsx)(`span`,{className:`font-mono`,children:e.chord}),hint:(0,H.jsx)(`span`,{className:`font-mono`,children:`${e.kind}:${e.target}`})},e.chord))}),(0,H.jsx)(wx,{title:Q(`keybindings.configFile`),hint:B(`prefs.keysYaml`),children:(0,H.jsx)(Tx,{label:(0,H.jsx)(`span`,{className:`font-mono break-all`,children:r.path+(r.exists?``:Q(`keybindings.notCreated`))}),hint:B(i?`keys.agentFailed`:`keys.agentHint`),children:(0,H.jsx)(U,{variant:`action`,onClick:()=>{a(!1),fy(e,B(`keys.agentPrompt`,{path:r.path})).catch(()=>a(!0))},children:B(`keys.agent`)})})})]})}var Ew=`/assets/pulse-3XJkP4CJ.wav`;function Dw(e,t){return e===`error`||t}function Ow(e,t,n=!1){return n?e.kind===`error`:t||e.kind!==`done`||e.turnEnd!==!0}function kw(e,t,n=!1){return t&&e.silent!==!0&&!n}function Aw(e){return e===`permission_needed`?`needs_input`:e===`error`||e===`rate_limited`||e===`dead`?`error`:e===`turn_complete`?`done`:null}function jw(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 Mw(){return window.isSecureContext&&`serviceWorker`in navigator&&`PushManager`in window&&`Notification`in window}var Nw=()=>navigator.serviceWorker.register(`sw.js`);async function Pw(e){if(!Mw())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 Fw(e){if(!Mw())return`unsupported`;if(await Notification.requestPermission()!==`granted`)return`blocked`;let t=await Nw();await navigator.serviceWorker.ready;let{publicKey:n}=await e.request(`push.key`),r=await t.pushManager.getSubscription();return r?.options.applicationServerKey&&Vw(r.options.applicationServerKey)!==n&&(await r.unsubscribe(),r=null),r??=await t.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:Bw(n)}),await e.request(`push.subscribe`,{subscription:r.toJSON()}),`on`}async function Iw(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 Lw(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(),Rw?.(e),o.close()}}var Rw=null;function zw(e){Rw=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=()=>{Rw=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 Bw(e){let t=atob(e.replace(/-/g,`+`).replace(/_/g,`/`));return Uint8Array.from(t,e=>e.charCodeAt(0))}function Vw(e){return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}var Hw={done:`✓`,needs_input:`?`,error:`✕`};function Uw(e){let t=new Audio(Ew);t.volume=Math.min(1,Math.max(0,e)),t.play().catch(()=>void 0)}function Ww(e,t,n){!document.hidden||typeof Notification>`u`||Notification.permission!==`granted`||Lw(e,t,n,Hw[t]).catch(()=>void 0)}function Gw(){typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission()}function Kw(e){let t=new Map;for(let n of e.tasks)n.activity&&t.set(n.id,n.activity.state);return t}function qw(e){let t=(0,h.useRef)(null);(0,h.useEffect)(()=>{let n=()=>{let n=e.tasks.get();if(!n)return;let r=Kw(n),i=jw(t.current,r,null,Aw);t.current=r;let{prefs:a}=_p.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:t,kind:n}of i){if(t===o||!Ow({kind:n,turnEnd:!0},a.finishedAlerts))continue;let r=s.get(t)??t;Dw(n,a.toast)&&L(`${Hw[n]} ${r}`,n===`error`?`error`:`info`,{label:B(`workspace.openTask`),run:()=>e.select(t)}),kw({},a.sound)&&(Uw(a.soundVolume),Ww(t,n,r))}};return n(),e.tasks.subscribe(n)},[e])}function Jw({client:e}){let[t,n]=(0,h.useState)(null),[r,i]=(0,h.useState)(null);(0,h.useEffect)(()=>{Pw(e).then(n,()=>n(`off`))},[e]);let a=t=>{i(null),(t?Fw(e):Iw(e)).then(n,e=>i(e instanceof Error?e.message:String(e)))},o=r?B(`prefs.pushFailed`,{error:r}):B(t===`unsupported`?`prefs.pushUnsupported`:t===`blocked`?`prefs.pushBlocked`:`prefs.pushHint`);return(0,H.jsx)(Ex,{label:B(`prefs.push`),hint:o,checked:t===`on`,disabled:t===null||t===`unsupported`||t===`blocked`,onChange:a})}function Yw({model:e}){let{client:t}=e,n=wp(),{prefs:r}=n,i=(e,n)=>void Sp(t,e,n);return(0,H.jsxs)(wx,{children:[(0,H.jsx)(Ex,{label:Q(`general.toast`),hint:B(`settings.notifications.toastNote`),checked:r.toast,onChange:e=>i(`toast`,e)}),(0,H.jsx)(Ex,{label:Q(`general.sound`),hint:B(`prefs.soundHint`),checked:r.sound,onChange:e=>{e&&Gw(),i(`sound`,e)}}),(0,H.jsx)(Ox,{label:B(`settings.notifications.volume`),hint:B(`prefs.soundVolumeHint`),value:r.soundVolume,picks:Tp(n,`soundVolume`).map(e=>({value:e,label:`${Math.round(e*100)}%`})),onPick:e=>{_p.get().prefs.sound&&Uw(e),i(`soundVolume`,e)}}),(0,H.jsx)(Ex,{label:Q(`general.crossTask`),hint:Q(`general.crossTaskHint`),checked:r.crossTask,onChange:e=>i(`crossTask`,e)}),(0,H.jsx)(Ex,{label:Q(`general.finishedAlerts`),hint:Q(`general.finishedAlertsHint`),checked:r.finishedAlerts,onChange:e=>i(`finishedAlerts`,e)}),(0,H.jsx)(Jw,{client:t})]})}var Xw={kanban:`kanban`,issues:`issues`};function Zw({model:e}){let t=y(e.installedMods),[n,r]=(0,h.useState)(()=>X(e,`builtinMods.list`)?.mods??null);if((0,h.useEffect)(()=>{Ku(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&&O.get()===Xw[n.id]&&O.set(null),e.refreshMods())).catch(e=>L(G(e),`error`))};return(0,H.jsx)(wx,{title:B(`settings.plugins.builtIn`),hint:B(`settings.plugins.builtInHint`),children:n.map(e=>(0,H.jsx)(Tx,{label:e.name,hint:e.description,inline:!0,children:(0,H.jsx)(Cx,{on:t.has(e.id),"aria-label":B(`settings.plugins.turnOn`,{name:e.name}),onClick:()=>i(e)})},e.id))})}function Qw({model:e}){let{client:t}=e,[n,r]=(0,h.useState)(()=>X(t,`plugins.list`)?.plugins??null),i=(0,h.useCallback)(()=>Ku(t,`plugins.list`).then(e=>r(e.plugins),e=>L(G(e),`error`)),[t]);return(0,h.useEffect)(()=>{i()},[i]),(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Zw,{model:e}),(0,H.jsx)(wx,{title:B(`settings.plugins.registered`),children:n?n.length===0?(0,H.jsx)(`p`,{className:Ob,children:B(`settings.plugins.empty`)}):n.map(e=>(0,H.jsx)(Tx,{label:e.id,hint:[e.version,e.linked?B(`settings.plugins.linked`):null,e.platformOk===!1?B(`settings.plugins.unsupportedPlatform`):null].filter(Boolean).join(`, `),inline:!0,children:(0,H.jsx)(Cx,{on:e.enabled,"aria-label":e.id,onClick:()=>void t.request(`plugin.setEnabled`,{id:e.id,enabled:!e.enabled}).then(i).catch(e=>L(G(e),`error`))})},e.id)):(0,H.jsx)(`p`,{className:Ob,children:B(`preview.loading`)})})]})}function $w(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,H.jsxs)(`form`,{className:ux,onSubmit:n=>{n.preventDefault(),e.onSave(t,s?.takesModel?r.trim():``,a)},onKeyDown:t=>{t.key===`Escape`&&(t.stopPropagation(),e.onCancel())},children:[(0,H.jsx)(nb,{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,H.jsx)(nb,{label:B(`prefs.tierEffort`),value:a,picks:[``,...s.effortLevels].map(e=>({value:e,label:e||Q(`autoRouting.engineDefault`)})),onPick:o}),s?.takesModel&&(0,H.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":B(`prefs.tierModel`),onChange:e=>i(e.target.value)}),(0,H.jsxs)(`div`,{className:Pb,children:[(0,H.jsx)(U,{onClick:e.onCancel,children:B(`dialog.cancel`)}),(0,H.jsx)(U,{variant:`filled`,type:`submit`,children:Q(`action.save`)})]})]})}function eT({client:e}){let[t,n]=(0,h.useState)(()=>X(e,`autoRouting.get`)??null),[r,i]=(0,h.useState)(null),a=(0,h.useCallback)(()=>Ku(e,`autoRouting.get`).then(n,e=>L(G(e),`error`)),[e]);(0,h.useEffect)(()=>{a()},[a]);let o=(t,n)=>e.request(t,n).then(a).catch(e=>L(G(e),`error`));if(!t)return(0,H.jsx)(`p`,{className:Ob,children:B(`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,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(wx,{hint:Q(`autoRouting.hint`),children:[!t.configured&&(0,H.jsx)(Tx,{label:(0,H.jsx)(`span`,{className:`text-warning`,children:Q(`autoRouting.unconfigured`)})}),t.tiers.map(e=>(0,H.jsxs)(`div`,{className:cx,children:[(0,H.jsxs)(`div`,{className:lx,children:[(0,H.jsx)(`span`,{className:Tb,children:tb(`tier.${e.tier}`)}),(0,H.jsx)(`span`,{className:`${Eb} min-w-0 truncate`,children:[e.engineName,e.model??Q(`autoRouting.engineDefault`),e.effort??Q(`autoRouting.engineDefault`)].join(` · `)}),(0,H.jsx)(U,{className:`ml-auto`,onClick:()=>i(r===e.tier?null:e.tier),children:B(`prefs.tierEdit`)})]}),(0,H.jsx)(`span`,{className:Eb,children:tb(`tierDesc.${e.tier}`)}),(0,H.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,H.jsx)($w,{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,H.jsxs)(wx,{title:Q(`autoRouting.classifierTitle`),hint:Q(`autoRouting.classifierHint`),children:[(0,H.jsx)(Tx,{label:(0,H.jsx)(`span`,{className:s.mode===`off`?`text-muted`:`text-warning`,children:Q(`autoRouting.classifierDataFlow`)})}),(0,H.jsx)(Ox,{label:Q(`autoRouting.classifierLabel`),hint:l.replace(/^[—\s]+/,``),value:s.mode,picks:c,onPick:e=>void o(`autoRouting.setClassifier`,{mode:e})})]}),(0,H.jsxs)(wx,{title:B(`prefs.classifierConnection`),hint:B(`prefs.editInTui`),children:[(0,H.jsx)(kx,{label:Q(`autoRouting.endpointLabel`),value:s.endpointHost||B(`prefs.unset`)}),(0,H.jsx)(kx,{label:Q(`autoRouting.thresholdLabel`),value:s.threshold.toFixed(2)}),(0,H.jsx)(Tx,{label:Q(`autoRouting.keyLabel`),hint:u})]})]})}var tT=[{id:`preferences`,sections:[`general`,`appearance`,`notifications`,`snippets`,`keys`]},{id:`agents`,sections:[`engines`,`autoRouting`,`voice`,`connectors`,`plugins`]},{id:`more`,sections:[`about`,`feedback`,`dev`]}],nT=e=>({section:e??`general`,drilled:e!==void 0});function rT(e,t){return t&&e.drilled?`list`:`close`}var iT=e=>e.split(`
54
- `,1)[0]??``;function aT(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=m_.test(t)&&r.trim()!==``;return(0,H.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:n=>{n.preventDefault(),s&&(o(!0),f_(e.client,{name:t,text:r}).then(e.onDone).catch(e=>{L(G(e),`error`),o(!1)}))},children:[(0,H.jsxs)(`label`,{className:jb,children:[(0,H.jsx)(`span`,{className:Mb,children:B(`snippets.name`)}),(0,H.jsx)(`input`,{className:`${kb} w-full font-mono`,value:t,maxLength:32,spellCheck:!1,autoComplete:`off`,autoFocus:!e.editing,readOnly:e.editing!==void 0,placeholder:B(`snippets.namePlaceholder`),onChange:e=>n(e.target.value)}),t!==``&&!m_.test(t)&&(0,H.jsx)(`span`,{className:`text-meta text-muted [&_a]:text-accent`,children:B(`snippets.badName`)})]}),(0,H.jsxs)(`label`,{className:jb,children:[(0,H.jsx)(`span`,{className:Mb,children:B(`snippets.text`)}),(0,H.jsx)(`textarea`,{className:`${kb} ${Nb} w-full`,rows:5,value:r,maxLength:8e3,placeholder:B(`snippets.textPlaceholder`),onChange:e=>i(e.target.value)})]}),(0,H.jsxs)(`div`,{className:Pb,children:[(0,H.jsx)(U,{onClick:e.onDone,children:B(`snippets.cancel`)}),(0,H.jsx)(U,{type:`submit`,disabled:a||!s,children:B(`snippets.save`)})]})]})}function oT({model:e}){let{client:t}=e,n=u_(),[r,i]=(0,h.useState)(null);return(0,h.useEffect)(()=>void d_(t).catch(()=>void 0),[t]),(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,H.jsxs)(wx,{children:[n.length===0&&r===null&&(0,H.jsx)(Tx,{label:B(`snippets.empty`)}),n.map(e=>(0,H.jsxs)(Tx,{label:(0,H.jsxs)(`span`,{className:`font-mono`,children:[`@`,e.name]}),hint:iT(e.text),children:[(0,H.jsx)(U,{onClick:()=>i(e),children:B(`snippets.edit`)}),(0,H.jsx)(U,{onClick:()=>void p_(t,e.name).then(()=>{i(null),L(B(`snippets.removed`,{name:e.name}))}).catch(e=>L(G(e),`error`)),children:B(`snippets.remove`)})]},e.name))]}),r===null?(0,H.jsx)(`div`,{className:Pb,children:(0,H.jsx)(U,{onClick:()=>i(`new`),children:B(`snippets.add`)})}):(0,H.jsx)(aT,{client:t,editing:r===`new`?void 0:r,onDone:()=>i(null)},r===`new`?`new`:r.name)]})}var sT=e=>e>=95?`crit`:e>=75?`warn`:`ok`,cT=e=>String(e).padStart(2,`0`);function lT(e,t){if(e==null||e<=t)return``;let n=new Date(e),r=`${cT(n.getHours())}:${cT(n.getMinutes())}`;return e-t<864e5?`→ ${r}`:`→ ${n.getMonth()+1}/${n.getDate()} ${r}`}function uT(e,t){let n=e.windows.find(e=>e.kind===`session`)??e.windows[0];return n?{label:n.label,percentText:`${n.percent}%`,resetText:lT(n.resetsAt,t),tone:sT(n.percent)}:null}var dT=1e4;function fT({client:e,inset:t=!0}){let n=y(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=K(dT,r);return()=>{t=!1,a()}},[e,n.state]);let a=Date.now(),o=(r??[]).flatMap(e=>{let t=uT({capturedAt:e.capturedAt,windows:e.windows},a);return t?[{vendor:e.vendor,name:e.name,chip:t}]:[]});return o.length===0?null:(0,H.jsx)(`div`,{className:`${zn} ${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,H.jsxs)(U,{variant:`row`,className:Bn,title:`${t} · ${n.label} ${n.percentText} ${n.resetText}`.trim(),"aria-label":`${B(`usage.open`)}: ${t}`,onClick:()=>{z(),he(`usage`)},children:[(0,H.jsx)(`span`,{className:`truncate`,children:t}),(0,H.jsx)(`span`,{className:Un(n.tone),style:{"--fill":`${r}%`}}),(0,H.jsxs)(`span`,{children:[n.label,` `,(0,H.jsx)(`span`,{className:Vn[n.tone],children:n.percentText})]})]},e)})})}var pT=2e3;function mT(e){let[t,n]=(0,h.useState)(null),[r,i]=(0,h.useState)(null),a=(0,h.useCallback)(t=>{n(t),gv(e,t.available)},[e]),o=(0,h.useCallback)(()=>e.request(`voice.status`).then(a,e=>i(G(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(),pT);return()=>window.clearInterval(e)},[s,o]),{status:t,error:r,setError:i,accept:a}}function hT(e){let[t,n]=(0,h.useState)(!1);return t?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:Db,children:e.ask}),(0,H.jsx)(U,{variant:`action`,disabled:e.disabled,onClick:()=>{n(!1),e.onConfirm()},children:e.label}),(0,H.jsx)(U,{variant:`action`,onClick:()=>n(!1),children:B(`voice.setup.cancel`)})]}):(0,H.jsx)(U,{variant:`action`,disabled:e.disabled,onClick:()=>n(!0),children:e.label})}function gT({client:e}){let{status:t,error:n,setError:r,accept:i}=mT(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(G(e))).finally(()=>o(!1)));if(!t)return(0,H.jsx)(`p`,{className:Ob,children:n??`…`});if(!s)return(0,H.jsx)(`p`,{className:Ob,children:t.model??B(`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`?B(`voice.setup.offHint`):c?B(`voice.setup.cloudNeeded`):b===`local`&&!s.localInstalled?B(y?`voice.setup.localInstalling`:`voice.setup.localNeeded`):t.ready?B(`voice.setup.ready`,{model:t.model??``}):t.error??B(`voice.setup.starting`),C=y?v.line??B(`voice.setup.installing`):v.phase===`failed`&&!s.localInstalled?B(`voice.setup.failed`,{line:v.line??``}):s.localInstalled?B(`voice.setup.installed`):s.blocked??B(`voice.setup.localHint`);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(wx,{children:(0,H.jsx)(Ox,{label:B(`voice.setup.dictation`),hint:S,value:b,picks:[`off`,`local`,`cloud`].map(e=>({value:e,label:B(`voice.setup.backend.${e}`)})),onPick:x})}),(b===`local`||s.localInstalled||y)&&(0,H.jsx)(wx,{title:B(`voice.setup.backend.local`),children:(0,H.jsx)(Tx,{label:B(`voice.setup.localTitle`),hint:C,children:y?(0,H.jsx)(`span`,{className:`max-w-90 min-w-0 truncate font-mono text-meta text-muted [overflow-wrap:anywhere]`,children:B(`voice.setup.installing`)}):s.localInstalled?(0,H.jsx)(hT,{label:B(`voice.setup.uninstall`),ask:B(`voice.setup.uninstallAsk`),disabled:a,onConfirm:()=>void _(`voice.uninstall`)}):!s.blocked&&(0,H.jsx)(U,{variant:`action`,disabled:a,onClick:()=>void _(`voice.install`),children:B(`voice.setup.install`)})})}),(b===`cloud`||s.cloud)&&(0,H.jsx)(wx,{title:B(`voice.setup.cloudTitle`),hint:B(`voice.setup.cloudHint`),children:(0,H.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,H.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(`span`,{className:`text-meta font-medium text-muted`,children:B(`voice.setup.baseURL`)}),(0,H.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,H.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(`span`,{className:`text-meta font-medium text-muted`,children:B(`voice.setup.model`)}),(0,H.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,H.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(`span`,{className:`text-meta font-medium text-muted`,children:B(`voice.setup.apiKey`)}),(0,H.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?B(`voice.setup.keySaved`):``,autoComplete:`off`,onChange:e=>g(e.target.value)})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2.5`,children:[s.cloud&&(0,H.jsx)(hT,{label:B(`voice.setup.forget`),ask:B(`voice.setup.forgetAsk`),disabled:a,onConfirm:()=>{d(``),p(``),_(`voice.forgetCloud`)}}),(0,H.jsx)(U,{variant:`action`,type:`submit`,disabled:a||!u.trim()||!f.trim()||!(m||s.cloud?.hasKey),children:B(s.backend===`cloud`?`voice.setup.save`:`voice.setup.saveAndUse`)})]})]})}),n&&(0,H.jsx)(`p`,{className:`m-0 py-3 text-body text-muted text-error`,children:n})]})}var _T={general:e=>(0,H.jsx)(ow,{model:e}),appearance:e=>(0,H.jsx)(CC,{model:e}),notifications:e=>(0,H.jsx)(Yw,{model:e}),snippets:e=>(0,H.jsx)(oT,{model:e}),keys:e=>(0,H.jsx)(Tw,{model:e}),engines:e=>(0,H.jsx)(XC,{client:e.client}),autoRouting:e=>(0,H.jsx)(eT,{client:e.client}),voice:e=>(0,H.jsx)(gT,{client:e.client}),connectors:e=>(0,H.jsx)(zC,{model:e}),plugins:e=>(0,H.jsx)(Qw,{model:e}),about:e=>(0,H.jsx)(IS,{client:e.client}),feedback:e=>(0,H.jsx)(rw,{model:e}),dev:e=>(0,H.jsx)(VC,{client:e.client})},vT={general:`sections.general`,engines:`sections.engines`,autoRouting:`sections.autoRouting`,plugins:`sections.plugins`,keys:`sections.keys`,feedback:`sections.feedback`,dev:`sections.dev`},yT=e=>{let t=vT[e];return t?Q(t):B(`settings.sections.${e}`)};function bT(e){return(0,H.jsxs)(`nav`,{className:lb,"aria-label":B(`settings.title`),children:[(0,H.jsx)(`h1`,{className:ub,children:B(`settings.title`)}),tT.map(t=>(0,H.jsxs)(`div`,{className:db,children:[(0,H.jsx)(`p`,{className:fb,children:B(`settings.groups.${t.id}`)}),t.sections.map(n=>(0,H.jsxs)(U,{variant:`row`,className:pb(!e.narrow&&e.current===n,t.id===`more`),"aria-current":!e.narrow&&e.current===n?`page`:void 0,onClick:()=>e.onPick(n),children:[yT(n),(0,H.jsx)(ps,{right:!0,className:mb})]},n))]},t.id))]})}function xT({model:e,section:t}){V();let[n,r]=(0,h.useState)(()=>nT(t)),i=Se(),a=()=>rT(n,i)===`list`?r({...n,drilled:!1}):z();(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=y(Oe)===`panel`&&i&&n.drilled,s=!i||!n.drilled||o,c=!i||n.drilled;return(0,H.jsx)(`div`,{className:ib,onMouseDown:e=>e.target===e.currentTarget&&z(),children:(0,H.jsxs)(`dialog`,{ref:i&&!n.drilled?ke(z):void 0,tabIndex:-1,open:!0,className:ab,"aria-label":B(`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:[i?s&&(0,H.jsx)(U,{variant:`row`,className:sb(!0),onClick:z,children:`‹ ${fe.get()===`sidebar`?Tl(`narrowBack`):B(`dialog.close`)}`}):(0,H.jsx)(U,{variant:`row`,className:ob,"aria-label":B(`dialog.close`),title:B(`dialog.close`),onClick:z,children:`×`}),s&&(0,H.jsx)(bT,{current:n.section,narrow:i,onPick:e=>r({section:e,drilled:!0})}),i&&s&&(0,H.jsx)(fT,{client:e.client,inset:!1}),c&&(0,H.jsxs)(`div`,{ref:i?ke(a):void 0,className:cb(o),children:[i&&(0,H.jsx)(U,{variant:`row`,className:sb(!1),onClick:a,children:`‹ ${B(`settings.title`)}`}),(0,H.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto scrollbar-none`,children:(0,H.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,H.jsxs)(`header`,{className:`flex flex-col gap-1 pr-8 w-narrow:pr-0`,children:[(0,H.jsx)(`h1`,{className:`m-0 font-sans text-display font-semibold normal-nums text-ink`,children:yT(n.section)}),(0,H.jsx)(`p`,{className:`m-0 text-body text-muted`,children:B(`settings.pages.${n.section}`)})]}),(0,H.jsx)(`div`,{className:`flex flex-col gap-7 w-narrow:gap-6`,children:_T[n.section](e)})]})},n.section)]})]})})}var ST=e=>{let{taskId:t}=e.selection.get();return e.tasks.get()?.tasks.find(e=>e.id===t)??null},CT=e=>{let{taskId:t,tabId:n}=e.selection.get(),r=t?e.tabs.get()[t]?.find(e=>e.id===n):void 0;return!!r&&!Gd(r.split)},wT=[{id:`app.refresh`,live:()=>Ta.get().stale,run:e=>ka(e.client)},{id:`palette.open`,live:()=>!0,run:zy},{id:`task.new.global`,live:()=>!0,run:e=>xv(ST(e)?.repo)},{id:`chat.tab.fork`,live:e=>!!ST(e),run:e=>{let t=ST(e);t&&C.set((0,H.jsx)(ud,{model:e,taskId:t.id,context:`continue`}))}},{id:`chat.fork.new`,live:e=>!!ST(e),run:e=>{let t=ST(e);t&&C.set((0,H.jsx)(ud,{model:e,taskId:t.id,destination:`fork`}))}},{id:`settings.open`,live:()=>!0,run:e=>C.set((0,H.jsx)(xT,{model:e}))},{id:`inbox.show`,live:()=>!0,run:e=>C.set((0,H.jsx)(pp,{model:e}))},{id:`focus.previous`,live:()=>!0,run:()=>xo(-1)},{id:`focus.next`,live:()=>!0,run:()=>xo(1)},{id:`workspace.zenToggle`,live:e=>!!ST(e),run:()=>N.set(!N.get())},{id:`files.createPR`,live:e=>!!ST(e),run:e=>{let t=ST(e);t&&e.client.request(`tab.requestPR`,e.engineTarget(t.id)).then(()=>L(B(`files.prRequested`))).catch(e=>L(e instanceof Error?e.message:String(e),`error`))}},{id:`chat.tab.close`,live:e=>!!e.selection.get().tabId&&CT(e),run:e=>{let{taskId:t,tabId:n}=e.selection.get();!t||!n||e.closeTab(t,n).catch(e=>L(e instanceof Error?e.message:String(e),`error`))}},{id:`kanban.open`,live:e=>e.installedMods.get().has(`kanban`),run:()=>he(`kanban`)},{id:`automations.open`,live:()=>!0,run:()=>he(`routines`)},{id:`workItems.open`,live:e=>e.installedMods.get().has(`issues`),run:()=>he(`issues`)},{id:`task.moveMode`,live:e=>!!Uy(e),run:()=>{zp(!Lp.get()),document.querySelector(`.rail`)?.focus()}},{id:`files.syncBase`,live:e=>Uy(e)?.kind===`task`,run:e=>{let t=Uy(e);t&&Ty(e,t.id)}},{id:`files.fixChecks`,live:e=>!!Uy(e),run:e=>{let t=Uy(e);t&&Dy(e,t.id,B(`taskops.fixSent`))}},{id:`task.openEditor`,live:e=>!!Uy(e),run:e=>{let t=Uy(e);t&&Oy(e,t.id)}}];Co(()=>wT.map(e=>({id:e.id,chords:xa(e.id),prefix:!0,live:e.live,run:e.run})));function TT(e){return Jc(e[0]??``)}function ET(e,t){let n=Oo(),r=To().filter(t=>t.prefix&&Eo(t,n)&&t.live?.(e)!==!1);for(let e of t){let t=r.filter(t=>t.chords.includes(e)).sort((e,t)=>Do(e,n)-Do(t,n))[0];if(t)return t}}var DT=null,OT=null;function kT(){DT=null,OT!==null&&window.clearTimeout(OT),OT=null;let e=bf.get();e.guide?.kind===`prefix`&&bf.set({...e,guide:null})}function AT(){if(DT!==null){kT();return}C.get()||ga()===null||(DT=Date.now(),bf.set({...bf.get(),guide:{kind:`prefix`,armedAt:DT}}),OT!==null&&window.clearTimeout(OT),OT=window.setTimeout(kT,da.get().prefix.timeoutMs))}function jT(e,t){kT();let n=typeof t==`string`?[t]:t,r=ET(e,n);Sf(TT(n),r?.id??null),r?.run(e)}var MT=null;function NT(){MT!==null&&window.clearTimeout(MT),MT=null;let e=bf.get();e.guide?.kind===`direct`&&bf.set({...e,guide:null})}function PT(){MT!==null||C.get()||(MT=window.setTimeout(()=>{kT(),bf.set({...bf.get(),guide:{kind:`direct`}})},400))}function FT(e){(0,h.useEffect)(()=>{let t=t=>{if(t.key===`Control`){t.repeat||PT();return}if(NT(),[`Shift`,`Alt`,`Meta`].includes(t.key))return;let n=qc(t),{firstStrokes:r,timeoutMs:i}=da.get().prefix;if(DT!==null&&Date.now()-DT<=i){if(t.preventDefault(),t.stopImmediatePropagation(),t.key===`Escape`)return kT();jT(e,n);return}kT();let a=document.activeElement,o=Lo(a instanceof HTMLElement?a:null)===`field`;!C.get()&&!o&&n.some(e=>r.includes(e))&&(t.preventDefault(),t.stopImmediatePropagation(),AT())},n=e=>e.key===`Control`&&NT(),r=e=>{DT!==null&&(e.target instanceof Element&&e.target.closest(`.prefix-guide, .shortcut-badge, [data-prefix-arm]`)||kT())};return window.addEventListener(`keydown`,t,{capture:!0}),window.addEventListener(`keyup`,n,{capture:!0}),window.addEventListener(`pointerdown`,r,{capture:!0}),window.addEventListener(`blur`,NT),()=>{window.removeEventListener(`keydown`,t,{capture:!0}),window.removeEventListener(`keyup`,n,{capture:!0}),window.removeEventListener(`pointerdown`,r,{capture:!0}),window.removeEventListener(`blur`,NT),NT(),kT()}},[e])}function IT(e){let t=Oo(),n=new Map;for(let r of To()){if(!r.prefix||!Eo(r,t)||r.live?.(e)===!1)continue;let i=Do(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 LT(e){let t=new Map(aa.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=cl(e);r.set(n,[...r.get(n)??[],{action:e,strokes:t}])}return[...r].map(([e,t])=>({category:e,actions:t}))}var RT=e=>e===`prefix.moreCommands`?yl(`moreCommandsPrefix`):Cl(e);function zT(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 BT({model:e}){V();let t=y(bf);y(da),y(e.selection);let n=Date.now(),r=t.entries.filter(e=>n-e.at<yf),i=t.guide?.kind===`prefix`?t.guide.armedAt:null,a=i!==null&&n-i<vf?i+vf:null;zT(a??(r[0]?r[0].at+yf: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?gf(ko(e,Oo()),ga()):IT(e);return(0,H.jsxs)(`output`,{className:`mono ${an}`,onMouseDown:e=>e.preventDefault(),children:[(0,H.jsxs)(`div`,{className:sn,children:[(0,H.jsx)(`span`,{className:`text-accent`,children:n?yl(`directLayer`):yl(`commandLayer`,{prefix:ga()??``})}),(0,H.jsx)(`span`,{className:`keys-only text-muted`,children:yl(n?`releaseCtrl`:`escCancel`)})]}),(0,H.jsx)(`div`,{className:cn,children:LT(r).map(t=>(0,H.jsxs)(`div`,{className:ln,children:[(0,H.jsx)(`div`,{className:`text-accent`,children:wl(t.category)}),t.actions.map(({action:t,strokes:r})=>(0,H.jsxs)(`button`,{type:`button`,className:un,disabled:n,onClick:()=>r[0]&&jT(e,r[0]),children:[(0,H.jsx)(`span`,{className:on,children:r.map(Jc).join(`/`)}),(0,H.jsx)(`span`,{children:RT(t)})]},t))]},t.category))})]})}return(0,H.jsxs)(`output`,{className:Cn,children:[r.map(e=>(0,H.jsxs)(VT,{at:e.at,children:[(0,H.jsx)(`span`,{className:`text-accent`,children:ga()}),` + `,e.stroke,` →`,` `,e.action?RT(e.action):(0,H.jsx)(`span`,{className:`text-muted`,children:`∅`})]},e.id)),i!==null&&(0,H.jsxs)(`div`,{className:wn(!1),children:[(0,H.jsx)(`span`,{className:`text-accent`,children:ga()}),` ⋯`]})]})}function VT({at:e,children:t}){let[n]=(0,h.useState)(Date.now),r=n-e>140,i={"--hud-out":`${e+yf-140-n}ms`};return(0,H.jsx)(`div`,{className:wn(r),style:i,children:t})}function HT({model:e,bindingId:t,head:n=!1}){let r=y(bf);y(da);let i=wp().prefs.prefixTap;if(r.guide?.kind!==`prefix`||i!==`local`)return null;let a=hf({bindingId:t,reachability:ko(e,Oo()),prefixKey:ga()});if(!a)return null;let o=To().find(e=>e.id===t&&e.prefix)?.chords[0];return(0,H.jsx)(`button`,{type:`button`,className:`mono ${Xt(n)}`,onMouseDown:e=>e.preventDefault(),onClick:t=>{t.stopPropagation(),o&&jT(e,o)},children:a})}var UT=[`workingBorder`,`runningTitle`,`taskColors`,`colorblind`];function WT(e){let{client:t}=e,n=wp(),r=vC(),i=y(sC);yC(e),qw(e),(0,h.useEffect)(()=>{let e=()=>{xp(t).catch(()=>void 0),d_(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]:XS(n.themes,n.prefs.theme,r),a=t?iC(t,n.prefs):{};for(let[t,n]of Object.entries(a))e.style.setProperty(t,n);e.style.colorScheme=r;for(let t of UT)e.dataset[t]=String(n.prefs[t]);oC.set(t?aC(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&&N.get()!==n.prefs.zen&&N.set(n.prefs.zen)},[n.loaded,n.prefs.zen]),(0,h.useEffect)(()=>N.subscribe(()=>{N.get()!==_p.get().prefs.zen&&Sp(t,`zen`,N.get())}),[t])}var GT={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 KT(e,t){return GT[e].flatMap(e=>{if(t===`always`&&e.always!==!0)return[];let n=nl(e.id);return n?[{cap:n,msg:e.msg}]:[]})}var qT=e=>`rove.web.hintUsed.${e}`,JT=v({sidebar:localStorage.getItem(qT(`sidebar`))===`1`});function YT(e){JT.get()[e]||(localStorage.setItem(qT(e),`1`),JT.set({...JT.get(),[e]:!0}))}function XT(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 ZT={entries:[],at:-1};function QT(e,t){let n=e.entries[e.at];if(n&&XT(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 $T(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 eE=v(ZT);function tE(e){let t=O.get();if(t)return{kind:`page`,id:t};let n=F.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 nE(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 rE=!1;function iE(e){let t=!1,n=()=>{t||(t=!0,queueMicrotask(()=>{if(t=!1,rE)return;let n=tE(e);n&&eE.set(QT(eE.get(),n))}))};n();let r=[e.selection.subscribe(n),O.subscribe(n),F.subscribe(n)];return()=>{for(let e of r)e()}}function aE(e,t){let n=eE.get(),r=$T(n,t,t=>nE(e,t)),i=n.entries[r];i&&(rE=!0,i.kind===`task`?(O.set(null),F.set(null),e.select(i.taskId,i.tabId)):i.kind===`page`?(F.set(null),he(i.id)):(O.set(null),F.set(i.start)),eE.set({entries:n.entries,at:r}),queueMicrotask(()=>{rE=!1}))}function oE(e,t){return e.filter(e=>e.groupId===t).sort((e,t)=>(e.createdAt??``).localeCompare(t.createdAt??``)||e.title.localeCompare(t.title))}var sE=400;function cE(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(`
53
+ `):[],[c]),u=(0,h.useRef)(new Set),d=(0,h.useCallback)(async e=>{let n=await Ku(t,`github.status`,CC(e)).catch(e=>({status:null,reason:`failed`,message:G(e)}));i(t=>({...t,[e]:n}))},[t]),f=(0,h.useCallback)(async()=>{o(!0);try{await Promise.all([``,...l].map(d))}finally{o(!1)}},[d,l]);return(0,h.useEffect)(()=>{f()},[f]),(0,h.useEffect)(()=>{let e=new Set(Object.entries(s).flatMap(([e,t])=>TC(t.status)?[e]:[])),t=[...u.current].some(t=>!e.has(t));if(u.current=e,t&&f(),e.size===0)return;let n=window.setTimeout(()=>{for(let t of e)d(t)},wC);return()=>window.clearTimeout(n)},[s,d,f]),{machines:n,probes:s,refreshing:a,refresh:f,probe:d,act:(0,h.useCallback)(async(e,n)=>{try{let r=await t.request(e,n);return r.ok||L(r.message,`error`),r}catch(e){return L(G(e),`error`),null}},[t])}}var DC={same:`markSame`,different:`markDifferent`,signedOut:`markSignedOut`,noGh:`markNoGh`,outdated:`markOutdated`,offline:`markOffline`,denied:`markDenied`,failed:`markFailed`},OC=(e,t)=>B(`settings.connectors.${e}`,t),kC={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 AC(e,t){return e===`loading`?OC(`loading`):OC(DC[e],{login:t?.account??``})}function jC(e){if(!e?.gh)return``;let t=e.ssh.ok?`✓ ${e.ssh.user??``}`.trim():`✗`;return OC(`detail`,{protocol:e.protocol??`—`,ssh:t})}function MC(){return(0,H.jsx)(`svg`,{className:`size-7 flex-none`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,H.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 NC(e){navigator.clipboard.writeText(e).then(()=>L(OC(`codeCopied`)),()=>{})}function PC({login:e,onCancel:t}){return e.state===`failed`?(0,H.jsxs)(`div`,{className:Nb,children:[(0,H.jsx)(`span`,{className:`text-muted`,children:OC(`loginFailed`,{error:e.error??``})}),(0,H.jsx)(U,{className:`ml-auto`,onClick:t,children:OC(`dismiss`)})]}):e.state===`syncing`?(0,H.jsx)(`div`,{className:Nb,children:(0,H.jsx)(`span`,{className:`text-muted`,children:OC(`syncing`)})}):(0,H.jsxs)(`div`,{className:Nb,children:[e.code?(0,H.jsxs)(H.Fragment,{children:[(0,H.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:OC(`codeHint`),onClick:()=>NC(e.code??``),children:e.code}),(0,H.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,children:OC(`openGithub`)})]}):(0,H.jsx)(`span`,{className:`text-muted`,children:OC(`loading`)}),(0,H.jsx)(U,{className:`ml-auto`,onClick:t,children:B(`dialog.cancel`)})]})}function FC(e){let t=SC(e.probe,e.machine,e.rove),n=e.probe?.status??null,r=TC(n),i=t===`different`||t===`signedOut`,a=n?.login;return(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:rx,children:[(0,H.jsxs)(`div`,{className:ix,children:[(0,H.jsx)(`span`,{className:Cb,children:e.name}),(0,H.jsx)(`span`,{className:ax(),title:[n?.authDetail,n?.ssh.detail].filter(Boolean).join(`, `)||void 0,children:jC(n)})]}),(0,H.jsx)(`span`,{className:`whitespace-nowrap text-meta ${kC[t]}`,title:e.probe?.message,children:AC(t,n)}),e.onSync&&i&&e.rove&&!r&&(0,H.jsx)(U,{variant:`action`,disabled:e.busy,onClick:e.onSync,children:OC(`useRove`)}),e.onLogin&&i&&!r&&(0,H.jsx)(U,{variant:`action`,disabled:e.busy,onClick:e.onLogin,children:OC(`loginThere`)})]}),a&&(0,H.jsx)(`div`,{className:`pb-3`,children:(0,H.jsx)(PC,{login:a,onCancel:e.onCancel})})]})}function IC({model:e}){let{machines:t,probes:n,refreshing:r,refresh:i,probe:a,act:o}=EC(e),[s,c]=(0,h.useState)(null),[l,u]=(0,h.useState)(!1),d=n[``],f=d?.status?.account??null,p=TC(d?.status),m=async(e,t)=>{c(e);try{await t()}finally{c(null)}},g=e=>m(e,async()=>{await o(`github.login`,e===``?{}:{machine:e}),await a(e)}),_=e=>m(e,async()=>{await o(`github.login`,e===``?{cancel:!0}:{machine:e,cancel:!0}),await a(e)}),v=e=>m(e,async()=>{(await o(`github.sync`,{machine:e}))?.ok&&L(OC(`synced`,{machine:e,login:f??``})),await a(e)}),y=()=>m(``,async()=>{(await o(`github.logout`,{}))?.ok&&u(!1),await i()});return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Sx,{children:(0,H.jsxs)(`div`,{children:[(0,H.jsx)(Cx,{label:(0,H.jsxs)(`span`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(MC,{}),(0,H.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,H.jsx)(`span`,{children:`GitHub`}),(0,H.jsx)(`span`,{className:wb,children:OC(`githubDescription`)})]})]}),children:f?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`span`,{className:Tb,children:[`@`,f]}),(0,H.jsx)(U,{variant:`action`,disabled:s!==null,onClick:()=>u(!0),children:OC(`disconnect`)})]}):d?!p&&(0,H.jsx)(U,{variant:`filled`,disabled:s!==null,onClick:()=>void g(``),children:OC(`connect`)}):(0,H.jsx)(`span`,{className:`text-meta text-muted`,children:OC(`loading`)})}),l&&(0,H.jsx)(`div`,{className:`pb-3`,children:(0,H.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,H.jsx)(`p`,{children:OC(`disconnectBody`)}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2.5`,children:[(0,H.jsx)(U,{onClick:()=>u(!1),children:B(`dialog.cancel`)}),(0,H.jsx)(U,{variant:`danger`,disabled:s!==null,onClick:()=>void y(),children:OC(`disconnect`)})]})]})}),!f&&d?.status?.login&&(0,H.jsx)(`div`,{className:`pb-3`,children:(0,H.jsx)(PC,{login:d.status.login,onCancel:()=>void _(``)})})]})}),(f||!d)&&(0,H.jsxs)(Sx,{title:OC(`machines`),hint:OC(`machinesHint`),children:[(0,H.jsx)(FC,{name:OC(`thisMachine`),probe:d,machine:null,rove:f,busy:s!==null,onCancel:()=>void _(``)}),t.map(e=>(0,H.jsx)(FC,{name:e.alias,probe:n[e.alias],machine:e.state,rove:f,busy:s!==null,onSync:()=>void v(e.alias),onLogin:()=>void g(e.alias),onCancel:()=>void _(e.alias)},e.alias)),(0,H.jsx)(`div`,{className:`py-2.5`,children:(0,H.jsx)(U,{variant:`action`,disabled:r,onClick:()=>void i(),children:OC(r?`refreshing`:`refresh`)})})]})]})}function LC({model:e}){return(0,H.jsx)(IC,{model:e})}var RC=[{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 zC({client:e}){let{prefs:t}=wp(),[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`),L(Q(`restart.done`)),r(null)}catch(e){L(G(e),`error`)}finally{a(!1)}}},s=(e,t,a,s,c)=>(0,H.jsxs)(`div`,{children:[(0,H.jsx)(Cx,{label:t,hint:a,children:(0,H.jsx)(U,{variant:`action`,onClick:()=>r(e),children:s})}),n===e&&(0,H.jsx)(`div`,{className:`pb-3`,children:(0,H.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,H.jsx)(`strong`,{children:Q(`${e}.title`)}),(0,H.jsx)(`p`,{children:B(e===`reset`?`prefs.resetBody`:`prefs.restartBody`)}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2.5`,children:[(0,H.jsx)(U,{onClick:()=>r(null),children:B(`dialog.cancel`)}),(0,H.jsx)(U,{variant:c?`danger`:`filled`,disabled:i,onClick:()=>void o(),children:s})]})]})})]});return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Sx,{title:Q(`dev.experimental`),children:RC.map(n=>(0,H.jsx)(wx,{label:Q(n.label),hint:Q(n.hint),checked:t[n.key],onChange:t=>void Sp(e,n.key,t)},n.key))}),(0,H.jsxs)(Sx,{hint:Q(`dev.doctorHint`),children:[s(`restart`,Q(`dev.restart`),B(`prefs.restartHint`),B(`prefs.restartButton`),!1),s(`reset`,Q(`dev.reset`),B(`prefs.resetHint`),B(`prefs.resetButton`),!0)]})]})}function BC(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 VC=v([]),HC=3e4;function UC(e){return e.request(`skill.missing`).then(e=>VC.set(e.engines),()=>{})}function WC(e){(0,h.useEffect)(()=>{let t=e.onOpen(()=>void UC(e)),n=K(HC,()=>void UC(e));return()=>{t(),n()}},[e])}function GC(e){return e.request(`skill.install`).then(e=>{e.error&&L(Q(`engines.skill.failed`,{reason:e.error}),`error`)}).catch(e=>L(G(e),`error`)).then(()=>UC(e))}function KC(e){return BC({binaryFound:e.binaryFound,login:e.login,hooks:e.hooks,configIssue:e.configIssue,commandChosen:e.custom||e.customized})}var qC={ready:`ready`,attention:`attention`,error:`error`,absent:`absent`,unknown:`absent`};function JC({client:e}){let[t,n]=(0,h.useState)(()=>X(e,`engines.settings`)?.engines??null),[r,i]=(0,h.useState)(null),a=(0,h.useCallback)(()=>Ku(e,`engines.settings`).then(e=>n(e.engines),e=>L(G(e),`error`)),[e]);(0,h.useEffect)(()=>{a()},[a]);let o=(t,n={})=>void e.request(t,n).then(a).catch(e=>L(G(e),`error`));return t?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`p`,{className:_b,children:Q(`engines.hint`)}),(0,H.jsxs)(`div`,{className:Fb,children:[(0,H.jsxs)(`div`,{className:Ib,"aria-hidden":`true`,children:[(0,H.jsx)(`span`,{}),(0,H.jsx)(`span`,{children:Q(`engines.defaultMark`)}),(0,H.jsx)(`span`,{children:Q(`engines.available`)})]}),t.map(e=>(0,H.jsx)(YC,{engine:e,open:r===e.id,onToggleOpen:()=>i(r===e.id?null:e.id),run:o},e.id))]})]}),(0,H.jsx)(QC,{engines:t,run:o}),(0,H.jsx)($C,{engines:t,client:e,reload:a})]}):(0,H.jsx)(`p`,{className:Eb,children:B(`preview.loading`)})}function YC(e){let{engine:t,run:n}=e,r=(0,h.useId)(),i=KC(t),a=t.binaryFound===!1;return(0,H.jsxs)(`div`,{className:Lb,children:[(0,H.jsxs)(`div`,{className:Rb,children:[(0,H.jsxs)(`button`,{type:`button`,className:zb,"aria-expanded":e.open,"aria-controls":r,onClick:e.onToggleOpen,children:[(0,H.jsx)(ps,{right:!e.open,className:Bb(e.open)}),(0,H.jsxs)(`span`,{className:Vb,children:[(0,H.jsxs)(`span`,{className:Hb(!t.enabled),children:[t.name,t.renamedFrom?(0,H.jsx)(`span`,{className:Ub,children:t.renamedFrom}):null,t.custom&&!t.renamedFrom?(0,H.jsx)(`span`,{className:Ub,children:Q(`engines.customTag`)}):null]}),(0,H.jsxs)(`span`,{className:Gb(qC[i.tone]),children:[(0,H.jsx)(`span`,{className:Kb(qC[i.tone]),"aria-hidden":`true`}),Q(i.key.slice(9))]})]})]}),(0,H.jsx)(`div`,{className:qb,children:t.isDefault?(0,H.jsx)(`span`,{className:Jb,children:Q(`engines.defaultMark`)}):t.canBeDefault&&!a?(0,H.jsx)(`button`,{type:`button`,className:Yb,"aria-label":B(`settings.engines.default`,{name:t.name}),onClick:()=>n(`engine.setDefault`,{id:t.id}),children:Q(`engines.makeDefault`)}):null}),a?(0,H.jsx)(`span`,{}):(0,H.jsx)(xx,{on:t.enabled,"aria-label":B(`settings.engines.enabled`,{name:t.name}),onClick:()=>n(`engine.setEnabled`,{id:t.id,enabled:!t.enabled})})]}),e.open?(0,H.jsx)(ZC,{id:r,engine:t,run:n}):null]})}function XC(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 ZC(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=[XC(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,H.jsxs)(`div`,{id:e.id,className:Xb,children:[(0,H.jsxs)(`dl`,{className:Zb,children:[(0,H.jsx)(`dt`,{className:Qb,children:Q(`engines.detail.program`)}),(0,H.jsx)(`dd`,{className:$b(t.binaryFound===!1),children:a}),(0,H.jsx)(`dt`,{className:Qb,children:Q(`engines.detail.signIn`)}),(0,H.jsx)(`dd`,{className:$b(t.login===`no`),children:o}),(0,H.jsx)(`dt`,{className:Qb,children:Q(`engines.detail.reporting`)}),(0,H.jsx)(`dd`,{className:$b(!1),children:s.map(e=>(0,H.jsx)(`span`,{className:`block`,children:e},e))}),t.skill===`unsupported`?null:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{className:Qb,children:Q(`engines.detail.skill`)}),(0,H.jsx)(`dd`,{className:$b(t.skill!==`installed`),children:Q(t.skill===`installed`?`engines.detail.skillInstalledHere`:t.skill===`outdated`?`engines.detail.skillOutdated`:`engines.detail.skillMissing`)})]}),t.custom?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{className:Qb,children:Q(`engines.detail.adapter`)}),(0,H.jsx)(`dd`,{className:$b(!1),children:t.protocol?Q(`engines.detail.adapterDeclared`,{protocol:t.protocol}):Q(`engines.detail.adapterGeneric`)})]}):null]}),r===null?(0,H.jsxs)(`div`,{className:ex,children:[(0,H.jsx)(U,{variant:`action`,onClick:()=>i(t.name),children:B(`settings.engines.rename`)}),t.custom||t.customized?(0,H.jsx)(U,{variant:`action`,onClick:()=>n(`engine.reset`,{id:t.id}),children:t.custom?B(`settings.engines.remove`):B(`settings.engines.reset`)}):null]}):(0,H.jsxs)(`form`,{className:ex,onSubmit:e=>{e.preventDefault(),n(`engine.rename`,{id:t.id,name:r}),i(null)},children:[(0,H.jsx)(`input`,{className:`${jr} w-full ${tx}`,autoFocus:!0,value:r,"aria-label":B(`settings.engines.rename`),placeholder:B(`settings.engines.namePlaceholder`),onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),i(null))}}),(0,H.jsx)(U,{variant:`filled`,type:`submit`,children:B(`settings.engines.save`)}),(0,H.jsx)(U,{variant:`action`,onClick:()=>i(null),children:B(`settings.engines.cancel`)})]})]})}function QC({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,H.jsx)(Sx,{title:Q(`engines.integrations.title`),hint:Q(`engines.integrations.hint`),children:(0,H.jsx)(Cx,{label:Q(`engines.integrations.summary`,{installed:i,total:r.length}),children:(0,H.jsxs)(`div`,{className:Mb,children:[a>0?(0,H.jsx)(U,{variant:`filled`,onClick:()=>t(`engines.hooks.install`),children:Q(`engines.integrations.install`,{count:a})}):(0,H.jsx)(`span`,{className:nx,children:Q(`engines.integrations.upToDate`)}),o>0?(0,H.jsx)(U,{variant:`action`,onClick:()=>t(`engines.hooks.uninstall`),children:Q(`engines.integrations.remove`,{count:o})}):null]})})})}function $C(e){let t=e.engines.filter(e=>e.skill!==`unsupported`),n=t.filter(e=>e.skill===`installed`).length,r=t.length-n;return(0,H.jsx)(Sx,{title:Q(`engines.skill.title`),hint:Q(`engines.skill.hint`),children:(0,H.jsx)(Cx,{label:t.length>0?Q(`engines.integrations.summary`,{installed:n,total:t.length}):Q(`engines.skill.noEngines`),children:r>0?(0,H.jsx)(U,{variant:`filled`,onClick:()=>void GC(e.client).then(e.reload),children:Q(`engines.skill.install`,{count:r})}):t.length>0?(0,H.jsx)(`span`,{className:nx,children:Q(`engines.integrations.upToDate`)}):null})})}var ew={bug:`settings.feedback.kindBug`,idea:`settings.feedback.kindIdea`,question:`settings.feedback.kindQuestion`};function tw({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,H.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=>L(G(e),`error`)).finally(()=>c(!1)))},children:[(0,H.jsx)(`p`,{className:`m-0 ${wb}`,children:B(`settings.feedback.hint`)}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,H.jsx)(`div`,{className:Mb,children:(0,H.jsx)(U,{variant:`action`,type:`button`,onClick:()=>{f(!1),fy(e).catch(()=>f(!0))},children:B(`settings.feedback.report`)})}),(0,H.jsx)(`p`,{className:`m-0 ${wb}`,children:B(d?`settings.feedback.reportFailed`:`settings.feedback.reportNote`)})]}),(0,H.jsxs)(`label`,{className:kb,children:[(0,H.jsx)(`span`,{className:Ab,children:B(`settings.feedback.kindLabel`)}),(0,H.jsx)(`select`,{className:`${Db} w-full`,value:t,onChange:e=>n(e.target.value),children:Object.keys(ew).map(e=>(0,H.jsx)(`option`,{value:e,children:B(ew[e])},e))})]}),(0,H.jsxs)(`label`,{className:kb,children:[(0,H.jsx)(`span`,{className:Ab,children:B(`settings.feedback.titleLabel`)}),(0,H.jsx)(`input`,{className:`${Db} w-full`,value:r,onChange:e=>i(e.target.value)})]}),(0,H.jsxs)(`label`,{className:kb,children:[(0,H.jsx)(`span`,{className:Ab,children:B(`settings.feedback.body`)}),(0,H.jsx)(`textarea`,{className:`${Db} ${jb} w-full`,rows:6,value:a,onChange:e=>o(e.target.value)})]}),l&&(0,H.jsxs)(`p`,{className:`m-0 text-meta text-muted [&_a]:text-accent break-words`,children:[l.filed?B(`settings.feedback.sent`,{number:l.number??0}):B(`settings.feedback.notFiled`,{hint:l.hint??``}),` `,(0,H.jsx)(`a`,{className:`underline`,href:l.url,target:`_blank`,rel:`noreferrer`,children:l.filed?l.url:B(`settings.feedback.openLink`)})]}),(0,H.jsx)(`div`,{className:Mb,children:(0,H.jsx)(U,{variant:`filled`,type:`submit`,disabled:s||!r.trim()||!a.trim(),children:B(`settings.feedback.send`)})})]})}var nw=[{value:`en`,label:`English`},{value:`zh`,label:`中文`}],rw={default:`general.worktreeKindDefault`,nextToProject:`general.worktreeKindNext`,custom:`general.worktreeKindCustom`};function iw({model:e}){let{client:t}=e,n=wp(),{prefs:r,info:i}=n,a=(e,n)=>void Sp(t,e,n),o=[`default`,`nextToProject`];(i.worktreeCustomPath||r.worktreeBase===`custom`)&&o.push(`custom`);let s=o.map(e=>({value:e,label:Q(rw[e])}));return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(Sx,{title:B(`settings.general.groupInterface`),children:[(0,H.jsx)(Ex,{label:Q(`general.language`),hint:B(`prefs.languageHint`),value:r.locale,picks:nw,onPick:e=>a(`locale`,e)}),(0,H.jsx)(wx,{label:Q(`general.keyHintsShow`),hint:Q(`general.keyHintsHint`),checked:r.keyHints,onChange:e=>a(`keyHints`,e)}),(0,H.jsx)(wx,{label:Q(`general.zenDefaultOn`),hint:B(`prefs.zenHint`),checked:r.zen,onChange:e=>a(`zen`,e)}),(0,H.jsx)(Ex,{label:B(`settings.general.tabStrip`),value:r.tabStrip,picks:Tp(n,`tabStrip`).map(e=>({value:e,label:Q(`general.tabStripMode.${e}`)})),onPick:e=>a(`tabStrip`,e)})]}),(0,H.jsx)(Sx,{title:B(`settings.general.groupFiles`),children:(0,H.jsx)(Ex,{label:Q(`general.worktree`),hint:Q(`general.worktreeHint`),value:r.worktreeBase,picks:s,onPick:e=>a(`worktreeBase`,e)})}),(0,H.jsx)(Sx,{title:B(`settings.general.groupTerminal`),hint:Q(`general.terminalHint`),children:(0,H.jsx)(aw,{client:t})})]})}function aw({client:e}){let t=wp(),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,H.jsx)(Cx,{label:B(`settings.general.scrollback`),hint:Q(`general.scrollbackRowHint`),children:(0,H.jsx)(`input`,{className:Ob,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)):Sp(e,`scrollbackRows`,o)},onKeyDown:e=>e.key===`Enter`&&e.currentTarget.blur()})})}var ow=`prefix.key`;function sw(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 cw(){return el(Xc().filter(e=>e.keys.length>0||e.prefixKeys!==void 0)).flatMap(e=>[...e.rows])}[...Array.from({length:12},(e,t)=>`f${t+1}`)];function lw(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 uw={"sidebar.goto":lw(`top (double-tap)`,`bottom`),"sidebar.nav":lw(`down`,`up`),"files.nav":lw(`down`,`up`),"diff.review.cursor":lw(`down`,`up`),"sidebar.search.nav":lw(`down`,`up`),"files.hierarchy":lw(`collapse`,`expand`),"files.tab":lw(`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 dw(e){return uw[e]?.slots??[]}var fw=`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`,pw={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`},mw=`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 hw(e){return(0,H.jsxs)(`span`,{className:It(fw,pw[e.tone??`idle`]),children:[(0,H.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,H.jsx)(`button`,{type:`button`,"aria-label":e.removeLabel,className:It(mw,!e.removeShown&&`opacity-0`),onClick:e.onRemove,children:`×`})]})}var gw=new Set([`app.quit`,`view.redraw`]),_w=el(cw().filter(e=>!gw.has(e.id)));function vw(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 ma(e)}catch(e){L(G(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`?[]:da.get().prefix.firstStrokes,i=sw(t,qc(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,dw(e).length),got:[],prefixArmed:!1})},save:(e,t)=>void o(e,t)}}function yw(e,t){if(e.prefixArmed)return Q(`keybindings.recordingPrefix`,{prefix:t});let n=dw(e.id)[e.got.length];return n?Q(`keybindings.recordingSlot`,{slot:n}):Q(`keybindings.recording`)}function bw(e){let{editor:t,id:n}=e,r=()=>t.record(n),i=B(`keys.recordFor`,{name:e.name});if(t.recording?.id===n)return(0,H.jsx)(hw,{tone:`active`,label:i,onPress:r,children:yw(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,H.jsx)(hw,{tone:`empty`,label:i,onPress:r,children:Q(`keybindings.unbound`)}):(0,H.jsxs)(H.Fragment,{children:[e.direct.length>0&&(0,H.jsx)(hw,{tone:a,label:i,onPress:r,onRemove:()=>t.save(n,{direct:[]}),removeLabel:B(`keys.removeFor`,{name:e.name}),removeShown:o,children:e.direct.join(` / `)}),s.length>0&&(0,H.jsx)(hw,{tone:a,label:i,onPress:r,onRemove:()=>t.save(n,{prefix:[]}),removeLabel:B(`keys.removeFor`,{name:e.name}),removeShown:o,children:s.map(t=>`${e.prefixName} ${t}`).join(` / `)})]})}function xw(e,t,n,r){let i=e.notice?.id===t?e.notice.lines:[];return i.length>0?(0,H.jsx)(`span`,{className:`text-warning`,children:i.join(` `)}):n===null?r:(0,H.jsxs)(`span`,{className:`inline-flex flex-wrap items-baseline gap-x-2`,children:[Q(`keybindings.defaultKeys`,{keys:n}),(0,H.jsx)(U,{hit:`tight`,onClick:()=>e.save(t,{direct:`default`,prefix:`default`}),children:B(`keys.reset`)})]})}function Sw({editor:e,keys:t}){let n=t.prefix.key??Q(`keybindings.prefixDisabled`),r=(e,t=[])=>[...e,...t.map(e=>`${n} ${e}`)].join(` / `);return(0,H.jsx)(H.Fragment,{children:_w.map(i=>(0,H.jsx)(Sx,{title:wl(i.category),children:i.rows.map(i=>{let a=t.rows.find(e=>e.id===i.id),o=Sl(i.id);return(0,H.jsx)(Cx,{label:o,hint:xw(e,i.id,a?r(i.keys,i.prefixKeys):null),children:(0,H.jsx)(bw,{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 Cw({model:e}){let{client:t}=e,{prefs:n}=wp(),r=y(da),[i,a]=(0,h.useState)(!1);(0,h.useEffect)(()=>void ma(t),[t]);let o=r.prefix.key??Q(`keybindings.prefixDisabled`),s=vw(t),c=ua.prefix.firstStrokes,l=r.prefix.firstStrokes.join()!==c.join();return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(Sx,{hint:B(`keys.editHint`),children:[(0,H.jsx)(Ex,{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 Sp(t,`prefixTap`,e)}),(0,H.jsx)(Cx,{label:Q(`keybindings.prefixTitle`,{prefix:o}),hint:xw(s,ow,l?c.join(` / `):null,Q(`keybindings.prefixHint`,{prefix:o,timeout:r.prefix.timeoutMs})),children:(0,H.jsx)(bw,{editor:s,id:ow,name:Q(`keybindings.prefixKey`),direct:r.prefix.firstStrokes,prefixName:o,changed:l})})]}),r.warnings.length>0&&(0,H.jsx)(Sx,{title:Q(`keybindings.warnings`),children:r.warnings.map(e=>(0,H.jsx)(Cx,{label:(0,H.jsx)(`span`,{className:`text-warning`,children:e})},e))}),(0,H.jsx)(Sw,{editor:s,keys:r}),r.plugins.length>0&&(0,H.jsx)(Sx,{title:B(`keys.pluginChords`),children:r.plugins.map(e=>(0,H.jsx)(Cx,{label:(0,H.jsx)(`span`,{className:`font-mono`,children:e.chord}),hint:(0,H.jsx)(`span`,{className:`font-mono`,children:`${e.kind}:${e.target}`})},e.chord))}),(0,H.jsx)(Sx,{title:Q(`keybindings.configFile`),hint:B(`prefs.keysYaml`),children:(0,H.jsx)(Cx,{label:(0,H.jsx)(`span`,{className:`font-mono break-all`,children:r.path+(r.exists?``:Q(`keybindings.notCreated`))}),hint:B(i?`keys.agentFailed`:`keys.agentHint`),children:(0,H.jsx)(U,{variant:`action`,onClick:()=>{a(!1),dy(e,B(`keys.agentPrompt`,{path:r.path})).catch(()=>a(!0))},children:B(`keys.agent`)})})})]})}var ww=`/assets/pulse-3XJkP4CJ.wav`;function Tw(e,t){return e===`error`||t}function Ew(e,t,n=!1){return n?e.kind===`error`:t||e.kind!==`done`||e.turnEnd!==!0}function Dw(e,t,n=!1){return t&&e.silent!==!0&&!n}function Ow(e){return e===`permission_needed`?`needs_input`:e===`error`||e===`rate_limited`||e===`dead`?`error`:e===`turn_complete`?`done`:null}function kw(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 Aw(){return window.isSecureContext&&`serviceWorker`in navigator&&`PushManager`in window&&`Notification`in window}var jw=()=>navigator.serviceWorker.register(`sw.js`);async function Mw(e){if(!Aw())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 Nw(e){if(!Aw())return`unsupported`;if(await Notification.requestPermission()!==`granted`)return`blocked`;let t=await jw();await navigator.serviceWorker.ready;let{publicKey:n}=await e.request(`push.key`),r=await t.pushManager.getSubscription();return r?.options.applicationServerKey&&zw(r.options.applicationServerKey)!==n&&(await r.unsubscribe(),r=null),r??=await t.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:Rw(n)}),await e.request(`push.subscribe`,{subscription:r.toJSON()}),`on`}async function Pw(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 Fw(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(),Iw?.(e),o.close()}}var Iw=null;function Lw(e){Iw=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=()=>{Iw=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 Rw(e){let t=atob(e.replace(/-/g,`+`).replace(/_/g,`/`));return Uint8Array.from(t,e=>e.charCodeAt(0))}function zw(e){return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}var Bw={done:`✓`,needs_input:`?`,error:`✕`};function Vw(e){let t=new Audio(ww);t.volume=Math.min(1,Math.max(0,e)),t.play().catch(()=>void 0)}function Hw(e,t,n){!document.hidden||typeof Notification>`u`||Notification.permission!==`granted`||Fw(e,t,n,Bw[t]).catch(()=>void 0)}function Uw(){typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission()}function Ww(e){let t=new Map;for(let n of e.tasks)n.activity&&t.set(n.id,n.activity.state);return t}function Gw(e){let t=(0,h.useRef)(null);(0,h.useEffect)(()=>{let n=()=>{let n=e.tasks.get();if(!n)return;let r=Ww(n),i=kw(t.current,r,null,Ow);t.current=r;let{prefs:a}=_p.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:t,kind:n}of i){if(t===o||!Ew({kind:n,turnEnd:!0},a.finishedAlerts))continue;let r=s.get(t)??t;Tw(n,a.toast)&&L(`${Bw[n]} ${r}`,n===`error`?`error`:`info`,{label:B(`workspace.openTask`),run:()=>e.select(t)}),Dw({},a.sound)&&(Vw(a.soundVolume),Hw(t,n,r))}};return n(),e.tasks.subscribe(n)},[e])}function Kw({client:e}){let[t,n]=(0,h.useState)(null),[r,i]=(0,h.useState)(null);(0,h.useEffect)(()=>{Mw(e).then(n,()=>n(`off`))},[e]);let a=t=>{i(null),(t?Nw(e):Pw(e)).then(n,e=>i(e instanceof Error?e.message:String(e)))},o=r?B(`prefs.pushFailed`,{error:r}):B(t===`unsupported`?`prefs.pushUnsupported`:t===`blocked`?`prefs.pushBlocked`:`prefs.pushHint`);return(0,H.jsx)(wx,{label:B(`prefs.push`),hint:o,checked:t===`on`,disabled:t===null||t===`unsupported`||t===`blocked`,onChange:a})}function qw({model:e}){let{client:t}=e,n=wp(),{prefs:r}=n,i=(e,n)=>void Sp(t,e,n);return(0,H.jsxs)(Sx,{children:[(0,H.jsx)(wx,{label:Q(`general.toast`),hint:B(`settings.notifications.toastNote`),checked:r.toast,onChange:e=>i(`toast`,e)}),(0,H.jsx)(wx,{label:Q(`general.sound`),hint:B(`prefs.soundHint`),checked:r.sound,onChange:e=>{e&&Uw(),i(`sound`,e)}}),(0,H.jsx)(Ex,{label:B(`settings.notifications.volume`),hint:B(`prefs.soundVolumeHint`),value:r.soundVolume,picks:Tp(n,`soundVolume`).map(e=>({value:e,label:`${Math.round(e*100)}%`})),onPick:e=>{_p.get().prefs.sound&&Vw(e),i(`soundVolume`,e)}}),(0,H.jsx)(wx,{label:Q(`general.crossTask`),hint:Q(`general.crossTaskHint`),checked:r.crossTask,onChange:e=>i(`crossTask`,e)}),(0,H.jsx)(wx,{label:Q(`general.finishedAlerts`),hint:Q(`general.finishedAlertsHint`),checked:r.finishedAlerts,onChange:e=>i(`finishedAlerts`,e)}),(0,H.jsx)(Kw,{client:t})]})}var Jw={kanban:`kanban`,issues:`issues`};function Yw({model:e}){let t=y(e.installedMods),[n,r]=(0,h.useState)(()=>X(e,`builtinMods.list`)?.mods??null);if((0,h.useEffect)(()=>{Ku(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&&O.get()===Jw[n.id]&&O.set(null),e.refreshMods())).catch(e=>L(G(e),`error`))};return(0,H.jsx)(Sx,{title:B(`settings.plugins.builtIn`),hint:B(`settings.plugins.builtInHint`),children:n.map(e=>(0,H.jsx)(Cx,{label:e.name,hint:e.description,inline:!0,children:(0,H.jsx)(xx,{on:t.has(e.id),"aria-label":B(`settings.plugins.turnOn`,{name:e.name}),onClick:()=>i(e)})},e.id))})}function Xw({model:e}){let{client:t}=e,[n,r]=(0,h.useState)(()=>X(t,`plugins.list`)?.plugins??null),i=(0,h.useCallback)(()=>Ku(t,`plugins.list`).then(e=>r(e.plugins),e=>L(G(e),`error`)),[t]);return(0,h.useEffect)(()=>{i()},[i]),(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Yw,{model:e}),(0,H.jsx)(Sx,{title:B(`settings.plugins.registered`),children:n?n.length===0?(0,H.jsx)(`p`,{className:Eb,children:B(`settings.plugins.empty`)}):n.map(e=>(0,H.jsx)(Cx,{label:e.id,hint:[e.version,e.linked?B(`settings.plugins.linked`):null,e.platformOk===!1?B(`settings.plugins.unsupportedPlatform`):null].filter(Boolean).join(`, `),inline:!0,children:(0,H.jsx)(xx,{on:e.enabled,"aria-label":e.id,onClick:()=>void t.request(`plugin.setEnabled`,{id:e.id,enabled:!e.enabled}).then(i).catch(e=>L(G(e),`error`))})},e.id)):(0,H.jsx)(`p`,{className:Eb,children:B(`preview.loading`)})})]})}function Zw(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,H.jsxs)(`form`,{className:cx,onSubmit:n=>{n.preventDefault(),e.onSave(t,s?.takesModel?r.trim():``,a)},onKeyDown:t=>{t.key===`Escape`&&(t.stopPropagation(),e.onCancel())},children:[(0,H.jsx)(eb,{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,H.jsx)(eb,{label:B(`prefs.tierEffort`),value:a,picks:[``,...s.effortLevels].map(e=>({value:e,label:e||Q(`autoRouting.engineDefault`)})),onPick:o}),s?.takesModel&&(0,H.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":B(`prefs.tierModel`),onChange:e=>i(e.target.value)}),(0,H.jsxs)(`div`,{className:Mb,children:[(0,H.jsx)(U,{onClick:e.onCancel,children:B(`dialog.cancel`)}),(0,H.jsx)(U,{variant:`filled`,type:`submit`,children:Q(`action.save`)})]})]})}function Qw({client:e}){let[t,n]=(0,h.useState)(()=>X(e,`autoRouting.get`)??null),[r,i]=(0,h.useState)(null),a=(0,h.useCallback)(()=>Ku(e,`autoRouting.get`).then(n,e=>L(G(e),`error`)),[e]);(0,h.useEffect)(()=>{a()},[a]);let o=(t,n)=>e.request(t,n).then(a).catch(e=>L(G(e),`error`));if(!t)return(0,H.jsx)(`p`,{className:Eb,children:B(`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,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(Sx,{hint:Q(`autoRouting.hint`),children:[!t.configured&&(0,H.jsx)(Cx,{label:(0,H.jsx)(`span`,{className:`text-warning`,children:Q(`autoRouting.unconfigured`)})}),t.tiers.map(e=>(0,H.jsxs)(`div`,{className:ox,children:[(0,H.jsxs)(`div`,{className:sx,children:[(0,H.jsx)(`span`,{className:Cb,children:$y(`tier.${e.tier}`)}),(0,H.jsx)(`span`,{className:`${wb} min-w-0 truncate`,children:[e.engineName,e.model??Q(`autoRouting.engineDefault`),e.effort??Q(`autoRouting.engineDefault`)].join(` · `)}),(0,H.jsx)(U,{className:`ml-auto`,onClick:()=>i(r===e.tier?null:e.tier),children:B(`prefs.tierEdit`)})]}),(0,H.jsx)(`span`,{className:wb,children:$y(`tierDesc.${e.tier}`)}),(0,H.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,H.jsx)(Zw,{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,H.jsxs)(Sx,{title:Q(`autoRouting.classifierTitle`),hint:Q(`autoRouting.classifierHint`),children:[(0,H.jsx)(Cx,{label:(0,H.jsx)(`span`,{className:s.mode===`off`?`text-muted`:`text-warning`,children:Q(`autoRouting.classifierDataFlow`)})}),(0,H.jsx)(Ex,{label:Q(`autoRouting.classifierLabel`),hint:l.replace(/^[—\s]+/,``),value:s.mode,picks:c,onPick:e=>void o(`autoRouting.setClassifier`,{mode:e})})]}),(0,H.jsxs)(Sx,{title:B(`prefs.classifierConnection`),hint:B(`prefs.editInTui`),children:[(0,H.jsx)(Dx,{label:Q(`autoRouting.endpointLabel`),value:s.endpointHost||B(`prefs.unset`)}),(0,H.jsx)(Dx,{label:Q(`autoRouting.thresholdLabel`),value:s.threshold.toFixed(2)}),(0,H.jsx)(Cx,{label:Q(`autoRouting.keyLabel`),hint:u})]})]})}var $w=[{id:`preferences`,sections:[`general`,`appearance`,`notifications`,`snippets`,`keys`]},{id:`agents`,sections:[`engines`,`autoRouting`,`voice`,`connectors`,`plugins`]},{id:`more`,sections:[`about`,`feedback`,`dev`]}],eT=e=>({section:e??`general`,drilled:e!==void 0});function tT(e,t){return t&&e.drilled?`list`:`close`}var nT=e=>e.split(`
54
+ `,1)[0]??``;function rT(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=p_.test(t)&&r.trim()!==``;return(0,H.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:n=>{n.preventDefault(),s&&(o(!0),d_(e.client,{name:t,text:r}).then(e.onDone).catch(e=>{L(G(e),`error`),o(!1)}))},children:[(0,H.jsxs)(`label`,{className:kb,children:[(0,H.jsx)(`span`,{className:Ab,children:B(`snippets.name`)}),(0,H.jsx)(`input`,{className:`${Db} w-full font-mono`,value:t,maxLength:32,spellCheck:!1,autoComplete:`off`,autoFocus:!e.editing,readOnly:e.editing!==void 0,placeholder:B(`snippets.namePlaceholder`),onChange:e=>n(e.target.value)}),t!==``&&!p_.test(t)&&(0,H.jsx)(`span`,{className:`text-meta text-muted [&_a]:text-accent`,children:B(`snippets.badName`)})]}),(0,H.jsxs)(`label`,{className:kb,children:[(0,H.jsx)(`span`,{className:Ab,children:B(`snippets.text`)}),(0,H.jsx)(`textarea`,{className:`${Db} ${jb} w-full`,rows:5,value:r,maxLength:8e3,placeholder:B(`snippets.textPlaceholder`),onChange:e=>i(e.target.value)})]}),(0,H.jsxs)(`div`,{className:Mb,children:[(0,H.jsx)(U,{onClick:e.onDone,children:B(`snippets.cancel`)}),(0,H.jsx)(U,{type:`submit`,disabled:a||!s,children:B(`snippets.save`)})]})]})}function iT({model:e}){let{client:t}=e,n=l_(),[r,i]=(0,h.useState)(null);return(0,h.useEffect)(()=>void u_(t).catch(()=>void 0),[t]),(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,H.jsxs)(Sx,{children:[n.length===0&&r===null&&(0,H.jsx)(Cx,{label:B(`snippets.empty`)}),n.map(e=>(0,H.jsxs)(Cx,{label:(0,H.jsxs)(`span`,{className:`font-mono`,children:[`@`,e.name]}),hint:nT(e.text),children:[(0,H.jsx)(U,{onClick:()=>i(e),children:B(`snippets.edit`)}),(0,H.jsx)(U,{onClick:()=>void f_(t,e.name).then(()=>{i(null),L(B(`snippets.removed`,{name:e.name}))}).catch(e=>L(G(e),`error`)),children:B(`snippets.remove`)})]},e.name))]}),r===null?(0,H.jsx)(`div`,{className:Mb,children:(0,H.jsx)(U,{onClick:()=>i(`new`),children:B(`snippets.add`)})}):(0,H.jsx)(rT,{client:t,editing:r===`new`?void 0:r,onDone:()=>i(null)},r===`new`?`new`:r.name)]})}var aT=e=>e>=95?`crit`:e>=75?`warn`:`ok`,oT=e=>String(e).padStart(2,`0`);function sT(e,t){if(e==null||e<=t)return``;let n=new Date(e),r=`${oT(n.getHours())}:${oT(n.getMinutes())}`;return e-t<864e5?`→ ${r}`:`→ ${n.getMonth()+1}/${n.getDate()} ${r}`}function cT(e,t){let n=e.windows.find(e=>e.kind===`session`)??e.windows[0];return n?{label:n.label,percentText:`${n.percent}%`,resetText:sT(n.resetsAt,t),tone:aT(n.percent)}:null}var lT=1e4;function uT({client:e,inset:t=!0}){let n=y(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=K(lT,r);return()=>{t=!1,a()}},[e,n.state]);let a=Date.now(),o=(r??[]).flatMap(e=>{let t=cT({capturedAt:e.capturedAt,windows:e.windows},a);return t?[{vendor:e.vendor,name:e.name,chip:t}]:[]});return o.length===0?null:(0,H.jsx)(`div`,{className:`${zn} ${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,H.jsxs)(U,{variant:`row`,className:Bn,title:`${t} · ${n.label} ${n.percentText} ${n.resetText}`.trim(),"aria-label":`${B(`usage.open`)}: ${t}`,onClick:()=>{z(),he(`usage`)},children:[(0,H.jsx)(`span`,{className:`truncate`,children:t}),(0,H.jsx)(`span`,{className:Un(n.tone),style:{"--fill":`${r}%`}}),(0,H.jsxs)(`span`,{children:[n.label,` `,(0,H.jsx)(`span`,{className:Vn[n.tone],children:n.percentText})]})]},e)})})}var dT=2e3;function fT(e){let[t,n]=(0,h.useState)(null),[r,i]=(0,h.useState)(null),a=(0,h.useCallback)(t=>{n(t),hv(e,t.available)},[e]),o=(0,h.useCallback)(()=>e.request(`voice.status`).then(a,e=>i(G(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(),dT);return()=>window.clearInterval(e)},[s,o]),{status:t,error:r,setError:i,accept:a}}function pT(e){let[t,n]=(0,h.useState)(!1);return t?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:Tb,children:e.ask}),(0,H.jsx)(U,{variant:`action`,disabled:e.disabled,onClick:()=>{n(!1),e.onConfirm()},children:e.label}),(0,H.jsx)(U,{variant:`action`,onClick:()=>n(!1),children:B(`voice.setup.cancel`)})]}):(0,H.jsx)(U,{variant:`action`,disabled:e.disabled,onClick:()=>n(!0),children:e.label})}function mT({client:e}){let{status:t,error:n,setError:r,accept:i}=fT(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(G(e))).finally(()=>o(!1)));if(!t)return(0,H.jsx)(`p`,{className:Eb,children:n??`…`});if(!s)return(0,H.jsx)(`p`,{className:Eb,children:t.model??B(`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`?B(`voice.setup.offHint`):c?B(`voice.setup.cloudNeeded`):b===`local`&&!s.localInstalled?B(y?`voice.setup.localInstalling`:`voice.setup.localNeeded`):t.ready?B(`voice.setup.ready`,{model:t.model??``}):t.error??B(`voice.setup.starting`),C=y?v.line??B(`voice.setup.installing`):v.phase===`failed`&&!s.localInstalled?B(`voice.setup.failed`,{line:v.line??``}):s.localInstalled?B(`voice.setup.installed`):s.blocked??B(`voice.setup.localHint`);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Sx,{children:(0,H.jsx)(Ex,{label:B(`voice.setup.dictation`),hint:S,value:b,picks:[`off`,`local`,`cloud`].map(e=>({value:e,label:B(`voice.setup.backend.${e}`)})),onPick:x})}),(b===`local`||s.localInstalled||y)&&(0,H.jsx)(Sx,{title:B(`voice.setup.backend.local`),children:(0,H.jsx)(Cx,{label:B(`voice.setup.localTitle`),hint:C,children:y?(0,H.jsx)(`span`,{className:`max-w-90 min-w-0 truncate font-mono text-meta text-muted [overflow-wrap:anywhere]`,children:B(`voice.setup.installing`)}):s.localInstalled?(0,H.jsx)(pT,{label:B(`voice.setup.uninstall`),ask:B(`voice.setup.uninstallAsk`),disabled:a,onConfirm:()=>void _(`voice.uninstall`)}):!s.blocked&&(0,H.jsx)(U,{variant:`action`,disabled:a,onClick:()=>void _(`voice.install`),children:B(`voice.setup.install`)})})}),(b===`cloud`||s.cloud)&&(0,H.jsx)(Sx,{title:B(`voice.setup.cloudTitle`),hint:B(`voice.setup.cloudHint`),children:(0,H.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,H.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(`span`,{className:`text-meta font-medium text-muted`,children:B(`voice.setup.baseURL`)}),(0,H.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,H.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(`span`,{className:`text-meta font-medium text-muted`,children:B(`voice.setup.model`)}),(0,H.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,H.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(`span`,{className:`text-meta font-medium text-muted`,children:B(`voice.setup.apiKey`)}),(0,H.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?B(`voice.setup.keySaved`):``,autoComplete:`off`,onChange:e=>g(e.target.value)})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2.5`,children:[s.cloud&&(0,H.jsx)(pT,{label:B(`voice.setup.forget`),ask:B(`voice.setup.forgetAsk`),disabled:a,onConfirm:()=>{d(``),p(``),_(`voice.forgetCloud`)}}),(0,H.jsx)(U,{variant:`action`,type:`submit`,disabled:a||!u.trim()||!f.trim()||!(m||s.cloud?.hasKey),children:B(s.backend===`cloud`?`voice.setup.save`:`voice.setup.saveAndUse`)})]})]})}),n&&(0,H.jsx)(`p`,{className:`m-0 py-3 text-body text-muted text-error`,children:n})]})}var hT={general:e=>(0,H.jsx)(iw,{model:e}),appearance:e=>(0,H.jsx)(xC,{model:e}),notifications:e=>(0,H.jsx)(qw,{model:e}),snippets:e=>(0,H.jsx)(iT,{model:e}),keys:e=>(0,H.jsx)(Cw,{model:e}),engines:e=>(0,H.jsx)(JC,{client:e.client}),autoRouting:e=>(0,H.jsx)(Qw,{client:e.client}),voice:e=>(0,H.jsx)(mT,{client:e.client}),connectors:e=>(0,H.jsx)(LC,{model:e}),plugins:e=>(0,H.jsx)(Xw,{model:e}),about:e=>(0,H.jsx)(PS,{client:e.client}),feedback:e=>(0,H.jsx)(tw,{model:e}),dev:e=>(0,H.jsx)(zC,{client:e.client})},gT={general:`sections.general`,engines:`sections.engines`,autoRouting:`sections.autoRouting`,plugins:`sections.plugins`,keys:`sections.keys`,feedback:`sections.feedback`,dev:`sections.dev`},_T=e=>{let t=gT[e];return t?Q(t):B(`settings.sections.${e}`)};function vT(e){return(0,H.jsxs)(`nav`,{className:sb,"aria-label":B(`settings.title`),children:[(0,H.jsx)(`h1`,{className:cb,children:B(`settings.title`)}),$w.map(t=>(0,H.jsxs)(`div`,{className:lb,children:[(0,H.jsx)(`p`,{className:ub,children:B(`settings.groups.${t.id}`)}),t.sections.map(n=>(0,H.jsxs)(U,{variant:`row`,className:db(!e.narrow&&e.current===n,t.id===`more`),"aria-current":!e.narrow&&e.current===n?`page`:void 0,onClick:()=>e.onPick(n),children:[_T(n),(0,H.jsx)(ps,{right:!0,className:fb})]},n))]},t.id))]})}function yT({model:e,section:t}){V();let[n,r]=(0,h.useState)(()=>eT(t)),i=Se(),a=()=>tT(n,i)===`list`?r({...n,drilled:!1}):z();(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=y(Oe)===`panel`&&i&&n.drilled,s=!i||!n.drilled||o,c=!i||n.drilled;return(0,H.jsx)(`div`,{className:nb,onMouseDown:e=>e.target===e.currentTarget&&z(),children:(0,H.jsxs)(`dialog`,{ref:i&&!n.drilled?ke(z):void 0,tabIndex:-1,open:!0,className:rb,"aria-label":B(`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:[i?s&&(0,H.jsx)(U,{variant:`row`,className:ab(!0),onClick:z,children:`‹ ${fe.get()===`sidebar`?Tl(`narrowBack`):B(`dialog.close`)}`}):(0,H.jsx)(U,{variant:`row`,className:ib,"aria-label":B(`dialog.close`),title:B(`dialog.close`),onClick:z,children:`×`}),s&&(0,H.jsx)(vT,{current:n.section,narrow:i,onPick:e=>r({section:e,drilled:!0})}),i&&s&&(0,H.jsx)(uT,{client:e.client,inset:!1}),c&&(0,H.jsxs)(`div`,{ref:i?ke(a):void 0,className:ob(o),children:[i&&(0,H.jsx)(U,{variant:`row`,className:ab(!1),onClick:a,children:`‹ ${B(`settings.title`)}`}),(0,H.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto scrollbar-none`,children:(0,H.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,H.jsxs)(`header`,{className:`flex flex-col gap-1 pr-8 w-narrow:pr-0`,children:[(0,H.jsx)(`h1`,{className:`m-0 font-sans text-display font-semibold normal-nums text-ink`,children:_T(n.section)}),(0,H.jsx)(`p`,{className:`m-0 text-body text-muted`,children:B(`settings.pages.${n.section}`)})]}),(0,H.jsx)(`div`,{className:`flex flex-col gap-7 w-narrow:gap-6`,children:hT[n.section](e)})]})},n.section)]})]})})}var bT=e=>{let{taskId:t}=e.selection.get();return e.tasks.get()?.tasks.find(e=>e.id===t)??null},xT=e=>{let{taskId:t,tabId:n}=e.selection.get(),r=t?e.tabs.get()[t]?.find(e=>e.id===n):void 0;return!!r&&!Gd(r.split)},ST=[{id:`app.refresh`,live:()=>Ta.get().stale,run:e=>ka(e.client)},{id:`palette.open`,live:()=>!0,run:Ly},{id:`task.new.global`,live:()=>!0,run:e=>bv(bT(e)?.repo)},{id:`chat.tab.fork`,live:e=>!!bT(e),run:e=>{let t=bT(e);t&&C.set((0,H.jsx)(ud,{model:e,taskId:t.id,context:`continue`}))}},{id:`chat.fork.new`,live:e=>!!bT(e),run:e=>{let t=bT(e);t&&C.set((0,H.jsx)(ud,{model:e,taskId:t.id,destination:`fork`}))}},{id:`settings.open`,live:()=>!0,run:e=>C.set((0,H.jsx)(yT,{model:e}))},{id:`inbox.show`,live:()=>!0,run:e=>C.set((0,H.jsx)(pp,{model:e}))},{id:`focus.previous`,live:()=>!0,run:()=>xo(-1)},{id:`focus.next`,live:()=>!0,run:()=>xo(1)},{id:`workspace.zenToggle`,live:e=>!!bT(e),run:()=>N.set(!N.get())},{id:`files.createPR`,live:e=>!!bT(e),run:e=>{let t=bT(e);t&&e.client.request(`tab.requestPR`,e.engineTarget(t.id)).then(()=>L(B(`files.prRequested`))).catch(e=>L(e instanceof Error?e.message:String(e),`error`))}},{id:`chat.tab.close`,live:e=>!!e.selection.get().tabId&&xT(e),run:e=>{let{taskId:t,tabId:n}=e.selection.get();!t||!n||e.closeTab(t,n).catch(e=>L(e instanceof Error?e.message:String(e),`error`))}},{id:`kanban.open`,live:e=>e.installedMods.get().has(`kanban`),run:()=>he(`kanban`)},{id:`automations.open`,live:()=>!0,run:()=>he(`routines`)},{id:`workItems.open`,live:e=>e.installedMods.get().has(`issues`),run:()=>he(`issues`)},{id:`task.moveMode`,live:e=>!!Vy(e),run:()=>{Rp(!Lp.get()),document.querySelector(`.rail`)?.focus()}},{id:`files.syncBase`,live:e=>Vy(e)?.kind===`task`,run:e=>{let t=Vy(e);t&&wy(e,t.id)}},{id:`files.fixChecks`,live:e=>!!Vy(e),run:e=>{let t=Vy(e);t&&Ey(e,t.id,B(`taskops.fixSent`))}},{id:`task.openEditor`,live:e=>!!Vy(e),run:e=>{let t=Vy(e);t&&Dy(e,t.id)}}];Co(()=>ST.map(e=>({id:e.id,chords:xa(e.id),prefix:!0,live:e.live,run:e.run})));function CT(e){return Jc(e[0]??``)}function wT(e,t){let n=Oo(),r=To().filter(t=>t.prefix&&Eo(t,n)&&t.live?.(e)!==!1);for(let e of t){let t=r.filter(t=>t.chords.includes(e)).sort((e,t)=>Do(e,n)-Do(t,n))[0];if(t)return t}}var TT=null,ET=null;function DT(){TT=null,ET!==null&&window.clearTimeout(ET),ET=null;let e=bf.get();e.guide?.kind===`prefix`&&bf.set({...e,guide:null})}function OT(){if(TT!==null){DT();return}C.get()||ga()===null||(TT=Date.now(),bf.set({...bf.get(),guide:{kind:`prefix`,armedAt:TT}}),ET!==null&&window.clearTimeout(ET),ET=window.setTimeout(DT,da.get().prefix.timeoutMs))}function kT(e,t){DT();let n=typeof t==`string`?[t]:t,r=wT(e,n);Sf(CT(n),r?.id??null),r?.run(e)}var AT=null;function jT(){AT!==null&&window.clearTimeout(AT),AT=null;let e=bf.get();e.guide?.kind===`direct`&&bf.set({...e,guide:null})}function MT(){AT!==null||C.get()||(AT=window.setTimeout(()=>{DT(),bf.set({...bf.get(),guide:{kind:`direct`}})},400))}function NT(e){(0,h.useEffect)(()=>{let t=t=>{if(t.key===`Control`){t.repeat||MT();return}if(jT(),[`Shift`,`Alt`,`Meta`].includes(t.key))return;let n=qc(t),{firstStrokes:r,timeoutMs:i}=da.get().prefix;if(TT!==null&&Date.now()-TT<=i){if(t.preventDefault(),t.stopImmediatePropagation(),t.key===`Escape`)return DT();kT(e,n);return}DT();let a=document.activeElement,o=Lo(a instanceof HTMLElement?a:null)===`field`;!C.get()&&!o&&n.some(e=>r.includes(e))&&(t.preventDefault(),t.stopImmediatePropagation(),OT())},n=e=>e.key===`Control`&&jT(),r=e=>{TT!==null&&(e.target instanceof Element&&e.target.closest(`.prefix-guide, .shortcut-badge, [data-prefix-arm]`)||DT())};return window.addEventListener(`keydown`,t,{capture:!0}),window.addEventListener(`keyup`,n,{capture:!0}),window.addEventListener(`pointerdown`,r,{capture:!0}),window.addEventListener(`blur`,jT),()=>{window.removeEventListener(`keydown`,t,{capture:!0}),window.removeEventListener(`keyup`,n,{capture:!0}),window.removeEventListener(`pointerdown`,r,{capture:!0}),window.removeEventListener(`blur`,jT),jT(),DT()}},[e])}function PT(e){let t=Oo(),n=new Map;for(let r of To()){if(!r.prefix||!Eo(r,t)||r.live?.(e)===!1)continue;let i=Do(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 FT(e){let t=new Map(aa.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=cl(e);r.set(n,[...r.get(n)??[],{action:e,strokes:t}])}return[...r].map(([e,t])=>({category:e,actions:t}))}var IT=e=>e===`prefix.moreCommands`?yl(`moreCommandsPrefix`):Cl(e);function LT(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 RT({model:e}){V();let t=y(bf);y(da),y(e.selection);let n=Date.now(),r=t.entries.filter(e=>n-e.at<yf),i=t.guide?.kind===`prefix`?t.guide.armedAt:null,a=i!==null&&n-i<vf?i+vf:null;LT(a??(r[0]?r[0].at+yf: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?gf(ko(e,Oo()),ga()):PT(e);return(0,H.jsxs)(`output`,{className:`mono ${an}`,onMouseDown:e=>e.preventDefault(),children:[(0,H.jsxs)(`div`,{className:sn,children:[(0,H.jsx)(`span`,{className:`text-accent`,children:n?yl(`directLayer`):yl(`commandLayer`,{prefix:ga()??``})}),(0,H.jsx)(`span`,{className:`keys-only text-muted`,children:yl(n?`releaseCtrl`:`escCancel`)})]}),(0,H.jsx)(`div`,{className:cn,children:FT(r).map(t=>(0,H.jsxs)(`div`,{className:ln,children:[(0,H.jsx)(`div`,{className:`text-accent`,children:wl(t.category)}),t.actions.map(({action:t,strokes:r})=>(0,H.jsxs)(`button`,{type:`button`,className:un,disabled:n,onClick:()=>r[0]&&kT(e,r[0]),children:[(0,H.jsx)(`span`,{className:on,children:r.map(Jc).join(`/`)}),(0,H.jsx)(`span`,{children:IT(t)})]},t))]},t.category))})]})}return(0,H.jsxs)(`output`,{className:Cn,children:[r.map(e=>(0,H.jsxs)(zT,{at:e.at,children:[(0,H.jsx)(`span`,{className:`text-accent`,children:ga()}),` + `,e.stroke,` →`,` `,e.action?IT(e.action):(0,H.jsx)(`span`,{className:`text-muted`,children:`∅`})]},e.id)),i!==null&&(0,H.jsxs)(`div`,{className:wn(!1),children:[(0,H.jsx)(`span`,{className:`text-accent`,children:ga()}),` ⋯`]})]})}function zT({at:e,children:t}){let[n]=(0,h.useState)(Date.now),r=n-e>140,i={"--hud-out":`${e+yf-140-n}ms`};return(0,H.jsx)(`div`,{className:wn(r),style:i,children:t})}function BT({model:e,bindingId:t,head:n=!1}){let r=y(bf);y(da);let i=wp().prefs.prefixTap;if(r.guide?.kind!==`prefix`||i!==`local`)return null;let a=hf({bindingId:t,reachability:ko(e,Oo()),prefixKey:ga()});if(!a)return null;let o=To().find(e=>e.id===t&&e.prefix)?.chords[0];return(0,H.jsx)(`button`,{type:`button`,className:`mono ${Xt(n)}`,onMouseDown:e=>e.preventDefault(),onClick:t=>{t.stopPropagation(),o&&kT(e,o)},children:a})}var VT=[`workingBorder`,`runningTitle`,`taskColors`,`colorblind`];function HT(e){let{client:t}=e,n=wp(),r=gC(),i=y(aC);_C(e),Gw(e),(0,h.useEffect)(()=>{let e=()=>{xp(t).catch(()=>void 0),u_(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]:JS(n.themes,n.prefs.theme,r),a=t?nC(t,n.prefs):{};for(let[t,n]of Object.entries(a))e.style.setProperty(t,n);e.style.colorScheme=r;for(let t of VT)e.dataset[t]=String(n.prefs[t]);iC.set(t?rC(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&&N.get()!==n.prefs.zen&&N.set(n.prefs.zen)},[n.loaded,n.prefs.zen]),(0,h.useEffect)(()=>N.subscribe(()=>{N.get()!==_p.get().prefs.zen&&Sp(t,`zen`,N.get())}),[t])}var UT={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 WT(e,t){return UT[e].flatMap(e=>{if(t===`always`&&e.always!==!0)return[];let n=nl(e.id);return n?[{cap:n,msg:e.msg}]:[]})}var GT=e=>`rove.web.hintUsed.${e}`,KT=v({sidebar:localStorage.getItem(GT(`sidebar`))===`1`});function qT(e){KT.get()[e]||(localStorage.setItem(GT(e),`1`),KT.set({...KT.get(),[e]:!0}))}function JT(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 YT={entries:[],at:-1};function XT(e,t){let n=e.entries[e.at];if(n&&JT(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 ZT(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 QT=v(YT);function $T(e){let t=O.get();if(t)return{kind:`page`,id:t};let n=F.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 eE(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 tE=!1;function nE(e){let t=!1,n=()=>{t||(t=!0,queueMicrotask(()=>{if(t=!1,tE)return;let n=$T(e);n&&QT.set(XT(QT.get(),n))}))};n();let r=[e.selection.subscribe(n),O.subscribe(n),F.subscribe(n)];return()=>{for(let e of r)e()}}function rE(e,t){let n=QT.get(),r=ZT(n,t,t=>eE(e,t)),i=n.entries[r];i&&(tE=!0,i.kind===`task`?(O.set(null),F.set(null),e.select(i.taskId,i.tabId)):i.kind===`page`?(F.set(null),he(i.id)):(O.set(null),F.set(i.start)),QT.set({entries:n.entries,at:r}),queueMicrotask(()=>{tE=!1}))}function iE(e,t){return e.filter(e=>e.groupId===t).sort((e,t)=>(e.createdAt??``).localeCompare(t.createdAt??``)||e.title.localeCompare(t.title))}var aE=400;function oE(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(`
55
55
  `).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(`
56
- `);return r?r.length>sE?`${r.slice(0,sE).trimEnd()}…`:r:null}function lE(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 uE(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&&L(B(`compare.archived`,{count:i})),e instanceof Uo&&e.code===`TASK_BUSY`)throw e;L(B(`compare.archiveFailed`,{error:G(e)}),`error`);return}L(B(`compare.archived`,{count:i}))}async function dE(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){L(B(`compare.keepFailed`,{error:G(e)}),`error`);return}L(B(`compare.keptToast`,{title:t.label}));let r=n.filter(e=>e.id!==t.id).map(e=>e.id);r.length!==0&&C.set((0,H.jsx)(Ti,{title:B(`compare.archiveTitle`),body:B(`compare.archiveBody`,{count:r.length}),confirmLabel:B(`compare.archiveConfirm`),onConfirm:()=>uE(e,r,!1),escalate:{when:e=>e instanceof Uo&&e.code===`TASK_BUSY`,label:B(`compare.archiveBusyConfirm`),title:B(`compare.archiveBusyTitle`),body:()=>B(`compare.archiveBusyBody`),run:()=>uE(e,r,!0)}}))}async function fE(e,t){try{await e.act(`task.keep`,{taskId:t.id,kept:!1}),L(B(`compare.unkeptToast`,{title:t.label}))}catch(e){L(B(`compare.keepFailed`,{error:G(e)}),`error`)}}var pE={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: {error}`},mE={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}`},hE={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}`},gE={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}`},_E={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`}},vE={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 yE(){let e=V()===`zh`;return{kanban:e?gE:hE,auto:e?mE:pE,items:e?vE:_E,nav:(e?Gi:Wi).nav,group:(e?Gi:Wi).group,common:e?ki:Oi}}function $(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??e))}function bE(){let{auto:e}=yE();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 xE(e){return e instanceof Error?e.message:String(e)}function SE(e){return e.replace(/^\/private\//,`/`).replace(/\/+$/,``)}function CE(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 wE(...e){let t=new Set,n=[];for(let r of e.flat()){if(!r||r.startsWith(`ssh://`))continue;let e=SE(r);t.has(e)||(t.add(e),n.push(r))}return n}function TE(e){return wE((y(e.tasks)?.tasks??[]).filter(e=>!Ad(e)).map(e=>e.repo))}function EE(e){let t=y(e.tasks),{taskId:n}=y(e.selection);return t?.tasks.find(e=>e.id===n)?.repo}function DE(e){let[t,n]=(0,h.useState)(0);return(0,h.useEffect)(()=>K(e,()=>n(e=>e+1)),[e]),[t,(0,h.useCallback)(()=>n(e=>e+1),[])]}function OE(e){return e instanceof HTMLElement?e.isContentEditable||[`INPUT`,`TEXTAREA`,`SELECT`].includes(e.tagName):!1}function kE(e){let t=(0,h.useRef)(e);t.current=e,(0,h.useEffect)(()=>{let e=e=>{if(e.defaultPrevented||C.get()||S.get())return;let n=e.target instanceof HTMLElement?e.target:null;OE(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 AE(){let e=(0,h.useRef)(null);return(0,h.useEffect)(()=>e.current?.focus(),[]),e}function jE({tone:e,children:t}){return(0,H.jsx)(`span`,{className:It(`flex-none font-mono text-meta`,e&&lp[e]),children:t})}var ME=`mt-3 grid grid-cols-[repeat(auto-fit,minmax(min(100%,17rem),1fr))] items-start gap-x-5 gap-y-6`,NE=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)]`,PE=`flex min-w-0 items-center gap-2`,FE=`min-w-0 truncate font-bold`,IE=`truncate font-mono text-meta text-muted`,LE=`m-0 line-clamp-6 whitespace-pre-wrap wrap-anywhere`,RE=`flex min-w-0 flex-col`,zE=`flex min-w-0 items-baseline gap-2 py-px font-mono text-meta`,BE=`flex flex-wrap gap-x-3.5 gap-y-1 font-mono text-meta`,VE=`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`,HE=6;function UE(e,t){let[n,r]=(0,h.useState)(null),[i,a]=(0,h.useState)(()=>X(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 Ku(e,`output.read`,{taskId:t.id,limit:8}).then(e=>n&&r(cE(e)),()=>n&&r(null)),()=>{n=!1}},[e,t.id,o]),(0,h.useEffect)(()=>{let n=!0;return Ku(e,`diff.files`,{taskId:t.id}).then(e=>n&&a(e),()=>{}),()=>{n=!1}},[e,t.id,s,o]),{reply:n,changes:i?lE(i):null}}function WE({changes:e,onOpen:t}){if(!e)return(0,H.jsx)(`p`,{className:wr,children:`…`});if(e.files.length===0)return(0,H.jsx)(`p`,{className:`m-0 font-mono text-meta text-subtle`,children:B(`compare.noChanges`)});let n=e.files.length-HE;return(0,H.jsxs)(`div`,{className:RE,children:[(0,H.jsxs)(`p`,{className:`m-0 flex gap-2 font-mono text-meta text-muted`,children:[(0,H.jsx)(`span`,{children:B(`compare.files`,{count:e.files.length})}),e.added>0&&(0,H.jsxs)(jE,{tone:`added`,children:[`+`,e.added]}),e.deleted>0&&(0,H.jsxs)(jE,{tone:`removed`,children:[`−`,e.deleted]})]}),e.files.slice(0,HE).map(n=>(0,H.jsxs)(U,{variant:`row`,className:`${zE} text-left [&:hover]:underline`,title:n.path,onClick:()=>t(n.path,e.scope),children:[(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n.path}),n.added?(0,H.jsxs)(jE,{tone:`added`,children:[`+`,n.added]}):null,n.deleted?(0,H.jsxs)(jE,{tone:`removed`,children:[`−`,n.deleted]}):null]},n.path)),n>0&&(0,H.jsx)(`span`,{className:`font-mono text-meta text-subtle`,children:B(`compare.more`,{count:n})})]})}function GE({model:e,row:t,round:n}){let{reply:r,changes:i}=UE(e,t),{look:a}=Th(t.rowStatus),o=t.kept===!0,s=(n,r)=>{e.select(t.id),Lc({taskId:t.id,path:n,scope:r})};return(0,H.jsxs)(`section`,{className:NE(o),"data-attempt":t.id,children:[(0,H.jsxs)(`div`,{className:PE,children:[(0,H.jsx)(Vh,{status:t.rowStatus}),(0,H.jsx)(`span`,{className:FE,children:t.engine?.name??t.label}),(0,H.jsx)(`span`,{className:`flex-none text-meta text-muted`,children:B(`compare.status.${a}`)}),o&&(0,H.jsx)(`span`,{className:`ml-auto flex-none font-mono text-meta text-accent`,children:B(`compare.kept`)})]}),(0,H.jsx)(`span`,{className:IE,title:t.branch,children:t.branch}),r?(0,H.jsx)(`p`,{className:LE,children:r}):(0,H.jsx)(`p`,{className:`m-0 text-muted`,children:B(`compare.noReply`)}),(0,H.jsx)(WE,{changes:i,onOpen:s}),(0,H.jsxs)(`div`,{className:BE,children:[(0,H.jsx)(U,{hit:`tight`,onClick:()=>e.select(t.id),children:B(`compare.terminal`)}),(0,H.jsx)(U,{hit:`tight`,onClick:()=>s(`.`,i?.scope??`working`),children:B(`compare.diff`)}),o?(0,H.jsx)(U,{hit:`tight`,onClick:()=>void fE(e,t),children:B(`compare.unkeep`)}):(0,H.jsx)(U,{hit:`tight`,onClick:()=>void dE(e,t,n),children:B(`compare.keep`)})]})]})}function KE({model:e}){V();let t=y(A),n=y(e.tasks),r=AE(),i=t&&n?oE(n.tasks,t):[];return(0,H.jsxs)(`div`,{className:jx,tabIndex:0,ref:r,onKeyDown:e=>{e.metaKey||e.ctrlKey||e.altKey||e.key!==`q`&&e.key!==`Escape`||(e.preventDefault(),O.set(null))},children:[(0,H.jsx)(`h1`,{className:Mx,children:B(`compare.title`)}),i.length===0?(0,H.jsx)(`p`,{className:`text-muted`,children:B(`compare.empty`)}):(0,H.jsx)(`div`,{className:ME,children:i.map(t=>(0,H.jsx)(GE,{model:e,row:t,round:i},t.id))})]})}function qE(e){let t=Math.floor(e/6e4),n=Math.floor(t/60);return{minutes:t,hours:n,days:Math.floor(n/24)}}function JE(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}=qE(n);return i<60?`${i}m`:a<24?`${a}h`:`${o}d`}var YE=[{id:`issues`,label:`reviewQueue.sourceIssues`},{id:`reviews`,label:`reviewQueue.sourceReviews`}];function XE(){V();let e=y(my);return(0,H.jsx)(`span`,{className:`flex items-baseline gap-3 font-mono text-meta`,children:YE.map(t=>t.id===e?(0,H.jsx)(`span`,{className:`text-ink`,children:B(t.label)},t.id):(0,H.jsx)(U,{onClick:()=>my.set(t.id),children:B(t.label)},t.id))})}var ZE={passing:`reviewQueue.checksPassing`,failing:`reviewQueue.checksFailing`,pending:`reviewQueue.checksPending`},QE={missing:`reviewQueue.gh.missing`,unauthenticated:`reviewQueue.gh.unauthenticated`,failed:`reviewQueue.gh.failed`};function $E(e){let{pr:t}=e,n=Date.parse(t.createdAt),r=[t.isDraft?B(`reviewQueue.draft`):``,t.fork?B(`reviewQueue.fork`):``,t.checks?B(ZE[t.checks]):``];return(0,H.jsxs)(`div`,{"data-row":e.index,className:Rx(e.at),onClick:e.onPick,children:[(0,H.jsxs)(`div`,{className:zx,children:[(0,H.jsxs)(`span`,{className:`mono ${Bx}`,children:[t.nameWithOwner.split(`/`)[1],`#`,t.number]}),(0,H.jsx)(`span`,{className:Hx,children:t.title}),(0,H.jsx)(U,{disabled:e.busy,onClick:e.onReview,children:B(`reviewQueue.start`)})]}),(0,H.jsxs)(`div`,{className:Vx,children:[(0,H.jsx)(`span`,{className:Hx,children:[t.author,...r].filter(Boolean).join(`, `)}),(0,H.jsxs)(`span`,{className:`mono`,children:[`+`,t.additions,` −`,t.deletions]}),(0,H.jsx)(`span`,{className:`mono`,children:Number.isFinite(n)?JE(n,e.now):``})]})]})}function eD({model:e}){V();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=AE(),_=(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(xE(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(B(`reviewQueue.preparing`,{number:e.number}));try{let{ref:n}=await t.request(`review.prepare`,{repo:e.repo,number:e.number});te(hy(e,n,B(`reviewQueue.prompt`,{number:e.number,repo:e.nameWithOwner,title:e.title,url:e.url,head:e.headRef,base:e.baseRef})))}catch(t){L(B(`reviewQueue.failed`,{number:e.number,error:xE(t)}),`error`)}finally{l(null),d(null)}}};kE(e=>{if(e.ctrlKey)return e.key===`c`&&(O.set(null),!0);switch(e.key){case`Escape`:case`q`:return O.set(null),!0;case`j`:case`ArrowDown`:return 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,H.jsxs)(`div`,{className:jx,tabIndex:0,ref:g,children:[(0,H.jsxs)(`div`,{className:Nx,children:[(0,H.jsx)(`h1`,{className:Mx,children:B(`reviewQueue.title`)}),(0,H.jsx)(XE,{})]}),i?(0,H.jsx)(`p`,{className:`text-error`,children:i}):n===null?(0,H.jsx)(`p`,{className:`text-muted`,children:`…`}):n.reason?(0,H.jsx)(`p`,{className:`text-muted`,children:B(QE[n.reason])}):v.length===0?(0,H.jsx)(`p`,{className:`text-muted`,children:B(`reviewQueue.empty`)}):(0,H.jsx)(`div`,{className:Lx,ref:_,children:v.map((e,t)=>(0,H.jsx)($E,{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,H.jsx)(`p`,{className:`text-muted mx-0 mt-2 mb-0 text-meta leading-[inherit]`,children:B(`reviewQueue.other`,{count:n.other})}),u&&(0,H.jsx)(`p`,{className:`text-muted mx-0 mt-2 mb-0 text-meta leading-[inherit]`,children:u})]})}var tD=30;function nD(){let{items:e}=yE();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 rD({model:e}){let{items:t,common:n}=yE(),r=nD(),i=e.client,a=y(e.tasks),o=TE(e),s=EE(e),[c,l]=(0,h.useState)(()=>{let e=s?o.findIndex(e=>SE(e)===SE(s)):-1;return Math.max(0,e)}),u=o[c],d=(e,t)=>({repo:e,limit:tD,...t?{assignee:`@me`}:{}}),f=e=>Object.fromEntries(e.links.map(e=>[e.number,e.taskId])),[p,m]=(0,h.useState)(()=>u?X(i,`workitem.list`,d(u,!1))?.items??null:null),[g,_]=(0,h.useState)(()=>{let e=u?X(i,`workitem.links`,{repo:u}):void 0;return e?f(e):{}}),[v,b]=(0,h.useState)(null),[x,S]=(0,h.useState)(!1),[C,w]=(0,h.useState)(0),[T,E]=(0,h.useState)(0),[D,k]=(0,h.useState)(!1),[A,j]=(0,h.useState)(null),M=AE(),N=(0,h.useRef)(!1);(0,h.useEffect)(()=>{let e=!0;if(!u){m([]);return}b(null);let t=N.current;N.current=!1;let n=d(u,x),r=X(i,`workitem.list`,n);return r&&m(r.items),i.request(`workitem.list`,{...n,...t?{refresh:!0}:{}}).then(t=>e&&m(Gu(i,`workitem.list`,n,t).items)).catch(t=>{e&&(b(xE(t)),m([]))}),Ku(i,`workitem.links`,{repo:u}).then(t=>e&&_(f(t))).catch(()=>e&&_({})),()=>{e=!1}},[i,u,x,C,a?.tasks.length]);let P=p??[],ee=Math.min(T,Math.max(0,P.length-1));(0,h.useEffect)(()=>j(null),[u,x]);let F=(0,h.useRef)(null);(0,h.useEffect)(()=>{F.current?.querySelector(`[data-row="${ee}"]`)?.scrollIntoView({block:`nearest`})},[ee]);let I=e=>a?.tasks.find(t=>t.id===e)?.label??e,te=t=>{O.set(null),e.select(t)},ne=async()=>{let e=P[ee];if(!e||!u||D)return;let n=g[e.number];if(n){j($(t.openingLinked,{title:I(n)})),te(n);return}k(!0),j($(t.starting,{number:e.number}));try{let n=await i.request(`workitem.start`,{repo:u,number:e.number});n.started?te(n.taskId):j($(t.startedNoEngine,{title:n.title}))}catch(n){L($(t.startFailed,{number:e.number,error:xE(n)}),`error`)}finally{k(!1)}};kE(e=>{if(e.ctrlKey)return e.key===`c`&&(O.set(null),!0);switch(e.key){case`Escape`:case`q`:return O.set(null),!0;case`j`:case`ArrowDown`:return E(Math.min(P.length-1,ee+1)),!0;case`k`:case`ArrowUp`:return E(Math.max(0,ee-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 N.current=!0,w(e=>e+1),!0;case`Enter`:return ne(),!0;default:return!1}});let re=Date.now();return(0,H.jsxs)(`div`,{className:jx,tabIndex:0,ref:M,children:[(0,H.jsxs)(`div`,{className:Nx,children:[(0,H.jsx)(`h1`,{className:Mx,children:t.title}),(0,H.jsx)(XE,{}),(0,H.jsxs)(`span`,{className:`mono touch:empty:hidden! text-muted ${Px(!0)}`,children:[u?CE(u,o):t.noRepo,x?` ${t.assignedFilter}`:``]})]}),v?(0,H.jsxs)(`div`,{className:Lx,children:[(0,H.jsx)(`p`,{className:`text-error`,children:v}),(0,H.jsx)(`p`,{className:`text-muted`,children:r(v)})]}):p===null?(0,H.jsx)(`p`,{className:`text-muted`,children:n.loading}):P.length===0?(0,H.jsx)(`p`,{className:`text-muted`,children:t.empty}):(0,H.jsx)(`div`,{className:Lx,ref:F,children:P.map((e,n)=>{let r=g[e.number],i=Date.parse(e.updatedAt);return(0,H.jsxs)(`div`,{"data-row":n,className:Rx(n===ee),onClick:()=>n===ee?void ne():E(n),children:[(0,H.jsxs)(`div`,{className:zx,children:[(0,H.jsxs)(`span`,{className:`mono ${Bx}`,children:[`#`,e.number]}),(0,H.jsx)(`span`,{children:e.title})]}),(0,H.jsxs)(`div`,{className:Vx,children:[(0,H.jsx)(`span`,{className:Hx,children:[e.author,...e.labels.slice(0,2)].filter(Boolean).join(`, `)}),r&&(0,H.jsx)(`span`,{children:$(t.linkedChip,{title:I(r)})}),(0,H.jsx)(`span`,{className:`mono`,children:Number.isFinite(i)?JE(i,re):``})]})]},e.number)})}),A&&(0,H.jsx)(`p`,{className:`text-muted mx-0 mt-2 mb-0 text-meta leading-[inherit]`,children:A})]})}function iD({model:e}){return y(my)===`reviews`?(0,H.jsx)(eD,{model:e}):(0,H.jsx)(rD,{model:e})}var aD={backlog:`active`,in_progress:`active`,in_review:`parked`,error:`parked`,done:`terminal`,canceled:`terminal`,open:`active`,doing:`active`,hold:`parked`};function oD(e){return aD[e]??`parked`}var sD=[`backlog`,`in_progress`,`parked`,`done`];function cD(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 lD(e,t){let n=oD(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 uD(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 dD(e,t){return e.created===t.created?t.id-e.id:e.created<t.created?1:-1}function fD(e,t){let n={backlog:[],in_progress:[],parked:[],done:[]};for(let r of e)n[lD(r,t)].push(r);return sD.map(e=>{let t=e===`done`||e===`parked`,r=n[e].sort(dD);return!t||r.length<=20?{key:e,issues:r,hiddenCount:0}:{key:e,issues:r.slice(0,20),hiddenCount:r.length-20}})}var pD=[`worktree`,`projectWorktree`,`project`];async function mD(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:xE(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:xE(e)})),{taskId:c,tabId:s,warnings:a}}var hD=`text-meta leading-[inherit]`,gD=`text-meta`,_D=`flex flex-col gap-2 overflow-hidden`,vD=`flex min-w-0 items-baseline gap-3`,yD=`font-bold whitespace-nowrap text-accent touch:relative touch:after:absolute touch:after:-inset-x-2 touch:after:-inset-y-1 touch:after:content-['']`,bD=`min-w-0 truncate ${gD}`,xD=`ml-auto ${hD}`,SD=`grid min-h-0 flex-1 grid-cols-4 gap-2`,CD=`flex min-h-0 flex-1 flex-col gap-2`,wD=`flex gap-4 ${gD}`,TD=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`}`,ED={in_progress:`text-accent`,parked:`text-warning`,done:`text-success`},DD=e=>`flex min-h-0 flex-col rounded-md border-hairline border-line p-2 ${e?`flex-1`:``}`,OD=e=>`m-0 mb-2 flex justify-between gap-2 font-mono text-meta font-bold normal-nums ${ED[e]??`text-muted`}`,kD=`flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto`,AD=`m-0 ${gD}`,jD=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`}`,MD=`flex justify-between gap-2`,ND=e=>`min-w-0 font-bold wrap-anywhere ${e?`text-muted`:``}`,PD=`h-[2.8em] overflow-hidden whitespace-pre-wrap wrap-anywhere ${hD}`,FD=`flex justify-between gap-2 ${gD}`,ID=`w-[min(680px,calc(100vw-32px))]!`,LD=`flex items-baseline gap-3.5`,RD=`flex items-baseline gap-2.5`,zD=`tracking-[0] normal-case`,BD=`min-h-40 font-mono`,VD=`flex flex-col items-start gap-0.5`,HD=e=>`text-left font-mono text-meta whitespace-pre-wrap normal-nums ${e?`font-bold text-accent`:`font-normal text-muted`}`,UD=hD,WD=`flex flex-col gap-1 [&_p]:m-0`,GD=`flex gap-2 ${gD}`,KD=`min-w-[4ch] text-right`,qD=`rounded-sm border-hairline border-transparent p-1 focus:border-accent focus:outline-none`,JD={choice:`radiogroup`,list:`listbox`,cells:`group`};function YD(e){return(0,H.jsx)(`div`,{ref:e.fieldRef,role:JD[e.kind??`choice`],tabIndex:0,"aria-label":e.label,className:`${qD} ${e.className??``}`,onKeyDown:e.onKeyDown,onClick:e.onClick,children:e.children})}var XD=[`open`,`doing`,`hold`,`done`];function ZD({model:e,taskId:t}){let{kanban:n}=yE(),[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,H.jsxs)(`div`,{className:WD,children:[(0,H.jsx)(`h2`,{className:`${W} text-muted`,children:n.detail.eventsLabel}),r===null?(0,H.jsx)(`p`,{className:`text-muted`,children:n.detail.eventsLoading}):r.length===0?(0,H.jsx)(`p`,{className:`text-muted`,children:n.detail.eventsNone}):r.map(e=>(0,H.jsxs)(`div`,{className:`mono ${GD}`,children:[(0,H.jsx)(`span`,{className:`text-muted ${KD}`,children:JE(e.at)}),(0,H.jsx)(`span`,{children:e.kind}),e.tail&&(0,H.jsx)(`span`,{className:`text-muted`,children:e.tail})]},`${e.at}:${e.kind}:${e.tail}`))]})}function QD(e){let{kanban:t}=yE(),{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)(pD[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=>{z(),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()})},A=()=>{i&&O()&&D({kind:`create`,title:s.trim(),body:l,start:null})},j=()=>D(i?null:{kind:`close`,...T()}),M=(0,h.useRef)({commit:k,saveOnly:A,close:j});M.current={commit:k,saveOnly:A,close:j},(0,h.useEffect)(()=>{let e=e=>{let t=e.key===`Escape`?M.current.close:e.key===`Enter`&&(e.ctrlKey||e.metaKey)?M.current.commit:e.key.toLowerCase()===`s`&&e.ctrlKey&&!e.metaKey?M.current.saveOnly:null;t&&(e.preventDefault(),e.stopImmediatePropagation(),t())};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},[]);let N=async t=>{let n=t.find(e=>e.size>zl);if(n){L(B(`pages.attachTooLarge`,{name:n.name||n.type}),`error`);return}x(!0);try{let n=await Promise.all(t.map(t=>Kl(e.model.client,t)));u(e=>Ul(e,n))}catch(e){L(G(e),`error`)}finally{x(!1)}},P=e=>{let t=Array.from(e.clipboardData.files);t.length!==0&&(e.preventDefault(),N(t))},ee=e=>{let t=Array.from(e.dataTransfer.files);e.preventDefault(),t.length>0&&N(t)},F=(e,t,n)=>e[(Math.max(0,e.indexOf(t))+n+e.length)%e.length],I=(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()},te=d===`done`?`text-success`:d===`hold`?`text-warning`:d===`doing`?`text-accent`:`text-muted`,ne=e=>t.detail.status[e];return(0,H.jsx)(`div`,{className:Br,onMouseDown:e=>e.target===e.currentTarget&&M.current.close(),children:(0,H.jsxs)(`dialog`,{open:!0,className:`${Vr(!0)} ${ID}`,"aria-label":i?t.detail.newStory:`#${n.id}`,onPaste:P,onDrop:ee,onDragOver:e=>e.preventDefault(),children:[(0,H.jsxs)(`div`,{className:Hr,children:[i?(0,H.jsx)(`h1`,{className:`${W} text-muted`,children:t.detail.newStory}):(0,H.jsxs)(`h1`,{className:`${W} text-muted ${LD}`,children:[(0,H.jsxs)(`span`,{children:[`#`,n.id]}),(0,H.jsx)(`span`,{className:te,children:ne(d)}),(0,H.jsx)(`span`,{className:`text-muted`,children:$(t.detail.created,{date:n.created})}),a&&(0,H.jsx)(`span`,{className:`text-accent`,children:t.detail.linked})]}),(0,H.jsx)(`button`,{type:`button`,className:Wr,"aria-label":B(`dialog.close`),title:B(`dialog.close`),onClick:()=>M.current.close(),children:`×`})]}),(0,H.jsxs)(`div`,{className:Gr,children:[(0,H.jsxs)(`label`,{className:Fr,children:[(0,H.jsx)(`span`,{className:`${W} text-muted`,children:t.detail.titleLabel}),(0,H.jsx)(`input`,{ref:C(`title`),className:Mr,spellCheck:!1,value:s,onChange:e=>c(e.target.value.replace(/[\r\n]+/g,` `)),onKeyDown:e=>{e.key===`Enter`&&!e.ctrlKey&&!e.metaKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),S.current.description?.focus())}})]}),(0,H.jsxs)(`label`,{className:Fr,children:[(0,H.jsxs)(`span`,{className:`${W} text-muted ${RD}`,children:[t.detail.description,(0,H.jsx)(`span`,{className:`text-muted ${zD}`,children:lu()?B(`pages.attachHintTouch`):t.detail.attachHint}),b&&(0,H.jsx)(`span`,{className:`text-accent`,children:`…`})]}),(0,H.jsx)(`textarea`,{ref:C(`description`),className:`${Mr} ${Ir} ${BD}`,rows:8,spellCheck:!1,placeholder:t.detail.noDescription,value:l,onChange:e=>u(e.target.value)})]}),!i&&(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.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,H.jsx)(`span`,{className:`keys-only text-muted tracking-[0] normal-case`,children:`←/→`})]}),(0,H.jsx)(YD,{fieldRef:C(`status`),label:t.detail.statusLabel,className:`flex flex-wrap gap-1.5`,onKeyDown:I(`x`,e=>f(F(XD,d,e))),children:XD.map(e=>(0,H.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-pressed":e===d,className:Rr(e===d),onClick:()=>{f(e),S.current.status?.focus()},children:ne(e)},e))})]}),o?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:Fr,children:[(0,H.jsxs)(`span`,{className:`${W} text-muted ${RD}`,children:[t.detail.engine,(0,H.jsx)(`span`,{className:`keys-only text-muted ${zD}`,children:`←/→`})]}),(0,H.jsx)(YD,{fieldRef:C(`engine`),label:t.detail.engine,className:Lr,onKeyDown:I(`x`,t=>m(F(e.engines.map(e=>e.id),p,t)),k),children:e.engines.map(e=>(0,H.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-pressed":e.id===p,className:Rr(e.id===p),onClick:()=>{m(e.id),S.current.engine?.focus()},children:e.name},e.id))})]}),(0,H.jsxs)(`div`,{className:Fr,children:[(0,H.jsxs)(`span`,{className:`${W} text-muted ${RD}`,children:[t.detail.workspace,(0,H.jsx)(`span`,{className:`keys-only text-muted ${zD}`,children:`↑/↓`})]}),(0,H.jsx)(YD,{fieldRef:C(`workspace`),label:t.detail.workspace,className:VD,onKeyDown:I(`y`,e=>_(F(pD,g,e)),k),children:pD.map(e=>(0,H.jsxs)(`button`,{type:`button`,tabIndex:-1,"aria-pressed":e===g,className:`touch:py-1.5 ${HD(e===g)}`,onClick:()=>{_(e),S.current.workspace?.focus()},children:[e===g?`▸ `:` `,t.detail.placement[e]]},e))})]}),(0,H.jsxs)(`div`,{className:Fr,children:[(0,H.jsxs)(`span`,{className:`${W} text-muted ${RD}`,children:[t.detail.jumpLabel,(0,H.jsx)(`span`,{className:`keys-only text-muted ${zD}`,children:`←/→`})]}),(0,H.jsx)(YD,{fieldRef:C(`jump`),label:t.detail.jumpLabel,className:Lr,onKeyDown:I(`x`,()=>y(!v),k),children:[!1,!0].map(e=>(0,H.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-pressed":e===v,className:Rr(e===v),onClick:()=>{y(e),S.current.jump?.focus()},children:e?t.detail.jump.follow:t.detail.jump.stay},String(e)))})]}),(0,H.jsx)(`p`,{className:`touch:empty:hidden! text-muted ${UD}`,children:(0,H.jsx)(cp,{text:fu(i?t.detail.createLegend:t.detail.startLegend)})}),(0,H.jsxs)(`div`,{className:Nr,children:[i&&(0,H.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:A,children:B(`pages.storySave`)}),(0,H.jsx)(`button`,{type:`button`,className:xr(),onClick:k,children:B(i?`pages.storySaveStart`:`pages.storyStart`)})]})]}):a?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:Fr,children:[(0,H.jsx)(`span`,{className:`${W} text-muted`,children:t.detail.sessionLabel}),(0,H.jsxs)(`div`,{className:`${Lr} ${qD}`,children:[(0,H.jsx)(`button`,{ref:C(`open`),type:`button`,className:Rr(!0),onClick:()=>D({kind:`open`,taskId:a,...T()}),children:t.detail.openAction}),(0,H.jsx)(`button`,{ref:C(`unlink`),type:`button`,className:Rr(),onClick:()=>D({kind:`unlink`,...T()}),children:t.detail.unlinkAction})]})]}),(0,H.jsx)(ZD,{model:e.model,taskId:a}),(0,H.jsx)(`p`,{className:`touch:empty:hidden! text-muted ${UD}`,children:(0,H.jsx)(cp,{text:fu(t.detail.openLegend)})})]}):(0,H.jsx)(`p`,{className:`touch:empty:hidden! text-muted ${UD}`,children:(0,H.jsx)(cp,{text:fu(t.detail.doneNote)})})]})]})})}var $D={"waiting-on-you":`text-error`,landing:`text-success`,"ready-for-review":`text-ink`,working:`text-accent`};function eO(e){let[t,n]=(0,h.useState)(()=>{let t=X(e,`engines.list`);return t?Eu(t.engines):[]});return(0,h.useEffect)(()=>e.client.onOpen(()=>{Ku(e,`engines.list`).then(e=>n(Eu(e.engines))).catch(()=>{})}),[e]),{engines:t,defaultEngine:Du(t)}}function tO(e,t){let n=TE(e),r=n.join(`
57
- `),[i,a]=(0,h.useState)(()=>X(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])=>wE(e,n,t)).then(e=>Promise.all(e.map(e=>r.request(`issue.list`,{repo:e}).catch(t=>({repoRoot:e,nextId:1,issues:[],readError:xE(t)}))))).then(n=>{let r=Gu(e,`kanban.boards`,void 0,[...n].sort((e,t)=>e.repoRoot.localeCompare(t.repoRoot)));t&&a(r)}),()=>{t=!1}},[e,t,r]),i}function nO(e){let{issue:t}=e,n=t.body.trim();return(0,H.jsxs)(`div`,{"data-issue":t.id,className:jD({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,H.jsxs)(`div`,{className:MD,children:[(0,H.jsx)(`span`,{className:ND(e.column===`done`),children:t.title}),(0,H.jsxs)(`span`,{className:`mono text-muted`,children:[`#`,t.id]})]}),(0,H.jsx)(`div`,{className:`text-muted ${PD}`,children:n}),(0,H.jsxs)(`div`,{className:`mono text-muted ${FD}`,children:[(0,H.jsx)(`span`,{children:t.created}),e.badge&&(0,H.jsx)(`span`,{className:e.badge.tone,children:e.badge.label})]})]})}var rO=5e3,iO=760;function aO({model:e}){let{kanban:t,group:n,common:r}=yE(),[i,a]=DE(rO),o=tO(e,i),{engines:s,defaultEngine:c}=eO(e),l=y(e.tasks),u=EE(e),[d,f]=(0,h.useState)(null),[p,m]=(0,h.useState)(null),g=AE(),[_,v]=(0,h.useState)(!1);(0,h.useEffect)(()=>{let e=g.current;if(!e)return;let t=new ResizeObserver(()=>v(e.clientWidth<iO));return t.observe(e),()=>t.disconnect()},[g]);let b=o??[],x=u?b.find(e=>e.repoRoot.replace(/^\/private\//,`/`)===u.replace(/^\/private\//,`/`)):void 0,w=Math.max(0,b.findIndex(e=>e.repoRoot===(d??x?.repoRoot))),T=b[w],E=b.map(e=>e.repoRoot),D=b.filter(e=>e.readError).map(e=>`${e.repoRoot}\0${e.readError}`).join(`
58
- `);(0,h.useEffect)(()=>{for(let e of b)e.readError&&L($(t.readFailedToast,{repo:CE(e.repoRoot,E),error:e.readError}),`error`)},[D]);let k=l?.tasks??[],A=new Set(k.map(e=>e.id)),j=e=>k.find(t=>t.id===e)?.group,{columns:M,attentionCount:N}=uD(T?fD(T.issues,A.size===0?void 0:e=>A.has(e)):[],e=>j(e)===`waiting-on-you`),P={backlog:t.column.backlog,in_progress:t.column.inProgress,parked:t.column.parked,done:t.column.done},ee=(e,t)=>{let r=e.taskId&&(t===`in_progress`||t===`parked`)?j(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:$D[r]??`text-muted`}:null},F=async(t,n,r,i)=>{try{return await e.client.request(t,{repo:T?.repoRoot,...n})}catch(e){return L($(r,{id:String(i),error:xE(e)}),`error`),null}finally{a()}},I=(e,n)=>F(`issue.setStatus`,{id:e.id,status:n},t.statusFailed,e.id),te=t=>{O.set(null),e.select(t)},ne=async(n,r,i)=>{try{let a=await mD(e.client,{repo:n,issue:r,engine:i.engine,placement:i.placement});for(let e of a.warnings)L($(e.kind===`link`?t.linkFailed:t.statusFailed,{id:String(r.id),error:e.error}),`error`);i.jump?(O.set(null),e.selectWhenListed(a.taskId),a.tabId&&await e.refreshTabsNow(a.taskId).then(()=>e.select(a.taskId,a.tabId))):L($(t.detail.startedBackground,{title:`#${r.id} ${r.title}`}))}catch(e){L(G(e),`error`)}finally{a()}},re=async(e,n)=>{if(!T||n.kind===`create`)return;let r={};n.title!==e.title&&(r.title=n.title),n.body!==e.body&&(r.body=n.body),(r.title!==void 0||r.body!==void 0)&&await F(`issue.update`,{id:e.id,...r},t.updateFailed,e.id),n.status!==e.status&&await I(e,n.status),n.kind===`open`?te(n.taskId):n.kind===`unlink`?await F(`issue.update`,{id:e.id,task:`none`},t.unlinkFailed,e.id):n.kind===`start`&&await ne(T.repoRoot,{...e,...r},n)},ie=t=>{T&&(m(t.id),C.set((0,H.jsx)(QD,{model:e,issue:t,mode:`detail`,engines:s,defaultEngine:c,onOutcome:e=>void re(t,e)})))},ae=()=>{if(!T)return;let n=T.repoRoot,r={id:T.nextId,title:``,status:`open`,created:new Date().toISOString().slice(0,10),body:``};C.set((0,H.jsx)(QD,{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 ne(n,o,i.start)}catch(e){L($(t.createFailed,{error:xE(e)}),`error`)}})()}}))},oe=()=>{let n=T?.issues.find(e=>e.id===p);if(!T||!n)return;let i=T.repoRoot;C.set((0,H.jsx)(Ti,{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){L($(t.deleteFailed,{id:String(n.id),error:xE(e)}),`error`)}finally{a()}}}))},R=e=>{b.length!==0&&(f(b[(w+e+b.length)%b.length]?.repoRoot??null),m(null))},z=e=>{let t=cD(M,p,e);t!=null&&m(t)},se=e=>M.some(e=>e.issues.length>0)?z(e):R(e===`left`?-1:1);kE(e=>{if(e.ctrlKey)return e.key===`c`&&(O.set(null),!0);switch(e.key){case`Escape`:case`q`:return O.set(null),!0;case`r`:return a(),!0;case`Tab`:return R(e.shiftKey?-1:1),!0;case`ArrowUp`:return z(`up`),!0;case`ArrowDown`:return z(`down`),!0;case`ArrowRight`:case`l`:return se(`right`),!0;case`ArrowLeft`:case`h`:return se(`left`),!0;case`Enter`:{let e=T?.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 ce=(0,h.useRef)(null);(0,h.useEffect)(()=>{ce.current?.querySelector(`[data-issue="${p}"]`)?.scrollIntoView({block:`nearest`})},[p]);let le=(e,n,r)=>{m(e.id),S.set({x:n,y:r,items:XD.filter(t=>t!==e.status).map(n=>({label:$(t.menu.setStatus,{status:t.detail.status[n]}),run:()=>void I(e,n)}))})},ue=M.find(e=>e.issues.some(e=>e.id===p))??M.find(e=>e.issues.length>0)??M[0],de=(e,n=!1)=>{let r=$(t.attention,{count:String(N)});return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`span`,{children:[P[e.key],` (`,e.issues.length+e.hiddenCount,`)`]}),e.key===`in_progress`&&N>0&&(0,H.jsx)(`span`,{className:`text-warning`,title:n?r:void 0,children:n?`!${N}`:r})]})},fe=(e,n)=>(0,H.jsxs)(`section`,{className:DD(!n),children:[n&&(0,H.jsx)(`h2`,{className:OD(e.key),children:de(e)}),(0,H.jsxs)(`div`,{className:kD,children:[e.issues.map(t=>(0,H.jsx)(nO,{issue:t,column:e.key,selected:t.id===p,badge:ee(t,e.key),onSelect:()=>m(t.id),onOpen:()=>ie(t),onMenu:(e,n)=>le(t,e,n)},t.id)),e.issues.length===0&&e.hiddenCount===0&&(0,H.jsx)(`p`,{className:`mono text-muted ${AD}`,children:t.columnEmpty}),e.hiddenCount>0&&(0,H.jsx)(`p`,{className:`mono text-muted ${AD}`,children:$(t.more,{count:String(e.hiddenCount)})})]})]},e.key);return(0,H.jsxs)(`div`,{className:`${Ax} ${_D}`,tabIndex:0,ref:g,children:[(0,H.jsxs)(`div`,{className:`kb-top`,children:[(0,H.jsx)(`h1`,{className:Mx,children:t.title}),(0,H.jsx)(`span`,{className:`mono keys-only text-muted`,children:t.hint}),(0,H.jsxs)(`span`,{className:`mono ${Fx}`,children:[(0,H.jsx)(`button`,{type:`button`,className:`${Ar} ${Ix.kanban}`,disabled:!T,onClick:ae,children:B(`pages.new`)}),(0,H.jsx)(`button`,{type:`button`,className:`${Ar} ${Ix.kanban}`,disabled:!T?.issues.some(e=>e.id===p),onClick:oe,children:B(`pages.delete`)})]})]}),o===null?(0,H.jsx)(`p`,{className:`text-muted`,children:t.loading}):T?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:vD,children:[(0,H.jsxs)(`button`,{type:`button`,className:yD,onClick:()=>R(1),children:[CE(T.repoRoot,E),b.length>1&&(0,H.jsx)(`span`,{className:`text-muted`,children:` ${w+1}/${b.length}`})]}),!_&&(0,H.jsx)(`span`,{className:`mono text-muted ${bD}`,children:T.repoRoot}),T.issues.length===0&&!T.readError&&(0,H.jsx)(`span`,{className:`text-muted ${xD}`,children:t.empty})]}),T.readError?(0,H.jsx)(`p`,{className:`text-error`,children:$(t.readFailed,{error:T.readError})}):_&&ue?(0,H.jsxs)(`div`,{className:CD,ref:ce,children:[(0,H.jsx)(`div`,{className:`mono ${wD}`,children:M.map(e=>(0,H.jsx)(`button`,{type:`button`,className:TD(e.key===ue.key),onClick:()=>{let t=e.issues[0];t&&m(t.id)},children:de(e,!0)},e.key))}),fe(ue,!1)]}):(0,H.jsx)(`div`,{className:SD,ref:ce,children:M.map(e=>fe(e,!0))})]}):(0,H.jsx)(`p`,{className:`text-muted`,children:t.noRepos})]})}var oO={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})`},sO={title:`Mods`,empty:`当前没有 mod 在绘制内容。`,emptyHint:`声明了 [mod] 的插件会在这里绘制面板,TUI 和 web 显示的是同一份。`,keys:`↑↓/tab 移动 · enter 按下 · esc 返回`,pressFailed:`{plugin}:按键没有送达 mod({reason})`},cO={info:`text-info`,success:`text-success`,warning:`text-warning`,error:`text-error`,muted:`text-muted`},lO=`flex flex-col gap-3`,uO=`[&_p]:mx-0 [&_p]:my-1`,dO=`rounded-md border-hairline border-line px-3 pt-2 pb-3 font-mono`,fO=`mb-2 text-meta leading-[inherit] text-ink`,pO=(e,t)=>`flex min-w-0 items-start ${e?`[&>form]:flex-[1_1_12em] [&>form]:self-center`:``} ${t?`rounded-sm border-hairline border-line`:``}`,mO=(e,t)=>`whitespace-pre-wrap wrap-anywhere ${e?cO[e]:`text-ink`} ${t?`font-bold`:``}`,hO=(e,t)=>`cursor-pointer rounded-sm border-hairline border-current px-2.5 py-0.5 [font:inherit] font-bold! ${cO[e]} ${t?`bg-[color-mix(in_srgb,currentcolor_18%,transparent)]`:`bg-transparent [&:hover]:bg-[color-mix(in_srgb,currentcolor_18%,transparent)]`}`,gO=`flex min-w-0 max-w-[40em] self-stretch`,_O=`w-full font-mono`,vO=[0,6,12,20];function yO(e){return`mod-${e.kind}:${e.plugin}/${e.pane}/${e.key}`}function bO(e){let[t,n]=(0,h.useState)(e.value??``);return(0,H.jsx)(`form`,{className:gO,onSubmit:r=>{r.preventDefault(),e.onSubmit(t),n(e.value??``)},children:(0,H.jsx)(`input`,{id:e.id,className:`${Mr} ${_O}`,spellCheck:!1,value:t,placeholder:e.placeholder,onFocus:e.onFocus,onChange:e=>n(e.target.value)})})}function xO(e){let{node:t}=e;if(t.type===`text`)return(0,H.jsx)(`span`,{className:mO(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,H.jsx)(bO,{id:yO(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,H.jsx)(`button`,{type:`button`,id:yO(n),className:hO(t.tone??`info`,Ha(n,e.cursor)),onFocus:()=>e.onFocus(n),onClick:()=>e.onPress(n),children:t.label})}return(0,H.jsx)(`div`,{className:pO(t.direction===`row`,t.border===!0),style:{flexDirection:t.direction??`column`,gap:vO[t.gap??0],padding:vO[t.padding??0]},children:t.children.map((t,n)=>(0,H.jsx)(xO,{...e,node:t},n))})}function SO({model:e}){let t=V()===`zh`?sO:oO,n=y(e.mods),r=Va(n),[i,a]=(0,h.useState)(null),o=Ua(r,i),s=AE(),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=>L(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=Wa(r,o,e);a(t),t&&document.getElementById(yO(t))?.focus()};return kE(e=>{if(e.ctrlKey)return e.key===`c`&&(O.set(null),!0);switch(e.key){case`Escape`:case`q`:return O.set(null),!0;case`ArrowDown`:return f(1),!0;case`ArrowUp`:return f(-1),!0;case`Enter`:return e.target instanceof HTMLButtonElement?!1:(o?.kind===`button`&&u(o),!0);default:return!1}}),(0,H.jsxs)(`div`,{className:`${jx} ${lO}`,tabIndex:0,ref:s,children:[(0,H.jsxs)(`div`,{className:Nx,children:[(0,H.jsx)(`h1`,{className:Mx,children:t.title}),(0,H.jsx)(`span`,{className:`keys-only touch:empty:hidden! text-muted ${Px(!1)}`,children:t.keys})]}),n.length===0?(0,H.jsxs)(`div`,{className:uO,children:[(0,H.jsx)(`p`,{children:t.empty}),(0,H.jsx)(`p`,{className:`text-muted`,children:t.emptyHint})]}):n.map(e=>(0,H.jsxs)(`section`,{className:dO,children:[(0,H.jsxs)(`header`,{className:fO,children:[e.title,` `,(0,H.jsx)(`span`,{className:`text-muted`,children:e.plugin})]}),(0,H.jsx)(xO,{node:e.tree,pane:e,cursor:o,onPress:u,onSubmit:d,onFocus:a})]},`${e.plugin}/${e.id}`))]})}function CO(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 wO(e){return e===`dispatch_failed`||e===`skipped_unavailable`||e===`script_failed`}function TO(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 EO=6e4,DO=3294,OO=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]]),kO=new Map([[`SUN`,0],[`MON`,1],[`TUE`,2],[`WED`,3],[`THU`,4],[`FRI`,5],[`SAT`,6]]),AO=256;function jO(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 MO(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=jO(t,e.names,e.field),c=jO(i,e.names,e.field)}else s=jO(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 NO(e){if(e.length>AO)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:MO({value:n,min:0,max:59,field:`minute`}),hours:MO({value:r,min:0,max:23,field:`hour`}),daysOfMonth:MO({value:i,min:1,max:31,field:`day-of-month`}),months:MO({value:a,min:1,max:12,field:`month`,names:OO}),daysOfWeek:MO({value:o,min:0,max:7,field:`weekday`,names:kO,normalize:e=>e%7}),dayOfMonthRestricted:!i.startsWith(`*`),dayOfWeekRestricted:!o.startsWith(`*`)}}function PO(e){try{return NO(e),!0}catch{return!1}}function FO(e,t,n){return new Date(e.year,e.month-1,e.day,t,n,0,0).getTime()}function IO(e){let t=new Date(e);return{year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()}}function LO(e,t){return IO(new Date(e.year,e.month-1,e.day+t,12,0,0,0).getTime())}function RO(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 zO(e){return e-e%EO}function BO(e,t){return[...e].sort((e,n)=>(e-n)*t)}function VO(e,t){let n=NO(e),r=BO(n.hours,1),i=BO(n.minutes,1),a=new Date(zO(t)+EO),o=IO(a.getTime()),s=a.getHours(),c=a.getMinutes();for(let e=0;e<DO;e++){if(RO(n,o)){for(let e of r)if(!(e<s))for(let n of i){if(e===s&&n<c)continue;let r=FO(o,e,n);if(r>t)return r}}o=LO(o,1),s=0,c=0}throw Error(`cron expression never matches: ${e}`)}var HO=[`minute`,`hour`,`dayOfMonth`,`month`,`dayOfWeek`];function UO(e){let t=e.trim().split(/\s+/).filter(Boolean);return HO.map((e,n)=>t[n]??`*`)}function WO(e){return HO.map((t,n)=>e[n]??`*`).join(` `)}var GO=[`*`,`*/5`,`*/10`,`*/15`,`*/30`,...ZO(0,59)],KO=[`*`,`*/2`,`*/3`,`*/4`,`*/6`,`*/12`,...ZO(0,23)],qO=[`*`,...ZO(1,31)],JO=[`*`,`JAN`,`FEB`,`MAR`,`APR`,`MAY`,`JUN`,`JUL`,`AUG`,`SEP`,`OCT`,`NOV`,`DEC`],YO=[`*`,`MON-FRI`,`SAT,SUN`,`MON`,`TUE`,`WED`,`THU`,`FRI`,`SAT`,`SUN`],XO=[`MON`,`TUE`,`WED`,`THU`,`FRI`,`SAT`,`SUN`];function ZO(e,t){let n=[];for(let r=e;r<=t;r++)n.push(String(r));return n}var QO={minute:GO,hour:KO,dayOfMonth:qO,month:JO,dayOfWeek:YO};function $O(e,t,n){let r=QO[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 ek(e,t){return Math.min(Math.max(e+t,0),HO.length-1)}function tk(e,t,n){let r=UO(e);return t<0||t>=HO.length||(r[t]=n),WO(r)}function nk(e,t){let[n,r,i,a,o]=UO(e);if(a!==`*`||i!==`*`||n===void 0||r===void 0||o===void 0)return null;let s=rk(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=XO.find(e=>e===o.toUpperCase());return u?t(`automations.schedule.onWeekday`,{weekday:t(`automations.schedule.dow.${u}`),at:c}):null}function rk(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 ik(e,t,n,r){let i=e.trim();if(!PO(i))return{kind:`invalid`};let a;try{a=VO(i,t)}catch{return{kind:`never`}}return{kind:`ok`,nextRunMs:a,relative:ak(a-t,n),absolute:ok(a,t,n,r)}}function ak(e,t){let{minutes:n,hours:r,days:i}=qE(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 ok(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 sk(e,t){let n=t?.trim()??``;return n&&e?.effortLevels?.includes(n)?n:``}function ck(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:_}=Ci();(0,h.useEffect)(()=>{Promise.all([t.client.request(`engines.list`),e.current()]).then(([e,t])=>{let n=Eu(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(sk(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(sk(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,H.jsx)(Si,{title:q(`tasks`,`changeEngine.title`),wide:!0,children:(0,H.jsxs)(`form`,{className:Gr,onKeyDown:T,onSubmit:e=>{e.preventDefault(),E()},children:[(0,H.jsx)(`ul`,{className:zr,"aria-label":q(`tasks`,`changeEngine.title`),children:n.map(e=>(0,H.jsx)(`li`,{children:(0,H.jsxs)(`button`,{type:`button`,"aria-pressed":e.id===o,className:hi({selected:e.id===o}),onClick:()=>S(e.id),children:[(0,H.jsx)(`span`,{className:`${yi} text-accent`,children:e.id===o?`●`:` `}),(0,H.jsx)(`span`,{className:gi,children:e.name}),e.id===i.engine&&(0,H.jsx)(`span`,{className:`text-muted`,children:q(`tasks`,`changeEngine.current`)})]})},e.id))}),f&&v&&v.acceptsModel&&(0,H.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:q(`tasks`,`engineModel.label`)}),(0,H.jsx)(`input`,{className:Mr,spellCheck:!1,placeholder:q(`tasks`,`engineModel.placeholder`),value:u,onChange:e=>d(e.target.value)}),x.length>0&&(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:x.map(e=>(0,H.jsx)(`button`,{type:`button`,className:Rr(),onClick:()=>d(e),children:e},e))})]}),b.length>0&&(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:q(`tasks`,`changeEngine.effortLabel`)}),(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:b.map(e=>(0,H.jsx)(`button`,{type:`button`,"aria-pressed":e===c,className:Rr(e===c),onClick:()=>l(e),children:e===``?q(`tasks`,`changeEngine.noEffort`):e},e||`default`))})]}),(0,H.jsx)(`p`,{className:`keys-only ${Tr}`,children:(0,H.jsx)(cp,{text:[q(`tasks`,`changeEngine.footer.engine`),...v?.acceptsModel?[q(`tasks`,`changeEngine.footer.model`)]:[],...b.length>0?[q(`tasks`,`changeEngine.footer.effort`)]:[],q(`tasks`,`changeEngine.footer.set`),q(`tasks`,`changeEngine.footer.cancel`)].join(` · `)})}),g&&(0,H.jsx)(`p`,{className:`text-error`,children:g}),(0,H.jsx)(Di,{busy:m||!f,submitLabel:B(`taskops.set`)})]})})}var lk=`flex flex-col overflow-hidden @container`,uk=`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`,dk=`flex min-h-0 flex-col gap-3 overflow-y-auto scrollbar-none rt-narrow:shrink-0 rt-narrow:overflow-visible`,fk=`flex gap-1.5 px-2 pt-0 pb-1`,pk=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`}`,mk=`flex min-w-0 items-baseline gap-2.5`,hk=e=>`min-w-0 flex-1 truncate font-bold ${e?`text-muted`:``}`,gk=`whitespace-nowrap text-meta`,_k=`truncate text-meta`,vk=`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)]`,yk=`flex flex-wrap items-baseline justify-between gap-3`,bk=`font-sans text-display font-bold normal-nums wrap-anywhere`,xk=`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`,Sk=`max-h-[12lh] overflow-y-auto rounded-sm bg-inset px-2.5 py-2 whitespace-pre-wrap wrap-anywhere`,Ck=`min-w-0 text-meta leading-[inherit]`,wk=`flex w-full min-w-0 gap-2 text-inherit`,Tk=wk,Ek=`${wk} cursor-pointer border-none bg-transparent p-0 text-left font-[inherit] [&:hover]:underline`,Dk=`min-w-0 flex-1 truncate`,Ok=`[&+&]:mt-1.5`,kk=e=>`whitespace-pre-wrap wrap-anywhere text-meta ${e?``:`leading-[inherit]`}`,Ak=`text-meta`,jk=`flex gap-4.5`,Mk=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`}`,Nk=`hidden gap-2 px-1 pt-0.5 pb-1.5 touch:flex`,Pk=`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 Fk(e){let t=e.client,[n,r]=(0,h.useState)(()=>X(t,`pendingStart.list`)?.starts??[]);if((0,h.useEffect)(()=>{let e=!0;return Ku(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){L($(B(`pages.laterCancelFailed`),{error:xE(e)}),`error`)}};return(0,H.jsxs)(`section`,{"data-field":`later`,className:`mt-2.5`,children:[(0,H.jsxs)(`h2`,{className:`${W} ${fk} text-muted`,children:[B(`pages.laterStarts`),` `,(0,H.jsx)(`span`,{className:`mono`,children:n.length})]}),n.map(e=>(0,H.jsxs)(`div`,{className:pk(!1),children:[(0,H.jsxs)(`span`,{className:mk,children:[(0,H.jsx)(`span`,{className:hk(!1),children:e.title}),(0,H.jsx)(`span`,{className:`mono text-muted ${gk}`,title:new Date(e.at).toLocaleString(),children:Tg(new Date(e.at))}),(0,H.jsx)(U,{className:`font-mono`,hit:`tight`,onClick:()=>void a(e),children:B(`pages.laterCancel`)})]}),(0,H.jsx)(`span`,{className:`mono text-muted ${_k}`,children:CE(e.repo,i)}),e.error&&(0,H.jsx)(`span`,{className:`mono text-warning truncate text-meta`,title:e.error,children:$(B(`pages.laterFailed`),{error:e.error})})]},e.id))]})}var Ik={name:``,repo:``,prompt:``,schedule:`0 9 * * MON-FRI`};function Lk(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))&&PO(e.schedule.trim())}function Rk(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`:PO(e.schedule.trim())?null:`schedule`}function zk(e){let{auto:t,common:n}=yE(),r=bE(),i=V()===`zh`?`zh-CN`:`en-US`,[a,o]=(0,h.useState)(()=>({...Ik,repo:e.repos.find(t=>e.defaultRepo&&SE(t)===SE(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(),z())};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},[]);let m=()=>{if(Lk(a)){z(),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=Rk(a);n&&(d.current[n]?.focus(),u(Reflect.get(t.missing,n)))},g=a.repo===null?[]:e.tasks.filter(e=>SE(e.repo)===SE(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=UO(a.schedule),w=e=>{let t=HO[s];t&&p({schedule:tk(a.schedule,s,$O(t,C[s]??`*`,e))})},T=e=>{if(!(e.ctrlKey||e.metaKey||e.altKey)){if(e.key===`ArrowLeft`||e.key===`h`)c(ek(s,-1));else if(e.key===`ArrowRight`||e.key===`l`)c(ek(s,1));else if(e.key===`ArrowUp`||e.key===`ArrowDown`)w(e.key===`ArrowUp`?1:-1);else return;e.preventDefault()}},E=ik(a.schedule,Date.now(),r,i),D=nk(a.schedule,r);return(0,H.jsx)(`div`,{className:Br,onMouseDown:e=>e.target===e.currentTarget&&z(),children:(0,H.jsxs)(`dialog`,{open:!0,className:`${Vr(!0)} ${ID}`,"aria-label":t.newTitle,children:[(0,H.jsx)(`h1`,{className:`${W} text-muted`,children:t.newTitle}),(0,H.jsxs)(`div`,{className:Gr,children:[(0,H.jsxs)(`label`,{className:Fr,children:[(0,H.jsx)(`span`,{className:`${W} text-muted`,children:t.fieldName}),(0,H.jsx)(`input`,{ref:f(`name`),className:Mr,spellCheck:!1,placeholder:t.namePlaceholder,value:a.name,onChange:e=>p({name:e.target.value}),onKeyDown:S(`repo`)})]}),(0,H.jsxs)(`div`,{className:Fr,children:[(0,H.jsxs)(`span`,{className:`${W} text-muted ${RD}`,children:[t.fieldRepo,(0,H.jsx)(`span`,{className:`keys-only text-muted ${zD}`,children:`↑/↓`})]}),(0,H.jsx)(YD,{fieldRef:f(`repo`),kind:`list`,label:t.fieldRepo,className:VD,onKeyDown:x(b),children:y.map(t=>(0,H.jsxs)(`button`,{type:`button`,tabIndex:-1,"aria-selected":t===a.repo,className:`touch:py-1.5 ${HD(t===a.repo)}`,onClick:()=>{p({repo:t,target:void 0}),d.current.repo?.focus()},children:[t===a.repo?`▸ `:` `,t===null?B(`rail.noProject`):CE(t,e.repos)]},t??``))})]}),(0,H.jsxs)(`div`,{className:Fr,children:[(0,H.jsxs)(`span`,{className:`${W} text-muted ${RD}`,children:[t.fieldTarget,(0,H.jsx)(`span`,{className:`keys-only text-muted ${zD}`,children:`↑/↓`})]}),(0,H.jsx)(YD,{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,H.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:t.fieldTargetTab}),(0,H.jsx)(`input`,{ref:f(`targetTab`),className:Mr,spellCheck:!1,value:a.target.tabId,onChange:e=>a.target&&p({target:{...a.target,tabId:e.target.value}}),onKeyDown:S(`prompt`)})]}),(0,H.jsxs)(`label`,{className:Fr,children:[(0,H.jsx)(`span`,{className:`${W} text-muted`,children:t.fieldPrompt}),(0,H.jsx)(`input`,{ref:f(`prompt`),className:Mr,spellCheck:!1,placeholder:t.promptPlaceholder,value:a.prompt,onChange:e=>p({prompt:e.target.value}),onKeyDown:S(`schedule`)})]}),(0,H.jsxs)(`div`,{className:Fr,children:[(0,H.jsxs)(`span`,{className:`${W} text-muted ${RD}`,children:[t.fieldSchedule,(0,H.jsx)(`span`,{className:`keys-only text-muted ${zD}`,children:`←/→ ↑/↓`})]}),(0,H.jsx)(YD,{fieldRef:f(`schedule`),kind:`cells`,label:t.fieldSchedule,className:jk,onKeyDown:T,children:HO.map((e,n)=>(0,H.jsxs)(`button`,{type:`button`,tabIndex:-1,className:Mk(n===s),onClick:()=>{c(n),d.current.schedule?.focus()},children:[C[n]??`*`,(0,H.jsx)(`span`,{children:t.cronField[e]})]},e))}),(0,H.jsx)(`div`,{className:Nk,children:[-1,1].map(e=>{let n=t.cronField[HO[s]??`minute`]??``;return(0,H.jsx)(`button`,{type:`button`,tabIndex:-1,className:Pk,"aria-label":B(e<0?`pages.cronDown`:`pages.cronUp`,{field:n}),onClick:()=>{w(e),d.current.schedule?.focus()},children:e<0?`−`:`+`},e)})}),E.kind===`ok`?(0,H.jsxs)(`p`,{className:`mono text-success`,children:[D?`${D}, `:``,E.relative,`, `,E.absolute]}):(0,H.jsx)(`p`,{className:`mono text-error`,children:E.kind===`never`?t.cronNever:t.cronInvalid})]}),l&&(0,H.jsxs)(`p`,{className:`text-error`,children:[`※ `,l]}),(0,H.jsx)(`p`,{className:`touch:empty:hidden! text-muted ${UD}`,children:(0,H.jsx)(cp,{text:fu(t.composerLegend)})}),(0,H.jsxs)(`div`,{className:Nr,children:[(0,H.jsx)(`button`,{type:`button`,className:Ar,onClick:z,children:n.cancel}),(0,H.jsx)(`button`,{ref:f(`confirm`),type:`button`,className:xr(),onClick:m,children:n.create})]})]})]})})}var Bk=[`ok`,`blocked`,`failed`,`skipped`];function Vk(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 Hk={scheduled:`schedule`,manual:`manual`,webhook:`webhook`};function Uk(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 Wk(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 Gk(e,t){return e.filter(e=>t===null||Vk(e)===t).sort((e,t)=>Date.parse(t.at)-Date.parse(e.at)||t.runNumber-e.runNumber)}function Kk(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 qk=(e,t)=>e&&typeof e==`object`?Reflect.get(e,t):void 0;function Jk(e){let t=Kk(e);if(!t)return{summary:e,full:e};let n=qk(t.value,`error`)??t.value,r=qk(n,`message`),i=qk(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 Yk(e){let t=e.trim();if(!/^[[{]/.test(t))return e;try{return JSON.stringify(JSON.parse(t),null,2)}catch{return e}}var Xk={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`},Zk={success:`text-success`,muted:`text-muted`,warning:`text-warning`,error:`text-error`},Qk={success:`✓`,error:`†`,warning:`!`,muted:`·`},$k=e=>Xk[e]??`muted`;function eA(e){let{auto:t}=yE(),{runs:n,when:r}=e,i=e=>t.runStatus[e]??e,a=n.filter(e=>e.response);return(0,H.jsxs)(H.Fragment,{children:[n[0]?.precheckResult&&(0,H.jsx)(tA,{run:n[0]}),(0,H.jsx)(`h2`,{className:`${W} text-muted`,children:t.responses}),a.length===0?(0,H.jsx)(`p`,{className:`text-muted`,children:t.noResponses}):a.map(e=>(0,H.jsxs)(`div`,{className:Ok,children:[(0,H.jsx)(`p`,{className:`mono ${Ak} ${Zk[$k(e.status)]}`,children:`#${e.runNumber} ${i(e.status)}, ${r(e.response?.at)}`}),(0,H.jsx)(`p`,{className:kk(!1),children:Yk(e.response?.text??``)})]},e.id))]})}function tA({run:e}){let{auto:t}=yE(),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,H.jsxs)(`div`,{children:[(0,H.jsx)(`h2`,{className:`${W} text-muted`,children:$(t.precheckDetail,{exit:r,duration:String(n.durationMs)})}),i.length===0?(0,H.jsx)(`p`,{className:`text-muted`,children:t.precheckNoOutput}):i.map(e=>(0,H.jsx)(`p`,{className:`mono ${kk(!0)}`,children:`${e.label}: ${e.text.replace(/\s+$/,``).split(`
56
+ `);return r?r.length>aE?`${r.slice(0,aE).trimEnd()}…`:r:null}function sE(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 cE(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&&L(B(`compare.archived`,{count:i})),e instanceof Uo&&e.code===`TASK_BUSY`)throw e;L(B(`compare.archiveFailed`,{error:G(e)}),`error`);return}L(B(`compare.archived`,{count:i}))}async function lE(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){L(B(`compare.keepFailed`,{error:G(e)}),`error`);return}L(B(`compare.keptToast`,{title:t.label}));let r=n.filter(e=>e.id!==t.id).map(e=>e.id);r.length!==0&&C.set((0,H.jsx)(Ti,{title:B(`compare.archiveTitle`),body:B(`compare.archiveBody`,{count:r.length}),confirmLabel:B(`compare.archiveConfirm`),onConfirm:()=>cE(e,r,!1),escalate:{when:e=>e instanceof Uo&&e.code===`TASK_BUSY`,label:B(`compare.archiveBusyConfirm`),title:B(`compare.archiveBusyTitle`),body:()=>B(`compare.archiveBusyBody`),run:()=>cE(e,r,!0)}}))}async function uE(e,t){try{await e.act(`task.keep`,{taskId:t.id,kept:!1}),L(B(`compare.unkeptToast`,{title:t.label}))}catch(e){L(B(`compare.keepFailed`,{error:G(e)}),`error`)}}var dE={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: {error}`},fE={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}`},pE={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`,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}`},mE={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 任务——独立工作区`,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}`},hE={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`}},gE={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 _E(){let e=V()===`zh`;return{kanban:e?mE:pE,auto:e?fE:dE,items:e?gE:hE,nav:(e?Gi:Wi).nav,group:(e?Gi:Wi).group,common:e?ki:Oi}}function $(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??e))}function vE(){let{auto:e}=_E();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 yE(e){return e instanceof Error?e.message:String(e)}function bE(e){return e.replace(/^\/private\//,`/`).replace(/\/+$/,``)}function xE(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 SE(...e){let t=new Set,n=[];for(let r of e.flat()){if(!r||r.startsWith(`ssh://`))continue;let e=bE(r);t.has(e)||(t.add(e),n.push(r))}return n}function CE(e){return SE((y(e.tasks)?.tasks??[]).filter(e=>!Ad(e)).map(e=>e.repo))}function wE(e){let t=y(e.tasks),{taskId:n}=y(e.selection);return t?.tasks.find(e=>e.id===n)?.repo}function TE(e){let[t,n]=(0,h.useState)(0);return(0,h.useEffect)(()=>K(e,()=>n(e=>e+1)),[e]),[t,(0,h.useCallback)(()=>n(e=>e+1),[])]}function EE(e){return e instanceof HTMLElement?e.isContentEditable||[`INPUT`,`TEXTAREA`,`SELECT`].includes(e.tagName):!1}function DE(e){let t=(0,h.useRef)(e);t.current=e,(0,h.useEffect)(()=>{let e=e=>{if(e.defaultPrevented||C.get()||S.get())return;let n=e.target instanceof HTMLElement?e.target:null;EE(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 OE(){let e=(0,h.useRef)(null);return(0,h.useEffect)(()=>e.current?.focus(),[]),e}function kE({tone:e,children:t}){return(0,H.jsx)(`span`,{className:It(`flex-none font-mono text-meta`,e&&lp[e]),children:t})}var AE=`mt-3 grid grid-cols-[repeat(auto-fit,minmax(min(100%,17rem),1fr))] items-start gap-x-5 gap-y-6`,jE=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)]`,ME=`flex min-w-0 items-center gap-2`,NE=`min-w-0 truncate font-bold`,PE=`truncate font-mono text-meta text-muted`,FE=`m-0 line-clamp-6 whitespace-pre-wrap wrap-anywhere`,IE=`flex min-w-0 flex-col`,LE=`flex min-w-0 items-baseline gap-2 py-px font-mono text-meta`,RE=`flex flex-wrap gap-x-3.5 gap-y-1 font-mono text-meta`,zE=`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`,BE=6;function VE(e,t){let[n,r]=(0,h.useState)(null),[i,a]=(0,h.useState)(()=>X(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 Ku(e,`output.read`,{taskId:t.id,limit:8}).then(e=>n&&r(oE(e)),()=>n&&r(null)),()=>{n=!1}},[e,t.id,o]),(0,h.useEffect)(()=>{let n=!0;return Ku(e,`diff.files`,{taskId:t.id}).then(e=>n&&a(e),()=>{}),()=>{n=!1}},[e,t.id,s,o]),{reply:n,changes:i?sE(i):null}}function HE({changes:e,onOpen:t}){if(!e)return(0,H.jsx)(`p`,{className:wr,children:`…`});if(e.files.length===0)return(0,H.jsx)(`p`,{className:`m-0 font-mono text-meta text-subtle`,children:B(`compare.noChanges`)});let n=e.files.length-BE;return(0,H.jsxs)(`div`,{className:IE,children:[(0,H.jsxs)(`p`,{className:`m-0 flex gap-2 font-mono text-meta text-muted`,children:[(0,H.jsx)(`span`,{children:B(`compare.files`,{count:e.files.length})}),e.added>0&&(0,H.jsxs)(kE,{tone:`added`,children:[`+`,e.added]}),e.deleted>0&&(0,H.jsxs)(kE,{tone:`removed`,children:[`−`,e.deleted]})]}),e.files.slice(0,BE).map(n=>(0,H.jsxs)(U,{variant:`row`,className:`${LE} text-left [&:hover]:underline`,title:n.path,onClick:()=>t(n.path,e.scope),children:[(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n.path}),n.added?(0,H.jsxs)(kE,{tone:`added`,children:[`+`,n.added]}):null,n.deleted?(0,H.jsxs)(kE,{tone:`removed`,children:[`−`,n.deleted]}):null]},n.path)),n>0&&(0,H.jsx)(`span`,{className:`font-mono text-meta text-subtle`,children:B(`compare.more`,{count:n})})]})}function UE({model:e,row:t,round:n}){let{reply:r,changes:i}=VE(e,t),{look:a}=wh(t.rowStatus),o=t.kept===!0,s=(n,r)=>{e.select(t.id),Lc({taskId:t.id,path:n,scope:r})};return(0,H.jsxs)(`section`,{className:jE(o),"data-attempt":t.id,children:[(0,H.jsxs)(`div`,{className:ME,children:[(0,H.jsx)(Bh,{status:t.rowStatus}),(0,H.jsx)(`span`,{className:NE,children:t.engine?.name??t.label}),(0,H.jsx)(`span`,{className:`flex-none text-meta text-muted`,children:B(`compare.status.${a}`)}),o&&(0,H.jsx)(`span`,{className:`ml-auto flex-none font-mono text-meta text-accent`,children:B(`compare.kept`)})]}),(0,H.jsx)(`span`,{className:PE,title:t.branch,children:t.branch}),r?(0,H.jsx)(`p`,{className:FE,children:r}):(0,H.jsx)(`p`,{className:`m-0 text-muted`,children:B(`compare.noReply`)}),(0,H.jsx)(HE,{changes:i,onOpen:s}),(0,H.jsxs)(`div`,{className:RE,children:[(0,H.jsx)(U,{hit:`tight`,onClick:()=>e.select(t.id),children:B(`compare.terminal`)}),(0,H.jsx)(U,{hit:`tight`,onClick:()=>s(`.`,i?.scope??`working`),children:B(`compare.diff`)}),o?(0,H.jsx)(U,{hit:`tight`,onClick:()=>void uE(e,t),children:B(`compare.unkeep`)}):(0,H.jsx)(U,{hit:`tight`,onClick:()=>void lE(e,t,n),children:B(`compare.keep`)})]})]})}function WE({model:e}){V();let t=y(A),n=y(e.tasks),r=OE(),i=t&&n?iE(n.tasks,t):[];return(0,H.jsxs)(`div`,{className:kx,tabIndex:0,ref:r,onKeyDown:e=>{e.metaKey||e.ctrlKey||e.altKey||e.key!==`q`&&e.key!==`Escape`||(e.preventDefault(),O.set(null))},children:[(0,H.jsx)(`h1`,{className:Ax,children:B(`compare.title`)}),i.length===0?(0,H.jsx)(`p`,{className:`text-muted`,children:B(`compare.empty`)}):(0,H.jsx)(`div`,{className:AE,children:i.map(t=>(0,H.jsx)(UE,{model:e,row:t,round:i},t.id))})]})}function GE(e){let t=Math.floor(e/6e4),n=Math.floor(t/60);return{minutes:t,hours:n,days:Math.floor(n/24)}}function KE(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}=GE(n);return i<60?`${i}m`:a<24?`${a}h`:`${o}d`}var qE=[{id:`issues`,label:`reviewQueue.sourceIssues`},{id:`reviews`,label:`reviewQueue.sourceReviews`}];function JE(){V();let e=y(py);return(0,H.jsx)(`span`,{className:`flex items-baseline gap-3 font-mono text-meta`,children:qE.map(t=>t.id===e?(0,H.jsx)(`span`,{className:`text-ink`,children:B(t.label)},t.id):(0,H.jsx)(U,{onClick:()=>py.set(t.id),children:B(t.label)},t.id))})}var YE={passing:`reviewQueue.checksPassing`,failing:`reviewQueue.checksFailing`,pending:`reviewQueue.checksPending`},XE={missing:`reviewQueue.gh.missing`,unauthenticated:`reviewQueue.gh.unauthenticated`,failed:`reviewQueue.gh.failed`};function ZE(e){let{pr:t}=e,n=Date.parse(t.createdAt),r=[t.isDraft?B(`reviewQueue.draft`):``,t.fork?B(`reviewQueue.fork`):``,t.checks?B(YE[t.checks]):``];return(0,H.jsxs)(`div`,{"data-row":e.index,className:Ix(e.at),onClick:e.onPick,children:[(0,H.jsxs)(`div`,{className:Lx,children:[(0,H.jsxs)(`span`,{className:`mono ${Rx}`,children:[t.nameWithOwner.split(`/`)[1],`#`,t.number]}),(0,H.jsx)(`span`,{className:Bx,children:t.title}),(0,H.jsx)(U,{disabled:e.busy,onClick:e.onReview,children:B(`reviewQueue.start`)})]}),(0,H.jsxs)(`div`,{className:zx,children:[(0,H.jsx)(`span`,{className:Bx,children:[t.author,...r].filter(Boolean).join(`, `)}),(0,H.jsxs)(`span`,{className:`mono`,children:[`+`,t.additions,` −`,t.deletions]}),(0,H.jsx)(`span`,{className:`mono`,children:Number.isFinite(n)?KE(n,e.now):``})]})]})}function QE({model:e}){V();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=OE(),_=(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(yE(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(B(`reviewQueue.preparing`,{number:e.number}));try{let{ref:n}=await t.request(`review.prepare`,{repo:e.repo,number:e.number});te(my(e,n,B(`reviewQueue.prompt`,{number:e.number,repo:e.nameWithOwner,title:e.title,url:e.url,head:e.headRef,base:e.baseRef})))}catch(t){L(B(`reviewQueue.failed`,{number:e.number,error:yE(t)}),`error`)}finally{l(null),d(null)}}};DE(e=>{if(e.ctrlKey)return e.key===`c`&&(O.set(null),!0);switch(e.key){case`Escape`:case`q`:return O.set(null),!0;case`j`:case`ArrowDown`:return 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,H.jsxs)(`div`,{className:kx,tabIndex:0,ref:g,children:[(0,H.jsxs)(`div`,{className:jx,children:[(0,H.jsx)(`h1`,{className:Ax,children:B(`reviewQueue.title`)}),(0,H.jsx)(JE,{})]}),i?(0,H.jsx)(`p`,{className:`text-error`,children:i}):n===null?(0,H.jsx)(`p`,{className:`text-muted`,children:`…`}):n.reason?(0,H.jsx)(`p`,{className:`text-muted`,children:B(XE[n.reason])}):v.length===0?(0,H.jsx)(`p`,{className:`text-muted`,children:B(`reviewQueue.empty`)}):(0,H.jsx)(`div`,{className:Fx,ref:_,children:v.map((e,t)=>(0,H.jsx)(ZE,{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,H.jsx)(`p`,{className:`text-muted mx-0 mt-2 mb-0 text-meta leading-[inherit]`,children:B(`reviewQueue.other`,{count:n.other})}),u&&(0,H.jsx)(`p`,{className:`text-muted mx-0 mt-2 mb-0 text-meta leading-[inherit]`,children:u})]})}var $E=30;function eD(){let{items:e}=_E();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 tD({model:e}){let{items:t,common:n}=_E(),r=eD(),i=e.client,a=y(e.tasks),o=CE(e),s=wE(e),[c,l]=(0,h.useState)(()=>{let e=s?o.findIndex(e=>bE(e)===bE(s)):-1;return Math.max(0,e)}),u=o[c],d=(e,t)=>({repo:e,limit:$E,...t?{assignee:`@me`}:{}}),f=e=>Object.fromEntries(e.links.map(e=>[e.number,e.taskId])),[p,m]=(0,h.useState)(()=>u?X(i,`workitem.list`,d(u,!1))?.items??null:null),[g,_]=(0,h.useState)(()=>{let e=u?X(i,`workitem.links`,{repo:u}):void 0;return e?f(e):{}}),[v,b]=(0,h.useState)(null),[x,S]=(0,h.useState)(!1),[C,w]=(0,h.useState)(0),[T,E]=(0,h.useState)(0),[D,k]=(0,h.useState)(!1),[A,j]=(0,h.useState)(null),M=OE(),N=(0,h.useRef)(!1);(0,h.useEffect)(()=>{let e=!0;if(!u){m([]);return}b(null);let t=N.current;N.current=!1;let n=d(u,x),r=X(i,`workitem.list`,n);return r&&m(r.items),i.request(`workitem.list`,{...n,...t?{refresh:!0}:{}}).then(t=>e&&m(Gu(i,`workitem.list`,n,t).items)).catch(t=>{e&&(b(yE(t)),m([]))}),Ku(i,`workitem.links`,{repo:u}).then(t=>e&&_(f(t))).catch(()=>e&&_({})),()=>{e=!1}},[i,u,x,C,a?.tasks.length]);let P=p??[],ee=Math.min(T,Math.max(0,P.length-1));(0,h.useEffect)(()=>j(null),[u,x]);let F=(0,h.useRef)(null);(0,h.useEffect)(()=>{F.current?.querySelector(`[data-row="${ee}"]`)?.scrollIntoView({block:`nearest`})},[ee]);let I=e=>a?.tasks.find(t=>t.id===e)?.label??e,te=t=>{O.set(null),e.select(t)},ne=async()=>{let e=P[ee];if(!e||!u||D)return;let n=g[e.number];if(n){j($(t.openingLinked,{title:I(n)})),te(n);return}k(!0),j($(t.starting,{number:e.number}));try{let n=await i.request(`workitem.start`,{repo:u,number:e.number});n.started?te(n.taskId):j($(t.startedNoEngine,{title:n.title}))}catch(n){L($(t.startFailed,{number:e.number,error:yE(n)}),`error`)}finally{k(!1)}};DE(e=>{if(e.ctrlKey)return e.key===`c`&&(O.set(null),!0);switch(e.key){case`Escape`:case`q`:return O.set(null),!0;case`j`:case`ArrowDown`:return E(Math.min(P.length-1,ee+1)),!0;case`k`:case`ArrowUp`:return E(Math.max(0,ee-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 N.current=!0,w(e=>e+1),!0;case`Enter`:return ne(),!0;default:return!1}});let re=Date.now();return(0,H.jsxs)(`div`,{className:kx,tabIndex:0,ref:M,children:[(0,H.jsxs)(`div`,{className:jx,children:[(0,H.jsx)(`h1`,{className:Ax,children:t.title}),(0,H.jsx)(JE,{}),(0,H.jsxs)(`span`,{className:`mono touch:empty:hidden! text-muted ${Mx(!0)}`,children:[u?xE(u,o):t.noRepo,x?` ${t.assignedFilter}`:``]})]}),v?(0,H.jsxs)(`div`,{className:Fx,children:[(0,H.jsx)(`p`,{className:`text-error`,children:v}),(0,H.jsx)(`p`,{className:`text-muted`,children:r(v)})]}):p===null?(0,H.jsx)(`p`,{className:`text-muted`,children:n.loading}):P.length===0?(0,H.jsx)(`p`,{className:`text-muted`,children:t.empty}):(0,H.jsx)(`div`,{className:Fx,ref:F,children:P.map((e,n)=>{let r=g[e.number],i=Date.parse(e.updatedAt);return(0,H.jsxs)(`div`,{"data-row":n,className:Ix(n===ee),onClick:()=>n===ee?void ne():E(n),children:[(0,H.jsxs)(`div`,{className:Lx,children:[(0,H.jsxs)(`span`,{className:`mono ${Rx}`,children:[`#`,e.number]}),(0,H.jsx)(`span`,{children:e.title})]}),(0,H.jsxs)(`div`,{className:zx,children:[(0,H.jsx)(`span`,{className:Bx,children:[e.author,...e.labels.slice(0,2)].filter(Boolean).join(`, `)}),r&&(0,H.jsx)(`span`,{children:$(t.linkedChip,{title:I(r)})}),(0,H.jsx)(`span`,{className:`mono`,children:Number.isFinite(i)?KE(i,re):``})]})]},e.number)})}),A&&(0,H.jsx)(`p`,{className:`text-muted mx-0 mt-2 mb-0 text-meta leading-[inherit]`,children:A})]})}function nD({model:e}){return y(py)===`reviews`?(0,H.jsx)(QE,{model:e}):(0,H.jsx)(tD,{model:e})}var rD={backlog:`active`,in_progress:`active`,in_review:`parked`,error:`parked`,done:`terminal`,canceled:`terminal`,open:`active`,doing:`active`,hold:`parked`};function iD(e){return rD[e]??`parked`}var aD=[`backlog`,`in_progress`,`parked`,`done`];function oD(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 sD(e,t){let n=iD(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 cD(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 lD(e,t){return e.created===t.created?t.id-e.id:e.created<t.created?1:-1}function uD(e,t){let n={backlog:[],in_progress:[],parked:[],done:[]};for(let r of e)n[sD(r,t)].push(r);return aD.map(e=>{let t=e===`done`||e===`parked`,r=n[e].sort(lD);return!t||r.length<=20?{key:e,issues:r,hiddenCount:0}:{key:e,issues:r.slice(0,20),hiddenCount:r.length-20}})}var dD=[`worktree`,`project`];async function fD(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});return await e.request(`issue.update`,{repo:t.repo,id:t.issue.id,task:n}).catch(e=>a.push({kind:`link`,error:yE(e)})),{taskId:n,warnings:a}}let o=await Ru((t,n)=>e.request(t,n),t.repo,t.engine,r,i);if(!o)throw Error(`the session did not start`);return await e.request(`issue.setStatus`,{repo:t.repo,id:t.issue.id,status:`doing`}).catch(e=>a.push({kind:`status`,error:yE(e)})),{taskId:o,warnings:a}}var pD=`text-meta leading-[inherit]`,mD=`text-meta`,hD=`flex flex-col gap-2 overflow-hidden`,gD=`flex min-w-0 items-baseline gap-3`,_D=`font-bold whitespace-nowrap text-accent touch:relative touch:after:absolute touch:after:-inset-x-2 touch:after:-inset-y-1 touch:after:content-['']`,vD=`min-w-0 truncate ${mD}`,yD=`ml-auto ${pD}`,bD=`grid min-h-0 flex-1 grid-cols-4 gap-2`,xD=`flex min-h-0 flex-1 flex-col gap-2`,SD=`flex gap-4 ${mD}`,CD=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`}`,wD={in_progress:`text-accent`,parked:`text-warning`,done:`text-success`},TD=e=>`flex min-h-0 flex-col rounded-md border-hairline border-line p-2 ${e?`flex-1`:``}`,ED=e=>`m-0 mb-2 flex justify-between gap-2 font-mono text-meta font-bold normal-nums ${wD[e]??`text-muted`}`,DD=`flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto`,OD=`m-0 ${mD}`,kD=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`}`,AD=`flex justify-between gap-2`,jD=e=>`min-w-0 font-bold wrap-anywhere ${e?`text-muted`:``}`,MD=`h-[2.8em] overflow-hidden whitespace-pre-wrap wrap-anywhere ${pD}`,ND=`flex justify-between gap-2 ${mD}`,PD=`w-[min(680px,calc(100vw-32px))]!`,FD=`flex items-baseline gap-3.5`,ID=`flex items-baseline gap-2.5`,LD=`tracking-[0] normal-case`,RD=`min-h-40 font-mono`,zD=`flex flex-col items-start gap-0.5`,BD=e=>`text-left font-mono text-meta whitespace-pre-wrap normal-nums ${e?`font-bold text-accent`:`font-normal text-muted`}`,VD=pD,HD=`flex flex-col gap-1 [&_p]:m-0`,UD=`flex gap-2 ${mD}`,WD=`min-w-[4ch] text-right`,GD=`rounded-sm border-hairline border-transparent p-1 focus:border-accent focus:outline-none`,KD={choice:`radiogroup`,list:`listbox`,cells:`group`};function qD(e){return(0,H.jsx)(`div`,{ref:e.fieldRef,role:KD[e.kind??`choice`],tabIndex:0,"aria-label":e.label,className:`${GD} ${e.className??``}`,onKeyDown:e.onKeyDown,onClick:e.onClick,children:e.children})}var JD=[`open`,`doing`,`hold`,`done`];function YD({model:e,taskId:t}){let{kanban:n}=_E(),[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,H.jsxs)(`div`,{className:HD,children:[(0,H.jsx)(`h2`,{className:`${W} text-muted`,children:n.detail.eventsLabel}),r===null?(0,H.jsx)(`p`,{className:`text-muted`,children:n.detail.eventsLoading}):r.length===0?(0,H.jsx)(`p`,{className:`text-muted`,children:n.detail.eventsNone}):r.map(e=>(0,H.jsxs)(`div`,{className:`mono ${UD}`,children:[(0,H.jsx)(`span`,{className:`text-muted ${WD}`,children:KE(e.at)}),(0,H.jsx)(`span`,{children:e.kind}),e.tail&&(0,H.jsx)(`span`,{className:`text-muted`,children:e.tail})]},`${e.at}:${e.kind}:${e.tail}`))]})}function XD(e){let{kanban:t}=_E(),{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)(dD[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=>{z(),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()})},A=()=>{i&&O()&&D({kind:`create`,title:s.trim(),body:l,start:null})},j=()=>D(i?null:{kind:`close`,...T()}),M=(0,h.useRef)({commit:k,saveOnly:A,close:j});M.current={commit:k,saveOnly:A,close:j},(0,h.useEffect)(()=>{let e=e=>{let t=e.key===`Escape`?M.current.close:e.key===`Enter`&&(e.ctrlKey||e.metaKey)?M.current.commit:e.key.toLowerCase()===`s`&&e.ctrlKey&&!e.metaKey?M.current.saveOnly:null;t&&(e.preventDefault(),e.stopImmediatePropagation(),t())};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},[]);let N=async t=>{let n=t.find(e=>e.size>zl);if(n){L(B(`pages.attachTooLarge`,{name:n.name||n.type}),`error`);return}x(!0);try{let n=await Promise.all(t.map(t=>Kl(e.model.client,t)));u(e=>Ul(e,n))}catch(e){L(G(e),`error`)}finally{x(!1)}},P=e=>{let t=Array.from(e.clipboardData.files);t.length!==0&&(e.preventDefault(),N(t))},ee=e=>{let t=Array.from(e.dataTransfer.files);e.preventDefault(),t.length>0&&N(t)},F=(e,t,n)=>e[(Math.max(0,e.indexOf(t))+n+e.length)%e.length],I=(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()},te=d===`done`?`text-success`:d===`hold`?`text-warning`:d===`doing`?`text-accent`:`text-muted`,ne=e=>t.detail.status[e];return(0,H.jsx)(`div`,{className:Br,onMouseDown:e=>e.target===e.currentTarget&&M.current.close(),children:(0,H.jsxs)(`dialog`,{open:!0,className:`${Vr(!0)} ${PD}`,"aria-label":i?t.detail.newStory:`#${n.id}`,onPaste:P,onDrop:ee,onDragOver:e=>e.preventDefault(),children:[(0,H.jsxs)(`div`,{className:Hr,children:[i?(0,H.jsx)(`h1`,{className:`${W} text-muted`,children:t.detail.newStory}):(0,H.jsxs)(`h1`,{className:`${W} text-muted ${FD}`,children:[(0,H.jsxs)(`span`,{children:[`#`,n.id]}),(0,H.jsx)(`span`,{className:te,children:ne(d)}),(0,H.jsx)(`span`,{className:`text-muted`,children:$(t.detail.created,{date:n.created})}),a&&(0,H.jsx)(`span`,{className:`text-accent`,children:t.detail.linked})]}),(0,H.jsx)(`button`,{type:`button`,className:Wr,"aria-label":B(`dialog.close`),title:B(`dialog.close`),onClick:()=>M.current.close(),children:`×`})]}),(0,H.jsxs)(`div`,{className:Gr,children:[(0,H.jsxs)(`label`,{className:Fr,children:[(0,H.jsx)(`span`,{className:`${W} text-muted`,children:t.detail.titleLabel}),(0,H.jsx)(`input`,{ref:C(`title`),className:Mr,spellCheck:!1,value:s,onChange:e=>c(e.target.value.replace(/[\r\n]+/g,` `)),onKeyDown:e=>{e.key===`Enter`&&!e.ctrlKey&&!e.metaKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),S.current.description?.focus())}})]}),(0,H.jsxs)(`label`,{className:Fr,children:[(0,H.jsxs)(`span`,{className:`${W} text-muted ${ID}`,children:[t.detail.description,(0,H.jsx)(`span`,{className:`text-muted ${LD}`,children:lu()?B(`pages.attachHintTouch`):t.detail.attachHint}),b&&(0,H.jsx)(`span`,{className:`text-accent`,children:`…`})]}),(0,H.jsx)(`textarea`,{ref:C(`description`),className:`${Mr} ${Ir} ${RD}`,rows:8,spellCheck:!1,placeholder:t.detail.noDescription,value:l,onChange:e=>u(e.target.value)})]}),!i&&(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.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,H.jsx)(`span`,{className:`keys-only text-muted tracking-[0] normal-case`,children:`←/→`})]}),(0,H.jsx)(qD,{fieldRef:C(`status`),label:t.detail.statusLabel,className:`flex flex-wrap gap-1.5`,onKeyDown:I(`x`,e=>f(F(JD,d,e))),children:JD.map(e=>(0,H.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-pressed":e===d,className:Rr(e===d),onClick:()=>{f(e),S.current.status?.focus()},children:ne(e)},e))})]}),o?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:Fr,children:[(0,H.jsxs)(`span`,{className:`${W} text-muted ${ID}`,children:[t.detail.engine,(0,H.jsx)(`span`,{className:`keys-only text-muted ${LD}`,children:`←/→`})]}),(0,H.jsx)(qD,{fieldRef:C(`engine`),label:t.detail.engine,className:Lr,onKeyDown:I(`x`,t=>m(F(e.engines.map(e=>e.id),p,t)),k),children:e.engines.map(e=>(0,H.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-pressed":e.id===p,className:Rr(e.id===p),onClick:()=>{m(e.id),S.current.engine?.focus()},children:e.name},e.id))})]}),(0,H.jsxs)(`div`,{className:Fr,children:[(0,H.jsxs)(`span`,{className:`${W} text-muted ${ID}`,children:[t.detail.workspace,(0,H.jsx)(`span`,{className:`keys-only text-muted ${LD}`,children:`↑/↓`})]}),(0,H.jsx)(qD,{fieldRef:C(`workspace`),label:t.detail.workspace,className:zD,onKeyDown:I(`y`,e=>_(F(dD,g,e)),k),children:dD.map(e=>(0,H.jsxs)(`button`,{type:`button`,tabIndex:-1,"aria-pressed":e===g,className:`touch:py-1.5 ${BD(e===g)}`,onClick:()=>{_(e),S.current.workspace?.focus()},children:[e===g?`▸ `:` `,t.detail.placement[e]]},e))})]}),(0,H.jsxs)(`div`,{className:Fr,children:[(0,H.jsxs)(`span`,{className:`${W} text-muted ${ID}`,children:[t.detail.jumpLabel,(0,H.jsx)(`span`,{className:`keys-only text-muted ${LD}`,children:`←/→`})]}),(0,H.jsx)(qD,{fieldRef:C(`jump`),label:t.detail.jumpLabel,className:Lr,onKeyDown:I(`x`,()=>y(!v),k),children:[!1,!0].map(e=>(0,H.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-pressed":e===v,className:Rr(e===v),onClick:()=>{y(e),S.current.jump?.focus()},children:e?t.detail.jump.follow:t.detail.jump.stay},String(e)))})]}),(0,H.jsx)(`p`,{className:`touch:empty:hidden! text-muted ${VD}`,children:(0,H.jsx)(cp,{text:fu(i?t.detail.createLegend:t.detail.startLegend)})}),(0,H.jsxs)(`div`,{className:Nr,children:[i&&(0,H.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:A,children:B(`pages.storySave`)}),(0,H.jsx)(`button`,{type:`button`,className:xr(),onClick:k,children:B(i?`pages.storySaveStart`:`pages.storyStart`)})]})]}):a?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:Fr,children:[(0,H.jsx)(`span`,{className:`${W} text-muted`,children:t.detail.sessionLabel}),(0,H.jsxs)(`div`,{className:`${Lr} ${GD}`,children:[(0,H.jsx)(`button`,{ref:C(`open`),type:`button`,className:Rr(!0),onClick:()=>D({kind:`open`,taskId:a,...T()}),children:t.detail.openAction}),(0,H.jsx)(`button`,{ref:C(`unlink`),type:`button`,className:Rr(),onClick:()=>D({kind:`unlink`,...T()}),children:t.detail.unlinkAction})]})]}),(0,H.jsx)(YD,{model:e.model,taskId:a}),(0,H.jsx)(`p`,{className:`touch:empty:hidden! text-muted ${VD}`,children:(0,H.jsx)(cp,{text:fu(t.detail.openLegend)})})]}):(0,H.jsx)(`p`,{className:`touch:empty:hidden! text-muted ${VD}`,children:(0,H.jsx)(cp,{text:fu(t.detail.doneNote)})})]})]})})}var ZD={"waiting-on-you":`text-error`,landing:`text-success`,"ready-for-review":`text-ink`,working:`text-accent`};function QD(e){let[t,n]=(0,h.useState)(()=>{let t=X(e,`engines.list`);return t?Eu(t.engines):[]});return(0,h.useEffect)(()=>e.client.onOpen(()=>{Ku(e,`engines.list`).then(e=>n(Eu(e.engines))).catch(()=>{})}),[e]),{engines:t,defaultEngine:Du(t)}}function $D(e,t){let n=CE(e),r=n.join(`
57
+ `),[i,a]=(0,h.useState)(()=>X(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])=>SE(e,n,t)).then(e=>Promise.all(e.map(e=>r.request(`issue.list`,{repo:e}).catch(t=>({repoRoot:e,nextId:1,issues:[],readError:yE(t)}))))).then(n=>{let r=Gu(e,`kanban.boards`,void 0,[...n].sort((e,t)=>e.repoRoot.localeCompare(t.repoRoot)));t&&a(r)}),()=>{t=!1}},[e,t,r]),i}function eO(e){let{issue:t}=e,n=t.body.trim();return(0,H.jsxs)(`div`,{"data-issue":t.id,className:kD({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,H.jsxs)(`div`,{className:AD,children:[(0,H.jsx)(`span`,{className:jD(e.column===`done`),children:t.title}),(0,H.jsxs)(`span`,{className:`mono text-muted`,children:[`#`,t.id]})]}),(0,H.jsx)(`div`,{className:`text-muted ${MD}`,children:n}),(0,H.jsxs)(`div`,{className:`mono text-muted ${ND}`,children:[(0,H.jsx)(`span`,{children:t.created}),e.badge&&(0,H.jsx)(`span`,{className:e.badge.tone,children:e.badge.label})]})]})}var tO=5e3,nO=760;function rO({model:e}){let{kanban:t,group:n,common:r}=_E(),[i,a]=TE(tO),o=$D(e,i),{engines:s,defaultEngine:c}=QD(e),l=y(e.tasks),u=wE(e),[d,f]=(0,h.useState)(null),[p,m]=(0,h.useState)(null),g=OE(),[_,v]=(0,h.useState)(!1);(0,h.useEffect)(()=>{let e=g.current;if(!e)return;let t=new ResizeObserver(()=>v(e.clientWidth<nO));return t.observe(e),()=>t.disconnect()},[g]);let b=o??[],x=u?b.find(e=>e.repoRoot.replace(/^\/private\//,`/`)===u.replace(/^\/private\//,`/`)):void 0,w=Math.max(0,b.findIndex(e=>e.repoRoot===(d??x?.repoRoot))),T=b[w],E=b.map(e=>e.repoRoot),D=b.filter(e=>e.readError).map(e=>`${e.repoRoot}\0${e.readError}`).join(`
58
+ `);(0,h.useEffect)(()=>{for(let e of b)e.readError&&L($(t.readFailedToast,{repo:xE(e.repoRoot,E),error:e.readError}),`error`)},[D]);let k=l?.tasks??[],A=new Set(k.map(e=>e.id)),j=e=>k.find(t=>t.id===e)?.group,{columns:M,attentionCount:N}=cD(T?uD(T.issues,A.size===0?void 0:e=>A.has(e)):[],e=>j(e)===`waiting-on-you`),P={backlog:t.column.backlog,in_progress:t.column.inProgress,parked:t.column.parked,done:t.column.done},ee=(e,t)=>{let r=e.taskId&&(t===`in_progress`||t===`parked`)?j(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:ZD[r]??`text-muted`}:null},F=async(t,n,r,i)=>{try{return await e.client.request(t,{repo:T?.repoRoot,...n})}catch(e){return L($(r,{id:String(i),error:yE(e)}),`error`),null}finally{a()}},I=(e,n)=>F(`issue.setStatus`,{id:e.id,status:n},t.statusFailed,e.id),te=t=>{O.set(null),e.select(t)},ne=async(n,r,i)=>{try{let a=await fD(e.client,{repo:n,issue:r,engine:i.engine,placement:i.placement});for(let e of a.warnings)L($(e.kind===`link`?t.linkFailed:t.statusFailed,{id:String(r.id),error:e.error}),`error`);i.jump?(O.set(null),e.selectWhenListed(a.taskId)):L($(t.detail.startedBackground,{title:`#${r.id} ${r.title}`}))}catch(e){L(G(e),`error`)}finally{a()}},re=async(e,n)=>{if(!T||n.kind===`create`)return;let r={};n.title!==e.title&&(r.title=n.title),n.body!==e.body&&(r.body=n.body),(r.title!==void 0||r.body!==void 0)&&await F(`issue.update`,{id:e.id,...r},t.updateFailed,e.id),n.status!==e.status&&await I(e,n.status),n.kind===`open`?te(n.taskId):n.kind===`unlink`?await F(`issue.update`,{id:e.id,task:`none`},t.unlinkFailed,e.id):n.kind===`start`&&await ne(T.repoRoot,{...e,...r},n)},ie=t=>{T&&(m(t.id),C.set((0,H.jsx)(XD,{model:e,issue:t,mode:`detail`,engines:s,defaultEngine:c,onOutcome:e=>void re(t,e)})))},ae=()=>{if(!T)return;let n=T.repoRoot,r={id:T.nextId,title:``,status:`open`,created:new Date().toISOString().slice(0,10),body:``};C.set((0,H.jsx)(XD,{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 ne(n,o,i.start)}catch(e){L($(t.createFailed,{error:yE(e)}),`error`)}})()}}))},oe=()=>{let n=T?.issues.find(e=>e.id===p);if(!T||!n)return;let i=T.repoRoot;C.set((0,H.jsx)(Ti,{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){L($(t.deleteFailed,{id:String(n.id),error:yE(e)}),`error`)}finally{a()}}}))},R=e=>{b.length!==0&&(f(b[(w+e+b.length)%b.length]?.repoRoot??null),m(null))},z=e=>{let t=oD(M,p,e);t!=null&&m(t)},se=e=>M.some(e=>e.issues.length>0)?z(e):R(e===`left`?-1:1);DE(e=>{if(e.ctrlKey)return e.key===`c`&&(O.set(null),!0);switch(e.key){case`Escape`:case`q`:return O.set(null),!0;case`r`:return a(),!0;case`Tab`:return R(e.shiftKey?-1:1),!0;case`ArrowUp`:return z(`up`),!0;case`ArrowDown`:return z(`down`),!0;case`ArrowRight`:case`l`:return se(`right`),!0;case`ArrowLeft`:case`h`:return se(`left`),!0;case`Enter`:{let e=T?.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 ce=(0,h.useRef)(null);(0,h.useEffect)(()=>{ce.current?.querySelector(`[data-issue="${p}"]`)?.scrollIntoView({block:`nearest`})},[p]);let le=(e,n,r)=>{m(e.id),S.set({x:n,y:r,items:JD.filter(t=>t!==e.status).map(n=>({label:$(t.menu.setStatus,{status:t.detail.status[n]}),run:()=>void I(e,n)}))})},ue=M.find(e=>e.issues.some(e=>e.id===p))??M.find(e=>e.issues.length>0)??M[0],de=(e,n=!1)=>{let r=$(t.attention,{count:String(N)});return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`span`,{children:[P[e.key],` (`,e.issues.length+e.hiddenCount,`)`]}),e.key===`in_progress`&&N>0&&(0,H.jsx)(`span`,{className:`text-warning`,title:n?r:void 0,children:n?`!${N}`:r})]})},fe=(e,n)=>(0,H.jsxs)(`section`,{className:TD(!n),children:[n&&(0,H.jsx)(`h2`,{className:ED(e.key),children:de(e)}),(0,H.jsxs)(`div`,{className:DD,children:[e.issues.map(t=>(0,H.jsx)(eO,{issue:t,column:e.key,selected:t.id===p,badge:ee(t,e.key),onSelect:()=>m(t.id),onOpen:()=>ie(t),onMenu:(e,n)=>le(t,e,n)},t.id)),e.issues.length===0&&e.hiddenCount===0&&(0,H.jsx)(`p`,{className:`mono text-muted ${OD}`,children:t.columnEmpty}),e.hiddenCount>0&&(0,H.jsx)(`p`,{className:`mono text-muted ${OD}`,children:$(t.more,{count:String(e.hiddenCount)})})]})]},e.key);return(0,H.jsxs)(`div`,{className:`${Ox} ${hD}`,tabIndex:0,ref:g,children:[(0,H.jsxs)(`div`,{className:`kb-top`,children:[(0,H.jsx)(`h1`,{className:Ax,children:t.title}),(0,H.jsx)(`span`,{className:`mono keys-only text-muted`,children:t.hint}),(0,H.jsxs)(`span`,{className:`mono ${Nx}`,children:[(0,H.jsx)(`button`,{type:`button`,className:`${Ar} ${Px.kanban}`,disabled:!T,onClick:ae,children:B(`pages.new`)}),(0,H.jsx)(`button`,{type:`button`,className:`${Ar} ${Px.kanban}`,disabled:!T?.issues.some(e=>e.id===p),onClick:oe,children:B(`pages.delete`)})]})]}),o===null?(0,H.jsx)(`p`,{className:`text-muted`,children:t.loading}):T?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:gD,children:[(0,H.jsxs)(`button`,{type:`button`,className:_D,onClick:()=>R(1),children:[xE(T.repoRoot,E),b.length>1&&(0,H.jsx)(`span`,{className:`text-muted`,children:` ${w+1}/${b.length}`})]}),!_&&(0,H.jsx)(`span`,{className:`mono text-muted ${vD}`,children:T.repoRoot}),T.issues.length===0&&!T.readError&&(0,H.jsx)(`span`,{className:`text-muted ${yD}`,children:t.empty})]}),T.readError?(0,H.jsx)(`p`,{className:`text-error`,children:$(t.readFailed,{error:T.readError})}):_&&ue?(0,H.jsxs)(`div`,{className:xD,ref:ce,children:[(0,H.jsx)(`div`,{className:`mono ${SD}`,children:M.map(e=>(0,H.jsx)(`button`,{type:`button`,className:CD(e.key===ue.key),onClick:()=>{let t=e.issues[0];t&&m(t.id)},children:de(e,!0)},e.key))}),fe(ue,!1)]}):(0,H.jsx)(`div`,{className:bD,ref:ce,children:M.map(e=>fe(e,!0))})]}):(0,H.jsx)(`p`,{className:`text-muted`,children:t.noRepos})]})}var iO={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})`},aO={title:`Mods`,empty:`当前没有 mod 在绘制内容。`,emptyHint:`声明了 [mod] 的插件会在这里绘制面板,TUI 和 web 显示的是同一份。`,keys:`↑↓/tab 移动 · enter 按下 · esc 返回`,pressFailed:`{plugin}:按键没有送达 mod({reason})`},oO={info:`text-info`,success:`text-success`,warning:`text-warning`,error:`text-error`,muted:`text-muted`},sO=`flex flex-col gap-3`,cO=`[&_p]:mx-0 [&_p]:my-1`,lO=`rounded-md border-hairline border-line px-3 pt-2 pb-3 font-mono`,uO=`mb-2 text-meta leading-[inherit] text-ink`,dO=(e,t)=>`flex min-w-0 items-start ${e?`[&>form]:flex-[1_1_12em] [&>form]:self-center`:``} ${t?`rounded-sm border-hairline border-line`:``}`,fO=(e,t)=>`whitespace-pre-wrap wrap-anywhere ${e?oO[e]:`text-ink`} ${t?`font-bold`:``}`,pO=(e,t)=>`cursor-pointer rounded-sm border-hairline border-current px-2.5 py-0.5 [font:inherit] font-bold! ${oO[e]} ${t?`bg-[color-mix(in_srgb,currentcolor_18%,transparent)]`:`bg-transparent [&:hover]:bg-[color-mix(in_srgb,currentcolor_18%,transparent)]`}`,mO=`flex min-w-0 max-w-[40em] self-stretch`,hO=`w-full font-mono`,gO=[0,6,12,20];function _O(e){return`mod-${e.kind}:${e.plugin}/${e.pane}/${e.key}`}function vO(e){let[t,n]=(0,h.useState)(e.value??``);return(0,H.jsx)(`form`,{className:mO,onSubmit:r=>{r.preventDefault(),e.onSubmit(t),n(e.value??``)},children:(0,H.jsx)(`input`,{id:e.id,className:`${Mr} ${hO}`,spellCheck:!1,value:t,placeholder:e.placeholder,onFocus:e.onFocus,onChange:e=>n(e.target.value)})})}function yO(e){let{node:t}=e;if(t.type===`text`)return(0,H.jsx)(`span`,{className:fO(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,H.jsx)(vO,{id:_O(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,H.jsx)(`button`,{type:`button`,id:_O(n),className:pO(t.tone??`info`,Ha(n,e.cursor)),onFocus:()=>e.onFocus(n),onClick:()=>e.onPress(n),children:t.label})}return(0,H.jsx)(`div`,{className:dO(t.direction===`row`,t.border===!0),style:{flexDirection:t.direction??`column`,gap:gO[t.gap??0],padding:gO[t.padding??0]},children:t.children.map((t,n)=>(0,H.jsx)(yO,{...e,node:t},n))})}function bO({model:e}){let t=V()===`zh`?aO:iO,n=y(e.mods),r=Va(n),[i,a]=(0,h.useState)(null),o=Ua(r,i),s=OE(),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=>L(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=Wa(r,o,e);a(t),t&&document.getElementById(_O(t))?.focus()};return DE(e=>{if(e.ctrlKey)return e.key===`c`&&(O.set(null),!0);switch(e.key){case`Escape`:case`q`:return O.set(null),!0;case`ArrowDown`:return f(1),!0;case`ArrowUp`:return f(-1),!0;case`Enter`:return e.target instanceof HTMLButtonElement?!1:(o?.kind===`button`&&u(o),!0);default:return!1}}),(0,H.jsxs)(`div`,{className:`${kx} ${sO}`,tabIndex:0,ref:s,children:[(0,H.jsxs)(`div`,{className:jx,children:[(0,H.jsx)(`h1`,{className:Ax,children:t.title}),(0,H.jsx)(`span`,{className:`keys-only touch:empty:hidden! text-muted ${Mx(!1)}`,children:t.keys})]}),n.length===0?(0,H.jsxs)(`div`,{className:cO,children:[(0,H.jsx)(`p`,{children:t.empty}),(0,H.jsx)(`p`,{className:`text-muted`,children:t.emptyHint})]}):n.map(e=>(0,H.jsxs)(`section`,{className:lO,children:[(0,H.jsxs)(`header`,{className:uO,children:[e.title,` `,(0,H.jsx)(`span`,{className:`text-muted`,children:e.plugin})]}),(0,H.jsx)(yO,{node:e.tree,pane:e,cursor:o,onPress:u,onSubmit:d,onFocus:a})]},`${e.plugin}/${e.id}`))]})}function xO(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 SO(e){return e===`dispatch_failed`||e===`skipped_unavailable`||e===`script_failed`}function CO(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 wO=6e4,TO=3294,EO=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]]),DO=new Map([[`SUN`,0],[`MON`,1],[`TUE`,2],[`WED`,3],[`THU`,4],[`FRI`,5],[`SAT`,6]]),OO=256;function kO(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 AO(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=kO(t,e.names,e.field),c=kO(i,e.names,e.field)}else s=kO(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 jO(e){if(e.length>OO)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:AO({value:n,min:0,max:59,field:`minute`}),hours:AO({value:r,min:0,max:23,field:`hour`}),daysOfMonth:AO({value:i,min:1,max:31,field:`day-of-month`}),months:AO({value:a,min:1,max:12,field:`month`,names:EO}),daysOfWeek:AO({value:o,min:0,max:7,field:`weekday`,names:DO,normalize:e=>e%7}),dayOfMonthRestricted:!i.startsWith(`*`),dayOfWeekRestricted:!o.startsWith(`*`)}}function MO(e){try{return jO(e),!0}catch{return!1}}function NO(e,t,n){return new Date(e.year,e.month-1,e.day,t,n,0,0).getTime()}function PO(e){let t=new Date(e);return{year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()}}function FO(e,t){return PO(new Date(e.year,e.month-1,e.day+t,12,0,0,0).getTime())}function IO(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 LO(e){return e-e%wO}function RO(e,t){return[...e].sort((e,n)=>(e-n)*t)}function zO(e,t){let n=jO(e),r=RO(n.hours,1),i=RO(n.minutes,1),a=new Date(LO(t)+wO),o=PO(a.getTime()),s=a.getHours(),c=a.getMinutes();for(let e=0;e<TO;e++){if(IO(n,o)){for(let e of r)if(!(e<s))for(let n of i){if(e===s&&n<c)continue;let r=NO(o,e,n);if(r>t)return r}}o=FO(o,1),s=0,c=0}throw Error(`cron expression never matches: ${e}`)}var BO=[`minute`,`hour`,`dayOfMonth`,`month`,`dayOfWeek`];function VO(e){let t=e.trim().split(/\s+/).filter(Boolean);return BO.map((e,n)=>t[n]??`*`)}function HO(e){return BO.map((t,n)=>e[n]??`*`).join(` `)}var UO=[`*`,`*/5`,`*/10`,`*/15`,`*/30`,...YO(0,59)],WO=[`*`,`*/2`,`*/3`,`*/4`,`*/6`,`*/12`,...YO(0,23)],GO=[`*`,...YO(1,31)],KO=[`*`,`JAN`,`FEB`,`MAR`,`APR`,`MAY`,`JUN`,`JUL`,`AUG`,`SEP`,`OCT`,`NOV`,`DEC`],qO=[`*`,`MON-FRI`,`SAT,SUN`,`MON`,`TUE`,`WED`,`THU`,`FRI`,`SAT`,`SUN`],JO=[`MON`,`TUE`,`WED`,`THU`,`FRI`,`SAT`,`SUN`];function YO(e,t){let n=[];for(let r=e;r<=t;r++)n.push(String(r));return n}var XO={minute:UO,hour:WO,dayOfMonth:GO,month:KO,dayOfWeek:qO};function ZO(e,t,n){let r=XO[e],i=r.indexOf(t.trim().toUpperCase());return i<0?(n>0?r[0]:r[r.length-1])??t:r[(i+n+r.length)%r.length]??t}function QO(e,t){return Math.min(Math.max(e+t,0),BO.length-1)}function $O(e,t,n){let r=VO(e);return t<0||t>=BO.length||(r[t]=n),HO(r)}function ek(e,t){let[n,r,i,a,o]=VO(e);if(a!==`*`||i!==`*`||n===void 0||r===void 0||o===void 0)return null;let s=tk(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=JO.find(e=>e===o.toUpperCase());return u?t(`automations.schedule.onWeekday`,{weekday:t(`automations.schedule.dow.${u}`),at:c}):null}function tk(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 nk(e,t,n,r){let i=e.trim();if(!MO(i))return{kind:`invalid`};let a;try{a=zO(i,t)}catch{return{kind:`never`}}return{kind:`ok`,nextRunMs:a,relative:rk(a-t,n),absolute:ik(a,t,n,r)}}function rk(e,t){let{minutes:n,hours:r,days:i}=GE(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 ik(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 ak(e,t){let n=t?.trim()??``;return n&&e?.effortLevels?.includes(n)?n:``}function ok(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:_}=Ci();(0,h.useEffect)(()=>{Promise.all([t.client.request(`engines.list`),e.current()]).then(([e,t])=>{let n=Eu(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(ak(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(ak(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,H.jsx)(Si,{title:q(`tasks`,`changeEngine.title`),wide:!0,children:(0,H.jsxs)(`form`,{className:Gr,onKeyDown:T,onSubmit:e=>{e.preventDefault(),E()},children:[(0,H.jsx)(`ul`,{className:zr,"aria-label":q(`tasks`,`changeEngine.title`),children:n.map(e=>(0,H.jsx)(`li`,{children:(0,H.jsxs)(`button`,{type:`button`,"aria-pressed":e.id===o,className:hi({selected:e.id===o}),onClick:()=>S(e.id),children:[(0,H.jsx)(`span`,{className:`${yi} text-accent`,children:e.id===o?`●`:` `}),(0,H.jsx)(`span`,{className:gi,children:e.name}),e.id===i.engine&&(0,H.jsx)(`span`,{className:`text-muted`,children:q(`tasks`,`changeEngine.current`)})]})},e.id))}),f&&v&&v.acceptsModel&&(0,H.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:q(`tasks`,`engineModel.label`)}),(0,H.jsx)(`input`,{className:Mr,spellCheck:!1,placeholder:q(`tasks`,`engineModel.placeholder`),value:u,onChange:e=>d(e.target.value)}),x.length>0&&(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:x.map(e=>(0,H.jsx)(`button`,{type:`button`,className:Rr(),onClick:()=>d(e),children:e},e))})]}),b.length>0&&(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:q(`tasks`,`changeEngine.effortLabel`)}),(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:b.map(e=>(0,H.jsx)(`button`,{type:`button`,"aria-pressed":e===c,className:Rr(e===c),onClick:()=>l(e),children:e===``?q(`tasks`,`changeEngine.noEffort`):e},e||`default`))})]}),(0,H.jsx)(`p`,{className:`keys-only ${Tr}`,children:(0,H.jsx)(cp,{text:[q(`tasks`,`changeEngine.footer.engine`),...v?.acceptsModel?[q(`tasks`,`changeEngine.footer.model`)]:[],...b.length>0?[q(`tasks`,`changeEngine.footer.effort`)]:[],q(`tasks`,`changeEngine.footer.set`),q(`tasks`,`changeEngine.footer.cancel`)].join(` · `)})}),g&&(0,H.jsx)(`p`,{className:`text-error`,children:g}),(0,H.jsx)(Di,{busy:m||!f,submitLabel:B(`taskops.set`)})]})})}var sk=`flex flex-col overflow-hidden @container`,ck=`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`,lk=`flex min-h-0 flex-col gap-3 overflow-y-auto scrollbar-none rt-narrow:shrink-0 rt-narrow:overflow-visible`,uk=`flex gap-1.5 px-2 pt-0 pb-1`,dk=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`}`,fk=`flex min-w-0 items-baseline gap-2.5`,pk=e=>`min-w-0 flex-1 truncate font-bold ${e?`text-muted`:``}`,mk=`whitespace-nowrap text-meta`,hk=`truncate text-meta`,gk=`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)]`,_k=`flex flex-wrap items-baseline justify-between gap-3`,vk=`font-sans text-display font-bold normal-nums wrap-anywhere`,yk=`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`,bk=`max-h-[12lh] overflow-y-auto rounded-sm bg-inset px-2.5 py-2 whitespace-pre-wrap wrap-anywhere`,xk=`min-w-0 text-meta leading-[inherit]`,Sk=`flex w-full min-w-0 gap-2 text-inherit`,Ck=Sk,wk=`${Sk} cursor-pointer border-none bg-transparent p-0 text-left font-[inherit] [&:hover]:underline`,Tk=`min-w-0 flex-1 truncate`,Ek=`[&+&]:mt-1.5`,Dk=e=>`whitespace-pre-wrap wrap-anywhere text-meta ${e?``:`leading-[inherit]`}`,Ok=`text-meta`,kk=`flex gap-4.5`,Ak=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`}`,jk=`hidden gap-2 px-1 pt-0.5 pb-1.5 touch:flex`,Mk=`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 Nk(e){let t=e.client,[n,r]=(0,h.useState)(()=>X(t,`pendingStart.list`)?.starts??[]);if((0,h.useEffect)(()=>{let e=!0;return Ku(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){L($(B(`pages.laterCancelFailed`),{error:yE(e)}),`error`)}};return(0,H.jsxs)(`section`,{"data-field":`later`,className:`mt-2.5`,children:[(0,H.jsxs)(`h2`,{className:`${W} ${uk} text-muted`,children:[B(`pages.laterStarts`),` `,(0,H.jsx)(`span`,{className:`mono`,children:n.length})]}),n.map(e=>(0,H.jsxs)(`div`,{className:dk(!1),children:[(0,H.jsxs)(`span`,{className:fk,children:[(0,H.jsx)(`span`,{className:pk(!1),children:e.title}),(0,H.jsx)(`span`,{className:`mono text-muted ${mk}`,title:new Date(e.at).toLocaleString(),children:wg(new Date(e.at))}),(0,H.jsx)(U,{className:`font-mono`,hit:`tight`,onClick:()=>void a(e),children:B(`pages.laterCancel`)})]}),(0,H.jsx)(`span`,{className:`mono text-muted ${hk}`,children:xE(e.repo,i)}),e.error&&(0,H.jsx)(`span`,{className:`mono text-warning truncate text-meta`,title:e.error,children:$(B(`pages.laterFailed`),{error:e.error})})]},e.id))]})}var Pk={name:``,repo:``,prompt:``,schedule:`0 9 * * MON-FRI`};function Fk(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))&&MO(e.schedule.trim())}function Ik(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`:MO(e.schedule.trim())?null:`schedule`}function Lk(e){let{auto:t,common:n}=_E(),r=vE(),i=V()===`zh`?`zh-CN`:`en-US`,[a,o]=(0,h.useState)(()=>({...Pk,repo:e.repos.find(t=>e.defaultRepo&&bE(t)===bE(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(),z())};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},[]);let m=()=>{if(Fk(a)){z(),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=Ik(a);n&&(d.current[n]?.focus(),u(Reflect.get(t.missing,n)))},g=a.repo===null?[]:e.tasks.filter(e=>bE(e.repo)===bE(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=VO(a.schedule),w=e=>{let t=BO[s];t&&p({schedule:$O(a.schedule,s,ZO(t,C[s]??`*`,e))})},T=e=>{if(!(e.ctrlKey||e.metaKey||e.altKey)){if(e.key===`ArrowLeft`||e.key===`h`)c(QO(s,-1));else if(e.key===`ArrowRight`||e.key===`l`)c(QO(s,1));else if(e.key===`ArrowUp`||e.key===`ArrowDown`)w(e.key===`ArrowUp`?1:-1);else return;e.preventDefault()}},E=nk(a.schedule,Date.now(),r,i),D=ek(a.schedule,r);return(0,H.jsx)(`div`,{className:Br,onMouseDown:e=>e.target===e.currentTarget&&z(),children:(0,H.jsxs)(`dialog`,{open:!0,className:`${Vr(!0)} ${PD}`,"aria-label":t.newTitle,children:[(0,H.jsx)(`h1`,{className:`${W} text-muted`,children:t.newTitle}),(0,H.jsxs)(`div`,{className:Gr,children:[(0,H.jsxs)(`label`,{className:Fr,children:[(0,H.jsx)(`span`,{className:`${W} text-muted`,children:t.fieldName}),(0,H.jsx)(`input`,{ref:f(`name`),className:Mr,spellCheck:!1,placeholder:t.namePlaceholder,value:a.name,onChange:e=>p({name:e.target.value}),onKeyDown:S(`repo`)})]}),(0,H.jsxs)(`div`,{className:Fr,children:[(0,H.jsxs)(`span`,{className:`${W} text-muted ${ID}`,children:[t.fieldRepo,(0,H.jsx)(`span`,{className:`keys-only text-muted ${LD}`,children:`↑/↓`})]}),(0,H.jsx)(qD,{fieldRef:f(`repo`),kind:`list`,label:t.fieldRepo,className:zD,onKeyDown:x(b),children:y.map(t=>(0,H.jsxs)(`button`,{type:`button`,tabIndex:-1,"aria-selected":t===a.repo,className:`touch:py-1.5 ${BD(t===a.repo)}`,onClick:()=>{p({repo:t,target:void 0}),d.current.repo?.focus()},children:[t===a.repo?`▸ `:` `,t===null?B(`rail.noProject`):xE(t,e.repos)]},t??``))})]}),(0,H.jsxs)(`div`,{className:Fr,children:[(0,H.jsxs)(`span`,{className:`${W} text-muted ${ID}`,children:[t.fieldTarget,(0,H.jsx)(`span`,{className:`keys-only text-muted ${LD}`,children:`↑/↓`})]}),(0,H.jsx)(qD,{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,H.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:t.fieldTargetTab}),(0,H.jsx)(`input`,{ref:f(`targetTab`),className:Mr,spellCheck:!1,value:a.target.tabId,onChange:e=>a.target&&p({target:{...a.target,tabId:e.target.value}}),onKeyDown:S(`prompt`)})]}),(0,H.jsxs)(`label`,{className:Fr,children:[(0,H.jsx)(`span`,{className:`${W} text-muted`,children:t.fieldPrompt}),(0,H.jsx)(`input`,{ref:f(`prompt`),className:Mr,spellCheck:!1,placeholder:t.promptPlaceholder,value:a.prompt,onChange:e=>p({prompt:e.target.value}),onKeyDown:S(`schedule`)})]}),(0,H.jsxs)(`div`,{className:Fr,children:[(0,H.jsxs)(`span`,{className:`${W} text-muted ${ID}`,children:[t.fieldSchedule,(0,H.jsx)(`span`,{className:`keys-only text-muted ${LD}`,children:`←/→ ↑/↓`})]}),(0,H.jsx)(qD,{fieldRef:f(`schedule`),kind:`cells`,label:t.fieldSchedule,className:kk,onKeyDown:T,children:BO.map((e,n)=>(0,H.jsxs)(`button`,{type:`button`,tabIndex:-1,className:Ak(n===s),onClick:()=>{c(n),d.current.schedule?.focus()},children:[C[n]??`*`,(0,H.jsx)(`span`,{children:t.cronField[e]})]},e))}),(0,H.jsx)(`div`,{className:jk,children:[-1,1].map(e=>{let n=t.cronField[BO[s]??`minute`]??``;return(0,H.jsx)(`button`,{type:`button`,tabIndex:-1,className:Mk,"aria-label":B(e<0?`pages.cronDown`:`pages.cronUp`,{field:n}),onClick:()=>{w(e),d.current.schedule?.focus()},children:e<0?`−`:`+`},e)})}),E.kind===`ok`?(0,H.jsxs)(`p`,{className:`mono text-success`,children:[D?`${D}, `:``,E.relative,`, `,E.absolute]}):(0,H.jsx)(`p`,{className:`mono text-error`,children:E.kind===`never`?t.cronNever:t.cronInvalid})]}),l&&(0,H.jsxs)(`p`,{className:`text-error`,children:[`※ `,l]}),(0,H.jsx)(`p`,{className:`touch:empty:hidden! text-muted ${VD}`,children:(0,H.jsx)(cp,{text:fu(t.composerLegend)})}),(0,H.jsxs)(`div`,{className:Nr,children:[(0,H.jsx)(`button`,{type:`button`,className:Ar,onClick:z,children:n.cancel}),(0,H.jsx)(`button`,{ref:f(`confirm`),type:`button`,className:xr(),onClick:m,children:n.create})]})]})]})})}var Rk=[`ok`,`blocked`,`failed`,`skipped`];function zk(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 Bk={scheduled:`schedule`,manual:`manual`,webhook:`webhook`};function Vk(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 Hk(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 Uk(e,t){return e.filter(e=>t===null||zk(e)===t).sort((e,t)=>Date.parse(t.at)-Date.parse(e.at)||t.runNumber-e.runNumber)}function Wk(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 Gk=(e,t)=>e&&typeof e==`object`?Reflect.get(e,t):void 0;function Kk(e){let t=Wk(e);if(!t)return{summary:e,full:e};let n=Gk(t.value,`error`)??t.value,r=Gk(n,`message`),i=Gk(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 qk(e){let t=e.trim();if(!/^[[{]/.test(t))return e;try{return JSON.stringify(JSON.parse(t),null,2)}catch{return e}}var Jk={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`},Yk={success:`text-success`,muted:`text-muted`,warning:`text-warning`,error:`text-error`},Xk={success:`✓`,error:`†`,warning:`!`,muted:`·`},Zk=e=>Jk[e]??`muted`;function Qk(e){let{auto:t}=_E(),{runs:n,when:r}=e,i=e=>t.runStatus[e]??e,a=n.filter(e=>e.response);return(0,H.jsxs)(H.Fragment,{children:[n[0]?.precheckResult&&(0,H.jsx)($k,{run:n[0]}),(0,H.jsx)(`h2`,{className:`${W} text-muted`,children:t.responses}),a.length===0?(0,H.jsx)(`p`,{className:`text-muted`,children:t.noResponses}):a.map(e=>(0,H.jsxs)(`div`,{className:Ek,children:[(0,H.jsx)(`p`,{className:`mono ${Ok} ${Yk[Zk(e.status)]}`,children:`#${e.runNumber} ${i(e.status)}, ${r(e.response?.at)}`}),(0,H.jsx)(`p`,{className:Dk(!1),children:qk(e.response?.text??``)})]},e.id))]})}function $k({run:e}){let{auto:t}=_E(),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,H.jsxs)(`div`,{children:[(0,H.jsx)(`h2`,{className:`${W} text-muted`,children:$(t.precheckDetail,{exit:r,duration:String(n.durationMs)})}),i.length===0?(0,H.jsx)(`p`,{className:`text-muted`,children:t.precheckNoOutput}):i.map(e=>(0,H.jsx)(`p`,{className:`mono ${Dk(!0)}`,children:`${e.label}: ${e.text.replace(/\s+$/,``).split(`
59
59
  `).slice(-10).join(`
60
- `)}`},e.label))]})}var nA=30;function rA(e,t,n){let r=t.join(`\0`),[i,a]=(0,h.useState)(()=>Object.fromEntries(t.map(t=>[t,X(e,`routine.runs`,{id:t})?.runs??[]])));return(0,h.useEffect)(()=>{let n=!0;for(let r of t)Ku(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 iA(e){V();let{auto:t}=yE(),[n,r]=(0,h.useState)(null),i=Gk(e.runs,n),a=e=>{if(e.status===`skipped_blocked`){let t=e.blocked?.reason;return t?$(B(`runLog.blockedRun`),{reason:B(`runLog.blocked.${t}`)}):B(`runLog.outcome.blocked`)}return t.runStatus[e.status]??e.status},o=(e,t,n,r)=>(0,H.jsx)(U,{variant:`pill`,hit:`tight`,"aria-current":t,className:`max-w-40 truncate`,onClick:n,children:`[ ${e} ]`},r);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`h2`,{className:`${W} text-muted`,children:B(`runLog.title`)}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1`,children:[o(B(`runLog.all`),n===null,()=>r(null),`all`),Bk.map(e=>o(B(`runLog.outcome.${e}`),n===e,()=>r(e),e))]}),i.length===0?(0,H.jsx)(`p`,{className:`text-muted`,children:e.runs.length===0?t.noRuns:B(`runLog.empty`)}):i.slice(0,nA).map(n=>{let r=$k(n.status),i=TO(n,e.now),o=i===`awaiting`?`, ${t.responseAwaiting}`:i===`missing`?`, ${t.responseMissing}`:``,s=Uk(n),c=(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{children:Qk[r]}),(0,H.jsx)(`span`,{children:`#${n.runNumber}`}),(0,H.jsx)(`span`,{className:Dk,children:`${a(n)}${n.tabId?`, ${n.tabId}`:``}${o}`}),(0,H.jsx)(`span`,{className:`text-subtle`,children:B(`runLog.source.${Hk[n.trigger]}`)}),s!==null&&(0,H.jsx)(`span`,{className:`text-muted`,children:Wk(s)}),(0,H.jsx)(`span`,{className:`text-muted`,children:e.when(n.at)})]}),l=n.error?Jk(n.error):null,u=n.taskId,d=i===`missing`?`text-warning`:Zk[r];return(0,H.jsxs)(`div`,{className:`${Ck} ${d}`,children:[u?(0,H.jsx)(`button`,{type:`button`,className:`mono ${Ek}`,onClick:()=>e.openRun(u),children:c}):(0,H.jsx)(`span`,{className:`mono ${Tk}`,children:c}),l&&(0,H.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,H.jsx)(`summary`,{children:l.summary}),(0,H.jsx)(`pre`,{children:l.full})]})]},n.id)}),i.length>nA&&(0,H.jsx)(`p`,{className:`text-muted`,children:B(`runLog.more`,{count:i.length-nA})})]})}function aA(e){let{auto:t}=yE(),n=bE(),r=V()===`zh`?`zh-CN`:`en-US`,{routine:i,busy:a,when:o}=e,s=nk(i.schedule,n),c=i.nextRunAt?Date.parse(i.nextRunAt):NaN;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:yk,children:[(0,H.jsx)(`h2`,{className:bk,children:i.name}),(0,H.jsxs)(`span`,{className:`mono ${Fx}`,children:[(0,H.jsx)(`button`,{type:`button`,className:`${Ar} ${Ix.row}`,disabled:a,onClick:e.onRunNow,children:t.runNow}),(0,H.jsx)(`button`,{type:`button`,className:`${Ar} ${Ix.row}`,disabled:a,onClick:e.onToggle,children:B(i.enabled?`pages.routinePause`:`pages.routineEnable`)}),(0,H.jsx)(`button`,{type:`button`,className:`${Ar} ${Ix.row}`,disabled:a,onClick:e.onDelete,children:B(`pages.delete`)})]})]}),(0,H.jsxs)(`dl`,{className:xk,children:[(0,H.jsx)(`dt`,{className:`text-muted`,children:B(`pages.routineSchedule`)}),(0,H.jsxs)(`dd`,{children:[s??(0,H.jsx)(`span`,{className:`mono`,children:i.schedule}),s&&(0,H.jsx)(`span`,{className:`mono text-muted`,children:` ${i.schedule}`})]}),(0,H.jsx)(`dt`,{className:`text-muted`,children:B(`pages.routineNext`)}),(0,H.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,H.jsx)(`dt`,{className:`text-muted`,children:B(`pages.routineProject`)}),(0,H.jsx)(`dd`,{children:e.project}),!i.script&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{className:`text-muted`,children:B(`pages.routineDelivers`)}),(0,H.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,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{className:`text-muted`,children:B(`pages.routineEngine`)}),(0,H.jsxs)(`dd`,{className:`flex flex-wrap items-baseline gap-x-3.5`,children:[(0,H.jsx)(`span`,{children:e.engine}),(0,H.jsx)(U,{className:`font-mono`,hit:`tight`,disabled:a,onClick:e.onChangeEngine,children:B(`pages.routineChangeEngine`)})]})]})]}),i.precheck&&(0,H.jsx)(`p`,{className:`mono text-muted`,children:$(t.precheck,{command:i.precheck.command})}),i.script?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`h2`,{className:`${W} text-muted`,children:B(`pages.routineScript`)}),(0,H.jsx)(`p`,{className:`mono ${Sk}`,children:i.script.command})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`h2`,{className:`${W} text-muted`,children:B(`pages.routinePrompt`)}),(0,H.jsx)(`p`,{className:Sk,children:i.prompt})]}),(0,H.jsx)(iA,{runs:e.runs,now:e.now,when:o,openRun:e.openRun}),(0,H.jsx)(eA,{runs:e.runs,when:o})]})}var oA=5e3;function sA({model:e}){let{auto:t,common:n}=yE(),r=e.client,[i,a]=DE(oA),o=y(e.tasks),s=TE(e),c=EE(e),[l,u]=(0,h.useState)(()=>X(r,`routine.list`)??null),[d,f]=(0,h.useState)(null),[p,m]=(0,h.useState)(null),[g,_]=(0,h.useState)(null),v=AE(),b=bE(),x=(0,h.useRef)(null);(0,h.useEffect)(()=>{let e=!0;return Ku(r,`routine.list`).then(t=>e&&u(t)).catch(()=>e&&u(e=>e??{automations:[],keepsDaemonAlive:!1})),()=>{e=!1}},[r,i]);let[S,w]=(0,h.useState)(()=>X(r,`engines.list`)?.engines??[]);(0,h.useEffect)(()=>r.onOpen(()=>{Ku(r,`engines.list`).then(e=>w(e.engines)).catch(()=>{})}),[r]);let T=l?.automations??[],E=l?.lastRunStatus??{},D=l?.lastFailure??{},A=e=>{let t=E[e.id];return t!==void 0&&wO(t)},j=[{key:`pages.routinesNeedYou`,rows:T.filter(A)},{key:`pages.routinesActive`,rows:T.filter(e=>e.enabled&&!A(e))},{key:`pages.routinesPaused`,rows:T.filter(e=>!e.enabled&&!A(e))}],M=j.flatMap(e=>e.rows),N=Math.max(0,M.findIndex(e=>e.id===d)),P=M[N],ee=e=>f(M[e]?.id??null),F=j[0]?.rows.length??0,I=y(k);(0,h.useEffect)(()=>{I===null||!l||(l.automations.some(e=>e.id===I)&&f(I),k.set(null))},[I,l]);let te=rA(r,P?[P.id]:[],i),ne=P?te[P.id]??[]:[];(0,h.useEffect)(()=>_(null),[P?.id]);let re=(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&&re.current&&e.offsetTop>re.current.offsetTop){e.scrollIntoView({block:`start`,behavior:`smooth`});return}re.current?.querySelector(`[data-row="${N}"]`)?.scrollIntoView({block:`nearest`})},[N,ie]);let R=Date.now(),z=e=>{let n=e?Date.parse(e):NaN;if(!Number.isFinite(n))return`—`;let r=n-R,i=r>=0,a=Math.floor(Math.abs(r)/6e4),o=Math.floor(a/60);return a<1?i?t.when.now:t.when.justNow:a<60?$(i?t.when.inMinutes:t.when.minutesAgo,{n:a}):o<24?$(i?t.when.inHours:t.when.hoursAgo,{n:o}):new Date(n).toLocaleDateString()},se=e=>o?.tasks.find(t=>t.id===e)?.label??e,ce=t=>{O.set(null),e.select(t)},le=(e,t,n)=>L($(e,{name:t,error:xE(n)}),`error`),ue=async()=>{if(!(!P||p)){m(P.id);try{await r.request(`routine.setEnabled`,{id:P.id,enabled:!P.enabled}),a()}catch(e){le(P.enabled?t.disableFailed:t.enableFailed,P.name,e)}finally{m(null)}}},de=async()=>{if(!(!P||p)){m(P.id),_($(t.running,{name:P.name}));try{let e=await r.request(`routine.runNow`,{id:P.id});_($(t.ranWith,{name:P.name,status:e.status})),a()}catch(e){le(t.runFailed,P.name,e)}finally{m(null)}}},fe=async()=>{if(p)return;let e=wE(await r.request(`repos.list`).then(e=>e.repos).catch(()=>[]),s);C.set((0,H.jsx)(zk,{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){L($(t.createFailed,{error:xE(e)}),`error`)}finally{m(null)}})()}}))},pe=()=>{if(!P||p)return;let e=P;C.set((0,H.jsx)(Ti,{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){le(t.deleteFailed,e.name,n)}finally{m(null)}}}))};kE(e=>{if(e.ctrlKey)return e.key===`c`&&(O.set(null),!0);switch(e.key){case`Escape`:case`q`:return O.set(null),!0;case`j`:case`ArrowDown`:return ee(Math.min(M.length-1,N+1)),!0;case`k`:case`ArrowUp`:return ee(Math.max(0,N-1)),!0;case`n`:return fe(),!0;case`r`:return a(),!0;case`e`:return ue(),!0;case`s`:return de(),!0;case`d`:return pe(),!0;case`Enter`:{let e=ne[0]?.taskId;return e?ce(e):ne.length>0&&_(t.latestRunNoTask),!0}default:return!1}});let me=e=>CO(e,e=>S.find(t=>t.id===e)?.name??e,t.engineDefault),he=()=>{if(!P)return;let n=P;C.set((0,H.jsx)(ck,{model:e,current:async()=>({engine:n.vendor,effort:n.modelEffort,model:n.model}),onSet:async e=>{let i=await r.request(`routine.setEngine`,{id:n.id,engine:e.engine.id,model:e.model??``,effort:e.effort??``});_($(i.releasedSessionTaskId?t.engineChangedNewSession:t.engineChanged,{name:n.name,engine:[e.engine.name,e.model,e.effort].filter(Boolean).join(` · `)})),a()}}))},ge=e=>e===void 0?B(`rail.noProject`):CE(e,T.flatMap(e=>e.repo??[]));return(0,H.jsxs)(`div`,{className:`${Ax} ${lk}`,tabIndex:0,ref:v,children:[(0,H.jsxs)(`div`,{className:Nx,children:[(0,H.jsx)(`h1`,{className:Mx,children:t.title}),(0,H.jsxs)(`span`,{className:`mono ${Fx}`,children:[F>0&&(0,H.jsx)(`span`,{className:`text-error`,children:$(t.needAttention,{count:String(F),total:String(M.length)})}),(0,H.jsx)(`span`,{className:`text-muted`,children:l?.keepsDaemonAlive?t.holdingDaemon:t.notHolding}),(0,H.jsx)(`button`,{type:`button`,className:`${Ar} ${Ix.header}`,onClick:()=>void fe(),children:B(`pages.new`)})]})]}),(0,H.jsx)(Fk,{client:r,tick:i,reload:a}),l===null?(0,H.jsx)(`p`,{className:`text-muted`,children:n.loading}):M.length===0?(0,H.jsxs)(`div`,{className:Lx,children:[(0,H.jsx)(`p`,{className:`text-muted`,children:t.empty}),(0,H.jsx)(`p`,{className:`keys-only`,children:t.emptyHint})]}):(0,H.jsxs)(`div`,{className:uk,children:[(0,H.jsx)(`div`,{className:dk,ref:re,children:j.map(e=>e.rows.length===0?null:(0,H.jsxs)(`section`,{children:[(0,H.jsxs)(`h2`,{className:`${W} ${fk} ${e===j[0]?`text-error`:`text-muted`}`,children:[B(e.key),` `,(0,H.jsx)(`span`,{className:`mono`,children:e.rows.length})]}),e.rows.map(e=>{let n=M.indexOf(e),r=E[e.id],i=r?$k(r):null;return(0,H.jsxs)(`div`,{"data-row":n,className:pk(n===N),onClick:()=>{ee(n),ae(e=>e+1)},children:[(0,H.jsxs)(`span`,{className:mk,children:[(0,H.jsx)(`span`,{className:hk(!e.enabled),children:e.name}),(0,H.jsx)(`span`,{className:`mono text-muted ${gk}`,children:e.enabled?z(e.nextRunAt):t.paused}),(0,H.jsx)(`span`,{className:`mono ${i?Zk[i]:`text-muted`}`,style:{width:`1ch`},children:i?Qk[i]:` `})]}),(0,H.jsx)(`span`,{className:`mono text-muted ${_k}`,title:e.schedule,children:[ge(e.repo),nk(e.schedule,b)??e.schedule,me(e)?.short].filter(Boolean).join(` · `)}),D[e.id]?(0,H.jsx)(`span`,{className:`mono text-warning ${_k}`,title:D[e.id]?.reason,children:$(t.lastFailed,{when:z(D[e.id]?.at),reason:D[e.id]?.reason??``})}):null]},e.id)})]},e.key))}),(0,H.jsx)(`div`,{className:vk,ref:x,children:P?(0,H.jsx)(aA,{routine:P,runs:ne,busy:p===P.id,project:ge(P.repo),engine:me(P)?.full??null,targetTitle:P.target?se(P.target.taskId):void 0,now:R,when:z,openRun:ce,onRunNow:()=>void de(),onToggle:()=>void ue(),onDelete:pe,onChangeEngine:he}):(0,H.jsx)(`p`,{className:`text-muted`,children:t.noSelection})})]}),g&&(0,H.jsx)(`p`,{className:`text-muted mx-0 mt-2 mb-0 text-meta leading-[inherit]`,children:g})]})}var cA=v({});function lA(e,t,n){let r=cA.get()[`${e}::${t.id}`];return r&&r.sig===Zd(n)&&Wd(n.root).some(e=>e.id===r.leaf)?r.leaf:n.activeLeafId}function uA(e,t,n,r){cA.set({...cA.get(),[`${e}::${t}`]:{sig:Zd(n),leaf:r}})}function dA(e,t,n,r){uA(e,t.id,n,r),Po(qu(e,t.id,r))?.focus()}function fA(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 pA(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){L(e instanceof Error?e.message:String(e),`error`)}}function mA(e,t,n,r,i){let a=i??(n.split?lA(t,n,n.split):`leaf-1`),o=e.selection.get();(o.taskId!==t||o.tabId!==n.id)&&e.select(t,n.id);let s=Po(qu(t,n.id,a))?.size();pA(e,{taskId:t,tabId:n.id,action:`open`,direction:r,leafId:a,...s},e=>{e.changed?e.split&&uA(t,n.id,e.split,e.leaf):L(B(`layout.splitTooSmall`),`error`)})}function hA(e,t,n,r){let i=n.split,a=i?lA(t,n,i):r,o=()=>pA(e,{taskId:t,tabId:n.id,action:`close`,leafId:r},e=>{let i=e.split;if(!i)return;let o=a!==r&&Wd(i.root).some(e=>e.id===a);uA(t,n.id,i,o?a:i.activeLeafId)});if(!i||!Yd(n,i,r)){o();return}C.set((0,H.jsx)(Ti,{title:B(`confirm.closePaneTitle`,{pane:Jd(i,Hd(n)).get(r)??r}),body:B(`confirm.closePaneBody`),confirmLabel:B(`menu.closePane`),onConfirm:o}))}function gA(e,t,n,r){let i=n.split;i&&C.set((0,H.jsx)(wi,{title:xl(`split.renameTitle`),initial:Jd(i,Hd(n)).get(r)??``,allowEmpty:!0,submitLabel:B(`dialog.save`),onSubmit:i=>pA(e,{taskId:t,tabId:n.id,action:`rename`,leafId:r,title:i})}))}function _A(e,t,n,r){return[{label:B(`menu.renamePane`),section:`split`,key:nl(`workspace.split.rename`)??void 0,run:()=>gA(e,t,n,r)},{label:B(`menu.closePane`),section:`split`,key:ba(`workspace.split.close`)||void 0,run:()=>hA(e,t,n,r)}]}function vA(e,t,n,r){return[{label:B(`menu.splitRight`),section:`split`,key:nl(`workspace.split.right`)??void 0,run:()=>mA(e,t,n,`right`,r)},{label:B(`menu.splitDown`),section:`split`,key:nl(`workspace.split.down`)??void 0,run:()=>mA(e,t,n,`down`,r)}]}function yA(e,t,n,r){let i=n.split,a=r??(i?lA(t,n,i):`leaf-1`);return[...vA(e,t,n,a),...Gd(i)?_A(e,t,n,a):[]]}function bA(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)??po(n);return!i||!Xd(i)?[]:vA(e,t,i,i.split?lA(t,i,i.split):`leaf-1`)}function xA({model:e,task:t}){let[n,r]=(0,h.useState)(()=>X(e,`task.get`,{taskId:t.id})?.task??null),[i,a]=(0,h.useState)(null),{busy:o,error:s,submit:c}=Ci();(0,h.useEffect)(()=>{Ku(e,`task.get`,{taskId:t.id}).then(e=>r(e.task)).catch(e=>a(G(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,H.jsx)(Si,{title:q(`tasks`,`runAgain.title`),wide:!0,children:(0,H.jsxs)(`form`,{className:Gr,onSubmit:e=>{e.preventDefault(),l()},children:[(0,H.jsx)(`p`,{className:`text-muted`,children:q(`tasks`,`runAgain.source`,{title:t.label})}),(0,H.jsx)(`pre`,{className:Er,children:n?.prompt??i??q(`tasks`,`fieldNotes.loading`)}),(0,H.jsx)(`p`,{className:Tr,children:q(`tasks`,`runAgain.hint`)}),s&&(0,H.jsx)(`p`,{className:`text-error`,children:s}),(0,H.jsx)(Di,{busy:o||!n?.prompt,submitLabel:q(`tasks`,`runAgain.confirm`)})]})})}function SA(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 CA({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:G(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(G(e))}}};return(0,H.jsx)(Si,{title:q(`tasks`,`fieldNotes.title`),wide:!0,children:(0,H.jsxs)(`div`,{className:Gr,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,H.jsx)(`p`,{className:`font-mono text-meta break-all text-muted`,children:t}),n.kind===`loading`&&(0,H.jsx)(`p`,{className:`text-muted`,children:q(`tasks`,`fieldNotes.loading`)}),n.kind===`error`&&(0,H.jsx)(`p`,{className:`text-error`,children:n.message}),n.kind===`ready`&&f.length===0&&(0,H.jsx)(`p`,{className:`text-muted`,children:q(`tasks`,`fieldNotes.empty`)}),f.length>0&&(0,H.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,H.jsx)(`li`,{children:(0,H.jsxs)(`button`,{type:`button`,className:Dr(t===i),onClick:()=>a(t),autoFocus:t===0,children:[(0,H.jsxs)(`span`,{className:`font-mono text-meta whitespace-pre text-accent`,children:[t===i?`▸ `:` `,SA(e.at),`, `,e.author]}),(0,H.jsx)(`span`,{className:`text-ink whitespace-pre-wrap wrap-anywhere`,children:e.text})]})},`${e.at}:${t}`))}),o&&(0,H.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-sm border-hairline border-line bg-paper px-3 py-2.5`,children:[(0,H.jsx)(`p`,{children:(0,H.jsx)(`strong`,{children:q(`tasks`,`fieldNotes.confirmDelete.title`)})}),(0,H.jsx)(`p`,{className:`text-muted`,children:q(`tasks`,`fieldNotes.confirmDelete.body`,{text:o.text})}),c&&(0,H.jsx)(`p`,{className:`text-error`,children:c}),(0,H.jsxs)(`div`,{className:`actions flex items-center justify-end gap-3.5`,children:[(0,H.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>s(null),children:B(`dialog.cancel`)}),(0,H.jsx)(`button`,{type:`button`,className:xr({danger:!0}),onClick:()=>void p(o),children:B(`taskops.retire`)})]})]}),!o&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{className:`keys-only font-sans text-meta text-subtle`,children:q(`tasks`,`fieldNotes.footerDeletable`)}),(0,H.jsxs)(`div`,{className:`actions flex items-center justify-end gap-3.5`,children:[(0,H.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,disabled:f[i]?.id===void 0,onClick:()=>s(f[i]??null),children:B(`taskops.retire`)}),(0,H.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:z,children:B(`taskops.close`)})]})]})]})})}var wA=[`backlog`,`in_progress`,`in_review`,`done`,`canceled`,`error`],TA={backlog:`status.backlog`,in_progress:`status.inProgress`,in_review:`status.inReview`,done:`status.done`,canceled:`status.canceled`,error:`status.error`},EA=e=>({binding:e,key:nl(e)??void 0});async function DA(e,t){if(!e){L(B(`menu.nothingToCopy`,{what:t}),`error`);return}try{await navigator.clipboard.writeText(e),L(B(`menu.copied`,{text:e}))}catch{L(B(`menu.copyFailed`),`error`)}}function OA(e,t,n){let r=[{label:B(`menu.newTask`),section:`open`,run:()=>xv(t)}],i=n.mainTaskId;return i&&(n.first||r.push({label:q(`tasks`,`menu.moveToTop`),section:`edit`,run:()=>void e.client.request(`task.move`,{taskId:i,direction:`top`}).catch(e=>L(q(`tasks`,`toast.moveFailed`,{error:String(e)}),`error`))}),r.push({label:q(`tasks`,`menu.reorderProject`),section:`edit`,...EA(`sidebar.localMerge`),run:()=>AA(i)})),r.push({label:B(`menu.viewSessions`),section:`open`,run:()=>_e(t)}),r.push({label:q(`tasks`,`menu.fieldNotes`),section:`notes`,run:()=>C.set((0,H.jsx)(CA,{model:e,repo:t}))}),i&&r.push({label:q(`tasks`,`menu.forgetProject`),section:`danger`,danger:!0,run:()=>C.set(Ny(e,t,n.label))}),r}function kA(e){return[{label:B(`menu.newChatNoFolder`),section:`open`,run:()=>Sv()},{label:B(`menu.newShell`),section:`open`,run:()=>void od(e).catch(e=>L(String(e),`error`))},{label:B(`menu.viewSessions`),section:`open`,run:()=>_e(``)}]}function AA(e){let t=!Lp.get();t&&e!==void 0&&Rp.set(e),zp(t),document.querySelector(`.rail`)?.focus()}function jA(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?(L(q(`tasks`,`moveToProject.empty`),`error`),null):(0,H.jsx)(Ei,{title:q(`tasks`,`moveToProject.title`),choices:r,onPick:async n=>{await e.client.request(`task.moveToProject`,{taskId:t.id,repo:n}),L(q(`tasks`,`toast.movedToProject`,{project:r.find(e=>e.value===n)?.label??n}))}})}function MA(e,t,n){let r=e.client,i=[];n&&(i.push({label:B(`menu.closeTab`),section:`tab`,run:()=>C.set((0,H.jsx)(Ti,{title:B(`confirm.closeTabTitle`,{tab:n.title??n.engineName??n.id}),body:B(`confirm.closeTabBody`),confirmLabel:B(`menu.closeTab`),onConfirm:async()=>{await e.closeTab(t.id,n.id)}}))}),i.push(...yA(e,t.id,n))),i.push({label:B(`menu.newChat`),section:`open`,run:()=>void id(e,t.id)}),i.push({label:B(`menu.newChatPick`),section:`open`,rare:!0,run:()=>C.set((0,H.jsx)(ud,{model:e,taskId:t.id}))}),i.push({label:B(`menu.continueEngine`),section:`open`,rare:!0,...EA(`chat.tab.fork`),run:()=>C.set((0,H.jsx)(ud,{model:e,taskId:t.id,context:`continue`,sourceTabId:n?.id}))}),i.push({label:B(`menu.newShell`),section:`open`,run:()=>void ad(e,t.id,{kind:`shell`}).catch(e=>L(String(e),`error`))}),t.kind===`task`&&t.ownsBranch===!0&&t.branch&&!t.sharesWorkspaceOf&&!t.machine&&!t.extraRepoCount&&i.push({label:q(`tasks`,`menu.newTaskFromBranch`),section:`open`,rare:!0,run:()=>te({repo:t.repo,baseBranch:t.branch,worktree:!0})}),t.startsAt&&(i.push({label:B(`menu.startNow`),section:`open`,run:()=>void e.client.request(`task.startScheduledNow`,{taskId:t.id}).catch(e=>L(String(e),`error`))}),i.push({label:B(`menu.cancelStart`),section:`open`,run:()=>void e.client.request(`task.cancelScheduledStart`,{taskId:t.id}).catch(e=>L(String(e),`error`))})),t.hasPrompt&&(i.push({label:q(`tasks`,`menu.runAgain`),section:`open`,run:()=>C.set((0,H.jsx)(xA,{model:e,task:t}))}),i.push({label:B(`menu.retryEdit`),section:`open`,rare:!0,run:()=>void s_(e,t)}));let a=!t.machine;if(a&&i.push({label:q(`tasks`,`menu.openEditor`),section:`open`,...EA(`tasks.openWorktree`),run:()=>void Oy(e,t.id)}),t.groupId){let e=t.groupId;i.push({label:B(`compare.menu`),section:`open`,run:()=>ge(e)})}i.push({label:B(`menu.rename`),section:`edit`,...EA(`sidebar.rename`),run:()=>C.set((0,H.jsx)(wi,{title:B(`menu.rename`),initial:t.title,submitLabel:B(`dialog.save`),onSubmit:n=>e.act(`task.rename`,{taskId:t.id,title:n}).then(()=>{})}))}),t.kind!==`main`&&i.push({label:t.pinned?B(`menu.unpin`):B(`menu.pin`),section:`edit`,...EA(`sidebar.pin`),run:()=>void e.act(`task.pin`,{taskId:t.id,pinned:!t.pinned}).catch(e=>L(String(e),`error`))}),a&&i.push({label:q(`tasks`,`menu.reorder`),section:`edit`,rare:!0,...EA(`sidebar.localMerge`),run:()=>AA()}),i.push({label:B(`menu.setStatus`),section:`edit`,children:wA.map(n=>({label:B(TA[n]),checked:n===t.status,run:()=>void e.act(`task.setStatus`,{taskId:t.id,status:n}).catch(e=>L(String(e),`error`))}))}),a&&t.kind!==`main`&&!t.routine&&!t.parentTaskId&&!t.extraRepoCount&&i.push({label:q(`tasks`,`menu.moveToProject`),section:`edit`,rare:!0,run:()=>{let n=jA(e,t);n&&C.set(n)}}),a&&i.push({label:B(`menu.changeEngine`),section:`edit`,rare:!0,...EA(`tasks.cycleEngine`),run:()=>C.set((0,H.jsx)(ck,{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}}),L(q(`tasks`,`toast.engineSwitched`,{engine:n.engine.name}))}}))}),t.pr?.checkState===`failing`&&i.push({label:q(`tasks`,`menu.fixChecks`),section:`git`,key:ba(`files.fixChecks`),run:()=>void Dy(e,t.id,B(`taskops.fixSent`))}),t.kind===`task`&&t.branch&&a&&i.push({label:q(`tasks`,`menu.syncBase`),section:`git`,rare:!0,key:ba(`files.syncBase`),run:()=>void Ty(e,t.id)}),t.branch&&i.push({label:B(`menu.renameBranch`),section:`git`,rare:!0,...EA(`tasks.renameBranch`),run:()=>C.set((0,H.jsx)(wi,{title:B(`menu.renameBranch`),initial:t.branch,submitLabel:B(`dialog.save`),onSubmit:e=>r.request(`task.setBranch`,{taskId:t.id,branch:e}).then(()=>{})}))}),t.kind===`task`&&t.branch&&i.push({label:B(`menu.land`),section:`git`,run:()=>void Cy(e,t)});let o=[{label:B(`menu.copyWhat.id`),run:()=>void DA(t.id,B(`menu.what.id`))}];return t.branch&&o.push({label:B(`menu.copyWhat.branch`),run:()=>void DA(t.branch,B(`menu.what.branch`))}),o.push({label:B(`menu.copyWhat.path`),run:()=>void r.request(`task.get`,{taskId:t.id}).then(e=>DA(e.task.worktreePath,B(`menu.what.path`))).catch(e=>L(String(e),`error`))}),i.push({label:B(`menu.copy`),section:`copy`,children:o}),i.push({label:q(`tasks`,t.archived?`menu.unarchive`:`menu.archive`),section:`danger`,run:()=>void My(e,t)}),i.push({label:B(`menu.removeSession`),section:`danger`,...EA(`sidebar.delete`),danger:!0,run:()=>C.set(t.kind===`main`?jy(e,t):Ay(e,t))}),i}var NA=e=>Date.parse(e.updatedAt??e.createdAt??``)||0;function PA(e,t,n,r){return(r===`archived`?e?.archived??[]:e?.tasks??[]).filter(e=>!e.routine).filter(e=>n===null||!Ad(e)&&SE(e.repo)===SE(n)).filter(e=>r===`archived`||e.kind!==`main`||t[e.id]?.length!==0).sort((e,t)=>NA(t)-NA(e))}function FA(e){let t=new Set,n=[];for(let r of[...e?.tasks??[],...e?.archived??[]]){if(r.routine||Ad(r)||r.repo.startsWith(`ssh://`))continue;let e=SE(r.repo);t.has(e)||(t.add(e),n.push(r.repo))}return n}function IA({tabs:e,value:t,onChange:n,className:r}){return(0,H.jsx)(`div`,{className:It(`flex gap-1`,r),role:`tablist`,children:e.map(e=>{let r=e.id===t;return(0,H.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":r,className:It(`relative rounded-sm px-2.5 py-0.75 font-mono text-meta font-semibold`,`touch:after:absolute touch:after:content-[''] touch:after:-inset-x-0.5 touch:after:-top-2 touch:after:-bottom-1.5`,r?`bg-inset text-ink group-focus-within/pane:text-accent`:`text-muted`),onClick:()=>n(e.id),children:e.label},e.id)})})}function LA({model:e}){let{common:t}=yE(),n=y(e.tasks),r=y(e.tabs),i=y(j)??``,[a,o]=(0,h.useState)(`active`),[s,c]=(0,h.useState)(0),l=FA(n),u=i===``?null:i,d=PA(n,r,u,a),f=Math.min(s,Math.max(0,d.length-1)),p=(0,h.useRef)(null);(0,h.useEffect)(()=>p.current?.focus(),[]);let m=(0,h.useRef)(null);(0,h.useEffect)(()=>{m.current?.querySelector(`[data-row="${f}"]`)?.scrollIntoView({block:`nearest`})},[f]);let g=t=>{O.set(null),e.select(t)},_=e=>{o(e),c(0)},v=e=>{let t=[``,...l],n=t.findIndex(e=>e===``?i===``:SE(e)===SE(i));j.set(t[(Math.max(0,n)+(e?t.length-1:1))%t.length]??``),c(0)};kE(e=>{if(e.ctrlKey)return e.key===`c`&&(O.set(null),!0);let t=d[f];switch(e.key){case`Escape`:case`q`:return O.set(null),!0;case`j`:case`ArrowDown`:return c(Math.min(d.length-1,f+1)),!0;case`k`:case`ArrowUp`:return c(Math.max(0,f-1)),!0;case`Tab`:return v(e.shiftKey),!0;case`a`:return _(a===`active`?`archived`:`active`),!0;case`Enter`:return t&&g(t.id),!0;default:return!1}});let b=Date.now();return(0,H.jsxs)(`div`,{className:`group/pane ${jx}`,tabIndex:0,ref:p,children:[(0,H.jsxs)(`div`,{className:Nx,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,H.jsx)(`h1`,{className:Mx,children:B(`sessions.title`)}),(0,H.jsx)(IA,{tabs:[{id:`active`,label:B(`sessions.active`)},{id:`archived`,label:B(`sessions.archived`)}],value:a,onChange:_})]}),(0,H.jsx)(`span`,{className:`mono touch:empty:hidden! text-muted ${Px(!0)}`,children:u?CE(u,l):B(`sessions.allProjects`)})]}),n?d.length===0?(0,H.jsx)(`p`,{className:`text-muted`,children:B(a===`archived`?`sessions.emptyArchived`:`sessions.emptyActive`)}):(0,H.jsx)(`div`,{className:Lx,ref:m,children:d.map((t,n)=>{let r=Date.parse(t.updatedAt??t.createdAt??``);return(0,H.jsx)(`div`,{"data-row":n,className:Rx(n===f),onClick:()=>g(t.id),onContextMenu:r=>{c(n),_F(r,MA(e,t,null))},children:(0,H.jsxs)(`div`,{className:zx,children:[(0,H.jsx)(`span`,{className:Hx,title:t.label,children:t.label}),u===null&&!Ad(t)?(0,H.jsx)(`span`,{className:`mono text-meta ${Bx}`,children:CE(t.repo,l)}):null,(0,H.jsx)(`span`,{className:`mono text-meta ${Bx}`,children:Number.isFinite(r)?JE(r,b):``})]})},t.id)})}):(0,H.jsx)(`p`,{className:`text-muted`,children:t.loading}),(0,H.jsx)(`p`,{className:`mt-2.5 mb-0 text-meta text-subtle touch:hidden`,children:B(`sessions.keys`)})]})}function RA({active:e=!1,onSelect:t,plus:n=!1,children:r}){return(0,H.jsxs)(`button`,{type:`button`,className:`rail-nav-row ${Kx(e)}`,"aria-current":e?`page`:void 0,onClick:t,children:[r,n?(0,H.jsx)(`span`,{className:qx,"aria-hidden":`true`,children:`+`}):null]})}var zA=`mx-auto flex max-w-[76rem] flex-col font-mono text-meta leading-[1.5]`,BA=`flex items-end justify-between gap-[4ch]`,VA=`m-0 text-title font-bold tracking-[0.02em]`,HA=`font-bold tracking-code uppercase`,UA=`text-muted`,WA=`text-subtle`,GA=`my-4 border-t-hairline border-dashed! border-line-active`,KA=`m-0 mb-1.5 text-meta text-muted ${HA}`,qA=`${KA} flex flex-wrap items-baseline justify-between gap-x-[4ch]`,JA=`flex flex-wrap items-start gap-x-[8ch] gap-y-4`,YA=`min-w-[min(100%,36ch)] flex-1`,XA=`text-[3.5rem] leading-none font-bold tracking-[-0.03em]`,ZA=`grid grid-cols-[repeat(auto-fit,minmax(min(100%,34ch),1fr))] items-start gap-x-[6ch] gap-y-5`,QA=`flex min-w-0 items-baseline gap-[1ch] whitespace-nowrap`,$A=`min-w-0 truncate`,ej=`min-w-[2ch] flex-1 -translate-y-0.75 border-b-hairline border-dotted! border-line-active`,tj=`pl-[2ch] text-subtle`,nj=`-mx-[1ch] block rounded-sm px-[1ch] py-0.5 text-left`,rj=`${nj} w-[calc(100%+2ch)] cursor-pointer hover:bg-hover focus-visible:outline-1 focus-visible:-outline-offset-1 focus-visible:outline-focus`,ij=`grid grid-cols-[6ch_minmax(0,1fr)_5ch_5ch_8ch] items-center gap-x-[2ch] py-0.5 whitespace-nowrap`,aj=[`bg-accent`,`bg-info`,`bg-merged`,`bg-subtle`],oj=`grid grid-cols-[minmax(0,1fr)_minmax(8ch,14ch)_5ch] items-center gap-x-[1ch] whitespace-nowrap`,sj=`relative h-2.5 border-hairline border-current after:absolute after:inset-y-0 after:left-0 after:w-(--fill) after:bg-current after:content-['']`,cj={ok:`${sj} text-success`,warn:`${sj} text-warning`,crit:`${sj} text-error`},lj=`flex h-9 flex-none items-stretch text-ink`,uj=`flex-none bg-current`,dj=`flex flex-wrap items-baseline justify-between gap-x-[4ch] gap-y-1 text-subtle`,fj={turns:0,tokens:0,ms:0},pj=e=>(e.usage?.input_tokens??0)+(e.usage?.output_tokens??0),mj=e=>Math.max(0,e.endedAt-e.startedAt),hj=(e,t)=>({turns:e.turns+1,tokens:e.tokens+pj(t),ms:e.ms+mj(t)});function gj(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function _j(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(gj(n.getTime()))}let a=new Map(i.map(e=>[e,{sum:fj,byEngine:{}}]));for(let t of e){let e=a.get(gj(t.startedAt));if(!e)continue;let n=t.vendor??`unknown`;e.sum=hj(e.sum,t),e.byEngine[n]=(e.byEngine[n]??0)+pj(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:gj(o)}:null;return{cutoff:s,days:i.map(e=>{let t=a.get(e);return{day:e,...t?.sum??fj,byEngine:t?.byEngine??{},partial:s!==null&&e<=s.day}})}}function vj(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,...hj(t.get(i)??fj,n)})}return[...t.values()].sort((e,t)=>t.tokens-e.tokens||t.turns-e.turns)}function yj(e,t){let n=new Map;for(let t of e)n.set(t.taskId,{taskId:t.taskId,...hj(n.get(t.taskId)??fj,t)});return[...n.values()].sort((e,t)=>t.tokens-e.tokens||t.turns-e.turns).slice(0,t)}function bj(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 xj=.1,Sj=/^(\d+)\s*(h|d)$/;function Cj(e,t){let n=Sj.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*xj)||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 wj=14,Tj=500,Ej=3e4,Dj=8;function Oj(e,t,n,r){let i=X(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 Ku(e,t,n).then(e=>r&&o({kind:`ready`,value:e})).catch(e=>r&&o(t=>t.kind===`ready`?t:{kind:`failed`,error:xE(e)})),()=>{r=!1}},[e,t,s,r]),a}var kj=()=>(0,H.jsx)(`div`,{className:GA});function Aj({name:e,title:t,sum:n,sub:r,open:i}){let a=(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`span`,{className:QA,children:[(0,H.jsx)(`span`,{className:$A,title:t,children:e}),(0,H.jsx)(`span`,{className:ej}),(0,H.jsx)(`span`,{children:bj(n.tokens)})]}),(0,H.jsx)(`span`,{className:`block truncate ${tj}`,children:[r,`${n.turns}t`,Wk(n.ms)].filter(Boolean).join(` · `)})]});return i?(0,H.jsx)(U,{variant:`row`,className:rj,onClick:i,children:a}):(0,H.jsx)(`div`,{className:nj,children:a})}function jj({sum:e}){let t=`${e.tokens}${e.turns}${e.ms}`.repeat(4).slice(0,36);return(0,H.jsx)(`div`,{className:lj,"aria-hidden":`true`,children:[...t].map((e,t)=>(0,H.jsx)(`span`,{className:uj,style:{width:1+Number(e)%3,marginRight:1+Number(e)%2}},t))})}function Mj({usage:e,nameOf:t}){let n=Date.now(),r=e.flatMap(e=>e.windows.map(r=>{let i=Cj(r,n),a=i?.kind===`full`&&i.at-n<72e6,o=i?.kind===`full`?$(B(`usage.full`),{time:new Date(i.at).toLocaleString([],{...a?{}:{weekday:`short`},hour:`2-digit`,minute:`2-digit`})}):i?B(`usage.lasts`):``;return{key:`${e.vendor}:${r.kind}`,name:`${e.name||t(e.vendor)} ${r.label}`,percent:Math.round(r.percent),tone:uT({capturedAt:e.capturedAt,windows:[r]},n)?.tone??`ok`,note:o}}));return r.length===0?null:(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`h2`,{className:KA,children:B(`usage.quota`)}),r.map(e=>(0,H.jsxs)(`div`,{className:`py-0.5`,children:[(0,H.jsxs)(`div`,{className:oj,children:[(0,H.jsx)(`span`,{className:$A,children:e.name}),(0,H.jsx)(`span`,{className:cj[e.tone]??cj.ok,style:{"--fill":`${Math.min(100,Math.max(0,e.percent))}%`}}),(0,H.jsx)(`span`,{className:`text-right ${Vn[e.tone]}`,children:`${e.percent}%`})]}),e.note&&(0,H.jsx)(`div`,{className:`pl-[2ch] text-subtle`,children:e.note})]},e.key))]})}function Nj({model:e}){V();let t=AE(),[n]=DE(Ej),r=Oj(e,`turns.list`,{sinceDays:wj,limit:Tj},n),i=Oj(e,`engines.list`,{},n),a=Oj(e,`usage.get`,{},n),o=y(e.tasks),s=i.kind===`ready`?i.value.engines:[],c=e=>s.find(t=>t.id===e)?.name??e,l=e=>o?.tasks.find(t=>t.id===e)?.label??B(`usage.removedTask`),u=a.kind===`ready`&&a.value.usage&&(0,H.jsx)(Mj,{usage:a.value.usage,nameOf:c});return(0,H.jsx)(`div`,{className:jx,tabIndex:0,ref:t,onKeyDown:e=>{e.metaKey||e.ctrlKey||e.altKey||e.key!==`q`&&e.key!==`Escape`||(e.preventDefault(),O.set(null))},children:(0,H.jsx)(`div`,{className:zA,children:(()=>{if(r.kind===`loading`)return(0,H.jsx)(`p`,{className:`m-0 ${UA}`,children:B(`usage.loading`)});if(r.kind===`failed`)return(0,H.jsx)(`p`,{className:`m-0 text-error`,children:$(B(`usage.failed`),{error:r.error})});let t=r.value.turns,n=new Set(r.value.readers??[]),i=_j(t,Date.now(),wj,Tj),a=new Map;for(let e of i.days)for(let[t,n]of Object.entries(e.byEngine))a.set(t,(a.get(t)??0)+n);let s=[...a].sort((e,t)=>t[1]-e[1]).map(([e])=>e),d=e=>aj[Math.max(0,s.indexOf(e))%aj.length]??aj[0],f=Math.max(0,...i.days.map(e=>e.tokens)),p=i.days.slice(Math.max(0,i.days.findIndex(e=>e.turns>0))),m=i.days.reduce((e,t)=>({turns:e.turns+t.turns,tokens:e.tokens+t.tokens,ms:e.ms+t.ms}),{turns:0,tokens:0,ms:0}),h=[...new Set((o?.tasks??[]).flatMap(e=>e.engine?.id&&!n.has(e.engine.id)?[e.engine.id]:[]))];return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:BA,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`h1`,{className:VA,children:[(0,H.jsx)(`span`,{className:Gn,children:`[`}),` rove `,(0,H.jsx)(`span`,{className:Gn,children:`]`})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{className:HA,children:B(`usage.receipt`)}),(0,H.jsx)(`span`,{className:UA,children:` ${i.days[0]?.day.slice(5)} → ${i.days.at(-1)?.day.slice(5)}`})]})]}),t.length>0&&(0,H.jsx)(jj,{sum:m})]}),(0,H.jsx)(kj,{}),t.length===0?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{className:`m-0 ${UA}`,children:B(`usage.empty`)}),u&&(0,H.jsx)(kj,{}),u]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:JA,children:[(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`h2`,{className:KA,children:B(`usage.total`)}),(0,H.jsx)(`div`,{className:XA,children:bj(m.tokens)}),(0,H.jsx)(`div`,{className:`mt-1.5 ${UA}`,children:`${$(B(`usage.turns`),{count:m.turns})} · ${Wk(m.ms)}`})]}),(0,H.jsxs)(`section`,{className:YA,children:[(0,H.jsxs)(`h2`,{className:qA,children:[B(`usage.perDay`),s.length>1&&(0,H.jsx)(`span`,{className:`flex flex-wrap gap-x-[2ch] font-normal tracking-normal normal-case`,children:s.map(e=>(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`span`,{className:`mr-[1ch] inline-block size-2 align-baseline ${d(e)}`}),c(e)]},e))})]}),p.map(e=>(0,H.jsxs)(`div`,{className:ij,children:[(0,H.jsx)(`span`,{className:UA,children:`${e.day.slice(5)}${e.partial?`~`:``}`}),(0,H.jsx)(`span`,{className:`flex min-w-0`,children:e.tokens>0&&f>0&&(0,H.jsx)(`span`,{className:`flex h-2.5 w-(--fill) min-w-0.5 gap-px`,style:{"--fill":`${e.tokens/f*100}%`},children:s.map(t=>(e.byEngine[t]??0)>0&&(0,H.jsx)(`span`,{className:`min-w-0.5 basis-0 ${d(t)}`,style:{flexGrow:e.byEngine[t]}},t))})}),e.turns>0&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`text-right`,children:bj(e.tokens)}),(0,H.jsx)(`span`,{className:`text-right text-subtle`,children:`${e.turns}t`}),(0,H.jsx)(`span`,{className:`text-right text-subtle`,children:Wk(e.ms)})]})]},e.day))]})]}),(0,H.jsx)(kj,{}),(0,H.jsxs)(`div`,{className:ZA,children:[(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`h2`,{className:KA,children:B(`usage.byModel`)}),vj(t).map(e=>(0,H.jsx)(Aj,{name:e.model,title:`${c(e.engine)} · ${e.model}`,sum:e,sub:c(e.engine)},`${e.engine}\0${e.model}`))]}),(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`h2`,{className:KA,children:B(`usage.topTasks`)}),yj(t,Dj).map(t=>{let n=o?.tasks.some(e=>e.id===t.taskId),r=l(t.taskId);return(0,H.jsx)(Aj,{name:n?r:(0,H.jsx)(`span`,{className:WA,children:r}),title:r,sum:t,open:n?()=>{O.set(null),e.select(t.taskId)}:null},t.taskId)})]}),u]})]}),(0,H.jsx)(kj,{}),(0,H.jsxs)(`div`,{className:dj,children:[(0,H.jsx)(`span`,{children:$(B(`usage.range`),{days:wj})}),i.cutoff&&(0,H.jsx)(`span`,{children:$(B(`usage.cutoff`),{count:i.cutoff.count,day:i.cutoff.day.slice(5)})}),h.length>0&&(0,H.jsx)(`span`,{children:$(B(`usage.noReader`),{engines:h.map(c).join(`, `)})}),(0,H.jsx)(`span`,{className:`${HA} ml-auto`,children:B(`usage.thanks`)})]})]})})()})})}var Pj={id:`mods`,label:`mods`},Fj=[{id:`kanban`,label:`kanban`,mod:`kanban`},{id:`routines`,label:`automations`},{id:`issues`,label:`issues`,mod:`issues`}];function Ij({model:e}){let{nav:t}=yE(),n=y(O),r=y(e.mods).length>0,i=y(e.installedMods),a=[...Fj.filter(e=>!e.mod||i.has(e.mod)),...r?[Pj]:[]];return(0,H.jsxs)(`div`,{className:Ux,children:[(0,H.jsx)(RA,{plus:!0,onSelect:()=>xv(),children:B(`rail.newTask`)}),a.map(e=>(0,H.jsx)(RA,{active:n===e.id,onSelect:()=>he(e.id),children:t[e.label]},e.id)),(0,H.jsx)(RA,{active:n===`sessions`,onSelect:()=>_e(``),children:B(`sessions.title`)})]})}function Lj({model:e,page:t}){let n=y(e.installedMods);return t===`kanban`&&n.has(`kanban`)?(0,H.jsx)(aO,{model:e}):t===`routines`?(0,H.jsx)(sA,{model:e}):t===`issues`&&n.has(`issues`)?(0,H.jsx)(iD,{model:e}):t===`mods`?(0,H.jsx)(SO,{model:e}):t===`compare`?(0,H.jsx)(KE,{model:e}):t===`usage`?(0,H.jsx)(Nj,{model:e}):t===`sessions`?(0,H.jsx)(LA,{model:e}):null}var Rj=f();function zj(e){return e?.match(/^https?:\/\/[^/]+\/([^/]+\/[^/]+)\/(?:pull|merge_requests|-\/merge_requests)\//)?.[1]}var Bj=e=>e.charAt(0).toUpperCase()+e.slice(1);function Vj(e){return[B(`rail.pr.state.${e.state}`),...e.checks?[B(`rail.pr.checks.${e.checks}`)]:[]].join(`, `)}function Hj(e){let t=new Map;for(let n of e){let e=jh(n),r=[...e&&n.pr?[{pr:n.pr,mark:e}]:[],...(n.sessionPrs??[]).flatMap(e=>{let t=Mh(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&&Nh([a.mark,i])!==a.mark)&&t.set(r,{task:n,pr:e,mark:i})}}return[...t.values()]}function Uj({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=lu();(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=Hj(e),p=Nh(f.map(e=>e.mark));if(!p)return null;let m=f.length===1?`PR #${f[0]?.pr.number??``}, ${Vj(p)}`:B(`rail.pr.many`,{count:f.length});return(0,H.jsxs)(`span`,{ref:o,className:`chip ${km} ${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,H.jsx)(`span`,{className:`font-sans`,children:f.length}),n&&(0,Rj.createPortal)((0,H.jsx)(`div`,{ref:c,className:Am(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=zj(t?.url),i=t?.additions!==void 0&&t.deletions!==void 0;return(0,H.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,H.jsx)(`span`,{className:`truncate font-semibold text-ink`,children:t.title||e.label}),(0,H.jsxs)(`span`,{className:`flex items-baseline gap-0 text-meta leading-[inherit] whitespace-nowrap`,children:[(0,H.jsxs)(`span`,{className:`inline-flex items-baseline gap-1.25 ${n.tone}`,children:[(0,H.jsx)(`span`,{className:`font-mono`,children:n.glyph}),Bj(B(`rail.pr.state.${n.state}`))]}),(0,H.jsx)(`span`,{className:`overflow-hidden text-ellipsis whitespace-pre text-muted`,children:[...n.checks?[B(`rail.pr.checks.${n.checks}`)]:[],[r,t?.number===void 0?``:`#${t.number}`].filter(Boolean).join(` `)].filter(Boolean).map(e=>`, ${e}`).join(``)}),i&&(0,H.jsxs)(`span`,{className:`ml-auto flex gap-1.5 pl-3 tabular-nums`,children:[(0,H.jsxs)(`span`,{className:`text-success`,children:[`+`,t.additions]}),(0,H.jsxs)(`span`,{className:`text-error`,children:[`−`,t.deletions]})]})]})]},t.url??`${e.id}#${t.number??``}`)})}),document.body)]})}function Wj(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 Gj(e,t,n,r){let i=Wj(e,t,n);return i===null?null:r===`above`&&i>0?i-1:r===`below`&&i<0?i+1:i}function Kj(e,t){return e.id===t.id?!1:e.kind===`main`?t.kind===`main`:t.kind!==`main`&&t.repo===e.repo&&!t.pinned==!e.pinned}var qj=e=>e===void 0||e.kind===`project`||e.kind===`state`?0:e.kind===`task`||e.kind===`pane`||e.kind===`round`?e.depth:1;function Jj(e,t){let n=qj(e[t]),r=t+1;for(;r<e.length&&qj(e[r])>n;)r++;return r}function Yj(e,t){let n=qj(e[t]),r=[];for(let i=2;i<=n;i++){let a=t+1;for(;a<e.length&&qj(e[a])>i;)a++;let o=a<e.length&&qj(e[a])===i;r.push(i===n?o?`tee`:`elbow`:o?`pipe`:`blank`)}return r}function Xj(e,t,n,r){let i=e.findIndex(e=>e.id===t);if(i<0||t===n)return e;let a=Jj(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:Jj(s,c);return[...s.slice(0,l),...o,...s.slice(l)]}var Zj={duration:180,easing:`cubic-bezier(0.16, 1, 0.3, 1)`};function Qj(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}],Zj):t!==e.offsetTop&&e.animate([{transform:`translateY(${t-e.offsetTop}px)`},{transform:`none`}],Zj)}})}var $j=null,eM=()=>($j||($j=new Image,$j.src=`data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7`),$j);function tM(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);Qj(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&&!Ad(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(eM(),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,Jj(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&&!Kj(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),Fp(`default`),L(q(`tasks`,`sort.label`,{mode:q(`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=>L(q(`tasks`,`toast.moveFailed`,{error:e instanceof Error?e.message:String(e)}),`error`)).finally(u);return}let m=Gj(t,i.from,i.to,i.side);m?Vp(e,i.from.id,m).finally(u):l.current()}},w=e=>{let t=[...e?.querySelectorAll(`[data-row]`)??[]];g.current=new Map(t.map((e,n)=>{let r=t[n-1],i=r?e.offsetTop-r.offsetTop-r.offsetHeight:0;return[e.dataset.row??``,{top:e.offsetTop,gap:i,height:e.offsetHeight}]}))},T=(e,t)=>{m.current=t?Xj(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,Jj(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 nM({model:e,narrow:t,onSettings:n}){V();let r=y(UC),i=Q(`engines.skill.bannerHintWeb`,{engines:r.join(`, `)});return(0,H.jsxs)(`div`,{className:Wx,children:[!t&&(0,H.jsx)(fT,{client:e.client}),(0,H.jsxs)(`div`,{className:Gx,children:[(0,H.jsxs)(`button`,{type:`button`,className:`rail-nav-row ${Kx(!1)}`,onClick:n,children:[(0,H.jsxs)(`svg`,{className:Jx,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[(0,H.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,H.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`})]}),(0,H.jsx)(`span`,{children:B(`rail.settings`)}),r.length>0&&(0,H.jsx)(`span`,{className:`ml-2 min-w-0 truncate text-meta text-subtle`,title:i,children:B(`rail.skillCue`)})]}),(0,H.jsx)(HT,{model:e,bindingId:`settings.open`})]})]})}function rM(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 iM=`rove.web.rail.shownMains`;function aM(){try{let e=JSON.parse(localStorage.getItem(iM)??`[]`);return Array.isArray(e)?Object.fromEntries(e.map(e=>[String(e),[null]])):{}}catch{return{}}}function oM(e,t){try{let n=e.filter(e=>e.kind===`main`&&(t[e.id]?.length??0)>0).map(e=>e.id);localStorage.setItem(iM,JSON.stringify(n))}catch{}}function sM(e,t,n){return(0,h.useEffect)(()=>{n&&oM(e,t)},[n,e,t]),(0,h.useMemo)(()=>n?t:{...aM(),...t},[n,t])}function cM(e,{task:t,tab:n,leaf:r}){n.split&&dA(t.id,n,n.split,r),e.select(t.id,n.id)}function lM(e){let{row:t}=e,n=y(e.model.selection);y(cA);let r=n.taskId===t.task.id&&n.tabId===t.tab.id&&!!t.tab.split&&lA(t.task.id,t.tab,t.tab.split)===t.leaf;return(0,H.jsxs)(`button`,{type:`button`,className:`${hi({size:`pane`})} ${e.cursor?Lm:``}`,"aria-current":r||void 0,onClick:e.onClick,onContextMenu:e.onMenu,...e.place,children:[(0,H.jsx)(`span`,{className:wm,"aria-hidden":`true`,children:e.guides?.map((e,t)=>(0,H.jsx)(`span`,{className:Dm(e)},t))}),(0,H.jsx)(`span`,{className:`${gi} text-(length:--fs-meta) ${r?`text-ink`:`text-muted`}`,children:t.label})]})}var uM=`rove.collapsedProjects`,dM=`rove.foldedTasks`,fM=`rove.openedTasks`,pM=600;function mM(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 hM(e,t){try{localStorage.setItem(e,JSON.stringify([...t]))}catch{}}var gM=(e,t)=>{let n=new Set(e);return n.delete(t)||n.add(t),n};function _M(){let e=y(Np),[t,n]=(0,h.useState)({active:!1,query:``}),[r,i]=(0,h.useState)(()=>mM(uM)),a=e=>i(t=>{let n=gM(t,e);return hM(uM,n),n}),[o,s]=(0,h.useState)(()=>({folded:mM(dM),opened:mM(fM)}));return{sort:e,cycleSort:Ip,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)),hM(dM,r),hM(fM,i),{folded:r,opened:i}})}}var vM=[`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 yM(e){for(let t of e)for(let e of vM){let n=ya(e).indexOf(t);if(n>=0)return{id:e,slot:n}}return null}function bM(e,t){let n=e.selection.get().taskId===t;e.select(t),pe(),n&&!yv(e.client)&&bo()}function xM(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)(()=>Hy.set(f),[f]);let p=l[0]?.id??null;(0,h.useEffect)(()=>{i.query,i.active&&s(p)},[i.active,i.query,p]);let m=e=>{let t=l[Math.max(0,Math.min(l.length-1,e))];t&&s(t.id)},g=t=>{t?.kind===`task`&&e.select(t.task.id),t?.kind===`round`&&ge(t.groupId),t?.kind===`pane`&&cM(e,t),t&&pe()},_=(t,n)=>{t?.kind===`task`&&x(MA(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=Eu(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}),L(B(`rail.engineSwitched`,{engine:i.name}))}catch(e){L(B(`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=yM(qc(t));if(Lp.get()){let n=o?.kind===`task`&&o.machine===void 0;if(d?.id===`sidebar.nav`)n&&Bp(e,o,d.slot%2==0?1:-1);else if(d?.id===`sidebar.localMerge`||t.key===`Enter`||t.key===`Escape`)zp(!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<pM?(m(0),c.current=0):c.current=Date.now();break;case`sidebar.select`:case`sidebar.tree.open`:g(o);break;case`tasks.focusEngine`:bo();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&&zp(!0);break;case`sidebar.sort`:n.cycleSort(),L(q(`tasks`,`sort.label`,{mode:q(`tasks`,`sort.modes.${Np.get()}`)}));break;case`sidebar.search.enter`:a({active:!0,query:``});break;case`task.new`:r.onNewTask(o?.kind===`task`||o?.kind===`pane`?o.task.repo:void 0,o?.machine);break;case`settings.open.sidebar`:r.onSettings();break;case`worktrees.open.sidebar`:he(`worktrees`);break;case`tasks.update`:he(`update`);break;default:return}t.preventDefault()},onPress:e=>{let t=e.target.closest(`[data-row]`)?.dataset.row;t&&s(t)}}}var SM=192,CM=`rove.web.railWidth`,wM=`rove.web.railFolded`;function TM(){let e=Number(localStorage.getItem(CM));return Number.isFinite(e)&&e>0?e:null}var EM=v(TM());EM.subscribe(()=>{let e=EM.get();e===null?localStorage.removeItem(CM):localStorage.setItem(CM,String(Math.round(e)))}),EM.subscribe(le);var DM=v(localStorage.getItem(wM)===`1`);DM.subscribe(()=>localStorage.setItem(wM,DM.get()?`1`:`0`));var OM=v(!1),kM=null,AM=!1;function jM(e){kM!==null&&window.clearTimeout(kM),kM=null,AM=e,e?OM.set(!0):kM=window.setTimeout(()=>S.get()===null&&OM.set(!1),250)}S.subscribe(()=>{S.get()===null&&OM.get()&&!AM&&jM(!1)}),DM.subscribe(()=>OM.set(!1)),DM.subscribe(le);function MM(e,t=window.innerWidth){let n=Math.max(SM,t-320);return Math.max(SM,Math.min(n,Math.round(e)))}var NM=(e,t,n)=>`~pane:${e}:${t}:${n}`;function PM(e,t){return e.flatMap(e=>e.kind===`task`?[e,...(t[e.task.id]??[]).flatMap(t=>{let n=t.split;if(!n||!Gd(n))return[];let r=Jd(n,Hd(t));return Wd(n.root).map(n=>({id:NM(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 FM(e){let{row:t}=e;return(0,H.jsxs)(`button`,{type:`button`,className:`${hi({size:`pane`})} ${e.cursor?Lm:``}`,title:B(`compare.menu`),onClick:()=>{e.onClick(),ge(t.groupId)},...e.place,children:[e.guides&&(0,H.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,H.jsx)(`span`,{className:Dm(e)},t))}),(0,H.jsx)(`span`,{className:`${gi} text-(length:--fs-meta) text-muted`,children:t.title}),(0,H.jsxs)(`span`,{className:`${xi} ml-auto items-center`,children:[e.repo&&(0,H.jsx)(`span`,{className:`max-w-24 truncate text-subtle`,children:e.repo}),(0,H.jsx)(`span`,{className:`text-subtle`,children:t.tasks.length}),(0,H.jsx)(Vh,{status:kh(t.tasks)})]})]})}function IM(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,H.jsxs)(`div`,{className:`${Pm} mono items-center`,children:[(0,H.jsx)(`span`,{className:`text-accent`,children:`/`}),(0,H.jsx)(`input`,{ref:t,className:Fm,type:`text`,autoFocus:!0,spellCheck:!1,autoComplete:`off`,autoCapitalize:`off`,enterKeyHint:`go`,value:e.query,placeholder:B(`rail.searchPlaceholder`),"aria-label":B(`rail.searchPlaceholder`),onChange:t=>e.onChange(t.target.value)}),e.query&&(0,H.jsx)(`span`,{className:`ml-1.5 text-muted`,children:e.count})]})}var LM=Math.min,RM=Math.max,zM=Math.round,BM=Math.floor,VM=e=>({x:e,y:e}),HM={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function UM(e,t,n){return RM(e,LM(t,n))}function WM(e,t){return typeof e==`function`?e(t):e}function GM(e){return e.split(`-`)[0]}function KM(e){return e.split(`-`)[1]}function qM(e){return e===`x`?`y`:`x`}function JM(e){return e===`y`?`height`:`width`}function YM(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function XM(e){return qM(YM(e))}function ZM(e,t,n){n===void 0&&(n=!1);let r=KM(e),i=XM(e),a=JM(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=oN(o)),[o,oN(o)]}function QM(e){let t=oN(e);return[$M(e),t,$M(t)]}function $M(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var eN=[`left`,`right`],tN=[`right`,`left`],nN=[`top`,`bottom`],rN=[`bottom`,`top`];function iN(e,t,n){switch(e){case`top`:case`bottom`:return n?t?tN:eN:t?eN:tN;case`left`:case`right`:return t?nN:rN;default:return[]}}function aN(e,t,n,r){let i=KM(e),a=iN(GM(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map($M)))),a}function oN(e){let t=GM(e);return HM[t]+e.slice(t.length)}function sN(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function cN(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:sN(e)}function lN(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 uN(e,t,n){let{reference:r,floating:i}=e,a=YM(t),o=XM(t),s=JM(o),c=GM(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=KM(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function dN(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}=WM(t,e),p=cN(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=lN(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=lN(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 fN=50,pN=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:dN},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=uN(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<fN&&(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}=uN(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},mN=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}=WM(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=GM(r),_=YM(o),v=GM(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[oN(o)]:QM(o)),x=p!==`none`;!d&&x&&b.push(...aN(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=ZM(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===YM(t)||T.every(e=>YM(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=YM(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{}}}},hN=new Set([`left`,`top`]);async function gN(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=GM(n),s=KM(n),c=YM(n)===`y`,l=hN.has(o)?-1:1,u=a&&c?-1:1,d=WM(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 _N=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 gN(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}}}}},vN=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}=WM(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=YM(i),p=qM(f),m=u[p],h=u[f],g=(e,t)=>UM(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 yN(){return typeof window<`u`}function bN(e){return CN(e)?(e.nodeName||``).toLowerCase():`#document`}function xN(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function SN(e){return((CN(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function CN(e){return yN()?e instanceof Node||e instanceof xN(e).Node:!1}function wN(e){return yN()?e instanceof Element||e instanceof xN(e).Element:!1}function TN(e){return yN()?e instanceof HTMLElement||e instanceof xN(e).HTMLElement:!1}function EN(e){return!yN()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof xN(e).ShadowRoot}function DN(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=RN(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function ON(e){return/^(table|td|th)$/.test(bN(e))}function kN(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var AN=/transform|translate|scale|rotate|perspective|filter/,jN=/paint|layout|strict|content/,MN=e=>!!e&&e!==`none`,NN;function PN(e){let t=wN(e)?RN(e):e;return MN(t.transform)||MN(t.translate)||MN(t.scale)||MN(t.rotate)||MN(t.perspective)||!IN()&&(MN(t.backdropFilter)||MN(t.filter))||AN.test(t.willChange||``)||jN.test(t.contain||``)}function FN(e){let t=BN(e);for(;TN(t)&&!LN(t);){if(PN(t))return t;if(kN(t))return null;t=BN(t)}return null}function IN(){return NN??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),NN}function LN(e){return/^(html|body|#document)$/.test(bN(e))}function RN(e){return xN(e).getComputedStyle(e)}function zN(e){return wN(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function BN(e){if(bN(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||EN(e)&&e.host||SN(e);return EN(t)?t.host:t}function VN(e){let t=BN(e);return LN(t)?(e.ownerDocument||e).body:TN(t)&&DN(t)?t:VN(t)}function HN(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=VN(e),i=r===e.ownerDocument?.body,a=xN(r);if(i){let e=UN(a);return t.concat(a,a.visualViewport||[],DN(r)?r:[],e&&n?HN(e):[])}return t.concat(r,HN(r,[],n))}function UN(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function WN(e){let t=RN(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=TN(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=zM(n)!==a||zM(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function GN(e){return wN(e)?e:e.contextElement}function KN(e){let t=GN(e);if(!TN(t))return VM(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=WN(t),o=(a?zM(n.width):n.width)/r,s=(a?zM(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var qN=VM(0);function JN(e){let t=xN(e);return!IN()||!t.visualViewport?qN:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function YN(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===xN(e)}function XN(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=GN(e),o=VM(1);t&&(r?wN(r)&&(o=KN(r)):o=KN(e));let s=YN(a,n,r)?JN(a):VM(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=xN(a),t=wN(r)?xN(r):r,n=e,i=UN(n);for(;i&&t!==n;){let e=KN(i),t=i.getBoundingClientRect(),r=RN(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=xN(i),i=UN(n)}}return lN({width:u,height:d,x:c,y:l})}function ZN(e,t){let n=zN(e).scrollLeft;return t?t.left+n:XN(SN(e)).left+n}function QN(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-ZN(e,n),y:n.top+t.scrollTop}}function $N(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=SN(r),s=t?kN(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=VM(1),u=VM(0),d=TN(r);if((d||!a)&&((bN(r)!==`body`||DN(o))&&(c=zN(r)),d)){let e=XN(r);l=KN(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?QN(o,c):VM(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 eP(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function tP(e){let t=zN(e),n=e.ownerDocument.body,r=RM(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=RM(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+ZN(e),o=-t.scrollTop;return RN(n).direction===`rtl`&&(a+=RM(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var nP=25;function rP(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=xN(e),a=SN(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!IN()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(ZN(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=nP&&(s-=o)}return{width:s,height:c,x:l,y:u}}function iP(e,t){let n=XN(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=KN(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function aP(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=rP(e,n,t);else if(t===`document`)r=tP(SN(e));else if(wN(t))r=iP(t,n);else{let n=JN(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return lN(r)}function oP(e,t){let n=t.get(e);if(n)return n;let r=HN(e,[],!1).filter(e=>wN(e)&&bN(e)!==`body`),i=null,a=RN(e).position===`fixed`,o=a?BN(e):e;for(;wN(o)&&!LN(o);){let e=RN(o),t=PN(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=BN(o)}return t.set(e,r),r}function sP(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?kN(t)?[]:oP(t,this._c):[].concat(n),r],o=aP(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=aP(t,a[e],i);s=RM(n.top,s),c=LM(n.right,c),l=LM(n.bottom,l),u=RM(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function cP(e){let{width:t,height:n}=WN(e);return{width:t,height:n}}function lP(e,t,n){let r=TN(t),i=SN(t),a=n===`fixed`,o=XN(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=VM(0);if((r||!a)&&((bN(t)!==`body`||DN(i))&&(s=zN(t)),r)){let e=XN(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=ZN(i));let l=i&&!r&&!a?QN(i,s):VM(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 uP(e){return RN(e).position===`static`}function dP(e,t){if(!TN(e)||RN(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return SN(e)===n&&(n=n.ownerDocument.body),n}function fP(e,t){let n=xN(e);if(kN(e))return n;if(!TN(e)){let t=BN(e);for(;t&&!LN(t);){if(wN(t)&&!uP(t))return t;t=BN(t)}return n}let r=dP(e,t);for(;r&&ON(r)&&uP(r);)r=dP(r,t);return r&&LN(r)&&uP(r)&&!PN(r)?n:r||FN(e)||n}var pP=async function(e){let t=this.getOffsetParent||fP,n=this.getDimensions,r=await n(e.floating);return{reference:lP(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function mP(e){return RN(e).direction===`rtl`}var hP={convertOffsetParentRelativeRectToViewportRelativeRect:$N,getDocumentElement:SN,getClippingRect:sP,getOffsetParent:fP,getElementRects:pP,getClientRects:eP,getDimensions:cP,getScale:KN,isElement:wN,isRTL:mP};function gP(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function _P(e,t,n){let r=null,i,a=SN(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=BM(d),h=BM(a.clientWidth-(u+f)),g=BM(a.clientHeight-(d+p)),_=BM(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:RM(0,LM(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!gP(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=xN(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function vP(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=GN(e),u=i||a?[...l?HN(l):[],...t?HN(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?_P(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?XN(e):null;c&&g();function g(){let t=XN(e);h&&!gP(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 yP=_N,bP=vN,xP=mN,SP=(e,t,n)=>{let r=new Map,i=n??{},a={...hP,...i.platform,_c:r};return pN(e,t,{...i,platform:a})},CP=`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`,wP=500,TP=400,EP=`rove-tip`,DP=null,OP=null,kP=null,AP=null,jP=0,MP=!1,NP=()=>MP;function PP(){return DP?.isConnected?DP:(DP=document.createElement(`div`),DP.id=EP,DP.setAttribute(`role`,`tooltip`),DP.className=CP,DP.hidden=!0,document.body.append(DP),DP)}function FP(){AP!==null&&window.clearTimeout(AP),AP=null}function IP(e,t,n=`top`){FP(),LP();let r=PP();r.textContent=t,r.hidden=!1,OP=e,e.setAttribute(`aria-describedby`,EP),kP=vP(e,r,()=>{if(!e.isConnected)return LP();SP(e,r,{strategy:`fixed`,placement:n,middleware:[yP(6),xP(),bP({padding:8})]}).then(({x:e,y:t})=>{r.style.left=`${e}px`,r.style.top=`${t}px`})})}function LP(){FP(),OP&&(kP?.(),kP=null,OP.getAttribute(`aria-describedby`)===EP&&OP.removeAttribute(`aria-describedby`),OP=null,DP&&(DP.hidden=!0),jP=performance.now())}function RP(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 zP(e){if(e===OP)return;FP();let t=OP!==null||performance.now()-jP<TP,n=()=>e.isConnected&&e.dataset.tip&&IP(e,e.dataset.tip);t?n():AP=window.setTimeout(n,wP)}var BP=!1;function VP(){BP||(BP=!0,document.addEventListener(`pointerover`,e=>{if(e.pointerType===`touch`)return;let t=RP(e.target);t?zP(t):OP&&e.target instanceof Node&&OP.contains(e.target)||LP()}),document.addEventListener(`pointerout`,e=>{let t=RP(e.target);t&&!(e.relatedTarget instanceof Node&&t.contains(e.relatedTarget))&&LP()}),document.addEventListener(`keydown`,e=>{MP=!0,e.key===`Escape`&&LP()},!0),document.addEventListener(`pointerdown`,()=>{MP=!1,LP()},!0),document.addEventListener(`focusin`,e=>{let t=MP?RP(e.target):null;t&&zP(t)}),document.addEventListener(`focusout`,e=>{e.target===OP&&LP()}),window.addEventListener(`blur`,LP))}var HP=450,UP=e=>{let t=e.querySelector(`.row-title`);return!!t&&t.scrollWidth>t.clientWidth};function WP(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(()=>IP(e,i.current,`right`),HP)},s=()=>{a(),LP()};return(0,h.useEffect)(()=>{let e=r.current,n=e?.closest(`.rail`);if(!t||!e||!n||!NP()||!n.contains(document.activeElement)||!UP(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`||!UP(e.currentTarget)||o(e.currentTarget)},onPointerLeave:s,hide:s}}var GP={info:`text-info`,success:`text-success`,warning:`text-warning`,error:`text-error`};function KP(e){return e.tokens?.map(e=>(0,H.jsx)(`span`,{className:`max-w-32 truncate ${GP[e.tone??``]??`text-subtle`}`,title:e.source,children:e.text},`${e.source}:${e.text}`))}function qP({at:e}){let t=new Date(e);if(Number.isNaN(t.getTime()))return null;let n=Tg(t);return(0,H.jsxs)(`span`,{className:`text-subtle`,title:B(`rail.startsAt`,{time:t.toLocaleString()}),children:[`◷ `,n]})}var JP=2e4;function YP(e,t){let n=wp().prefs.statusMarkNoticeSeen===!1,r=BS();(0,h.useEffect)(()=>{!n||t===void 0||(Sp(e.client,`statusMarkNoticeSeen`,!0),t!==0&&r!==`dots`&&L(B(`rail.markNotice`),`info`,{label:B(`rail.markNoticeUndo`),run:()=>VS(e.client,`dots`)},JP))},[e,n,t,r])}function XP(e){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`button`,{type:`button`,className:Wm,title:e.sessionsTitle,onClick:e.onSessions,children:`≡`}),(0,H.jsx)(`button`,{type:`button`,className:Um,title:e.newTaskTitle,onClick:e.onNewTask,children:`+`})]})}var ZP=150,QP=128,$P=0,eF=2,tF=[{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}],nF=`/-\\|`,rF=6,iF=(e,t,n,r)=>{let i=e[n];i&&t>=0&&t<i.length&&(i[t]=r)};function aF(e,t){let n=Math.min(64,Math.max(24,Math.floor(t))),r=(Math.floor(e)%ZP+ZP)%ZP,i=Array.from({length:11},()=>Array(n).fill(` `)),a=Array.from({length:11},()=>Array(n).fill(` `));iF(a,$P,0,`o`);let o=eF+2*(tF.length-1),s=Math.min(o,Math.floor(r/2));for(let e=1;e<=s;e++)iF(i,$P,e,`|`);if(tF.forEach((e,t)=>{let o=eF+2*t,s=2*o;if(r<s)return;iF(i,$P,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))%rF+rF)%rF===0?iF(a,t,o,`=`):iF(i,t,o,`-`);d?iF(a,u,o,`o`):u<l?iF(a,u,o,`>`):iF(a,u,o,nF[(Math.floor(r/2)+t)%4]??`-`)}),r>=QP){let e=Math.ceil((r-QP+1)/22*(n+1));for(let t of[i,a])for(let r of t)r.fill(` `,0,Math.min(n,e))}return{base:i.map(e=>e.join(``)).join(`
60
+ `)}`},e.label))]})}var eA=30;function tA(e,t,n){let r=t.join(`\0`),[i,a]=(0,h.useState)(()=>Object.fromEntries(t.map(t=>[t,X(e,`routine.runs`,{id:t})?.runs??[]])));return(0,h.useEffect)(()=>{let n=!0;for(let r of t)Ku(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 nA(e){V();let{auto:t}=_E(),[n,r]=(0,h.useState)(null),i=Uk(e.runs,n),a=e=>{if(e.status===`skipped_blocked`){let t=e.blocked?.reason;return t?$(B(`runLog.blockedRun`),{reason:B(`runLog.blocked.${t}`)}):B(`runLog.outcome.blocked`)}return t.runStatus[e.status]??e.status},o=(e,t,n,r)=>(0,H.jsx)(U,{variant:`pill`,hit:`tight`,"aria-current":t,className:`max-w-40 truncate`,onClick:n,children:`[ ${e} ]`},r);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`h2`,{className:`${W} text-muted`,children:B(`runLog.title`)}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1`,children:[o(B(`runLog.all`),n===null,()=>r(null),`all`),Rk.map(e=>o(B(`runLog.outcome.${e}`),n===e,()=>r(e),e))]}),i.length===0?(0,H.jsx)(`p`,{className:`text-muted`,children:e.runs.length===0?t.noRuns:B(`runLog.empty`)}):i.slice(0,eA).map(n=>{let r=Zk(n.status),i=CO(n,e.now),o=i===`awaiting`?`, ${t.responseAwaiting}`:i===`missing`?`, ${t.responseMissing}`:``,s=Vk(n),c=(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{children:Xk[r]}),(0,H.jsx)(`span`,{children:`#${n.runNumber}`}),(0,H.jsx)(`span`,{className:Tk,children:`${a(n)}${n.tabId?`, ${n.tabId}`:``}${o}`}),(0,H.jsx)(`span`,{className:`text-subtle`,children:B(`runLog.source.${Bk[n.trigger]}`)}),s!==null&&(0,H.jsx)(`span`,{className:`text-muted`,children:Hk(s)}),(0,H.jsx)(`span`,{className:`text-muted`,children:e.when(n.at)})]}),l=n.error?Kk(n.error):null,u=n.taskId,d=i===`missing`?`text-warning`:Yk[r];return(0,H.jsxs)(`div`,{className:`${xk} ${d}`,children:[u?(0,H.jsx)(`button`,{type:`button`,className:`mono ${wk}`,onClick:()=>e.openRun(u),children:c}):(0,H.jsx)(`span`,{className:`mono ${Ck}`,children:c}),l&&(0,H.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,H.jsx)(`summary`,{children:l.summary}),(0,H.jsx)(`pre`,{children:l.full})]})]},n.id)}),i.length>eA&&(0,H.jsx)(`p`,{className:`text-muted`,children:B(`runLog.more`,{count:i.length-eA})})]})}function rA(e){let{auto:t}=_E(),n=vE(),r=V()===`zh`?`zh-CN`:`en-US`,{routine:i,busy:a,when:o}=e,s=ek(i.schedule,n),c=i.nextRunAt?Date.parse(i.nextRunAt):NaN;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:_k,children:[(0,H.jsx)(`h2`,{className:vk,children:i.name}),(0,H.jsxs)(`span`,{className:`mono ${Nx}`,children:[(0,H.jsx)(`button`,{type:`button`,className:`${Ar} ${Px.row}`,disabled:a,onClick:e.onRunNow,children:t.runNow}),(0,H.jsx)(`button`,{type:`button`,className:`${Ar} ${Px.row}`,disabled:a,onClick:e.onToggle,children:B(i.enabled?`pages.routinePause`:`pages.routineEnable`)}),(0,H.jsx)(`button`,{type:`button`,className:`${Ar} ${Px.row}`,disabled:a,onClick:e.onDelete,children:B(`pages.delete`)})]})]}),(0,H.jsxs)(`dl`,{className:yk,children:[(0,H.jsx)(`dt`,{className:`text-muted`,children:B(`pages.routineSchedule`)}),(0,H.jsxs)(`dd`,{children:[s??(0,H.jsx)(`span`,{className:`mono`,children:i.schedule}),s&&(0,H.jsx)(`span`,{className:`mono text-muted`,children:` ${i.schedule}`})]}),(0,H.jsx)(`dt`,{className:`text-muted`,children:B(`pages.routineNext`)}),(0,H.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,H.jsx)(`dt`,{className:`text-muted`,children:B(`pages.routineProject`)}),(0,H.jsx)(`dd`,{children:e.project}),!i.script&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{className:`text-muted`,children:B(`pages.routineDelivers`)}),(0,H.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,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{className:`text-muted`,children:B(`pages.routineEngine`)}),(0,H.jsxs)(`dd`,{className:`flex flex-wrap items-baseline gap-x-3.5`,children:[(0,H.jsx)(`span`,{children:e.engine}),(0,H.jsx)(U,{className:`font-mono`,hit:`tight`,disabled:a,onClick:e.onChangeEngine,children:B(`pages.routineChangeEngine`)})]})]})]}),i.precheck&&(0,H.jsx)(`p`,{className:`mono text-muted`,children:$(t.precheck,{command:i.precheck.command})}),i.script?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`h2`,{className:`${W} text-muted`,children:B(`pages.routineScript`)}),(0,H.jsx)(`p`,{className:`mono ${bk}`,children:i.script.command})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`h2`,{className:`${W} text-muted`,children:B(`pages.routinePrompt`)}),(0,H.jsx)(`p`,{className:bk,children:i.prompt})]}),(0,H.jsx)(nA,{runs:e.runs,now:e.now,when:o,openRun:e.openRun}),(0,H.jsx)(Qk,{runs:e.runs,when:o})]})}var iA=5e3;function aA({model:e}){let{auto:t,common:n}=_E(),r=e.client,[i,a]=TE(iA),o=y(e.tasks),s=CE(e),c=wE(e),[l,u]=(0,h.useState)(()=>X(r,`routine.list`)??null),[d,f]=(0,h.useState)(null),[p,m]=(0,h.useState)(null),[g,_]=(0,h.useState)(null),v=OE(),b=vE(),x=(0,h.useRef)(null);(0,h.useEffect)(()=>{let e=!0;return Ku(r,`routine.list`).then(t=>e&&u(t)).catch(()=>e&&u(e=>e??{automations:[],keepsDaemonAlive:!1})),()=>{e=!1}},[r,i]);let[S,w]=(0,h.useState)(()=>X(r,`engines.list`)?.engines??[]);(0,h.useEffect)(()=>r.onOpen(()=>{Ku(r,`engines.list`).then(e=>w(e.engines)).catch(()=>{})}),[r]);let T=l?.automations??[],E=l?.lastRunStatus??{},D=l?.lastFailure??{},A=e=>{let t=E[e.id];return t!==void 0&&SO(t)},j=[{key:`pages.routinesNeedYou`,rows:T.filter(A)},{key:`pages.routinesActive`,rows:T.filter(e=>e.enabled&&!A(e))},{key:`pages.routinesPaused`,rows:T.filter(e=>!e.enabled&&!A(e))}],M=j.flatMap(e=>e.rows),N=Math.max(0,M.findIndex(e=>e.id===d)),P=M[N],ee=e=>f(M[e]?.id??null),F=j[0]?.rows.length??0,I=y(k);(0,h.useEffect)(()=>{I===null||!l||(l.automations.some(e=>e.id===I)&&f(I),k.set(null))},[I,l]);let te=tA(r,P?[P.id]:[],i),ne=P?te[P.id]??[]:[];(0,h.useEffect)(()=>_(null),[P?.id]);let re=(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&&re.current&&e.offsetTop>re.current.offsetTop){e.scrollIntoView({block:`start`,behavior:`smooth`});return}re.current?.querySelector(`[data-row="${N}"]`)?.scrollIntoView({block:`nearest`})},[N,ie]);let R=Date.now(),z=e=>{let n=e?Date.parse(e):NaN;if(!Number.isFinite(n))return`—`;let r=n-R,i=r>=0,a=Math.floor(Math.abs(r)/6e4),o=Math.floor(a/60);return a<1?i?t.when.now:t.when.justNow:a<60?$(i?t.when.inMinutes:t.when.minutesAgo,{n:a}):o<24?$(i?t.when.inHours:t.when.hoursAgo,{n:o}):new Date(n).toLocaleDateString()},se=e=>o?.tasks.find(t=>t.id===e)?.label??e,ce=t=>{O.set(null),e.select(t)},le=(e,t,n)=>L($(e,{name:t,error:yE(n)}),`error`),ue=async()=>{if(!(!P||p)){m(P.id);try{await r.request(`routine.setEnabled`,{id:P.id,enabled:!P.enabled}),a()}catch(e){le(P.enabled?t.disableFailed:t.enableFailed,P.name,e)}finally{m(null)}}},de=async()=>{if(!(!P||p)){m(P.id),_($(t.running,{name:P.name}));try{let e=await r.request(`routine.runNow`,{id:P.id});_($(t.ranWith,{name:P.name,status:e.status})),a()}catch(e){le(t.runFailed,P.name,e)}finally{m(null)}}},fe=async()=>{if(p)return;let e=SE(await r.request(`repos.list`).then(e=>e.repos).catch(()=>[]),s);C.set((0,H.jsx)(Lk,{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){L($(t.createFailed,{error:yE(e)}),`error`)}finally{m(null)}})()}}))},pe=()=>{if(!P||p)return;let e=P;C.set((0,H.jsx)(Ti,{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){le(t.deleteFailed,e.name,n)}finally{m(null)}}}))};DE(e=>{if(e.ctrlKey)return e.key===`c`&&(O.set(null),!0);switch(e.key){case`Escape`:case`q`:return O.set(null),!0;case`j`:case`ArrowDown`:return ee(Math.min(M.length-1,N+1)),!0;case`k`:case`ArrowUp`:return ee(Math.max(0,N-1)),!0;case`n`:return fe(),!0;case`r`:return a(),!0;case`e`:return ue(),!0;case`s`:return de(),!0;case`d`:return pe(),!0;case`Enter`:{let e=ne[0]?.taskId;return e?ce(e):ne.length>0&&_(t.latestRunNoTask),!0}default:return!1}});let me=e=>xO(e,e=>S.find(t=>t.id===e)?.name??e,t.engineDefault),he=()=>{if(!P)return;let n=P;C.set((0,H.jsx)(ok,{model:e,current:async()=>({engine:n.vendor,effort:n.modelEffort,model:n.model}),onSet:async e=>{let i=await r.request(`routine.setEngine`,{id:n.id,engine:e.engine.id,model:e.model??``,effort:e.effort??``});_($(i.releasedSessionTaskId?t.engineChangedNewSession:t.engineChanged,{name:n.name,engine:[e.engine.name,e.model,e.effort].filter(Boolean).join(` · `)})),a()}}))},ge=e=>e===void 0?B(`rail.noProject`):xE(e,T.flatMap(e=>e.repo??[]));return(0,H.jsxs)(`div`,{className:`${Ox} ${sk}`,tabIndex:0,ref:v,children:[(0,H.jsxs)(`div`,{className:jx,children:[(0,H.jsx)(`h1`,{className:Ax,children:t.title}),(0,H.jsxs)(`span`,{className:`mono ${Nx}`,children:[F>0&&(0,H.jsx)(`span`,{className:`text-error`,children:$(t.needAttention,{count:String(F),total:String(M.length)})}),(0,H.jsx)(`span`,{className:`text-muted`,children:l?.keepsDaemonAlive?t.holdingDaemon:t.notHolding}),(0,H.jsx)(`button`,{type:`button`,className:`${Ar} ${Px.header}`,onClick:()=>void fe(),children:B(`pages.new`)})]})]}),(0,H.jsx)(Nk,{client:r,tick:i,reload:a}),l===null?(0,H.jsx)(`p`,{className:`text-muted`,children:n.loading}):M.length===0?(0,H.jsxs)(`div`,{className:Fx,children:[(0,H.jsx)(`p`,{className:`text-muted`,children:t.empty}),(0,H.jsx)(`p`,{className:`keys-only`,children:t.emptyHint})]}):(0,H.jsxs)(`div`,{className:ck,children:[(0,H.jsx)(`div`,{className:lk,ref:re,children:j.map(e=>e.rows.length===0?null:(0,H.jsxs)(`section`,{children:[(0,H.jsxs)(`h2`,{className:`${W} ${uk} ${e===j[0]?`text-error`:`text-muted`}`,children:[B(e.key),` `,(0,H.jsx)(`span`,{className:`mono`,children:e.rows.length})]}),e.rows.map(e=>{let n=M.indexOf(e),r=E[e.id],i=r?Zk(r):null;return(0,H.jsxs)(`div`,{"data-row":n,className:dk(n===N),onClick:()=>{ee(n),ae(e=>e+1)},children:[(0,H.jsxs)(`span`,{className:fk,children:[(0,H.jsx)(`span`,{className:pk(!e.enabled),children:e.name}),(0,H.jsx)(`span`,{className:`mono text-muted ${mk}`,children:e.enabled?z(e.nextRunAt):t.paused}),(0,H.jsx)(`span`,{className:`mono ${i?Yk[i]:`text-muted`}`,style:{width:`1ch`},children:i?Xk[i]:` `})]}),(0,H.jsx)(`span`,{className:`mono text-muted ${hk}`,title:e.schedule,children:[ge(e.repo),ek(e.schedule,b)??e.schedule,me(e)?.short].filter(Boolean).join(` · `)}),D[e.id]?(0,H.jsx)(`span`,{className:`mono text-warning ${hk}`,title:D[e.id]?.reason,children:$(t.lastFailed,{when:z(D[e.id]?.at),reason:D[e.id]?.reason??``})}):null]},e.id)})]},e.key))}),(0,H.jsx)(`div`,{className:gk,ref:x,children:P?(0,H.jsx)(rA,{routine:P,runs:ne,busy:p===P.id,project:ge(P.repo),engine:me(P)?.full??null,targetTitle:P.target?se(P.target.taskId):void 0,now:R,when:z,openRun:ce,onRunNow:()=>void de(),onToggle:()=>void ue(),onDelete:pe,onChangeEngine:he}):(0,H.jsx)(`p`,{className:`text-muted`,children:t.noSelection})})]}),g&&(0,H.jsx)(`p`,{className:`text-muted mx-0 mt-2 mb-0 text-meta leading-[inherit]`,children:g})]})}var oA=v({});function sA(e,t,n){let r=oA.get()[`${e}::${t.id}`];return r&&r.sig===Zd(n)&&Wd(n.root).some(e=>e.id===r.leaf)?r.leaf:n.activeLeafId}function cA(e,t,n,r){oA.set({...oA.get(),[`${e}::${t}`]:{sig:Zd(n),leaf:r}})}function lA(e,t,n,r){cA(e,t.id,n,r),Po(qu(e,t.id,r))?.focus()}function uA(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 dA(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){L(e instanceof Error?e.message:String(e),`error`)}}function fA(e,t,n,r,i){let a=i??(n.split?sA(t,n,n.split):`leaf-1`),o=e.selection.get();(o.taskId!==t||o.tabId!==n.id)&&e.select(t,n.id);let s=Po(qu(t,n.id,a))?.size();dA(e,{taskId:t,tabId:n.id,action:`open`,direction:r,leafId:a,...s},e=>{e.changed?e.split&&cA(t,n.id,e.split,e.leaf):L(B(`layout.splitTooSmall`),`error`)})}function pA(e,t,n,r){let i=n.split,a=i?sA(t,n,i):r,o=()=>dA(e,{taskId:t,tabId:n.id,action:`close`,leafId:r},e=>{let i=e.split;if(!i)return;let o=a!==r&&Wd(i.root).some(e=>e.id===a);cA(t,n.id,i,o?a:i.activeLeafId)});if(!i||!Yd(n,i,r)){o();return}C.set((0,H.jsx)(Ti,{title:B(`confirm.closePaneTitle`,{pane:Jd(i,Hd(n)).get(r)??r}),body:B(`confirm.closePaneBody`),confirmLabel:B(`menu.closePane`),onConfirm:o}))}function mA(e,t,n,r){let i=n.split;i&&C.set((0,H.jsx)(wi,{title:xl(`split.renameTitle`),initial:Jd(i,Hd(n)).get(r)??``,allowEmpty:!0,submitLabel:B(`dialog.save`),onSubmit:i=>dA(e,{taskId:t,tabId:n.id,action:`rename`,leafId:r,title:i})}))}function hA(e,t,n,r){return[{label:B(`menu.renamePane`),section:`split`,key:nl(`workspace.split.rename`)??void 0,run:()=>mA(e,t,n,r)},{label:B(`menu.closePane`),section:`split`,key:ba(`workspace.split.close`)||void 0,run:()=>pA(e,t,n,r)}]}function gA(e,t,n,r){return[{label:B(`menu.splitRight`),section:`split`,key:nl(`workspace.split.right`)??void 0,run:()=>fA(e,t,n,`right`,r)},{label:B(`menu.splitDown`),section:`split`,key:nl(`workspace.split.down`)??void 0,run:()=>fA(e,t,n,`down`,r)}]}function _A(e,t,n,r){let i=n.split,a=r??(i?sA(t,n,i):`leaf-1`);return[...gA(e,t,n,a),...Gd(i)?hA(e,t,n,a):[]]}function vA(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)??po(n);return!i||!Xd(i)?[]:gA(e,t,i,i.split?sA(t,i,i.split):`leaf-1`)}function yA({model:e,task:t}){let[n,r]=(0,h.useState)(()=>X(e,`task.get`,{taskId:t.id})?.task??null),[i,a]=(0,h.useState)(null),{busy:o,error:s,submit:c}=Ci();(0,h.useEffect)(()=>{Ku(e,`task.get`,{taskId:t.id}).then(e=>r(e.task)).catch(e=>a(G(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,H.jsx)(Si,{title:q(`tasks`,`runAgain.title`),wide:!0,children:(0,H.jsxs)(`form`,{className:Gr,onSubmit:e=>{e.preventDefault(),l()},children:[(0,H.jsx)(`p`,{className:`text-muted`,children:q(`tasks`,`runAgain.source`,{title:t.label})}),(0,H.jsx)(`pre`,{className:Er,children:n?.prompt??i??q(`tasks`,`fieldNotes.loading`)}),(0,H.jsx)(`p`,{className:Tr,children:q(`tasks`,`runAgain.hint`)}),s&&(0,H.jsx)(`p`,{className:`text-error`,children:s}),(0,H.jsx)(Di,{busy:o||!n?.prompt,submitLabel:q(`tasks`,`runAgain.confirm`)})]})})}function bA(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 xA({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:G(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(G(e))}}};return(0,H.jsx)(Si,{title:q(`tasks`,`fieldNotes.title`),wide:!0,children:(0,H.jsxs)(`div`,{className:Gr,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,H.jsx)(`p`,{className:`font-mono text-meta break-all text-muted`,children:t}),n.kind===`loading`&&(0,H.jsx)(`p`,{className:`text-muted`,children:q(`tasks`,`fieldNotes.loading`)}),n.kind===`error`&&(0,H.jsx)(`p`,{className:`text-error`,children:n.message}),n.kind===`ready`&&f.length===0&&(0,H.jsx)(`p`,{className:`text-muted`,children:q(`tasks`,`fieldNotes.empty`)}),f.length>0&&(0,H.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,H.jsx)(`li`,{children:(0,H.jsxs)(`button`,{type:`button`,className:Dr(t===i),onClick:()=>a(t),autoFocus:t===0,children:[(0,H.jsxs)(`span`,{className:`font-mono text-meta whitespace-pre text-accent`,children:[t===i?`▸ `:` `,bA(e.at),`, `,e.author]}),(0,H.jsx)(`span`,{className:`text-ink whitespace-pre-wrap wrap-anywhere`,children:e.text})]})},`${e.at}:${t}`))}),o&&(0,H.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-sm border-hairline border-line bg-paper px-3 py-2.5`,children:[(0,H.jsx)(`p`,{children:(0,H.jsx)(`strong`,{children:q(`tasks`,`fieldNotes.confirmDelete.title`)})}),(0,H.jsx)(`p`,{className:`text-muted`,children:q(`tasks`,`fieldNotes.confirmDelete.body`,{text:o.text})}),c&&(0,H.jsx)(`p`,{className:`text-error`,children:c}),(0,H.jsxs)(`div`,{className:`actions flex items-center justify-end gap-3.5`,children:[(0,H.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>s(null),children:B(`dialog.cancel`)}),(0,H.jsx)(`button`,{type:`button`,className:xr({danger:!0}),onClick:()=>void p(o),children:B(`taskops.retire`)})]})]}),!o&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{className:`keys-only font-sans text-meta text-subtle`,children:q(`tasks`,`fieldNotes.footerDeletable`)}),(0,H.jsxs)(`div`,{className:`actions flex items-center justify-end gap-3.5`,children:[(0,H.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,disabled:f[i]?.id===void 0,onClick:()=>s(f[i]??null),children:B(`taskops.retire`)}),(0,H.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:z,children:B(`taskops.close`)})]})]})]})})}var SA=[`backlog`,`in_progress`,`in_review`,`done`,`canceled`,`error`],CA={backlog:`status.backlog`,in_progress:`status.inProgress`,in_review:`status.inReview`,done:`status.done`,canceled:`status.canceled`,error:`status.error`},wA=e=>({binding:e,key:nl(e)??void 0});async function TA(e,t){if(!e){L(B(`menu.nothingToCopy`,{what:t}),`error`);return}try{await navigator.clipboard.writeText(e),L(B(`menu.copied`,{text:e}))}catch{L(B(`menu.copyFailed`),`error`)}}function EA(e,t,n){let r=[{label:B(`menu.newTask`),section:`open`,run:()=>bv(t)}],i=(n,i,a)=>{i!==null&&r.push({label:n,section:`edit`,run:()=>void e.client.request(`project.move`,{repo:t,target:i,side:a}).catch(e=>L(q(`tasks`,`toast.moveFailed`,{error:String(e)}),`error`))})};return i(q(`tasks`,`menu.moveToTop`),n.top,`before`),i(q(`tasks`,`menu.moveProjectUp`),n.above,`before`),i(q(`tasks`,`menu.moveProjectDown`),n.below,`after`),r.push({label:B(`menu.viewSessions`),section:`open`,run:()=>_e(t)}),r.push({label:q(`tasks`,`menu.fieldNotes`),section:`notes`,run:()=>C.set((0,H.jsx)(xA,{model:e,repo:t}))}),n.local&&r.push({label:q(`tasks`,`menu.forgetProject`),section:`danger`,danger:!0,run:()=>C.set(jy(e,t,n.label))}),r}function DA(e){return[{label:B(`menu.newChatNoFolder`),section:`open`,run:()=>xv()},{label:B(`menu.newShell`),section:`open`,run:()=>void od(e).catch(e=>L(String(e),`error`))},{label:B(`menu.viewSessions`),section:`open`,run:()=>_e(``)}]}function OA(){Rp(!Lp.get()),document.querySelector(`.rail`)?.focus()}function kA(e,t,n){let r=n.filter(e=>!e.startsWith(`ssh://`)&&e!==t.repo),i=r.map(e=>{let t=e.slice(e.lastIndexOf(`/`)+1);return{value:e,label:r.filter(e=>e.endsWith(`/${t}`)).length>1?e:t}});return i.length===0?(L(q(`tasks`,`moveToProject.empty`),`error`),null):(0,H.jsx)(Ei,{title:q(`tasks`,`moveToProject.title`),choices:i,onPick:async n=>{await e.client.request(`task.moveToProject`,{taskId:t.id,repo:n}),L(q(`tasks`,`toast.movedToProject`,{project:i.find(e=>e.value===n)?.label??n}))}})}function AA(e,t,n){let r=e.client,i=[];n&&(i.push({label:B(`menu.closeTab`),section:`tab`,run:()=>C.set((0,H.jsx)(Ti,{title:B(`confirm.closeTabTitle`,{tab:n.title??n.engineName??n.id}),body:B(`confirm.closeTabBody`),confirmLabel:B(`menu.closeTab`),onConfirm:async()=>{await e.closeTab(t.id,n.id)}}))}),i.push(..._A(e,t.id,n))),i.push({label:B(`menu.newChat`),section:`open`,run:()=>void id(e,t.id)}),i.push({label:B(`menu.newChatPick`),section:`open`,rare:!0,run:()=>C.set((0,H.jsx)(ud,{model:e,taskId:t.id}))}),i.push({label:B(`menu.continueEngine`),section:`open`,rare:!0,...wA(`chat.tab.fork`),run:()=>C.set((0,H.jsx)(ud,{model:e,taskId:t.id,context:`continue`,sourceTabId:n?.id}))}),i.push({label:B(`menu.newShell`),section:`open`,run:()=>void ad(e,t.id,{kind:`shell`}).catch(e=>L(String(e),`error`))}),t.kind===`task`&&t.ownsBranch===!0&&t.branch&&!t.sharesWorkspaceOf&&!t.machine&&!t.extraRepoCount&&i.push({label:q(`tasks`,`menu.newTaskFromBranch`),section:`open`,rare:!0,run:()=>te({repo:t.repo,baseBranch:t.branch,worktree:!0})}),t.startsAt&&(i.push({label:B(`menu.startNow`),section:`open`,run:()=>void e.client.request(`task.startScheduledNow`,{taskId:t.id}).catch(e=>L(String(e),`error`))}),i.push({label:B(`menu.cancelStart`),section:`open`,run:()=>void e.client.request(`task.cancelScheduledStart`,{taskId:t.id}).catch(e=>L(String(e),`error`))})),t.hasPrompt&&(i.push({label:q(`tasks`,`menu.runAgain`),section:`open`,run:()=>C.set((0,H.jsx)(yA,{model:e,task:t}))}),i.push({label:B(`menu.retryEdit`),section:`open`,rare:!0,run:()=>void o_(e,t)}));let a=!t.machine;if(a&&i.push({label:q(`tasks`,`menu.openEditor`),section:`open`,...wA(`tasks.openWorktree`),run:()=>void Dy(e,t.id)}),t.groupId){let e=t.groupId;i.push({label:B(`compare.menu`),section:`open`,run:()=>ge(e)})}i.push({label:B(`menu.rename`),section:`edit`,...wA(`sidebar.rename`),run:()=>C.set((0,H.jsx)(wi,{title:B(`menu.rename`),initial:t.title,submitLabel:B(`dialog.save`),onSubmit:n=>e.act(`task.rename`,{taskId:t.id,title:n}).then(()=>{})}))}),i.push({label:t.pinned?B(`menu.unpin`):B(`menu.pin`),section:`edit`,...wA(`sidebar.pin`),run:()=>void e.act(`task.pin`,{taskId:t.id,pinned:!t.pinned}).catch(e=>L(String(e),`error`))}),a&&i.push({label:q(`tasks`,`menu.reorder`),section:`edit`,rare:!0,...wA(`sidebar.localMerge`),run:()=>OA()}),i.push({label:B(`menu.setStatus`),section:`edit`,children:SA.map(n=>({label:B(CA[n]),checked:n===t.status,run:()=>void e.act(`task.setStatus`,{taskId:t.id,status:n}).catch(e=>L(String(e),`error`))}))}),a&&!t.routine&&!t.parentTaskId&&!t.extraRepoCount&&i.push({label:q(`tasks`,`menu.moveToProject`),section:`edit`,rare:!0,run:()=>void e.client.request(`repos.list`).then(n=>{let r=kA(e,t,n.repos);r&&C.set(r)}).catch(e=>L(String(e),`error`))}),a&&i.push({label:B(`menu.changeEngine`),section:`edit`,rare:!0,...wA(`tasks.cycleEngine`),run:()=>C.set((0,H.jsx)(ok,{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}}),L(q(`tasks`,`toast.engineSwitched`,{engine:n.engine.name}))}}))}),t.pr?.checkState===`failing`&&i.push({label:q(`tasks`,`menu.fixChecks`),section:`git`,key:ba(`files.fixChecks`),run:()=>void Ey(e,t.id,B(`taskops.fixSent`))}),t.kind===`task`&&t.branch&&a&&i.push({label:q(`tasks`,`menu.syncBase`),section:`git`,rare:!0,key:ba(`files.syncBase`),run:()=>void wy(e,t.id)}),t.branch&&i.push({label:B(`menu.renameBranch`),section:`git`,rare:!0,...wA(`tasks.renameBranch`),run:()=>C.set((0,H.jsx)(wi,{title:B(`menu.renameBranch`),initial:t.branch,submitLabel:B(`dialog.save`),onSubmit:e=>r.request(`task.setBranch`,{taskId:t.id,branch:e}).then(()=>{})}))}),t.kind===`task`&&t.branch&&i.push({label:B(`menu.land`),section:`git`,run:()=>void Sy(e,t)});let o=[{label:B(`menu.copyWhat.id`),run:()=>void TA(t.id,B(`menu.what.id`))}];return t.branch&&o.push({label:B(`menu.copyWhat.branch`),run:()=>void TA(t.branch,B(`menu.what.branch`))}),o.push({label:B(`menu.copyWhat.path`),run:()=>void r.request(`task.get`,{taskId:t.id}).then(e=>TA(e.task.worktreePath,B(`menu.what.path`))).catch(e=>L(String(e),`error`))}),i.push({label:B(`menu.copy`),section:`copy`,children:o}),i.push({label:q(`tasks`,t.archived?`menu.unarchive`:`menu.archive`),section:`danger`,run:()=>void Ay(e,t)}),i.push({label:B(`menu.removeSession`),section:`danger`,...wA(`sidebar.delete`),danger:!0,run:()=>C.set(ky(e,t))}),i}var jA=e=>Date.parse(e.updatedAt??e.createdAt??``)||0;function MA(e,t,n){return(n===`archived`?e?.archived??[]:e?.tasks??[]).filter(e=>!e.routine).filter(e=>t===null||!Ad(e)&&bE(e.repo)===bE(t)).sort((e,t)=>jA(t)-jA(e))}function NA(e){let t=new Set,n=[];for(let r of[...e?.tasks??[],...e?.archived??[]]){if(r.routine||Ad(r)||r.repo.startsWith(`ssh://`))continue;let e=bE(r.repo);t.has(e)||(t.add(e),n.push(r.repo))}return n}function PA({tabs:e,value:t,onChange:n,className:r}){return(0,H.jsx)(`div`,{className:It(`flex gap-1`,r),role:`tablist`,children:e.map(e=>{let r=e.id===t;return(0,H.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":r,className:It(`relative rounded-sm px-2.5 py-0.75 font-mono text-meta font-semibold`,`touch:after:absolute touch:after:content-[''] touch:after:-inset-x-0.5 touch:after:-top-2 touch:after:-bottom-1.5`,r?`bg-inset text-ink group-focus-within/pane:text-accent`:`text-muted`),onClick:()=>n(e.id),children:e.label},e.id)})})}function FA({model:e}){let{common:t}=_E(),n=y(e.tasks),r=y(j)??``,[i,a]=(0,h.useState)(`active`),[o,s]=(0,h.useState)(0),c=NA(n),l=r===``?null:r,u=MA(n,l,i),d=Math.min(o,Math.max(0,u.length-1)),f=(0,h.useRef)(null);(0,h.useEffect)(()=>f.current?.focus(),[]);let p=(0,h.useRef)(null);(0,h.useEffect)(()=>{p.current?.querySelector(`[data-row="${d}"]`)?.scrollIntoView({block:`nearest`})},[d]);let m=t=>{O.set(null),e.select(t)},g=e=>{a(e),s(0)},_=e=>{let t=[``,...c],n=t.findIndex(e=>e===``?r===``:bE(e)===bE(r));j.set(t[(Math.max(0,n)+(e?t.length-1:1))%t.length]??``),s(0)};DE(e=>{if(e.ctrlKey)return e.key===`c`&&(O.set(null),!0);let t=u[d];switch(e.key){case`Escape`:case`q`:return O.set(null),!0;case`j`:case`ArrowDown`:return s(Math.min(u.length-1,d+1)),!0;case`k`:case`ArrowUp`:return s(Math.max(0,d-1)),!0;case`Tab`:return _(e.shiftKey),!0;case`a`:return g(i===`active`?`archived`:`active`),!0;case`Enter`:return t&&m(t.id),!0;default:return!1}});let v=Date.now();return(0,H.jsxs)(`div`,{className:`group/pane ${kx}`,tabIndex:0,ref:f,children:[(0,H.jsxs)(`div`,{className:jx,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,H.jsx)(`h1`,{className:Ax,children:B(`sessions.title`)}),(0,H.jsx)(PA,{tabs:[{id:`active`,label:B(`sessions.active`)},{id:`archived`,label:B(`sessions.archived`)}],value:i,onChange:g})]}),(0,H.jsx)(`span`,{className:`mono touch:empty:hidden! text-muted ${Mx(!0)}`,children:l?xE(l,c):B(`sessions.allProjects`)})]}),n?u.length===0?(0,H.jsx)(`p`,{className:`text-muted`,children:B(i===`archived`?`sessions.emptyArchived`:`sessions.emptyActive`)}):(0,H.jsx)(`div`,{className:Fx,ref:p,children:u.map((t,n)=>{let r=Date.parse(t.updatedAt??t.createdAt??``);return(0,H.jsx)(`div`,{"data-row":n,className:Ix(n===d),onClick:()=>m(t.id),onContextMenu:r=>{s(n),uF(r,AA(e,t,null))},children:(0,H.jsxs)(`div`,{className:Lx,children:[(0,H.jsx)(`span`,{className:Bx,title:t.label,children:t.label}),l===null&&!Ad(t)?(0,H.jsx)(`span`,{className:`mono text-meta ${Rx}`,children:xE(t.repo,c)}):null,(0,H.jsx)(`span`,{className:`mono text-meta ${Rx}`,children:Number.isFinite(r)?KE(r,v):``})]})},t.id)})}):(0,H.jsx)(`p`,{className:`text-muted`,children:t.loading}),(0,H.jsx)(`p`,{className:`mt-2.5 mb-0 text-meta text-subtle touch:hidden`,children:B(`sessions.keys`)})]})}function IA({active:e=!1,onSelect:t,plus:n=!1,children:r}){return(0,H.jsxs)(`button`,{type:`button`,className:`rail-nav-row ${Wx(e)}`,"aria-current":e?`page`:void 0,onClick:t,children:[r,n?(0,H.jsx)(`span`,{className:Gx,"aria-hidden":`true`,children:`+`}):null]})}var LA=`mx-auto flex max-w-[76rem] flex-col font-mono text-meta leading-[1.5]`,RA=`flex items-end justify-between gap-[4ch]`,zA=`m-0 text-title font-bold tracking-[0.02em]`,BA=`font-bold tracking-code uppercase`,VA=`text-muted`,HA=`text-subtle`,UA=`my-4 border-t-hairline border-dashed! border-line-active`,WA=`m-0 mb-1.5 text-meta text-muted ${BA}`,GA=`${WA} flex flex-wrap items-baseline justify-between gap-x-[4ch]`,KA=`flex flex-wrap items-start gap-x-[8ch] gap-y-4`,qA=`min-w-[min(100%,36ch)] flex-1`,JA=`text-[3.5rem] leading-none font-bold tracking-[-0.03em]`,YA=`grid grid-cols-[repeat(auto-fit,minmax(min(100%,34ch),1fr))] items-start gap-x-[6ch] gap-y-5`,XA=`flex min-w-0 items-baseline gap-[1ch] whitespace-nowrap`,ZA=`min-w-0 truncate`,QA=`min-w-[2ch] flex-1 -translate-y-0.75 border-b-hairline border-dotted! border-line-active`,$A=`pl-[2ch] text-subtle`,ej=`-mx-[1ch] block rounded-sm px-[1ch] py-0.5 text-left`,tj=`${ej} w-[calc(100%+2ch)] cursor-pointer hover:bg-hover focus-visible:outline-1 focus-visible:-outline-offset-1 focus-visible:outline-focus`,nj=`grid grid-cols-[6ch_minmax(0,1fr)_5ch_5ch_8ch] items-center gap-x-[2ch] py-0.5 whitespace-nowrap`,rj=[`bg-accent`,`bg-info`,`bg-merged`,`bg-subtle`],ij=`grid grid-cols-[minmax(0,1fr)_minmax(8ch,14ch)_5ch] items-center gap-x-[1ch] whitespace-nowrap`,aj=`relative h-2.5 border-hairline border-current after:absolute after:inset-y-0 after:left-0 after:w-(--fill) after:bg-current after:content-['']`,oj={ok:`${aj} text-success`,warn:`${aj} text-warning`,crit:`${aj} text-error`},sj=`flex h-9 flex-none items-stretch text-ink`,cj=`flex-none bg-current`,lj=`flex flex-wrap items-baseline justify-between gap-x-[4ch] gap-y-1 text-subtle`,uj={turns:0,tokens:0,ms:0},dj=e=>(e.usage?.input_tokens??0)+(e.usage?.output_tokens??0),fj=e=>Math.max(0,e.endedAt-e.startedAt),pj=(e,t)=>({turns:e.turns+1,tokens:e.tokens+dj(t),ms:e.ms+fj(t)});function mj(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function hj(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(mj(n.getTime()))}let a=new Map(i.map(e=>[e,{sum:uj,byEngine:{}}]));for(let t of e){let e=a.get(mj(t.startedAt));if(!e)continue;let n=t.vendor??`unknown`;e.sum=pj(e.sum,t),e.byEngine[n]=(e.byEngine[n]??0)+dj(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:mj(o)}:null;return{cutoff:s,days:i.map(e=>{let t=a.get(e);return{day:e,...t?.sum??uj,byEngine:t?.byEngine??{},partial:s!==null&&e<=s.day}})}}function gj(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,...pj(t.get(i)??uj,n)})}return[...t.values()].sort((e,t)=>t.tokens-e.tokens||t.turns-e.turns)}function _j(e,t){let n=new Map;for(let t of e)n.set(t.taskId,{taskId:t.taskId,...pj(n.get(t.taskId)??uj,t)});return[...n.values()].sort((e,t)=>t.tokens-e.tokens||t.turns-e.turns).slice(0,t)}function vj(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 yj=.1,bj=/^(\d+)\s*(h|d)$/;function xj(e,t){let n=bj.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*yj)||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 Sj=14,Cj=500,wj=3e4,Tj=8;function Ej(e,t,n,r){let i=X(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 Ku(e,t,n).then(e=>r&&o({kind:`ready`,value:e})).catch(e=>r&&o(t=>t.kind===`ready`?t:{kind:`failed`,error:yE(e)})),()=>{r=!1}},[e,t,s,r]),a}var Dj=()=>(0,H.jsx)(`div`,{className:UA});function Oj({name:e,title:t,sum:n,sub:r,open:i}){let a=(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`span`,{className:XA,children:[(0,H.jsx)(`span`,{className:ZA,title:t,children:e}),(0,H.jsx)(`span`,{className:QA}),(0,H.jsx)(`span`,{children:vj(n.tokens)})]}),(0,H.jsx)(`span`,{className:`block truncate ${$A}`,children:[r,`${n.turns}t`,Hk(n.ms)].filter(Boolean).join(` · `)})]});return i?(0,H.jsx)(U,{variant:`row`,className:tj,onClick:i,children:a}):(0,H.jsx)(`div`,{className:ej,children:a})}function kj({sum:e}){let t=`${e.tokens}${e.turns}${e.ms}`.repeat(4).slice(0,36);return(0,H.jsx)(`div`,{className:sj,"aria-hidden":`true`,children:[...t].map((e,t)=>(0,H.jsx)(`span`,{className:cj,style:{width:1+Number(e)%3,marginRight:1+Number(e)%2}},t))})}function Aj({usage:e,nameOf:t}){let n=Date.now(),r=e.flatMap(e=>e.windows.map(r=>{let i=xj(r,n),a=i?.kind===`full`&&i.at-n<72e6,o=i?.kind===`full`?$(B(`usage.full`),{time:new Date(i.at).toLocaleString([],{...a?{}:{weekday:`short`},hour:`2-digit`,minute:`2-digit`})}):i?B(`usage.lasts`):``;return{key:`${e.vendor}:${r.kind}`,name:`${e.name||t(e.vendor)} ${r.label}`,percent:Math.round(r.percent),tone:cT({capturedAt:e.capturedAt,windows:[r]},n)?.tone??`ok`,note:o}}));return r.length===0?null:(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`h2`,{className:WA,children:B(`usage.quota`)}),r.map(e=>(0,H.jsxs)(`div`,{className:`py-0.5`,children:[(0,H.jsxs)(`div`,{className:ij,children:[(0,H.jsx)(`span`,{className:ZA,children:e.name}),(0,H.jsx)(`span`,{className:oj[e.tone]??oj.ok,style:{"--fill":`${Math.min(100,Math.max(0,e.percent))}%`}}),(0,H.jsx)(`span`,{className:`text-right ${Vn[e.tone]}`,children:`${e.percent}%`})]}),e.note&&(0,H.jsx)(`div`,{className:`pl-[2ch] text-subtle`,children:e.note})]},e.key))]})}function jj({model:e}){V();let t=OE(),[n]=TE(wj),r=Ej(e,`turns.list`,{sinceDays:Sj,limit:Cj},n),i=Ej(e,`engines.list`,{},n),a=Ej(e,`usage.get`,{},n),o=y(e.tasks),s=i.kind===`ready`?i.value.engines:[],c=e=>s.find(t=>t.id===e)?.name??e,l=e=>o?.tasks.find(t=>t.id===e)?.label??B(`usage.removedTask`),u=a.kind===`ready`&&a.value.usage&&(0,H.jsx)(Aj,{usage:a.value.usage,nameOf:c});return(0,H.jsx)(`div`,{className:kx,tabIndex:0,ref:t,onKeyDown:e=>{e.metaKey||e.ctrlKey||e.altKey||e.key!==`q`&&e.key!==`Escape`||(e.preventDefault(),O.set(null))},children:(0,H.jsx)(`div`,{className:LA,children:(()=>{if(r.kind===`loading`)return(0,H.jsx)(`p`,{className:`m-0 ${VA}`,children:B(`usage.loading`)});if(r.kind===`failed`)return(0,H.jsx)(`p`,{className:`m-0 text-error`,children:$(B(`usage.failed`),{error:r.error})});let t=r.value.turns,n=new Set(r.value.readers??[]),i=hj(t,Date.now(),Sj,Cj),a=new Map;for(let e of i.days)for(let[t,n]of Object.entries(e.byEngine))a.set(t,(a.get(t)??0)+n);let s=[...a].sort((e,t)=>t[1]-e[1]).map(([e])=>e),d=e=>rj[Math.max(0,s.indexOf(e))%rj.length]??rj[0],f=Math.max(0,...i.days.map(e=>e.tokens)),p=i.days.slice(Math.max(0,i.days.findIndex(e=>e.turns>0))),m=i.days.reduce((e,t)=>({turns:e.turns+t.turns,tokens:e.tokens+t.tokens,ms:e.ms+t.ms}),{turns:0,tokens:0,ms:0}),h=[...new Set((o?.tasks??[]).flatMap(e=>e.engine?.id&&!n.has(e.engine.id)?[e.engine.id]:[]))];return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:RA,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`h1`,{className:zA,children:[(0,H.jsx)(`span`,{className:Gn,children:`[`}),` rove `,(0,H.jsx)(`span`,{className:Gn,children:`]`})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{className:BA,children:B(`usage.receipt`)}),(0,H.jsx)(`span`,{className:VA,children:` ${i.days[0]?.day.slice(5)} → ${i.days.at(-1)?.day.slice(5)}`})]})]}),t.length>0&&(0,H.jsx)(kj,{sum:m})]}),(0,H.jsx)(Dj,{}),t.length===0?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{className:`m-0 ${VA}`,children:B(`usage.empty`)}),u&&(0,H.jsx)(Dj,{}),u]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:KA,children:[(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`h2`,{className:WA,children:B(`usage.total`)}),(0,H.jsx)(`div`,{className:JA,children:vj(m.tokens)}),(0,H.jsx)(`div`,{className:`mt-1.5 ${VA}`,children:`${$(B(`usage.turns`),{count:m.turns})} · ${Hk(m.ms)}`})]}),(0,H.jsxs)(`section`,{className:qA,children:[(0,H.jsxs)(`h2`,{className:GA,children:[B(`usage.perDay`),s.length>1&&(0,H.jsx)(`span`,{className:`flex flex-wrap gap-x-[2ch] font-normal tracking-normal normal-case`,children:s.map(e=>(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`span`,{className:`mr-[1ch] inline-block size-2 align-baseline ${d(e)}`}),c(e)]},e))})]}),p.map(e=>(0,H.jsxs)(`div`,{className:nj,children:[(0,H.jsx)(`span`,{className:VA,children:`${e.day.slice(5)}${e.partial?`~`:``}`}),(0,H.jsx)(`span`,{className:`flex min-w-0`,children:e.tokens>0&&f>0&&(0,H.jsx)(`span`,{className:`flex h-2.5 w-(--fill) min-w-0.5 gap-px`,style:{"--fill":`${e.tokens/f*100}%`},children:s.map(t=>(e.byEngine[t]??0)>0&&(0,H.jsx)(`span`,{className:`min-w-0.5 basis-0 ${d(t)}`,style:{flexGrow:e.byEngine[t]}},t))})}),e.turns>0&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`text-right`,children:vj(e.tokens)}),(0,H.jsx)(`span`,{className:`text-right text-subtle`,children:`${e.turns}t`}),(0,H.jsx)(`span`,{className:`text-right text-subtle`,children:Hk(e.ms)})]})]},e.day))]})]}),(0,H.jsx)(Dj,{}),(0,H.jsxs)(`div`,{className:YA,children:[(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`h2`,{className:WA,children:B(`usage.byModel`)}),gj(t).map(e=>(0,H.jsx)(Oj,{name:e.model,title:`${c(e.engine)} · ${e.model}`,sum:e,sub:c(e.engine)},`${e.engine}\0${e.model}`))]}),(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`h2`,{className:WA,children:B(`usage.topTasks`)}),_j(t,Tj).map(t=>{let n=o?.tasks.some(e=>e.id===t.taskId),r=l(t.taskId);return(0,H.jsx)(Oj,{name:n?r:(0,H.jsx)(`span`,{className:HA,children:r}),title:r,sum:t,open:n?()=>{O.set(null),e.select(t.taskId)}:null},t.taskId)})]}),u]})]}),(0,H.jsx)(Dj,{}),(0,H.jsxs)(`div`,{className:lj,children:[(0,H.jsx)(`span`,{children:$(B(`usage.range`),{days:Sj})}),i.cutoff&&(0,H.jsx)(`span`,{children:$(B(`usage.cutoff`),{count:i.cutoff.count,day:i.cutoff.day.slice(5)})}),h.length>0&&(0,H.jsx)(`span`,{children:$(B(`usage.noReader`),{engines:h.map(c).join(`, `)})}),(0,H.jsx)(`span`,{className:`${BA} ml-auto`,children:B(`usage.thanks`)})]})]})})()})})}var Mj={id:`mods`,label:`mods`},Nj=[{id:`kanban`,label:`kanban`,mod:`kanban`},{id:`routines`,label:`automations`},{id:`issues`,label:`issues`,mod:`issues`}];function Pj({model:e}){let{nav:t}=_E(),n=y(O),r=y(e.mods).length>0,i=y(e.installedMods),a=[...Nj.filter(e=>!e.mod||i.has(e.mod)),...r?[Mj]:[]];return(0,H.jsxs)(`div`,{className:Vx,children:[(0,H.jsx)(IA,{plus:!0,onSelect:()=>bv(),children:B(`rail.newTask`)}),a.map(e=>(0,H.jsx)(IA,{active:n===e.id,onSelect:()=>he(e.id),children:t[e.label]},e.id)),(0,H.jsx)(IA,{active:n===`sessions`,onSelect:()=>_e(``),children:B(`sessions.title`)})]})}function Fj({model:e,page:t}){let n=y(e.installedMods);return t===`kanban`&&n.has(`kanban`)?(0,H.jsx)(rO,{model:e}):t===`routines`?(0,H.jsx)(aA,{model:e}):t===`issues`&&n.has(`issues`)?(0,H.jsx)(nD,{model:e}):t===`mods`?(0,H.jsx)(bO,{model:e}):t===`compare`?(0,H.jsx)(WE,{model:e}):t===`usage`?(0,H.jsx)(jj,{model:e}):t===`sessions`?(0,H.jsx)(FA,{model:e}):null}var Ij=f();function Lj(e){return e?.match(/^https?:\/\/[^/]+\/([^/]+\/[^/]+)\/(?:pull|merge_requests|-\/merge_requests)\//)?.[1]}var Rj=e=>e.charAt(0).toUpperCase()+e.slice(1);function zj(e){return[B(`rail.pr.state.${e.state}`),...e.checks?[B(`rail.pr.checks.${e.checks}`)]:[]].join(`, `)}function Bj(e){let t=new Map;for(let n of e){let e=Ah(n),r=[...e&&n.pr?[{pr:n.pr,mark:e}]:[],...(n.sessionPrs??[]).flatMap(e=>{let t=jh(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&&Mh([a.mark,i])!==a.mark)&&t.set(r,{task:n,pr:e,mark:i})}}return[...t.values()]}function Vj({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=lu();(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=Bj(e),p=Mh(f.map(e=>e.mark));if(!p)return null;let m=f.length===1?`PR #${f[0]?.pr.number??``}, ${zj(p)}`:B(`rail.pr.many`,{count:f.length});return(0,H.jsxs)(`span`,{ref:o,className:`chip ${Om} ${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,H.jsx)(`span`,{className:`font-sans`,children:f.length}),n&&(0,Ij.createPortal)((0,H.jsx)(`div`,{ref:c,className:km(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=Lj(t?.url),i=t?.additions!==void 0&&t.deletions!==void 0;return(0,H.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,H.jsx)(`span`,{className:`truncate font-semibold text-ink`,children:t.title||e.label}),(0,H.jsxs)(`span`,{className:`flex items-baseline gap-0 text-meta leading-[inherit] whitespace-nowrap`,children:[(0,H.jsxs)(`span`,{className:`inline-flex items-baseline gap-1.25 ${n.tone}`,children:[(0,H.jsx)(`span`,{className:`font-mono`,children:n.glyph}),Rj(B(`rail.pr.state.${n.state}`))]}),(0,H.jsx)(`span`,{className:`overflow-hidden text-ellipsis whitespace-pre text-muted`,children:[...n.checks?[B(`rail.pr.checks.${n.checks}`)]:[],[r,t?.number===void 0?``:`#${t.number}`].filter(Boolean).join(` `)].filter(Boolean).map(e=>`, ${e}`).join(``)}),i&&(0,H.jsxs)(`span`,{className:`ml-auto flex gap-1.5 pl-3 tabular-nums`,children:[(0,H.jsxs)(`span`,{className:`text-success`,children:[`+`,t.additions]}),(0,H.jsxs)(`span`,{className:`text-error`,children:[`−`,t.deletions]})]})]})]},t.url??`${e.id}#${t.number??``}`)})}),document.body)]})}function Hj(e,t,n){let r=e=>e.repo===t.repo&&!e.pinned==!t.pinned;if(t.id===n.id||!r(n))return null;let i=e.filter(r).sort((e,t)=>(e.order??e.rank)-(t.order??t.rank)).map(e=>e.id);return i.indexOf(n.id)-i.indexOf(t.id)}function Uj(e,t,n,r){let i=Hj(e,t,n);return i===null?null:r===`above`&&i>0?i-1:r===`below`&&i<0?i+1:i}function Wj(e,t){return e.id!==t.id&&t.repo===e.repo&&!t.pinned==!e.pinned}var Gj=e=>e===void 0||e.kind===`project`||e.kind===`state`?0:e.kind===`task`||e.kind===`pane`||e.kind===`round`?e.depth:1;function Kj(e,t){let n=Gj(e[t]),r=t+1;for(;r<e.length&&Gj(e[r])>n;)r++;return r}function qj(e,t){let n=Gj(e[t]),r=[];for(let i=2;i<=n;i++){let a=t+1;for(;a<e.length&&Gj(e[a])>i;)a++;let o=a<e.length&&Gj(e[a])===i;r.push(i===n?o?`tee`:`elbow`:o?`pipe`:`blank`)}return r}function Jj(e,t,n,r){let i=e.findIndex(e=>e.id===t);if(i<0||t===n)return e;let a=Kj(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:Kj(s,c);return[...s.slice(0,l),...o,...s.slice(l)]}var Yj={duration:180,easing:`cubic-bezier(0.16, 1, 0.3, 1)`};function Xj(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}],Yj):t!==e.offsetTop&&e.animate([{transform:`translateY(${t-e.offsetTop}px)`},{transform:`none`}],Yj)}})}var Zj=null,Qj=()=>(Zj||(Zj=new Image,Zj.src=`data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7`),Zj);function $j(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);Xj(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&&!Ad(t))??null:e.kind===`task`&&e.depth===1?e.task:null,x=e=>{let t=b(e);if(t)return{draggable:!0,onDragStart:n=>{n.dataTransfer.effectAllowed=`move`,n.dataTransfer.setDragImage(Qj(),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,Kj(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&&!Wj(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),Fp(`default`),L(q(`tasks`,`sort.label`,{mode:q(`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=>L(q(`tasks`,`toast.moveFailed`,{error:e instanceof Error?e.message:String(e)}),`error`)).finally(u);return}let m=Uj(t,i.from,i.to,i.side);m?Bp(e,i.from.id,m).finally(u):l.current()}},w=e=>{let t=[...e?.querySelectorAll(`[data-row]`)??[]];g.current=new Map(t.map((e,n)=>{let r=t[n-1],i=r?e.offsetTop-r.offsetTop-r.offsetHeight:0;return[e.dataset.row??``,{top:e.offsetTop,gap:i,height:e.offsetHeight}]}))},T=(e,t)=>{m.current=t?Jj(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,Kj(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 eM({model:e,narrow:t,onSettings:n}){V();let r=y(VC),i=Q(`engines.skill.bannerHintWeb`,{engines:r.join(`, `)});return(0,H.jsxs)(`div`,{className:Hx,children:[!t&&(0,H.jsx)(uT,{client:e.client}),(0,H.jsxs)(`div`,{className:Ux,children:[(0,H.jsxs)(`button`,{type:`button`,className:`rail-nav-row ${Wx(!1)}`,onClick:n,children:[(0,H.jsxs)(`svg`,{className:Kx,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[(0,H.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,H.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`})]}),(0,H.jsx)(`span`,{children:B(`rail.settings`)}),r.length>0&&(0,H.jsx)(`span`,{className:`ml-2 min-w-0 truncate text-meta text-subtle`,title:i,children:B(`rail.skillCue`)})]}),(0,H.jsx)(BT,{model:e,bindingId:`settings.open`})]})]})}function tM(e,{task:t,tab:n,leaf:r}){n.split&&lA(t.id,n,n.split,r),e.select(t.id,n.id)}function nM(e){let{row:t}=e,n=y(e.model.selection);y(oA);let r=n.taskId===t.task.id&&n.tabId===t.tab.id&&!!t.tab.split&&sA(t.task.id,t.tab,t.tab.split)===t.leaf;return(0,H.jsxs)(`button`,{type:`button`,className:`${hi({size:`pane`})} ${e.cursor?Im:``}`,"aria-current":r||void 0,onClick:e.onClick,onContextMenu:e.onMenu,...e.place,children:[(0,H.jsx)(`span`,{className:Cm,"aria-hidden":`true`,children:e.guides?.map((e,t)=>(0,H.jsx)(`span`,{className:Em(e)},t))}),(0,H.jsx)(`span`,{className:`${gi} text-(length:--fs-meta) ${r?`text-ink`:`text-muted`}`,children:t.label})]})}var rM=`rove.collapsedProjects`,iM=`rove.foldedTasks`,aM=`rove.openedTasks`,oM=600;function sM(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 cM(e,t){try{localStorage.setItem(e,JSON.stringify([...t]))}catch{}}var lM=(e,t)=>{let n=new Set(e);return n.delete(t)||n.add(t),n};function uM(){let e=y(Np),[t,n]=(0,h.useState)({active:!1,query:``}),[r,i]=(0,h.useState)(()=>sM(rM)),a=e=>i(t=>{let n=lM(t,e);return cM(rM,n),n}),[o,s]=(0,h.useState)(()=>({folded:sM(iM),opened:sM(aM)}));return{sort:e,cycleSort:Ip,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)),cM(iM,r),cM(aM,i),{folded:r,opened:i}})}}var dM=[`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 fM(e){for(let t of e)for(let e of dM){let n=ya(e).indexOf(t);if(n>=0)return{id:e,slot:n}}return null}function pM(e,t){let n=e.selection.get().taskId===t;e.select(t),pe(),n&&!vv(e.client)&&bo()}function mM(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)(()=>By.set(f),[f]);let p=l[0]?.id??null;(0,h.useEffect)(()=>{i.query,i.active&&s(p)},[i.active,i.query,p]);let m=e=>{let t=l[Math.max(0,Math.min(l.length-1,e))];t&&s(t.id)},g=t=>{t?.kind===`task`&&e.select(t.task.id),t?.kind===`round`&&ge(t.groupId),t?.kind===`pane`&&tM(e,t),t&&pe()},_=(t,n)=>{t?.kind===`task`&&x(AA(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=Eu(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}),L(B(`rail.engineSwitched`,{engine:i.name}))}catch(e){L(B(`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=fM(qc(t));if(Lp.get()){let n=o?.kind===`task`&&o.machine===void 0;if(d?.id===`sidebar.nav`)n&&zp(e,o,d.slot%2==0?1:-1);else if(d?.id===`sidebar.localMerge`||t.key===`Enter`||t.key===`Escape`)Rp(!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<oM?(m(0),c.current=0):c.current=Date.now();break;case`sidebar.select`:case`sidebar.tree.open`:g(o);break;case`tasks.focusEngine`:bo();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&&Rp(!0);break;case`sidebar.sort`:n.cycleSort(),L(q(`tasks`,`sort.label`,{mode:q(`tasks`,`sort.modes.${Np.get()}`)}));break;case`sidebar.search.enter`:a({active:!0,query:``});break;case`task.new`:r.onNewTask(o?.kind===`task`||o?.kind===`pane`?o.task.repo:void 0,o?.machine);break;case`settings.open.sidebar`:r.onSettings();break;case`worktrees.open.sidebar`:he(`worktrees`);break;case`tasks.update`:he(`update`);break;default:return}t.preventDefault()},onPress:e=>{let t=e.target.closest(`[data-row]`)?.dataset.row;t&&s(t)}}}var hM=192,gM=`rove.web.railWidth`,_M=`rove.web.railFolded`;function vM(){let e=Number(localStorage.getItem(gM));return Number.isFinite(e)&&e>0?e:null}var yM=v(vM());yM.subscribe(()=>{let e=yM.get();e===null?localStorage.removeItem(gM):localStorage.setItem(gM,String(Math.round(e)))}),yM.subscribe(le);var bM=v(localStorage.getItem(_M)===`1`);bM.subscribe(()=>localStorage.setItem(_M,bM.get()?`1`:`0`));var xM=v(!1),SM=null,CM=!1;function wM(e){SM!==null&&window.clearTimeout(SM),SM=null,CM=e,e?xM.set(!0):SM=window.setTimeout(()=>S.get()===null&&xM.set(!1),250)}S.subscribe(()=>{S.get()===null&&xM.get()&&!CM&&wM(!1)}),bM.subscribe(()=>xM.set(!1)),bM.subscribe(le);function TM(e,t=window.innerWidth){let n=Math.max(hM,t-320);return Math.max(hM,Math.min(n,Math.round(e)))}var EM=(e,t,n)=>`~pane:${e}:${t}:${n}`;function DM(e,t){return e.flatMap(e=>e.kind===`task`?[e,...(t[e.task.id]??[]).flatMap(t=>{let n=t.split;if(!n||!Gd(n))return[];let r=Jd(n,Hd(t));return Wd(n.root).map(n=>({id:EM(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 OM(e){let{row:t}=e;return(0,H.jsxs)(`button`,{type:`button`,className:`${hi({size:`pane`})} ${e.cursor?Im:``}`,title:B(`compare.menu`),onClick:()=>{e.onClick(),ge(t.groupId)},...e.place,children:[e.guides&&(0,H.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,H.jsx)(`span`,{className:Em(e)},t))}),(0,H.jsx)(`span`,{className:`${gi} text-(length:--fs-meta) text-muted`,children:t.title}),(0,H.jsxs)(`span`,{className:`${xi} ml-auto items-center`,children:[e.repo&&(0,H.jsx)(`span`,{className:`max-w-24 truncate text-subtle`,children:e.repo}),(0,H.jsx)(`span`,{className:`text-subtle`,children:t.tasks.length}),(0,H.jsx)(Bh,{status:Oh(t.tasks)})]})]})}function kM(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,H.jsxs)(`div`,{className:`${Nm} mono items-center`,children:[(0,H.jsx)(`span`,{className:`text-accent`,children:`/`}),(0,H.jsx)(`input`,{ref:t,className:Pm,type:`text`,autoFocus:!0,spellCheck:!1,autoComplete:`off`,autoCapitalize:`off`,enterKeyHint:`go`,value:e.query,placeholder:B(`rail.searchPlaceholder`),"aria-label":B(`rail.searchPlaceholder`),onChange:t=>e.onChange(t.target.value)}),e.query&&(0,H.jsx)(`span`,{className:`ml-1.5 text-muted`,children:e.count})]})}var AM=Math.min,jM=Math.max,MM=Math.round,NM=Math.floor,PM=e=>({x:e,y:e}),FM={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function IM(e,t,n){return jM(e,AM(t,n))}function LM(e,t){return typeof e==`function`?e(t):e}function RM(e){return e.split(`-`)[0]}function zM(e){return e.split(`-`)[1]}function BM(e){return e===`x`?`y`:`x`}function VM(e){return e===`y`?`height`:`width`}function HM(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function UM(e){return BM(HM(e))}function WM(e,t,n){n===void 0&&(n=!1);let r=zM(e),i=UM(e),a=VM(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=$M(o)),[o,$M(o)]}function GM(e){let t=$M(e);return[KM(e),t,KM(t)]}function KM(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var qM=[`left`,`right`],JM=[`right`,`left`],YM=[`top`,`bottom`],XM=[`bottom`,`top`];function ZM(e,t,n){switch(e){case`top`:case`bottom`:return n?t?JM:qM:t?qM:JM;case`left`:case`right`:return t?YM:XM;default:return[]}}function QM(e,t,n,r){let i=zM(e),a=ZM(RM(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(KM)))),a}function $M(e){let t=RM(e);return FM[t]+e.slice(t.length)}function eN(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function tN(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:eN(e)}function nN(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 rN(e,t,n){let{reference:r,floating:i}=e,a=HM(t),o=UM(t),s=VM(o),c=RM(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=zM(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function iN(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}=LM(t,e),p=tN(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=nN(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=nN(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 aN=50,oN=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:iN},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=rN(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<aN&&(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}=rN(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},sN=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}=LM(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=RM(r),_=HM(o),v=RM(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[$M(o)]:GM(o)),x=p!==`none`;!d&&x&&b.push(...QM(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=WM(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`||_===HM(t)||T.every(e=>HM(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=HM(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{}}}},cN=new Set([`left`,`top`]);async function lN(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=RM(n),s=zM(n),c=HM(n)===`y`,l=cN.has(o)?-1:1,u=a&&c?-1:1,d=LM(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 uN=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 lN(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}}}}},dN=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}=LM(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=HM(i),p=BM(f),m=u[p],h=u[f],g=(e,t)=>IM(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 fN(){return typeof window<`u`}function pN(e){return gN(e)?(e.nodeName||``).toLowerCase():`#document`}function mN(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function hN(e){return((gN(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function gN(e){return fN()?e instanceof Node||e instanceof mN(e).Node:!1}function _N(e){return fN()?e instanceof Element||e instanceof mN(e).Element:!1}function vN(e){return fN()?e instanceof HTMLElement||e instanceof mN(e).HTMLElement:!1}function yN(e){return!fN()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof mN(e).ShadowRoot}function bN(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=jN(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function xN(e){return/^(table|td|th)$/.test(pN(e))}function SN(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var CN=/transform|translate|scale|rotate|perspective|filter/,wN=/paint|layout|strict|content/,TN=e=>!!e&&e!==`none`,EN;function DN(e){let t=_N(e)?jN(e):e;return TN(t.transform)||TN(t.translate)||TN(t.scale)||TN(t.rotate)||TN(t.perspective)||!kN()&&(TN(t.backdropFilter)||TN(t.filter))||CN.test(t.willChange||``)||wN.test(t.contain||``)}function ON(e){let t=NN(e);for(;vN(t)&&!AN(t);){if(DN(t))return t;if(SN(t))return null;t=NN(t)}return null}function kN(){return EN??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),EN}function AN(e){return/^(html|body|#document)$/.test(pN(e))}function jN(e){return mN(e).getComputedStyle(e)}function MN(e){return _N(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function NN(e){if(pN(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||yN(e)&&e.host||hN(e);return yN(t)?t.host:t}function PN(e){let t=NN(e);return AN(t)?(e.ownerDocument||e).body:vN(t)&&bN(t)?t:PN(t)}function FN(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=PN(e),i=r===e.ownerDocument?.body,a=mN(r);if(i){let e=IN(a);return t.concat(a,a.visualViewport||[],bN(r)?r:[],e&&n?FN(e):[])}return t.concat(r,FN(r,[],n))}function IN(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function LN(e){let t=jN(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=vN(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=MM(n)!==a||MM(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function RN(e){return _N(e)?e:e.contextElement}function zN(e){let t=RN(e);if(!vN(t))return PM(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=LN(t),o=(a?MM(n.width):n.width)/r,s=(a?MM(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var BN=PM(0);function VN(e){let t=mN(e);return!kN()||!t.visualViewport?BN:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function HN(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===mN(e)}function UN(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=RN(e),o=PM(1);t&&(r?_N(r)&&(o=zN(r)):o=zN(e));let s=HN(a,n,r)?VN(a):PM(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=mN(a),t=_N(r)?mN(r):r,n=e,i=IN(n);for(;i&&t!==n;){let e=zN(i),t=i.getBoundingClientRect(),r=jN(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=mN(i),i=IN(n)}}return nN({width:u,height:d,x:c,y:l})}function WN(e,t){let n=MN(e).scrollLeft;return t?t.left+n:UN(hN(e)).left+n}function GN(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-WN(e,n),y:n.top+t.scrollTop}}function KN(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=hN(r),s=t?SN(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=PM(1),u=PM(0),d=vN(r);if((d||!a)&&((pN(r)!==`body`||bN(o))&&(c=MN(r)),d)){let e=UN(r);l=zN(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?GN(o,c):PM(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 qN(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function JN(e){let t=MN(e),n=e.ownerDocument.body,r=jM(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=jM(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+WN(e),o=-t.scrollTop;return jN(n).direction===`rtl`&&(a+=jM(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var YN=25;function XN(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=mN(e),a=hN(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!kN()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(WN(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<=YN&&(s-=o)}return{width:s,height:c,x:l,y:u}}function ZN(e,t){let n=UN(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=zN(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function QN(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=XN(e,n,t);else if(t===`document`)r=JN(hN(e));else if(_N(t))r=ZN(t,n);else{let n=VN(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return nN(r)}function $N(e,t){let n=t.get(e);if(n)return n;let r=FN(e,[],!1).filter(e=>_N(e)&&pN(e)!==`body`),i=null,a=jN(e).position===`fixed`,o=a?NN(e):e;for(;_N(o)&&!AN(o);){let e=jN(o),t=DN(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=NN(o)}return t.set(e,r),r}function eP(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?SN(t)?[]:$N(t,this._c):[].concat(n),r],o=QN(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=QN(t,a[e],i);s=jM(n.top,s),c=AM(n.right,c),l=AM(n.bottom,l),u=jM(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function tP(e){let{width:t,height:n}=LN(e);return{width:t,height:n}}function nP(e,t,n){let r=vN(t),i=hN(t),a=n===`fixed`,o=UN(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=PM(0);if((r||!a)&&((pN(t)!==`body`||bN(i))&&(s=MN(t)),r)){let e=UN(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=WN(i));let l=i&&!r&&!a?GN(i,s):PM(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 rP(e){return jN(e).position===`static`}function iP(e,t){if(!vN(e)||jN(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return hN(e)===n&&(n=n.ownerDocument.body),n}function aP(e,t){let n=mN(e);if(SN(e))return n;if(!vN(e)){let t=NN(e);for(;t&&!AN(t);){if(_N(t)&&!rP(t))return t;t=NN(t)}return n}let r=iP(e,t);for(;r&&xN(r)&&rP(r);)r=iP(r,t);return r&&AN(r)&&rP(r)&&!DN(r)?n:r||ON(e)||n}var oP=async function(e){let t=this.getOffsetParent||aP,n=this.getDimensions,r=await n(e.floating);return{reference:nP(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function sP(e){return jN(e).direction===`rtl`}var cP={convertOffsetParentRelativeRectToViewportRelativeRect:KN,getDocumentElement:hN,getClippingRect:eP,getOffsetParent:aP,getElementRects:oP,getClientRects:qN,getDimensions:tP,getScale:zN,isElement:_N,isRTL:sP};function lP(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function uP(e,t,n){let r=null,i,a=hN(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=NM(d),h=NM(a.clientWidth-(u+f)),g=NM(a.clientHeight-(d+p)),_=NM(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:jM(0,AM(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!lP(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=mN(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function dP(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=RN(e),u=i||a?[...l?FN(l):[],...t?FN(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?uP(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?UN(e):null;c&&g();function g(){let t=UN(e);h&&!lP(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 fP=uN,pP=dN,mP=sN,hP=(e,t,n)=>{let r=new Map,i=n??{},a={...cP,...i.platform,_c:r};return oN(e,t,{...i,platform:a})},gP=`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`,_P=500,vP=400,yP=`rove-tip`,bP=null,xP=null,SP=null,CP=null,wP=0,TP=!1,EP=()=>TP;function DP(){return bP?.isConnected?bP:(bP=document.createElement(`div`),bP.id=yP,bP.setAttribute(`role`,`tooltip`),bP.className=gP,bP.hidden=!0,document.body.append(bP),bP)}function OP(){CP!==null&&window.clearTimeout(CP),CP=null}function kP(e,t,n=`top`){OP(),AP();let r=DP();r.textContent=t,r.hidden=!1,xP=e,e.setAttribute(`aria-describedby`,yP),SP=dP(e,r,()=>{if(!e.isConnected)return AP();hP(e,r,{strategy:`fixed`,placement:n,middleware:[fP(6),mP(),pP({padding:8})]}).then(({x:e,y:t})=>{r.style.left=`${e}px`,r.style.top=`${t}px`})})}function AP(){OP(),xP&&(SP?.(),SP=null,xP.getAttribute(`aria-describedby`)===yP&&xP.removeAttribute(`aria-describedby`),xP=null,bP&&(bP.hidden=!0),wP=performance.now())}function jP(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 MP(e){if(e===xP)return;OP();let t=xP!==null||performance.now()-wP<vP,n=()=>e.isConnected&&e.dataset.tip&&kP(e,e.dataset.tip);t?n():CP=window.setTimeout(n,_P)}var NP=!1;function PP(){NP||(NP=!0,document.addEventListener(`pointerover`,e=>{if(e.pointerType===`touch`)return;let t=jP(e.target);t?MP(t):xP&&e.target instanceof Node&&xP.contains(e.target)||AP()}),document.addEventListener(`pointerout`,e=>{let t=jP(e.target);t&&!(e.relatedTarget instanceof Node&&t.contains(e.relatedTarget))&&AP()}),document.addEventListener(`keydown`,e=>{TP=!0,e.key===`Escape`&&AP()},!0),document.addEventListener(`pointerdown`,()=>{TP=!1,AP()},!0),document.addEventListener(`focusin`,e=>{let t=TP?jP(e.target):null;t&&MP(t)}),document.addEventListener(`focusout`,e=>{e.target===xP&&AP()}),window.addEventListener(`blur`,AP))}var FP=450,IP=e=>{let t=e.querySelector(`.row-title`);return!!t&&t.scrollWidth>t.clientWidth};function LP(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(()=>kP(e,i.current,`right`),FP)},s=()=>{a(),AP()};return(0,h.useEffect)(()=>{let e=r.current,n=e?.closest(`.rail`);if(!t||!e||!n||!EP()||!n.contains(document.activeElement)||!IP(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`||!IP(e.currentTarget)||o(e.currentTarget)},onPointerLeave:s,hide:s}}var RP={info:`text-info`,success:`text-success`,warning:`text-warning`,error:`text-error`};function zP(e){return e.tokens?.map(e=>(0,H.jsx)(`span`,{className:`max-w-32 truncate ${RP[e.tone??``]??`text-subtle`}`,title:e.source,children:e.text},`${e.source}:${e.text}`))}function BP({at:e}){let t=new Date(e);if(Number.isNaN(t.getTime()))return null;let n=wg(t);return(0,H.jsxs)(`span`,{className:`text-subtle`,title:B(`rail.startsAt`,{time:t.toLocaleString()}),children:[`◷ `,n]})}var VP=2e4;function HP(e,t){let n=wp().prefs.statusMarkNoticeSeen===!1,r=RS();(0,h.useEffect)(()=>{!n||t===void 0||(Sp(e.client,`statusMarkNoticeSeen`,!0),t!==0&&r!==`dots`&&L(B(`rail.markNotice`),`info`,{label:B(`rail.markNoticeUndo`),run:()=>zS(e.client,`dots`)},VP))},[e,n,t,r])}function UP(e){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`button`,{type:`button`,className:Um,title:e.sessionsTitle,onClick:e.onSessions,children:`≡`}),(0,H.jsx)(`button`,{type:`button`,className:Hm,title:e.newTaskTitle,onClick:e.onNewTask,children:`+`})]})}var WP=150,GP=128,KP=0,qP=2,JP=[{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}],YP=`/-\\|`,XP=6,ZP=(e,t,n,r)=>{let i=e[n];i&&t>=0&&t<i.length&&(i[t]=r)};function QP(e,t){let n=Math.min(64,Math.max(24,Math.floor(t))),r=(Math.floor(e)%WP+WP)%WP,i=Array.from({length:11},()=>Array(n).fill(` `)),a=Array.from({length:11},()=>Array(n).fill(` `));ZP(a,KP,0,`o`);let o=qP+2*(JP.length-1),s=Math.min(o,Math.floor(r/2));for(let e=1;e<=s;e++)ZP(i,KP,e,`|`);if(JP.forEach((e,t)=>{let o=qP+2*t,s=2*o;if(r<s)return;ZP(i,KP,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))%XP+XP)%XP===0?ZP(a,t,o,`=`):ZP(i,t,o,`-`);d?ZP(a,u,o,`o`):u<l?ZP(a,u,o,`>`):ZP(a,u,o,YP[(Math.floor(r/2)+t)%4]??`-`)}),r>=GP){let e=Math.ceil((r-GP+1)/22*(n+1));for(let t of[i,a])for(let r of t)r.fill(` `,0,Math.min(n,e))}return{base:i.map(e=>e.join(``)).join(`
61
61
  `),accent:a.map(e=>e.join(``)).join(`
62
- `)}}var oF=`min-h-0 w-full overflow-y-auto`,sF=`mx-auto mt-[min(16vh,8rem)] flex w-full max-w-130 flex-col gap-4 px-5 pb-7`,cF=`relative grid w-full select-none overflow-hidden font-mono text-(length:--fs-body) text-subtle [contain:layout_paint]`,lF=`col-start-1 row-start-1 m-0 whitespace-pre font-[inherit] leading-[inherit]`,uF=`invisible absolute top-0 left-0 whitespace-pre`,dF=1.3,fF=`0000000000`,pF=1e3/12;function mF(){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=aF(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)/pF);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,H.jsxs)(`div`,{ref:e,"aria-hidden":`true`,"data-field":`first-run-art`,className:cF,style:{height:`${11*dF}em`,lineHeight:dF},children:[(0,H.jsx)(`span`,{ref:t,className:uF,children:fF}),(0,H.jsx)(`pre`,{ref:n,className:lF}),(0,H.jsx)(`pre`,{ref:r,className:`${lF} text-accent`})]})}function hF(e){let t=q(`doctor`,`fix.humanOnlyWhy`),n=[];if(e.git||n.push({id:`git`,label:q(`doctor`,`fix.git`),action:q(`doctor`,`fix.gitAction`),why:t}),e.engines.length===0){let r=e.signedOut.length>0;n.push({id:`engine`,label:q(`doctor`,r?`fix.noEngineLogin`:`fix.noEngine`),action:q(`doctor`,r?`fix.noEngineLoginAction`:`fix.noEngineAction`,{list:e.signedOut.map(e=>e.id).join(`, `)}),why:t})}return n}function gF({model:e}){V(),y(da);let[t,n]=(0,h.useState)(()=>X(e,`welcome.env`)??null);(0,h.useEffect)(()=>{let t=!0;return Ku(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)?hF(t):[];return(0,H.jsx)(`div`,{className:oF,"data-field":`welcome`,children:(0,H.jsxs)(`div`,{className:sF,children:[(0,H.jsx)(mF,{}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,H.jsx)(`h1`,{className:`m-0 font-sans text-title font-semibold text-ink`,children:B(`firstRun.title`)}),(0,H.jsx)(`p`,{className:`m-0 font-sans text-body text-muted`,children:B(`firstRun.body`)})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(`button`,{type:`button`,className:xr(),"data-field":`start-first-task`,onClick:()=>xv(t?.start?.repo),children:B(`firstRun.start`)}),(0,H.jsx)(`span`,{className:`keys-only mono text-meta text-subtle`,children:ba(`task.new.global`)})]}),t!==null&&r!==null&&(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5 font-sans text-meta`,children:[(0,H.jsx)(`p`,{className:`m-0 ${r.warn?`text-warning`:`text-subtle`}`,children:q(`workspace`,`welcome.${r.key}`,{list:r.list})}),!t.git&&(0,H.jsx)(`p`,{className:`m-0 text-warning`,children:q(`workspace`,`welcome.gitMissing`)}),i.map(e=>(0,H.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,H.jsx)(`p`,{className:`m-0 text-warning`,children:e.label}),(0,H.jsx)(`p`,{className:`mono m-0 text-accent`,children:e.action}),(0,H.jsx)(`p`,{className:`m-0 text-muted`,children:e.why})]},e.id)),i.length>0&&(0,H.jsx)(`p`,{className:`m-0 text-muted`,children:q(`common`,`failureHint`,{command:`rove doctor`})})]})]})})}function _F(e,t){e.preventDefault(),S.set({x:e.clientX,y:e.clientY,items:t,target:e.currentTarget,fromKeyboard:e.button!==2})}function vF({model:e,narrow:t}){let n=V(),r=y(e.tasks),i=y(e.remote),a=Zm(e),o=y(e.tabs),s=RS(e);YP(e,r?.tasks.length);let c=y(e.tabsSettled),l=y(e.selection),u=r?.tasks??[],d=r?.attention.filter(e=>e.unread).length??0,f=l.taskId,p=sM(u,o,c),m=new Map([...u,...i].map(e=>[e.id,e])),g=_M(),_=y(Lp),v=y(Op)===`state`,x=y(Rp),S=e=>(v?Av:Vd)({tasks:u,remote:i,machines:a,sort:g.sort,query:e,fold:{...g.hand,selectedId:f??void 0}}),w=S(g.search.active?g.search.query:``),{groups:T}=w,E=g.search.active?w.rows:Ud(PM(jv(rM(w.rows,p,l.taskId,c,x)),o),g.collapsed),D=e=>e.filter(e=>e.kind!==`project`&&e.kind!==`state`&&e.kind!==`round`),O=(n===`zh`?Gi:Wi).machine,k=new Set(a.filter(e=>e.state!==`online`).map(e=>e.alias)),A=T.find(e=>e.tasks.some(e=>e.kind===`main`))?.repo,j=e=>({mainTaskId:T.find(t=>t.repo===e)?.tasks.find(e=>e.kind===`main`)?.id??null,label:dd(e),first:e===A}),M=tM(e,u,!g.search.active&&!v,g.sort==="default"),{place:N,dragging:P}=M.places(E),ee=()=>C.set((0,H.jsx)(xT,{model:e})),F=xM(e,E,g,{selectedId:f,onNewTask:xv,onSettings:ee}),I=x!==null&&E.some(e=>e.id===x),te=F.setCursor;(0,h.useEffect)(()=>{I&&x!==null&&te(x)},[I,x,te]);let ne=D(S(``).rows).length,re=(0,h.useRef)(null),ie=y(DM)&&!t,ae=y(OM)&&ie,L=t?u.find(e=>e.id===l.taskId&&!e.deleting)??null:null;return(0,H.jsxs)(`nav`,{className:`${Mm} ${ie?`is-folded`:``}`,ref:re,inert:ie&&!ae,"aria-hidden":ie&&!ae,onMouseEnter:ie?()=>jM(!0):void 0,onMouseLeave:ie?()=>jM(!1):void 0,tabIndex:0,onKeyDown:e=>{YT(`sidebar`),F.onKeyDown(e)},children:[(0,H.jsxs)(`header`,{className:Nm,children:[(0,H.jsxs)(`span`,{className:`${Wn} mr-auto`,children:[(0,H.jsx)(`span`,{className:Gn,children:`[`}),` rove `,(0,H.jsx)(`span`,{className:Gn,children:`]`})]}),(0,H.jsxs)(`span`,{className:`relative`,children:[(0,H.jsx)(`button`,{type:`button`,className:`m-0 text-meta font-medium normal-nums inbox-chip relative ${fi} ${Gt} ${d>0?`text-accent`:`text-muted`}`,onClick:()=>C.set((0,H.jsx)(pp,{model:e})),children:B(`rail.inbox`,{count:d})}),(0,H.jsx)(HT,{model:e,bindingId:`inbox.show`,head:!0})]}),(0,H.jsx)(CS,{})]}),_&&(0,H.jsxs)(`div`,{className:`flex gap-1 px-3.5 pb-2 text-meta mono`,children:[(0,H.jsx)(`span`,{className:`text-accent`,children:q(`tasks`,`moveChip`).trim()}),(0,H.jsx)(`span`,{className:`keys-only ml-1.5 text-muted`,children:(0,H.jsx)(cp,{text:B(`taskops.moveHint`)})})]}),g.search.active&&(0,H.jsx)(IM,{query:g.search.query,count:`${D(E).length}/${ne}`,onChange:e=>g.setSearch(t=>({...t,query:e}))}),(0,H.jsx)(Ij,{model:e}),(0,H.jsxs)(`div`,{"data-rail-body":!0,className:Im(P!==null),...M.body,onPointerDownCapture:F.onPress,children:[r&&u.length===0&&i.length===0&&t&&(0,H.jsx)(gF,{model:e}),r&&u.length===0&&i.length===0&&!t&&(0,H.jsx)(`p`,{className:`m-0 px-2 py-3 font-mono text-meta text-subtle`,children:B(`rail.empty`)}),L&&(0,H.jsx)(VF,{title:L.title}),E.map((t,n)=>t.kind===`round`?(0,H.jsx)(FM,{row:t,guides:t.depth>1?Yj(E,n):void 0,repo:v&&t.depth===1?Ov(t.tasks[0]):void 0,cursor:t.id===F.cursor,place:N(t),onClick:()=>F.setCursor(t.id)},t.id):t.kind===`pane`?(0,H.jsx)(lM,{model:e,row:t,guides:Yj(E,n),cursor:t.id===F.cursor,place:N(t),onClick:()=>{F.setCursor(t.id),cM(e,t),pe()},onMenu:n=>{F.setCursor(t.id),_F(n,_A(e,t.task.id,t.tab,t.leaf))}},t.id):(0,H.jsx)(yF,{row:t,guides:t.kind===`task`&&t.depth>1?Yj(E,n):void 0,cloud:Jm(t,a,O),repo:v&&t.kind===`task`&&t.depth===1?Ov(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===F.cursor&&P===null,stale:t.machine!==void 0&&k.has(t.machine),collapsed:(t.kind===`project`||t.kind===`state`)&&g.collapsed.has(t.id),drag:M.props(t),dragging:P===t.id,place:N(t),onNewTask:t.kind===`project`?t.noProject?Sv:()=>xv(t.repo,t.machine):void 0,moving:_&&t.machine===void 0&&(t.kind===`project`?!t.noProject&&j(t.repo).mainTaskId===F.cursor:t.id===F.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?kh([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:()=>{F.setCursor(t.id),(t.kind===`project`||t.kind===`state`)&&g.toggleProject(t.id),t.kind===`task`&&bM(e,t.task.id)},onMenu:n=>{if(t.kind!==`project`||t.machine===void 0){if(t.kind===`project`&&t.noProject){_F(n,kA(e));return}if(t.kind===`project`){let r=j(t.repo);r.mainTaskId&&E.some(e=>e.id===r.mainTaskId)&&F.setCursor(r.mainTaskId),_F(n,OA(e,t.repo,r));return}t.kind===`task`&&(F.setCursor(t.id),_F(n,b(SF(xF(MA(e,t.task,null),t.fold,()=>g.toggleTaskFold(t.id,t.fold?.collapsed===!0)),bA(e,t.task.id)),B(`menu.more`))))}}},t.id))]}),(0,H.jsx)(nM,{model:e,narrow:t,onSettings:ee}),(0,H.jsx)(HF,{pane:`sidebar`}),!t&&!ie&&(0,H.jsx)(IF,{rail:re})]})}function yF(e){let{row:t}=e,n=WP(t.kind===`task`?t.task.label:``,e.cursor&&t.kind===`task`),r=e.cursor?Lm:``;if(t.kind===`project`||t.kind===`state`)return(0,H.jsxs)(`h2`,{className:Rm({moving:e.moving,dragging:e.dragging,grab:e.drag!==void 0}),onContextMenu:e.onMenu,...e.place,...e.drag,children:[(0,H.jsxs)(`button`,{type:`button`,className:Bm,title:t.kind===`project`&&!t.noProject?t.repo:void 0,"aria-expanded":!e.collapsed,onClick:e.onClick,children:[(0,H.jsx)(`span`,{className:`truncate`,children:t.label}),t.kind===`state`&&(0,H.jsx)(`span`,{className:`font-normal text-subtle`,children:t.count}),(0,H.jsx)(ps,{right:e.collapsed,className:Vm(!!e.collapsed)})]}),e.onNewTask&&t.kind===`project`&&(0,H.jsx)(XP,{sessionsTitle:B(`menu.viewSessions`),onSessions:()=>_e(t.noProject?``:t.repo),newTaskTitle:B(`rail.newTask`),onNewTask:e.onNewTask})]});let i=t.task,a=i.rowStatus?.kind===`running`,o=gy(i),s=BS(),c=s===`engine`,l=t.fold?.collapsed?e.rollup:i.rowStatus;return(0,H.jsxs)(`button`,{type:`button`,ref:n.ref,className:`${hi({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,H.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,H.jsx)(`span`,{className:Dm(e)},t))}),s!==`dots`&&(0,H.jsx)(WS,{icon:e.engineIcon,name:i.engine?.name,status:c?Th(l):void 0}),(0,H.jsx)(`span`,{className:`${_i} ${e.stale?`text-subtle`:``} ${a?vi:``}`,children:t.attempt??i.label}),(0,H.jsxs)(`span`,{className:`${xi} ml-auto items-center`,children:[(0,H.jsx)(KP,{tokens:i.rowTokens}),e.repo&&(0,H.jsx)(`span`,{className:`max-w-24 truncate text-subtle`,children:e.repo}),t.level!==void 0&&(0,H.jsx)(`span`,{className:`text-subtle`,children:t.level}),(i.extraRepoCount??0)>0&&(0,H.jsxs)(`span`,{className:`text-subtle`,title:B(`rail.extraRepos`,{count:i.extraRepoCount??0}),children:[`+`,i.extraRepoCount]}),o&&(0,H.jsxs)(`span`,{className:`text-subtle tabular-nums`,title:B(`rail.todos`,o),children:[o.done,`/`,o.total]}),t.fold?.collapsed&&(0,H.jsx)(bF,{count:t.fold.count,onUnfold:e.onToggleFold}),i.kept&&(0,H.jsx)(`span`,{className:`text-accent`,title:B(`compare.kept`),children:`✓`}),i.pinned&&(0,H.jsx)(`span`,{className:`text-subtle`,children:`▴`}),i.startsAt&&(0,H.jsx)(qP,{at:i.startsAt}),(0,H.jsx)(Uj,{tasks:e.prTasks??[i],onOpen:n.hide}),!c&&(0,H.jsx)(Vh,{status:l}),e.cloud&&(0,H.jsx)(Ym,{label:e.cloud})]})]})}function bF(e){let t=q(`tasks`,`menu.expandChildren`);return(0,H.jsxs)(`span`,{role:`button`,tabIndex:-1,"aria-label":t,"aria-expanded":!1,className:`chip text-muted ${Om}`,title:t,onClick:t=>{t.stopPropagation(),e.onUnfold()},children:[e.count,(0,H.jsx)(ps,{right:!0})]})}function xF(e,t,n){if(!t)return e;let r={label:q(`tasks`,t.collapsed?`menu.expandChildren`:`menu.collapseChildren`),section:`open`,rare:!0,run:n},i=e.map(e=>e.section).lastIndexOf(`open`);return[...e.slice(0,i+1),r,...e.slice(i+1)]}function SF(e,t){let n=e.map(e=>e.section).lastIndexOf(`open`);return[...e.slice(0,n+1),...t.map(e=>({...e,rare:!0})),...e.slice(n+1)]}function CF({children:e}){return(0,H.jsx)(`svg`,{className:`size-3.5 ${Yn}`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:e})}var wF={chat:(0,H.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,H.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,H.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,H.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,H.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,H.jsx)(`path`,{d:`M2 10a6 6 0 1 1 12 0M8 10l2.5-3.5M4 13h8`})};function TF(e){let t=ys(e);return t?bs(t):B(`panel.browser`)}var EF=7.3,DF=22,OF=160,kF=2,AF=24;function jF(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(OF,DF+e*EF)+kF}return n<=t}function MF(e,t,n){let r=[{label:B(`panel.close`),section:`close`,run:()=>Uc(e,n.id)}];return t.tabs.length>1&&r.push({label:B(`panel.closeOthers`),section:`close`,run:()=>Hc(e,e=>Ms(e,n.id))}),r}function NF({taskId:e,column:t}){V();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&&!jF(t.tabs.map(TF),i-AF);return(0,h.useEffect)(()=>{r.current?.querySelector(`.is-active`)?.scrollIntoView({block:`nearest`,inline:`nearest`})},[t.active,t.tabs.length,o]),(0,H.jsxs)(`div`,{className:ir,ref:n,children:[(0,H.jsx)(`div`,{className:ar,role:`tablist`,"aria-label":B(`panel.tabs`),ref:r,children:t.tabs.map(n=>{let r=n.id===t.active;return(0,H.jsxs)(`div`,{role:`presentation`,className:or({active:r,compact:o}),onMouseDown:e=>{e.button===1&&e.preventDefault()},onAuxClick:t=>{t.button===1&&(t.preventDefault(),Uc(e,n.id))},onContextMenu:r=>_F(r,MF(e,t,n)),children:[(0,H.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":r,className:sr(r),title:ys(n)||TF(n),onClick:()=>Hc(e,e=>Ss(e,n.id)),children:(0,H.jsx)(`span`,{className:cr,children:TF(n)})}),(0,H.jsx)(`button`,{type:`button`,className:lr(r),"aria-label":B(`panel.close`),tabIndex:-1,onClick:()=>Uc(e,n.id),children:`×`})]},n.id)})}),(0,H.jsx)(`button`,{type:`button`,className:Xn({tool:!0}),title:B(`panel.new`),"aria-label":B(`panel.new`),onClick:()=>Hc(e,Ts),children:(0,H.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:`M8 3.5v9M3.5 8h9`})})})]})}function PF({edge:e,className:t,...n}){return(0,H.jsx)(`div`,{"data-grip":``,className:It(`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 FF=400;function IF({rail:e}){V();let t=(0,h.useRef)(null),n=(0,h.useRef)(0),r=(0,h.useRef)(null);return(0,H.jsx)(PF,{edge:`right`,title:B(`layout.railResize`),onPointerDown:n=>{t.current={x:n.clientX,width:e.current?.getBoundingClientRect().width??0,moved:!1},n.currentTarget.setPointerCapture(n.pointerId),ue(!0)},onPointerMove:e=>{let n=t.current;!n||e.clientX===n.x||(n.moved=!0,EM.set(MM(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<FF?(n.current=0,EM.set(null)):(n.current=i,r.current=window.setTimeout(()=>DM.set(!0),FF))},onLostPointerCapture:()=>ue(!1)})}function LF({side:e}){return(0,H.jsxs)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,H.jsx)(`rect`,{x:`1.5`,y:`2.5`,width:`13`,height:`11`,rx:`2.5`}),(0,H.jsx)(`path`,{d:e===`left`?`M6 2.5v11`:`M10 2.5v11`})]})}function RF({model:e}){V();let t=y(eE),n=y(DM),r=y(e.tasks),i=t=>nE(e,t),a=B(n?`layout.railUnfold`:`layout.railFold`),o=n&&(r?.tasks??[]).some(Dh);return(0,H.jsxs)(`div`,{className:Zn,onMouseEnter:()=>n&&OM.get()&&jM(!0),onMouseLeave:()=>n&&OM.get()&&jM(!1),children:[(0,H.jsxs)(`button`,{type:`button`,className:Xn(),title:a,"aria-label":a,onClick:()=>DM.set(!n),children:[(0,H.jsx)(LF,{side:`left`}),o&&(0,H.jsx)(`span`,{className:`absolute top-0.75 right-0.75 size-1.5 rounded-full bg-accent`})]}),(0,H.jsx)(`button`,{type:`button`,className:Xn(),title:B(`layout.navBack`),"aria-label":B(`layout.navBack`),disabled:$T(t,-1,i)<0,onClick:()=>aE(e,-1),children:(0,H.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:`M10 3.5 5.5 8l4.5 4.5`})})}),(0,H.jsx)(`button`,{type:`button`,className:Xn(),title:B(`layout.navForward`),"aria-label":B(`layout.navForward`),disabled:$T(t,1,i)<0,onClick:()=>aE(e,1),children:(0,H.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:`M6 3.5 10.5 8 6 12.5`})})})]})}var zF=(0,H.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 BF({taskId:e,title:t}){V();let n=y(tc);return(0,H.jsxs)(`div`,{className:Kt,children:[(0,H.jsxs)(`button`,{type:`button`,className:`mono ${qt}`,"aria-label":Tl(`narrowBack`),onClick:me,children:[(0,H.jsx)(`span`,{className:`flex-none text-accent`,children:t?`‹`:`‹ ${Tl(`narrowBack`)}`}),t&&(0,H.jsx)(`span`,{className:`truncate font-sans text-body font-normal text-ink`,children:t})]}),e&&(0,H.jsx)(`span`,{className:`mono ml-auto flex flex-none gap-0.5`,role:`tablist`,children:[`terminal`,...ec].map(t=>{let r=B(t===`terminal`?`layout.narrowTerminal`:`panel.${t}`);return(0,H.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":n===t,"aria-label":r,title:r,className:Jt,onClick:()=>t===`terminal`?tc.set(t):Fc(e,t),children:(0,H.jsx)(CF,{children:t===`terminal`?zF:wF[t]})},t)})})]})}function VF({title:e}){return V(),(0,H.jsxs)(`button`,{type:`button`,className:hi({}),onClick:pe,children:[(0,H.jsx)(`span`,{className:`${yi} font-bold text-accent`,children:`↩`}),(0,H.jsx)(`span`,{className:gi,children:El(`recentJump`,{title:e})})]})}function HF({pane:e}){V();let{prefs:t}=wp(),n=y(JT)[e];if(!t.keyHints)return null;let r=KT(e,n?`always`:`firstUse`);return r.length===0?null:(0,H.jsx)(`p`,{className:`mono text-muted ${Yt}`,children:(0,H.jsx)(cp,{text:r.map(e=>`${la(e.cap)} ${bl(`pane.${e.msg}`)}`).join(` · `)})})}function UF(e,t,n){let r=n.width/t.width,i=n.height/t.height,a=Math.min(n.width,Math.max(0,Math.round(e.left*r))),o=Math.min(n.height,Math.max(0,Math.round(e.top*i)));return{x:a,y:o,width:Math.min(n.width-a,Math.round(e.width*r)),height:Math.min(n.height-o,Math.round(e.height*i))}}function WF(e,t,n){let r={left:0,top:0,width:n.innerWidth,height:n.innerHeight},i={left:(n.outerWidth-n.innerWidth)/2,top:n.outerHeight-n.innerHeight},a={...i,width:n.outerWidth,height:n.outerHeight},o={left:n.screenX+i.left,top:n.screenY+i.top,...n.screen},s={browser:r,window:a,monitor:o}[e??``];if(s)return s;let c=e=>Math.abs(e.width/e.height-t.width/t.height);return[r,a,o].reduce((e,t)=>c(t)<c(e)?t:e)}function GF(){return typeof navigator.mediaDevices?.getDisplayMedia==`function`}async function KF(e,t){let n=await navigator.mediaDevices.getDisplayMedia({video:{displaySurface:`browser`},preferCurrentTab:!0,selfBrowserSurface:`include`});try{let r=document.createElement(`video`);r.muted=!0,r.srcObject=n,await r.play();let i={width:r.videoWidth,height:r.videoHeight},a=e.getBoundingClientRect(),o=WF(n.getVideoTracks()[0]?.getSettings().displaySurface,i,window),s=UF({left:a.left+o.left,top:a.top+o.top,width:a.width,height:a.height},o,i),c=document.createElement(`canvas`);c.width=s.width,c.height=s.height,c.getContext(`2d`)?.drawImage(r,s.x,s.y,s.width,s.height,0,0,s.width,s.height);let l=await new Promise(e=>c.toBlob(e,`image/png`));if(!l)throw Error(`empty capture`);return new File([l],t,{type:`image/png`})}finally{for(let e of n.getTracks())e.stop()}}var qF=new Set,JF=2e3;function YF(e){qF.add(e)}function XF(e,t=JF){setTimeout(()=>qF.delete(e),t)}var ZF=e=>qF.has(e),QF=new Map,$F=new Set,eI=(e,t)=>`${e}/${t}`,tI=e=>QF.get(e)??``;function nI(e,t){t===``?QF.delete(e):QF.set(e,t);for(let e of $F)e()}function rI(e){return $F.add(e),()=>$F.delete(e)}function iI(e,t){let n=tI(e).trimEnd();nI(e,n===``?t:`${n}\n\n${t}`)}function aI(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 oI(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&&L(B(`voice.learned`,{pairs:r.map(e=>B(`voice.learnedPair`,{spoken:e.spoken,term:e.term})).join(`, `)}),`info`,{label:B(`voice.undo`),run:()=>void e.request(`voice.unlearn`,{learned:r}).then(()=>L(B(`voice.unlearned`)),()=>L(B(`voice.unlearnFailed`),`error`))})}function sI({model:e,taskId:t,tabId:n}){let r=y(e.tasks)?.tasks.find(e=>e.id===t)!==void 0,i=eI(t,n),a=(0,h.useSyncExternalStore)(rI,()=>tI(i)),[o,s]=(0,h.useState)(!1),{attachments:c,attach:l,remove:u,ready:d,clear:f}=ou(e,e=>L(e,`error`)),p=(0,h.useRef)(null),m=vv(e.client),[g,_]=(0,h.useState)(!1),v=b_({value:a,onChange:e=>nI(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)}`;nI(i,s);let c=n+o.length+e.length;b.current=aI(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)||nI(i,t)},C=e=>void S(e),w=async(r=a)=>{s(!0);try{let a=tu(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?(nI(i,``),f(),_(!1),b.current&&oI(e.client,b.current,r),b.current=null,!0):(L(B(`layout.composerNotSent`,{reason:o.reason??``}),`error`),!1)}catch(e){let t=e instanceof Uo?e.code:void 0;return L(t===`UNKNOWN_OP`?B(`layout.composerOldBridge`):t===`AWAITING_PERMISSION`?B(`layout.composerAtMenu`):e instanceof Error?e.message:String(e),`error`),!1}finally{s(!1)}};if(!r)return null;let T=l,E={client:e.client,context:()=>({draft:a,taskId:t,tabId:n}),onText:e=>void x(e),disabled:o},D=m===!0&&!g&&a===``,O=()=>{(0,Rj.flushSync)(()=>_(!0)),p.current?.focus()};return(0,H.jsx)(X_,{value:a,placeholder:B(`layout.composerPlaceholder`),sendLabel:B(`layout.composerSend`),busy:o,ready:a.trim()!==``||c.length>0,attached:(0,H.jsx)(su,{attachments:c,onRemove:u}),attach:(0,H.jsxs)($l,{className:M_(),title:B(`layout.composerAttach`),disabled:o,onFiles:T,children:[(0,H.jsx)(`span`,{className:`sr-only`,children:B(`layout.composerAttach`)}),(0,H.jsx)(R_,{})]}),dictate:(0,H.jsx)(bv,{...E,look:N_,face:e=>(0,H.jsx)(J_,{state:e})}),voice:D?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(bv,{...E,onSend:C,look:P_,onTap:O,idle:B(`voice.holdOrType`),face:e=>(0,H.jsx)(q_,{state:e,idle:B(`voice.holdOrType`),working:B(`voice.working`),slide:B(`voice.slideToSend`),release:B(`voice.tipSend`)})}),(0,H.jsx)(z_,{label:B(`layout.composerSend`),disabled:o||c.length===0})]}):void 0,composerKey:i,fieldRef:p,suggest:v.list,...v.field,onPaste:Ql(T).onPaste,onBlur:()=>a===``&&_(!1),onSend:()=>void w()})}var cI={up:`layout.termKeyUp`,down:`layout.termKeyDown`,left:`layout.termKeyLeft`,right:`layout.termKeyRight`,interrupt:`layout.termKeyInterrupt`,enter:`layout.termKeyEnter`};function lI({handle:e,atMenu:t}){V();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,H.jsx)(`button`,{type:`button`,className:rn(!1),"aria-label":cI[e.id]?B(cI[e.id]):void 0,onClick:()=>{r(!1),i.input(e.bytes(i.modes.applicationCursorKeysMode),!0)},children:e.cap},e.id);return(0,H.jsxs)(`div`,{className:`mono ${nn}`,role:`toolbar`,"aria-label":B(`layout.termKeys`),onPointerDown:e=>e.preventDefault(),children:[t&&$f.map(a),(0,H.jsx)(`button`,{type:`button`,className:rn(n),"aria-pressed":n,onClick:()=>r(!n),children:`ctrl`}),Zf.filter(e=>!(t&&$f.includes(e))).map(a)]})}var uI={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`},dI=`Rove Nerd Symbols`,fI=[`"JetBrains Mono"`,`"${dI}"`,`"SF Mono"`,`ui-monospace`,`Menlo`,`monospace`].join(`, `);function pI(e){switch(e.kind){case`restored`:return B(`workspace.restored`);case`notLive`:return B(`workspace.tabNotLive`);case`exited`:return B(`workspace.exited`,{code:e.code??`?`});case`failed`:return B(`workspace.attachFailed`,{message:e.message});case`none`:return``}}function mI(e){V();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?B(`workspace.reopenFailed`,{message:o.error}):s?B(`workspace.engineExited`,{code:s.code??`?`}):c?d?B(`workspace.usageLimitUntil`,{time:new Date(d).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}):B(`workspace.usageLimit`):pI(t);return(0,H.jsxs)(`div`,{className:In(t.kind===`failed`||!!o.error),children:[(0,H.jsx)(`span`,{children:m}),e.onReopen&&(f||s)&&(0,H.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,disabled:o.busy,onClick:()=>e.onReopen?.(s!==null),children:o.busy?B(`workspace.reopening`):B(s?`workspace.retry`:`workspace.reopen`)}),t.kind===`failed`&&e.onRetryAttach&&(0,H.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:e.onRetryAttach,children:B(`workspace.retry`)}),c&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(U,{variant:`link`,hit:`tight`,onClick:()=>C.set((0,H.jsx)(ud,{model:r,taskId:i,context:`continue`,sourceTabId:a})),children:B(`menu.continueEngine`)}),(0,H.jsx)(U,{variant:`link`,hit:`tight`,disabled:l,onClick:()=>{u(!0),r.client.request(`task.resumeQuota`,{taskId:i}).catch(e=>L(e instanceof Error?e.message:String(e),`error`)).finally(()=>u(!1))},children:B(l?`workspace.resumingQuota`:`workspace.resumeQuota`)}),(0,H.jsx)(U,{variant:`link`,hit:`tight`,onClick:e.onDismissLimit,children:B(`workspace.dismiss`)})]}),p&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>C.set((0,H.jsx)(xT,{model:r,section:`engines`})),children:B(`workspace.engineSettings`)}),(0,H.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>C.set((0,H.jsx)(ud,{model:r,taskId:i})),children:B(`menu.newChatPick`)}),(0,H.jsx)(U,{variant:`link`,hit:`tight`,onClick:()=>C.set((0,H.jsx)(ud,{model:r,taskId:i,context:`continue`,sourceTabId:a})),children:B(`menu.continueEngine`)})]})]})}function hI(e){let t=e.split(`
62
+ `)}}var $P=`min-h-0 w-full overflow-y-auto`,eF=`mx-auto mt-[min(16vh,8rem)] flex w-full max-w-130 flex-col gap-4 px-5 pb-7`,tF=`relative grid w-full select-none overflow-hidden font-mono text-(length:--fs-body) text-subtle [contain:layout_paint]`,nF=`col-start-1 row-start-1 m-0 whitespace-pre font-[inherit] leading-[inherit]`,rF=`invisible absolute top-0 left-0 whitespace-pre`,iF=1.3,aF=`0000000000`,oF=1e3/12;function sF(){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=QP(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)/oF);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,H.jsxs)(`div`,{ref:e,"aria-hidden":`true`,"data-field":`first-run-art`,className:tF,style:{height:`${11*iF}em`,lineHeight:iF},children:[(0,H.jsx)(`span`,{ref:t,className:rF,children:aF}),(0,H.jsx)(`pre`,{ref:n,className:nF}),(0,H.jsx)(`pre`,{ref:r,className:`${nF} text-accent`})]})}function cF(e){let t=q(`doctor`,`fix.humanOnlyWhy`),n=[];if(e.git||n.push({id:`git`,label:q(`doctor`,`fix.git`),action:q(`doctor`,`fix.gitAction`),why:t}),e.engines.length===0){let r=e.signedOut.length>0;n.push({id:`engine`,label:q(`doctor`,r?`fix.noEngineLogin`:`fix.noEngine`),action:q(`doctor`,r?`fix.noEngineLoginAction`:`fix.noEngineAction`,{list:e.signedOut.map(e=>e.id).join(`, `)}),why:t})}return n}function lF({model:e}){V(),y(da);let[t,n]=(0,h.useState)(()=>X(e,`welcome.env`)??null);(0,h.useEffect)(()=>{let t=!0;return Ku(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)?cF(t):[];return(0,H.jsx)(`div`,{className:$P,"data-field":`welcome`,children:(0,H.jsxs)(`div`,{className:eF,children:[(0,H.jsx)(sF,{}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,H.jsx)(`h1`,{className:`m-0 font-sans text-title font-semibold text-ink`,children:B(`firstRun.title`)}),(0,H.jsx)(`p`,{className:`m-0 font-sans text-body text-muted`,children:B(`firstRun.body`)})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(`button`,{type:`button`,className:xr(),"data-field":`start-first-task`,onClick:()=>bv(t?.start?.repo),children:B(`firstRun.start`)}),(0,H.jsx)(`span`,{className:`keys-only mono text-meta text-subtle`,children:ba(`task.new.global`)})]}),t!==null&&r!==null&&(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5 font-sans text-meta`,children:[(0,H.jsx)(`p`,{className:`m-0 ${r.warn?`text-warning`:`text-subtle`}`,children:q(`workspace`,`welcome.${r.key}`,{list:r.list})}),!t.git&&(0,H.jsx)(`p`,{className:`m-0 text-warning`,children:q(`workspace`,`welcome.gitMissing`)}),i.map(e=>(0,H.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,H.jsx)(`p`,{className:`m-0 text-warning`,children:e.label}),(0,H.jsx)(`p`,{className:`mono m-0 text-accent`,children:e.action}),(0,H.jsx)(`p`,{className:`m-0 text-muted`,children:e.why})]},e.id)),i.length>0&&(0,H.jsx)(`p`,{className:`m-0 text-muted`,children:q(`common`,`failureHint`,{command:`rove doctor`})})]})]})})}function uF(e,t){e.preventDefault(),S.set({x:e.clientX,y:e.clientY,items:t,target:e.currentTarget,fromKeyboard:e.button!==2})}function dF({model:e,narrow:t}){let n=V(),r=y(e.tasks),i=y(e.remote),a=Xm(e),o=y(e.tabs),s=IS(e);HP(e,r?.tasks.length);let c=y(e.selection),l=r?.tasks??[],u=r?.attention.filter(e=>e.unread).length??0,d=c.taskId,f=new Map([...l,...i].map(e=>[e.id,e])),p=uM(),m=y(Lp),g=y(Op)===`state`,_=e=>(g?kv:Vd)({tasks:l,remote:i,machines:a,sort:p.sort,query:e,fold:{...p.hand,selectedId:d??void 0}}),v=_(p.search.active?p.search.query:``),{groups:x}=v,S=p.search.active?v.rows:Ud(DM(Av(v.rows),o),p.collapsed),w=e=>e.filter(e=>e.kind!==`project`&&e.kind!==`state`&&e.kind!==`round`),T=(n===`zh`?Gi:Wi).machine,E=new Set(a.filter(e=>e.state!==`online`).map(e=>e.alias)),D=x.filter(e=>!e.noProject&&e.machine===void 0).map(e=>e.repo),O=e=>{let t=D.indexOf(e);return{label:dd(e),local:t>=0,top:t>0?D[0]??null:null,above:t>0?D[t-1]??null:null,below:t>=0?D[t+1]??null:null}},k=$j(e,l,!p.search.active&&!g,p.sort==="default"),{place:A,dragging:j}=k.places(S),M=()=>C.set((0,H.jsx)(yT,{model:e})),N=mM(e,S,p,{selectedId:d,onNewTask:bv,onSettings:M}),P=w(_(``).rows).length,ee=(0,h.useRef)(null),F=y(bM)&&!t,I=y(xM)&&F,te=t?l.find(e=>e.id===c.taskId&&!e.deleting)??null:null;return(0,H.jsxs)(`nav`,{className:`${jm} ${F?`is-folded`:``}`,ref:ee,inert:F&&!I,"aria-hidden":F&&!I,onMouseEnter:F?()=>wM(!0):void 0,onMouseLeave:F?()=>wM(!1):void 0,tabIndex:0,onKeyDown:e=>{qT(`sidebar`),N.onKeyDown(e)},children:[(0,H.jsxs)(`header`,{className:Mm,children:[(0,H.jsxs)(`span`,{className:`${Wn} mr-auto`,children:[(0,H.jsx)(`span`,{className:Gn,children:`[`}),` rove `,(0,H.jsx)(`span`,{className:Gn,children:`]`})]}),(0,H.jsxs)(`span`,{className:`relative`,children:[(0,H.jsx)(`button`,{type:`button`,className:`m-0 text-meta font-medium normal-nums inbox-chip relative ${fi} ${Gt} ${u>0?`text-accent`:`text-muted`}`,onClick:()=>C.set((0,H.jsx)(pp,{model:e})),children:B(`rail.inbox`,{count:u})}),(0,H.jsx)(BT,{model:e,bindingId:`inbox.show`,head:!0})]}),(0,H.jsx)(xS,{})]}),m&&(0,H.jsxs)(`div`,{className:`flex gap-1 px-3.5 pb-2 text-meta mono`,children:[(0,H.jsx)(`span`,{className:`text-accent`,children:q(`tasks`,`moveChip`).trim()}),(0,H.jsx)(`span`,{className:`keys-only ml-1.5 text-muted`,children:(0,H.jsx)(cp,{text:B(`taskops.moveHint`)})})]}),p.search.active&&(0,H.jsx)(kM,{query:p.search.query,count:`${w(S).length}/${P}`,onChange:e=>p.setSearch(t=>({...t,query:e}))}),(0,H.jsx)(Pj,{model:e}),(0,H.jsxs)(`div`,{"data-rail-body":!0,className:Fm(j!==null),...k.body,onPointerDownCapture:N.onPress,children:[r&&l.length===0&&i.length===0&&t&&(0,H.jsx)(lF,{model:e}),r&&l.length===0&&i.length===0&&!t&&(0,H.jsx)(`p`,{className:`m-0 px-2 py-3 font-mono text-meta text-subtle`,children:B(`rail.empty`)}),te&&(0,H.jsx)(PF,{title:te.title}),S.map((t,n)=>t.kind===`round`?(0,H.jsx)(OM,{row:t,guides:t.depth>1?qj(S,n):void 0,repo:g&&t.depth===1?Dv(t.tasks[0]):void 0,cursor:t.id===N.cursor,place:A(t),onClick:()=>N.setCursor(t.id)},t.id):t.kind===`pane`?(0,H.jsx)(nM,{model:e,row:t,guides:qj(S,n),cursor:t.id===N.cursor,place:A(t),onClick:()=>{N.setCursor(t.id),tM(e,t),pe()},onMenu:n=>{N.setCursor(t.id),uF(n,hA(e,t.task.id,t.tab,t.leaf))}},t.id):(0,H.jsx)(fF,{row:t,guides:t.kind===`task`&&t.depth>1?qj(S,n):void 0,cloud:qm(t,a,T),repo:g&&t.kind===`task`&&t.depth===1?Dv(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===d,cursor:t.id===N.cursor&&j===null,stale:t.machine!==void 0&&E.has(t.machine),collapsed:(t.kind===`project`||t.kind===`state`)&&p.collapsed.has(t.id),drag:k.props(t),dragging:j===t.id,place:A(t),onNewTask:t.kind===`project`?t.noProject?xv:()=>bv(t.repo,t.machine):void 0,moving:m&&t.machine===void 0&&t.kind!==`project`&&t.id===N.cursor,prTasks:t.kind===`task`?[t.task,...(t.fold?.descendantIds??[]).flatMap(e=>f.get(e)??[])]:void 0,rollup:t.kind===`task`&&t.fold?.collapsed?Oh([t.task,...t.fold.descendantIds.flatMap(e=>f.get(e)??[])]):void 0,onToggleFold:()=>{t.kind===`task`&&p.toggleTaskFold(t.id,t.fold?.collapsed===!0)},onClick:()=>{N.setCursor(t.id),(t.kind===`project`||t.kind===`state`)&&p.toggleProject(t.id),t.kind===`task`&&pM(e,t.task.id)},onMenu:n=>{if(t.kind!==`project`||t.machine===void 0){if(t.kind===`project`&&t.noProject){uF(n,DA(e));return}if(t.kind===`project`){uF(n,EA(e,t.repo,O(t.repo)));return}t.kind===`task`&&(N.setCursor(t.id),uF(n,b(hF(mF(AA(e,t.task,null),t.fold,()=>p.toggleTaskFold(t.id,t.fold?.collapsed===!0)),vA(e,t.task.id)),B(`menu.more`))))}}},t.id))]}),(0,H.jsx)(eM,{model:e,narrow:t,onSettings:M}),(0,H.jsx)(FF,{pane:`sidebar`}),!t&&!F&&(0,H.jsx)(kF,{rail:ee})]})}function fF(e){let{row:t}=e,n=LP(t.kind===`task`?t.task.label:``,e.cursor&&t.kind===`task`),r=e.cursor?Im:``;if(t.kind===`project`||t.kind===`state`)return(0,H.jsxs)(`h2`,{className:Lm({moving:e.moving,dragging:e.dragging,grab:e.drag!==void 0}),onContextMenu:e.onMenu,...e.place,...e.drag,children:[(0,H.jsxs)(`button`,{type:`button`,className:zm,title:t.kind===`project`&&!t.noProject?t.repo:void 0,"aria-expanded":!e.collapsed,onClick:e.onClick,children:[(0,H.jsx)(`span`,{className:`truncate`,children:t.label}),t.kind===`state`&&(0,H.jsx)(`span`,{className:`font-normal text-subtle`,children:t.count}),(0,H.jsx)(ps,{right:e.collapsed,className:Bm(!!e.collapsed)})]}),e.onNewTask&&t.kind===`project`&&(0,H.jsx)(UP,{sessionsTitle:B(`menu.viewSessions`),onSessions:()=>_e(t.noProject?``:t.repo),newTaskTitle:B(`rail.newTask`),onNewTask:e.onNewTask})]});let i=t.task,a=i.rowStatus?.kind===`running`,o=hy(i),s=RS(),c=s===`engine`,l=t.fold?.collapsed?e.rollup:i.rowStatus;return(0,H.jsxs)(`button`,{type:`button`,ref:n.ref,className:`${hi({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,H.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,H.jsx)(`span`,{className:Em(e)},t))}),s!==`dots`&&(0,H.jsx)(HS,{icon:e.engineIcon,name:i.engine?.name,status:c?wh(l):void 0}),(0,H.jsx)(`span`,{className:`${_i} ${e.stale?`text-subtle`:``} ${a?vi:``}`,children:t.attempt??i.label}),(0,H.jsxs)(`span`,{className:`${xi} ml-auto items-center`,children:[(0,H.jsx)(zP,{tokens:i.rowTokens}),e.repo&&(0,H.jsx)(`span`,{className:`max-w-24 truncate text-subtle`,children:e.repo}),t.level!==void 0&&(0,H.jsx)(`span`,{className:`text-subtle`,children:t.level}),(i.extraRepoCount??0)>0&&(0,H.jsxs)(`span`,{className:`text-subtle`,title:B(`rail.extraRepos`,{count:i.extraRepoCount??0}),children:[`+`,i.extraRepoCount]}),o&&(0,H.jsxs)(`span`,{className:`text-subtle tabular-nums`,title:B(`rail.todos`,o),children:[o.done,`/`,o.total]}),t.fold?.collapsed&&(0,H.jsx)(pF,{count:t.fold.count,onUnfold:e.onToggleFold}),i.kept&&(0,H.jsx)(`span`,{className:`text-accent`,title:B(`compare.kept`),children:`✓`}),i.pinned&&(0,H.jsx)(`span`,{className:`text-subtle`,children:`▴`}),i.startsAt&&(0,H.jsx)(BP,{at:i.startsAt}),(0,H.jsx)(Vj,{tasks:e.prTasks??[i],onOpen:n.hide}),!c&&(0,H.jsx)(Bh,{status:l}),e.cloud&&(0,H.jsx)(Jm,{label:e.cloud})]})]})}function pF(e){let t=q(`tasks`,`menu.expandChildren`);return(0,H.jsxs)(`span`,{role:`button`,tabIndex:-1,"aria-label":t,"aria-expanded":!1,className:`chip text-muted ${Dm}`,title:t,onClick:t=>{t.stopPropagation(),e.onUnfold()},children:[e.count,(0,H.jsx)(ps,{right:!0})]})}function mF(e,t,n){if(!t)return e;let r={label:q(`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 hF(e,t){let n=e.map(e=>e.section).lastIndexOf(`open`);return[...e.slice(0,n+1),...t.map(e=>({...e,rare:!0})),...e.slice(n+1)]}function gF({children:e}){return(0,H.jsx)(`svg`,{className:`size-3.5 ${Yn}`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:e})}var _F={chat:(0,H.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,H.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,H.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,H.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,H.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,H.jsx)(`path`,{d:`M2 10a6 6 0 1 1 12 0M8 10l2.5-3.5M4 13h8`})};function vF(e){let t=ys(e);return t?bs(t):B(`panel.browser`)}var yF=7.3,bF=22,xF=160,SF=2,CF=24;function wF(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(xF,bF+e*yF)+SF}return n<=t}function TF(e,t,n){let r=[{label:B(`panel.close`),section:`close`,run:()=>Uc(e,n.id)}];return t.tabs.length>1&&r.push({label:B(`panel.closeOthers`),section:`close`,run:()=>Hc(e,e=>Ms(e,n.id))}),r}function EF({taskId:e,column:t}){V();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&&!wF(t.tabs.map(vF),i-CF);return(0,h.useEffect)(()=>{r.current?.querySelector(`.is-active`)?.scrollIntoView({block:`nearest`,inline:`nearest`})},[t.active,t.tabs.length,o]),(0,H.jsxs)(`div`,{className:ir,ref:n,children:[(0,H.jsx)(`div`,{className:ar,role:`tablist`,"aria-label":B(`panel.tabs`),ref:r,children:t.tabs.map(n=>{let r=n.id===t.active;return(0,H.jsxs)(`div`,{role:`presentation`,className:or({active:r,compact:o}),onMouseDown:e=>{e.button===1&&e.preventDefault()},onAuxClick:t=>{t.button===1&&(t.preventDefault(),Uc(e,n.id))},onContextMenu:r=>uF(r,TF(e,t,n)),children:[(0,H.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":r,className:sr(r),title:ys(n)||vF(n),onClick:()=>Hc(e,e=>Ss(e,n.id)),children:(0,H.jsx)(`span`,{className:cr,children:vF(n)})}),(0,H.jsx)(`button`,{type:`button`,className:lr(r),"aria-label":B(`panel.close`),tabIndex:-1,onClick:()=>Uc(e,n.id),children:`×`})]},n.id)})}),(0,H.jsx)(`button`,{type:`button`,className:Xn({tool:!0}),title:B(`panel.new`),"aria-label":B(`panel.new`),onClick:()=>Hc(e,Ts),children:(0,H.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:`M8 3.5v9M3.5 8h9`})})})]})}function DF({edge:e,className:t,...n}){return(0,H.jsx)(`div`,{"data-grip":``,className:It(`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 OF=400;function kF({rail:e}){V();let t=(0,h.useRef)(null),n=(0,h.useRef)(0),r=(0,h.useRef)(null);return(0,H.jsx)(DF,{edge:`right`,title:B(`layout.railResize`),onPointerDown:n=>{t.current={x:n.clientX,width:e.current?.getBoundingClientRect().width??0,moved:!1},n.currentTarget.setPointerCapture(n.pointerId),ue(!0)},onPointerMove:e=>{let n=t.current;!n||e.clientX===n.x||(n.moved=!0,yM.set(TM(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<OF?(n.current=0,yM.set(null)):(n.current=i,r.current=window.setTimeout(()=>bM.set(!0),OF))},onLostPointerCapture:()=>ue(!1)})}function AF({side:e}){return(0,H.jsxs)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,H.jsx)(`rect`,{x:`1.5`,y:`2.5`,width:`13`,height:`11`,rx:`2.5`}),(0,H.jsx)(`path`,{d:e===`left`?`M6 2.5v11`:`M10 2.5v11`})]})}function jF({model:e}){V();let t=y(QT),n=y(bM),r=y(e.tasks),i=t=>eE(e,t),a=B(n?`layout.railUnfold`:`layout.railFold`),o=n&&(r?.tasks??[]).some(Eh);return(0,H.jsxs)(`div`,{className:Zn,onMouseEnter:()=>n&&xM.get()&&wM(!0),onMouseLeave:()=>n&&xM.get()&&wM(!1),children:[(0,H.jsxs)(`button`,{type:`button`,className:Xn(),title:a,"aria-label":a,onClick:()=>bM.set(!n),children:[(0,H.jsx)(AF,{side:`left`}),o&&(0,H.jsx)(`span`,{className:`absolute top-0.75 right-0.75 size-1.5 rounded-full bg-accent`})]}),(0,H.jsx)(`button`,{type:`button`,className:Xn(),title:B(`layout.navBack`),"aria-label":B(`layout.navBack`),disabled:ZT(t,-1,i)<0,onClick:()=>rE(e,-1),children:(0,H.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:`M10 3.5 5.5 8l4.5 4.5`})})}),(0,H.jsx)(`button`,{type:`button`,className:Xn(),title:B(`layout.navForward`),"aria-label":B(`layout.navForward`),disabled:ZT(t,1,i)<0,onClick:()=>rE(e,1),children:(0,H.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:`M6 3.5 10.5 8 6 12.5`})})})]})}var MF=(0,H.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 NF({taskId:e,title:t}){V();let n=y(tc);return(0,H.jsxs)(`div`,{className:Kt,children:[(0,H.jsxs)(`button`,{type:`button`,className:`mono ${qt}`,"aria-label":Tl(`narrowBack`),onClick:me,children:[(0,H.jsx)(`span`,{className:`flex-none text-accent`,children:t?`‹`:`‹ ${Tl(`narrowBack`)}`}),t&&(0,H.jsx)(`span`,{className:`truncate font-sans text-body font-normal text-ink`,children:t})]}),e&&(0,H.jsx)(`span`,{className:`mono ml-auto flex flex-none gap-0.5`,role:`tablist`,children:[`terminal`,...ec].map(t=>{let r=B(t===`terminal`?`layout.narrowTerminal`:`panel.${t}`);return(0,H.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":n===t,"aria-label":r,title:r,className:Jt,onClick:()=>t===`terminal`?tc.set(t):Fc(e,t),children:(0,H.jsx)(gF,{children:t===`terminal`?MF:_F[t]})},t)})})]})}function PF({title:e}){return V(),(0,H.jsxs)(`button`,{type:`button`,className:hi({}),onClick:pe,children:[(0,H.jsx)(`span`,{className:`${yi} font-bold text-accent`,children:`↩`}),(0,H.jsx)(`span`,{className:gi,children:El(`recentJump`,{title:e})})]})}function FF({pane:e}){V();let{prefs:t}=wp(),n=y(KT)[e];if(!t.keyHints)return null;let r=WT(e,n?`always`:`firstUse`);return r.length===0?null:(0,H.jsx)(`p`,{className:`mono text-muted ${Yt}`,children:(0,H.jsx)(cp,{text:r.map(e=>`${la(e.cap)} ${bl(`pane.${e.msg}`)}`).join(` · `)})})}function IF(e,t,n){let r=n.width/t.width,i=n.height/t.height,a=Math.min(n.width,Math.max(0,Math.round(e.left*r))),o=Math.min(n.height,Math.max(0,Math.round(e.top*i)));return{x:a,y:o,width:Math.min(n.width-a,Math.round(e.width*r)),height:Math.min(n.height-o,Math.round(e.height*i))}}function LF(e,t,n){let r={left:0,top:0,width:n.innerWidth,height:n.innerHeight},i={left:(n.outerWidth-n.innerWidth)/2,top:n.outerHeight-n.innerHeight},a={...i,width:n.outerWidth,height:n.outerHeight},o={left:n.screenX+i.left,top:n.screenY+i.top,...n.screen},s={browser:r,window:a,monitor:o}[e??``];if(s)return s;let c=e=>Math.abs(e.width/e.height-t.width/t.height);return[r,a,o].reduce((e,t)=>c(t)<c(e)?t:e)}function RF(){return typeof navigator.mediaDevices?.getDisplayMedia==`function`}async function zF(e,t){let n=await navigator.mediaDevices.getDisplayMedia({video:{displaySurface:`browser`},preferCurrentTab:!0,selfBrowserSurface:`include`});try{let r=document.createElement(`video`);r.muted=!0,r.srcObject=n,await r.play();let i={width:r.videoWidth,height:r.videoHeight},a=e.getBoundingClientRect(),o=LF(n.getVideoTracks()[0]?.getSettings().displaySurface,i,window),s=IF({left:a.left+o.left,top:a.top+o.top,width:a.width,height:a.height},o,i),c=document.createElement(`canvas`);c.width=s.width,c.height=s.height,c.getContext(`2d`)?.drawImage(r,s.x,s.y,s.width,s.height,0,0,s.width,s.height);let l=await new Promise(e=>c.toBlob(e,`image/png`));if(!l)throw Error(`empty capture`);return new File([l],t,{type:`image/png`})}finally{for(let e of n.getTracks())e.stop()}}var BF=new Set,VF=2e3;function HF(e){BF.add(e)}function UF(e,t=VF){setTimeout(()=>BF.delete(e),t)}var WF=e=>BF.has(e),GF=new Map,KF=new Set,qF=(e,t)=>`${e}/${t}`,JF=e=>GF.get(e)??``;function YF(e,t){t===``?GF.delete(e):GF.set(e,t);for(let e of KF)e()}function XF(e){return KF.add(e),()=>KF.delete(e)}function ZF(e,t){let n=JF(e).trimEnd();YF(e,n===``?t:`${n}\n\n${t}`)}function QF(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 $F(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&&L(B(`voice.learned`,{pairs:r.map(e=>B(`voice.learnedPair`,{spoken:e.spoken,term:e.term})).join(`, `)}),`info`,{label:B(`voice.undo`),run:()=>void e.request(`voice.unlearn`,{learned:r}).then(()=>L(B(`voice.unlearned`)),()=>L(B(`voice.unlearnFailed`),`error`))})}function eI({model:e,taskId:t,tabId:n}){let r=y(e.tasks)?.tasks.find(e=>e.id===t)!==void 0,i=qF(t,n),a=(0,h.useSyncExternalStore)(XF,()=>JF(i)),[o,s]=(0,h.useState)(!1),{attachments:c,attach:l,remove:u,ready:d,clear:f}=ou(e,e=>L(e,`error`)),p=(0,h.useRef)(null),m=_v(e.client),[g,_]=(0,h.useState)(!1),v=y_({value:a,onChange:e=>YF(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)}`;YF(i,s);let c=n+o.length+e.length;b.current=QF(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)||YF(i,t)},C=e=>void S(e),w=async(r=a)=>{s(!0);try{let a=tu(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?(YF(i,``),f(),_(!1),b.current&&$F(e.client,b.current,r),b.current=null,!0):(L(B(`layout.composerNotSent`,{reason:o.reason??``}),`error`),!1)}catch(e){let t=e instanceof Uo?e.code:void 0;return L(t===`UNKNOWN_OP`?B(`layout.composerOldBridge`):t===`AWAITING_PERMISSION`?B(`layout.composerAtMenu`):e instanceof Error?e.message:String(e),`error`),!1}finally{s(!1)}};if(!r)return null;let T=l,E={client:e.client,context:()=>({draft:a,taskId:t,tabId:n}),onText:e=>void x(e),disabled:o},D=m===!0&&!g&&a===``,O=()=>{(0,Ij.flushSync)(()=>_(!0)),p.current?.focus()};return(0,H.jsx)(Y_,{value:a,placeholder:B(`layout.composerPlaceholder`),sendLabel:B(`layout.composerSend`),busy:o,ready:a.trim()!==``||c.length>0,attached:(0,H.jsx)(su,{attachments:c,onRemove:u}),attach:(0,H.jsxs)($l,{className:j_(),title:B(`layout.composerAttach`),disabled:o,onFiles:T,children:[(0,H.jsx)(`span`,{className:`sr-only`,children:B(`layout.composerAttach`)}),(0,H.jsx)(L_,{})]}),dictate:(0,H.jsx)(yv,{...E,look:M_,face:e=>(0,H.jsx)(q_,{state:e})}),voice:D?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(yv,{...E,onSend:C,look:N_,onTap:O,idle:B(`voice.holdOrType`),face:e=>(0,H.jsx)(K_,{state:e,idle:B(`voice.holdOrType`),working:B(`voice.working`),slide:B(`voice.slideToSend`),release:B(`voice.tipSend`)})}),(0,H.jsx)(R_,{label:B(`layout.composerSend`),disabled:o||c.length===0})]}):void 0,composerKey:i,fieldRef:p,suggest:v.list,...v.field,onPaste:Ql(T).onPaste,onBlur:()=>a===``&&_(!1),onSend:()=>void w()})}var tI={up:`layout.termKeyUp`,down:`layout.termKeyDown`,left:`layout.termKeyLeft`,right:`layout.termKeyRight`,interrupt:`layout.termKeyInterrupt`,enter:`layout.termKeyEnter`};function nI({handle:e,atMenu:t}){V();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,H.jsx)(`button`,{type:`button`,className:rn(!1),"aria-label":tI[e.id]?B(tI[e.id]):void 0,onClick:()=>{r(!1),i.input(e.bytes(i.modes.applicationCursorKeysMode),!0)},children:e.cap},e.id);return(0,H.jsxs)(`div`,{className:`mono ${nn}`,role:`toolbar`,"aria-label":B(`layout.termKeys`),onPointerDown:e=>e.preventDefault(),children:[t&&$f.map(a),(0,H.jsx)(`button`,{type:`button`,className:rn(n),"aria-pressed":n,onClick:()=>r(!n),children:`ctrl`}),Zf.filter(e=>!(t&&$f.includes(e))).map(a)]})}var rI={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`},iI=`Rove Nerd Symbols`,aI=[`"JetBrains Mono"`,`"${iI}"`,`"SF Mono"`,`ui-monospace`,`Menlo`,`monospace`].join(`, `);function oI(e){switch(e.kind){case`restored`:return B(`workspace.restored`);case`notLive`:return B(`workspace.tabNotLive`);case`exited`:return B(`workspace.exited`,{code:e.code??`?`});case`failed`:return B(`workspace.attachFailed`,{message:e.message});case`none`:return``}}function sI(e){V();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?B(`workspace.reopenFailed`,{message:o.error}):s?B(`workspace.engineExited`,{code:s.code??`?`}):c?d?B(`workspace.usageLimitUntil`,{time:new Date(d).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}):B(`workspace.usageLimit`):oI(t);return(0,H.jsxs)(`div`,{className:In(t.kind===`failed`||!!o.error),children:[(0,H.jsx)(`span`,{children:m}),e.onReopen&&(f||s)&&(0,H.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,disabled:o.busy,onClick:()=>e.onReopen?.(s!==null),children:o.busy?B(`workspace.reopening`):B(s?`workspace.retry`:`workspace.reopen`)}),t.kind===`failed`&&e.onRetryAttach&&(0,H.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:e.onRetryAttach,children:B(`workspace.retry`)}),c&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(U,{variant:`link`,hit:`tight`,onClick:()=>C.set((0,H.jsx)(ud,{model:r,taskId:i,context:`continue`,sourceTabId:a})),children:B(`menu.continueEngine`)}),(0,H.jsx)(U,{variant:`link`,hit:`tight`,disabled:l,onClick:()=>{u(!0),r.client.request(`task.resumeQuota`,{taskId:i}).catch(e=>L(e instanceof Error?e.message:String(e),`error`)).finally(()=>u(!1))},children:B(l?`workspace.resumingQuota`:`workspace.resumeQuota`)}),(0,H.jsx)(U,{variant:`link`,hit:`tight`,onClick:e.onDismissLimit,children:B(`workspace.dismiss`)})]}),p&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>C.set((0,H.jsx)(yT,{model:r,section:`engines`})),children:B(`workspace.engineSettings`)}),(0,H.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>C.set((0,H.jsx)(ud,{model:r,taskId:i})),children:B(`menu.newChatPick`)}),(0,H.jsx)(U,{variant:`link`,hit:`tight`,onClick:()=>C.set((0,H.jsx)(ud,{model:r,taskId:i,context:`continue`,sourceTabId:a})),children:B(`menu.continueEngine`)})]})]})}function cI(e){let t=e.split(`
63
63
  `).map(e=>e.trimEnd());for(;t[0]===``;)t.shift();for(;t.at(-1)===``;)t.pop();if(t.length===0)return null;let n=Math.max(0,...Array.from(t.join(`
64
64
  `).matchAll(/`+/g),e=>e[0].length)),r="`".repeat(Math.max(3,n+1));return`${r}\n${t.join(`
65
- `)}\n${r}\n`}function gI(e){let t=document.querySelector(`[data-composer="${CSS.escape(e)}"]`);return t&&t.offsetParent!==null?t:null}function _I(e,t,n,r){let i=hI(e.term.getSelection());if(i===null)return!1;let a=eI(t,n),o=gI(a);if(o){iI(a,i),e.term.clearSelection();let t=o.querySelector(`textarea`);return t?.focus(),t?.setSelectionRange(t.value.length,t.value.length),!0}return r?(L(B(`quote.atMenu`),`error`),!1):e.term.modes.bracketedPasteMode?(e.term.paste(i),e.term.clearSelection(),e.term.focus(),!0):(L(B(`quote.notReady`),`error`),!1)}async function vI(e,t,n){for(let r of n){r.size>1048576&&L(B(`layout.dropUploading`,{name:r.name}));try{t.term.paste(`${await Kl(e,r)} `)}catch(e){L(e instanceof Error?e.message:String(e),`error`)}}t.term.focus()}async function yI(){if(!navigator.clipboard?.read)throw Error(B(`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 bI(e,t){let n;try{n=await yI()}catch(e){L(B(`layout.pasteNoAccess`,{error:e instanceof Error?e.message:String(e)}),`error`);return}n.length===0?L(B(`layout.pasteNoImage`),`error`):await vI(e,t,n)}async function xI(e){try{return await navigator.clipboard.writeText(e),!0}catch{return L(B(`menu.copyFailed`),`error`),!1}}function SI(e){let{client:t,taskId:n,tabId:r,leafId:i}=e,a=y(e.model.tasks)?.tasks.find(e=>e.id===n)?.tabStatus?.[r]?.kind===`needs-input`;V();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,vv(t);let _=e.composer===!0&&yv(t),v=(0,h.useRef)(_);v.current=_,(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 "${dI}"`,String.fromCodePoint(57504)).catch(()=>{});let d=()=>{s||Bf({client:t,host:e,taskId:n,tabId:r,leafId:i,focusOnMount:g.current.focused!==!1&&!v.current},{setNotice:c,onScrolled:f,onFocusChange:e=>{if(!a)return;let{stream:t}=a.handle;e?(g.current.onActivate?.(),Mo.set(Po(t)??null)):Mo.get()?.stream===t&&Mo.set(null)},onExit:()=>{ZF(qu(n,r,i))||g.current.onExit?.()},copyText:xI,pasteImage:async()=>{a&&await bI(t,a.handle)}}).then(e=>{s?e.release():(a=e,u(e.handle))})};return zf(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&&(xI(t),e.clearSelection(),!0)},reset:()=>{let o={cols:e.cols,rows:e.rows};C.set((0,H.jsx)(Ti,{title:xl(`reset.title`),body:xl(`reset.body`),confirmLabel:B(`workspace.reset`),onConfirm:async()=>{YF(a);try{await t.request(`tab.split`,{taskId:n,tabId:r,action:`reset`,leafId:i??`leaf-1`,...o}),await l.reattach(),e.focus()}finally{XF(a)}}}))},size:()=>({cols:e.cols,rows:e.rows})},s=No(o);return document.activeElement===e.textarea&&Mo.set(o),()=>{s()}},[l,t,n,r,i]),(0,h.useEffect)(()=>{e.focused&&!_&&l&&document.activeElement!==l.term.textarea&&l.term.focus()},[e.focused,_,l]);let S=!i||i===`leaf-1`,[w,T]=(0,h.useState)(null),E=e.engineExit?.since===w,[D,O]=(0,h.useState)(null),k=e.usageLimit&&e.usageLimit.since!==D?e.usageLimit:null,A=(0,h.useRef)(!1),j=async(i,a)=>{if(!A.current){A.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(),T(e.engineExit?.since??null),m({busy:!1,error:null})}catch(e){m({busy:!1,error:e instanceof Error?e.message:String(e)})}finally{A.current=!1}}};return(0,H.jsxs)(`div`,{className:An,"data-stream":qu(n,r,i),onDragOver:e=>e.dataTransfer.types.includes(`Files`)&&e.preventDefault(),onDrop:e=>{!e.dataTransfer.files.length||!l||(e.preventDefault(),vI(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?vI(t,l,n):bI(t,l))},children:[(0,H.jsxs)(`div`,{className:jn,children:[(0,H.jsx)(`div`,{className:Mn,ref:o}),(0,H.jsx)(mI,{notice:s,engineExit:E?null:e.engineExit??null,model:e.model,taskId:n,tabId:r,revive:p,onReopen:S&&l?e=>void j(l,e):void 0,onRetryAttach:l?()=>void l.reattach():void 0,usageLimit:k!==null,onDismissLimit:k?()=>O(k.since):void 0}),b&&e.composer&&l&&(0,H.jsx)(U,{variant:`floating`,className:`absolute top-2.5 right-2.5 z-4`,title:B(`quote.title`),onClick:()=>_I(l,n,r,a),children:B(`quote.action`)}),d>0&&l&&(0,H.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,H.jsx)(`span`,{className:`text-warning`,children:xl(`scrolledBack`,{lines:d})}),(0,H.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>l.scrollToTop(),children:xl(`scrollFirst`)}),(0,H.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>l.scrollToBottom(),children:xl(`scrollLatest`)})]})]}),e.composer&&(0,H.jsx)(sI,{model:e.model,taskId:n,tabId:r}),l&&(0,H.jsx)(lI,{handle:l,atMenu:a})]})}var CI=[{tool:`pen`,d:`M3 13l.6-2.6L10.9 3.1l2 2L5.6 12.4zM9.6 4.4l2 2`},{tool:`box`,d:`M3 4h10v8H3z`},{tool:`text`,d:`M4 4h8M8 4v8.5`}];function wI({mark:e}){return e.kind===`pen`?(0,H.jsx)(`path`,{d:e.d}):e.kind===`box`?(0,H.jsx)(`rect`,{x:e.x,y:e.y,width:e.w,height:e.h,rx:2}):(0,H.jsx)(`text`,{x:e.x,y:e.y,className:`fill-accent stroke-none font-mono text-body font-semibold`,children:e.text})}function TI({model:e,taskId:t,url:n,target:r,onClose:i}){let[a,o]=(0,h.useState)(`pen`),[s,c]=(0,h.useState)([]),[l,u]=(0,h.useState)(null),[d,f]=(0,h.useState)(null),[p,m]=(0,h.useState)(!1),g=e=>{let t=e.currentTarget.getBoundingClientRect();return{x:Math.round(e.clientX-t.left),y:Math.round(e.clientY-t.top)}},_=e=>{let{x:t,y:n}=g(e);a!==`text`&&(e.currentTarget.setPointerCapture(e.pointerId),u(a===`pen`?{kind:`pen`,d:`M${t} ${n}`}:{kind:`box`,x:t,y:n,w:0,h:0}))},v=e=>{if(!l)return;let{x:t,y:n}=g(e);l.kind===`pen`?u({kind:`pen`,d:`${l.d} L${t} ${n}`}):l.kind===`box`&&u({...l,w:Math.max(0,t-l.x),h:Math.max(0,n-l.y)})},y=()=>{l&&(l.kind!==`box`||l.w>2&&l.h>2)&&c([...s,l]),u(null)},b=e=>{d&&e.trim()&&c([...s,{kind:`text`,...d,text:e.trim()}]),f(null)},x=async()=>{let a=M.get(),o=a?.startsWith(`${t}::`)?Rf(e.client,a):null,s=r.current;if(!o||!s){L(B(`browser.noEngine`),`error`);return}m(!0);try{await vI(e.client,o,[await KF(s,`browser-${bs(n)}.png`)]),i()}catch(e){e instanceof DOMException&&e.name===`NotAllowedError`||L(B(`browser.captureFailed`,{error:e instanceof Error?e.message:String(e)}),`error`),m(!1)}};return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`svg`,{className:yr,"aria-label":B(`browser.annotate`),onPointerDown:_,onPointerMove:v,onPointerUp:y,onPointerCancel:y,onClick:e=>a===`text`&&f(g(e)),children:[(0,H.jsx)(`title`,{children:B(`browser.annotate`)}),[...s,...l?[l]:[]].map((e,t)=>(0,H.jsx)(wI,{mark:e},t))]}),d&&(0,H.jsx)(`input`,{autoFocus:!0,className:`absolute min-w-24 rounded-xs border-hairline border-accent bg-paper px-1 font-mono text-body text-accent focus:outline-none`,style:{left:d.x,top:d.y-14},"aria-label":B(`browser.text`),onBlur:e=>b(e.target.value),onKeyDown:e=>e.key===`Enter`&&e.currentTarget.blur()},`${d.x},${d.y}`),!p&&(0,H.jsxs)(`div`,{className:`absolute bottom-3 left-1/2 flex w-max -translate-x-1/2 items-center whitespace-nowrap gap-0.5 rounded-md border-hairline border-line bg-surface p-1 shadow-popover [&_svg]:flex-none`,children:[CI.map(e=>(0,H.jsx)(U,{variant:a===e.tool?`iconOn`:`icon`,title:B(`browser.${e.tool}`),"aria-label":B(`browser.${e.tool}`),"aria-pressed":a===e.tool,onClick:()=>o(e.tool),children:(0,H.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:e.d})})},e.tool)),(0,H.jsx)(U,{variant:`icon`,disabled:s.length===0,title:B(`browser.undo`),"aria-label":B(`browser.undo`),onClick:()=>c(s.slice(0,-1)),children:(0,H.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:`M5.5 3.5 3 6l2.5 2.5M3 6h6.5a3 3 0 0 1 0 6H7`})})}),(0,H.jsx)(U,{variant:`filled`,onClick:()=>void x(),children:B(`browser.addToChat`)}),(0,H.jsx)(U,{variant:`icon`,title:B(`browser.annotateDone`),"aria-label":B(`browser.annotateDone`),onClick:i,children:(0,H.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:`M4 4l8 8M12 4l-8 8`})})})]})]})}function EI(e){return e===`localhost`||e.endsWith(`.localhost`)||e===`[::1]`||/^127(\.\d{1,3}){3}$/.test(e)}var DI=/^(localhost|127(\.\d{1,3}){3}|\[::1\])(:\d+)?([/?#]|$)/i,OI=/^[a-z][a-z0-9+.-]*:(?!\d+([/?#]|$))/i;function kI(e){let t=e.trim();if(!t||/\s/.test(t)||OI.test(t)&&!/^https?:\/\//i.test(t))return null;let n=/^https?:\/\//i.test(t)?t:DI.test(t)?`http://${t}`:`https://${t.replace(/^\/\//,``)}`;try{let e=new URL(n);return e.hostname?e.href:null}catch{return null}}function AI(e,t,n=EI(t.hostname)){let r=new URL(e);return r.origin===t.origin?`self`:EI(r.hostname)?n?`yes`:`remote`:r.protocol===`https:`?`yes`:`unreachable`}function jI(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 MI=5e3;function NI(e,t){let[n,r]=(0,h.useState)([]);return(0,h.useEffect)(()=>{r([]);let n=!0,i=()=>e.client.request(`browser.ports`,{taskId:t}).then(e=>n&&r(e.ports),()=>{});i();let a=window.setInterval(()=>void i(),MI);return()=>{n=!1,window.clearInterval(a)}},[e,t]),n}function PI({model:e,task:t}){V();let n=t.id,r=NI(e,n);return r.length===0?null:(0,H.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:r.map(e=>(0,H.jsx)(U,{onClick:()=>zc(n,e.url),children:B(`files.openPort`,{port:e.port})},e.port))})}var FI=6e4,II=new class{known=new Map;get(e){return this.known.get(e)}due(e,t){let n=this.known.get(e);return!n||t-n.at>=FI}set(e,t,n){t===null&&this.known.get(e)?.probe||this.known.set(e,{probe:t,at:n})}};function LI(e,t,n){let[,r]=(0,h.useState)(0);(0,h.useEffect)(()=>{if(!n||!II.due(t,Date.now()))return;let i=!0;return e.request(`browser.probe`,{url:t,origin:window.location.origin}).then(e=>II.set(t,e,Date.now()),()=>II.set(t,null,Date.now())).then(()=>i&&r(e=>e+1)),()=>{i=!1}},[e,t,n]);let i=n?II.get(t):void 0;return{pending:n&&!i,probe:i?.probe??null}}function RI({d:e}){return(0,H.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:e})})}function zI(e){let t=NI(e.model,e.taskId);return(0,H.jsxs)(`div`,{className:pr,children:[t.length>0&&(0,H.jsx)(`div`,{className:`flex w-[36ch] max-w-full flex-col text-left text-ink`,children:t.map(t=>(0,H.jsxs)(`button`,{type:`button`,className:hi({size:`file`}),title:t.url,onClick:()=>e.onOpen(t.url),children:[(0,H.jsx)(`span`,{className:`row-title min-w-0 flex-1 truncate`,children:t.command}),(0,H.jsx)(`span`,{className:`flex-none text-subtle`,children:`:${t.port}`})]},t.port))}),(0,H.jsx)(`p`,{children:B(t.length>0?`browser.empty`:`browser.emptyPorts`)})]})}var BI=`M6.5 3.5h-3v9h9v-3M9.5 3.5h3v3M12.5 3.5l-5 5`;function VI({model:e,taskId:t,tab:n,onNavigate:r,onStep:i}){V();let a=ys(n),[o,s]=(0,h.useState)(a),[c,l]=(0,h.useState)(!1),[u,d]=(0,h.useState)(0),[f,p]=(0,h.useState)(!1),m=(0,h.useRef)(null),g=y(e.client.conn).hello?.peer?.local,_=a?AI(a,window.location,g):null;(0,h.useEffect)(()=>{s(a),l(!1)},[a]);let v=e=>{let t=kI(e);l(t===null&&e.trim()!==``),t!==null&&(s(t),t===a?d(u+1):r(t))},b=a?new URL(a).hostname:``,x=_===`yes`&&a.startsWith(`https:`)&&!EI(b),{pending:S,probe:C}=LI(e.client,a,x),w=a&&_?jI(a,_,C):null,T=_===`yes`&&!w&&!S,E=w?B(`browser.${w.key}`,{host:w.host}):_===null?B(c?`browser.invalid`:`browser.empty`):null;return(0,H.jsxs)(`div`,{className:mr,children:[(0,H.jsxs)(`form`,{className:hr,onSubmit:e=>{e.preventDefault(),v(o)},children:[(0,H.jsx)(`button`,{type:`button`,className:Xn({small:!0}),disabled:n.at<=0,title:B(`browser.back`),"aria-label":B(`browser.back`),onClick:()=>i(n.at-1),children:(0,H.jsx)(RI,{d:`M10 3.5 5.5 8l4.5 4.5`})}),(0,H.jsx)(`button`,{type:`button`,className:Xn({small:!0}),disabled:n.at>=n.urls.length-1,title:B(`browser.forward`),"aria-label":B(`browser.forward`),onClick:()=>i(n.at+1),children:(0,H.jsx)(RI,{d:`M6 3.5 10.5 8 6 12.5`})}),(0,H.jsx)(`button`,{type:`button`,className:Xn({small:!0}),disabled:!T,title:B(`browser.reload`),"aria-label":B(`browser.reload`),onClick:()=>d(u+1),children:(0,H.jsx)(RI,{d:`M12.5 8a4.5 4.5 0 1 1-1.4-3.3M12.5 2.5v2.7H9.8`})}),(0,H.jsx)(`input`,{className:`browser-url mono ${gr}`,value:o,placeholder:B(`browser.placeholder`),"aria-label":B(`browser.address`),"aria-invalid":c,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,inputMode:`url`,onChange:e=>s(e.target.value)}),GF()&&(0,H.jsx)(U,{variant:f&&T?`iconOn`:`icon`,disabled:!T,title:B(`browser.annotate`),"aria-label":B(`browser.annotate`),"aria-pressed":f&&T,onClick:()=>p(!f),children:(0,H.jsx)(RI,{d:`M3 13l.6-2.6L10.9 3.1l2 2L5.6 12.4zM9.6 4.4l2 2`})}),a?(0,H.jsx)(`a`,{className:Xn({small:!0}),href:a,target:`_blank`,rel:`noopener noreferrer`,title:B(`browser.openTab`),"aria-label":B(`browser.openTab`),children:(0,H.jsx)(RI,{d:BI})}):(0,H.jsx)(`button`,{type:`button`,className:Xn({small:!0}),disabled:!0,"aria-label":B(`browser.openTab`),children:(0,H.jsx)(RI,{d:BI})})]}),T?(0,H.jsxs)(`div`,{ref:m,className:vr,children:[(0,H.jsx)(`iframe`,{className:_r,src:a,title:a,sandbox:`allow-scripts allow-same-origin allow-forms allow-popups`,referrerPolicy:`no-referrer`},`${a}#${u}`),f&&(0,H.jsx)(TI,{model:e,taskId:t,url:a,target:m,onClose:()=>p(!1)},`${a}#${u}`)]}):_===null&&!c?(0,H.jsx)(zI,{model:e,taskId:t,onOpen:r}):E?(0,H.jsx)(`p`,{className:pr,children:E}):null]})}var HI=`scrollbar-none flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto p-3`,UI=`m-0 p-3 font-mono text-meta text-muted`,WI=`flex items-baseline justify-between gap-3 font-mono text-meta normal-nums`,GI=`flex h-1.5 w-full gap-px overflow-hidden rounded-full bg-inset`,KI=`h-full min-w-[2px] flex-none`,qI=`m-0 flex list-none flex-col p-0`,JI=`-mx-1 flex h-5.5 min-w-0 items-center gap-2 rounded-xs px-1 font-mono text-meta normal-nums`,YI=`mt-2`,XI=`size-2 flex-none rounded-full bg-line`,ZI=`flex min-w-0 flex-1 items-center gap-1.5`,QI=`min-w-0 truncate text-muted`,$I=`w-[7ch] flex-none text-right text-ink`,eL=`w-[6ch] flex-none text-right text-muted`,tL=`group/fold`,nL=`${JI} cursor-pointer list-none hover:bg-hover focus-visible:outline focus-visible:outline-1 focus-visible:outline-focus [&::-webkit-details-marker]:hidden`,rL=`m-0 flex list-none flex-col p-0`,iL=`${JI} pl-5`,aL=`flex min-w-0 flex-1 overflow-hidden`,oL=`min-w-0 truncate text-subtle`,sL=`flex-none text-muted`,cL=`w-[7ch] flex-none text-right text-muted`,lL=`w-[6ch] flex-none`,uL=1e4,dL={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)`},fL=[`var(--info)`,`var(--success)`,`var(--warning)`,`var(--merged)`];function pL({model:e,task:t,active:n}){V();let r=y(e.client.conn),i=y(e.selection),a=y(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:xE(e)})),c=()=>{d(!0),o(!0).finally(()=>a&&d(!1))};o(!1).then(c);let u=K(uL,c);return()=>{a=!1,d(!1),u()}},[e,n,r.state,t.id,s]),c.kind===`loading`)return(0,H.jsx)(`p`,{className:UI,children:B(`context.loading`)});if(c.kind===`failed`)return(0,H.jsx)(`p`,{className:UI,children:B(`context.failed`,{error:c.error})});if(!c.meter)return(0,H.jsx)(`p`,{className:UI,children:B(`context.none`)});let p=c.meter,m=p.rows.filter(e=>e.share!==void 0),g=e=>e.share===void 0?void 0:dL[e.key]??fL[m.indexOf(e)%fL.length],_=`${p.approximate?`~`:``}${hL(p.used)}`;return(0,H.jsxs)(`div`,{className:HI,children:[(0,H.jsxs)(`div`,{className:WI,children:[(0,H.jsx)(`span`,{className:`text-ink`,children:p.percent===null?B(`context.usedTokens`,{tokens:_}):B(`context.used`,{percent:gL(p.percent)})}),p.window!==null&&(0,H.jsxs)(`span`,{className:`text-muted`,children:[_,` / `,hL(p.window)]})]}),(0,H.jsx)(`div`,{className:GI,role:`meter`,"aria-valuenow":Math.round(p.percent??100),"aria-valuemin":0,"aria-valuemax":100,children:m.map(e=>(0,H.jsx)(`span`,{className:KI,style:{width:`${e.share}%`,background:g(e)}},e.key))}),(0,H.jsx)(`ul`,{className:qI,children:p.rows.map((e,t)=>{let n=`context.part.${e.key}`,r=B(n)===n?e.label??e.key:B(n),i=g(e),a=(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:XI,style:i?{background:i}:void 0}),(0,H.jsxs)(`span`,{className:ZI,children:[(0,H.jsx)(`span`,{className:QI,title:r,children:r}),e.items&&(0,H.jsx)(`span`,{className:`inline-block flex-none text-subtle group-open/fold:rotate-90`,children:`›`})]}),(0,H.jsx)(`span`,{className:$I,children:hL(e.tokens)}),(0,H.jsx)(`span`,{className:eL,children:e.deferred?`—`:gL(e.tokens/(p.window??p.used)*100)})]}),o=(e.deferred?!p.rows[t-1]?.deferred:e.share===void 0)?YI:void 0;if(!e.items)return(0,H.jsx)(`li`,{className:o,children:(0,H.jsx)(`div`,{className:JI,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,H.jsx)(`li`,{className:o,children:(0,H.jsxs)(`details`,{className:tL,children:[(0,H.jsx)(`summary`,{className:nL,children:a}),(0,H.jsxs)(`ul`,{className:rL,children:[e.items.map(e=>(0,H.jsx)(mL,{name:e.name,tokens:e.tokens},e.name)),c>0&&(0,H.jsx)(mL,{name:B(`context.more`,{count:c}),tokens:e.tokens-s})]})]})},e.key)})}),u&&m.length<2&&(0,H.jsx)(`p`,{className:`m-0 font-mono text-meta text-subtle`,children:B(`context.probing`)})]})}function mL({name:e,tokens:t}){let n=e.lastIndexOf(`/`)+1;return(0,H.jsxs)(`li`,{className:iL,title:e,children:[(0,H.jsxs)(`span`,{className:aL,children:[n>0&&(0,H.jsx)(`span`,{className:`min-w-0 truncate text-subtle`,children:e.slice(0,n)}),(0,H.jsx)(`span`,{className:n>0?sL:oL,children:e.slice(n)})]}),(0,H.jsx)(`span`,{className:cL,children:hL(Math.max(0,t))}),(0,H.jsx)(`span`,{className:lL})]})}function hL(e){return e>=1e6?`${+(e/1e6).toFixed(1)}M`:e>=1e3?`${+(e/1e3).toFixed(1)}k`:String(e)}function gL(e){return e>0&&e<.1?`<0.1%`:`${e<10?+e.toFixed(1):Math.round(e)}%`}var _L=3;function vL({model:e,task:t}){V();let n=t.autoFixCi,r=n=>void e.client.request(`task.autoFixCi`,{taskId:t.id,enabled:n}).catch(e=>L(e instanceof Error?e.message:String(e),`error`));return(0,H.jsx)(`div`,{className:`flex items-center gap-3 px-2 pt-1 font-mono text-meta`,children:n?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:n.stopped?lp.attention:`text-muted`,title:B(`files.autoFix.hint`),children:B(n.stopped?`files.autoFix.stopped`:`files.autoFix.count`,{n:n.attempts,max:_L})}),(0,H.jsx)(U,{hit:`tight`,onClick:()=>r(!1),children:B(`files.autoFix.off`)})]}):(0,H.jsx)(U,{hit:`tight`,title:B(`files.autoFix.hint`),onClick:()=>r(!0),children:B(`files.autoFix.on`)})})}function yL(e){let t=e.pr;return!!t&&t.number!==void 0&&!e.machine&&(t.lifecycle===`open`||t.lifecycle===`ready_to_merge`)}function bL(e){let t={fail:0,pending:0,pass:0,skipped:0};for(let n of e)t[n.state]++;return t}function xL(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 SL(e,t){let{startedAt:n,completedAt:r,durationMs:i}=e;return e.state===`pending`?n?{key:`files.checks.runningFor`,vars:{elapsed:xL(t-n)}}:null:i===null?r?{key:`files.checks.finishedAgo`,vars:{age:Ml(t-r)}}:null:r?{key:`files.checks.tookAgo`,vars:{duration:xL(i),age:Ml(t-r)}}:{key:`files.checks.took`,vars:{duration:xL(i)}}}function CL(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 wL=`flex flex-col gap-0.5 px-2 pb-2 font-mono text-meta`,TL=`flex items-start gap-2`,EL=`flex min-w-0 flex-1 flex-wrap items-center gap-x-2 text-left text-ink`,DL={pass:{glyph:`✓`,tone:`success`},fail:{glyph:`✗`,tone:`attention`},pending:{glyph:`●`,tone:`warning`},skipped:{glyph:`–`,tone:`muted`}};function OL({model:e,task:t}){V();let n=t.pr,r=t.id,[i,a]=(0,h.useState)(()=>X(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&&(Gu(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:B(`files.checks.noLog`)}:{state:`note`,text:B(`files.checks.logUnavailable`,{detail:e.detail})}).catch(e=>({state:`note`,text:B(`files.checks.logUnavailable`,{detail:e instanceof Error?e.message:String(e)})})).then(e=>l(t=>n in t?{...t,[n]:e}:t))},m=(0,H.jsx)(U,{hit:`tight`,className:`flex-none whitespace-nowrap`,onClick:()=>d(e=>e+1),children:B(`files.checks.refresh`)});if(!i)return(0,H.jsx)(`div`,{className:wL,children:(0,H.jsx)(`div`,{className:TL,children:(0,H.jsxs)(`span`,{className:`flex-1 text-muted`,children:[B(`files.checks.title`),` `,B(`files.checks.loading`)]})})});if(i.outcome!==`ok`)return(0,H.jsx)(`div`,{className:wL,children:(0,H.jsxs)(`div`,{className:TL,children:[(0,H.jsx)(`span`,{className:`min-w-0 flex-1 text-muted wrap-anywhere`,children:i.outcome===`none`?B(`files.checks.none`):B(`files.checks.unavailable`,{detail:i.detail})}),m]})});let g=bL(i.checks),_=Date.now(),v=o??(g.fail>0||g.pending>0),y=CL(i);return(0,H.jsxs)(`div`,{className:wL,children:[(0,H.jsxs)(`div`,{className:TL,children:[(0,H.jsxs)(U,{variant:`row`,className:EL,"aria-expanded":v,disabled:i.total===0,onClick:()=>s(!v),children:[i.total>0&&(0,H.jsx)(ps,{right:!v}),(0,H.jsx)(`span`,{children:i.total===0?B(`files.checks.none`):B(`files.checks.summary`,{pass:g.pass+g.skipped,total:i.total})}),g.fail>0&&(0,H.jsx)(`span`,{className:lp.attention,children:B(`files.checks.failed`,{count:g.fail})}),g.pending>0&&(0,H.jsx)(`span`,{className:lp.warning,children:B(`files.checks.running`,{count:g.pending})}),y.map(e=>(0,H.jsx)(`span`,{className:lp[e.tone],children:B(e.key)},e.key))]}),m]}),v&&i.checks.map(e=>{let{glyph:t,tone:n}=DL[e.state],r=SL(e,_),i=`${e.runId}:${e.name}`,a=c[i];return(0,H.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,H.jsxs)(`div`,{className:`flex items-baseline gap-2 pl-4`,children:[(0,H.jsx)(`span`,{className:`w-[1ch] flex-none text-center ${lp[n]}`,children:t}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.name,children:e.name}),r&&(0,H.jsx)(`span`,{className:`flex-none text-subtle`,children:B(r.key,r.vars)}),e.state===`fail`&&e.runId&&(0,H.jsx)(U,{hit:`tight`,className:`flex-none whitespace-nowrap`,onClick:()=>p(e),children:B(a?`files.checks.hideLog`:`files.checks.log`)})]}),a&&(0,H.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`?B(`files.checks.loading`):a.text})]},`${e.name}:${e.url}`)}),v&&i.total>i.checks.length&&(0,H.jsx)(`span`,{className:`pl-4 text-subtle`,children:B(`files.checks.more`,{count:i.total-i.checks.length})})]})}function kL({model:e,task:t}){return yL(t)?(0,H.jsxs)(`div`,{onKeyDown:e=>e.stopPropagation(),children:[(0,H.jsx)(OL,{model:e,task:t}),(0,H.jsx)(vL,{model:e,task:t})]}):null}var AL=[`renamed`,`added`,`untracked`,`modified`,`deleted`,`conflict`],jL={U:`conflict`,D:`deleted`,M:`modified`,T:`modified`,"?":`untracked`,A:`added`,R:`renamed`,C:`renamed`},ML={conflict:`attention`,deleted:`attention`,modified:`warning`,untracked:`success`,added:`success`,renamed:`accent`},NL={conflict:`!`,deleted:`D`,modified:`M`,untracked:`U`,added:`A`,renamed:`R`};function PL(e){let t=new Map;for(let n of[`branch`,`working`])for(let r of e){let e=r.scope===n?jL[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||AL.indexOf(r)>AL.indexOf(a))&&n.set(i,r)}return n}function FL(e,t){return e.some(e=>e.scope===`working`&&e.path===t&&e.status!==`?`)}function IL(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 LL={start:`\x1B[200~`,end:`\x1B[201~`};function RL(e,t){return e.engineTarget(t).tabId??e.tabs.get()[t]?.find(e=>e.kind===`engine`)?.id}async function zL(e,t,n){let r=RL(e,t);if(!r)return L(B(`files.stripNoEngine`),`error`),!1;try{return e.selection.get().tabId!==r&&e.select(t,r),await e.client.request(`term.input`,{stream:qu(t,r),data:`${LL.start}${n}${LL.end}`}),L(B(`files.stripFilled`)),!0}catch(e){return L(e instanceof Error?e.message:String(e),`error`),!1}}function BL(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 VL(e){return[...BL(e)?[`commit`]:[],...HL(e)]}function HL(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 UL(e,t,n){try{let r=await e.client.request(`task.prompt`,{taskId:t.id,kind:n});r.outcome===`unavailable`?L(B(`files.stripUnavailable`,{detail:r.detail??``}),`error`):r.outcome===`none`||!r.prompt?L(B(`files.stripNothing`),`error`):await zL(e,t.id,r.prompt)}catch(e){L(e instanceof Error?e.message:String(e),`error`)}}var WL={commit:`files.stripCommit`,createPR:`files.stripCreate`,conflicts:`files.stripConflicts`,fixCI:`files.stripFixCi`,comments:`files.stripComments`,archive:`files.stripArchive`};function GL({model:e,task:t}){let n=VL(t);return n.length===0?null:(0,H.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,H.jsx)(U,{onClick:()=>n===`archive`?void My(e,t):void UL(e,t,n),children:B(WL[n])},n))})}function KL({model:e,task:t,narrow:n=!1}){V();let[r,i]=(0,h.useState)(()=>X(e,`files.list`,{taskId:t.id})?.files??null),[a,o]=(0,h.useState)(()=>PL(X(e,`diff.files`,{taskId:t.id})?.files??[])),[s,c]=(0,h.useState)(null),[l,u]=(0,h.useState)(null),[d,f]=(0,h.useState)(new Set),[p,m]=(0,h.useState)(0),[g,_]=(0,h.useState)(0),v=(0,h.useRef)(null),b=y(M),x=y(e.client.conn),S=JSON.stringify(t.changes??null);(0,h.useEffect)(()=>{let n=!0;return Ku(e,`files.list`,{taskId:t.id}).then(e=>{n&&(i(e.files),c(e.root??null),u(null))},e=>n&&u(Yo(e))),()=>{n=!1}},[e,t.id,S,g,x.state]),(0,h.useEffect)(()=>{let n=!0;return Ku(e,`diff.files`,{taskId:t.id}).then(e=>n&&o(PL(e.files)),()=>{}),()=>{n=!1}},[e,t.id,S,g,x.state]);let C=r!==null,w=IL(r??[],d).map(e=>({path:e.path,label:e.name,depth:e.depth,dir:e.dir,open:e.open,state:a.get(e.path)})),T=Math.min(p,Math.max(0,w.length-1)),E=w[T],D=(e,t)=>f(n=>{let r=new Set(n);return t??!r.has(e)?r.add(e):r.delete(e),r}),O=e=>Rc(t.id,e),k=e=>Lc({taskId:t.id,path:e,scope:`working`}),A=n=>{if(!b?.startsWith(`${t.id}::`)){L(B(`files.mentionNoEngine`),`error`);return}e.client.request(`term.input`,{stream:b,data:`@${n} `}).catch(e=>L(String(e),`error`))},j=(n,r,i)=>t.machine?L(B(`files.remoteNoExternal`,{host:t.machine.label}),`error`):void e.client.request(n,{taskId:t.id,path:r}).then(()=>i&&L(i)).catch(e=>L(e instanceof Error?e.message:String(e),`error`)),N=e=>j(`file.openExternal`,e,B(`taskops.openedExternal`)),P=n=>void e.client.request(`file.openTerminal`,{taskId:t.id,path:n}).catch(e=>L(e instanceof Error?e.message:String(e),`error`)),ee=e=>{let t=e.dir?e.path.slice(0,-1):e.path;return[{label:B(`files.menu.attach`),key:`a`,run:()=>A(e.path)},{label:B(`files.menu.copy`),children:[{label:B(`files.menu.copyRelative`),run:()=>void DA(t,t)},...s?[{label:B(`files.menu.copyAbsolute`),run:()=>void DA(`${s}/${t}`,t)}]:[],{label:B(`files.menu.copyName`),run:()=>void DA(e.label,t)}]},{label:B(`files.menu.diff`),key:`d`,section:`open`,run:()=>k(e.path)},...e.dir?[]:[{label:B(`files.menu.openExternal`),key:`o`,section:`open`,run:()=>N(e.path)}],{label:B(`files.menu.reveal`),section:`open`,run:()=>j(`file.reveal`,t)},{label:B(`files.menu.terminal`),section:`terminal`,run:()=>P(t)}]};return(0,H.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:v,onKeyDown:e=>{let t=e.key;if(t===`j`||t===`ArrowDown`)m(Math.min(w.length-1,T+1));else if(t===`k`||t===`ArrowUp`)m(Math.max(0,T-1));else if((t===`l`||t===`ArrowRight`)&&E?.dir)D(E.path,!0);else if((t===`h`||t===`ArrowLeft`)&&E?.dir)D(E.path,!1);else if(t===`r`)_(e=>e+1);else if(t===`D`&&e.shiftKey)k(`.`);else if(t===`d`&&E)k(E.path);else if(t===`Enter`&&E)E.dir?D(E.path):O(E.path);else if(t===`a`&&E)A(E.path);else if(t===`o`&&E&&!E.dir)N(E.path);else return;e.preventDefault()},children:[(0,H.jsx)(GL,{model:e,task:t}),(0,H.jsx)(kL,{model:e,task:t}),(0,H.jsx)(PI,{model:e,task:t}),(0,H.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[l&&(0,H.jsx)(`p`,{className:`mono text-error`,children:l}),!l&&C&&w.length===0&&(0,H.jsx)(`p`,{className:`mx-2.5 my-3 font-mono text-meta text-subtle`,children:B(`files.emptyAll`)}),w.map((e,t)=>(0,H.jsxs)(`button`,{type:`button`,className:hi({selected:t===T,size:n?`file-narrow`:`file`}),style:{paddingLeft:8+e.depth*14},title:e.path,onContextMenu:n=>{m(t),_F(n,ee(e))},onClick:()=>{m(t),v.current?.focus(),e.dir?D(e.path):O(e.path)},children:[(0,H.jsx)(`span`,{className:bi,children:e.dir?(0,H.jsx)(ps,{right:!e.open}):null}),(0,H.jsx)(`span`,{className:`${gi} ${e.state?lp[ML[e.state]]:``}`,children:e.label}),e.state&&(0,H.jsx)(`span`,{className:`w-[1ch] flex-none text-center font-mono ${lp[ML[e.state]]}`,title:B(`files.state.${e.state}`),children:e.dir?`•`:NL[e.state]})]},e.path))]})]})}var qL={md:`md`,markdown:`md`,html:`html`,htm:`html`,svg:`svg`,png:`image`,jpg:`image`,jpeg:`image`,gif:`image`,webp:`image`,pdf:`pdf`};function JL(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<0?null:qL[t.slice(n+1).toLowerCase()]??null}function YL(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 XL=e=>new TextDecoder().decode(YL(e));function ZL(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 QL=`default-src 'none'; img-src data:; style-src 'unsafe-inline'`;function $L(e){let t=`<meta http-equiv="Content-Security-Policy" content="${QL}">`,n=/^\s*<!doctype[^>]*>/i.exec(e);return n?`${n[0]}${t}${e.slice(n[0].length)}`:`${t}${e}`}var eR=/^\[([^\]\n]+)\]\((https?:\/\/[^\s)]+)\)/,tR=/^https?:\/\/[^\s<>)\]]+/,nR=/[\p{L}\p{N}]/u;function rR(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:rR(e.slice(i+2,n))}),i=n+2;continue}}else if(o===`*`||o===`_`&&!nR.test(e[i-1]??``)){let n=e.indexOf(o,i+1);if(n>i+1&&!/\s/.test(e[i+1]??` `)&&(o===`*`||!nR.test(e[n+1]??``))){r(),t.push({t:`em`,c:rR(e.slice(i+1,n))}),i=n+1;continue}}else if(o===`[`){let e=eR.exec(a);if(e){r(),t.push({t:`link`,href:e[2],c:rR(e[1])}),i+=e[0].length;continue}}else if(o===`h`&&!nR.test(e[i-1]??``)){let e=tR.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 iR=/^\s*(```+|~~~+)\s*([\w+#.-]*)\s*$/,aR=/^(#{1,6})\s+(.*?)\s*#*\s*$/,oR=/^(\s*)([-*+])\s+(.*)$/,sR=/^(\s*)\d+[.)]\s+(.*)$/,cR=/^\s*([-*_])(\s*\1){2,}\s*$/,lR=/^\s*\|.*\|\s*$/,uR=/^\s*\|?\s*:?-{2,}:?\s*(\|\s*:?-{2,}:?\s*)*\|?\s*$/,dR=e=>e.trim().replace(/^\|/,``).replace(/\|$/,``).split(`|`).map(e=>e.trim());function fR(e){let t=e.replace(/\r\n?/g,`
65
+ `)}\n${r}\n`}function lI(e){let t=document.querySelector(`[data-composer="${CSS.escape(e)}"]`);return t&&t.offsetParent!==null?t:null}function uI(e,t,n,r){let i=cI(e.term.getSelection());if(i===null)return!1;let a=qF(t,n),o=lI(a);if(o){ZF(a,i),e.term.clearSelection();let t=o.querySelector(`textarea`);return t?.focus(),t?.setSelectionRange(t.value.length,t.value.length),!0}return r?(L(B(`quote.atMenu`),`error`),!1):e.term.modes.bracketedPasteMode?(e.term.paste(i),e.term.clearSelection(),e.term.focus(),!0):(L(B(`quote.notReady`),`error`),!1)}async function dI(e,t,n){for(let r of n){r.size>1048576&&L(B(`layout.dropUploading`,{name:r.name}));try{t.term.paste(`${await Kl(e,r)} `)}catch(e){L(e instanceof Error?e.message:String(e),`error`)}}t.term.focus()}async function fI(){if(!navigator.clipboard?.read)throw Error(B(`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 pI(e,t){let n;try{n=await fI()}catch(e){L(B(`layout.pasteNoAccess`,{error:e instanceof Error?e.message:String(e)}),`error`);return}n.length===0?L(B(`layout.pasteNoImage`),`error`):await dI(e,t,n)}async function mI(e){try{return await navigator.clipboard.writeText(e),!0}catch{return L(B(`menu.copyFailed`),`error`),!1}}function hI(e){let{client:t,taskId:n,tabId:r,leafId:i}=e,a=y(e.model.tasks)?.tasks.find(e=>e.id===n)?.tabStatus?.[r]?.kind===`needs-input`;V();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,_v(t);let _=e.composer===!0&&vv(t),v=(0,h.useRef)(_);v.current=_,(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 "${iI}"`,String.fromCodePoint(57504)).catch(()=>{});let d=()=>{s||Bf({client:t,host:e,taskId:n,tabId:r,leafId:i,focusOnMount:g.current.focused!==!1&&!v.current},{setNotice:c,onScrolled:f,onFocusChange:e=>{if(!a)return;let{stream:t}=a.handle;e?(g.current.onActivate?.(),Mo.set(Po(t)??null)):Mo.get()?.stream===t&&Mo.set(null)},onExit:()=>{WF(qu(n,r,i))||g.current.onExit?.()},copyText:mI,pasteImage:async()=>{a&&await pI(t,a.handle)}}).then(e=>{s?e.release():(a=e,u(e.handle))})};return zf(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&&(mI(t),e.clearSelection(),!0)},reset:()=>{let o={cols:e.cols,rows:e.rows};C.set((0,H.jsx)(Ti,{title:xl(`reset.title`),body:xl(`reset.body`),confirmLabel:B(`workspace.reset`),onConfirm:async()=>{HF(a);try{await t.request(`tab.split`,{taskId:n,tabId:r,action:`reset`,leafId:i??`leaf-1`,...o}),await l.reattach(),e.focus()}finally{UF(a)}}}))},size:()=>({cols:e.cols,rows:e.rows})},s=No(o);return document.activeElement===e.textarea&&Mo.set(o),()=>{s()}},[l,t,n,r,i]),(0,h.useEffect)(()=>{e.focused&&!_&&l&&document.activeElement!==l.term.textarea&&l.term.focus()},[e.focused,_,l]);let S=!i||i===`leaf-1`,[w,T]=(0,h.useState)(null),E=e.engineExit?.since===w,[D,O]=(0,h.useState)(null),k=e.usageLimit&&e.usageLimit.since!==D?e.usageLimit:null,A=(0,h.useRef)(!1),j=async(i,a)=>{if(!A.current){A.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(),T(e.engineExit?.since??null),m({busy:!1,error:null})}catch(e){m({busy:!1,error:e instanceof Error?e.message:String(e)})}finally{A.current=!1}}};return(0,H.jsxs)(`div`,{className:An,"data-stream":qu(n,r,i),onDragOver:e=>e.dataTransfer.types.includes(`Files`)&&e.preventDefault(),onDrop:e=>{!e.dataTransfer.files.length||!l||(e.preventDefault(),dI(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?dI(t,l,n):pI(t,l))},children:[(0,H.jsxs)(`div`,{className:jn,children:[(0,H.jsx)(`div`,{className:Mn,ref:o}),(0,H.jsx)(sI,{notice:s,engineExit:E?null:e.engineExit??null,model:e.model,taskId:n,tabId:r,revive:p,onReopen:S&&l?e=>void j(l,e):void 0,onRetryAttach:l?()=>void l.reattach():void 0,usageLimit:k!==null,onDismissLimit:k?()=>O(k.since):void 0}),b&&e.composer&&l&&(0,H.jsx)(U,{variant:`floating`,className:`absolute top-2.5 right-2.5 z-4`,title:B(`quote.title`),onClick:()=>uI(l,n,r,a),children:B(`quote.action`)}),d>0&&l&&(0,H.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,H.jsx)(`span`,{className:`text-warning`,children:xl(`scrolledBack`,{lines:d})}),(0,H.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>l.scrollToTop(),children:xl(`scrollFirst`)}),(0,H.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>l.scrollToBottom(),children:xl(`scrollLatest`)})]})]}),e.composer&&(0,H.jsx)(eI,{model:e.model,taskId:n,tabId:r}),l&&(0,H.jsx)(nI,{handle:l,atMenu:a})]})}var gI=[{tool:`pen`,d:`M3 13l.6-2.6L10.9 3.1l2 2L5.6 12.4zM9.6 4.4l2 2`},{tool:`box`,d:`M3 4h10v8H3z`},{tool:`text`,d:`M4 4h8M8 4v8.5`}];function _I({mark:e}){return e.kind===`pen`?(0,H.jsx)(`path`,{d:e.d}):e.kind===`box`?(0,H.jsx)(`rect`,{x:e.x,y:e.y,width:e.w,height:e.h,rx:2}):(0,H.jsx)(`text`,{x:e.x,y:e.y,className:`fill-accent stroke-none font-mono text-body font-semibold`,children:e.text})}function vI({model:e,taskId:t,url:n,target:r,onClose:i}){let[a,o]=(0,h.useState)(`pen`),[s,c]=(0,h.useState)([]),[l,u]=(0,h.useState)(null),[d,f]=(0,h.useState)(null),[p,m]=(0,h.useState)(!1),g=e=>{let t=e.currentTarget.getBoundingClientRect();return{x:Math.round(e.clientX-t.left),y:Math.round(e.clientY-t.top)}},_=e=>{let{x:t,y:n}=g(e);a!==`text`&&(e.currentTarget.setPointerCapture(e.pointerId),u(a===`pen`?{kind:`pen`,d:`M${t} ${n}`}:{kind:`box`,x:t,y:n,w:0,h:0}))},v=e=>{if(!l)return;let{x:t,y:n}=g(e);l.kind===`pen`?u({kind:`pen`,d:`${l.d} L${t} ${n}`}):l.kind===`box`&&u({...l,w:Math.max(0,t-l.x),h:Math.max(0,n-l.y)})},y=()=>{l&&(l.kind!==`box`||l.w>2&&l.h>2)&&c([...s,l]),u(null)},b=e=>{d&&e.trim()&&c([...s,{kind:`text`,...d,text:e.trim()}]),f(null)},x=async()=>{let a=M.get(),o=a?.startsWith(`${t}::`)?Rf(e.client,a):null,s=r.current;if(!o||!s){L(B(`browser.noEngine`),`error`);return}m(!0);try{await dI(e.client,o,[await zF(s,`browser-${bs(n)}.png`)]),i()}catch(e){e instanceof DOMException&&e.name===`NotAllowedError`||L(B(`browser.captureFailed`,{error:e instanceof Error?e.message:String(e)}),`error`),m(!1)}};return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`svg`,{className:yr,"aria-label":B(`browser.annotate`),onPointerDown:_,onPointerMove:v,onPointerUp:y,onPointerCancel:y,onClick:e=>a===`text`&&f(g(e)),children:[(0,H.jsx)(`title`,{children:B(`browser.annotate`)}),[...s,...l?[l]:[]].map((e,t)=>(0,H.jsx)(_I,{mark:e},t))]}),d&&(0,H.jsx)(`input`,{autoFocus:!0,className:`absolute min-w-24 rounded-xs border-hairline border-accent bg-paper px-1 font-mono text-body text-accent focus:outline-none`,style:{left:d.x,top:d.y-14},"aria-label":B(`browser.text`),onBlur:e=>b(e.target.value),onKeyDown:e=>e.key===`Enter`&&e.currentTarget.blur()},`${d.x},${d.y}`),!p&&(0,H.jsxs)(`div`,{className:`absolute bottom-3 left-1/2 flex w-max -translate-x-1/2 items-center whitespace-nowrap gap-0.5 rounded-md border-hairline border-line bg-surface p-1 shadow-popover [&_svg]:flex-none`,children:[gI.map(e=>(0,H.jsx)(U,{variant:a===e.tool?`iconOn`:`icon`,title:B(`browser.${e.tool}`),"aria-label":B(`browser.${e.tool}`),"aria-pressed":a===e.tool,onClick:()=>o(e.tool),children:(0,H.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:e.d})})},e.tool)),(0,H.jsx)(U,{variant:`icon`,disabled:s.length===0,title:B(`browser.undo`),"aria-label":B(`browser.undo`),onClick:()=>c(s.slice(0,-1)),children:(0,H.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:`M5.5 3.5 3 6l2.5 2.5M3 6h6.5a3 3 0 0 1 0 6H7`})})}),(0,H.jsx)(U,{variant:`filled`,onClick:()=>void x(),children:B(`browser.addToChat`)}),(0,H.jsx)(U,{variant:`icon`,title:B(`browser.annotateDone`),"aria-label":B(`browser.annotateDone`),onClick:i,children:(0,H.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:`M4 4l8 8M12 4l-8 8`})})})]})]})}function yI(e){return e===`localhost`||e.endsWith(`.localhost`)||e===`[::1]`||/^127(\.\d{1,3}){3}$/.test(e)}var bI=/^(localhost|127(\.\d{1,3}){3}|\[::1\])(:\d+)?([/?#]|$)/i,xI=/^[a-z][a-z0-9+.-]*:(?!\d+([/?#]|$))/i;function SI(e){let t=e.trim();if(!t||/\s/.test(t)||xI.test(t)&&!/^https?:\/\//i.test(t))return null;let n=/^https?:\/\//i.test(t)?t:bI.test(t)?`http://${t}`:`https://${t.replace(/^\/\//,``)}`;try{let e=new URL(n);return e.hostname?e.href:null}catch{return null}}function CI(e,t,n=yI(t.hostname)){let r=new URL(e);return r.origin===t.origin?`self`:yI(r.hostname)?n?`yes`:`remote`:r.protocol===`https:`?`yes`:`unreachable`}function wI(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 TI=5e3;function EI(e,t){let[n,r]=(0,h.useState)([]);return(0,h.useEffect)(()=>{r([]);let n=!0,i=()=>e.client.request(`browser.ports`,{taskId:t}).then(e=>n&&r(e.ports),()=>{});i();let a=window.setInterval(()=>void i(),TI);return()=>{n=!1,window.clearInterval(a)}},[e,t]),n}function DI({model:e,task:t}){V();let n=t.id,r=EI(e,n);return r.length===0?null:(0,H.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:r.map(e=>(0,H.jsx)(U,{onClick:()=>zc(n,e.url),children:B(`files.openPort`,{port:e.port})},e.port))})}var OI=6e4,kI=new class{known=new Map;get(e){return this.known.get(e)}due(e,t){let n=this.known.get(e);return!n||t-n.at>=OI}set(e,t,n){t===null&&this.known.get(e)?.probe||this.known.set(e,{probe:t,at:n})}};function AI(e,t,n){let[,r]=(0,h.useState)(0);(0,h.useEffect)(()=>{if(!n||!kI.due(t,Date.now()))return;let i=!0;return e.request(`browser.probe`,{url:t,origin:window.location.origin}).then(e=>kI.set(t,e,Date.now()),()=>kI.set(t,null,Date.now())).then(()=>i&&r(e=>e+1)),()=>{i=!1}},[e,t,n]);let i=n?kI.get(t):void 0;return{pending:n&&!i,probe:i?.probe??null}}function jI({d:e}){return(0,H.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:e})})}function MI(e){let t=EI(e.model,e.taskId);return(0,H.jsxs)(`div`,{className:pr,children:[t.length>0&&(0,H.jsx)(`div`,{className:`flex w-[36ch] max-w-full flex-col text-left text-ink`,children:t.map(t=>(0,H.jsxs)(`button`,{type:`button`,className:hi({size:`file`}),title:t.url,onClick:()=>e.onOpen(t.url),children:[(0,H.jsx)(`span`,{className:`row-title min-w-0 flex-1 truncate`,children:t.command}),(0,H.jsx)(`span`,{className:`flex-none text-subtle`,children:`:${t.port}`})]},t.port))}),(0,H.jsx)(`p`,{children:B(t.length>0?`browser.empty`:`browser.emptyPorts`)})]})}var NI=`M6.5 3.5h-3v9h9v-3M9.5 3.5h3v3M12.5 3.5l-5 5`;function PI({model:e,taskId:t,tab:n,onNavigate:r,onStep:i}){V();let a=ys(n),[o,s]=(0,h.useState)(a),[c,l]=(0,h.useState)(!1),[u,d]=(0,h.useState)(0),[f,p]=(0,h.useState)(!1),m=(0,h.useRef)(null),g=y(e.client.conn).hello?.peer?.local,_=a?CI(a,window.location,g):null;(0,h.useEffect)(()=>{s(a),l(!1)},[a]);let v=e=>{let t=SI(e);l(t===null&&e.trim()!==``),t!==null&&(s(t),t===a?d(u+1):r(t))},b=a?new URL(a).hostname:``,x=_===`yes`&&a.startsWith(`https:`)&&!yI(b),{pending:S,probe:C}=AI(e.client,a,x),w=a&&_?wI(a,_,C):null,T=_===`yes`&&!w&&!S,E=w?B(`browser.${w.key}`,{host:w.host}):_===null?B(c?`browser.invalid`:`browser.empty`):null;return(0,H.jsxs)(`div`,{className:mr,children:[(0,H.jsxs)(`form`,{className:hr,onSubmit:e=>{e.preventDefault(),v(o)},children:[(0,H.jsx)(`button`,{type:`button`,className:Xn({small:!0}),disabled:n.at<=0,title:B(`browser.back`),"aria-label":B(`browser.back`),onClick:()=>i(n.at-1),children:(0,H.jsx)(jI,{d:`M10 3.5 5.5 8l4.5 4.5`})}),(0,H.jsx)(`button`,{type:`button`,className:Xn({small:!0}),disabled:n.at>=n.urls.length-1,title:B(`browser.forward`),"aria-label":B(`browser.forward`),onClick:()=>i(n.at+1),children:(0,H.jsx)(jI,{d:`M6 3.5 10.5 8 6 12.5`})}),(0,H.jsx)(`button`,{type:`button`,className:Xn({small:!0}),disabled:!T,title:B(`browser.reload`),"aria-label":B(`browser.reload`),onClick:()=>d(u+1),children:(0,H.jsx)(jI,{d:`M12.5 8a4.5 4.5 0 1 1-1.4-3.3M12.5 2.5v2.7H9.8`})}),(0,H.jsx)(`input`,{className:`browser-url mono ${gr}`,value:o,placeholder:B(`browser.placeholder`),"aria-label":B(`browser.address`),"aria-invalid":c,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,inputMode:`url`,onChange:e=>s(e.target.value)}),RF()&&(0,H.jsx)(U,{variant:f&&T?`iconOn`:`icon`,disabled:!T,title:B(`browser.annotate`),"aria-label":B(`browser.annotate`),"aria-pressed":f&&T,onClick:()=>p(!f),children:(0,H.jsx)(jI,{d:`M3 13l.6-2.6L10.9 3.1l2 2L5.6 12.4zM9.6 4.4l2 2`})}),a?(0,H.jsx)(`a`,{className:Xn({small:!0}),href:a,target:`_blank`,rel:`noopener noreferrer`,title:B(`browser.openTab`),"aria-label":B(`browser.openTab`),children:(0,H.jsx)(jI,{d:NI})}):(0,H.jsx)(`button`,{type:`button`,className:Xn({small:!0}),disabled:!0,"aria-label":B(`browser.openTab`),children:(0,H.jsx)(jI,{d:NI})})]}),T?(0,H.jsxs)(`div`,{ref:m,className:vr,children:[(0,H.jsx)(`iframe`,{className:_r,src:a,title:a,sandbox:`allow-scripts allow-same-origin allow-forms allow-popups`,referrerPolicy:`no-referrer`},`${a}#${u}`),f&&(0,H.jsx)(vI,{model:e,taskId:t,url:a,target:m,onClose:()=>p(!1)},`${a}#${u}`)]}):_===null&&!c?(0,H.jsx)(MI,{model:e,taskId:t,onOpen:r}):E?(0,H.jsx)(`p`,{className:pr,children:E}):null]})}var FI=`scrollbar-none flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto p-3`,II=`m-0 p-3 font-mono text-meta text-muted`,LI=`flex items-baseline justify-between gap-3 font-mono text-meta normal-nums`,RI=`flex h-1.5 w-full gap-px overflow-hidden rounded-full bg-inset`,zI=`h-full min-w-[2px] flex-none`,BI=`m-0 flex list-none flex-col p-0`,VI=`-mx-1 flex h-5.5 min-w-0 items-center gap-2 rounded-xs px-1 font-mono text-meta normal-nums`,HI=`mt-2`,UI=`size-2 flex-none rounded-full bg-line`,WI=`flex min-w-0 flex-1 items-center gap-1.5`,GI=`min-w-0 truncate text-muted`,KI=`w-[7ch] flex-none text-right text-ink`,qI=`w-[6ch] flex-none text-right text-muted`,JI=`group/fold`,YI=`${VI} cursor-pointer list-none hover:bg-hover focus-visible:outline focus-visible:outline-1 focus-visible:outline-focus [&::-webkit-details-marker]:hidden`,XI=`m-0 flex list-none flex-col p-0`,ZI=`${VI} pl-5`,QI=`flex min-w-0 flex-1 overflow-hidden`,$I=`min-w-0 truncate text-subtle`,eL=`flex-none text-muted`,tL=`w-[7ch] flex-none text-right text-muted`,nL=`w-[6ch] flex-none`,rL=1e4,iL={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)`},aL=[`var(--info)`,`var(--success)`,`var(--warning)`,`var(--merged)`];function oL({model:e,task:t,active:n}){V();let r=y(e.client.conn),i=y(e.selection),a=y(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:yE(e)})),c=()=>{d(!0),o(!0).finally(()=>a&&d(!1))};o(!1).then(c);let u=K(rL,c);return()=>{a=!1,d(!1),u()}},[e,n,r.state,t.id,s]),c.kind===`loading`)return(0,H.jsx)(`p`,{className:II,children:B(`context.loading`)});if(c.kind===`failed`)return(0,H.jsx)(`p`,{className:II,children:B(`context.failed`,{error:c.error})});if(!c.meter)return(0,H.jsx)(`p`,{className:II,children:B(`context.none`)});let p=c.meter,m=p.rows.filter(e=>e.share!==void 0),g=e=>e.share===void 0?void 0:iL[e.key]??aL[m.indexOf(e)%aL.length],_=`${p.approximate?`~`:``}${cL(p.used)}`;return(0,H.jsxs)(`div`,{className:FI,children:[(0,H.jsxs)(`div`,{className:LI,children:[(0,H.jsx)(`span`,{className:`text-ink`,children:p.percent===null?B(`context.usedTokens`,{tokens:_}):B(`context.used`,{percent:lL(p.percent)})}),p.window!==null&&(0,H.jsxs)(`span`,{className:`text-muted`,children:[_,` / `,cL(p.window)]})]}),(0,H.jsx)(`div`,{className:RI,role:`meter`,"aria-valuenow":Math.round(p.percent??100),"aria-valuemin":0,"aria-valuemax":100,children:m.map(e=>(0,H.jsx)(`span`,{className:zI,style:{width:`${e.share}%`,background:g(e)}},e.key))}),(0,H.jsx)(`ul`,{className:BI,children:p.rows.map((e,t)=>{let n=`context.part.${e.key}`,r=B(n)===n?e.label??e.key:B(n),i=g(e),a=(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:UI,style:i?{background:i}:void 0}),(0,H.jsxs)(`span`,{className:WI,children:[(0,H.jsx)(`span`,{className:GI,title:r,children:r}),e.items&&(0,H.jsx)(`span`,{className:`inline-block flex-none text-subtle group-open/fold:rotate-90`,children:`›`})]}),(0,H.jsx)(`span`,{className:KI,children:cL(e.tokens)}),(0,H.jsx)(`span`,{className:qI,children:e.deferred?`—`:lL(e.tokens/(p.window??p.used)*100)})]}),o=(e.deferred?!p.rows[t-1]?.deferred:e.share===void 0)?HI:void 0;if(!e.items)return(0,H.jsx)(`li`,{className:o,children:(0,H.jsx)(`div`,{className:VI,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,H.jsx)(`li`,{className:o,children:(0,H.jsxs)(`details`,{className:JI,children:[(0,H.jsx)(`summary`,{className:YI,children:a}),(0,H.jsxs)(`ul`,{className:XI,children:[e.items.map(e=>(0,H.jsx)(sL,{name:e.name,tokens:e.tokens},e.name)),c>0&&(0,H.jsx)(sL,{name:B(`context.more`,{count:c}),tokens:e.tokens-s})]})]})},e.key)})}),u&&m.length<2&&(0,H.jsx)(`p`,{className:`m-0 font-mono text-meta text-subtle`,children:B(`context.probing`)})]})}function sL({name:e,tokens:t}){let n=e.lastIndexOf(`/`)+1;return(0,H.jsxs)(`li`,{className:ZI,title:e,children:[(0,H.jsxs)(`span`,{className:QI,children:[n>0&&(0,H.jsx)(`span`,{className:`min-w-0 truncate text-subtle`,children:e.slice(0,n)}),(0,H.jsx)(`span`,{className:n>0?eL:$I,children:e.slice(n)})]}),(0,H.jsx)(`span`,{className:tL,children:cL(Math.max(0,t))}),(0,H.jsx)(`span`,{className:nL})]})}function cL(e){return e>=1e6?`${+(e/1e6).toFixed(1)}M`:e>=1e3?`${+(e/1e3).toFixed(1)}k`:String(e)}function lL(e){return e>0&&e<.1?`<0.1%`:`${e<10?+e.toFixed(1):Math.round(e)}%`}var uL=3;function dL({model:e,task:t}){V();let n=t.autoFixCi,r=n=>void e.client.request(`task.autoFixCi`,{taskId:t.id,enabled:n}).catch(e=>L(e instanceof Error?e.message:String(e),`error`));return(0,H.jsx)(`div`,{className:`flex items-center gap-3 px-2 pt-1 font-mono text-meta`,children:n?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:n.stopped?lp.attention:`text-muted`,title:B(`files.autoFix.hint`),children:B(n.stopped?`files.autoFix.stopped`:`files.autoFix.count`,{n:n.attempts,max:uL})}),(0,H.jsx)(U,{hit:`tight`,onClick:()=>r(!1),children:B(`files.autoFix.off`)})]}):(0,H.jsx)(U,{hit:`tight`,title:B(`files.autoFix.hint`),onClick:()=>r(!0),children:B(`files.autoFix.on`)})})}function fL(e){let t=e.pr;return!!t&&t.number!==void 0&&!e.machine&&(t.lifecycle===`open`||t.lifecycle===`ready_to_merge`)}function pL(e){let t={fail:0,pending:0,pass:0,skipped:0};for(let n of e)t[n.state]++;return t}function mL(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 hL(e,t){let{startedAt:n,completedAt:r,durationMs:i}=e;return e.state===`pending`?n?{key:`files.checks.runningFor`,vars:{elapsed:mL(t-n)}}:null:i===null?r?{key:`files.checks.finishedAgo`,vars:{age:Ml(t-r)}}:null:r?{key:`files.checks.tookAgo`,vars:{duration:mL(i),age:Ml(t-r)}}:{key:`files.checks.took`,vars:{duration:mL(i)}}}function gL(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 _L=`flex flex-col gap-0.5 px-2 pb-2 font-mono text-meta`,vL=`flex items-start gap-2`,yL=`flex min-w-0 flex-1 flex-wrap items-center gap-x-2 text-left text-ink`,bL={pass:{glyph:`✓`,tone:`success`},fail:{glyph:`✗`,tone:`attention`},pending:{glyph:`●`,tone:`warning`},skipped:{glyph:`–`,tone:`muted`}};function xL({model:e,task:t}){V();let n=t.pr,r=t.id,[i,a]=(0,h.useState)(()=>X(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&&(Gu(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:B(`files.checks.noLog`)}:{state:`note`,text:B(`files.checks.logUnavailable`,{detail:e.detail})}).catch(e=>({state:`note`,text:B(`files.checks.logUnavailable`,{detail:e instanceof Error?e.message:String(e)})})).then(e=>l(t=>n in t?{...t,[n]:e}:t))},m=(0,H.jsx)(U,{hit:`tight`,className:`flex-none whitespace-nowrap`,onClick:()=>d(e=>e+1),children:B(`files.checks.refresh`)});if(!i)return(0,H.jsx)(`div`,{className:_L,children:(0,H.jsx)(`div`,{className:vL,children:(0,H.jsxs)(`span`,{className:`flex-1 text-muted`,children:[B(`files.checks.title`),` `,B(`files.checks.loading`)]})})});if(i.outcome!==`ok`)return(0,H.jsx)(`div`,{className:_L,children:(0,H.jsxs)(`div`,{className:vL,children:[(0,H.jsx)(`span`,{className:`min-w-0 flex-1 text-muted wrap-anywhere`,children:i.outcome===`none`?B(`files.checks.none`):B(`files.checks.unavailable`,{detail:i.detail})}),m]})});let g=pL(i.checks),_=Date.now(),v=o??(g.fail>0||g.pending>0),y=gL(i);return(0,H.jsxs)(`div`,{className:_L,children:[(0,H.jsxs)(`div`,{className:vL,children:[(0,H.jsxs)(U,{variant:`row`,className:yL,"aria-expanded":v,disabled:i.total===0,onClick:()=>s(!v),children:[i.total>0&&(0,H.jsx)(ps,{right:!v}),(0,H.jsx)(`span`,{children:i.total===0?B(`files.checks.none`):B(`files.checks.summary`,{pass:g.pass+g.skipped,total:i.total})}),g.fail>0&&(0,H.jsx)(`span`,{className:lp.attention,children:B(`files.checks.failed`,{count:g.fail})}),g.pending>0&&(0,H.jsx)(`span`,{className:lp.warning,children:B(`files.checks.running`,{count:g.pending})}),y.map(e=>(0,H.jsx)(`span`,{className:lp[e.tone],children:B(e.key)},e.key))]}),m]}),v&&i.checks.map(e=>{let{glyph:t,tone:n}=bL[e.state],r=hL(e,_),i=`${e.runId}:${e.name}`,a=c[i];return(0,H.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,H.jsxs)(`div`,{className:`flex items-baseline gap-2 pl-4`,children:[(0,H.jsx)(`span`,{className:`w-[1ch] flex-none text-center ${lp[n]}`,children:t}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.name,children:e.name}),r&&(0,H.jsx)(`span`,{className:`flex-none text-subtle`,children:B(r.key,r.vars)}),e.state===`fail`&&e.runId&&(0,H.jsx)(U,{hit:`tight`,className:`flex-none whitespace-nowrap`,onClick:()=>p(e),children:B(a?`files.checks.hideLog`:`files.checks.log`)})]}),a&&(0,H.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`?B(`files.checks.loading`):a.text})]},`${e.name}:${e.url}`)}),v&&i.total>i.checks.length&&(0,H.jsx)(`span`,{className:`pl-4 text-subtle`,children:B(`files.checks.more`,{count:i.total-i.checks.length})})]})}function SL({model:e,task:t}){return fL(t)?(0,H.jsxs)(`div`,{onKeyDown:e=>e.stopPropagation(),children:[(0,H.jsx)(xL,{model:e,task:t}),(0,H.jsx)(dL,{model:e,task:t})]}):null}var CL=[`renamed`,`added`,`untracked`,`modified`,`deleted`,`conflict`],wL={U:`conflict`,D:`deleted`,M:`modified`,T:`modified`,"?":`untracked`,A:`added`,R:`renamed`,C:`renamed`},TL={conflict:`attention`,deleted:`attention`,modified:`warning`,untracked:`success`,added:`success`,renamed:`accent`},EL={conflict:`!`,deleted:`D`,modified:`M`,untracked:`U`,added:`A`,renamed:`R`};function DL(e){let t=new Map;for(let n of[`branch`,`working`])for(let r of e){let e=r.scope===n?wL[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||CL.indexOf(r)>CL.indexOf(a))&&n.set(i,r)}return n}function OL(e,t){return e.some(e=>e.scope===`working`&&e.path===t&&e.status!==`?`)}function kL(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 AL={start:`\x1B[200~`,end:`\x1B[201~`};function jL(e,t){return e.engineTarget(t).tabId??e.tabs.get()[t]?.find(e=>e.kind===`engine`)?.id}async function ML(e,t,n){let r=jL(e,t);if(!r)return L(B(`files.stripNoEngine`),`error`),!1;try{return e.selection.get().tabId!==r&&e.select(t,r),await e.client.request(`term.input`,{stream:qu(t,r),data:`${AL.start}${n}${AL.end}`}),L(B(`files.stripFilled`)),!0}catch(e){return L(e instanceof Error?e.message:String(e),`error`),!1}}function NL(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 PL(e){return[...NL(e)?[`commit`]:[],...FL(e)]}function FL(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?[]:[`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 IL(e,t,n){try{let r=await e.client.request(`task.prompt`,{taskId:t.id,kind:n});r.outcome===`unavailable`?L(B(`files.stripUnavailable`,{detail:r.detail??``}),`error`):r.outcome===`none`||!r.prompt?L(B(`files.stripNothing`),`error`):await ML(e,t.id,r.prompt)}catch(e){L(e instanceof Error?e.message:String(e),`error`)}}var LL={commit:`files.stripCommit`,createPR:`files.stripCreate`,conflicts:`files.stripConflicts`,fixCI:`files.stripFixCi`,comments:`files.stripComments`,archive:`files.stripArchive`};function RL({model:e,task:t}){let n=PL(t);return n.length===0?null:(0,H.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,H.jsx)(U,{onClick:()=>n===`archive`?void Ay(e,t):void IL(e,t,n),children:B(LL[n])},n))})}function zL({model:e,task:t,narrow:n=!1}){V();let[r,i]=(0,h.useState)(()=>X(e,`files.list`,{taskId:t.id})?.files??null),[a,o]=(0,h.useState)(()=>DL(X(e,`diff.files`,{taskId:t.id})?.files??[])),[s,c]=(0,h.useState)(null),[l,u]=(0,h.useState)(null),[d,f]=(0,h.useState)(new Set),[p,m]=(0,h.useState)(0),[g,_]=(0,h.useState)(0),v=(0,h.useRef)(null),b=y(M),x=y(e.client.conn),S=JSON.stringify(t.changes??null);(0,h.useEffect)(()=>{let n=!0;return Ku(e,`files.list`,{taskId:t.id}).then(e=>{n&&(i(e.files),c(e.root??null),u(null))},e=>n&&u(Yo(e))),()=>{n=!1}},[e,t.id,S,g,x.state]),(0,h.useEffect)(()=>{let n=!0;return Ku(e,`diff.files`,{taskId:t.id}).then(e=>n&&o(DL(e.files)),()=>{}),()=>{n=!1}},[e,t.id,S,g,x.state]);let C=r!==null,w=kL(r??[],d).map(e=>({path:e.path,label:e.name,depth:e.depth,dir:e.dir,open:e.open,state:a.get(e.path)})),T=Math.min(p,Math.max(0,w.length-1)),E=w[T],D=(e,t)=>f(n=>{let r=new Set(n);return t??!r.has(e)?r.add(e):r.delete(e),r}),O=e=>Rc(t.id,e),k=e=>Lc({taskId:t.id,path:e,scope:`working`}),A=n=>{if(!b?.startsWith(`${t.id}::`)){L(B(`files.mentionNoEngine`),`error`);return}e.client.request(`term.input`,{stream:b,data:`@${n} `}).catch(e=>L(String(e),`error`))},j=(n,r,i)=>t.machine?L(B(`files.remoteNoExternal`,{host:t.machine.label}),`error`):void e.client.request(n,{taskId:t.id,path:r}).then(()=>i&&L(i)).catch(e=>L(e instanceof Error?e.message:String(e),`error`)),N=e=>j(`file.openExternal`,e,B(`taskops.openedExternal`)),P=n=>void e.client.request(`file.openTerminal`,{taskId:t.id,path:n}).catch(e=>L(e instanceof Error?e.message:String(e),`error`)),ee=e=>{let t=e.dir?e.path.slice(0,-1):e.path;return[{label:B(`files.menu.attach`),key:`a`,run:()=>A(e.path)},{label:B(`files.menu.copy`),children:[{label:B(`files.menu.copyRelative`),run:()=>void TA(t,t)},...s?[{label:B(`files.menu.copyAbsolute`),run:()=>void TA(`${s}/${t}`,t)}]:[],{label:B(`files.menu.copyName`),run:()=>void TA(e.label,t)}]},{label:B(`files.menu.diff`),key:`d`,section:`open`,run:()=>k(e.path)},...e.dir?[]:[{label:B(`files.menu.openExternal`),key:`o`,section:`open`,run:()=>N(e.path)}],{label:B(`files.menu.reveal`),section:`open`,run:()=>j(`file.reveal`,t)},{label:B(`files.menu.terminal`),section:`terminal`,run:()=>P(t)}]};return(0,H.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:v,onKeyDown:e=>{let t=e.key;if(t===`j`||t===`ArrowDown`)m(Math.min(w.length-1,T+1));else if(t===`k`||t===`ArrowUp`)m(Math.max(0,T-1));else if((t===`l`||t===`ArrowRight`)&&E?.dir)D(E.path,!0);else if((t===`h`||t===`ArrowLeft`)&&E?.dir)D(E.path,!1);else if(t===`r`)_(e=>e+1);else if(t===`D`&&e.shiftKey)k(`.`);else if(t===`d`&&E)k(E.path);else if(t===`Enter`&&E)E.dir?D(E.path):O(E.path);else if(t===`a`&&E)A(E.path);else if(t===`o`&&E&&!E.dir)N(E.path);else return;e.preventDefault()},children:[(0,H.jsx)(RL,{model:e,task:t}),(0,H.jsx)(SL,{model:e,task:t}),(0,H.jsx)(DI,{model:e,task:t}),(0,H.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[l&&(0,H.jsx)(`p`,{className:`mono text-error`,children:l}),!l&&C&&w.length===0&&(0,H.jsx)(`p`,{className:`mx-2.5 my-3 font-mono text-meta text-subtle`,children:B(`files.emptyAll`)}),w.map((e,t)=>(0,H.jsxs)(`button`,{type:`button`,className:hi({selected:t===T,size:n?`file-narrow`:`file`}),style:{paddingLeft:8+e.depth*14},title:e.path,onContextMenu:n=>{m(t),uF(n,ee(e))},onClick:()=>{m(t),v.current?.focus(),e.dir?D(e.path):O(e.path)},children:[(0,H.jsx)(`span`,{className:bi,children:e.dir?(0,H.jsx)(ps,{right:!e.open}):null}),(0,H.jsx)(`span`,{className:`${gi} ${e.state?lp[TL[e.state]]:``}`,children:e.label}),e.state&&(0,H.jsx)(`span`,{className:`w-[1ch] flex-none text-center font-mono ${lp[TL[e.state]]}`,title:B(`files.state.${e.state}`),children:e.dir?`•`:EL[e.state]})]},e.path))]})]})}var BL={md:`md`,markdown:`md`,html:`html`,htm:`html`,svg:`svg`,png:`image`,jpg:`image`,jpeg:`image`,gif:`image`,webp:`image`,pdf:`pdf`};function VL(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<0?null:BL[t.slice(n+1).toLowerCase()]??null}function HL(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 UL=e=>new TextDecoder().decode(HL(e));function WL(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 GL=`default-src 'none'; img-src data:; style-src 'unsafe-inline'`;function KL(e){let t=`<meta http-equiv="Content-Security-Policy" content="${GL}">`,n=/^\s*<!doctype[^>]*>/i.exec(e);return n?`${n[0]}${t}${e.slice(n[0].length)}`:`${t}${e}`}var qL=/^\[([^\]\n]+)\]\((https?:\/\/[^\s)]+)\)/,JL=/^https?:\/\/[^\s<>)\]]+/,YL=/[\p{L}\p{N}]/u;function XL(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:XL(e.slice(i+2,n))}),i=n+2;continue}}else if(o===`*`||o===`_`&&!YL.test(e[i-1]??``)){let n=e.indexOf(o,i+1);if(n>i+1&&!/\s/.test(e[i+1]??` `)&&(o===`*`||!YL.test(e[n+1]??``))){r(),t.push({t:`em`,c:XL(e.slice(i+1,n))}),i=n+1;continue}}else if(o===`[`){let e=qL.exec(a);if(e){r(),t.push({t:`link`,href:e[2],c:XL(e[1])}),i+=e[0].length;continue}}else if(o===`h`&&!YL.test(e[i-1]??``)){let e=JL.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 ZL=/^\s*(```+|~~~+)\s*([\w+#.-]*)\s*$/,QL=/^(#{1,6})\s+(.*?)\s*#*\s*$/,$L=/^(\s*)([-*+])\s+(.*)$/,eR=/^(\s*)\d+[.)]\s+(.*)$/,tR=/^\s*([-*_])(\s*\1){2,}\s*$/,nR=/^\s*\|.*\|\s*$/,rR=/^\s*\|?\s*:?-{2,}:?\s*(\|\s*:?-{2,}:?\s*)*\|?\s*$/,iR=e=>e.trim().replace(/^\|/,``).replace(/\|$/,``).split(`|`).map(e=>e.trim());function aR(e){let t=e.replace(/\r\n?/g,`
66
66
  `).split(`
67
- `),n=[],r=[],i=()=>{r.length>0&&n.push({t:`para`,c:rR(r.join(`
68
- `))}),r=[]};for(let e=0;e<t.length;e++){let a=t[e],o=iR.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(`
69
- `)});continue}if(a.trim()===``){i();continue}let s=aR.exec(a);if(s){i(),n.push({t:`heading`,level:s[1].length,c:rR(s[2])});continue}if(cR.test(a)){i(),n.push({t:`hr`});continue}if(lR.test(a)){i();let r=[];for(;e<t.length&&lR.test(t[e]);e++){let n=t[e];uR.test(n)||r.push(dR(n))}e--,n.push({t:`table`,rows:r.map(e=>e.map(e=>rR(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:rR(r.join(`
70
- `))});continue}let c=oR.exec(a),l=c?null:sR.exec(a);if(c||l){i();let r=!c,a=[];for(;e<t.length;e++){let n=r?sR.exec(t[e]):oR.exec(t[e]);if(!n)break;let i=n[1].length;a.push({depth:Math.min(3,Math.floor(i/2)),c:rR(r?n[2]:n[3])})}e--,n.push({t:`list`,ordered:r,items:a});continue}r.push(a)}return i(),n}var pR=`flex min-h-0 min-w-0 flex-1 flex-col font-sans text-body`,mR=`flex flex-none flex-wrap items-center gap-x-3 gap-y-1 px-3 pb-1.5 font-mono text-meta`,hR=`min-w-0 flex-1 basis-32 py-1 text-meta`,gR=`min-h-0 flex-1 overflow-y-auto px-3 pb-3`,_R=`m-0 px-3 py-2 font-mono text-meta text-subtle`,vR=`m-0 whitespace-pre-wrap px-3 pb-3 font-mono text-meta leading-[1.45] text-muted wrap-anywhere`,yR=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`}`,bR=`mb-0.5 flex items-center gap-2 font-mono text-meta`,xR=e=>e===`user`?`text-accent`:`text-muted`,SR=`text-subtle`,CR=`ml-auto opacity-0 group-hover/entry:opacity-100 focus-visible:opacity-100 touch:opacity-100`,wR=`m-0 mt-0.5 flex min-w-0 items-baseline gap-1.5 font-mono text-meta text-subtle`,TR=`flex-none text-muted`,ER=`min-w-0 flex-1 truncate`,DR=`leading-[1.5] wrap-anywhere`,OR=`m-0 mb-2 whitespace-pre-wrap last:mb-0`,kR=`m-0 mt-3 mb-1.5 font-semibold first:mt-0`,AR=`m-0 mb-2 flex flex-col gap-0.5 pl-5 last:mb-0`,jR=`m-0 mb-2 border-l-2 border-line pl-2.5 whitespace-pre-wrap text-muted last:mb-0`,MR=`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`,NR=`rounded-xs bg-inset px-1 font-mono text-meta`,PR=`text-accent underline`,FR=`mb-2 block max-w-full overflow-x-auto border-collapse font-mono text-meta last:mb-0`,IR=`border-hairline border-line px-2 py-0.5 text-left align-top`,LR=`my-2 border-0 border-t border-line`;function RR(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,H.jsx)(`mark`,{className:ay,"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 zR=[`h3`,`h3`,`h4`,`h5`,`h6`,`h6`];function BR({level:e,children:t}){let n=zR[Math.min(5,Math.max(0,e-1))]??`h6`;return(0,H.jsx)(n,{className:kR,children:t})}function VR(e,t){return e.map((e,n)=>(0,H.jsx)(h.Fragment,{children:t(e)},n))}function HR({nodes:e,needle:t}){return VR(e,e=>e.t===`text`?RR(e.v,t):e.t===`code`?(0,H.jsx)(`code`,{className:NR,children:RR(e.v,t)}):e.t===`bold`?(0,H.jsx)(`strong`,{children:(0,H.jsx)(HR,{nodes:e.c,needle:t})}):e.t===`em`?(0,H.jsx)(`em`,{children:(0,H.jsx)(HR,{nodes:e.c,needle:t})}):(0,H.jsx)(`a`,{className:PR,href:e.href,target:`_blank`,rel:`noopener noreferrer`,children:(0,H.jsx)(HR,{nodes:e.c,needle:t})}))}function UR({block:e,needle:t}){switch(e.t){case`heading`:return(0,H.jsx)(BR,{level:e.level,children:(0,H.jsx)(HR,{nodes:e.c,needle:t})});case`para`:return(0,H.jsx)(`p`,{className:OR,children:(0,H.jsx)(HR,{nodes:e.c,needle:t})});case`code`:return(0,H.jsx)(`pre`,{className:MR,children:(0,H.jsx)(`code`,{children:RR(e.v,t)})});case`quote`:return(0,H.jsx)(`blockquote`,{className:jR,children:(0,H.jsx)(HR,{nodes:e.c,needle:t})});case`hr`:return(0,H.jsx)(`hr`,{className:LR});case`list`:{let n=e.ordered?`ol`:`ul`;return(0,H.jsx)(n,{className:`${AR} ${e.ordered?`list-decimal`:`list-disc`}`,children:VR(e.items,e=>(0,H.jsx)(`li`,{style:{marginLeft:`${e.depth*1.25}rem`},children:(0,H.jsx)(HR,{nodes:e.c,needle:t})}))})}case`table`:return(0,H.jsx)(`table`,{className:FR,children:(0,H.jsx)(`tbody`,{children:VR(e.rows,e=>(0,H.jsx)(`tr`,{children:VR(e,e=>(0,H.jsx)(`td`,{className:IR,children:(0,H.jsx)(HR,{nodes:e,needle:t})}))}))})})}}function WR({source:e,needle:t=``}){let n=(0,h.useMemo)(()=>fR(e),[e]);return(0,H.jsx)(`div`,{className:DR,children:VR(n,e=>(0,H.jsx)(UR,{block:e,needle:t}))})}function GR(e){if(e instanceof Uo){if(e.code===`TOO_LARGE`){let t=e.detail?.size;return $(B(`artifact.tooLarge`),{size:typeof t==`number`?`${(t/1048576).toFixed(1)} MB`:`5 MB+`})}if(e.code===`NOT_PREVIEWABLE`)return B(`artifact.notPreviewable`);if(e.code===`NOT_FOUND`)return B(`artifact.gone`)}return $(B(`artifact.failed`),{error:e instanceof Error?e.message:String(e)})}function KR(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:GR(e)})),()=>{r=!1}},[e,t,n,r]),i}function qR(e,t){let n=(0,h.useMemo)(()=>e===null?null:URL.createObjectURL(new Blob([YL(e)],{type:t})),[e,t]);return(0,h.useEffect)(()=>()=>void(n&&URL.revokeObjectURL(n)),[n]),n}function JR({model:e,taskId:t,path:n,kind:r,changeKey:i}){V();let a=KR(e,t,n,i),o=qR(a.kind===`ready`&&(r===`svg`||r===`image`||r===`pdf`)?a.file.base64:null,r===`md`||r===`html`?``:ZL(r,n));return a.kind===`loading`?(0,H.jsx)(`p`,{className:wr,children:B(`artifact.loading`)}):a.kind===`failed`?(0,H.jsx)(`p`,{className:`${wr} text-error`,children:a.text}):r===`md`?(0,H.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto px-3 py-2`,children:(0,H.jsx)(WR,{source:XL(a.file.base64)})}):r===`html`?(0,H.jsx)(`iframe`,{title:n,sandbox:``,srcDoc:$L(XL(a.file.base64)),style:{colorScheme:`light`,background:`#fff`},className:`min-h-0 w-full flex-1 border-none`}):o?r===`pdf`?(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,H.jsx)(`a`,{className:`${Ar} px-3 py-1 font-mono text-meta`,href:o,target:`_blank`,rel:`noreferrer noopener`,children:B(`artifact.open`)}),(0,H.jsx)(`iframe`,{title:n,src:o,className:`min-h-0 w-full flex-1 border-none`})]}):(0,H.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-3`,children:(0,H.jsx)(`img`,{src:o,alt:n,className:`max-w-full`})}):null}function YR(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,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(`input`,{className:Mr,"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,H.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,H.jsx)(`li`,{ref:n===i?a:void 0,children:(0,H.jsxs)(`button`,{type:`button`,tabIndex:-1,"aria-pressed":n===i,className:kr({cursor:n===i,accent:!!t.accent}),onMouseDown:t=>{t.preventDefault(),e.onPick(n)},children:[(0,H.jsx)(`span`,{children:t.text}),t.dim&&(0,H.jsxs)(`span`,{className:`text-muted`,children:[` `,t.dim]})]})},t.key))})]})}function XR(e,t,n){let r=[{ref:null,suggestion:{key:`default`,text:t,dim:B(`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??[],B(`review.baseBranch`)),i(e?.remotes??[],B(`review.baseRemote`)),i(e?.tags??[],B(`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 ZR(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 Ku(s,`diff.refs`,{taskId:e.taskId}).then(e=>n&&o(e),()=>{}),()=>{n=!1}},[t,s,e.taskId]);let c=XR(a,e.base,r),l=t=>{e.onPick(t),n(!1),i(``)},u=e.custom??e.base,d=[{id:`task`,label:B(`review.scopeTask`)},{id:`working`,label:B(`review.scopeWorking`)},{id:`branch`,label:B(`review.scopeBranch`)}],f=d.find(t=>t.id===e.scope)?.label??``;return(0,H.jsxs)(`span`,{className:`relative`,onKeyDown:e=>{e.stopPropagation(),e.key===`Escape`&&t&&n(!1)},children:[(0,H.jsx)(U,{hit:`tight`,"aria-expanded":t,"aria-haspopup":`menu`,onClick:t=>{let r=t.currentTarget.getBoundingClientRect();S.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:B(`review.compareAgainst`,{base:u}),section:`base`,run:()=>n(!0)}]})},children:B(`review.scopeMenu`,{base:u,scope:f})}),t&&(0,H.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,H.jsx)(YR,{field:`diff-base`,autoFocus:!0,value:r,onChange:i,items:c.map(e=>e.suggestion),open:!0,placeholder:B(`review.basePlaceholder`),onPick:e=>l(c[e]?.ref??null),onEnter:()=>l(r.trim()===``?null:r.trim())})})]})}var QR=`rove.diffBase`;function $R(){try{let e=JSON.parse(localStorage.getItem(QR)??`{}`);return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`string`))}catch{return{}}}function ez(e){return $R()[e]??null}function tz(e,t){let n=$R();t===null?delete n[e]:n[e]=t;try{localStorage.setItem(QR,JSON.stringify(n))}catch{}}function nz(e){let[t,n]=(0,h.useState)(()=>ez(e.taskId));return[t,t=>{tz(e.taskId,t),n(t),t!==null&&e.scope!==`task`&&Lc({taskId:e.taskId,path:e.path,scope:`task`})}]}var rz={add:`bg-diff-added-bg`,del:`bg-diff-removed-bg`},iz={add:`text-diff-added`,del:`text-diff-removed`};function az(e,t){let n=t.cursor?`bg-inset group-focus/preview:bg-accent-soft`:t.noted?`bg-inset`:rz[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 oz=`text-right text-subtle`,sz=`${oz} group-data-file/preview:hidden`,cz=(e,t,n=!1)=>t?`text-accent`:n?`text-diff-added`:iz[e]??``,lz=e=>`min-w-0 whitespace-pre-wrap wrap-anywhere ${iz[e]??``}`,uz=`min-w-0 whitespace-pre-wrap wrap-anywhere text-accent`,dz=`col-span-3 flex min-w-0 items-baseline gap-2 overflow-hidden`,fz=(0,h.memo)(function(e){return(0,H.jsxs)(`div`,{className:`flex items-center ${e.viewed?`opacity-60`:``}`,children:[(0,H.jsxs)(U,{variant:`row`,"data-row":e.index,"aria-expanded":!e.closed,"aria-label":B(e.closed?`review.unfold`:`review.fold`,{path:e.name}),className:`${az(`file`,{cursor:e.cursor,noted:!1})} min-w-0 flex-1 text-left`,onClick:()=>e.onToggleFold(e.index,e.path),children:[(0,H.jsx)(`span`,{className:`grid place-items-center text-subtle`,children:(0,H.jsx)(ps,{right:e.closed})}),(0,H.jsxs)(`span`,{className:dz,children:[(0,H.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name}),e.added?(0,H.jsxs)(jE,{tone:`added`,children:[`+`,e.added]}):null,e.removed?(0,H.jsxs)(jE,{tone:`removed`,children:[`−`,e.removed]}):null]})]}),e.path!==null&&(0,H.jsx)(U,{hit:`tight`,className:`flex-none px-2`,"aria-pressed":e.viewed,"aria-label":B(e.viewed?`review.unmarkViewed`:`review.markViewed`,{path:e.name}),onClick:()=>e.path!==null&&e.onToggleViewed(e.path),children:e.viewed?B(`review.viewedOn`):B(`review.viewed`)})]})});function pz(e){return(0,H.jsxs)(`div`,{className:`absolute top-full right-3 z-1 flex gap-1.5`,children:[(0,H.jsx)(U,{variant:`floating`,onMouseDown:e=>e.preventDefault(),onClick:t=>{t.stopPropagation(),e.onComment()},children:B(`review.comment`)}),e.showRange&&(0,H.jsx)(U,{variant:`floating`,onClick:t=>{t.stopPropagation(),e.onRange()},children:B(`review.range`)}),e.ranged&&(0,H.jsx)(U,{variant:`floating`,title:B(`preview.askInChatHint`),onMouseDown:e=>e.preventDefault(),onClick:t=>{t.stopPropagation(),e.onAsk()},children:B(`preview.askInChat`)})]})}function mz({note:e,onEdit:t}){return(0,H.jsxs)(U,{variant:`row`,className:`${az(`note`,{cursor:!1,noted:!1})} w-full text-left`,onClick:t,children:[(0,H.jsx)(`span`,{className:sz}),(0,H.jsx)(`span`,{}),(0,H.jsx)(`span`,{className:`text-accent`,children:`●`}),(0,H.jsx)(`span`,{className:uz,children:e.body})]})}function hz(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 gz=2e3,_z=(0,h.memo)(function(e){let{index:t,row:n,noted:r}=e;return(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{"data-row":t,className:az(n.kind,{cursor:e.cursor,noted:r}),onClick:n=>e.onClick(t,n),children:[(0,H.jsx)(`span`,{className:sz,children:n.oldNo??``}),(0,H.jsx)(`span`,{className:oz,children:n.newNo??``}),(0,H.jsx)(`span`,{className:cz(n.kind,r,e.changed),children:n.kind===`add`?`+`:n.kind===`del`?`−`:r?`●`:e.changed?`▎`:` `}),(0,H.jsxs)(`span`,{className:lz(n.kind),children:[n.text.length>gz?n.text.slice(0,gz):n.text,n.text.length>gz&&(0,H.jsxs)(`span`,{className:`text-subtle`,children:[` `,B(`review.lineClipped`,{count:(n.text.length-gz).toLocaleString()})]})]}),e.actions]}),e.notes?.map(t=>t.id===e.editId?(0,H.jsx)(h.Fragment,{children:e.composer},t.id):(0,H.jsx)(mz,{note:t,onEdit:()=>e.onEditNote(t)},t.id)),e.editId===void 0&&e.composer]})});function vz(e){return(0,H.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,H.jsx)(U,{hit:`tight`,"aria-pressed":e.ignoreWs,title:B(`review.ignoreWsHint`),className:`opacity-60 aria-pressed:underline aria-pressed:opacity-100`,onClick:e.onToggleWs,children:B(`review.ignoreWs`)}),(0,H.jsxs)(`span`,{className:`flex min-w-0 basis-full flex-wrap items-center gap-x-1.5 text-muted`,children:[B(`review.totals`,{files:e.files,added:e.added,removed:e.removed}),e.shape&&(0,H.jsxs)(`span`,{children:[`· `,e.shape]}),e.files>0&&(0,H.jsxs)(`span`,{className:`whitespace-nowrap`,children:[`· `,B(`review.viewedCount`,{done:e.viewed,files:e.files})]})]}),(0,H.jsxs)(`span`,{className:`ml-auto flex items-center gap-x-3`,children:[e.files>1&&(0,H.jsx)(U,{hit:`tight`,onClick:e.onNextFile,children:B(`review.nextFile`)}),e.onNextComment&&(0,H.jsx)(U,{hit:`tight`,onClick:e.onNextComment,children:B(`review.nextComment`)}),e.files>1&&(0,H.jsx)(U,{hit:`tight`,onClick:e.onFoldAll,children:e.allFolded?B(`review.unfoldAll`):B(`review.foldAll`)})]})]})}var yz=`rove.diffViewed`,bz=(e,t)=>`${e}\0${t}`,xz=4096;function Sz(e){let t=2166136261;for(let n of e){let e=n.text.length>xz?`${n.text.slice(0,xz/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 Cz(e){let t=new Map,n=-1,r=r=>{let i=n>=0?e[n]?.path:null;i&&t.set(i,Sz(e.slice(n+1,r)))};return e.forEach((e,t)=>{e.kind===`file`&&(r(t),n=t)}),r(e.length),t}function wz(){try{let e=JSON.parse(localStorage.getItem(yz)??`{}`);return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`string`))}catch{return{}}}function Tz(e){try{localStorage.setItem(yz,JSON.stringify(e))}catch{}}function Ez(e,t,n){let r=new Set;for(let[i,a]of n)e[bz(t,i)]===a&&r.add(i);return r}function Dz(e,t,n,r){let i={...e};return r===void 0?delete i[bz(t,n)]:i[bz(t,n)]=r,i}function Oz(e,t){return e.find(e=>e>t)??e[0]??null}var kz=`rove.diffIgnoreWs`;function Az(){try{return localStorage.getItem(kz)===`1`}catch{return!1}}function jz(e){try{localStorage.setItem(kz,e?`1`:`0`)}catch{}}var Mz=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/;function Nz(e,t=null,n=!1){let r=[],i=0,a=0,o=t,s=!1;for(let t of e.replace(/\n$/,``).split(`
71
- `)){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=Mz.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 Pz(e,t){return e.replace(/\n$/,``).split(`
72
- `).map((e,n)=>({kind:`ctx`,text:e,oldNo:null,newNo:n+1,path:t}))}function Fz(e){return e.kind===`del`?e.foreignOld?null:e.oldNo:e.kind===`add`||e.kind===`ctx`?e.newNo:null}function Iz(e){let t=e.startLine?`lines ${e.startLine}-${e.line}`:`line ${e.line}`;return`@${e.path} (${t}) `}function Lz(e,t,n){let r=e[t],i=r?Fz(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?Fz(a):null,c=o?Fz(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 Rz(e,t,n){let r=Lz(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 zz(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 Bz(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 Vz(e){return(0,H.jsx)(`div`,{className:`flex flex-none items-center gap-3 px-2 pt-1.5 font-mono text-meta`,children:(0,H.jsx)(U,{hit:`tight`,onClick:()=>e.file?Lc({taskId:e.taskId,path:e.path,scope:`working`}):Rc(e.taskId,e.path),children:B(e.file?`preview.modeDiff`:`preview.modeFile`)})})}function Hz(e,t,n,r,i){let[a,o]=(0,h.useState)(null);return(0,h.useEffect)(()=>{if(!r)return;let i=!0;return Ku(e,`diff.file`,{taskId:t,path:n,scope:`working`}).then(e=>{if(!i)return;let t=e.kind===`diff`&&typeof e.text==`string`?Nz(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 Uz=[`source`,`tests`,`config`,`docs`,`generated`],Wz=/(^|\/)(bun\.lockb?|package-lock\.json|yarn\.lock|pnpm-lock\.yaml|Cargo\.lock|poetry\.lock|uv\.lock|Gemfile\.lock|go\.sum|composer\.lock)$/,Gz=/(^|\/)(dist|build|generated|__generated__|\.next)\/|\.min\.(js|css)$|\.snap$|\.generated\.|\.pb\.go$|\.map$/,Kz=/(^|\/)(tests?|__tests__|spec|e2e)\/|\.(test|spec)\.[cm]?[jt]sx?$|_test\.(go|py)$|(^|\/)test_[^/]+\.py$/,qz=/\.(md|mdx|rst|txt)$|(^|\/)docs\//i,Jz=/(^|\/)(\.[\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)\//,Yz=e=>Wz.test(e);function Xz(e){return Wz.test(e)||Gz.test(e)?`generated`:Kz.test(e)?`tests`:qz.test(e)?`docs`:Jz.test(e)?`config`:`source`}var Zz=e=>Xz(e)===`generated`;function Qz(e){let t=e.filter(e=>Xz(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 $z(e){let t=[],n=(e,n)=>n>0&&t.push({group:e,count:n});for(let t of Uz)t===`generated`?(n(`lockfile`,e.filter(Yz).length),n(`generated`,e.filter(e=>Xz(e)===`generated`&&!Yz(e)).length)):n(t,e.filter(e=>Xz(e)===t).length);return t}function eB(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=>Uz.indexOf(Xz(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 tB(e){return $z(e.map(e=>e.path)).map(({group:e,count:t})=>({key:e===`lockfile`?t===1?`lockfile`:`lockfiles`:e,count:t}))}function nB(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?``:[B(`review.shape.effort`,{n:Qz(n)}),...tB(n).map(e=>B(`review.shape.${e.key}`,{count:e.count}))].join(` · `)}function rB(e,t,n){if(!e||typeof e!=`object`||!(`kind`in e))return{kind:`text`,text:B(`preview.unknown`)};let r=`text`in e&&typeof e.text==`string`?e.text:``;switch(e.kind){case`diff`:{let e=Nz(r,t===`.`?null:t,n);return{kind:`rows`,rows:t===`.`?eB(e):e,diff:!0}}case`code`:return{kind:`rows`,rows:Pz(r,t),diff:!1};case`binary`:return{kind:`text`,text:B(`preview.binary`)};case`empty`:return{kind:`text`,text:B(`preview.empty`)};case`error`:return{kind:`text`,text:`message`in e?String(e.message):B(`preview.unknown`),error:!0};default:return{kind:`text`,text:B(`preview.noHunks`,{kind:String(e.kind)})}}}function iB(e){return e instanceof Uo&&e.code===`UNKNOWN_OP`?Error(B(`review.notSupported`)):e instanceof Error?e:Error(String(e))}function aB(e,t){let n=e.tasks.get()?.tasks.find(e=>e.id===t);return n?.workspace?`${n.machine?.id??``}:${n.workspace}`:t}var oB={add:`+`,del:`-`},sB=40,cB=160,lB=e=>`${oB[e.kind]??` `}${e.text.slice(0,cB)}`,uB=e=>e.startLine!==void 0&&e.startLine!==e.line?`${e.filePath}:${e.startLine}-${e.line}`:`${e.filePath}:${e.line}`;function dB(e,t,n){let r=[];for(let i=t;i<=n&&r.length<sB;i++){let t=e[i];t&&Fz(t)!==null&&r.push(lB(t))}return r.join(`
73
- `)}function fB(e,t){let n=e.startLine??e.line,r=t.flatMap((t,n)=>t.path===e.filePath&&Fz(t)!==null?[n]:[]);if(!e.code){let i=r.filter(r=>{let i=Fz(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(`
74
- `);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&&Fz(t[o])===n&&a.every((e,n)=>lB(t[e])===i[n]))return{first:o,last:s}}return null}function pB(e,t,n){return fB(e,t)?`ok`:t.some(t=>t.path===e.filePath)||n?`moved`:`unknown`}function mB(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:dB(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 iB(e)});e.onSaved(t.kind===`add`),r()}};return{node:t&&(0,H.jsx)(hB,{location:t.kind===`add`?uB({filePath:t.target.path,startLine:t.target.startLine,line:t.target.line}):uB(t.note),...t.kind===`edit`?{initial:t.note.body}:{},onSubmit:i,onCancel:r}),row:t?t.kind===`add`?t.target.last:fB(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 hB(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,H.jsxs)(`div`,{className:az(`note`,{cursor:!1,noted:!1}),onKeyDown:e=>e.stopPropagation(),onMouseUp:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:[(0,H.jsx)(`span`,{className:sz}),(0,H.jsx)(`span`,{}),(0,H.jsx)(`span`,{className:`text-accent`,children:`●`}),(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5 whitespace-normal`,children:[(0,H.jsx)(`textarea`,{className:`${Mr} ${Ir} font-mono`,"aria-label":B(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,H.jsx)(`p`,{className:`m-0 text-error`,children:a}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(U,{hit:`tight`,disabled:r||!c,onClick:()=>void l(),children:B(s?`review.noteSave`:`review.noteAdd`)}),(0,H.jsx)(U,{hit:`tight`,className:`text-muted`,disabled:r,onClick:e.onCancel,children:B(`review.noteCancel`)})]})]})]})}function gB({notes:e,states:t,sending:n,onShow:r,onEdit:i,onDrop:a,onSend:o}){V();let[s,c]=(0,h.useState)(!1);if(e.length===0)return null;let l=e.length;return(0,H.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,H.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-1.5 narrow:px-2`,children:[(0,H.jsxs)(U,{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,H.jsx)(ps,{right:!s}),(0,H.jsx)(`span`,{children:l===1?B(`review.countOne`):B(`review.count`,{count:l})})]}),(0,H.jsx)(U,{disabled:n,onClick:o,children:n?B(`review.sending`):B(`review.send`,{count:l})})]}),s&&(0,H.jsx)(`ul`,{className:`m-0 min-h-0 list-none overflow-y-auto p-0 pb-1`,children:e.map(e=>(0,H.jsxs)(`li`,{className:`flex flex-col gap-0.5 px-3 py-1 narrow:px-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,H.jsx)(U,{variant:`row`,className:`min-w-0 flex-1 truncate text-left text-ink hover:underline`,title:B(`review.show`),onClick:()=>r(e),children:uB(e)}),t.get(e.id)===`moved`&&(0,H.jsx)(`span`,{title:B(`review.movedHint`),children:(0,H.jsx)(jE,{tone:`warning`,children:B(`review.moved`)})}),(0,H.jsx)(U,{hit:`tight`,onClick:()=>i(e),children:B(`review.edit`)}),(0,H.jsx)(U,{hit:`tight`,onClick:()=>a(e),children:B(`review.drop`)})]}),(0,H.jsx)(`p`,{className:`m-0 line-clamp-2 whitespace-pre-wrap wrap-anywhere text-muted`,children:e.body})]},e.id))})]})}var _B=[];function vB({model:e,view:t,active:n,restored:r,onClose:i}){V();let a=lu(),[o,s]=(0,h.useState)(Az),[c,l]=(0,h.useState)(wz),[u,d]=nz(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}:{}},_=aB(e,t.taskId),v={...g,taskId:_},[b,x]=(0,h.useState)(()=>{let n=X(e,`diff.file`,v);return n===void 0?null:rB(n,t.path,p)}),[S,C]=(0,h.useState)(()=>X(e,`review.list`,{taskId:t.taskId})?.notes??[]),[w,T]=(0,h.useState)(()=>X(e,`diff.files`,{taskId:_})),[E,D]=(0,h.useState)(0),[O,k]=(0,h.useState)(null),[A,j]=(0,h.useState)(!1),[N,P]=(0,h.useState)(new Map),[ee,F]=(0,h.useState)(!1),[I,te]=(0,h.useState)(0),ne=(0,h.useRef)(null),re=e.client,ie=y(re.conn).state;(0,h.useEffect)(()=>{let e=!0;return re.request(`diff.file`,g).then(n=>e&&x(rB(Gu(re,`diff.file`,v,n),t.path,p)),t=>{if(e){if(f&&t instanceof Uo&&t.code===`BAD_REF`){d(null),L(t.message,`error`);return}x({kind:`text`,text:Yo(t),error:!0})}}),()=>{e=!1}},[re,t.taskId,t.path,t.scope,o,f,I,ie]),(0,h.useEffect)(()=>{let e=!0;return re.request(`diff.files`,{taskId:t.taskId}).then(t=>e&&T(Gu(re,`diff.files`,{taskId:_},t)),()=>{}),()=>{e=!1}},[re,t.taskId,I]);let ae=()=>void Ku(re,`review.list`,{taskId:t.taskId}).then(e=>C(e.notes));(0,h.useEffect)(ae,[re,t.taskId,I]);let oe=(0,h.useRef)(!1);(0,h.useEffect)(()=>{n&&(oe.current||!r)&&ne.current?.focus(),oe.current=!0},[n,r]);let R=b?.kind===`rows`?b.rows:_B,z=b?.kind===`rows`&&b.diff,se=w?.base??null,ce=t.path!==`.`&&t.scope===`working`&&FL(w?.files??[],t.path),le=Hz(re,t.taskId,t.path,m&&ce&&!z,I),ue=(0,h.useMemo)(()=>R.map((e,t)=>`row-${t}`),[R]),de=(0,h.useMemo)(()=>Bz(R),[R]),fe=(0,h.useMemo)(()=>Cz(R),[R]),pe=(0,h.useMemo)(()=>Ez(c,t.taskId,fe),[c,t.taskId,fe]),me=(0,h.useMemo)(()=>{let e=new Set;for(let t of fe.keys())(N.get(t)??(Zz(t)||pe.has(t)))&&e.add(t);return e},[fe,pe,N]),he=(e,t)=>P(n=>{let r=new Map(n);for(let n of e)r.set(n,t);return r}),ge=(0,h.useMemo)(()=>zz(R,me),[R,me]),_e=(0,h.useMemo)(()=>S.filter(e=>e.sentAt===void 0),[S]),ve=(0,h.useMemo)(()=>_e.map(e=>({note:e,at:fB(e,R)})),[_e,R]),ye=(0,h.useMemo)(()=>{let e=new Set;for(let{at:t}of ve)if(t)for(let n=t.first;n<=t.last;n++)e.add(n);return e},[ve]),be=(0,h.useMemo)(()=>{let e=new Map;for(let{note:t,at:n}of ve)n&&e.set(n.last,[...e.get(n.last)??[],t]);return e},[ve]),xe=t.path===`.`&&b!==null&&!(b.kind===`text`&&b.error),Se=(0,h.useMemo)(()=>{let e=new Map;for(let{note:t}of ve)e.set(t.id,pB(t,R,xe));return e},[ve,R,xe]);(0,h.useEffect)(()=>{if(ge.includes(E))return;let e=E;for(;e>0&&R[e]?.kind!==`file`;)e--;D(e),k(null)},[ge,E,R]);let Ce=(0,h.useRef)(!1);(0,h.useEffect)(()=>{if(!Ce.current){Ce.current=!0;return}ne.current?.querySelector(`[data-row="${E}"]`)?.scrollIntoView({block:`nearest`})},[E]);let we=Rz(R,E,O),Te=e=>he([e],!me.has(e)),Ee=[...de.keys()].flatMap(e=>R[e]?.path?[R[e]?.path]:[]),De=(0,h.useMemo)(()=>nB(de,R),[de,R]),Oe=Ee.length>0&&Ee.every(e=>me.has(e)),ke=[...de.values()].reduce((e,t)=>({added:e.added+t.added,removed:e.removed+t.removed}),{added:0,removed:0}),Ae=e=>{let n=Dz(c,t.taskId,e,pe.has(e)?void 0:fe.get(e));l(n),Tz(n),P(t=>{let n=new Map(t);return n.delete(e),n})},je=()=>{jz(!o),s(!o)},Me=mB({client:re,taskId:t.taskId,rows:R,target:we,onSaved:e=>{e&&(k(null),j(!1)),ae()},focusView:()=>ne.current?.focus()}),Ne=e=>{Le(e),(t.path===`.`||t.path===e.filePath)&&Me.edit(e)},Pe=e=>void re.request(`review.remove`,{taskId:t.taskId,id:e.id}).then(ae).catch(e=>L(iB(e).message,`error`)),Fe=y(M),Ie=()=>{let e=Lz(R,E,O);if(e){if(!Fe?.startsWith(`${t.taskId}::`)){L(B(`files.mentionNoEngine`),`error`);return}re.request(`term.input`,{stream:Fe,data:Iz(e)}).then(()=>{k(null),Po(Fe)?.focus()}).catch(e=>L(e instanceof Error?e.message:String(e),`error`))}},Le=e=>{let n=fB(e,R),r=R.findIndex(t=>t.kind===`file`&&t.path===e.filePath);n?(he([e.filePath],!1),D(n.first)):t.path===`.`&&r>=0?D(r):t.path!==e.filePath&&t.path!==`.`&&Lc({taskId:t.taskId,path:e.filePath,scope:t.scope}),k(null),j(!1)},Re=()=>{F(!0),re.request(`review.send`,e.engineTarget(t.taskId)).then(e=>{L(e.delivered?B(`preview.sent`,{count:e.sent}):B(`preview.notSent`,{reason:e.reason??``}),e.delivered?`info`:`error`),ae()}).catch(e=>L(e instanceof Error?e.message:String(e),`error`)).finally(()=>F(!1))},ze=()=>{let e=Oz([...de.keys()],E);e!==null&&(D(e),k(null),j(!1))},Be=()=>{let e=Oz(ve.flatMap(({at:e})=>e?[e.first]:[]).sort((e,t)=>e-t),E);if(e===null)return;let t=R[e]?.path;t&&he([t],!1),D(e),k(null),j(!1)},Ve=e=>D(t=>{let n=Math.max(0,ge.indexOf(t));return ge[Math.min(ge.length-1,Math.max(0,n+e))]??t}),He=e=>{let t=e.key;if(t===`j`||t===`ArrowDown`)Ve(1);else if(t===`k`||t===`ArrowUp`)Ve(-1);else if(t===`v`)k(e=>e===null?E:null),j(!0);else if(t===`c`&&!e.ctrlKey)Me.add();else if(t===`x`){let e=ve.find(({at:e})=>e&&E>=e.first&&E<=e.last);e&&Pe(e.note)}else if(t===`s`)Re();else if(t===`z`){let e=R[E]?.path;e&&z&&Te(e)}else if(t===`r`)te(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()},Ue=()=>{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)),j(!0))},We=hz({rowClick:(e,t)=>{window.getSelection()?.isCollapsed!==!1&&(t.shiftKey?k(e=>e??E):(!a||O===null)&&k(null),D(e),j(!0))},fileClick:(e,t)=>{D(e),k(null),j(!1),t&&Te(t)},viewedClick:Ae,editNote:Ne}),Ge=O===null?E:Math.min(O,E),Ke=O===null?E:Math.max(O,E);return(0,H.jsxs)(`div`,{className:`group/preview @container/preview flex min-h-0 min-w-0 flex-1 flex-col outline-none`,"data-file":m&&!z?``:void 0,tabIndex:0,ref:ne,onKeyDown:He,children:[ce&&(0,H.jsx)(Vz,{taskId:t.taskId,path:t.path,file:m}),z&&(0,H.jsx)(vz,{picker:se!==null&&(0,H.jsx)(ZR,{taskId:t.taskId,model:e,scope:t.scope,onScope:e=>Lc({taskId:t.taskId,path:t.path,scope:e}),base:se,custom:u,onPick:d}),ignoreWs:o,onToggleWs:je,files:Ee.length,shape:De,added:ke.added,removed:ke.removed,viewed:pe.size,allFolded:Oe,onFoldAll:()=>he(Ee,!Oe),onNextFile:ze,onNextComment:ve.some(({at:e})=>e)?Be:null}),(0,H.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto py-1.5 font-mono text-meta/normal`,onMouseUp:Ue,children:[!b&&(0,H.jsx)(`p`,{className:`mx-2.5 my-3 font-mono text-meta text-subtle`,children:B(`preview.loading`)}),b?.kind===`text`&&(0,H.jsx)(`p`,{className:`mx-2.5 my-3 font-mono text-meta text-subtle ${b.error?`text-error`:``}`,children:b.text}),ge.map(e=>{let t=R[e],n=e>=Ge&&e<=Ke;if(t.kind===`file`){let r=de.get(e),i=t.path;return(0,H.jsx)(fz,{index:e,name:t.text,path:i,closed:i!==null&&me.has(i),viewed:i!==null&&pe.has(i),cursor:n,added:r?.added??0,removed:r?.removed??0,onToggleFold:We.fileClick,onToggleViewed:We.viewedClick},ue[e])}return(0,H.jsx)(_z,{index:e,row:t,cursor:n,noted:ye.has(e),actions:A&&we&&!Me.node&&e===Ke&&(0,H.jsx)(pz,{showRange:a&&O===null,ranged:O!==null,onComment:Me.add,onRange:()=>k(E),onAsk:Ie}),notes:be.get(e),changed:t.newNo!==null&&le?.has(t.newNo)===!0,composer:e===Me.row?Me.node:void 0,editId:e===Me.row?Me.editId:void 0,onClick:We.rowClick,onEditNote:We.editNote},ue[e])}),Me.row===-1&&Me.node]}),(0,H.jsx)(gB,{notes:_e,states:Se,sending:ee,onShow:Le,onEdit:Ne,onDrop:Pe,onSend:Re})]})}function yB(e){V();let{model:t,view:n}=e,r=n.path===`.`?null:JL(n.path),[i,a]=(0,h.useState)(null),o=y(t.tasks);if(!r)return(0,H.jsx)(vB,{...e});let s=i===n.path,c=JSON.stringify(o?.tasks.find(e=>e.id===n.taskId)?.changes??null);return(0,H.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,H.jsxs)(`div`,{className:`flex gap-x-3 px-2.5 py-1`,children:[(0,H.jsx)(U,{variant:`pill`,hit:`tight`,"aria-current":!s,onClick:()=>a(null),children:`[ ${B(`artifact.preview`)} ]`}),(0,H.jsx)(U,{variant:`pill`,hit:`tight`,"aria-current":s,onClick:()=>a(n.path),children:`[ ${B(`artifact.source`)} ]`})]}),s?(0,H.jsx)(vB,{...e}):(0,H.jsx)(JR,{model:t,taskId:n.taskId,path:n.path,kind:r,changeKey:c})]})}var bB={entries:[],failed:new Set},xB=[`command`,`cmd`,`file_path`,`path`,`pattern`,`query`,`url`,`description`,`prompt`],SB=100;function CB(e){let t=(e.split(`
75
- `).find(e=>e.trim()!==``)??``).trim();return t.length>SB?`${t.slice(0,99)}…`:t}function wB(e){if(typeof e==`string`)return CB(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 xB){let r=n(t[e]);if(r.trim())return CB(r)}for(let e of Object.values(t)){let t=n(e);if(t.trim())return CB(t)}return``}function TB(e){return e===`user`||e===`assistant`||e===`system`?e:null}function EB(e,t){let n=[],r=[];return e.forEach((e,i)=>{let a=TB(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:wB(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(`
67
+ `),n=[],r=[],i=()=>{r.length>0&&n.push({t:`para`,c:XL(r.join(`
68
+ `))}),r=[]};for(let e=0;e<t.length;e++){let a=t[e],o=ZL.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(`
69
+ `)});continue}if(a.trim()===``){i();continue}let s=QL.exec(a);if(s){i(),n.push({t:`heading`,level:s[1].length,c:XL(s[2])});continue}if(tR.test(a)){i(),n.push({t:`hr`});continue}if(nR.test(a)){i();let r=[];for(;e<t.length&&nR.test(t[e]);e++){let n=t[e];rR.test(n)||r.push(iR(n))}e--,n.push({t:`table`,rows:r.map(e=>e.map(e=>XL(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:XL(r.join(`
70
+ `))});continue}let c=$L.exec(a),l=c?null:eR.exec(a);if(c||l){i();let r=!c,a=[];for(;e<t.length;e++){let n=r?eR.exec(t[e]):$L.exec(t[e]);if(!n)break;let i=n[1].length;a.push({depth:Math.min(3,Math.floor(i/2)),c:XL(r?n[2]:n[3])})}e--,n.push({t:`list`,ordered:r,items:a});continue}r.push(a)}return i(),n}var oR=`flex min-h-0 min-w-0 flex-1 flex-col font-sans text-body`,sR=`flex flex-none flex-wrap items-center gap-x-3 gap-y-1 px-3 pb-1.5 font-mono text-meta`,cR=`min-w-0 flex-1 basis-32 py-1 text-meta`,lR=`min-h-0 flex-1 overflow-y-auto px-3 pb-3`,uR=`m-0 px-3 py-2 font-mono text-meta text-subtle`,dR=`m-0 whitespace-pre-wrap px-3 pb-3 font-mono text-meta leading-[1.45] text-muted wrap-anywhere`,fR=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`}`,pR=`mb-0.5 flex items-center gap-2 font-mono text-meta`,mR=e=>e===`user`?`text-accent`:`text-muted`,hR=`text-subtle`,gR=`ml-auto opacity-0 group-hover/entry:opacity-100 focus-visible:opacity-100 touch:opacity-100`,_R=`m-0 mt-0.5 flex min-w-0 items-baseline gap-1.5 font-mono text-meta text-subtle`,vR=`flex-none text-muted`,yR=`min-w-0 flex-1 truncate`,bR=`leading-[1.5] wrap-anywhere`,xR=`m-0 mb-2 whitespace-pre-wrap last:mb-0`,SR=`m-0 mt-3 mb-1.5 font-semibold first:mt-0`,CR=`m-0 mb-2 flex flex-col gap-0.5 pl-5 last:mb-0`,wR=`m-0 mb-2 border-l-2 border-line pl-2.5 whitespace-pre-wrap text-muted last:mb-0`,TR=`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`,ER=`rounded-xs bg-inset px-1 font-mono text-meta`,DR=`text-accent underline`,OR=`mb-2 block max-w-full overflow-x-auto border-collapse font-mono text-meta last:mb-0`,kR=`border-hairline border-line px-2 py-0.5 text-left align-top`,AR=`my-2 border-0 border-t border-line`;function jR(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,H.jsx)(`mark`,{className:iy,"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 MR=[`h3`,`h3`,`h4`,`h5`,`h6`,`h6`];function NR({level:e,children:t}){let n=MR[Math.min(5,Math.max(0,e-1))]??`h6`;return(0,H.jsx)(n,{className:SR,children:t})}function PR(e,t){return e.map((e,n)=>(0,H.jsx)(h.Fragment,{children:t(e)},n))}function FR({nodes:e,needle:t}){return PR(e,e=>e.t===`text`?jR(e.v,t):e.t===`code`?(0,H.jsx)(`code`,{className:ER,children:jR(e.v,t)}):e.t===`bold`?(0,H.jsx)(`strong`,{children:(0,H.jsx)(FR,{nodes:e.c,needle:t})}):e.t===`em`?(0,H.jsx)(`em`,{children:(0,H.jsx)(FR,{nodes:e.c,needle:t})}):(0,H.jsx)(`a`,{className:DR,href:e.href,target:`_blank`,rel:`noopener noreferrer`,children:(0,H.jsx)(FR,{nodes:e.c,needle:t})}))}function IR({block:e,needle:t}){switch(e.t){case`heading`:return(0,H.jsx)(NR,{level:e.level,children:(0,H.jsx)(FR,{nodes:e.c,needle:t})});case`para`:return(0,H.jsx)(`p`,{className:xR,children:(0,H.jsx)(FR,{nodes:e.c,needle:t})});case`code`:return(0,H.jsx)(`pre`,{className:TR,children:(0,H.jsx)(`code`,{children:jR(e.v,t)})});case`quote`:return(0,H.jsx)(`blockquote`,{className:wR,children:(0,H.jsx)(FR,{nodes:e.c,needle:t})});case`hr`:return(0,H.jsx)(`hr`,{className:AR});case`list`:{let n=e.ordered?`ol`:`ul`;return(0,H.jsx)(n,{className:`${CR} ${e.ordered?`list-decimal`:`list-disc`}`,children:PR(e.items,e=>(0,H.jsx)(`li`,{style:{marginLeft:`${e.depth*1.25}rem`},children:(0,H.jsx)(FR,{nodes:e.c,needle:t})}))})}case`table`:return(0,H.jsx)(`table`,{className:OR,children:(0,H.jsx)(`tbody`,{children:PR(e.rows,e=>(0,H.jsx)(`tr`,{children:PR(e,e=>(0,H.jsx)(`td`,{className:kR,children:(0,H.jsx)(FR,{nodes:e,needle:t})}))}))})})}}function LR({source:e,needle:t=``}){let n=(0,h.useMemo)(()=>aR(e),[e]);return(0,H.jsx)(`div`,{className:bR,children:PR(n,e=>(0,H.jsx)(IR,{block:e,needle:t}))})}function RR(e){if(e instanceof Uo){if(e.code===`TOO_LARGE`){let t=e.detail?.size;return $(B(`artifact.tooLarge`),{size:typeof t==`number`?`${(t/1048576).toFixed(1)} MB`:`5 MB+`})}if(e.code===`NOT_PREVIEWABLE`)return B(`artifact.notPreviewable`);if(e.code===`NOT_FOUND`)return B(`artifact.gone`)}return $(B(`artifact.failed`),{error:e instanceof Error?e.message:String(e)})}function zR(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:RR(e)})),()=>{r=!1}},[e,t,n,r]),i}function BR(e,t){let n=(0,h.useMemo)(()=>e===null?null:URL.createObjectURL(new Blob([HL(e)],{type:t})),[e,t]);return(0,h.useEffect)(()=>()=>void(n&&URL.revokeObjectURL(n)),[n]),n}function VR({model:e,taskId:t,path:n,kind:r,changeKey:i}){V();let a=zR(e,t,n,i),o=BR(a.kind===`ready`&&(r===`svg`||r===`image`||r===`pdf`)?a.file.base64:null,r===`md`||r===`html`?``:WL(r,n));return a.kind===`loading`?(0,H.jsx)(`p`,{className:wr,children:B(`artifact.loading`)}):a.kind===`failed`?(0,H.jsx)(`p`,{className:`${wr} text-error`,children:a.text}):r===`md`?(0,H.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto px-3 py-2`,children:(0,H.jsx)(LR,{source:UL(a.file.base64)})}):r===`html`?(0,H.jsx)(`iframe`,{title:n,sandbox:``,srcDoc:KL(UL(a.file.base64)),style:{colorScheme:`light`,background:`#fff`},className:`min-h-0 w-full flex-1 border-none`}):o?r===`pdf`?(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,H.jsx)(`a`,{className:`${Ar} px-3 py-1 font-mono text-meta`,href:o,target:`_blank`,rel:`noreferrer noopener`,children:B(`artifact.open`)}),(0,H.jsx)(`iframe`,{title:n,src:o,className:`min-h-0 w-full flex-1 border-none`})]}):(0,H.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-3`,children:(0,H.jsx)(`img`,{src:o,alt:n,className:`max-w-full`})}):null}function HR(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,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(`input`,{className:Mr,"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,H.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,H.jsx)(`li`,{ref:n===i?a:void 0,children:(0,H.jsxs)(`button`,{type:`button`,tabIndex:-1,"aria-pressed":n===i,className:kr({cursor:n===i,accent:!!t.accent}),onMouseDown:t=>{t.preventDefault(),e.onPick(n)},children:[(0,H.jsx)(`span`,{children:t.text}),t.dim&&(0,H.jsxs)(`span`,{className:`text-muted`,children:[` `,t.dim]})]})},t.key))})]})}function UR(e,t,n){let r=[{ref:null,suggestion:{key:`default`,text:t,dim:B(`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??[],B(`review.baseBranch`)),i(e?.remotes??[],B(`review.baseRemote`)),i(e?.tags??[],B(`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 WR(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 Ku(s,`diff.refs`,{taskId:e.taskId}).then(e=>n&&o(e),()=>{}),()=>{n=!1}},[t,s,e.taskId]);let c=UR(a,e.base,r),l=t=>{e.onPick(t),n(!1),i(``)},u=e.custom??e.base,d=[{id:`task`,label:B(`review.scopeTask`)},{id:`working`,label:B(`review.scopeWorking`)},{id:`branch`,label:B(`review.scopeBranch`)}],f=d.find(t=>t.id===e.scope)?.label??``;return(0,H.jsxs)(`span`,{className:`relative`,onKeyDown:e=>{e.stopPropagation(),e.key===`Escape`&&t&&n(!1)},children:[(0,H.jsx)(U,{hit:`tight`,"aria-expanded":t,"aria-haspopup":`menu`,onClick:t=>{let r=t.currentTarget.getBoundingClientRect();S.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:B(`review.compareAgainst`,{base:u}),section:`base`,run:()=>n(!0)}]})},children:B(`review.scopeMenu`,{base:u,scope:f})}),t&&(0,H.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,H.jsx)(HR,{field:`diff-base`,autoFocus:!0,value:r,onChange:i,items:c.map(e=>e.suggestion),open:!0,placeholder:B(`review.basePlaceholder`),onPick:e=>l(c[e]?.ref??null),onEnter:()=>l(r.trim()===``?null:r.trim())})})]})}var GR=`rove.diffBase`;function KR(){try{let e=JSON.parse(localStorage.getItem(GR)??`{}`);return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`string`))}catch{return{}}}function qR(e){return KR()[e]??null}function JR(e,t){let n=KR();t===null?delete n[e]:n[e]=t;try{localStorage.setItem(GR,JSON.stringify(n))}catch{}}function YR(e){let[t,n]=(0,h.useState)(()=>qR(e.taskId));return[t,t=>{JR(e.taskId,t),n(t),t!==null&&e.scope!==`task`&&Lc({taskId:e.taskId,path:e.path,scope:`task`})}]}var XR={add:`bg-diff-added-bg`,del:`bg-diff-removed-bg`},ZR={add:`text-diff-added`,del:`text-diff-removed`};function QR(e,t){let n=t.cursor?`bg-inset group-focus/preview:bg-accent-soft`:t.noted?`bg-inset`:XR[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 $R=`text-right text-subtle`,ez=`${$R} group-data-file/preview:hidden`,tz=(e,t,n=!1)=>t?`text-accent`:n?`text-diff-added`:ZR[e]??``,nz=e=>`min-w-0 whitespace-pre-wrap wrap-anywhere ${ZR[e]??``}`,rz=`min-w-0 whitespace-pre-wrap wrap-anywhere text-accent`,iz=`col-span-3 flex min-w-0 items-baseline gap-2 overflow-hidden`,az=(0,h.memo)(function(e){return(0,H.jsxs)(`div`,{className:`flex items-center ${e.viewed?`opacity-60`:``}`,children:[(0,H.jsxs)(U,{variant:`row`,"data-row":e.index,"aria-expanded":!e.closed,"aria-label":B(e.closed?`review.unfold`:`review.fold`,{path:e.name}),className:`${QR(`file`,{cursor:e.cursor,noted:!1})} min-w-0 flex-1 text-left`,onClick:()=>e.onToggleFold(e.index,e.path),children:[(0,H.jsx)(`span`,{className:`grid place-items-center text-subtle`,children:(0,H.jsx)(ps,{right:e.closed})}),(0,H.jsxs)(`span`,{className:iz,children:[(0,H.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name}),e.added?(0,H.jsxs)(kE,{tone:`added`,children:[`+`,e.added]}):null,e.removed?(0,H.jsxs)(kE,{tone:`removed`,children:[`−`,e.removed]}):null]})]}),e.path!==null&&(0,H.jsx)(U,{hit:`tight`,className:`flex-none px-2`,"aria-pressed":e.viewed,"aria-label":B(e.viewed?`review.unmarkViewed`:`review.markViewed`,{path:e.name}),onClick:()=>e.path!==null&&e.onToggleViewed(e.path),children:e.viewed?B(`review.viewedOn`):B(`review.viewed`)})]})});function oz(e){return(0,H.jsxs)(`div`,{className:`absolute top-full right-3 z-1 flex gap-1.5`,children:[(0,H.jsx)(U,{variant:`floating`,onMouseDown:e=>e.preventDefault(),onClick:t=>{t.stopPropagation(),e.onComment()},children:B(`review.comment`)}),e.showRange&&(0,H.jsx)(U,{variant:`floating`,onClick:t=>{t.stopPropagation(),e.onRange()},children:B(`review.range`)}),e.ranged&&(0,H.jsx)(U,{variant:`floating`,title:B(`preview.askInChatHint`),onMouseDown:e=>e.preventDefault(),onClick:t=>{t.stopPropagation(),e.onAsk()},children:B(`preview.askInChat`)})]})}function sz({note:e,onEdit:t}){return(0,H.jsxs)(U,{variant:`row`,className:`${QR(`note`,{cursor:!1,noted:!1})} w-full text-left`,onClick:t,children:[(0,H.jsx)(`span`,{className:ez}),(0,H.jsx)(`span`,{}),(0,H.jsx)(`span`,{className:`text-accent`,children:`●`}),(0,H.jsx)(`span`,{className:rz,children:e.body})]})}function cz(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 lz=2e3,uz=(0,h.memo)(function(e){let{index:t,row:n,noted:r}=e;return(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{"data-row":t,className:QR(n.kind,{cursor:e.cursor,noted:r}),onClick:n=>e.onClick(t,n),children:[(0,H.jsx)(`span`,{className:ez,children:n.oldNo??``}),(0,H.jsx)(`span`,{className:$R,children:n.newNo??``}),(0,H.jsx)(`span`,{className:tz(n.kind,r,e.changed),children:n.kind===`add`?`+`:n.kind===`del`?`−`:r?`●`:e.changed?`▎`:` `}),(0,H.jsxs)(`span`,{className:nz(n.kind),children:[n.text.length>lz?n.text.slice(0,lz):n.text,n.text.length>lz&&(0,H.jsxs)(`span`,{className:`text-subtle`,children:[` `,B(`review.lineClipped`,{count:(n.text.length-lz).toLocaleString()})]})]}),e.actions]}),e.notes?.map(t=>t.id===e.editId?(0,H.jsx)(h.Fragment,{children:e.composer},t.id):(0,H.jsx)(sz,{note:t,onEdit:()=>e.onEditNote(t)},t.id)),e.editId===void 0&&e.composer]})});function dz(e){return(0,H.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,H.jsx)(U,{hit:`tight`,"aria-pressed":e.ignoreWs,title:B(`review.ignoreWsHint`),className:`opacity-60 aria-pressed:underline aria-pressed:opacity-100`,onClick:e.onToggleWs,children:B(`review.ignoreWs`)}),(0,H.jsxs)(`span`,{className:`flex min-w-0 basis-full flex-wrap items-center gap-x-1.5 text-muted`,children:[B(`review.totals`,{files:e.files,added:e.added,removed:e.removed}),e.shape&&(0,H.jsxs)(`span`,{children:[`· `,e.shape]}),e.files>0&&(0,H.jsxs)(`span`,{className:`whitespace-nowrap`,children:[`· `,B(`review.viewedCount`,{done:e.viewed,files:e.files})]})]}),(0,H.jsxs)(`span`,{className:`ml-auto flex items-center gap-x-3`,children:[e.files>1&&(0,H.jsx)(U,{hit:`tight`,onClick:e.onNextFile,children:B(`review.nextFile`)}),e.onNextComment&&(0,H.jsx)(U,{hit:`tight`,onClick:e.onNextComment,children:B(`review.nextComment`)}),e.files>1&&(0,H.jsx)(U,{hit:`tight`,onClick:e.onFoldAll,children:e.allFolded?B(`review.unfoldAll`):B(`review.foldAll`)})]})]})}var fz=`rove.diffViewed`,pz=(e,t)=>`${e}\0${t}`,mz=4096;function hz(e){let t=2166136261;for(let n of e){let e=n.text.length>mz?`${n.text.slice(0,mz/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 gz(e){let t=new Map,n=-1,r=r=>{let i=n>=0?e[n]?.path:null;i&&t.set(i,hz(e.slice(n+1,r)))};return e.forEach((e,t)=>{e.kind===`file`&&(r(t),n=t)}),r(e.length),t}function _z(){try{let e=JSON.parse(localStorage.getItem(fz)??`{}`);return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`string`))}catch{return{}}}function vz(e){try{localStorage.setItem(fz,JSON.stringify(e))}catch{}}function yz(e,t,n){let r=new Set;for(let[i,a]of n)e[pz(t,i)]===a&&r.add(i);return r}function bz(e,t,n,r){let i={...e};return r===void 0?delete i[pz(t,n)]:i[pz(t,n)]=r,i}function xz(e,t){return e.find(e=>e>t)??e[0]??null}var Sz=`rove.diffIgnoreWs`;function Cz(){try{return localStorage.getItem(Sz)===`1`}catch{return!1}}function wz(e){try{localStorage.setItem(Sz,e?`1`:`0`)}catch{}}var Tz=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/;function Ez(e,t=null,n=!1){let r=[],i=0,a=0,o=t,s=!1;for(let t of e.replace(/\n$/,``).split(`
71
+ `)){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=Tz.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 Dz(e,t){return e.replace(/\n$/,``).split(`
72
+ `).map((e,n)=>({kind:`ctx`,text:e,oldNo:null,newNo:n+1,path:t}))}function Oz(e){return e.kind===`del`?e.foreignOld?null:e.oldNo:e.kind===`add`||e.kind===`ctx`?e.newNo:null}function kz(e){let t=e.startLine?`lines ${e.startLine}-${e.line}`:`line ${e.line}`;return`@${e.path} (${t}) `}function Az(e,t,n){let r=e[t],i=r?Oz(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?Oz(a):null,c=o?Oz(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 jz(e,t,n){let r=Az(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 Mz(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 Nz(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 Pz(e){return(0,H.jsx)(`div`,{className:`flex flex-none items-center gap-3 px-2 pt-1.5 font-mono text-meta`,children:(0,H.jsx)(U,{hit:`tight`,onClick:()=>e.file?Lc({taskId:e.taskId,path:e.path,scope:`working`}):Rc(e.taskId,e.path),children:B(e.file?`preview.modeDiff`:`preview.modeFile`)})})}function Fz(e,t,n,r,i){let[a,o]=(0,h.useState)(null);return(0,h.useEffect)(()=>{if(!r)return;let i=!0;return Ku(e,`diff.file`,{taskId:t,path:n,scope:`working`}).then(e=>{if(!i)return;let t=e.kind===`diff`&&typeof e.text==`string`?Ez(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 Iz=[`source`,`tests`,`config`,`docs`,`generated`],Lz=/(^|\/)(bun\.lockb?|package-lock\.json|yarn\.lock|pnpm-lock\.yaml|Cargo\.lock|poetry\.lock|uv\.lock|Gemfile\.lock|go\.sum|composer\.lock)$/,Rz=/(^|\/)(dist|build|generated|__generated__|\.next)\/|\.min\.(js|css)$|\.snap$|\.generated\.|\.pb\.go$|\.map$/,zz=/(^|\/)(tests?|__tests__|spec|e2e)\/|\.(test|spec)\.[cm]?[jt]sx?$|_test\.(go|py)$|(^|\/)test_[^/]+\.py$/,Bz=/\.(md|mdx|rst|txt)$|(^|\/)docs\//i,Vz=/(^|\/)(\.[\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)\//,Hz=e=>Lz.test(e);function Uz(e){return Lz.test(e)||Rz.test(e)?`generated`:zz.test(e)?`tests`:Bz.test(e)?`docs`:Vz.test(e)?`config`:`source`}var Wz=e=>Uz(e)===`generated`;function Gz(e){let t=e.filter(e=>Uz(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 Kz(e){let t=[],n=(e,n)=>n>0&&t.push({group:e,count:n});for(let t of Iz)t===`generated`?(n(`lockfile`,e.filter(Hz).length),n(`generated`,e.filter(e=>Uz(e)===`generated`&&!Hz(e)).length)):n(t,e.filter(e=>Uz(e)===t).length);return t}function qz(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=>Iz.indexOf(Uz(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 Jz(e){return Kz(e.map(e=>e.path)).map(({group:e,count:t})=>({key:e===`lockfile`?t===1?`lockfile`:`lockfiles`:e,count:t}))}function Yz(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?``:[B(`review.shape.effort`,{n:Gz(n)}),...Jz(n).map(e=>B(`review.shape.${e.key}`,{count:e.count}))].join(` · `)}function Xz(e,t,n){if(!e||typeof e!=`object`||!(`kind`in e))return{kind:`text`,text:B(`preview.unknown`)};let r=`text`in e&&typeof e.text==`string`?e.text:``;switch(e.kind){case`diff`:{let e=Ez(r,t===`.`?null:t,n);return{kind:`rows`,rows:t===`.`?qz(e):e,diff:!0}}case`code`:return{kind:`rows`,rows:Dz(r,t),diff:!1};case`binary`:return{kind:`text`,text:B(`preview.binary`)};case`empty`:return{kind:`text`,text:B(`preview.empty`)};case`error`:return{kind:`text`,text:`message`in e?String(e.message):B(`preview.unknown`),error:!0};default:return{kind:`text`,text:B(`preview.noHunks`,{kind:String(e.kind)})}}}function Zz(e){return e instanceof Uo&&e.code===`UNKNOWN_OP`?Error(B(`review.notSupported`)):e instanceof Error?e:Error(String(e))}function Qz(e,t){let n=e.tasks.get()?.tasks.find(e=>e.id===t);return n?.workspace?`${n.machine?.id??``}:${n.workspace}`:t}var $z={add:`+`,del:`-`},eB=40,tB=160,nB=e=>`${$z[e.kind]??` `}${e.text.slice(0,tB)}`,rB=e=>e.startLine!==void 0&&e.startLine!==e.line?`${e.filePath}:${e.startLine}-${e.line}`:`${e.filePath}:${e.line}`;function iB(e,t,n){let r=[];for(let i=t;i<=n&&r.length<eB;i++){let t=e[i];t&&Oz(t)!==null&&r.push(nB(t))}return r.join(`
73
+ `)}function aB(e,t){let n=e.startLine??e.line,r=t.flatMap((t,n)=>t.path===e.filePath&&Oz(t)!==null?[n]:[]);if(!e.code){let i=r.filter(r=>{let i=Oz(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(`
74
+ `);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&&Oz(t[o])===n&&a.every((e,n)=>nB(t[e])===i[n]))return{first:o,last:s}}return null}function oB(e,t,n){return aB(e,t)?`ok`:t.some(t=>t.path===e.filePath)||n?`moved`:`unknown`}function sB(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:iB(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 Zz(e)});e.onSaved(t.kind===`add`),r()}};return{node:t&&(0,H.jsx)(cB,{location:t.kind===`add`?rB({filePath:t.target.path,startLine:t.target.startLine,line:t.target.line}):rB(t.note),...t.kind===`edit`?{initial:t.note.body}:{},onSubmit:i,onCancel:r}),row:t?t.kind===`add`?t.target.last:aB(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 cB(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,H.jsxs)(`div`,{className:QR(`note`,{cursor:!1,noted:!1}),onKeyDown:e=>e.stopPropagation(),onMouseUp:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:[(0,H.jsx)(`span`,{className:ez}),(0,H.jsx)(`span`,{}),(0,H.jsx)(`span`,{className:`text-accent`,children:`●`}),(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5 whitespace-normal`,children:[(0,H.jsx)(`textarea`,{className:`${Mr} ${Ir} font-mono`,"aria-label":B(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,H.jsx)(`p`,{className:`m-0 text-error`,children:a}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(U,{hit:`tight`,disabled:r||!c,onClick:()=>void l(),children:B(s?`review.noteSave`:`review.noteAdd`)}),(0,H.jsx)(U,{hit:`tight`,className:`text-muted`,disabled:r,onClick:e.onCancel,children:B(`review.noteCancel`)})]})]})]})}function lB({notes:e,states:t,sending:n,onShow:r,onEdit:i,onDrop:a,onSend:o}){V();let[s,c]=(0,h.useState)(!1);if(e.length===0)return null;let l=e.length;return(0,H.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,H.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-1.5 narrow:px-2`,children:[(0,H.jsxs)(U,{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,H.jsx)(ps,{right:!s}),(0,H.jsx)(`span`,{children:l===1?B(`review.countOne`):B(`review.count`,{count:l})})]}),(0,H.jsx)(U,{disabled:n,onClick:o,children:n?B(`review.sending`):B(`review.send`,{count:l})})]}),s&&(0,H.jsx)(`ul`,{className:`m-0 min-h-0 list-none overflow-y-auto p-0 pb-1`,children:e.map(e=>(0,H.jsxs)(`li`,{className:`flex flex-col gap-0.5 px-3 py-1 narrow:px-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,H.jsx)(U,{variant:`row`,className:`min-w-0 flex-1 truncate text-left text-ink hover:underline`,title:B(`review.show`),onClick:()=>r(e),children:rB(e)}),t.get(e.id)===`moved`&&(0,H.jsx)(`span`,{title:B(`review.movedHint`),children:(0,H.jsx)(kE,{tone:`warning`,children:B(`review.moved`)})}),(0,H.jsx)(U,{hit:`tight`,onClick:()=>i(e),children:B(`review.edit`)}),(0,H.jsx)(U,{hit:`tight`,onClick:()=>a(e),children:B(`review.drop`)})]}),(0,H.jsx)(`p`,{className:`m-0 line-clamp-2 whitespace-pre-wrap wrap-anywhere text-muted`,children:e.body})]},e.id))})]})}var uB=[];function dB({model:e,view:t,active:n,restored:r,onClose:i}){V();let a=lu(),[o,s]=(0,h.useState)(Cz),[c,l]=(0,h.useState)(_z),[u,d]=YR(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}:{}},_=Qz(e,t.taskId),v={...g,taskId:_},[b,x]=(0,h.useState)(()=>{let n=X(e,`diff.file`,v);return n===void 0?null:Xz(n,t.path,p)}),[S,C]=(0,h.useState)(()=>X(e,`review.list`,{taskId:t.taskId})?.notes??[]),[w,T]=(0,h.useState)(()=>X(e,`diff.files`,{taskId:_})),[E,D]=(0,h.useState)(0),[O,k]=(0,h.useState)(null),[A,j]=(0,h.useState)(!1),[N,P]=(0,h.useState)(new Map),[ee,F]=(0,h.useState)(!1),[I,te]=(0,h.useState)(0),ne=(0,h.useRef)(null),re=e.client,ie=y(re.conn).state;(0,h.useEffect)(()=>{let e=!0;return re.request(`diff.file`,g).then(n=>e&&x(Xz(Gu(re,`diff.file`,v,n),t.path,p)),t=>{if(e){if(f&&t instanceof Uo&&t.code===`BAD_REF`){d(null),L(t.message,`error`);return}x({kind:`text`,text:Yo(t),error:!0})}}),()=>{e=!1}},[re,t.taskId,t.path,t.scope,o,f,I,ie]),(0,h.useEffect)(()=>{let e=!0;return re.request(`diff.files`,{taskId:t.taskId}).then(t=>e&&T(Gu(re,`diff.files`,{taskId:_},t)),()=>{}),()=>{e=!1}},[re,t.taskId,I]);let ae=()=>void Ku(re,`review.list`,{taskId:t.taskId}).then(e=>C(e.notes));(0,h.useEffect)(ae,[re,t.taskId,I]);let oe=(0,h.useRef)(!1);(0,h.useEffect)(()=>{n&&(oe.current||!r)&&ne.current?.focus(),oe.current=!0},[n,r]);let R=b?.kind===`rows`?b.rows:uB,z=b?.kind===`rows`&&b.diff,se=w?.base??null,ce=t.path!==`.`&&t.scope===`working`&&OL(w?.files??[],t.path),le=Fz(re,t.taskId,t.path,m&&ce&&!z,I),ue=(0,h.useMemo)(()=>R.map((e,t)=>`row-${t}`),[R]),de=(0,h.useMemo)(()=>Nz(R),[R]),fe=(0,h.useMemo)(()=>gz(R),[R]),pe=(0,h.useMemo)(()=>yz(c,t.taskId,fe),[c,t.taskId,fe]),me=(0,h.useMemo)(()=>{let e=new Set;for(let t of fe.keys())(N.get(t)??(Wz(t)||pe.has(t)))&&e.add(t);return e},[fe,pe,N]),he=(e,t)=>P(n=>{let r=new Map(n);for(let n of e)r.set(n,t);return r}),ge=(0,h.useMemo)(()=>Mz(R,me),[R,me]),_e=(0,h.useMemo)(()=>S.filter(e=>e.sentAt===void 0),[S]),ve=(0,h.useMemo)(()=>_e.map(e=>({note:e,at:aB(e,R)})),[_e,R]),ye=(0,h.useMemo)(()=>{let e=new Set;for(let{at:t}of ve)if(t)for(let n=t.first;n<=t.last;n++)e.add(n);return e},[ve]),be=(0,h.useMemo)(()=>{let e=new Map;for(let{note:t,at:n}of ve)n&&e.set(n.last,[...e.get(n.last)??[],t]);return e},[ve]),xe=t.path===`.`&&b!==null&&!(b.kind===`text`&&b.error),Se=(0,h.useMemo)(()=>{let e=new Map;for(let{note:t}of ve)e.set(t.id,oB(t,R,xe));return e},[ve,R,xe]);(0,h.useEffect)(()=>{if(ge.includes(E))return;let e=E;for(;e>0&&R[e]?.kind!==`file`;)e--;D(e),k(null)},[ge,E,R]);let Ce=(0,h.useRef)(!1);(0,h.useEffect)(()=>{if(!Ce.current){Ce.current=!0;return}ne.current?.querySelector(`[data-row="${E}"]`)?.scrollIntoView({block:`nearest`})},[E]);let we=jz(R,E,O),Te=e=>he([e],!me.has(e)),Ee=[...de.keys()].flatMap(e=>R[e]?.path?[R[e]?.path]:[]),De=(0,h.useMemo)(()=>Yz(de,R),[de,R]),Oe=Ee.length>0&&Ee.every(e=>me.has(e)),ke=[...de.values()].reduce((e,t)=>({added:e.added+t.added,removed:e.removed+t.removed}),{added:0,removed:0}),Ae=e=>{let n=bz(c,t.taskId,e,pe.has(e)?void 0:fe.get(e));l(n),vz(n),P(t=>{let n=new Map(t);return n.delete(e),n})},je=()=>{wz(!o),s(!o)},Me=sB({client:re,taskId:t.taskId,rows:R,target:we,onSaved:e=>{e&&(k(null),j(!1)),ae()},focusView:()=>ne.current?.focus()}),Ne=e=>{Le(e),(t.path===`.`||t.path===e.filePath)&&Me.edit(e)},Pe=e=>void re.request(`review.remove`,{taskId:t.taskId,id:e.id}).then(ae).catch(e=>L(Zz(e).message,`error`)),Fe=y(M),Ie=()=>{let e=Az(R,E,O);if(e){if(!Fe?.startsWith(`${t.taskId}::`)){L(B(`files.mentionNoEngine`),`error`);return}re.request(`term.input`,{stream:Fe,data:kz(e)}).then(()=>{k(null),Po(Fe)?.focus()}).catch(e=>L(e instanceof Error?e.message:String(e),`error`))}},Le=e=>{let n=aB(e,R),r=R.findIndex(t=>t.kind===`file`&&t.path===e.filePath);n?(he([e.filePath],!1),D(n.first)):t.path===`.`&&r>=0?D(r):t.path!==e.filePath&&t.path!==`.`&&Lc({taskId:t.taskId,path:e.filePath,scope:t.scope}),k(null),j(!1)},Re=()=>{F(!0),re.request(`review.send`,e.engineTarget(t.taskId)).then(e=>{L(e.delivered?B(`preview.sent`,{count:e.sent}):B(`preview.notSent`,{reason:e.reason??``}),e.delivered?`info`:`error`),ae()}).catch(e=>L(e instanceof Error?e.message:String(e),`error`)).finally(()=>F(!1))},ze=()=>{let e=xz([...de.keys()],E);e!==null&&(D(e),k(null),j(!1))},Be=()=>{let e=xz(ve.flatMap(({at:e})=>e?[e.first]:[]).sort((e,t)=>e-t),E);if(e===null)return;let t=R[e]?.path;t&&he([t],!1),D(e),k(null),j(!1)},Ve=e=>D(t=>{let n=Math.max(0,ge.indexOf(t));return ge[Math.min(ge.length-1,Math.max(0,n+e))]??t}),He=e=>{let t=e.key;if(t===`j`||t===`ArrowDown`)Ve(1);else if(t===`k`||t===`ArrowUp`)Ve(-1);else if(t===`v`)k(e=>e===null?E:null),j(!0);else if(t===`c`&&!e.ctrlKey)Me.add();else if(t===`x`){let e=ve.find(({at:e})=>e&&E>=e.first&&E<=e.last);e&&Pe(e.note)}else if(t===`s`)Re();else if(t===`z`){let e=R[E]?.path;e&&z&&Te(e)}else if(t===`r`)te(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()},Ue=()=>{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)),j(!0))},We=cz({rowClick:(e,t)=>{window.getSelection()?.isCollapsed!==!1&&(t.shiftKey?k(e=>e??E):(!a||O===null)&&k(null),D(e),j(!0))},fileClick:(e,t)=>{D(e),k(null),j(!1),t&&Te(t)},viewedClick:Ae,editNote:Ne}),Ge=O===null?E:Math.min(O,E),Ke=O===null?E:Math.max(O,E);return(0,H.jsxs)(`div`,{className:`group/preview @container/preview flex min-h-0 min-w-0 flex-1 flex-col outline-none`,"data-file":m&&!z?``:void 0,tabIndex:0,ref:ne,onKeyDown:He,children:[ce&&(0,H.jsx)(Pz,{taskId:t.taskId,path:t.path,file:m}),z&&(0,H.jsx)(dz,{picker:se!==null&&(0,H.jsx)(WR,{taskId:t.taskId,model:e,scope:t.scope,onScope:e=>Lc({taskId:t.taskId,path:t.path,scope:e}),base:se,custom:u,onPick:d}),ignoreWs:o,onToggleWs:je,files:Ee.length,shape:De,added:ke.added,removed:ke.removed,viewed:pe.size,allFolded:Oe,onFoldAll:()=>he(Ee,!Oe),onNextFile:ze,onNextComment:ve.some(({at:e})=>e)?Be:null}),(0,H.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto py-1.5 font-mono text-meta/normal`,onMouseUp:Ue,children:[!b&&(0,H.jsx)(`p`,{className:`mx-2.5 my-3 font-mono text-meta text-subtle`,children:B(`preview.loading`)}),b?.kind===`text`&&(0,H.jsx)(`p`,{className:`mx-2.5 my-3 font-mono text-meta text-subtle ${b.error?`text-error`:``}`,children:b.text}),ge.map(e=>{let t=R[e],n=e>=Ge&&e<=Ke;if(t.kind===`file`){let r=de.get(e),i=t.path;return(0,H.jsx)(az,{index:e,name:t.text,path:i,closed:i!==null&&me.has(i),viewed:i!==null&&pe.has(i),cursor:n,added:r?.added??0,removed:r?.removed??0,onToggleFold:We.fileClick,onToggleViewed:We.viewedClick},ue[e])}return(0,H.jsx)(uz,{index:e,row:t,cursor:n,noted:ye.has(e),actions:A&&we&&!Me.node&&e===Ke&&(0,H.jsx)(oz,{showRange:a&&O===null,ranged:O!==null,onComment:Me.add,onRange:()=>k(E),onAsk:Ie}),notes:be.get(e),changed:t.newNo!==null&&le?.has(t.newNo)===!0,composer:e===Me.row?Me.node:void 0,editId:e===Me.row?Me.editId:void 0,onClick:We.rowClick,onEditNote:We.editNote},ue[e])}),Me.row===-1&&Me.node]}),(0,H.jsx)(lB,{notes:_e,states:Se,sending:ee,onShow:Le,onEdit:Ne,onDrop:Pe,onSend:Re})]})}function fB(e){V();let{model:t,view:n}=e,r=n.path===`.`?null:VL(n.path),[i,a]=(0,h.useState)(null),o=y(t.tasks);if(!r)return(0,H.jsx)(dB,{...e});let s=i===n.path,c=JSON.stringify(o?.tasks.find(e=>e.id===n.taskId)?.changes??null);return(0,H.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,H.jsxs)(`div`,{className:`flex gap-x-3 px-2.5 py-1`,children:[(0,H.jsx)(U,{variant:`pill`,hit:`tight`,"aria-current":!s,onClick:()=>a(null),children:`[ ${B(`artifact.preview`)} ]`}),(0,H.jsx)(U,{variant:`pill`,hit:`tight`,"aria-current":s,onClick:()=>a(n.path),children:`[ ${B(`artifact.source`)} ]`})]}),s?(0,H.jsx)(dB,{...e}):(0,H.jsx)(VR,{model:t,taskId:n.taskId,path:n.path,kind:r,changeKey:c})]})}var pB={entries:[],failed:new Set},mB=[`command`,`cmd`,`file_path`,`path`,`pattern`,`query`,`url`,`description`,`prompt`],hB=100;function gB(e){let t=(e.split(`
75
+ `).find(e=>e.trim()!==``)??``).trim();return t.length>hB?`${t.slice(0,99)}…`:t}function _B(e){if(typeof e==`string`)return gB(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 mB){let r=n(t[e]);if(r.trim())return gB(r)}for(let e of Object.values(t)){let t=n(e);if(t.trim())return gB(t)}return``}function vB(e){return e===`user`||e===`assistant`||e===`system`?e:null}function yB(e,t){let n=[],r=[];return e.forEach((e,i)=>{let a=vB(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:_B(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(`
76
76
 
77
- `),tools:s})}),{entries:n,failed:r}}function DB(e,t,n){let r=EB(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 OB(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 kB=e=>e.replace(/[*_`]+/g,``).replace(/[…\s]+/g,` `).trim().toLowerCase();function AB(e,t){let n=e.find(e=>e.at===t.at&&e.role===t.role);if(n)return n.index;let r=kB(t.snippet);return r?e.find(e=>e.role===t.role&&kB(e.text).includes(r))?.index??null:null}function jB(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 MB(e,t){let n=e.tools.map(e=>`- \`${e.name}\`${e.summary?` ${e.summary}`:``}${t.has(e.callId)?` (failed)`:``}`);return[e.text,n.join(`
77
+ `),tools:s})}),{entries:n,failed:r}}function bB(e,t,n){let r=yB(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 xB(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 SB=e=>e.replace(/[*_`]+/g,``).replace(/[…\s]+/g,` `).trim().toLowerCase();function CB(e,t){let n=e.find(e=>e.at===t.at&&e.role===t.role);if(n)return n.index;let r=SB(t.snippet);return r?e.find(e=>e.role===t.role&&SB(e.text).includes(r))?.index??null:null}function wB(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 TB(e,t){let n=e.tools.map(e=>`- \`${e.name}\`${e.summary?` ${e.summary}`:``}${t.has(e.callId)?` (failed)`:``}`);return[e.text,n.join(`
78
78
  `)].filter(e=>e!==``).join(`
79
79
 
80
- `)}function NB(e,t){return e.text===``?MB(e,t):e.text}function PB(e,t,n,r){return`# ${e}\n\n${t.map(e=>`${`## ${r[e.role]}${e.at?` · ${e.at}`:``}`}\n\n${MB(e,n)}`).join(`
80
+ `)}function EB(e,t){return e.text===``?TB(e,t):e.text}function DB(e,t,n,r){return`# ${e}\n\n${t.map(e=>`${`## ${r[e.role]}${e.at?` · ${e.at}`:``}`}\n\n${TB(e,n)}`).join(`
81
81
 
82
- `)}\n`}var FB=50;function IB(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:FB,...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=DB(bB,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:G(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:DB(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:DB(e.transcript,n.history?.messages??[],n.history?.firstIndex??0),older:n.olderCursor??null}:e)}catch(e){t===c.current&&r({kind:`error`,message:G(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=DB(i,t.messages,t.firstIndex),r=e.olderCursor??null}return t===c.current?(r(e=>e.kind===`ready`?{...e,transcript:n.reduce((e,t)=>DB(e,t.messages,t.firstIndex),e.transcript),older:null}:e),i):null}catch(e){return t===c.current&&r({kind:`error`,message:G(e)}),null}finally{t===c.current&&(s.current=!1,a(!1))}},[l]),refresh:d,reload:(0,h.useCallback)(()=>{r({kind:`loading`}),u()},[u])}}var LB=3e3,RB=80,zB=2500;function BB(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 VB=e=>{let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})};function HB(e){let{entry:t}=e,n=B(t.role===`user`?`transcript.you`:t.role===`assistant`?`transcript.agent`:`transcript.system`);return(0,H.jsxs)(`article`,{className:yR(e),"data-index":t.index,children:[(0,H.jsxs)(`header`,{className:bR,children:[(0,H.jsx)(`span`,{className:xR(t.role),children:n}),(0,H.jsx)(`span`,{className:SR,children:VB(t.at)}),(0,H.jsx)(U,{className:CR,onClick:e.onCopy,children:B(`transcript.copy`)})]}),t.text!==``&&(0,H.jsx)(WR,{source:t.text,needle:e.needle}),t.tools.map((t,n)=>(0,H.jsxs)(`p`,{className:wR,title:`${t.name} ${t.summary}`,children:[(0,H.jsx)(`span`,{className:TR,children:RR(t.name,e.needle)}),(0,H.jsx)(`span`,{className:ER,children:RR(t.summary,e.needle)}),e.failed.has(t.callId)&&(0,H.jsx)(`span`,{className:`flex-none text-error`,children:B(`transcript.failed`)})]},n))]})}function UB({model:e,task:t,active:n}){V();let r=IB(e,t.id),{state:i}=r,[a,o]=(0,h.useState)(``),[s,c]=(0,h.useState)(0),[l,u]=(0,h.useState)(null),d=(0,h.useRef)(null),f=(0,h.useRef)(!0),p=(0,h.useRef)(null),m=y(Py),g=i.kind===`ready`?i:null,_=(0,h.useMemo)(()=>g?.transcript.entries??[],[g?.transcript]),v=g?.transcript.failed??new Set,b=(0,h.useMemo)(()=>OB(_,a),[_,a]),x=b.length===0?0:Math.min(s,b.length-1),S=b[x]??null,C=e=>{f.current=!1,d.current?.querySelector(`[data-index="${e}"]`)?.scrollIntoView({block:`center`})},w=t.rowStatus?.kind,T=w===`running`||w===`needs-input`,{refresh:E}=r;(0,h.useEffect)(()=>{n&&E()},[n,w,E]),(0,h.useEffect)(()=>{if(!n||!T)return;let e=setInterval(()=>void E(),LB);return()=>clearInterval(e)},[n,T,E]),(0,h.useLayoutEffect)(()=>{let e=d.current;e&&(p.current?(e.scrollTop=p.current.top+(e.scrollHeight-p.current.height),p.current=null):f.current&&(e.scrollTop=e.scrollHeight))},[_]);let D=async()=>{let e=d.current;e&&(p.current={height:e.scrollHeight,top:e.scrollTop}),await r.loadOlder()};(0,h.useEffect)(()=>{if(!m||m.taskId!==t.id||!g||!n)return;let e=AB(_,m.hit);e===null?g.older&&jB(_,m.hit)?D():Py.set(null):(u(e),C(e),Py.set(null))},[m,g,_,n,t.id]),(0,h.useEffect)(()=>{if(l===null)return;let e=setTimeout(()=>u(null),zB);return()=>clearTimeout(e)},[l]),(0,h.useEffect)(()=>{c(0);let e=OB(_,a)[0];e!==void 0&&C(e)},[a]);let O=e=>{if(b.length===0)return;let t=(x+e+b.length)%b.length;c(t),C(b[t])},k=e=>{e.key===`Enter`&&!e.nativeEvent.isComposing?(e.preventDefault(),O(e.shiftKey?-1:1)):e.key===`Escape`&&a!==``&&(e.stopPropagation(),o(``))},A=e=>void navigator.clipboard.writeText(NB(e,v)).then(()=>L(B(`transcript.copied`)),()=>L(B(`menu.copyFailed`),`error`)),j=async()=>{let e=await r.loadAll();if(!e)return;let n={user:B(`transcript.you`),assistant:B(`transcript.agent`),system:B(`transcript.system`)};BB(`${t.label.replace(/[^\p{L}\p{N}]+/gu,`-`).replace(/^-|-$/g,``)||`conversation`}.md`,PB(t.label,e.entries,e.failed,n))};return i.kind===`loading`?(0,H.jsx)(`div`,{className:pR,children:(0,H.jsx)(`p`,{className:_R,children:B(`transcript.loading`)})}):i.kind===`error`?(0,H.jsxs)(`div`,{className:pR,children:[(0,H.jsx)(`p`,{className:`${_R} text-error`,children:B(`transcript.error`,{error:i.message})}),(0,H.jsx)(`p`,{className:_R,children:(0,H.jsx)(U,{onClick:r.reload,children:B(`transcript.retry`)})})]}):i.kind===`terminal`?(0,H.jsxs)(`div`,{className:pR,children:[(0,H.jsx)(`p`,{className:_R,children:B(`transcript.noHistory`)}),(0,H.jsx)(`pre`,{className:`${vR} min-h-0 flex-1 overflow-y-auto`,children:i.tail.join(`
83
- `)})]}):(0,H.jsxs)(`div`,{className:pR,children:[(0,H.jsxs)(`div`,{className:mR,children:[(0,H.jsx)(`input`,{className:`${Mr} ${hR}`,value:a,placeholder:B(`transcript.findPlaceholder`),"aria-label":B(`transcript.findPlaceholder`),spellCheck:!1,autoComplete:`off`,onChange:e=>o(e.target.value),onKeyDown:k}),a.trim()!==``&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`whitespace-nowrap text-muted`,children:b.length===0?B(`transcript.findNone`):B(`transcript.findCount`,{at:x+1,total:b.length})}),(0,H.jsx)(U,{onClick:()=>O(-1),disabled:b.length===0,children:B(`transcript.prev`)}),(0,H.jsx)(U,{onClick:()=>O(1),disabled:b.length===0,children:B(`transcript.next`)})]}),(0,H.jsx)(U,{onClick:()=>void j(),disabled:_.length===0,children:B(`transcript.export`)})]}),(0,H.jsxs)(`div`,{ref:d,className:gR,onScroll:e=>{let t=e.currentTarget;f.current=t.scrollHeight-t.scrollTop-t.clientHeight<RB,t.scrollTop<RB&&g?.older&&!r.paging&&D()},children:[g?.older&&(0,H.jsx)(`p`,{className:`m-0 px-3 py-2 font-mono text-meta text-subtle`,children:(0,H.jsx)(U,{onClick:()=>void D(),disabled:r.paging,children:B(`transcript.older`)})}),_.length===0&&(0,H.jsx)(`p`,{className:`m-0 px-3 py-2 font-mono text-meta text-subtle`,children:B(`transcript.empty`)}),_.map(e=>(0,H.jsx)(HB,{entry:e,failed:v,needle:a,flash:l===e.index,current:S===e.index,onCopy:()=>A(e)},e.index))]})]})}var WB={working:`review.scopeWorking`,branch:`review.scopeBranch`,task:`review.scopeTask`};function GB(e){return e.kind===`file`?{text:zs(e.path),hint:e.path}:e.kind===`diff`?e.path===`.`?{text:B(WB[e.scope]),hint:B(`preview.whole`)}:{text:zs(e.path),hint:e.path}:{text:B(`panel.${e.kind}`),hint:B(`panel.${e.kind}`)}}function KB({taskId:e,kind:t,expand:n}){V();let r=y(oc),i=B(r?`panel.restore`:`panel.expand`);return(0,H.jsxs)(H.Fragment,{children:[n&&(0,H.jsx)(`button`,{type:`button`,className:Xn({tool:!0}),title:i,"aria-label":i,"aria-pressed":r,onClick:()=>oc.set(!r),children:(0,H.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,H.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,H.jsx)(`button`,{type:`button`,className:Xn({tool:!0}),title:B(`panel.close`),"aria-label":B(`panel.close`),onClick:()=>Vc(e,t),children:(0,H.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:`M4 4l8 8M12 4l-8 8`})})})]})}function qB({taskId:e,column:t,narrow:n}){if(V(),t.kind===`browser`)return(0,H.jsxs)(`div`,{className:nr(n),children:[(0,H.jsx)(NF,{taskId:e,column:t}),!n&&(0,H.jsx)(KB,{taskId:e,kind:`browser`,expand:!0})]});if(n&&t.kind!==`diff`)return null;let{text:r,hint:i}=GB(t);return(0,H.jsxs)(`div`,{className:nr(n),children:[(0,H.jsx)(`span`,{className:rr,title:i,children:r}),(0,H.jsx)(KB,{taskId:e,kind:t.kind,expand:!n})]})}function JB({model:e,task:t,column:n}){let r=(0,h.useRef)([]);return r.current=Ns(r.current,n.active,n.tabs),n.tabs.filter(e=>r.current.includes(e.id)).map(r=>(0,H.jsx)(`div`,{className:fr,hidden:r.id!==n.active,children:(0,H.jsx)(VI,{model:e,taskId:t.id,tab:r,onNavigate:e=>Hc(t.id,t=>Ds(t,r.id,e)),onStep:e=>Hc(t.id,t=>Os(t,r.id,e))})},r.id))}function YB({model:e,task:t,column:n,narrow:r,restored:i}){return n.kind===`browser`?(0,H.jsx)(JB,{model:e,task:t,column:n}):(0,H.jsxs)(`div`,{className:fr,children:[n.kind===`files`&&(0,H.jsx)(KL,{model:e,task:t,narrow:r}),n.kind===`chat`&&(0,H.jsx)(UB,{model:e,task:t,active:!0}),n.kind===`quota`&&(0,H.jsx)(pL,{model:e,task:t,active:!0}),n.kind===`file`&&(0,H.jsx)(yB,{model:e,view:{taskId:t.id,path:n.path,scope:`working`,file:!0},active:!0,restored:i,onClose:()=>Vc(t.id,`file`)},`${t.id}:file:${n.path}:${n.at??``}`),n.kind===`diff`&&(0,H.jsx)(yB,{model:e,view:{taskId:t.id,path:n.path,scope:n.scope},active:!0,restored:i,onClose:()=>Vc(t.id,`diff`)},`${t.id}:${n.path}:${n.scope}:${n.at??``}`)]})}function XB({taskId:e,kinds:t,index:n,body:r,slot:i}){V();let a=(0,h.useRef)(null);return(0,H.jsx)(`div`,{className:dr,style:{gridColumn:i},title:B(`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=$s(r.widths,n,t.clientX-r.x,220);Pc(e,e=>Zs(e,i))},onLostPointerCapture:()=>{a.current=null,r.current?.classList.remove(`is-resizing`)},onDoubleClick:()=>Pc(e,Qs)})}function ZB({panel:e}){V();let t=(0,h.useRef)(null);return(0,H.jsx)(PF,{edge:`left`,title:B(`panel.resize`),onPointerDown:n=>{t.current={x:n.clientX,width:e.current?.getBoundingClientRect().width??0},e.current?.classList.add(`is-resizing`),n.currentTarget.setPointerCapture(n.pointerId),ue(!0)},onPointerMove:e=>{let n=t.current;if(!n||e.clientX===n.x)return;let r=DM.get()?0:MM(EM.get()??280);ic.set(sc(n.width-(e.clientX-n.x),r))},onLostPointerCapture:()=>{t.current=null,e.current?.classList.remove(`is-resizing`),ue(!1)},onDoubleClick:()=>ic.set(null)})}var QB=e=>e.kind===`diff`?`diff:${e.path}:${e.scope}`:e.kind===`file`?`file:${e.path}`:e.kind;function $B({model:e,task:t,narrow:n}){V();let r=Ac(t.id),i=y(tc),a=y(oc),o=(0,h.useRef)(null),s=(0,h.useRef)(null),c=i===`terminal`?`files`:i,l=n?Rs(r,c):void 0;(0,h.useEffect)(()=>{n&&!l&&Pc(t.id,e=>Us(e,c))},[n,l,c,t.id]);let u=n?l?[l]:[]:r.columns,d=u.map(e=>e.kind),f=(n?[1]:Xs(r)).map((e,t)=>`${t>0?`var(--divider) `:``}minmax(0, ${e}fr)`).join(` `),p=(0,h.useRef)(u.map(QB));return(0,H.jsxs)(`aside`,{className:$n(n),ref:o,children:[!n&&!a&&(0,H.jsx)(ZB,{panel:o}),(0,H.jsxs)(`div`,{className:er,ref:s,style:{gridTemplateColumns:f},children:[u.map(r=>(0,H.jsxs)(`section`,{className:tr,"data-kind":r.kind,style:{gridColumn:2*d.indexOf(r.kind)+1},children:[(0,H.jsx)(qB,{taskId:t.id,column:r,narrow:n}),(0,H.jsx)(YB,{model:e,task:t,column:r,narrow:n,restored:p.current.includes(QB(r))})]},r.kind)),!n&&u.slice(1).map((e,n)=>(0,H.jsx)(XB,{taskId:t.id,kinds:d,index:n,body:s,slot:2*n+2},`divider:${e.kind}`))]})]})}function eV({model:e,task:t,remoteHost:n,narrow:r=!1}){let i=y(N),a=jc(t?.id??null);return!r&&(i||!a)?null:t?(0,H.jsx)($B,{model:e,task:t,narrow:r},t.id):n?(0,H.jsx)(`aside`,{className:$n(!1),children:(0,H.jsx)(Xm,{host:n,onMachines:()=>Kv(e)})}):null}var tV=1500;function nV({model:e}){let t=e.client,n=y(t.conn),[r,i]=(0,h.useState)(!1);return(0,h.useEffect)(()=>{if(n.state!==`connecting`)return i(!1);let e=window.setTimeout(()=>i(!0),tV);return()=>window.clearTimeout(e)},[n.state]),n.state===`open`||n.state===`connecting`&&!r?null:(0,H.jsxs)(`footer`,{className:Ln,children:[(0,H.jsx)(`span`,{className:Rn(n.state===`retrying`)}),(0,H.jsx)(`span`,{children:n.state===`retrying`?B(`status.retrying`,{count:n.failures}):B(`status.connecting`)}),n.state===`retrying`&&(0,H.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>t.retryNow(),children:B(`status.retry`)})]})}var rV=`rove.web.update.skipped`,iV=`rove.web.update.askedAt`;function aV(e){return!e.latest||!e.notify||e.latest===e.skipped||e.askedAt!==null&&e.now-e.askedAt<18e6?null:e.latest}function oV(){let e=_S.get(),t=aV({latest:e?.info?.hasUpdate?e.info.latest:null,notify:_p.get().prefs.updateNotify,skipped:localStorage.getItem(rV),askedAt:Number(localStorage.getItem(iV))||null,now:Date.now()});!t||C.get()!==null||(localStorage.setItem(iV,String(Date.now())),C.set((0,H.jsx)(sV,{current:e?.current??``,latest:t,notes:e?.notes??[]})))}function sV(e){let[t]=e.notes;return(0,H.jsx)(Si,{title:B(`updatePrompt.title`,{version:e.latest}),wide:e.notes.length>0,children:(0,H.jsxs)(`div`,{className:Gr,children:[(0,H.jsx)(`p`,{className:`text-muted`,children:B(`updatePrompt.body`,{current:e.current})}),e.notes.length===1&&t?(0,H.jsx)(gS,{body:t.body}):(0,H.jsx)(wS,{notes:e.notes}),(0,H.jsxs)(`div`,{className:Nr,children:[(0,H.jsx)(U,{onClick:()=>{localStorage.setItem(rV,e.latest),z()},children:B(`updatePrompt.skip`)}),(0,H.jsx)(U,{onClick:z,children:B(`updatePrompt.later`)}),(0,H.jsx)(U,{variant:`filled`,autoFocus:!0,onClick:()=>{z(),vS.set(!0),he(`update`)},children:B(`updatePrompt.yes`)})]})]})})}function cV({model:e,taskId:t,groupId:n}){V();let r=y(e.tasks),i=r?oE(r.tasks,n):[];return i.length<2||!i.some(e=>e.id===t)?null:(0,H.jsxs)(`nav`,{className:VE,"aria-label":B(`compare.menu`),children:[i.map((n,r)=>(0,H.jsxs)(U,{variant:`pill`,hit:`tight`,"aria-current":n.id===t,onClick:()=>e.select(n.id),children:[`[ `,(0,H.jsx)(Vh,{status:n.rowStatus}),r+1,` `,n.engine?.name??n.label,n.kept&&(0,H.jsx)(`span`,{className:`text-accent`,children:`✓`}),` ]`]},n.id)),(0,H.jsx)(U,{hit:`tight`,className:`ml-auto flex-none whitespace-nowrap`,onClick:()=>ge(n),children:B(`compare.strip`)})]})}var lV=e=>fA(e)!==null,uV=e=>Gd(fA(e)?.tab.split);function dV(e){let t=fA(e),n=t?.tab.split;return t&&n?{...t,split:n,leaf:lA(t.taskId,t.tab,n)}:null}Co(()=>[{id:`workspace.split.right`,chords:[`ctrl+\\`],prefix:!1,surface:`workspace`,live:lV,run:e=>{let t=fA(e);t&&mA(e,t.taskId,t.tab,`right`)}},{id:`workspace.split.down`,chords:[`ctrl+=`],prefix:!1,surface:`workspace`,live:lV,run:e=>{let t=fA(e);t&&mA(e,t.taskId,t.tab,`down`)}},{id:`workspace.split.focus-next`,chords:[`f3`],prefix:!1,surface:`workspace`,live:uV,run:e=>{let t=dV(e);t&&dA(t.taskId,t.tab,t.split,qd(t.split,t.leaf))}},{id:`workspace.split.close`,chords:[`w`],prefix:!0,surface:`workspace`,live:uV,run:e=>{let t=dV(e);t&&hA(e,t.taskId,t.tab,t.leaf)}},{id:`workspace.split.rename`,chords:[`f2`],prefix:!1,surface:`workspace`,live:uV,run:e=>{let t=dV(e);t&&gA(e,t.taskId,t.tab,t.leaf)}}]);var fV=[{id:`leaf-1`,x:0,y:0,w:1,h:1,left:!1,top:!1}];function pV({model:e,taskId:t,tab:n}){let r=n.split;y(cA);let i=r?lA(t,n,r):`leaf-1`,a=r?Jd(r,Hd(n)):new Map,o=Gd(r),{prefs:s}=wp(),c=y(e.tasks)?.tasks.find(e=>e.id===t)?.tabStatus?.[n.id]??n.status,l=n.kind===`engine`&&c?.reason===`dead`?c.since:null;(0,h.useEffect)(()=>{l!==null&&e.refreshTabsNow(t)},[l,e,t]);let u=l!==null&&n.alive!==!1?{code:n.exit?.code??null,since:l}:null,d=n.kind===`engine`&&c?.reason===`rate_limited`?{since:c.since}:null;return(0,H.jsx)(`div`,{className:Zt,children:(r?Kd(r.root):fV).map(c=>(0,H.jsxs)(`div`,{className:en(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,H.jsx)(SI,{client:e.client,model:e,engineExit:c.id===`leaf-1`?u:null,usageLimit:c.id===`leaf-1`?d:null,composer:n.kind===`engine`&&c.id===`leaf-1`,taskId:t,tabId:n.id,leafId:c.id,focused:c.id===i,onActivate:()=>r&&uA(t,n.id,r,c.id),onExit:()=>{o?pA(e,{taskId:t,tabId:n.id,action:`close`,leafId:c.id}):n.kind!==`engine`&&e.closeTab(t,n.id).catch(()=>{})}}),o&&(0,H.jsx)(`span`,{className:tn(s.splitStyle===`rule`,c.id===i),onContextMenu:r=>_F(r,yA(e,t,n,c.id)),children:a.get(c.id)})]},c.id))})}var mV=/^[0-9a-f]{7,40}$/i;function hV(e,t){return t.sharesWorkspaceOf||!t.baseRef?null:e.find(e=>e.id!==t.id&&e.branch!==``&&e.branch===t.baseRef)||(mV.test(t.baseRef)&&t.parentTaskId?e.find(e=>e.id===t.parentTaskId)??null:null)}function gV(e,t){let n=[];for(let r=hV(e,t);r&&n.length<20&&!n.includes(r);r=hV(e,r))n.unshift(r);let r=e.filter(n=>!n.deleting&&hV(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&&!mV.test(i.baseRef)?i.baseRef:null;return{nodes:[...n,t,...r],at:n.length,base:a}}var _V=e=>e.pr?.lifecycle===`merged`;function vV(e){return e.nodes.find(e=>!_V(e))??null}function yV({model:e,taskId:t}){V();let n=y(e.tasks)?.tasks??[],r=n.find(e=>e.id===t),i=r?gV(n,r):null;if(!i)return null;let a=vV(i);return(0,H.jsxs)(`nav`,{className:VE,"aria-label":B(`compare.stackLabel`),children:[i.base&&(0,H.jsxs)(`span`,{className:`text-subtle`,children:[i.base,` ←`]}),i.nodes.map((n,r)=>(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-x-3.5`,children:[r>0&&(0,H.jsx)(`span`,{className:`text-subtle`,children:`←`}),(0,H.jsxs)(U,{variant:`pill`,hit:`tight`,"aria-current":n.id===t,onClick:()=>e.select(n.id),children:[`[ `,(0,H.jsx)(Vh,{status:n.rowStatus}),n.label||n.title,_V(n)?(0,H.jsx)(`span`,{className:`text-accent`,children:`✓`}):n.pr?.number?(0,H.jsx)(`span`,{children:`PR`}):null,` ]`]})]},n.id)),a&&!a.machine&&(0,H.jsx)(U,{hit:`tight`,className:`ml-auto flex-none whitespace-nowrap`,onClick:()=>void Cy(e,a),children:B(`compare.landBottom`)})]})}function bV(e,t){return e===`never`?!1:e!==`multipleOnly`||t>=2}function xV({taskId:e}){V();let t=Ac(e),n=y(N),r=jc(e)&&!n;return(0,H.jsx)(`div`,{className:ur,children:ec.map(n=>{let i=r&&!!Rs(t,n);return(0,H.jsx)(`button`,{type:`button`,className:Xn({on:i}),title:B(`panel.${n}`),"aria-label":B(`panel.${n}`),"aria-pressed":i,onClick:()=>Ic(e,n),children:(0,H.jsx)(CF,{children:wF[n]})},n)})})}function SV({model:e,task:t,tabs:n,narrow:r}){let i=y(e.selection),{prefs:a}=wp(),o=!bV(a.tabStrip,n.length);return(0,H.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,H.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=>_F(r,b(MA(e,t,n),B(`menu.more`))),children:[(0,H.jsx)(`span`,{className:`text-subtle group-aria-selected/tab:text-accent`,children:r+1}),Hd(n)]},n.id)),!r&&(0,H.jsx)(xV,{taskId:t.id})]})}function CV(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??e))}function wV({model:e}){let t=V()===`zh`?$i:Qi,n=e.client,[r,i]=(0,h.useState)(()=>(X(n,`worktrees.list`,{network:!0})??X(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=>Ku(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&&L(CV(t.delete.residue,i.residue)),g()}catch(n){o(t=>t.filter(t=>t!==e.path));let i=n&&typeof n==`object`&&`code`in n?n.code:null;if(!r&&i===`DIRTY_WORKTREE`){C.set((0,H.jsx)(Ti,{title:t.delete.forceTitle,body:`${CV(t.delete.forceBody,{branch:e.branch||e.path})}\n\n${CV(t.delete.forceReason,{reason:G(n)})}`,confirmLabel:t.delete.button,onConfirm:()=>_(e,!0)}));return}L(CV(t.delete.failed,{error:G(n)}),`error`)}},v=e=>C.set((0,H.jsx)(Ti,{title:t.delete.confirmTitle,body:CV(t.delete.confirmBody,{branch:e.branch||e.path}),confirmLabel:t.delete.button,onConfirm:async()=>{_(e,!1)}})),y=n=>{if(!n.taskId){L(t.land.noTask,`error`);return}Cy(e,{id:n.taskId,title:n.branch,branch:n.branch},g)},b=e=>{if(e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.toLowerCase()===`c`&&!window.getSelection()?.toString())return e.preventDefault(),O.set(null);if(e.metaKey||e.ctrlKey||e.altKey)return;let t=p[m];if(e.key===`j`||e.key===`ArrowDown`)c(Math.min(p.length-1,m+1));else if(e.key===`k`||e.key===`ArrowUp`)c(Math.max(0,m-1));else if(e.key===`d`&&t)v(t);else if(e.key===`l`&&t)y(t);else if(e.key===`q`||e.key===`Escape`)O.set(null);else return;e.preventDefault()},x=0;return(0,H.jsxs)(`div`,{className:jx,tabIndex:0,ref:d,onKeyDown:b,children:[(0,H.jsx)(`h1`,{className:Mx,children:t.title}),r===null?(0,H.jsx)(`p`,{className:`text-muted`,children:t.loading}):f.length===0?(0,H.jsx)(`p`,{className:`text-muted`,children:t.noProjects}):f.map(e=>{let n=x;return x+=e.worktrees.length,(0,H.jsxs)(`section`,{className:aS,children:[(0,H.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,H.jsx)(`span`,{children:e.repo}),(0,H.jsx)(`span`,{className:`rule`})]}),e.worktrees.length===0&&(0,H.jsx)(`p`,{className:`mono text-muted`,children:t.noWorktrees}),e.worktrees.map((e,r)=>{let i=n+r;return(0,H.jsxs)(`div`,{"data-row":i,className:oS(i===m),onClick:()=>c(i),children:[(0,H.jsxs)(`div`,{className:sS,children:[(0,H.jsx)(`span`,{className:lS,children:e.branch||t.row.detached}),e.roveManaged&&(0,H.jsx)(`span`,{className:`chip text-muted`,children:t.badge.roveManaged}),e.dirty===!0&&(0,H.jsx)(`span`,{className:`chip text-warning`,children:t.badge.dirty}),e.dirty===null&&(0,H.jsx)(`span`,{className:`chip text-muted`,children:t.badge.dirtyUnknown}),(0,H.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,H.jsx)(`span`,{className:`chip ${e.verdict===`merged`?`text-success`:e.verdict===`stale`?`text-warning`:`text-accent`}`,children:t.verdict[e.verdictReason]??e.verdictReason})]}),(0,H.jsxs)(`div`,{className:`${cS} mono text-muted`,children:[(0,H.jsx)(`span`,{className:uS,children:e.path}),e.createdAtMs>0&&(0,H.jsx)(`span`,{children:CV(t.row.created,{age:Ml(Date.now()-e.createdAtMs)})})]}),i===m&&(0,H.jsxs)(`div`,{className:`flex items-baseline gap-2 text-[length:var(--fs-body)]`,children:[(0,H.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>v(e),children:t.delete.button}),e.taskId&&(0,H.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>y(e),children:t.land.button})]})]},e.path)})]},e.repo)}),(0,H.jsx)(`p`,{className:`${dS} mono keys-only text-muted`,children:(0,H.jsx)(cp,{text:`j/k · d ${t.delete.button} · l ${t.land.button} · q/esc`})})]})}function TV({model:e,narrow:t}){let n=y(e.selection),r=y(e.tabs),i=y(e.tasks),a=y(e.remote),o=a.find(e=>e.id===n.taskId&&!e.machine?.stale),s=lo(i,n.taskId)??o??null,c=o?void 0:a.find(e=>e.id===n.taskId),l=s?r[s.id]??[]:[],u=s?s.id in r:!1,d=y(O),f=bC(s?.id),p=s?.rowStatus?.kind===`running`,m=y(F),g=y(tc)!==`terminal`&&t&&!!s;return(0,h.useEffect)(()=>{let t=e.selection.get();return e.selection.subscribe(()=>{O.set(null),F.set(null);let n=e.selection.get();(n.taskId!==t.taskId||n.tabId!==t.tabId)&&tc.set(`terminal`),t=n})},[e]),(0,h.useEffect)(()=>iE(e),[e]),d===`update`?(0,H.jsxs)(`main`,{className:`${Dn} ${Ut}`,children:[t&&(0,H.jsx)(BF,{}),(0,H.jsx)(DS,{client:e.client})]}):d===`worktrees`?(0,H.jsxs)(`main`,{className:`${Dn} ${Ut}`,children:[t&&(0,H.jsx)(BF,{}),(0,H.jsx)(wV,{model:e})]}):d?(0,H.jsxs)(`main`,{className:`${Dn} ${Ut}`,children:[t&&(0,H.jsx)(BF,{}),(0,H.jsx)(Lj,{model:e,page:d})]}):m?(0,H.jsxs)(`main`,{className:`${Dn} ${Ut}`,children:[t&&(0,H.jsx)(BF,{}),(0,H.jsx)(`div`,{className:On,children:(0,H.jsx)(wv,{model:e,seed:m},a_(m))})]}):(0,H.jsxs)(`main`,{className:`${Dn} ${Ut}`,children:[t&&(0,H.jsx)(BF,{taskId:s?.id,title:s?.title}),s&&(0,H.jsx)(SV,{model:e,task:s,tabs:l,narrow:t}),s&&!s.groupId&&(0,H.jsx)(yV,{model:e,taskId:s.id}),s?.groupId&&(0,H.jsx)(cV,{model:e,taskId:s.id,groupId:s.groupId}),(0,H.jsxs)(`div`,{className:`${On} ${p?kn:``}`,style:f?{"--task-ink":f}:void 0,children:[!t&&!s&&!c&&i&&i.tasks.length+a.length===0&&(0,H.jsx)(gF,{model:e}),!s&&!c&&i&&i.tasks.length+a.length>0&&(0,H.jsx)(`p`,{className:Tn,children:B(`workspace.pickTask`)}),c?.machine&&(0,H.jsx)(`div`,{className:En,children:(0,H.jsx)(Xm,{host:c.machine.label,onMachines:()=>Kv(e)})}),s&&u&&l.length===0&&!g&&(0,H.jsxs)(`div`,{className:En,children:[(0,H.jsx)(`p`,{children:B(`workspace.noTabs`)}),(0,H.jsx)(U,{variant:`filled`,onClick:()=>void ad(e,s.id,{kind:`engine`}).catch(e=>L(String(e),`error`)),children:s.engine?B(`workspace.startEngine`,{engine:s.engine.name}):B(`workspace.startSession`)}),` `,(0,H.jsx)(U,{variant:`filled`,onClick:()=>void id(e,s.id),children:B(`menu.newChat`)}),` `,(0,H.jsx)(U,{variant:`filled`,onClick:()=>C.set((0,H.jsx)(ud,{model:e,taskId:s.id})),children:B(`menu.newChatPick`)})]}),s&&g&&(0,H.jsx)(eV,{model:e,task:s,narrow:!0}),s&&n.tabId&&l.some(e=>e.id===n.tabId)&&(0,H.jsx)(`div`,{className:`min-w-0 flex-1 ${g?`hidden`:`flex`}`,children:(0,H.jsx)(pV,{model:e,taskId:s.id,tab:l.find(e=>e.id===n.tabId)??l[0]},`${s.id}::${n.tabId}`)})]})]})}function EV({model:e}){V();let t=y(e.client.conn);return t.hello===null&&t.failures>=2?(0,H.jsx)(DV,{}):(0,H.jsx)(OV,{model:e})}function DV(){let[e,t]=(0,h.useState)(null);return(0,h.useEffect)(()=>{ss().then(t)},[]),e===null?null:e?(0,H.jsx)(fs,{}):(0,H.jsx)(Pr,{failing:!0})}function OV({model:e}){FT(e);let t=y(e.client.conn).hello;(0,h.useEffect)(()=>{if(!t)return;jS(e.client,t.roveVersion);let n=()=>void SS(e.client).then(oV);n();let r=window.setInterval(n,36e5);return()=>window.clearInterval(r)},[t,e.client]),(0,h.useEffect)(()=>{t&&is(e)},[t,e]),df(e),cf(e),zo(),ha(e.client),WT(e),Oa(e.client),KC(e.client),(0,h.useEffect)(()=>{e.onSelect=pe;let t=F.subscribe(()=>{F.get()!==null&&pe()});return ne(),t},[e]),(0,h.useEffect)(()=>zw(e),[e]);let n=y(N),r=y(e.selection),i=y(e.tasks),a=y(e.remote),o=Se(),s=y(DM),c=y(OM),l=y(EM),u=y(fe),d=y(Oe)===`app`,f=y(ic),p=y(oc),m=y(O),g=y(se)===`drag`,_=y(F)!==null,v=a.find(e=>e.id===r.taskId&&!e.machine?.stale),b=lo(i,r.taskId)??v??null,x=v?void 0:a.find(e=>e.id===r.taskId),S=jc(b?.id??null),C=Ac(b?.id??``).columns.length,w=o?Ce(u,!!b||!!x,m!==null||_):null;(0,h.useEffect)(()=>e.setTaskShown(w===null||w===`content`&&m===null&&!_),[e,w,m,_]);let T=MM(l??280),E=f===null?null:sc(f,s?0:T),D=Math.max(1,C),k=`max(280px, min(calc((100% - var(--rail-w)) * ${D} / ${D+2}), calc(100% - var(--rail-w) - 320px)))`,A={"--rail-w":`${s?0:T}px`,"--rail-open-w":`${T}px`,"--panel-w":E===null?k:`${E}px`};return(0,H.jsxs)(`div`,{className:Bt,children:[(0,H.jsx)(Aa,{onRefresh:()=>ka(e.client)}),(0,H.jsxs)(`div`,{className:Vt({zen:n||!S||!b&&!x||o,expanded:p&&S&&!n&&!o,surface:w&&d?`back`:w,folded:s&&!o,peek:s&&c&&!o,dragging:g}),style:o?void 0:A,children:[!o&&(0,H.jsx)(RF,{model:e}),s&&!o&&(0,H.jsx)(`div`,{className:`absolute inset-y-0 left-0 z-5 col-1 row-1 w-2.5`,title:B(`layout.railUnfold`),onMouseEnter:()=>jM(!0),onMouseLeave:()=>jM(!1),onMouseUp:()=>DM.set(!1)}),(0,H.jsx)(vF,{model:e,narrow:o}),(0,H.jsx)(TV,{model:e,narrow:o}),!o&&(0,H.jsx)(eV,{model:e,task:b,remoteHost:x?.machine?.label}),(0,H.jsx)(nV,{model:e}),(0,H.jsx)(vs,{}),(0,H.jsx)(BT,{model:e}),(0,H.jsx)(mo,{model:e})]})]})}var kV=`a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`;function AV(e){return[...e.querySelectorAll(kV)].filter(e=>e.tabIndex>=0&&e.offsetParent!==null)}function jV(){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=AV(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 MV(e){if(!oe())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 NV(e){for(let t of document.querySelectorAll(`${e}.is-leaving`))t.remove()}function PV(){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 FV(){let e=C.get(),t=-1/0;C.subscribe(()=>{let n=C.get();if(n===null&&e!==null)t=performance.now(),MV(`.overlay`);else if(n!==null){let n=e!==null||performance.now()-t<140;NV(`.overlay`),n&&requestAnimationFrame(PV)}e=n});let n=S.get();S.subscribe(()=>{let e=S.get();e===null&&n!==null?MV(`.menu`):e!==null&&NV(`.menu`),n=e});let r=bf.get().guide;bf.subscribe(()=>{let e=bf.get().guide;e===null&&r!==null?MV(`.prefix-guide`):e!==null&&NV(`.prefix-guide`),r=e})}var IV=500,LV=10,RV=`input, textarea, select, [contenteditable], .xterm`,zV=[`mousedown`,`mouseup`,`click`,`contextmenu`];function BV(){let e=null,t=()=>{e&&window.clearTimeout(e.timer),e=null},n=()=>{let e=e=>{e.preventDefault(),e.stopPropagation()},t=()=>{for(let t of zV)document.removeEventListener(t,e,!0);document.removeEventListener(`pointerdown`,t,!0),document.removeEventListener(`keydown`,t,!0)};for(let t of zV)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(RV))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())},IV)};e=a},!0),document.addEventListener(`pointermove`,n=>{e&&Math.hypot(n.clientX-e.x,n.clientY-e.y)>LV&&t()},!0),document.addEventListener(`pointerup`,t,!0),document.addEventListener(`pointercancel`,t,!0),document.addEventListener(`contextmenu`,t=>{e&&t.isTrusted&&(e.native=!0)},!0)}function VV(e,t){e.viewingExtras=()=>uc({narrow:be(),panelOpen:Mc(e.selection.get().taskId),zen:N.get()});let n=()=>e.reportViewing();ac.subscribe(n),Nc(n),N.subscribe(n),F.subscribe(n),O.subscribe(n),xe(n),t.on(`panel`,t=>{lc(t)&&Wc(t,e.selection.get().taskId)})}function HV(e){let t=e;return!!t&&typeof t.promptId==`string`&&typeof t.title==`string`}function UV({client:e,prompt:t}){let n=(V()===`zh`?ki:Oi).prompt,[r,i]=(0,h.useState)(t.initial??``),a=(0,h.useRef)(!1),{busy:o,error:s,submit:c}=Ci();return(0,h.useEffect)(()=>()=>{a.current||e.request(`ui.promptReply`,{promptId:t.promptId}).catch(()=>{})},[e,t.promptId]),(0,H.jsx)(Si,{title:t.title,children:(0,H.jsxs)(`form`,{className:Gr,onSubmit:n=>{n.preventDefault(),c(async()=>{await e.request(`ui.promptReply`,{promptId:t.promptId,value:r}),a.current=!0})},children:[(0,H.jsx)(`input`,{className:Mr,"aria-label":n.fieldLabel,autoFocus:!0,spellCheck:!1,value:r,placeholder:t.placeholder,onChange:e=>i(e.target.value)}),s&&(0,H.jsx)(`p`,{className:`text-error`,children:s}),(0,H.jsx)(Di,{busy:o,submitLabel:n.submitLabel})]})})}function WV(e,t){C.get()||C.set((0,H.jsx)(UV,{client:e,prompt:t},t.promptId))}var GV=900,KV=new WeakMap;function qV(e){e.setAttribute(`data-scrolling`,``),window.clearTimeout(KV.get(e)),KV.set(e,window.setTimeout(()=>e.removeAttribute(`data-scrolling`),GV))}function JV(){document.addEventListener(`scroll`,e=>{let t=e.target instanceof Element?e.target:document.scrollingElement;t&&qV(t)},{capture:!0,passive:!0})}var YV=`rove-web.reloadedFor`;function XV(e,t,n){return e===null?`adopt`:t===e||t===n?`stay`:`reload`}function ZV(){let e=null;try{e=window.sessionStorage}catch{}return{storage:e,reload:()=>window.location.reload()}}function QV(e,t=ZV()){let n=null,r=null,i=()=>{try{return t.storage?.getItem(YV)??r}catch{return r}};return e.conn.subscribe(()=>{let{state:a,hello:o}=e.conn.get();if(a!==`open`||!o)return;let s=XV(n,o.roveVersion,i());if(s===`adopt`&&(n=o.roveVersion),s===`reload`){r=o.roveVersion;try{t.storage?.setItem(YV,o.roveVersion)}catch{}t.reload()}})}function $V(){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 eH=(0,g.createRoot)(document.getElementById(`root`));$V(),BV(),Pe(),JV(),FV(),jV(),VP();function tH(e){let t=new qo(Jo(),e),n=new fo(t);t.on(`prompt`,e=>{HV(e)&&WV(t,e)}),VV(n,t),QV(t),t.start(),eH.render((0,H.jsx)(h.StrictMode,{children:(0,H.jsx)(EV,{model:n})}))}var nH=i();nH?tH(nH):Promise.all([cs(),ss()]).then(([e,t])=>{e?tH(``):eH.render((0,H.jsx)(h.StrictMode,{children:t?(0,H.jsx)(fs,{}):(0,H.jsx)(Pr,{})}))});export{_p as a,rp as c,Uo as d,Nn as f,se as h,oC as i,np as l,M as m,fI as n,tp as o,Fn as p,uI as r,ep as s,qV as t,qu as u};
82
+ `)}\n`}var OB=50;function kB(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:OB,...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=bB(pB,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:G(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:bB(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:bB(e.transcript,n.history?.messages??[],n.history?.firstIndex??0),older:n.olderCursor??null}:e)}catch(e){t===c.current&&r({kind:`error`,message:G(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=bB(i,t.messages,t.firstIndex),r=e.olderCursor??null}return t===c.current?(r(e=>e.kind===`ready`?{...e,transcript:n.reduce((e,t)=>bB(e,t.messages,t.firstIndex),e.transcript),older:null}:e),i):null}catch(e){return t===c.current&&r({kind:`error`,message:G(e)}),null}finally{t===c.current&&(s.current=!1,a(!1))}},[l]),refresh:d,reload:(0,h.useCallback)(()=>{r({kind:`loading`}),u()},[u])}}var AB=3e3,jB=80,MB=2500;function NB(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 PB=e=>{let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})};function FB(e){let{entry:t}=e,n=B(t.role===`user`?`transcript.you`:t.role===`assistant`?`transcript.agent`:`transcript.system`);return(0,H.jsxs)(`article`,{className:fR(e),"data-index":t.index,children:[(0,H.jsxs)(`header`,{className:pR,children:[(0,H.jsx)(`span`,{className:mR(t.role),children:n}),(0,H.jsx)(`span`,{className:hR,children:PB(t.at)}),(0,H.jsx)(U,{className:gR,onClick:e.onCopy,children:B(`transcript.copy`)})]}),t.text!==``&&(0,H.jsx)(LR,{source:t.text,needle:e.needle}),t.tools.map((t,n)=>(0,H.jsxs)(`p`,{className:_R,title:`${t.name} ${t.summary}`,children:[(0,H.jsx)(`span`,{className:vR,children:jR(t.name,e.needle)}),(0,H.jsx)(`span`,{className:yR,children:jR(t.summary,e.needle)}),e.failed.has(t.callId)&&(0,H.jsx)(`span`,{className:`flex-none text-error`,children:B(`transcript.failed`)})]},n))]})}function IB({model:e,task:t,active:n}){V();let r=kB(e,t.id),{state:i}=r,[a,o]=(0,h.useState)(``),[s,c]=(0,h.useState)(0),[l,u]=(0,h.useState)(null),d=(0,h.useRef)(null),f=(0,h.useRef)(!0),p=(0,h.useRef)(null),m=y(My),g=i.kind===`ready`?i:null,_=(0,h.useMemo)(()=>g?.transcript.entries??[],[g?.transcript]),v=g?.transcript.failed??new Set,b=(0,h.useMemo)(()=>xB(_,a),[_,a]),x=b.length===0?0:Math.min(s,b.length-1),S=b[x]??null,C=e=>{f.current=!1,d.current?.querySelector(`[data-index="${e}"]`)?.scrollIntoView({block:`center`})},w=t.rowStatus?.kind,T=w===`running`||w===`needs-input`,{refresh:E}=r;(0,h.useEffect)(()=>{n&&E()},[n,w,E]),(0,h.useEffect)(()=>{if(!n||!T)return;let e=setInterval(()=>void E(),AB);return()=>clearInterval(e)},[n,T,E]),(0,h.useLayoutEffect)(()=>{let e=d.current;e&&(p.current?(e.scrollTop=p.current.top+(e.scrollHeight-p.current.height),p.current=null):f.current&&(e.scrollTop=e.scrollHeight))},[_]);let D=async()=>{let e=d.current;e&&(p.current={height:e.scrollHeight,top:e.scrollTop}),await r.loadOlder()};(0,h.useEffect)(()=>{if(!m||m.taskId!==t.id||!g||!n)return;let e=CB(_,m.hit);e===null?g.older&&wB(_,m.hit)?D():My.set(null):(u(e),C(e),My.set(null))},[m,g,_,n,t.id]),(0,h.useEffect)(()=>{if(l===null)return;let e=setTimeout(()=>u(null),MB);return()=>clearTimeout(e)},[l]),(0,h.useEffect)(()=>{c(0);let e=xB(_,a)[0];e!==void 0&&C(e)},[a]);let O=e=>{if(b.length===0)return;let t=(x+e+b.length)%b.length;c(t),C(b[t])},k=e=>{e.key===`Enter`&&!e.nativeEvent.isComposing?(e.preventDefault(),O(e.shiftKey?-1:1)):e.key===`Escape`&&a!==``&&(e.stopPropagation(),o(``))},A=e=>void navigator.clipboard.writeText(EB(e,v)).then(()=>L(B(`transcript.copied`)),()=>L(B(`menu.copyFailed`),`error`)),j=async()=>{let e=await r.loadAll();if(!e)return;let n={user:B(`transcript.you`),assistant:B(`transcript.agent`),system:B(`transcript.system`)};NB(`${t.label.replace(/[^\p{L}\p{N}]+/gu,`-`).replace(/^-|-$/g,``)||`conversation`}.md`,DB(t.label,e.entries,e.failed,n))};return i.kind===`loading`?(0,H.jsx)(`div`,{className:oR,children:(0,H.jsx)(`p`,{className:uR,children:B(`transcript.loading`)})}):i.kind===`error`?(0,H.jsxs)(`div`,{className:oR,children:[(0,H.jsx)(`p`,{className:`${uR} text-error`,children:B(`transcript.error`,{error:i.message})}),(0,H.jsx)(`p`,{className:uR,children:(0,H.jsx)(U,{onClick:r.reload,children:B(`transcript.retry`)})})]}):i.kind===`terminal`?(0,H.jsxs)(`div`,{className:oR,children:[(0,H.jsx)(`p`,{className:uR,children:B(`transcript.noHistory`)}),(0,H.jsx)(`pre`,{className:`${dR} min-h-0 flex-1 overflow-y-auto`,children:i.tail.join(`
83
+ `)})]}):(0,H.jsxs)(`div`,{className:oR,children:[(0,H.jsxs)(`div`,{className:sR,children:[(0,H.jsx)(`input`,{className:`${Mr} ${cR}`,value:a,placeholder:B(`transcript.findPlaceholder`),"aria-label":B(`transcript.findPlaceholder`),spellCheck:!1,autoComplete:`off`,onChange:e=>o(e.target.value),onKeyDown:k}),a.trim()!==``&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`whitespace-nowrap text-muted`,children:b.length===0?B(`transcript.findNone`):B(`transcript.findCount`,{at:x+1,total:b.length})}),(0,H.jsx)(U,{onClick:()=>O(-1),disabled:b.length===0,children:B(`transcript.prev`)}),(0,H.jsx)(U,{onClick:()=>O(1),disabled:b.length===0,children:B(`transcript.next`)})]}),(0,H.jsx)(U,{onClick:()=>void j(),disabled:_.length===0,children:B(`transcript.export`)})]}),(0,H.jsxs)(`div`,{ref:d,className:lR,onScroll:e=>{let t=e.currentTarget;f.current=t.scrollHeight-t.scrollTop-t.clientHeight<jB,t.scrollTop<jB&&g?.older&&!r.paging&&D()},children:[g?.older&&(0,H.jsx)(`p`,{className:`m-0 px-3 py-2 font-mono text-meta text-subtle`,children:(0,H.jsx)(U,{onClick:()=>void D(),disabled:r.paging,children:B(`transcript.older`)})}),_.length===0&&(0,H.jsx)(`p`,{className:`m-0 px-3 py-2 font-mono text-meta text-subtle`,children:B(`transcript.empty`)}),_.map(e=>(0,H.jsx)(FB,{entry:e,failed:v,needle:a,flash:l===e.index,current:S===e.index,onCopy:()=>A(e)},e.index))]})]})}var LB={working:`review.scopeWorking`,branch:`review.scopeBranch`,task:`review.scopeTask`};function RB(e){return e.kind===`file`?{text:zs(e.path),hint:e.path}:e.kind===`diff`?e.path===`.`?{text:B(LB[e.scope]),hint:B(`preview.whole`)}:{text:zs(e.path),hint:e.path}:{text:B(`panel.${e.kind}`),hint:B(`panel.${e.kind}`)}}function zB({taskId:e,kind:t,expand:n}){V();let r=y(oc),i=B(r?`panel.restore`:`panel.expand`);return(0,H.jsxs)(H.Fragment,{children:[n&&(0,H.jsx)(`button`,{type:`button`,className:Xn({tool:!0}),title:i,"aria-label":i,"aria-pressed":r,onClick:()=>oc.set(!r),children:(0,H.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,H.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,H.jsx)(`button`,{type:`button`,className:Xn({tool:!0}),title:B(`panel.close`),"aria-label":B(`panel.close`),onClick:()=>Vc(e,t),children:(0,H.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:`M4 4l8 8M12 4l-8 8`})})})]})}function BB({taskId:e,column:t,narrow:n}){if(V(),t.kind===`browser`)return(0,H.jsxs)(`div`,{className:nr(n),children:[(0,H.jsx)(EF,{taskId:e,column:t}),!n&&(0,H.jsx)(zB,{taskId:e,kind:`browser`,expand:!0})]});if(n&&t.kind!==`diff`)return null;let{text:r,hint:i}=RB(t);return(0,H.jsxs)(`div`,{className:nr(n),children:[(0,H.jsx)(`span`,{className:rr,title:i,children:r}),(0,H.jsx)(zB,{taskId:e,kind:t.kind,expand:!n})]})}function VB({model:e,task:t,column:n}){let r=(0,h.useRef)([]);return r.current=Ns(r.current,n.active,n.tabs),n.tabs.filter(e=>r.current.includes(e.id)).map(r=>(0,H.jsx)(`div`,{className:fr,hidden:r.id!==n.active,children:(0,H.jsx)(PI,{model:e,taskId:t.id,tab:r,onNavigate:e=>Hc(t.id,t=>Ds(t,r.id,e)),onStep:e=>Hc(t.id,t=>Os(t,r.id,e))})},r.id))}function HB({model:e,task:t,column:n,narrow:r,restored:i}){return n.kind===`browser`?(0,H.jsx)(VB,{model:e,task:t,column:n}):(0,H.jsxs)(`div`,{className:fr,children:[n.kind===`files`&&(0,H.jsx)(zL,{model:e,task:t,narrow:r}),n.kind===`chat`&&(0,H.jsx)(IB,{model:e,task:t,active:!0}),n.kind===`quota`&&(0,H.jsx)(oL,{model:e,task:t,active:!0}),n.kind===`file`&&(0,H.jsx)(fB,{model:e,view:{taskId:t.id,path:n.path,scope:`working`,file:!0},active:!0,restored:i,onClose:()=>Vc(t.id,`file`)},`${t.id}:file:${n.path}:${n.at??``}`),n.kind===`diff`&&(0,H.jsx)(fB,{model:e,view:{taskId:t.id,path:n.path,scope:n.scope},active:!0,restored:i,onClose:()=>Vc(t.id,`diff`)},`${t.id}:${n.path}:${n.scope}:${n.at??``}`)]})}function UB({taskId:e,kinds:t,index:n,body:r,slot:i}){V();let a=(0,h.useRef)(null);return(0,H.jsx)(`div`,{className:dr,style:{gridColumn:i},title:B(`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=$s(r.widths,n,t.clientX-r.x,220);Pc(e,e=>Zs(e,i))},onLostPointerCapture:()=>{a.current=null,r.current?.classList.remove(`is-resizing`)},onDoubleClick:()=>Pc(e,Qs)})}function WB({panel:e}){V();let t=(0,h.useRef)(null);return(0,H.jsx)(DF,{edge:`left`,title:B(`panel.resize`),onPointerDown:n=>{t.current={x:n.clientX,width:e.current?.getBoundingClientRect().width??0},e.current?.classList.add(`is-resizing`),n.currentTarget.setPointerCapture(n.pointerId),ue(!0)},onPointerMove:e=>{let n=t.current;if(!n||e.clientX===n.x)return;let r=bM.get()?0:TM(yM.get()??280);ic.set(sc(n.width-(e.clientX-n.x),r))},onLostPointerCapture:()=>{t.current=null,e.current?.classList.remove(`is-resizing`),ue(!1)},onDoubleClick:()=>ic.set(null)})}var GB=e=>e.kind===`diff`?`diff:${e.path}:${e.scope}`:e.kind===`file`?`file:${e.path}`:e.kind;function KB({model:e,task:t,narrow:n}){V();let r=Ac(t.id),i=y(tc),a=y(oc),o=(0,h.useRef)(null),s=(0,h.useRef)(null),c=i===`terminal`?`files`:i,l=n?Rs(r,c):void 0;(0,h.useEffect)(()=>{n&&!l&&Pc(t.id,e=>Us(e,c))},[n,l,c,t.id]);let u=n?l?[l]:[]:r.columns,d=u.map(e=>e.kind),f=(n?[1]:Xs(r)).map((e,t)=>`${t>0?`var(--divider) `:``}minmax(0, ${e}fr)`).join(` `),p=(0,h.useRef)(u.map(GB));return(0,H.jsxs)(`aside`,{className:$n(n),ref:o,children:[!n&&!a&&(0,H.jsx)(WB,{panel:o}),(0,H.jsxs)(`div`,{className:er,ref:s,style:{gridTemplateColumns:f},children:[u.map(r=>(0,H.jsxs)(`section`,{className:tr,"data-kind":r.kind,style:{gridColumn:2*d.indexOf(r.kind)+1},children:[(0,H.jsx)(BB,{taskId:t.id,column:r,narrow:n}),(0,H.jsx)(HB,{model:e,task:t,column:r,narrow:n,restored:p.current.includes(GB(r))})]},r.kind)),!n&&u.slice(1).map((e,n)=>(0,H.jsx)(UB,{taskId:t.id,kinds:d,index:n,body:s,slot:2*n+2},`divider:${e.kind}`))]})]})}function qB({model:e,task:t,remoteHost:n,narrow:r=!1}){let i=y(N),a=jc(t?.id??null);return!r&&(i||!a)?null:t?(0,H.jsx)(KB,{model:e,task:t,narrow:r},t.id):n?(0,H.jsx)(`aside`,{className:$n(!1),children:(0,H.jsx)(Ym,{host:n,onMachines:()=>Gv(e)})}):null}var JB=1500;function YB({model:e}){let t=e.client,n=y(t.conn),[r,i]=(0,h.useState)(!1);return(0,h.useEffect)(()=>{if(n.state!==`connecting`)return i(!1);let e=window.setTimeout(()=>i(!0),JB);return()=>window.clearTimeout(e)},[n.state]),n.state===`open`||n.state===`connecting`&&!r?null:(0,H.jsxs)(`footer`,{className:Ln,children:[(0,H.jsx)(`span`,{className:Rn(n.state===`retrying`)}),(0,H.jsx)(`span`,{children:n.state===`retrying`?B(`status.retrying`,{count:n.failures}):B(`status.connecting`)}),n.state===`retrying`&&(0,H.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>t.retryNow(),children:B(`status.retry`)})]})}var XB=`rove.web.update.skipped`,ZB=`rove.web.update.askedAt`;function QB(e){return!e.latest||!e.notify||e.latest===e.skipped||e.askedAt!==null&&e.now-e.askedAt<18e6?null:e.latest}function $B(){let e=hS.get(),t=QB({latest:e?.info?.hasUpdate?e.info.latest:null,notify:_p.get().prefs.updateNotify,skipped:localStorage.getItem(XB),askedAt:Number(localStorage.getItem(ZB))||null,now:Date.now()});!t||C.get()!==null||(localStorage.setItem(ZB,String(Date.now())),C.set((0,H.jsx)(eV,{current:e?.current??``,latest:t,notes:e?.notes??[]})))}function eV(e){let[t]=e.notes;return(0,H.jsx)(Si,{title:B(`updatePrompt.title`,{version:e.latest}),wide:e.notes.length>0,children:(0,H.jsxs)(`div`,{className:Gr,children:[(0,H.jsx)(`p`,{className:`text-muted`,children:B(`updatePrompt.body`,{current:e.current})}),e.notes.length===1&&t?(0,H.jsx)(mS,{body:t.body}):(0,H.jsx)(SS,{notes:e.notes}),(0,H.jsxs)(`div`,{className:Nr,children:[(0,H.jsx)(U,{onClick:()=>{localStorage.setItem(XB,e.latest),z()},children:B(`updatePrompt.skip`)}),(0,H.jsx)(U,{onClick:z,children:B(`updatePrompt.later`)}),(0,H.jsx)(U,{variant:`filled`,autoFocus:!0,onClick:()=>{z(),gS.set(!0),he(`update`)},children:B(`updatePrompt.yes`)})]})]})})}function tV({model:e,taskId:t,groupId:n}){V();let r=y(e.tasks),i=r?iE(r.tasks,n):[];return i.length<2||!i.some(e=>e.id===t)?null:(0,H.jsxs)(`nav`,{className:zE,"aria-label":B(`compare.menu`),children:[i.map((n,r)=>(0,H.jsxs)(U,{variant:`pill`,hit:`tight`,"aria-current":n.id===t,onClick:()=>e.select(n.id),children:[`[ `,(0,H.jsx)(Bh,{status:n.rowStatus}),r+1,` `,n.engine?.name??n.label,n.kept&&(0,H.jsx)(`span`,{className:`text-accent`,children:`✓`}),` ]`]},n.id)),(0,H.jsx)(U,{hit:`tight`,className:`ml-auto flex-none whitespace-nowrap`,onClick:()=>ge(n),children:B(`compare.strip`)})]})}var nV=e=>uA(e)!==null,rV=e=>Gd(uA(e)?.tab.split);function iV(e){let t=uA(e),n=t?.tab.split;return t&&n?{...t,split:n,leaf:sA(t.taskId,t.tab,n)}:null}Co(()=>[{id:`workspace.split.right`,chords:[`ctrl+\\`],prefix:!1,surface:`workspace`,live:nV,run:e=>{let t=uA(e);t&&fA(e,t.taskId,t.tab,`right`)}},{id:`workspace.split.down`,chords:[`ctrl+=`],prefix:!1,surface:`workspace`,live:nV,run:e=>{let t=uA(e);t&&fA(e,t.taskId,t.tab,`down`)}},{id:`workspace.split.focus-next`,chords:[`f3`],prefix:!1,surface:`workspace`,live:rV,run:e=>{let t=iV(e);t&&lA(t.taskId,t.tab,t.split,qd(t.split,t.leaf))}},{id:`workspace.split.close`,chords:[`w`],prefix:!0,surface:`workspace`,live:rV,run:e=>{let t=iV(e);t&&pA(e,t.taskId,t.tab,t.leaf)}},{id:`workspace.split.rename`,chords:[`f2`],prefix:!1,surface:`workspace`,live:rV,run:e=>{let t=iV(e);t&&mA(e,t.taskId,t.tab,t.leaf)}}]);var aV=[{id:`leaf-1`,x:0,y:0,w:1,h:1,left:!1,top:!1}];function oV({model:e,taskId:t,tab:n}){let r=n.split;y(oA);let i=r?sA(t,n,r):`leaf-1`,a=r?Jd(r,Hd(n)):new Map,o=Gd(r),{prefs:s}=wp(),c=y(e.tasks)?.tasks.find(e=>e.id===t)?.tabStatus?.[n.id]??n.status,l=n.kind===`engine`&&c?.reason===`dead`?c.since:null;(0,h.useEffect)(()=>{l!==null&&e.refreshTabsNow(t)},[l,e,t]);let u=l!==null&&n.alive!==!1?{code:n.exit?.code??null,since:l}:null,d=n.kind===`engine`&&c?.reason===`rate_limited`?{since:c.since}:null;return(0,H.jsx)(`div`,{className:Zt,children:(r?Kd(r.root):aV).map(c=>(0,H.jsxs)(`div`,{className:en(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,H.jsx)(hI,{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&&cA(t,n.id,r,c.id),onExit:()=>{o?dA(e,{taskId:t,tabId:n.id,action:`close`,leafId:c.id}):n.kind!==`engine`&&e.closeTab(t,n.id).catch(()=>{})}}),o&&(0,H.jsx)(`span`,{className:tn(s.splitStyle===`rule`,c.id===i),onContextMenu:r=>uF(r,_A(e,t,n,c.id)),children:a.get(c.id)})]},c.id))})}var sV=/^[0-9a-f]{7,40}$/i;function cV(e,t){return t.sharesWorkspaceOf||!t.baseRef?null:e.find(e=>e.id!==t.id&&e.branch!==``&&e.branch===t.baseRef)||(sV.test(t.baseRef)&&t.parentTaskId?e.find(e=>e.id===t.parentTaskId)??null:null)}function lV(e,t){let n=[];for(let r=cV(e,t);r&&n.length<20&&!n.includes(r);r=cV(e,r))n.unshift(r);let r=e.filter(n=>!n.deleting&&cV(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&&!sV.test(i.baseRef)?i.baseRef:null;return{nodes:[...n,t,...r],at:n.length,base:a}}var uV=e=>e.pr?.lifecycle===`merged`;function dV(e){return e.nodes.find(e=>!uV(e))??null}function fV({model:e,taskId:t}){V();let n=y(e.tasks)?.tasks??[],r=n.find(e=>e.id===t),i=r?lV(n,r):null;if(!i)return null;let a=dV(i);return(0,H.jsxs)(`nav`,{className:zE,"aria-label":B(`compare.stackLabel`),children:[i.base&&(0,H.jsxs)(`span`,{className:`text-subtle`,children:[i.base,` ←`]}),i.nodes.map((n,r)=>(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-x-3.5`,children:[r>0&&(0,H.jsx)(`span`,{className:`text-subtle`,children:`←`}),(0,H.jsxs)(U,{variant:`pill`,hit:`tight`,"aria-current":n.id===t,onClick:()=>e.select(n.id),children:[`[ `,(0,H.jsx)(Bh,{status:n.rowStatus}),n.label||n.title,uV(n)?(0,H.jsx)(`span`,{className:`text-accent`,children:`✓`}):n.pr?.number?(0,H.jsx)(`span`,{children:`PR`}):null,` ]`]})]},n.id)),a&&!a.machine&&(0,H.jsx)(U,{hit:`tight`,className:`ml-auto flex-none whitespace-nowrap`,onClick:()=>void Sy(e,a),children:B(`compare.landBottom`)})]})}function pV(e,t){return e===`never`?!1:e!==`multipleOnly`||t>=2}function mV({taskId:e}){V();let t=Ac(e),n=y(N),r=jc(e)&&!n;return(0,H.jsx)(`div`,{className:ur,children:ec.map(n=>{let i=r&&!!Rs(t,n);return(0,H.jsx)(`button`,{type:`button`,className:Xn({on:i}),title:B(`panel.${n}`),"aria-label":B(`panel.${n}`),"aria-pressed":i,onClick:()=>Ic(e,n),children:(0,H.jsx)(gF,{children:_F[n]})},n)})})}function hV({model:e,task:t,tabs:n,narrow:r}){let i=y(e.selection),{prefs:a}=wp(),o=!pV(a.tabStrip,n.length);return(0,H.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,H.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=>uF(r,b(AA(e,t,n),B(`menu.more`))),children:[(0,H.jsx)(`span`,{className:`text-subtle group-aria-selected/tab:text-accent`,children:r+1}),Hd(n)]},n.id)),!r&&(0,H.jsx)(mV,{taskId:t.id})]})}function gV(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??e))}function _V({model:e}){let t=V()===`zh`?$i:Qi,n=e.client,[r,i]=(0,h.useState)(()=>(X(n,`worktrees.list`,{network:!0})??X(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=>Ku(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&&L(gV(t.delete.residue,i.residue)),g()}catch(n){o(t=>t.filter(t=>t!==e.path));let i=n&&typeof n==`object`&&`code`in n?n.code:null;if(!r&&i===`DIRTY_WORKTREE`){C.set((0,H.jsx)(Ti,{title:t.delete.forceTitle,body:`${gV(t.delete.forceBody,{branch:e.branch||e.path})}\n\n${gV(t.delete.forceReason,{reason:G(n)})}`,confirmLabel:t.delete.button,onConfirm:()=>_(e,!0)}));return}L(gV(t.delete.failed,{error:G(n)}),`error`)}},v=e=>C.set((0,H.jsx)(Ti,{title:t.delete.confirmTitle,body:gV(t.delete.confirmBody,{branch:e.branch||e.path}),confirmLabel:t.delete.button,onConfirm:async()=>{_(e,!1)}})),y=n=>{if(!n.taskId){L(t.land.noTask,`error`);return}Sy(e,{id:n.taskId,title:n.branch,branch:n.branch},g)},b=e=>{if(e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.toLowerCase()===`c`&&!window.getSelection()?.toString())return e.preventDefault(),O.set(null);if(e.metaKey||e.ctrlKey||e.altKey)return;let t=p[m];if(e.key===`j`||e.key===`ArrowDown`)c(Math.min(p.length-1,m+1));else if(e.key===`k`||e.key===`ArrowUp`)c(Math.max(0,m-1));else if(e.key===`d`&&t)v(t);else if(e.key===`l`&&t)y(t);else if(e.key===`q`||e.key===`Escape`)O.set(null);else return;e.preventDefault()},x=0;return(0,H.jsxs)(`div`,{className:kx,tabIndex:0,ref:d,onKeyDown:b,children:[(0,H.jsx)(`h1`,{className:Ax,children:t.title}),r===null?(0,H.jsx)(`p`,{className:`text-muted`,children:t.loading}):f.length===0?(0,H.jsx)(`p`,{className:`text-muted`,children:t.noProjects}):f.map(e=>{let n=x;return x+=e.worktrees.length,(0,H.jsxs)(`section`,{className:rS,children:[(0,H.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,H.jsx)(`span`,{children:e.repo}),(0,H.jsx)(`span`,{className:`rule`})]}),e.worktrees.length===0&&(0,H.jsx)(`p`,{className:`mono text-muted`,children:t.noWorktrees}),e.worktrees.map((e,r)=>{let i=n+r;return(0,H.jsxs)(`div`,{"data-row":i,className:iS(i===m),onClick:()=>c(i),children:[(0,H.jsxs)(`div`,{className:aS,children:[(0,H.jsx)(`span`,{className:sS,children:e.branch||t.row.detached}),e.roveManaged&&(0,H.jsx)(`span`,{className:`chip text-muted`,children:t.badge.roveManaged}),e.dirty===!0&&(0,H.jsx)(`span`,{className:`chip text-warning`,children:t.badge.dirty}),e.dirty===null&&(0,H.jsx)(`span`,{className:`chip text-muted`,children:t.badge.dirtyUnknown}),(0,H.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,H.jsx)(`span`,{className:`chip ${e.verdict===`merged`?`text-success`:e.verdict===`stale`?`text-warning`:`text-accent`}`,children:t.verdict[e.verdictReason]??e.verdictReason})]}),(0,H.jsxs)(`div`,{className:`${oS} mono text-muted`,children:[(0,H.jsx)(`span`,{className:cS,children:e.path}),e.createdAtMs>0&&(0,H.jsx)(`span`,{children:gV(t.row.created,{age:Ml(Date.now()-e.createdAtMs)})})]}),i===m&&(0,H.jsxs)(`div`,{className:`flex items-baseline gap-2 text-[length:var(--fs-body)]`,children:[(0,H.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>v(e),children:t.delete.button}),e.taskId&&(0,H.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>y(e),children:t.land.button})]})]},e.path)})]},e.repo)}),(0,H.jsx)(`p`,{className:`${lS} mono keys-only text-muted`,children:(0,H.jsx)(cp,{text:`j/k · d ${t.delete.button} · l ${t.land.button} · q/esc`})})]})}function vV({model:e,narrow:t}){let n=y(e.selection),r=y(e.tabs),i=y(e.tasks),a=y(e.remote),o=a.find(e=>e.id===n.taskId&&!e.machine?.stale),s=lo(i,n.taskId)??o??null,c=o?void 0:a.find(e=>e.id===n.taskId),l=s?r[s.id]??[]:[],u=s?s.id in r:!1,d=y(O),f=vC(s?.id),p=s?.rowStatus?.kind===`running`,m=y(F),g=y(tc)!==`terminal`&&t&&!!s;return(0,h.useEffect)(()=>{let t=e.selection.get();return e.selection.subscribe(()=>{O.set(null),F.set(null);let n=e.selection.get();(n.taskId!==t.taskId||n.tabId!==t.tabId)&&tc.set(`terminal`),t=n})},[e]),(0,h.useEffect)(()=>nE(e),[e]),d===`update`?(0,H.jsxs)(`main`,{className:`${Dn} ${Ut}`,children:[t&&(0,H.jsx)(NF,{}),(0,H.jsx)(TS,{client:e.client})]}):d===`worktrees`?(0,H.jsxs)(`main`,{className:`${Dn} ${Ut}`,children:[t&&(0,H.jsx)(NF,{}),(0,H.jsx)(_V,{model:e})]}):d?(0,H.jsxs)(`main`,{className:`${Dn} ${Ut}`,children:[t&&(0,H.jsx)(NF,{}),(0,H.jsx)(Fj,{model:e,page:d})]}):m?(0,H.jsxs)(`main`,{className:`${Dn} ${Ut}`,children:[t&&(0,H.jsx)(NF,{}),(0,H.jsx)(`div`,{className:On,children:(0,H.jsx)(Cv,{model:e,seed:m},i_(m))})]}):(0,H.jsxs)(`main`,{className:`${Dn} ${Ut}`,children:[t&&(0,H.jsx)(NF,{taskId:s?.id,title:s?.title}),s&&(0,H.jsx)(hV,{model:e,task:s,tabs:l,narrow:t}),s&&!s.groupId&&(0,H.jsx)(fV,{model:e,taskId:s.id}),s?.groupId&&(0,H.jsx)(tV,{model:e,taskId:s.id,groupId:s.groupId}),(0,H.jsxs)(`div`,{className:`${On} ${p?kn:``}`,style:f?{"--task-ink":f}:void 0,children:[!t&&!s&&!c&&i&&i.tasks.length+a.length===0&&(0,H.jsx)(lF,{model:e}),!s&&!c&&i&&i.tasks.length+a.length>0&&(0,H.jsx)(`p`,{className:Tn,children:B(`workspace.pickTask`)}),c?.machine&&(0,H.jsx)(`div`,{className:En,children:(0,H.jsx)(Ym,{host:c.machine.label,onMachines:()=>Gv(e)})}),s&&u&&l.length===0&&!g&&(0,H.jsxs)(`div`,{className:En,children:[(0,H.jsx)(`p`,{children:B(`workspace.noTabs`)}),(0,H.jsx)(U,{variant:`filled`,onClick:()=>void ad(e,s.id,{kind:`engine`}).catch(e=>L(String(e),`error`)),children:s.engine?B(`workspace.startEngine`,{engine:s.engine.name}):B(`workspace.startSession`)}),` `,(0,H.jsx)(U,{variant:`filled`,onClick:()=>void id(e,s.id),children:B(`menu.newChat`)}),` `,(0,H.jsx)(U,{variant:`filled`,onClick:()=>C.set((0,H.jsx)(ud,{model:e,taskId:s.id})),children:B(`menu.newChatPick`)})]}),s&&g&&(0,H.jsx)(qB,{model:e,task:s,narrow:!0}),s&&n.tabId&&l.some(e=>e.id===n.tabId)&&(0,H.jsx)(`div`,{className:`min-w-0 flex-1 ${g?`hidden`:`flex`}`,children:(0,H.jsx)(oV,{model:e,taskId:s.id,tab:l.find(e=>e.id===n.tabId)??l[0]},`${s.id}::${n.tabId}`)})]})]})}function yV({model:e}){V();let t=y(e.client.conn);return t.hello===null&&t.failures>=2?(0,H.jsx)(bV,{}):(0,H.jsx)(xV,{model:e})}function bV(){let[e,t]=(0,h.useState)(null);return(0,h.useEffect)(()=>{ss().then(t)},[]),e===null?null:e?(0,H.jsx)(fs,{}):(0,H.jsx)(Pr,{failing:!0})}function xV({model:e}){NT(e);let t=y(e.client.conn).hello;(0,h.useEffect)(()=>{if(!t)return;kS(e.client,t.roveVersion);let n=()=>void bS(e.client).then($B);n();let r=window.setInterval(n,36e5);return()=>window.clearInterval(r)},[t,e.client]),(0,h.useEffect)(()=>{t&&is(e)},[t,e]),df(e),cf(e),zo(),ha(e.client),HT(e),Oa(e.client),WC(e.client),(0,h.useEffect)(()=>{e.onSelect=pe;let t=F.subscribe(()=>{F.get()!==null&&pe()});return ne(),t},[e]),(0,h.useEffect)(()=>Lw(e),[e]);let n=y(N),r=y(e.selection),i=y(e.tasks),a=y(e.remote),o=Se(),s=y(bM),c=y(xM),l=y(yM),u=y(fe),d=y(Oe)===`app`,f=y(ic),p=y(oc),m=y(O),g=y(se)===`drag`,_=y(F)!==null,v=a.find(e=>e.id===r.taskId&&!e.machine?.stale),b=lo(i,r.taskId)??v??null,x=v?void 0:a.find(e=>e.id===r.taskId),S=jc(b?.id??null),C=Ac(b?.id??``).columns.length,w=o?Ce(u,!!b||!!x,m!==null||_):null;(0,h.useEffect)(()=>e.setTaskShown(w===null||w===`content`&&m===null&&!_),[e,w,m,_]);let T=TM(l??280),E=f===null?null:sc(f,s?0:T),D=Math.max(1,C),k=`max(280px, min(calc((100% - var(--rail-w)) * ${D} / ${D+2}), calc(100% - var(--rail-w) - 320px)))`,A={"--rail-w":`${s?0:T}px`,"--rail-open-w":`${T}px`,"--panel-w":E===null?k:`${E}px`};return(0,H.jsxs)(`div`,{className:Bt,children:[(0,H.jsx)(Aa,{onRefresh:()=>ka(e.client)}),(0,H.jsxs)(`div`,{className:Vt({zen:n||!S||!b&&!x||o,expanded:p&&S&&!n&&!o,surface:w&&d?`back`:w,folded:s&&!o,peek:s&&c&&!o,dragging:g}),style:o?void 0:A,children:[!o&&(0,H.jsx)(jF,{model:e}),s&&!o&&(0,H.jsx)(`div`,{className:`absolute inset-y-0 left-0 z-5 col-1 row-1 w-2.5`,title:B(`layout.railUnfold`),onMouseEnter:()=>wM(!0),onMouseLeave:()=>wM(!1),onMouseUp:()=>bM.set(!1)}),(0,H.jsx)(dF,{model:e,narrow:o}),(0,H.jsx)(vV,{model:e,narrow:o}),!o&&(0,H.jsx)(qB,{model:e,task:b,remoteHost:x?.machine?.label}),(0,H.jsx)(YB,{model:e}),(0,H.jsx)(vs,{}),(0,H.jsx)(RT,{model:e}),(0,H.jsx)(mo,{model:e})]})]})}var SV=`a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`;function CV(e){return[...e.querySelectorAll(SV)].filter(e=>e.tabIndex>=0&&e.offsetParent!==null)}function wV(){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=CV(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 TV(e){if(!oe())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 EV(e){for(let t of document.querySelectorAll(`${e}.is-leaving`))t.remove()}function DV(){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 OV(){let e=C.get(),t=-1/0;C.subscribe(()=>{let n=C.get();if(n===null&&e!==null)t=performance.now(),TV(`.overlay`);else if(n!==null){let n=e!==null||performance.now()-t<140;EV(`.overlay`),n&&requestAnimationFrame(DV)}e=n});let n=S.get();S.subscribe(()=>{let e=S.get();e===null&&n!==null?TV(`.menu`):e!==null&&EV(`.menu`),n=e});let r=bf.get().guide;bf.subscribe(()=>{let e=bf.get().guide;e===null&&r!==null?TV(`.prefix-guide`):e!==null&&EV(`.prefix-guide`),r=e})}var kV=500,AV=10,jV=`input, textarea, select, [contenteditable], .xterm`,MV=[`mousedown`,`mouseup`,`click`,`contextmenu`];function NV(){let e=null,t=()=>{e&&window.clearTimeout(e.timer),e=null},n=()=>{let e=e=>{e.preventDefault(),e.stopPropagation()},t=()=>{for(let t of MV)document.removeEventListener(t,e,!0);document.removeEventListener(`pointerdown`,t,!0),document.removeEventListener(`keydown`,t,!0)};for(let t of MV)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(jV))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())},kV)};e=a},!0),document.addEventListener(`pointermove`,n=>{e&&Math.hypot(n.clientX-e.x,n.clientY-e.y)>AV&&t()},!0),document.addEventListener(`pointerup`,t,!0),document.addEventListener(`pointercancel`,t,!0),document.addEventListener(`contextmenu`,t=>{e&&t.isTrusted&&(e.native=!0)},!0)}function PV(e,t){e.viewingExtras=()=>uc({narrow:be(),panelOpen:Mc(e.selection.get().taskId),zen:N.get()});let n=()=>e.reportViewing();ac.subscribe(n),Nc(n),N.subscribe(n),F.subscribe(n),O.subscribe(n),xe(n),t.on(`panel`,t=>{lc(t)&&Wc(t,e.selection.get().taskId)})}function FV(e){let t=e;return!!t&&typeof t.promptId==`string`&&typeof t.title==`string`}function IV({client:e,prompt:t}){let n=(V()===`zh`?ki:Oi).prompt,[r,i]=(0,h.useState)(t.initial??``),a=(0,h.useRef)(!1),{busy:o,error:s,submit:c}=Ci();return(0,h.useEffect)(()=>()=>{a.current||e.request(`ui.promptReply`,{promptId:t.promptId}).catch(()=>{})},[e,t.promptId]),(0,H.jsx)(Si,{title:t.title,children:(0,H.jsxs)(`form`,{className:Gr,onSubmit:n=>{n.preventDefault(),c(async()=>{await e.request(`ui.promptReply`,{promptId:t.promptId,value:r}),a.current=!0})},children:[(0,H.jsx)(`input`,{className:Mr,"aria-label":n.fieldLabel,autoFocus:!0,spellCheck:!1,value:r,placeholder:t.placeholder,onChange:e=>i(e.target.value)}),s&&(0,H.jsx)(`p`,{className:`text-error`,children:s}),(0,H.jsx)(Di,{busy:o,submitLabel:n.submitLabel})]})})}function LV(e,t){C.get()||C.set((0,H.jsx)(IV,{client:e,prompt:t},t.promptId))}var RV=900,zV=new WeakMap;function BV(e){e.setAttribute(`data-scrolling`,``),window.clearTimeout(zV.get(e)),zV.set(e,window.setTimeout(()=>e.removeAttribute(`data-scrolling`),RV))}function VV(){document.addEventListener(`scroll`,e=>{let t=e.target instanceof Element?e.target:document.scrollingElement;t&&BV(t)},{capture:!0,passive:!0})}var HV=`rove-web.reloadedFor`;function UV(e,t,n){return e===null?`adopt`:t===e||t===n?`stay`:`reload`}function WV(){let e=null;try{e=window.sessionStorage}catch{}return{storage:e,reload:()=>window.location.reload()}}function GV(e,t=WV()){let n=null,r=null,i=()=>{try{return t.storage?.getItem(HV)??r}catch{return r}};return e.conn.subscribe(()=>{let{state:a,hello:o}=e.conn.get();if(a!==`open`||!o)return;let s=UV(n,o.roveVersion,i());if(s===`adopt`&&(n=o.roveVersion),s===`reload`){r=o.roveVersion;try{t.storage?.setItem(HV,o.roveVersion)}catch{}t.reload()}})}function KV(){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 qV=(0,g.createRoot)(document.getElementById(`root`));KV(),NV(),Pe(),VV(),OV(),wV(),PP();function JV(e){let t=new qo(Jo(),e),n=new fo(t);t.on(`prompt`,e=>{FV(e)&&LV(t,e)}),PV(n,t),GV(t),t.start(),qV.render((0,H.jsx)(h.StrictMode,{children:(0,H.jsx)(yV,{model:n})}))}var YV=i();YV?JV(YV):Promise.all([cs(),ss()]).then(([e,t])=>{e?JV(``):qV.render((0,H.jsx)(h.StrictMode,{children:t?(0,H.jsx)(fs,{}):(0,H.jsx)(Pr,{})}))});export{_p as a,rp as c,Uo as d,Nn as f,se as h,iC as i,np as l,M as m,aI as n,tp as o,Fn as p,rI as r,ep as s,BV as t,qu as u};