@sma1lboy/rove 0.9.304 → 0.9.305-next.430

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 (114) hide show
  1. package/dist/cli/{chunk-kyddm7xe.js → chunk-06vsvvtr.js} +1 -1
  2. package/dist/cli/{chunk-jkxn32nk.js → chunk-0s7j1xps.js} +1 -1
  3. package/dist/cli/{chunk-vk2xz0s4.js → chunk-19n8y9xp.js} +3 -3
  4. package/dist/cli/{chunk-qnkq7d8z.js → chunk-1bertmzz.js} +3 -3
  5. package/dist/cli/{chunk-gb2ahsfx.js → chunk-1et3gskx.js} +1 -1
  6. package/dist/cli/chunk-29e7x3qx.js +2 -0
  7. package/dist/cli/{chunk-sd6eae1h.js → chunk-2agspgfq.js} +1 -1
  8. package/dist/cli/{chunk-ga0kvz6j.js → chunk-2gpr5dm4.js} +1 -1
  9. package/dist/cli/{chunk-d4w91a02.js → chunk-2nddryb2.js} +1 -1
  10. package/dist/cli/{chunk-q6qmv2jq.js → chunk-37g0yabr.js} +1 -1
  11. package/dist/cli/{chunk-d3d06a4w.js → chunk-3da0g8md.js} +2 -2
  12. package/dist/cli/{chunk-mb2tfr2c.js → chunk-3jh1cfdj.js} +1 -1
  13. package/dist/cli/{chunk-j1rw5jdt.js → chunk-3t3fp5h4.js} +1 -1
  14. package/dist/cli/{chunk-tr9n297x.js → chunk-4nzf8w3e.js} +2 -2
  15. package/dist/cli/{chunk-am3vaamq.js → chunk-59ff10tt.js} +1 -1
  16. package/dist/cli/{chunk-hmfqyvet.js → chunk-5dv7pw3w.js} +2 -2
  17. package/dist/cli/{chunk-cmbd3s71.js → chunk-6azsw0ry.js} +5 -5
  18. package/dist/cli/{chunk-vpm8dfyg.js → chunk-6cggsxpr.js} +1 -1
  19. package/dist/cli/{chunk-p9an6jcq.js → chunk-6jxe4f13.js} +1 -1
  20. package/dist/cli/{chunk-b7bbnx1x.js → chunk-6wzb9c2x.js} +1 -1
  21. package/dist/cli/chunk-750rk2xz.js +16 -0
  22. package/dist/cli/chunk-7dah6dc9.js +2 -0
  23. package/dist/cli/{chunk-tzf7b25k.js → chunk-7ezpcrkf.js} +1 -1
  24. package/dist/cli/chunk-7gk8g1ae.js +2 -0
  25. package/dist/cli/{chunk-22syh28c.js → chunk-7yhekmvy.js} +1 -1
  26. package/dist/cli/{chunk-mdypt84n.js → chunk-8ag7qs90.js} +1 -1
  27. package/dist/cli/chunk-8nbvsger.js +2 -0
  28. package/dist/cli/{chunk-cb3krnqn.js → chunk-8wejvvsz.js} +1 -1
  29. package/dist/cli/{chunk-akygcre8.js → chunk-9892j1n1.js} +1 -1
  30. package/dist/cli/{chunk-wh147k4t.js → chunk-9b42t2wf.js} +1 -1
  31. package/dist/cli/{chunk-ammf7919.js → chunk-9tke0g8m.js} +1 -1
  32. package/dist/cli/chunk-a5pd9fk3.js +2 -0
  33. package/dist/cli/{chunk-x4gqyhhv.js → chunk-a6s52zm5.js} +1 -1
  34. package/dist/cli/{chunk-d4eav2xt.js → chunk-a8j2x5pf.js} +1 -1
  35. package/dist/cli/chunk-aejb41e3.js +2 -0
  36. package/dist/cli/{chunk-jx0sfc90.js → chunk-am70fwd0.js} +1 -1
  37. package/dist/cli/{chunk-gr9555d9.js → chunk-b7rxn7c9.js} +1 -1
  38. package/dist/cli/chunk-cs7m5f61.js +2 -0
  39. package/dist/cli/{chunk-s00wwj3a.js → chunk-cvcp1aye.js} +1 -1
  40. package/dist/cli/{chunk-76433s6v.js → chunk-d35ctfpd.js} +1 -1
  41. package/dist/cli/chunk-dab3kttb.js +2 -0
  42. package/dist/cli/{chunk-7w43ktng.js → chunk-ejs6dnxf.js} +1 -1
  43. package/dist/cli/{chunk-yebkeqj2.js → chunk-er4mc36m.js} +1 -1
  44. package/dist/cli/{chunk-sqcntdty.js → chunk-etz8f2ny.js} +1 -1
  45. package/dist/cli/{chunk-g770enx5.js → chunk-fmhnw1nz.js} +2 -2
  46. package/dist/cli/{chunk-689sfk7h.js → chunk-g70rcpsp.js} +1 -1
  47. package/dist/cli/{chunk-px91psgc.js → chunk-ga448pv8.js} +1 -1
  48. package/dist/cli/{chunk-5gw9f1zb.js → chunk-gafj4yp3.js} +4 -4
  49. package/dist/cli/{chunk-gdjaf50p.js → chunk-ggjg0h5c.js} +1 -1
  50. package/dist/cli/{chunk-wjz55sc3.js → chunk-gvs8sbp2.js} +1 -1
  51. package/dist/cli/{chunk-zc7e78mv.js → chunk-gz0x179r.js} +1 -1
  52. package/dist/cli/chunk-h2xantkm.js +2 -0
  53. package/dist/cli/{chunk-ytx7x3j8.js → chunk-hct98wxq.js} +1 -1
  54. package/dist/cli/{chunk-qjr63j9v.js → chunk-kvwneanp.js} +1 -1
  55. package/dist/cli/chunk-m5ddrj6q.js +2 -0
  56. package/dist/cli/{chunk-m6ekn4q8.js → chunk-mavyyarb.js} +1 -1
  57. package/dist/cli/{chunk-6y1jamqn.js → chunk-me70fpec.js} +1 -1
  58. package/dist/cli/{chunk-ykm19q7h.js → chunk-n15p38e5.js} +1 -1
  59. package/dist/cli/{chunk-2v2t1a03.js → chunk-nhsem71y.js} +1 -1
  60. package/dist/cli/{chunk-e04yypye.js → chunk-nyr8zxgd.js} +3 -3
  61. package/dist/cli/{chunk-q8b6gnc5.js → chunk-p4rhkv3k.js} +1 -1
  62. package/dist/cli/{chunk-x3c6f2sf.js → chunk-pf3nzz87.js} +1 -1
  63. package/dist/cli/{chunk-jb63kaer.js → chunk-qaznc1bg.js} +1 -1
  64. package/dist/cli/{chunk-633beahm.js → chunk-qwqa75g1.js} +1 -1
  65. package/dist/cli/{chunk-2h58p581.js → chunk-r8xt34nn.js} +1 -1
  66. package/dist/cli/chunk-ragdpajw.js +6 -0
  67. package/dist/cli/{chunk-bp3edwby.js → chunk-rnmj5c45.js} +1 -1
  68. package/dist/cli/{chunk-ahnv378z.js → chunk-s129kc10.js} +1 -1
  69. package/dist/cli/chunk-s2eezz0a.js +3 -0
  70. package/dist/cli/{chunk-sfskhmzp.js → chunk-s6wqbs6y.js} +1 -1
  71. package/dist/cli/{chunk-rz5sspn8.js → chunk-sffdpzfv.js} +1 -1
  72. package/dist/cli/{chunk-7zawz6sa.js → chunk-sggsdk9s.js} +11 -7
  73. package/dist/cli/{chunk-16sb3y82.js → chunk-t4reqv8m.js} +1 -1
  74. package/dist/cli/{chunk-q6q4aram.js → chunk-t7qj639x.js} +1 -1
  75. package/dist/cli/{chunk-emj5p5k7.js → chunk-t8gt3kq8.js} +1 -1
  76. package/dist/cli/{chunk-486j02v4.js → chunk-vat1vjkk.js} +1 -1
  77. package/dist/cli/{chunk-gd8gc37t.js → chunk-vd9670dy.js} +1 -1
  78. package/dist/cli/chunk-vjejmwzj.js +2 -0
  79. package/dist/cli/{chunk-rajwag3e.js → chunk-weah9492.js} +1 -1
  80. package/dist/cli/{chunk-mwbs7818.js → chunk-x5ybfyja.js} +1 -1
  81. package/dist/cli/{chunk-zpdvfb01.js → chunk-xj3034s1.js} +1 -1
  82. package/dist/cli/chunk-yk3we30f.js +2 -0
  83. package/dist/cli/chunk-yzz6vx5j.js +2 -0
  84. package/dist/cli/{chunk-7d22h7qg.js → chunk-z1fpd4k2.js} +1 -1
  85. package/dist/cli/{chunk-r9yx4k0q.js → chunk-zc67sqet.js} +1 -1
  86. package/dist/cli/{chunk-nmfcvtxk.js → chunk-zp4efbtb.js} +1 -1
  87. package/dist/cli/{chunk-2pc4wpm4.js → chunk-zqftyn6w.js} +1 -1
  88. package/dist/cli/{chunk-bznee97z.js → chunk-zze1pw22.js} +1 -1
  89. package/dist/cli/index.js +3 -3
  90. package/dist/cli/rove.js +3 -3
  91. package/dist/completions/rove.bash +1 -1
  92. package/dist/completions/rove.fish +1 -1
  93. package/dist/completions/rove.zsh +1 -1
  94. package/dist/web/assets/{index-D9TLg2oV.js → index-7xgjby6F.js} +3 -3
  95. package/dist/web/assets/{term-mount-Cn86hde_.js → term-mount-OMVJnrk8.js} +1 -1
  96. package/dist/web/index.html +1 -1
  97. package/package.json +1 -1
  98. package/dist/cli/chunk-0qxqk8cr.js +0 -2
  99. package/dist/cli/chunk-0r64dqy3.js +0 -3
  100. package/dist/cli/chunk-1fw86kg2.js +0 -2
  101. package/dist/cli/chunk-1w2dx91w.js +0 -2
  102. package/dist/cli/chunk-2ze5ss4k.js +0 -2
  103. package/dist/cli/chunk-46zqt24x.js +0 -2
  104. package/dist/cli/chunk-8647s43m.js +0 -2
  105. package/dist/cli/chunk-96jqrzcp.js +0 -2
  106. package/dist/cli/chunk-czyyrxmf.js +0 -2
  107. package/dist/cli/chunk-d9e1vx7y.js +0 -15
  108. package/dist/cli/chunk-fg7kv30n.js +0 -2
  109. package/dist/cli/chunk-gpmpv5gw.js +0 -2
  110. package/dist/cli/chunk-pe92nt86.js +0 -4
  111. package/dist/cli/chunk-scb1g3zf.js +0 -2
  112. package/dist/cli/chunk-vy5ja578.js +0 -2
  113. package/dist/cli/chunk-xrg2tc6p.js +0 -2
  114. package/dist/cli/chunk-zshgx9fp.js +0 -6
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/term-mount-Cn86hde_.js","assets/rolldown-runtime-hePW80VL.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-OMVJnrk8.js","assets/rolldown-runtime-hePW80VL.js","assets/term-mount-BrP-ENHg.css"])))=>i.map(i=>d[i]);
2
2
  import{n as e,t}from"./rolldown-runtime-hePW80VL.js";(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 n=`rove.bridge.token`;if(typeof window<`u`){let e=new URLSearchParams(window.location.hash.slice(1)).get(`token`);e&&(localStorage.setItem(n,e),history.replaceState(null,``,window.location.pathname+window.location.search))}function r(){return localStorage.getItem(n)}function i(e){localStorage.setItem(n,e)}function a(){localStorage.removeItem(n)}var o=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 ee(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 P(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:ee,forEach:function(e,t,n){ee(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return ee(e,function(){t++}),t},toArray:function(e){return ee(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:P}},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`})),s=t(((e,t)=>{t.exports=o()})),c=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}}}})),l=t(((e,t)=>{t.exports=c()})),u=t((e=>{var t=s();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 c=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=c.T,n=i.p;try{if(c.T=null,i.p=2,e)return e()}finally{c.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 c.H.useFormState(e,t,n)},e.useFormStatus=function(){return c.H.useHostTransitionStatus()},e.version=`19.2.8`})),d=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=u()})),f=t((e=>{var t=l(),n=s(),r=d();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 c(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 u(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 f(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 f(a),e;if(s===r)return f(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 ee(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?ee(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return ee(e(t))}catch{}}return null}var P=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=[],L=-1;function re(e){return{current:e}}function ie(e){0>L||(e.current=ne[L],ne[L]=null,L--)}function ae(e,t){L++,ne[L]=e.current,e.current=t}var R=re(null),oe=re(null),se=re(null),z=re(null);function ce(e,t){switch(ae(se,t),ae(oe,e),ae(R,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}}ie(R),ae(R,e)}function le(){ie(R),ie(oe),ie(se)}function B(e){e.memoizedState!==null&&ae(z,e);var t=R.current,n=Wd(t,e.type);t!==n&&(ae(oe,e),ae(R,n))}function ue(e){oe.current===e&&(ie(R),ie(oe)),z.current===e&&(ie(z),ep._currentValue=te)}var de,fe;function pe(e){if(de===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);de=t&&t[1]||``,fe=-1<e.stack.indexOf(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+de+e+fe}var me=!1;function he(e,t){if(!e||me)return``;me=!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(`
@@ -36,8 +36,8 @@ Then look for the hook that older version installed. Check my engine settings fi
36
36
  `)})}async function os(e){if(es||ns())return;es=!0;let{tasks:t}=await e.client.request(`worktree.legacyAdopted`,{}).catch(()=>({tasks:[]}));t.length!==0&&O.get()===null&&O.set((0,W.jsx)(ss,{model:e,tasks:t}))}function ss(e){let[t,n]=(0,m.useState)(!1),[r,i]=(0,m.useState)(null),a=async()=>{n(!0),i(null);try{let{taskId:t}=await e.model.client.request(`worktree.legacyCleanup`,{title:J(`tasks`,`confirm.legacyAdoptSessionTitle`),prompt:as(e.tasks)});B(),e.model.selectWhenListed(t)}catch(e){i(J(`tasks`,`confirm.legacyAdoptFailed`,{message:Zo(e)}))}finally{n(!1)}};return(0,W.jsx)(Ci,{title:J(`tasks`,`confirm.legacyAdoptTitle`,{count:e.tasks.length}),children:(0,W.jsxs)(`div`,{className:Kr,children:[(0,W.jsx)(`p`,{className:`text-muted whitespace-pre-wrap`,children:J(`tasks`,`confirm.legacyAdoptBody`,{list:is(e.tasks)})}),r&&(0,W.jsx)(`p`,{className:`text-error`,children:r}),(0,W.jsxs)(`div`,{className:Pr,children:[(0,W.jsx)(G,{onClick:()=>{rs(),B()},children:J(`tasks`,`confirm.legacyAdoptNever`)}),(0,W.jsx)(G,{onClick:B,children:J(`tasks`,`confirm.legacyAdoptLater`)}),(0,W.jsx)(G,{variant:`filled`,disabled:t,autoFocus:!0,onClick:()=>void a(),children:J(`tasks`,`confirm.legacyAdoptClean`)})]})]})})}function cs(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 ls(e=Uo){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 us(e=Uo){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 ds(e,t=Uo){try{let n=await t(`/login`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({password:e}),credentials:`omit`}),r=cs(n.status,await n.json().catch(()=>null));return r.kind===`ok`&&i(r.token),r}catch{return{kind:`unreachable`}}}async function fs(e=Uo){let t=r();a(),t&&await e(`/logout`,{method:`POST`,headers:{Authorization:`Bearer ${t}`}}).catch(()=>{})}function ps(e){if(!e)return null;switch(e.kind){case`ok`:return null;case`wrong`:return H(`login.wrong`);case`locked`:return H(`login.locked`,{minutes:e.minutes});case`lockedHost`:return H(`login.lockedHost`);case`unreachable`:return H(`login.unreachable`)}}function ms(){U();let[e,t]=(0,m.useState)(``),[n,r]=(0,m.useState)(!1),[i,a]=(0,m.useState)(null),o=ps(i);return(0,W.jsx)(`div`,{className:Kn,children:(0,W.jsxs)(`form`,{className:qn,onSubmit:async i=>{if(i.preventDefault(),n||!e)return;r(!0);let o=await ds(e);if(o.kind===`ok`){window.location.reload();return}t(``),a(o),r(!1)},children:[(0,W.jsxs)(`span`,{className:Wn,children:[(0,W.jsx)(`span`,{className:Gn,children:`[`}),` rove `,(0,W.jsx)(`span`,{className:Gn,children:`]`})]}),(0,W.jsx)(`h1`,{className:`${Ar} text-muted`,children:H(`login.title`)}),(0,W.jsx)(`p`,{className:`text-muted`,children:H(`login.body`)}),(0,W.jsx)(`input`,{className:Nr,type:`password`,autoComplete:`current-password`,"aria-label":H(`login.field`),placeholder:H(`login.field`),autoFocus:!0,value:e,disabled:n,onChange:e=>{t(e.target.value),a(null)}}),o&&(0,W.jsx)(`p`,{className:`text-error`,role:`alert`,children:o}),(0,W.jsx)(`div`,{className:Pr,children:(0,W.jsx)(`button`,{type:`submit`,className:xr(),disabled:n||!e,children:H(n?`login.checking`:`login.submit`)})})]})})}function hs(e){return(0,W.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,W.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 gs=120;function _s(e,t,n,r=e-t){return e+t+8<=n?e:Math.max(8,Math.min(r,n-t-8))}function vs(e){let{item:t}=e;return(0,W.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:Jr({selected:e.selected,open:e.open,danger:t.danger}),onMouseEnter:e.onEnter,onMouseLeave:e.onLeave,onClick:e.onPick,children:[(0,W.jsx)(`span`,{children:t.label}),t.children?(0,W.jsx)(hs,{right:!0,className:Zr(!!(e.selected||e.open))}):t.checked?(0,W.jsx)(`span`,{className:Qr,"aria-hidden":!0,children:`✓`}):t.key&&(0,W.jsx)(`span`,{className:Xr({selected:e.selected,danger:t.danger}),children:t.key})]})}function ys(){let e=y(D),[t,n]=(0,m.useState)(0),[r,i]=(0,m.useState)(null),[a,o]=(0,m.useState)(-1),[s,c]=(0,m.useState)(!1),l=(0,m.useRef)(null),u=(0,m.useRef)(null),d=(0,m.useRef)([]),f=(0,m.useRef)(void 0),[p,h]=(0,m.useState)({x:0,y:0}),[g,_]=(0,m.useState)({x:0,y:0});if((0,m.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);h({x:_s(a,t,window.innerWidth),y:_s(e.y,r,window.innerHeight)});let o=e.target;return o?.setAttribute(`data-menu-open`,``),()=>o?.removeAttribute(`data-menu-open`)},[e]),(0,m.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:_s(t.right+2,i,window.innerWidth,t.left-i-2),y:_s(n.top-5,a,window.innerHeight,n.bottom+5-a)})},[r]),(0,m.useEffect)(()=>()=>window.clearTimeout(f.current),[]),(0,m.useEffect)(()=>{if(!e)return;let d=e.items,f=r===null?[]:d[r]?.children??[],p=()=>D.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&&(D.set(null),e.run())},x=e=>{window.clearTimeout(f.current),i(e),c(!1),o(-1)};return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{ref:l,className:qr(),role:`menu`,style:{left:p.x,top:p.y,minWidth:e.minWidth},children:e.items.map((a,o)=>(0,W.jsxs)(m.Fragment,{children:[o>0&&a.section!==e.items[o-1]?.section&&(0,W.jsx)(`hr`,{className:`-mx-1 my-1 h-px flex-none border-none bg-line`}),(0,W.jsx)(vs,{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),gs):i(null)},onLeave:()=>{window.clearTimeout(f.current),o!==r&&n(-1)},onPick:()=>a.children?x(o):b(a)})]},a.label))}),v&&(0,W.jsx)(`div`,{ref:u,className:qr(!0),role:`menu`,style:{left:g.x,top:g.y},children:v.map((e,t)=>(0,W.jsx)(vs,{item:e,selected:t===a,onEnter:()=>{o(t),c(!0)},onLeave:()=>o(-1),onPick:()=>b(e)},e.label))})]})}function bs(){let e=y(O),t=y(A);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(ys,{}),e,(0,W.jsx)(`div`,{className:$r,"aria-live":`polite`,children:t.map(e=>{let t=`${ri(e.tone===`error`)} ${e.leaving?`is-leaving`:``}`,n=e.action;return n?(0,W.jsxs)(`div`,{className:`${t} ${ei}`,children:[(0,W.jsx)(`span`,{className:ti,children:e.text}),(0,W.jsx)(G,{className:ni,onClick:()=>{le(e.id),n.run()},children:`[ ${n.label} ]`})]},e.id):(0,W.jsx)(`button`,{type:`button`,className:t,onClick:()=>le(e.id),children:e.text},e.id)})})]})}var xs=`file:`,Ss=e=>`${xs}${e}`,Cs=e=>e.startsWith(xs)?e.slice(5):null;function ws(e,t){return t?`${t.replace(/\/$/,``)}/${e}`:e}function Ts(e,t){let n=e.trim().replace(/^file:\/\//i,``),r;if(n.startsWith(`./`))r=n.slice(2);else if(n.startsWith(`/`)){let e=t?.replace(/\/$/,``);if(!e||!n.startsWith(`${e}/`))return`outside`;r=n.slice(e.length+1)}else return null;return r&&!r.split(`/`).includes(`..`)?Ss(r):`outside`}function Es(e){return e===`localhost`||e.endsWith(`.localhost`)||e===`[::1]`||/^127(\.\d{1,3}){3}$/.test(e)}var Ds=/^(localhost|127(\.\d{1,3}){3}|\[::1\])(:\d+)?([/?#]|$)/i,Os=/^[a-z][a-z0-9+.-]*:(?!\d+([/?#]|$))/i;function ks(e){let t=e.trim();if(!t||/\s/.test(t)||Os.test(t)&&!/^https?:\/\//i.test(t))return null;let n=/^https?:\/\//i.test(t)?t:Ds.test(t)?`http://${t}`:`https://${t.replace(/^\/\//,``)}`;try{let e=new URL(n);return e.hostname===`[::1]`&&(e.hostname=`localhost`),e.hostname?e.href:null}catch{return null}}function As(e,t,n=Es(t.hostname)){let r=new URL(e);return r.origin===t.origin?`self`:Es(r.hostname)?n?`yes`:`remote`:r.protocol===`https:`?`yes`:`unreachable`}function js(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}function Ms(e){return e.urls[e.at]??``}function Ns(e){let t=Cs(e);if(t!==null)return t.slice(t.lastIndexOf(`/`)+1);try{return new URL(e).host.replace(/^www\./,``)}catch{return e}}function Ps(){return{kind:`browser`,tabs:[{id:`t1`,urls:[],at:-1}],active:`t1`,recent:[`t1`],next:2}}function Fs(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 Is(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=Ws(t,e.id)??t}return t}function Ls(e,t){let n=`t${e.next}`,r={id:n,urls:t,at:t.length-1};return Is(Fs({...e,tabs:[...e.tabs,r],next:e.next+1},n))}function Rs(e){return Ls(e,[])}function zs(e,t){return{...e,tabs:e.tabs.map(e=>e.id===t.id?t:e)}}function Bs(e,t,n){let r=e.tabs.find(e=>e.id===t);if(!r||Ms(r)===n)return e;let i=[...r.urls.slice(0,r.at+1),n].slice(-30);return zs(e,{...r,urls:i,at:i.length-1})}function Vs(e,t,n){let r=e.tabs.find(e=>e.id===t);return!r||n===r.at||n<0||n>=r.urls.length?e:zs(e,{...r,at:n})}function Hs(e,t){let n=e.tabs.find(e=>Ms(e)===t);if(n)return Fs(e,n.id);let r=e.tabs.find(e=>Ms(e)===``);return r?Bs(Fs(e,r.id),r.id,t):Ls(e,[t])}function Us(e,t,n){let r=e.tabs.find(e=>Ms(e)===t),i=e.tabs.find(t=>t.id===e.active),a=i&&(Ms(i)===``||Cs(Ms(i))!==null),o=r?Fs(e,r.id):a?Bs(e,i.id,t):Hs(e,t),s=o.tabs.find(e=>e.id===o.active);return n===void 0||!s||s.read===n?o:zs(o,{...s,read:n})}function Ws(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 Gs(e,t){return e.tabs.some(e=>e.id===t)?Ws(e,t):e}function Ks(e,t){let n=e.tabs.find(e=>e.id===t);return n?{...e,tabs:[n],active:t,recent:[t]}:e}function qs(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 Js(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 Ys=[`quota`,`files`,`diff`,`chat`,`browser`],Xs=1e3;function Zs(){return{columns:[{kind:`files`}],weights:{}}}function Qs(e,t){return e.columns.find(e=>e.kind===t)}function $s(e){return e.slice(e.lastIndexOf(`/`)+1)}function ec(e,t){return{...e,columns:e.columns.map(e=>e.kind===t.kind?t:e)}}function tc(e){return[...e].sort((e,t)=>Ys.indexOf(e.kind)-Ys.indexOf(t.kind))}function nc(e,t){return{...e,columns:tc([...e.columns,t])}}function rc(e,t){return Qs(e,t)?e:nc(e,t===`diff`?{kind:t,path:`.`,scope:`working`}:t===`browser`?Ps():{kind:t})}function ic(e,t,n){let r=Qs(e,`browser`);if(r?.kind!==`browser`)return nc(e,Us(Ps(),Ss(t),n));let i=Us(r,Ss(t),n);return i===r?e:ec(e,i)}function ac(e,t,n,r){let i=r===void 0?{kind:`diff`,path:t,scope:n}:{kind:`diff`,path:t,scope:n,at:r},a=Qs(e,`diff`);return a?a.kind===`diff`&&a.path===t&&a.scope===n&&(r===void 0||a.at===r)?e:ec(e,i):nc(e,i)}function oc(e,t){let n=Qs(e,`browser`);return n?.kind===`browser`?ec(e,Hs(n,t)):nc(e,Hs(Ps(),t))}function sc(e,t){if(!Qs(e,t))return e;let{[t]:n,...r}=e.weights;return{columns:e.columns.filter(e=>e.kind!==t),weights:r}}function cc(e,t){let n=Qs(e,`browser`);if(n?.kind!==`browser`)return e;let r=t(n);return r===n?e:r?ec(e,r):sc(e,`browser`)}function lc(e,t,n){if(!t){let t=e.columns.filter(e=>e.kind===n);return{panel:rc({...e,columns:t},n),open:!0}}if(Qs(e,n)){let t=sc(e,n);return{panel:t,open:t.columns.length>0}}return{panel:rc(e,n),open:!0}}function uc(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*Xs)}function dc(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 fc(e){return Object.keys(e.weights).length===0?e:{...e,weights:{}}}function pc(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 mc=Ys.filter(e=>e!==`chat`),hc=v(`terminal`),gc=`rove.web.panelWidth`,_c=`rove.web.panelOpen`,vc=v((()=>{let e=Number(localStorage.getItem(gc));return Number.isFinite(e)&&e>0?e:null})());vc.subscribe(()=>{let e=vc.get();e===null?localStorage.removeItem(gc):localStorage.setItem(gc,String(Math.round(e)))}),vc.subscribe(fe);var yc=v(localStorage.getItem(_c)===`1`);yc.subscribe(()=>localStorage.setItem(_c,yc.get()?`1`:`0`));var bc=v(!1);yc.subscribe(()=>{yc.get()||bc.set(!1)});function xc(e,t,n=window.innerWidth){let r=Math.max(280,n-t-320);return Math.max(280,Math.min(r,Math.round(e)))}var Sc=[`files`,`diff`,`browser`];function Cc(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.taskId==`string`&&t.taskId!==``&&Sc.includes(t.view)&&typeof t.at==`number`&&(t.url===void 0||typeof t.url==`string`)&&(t.path===void 0||typeof t.path==`string`)}function wc(e){return e.narrow?{panel:!1,panelOpen:!1,narrow:!0}:{panel:!0,panelOpen:e.panelOpen,narrow:!1}}function Tc(e,t){return{tab:e.path?e.view===`files`?`browser`:`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 Ec(e,t,n){return t.url?oc(e,t.url):t.path?t.tab===`browser`?ic(e,t.path,n):ac(e,t.path,`working`,n):rc(e,t.tab)}var Dc=[`files`,`chat`,`diff`,`browser`,`quota`],Oc=e=>e===`branch`||e===`task`?e:`working`;function kc(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===`diff`&&typeof t.path==`string`&&t.path!==``?{kind:`diff`,path:t.path,scope:Oc(t.scope)}:t.kind===`browser`?Js(t.tabs,t.active,t.recent,t.next):null}function Ac(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 jc(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 Mc(e){let t=jc(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:Oc(n.scope)})}if(i===`browser`){let n=Js(t.tabs.filter(e=>e.kind===`browser`),void 0,t.recent,e.next);n&&r.push(n)}}return{columns:tc(r),weights:{}}}function Nc(e){if(!e||typeof e!=`object`)return null;let t=e;if(!Array.isArray(t.columns))return Mc(t);let n=[];for(let e of t.columns){let t=kc(e);t&&!n.some(e=>e.kind===t.kind)&&n.push(t)}let r={columns:tc(n),weights:Ac(t.weights,n)},i=t.columns.find(e=>e?.kind===`file`&&typeof e.path==`string`&&e.path!==``);return i?ic(r,i.path):r}function Pc(e,t){let n=Zs(),r=typeof t==`string`&&t!==``?t:``;return e!==`browser`&&!r?n:{...n,columns:[...n.columns,r?Hs(Ps(),r):Ps()]}}function Fc(e){try{let t=JSON.parse(e??`{}`);return t&&typeof t==`object`&&!Array.isArray(t)?Object.entries(t):[]}catch{return[]}}function Ic(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 Lc(e,t){let n={};for(let[t,r]of Fc(e)){let e=Nc(r);e&&(n[t]=e)}let r=new Map(Fc(t.tab).filter(([,e])=>Dc.includes(e))),i=new Map(Fc(t.url)),a=[...new Set([...r.keys(),...i.keys()])].filter(e=>!(e in n));n={...Object.fromEntries(a.map(e=>[e,Pc(r.get(e),i.get(e))])),...n};for(let e of Object.keys(n).slice(0,-50))delete n[e];return n}var Rc=`rove.web.panels`,zc=`rove.web.panelTab`,Bc=`rove.web.panelUrl`;function Vc(){let e={tab:localStorage.getItem(zc),url:localStorage.getItem(Bc)},t=Lc(localStorage.getItem(Rc),e);return(e.tab!==null||e.url!==null)&&(localStorage.setItem(Rc,JSON.stringify(t)),localStorage.removeItem(zc),localStorage.removeItem(Bc)),t}var Hc=v(Vc()),Uc={columns:[],weights:{}};function Wc(e){return y(Hc)[e]??Uc}function Gc(e){let t=Wc(e??``),n=y(yc),r=y(L)!==null,i=y(N)!==null;return n&&!r&&!i&&(e===null||t.columns.length>0)}function Kc(e){return!yc.get()||L.get()!==null||N.get()!==null?!1:e===null||(Hc.get()[e]??Uc).columns.length>0}var qc=e=>Hc.subscribe(e);function Jc(e,t){let n=Hc.get()[e]??Uc,r=t(n);if(r===n)return;let i=Ic(Hc.get(),e,r);Hc.set(i),localStorage.setItem(Rc,JSON.stringify(i))}function Yc(e,t){Jc(e,e=>rc(e,t)),yc.set(!0),Se()&&hc.set(t)}function Xc(e,t){let n=yc.get(),r=lc(Hc.get()[e]??Uc,n,t);Jc(e,()=>r.panel),r.open?yc.set(!0):bc.set(!1)}function Zc(e){Jc(e.taskId,t=>ac(t,e.path,e.scope)),yc.set(!0),Se()&&hc.set(`diff`)}function Qc(e,t){Jc(e,e=>ic(e,t)),yc.set(!0),Se()&&hc.set(`browser`)}function $c(e,t){Jc(e,e=>oc(e,t)),yc.set(!0),Se()&&hc.set(`browser`)}function el(e,t){let n=Hc.get()[e]??Uc;!Se()&&n.columns.length===0&&bc.set(!1),Se()&&hc.get()===t&&!Qs(n,t)&&Yc(e,`files`)}function tl(e,t){Jc(e,e=>sc(e,t)),el(e,t)}function nl(e,t){Jc(e,e=>cc(e,t)),el(e,`browser`)}function rl(e,t){nl(e,e=>Gs(e,t))}function il(e,t){let n=Tc(e,{taskId:t,narrow:Se()});Jc(e.taskId,t=>Ec(t,n,e.at)),n.show&&yc.set(!0)}var al={Enter:`return`," ":`space`,Escape:`escape`,ArrowUp:`up`,ArrowDown:`down`,ArrowLeft:`left`,ArrowRight:`right`,PageUp:`pageup`,PageDown:`pagedown`};function ol(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 al[e.key]??e.key.toLowerCase()}function sl(e){let t=ol(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 cl(e){return e.startsWith(`shift+`)&&e.length===7?e.slice(6).toUpperCase():e}var ll=new Map(Y.map(e=>[e.id,{keys:[...e.keys],prefixKeys:e.prefixKeys&&[...e.prefixKeys],hint:e.hint?{...e.hint}:void 0}]));function ul(){return Y.map(e=>{let t=ll.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 dl=new Map(Y.map(e=>[e.id,e]));function fl(e){return dl.get(e)}function pl(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 ml(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 hl(e){return e.hint?.keys??e.keys[0]}function gl(e){let t=fl(e);if(!t)return null;let n=hl(t);return n&&n.length>0?n:null}function _l(e){return e.keys.length>0?e.hint?.keys??e.keys[0]??null:e.prefixKeys?.length?null:e.hint?.keys??null}function vl(e,t){return e.scope===`global`?!0:t===null?!1:e.scope===t||t===`terminal`&&e.scope===`workspace`}function yl(e,t,n,r){let i=[],a=[],o=[],s=new Map;for(let c of e){let e=_l(c),l=vl(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 bl={global:`Global`,sidebar:`Sidebar`,workspace:`Workspace`,files:`Files`,inbox:`Inbox`,terminal:`Terminal`};function xl(e){return e?bl[e]:`Global`}function Sl(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.filesToggle`?`Tools`:fl(e)?.category??`Global`}function Cl(e,t,n){let r=e.trim();return pl(r,t)||pl(r,n)}var wl={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`},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`}},Tl={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:`标记 — 标签栏和收件箱`},mark:{spinner:`运行中:引擎正在执行一轮,或任务作业正在运行`,needsInput:`等你回答:权限确认或提问`,attention:`需要你处理:出错、限流、引擎已退出或删除失败`,unseen:`一轮已结束,你还没看过`,idle:`空闲`,subagent:`正在运行的子代理,显示在分支名前`,remote:`任务在另一台机器上`,done:`这一轮已结束`,rateLimited:`被限流,会自动恢复`,dead:`引擎进程已退出`,routineFailed:`例行任务运行失败`}},El={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.filesToggle":`Show or hide Files`,"view.redraw":`Redraw the screen`,"attention.next":`Jump to the next Inbox item`,"task.previous":`Back to the previous task`,"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`}},Dl={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.filesToggle":`显示或收起文件栏`,"view.redraw":`重绘屏幕`,"attention.next":`跳到下一个收件箱条目`,"task.previous":`回到上一个任务`,"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 Ol(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 kl(e,t){return Mt.get()===`zh`?t:e}function Al(e,t){return t?e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??e)):e}var jl=(e,t)=>Al(Ol(kl(wl,Tl),e)??Ol(wl,e)??e,t),Ml=(e,t)=>Al(Ol(kl(Yi,Xi),e)??Ol(Yi,e)??e,t);function Nl(e){return kl(El,Dl).desc[e]??El.desc[e]??e}function Pl(e){let t=Nl(e),n=t.search(/\s—\s|——/);return n>0?t.slice(0,n):t}function Fl(e){return kl(El,Dl).category[e]??e}var Il=(e,t)=>Al(Ol(kl($i,ea),e)??Ol($i,e)??e,t),Ll=(e,t)=>Al(Ol(kl(qi,Ji),e)??Ol(qi,e)??e,t),Rl=e=>e.split(` + `).map(e=>so(e)).join(` + `);function zl(e){let t=Fl(xl(e.scope));return e.kind===`here`?jl(`here`,{surface:t}):e.kind===`direct`?jl(`direct`):e.kind===`prefix`?jl(`afterPrefix`):jl(`otherPane`,{surface:t})}function Bl(e){let t=document.activeElement instanceof HTMLElement?document.activeElement:null;O.set((0,W.jsx)(Vl,{model:e,surface:Ao(),origin:t}))}function Vl({model:e,surface:t,origin:n}){U();let r=y(lo),[i,a]=(0,m.useState)(!1),[o,s]=(0,m.useState)(``),c=(0,m.useRef)(null),l=(0,m.useMemo)(()=>jo(e,t),[e,t]),u=(0,m.useMemo)(()=>yl(Mo(),t===`terminal`?`terminal`:t,ho(),l),[l,t,r]).map(e=>({...e,rows:e.rows.filter(e=>Cl(o,Nl(e.binding.id),e.primary))})).filter(e=>e.rows.length>0);return(0,m.useEffect)(()=>()=>n?.focus(),[n]),(0,m.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===`?`)B();else if(!i&&t.key===`/`)a(!0);else return;t.preventDefault()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[i]),(0,W.jsx)(Ci,{title:jl(`title`),wide:!0,children:(0,W.jsxs)(`div`,{className:`${Kr} help`,children:[(0,W.jsxs)(`div`,{className:gn,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`p`,{className:`text-muted`,children:t?jl(`focused`,{surface:Fl(xl(t))}):jl(`allBindings`)}),(0,W.jsx)(`p`,{className:`text-muted`,children:jl(`grammar`,{prefix:go()})})]}),(0,W.jsxs)(`div`,{className:_n,children:[(0,W.jsx)(`span`,{className:`subtle`,children:jl(`scrollKeys`)}),(0,W.jsx)(`button`,{type:`button`,className:jr,onClick:B,children:jl(`esc`)})]})]}),i?(0,W.jsx)(`input`,{className:Nr,autoFocus:!0,spellCheck:!1,value:o,placeholder:jl(`search`),onChange:e=>{s(e.target.value),c.current?.scrollTo({top:0})}}):(0,W.jsx)(`p`,{className:`text-muted`,children:jl(`filter`)}),u.length===0&&(0,W.jsx)(`p`,{className:`text-muted`,children:jl(`noResults`)}),(0,W.jsx)(`div`,{className:vn,ref:c,children:u.map((e,t)=>(0,W.jsxs)(`section`,{className:yn,children:[(0,W.jsx)(`h2`,{className:bn,children:zl(e)}),e.rows.map(t=>(0,W.jsxs)(`div`,{className:xn,children:[(0,W.jsx)(`span`,{className:`mono ${Sn}`,children:Rl(t.primary)}),(0,W.jsx)(`span`,{className:`flex-1`,children:Nl(t.binding.id)}),t.aliases.length>0&&(0,W.jsx)(`span`,{className:`text-muted`,children:`(${t.aliases.map(Rl).join(`, `)})`})]},`${e.kind}-${t.binding.id}`))]},`${e.kind}-${e.scope??t}`))})]})})}function Hl(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`restored`:return{glyph:`!`,tone:`attention`,stateKey:`inbox.state.restored`};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 Ul(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 Wl=e=>e===`routine_failed`,Gl=e=>`${e.taskId??``}:${e.tabId??``}`;function Kl(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)||Gl(e).localeCompare(Gl(t)))}function ql(e,t,n){let r=new Set(t),i=Kl(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=>Gl(e)===Gl(n));return a<0||i.length===1?i[0]??null:i[(a+1)%i.length]??null}function Jl(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 Yl(e,t,n=!1){let r=`attention.dismiss`,i;if(Wl(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=>z(String(e),`error`))}function Xl(e,t){Yl(e,t),B(),ee.set(t.automationId??null),N.set(`routines`)}var Zl=524288e3,Ql=1048576;function $l(e,t){return/\.pdf$/i.test(e)?`pdf[${t}]`:/\.(png|jpe?g|gif|webp)$/i.test(e)?`images[${t}]`:`files[${t}]`}function eu(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 tu(e,t){let n=e.replace(/\s+$/,``),r=eu(e);for(let e of t){let t=`${$l(e,r)}: ${e}`;n=n.length>0?`${n}\n${t}`:t,r+=1}return n}function nu(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 ru(e,t,n){if(t.size>524288e3)throw Error(H(`pages.attachTooLarge`,{name:t.name}));let r={mime:t.type,name:t.name,...n?{task:n}:{}},i=async(e,n)=>nu(new Uint8Array(await t.slice(e,n).arrayBuffer()));if(t.size<=1048576)return e.request(`attachment.put`,{...r,data:await i(0,t.size)});let a;for(let n=0;;){let o=Math.min(n+Ql,t.size),s=await e.request(`attachment.part`,{...r,...a?{upload:a}:{},offset:n,data:await i(n,o),done:o===t.size});if(s.path!==void 0)return{path:s.path,kind:s.kind??`file`};a=s.upload,n=o}}async function iu(e,t,n){return(await ru(e,t,n)).path}function au(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 ou=`size-14 rounded-sm border-hairline border-line object-cover`;function su({name:e,thumb:t}){if(t)return(0,W.jsx)(`img`,{src:t,alt:``,draggable:!1,className:ou});let n=e.includes(`.`)?e.split(`.`).pop()??``:``;return(0,W.jsx)(`span`,{className:`${ou} flex items-center justify-center font-mono text-meta uppercase text-muted`,children:n.slice(0,4)||`file`})}function cu({item:e,onRemove:t}){let[n]=(0,m.useState)(e.pending);return(0,W.jsxs)(`li`,{className:`group relative size-14 shrink-0 ${n?`motion-safe:animate-rise-in`:``}`,title:`${e.name} · ${au(e.size)}`,children:[(0,W.jsx)(`div`,{className:`transition-opacity duration-150 motion-reduce:transition-none ${e.pending?`opacity-50`:``}`,children:(0,W.jsx)(su,{...e})}),(0,W.jsx)(`button`,{type:`button`,"aria-label":H(`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 lu({items:e,onRemove:t}){return e.length===0?null:(0,W.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,W.jsx)(cu,{item:e,onRemove:t},e.id))})}function uu(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 du(e){return(0,W.jsxs)(`label`,{className:e.className,title:e.title,children:[e.children,(0,W.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 fu={image:`images`,pdf:`pdf`};function pu(e,t){let n=t.filter(e=>e.path!==void 0);return n.length===0?e:`${e}\n\n${n.map((e,t)=>`${fu[e.kind??`image`]??`files`}[${t}]: ${e.path}`).join(`
37
37
  `)}`}var mu=112;async function hu(e){if(e.type.startsWith(`image/`))try{let t=await createImageBitmap(e),n=Math.min(1,mu/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 gu(e){if(!e)return[];try{let t=JSON.parse(sessionStorage.getItem(e)??`[]`);return Array.isArray(t)?t:[]}catch{return[]}}var _u=0;function vu(e,t,n,r){let[i,a]=(0,m.useState)(()=>gu(n)),o=(0,m.useRef)(i),s=(0,m.useRef)(new Set),c=e=>{if(o.current=e(o.current),a(o.current),n)try{sessionStorage.setItem(n,JSON.stringify(o.current.filter(e=>e.path!==void 0)))}catch{}},l=async n=>{let i=`${Date.now()}-${_u++}`,a=await hu(n);c(e=>[...e,{id:i,name:n.name,size:n.size,mime:n.type,...a?{thumb:a}:{}}]);try{let t=await ru(e.client,n,r);c(e=>e.map(e=>e.id===i?{...e,path:t.path,kind:t.kind}:e))}catch(e){c(e=>e.filter(e=>e.id!==i)),t(e instanceof Error?e.message:String(e))}};return{attachments:i,attach:e=>{for(let t of e){let e=l(t);s.current.add(e),e.finally(()=>s.current.delete(e))}},remove:e=>c(t=>t.filter(t=>t.id!==e)),ready:async()=>(await Promise.all(s.current),o.current),clear:()=>c(()=>[])}}function yu(e){return(0,W.jsx)(lu,{items:e.attachments.map(e=>({...e,pending:e.path===void 0})),onRemove:e.onRemove})}function bu(e){let t=(0,m.useRef)(null),n=(0,m.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,W.jsx)(`div`,{ref:t,className:Rr,"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,W.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:zr(t.id===e.value,t.dim),title:t.title,onClick:()=>e.onChange(t.id),children:t.label},t.id))})}function xu(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(hover: none) and (pointer: coarse)`).matches}var Su=/^(?:enter|return|tab|esc|space|shift|ctrl\+\S+|cmd\+\S+|alt\+\S+|[↑↓←→]+(?:\/[↑↓←→]+)?|[b-hj-z](?:\/[b-hj-z])?)(?:\/\S+)?(?:\s|$)/i;function Cu(e){return e.split(`·`).map(e=>e.trim()).filter(e=>e&&!Su.test(e)).join(` · `)}function wu(e){return xu()?Cu(e):e}function Tu(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 Eu(e){let t=Ou(e);return t<0||t===e.length-1?{base:e,dir:``}:{base:e.slice(t+1),dir:e.slice(0,t+1)}}function Du(e){return/^(?:[A-Za-z]:(?:[\\/]|$)|\\\\)/.test(e)}function Ou(e){return Du(e)||/^~\\/.test(e)?Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`)):e.lastIndexOf(`/`)}function ku(e){return e.startsWith(`/`)||Du(e)}function Au(e){return e.startsWith(`~`)||e.includes(`/`)||Du(e)}function ju(e,t){return t?e===`~`?t:e.startsWith(`~/`)||e.startsWith(`~\\`)?t+e.slice(1):e:e}function Mu(e){let t=Du(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 Nu=/^(?:(?:https?|ssh|git):\/\/[A-Za-z0-9[]\S*|[A-Za-z0-9._-]+@[A-Za-z0-9][A-Za-z0-9.-]*:\S+)$/i,Pu=/^[A-Za-z0-9][A-Za-z0-9-]{0,38}\/(?![.]+(?:git)?$)[A-Za-z0-9._-]{1,100}$/i;function Fu(e){let t=e.trim();return Nu.test(t)||Pu.test(t)?t:null}var Iu=/^(?:https?:\/\/(?:www\.)?github\.com\/|(?:ssh:\/\/)?git@github\.com[:/])/i;function Lu(e){let t=e.trim(),n=t.replace(Iu,``);if(n===t)return Pu.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 Ru(e,t){return e.filter(e=>e.enabled!==!1||e.id===t)}function zu(e,t){return(e.find(e=>e.id===t)??e.find(e=>e.ready!==!1)??e[0])?.id??``}function Bu(e,t){return!e||e.acceptsModel===!1?[]:[{id:``,label:t},...(e.models??[]).map(e=>({id:e.id,label:e.label??e.id}))]}function Vu(e,t,n){return t?e.find(e=>e.id===t)?.label??t:n}function Hu(e,t){return e.includes(t)?e.length>1?e.filter(e=>e!==t):e:[...e,t]}function Uu(e){let[t,n,...r]=e;return!t||!n?t??``:r.length>0?`${t} + ${n} +${r.length}`:`${t} + ${n}`}function Wu(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 Gu(e){let[t,...n]=e;if(!t)return``;let r=Eu(t).base;return n.length>0?`${r} +${n.length}`:r}function Ku(e,t){return e.includes(t)?e.filter(e=>e!==t):e.length>=8?e:[...e,t]}function qu(e,t){if(!/^[1-9]$/.test(e))return null;let n=Number(e)-1;return n<t?n:null}function Ju(e){let[t,...n]=e.repos;if(!t)throw Error(`no repo`);let r=e.at?Tu(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 Yu(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 Xu(e,t,n,r,i=r.trim(),a,o=``){let s=n?{engine:n}:{},c=r.trim()?Tu(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 Qu(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 $u=new WeakMap,ed=200,td=e=>`client`in e?e.client:e,nd=(e,t)=>t?`${e} ${JSON.stringify(t)}`:e;function X(e,t,n){return $u.get(td(e))?.get(nd(t,n))}function rd(e,t,n,r){let i=td(e),a=$u.get(i)??new Map,o=nd(t,n);a.delete(o),a.set(o,r),$u.set(i,a);for(let e of a.keys()){if(a.size<=ed)break;a.delete(e)}return r}function Z(e,t,n){return td(e).request(t,n).then(r=>rd(e,t,n,r))}function id(e,t,n){return n&&n!==`leaf-1`?`${e}::${t}::${n}`:`${e}::${t}`}var ad=`rove.web.engines`;function od(){try{let e=JSON.parse(localStorage.getItem(ad)??`null`);return Array.isArray(e)?{engines:e}:void 0}catch{return}}function sd(e){try{localStorage.setItem(ad,JSON.stringify(e))}catch{}}function cd(e,t,n){let r=t?{repo:t}:{},[i]=(0,m.useState)(()=>{let t=X(e,`engines.list`,r)??X(e,`engines.list`)??od(),i=t?Ru(t.engines):[];return{offered:i,engine:t?zu(i,n??t.preferred):``}}),[a,o]=(0,m.useState)(i.offered),[s,c]=(0,m.useState)(i.engine);return(0,m.useEffect)(()=>e.client.onOpen(()=>{Z(e,`engines.list`,r).then(e=>{sd(e.engines);let t=Ru(e.engines);o(t),c(zu(t,n??e.preferred))}).catch(()=>{})}),[e]),{engines:a,engine:s,setEngine:c}}var ld=`shell`,ud=`pane:`,dd=e=>e.startsWith(ud),fd=e=>e.slice(5);function pd(e){let[t,n]=(0,m.useState)(()=>X(e,`plugin.panes`)?.panes??[]);return(0,m.useEffect)(()=>{Z(e,`plugin.panes`).then(e=>n(e.panes)).catch(()=>n([]))},[e]),t}function md(e){let t=[...e.engines,...e.withShell?[{id:ld,name:H(`tab.shell`)}]:[],...(e.panes??[]).map(e=>({id:ud+e.id,name:e.title}))];return(0,W.jsx)(bu,{label:H(`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?H(`newTask.notReady`):void 0}))})}function hd(e,t){return gd(e,t,{kind:`engine`,latest:!0}).catch(e=>z(String(e),`error`))}async function gd(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 Io(id(t,r))?.reattach(),e.select(t,r)}async function _d(e){await gd(e,(await e.client.request(`task.openScratch`,{})).taskId,{kind:`shell`})}var vd=[`1`,`2`,`3`,`4`,`5`],yd=[`tab`,`fork`,`scratch`],bd=[`message`,`attempts`,`engine`,`fork-base`,`destination`];function xd(e){U();let{model:t,taskId:n}=e,r=t.tasks.get()?.tasks.find(e=>e.id===n),i=cd(t,r?.repo),[a,o]=(0,m.useState)(e.destination??`tab`),[s,c]=(0,m.useState)(e.context??`fresh`),[l,u]=(0,m.useState)(``),[d,f]=(0,m.useState)(`1`),[p,h]=(0,m.useState)(r?.branch??`main`),{busy:g,error:_,setError:v,submit:y}=wi(),{attachments:b,attach:x,remove:S,ready:C}=vu(t,v,void 0,n),w=s===`fresh`&&a!==`fork`,T=a===`tab`&&s===`fresh`,E=pd(t),D=i.engine===`shell`&&!w||dd(i.engine)&&!T?``:i.engine,O=D===ld,k=dd(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`,ee=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`?J(`terminal`,`tab.noTranscriptToHandOff`,{engine:e.engine??``}):J(`terminal`,`tab.nothingToFork`))},P=()=>y(async()=>{let e=s===`continue`&&a===`tab`&&!O&&!k&&N(),i=[s===`continue`&&!e?await ee():``,pu(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 gd(t,e.taskId,{kind:`shell`}):t.selectWhenListed(e.taskId)}else if(A){if(!r)throw Error(J(`terminal`,`tab.tabGone`));if(!l.trim())throw Error(H(`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=Wu(e);if(!t)throw e;z(e instanceof Error?e.message:String(e),`error`),ve(t);return}a.forkRefused&&z(H(`taskops.forkLeftBehind`,{reason:a.forkRefused}));let o=a.taskIds[0];a.groupId?ve(a.groupId):o&&t.selectWhenListed(o)}else if(O)await gd(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:fd(D),...r?{tabId:r}:{}});await t.refreshTabsNow(n),t.select(n,i.tabId)}else await gd(t,n,{kind:`engine`,engine:D,prompt:i,...e?{replaceTab:M()}:{}})});return(0,W.jsx)(Ci,{title:J(`terminal`,`tab.newChat.title`),wide:!0,children:(0,W.jsxs)(`form`,{className:Kr,onKeyDown:e=>{if(e.key===`Tab`&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&(A||!e.shiftKey))e.preventDefault(),e.stopPropagation(),A?Qu(e.currentTarget,bd,e.shiftKey?-1:1):j(yd[(yd.indexOf(a)+1)%yd.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(),P()},onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault(),x(Array.from(e.dataTransfer.files))},children:[(0,W.jsxs)(`div`,{className:Ir,children:[(0,W.jsx)(`span`,{className:`${Ar} text-muted`,children:J(`terminal`,`tab.newChat.engine`)}),(0,W.jsx)(md,{engines:i.engines,value:D,onChange:i.setEngine,withShell:w,panes:T?E:[]})]}),(0,W.jsxs)(`div`,{className:Ir,children:[(0,W.jsx)(`span`,{className:`${Ar} text-muted`,children:J(`terminal`,`tab.newChat.destLabel`)}),(0,W.jsx)(bu,{label:J(`terminal`,`tab.newChat.destLabel`),field:`destination`,value:a,onChange:e=>j(e,s),choices:yd.map(e=>({id:e,label:J(`terminal`,`tab.newChat.dest${e===`tab`?`Tab`:e===`fork`?`Fork`:`Scratch`}`)}))})]}),(0,W.jsxs)(`div`,{className:Ir,children:[(0,W.jsxs)(`span`,{className:`${Ar} text-muted`,children:[J(`terminal`,`tab.newChat.ctxLabel`),` `,(0,W.jsx)(`span`,{className:`keys-only`,children:`ctrl+f`})]}),(0,W.jsx)(bu,{label:J(`terminal`,`tab.newChat.ctxLabel`),field:`context`,value:s,onChange:e=>j(a,e===`continue`?`continue`:`fresh`),choices:[`fresh`,`continue`].map(e=>({id:e,label:J(`terminal`,`tab.newChat.ctx${e===`fresh`?`Fresh`:`Continue`}`)}))})]}),A&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,W.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:J(`quickTask`,`attemptsLabel`)}),(0,W.jsx)(bu,{label:J(`quickTask`,`attemptsLabel`),field:`attempts`,value:d,onChange:f,choices:vd.map(e=>({id:e,label:e}))})]}),(0,W.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,W.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:H(`taskops.forkBranch`)}),(0,W.jsx)(`input`,{className:Nr,"data-field":`fork-base`,spellCheck:!1,value:p,onChange:e=>h(e.target.value)})]})]}),!O&&!k&&a!==`scratch`&&(0,W.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,W.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:H(`newChat.prompt`)}),(0,W.jsx)(`textarea`,{className:`${Nr} min-h-18 max-h-[50vh] leading-[1.45]`,"data-field":`message`,autoFocus:!0,rows:4,placeholder:H(`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,W.jsx)(yu,{attachments:b,onRemove:S}),xu()?(0,W.jsx)(`p`,{className:`text-muted`,children:H(`pages.attachHintTouch`)}):(0,W.jsx)(`p`,{className:`keys-only mx-0 mt-2 mb-0 ${Tr}`,children:J(`quickTask`,`legend`)}),_&&(0,W.jsx)(`p`,{className:`text-error`,children:_}),(0,W.jsx)(Di,{busy:g,submitLabel:H(`newChat.start`)})]})})}var Sd=e=>e.split(/[\\/]/).filter(Boolean),Cd=e=>Sd(e).pop()??e;function wd(e,t,n=``){let r=Cd(e),i=t.filter(t=>(t.repo!==e||t.host!==n)&&Cd(t.repo)===r);if(i.length===0)return r;let a=e=>Sd(e).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 Td=e=>e.startsWith(`root:`)?null:e.split(`/`).slice(-2).join(`/`);function Ed(e,t){let n=Cd(e.repo),r=t.filter(t=>t!==e&&Cd(t.repo)===n);if(r.length===0)return n;let i=e.repoId,a=i?Td(i):null;return i&&a?r.some(e=>e.repoId&&e.repoId!==i&&Td(e.repoId)===a)?i:a:wd(e.repo,[e,...r].map(e=>({repo:e.repo,host:``})))}var Dd=/\s+#\d+\/\d+$/,Od=(e,t)=>(e.createdAt??``).localeCompare(t.createdAt??``)||e.id.localeCompare(t.id),kd=e=>e.groupId?`${e.machine?.id??``}\0${e.groupId}`:null;function Ad(e){let t=new Map;for(let n of e){let e=kd(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(Od);return t}function jd(e){return(e[0]?.label??``).replace(Dd,``)}function Md(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 Nd=[`default`,`recent`,`attention`,`name`],Pd={folded:new Set,opened:new Set},Fd=e=>{let t=Date.parse(e??``);return Number.isFinite(t)?t:0},Id=e=>Fd(e.updatedAt??e.createdAt),Ld=e=>Fd(e.createdAt),Rd=(e,t)=>Ld(t)-Ld(e)||t.id.localeCompare(e.id),zd=(e,t)=>Id(t)-Id(e)||t.id.localeCompare(e.id),Bd=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`}),Vd={default:null,recent:Rd,attention:(e,t)=>e.rank-t.rank||zd(e,t),name:(e,t)=>Bd.compare(e.label.trim(),t.label.trim())||e.id.localeCompare(t.id)},Hd=`~scratch`,Ud=e=>e.kind===`dir`&&(e.scratch===!0||e.noProject===!0);function Wd(e,t){return[...e].sort((e,t)=>(e.order??e.rank)-(t.order??t.rank)).sort(qd(Vd[t]))}function Gd(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=Ud(e)?Hd:e.repo,n=r.get(t);n?n.push(e):r.set(t,[e])}let i=Vd[t],a=[...r].map(([e,t])=>{let n=t.sort(qd(i));if(e===`~scratch`&&t.every(Ud))return{repo:``,label:H(`rail.noProject`),tasks:n,key:Hd,noProject:!0};let r=t.find(e=>e.repoId)?.repoId;return{repo:e,label:Cd(e),tasks:n,...r?{repoId:r}:{}}});return[...a.filter(e=>e.noProject),...a.filter(e=>!e.noProject)]}var Kd=e=>+!e.pinned,qd=e=>(t,n)=>Kd(t)-Kd(n)||(e?e(t,n):0);function Jd(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 Yd(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)||Jd(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 Xd(e,t,n=[]){for(let r of e.get(t)??[])n.push(r.id),Xd(e,r.id,n);return n}function Zd(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 Qd(e,t=``,n=Pd,r=0,i=!0){let a=t.trim(),o=(...e)=>e.some(e=>e!==``&&pl(a,e)),{children:s,nested:c}=Yd(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,Cd(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?Xd(s,t.id):[],m=u!==void 0&&a===``&&Zd(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?Ad(t):new Map,o=new Set;for(let i of t){let t=kd(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:jd(s),tasks:s,depth:Math.min(l,3),...c.machine?{machine:c.machine.id}:{}});let u=Md(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 $d=e=>Math.max(0,...e.tasks.map(Ld));function ef(e){let t=e.tasks.filter(e=>!e.routine),n=e.remote.filter(e=>!e.routine),r=[...Gd(t,e.sort).map(e=>({group:e})),...e.machines.flatMap(t=>Gd(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?Hd:t??(e.machine===void 0?n:`${e.machine}\0${n}`),a=i.get(r);a?a.push(e):i.set(r,[e])}let a=Vd[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(qd(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:Ed(e,s)])),l=s.map(e=>({...e,label:c.get(e)??e.label}));return e.sort===`recent`&&l.sort((e,t)=>$d(t)-$d(e)),e.sort===`name`&&l.sort((e,t)=>Bd.compare(e.label,t.label)),l.sort((e,t)=>Number(t.noProject===!0)-Number(e.noProject===!0)),{rows:Qd(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 tf(e){return e.title??e.engineName??(e.kind===`engine`?H(`tab.engine`):H(`tab.shell`))}function nf(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 rf(e){return e.kind===`leaf`?[e]:e.children.flatMap(rf)}function af(e){return!!e&&rf(e.root).length>1}function of(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 sf(e,t,n=1){let r=rf(e.root).map(e=>e.id),i=r.indexOf(t);return r[(Math.max(0,i)+n+r.length)%r.length]??t}function cf(e,t){let n=new Map,r=new Map;for(let i of rf(e.root)){if(i.title){r.set(i.id,i.title);continue}let e=i.own?t:i.engineName??`shell`,a=(n.get(e)??0)+1;n.set(e,a),r.set(i.id,a===1?e:`${e} ${a}`)}return r}function lf(e,t,n){return e.kind===`engine`&&rf(t.root).some(e=>e.id===n&&e.own)}function uf(e){return e.alive!==!1||!!e.split&&!rf(e.split.root).some(e=>e.own)}function df(e){return rf(e.root).map(e=>e.id).join(`,`)}function ff(e){return!(e instanceof HTMLElement)||e.closest(`.xterm`)?!1:e.isContentEditable||[`INPUT`,`TEXTAREA`,`SELECT`].includes(e.tagName)}function pf(e){return e instanceof HTMLElement&&!!e.closest(`.rail, button, a`)}var mf=e=>e.tabs.get()[e.selection.get().taskId??``]??[];function hf(e){let{taskId:t,tabId:n}=e.selection.get(),r=mf(e);return{taskId:t,tabs:r,at:r.findIndex(e=>e.id===n)}}function gf(e,t){let{taskId:n,tabs:r}=hf(e),i=r[t];!n||!i||e.select(n,i.id)}function _f(e){let{taskId:t,tabs:n,at:r}=hf(e),i=n[r];!t||!i||O.set((0,W.jsx)(Ti,{title:H(`menu.renameTab`),initial:tf(i),submitLabel:H(`dialog.save`),onSubmit:async n=>{await e.renameTab(t,i.id,n)}}))}var vf=e=>!!e.selection.get().taskId,yf=e=>mf(e).length>0,bf=[{id:`help.open`,chords:[`f1`],prefix:!1,run:Bl},{id:`focus.next`,chords:[`f4`],prefix:!1,run:()=>eo(1)},{id:`chat.tab.chooseEngine`,chords:[`ctrl+e`],prefix:!1,surface:`workspace`,live:vf,run:e=>{let{taskId:t}=e.selection.get();t&&O.set((0,W.jsx)(xd,{model:e,taskId:t}))}},{id:`chat.tab.rename`,chords:[`f2`],prefix:!1,surface:`workspace`,live:e=>{let{tabs:t,at:n}=hf(e);return!!t[n]&&!af(t[n]?.split)},run:_f},{id:`chat.tab.cycle-next`,chords:[`ctrl+]`],prefix:!1,surface:`workspace`,live:yf,run:e=>gf(e,(hf(e).at+1)%mf(e).length)},{id:`chat.tab.cycle-prev`,chords:[`ctrl+[`],prefix:!1,surface:`workspace`,live:yf,run:e=>gf(e,(hf(e).at-1+mf(e).length)%mf(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:yf,run:(e,t=``)=>{let n=Do().find(e=>e.id===`chat.tab.goto`&&!e.prefix)?.chords.indexOf(t)??-1;n>=0&&gf(e,n)}},{id:`attention.next`,chords:[`f7`],prefix:!1,run:e=>Sf(e)}];To(()=>bf);function xf(e){(0,m.useEffect)(()=>{let t=t=>{if(O.get()||ff(t.target))return;let n=N.get();if(n===`worktrees`)return;let r=Ao()??(vf(e)?`workspace`:`sidebar`),{taskId:i}=e.selection.get();if(!n&&i&&!t.ctrlKey&&!t.shiftKey&&!t.metaKey&&!t.altKey&&t.key===`Enter`&&!yf(e)&&!pf(t.target)){t.preventDefault(),t.stopPropagation(),O.set((0,W.jsx)(xd,{model:e,taskId:i}));return}let a=sl(t),o=Do().filter(t=>!t.prefix&&!t.native&&t.chords.some(e=>a.includes(e))&&Oo(t,r)&&!(n&&t.surface)&&t.live?.(e)!==!1).sort((e,t)=>ko(e,r)-ko(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 Sf(e){let t=e.tasks.get();if(!t)return;let n=ql(t.attention,t.tasks.map(e=>e.id),e.selection.get());if(!n){z(H(`inbox.empty`));return}if(Wl(n.state)){Xl(e,n);return}n.taskId!==null&&(e.select(n.taskId,n.tabId),Yl(e,n))}async function Cf(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){z(H(`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){z(K(e),`error`)}}function wf(e){(0,m.useEffect)(()=>{let t=t=>{let n=lo.get().plugins;if(n.length===0||!Co({dialog:O.get()!==null,page:N.get()})||ff(t.target))return;let r=So(n,sl(t));r&&(t.preventDefault(),t.stopImmediatePropagation(),Cf(e,r))};return window.addEventListener(`keydown`,t,{capture:!0}),()=>window.removeEventListener(`keydown`,t,{capture:!0})},[e])}var Tf=`prefix.moreCommands`,Ef=/^ctrl\+[^+]+$/;function Df(e){return Ef.test(e)?e.slice(5):null}function Of(e){let t=fl(e.bindingId);if(!t)return null;if(e.reachability.direct.has(e.bindingId)){let e=t.keys[0];if(e)return so(e)}if(e.prefixKey&&e.reachability.prefix.has(e.bindingId)){let n=t.prefixKeys?.[0];if(n)return`${so(e.prefixKey)} ${so(n)}`}return null}function kf(e,t){let n=Y.filter(t=>e.direct.has(t.id)).flatMap(e=>{let t=e.keys.flatMap(e=>Df(e)??[]);return t.length>2?[{stroke:`${t[0]}-${t.at(-1)}`,action:e.id}]:t.map(t=>({stroke:t,action:e.id}))}),r=t?Df(t):null;return r&&e.prefix.size>0&&n.push({stroke:r,action:Tf}),n}var Af=4e3,jf=180,Mf=Af,Nf=v({guide:null,entries:[]}),Pf=1;function Ff(e,t){let n={id:Pf++,stroke:e,action:t,at:Date.now()};Nf.set({guide:null,entries:[...Nf.get().entries,n].slice(-3)})}var If=`modulepreload`,Lf=function(e){return`/`+e},Rf={},zf=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=Lf(t,n),t=s(t),t in Rf)return;Rf[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`:If,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)})},Bf=8,Vf=32,Hf=3e3,Uf=100,Wf=new WeakMap,Gf=null;function Kf(e){let t=Wf.get(e);return t||(t={entries:new Map,snapshots:new Map,left:null},Wf.set(e,t)),t}function qf(){return Gf||(Gf=document.createElement(`div`),Gf.style.display=`none`,document.body.append(Gf)),Gf}function Jf(e,t,n){e.snapshots.delete(t),e.snapshots.set(t,n);for(let t of e.snapshots.keys()){if(e.snapshots.size<=Vf)break;e.snapshots.delete(t)}}function Yf(e,t,n){e.entries.delete(t.key),t.leaving!==null&&window.clearTimeout(t.leaving),t.leaving=null,n?Jf(e,t.key,t.handle.snapshot()):e.snapshots.delete(t.key),t.handle.dispose(),t.box.remove()}function Xf(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-Bf)))Yf(e,n,!0)}function Zf(e,t){return Kf(e).entries.get(t)?.handle??null}function Qf(e,t,n,r){return Kf(e).entries.get(id(t,n,r))?.slot.parkedAt!=null}async function $f(e,t){let n=Kf(e.client),r=id(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,rp(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:()=>ep(n,i)}}let a=document.createElement(`div`);a.className=Pn,e.host.append(a),tp(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 zf(async()=>{let{mountTerminal:e}=await import(`./term-mount-Cn86hde_.js`);return{mountTerminal:e}},__vite__mapDeps([0,1,2])),d=u({...e,el:a,snapshot:l,onPainted:()=>rp(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&&Yf(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:()=>ep(n,f)}}function ep(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(),qf().append(t.box),e.left=t,Xf(e))}function tp(e,t){let n=e.left;e.left=null,!(!n||n.slot.parkedAt===null||performance.now()-n.slot.parkedAt>Uf)&&e.entries.get(n.key)===n&&(n.box.classList.add(`is-leaving`),t.append(n.box),n.leaving=window.setTimeout(()=>np(e,n),Hf))}function np(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&&qf().append(t.box))}function rp(e){for(let t of e.entries.values())np(e,t)}async function ip(e,t,n){return Jl(await e.request(`output.read`,{taskId:t,tab:n,source:`terminal`,limit:12}))}async function ap(e,t,n,r){try{let i=await e.client.request(`tab.send`,{taskId:t,tabId:n,prompt:r});return i.delivered?!0:(z(H(`layout.composerNotSent`,{reason:i.reason??``}),`error`),!1)}catch(e){let t=e instanceof Go?e.code:void 0;return z(t===`UNKNOWN_OP`?H(`layout.composerOldBridge`):t===`AWAITING_PERMISSION`?H(`layout.composerAtMenu`):e instanceof Error?e.message:String(e),`error`),!1}}async function op(e,t,n,r){let{client:i}=e,a=id(t,n),o=Io(a)!==void 0||Qf(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 z(e instanceof Error?e.message:String(e),`error`),!1}finally{o||await i.request(`term.detach`,{stream:a}).catch(()=>{})}}async function sp(e,t,n){try{return(await e.client.request(`gate.answer`,{gateId:t,...n})).delivered||z(H(`inbox.gateKept`)),!0}catch(e){return z(e instanceof Error?e.message:String(e),`error`),!1}}var cp=(e,t,n)=>({id:e,cap:t,bytes:e=>`\x1b${e?`O`:`[`}${n}`}),lp={id:`enter`,cap:`⏎`,bytes:()=>`\r`},up=[{id:`esc`,cap:`esc`,bytes:()=>`\x1B`},{id:`tab`,cap:`tab`,bytes:()=>` `},{id:`backtab`,cap:`⇧tab`,bytes:()=>`\x1B[Z`},{id:`interrupt`,cap:`^C`,bytes:()=>``},cp(`up`,`↑`,`A`),cp(`down`,`↓`,`B`),cp(`left`,`←`,`D`),cp(`right`,`→`,`C`),lp],dp=e=>({id:`option-${e}`,cap:String(e),bytes:()=>String(e)}),fp=[dp(1),dp(2),dp(3),dp(4),lp];function pp(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 mp=`\x1B[27;2;13~`;function hp(e){return e.key!==`Enter`||!e.shiftKey||e.ctrlKey||e.metaKey||e.altKey?!1:!e.isComposing&&e.keyCode!==229}function gp(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 _p=`mx-2.5 mt-0.5 mb-1.5 flex min-w-0 flex-col gap-1.5 font-mono text-meta`,vp=2e3;function yp(e,t,n){let[r,i]=(0,m.useState)(null),[a,o]=(0,m.useState)(0);return(0,m.useEffect)(()=>{if(!n)return;let r=!0,a=0,o=async()=>{try{let a=await ip(e.client,t,n);r&&i(a)}catch{r&&i(e=>e??[])}r&&(a=window.setTimeout(o,vp))};return o(),()=>{r=!1,window.clearTimeout(a)}},[e,t,n,a]),{lines:r,refresh:()=>o(e=>e+1)}}function bp(e){U();let{model:t,taskId:n,tabId:r,mode:i,gate:a}=e,{lines:o,refresh:s}=yp(t,n,r),c=(0,m.useRef)(null),[l,u]=(0,m.useState)(``),[d,f]=(0,m.useState)(!1);(0,m.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},h=async()=>{let e=l.trim();!e||d||await p(()=>i===`gate`&&a?sp(t,a.id,{text:e}):r?ap(t,n,r,e):Promise.resolve(!1))&&u(``)};return(0,W.jsxs)(`div`,{className:_p,children:[a&&(0,W.jsx)(`p`,{className:`m-0 whitespace-pre-wrap wrap-anywhere text-ink`,children:a.question}),r&&(0,W.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?H(`inbox.noOutput`):o.join(`
40
- `)}),i===`gate`&&a&&(0,W.jsx)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:a.options.map(e=>(0,W.jsxs)(G,{disabled:d,title:e.detail,onClick:()=>void p(()=>sp(t,a.id,{option:e.key})),children:[`[ `,e.key===a.recommended?`★ `:``,e.label,` ]`]},e.key))}),i===`menu`&&r&&(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[fp.map(e=>(0,W.jsxs)(G,{disabled:d,onClick:()=>void p(()=>op(t,n,r,e.bytes(!1))),children:[`[ `,e.cap,` ]`]},e.id)),(0,W.jsx)(G,{onClick:e.onOpenTab,children:H(`inbox.openTab`)})]}),(i===`reply`||i===`gate`)&&(0,W.jsxs)(`form`,{className:`flex min-w-0 items-center gap-2`,onSubmit:e=>{e.preventDefault(),h()},children:[(0,W.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:H(`inbox.replyPlaceholder`),"aria-label":H(`inbox.replyPlaceholder`),autoComplete:`off`,enterKeyHint:`send`,onChange:e=>u(e.target.value)}),(0,W.jsx)(G,{type:`submit`,disabled:d||l.trim()===``,children:H(`inbox.send`)})]})]})}function xp({text:e}){return(0,W.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,W.jsx)(`span`,{children:e},e))})}var Sp={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`},Cp={accent:`text-accent`,muted:`text-subtle`,attention:`text-error`,warning:`text-warning`,success:`text-success`,info:`text-accent`,ink:`text-ink`},wp=6;function Tp(e,t){return e?`${Cd(e.repo)} › ${e.label}`:t}function Ep({model:e}){U();let t=y(e.tasks),n=y(e.visits),r=y(e.tabs),[i,a]=(0,m.useState)(0),[o,s]=(0,m.useState)(null),[c,l]=(0,m.useState)(Date.now());(0,m.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=Kl(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:Tp(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}`)),h=n.filter(e=>u.has(e.taskId)&&!p.has(`${e.taskId}:${e.tabId}`)).slice(0,wp).map(e=>({key:`r:${e.taskId}:${e.tabId}`,section:`recent`,taskId:e.taskId,tabId:e.tabId,identity:Tp(u.get(e.taskId),e.taskId),subtitle:d(e.taskId,e.tabId)||u.get(e.taskId)?.branch||``,at:e.at})),g=[...f,...h],_=g[Math.min(i,g.length-1)],v=t=>{if(t.attention&&Wl(t.attention.state))return Xl(e,t.attention);t.attention&&Yl(e,t.attention),t.taskId&&u.has(t.taskId)&&(e.select(t.taskId,t.tabId),B())},b=()=>void Promise.all(f.map(t=>t.attention&&Yl(e,t.attention,!0)));(0,m.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)Yl(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?Hl(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&&!Wl(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,W.jsxs)(`li`,{children:[(0,W.jsxs)(`div`,{className:ui,children:[(0,W.jsxs)(`button`,{type:`button`,className:`${gi({selected:i,stack:!0})} ${di}`,onMouseEnter:()=>a(g.indexOf(n)),onClick:()=>v(n),children:[(0,W.jsxs)(`span`,{className:ci,children:[(0,W.jsx)(`span`,{className:_i,children:n.identity}),r&&(0,W.jsxs)(`span`,{className:`flex-none font-mono text-meta font-normal normal-nums ${Cp[r.tone]}`,children:[r.glyph,` `,H(r.stateKey)]}),(0,W.jsx)(`span`,{className:li,children:Ul(c-n.at)})]}),n.subtitle&&(0,W.jsx)(`span`,{className:`truncate font-mono text-meta font-normal normal-nums text-muted`,children:n.subtitle})]}),m?(0,W.jsx)(G,{className:fi,"aria-expanded":x,onClick:()=>{a(g.indexOf(n)),s(x?null:b)},children:H(x?`inbox.hide`:`inbox.reply`)}):(0,W.jsx)(`span`,{"aria-hidden":!0,className:fi})]}),x&&n.taskId&&(0,W.jsx)(bp,{model:e,taskId:n.taskId,tabId:p,mode:y,gate:f,onOpenTab:()=>v(n)})]},n.key)};return(0,W.jsx)(Ci,{title:H(`inbox.title`),wide:!0,children:(0,W.jsxs)(`div`,{className:Kr,children:[(0,W.jsxs)(`div`,{className:ai,children:[(0,W.jsx)(`p`,{className:`${Ar} text-muted ${ii} touch:hidden!`,children:(0,W.jsx)(xp,{text:H(`inbox.hints`)})}),f.length>0&&(0,W.jsx)(G,{className:`flex-none min-w-[calc(9ch+0.5rem)] whitespace-nowrap pr-2 text-right font-mono text-meta`,onClick:b,children:H(`inbox.ackAll`)})]}),(0,W.jsx)(`h2`,{className:`${Ar} text-muted ${oi}`,children:H(`inbox.attention`)}),f.length===0?(0,W.jsx)(`p`,{className:`mono text-muted`,children:H(`inbox.empty`)}):(0,W.jsx)(`ul`,{className:si,children:f.map(x)}),h.length>0&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`h2`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted mt-1`,children:H(`inbox.recent`)}),(0,W.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-0.5 p-0`,children:h.map(x)})]})]})})}var Dp=`rove.prefs`,Op={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,editorKind:`auto`,worktreeBase:`default`,scrollbackRows:1e3,tabStrip:`never`,prefixTap:`local`,remoteProjects:!1,autoStatus:!1,dispatcher:!1,updateChannel:`latest`,updateNotify:!0};function kp(){try{let e=JSON.parse(localStorage.getItem(Dp)??`null`);if(e&&typeof e==`object`&&`prefs`in e&&`themes`in e){let t=e;return{...t,prefs:{...Op,...t.prefs},loaded:!0}}}catch{}return{loaded:!1,prefs:Op,options:{},info:{editorCustomSet:!1,worktreeCustomPath:``},themes:[],glyphSets:{}}}var Ap=v(kp());function jp(e){(e.locale===`en`||e.locale===`zh`)&&Mt.set(e.locale)}jp(Ap.get().prefs);function Mp(e){let t={loaded:!0,prefs:e.prefs,options:e.options,info:e.info,themes:e.themes,glyphSets:e.glyphSets};Ap.set(t),jp(t.prefs),localStorage.setItem(Dp,JSON.stringify(t))}var Np=null;async function Pp(e){Np=e,Mp(await e.request(`prefs.get`))}async function Fp(e,t,n){let r=Ap.get();Ap.set({...r,prefs:{...r.prefs,[t]:n}}),jp(Ap.get().prefs);try{let r=await e.request(`prefs.set`,{key:t,value:n});Mp({...Ap.get(),prefs:r.prefs})}catch(e){Ap.set(r),jp(r.prefs),z(e instanceof Error?e.message:String(e),`error`)}}function Ip(e,t){if(Np)return void Fp(Np,e,t);let n=Ap.get();Ap.set({...n,prefs:{...n.prefs,[e]:t}})}function Lp(){return y(Ap)}function Rp(e,t){let n=e.options[t];return Array.isArray(n)?n:[]}var zp=[`project`,`state`],Bp=`rove.railGroup`,Vp=v(zp.find(e=>e===localStorage.getItem(Bp))??`project`);function Hp(e){e!==Vp.get()&&(Vp.set(e),localStorage.setItem(Bp,e))}Ap.subscribe(()=>{let{loaded:e,prefs:t}=Ap.get();e&&zp.includes(t.railGroup)&&Hp(t.railGroup)});function Up(e){Hp(e),Ip(`railGroup`,e)}var Wp=`rove.activeSortMode`;function Gp(){let e=localStorage.getItem(Wp);return Nd.find(t=>t===e)??`recent`}var Kp=v(Gp());function qp(e){e!==Kp.get()&&(Kp.set(e),localStorage.setItem(Wp,e))}Ap.subscribe(()=>{let{loaded:e,prefs:t}=Ap.get();e&&Nd.includes(t.railSort)&&qp(t.railSort)});function Jp(e){qp(e),Ip(`railSort`,e)}function Yp(){Jp(Nd[(Nd.indexOf(Kp.get())+1)%Nd.length]??`default`)}var Xp=v(!1);function Zp(e){e&&(Kp.get()!=="default"||Vp.get()===`state`)&&(Jp(`default`),Up(`project`),z(J(`tasks`,`sort.reorderSwitched`))),Xp.set(e)}async function Qp(e,t,n){let r=n<0?`up`:`down`;try{await e.client.request(`task.move`,{taskId:t.task.id,direction:r})}catch(e){z(J(`tasks`,`toast.moveFailed`,{error:e instanceof Error?e.message:String(e)}),`error`)}}async function $p(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){z(J(`tasks`,`toast.moveFailed`,{error:e instanceof Error?e.message:String(e)}),`error`)}}var em=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5],tm=Array.from({length:64},(e,t)=>{let n=t%8,r=t>>3;return(4*(em[(r&3)*4+(n&3)]??0)+([0,2,3,1][(r>>2)*2+(n>>2)]??0)+.5)/64}),nm=(e,t)=>tm[(t&7)*8+(e&7)]??1,rm=[[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 im(e,t){e.fill(0);for(let[n,r,i]of rm)Math.sin(t*.8+i)>-.5&&(e[r*128+n]=1)}var am=64,om=40,sm=25,cm=(1-1.2/sm)**2,lm=[{radius:1.55,lift:.3,roll:-.42,speed:.9,phase:.4,ink:4},{radius:1.95,lift:.22,roll:.3,speed:-.55,phase:2.6,ink:3},{radius:2.4,lift:.36,roll:-.12,speed:.38,phase:4.4,ink:3}],um=1.9;function dm(e,t){im(e,t);let n=(t,n,r)=>{t>=0&&t<128&&n>=0&&n<80&&(e[n*128+t]=r)},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<80;e++)for(let t=0;t<128;t++){let s=(t+.5-am)/sm,u=(e+.5-om)/sm,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)>nm(t,e)?n(t,e,h>.4?3:2):p>cm&&n(t,e,1)}for(let e of lm){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(am+s*sm),Math.floor(om+c*sm),l]},o=Math.round(Math.PI*e.radius*sm);for(let e=0;e<o;e++){let t=a(e/o*Math.PI*2);t&&!t[2]&&n(t[0],t[1],1)}let s=e.phase+t*e.speed,c=.5/(e.radius*sm),l=-Math.sign(e.speed)*c;for(let e=um/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,0)}for(let t=um/c;t>0;t--){let r=a(s+t*l),i=1-t*c/um;r&&i>nm(r[0],r[1])&&n(r[0],r[1],i>.6?e.ink:2)}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)}}var fm=-.38,pm=Math.cos(fm),mm=Math.sin(fm),hm=.3;function gm(e,t){im(e,t);let n=t*.21,r=55*Math.cos(n),i=21*Math.sin(n),a=r*pm-i*mm,o=r*mm+i*pm;for(let t=0;t<80;t++)for(let r=0;r<128;r++){let s=t*128+r,c=r+.5-64,l=t+.5-40,u=c*pm+l*mm,d=l*pm-c*mm,f=nm(r,t),p=(u*u+d*d)/441;if(p<1){let t=Math.sqrt(1-p),r=Math.max(0,-.57*u/21-.68*d/21+.56*t),i=d/21+.17*t;e[s]=r*(.73+.23*Math.cos(i*18+.5*Math.sin(n+u/9)))>f?3:+(p>.94&&f<.68)}let m=Math.hypot(u,d/hm);if(m>=28&&m<53&&(p>=1||d>0)){let t=.61+.29*Math.cos(m*1.4)+.1*Math.sin(m*3-n);e[s]=(m>41.5&&m<44.5?0:t*(u>10&&d<0&&Math.abs(d)<7?.32:1)*(m<31||m>49?.55:1))>f?m>45&&m<47&&u<-8&&d>0?4:d>0?3:2:0}let h=Math.hypot(c-a,l-o);h<2&&(p>=1||i>0)&&(e[s]=h<1.45?4:2)}}var _m=[[-.33,-.34,.22],[.22,-.5,.11],[-.48,.2,.13],[.15,.34,.27]];function vm(e,t){im(e,t);let n=t*.27,r=26+6*Math.cos(n),i=49+3*Math.sin(n);for(let t=0;t<80;t++)for(let a=0;a<128;a++){let o=t*128+a,s=nm(a,t),c=(a-94)/15,l=(t-55)/15,u=c*c+l*l;if(u<1){let t=Math.sqrt(1-u),n=-.83*c-.49*l+.19*t;for(let[e,t,r]of _m){let i=Math.hypot(c-e,l-t)/r;i<1&&(n+=i>.72?.22:-.3)}e[o]=n>s?n>.54?3:2:+(u>.92&&s<.28)}let d=a-r,f=t-i,p=d/80;if(p>0&&p<1){let t=-d*.63+28*p*p,r=3+13*p,i=(f-t)/r,a=Math.max(0,1-Math.abs(i)),c=.58+.42*Math.cos(i*14+p*5-n),l=Math.max(0,1-Math.abs(f+d*.54)/1.65);(a*c+l*.75)*(1-p)>s&&(e[o]=l>.55&&p<.68?4:p<.56?3:2)}let m=Math.hypot(d,f);m<2.8?e[o]=3:m<8&&.84*(1-m/8)**1.3>s&&(e[o]=4)}}var ym=`flex min-h-0 w-full flex-1 flex-col overflow-y-auto`,bm=`mx-auto mt-[clamp(0rem,calc(50dvh-13rem),12rem)] flex w-full max-w-130 flex-col items-center gap-4 px-5 py-7 text-center narrow:mt-0`,xm=`relative mb-3 aspect-[760/335] min-h-0 w-full max-w-[830px] shrink narrow:aspect-[760/465]`;function Sm(e){let t=e;return()=>(t=Math.imul(t,1664525)+1013904223>>>0,t/4294967296)}var Cm=Sm(892671),wm=Array.from({length:104},(e,t)=>({along:Cm()+Cm()-1,across:Cm()+Cm()-1,depth:Cm(),phase:Cm()*2*Math.PI,pace:Cm(),starX:44+Cm()*672,starY:23+Cm()*284,copper:t===2||t===61||t===24,near:t===2||t===30||t===82,lead:t===2,glint:t===59})).sort((e,t)=>Number(e.near)-Number(t.near)||e.depth-t.depth),Tm=Array.from({length:12},()=>({x:15+Cm()*730,y:12+Cm()*300,phase:Cm()*2*Math.PI})),Em=[[-2,174,174],[0,222,172],[2,262,167],[4,372,149],[5.8,485,96],[6.9,555,101],[7.8,551,143],[8.9,484,174],[10.4,351,204],[11.7,246,177],[13,217,128],[14.3,285,100],[16,459,103],[18,642,132],[20,826,135]];function Dm(e){let t=Math.max(0,Math.min(1,e));return t*t*(3-2*t)}function Om(e){let t=0;for(;t<Em.length-2&&e>Em[t+1][0];)t++;let n=Em[t],r=Em[t+1],i=Em[Math.max(0,t-1)],a=Em[Math.min(Em.length-1,t+2)],o=r[0]-n[0],s=Math.max(0,Math.min(1,(e-n[0])/o)),c=s*s,l=c*s;function u(e){let t=(r[e]-i[e])*o/(r[0]-i[0]),u=(a[e]-n[e])*o/(a[0]-n[0]);return(2*l-3*c+1)*n[e]+(l-2*c+s)*t+(3*c-2*l)*r[e]+(l-c)*u}return[u(1),u(2)]}function km(e,t){let n=t+e.along*1.43+(e.depth-.5)*.32,[r,i]=Om(n),[a,o]=Om(n+.045),s=Math.hypot(a-r,o-i)||1,c=(a-r)/s,l=(o-i)/s,u=Math.sin(n*1.25+e.along*2.2),d=43+15*Math.sin(t*.61)+17*u,f=e.along*67+8*Math.sin(t*.58+e.phase),p=e.across*d+u*18+(e.depth-.5)*25+6*Math.sin(t*.72+e.phase),m=e.near?Dm((t-5)/3)*(1-Dm((t-11.6)/2.1)):0;return{x:r+c*f-l*p+m*(e.depth-.5)*135,y:i+l*f+c*p+m*(e.lead?58:36),near:m}}function Am(e,t,n,r,i,a,o,s,c){let l=Math.cos(r),u=Math.sin(r),d=(e,r,a=0)=>[t+i*(e*l-r*u+.22*a),n+i*(e*u+r*l*.67-a*.7)];function f(t,n,...r){e.fillStyle=t,e.beginPath(),e.moveTo(...n);for(let t of r)e.lineTo(...t);e.closePath(),e.fill()}function p(e,t){let n=1+e*o*.42,r=a*.85+e*o*.5,i=(t,i,a)=>d(t,e*i*n,a*r);f(t,d(3,e*.4),i(3,3,.8),i(1.4,6.3,3.8),i(-4.9,10.6,6),i(-3.7,6.2,3.9),i(-4.3,6.5,3.5),i(-2.3,2.7,.5),d(-2,e*.45))}p(-1,s),p(1,c),f(c,d(6,0),d(3.1,-.95),d(.8,-1.05),d(-2.4,-.75),d(-5.9,-1.35),d(-5.6,.85),d(-2.2,.55),d(.8,1.18),d(2.8,.72))}function jm(e,t,n,r,i,a,o,s,c){let l=1-a,u=.5+.5*Math.sin(i*(1.6+t.pace)+t.phase);if(e.save(),e.setTransform(1,0,0,1,Math.round(n*e.canvas.width/760),Math.round(r*e.canvas.height/335)),t.lead||t.glint||t.depth>.945){let n=(t.lead?6:3)+Math.round(u*2),r=Math.max(2,Math.round(n*l*.82));e.fillStyle=c,e.globalAlpha=l*(.69+.18*u),e.fillRect(-r,0,2*r+1,1),e.fillRect(0,-r-1,1,2*r+3),e.globalAlpha=l*(.38+.14*u),e.fillRect(-2,-2,1,1),e.fillRect(2,2,1,1),e.fillRect(-2,2,1,1),e.fillRect(2,-2,1,1),e.fillStyle=s,e.globalAlpha=l,e.fillRect(-1,-1,3,3)}else{let n=t.depth>.54||t.copper;e.fillStyle=n?s:c,e.globalAlpha=l*(n?.83+.17*u:.56+.2*u);let r=n||o?2:1;e.fillRect(0,0,r,r)}e.restore()}function Mm(e,t,n,r){let i=r.getPropertyValue(`--color-ink`).trim(),a=r.getPropertyValue(`--color-muted`).trim(),o=r.getPropertyValue(`--color-accent`).trim(),s=r.getPropertyValue(`--color-subtle`).trim(),c=`color-mix(in srgb, ${i} 60%, ${r.colorScheme===`light`?`black`:`white`})`,l=`color-mix(in srgb, ${a} 60%, ${i})`,u=`color-mix(in srgb, ${i} 55%, ${o})`,d=`color-mix(in srgb, ${o} 70%, ${r.getPropertyValue(`--color-paper`)})`;e.setTransform(e.canvas.width/760,0,0,e.canvas.height/335,0,0),e.clearRect(0,0,760,335),e.fillStyle=s;for(let n of Tm)e.globalAlpha=.33+.18*Math.sin(t*.52+n.phase),e.fillRect(n.x,n.y,1.9,1.9);for(let r of wm){let f=Dm((t-1.8-r.along*.59-r.depth*.56)/2.25)*(1-Dm((t-14.85-r.along*.36)/1.87)),p=f>0?km(r,t):{x:r.starX,y:r.starY,near:0},m=r.starX+(p.x-r.starX)*f,h=r.starY+(p.y-r.starY)*f;if(f<.97&&jm(e,r,m,h,t,f,n,r.copper?u:c,r.copper?o:l),f<.04)continue;let g=km(r,t+.05),_=Math.atan2(g.y-p.y,g.x-p.x),v=Math.sin(t*(3.9+r.pace*2.4)+r.phase),y=.74*Math.sin(t*1.18+r.along*2.4+.26*r.phase),b=(.31+.51*r.depth**1.8+p.near*(r.lead?2.7:1.55))*(n?1.18:1)*(.28+.72*f);e.globalAlpha=f*(.68+.32*r.depth),Am(e,m,h,_,b,v,y,r.copper?d:s,r.copper?o:r.depth>.5?i:a)}e.globalAlpha=1}var Nm=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];function Pm(e){let t=document.createElement(`canvas`),n=t.getContext(`2d`,{willReadFrequently:!0}),r=e.getContext(`2d`),i=getComputedStyle(e);return a=>{if(!n||!r||!e.clientWidth||!e.clientHeight)return;let o=e.clientWidth<550,s=o?460:440;t.width!==s&&(t.width=s,t.height=Math.round(s*335/760)),Mm(n,a%17,o,i);let c=n.getImageData(0,0,t.width,t.height),l=3;for(let e=0;e<t.height;e++)for(let n=0;n<t.width;n++,l+=4){let t=c.data[l];if(!t)continue;let r=Nm[(n&3)+4*(e&3)];c.data[l]=t>12+7*r?Math.max(135,t)*(r>12?.45:1):0}n.putImageData(c,0,0);let u=Math.min(window.devicePixelRatio||1,2),d=Math.round(e.clientWidth*u),f=Math.round(e.clientHeight*u);(e.width!==d||e.height!==f)&&(e.width=d,e.height=f),r.clearRect(0,0,d,f),r.imageSmoothingEnabled=!1;let p=Math.min(d/760,f/335)*(o?1.24:1),m=760*p,h=335*p;r.drawImage(t,(d-m)/2,(f-h)/2,m,h)}}var Fm=3,Im=2,Lm=[``,`--color-subtle`,`--color-muted`,`--color-ink`,`--color-accent`],Rm={orbit:dm,rings:gm,comet:vm},zm=7;function Bm(e,t){let n=e.getContext(`2d`);if(!n)return;let r=window.devicePixelRatio||1,i=Math.round(128*Fm*r);e.width!==i&&(e.width=i,e.height=Math.round(80*Fm*r)),n.setTransform(r,0,0,r,0,0),n.clearRect(0,0,128*Fm,80*Fm);let a=getComputedStyle(e);for(let e=1;e<=4;e++){n.fillStyle=a.getPropertyValue(Lm[e]??``)||a.color;for(let r=0;r<t.length;r++)t[r]===e&&n.fillRect(r%128*Fm,Math.floor(r/128)*Fm,Im,Im)}}function Vm(e,t){let n=new Uint8Array(10240),r=Rm[t]??dm;return t=>{r(n,t),Bm(e,n)}}function Hm({scene:e}){let t=(0,m.useRef)(null);return(0,m.useEffect)(()=>{let n=t.current;if(!n)return;let r=window.matchMedia(`(prefers-reduced-motion: reduce)`),i=e===`starlings`,a=i?Pm(n):Vm(n,e),o=i?8.7:zm,s=!1,c=0,l=i?0:zm,u=0,d=()=>a(r.matches?o:l),f=e=>{c=requestAnimationFrame(f),!(e-u<1e3/24)&&(l+=(e-u)/1e3,u=e,d())},p=()=>{cancelAnimationFrame(c),!(!s||document.hidden)&&(d(),r.matches||(u=performance.now(),c=requestAnimationFrame(f)))},m=new IntersectionObserver(([e])=>{s=!!e?.isIntersecting,p()});m.observe(n);let h=new MutationObserver(()=>{s&&r.matches&&d()}),g=i?new ResizeObserver(()=>{s&&!document.hidden&&r.matches&&d()}):null;return g?.observe(n),h.observe(document.documentElement,{attributes:!0,attributeFilter:[`style`]}),r.addEventListener(`change`,p),document.addEventListener(`visibilitychange`,p),()=>{cancelAnimationFrame(c),m.disconnect(),g?.disconnect(),h.disconnect(),r.removeEventListener(`change`,p),document.removeEventListener(`visibilitychange`,p)}},[e]),(0,W.jsx)(`div`,{"aria-hidden":`true`,className:e===`starlings`?xm:`mb-3 w-96 max-w-full shrink-0 narrow:w-72`,children:(0,W.jsx)(`canvas`,{ref:t,"data-plate":e,width:128*Fm,height:80*Fm,className:e===`starlings`?`absolute inset-0 block h-full w-full text-muted`:`block h-auto w-full text-muted`},e)})}function Um(e,t){let n=t.trim().toLowerCase(),r=e.toLowerCase();if(r.includes(n))return`substring`;if(!n.includes(`/`))return null;let i=n.split(`/`),a=0;for(let e of r.split(`/`))a<i.length&&e.startsWith(i[a]??``)&&a++;return a===i.length?`segments`:null}function Wm(e,t){if(!t.trim())return e;let n=[],r=[];for(let i of e){let e=Um(i,t);e===`substring`?n.push(i):e===`segments`&&r.push(i)}return[...n,...r]}var Gm=`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`,Km=`flex min-h-0 flex-1 flex-col items-center justify-center gap-1.5 overflow-hidden text-center keyboard:hidden`,qm=`relative mx-auto flex w-full max-w-[104ch] flex-none flex-col gap-2 keyboard:mt-auto`,Jm=`pointer-events-none absolute bottom-full left-0 mb-2 flex flex-col gap-1`,Ym=`flex flex-col gap-2 rounded-md border-hairline border-line bg-surface px-3 py-2.5 focus-within:border-line-active`,Xm=`flex flex-wrap items-center justify-end gap-1.5`,Zm=`max-h-[40vh] min-h-[4.5em] w-full bg-transparent text-ink [border:0] [outline:0]`,Qm=`flex items-center gap-1.5 px-1`,$m=`flex min-w-0 items-center gap-1.5 narrow:contents`,eh=`${$m} group/end ml-auto narrow:ml-0`,th=(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`}`,nh=`size-3.25 flex-none fill-none stroke-current [stroke-linecap:round] [stroke-linejoin:round] [stroke-width:1.3]`,rh=`narrow:sr-only`,ih=`min-w-8.5`,ah=(e=!1)=>`inline-flex max-w-[28ch] ${ih} 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`}`,oh=`disabled:cursor-default disabled:opacity-60`,sh=e=>`${ah(e)} min-w-[9ch] justify-center ${oh}`,ch=`touch-none select-none [-webkit-touch-callout:none]`,lh=(e=!1)=>`group/chip relative inline-flex ${ih} ${e?`narrow:max-w-fit narrow:flex-[1_1_0]`:``}`,uh=`flex min-h-0 flex-col gap-1 overflow-x-hidden overflow-y-auto p-1.5 [outline:0]`,dh=`flex min-h-0 flex-col overflow-x-hidden overflow-y-auto`,fh=`sticky top-0 z-1 m-0 bg-surface px-1.5 pt-1.5 pb-0.5 text-left`,ph=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`:``}`,mh=`flex-[0_0_1.5ch] text-accent`,hh=`ml-auto pl-3 inline-flex items-center gap-1`,gh=`min-w-0 overflow-hidden text-ellipsis whitespace-nowrap`,_h=`${gh} narrow:max-w-[13ch]`,vh=`${gh} [direction:rtl]`,yh=`flex-none whitespace-nowrap`,bh=`mx-2 my-1`,xh=`flex flex-col gap-0.5 px-1.5 py-0.5`,Sh=`min-w-[36ch]`,Ch=`flex items-center gap-1.5 p-1.5`;function wh(){return(0,W.jsx)(`svg`,{className:nh,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,W.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 Th(){return(0,W.jsxs)(`svg`,{className:nh,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,W.jsx)(`circle`,{cx:`4.5`,cy:`3.5`,r:`1.5`}),(0,W.jsx)(`circle`,{cx:`4.5`,cy:`12.5`,r:`1.5`}),(0,W.jsx)(`circle`,{cx:`11.5`,cy:`5`,r:`1.5`}),(0,W.jsx)(`path`,{d:`M4.5 5v6M11.5 6.5c0 3-7 2-7 4.5`})]})}function Eh(e){return e instanceof Error?e.message:String(e)}function Dh(e){return/no space left on device|ENOSPC|disk quota exceeded/i.test(Eh(e))}var Oh=[`..##..`,`##..#.`,`#....#`,`.####.`],kh=`-my-0.75 -mr-0.5 ml-0 flex flex-none self-stretch`,Ah=`before:absolute before:top-0 before:left-1 before:content-[''] before:[border-left:var(--hairline)_solid_var(--line-active)]`,jh={blank:``,pipe:`${Ah} before:bottom-0`,tee:`${Ah} before:bottom-0`,elbow:`${Ah} before:right-0 before:bottom-1/2 before:rounded-bl-[6px] before:[border-bottom:var(--hairline)_solid_var(--line-active)]`},Mh=e=>`relative w-3 ${jh[e]}`,Nh=`-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`,Ph=`inline-flex items-center gap-1`,Fh=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`:``}`,Ih=`inline-flex flex-none items-center text-subtle`,Lh=`group/rail rail @container row-1 flex min-h-0 flex-col focus:outline-none ${Wt}`,Rh=`flex min-w-0 items-center gap-2.5 overflow-hidden px-3.5 pt-3.5 pb-2.5 whitespace-nowrap`,zh=`flex gap-1 px-3.5 pb-2 text-meta`,Bh=`min-w-0 flex-1 border-none bg-transparent p-0 text-ink [font:inherit] outline-none placeholder:text-subtle`,Vh=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`:``}`,Hh=`group-focus-within/rail:[box-shadow:inset_0_0_0_1px_var(--focus)]`,Uh=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']`:``}`,Wh=`touch:relative touch:after:absolute touch:after:-inset-x-1.5 touch:after:-inset-y-3 touch:after:content-['']`,Gh=`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 touch:relative touch:after:absolute touch:after:inset-x-0 touch:after:-inset-y-3 touch:after:content-['']`,Kh=`-ml-1 ${Gh}`,qh=`group/toggle ${Gh}`,Jh=e=>e?``:`opacity-0 group-hover/head:opacity-100 group-focus-visible/toggle:opacity-100 touch:opacity-100`,Yh=`-mr-[4.5px] ml-auto size-5 shrink-0 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 ${Wh}`,Xh=1e4;function Zh(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 Qh(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}${Zh(t,n).slice((t.hostLabel||t.alias).length)}`}function $h(e,t,n){if(e.kind!==`task`||e.machine===void 0)return null;let r=e.machine;return Qh(r,t.find(e=>e.alias===r),n,e.task.machine?.label)}var eg=Oh.flatMap((e,t)=>[...e].flatMap((e,n)=>e===`#`?[[n,t]]:[]));function tg({label:e}){return(0,W.jsx)(`span`,{className:Ih,title:e,role:`img`,"aria-label":e,children:(0,W.jsx)(`svg`,{viewBox:`0 0 11.5 7.5`,width:`11.5`,height:`7.5`,fill:`currentColor`,"aria-hidden":`true`,children:eg.map(([e,t])=>(0,W.jsx)(`circle`,{cx:e*2+.75,cy:t*2+.75,r:`0.75`},`${e}.${t}`))})})}function ng({host:e,onMachines:t}){return U(),(0,W.jsxs)(`div`,{className:Jn,children:[(0,W.jsx)(`p`,{className:`text-muted`,children:J(`tasks`,`machine.filesElsewhere`,{host:e})}),(0,W.jsx)(`p`,{className:`text-muted`,children:J(`tasks`,`machine.filesHint`,{host:e})}),(0,W.jsx)(`div`,{children:(0,W.jsx)(G,{hit:`tight`,onClick:t,children:H(`machines.open`)})})]})}function rg(e){let t=y(e.client.conn),n=y(e.remote),[r,i]=(0,m.useState)(()=>X(e,`machines.list`)?.machines??[]),a=[...new Set(n.map(e=>`${e.machine?.id}:${e.machine?.stale??!1}`))].join();return(0,m.useEffect)(()=>{if(t.state!==`open`)return;let n=!0,r=()=>Z(e,`machines.list`).then(e=>n&&i(e.machines),()=>{});r();let a=Oi(Xh,r);return()=>{n=!1,a()}},[e.client,t.state,a]),r}function ig(e){let[t,n]=(0,m.useState)(!1),r=(0,m.useRef)(e.onClose);r.current=e.onClose,(0,m.useEffect)(()=>{t||r.current?.()},[t]);let i=(0,m.useRef)(null),a=(0,m.useRef)(null),o=(0,m.useRef)(null);(0,m.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,m.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,W.jsxs)(`span`,{ref:i,className:lh(e.yields),onKeyDown:e=>{e.key!==`Escape`||!t||(e.preventDefault(),e.stopPropagation(),s())},children:[(0,W.jsx)(`button`,{ref:a,type:`button`,className:ah(),"data-field":e.field,title:e.title,"aria-haspopup":`menu`,"aria-expanded":t,disabled:e.disabled,onClick:()=>n(e=>!e),children:typeof e.label==`string`?(0,W.jsx)(`span`,{className:gh,children:e.label}):e.label}),t&&(0,W.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 ag(e){let[t,n]=(0,m.useState)(0),r=[...e.extra?[e.extra]:[],...e.rows,...e.more??[]],i=Math.min(t,Math.max(0,r.length-1)),a=(0,m.useRef)(null);return(0,m.useEffect)(()=>{a.current?.scrollIntoView({block:`nearest`})},[i,e.rows]),(0,W.jsxs)(`div`,{className:uh,children:[(0,W.jsx)(`input`,{className:hn,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,W.jsxs)(`div`,{className:dh,children:[r.length===0&&(0,W.jsx)(`p`,{className:`mx-2 my-1 text-muted`,children:e.empty}),r.map((t,r)=>(0,W.jsxs)(m.Fragment,{children:[e.moreLabel&&t===e.more?.[0]&&(0,W.jsx)(`p`,{className:`mx-2 mt-2 mb-0.5 text-muted`,children:e.moreLabel}),t.ruled&&r>0&&(0,W.jsx)(`div`,{className:`mx-2 my-1 flex-none border-t-hairline border-t-line`}),(0,W.jsxs)(`button`,{type:`button`,"aria-current":t.checked===!0,ref:r===i?a:void 0,tabIndex:-1,title:t.title,className:ph({cursor:r===i}),onMouseMove:()=>n(r),onClick:n=>e.onPick(t.key,n.shiftKey||n.metaKey||n.ctrlKey),children:[(0,W.jsx)(`span`,{className:mh,children:t.checked?`✓`:``}),(0,W.jsx)(`span`,{className:yh,children:t.text}),t.dim&&(0,W.jsx)(`span`,{className:`ml-auto pl-3 text-muted ${t.dimPath?vh:`min-w-0 overflow-hidden text-ellipsis whitespace-nowrap`}`,children:t.dimPath?(0,W.jsx)(`bdi`,{children:t.dim}):t.dim})]})]},t.key))]}),e.hint&&(0,W.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 og(e){return(0,W.jsxs)(`button`,{type:`button`,role:e.multi?`menuitemcheckbox`:`menuitemradio`,"aria-checked":e.checked,tabIndex:-1,disabled:e.option.disabled,className:ph({cursor:e.cursor,dim:e.option.dim}),onMouseMove:e.onHover,onClick:e.onPick,children:[(0,W.jsx)(`span`,{className:mh,children:e.checked?`✓`:``}),(0,W.jsx)(`span`,{children:e.option.label}),!e.checked&&e.digit!==void 0&&!e.option.disabled&&(0,W.jsx)(`span`,{className:`ml-auto pl-3 text-muted`,children:e.digit})]})}function sg(e){let[t,n]=(0,m.useState)(()=>Math.max(0,e.options.findIndex(t=>t.id===e.value))),r=(0,m.useRef)(null);return(0,m.useEffect)(()=>r.current?.focus(),[]),(0,W.jsxs)(`div`,{ref:r,role:`menu`,tabIndex:-1,className:uh,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?qu(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,W.jsxs)(`button`,{type:`button`,className:`${fh} ${Ar} text-muted`,tabIndex:-1,onClick:e.onBack,children:[`‹ `,e.heading]}):(0,W.jsx)(`p`,{className:`${fh} ${Ar} text-muted`,children:e.heading}),e.options.map((r,i)=>(0,W.jsx)(og,{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 cg(e){return(0,W.jsxs)(`div`,{className:`${uh} ${Sh}`,children:[(0,W.jsx)(`p`,{className:`${fh} ${Ar} text-muted`,children:H(`newSession.branches`)}),(0,W.jsxs)(`label`,{className:xh,children:[(0,W.jsx)(`span`,{className:`text-muted`,children:H(`newSession.branchName`)}),(0,W.jsx)(`input`,{className:Nr,autoFocus:!0,spellCheck:!1,placeholder:H(`newSession.branchNamePlaceholder`),value:e.branch,onChange:t=>e.onBranch(t.target.value)})]}),e.repos.map(t=>(0,W.jsxs)(`label`,{className:xh,children:[(0,W.jsxs)(`span`,{children:[t.name,t.primary&&(0,W.jsxs)(`span`,{className:`text-muted`,children:[` `,H(`newSession.primary`)]})]}),(0,W.jsx)(`select`,{className:Nr,"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,W.jsx)(`option`,{value:e,children:e},e))})]},t.path))]})}function lg(e){return e.replace(/\.git$/,``).split(/[/:]/).filter(Boolean).slice(-2).join(`/`)}function ug(e){return e.id.startsWith(`root:`)?e.primary??e.checkouts[0]??e.id:e.id}function dg(e,t){if(!e||e.clone)return null;if(ku(e.ref))return e.ref;let n=t.find(t=>t.id===e.ref);return n?.primary??n?.checkouts[0]??null}function fg(e,t){if(!e)return null;let n=t.find(t=>t.id===e||t.checkouts.includes(e));return n?{ref:ug(n),clone:!1}:ku(e)?{ref:e,clone:!1}:null}function pg(e,t,n){let r=t.toLowerCase();return n?e.some(e=>e.toLowerCase()===`github.com/${r}`):e.some(e=>Eu(e).base.toLowerCase()===(r.split(`/`)[1]??``))}function mg(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:ug(i),clone:!1}:r.startsWith(`root:`)||ku(r)?null:{ref:r,clone:!0}}function hg(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 gg(e){return{repo:e.checkout??e.pick.ref,machine:e.machine,...e.checkout?{noWorktree:!0}:{},...e.pick.clone?{clone:!0}:{},...e.baseRef&&!e.checkout?{baseBranch:e.baseRef}:{},...e.prompt?{prompt:e.prompt}:{},...e.engine?{engine:e.engine}:{},...e.engineThere?{engineThere:!0}:{},...!e.engineThere&&e.model?{model:e.model}:{}}}function _g(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`}}var vg={error:[0,4,8,2,6],done:[3,7,5,2],idle:[1,2,5,8,7,6,3,0]},yg=1.2,bg=[0,1,4,5];function xg(e){return bg.includes((Math.floor(e)%20+20)%20)}var Sg=.3,Cg=.35,wg=.25,Tg=.12,Eg=2,Dg=1,Og={error:{dots:vg.error,bright:1},done:{dots:vg.done,bright:1},idle:{dots:vg.idle,bright:.6}},kg=Array.from({length:9},(e,t)=>Math.hypot(t%3-1,Math.floor(t/3)-1));function Ag(e){return Cg+.65*(.5+.5*Math.cos(2*Math.PI*e/yg))}function jg(e,t,n,r=1){switch(e){case`working`:{let e=t*80/1e3/r;return kg.map(t=>Ag(e-t*Sg))}case`waiting`:{let e=xg(t/r);return Array(9).fill(e?wg:1)}default:{let t=Og[e],r=Array(9).fill(Tg);return t?.dots.forEach((e,i)=>{let a=Math.min(Math.max(n-i*Dg,0),Eg)/Eg;r[e]=t.bright*a+Tg*(1-a)}),r}}}function Mg(e,t){let n=Og[e];return!n||t<(n.dots.length-1)*Dg+Eg}var Ng={working:`info`,waiting:`warning`,error:`attention`,done:`success`,idle:`muted`},Pg={prOpen:``,prMerged:``,prClosed:``};function Fg(e){let t=_g(e);return{look:t,tone:Ng[t]}}function Ig(e){return e.rowStatus?.kind===`needs-input`||e.rowStatus?.kind===`attention`}var Lg={busy:0,attention:1,"needs-input":2,running:3,unseen:4,idle:5};function Rg(e){let t;for(let{rowStatus:n}of e)n&&(!t||Lg[n.kind]<Lg[t.kind]||n.kind===t.kind&&n.since>t.since)&&(t=n);return t}function zg(e,t){if(!e)return null;if(e.lifecycle===`merged`)return{glyph:Pg.prMerged,tone:`text-merged`,state:`merged`};if(e.lifecycle===`closed`)return{glyph:Pg.prClosed,tone:`text-muted`,state:`closed`};if(e.lifecycle!==`open`&&e.lifecycle!==`ready_to_merge`&&e.lifecycle!==`unknown`)return null;let n=t===`conflict`?`conflict`:t===`failing`?`failing`:t===`passing`?`passing`:e.checkState===`pending`?`pending`:void 0,r=n===`conflict`?`text-warning`:n===`failing`?`text-error`:`text-success`;return{glyph:Pg.prOpen,tone:r,state:`open`,...n?{checks:n}:{}}}function Bg(e){return zg(e.pr,e.prChip)}function Vg(e){return zg(e,(e.mergeable??``).toUpperCase()===`CONFLICTING`?`conflict`:e.checkState===`failing`?`failing`:e.checkState===`passing`?`passing`:null)}function Hg(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 Ug=3,Wg=new Set,Gg;function Kg(e,t){let n=typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches,r=1/0,i=e.held+t-e.step,a=Mg(e.look,n?r:i);return jg(e.look,t,n?r:i,n?Ug:1).forEach((t,n)=>{let r=e.el.children[n].style;r.opacity=t.toFixed(3)}),a}function qg(){let e=Math.floor(performance.now()/80);for(let t of Wg)Kg(t,e)||Wg.delete(t);Jg()}function Jg(){Gg=Wg.size?window.setTimeout(qg,80-performance.now()%80+2):void 0}function Yg(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 Kg(a,r)&&(Wg.add(a),Gg===void 0&&Jg()),()=>{Wg.delete(a)}}function Xg({status:e}){let{look:t,tone:n}=Fg(e);return(0,W.jsx)($g,{look:t,tone:n,since:e?.since??0},t)}var Zg=e=>e===`muted`?`text-muted`:e===`ink`?`text-ink`:Sp[e];function Qg(){return(0,W.jsx)($g,{look:`working`,tone:`info`,since:Date.now()})}function $g({look:e,tone:t,since:n}){let r=(0,m.useRef)(null),[i]=(0,m.useState)(n);return(0,m.useLayoutEffect)(()=>{let t=r.current;return t?Yg(t,e,i):void 0},[e,i]),(0,W.jsx)(`span`,{ref:r,className:`inline-grid flex-none grid-cols-[repeat(3,3px)] auto-rows-[3px] gap-px self-center ${Zg(t)}`,"aria-hidden":`true`,children:Array.from({length:9},(e,t)=>(0,W.jsx)(`i`,{className:`rounded-full bg-current opacity-12`},t))})}var e_={offline:`newSession.remoteOffline`,outdated:`newSession.remoteOutdated`},t_=`local`,n_=`auto`,r_=`rove.newSession.autoMachine`;function i_(){try{return localStorage.getItem(r_)===`1`}catch{return!1}}var a_=(e,t)=>Z(e,`machines.repos`,{machine:t});function o_(e,t){let n=t.filter(e=>e.state===`online`).map(e=>e.alias).join(`
39
+ `);if(a===`scratch`){let e=await t.client.request(`task.openScratch`,O?{}:{engine:D});O?await gd(t,e.taskId,{kind:`shell`}):t.selectWhenListed(e.taskId)}else if(A){if(!r)throw Error(J(`terminal`,`tab.tabGone`));if(!l.trim())throw Error(H(`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=Wu(e);if(!t)throw e;z(e instanceof Error?e.message:String(e),`error`),ve(t);return}a.forkRefused&&z(H(`taskops.forkLeftBehind`,{reason:a.forkRefused}));let o=a.taskIds[0];a.groupId?ve(a.groupId):o&&t.selectWhenListed(o)}else if(O)await gd(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:fd(D),...r?{tabId:r}:{}});await t.refreshTabsNow(n),t.select(n,i.tabId)}else await gd(t,n,{kind:`engine`,engine:D,prompt:i,...e?{replaceTab:M()}:{}})});return(0,W.jsx)(Ci,{title:J(`terminal`,`tab.newChat.title`),wide:!0,children:(0,W.jsxs)(`form`,{className:Kr,onKeyDown:e=>{if(e.key===`Tab`&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&(A||!e.shiftKey))e.preventDefault(),e.stopPropagation(),A?Qu(e.currentTarget,bd,e.shiftKey?-1:1):j(yd[(yd.indexOf(a)+1)%yd.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(),P()},onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault(),x(Array.from(e.dataTransfer.files))},children:[(0,W.jsxs)(`div`,{className:Ir,children:[(0,W.jsx)(`span`,{className:`${Ar} text-muted`,children:J(`terminal`,`tab.newChat.engine`)}),(0,W.jsx)(md,{engines:i.engines,value:D,onChange:i.setEngine,withShell:w,panes:T?E:[]})]}),(0,W.jsxs)(`div`,{className:Ir,children:[(0,W.jsx)(`span`,{className:`${Ar} text-muted`,children:J(`terminal`,`tab.newChat.destLabel`)}),(0,W.jsx)(bu,{label:J(`terminal`,`tab.newChat.destLabel`),field:`destination`,value:a,onChange:e=>j(e,s),choices:yd.map(e=>({id:e,label:J(`terminal`,`tab.newChat.dest${e===`tab`?`Tab`:e===`fork`?`Fork`:`Scratch`}`)}))})]}),(0,W.jsxs)(`div`,{className:Ir,children:[(0,W.jsxs)(`span`,{className:`${Ar} text-muted`,children:[J(`terminal`,`tab.newChat.ctxLabel`),` `,(0,W.jsx)(`span`,{className:`keys-only`,children:`ctrl+f`})]}),(0,W.jsx)(bu,{label:J(`terminal`,`tab.newChat.ctxLabel`),field:`context`,value:s,onChange:e=>j(a,e===`continue`?`continue`:`fresh`),choices:[`fresh`,`continue`].map(e=>({id:e,label:J(`terminal`,`tab.newChat.ctx${e===`fresh`?`Fresh`:`Continue`}`)}))})]}),A&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,W.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:J(`quickTask`,`attemptsLabel`)}),(0,W.jsx)(bu,{label:J(`quickTask`,`attemptsLabel`),field:`attempts`,value:d,onChange:f,choices:vd.map(e=>({id:e,label:e}))})]}),(0,W.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,W.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:H(`taskops.forkBranch`)}),(0,W.jsx)(`input`,{className:Nr,"data-field":`fork-base`,spellCheck:!1,value:p,onChange:e=>h(e.target.value)})]})]}),!O&&!k&&a!==`scratch`&&(0,W.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,W.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:H(`newChat.prompt`)}),(0,W.jsx)(`textarea`,{className:`${Nr} min-h-18 max-h-[50vh] leading-[1.45]`,"data-field":`message`,autoFocus:!0,rows:4,placeholder:H(`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,W.jsx)(yu,{attachments:b,onRemove:S}),xu()?(0,W.jsx)(`p`,{className:`text-muted`,children:H(`pages.attachHintTouch`)}):(0,W.jsx)(`p`,{className:`keys-only mx-0 mt-2 mb-0 ${Tr}`,children:J(`quickTask`,`legend`)}),_&&(0,W.jsx)(`p`,{className:`text-error`,children:_}),(0,W.jsx)(Di,{busy:g,submitLabel:H(`newChat.start`)})]})})}var Sd=e=>e.split(/[\\/]/).filter(Boolean),Cd=e=>Sd(e).pop()??e;function wd(e,t,n=``){let r=Cd(e),i=t.filter(t=>(t.repo!==e||t.host!==n)&&Cd(t.repo)===r);if(i.length===0)return r;let a=e=>Sd(e).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 Td=e=>e.startsWith(`root:`)?null:e.split(`/`).slice(-2).join(`/`);function Ed(e,t){let n=Cd(e.repo),r=t.filter(t=>t!==e&&Cd(t.repo)===n);if(r.length===0)return n;let i=e.repoId,a=i?Td(i):null;return i&&a?r.some(e=>e.repoId&&e.repoId!==i&&Td(e.repoId)===a)?i:a:wd(e.repo,[e,...r].map(e=>({repo:e.repo,host:``})))}var Dd=/\s+#\d+\/\d+$/,Od=(e,t)=>(e.createdAt??``).localeCompare(t.createdAt??``)||e.id.localeCompare(t.id),kd=e=>e.groupId?`${e.machine?.id??``}\0${e.groupId}`:null;function Ad(e){let t=new Map;for(let n of e){let e=kd(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(Od);return t}function jd(e){return(e[0]?.label??``).replace(Dd,``)}function Md(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 Nd=[`default`,`recent`,`attention`,`name`],Pd={folded:new Set,opened:new Set},Fd=e=>{let t=Date.parse(e??``);return Number.isFinite(t)?t:0},Id=e=>Fd(e.updatedAt??e.createdAt),Ld=e=>Fd(e.createdAt),Rd=(e,t)=>Ld(t)-Ld(e)||t.id.localeCompare(e.id),zd=(e,t)=>Id(t)-Id(e)||t.id.localeCompare(e.id),Bd=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`}),Vd={default:null,recent:Rd,attention:(e,t)=>e.rank-t.rank||zd(e,t),name:(e,t)=>Bd.compare(e.label.trim(),t.label.trim())||e.id.localeCompare(t.id)},Hd=`~scratch`,Ud=e=>e.kind===`dir`&&(e.scratch===!0||e.noProject===!0);function Wd(e,t){return[...e].sort((e,t)=>(e.order??e.rank)-(t.order??t.rank)).sort(qd(Vd[t]))}function Gd(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=Ud(e)?Hd:e.repo,n=r.get(t);n?n.push(e):r.set(t,[e])}let i=Vd[t],a=[...r].map(([e,t])=>{let n=t.sort(qd(i));if(e===`~scratch`&&t.every(Ud))return{repo:``,label:H(`rail.noProject`),tasks:n,key:Hd,noProject:!0};let r=t.find(e=>e.repoId)?.repoId;return{repo:e,label:Cd(e),tasks:n,...r?{repoId:r}:{}}});return[...a.filter(e=>e.noProject),...a.filter(e=>!e.noProject)]}var Kd=e=>+!e.pinned,qd=e=>(t,n)=>Kd(t)-Kd(n)||(e?e(t,n):0);function Jd(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 Yd(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)||Jd(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 Xd(e,t,n=[]){for(let r of e.get(t)??[])n.push(r.id),Xd(e,r.id,n);return n}function Zd(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 Qd(e,t=``,n=Pd,r=0,i=!0){let a=t.trim(),o=(...e)=>e.some(e=>e!==``&&pl(a,e)),{children:s,nested:c}=Yd(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,Cd(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?Xd(s,t.id):[],m=u!==void 0&&a===``&&Zd(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?Ad(t):new Map,o=new Set;for(let i of t){let t=kd(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:jd(s),tasks:s,depth:Math.min(l,3),...c.machine?{machine:c.machine.id}:{}});let u=Md(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 $d=e=>Math.max(0,...e.tasks.map(Ld));function ef(e){let t=e.tasks.filter(e=>!e.routine),n=e.remote.filter(e=>!e.routine),r=[...Gd(t,e.sort).map(e=>({group:e})),...e.machines.flatMap(t=>Gd(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?Hd:t??(e.machine===void 0?n:`${e.machine}\0${n}`),a=i.get(r);a?a.push(e):i.set(r,[e])}let a=Vd[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(qd(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:Ed(e,s)])),l=s.map(e=>({...e,label:c.get(e)??e.label}));return e.sort===`recent`&&l.sort((e,t)=>$d(t)-$d(e)),e.sort===`name`&&l.sort((e,t)=>Bd.compare(e.label,t.label)),l.sort((e,t)=>Number(t.noProject===!0)-Number(e.noProject===!0)),{rows:Qd(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 tf(e){return e.title??e.engineName??(e.kind===`engine`?H(`tab.engine`):H(`tab.shell`))}function nf(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 rf(e){return e.kind===`leaf`?[e]:e.children.flatMap(rf)}function af(e){return!!e&&rf(e.root).length>1}function of(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 sf(e,t,n=1){let r=rf(e.root).map(e=>e.id),i=r.indexOf(t);return r[(Math.max(0,i)+n+r.length)%r.length]??t}function cf(e,t){let n=new Map,r=new Map;for(let i of rf(e.root)){if(i.title){r.set(i.id,i.title);continue}let e=i.own?t:i.engineName??`shell`,a=(n.get(e)??0)+1;n.set(e,a),r.set(i.id,a===1?e:`${e} ${a}`)}return r}function lf(e,t,n){return e.kind===`engine`&&rf(t.root).some(e=>e.id===n&&e.own)}function uf(e){return e.alive!==!1||!!e.split&&!rf(e.split.root).some(e=>e.own)}function df(e){return rf(e.root).map(e=>e.id).join(`,`)}function ff(e){return!(e instanceof HTMLElement)||e.closest(`.xterm`)?!1:e.isContentEditable||[`INPUT`,`TEXTAREA`,`SELECT`].includes(e.tagName)}function pf(e){return e instanceof HTMLElement&&!!e.closest(`.rail, button, a`)}var mf=e=>e.tabs.get()[e.selection.get().taskId??``]??[];function hf(e){let{taskId:t,tabId:n}=e.selection.get(),r=mf(e);return{taskId:t,tabs:r,at:r.findIndex(e=>e.id===n)}}function gf(e,t){let{taskId:n,tabs:r}=hf(e),i=r[t];!n||!i||e.select(n,i.id)}function _f(e){let{taskId:t,tabs:n,at:r}=hf(e),i=n[r];!t||!i||O.set((0,W.jsx)(Ti,{title:H(`menu.renameTab`),initial:tf(i),submitLabel:H(`dialog.save`),onSubmit:async n=>{await e.renameTab(t,i.id,n)}}))}var vf=e=>!!e.selection.get().taskId,yf=e=>mf(e).length>0,bf=[{id:`help.open`,chords:[`f1`],prefix:!1,run:Bl},{id:`focus.next`,chords:[`f4`],prefix:!1,run:()=>eo(1)},{id:`chat.tab.chooseEngine`,chords:[`ctrl+e`],prefix:!1,surface:`workspace`,live:vf,run:e=>{let{taskId:t}=e.selection.get();t&&O.set((0,W.jsx)(xd,{model:e,taskId:t}))}},{id:`chat.tab.rename`,chords:[`f2`],prefix:!1,surface:`workspace`,live:e=>{let{tabs:t,at:n}=hf(e);return!!t[n]&&!af(t[n]?.split)},run:_f},{id:`chat.tab.cycle-next`,chords:[`ctrl+]`],prefix:!1,surface:`workspace`,live:yf,run:e=>gf(e,(hf(e).at+1)%mf(e).length)},{id:`chat.tab.cycle-prev`,chords:[`ctrl+[`],prefix:!1,surface:`workspace`,live:yf,run:e=>gf(e,(hf(e).at-1+mf(e).length)%mf(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:yf,run:(e,t=``)=>{let n=Do().find(e=>e.id===`chat.tab.goto`&&!e.prefix)?.chords.indexOf(t)??-1;n>=0&&gf(e,n)}},{id:`attention.next`,chords:[`f7`],prefix:!1,run:e=>Sf(e)}];To(()=>bf);function xf(e){(0,m.useEffect)(()=>{let t=t=>{if(O.get()||ff(t.target))return;let n=N.get();if(n===`worktrees`)return;let r=Ao()??(vf(e)?`workspace`:`sidebar`),{taskId:i}=e.selection.get();if(!n&&i&&!t.ctrlKey&&!t.shiftKey&&!t.metaKey&&!t.altKey&&t.key===`Enter`&&!yf(e)&&!pf(t.target)){t.preventDefault(),t.stopPropagation(),O.set((0,W.jsx)(xd,{model:e,taskId:i}));return}let a=sl(t),o=Do().filter(t=>!t.prefix&&!t.native&&t.chords.some(e=>a.includes(e))&&Oo(t,r)&&!(n&&t.surface)&&t.live?.(e)!==!1).sort((e,t)=>ko(e,r)-ko(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 Sf(e){let t=e.tasks.get();if(!t)return;let n=ql(t.attention,t.tasks.map(e=>e.id),e.selection.get());if(!n){z(H(`inbox.empty`));return}if(Wl(n.state)){Xl(e,n);return}n.taskId!==null&&(e.select(n.taskId,n.tabId),Yl(e,n))}async function Cf(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){z(H(`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){z(K(e),`error`)}}function wf(e){(0,m.useEffect)(()=>{let t=t=>{let n=lo.get().plugins;if(n.length===0||!Co({dialog:O.get()!==null,page:N.get()})||ff(t.target))return;let r=So(n,sl(t));r&&(t.preventDefault(),t.stopImmediatePropagation(),Cf(e,r))};return window.addEventListener(`keydown`,t,{capture:!0}),()=>window.removeEventListener(`keydown`,t,{capture:!0})},[e])}var Tf=`prefix.moreCommands`,Ef=/^ctrl\+[^+]+$/;function Df(e){return Ef.test(e)?e.slice(5):null}function Of(e){let t=fl(e.bindingId);if(!t)return null;if(e.reachability.direct.has(e.bindingId)){let e=t.keys[0];if(e)return so(e)}if(e.prefixKey&&e.reachability.prefix.has(e.bindingId)){let n=t.prefixKeys?.[0];if(n)return`${so(e.prefixKey)} ${so(n)}`}return null}function kf(e,t){let n=Y.filter(t=>e.direct.has(t.id)).flatMap(e=>{let t=e.keys.flatMap(e=>Df(e)??[]);return t.length>2?[{stroke:`${t[0]}-${t.at(-1)}`,action:e.id}]:t.map(t=>({stroke:t,action:e.id}))}),r=t?Df(t):null;return r&&e.prefix.size>0&&n.push({stroke:r,action:Tf}),n}var Af=4e3,jf=180,Mf=Af,Nf=v({guide:null,entries:[]}),Pf=1;function Ff(e,t){let n={id:Pf++,stroke:e,action:t,at:Date.now()};Nf.set({guide:null,entries:[...Nf.get().entries,n].slice(-3)})}var If=`modulepreload`,Lf=function(e){return`/`+e},Rf={},zf=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=Lf(t,n),t=s(t),t in Rf)return;Rf[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`:If,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)})},Bf=8,Vf=32,Hf=3e3,Uf=100,Wf=new WeakMap,Gf=null;function Kf(e){let t=Wf.get(e);return t||(t={entries:new Map,snapshots:new Map,left:null},Wf.set(e,t)),t}function qf(){return Gf||(Gf=document.createElement(`div`),Gf.style.display=`none`,document.body.append(Gf)),Gf}function Jf(e,t,n){e.snapshots.delete(t),e.snapshots.set(t,n);for(let t of e.snapshots.keys()){if(e.snapshots.size<=Vf)break;e.snapshots.delete(t)}}function Yf(e,t,n){e.entries.delete(t.key),t.leaving!==null&&window.clearTimeout(t.leaving),t.leaving=null,n?Jf(e,t.key,t.handle.snapshot()):e.snapshots.delete(t.key),t.handle.dispose(),t.box.remove()}function Xf(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-Bf)))Yf(e,n,!0)}function Zf(e,t){return Kf(e).entries.get(t)?.handle??null}function Qf(e,t,n,r){return Kf(e).entries.get(id(t,n,r))?.slot.parkedAt!=null}async function $f(e,t){let n=Kf(e.client),r=id(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,rp(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:()=>ep(n,i)}}let a=document.createElement(`div`);a.className=Pn,e.host.append(a),tp(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 zf(async()=>{let{mountTerminal:e}=await import(`./term-mount-OMVJnrk8.js`);return{mountTerminal:e}},__vite__mapDeps([0,1,2])),d=u({...e,el:a,snapshot:l,onPainted:()=>rp(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&&Yf(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:()=>ep(n,f)}}function ep(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(),qf().append(t.box),e.left=t,Xf(e))}function tp(e,t){let n=e.left;e.left=null,!(!n||n.slot.parkedAt===null||performance.now()-n.slot.parkedAt>Uf)&&e.entries.get(n.key)===n&&(n.box.classList.add(`is-leaving`),t.append(n.box),n.leaving=window.setTimeout(()=>np(e,n),Hf))}function np(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&&qf().append(t.box))}function rp(e){for(let t of e.entries.values())np(e,t)}async function ip(e,t,n){return Jl(await e.request(`output.read`,{taskId:t,tab:n,source:`terminal`,limit:12}))}async function ap(e,t,n,r){try{let i=await e.client.request(`tab.send`,{taskId:t,tabId:n,prompt:r});return i.delivered?!0:(z(H(`layout.composerNotSent`,{reason:i.reason??``}),`error`),!1)}catch(e){let t=e instanceof Go?e.code:void 0;return z(t===`UNKNOWN_OP`?H(`layout.composerOldBridge`):t===`AWAITING_PERMISSION`?H(`layout.composerAtMenu`):e instanceof Error?e.message:String(e),`error`),!1}}async function op(e,t,n,r){let{client:i}=e,a=id(t,n),o=Io(a)!==void 0||Qf(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 z(e instanceof Error?e.message:String(e),`error`),!1}finally{o||await i.request(`term.detach`,{stream:a}).catch(()=>{})}}async function sp(e,t,n){try{return(await e.client.request(`gate.answer`,{gateId:t,...n})).delivered||z(H(`inbox.gateKept`)),!0}catch(e){return z(e instanceof Error?e.message:String(e),`error`),!1}}var cp=(e,t,n)=>({id:e,cap:t,bytes:e=>`\x1b${e?`O`:`[`}${n}`}),lp={id:`enter`,cap:`⏎`,bytes:()=>`\r`},up=[{id:`esc`,cap:`esc`,bytes:()=>`\x1B`},{id:`tab`,cap:`tab`,bytes:()=>` `},{id:`backtab`,cap:`⇧tab`,bytes:()=>`\x1B[Z`},{id:`interrupt`,cap:`^C`,bytes:()=>``},cp(`up`,`↑`,`A`),cp(`down`,`↓`,`B`),cp(`left`,`←`,`D`),cp(`right`,`→`,`C`),lp],dp=e=>({id:`option-${e}`,cap:String(e),bytes:()=>String(e)}),fp=[dp(1),dp(2),dp(3),dp(4),lp];function pp(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 mp=`\x1B[27;2;13~`;function hp(e){return e.key!==`Enter`||!e.shiftKey||e.ctrlKey||e.metaKey||e.altKey?!1:!e.isComposing&&e.keyCode!==229}function gp(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 _p=`mx-2.5 mt-0.5 mb-1.5 flex min-w-0 flex-col gap-1.5 font-mono text-meta`,vp=2e3;function yp(e,t,n){let[r,i]=(0,m.useState)(null),[a,o]=(0,m.useState)(0);return(0,m.useEffect)(()=>{if(!n)return;let r=!0,a=0,o=async()=>{try{let a=await ip(e.client,t,n);r&&i(a)}catch{r&&i(e=>e??[])}r&&(a=window.setTimeout(o,vp))};return o(),()=>{r=!1,window.clearTimeout(a)}},[e,t,n,a]),{lines:r,refresh:()=>o(e=>e+1)}}function bp(e){U();let{model:t,taskId:n,tabId:r,mode:i,gate:a}=e,{lines:o,refresh:s}=yp(t,n,r),c=(0,m.useRef)(null),[l,u]=(0,m.useState)(``),[d,f]=(0,m.useState)(!1);(0,m.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},h=async()=>{let e=l.trim();!e||d||await p(()=>i===`gate`&&a?sp(t,a.id,{text:e}):r?ap(t,n,r,e):Promise.resolve(!1))&&u(``)};return(0,W.jsxs)(`div`,{className:_p,children:[a&&(0,W.jsx)(`p`,{className:`m-0 whitespace-pre-wrap wrap-anywhere text-ink`,children:a.question}),r&&(0,W.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?H(`inbox.noOutput`):o.join(`
40
+ `)}),i===`gate`&&a&&(0,W.jsx)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:a.options.map(e=>(0,W.jsxs)(G,{disabled:d,title:e.detail,onClick:()=>void p(()=>sp(t,a.id,{option:e.key})),children:[`[ `,e.key===a.recommended?`★ `:``,e.label,` ]`]},e.key))}),i===`menu`&&r&&(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[fp.map(e=>(0,W.jsxs)(G,{disabled:d,onClick:()=>void p(()=>op(t,n,r,e.bytes(!1))),children:[`[ `,e.cap,` ]`]},e.id)),(0,W.jsx)(G,{onClick:e.onOpenTab,children:H(`inbox.openTab`)})]}),(i===`reply`||i===`gate`)&&(0,W.jsxs)(`form`,{className:`flex min-w-0 items-center gap-2`,onSubmit:e=>{e.preventDefault(),h()},children:[(0,W.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:H(`inbox.replyPlaceholder`),"aria-label":H(`inbox.replyPlaceholder`),autoComplete:`off`,enterKeyHint:`send`,onChange:e=>u(e.target.value)}),(0,W.jsx)(G,{type:`submit`,disabled:d||l.trim()===``,children:H(`inbox.send`)})]})]})}function xp({text:e}){return(0,W.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,W.jsx)(`span`,{children:e},e))})}var Sp={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`},Cp={accent:`text-accent`,muted:`text-subtle`,attention:`text-error`,warning:`text-warning`,success:`text-success`,info:`text-accent`,ink:`text-ink`},wp=6;function Tp(e,t){return e?`${Cd(e.repo)} › ${e.label}`:t}function Ep({model:e}){U();let t=y(e.tasks),n=y(e.visits),r=y(e.tabs),[i,a]=(0,m.useState)(0),[o,s]=(0,m.useState)(null),[c,l]=(0,m.useState)(Date.now());(0,m.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=Kl(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:Tp(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}`)),h=n.filter(e=>u.has(e.taskId)&&!p.has(`${e.taskId}:${e.tabId}`)).slice(0,wp).map(e=>({key:`r:${e.taskId}:${e.tabId}`,section:`recent`,taskId:e.taskId,tabId:e.tabId,identity:Tp(u.get(e.taskId),e.taskId),subtitle:d(e.taskId,e.tabId)||u.get(e.taskId)?.branch||``,at:e.at})),g=[...f,...h],_=g[Math.min(i,g.length-1)],v=t=>{if(t.attention&&Wl(t.attention.state))return Xl(e,t.attention);t.attention&&Yl(e,t.attention),t.taskId&&u.has(t.taskId)&&(e.select(t.taskId,t.tabId),B())},b=()=>void Promise.all(f.map(t=>t.attention&&Yl(e,t.attention,!0)));(0,m.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)Yl(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?Hl(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&&!Wl(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,W.jsxs)(`li`,{children:[(0,W.jsxs)(`div`,{className:ui,children:[(0,W.jsxs)(`button`,{type:`button`,className:`${gi({selected:i,stack:!0})} ${di}`,onMouseEnter:()=>a(g.indexOf(n)),onClick:()=>v(n),children:[(0,W.jsxs)(`span`,{className:ci,children:[(0,W.jsx)(`span`,{className:_i,children:n.identity}),r&&(0,W.jsxs)(`span`,{className:`flex-none font-mono text-meta font-normal normal-nums ${Cp[r.tone]}`,children:[r.glyph,` `,H(r.stateKey)]}),(0,W.jsx)(`span`,{className:li,children:Ul(c-n.at)})]}),n.subtitle&&(0,W.jsx)(`span`,{className:`truncate font-mono text-meta font-normal normal-nums text-muted`,children:n.subtitle})]}),m?(0,W.jsx)(G,{className:fi,"aria-expanded":x,onClick:()=>{a(g.indexOf(n)),s(x?null:b)},children:H(x?`inbox.hide`:`inbox.reply`)}):(0,W.jsx)(`span`,{"aria-hidden":!0,className:fi})]}),x&&n.taskId&&(0,W.jsx)(bp,{model:e,taskId:n.taskId,tabId:p,mode:y,gate:f,onOpenTab:()=>v(n)})]},n.key)};return(0,W.jsx)(Ci,{title:H(`inbox.title`),wide:!0,children:(0,W.jsxs)(`div`,{className:Kr,children:[(0,W.jsxs)(`div`,{className:ai,children:[(0,W.jsx)(`p`,{className:`${Ar} text-muted ${ii} touch:hidden!`,children:(0,W.jsx)(xp,{text:H(`inbox.hints`)})}),f.length>0&&(0,W.jsx)(G,{className:`flex-none min-w-[calc(9ch+0.5rem)] whitespace-nowrap pr-2 text-right font-mono text-meta`,onClick:b,children:H(`inbox.ackAll`)})]}),(0,W.jsx)(`h2`,{className:`${Ar} text-muted ${oi}`,children:H(`inbox.attention`)}),f.length===0?(0,W.jsx)(`p`,{className:`mono text-muted`,children:H(`inbox.empty`)}):(0,W.jsx)(`ul`,{className:si,children:f.map(x)}),h.length>0&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`h2`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted mt-1`,children:H(`inbox.recent`)}),(0,W.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-0.5 p-0`,children:h.map(x)})]})]})})}var Dp=`rove.prefs`,Op={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,editorKind:`auto`,worktreeBase:`default`,scrollbackRows:1e3,tabStrip:`never`,prefixTap:`local`,remoteProjects:!1,autoStatus:!1,dispatcher:!1,updateChannel:`latest`,updateNotify:!0};function kp(){try{let e=JSON.parse(localStorage.getItem(Dp)??`null`);if(e&&typeof e==`object`&&`prefs`in e&&`themes`in e){let t=e;return{...t,prefs:{...Op,...t.prefs},loaded:!0}}}catch{}return{loaded:!1,prefs:Op,options:{},info:{editorCustomSet:!1,worktreeCustomPath:``},themes:[],glyphSets:{}}}var Ap=v(kp());function jp(e){(e.locale===`en`||e.locale===`zh`)&&Mt.set(e.locale)}jp(Ap.get().prefs);function Mp(e){let t={loaded:!0,prefs:e.prefs,options:e.options,info:e.info,themes:e.themes,glyphSets:e.glyphSets};Ap.set(t),jp(t.prefs),localStorage.setItem(Dp,JSON.stringify(t))}var Np=null;async function Pp(e){Np=e,Mp(await e.request(`prefs.get`))}async function Fp(e,t,n){let r=Ap.get();Ap.set({...r,prefs:{...r.prefs,[t]:n}}),jp(Ap.get().prefs);try{let r=await e.request(`prefs.set`,{key:t,value:n});Mp({...Ap.get(),prefs:r.prefs})}catch(e){Ap.set(r),jp(r.prefs),z(e instanceof Error?e.message:String(e),`error`)}}function Ip(e,t){if(Np)return void Fp(Np,e,t);let n=Ap.get();Ap.set({...n,prefs:{...n.prefs,[e]:t}})}function Lp(){return y(Ap)}function Rp(e,t){let n=e.options[t];return Array.isArray(n)?n:[]}var zp=[`project`,`state`],Bp=`rove.railGroup`,Vp=v(zp.find(e=>e===localStorage.getItem(Bp))??`project`);function Hp(e){e!==Vp.get()&&(Vp.set(e),localStorage.setItem(Bp,e))}Ap.subscribe(()=>{let{loaded:e,prefs:t}=Ap.get();e&&zp.includes(t.railGroup)&&Hp(t.railGroup)});function Up(e){Hp(e),Ip(`railGroup`,e)}var Wp=`rove.activeSortMode`;function Gp(){let e=localStorage.getItem(Wp);return Nd.find(t=>t===e)??`recent`}var Kp=v(Gp());function qp(e){e!==Kp.get()&&(Kp.set(e),localStorage.setItem(Wp,e))}Ap.subscribe(()=>{let{loaded:e,prefs:t}=Ap.get();e&&Nd.includes(t.railSort)&&qp(t.railSort)});function Jp(e){qp(e),Ip(`railSort`,e)}function Yp(){Jp(Nd[(Nd.indexOf(Kp.get())+1)%Nd.length]??`default`)}var Xp=v(!1);function Zp(e){e&&(Kp.get()!=="default"||Vp.get()===`state`)&&(Jp(`default`),Up(`project`),z(J(`tasks`,`sort.reorderSwitched`))),Xp.set(e)}async function Qp(e,t,n){let r=n<0?`up`:`down`;try{await e.client.request(`task.move`,{taskId:t.task.id,direction:r})}catch(e){z(J(`tasks`,`toast.moveFailed`,{error:e instanceof Error?e.message:String(e)}),`error`)}}async function $p(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){z(J(`tasks`,`toast.moveFailed`,{error:e instanceof Error?e.message:String(e)}),`error`)}}var em=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5],tm=Array.from({length:64},(e,t)=>{let n=t%8,r=t>>3;return(4*(em[(r&3)*4+(n&3)]??0)+([0,2,3,1][(r>>2)*2+(n>>2)]??0)+.5)/64}),nm=(e,t)=>tm[(t&7)*8+(e&7)]??1,rm=[[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 im(e,t){e.fill(0);for(let[n,r,i]of rm)Math.sin(t*.8+i)>-.5&&(e[r*128+n]=1)}var am=64,om=40,sm=25,cm=(1-1.2/sm)**2,lm=[{radius:1.55,lift:.3,roll:-.42,speed:.9,phase:.4,ink:4},{radius:1.95,lift:.22,roll:.3,speed:-.55,phase:2.6,ink:3},{radius:2.4,lift:.36,roll:-.12,speed:.38,phase:4.4,ink:3}],um=1.9;function dm(e,t){im(e,t);let n=(t,n,r)=>{t>=0&&t<128&&n>=0&&n<80&&(e[n*128+t]=r)},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<80;e++)for(let t=0;t<128;t++){let s=(t+.5-am)/sm,u=(e+.5-om)/sm,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)>nm(t,e)?n(t,e,h>.4?3:2):p>cm&&n(t,e,1)}for(let e of lm){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(am+s*sm),Math.floor(om+c*sm),l]},o=Math.round(Math.PI*e.radius*sm);for(let e=0;e<o;e++){let t=a(e/o*Math.PI*2);t&&!t[2]&&n(t[0],t[1],1)}let s=e.phase+t*e.speed,c=.5/(e.radius*sm),l=-Math.sign(e.speed)*c;for(let e=um/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,0)}for(let t=um/c;t>0;t--){let r=a(s+t*l),i=1-t*c/um;r&&i>nm(r[0],r[1])&&n(r[0],r[1],i>.6?e.ink:2)}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)}}var fm=-.38,pm=Math.cos(fm),mm=Math.sin(fm),hm=.3;function gm(e,t){im(e,t);let n=t*.21,r=55*Math.cos(n),i=21*Math.sin(n),a=r*pm-i*mm,o=r*mm+i*pm;for(let t=0;t<80;t++)for(let r=0;r<128;r++){let s=t*128+r,c=r+.5-64,l=t+.5-40,u=c*pm+l*mm,d=l*pm-c*mm,f=nm(r,t),p=(u*u+d*d)/441;if(p<1){let t=Math.sqrt(1-p),r=Math.max(0,-.57*u/21-.68*d/21+.56*t),i=d/21+.17*t;e[s]=r*(.73+.23*Math.cos(i*18+.5*Math.sin(n+u/9)))>f?3:+(p>.94&&f<.68)}let m=Math.hypot(u,d/hm);if(m>=28&&m<53&&(p>=1||d>0)){let t=.61+.29*Math.cos(m*1.4)+.1*Math.sin(m*3-n);e[s]=(m>41.5&&m<44.5?0:t*(u>10&&d<0&&Math.abs(d)<7?.32:1)*(m<31||m>49?.55:1))>f?m>45&&m<47&&u<-8&&d>0?4:d>0?3:2:0}let h=Math.hypot(c-a,l-o);h<2&&(p>=1||i>0)&&(e[s]=h<1.45?4:2)}}var _m=[[-.33,-.34,.22],[.22,-.5,.11],[-.48,.2,.13],[.15,.34,.27]];function vm(e,t){im(e,t);let n=t*.27,r=26+6*Math.cos(n),i=49+3*Math.sin(n);for(let t=0;t<80;t++)for(let a=0;a<128;a++){let o=t*128+a,s=nm(a,t),c=(a-94)/15,l=(t-55)/15,u=c*c+l*l;if(u<1){let t=Math.sqrt(1-u),n=-.83*c-.49*l+.19*t;for(let[e,t,r]of _m){let i=Math.hypot(c-e,l-t)/r;i<1&&(n+=i>.72?.22:-.3)}e[o]=n>s?n>.54?3:2:+(u>.92&&s<.28)}let d=a-r,f=t-i,p=d/80;if(p>0&&p<1){let t=-d*.63+28*p*p,r=3+13*p,i=(f-t)/r,a=Math.max(0,1-Math.abs(i)),c=.58+.42*Math.cos(i*14+p*5-n),l=Math.max(0,1-Math.abs(f+d*.54)/1.65);(a*c+l*.75)*(1-p)>s&&(e[o]=l>.55&&p<.68?4:p<.56?3:2)}let m=Math.hypot(d,f);m<2.8?e[o]=3:m<8&&.84*(1-m/8)**1.3>s&&(e[o]=4)}}var ym=`flex min-h-0 w-full flex-1 flex-col overflow-y-auto`,bm=`mx-auto mt-[clamp(0rem,calc(50dvh-13rem),12rem)] flex w-full max-w-130 flex-col items-center gap-4 px-5 py-7 text-center narrow:mt-0`,xm=`relative mb-3 aspect-[760/335] min-h-0 w-full max-w-[830px] shrink narrow:aspect-[760/465]`;function Sm(e){let t=e;return()=>(t=Math.imul(t,1664525)+1013904223>>>0,t/4294967296)}var Cm=Sm(892671),wm=Array.from({length:104},(e,t)=>({along:Cm()+Cm()-1,across:Cm()+Cm()-1,depth:Cm(),phase:Cm()*2*Math.PI,pace:Cm(),starX:44+Cm()*672,starY:23+Cm()*284,copper:t===2||t===61||t===24,near:t===2||t===30||t===82,lead:t===2,glint:t===59})).sort((e,t)=>Number(e.near)-Number(t.near)||e.depth-t.depth),Tm=Array.from({length:12},()=>({x:15+Cm()*730,y:12+Cm()*300,phase:Cm()*2*Math.PI})),Em=[[-2,174,174],[0,222,172],[2,262,167],[4,372,149],[5.8,485,96],[6.9,555,101],[7.8,551,143],[8.9,484,174],[10.4,351,204],[11.7,246,177],[13,217,128],[14.3,285,100],[16,459,103],[18,642,132],[20,826,135]];function Dm(e){let t=Math.max(0,Math.min(1,e));return t*t*(3-2*t)}function Om(e){let t=0;for(;t<Em.length-2&&e>Em[t+1][0];)t++;let n=Em[t],r=Em[t+1],i=Em[Math.max(0,t-1)],a=Em[Math.min(Em.length-1,t+2)],o=r[0]-n[0],s=Math.max(0,Math.min(1,(e-n[0])/o)),c=s*s,l=c*s;function u(e){let t=(r[e]-i[e])*o/(r[0]-i[0]),u=(a[e]-n[e])*o/(a[0]-n[0]);return(2*l-3*c+1)*n[e]+(l-2*c+s)*t+(3*c-2*l)*r[e]+(l-c)*u}return[u(1),u(2)]}function km(e,t){let n=t+e.along*1.43+(e.depth-.5)*.32,[r,i]=Om(n),[a,o]=Om(n+.045),s=Math.hypot(a-r,o-i)||1,c=(a-r)/s,l=(o-i)/s,u=Math.sin(n*1.25+e.along*2.2),d=43+15*Math.sin(t*.61)+17*u,f=e.along*67+8*Math.sin(t*.58+e.phase),p=e.across*d+u*18+(e.depth-.5)*25+6*Math.sin(t*.72+e.phase),m=e.near?Dm((t-5)/3)*(1-Dm((t-11.6)/2.1)):0;return{x:r+c*f-l*p+m*(e.depth-.5)*135,y:i+l*f+c*p+m*(e.lead?58:36),near:m}}function Am(e,t,n,r,i,a,o,s,c){let l=Math.cos(r),u=Math.sin(r),d=(e,r,a=0)=>[t+i*(e*l-r*u+.22*a),n+i*(e*u+r*l*.67-a*.7)];function f(t,n,...r){e.fillStyle=t,e.beginPath(),e.moveTo(...n);for(let t of r)e.lineTo(...t);e.closePath(),e.fill()}function p(e,t){let n=1+e*o*.42,r=a*.85+e*o*.5,i=(t,i,a)=>d(t,e*i*n,a*r);f(t,d(3,e*.4),i(3,3,.8),i(1.4,6.3,3.8),i(-4.9,10.6,6),i(-3.7,6.2,3.9),i(-4.3,6.5,3.5),i(-2.3,2.7,.5),d(-2,e*.45))}p(-1,s),p(1,c),f(c,d(6,0),d(3.1,-.95),d(.8,-1.05),d(-2.4,-.75),d(-5.9,-1.35),d(-5.6,.85),d(-2.2,.55),d(.8,1.18),d(2.8,.72))}function jm(e,t,n,r,i,a,o,s,c){let l=1-a,u=.5+.5*Math.sin(i*(1.6+t.pace)+t.phase);if(e.save(),e.setTransform(1,0,0,1,Math.round(n*e.canvas.width/760),Math.round(r*e.canvas.height/335)),t.lead||t.glint||t.depth>.945){let n=(t.lead?6:3)+Math.round(u*2),r=Math.max(2,Math.round(n*l*.82));e.fillStyle=c,e.globalAlpha=l*(.69+.18*u),e.fillRect(-r,0,2*r+1,1),e.fillRect(0,-r-1,1,2*r+3),e.globalAlpha=l*(.38+.14*u),e.fillRect(-2,-2,1,1),e.fillRect(2,2,1,1),e.fillRect(-2,2,1,1),e.fillRect(2,-2,1,1),e.fillStyle=s,e.globalAlpha=l,e.fillRect(-1,-1,3,3)}else{let n=t.depth>.54||t.copper;e.fillStyle=n?s:c,e.globalAlpha=l*(n?.83+.17*u:.56+.2*u);let r=n||o?2:1;e.fillRect(0,0,r,r)}e.restore()}function Mm(e,t,n,r){let i=r.getPropertyValue(`--color-ink`).trim(),a=r.getPropertyValue(`--color-muted`).trim(),o=r.getPropertyValue(`--color-accent`).trim(),s=r.getPropertyValue(`--color-subtle`).trim(),c=`color-mix(in srgb, ${i} 60%, ${r.colorScheme===`light`?`black`:`white`})`,l=`color-mix(in srgb, ${a} 60%, ${i})`,u=`color-mix(in srgb, ${i} 55%, ${o})`,d=`color-mix(in srgb, ${o} 70%, ${r.getPropertyValue(`--color-paper`)})`;e.setTransform(e.canvas.width/760,0,0,e.canvas.height/335,0,0),e.clearRect(0,0,760,335),e.fillStyle=s;for(let n of Tm)e.globalAlpha=.33+.18*Math.sin(t*.52+n.phase),e.fillRect(n.x,n.y,1.9,1.9);for(let r of wm){let f=Dm((t-1.8-r.along*.59-r.depth*.56)/2.25)*(1-Dm((t-14.85-r.along*.36)/1.87)),p=f>0?km(r,t):{x:r.starX,y:r.starY,near:0},m=r.starX+(p.x-r.starX)*f,h=r.starY+(p.y-r.starY)*f;if(f<.97&&jm(e,r,m,h,t,f,n,r.copper?u:c,r.copper?o:l),f<.04)continue;let g=km(r,t+.05),_=Math.atan2(g.y-p.y,g.x-p.x),v=Math.sin(t*(3.9+r.pace*2.4)+r.phase),y=.74*Math.sin(t*1.18+r.along*2.4+.26*r.phase),b=(.31+.51*r.depth**1.8+p.near*(r.lead?2.7:1.55))*(n?1.18:1)*(.28+.72*f);e.globalAlpha=f*(.68+.32*r.depth),Am(e,m,h,_,b,v,y,r.copper?d:s,r.copper?o:r.depth>.5?i:a)}e.globalAlpha=1}var Nm=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];function Pm(e){let t=document.createElement(`canvas`),n=t.getContext(`2d`,{willReadFrequently:!0}),r=e.getContext(`2d`),i=getComputedStyle(e);return a=>{if(!n||!r||!e.clientWidth||!e.clientHeight)return;let o=e.clientWidth<550,s=o?460:440;t.width!==s&&(t.width=s,t.height=Math.round(s*335/760)),Mm(n,a%17,o,i);let c=n.getImageData(0,0,t.width,t.height),l=3;for(let e=0;e<t.height;e++)for(let n=0;n<t.width;n++,l+=4){let t=c.data[l];if(!t)continue;let r=Nm[(n&3)+4*(e&3)];c.data[l]=t>12+7*r?Math.max(135,t)*(r>12?.45:1):0}n.putImageData(c,0,0);let u=Math.min(window.devicePixelRatio||1,2),d=Math.round(e.clientWidth*u),f=Math.round(e.clientHeight*u);(e.width!==d||e.height!==f)&&(e.width=d,e.height=f),r.clearRect(0,0,d,f),r.imageSmoothingEnabled=!1;let p=Math.min(d/760,f/335)*(o?1.24:1),m=760*p,h=335*p;r.drawImage(t,(d-m)/2,(f-h)/2,m,h)}}var Fm=3,Im=2,Lm=[``,`--color-subtle`,`--color-muted`,`--color-ink`,`--color-accent`],Rm={orbit:dm,rings:gm,comet:vm},zm=7;function Bm(e,t){let n=e.getContext(`2d`);if(!n)return;let r=window.devicePixelRatio||1,i=Math.round(128*Fm*r);e.width!==i&&(e.width=i,e.height=Math.round(80*Fm*r)),n.setTransform(r,0,0,r,0,0),n.clearRect(0,0,128*Fm,80*Fm);let a=getComputedStyle(e);for(let e=1;e<=4;e++){n.fillStyle=a.getPropertyValue(Lm[e]??``)||a.color;for(let r=0;r<t.length;r++)t[r]===e&&n.fillRect(r%128*Fm,Math.floor(r/128)*Fm,Im,Im)}}function Vm(e,t){let n=new Uint8Array(10240),r=Rm[t]??dm;return t=>{r(n,t),Bm(e,n)}}function Hm({scene:e}){let t=(0,m.useRef)(null);return(0,m.useEffect)(()=>{let n=t.current;if(!n)return;let r=window.matchMedia(`(prefers-reduced-motion: reduce)`),i=e===`starlings`,a=i?Pm(n):Vm(n,e),o=i?8.7:zm,s=!1,c=0,l=i?0:zm,u=0,d=()=>a(r.matches?o:l),f=e=>{c=requestAnimationFrame(f),!(e-u<1e3/24)&&(l+=(e-u)/1e3,u=e,d())},p=()=>{cancelAnimationFrame(c),!(!s||document.hidden)&&(d(),r.matches||(u=performance.now(),c=requestAnimationFrame(f)))},m=new IntersectionObserver(([e])=>{s=!!e?.isIntersecting,p()});m.observe(n);let h=new MutationObserver(()=>{s&&r.matches&&d()}),g=i?new ResizeObserver(()=>{s&&!document.hidden&&r.matches&&d()}):null;return g?.observe(n),h.observe(document.documentElement,{attributes:!0,attributeFilter:[`style`]}),r.addEventListener(`change`,p),document.addEventListener(`visibilitychange`,p),()=>{cancelAnimationFrame(c),m.disconnect(),g?.disconnect(),h.disconnect(),r.removeEventListener(`change`,p),document.removeEventListener(`visibilitychange`,p)}},[e]),(0,W.jsx)(`div`,{"aria-hidden":`true`,className:e===`starlings`?xm:`mb-3 w-96 max-w-full shrink-0 narrow:w-72`,children:(0,W.jsx)(`canvas`,{ref:t,"data-plate":e,width:128*Fm,height:80*Fm,className:e===`starlings`?`absolute inset-0 block h-full w-full text-muted`:`block h-auto w-full text-muted`},e)})}function Um(e,t){let n=t.trim().toLowerCase(),r=e.toLowerCase();if(r.includes(n))return`substring`;if(!n.includes(`/`))return null;let i=n.split(`/`),a=0;for(let e of r.split(`/`))a<i.length&&e.startsWith(i[a]??``)&&a++;return a===i.length?`segments`:null}function Wm(e,t){if(!t.trim())return e;let n=[],r=[];for(let i of e){let e=Um(i,t);e===`substring`?n.push(i):e===`segments`&&r.push(i)}return[...n,...r]}var Gm=`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`,Km=`flex min-h-0 flex-1 flex-col items-center justify-center gap-1.5 overflow-hidden text-center keyboard:hidden`,qm=`relative mx-auto flex w-full max-w-[104ch] flex-none flex-col gap-2 keyboard:mt-auto`,Jm=`pointer-events-none absolute bottom-full left-0 mb-2 flex flex-col gap-1`,Ym=`flex flex-col gap-2 rounded-md border-hairline border-line bg-surface px-3 py-2.5 focus-within:border-line-active`,Xm=`flex flex-wrap items-center justify-end gap-1.5`,Zm=`max-h-[40vh] min-h-[4.5em] w-full bg-transparent text-ink [border:0] [outline:0]`,Qm=`flex items-center gap-1.5 px-1`,$m=`flex min-w-0 items-center gap-1.5 narrow:contents`,eh=`${$m} group/end ml-auto narrow:ml-0`,th=(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`}`,nh=`size-3.25 flex-none fill-none stroke-current [stroke-linecap:round] [stroke-linejoin:round] [stroke-width:1.3]`,rh=`narrow:sr-only`,ih=`min-w-8.5`,ah=(e=!1)=>`inline-flex max-w-[28ch] ${ih} 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`}`,oh=`disabled:cursor-default disabled:opacity-60`,sh=e=>`${ah(e)} min-w-[9ch] justify-center ${oh}`,ch=`touch-none select-none [-webkit-touch-callout:none]`,lh=(e=!1)=>`group/chip relative inline-flex ${ih} ${e?`narrow:max-w-fit narrow:flex-[1_1_0]`:``}`,uh=`flex min-h-0 flex-col gap-1 overflow-x-hidden overflow-y-auto p-1.5 [outline:0]`,dh=`flex min-h-0 flex-col overflow-x-hidden overflow-y-auto`,fh=`sticky top-0 z-1 m-0 bg-surface px-1.5 pt-1.5 pb-0.5 text-left`,ph=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`:``}`,mh=`flex-[0_0_1.5ch] text-accent`,hh=`ml-auto pl-3 inline-flex items-center gap-1`,gh=`min-w-0 overflow-hidden text-ellipsis whitespace-nowrap`,_h=`${gh} narrow:max-w-[13ch]`,vh=`${gh} [direction:rtl]`,yh=`flex-none whitespace-nowrap`,bh=`mx-2 my-1`,xh=`flex flex-col gap-0.5 px-1.5 py-0.5`,Sh=`min-w-[36ch]`,Ch=`flex items-center gap-1.5 p-1.5`;function wh(){return(0,W.jsx)(`svg`,{className:nh,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,W.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 Th(){return(0,W.jsxs)(`svg`,{className:nh,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,W.jsx)(`circle`,{cx:`4.5`,cy:`3.5`,r:`1.5`}),(0,W.jsx)(`circle`,{cx:`4.5`,cy:`12.5`,r:`1.5`}),(0,W.jsx)(`circle`,{cx:`11.5`,cy:`5`,r:`1.5`}),(0,W.jsx)(`path`,{d:`M4.5 5v6M11.5 6.5c0 3-7 2-7 4.5`})]})}function Eh(e){return e instanceof Error?e.message:String(e)}function Dh(e){return/no space left on device|ENOSPC|disk quota exceeded/i.test(Eh(e))}var Oh=[`..##..`,`##..#.`,`#....#`,`.####.`],kh=`-my-0.75 -mr-0.5 ml-0 flex flex-none self-stretch`,Ah=`before:absolute before:top-0 before:left-1 before:content-[''] before:[border-left:var(--hairline)_solid_var(--line-active)]`,jh={blank:``,pipe:`${Ah} before:bottom-0`,tee:`${Ah} before:bottom-0`,elbow:`${Ah} before:right-0 before:bottom-1/2 before:rounded-bl-[6px] before:[border-bottom:var(--hairline)_solid_var(--line-active)]`},Mh=e=>`relative w-3 ${jh[e]}`,Nh=`-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`,Ph=`inline-flex items-center gap-1`,Fh=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`:``}`,Ih=`inline-flex flex-none items-center text-subtle`,Lh=`group/rail rail @container row-1 flex min-h-0 flex-col focus:outline-none ${Wt}`,Rh=`flex min-w-0 items-center gap-2.5 overflow-hidden px-3.5 pt-3.5 pb-2.5 whitespace-nowrap`,zh=`flex gap-1 px-3.5 pb-2 text-meta`,Bh=`min-w-0 flex-1 border-none bg-transparent p-0 text-ink [font:inherit] outline-none placeholder:text-subtle`,Vh=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`:``}`,Hh=`group-focus-within/rail:[box-shadow:inset_0_0_0_1px_var(--focus)]`,Uh=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']`:``}`,Wh=`touch:relative touch:after:absolute touch:after:-inset-x-1.5 touch:after:-inset-y-3 touch:after:content-['']`,Gh=`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 touch:relative touch:after:absolute touch:after:inset-x-0 touch:after:-inset-y-3 touch:after:content-['']`,Kh=`-ml-1 ${Gh}`,qh=`group/toggle ${Gh}`,Jh=e=>e?``:`opacity-0 group-hover/head:opacity-100 group-focus-visible/toggle:opacity-100 touch:opacity-100`,Yh=`-mr-[4.5px] ml-auto size-5 shrink-0 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 ${Wh}`,Xh=1e4;function Zh(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 Qh(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}${Zh(t,n).slice((t.hostLabel||t.alias).length)}`}function $h(e,t,n){if(e.kind!==`task`)return null;let r=e.machine??e.task.workspaceOn;return r===void 0?null:Qh(r,t.find(e=>e.alias===r),n,e.task.machine?.label)}var eg=Oh.flatMap((e,t)=>[...e].flatMap((e,n)=>e===`#`?[[n,t]]:[]));function tg({label:e}){return(0,W.jsx)(`span`,{className:Ih,title:e,role:`img`,"aria-label":e,children:(0,W.jsx)(`svg`,{viewBox:`0 0 11.5 7.5`,width:`11.5`,height:`7.5`,fill:`currentColor`,"aria-hidden":`true`,children:eg.map(([e,t])=>(0,W.jsx)(`circle`,{cx:e*2+.75,cy:t*2+.75,r:`0.75`},`${e}.${t}`))})})}function ng({host:e,onMachines:t}){return U(),(0,W.jsxs)(`div`,{className:Jn,children:[(0,W.jsx)(`p`,{className:`text-muted`,children:J(`tasks`,`machine.filesElsewhere`,{host:e})}),(0,W.jsx)(`p`,{className:`text-muted`,children:J(`tasks`,`machine.filesHint`,{host:e})}),(0,W.jsx)(`div`,{children:(0,W.jsx)(G,{hit:`tight`,onClick:t,children:H(`machines.open`)})})]})}function rg(e){let t=y(e.client.conn),n=y(e.remote),[r,i]=(0,m.useState)(()=>X(e,`machines.list`)?.machines??[]),a=[...new Set(n.map(e=>`${e.machine?.id}:${e.machine?.stale??!1}`))].join();return(0,m.useEffect)(()=>{if(t.state!==`open`)return;let n=!0,r=()=>Z(e,`machines.list`).then(e=>n&&i(e.machines),()=>{});r();let a=Oi(Xh,r);return()=>{n=!1,a()}},[e.client,t.state,a]),r}function ig(e){let[t,n]=(0,m.useState)(!1),r=(0,m.useRef)(e.onClose);r.current=e.onClose,(0,m.useEffect)(()=>{t||r.current?.()},[t]);let i=(0,m.useRef)(null),a=(0,m.useRef)(null),o=(0,m.useRef)(null);(0,m.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,m.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,W.jsxs)(`span`,{ref:i,className:lh(e.yields),onKeyDown:e=>{e.key!==`Escape`||!t||(e.preventDefault(),e.stopPropagation(),s())},children:[(0,W.jsx)(`button`,{ref:a,type:`button`,className:ah(),"data-field":e.field,title:e.title,"aria-haspopup":`menu`,"aria-expanded":t,disabled:e.disabled,onClick:()=>n(e=>!e),children:typeof e.label==`string`?(0,W.jsx)(`span`,{className:gh,children:e.label}):e.label}),t&&(0,W.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 ag(e){let[t,n]=(0,m.useState)(0),r=[...e.extra?[e.extra]:[],...e.rows,...e.more??[]],i=Math.min(t,Math.max(0,r.length-1)),a=(0,m.useRef)(null);return(0,m.useEffect)(()=>{a.current?.scrollIntoView({block:`nearest`})},[i,e.rows]),(0,W.jsxs)(`div`,{className:uh,children:[(0,W.jsx)(`input`,{className:hn,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,W.jsxs)(`div`,{className:dh,children:[r.length===0&&(0,W.jsx)(`p`,{className:`mx-2 my-1 text-muted`,children:e.empty}),r.map((t,r)=>(0,W.jsxs)(m.Fragment,{children:[e.moreLabel&&t===e.more?.[0]&&(0,W.jsx)(`p`,{className:`mx-2 mt-2 mb-0.5 text-muted`,children:e.moreLabel}),t.ruled&&r>0&&(0,W.jsx)(`div`,{className:`mx-2 my-1 flex-none border-t-hairline border-t-line`}),(0,W.jsxs)(`button`,{type:`button`,"aria-current":t.checked===!0,ref:r===i?a:void 0,tabIndex:-1,title:t.title,className:ph({cursor:r===i}),onMouseMove:()=>n(r),onClick:n=>e.onPick(t.key,n.shiftKey||n.metaKey||n.ctrlKey),children:[(0,W.jsx)(`span`,{className:mh,children:t.checked?`✓`:``}),(0,W.jsx)(`span`,{className:yh,children:t.text}),t.dim&&(0,W.jsx)(`span`,{className:`ml-auto pl-3 text-muted ${t.dimPath?vh:`min-w-0 overflow-hidden text-ellipsis whitespace-nowrap`}`,children:t.dimPath?(0,W.jsx)(`bdi`,{children:t.dim}):t.dim})]})]},t.key))]}),e.hint&&(0,W.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 og(e){return(0,W.jsxs)(`button`,{type:`button`,role:e.multi?`menuitemcheckbox`:`menuitemradio`,"aria-checked":e.checked,tabIndex:-1,disabled:e.option.disabled,className:ph({cursor:e.cursor,dim:e.option.dim}),onMouseMove:e.onHover,onClick:e.onPick,children:[(0,W.jsx)(`span`,{className:mh,children:e.checked?`✓`:``}),(0,W.jsx)(`span`,{children:e.option.label}),!e.checked&&e.digit!==void 0&&!e.option.disabled&&(0,W.jsx)(`span`,{className:`ml-auto pl-3 text-muted`,children:e.digit})]})}function sg(e){let[t,n]=(0,m.useState)(()=>Math.max(0,e.options.findIndex(t=>t.id===e.value))),r=(0,m.useRef)(null);return(0,m.useEffect)(()=>r.current?.focus(),[]),(0,W.jsxs)(`div`,{ref:r,role:`menu`,tabIndex:-1,className:uh,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?qu(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,W.jsxs)(`button`,{type:`button`,className:`${fh} ${Ar} text-muted`,tabIndex:-1,onClick:e.onBack,children:[`‹ `,e.heading]}):(0,W.jsx)(`p`,{className:`${fh} ${Ar} text-muted`,children:e.heading}),e.options.map((r,i)=>(0,W.jsx)(og,{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 cg(e){return(0,W.jsxs)(`div`,{className:`${uh} ${Sh}`,children:[(0,W.jsx)(`p`,{className:`${fh} ${Ar} text-muted`,children:H(`newSession.branches`)}),(0,W.jsxs)(`label`,{className:xh,children:[(0,W.jsx)(`span`,{className:`text-muted`,children:H(`newSession.branchName`)}),(0,W.jsx)(`input`,{className:Nr,autoFocus:!0,spellCheck:!1,placeholder:H(`newSession.branchNamePlaceholder`),value:e.branch,onChange:t=>e.onBranch(t.target.value)})]}),e.repos.map(t=>(0,W.jsxs)(`label`,{className:xh,children:[(0,W.jsxs)(`span`,{children:[t.name,t.primary&&(0,W.jsxs)(`span`,{className:`text-muted`,children:[` `,H(`newSession.primary`)]})]}),(0,W.jsx)(`select`,{className:Nr,"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,W.jsx)(`option`,{value:e,children:e},e))})]},t.path))]})}function lg(e){return e.replace(/\.git$/,``).split(/[/:]/).filter(Boolean).slice(-2).join(`/`)}function ug(e){return e.id.startsWith(`root:`)?e.primary??e.checkouts[0]??e.id:e.id}function dg(e,t){if(!e||e.clone)return null;if(ku(e.ref))return e.ref;let n=t.find(t=>t.id===e.ref);return n?.primary??n?.checkouts[0]??null}function fg(e,t){if(!e)return null;let n=t.find(t=>t.id===e||t.checkouts.includes(e));return n?{ref:ug(n),clone:!1}:ku(e)?{ref:e,clone:!1}:null}function pg(e,t,n){let r=t.toLowerCase();return n?e.some(e=>e.toLowerCase()===`github.com/${r}`):e.some(e=>Eu(e).base.toLowerCase()===(r.split(`/`)[1]??``))}function mg(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:ug(i),clone:!1}:r.startsWith(`root:`)||ku(r)?null:{ref:r,clone:!0}}function hg(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 gg(e){return{repo:e.checkout??e.pick.ref,machine:e.machine,...e.checkout?{noWorktree:!0}:{},...e.pick.clone?{clone:!0}:{},...e.baseRef&&!e.checkout?{baseBranch:e.baseRef}:{},...e.prompt?{prompt:e.prompt}:{},...e.engine?{engine:e.engine}:{},...e.engineThere?{engineThere:!0}:{},...!e.engineThere&&e.model?{model:e.model}:{}}}function _g(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`}}var vg={error:[0,4,8,2,6],done:[3,7,5,2],idle:[1,2,5,8,7,6,3,0]},yg=1.2,bg=[0,1,4,5];function xg(e){return bg.includes((Math.floor(e)%20+20)%20)}var Sg=.3,Cg=.35,wg=.25,Tg=.12,Eg=2,Dg=1,Og={error:{dots:vg.error,bright:1},done:{dots:vg.done,bright:1},idle:{dots:vg.idle,bright:.6}},kg=Array.from({length:9},(e,t)=>Math.hypot(t%3-1,Math.floor(t/3)-1));function Ag(e){return Cg+.65*(.5+.5*Math.cos(2*Math.PI*e/yg))}function jg(e,t,n,r=1){switch(e){case`working`:{let e=t*80/1e3/r;return kg.map(t=>Ag(e-t*Sg))}case`waiting`:{let e=xg(t/r);return Array(9).fill(e?wg:1)}default:{let t=Og[e],r=Array(9).fill(Tg);return t?.dots.forEach((e,i)=>{let a=Math.min(Math.max(n-i*Dg,0),Eg)/Eg;r[e]=t.bright*a+Tg*(1-a)}),r}}}function Mg(e,t){let n=Og[e];return!n||t<(n.dots.length-1)*Dg+Eg}var Ng={working:`info`,waiting:`warning`,error:`attention`,done:`success`,idle:`muted`},Pg={prOpen:``,prMerged:``,prClosed:``};function Fg(e){let t=_g(e);return{look:t,tone:Ng[t]}}function Ig(e){return e.rowStatus?.kind===`needs-input`||e.rowStatus?.kind===`attention`}var Lg={busy:0,attention:1,"needs-input":2,running:3,unseen:4,idle:5};function Rg(e){let t;for(let{rowStatus:n}of e)n&&(!t||Lg[n.kind]<Lg[t.kind]||n.kind===t.kind&&n.since>t.since)&&(t=n);return t}function zg(e,t){if(!e)return null;if(e.lifecycle===`merged`)return{glyph:Pg.prMerged,tone:`text-merged`,state:`merged`};if(e.lifecycle===`closed`)return{glyph:Pg.prClosed,tone:`text-muted`,state:`closed`};if(e.lifecycle!==`open`&&e.lifecycle!==`ready_to_merge`&&e.lifecycle!==`unknown`)return null;let n=t===`conflict`?`conflict`:t===`failing`?`failing`:t===`passing`?`passing`:e.checkState===`pending`?`pending`:void 0,r=n===`conflict`?`text-warning`:n===`failing`?`text-error`:`text-success`;return{glyph:Pg.prOpen,tone:r,state:`open`,...n?{checks:n}:{}}}function Bg(e){return zg(e.pr,e.prChip)}function Vg(e){return zg(e,(e.mergeable??``).toUpperCase()===`CONFLICTING`?`conflict`:e.checkState===`failing`?`failing`:e.checkState===`passing`?`passing`:null)}function Hg(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 Ug=3,Wg=new Set,Gg;function Kg(e,t){let n=typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches,r=1/0,i=e.held+t-e.step,a=Mg(e.look,n?r:i);return jg(e.look,t,n?r:i,n?Ug:1).forEach((t,n)=>{let r=e.el.children[n].style;r.opacity=t.toFixed(3)}),a}function qg(){let e=Math.floor(performance.now()/80);for(let t of Wg)Kg(t,e)||Wg.delete(t);Jg()}function Jg(){Gg=Wg.size?window.setTimeout(qg,80-performance.now()%80+2):void 0}function Yg(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 Kg(a,r)&&(Wg.add(a),Gg===void 0&&Jg()),()=>{Wg.delete(a)}}function Xg({status:e}){let{look:t,tone:n}=Fg(e);return(0,W.jsx)($g,{look:t,tone:n,since:e?.since??0},t)}var Zg=e=>e===`muted`?`text-muted`:e===`ink`?`text-ink`:Sp[e];function Qg(){return(0,W.jsx)($g,{look:`working`,tone:`info`,since:Date.now()})}function $g({look:e,tone:t,since:n}){let r=(0,m.useRef)(null),[i]=(0,m.useState)(n);return(0,m.useLayoutEffect)(()=>{let t=r.current;return t?Yg(t,e,i):void 0},[e,i]),(0,W.jsx)(`span`,{ref:r,className:`inline-grid flex-none grid-cols-[repeat(3,3px)] auto-rows-[3px] gap-px self-center ${Zg(t)}`,"aria-hidden":`true`,children:Array.from({length:9},(e,t)=>(0,W.jsx)(`i`,{className:`rounded-full bg-current opacity-12`},t))})}var e_={offline:`newSession.remoteOffline`,outdated:`newSession.remoteOutdated`},t_=`local`,n_=`auto`,r_=`rove.newSession.autoMachine`;function i_(){try{return localStorage.getItem(r_)===`1`}catch{return!1}}var a_=(e,t)=>Z(e,`machines.repos`,{machine:t});function o_(e,t){let n=t.filter(e=>e.state===`online`).map(e=>e.alias).join(`
41
41
  `);(0,m.useEffect)(()=>{for(let t of n?[t_,...n.split(`
42
42
  `)]:[])a_(e,t).catch(()=>{})},[e,n])}function s_(e,t){let[n,r]=(0,m.useState)(null);return(0,m.useEffect)(()=>{if(!t)return;let n=!1;return Z(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 c_(e,t,n){let r=hg(n.engines,s_(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 l_(e,t,n){let[r,i]=(0,m.useState)(null),a=d_(e,r?.from??``);return(0,m.useEffect)(()=>{!r||!a.loaded||!t.loaded||(t.problem||n(mg(r.ref,a.repos,t.repos)),i(null))},[r,a,t,n]),(e,t)=>i(e&&t?{from:e,ref:t}:null)}function u_(e,t,n){let r=rg(e),[i,a]=(0,m.useState)(t.machine??``),[o,s]=(0,m.useState)(()=>!t.machine&&i_()),c=d_(e,i),[l,u]=(0,m.useState)(!1),d=c_(e,l?i:``,n);o_(e,r);let[f,p]=(0,m.useState)(null),[h,g]=(0,m.useState)(``),_=l_(e,c,e=>p(t=>t??e));return(0,m.useEffect)(()=>{!i||!c.loaded||i!==t.machine||p(e=>e??fg(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:h,setBase:g,switchTo(e,t){let n=e===`auto`?``:e;s(e===n_);try{localStorage.setItem(r_,e===`auto`?`1`:`0`)}catch{}_(n&&(i||`local`),i?f?.ref:t),a(n),p(null),g(``)}}}function d_(e,t){U();let[n,r]=(0,m.useState)(null);if((0,m.useEffect)(()=>{if(!t)return;let n=!1;return a_(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:H(`newSession.remoteFailed`,{machine:t,message:i?.failed??``})};let s=o.reason?e_[o.reason]:void 0,c=o.reason?s?H(s,{machine:t}):H(`newSession.remoteFailed`,{machine:t,message:o.message??o.reason}):``;return{repos:o.repos,loaded:!0,problem:c}}function f_(e,t){return t.problem?t.problem:t.loaded?H(`newSession.remoteNone`,{machine:e}):H(`newSession.remoteLoading`,{machine:e})}function p_(){return(0,W.jsxs)(`svg`,{className:nh,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,W.jsx)(`rect`,{x:`2`,y:`3`,width:`12`,height:`8`,rx:`1`}),(0,W.jsx)(`path`,{d:`M5.5 13.5h5M8 11v2.5`})]})}function m_(e){let t=(U()===`zh`?Ji:qi).machine,n=e.machines.find(t=>t.alias===e.value),r=e.value===`auto`?H(`newSession.machineAuto`):e.value?n?.hostLabel||e.value:H(`newSession.thisMachine`);return(0,W.jsx)(ig,{field:`machine`,title:H(`newSession.machine`),label:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(p_,{}),(0,W.jsx)(`span`,{className:rh,children:r})]}),children:n=>(0,W.jsx)(sg,{heading:H(`newSession.machine`),options:[{id:n_,label:H(`newSession.machineAuto`)},{id:``,label:H(`newSession.thisMachine`)},...e.machines.map(e=>({id:e.alias,label:Zh(e,t),disabled:e.state!==`online`}))],footer:e.value===`auto`?(0,W.jsx)(`p`,{className:`${bh} text-muted`,children:H(`newSession.machineAutoNote`)}):null,value:e.value,digits:!0,onPick:t=>{e.onPick(t),n()}})})}function h_(e){let{machine:t}=e;return(0,W.jsx)(sg,{heading:H(`newSession.agentPlace`),options:[{id:``,label:H(`newSession.thisMachine`)},{id:`there`,label:t}],value:e.there?`there`:``,digits:!0,onBack:e.onBack,onPick:t=>e.onPick(t!==``),footer:(0,W.jsx)(`p`,{className:`${bh} text-muted`,children:H(e.there?`newSession.agentThereNote`:`newSession.agentHereNote`,{machine:t})})})}function g_(e){let[t,n]=(0,m.useState)(``),r=t.trim();return(0,W.jsx)(ig,{field:`branch`,title:H(`newSession.branch`),label:e.value||H(`newSession.branch`),children:i=>(0,W.jsx)(ag,{placeholder:H(`newSession.branchTypeRef`),empty:``,rows:[{key:``,text:H(`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 __(e,t){return(await e.client.request(`task.spawn`,gg(t))).taskIds[0]}function v_(e){let{progress:t,error:n}=e;return!t&&!n?null:(0,W.jsxs)(`div`,{className:Jm,children:[t&&(0,W.jsxs)(`p`,{className:`m-0 flex items-center gap-2 text-muted`,"data-field":`clone-progress`,children:[(0,W.jsx)(Qg,{}),(0,W.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&&!Dh(n)&&(0,W.jsxs)(`p`,{className:`m-0 text-error`,children:[`※ `,n]}),n&&Dh(n)&&(0,W.jsxs)(`p`,{className:`pointer-events-auto m-0 text-error`,"data-field":`no-disk-space`,children:[`※ `,J(`tasks`,`toast.noDiskSpace`),` `,(0,W.jsx)(G,{hit:`tight`,disabled:e.busy,onClick:e.onRetry,children:H(`newSession.retry`)})]})]})}function y_(e){return e instanceof Go&&e.code===`CLONE_FAILED`?J(`newTask`,`error.cloneFailed`,{error:e.message}):e instanceof Error?e.message:String(e)}function b_({on:e,...t}){return(0,W.jsx)(`button`,{type:`button`,className:`${ah(e)} ${oh}`,"aria-pressed":e,...t})}function x_(e){let[t,n]=(0,m.useState)(``);if(e.ungrouped)return null;if(e.remote){if(!e.remotePick)return null;let t=e.remoteWorktree;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(S_,{on:t!==`off`,disabled:t===`required`,title:H(t===`required`?`newSession.worktreeRemoteRequired`:t===`off`?`newSession.worktreeOff`:`newSession.worktreeOn`),onClick:e.onToggleWorktree}),t!==`off`&&(0,W.jsx)(g_,{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=Wm(s?.branches??[],t).map(e=>({key:e,text:e,checked:e===(i[o]||s?.current)})),u=r.map(t=>({path:t,name:Eu(t).base,primary:t===o,branches:e.probes[t]?.branches??[],current:e.probes[t]?.current??``,base:i[t]??``}));return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(S_,{on:!a,disabled:r.length>1||e.plain,title:e.plain?H(`newSession.worktreeNoGit`):r.length>1?H(`newSession.worktreeMulti`):H(a?`newSession.worktreeOff`:`newSession.worktreeOn`),onClick:e.onToggleWorktree}),r.length>1?(0,W.jsx)(ig,{field:`branch`,title:H(`newSession.branches`),label:H(`newSession.branches`),children:()=>(0,W.jsx)(cg,{repos:u,branch:e.branchName,onBranch:e.onBranchName,onBase:e.onBase})}):!a&&s?.ok&&c&&(0,W.jsx)(ig,{field:`branch`,title:H(`newSession.branch`),label:c,children:r=>(0,W.jsx)(ag,{placeholder:H(`newSession.branchSearch`),empty:H(`newSession.branchEmpty`),rows:l,query:t,onQuery:n,onPick:t=>{e.onBase(o,t),n(``),r()}})})]})}function S_(e){return(0,W.jsxs)(b_,{on:e.on,disabled:e.disabled,title:e.title,onClick:e.onClick,children:[(0,W.jsx)(Th,{}),(0,W.jsx)(`span`,{className:rh,children:H(`newSession.worktree`)})]})}var C_=`rove.web.newSession.prompt`,w_=`rove.web.newSession.attachments`,T_=sessionStorage.getItem(C_)??``;function E_(){return T_}function D_(e){T_=e;try{sessionStorage.setItem(C_,e)}catch{}}function O_(e,t){let[n,r]=(0,m.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=Hu(a,t);r(n),n[0]&&n[0]!==e.engine&&e.setEngine(n[0])}}}function k_(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,W.jsx)(ig,{field:`engine`,title:H(`newSession.engine`),label:Uu(i)||H(`newSession.engine`),children:i=>(0,W.jsx)(sg,{heading:H(`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?H(`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,W.jsx)(G,{className:`mx-2 mt-1 mb-0.5 self-start font-mono`,"data-field":`compare-engines`,hit:`tight`,onClick:()=>t.setComparing(!t.comparing),children:H(t.comparing?`compare.oneEngine`:`compare.severalEngines`)}):null})})}function A_(e){return(0,W.jsx)(ig,{field:`model`,title:H(`newSession.model`),label:Vu(e.models,e.model,H(`newSession.modelDefault`)),children:t=>(0,W.jsx)(sg,{heading:H(`newSession.modelHeading`),options:e.models,value:e.model,digits:!0,onPick:n=>{e.onModel(n),t()}})})}var j_=6e4,M_=/^(?:(today|tomorrow|今天|明天)\s*)?(\d{1,2})(?::(\d{2}))?\s*(am|pm)?$/i,N_=/^\+\s*(?:(\d+)\s*h)?\s*(?:(\d+)\s*m)?$/i;function P_(e,t){let n=e.trim(),r=N_.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*j_):null}let i=M_.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 F_(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 I_(e){let[t,n]=(0,m.useState)(``),r=()=>{let n=P_(t,new Date);if(!n)return e.onInvalid(H(`newSession.laterBad`));e.onSchedule(n)};return(0,W.jsxs)(`div`,{className:Ch,children:[(0,W.jsx)(`input`,{className:`${Nr} min-w-0 flex-1`,value:t,placeholder:H(`newSession.laterPlaceholder`),"aria-label":H(`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,W.jsx)(G,{variant:`filled`,disabled:!t.trim(),onClick:r,children:H(`newSession.laterConfirm`)})]})}function L_(e){let[t,n]=(0,m.useState)(`root`),r=e.agentPlace;return(0,W.jsx)(ig,{field:`more`,title:H(`newSession.more`),label:(0,W.jsx)(`span`,{"aria-hidden":`true`,children:`⋯`}),onClose:()=>n(`root`),children:i=>t===`later`?(0,W.jsxs)(`div`,{className:uh,children:[(0,W.jsxs)(`button`,{type:`button`,className:`${fh} ${Ar} text-muted`,onClick:()=>n(`root`),children:[`‹ `,H(`newSession.later`)]}),(0,W.jsx)(I_,{onBack:()=>n(`root`),onInvalid:e.onInvalid,onSchedule:t=>{i(),e.onLater?.(t)}})]}):t===`agent`&&r?(0,W.jsx)(h_,{...r,onBack:()=>n(`root`),onPick:e=>{r.onPick(e),i()}}):(0,W.jsxs)(`div`,{role:`menu`,className:uh,children:[r&&(0,W.jsx)(R_,{label:H(`newSession.agentPlace`),dim:r.there?r.machine:H(`newSession.thisMachine`),sub:!0,disabled:e.busy,onClick:()=>n(`agent`)}),e.onLater&&(0,W.jsx)(R_,{label:H(`newSession.later`),sub:!0,disabled:e.busy,onClick:()=>n(`later`)})]})})}function R_(e){return(0,W.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`${ph({cursor:!1})} [&:hover:not(:disabled)]:bg-hover`,disabled:e.disabled,onClick:e.onClick,children:[(0,W.jsx)(`span`,{className:gh,children:e.label}),(e.dim!==void 0||e.sub)&&(0,W.jsxs)(`span`,{className:`${hh} text-muted`,children:[e.dim,e.sub&&(0,W.jsx)(hs,{right:!0})]})]})}var z_=`clone:`;function B_(e){let{model:t,saved:n,picked:r,primary:i,home:a,query:o,remote:s}=e,[c,l]=(0,m.useState)(()=>X(t,`github.repos`)??null);(0,m.useEffect)(()=>{let e=!1,n=t.client.onOpen(()=>{Z(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=Lu(u),p=n.filter(e=>e.toLowerCase().includes(d)||f!==null&&`/${Eu(e).base.toLowerCase()}`===f.slice(f.indexOf(`/`))),h=H(`newSession.noFolder`),g=e.ungrouped&&(!u||h.toLowerCase().includes(u.toLowerCase()))?[{key:Hd,text:h,checked:e.ungrouped.on}]:[],_=p.map((e,t)=>{let{base:n,dir:a}=Eu(e);return{key:e,text:n,dim:e===i&&r.length>1?`${H(`newSession.primary`)}, ${a}`:a,dimPath:!0,title:e,checked:r.includes(e),ruled:t===0&&g.length>0}}),v=Fu(u),y=v&&(v.includes(`:`)||p.length===0)?v:null,b=!y&&Au(u)&&!n.includes(u)&&(!s||ku(u))?Mu(ju(u,a)):``,x=(c?.repos??[]).filter(e=>e.nameWithOwner.toLowerCase().includes(f??d)).filter(e=>!pg(n,e.nameWithOwner,s!==void 0)).sort((e,t)=>Number(t.nameWithOwner.toLowerCase()===f)-Number(e.nameWithOwner.toLowerCase()===f)).map(t=>({key:z_+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:z_+y,text:s?H(`newSession.cloneRowOn`,{source:y,machine:s.name}):H(`newSession.cloneRow`,{source:y})}:b?{key:b,text:b,checked:r.includes(b)}:null;return(0,W.jsx)(ag,{placeholder:H(s?`newSession.repoSearchRemote`:`newSession.repoSearch`),empty:s?.empty??H(`newSession.repoEmpty`),rows:s?.blocked?[]:[...g,..._],query:o,onQuery:e.onQuery,extra:s?.blocked?null:S,more:s?.blocked?[]:x,moreLabel:H(`newSession.githubGroup`),hint:s?void 0:H(`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()}})}var V_=`:shell`;function H_(e,t){let[n,r]=(0,m.useState)(!1),i=t&&n;return t?{on:i,choice:{...e,engines:[...e.engines,{id:V_,name:H(`newSession.shell`)}],engine:i?V_:e.engine,setEngine:t=>{r(t===V_),t!==`:shell`&&e.setEngine(t)}}}:{on:i,choice:e}}async function U_(e,t,n){let r=n.trim();if(/[\r\n]/.test(r))throw Error(H(`newSession.shellOneLine`));let i=r?{type:r}:{},a=r?Tu(r):H(`newSession.shell`);if(typeof t==`object`&&t)return(await e(`task.spawn`,{...Ju({repos:t.repos,branch:t.branch,engine:``,prompt:``,model:``}),title:a,shell:!0,...i})).taskIds[0];let{taskId:o}=t===null?await e(`task.openScratch`,{}):await e(`task.openCheckout`,{repo:t,title:a});return await e(`tab.new`,{taskId:o,kind:`shell`,own:!0,...i}),o}function W_(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 G_(e,t){return e?[e,...(t.extras??[]).map(e=>e.repo)]:[]}function K_(e,t){return e?{...t.baseBranch?{[e]:t.baseBranch}:{},...Object.fromEntries((t.extras??[]).flatMap(e=>e.baseRef?[[e.repo,e.baseRef]]:[]))}:{}}function q_(e){return[e.machine??``,e.repo??``,e.ungrouped?`u`:``,e.retryOf?.id??``,e.baseBranch??``,e.worktree===void 0?``:String(e.worktree)].join(`\0`)}function J_(e,t){return e.retryOf&&e.engine&&e.engine===t?e.retryOf.id:void 0}async function Y_(e,t){try{let{task:n}=await e.client.request(`task.get`,{taskId:t.id});if(!n.prompt)return void z(H(`menu.retryNoPrompt`),`error`);ie(W_(t,{...n,prompt:n.prompt}))}catch(e){z(K(e),`error`)}}function X_(e,t){let n=async n=>{await e.act(`task.archive`,{taskId:t.id,archived:!0,...n?{force:n}:{}}),z(J(`tasks`,`archive.done`,{title:t.label}))};O.set((0,W.jsx)(q,{title:H(`newSession.retryArchiveTitle`,{title:t.label}),body:H(`newSession.retryArchiveBody`),confirmLabel:J(`tasks`,`menu.archive`),onConfirm:()=>n(!1),escalate:{when:e=>e instanceof Go&&e.code===`TASK_BUSY`,label:J(`tasks`,`archive.busyConfirm`),title:J(`tasks`,`archive.busyTitle`),body:()=>J(`tasks`,`archive.busyBody`,{title:t.label}),run:()=>n(!0)}}))}var Z_=v([]),Q_=()=>y(Z_);async function $_(e){Z_.set((await e.request(`snippets.get`)).snippets)}async function ev(e,t){Z_.set((await e.request(`snippets.save`,{name:t.name,text:t.text})).snippets)}async function tv(e,t){Z_.set((await e.request(`snippets.remove`,{name:t})).snippets)}var nv=/^[A-Za-z0-9][\w-]{0,31}$/;function rv(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 iv(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 av(e,t,n){return{text:e.slice(0,t.start)+n.text+e.slice(t.end),caret:t.start+n.text.length}}var ov=e=>e.split(`
43
43
  `,1)[0]??``;function sv(e){return(0,W.jsx)(`ul`,{className:`${Or} ${e.className}`,children:e.items.map((t,n)=>(0,W.jsx)(`li`,{children:(0,W.jsxs)(G,{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,W.jsxs)(`span`,{className:`text-accent`,children:[`@`,t.name]}),(0,W.jsxs)(`span`,{className:`text-muted`,children:[` `,ov(t.text)]})]})},t.name))})}function cv(e){let t=Q_(),[n,r]=(0,m.useState)(0),[i,a]=(0,m.useState)(0),[o,s]=(0,m.useState)(null),c=(0,m.useRef)(null),l=rv(e.value,Math.min(n,e.value.length)),u=l?iv(t,l.query):[],d=l!==null&&u.length>0&&o!==l.start,f=Math.min(i,Math.max(0,u.length-1));(0,m.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=av(e.value,l,n);c.current=r.caret,a(0),e.onChange(r.text)},h=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,W.jsx)(sv,{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=>{h(t)||!e.onEnter||t.key!==`Enter`||t.shiftKey||t.nativeEvent.isComposing||(t.preventDefault(),e.onEnter())}}}}var lv=`relative hidden [border-top:var(--hairline)_solid_var(--line)] bg-surface px-3 pt-2.5 pb-3.5 touch:flex`,uv=`absolute inset-x-3 bottom-full z-5 mb-1`,dv=`absolute inset-x-3 bottom-full z-6 mb-1`,fv=`flex min-w-0 flex-1 items-center gap-2.5`,pv=`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`,mv=`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`,hv=`transition-transform duration-100 active:scale-94 motion-reduce:transition-none motion-reduce:active:scale-none`,gv=`transition-[scale,background-color,border-color,color] duration-150 active:scale-[0.98] motion-reduce:transition-none motion-reduce:active:scale-none`,_v=`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 ${hv}`,vv=`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 ${hv}`,yv=`size-4.5 flex-none fill-none stroke-current stroke-[1.5] [stroke-linecap:round] [stroke-linejoin:round]`,bv=(e=!1)=>`${vv} -mr-1.5 -ml-3.25 ${e?`text-accent`:`text-muted`}`,xv=e=>`${vv} ${e?`text-accent`:`text-muted`}`,Sv=(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 ${gv} ${t?`border-accent bg-accent text-paper`:e?`border-accent bg-accent-soft text-accent`:`border-line bg-inset text-ink`}`;function Cv({d:e}){return(0,W.jsx)(`svg`,{viewBox:`0 0 16 16`,className:yv,"aria-hidden":`true`,children:(0,W.jsx)(`path`,{d:e})})}var wv=`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`,Tv=`M8 13V3M3.5 7.5 8 3l4.5 4.5`;function Ev(){return(0,W.jsx)(Cv,{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 Dv(e){return(0,W.jsxs)(`button`,{type:`submit`,className:_v,title:e.label,disabled:e.disabled,children:[(0,W.jsx)(`span`,{className:`sr-only`,children:e.label}),(0,W.jsx)(Cv,{d:Tv})]})}function Ov(e,t){let n=(0,m.useRef)(e);e!==null&&(n.current=e);let r=e===null,[i,a]=(0,m.useState)(r);return(0,m.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 kv(e){return typeof Intl.Segmenter==`function`?[...new Intl.Segmenter(void 0,{granularity:`word`}).segment(e)].map(e=>e.segment):e.split(/(\s+)/)}function Av({level:e,seconds:t,wide:n}){let r=n?120:80,i=(0,m.useRef)([]),a=(0,m.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,W.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,W.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 jv(){return(0,W.jsx)(`span`,{className:`inline-flex items-center gap-[3px] align-middle`,"aria-hidden":`true`,children:[0,160,320].map(e=>(0,W.jsx)(`i`,{className:`block size-1 rounded-full bg-current motion-safe:animate-dot`,style:{animationDelay:`${e}ms`}},e))})}var Mv=`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 Nv({bubble:e,leaving:t}){return(0,W.jsx)(`span`,{className:`${Mv} ${t?`motion-safe:animate-sink-out`:`motion-safe:animate-bubble-in`} ${e.armed?`border-accent`:`border-line`}`,children:e.text?(0,W.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,W.jsx)(`span`,{children:kv(e.text).map((e,t)=>(0,W.jsx)(`span`,{className:`motion-safe:animate-fade-in`,children:e},t))})},`words`):(0,W.jsx)(`span`,{className:`flex min-w-0 flex-1 text-accent`,children:(0,W.jsx)(Av,{level:e.level,seconds:e.seconds,wide:!0})},`wave`)})}var Pv=`flex min-w-0 flex-1 items-center gap-2.5 motion-safe:animate-fade-in`;function Fv(e){let{state:t}=e,n=t.phase===`recording`,r=t.phase===`transcribing`,i=e.slide!==void 0,a=n&&t.held,o=(0,m.useRef)(``);n&&(o.current=t.partial);let{shown:s,leaving:c}=Ov(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,W.jsx)(Nv,{bubble:s,leaving:c}),u=(0,W.jsxs)(`span`,{className:`${Pv} justify-center gap-2 text-body`,children:[e.working.replace(/…$/,``),(0,W.jsx)(jv,{})]},`working`);return r||n&&i&&!a?(0,W.jsxs)(W.Fragment,{children:[l,u]}):n?(0,W.jsxs)(W.Fragment,{children:[l,(0,W.jsxs)(`span`,{className:Pv,children:[(0,W.jsx)(`span`,{className:`size-2 flex-none rounded-full bg-current`,style:{opacity:.3+Math.min(1,t.level*10)*.7}}),(0,W.jsx)(`span`,{className:`flex-none font-mono text-body normal-nums`,children:t.time}),i?(0,W.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,W.jsx)(`svg`,{viewBox:`0 0 16 16`,className:`size-4 flex-none fill-none stroke-current stroke-[1.5]`,"aria-hidden":`true`,children:(0,W.jsx)(`path`,{d:Tv})}),t.armed?e.release:e.slide]},String(t.armed)):t.partial?(0,W.jsx)(`span`,{className:`flex min-w-0 flex-1 justify-end overflow-hidden whitespace-nowrap text-meta`,children:t.partial}):(0,W.jsx)(Av,{level:t.level,seconds:t.seconds})]},`take`)]}):(0,W.jsxs)(W.Fragment,{children:[l,(0,W.jsxs)(`span`,{className:`${Pv} justify-center gap-2 text-display`,children:[(0,W.jsx)(`span`,{className:`flex text-muted`,children:(0,W.jsx)(Cv,{d:wv})}),e.idle]},`idle`)]})}function Iv({state:e}){return e.phase===`recording`?(0,W.jsx)(`span`,{className:`font-mono text-meta normal-nums`,children:e.time}):e.phase===`transcribing`?(0,W.jsx)(`span`,{className:`font-mono text-meta`,children:`…`}):(0,W.jsx)(Cv,{d:wv})}function Lv(e){return e.hold?(0,W.jsx)(Fv,{state:e.state,idle:e.idle,working:e.working}):(0,W.jsx)(Iv,{state:e.state})}function Rv(e){return(0,W.jsxs)(`form`,{className:lv,"data-composer":e.composerKey,onSubmit:t=>{t.preventDefault(),e.onSend()},children:[e.attached&&(0,W.jsx)(`div`,{className:uv,children:e.attached}),e.suggest&&(0,W.jsx)(`div`,{className:dv,children:e.suggest}),(0,W.jsxs)(`div`,{className:fv,children:[e.attach,e.voice??(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:pv,children:[(0,W.jsx)(`textarea`,{ref:e.fieldRef,className:mv,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,W.jsx)(Dv,{label:e.sendLabel,disabled:e.busy||!e.ready})]})]})]})}var zv=`/dictation-worklet.js`,Bv=60,Vv=16e3,Hv=.004,Uv={phase:`idle`,seconds:0,level:0,error:null,partial:``},Wv=1e3,Gv=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 Kv(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 qv(e,t){let n=new Gv(t/Vv).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,Vv,!0),a.setUint32(28,Vv*2,!0),a.setUint16(32,2,!0),a.setUint16(34,16,!0),o(36,`data`),a.setUint32(40,r*2,!0),i.set(Kv(n),44),i}function Jv(e){for(let t of e.getTracks())t.stop();return null}function Yv(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 Xv=class{client;scope;view=v(Uv);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({...Uv,phase:`recording`});try{let n=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0}});if(t!==this.session)return Jv(n);this.stream=n;let r=new AudioContext;if(this.context=r,await r.audioWorklet.addModule(zv),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(),Bv*1e3),e&&(this.live={id:`${Date.now().toString(36)}${Math.random().toString(36).slice(2,10)}`,resample:new Gv(r.sampleRate/Vv),sent:0,seq:0,inFlight:null,dead:!1},this.liveTimer=window.setInterval(()=>void this.pump(!1),Wv)),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:Yv(Kv(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??Vv,t=this.chunks;this.view.set({...this.view.get(),phase:`transcribing`,level:0}),this.release();let n=qv(t,e),r=(n.length-44)/2/Vv;if(r<.3||this.peak<Hv)return this.live=null,this.view.set(Uv),{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(Uv),t}catch(e){return this.live=null,this.fail(e),null}}transcribeWhole(e){let t=this.scope();return this.client.request(`voice.transcribe`,{wav:Yv(e),context:t.draft,taskId:t.taskId,tabId:t.tabId})}fail(e){this.view.set({...Uv,phase:`error`,error:e instanceof Error?e.message:String(e)})}cancel(){this.view.get().phase===`recording`&&(this.release(),this.live=null,this.view.set(Uv))}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}},Zv=e=>`0:${String(Math.floor(e)).padStart(2,`0`)}`,Qv=300,$v=48,ey=()=>navigator.vibrate?.(8),ty=new WeakMap,ny=new WeakSet;function ry(e){let t=ty.get(e);return t||(t=v(null),ty.set(e,t)),t}function iy(e,t){ry(e).set(t)}var ay=e=>e.available??(e.ready===!0||(e.model??null)!==null);function oy(e){let t=ry(e),n=y(t);return(0,m.useEffect)(()=>{ny.has(e)||(ny.add(e),e.onOpen(()=>{e.request(`voice.status`).then(e=>t.set(ay(e)),()=>t.set(!1))}))},[e,t]),n}var sy=e=>xu()&&ry(e).get()!==!1;function cy(e){U();let t=(0,m.useRef)(e);t.current=e;let n=(0,m.useRef)(null);n.current===null&&(n.current=new Xv(e.client,()=>t.current.context()));let r=y(n.current.view),i=oy(e.client),a=(0,m.useRef)(null),o=(0,m.useRef)(!1),[s,c]=(0,m.useState)(null);(0,m.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}),ey()},Qv)),a.current=t},f=e=>{let n=a.current;if(!n?.held||!t.current.onSend)return;let r=n.y-e.clientY>$v;r!==n.armed&&(n.armed=r,c({armed:r}),ey())},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)}},h=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`?H(s?`voice.release`:`voice.stop`,{time:Zv(r.seconds)}):r.phase===`transcribing`?H(`voice.working`):e.idle??H(`voice.say`),_=r.phase===`recording`,v=s?.armed??!1;return i===!0?(0,W.jsx)(`button`,{type:`button`,className:`${(e.look??sh)(_,v)} ${ch}`,disabled:e.disabled||r.phase===`transcribing`,title:r.error??H(`voice.hint`),"aria-label":e.face?g:void 0,onPointerDown:d,onPointerMove:f,onPointerUp:()=>void p(),onPointerCancel:()=>void h(),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:Zv(r.seconds),seconds:r.seconds,level:r.level,held:s!==null,armed:v,partial:r.partial}):(0,W.jsxs)(W.Fragment,{children:[g,_&&(0,W.jsx)(`span`,{className:`inline-flex items-center`,"aria-hidden":`true`,children:(0,W.jsx)(`span`,{className:`size-1.5 rounded-full bg-current`,style:{opacity:.25+Math.min(1,r.level*12)*.75}})})]})}):null}function ly(e,t){re(e,void 0,t)}function uy(){re(void 0,void 0,void 0,void 0,!0)}var dy=`rove.web.newSession.worktree`;function fy({model:e,seed:t}){let n=t.repo;U();let r=y(e.selection).taskId,i=e.tasks.get()?.tasks.find(e=>e.id===r)?.repo,a=cd(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,m.useState)(o??[]),[u,d]=(0,m.useState)(()=>X(e,`fs.subdirs`,{path:`~/`})?.home??``),[f,p]=(0,m.useState)(()=>G_(s(o),t)),[h,g]=(0,m.useState)(()=>Object.fromEntries(f.flatMap(t=>{let n=X(e,`repo.probe`,{path:t});return n?[[t,n]]:[]}))),_=(0,m.useRef)(new Set),[v,b]=(0,m.useState)(t.ungrouped===!0),[x,S]=(0,m.useState)(null),C=()=>{b(!0),p([]),S(null)},[w,T]=(0,m.useState)(()=>K_(s(o),t)),[E,D]=(0,m.useState)(``),[O,k]=(0,m.useState)(``),[A,j]=(0,m.useState)(()=>(t.prompt!==void 0&&D_(t.prompt),E_())),M=e=>{D_(e),j(e)},[N,ee]=(0,m.useState)(``),[P,F]=(0,m.useState)(!1),[I,te]=(0,m.useState)(``),[ne,re]=(0,m.useState)(()=>t.worktree??localStorage.getItem(dy)!==`0`),ie=e=>{localStorage.setItem(dy,e?`1`:`0`),re(e)},[ae,R]=(0,m.useState)(null),oe=(0,m.useRef)(()=>{}),{attachments:se,attach:ce,remove:le,ready:B,clear:ue}=vu(e,R,w_),de=(0,m.useRef)(null),fe=oy(e.client),pe=xu()&&fe===!0,me=e=>{let t=de.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(()=>{pe||t?.focus(),t?.setSelectionRange(a,a)})},he=u_(e,{machine:t.machine,repo:n},a),{machines:ge,machine:_e,remote:V,machineName:ye,remoteList:be,engineThere:xe,shown:Se}=he,{pick:Ce,setPick:we,base:Te,setBase:Ee}=he,De=H_(Se,!V),Oe=V||De.on?null:uu(e=>void ce(e)),ke=Se.engine;(0,m.useEffect)(()=>e.client.onOpen(()=>{Promise.all([Z(e,`repos.list`),Z(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:G_(r,t)),T(e=>({...e,...K_(r,t)}))}).catch(()=>{})}),[e,n]);let Ae=f.some(e=>h[e]?.git===!1),je=!V&&(!ne||Ae)&&f.length===1,Me=V&&!xe?dg(Ce,be.repos):null,Ne=Me!==null&&!ne,Pe=f[0]??``;(0,m.useEffect)(()=>{for(let t of f)_.current.has(t)||(_.current.add(t),Z(e,`repo.probe`,{path:t}).then(e=>g(n=>({...n,[t]:e}))).catch(()=>{}))},[e,f]),(0,m.useEffect)(()=>{sy(e.client)||de.current?.focus()},[e.client]);let Fe=!V&&!v&&!je&&!De.on,Ie=O_(De.choice,Fe),Le=Ie.comparing?Se:De.choice,Re=a.engines.find(e=>e.id===ke),ze=Se.engines.find(e=>e.id===ke)?.name??ke,Be=Bu(Re,H(`newSession.modelDefault`)),Ve=Be.some(e=>e.id===N)?N:``,He=async t=>{te(H(`newSession.cloning`,{source:t}));let n=await e.client.request(`repo.clone`,{url:t},te);return l(e=>e.includes(n.path)?e:[...e,n.path]),p([n.path]),S(null),n.path},Ue=async()=>{if(!Ce)return R(H(`newSession.needRepo`));if(!A.trim())return R(H(`newSession.needPrompt`));let n=Se.missing?.has(ke)&&ze;if(n)return R(H(`newSession.engineMissingOn`,{engine:n,machine:ye}));F(!0),te(Ce.clone?H(`newSession.cloningOn`,{source:lg(Ce.ref),machine:ye}):H(`newSession.startingOn`,{machine:ye}));try{let n=await __(e,{pick:Ce,machine:_e,engine:ke,prompt:A.trim(),baseRef:Te,...Ne?{checkout:Me}:{},engineThere:xe,model:Ve});D_(``),L.set(null),n&&e.selectWhenListed(n),t.retryOf&&n&&X_(e,t.retryOf)}catch(e){R(y_(e))}finally{F(!1),te(``)}},We=async n=>{if(oe.current=()=>void We(n),R(null),V)return Ue();if(!Pe&&!v&&!x)return R(H(`newSession.needRepo`));if(!A.trim()&&!De.on)return R(H(`newSession.needPrompt`));F(!0);let r=pu(A.trim(),await B());try{let i=x?[await He(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(H(`newSession.plainMulti`));let c,l,u=e.client.request.bind(e.client),d=i.map((e,t)=>({repo:a[t]?.repo??e,baseRef:w[e]??``})),p=i.length===1&&!ne||s?d[0]?.repo??``:null;if(De.on)c=await U_(u,v?null:p??{repos:d,branch:E.trim()},A);else if(v)c=await Yu(u,ke,r,Ve);else if(p!==null)c=await Xu(u,p,ke,A,r,n,Ve);else{let a=J_(t,ke),o=he.auto&&!n&&i.length===1&&Ie.ids.length<=1&&se.length===0&&!a,s=await e.client.request(`task.spawn`,{...Ju({repos:d,branch:E.trim(),engine:ke,commandFrom:a,engines:n?[]:Ie.ids,prompt:r,...n?{at:n}:{},model:Ve}),...o?{machine:n_}:{}});s.machine&&z(H(`newSession.startedOn`,{machine:s.machine})),c=s.taskIds[0],l=s.groupId}n&&z(H(`newSession.laterSet`,{time:F_(n)})),D_(``),ue(),L.set(null),l?ve(l):c&&e.selectWhenListed(c),t.retryOf&&c&&X_(e,t.retryOf)}catch(e){let t=Wu(e);t?(D_(``),ue(),L.set(null),z(e instanceof Error?e.message:String(e),`error`),ve(t)):R(y_(e))}finally{F(!1),te(``)}},Ge=cv({value:A,onChange:M,area:de,onEnter:()=>void We()}),Ke=e=>{he.switchTo(e,Pe),k(``),R(null),b(!1)};return(0,W.jsxs)(`div`,{className:Gm,children:[(0,W.jsxs)(`div`,{className:Km,children:[(0,W.jsx)(Hm,{scene:t.sky??`orbit`}),(0,W.jsx)(`h1`,{className:`m-0 font-sans text-title font-semibold text-accent`,children:H(`newSession.title`)}),(0,W.jsx)(`p`,{className:`m-0 text-muted narrow:hidden`,children:H(`newSession.tagline`)})]}),(0,W.jsxs)(`form`,{className:qm,onSubmit:e=>{e.preventDefault(),We()},children:[(0,W.jsxs)(`div`,{className:Ym,...Oe?.drop,children:[!V&&(0,W.jsx)(yu,{attachments:se,onRemove:le}),(0,W.jsx)(`textarea`,{ref:de,className:Zm,rows:4,spellCheck:!1,placeholder:H(De.on?`newSession.shellPlaceholder`:`newSession.placeholder`),value:A,disabled:P,onPaste:Oe?.onPaste,...Ge.field}),Ge.list,(0,W.jsxs)(`div`,{className:Xm,children:[Oe&&(0,W.jsxs)(du,{className:(pe?bv:th)(se.length>0),title:H(`newSession.attachHint`),disabled:P,onFiles:ce,children:[(0,W.jsx)(`span`,{className:`sr-only`,children:H(`newSession.attach`)}),(0,W.jsx)(Ev,{})]}),(0,W.jsx)(cy,{client:e.client,context:()=>({draft:[A.slice(-300),Pe,E,Ce?.ref??``].filter(Boolean).join(`