@sma1lboy/rove 0.9.310 → 0.9.311-next.651

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 (63) hide show
  1. package/dist/cli/{chunk-v72qzktg.js → chunk-164snxjp.js} +1 -1
  2. package/dist/cli/{chunk-3d6caevx.js → chunk-16w3zr3h.js} +1 -1
  3. package/dist/cli/{chunk-expgczbc.js → chunk-1kbt48sb.js} +1 -1
  4. package/dist/cli/{chunk-ecdnw5xe.js → chunk-281nz84k.js} +2 -2
  5. package/dist/cli/{chunk-teq8p5rp.js → chunk-3mteb2yn.js} +2 -2
  6. package/dist/cli/{chunk-z3cje8hk.js → chunk-6jp5qvp7.js} +1 -1
  7. package/dist/cli/{chunk-jx3zndsh.js → chunk-7gsa4e5v.js} +1 -1
  8. package/dist/cli/{chunk-a2rxzyy4.js → chunk-7pkman2r.js} +1 -1
  9. package/dist/cli/{chunk-0mdzphdz.js → chunk-883sxh54.js} +1 -1
  10. package/dist/cli/{chunk-ep7abg35.js → chunk-88fm48j7.js} +1 -1
  11. package/dist/cli/{chunk-j0s13v56.js → chunk-9g3ykmk1.js} +1 -1
  12. package/dist/cli/{chunk-cqazrkzw.js → chunk-ap8hnhp8.js} +1 -1
  13. package/dist/cli/{chunk-hwckecfa.js → chunk-b8pbxxd7.js} +1 -1
  14. package/dist/cli/{chunk-fads90r0.js → chunk-bhfxqwkr.js} +1 -1
  15. package/dist/cli/{chunk-gfsgk1n8.js → chunk-cpg3xatp.js} +1 -1
  16. package/dist/cli/{chunk-0rfkgmns.js → chunk-d32fc64g.js} +1 -1
  17. package/dist/cli/{chunk-tzhfek18.js → chunk-dkxg9ykw.js} +1 -1
  18. package/dist/cli/{chunk-b3nrywgm.js → chunk-f09xb6kf.js} +1 -1
  19. package/dist/cli/{chunk-ehssspvr.js → chunk-f6sp14yz.js} +1 -1
  20. package/dist/cli/{chunk-mp535p99.js → chunk-ffkvvwyw.js} +1 -1
  21. package/dist/cli/{chunk-bz3p5vp1.js → chunk-fvqhz4jc.js} +1 -1
  22. package/dist/cli/{chunk-wth84cjn.js → chunk-g6mapq3w.js} +1 -1
  23. package/dist/cli/{chunk-7vassnhs.js → chunk-g6wqzvar.js} +2 -2
  24. package/dist/cli/{chunk-kzcd7vdj.js → chunk-j7x4f13g.js} +1 -1
  25. package/dist/cli/{chunk-0x3vfkz9.js → chunk-jqj587mq.js} +1 -1
  26. package/dist/cli/{chunk-11vgtrm4.js → chunk-jra5dpw9.js} +1 -1
  27. package/dist/cli/{chunk-kmfas00z.js → chunk-k54r9610.js} +1 -1
  28. package/dist/cli/{chunk-29ftjs96.js → chunk-kgwe9fe5.js} +1 -1
  29. package/dist/cli/{chunk-pgaf0wqj.js → chunk-khgzase0.js} +1 -1
  30. package/dist/cli/{chunk-gf37e6ty.js → chunk-mmbzs7k5.js} +1 -1
  31. package/dist/cli/{chunk-451z1265.js → chunk-mrvb0vtm.js} +1 -1
  32. package/dist/cli/{chunk-bsprr76b.js → chunk-nzzj0b9g.js} +1 -1
  33. package/dist/cli/{chunk-v29v0cgd.js → chunk-p880k6a0.js} +1 -1
  34. package/dist/cli/{chunk-3kraw5fh.js → chunk-pm71xktm.js} +1 -1
  35. package/dist/cli/{chunk-zgmnse5q.js → chunk-q6k7mpmp.js} +1 -1
  36. package/dist/cli/{chunk-w3dpq6aj.js → chunk-q6t3y24h.js} +2 -2
  37. package/dist/cli/{chunk-vg3tyctk.js → chunk-qvbr5xec.js} +1 -1
  38. package/dist/cli/{chunk-k1pk159f.js → chunk-qxh4hj9t.js} +1 -1
  39. package/dist/cli/{chunk-6qp32yje.js → chunk-r7gjh0kr.js} +1 -1
  40. package/dist/cli/{chunk-cjzyc7cn.js → chunk-snp86g9s.js} +1 -1
  41. package/dist/cli/chunk-v8bdmbb9.js +3 -0
  42. package/dist/cli/{chunk-3yd8nyv6.js → chunk-vcj1rd8h.js} +1 -1
  43. package/dist/cli/{chunk-j6g8jmke.js → chunk-vv3e8ceh.js} +2 -2
  44. package/dist/cli/{chunk-ymmzwv5w.js → chunk-vym8dky3.js} +1 -1
  45. package/dist/cli/{chunk-8akyzrjc.js → chunk-w93a23cv.js} +1 -1
  46. package/dist/cli/{chunk-ene2k7kb.js → chunk-wzrw4tas.js} +1 -1
  47. package/dist/cli/{chunk-z6k53zqj.js → chunk-xtxca7d8.js} +1 -1
  48. package/dist/cli/{chunk-etj5h8hg.js → chunk-yfckah6a.js} +1 -1
  49. package/dist/cli/{chunk-jpa26n83.js → chunk-ypfvxnwf.js} +1 -1
  50. package/dist/cli/index.js +2 -2
  51. package/dist/cli/rove.js +1 -1
  52. package/dist/web/assets/{index-D7OcIn1Q.js → index-B_nBSzPe.js} +44 -44
  53. package/dist/web/assets/index-DmblaqlN.css +1 -0
  54. package/dist/web/assets/{term-mount-CSGanVNa.js → term-mount-blMr0MC-.js} +1 -1
  55. package/dist/web/index.html +2 -2
  56. package/dist/web/relay/index.html +2 -2
  57. package/dist/web/relay-client/assets/{index-B307rVpU.js → index-DV5nLhAz.js} +41 -41
  58. package/dist/web/relay-client/assets/index-Dno3gMd0.css +1 -0
  59. package/dist/web/relay-client/index.html +2 -2
  60. package/package.json +1 -1
  61. package/dist/cli/chunk-aterhn60.js +0 -3
  62. package/dist/web/assets/index-BWayUsdy.css +0 -1
  63. package/dist/web/relay-client/assets/index-T6nIyGrP.css +0 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/term-mount-CSGanVNa.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-blMr0MC-.js","assets/rolldown-runtime-hePW80VL.js","assets/term-mount-BrP-ENHg.css"])))=>i.map(i=>d[i]);
2
2
  import{n as e,r as t,t as n}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 r=`rove.bridge.token`;if(typeof window<`u`){let e=new URLSearchParams(window.location.hash.slice(1)).get(`token`);e&&(localStorage.setItem(r,e),history.replaceState(null,``,window.location.pathname+window.location.search))}function i(){return localStorage.getItem(r)}function a(e){localStorage.setItem(r,e)}function o(){localStorage.removeItem(r)}var s=n((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 ee(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function te(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,te(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),te(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+j(a,u),c+=te(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+j(a,u++),c+=te(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return te(ee(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function M(e,t,n){if(e==null)return e;var r=[],i=0;return te(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function ne(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 N=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)},P={map:M,forEach:function(e,t,n){M(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return M(e,function(){t++}),t},toArray:function(e){return M(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=P,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:ne}},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,N)}catch(e){N(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.8`})),c=n(((e,t)=>{t.exports=s()})),l=n((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),u=n(((e,t)=>{t.exports=l()})),d=n((e=>{var t=c();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=l(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=l(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)}},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.8`})),f=n(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=d()})),p=n((e=>{var t=u(),n=c(),r=f();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function d(e){if(o(e)!==e)throw Error(i(188))}function p(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return d(a),e;if(s===r)return d(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,l=a.child;l;){if(l===n){c=!0,n=a,r=s;break}if(l===r){c=!0,r=a,n=s;break}l=l.sibling}if(!c){for(l=s.child;l;){if(l===n){c=!0,n=s,r=a;break}if(l===r){c=!0,r=s,n=a;break}l=l.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function m(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=m(e),t!==null)return t;e=e.sibling}return null}var h=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),w=Symbol.for(`react.forward_ref`),T=Symbol.for(`react.suspense`),E=Symbol.for(`react.suspense_list`),D=Symbol.for(`react.memo`),O=Symbol.for(`react.lazy`),k=Symbol.for(`react.activity`),A=Symbol.for(`react.memo_cache_sentinel`),j=Symbol.iterator;function ee(e){return typeof e!=`object`||!e?null:(e=j&&e[j]||e[`@@iterator`],typeof e==`function`?e:null)}var te=Symbol.for(`react.client.reference`);function M(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===te?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case T:return`Suspense`;case E:return`SuspenseList`;case k:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case w:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case D:return t=e.displayName||null,t===null?M(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return M(e(t))}catch{}}return null}var ne=Array.isArray,N=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,re={pending:!1,data:null,method:null,action:null},ie=[],F=-1;function I(e){return{current:e}}function ae(e){0>F||(e.current=ie[F],ie[F]=null,F--)}function L(e,t){F++,ie[F]=e.current,e.current=t}var R=I(null),oe=I(null),se=I(null),ce=I(null);function z(e,t){switch(L(se,t),L(oe,e),L(R,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Wd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Wd(t),e=Gd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}ae(R),L(R,e)}function le(){ae(R),ae(oe),ae(se)}function ue(e){e.memoizedState!==null&&L(ce,e);var t=R.current,n=Gd(t,e.type);t!==n&&(L(oe,e),L(R,n))}function B(e){oe.current===e&&(ae(R),ae(oe)),ce.current===e&&(ae(ce),tp._currentValue=re)}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(`
@@ -7,7 +7,7 @@ import{n as e,r as t,t as n}from"./rolldown-runtime-hePW80VL.js";(function(){let
7
7
  `+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{me=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?pe(n):``}function ge(e,t){switch(e.tag){case 26:case 27:case 5:return pe(e.type);case 16:return pe(`Lazy`);case 13:return e.child!==t&&t!==null?pe(`Suspense Fallback`):pe(`Suspense`);case 19:return pe(`SuspenseList`);case 0:case 15:return he(e.type,!1);case 11:return he(e.type.render,!1);case 1:return he(e.type,!0);case 31:return pe(`Activity`);default:return``}}function _e(e){try{var t=``,n=null;do t+=ge(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
8
8
  Error generating stack: `+e.message+`
9
9
  `+e.stack}}var ve=Object.prototype.hasOwnProperty,ye=t.unstable_scheduleCallback,be=t.unstable_cancelCallback,xe=t.unstable_shouldYield,Se=t.unstable_requestPaint,Ce=t.unstable_now,we=t.unstable_getCurrentPriorityLevel,Te=t.unstable_ImmediatePriority,Ee=t.unstable_UserBlockingPriority,De=t.unstable_NormalPriority,Oe=t.unstable_LowPriority,ke=t.unstable_IdlePriority,Ae=t.log,je=t.unstable_setDisableYieldValue,Me=null,Ne=null;function Pe(e){if(typeof Ae==`function`&&je(e),Ne&&typeof Ne.setStrictMode==`function`)try{Ne.setStrictMode(Me,e)}catch{}}var Fe=Math.clz32?Math.clz32:Re,Ie=Math.log,Le=Math.LN2;function Re(e){return e>>>=0,e===0?32:31-(Ie(e)/Le|0)|0}var ze=256,Be=262144,Ve=4194304;function He(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ue(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=He(n))):i=He(o):i=He(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=He(n))):i=He(o)):i=He(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function We(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ge(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ke(){var e=Ve;return Ve<<=1,!(Ve&62914560)&&(Ve=4194304),e}function qe(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Je(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ye(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-Fe(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&Xe(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Xe(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Fe(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function Ze(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Fe(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function Qe(e,t){var n=t&-t;return n=n&42?1:$e(n),(n&(e.suspendedLanes|t))===0?n:0}function $e(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function et(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function tt(){var e=P.p;return e===0?(e=window.event,e===void 0?32:_p(e.type)):e}function nt(e,t){var n=P.p;try{return P.p=e,t()}finally{P.p=n}}var rt=Math.random().toString(36).slice(2),it=`__reactFiber$`+rt,at=`__reactProps$`+rt,ot=`__reactContainer$`+rt,st=`__reactEvents$`+rt,ct=`__reactListeners$`+rt,lt=`__reactHandles$`+rt,ut=`__reactResources$`+rt,dt=`__reactMarker$`+rt;function ft(e){delete e[it],delete e[at],delete e[st],delete e[ct],delete e[lt]}function pt(e){var t=e[it];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ot]||n[it]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=mf(e);e!==null;){if(n=e[it])return n;e=mf(e)}return t}e=n,n=e.parentNode}return null}function mt(e){if(e=e[it]||e[ot]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function ht(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function gt(e){var t=e[ut];return t||=e[ut]={hoistableStyles:new Map,hoistableScripts:new Map},t}function _t(e){e[dt]=!0}var vt=new Set,yt={};function bt(e,t){xt(e,t),xt(e+`Capture`,t)}function xt(e,t){for(yt[e]=t,e=0;e<t.length;e++)vt.add(t[e])}var St=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),Ct={},wt={};function Tt(e){return ve.call(wt,e)?!0:ve.call(Ct,e)?!1:St.test(e)?wt[e]=!0:(Ct[e]=!0,!1)}function Et(e,t,n){if(Tt(t)){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}}function Dt(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function Ot(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function kt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function At(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function jt(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Mt(e){if(!e._valueTracker){var t=At(e)?`checked`:`value`;e._valueTracker=jt(e,t,``+e[t])}}function Nt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=At(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function Pt(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var Ft=/[\n"\\]/g;function It(e){return e.replace(Ft,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Lt(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+kt(t)):e.value!==``+kt(t)&&(e.value=``+kt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):zt(e,o,kt(n)):zt(e,o,kt(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+kt(s):e.removeAttribute(`name`)}function Rt(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){Mt(e);return}n=n==null?``:``+kt(n),t=t==null?n:``+kt(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),Mt(e)}function zt(e,t,n){t===`number`&&Pt(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Bt(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+kt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Vt(e,t,n){if(t!=null&&(t=``+kt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+kt(n)}function Ht(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(ne(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=kt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Mt(e)}function Ut(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var V=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function Wt(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||V.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function H(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&Wt(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&Wt(e,o,t[o])}function Gt(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var Kt=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),qt=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Jt(e){return qt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function Yt(){}var Xt=null;function Zt(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Qt=null,$t=null;function en(e){var t=mt(e);if(t&&(e=t.stateNode)){var n=e[at]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Lt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+It(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[at]||null;if(!a)throw Error(i(90));Lt(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Nt(r)}break a;case`textarea`:Vt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Bt(e,!!n.multiple,t,!1)}}}var tn=!1;function nn(e,t,n){if(tn)return e(t,n);tn=!0;try{return e(t)}finally{if(tn=!1,(Qt!==null||$t!==null)&&(bu(),Qt&&(t=Qt,e=$t,$t=Qt=null,en(t),e)))for(t=0;t<e.length;t++)en(e[t])}}function rn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[at]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var an=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),on=!1;if(an)try{var sn={};Object.defineProperty(sn,"passive",{get:function(){on=!0}}),window.addEventListener(`test`,sn,sn),window.removeEventListener(`test`,sn,sn)}catch{on=!1}var cn=null,ln=null,un=null;function dn(){if(un)return un;var e,t=ln,n=t.length,r,i=`value`in cn?cn.value:cn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return un=i.slice(e,1<r?1-r:void 0)}function fn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function pn(){return!0}function mn(){return!1}function hn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?pn:mn,this.isPropagationStopped=mn,this}return h(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=pn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=pn)},persist:function(){},isPersistent:pn}),t}var gn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},_n=hn(gn),vn=h({},gn,{view:0,detail:0}),yn=hn(vn),bn,xn,Sn,Cn=h({},vn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Pn,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==Sn&&(Sn&&e.type===`mousemove`?(bn=e.screenX-Sn.screenX,xn=e.screenY-Sn.screenY):xn=bn=0,Sn=e),bn)},movementY:function(e){return`movementY`in e?e.movementY:xn}}),wn=hn(Cn),Tn=hn(h({},Cn,{dataTransfer:0})),En=hn(h({},vn,{relatedTarget:0})),Dn=hn(h({},gn,{animationName:0,elapsedTime:0,pseudoElement:0})),On=hn(h({},gn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),kn=hn(h({},gn,{data:0})),An={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},jn={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},Mn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Nn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Mn[e])?!!t[e]:!1}function Pn(){return Nn}var Fn=hn(h({},vn,{key:function(e){if(e.key){var t=An[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=fn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?jn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Pn,charCode:function(e){return e.type===`keypress`?fn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?fn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),In=hn(h({},Cn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Ln=hn(h({},vn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Pn})),Rn=hn(h({},gn,{propertyName:0,elapsedTime:0,pseudoElement:0})),zn=hn(h({},Cn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),Bn=hn(h({},gn,{newState:0,oldState:0})),Vn=[9,13,27,32],Hn=an&&`CompositionEvent`in window,Un=null;an&&`documentMode`in document&&(Un=document.documentMode);var Wn=an&&`TextEvent`in window&&!Un,Gn=an&&(!Hn||Un&&8<Un&&11>=Un),Kn=` `,qn=!1;function Jn(e,t){switch(e){case`keyup`:return Vn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Yn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Xn=!1;function Zn(e,t){switch(e){case`compositionend`:return Yn(t);case`keypress`:return t.which===32?(qn=!0,Kn):null;case`textInput`:return e=t.data,e===Kn&&qn?null:e;default:return null}}function Qn(e,t){if(Xn)return e===`compositionend`||!Hn&&Jn(e,t)?(e=dn(),un=ln=cn=null,Xn=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return Gn&&t.locale!==`ko`?null:t.data;default:return null}}var $n={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function er(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!$n[e.type]:t===`textarea`}function tr(e,t,n,r){Qt?$t?$t.push(r):$t=[r]:Qt=r,t=Od(t,`onChange`),0<t.length&&(n=new _n(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var nr=null,rr=null;function ir(e){bd(e,0)}function ar(e){if(Nt(ht(e)))return e}function or(e,t){if(e===`change`)return t}var sr=!1;if(an){var cr;if(an){var lr=`oninput`in document;if(!lr){var ur=document.createElement(`div`);ur.setAttribute(`oninput`,`return;`),lr=typeof ur.oninput==`function`}cr=lr}else cr=!1;sr=cr&&(!document.documentMode||9<document.documentMode)}function dr(){nr&&(nr.detachEvent(`onpropertychange`,fr),rr=nr=null)}function fr(e){if(e.propertyName===`value`&&ar(rr)){var t=[];tr(t,rr,e,Zt(e)),nn(ir,t)}}function pr(e,t,n){e===`focusin`?(dr(),nr=t,rr=n,nr.attachEvent(`onpropertychange`,fr)):e===`focusout`&&dr()}function mr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return ar(rr)}function hr(e,t){if(e===`click`)return ar(t)}function gr(e,t){if(e===`input`||e===`change`)return ar(t)}function _r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var vr=typeof Object.is==`function`?Object.is:_r;function yr(e,t){if(vr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!ve.call(t,i)||!vr(e[i],t[i]))return!1}return!0}function br(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function xr(e,t){var n=br(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=br(n)}}function Sr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Sr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Cr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Pt(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Pt(e.document)}return t}function wr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Tr=an&&`documentMode`in document&&11>=document.documentMode,Er=null,Dr=null,Or=null,kr=!1;function Ar(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;kr||Er==null||Er!==Pt(r)||(r=Er,`selectionStart`in r&&wr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Or&&yr(Or,r)||(Or=r,r=Od(Dr,`onSelect`),0<r.length&&(t=new _n(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Er)))}function jr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Mr={animationend:jr(`Animation`,`AnimationEnd`),animationiteration:jr(`Animation`,`AnimationIteration`),animationstart:jr(`Animation`,`AnimationStart`),transitionrun:jr(`Transition`,`TransitionRun`),transitionstart:jr(`Transition`,`TransitionStart`),transitioncancel:jr(`Transition`,`TransitionCancel`),transitionend:jr(`Transition`,`TransitionEnd`)},Nr={},Pr={};an&&(Pr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Mr.animationend.animation,delete Mr.animationiteration.animation,delete Mr.animationstart.animation),`TransitionEvent`in window||delete Mr.transitionend.transition);function Fr(e){if(Nr[e])return Nr[e];if(!Mr[e])return e;var t=Mr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Pr)return Nr[e]=t[n];return e}var U=Fr(`animationend`),Ir=Fr(`animationiteration`),Lr=Fr(`animationstart`),Rr=Fr(`transitionrun`),zr=Fr(`transitionstart`),Br=Fr(`transitioncancel`),W=Fr(`transitionend`),Vr=new Map,Hr=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);Hr.push(`scrollEnd`);function Ur(e,t){Vr.set(e,t),bt(t,[e])}var Wr=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)},Gr=[],Kr=0,qr=0;function Jr(){for(var e=Kr,t=qr=Kr=0;t<e;){var n=Gr[t];Gr[t++]=null;var r=Gr[t];Gr[t++]=null;var i=Gr[t];Gr[t++]=null;var a=Gr[t];if(Gr[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&Qr(n,i,a)}}function Yr(e,t,n,r){Gr[Kr++]=e,Gr[Kr++]=t,Gr[Kr++]=n,Gr[Kr++]=r,qr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Xr(e,t,n,r){return Yr(e,t,n,r),$r(e)}function Zr(e,t){return Yr(e,null,null,t),$r(e)}function Qr(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-Fe(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function $r(e){if(50<du)throw du=0,fu=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var ei={};function ti(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ni(e,t,n,r){return new ti(e,t,n,r)}function ri(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ii(e,t){var n=e.alternate;return n===null?(n=ni(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function ai(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function oi(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)ri(e)&&(s=1);else if(typeof e==`string`)s=Kf(e,n,R.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case k:return e=ni(31,n,t,a),e.elementType=k,e.lanes=o,e;case y:return si(n.children,a,o,t);case b:s=8,a|=24;break;case x:return e=ni(12,n,t,a|2),e.elementType=x,e.lanes=o,e;case T:return e=ni(13,n,t,a),e.elementType=T,e.lanes=o,e;case E:return e=ni(19,n,t,a),e.elementType=E,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case C:s=10;break a;case S:s=9;break a;case w:s=11;break a;case D:s=14;break a;case O:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=ni(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function si(e,t,n,r){return e=ni(7,e,r,t),e.lanes=n,e}function ci(e,t,n){return e=ni(6,e,null,t),e.lanes=n,e}function li(e){var t=ni(18,null,null,0);return t.stateNode=e,t}function ui(e,t,n){return t=ni(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var di=new WeakMap;function fi(e,t){if(typeof e==`object`&&e){var n=di.get(e);return n===void 0?(t={value:e,source:t,stack:_e(t)},di.set(e,t),t):n}return{value:e,source:t,stack:_e(t)}}var pi=[],mi=0,hi=null,gi=0,_i=[],vi=0,yi=null,bi=1,xi=``;function Si(e,t){pi[mi++]=gi,pi[mi++]=hi,hi=e,gi=t}function Ci(e,t,n){_i[vi++]=bi,_i[vi++]=xi,_i[vi++]=yi,yi=e;var r=bi;e=xi;var i=32-Fe(r)-1;r&=~(1<<i),n+=1;var a=32-Fe(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,bi=1<<32-Fe(t)+i|n<<i|r,xi=a+e}else bi=1<<a|n<<i|r,xi=e}function wi(e){e.return!==null&&(Si(e,1),Ci(e,1,0))}function Ti(e){for(;e===hi;)hi=pi[--mi],pi[mi]=null,gi=pi[--mi],pi[mi]=null;for(;e===yi;)yi=_i[--vi],_i[vi]=null,xi=_i[--vi],_i[vi]=null,bi=_i[--vi],_i[vi]=null}function Ei(e,t){_i[vi++]=bi,_i[vi++]=xi,_i[vi++]=yi,bi=t.id,xi=t.overflow,yi=e}var Di=null,Oi=null,ki=!1,Ai=null,ji=!1,Mi=Error(i(519));function Ni(e){throw zi(fi(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Mi}function Pi(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[it]=e,t[at]=r,n){case`dialog`:xd(`cancel`,t),xd(`close`,t);break;case`iframe`:case`object`:case`embed`:xd(`load`,t);break;case`video`:case`audio`:for(n=0;n<vd.length;n++)xd(vd[n],t);break;case`source`:xd(`error`,t);break;case`img`:case`image`:case`link`:xd(`error`,t),xd(`load`,t);break;case`details`:xd(`toggle`,t);break;case`input`:xd(`invalid`,t),Rt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:xd(`invalid`,t);break;case`textarea`:xd(`invalid`,t),Ht(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||Pd(t.textContent,n)?(r.popover!=null&&(xd(`beforetoggle`,t),xd(`toggle`,t)),r.onScroll!=null&&xd(`scroll`,t),r.onScrollEnd!=null&&xd(`scrollend`,t),r.onClick!=null&&(t.onclick=Yt),t=!0):t=!1,t||Ni(e,!0)}function Fi(e){for(Di=e.return;Di;)switch(Di.tag){case 5:case 31:case 13:ji=!1;return;case 27:case 3:ji=!0;return;default:Di=Di.return}}function Ii(e){if(e!==Di)return!1;if(!ki)return Fi(e),ki=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||Kd(e.type,e.memoizedProps)),n=!n),n&&Oi&&Ni(e),Fi(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Oi=pf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Oi=pf(e)}else t===27?(t=Oi,ef(e.type)?(e=ff,ff=null,Oi=e):Oi=t):Oi=Di?df(e.stateNode.nextSibling):null;return!0}function Li(){Oi=Di=null,ki=!1}function Ri(){var e=Ai;return e!==null&&(Zl===null?Zl=e:Zl.push.apply(Zl,e),Ai=null),e}function zi(e){Ai===null?Ai=[e]:Ai.push(e)}var Bi=I(null),Vi=null,Hi=null;function Ui(e,t,n){L(Bi,t._currentValue),t._currentValue=n}function Wi(e){e._currentValue=Bi.current,ae(Bi)}function Gi(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Ki(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),Gi(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),Gi(s,n,e),s=null}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function qi(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;vr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===ce.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[tp]:e.push(tp))}a=a.return}e!==null&&Ki(t,e,n,r),t.flags|=262144}function Ji(e){for(e=e.firstContext;e!==null;){if(!vr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Yi(e){Vi=e,Hi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Xi(e){return Qi(Vi,e)}function Zi(e,t){return Vi===null&&Yi(e),Qi(e,t)}function Qi(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Hi===null){if(e===null)throw Error(i(308));Hi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Hi=Hi.next=t;return n}var $i=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},ea=t.unstable_scheduleCallback,ta=t.unstable_NormalPriority,na={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ra(){return{controller:new $i,data:new Map,refCount:0}}function G(e){e.refCount--,e.refCount===0&&ea(ta,function(){e.controller.abort()})}var ia=null,aa=0,oa=0,sa=null;function ca(e,t){if(ia===null){var n=ia=[];aa=0,oa=fd(),sa={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return aa++,t.then(la,la),t}function la(){if(--aa===0&&ia!==null){sa!==null&&(sa.status=`fulfilled`);var e=ia;ia=null,oa=0,sa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function ua(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var da=N.S;N.S=function(e,t){eu=Ce(),typeof t==`object`&&t&&typeof t.then==`function`&&ca(e,t),da!==null&&da(e,t)};var fa=I(null);function pa(){var e=fa.current;return e===null?Ll.pooledCache:e}function ma(e,t){t===null?L(fa,fa.current):L(fa,t.pool)}function ha(){var e=pa();return e===null?null:{parent:na._currentValue,pool:e}}var ga=Error(i(460)),_a=Error(i(474)),va=Error(i(542)),ya={then:function(){}};function ba(e){return e=e.status,e===`fulfilled`||e===`rejected`}function xa(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Yt,Yt),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Ta(e),e;default:if(typeof t.status==`string`)t.then(Yt,Yt);else{if(e=Ll,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Ta(e),e}throw Ca=t,ga}}function Sa(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Ca=e,ga):e}}var Ca=null;function wa(){if(Ca===null)throw Error(i(459));var e=Ca;return Ca=null,e}function Ta(e){if(e===ga||e===va)throw Error(i(483))}var Ea=null,Da=0;function Oa(e){var t=Da;return Da+=1,Ea===null&&(Ea=[]),xa(Ea,e,t)}function ka(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Aa(e,t){throw t.$$typeof===g?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function ja(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=ii(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=ci(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===y?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===O&&Sa(i)===t.type)?(t=a(t,n.props),ka(t,n),t.return=e,t):(t=oi(n.type,n.key,n.props,null,e.mode,r),ka(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=ui(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=si(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=ci(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case _:return n=oi(t.type,t.key,t.props,null,e.mode,n),ka(n,t),n.return=e,n;case v:return t=ui(t,e.mode,n),t.return=e,t;case O:return t=Sa(t),f(e,t,n)}if(ne(t)||ee(t))return t=si(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Oa(t),n);if(t.$$typeof===C)return f(e,Zi(e,t),n);Aa(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case _:return n.key===i?l(e,t,n,r):null;case v:return n.key===i?u(e,t,n,r):null;case O:return n=Sa(n),p(e,t,n,r)}if(ne(n)||ee(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Oa(n),r);if(n.$$typeof===C)return p(e,t,Zi(e,n),r);Aa(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case _:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case v:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case O:return r=Sa(r),m(e,t,n,r,i)}if(ne(r)||ee(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,Oa(r),i);if(r.$$typeof===C)return m(e,t,n,Zi(t,r),i);Aa(t,r)}return null}function h(i,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),ki&&Si(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return ki&&Si(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),ki&&Si(i,h),l}function g(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),ki&&Si(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return ki&&Si(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),ki&&Si(a,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===y&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case _:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===y){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===O&&Sa(l)===r.type){n(e,r.sibling),c=a(r,o.props),ka(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===y?(c=si(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=oi(o.type,o.key,o.props,null,e.mode,c),ka(c,o),c.return=e,e=c)}return s(e);case v:a:{for(l=o.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=ui(o,e.mode,c),c.return=e,e=c}return s(e);case O:return o=Sa(o),b(e,r,o,c)}if(ne(o))return h(e,r,o,c);if(ee(o)){if(l=ee(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,Oa(o),c);if(o.$$typeof===C)return b(e,r,Zi(e,o),c);Aa(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=ci(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Da=0;var i=b(e,t,n,r);return Ea=null,i}catch(t){if(t===ga||t===va)throw t;var a=ni(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Ma=ja(!0),Na=ja(!1),Pa=!1;function Fa(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ia(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function La(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ra(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Il&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=$r(e),Qr(e,null,n),t}return Yr(e,r,t,n),$r(e)}function za(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ze(e,n)}}function Ba(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var K=!1;function Va(){if(K){var e=sa;if(e!==null)throw e}}function Ha(e,t,n,r){K=!1;var i=e.updateQueue;Pa=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(X&f)===f:(r&f)===f){f!==0&&f===oa&&(K=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(m=g.payload,typeof m==`function`){d=m.call(_,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,f=typeof m==`function`?m.call(_,d,f):m,f==null)break a;d=h({},d,f);break a;case 2:Pa=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Gl|=o,e.lanes=o,e.memoizedState=d}}function Ua(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Wa(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Ua(n[e],t)}var Ga=I(null),Ka=I(0);function qa(e,t){e=Ul,L(Ka,e),L(Ga,t),Ul=e|t.baseLanes}function Ja(){L(Ka,Ul),L(Ga,Ga.current)}function Ya(){Ul=Ka.current,ae(Ga),ae(Ka)}var Xa=I(null),Za=null;function Qa(e){var t=e.alternate;L(ro,ro.current&1),L(Xa,e),Za===null&&(t===null||Ga.current!==null||t.memoizedState!==null)&&(Za=e)}function $a(e){L(ro,ro.current),L(Xa,e),Za===null&&(Za=e)}function eo(e){e.tag===22?(L(ro,ro.current),L(Xa,e),Za===null&&(Za=e)):to(e)}function to(){L(ro,ro.current),L(Xa,Xa.current)}function no(e){ae(Xa),Za===e&&(Za=null),ae(ro)}var ro=I(0);function io(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||cf(n)||lf(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ao=0,q=null,oo=null,so=null,co=!1,lo=!1,uo=!1,fo=0,po=0,mo=null,ho=0;function go(){throw Error(i(321))}function _o(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!vr(e[n],t[n]))return!1;return!0}function vo(e,t,n,r,i,a){return ao=a,q=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,N.H=e===null||e.memoizedState===null?Ps:Fs,uo=!1,a=n(r,i),uo=!1,lo&&(a=bo(t,n,r,i)),yo(e),a}function yo(e){N.H=Ns;var t=oo!==null&&oo.next!==null;if(ao=0,so=oo=q=null,co=!1,po=0,mo=null,t)throw Error(i(300));e===null||Qs||(e=e.dependencies,e!==null&&Ji(e)&&(Qs=!0))}function bo(e,t,n,r){q=e;var a=0;do{if(lo&&(mo=null),po=0,lo=!1,25<=a)throw Error(i(301));if(a+=1,so=oo=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}N.H=Is,o=t(n,r)}while(lo);return o}function xo(){var e=N.H,t=e.useState()[0];return t=typeof t.then==`function`?Oo(t):t,e=e.useState()[0],(oo===null?null:oo.memoizedState)!==e&&(q.flags|=1024),t}function So(){var e=fo!==0;return fo=0,e}function Co(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function wo(e){if(co){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}co=!1}ao=0,so=oo=q=null,lo=!1,po=fo=0,mo=null}function To(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return so===null?q.memoizedState=so=e:so=so.next=e,so}function Eo(){if(oo===null){var e=q.alternate;e=e===null?null:e.memoizedState}else e=oo.next;var t=so===null?q.memoizedState:so.next;if(t!==null)so=t,oo=e;else{if(e===null)throw q.alternate===null?Error(i(467)):Error(i(310));oo=e,e={memoizedState:oo.memoizedState,baseState:oo.baseState,baseQueue:oo.baseQueue,queue:oo.queue,next:null},so===null?q.memoizedState=so=e:so=so.next=e}return so}function Do(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Oo(e){var t=po;return po+=1,mo===null&&(mo=[]),e=xa(mo,e,t),t=q,(so===null?t.memoizedState:so.next)===null&&(t=t.alternate,N.H=t===null||t.memoizedState===null?Ps:Fs),e}function ko(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Oo(e);if(e.$$typeof===C)return Xi(e)}throw Error(i(438,String(e)))}function Ao(e){var t=null,n=q.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=q.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=Do(),q.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=A;return t.index++,n}function jo(e,t){return typeof t==`function`?t(e):t}function Mo(e){return No(Eo(),oo,e)}function No(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(ao&f)===f:(X&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===oa&&(d=!0);else if((ao&p)===p){u=u.next,p===oa&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,q.lanes|=p,Gl|=p;f=u.action,uo&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,q.lanes|=f,Gl|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!vr(o,e.memoizedState)&&(Qs=!0,d&&(n=sa,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Po(e){var t=Eo(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);vr(o,t.memoizedState)||(Qs=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Fo(e,t,n){var r=q,a=Eo(),o=ki;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!vr((oo||a).memoizedState,n);if(s&&(a.memoizedState=n,Qs=!0),a=a.queue,J(Ro.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||so!==null&&so.memoizedState.tag&1){if(r.flags|=2048,ts(9,{destroy:void 0},Lo.bind(null,r,a,n,t),null),Ll===null)throw Error(i(349));o||ao&127||Io(r,t,n)}return n}function Io(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=q.updateQueue,t===null?(t=Do(),q.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Lo(e,t,n,r){t.value=n,t.getSnapshot=r,zo(t)&&Bo(e)}function Ro(e,t,n){return n(function(){zo(t)&&Bo(e)})}function zo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!vr(e,n)}catch{return!0}}function Bo(e){var t=Zr(e,2);t!==null&&hu(t,e,2)}function Vo(e){var t=To();if(typeof e==`function`){var n=e;if(e=n(),uo){Pe(!0);try{n()}finally{Pe(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:jo,lastRenderedState:e},t}function Ho(e,t,n,r){return e.baseState=n,No(e,oo,typeof r==`function`?r:jo)}function Uo(e,t,n,r,a){if(As(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};N.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Wo(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Wo(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=N.T,o={};N.T=o;try{var s=n(i,r),c=N.S;c!==null&&c(o,s),Go(e,t,s)}catch(n){qo(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),N.T=a}}else try{a=n(i,r),Go(e,t,a)}catch(n){qo(e,t,n)}}function Go(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Ko(e,t,n)},function(n){return qo(e,t,n)}):Ko(e,t,n)}function Ko(e,t,n){t.status=`fulfilled`,t.value=n,Jo(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Wo(e,n)))}function qo(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Jo(t),t=t.next;while(t!==r)}e.action=null}function Jo(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Yo(e,t){return t}function Xo(e,t){if(ki){var n=Ll.formState;if(n!==null){a:{var r=q;if(ki){if(Oi){b:{for(var i=Oi,a=ji;i.nodeType!==8;){if(!a){i=null;break b}if(i=df(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Oi=df(i.nextSibling),r=i.data===`F!`;break a}}Ni(r)}r=!1}r&&(t=n[0])}}return n=To(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Yo,lastRenderedState:t},n.queue=r,n=Ds.bind(null,q,r),r.dispatch=n,r=Vo(!1),a=ks.bind(null,q,!1,r.queue),r=To(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Uo.bind(null,q,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Zo(e){return Qo(Eo(),oo,e)}function Qo(e,t,n){if(t=No(e,t,Yo)[0],e=Mo(jo)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=Oo(t)}catch(e){throw e===ga?va:e}else r=t;t=Eo();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(q.flags|=2048,ts(9,{destroy:void 0},$o.bind(null,i,n),null)),[r,a,e]}function $o(e,t){e.action=t}function es(e){var t=Eo(),n=oo;if(n!==null)return Qo(t,n,e);Eo(),t=t.memoizedState,n=Eo();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function ts(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=q.updateQueue,t===null&&(t=Do(),q.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function ns(){return Eo().memoizedState}function rs(e,t,n,r){var i=To();q.flags|=e,i.memoizedState=ts(1|t,{destroy:void 0},n,r===void 0?null:r)}function is(e,t,n,r){var i=Eo();r=r===void 0?null:r;var a=i.memoizedState.inst;oo!==null&&r!==null&&_o(r,oo.memoizedState.deps)?i.memoizedState=ts(t,a,n,r):(q.flags|=e,i.memoizedState=ts(1|t,a,n,r))}function as(e,t){rs(8390656,8,e,t)}function J(e,t){is(2048,8,e,t)}function os(e){q.flags|=4;var t=q.updateQueue;if(t===null)t=Do(),q.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function ss(e){var t=Eo().memoizedState;return os({ref:t,nextImpl:e}),function(){if(Il&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function cs(e,t){return is(4,2,e,t)}function ls(e,t){return is(4,4,e,t)}function us(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function ds(e,t,n){n=n==null?null:n.concat([e]),is(4,4,us.bind(null,t,e),n)}function fs(){}function ps(e,t){var n=Eo();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&_o(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function ms(e,t){var n=Eo();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&_o(t,r[1]))return r[0];if(r=e(),uo){Pe(!0);try{e()}finally{Pe(!1)}}return n.memoizedState=[r,t],r}function hs(e,t,n){return n===void 0||ao&1073741824&&!(X&261930)?e.memoizedState=t:(e.memoizedState=n,e=mu(),q.lanes|=e,Gl|=e,n)}function gs(e,t,n,r){return vr(n,t)?n:Ga.current===null?!(ao&42)||ao&1073741824&&!(X&261930)?(Qs=!0,e.memoizedState=n):(e=mu(),q.lanes|=e,Gl|=e,t):(e=hs(e,n,r),vr(e,t)||(Qs=!0),e)}function _s(e,t,n,r,i){var a=P.p;P.p=a!==0&&8>a?a:8;var o=N.T,s={};N.T=s,ks(e,!1,t,n);try{var c=i(),l=N.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Os(e,t,ua(c,r),pu(e)):Os(e,t,r,pu(e))}catch(n){Os(e,t,{then:function(){},status:`rejected`,reason:n},pu())}finally{P.p=a,o!==null&&s.types!==null&&(o.types=s.types),N.T=o}}function vs(){}function ys(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=bs(e).queue;_s(e,a,t,re,n===null?vs:function(){return xs(e),n(r)})}function bs(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:re,baseState:re,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:jo,lastRenderedState:re},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:jo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function xs(e){var t=bs(e);t.next===null&&(t=e.alternate.memoizedState),Os(e,t.next.queue,{},pu())}function Ss(){return Xi(tp)}function Cs(){return Eo().memoizedState}function ws(){return Eo().memoizedState}function Ts(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=pu();e=La(n);var r=Ra(t,e,n);r!==null&&(hu(r,t,n),za(r,t,n)),t={cache:ra()},e.payload=t;return}t=t.return}}function Es(e,t,n){var r=pu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},As(e)?js(t,n):(n=Xr(e,t,n,r),n!==null&&(hu(n,e,r),Ms(n,t,r)))}function Ds(e,t,n){Os(e,t,n,pu())}function Os(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(As(e))js(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,vr(s,o))return Yr(e,t,i,0),Ll===null&&Jr(),!1}catch{}if(n=Xr(e,t,i,r),n!==null)return hu(n,e,r),Ms(n,t,r),!0}return!1}function ks(e,t,n,r){if(r={lane:2,revertLane:fd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},As(e)){if(t)throw Error(i(479))}else t=Xr(e,n,r,2),t!==null&&hu(t,e,2)}function As(e){var t=e.alternate;return e===q||t!==null&&t===q}function js(e,t){lo=co=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ms(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ze(e,n)}}var Ns={readContext:Xi,use:ko,useCallback:go,useContext:go,useEffect:go,useImperativeHandle:go,useLayoutEffect:go,useInsertionEffect:go,useMemo:go,useReducer:go,useRef:go,useState:go,useDebugValue:go,useDeferredValue:go,useTransition:go,useSyncExternalStore:go,useId:go,useHostTransitionStatus:go,useFormState:go,useActionState:go,useOptimistic:go,useMemoCache:go,useCacheRefresh:go};Ns.useEffectEvent=go;var Ps={readContext:Xi,use:ko,useCallback:function(e,t){return To().memoizedState=[e,t===void 0?null:t],e},useContext:Xi,useEffect:as,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),rs(4194308,4,us.bind(null,t,e),n)},useLayoutEffect:function(e,t){return rs(4194308,4,e,t)},useInsertionEffect:function(e,t){rs(4,2,e,t)},useMemo:function(e,t){var n=To();t=t===void 0?null:t;var r=e();if(uo){Pe(!0);try{e()}finally{Pe(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=To();if(n!==void 0){var i=n(t);if(uo){Pe(!0);try{n(t)}finally{Pe(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Es.bind(null,q,e),[r.memoizedState,e]},useRef:function(e){var t=To();return e={current:e},t.memoizedState=e},useState:function(e){e=Vo(e);var t=e.queue,n=Ds.bind(null,q,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:fs,useDeferredValue:function(e,t){return hs(To(),e,t)},useTransition:function(){var e=Vo(!1);return e=_s.bind(null,q,e.queue,!0,!1),To().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=q,a=To();if(ki){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Ll===null)throw Error(i(349));X&127||Io(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,as(Ro.bind(null,r,o,e),[e]),r.flags|=2048,ts(9,{destroy:void 0},Lo.bind(null,r,o,n,t),null),n},useId:function(){var e=To(),t=Ll.identifierPrefix;if(ki){var n=xi,r=bi;n=(r&~(1<<32-Fe(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=fo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=ho++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Ss,useFormState:Xo,useActionState:Xo,useOptimistic:function(e){var t=To();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=ks.bind(null,q,!0,n),n.dispatch=t,[e,t]},useMemoCache:Ao,useCacheRefresh:function(){return To().memoizedState=Ts.bind(null,q)},useEffectEvent:function(e){var t=To(),n={impl:e};return t.memoizedState=n,function(){if(Il&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Fs={readContext:Xi,use:ko,useCallback:ps,useContext:Xi,useEffect:J,useImperativeHandle:ds,useInsertionEffect:cs,useLayoutEffect:ls,useMemo:ms,useReducer:Mo,useRef:ns,useState:function(){return Mo(jo)},useDebugValue:fs,useDeferredValue:function(e,t){return gs(Eo(),oo.memoizedState,e,t)},useTransition:function(){var e=Mo(jo)[0],t=Eo().memoizedState;return[typeof e==`boolean`?e:Oo(e),t]},useSyncExternalStore:Fo,useId:Cs,useHostTransitionStatus:Ss,useFormState:Zo,useActionState:Zo,useOptimistic:function(e,t){return Ho(Eo(),oo,e,t)},useMemoCache:Ao,useCacheRefresh:ws};Fs.useEffectEvent=ss;var Is={readContext:Xi,use:ko,useCallback:ps,useContext:Xi,useEffect:J,useImperativeHandle:ds,useInsertionEffect:cs,useLayoutEffect:ls,useMemo:ms,useReducer:Po,useRef:ns,useState:function(){return Po(jo)},useDebugValue:fs,useDeferredValue:function(e,t){var n=Eo();return oo===null?hs(n,e,t):gs(n,oo.memoizedState,e,t)},useTransition:function(){var e=Po(jo)[0],t=Eo().memoizedState;return[typeof e==`boolean`?e:Oo(e),t]},useSyncExternalStore:Fo,useId:Cs,useHostTransitionStatus:Ss,useFormState:es,useActionState:es,useOptimistic:function(e,t){var n=Eo();return oo===null?(n.baseState=e,[e,n.queue.dispatch]):Ho(n,oo,e,t)},useMemoCache:Ao,useCacheRefresh:ws};Is.useEffectEvent=ss;function Ls(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:h({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Rs={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=pu(),i=La(r);i.payload=t,n!=null&&(i.callback=n),t=Ra(e,i,r),t!==null&&(hu(t,e,r),za(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=pu(),i=La(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Ra(e,i,r),t!==null&&(hu(t,e,r),za(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=pu(),r=La(n);r.tag=2,t!=null&&(r.callback=t),t=Ra(e,r,n),t!==null&&(hu(t,e,n),za(t,e,n))}};function zs(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!yr(n,r)||!yr(i,a):!0}function Bs(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Rs.enqueueReplaceState(t,t.state,null)}function Vs(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=h({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Hs(e){Wr(e)}function Us(e){console.error(e)}function Ws(e){Wr(e)}function Gs(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Ks(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function qs(e,t,n){return n=La(n),n.tag=3,n.payload={element:null},n.callback=function(){Gs(e,t)},n}function Js(e){return e=La(e),e.tag=3,e}function Ys(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Ks(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Ks(t,n,r),typeof i!=`function`&&(ru===null?ru=new Set([this]):ru.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Xs(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&qi(t,n,a,!0),n=Xa.current,n!==null){switch(n.tag){case 31:case 13:return Za===null?Du():n.alternate===null&&Wl===0&&(Wl=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===ya?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Ku(e,r,a)),!1;case 22:return n.flags|=65536,r===ya?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),Ku(e,r,a)),!1}throw Error(i(435,n.tag))}return Ku(e,r,a),Du(),!1}if(ki)return t=Xa.current,t===null?(r!==Mi&&(t=Error(i(423),{cause:r}),zi(fi(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=fi(r,n),a=qs(e.stateNode,r,a),Ba(e,a),Wl!==4&&(Wl=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==Mi&&(e=Error(i(422),{cause:r}),zi(fi(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=fi(o,n),Xl===null?Xl=[o]:Xl.push(o),Wl!==4&&(Wl=2),t===null)return!0;r=fi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=qs(n.stateNode,r,e),Ba(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(ru===null||!ru.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=Js(a),Ys(a,e,n,r),Ba(n,a),!1}n=n.return}while(n!==null);return!1}var Zs=Error(i(461)),Qs=!1;function $s(e,t,n,r){t.child=e===null?Na(t,null,n,r):Ma(t,e.child,n,r)}function ec(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return Yi(t),r=vo(e,t,n,o,a,i),s=So(),e!==null&&!Qs?(Co(e,t,i),wc(e,t,i)):(ki&&s&&wi(t),t.flags|=1,$s(e,t,r,i),t.child)}function tc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ri(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,nc(e,t,a,r,i)):(e=oi(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Tc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?yr:n,n(o,r)&&e.ref===t.ref)return wc(e,t,i)}return t.flags|=1,e=ii(a,r),e.ref=t.ref,e.return=t,t.child=e}function nc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(yr(a,r)&&e.ref===t.ref){if(Qs=!1,t.pendingProps=r=a,Tc(e,i))e.flags&131072&&(Qs=!0);else return t.lanes=e.lanes,wc(e,t,i)}}return uc(e,t,n,r,i)}function rc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return ac(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ma(t,a===null?null:a.cachePool),a===null?Ja():qa(t,a),eo(t);else return r=t.lanes=536870912,ac(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&ma(t,null),Ja(),to(t)):(ma(t,a.cachePool),qa(t,a),to(t),t.memoizedState=null);return $s(e,t,i,n),t.child}function ic(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function ac(e,t,n,r,i){var a=pa();return a=a===null?null:{parent:na._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&ma(t,null),Ja(),eo(t),e!==null&&qi(e,t,r,!0),t.childLanes=i,null}function oc(e,t){return t=yc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function sc(e,t,n){return Ma(t,e.child,null,n),e=oc(t,t.pendingProps),e.flags|=2,no(t),t.memoizedState=null,e}function cc(e,t,n){var r=t.pendingProps,a=!!(t.flags&128);if(t.flags&=-129,e===null){if(ki){if(r.mode===`hidden`)return e=oc(t,r),t.lanes=536870912,ic(null,e);if($a(t),(e=Oi)?(e=sf(e,ji),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:yi===null?null:{id:bi,overflow:xi},retryLane:536870912,hydrationErrors:null},n=li(e),n.return=t,t.child=n,Di=t,Oi=null)):e=null,e===null)throw Ni(t);return t.lanes=536870912,null}return oc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if($a(t),a){if(t.flags&256)t.flags&=-257,t=sc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558))}else if(Qs||qi(e,t,n,!1),a=(n&e.childLanes)!==0,Qs||a){if(r=Ll,r!==null&&(s=Qe(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,Zr(e,s),hu(r,e,s),Zs;Du(),t=sc(e,t,n)}else e=o.treeContext,Oi=df(s.nextSibling),Di=t,ki=!0,Ai=null,ji=!1,e!==null&&Ei(t,e),t=oc(t,r),t.flags|=4096;return t}return e=ii(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function lc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function uc(e,t,n,r,i){return Yi(t),n=vo(e,t,n,r,void 0,i),r=So(),e!==null&&!Qs?(Co(e,t,i),wc(e,t,i)):(ki&&r&&wi(t),t.flags|=1,$s(e,t,n,i),t.child)}function dc(e,t,n,r,i,a){return Yi(t),t.updateQueue=null,n=bo(t,r,n,i),yo(e),r=So(),e!==null&&!Qs?(Co(e,t,a),wc(e,t,a)):(ki&&r&&wi(t),t.flags|=1,$s(e,t,n,a),t.child)}function fc(e,t,n,r,i){if(Yi(t),t.stateNode===null){var a=ei,o=n.contextType;typeof o==`object`&&o&&(a=Xi(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Rs,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Fa(t),o=n.contextType,a.context=typeof o==`object`&&o?Xi(o):ei,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Ls(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Rs.enqueueReplaceState(a,a.state,null),Ha(t,r,a,i),Va(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Vs(n,s);a.props=c;var l=a.context,u=n.contextType;o=ei,typeof u==`object`&&u&&(o=Xi(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Bs(t,a,r,o),Pa=!1;var f=t.memoizedState;a.state=f,Ha(t,r,a,i),Va(),l=t.memoizedState,s||f!==l||Pa?(typeof d==`function`&&(Ls(t,n,d,r),l=t.memoizedState),(c=Pa||zs(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Ia(e,t),o=t.memoizedProps,u=Vs(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=ei,typeof l==`object`&&l&&(c=Xi(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Bs(t,a,r,c),Pa=!1,f=t.memoizedState,a.state=f,Ha(t,r,a,i),Va();var p=t.memoizedState;o!==d||f!==p||Pa||e!==null&&e.dependencies!==null&&Ji(e.dependencies)?(typeof s==`function`&&(Ls(t,n,s,r),p=t.memoizedState),(u=Pa||zs(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Ji(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,lc(e,t),r=!!(t.flags&128),a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=Ma(t,e.child,null,i),t.child=Ma(t,null,n,i)):$s(e,t,n,i),t.memoizedState=a.state,e=t.child):e=wc(e,t,i),e}function pc(e,t,n,r){return Li(),t.flags|=256,$s(e,t,n,r),t.child}var mc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function hc(e){return{baseLanes:e,cachePool:ha()}}function gc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=Jl),e}function _c(e,t,n){var r=t.pendingProps,a=!1,o=!!(t.flags&128),s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:!!(ro.current&2)),s&&(a=!0,t.flags&=-129),s=!!(t.flags&32),t.flags&=-33,e===null){if(ki){if(a?Qa(t):to(t),(e=Oi)?(e=sf(e,ji),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:yi===null?null:{id:bi,overflow:xi},retryLane:536870912,hydrationErrors:null},n=li(e),n.return=t,t.child=n,Di=t,Oi=null)):e=null,e===null)throw Ni(t);return lf(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(to(t),a=t.mode,c=yc({mode:`hidden`,children:c},a),r=si(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=hc(n),r.childLanes=gc(e,s,n),t.memoizedState=mc,ic(null,r)):(Qa(t),vc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(Qa(t),t.flags&=-257,t=bc(e,t,n)):t.memoizedState===null?(to(t),c=r.fallback,a=t.mode,r=yc({mode:`visible`,children:r.children},a),c=si(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,Ma(t,e.child,null,n),r=t.child,r.memoizedState=hc(n),r.childLanes=gc(e,s,n),t.memoizedState=mc,t=ic(null,r)):(to(t),t.child=e.child,t.flags|=128,t=null);else if(Qa(t),lf(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,zi({value:r,source:null,stack:null}),t=bc(e,t,n)}else if(Qs||qi(e,t,n,!1),s=(n&e.childLanes)!==0,Qs||s){if(s=Ll,s!==null&&(r=Qe(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,Zr(e,r),hu(s,e,r),Zs;cf(c)||Du(),t=bc(e,t,n)}else cf(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Oi=df(c.nextSibling),Di=t,ki=!0,Ai=null,ji=!1,e!==null&&Ei(t,e),t=vc(t,r.children),t.flags|=4096);return t}return a?(to(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=ii(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=si(c,a,n,null),c.flags|=2):c=ii(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,ic(null,r),r=t.child,c=e.child.memoizedState,c===null?c=hc(n):(a=c.cachePool,a===null?a=ha():(l=na._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=gc(e,s,n),t.memoizedState=mc,ic(e.child,r)):(Qa(t),n=e.child,e=n.sibling,n=ii(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function vc(e,t){return t=yc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function yc(e,t){return e=ni(22,e,null,t),e.lanes=0,e}function bc(e,t,n){return Ma(t,e.child,null,n),e=vc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function xc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Gi(e.return,t,n)}function Sc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function Cc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=ro.current,s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,L(ro,o),$s(e,t,r,n),r=ki?gi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&xc(e,n,t);else if(e.tag===19)xc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&io(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Sc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&io(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Sc(t,!0,n,null,a,r);break;case`together`:Sc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function wc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Gl|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(qi(e,t,n,!1),(n&t.childLanes)===0)return null}else return null}if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=ii(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ii(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Tc(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&Ji(e)))}function Ec(e,t,n){switch(t.tag){case 3:z(t,t.stateNode.containerInfo),Ui(t,na,e.memoizedState.cache),Li();break;case 27:case 5:ue(t);break;case 4:z(t,t.stateNode.containerInfo);break;case 10:Ui(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,$a(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(Qa(t),e=wc(e,t,n),e===null?null:e.sibling):_c(e,t,n):(Qa(t),t.flags|=128,null);Qa(t);break;case 19:var i=!!(e.flags&128);if(r=(n&t.childLanes)!==0,r||=(qi(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return Cc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),L(ro,ro.current),r)break;return null;case 22:return t.lanes=0,rc(e,t,n,t.pendingProps);case 24:Ui(t,na,e.memoizedState.cache)}return wc(e,t,n)}function Dc(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)Qs=!0;else{if(!Tc(e,n)&&!(t.flags&128))return Qs=!1,Ec(e,t,n);Qs=!!(e.flags&131072)}}else Qs=!1,ki&&t.flags&1048576&&Ci(t,gi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=Sa(t.elementType),t.type=e,typeof e==`function`)ri(e)?(r=Vs(e,r),t.tag=1,t=fc(null,t,e,r,n)):(t.tag=0,t=uc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===w){t.tag=11,t=ec(null,t,e,r,n);break a}if(a===D){t.tag=14,t=tc(null,t,e,r,n);break a}}throw t=M(e)||e,Error(i(306,t,``))}}return t;case 0:return uc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=Vs(r,t.pendingProps),fc(e,t,r,a,n);case 3:a:{if(z(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,Ia(e,t),Ha(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Ui(t,na,r),r!==o.cache&&Ki(t,[na],n,!0),Va(),r=s.element,o.isDehydrated){if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=pc(e,t,r,n);break a}if(r!==a){a=fi(Error(i(424)),t),zi(a),t=pc(e,t,r,n);break a}switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Oi=df(e.firstChild),Di=t,ki=!0,Ai=null,ji=!0,n=Na(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Li(),r===a){t=wc(e,t,n);break a}$s(e,t,r,n)}t=t.child}return t;case 26:return lc(e,t),e===null?(n=Mf(t.type,null,t.pendingProps,null))?t.memoizedState=n:ki||(n=t.type,e=t.pendingProps,r=Ud(se.current).createElement(n),r[it]=t,r[at]=e,Ld(r,n,e),_t(r),t.stateNode=r):t.memoizedState=Mf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ue(t),e===null&&ki&&(r=t.stateNode=hf(t.type,t.pendingProps,se.current),Di=t,ji=!0,a=Oi,ef(t.type)?(ff=a,Oi=df(r.firstChild)):Oi=a),$s(e,t,t.pendingProps.children,n),lc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&ki&&((a=r=Oi)&&(r=af(r,t.type,t.pendingProps,ji),r===null?a=!1:(t.stateNode=r,Di=t,Oi=df(r.firstChild),ji=!1,a=!0)),a||Ni(t)),ue(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,Kd(a,o)?r=null:s!==null&&Kd(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=vo(e,t,xo,null,null,n),tp._currentValue=a),lc(e,t),$s(e,t,r,n),t.child;case 6:return e===null&&ki&&((e=n=Oi)&&(n=of(n,t.pendingProps,ji),n===null?e=!1:(t.stateNode=n,Di=t,Oi=null,e=!0)),e||Ni(t)),null;case 13:return _c(e,t,n);case 4:return z(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ma(t,null,r,n):$s(e,t,r,n),t.child;case 11:return ec(e,t,t.type,t.pendingProps,n);case 7:return $s(e,t,t.pendingProps,n),t.child;case 8:return $s(e,t,t.pendingProps.children,n),t.child;case 12:return $s(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Ui(t,t.type,r.value),$s(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,Yi(t),a=Xi(a),r=r(a),t.flags|=1,$s(e,t,r,n),t.child;case 14:return tc(e,t,t.type,t.pendingProps,n);case 15:return nc(e,t,t.type,t.pendingProps,n);case 19:return Cc(e,t,n);case 31:return cc(e,t,n);case 22:return rc(e,t,n,t.pendingProps);case 24:return Yi(t),r=Xi(na),e===null?(a=pa(),a===null&&(a=Ll,o=ra(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},Fa(t),Ui(t,na,a)):((e.lanes&n)!==0&&(Ia(e,t),Ha(t,null,null,n),Va()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,Ui(t,na,r),r!==a.cache&&Ki(t,[na],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Ui(t,na,r))),$s(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function Oc(e){e.flags|=4}function kc(e,t,n,r,i){if((t=!!(e.mode&32))&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i){if(e.stateNode.complete)e.flags|=8192;else if(wu())e.flags|=8192;else throw Ca=ya,_a}}else e.flags&=-16777217}function Ac(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!qf(t)){if(wu())e.flags|=8192;else throw Ca=ya,_a}}function jc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:Ke(),e.lanes|=t,Yl|=t)}function Mc(e,t){if(!ki)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Nc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Pc(e,t,n){var r=t.pendingProps;switch(Ti(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Nc(t),null;case 1:return Nc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Wi(na),le(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Ii(t)?Oc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ri())),Nc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(Oc(t),o===null?(Nc(t),kc(t,a,null,r,n)):(Nc(t),Ac(t,o))):o?o===e.memoizedState?(Nc(t),t.flags&=-16777217):(Oc(t),Nc(t),Ac(t,o)):(e=e.memoizedProps,e!==r&&Oc(t),Nc(t),kc(t,a,e,r,n)),null;case 27:if(B(t),n=se.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Oc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Nc(t),null}e=R.current,Ii(t)?Pi(t,e):(e=hf(a,r,n),t.stateNode=e,Oc(t))}return Nc(t),null;case 5:if(B(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Oc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Nc(t),null}if(o=R.current,Ii(t))Pi(t,o);else{var s=Ud(se.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[it]=t,o[at]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Ld(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Oc(t)}}return Nc(t),kc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Oc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=se.current,Ii(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Di,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[it]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Pd(e.nodeValue,n)),e||Ni(t,!0)}else e=Ud(e).createTextNode(r),e[it]=t,t.stateNode=e}return Nc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Ii(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[it]=t}else Li(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Nc(t),e=!1}else n=Ri(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(no(t),t):(no(t),null);if(t.flags&128)throw Error(i(558))}return Nc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Ii(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[it]=t}else Li(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Nc(t),a=!1}else a=Ri(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(no(t),t):(no(t),null)}return no(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),jc(t,t.updateQueue),Nc(t),null);case 4:return le(),e===null&&wd(t.stateNode.containerInfo),Nc(t),null;case 10:return Wi(t.type),Nc(t),null;case 19:if(ae(ro),r=t.memoizedState,r===null)return Nc(t),null;if(a=!!(t.flags&128),o=r.rendering,o===null){if(a)Mc(r,!1);else{if(Wl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=io(e),o!==null){for(t.flags|=128,Mc(r,!1),e=o.updateQueue,t.updateQueue=e,jc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ai(n,e),n=n.sibling;return L(ro,ro.current&1|2),ki&&Si(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ce()>tu&&(t.flags|=128,a=!0,Mc(r,!1),t.lanes=4194304)}}else{if(!a){if(e=io(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,jc(t,e),Mc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!ki)return Nc(t),null}else 2*Ce()-r.renderingStartTime>tu&&n!==536870912&&(t.flags|=128,a=!0,Mc(r,!1),t.lanes=4194304)}r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(Nc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Ce(),e.sibling=null,n=ro.current,L(ro,a?n&1|2:n&1),ki&&Si(t,r.treeForkCount),e);case 22:case 23:return no(t),Ya(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Nc(t),t.subtreeFlags&6&&(t.flags|=8192)):Nc(t),n=t.updateQueue,n!==null&&jc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&ae(fa),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Wi(na),Nc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Fc(e,t){switch(Ti(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Wi(na),le(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return B(t),null;case 31:if(t.memoizedState!==null){if(no(t),t.alternate===null)throw Error(i(340));Li()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(no(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Li()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ae(ro),null;case 4:return le(),null;case 10:return Wi(t.type),null;case 22:case 23:return no(t),Ya(),e!==null&&ae(fa),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Wi(na),null;case 25:return null;default:return null}}function Ic(e,t){switch(Ti(t),t.tag){case 3:Wi(na),le();break;case 26:case 27:case 5:B(t);break;case 4:le();break;case 31:t.memoizedState!==null&&no(t);break;case 13:no(t);break;case 19:ae(ro);break;case 10:Wi(t.type);break;case 22:case 23:no(t),Ya(),e!==null&&ae(fa);break;case 24:Wi(na)}}function Lc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Gu(t,t.return,e)}}function Rc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Gu(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Gu(t,t.return,e)}}function zc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Wa(t,n)}catch(t){Gu(e,e.return,t)}}}function Bc(e,t,n){n.props=Vs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Gu(e,t,n)}}function Vc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Gu(e,t,n)}}function Hc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){Gu(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Gu(e,t,n)}else n.current=null}}function Uc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Gu(e,e.return,t)}}function Wc(e,t,n){try{var r=e.stateNode;Rd(r,e.type,n,t),r[at]=t}catch(t){Gu(e,e.return,t)}}function Gc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&ef(e.type)||e.tag===4}function Kc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Gc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&ef(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function qc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Yt));else if(r!==4&&(r===27&&ef(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(qc(e,t,n),e=e.sibling;e!==null;)qc(e,t,n),e=e.sibling}function Jc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&ef(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Jc(e,t,n),e=e.sibling;e!==null;)Jc(e,t,n),e=e.sibling}function Yc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Ld(t,r,n),t[it]=e,t[at]=n}catch(t){Gu(e,e.return,t)}}var Xc=!1,Zc=!1,Qc=!1,$c=typeof WeakSet==`function`?WeakSet:Set,el=null;function tl(e,t){if(e=e.containerInfo,Vd=up,e=Cr(e),wr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Hd={focusedElem:e,selectionRange:n},up=!1,el=t;el!==null;)if(t=el,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,el=e;else for(;el!==null;){switch(t=el,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)a=e[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&o!==null){e=void 0,n=t,a=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var h=Vs(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Gu(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)rf(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:rf(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(i(163))}if(e=t.sibling,e!==null){e.return=t.return,el=e;break}el=t.return}}function nl(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:_l(e,n),r&4&&Lc(5,n);break;case 1:if(_l(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Gu(n,n.return,e)}else{var i=Vs(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Gu(n,n.return,e)}}}r&64&&zc(n),r&512&&Vc(n,n.return);break;case 3:if(_l(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Wa(e,t)}catch(e){Gu(n,n.return,e)}}break;case 27:t===null&&r&4&&Yc(n);case 26:case 5:_l(e,n),t===null&&r&4&&Uc(n),r&512&&Vc(n,n.return);break;case 12:_l(e,n);break;case 31:_l(e,n),r&4&&cl(e,n);break;case 13:_l(e,n),r&4&&ll(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Yu.bind(null,n),uf(e,n))));break;case 22:if(r=n.memoizedState!==null||Xc,!r){t=t!==null&&t.memoizedState!==null||Zc,i=Xc;var a=Zc;Xc=r,(Zc=t)&&!a?yl(e,n,!!(n.subtreeFlags&8772)):_l(e,n),Xc=i,Zc=a}break;case 30:break;default:_l(e,n)}}function rl(e){var t=e.alternate;t!==null&&(e.alternate=null,rl(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&ft(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var il=null,al=!1;function ol(e,t,n){for(n=n.child;n!==null;)sl(e,t,n),n=n.sibling}function sl(e,t,n){if(Ne&&typeof Ne.onCommitFiberUnmount==`function`)try{Ne.onCommitFiberUnmount(Me,n)}catch{}switch(n.tag){case 26:Zc||Hc(n,t),ol(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Zc||Hc(n,t);var r=il,i=al;ef(n.type)&&(il=n.stateNode,al=!1),ol(e,t,n),gf(n.stateNode),il=r,al=i;break;case 5:Zc||Hc(n,t);case 6:if(r=il,i=al,il=null,ol(e,t,n),il=r,al=i,il!==null){if(al)try{(il.nodeType===9?il.body:il.nodeName===`HTML`?il.ownerDocument.body:il).removeChild(n.stateNode)}catch(e){Gu(n,t,e)}else try{il.removeChild(n.stateNode)}catch(e){Gu(n,t,e)}}break;case 18:il!==null&&(al?(e=il,tf(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Ip(e)):tf(il,n.stateNode));break;case 4:r=il,i=al,il=n.stateNode.containerInfo,al=!0,ol(e,t,n),il=r,al=i;break;case 0:case 11:case 14:case 15:Rc(2,n,t),Zc||Rc(4,n,t),ol(e,t,n);break;case 1:Zc||(Hc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Bc(n,t,r)),ol(e,t,n);break;case 21:ol(e,t,n);break;case 22:Zc=(r=Zc)||n.memoizedState!==null,ol(e,t,n),Zc=r;break;default:ol(e,t,n)}}function cl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Ip(e)}catch(e){Gu(t,t.return,e)}}}function ll(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Ip(e)}catch(e){Gu(t,t.return,e)}}function ul(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new $c),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new $c),t;default:throw Error(i(435,e.tag))}}function dl(e,t){var n=ul(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=Xu.bind(null,e,t);t.then(r,r)}})}function fl(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r],o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(ef(c.type)){il=c.stateNode,al=!1;break a}break;case 5:il=c.stateNode,al=!1;break a;case 3:case 4:il=c.stateNode.containerInfo,al=!0;break a}c=c.return}if(il===null)throw Error(i(160));sl(o,s,a),il=null,al=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)ml(t,e),t=t.sibling}var pl=null;function ml(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:fl(t,e),hl(e),r&4&&(Rc(3,e,e.return),Lc(3,e),Rc(5,e,e.return));break;case 1:fl(t,e),hl(e),r&512&&(Zc||n===null||Hc(n,n.return)),r&64&&Xc&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var a=pl;if(fl(t,e),hl(e),r&512&&(Zc||n===null||Hc(n,n.return)),r&4){var o=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null){if(r===null){if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,a=a.ownerDocument||a;b:switch(r){case`title`:o=a.getElementsByTagName(`title`)[0],(!o||o[dt]||o[it]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),Ld(o,r,n),o[it]=e,_t(o),r=o;break a;case`link`:var s=Wf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&o.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&o.getAttribute(`title`)===(n.title==null?null:n.title)&&o.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}o=a.createElement(r),Ld(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=Wf(`meta`,`content`,a).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`content`)===(n.content==null?null:``+n.content)&&o.getAttribute(`name`)===(n.name==null?null:n.name)&&o.getAttribute(`property`)===(n.property==null?null:n.property)&&o.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}o=a.createElement(r),Ld(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[it]=e,_t(o),r=o}e.stateNode=r}else Gf(a,e.type,e.stateNode)}else e.stateNode=zf(a,r,e.memoizedProps)}else o===r?r===null&&e.stateNode!==null&&Wc(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Gf(a,e.type,e.stateNode):zf(a,r,e.memoizedProps))}break;case 27:fl(t,e),hl(e),r&512&&(Zc||n===null||Hc(n,n.return)),n!==null&&r&4&&Wc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(fl(t,e),hl(e),r&512&&(Zc||n===null||Hc(n,n.return)),e.flags&32){a=e.stateNode;try{Ut(a,``)}catch(t){Gu(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,Wc(e,a,n===null?a:n.memoizedProps)),r&1024&&(Qc=!0);break;case 6:if(fl(t,e),hl(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Gu(e,e.return,t)}}break;case 3:if(Uf=null,a=pl,pl=yf(t.containerInfo),fl(t,e),pl=a,hl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Ip(t.containerInfo)}catch(t){Gu(e,e.return,t)}Qc&&(Qc=!1,gl(e));break;case 4:r=pl,pl=yf(e.stateNode.containerInfo),fl(t,e),hl(e),pl=r;break;case 12:fl(t,e),hl(e);break;case 31:fl(t,e),hl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,dl(e,r)));break;case 13:fl(t,e),hl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&($l=Ce()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,dl(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=Xc,d=Zc;if(Xc=u||a,Zc=d||l,fl(t,e),Zc=d,Xc=u,hl(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||Xc||Zc||vl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(o=l.stateNode,a)s=o.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){Gu(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){Gu(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?nf(m,!0):nf(l.stateNode,!1)}catch(e){Gu(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,dl(e,n))));break;case 19:fl(t,e),hl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,dl(e,r)));break;case 30:break;case 21:break;default:fl(t,e),hl(e)}}function hl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Gc(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;Jc(e,Kc(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(Ut(o,``),n.flags&=-33),Jc(e,Kc(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;qc(e,Kc(e),s);break;default:throw Error(i(161))}}catch(t){Gu(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function gl(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;gl(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function _l(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)nl(e,t.alternate,t),t=t.sibling}function vl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Rc(4,t,t.return),vl(t);break;case 1:Hc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Bc(t,t.return,n),vl(t);break;case 27:gf(t.stateNode);case 26:case 5:Hc(t,t.return),vl(t);break;case 22:t.memoizedState===null&&vl(t);break;case 30:vl(t);break;default:vl(t)}e=e.sibling}}function yl(e,t,n){for(n&&=!!(t.subtreeFlags&8772),t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:yl(i,a,n),Lc(4,a);break;case 1:if(yl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Gu(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)Ua(c[i],s)}catch(e){Gu(r,r.return,e)}}n&&o&64&&zc(a),Vc(a,a.return);break;case 27:Yc(a);case 26:case 5:yl(i,a,n),n&&r===null&&o&4&&Uc(a),Vc(a,a.return);break;case 12:yl(i,a,n);break;case 31:yl(i,a,n),n&&o&4&&cl(i,a);break;case 13:yl(i,a,n),n&&o&4&&ll(i,a);break;case 22:a.memoizedState===null&&yl(i,a,n),Vc(a,a.return);break;case 30:break;default:yl(i,a,n)}t=t.sibling}}function bl(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&G(n))}function xl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&G(e))}function Sl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Cl(e,t,n,r),t=t.sibling}function Cl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Sl(e,t,n,r),i&2048&&Lc(9,t);break;case 1:Sl(e,t,n,r);break;case 3:Sl(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&G(e)));break;case 12:if(i&2048){Sl(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){Gu(t,t.return,e)}}else Sl(e,t,n,r);break;case 31:Sl(e,t,n,r);break;case 13:Sl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?Sl(e,t,n,r):(a._visibility|=2,wl(e,t,n,r,!!(t.subtreeFlags&10256)||!1)):a._visibility&2?Sl(e,t,n,r):Tl(e,t),i&2048&&bl(o,t);break;case 24:Sl(e,t,n,r),i&2048&&xl(t.alternate,t);break;default:Sl(e,t,n,r)}}function wl(e,t,n,r,i){for(i&&=!!(t.subtreeFlags&10256)||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:wl(a,o,s,c,i),Lc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,wl(a,o,s,c,i)):u._visibility&2?wl(a,o,s,c,i):Tl(a,o),i&&l&2048&&bl(o.alternate,o);break;case 24:wl(a,o,s,c,i),i&&l&2048&&xl(o.alternate,o);break;default:wl(a,o,s,c,i)}t=t.sibling}}function Tl(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Tl(n,r),i&2048&&bl(r.alternate,r);break;case 24:Tl(n,r),i&2048&&xl(r.alternate,r);break;default:Tl(n,r)}t=t.sibling}}var El=8192;function Dl(e,t,n){if(e.subtreeFlags&El)for(e=e.child;e!==null;)Ol(e,t,n),e=e.sibling}function Ol(e,t,n){switch(e.tag){case 26:Dl(e,t,n),e.flags&El&&e.memoizedState!==null&&Jf(n,pl,e.memoizedState,e.memoizedProps);break;case 5:Dl(e,t,n);break;case 3:case 4:var r=pl;pl=yf(e.stateNode.containerInfo),Dl(e,t,n),pl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=El,El=16777216,Dl(e,t,n),El=r):Dl(e,t,n));break;default:Dl(e,t,n)}}function kl(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Al(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];el=r,Nl(r,e)}kl(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)jl(e),e=e.sibling}function jl(e){switch(e.tag){case 0:case 11:case 15:Al(e),e.flags&2048&&Rc(9,e,e.return);break;case 3:Al(e);break;case 12:Al(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Ml(e)):Al(e);break;default:Al(e)}}function Ml(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];el=r,Nl(r,e)}kl(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Rc(8,t,t.return),Ml(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Ml(t));break;default:Ml(t)}e=e.sibling}}function Nl(e,t){for(;el!==null;){var n=el;switch(n.tag){case 0:case 11:case 15:Rc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:G(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,el=r;else a:for(n=e;el!==null;){r=el;var i=r.sibling,a=r.return;if(rl(r),r===n){el=null;break a}if(i!==null){i.return=a,el=i;break a}el=a}}}var Pl={getCacheForType:function(e){var t=Xi(na),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Xi(na).controller.signal}},Fl=typeof WeakMap==`function`?WeakMap:Map,Il=0,Ll=null,Y=null,X=0,Rl=0,zl=null,Bl=!1,Vl=!1,Hl=!1,Ul=0,Wl=0,Gl=0,Kl=0,ql=0,Jl=0,Yl=0,Xl=null,Zl=null,Ql=!1,$l=0,eu=0,tu=1/0,nu=null,ru=null,iu=0,au=null,ou=null,su=0,cu=0,lu=null,uu=null,du=0,fu=null;function pu(){return Il&2&&X!==0?X&-X:N.T===null?tt():fd()}function mu(){if(Jl===0){if(!(X&536870912)||ki){var e=Be;Be<<=1,!(Be&3932160)&&(Be=262144),Jl=e}else Jl=536870912}return e=Xa.current,e!==null&&(e.flags|=32),Jl}function hu(e,t,n){(e===Ll&&(Rl===2||Rl===9)||e.cancelPendingCommit!==null)&&(Su(e,0),yu(e,X,Jl,!1)),Je(e,n),(!(Il&2)||e!==Ll)&&(e===Ll&&(!(Il&2)&&(Kl|=n),Wl===4&&yu(e,X,Jl,!1)),id(e))}function gu(e,t,n){if(Il&6)throw Error(i(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||We(e,t),a=r?Au(e,t):Ou(e,t,!0),o=r;do{if(a===0){Vl&&!r&&yu(e,t,0,!1);break}if(n=e.current.alternate,o&&!vu(n)){a=Ou(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=Xl;var l=c.current.memoizedState.isDehydrated;if(l&&(Su(c,s).flags|=256),s=Ou(c,s,!1),s!==2){if(Hl&&!l){c.errorRecoveryDisabledLanes|=o,Kl|=o,a=4;break a}o=Zl,Zl=a,o!==null&&(Zl===null?Zl=o:Zl.push.apply(Zl,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Su(e,0),yu(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t)break;case 6:yu(r,t,Jl,!Bl);break a;case 2:Zl=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=$l+300-Ce(),10<a)){if(yu(r,t,Jl,!Bl),Ue(r,0,!0)!==0)break a;su=t,r.timeoutHandle=Yd(_u.bind(null,r,n,Zl,nu,Ql,t,Jl,Kl,Yl,Bl,o,`Throttled`,-0,0),a);break a}_u(r,n,Zl,nu,Ql,t,Jl,Kl,Yl,Bl,o,null,-0,0)}break}while(1);id(e)}function _u(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Yt},Ol(t,a,d);var m=(a&62914560)===a?$l-Ce():(a&4194048)===a?eu-Ce():0;if(m=Xf(d,m),m!==null){su=a,e.cancelPendingCommit=m(Lu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),yu(e,a,o,!l);return}}Lu(e,t,a,n,r,i,o,s,c)}function vu(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!vr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function yu(e,t,n,r){t&=~ql,t&=~Kl,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Fe(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Xe(e,n,t)}function bu(){return Il&6?!0:(ad(0,!1),!1)}function xu(){if(Y!==null){if(Rl===0)var e=Y.return;else e=Y,Hi=Vi=null,wo(e),Ea=null,Da=0,e=Y;for(;e!==null;)Ic(e.alternate,e),e=e.return;Y=null}}function Su(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,Xd(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),su=0,xu(),Ll=e,Y=n=ii(e.current,null),X=t,Rl=0,zl=null,Bl=!1,Vl=We(e,t),Hl=!1,Yl=Jl=ql=Kl=Gl=Wl=0,Zl=Xl=null,Ql=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Fe(r),a=1<<i;t|=e[i],r&=~a}return Ul=t,Jr(),n}function Cu(e,t){q=null,N.H=Ns,t===ga||t===va?(t=wa(),Rl=3):t===_a?(t=wa(),Rl=4):Rl=t===Zs?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,zl=t,Y===null&&(Wl=1,Gs(e,fi(t,e.current)))}function wu(){var e=Xa.current;return e===null?!0:(X&4194048)===X?Za===null:(X&62914560)===X||X&536870912?e===Za:!1}function Tu(){var e=N.H;return N.H=Ns,e===null?Ns:e}function Eu(){var e=N.A;return N.A=Pl,e}function Du(){Wl=4,Bl||(X&4194048)!==X&&Xa.current!==null||(Vl=!0),!(Gl&134217727)&&!(Kl&134217727)||Ll===null||yu(Ll,X,Jl,!1)}function Ou(e,t,n){var r=Il;Il|=2;var i=Tu(),a=Eu();(Ll!==e||X!==t)&&(nu=null,Su(e,t)),t=!1;var o=Wl;a:do try{if(Rl!==0&&Y!==null){var s=Y,c=zl;switch(Rl){case 8:xu(),o=6;break a;case 3:case 2:case 9:case 6:Xa.current===null&&(t=!0);var l=Rl;if(Rl=0,zl=null,Pu(e,s,c,l),n&&Vl){o=0;break a}break;default:l=Rl,Rl=0,zl=null,Pu(e,s,c,l)}}ku(),o=Wl;break}catch(t){Cu(e,t)}while(1);return t&&e.shellSuspendCounter++,Hi=Vi=null,Il=r,N.H=i,N.A=a,Y===null&&(Ll=null,X=0,Jr()),o}function ku(){for(;Y!==null;)Mu(Y)}function Au(e,t){var n=Il;Il|=2;var r=Tu(),a=Eu();Ll!==e||X!==t?(nu=null,tu=Ce()+500,Su(e,t)):Vl=We(e,t);a:do try{if(Rl!==0&&Y!==null){t=Y;var o=zl;b:switch(Rl){case 1:Rl=0,zl=null,Pu(e,t,o,1);break;case 2:case 9:if(ba(o)){Rl=0,zl=null,Nu(t);break}t=function(){Rl!==2&&Rl!==9||Ll!==e||(Rl=7),id(e)},o.then(t,t);break a;case 3:Rl=7;break a;case 4:Rl=5;break a;case 7:ba(o)?(Rl=0,zl=null,Nu(t)):(Rl=0,zl=null,Pu(e,t,o,7));break;case 5:var s=null;switch(Y.tag){case 26:s=Y.memoizedState;case 5:case 27:var c=Y;if(s?qf(s):c.stateNode.complete){Rl=0,zl=null;var l=c.sibling;if(l!==null)Y=l;else{var u=c.return;u===null?Y=null:(Y=u,Fu(u))}break b}}Rl=0,zl=null,Pu(e,t,o,5);break;case 6:Rl=0,zl=null,Pu(e,t,o,6);break;case 8:xu(),Wl=6;break a;default:throw Error(i(462))}}ju();break}catch(t){Cu(e,t)}while(1);return Hi=Vi=null,N.H=r,N.A=a,Il=n,Y===null?(Ll=null,X=0,Jr(),Wl):0}function ju(){for(;Y!==null&&!xe();)Mu(Y)}function Mu(e){var t=Dc(e.alternate,e,Ul);e.memoizedProps=e.pendingProps,t===null?Fu(e):Y=t}function Nu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=dc(n,t,t.pendingProps,t.type,void 0,X);break;case 11:t=dc(n,t,t.pendingProps,t.type.render,t.ref,X);break;case 5:wo(t);default:Ic(n,t),t=Y=ai(t,Ul),t=Dc(n,t,Ul)}e.memoizedProps=e.pendingProps,t===null?Fu(e):Y=t}function Pu(e,t,n,r){Hi=Vi=null,wo(t),Ea=null,Da=0;var i=t.return;try{if(Xs(e,i,t,n,X)){Wl=1,Gs(e,fi(n,e.current)),Y=null;return}}catch(t){if(i!==null)throw Y=i,t;Wl=1,Gs(e,fi(n,e.current)),Y=null;return}t.flags&32768?(ki||r===1?e=!0:Vl||X&536870912?e=!1:(Bl=e=!0,(r===2||r===9||r===3||r===6)&&(r=Xa.current,r!==null&&r.tag===13&&(r.flags|=16384))),Iu(t,e)):Fu(t)}function Fu(e){var t=e;do{if(t.flags&32768){Iu(t,Bl);return}e=t.return;var n=Pc(t.alternate,t,Ul);if(n!==null){Y=n;return}if(t=t.sibling,t!==null){Y=t;return}Y=t=e}while(t!==null);Wl===0&&(Wl=5)}function Iu(e,t){do{var n=Fc(e.alternate,e);if(n!==null){n.flags&=32767,Y=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Y=e;return}Y=e=n}while(e!==null);Wl=6,Y=null}function Lu(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do Hu();while(iu!==0);if(Il&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=qr,Ye(e,n,o,s,c,l),e===Ll&&(Y=Ll=null,X=0),ou=t,au=e,su=n,cu=o,lu=a,uu=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,Zu(De,function(){return Uu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=N.T,N.T=null,a=P.p,P.p=2,s=Il,Il|=4;try{tl(e,t,n)}finally{Il=s,P.p=a,N.T=r}}iu=1,Ru(),zu(),Bu()}}function Ru(){if(iu===1){iu=0;var e=au,t=ou,n=!!(t.flags&13878);if(t.subtreeFlags&13878||n){n=N.T,N.T=null;var r=P.p;P.p=2;var i=Il;Il|=4;try{ml(t,e);var a=Hd,o=Cr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&Sr(s.ownerDocument.documentElement,s)){if(c!==null&&wr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=xr(s,h),v=xr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}up=!!Vd,Hd=Vd=null}finally{Il=i,P.p=r,N.T=n}}e.current=t,iu=2}}function zu(){if(iu===2){iu=0;var e=au,t=ou,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=N.T,N.T=null;var r=P.p;P.p=2;var i=Il;Il|=4;try{nl(e,t.alternate,t)}finally{Il=i,P.p=r,N.T=n}}iu=3}}function Bu(){if(iu===4||iu===3){iu=0,Se();var e=au,t=ou,n=su,r=uu;t.subtreeFlags&10256||t.flags&10256?iu=5:(iu=0,ou=au=null,Vu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(ru=null),et(n),t=t.stateNode,Ne&&typeof Ne.onCommitFiberRoot==`function`)try{Ne.onCommitFiberRoot(Me,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=N.T,i=P.p,P.p=2,N.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{N.T=t,P.p=i}}su&3&&Hu(),id(e),i=e.pendingLanes,n&261930&&i&42?e===fu?du++:(du=0,fu=e):du=0,ad(0,!1)}}function Vu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,G(t)))}function Hu(){return Ru(),zu(),Bu(),Uu()}function Uu(){if(iu!==5)return!1;var e=au,t=cu;cu=0;var n=et(su),r=N.T,a=P.p;try{P.p=32>n?32:n,N.T=null,n=lu,lu=null;var o=au,s=su;if(iu=0,ou=au=null,su=0,Il&6)throw Error(i(331));var c=Il;if(Il|=4,jl(o.current),Cl(o,o.current,s,n),Il=c,ad(0,!1),Ne&&typeof Ne.onPostCommitFiberRoot==`function`)try{Ne.onPostCommitFiberRoot(Me,o)}catch{}return!0}finally{P.p=a,N.T=r,Vu(e,t)}}function Wu(e,t,n){t=fi(n,t),t=qs(e.stateNode,t,2),e=Ra(e,t,2),e!==null&&(Je(e,2),id(e))}function Gu(e,t,n){if(e.tag===3)Wu(e,e,n);else for(;t!==null;){if(t.tag===3){Wu(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(ru===null||!ru.has(r))){e=fi(n,e),n=Js(2),r=Ra(t,n,2),r!==null&&(Ys(n,r,t,e),Je(r,2),id(r));break}}t=t.return}}function Ku(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Fl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Hl=!0,i.add(n),e=qu.bind(null,e,t,n),t.then(e,e))}function qu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Ll===e&&(X&n)===n&&(Wl===4||Wl===3&&(X&62914560)===X&&300>Ce()-$l?!(Il&2)&&Su(e,0):ql|=n,Yl===X&&(Yl=0)),id(e)}function Ju(e,t){t===0&&(t=Ke()),e=Zr(e,t),e!==null&&(Je(e,t),id(e))}function Yu(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Ju(e,n)}function Xu(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),Ju(e,n)}function Zu(e,t){return ye(e,t)}var Qu=null,$u=null,ed=!1,td=!1,nd=!1,rd=0;function id(e){e!==$u&&e.next===null&&($u===null?Qu=$u=e:$u=$u.next=e),td=!0,ed||(ed=!0,dd())}function ad(e,t){if(!nd&&td){nd=!0;do for(var n=!1,r=Qu;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Fe(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,ud(r,a))}else a=X,a=Ue(r,r===Ll?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||We(r,a)||(n=!0,ud(r,a))}r=r.next}while(n);nd=!1}}function od(){sd()}function sd(){td=ed=!1;var e=0;rd!==0&&Jd()&&(e=rd);for(var t=Ce(),n=null,r=Qu;r!==null;){var i=r.next,a=cd(r,t);a===0?(r.next=null,n===null?Qu=i:n.next=i,i===null&&($u=n)):(n=r,(e!==0||a&3)&&(td=!0)),r=i}iu!==0&&iu!==5||ad(e,!1),rd!==0&&(rd=0)}function cd(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Fe(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Ge(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Ll,n=X,n=Ue(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Rl===2||Rl===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&be(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||We(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&be(r),et(n)){case 2:case 8:n=Ee;break;case 32:n=De;break;case 268435456:n=ke;break;default:n=De}return r=ld.bind(null,e),n=ye(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&be(r),e.callbackPriority=2,e.callbackNode=null,2}function ld(e,t){if(iu!==0&&iu!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Hu()&&e.callbackNode!==n)return null;var r=X;return r=Ue(e,e===Ll?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(gu(e,r,t),cd(e,Ce()),e.callbackNode!=null&&e.callbackNode===n?ld.bind(null,e):null)}function ud(e,t){if(Hu())return null;gu(e,t,!0)}function dd(){Qd(function(){Il&6?ye(Te,od):sd()})}function fd(){if(rd===0){var e=oa;e===0&&(e=ze,ze<<=1,!(ze&261888)&&(ze=256)),rd=e}return rd}function pd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Jt(``+e)}function md(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function hd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=pd((i[at]||null).action),o=r.submitter;o&&(t=(t=o[at]||null)?pd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new _n(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(rd!==0){var e=o?md(i,o):new FormData(i);ys(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?md(i,o):new FormData(i),ys(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var gd=0;gd<Hr.length;gd++){var _d=Hr[gd];Ur(_d.toLowerCase(),`on`+(_d[0].toUpperCase()+_d.slice(1)))}Ur(U,`onAnimationEnd`),Ur(Ir,`onAnimationIteration`),Ur(Lr,`onAnimationStart`),Ur(`dblclick`,`onDoubleClick`),Ur(`focusin`,`onFocus`),Ur(`focusout`,`onBlur`),Ur(Rr,`onTransitionRun`),Ur(zr,`onTransitionStart`),Ur(Br,`onTransitionCancel`),Ur(W,`onTransitionEnd`),xt(`onMouseEnter`,[`mouseout`,`mouseover`]),xt(`onMouseLeave`,[`mouseout`,`mouseover`]),xt(`onPointerEnter`,[`pointerout`,`pointerover`]),xt(`onPointerLeave`,[`pointerout`,`pointerover`]),bt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),bt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),bt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),bt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),bt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),bt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var vd=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),yd=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(vd));function bd(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Wr(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Wr(e)}i.currentTarget=null,a=c}}}}function xd(e,t){var n=t[st];n===void 0&&(n=t[st]=new Set);var r=e+`__bubble`;n.has(r)||(Td(t,e,2,!1),n.add(r))}function Sd(e,t,n){var r=0;t&&(r|=4),Td(n,e,r,t)}var Cd=`_reactListening`+Math.random().toString(36).slice(2);function wd(e){if(!e[Cd]){e[Cd]=!0,vt.forEach(function(t){t!==`selectionchange`&&(yd.has(t)||Sd(t,!1,e),Sd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Cd]||(t[Cd]=!0,Sd(`selectionchange`,!1,t))}}function Td(e,t,n,r){switch(_p(t)){case 2:var i=dp;break;case 8:i=fp;break;default:i=pp}n=i.bind(null,t,n,e),i=void 0,!on||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Ed(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=pt(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}nn(function(){var r=a,i=Zt(n),s=[];a:{var c=Vr.get(e);if(c!==void 0){var l=_n,u=e;switch(e){case`keypress`:if(fn(n)===0)break a;case`keydown`:case`keyup`:l=Fn;break;case`focusin`:u=`focus`,l=En;break;case`focusout`:u=`blur`,l=En;break;case`beforeblur`:case`afterblur`:l=En;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=wn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Tn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=Ln;break;case U:case Ir:case Lr:l=Dn;break;case W:l=Rn;break;case`scroll`:case`scrollend`:l=yn;break;case`wheel`:l=zn;break;case`copy`:case`cut`:case`paste`:l=On;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=In;break;case`toggle`:case`beforetoggle`:l=Bn}var d=!!(t&4),f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=rn(m,p),g!=null&&d.push(Dd(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,c&&n!==Xt&&(u=n.relatedTarget||n.fromElement)&&(pt(u)||u[ot]))break a;if((l||c)&&(c=i.window===i?i:(c=i.ownerDocument)?c.defaultView||c.parentWindow:window,l?(u=n.relatedTarget||n.toElement,l=r,u=u?pt(u):null,u!==null&&(f=o(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(l=null,u=r),l!==u)){if(d=wn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=In,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:ht(l),h=u==null?c:ht(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,pt(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,l&&u)b:{for(d=kd,p=l,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;l!==null&&Ad(s,c,l,d,!1),u!==null&&f!==null&&Ad(s,f,u,d,!0)}}a:{if(c=r?ht(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=or;else if(er(c)){if(sr)v=gr;else{v=mr;var y=pr}}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&Gt(r.elementType)&&(v=or):v=hr;if(v&&=v(e,r)){tr(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&zt(c,`number`,c.value)}switch(y=r?ht(r):window,e){case`focusin`:(er(y)||y.contentEditable===`true`)&&(Er=y,Dr=r,Or=null);break;case`focusout`:Or=Dr=Er=null;break;case`mousedown`:kr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:kr=!1,Ar(s,n,i);break;case`selectionchange`:if(Tr)break;case`keydown`:case`keyup`:Ar(s,n,i)}var b;if(Hn)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else Xn?Jn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Gn&&n.locale!==`ko`&&(Xn||x!==`onCompositionStart`?x===`onCompositionEnd`&&Xn&&(b=dn()):(cn=i,ln=`value`in cn?cn.value:cn.textContent,Xn=!0)),y=Od(r,x),0<y.length&&(x=new kn(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=Yn(n),b!==null&&(x.data=b)))),(b=Wn?Zn(e,n):Qn(e,n))&&(x=Od(r,`onBeforeInput`),0<x.length&&(y=new kn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),hd(s,e,r,n,i)}bd(s,t)})}function Dd(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Od(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=rn(e,n),i!=null&&r.unshift(Dd(e,i,a)),i=rn(e,t),i!=null&&r.push(Dd(e,i,a))),e.tag===3)return r;e=e.return}return[]}function kd(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Ad(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=rn(n,a),l!=null&&o.unshift(Dd(n,l,c))):i||(l=rn(n,a),l!=null&&o.push(Dd(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var jd=/\r\n?/g,Md=/\u0000|\uFFFD/g;function Nd(e){return(typeof e==`string`?e:``+e).replace(jd,`
10
- `).replace(Md,``)}function Pd(e,t){return t=Nd(t),Nd(e)===t}function Fd(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Ut(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Ut(e,``+r);break;case`className`:Dt(e,`class`,r);break;case`tabIndex`:Dt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Dt(e,n,r);break;case`style`:H(e,r,o);break;case`data`:if(t!==`object`){Dt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Jt(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof o==`function`&&(n===`formAction`?(t!==`input`&&Fd(e,t,`name`,a.name,a,null),Fd(e,t,`formEncType`,a.formEncType,a,null),Fd(e,t,`formMethod`,a.formMethod,a,null),Fd(e,t,`formTarget`,a.formTarget,a,null)):(Fd(e,t,`encType`,a.encType,a,null),Fd(e,t,`method`,a.method,a,null),Fd(e,t,`target`,a.target,a,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Jt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Yt);break;case`onScroll`:r!=null&&xd(`scroll`,e);break;case`onScrollEnd`:r!=null&&xd(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Jt(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:xd(`beforetoggle`,e),xd(`toggle`,e),Et(e,`popover`,r);break;case`xlinkActuate`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Ot(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Ot(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Ot(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Et(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=Kt.get(n)||n,Et(e,n,r))}}function Id(e,t,n,r,a,o){switch(n){case`style`:H(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Ut(e,r):(typeof r==`number`||typeof r==`bigint`)&&Ut(e,``+r);break;case`onScroll`:r!=null&&xd(`scroll`,e);break;case`onScrollEnd`:r!=null&&xd(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=Yt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!yt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[at]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):Et(e,n,r)}}}function Ld(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:xd(`error`,e),xd(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Fd(e,t,o,s,n,null)}}a&&Fd(e,t,`srcSet`,n.srcSet,n,null),r&&Fd(e,t,`src`,n.src,n,null);return;case`input`:xd(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:Fd(e,t,r,d,n,null)}}Rt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in xd(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Fd(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Bt(e,!!r,n,!0):Bt(e,!!r,t,!1);return;case`textarea`:for(s in xd(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:Fd(e,t,s,c,n,null)}Ht(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Fd(e,t,l,r,n,null)}return;case`dialog`:xd(`beforetoggle`,e),xd(`toggle`,e),xd(`cancel`,e),xd(`close`,e);break;case`iframe`:case`object`:xd(`load`,e);break;case`video`:case`audio`:for(r=0;r<vd.length;r++)xd(vd[r],e);break;case`image`:xd(`error`,e),xd(`load`,e);break;case`details`:xd(`toggle`,e);break;case`embed`:case`source`:case`link`:xd(`error`,e),xd(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Fd(e,t,u,r,n,null)}return;default:if(Gt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Id(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Fd(e,t,c,r,n,null))}function Rd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Fd(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:a=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&Fd(e,t,p,m,r,f)}}Lt(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Fd(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&Fd(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Bt(e,!!n,n?[]:``,!1):Bt(e,!!n,t,!0)):Bt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Fd(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&Fd(e,t,s,a,r,o)}Vt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Fd(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Fd(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Fd(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:Fd(e,t,u,p,r,m)}return;default:if(Gt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Id(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Id(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Fd(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Fd(e,t,f,p,r,m)}function zd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Bd(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&zd(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&zd(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Vd=null,Hd=null;function Ud(e){return e.nodeType===9?e:e.ownerDocument}function Wd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Gd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Kd(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var qd=null;function Jd(){var e=window.event;return e&&e.type===`popstate`?e!==qd&&(qd=e,!0):(qd=null,!1)}var Yd=typeof setTimeout==`function`?setTimeout:void 0,Xd=typeof clearTimeout==`function`?clearTimeout:void 0,Zd=typeof Promise==`function`?Promise:void 0,Qd=typeof queueMicrotask==`function`?queueMicrotask:Zd===void 0?Yd:function(e){return Zd.resolve(null).then(e).catch($d)};function $d(e){setTimeout(function(){throw e})}function ef(e){return e===`head`}function tf(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Ip(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)gf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,gf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[dt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&gf(e.ownerDocument.body)}n=i}while(n);Ip(t)}function nf(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function rf(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:rf(n),ft(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function af(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[dt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=df(e.nextSibling),e===null)break}return null}function of(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=df(e.nextSibling),e===null))return null;return e}function sf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=df(e.nextSibling),e===null))return null;return e}function cf(e){return e.data===`$?`||e.data===`$~`}function lf(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function uf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function df(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var ff=null;function pf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return df(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function mf(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function hf(e,t,n){switch(t=Ud(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function gf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);ft(e)}var _f=new Map,vf=new Set;function yf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var bf=P.d;P.d={f:xf,r:Sf,D:Tf,C:Ef,L:Df,m:Of,X:Af,S:kf,M:jf};function xf(){var e=bf.f(),t=bu();return e||t}function Sf(e){var t=mt(e);t!==null&&t.tag===5&&t.type===`form`?xs(t):bf.r(e)}var Cf=typeof document>`u`?null:document;function wf(e,t,n){var r=Cf;if(r&&typeof t==`string`&&t){var i=It(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),vf.has(i)||(vf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Ld(t,`link`,e),_t(t),r.head.appendChild(t)))}}function Tf(e){bf.D(e),wf(`dns-prefetch`,e,null)}function Ef(e,t){bf.C(e,t),wf(`preconnect`,e,t)}function Df(e,t,n){bf.L(e,t,n);var r=Cf;if(r&&e&&t){var i=`link[rel="preload"][as="`+It(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+It(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+It(n.imageSizes)+`"]`)):i+=`[href="`+It(e)+`"]`;var a=i;switch(t){case`style`:a=Nf(e);break;case`script`:a=Lf(e)}_f.has(a)||(e=h({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),_f.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Pf(a))||t===`script`&&r.querySelector(Rf(a))||(t=r.createElement(`link`),Ld(t,`link`,e),_t(t),r.head.appendChild(t)))}}function Of(e,t){bf.m(e,t);var n=Cf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+It(r)+`"][href="`+It(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Lf(e)}if(!_f.has(a)&&(e=h({rel:`modulepreload`,href:e},t),_f.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Rf(a)))return}r=n.createElement(`link`),Ld(r,`link`,e),_t(r),n.head.appendChild(r)}}}function kf(e,t,n){bf.S(e,t,n);var r=Cf;if(r&&e){var i=gt(r).hoistableStyles,a=Nf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Pf(a)))s.loading=5;else{e=h({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=_f.get(a))&&Vf(e,n);var c=o=r.createElement(`link`);_t(c),Ld(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Bf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Af(e,t){bf.X(e,t);var n=Cf;if(n&&e){var r=gt(n).hoistableScripts,i=Lf(e),a=r.get(i);a||(a=n.querySelector(Rf(i)),a||(e=h({src:e,async:!0},t),(t=_f.get(i))&&Hf(e,t),a=n.createElement(`script`),_t(a),Ld(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function jf(e,t){bf.M(e,t);var n=Cf;if(n&&e){var r=gt(n).hoistableScripts,i=Lf(e),a=r.get(i);a||(a=n.querySelector(Rf(i)),a||(e=h({src:e,async:!0,type:`module`},t),(t=_f.get(i))&&Hf(e,t),a=n.createElement(`script`),_t(a),Ld(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Mf(e,t,n,r){var a=(a=se.current)?yf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Nf(n.href),n=gt(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Nf(n.href);var o=gt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Pf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),_f.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},_f.set(e,n),o||If(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Lf(n),n=gt(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Nf(e){return`href="`+It(e)+`"`}function Pf(e){return`link[rel="stylesheet"][`+e+`]`}function Ff(e){return h({},e,{"data-precedence":e.precedence,precedence:null})}function If(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Ld(t,`link`,n),_t(t),e.head.appendChild(t))}function Lf(e){return`[src="`+It(e)+`"]`}function Rf(e){return`script[async]`+e}function zf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+It(n.href)+`"]`);if(r)return t.instance=r,_t(r),r;var a=h({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),_t(r),Ld(r,`style`,a),Bf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Nf(n.href);var o=e.querySelector(Pf(a));if(o)return t.state.loading|=4,t.instance=o,_t(o),o;r=Ff(n),(a=_f.get(a))&&Vf(r,a),o=(e.ownerDocument||e).createElement(`link`),_t(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Ld(o,`link`,r),t.state.loading|=4,Bf(o,n.precedence,e),t.instance=o;case`script`:return o=Lf(n.src),(a=e.querySelector(Rf(o)))?(t.instance=a,_t(a),a):(r=n,(a=_f.get(o))&&(r=h({},n),Hf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),_t(a),Ld(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Bf(r,n.precedence,e));return t.instance}function Bf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Vf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Hf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Uf=null;function Wf(e,t,n){if(Uf===null){var r=new Map,i=Uf=new Map;i.set(n,r)}else i=Uf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[dt]||a[it]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Gf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Kf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function qf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Jf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Nf(r.href),a=t.querySelector(Pf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Zf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,_t(a);return}a=t.ownerDocument||t,r=Ff(r),(i=_f.get(i))&&Vf(r,i),a=a.createElement(`link`),_t(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Ld(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Zf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Yf=0;function Xf(e,t){return e.stylesheets&&e.count===0&&$f(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&$f(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Yf===0&&(Yf=62500*Bd());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&$f(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Yf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Zf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)$f(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Qf=null;function $f(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Qf=new Map,t.forEach(ep,e),Qf=null,Zf.call(e))}function ep(e,t){if(!(t.state.loading&4)){var n=Qf.get(e);if(n)var r=n.get(null);else{n=new Map,Qf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=Zf.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var tp={$$typeof:C,Provider:null,Consumer:null,_currentValue:re,_currentValue2:re,_threadCount:0};function np(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=qe(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=qe(0),this.hiddenUpdates=qe(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function rp(e,t,n,r,i,a,o,s,c,l,u,d){return e=new np(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=ni(3,null,null,t),e.current=a,a.stateNode=e,t=ra(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Fa(a),e}function ip(e){return e?(e=ei,e):ei}function ap(e,t,n,r,i,a){i=ip(i),r.context===null?r.context=i:r.pendingContext=i,r=La(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Ra(e,r,t),n!==null&&(hu(n,e,t),za(n,e,t))}function op(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function sp(e,t){op(e,t),(e=e.alternate)&&op(e,t)}function cp(e){if(e.tag===13||e.tag===31){var t=Zr(e,67108864);t!==null&&hu(t,e,67108864),sp(e,67108864)}}function lp(e){if(e.tag===13||e.tag===31){var t=pu();t=$e(t);var n=Zr(e,t);n!==null&&hu(n,e,t),sp(e,t)}}var up=!0;function dp(e,t,n,r){var i=N.T;N.T=null;var a=P.p;try{P.p=2,pp(e,t,n,r)}finally{P.p=a,N.T=i}}function fp(e,t,n,r){var i=N.T;N.T=null;var a=P.p;try{P.p=8,pp(e,t,n,r)}finally{P.p=a,N.T=i}}function pp(e,t,n,r){if(up){var i=mp(r);if(i===null)Ed(e,t,r,hp,n),Ep(e,r);else if(Op(i,e,t,n,r))r.stopPropagation();else if(Ep(e,r),t&4&&-1<Tp.indexOf(e)){for(;i!==null;){var a=mt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=He(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Fe(o);s.entanglements[1]|=c,o&=~c}id(a),!(Il&6)&&(tu=Ce()+500,ad(0,!1))}}break;case 31:case 13:s=Zr(a,2),s!==null&&hu(s,a,2),bu(),sp(a,2)}if(a=mp(r),a===null&&Ed(e,t,r,hp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Ed(e,t,r,null,n)}}function mp(e){return e=Zt(e),gp(e)}var hp=null;function gp(e){if(hp=null,e=pt(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=l(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return hp=e,null}function _p(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(we()){case Te:return 2;case Ee:return 8;case De:case Oe:return 32;case ke:return 268435456;default:return 32}default:return 32}}var vp=!1,yp=null,bp=null,xp=null,Sp=new Map,Cp=new Map,wp=[],Tp=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Ep(e,t){switch(e){case`focusin`:case`focusout`:yp=null;break;case`dragenter`:case`dragleave`:bp=null;break;case`mouseover`:case`mouseout`:xp=null;break;case`pointerover`:case`pointerout`:Sp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Cp.delete(t.pointerId)}}function Dp(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=mt(t),t!==null&&cp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Op(e,t,n,r,i){switch(t){case`focusin`:return yp=Dp(yp,e,t,n,r,i),!0;case`dragenter`:return bp=Dp(bp,e,t,n,r,i),!0;case`mouseover`:return xp=Dp(xp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Sp.set(a,Dp(Sp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Cp.set(a,Dp(Cp.get(a)||null,e,t,n,r,i)),!0}return!1}function kp(e){var t=pt(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,nt(e.priority,function(){lp(n)});return}}else if(t===31){if(t=l(n),t!==null){e.blockedOn=t,nt(e.priority,function(){lp(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Ap(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=mp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Xt=r,n.target.dispatchEvent(r),Xt=null}else return t=mt(n),t!==null&&cp(t),e.blockedOn=n,!1;t.shift()}return!0}function jp(e,t,n){Ap(e)&&n.delete(t)}function Mp(){vp=!1,yp!==null&&Ap(yp)&&(yp=null),bp!==null&&Ap(bp)&&(bp=null),xp!==null&&Ap(xp)&&(xp=null),Sp.forEach(jp),Cp.forEach(jp)}function Np(e,n){e.blockedOn===n&&(e.blockedOn=null,vp||(vp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Mp)))}var Pp=null;function Fp(e){Pp!==e&&(Pp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Pp===e&&(Pp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(gp(r||n)===null)continue;break}var a=mt(n);a!==null&&(e.splice(t,3),t-=3,ys(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Ip(e){function t(t){return Np(t,e)}yp!==null&&Np(yp,e),bp!==null&&Np(bp,e),xp!==null&&Np(xp,e),Sp.forEach(t),Cp.forEach(t);for(var n=0;n<wp.length;n++){var r=wp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<wp.length&&(n=wp[0],n.blockedOn===null);)kp(n),n.blockedOn===null&&wp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[at]||null;if(typeof a==`function`)o||Fp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[at]||null)s=o.formAction;else if(gp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Fp(n)}}}function Lp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Rp(e){this._internalRoot=e}zp.prototype.render=Rp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;ap(n,pu(),e,t,null,null)},zp.prototype.unmount=Rp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;ap(e.current,2,null,e,null,null),bu(),t[ot]=null}};function zp(e){this._internalRoot=e}zp.prototype.unstable_scheduleHydration=function(e){if(e){var t=tt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<wp.length&&t!==0&&t<wp[n].priority;n++);wp.splice(n,0,e),n===0&&kp(e)}};var Bp=n.version;if(Bp!==`19.2.8`)throw Error(i(527,Bp,`19.2.8`));P.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=p(t),e=e===null?null:m(e),e=e===null?null:e.stateNode,e};var Vp={bundleType:0,version:`19.2.8`,rendererPackageName:`react-dom`,currentDispatcherRef:N,reconcilerVersion:`19.2.8`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Hp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Hp.isDisabled&&Hp.supportsFiber)try{Me=Hp.inject(Vp),Ne=Hp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Hs,s=Us,c=Ws;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=rp(e,1,!1,null,null,n,r,null,o,s,c,Lp),e[ot]=t.current,wd(e),new Rp(t)}})),m=n(((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=p()})),h=t(c(),1),g=m(),_=70;function v(e){return e.focusedPane===`sidebar`?`sidebar`:e.hasSelection||e.hasOpenPage?`content`:`sidebar`}function y(e){let t=e,n=new Set;return{get:()=>t,set(e){if(!Object.is(e,t)){t=e;for(let e of n)e()}},subscribe(e){return n.add(e),()=>n.delete(e)}}}function b(e){return(0,h.useSyncExternalStore)(e.subscribe,e.get,e.get)}var x=[`orbit`,`comet`,`rings`,`starlings`],S=`rove.web.lastSky`;function C(){try{return sessionStorage.getItem(S)}catch{return null}}var w=C();function T(){let e=x[(x.findIndex(e=>e===w)+1)%x.length];w=e;try{sessionStorage.setItem(S,e)}catch{}return e}function E(e,t){let n=e.filter(e=>e.rare&&!e.children);if(n.length===0)return[...e];let r=e.filter(e=>!n.includes(e)),i={label:t,section:`more`,children:n.map(({section:e,...t})=>t)},a=r.findIndex(e=>e.section===`danger`);return a<0?[...r,i]:[...r.slice(0,a),i,...r.slice(a)]}function D(e,t){for(let n of e){if(n.binding===t)return n;let e=n.children&&D(n.children,t);if(e)return e}}var O=y(null),k=y(null),A=null;k.subscribe(()=>{let e=document.activeElement;if(k.get()!==null){!A&&e instanceof HTMLElement&&!e.closest(`.dialog`)&&(A=e);return}let t=A;A=null,window.setTimeout(()=>{t?.isConnected&&(!document.activeElement||document.activeElement===document.body)&&t.focus()},0)});var j=y([]),ee=[`worktrees`,`update`,`kanban`,`routines`,`issues`,`mods`,`compare`,`usage`,`sessions`];function te(e,t){let n=null;try{n=t(JSON.parse(sessionStorage.getItem(e)??`null`))}catch{}let r=y(n);return r.subscribe(()=>{try{let t=r.get();t===null?sessionStorage.removeItem(e):sessionStorage.setItem(e,JSON.stringify(t))}catch{}}),r}var M=te(`rove.web.page`,e=>ee.find(t=>t===e)??null),ne=y(null),N=te(`rove.web.compareGroup`,e=>typeof e==`string`?e:null),P=te(`rove.web.sessionsRepo`,e=>typeof e==`string`?e:null),re=y(null),ie=`rove.web.newSession`;function F(){try{let e=JSON.parse(sessionStorage.getItem(ie)??`null`);return e&&typeof e==`object`?e:null}catch{return null}}var I=y(F());I.subscribe(()=>{try{let e=I.get();if(!e)return sessionStorage.removeItem(ie);let{prompt:t,...n}=e;sessionStorage.setItem(ie,JSON.stringify(n))}catch{}});function ae(e,t,n,r,i){L({...e?{repo:e}:{},...t?{baseBranch:t}:{},...n?{machine:n}:{},...r?{prompt:r}:{},...i?{ungrouped:!0}:{}})}function L(e){M.set(null),k.set(null),I.set({...e,sky:T()})}function R(){let e=new URLSearchParams(window.location.search),t=e.get(`prompt`);if(t===null)return;let n=e.get(`repo`)??void 0;e.delete(`prompt`),e.delete(`repo`);let r=e.toString();history.replaceState(null,``,`${window.location.pathname}${r?`?${r}`:``}${window.location.hash}`),ae(n,void 0,void 0,t)}var oe=1,se=4e3,ce=8e3;function z(e,t=`info`,n,r){if(j.get().some(n=>n.text===e&&n.tone===t&&!n.leaving))return;let i=oe++;j.set([...j.get(),{id:i,text:e,tone:t,...n?{action:n}:{}}].slice(-3)),window.setTimeout(()=>ue(i),r??(n?ce:se))}function le(){return typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches}function ue(e){if(!j.get().some(t=>t.id===e&&!t.leaving))return;let t=()=>j.set(j.get().filter(t=>t.id!==e));if(le()){t();return}j.set(j.get().map(t=>t.id===e?{...t,leaving:!0}:t)),window.setTimeout(t,140)}function B(){k.set(null)}var de=y(null),fe=null;function pe(){de.get()!==`drag`&&(fe!==null&&window.clearTimeout(fe),de.set(`slide`),fe=window.setTimeout(()=>de.set(null),240))}function me(e){fe!==null&&window.clearTimeout(fe),fe=null,de.set(e?`drag`:null)}var he=`(max-width: ${_*8-1}px)`,ge=y(`sidebar`),_e=y(0),ve=ge.get();ge.subscribe(()=>{let e=ge.get();ve===`workspace`&&e===`sidebar`&&_e.set(_e.get()+1),ve=e});var ye=()=>ge.set(`workspace`),be=()=>ge.set(`sidebar`);function xe(e){M.set(e),ye()}function Se(e){N.set(e),xe(`compare`)}function Ce(e){P.set(e),xe(`sessions`)}var we,Te=()=>(we??=window.matchMedia(he),we),Ee=()=>Te().matches,De=e=>{let t=Te();return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)};function Oe(){return(0,h.useSyncExternalStore)(e=>{let t=Te();return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)},()=>Te().matches,()=>!1)}function ke(e,t,n){return v({focusedPane:e,hasSelection:t,hasOpenPage:n})}var Ae=10,je=200,Me=`input, textarea, select, [contenteditable]`,Ne=`[data-back-panel]`,Pe=y(null),Fe=e=>t=>{if(t)return t.dataset.backPanel=``,t.addEventListener(`backswipe`,e),()=>{delete t.dataset.backPanel,t.removeEventListener(`backswipe`,e)}};function Ie(e){return e.closest(Ne)||(e.closest(`dialog`)||ge.get()!==`workspace`?null:document.querySelector(`.app > main`))}var Le=(e,t)=>e>0&&e>Math.abs(t),Re=(e,t,n)=>e>=t/3||e>=40&&n<250;function ze(e){for(let t=e;t;t=t.parentElement)if(t.scrollWidth>t.clientWidth&&/auto|scroll/.test(getComputedStyle(t).overflowX))return!0;return!1}function Be(){let e=null,t=(e,t,n)=>{let r=()=>{n?e.matches(Ne)?e.dispatchEvent(new Event(`backswipe`)):be():e.style.removeProperty(`--back-x`),Pe.set(null)},i=n?e.offsetWidth:0;e.style.setProperty(`--back-x`,`${i}px`);let a=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;e.animate({translate:[`${t}px`,`${i}px`]},{duration:a?0:je,easing:`cubic-bezier(0.2, 0, 0, 1)`}).finished.then(r,r)};document.addEventListener(`touchstart`,t=>{let{target:n}=t;if(e=null,Pe.get()||t.touches.length!==1||!Ee()||!(n instanceof Element)||n.closest(Me)||ze(n))return;let r=Ie(n);r&&(e={panel:r,x:t.touches[0].clientX,y:t.touches[0].clientY,at:t.timeStamp,dx:0,on:!1})},{passive:!0}),document.addEventListener(`touchmove`,t=>{if(!e)return;let n=t.touches[0].clientX-e.x;if(!e.on){let r=t.touches[0].clientY-e.y;if(Math.hypot(n,r)<Ae)return;if(t.touches.length!==1||!Le(n,r)||!document.getSelection()?.isCollapsed){e=null;return}e.on=!0,Pe.set(e.panel.matches(Ne)?`panel`:`app`)}t.preventDefault(),t.stopPropagation(),e.dx=Math.max(0,n),e.panel.style.setProperty(`--back-x`,`${e.dx}px`)},{capture:!0,passive:!1});let n=n=>{let r=e;if(e=null,!r?.on)return;let i=n.type===`touchend`&&Re(r.dx,window.innerWidth,n.timeStamp-r.at);t(r.panel,r.dx,i)};document.addEventListener(`touchend`,n),document.addEventListener(`touchcancel`,n)}var Ve=e({en:()=>He,zh:()=>Ue}),He={artifact:{preview:`preview`,source:`source`,open:`[ open ]`,loading:`Loading…`,tooLarge:`Too large to preview ({size}); the source view reads it as text.`,notPreviewable:`This file cannot be previewed.`,gone:`The file is gone.`,failed:`Could not read the file: {error}`}},Ue={artifact:{preview:`预览`,source:`源码`,open:`[ 打开 ]`,loading:`加载中…`,tooLarge:`文件太大,无法预览({size});可在源码视图中按文本查看。`,notPreviewable:`这个文件无法预览。`,gone:`文件已不存在。`,failed:`无法读取文件:{error}`}},We=e({en:()=>Ge,zh:()=>Ke}),Ge={compare:{title:`Compare attempts`,menu:`Compare attempts`,severalEngines:`[ compare engines ]`,oneEngine:`[ one engine ]`,needsPrompt:`Compare runs the prompt, so it needs one`,empty:`No attempts left in this round.`,noReply:`no reply yet`,noChanges:`no changes`,status:{working:`working`,waiting:`waiting for you`,error:`needs a look`,done:`done`,idle:`idle`},files:`files: {count}`,attempts:`attempts: {count}`,moreLines:`[ {count} more lines in the diff ]`,kept:`kept`,strip:`[ compare ]`,stackLabel:`Stacked tasks`,landBottom:`[ land bottom ]`,landBottomPhone:`Land bottom`,terminal:`[ terminal ]`,diff:`[ diff ]`,keep:`Keep this one`,unkeep:`[ unkeep ]`,keptToast:`kept {title}`,unkeptToast:`no longer kept: {title}`,keepFailed:`could not mark it kept: {error}`,archiveTitle:`Archive the other attempts?`,archiveBody:`Hides the other {count} from the rail and closes their sessions. Their worktrees and branches stay.`,archiveConfirm:`Archive`,archiveBusyTitle:`Some attempts are still working`,archiveBusyBody:`Archive them anyway? They are stopped; their worktrees and branches stay.`,archiveBusyConfirm:`Archive anyway`,archived:`archived {count} attempts`,archivedOne:`archived 1 attempt`,archiveFailed:`could not archive: {error}`}},Ke={compare:{title:`对比方案`,menu:`对比方案`,severalEngines:`[ 多引擎对比 ]`,oneEngine:`[ 单引擎 ]`,needsPrompt:`对比要运行提示词,请先写一个`,empty:`这一轮没有剩下的方案。`,noReply:`还没有回复`,noChanges:`没有改动`,status:{working:`运行中`,waiting:`等你处理`,error:`需要看一眼`,done:`已完成`,idle:`空闲`},files:`文件:{count}`,attempts:`方案:{count}`,moreLines:`[ diff 里还有 {count} 行 ]`,kept:`已保留`,strip:`[ 对比 ]`,stackLabel:`堆叠任务`,landBottom:`[ 合并底部 ]`,landBottomPhone:`合并底部`,terminal:`[ 终端 ]`,diff:`[ diff ]`,keep:`保留这个`,unkeep:`[ 取消保留 ]`,keptToast:`已保留 {title}`,unkeptToast:`已取消保留:{title}`,keepFailed:`无法标记保留:{error}`,archiveTitle:`归档其他方案?`,archiveBody:`把其余 {count} 个从侧栏收起,并结束它们的会话。worktree 和分支都保留。`,archiveConfirm:`归档`,archiveBusyTitle:`有方案还在运行`,archiveBusyBody:`仍要归档吗?它们会被停掉,worktree 和分支都保留。`,archiveBusyConfirm:`仍然归档`,archived:`已归档 {count} 个方案`,archivedOne:`已归档 1 个方案`,archiveFailed:`无法归档:{error}`}},qe=e({en:()=>Je,zh:()=>Ye}),Je={context:{used:`{percent} used`,usedTokens:`{tokens} used`,loading:`Reading context…`,none:`No context reading for this conversation: its engine records none, or it has not answered yet.`,failed:`Couldn't read context: {error}`,probing:`Reading what fills it…`,more:`+{count} more`,part:{system:`System prompt & tools`,system_prompt:`System prompt`,system_tools:`System tools`,mcp_tools:`MCP tools`,mcp_instructions:`MCP server instructions`,mcp_tools_deferred:`MCP tools (deferred)`,system_tools_deferred:`System tools (deferred)`,custom_agents:`Custom agents`,memory_files:`Memory files`,skills:`Skills`,messages:`Messages`,used:`Used`,free:`Free space`}}},Ye={context:{used:`已用 {percent}`,usedTokens:`已用 {tokens}`,loading:`正在读取上下文…`,none:`这个会话没有上下文读数:它的引擎不记录,或者还没回复过。`,failed:`读取上下文失败:{error}`,probing:`正在读取构成…`,more:`另有 {count} 项`,part:{system:`系统提示与工具`,system_prompt:`系统提示`,system_tools:`系统工具`,mcp_tools:`MCP 工具`,mcp_instructions:`MCP 服务器说明`,mcp_tools_deferred:`MCP 工具(按需加载)`,system_tools_deferred:`系统工具(按需加载)`,custom_agents:`自定义 agent`,memory_files:`记忆文件`,skills:`技能`,messages:`消息`,used:`已用`,free:`剩余空间`}}},Xe=e({en:()=>Ze,zh:()=>Qe}),Ze={dialog:{cancel:`Cancel`,save:`Save`,close:`Close`},crash:{title:`This page hit an error. Copy the report below before reloading.`,copy:`Copy report`,copied:`Copied`,reload:`Reload`},updatePrompt:{title:`Rove {version} is available`,body:`This computer runs {current}. Update installs the new version on it.`,yes:`Update`,later:`Not now`,skip:`Skip this version`},whatsNew:{title:`What's new`,continue:`Continue`,openRelease:`Open release notes`,keys:`q / esc`},menu:{cancel:`Cancel`,closeTab:`Close tab`,newChat:`New conversation`,newChatPick:`New conversation with…`,retryEdit:`Retry with edited prompt…`,retryNoPrompt:`This task has no stored prompt`,startNow:`Start now`,cancelStart:`Cancel scheduled start`,continueEngine:`Continue in another engine…`,newShell:`New shell`,newChatNoFolder:`New conversation (no folder)`,renameTab:`Rename tab`,splitRight:`Split right`,splitDown:`Split down`,renamePane:`Rename pane`,closePane:`Close pane`,newTask:`New task`,rename:`Rename`,pin:`Pin`,unpin:`Unpin`,setStatus:`Set status`,copy:`Copy`,copyWhat:{id:`Task ID`,branch:`Branch name`,path:`Worktree path`},renameBranch:`Rename branch`,changeEngine:`Change engine`,land:`Land into base branch`,delete:`Delete`,removeSession:`Remove session`,archiveMany:`Archive {count} sessions`,archivedMany:`Archived {count} sessions`,archiveManyBusy:`These are still working or waiting on you:`,removeMany:`Remove {count} sessions`,removedMany:`Removed {count} sessions`,removeManyTitle:`Remove {count} sessions?`,removeManyBody:`Ends each session, closes its tabs and removes its worktree folder. Git branches stay; a child moves up to its parent's place.`,removeManyDirtyTitle:`Some worktrees have uncommitted changes`,removeManyDirtyBody:`Removing them anyway loses those changes:`,viewSessions:`View all sessions`,more:`More`,copied:`copied {text}`,copyFailed:`the browser refused the clipboard`,nothingToCopy:`this task has no {what} yet`,what:{id:`id`,branch:`branch`,path:`worktree path`}},confirm:{closeTabTitle:`Close "{tab}"?`,closeTabBody:`Stops the session in this tab. The task and its worktree stay.`,closePaneTitle:`Close "{pane}"?`,closePaneBody:`The engine session in this pane ends. The tab's other panes stay.`,delete:`delete`,forceDelete:`force delete`},newTask:{title:`new task`,repo:`project`,engine:`engine`,notReady:`not installed or not signed in`,taskTitle:`title`,titlePlaceholder:`optional; derived from the prompt otherwise`,prompt:`first message`,promptPlaceholder:`optional; ⌘↵ creates`,create:`create`,needRepo:`pick a project first`},newChat:{title:`new conversation`,prompt:`first message`,start:`start`,promptPlaceholder:`optional; empty opens the engine without a message`},newSession:{title:`New session`,tagline:`Pick a project and a model, then describe the task. The session starts with your first message.`,placeholder:`Describe a task or ask a question`,start:`Start session`,later:`Start later…`,laterConfirm:`Start later`,laterPlaceholder:`22:30 · tomorrow 9:00 · +30m`,laterBad:`That is not a time ahead. Try 22:30, tomorrow 9:00 or +2h.`,laterSet:`Starts at {time}. Until then it waits under Routines, where you can cancel it.`,retryArchiveTitle:`Archive "{title}"?`,retryArchiveBody:`The retry has started. Archive the original? Its session is closed; nothing is deleted.`,needRepo:`Pick a project first`,needPrompt:`Describe the task first`,repo:`Project`,repoSearch:`Search projects or type a path`,repoEmpty:`No matching project`,noFolder:`No folder`,chooseFolder:`Choose folder`,openFolder:`+ Open folder…`,openFolderHeading:`Open folder`,folderFilter:`Paste a path or filter folders…`,folderUse:`Use "{name}"`,folderBack:`← Back`,folderParent:`parent`,folderGit:`git`,folderEmpty:`No subfolders`,folderHint:`← up · → open · enter select · esc back`,cloneRow:`Clone {source}`,cloning:`Cloning {source}`,githubGroup:`Your GitHub repositories`,githubLoading:`Reading your GitHub repositories…`,branch:`Branch`,branchSearch:`Search branches`,branches:`Branches`,branchName:`Branch name, shared by every repo`,branchNamePlaceholder:`derived from the prompt`,primary:`primary`,repoCount:`{count} repos: the first is the primary`,branchEmpty:`No matching branch`,model:`Model`,modelHeading:`Model for this session`,engine:`Engine`,shell:`Shell`,shellPlaceholder:`A command to run first, or leave empty for a plain terminal`,shellOneLine:`A shell command is one line`,modelDefault:`Default`,more:`More`,attach:`Attach`,attachHint:`Add files to the first message; you can also paste or drop them on the prompt`,removeAttachment:`Remove {name}`,worktree:`Worktree`,worktreeOn:`Runs in its own worktree and branch. Click to run in the project's checkout instead`,worktreeOff:`Runs in the project's checkout as it is, on its current branch. Click for a worktree`,worktreeMulti:`A task across several repos always gets a worktree in each`,worktreeNoGit:`Not a git repository: the session runs in the folder itself`,worktreeRemoteRequired:`An agent running on that machine, or a repo it still has to clone, always gets a worktree`,plainMulti:`A folder without git can't join a task across several repos`,machine:`Machine`,thisMachine:`This machine`,machineAuto:`Auto`,machineAutoNote:`Starts on the least busy machine that has this project.`,startedOn:`Started on {machine}`,retry:`Retry`,agentPlace:`Agent runs on`,agentHereNote:`Uses this machine's engines and sign-in. Only the files and commands are on {machine}.`,agentThereNote:`The engine runs on {machine}, so it must be installed and signed in there.`,cloneRowOn:`Clone {source} on {machine}`,cloningOn:`Cloning {source} on {machine}`,startingOn:`Starting the task on {machine}`,engineMissing:`{engine} · not installed`,engineMissingOn:`{engine} is not installed on {machine}. Install it there, or pick another engine.`,repoSearchRemote:`Search or type owner/repo`,remoteOffline:`{machine} is offline`,remoteOutdated:`{machine} runs a Rove too old to list its projects`,remoteFailed:`Could not read {machine}'s projects: {message}`,remoteNone:`{machine} has no projects yet. Type owner/repo to clone one there`,remoteLoading:`Reading {machine}'s projects…`,branchTypeRef:`Type a branch or ref to start from`,branchRemoteDefault:`Its current branch`},sessions:{title:`Sessions`,active:`Active`,archived:`Archived`,allProjects:`all projects`,emptyActive:`No sessions here. Start one from New task.`,emptyArchived:`Nothing archived here. Archive a session from its row menu.`,keys:`tab project · a archived · enter open · q close`},search:{tasks:`Tasks`,archived:`{repo} · archived, pick to unarchive`,commands:`Commands`,inConversations:`In conversations`,searching:`searching…`,none:`Nothing said matches “{query}”.`,you:`you`,agent:`agent`,truncated:`Stopped early to stay fast; add a word to narrow it.`,skipped:`{count} task(s) not searched: another machine's, or an engine Rove cannot read.`},taskops:{publishTitle:`publish to the remote`,publishBody:`{branch} lives on {host}. Push it from there and open a pull request?`,publishButton:`push & open PR`,publishedPr:`pushed {branch} — PR {url}`,publishedNoPr:`pushed {branch}, but no PR: {reason}`,set:`set`,retire:`delete`,close:`close`,moveHint:`j/k move · enter or esc done`,fixSent:`asked the agent to fix the failing checks`,forkNeedsMessage:`a message is required to fork a task`,forkLeftBehind:`Started from the last commit — uncommitted work stays in the original task ({reason})`,forkBranch:`fork from branch`,openedExternal:`opened in the Mac's app`}},Qe={dialog:{cancel:`取消`,save:`保存`,close:`关闭`},crash:{title:`页面出错了。刷新前先把下面的报告复制下来。`,copy:`复制报告`,copied:`已复制`,reload:`刷新`},updatePrompt:{title:`Rove {version} 可以更新了`,body:`这台电脑运行的是 {current}。点更新会在它上面安装新版本。`,yes:`更新`,later:`暂不`,skip:`跳过这个版本`},whatsNew:{title:`更新内容`,continue:`继续`,openRelease:`打开发布说明`,keys:`q / esc`},menu:{cancel:`取消`,closeTab:`关闭该标签页`,newChat:`新建会话`,newChatPick:`选择引擎新建会话…`,retryEdit:`改提示词后重试…`,retryNoPrompt:`这个任务没有保存的提示词`,startNow:`立即启动`,cancelStart:`取消定时启动`,continueEngine:`换个引擎继续…`,newShell:`新建终端`,newChatNoFolder:`新建会话(无文件夹)`,renameTab:`重命名标签页`,splitRight:`向右分屏`,splitDown:`向下分屏`,renamePane:`重命名分屏`,closePane:`关闭分屏`,newTask:`新建任务`,rename:`重命名`,pin:`置顶`,unpin:`取消置顶`,setStatus:`设置状态`,copy:`复制`,copyWhat:{id:`任务 ID`,branch:`分支名`,path:`worktree 路径`},renameBranch:`重命名分支`,changeEngine:`切换引擎`,land:`合入基础分支`,delete:`删除`,removeSession:`移除会话`,archiveMany:`归档 {count} 个会话`,archivedMany:`已归档 {count} 个会话`,archiveManyBusy:`这些会话还在运行或在等你:`,removeMany:`移除 {count} 个会话`,removedMany:`已移除 {count} 个会话`,removeManyTitle:`移除 {count} 个会话?`,removeManyBody:`结束每个会话,关闭它的标签页,并删除它的 worktree 文件夹。git 分支会保留;子会话会上移到父会话的位置。`,removeManyDirtyTitle:`有些 worktree 还有未提交的改动`,removeManyDirtyBody:`仍然移除会丢掉这些改动:`,viewSessions:`查看全部会话`,more:`更多`,copied:`已复制 {text}`,copyFailed:`浏览器拒绝了剪贴板访问`,nothingToCopy:`这个任务还没有{what}`,what:{id:`ID`,branch:`分支`,path:`worktree 路径`}},confirm:{closeTabTitle:`关闭「{tab}」?`,closeTabBody:`停止这个标签里的会话。任务和它的 worktree 会保留。`,closePaneTitle:`关闭「{pane}」?`,closePaneBody:`这个分屏里的引擎会话会结束。标签里的其他分屏会保留。`,delete:`删除`,forceDelete:`强制删除`},newTask:{title:`新建任务`,repo:`项目`,engine:`引擎`,notReady:`未安装或未登录`,taskTitle:`标题`,titlePlaceholder:`可选;不填就从第一条消息生成`,prompt:`第一条消息`,promptPlaceholder:`可选;⌘↵ 创建`,create:`创建`,needRepo:`先选一个项目`},newChat:{title:`新建会话`,prompt:`第一条消息`,start:`开始`,promptPlaceholder:`可选;留空则直接打开引擎,不发消息`},newSession:{title:`新会话`,tagline:`选好项目和模型,再描述任务。会话从你的第一条消息开始。`,placeholder:`描述一个任务,或提个问题`,start:`开始会话`,later:`稍后启动…`,laterConfirm:`稍后启动`,laterPlaceholder:`22:30 · 明天 9:00 · +30m`,laterBad:`这不是一个未来的时间。试试 22:30、明天 9:00 或 +2h。`,laterSet:`{time} 启动。在那之前它列在「例行任务」里,可以在那里取消。`,retryArchiveTitle:`归档「{title}」?`,retryArchiveBody:`重试已经开始。要把原来的会话归档吗?它的进程会结束,不会删除任何东西。`,needRepo:`先选一个项目`,needPrompt:`先描述一下任务`,repo:`项目`,repoSearch:`搜索项目,或输入路径`,repoEmpty:`没有匹配的项目`,noFolder:`无文件夹`,chooseFolder:`选择文件夹`,openFolder:`+ 打开文件夹…`,openFolderHeading:`打开文件夹`,folderFilter:`粘贴路径或过滤文件夹…`,folderUse:`使用「{name}」`,folderBack:`← 返回`,folderParent:`上级目录`,folderGit:`git`,folderEmpty:`没有子文件夹`,folderHint:`← 上一级 · → 进入 · enter 选定 · esc 返回`,cloneRow:`克隆 {source}`,cloning:`正在克隆 {source}`,githubGroup:`你的 GitHub 仓库`,githubLoading:`正在读取你的 GitHub 仓库…`,branch:`分支`,branchSearch:`搜索分支`,branches:`分支`,branchName:`分支名,所有仓库共用`,branchNamePlaceholder:`不填就从提示词生成`,primary:`主仓库`,repoCount:`{count} 个仓库,第一个是主仓库`,branchEmpty:`没有匹配的分支`,model:`模型`,modelHeading:`本次会话的模型`,engine:`引擎`,shell:`Shell`,shellPlaceholder:`先运行的命令,留空就只开一个终端`,shellOneLine:`Shell 命令只能写一行`,modelDefault:`默认`,more:`更多`,attach:`附件`,attachHint:`给第一条消息加文件;也可以直接粘贴或拖到输入框里`,removeAttachment:`移除 {name}`,worktree:`Worktree`,worktreeOn:`在独立的 worktree 和分支里运行。点击改为直接在项目目录里运行`,worktreeOff:`直接在项目目录里运行,用它当前的分支。点击改为独立 worktree`,worktreeMulti:`跨多个仓库的任务每个仓库都会有 worktree`,worktreeNoGit:`不是 git 仓库:会话直接在这个文件夹里运行`,worktreeRemoteRequired:`agent 跑在那台机器上,或仓库还要先克隆时,总会建 worktree`,plainMulti:`没有 git 的文件夹不能加入跨多个仓库的任务`,machine:`机器`,thisMachine:`本机`,machineAuto:`自动`,machineAutoNote:`在有这个项目、且最空闲的机器上启动。`,startedOn:`已在 {machine} 上启动`,retry:`重试`,agentPlace:`agent 运行在`,agentHereNote:`用本机的引擎和登录,只有文件和命令在 {machine} 上。`,agentThereNote:`引擎在 {machine} 上运行,那边要装好并登录。`,cloneRowOn:`在 {machine} 上克隆 {source}`,cloningOn:`正在 {machine} 上克隆 {source}`,startingOn:`正在 {machine} 上启动任务`,engineMissing:`{engine} · 未安装`,engineMissingOn:`{machine} 上没有安装 {engine}。在那台机器上装好,或者换一个引擎。`,repoSearchRemote:`搜索,或输入 owner/repo`,remoteOffline:`{machine} 已离线`,remoteOutdated:`{machine} 上的 Rove 太旧,列不出它的项目`,remoteFailed:`读不到 {machine} 上的项目:{message}`,remoteNone:`{machine} 上还没有项目。输入 owner/repo 就能在那里克隆`,remoteLoading:`正在读取 {machine} 上的项目…`,branchTypeRef:`输入要基于的分支或 ref`,branchRemoteDefault:`它当前的分支`},sessions:{title:`会话`,active:`进行中`,archived:`已归档`,allProjects:`全部项目`,emptyActive:`这里还没有会话。从「新建任务」开始一个。`,emptyArchived:`这里没有已归档的会话。在会话的右键菜单里归档。`,keys:`tab 切换项目 · a 已归档 · enter 打开 · q 关闭`},search:{tasks:`任务`,archived:`{repo} · 已归档,选中即恢复`,commands:`命令`,inConversations:`在对话里`,searching:`搜索中…`,none:`没有说过「{query}」。`,you:`你`,agent:`agent`,truncated:`为了快提前停了;多加一个词缩小范围。`,skipped:`有 {count} 个任务没搜:在别的机器上,或 Rove 读不了它的引擎记录。`},taskops:{publishTitle:`推送到远端`,publishBody:`{branch} 在 {host} 上。要从那台机器推送它并开一个 PR 吗?`,publishButton:`推送并开 PR`,publishedPr:`已推送 {branch} — PR {url}`,publishedNoPr:`已推送 {branch},但没开成 PR:{reason}`,set:`设置`,retire:`删除`,close:`关闭`,moveHint:`j/k 移动 · enter 或 esc 完成`,fixSent:`已请 agent 修复失败的检查`,forkNeedsMessage:`fork 任务需要填写消息`,forkLeftBehind:`已从最近一次提交开始——未提交的改动留在原任务里({reason})`,forkBranch:`基于分支`,openedExternal:`已在 Mac 上用系统应用打开`}},$e=e({en:()=>et,zh:()=>tt}),et={machines:{title:`Machines`,open:`[ machines ]`,none:"No other machines registered. Add one with `rove machine add`.",newHere:`[ new task here ]`,tasks:`[ tasks ]`,repos:`[ repos ]`,hide:`[ hide ]`,noTasks:`no tasks`,noRepos:`no repos`,loading:`…`,reposFailed:`couldn't read its repos: {message}`,update:`[ update rove ]`,updating:`updating… this can take a few minutes`,updated:`updated: v{from} → v{to}`,upToDate:`already on the newest build of this machine's channel (v{to})`,updateFailed:`couldn't update it: {message}`,reason:{refused:`ssh was refused (nothing is listening or a firewall is in the way)`,timeout:`ssh timed out`,"host-key-changed":`its ssh host key changed; check it, then update known_hosts`,"host-key-unverified":`its ssh host key is not known yet; connect once by hand to trust it`,"auth-denied":`ssh refused the login (no key or password accepted)`,unresolved:`its hostname does not resolve`,"ssh-failed":`ssh failed`,"no-rove":`rove is not installed there`,"no-daemon":`its rove daemon is not running`,"bad-status":`it answered with something rove could not read`,handshake:`the link came up but the handshake failed`,"no-forwarding":`ssh forwarding is disabled there`,lost:`the link dropped; reconnecting`}}},tt={machines:{title:`机器`,open:`[ 机器 ]`,none:"没有注册其他机器。用 `rove machine add` 添加。",newHere:`[ 在这台新建任务 ]`,tasks:`[ 任务 ]`,repos:`[ 仓库 ]`,hide:`[ 收起 ]`,noTasks:`没有任务`,noRepos:`没有仓库`,loading:`…`,reposFailed:`读不到它的仓库:{message}`,update:`[ 更新 rove ]`,updating:`正在更新…可能要几分钟`,updated:`已更新:v{from} → v{to}`,upToDate:`已经是这台机器所在通道的最新版(v{to})`,updateFailed:`更新失败:{message}`,reason:{refused:`ssh 被拒绝(没有进程在监听,或被防火墙挡住)`,timeout:`ssh 超时`,"host-key-changed":`它的 ssh 主机密钥变了;确认无误后更新 known_hosts`,"host-key-unverified":`还不认识它的 ssh 主机密钥;先手动连一次以信任它`,"auth-denied":`ssh 拒绝了登录(没有被接受的密钥或密码)`,unresolved:`它的主机名解析不了`,"ssh-failed":`ssh 失败`,"no-rove":`那里没有安装 rove`,"no-daemon":`它的 rove 守护进程没在运行`,"bad-status":`它返回了 rove 读不懂的内容`,handshake:`链路通了但握手失败`,"no-forwarding":`那里禁用了 ssh 端口转发`,lost:`链路断了;正在重连`}}},nt=e({en:()=>rt,zh:()=>it}),rt={files:{autoFix:{on:`[ auto-fix CI ]`,off:`[ turn off ]`,count:`auto-fix {n}/{max}`,stopped:`auto-fix stopped {n}/{max}`,hint:`When checks fail on a new push and the agent is idle, send it the failing logs. At most once per push, 3 times in all, then it stops and tells your Inbox.`},stripCreate:`[ create PR ]`,stripFixCi:`[ fix CI ]`,stripConflicts:`[ resolve conflicts ]`,stripComments:`[ address comments ]`,stripArchive:`[ archive ]`,stripFilled:`prompt is in the input; edit it and press Enter`,stripNoEngine:`No engine session open in this task — nowhere to put the prompt.`,stripUnavailable:`couldn't read the PR's checks: {detail}`,stripNothing:`nothing to ask the agent about right now`,openPort:`[ open :{port} ]`,checks:{title:`checks`,summary:`{pass}/{total} passed`,failed:`{count} failed`,running:`{count} running`,none:`no checks`,refresh:`[ refresh ]`,loading:`…`,unavailable:`couldn't read the PR: {detail}`,log:`[ log ]`,hideLog:`[ hide ]`,noLog:`no log excerpt for this job`,logUnavailable:`couldn't read the log: {detail}`,more:`{count} more not shown`,took:`{duration}`,tookAgo:`{duration} · {age} ago`,finishedAgo:`{age} ago`,runningFor:`running {elapsed}`},merge:{draft:`draft`,conflicts:`conflicts`,behind:`behind base`,unstable:`checks not passing`,blocked:`blocked`,clean:`mergeable`,approved:`approved`,changes:`changes requested`,reviewRequired:`review required`},stripCommit:`[ commit ]`,prRequested:`asked the agent to create the PR`,remoteNoExternal:`this file is on {host}; open it there`,mentionNoEngine:`No engine session open in this task — nothing to mention into.`,menu:{attach:`Attach as context`,diff:`Open diff`,copy:`Copy`,copyRelative:`Relative path`,copyAbsolute:`Absolute path`,copyName:`Filename`,openExternal:`Open in the Mac's app`,reveal:`Show in Finder`,terminal:`Open in terminal`},landTodos:`{count} todo(s) on this task are still unchecked.`,emptyAll:`(empty worktree)`,truncated:`Only the first {count} files are listed.`,state:{conflict:`conflict`,deleted:`deleted`,modified:`modified`,untracked:`untracked`,added:`added`,renamed:`renamed`}},preview:{loading:`loading…`,whole:`whole worktree`,unknown:`nothing to show`,binary:`binary file — not shown as text`,empty:`no changes`,noHunks:`no text changes ({kind})`,modeFile:`[ file ]`,modeDiff:`[ diff ]`,askInChat:`ask in chat`,askInChatHint:`Put the selected lines in the engine's prompt`,sent:`sent {count} notes to the engine`,sentOne:`sent 1 note to the engine`,notSent:`notes not sent: {reason}`},review:{comment:`comment`,range:`range`,count:`{count} comments`,countOne:`1 comment`,send:`send {count}`,sending:`sending…`,edit:`edit`,drop:`drop`,moved:`moved`,movedHint:`The code under this comment changed since it was written.`,show:`Show in the diff`,noteOn:`note on {location}`,noteEditOn:`edit note on {location}`,noteAdd:`[ add note ]`,noteSave:`[ save note ]`,noteCancel:`[ cancel ]`,fold:`Fold {path}`,unfold:`Unfold {path}`,foldAll:`fold all`,unfoldAll:`unfold all`,ignoreWs:`[ ws ]`,ignoreWsHint:`Hide whitespace-only changes (git diff -w)`,viewed:`[ viewed ]`,markViewed:`Mark {path} viewed`,viewedOn:`[x] viewed`,unmarkViewed:`Unmark {path} viewed`,totals:`{files} files · +{added} −{removed}`,totalsOne:`1 file · +{added} −{removed}`,viewedCount:`{done}/{files} viewed`,nextFile:`[ next file ]`,nextComment:`[ next comment ]`,scopeMenu:`{base} → {scope} ▾`,compareAgainst:`Compare against {base}…`,baseDefault:`task base`,baseBranch:`branch`,baseRemote:`remote`,baseTag:`tag`,basePlaceholder:`branch, tag or commit`,shape:{effort:`effort {n}/5`,lockfile:`{count} lockfile`,lockfiles:`{count} lockfiles`,generated:`{count} generated`,tests:`{count} tests`,config:`{count} config`,docs:`{count} docs`,source:`{count} source`},scopeWorking:`Uncommitted changes`,scopeBranch:`Committed changes`,scopeTask:`All changes`,lineClipped:`… {count} more characters`,notSupported:`This bridge is older than the page and can't do that; restart it.`},panel:{tabs:`Browser tabs`,files:`Files`,chat:`Chat`,diff:`Diff`,browser:`Browser`,quota:`Context`,resize:`Drag to resize the panel, double-click to reset`,new:`New tab`,close:`Close`,expand:`Expand the side panel`,restore:`Restore the side panel size`,closeOthers:`Close others`,resizeSplit:`Drag to resize, double-click to reset the widths`},browser:{address:`Address`,placeholder:`https://… or localhost:3000`,back:`Back`,forward:`Forward`,reload:`Reload`,openTab:`Open in a new tab`,invalid:`That is not a web address; only http and https pages open here.`,outside:`Only files inside this task's directory open here.`,empty:`Enter a web address, or a local dev server.`,emptyPorts:`Enter a web address. A dev server started in this task is listed here.`,noFrame:`Only https pages open here; this address uses plain http. Use ↗ to open it in a new tab.`,self:`That address is Rove itself, which can't be framed. Use ↗ to open it in a new tab.`,refuses:`{host} doesn't allow being shown inside another page.`,unreachable:`{host} can't be reached from here.`,remote:`{host} runs on the Rove machine, not on this one.`,annotate:`Mark up this page`,pen:`Pen`,box:`Box`,text:`Text`,undo:`Undo the last mark`,addToChat:`Add to chat`,annotateDone:`Stop marking`,noEngine:`Open an agent session in this task first; the picture goes into its prompt.`,captureFailed:`Couldn't take a picture of the page: {error}`,handToAgent:`Hand to agent`,takeControl:`Agent · Take control`,handedToAgent:`Handed {id} to agent`,handedToHuman:`Took control of {id}`}},it={files:{autoFix:{on:`[ 自动修复 CI ]`,off:`[ 关闭 ]`,count:`自动修复 {n}/{max}`,stopped:`自动修复已停止 {n}/{max}`,hint:`检查在新提交上失败且代理空闲时,自动把失败日志发给它。每次提交最多一次、总共 3 次,之后停止并通知收件箱。`},stripCreate:`[ 创建 PR ]`,stripFixCi:`[ 修复 CI ]`,stripConflicts:`[ 解决冲突 ]`,stripComments:`[ 处理评论 ]`,stripArchive:`[ 归档 ]`,stripFilled:`提示词已放进输入框,修改后按 Enter 发送`,stripNoEngine:`这个任务没有打开的引擎会话,提示词无处可放。`,stripUnavailable:`读不到 PR 的检查结果:{detail}`,stripNothing:`现在没有需要让代理处理的事`,openPort:`[ 打开 :{port} ]`,checks:{title:`检查`,summary:`{pass}/{total} 通过`,failed:`{count} 个失败`,running:`{count} 个进行中`,none:`没有检查`,refresh:`[ 刷新 ]`,loading:`…`,unavailable:`读不到这个 PR:{detail}`,log:`[ 日志 ]`,hideLog:`[ 收起 ]`,noLog:`这个作业没有日志摘录`,logUnavailable:`读不到日志:{detail}`,more:`还有 {count} 个未显示`,took:`{duration}`,tookAgo:`{duration} · {age}前`,finishedAgo:`{age}前`,runningFor:`已运行 {elapsed}`},merge:{draft:`草稿`,conflicts:`有冲突`,behind:`落后于基线`,unstable:`检查未通过`,blocked:`被阻塞`,clean:`可合并`,approved:`已批准`,changes:`要求修改`,reviewRequired:`需要评审`},stripCommit:`[ 提交 ]`,prRequested:`已让代理去创建 PR`,remoteNoExternal:`这个文件在 {host} 上,请到那台机器上打开`,mentionNoEngine:`这个任务没有打开的引擎会话——没有地方可以提及。`,menu:{attach:`作为上下文附加`,diff:`打开 diff`,copy:`复制`,copyRelative:`相对路径`,copyAbsolute:`绝对路径`,copyName:`文件名`,openExternal:`用 Mac 上的应用打开`,reveal:`在 Finder 中显示`,terminal:`在终端中打开`},landTodos:`此任务还有 {count} 条待办未完成。`,emptyAll:`(空工作区)`,truncated:`只列出了前 {count} 个文件。`,state:{conflict:`有冲突`,deleted:`已删除`,modified:`已修改`,untracked:`未跟踪`,added:`已新增`,renamed:`已重命名`}},preview:{loading:`加载中…`,whole:`整个工作区`,unknown:`没有可显示的内容`,binary:`二进制文件——不以文本显示`,empty:`没有变更`,noHunks:`没有文本变更({kind})`,modeFile:`[ 文件 ]`,modeDiff:`[ 差异 ]`,askInChat:`在对话里问`,askInChatHint:`把选中的几行放进引擎的输入框`,sent:`已把 {count} 条批注发给引擎`,sentOne:`已把 1 条批注发给引擎`,notSent:`批注没有发出:{reason}`},review:{comment:`批注`,range:`选范围`,count:`{count} 条批注`,countOne:`1 条批注`,send:`发送 {count} 条`,sending:`发送中…`,edit:`编辑`,drop:`删除`,moved:`已移位`,movedHint:`这条批注下面的代码在写下之后变了。`,show:`在差异里定位`,noteOn:`批注 {location}`,noteEditOn:`编辑批注 {location}`,noteAdd:`[ 添加批注 ]`,noteSave:`[ 保存批注 ]`,noteCancel:`[ 取消 ]`,fold:`折叠 {path}`,unfold:`展开 {path}`,foldAll:`全部折叠`,unfoldAll:`全部展开`,ignoreWs:`[ ws ]`,ignoreWsHint:`隐藏仅空白的改动 (git diff -w)`,viewed:`[ 已看 ]`,markViewed:`标记 {path} 为已看`,viewedOn:`[x] 已看`,unmarkViewed:`取消 {path} 的已看`,totals:`{files} 个文件 · +{added} −{removed}`,totalsOne:`1 个文件 · +{added} −{removed}`,viewedCount:`已看 {done}/{files}`,nextFile:`[ 下个文件 ]`,nextComment:`[ 下条评论 ]`,scopeMenu:`{base} → {scope} ▾`,compareAgainst:`对比基准:{base}…`,baseDefault:`任务基准`,baseBranch:`分支`,baseRemote:`远程`,baseTag:`标签`,basePlaceholder:`分支、标签或提交`,shape:{effort:`评审量 {n}/5`,lockfile:`{count} 个锁文件`,lockfiles:`{count} 个锁文件`,generated:`{count} 个生成文件`,tests:`{count} 个测试`,config:`{count} 个配置`,docs:`{count} 个文档`,source:`{count} 个源码`},scopeWorking:`未提交的改动`,scopeBranch:`已提交的改动`,scopeTask:`全部改动`,lineClipped:`…还有 {count} 个字符`,notSupported:`这个 bridge 比页面旧,做不了这个;请重启它。`},panel:{tabs:`浏览器标签页`,files:`文件`,chat:`对话`,diff:`差异`,browser:`浏览器`,quota:`上下文`,resize:`拖动调整侧边栏宽度,双击复位`,new:`新建标签页`,close:`关闭`,expand:`展开侧边栏`,restore:`还原侧边栏大小`,closeOthers:`关闭其他`,resizeSplit:`拖动调整宽度,双击恢复默认宽度`},browser:{address:`地址`,placeholder:`https://… 或 localhost:3000`,back:`后退`,forward:`前进`,reload:`刷新`,openTab:`在新标签页打开`,invalid:`这不是网页地址;这里只能打开 http 和 https 页面。`,outside:`这里只能打开这个任务目录里的文件。`,empty:`输入网页地址,或本地开发服务器的地址。`,emptyPorts:`输入网页地址。在这个任务里启动的开发服务器会列在这里。`,noFrame:`这里只能打开 https 页面;这个地址用的是 http。点 ↗ 在新标签页打开。`,self:`这个地址就是 Rove 本身,不能嵌入。点 ↗ 在新标签页打开。`,refuses:`{host} 不允许嵌入其他页面。`,unreachable:`从这里访问不到 {host}。`,remote:`{host} 运行在 Rove 所在的机器上,不在这台设备上。`,annotate:`在页面上标注`,pen:`画笔`,box:`方框`,text:`文字`,undo:`撤销上一笔`,addToChat:`加到对话`,annotateDone:`结束标注`,noEngine:`先在这个任务里打开一个 agent 会话;截图会进它的输入框。`,captureFailed:`没能截下这个页面:{error}`,handToAgent:`交给代理`,takeControl:`代理控制中 · 接管`,handedToAgent:`已将 {id} 交给代理`,handedToHuman:`已接管 {id}`}},at=e({en:()=>ot,zh:()=>st}),ot={quote:{action:`[ quote ]`,title:`Put the selection in the prompt as a quote`,atMenu:`The agent is waiting on a choice. Answer it first, then quote.`,notReady:`The agent's prompt is not taking pasted text yet. Try again in a moment.`},snippets:{empty:`No snippets yet.`,name:`Name`,namePlaceholder:`review`,text:`Text`,textPlaceholder:`Review this change for bugs and missing tests.`,add:`[ add ]`,save:`[ save ]`,edit:`[ edit ]`,cancel:`[ cancel ]`,remove:`[ remove ]`,removed:`Removed @{name}`,badName:`A name is letters, digits, - or _, up to 32.`,phone:{add:`Add snippet`,save:`Save`,cancel:`Cancel`,remove:`Delete snippet`}}},st={quote:{action:`[ 引用 ]`,title:`把选中的内容作为引用放进提示词`,atMenu:`agent 正在等你做选择。先回答它,再引用。`,notReady:`agent 的输入框暂时还不接受粘贴。稍等一下再试。`},snippets:{empty:`还没有片段。`,name:`名称`,namePlaceholder:`review`,text:`内容`,textPlaceholder:`检查这次改动有没有 bug,有没有漏掉的测试。`,add:`[ 添加 ]`,save:`[ 保存 ]`,edit:`[ 编辑 ]`,cancel:`[ 取消 ]`,remove:`[ 删除 ]`,removed:`已删除 @{name}`,badName:`名称只能是字母、数字、- 或 _,最长 32 位。`,phone:{add:`添加片段`,save:`保存`,cancel:`取消`,remove:`删除片段`}}},ct=e({en:()=>lt,zh:()=>ut}),lt={rail:{markNotice:`Task rows now start with the engine's icon. Change it in Settings → Appearance.`,markNoticeUndo:`Old look`,inbox:`inbox {count}`,empty:`no tasks yet`,skillCue:`skill missing`,newTask:`New task`,update:`Update`,settings:`Settings`,noProject:`Ungrouped`,connector:{weixin:`WeChat`,lark:`Lark`,inbox:`External messages`},expandGroup:`Expand {name}`,collapseGroup:`Collapse {name}`,reconnecting:`reconnecting`,extensions:`Extensions`,addExtension:`Add extension`,newTaskMode:{worktree:`worktree`,folder:`folder`},lastOpened:`Last opened`,state:{needs:`needs you`,working:`working`,ready:`ready`,idle:`idle`},extraRepos:`{count} more repos in this task`,extraReposOne:`1 more repo in this task`,todos:`{done} of {total} todos done`,todosOne:`{done} of 1 todo done`,startsAt:`Starts {time}`,pr:{state:{open:`open`,merged:`merged`,closed:`closed`},many:`{count} PRs in this task and its children`,checks:{conflict:`conflicts with its base`,failing:`checks failing`,passing:`checks passing`,pending:`checks running`}},searchPlaceholder:`fuzzy filter`,engineSwitched:`Engine → {engine} (applies on reopen)`,engineSwitchFailed:`could not switch engine: {error}`},inbox:{title:`inbox`,hints:`↑↓ move · enter open · d ack · esc close`,attention:`attention`,recent:`recent`,empty:`no pending attention`,send:`Send`,openTab:`[ open ]`,noOutput:`no output yet`,outputUnreadable:`couldn't read this tab's output`,replyPlaceholder:`reply to this session`,gateKept:`Saved; the engine isn't running and will get it with its next message.`,gateAnswer:`Answer`,phone:{title:`Inbox`,empty:`Nothing needs you right now.`,ackAll:`Ack all`,ack:`Ack`,open:`Open`,reply:`Reply`},state:{done:`done`,needsInput:`needs input`,error:`error`,rateLimited:`rate limited`,dead:`engine exited`,restored:`restored after restart`,routineFailed:`routine needs you`,decision:`needs a decision`,reportMissing:`report missing`}}},ut={rail:{markNotice:`任务行现在以引擎图标开头。可在设置 → 外观里更改。`,markNoticeUndo:`换回旧样式`,inbox:`收件箱 {count}`,empty:`还没有任务`,skillCue:`缺少技能`,newTask:`新建任务`,update:`更新`,settings:`设置`,noProject:`未分组`,connector:{weixin:`微信`,lark:`飞书`,inbox:`外部消息`},expandGroup:`展开{name}`,collapseGroup:`收起{name}`,reconnecting:`重连中`,extensions:`扩展`,addExtension:`添加扩展`,newTaskMode:{worktree:`worktree`,folder:`文件夹`},lastOpened:`上次打开`,state:{needs:`等你处理`,working:`进行中`,ready:`待收尾`,idle:`空闲`},extraRepos:`这个任务还含 {count} 个仓库`,extraReposOne:`这个任务还含 1 个仓库`,todos:`{done}/{total} 条待办已完成`,todosOne:`{done}/1 条待办已完成`,startsAt:`{time} 启动`,pr:{state:{open:`进行中`,merged:`已合并`,closed:`已关闭`},many:`这个任务及子任务共 {count} 个 PR`,checks:{conflict:`与基础分支冲突`,failing:`检查未通过`,passing:`检查已通过`,pending:`检查进行中`}},searchPlaceholder:`模糊搜索`,engineSwitched:`引擎 → {engine}(重新打开后生效)`,engineSwitchFailed:`切换引擎失败:{error}`},inbox:{title:`收件箱`,hints:`↑↓ 移动 · enter 打开 · d 已阅 · esc 关闭`,attention:`待处理`,recent:`最近使用`,empty:`暂无待处理`,send:`发送`,openTab:`[ 打开 ]`,noOutput:`还没有输出`,outputUnreadable:`读不到这个标签页的输出`,replyPlaceholder:`回复这个会话`,gateKept:`已记下;引擎没在运行,下次发消息时一并送达。`,gateAnswer:`回答`,phone:{title:`收件箱`,empty:`现在没有需要你处理的。`,ackAll:`全部已阅`,ack:`已阅`,open:`打开`,reply:`回复`},state:{done:`完成`,needsInput:`需要输入`,error:`出错`,rateLimited:`限流`,dead:`引擎已退出`,restored:`重启后已恢复`,routineFailed:`例行任务需要处理`,decision:`等你决定`,reportMissing:`未回报`}}},dt=e({en:()=>ft,zh:()=>pt}),ft={reviewQueue:{sourceIssues:`[ issues ]`,sourceReviews:`[ PRs waiting on me ]`,palette:`Review queue`,title:`PRs waiting on me`,empty:`No open PR asks for your review in your projects.`,other:`{count} more in projects Rove doesn't know.`,draft:`draft`,fork:`fork`,checksPassing:`checks passing`,checksFailing:`checks failing`,checksPending:`checks running`,start:`[ review ]`,preparing:`Fetching #{number}…`,failed:`Could not start the review of #{number}: {error}`,gh:{missing:"The `gh` CLI is not installed or not on PATH.",unauthenticated:"`gh` is not signed in: run `gh auth login` on this Mac.",failed:`GitHub could not be read just now. Press r to retry.`},prompt:`Review pull request #{number} in {repo}: {title}
10
+ `).replace(Md,``)}function Pd(e,t){return t=Nd(t),Nd(e)===t}function Fd(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Ut(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Ut(e,``+r);break;case`className`:Dt(e,`class`,r);break;case`tabIndex`:Dt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Dt(e,n,r);break;case`style`:H(e,r,o);break;case`data`:if(t!==`object`){Dt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Jt(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof o==`function`&&(n===`formAction`?(t!==`input`&&Fd(e,t,`name`,a.name,a,null),Fd(e,t,`formEncType`,a.formEncType,a,null),Fd(e,t,`formMethod`,a.formMethod,a,null),Fd(e,t,`formTarget`,a.formTarget,a,null)):(Fd(e,t,`encType`,a.encType,a,null),Fd(e,t,`method`,a.method,a,null),Fd(e,t,`target`,a.target,a,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Jt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Yt);break;case`onScroll`:r!=null&&xd(`scroll`,e);break;case`onScrollEnd`:r!=null&&xd(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Jt(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:xd(`beforetoggle`,e),xd(`toggle`,e),Et(e,`popover`,r);break;case`xlinkActuate`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Ot(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Ot(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Ot(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Et(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=Kt.get(n)||n,Et(e,n,r))}}function Id(e,t,n,r,a,o){switch(n){case`style`:H(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Ut(e,r):(typeof r==`number`||typeof r==`bigint`)&&Ut(e,``+r);break;case`onScroll`:r!=null&&xd(`scroll`,e);break;case`onScrollEnd`:r!=null&&xd(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=Yt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!yt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[at]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):Et(e,n,r)}}}function Ld(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:xd(`error`,e),xd(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Fd(e,t,o,s,n,null)}}a&&Fd(e,t,`srcSet`,n.srcSet,n,null),r&&Fd(e,t,`src`,n.src,n,null);return;case`input`:xd(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:Fd(e,t,r,d,n,null)}}Rt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in xd(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Fd(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Bt(e,!!r,n,!0):Bt(e,!!r,t,!1);return;case`textarea`:for(s in xd(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:Fd(e,t,s,c,n,null)}Ht(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Fd(e,t,l,r,n,null)}return;case`dialog`:xd(`beforetoggle`,e),xd(`toggle`,e),xd(`cancel`,e),xd(`close`,e);break;case`iframe`:case`object`:xd(`load`,e);break;case`video`:case`audio`:for(r=0;r<vd.length;r++)xd(vd[r],e);break;case`image`:xd(`error`,e),xd(`load`,e);break;case`details`:xd(`toggle`,e);break;case`embed`:case`source`:case`link`:xd(`error`,e),xd(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Fd(e,t,u,r,n,null)}return;default:if(Gt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Id(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Fd(e,t,c,r,n,null))}function Rd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Fd(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:a=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&Fd(e,t,p,m,r,f)}}Lt(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Fd(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&Fd(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Bt(e,!!n,n?[]:``,!1):Bt(e,!!n,t,!0)):Bt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Fd(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&Fd(e,t,s,a,r,o)}Vt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Fd(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Fd(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Fd(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:Fd(e,t,u,p,r,m)}return;default:if(Gt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Id(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Id(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Fd(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Fd(e,t,f,p,r,m)}function zd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Bd(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&zd(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&zd(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Vd=null,Hd=null;function Ud(e){return e.nodeType===9?e:e.ownerDocument}function Wd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Gd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Kd(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var qd=null;function Jd(){var e=window.event;return e&&e.type===`popstate`?e!==qd&&(qd=e,!0):(qd=null,!1)}var Yd=typeof setTimeout==`function`?setTimeout:void 0,Xd=typeof clearTimeout==`function`?clearTimeout:void 0,Zd=typeof Promise==`function`?Promise:void 0,Qd=typeof queueMicrotask==`function`?queueMicrotask:Zd===void 0?Yd:function(e){return Zd.resolve(null).then(e).catch($d)};function $d(e){setTimeout(function(){throw e})}function ef(e){return e===`head`}function tf(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Ip(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)gf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,gf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[dt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&gf(e.ownerDocument.body)}n=i}while(n);Ip(t)}function nf(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function rf(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:rf(n),ft(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function af(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[dt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=df(e.nextSibling),e===null)break}return null}function of(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=df(e.nextSibling),e===null))return null;return e}function sf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=df(e.nextSibling),e===null))return null;return e}function cf(e){return e.data===`$?`||e.data===`$~`}function lf(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function uf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function df(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var ff=null;function pf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return df(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function mf(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function hf(e,t,n){switch(t=Ud(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function gf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);ft(e)}var _f=new Map,vf=new Set;function yf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var bf=P.d;P.d={f:xf,r:Sf,D:Tf,C:Ef,L:Df,m:Of,X:Af,S:kf,M:jf};function xf(){var e=bf.f(),t=bu();return e||t}function Sf(e){var t=mt(e);t!==null&&t.tag===5&&t.type===`form`?xs(t):bf.r(e)}var Cf=typeof document>`u`?null:document;function wf(e,t,n){var r=Cf;if(r&&typeof t==`string`&&t){var i=It(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),vf.has(i)||(vf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Ld(t,`link`,e),_t(t),r.head.appendChild(t)))}}function Tf(e){bf.D(e),wf(`dns-prefetch`,e,null)}function Ef(e,t){bf.C(e,t),wf(`preconnect`,e,t)}function Df(e,t,n){bf.L(e,t,n);var r=Cf;if(r&&e&&t){var i=`link[rel="preload"][as="`+It(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+It(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+It(n.imageSizes)+`"]`)):i+=`[href="`+It(e)+`"]`;var a=i;switch(t){case`style`:a=Nf(e);break;case`script`:a=Lf(e)}_f.has(a)||(e=h({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),_f.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Pf(a))||t===`script`&&r.querySelector(Rf(a))||(t=r.createElement(`link`),Ld(t,`link`,e),_t(t),r.head.appendChild(t)))}}function Of(e,t){bf.m(e,t);var n=Cf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+It(r)+`"][href="`+It(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Lf(e)}if(!_f.has(a)&&(e=h({rel:`modulepreload`,href:e},t),_f.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Rf(a)))return}r=n.createElement(`link`),Ld(r,`link`,e),_t(r),n.head.appendChild(r)}}}function kf(e,t,n){bf.S(e,t,n);var r=Cf;if(r&&e){var i=gt(r).hoistableStyles,a=Nf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Pf(a)))s.loading=5;else{e=h({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=_f.get(a))&&Vf(e,n);var c=o=r.createElement(`link`);_t(c),Ld(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Bf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Af(e,t){bf.X(e,t);var n=Cf;if(n&&e){var r=gt(n).hoistableScripts,i=Lf(e),a=r.get(i);a||(a=n.querySelector(Rf(i)),a||(e=h({src:e,async:!0},t),(t=_f.get(i))&&Hf(e,t),a=n.createElement(`script`),_t(a),Ld(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function jf(e,t){bf.M(e,t);var n=Cf;if(n&&e){var r=gt(n).hoistableScripts,i=Lf(e),a=r.get(i);a||(a=n.querySelector(Rf(i)),a||(e=h({src:e,async:!0,type:`module`},t),(t=_f.get(i))&&Hf(e,t),a=n.createElement(`script`),_t(a),Ld(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Mf(e,t,n,r){var a=(a=se.current)?yf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Nf(n.href),n=gt(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Nf(n.href);var o=gt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Pf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),_f.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},_f.set(e,n),o||If(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Lf(n),n=gt(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Nf(e){return`href="`+It(e)+`"`}function Pf(e){return`link[rel="stylesheet"][`+e+`]`}function Ff(e){return h({},e,{"data-precedence":e.precedence,precedence:null})}function If(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Ld(t,`link`,n),_t(t),e.head.appendChild(t))}function Lf(e){return`[src="`+It(e)+`"]`}function Rf(e){return`script[async]`+e}function zf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+It(n.href)+`"]`);if(r)return t.instance=r,_t(r),r;var a=h({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),_t(r),Ld(r,`style`,a),Bf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Nf(n.href);var o=e.querySelector(Pf(a));if(o)return t.state.loading|=4,t.instance=o,_t(o),o;r=Ff(n),(a=_f.get(a))&&Vf(r,a),o=(e.ownerDocument||e).createElement(`link`),_t(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Ld(o,`link`,r),t.state.loading|=4,Bf(o,n.precedence,e),t.instance=o;case`script`:return o=Lf(n.src),(a=e.querySelector(Rf(o)))?(t.instance=a,_t(a),a):(r=n,(a=_f.get(o))&&(r=h({},n),Hf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),_t(a),Ld(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Bf(r,n.precedence,e));return t.instance}function Bf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Vf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Hf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Uf=null;function Wf(e,t,n){if(Uf===null){var r=new Map,i=Uf=new Map;i.set(n,r)}else i=Uf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[dt]||a[it]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Gf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Kf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function qf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Jf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Nf(r.href),a=t.querySelector(Pf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Zf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,_t(a);return}a=t.ownerDocument||t,r=Ff(r),(i=_f.get(i))&&Vf(r,i),a=a.createElement(`link`),_t(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Ld(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Zf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Yf=0;function Xf(e,t){return e.stylesheets&&e.count===0&&$f(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&$f(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Yf===0&&(Yf=62500*Bd());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&$f(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Yf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Zf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)$f(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Qf=null;function $f(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Qf=new Map,t.forEach(ep,e),Qf=null,Zf.call(e))}function ep(e,t){if(!(t.state.loading&4)){var n=Qf.get(e);if(n)var r=n.get(null);else{n=new Map,Qf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=Zf.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var tp={$$typeof:C,Provider:null,Consumer:null,_currentValue:re,_currentValue2:re,_threadCount:0};function np(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=qe(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=qe(0),this.hiddenUpdates=qe(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function rp(e,t,n,r,i,a,o,s,c,l,u,d){return e=new np(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=ni(3,null,null,t),e.current=a,a.stateNode=e,t=ra(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Fa(a),e}function ip(e){return e?(e=ei,e):ei}function ap(e,t,n,r,i,a){i=ip(i),r.context===null?r.context=i:r.pendingContext=i,r=La(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Ra(e,r,t),n!==null&&(hu(n,e,t),za(n,e,t))}function op(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function sp(e,t){op(e,t),(e=e.alternate)&&op(e,t)}function cp(e){if(e.tag===13||e.tag===31){var t=Zr(e,67108864);t!==null&&hu(t,e,67108864),sp(e,67108864)}}function lp(e){if(e.tag===13||e.tag===31){var t=pu();t=$e(t);var n=Zr(e,t);n!==null&&hu(n,e,t),sp(e,t)}}var up=!0;function dp(e,t,n,r){var i=N.T;N.T=null;var a=P.p;try{P.p=2,pp(e,t,n,r)}finally{P.p=a,N.T=i}}function fp(e,t,n,r){var i=N.T;N.T=null;var a=P.p;try{P.p=8,pp(e,t,n,r)}finally{P.p=a,N.T=i}}function pp(e,t,n,r){if(up){var i=mp(r);if(i===null)Ed(e,t,r,hp,n),Ep(e,r);else if(Op(i,e,t,n,r))r.stopPropagation();else if(Ep(e,r),t&4&&-1<Tp.indexOf(e)){for(;i!==null;){var a=mt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=He(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Fe(o);s.entanglements[1]|=c,o&=~c}id(a),!(Il&6)&&(tu=Ce()+500,ad(0,!1))}}break;case 31:case 13:s=Zr(a,2),s!==null&&hu(s,a,2),bu(),sp(a,2)}if(a=mp(r),a===null&&Ed(e,t,r,hp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Ed(e,t,r,null,n)}}function mp(e){return e=Zt(e),gp(e)}var hp=null;function gp(e){if(hp=null,e=pt(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=l(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return hp=e,null}function _p(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(we()){case Te:return 2;case Ee:return 8;case De:case Oe:return 32;case ke:return 268435456;default:return 32}default:return 32}}var vp=!1,yp=null,bp=null,xp=null,Sp=new Map,Cp=new Map,wp=[],Tp=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Ep(e,t){switch(e){case`focusin`:case`focusout`:yp=null;break;case`dragenter`:case`dragleave`:bp=null;break;case`mouseover`:case`mouseout`:xp=null;break;case`pointerover`:case`pointerout`:Sp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Cp.delete(t.pointerId)}}function Dp(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=mt(t),t!==null&&cp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Op(e,t,n,r,i){switch(t){case`focusin`:return yp=Dp(yp,e,t,n,r,i),!0;case`dragenter`:return bp=Dp(bp,e,t,n,r,i),!0;case`mouseover`:return xp=Dp(xp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Sp.set(a,Dp(Sp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Cp.set(a,Dp(Cp.get(a)||null,e,t,n,r,i)),!0}return!1}function kp(e){var t=pt(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,nt(e.priority,function(){lp(n)});return}}else if(t===31){if(t=l(n),t!==null){e.blockedOn=t,nt(e.priority,function(){lp(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Ap(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=mp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Xt=r,n.target.dispatchEvent(r),Xt=null}else return t=mt(n),t!==null&&cp(t),e.blockedOn=n,!1;t.shift()}return!0}function jp(e,t,n){Ap(e)&&n.delete(t)}function Mp(){vp=!1,yp!==null&&Ap(yp)&&(yp=null),bp!==null&&Ap(bp)&&(bp=null),xp!==null&&Ap(xp)&&(xp=null),Sp.forEach(jp),Cp.forEach(jp)}function Np(e,n){e.blockedOn===n&&(e.blockedOn=null,vp||(vp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Mp)))}var Pp=null;function Fp(e){Pp!==e&&(Pp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Pp===e&&(Pp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(gp(r||n)===null)continue;break}var a=mt(n);a!==null&&(e.splice(t,3),t-=3,ys(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Ip(e){function t(t){return Np(t,e)}yp!==null&&Np(yp,e),bp!==null&&Np(bp,e),xp!==null&&Np(xp,e),Sp.forEach(t),Cp.forEach(t);for(var n=0;n<wp.length;n++){var r=wp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<wp.length&&(n=wp[0],n.blockedOn===null);)kp(n),n.blockedOn===null&&wp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[at]||null;if(typeof a==`function`)o||Fp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[at]||null)s=o.formAction;else if(gp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Fp(n)}}}function Lp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Rp(e){this._internalRoot=e}zp.prototype.render=Rp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;ap(n,pu(),e,t,null,null)},zp.prototype.unmount=Rp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;ap(e.current,2,null,e,null,null),bu(),t[ot]=null}};function zp(e){this._internalRoot=e}zp.prototype.unstable_scheduleHydration=function(e){if(e){var t=tt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<wp.length&&t!==0&&t<wp[n].priority;n++);wp.splice(n,0,e),n===0&&kp(e)}};var Bp=n.version;if(Bp!==`19.2.8`)throw Error(i(527,Bp,`19.2.8`));P.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=p(t),e=e===null?null:m(e),e=e===null?null:e.stateNode,e};var Vp={bundleType:0,version:`19.2.8`,rendererPackageName:`react-dom`,currentDispatcherRef:N,reconcilerVersion:`19.2.8`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Hp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Hp.isDisabled&&Hp.supportsFiber)try{Me=Hp.inject(Vp),Ne=Hp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Hs,s=Us,c=Ws;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=rp(e,1,!1,null,null,n,r,null,o,s,c,Lp),e[ot]=t.current,wd(e),new Rp(t)}})),m=n(((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=p()})),h=t(c(),1),g=m(),_=70;function v(e){return e.focusedPane===`sidebar`?`sidebar`:e.hasSelection||e.hasOpenPage?`content`:`sidebar`}function y(e){let t=e,n=new Set;return{get:()=>t,set(e){if(!Object.is(e,t)){t=e;for(let e of n)e()}},subscribe(e){return n.add(e),()=>n.delete(e)}}}function b(e){return(0,h.useSyncExternalStore)(e.subscribe,e.get,e.get)}var x=[`orbit`,`comet`,`rings`,`starlings`],S=`rove.web.lastSky`;function C(){try{return sessionStorage.getItem(S)}catch{return null}}var w=C();function T(){let e=x[(x.findIndex(e=>e===w)+1)%x.length];w=e;try{sessionStorage.setItem(S,e)}catch{}return e}function E(e,t){let n=e.filter(e=>e.rare&&!e.children);if(n.length===0)return[...e];let r=e.filter(e=>!n.includes(e)),i={label:t,section:`more`,children:n.map(({section:e,...t})=>t)},a=r.findIndex(e=>e.section===`danger`);return a<0?[...r,i]:[...r.slice(0,a),i,...r.slice(a)]}function D(e,t){for(let n of e){if(n.binding===t)return n;let e=n.children&&D(n.children,t);if(e)return e}}var O=y(null),k=y(null),A=null;k.subscribe(()=>{let e=document.activeElement;if(k.get()!==null){!A&&e instanceof HTMLElement&&!e.closest(`.dialog`)&&(A=e);return}let t=A;A=null,window.setTimeout(()=>{t?.isConnected&&(!document.activeElement||document.activeElement===document.body)&&t.focus()},0)});var j=y([]),ee=[`worktrees`,`update`,`kanban`,`routines`,`issues`,`mods`,`compare`,`usage`,`sessions`];function te(e,t){let n=null;try{n=t(JSON.parse(sessionStorage.getItem(e)??`null`))}catch{}let r=y(n);return r.subscribe(()=>{try{let t=r.get();t===null?sessionStorage.removeItem(e):sessionStorage.setItem(e,JSON.stringify(t))}catch{}}),r}var M=te(`rove.web.page`,e=>ee.find(t=>t===e)??null),ne=y(null),N=te(`rove.web.compareGroup`,e=>typeof e==`string`?e:null),P=te(`rove.web.sessionsRepo`,e=>typeof e==`string`?e:null),re=y(null),ie=`rove.web.newSession`;function F(){try{let e=JSON.parse(sessionStorage.getItem(ie)??`null`);return e&&typeof e==`object`?e:null}catch{return null}}var I=y(F());I.subscribe(()=>{try{let e=I.get();if(!e)return sessionStorage.removeItem(ie);let{prompt:t,...n}=e;sessionStorage.setItem(ie,JSON.stringify(n))}catch{}});function ae(e,t,n,r,i){L({...e?{repo:e}:{},...t?{baseBranch:t}:{},...n?{machine:n}:{},...r?{prompt:r}:{},...i?{ungrouped:!0}:{}})}function L(e){M.set(null),k.set(null),I.set({...e,sky:T()})}function R(){let e=new URLSearchParams(window.location.search),t=e.get(`prompt`);if(t===null)return;let n=e.get(`repo`)??void 0;e.delete(`prompt`),e.delete(`repo`);let r=e.toString();history.replaceState(null,``,`${window.location.pathname}${r?`?${r}`:``}${window.location.hash}`),ae(n,void 0,void 0,t)}var oe=1,se=4e3,ce=8e3;function z(e,t=`info`,n,r){if(j.get().some(n=>n.text===e&&n.tone===t&&!n.leaving))return;let i=oe++;j.set([...j.get(),{id:i,text:e,tone:t,...n?{action:n}:{}}].slice(-3)),window.setTimeout(()=>ue(i),r??(n?ce:se))}function le(){return typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches}function ue(e){if(!j.get().some(t=>t.id===e&&!t.leaving))return;let t=()=>j.set(j.get().filter(t=>t.id!==e));if(le()){t();return}j.set(j.get().map(t=>t.id===e?{...t,leaving:!0}:t)),window.setTimeout(t,140)}function B(){k.set(null)}var de=y(null),fe=null;function pe(){de.get()!==`drag`&&(fe!==null&&window.clearTimeout(fe),de.set(`slide`),fe=window.setTimeout(()=>de.set(null),240))}function me(e){fe!==null&&window.clearTimeout(fe),fe=null,de.set(e?`drag`:null)}var he=`(max-width: ${_*8-1}px)`,ge=y(`sidebar`),_e=y(0),ve=ge.get();ge.subscribe(()=>{let e=ge.get();ve===`workspace`&&e===`sidebar`&&_e.set(_e.get()+1),ve=e});var ye=()=>ge.set(`workspace`),be=()=>ge.set(`sidebar`);function xe(e){M.set(e),ye()}function Se(e){N.set(e),xe(`compare`)}function Ce(e){P.set(e),xe(`sessions`)}var we,Te=()=>(we??=window.matchMedia(he),we),Ee=()=>Te().matches,De=e=>{let t=Te();return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)};function Oe(){return(0,h.useSyncExternalStore)(e=>{let t=Te();return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)},()=>Te().matches,()=>!1)}function ke(e,t,n){return v({focusedPane:e,hasSelection:t,hasOpenPage:n})}var Ae=10,je=200,Me=`input, textarea, select, [contenteditable]`,Ne=`[data-back-panel]`,Pe=y(null),Fe=e=>t=>{if(t)return t.dataset.backPanel=``,t.addEventListener(`backswipe`,e),()=>{delete t.dataset.backPanel,t.removeEventListener(`backswipe`,e)}};function Ie(e){return e.closest(Ne)||(e.closest(`dialog`)||ge.get()!==`workspace`?null:document.querySelector(`.app > main`))}var Le=(e,t)=>e>0&&e>Math.abs(t),Re=(e,t,n)=>e>=t/3||e>=40&&n<250;function ze(e){for(let t=e;t;t=t.parentElement)if(t.scrollWidth>t.clientWidth&&/auto|scroll/.test(getComputedStyle(t).overflowX))return!0;return!1}function Be(){let e=null,t=(e,t,n)=>{let r=()=>{n?e.matches(Ne)?e.dispatchEvent(new Event(`backswipe`)):be():e.style.removeProperty(`--back-x`),Pe.set(null)},i=n?e.offsetWidth:0;e.style.setProperty(`--back-x`,`${i}px`);let a=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;e.animate({translate:[`${t}px`,`${i}px`]},{duration:a?0:je,easing:`cubic-bezier(0.2, 0, 0, 1)`}).finished.then(r,r)};document.addEventListener(`touchstart`,t=>{let{target:n}=t;if(e=null,Pe.get()||t.touches.length!==1||!Ee()||!(n instanceof Element)||n.closest(Me)||ze(n))return;let r=Ie(n);r&&(e={panel:r,x:t.touches[0].clientX,y:t.touches[0].clientY,at:t.timeStamp,dx:0,on:!1})},{passive:!0}),document.addEventListener(`touchmove`,t=>{if(!e)return;let n=t.touches[0].clientX-e.x;if(!e.on){let r=t.touches[0].clientY-e.y;if(Math.hypot(n,r)<Ae)return;if(t.touches.length!==1||!Le(n,r)||!document.getSelection()?.isCollapsed){e=null;return}e.on=!0,Pe.set(e.panel.matches(Ne)?`panel`:`app`)}t.preventDefault(),t.stopPropagation(),e.dx=Math.max(0,n),e.panel.style.setProperty(`--back-x`,`${e.dx}px`)},{capture:!0,passive:!1});let n=n=>{let r=e;if(e=null,!r?.on)return;let i=n.type===`touchend`&&Re(r.dx,window.innerWidth,n.timeStamp-r.at);t(r.panel,r.dx,i)};document.addEventListener(`touchend`,n),document.addEventListener(`touchcancel`,n)}var Ve=e({en:()=>He,zh:()=>Ue}),He={artifact:{preview:`preview`,source:`source`,open:`[ open ]`,loading:`Loading…`,tooLarge:`Too large to preview ({size}); the source view reads it as text.`,notPreviewable:`This file cannot be previewed.`,gone:`The file is gone.`,failed:`Could not read the file: {error}`}},Ue={artifact:{preview:`预览`,source:`源码`,open:`[ 打开 ]`,loading:`加载中…`,tooLarge:`文件太大,无法预览({size});可在源码视图中按文本查看。`,notPreviewable:`这个文件无法预览。`,gone:`文件已不存在。`,failed:`无法读取文件:{error}`}},We=e({en:()=>Ge,zh:()=>Ke}),Ge={compare:{title:`Compare attempts`,menu:`Compare attempts`,severalEngines:`[ compare engines ]`,oneEngine:`[ one engine ]`,needsPrompt:`Compare runs the prompt, so it needs one`,empty:`No attempts left in this round.`,noReply:`no reply yet`,noChanges:`no changes`,status:{working:`working`,waiting:`waiting for you`,error:`needs a look`,done:`done`,idle:`idle`},files:`files: {count}`,attempts:`attempts: {count}`,moreLines:`[ {count} more lines in the diff ]`,kept:`kept`,strip:`[ compare ]`,stackLabel:`Stacked tasks`,landBottom:`[ land bottom ]`,landBottomPhone:`Land bottom`,terminal:`[ terminal ]`,diff:`[ diff ]`,keep:`Keep this one`,unkeep:`[ unkeep ]`,keptToast:`kept {title}`,unkeptToast:`no longer kept: {title}`,keepFailed:`could not mark it kept: {error}`,archiveTitle:`Archive the other attempts?`,archiveBody:`Hides the other {count} from the rail and closes their sessions. Their worktrees and branches stay.`,archiveConfirm:`Archive`,archiveBusyTitle:`Some attempts are still working`,archiveBusyBody:`Archive them anyway? They are stopped; their worktrees and branches stay.`,archiveBusyConfirm:`Archive anyway`,archived:`archived {count} attempts`,archivedOne:`archived 1 attempt`,archiveFailed:`could not archive: {error}`}},Ke={compare:{title:`对比方案`,menu:`对比方案`,severalEngines:`[ 多引擎对比 ]`,oneEngine:`[ 单引擎 ]`,needsPrompt:`对比要运行提示词,请先写一个`,empty:`这一轮没有剩下的方案。`,noReply:`还没有回复`,noChanges:`没有改动`,status:{working:`运行中`,waiting:`等你处理`,error:`需要看一眼`,done:`已完成`,idle:`空闲`},files:`文件:{count}`,attempts:`方案:{count}`,moreLines:`[ diff 里还有 {count} 行 ]`,kept:`已保留`,strip:`[ 对比 ]`,stackLabel:`堆叠任务`,landBottom:`[ 合并底部 ]`,landBottomPhone:`合并底部`,terminal:`[ 终端 ]`,diff:`[ diff ]`,keep:`保留这个`,unkeep:`[ 取消保留 ]`,keptToast:`已保留 {title}`,unkeptToast:`已取消保留:{title}`,keepFailed:`无法标记保留:{error}`,archiveTitle:`归档其他方案?`,archiveBody:`把其余 {count} 个从侧栏收起,并结束它们的会话。worktree 和分支都保留。`,archiveConfirm:`归档`,archiveBusyTitle:`有方案还在运行`,archiveBusyBody:`仍要归档吗?它们会被停掉,worktree 和分支都保留。`,archiveBusyConfirm:`仍然归档`,archived:`已归档 {count} 个方案`,archivedOne:`已归档 1 个方案`,archiveFailed:`无法归档:{error}`}},qe=e({en:()=>Je,zh:()=>Ye}),Je={context:{used:`{percent} used`,usedTokens:`{tokens} used`,loading:`Reading context…`,none:`No context reading for this conversation: its engine records none, or it has not answered yet.`,failed:`Couldn't read context: {error}`,probing:`Reading what fills it…`,more:`+{count} more`,part:{system:`System prompt & tools`,system_prompt:`System prompt`,system_tools:`System tools`,mcp_tools:`MCP tools`,mcp_instructions:`MCP server instructions`,mcp_tools_deferred:`MCP tools (deferred)`,system_tools_deferred:`System tools (deferred)`,custom_agents:`Custom agents`,memory_files:`Memory files`,skills:`Skills`,messages:`Messages`,used:`Used`,free:`Free space`}}},Ye={context:{used:`已用 {percent}`,usedTokens:`已用 {tokens}`,loading:`正在读取上下文…`,none:`这个会话没有上下文读数:它的引擎不记录,或者还没回复过。`,failed:`读取上下文失败:{error}`,probing:`正在读取构成…`,more:`另有 {count} 项`,part:{system:`系统提示与工具`,system_prompt:`系统提示`,system_tools:`系统工具`,mcp_tools:`MCP 工具`,mcp_instructions:`MCP 服务器说明`,mcp_tools_deferred:`MCP 工具(按需加载)`,system_tools_deferred:`系统工具(按需加载)`,custom_agents:`自定义 agent`,memory_files:`记忆文件`,skills:`技能`,messages:`消息`,used:`已用`,free:`剩余空间`}}},Xe=e({en:()=>Ze,zh:()=>Qe}),Ze={dialog:{cancel:`Cancel`,save:`Save`,close:`Close`},crash:{title:`This page hit an error. Copy the report below before reloading.`,copy:`Copy report`,copied:`Copied`,reload:`Reload`},updatePrompt:{title:`Rove {version} is available`,body:`This computer runs {current}. Update installs the new version on it.`,yes:`Update`,later:`Not now`,skip:`Skip this version`},whatsNew:{title:`What's new`,continue:`Continue`,openRelease:`Open release notes`,keys:`q / esc`},menu:{cancel:`Cancel`,closeTab:`Close tab`,newChat:`New conversation`,newChatPick:`New conversation with…`,retryEdit:`Retry with edited prompt…`,retryNoPrompt:`This task has no stored prompt`,startNow:`Start now`,cancelStart:`Cancel scheduled start`,continueEngine:`Continue in another engine…`,newShell:`New shell`,newChatNoFolder:`New conversation (no folder)`,renameTab:`Rename tab`,splitRight:`Split right`,splitDown:`Split down`,renamePane:`Rename pane`,closePane:`Close pane`,newTask:`New task`,rename:`Rename`,pin:`Pin`,unpin:`Unpin`,setStatus:`Set status`,copy:`Copy`,copyWhat:{id:`Task ID`,branch:`Branch name`,path:`Worktree path`},renameBranch:`Rename branch`,changeEngine:`Change engine`,land:`Land into base branch`,delete:`Delete`,removeSession:`Remove session`,archiveMany:`Archive {count} sessions`,archivedMany:`Archived {count} sessions`,archiveManyBusy:`These are still working or waiting on you:`,removeMany:`Remove {count} sessions`,removedMany:`Removed {count} sessions`,removeManyTitle:`Remove {count} sessions?`,removeManyBody:`Ends each session, closes its tabs and removes its worktree folder. Git branches stay; a child moves up to its parent's place.`,removeManyDirtyTitle:`Some worktrees have uncommitted changes`,removeManyDirtyBody:`Removing them anyway loses those changes:`,viewSessions:`View all sessions`,more:`More`,copied:`copied {text}`,copyFailed:`the browser refused the clipboard`,nothingToCopy:`this task has no {what} yet`,what:{id:`id`,branch:`branch`,path:`worktree path`}},confirm:{closeTabTitle:`Close "{tab}"?`,closeTabBody:`Stops the session in this tab. The task and its worktree stay.`,closePaneTitle:`Close "{pane}"?`,closePaneBody:`The engine session in this pane ends. The tab's other panes stay.`,delete:`delete`,forceDelete:`force delete`},newTask:{title:`new task`,repo:`project`,engine:`engine`,notReady:`not installed or not signed in`,taskTitle:`title`,titlePlaceholder:`optional; derived from the prompt otherwise`,prompt:`first message`,promptPlaceholder:`optional; ⌘↵ creates`,create:`create`,needRepo:`pick a project first`},newChat:{title:`new conversation`,prompt:`first message`,start:`start`,promptPlaceholder:`optional; empty opens the engine without a message`},newSession:{title:`New session`,tagline:`Pick a project and a model, then describe the task. The session starts with your first message.`,placeholder:`Describe a task or ask a question`,start:`Start session`,later:`Start later…`,laterConfirm:`Start later`,laterPlaceholder:`22:30 · tomorrow 9:00 · +30m`,laterBad:`That is not a time ahead. Try 22:30, tomorrow 9:00 or +2h.`,laterSet:`Starts at {time}. Until then it waits under Routines, where you can cancel it.`,retryArchiveTitle:`Archive "{title}"?`,retryArchiveBody:`The retry has started. Archive the original? Its session is closed; nothing is deleted.`,needRepo:`Pick a project first`,needPrompt:`Describe the task first`,repo:`Project`,repoSearch:`Search projects or type a path`,repoEmpty:`No matching project`,noFolder:`No folder`,chooseFolder:`Choose folder`,openFolder:`+ Open folder…`,openFolderHeading:`Open folder`,folderFilter:`Paste a path or filter folders…`,folderUse:`Use "{name}"`,folderBack:`← Back`,folderParent:`parent`,folderGit:`git`,folderEmpty:`No subfolders`,folderHint:`← up · → open · enter select · esc back`,cloneRow:`Clone {source}`,cloning:`Cloning {source}`,githubGroup:`Your GitHub repositories`,githubLoading:`Reading your GitHub repositories…`,branch:`Branch`,branchSearch:`Search branches`,branches:`Branches`,branchName:`Branch name, shared by every repo`,branchNamePlaceholder:`derived from the prompt`,primary:`primary`,repoCount:`{count} repos: the first is the primary`,branchEmpty:`No matching branch`,model:`Model`,modelHeading:`Model for this session`,engine:`Engine`,shell:`Shell`,shellPlaceholder:`A command to run first, or leave empty for a plain terminal`,shellOneLine:`A shell command is one line`,modelDefault:`Default`,more:`More`,attach:`Attach`,attachHint:`Add files to the first message; you can also paste or drop them on the prompt`,removeAttachment:`Remove {name}`,worktree:`Worktree`,worktreeOn:`Runs in its own worktree and branch. Click to run in the project's checkout instead`,worktreeOff:`Runs in the project's checkout as it is, on its current branch. Click for a worktree`,worktreeMulti:`A task across several repos always gets a worktree in each`,worktreeNoGit:`Not a git repository: the session runs in the folder itself`,worktreeRemoteRequired:`An agent running on that machine, or a repo it still has to clone, always gets a worktree`,plainMulti:`A folder without git can't join a task across several repos`,machine:`Machine`,thisMachine:`This machine`,machineAuto:`Auto`,machineAutoNote:`Starts on the least busy machine that has this project.`,startedOn:`Started on {machine}`,retry:`Retry`,agentPlace:`Agent runs on`,agentHereNote:`Uses this machine's engines and sign-in. Only the files and commands are on {machine}.`,agentThereNote:`The engine runs on {machine}, so it must be installed and signed in there.`,cloneRowOn:`Clone {source} on {machine}`,cloningOn:`Cloning {source} on {machine}`,startingOn:`Starting the task on {machine}`,engineMissing:`{engine} · not installed`,engineMissingOn:`{engine} is not installed on {machine}. Install it there, or pick another engine.`,repoSearchRemote:`Search or type owner/repo`,remoteOffline:`{machine} is offline`,remoteOutdated:`{machine} runs a Rove too old to list its projects`,remoteFailed:`Could not read {machine}'s projects: {message}`,remoteNone:`{machine} has no projects yet. Type owner/repo to clone one there`,remoteLoading:`Reading {machine}'s projects…`,branchTypeRef:`Type a branch or ref to start from`,branchRemoteDefault:`Its current branch`},sessions:{title:`Sessions`,active:`Active`,archived:`Archived`,allProjects:`all projects`,emptyActive:`No sessions here. Start one from New task.`,emptyArchived:`Nothing archived here. Archive a session from its row menu.`,keys:`tab project · a archived · enter open · q close`},search:{tasks:`Tasks`,archived:`{repo} · archived, pick to unarchive`,commands:`Commands`,inConversations:`In conversations`,searching:`searching…`,none:`Nothing said matches “{query}”.`,you:`you`,agent:`agent`,truncated:`Stopped early to stay fast; add a word to narrow it.`,skipped:`{count} task(s) not searched: another machine's, or an engine Rove cannot read.`},taskops:{publishTitle:`publish to the remote`,publishBody:`{branch} lives on {host}. Push it from there and open a pull request?`,publishButton:`push & open PR`,publishedPr:`pushed {branch} — PR {url}`,publishedNoPr:`pushed {branch}, but no PR: {reason}`,set:`set`,retire:`delete`,close:`close`,moveHint:`j/k move · enter or esc done`,fixSent:`asked the agent to fix the failing checks`,forkNeedsMessage:`a message is required to fork a task`,forkLeftBehind:`Started from the last commit — uncommitted work stays in the original task ({reason})`,forkBranch:`fork from branch`,openedExternal:`opened in the Mac's app`}},Qe={dialog:{cancel:`取消`,save:`保存`,close:`关闭`},crash:{title:`页面出错了。刷新前先把下面的报告复制下来。`,copy:`复制报告`,copied:`已复制`,reload:`刷新`},updatePrompt:{title:`Rove {version} 可以更新了`,body:`这台电脑运行的是 {current}。点更新会在它上面安装新版本。`,yes:`更新`,later:`暂不`,skip:`跳过这个版本`},whatsNew:{title:`更新内容`,continue:`继续`,openRelease:`打开发布说明`,keys:`q / esc`},menu:{cancel:`取消`,closeTab:`关闭该标签页`,newChat:`新建会话`,newChatPick:`选择引擎新建会话…`,retryEdit:`改提示词后重试…`,retryNoPrompt:`这个任务没有保存的提示词`,startNow:`立即启动`,cancelStart:`取消定时启动`,continueEngine:`换个引擎继续…`,newShell:`新建终端`,newChatNoFolder:`新建会话(无文件夹)`,renameTab:`重命名标签页`,splitRight:`向右分屏`,splitDown:`向下分屏`,renamePane:`重命名分屏`,closePane:`关闭分屏`,newTask:`新建任务`,rename:`重命名`,pin:`置顶`,unpin:`取消置顶`,setStatus:`设置状态`,copy:`复制`,copyWhat:{id:`任务 ID`,branch:`分支名`,path:`worktree 路径`},renameBranch:`重命名分支`,changeEngine:`切换引擎`,land:`合入基础分支`,delete:`删除`,removeSession:`移除会话`,archiveMany:`归档 {count} 个会话`,archivedMany:`已归档 {count} 个会话`,archiveManyBusy:`这些会话还在运行或在等你:`,removeMany:`移除 {count} 个会话`,removedMany:`已移除 {count} 个会话`,removeManyTitle:`移除 {count} 个会话?`,removeManyBody:`结束每个会话,关闭它的标签页,并删除它的 worktree 文件夹。git 分支会保留;子会话会上移到父会话的位置。`,removeManyDirtyTitle:`有些 worktree 还有未提交的改动`,removeManyDirtyBody:`仍然移除会丢掉这些改动:`,viewSessions:`查看全部会话`,more:`更多`,copied:`已复制 {text}`,copyFailed:`浏览器拒绝了剪贴板访问`,nothingToCopy:`这个任务还没有{what}`,what:{id:`ID`,branch:`分支`,path:`worktree 路径`}},confirm:{closeTabTitle:`关闭「{tab}」?`,closeTabBody:`停止这个标签里的会话。任务和它的 worktree 会保留。`,closePaneTitle:`关闭「{pane}」?`,closePaneBody:`这个分屏里的引擎会话会结束。标签里的其他分屏会保留。`,delete:`删除`,forceDelete:`强制删除`},newTask:{title:`新建任务`,repo:`项目`,engine:`引擎`,notReady:`未安装或未登录`,taskTitle:`标题`,titlePlaceholder:`可选;不填就从第一条消息生成`,prompt:`第一条消息`,promptPlaceholder:`可选;⌘↵ 创建`,create:`创建`,needRepo:`先选一个项目`},newChat:{title:`新建会话`,prompt:`第一条消息`,start:`开始`,promptPlaceholder:`可选;留空则直接打开引擎,不发消息`},newSession:{title:`新会话`,tagline:`选好项目和模型,再描述任务。会话从你的第一条消息开始。`,placeholder:`描述一个任务,或提个问题`,start:`开始会话`,later:`稍后启动…`,laterConfirm:`稍后启动`,laterPlaceholder:`22:30 · 明天 9:00 · +30m`,laterBad:`这不是一个未来的时间。试试 22:30、明天 9:00 或 +2h。`,laterSet:`{time} 启动。在那之前它列在「例行任务」里,可以在那里取消。`,retryArchiveTitle:`归档「{title}」?`,retryArchiveBody:`重试已经开始。要把原来的会话归档吗?它的进程会结束,不会删除任何东西。`,needRepo:`先选一个项目`,needPrompt:`先描述一下任务`,repo:`项目`,repoSearch:`搜索项目,或输入路径`,repoEmpty:`没有匹配的项目`,noFolder:`无文件夹`,chooseFolder:`选择文件夹`,openFolder:`+ 打开文件夹…`,openFolderHeading:`打开文件夹`,folderFilter:`粘贴路径或过滤文件夹…`,folderUse:`使用「{name}」`,folderBack:`← 返回`,folderParent:`上级目录`,folderGit:`git`,folderEmpty:`没有子文件夹`,folderHint:`← 上一级 · → 进入 · enter 选定 · esc 返回`,cloneRow:`克隆 {source}`,cloning:`正在克隆 {source}`,githubGroup:`你的 GitHub 仓库`,githubLoading:`正在读取你的 GitHub 仓库…`,branch:`分支`,branchSearch:`搜索分支`,branches:`分支`,branchName:`分支名,所有仓库共用`,branchNamePlaceholder:`不填就从提示词生成`,primary:`主仓库`,repoCount:`{count} 个仓库,第一个是主仓库`,branchEmpty:`没有匹配的分支`,model:`模型`,modelHeading:`本次会话的模型`,engine:`引擎`,shell:`Shell`,shellPlaceholder:`先运行的命令,留空就只开一个终端`,shellOneLine:`Shell 命令只能写一行`,modelDefault:`默认`,more:`更多`,attach:`附件`,attachHint:`给第一条消息加文件;也可以直接粘贴或拖到输入框里`,removeAttachment:`移除 {name}`,worktree:`Worktree`,worktreeOn:`在独立的 worktree 和分支里运行。点击改为直接在项目目录里运行`,worktreeOff:`直接在项目目录里运行,用它当前的分支。点击改为独立 worktree`,worktreeMulti:`跨多个仓库的任务每个仓库都会有 worktree`,worktreeNoGit:`不是 git 仓库:会话直接在这个文件夹里运行`,worktreeRemoteRequired:`agent 跑在那台机器上,或仓库还要先克隆时,总会建 worktree`,plainMulti:`没有 git 的文件夹不能加入跨多个仓库的任务`,machine:`机器`,thisMachine:`本机`,machineAuto:`自动`,machineAutoNote:`在有这个项目、且最空闲的机器上启动。`,startedOn:`已在 {machine} 上启动`,retry:`重试`,agentPlace:`agent 运行在`,agentHereNote:`用本机的引擎和登录,只有文件和命令在 {machine} 上。`,agentThereNote:`引擎在 {machine} 上运行,那边要装好并登录。`,cloneRowOn:`在 {machine} 上克隆 {source}`,cloningOn:`正在 {machine} 上克隆 {source}`,startingOn:`正在 {machine} 上启动任务`,engineMissing:`{engine} · 未安装`,engineMissingOn:`{machine} 上没有安装 {engine}。在那台机器上装好,或者换一个引擎。`,repoSearchRemote:`搜索,或输入 owner/repo`,remoteOffline:`{machine} 已离线`,remoteOutdated:`{machine} 上的 Rove 太旧,列不出它的项目`,remoteFailed:`读不到 {machine} 上的项目:{message}`,remoteNone:`{machine} 上还没有项目。输入 owner/repo 就能在那里克隆`,remoteLoading:`正在读取 {machine} 上的项目…`,branchTypeRef:`输入要基于的分支或 ref`,branchRemoteDefault:`它当前的分支`},sessions:{title:`会话`,active:`进行中`,archived:`已归档`,allProjects:`全部项目`,emptyActive:`这里还没有会话。从「新建任务」开始一个。`,emptyArchived:`这里没有已归档的会话。在会话的右键菜单里归档。`,keys:`tab 切换项目 · a 已归档 · enter 打开 · q 关闭`},search:{tasks:`任务`,archived:`{repo} · 已归档,选中即恢复`,commands:`命令`,inConversations:`在对话里`,searching:`搜索中…`,none:`没有说过「{query}」。`,you:`你`,agent:`agent`,truncated:`为了快提前停了;多加一个词缩小范围。`,skipped:`有 {count} 个任务没搜:在别的机器上,或 Rove 读不了它的引擎记录。`},taskops:{publishTitle:`推送到远端`,publishBody:`{branch} 在 {host} 上。要从那台机器推送它并开一个 PR 吗?`,publishButton:`推送并开 PR`,publishedPr:`已推送 {branch} — PR {url}`,publishedNoPr:`已推送 {branch},但没开成 PR:{reason}`,set:`设置`,retire:`删除`,close:`关闭`,moveHint:`j/k 移动 · enter 或 esc 完成`,fixSent:`已请 agent 修复失败的检查`,forkNeedsMessage:`fork 任务需要填写消息`,forkLeftBehind:`已从最近一次提交开始——未提交的改动留在原任务里({reason})`,forkBranch:`基于分支`,openedExternal:`已在 Mac 上用系统应用打开`}},$e=e({en:()=>et,zh:()=>tt}),et={machines:{title:`Machines`,open:`[ machines ]`,none:"No other machines registered. Add one with `rove machine add`.",newHere:`[ new task here ]`,tasks:`[ tasks ]`,repos:`[ repos ]`,hide:`[ hide ]`,noTasks:`no tasks`,noRepos:`no repos`,loading:`…`,reposFailed:`couldn't read its repos: {message}`,update:`[ update rove ]`,updating:`updating… this can take a few minutes`,updated:`updated: v{from} → v{to}`,upToDate:`already on the newest build of this machine's channel (v{to})`,updateFailed:`couldn't update it: {message}`,reason:{refused:`ssh was refused (nothing is listening or a firewall is in the way)`,timeout:`ssh timed out`,"host-key-changed":`its ssh host key changed; check it, then update known_hosts`,"host-key-unverified":`its ssh host key is not known yet; connect once by hand to trust it`,"auth-denied":`ssh refused the login (no key or password accepted)`,unresolved:`its hostname does not resolve`,"ssh-failed":`ssh failed`,"no-rove":`rove is not installed there`,"no-daemon":`its rove daemon is not running`,"bad-status":`it answered with something rove could not read`,handshake:`the link came up but the handshake failed`,"no-forwarding":`ssh forwarding is disabled there`,lost:`the link dropped; reconnecting`}}},tt={machines:{title:`机器`,open:`[ 机器 ]`,none:"没有注册其他机器。用 `rove machine add` 添加。",newHere:`[ 在这台新建任务 ]`,tasks:`[ 任务 ]`,repos:`[ 仓库 ]`,hide:`[ 收起 ]`,noTasks:`没有任务`,noRepos:`没有仓库`,loading:`…`,reposFailed:`读不到它的仓库:{message}`,update:`[ 更新 rove ]`,updating:`正在更新…可能要几分钟`,updated:`已更新:v{from} → v{to}`,upToDate:`已经是这台机器所在通道的最新版(v{to})`,updateFailed:`更新失败:{message}`,reason:{refused:`ssh 被拒绝(没有进程在监听,或被防火墙挡住)`,timeout:`ssh 超时`,"host-key-changed":`它的 ssh 主机密钥变了;确认无误后更新 known_hosts`,"host-key-unverified":`还不认识它的 ssh 主机密钥;先手动连一次以信任它`,"auth-denied":`ssh 拒绝了登录(没有被接受的密钥或密码)`,unresolved:`它的主机名解析不了`,"ssh-failed":`ssh 失败`,"no-rove":`那里没有安装 rove`,"no-daemon":`它的 rove 守护进程没在运行`,"bad-status":`它返回了 rove 读不懂的内容`,handshake:`链路通了但握手失败`,"no-forwarding":`那里禁用了 ssh 端口转发`,lost:`链路断了;正在重连`}}},nt=e({en:()=>rt,zh:()=>it}),rt={files:{autoFix:{on:`[ auto-fix CI ]`,off:`[ turn off ]`,count:`auto-fix {n}/{max}`,stopped:`auto-fix stopped {n}/{max}`,hint:`When checks fail on a new push and the agent is idle, send it the failing logs. At most once per push, 3 times in all, then it stops and tells your Inbox.`},stripCreate:`[ create PR ]`,stripFixCi:`[ fix CI ]`,stripConflicts:`[ resolve conflicts ]`,stripComments:`[ address comments ]`,stripArchive:`[ archive ]`,stripFilled:`prompt is in the input; edit it and press Enter`,stripNoEngine:`No engine session open in this task — nowhere to put the prompt.`,stripUnavailable:`couldn't read the PR's checks: {detail}`,stripNothing:`nothing to ask the agent about right now`,openPort:`[ open :{port} ]`,checks:{title:`checks`,summary:`{pass}/{total} passed`,failed:`{count} failed`,running:`{count} running`,none:`no checks`,refresh:`[ refresh ]`,loading:`…`,unavailable:`couldn't read the PR: {detail}`,log:`[ log ]`,hideLog:`[ hide ]`,noLog:`no log excerpt for this job`,logUnavailable:`couldn't read the log: {detail}`,more:`{count} more not shown`,took:`{duration}`,tookAgo:`{duration} · {age} ago`,finishedAgo:`{age} ago`,runningFor:`running {elapsed}`},merge:{draft:`draft`,conflicts:`conflicts`,behind:`behind base`,unstable:`checks not passing`,blocked:`blocked`,clean:`mergeable`,approved:`approved`,changes:`changes requested`,reviewRequired:`review required`},stripCommit:`[ commit ]`,prRequested:`asked the agent to create the PR`,remoteNoExternal:`this file is on {host}; open it there`,mentionNoEngine:`No engine session open in this task — nothing to mention into.`,menu:{attach:`Attach as context`,diff:`Open diff`,copy:`Copy`,copyRelative:`Relative path`,copyAbsolute:`Absolute path`,copyName:`Filename`,openExternal:`Open in the Mac's app`,reveal:`Show in Finder`,terminal:`Open in terminal`},landTodos:`{count} todo(s) on this task are still unchecked.`,emptyAll:`(empty worktree)`,truncated:`Only the first {count} files are listed.`,state:{conflict:`conflict`,deleted:`deleted`,modified:`modified`,untracked:`untracked`,added:`added`,renamed:`renamed`}},preview:{loading:`loading…`,whole:`whole worktree`,unknown:`nothing to show`,binary:`binary file — not shown as text`,empty:`no changes`,noHunks:`no text changes ({kind})`,modeFile:`[ file ]`,modeDiff:`[ diff ]`,askInChat:`ask in chat`,askInChatHint:`Put the selected lines in the engine's prompt`,sent:`sent {count} notes to the engine`,sentOne:`sent 1 note to the engine`,notSent:`notes not sent: {reason}`},review:{comment:`comment`,range:`range`,count:`{count} comments`,countOne:`1 comment`,send:`send {count}`,sending:`sending…`,edit:`edit`,drop:`drop`,moved:`moved`,movedHint:`The code under this comment changed since it was written.`,show:`Show in the diff`,noteOn:`note on {location}`,noteEditOn:`edit note on {location}`,noteAdd:`[ add note ]`,noteSave:`[ save note ]`,noteCancel:`[ cancel ]`,fold:`Fold {path}`,unfold:`Unfold {path}`,foldAll:`fold all`,unfoldAll:`unfold all`,ignoreWs:`[ ws ]`,ignoreWsHint:`Hide whitespace-only changes (git diff -w)`,viewed:`[ viewed ]`,markViewed:`Mark {path} viewed`,viewedOn:`[x] viewed`,unmarkViewed:`Unmark {path} viewed`,totals:`{files} files · +{added} −{removed}`,totalsOne:`1 file · +{added} −{removed}`,viewedCount:`{done}/{files} viewed`,nextFile:`[ next file ]`,nextComment:`[ next comment ]`,scopeMenu:`{base} → {scope} ▾`,compareAgainst:`Compare against {base}…`,baseDefault:`task base`,baseBranch:`branch`,baseRemote:`remote`,baseTag:`tag`,basePlaceholder:`branch, tag or commit`,shape:{effort:`effort {n}/5`,lockfile:`{count} lockfile`,lockfiles:`{count} lockfiles`,generated:`{count} generated`,tests:`{count} tests`,config:`{count} config`,docs:`{count} docs`,source:`{count} source`},scopeWorking:`Uncommitted changes`,scopeBranch:`Committed changes`,scopeTask:`All changes`,lineClipped:`… {count} more characters`,notSupported:`This bridge is older than the page and can't do that; restart it.`},panel:{tabs:`Browser tabs`,files:`Files`,chat:`Chat`,diff:`Diff`,browser:`Browser`,quota:`Context`,resize:`Drag to resize the panel, double-click to reset`,new:`New tab`,close:`Close`,expand:`Expand the side panel`,restore:`Restore the side panel size`,closeOthers:`Close others`,resizeSplit:`Drag to resize, double-click to reset the widths`},browser:{address:`Address`,placeholder:`https://… or localhost:3000`,back:`Back`,forward:`Forward`,reload:`Reload`,openTab:`Open in a new tab`,invalid:`That is not a web address; only http and https pages open here.`,outside:`Only files inside this task's directory open here.`,empty:`Enter a web address, or a local dev server.`,emptyPorts:`Enter a web address. A dev server started in this task is listed here.`,noFrame:`Only https pages open here; this address uses plain http. Use ↗ to open it in a new tab.`,self:`That address is Rove itself, which can't be framed. Use ↗ to open it in a new tab.`,refuses:`{host} doesn't allow being shown inside another page.`,unreachable:`{host} can't be reached from here.`,remote:`{host} runs on the Rove machine, not on this one.`,annotate:`Mark up this page`,pen:`Pen`,box:`Box`,text:`Text`,undo:`Undo the last mark`,addToChat:`Add to chat`,annotateDone:`Stop marking`,noEngine:`Open an agent session in this task first; the picture goes into its prompt.`,captureFailed:`Couldn't take a picture of the page: {error}`,handToAgent:`Hand to agent`,takeControl:`Agent · Take control`,handedToAgent:`Handed {id} to agent`,handedToHuman:`Took control of {id}`}},it={files:{autoFix:{on:`[ 自动修复 CI ]`,off:`[ 关闭 ]`,count:`自动修复 {n}/{max}`,stopped:`自动修复已停止 {n}/{max}`,hint:`检查在新提交上失败且代理空闲时,自动把失败日志发给它。每次提交最多一次、总共 3 次,之后停止并通知收件箱。`},stripCreate:`[ 创建 PR ]`,stripFixCi:`[ 修复 CI ]`,stripConflicts:`[ 解决冲突 ]`,stripComments:`[ 处理评论 ]`,stripArchive:`[ 归档 ]`,stripFilled:`提示词已放进输入框,修改后按 Enter 发送`,stripNoEngine:`这个任务没有打开的引擎会话,提示词无处可放。`,stripUnavailable:`读不到 PR 的检查结果:{detail}`,stripNothing:`现在没有需要让代理处理的事`,openPort:`[ 打开 :{port} ]`,checks:{title:`检查`,summary:`{pass}/{total} 通过`,failed:`{count} 个失败`,running:`{count} 个进行中`,none:`没有检查`,refresh:`[ 刷新 ]`,loading:`…`,unavailable:`读不到这个 PR:{detail}`,log:`[ 日志 ]`,hideLog:`[ 收起 ]`,noLog:`这个作业没有日志摘录`,logUnavailable:`读不到日志:{detail}`,more:`还有 {count} 个未显示`,took:`{duration}`,tookAgo:`{duration} · {age}前`,finishedAgo:`{age}前`,runningFor:`已运行 {elapsed}`},merge:{draft:`草稿`,conflicts:`有冲突`,behind:`落后于基线`,unstable:`检查未通过`,blocked:`被阻塞`,clean:`可合并`,approved:`已批准`,changes:`要求修改`,reviewRequired:`需要评审`},stripCommit:`[ 提交 ]`,prRequested:`已让代理去创建 PR`,remoteNoExternal:`这个文件在 {host} 上,请到那台机器上打开`,mentionNoEngine:`这个任务没有打开的引擎会话——没有地方可以提及。`,menu:{attach:`作为上下文附加`,diff:`打开 diff`,copy:`复制`,copyRelative:`相对路径`,copyAbsolute:`绝对路径`,copyName:`文件名`,openExternal:`用 Mac 上的应用打开`,reveal:`在 Finder 中显示`,terminal:`在终端中打开`},landTodos:`此任务还有 {count} 条待办未完成。`,emptyAll:`(空工作区)`,truncated:`只列出了前 {count} 个文件。`,state:{conflict:`有冲突`,deleted:`已删除`,modified:`已修改`,untracked:`未跟踪`,added:`已新增`,renamed:`已重命名`}},preview:{loading:`加载中…`,whole:`整个工作区`,unknown:`没有可显示的内容`,binary:`二进制文件——不以文本显示`,empty:`没有变更`,noHunks:`没有文本变更({kind})`,modeFile:`[ 文件 ]`,modeDiff:`[ 差异 ]`,askInChat:`在对话里问`,askInChatHint:`把选中的几行放进引擎的输入框`,sent:`已把 {count} 条批注发给引擎`,sentOne:`已把 1 条批注发给引擎`,notSent:`批注没有发出:{reason}`},review:{comment:`批注`,range:`选范围`,count:`{count} 条批注`,countOne:`1 条批注`,send:`发送 {count} 条`,sending:`发送中…`,edit:`编辑`,drop:`删除`,moved:`已移位`,movedHint:`这条批注下面的代码在写下之后变了。`,show:`在差异里定位`,noteOn:`批注 {location}`,noteEditOn:`编辑批注 {location}`,noteAdd:`[ 添加批注 ]`,noteSave:`[ 保存批注 ]`,noteCancel:`[ 取消 ]`,fold:`折叠 {path}`,unfold:`展开 {path}`,foldAll:`全部折叠`,unfoldAll:`全部展开`,ignoreWs:`[ ws ]`,ignoreWsHint:`隐藏仅空白的改动 (git diff -w)`,viewed:`[ 已看 ]`,markViewed:`标记 {path} 为已看`,viewedOn:`[x] 已看`,unmarkViewed:`取消 {path} 的已看`,totals:`{files} 个文件 · +{added} −{removed}`,totalsOne:`1 个文件 · +{added} −{removed}`,viewedCount:`已看 {done}/{files}`,nextFile:`[ 下个文件 ]`,nextComment:`[ 下条评论 ]`,scopeMenu:`{base} → {scope} ▾`,compareAgainst:`对比基准:{base}…`,baseDefault:`任务基准`,baseBranch:`分支`,baseRemote:`远程`,baseTag:`标签`,basePlaceholder:`分支、标签或提交`,shape:{effort:`评审量 {n}/5`,lockfile:`{count} 个锁文件`,lockfiles:`{count} 个锁文件`,generated:`{count} 个生成文件`,tests:`{count} 个测试`,config:`{count} 个配置`,docs:`{count} 个文档`,source:`{count} 个源码`},scopeWorking:`未提交的改动`,scopeBranch:`已提交的改动`,scopeTask:`全部改动`,lineClipped:`…还有 {count} 个字符`,notSupported:`这个 bridge 比页面旧,做不了这个;请重启它。`},panel:{tabs:`浏览器标签页`,files:`文件`,chat:`对话`,diff:`差异`,browser:`浏览器`,quota:`上下文`,resize:`拖动调整侧边栏宽度,双击复位`,new:`新建标签页`,close:`关闭`,expand:`展开侧边栏`,restore:`还原侧边栏大小`,closeOthers:`关闭其他`,resizeSplit:`拖动调整宽度,双击恢复默认宽度`},browser:{address:`地址`,placeholder:`https://… 或 localhost:3000`,back:`后退`,forward:`前进`,reload:`刷新`,openTab:`在新标签页打开`,invalid:`这不是网页地址;这里只能打开 http 和 https 页面。`,outside:`这里只能打开这个任务目录里的文件。`,empty:`输入网页地址,或本地开发服务器的地址。`,emptyPorts:`输入网页地址。在这个任务里启动的开发服务器会列在这里。`,noFrame:`这里只能打开 https 页面;这个地址用的是 http。点 ↗ 在新标签页打开。`,self:`这个地址就是 Rove 本身,不能嵌入。点 ↗ 在新标签页打开。`,refuses:`{host} 不允许嵌入其他页面。`,unreachable:`从这里访问不到 {host}。`,remote:`{host} 运行在 Rove 所在的机器上,不在这台设备上。`,annotate:`在页面上标注`,pen:`画笔`,box:`方框`,text:`文字`,undo:`撤销上一笔`,addToChat:`加到对话`,annotateDone:`结束标注`,noEngine:`先在这个任务里打开一个 agent 会话;截图会进它的输入框。`,captureFailed:`没能截下这个页面:{error}`,handToAgent:`交给代理`,takeControl:`代理控制中 · 接管`,handedToAgent:`已将 {id} 交给代理`,handedToHuman:`已接管 {id}`}},at=e({en:()=>ot,zh:()=>st}),ot={quote:{action:`[ quote ]`,title:`Put the selection in the prompt as a quote`,atMenu:`The agent is waiting on a choice. Answer it first, then quote.`,notReady:`The agent's prompt is not taking pasted text yet. Try again in a moment.`},snippets:{empty:`No snippets yet.`,name:`Name`,namePlaceholder:`review`,text:`Text`,textPlaceholder:`Review this change for bugs and missing tests.`,add:`[ add ]`,save:`[ save ]`,edit:`[ edit ]`,cancel:`[ cancel ]`,remove:`[ remove ]`,removed:`Removed @{name}`,badName:`A name is letters, digits, - or _, up to 32.`,phone:{add:`Add snippet`,save:`Save`,cancel:`Cancel`,remove:`Delete snippet`}}},st={quote:{action:`[ 引用 ]`,title:`把选中的内容作为引用放进提示词`,atMenu:`agent 正在等你做选择。先回答它,再引用。`,notReady:`agent 的输入框暂时还不接受粘贴。稍等一下再试。`},snippets:{empty:`还没有片段。`,name:`名称`,namePlaceholder:`review`,text:`内容`,textPlaceholder:`检查这次改动有没有 bug,有没有漏掉的测试。`,add:`[ 添加 ]`,save:`[ 保存 ]`,edit:`[ 编辑 ]`,cancel:`[ 取消 ]`,remove:`[ 删除 ]`,removed:`已删除 @{name}`,badName:`名称只能是字母、数字、- 或 _,最长 32 位。`,phone:{add:`添加片段`,save:`保存`,cancel:`取消`,remove:`删除片段`}}},ct=e({en:()=>lt,zh:()=>ut}),lt={rail:{markNotice:`Task rows now start with the engine's icon. Change it in Settings → Appearance.`,markNoticeUndo:`Old look`,inbox:`inbox {count}`,empty:`no tasks yet`,skillCue:`skill missing`,newTask:`New task`,update:`Update`,settings:`Settings`,noProject:`Ungrouped`,connector:{weixin:`WeChat`,lark:`Lark`,inbox:`External messages`},expandGroup:`Expand {name}`,collapseGroup:`Collapse {name}`,reconnecting:`reconnecting`,computer:`this computer`,switchComputer:`Switch computer or pair another`,extensions:`Extensions`,addExtension:`Add extension`,newTaskMode:{worktree:`worktree`,folder:`folder`},lastOpened:`Last opened`,state:{needs:`needs you`,working:`working`,ready:`ready`,idle:`idle`},extraRepos:`{count} more repos in this task`,extraReposOne:`1 more repo in this task`,todos:`{done} of {total} todos done`,todosOne:`{done} of 1 todo done`,startsAt:`Starts {time}`,pr:{state:{open:`open`,merged:`merged`,closed:`closed`},many:`{count} PRs in this task and its children`,checks:{conflict:`conflicts with its base`,failing:`checks failing`,passing:`checks passing`,pending:`checks running`}},searchPlaceholder:`fuzzy filter`,engineSwitched:`Engine → {engine} (applies on reopen)`,engineSwitchFailed:`could not switch engine: {error}`},inbox:{title:`inbox`,hints:`↑↓ move · enter open · d ack · esc close`,attention:`attention`,recent:`recent`,empty:`no pending attention`,send:`Send`,openTab:`[ open ]`,noOutput:`no output yet`,outputUnreadable:`couldn't read this tab's output`,replyPlaceholder:`reply to this session`,gateKept:`Saved; the engine isn't running and will get it with its next message.`,gateAnswer:`Answer`,phone:{title:`Inbox`,empty:`Nothing needs you right now.`,ackAll:`Ack all`,ack:`Ack`,open:`Open`,reply:`Reply`},state:{done:`done`,needsInput:`needs input`,error:`error`,rateLimited:`rate limited`,dead:`engine exited`,restored:`restored after restart`,routineFailed:`routine needs you`,decision:`needs a decision`,reportMissing:`report missing`}}},ut={rail:{markNotice:`任务行现在以引擎图标开头。可在设置 → 外观里更改。`,markNoticeUndo:`换回旧样式`,inbox:`收件箱 {count}`,empty:`还没有任务`,skillCue:`缺少技能`,newTask:`新建任务`,update:`更新`,settings:`设置`,noProject:`未分组`,connector:{weixin:`微信`,lark:`飞书`,inbox:`外部消息`},expandGroup:`展开{name}`,collapseGroup:`收起{name}`,reconnecting:`重连中`,computer:`这台电脑`,switchComputer:`切换电脑或配对另一台`,extensions:`扩展`,addExtension:`添加扩展`,newTaskMode:{worktree:`worktree`,folder:`文件夹`},lastOpened:`上次打开`,state:{needs:`等你处理`,working:`进行中`,ready:`待收尾`,idle:`空闲`},extraRepos:`这个任务还含 {count} 个仓库`,extraReposOne:`这个任务还含 1 个仓库`,todos:`{done}/{total} 条待办已完成`,todosOne:`{done}/1 条待办已完成`,startsAt:`{time} 启动`,pr:{state:{open:`进行中`,merged:`已合并`,closed:`已关闭`},many:`这个任务及子任务共 {count} 个 PR`,checks:{conflict:`与基础分支冲突`,failing:`检查未通过`,passing:`检查已通过`,pending:`检查进行中`}},searchPlaceholder:`模糊搜索`,engineSwitched:`引擎 → {engine}(重新打开后生效)`,engineSwitchFailed:`切换引擎失败:{error}`},inbox:{title:`收件箱`,hints:`↑↓ 移动 · enter 打开 · d 已阅 · esc 关闭`,attention:`待处理`,recent:`最近使用`,empty:`暂无待处理`,send:`发送`,openTab:`[ 打开 ]`,noOutput:`还没有输出`,outputUnreadable:`读不到这个标签页的输出`,replyPlaceholder:`回复这个会话`,gateKept:`已记下;引擎没在运行,下次发消息时一并送达。`,gateAnswer:`回答`,phone:{title:`收件箱`,empty:`现在没有需要你处理的。`,ackAll:`全部已阅`,ack:`已阅`,open:`打开`,reply:`回复`},state:{done:`完成`,needsInput:`需要输入`,error:`出错`,rateLimited:`限流`,dead:`引擎已退出`,restored:`重启后已恢复`,routineFailed:`例行任务需要处理`,decision:`等你决定`,reportMissing:`未回报`}}},dt=e({en:()=>ft,zh:()=>pt}),ft={reviewQueue:{sourceIssues:`[ issues ]`,sourceReviews:`[ PRs waiting on me ]`,palette:`Review queue`,title:`PRs waiting on me`,empty:`No open PR asks for your review in your projects.`,other:`{count} more in projects Rove doesn't know.`,draft:`draft`,fork:`fork`,checksPassing:`checks passing`,checksFailing:`checks failing`,checksPending:`checks running`,start:`[ review ]`,preparing:`Fetching #{number}…`,failed:`Could not start the review of #{number}: {error}`,gh:{missing:"The `gh` CLI is not installed or not on PATH.",unauthenticated:"`gh` is not signed in: run `gh auth login` on this Mac.",failed:`GitHub could not be read just now. Press r to retry.`},prompt:`Review pull request #{number} in {repo}: {title}
11
11
  {url}
12
12
 
13
13
  This worktree is at the PR's head ({head}, going into {base}). Read the change against {base} (git diff origin/{base}...HEAD), then tell me what you find: bugs, risks, missing tests, anything unclear. Do not push, comment on or approve the PR; report here.`}},pt={reviewQueue:{sourceIssues:`[ 议题 ]`,sourceReviews:`[ 等我评审的 PR ]`,palette:`评审队列`,title:`等我评审的 PR`,empty:`你的项目里没有等你评审的 PR。`,other:`另有 {count} 个在 Rove 不认识的项目里。`,draft:`草稿`,fork:`fork`,checksPassing:`检查通过`,checksFailing:`检查未通过`,checksPending:`检查进行中`,start:`[ 评审 ]`,preparing:`正在获取 #{number}…`,failed:`无法开始评审 #{number}:{error}`,gh:{missing:"没有安装 `gh` 命令行,或不在 PATH 中。",unauthenticated:"`gh` 未登录:请在这台 Mac 上运行 `gh auth login`。",failed:`暂时读不到 GitHub。按 r 重试。`},prompt:`评审 {repo} 的拉取请求 #{number}:{title}
@@ -35,7 +35,7 @@ Then look for the hook that older version installed. Check my engine settings fi
35
35
 
36
36
  先把这份清单给我看,问我要删哪些,然后等我回答。对我确认的每一个,先运行 \`git -C <path> status --short\`;有未提交的改动就告诉我并再问一次,没有就运行 \`rove api delete --task-id <id> --wait\`。我没确认的一个都不要删,也不要加 --force。
37
37
 
38
- 然后找一下那个旧版本装的 hook。检查我的引擎设置文件,包括全局的和上面每个仓库里的,找命令里运行 \`rove hook worktree-created\` 的 hook。把找到的每一条连同所在文件给我看,我确认后再删。其他 hook 一律不动。`,legacyAdoptFailed:`清理会话没能启动:{message}`},Ta={open:`Open`,collapseChildren:`Collapse children`,expandChildren:`Expand children`,newChat:`New conversation`,newShell:`New shell`,continueEngine:`Continue in another engine…`,newScratchChat:`New conversation (no folder)`,newTask:`New task`,newTaskFromBranch:`New task from this branch`,forgetProject:`Remove project`,fieldNotes:`Field notes`,rename:`Rename`,pin:`Pin`,unpin:`Unpin`,reorder:`Reorder row`,moveToTop:`Move to top`,moveProjectUp:`Move up`,moveProjectDown:`Move down`,runAgain:`Run again`,setStatus:`Set status`,moveToProject:`Move session to…`,copy:`Copy`,more:`More`,copyId:`Copy task ID`,copyBranch:`Copy branch name`,copyPath:`Copy path`,openEditor:`Open in editor`,renameBranch:`Rename branch`,changeEngine:`Change engine`,fixChecks:`Fix failing checks`,rerunChecks:`Re-run failed checks`,syncBase:`Sync with base`,resolveConflicts:`Resolve conflicts`,abortOperation:`Abort paused merge or rebase`,land:`Land into base branch`,muteNotifications:`Mute notifications`,unmuteNotifications:`Unmute notifications`,archive:`Archive`,unarchive:`Unarchive`,delete:`Remove session`},Ea={open:`打开`,collapseChildren:`折叠子任务`,expandChildren:`展开子任务`,newChat:`新建会话`,newShell:`新建终端`,continueEngine:`换个引擎继续…`,newScratchChat:`新建会话(无文件夹)`,newTask:`新建任务`,newTaskFromBranch:`基于此分支新建任务`,forgetProject:`移除项目`,fieldNotes:`现场笔记`,rename:`重命名`,pin:`置顶`,unpin:`取消置顶`,reorder:`重新排序`,moveToTop:`移到顶部`,moveProjectUp:`上移`,moveProjectDown:`下移`,runAgain:`重新运行`,setStatus:`设置状态`,moveToProject:`移动会话到…`,copy:`复制`,more:`更多`,copyId:`复制任务 ID`,copyBranch:`复制分支名`,copyPath:`复制路径`,openEditor:`在编辑器中打开`,renameBranch:`重命名分支`,changeEngine:`切换引擎`,fixChecks:`修复失败的检查`,rerunChecks:`重新运行失败的检查`,syncBase:`同步基础分支`,resolveConflicts:`让 agent 解决冲突`,abortOperation:`中止暂停的合并或变基`,land:`合入基础分支`,muteNotifications:`静音通知`,unmuteNotifications:`取消静音通知`,archive:`归档`,unarchive:`取消归档`,delete:`移除会话`},Da={noDaemonWorktree:"No daemon running — can't create the worktree. Start it with `rove daemon restart`.",noEditor:`No editor found — set ROVE_OPEN_EDITOR (e.g. 'code', 'cursor', 'nvim')`,openWorktreeFailed:`Couldn't open worktree with {label}`,worktreeErrorDeleting:`This task is being deleted — it can't be opened`,worktreeErrorNotGit:"This project isn't a git repo yet — a task needs a git branch. Run `git init` (+ a first commit) in the project, then open the task. Non-git support is coming.",worktreeErrorGeneric:`Couldn't create the worktree: {message}`,noDiskSpace:`The disk is full, so the checkout could not be created. Free some space, then try again.`,scratchOpenFailed:`Couldn't open a scratch shell: {message}`,worktreeGoneTitle:`Worktree for "{title}" is gone`,worktreeGoneBody:`Closed {count} tab(s). The branch {branch} is still there — reopen the task to re-create its worktree.`,checksPassingTitle:`Checks passed for "{title}"`,checksFailingTitle:`Checks failed for "{title}"`,checksResolvedBody:`PR {pr} on {branch}`,copiedId:`Copied task ID {text}`,copiedTab:`Copied tab address {text}`,copiedSession:`Copied session ID {text}`,copiedBranch:`Copied branch {text}`,copiedPath:`Copied path {text}`,copyFailed:`Couldn't reach a clipboard — no clipboard command on PATH, and this terminal refused OSC 52.`,forgetProjectFailed:`Couldn't remove the project: {error}`,deleteFailed:`Couldn't delete "{title}": {error}`,createFailed:`Couldn't create the task: {error}`,engineStartFailed:`Task created; engine did not start`,engineStartRetry:`{error}. Press ⏎ on the task to retry.`,forkFailed:`Couldn't fork the task: {error}`,forkLeftBehind:`Started from the last commit — uncommitted work stays in the original task ({reason})`,childFailed:`Couldn't start the new conversation: {error}`,renameFailed:`Couldn't rename the task: {error}`,renameBranchFailed:`Couldn't rename the branch: {error}`,switchEngineFailed:`Couldn't switch the engine: {error}`,setStatusFailed:`Couldn't set the status: {error}`,pinFailed:`Couldn't change the pin: {error}`,moveFailed:`Couldn't move the task: {error}`,moveToProjectFailed:`Couldn't move the session: {error}`,movedToProject:`Moved to {project}`,issueChatFailed:`Couldn't start the issue chat: {error}`,inboxMarkReadFailed:`Couldn't mark it read: {error}`,inboxDismissFailed:`Couldn't dismiss it: {error}`,engineSwitched:`Engine → {engine} (applies on reopen)`,statusSet:`Status → {status}`},Oa={noDaemonWorktree:"守护进程未运行——无法创建 worktree。请运行 `rove daemon restart` 启动它。",noEditor:`未找到编辑器——请设置 ROVE_OPEN_EDITOR(如 'code'、'cursor'、'nvim')`,openWorktreeFailed:`无法用 {label} 打开 worktree`,worktreeErrorDeleting:`该任务正在删除中——无法打开`,worktreeErrorNotGit:"该项目尚非 git 仓库——任务需要 git 分支。请在项目中执行 `git init`(+ 首次提交)后再打开任务。非 git 项目的支持即将推出。",worktreeErrorGeneric:`无法创建 worktree:{message}`,noDiskSpace:`磁盘空间不足,没法创建工作目录。清理出一些空间后再重试。`,scratchOpenFailed:`无法打开临时 Shell:{message}`,worktreeGoneTitle:`"{title}" 的 worktree 已消失`,worktreeGoneBody:`已关闭 {count} 个标签页。分支 {branch} 仍在——重新打开该任务会重建 worktree。`,checksPassingTitle:`「{title}」的 PR 检查已通过`,checksFailingTitle:`「{title}」的 PR 检查失败了`,checksResolvedBody:`PR {pr},分支 {branch}`,copiedId:`已复制任务 ID {text}`,copiedTab:`已复制标签页地址 {text}`,copiedSession:`已复制会话 ID {text}`,copiedBranch:`已复制分支 {text}`,copiedPath:`已复制路径 {text}`,copyFailed:`无法访问剪贴板——PATH 上没有剪贴板命令,这个终端也拒绝了 OSC 52。`,forgetProjectFailed:`移除项目失败:{error}`,deleteFailed:`删除「{title}」失败:{error}`,createFailed:`创建任务失败:{error}`,engineStartFailed:`任务已创建,引擎没有启动`,engineStartRetry:`{error}。在任务上按 ⏎ 重试。`,forkFailed:`fork 任务失败:{error}`,forkLeftBehind:`已从最近一次提交开始——未提交的改动留在原任务里({reason})`,childFailed:`无法开始新对话:{error}`,renameFailed:`重命名任务失败:{error}`,renameBranchFailed:`重命名分支失败:{error}`,switchEngineFailed:`切换引擎失败:{error}`,setStatusFailed:`设置状态失败:{error}`,pinFailed:`修改置顶状态失败:{error}`,moveFailed:`移动任务失败:{error}`,moveToProjectFailed:`移动会话失败:{error}`,movedToProject:`已移到 {project}`,issueChatFailed:`启动议题会话失败:{error}`,inboxMarkReadFailed:`标记为已读失败:{error}`,inboxDismissFailed:`忽略失败:{error}`,engineSwitched:`引擎 → {engine}(重新打开后生效)`,statusSet:`状态 → {status}`},ka={nav:{kanban:`Kanban`,automations:`Routines`,issues:`Issues`,mods:`Mods`},header:{scratch:`Ungrouped`,connector:{weixin:`WeChat`,lark:`Lark`,inbox:`External messages`}},search:{placeholder:`fuzzy filter`},sort:{label:`sort: {mode}`,hint:`Change the order (manual → newest → attention → name)`,reorderSwitched:`Reorder needs manual order — switched`,modes:{default:`manual`,recent:`newest`,attention:`attention`,name:`name`}},menu:Ta,status:{backlog:`Backlog`,inProgress:`In progress`,inReview:`In review`,done:`Done`,canceled:`Canceled`,error:`Error`},setStatus:{title:`Set status`,current:`current`,footer:`↑↓ choose · enter set · esc cancel`},moveToProject:{title:`Move session to`,empty:"No other project yet — add one first, or run `rove api update --project PATH`",ungrouped:`Ungrouped`,footer:`↑↓ choose · enter move · esc cancel`},sync:{done:`Merged {base} into this worktree`,alreadyCurrent:`Already up to date with {base}`,conflict:`Merge conflict — resolve then commit: {files}`,dirty:`Commit the worktree's changes first, then sync: {files}`,failed:`Sync failed: {error}`},abortOp:{title:`Abort the {op}?`,body:`Git puts {branch} back where it was before the {op} started. Conflict resolutions made since then are lost.`,confirm:`Abort {op}`,done:`Aborted the {op} on {branch}`,failed:`Couldn't abort the {op}: {error}`},archive:{done:`Archived {title}`,restored:`Restored {title}`,busyTitle:`Archive while it's working?`,busyBody:`An engine in {title} is still working or waiting on you. Archiving stops it.`,busyConfirm:`Archive anyway`,failed:`Couldn't archive: {error}`,restoreFailed:`Couldn't restore: {error}`},rerun:{started:`Re-running failed checks`,none:`No failed checks to re-run`,external:`These checks didn't run on GitHub Actions; re-run them where they ran`,refused:`Re-run refused: {detail}`},changeEngine:{title:`Change engine`,current:`current`,effortLabel:`EFFORT`,noEffort:`engine default`,footer:{engine:`↑↓ engine`,effort:`←→ effort`,model:`tab model`,set:`enter set`,cancel:`esc cancel`}},engineModel:{label:`MODEL`,placeholder:`engine default`,loading:`listing models…`},tier:{swift:`swift`,standard:`standard`,deep:`deep`,manual:`manual`},tierDesc:{swift:`small, well-specified edits — the fastest, cheapest setting`,standard:`everyday feature work and bug fixes`,deep:`hard problems: unclear root causes, large refactors, design decisions`},runAgain:{title:`Run again`,source:`Brief from “{title}”`,hint:`Runs this brief again in a new task, on its own branch and worktree.`,confirm:`Run again`,footer:`↑↓ scroll · ←→ choose · enter run · esc cancel`},fieldNotes:{title:`Field notes`,empty:"No field notes for this repo yet — agents file one with `rove api note`.",loading:`Loading…`,footer:`↑↓ scroll · esc close`,footerDeletable:`↑↓ select · d delete · esc close`,confirmDelete:{title:`Delete this field note?`,body:`“{text}” stops being injected into new sessions on this repo. Nothing else changes.`}},confirm:Ca,renameBranch:{title:`Rename branch`,fieldLabel:`branch`},moveChip:` move`,recentJump:`Recent: {title}`,archivedHit:`{title} · archived, enter unarchives`,machine:{connecting:`connecting…`,offline:`offline`,unsupported:`unsupported`,mismatch:`protocol mismatch`,filesElsewhere:`on {host}`,filesHint:`{host} is unreachable right now; its files show here again when it reconnects.`,terminalElsewhere:`This task runs on {host}, which is unreachable right now.`,runsOn:`on {host}`,noTabs:`No tabs on {host} yet — prefix t opens one there.`},empty:{noMatchSearch:`No matching tasks — esc to clear.`,noActiveProject:`No active tasks for this project.`,noActive:`No active tasks — create one above.`},activity:{working:`working`,rateLimited:`rate limited`,permissionNeeded:`needs permission`,error:`error`,dead:`engine exited`},group:{waitingOnYou:`needs you`,landing:`ready to land`,readyForReview:`needs review`,working:`working`},subtitle:{noTracking:`no activity tracking`,materializing:`materializing`,deleting:`deleting`,deleteFailed:`delete failed`},reBranch:{title:`Set branch`,fieldLabel:`branch`,hintNoBranches:`(no local branches — type a new name)`,hintNoMatch:`(no match — enter renames to this branch)`,footer:`↑↓ pick · enter set · esc cancel`},toast:Da},Aa={nav:{kanban:`看板`,automations:`例行任务`,issues:`议题`,mods:`Mods`},header:{scratch:`未分组`,connector:{weixin:`微信`,lark:`飞书`,inbox:`外部消息`}},search:{placeholder:`模糊搜索`},sort:{label:`排序:{mode}`,hint:`切换排序(手动 → 最新 → 关注 → 名称)`,reorderSwitched:`调整顺序需手动排序,已切换`,modes:{default:`手动`,recent:`最新`,attention:`关注`,name:`名称`}},menu:Ea,status:{backlog:`待办`,inProgress:`进行中`,inReview:`待评审`,done:`已完成`,canceled:`已取消`,error:`出错`},setStatus:{title:`设置状态`,current:`当前`,footer:`↑↓ 选择 · enter 设置 · esc 取消`},moveToProject:{title:`移动会话到`,empty:"还没有其他项目——先添加一个,或运行 `rove api update --project PATH`",ungrouped:`未分组`,footer:`↑↓ 选择 · enter 移动 · esc 取消`},sync:{done:`已把 {base} 合并进该工作树`,alreadyCurrent:`已经和 {base} 同步`,conflict:`合并冲突——解决后提交:{files}`,dirty:`请先提交工作树里的改动,再同步:{files}`,failed:`同步失败:{error}`},abortOp:{title:`中止这次 {op}?`,body:`Git 会把 {branch} 恢复到 {op} 开始之前的状态,此后做过的冲突解决都会丢失。`,confirm:`中止 {op}`,done:`已中止 {branch} 上的 {op}`,failed:`无法中止 {op}:{error}`},archive:{done:`已归档 {title}`,restored:`已恢复 {title}`,busyTitle:`它还在工作,仍要归档?`,busyBody:`{title} 里有引擎仍在工作或在等你。归档会把它停掉。`,busyConfirm:`仍要归档`,failed:`归档失败:{error}`,restoreFailed:`恢复失败:{error}`},rerun:{started:`正在重新运行失败的检查`,none:`没有可重新运行的失败检查`,external:`这些检查不是在 GitHub Actions 上运行的,请到它们运行的地方重新运行`,refused:`无法重新运行:{detail}`},changeEngine:{title:`切换引擎`,current:`当前`,effortLabel:`推理强度`,noEffort:`引擎默认`,footer:{engine:`↑↓ 引擎`,effort:`←→ 强度`,model:`tab 模型`,set:`enter 设置`,cancel:`esc 取消`}},engineModel:{label:`模型`,placeholder:`引擎默认`,loading:`正在列出模型…`},tier:{swift:`轻快`,standard:`标准`,deep:`深入`,manual:`手动`},tierDesc:{swift:`小而明确的改动——最快、最省的一档`,standard:`日常的功能开发和修 bug`,deep:`难题:根因不明、大重构、设计决策`},runAgain:{title:`重新运行`,source:`来自任务「{title}」的指令`,hint:`在新任务里重新执行这段指令,新任务有自己的分支和工作树。`,confirm:`重新运行`,footer:`↑↓ 滚动 · ←→ 选择 · enter 运行 · esc 取消`},confirm:wa,renameBranch:{title:`重命名分支`,fieldLabel:`分支`},fieldNotes:{title:`现场笔记`,empty:"该仓库暂无现场笔记——agent 可用 `rove api note` 记录。",loading:`加载中…`,footer:`↑↓ 滚动 · esc 关闭`,footerDeletable:`↑↓ 选择 · d 删除 · esc 关闭`,confirmDelete:{title:`删除这条现场笔记?`,body:`「{text}」将不再注入该仓库的新会话。其他内容不受影响。`}},moveChip:` 移动`,recentJump:`最近:{title}`,archivedHit:`{title} · 已归档,回车恢复`,machine:{connecting:`连接中…`,offline:`离线`,unsupported:`不支持`,mismatch:`协议不兼容`,filesElsewhere:`在 {host} 上`,filesHint:`{host} 暂时连不上;重新连上后这里会再显示它的文件。`,terminalElsewhere:`这个任务跑在 {host} 上,暂时连不上。`,runsOn:`在 {host} 上`,noTabs:`{host} 上还没有 tab——按 prefix t 在那里新开一个。`},empty:{noMatchSearch:`无匹配任务——按 esc 清除。`,noActiveProject:`该项目暂无活跃任务。`,noActive:`暂无活跃任务——在上方新建。`},activity:{working:`运行中`,rateLimited:`请求受限`,permissionNeeded:`等待授权`,error:`错误`,dead:`引擎已退出`},group:{waitingOnYou:`等你处理`,landing:`可以合了`,readyForReview:`待你验收`,working:`运行中`},subtitle:{noTracking:`不跟踪活动`,materializing:`正在创建 worktree`,deleting:`正在删除`,deleteFailed:`删除失败`},reBranch:{title:`设置分支`,fieldLabel:`分支`,hintNoBranches:`(没有本地分支——输入新名称)`,hintNoMatch:`(无匹配——回车将分支重命名为此名)`,footer:`↑↓ 选择 · enter 设置 · esc 取消`},toast:Oa},ja={noTask:`(no task — press n to create)`,exited:`process exited — F5 restarts it`,engineExit:{title:`Engine exited`,titleCode:`Engine exited (code {code})`,retry:`Retry`,settings:`Settings → Engines`,another:`Another engine`,continueIn:`Continue in another engine`},usageLimit:{title:`Usage limit reached`,dismiss:`Dismiss`},restoring:`restoring session…`,recovery:{live:`Live process reattached`,relaunched:`Command relaunched in a new process. Any restored output is historical; check the engine to resume or continue your conversation.`,restored:`Historical screen restored; previous process ended. Restart and check the engine before continuing.`},tab:{groupTitle:`group {n}`,renameTitle:`Rename tab`,renameField:`TAB TITLE`,renameSubmit:`rename`,chooseEngineHint:`←/→ or h/l choose, enter confirm, esc cancel`,newChat:{title:`New conversation`,engine:`ENGINE`,destLabel:`DESTINATION`,destTab:`child task, same directory`,destFork:`fork a child task (new worktree)`,destScratch:`new scratch task ($HOME)`,ctxLabel:`CONTEXT`,ctxFresh:`fresh conversation`,ctxContinue:`continue this conversation`},cannotCloseLast:`Cannot close the only tab`,tabGone:`That tab is no longer there`,closeOthersTitle:`Close the other tabs?`,closeOthersBody:`Closing {count} · their sessions end, this tab stays open.`,closeOthersConfirm:`close tabs`,closeOthersCancel:`cancel`,menu:{rename:`Rename tab`,copyAddress:`Copy tab address`,copySessionId:`Copy session ID`,continueEngine:`Continue in another engine…`,closeOthers:`Close other tabs`,close:`Close tab`},nothingToFork:`No conversation in this tab to fork yet`,noSessionYet:`No conversation in this tab yet`,noSessionYetHint:`Send the engine a prompt; its session ID exists once the conversation starts.`,noTranscriptToHandOff:`{engine} keeps no readable transcript to hand over`},split:{renameTitle:`Rename split`,renameField:`SPLIT NAME`},scrolledBack:`↑ scrolled {lines}L`,scrollFirst:`[first]`,scrollLatest:`[latest]`,unavailable:{shellMissing:`terminal unavailable — the shell named by $SHELL isn't on this machine. Point $SHELL at one that exists, or unset it to fall back to the system default.`,spawnFailed:`terminal unavailable — the shell exited immediately. Its error is in ~/.rove/pty.log.`,retry:`F5 tries again`},reset:{title:`Reset terminal?`,body:`The running shell will be killed and a fresh one will spawn at the worktree. Any in-flight processes (vim, htop, paused jobs) end immediately.`}},Ma={recovery:{live:`已重新连接仍在运行的进程`,relaunched:`命令已在新进程中重启。如有恢复的输出,它属于历史记录;请在引擎内确认会话恢复或继续操作。`,restored:`已恢复历史画面;原进程已结束。请重启并确认引擎状态后继续。`},noTask:`(无任务 —— 按 n 创建)`,exited:`进程已退出 —— 按 F5 重启`,engineExit:{title:`引擎已退出`,titleCode:`引擎已退出(退出码 {code})`,retry:`重试`,settings:`设置 → 引擎`,another:`换个引擎`,continueIn:`换个引擎继续`},usageLimit:{title:`已达到用量上限`,dismiss:`忽略`},restoring:`正在恢复会话…`,tab:{groupTitle:`group {n}`,renameTitle:`重命名标签页`,renameField:`标签页名称`,renameSubmit:`重命名`,chooseEngineHint:`←/→ 或 h/l 选择,enter 确认,esc 取消`,newChat:{title:`新建对话`,engine:`引擎`,destLabel:`落点`,destTab:`子任务,同一目录`,destFork:`fork 子任务(新 worktree)`,destScratch:`新临时任务($HOME)`,ctxLabel:`上下文`,ctxFresh:`全新对话`,ctxContinue:`接着当前对话`},cannotCloseLast:`无法关闭唯一的标签页`,tabGone:`这个标签页已经不在了`,closeOthersTitle:`关闭其他标签页?`,closeOthersBody:`将关闭 {count} 个,它们的会话会结束,只保留这个标签页。`,closeOthersConfirm:`关闭标签页`,closeOthersCancel:`取消`,menu:{rename:`重命名标签页`,copyAddress:`复制标签页地址`,copySessionId:`复制会话 ID`,continueEngine:`换个引擎继续…`,closeOthers:`关闭其他标签页`,close:`关闭标签页`},nothingToFork:`这个标签页还没有可派生的对话`,noSessionYet:`这个标签页还没有对话`,noSessionYetHint:`先给引擎发一条消息,对话开始后才有会话 ID。`,noTranscriptToHandOff:`{engine} 没有可读的对话记录,无法交接`},split:{renameTitle:`重命名分屏`,renameField:`分屏名称`},scrolledBack:`↑ 已回滚 {lines} 行`,scrollFirst:`[最早]`,scrollLatest:`[最新]`,unavailable:{shellMissing:`终端不可用 —— $SHELL 指向的 shell 在这台机器上不存在。请把 $SHELL 指向一个真实存在的 shell,或取消设置以回退到系统默认。`,spawnFailed:`终端不可用 —— shell 启动后立即退出。具体错误见 ~/.rove/pty.log。`,retry:`按 F5 重试`},reset:{title:`重置终端?`,body:`正在运行的 shell 会被杀掉并在 worktree 重新启动,进行中的进程(vim、htop、暂停的任务)会立即结束。`}},Na={pageTitle:`ROVE UPDATE`,closeHint:`q / esc close`,chip:`↑ {version}`,current:`current`,available:`v{version} available`,latest:`latest`,latestUnknown:`unknown — could not reach the registry`,registryRetry:`Check your connection, then close and reopen Update to retry.`,upToDate:`No newer release — nothing to install.`,releaseUrlUnavailable:`release URL unavailable; visit github.com/Sma1lboy/rove/releases`,statusReleaseOpened:`Opened release page in your browser.`,statusReleaseError:`Could not open release URL. Visit github.com/Sma1lboy/rove/releases in your browser.`,statusRunningUpdater:`Closing the TUI and running the updater in this terminal...`,loadingNotes:`Loading release notes...`,notesUnavailable:`Release notes are unavailable. Use Open release to view the GitHub release page.`,changesSectionHeader:`── changes from v{from} to v{to} ──`,otherClients:`Also in this release: {count} for other clients`,scopes:{ios:`Phone & iPhone app`,web:`Web`,tui:`Terminal (TUI)`,cli:`Command line`,daemon:`Background service`,android:`Android app`,other:`Other`},updateComplete:`Rove update complete. Relaunch Rove to use the new version.`,updateFailed:"Rove update failed with exit code {code}. Check the output above, then run `rove update` to retry.",pressAnyKey:`Press any key to close this update window.`,webRunning:`Running {command} …`,webInstalled:`Installed. Restart Rove to run v{latest}; this page reloads itself when it is back.`,webRestart:`Restart Rove`,webRestarting:`Restarting Rove… this page reloads itself when it is back.`,webStartFailed:`Could not start the updater: {error}`,actions:{updateNow:`Update now`,openRelease:`Open release`,close:`Close`,closeDetail:`return to the workspace`},whatsNew:{title:`WHAT'S NEW 🎉`,closeHint:`q / esc continue`,upgraded:`You're now on Rove v{to}, up from v{from}. Here's what changed.`,notesUnavailable:`Could not load the release notes — check your connection, or read them on GitHub.`,sourceHint:`release notes: {url}`},skew:{title:`⚠ DAEMON OUT OF DATE`,olderBuild:`an older build`,hint:`daemon is {daemon} — you launched v{clientVersion}. Press {keys} to refresh Rove onto the installed build`,hintNoKey:"daemon is {daemon} — you launched v{clientVersion}. Run `rove daemon restart`, then relaunch Rove"},refresh:{confirmTitle:`Refresh Rove?`,confirmBody:`Rove restarts the daemon and relaunches itself on the installed build. Running engine sessions live in the PTY host and keep going; open tabs come back.`,confirmLabel:`Refresh`,relaunching:`rove: restarting on the installed build...`,alreadyCurrent:`Rove and the daemon already run the same build — nothing to refresh.`,installGone:"This Rove was installed from a directory that no longer exists, so it cannot relaunch itself. Reinstall with `npm install -g @sma1lboy/rove`."},staleInstall:{title:`✕ ROVE INSTALL IS GONE`,hint:"this Rove is running from an install that no longer exists on disk, so it cannot start a daemon. Reinstall (`npm install -g @sma1lboy/rove`) and relaunch Rove"},versions:{pageTitle:`ROVE VERSIONS`,loading:`Loading releases...`,unavailable:`Could not fetch releases. Check your connection or wait for the rate limit, then reopen this page.`,tagCurrent:`current`,tagLatest:`latest`,tagBreaking:`breaking`,breakingWarning:"⚠ installing this crosses breaking version(s) {versions}. Rove will refuse to start until you run `rove reset`, which stops the daemon, the PTY host, and every live session. Tasks and worktrees are kept.",footerHint:`j/k select · enter install · q close`,closeHint:`q / esc close`}},Pa={pageTitle:`ROVE 更新`,closeHint:`q / esc 关闭`,chip:`↑ {version}`,current:`当前`,available:`有新版本 v{version}`,latest:`最新`,latestUnknown:`未知 —— 无法连接到 registry`,registryRetry:`请检查网络,然后关闭并重新打开更新页重试。`,upToDate:`没有更新的版本 —— 无需安装。`,releaseUrlUnavailable:`发布链接不可用;请访问 github.com/Sma1lboy/rove/releases`,statusReleaseOpened:`已在浏览器中打开发布说明页面。`,statusReleaseError:`无法打开发布链接。请在浏览器访问 github.com/Sma1lboy/rove/releases。`,statusRunningUpdater:`正在关闭 TUI,并在当前终端中运行更新程序……`,loadingNotes:`正在加载发布说明……`,notesUnavailable:`发布说明不可用。请使用「打开发布页」查看 GitHub 发布页面。`,changesSectionHeader:`── v{from} 至 v{to} 的变更 ──`,otherClients:`本版本还有 {count} 条其他客户端的更新`,scopes:{ios:`手机与 iPhone 应用`,web:`网页端`,tui:`终端 (TUI)`,cli:`命令行`,daemon:`后台服务`,android:`Android 应用`,other:`其他`},updateComplete:`Rove 更新完成。请重新启动 Rove 以使用新版本。`,updateFailed:"Rove 更新失败,退出码为 {code}。请检查上方输出,再运行 `rove update` 重试。",pressAnyKey:`按任意键关闭此更新窗口。`,webRunning:`正在运行 {command} …`,webInstalled:`已安装。重启 Rove 后运行 v{latest};恢复后页面会自动刷新。`,webRestart:`重启 Rove`,webRestarting:`正在重启 Rove… 恢复后页面会自动刷新。`,webStartFailed:`无法启动更新程序:{error}`,actions:{updateNow:`立即更新`,openRelease:`打开发布页`,close:`关闭`,closeDetail:`返回工作区`},whatsNew:{title:`更新内容 🎉`,closeHint:`q / esc 继续`,upgraded:`Rove 已从 v{from} 更新到 v{to},本次变更如下。`,notesUnavailable:`无法加载发布说明 —— 请检查网络连接,或到 GitHub 上查看。`,sourceHint:`发布说明:{url}`},skew:{title:`⚠ DAEMON 版本不一致`,olderBuild:`旧版本构建`,hint:`daemon 运行的是 {daemon},而你启动的是 v{clientVersion}。按 {keys} 可让 Rove 刷新到已安装的版本`,hintNoKey:"daemon 运行的是 {daemon},而你启动的是 v{clientVersion}。请运行 `rove daemon restart`,然后重新启动 Rove"},refresh:{confirmTitle:`刷新 Rove?`,confirmBody:`Rove 会重启 daemon,并以已安装的版本重新启动自身。正在运行的引擎会话由 PTY host 托管,不会中断;已打开的标签页会恢复。`,confirmLabel:`刷新`,relaunching:`rove:正在以已安装的版本重新启动……`,alreadyCurrent:`Rove 与 daemon 已经是同一个版本 —— 无需刷新。`,installGone:"当前 Rove 的安装目录已不存在,无法重新启动自身。请运行 `npm install -g @sma1lboy/rove` 重新安装。"},staleInstall:{title:`✕ ROVE 安装已不存在`,hint:"当前 Rove 运行自一份已从磁盘删除的安装,因此无法启动 daemon。请重新安装(`npm install -g @sma1lboy/rove`)并重新启动 Rove"},versions:{pageTitle:`ROVE 版本列表`,loading:`正在加载发布列表……`,unavailable:`无法获取发布列表。请检查网络或等待限流解除,然后重新打开本页。`,tagCurrent:`当前`,tagLatest:`最新`,tagBreaking:`breaking`,breakingWarning:"⚠ 安装该版本会跨过 breaking 版本 {versions}。更新后 Rove 会拒绝启动,直到你运行 `rove reset`——它会停掉 daemon、PTY host 和所有活动会话。任务和 worktree 会保留。",footerHint:`j/k 选择 · enter 安装 · q 关闭`,closeHint:`q / esc 关闭`}},Fa={quit:{confirmTitle:`Quit Rove?`,confirmBody:`The daemon and task sessions keep running. This closes only the native workspace.`,confirmLabel:`Quit`},narrowBack:`Tasks`,noPreviousTask:`No previous task to go back to`,empty:{selectTask:`Select a task with a worktree`,noSessions:`No sessions here — press ⏎ to start {engine}, or ctrl+e to pick another`,noSessionsShell:`No sessions here — press ⏎ to start a shell, or ctrl+e to pick another`,externalToAgent:`Nothing ran on this message — press ⏎ to give it to an agent`,remoteUnsupported:`Hosted engine launch over SSH is not implemented — this task's worktree is on {host}`,archived:`Archived — no live terminal`,unarchive:`[ Unarchive ]`},welcome:{title:`Welcome to Rove`,tagline:`All your coding agents in one place: when one runs out of quota, switch the task to another, and agents talk to each other directly.`,worktreeExplain:`Managed tasks create isolated worktrees and branches. Directory and project tasks reuse existing files; tabs within a task share its directory.`,stepNew:`creates your first task — pick a repo, a base branch, an engine`,stepHelp:`shows every shortcut reachable from the current focus`,stepPrefix:`opens the command menu`,enginesFound:`✓ engines: {list}`,enginesSignedOut:`✗ installed but not signed in: {list} — run one of them in a shell and log in`,enginesMissing:`✗ no engine CLI found — install claude, codex, copilot, or kimi, then restart Rove`,gitMissing:`✗ git not found on PATH — Rove needs git to create worktrees`,doctorHint:"run `rove doctor` in a shell for the full diagnosis",docsHint:`docs: https://docs.rove.run`},attention:{none:`No available Inbox items`},inbox:{title:`INBOX`,chip:`inbox {count}`,empty:`No pending attention`,openHint:`enter open`,clearHint:`d ack`,clearAllHint:`D ack all`,more:`+{count} more`,section:{attention:`ATTENTION`,recent:`RECENT`},state:{done:`done`,needsInput:`needs input`,error:`error`,rateLimited:`rate limited`,running:`running`,dead:`engine exited`,restored:`restored after restart`,routineFailed:`routine needs you`,reportMissing:`report missing`,decisionNeeded:`decision needed`,gateAnswered:`answered · engine not running`},resumesAt:`resumes {time}`}},Ia={quit:{confirmTitle:`退出 Rove?`,confirmBody:`守护进程和任务会话会继续运行,这里只关闭原生工作区。`,confirmLabel:`退出`},narrowBack:`任务`,noPreviousTask:`没有可以回去的上一个任务`,empty:{selectTask:`请选择一个带 worktree 的任务`,noSessions:`这里没有会话——按 ⏎ 启动 {engine},或按 ctrl+e 另选一个`,noSessionsShell:`这里没有会话——按 ⏎ 启动 shell,或按 ctrl+e 另选一个`,externalToAgent:`这条消息没有启动任何 agent——按 ⏎ 交给 agent 分析`,remoteUnsupported:`尚未实现通过 SSH 启动托管引擎——该任务的 worktree 在 {host} 上`,archived:`已归档——没有在运行的终端`,unarchive:`[ 取消归档 ]`},welcome:{title:`欢迎使用 Rove`,tagline:`所有编程 agent 都在一个地方:一个额度用完了,换另一个接着干;agent 之间直接对话,不用你传话。`,worktreeExplain:`托管任务创建独立的 worktree 和分支。目录与项目任务复用现有文件;同一任务内的标签页共享目录。`,stepNew:`创建你的第一个任务——选仓库、基础分支和引擎`,stepHelp:`查看当前焦点下的全部快捷键`,stepPrefix:`打开命令菜单`,enginesFound:`✓ 已检测到引擎:{list}`,enginesSignedOut:`✗ 已安装但未登录:{list}——请在 shell 里运行其中之一并完成登录`,enginesMissing:`✗ 未找到引擎 CLI——请安装 claude、codex、copilot 或 kimi 后重启 Rove`,gitMissing:`✗ PATH 上没有 git——Rove 需要 git 来创建 worktree`,doctorHint:"在 shell 里运行 `rove doctor` 查看完整诊断",docsHint:`文档:https://docs.rove.run`},attention:{none:`收件箱中没有可打开的项目`},inbox:{title:`收件箱`,chip:`收件箱 {count}`,empty:`暂无待处理`,openHint:`enter 打开`,clearHint:`d 已阅`,clearAllHint:`D 全部已阅`,more:`还有 {count} 条`,section:{attention:`待处理`,recent:`最近使用`},state:{done:`完成`,needsInput:`需要输入`,error:`出错`,rateLimited:`限流`,running:`进行中`,dead:`引擎已退出`,restored:`重启后已恢复`,routineFailed:`例行任务需要处理`,reportMissing:`未回报`,decisionNeeded:`等你决定`,gateAnswered:`已回答 · 引擎未运行`},resumesAt:`{time} 恢复`}},La={title:`Worktrees`,loading:`Loading worktrees…`,noProjects:`No local projects known to Rove yet.`,loadFailed:`Could not read the worktrees: {message}`,noWorktrees:`No worktrees.`,badge:{roveManaged:`rove`,dirty:`dirty`,dirtyUnknown:`dirty?`,remoteOn:`on remote`,remoteOff:`not pushed`,remoteUnknown:`remote unknown`},verdict:{prOpen:`PR open`,prMerged:`merged (PR)`,inMain:`in main`,prClosed:`PR closed`,idle:`stale`},row:{detached:`(detached)`,created:`created {age} ago`},delete:{button:`Delete`,confirmTitle:`Delete worktree?`,confirmBody:`Delete the worktree for "{branch}"? This removes the working directory; the branch itself is kept.`,forceTitle:`Force delete worktree?`,forceBody:'"{branch}" has uncommitted, untracked, or gitignored work. Force delete removes the worktree, but the work is snapshotted first to a salvage ref — list them with `git for-each-ref refs/rove/salvage`. Force delete anyway?',forceReason:`Refused because: {reason}`,failed:`Failed to delete worktree: {error}`,residue:`Git deregistered the worktree, but couldn't delete {path} ({reason}). Rove is done with it — retrying won't help; delete the directory by hand if you want the space.`},land:{button:`Land`,confirmTitle:`Land branch?`,confirmBody:`Merge "{branch}" into {landedOn} ({commits} commits), then remove this worktree? The branch is kept. Conflicts abort with a file list.`,confirmBodyOne:`Merge "{branch}" into {landedOn} (1 commit), then remove this worktree? The branch is kept. Conflicts abort with a file list.`,noTask:`This worktree isn't tracked as a Rove task — nothing to land.`,conflict:`Land hit conflicts (merge aborted). Resolve by hand: {files}`,dirtyBase:"The base checkout has uncommitted changes — commit them, then land. Never `git stash` here: the stash stack lives in the repo's common dir and is shared by every linked worktree, so a stash can entangle other tasks' work.",failed:`Land failed: {error}`,refusal:{EMPTY_BRANCH:`Nothing to land: "{branch}" has no commits ahead of {landedOn}.`,EMPTY_BRANCH_DIRTY_WORKTREE:`Nothing to land yet: "{branch}" has no commits ahead of {landedOn}, but its worktree has uncommitted changes ({files}). Commit them there, then land.`,MISSING_REF:`"{branch}" is gone from the project: it was renamed or deleted outside Rove.`,DETACHED_HEAD:`The project checkout is not on a branch. Check one out there, then land.`,SAME_BRANCH:`The project checkout is already on "{branch}", so there is nothing to land it onto.`,UNBORN_BASE:`{landedOn} has no commits yet, so there is nothing to merge into. Make the first commit there, then land.`,UNREADABLE_BASE:`Could not read the project checkout. Is it still a git repository?`},done:`Landed "{branch}" onto {landedOn} ({commit}).`,worktreeKept:`Landed, but the worktree was kept: {reason}`,worktreePathStale:`Landed and removed the worktree, but the task still points at it: {reason}`,worktreeResidue:`Landed. Git deregistered the worktree, but couldn't delete {path} ({reason}) — delete the directory by hand if you want the space.`},hint:{}},Ra={title:`工作树`,loading:`正在加载 worktree…`,noProjects:`Rove 还没有已知的本地项目。`,loadFailed:`读不到 worktree 列表:{message}`,noWorktrees:`没有 worktree。`,badge:{roveManaged:`rove`,dirty:`有改动`,dirtyUnknown:`改动未知`,remoteOn:`已推送`,remoteOff:`未推送`,remoteUnknown:`远端未知`},verdict:{prOpen:`PR 评审中`,prMerged:`已合入 (PR)`,inMain:`已在主分支`,prClosed:`PR 已关闭`,idle:`陈旧`},row:{detached:`(游离状态)`,created:`{age}前创建`},delete:{button:`删除`,confirmTitle:`删除 worktree?`,confirmBody:`确定删除 "{branch}" 对应的 worktree?工作目录会被移除,分支本身会保留。`,forceTitle:`强制删除 worktree?`,forceBody:'"{branch}" 存在未提交、未跟踪或被 gitignore 的改动。强制删除会移除 worktree,但这些改动会先被快照到一个 salvage ref——用 `git for-each-ref refs/rove/salvage` 可以列出它们。仍要强制删除吗?',forceReason:`拒绝原因:{reason}`,failed:`删除 worktree 失败:{error}`,residue:`Git 已注销该 worktree,但没能删掉 {path}({reason})。Rove 这边已经处理完了——重试没有用;想要回磁盘空间请手动删除该目录。`},land:{button:`合入`,confirmTitle:`合入分支?`,confirmBody:`把 "{branch}" 合入 {landedOn}({commits} 个提交),然后移除这个 worktree?分支会保留。冲突会中止并给出文件清单。`,confirmBodyOne:`把 "{branch}" 合入 {landedOn}(1 个提交),然后移除这个 worktree?分支会保留。冲突会中止并给出文件清单。`,noTask:`该 worktree 未作为 Rove 任务被跟踪——没有可合入的对象。`,conflict:`合入遇到冲突(已中止)。请手动解决:{files}`,dirtyBase:"基础检出有未提交改动——请先提交再合入。绝不要在这里 `git stash`:stash 栈存放在仓库的 common dir 中,该仓库所有 linked worktree 共享,一次 stash 可能纠缠其他任务的工作。",failed:`合入失败:{error}`,refusal:{EMPTY_BRANCH:`没有可合入的内容:"{branch}" 比 {landedOn} 没有多出任何提交。`,EMPTY_BRANCH_DIRTY_WORKTREE:`还没有可合入的内容:"{branch}" 比 {landedOn} 没有多出提交,但它的 worktree 里有未提交的改动({files})。先在那里提交,再合入。`,MISSING_REF:`项目里已经没有 "{branch}" 了:它在 Rove 之外被改名或删除。`,DETACHED_HEAD:`项目检出不在任何分支上。先在那里检出一个分支,再合入。`,SAME_BRANCH:`项目检出已经在 "{branch}" 上,没有可以合入的目标。`,UNBORN_BASE:`{landedOn} 还没有任何提交,没有可合入的目标。先在那里做第一次提交,再合入。`,UNREADABLE_BASE:`读不了项目检出。它还是 git 仓库吗?`},done:`已把 "{branch}" 合入 {landedOn}({commit})。`,worktreeKept:`已合入,但 worktree 保留了:{reason}`,worktreePathStale:`已合入并移除 worktree,但任务仍指向它:{reason}`,worktreeResidue:`已合入。Git 已注销该 worktree,但没能删掉 {path}({reason})——想要回磁盘空间请手动删除该目录。`},hint:{}},za={common:{en:da,zh:fa},doctor:{en:pa,zh:ma},files:{en:ha,zh:ga},newTask:{en:_a,zh:va},onboarding:{en:ya,zh:ba},quickTask:{en:xa,zh:Sa},tasks:{en:ka,zh:Aa},terminal:{en:ja,zh:Ma},update:{en:Na,zh:Pa},workspace:{en:Fa,zh:Ia},worktrees:{en:La,zh:Ra}};function Ba(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 K(e,t,n){let r=za[e],i=Ba(r[Bt.get()],t)??Ba(r.en,t)??t;return n?i.replace(/\{(\w+)\}/g,(e,t)=>String(n[t]??e)):i}var Va=y({stale:!1,daemonVersion:null,bridgeVersion:null}),Ha=2e4;async function Ua(e){try{let t=await e.request(`daemon.info`);return Va.set({stale:t.stale,daemonVersion:t.daemonVersion,bridgeVersion:t.bridgeVersion}),t.stale}catch{return Va.get().stale}}function Wa(e){(0,h.useEffect)(()=>{let t=e.onOpen(()=>void Ua(e)),n=ua(Ha,()=>void Ua(e));return()=>{t(),n()}},[e])}function Ga(e){if(!Va.get().stale){z(K(`update`,`refresh.alreadyCurrent`),`error`);return}k.set((0,U.jsx)(sa,{title:K(`update`,`refresh.confirmTitle`),body:V(`layout.refreshConfirm`),confirmLabel:K(`update`,`refresh.confirmLabel`),onConfirm:async()=>{await e.request(`daemon.restart`),z(K(`update`,`refresh.relaunching`));for(let t=0;t<20;t++)if(await new Promise(e=>window.setTimeout(e,1e3)),!await Ua(e))return;throw Error(V(`layout.refreshTimeout`))}}))}var Ka=[`info`,`success`,`warning`,`error`,`muted`],qa=4e3,Ja=4e3,Ya=/^[A-Za-z0-9._:-]{1,64}$/,Xa={box:new Set([`type`,`direction`,`gap`,`padding`,`border`,`children`]),text:new Set([`type`,`text`,`tone`,`bold`]),button:new Set([`type`,`key`,`label`,`tone`]),input:new Set([`type`,`key`,`placeholder`,`value`])};function Za(e){return typeof e==`string`&&Ka.includes(e)}function Qa(e){return e===0||e===1||e===2||e===3}var $a=class extends Error{};function eo(e){let t=0,n=new Set,r=(e,i,a)=>{if(a>12)throw new $a(`${i}: deeper than 12`);if(++t>400)throw new $a(`more than 400 elements`);if(!e||typeof e!=`object`||Array.isArray(e))throw new $a(`${i}: not an element`);let o=e,s=o.type;if(s!==`box`&&s!==`text`&&s!==`button`&&s!==`input`)throw new $a(`${i}: unknown element ${JSON.stringify(s)}`);for(let e of Object.keys(o))if(!Xa[s].has(e))throw new $a(`${i}: ${s} has no prop "${e}"`);if(o.tone!==void 0&&!Za(o.tone))throw new $a(`${i}: tone must be one of ${Ka.join(`, `)}`);if(s===`text`){if(typeof o.text!=`string`||o.text.length>4e3)throw new $a(`${i}: text must be a string of at most ${qa} chars`);if(o.bold!==void 0&&typeof o.bold!=`boolean`)throw new $a(`${i}: bold must be boolean`);return{type:s,text:o.text,...o.tone===void 0?{}:{tone:o.tone},...o.bold?{bold:!0}:{}}}if(s===`button`||s===`input`){if(typeof o.key!=`string`||!Ya.test(o.key))throw new $a(`${i}: bad ${s} key`);if(n.has(o.key))throw new $a(`${i}: duplicate key "${o.key}"`);n.add(o.key)}if(s===`input`){for(let e of[`placeholder`,`value`]){let t=o[e];if(t!==void 0&&(typeof t!=`string`||t.length>4e3))throw new $a(`${i}: ${e} must be a string of at most ${Ja} chars`)}return{type:s,key:o.key,...o.placeholder===void 0?{}:{placeholder:o.placeholder},...o.value===void 0?{}:{value:o.value}}}if(s===`button`){if(typeof o.label!=`string`||o.label.length===0||o.label.length>40)throw new $a(`${i}: label must be 1-40 chars`);return{type:s,key:o.key,label:o.label,...o.tone===void 0?{}:{tone:o.tone}}}if(o.direction!==void 0&&o.direction!==`row`&&o.direction!==`column`)throw new $a(`${i}: direction must be "row" or "column"`);for(let e of[`gap`,`padding`])if(o[e]!==void 0&&!Qa(o[e]))throw new $a(`${i}: ${e} must be 0-3`);if(o.border!==void 0&&typeof o.border!=`boolean`)throw new $a(`${i}: border must be boolean`);if(!Array.isArray(o.children))throw new $a(`${i}: box needs children`);return{type:s,...o.direction===void 0?{}:{direction:o.direction},...o.gap===void 0?{}:{gap:o.gap},...o.padding===void 0?{}:{padding:o.padding},...o.border?{border:!0}:{},children:o.children.map((e,t)=>r(e,`${i}.children[${t}]`,a+1))}};try{return{ok:!0,tree:r(e,`tree`,1)}}catch(e){if(e instanceof $a)return{ok:!1,error:e.message};throw e}}function to(e){let t=e?.panes;if(!Array.isArray(t))return null;let n=[];for(let e of t){if(!e||typeof e!=`object`)continue;let t=e;if(typeof t.plugin!=`string`||typeof t.id!=`string`||typeof t.title!=`string`)continue;let r=eo(t.tree);r.ok&&n.push({plugin:t.plugin,id:t.id,title:t.title,tree:r.tree})}return n}function no(e){let t=[],n=(e,r,i)=>{if(e.type===`button`||e.type===`input`)t.push({kind:e.type,plugin:r,pane:i,key:e.key});else if(e.type===`box`)for(let t of e.children)n(t,r,i)};for(let t of e)n(t.tree,t.plugin,t.id);return t}function ro(e,t){return e!==null&&t!==null&&e.plugin===t.plugin&&e.pane===t.pane&&e.key===t.key}function io(e,t){return e.find(e=>ro(e,t))??e[0]??null}function ao(e,t,n){if(e.length===0)return null;let r=e.findIndex(e=>ro(e,t));return r<0?e[0]??null:e[(r+n+e.length)%e.length]??null}function q(e,t){if(!t)return e;let n=new Map(e.map(e=>[e.id,e]));for(let e of t.remove)n.delete(e);for(let e of t.upsert)n.set(e.id,e);return t.order?t.order.flatMap(e=>n.get(e)??[]):e.map(e=>n.get(e.id)??e)}function oo(e,t){return{...e,rev:t.rev,tasks:q(e.tasks,t.tasks),...t.archived?{archived:q(e.archived??[],t.archived)}:{},...t.attention?{attention:t.attention}:{},...t.gates?{gates:t.gates}:{}}}function so(e){return!!e&&typeof e==`object`&&typeof e.from==`number`}function co(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}var lo=e=>e.kind===`dir`&&e.noProject===!0,uo=e=>e.split(/[\\/]/).filter(Boolean),fo=e=>uo(e).pop()??e;function po(e,t,n=``){let r=fo(e),i=t.filter(t=>(t.repo!==e||t.host!==n)&&fo(t.repo)===r);if(i.length===0)return r;let a=e=>uo(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 mo=e=>e.startsWith(`root:`)?null:e.split(`/`).slice(-2).join(`/`);function ho(e,t){let n=fo(e.repo),r=t.filter(t=>t!==e&&fo(t.repo)===n);if(r.length===0)return n;let i=e.repoId,a=i?mo(i):null;return i&&a?r.some(e=>e.repoId&&e.repoId!==i&&mo(e.repoId)===a)?i:a:po(e.repo,[e,...r].map(e=>({repo:e.repo,host:``})))}var go=/\s+#\d+\/\d+$/,_o=(e,t)=>(e.createdAt??``).localeCompare(t.createdAt??``)||e.id.localeCompare(t.id),vo=e=>e.groupId?`${e.machine?.id??``}\0${e.groupId}`:null;function yo(e){let t=new Map;for(let n of e){let e=vo(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(_o);return t}function bo(e){return(e[0]?.label??``).replace(go,``)}function xo(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 So=[`default`,`recent`,`attention`,`name`],Co={folded:new Set,opened:new Set},wo=e=>{let t=Date.parse(e??``);return Number.isFinite(t)?t:0},To=e=>wo(e.updatedAt??e.createdAt),Eo=e=>wo(e.createdAt),Do=(e,t)=>Eo(t)-Eo(e)||t.id.localeCompare(e.id),Oo=(e,t)=>To(t)-To(e)||t.id.localeCompare(e.id),ko=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`}),Ao={default:null,recent:Do,attention:(e,t)=>e.rank-t.rank||Oo(e,t),name:(e,t)=>ko.compare(e.label.trim(),t.label.trim())||e.id.localeCompare(t.id)},jo=`~scratch`,Mo=e=>lo(e);function No(e,t){return[...e].sort((e,t)=>(e.order??e.rank)-(t.order??t.rank)).sort(Io(Ao[t]))}function Po(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=Mo(e)?jo:e.repo,n=r.get(t);n?n.push(e):r.set(t,[e])}let i=Ao[t],a=[...r].map(([e,t])=>{let n=t.sort(Io(i));if(e===`~scratch`&&t.every(Mo))return{repo:``,label:V(`rail.noProject`),tasks:n,key:jo,noProject:!0};let r=t.find(e=>e.repoId)?.repoId;return{repo:e,label:fo(e),tasks:n,...r?{repoId:r}:{}}});return[...a.filter(e=>e.noProject),...a.filter(e=>!e.noProject)]}var Fo=e=>+!e.pinned,Io=e=>(t,n)=>Fo(t)-Fo(n)||(e?e(t,n):0);function Lo(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 Ro(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)||Lo(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 zo(e,t,n=[]){for(let r of e.get(t)??[])n.push(r.id),zo(e,r.id,n);return n}function Bo(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 Vo(e,t=``,n=Co,r=0,i=!0){let a=t.trim(),o=(...e)=>e.some(e=>e!==``&&co(a,e)),{children:s,nested:c}=Ro(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,fo(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?zo(s,t.id):[],m=u!==void 0&&a===``&&Bo(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?yo(t):new Map,o=new Set;for(let i of t){let t=vo(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:bo(s),tasks:s,depth:Math.min(l,3),...c.machine?{machine:c.machine.id}:{}});let u=xo(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}function Ho(e){let t=e.tasks.find(e=>e.connector)?.connector;return t===`weixin`||t===`lark`||t===`inbox`?V(`rail.connector.${t}`):null}var Uo=e=>Math.max(0,...e.tasks.map(Eo));function Wo(e){let t=e.tasks.filter(e=>!e.routine),n=e.remote.filter(e=>!e.routine),r=[...Po(t,e.sort).map(e=>({group:e})),...e.machines.flatMap(t=>Po(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?jo:t??(e.machine===void 0?n:`${e.machine}\0${n}`),a=i.get(r);a?a.push(e):i.set(r,[e])}let a=Ao[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(Io(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:Ho(e)??ho(e,s)])),l=s.map(e=>({...e,label:c.get(e)??e.label}));e.sort===`recent`&&l.sort((e,t)=>Uo(t)-Uo(e)),e.sort===`name`&&l.sort((e,t)=>ko.compare(e.label,t.label));let u=e=>Number(e.tasks.some(e=>e.connector!==void 0));return l.sort((e,t)=>u(e)-u(t)),l.sort((e,t)=>Number(t.noProject===!0)-Number(e.noProject===!0)),{rows:Vo(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 Go(e){return e.title??e.engineName??(e.kind===`engine`?V(`tab.engine`):V(`tab.shell`))}function Ko(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)}var qo=(e,t)=>n=>({...n,tasks:n.tasks.map(n=>n.id===e?{...n,...t}:n)}),Jo=(e,t)=>n=>({...n,tasks:n.tasks.map(n=>n.id===e?{...n,title:t,label:n.label===n.title?t:n.label}:n)});function Yo(e,t){let n=new Set([t]);for(let t=!0;t;){t=!1;for(let r of e)r.parentTaskId&&n.has(r.parentTaskId)&&!n.has(r.id)&&(n.add(r.id),t=!0)}return n}var Xo=e=>e.order??e.rank;function Zo(e,t){let n=e.find(e=>e.id===t);if(!n||Mo(n))return[...e];let r=Xo(n),i=e.filter(e=>e.repo===n.repo&&!Mo(e)&&Xo(e)>r).sort((e,t)=>Xo(e)-Xo(t)),a=new Map(i.map((e,t)=>[e.id,r+(t+1)/(i.length+1)]));return e.map(e=>{let t=a.get(e.id);return t===void 0?e:{...e,order:t}})}var Qo=(e,t,n=!1)=>r=>{let i=t?Zo(r.tasks,e):r.archived??[],a=n?new Set([e]):Yo(i,e),o=i.find(t=>t.id===e)?.parentTaskId,s=i.filter(e=>a.has(e.id)).map(e=>({...e,archived:t})),c=i.filter(e=>!a.has(e.id)).map(t=>n&&t.parentTaskId===e?{...t,parentTaskId:o}:t);return t?{...r,tasks:c,archived:[...r.archived??[],...s]}:{...r,tasks:[...r.tasks,...s],archived:c}},$o=(e,t)=>n=>{let r=[...n.tasks,...n.archived??[]],i=t?Yo(r,e):new Set([e]),a=r.find(t=>t.id===e)?.parentTaskId,o=t=>t.filter(e=>!i.has(e.id)).map(t=>t.parentTaskId===e?{...t,parentTaskId:a}:t);return{...n,tasks:o(Zo(n.tasks,e)),...n.archived?{archived:o(n.archived)}:{}}},es={"task.pin":(e,t)=>qo(e,{pinned:t.pinned===!0}),"task.keep":(e,t)=>qo(e,{kept:t.kept===!0}),"task.setStatus":(e,t)=>qo(e,{status:t.status}),"task.rename":(e,t)=>Jo(e,String(t.title)),"task.archive":(e,t)=>Qo(e,t.archived===!0,t.promote===!0),"task.delete":(e,t)=>$o(e,t.cascade===!0)};Object.keys(es);function ts(e,t){return es[e]?.(String(t.taskId),t)??null}var ns=new WeakMap,rs=200,is=e=>`client`in e?e.client:e,as=(e,t)=>t?`${e} ${JSON.stringify(t)}`:e;function J(e,t,n){return ns.get(is(e))?.get(as(t,n))}function os(e,t,n,r){let i=is(e),a=ns.get(i)??new Map,o=as(t,n);a.delete(o),a.set(o,r),ns.set(i,a);for(let e of a.keys()){if(a.size<=rs)break;a.delete(e)}return r}function ss(e,t,n){return is(e).request(t,n).then(r=>os(e,t,n,r))}var cs=`rove.web.selection`,ls=`null`,us=300;function ds(){try{let e=JSON.parse(localStorage.getItem(cs)??`null`);if(e&&typeof e==`object`&&`taskId`in e&&typeof e.taskId==`string`)return{taskId:e.taskId,tabId:`tabId`in e&&typeof e.tabId==`string`?e.tabId:null}}catch{}return{taskId:null,tabId:null}}function fs(e){if(!e||typeof e!=`object`||!(`taskIds`in e))return;let t=e.taskIds;return Array.isArray(t)?t.filter(e=>typeof e==`string`):void 0}function ps(e){return!!e&&typeof e==`object`&&`tasks`in e&&Array.isArray(e.tasks)}var ms=`rove.web.visits`,hs=20;function gs(){try{let e=JSON.parse(localStorage.getItem(ms)??`[]`);return Array.isArray(e)?e.filter(e=>!!e&&typeof e==`object`&&typeof e.taskId==`string`):[]}catch{return[]}}function _s(e,t){if(t)return e?.tasks.find(e=>e.id===t)??e?.archived?.find(e=>e.id===t)}function vs(e,t,n){let r=(e,t)=>e.some(e=>e.id===t&&!e.deleting);return n!==null&&r(e,n)&&!r(t,n)}var ys=class{client;tasks=y(null);remote=y([]);tabs=y({});tabsSettled=y(!1);mods=y([]);installedMods=y(new Set);selection=y(ds());visits=y(gs());tabTimer=null;tabsReadAt=-1/0;tabScope=new Set;tabSets=new Map;tabReads=new Map;syncing=null;served=null;edits=new Map;pendingSelect=null;selectIntent=0;provisioning=new Map;viewingSent=ls;taskShown=!0;viewingExtras=()=>({});constructor(e){this.client=e,e.onOpen(()=>{this.resync(),this.viewingSent=ls,this.reportViewing(),this.refreshMods(),ss(e,`github.repos`).catch(()=>{})}),typeof document<`u`&&typeof document.addEventListener==`function`&&document.addEventListener(`visibilitychange`,()=>{this.reportViewing(),document.visibilityState===`visible`&&this.refreshMods()}),typeof window<`u`&&typeof window.addEventListener==`function`&&window.addEventListener(`pagehide`,()=>this.reportViewing(!0)),e.on(`tasks`,e=>{ps(e)&&this.acceptTasks(e)}),e.on(`tasks.patch`,e=>{let t=this.served;t&&so(e)&&e.from===t.rev?this.acceptTasks(oo(t,e)):this.resync()}),e.on(`tabs`,e=>this.scheduleTabRefresh(fs(e))),e.on(`mods`,e=>this.mods.set(to(e)??[]))}resync(){return this.syncing??=this.client.request(`tasks.subscribe`,{patches:!0}).then(e=>this.acceptTasks(e)).catch(()=>{}).finally(()=>{this.syncing=null}),this.syncing}async refreshMods(){try{let{mods:e}=await this.client.request(`builtinMods.list`);this.installedMods.set(new Set(e.filter(e=>e.installed).map(e=>e.id)))}catch{}}onSelect=()=>{};setTaskShown(e){this.taskShown!==e&&(this.taskShown=e,this.reportViewing())}select(e,t=null){this.onSelect();let n=++this.selectIntent;if(this.tasks.get()?.tasks.find(t=>t.id===e)?.noWorktree){this.provisioning.has(e)?this.provisioning.set(e,{intent:n,tabId:t}):this.provisionThenSelect(e,{intent:n,tabId:t});return}this.commitSelection(e,t)}commitSelection(e,t){let n=this.tabs.get()[e]??[],r={taskId:e,tabId:t??bs(n)?.id??null};this.selection.set(r),localStorage.setItem(cs,JSON.stringify(r));let i=[{...r,at:Date.now()},...this.visits.get().filter(e=>e.taskId!==r.taskId||e.tabId!==r.tabId)].slice(0,hs);this.visits.set(i),localStorage.setItem(ms,JSON.stringify(i)),this.reportViewing(),e in this.tabs.get()||this.scheduleTabRefresh([e])}reportViewing(e=!1){let{taskId:t,tabId:n}=this.selection.get(),r=e||typeof document<`u`&&document.visibilityState===`hidden`||!t||!this.taskShown?null:{taskId:t,...n?{tabId:n}:{},...this.viewingExtras()},i=JSON.stringify(r);i!==this.viewingSent&&(this.viewingSent=i,this.client.request(`ui.viewing`,r??{taskId:null}).catch(()=>{this.viewingSent===i&&(this.viewingSent=ls)}))}async provisionThenSelect(e,t){this.provisioning.set(e,t);let n=!0;try{await this.client.request(`task.ensureWorktree`,{taskId:e})}catch(e){n=!1,z(e instanceof Error?e.message:String(e),`error`)}let r=this.provisioning.get(e)??t;this.provisioning.delete(e),n&&(this.markProvisioned(e),(this.tasks.get()?.tasks.some(t=>t.id===e)??!1)&&r.intent===this.selectIntent&&this.commitSelection(e,r.tabId))}markProvisioned(e){let t=this.tasks.get();if(!t)return;let n=t.tasks.map(t=>t.id===e?{...t,noWorktree:void 0}:t);this.tasks.set({...t,tasks:n})}selectWhenListed(e){this.tasks.get()?.tasks.some(t=>t.id===e)?this.select(e):this.pendingSelect=e}engineTarget(e){let{taskId:t,tabId:n}=this.selection.get(),r=t===e?this.tabs.get()[e]?.find(e=>e.id===n):void 0;return r?.kind===`engine`?{taskId:e,tabId:r.id}:{taskId:e}}async refreshTabsNow(e){await this.refreshTabs([e])}tabbedTasks(){let e=this.tasks.get(),t=e?.archived?.find(e=>e.id===this.selection.get().taskId);return[...e?.tasks??[],...t?[t]:[],...this.remote.get().filter(e=>!e.machine?.stale)]}act(e,t){let n=ts(e,t),r=()=>this.client.request(e,t);return n?this.optimistic(n,r):r()}closeTab(e,t){return this.tabAct(e,`tab.close`,{taskId:e,tabId:t},e=>e.filter(e=>e.id!==t))}renameTab(e,t,n){return this.tabAct(e,`tab.rename`,{taskId:e,tabId:t,title:n},e=>e.map(e=>e.id===t?{...e,title:n}:e))}async tabAct(e,t,n,r){let i=this.tabs.get()[e];i&&(this.tabReads.set(e,(this.tabReads.get(e)??0)+1),this.tabs.set({...this.tabs.get(),[e]:r(i)}),this.reselectIfClosed(e));try{await this.client.request(t,n)}finally{await this.refreshTabs([e])}}async optimistic(e,t){this.edits.set(e,!1);let n=this.selection.get();this.served&&this.acceptTasks(this.served,!0);try{let n=await t();return this.edits.has(e)&&this.edits.set(e,!0),n}catch(t){throw this.edits.delete(e),this.served&&this.acceptTasks(this.served,!0),n.taskId!==null&&this.selection.get().taskId!==n.taskId&&_s(this.tasks.get(),n.taskId)&&this.commitSelection(n.taskId,n.tabId),t}}acceptTasks(e,t=!1){this.served=e;let n=e;for(let[e,r]of this.edits){let i=e(n);r&&!t&&i.tasks.length===n.tasks.length?this.edits.delete(e):n=i}let r=[...this.tasks.get()?.tasks??[],...this.remote.get()];this.remote.set(n.tasks.filter(e=>e.machine)),this.tasks.set({...n,tasks:n.tasks.filter(e=>!e.machine)}),vs(r,n.tasks,this.selection.get().taskId)&&this.leaveForNewTask(),this.pendingSelect&&n.tasks.some(e=>e.id===this.pendingSelect)&&(this.select(this.pendingSelect),this.pendingSelect=null);let i=this.tabbedTasks(),a=new Set(i.map(e=>e.id)),o=this.tabs.get();Object.keys(o).some(e=>!a.has(e))&&this.tabs.set(Object.fromEntries(Object.entries(o).filter(([e])=>a.has(e))));for(let e of this.tabSets.keys())a.has(e)||this.tabSets.delete(e);let s=i.filter(e=>{let t=Object.keys(e.tabStatus??{}).sort().join(` `);return this.tabSets.get(e.id)!==t&&(this.tabSets.set(e.id,t),!0)});s.length>0&&this.scheduleTabRefresh(s.map(e=>e.id))}leaveForNewTask(){let e=I.get(),t=ge.get(),n={taskId:null,tabId:null};this.selection.set(n),localStorage.setItem(cs,JSON.stringify(n)),this.reportViewing(),I.set(e??{ungrouped:!0,sky:T()}),ge.set(t)}scheduleTabRefresh(e){if(!e)this.tabScope=null;else for(let t of e)this.tabScope?.add(t);if(this.tabTimer!==null)return;let t=Math.max(0,this.tabsReadAt+us-Date.now());this.tabTimer=window.setTimeout(()=>{this.tabTimer=null,this.tabsReadAt=Date.now();let e=this.tabScope;this.tabScope=new Set,this.refreshTabs(e?[...e]:this.tabbedTasks().map(e=>e.id))},t)}async refreshTabs(e){await Promise.all(e.map(async e=>{let t=(this.tabReads.get(e)??0)+1;this.tabReads.set(e,t);let n;try{n=(await this.client.request(`task.tabs`,{taskId:e})).tabs}catch{return}this.tabReads.get(e)===t&&(this.tabs.set({...this.tabs.get(),[e]:n}),this.reselectIfClosed(e))})),this.tabsSettled.get()||this.tabsSettled.set(!0)}reselectIfClosed(e){let t=this.selection.get();t.taskId===e&&((this.tabs.get()[e]??[]).some(e=>e.id===t.tabId)||this.commitSelection(e,null))}};function bs(e){return e.find(e=>e.alive!==!1)??e[0]}function xs({model:e}){let t=b(e.selection),n=b(e.tasks),r=b(e.remote),i=_s(n,t.taskId)??r.find(e=>e.id===t.taskId),a=n?.attention.filter(e=>e.unread).length??0,o=`${a>0?`(${a}) `:``}${i?`${i.label} - `:``}rove`;return(0,h.useEffect)(()=>{document.title=o},[o]),null}var Ss=[`sidebar`,`workspace`,`files`];function Cs(e,t,n){let r=Ss.filter(e=>e!==`files`||n.filesVisible),i=r.indexOf(e);if(i<0)return(t>0?r[r.length-1]:r[0])??null;let a=Math.min(Math.max(i+t,0),r.length-1);return a===i?null:r[a]??null}var ws=`.split-leaf.is-active textarea.xterm-helper-textarea`,Ts={sidebar:[`.rail`,`.rail`],workspace:[`.workspace`,ws],files:[`.side-panel`,`.side-view:not([hidden]) :is([tabindex='0'], input)`]};function Es(){for(let e of document.querySelectorAll(ws))if(e.closest(`[data-stream]`)?.getClientRects().length)return e;return null}function Ds(){let e=Es();return e?.focus(),e!==null}function Os(e){let t=Cs(Object.keys(Ts).find(e=>document.activeElement?.closest(Ts[e][0]))??`sidebar`,e,{filesVisible:document.querySelector(Ts.files[0])!==null});t&&document.querySelector(Ts[t][1])?.focus()}var ks=[{id:`chat.tab.new`,scope:`workspace`,keys:[`ctrl+t`],category:`Workspace`,description:`New chat tab`,hint:{keys:`ctrl+t`},presentation:`onePress`},{id:`chat.tab.chooseEngine`,scope:`workspace`,keys:[`ctrl+e`],category:`Workspace`,description:`New conversation — engine/shell picker with destination + context toggles`,hint:{keys:`ctrl+e`},presentation:`onePress`},{id:`chat.tab.fork`,scope:`workspace`,keys:[],prefixKeys:[`c`],category:`Workspace`,description:`Fork this chat into a new tab (same Task directory, keeps the conversation)`,hint:{keys:`ctrl+a c`}},{id:`chat.fork.new`,scope:`workspace`,keys:[],prefixKeys:[`f`],category:`Workspace`,description:`Quick-fork: create child task seeded with current repo/branch/model`,hint:{keys:`ctrl+a f`}},{id:`chat.tab.close`,scope:`workspace`,keys:[`ctrl+w`],prefixKeys:[`w`],category:`Workspace`,description:`Close chat tab`,hint:{keys:`ctrl+w`},presentation:`onePress`},{id:`workspace.reopenSession`,scope:`workspace`,keys:[`return`],category:`Workspace`,description:`Reopen a session in a task whose tabs are all closed`,hint:{keys:`enter`},presentation:`onePress`},{id:`chat.tab.rename`,scope:`workspace`,keys:[`f2`],category:`Workspace`,description:`Rename active chat tab`,hint:{keys:`f2`},presentation:`onePress`},{id:`chat.tab.cycle-next`,scope:`workspace`,keys:[`ctrl+]`],category:`Workspace`,description:`Next chat tab`,hint:{keys:`ctrl+]`},presentation:`onePress`},{id:`chat.tab.cycle-prev`,scope:`workspace`,keys:[`ctrl+[`],category:`Workspace`,description:`Previous chat tab`,hint:{keys:`ctrl+[`},presentation:`onePress`},{id:`chat.tab.goto`,scope:`workspace`,keys:[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`].map(e=>`ctrl+${e}`),category:`Workspace`,description:`Go to chat tab N`,hint:{keys:`ctrl+1-9`},presentation:`onePress`},{id:`workspace.split.right`,scope:`workspace`,keys:[`ctrl+\\`],category:`Workspace`,description:`Split right`,hint:{keys:`ctrl+\\`},presentation:`onePress`},{id:`workspace.split.down`,scope:`workspace`,keys:[`ctrl+=`],category:`Workspace`,description:`Split down`,hint:{keys:`ctrl+=`},presentation:`onePress`},{id:`workspace.split.focus-next`,scope:`workspace`,keys:[`f3`],category:`Workspace`,description:`Focus next split`,hint:{keys:`f3`},presentation:`onePress`},{id:`workspace.split.close`,scope:`workspace`,keys:[`ctrl+w`],prefixKeys:[`w`],category:`Workspace`,description:`Close active split (tab when unsplit)`,hint:{keys:`ctrl+w`},presentation:`onePress`},{id:`workspace.split.rename`,scope:`workspace`,keys:[`f2`],category:`Workspace`,description:`Rename active split (tab when unsplit)`,hint:{keys:`f2`},presentation:`onePress`}],As=[{id:`files.nav`,scope:`files`,keys:[`j`,`k`,`down`,`up`],category:`Files`,description:`Move cursor up/down`,hint:{keys:`j/k`}},{id:`files.hierarchy`,scope:`files`,keys:[`h`,`l`,`left`,`right`],category:`Files`,description:`Collapse / expand tree level`,hint:{keys:`h/l`}},{id:`files.open`,scope:`files`,keys:[`return`],category:`Files`,description:`Open file in configured editor (diff when supported)`,hint:{keys:`enter`}},{id:`files.tab`,scope:`files`,keys:[`[`,`]`],category:`Files`,description:`Switch tab (cycle All / Changes)`,hint:{keys:`[/]`}},{id:`files.refresh`,scope:`files`,keys:[`r`],category:`Files`,description:`Refresh`,hint:{keys:`r`}},{id:`files.scope`,scope:`files`,keys:[`b`],category:`Files`,description:`Toggle Changes scope (working ↔ branch vs base)`,hint:{keys:`b`}},{id:`files.diff`,scope:`files`,keys:[`d`],category:`Files`,description:`Open read-only diff in a workspace tab`,hint:{keys:`d`}},{id:`files.diffAll`,scope:`files`,keys:[`shift+d`],category:`Files`,description:`Open the whole worktree's diff in one workspace tab`,hint:{keys:`D`}},{id:`files.openExternal`,scope:`files`,keys:[`o`],category:`Files`,description:`Open file in system default app (audio / video / pdf preview)`,hint:{keys:`o`}},{id:`files.mention`,scope:`files`,keys:[`a`],category:`Files`,description:`Inject @<path> mention into the engine pane`,hint:{keys:`a`}},{id:`files.search.enter`,scope:`files`,keys:[`/`],category:`Files`,description:`Search file names and text`,hint:{keys:`/`}},{id:`files.hidden`,scope:`files`,keys:[`.`],category:`Files`,description:`Show or hide dot files and folders on the All tab`,hint:{keys:`.`}},{id:`files.changesView`,scope:`files`,keys:[`t`],category:`Files`,description:`Show Changes as a folder tree or a flat list`,hint:{keys:`t`}},{id:`files.search.nav`,scope:`files`,keys:[`down`,`up`],category:`Files`,description:`Move highlight in file search results`},{id:`files.search.submit`,scope:`files`,keys:[`return`],category:`Files`,description:`Open the highlighted search result`},{id:`files.search.cancel`,scope:`files`,keys:[`escape`],category:`Files`,description:`Close file search`},{id:`files.createPR`,scope:`global`,keys:[],prefixKeys:[`p`,`shift+p`],category:`Files`,description:`Ask the agent to create a PR from the current task`},{id:`files.fixChecks`,scope:`global`,keys:[],prefixKeys:[`k`],category:`Files`,description:`Ask the agent to fix the failing PR checks`},{id:`files.syncBase`,scope:`global`,keys:[],prefixKeys:[`u`],category:`Files`,description:`Merge the base branch into this task's worktree`},{id:`diff.review.cursor`,scope:`workspace`,keys:[`j`,`k`,`down`,`up`],bareKeys:!0,category:`Diff review`,description:`Move the line cursor over the diff`,hint:{keys:`j/k`}},{id:`diff.review.range`,scope:`workspace`,keys:[`v`],bareKeys:!0,category:`Diff review`,description:`Toggle range anchor at the cursor`,hint:{keys:`v`}},{id:`diff.review.note`,scope:`workspace`,keys:[`c`],bareKeys:!0,category:`Diff review`,description:`Add a review note at the cursor`,hint:{keys:`c`}},{id:`diff.review.send`,scope:`workspace`,keys:[`s`],bareKeys:!0,category:`Diff review`,description:`Send all unsent review notes to the engine`,hint:{keys:`s`}},{id:`diff.review.drop`,scope:`workspace`,keys:[`x`],bareKeys:!0,category:`Diff review`,description:`Drop the review note the cursor sits inside`,hint:{keys:`x`}},{id:`diff.review.reload`,scope:`workspace`,keys:[`r`],bareKeys:!0,category:`Diff review`,description:`Reload the previewed file from disk`,hint:{keys:`r`}}],js=[{id:`inbox.show`,scope:`global`,keys:[],prefixKeys:[`i`],category:`Global`,description:`Open Inbox`},{id:`inbox.nav`,scope:`inbox`,keys:[`j`,`k`,`down`,`up`],category:`Inbox`,description:`Move cursor up/down`,hint:{keys:`j/k`}},{id:`inbox.open`,scope:`inbox`,keys:[`return`],category:`Inbox`,description:`Open the selected Task and Terminal Tab`,hint:{keys:`enter`}},{id:`inbox.delete`,scope:`inbox`,keys:[`d`],category:`Inbox`,description:`Ack the selected Inbox item`,hint:{keys:`d`}},{id:`inbox.deleteAll`,scope:`inbox`,keys:[`shift+d`],category:`Inbox`,description:`Ack every ATTENTION item`,hint:{keys:`D`}}],Ms=[{id:`palette.open`,scope:`global`,keys:[],prefixKeys:[`/`],category:`Global`,description:`Search commands`},{id:`help.open`,scope:`global`,keys:[`f1`],category:`Global`,description:`Show keybindings help`,hint:{keys:`F1`},presentation:`onePress`},{id:`task.new`,scope:`sidebar`,keys:[`n`],category:`Sidebar`,description:`New task`,hint:{keys:`n`}},{id:`task.new.global`,scope:`global`,keys:[],prefixKeys:[`n`],category:`Global`,description:`New task`},{id:`task.openEditor`,scope:`global`,keys:[],prefixKeys:[`o`],category:`Global`,description:`Open active Task directory in editor`},{id:`task.moveMode`,scope:`global`,keys:[],prefixKeys:[`m`],category:`Global`,description:`Reorder sidebar rows (then j/k)`},{id:`settings.open`,scope:`global`,keys:[],prefixKeys:[`,`],category:`Global`,description:`Open settings`},{id:`app.refresh`,scope:`global`,keys:[],prefixKeys:[`r`],category:`Global`,description:`Refresh Rove onto the installed build (after an update)`},{id:`settings.open.sidebar`,scope:`sidebar`,keys:[`s`],category:`Sidebar`,description:`Open settings`,hint:{keys:`s`}},{id:`worktrees.open.sidebar`,scope:`sidebar`,keys:[`x`],category:`Sidebar`,description:`Open worktrees`,hint:{keys:`x`}},{id:`kanban.open`,scope:`global`,keys:[],prefixKeys:[`1`],category:`Global`,description:`Open kanban (issues board)`},{id:`automations.open`,scope:`global`,keys:[],prefixKeys:[`2`],category:`Global`,description:`Open routines (scheduled tasks)`},{id:`workItems.open`,scope:`global`,keys:[],prefixKeys:[`3`],category:`Global`,description:`Open GitHub issues (external tracker)`},{id:`app.quit`,scope:`sidebar`,keys:[`q`,`ctrl+q`],category:`Sidebar`,description:`Quit (with confirm)`,hint:{keys:`q`}},{id:`focus.sidebar`,scope:`workspace`,keys:[`ctrl+q`],prefixKeys:[`q`],category:`Workspace`,description:`Back to sidebar (tasks)`,hint:{keys:`ctrl+q`},presentation:`onePress`},{id:`focus.previous`,scope:`global`,keys:[],prefixKeys:[`h`],category:`Navigation`,description:`Focus previous pane (files → workspace → sidebar)`},{id:`focus.next`,scope:`global`,keys:[`f4`],prefixKeys:[`l`],category:`Navigation`,description:`Focus next pane (sidebar → workspace → files)`,hint:{keys:`f4`},presentation:`onePress`},{id:`attention.next`,scope:`global`,keys:[`f7`],category:`Navigation`,description:`Jump to the next available Inbox item`,hint:{keys:`f7`},presentation:`onePress`},{id:`task.previous`,scope:`global`,keys:[],prefixKeys:[`tab`],category:`Navigation`,description:`Back to the previous task`},{id:`workspace.filesToggle`,scope:`global`,keys:[],prefixKeys:[`z`],category:`Navigation`,description:`Show or hide the Files pane`},{id:`view.redraw`,scope:`global`,keys:[],prefixKeys:[`r`],category:`Global`,description:`Redraw the screen`},{id:`sidebar.nav`,scope:`sidebar`,keys:[`j`,`k`,`down`,`up`],category:`Sidebar`,description:`Move cursor up/down`,hint:{keys:`j/k`}},{id:`sidebar.select`,scope:`sidebar`,keys:[`return`],category:`Sidebar`,description:`Open the selected task`,hint:{keys:`enter`}},{id:`sidebar.tree.open`,scope:`sidebar`,keys:[`l`,`space`],category:`Sidebar`,description:`Open the row under the cursor (a tab row enters its chat)`,hint:{keys:`l`}},{id:`sidebar.goto`,scope:`sidebar`,keys:[`g`,`shift+g`],category:`Sidebar`,description:`Top / bottom of list (gg or shift-G)`},{id:`sidebar.rename`,scope:`sidebar`,keys:[`r`],category:`Sidebar`,description:`Rename task`,hint:{keys:`r`}},{id:`sidebar.localMerge`,scope:`sidebar`,keys:[`shift+m`],category:`Sidebar`,description:`Reorder row (Shift+M, then j/k)`,hint:{keys:`M`}},{id:`sidebar.pin`,scope:`sidebar`,keys:[`shift+p`],category:`Sidebar`,description:`Pin / unpin task at top (Shift+P)`,hint:{keys:`P`}},{id:`sidebar.sort`,scope:`sidebar`,keys:[`t`],category:`Sidebar`,description:`Cycle task sort (default → recent → attention → name)`,hint:{keys:`t`}},{id:`sidebar.delete`,scope:`sidebar`,keys:[`d`],category:`Sidebar`,description:`Remove session (with confirm)`,hint:{keys:`d`}},{id:`sidebar.search.enter`,scope:`sidebar`,keys:[`/`],category:`Sidebar`,description:`Search tasks (fuzzy filter)`,hint:{keys:`/`}},{id:`sidebar.search.nav`,scope:`sidebar`,keys:[`down`,`up`],category:`Sidebar`,description:`Move highlight in search results`},{id:`sidebar.search.submit`,scope:`sidebar`,keys:[`return`],category:`Sidebar`,description:`Select search match and exit search`},{id:`sidebar.search.cancel`,scope:`sidebar`,keys:[`escape`],category:`Sidebar`,description:`Cancel search (restore prior selection)`},{id:`tasks.openWorktree`,scope:`sidebar`,keys:[`o`],category:`Tasks pane`,description:`Open selected Task directory in your editor`,hint:{keys:`o`}},{id:`tasks.renameBranch`,scope:`sidebar`,keys:[`b`],category:`Tasks pane`,description:`Rename the selected task's git branch`,hint:{keys:`b`}},{id:`tasks.cycleEngine`,scope:`sidebar`,keys:[`v`],category:`Tasks pane`,description:`Cycle engine vendor — applies on reopen`,hint:{keys:`v`}},{id:`tasks.update`,scope:`sidebar`,keys:[`u`],category:`Tasks pane`,description:`Open the update page — version check + release notes`,hint:{keys:`u`}},{id:`tasks.focusEngine`,scope:`sidebar`,keys:[`right`],category:`Tasks pane`,description:`Focus the engine pane of the current window`,hint:{keys:`→`}},...ks,...As,...js,{id:`terminal.scroll-up`,scope:`terminal`,keys:[`ctrl+pageup`],category:`Terminal`,description:`Scroll scrollback up`,hint:{keys:`ctrl+pgup`}},{id:`terminal.scroll-down`,scope:`terminal`,keys:[`ctrl+pagedown`],category:`Terminal`,description:`Scroll scrollback down`},{id:`terminal.reset`,scope:`terminal`,keys:[`f5`],category:`Terminal`,description:`Reset terminal — kill the current shell and respawn`,hint:{keys:`f5`},presentation:`onePress`}],Ns={ctrl:`⌃`,control:`⌃`,alt:`⌥`,opt:`⌥`,option:`⌥`,shift:`⇧`,cmd:`⌘`,command:`⌘`,meta:`⌘`,super:`⌘`},Ps={enter:`⏎`,return:`⏎`,esc:`⎋`,escape:`⎋`,space:`␣`,up:`↑`,down:`↓`,left:`←`,right:`→`,backspace:`⌫`,delete:`⌦`,del:`⌦`,pgup:`⇞`,pageup:`⇞`,pgdn:`⇟`,pagedown:`⇟`,home:`↖`,end:`↘`};function Fs(e,t){if(e.includes(`/`))return e.split(`/`).map(e=>Fs(e,t)).join(`/`);let n=e.toLowerCase();return n===`tab`?`tab`:Ps[n]||(/^f\d{1,2}$/.test(n)?n.toUpperCase():t?/^[a-z]$/.test(n)?e.toUpperCase():e.replace(/[a-z]+/gi,e=>e.toUpperCase()):e)}function Is(e,t=`⌃A`){let n=e.trim();if(!n)return n;let r=/^prefix\s+(.+)$/i.exec(n);if(r){let e=r[1]??``;return`${t} ${e.includes(`+`)?Is(e,t):Fs(e,!0)}`}let i=n.split(`+`);if(i.length===1)return Fs(i[0]??``,!1);let a=i[i.length-1]??``;return`${i.slice(0,-1).map(e=>Ns[e.toLowerCase().trim()]??e).join(``)} ${Fs(a,!0)}`}var Ls={path:``,exists:!1,rows:[],prefix:{key:`ctrl+a`,firstStrokes:[`ctrl+a`],timeoutMs:5e3},plugins:[],applied:[],warnings:[]},Rs=y(Ls),zs=new Map(Ms.map(e=>[e.id,{keys:[...e.keys],prefixKeys:e.prefixKeys&&[...e.prefixKeys],hint:e.hint&&{...e.hint}}]));function Bs(e){for(let e of Ms){let t=zs.get(e.id);if(!t)continue;let n=e;n.keys=[...t.keys],n.prefixKeys=t.prefixKeys&&[...t.prefixKeys],n.hint=t.hint&&{...t.hint}}for(let t of e.rows){let e=Ms.find(e=>e.id===t.id);e&&(e.keys=[...t.keys],e.prefixKeys=t.prefixKeys&&[...t.prefixKeys],e.hint=t.hint&&{...t.hint})}Rs.set(e)}async function Vs(e){try{Bs(await e.request(`keybindings.get`))}catch{}}function Hs(e){let t=b(e.conn).hello;(0,h.useEffect)(()=>{if(!t)return;let n=()=>void Vs(e);return n(),window.addEventListener(`focus`,n),()=>window.removeEventListener(`focus`,n)},[t,e])}var Us=()=>Rs.get().prefix.key,Ws=()=>{let e=Us();return e===null?``:Is(e)};function Gs(e,t=`direct`){let n=Ms.find(t=>t.id===e),r=t===`prefix`?n?.prefixKeys?.[0]:n?.keys[0];return r===void 0?void 0:Is(r)}var Ks=e=>Ms.find(t=>t.id===e)?.keys??[];function qs(e){let t=Ws(),n=Gs(e,`prefix`);return t&&n?`${t} ${n}`:``}var Js=e=>zs.get(e)?.prefixKeys??[];function Ys(e,t){let n=Rs.get().rows.find(t=>t.id===e),r=zs.get(e),i=t===`prefix`?n?.prefixKeys:n?.keys,a=t===`prefix`?r?.prefixKeys:r?.keys;return i&&JSON.stringify(i)!==JSON.stringify(a??[])?i:void 0}function Xs(e,t){for(let n of t){let t=e.find(e=>e.chord===n);if(t)return t}}function Zs(e){return!e.dialog&&e.page!==`worktrees`&&e.page!==`update`}var Qs=[];function $s(e){Qs.push(e)}var ec={workspace:`workspace`,sidebar:`sidebar`,files:`files`,terminal:`terminal`};function tc(){let e=Qs.flatMap(e=>e()),t=new Set(e.filter(e=>!e.prefix).map(e=>e.id)),n=e.map(e=>{let t=Ys(e.id,e.prefix?`prefix`:`direct`);return t?{...e,chords:t}:e});for(let r of e){let e=r.prefix?Ys(r.id,`direct`):void 0;if(!e||e.length===0||t.has(r.id))continue;t.add(r.id);let i=Ms.find(e=>e.id===r.id)?.scope??`global`;n.push({...r,prefix:!1,chords:e,...ec[i]?{surface:ec[i]}:{}})}return n}function nc(e,t){return!e.surface||e.surface===t||t===`terminal`&&e.surface===`workspace`}function rc(e,t){return e.surface===t?0:e.surface?1:2}function ic(){let e=document.activeElement;return e instanceof Element?e.closest(`.xterm`)?`terminal`:e.closest(`.rail`)?`sidebar`:e.closest(`.files`)?`files`:e.closest(`.workspace, .side-panel`)?`workspace`:null:null}function ac(e,t){let n=new Set,r=new Set;for(let i of tc())!nc(i,t)||i.live?.(e)===!1||(i.prefix?r:n).add(i.id);return{direct:n,prefix:r,inputPassthrough:t===`terminal`}}function oc(){let e=new Set(tc().map(e=>e.id));return Ms.filter(t=>e.has(t.id))}var sc=new Map,cc=y(null);function lc(e){return sc.set(e.stream,e),()=>{sc.get(e.stream)===e&&sc.delete(e.stream),cc.get()===e&&cc.set(null)}}function uc(e){return sc.get(e)}$s(()=>[{id:`terminal.scroll-up`,chords:[`ctrl+pageup`],prefix:!1,surface:`terminal`,run:()=>cc.get()?.scrollPages(-1)},{id:`terminal.scroll-down`,chords:[`ctrl+pagedown`],prefix:!1,surface:`terminal`,run:()=>cc.get()?.scrollPages(1)},{id:`terminal.reset`,chords:[`f5`],prefix:!1,surface:`terminal`,run:()=>cc.get()?.reset()}]);var dc={INPUT:!0,TEXTAREA:!0,SELECT:!0},fc=`.rail, .side-panel, dialog, [role=dialog], [role=menu], [role=listbox]`;function pc(e){return!e||e.tagName===`BODY`||e.tagName===`HTML`?`none`:e.closest(`.xterm`)?`terminal`:dc[e.tagName]===!0||e.isContentEditable?`field`:e.closest(fc)?`pane`:`loose`}function mc(e,t,n){return e.key!==`Escape`||e.defaultPrevented||e.isComposing||e.ctrlKey||e.metaKey||e.altKey||e.shiftKey||n.overlay||!n.terminal?!1:t===`none`||t===`loose`}function hc(){(0,h.useEffect)(()=>{let e=e=>{if(e.key!==`Escape`)return;let t=Es(),n=document.activeElement;if(!mc(e,pc(n instanceof HTMLElement?n:null),{overlay:k.get()!==null||O.get()!==null||M.get()!==null||I.get()!==null,terminal:t!==null}))return;let r=t?.closest(`[data-stream]`)?.dataset.stream,i=r?uc(r):void 0;!t||!i||(e.preventDefault(),t.focus(),i.input(`\x1B`))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[])}function gc(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 _c(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 vc=e=>e===`routine_failed`,yc=e=>`${e.taskId??``}:${e.tabId??``}`;function bc(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)||yc(e).localeCompare(yc(t)))}function xc(e,t,n){let r=new Set(t),i=bc(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=>yc(e)===yc(n));return a<0||i.length===1?i[0]??null:i[(a+1)%i.length]??null}function Sc(e,t){return t===`failed`?Array.isArray(e)?e:`unreadable`:t}function Cc(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 wc(e,t,n=!1){let r=`attention.dismiss`,i;if(vc(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 Tc(e,t){wc(e,t),B(),ne.set(t.automationId??null),M.set(`routines`)}var Ec=6;function Dc(e,t){if(!e)return{identity:t,project:``,label:t};let n=fo(e.repo);return{identity:`${n} › ${e.label}`,project:n,label:e.label}}function Oc(e){let t=b(e.tasks),n=b(e.visits),r=b(e.tabs),[i,a]=(0,h.useState)(Date.now());(0,h.useEffect)(()=>{let e=window.setInterval(()=>a(Date.now()),3e4);return()=>window.clearInterval(e)},[]);let o=new Map((t?.tasks??[]).map(e=>[e.id,e])),s=(e,t)=>e&&t&&r[e]?.find(e=>e.id===t)?.title||``,c=bc(t?.attention??[],t?.tasks.map(e=>e.id)??[]).map((e,t)=>{let n=e.taskId?o.get(e.taskId):void 0;return{key:`a${t}:${e.taskId}:${e.tabId}`,section:`attention`,taskId:e.taskId,tabId:e.tabId,...Dc(n,e.label??e.taskId??``),subtitle:s(e.taskId,e.tabId)||n?.branch||``,at:e.at,attention:e}}),l=new Set(c.map(e=>`${e.taskId}:${e.tabId}`)),u=n.filter(e=>o.has(e.taskId)&&!l.has(`${e.taskId}:${e.tabId}`)).slice(0,Ec).map(e=>({key:`r:${e.taskId}:${e.tabId}`,section:`recent`,taskId:e.taskId,tabId:e.tabId,...Dc(o.get(e.taskId),e.taskId),subtitle:s(e.taskId,e.tabId)||o.get(e.taskId)?.branch||``,at:e.at})),d=[...c,...u],f=t=>{if(t.attention&&vc(t.attention.state))return Tc(e,t.attention);t.attention&&wc(e,t.attention),t.taskId&&o.has(t.taskId)&&(e.select(t.taskId,t.tabId),B())},p=()=>void Promise.all(c.map(t=>t.attention&&wc(e,t.attention,!0))),m=t=>t.attention&&void wc(e,t.attention,!0),g=e=>{let n=e.attention,r=e.taskId?o.get(e.taskId):void 0,i=n?.gateId?t?.gates?.find(e=>e.id===n.gateId&&e.status===`open`):void 0,a=e.tabId??i?.tabId??null;if(!(n&&r&&!r.machine&&!vc(n.state)&&(!n.gateId||i)&&(a||i)))return null;let s=n?.state===`permission_needed`||!!a&&r?.tabStatus?.[a]?.kind===`needs-input`,c=i?`gate`:n?.state===`dead`?`readonly`:s?`menu`:`reply`;return{id:`${e.taskId}:${e.tabId}:${n?.gateId??``}`,tabId:a,mode:c,gate:i}};return{attention:c,recent:u,cards:d,now:i,open:f,ack:m,ackAll:p,peekOf:g,menuOf:(e,t)=>{let n=g(e);return[...n?[{label:V(`inbox.phone.reply`),run:()=>t(n)}]:[],{label:V(`inbox.phone.open`),run:()=>f(e)},...e.attention?[{label:V(`inbox.phone.ack`),run:()=>m(e)}]:[]]}}}var kc=Reflect.get(globalThis,`__roveRelay`),Ac=kc!==void 0;function jc(e,t){return kc?kc.fetch(e,t):fetch(e,t)}async function Mc(e){if(!kc)return e;let t=await kc.fetch(e);return t.ok?URL.createObjectURL(new Blob([await t.arrayBuffer()],{type:`text/javascript`})):e}function Nc(e,t){return kc?new kc.WebSocket(e,t):new WebSocket(e,t)}var Pc=class extends Error{code;detail;constructor(e,t,n){super(t),this.code=e,this.detail=n}},Fc=[500,1e3,2e3,4e3,8e3,15e3],Ic=4e3,Lc=1e4,Rc=class{url;token;conn=y({state:`connecting`,hello:null,failures:0});ws=null;nextId=1;pending=new Map;listeners=new Map;openHooks=new Set;retryTimer=null;deadline=null;constructor(e,t){this.url=e,this.token=t}start(){this.connect();let e=()=>{document.visibilityState===`visible`&&this.checkNow()};document.addEventListener(`visibilitychange`,e),window.addEventListener(`online`,e),window.addEventListener(`pageshow`,e)}checkNow(){if(this.retryTimer!==null){this.retryNow();return}let e=this.ws;!e||this.conn.get().state!==`open`||this.deadline!==null||(this.armDeadline(e,Ic),this.request(`hello`).then(()=>this.clearDeadline(),e=>{e instanceof Pc&&e.code!==`NOT_CONNECTED`&&this.clearDeadline()}))}armDeadline(e,t){this.clearDeadline(),this.deadline=window.setTimeout(()=>this.lost(e),t)}clearDeadline(){this.deadline!==null&&window.clearTimeout(this.deadline),this.deadline=null}onOpen(e){return this.openHooks.add(e),this.conn.get().state===`open`&&e(),()=>this.openHooks.delete(e)}on(e,t){let n=this.listeners.get(e);return n||(n=new Set,this.listeners.set(e,n)),n.add(t),()=>n.delete(t)}request(e,t={},n){let r=this.ws;if(!r||r.readyState!==WebSocket.OPEN)return Promise.reject(new Pc(`NOT_CONNECTED`,`not connected to rove`));let i=this.nextId++;return new Promise((a,o)=>{this.pending.set(i,{resolve:e=>a(e),reject:o,progress:n}),r.send(JSON.stringify({id:i,op:e,args:t}))})}connect(){this.retryTimer=null;let e=Nc(this.url,this.token?[`rove.v1`,`rove.bearer.${this.token}`]:[`rove.v1`]);this.ws=e,this.armDeadline(e,Lc),e.onmessage=e=>this.receive(String(e.data)),e.onopen=()=>{this.request(`hello`,{userAgent:navigator.userAgent}).then(e=>{this.clearDeadline(),this.conn.set({state:`open`,hello:e,failures:0});for(let e of this.openHooks)e()},()=>this.lost(e))},e.onclose=t=>this.lost(e,t?.code)}lost(e,t){if(this.ws!==e)return;this.ws=null,this.clearDeadline(),e.onopen=null,e.onclose=null,e.onmessage=null,e.close();for(let e of this.pending.values())e.reject(new Pc(`NOT_CONNECTED`,`connection lost`));if(this.pending.clear(),t===4401){o(),this.conn.set({state:`retrying`,hello:null,failures:2});return}let n=this.conn.get().failures+1;this.conn.set({state:`retrying`,hello:this.conn.get().hello,failures:n});let r=Fc[Math.min(n-1,Fc.length-1)];this.retryTimer=window.setTimeout(()=>this.connect(),r)}receive(e){let t;try{t=JSON.parse(e)}catch{return}if(!t||typeof t!=`object`)return;if(`event`in t&&typeof t.event==`string`){let e=`data`in t?t.data:void 0;if(t.event===`op.progress`){let t=e;typeof t?.id==`number`&&typeof t.line==`string`&&this.pending.get(t.id)?.progress?.(t.line);return}for(let n of this.listeners.get(t.event)??[])n(e);return}if(!(`id`in t)||typeof t.id!=`number`)return;let n=this.pending.get(t.id);if(!n)return;if(this.pending.delete(t.id),`ok`in t&&t.ok===!0){n.resolve(`result`in t?t.result:void 0);return}let r=`error`in t&&t.error&&typeof t.error==`object`?t.error:{},i=`code`in r&&typeof r.code==`string`?r.code:`INTERNAL`,a=`message`in r&&typeof r.message==`string`?r.message:i;n.reject(new Pc(i,a,r))}retryNow(){this.retryTimer!==null&&(window.clearTimeout(this.retryTimer),this.connect())}};function zc(){return`${window.location.protocol===`https:`?`wss:`:`ws:`}//${window.location.host}/ws`}function Bc(e,t,n){return n&&n!==`leaf-1`?`${e}::${t}::${n}`:`${e}::${t}`}var Vc=`modulepreload`,Hc=function(e){return`/`+e},Uc={},Wc=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=Hc(t,n),t=s(t),t in Uc)return;Uc[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`:Vc,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)})},Gc=8,Kc=32,qc=3e3,Jc=100,Yc=new WeakMap,Xc=null;function Zc(e){let t=Yc.get(e);return t||(t={entries:new Map,snapshots:new Map,left:null},Yc.set(e,t)),t}function Qc(){return Xc||(Xc=document.createElement(`div`),Xc.style.display=`none`,document.body.append(Xc)),Xc}function $c(e,t,n){e.snapshots.delete(t),e.snapshots.set(t,n);for(let t of e.snapshots.keys()){if(e.snapshots.size<=Kc)break;e.snapshots.delete(t)}}function el(e,t,n){e.entries.delete(t.key),t.leaving!==null&&window.clearTimeout(t.leaving),t.leaving=null,n?$c(e,t.key,t.handle.snapshot()):e.snapshots.delete(t.key),t.handle.dispose(),t.box.remove()}function tl(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-Gc)))el(e,n,!0)}function nl(e,t){return Zc(e).entries.get(t)?.handle??null}function rl(e,t,n,r){return Zc(e).entries.get(Bc(t,n,r))?.slot.parkedAt!=null}async function il(e,t){let n=Zc(e.client),r=Bc(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,cl(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:()=>al(n,i)}}let a=document.createElement(`div`);a.className=Yn,e.host.append(a),ol(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 Wc(async()=>{let{mountTerminal:e}=await import(`./term-mount-CSGanVNa.js`);return{mountTerminal:e}},__vite__mapDeps([0,1,2])),d=u({...e,el:a,snapshot:l,onPainted:()=>cl(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&&el(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:()=>al(n,f)}}function al(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(),Qc().append(t.box),e.left=t,tl(e))}function ol(e,t){let n=e.left;e.left=null,!(!n||n.slot.parkedAt===null||performance.now()-n.slot.parkedAt>Jc)&&e.entries.get(n.key)===n&&(n.box.classList.add(`is-leaving`),t.append(n.box),n.leaving=window.setTimeout(()=>sl(e,n),qc))}function sl(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&&Qc().append(t.box))}function cl(e){for(let t of e.entries.values())sl(e,t)}async function ll(e,t,n){return Cc(await e.request(`output.read`,{taskId:t,tab:n,source:`terminal`,limit:12}))}async function ul(e,t,n,r){try{let i=await e.client.request(`tab.send`,{taskId:t,tabId:n,prompt:r});return i.delivered?!0:(z(V(`layout.composerNotSent`,{reason:i.reason??``}),`error`),!1)}catch(e){let t=e instanceof Pc?e.code:void 0;return z(t===`UNKNOWN_OP`?V(`layout.composerOldBridge`):t===`AWAITING_PERMISSION`?V(`layout.composerAtMenu`):e instanceof Error?e.message:String(e),`error`),!1}}async function dl(e,t,n,r){let{client:i}=e,a=Bc(t,n),o=uc(a)!==void 0||rl(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 fl(e,t,n){try{return(await e.client.request(`gate.answer`,{gateId:t,...n})).delivered||z(V(`inbox.gateKept`)),!0}catch(e){return z(e instanceof Error?e.message:String(e),`error`),!1}}var pl=(e,t,n)=>({id:e,cap:t,bytes:e=>`\x1b${e?`O`:`[`}${n}`}),ml={id:`enter`,cap:`⏎`,bytes:()=>`\r`},hl=[{id:`esc`,cap:`esc`,bytes:()=>`\x1B`},{id:`tab`,cap:`tab`,bytes:()=>` `},{id:`backtab`,cap:`⇧tab`,bytes:()=>`\x1B[Z`},{id:`interrupt`,cap:`^C`,bytes:()=>``},pl(`up`,`↑`,`A`),pl(`down`,`↓`,`B`),pl(`left`,`←`,`D`),pl(`right`,`→`,`C`),ml],gl=[`esc`,`backtab`,`interrupt`,`up`,`down`,`enter`];function _l(e){let t=e?[...yl.slice(0,-1),hl[0],ml]:hl.filter(e=>gl.includes(e.id));return{first:t,rest:hl.filter(e=>!t.includes(e))}}var vl=e=>({id:`option-${e}`,cap:String(e),bytes:()=>String(e)}),yl=[vl(1),vl(2),vl(3),vl(4),ml];function bl(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 xl=`\x1B[27;2;13~`;function Sl(e){return e.key!==`Enter`||!e.shiftKey||e.ctrlKey||e.metaKey||e.altKey?!1:!e.isComposing&&e.keyCode!==229}function Cl(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 wl=`mx-2.5 mt-0.5 mb-1.5 flex min-w-0 flex-col gap-1.5 font-mono text-meta`,Tl=2e3;function El(e,t,n){let[r,i]=(0,h.useState)(null),[a,o]=(0,h.useState)(0);return(0,h.useEffect)(()=>{if(!n)return;let r=!0,a=0,o=async()=>{try{let a=await ll(e.client,t,n);r&&i(a)}catch{r&&i(e=>Sc(e,`failed`))}r&&(a=window.setTimeout(o,Tl))};return o(),()=>{r=!1,window.clearTimeout(a)}},[e,t,n,a]),{lines:r,refresh:()=>o(e=>e+1)}}function Dl({d:e}){return(0,U.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,U.jsx)(`path`,{d:e})})}function Ol(e){H();let{model:t,taskId:n,tabId:r,mode:i,gate:a}=e,{lines:o,refresh:s}=El(t,n,r),c=(0,h.useRef)(null),[l,u]=(0,h.useState)(``),[d,f]=(0,h.useState)(!1);(0,h.useEffect)(()=>{let e=c.current;e&&(e.scrollTop=e.scrollHeight)},[o]);let p=async e=>{f(!0);let t=await e();return f(!1),t&&window.setTimeout(s,600),t},m=async()=>{let e=l.trim();!e||d||await p(()=>i===`gate`&&a?fl(t,a.id,{text:e}):r?ul(t,n,r,e):Promise.resolve(!1))&&u(``)};return(0,U.jsxs)(`div`,{className:wl,children:[a&&(0,U.jsx)(`p`,{className:`m-0 whitespace-pre-wrap wrap-anywhere text-ink`,children:a.question}),r&&(0,U.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===`unreadable`?V(`inbox.outputUnreadable`):o.length===0?V(`inbox.noOutput`):o.join(`
38
+ 然后找一下那个旧版本装的 hook。检查我的引擎设置文件,包括全局的和上面每个仓库里的,找命令里运行 \`rove hook worktree-created\` 的 hook。把找到的每一条连同所在文件给我看,我确认后再删。其他 hook 一律不动。`,legacyAdoptFailed:`清理会话没能启动:{message}`},Ta={open:`Open`,collapseChildren:`Collapse children`,expandChildren:`Expand children`,newChat:`New conversation`,newShell:`New shell`,continueEngine:`Continue in another engine…`,newScratchChat:`New conversation (no folder)`,newTask:`New task`,newTaskFromBranch:`New task from this branch`,forgetProject:`Remove project`,fieldNotes:`Field notes`,rename:`Rename`,pin:`Pin`,unpin:`Unpin`,reorder:`Reorder row`,moveToTop:`Move to top`,moveProjectUp:`Move up`,moveProjectDown:`Move down`,runAgain:`Run again`,setStatus:`Set status`,moveToProject:`Move session to…`,copy:`Copy`,more:`More`,copyId:`Copy task ID`,copyBranch:`Copy branch name`,copyPath:`Copy path`,openEditor:`Open in editor`,renameBranch:`Rename branch`,changeEngine:`Change engine`,fixChecks:`Fix failing checks`,rerunChecks:`Re-run failed checks`,syncBase:`Sync with base`,resolveConflicts:`Resolve conflicts`,abortOperation:`Abort paused merge or rebase`,land:`Land into base branch`,muteNotifications:`Mute notifications`,unmuteNotifications:`Unmute notifications`,archive:`Archive`,unarchive:`Unarchive`,delete:`Remove session`},Ea={open:`打开`,collapseChildren:`折叠子任务`,expandChildren:`展开子任务`,newChat:`新建会话`,newShell:`新建终端`,continueEngine:`换个引擎继续…`,newScratchChat:`新建会话(无文件夹)`,newTask:`新建任务`,newTaskFromBranch:`基于此分支新建任务`,forgetProject:`移除项目`,fieldNotes:`现场笔记`,rename:`重命名`,pin:`置顶`,unpin:`取消置顶`,reorder:`重新排序`,moveToTop:`移到顶部`,moveProjectUp:`上移`,moveProjectDown:`下移`,runAgain:`重新运行`,setStatus:`设置状态`,moveToProject:`移动会话到…`,copy:`复制`,more:`更多`,copyId:`复制任务 ID`,copyBranch:`复制分支名`,copyPath:`复制路径`,openEditor:`在编辑器中打开`,renameBranch:`重命名分支`,changeEngine:`切换引擎`,fixChecks:`修复失败的检查`,rerunChecks:`重新运行失败的检查`,syncBase:`同步基础分支`,resolveConflicts:`让 agent 解决冲突`,abortOperation:`中止暂停的合并或变基`,land:`合入基础分支`,muteNotifications:`静音通知`,unmuteNotifications:`取消静音通知`,archive:`归档`,unarchive:`取消归档`,delete:`移除会话`},Da={noDaemonWorktree:"No daemon running — can't create the worktree. Start it with `rove daemon restart`.",noEditor:`No editor found — set ROVE_OPEN_EDITOR (e.g. 'code', 'cursor', 'nvim')`,openWorktreeFailed:`Couldn't open worktree with {label}`,worktreeErrorDeleting:`This task is being deleted — it can't be opened`,worktreeErrorNotGit:"This project isn't a git repo yet — a task needs a git branch. Run `git init` (+ a first commit) in the project, then open the task. Non-git support is coming.",worktreeErrorGeneric:`Couldn't create the worktree: {message}`,noDiskSpace:`The disk is full, so the checkout could not be created. Free some space, then try again.`,scratchOpenFailed:`Couldn't open a scratch shell: {message}`,worktreeGoneTitle:`Worktree for "{title}" is gone`,worktreeGoneBody:`Closed {count} tab(s). The branch {branch} is still there — reopen the task to re-create its worktree.`,checksPassingTitle:`Checks passed for "{title}"`,checksFailingTitle:`Checks failed for "{title}"`,checksResolvedBody:`PR {pr} on {branch}`,copiedId:`Copied task ID {text}`,copiedTab:`Copied tab address {text}`,copiedSession:`Copied session ID {text}`,copiedBranch:`Copied branch {text}`,copiedPath:`Copied path {text}`,copyFailed:`Couldn't reach a clipboard — no clipboard command on PATH, and this terminal refused OSC 52.`,forgetProjectFailed:`Couldn't remove the project: {error}`,deleteFailed:`Couldn't delete "{title}": {error}`,createFailed:`Couldn't create the task: {error}`,engineStartFailed:`Task created; engine did not start`,engineStartRetry:`{error}. Press ⏎ on the task to retry.`,forkFailed:`Couldn't fork the task: {error}`,forkLeftBehind:`Started from the last commit — uncommitted work stays in the original task ({reason})`,childFailed:`Couldn't start the new conversation: {error}`,renameFailed:`Couldn't rename the task: {error}`,renameBranchFailed:`Couldn't rename the branch: {error}`,switchEngineFailed:`Couldn't switch the engine: {error}`,setStatusFailed:`Couldn't set the status: {error}`,pinFailed:`Couldn't change the pin: {error}`,moveFailed:`Couldn't move the task: {error}`,moveToProjectFailed:`Couldn't move the session: {error}`,movedToProject:`Moved to {project}`,issueChatFailed:`Couldn't start the issue chat: {error}`,inboxMarkReadFailed:`Couldn't mark it read: {error}`,inboxDismissFailed:`Couldn't dismiss it: {error}`,engineSwitched:`Engine → {engine} (applies on reopen)`,statusSet:`Status → {status}`},Oa={noDaemonWorktree:"守护进程未运行——无法创建 worktree。请运行 `rove daemon restart` 启动它。",noEditor:`未找到编辑器——请设置 ROVE_OPEN_EDITOR(如 'code'、'cursor'、'nvim')`,openWorktreeFailed:`无法用 {label} 打开 worktree`,worktreeErrorDeleting:`该任务正在删除中——无法打开`,worktreeErrorNotGit:"该项目尚非 git 仓库——任务需要 git 分支。请在项目中执行 `git init`(+ 首次提交)后再打开任务。非 git 项目的支持即将推出。",worktreeErrorGeneric:`无法创建 worktree:{message}`,noDiskSpace:`磁盘空间不足,没法创建工作目录。清理出一些空间后再重试。`,scratchOpenFailed:`无法打开临时 Shell:{message}`,worktreeGoneTitle:`"{title}" 的 worktree 已消失`,worktreeGoneBody:`已关闭 {count} 个标签页。分支 {branch} 仍在——重新打开该任务会重建 worktree。`,checksPassingTitle:`「{title}」的 PR 检查已通过`,checksFailingTitle:`「{title}」的 PR 检查失败了`,checksResolvedBody:`PR {pr},分支 {branch}`,copiedId:`已复制任务 ID {text}`,copiedTab:`已复制标签页地址 {text}`,copiedSession:`已复制会话 ID {text}`,copiedBranch:`已复制分支 {text}`,copiedPath:`已复制路径 {text}`,copyFailed:`无法访问剪贴板——PATH 上没有剪贴板命令,这个终端也拒绝了 OSC 52。`,forgetProjectFailed:`移除项目失败:{error}`,deleteFailed:`删除「{title}」失败:{error}`,createFailed:`创建任务失败:{error}`,engineStartFailed:`任务已创建,引擎没有启动`,engineStartRetry:`{error}。在任务上按 ⏎ 重试。`,forkFailed:`fork 任务失败:{error}`,forkLeftBehind:`已从最近一次提交开始——未提交的改动留在原任务里({reason})`,childFailed:`无法开始新对话:{error}`,renameFailed:`重命名任务失败:{error}`,renameBranchFailed:`重命名分支失败:{error}`,switchEngineFailed:`切换引擎失败:{error}`,setStatusFailed:`设置状态失败:{error}`,pinFailed:`修改置顶状态失败:{error}`,moveFailed:`移动任务失败:{error}`,moveToProjectFailed:`移动会话失败:{error}`,movedToProject:`已移到 {project}`,issueChatFailed:`启动议题会话失败:{error}`,inboxMarkReadFailed:`标记为已读失败:{error}`,inboxDismissFailed:`忽略失败:{error}`,engineSwitched:`引擎 → {engine}(重新打开后生效)`,statusSet:`状态 → {status}`},ka={nav:{kanban:`Kanban`,automations:`Routines`,issues:`Issues`,mods:`Mods`},header:{scratch:`Ungrouped`,connector:{weixin:`WeChat`,lark:`Lark`,inbox:`External messages`}},search:{placeholder:`fuzzy filter`},sort:{label:`sort: {mode}`,hint:`Change the order (manual → newest → attention → name)`,reorderSwitched:`Reorder needs manual order — switched`,modes:{default:`manual`,recent:`newest`,attention:`attention`,name:`name`}},menu:Ta,status:{backlog:`Backlog`,inProgress:`In progress`,inReview:`In review`,done:`Done`,canceled:`Canceled`,error:`Error`},setStatus:{title:`Set status`,current:`current`,footer:`↑↓ choose · enter set · esc cancel`},moveToProject:{title:`Move session to`,empty:"No other project yet — add one first, or run `rove api update --project PATH`",ungrouped:`Ungrouped`,footer:`↑↓ choose · enter move · esc cancel`},sync:{done:`Merged {base} into this worktree`,alreadyCurrent:`Already up to date with {base}`,conflict:`Merge conflict — resolve then commit: {files}`,dirty:`Commit the worktree's changes first, then sync: {files}`,failed:`Sync failed: {error}`},abortOp:{title:`Abort the {op}?`,body:`Git puts {branch} back where it was before the {op} started. Conflict resolutions made since then are lost.`,confirm:`Abort {op}`,done:`Aborted the {op} on {branch}`,failed:`Couldn't abort the {op}: {error}`},archive:{done:`Archived {title}`,restored:`Restored {title}`,busyTitle:`Archive while it's working?`,busyBody:`An engine in {title} is still working or waiting on you. Archiving stops it.`,busyConfirm:`Archive anyway`,failed:`Couldn't archive: {error}`,restoreFailed:`Couldn't restore: {error}`},rerun:{started:`Re-running failed checks`,none:`No failed checks to re-run`,external:`These checks didn't run on GitHub Actions; re-run them where they ran`,refused:`Re-run refused: {detail}`},changeEngine:{title:`Change engine`,current:`current`,effortLabel:`EFFORT`,noEffort:`engine default`,footer:{engine:`↑↓ engine`,effort:`←→ effort`,model:`tab model`,set:`enter set`,cancel:`esc cancel`}},engineModel:{label:`MODEL`,placeholder:`engine default`,loading:`listing models…`},tier:{swift:`swift`,standard:`standard`,deep:`deep`,manual:`manual`},tierDesc:{swift:`small, well-specified edits — the fastest, cheapest setting`,standard:`everyday feature work and bug fixes`,deep:`hard problems: unclear root causes, large refactors, design decisions`},runAgain:{title:`Run again`,source:`Brief from “{title}”`,hint:`Runs this brief again in a new task, on its own branch and worktree.`,confirm:`Run again`,footer:`↑↓ scroll · ←→ choose · enter run · esc cancel`},fieldNotes:{title:`Field notes`,empty:"No field notes for this repo yet — agents file one with `rove api note`.",loading:`Loading…`,footer:`↑↓ scroll · esc close`,footerDeletable:`↑↓ select · d delete · esc close`,confirmDelete:{title:`Delete this field note?`,body:`“{text}” stops being injected into new sessions on this repo. Nothing else changes.`}},confirm:Ca,renameBranch:{title:`Rename branch`,fieldLabel:`branch`},moveChip:` move`,recentJump:`Recent: {title}`,archivedHit:`{title} · archived, enter unarchives`,machine:{connecting:`connecting…`,offline:`offline`,unsupported:`unsupported`,mismatch:`protocol mismatch`,filesElsewhere:`on {host}`,filesHint:`{host} is unreachable right now; its files show here again when it reconnects.`,terminalElsewhere:`This task runs on {host}, which is unreachable right now.`,runsOn:`on {host}`,noTabs:`No tabs on {host} yet — prefix t opens one there.`},empty:{noMatchSearch:`No matching tasks — esc to clear.`,noActiveProject:`No active tasks for this project.`,noActive:`No active tasks — create one above.`},activity:{working:`working`,rateLimited:`rate limited`,permissionNeeded:`needs permission`,error:`error`,dead:`engine exited`},group:{waitingOnYou:`needs you`,landing:`ready to land`,readyForReview:`needs review`,working:`working`},subtitle:{noTracking:`no activity tracking`,materializing:`materializing`,deleting:`deleting`,deleteFailed:`delete failed`},reBranch:{title:`Set branch`,fieldLabel:`branch`,hintNoBranches:`(no local branches — type a new name)`,hintNoMatch:`(no match — enter renames to this branch)`,footer:`↑↓ pick · enter set · esc cancel`},toast:Da},Aa={nav:{kanban:`看板`,automations:`例行任务`,issues:`议题`,mods:`Mods`},header:{scratch:`未分组`,connector:{weixin:`微信`,lark:`飞书`,inbox:`外部消息`}},search:{placeholder:`模糊搜索`},sort:{label:`排序:{mode}`,hint:`切换排序(手动 → 最新 → 关注 → 名称)`,reorderSwitched:`调整顺序需手动排序,已切换`,modes:{default:`手动`,recent:`最新`,attention:`关注`,name:`名称`}},menu:Ea,status:{backlog:`待办`,inProgress:`进行中`,inReview:`待评审`,done:`已完成`,canceled:`已取消`,error:`出错`},setStatus:{title:`设置状态`,current:`当前`,footer:`↑↓ 选择 · enter 设置 · esc 取消`},moveToProject:{title:`移动会话到`,empty:"还没有其他项目——先添加一个,或运行 `rove api update --project PATH`",ungrouped:`未分组`,footer:`↑↓ 选择 · enter 移动 · esc 取消`},sync:{done:`已把 {base} 合并进该工作树`,alreadyCurrent:`已经和 {base} 同步`,conflict:`合并冲突——解决后提交:{files}`,dirty:`请先提交工作树里的改动,再同步:{files}`,failed:`同步失败:{error}`},abortOp:{title:`中止这次 {op}?`,body:`Git 会把 {branch} 恢复到 {op} 开始之前的状态,此后做过的冲突解决都会丢失。`,confirm:`中止 {op}`,done:`已中止 {branch} 上的 {op}`,failed:`无法中止 {op}:{error}`},archive:{done:`已归档 {title}`,restored:`已恢复 {title}`,busyTitle:`它还在工作,仍要归档?`,busyBody:`{title} 里有引擎仍在工作或在等你。归档会把它停掉。`,busyConfirm:`仍要归档`,failed:`归档失败:{error}`,restoreFailed:`恢复失败:{error}`},rerun:{started:`正在重新运行失败的检查`,none:`没有可重新运行的失败检查`,external:`这些检查不是在 GitHub Actions 上运行的,请到它们运行的地方重新运行`,refused:`无法重新运行:{detail}`},changeEngine:{title:`切换引擎`,current:`当前`,effortLabel:`推理强度`,noEffort:`引擎默认`,footer:{engine:`↑↓ 引擎`,effort:`←→ 强度`,model:`tab 模型`,set:`enter 设置`,cancel:`esc 取消`}},engineModel:{label:`模型`,placeholder:`引擎默认`,loading:`正在列出模型…`},tier:{swift:`轻快`,standard:`标准`,deep:`深入`,manual:`手动`},tierDesc:{swift:`小而明确的改动——最快、最省的一档`,standard:`日常的功能开发和修 bug`,deep:`难题:根因不明、大重构、设计决策`},runAgain:{title:`重新运行`,source:`来自任务「{title}」的指令`,hint:`在新任务里重新执行这段指令,新任务有自己的分支和工作树。`,confirm:`重新运行`,footer:`↑↓ 滚动 · ←→ 选择 · enter 运行 · esc 取消`},confirm:wa,renameBranch:{title:`重命名分支`,fieldLabel:`分支`},fieldNotes:{title:`现场笔记`,empty:"该仓库暂无现场笔记——agent 可用 `rove api note` 记录。",loading:`加载中…`,footer:`↑↓ 滚动 · esc 关闭`,footerDeletable:`↑↓ 选择 · d 删除 · esc 关闭`,confirmDelete:{title:`删除这条现场笔记?`,body:`「{text}」将不再注入该仓库的新会话。其他内容不受影响。`}},moveChip:` 移动`,recentJump:`最近:{title}`,archivedHit:`{title} · 已归档,回车恢复`,machine:{connecting:`连接中…`,offline:`离线`,unsupported:`不支持`,mismatch:`协议不兼容`,filesElsewhere:`在 {host} 上`,filesHint:`{host} 暂时连不上;重新连上后这里会再显示它的文件。`,terminalElsewhere:`这个任务跑在 {host} 上,暂时连不上。`,runsOn:`在 {host} 上`,noTabs:`{host} 上还没有 tab——按 prefix t 在那里新开一个。`},empty:{noMatchSearch:`无匹配任务——按 esc 清除。`,noActiveProject:`该项目暂无活跃任务。`,noActive:`暂无活跃任务——在上方新建。`},activity:{working:`运行中`,rateLimited:`请求受限`,permissionNeeded:`等待授权`,error:`错误`,dead:`引擎已退出`},group:{waitingOnYou:`等你处理`,landing:`可以合了`,readyForReview:`待你验收`,working:`运行中`},subtitle:{noTracking:`不跟踪活动`,materializing:`正在创建 worktree`,deleting:`正在删除`,deleteFailed:`删除失败`},reBranch:{title:`设置分支`,fieldLabel:`分支`,hintNoBranches:`(没有本地分支——输入新名称)`,hintNoMatch:`(无匹配——回车将分支重命名为此名)`,footer:`↑↓ 选择 · enter 设置 · esc 取消`},toast:Oa},ja={noTask:`(no task — press n to create)`,exited:`process exited — F5 restarts it`,engineExit:{title:`Engine exited`,titleCode:`Engine exited (code {code})`,retry:`Retry`,settings:`Settings → Engines`,another:`Another engine`,continueIn:`Continue in another engine`},usageLimit:{title:`Usage limit reached`,dismiss:`Dismiss`},restoring:`restoring session…`,recovery:{live:`Live process reattached`,relaunched:`Command relaunched in a new process. Any restored output is historical; check the engine to resume or continue your conversation.`,restored:`Historical screen restored; previous process ended. Restart and check the engine before continuing.`},tab:{groupTitle:`group {n}`,renameTitle:`Rename tab`,renameField:`TAB TITLE`,renameSubmit:`rename`,chooseEngineHint:`←/→ or h/l choose, enter confirm, esc cancel`,newChat:{title:`New conversation`,engine:`ENGINE`,destLabel:`DESTINATION`,destTab:`child task, same directory`,destFork:`fork a child task (new worktree)`,destScratch:`new scratch task ($HOME)`,ctxLabel:`CONTEXT`,ctxFresh:`fresh conversation`,ctxContinue:`continue this conversation`},cannotCloseLast:`Cannot close the only tab`,tabGone:`That tab is no longer there`,closeOthersTitle:`Close the other tabs?`,closeOthersBody:`Closing {count} · their sessions end, this tab stays open.`,closeOthersConfirm:`close tabs`,closeOthersCancel:`cancel`,menu:{rename:`Rename tab`,copyAddress:`Copy tab address`,copySessionId:`Copy session ID`,continueEngine:`Continue in another engine…`,closeOthers:`Close other tabs`,close:`Close tab`},nothingToFork:`No conversation in this tab to fork yet`,noSessionYet:`No conversation in this tab yet`,noSessionYetHint:`Send the engine a prompt; its session ID exists once the conversation starts.`,noTranscriptToHandOff:`{engine} keeps no readable transcript to hand over`},split:{renameTitle:`Rename split`,renameField:`SPLIT NAME`},scrolledBack:`↑ scrolled {lines}L`,scrollFirst:`[first]`,scrollLatest:`[latest]`,unavailable:{shellMissing:`terminal unavailable — the shell named by $SHELL isn't on this machine. Point $SHELL at one that exists, or unset it to fall back to the system default.`,spawnFailed:`terminal unavailable — the shell exited immediately. Its error is in ~/.rove/pty.log.`,retry:`F5 tries again`},reset:{title:`Reset terminal?`,body:`The running shell will be killed and a fresh one will spawn at the worktree. Any in-flight processes (vim, htop, paused jobs) end immediately.`}},Ma={recovery:{live:`已重新连接仍在运行的进程`,relaunched:`命令已在新进程中重启。如有恢复的输出,它属于历史记录;请在引擎内确认会话恢复或继续操作。`,restored:`已恢复历史画面;原进程已结束。请重启并确认引擎状态后继续。`},noTask:`(无任务 —— 按 n 创建)`,exited:`进程已退出 —— 按 F5 重启`,engineExit:{title:`引擎已退出`,titleCode:`引擎已退出(退出码 {code})`,retry:`重试`,settings:`设置 → 引擎`,another:`换个引擎`,continueIn:`换个引擎继续`},usageLimit:{title:`已达到用量上限`,dismiss:`忽略`},restoring:`正在恢复会话…`,tab:{groupTitle:`group {n}`,renameTitle:`重命名标签页`,renameField:`标签页名称`,renameSubmit:`重命名`,chooseEngineHint:`←/→ 或 h/l 选择,enter 确认,esc 取消`,newChat:{title:`新建对话`,engine:`引擎`,destLabel:`落点`,destTab:`子任务,同一目录`,destFork:`fork 子任务(新 worktree)`,destScratch:`新临时任务($HOME)`,ctxLabel:`上下文`,ctxFresh:`全新对话`,ctxContinue:`接着当前对话`},cannotCloseLast:`无法关闭唯一的标签页`,tabGone:`这个标签页已经不在了`,closeOthersTitle:`关闭其他标签页?`,closeOthersBody:`将关闭 {count} 个,它们的会话会结束,只保留这个标签页。`,closeOthersConfirm:`关闭标签页`,closeOthersCancel:`取消`,menu:{rename:`重命名标签页`,copyAddress:`复制标签页地址`,copySessionId:`复制会话 ID`,continueEngine:`换个引擎继续…`,closeOthers:`关闭其他标签页`,close:`关闭标签页`},nothingToFork:`这个标签页还没有可派生的对话`,noSessionYet:`这个标签页还没有对话`,noSessionYetHint:`先给引擎发一条消息,对话开始后才有会话 ID。`,noTranscriptToHandOff:`{engine} 没有可读的对话记录,无法交接`},split:{renameTitle:`重命名分屏`,renameField:`分屏名称`},scrolledBack:`↑ 已回滚 {lines} 行`,scrollFirst:`[最早]`,scrollLatest:`[最新]`,unavailable:{shellMissing:`终端不可用 —— $SHELL 指向的 shell 在这台机器上不存在。请把 $SHELL 指向一个真实存在的 shell,或取消设置以回退到系统默认。`,spawnFailed:`终端不可用 —— shell 启动后立即退出。具体错误见 ~/.rove/pty.log。`,retry:`按 F5 重试`},reset:{title:`重置终端?`,body:`正在运行的 shell 会被杀掉并在 worktree 重新启动,进行中的进程(vim、htop、暂停的任务)会立即结束。`}},Na={pageTitle:`ROVE UPDATE`,closeHint:`q / esc close`,chip:`↑ {version}`,current:`current`,available:`v{version} available`,latest:`latest`,latestUnknown:`unknown — could not reach the registry`,registryRetry:`Check your connection, then close and reopen Update to retry.`,upToDate:`No newer release — nothing to install.`,releaseUrlUnavailable:`release URL unavailable; visit github.com/Sma1lboy/rove/releases`,statusReleaseOpened:`Opened release page in your browser.`,statusReleaseError:`Could not open release URL. Visit github.com/Sma1lboy/rove/releases in your browser.`,statusRunningUpdater:`Closing the TUI and running the updater in this terminal...`,loadingNotes:`Loading release notes...`,notesUnavailable:`Release notes are unavailable. Use Open release to view the GitHub release page.`,changesSectionHeader:`── changes from v{from} to v{to} ──`,otherClients:`Also in this release: {count} for other clients`,scopes:{ios:`Phone & iPhone app`,web:`Web`,tui:`Terminal (TUI)`,cli:`Command line`,daemon:`Background service`,android:`Android app`,other:`Other`},updateComplete:`Rove update complete. Relaunch Rove to use the new version.`,updateFailed:"Rove update failed with exit code {code}. Check the output above, then run `rove update` to retry.",pressAnyKey:`Press any key to close this update window.`,webRunning:`Running {command} …`,webInstalled:`Installed. Restart Rove to run v{latest}; this page reloads itself when it is back.`,webRestart:`Restart Rove`,webRestarting:`Restarting Rove… this page reloads itself when it is back.`,webStartFailed:`Could not start the updater: {error}`,actions:{updateNow:`Update now`,openRelease:`Open release`,close:`Close`,closeDetail:`return to the workspace`},whatsNew:{title:`WHAT'S NEW 🎉`,closeHint:`q / esc continue`,upgraded:`You're now on Rove v{to}, up from v{from}. Here's what changed.`,notesUnavailable:`Could not load the release notes — check your connection, or read them on GitHub.`,sourceHint:`release notes: {url}`},skew:{title:`⚠ DAEMON OUT OF DATE`,olderBuild:`an older build`,hint:`daemon is {daemon} — you launched v{clientVersion}. Press {keys} to refresh Rove onto the installed build`,hintNoKey:"daemon is {daemon} — you launched v{clientVersion}. Run `rove daemon restart`, then relaunch Rove"},refresh:{confirmTitle:`Refresh Rove?`,confirmBody:`Rove restarts the daemon and relaunches itself on the installed build. Running engine sessions live in the PTY host and keep going; open tabs come back.`,confirmLabel:`Refresh`,relaunching:`rove: restarting on the installed build...`,alreadyCurrent:`Rove and the daemon already run the same build — nothing to refresh.`,installGone:"This Rove was installed from a directory that no longer exists, so it cannot relaunch itself. Reinstall with `npm install -g @sma1lboy/rove`."},staleInstall:{title:`✕ ROVE INSTALL IS GONE`,hint:"this Rove is running from an install that no longer exists on disk, so it cannot start a daemon. Reinstall (`npm install -g @sma1lboy/rove`) and relaunch Rove"},versions:{pageTitle:`ROVE VERSIONS`,loading:`Loading releases...`,unavailable:`Could not fetch releases. Check your connection or wait for the rate limit, then reopen this page.`,tagCurrent:`current`,tagLatest:`latest`,tagBreaking:`breaking`,breakingWarning:"⚠ installing this crosses breaking version(s) {versions}. Rove will refuse to start until you run `rove reset`, which stops the daemon, the PTY host, and every live session. Tasks and worktrees are kept.",footerHint:`j/k select · enter install · q close`,closeHint:`q / esc close`}},Pa={pageTitle:`ROVE 更新`,closeHint:`q / esc 关闭`,chip:`↑ {version}`,current:`当前`,available:`有新版本 v{version}`,latest:`最新`,latestUnknown:`未知 —— 无法连接到 registry`,registryRetry:`请检查网络,然后关闭并重新打开更新页重试。`,upToDate:`没有更新的版本 —— 无需安装。`,releaseUrlUnavailable:`发布链接不可用;请访问 github.com/Sma1lboy/rove/releases`,statusReleaseOpened:`已在浏览器中打开发布说明页面。`,statusReleaseError:`无法打开发布链接。请在浏览器访问 github.com/Sma1lboy/rove/releases。`,statusRunningUpdater:`正在关闭 TUI,并在当前终端中运行更新程序……`,loadingNotes:`正在加载发布说明……`,notesUnavailable:`发布说明不可用。请使用「打开发布页」查看 GitHub 发布页面。`,changesSectionHeader:`── v{from} 至 v{to} 的变更 ──`,otherClients:`本版本还有 {count} 条其他客户端的更新`,scopes:{ios:`手机与 iPhone 应用`,web:`网页端`,tui:`终端 (TUI)`,cli:`命令行`,daemon:`后台服务`,android:`Android 应用`,other:`其他`},updateComplete:`Rove 更新完成。请重新启动 Rove 以使用新版本。`,updateFailed:"Rove 更新失败,退出码为 {code}。请检查上方输出,再运行 `rove update` 重试。",pressAnyKey:`按任意键关闭此更新窗口。`,webRunning:`正在运行 {command} …`,webInstalled:`已安装。重启 Rove 后运行 v{latest};恢复后页面会自动刷新。`,webRestart:`重启 Rove`,webRestarting:`正在重启 Rove… 恢复后页面会自动刷新。`,webStartFailed:`无法启动更新程序:{error}`,actions:{updateNow:`立即更新`,openRelease:`打开发布页`,close:`关闭`,closeDetail:`返回工作区`},whatsNew:{title:`更新内容 🎉`,closeHint:`q / esc 继续`,upgraded:`Rove 已从 v{from} 更新到 v{to},本次变更如下。`,notesUnavailable:`无法加载发布说明 —— 请检查网络连接,或到 GitHub 上查看。`,sourceHint:`发布说明:{url}`},skew:{title:`⚠ DAEMON 版本不一致`,olderBuild:`旧版本构建`,hint:`daemon 运行的是 {daemon},而你启动的是 v{clientVersion}。按 {keys} 可让 Rove 刷新到已安装的版本`,hintNoKey:"daemon 运行的是 {daemon},而你启动的是 v{clientVersion}。请运行 `rove daemon restart`,然后重新启动 Rove"},refresh:{confirmTitle:`刷新 Rove?`,confirmBody:`Rove 会重启 daemon,并以已安装的版本重新启动自身。正在运行的引擎会话由 PTY host 托管,不会中断;已打开的标签页会恢复。`,confirmLabel:`刷新`,relaunching:`rove:正在以已安装的版本重新启动……`,alreadyCurrent:`Rove 与 daemon 已经是同一个版本 —— 无需刷新。`,installGone:"当前 Rove 的安装目录已不存在,无法重新启动自身。请运行 `npm install -g @sma1lboy/rove` 重新安装。"},staleInstall:{title:`✕ ROVE 安装已不存在`,hint:"当前 Rove 运行自一份已从磁盘删除的安装,因此无法启动 daemon。请重新安装(`npm install -g @sma1lboy/rove`)并重新启动 Rove"},versions:{pageTitle:`ROVE 版本列表`,loading:`正在加载发布列表……`,unavailable:`无法获取发布列表。请检查网络或等待限流解除,然后重新打开本页。`,tagCurrent:`当前`,tagLatest:`最新`,tagBreaking:`breaking`,breakingWarning:"⚠ 安装该版本会跨过 breaking 版本 {versions}。更新后 Rove 会拒绝启动,直到你运行 `rove reset`——它会停掉 daemon、PTY host 和所有活动会话。任务和 worktree 会保留。",footerHint:`j/k 选择 · enter 安装 · q 关闭`,closeHint:`q / esc 关闭`}},Fa={quit:{confirmTitle:`Quit Rove?`,confirmBody:`The daemon and task sessions keep running. This closes only the native workspace.`,confirmLabel:`Quit`},narrowBack:`Tasks`,noPreviousTask:`No previous task to go back to`,empty:{selectTask:`Select a task with a worktree`,noSessions:`No sessions here — press ⏎ to start {engine}, or ctrl+e to pick another`,noSessionsShell:`No sessions here — press ⏎ to start a shell, or ctrl+e to pick another`,externalToAgent:`Nothing ran on this message — press ⏎ to give it to an agent`,remoteUnsupported:`Hosted engine launch over SSH is not implemented — this task's worktree is on {host}`,archived:`Archived — no live terminal`,unarchive:`[ Unarchive ]`},welcome:{title:`Welcome to Rove`,tagline:`All your coding agents in one place: when one runs out of quota, switch the task to another, and agents talk to each other directly.`,worktreeExplain:`Managed tasks create isolated worktrees and branches. Directory and project tasks reuse existing files; tabs within a task share its directory.`,stepNew:`creates your first task — pick a repo, a base branch, an engine`,stepHelp:`shows every shortcut reachable from the current focus`,stepPrefix:`opens the command menu`,enginesFound:`✓ engines: {list}`,enginesSignedOut:`✗ installed but not signed in: {list} — run one of them in a shell and log in`,enginesMissing:`✗ no engine CLI found — install claude, codex, copilot, or kimi, then restart Rove`,gitMissing:`✗ git not found on PATH — Rove needs git to create worktrees`,doctorHint:"run `rove doctor` in a shell for the full diagnosis",docsHint:`docs: https://docs.rove.run`},attention:{none:`No available Inbox items`},inbox:{title:`INBOX`,chip:`inbox {count}`,empty:`No pending attention`,openHint:`enter open`,clearHint:`d ack`,clearAllHint:`D ack all`,more:`+{count} more`,section:{attention:`ATTENTION`,recent:`RECENT`},state:{done:`done`,needsInput:`needs input`,error:`error`,rateLimited:`rate limited`,running:`running`,dead:`engine exited`,restored:`restored after restart`,routineFailed:`routine needs you`,reportMissing:`report missing`,decisionNeeded:`decision needed`,gateAnswered:`answered · engine not running`},resumesAt:`resumes {time}`}},Ia={quit:{confirmTitle:`退出 Rove?`,confirmBody:`守护进程和任务会话会继续运行,这里只关闭原生工作区。`,confirmLabel:`退出`},narrowBack:`任务`,noPreviousTask:`没有可以回去的上一个任务`,empty:{selectTask:`请选择一个带 worktree 的任务`,noSessions:`这里没有会话——按 ⏎ 启动 {engine},或按 ctrl+e 另选一个`,noSessionsShell:`这里没有会话——按 ⏎ 启动 shell,或按 ctrl+e 另选一个`,externalToAgent:`这条消息没有启动任何 agent——按 ⏎ 交给 agent 分析`,remoteUnsupported:`尚未实现通过 SSH 启动托管引擎——该任务的 worktree 在 {host} 上`,archived:`已归档——没有在运行的终端`,unarchive:`[ 取消归档 ]`},welcome:{title:`欢迎使用 Rove`,tagline:`所有编程 agent 都在一个地方:一个额度用完了,换另一个接着干;agent 之间直接对话,不用你传话。`,worktreeExplain:`托管任务创建独立的 worktree 和分支。目录与项目任务复用现有文件;同一任务内的标签页共享目录。`,stepNew:`创建你的第一个任务——选仓库、基础分支和引擎`,stepHelp:`查看当前焦点下的全部快捷键`,stepPrefix:`打开命令菜单`,enginesFound:`✓ 已检测到引擎:{list}`,enginesSignedOut:`✗ 已安装但未登录:{list}——请在 shell 里运行其中之一并完成登录`,enginesMissing:`✗ 未找到引擎 CLI——请安装 claude、codex、copilot 或 kimi 后重启 Rove`,gitMissing:`✗ PATH 上没有 git——Rove 需要 git 来创建 worktree`,doctorHint:"在 shell 里运行 `rove doctor` 查看完整诊断",docsHint:`文档:https://docs.rove.run`},attention:{none:`收件箱中没有可打开的项目`},inbox:{title:`收件箱`,chip:`收件箱 {count}`,empty:`暂无待处理`,openHint:`enter 打开`,clearHint:`d 已阅`,clearAllHint:`D 全部已阅`,more:`还有 {count} 条`,section:{attention:`待处理`,recent:`最近使用`},state:{done:`完成`,needsInput:`需要输入`,error:`出错`,rateLimited:`限流`,running:`进行中`,dead:`引擎已退出`,restored:`重启后已恢复`,routineFailed:`例行任务需要处理`,reportMissing:`未回报`,decisionNeeded:`等你决定`,gateAnswered:`已回答 · 引擎未运行`},resumesAt:`{time} 恢复`}},La={title:`Worktrees`,loading:`Loading worktrees…`,noProjects:`No local projects known to Rove yet.`,loadFailed:`Could not read the worktrees: {message}`,noWorktrees:`No worktrees.`,badge:{roveManaged:`rove`,dirty:`dirty`,dirtyUnknown:`dirty?`,remoteOn:`on remote`,remoteOff:`not pushed`,remoteUnknown:`remote unknown`},verdict:{prOpen:`PR open`,prMerged:`merged (PR)`,inMain:`in main`,prClosed:`PR closed`,idle:`stale`},row:{detached:`(detached)`,created:`created {age} ago`},delete:{button:`Delete`,confirmTitle:`Delete worktree?`,confirmBody:`Delete the worktree for "{branch}"? This removes the working directory; the branch itself is kept.`,forceTitle:`Force delete worktree?`,forceBody:'"{branch}" has uncommitted, untracked, or gitignored work. Force delete removes the worktree, but the work is snapshotted first to a salvage ref — list them with `git for-each-ref refs/rove/salvage`. Force delete anyway?',forceReason:`Refused because: {reason}`,failed:`Failed to delete worktree: {error}`,residue:`Git deregistered the worktree, but couldn't delete {path} ({reason}). Rove is done with it — retrying won't help; delete the directory by hand if you want the space.`},land:{button:`Land`,confirmTitle:`Land branch?`,confirmBody:`Merge "{branch}" into {landedOn} ({commits} commits), then remove this worktree? The branch is kept. Conflicts abort with a file list.`,confirmBodyOne:`Merge "{branch}" into {landedOn} (1 commit), then remove this worktree? The branch is kept. Conflicts abort with a file list.`,noTask:`This worktree isn't tracked as a Rove task — nothing to land.`,conflict:`Land hit conflicts (merge aborted). Resolve by hand: {files}`,dirtyBase:"The base checkout has uncommitted changes — commit them, then land. Never `git stash` here: the stash stack lives in the repo's common dir and is shared by every linked worktree, so a stash can entangle other tasks' work.",failed:`Land failed: {error}`,refusal:{EMPTY_BRANCH:`Nothing to land: "{branch}" has no commits ahead of {landedOn}.`,EMPTY_BRANCH_DIRTY_WORKTREE:`Nothing to land yet: "{branch}" has no commits ahead of {landedOn}, but its worktree has uncommitted changes ({files}). Commit them there, then land.`,MISSING_REF:`"{branch}" is gone from the project: it was renamed or deleted outside Rove.`,DETACHED_HEAD:`The project checkout is not on a branch. Check one out there, then land.`,SAME_BRANCH:`The project checkout is already on "{branch}", so there is nothing to land it onto.`,UNBORN_BASE:`{landedOn} has no commits yet, so there is nothing to merge into. Make the first commit there, then land.`,UNREADABLE_BASE:`Could not read the project checkout. Is it still a git repository?`},done:`Landed "{branch}" onto {landedOn} ({commit}).`,worktreeKept:`Landed, but the worktree was kept: {reason}`,worktreePathStale:`Landed and removed the worktree, but the task still points at it: {reason}`,worktreeResidue:`Landed. Git deregistered the worktree, but couldn't delete {path} ({reason}) — delete the directory by hand if you want the space.`},hint:{}},Ra={title:`工作树`,loading:`正在加载 worktree…`,noProjects:`Rove 还没有已知的本地项目。`,loadFailed:`读不到 worktree 列表:{message}`,noWorktrees:`没有 worktree。`,badge:{roveManaged:`rove`,dirty:`有改动`,dirtyUnknown:`改动未知`,remoteOn:`已推送`,remoteOff:`未推送`,remoteUnknown:`远端未知`},verdict:{prOpen:`PR 评审中`,prMerged:`已合入 (PR)`,inMain:`已在主分支`,prClosed:`PR 已关闭`,idle:`陈旧`},row:{detached:`(游离状态)`,created:`{age}前创建`},delete:{button:`删除`,confirmTitle:`删除 worktree?`,confirmBody:`确定删除 "{branch}" 对应的 worktree?工作目录会被移除,分支本身会保留。`,forceTitle:`强制删除 worktree?`,forceBody:'"{branch}" 存在未提交、未跟踪或被 gitignore 的改动。强制删除会移除 worktree,但这些改动会先被快照到一个 salvage ref——用 `git for-each-ref refs/rove/salvage` 可以列出它们。仍要强制删除吗?',forceReason:`拒绝原因:{reason}`,failed:`删除 worktree 失败:{error}`,residue:`Git 已注销该 worktree,但没能删掉 {path}({reason})。Rove 这边已经处理完了——重试没有用;想要回磁盘空间请手动删除该目录。`},land:{button:`合入`,confirmTitle:`合入分支?`,confirmBody:`把 "{branch}" 合入 {landedOn}({commits} 个提交),然后移除这个 worktree?分支会保留。冲突会中止并给出文件清单。`,confirmBodyOne:`把 "{branch}" 合入 {landedOn}(1 个提交),然后移除这个 worktree?分支会保留。冲突会中止并给出文件清单。`,noTask:`该 worktree 未作为 Rove 任务被跟踪——没有可合入的对象。`,conflict:`合入遇到冲突(已中止)。请手动解决:{files}`,dirtyBase:"基础检出有未提交改动——请先提交再合入。绝不要在这里 `git stash`:stash 栈存放在仓库的 common dir 中,该仓库所有 linked worktree 共享,一次 stash 可能纠缠其他任务的工作。",failed:`合入失败:{error}`,refusal:{EMPTY_BRANCH:`没有可合入的内容:"{branch}" 比 {landedOn} 没有多出任何提交。`,EMPTY_BRANCH_DIRTY_WORKTREE:`还没有可合入的内容:"{branch}" 比 {landedOn} 没有多出提交,但它的 worktree 里有未提交的改动({files})。先在那里提交,再合入。`,MISSING_REF:`项目里已经没有 "{branch}" 了:它在 Rove 之外被改名或删除。`,DETACHED_HEAD:`项目检出不在任何分支上。先在那里检出一个分支,再合入。`,SAME_BRANCH:`项目检出已经在 "{branch}" 上,没有可以合入的目标。`,UNBORN_BASE:`{landedOn} 还没有任何提交,没有可合入的目标。先在那里做第一次提交,再合入。`,UNREADABLE_BASE:`读不了项目检出。它还是 git 仓库吗?`},done:`已把 "{branch}" 合入 {landedOn}({commit})。`,worktreeKept:`已合入,但 worktree 保留了:{reason}`,worktreePathStale:`已合入并移除 worktree,但任务仍指向它:{reason}`,worktreeResidue:`已合入。Git 已注销该 worktree,但没能删掉 {path}({reason})——想要回磁盘空间请手动删除该目录。`},hint:{}},za={common:{en:da,zh:fa},doctor:{en:pa,zh:ma},files:{en:ha,zh:ga},newTask:{en:_a,zh:va},onboarding:{en:ya,zh:ba},quickTask:{en:xa,zh:Sa},tasks:{en:ka,zh:Aa},terminal:{en:ja,zh:Ma},update:{en:Na,zh:Pa},workspace:{en:Fa,zh:Ia},worktrees:{en:La,zh:Ra}};function Ba(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 K(e,t,n){let r=za[e],i=Ba(r[Bt.get()],t)??Ba(r.en,t)??t;return n?i.replace(/\{(\w+)\}/g,(e,t)=>String(n[t]??e)):i}var Va=y({stale:!1,daemonVersion:null,bridgeVersion:null}),Ha=2e4;async function Ua(e){try{let t=await e.request(`daemon.info`);return Va.set({stale:t.stale,daemonVersion:t.daemonVersion,bridgeVersion:t.bridgeVersion}),t.stale}catch{return Va.get().stale}}function Wa(e){(0,h.useEffect)(()=>{let t=e.onOpen(()=>void Ua(e)),n=ua(Ha,()=>void Ua(e));return()=>{t(),n()}},[e])}function Ga(e){if(!Va.get().stale){z(K(`update`,`refresh.alreadyCurrent`),`error`);return}k.set((0,U.jsx)(sa,{title:K(`update`,`refresh.confirmTitle`),body:V(`layout.refreshConfirm`),confirmLabel:K(`update`,`refresh.confirmLabel`),onConfirm:async()=>{await e.request(`daemon.restart`),z(K(`update`,`refresh.relaunching`));for(let t=0;t<20;t++)if(await new Promise(e=>window.setTimeout(e,1e3)),!await Ua(e))return;throw Error(V(`layout.refreshTimeout`))}}))}var Ka=[`info`,`success`,`warning`,`error`,`muted`],qa=4e3,Ja=4e3,Ya=/^[A-Za-z0-9._:-]{1,64}$/,Xa={box:new Set([`type`,`direction`,`gap`,`padding`,`border`,`children`]),text:new Set([`type`,`text`,`tone`,`bold`]),button:new Set([`type`,`key`,`label`,`tone`]),input:new Set([`type`,`key`,`placeholder`,`value`])};function Za(e){return typeof e==`string`&&Ka.includes(e)}function Qa(e){return e===0||e===1||e===2||e===3}var $a=class extends Error{};function eo(e){let t=0,n=new Set,r=(e,i,a)=>{if(a>12)throw new $a(`${i}: deeper than 12`);if(++t>400)throw new $a(`more than 400 elements`);if(!e||typeof e!=`object`||Array.isArray(e))throw new $a(`${i}: not an element`);let o=e,s=o.type;if(s!==`box`&&s!==`text`&&s!==`button`&&s!==`input`)throw new $a(`${i}: unknown element ${JSON.stringify(s)}`);for(let e of Object.keys(o))if(!Xa[s].has(e))throw new $a(`${i}: ${s} has no prop "${e}"`);if(o.tone!==void 0&&!Za(o.tone))throw new $a(`${i}: tone must be one of ${Ka.join(`, `)}`);if(s===`text`){if(typeof o.text!=`string`||o.text.length>4e3)throw new $a(`${i}: text must be a string of at most ${qa} chars`);if(o.bold!==void 0&&typeof o.bold!=`boolean`)throw new $a(`${i}: bold must be boolean`);return{type:s,text:o.text,...o.tone===void 0?{}:{tone:o.tone},...o.bold?{bold:!0}:{}}}if(s===`button`||s===`input`){if(typeof o.key!=`string`||!Ya.test(o.key))throw new $a(`${i}: bad ${s} key`);if(n.has(o.key))throw new $a(`${i}: duplicate key "${o.key}"`);n.add(o.key)}if(s===`input`){for(let e of[`placeholder`,`value`]){let t=o[e];if(t!==void 0&&(typeof t!=`string`||t.length>4e3))throw new $a(`${i}: ${e} must be a string of at most ${Ja} chars`)}return{type:s,key:o.key,...o.placeholder===void 0?{}:{placeholder:o.placeholder},...o.value===void 0?{}:{value:o.value}}}if(s===`button`){if(typeof o.label!=`string`||o.label.length===0||o.label.length>40)throw new $a(`${i}: label must be 1-40 chars`);return{type:s,key:o.key,label:o.label,...o.tone===void 0?{}:{tone:o.tone}}}if(o.direction!==void 0&&o.direction!==`row`&&o.direction!==`column`)throw new $a(`${i}: direction must be "row" or "column"`);for(let e of[`gap`,`padding`])if(o[e]!==void 0&&!Qa(o[e]))throw new $a(`${i}: ${e} must be 0-3`);if(o.border!==void 0&&typeof o.border!=`boolean`)throw new $a(`${i}: border must be boolean`);if(!Array.isArray(o.children))throw new $a(`${i}: box needs children`);return{type:s,...o.direction===void 0?{}:{direction:o.direction},...o.gap===void 0?{}:{gap:o.gap},...o.padding===void 0?{}:{padding:o.padding},...o.border?{border:!0}:{},children:o.children.map((e,t)=>r(e,`${i}.children[${t}]`,a+1))}};try{return{ok:!0,tree:r(e,`tree`,1)}}catch(e){if(e instanceof $a)return{ok:!1,error:e.message};throw e}}function to(e){let t=e?.panes;if(!Array.isArray(t))return null;let n=[];for(let e of t){if(!e||typeof e!=`object`)continue;let t=e;if(typeof t.plugin!=`string`||typeof t.id!=`string`||typeof t.title!=`string`)continue;let r=eo(t.tree);r.ok&&n.push({plugin:t.plugin,id:t.id,title:t.title,tree:r.tree})}return n}function no(e){let t=[],n=(e,r,i)=>{if(e.type===`button`||e.type===`input`)t.push({kind:e.type,plugin:r,pane:i,key:e.key});else if(e.type===`box`)for(let t of e.children)n(t,r,i)};for(let t of e)n(t.tree,t.plugin,t.id);return t}function ro(e,t){return e!==null&&t!==null&&e.plugin===t.plugin&&e.pane===t.pane&&e.key===t.key}function io(e,t){return e.find(e=>ro(e,t))??e[0]??null}function ao(e,t,n){if(e.length===0)return null;let r=e.findIndex(e=>ro(e,t));return r<0?e[0]??null:e[(r+n+e.length)%e.length]??null}function q(e,t){if(!t)return e;let n=new Map(e.map(e=>[e.id,e]));for(let e of t.remove)n.delete(e);for(let e of t.upsert)n.set(e.id,e);return t.order?t.order.flatMap(e=>n.get(e)??[]):e.map(e=>n.get(e.id)??e)}function oo(e,t){return{...e,rev:t.rev,tasks:q(e.tasks,t.tasks),...t.archived?{archived:q(e.archived??[],t.archived)}:{},...t.attention?{attention:t.attention}:{},...t.gates?{gates:t.gates}:{}}}function so(e){return!!e&&typeof e==`object`&&typeof e.from==`number`}function co(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}var lo=e=>e.kind===`dir`&&e.noProject===!0,uo=e=>e.split(/[\\/]/).filter(Boolean),fo=e=>uo(e).pop()??e;function po(e,t,n=``){let r=fo(e),i=t.filter(t=>(t.repo!==e||t.host!==n)&&fo(t.repo)===r);if(i.length===0)return r;let a=e=>uo(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 mo=e=>e.startsWith(`root:`)?null:e.split(`/`).slice(-2).join(`/`);function ho(e,t){let n=fo(e.repo),r=t.filter(t=>t!==e&&fo(t.repo)===n);if(r.length===0)return n;let i=e.repoId,a=i?mo(i):null;return i&&a?r.some(e=>e.repoId&&e.repoId!==i&&mo(e.repoId)===a)?i:a:po(e.repo,[e,...r].map(e=>({repo:e.repo,host:``})))}var go=/\s+#\d+\/\d+$/,_o=(e,t)=>(e.createdAt??``).localeCompare(t.createdAt??``)||e.id.localeCompare(t.id),vo=e=>e.groupId?`${e.machine?.id??``}\0${e.groupId}`:null;function yo(e){let t=new Map;for(let n of e){let e=vo(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(_o);return t}function bo(e){return(e[0]?.label??``).replace(go,``)}function xo(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 So=[`default`,`recent`,`attention`,`name`],Co={folded:new Set,opened:new Set},wo=e=>{let t=Date.parse(e??``);return Number.isFinite(t)?t:0},To=e=>wo(e.updatedAt??e.createdAt),Eo=e=>wo(e.createdAt),Do=(e,t)=>Eo(t)-Eo(e)||t.id.localeCompare(e.id),Oo=(e,t)=>To(t)-To(e)||t.id.localeCompare(e.id),ko=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`}),Ao={default:null,recent:Do,attention:(e,t)=>e.rank-t.rank||Oo(e,t),name:(e,t)=>ko.compare(e.label.trim(),t.label.trim())||e.id.localeCompare(t.id)},jo=`~scratch`,Mo=e=>lo(e);function No(e,t){return[...e].sort((e,t)=>(e.order??e.rank)-(t.order??t.rank)).sort(Io(Ao[t]))}function Po(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=Mo(e)?jo:e.repo,n=r.get(t);n?n.push(e):r.set(t,[e])}let i=Ao[t],a=[...r].map(([e,t])=>{let n=t.sort(Io(i));if(e===`~scratch`&&t.every(Mo))return{repo:``,label:V(`rail.noProject`),tasks:n,key:jo,noProject:!0};let r=t.find(e=>e.repoId)?.repoId;return{repo:e,label:fo(e),tasks:n,...r?{repoId:r}:{}}});return[...a.filter(e=>e.noProject),...a.filter(e=>!e.noProject)]}var Fo=e=>+!e.pinned,Io=e=>(t,n)=>Fo(t)-Fo(n)||(e?e(t,n):0);function Lo(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 Ro(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)||Lo(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 zo(e,t,n=[]){for(let r of e.get(t)??[])n.push(r.id),zo(e,r.id,n);return n}function Bo(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 Vo(e,t=``,n=Co,r=0,i=!0){let a=t.trim(),o=(...e)=>e.some(e=>e!==``&&co(a,e)),{children:s,nested:c}=Ro(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,fo(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?zo(s,t.id):[],m=u!==void 0&&a===``&&Bo(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?yo(t):new Map,o=new Set;for(let i of t){let t=vo(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:bo(s),tasks:s,depth:Math.min(l,3),...c.machine?{machine:c.machine.id}:{}});let u=xo(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}function Ho(e){let t=e.tasks.find(e=>e.connector)?.connector;return t===`weixin`||t===`lark`||t===`inbox`?V(`rail.connector.${t}`):null}var Uo=e=>Math.max(0,...e.tasks.map(Eo));function Wo(e){let t=e.tasks.filter(e=>!e.routine),n=e.remote.filter(e=>!e.routine),r=[...Po(t,e.sort).map(e=>({group:e})),...e.machines.flatMap(t=>Po(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?jo:t??(e.machine===void 0?n:`${e.machine}\0${n}`),a=i.get(r);a?a.push(e):i.set(r,[e])}let a=Ao[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(Io(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:Ho(e)??ho(e,s)])),l=s.map(e=>({...e,label:c.get(e)??e.label}));e.sort===`recent`&&l.sort((e,t)=>Uo(t)-Uo(e)),e.sort===`name`&&l.sort((e,t)=>ko.compare(e.label,t.label));let u=e=>Number(e.tasks.some(e=>e.connector!==void 0));return l.sort((e,t)=>u(e)-u(t)),l.sort((e,t)=>Number(t.noProject===!0)-Number(e.noProject===!0)),{rows:Vo(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 Go(e){return e.title??e.engineName??(e.kind===`engine`?V(`tab.engine`):V(`tab.shell`))}function Ko(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)}var qo=(e,t)=>n=>({...n,tasks:n.tasks.map(n=>n.id===e?{...n,...t}:n)}),Jo=(e,t)=>n=>({...n,tasks:n.tasks.map(n=>n.id===e?{...n,title:t,label:n.label===n.title?t:n.label}:n)});function Yo(e,t){let n=new Set([t]);for(let t=!0;t;){t=!1;for(let r of e)r.parentTaskId&&n.has(r.parentTaskId)&&!n.has(r.id)&&(n.add(r.id),t=!0)}return n}var Xo=e=>e.order??e.rank;function Zo(e,t){let n=e.find(e=>e.id===t);if(!n||Mo(n))return[...e];let r=Xo(n),i=e.filter(e=>e.repo===n.repo&&!Mo(e)&&Xo(e)>r).sort((e,t)=>Xo(e)-Xo(t)),a=new Map(i.map((e,t)=>[e.id,r+(t+1)/(i.length+1)]));return e.map(e=>{let t=a.get(e.id);return t===void 0?e:{...e,order:t}})}var Qo=(e,t,n=!1)=>r=>{let i=t?Zo(r.tasks,e):r.archived??[],a=n?new Set([e]):Yo(i,e),o=i.find(t=>t.id===e)?.parentTaskId,s=i.filter(e=>a.has(e.id)).map(e=>({...e,archived:t})),c=i.filter(e=>!a.has(e.id)).map(t=>n&&t.parentTaskId===e?{...t,parentTaskId:o}:t);return t?{...r,tasks:c,archived:[...r.archived??[],...s]}:{...r,tasks:[...r.tasks,...s],archived:c}},$o=(e,t)=>n=>{let r=[...n.tasks,...n.archived??[]],i=t?Yo(r,e):new Set([e]),a=r.find(t=>t.id===e)?.parentTaskId,o=t=>t.filter(e=>!i.has(e.id)).map(t=>t.parentTaskId===e?{...t,parentTaskId:a}:t);return{...n,tasks:o(Zo(n.tasks,e)),...n.archived?{archived:o(n.archived)}:{}}},es={"task.pin":(e,t)=>qo(e,{pinned:t.pinned===!0}),"task.keep":(e,t)=>qo(e,{kept:t.kept===!0}),"task.setStatus":(e,t)=>qo(e,{status:t.status}),"task.rename":(e,t)=>Jo(e,String(t.title)),"task.archive":(e,t)=>Qo(e,t.archived===!0,t.promote===!0),"task.delete":(e,t)=>$o(e,t.cascade===!0)};Object.keys(es);function ts(e,t){return es[e]?.(String(t.taskId),t)??null}var ns=new WeakMap,rs=200,is=e=>`client`in e?e.client:e,as=(e,t)=>t?`${e} ${JSON.stringify(t)}`:e;function J(e,t,n){return ns.get(is(e))?.get(as(t,n))}function os(e,t,n,r){let i=is(e),a=ns.get(i)??new Map,o=as(t,n);a.delete(o),a.set(o,r),ns.set(i,a);for(let e of a.keys()){if(a.size<=rs)break;a.delete(e)}return r}function ss(e,t,n){return is(e).request(t,n).then(r=>os(e,t,n,r))}var cs=`rove.web.selection`,ls=`null`,us=300;function ds(){try{let e=JSON.parse(localStorage.getItem(cs)??`null`);if(e&&typeof e==`object`&&`taskId`in e&&typeof e.taskId==`string`)return{taskId:e.taskId,tabId:`tabId`in e&&typeof e.tabId==`string`?e.tabId:null}}catch{}return{taskId:null,tabId:null}}function fs(e){if(!e||typeof e!=`object`||!(`taskIds`in e))return;let t=e.taskIds;return Array.isArray(t)?t.filter(e=>typeof e==`string`):void 0}function ps(e){return!!e&&typeof e==`object`&&`tasks`in e&&Array.isArray(e.tasks)}var ms=`rove.web.visits`,hs=20;function gs(){try{let e=JSON.parse(localStorage.getItem(ms)??`[]`);return Array.isArray(e)?e.filter(e=>!!e&&typeof e==`object`&&typeof e.taskId==`string`):[]}catch{return[]}}function _s(e,t){if(t)return e?.tasks.find(e=>e.id===t)??e?.archived?.find(e=>e.id===t)}function vs(e,t,n){let r=(e,t)=>e.some(e=>e.id===t&&!e.deleting);return n!==null&&r(e,n)&&!r(t,n)}var ys=class{client;tasks=y(null);remote=y([]);tabs=y({});tabsSettled=y(!1);mods=y([]);installedMods=y(new Set);selection=y(ds());visits=y(gs());tabTimer=null;tabsReadAt=-1/0;tabScope=new Set;tabSets=new Map;tabReads=new Map;syncing=null;served=null;edits=new Map;pendingSelect=null;selectIntent=0;provisioning=new Map;viewingSent=ls;taskShown=!0;viewingExtras=()=>({});constructor(e){this.client=e,e.onOpen(()=>{this.resync(),this.viewingSent=ls,this.reportViewing(),this.refreshMods(),ss(e,`github.repos`).catch(()=>{})}),typeof document<`u`&&typeof document.addEventListener==`function`&&document.addEventListener(`visibilitychange`,()=>{this.reportViewing(),document.visibilityState===`visible`&&this.refreshMods()}),typeof window<`u`&&typeof window.addEventListener==`function`&&window.addEventListener(`pagehide`,()=>this.reportViewing(!0)),e.on(`tasks`,e=>{ps(e)&&this.acceptTasks(e)}),e.on(`tasks.patch`,e=>{let t=this.served;t&&so(e)&&e.from===t.rev?this.acceptTasks(oo(t,e)):this.resync()}),e.on(`tabs`,e=>this.scheduleTabRefresh(fs(e))),e.on(`mods`,e=>this.mods.set(to(e)??[]))}resync(){return this.syncing??=this.client.request(`tasks.subscribe`,{patches:!0}).then(e=>this.acceptTasks(e)).catch(()=>{}).finally(()=>{this.syncing=null}),this.syncing}async refreshMods(){try{let{mods:e}=await this.client.request(`builtinMods.list`);this.installedMods.set(new Set(e.filter(e=>e.installed).map(e=>e.id)))}catch{}}onSelect=()=>{};setTaskShown(e){this.taskShown!==e&&(this.taskShown=e,this.reportViewing())}select(e,t=null){this.onSelect();let n=++this.selectIntent;if(this.tasks.get()?.tasks.find(t=>t.id===e)?.noWorktree){this.provisioning.has(e)?this.provisioning.set(e,{intent:n,tabId:t}):this.provisionThenSelect(e,{intent:n,tabId:t});return}this.commitSelection(e,t)}commitSelection(e,t){let n=this.tabs.get()[e]??[],r={taskId:e,tabId:t??bs(n)?.id??null};this.selection.set(r),localStorage.setItem(cs,JSON.stringify(r));let i=[{...r,at:Date.now()},...this.visits.get().filter(e=>e.taskId!==r.taskId||e.tabId!==r.tabId)].slice(0,hs);this.visits.set(i),localStorage.setItem(ms,JSON.stringify(i)),this.reportViewing(),e in this.tabs.get()||this.scheduleTabRefresh([e])}reportViewing(e=!1){let{taskId:t,tabId:n}=this.selection.get(),r=e||typeof document<`u`&&document.visibilityState===`hidden`||!t||!this.taskShown?null:{taskId:t,...n?{tabId:n}:{},...this.viewingExtras()},i=JSON.stringify(r);i!==this.viewingSent&&(this.viewingSent=i,this.client.request(`ui.viewing`,r??{taskId:null}).catch(()=>{this.viewingSent===i&&(this.viewingSent=ls)}))}async provisionThenSelect(e,t){this.provisioning.set(e,t);let n=!0;try{await this.client.request(`task.ensureWorktree`,{taskId:e})}catch(e){n=!1,z(e instanceof Error?e.message:String(e),`error`)}let r=this.provisioning.get(e)??t;this.provisioning.delete(e),n&&(this.markProvisioned(e),(this.tasks.get()?.tasks.some(t=>t.id===e)??!1)&&r.intent===this.selectIntent&&this.commitSelection(e,r.tabId))}markProvisioned(e){let t=this.tasks.get();if(!t)return;let n=t.tasks.map(t=>t.id===e?{...t,noWorktree:void 0}:t);this.tasks.set({...t,tasks:n})}selectWhenListed(e){this.tasks.get()?.tasks.some(t=>t.id===e)?this.select(e):this.pendingSelect=e}engineTarget(e){let{taskId:t,tabId:n}=this.selection.get(),r=t===e?this.tabs.get()[e]?.find(e=>e.id===n):void 0;return r?.kind===`engine`?{taskId:e,tabId:r.id}:{taskId:e}}async refreshTabsNow(e){await this.refreshTabs([e])}tabbedTasks(){let e=this.tasks.get(),t=e?.archived?.find(e=>e.id===this.selection.get().taskId);return[...e?.tasks??[],...t?[t]:[],...this.remote.get().filter(e=>!e.machine?.stale)]}act(e,t){let n=ts(e,t),r=()=>this.client.request(e,t);return n?this.optimistic(n,r):r()}closeTab(e,t){return this.tabAct(e,`tab.close`,{taskId:e,tabId:t},e=>e.filter(e=>e.id!==t))}renameTab(e,t,n){return this.tabAct(e,`tab.rename`,{taskId:e,tabId:t,title:n},e=>e.map(e=>e.id===t?{...e,title:n}:e))}async tabAct(e,t,n,r){let i=this.tabs.get()[e];i&&(this.tabReads.set(e,(this.tabReads.get(e)??0)+1),this.tabs.set({...this.tabs.get(),[e]:r(i)}),this.reselectIfClosed(e));try{await this.client.request(t,n)}finally{await this.refreshTabs([e])}}async optimistic(e,t){this.edits.set(e,!1);let n=this.selection.get();this.served&&this.acceptTasks(this.served,!0);try{let n=await t();return this.edits.has(e)&&this.edits.set(e,!0),n}catch(t){throw this.edits.delete(e),this.served&&this.acceptTasks(this.served,!0),n.taskId!==null&&this.selection.get().taskId!==n.taskId&&_s(this.tasks.get(),n.taskId)&&this.commitSelection(n.taskId,n.tabId),t}}acceptTasks(e,t=!1){this.served=e;let n=e;for(let[e,r]of this.edits){let i=e(n);r&&!t&&i.tasks.length===n.tasks.length?this.edits.delete(e):n=i}let r=[...this.tasks.get()?.tasks??[],...this.remote.get()];this.remote.set(n.tasks.filter(e=>e.machine)),this.tasks.set({...n,tasks:n.tasks.filter(e=>!e.machine)}),vs(r,n.tasks,this.selection.get().taskId)&&this.leaveForNewTask(),this.pendingSelect&&n.tasks.some(e=>e.id===this.pendingSelect)&&(this.select(this.pendingSelect),this.pendingSelect=null);let i=this.tabbedTasks(),a=new Set(i.map(e=>e.id)),o=this.tabs.get();Object.keys(o).some(e=>!a.has(e))&&this.tabs.set(Object.fromEntries(Object.entries(o).filter(([e])=>a.has(e))));for(let e of this.tabSets.keys())a.has(e)||this.tabSets.delete(e);let s=i.filter(e=>{let t=Object.keys(e.tabStatus??{}).sort().join(` `);return this.tabSets.get(e.id)!==t&&(this.tabSets.set(e.id,t),!0)});s.length>0&&this.scheduleTabRefresh(s.map(e=>e.id))}leaveForNewTask(){let e=I.get(),t=ge.get(),n={taskId:null,tabId:null};this.selection.set(n),localStorage.setItem(cs,JSON.stringify(n)),this.reportViewing(),I.set(e??{ungrouped:!0,sky:T()}),ge.set(t)}scheduleTabRefresh(e){if(!e)this.tabScope=null;else for(let t of e)this.tabScope?.add(t);if(this.tabTimer!==null)return;let t=Math.max(0,this.tabsReadAt+us-Date.now());this.tabTimer=window.setTimeout(()=>{this.tabTimer=null,this.tabsReadAt=Date.now();let e=this.tabScope;this.tabScope=new Set,this.refreshTabs(e?[...e]:this.tabbedTasks().map(e=>e.id))},t)}async refreshTabs(e){await Promise.all(e.map(async e=>{let t=(this.tabReads.get(e)??0)+1;this.tabReads.set(e,t);let n;try{n=(await this.client.request(`task.tabs`,{taskId:e})).tabs}catch{return}this.tabReads.get(e)===t&&(this.tabs.set({...this.tabs.get(),[e]:n}),this.reselectIfClosed(e))})),this.tabsSettled.get()||this.tabsSettled.set(!0)}reselectIfClosed(e){let t=this.selection.get();t.taskId===e&&((this.tabs.get()[e]??[]).some(e=>e.id===t.tabId)||this.commitSelection(e,null))}};function bs(e){return e.find(e=>e.alive!==!1)??e[0]}function xs({model:e}){let t=b(e.selection),n=b(e.tasks),r=b(e.remote),i=_s(n,t.taskId)??r.find(e=>e.id===t.taskId),a=n?.attention.filter(e=>e.unread).length??0,o=`${a>0?`(${a}) `:``}${i?`${i.label} - `:``}rove`;return(0,h.useEffect)(()=>{document.title=o},[o]),null}var Ss=[`sidebar`,`workspace`,`files`];function Cs(e,t,n){let r=Ss.filter(e=>e!==`files`||n.filesVisible),i=r.indexOf(e);if(i<0)return(t>0?r[r.length-1]:r[0])??null;let a=Math.min(Math.max(i+t,0),r.length-1);return a===i?null:r[a]??null}var ws=`.split-leaf.is-active textarea.xterm-helper-textarea`,Ts={sidebar:[`.rail`,`.rail`],workspace:[`.workspace`,ws],files:[`.side-panel`,`.side-view:not([hidden]) :is([tabindex='0'], input)`]};function Es(){for(let e of document.querySelectorAll(ws))if(e.closest(`[data-stream]`)?.getClientRects().length)return e;return null}function Ds(){let e=Es();return e?.focus(),e!==null}function Os(e){let t=Cs(Object.keys(Ts).find(e=>document.activeElement?.closest(Ts[e][0]))??`sidebar`,e,{filesVisible:document.querySelector(Ts.files[0])!==null});t&&document.querySelector(Ts[t][1])?.focus()}var ks=[{id:`chat.tab.new`,scope:`workspace`,keys:[`ctrl+t`],category:`Workspace`,description:`New chat tab`,hint:{keys:`ctrl+t`},presentation:`onePress`},{id:`chat.tab.chooseEngine`,scope:`workspace`,keys:[`ctrl+e`],category:`Workspace`,description:`New conversation — engine/shell picker with destination + context toggles`,hint:{keys:`ctrl+e`},presentation:`onePress`},{id:`chat.tab.fork`,scope:`workspace`,keys:[],prefixKeys:[`c`],category:`Workspace`,description:`Fork this chat into a new tab (same Task directory, keeps the conversation)`,hint:{keys:`ctrl+a c`}},{id:`chat.fork.new`,scope:`workspace`,keys:[],prefixKeys:[`f`],category:`Workspace`,description:`Quick-fork: create child task seeded with current repo/branch/model`,hint:{keys:`ctrl+a f`}},{id:`chat.tab.close`,scope:`workspace`,keys:[`ctrl+w`],prefixKeys:[`w`],category:`Workspace`,description:`Close chat tab`,hint:{keys:`ctrl+w`},presentation:`onePress`},{id:`workspace.reopenSession`,scope:`workspace`,keys:[`return`],category:`Workspace`,description:`Reopen a session in a task whose tabs are all closed`,hint:{keys:`enter`},presentation:`onePress`},{id:`chat.tab.rename`,scope:`workspace`,keys:[`f2`],category:`Workspace`,description:`Rename active chat tab`,hint:{keys:`f2`},presentation:`onePress`},{id:`chat.tab.cycle-next`,scope:`workspace`,keys:[`ctrl+]`],category:`Workspace`,description:`Next chat tab`,hint:{keys:`ctrl+]`},presentation:`onePress`},{id:`chat.tab.cycle-prev`,scope:`workspace`,keys:[`ctrl+[`],category:`Workspace`,description:`Previous chat tab`,hint:{keys:`ctrl+[`},presentation:`onePress`},{id:`chat.tab.goto`,scope:`workspace`,keys:[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`].map(e=>`ctrl+${e}`),category:`Workspace`,description:`Go to chat tab N`,hint:{keys:`ctrl+1-9`},presentation:`onePress`},{id:`workspace.split.right`,scope:`workspace`,keys:[`ctrl+\\`],category:`Workspace`,description:`Split right`,hint:{keys:`ctrl+\\`},presentation:`onePress`},{id:`workspace.split.down`,scope:`workspace`,keys:[`ctrl+=`],category:`Workspace`,description:`Split down`,hint:{keys:`ctrl+=`},presentation:`onePress`},{id:`workspace.split.focus-next`,scope:`workspace`,keys:[`f3`],category:`Workspace`,description:`Focus next split`,hint:{keys:`f3`},presentation:`onePress`},{id:`workspace.split.close`,scope:`workspace`,keys:[`ctrl+w`],prefixKeys:[`w`],category:`Workspace`,description:`Close active split (tab when unsplit)`,hint:{keys:`ctrl+w`},presentation:`onePress`},{id:`workspace.split.rename`,scope:`workspace`,keys:[`f2`],category:`Workspace`,description:`Rename active split (tab when unsplit)`,hint:{keys:`f2`},presentation:`onePress`}],As=[{id:`files.nav`,scope:`files`,keys:[`j`,`k`,`down`,`up`],category:`Files`,description:`Move cursor up/down`,hint:{keys:`j/k`}},{id:`files.hierarchy`,scope:`files`,keys:[`h`,`l`,`left`,`right`],category:`Files`,description:`Collapse / expand tree level`,hint:{keys:`h/l`}},{id:`files.open`,scope:`files`,keys:[`return`],category:`Files`,description:`Open file in configured editor (diff when supported)`,hint:{keys:`enter`}},{id:`files.tab`,scope:`files`,keys:[`[`,`]`],category:`Files`,description:`Switch tab (cycle All / Changes)`,hint:{keys:`[/]`}},{id:`files.refresh`,scope:`files`,keys:[`r`],category:`Files`,description:`Refresh`,hint:{keys:`r`}},{id:`files.scope`,scope:`files`,keys:[`b`],category:`Files`,description:`Toggle Changes scope (working ↔ branch vs base)`,hint:{keys:`b`}},{id:`files.diff`,scope:`files`,keys:[`d`],category:`Files`,description:`Open read-only diff in a workspace tab`,hint:{keys:`d`}},{id:`files.diffAll`,scope:`files`,keys:[`shift+d`],category:`Files`,description:`Open the whole worktree's diff in one workspace tab`,hint:{keys:`D`}},{id:`files.openExternal`,scope:`files`,keys:[`o`],category:`Files`,description:`Open file in system default app (audio / video / pdf preview)`,hint:{keys:`o`}},{id:`files.mention`,scope:`files`,keys:[`a`],category:`Files`,description:`Inject @<path> mention into the engine pane`,hint:{keys:`a`}},{id:`files.search.enter`,scope:`files`,keys:[`/`],category:`Files`,description:`Search file names and text`,hint:{keys:`/`}},{id:`files.hidden`,scope:`files`,keys:[`.`],category:`Files`,description:`Show or hide dot files and folders on the All tab`,hint:{keys:`.`}},{id:`files.changesView`,scope:`files`,keys:[`t`],category:`Files`,description:`Show Changes as a folder tree or a flat list`,hint:{keys:`t`}},{id:`files.search.nav`,scope:`files`,keys:[`down`,`up`],category:`Files`,description:`Move highlight in file search results`},{id:`files.search.submit`,scope:`files`,keys:[`return`],category:`Files`,description:`Open the highlighted search result`},{id:`files.search.cancel`,scope:`files`,keys:[`escape`],category:`Files`,description:`Close file search`},{id:`files.createPR`,scope:`global`,keys:[],prefixKeys:[`p`,`shift+p`],category:`Files`,description:`Ask the agent to create a PR from the current task`},{id:`files.fixChecks`,scope:`global`,keys:[],prefixKeys:[`k`],category:`Files`,description:`Ask the agent to fix the failing PR checks`},{id:`files.syncBase`,scope:`global`,keys:[],prefixKeys:[`u`],category:`Files`,description:`Merge the base branch into this task's worktree`},{id:`diff.review.cursor`,scope:`workspace`,keys:[`j`,`k`,`down`,`up`],bareKeys:!0,category:`Diff review`,description:`Move the line cursor over the diff`,hint:{keys:`j/k`}},{id:`diff.review.range`,scope:`workspace`,keys:[`v`],bareKeys:!0,category:`Diff review`,description:`Toggle range anchor at the cursor`,hint:{keys:`v`}},{id:`diff.review.note`,scope:`workspace`,keys:[`c`],bareKeys:!0,category:`Diff review`,description:`Add a review note at the cursor`,hint:{keys:`c`}},{id:`diff.review.send`,scope:`workspace`,keys:[`s`],bareKeys:!0,category:`Diff review`,description:`Send all unsent review notes to the engine`,hint:{keys:`s`}},{id:`diff.review.drop`,scope:`workspace`,keys:[`x`],bareKeys:!0,category:`Diff review`,description:`Drop the review note the cursor sits inside`,hint:{keys:`x`}},{id:`diff.review.reload`,scope:`workspace`,keys:[`r`],bareKeys:!0,category:`Diff review`,description:`Reload the previewed file from disk`,hint:{keys:`r`}}],js=[{id:`inbox.show`,scope:`global`,keys:[],prefixKeys:[`i`],category:`Global`,description:`Open Inbox`},{id:`inbox.nav`,scope:`inbox`,keys:[`j`,`k`,`down`,`up`],category:`Inbox`,description:`Move cursor up/down`,hint:{keys:`j/k`}},{id:`inbox.open`,scope:`inbox`,keys:[`return`],category:`Inbox`,description:`Open the selected Task and Terminal Tab`,hint:{keys:`enter`}},{id:`inbox.delete`,scope:`inbox`,keys:[`d`],category:`Inbox`,description:`Ack the selected Inbox item`,hint:{keys:`d`}},{id:`inbox.deleteAll`,scope:`inbox`,keys:[`shift+d`],category:`Inbox`,description:`Ack every ATTENTION item`,hint:{keys:`D`}}],Ms=[{id:`palette.open`,scope:`global`,keys:[],prefixKeys:[`/`],category:`Global`,description:`Search commands`},{id:`help.open`,scope:`global`,keys:[`f1`],category:`Global`,description:`Show keybindings help`,hint:{keys:`F1`},presentation:`onePress`},{id:`task.new`,scope:`sidebar`,keys:[`n`],category:`Sidebar`,description:`New task`,hint:{keys:`n`}},{id:`task.new.global`,scope:`global`,keys:[],prefixKeys:[`n`],category:`Global`,description:`New task`},{id:`task.openEditor`,scope:`global`,keys:[],prefixKeys:[`o`],category:`Global`,description:`Open active Task directory in editor`},{id:`task.moveMode`,scope:`global`,keys:[],prefixKeys:[`m`],category:`Global`,description:`Reorder sidebar rows (then j/k)`},{id:`settings.open`,scope:`global`,keys:[],prefixKeys:[`,`],category:`Global`,description:`Open settings`},{id:`app.refresh`,scope:`global`,keys:[],prefixKeys:[`r`],category:`Global`,description:`Refresh Rove onto the installed build (after an update)`},{id:`settings.open.sidebar`,scope:`sidebar`,keys:[`s`],category:`Sidebar`,description:`Open settings`,hint:{keys:`s`}},{id:`worktrees.open.sidebar`,scope:`sidebar`,keys:[`x`],category:`Sidebar`,description:`Open worktrees`,hint:{keys:`x`}},{id:`kanban.open`,scope:`global`,keys:[],prefixKeys:[`1`],category:`Global`,description:`Open kanban (issues board)`},{id:`automations.open`,scope:`global`,keys:[],prefixKeys:[`2`],category:`Global`,description:`Open routines (scheduled tasks)`},{id:`workItems.open`,scope:`global`,keys:[],prefixKeys:[`3`],category:`Global`,description:`Open GitHub issues (external tracker)`},{id:`app.quit`,scope:`sidebar`,keys:[`q`,`ctrl+q`],category:`Sidebar`,description:`Quit (with confirm)`,hint:{keys:`q`}},{id:`focus.sidebar`,scope:`workspace`,keys:[`ctrl+q`],prefixKeys:[`q`],category:`Workspace`,description:`Back to sidebar (tasks)`,hint:{keys:`ctrl+q`},presentation:`onePress`},{id:`focus.previous`,scope:`global`,keys:[],prefixKeys:[`h`],category:`Navigation`,description:`Focus previous pane (files → workspace → sidebar)`},{id:`focus.next`,scope:`global`,keys:[`f4`],prefixKeys:[`l`],category:`Navigation`,description:`Focus next pane (sidebar → workspace → files)`,hint:{keys:`f4`},presentation:`onePress`},{id:`attention.next`,scope:`global`,keys:[`f7`],category:`Navigation`,description:`Jump to the next available Inbox item`,hint:{keys:`f7`},presentation:`onePress`},{id:`task.previous`,scope:`global`,keys:[],prefixKeys:[`tab`],category:`Navigation`,description:`Back to the previous task`},{id:`workspace.filesToggle`,scope:`global`,keys:[],prefixKeys:[`z`],category:`Navigation`,description:`Show or hide the Files pane`},{id:`view.redraw`,scope:`global`,keys:[],prefixKeys:[`r`],category:`Global`,description:`Redraw the screen`},{id:`sidebar.nav`,scope:`sidebar`,keys:[`j`,`k`,`down`,`up`],category:`Sidebar`,description:`Move cursor up/down`,hint:{keys:`j/k`}},{id:`sidebar.select`,scope:`sidebar`,keys:[`return`],category:`Sidebar`,description:`Open the selected task`,hint:{keys:`enter`}},{id:`sidebar.tree.open`,scope:`sidebar`,keys:[`l`,`space`],category:`Sidebar`,description:`Open the row under the cursor (a tab row enters its chat)`,hint:{keys:`l`}},{id:`sidebar.goto`,scope:`sidebar`,keys:[`g`,`shift+g`],category:`Sidebar`,description:`Top / bottom of list (gg or shift-G)`},{id:`sidebar.rename`,scope:`sidebar`,keys:[`r`],category:`Sidebar`,description:`Rename task`,hint:{keys:`r`}},{id:`sidebar.localMerge`,scope:`sidebar`,keys:[`shift+m`],category:`Sidebar`,description:`Reorder row (Shift+M, then j/k)`,hint:{keys:`M`}},{id:`sidebar.pin`,scope:`sidebar`,keys:[`shift+p`],category:`Sidebar`,description:`Pin / unpin task at top (Shift+P)`,hint:{keys:`P`}},{id:`sidebar.sort`,scope:`sidebar`,keys:[`t`],category:`Sidebar`,description:`Cycle task sort (default → recent → attention → name)`,hint:{keys:`t`}},{id:`sidebar.delete`,scope:`sidebar`,keys:[`d`],category:`Sidebar`,description:`Remove session (with confirm)`,hint:{keys:`d`}},{id:`sidebar.search.enter`,scope:`sidebar`,keys:[`/`],category:`Sidebar`,description:`Search tasks (fuzzy filter)`,hint:{keys:`/`}},{id:`sidebar.search.nav`,scope:`sidebar`,keys:[`down`,`up`],category:`Sidebar`,description:`Move highlight in search results`},{id:`sidebar.search.submit`,scope:`sidebar`,keys:[`return`],category:`Sidebar`,description:`Select search match and exit search`},{id:`sidebar.search.cancel`,scope:`sidebar`,keys:[`escape`],category:`Sidebar`,description:`Cancel search (restore prior selection)`},{id:`tasks.openWorktree`,scope:`sidebar`,keys:[`o`],category:`Tasks pane`,description:`Open selected Task directory in your editor`,hint:{keys:`o`}},{id:`tasks.renameBranch`,scope:`sidebar`,keys:[`b`],category:`Tasks pane`,description:`Rename the selected task's git branch`,hint:{keys:`b`}},{id:`tasks.cycleEngine`,scope:`sidebar`,keys:[`v`],category:`Tasks pane`,description:`Cycle engine vendor — applies on reopen`,hint:{keys:`v`}},{id:`tasks.update`,scope:`sidebar`,keys:[`u`],category:`Tasks pane`,description:`Open the update page — version check + release notes`,hint:{keys:`u`}},{id:`tasks.focusEngine`,scope:`sidebar`,keys:[`right`],category:`Tasks pane`,description:`Focus the engine pane of the current window`,hint:{keys:`→`}},...ks,...As,...js,{id:`terminal.scroll-up`,scope:`terminal`,keys:[`ctrl+pageup`],category:`Terminal`,description:`Scroll scrollback up`,hint:{keys:`ctrl+pgup`}},{id:`terminal.scroll-down`,scope:`terminal`,keys:[`ctrl+pagedown`],category:`Terminal`,description:`Scroll scrollback down`},{id:`terminal.reset`,scope:`terminal`,keys:[`f5`],category:`Terminal`,description:`Reset terminal — kill the current shell and respawn`,hint:{keys:`f5`},presentation:`onePress`}],Ns={ctrl:`⌃`,control:`⌃`,alt:`⌥`,opt:`⌥`,option:`⌥`,shift:`⇧`,cmd:`⌘`,command:`⌘`,meta:`⌘`,super:`⌘`},Ps={enter:`⏎`,return:`⏎`,esc:`⎋`,escape:`⎋`,space:`␣`,up:`↑`,down:`↓`,left:`←`,right:`→`,backspace:`⌫`,delete:`⌦`,del:`⌦`,pgup:`⇞`,pageup:`⇞`,pgdn:`⇟`,pagedown:`⇟`,home:`↖`,end:`↘`};function Fs(e,t){if(e.includes(`/`))return e.split(`/`).map(e=>Fs(e,t)).join(`/`);let n=e.toLowerCase();return n===`tab`?`tab`:Ps[n]||(/^f\d{1,2}$/.test(n)?n.toUpperCase():t?/^[a-z]$/.test(n)?e.toUpperCase():e.replace(/[a-z]+/gi,e=>e.toUpperCase()):e)}function Is(e,t=`⌃A`){let n=e.trim();if(!n)return n;let r=/^prefix\s+(.+)$/i.exec(n);if(r){let e=r[1]??``;return`${t} ${e.includes(`+`)?Is(e,t):Fs(e,!0)}`}let i=n.split(`+`);if(i.length===1)return Fs(i[0]??``,!1);let a=i[i.length-1]??``;return`${i.slice(0,-1).map(e=>Ns[e.toLowerCase().trim()]??e).join(``)} ${Fs(a,!0)}`}var Ls={path:``,exists:!1,rows:[],prefix:{key:`ctrl+a`,firstStrokes:[`ctrl+a`],timeoutMs:5e3},plugins:[],applied:[],warnings:[]},Rs=y(Ls),zs=new Map(Ms.map(e=>[e.id,{keys:[...e.keys],prefixKeys:e.prefixKeys&&[...e.prefixKeys],hint:e.hint&&{...e.hint}}]));function Bs(e){for(let e of Ms){let t=zs.get(e.id);if(!t)continue;let n=e;n.keys=[...t.keys],n.prefixKeys=t.prefixKeys&&[...t.prefixKeys],n.hint=t.hint&&{...t.hint}}for(let t of e.rows){let e=Ms.find(e=>e.id===t.id);e&&(e.keys=[...t.keys],e.prefixKeys=t.prefixKeys&&[...t.prefixKeys],e.hint=t.hint&&{...t.hint})}Rs.set(e)}async function Vs(e){try{Bs(await e.request(`keybindings.get`))}catch{}}function Hs(e){let t=b(e.conn).hello;(0,h.useEffect)(()=>{if(!t)return;let n=()=>void Vs(e);return n(),window.addEventListener(`focus`,n),()=>window.removeEventListener(`focus`,n)},[t,e])}var Us=()=>Rs.get().prefix.key,Ws=()=>{let e=Us();return e===null?``:Is(e)};function Gs(e,t=`direct`){let n=Ms.find(t=>t.id===e),r=t===`prefix`?n?.prefixKeys?.[0]:n?.keys[0];return r===void 0?void 0:Is(r)}var Ks=e=>Ms.find(t=>t.id===e)?.keys??[];function qs(e){let t=Ws(),n=Gs(e,`prefix`);return t&&n?`${t} ${n}`:``}var Js=e=>zs.get(e)?.prefixKeys??[];function Ys(e,t){let n=Rs.get().rows.find(t=>t.id===e),r=zs.get(e),i=t===`prefix`?n?.prefixKeys:n?.keys,a=t===`prefix`?r?.prefixKeys:r?.keys;return i&&JSON.stringify(i)!==JSON.stringify(a??[])?i:void 0}function Xs(e,t){for(let n of t){let t=e.find(e=>e.chord===n);if(t)return t}}function Zs(e){return!e.dialog&&e.page!==`worktrees`&&e.page!==`update`}var Qs=[];function $s(e){Qs.push(e)}var ec={workspace:`workspace`,sidebar:`sidebar`,files:`files`,terminal:`terminal`};function tc(){let e=Qs.flatMap(e=>e()),t=new Set(e.filter(e=>!e.prefix).map(e=>e.id)),n=e.map(e=>{let t=Ys(e.id,e.prefix?`prefix`:`direct`);return t?{...e,chords:t}:e});for(let r of e){let e=r.prefix?Ys(r.id,`direct`):void 0;if(!e||e.length===0||t.has(r.id))continue;t.add(r.id);let i=Ms.find(e=>e.id===r.id)?.scope??`global`;n.push({...r,prefix:!1,chords:e,...ec[i]?{surface:ec[i]}:{}})}return n}function nc(e,t){return!e.surface||e.surface===t||t===`terminal`&&e.surface===`workspace`}function rc(e,t){return e.surface===t?0:e.surface?1:2}function ic(){let e=document.activeElement;return e instanceof Element?e.closest(`.xterm`)?`terminal`:e.closest(`.rail`)?`sidebar`:e.closest(`.files`)?`files`:e.closest(`.workspace, .side-panel`)?`workspace`:null:null}function ac(e,t){let n=new Set,r=new Set;for(let i of tc())!nc(i,t)||i.live?.(e)===!1||(i.prefix?r:n).add(i.id);return{direct:n,prefix:r,inputPassthrough:t===`terminal`}}function oc(){let e=new Set(tc().map(e=>e.id));return Ms.filter(t=>e.has(t.id))}var sc=new Map,cc=y(null);function lc(e){return sc.set(e.stream,e),()=>{sc.get(e.stream)===e&&sc.delete(e.stream),cc.get()===e&&cc.set(null)}}function uc(e){return sc.get(e)}$s(()=>[{id:`terminal.scroll-up`,chords:[`ctrl+pageup`],prefix:!1,surface:`terminal`,run:()=>cc.get()?.scrollPages(-1)},{id:`terminal.scroll-down`,chords:[`ctrl+pagedown`],prefix:!1,surface:`terminal`,run:()=>cc.get()?.scrollPages(1)},{id:`terminal.reset`,chords:[`f5`],prefix:!1,surface:`terminal`,run:()=>cc.get()?.reset()}]);var dc={INPUT:!0,TEXTAREA:!0,SELECT:!0},fc=`.rail, .side-panel, dialog, [role=dialog], [role=menu], [role=listbox]`;function pc(e){return!e||e.tagName===`BODY`||e.tagName===`HTML`?`none`:e.closest(`.xterm`)?`terminal`:dc[e.tagName]===!0||e.isContentEditable?`field`:e.closest(fc)?`pane`:`loose`}function mc(e,t,n){return e.key!==`Escape`||e.defaultPrevented||e.isComposing||e.ctrlKey||e.metaKey||e.altKey||e.shiftKey||n.overlay||!n.terminal?!1:t===`none`||t===`loose`}function hc(){(0,h.useEffect)(()=>{let e=e=>{if(e.key!==`Escape`)return;let t=Es(),n=document.activeElement;if(!mc(e,pc(n instanceof HTMLElement?n:null),{overlay:k.get()!==null||O.get()!==null||M.get()!==null||I.get()!==null,terminal:t!==null}))return;let r=t?.closest(`[data-stream]`)?.dataset.stream,i=r?uc(r):void 0;!t||!i||(e.preventDefault(),t.focus(),i.input(`\x1B`))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[])}function gc(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 _c(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 vc=e=>e===`routine_failed`,yc=e=>`${e.taskId??``}:${e.tabId??``}`;function bc(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)||yc(e).localeCompare(yc(t)))}function xc(e,t,n){let r=new Set(t),i=bc(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=>yc(e)===yc(n));return a<0||i.length===1?i[0]??null:i[(a+1)%i.length]??null}function Sc(e,t){return t===`failed`?Array.isArray(e)?e:`unreadable`:t}function Cc(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 wc(e,t,n=!1){let r=`attention.dismiss`,i;if(vc(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 Tc(e,t){wc(e,t),B(),ne.set(t.automationId??null),M.set(`routines`)}var Ec=6;function Dc(e,t){if(!e)return{identity:t,project:``,label:t};let n=fo(e.repo);return{identity:`${n} › ${e.label}`,project:n,label:e.label}}function Oc(e){let t=b(e.tasks),n=b(e.visits),r=b(e.tabs),[i,a]=(0,h.useState)(Date.now());(0,h.useEffect)(()=>{let e=window.setInterval(()=>a(Date.now()),3e4);return()=>window.clearInterval(e)},[]);let o=new Map((t?.tasks??[]).map(e=>[e.id,e])),s=(e,t)=>e&&t&&r[e]?.find(e=>e.id===t)?.title||``,c=bc(t?.attention??[],t?.tasks.map(e=>e.id)??[]).map((e,t)=>{let n=e.taskId?o.get(e.taskId):void 0;return{key:`a${t}:${e.taskId}:${e.tabId}`,section:`attention`,taskId:e.taskId,tabId:e.tabId,...Dc(n,e.label??e.taskId??``),subtitle:s(e.taskId,e.tabId)||n?.branch||``,at:e.at,attention:e}}),l=new Set(c.map(e=>`${e.taskId}:${e.tabId}`)),u=n.filter(e=>o.has(e.taskId)&&!l.has(`${e.taskId}:${e.tabId}`)).slice(0,Ec).map(e=>({key:`r:${e.taskId}:${e.tabId}`,section:`recent`,taskId:e.taskId,tabId:e.tabId,...Dc(o.get(e.taskId),e.taskId),subtitle:s(e.taskId,e.tabId)||o.get(e.taskId)?.branch||``,at:e.at})),d=[...c,...u],f=t=>{if(t.attention&&vc(t.attention.state))return Tc(e,t.attention);t.attention&&wc(e,t.attention),t.taskId&&o.has(t.taskId)&&(e.select(t.taskId,t.tabId),B())},p=()=>void Promise.all(c.map(t=>t.attention&&wc(e,t.attention,!0))),m=t=>t.attention&&void wc(e,t.attention,!0),g=e=>{let n=e.attention,r=e.taskId?o.get(e.taskId):void 0,i=n?.gateId?t?.gates?.find(e=>e.id===n.gateId&&e.status===`open`):void 0,a=e.tabId??i?.tabId??null;if(!(n&&r&&!r.machine&&!vc(n.state)&&(!n.gateId||i)&&(a||i)))return null;let s=n?.state===`permission_needed`||!!a&&r?.tabStatus?.[a]?.kind===`needs-input`,c=i?`gate`:n?.state===`dead`?`readonly`:s?`menu`:`reply`;return{id:`${e.taskId}:${e.tabId}:${n?.gateId??``}`,tabId:a,mode:c,gate:i}};return{attention:c,recent:u,cards:d,now:i,open:f,ack:m,ackAll:p,peekOf:g,menuOf:(e,t)=>{let n=g(e);return[...n?[{label:V(`inbox.phone.reply`),run:()=>t(n)}]:[],{label:V(`inbox.phone.open`),run:()=>f(e)},...e.attention?[{label:V(`inbox.phone.ack`),run:()=>m(e)}]:[]]}}}var kc=Reflect.get(globalThis,`__roveRelay`),Ac=kc!==void 0;function jc(e,t){return kc?kc.fetch(e,t):fetch(e,t)}async function Mc(e){if(!kc)return e;let t=await kc.fetch(e);return t.ok?URL.createObjectURL(new Blob([await t.arrayBuffer()],{type:`text/javascript`})):e}function Nc(e,t){return kc?new kc.WebSocket(e,t):new WebSocket(e,t)}var Pc=class extends Error{code;detail;constructor(e,t,n){super(t),this.code=e,this.detail=n}},Fc=[500,1e3,2e3,4e3,8e3,15e3],Ic=4e3,Lc=1e4,Rc=class{url;token;conn=y({state:`connecting`,hello:null,failures:0});ws=null;nextId=1;pending=new Map;listeners=new Map;openHooks=new Set;retryTimer=null;deadline=null;constructor(e,t){this.url=e,this.token=t}start(){this.connect();let e=()=>{document.visibilityState===`visible`&&this.checkNow()};document.addEventListener(`visibilitychange`,e),window.addEventListener(`online`,e),window.addEventListener(`pageshow`,e)}checkNow(){if(this.retryTimer!==null){this.retryNow();return}let e=this.ws;!e||this.conn.get().state!==`open`||this.deadline!==null||(this.armDeadline(e,Ic),this.request(`hello`).then(()=>this.clearDeadline(),e=>{e instanceof Pc&&e.code!==`NOT_CONNECTED`&&this.clearDeadline()}))}armDeadline(e,t){this.clearDeadline(),this.deadline=window.setTimeout(()=>this.lost(e),t)}clearDeadline(){this.deadline!==null&&window.clearTimeout(this.deadline),this.deadline=null}onOpen(e){return this.openHooks.add(e),this.conn.get().state===`open`&&e(),()=>this.openHooks.delete(e)}on(e,t){let n=this.listeners.get(e);return n||(n=new Set,this.listeners.set(e,n)),n.add(t),()=>n.delete(t)}request(e,t={},n){let r=this.ws;if(!r||r.readyState!==WebSocket.OPEN)return Promise.reject(new Pc(`NOT_CONNECTED`,`not connected to rove`));let i=this.nextId++;return new Promise((a,o)=>{this.pending.set(i,{resolve:e=>a(e),reject:o,progress:n}),r.send(JSON.stringify({id:i,op:e,args:t}))})}connect(){this.retryTimer=null;let e=Nc(this.url,this.token?[`rove.v1`,`rove.bearer.${this.token}`]:[`rove.v1`]);this.ws=e,this.armDeadline(e,Lc),e.onmessage=e=>this.receive(String(e.data)),e.onopen=()=>{this.request(`hello`,{userAgent:navigator.userAgent}).then(e=>{this.clearDeadline(),this.conn.set({state:`open`,hello:e,failures:0});for(let e of this.openHooks)e()},()=>this.lost(e))},e.onclose=t=>this.lost(e,t?.code)}lost(e,t){if(this.ws!==e)return;this.ws=null,this.clearDeadline(),e.onopen=null,e.onclose=null,e.onmessage=null,e.close();for(let e of this.pending.values())e.reject(new Pc(`NOT_CONNECTED`,`connection lost`));if(this.pending.clear(),t===4401){o(),this.conn.set({state:`retrying`,hello:null,failures:2});return}let n=this.conn.get().failures+1;this.conn.set({state:`retrying`,hello:this.conn.get().hello,failures:n});let r=Fc[Math.min(n-1,Fc.length-1)];this.retryTimer=window.setTimeout(()=>this.connect(),r)}receive(e){let t;try{t=JSON.parse(e)}catch{return}if(!t||typeof t!=`object`)return;if(`event`in t&&typeof t.event==`string`){let e=`data`in t?t.data:void 0;if(t.event===`op.progress`){let t=e;typeof t?.id==`number`&&typeof t.line==`string`&&this.pending.get(t.id)?.progress?.(t.line);return}for(let n of this.listeners.get(t.event)??[])n(e);return}if(!(`id`in t)||typeof t.id!=`number`)return;let n=this.pending.get(t.id);if(!n)return;if(this.pending.delete(t.id),`ok`in t&&t.ok===!0){n.resolve(`result`in t?t.result:void 0);return}let r=`error`in t&&t.error&&typeof t.error==`object`?t.error:{},i=`code`in r&&typeof r.code==`string`?r.code:`INTERNAL`,a=`message`in r&&typeof r.message==`string`?r.message:i;n.reject(new Pc(i,a,r))}retryNow(){this.retryTimer!==null&&(window.clearTimeout(this.retryTimer),this.connect())}};function zc(){return`${window.location.protocol===`https:`?`wss:`:`ws:`}//${window.location.host}/ws`}function Bc(e,t,n){return n&&n!==`leaf-1`?`${e}::${t}::${n}`:`${e}::${t}`}var Vc=`modulepreload`,Hc=function(e){return`/`+e},Uc={},Wc=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=Hc(t,n),t=s(t),t in Uc)return;Uc[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`:Vc,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)})},Gc=8,Kc=32,qc=3e3,Jc=100,Yc=new WeakMap,Xc=null;function Zc(e){let t=Yc.get(e);return t||(t={entries:new Map,snapshots:new Map,left:null},Yc.set(e,t)),t}function Qc(){return Xc||(Xc=document.createElement(`div`),Xc.style.display=`none`,document.body.append(Xc)),Xc}function $c(e,t,n){e.snapshots.delete(t),e.snapshots.set(t,n);for(let t of e.snapshots.keys()){if(e.snapshots.size<=Kc)break;e.snapshots.delete(t)}}function el(e,t,n){e.entries.delete(t.key),t.leaving!==null&&window.clearTimeout(t.leaving),t.leaving=null,n?$c(e,t.key,t.handle.snapshot()):e.snapshots.delete(t.key),t.handle.dispose(),t.box.remove()}function tl(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-Gc)))el(e,n,!0)}function nl(e,t){return Zc(e).entries.get(t)?.handle??null}function rl(e,t,n,r){return Zc(e).entries.get(Bc(t,n,r))?.slot.parkedAt!=null}async function il(e,t){let n=Zc(e.client),r=Bc(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,cl(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:()=>al(n,i)}}let a=document.createElement(`div`);a.className=Yn,e.host.append(a),ol(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 Wc(async()=>{let{mountTerminal:e}=await import(`./term-mount-blMr0MC-.js`);return{mountTerminal:e}},__vite__mapDeps([0,1,2])),d=u({...e,el:a,snapshot:l,onPainted:()=>cl(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&&el(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:()=>al(n,f)}}function al(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(),Qc().append(t.box),e.left=t,tl(e))}function ol(e,t){let n=e.left;e.left=null,!(!n||n.slot.parkedAt===null||performance.now()-n.slot.parkedAt>Jc)&&e.entries.get(n.key)===n&&(n.box.classList.add(`is-leaving`),t.append(n.box),n.leaving=window.setTimeout(()=>sl(e,n),qc))}function sl(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&&Qc().append(t.box))}function cl(e){for(let t of e.entries.values())sl(e,t)}async function ll(e,t,n){return Cc(await e.request(`output.read`,{taskId:t,tab:n,source:`terminal`,limit:12}))}async function ul(e,t,n,r){try{let i=await e.client.request(`tab.send`,{taskId:t,tabId:n,prompt:r});return i.delivered?!0:(z(V(`layout.composerNotSent`,{reason:i.reason??``}),`error`),!1)}catch(e){let t=e instanceof Pc?e.code:void 0;return z(t===`UNKNOWN_OP`?V(`layout.composerOldBridge`):t===`AWAITING_PERMISSION`?V(`layout.composerAtMenu`):e instanceof Error?e.message:String(e),`error`),!1}}async function dl(e,t,n,r){let{client:i}=e,a=Bc(t,n),o=uc(a)!==void 0||rl(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 fl(e,t,n){try{return(await e.client.request(`gate.answer`,{gateId:t,...n})).delivered||z(V(`inbox.gateKept`)),!0}catch(e){return z(e instanceof Error?e.message:String(e),`error`),!1}}var pl=(e,t,n)=>({id:e,cap:t,bytes:e=>`\x1b${e?`O`:`[`}${n}`}),ml={id:`enter`,cap:`⏎`,bytes:()=>`\r`},hl=[{id:`esc`,cap:`esc`,bytes:()=>`\x1B`},{id:`tab`,cap:`tab`,bytes:()=>` `},{id:`backtab`,cap:`⇧tab`,bytes:()=>`\x1B[Z`},{id:`interrupt`,cap:`^C`,bytes:()=>``},pl(`up`,`↑`,`A`),pl(`down`,`↓`,`B`),pl(`left`,`←`,`D`),pl(`right`,`→`,`C`),ml],gl=[`esc`,`backtab`,`interrupt`,`up`,`down`,`enter`];function _l(e){let t=e?[...yl.slice(0,-1),hl[0],ml]:hl.filter(e=>gl.includes(e.id));return{first:t,rest:hl.filter(e=>!t.includes(e))}}var vl=e=>({id:`option-${e}`,cap:String(e),bytes:()=>String(e)}),yl=[vl(1),vl(2),vl(3),vl(4),ml];function bl(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 xl=`\x1B[27;2;13~`;function Sl(e){return e.key!==`Enter`||!e.shiftKey||e.ctrlKey||e.metaKey||e.altKey?!1:!e.isComposing&&e.keyCode!==229}function Cl(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 wl=`mx-2.5 mt-0.5 mb-1.5 flex min-w-0 flex-col gap-1.5 font-mono text-meta`,Tl=2e3;function El(e,t,n){let[r,i]=(0,h.useState)(null),[a,o]=(0,h.useState)(0);return(0,h.useEffect)(()=>{if(!n)return;let r=!0,a=0,o=async()=>{try{let a=await ll(e.client,t,n);r&&i(a)}catch{r&&i(e=>Sc(e,`failed`))}r&&(a=window.setTimeout(o,Tl))};return o(),()=>{r=!1,window.clearTimeout(a)}},[e,t,n,a]),{lines:r,refresh:()=>o(e=>e+1)}}function Dl({d:e}){return(0,U.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,U.jsx)(`path`,{d:e})})}function Ol(e){H();let{model:t,taskId:n,tabId:r,mode:i,gate:a}=e,{lines:o,refresh:s}=El(t,n,r),c=(0,h.useRef)(null),[l,u]=(0,h.useState)(``),[d,f]=(0,h.useState)(!1);(0,h.useEffect)(()=>{let e=c.current;e&&(e.scrollTop=e.scrollHeight)},[o]);let p=async e=>{f(!0);let t=await e();return f(!1),t&&window.setTimeout(s,600),t},m=async()=>{let e=l.trim();!e||d||await p(()=>i===`gate`&&a?fl(t,a.id,{text:e}):r?ul(t,n,r,e):Promise.resolve(!1))&&u(``)};return(0,U.jsxs)(`div`,{className:wl,children:[a&&(0,U.jsx)(`p`,{className:`m-0 whitespace-pre-wrap wrap-anywhere text-ink`,children:a.question}),r&&(0,U.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===`unreadable`?V(`inbox.outputUnreadable`):o.length===0?V(`inbox.noOutput`):o.join(`
39
39
  `)}),i===`gate`&&a&&(0,U.jsx)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:a.options.map(e=>(0,U.jsxs)(W,{disabled:d,title:e.detail,onClick:()=>void p(()=>fl(t,a.id,{option:e.key})),children:[`[ `,e.key===a.recommended?`★ `:``,e.label,` ]`]},e.key))}),i===`menu`&&r&&(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[yl.map(e=>(0,U.jsxs)(W,{disabled:d,onClick:()=>void p(()=>dl(t,n,r,e.bytes(!1))),children:[`[ `,e.cap,` ]`]},e.id)),(0,U.jsx)(W,{onClick:e.onOpenTab,children:V(`inbox.openTab`)})]}),(i===`reply`||i===`gate`)&&(0,U.jsxs)(`form`,{className:`flex min-w-0 items-center gap-2`,onSubmit:e=>{e.preventDefault(),m()},children:[(0,U.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:V(`inbox.replyPlaceholder`),"aria-label":V(`inbox.replyPlaceholder`),autoComplete:`off`,enterKeyHint:`send`,onChange:e=>u(e.target.value)}),(0,U.jsx)(W,{variant:`icon`,type:`submit`,disabled:d||l.trim()===``,"aria-label":V(`inbox.send`),title:V(`inbox.send`),children:(0,U.jsx)(Dl,{d:`M8 13V3.5M4 7.5l4-4 4 4`})})]})]})}function kl(e=`light`){globalThis.webkit?.messageHandlers?.haptic?.postMessage(e)}var Al={pane:`flex items-center gap-2.5 px-1`,screen:`flex flex-none items-center gap-3 px-3 py-2`},jl={name:`min-w-0 flex-1 truncate font-sans text-body font-normal text-ink`,heading:`m-0 font-sans text-display font-semibold normal-nums text-ink`};function Ml(e){let t=e.titleKind??`name`;return(0,U.jsxs)(`div`,{className:Al[e.frame??`pane`],children:[(0,U.jsx)(Ui,{kind:e.back.kind??`back`,label:e.back.label,onClick:e.back.onClick}),e.title&&(t===`heading`?(0,U.jsx)(`h1`,{className:jl.heading,children:e.title}):(0,U.jsx)(`span`,{className:jl.name,children:e.title})),e.children]})}var Nl=`flex min-h-0 w-full flex-1 flex-col gap-4 overflow-y-auto scrollbar-none px-3 pt-0 pb-8`;function Pl({children:e}){return(0,U.jsx)(`h1`,{className:`m-0 px-0 pb-0.5 font-sans text-[28px] leading-[1.2] font-bold normal-nums text-ink`,children:e})}function Fl({label:e,inset:t,children:n}){return(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e&&(0,U.jsx)(`p`,{className:`m-0 px-3 pb-0 font-mono text-meta font-normal text-subtle`,children:e}),(0,U.jsx)(`div`,{className:`flex flex-col overflow-hidden rounded-[12px] [&>*+*]:[border-top:var(--hairline)_solid_var(--line)] ${t?`bg-inset`:`bg-surface`}`,children:n})]})}var Il=`flex min-h-13 items-center gap-3 rounded-none px-3 py-1.25 text-left font-sans text-title text-ink hover:bg-hover`;function Ll({actions:e}){return(0,U.jsx)(`div`,{className:`pointer-events-auto flex min-w-0 flex-1 items-center gap-2.5`,"data-phone-actions":!0,children:e.map(e=>{let t=`grid h-13 cursor-pointer place-items-center px-2.5 font-sans text-body font-semibold no-underline disabled:opacity-50 ${Zt} ${$t} ${Qt} ${e.glyph?`w-13 flex-none`:`min-w-0 flex-1`} ${e.tone===`accent`?`border-hairline border-transparent bg-accent text-paper shadow-popover`:`${Yt()} text-ink`}`,n=e.glyph??(0,U.jsx)(`span`,{className:`max-w-full truncate`,children:e.label});return e.href&&!e.disabled?(0,U.jsx)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,"aria-label":e.glyph?e.label:void 0,className:t,onClick:()=>{kl(),e.onClick?.()},children:n},e.label):(0,U.jsx)(`button`,{type:`button`,disabled:e.disabled,"aria-label":e.glyph?e.label:void 0,className:t,onClick:()=>{kl(),e.onClick?.()},children:n},e.label)})})}function Y({label:e,children:t}){return(0,U.jsxs)(`div`,{className:`flex min-h-13 items-center gap-4 px-3 py-2 font-sans text-body`,children:[(0,U.jsx)(`span`,{className:`flex-none text-muted`,children:e}),(0,U.jsx)(`span`,{className:`ml-auto line-clamp-2 min-w-0 text-right wrap-anywhere text-ink`,children:t})]})}var X=y({list:null,page:null});function Rl(e,t){(0,h.useLayoutEffect)(()=>X.set({...X.get(),[e]:t})),(0,h.useLayoutEffect)(()=>()=>X.set({...X.get(),[e]:null}),[e])}var zl=`duration-220 ease-snap motion-reduce:transition-none`,Bl=`pb-[max(8px,calc(12px_-_env(safe-area-inset-bottom)))]`,Vl=`bottom-[max(8px,calc(12px_-_env(safe-area-inset-bottom)))]`,Hl=80,Ul=300,Wl=120,Gl=14,Kl=6,ql=`rounded-[10px]`,Jl=e=>`${e.capsule?`c`:``}${e.wide?`w${e.wide.label}\0${e.wide.note??``}`:`a${e.action?.label}\0${e.action?.tone??``}`}`,Yl=e=>e.capsule?(e.capsule.left+e.capsule.width+e.main.left)/2:null,Xl=(e,t)=>e.capsule?[e.capsule,e.main]:[{left:e.main.left,width:t+Gl-e.main.left},{left:t-Gl,width:e.main.left+e.main.width-t+Gl}],Zl=e=>({left:e.offsetLeft,width:e.offsetWidth}),Ql=(e,t)=>({capsule:e&&Zl(e),main:Zl(t)}),$l=(e,t)=>[t,...e?.firstElementChild?.children??[]].filter(e=>!!e);function eu({spec:e}){if(e.wide)return(0,U.jsxs)(`span`,{className:`flex h-full min-w-0 items-center gap-2 px-3.5 font-mono`,children:[(0,U.jsx)(`span`,{className:`flex flex-none text-accent`,children:(0,U.jsx)(Ki,{})}),(0,U.jsx)(`span`,{className:`min-w-0 truncate text-body text-ink lowercase`,children:e.wide.label}),e.wide.note&&(0,U.jsx)(`span`,{className:`ml-auto flex-none text-meta tracking-[0.08em] text-muted uppercase`,children:e.wide.note})]});let t=e.action?.tone===`accent`;return(0,U.jsx)(`span`,{className:`grid h-full place-items-center px-3 font-sans text-body font-semibold ${t?`text-paper`:`text-ink`}`,children:(0,U.jsx)(`span`,{className:`max-w-full truncate`,children:e.action?.label})})}function tu({show:e}){let t=b(X),n=(0,h.useRef)(null),[r,i]=(0,h.useState)(e);(0,h.useLayoutEffect)(()=>{if(e===r)return;let t=!0,a=((e&&X.get()[e]?n.current?.parentElement?.querySelector(`:scope > main`):null)?.getAnimations()??[]).map(e=>e.finished);return Promise.allSettled(a).then(()=>t&&i(e)),()=>{t=!1}},[e,r]);let a=r?t[r]:null,o=a?Jl(a):null,[s,c]=(0,h.useState)(o),l=(0,h.useRef)(null),u=(0,h.useRef)(null);a&&(u.current=a),a&&o===s&&(l.current=a);let d=l.current,f=(0,h.useRef)(null),p=(0,h.useRef)(null),m=(0,h.useRef)(null),g=(0,h.useRef)(null),_=(0,h.useRef)(null),v=(0,h.useRef)(!1),[y,x]=(0,h.useState)(null),S=(0,h.useRef)(!1);if((0,h.useLayoutEffect)(()=>{if(!a||o===s||v.current)return;let e=()=>{l.current=u.current,c(u.current?Jl(u.current):null)};if(!(n.current&&Number(getComputedStyle(n.current).opacity)>.5)||matchMedia(`(prefers-reduced-motion: reduce)`).matches)return e();v.current=!0;let t=$l(f.current,m.current).map(e=>e.animate({opacity:[1,0]},{duration:Hl,fill:`forwards`}).finished);Promise.allSettled(t).then(()=>{p.current?x(Ql(f.current,p.current)):v.current=!1,e()})}),(0,h.useLayoutEffect)(()=>{if(!y){if(S.current)for(let e of $l(f.current,m.current))e.animate({opacity:[0,1]},{duration:Wl,easing:`ease-out`});S.current=!1;return}S.current=!0;let e=Ql(f.current,p.current),t=Yl(y)??Yl(e)??e.main.left+e.main.width/2,n=Xl(y,t),r=Xl(e,t),i=n.every((e,t)=>e.left===r[t].left&&e.width===r[t].width),a=Math.min(n[0].left,r[0].left),o=Math.max(n[1].left+n[1].width,r[1].left+r[1].width);_.current?.style.setProperty(`left`,`${a}px`),_.current?.style.setProperty(`width`,`${o-a}px`);let s=Array.from(g.current?.children??[],(e,t)=>{let a=e;return a.style.left=`${r[t].left}px`,a.style.width=`${r[t].width}px`,a.animate([{transform:`translateX(${n[t].left-r[t].left}px) scaleX(${n[t].width/r[t].width})`},{transform:`none`}],{duration:i?0:Ul,easing:`cubic-bezier(0.45, 0, 0.3, 1)`}).finished});Promise.allSettled(s).then(()=>{v.current=!1,x(null)})},[y]),!d)return null;let C=d.action?.tone===`accent`,w=d.wide?.onClick??d.action?.onClick,T=y?`invisible`:``;return(0,U.jsxs)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 z-2 col-1 row-1 flex items-end gap-2.5 ${Bl} transition-[translate,opacity] ${zl} ${d.capsule?`px-4`:`px-3`} ${a?``:`translate-y-4 opacity-0`}`,ref:n,inert:!a,"data-bottom-bar":!0,children:[y&&(0,U.jsxs)(`span`,{"aria-hidden":`true`,className:`absolute inset-0`,"data-bar-melt":!0,children:[(0,U.jsx)(`span`,{ref:_,className:`absolute ${Vl} h-13 backdrop-blur-md backdrop-saturate-150 opaque:hidden rounded-[14px]`}),(0,U.jsxs)(`span`,{ref:g,className:`absolute inset-0 [filter:url(#phone-bar-goo)] ${C?``:`opacity-60 opaque:opacity-100`}`,children:[(0,U.jsx)(`span`,{className:`absolute ${Vl} h-13 origin-left bg-inset ${ql}`}),(0,U.jsx)(`span`,{className:`absolute ${Vl} h-13 origin-left ${ql} ${C?`bg-accent`:`bg-inset`}`})]}),(0,U.jsx)(`svg`,{className:`absolute size-0`,role:`presentation`,children:(0,U.jsxs)(`filter`,{id:`phone-bar-goo`,x:`-10%`,y:`-50%`,width:`120%`,height:`200%`,colorInterpolationFilters:`sRGB`,children:[(0,U.jsx)(`feGaussianBlur`,{in:`SourceGraphic`,stdDeviation:Kl}),(0,U.jsx)(`feColorMatrix`,{values:`1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 20 -9.5`,result:`shape`}),(0,U.jsx)(`feMorphology`,{in:`shape`,operator:`erode`,radius:`1`,result:`inner`}),(0,U.jsx)(`feFlood`,{floodColor:`var(--ink)`,floodOpacity:`0.12`}),(0,U.jsx)(`feComposite`,{in2:`shape`,operator:`in`}),(0,U.jsx)(`feComposite`,{in2:`inner`,operator:`out`,result:`rim`}),(0,U.jsx)(`feGaussianBlur`,{in:`shape`,stdDeviation:`4`}),(0,U.jsx)(`feOffset`,{dy:`2`}),(0,U.jsx)(`feColorMatrix`,{values:`0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.4 0`}),(0,U.jsx)(`feComposite`,{in2:`shape`,operator:`out`,result:`shadow`}),(0,U.jsxs)(`feMerge`,{children:[(0,U.jsx)(`feMergeNode`,{in:`shadow`}),(0,U.jsx)(`feMergeNode`,{in:`shape`}),(0,U.jsx)(`feMergeNode`,{in:`rim`})]})]})})]}),d.capsule&&(0,U.jsx)(`div`,{ref:f,className:`flex-none ${T}`,children:d.capsule},s),(0,U.jsxs)(`button`,{ref:p,type:`button`,disabled:d.action?.disabled,className:`group/glass pointer-events-auto relative h-13 min-w-0 flex-1 cursor-pointer disabled:opacity-50 ${Qt} ${T}`,"data-new-task-bar":d.wide?``:void 0,onClick:()=>{kl(),w?.()},children:[(0,U.jsx)(`span`,{className:`absolute inset-0 ${Zt} ${en} ${C?`bg-accent shadow-popover`:Yt()}`}),(0,U.jsx)(`span`,{ref:m,className:`relative block h-full`,children:(0,U.jsx)(eu,{spec:d})},s)]})]})}function nu(e){return(0,U.jsxs)(`button`,{type:`button`,className:`flex min-h-13 w-full flex-col justify-center gap-0.5 px-3 py-2 text-left hover:bg-hover active:bg-hover focus-visible:bg-hover focus-visible:outline-none`,onClick:e.onClick,onContextMenu:e.onContextMenu,children:[(0,U.jsxs)(`span`,{className:`flex w-full min-w-0 items-baseline gap-2`,children:[(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-sans text-body text-ink`,children:e.title}),e.trailing]}),e.subtitle&&(0,U.jsx)(`span`,{className:`w-full truncate font-sans text-meta text-muted`,children:e.subtitle})]})}function ru(e){return Rl(`page`,e.primary?{wide:e.primary}:e.action?{action:e.action}:null),(0,U.jsx)(`div`,{ref:e.rootRef,tabIndex:-1,className:`relative flex min-h-0 flex-1 flex-col focus:outline-none`,children:(0,U.jsxs)(`div`,{className:`${Nl} ${e.primary||e.action?`pb-20`:``}`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(Pl,{children:e.title}),e.note&&(0,U.jsx)(`p`,{className:`m-0 font-sans text-meta text-muted`,children:e.note})]}),e.children]})})}function iu({label:e}){return(0,U.jsx)(`button`,{type:`button`,className:`${bn(`off`)} hidden keyboard:block`,"aria-label":e,onClick:()=>document.activeElement?.blur(),children:(0,U.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:`mx-auto size-5 fill-none stroke-current [stroke-linecap:round] [stroke-linejoin:round] [stroke-width:1.6]`,"aria-hidden":`true`,children:[(0,U.jsx)(`rect`,{x:`3`,y:`3`,width:`18`,height:`12`,rx:`2`}),(0,U.jsx)(`path`,{d:`M7 7h.01M11 7h.01M15 7h.01M8 11h8M9 19l3 3 3-3`})]})})}var au=f(),ou=`fixed inset-x-0 top-0 z-50 flex h-(--vvh,100dvh) items-end bg-[var(--scrim)]`,su=`static m-0 flex max-h-[85dvh] w-full max-w-none flex-col rounded-t-[16px] border-0 p-0 text-inherit bg-surface pb-[max(env(safe-area-inset-bottom),12px)] shadow-dialog focus:outline-none keyboard:max-h-[calc(var(--vvh,100dvh)-24px)] keyboard:pb-3`,cu=`flex flex-none touch-none flex-col`,lu=`mx-auto mt-2 mb-1 h-1 w-9 rounded-full bg-line-active`,uu=`m-0 px-5 pt-2 pb-2 font-sans text-body font-semibold text-ink`,du=`flex min-h-0 flex-col overflow-y-auto px-3 pb-1`,fu=`flex min-h-11 w-full flex-none items-center gap-3 rounded-sm px-2 text-left font-sans text-body hover:bg-hover active:bg-hover focus-visible:bg-hover focus-visible:outline-none`,pu={ink:`text-ink`,danger:`text-error`,muted:`text-muted`,cancel:`justify-center font-semibold text-ink`,action:`justify-center font-semibold text-accent`},mu=`flex min-h-11 w-full flex-none flex-col justify-center gap-1 rounded-sm px-2 py-2 text-left font-sans text-ink hover:bg-hover active:bg-hover focus-visible:bg-hover focus-visible:outline-none disabled:opacity-60`,hu=`mx-2 my-1 h-px flex-none border-none bg-line`,gu=`ml-auto size-4 flex-none fill-none stroke-accent [stroke-linecap:round] [stroke-linejoin:round] [stroke-width:1.75]`,_u=48;function vu(e){let t=(0,h.useRef)(null),n=(0,h.useRef)(null),[r,i]=(0,h.useState)(!1),a=(0,h.useRef)(!1),o=()=>le()?e.onClose():i(!0);return(0,h.useEffect)(()=>{n.current?.contains(document.activeElement)||n.current?.focus()},[]),(0,au.createPortal)((0,U.jsx)(`div`,{className:`${ou} ${r?`pointer-events-none animate-fade-out`:`motion-safe:animate-fade-in`}`,onPointerDown:e=>{a.current=e.target===e.currentTarget},onClick:e=>a.current&&e.target===e.currentTarget&&o(),onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),e.nativeEvent.stopImmediatePropagation(),o())},children:(0,U.jsxs)(`dialog`,{ref:n,tabIndex:-1,open:!0,"aria-modal":`true`,"aria-label":e.label,className:`${su} ${r?`animate-sheet-out`:`motion-safe:animate-sheet-in`}`,onAnimationEnd:t=>r&&t.target===t.currentTarget&&e.onClose(),children:[(0,U.jsxs)(`div`,{className:cu,onTouchStart:e=>{t.current=e.touches[0]?.clientY??null},onTouchEnd:e=>{let n=t.current;t.current=null,n!==null&&(e.changedTouches[0]?.clientY??n)-n>_u&&o()},children:[(0,U.jsx)(`span`,{className:lu,"aria-hidden":`true`}),e.title&&(0,U.jsx)(`h2`,{className:uu,children:e.title})]}),e.children(o)]})}),document.body)}function yu(e){let{tone:t=`ink`,stacked:n=!1,...r}=e;return(0,U.jsx)(`button`,{type:`button`,className:n?mu:`${fu} ${pu[t]}`,...r})}function bu(){return(0,U.jsx)(`svg`,{viewBox:`0 0 16 16`,className:gu,"aria-hidden":`true`,children:(0,U.jsx)(`path`,{d:`M3 8.5 6.5 12 13 4.5`})})}function xu(e){let t=(0,h.useRef)(null);return(0,h.useEffect)(()=>t.current?.focus(),[]),(0,U.jsx)(vu,{label:e.title,title:e.title,onClose:e.onClose,children:n=>(0,U.jsx)(`div`,{className:du,children:e.picks.map(r=>{let i=r.value===e.value;return(0,U.jsxs)(yu,{ref:i?t:void 0,"aria-pressed":i,onClick:()=>{kl(),n(),i||e.onPick(r.value)},children:[(0,U.jsx)(`span`,{className:`min-w-0`,children:r.label}),i&&(0,U.jsx)(bu,{})]},r.value)})})})}var Su=24,Cu=16,wu=120,Tu={accent:`bg-accent text-paper`,danger:`bg-error text-paper`,neutral:`bg-line-active text-ink`},Eu={surface:`bg-surface`,paper:`bg-paper`};function Du(e){let[t,n]=(0,h.useState)(0),r=(0,h.useRef)(null),i=(0,h.useRef)(!1),a=t<0?e.left:t>0?e.right:void 0,o=t=>Math.max(e.left?-window.innerWidth:0,Math.min(e.right?window.innerWidth:0,t));return(0,U.jsxs)(`div`,{className:`relative overflow-hidden touch-pan-y`,onTouchStart:e=>{let t=e.touches[0];r.current=t&&e.touches.length===1&&t.clientX>Su?{x:t.clientX,y:t.clientY,on:!1}:null},onTouchMove:e=>{let t=r.current,i=e.touches[0];if(!t||!i)return;let a=i.clientX-t.x;if(!t.on){let e=i.clientY-t.y;if(Math.hypot(a,e)<Cu)return;if(Math.abs(a)<=2*Math.abs(e)){r.current=null;return}t.on=!0,t.x=i.clientX}n(o(Math.round(i.clientX-t.x)))},onTouchEnd:()=>{let e=r.current;r.current=null,e?.on&&(i.current=!0,a&&Math.abs(t)>=wu&&(kl(`medium`),a.run()),n(0))},onTouchCancel:()=>{r.current=null,n(0)},onClickCapture:e=>{i.current&&(i.current=!1,e.preventDefault(),e.stopPropagation())},children:[a&&(0,U.jsx)(`div`,{"aria-hidden":`true`,className:`absolute inset-0 flex items-center px-5 font-sans text-body font-semibold ${t<0?`justify-end`:`justify-start`} ${Tu[a.tone]}`,children:a.label}),(0,U.jsx)(`div`,{className:`relative ${t===0?`transition-transform duration-200 ease-snap motion-reduce:transition-none`:`${Eu[e.ground??`surface`]} will-change-transform`}`,style:t?{transform:`translateX(${t}px)`}:void 0,children:e.children})]})}var Ou={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`},ku={accent:`text-accent`,muted:`text-subtle`,attention:`text-error`,warning:`text-warning`,success:`text-success`,info:`text-accent`,ink:`text-ink`};function Au({model:e}){H();let{attention:t,recent:n,now:r,open:i,ack:a,ackAll:o,peekOf:s,menuOf:c}=Oc(e),[l,u]=(0,h.useState)(null),d=e=>e.attention&&gc(e.attention.state).glyph===`?`?0:1,f=[...t].sort((e,t)=>d(e)-d(t)),p=t=>{let n=t.attention?gc(t.attention.state):null,o=s(t),d=c(t,e=>u(e.id)),f=(0,U.jsx)(nu,{title:t.identity,subtitle:t.subtitle,onClick:()=>i(t),onContextMenu:e=>{e.preventDefault(),O.set({x:e.clientX,y:e.clientY,target:e.currentTarget,items:d})},trailing:(0,U.jsxs)(U.Fragment,{children:[n&&(0,U.jsxs)(`span`,{className:`flex-none font-sans text-meta ${n.tone===`success`?`text-subtle`:ku[n.tone]}`,children:[n.glyph,` `,V(n.stateKey)]}),(0,U.jsx)(`span`,{className:`flex-none font-sans text-meta text-subtle`,children:_c(r-t.at)})]})});return(0,U.jsxs)(`div`,{children:[t.attention?(0,U.jsx)(Du,{left:{label:V(`inbox.phone.ack`),tone:`accent`,run:()=>a(t)},children:f}):f,o&&l===o.id&&t.taskId&&(0,U.jsx)(Ol,{model:e,taskId:t.taskId,tabId:o.tabId,mode:o.mode,gate:o.gate,onOpenTab:()=>i(t)})]},t.key)};return(0,U.jsx)(vu,{label:V(`inbox.phone.title`),title:V(`inbox.phone.title`),onClose:B,children:()=>(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`${du} gap-4`,children:[t.length===0&&n.length===0&&(0,U.jsx)(`p`,{className:`m-0 px-2 py-3 font-sans text-body text-muted`,children:V(`inbox.phone.empty`)}),t.length>0&&(0,U.jsx)(Fl,{label:V(`inbox.attention`),children:f.map(p)}),n.length>0&&(0,U.jsx)(Fl,{label:V(`inbox.recent`),children:n.map(p)})]}),t.length>0&&(0,U.jsx)(`div`,{className:`flex-none px-3 pt-1`,children:(0,U.jsx)(yu,{tone:`action`,onClick:o,children:V(`inbox.phone.ackAll`)})})]})})}function ju({text:e}){return(0,U.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,U.jsx)(`span`,{children:e},e))})}function Mu({model:e}){return Oe()?(0,U.jsx)(Au,{model:e}):(0,U.jsx)(Nu,{model:e})}function Nu({model:e}){H();let{attention:t,recent:n,cards:r,now:i,open:a,ack:o,ackAll:s,peekOf:c,menuOf:l}=Oc(e),u=(0,h.useRef)(null),[d,f]=(0,h.useState)(0),[p,m]=(0,h.useState)(null),g=r[Math.min(d,r.length-1)],_=(0,h.useRef)(!1),v=e=>{_.current=!0,f(t=>Math.max(0,Math.min(r.length-1,t+e)))};(0,h.useEffect)(()=>{_.current&&u.current?.querySelectorAll(`li`)[d]?.scrollIntoView({block:`nearest`}),_.current=!1},[d]),(0,h.useEffect)(()=>{let e=e=>{if(!(e.target instanceof HTMLElement&&e.target.closest(`input, textarea`))){if(e.key===`ArrowDown`||e.key===`j`)v(1);else if(e.key===`ArrowUp`||e.key===`k`)v(-1);else if(e.key===`Enter`&&g)a(g);else if(e.key===`d`&&g)o(g);else if(e.key===`D`)s();else return;e.preventDefault()}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)});let y=t=>{let n=t.attention?gc(t.attention.state):null,s=n?.tone===`success`,u=t===g,d=c(t),h=!!d&&p===d.id,_=!!d||!!t.attention;return(0,U.jsxs)(`li`,{children:[(0,U.jsxs)(`div`,{className:Ii,onMouseEnter:()=>f(r.indexOf(t)),onContextMenu:e=>{e.preventDefault();let n=l(t,e=>m(e.id));O.set({x:e.clientX,y:e.clientY,target:e.currentTarget,items:n})},children:[(0,U.jsxs)(`button`,{type:`button`,className:`${Xi({selected:u})} ${Li}`,onClick:()=>a(t),children:[(0,U.jsx)(`span`,{className:`${ea} ${n&&!s?ku[n.tone]:`text-subtle`}`,title:n?V(n.stateKey):void 0,children:n?.glyph}),(0,U.jsxs)(`span`,{className:Ni,children:[(0,U.jsx)(`span`,{className:Pi,children:t.label}),(0,U.jsx)(`span`,{className:Fi,children:[t.project,t.subtitle].filter(Boolean).join(` · `)})]}),n&&!s&&(0,U.jsx)(`span`,{className:`flex-none font-mono text-meta font-normal normal-nums ${ku[n.tone]}`,children:V(n.stateKey)}),(0,U.jsx)(`span`,{className:`${ji} ${h?`invisible`:_?Mi:``}`,children:_c(i-t.at)})]}),_&&(0,U.jsxs)(`span`,{className:`absolute inset-y-0 right-2 flex items-center gap-0.5 ${h?``:`invisible group-hover/card:visible group-focus-within/card:visible`}`,children:[d&&(0,U.jsx)(W,{variant:h?`iconOn`:`icon`,"aria-label":V(`inbox.phone.reply`),title:V(`inbox.phone.reply`),"aria-expanded":h,onClick:()=>m(h?null:d.id),children:(0,U.jsx)(Dl,{d:`M6.5 4 3 7.5 6.5 11M3 7.5h6.5a3.5 3.5 0 0 1 3.5 3.5v1`})}),t.attention&&(0,U.jsx)(W,{variant:`icon`,"aria-label":V(`inbox.phone.ack`),title:V(`inbox.phone.ack`),onClick:()=>o(t),children:(0,U.jsx)(Dl,{d:`M3.5 8.5 6.5 11.5 12.5 4.5`})})]})]}),h&&t.taskId&&(0,U.jsx)(Ol,{model:e,taskId:t.taskId,tabId:d.tabId,mode:d.mode,gate:d.gate,onOpenTab:()=>a(t)})]},t.key)};return(0,U.jsx)(ia,{title:V(`inbox.title`),wide:!0,children:(0,U.jsxs)(`div`,{ref:u,className:hi,children:[(0,U.jsxs)(`div`,{className:Oi,children:[(0,U.jsx)(`p`,{className:`${qr} text-muted ${Di} touch:hidden!`,children:(0,U.jsx)(ju,{text:V(`inbox.hints`)})}),t.length>0&&(0,U.jsx)(W,{variant:`pill`,onClick:s,children:V(`inbox.phone.ackAll`)})]}),(0,U.jsx)(`h2`,{className:`${qr} text-muted ${ki}`,children:V(`inbox.attention`)}),t.length===0?(0,U.jsx)(`p`,{className:`mono text-muted`,children:V(`inbox.empty`)}):(0,U.jsx)(`ul`,{className:Ai,children:t.map(y)}),n.length>0&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`h2`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted mt-1`,children:V(`inbox.recent`)}),(0,U.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-0.5 p-0`,children:n.map(y)})]})]})})}function Pu(e){return e instanceof Pc&&e.code===`NOT_CONNECTED`?V(`workspace.connect.notConnected`):e instanceof Error?e.message:String(e)}var Fu=`rove.web.legacyAdopt.dismissed`,Iu=6,Lu=!1,Ru=e=>e.replace(/[\\/]+$/,``).split(/[\\/]/).at(-1)??e;function zu(){try{return localStorage.getItem(Fu)===`1`}catch{return!1}}function Bu(){try{localStorage.setItem(Fu,`1`)}catch{}}function Vu(e){let t=e.slice(0,Iu).map(e=>` ${Ru(e.repo)}/${e.title}`);return e.length>Iu&&t.push(` ${K(`tasks`,`confirm.legacyAdoptMore`,{count:e.length-Iu})}`),t.join(`
40
40
  `)}function Hu(e){return K(`tasks`,`confirm.legacyAdoptPrompt`,{list:e.map(e=>`- ${e.id} · ${e.title} · ${e.worktreePath}`).join(`
41
41
  `)})}async function Uu(e){if(Lu||zu())return;Lu=!0;let{tasks:t}=await e.client.request(`worktree.legacyAdopted`,{}).catch(()=>({tasks:[]}));t.length!==0&&k.get()===null&&k.set((0,U.jsx)(Wu,{model:e,tasks:t}))}function Wu(e){let[t,n]=(0,h.useState)(!1),[r,i]=(0,h.useState)(null),a=async()=>{n(!0),i(null);try{let{taskId:t}=await e.model.client.request(`worktree.legacyCleanup`,{title:K(`tasks`,`confirm.legacyAdoptSessionTitle`),prompt:Hu(e.tasks)});B(),e.model.selectWhenListed(t)}catch(e){i(K(`tasks`,`confirm.legacyAdoptFailed`,{message:Pu(e)}))}finally{n(!1)}};return(0,U.jsx)(ia,{title:K(`tasks`,`confirm.legacyAdoptTitle`,{count:e.tasks.length}),children:(0,U.jsxs)(`div`,{className:hi,children:[(0,U.jsx)(`p`,{className:`text-muted whitespace-pre-wrap`,children:K(`tasks`,`confirm.legacyAdoptBody`,{list:Vu(e.tasks)})}),r&&(0,U.jsx)(`p`,{className:`text-error`,children:r}),(0,U.jsxs)(`div`,{className:Qr,children:[(0,U.jsx)(W,{onClick:()=>{Bu(),B()},children:K(`tasks`,`confirm.legacyAdoptNever`)}),(0,U.jsx)(W,{onClick:B,children:K(`tasks`,`confirm.legacyAdoptLater`)}),(0,U.jsx)(W,{variant:`filled`,disabled:t,autoFocus:!0,onClick:()=>void a(),children:K(`tasks`,`confirm.legacyAdoptClean`)})]})]})})}function Gu(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 Ku(e=jc){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 qu(e=jc){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 Ju(e,t=jc){try{let n=await t(`/login`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({password:e}),credentials:`omit`}),r=Gu(n.status,await n.json().catch(()=>null));return r.kind===`ok`&&a(r.token),r}catch{return{kind:`unreachable`}}}async function Yu(e=jc){let t=i();o(),t&&await e(`/logout`,{method:`POST`,headers:{Authorization:`Bearer ${t}`}}).catch(()=>{})}function Xu(e){if(!e)return null;switch(e.kind){case`ok`:return null;case`wrong`:return V(`login.wrong`);case`locked`:return V(`login.locked`,{minutes:e.minutes});case`lockedHost`:return V(`login.lockedHost`);case`unreachable`:return V(`login.unreachable`)}}function Zu(){H();let[e,t]=(0,h.useState)(``),[n,r]=(0,h.useState)(!1),[i,a]=(0,h.useState)(null),o=Xu(i);return(0,U.jsx)(`div`,{className:sr,children:(0,U.jsxs)(`form`,{className:cr,onSubmit:async i=>{if(i.preventDefault(),n||!e)return;r(!0);let o=await Ju(e);if(o.kind===`ok`){window.location.reload();return}t(``),a(o),r(!1)},children:[(0,U.jsxs)(`span`,{className:ar,children:[(0,U.jsx)(`span`,{className:or,children:`[`}),` rove `,(0,U.jsx)(`span`,{className:or,children:`]`})]}),(0,U.jsx)(`h1`,{className:`${qr} text-muted`,children:V(`login.title`)}),(0,U.jsx)(`p`,{className:`text-muted`,children:V(`login.body`)}),(0,U.jsx)(`input`,{className:Zr,type:`password`,autoComplete:`current-password`,"aria-label":V(`login.field`),placeholder:V(`login.field`),autoFocus:!0,value:e,disabled:n,onChange:e=>{t(e.target.value),a(null)}}),o&&(0,U.jsx)(`p`,{className:`text-error`,role:`alert`,children:o}),(0,U.jsx)(`div`,{className:Qr,children:(0,U.jsx)(`button`,{type:`submit`,className:Rr(),disabled:n||!e,children:V(n?`login.checking`:`login.submit`)})})]})})}var Qu=524288e3,$u=1048576;function ed(e,t){return/\.pdf$/i.test(e)?`pdf[${t}]`:/\.(png|jpe?g|gif|webp)$/i.test(e)?`images[${t}]`:`files[${t}]`}function td(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 nd(e,t){let n=e.replace(/\s+$/,``),r=td(e);for(let e of t){let t=`${ed(e,r)}: ${e}`;n=n.length>0?`${n}\n${t}`:t,r+=1}return n}function rd(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 id(e,t,n){if(t.size>524288e3)throw Error(V(`pages.attachTooLarge`,{name:t.name}));let r={mime:t.type,name:t.name,...n?{task:n}:{}},i=async(e,n)=>rd(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+$u,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 ad(e,t,n){return(await id(e,t,n)).path}function od(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 sd=`size-14 rounded-sm border-hairline border-line object-cover`;function cd({name:e,thumb:t}){if(t)return(0,U.jsx)(`img`,{src:t,alt:``,draggable:!1,className:sd});let n=e.includes(`.`)?e.split(`.`).pop()??``:``;return(0,U.jsx)(`span`,{className:`${sd} flex items-center justify-center font-mono text-meta uppercase text-muted`,children:n.slice(0,4)||`file`})}function ld({item:e,onRemove:t}){let[n]=(0,h.useState)(e.pending);return(0,U.jsxs)(`li`,{className:`group relative size-14 shrink-0 ${n?`motion-safe:animate-rise-in`:``}`,title:`${e.name} · ${od(e.size)}`,children:[(0,U.jsx)(`div`,{className:`transition-opacity duration-150 motion-reduce:transition-none ${e.pending?`opacity-50`:``}`,children:(0,U.jsx)(cd,{...e})}),(0,U.jsx)(`button`,{type:`button`,"aria-label":V(`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 ud({items:e,onRemove:t}){return e.length===0?null:(0,U.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,U.jsx)(ld,{item:e,onRemove:t},e.id))})}function dd(e,t){let n=e=>e.dataTransfer.types.includes(`Files`);return{drop:{onDragEnter:e=>n(e)&&t?.(!0),onDragOver:e=>{n(e)&&(e.preventDefault(),t?.(!0))},onDragLeave:e=>{let n=e.currentTarget.getBoundingClientRect();e.clientX>n.left&&e.clientX<n.right&&e.clientY>n.top&&e.clientY<n.bottom||t?.(!1)},onDrop:n=>{t?.(!1),n.dataTransfer.files.length!==0&&(n.preventDefault(),n.stopPropagation(),e(Array.from(n.dataTransfer.files)))}},onPaste:t=>{let n=Array.from(t.clipboardData.files);n.length!==0&&(t.preventDefault(),e(n))}}}function fd(e){let[t,n]=(0,h.useState)(!1);return{over:t,...dd(e,n)}}function pd(e){return(0,U.jsxs)(`label`,{className:e.className,title:e.title,"data-tp-part":`composer-attach`,children:[e.children,(0,U.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 md={image:`images`,pdf:`pdf`};function hd(e,t){let n=t.filter(e=>e.path!==void 0);return n.length===0?e:`${e}\n\n${n.map((e,t)=>`${md[e.kind??`image`]??`files`}[${t}]: ${e.path}`).join(`
@@ -51,63 +51,63 @@ Then look for the hook that older version installed. Check my engine settings fi
51
51
  `),[i,a]=(0,h.useState)(()=>J(e,`kanban.boards`)??null);return(0,h.useEffect)(()=>{let t=!0,r=e.client,i=e=>r.request(e).then(e=>e.repos).catch(()=>[]);return Promise.all([i(`repos.list`),i(`issue.repos`)]).then(([e,t])=>xS(e,n,t)).then(e=>Promise.all(e.map(e=>r.request(`issue.list`,{repo:e}).catch(t=>({repoRoot:e,nextId:1,issues:[],readError:vS(t)}))))).then(n=>{let r=os(e,`kanban.boards`,void 0,[...n].sort((e,t)=>e.repoRoot.localeCompare(t.repoRoot)));t&&a(r)}),()=>{t=!1}},[e,t,r]),i}function EE(e){let{issue:t}=e,n=t.body.trim();return(0,U.jsxs)(`div`,{"data-issue":t.id,className:tE({selected:e.selected,attention:e.badge?.tone===`text-error`}),onClick:()=>e.selected?e.onOpen():e.onSelect(),onContextMenu:t=>{t.preventDefault(),e.onMenu(t.clientX,t.clientY)},children:[(0,U.jsxs)(`div`,{className:nE,children:[(0,U.jsx)(`span`,{className:rE(e.column===`done`),children:t.title}),(0,U.jsxs)(`span`,{className:`mono text-muted`,children:[`#`,t.id]})]}),(0,U.jsx)(`div`,{className:`text-muted ${iE}`,children:n}),(0,U.jsxs)(`div`,{className:`mono text-muted ${aE}`,children:[(0,U.jsx)(`span`,{children:t.created}),e.badge&&(0,U.jsx)(`span`,{className:e.badge.tone,children:e.badge.label})]})]})}var DE=5e3,OE=760;function kE({model:e}){let{kanban:t,group:n,nav:r}=gS(),i=Oe(),[a,o]=wS(DE),s=TE(e,a),{engines:c,defaultEngine:l}=wE(e),u=b(e.tasks),d=CS(e),[f,p]=(0,h.useState)(null),[m,g]=(0,h.useState)(null),_=DS(),[v,y]=(0,h.useState)(!1);(0,h.useEffect)(()=>{let e=_.current;if(!e)return;let t=new ResizeObserver(()=>y(e.clientWidth<OE));return t.observe(e),()=>t.disconnect()},[_]);let x=s??[],S=d?x.find(e=>e.repoRoot.replace(/^\/private\//,`/`)===d.replace(/^\/private\//,`/`)):void 0,C=Math.max(0,x.findIndex(e=>e.repoRoot===(f??S?.repoRoot))),w=x[C],T=x.map(e=>e.repoRoot),E=x.filter(e=>e.readError).map(e=>`${e.repoRoot}\0${e.readError}`).join(`
52
52
  `);(0,h.useEffect)(()=>{for(let e of x)e.readError&&z(Z(t.readFailedToast,{repo:bS(e.repoRoot,T),error:e.readError}),`error`)},[E]);let D=u?.tasks??[],A=new Set(D.map(e=>e.id)),j=e=>D.find(t=>t.id===e)?.group,{columns:ee,attentionCount:te}=PT(w?IT(w.issues,A.size===0?void 0:e=>A.has(e)):[],e=>j(e)===`waiting-on-you`),ne={backlog:t.column.backlog,in_progress:t.column.inProgress,parked:t.column.parked,done:t.column.done},N=(e,t)=>{let r=e.taskId&&(t===`in_progress`||t===`parked`)?j(e.taskId):void 0,i=r===`waiting-on-you`?n.waitingOnYou:r===`landing`?n.landing:r===`ready-for-review`?n.readyForReview:r===`working`?n.working:null;return r&&i?{label:i,tone:CE[r]??`text-muted`}:null},P=async(t,n,r,i)=>{try{return await e.client.request(t,{repo:w?.repoRoot,...n})}catch(e){return z(Z(r,{id:String(i),error:vS(e)}),`error`),null}finally{o()}},re=(e,n)=>P(`issue.setStatus`,{id:e.id,status:n},t.statusFailed,e.id),ie=t=>{M.set(null),e.select(t)},F=async(n,r,i)=>{try{let a=await RT(e.client,{repo:n,issue:r,engine:i.engine,placement:i.placement});for(let e of a.warnings)z(Z(e.kind===`link`?t.linkFailed:t.statusFailed,{id:String(r.id),error:e.error}),`error`);i.jump?(M.set(null),e.selectWhenListed(a.taskId)):z(Z(t.detail.startedBackground,{title:`#${r.id} ${r.title}`}))}catch(e){z(G(e),`error`)}finally{o()}},I=async(e,n)=>{if(!w||n.kind===`create`)return;let r={};n.title!==e.title&&(r.title=n.title),n.body!==e.body&&(r.body=n.body),(r.title!==void 0||r.body!==void 0)&&await P(`issue.update`,{id:e.id,...r},t.updateFailed,e.id),n.status!==e.status&&await re(e,n.status),n.kind===`open`?ie(n.taskId):n.kind===`unlink`?await P(`issue.update`,{id:e.id,task:`none`},t.unlinkFailed,e.id):n.kind===`start`&&await F(w.repoRoot,{...e,...r},n)},ae=t=>{w&&(g(t.id),k.set((0,U.jsx)(SE,{model:e,issue:t,mode:`detail`,engines:c,defaultEngine:l,onOutcome:e=>void I(t,e)})))},L=()=>{if(!w)return;let n=w.repoRoot,r={id:w.nextId,title:``,status:`open`,created:new Date().toISOString().slice(0,10),body:``};k.set((0,U.jsx)(SE,{model:e,issue:r,mode:`create`,engines:c,defaultEngine:l,onOutcome:i=>{i.kind===`create`&&(async()=>{try{let t=await e.client.request(`issue.create`,{repo:n,title:i.title,body:i.body});if(o(),!i.start)return;let a=t.issues.find(e=>e.id===r.id)??t.issues.reduce((e,t)=>e&&e.id>t.id?e:t,null);a&&await F(n,a,i.start)}catch(e){z(Z(t.createFailed,{error:vS(e)}),`error`)}})()}}))},R=(n=w?.issues.find(e=>e.id===m))=>{if(!w||!n)return;let r=w.repoRoot;k.set((0,U.jsx)(sa,{title:Z(t.confirmDelete.title,{id:String(n.id)}),body:Z(t.confirmDelete.body,{title:n.title}),confirmLabel:V(`pages.deleteIssue`),onConfirm:async()=>{try{await e.client.request(`issue.delete`,{repo:r,id:n.id}),g(null)}catch(e){z(Z(t.deleteFailed,{id:String(n.id),error:vS(e)}),`error`)}finally{o()}}}))},oe=e=>{x.length!==0&&(p(x[(C+e+x.length)%x.length]?.repoRoot??null),g(null))},se=e=>{let t=MT(ee,m,e);t!=null&&g(t)},ce=e=>ee.some(e=>e.issues.length>0)?se(e):oe(e===`left`?-1:1);ES(e=>{if(e.ctrlKey)return e.key===`c`&&(M.set(null),!0);switch(e.key){case`Escape`:case`q`:return M.set(null),!0;case`r`:return o(),!0;case`Tab`:return oe(e.shiftKey?-1:1),!0;case`ArrowUp`:return se(`up`),!0;case`ArrowDown`:return se(`down`),!0;case`ArrowRight`:case`l`:return ce(`right`),!0;case`ArrowLeft`:case`h`:return ce(`left`),!0;case`Enter`:{let e=w?.issues.find(e=>e.id===m);return e&&ae(e),!0}case`n`:return L(),!0;case`d`:return R(),!0;default:return!1}});let le=(0,h.useRef)(null);(0,h.useEffect)(()=>{le.current?.querySelector(`[data-issue="${m}"]`)?.scrollIntoView({block:`nearest`})},[m]);let ue=(e,n,r)=>{g(e.id),O.set({x:n,y:r,items:bE.filter(t=>t!==e.status).map(n=>({label:Z(t.menu.setStatus,{status:t.detail.status[n]}),run:()=>void re(e,n)})).concat(i?[{label:V(`pages.deleteIssue`),danger:!0,section:`danger`,run:()=>R(e)}]:[])})},B=ee.find(e=>e.issues.some(e=>e.id===m))??ee.find(e=>e.issues.length>0)??ee[0],de=(e,n=!1)=>{let r=Z(t.attention,{count:String(te)});return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`span`,{children:[ne[e.key],` (`,e.issues.length+e.hiddenCount,`)`]}),e.key===`in_progress`&&te>0&&(0,U.jsx)(`span`,{className:`text-warning`,title:n?r:void 0,children:n?`!${te}`:r})]})},fe=(e,n)=>(0,U.jsxs)(`section`,{className:ZT(!n),children:[n&&(0,U.jsx)(`h2`,{className:QT(e.key),children:de(e)}),(0,U.jsxs)(`div`,{className:$T,children:[e.issues.map(t=>(0,U.jsx)(EE,{issue:t,column:e.key,selected:t.id===m,badge:N(t,e.key),onSelect:()=>g(t.id),onOpen:()=>ae(t),onMenu:(e,n)=>ue(t,e,n)},t.id)),e.issues.length===0&&e.hiddenCount===0&&(0,U.jsx)(`p`,{className:`mono text-muted ${eE}`,children:t.columnEmpty}),e.hiddenCount>0&&(0,U.jsx)(`p`,{className:`mono text-muted ${eE}`,children:Z(t.more,{count:String(e.hiddenCount)})})]})]},e.key),pe=s===null?(0,U.jsx)(`p`,{className:`text-muted`,children:t.loading}):w?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:HT,children:[(0,U.jsxs)(`button`,{type:`button`,className:UT,onClick:()=>oe(1),children:[bS(w.repoRoot,T),x.length>1&&(0,U.jsx)(`span`,{className:`text-muted`,children:` ${C+1}/${x.length}`})]}),!v&&(0,U.jsx)(`span`,{className:`mono text-muted ${WT}`,children:w.repoRoot}),w.issues.length===0&&!w.readError&&(0,U.jsx)(`span`,{className:`text-muted ${GT}`,children:t.empty})]}),w.readError?(0,U.jsx)(`p`,{className:`text-error`,children:Z(t.readFailed,{error:w.readError})}):v&&B?(0,U.jsxs)(`div`,{className:qT,ref:le,children:[(0,U.jsx)(`div`,{className:`mono ${JT}`,children:ee.map(e=>(0,U.jsx)(`button`,{type:`button`,className:YT(e.key===B.key),onClick:()=>{let t=e.issues[0];t&&g(t.id)},children:de(e,!0)},e.key))}),fe(B,!1)]}):(0,U.jsx)(`div`,{className:KT,ref:le,children:ee.map(e=>fe(e,!0))})]}):(0,U.jsx)(`p`,{className:`text-muted`,children:t.noRepos});return i?(0,U.jsx)(ru,{title:r.kanban,rootRef:_,primary:w?{label:V(`pages.newCard`),onClick:L}:void 0,children:pe}):(0,U.jsxs)(`div`,{className:`${Uw} ${VT}`,tabIndex:0,ref:_,children:[(0,U.jsxs)(`div`,{className:`kb-top`,children:[(0,U.jsx)(`h1`,{className:Gw,children:t.title}),(0,U.jsx)(`span`,{className:`mono keys-only text-muted`,children:t.hint}),(0,U.jsxs)(`span`,{className:`mono ${Jw}`,children:[(0,U.jsx)(`button`,{type:`button`,className:`${Jr} ${Yw.kanban}`,disabled:!w,onClick:L,children:V(`pages.new`)}),(0,U.jsx)(`button`,{type:`button`,className:`${Jr} ${Yw.kanban}`,disabled:!w?.issues.some(e=>e.id===m),onClick:()=>R(),children:V(`pages.delete`)})]})]}),pe]})}var AE={title:`Mods`,empty:`No mod is drawing anything.`,emptyHint:`A plugin with a [mod] entry draws its panes here, in the TUI and the web alike.`,keys:`↑↓/tab move · enter press · esc back`,pressFailed:`{plugin}: the press did not reach the mod ({reason})`},jE={title:`Mods`,empty:`当前没有 mod 在绘制内容。`,emptyHint:`声明了 [mod] 的插件会在这里绘制面板,TUI 和 web 显示的是同一份。`,keys:`↑↓/tab 移动 · enter 按下 · esc 返回`,pressFailed:`{plugin}:按键没有送达 mod({reason})`};function ME(e){let t=e.changes&&`behind`in e.changes?e.changes.behind??0:0;return{branch:e.branch,behind:t>0?`↓${t}`:null}}function NE(e,t,n){let r=[`kanban`,`issues`].filter(t=>e.has(t)).map(e=>({id:e,page:e,title:n[e]})),i=t.map(e=>{let t=`${e.plugin}/${e.id}`;return{id:`mod:${t}`,page:`mods`,title:e.title,note:e.plugin,pane:t}});return[...r,...i]}var PE=`rove.web.extPage`,FE=y(typeof localStorage>`u`?null:(()=>{try{return localStorage.getItem(PE)}catch{return null}})()),IE=y(null);function LE(e){FE.set(e.id),IE.set(e.pane??null);try{localStorage.setItem(PE,e.id)}catch{}}var RE={info:`text-info`,success:`text-success`,warning:`text-warning`,error:`text-error`,muted:`text-muted`},zE=`flex flex-col gap-3`,BE=`[&_p]:mx-0 [&_p]:my-1`,VE=`rounded-md border-hairline border-line px-3 pt-2 pb-3 font-mono`,HE=(e,t)=>`flex min-w-0 items-start ${e?`[&>form]:flex-[1_1_12em] [&>form]:self-center`:``} ${t?`rounded-sm border-hairline border-line`:``}`,UE=(e,t)=>`whitespace-pre-wrap wrap-anywhere ${e?RE[e]:`text-ink`} ${t?`font-bold`:``}`,WE=(e,t)=>`cursor-pointer rounded-sm border-hairline border-current px-2.5 py-0.5 [font:inherit] font-bold! ${RE[e]} ${t?`bg-[color-mix(in_srgb,currentcolor_18%,transparent)]`:`bg-transparent hover:bg-[color-mix(in_srgb,currentcolor_18%,transparent)]`}`,GE=`flex min-w-0 max-w-[40em] self-stretch`,KE=`w-full font-mono`,qE=[0,6,12,20];function JE(e){return`mod-${e.kind}:${e.plugin}/${e.pane}/${e.key}`}function YE(e){let[t,n]=(0,h.useState)(e.value??``);return(0,U.jsx)(`form`,{className:GE,onSubmit:r=>{r.preventDefault(),e.onSubmit(t),n(e.value??``)},children:(0,U.jsx)(`input`,{id:e.id,className:`${Zr} ${KE}`,spellCheck:!1,value:t,placeholder:e.placeholder,onFocus:e.onFocus,onChange:e=>n(e.target.value)})})}function XE(e){let{node:t}=e;if(t.type===`text`)return(0,U.jsx)(`span`,{className:UE(t.tone,t.bold===!0),children:t.text});if(t.type===`input`){let n={kind:`input`,plugin:e.pane.plugin,pane:e.pane.id,key:t.key};return(0,U.jsx)(YE,{id:JE(n),placeholder:t.placeholder,value:t.value,onFocus:()=>e.onFocus(n),onSubmit:t=>e.onSubmit(n,t)},t.value??``)}if(t.type===`button`){let n={kind:`button`,plugin:e.pane.plugin,pane:e.pane.id,key:t.key};return(0,U.jsx)(`button`,{type:`button`,id:JE(n),className:WE(t.tone??`info`,ro(n,e.cursor)),onFocus:()=>e.onFocus(n),onClick:()=>e.onPress(n),children:t.label})}return(0,U.jsx)(`div`,{className:HE(t.direction===`row`,t.border===!0),style:{flexDirection:t.direction??`column`,gap:qE[t.gap??0],padding:qE[t.padding??0]},children:t.children.map((t,n)=>(0,U.jsx)(XE,{...e,node:t},n))})}function ZE({model:e}){let t=H()===`zh`?jE:AE,n=Oe(),r=b(IE),i=b(e.mods),a=n?i.filter(e=>`${e.plugin}/${e.id}`===r):[],o=a.length>0?a:i,s=no(o),[c,l]=(0,h.useState)(null),u=io(s,c),d=DS(),f=(0,h.useRef)(!1),p=(t,n,r={})=>{l(t),!f.current&&(f.current=!0,e.client.request(n,{plugin:t.plugin,pane:t.pane,key:t.key,...r}).catch(e=>z(e instanceof Error?e.message:String(e),`error`)).finally(()=>{f.current=!1}))},m=e=>p(e,`mod.press`),g=(e,t)=>p(e,`mod.submit`,{value:t}),_=e=>{let t=ao(s,u,e);l(t),t&&document.getElementById(JE(t))?.focus()};ES(e=>{if(e.ctrlKey)return e.key===`c`&&(M.set(null),!0);switch(e.key){case`Escape`:case`q`:return M.set(null),!0;case`ArrowDown`:return _(1),!0;case`ArrowUp`:return _(-1),!0;case`Enter`:return e.target instanceof HTMLButtonElement?!1:(u?.kind===`button`&&m(u),!0);default:return!1}});let v=o.length===0?(0,U.jsxs)(`div`,{className:BE,children:[(0,U.jsx)(`p`,{children:t.empty}),(0,U.jsx)(`p`,{className:`text-muted`,children:t.emptyHint})]}):o.map(e=>(0,U.jsxs)(`section`,{className:VE,children:[a.length===0&&(0,U.jsxs)(`header`,{className:`mb-2 text-meta leading-[inherit] text-ink`,children:[e.title,` `,(0,U.jsx)(`span`,{className:`text-muted`,children:e.plugin})]}),(0,U.jsx)(XE,{node:e.tree,pane:e,cursor:u,onPress:m,onSubmit:g,onFocus:l})]},`${e.plugin}/${e.id}`));return n?(0,U.jsx)(ru,{title:a[0]?.title??t.title,note:a[0]?.plugin,rootRef:d,children:v}):(0,U.jsxs)(`div`,{className:`${Ww} ${zE}`,tabIndex:0,ref:d,children:[(0,U.jsxs)(`div`,{className:Kw,children:[(0,U.jsx)(`h1`,{className:Gw,children:t.title}),(0,U.jsx)(`span`,{className:`keys-only touch:empty:hidden! text-muted ${qw(!1)}`,children:t.keys})]}),v]})}var QE=[`ci_failed`,`pr_review_requested`,`issue_opened`,`webhook`,`local`];function $E(e){let t=!!e.schedule,n=eD(e);return t&&n?`hybrid`:n?`event`:`schedule`}function eD(e){return!!(e.eventTriggers&&e.eventTriggers.length>0||e.webhook)}function tD(e){let t=e.filter;if(!t)return e.kind;let n=[];return t.event?n.push(t.action?`${t.event}.${t.action}`:t.event):t.action&&n.push(t.action),t.branch&&n.push(t.branch),n.length>0?`${e.kind} (${n.join(`, `)})`:e.kind}function nD(e){let t=e.eventTriggers?.map(tD)??[];return t.length>0?t.join(`, `):e.webhook?`webhook`:``}function rD(e){return e===`dispatch_failed`||e===`skipped_unavailable`||e===`script_failed`}function iD(e,t){return e.response?`responded`:e.status!==`dispatched`&&e.status!==`revived`||e.deliveryStatus===`quiet`?null:e.deliveryStatus===`missing`?`missing`:e.deliveryStatus===`awaiting`?`awaiting`:t-Date.parse(e.at)>72e5?`missing`:`awaiting`}var aD=6e4,oD=3294,sD=new Map([[`JAN`,1],[`FEB`,2],[`MAR`,3],[`APR`,4],[`MAY`,5],[`JUN`,6],[`JUL`,7],[`AUG`,8],[`SEP`,9],[`OCT`,10],[`NOV`,11],[`DEC`,12]]),cD=new Map([[`SUN`,0],[`MON`,1],[`TUE`,2],[`WED`,3],[`THU`,4],[`FRI`,5],[`SAT`,6]]),lD=256;function uD(e,t,n){let r=e.toUpperCase(),i=t?.get(r);if(i!==void 0)return i;if(!/^\d+$/.test(r))throw Error(`invalid cron ${n}: ${e}`);return Number(r)}function dD(e){let t=new Set;for(let n of e.value.split(`,`)){if(n.length===0)throw Error(`invalid cron ${e.field}: ${e.value}`);let[r,i,...a]=n.split(`/`);if(a.length>0||r===void 0)throw Error(`invalid cron ${e.field}: ${n}`);let o=1;if(i!==void 0&&(!/^\d+$/.test(i)||(o=Number(i),o<1)))throw Error(`invalid cron ${e.field} step: ${n}`);let s,c;if(r===`*`)s=e.min,c=e.max;else if(r.includes(`-`)){let[t,i,...a]=r.split(`-`);if(a.length>0||t===void 0||i===void 0)throw Error(`invalid cron ${e.field} range: ${n}`);s=uD(t,e.names,e.field),c=uD(i,e.names,e.field)}else s=uD(r,e.names,e.field),c=i===void 0?s:e.max;if(s<e.min||c>e.max||s>c)throw Error(`cron ${e.field} out of range: ${n}`);for(let n=s;n<=c;n+=o)t.add(e.normalize?e.normalize(n):n)}return t}function fD(e){if(e.length>lD)throw Error(`cron expression is too long`);let t=e.trim().split(/\s+/).filter(Boolean);if(t.length!==5)throw Error(`cron expression needs 5 fields (minute hour day month weekday), got ${t.length}`);let[n,r,i,a,o]=t;return{minutes:dD({value:n,min:0,max:59,field:`minute`}),hours:dD({value:r,min:0,max:23,field:`hour`}),daysOfMonth:dD({value:i,min:1,max:31,field:`day-of-month`}),months:dD({value:a,min:1,max:12,field:`month`,names:sD}),daysOfWeek:dD({value:o,min:0,max:7,field:`weekday`,names:cD,normalize:e=>e%7}),dayOfMonthRestricted:!i.startsWith(`*`),dayOfWeekRestricted:!o.startsWith(`*`)}}function pD(e){try{return fD(e),!0}catch{return!1}}function mD(e,t,n){return new Date(e.year,e.month-1,e.day,t,n,0,0).getTime()}function hD(e){let t=new Date(e);return{year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()}}function gD(e,t){return hD(new Date(e.year,e.month-1,e.day+t,12,0,0,0).getTime())}function _D(e,t){if(!e.months.has(t.month))return!1;let n=e.daysOfMonth.has(t.day),r=e.daysOfWeek.has(new Date(t.year,t.month-1,t.day).getDay());return e.dayOfMonthRestricted&&e.dayOfWeekRestricted?n||r:n&&r}function vD(e){return e-e%aD}function yD(e,t){return[...e].sort((e,n)=>(e-n)*t)}function bD(e,t){let n=fD(e),r=yD(n.hours,1),i=yD(n.minutes,1),a=new Date(vD(t)+aD),o=hD(a.getTime()),s=a.getHours(),c=a.getMinutes();for(let e=0;e<oD;e++){if(_D(n,o)){for(let e of r)if(!(e<s))for(let n of i){if(e===s&&n<c)continue;let r=mD(o,e,n);if(r>t)return r}}o=gD(o,1),s=0,c=0}throw Error(`cron expression never matches: ${e}`)}var xD=[`minute`,`hour`,`dayOfMonth`,`month`,`dayOfWeek`];function SD(e){let t=e.trim().split(/\s+/).filter(Boolean);return xD.map((e,n)=>t[n]??`*`)}function CD(e){return xD.map((t,n)=>e[n]??`*`).join(` `)}var wD=[`*`,`*/5`,`*/10`,`*/15`,`*/30`,...AD(0,59)],TD=[`*`,`*/2`,`*/3`,`*/4`,`*/6`,`*/12`,...AD(0,23)],ED=[`*`,...AD(1,31)],DD=[`*`,`JAN`,`FEB`,`MAR`,`APR`,`MAY`,`JUN`,`JUL`,`AUG`,`SEP`,`OCT`,`NOV`,`DEC`],OD=[`*`,`MON-FRI`,`SAT,SUN`,`MON`,`TUE`,`WED`,`THU`,`FRI`,`SAT`,`SUN`],kD=[`MON`,`TUE`,`WED`,`THU`,`FRI`,`SAT`,`SUN`];function AD(e,t){let n=[];for(let r=e;r<=t;r++)n.push(String(r));return n}var jD={minute:wD,hour:TD,dayOfMonth:ED,month:DD,dayOfWeek:OD};function MD(e,t,n){let r=jD[e],i=r.indexOf(t.trim().toUpperCase());return i<0?(n>0?r[0]:r[r.length-1])??t:r[(i+n+r.length)%r.length]??t}function ND(e,t){return Math.min(Math.max(e+t,0),xD.length-1)}function PD(e,t,n){let r=SD(e);return t<0||t>=xD.length||(r[t]=n),CD(r)}function FD(e,t){let[n,r,i,a,o]=SD(e);if(a!==`*`||i!==`*`||n===void 0||r===void 0||o===void 0)return null;let s=ID(n,r,t);if(!s)return null;let{at:c,bare:l}=s;if(o===`*`)return l?c:t(`automations.schedule.everyDay`,{at:c});if(o===`MON-FRI`)return t(`automations.schedule.weekdays`,{at:c});if(o===`SAT,SUN`)return t(`automations.schedule.weekends`,{at:c});let u=kD.find(e=>e===o.toUpperCase());return u?t(`automations.schedule.onWeekday`,{weekday:t(`automations.schedule.dow.${u}`),at:c}):null}function ID(e,t,n){return t===`*`?e===`*`?{at:n(`automations.schedule.everyMinute`),bare:!0}:e.startsWith(`*/`)?{at:n(`automations.schedule.everyMinutes`,{n:e.slice(2)}),bare:!0}:/^\d+$/.test(e)?{at:n(`automations.schedule.hourlyAt`,{minute:e.padStart(2,`0`)}),bare:!1}:null:t.startsWith(`*/`)&&e===`0`?{at:n(`automations.schedule.everyHours`,{n:t.slice(2)}),bare:!0}:/^\d+$/.test(t)&&/^\d+$/.test(e)?{at:n(`automations.schedule.atClock`,{time:`${t.padStart(2,`0`)}:${e.padStart(2,`0`)}`}),bare:!1}:null}function LD(e,t,n,r){let i=e.trim();if(!pD(i))return{kind:`invalid`};let a;try{a=bD(i,t)}catch{return{kind:`never`}}return{kind:`ok`,nextRunMs:a,relative:RD(a-t,n),absolute:zD(a,t,n,r)}}function RD(e,t){let{minutes:n,hours:r,days:i}=hT(e);return n<60?t(`automations.when.inMinutes`,{n:Math.max(1,n)}):r<24?t(`automations.when.inHours`,{n:r}):t(`automations.when.inDays`,{n:i})}function zD(e,t,n,r){let i=new Date(e),a=`${String(i.getHours()).padStart(2,`0`)}:${String(i.getMinutes()).padStart(2,`0`)}`,o=new Date(t);if(i.getFullYear()===o.getFullYear()&&i.getMonth()===o.getMonth()&&i.getDate()===o.getDate())return a;let s=e-t<5184e5,c=i.toLocaleDateString(r,s?{weekday:`short`}:{weekday:`short`,month:`short`,day:`numeric`});return s?`${c} ${a}`:n(`automations.when.dateTime`,{date:c,time:a})}var BD={name:``,repo:``,prompt:``,triggerMode:`schedule`,schedule:`0 9 * * MON-FRI`,eventKind:`ci_failed`,eventFilter:``};function VD(e){return e.triggerMode===`event`?`event`:`schedule`}function HD(e,t=``){let n=t.trim();if(!n)return{kind:e};let r;if(e===`ci_failed`||e===`pr_review_requested`)r={branch:n};else if(e===`issue_opened`)r={action:n};else if(e===`webhook`){let e=n.indexOf(`.`);r=e>0&&e<n.length-1?{event:n.slice(0,e),action:n.slice(e+1)}:{event:n}}else r={event:n};return{kind:e,filter:r}}function UD(e){let t=VD(e)===`event`?!!(e.eventKind&&QE.includes(e.eventKind)):pD(e.schedule.trim());return e.name.trim().length>0&&(e.repo===null||e.repo.trim().length>0)&&e.prompt.trim().length>0&&(!e.target||e.target.taskId.trim().length>0&&/^tab-[\w-]+$/.test(e.target.tabId))&&t}function WD(e){return e.name.trim().length===0?`name`:e.repo!==null&&e.repo.trim().length===0?`repo`:e.target&&!e.target.taskId.trim()?`target`:e.target&&!/^tab-[\w-]+$/.test(e.target.tabId)?`targetTab`:e.prompt.trim().length===0?`prompt`:VD(e)===`event`?!e.eventKind||!QE.includes(e.eventKind)?`eventKind`:null:pD(e.schedule.trim())?null:`schedule`}function GD(e,t,n){if(e.script||e.target)return null;let r=e.vendor?t(e.vendor):n;return{full:[r,e.model,e.modelEffort].filter(Boolean).join(` · `),short:e.model??r}}function KD(e,t){let n=e.schedule?t?FD(e.schedule,t)??e.schedule:e.schedule:``,r=nD(e);return n&&r?`${n} + ${r}`:r?`on ${r}`:n}function qD(e,t){if(t===`all`)return!0;let n=$E(e);return t===`schedule`?n===`schedule`||n===`hybrid`:n===`event`||n===`hybrid`}function JD(e){return`/hooks/routines/${e}`}function YD(e,t){let n=t?.trim()??``;return n&&e?.effortLevels?.includes(n)?n:``}function XD(e){let{model:t}=e,[n,r]=(0,h.useState)([]),[i,a]=(0,h.useState)({}),[o,s]=(0,h.useState)(``),[c,l]=(0,h.useState)(``),[u,d]=(0,h.useState)(``),[f,p]=(0,h.useState)(!1),{busy:m,error:g,submit:_}=aa();(0,h.useEffect)(()=>{Promise.all([t.client.request(`engines.list`),e.current()]).then(([e,t])=>{let n=Lg(e.engines,t.engine).filter(e=>e.ready!==!1||e.id===t.engine),i=n.find(e=>e.id===t.engine)??n[0];r(n),a(t),s(i?.id??``),l(YD(i,t.effort)),d(i?.id===t.engine?t.model??``:``),p(!0)})},[t]);let v=n.find(e=>e.id===o),y=v?.effortLevels??[],b=y.length>0?[``,...y]:[],x=(v?.models??[]).map(e=>e.id).filter(e=>e.toLowerCase().includes(u.trim().toLowerCase())&&e!==u.trim()).slice(0,6),S=e=>{s(e);let t=n.find(t=>t.id===e);l(YD(t,e===i.engine?i.effort:void 0)),d(e===i.engine?i.model??``:``)},C=e=>{let t=n.findIndex(e=>e.id===o),r=n[Math.max(0,Math.min(n.length-1,t+e))];r&&S(r.id)},w=e=>{if(b.length===0)return;let t=Math.max(0,b.indexOf(c));l(b[Math.max(0,Math.min(b.length-1,t+e))]??``)},T=e=>{let t=e.target instanceof HTMLInputElement;if(e.key===`ArrowUp`&&!t)C(-1);else if(e.key===`ArrowDown`&&!t)C(1);else if((e.key===`ArrowLeft`||e.key===`h`)&&!t)w(-1);else if((e.key===`ArrowRight`||e.key===`l`)&&!t)w(1);else return;e.preventDefault()},E=()=>_(async()=>{if(!v)return;let t=y.length>0?c:void 0,n=v.acceptsModel?u.trim():void 0;(v.id!==i.engine||t!==void 0&&t!==(i.effort??``)||n!==void 0&&n!==(i.model??``))&&await e.onSet({engine:v,...t===void 0?{}:{effort:t},...n===void 0?{}:{model:n}})});return(0,U.jsx)(ia,{title:K(`tasks`,`changeEngine.title`),wide:!0,children:(0,U.jsxs)(`form`,{className:hi,onKeyDown:T,onSubmit:e=>{e.preventDefault(),E()},children:[(0,U.jsx)(`ul`,{className:ci,"aria-label":K(`tasks`,`changeEngine.title`),children:n.map(e=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(`button`,{type:`button`,"aria-pressed":e.id===o,className:Xi({selected:e.id===o}),onClick:()=>S(e.id),children:[(0,U.jsx)(`span`,{className:`${ea} text-accent`,children:e.id===o?`●`:` `}),(0,U.jsx)(`span`,{className:Zi,children:e.name}),e.id===i.engine&&(0,U.jsx)(`span`,{className:`text-muted`,children:K(`tasks`,`changeEngine.current`)})]})},e.id))}),f&&v&&v.acceptsModel&&(0,U.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(`span`,{className:`font-sans text-meta font-normal normal-nums text-muted`,children:K(`tasks`,`engineModel.label`)}),(0,U.jsx)(`input`,{className:Zr,spellCheck:!1,placeholder:K(`tasks`,`engineModel.placeholder`),value:u,onChange:e=>d(e.target.value)}),x.length>0&&(0,U.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:x.map(e=>(0,U.jsx)(`button`,{type:`button`,className:si(),onClick:()=>d(e),children:e},e))})]}),b.length>0&&(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(`span`,{className:`font-sans text-meta font-normal normal-nums text-muted`,children:K(`tasks`,`changeEngine.effortLabel`)}),(0,U.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:b.map(e=>(0,U.jsx)(`button`,{type:`button`,"aria-pressed":e===c,className:si(e===c),onClick:()=>l(e),children:e===``?K(`tasks`,`changeEngine.noEffort`):e},e||`default`))})]}),(0,U.jsx)(`p`,{className:`keys-only ${Hr}`,children:(0,U.jsx)(ju,{text:[K(`tasks`,`changeEngine.footer.engine`),...v?.acceptsModel?[K(`tasks`,`changeEngine.footer.model`)]:[],...b.length>0?[K(`tasks`,`changeEngine.footer.effort`)]:[],K(`tasks`,`changeEngine.footer.set`),K(`tasks`,`changeEngine.footer.cancel`)].join(` · `)})}),g&&(0,U.jsx)(`p`,{className:`text-error`,children:g}),(0,U.jsx)(la,{busy:m||!f,submitLabel:V(`taskops.set`)})]})})}var ZD=`flex flex-col overflow-hidden @container`,QD=`mt-2.5 grid min-h-0 flex-1 grid-cols-[minmax(260px,2fr)_minmax(0,3fr)] gap-4 rt-narrow:flex rt-narrow:flex-col rt-narrow:overflow-y-auto`,$D=`flex min-h-0 flex-col gap-3 overflow-y-auto scrollbar-none rt-narrow:shrink-0 rt-narrow:overflow-visible`,eO=`flex gap-1.5 px-2 pt-0 pb-1`,tO=e=>`flex min-w-0 cursor-pointer flex-col gap-0.5 rounded-sm px-2 py-1.5 select-none ${e?`bg-menu`:`hover:bg-hover`}`,nO=`flex min-w-0 items-baseline gap-2.5`,rO=e=>`min-w-0 flex-1 truncate font-bold ${e?`text-muted`:``}`,iO=`whitespace-nowrap text-meta`,aO=`truncate text-meta`,oO=`flex min-h-0 flex-col gap-1.5 overflow-y-auto py-0 pr-0 pl-4 [border-left:var(--hairline)_solid_var(--line)] [&_h2]:m-0 [&_p]:m-0 [&>*]:shrink-0 [&>h2]:mt-2.5 rt-narrow:shrink-0 rt-narrow:overflow-visible rt-narrow:pt-3 rt-narrow:pl-0 rt-narrow:[border-left:none] rt-narrow:[border-top:var(--hairline)_solid_var(--line)]`,sO=`flex flex-wrap items-baseline justify-between gap-3`,cO=`font-sans text-display font-bold normal-nums wrap-anywhere`,lO=`mx-0 mt-1 mb-0 grid grid-cols-[max-content_minmax(0,1fr)] items-baseline gap-x-3.5 gap-y-1 [&_dd]:m-0 [&_dd]:wrap-anywhere [&_dd_.mono]:whitespace-pre`,uO=`max-h-[12lh] overflow-y-auto rounded-sm bg-inset px-2.5 py-2 whitespace-pre-wrap wrap-anywhere`,dO=`min-w-0 text-meta leading-[inherit]`,fO=`flex w-full min-w-0 gap-2 text-inherit`,pO=fO,mO=`${fO} cursor-pointer border-none bg-transparent p-0 text-left font-[inherit] hover:underline`,hO=`min-w-0 flex-1 truncate`,gO=`[&+&]:mt-1.5`,_O=e=>`whitespace-pre-wrap wrap-anywhere text-meta ${e?``:`leading-[inherit]`}`,vO=`text-meta`,yO=`flex gap-4.5`,bO=e=>`flex min-w-[5ch] flex-col gap-0.5 rounded-sm border-hairline px-1.5 py-1 text-left font-mono text-body normal-nums [&>span]:text-meta [&>span]:text-subtle ${e?`border-accent font-bold text-accent`:`border-transparent font-normal`}`,xO=`hidden gap-2 px-1 pt-0.5 pb-1.5 touch:flex`,SO=`h-8 w-11 touch-manipulation rounded-sm border-hairline border-line bg-inset font-mono text-display font-normal normal-nums text-ink`;function CO(e){let t=e.client,[n,r]=(0,h.useState)(()=>J(t,`pendingStart.list`)?.starts??[]);if((0,h.useEffect)(()=>{let e=!0;return ss(t,`pendingStart.list`).then(t=>e&&r(t.starts)).catch(()=>void 0),()=>{e=!1}},[t,e.tick]),n.length===0)return null;let i=n.map(e=>e.repo),a=async n=>{try{await t.request(`pendingStart.cancel`,{id:n.id}),r(e=>e.filter(e=>e.id!==n.id)),e.reload()}catch(e){z(Z(V(`pages.laterCancelFailed`),{error:vS(e)}),`error`)}};return(0,U.jsxs)(`section`,{"data-field":`later`,className:`mt-2.5`,children:[(0,U.jsx)(`h2`,{className:`${qr} ${eO} text-muted`,children:V(`pages.laterStarts`)}),n.map(e=>(0,U.jsxs)(`div`,{className:tO(!1),children:[(0,U.jsxs)(`span`,{className:nO,children:[(0,U.jsx)(`span`,{className:rO(!1),children:e.title}),(0,U.jsx)(`span`,{className:`mono text-muted ${iO}`,title:new Date(e.at).toLocaleString(),children:Rv(new Date(e.at))}),(0,U.jsx)(W,{className:`font-mono`,hit:`tight`,onClick:()=>void a(e),children:V(`pages.laterCancel`)})]}),(0,U.jsx)(`span`,{className:`mono text-muted ${aO}`,children:bS(e.repo,i)}),e.error&&(0,U.jsx)(`span`,{className:`mono text-warning truncate text-meta`,title:e.error,children:Z(V(`pages.laterFailed`),{error:e.error})})]},e.id))]})}function wO({label:e,value:t,picks:n,onPick:r}){return(0,U.jsx)(`fieldset`,{"aria-label":e,className:`m-0 inline-flex min-w-0 flex-wrap gap-0.5 rounded-sm border-hairline border-line bg-inset p-0.5`,children:n.map(e=>{let n=e.value===t;return(0,U.jsx)(`button`,{type:`button`,"aria-pressed":n,className:Kt(`rounded-xs px-2.5 py-1 font-sans text-meta whitespace-nowrap touch:min-h-9`,`focus-visible:outline-1 focus-visible:outline-offset-1 focus-visible:outline-focus`,n?`bg-menu text-ink`:`text-muted hover:bg-hover`),onClick:()=>!n&&r(e.value),children:e.label},e.value)})})}function TO(e){let{auto:t,common:n}=gS(),r=_S(),i=H()===`zh`?`zh-CN`:`en-US`,[a,o]=(0,h.useState)(()=>({...BD,repo:e.repos.find(t=>e.defaultRepo&&yS(t)===yS(e.defaultRepo))??e.repos[0]??null})),[s,c]=(0,h.useState)(0),[l,u]=(0,h.useState)(null),d=(0,h.useRef)({}),f=e=>t=>{d.current[e]=t};(0,h.useEffect)(()=>d.current.name?.focus(),[]);let p=e=>{o(t=>({...t,...e})),u(null)};(0,h.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopImmediatePropagation(),B())};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},[]);let m=VD(a),g=a.eventKind??`ci_failed`,_=e=>{let t=QE[(QE.indexOf(g)+e+QE.length)%QE.length];t&&p({eventKind:t})},v=()=>{if(UD(a)){B(),e.onSubmit({name:a.name.trim(),repo:a.repo===null?null:a.repo.trim(),prompt:a.prompt.trim(),triggerMode:m,schedule:a.schedule.trim(),eventKind:g,eventFilter:(a.eventFilter??``).trim(),...a.target?{target:a.target}:{}});return}let n=WD(a);n&&(d.current[n]?.focus(),u(Reflect.get(t.missing,n)))},y=a.repo===null?[]:e.tasks.filter(e=>yS(e.repo)===yS(a.repo??``)),b=a.target?y.findIndex(e=>e.id===a.target?.taskId)+1:0,x=e=>{let t=(b+e+y.length+1)%(y.length+1),n=y[t-1];p({target:n?{kind:`existing-tab`,taskId:n.id,tabId:`tab-1`}:void 0})},S=[null,...e.repos],C=e=>{let t=Math.min(Math.max(S.indexOf(a.repo)+e,0),S.length-1),n=S[t];n!==void 0&&p({repo:n,target:void 0})},w=e=>t=>{(t.key===`ArrowUp`||t.key===`ArrowDown`)&&(t.preventDefault(),e(t.key===`ArrowDown`?1:-1))},T=e=>t=>{t.key===`Enter`&&(t.preventDefault(),d.current[e]?.focus())},E=SD(a.schedule),D=e=>{let t=xD[s];t&&p({schedule:PD(a.schedule,s,MD(t,E[s]??`*`,e))})},O=e=>{if(!(e.ctrlKey||e.metaKey||e.altKey)){if(e.key===`ArrowLeft`||e.key===`h`)c(ND(s,-1));else if(e.key===`ArrowRight`||e.key===`l`)c(ND(s,1));else if(e.key===`ArrowUp`||e.key===`ArrowDown`)D(e.key===`ArrowUp`?1:-1);else return;e.preventDefault()}},k=LD(a.schedule,Date.now(),r,i),A=FD(a.schedule,r);return(0,U.jsx)(`div`,{className:ui,onMouseDown:e=>e.target===e.currentTarget&&B(),children:(0,U.jsxs)(`dialog`,{open:!0,className:`${di(!0)} ${oE}`,"aria-label":t.newTitle,children:[(0,U.jsx)(`h1`,{className:`${qr} text-muted`,children:t.newTitle}),(0,U.jsxs)(`div`,{className:hi,children:[(0,U.jsxs)(`label`,{className:ri,children:[(0,U.jsx)(`span`,{className:`${ii}`,children:t.fieldName}),(0,U.jsx)(`input`,{ref:f(`name`),className:Zr,spellCheck:!1,placeholder:t.namePlaceholder,value:a.name,onChange:e=>p({name:e.target.value}),onKeyDown:T(`repo`)})]}),(0,U.jsxs)(`div`,{className:ri,children:[(0,U.jsxs)(`span`,{className:`${ii} ${cE}`,children:[t.fieldRepo,(0,U.jsx)(`span`,{className:`keys-only text-muted ${lE}`,children:`↑/↓`})]}),(0,U.jsx)(yE,{fieldRef:f(`repo`),kind:`list`,label:t.fieldRepo,className:dE,onKeyDown:w(C),children:S.map(t=>(0,U.jsxs)(`button`,{type:`button`,tabIndex:-1,"aria-selected":t===a.repo,className:`touch:py-1.5 ${fE(t===a.repo)}`,onClick:()=>{p({repo:t,target:void 0}),d.current.repo?.focus()},children:[t===a.repo?`▸ `:` `,t===null?V(`rail.noProject`):bS(t,e.repos)]},t??``))})]}),(0,U.jsxs)(`div`,{className:ri,children:[(0,U.jsxs)(`span`,{className:`${ii} ${cE}`,children:[t.fieldTarget,(0,U.jsx)(`span`,{className:`keys-only text-muted ${lE}`,children:`↑/↓`})]}),(0,U.jsx)(yE,{fieldRef:f(`target`),kind:`list`,label:t.fieldTarget,onKeyDown:w(x),onClick:()=>x(1),children:a.target?y[b-1]?.title??a.target.taskId:t.targetFresh})]}),a.target&&(0,U.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(`span`,{className:`font-sans text-meta font-normal normal-nums text-muted`,children:t.fieldTargetTab}),(0,U.jsx)(`input`,{ref:f(`targetTab`),className:Zr,spellCheck:!1,value:a.target.tabId,onChange:e=>a.target&&p({target:{...a.target,tabId:e.target.value}}),onKeyDown:T(`prompt`)})]}),(0,U.jsxs)(`label`,{className:ri,children:[(0,U.jsx)(`span`,{className:`${ii}`,children:t.fieldPrompt}),(0,U.jsx)(`input`,{ref:f(`prompt`),className:Zr,spellCheck:!1,placeholder:t.promptPlaceholder,value:a.prompt,onChange:e=>p({prompt:e.target.value}),onKeyDown:T(m===`event`?`eventKind`:`schedule`)})]}),(0,U.jsxs)(`div`,{className:ri,children:[(0,U.jsx)(`span`,{className:`${ii}`,children:t.fieldTrigger}),(0,U.jsx)(wO,{label:t.fieldTrigger,value:m,picks:[{value:`schedule`,label:t.triggerSchedule},{value:`event`,label:t.triggerEvent}],onPick:e=>p({triggerMode:e})})]}),m===`schedule`?(0,U.jsxs)(`div`,{className:ri,children:[(0,U.jsxs)(`span`,{className:`${ii} ${cE}`,children:[t.fieldSchedule,(0,U.jsx)(`span`,{className:`keys-only text-muted ${lE}`,children:`←/→ ↑/↓`})]}),(0,U.jsx)(yE,{fieldRef:f(`schedule`),kind:`cells`,label:t.fieldSchedule,className:yO,onKeyDown:O,children:xD.map((e,n)=>(0,U.jsxs)(`button`,{type:`button`,tabIndex:-1,className:bO(n===s),onClick:()=>{c(n),d.current.schedule?.focus()},children:[E[n]??`*`,(0,U.jsx)(`span`,{children:t.cronField[e]})]},e))}),(0,U.jsx)(`div`,{className:xO,children:[-1,1].map(e=>{let n=t.cronField[xD[s]??`minute`]??``;return(0,U.jsx)(`button`,{type:`button`,tabIndex:-1,className:SO,"aria-label":V(e<0?`pages.cronDown`:`pages.cronUp`,{field:n}),onClick:()=>{D(e),d.current.schedule?.focus()},children:e<0?`−`:`+`},e)})}),k.kind===`ok`?(0,U.jsxs)(`p`,{className:`mono text-success`,children:[A?`${A}, `:``,k.relative,`, `,k.absolute]}):(0,U.jsx)(`p`,{className:`mono text-error`,children:k.kind===`never`?t.cronNever:t.cronInvalid})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:ri,children:[(0,U.jsxs)(`span`,{className:`${ii} ${cE}`,children:[t.fieldEventKind,(0,U.jsx)(`span`,{className:`keys-only text-muted ${lE}`,children:`↑/↓`})]}),(0,U.jsx)(yE,{fieldRef:f(`eventKind`),kind:`list`,label:t.fieldEventKind,onKeyDown:w(_),onClick:()=>_(1),children:t.eventKind[g]})]}),(0,U.jsxs)(`label`,{className:ri,children:[(0,U.jsx)(`span`,{className:`${ii}`,children:t.fieldEventFilter}),(0,U.jsx)(`input`,{ref:f(`eventFilter`),className:Zr,spellCheck:!1,placeholder:t.eventFilterPlaceholder[g],value:a.eventFilter??``,onChange:e=>p({eventFilter:e.target.value}),onKeyDown:T(`confirm`)})]})]}),l&&(0,U.jsxs)(`p`,{className:`text-error`,children:[`※ `,l]}),(0,U.jsx)(`p`,{className:`touch:empty:hidden! text-muted ${pE}`,children:(0,U.jsx)(ju,{text:hf(t.composerLegend)})}),(0,U.jsxs)(`div`,{className:Qr,children:[(0,U.jsx)(`button`,{type:`button`,className:Jr,onClick:B,children:n.cancel}),(0,U.jsx)(`button`,{ref:f(`confirm`),type:`button`,className:Rr(),onClick:v,children:n.create})]})]})]})})}var EO=[`ok`,`blocked`,`failed`,`skipped`];function DO(e){switch(e.status){case`dispatched`:case`revived`:case`ran`:return`ok`;case`skipped_blocked`:return`blocked`;case`dispatch_failed`:case`skipped_unavailable`:case`script_failed`:return`failed`;default:return`skipped`}}var OO={scheduled:`schedule`,manual:`manual`,webhook:`webhook`,event:`event`};function kO(e){if(e.status===`skipped_precheck`)return e.precheckResult?.durationMs??null;if(e.status===`ran`||e.status===`script_failed`)return null;let t=Date.parse(e.at),n=Date.parse(e.response?.at??``);return Number.isFinite(t)&&Number.isFinite(n)&&n>=t?n-t:null}function AO(e){if(e<1e3)return`${Math.max(0,Math.round(e))}ms`;let t=Math.round(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m`;let r=Math.floor(n/60);return n%60==0?`${r}h`:`${r}h ${n%60}m`}function jO(e,t){return e.filter(e=>t===null||DO(e)===t).sort((e,t)=>Date.parse(t.at)-Date.parse(e.at)||t.runNumber-e.runNumber)}function MO(e){let t=e.indexOf(`{`),n=e.lastIndexOf(`}`);if(t<0||n<=t)return null;try{return{prefix:e.slice(0,t).trim(),value:JSON.parse(e.slice(t,n+1))}}catch{return null}}var NO=(e,t)=>e&&typeof e==`object`?Reflect.get(e,t):void 0;function PO(e){let t=MO(e);if(!t)return{summary:e,full:e};let n=NO(t.value,`error`)??t.value,r=NO(n,`message`),i=NO(n,`code`),a=typeof r==`string`?typeof i==`string`?`${i}: ${r}`:r:null,o=t.prefix.replace(/:$/,``);return{summary:a?`${o} — ${a}`:e,full:`${t.prefix}\n${JSON.stringify(t.value,null,2)}`}}function FO(e){let t=e.trim();if(!/^[[{]/.test(t))return e;try{return JSON.stringify(JSON.parse(t),null,2)}catch{return e}}var IO={dispatched:`success`,revived:`success`,skipped_precheck:`muted`,skipped_blocked:`warning`,skipped_cancelled:`muted`,skipped_missed:`warning`,skipped_unavailable:`warning`,dispatch_failed:`error`,ran:`success`,script_failed:`error`},LO={success:`text-success`,muted:`text-muted`,warning:`text-warning`,error:`text-error`},RO={success:`✓`,error:`†`,warning:`!`,muted:`·`},zO=e=>IO[e]??`muted`;function BO(e){let{auto:t}=gS(),{runs:n,when:r}=e,i=e=>t.runStatus[e]??e,a=n.filter(e=>e.response);return(0,U.jsxs)(U.Fragment,{children:[n[0]?.precheckResult&&(0,U.jsx)(VO,{run:n[0]}),(0,U.jsx)(`h2`,{className:`${qr} text-muted`,children:t.responses}),a.length===0?(0,U.jsx)(`p`,{className:`text-muted`,children:t.noResponses}):a.map(e=>(0,U.jsxs)(`div`,{className:gO,children:[(0,U.jsx)(`p`,{className:`mono ${vO} ${LO[zO(e.status)]}`,children:`#${e.runNumber} ${i(e.status)}, ${r(e.response?.at)}`}),(0,U.jsx)(`p`,{className:_O(!1),children:FO(e.response?.text??``)})]},e.id))]})}function VO({run:e}){let{auto:t}=gS(),n=e.precheckResult;if(!n)return null;let r=n.timedOut?t.precheckTimedOut:Z(t.precheckExited,{code:String(n.exitCode??`?`)}),i=[{label:t.precheckStdout,text:n.stdout},{label:t.precheckStderr,text:n.stderr}].filter(e=>e.text.trim().length>0);return(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h2`,{className:`${qr} text-muted`,children:Z(t.precheckDetail,{exit:r,duration:String(n.durationMs)})}),i.length===0?(0,U.jsx)(`p`,{className:`text-muted`,children:t.precheckNoOutput}):i.map(e=>(0,U.jsx)(`p`,{className:`mono ${_O(!0)}`,children:`${e.label}: ${e.text.replace(/\s+$/,``).split(`
53
53
  `).slice(-10).join(`
54
- `)}`},e.label))]})}var HO=30;function UO(e,t,n){let r=t.join(`\0`),[i,a]=(0,h.useState)(()=>Object.fromEntries(t.map(t=>[t,J(e,`routine.runs`,{id:t})?.runs??[]])));return(0,h.useEffect)(()=>{let n=!0;for(let r of t)ss(e,`routine.runs`,{id:r}).then(e=>n&&a(t=>({...t,[r]:e.runs}))).catch(()=>void 0);return()=>{n=!1}},[e,r,n]),i}function WO(){H();let{auto:e}=gS();return t=>{if(t.status===`skipped_blocked`){let e=t.blocked?.reason;return e?Z(V(`runLog.blockedRun`),{reason:V(`runLog.blocked.${e}`)}):V(`runLog.outcome.blocked`)}return e.runStatus[t.status]??t.status}}function GO(e){H();let{auto:t}=gS(),[n,r]=(0,h.useState)(null),i=jO(e.runs,n),a=WO(),o=(e,t,n,r)=>(0,U.jsx)(W,{variant:`pill`,hit:`tight`,"aria-current":t,className:`max-w-40 truncate`,onClick:n,children:`[ ${e} ]`},r);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`h2`,{className:`${qr} text-muted`,children:V(`runLog.title`)}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1`,children:[o(V(`runLog.all`),n===null,()=>r(null),`all`),EO.map(e=>o(V(`runLog.outcome.${e}`),n===e,()=>r(e),e))]}),i.length===0?(0,U.jsx)(`p`,{className:`text-muted`,children:e.runs.length===0?t.noRuns:V(`runLog.empty`)}):i.slice(0,HO).map(n=>{let r=zO(n.status),i=iD(n,e.now),o=i===`awaiting`?`, ${t.responseAwaiting}`:i===`missing`?`, ${t.responseMissing}`:``,s=kO(n),c=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{children:RO[r]}),(0,U.jsx)(`span`,{children:`#${n.runNumber}`}),(0,U.jsx)(`span`,{className:hO,title:n.event,children:`${a(n)}${n.tabId?`, ${n.tabId}`:``}${n.event?` · ${n.event}`:``}${o}`}),(0,U.jsx)(`span`,{className:`text-subtle`,children:V(`runLog.source.${OO[n.trigger]}`)}),s!==null&&(0,U.jsx)(`span`,{className:`text-muted`,children:AO(s)}),(0,U.jsx)(`span`,{className:`text-muted`,children:e.when(n.at)})]}),l=n.error?PO(n.error):null,u=n.taskId,d=i===`missing`?`text-warning`:LO[r];return(0,U.jsxs)(`div`,{className:`${dO} ${d}`,children:[u?(0,U.jsx)(`button`,{type:`button`,className:`mono ${mO}`,onClick:()=>e.openRun(u),children:c}):(0,U.jsx)(`span`,{className:`mono ${pO}`,children:c}),l&&(0,U.jsxs)(`details`,{className:`mono pl-[calc(2ch+16px)] [&_summary]:cursor-pointer [&_summary]:list-none [&_summary]:truncate [&_summary::-webkit-details-marker]:hidden [&[open]_summary]:whitespace-normal [&_pre]:mx-0 [&_pre]:mt-1 [&_pre]:mb-1.5 [&_pre]:max-h-[16lh] [&_pre]:overflow-auto [&_pre]:rounded-sm [&_pre]:bg-inset [&_pre]:px-2 [&_pre]:py-1.5 [&_pre]:whitespace-pre-wrap [&_pre]:wrap-anywhere [&_pre]:text-muted`,children:[(0,U.jsx)(`summary`,{children:l.summary}),(0,U.jsx)(`pre`,{children:l.full})]})]},n.id)}),i.length>HO&&(0,U.jsx)(`p`,{className:`text-muted`,children:V(`runLog.more`,{count:i.length-HO})})]})}function KO(e){let{auto:t}=gS(),n=_S(),r=H()===`zh`?`zh-CN`:`en-US`,{routine:i,busy:a,when:o}=e,s=$E(i),c=i.schedule?FD(i.schedule,n):null,l=i.nextRunAt?Date.parse(i.nextRunAt):NaN,u=nD(i),d=s===`hybrid`?t.triggerHybrid:s===`event`?t.triggerEvent:t.triggerSchedule;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:sO,children:[(0,U.jsx)(`h2`,{className:cO,children:i.name}),(0,U.jsxs)(`span`,{className:`mono ${Jw}`,children:[(0,U.jsx)(`button`,{type:`button`,className:`${Jr} ${Yw.row}`,disabled:a,onClick:e.onRunNow,children:t.runNow}),(0,U.jsx)(`button`,{type:`button`,className:`${Jr} ${Yw.row}`,disabled:a,onClick:e.onToggle,children:V(i.enabled?`pages.routinePause`:`pages.routineEnable`)}),(0,U.jsx)(`button`,{type:`button`,className:`${Jr} ${Yw.row}`,disabled:a,onClick:e.onDelete,children:V(`pages.delete`)})]})]}),(0,U.jsxs)(`dl`,{className:lO,children:[(0,U.jsx)(`dt`,{className:`text-muted`,children:V(`pages.routineTrigger`)}),(0,U.jsx)(`dd`,{children:d}),i.schedule&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`dt`,{className:`text-muted`,children:V(`pages.routineSchedule`)}),(0,U.jsxs)(`dd`,{children:[c??(0,U.jsx)(`span`,{className:`mono`,children:i.schedule}),c&&(0,U.jsx)(`span`,{className:`mono text-muted`,children:` ${i.schedule}`})]}),(0,U.jsx)(`dt`,{className:`text-muted`,children:V(`pages.routineNext`)}),(0,U.jsx)(`dd`,{className:i.enabled?``:`text-warning`,children:i.enabled?Number.isFinite(l)?`${o(i.nextRunAt)} · ${new Date(l).toLocaleString(r,{weekday:`short`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}`:`—`:t.paused})]}),u&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`dt`,{className:`text-muted`,children:V(`pages.routineEvents`)}),(0,U.jsx)(`dd`,{className:`mono`,children:u})]}),i.webhook&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`dt`,{className:`text-muted`,children:V(`pages.routineWebhook`)}),(0,U.jsx)(`dd`,{className:`mono`,children:JD(i.id)})]}),(0,U.jsx)(`dt`,{className:`text-muted`,children:V(`pages.routineProject`)}),(0,U.jsx)(`dd`,{children:e.project}),!i.script&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`dt`,{className:`text-muted`,children:V(`pages.routineDelivers`)}),(0,U.jsx)(`dd`,{children:i.target?Z(t.targetExisting,{task:e.targetTitle??i.target.taskId,tab:i.target.tabId}):i.persistentSession?i.newConversation?t.targetStandingNew:t.targetStanding:t.targetFresh})]}),e.engine&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`dt`,{className:`text-muted`,children:V(`pages.routineEngine`)}),(0,U.jsxs)(`dd`,{className:`flex flex-wrap items-baseline gap-x-3.5`,children:[(0,U.jsx)(`span`,{children:e.engine}),(0,U.jsx)(W,{className:`font-mono`,hit:`tight`,disabled:a,onClick:e.onChangeEngine,children:V(`pages.routineChangeEngine`)})]})]})]}),i.precheck&&(0,U.jsx)(`p`,{className:`mono text-muted`,children:Z(t.precheck,{command:i.precheck.command})}),i.script?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`h2`,{className:`${qr} text-muted`,children:V(`pages.routineScript`)}),(0,U.jsx)(`p`,{className:`mono ${uO}`,children:i.script.command})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`h2`,{className:`${qr} text-muted`,children:V(`pages.routinePrompt`)}),(0,U.jsx)(`p`,{className:uO,children:i.prompt})]}),(0,U.jsx)(GO,{runs:e.runs,now:e.now,when:o,openRun:e.openRun}),(0,U.jsx)(BO,{runs:e.runs,when:o})]})}function qO(e,t){let n=e?.lastRunStatus?.[t];return n!==void 0&&rD(n)}function JO(e,t){return e===`dispatch_failed`||e===`script_failed`?`error`:e!==void 0&&rD(e)?`waiting`:!t||e===void 0||e.startsWith(`skipped_`)?`idle`:`done`}function YO(e,t){return n=>{let r=n?Date.parse(n):NaN;if(!Number.isFinite(r))return`—`;let i=r-t,a=i>=0,o=Math.floor(Math.abs(i)/6e4),s=Math.floor(o/60);return o<1?a?e.now:e.justNow:o<60?Z(a?e.inMinutes:e.minutesAgo,{n:o}):s<24?Z(a?e.inHours:e.hoursAgo,{n:s}):new Date(r).toLocaleDateString()}}function XO(){return(0,U.jsx)(`svg`,{viewBox:`0 0 16 16`,className:`block size-4.5 flex-none translate-y-px fill-none stroke-current text-muted [stroke-linecap:round] [stroke-linejoin:round] [stroke-width:1.3]`,"aria-hidden":`true`,children:(0,U.jsx)(`path`,{d:`M3 3.5h10a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1v-7a1 1 0 0 1 1-1zM4.5 6.5 6.5 8l-2 1.5M8 10h3`})})}var ZO=`relative flex min-h-15 w-full items-center gap-3 rounded-sm px-3 py-2 text-left active:not-has-[[data-pr-chip]:active]:bg-hover focus-visible:bg-hover focus-visible:outline-none [&>svg]:translate-y-0`,QO=`pointer-events-none absolute inset-0 rounded-[inherit] bg-hover animate-[fade-out_560ms_ease-in_forwards] motion-reduce:hidden`,$O=`flex min-w-0 items-center gap-1.5 font-mono text-[13px] leading-[1.3] text-muted empty:hidden`;function ek(e){let{lead:t,mark:n,title:r,dim:i,flash:a,line2:o,trail:s,status:c,...l}=e;return(0,U.jsxs)(`button`,{type:`button`,className:`${ZO} hover:bg-hover data-menu-open:bg-hover`,"data-phone-row":!0,...l,children:[!!a&&(0,U.jsx)(`span`,{className:QO,"aria-hidden":`true`,"data-row-flash":!0},a),t,n,(0,U.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,U.jsx)(`span`,{className:`row-title truncate font-sans text-title ${i?`text-muted`:`text-ink`}`,children:r}),(0,U.jsx)(`span`,{className:$O,children:o})]}),s,c]})}var tk=`flex min-h-11 min-w-0 flex-1 cursor-pointer items-center gap-1.5 border-none bg-transparent p-0 text-left text-inherit [font:inherit] hover:text-ink`;function nk(e){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`button`,{type:`button`,className:tk,"aria-expanded":!e.collapsed,"aria-label":e.foldLabel,onClick:e.onToggle,children:[(0,U.jsx)(`span`,{className:`truncate tracking-[0.06em] uppercase`,children:e.label}),e.collapsed&&(0,U.jsx)(Bv,{right:!0})]}),e.add&&(0,U.jsx)(`button`,{type:`button`,className:`-mr-2 grid size-11 flex-none cursor-pointer place-items-center border-none bg-transparent font-sans text-display text-muted hover:text-ink active:text-ink`,"aria-label":e.add.label,"data-group-add":!0,onClick:e.add.onClick,children:`+`})]})}var rk=`M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2`;function ik(e){return(0,U.jsxs)(zi,{size:`nav`,kind:`routines`,label:e.label,onClick:e.onClick,children:[(0,U.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:`size-5.5 fill-none stroke-current [stroke-linecap:round] [stroke-linejoin:round] [stroke-width:1.6]`,"aria-hidden":`true`,children:[(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,U.jsx)(`path`,{d:`M12 6v6l4 2`})]}),e.count>0&&(0,U.jsx)(Wi,{count:e.count})]})}function ak(e){return(0,U.jsx)(zi,{size:`nav`,kind:`extensions`,label:e.label,onClick:e.onClick,children:(0,U.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:`size-5.5 fill-none stroke-current [stroke-linecap:round] [stroke-linejoin:round] [stroke-width:1.6]`,"aria-hidden":`true`,children:[(0,U.jsx)(`path`,{d:rk}),(0,U.jsx)(`rect`,{x:`14`,y:`2`,width:`8`,height:`8`,rx:`1`})]})})}var ok=20,sk=`m-0 px-3 py-2.5 text-body whitespace-pre-wrap wrap-anywhere text-ink`;function ck(e){let{auto:t}=gS(),n=_S(),r=H()===`zh`?`zh-CN`:`en-US`,i=WO(),[a,o]=(0,h.useState)(`all`),[s,c]=(0,h.useState)(!1),{routine:l,runs:u,busy:d,when:f}=e,p=$E(l),m=nD(l),g=p===`hybrid`?t.triggerHybrid:p===`event`?t.triggerEvent:t.triggerSchedule,_=l.nextRunAt?Date.parse(l.nextRunAt):NaN,v=jO(u,a===`all`?null:a),y=jO(u,null)[0],b=u.filter(e=>e.response);return(0,U.jsx)(vu,{label:l.name,title:l.name,onClose:e.onClose,children:()=>(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`${du} gap-4 pt-1 pb-3`,"data-routine-sheet":!0,children:[(0,U.jsxs)(Fl,{inset:!0,children:[(0,U.jsx)(Y,{label:V(`pages.routineTrigger`),children:g}),l.schedule&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Y,{label:V(`pages.routineSchedule`),children:FD(l.schedule,n)??(0,U.jsx)(`span`,{className:`font-mono`,children:l.schedule})}),(0,U.jsx)(Y,{label:V(`pages.routineNext`),children:l.enabled?Number.isFinite(_)?`${f(l.nextRunAt)} · ${new Date(_).toLocaleString(r,{weekday:`short`,hour:`2-digit`,minute:`2-digit`})}`:`—`:t.paused})]}),m&&(0,U.jsx)(Y,{label:V(`pages.routineEvents`),children:(0,U.jsx)(`span`,{className:`font-mono`,children:m})}),l.webhook&&(0,U.jsx)(Y,{label:V(`pages.routineWebhook`),children:(0,U.jsx)(`span`,{className:`font-mono`,children:JD(l.id)})}),e.engine&&(0,U.jsx)(Y,{label:V(`pages.routineEngine`),children:e.engine}),(0,U.jsx)(Y,{label:V(`pages.routineProject`),children:e.project}),!l.script&&(0,U.jsx)(Y,{label:V(`pages.routineDelivers`),children:l.target?Z(t.targetExisting,{task:e.targetTitle??l.target.taskId,tab:l.target.tabId}):l.persistentSession?l.newConversation?t.targetStandingNew:t.targetStanding:t.targetFresh}),(0,U.jsx)(Y,{label:V(`pages.phone.lastRun`),children:y?`${i(y)} · ${f(y.at)}`:t.noRuns})]}),(0,U.jsxs)(Fl,{inset:!0,label:V(l.script?`pages.phone.script`:`pages.phone.prompt`),children:[(0,U.jsx)(`p`,{className:`${sk} ${l.script?`font-mono`:`font-sans`}`,children:l.script?l.script.command:l.prompt}),l.precheck&&(0,U.jsx)(Y,{label:V(`pages.phone.precheck`),children:(0,U.jsx)(`span`,{className:`font-mono`,children:l.precheck.command})})]}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,U.jsx)(`p`,{className:`m-0 px-3 font-mono text-meta text-subtle`,children:V(`runLog.title`)}),(0,U.jsx)(wO,{label:V(`runLog.title`),value:a,picks:[{value:`all`,label:V(`runLog.all`)},...EO.map(e=>({value:e,label:V(`runLog.outcome.${e}`)}))],onPick:o}),v.length===0?(0,U.jsx)(`p`,{className:`m-0 px-3 font-sans text-body text-muted`,children:u.length===0?t.noRuns:V(`runLog.empty`)}):(0,U.jsx)(Fl,{inset:!0,children:v.slice(0,ok).map(t=>(0,U.jsx)(lk,{run:t,status:i(t),now:e.now,when:f,open:e.openRun},t.id))}),v.length>ok&&(0,U.jsx)(`p`,{className:`m-0 px-3 font-sans text-meta text-muted`,children:V(`runLog.more`,{count:v.length-ok})})]}),(0,U.jsx)(Fl,{inset:!0,label:V(`pages.phone.responses`),children:b.length===0?(0,U.jsx)(`p`,{className:`${sk} font-sans text-muted`,children:V(`pages.phone.noResponses`)}):b.map(e=>(0,U.jsxs)(`div`,{className:`flex flex-col gap-1 px-3 py-2.5`,children:[(0,U.jsx)(`span`,{className:`font-mono text-meta text-muted`,children:`#${e.runNumber} · ${f(e.response?.at)}`}),(0,U.jsx)(`p`,{className:`m-0 font-sans text-body whitespace-pre-wrap wrap-anywhere text-ink`,children:FO(e.response?.text??``)})]},e.id))})]}),(0,U.jsx)(`div`,{className:`flex flex-none px-3 pt-2`,children:(0,U.jsx)(Ll,{actions:[{label:V(`pages.phone.more`),glyph:`⋯`,onClick:()=>c(!0)},{label:V(l.enabled?`pages.phone.pause`:`pages.phone.enable`),disabled:d,onClick:e.onToggle},{label:V(`pages.phone.runNow`),tone:`accent`,disabled:d,onClick:e.onRunNow}]})}),s&&(0,U.jsx)(vu,{label:V(`pages.phone.more`),onClose:()=>c(!1),children:t=>(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-y-auto px-3 pb-1`,children:[e.engine&&(0,U.jsx)(yu,{onClick:()=>{e.onClose(),e.onChangeEngine()},children:V(`pages.phone.changeEngine`)}),e.engine&&(0,U.jsx)(`hr`,{className:`mx-2 my-1 h-px flex-none border-none bg-line`}),(0,U.jsx)(yu,{tone:`danger`,"data-routine-delete":!0,onClick:()=>{e.onClose(),e.onDelete()},children:V(`pages.phone.deleteRoutine`)}),(0,U.jsx)(yu,{tone:`cancel`,onClick:t,children:V(`menu.cancel`)})]})})]})})}function lk(e){let{auto:t}=gS(),{run:n}=e,r=iD(n,e.now),i=kO(n),a=n.taskId,o=[e.when(n.at),V(`runLog.source.${OO[n.trigger]}`),i===null?null:AO(i),r===`awaiting`?t.responseAwaiting:r===`missing`?t.responseMissing:null,n.error?PO(n.error).summary:null];return(0,U.jsx)(ek,{mark:null,title:`#${n.runNumber} ${e.status}`,line2:(0,U.jsx)(`span`,{className:`min-w-0 truncate`,children:o.filter(Boolean).join(` · `)}),status:(0,U.jsx)(W_,{look:JO(n.status,!0)}),disabled:!a,onClick:()=>a&&e.open(a)})}function uk(e){let{auto:t}=gS();return(0,U.jsxs)(`div`,{className:$D,ref:e.listRef,children:[e.header,e.sections.map(n=>n.rows.length===0?null:(0,U.jsxs)(`section`,{children:[(0,U.jsx)(`h2`,{className:`${qr} ${eO} ${n===e.sections[0]?`text-error`:`text-muted`}`,children:V(n.key)}),n.rows.map(n=>{let r=e.rows.indexOf(n),i=e.lastRunStatus[n.id],a=i?zO(i):null,o=e.lastFailure[n.id];return(0,U.jsxs)(`div`,{"data-row":r,className:tO(r===e.cursor),onClick:()=>e.onPick(r),children:[(0,U.jsxs)(`span`,{className:nO,children:[(0,U.jsx)(`span`,{className:rO(!n.enabled),children:n.name}),(0,U.jsx)(`span`,{className:`mono text-muted ${iO}`,children:e.timingLabel(n)}),(0,U.jsx)(`span`,{className:`mono ${a?LO[a]:`text-muted`}`,style:{width:`1ch`},children:a?RO[a]:` `})]}),(0,U.jsx)(`span`,{className:`mono text-muted ${aO}`,title:n.schedule??e.triggerSub(n),children:[e.repoName(n.repo),e.triggerSub(n),e.engineShort(n)].filter(Boolean).join(` · `)}),o?(0,U.jsx)(`span`,{className:`mono text-warning ${aO}`,title:o.reason,children:Z(t.lastFailed,{when:e.when(o.at),reason:o.reason})}):null]},n.id)})]},n.key))]})}function dk(e){return(0,U.jsx)(U.Fragment,{children:e.sections.map(t=>t.rows.length===0?null:(0,U.jsx)(Fl,{label:V(t.key),children:t.rows.map(t=>{let n=e.lastRunStatus[t.id];return(0,U.jsx)(ek,{"data-routine":t.id,mark:t.script?(0,U.jsx)(XO,{}):(0,U.jsx)(Ev,{icon:e.icons.get(t.vendor??``),name:e.engine(t)}),title:t.name,dim:!t.enabled,line2:(0,U.jsx)(`span`,{className:`min-w-0 truncate`,children:e.line2(t)}),status:(0,U.jsx)(W_,{look:JO(n,t.enabled)}),onClick:()=>e.onPick(t)},t.id)})},t.key))})}var fk=5e3;function pk({model:e}){let{auto:t,common:n,nav:r}=gS(),i=Oe(),a=lS(e),o=e.client,[s,c]=wS(fk),l=b(e.tasks),u=SS(e),d=CS(e),[f,p]=(0,h.useState)(()=>J(o,`routine.list`)??null),[m,g]=(0,h.useState)(`all`),[_,v]=(0,h.useState)(null),[y,x]=(0,h.useState)(null),[S,C]=(0,h.useState)(null),w=DS(),T=_S(),E=(0,h.useRef)(null);(0,h.useEffect)(()=>{let e=!0;return ss(o,`routine.list`).then(t=>e&&p(t)).catch(()=>e&&p(e=>e??{automations:[],keepsDaemonAlive:!1})),()=>{e=!1}},[o,s]);let[D,O]=(0,h.useState)(()=>J(o,`engines.list`)?.engines??[]);(0,h.useEffect)(()=>o.onOpen(()=>{ss(o,`engines.list`).then(e=>O(e.engines)).catch(()=>{})}),[o]);let A=f?.automations??[],j=A.filter(e=>qD(e,m)),ee=f?.lastRunStatus??{},te=f?.lastFailure??{},N=e=>qO(f,e.id),P=[{key:`pages.routinesNeedYou`,rows:j.filter(N)},{key:`pages.routinesActive`,rows:j.filter(e=>e.enabled&&!N(e))},{key:`pages.routinesPaused`,rows:j.filter(e=>!e.enabled&&!N(e))}],re=P.flatMap(e=>e.rows),ie=Math.max(0,re.findIndex(e=>e.id===_)),F=re[ie],I=e=>v(re[e]?.id??null),ae=P[0]?.rows.length??0,L=b(ne);(0,h.useEffect)(()=>{L===null||!f||(f.automations.some(e=>e.id===L)&&v(L),ne.set(null))},[L,f]);let R=UO(o,F?[F.id]:[],s),[oe,se]=(0,h.useState)(!1),ce=F?R[F.id]??[]:[];(0,h.useEffect)(()=>C(null),[F?.id]);let le=(0,h.useRef)(null),[ue,B]=(0,h.useState)(0),de=(0,h.useRef)(0);(0,h.useEffect)(()=>{let e=E.current,t=ue!==de.current;if(de.current=ue,t&&e&&le.current&&e.offsetTop>le.current.offsetTop){e.scrollIntoView({block:`start`,behavior:`smooth`});return}le.current?.querySelector(`[data-row="${ie}"]`)?.scrollIntoView({block:`nearest`})},[ie,ue]);let fe=Date.now(),pe=YO(t.when,fe),me=e=>l?.tasks.find(t=>t.id===e)?.label??e,he=t=>{M.set(null),e.select(t)},ge=(e,t,n)=>z(Z(e,{name:t,error:vS(n)}),`error`),_e=async()=>{if(!(!F||y)){x(F.id);try{await o.request(`routine.setEnabled`,{id:F.id,enabled:!F.enabled}),c()}catch(e){ge(F.enabled?t.disableFailed:t.enableFailed,F.name,e)}finally{x(null)}}},ve=async()=>{if(!(!F||y)){x(F.id),C(Z(t.running,{name:F.name}));try{let e=await o.request(`routine.runNow`,{id:F.id});C(Z(t.ranWith,{name:F.name,status:e.status})),c()}catch(e){ge(t.runFailed,F.name,e)}finally{x(null)}}},ye=async()=>{if(y)return;let e=xS(await o.request(`repos.list`).then(e=>e.repos).catch(()=>[]),u);k.set((0,U.jsx)(TO,{repos:e,tasks:(l?.tasks??[]).filter(e=>!e.deleting).map(e=>({id:e.id,title:e.label,repo:e.repo})),defaultRepo:d,onSubmit:e=>{(async()=>{x(`new`);try{let t=VD(e)===`event`?HD(e.eventKind??`ci_failed`,e.eventFilter):null;await o.request(`routine.create`,{...e.repo===null?{}:{repo:e.repo},name:e.name,prompt:e.prompt,...t?{event:t.kind,...t.filter?.branch?{eventBranch:t.filter.branch}:{},...t.filter?.event?{eventName:t.filter.event}:{},...t.filter?.action?{eventAction:t.filter.action}:{}}:{schedule:e.schedule},...e.target?{targetTask:e.target.taskId,targetTab:e.target.tabId}:{}}),c()}catch(e){z(Z(t.createFailed,{error:vS(e)}),`error`)}finally{x(null)}})()}}))},be=()=>{if(!F||y)return;let e=F;k.set((0,U.jsx)(sa,{title:t.deleteTitle,body:Z(t.deleteBody,{name:e.name}),confirmLabel:t.deleteButton,onConfirm:async()=>{x(e.id);try{await o.request(`routine.delete`,{id:e.id}),c()}catch(n){ge(t.deleteFailed,e.name,n)}finally{x(null)}}}))};ES(e=>{if(e.ctrlKey)return e.key===`c`&&(M.set(null),!0);switch(e.key){case`Escape`:case`q`:return M.set(null),!0;case`j`:case`ArrowDown`:return I(Math.min(re.length-1,ie+1)),!0;case`k`:case`ArrowUp`:return I(Math.max(0,ie-1)),!0;case`n`:return ye(),!0;case`r`:return c(),!0;case`e`:return _e(),!0;case`s`:return ve(),!0;case`d`:return be(),!0;case`Enter`:{let e=ce[0]?.taskId;return e?he(e):ce.length>0&&C(t.latestRunNoTask),!0}default:return!1}});let xe=e=>GD(e,e=>D.find(t=>t.id===e)?.name??e,t.engineDefault),Se=()=>{if(!F)return;let n=F;k.set((0,U.jsx)(XD,{model:e,current:async()=>({engine:n.vendor,effort:n.modelEffort,model:n.model}),onSet:async e=>{let r=await o.request(`routine.setEngine`,{id:n.id,engine:e.engine.id,model:e.model??``,effort:e.effort??``});C(Z(r.releasedSessionTaskId?t.engineChangedNewSession:t.engineChanged,{name:n.name,engine:[e.engine.name,e.model,e.effort].filter(Boolean).join(` · `)})),c()}}))},Ce=e=>e===void 0?V(`rail.noProject`):bS(e,A.flatMap(e=>e.repo??[])),we=F&&{routine:F,runs:ce,busy:y===F.id,project:Ce(F.repo),engine:xe(F)?.full??null,targetTitle:F.target?me(F.target.taskId):void 0,now:fe,when:pe,openRun:he,onRunNow:()=>void ve(),onToggle:()=>void _e(),onDelete:be,onChangeEngine:Se},Te=we&&(0,U.jsx)(KO,{...we}),Ee=e=>KD(e,T),De=e=>e.enabled?e.nextRunAt?pe(e.nextRunAt):t.eventModeBadge:t.paused,ke=A.length>0&&(0,U.jsx)(wO,{label:V(`pages.routinesFilter`),value:m,picks:[{value:`all`,label:V(`pages.routinesFilterAll`)},{value:`schedule`,label:V(`pages.routinesFilterSchedule`)},{value:`event`,label:V(`pages.routinesFilterEvent`)}],onPick:g}),Ae=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(CO,{client:o,tick:s,reload:c}),f===null?(0,U.jsx)(`p`,{className:`text-muted`,children:n.loading}):A.length===0?(0,U.jsxs)(`div`,{className:Xw,children:[(0,U.jsx)(`p`,{className:`text-muted`,children:t.empty}),(0,U.jsx)(`p`,{className:`keys-only`,children:t.emptyHint})]}):i?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{className:`mb-2`,children:ke}),(0,U.jsx)(dk,{sections:P,lastRunStatus:ee,icons:a,line2:e=>`${Ee(e)} · ${De(e)}`,engine:e=>xe(e)?.short,onPick:e=>{v(e.id),se(!0)}})]}):(0,U.jsxs)(`div`,{className:QD,children:[(0,U.jsx)(uk,{listRef:le,header:ke,sections:P,rows:re,cursor:ie,lastRunStatus:ee,lastFailure:te,repoName:Ce,triggerSub:Ee,timingLabel:De,engineShort:e=>xe(e)?.short,when:pe,onPick:e=>{I(e),B(e=>e+1)}}),(0,U.jsx)(`div`,{className:oO,ref:E,children:Te??(0,U.jsx)(`p`,{className:`text-muted`,children:t.noSelection})})]}),S&&(0,U.jsx)(`p`,{className:`text-muted mx-0 mt-2 mb-0 text-meta leading-[inherit]`,children:S})]});return i?(0,U.jsxs)(ru,{title:r.automations,rootRef:w,note:`${ae>0?Z(t.needAttention,{count:String(ae),total:String(re.length)}):``} ${f?.keepsDaemonAlive?t.holdingDaemon:t.notHolding}`.trim(),primary:{label:V(`pages.newRoutine`),onClick:()=>void ye()},children:[Ae,oe&&we&&(0,U.jsx)(ck,{...we,onClose:()=>se(!1)})]}):(0,U.jsxs)(`div`,{className:`${Uw} ${ZD}`,tabIndex:0,ref:w,children:[(0,U.jsxs)(`div`,{className:Kw,children:[(0,U.jsx)(`h1`,{className:Gw,children:t.title}),(0,U.jsxs)(`span`,{className:`mono ${Jw}`,children:[ae>0&&(0,U.jsx)(`span`,{className:`text-error`,children:Z(t.needAttention,{count:String(ae),total:String(re.length)})}),(0,U.jsx)(`span`,{className:`text-muted`,children:f?.keepsDaemonAlive?t.holdingDaemon:t.notHolding}),(0,U.jsx)(`button`,{type:`button`,className:`${Jr} ${Yw.header}`,onClick:()=>void ye(),children:V(`pages.new`)})]})]}),Ae]})}var mk=[`project`,`state`],hk=`rove.railGroup`,gk=y(mk.find(e=>e===localStorage.getItem(hk))??`project`);function _k(e){e!==gk.get()&&(gk.set(e),localStorage.setItem(hk,e))}jw.subscribe(()=>{let{loaded:e,prefs:t}=jw.get();e&&mk.includes(t.railGroup)&&_k(t.railGroup)});function vk(e){_k(e),Lw(`railGroup`,e)}var yk=`rove.activeSortMode`;function bk(){let e=localStorage.getItem(yk);return So.find(t=>t===e)??`recent`}var xk=y(bk());function Sk(e){e!==xk.get()&&(xk.set(e),localStorage.setItem(yk,e))}jw.subscribe(()=>{let{loaded:e,prefs:t}=jw.get();e&&So.includes(t.railSort)&&Sk(t.railSort)});function Ck(e){Sk(e),Lw(`railSort`,e)}function wk(){Ck(So[(So.indexOf(xk.get())+1)%So.length]??`default`)}var Tk=y(!1);function Ek(e){e&&(xk.get()!=="default"||gk.get()===`state`)&&(Ck(`default`),vk(`project`),z(K(`tasks`,`sort.reorderSwitched`))),Tk.set(e)}async function Dk(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(K(`tasks`,`toast.moveFailed`,{error:e instanceof Error?e.message:String(e)}),`error`)}}async function Ok(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(K(`tasks`,`toast.moveFailed`,{error:e instanceof Error?e.message:String(e)}),`error`)}}var kk=new Map(Ms.map(e=>[e.id,{keys:[...e.keys],prefixKeys:e.prefixKeys&&[...e.prefixKeys],hint:e.hint?{...e.hint}:void 0}]));function Ak(){return Ms.map(e=>{let t=kk.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 jk=new Map(Ms.map(e=>[e.id,e]));function Mk(e){return jk.get(e)}function Nk(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 Pk(e){return e.hint?.keys??e.keys[0]}function Fk(e){let t=Mk(e);if(!t)return null;let n=Pk(t);return n&&n.length>0?n:null}function Ik(e){return e.keys.length>0?e.hint?.keys??e.keys[0]??null:e.prefixKeys?.length?null:e.hint?.keys??null}function Lk(e,t){return e.scope===`global`?!0:t===null?!1:e.scope===t||t===`terminal`&&e.scope===`workspace`}function Rk(e,t,n,r){let i=[],a=[],o=[],s=new Map;for(let c of e){let e=Ik(c),l=Lk(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 zk={global:`Global`,sidebar:`Sidebar`,workspace:`Workspace`,files:`Files`,inbox:`Inbox`,terminal:`Terminal`};function Bk(e){return e?zk[e]:`Global`}function Vk(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`:Mk(e)?.category??`Global`}function Hk(e,t,n){let r=e.trim();return co(r,t)||co(r,n)}var Uk=`prefix.moreCommands`,Wk=/^ctrl\+[^+]+$/;function Gk(e){return Wk.test(e)?e.slice(5):null}function Kk(e){let t=Mk(e.bindingId);if(!t)return null;if(e.reachability.direct.has(e.bindingId)){let e=t.keys[0];if(e)return Is(e)}if(e.prefixKey&&e.reachability.prefix.has(e.bindingId)){let n=t.prefixKeys?.[0];if(n)return`${Is(e.prefixKey)} ${Is(n)}`}return null}function qk(e,t){let n=Ms.filter(t=>e.direct.has(t.id)).flatMap(e=>{let t=e.keys.flatMap(e=>Gk(e)??[]);return t.length>2?[{stroke:`${t[0]}-${t.at(-1)}`,action:e.id}]:t.map(t=>({stroke:t,action:e.id}))}),r=t?Gk(t):null;return r&&e.prefix.size>0&&n.push({stroke:r,action:Uk}),n}var Jk={Enter:`return`," ":`space`,Escape:`escape`,ArrowUp:`up`,ArrowDown:`down`,ArrowLeft:`left`,ArrowRight:`right`,PageUp:`pageup`,PageDown:`pagedown`};function Yk(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 Jk[e.key]??e.key.toLowerCase()}function Xk(e){let t=Yk(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 Zk(e){return e.startsWith(`shift+`)&&e.length===7?e.slice(6).toUpperCase():e}var Qk={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`}},$k={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:`例行任务运行失败`}},eA={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.search.enter":`Search file names and text`,"files.hidden":`Show or hide dot files and folders on the All tab`,"files.changesView":`Show Changes as a folder tree or a flat list`,"files.search.nav":`Move highlight in file search results`,"files.search.submit":`Open the highlighted search result`,"files.search.cancel":`Close file search`,"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`}},tA={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.search.enter":`搜索文件名和文件内容`,"files.hidden":`在「全部」标签页显示或隐藏以点开头的文件和文件夹`,"files.changesView":`将「改动」显示为文件夹树或平铺列表`,"files.search.nav":`在文件搜索结果中移动高亮`,"files.search.submit":`打开高亮的搜索结果`,"files.search.cancel":`关闭文件搜索`,"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 nA(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 rA(e,t){return Bt.get()===`zh`?t:e}function iA(e,t){return t?e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??e)):e}var aA=(e,t)=>iA(nA(rA(Qk,$k),e)??nA(Qk,e)??e,t),oA=(e,t)=>iA(nA(rA(ja,Ma),e)??nA(ja,e)??e,t);function sA(e){return rA(eA,tA).desc[e]??eA.desc[e]??e}function cA(e){let t=sA(e),n=t.search(/\s—\s|——/);return n>0?t.slice(0,n):t}function lA(e){return rA(eA,tA).category[e]??e}var uA=(e,t)=>iA(nA(rA(Fa,Ia),e)??nA(Fa,e)??e,t),dA=(e,t)=>iA(nA(rA(ka,Aa),e)??nA(ka,e)??e,t),fA=4e3,pA=180,mA=fA,hA=y({guide:null,entries:[]}),gA=1;function _A(e,t){let n={id:gA++,stroke:e,action:t,at:Date.now()};hA.set({guide:null,entries:[...hA.get().entries,n].slice(-3)})}function vA(e,t){let n=e.querySelector(`[data-field="${t}"]`);(n?.matches(`input, textarea`)?n:n?.querySelector(`[tabindex='0']`))?.focus()}function yA(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&&vA(e,a)}var bA=[`1`,`2`,`3`,`4`,`5`],xA=[`tab`,`fork`,`scratch`],SA=[`message`,`attempts`,`engine`,`fork-base`,`destination`];function CA(e){H();let{model:t,taskId:n}=e,r=t.tasks.get()?.tasks.find(e=>e.id===n),i=Ty(t),[a,o]=(0,h.useState)(e.destination??`tab`),[s,c]=(0,h.useState)(e.context??`fresh`),[l,u]=(0,h.useState)(``),d=ni(l),[f,p]=(0,h.useState)(`1`),[m,g]=(0,h.useState)(r?.branch??`main`),{busy:_,error:v,setError:y,submit:b}=aa(),{attachments:x,attach:S,remove:C,ready:w}=bd(t,y,void 0,n),T=s===`fresh`&&a!==`fork`,E=a===`tab`&&s===`fresh`,D=Ay(t),O=i.engine===`shell`&&!T||Oy(i.engine)&&!E?``:i.engine,k=O===Ey,A=Oy(O),j=a===`fork`,ee=(e,t)=>{let n=e===`scratch`&&t===`continue`&&a===`scratch`?`tab`:e;o(n),c(n===`scratch`?`fresh`:t)},te=()=>{let r=t.selection.get();return e.sourceTabId??(r.taskId===n?r.tabId:null)??`tab-1`},M=()=>t.tasks.get()?.tasks.find(e=>e.id===n)?.tabStatus?.[te()]?.reason===`dead`,ne=async()=>{let e=await t.client.request(`tab.handoff`,{taskId:n,tabId:te()});if(e.kind===`handoff`&&e.prompt)return e.prompt;throw Error(e.kind===`no-transcript`?K(`terminal`,`tab.noTranscriptToHandOff`,{engine:e.engine??``}):K(`terminal`,`tab.nothingToFork`))},N=()=>b(async()=>{let e=s===`continue`&&a===`tab`&&!k&&!A&&M(),i=[s===`continue`&&!e?await ne():``,hd(l.trim(),await w())].filter(Boolean).join(`
54
+ `)}`},e.label))]})}var HO=30;function UO(e,t,n){let r=t.join(`\0`),[i,a]=(0,h.useState)(()=>Object.fromEntries(t.map(t=>[t,J(e,`routine.runs`,{id:t})?.runs??[]])));return(0,h.useEffect)(()=>{let n=!0;for(let r of t)ss(e,`routine.runs`,{id:r}).then(e=>n&&a(t=>({...t,[r]:e.runs}))).catch(()=>void 0);return()=>{n=!1}},[e,r,n]),i}function WO(){H();let{auto:e}=gS();return t=>{if(t.status===`skipped_blocked`){let e=t.blocked?.reason;return e?Z(V(`runLog.blockedRun`),{reason:V(`runLog.blocked.${e}`)}):V(`runLog.outcome.blocked`)}return e.runStatus[t.status]??t.status}}function GO(e){H();let{auto:t}=gS(),[n,r]=(0,h.useState)(null),i=jO(e.runs,n),a=WO(),o=(e,t,n,r)=>(0,U.jsx)(W,{variant:`pill`,hit:`tight`,"aria-current":t,className:`max-w-40 truncate`,onClick:n,children:`[ ${e} ]`},r);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`h2`,{className:`${qr} text-muted`,children:V(`runLog.title`)}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1`,children:[o(V(`runLog.all`),n===null,()=>r(null),`all`),EO.map(e=>o(V(`runLog.outcome.${e}`),n===e,()=>r(e),e))]}),i.length===0?(0,U.jsx)(`p`,{className:`text-muted`,children:e.runs.length===0?t.noRuns:V(`runLog.empty`)}):i.slice(0,HO).map(n=>{let r=zO(n.status),i=iD(n,e.now),o=i===`awaiting`?`, ${t.responseAwaiting}`:i===`missing`?`, ${t.responseMissing}`:``,s=kO(n),c=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{children:RO[r]}),(0,U.jsx)(`span`,{children:`#${n.runNumber}`}),(0,U.jsx)(`span`,{className:hO,title:n.event,children:`${a(n)}${n.tabId?`, ${n.tabId}`:``}${n.event?` · ${n.event}`:``}${o}`}),(0,U.jsx)(`span`,{className:`text-subtle`,children:V(`runLog.source.${OO[n.trigger]}`)}),s!==null&&(0,U.jsx)(`span`,{className:`text-muted`,children:AO(s)}),(0,U.jsx)(`span`,{className:`text-muted`,children:e.when(n.at)})]}),l=n.error?PO(n.error):null,u=n.taskId,d=i===`missing`?`text-warning`:LO[r];return(0,U.jsxs)(`div`,{className:`${dO} ${d}`,children:[u?(0,U.jsx)(`button`,{type:`button`,className:`mono ${mO}`,onClick:()=>e.openRun(u),children:c}):(0,U.jsx)(`span`,{className:`mono ${pO}`,children:c}),l&&(0,U.jsxs)(`details`,{className:`mono pl-[calc(2ch+16px)] [&_summary]:cursor-pointer [&_summary]:list-none [&_summary]:truncate [&_summary::-webkit-details-marker]:hidden [&[open]_summary]:whitespace-normal [&_pre]:mx-0 [&_pre]:mt-1 [&_pre]:mb-1.5 [&_pre]:max-h-[16lh] [&_pre]:overflow-auto [&_pre]:rounded-sm [&_pre]:bg-inset [&_pre]:px-2 [&_pre]:py-1.5 [&_pre]:whitespace-pre-wrap [&_pre]:wrap-anywhere [&_pre]:text-muted`,children:[(0,U.jsx)(`summary`,{children:l.summary}),(0,U.jsx)(`pre`,{children:l.full})]})]},n.id)}),i.length>HO&&(0,U.jsx)(`p`,{className:`text-muted`,children:V(`runLog.more`,{count:i.length-HO})})]})}function KO(e){let{auto:t}=gS(),n=_S(),r=H()===`zh`?`zh-CN`:`en-US`,{routine:i,busy:a,when:o}=e,s=$E(i),c=i.schedule?FD(i.schedule,n):null,l=i.nextRunAt?Date.parse(i.nextRunAt):NaN,u=nD(i),d=s===`hybrid`?t.triggerHybrid:s===`event`?t.triggerEvent:t.triggerSchedule;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:sO,children:[(0,U.jsx)(`h2`,{className:cO,children:i.name}),(0,U.jsxs)(`span`,{className:`mono ${Jw}`,children:[(0,U.jsx)(`button`,{type:`button`,className:`${Jr} ${Yw.row}`,disabled:a,onClick:e.onRunNow,children:t.runNow}),(0,U.jsx)(`button`,{type:`button`,className:`${Jr} ${Yw.row}`,disabled:a,onClick:e.onToggle,children:V(i.enabled?`pages.routinePause`:`pages.routineEnable`)}),(0,U.jsx)(`button`,{type:`button`,className:`${Jr} ${Yw.row}`,disabled:a,onClick:e.onDelete,children:V(`pages.delete`)})]})]}),(0,U.jsxs)(`dl`,{className:lO,children:[(0,U.jsx)(`dt`,{className:`text-muted`,children:V(`pages.routineTrigger`)}),(0,U.jsx)(`dd`,{children:d}),i.schedule&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`dt`,{className:`text-muted`,children:V(`pages.routineSchedule`)}),(0,U.jsxs)(`dd`,{children:[c??(0,U.jsx)(`span`,{className:`mono`,children:i.schedule}),c&&(0,U.jsx)(`span`,{className:`mono text-muted`,children:` ${i.schedule}`})]}),(0,U.jsx)(`dt`,{className:`text-muted`,children:V(`pages.routineNext`)}),(0,U.jsx)(`dd`,{className:i.enabled?``:`text-warning`,children:i.enabled?Number.isFinite(l)?`${o(i.nextRunAt)} · ${new Date(l).toLocaleString(r,{weekday:`short`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}`:`—`:t.paused})]}),u&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`dt`,{className:`text-muted`,children:V(`pages.routineEvents`)}),(0,U.jsx)(`dd`,{className:`mono`,children:u})]}),i.webhook&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`dt`,{className:`text-muted`,children:V(`pages.routineWebhook`)}),(0,U.jsx)(`dd`,{className:`mono`,children:JD(i.id)})]}),(0,U.jsx)(`dt`,{className:`text-muted`,children:V(`pages.routineProject`)}),(0,U.jsx)(`dd`,{children:e.project}),!i.script&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`dt`,{className:`text-muted`,children:V(`pages.routineDelivers`)}),(0,U.jsx)(`dd`,{children:i.target?Z(t.targetExisting,{task:e.targetTitle??i.target.taskId,tab:i.target.tabId}):i.persistentSession?i.newConversation?t.targetStandingNew:t.targetStanding:t.targetFresh})]}),e.engine&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`dt`,{className:`text-muted`,children:V(`pages.routineEngine`)}),(0,U.jsxs)(`dd`,{className:`flex flex-wrap items-baseline gap-x-3.5`,children:[(0,U.jsx)(`span`,{children:e.engine}),(0,U.jsx)(W,{className:`font-mono`,hit:`tight`,disabled:a,onClick:e.onChangeEngine,children:V(`pages.routineChangeEngine`)})]})]})]}),i.precheck&&(0,U.jsx)(`p`,{className:`mono text-muted`,children:Z(t.precheck,{command:i.precheck.command})}),i.script?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`h2`,{className:`${qr} text-muted`,children:V(`pages.routineScript`)}),(0,U.jsx)(`p`,{className:`mono ${uO}`,children:i.script.command})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`h2`,{className:`${qr} text-muted`,children:V(`pages.routinePrompt`)}),(0,U.jsx)(`p`,{className:uO,children:i.prompt})]}),(0,U.jsx)(GO,{runs:e.runs,now:e.now,when:o,openRun:e.openRun}),(0,U.jsx)(BO,{runs:e.runs,when:o})]})}function qO(e,t){let n=e?.lastRunStatus?.[t];return n!==void 0&&rD(n)}function JO(e,t){return e===`dispatch_failed`||e===`script_failed`?`error`:e!==void 0&&rD(e)?`waiting`:!t||e===void 0||e.startsWith(`skipped_`)?`idle`:`done`}function YO(e,t){return n=>{let r=n?Date.parse(n):NaN;if(!Number.isFinite(r))return`—`;let i=r-t,a=i>=0,o=Math.floor(Math.abs(i)/6e4),s=Math.floor(o/60);return o<1?a?e.now:e.justNow:o<60?Z(a?e.inMinutes:e.minutesAgo,{n:o}):s<24?Z(a?e.inHours:e.hoursAgo,{n:s}):new Date(r).toLocaleDateString()}}function XO(){return(0,U.jsx)(`svg`,{viewBox:`0 0 16 16`,className:`block size-4.5 flex-none translate-y-px fill-none stroke-current text-muted [stroke-linecap:round] [stroke-linejoin:round] [stroke-width:1.3]`,"aria-hidden":`true`,children:(0,U.jsx)(`path`,{d:`M3 3.5h10a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1v-7a1 1 0 0 1 1-1zM4.5 6.5 6.5 8l-2 1.5M8 10h3`})})}var ZO=`relative flex min-h-15 w-full items-center gap-3 rounded-sm px-3 py-2 text-left active:not-has-[[data-pr-chip]:active]:bg-hover focus-visible:bg-hover focus-visible:outline-none [&>svg]:translate-y-0`,QO=`pointer-events-none absolute inset-0 rounded-[inherit] bg-hover animate-[fade-out_560ms_ease-in_forwards] motion-reduce:hidden`,$O=`flex min-w-0 items-center gap-1.5 font-mono text-[13px] leading-[1.3] text-muted empty:hidden`;function ek(e){let{lead:t,mark:n,title:r,dim:i,flash:a,line2:o,trail:s,status:c,...l}=e;return(0,U.jsxs)(`button`,{type:`button`,className:`${ZO} hover:bg-hover data-menu-open:bg-hover`,"data-phone-row":!0,...l,children:[!!a&&(0,U.jsx)(`span`,{className:QO,"aria-hidden":`true`,"data-row-flash":!0},a),t,n,(0,U.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,U.jsx)(`span`,{className:`row-title truncate font-sans text-title ${i?`text-muted`:`text-ink`}`,children:r}),(0,U.jsx)(`span`,{className:$O,children:o})]}),s,c]})}var tk=`flex min-h-11 min-w-0 flex-1 cursor-pointer items-center gap-1.5 border-none bg-transparent p-0 text-left text-inherit [font:inherit] hover:text-ink`;function nk(e){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`button`,{type:`button`,className:tk,"aria-expanded":!e.collapsed,"aria-label":e.foldLabel,onClick:e.onToggle,children:[(0,U.jsx)(`span`,{className:`truncate tracking-[0.06em] uppercase`,children:e.label}),e.collapsed&&(0,U.jsx)(Bv,{right:!0})]}),e.add&&(0,U.jsx)(`button`,{type:`button`,className:`-mr-2 grid size-11 flex-none cursor-pointer place-items-center border-none bg-transparent font-sans text-display text-muted hover:text-ink active:text-ink`,"aria-label":e.add.label,"data-group-add":!0,onClick:e.add.onClick,children:`+`})]})}var rk=`M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2`;function ik(e){return(0,U.jsxs)(zi,{size:`nav`,kind:`routines`,label:e.label,onClick:e.onClick,children:[(0,U.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:`size-5.5 fill-none stroke-current [stroke-linecap:round] [stroke-linejoin:round] [stroke-width:1.6]`,"aria-hidden":`true`,children:[(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,U.jsx)(`path`,{d:`M12 6v6l4 2`})]}),e.count>0&&(0,U.jsx)(Wi,{count:e.count})]})}function ak(e){return(0,U.jsx)(zi,{size:`nav`,kind:`extensions`,label:e.label,onClick:e.onClick,children:(0,U.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:`size-5.5 fill-none stroke-current [stroke-linecap:round] [stroke-linejoin:round] [stroke-width:1.6]`,"aria-hidden":`true`,children:[(0,U.jsx)(`path`,{d:rk}),(0,U.jsx)(`rect`,{x:`14`,y:`2`,width:`8`,height:`8`,rx:`1`})]})})}function ok(e){return(0,U.jsxs)(`button`,{type:`button`,className:`ml-2.5 flex min-h-11 min-w-0 cursor-pointer items-center gap-1 border-none bg-transparent p-0 font-mono text-meta text-muted active:text-ink`,"aria-label":e.label,"data-computer-switch":!0,onClick:e.onClick,children:[(0,U.jsx)(`span`,{className:`truncate`,children:e.name}),(0,U.jsx)(Bv,{})]})}var sk=20,ck=`m-0 px-3 py-2.5 text-body whitespace-pre-wrap wrap-anywhere text-ink`;function lk(e){let{auto:t}=gS(),n=_S(),r=H()===`zh`?`zh-CN`:`en-US`,i=WO(),[a,o]=(0,h.useState)(`all`),[s,c]=(0,h.useState)(!1),{routine:l,runs:u,busy:d,when:f}=e,p=$E(l),m=nD(l),g=p===`hybrid`?t.triggerHybrid:p===`event`?t.triggerEvent:t.triggerSchedule,_=l.nextRunAt?Date.parse(l.nextRunAt):NaN,v=jO(u,a===`all`?null:a),y=jO(u,null)[0],b=u.filter(e=>e.response);return(0,U.jsx)(vu,{label:l.name,title:l.name,onClose:e.onClose,children:()=>(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`${du} gap-4 pt-1 pb-3`,"data-routine-sheet":!0,children:[(0,U.jsxs)(Fl,{inset:!0,children:[(0,U.jsx)(Y,{label:V(`pages.routineTrigger`),children:g}),l.schedule&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Y,{label:V(`pages.routineSchedule`),children:FD(l.schedule,n)??(0,U.jsx)(`span`,{className:`font-mono`,children:l.schedule})}),(0,U.jsx)(Y,{label:V(`pages.routineNext`),children:l.enabled?Number.isFinite(_)?`${f(l.nextRunAt)} · ${new Date(_).toLocaleString(r,{weekday:`short`,hour:`2-digit`,minute:`2-digit`})}`:`—`:t.paused})]}),m&&(0,U.jsx)(Y,{label:V(`pages.routineEvents`),children:(0,U.jsx)(`span`,{className:`font-mono`,children:m})}),l.webhook&&(0,U.jsx)(Y,{label:V(`pages.routineWebhook`),children:(0,U.jsx)(`span`,{className:`font-mono`,children:JD(l.id)})}),e.engine&&(0,U.jsx)(Y,{label:V(`pages.routineEngine`),children:e.engine}),(0,U.jsx)(Y,{label:V(`pages.routineProject`),children:e.project}),!l.script&&(0,U.jsx)(Y,{label:V(`pages.routineDelivers`),children:l.target?Z(t.targetExisting,{task:e.targetTitle??l.target.taskId,tab:l.target.tabId}):l.persistentSession?l.newConversation?t.targetStandingNew:t.targetStanding:t.targetFresh}),(0,U.jsx)(Y,{label:V(`pages.phone.lastRun`),children:y?`${i(y)} · ${f(y.at)}`:t.noRuns})]}),(0,U.jsxs)(Fl,{inset:!0,label:V(l.script?`pages.phone.script`:`pages.phone.prompt`),children:[(0,U.jsx)(`p`,{className:`${ck} ${l.script?`font-mono`:`font-sans`}`,children:l.script?l.script.command:l.prompt}),l.precheck&&(0,U.jsx)(Y,{label:V(`pages.phone.precheck`),children:(0,U.jsx)(`span`,{className:`font-mono`,children:l.precheck.command})})]}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,U.jsx)(`p`,{className:`m-0 px-3 font-mono text-meta text-subtle`,children:V(`runLog.title`)}),(0,U.jsx)(wO,{label:V(`runLog.title`),value:a,picks:[{value:`all`,label:V(`runLog.all`)},...EO.map(e=>({value:e,label:V(`runLog.outcome.${e}`)}))],onPick:o}),v.length===0?(0,U.jsx)(`p`,{className:`m-0 px-3 font-sans text-body text-muted`,children:u.length===0?t.noRuns:V(`runLog.empty`)}):(0,U.jsx)(Fl,{inset:!0,children:v.slice(0,sk).map(t=>(0,U.jsx)(uk,{run:t,status:i(t),now:e.now,when:f,open:e.openRun},t.id))}),v.length>sk&&(0,U.jsx)(`p`,{className:`m-0 px-3 font-sans text-meta text-muted`,children:V(`runLog.more`,{count:v.length-sk})})]}),(0,U.jsx)(Fl,{inset:!0,label:V(`pages.phone.responses`),children:b.length===0?(0,U.jsx)(`p`,{className:`${ck} font-sans text-muted`,children:V(`pages.phone.noResponses`)}):b.map(e=>(0,U.jsxs)(`div`,{className:`flex flex-col gap-1 px-3 py-2.5`,children:[(0,U.jsx)(`span`,{className:`font-mono text-meta text-muted`,children:`#${e.runNumber} · ${f(e.response?.at)}`}),(0,U.jsx)(`p`,{className:`m-0 font-sans text-body whitespace-pre-wrap wrap-anywhere text-ink`,children:FO(e.response?.text??``)})]},e.id))})]}),(0,U.jsx)(`div`,{className:`flex flex-none px-3 pt-2`,children:(0,U.jsx)(Ll,{actions:[{label:V(`pages.phone.more`),glyph:`⋯`,onClick:()=>c(!0)},{label:V(l.enabled?`pages.phone.pause`:`pages.phone.enable`),disabled:d,onClick:e.onToggle},{label:V(`pages.phone.runNow`),tone:`accent`,disabled:d,onClick:e.onRunNow}]})}),s&&(0,U.jsx)(vu,{label:V(`pages.phone.more`),onClose:()=>c(!1),children:t=>(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-y-auto px-3 pb-1`,children:[e.engine&&(0,U.jsx)(yu,{onClick:()=>{e.onClose(),e.onChangeEngine()},children:V(`pages.phone.changeEngine`)}),e.engine&&(0,U.jsx)(`hr`,{className:`mx-2 my-1 h-px flex-none border-none bg-line`}),(0,U.jsx)(yu,{tone:`danger`,"data-routine-delete":!0,onClick:()=>{e.onClose(),e.onDelete()},children:V(`pages.phone.deleteRoutine`)}),(0,U.jsx)(yu,{tone:`cancel`,onClick:t,children:V(`menu.cancel`)})]})})]})})}function uk(e){let{auto:t}=gS(),{run:n}=e,r=iD(n,e.now),i=kO(n),a=n.taskId,o=[e.when(n.at),V(`runLog.source.${OO[n.trigger]}`),i===null?null:AO(i),r===`awaiting`?t.responseAwaiting:r===`missing`?t.responseMissing:null,n.error?PO(n.error).summary:null];return(0,U.jsx)(ek,{mark:null,title:`#${n.runNumber} ${e.status}`,line2:(0,U.jsx)(`span`,{className:`min-w-0 truncate`,children:o.filter(Boolean).join(` · `)}),status:(0,U.jsx)(W_,{look:JO(n.status,!0)}),disabled:!a,onClick:()=>a&&e.open(a)})}function dk(e){let{auto:t}=gS();return(0,U.jsxs)(`div`,{className:$D,ref:e.listRef,children:[e.header,e.sections.map(n=>n.rows.length===0?null:(0,U.jsxs)(`section`,{children:[(0,U.jsx)(`h2`,{className:`${qr} ${eO} ${n===e.sections[0]?`text-error`:`text-muted`}`,children:V(n.key)}),n.rows.map(n=>{let r=e.rows.indexOf(n),i=e.lastRunStatus[n.id],a=i?zO(i):null,o=e.lastFailure[n.id];return(0,U.jsxs)(`div`,{"data-row":r,className:tO(r===e.cursor),onClick:()=>e.onPick(r),children:[(0,U.jsxs)(`span`,{className:nO,children:[(0,U.jsx)(`span`,{className:rO(!n.enabled),children:n.name}),(0,U.jsx)(`span`,{className:`mono text-muted ${iO}`,children:e.timingLabel(n)}),(0,U.jsx)(`span`,{className:`mono ${a?LO[a]:`text-muted`}`,style:{width:`1ch`},children:a?RO[a]:` `})]}),(0,U.jsx)(`span`,{className:`mono text-muted ${aO}`,title:n.schedule??e.triggerSub(n),children:[e.repoName(n.repo),e.triggerSub(n),e.engineShort(n)].filter(Boolean).join(` · `)}),o?(0,U.jsx)(`span`,{className:`mono text-warning ${aO}`,title:o.reason,children:Z(t.lastFailed,{when:e.when(o.at),reason:o.reason})}):null]},n.id)})]},n.key))]})}function fk(e){return(0,U.jsx)(U.Fragment,{children:e.sections.map(t=>t.rows.length===0?null:(0,U.jsx)(Fl,{label:V(t.key),children:t.rows.map(t=>{let n=e.lastRunStatus[t.id];return(0,U.jsx)(ek,{"data-routine":t.id,mark:t.script?(0,U.jsx)(XO,{}):(0,U.jsx)(Ev,{icon:e.icons.get(t.vendor??``),name:e.engine(t)}),title:t.name,dim:!t.enabled,line2:(0,U.jsx)(`span`,{className:`min-w-0 truncate`,children:e.line2(t)}),status:(0,U.jsx)(W_,{look:JO(n,t.enabled)}),onClick:()=>e.onPick(t)},t.id)})},t.key))})}var pk=5e3;function mk({model:e}){let{auto:t,common:n,nav:r}=gS(),i=Oe(),a=lS(e),o=e.client,[s,c]=wS(pk),l=b(e.tasks),u=SS(e),d=CS(e),[f,p]=(0,h.useState)(()=>J(o,`routine.list`)??null),[m,g]=(0,h.useState)(`all`),[_,v]=(0,h.useState)(null),[y,x]=(0,h.useState)(null),[S,C]=(0,h.useState)(null),w=DS(),T=_S(),E=(0,h.useRef)(null);(0,h.useEffect)(()=>{let e=!0;return ss(o,`routine.list`).then(t=>e&&p(t)).catch(()=>e&&p(e=>e??{automations:[],keepsDaemonAlive:!1})),()=>{e=!1}},[o,s]);let[D,O]=(0,h.useState)(()=>J(o,`engines.list`)?.engines??[]);(0,h.useEffect)(()=>o.onOpen(()=>{ss(o,`engines.list`).then(e=>O(e.engines)).catch(()=>{})}),[o]);let A=f?.automations??[],j=A.filter(e=>qD(e,m)),ee=f?.lastRunStatus??{},te=f?.lastFailure??{},N=e=>qO(f,e.id),P=[{key:`pages.routinesNeedYou`,rows:j.filter(N)},{key:`pages.routinesActive`,rows:j.filter(e=>e.enabled&&!N(e))},{key:`pages.routinesPaused`,rows:j.filter(e=>!e.enabled&&!N(e))}],re=P.flatMap(e=>e.rows),ie=Math.max(0,re.findIndex(e=>e.id===_)),F=re[ie],I=e=>v(re[e]?.id??null),ae=P[0]?.rows.length??0,L=b(ne);(0,h.useEffect)(()=>{L===null||!f||(f.automations.some(e=>e.id===L)&&v(L),ne.set(null))},[L,f]);let R=UO(o,F?[F.id]:[],s),[oe,se]=(0,h.useState)(!1),ce=F?R[F.id]??[]:[];(0,h.useEffect)(()=>C(null),[F?.id]);let le=(0,h.useRef)(null),[ue,B]=(0,h.useState)(0),de=(0,h.useRef)(0);(0,h.useEffect)(()=>{let e=E.current,t=ue!==de.current;if(de.current=ue,t&&e&&le.current&&e.offsetTop>le.current.offsetTop){e.scrollIntoView({block:`start`,behavior:`smooth`});return}le.current?.querySelector(`[data-row="${ie}"]`)?.scrollIntoView({block:`nearest`})},[ie,ue]);let fe=Date.now(),pe=YO(t.when,fe),me=e=>l?.tasks.find(t=>t.id===e)?.label??e,he=t=>{M.set(null),e.select(t)},ge=(e,t,n)=>z(Z(e,{name:t,error:vS(n)}),`error`),_e=async()=>{if(!(!F||y)){x(F.id);try{await o.request(`routine.setEnabled`,{id:F.id,enabled:!F.enabled}),c()}catch(e){ge(F.enabled?t.disableFailed:t.enableFailed,F.name,e)}finally{x(null)}}},ve=async()=>{if(!(!F||y)){x(F.id),C(Z(t.running,{name:F.name}));try{let e=await o.request(`routine.runNow`,{id:F.id});C(Z(t.ranWith,{name:F.name,status:e.status})),c()}catch(e){ge(t.runFailed,F.name,e)}finally{x(null)}}},ye=async()=>{if(y)return;let e=xS(await o.request(`repos.list`).then(e=>e.repos).catch(()=>[]),u);k.set((0,U.jsx)(TO,{repos:e,tasks:(l?.tasks??[]).filter(e=>!e.deleting).map(e=>({id:e.id,title:e.label,repo:e.repo})),defaultRepo:d,onSubmit:e=>{(async()=>{x(`new`);try{let t=VD(e)===`event`?HD(e.eventKind??`ci_failed`,e.eventFilter):null;await o.request(`routine.create`,{...e.repo===null?{}:{repo:e.repo},name:e.name,prompt:e.prompt,...t?{event:t.kind,...t.filter?.branch?{eventBranch:t.filter.branch}:{},...t.filter?.event?{eventName:t.filter.event}:{},...t.filter?.action?{eventAction:t.filter.action}:{}}:{schedule:e.schedule},...e.target?{targetTask:e.target.taskId,targetTab:e.target.tabId}:{}}),c()}catch(e){z(Z(t.createFailed,{error:vS(e)}),`error`)}finally{x(null)}})()}}))},be=()=>{if(!F||y)return;let e=F;k.set((0,U.jsx)(sa,{title:t.deleteTitle,body:Z(t.deleteBody,{name:e.name}),confirmLabel:t.deleteButton,onConfirm:async()=>{x(e.id);try{await o.request(`routine.delete`,{id:e.id}),c()}catch(n){ge(t.deleteFailed,e.name,n)}finally{x(null)}}}))};ES(e=>{if(e.ctrlKey)return e.key===`c`&&(M.set(null),!0);switch(e.key){case`Escape`:case`q`:return M.set(null),!0;case`j`:case`ArrowDown`:return I(Math.min(re.length-1,ie+1)),!0;case`k`:case`ArrowUp`:return I(Math.max(0,ie-1)),!0;case`n`:return ye(),!0;case`r`:return c(),!0;case`e`:return _e(),!0;case`s`:return ve(),!0;case`d`:return be(),!0;case`Enter`:{let e=ce[0]?.taskId;return e?he(e):ce.length>0&&C(t.latestRunNoTask),!0}default:return!1}});let xe=e=>GD(e,e=>D.find(t=>t.id===e)?.name??e,t.engineDefault),Se=()=>{if(!F)return;let n=F;k.set((0,U.jsx)(XD,{model:e,current:async()=>({engine:n.vendor,effort:n.modelEffort,model:n.model}),onSet:async e=>{let r=await o.request(`routine.setEngine`,{id:n.id,engine:e.engine.id,model:e.model??``,effort:e.effort??``});C(Z(r.releasedSessionTaskId?t.engineChangedNewSession:t.engineChanged,{name:n.name,engine:[e.engine.name,e.model,e.effort].filter(Boolean).join(` · `)})),c()}}))},Ce=e=>e===void 0?V(`rail.noProject`):bS(e,A.flatMap(e=>e.repo??[])),we=F&&{routine:F,runs:ce,busy:y===F.id,project:Ce(F.repo),engine:xe(F)?.full??null,targetTitle:F.target?me(F.target.taskId):void 0,now:fe,when:pe,openRun:he,onRunNow:()=>void ve(),onToggle:()=>void _e(),onDelete:be,onChangeEngine:Se},Te=we&&(0,U.jsx)(KO,{...we}),Ee=e=>KD(e,T),De=e=>e.enabled?e.nextRunAt?pe(e.nextRunAt):t.eventModeBadge:t.paused,ke=A.length>0&&(0,U.jsx)(wO,{label:V(`pages.routinesFilter`),value:m,picks:[{value:`all`,label:V(`pages.routinesFilterAll`)},{value:`schedule`,label:V(`pages.routinesFilterSchedule`)},{value:`event`,label:V(`pages.routinesFilterEvent`)}],onPick:g}),Ae=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(CO,{client:o,tick:s,reload:c}),f===null?(0,U.jsx)(`p`,{className:`text-muted`,children:n.loading}):A.length===0?(0,U.jsxs)(`div`,{className:Xw,children:[(0,U.jsx)(`p`,{className:`text-muted`,children:t.empty}),(0,U.jsx)(`p`,{className:`keys-only`,children:t.emptyHint})]}):i?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{className:`mb-2`,children:ke}),(0,U.jsx)(fk,{sections:P,lastRunStatus:ee,icons:a,line2:e=>`${Ee(e)} · ${De(e)}`,engine:e=>xe(e)?.short,onPick:e=>{v(e.id),se(!0)}})]}):(0,U.jsxs)(`div`,{className:QD,children:[(0,U.jsx)(dk,{listRef:le,header:ke,sections:P,rows:re,cursor:ie,lastRunStatus:ee,lastFailure:te,repoName:Ce,triggerSub:Ee,timingLabel:De,engineShort:e=>xe(e)?.short,when:pe,onPick:e=>{I(e),B(e=>e+1)}}),(0,U.jsx)(`div`,{className:oO,ref:E,children:Te??(0,U.jsx)(`p`,{className:`text-muted`,children:t.noSelection})})]}),S&&(0,U.jsx)(`p`,{className:`text-muted mx-0 mt-2 mb-0 text-meta leading-[inherit]`,children:S})]});return i?(0,U.jsxs)(ru,{title:r.automations,rootRef:w,note:`${ae>0?Z(t.needAttention,{count:String(ae),total:String(re.length)}):``} ${f?.keepsDaemonAlive?t.holdingDaemon:t.notHolding}`.trim(),primary:{label:V(`pages.newRoutine`),onClick:()=>void ye()},children:[Ae,oe&&we&&(0,U.jsx)(lk,{...we,onClose:()=>se(!1)})]}):(0,U.jsxs)(`div`,{className:`${Uw} ${ZD}`,tabIndex:0,ref:w,children:[(0,U.jsxs)(`div`,{className:Kw,children:[(0,U.jsx)(`h1`,{className:Gw,children:t.title}),(0,U.jsxs)(`span`,{className:`mono ${Jw}`,children:[ae>0&&(0,U.jsx)(`span`,{className:`text-error`,children:Z(t.needAttention,{count:String(ae),total:String(re.length)})}),(0,U.jsx)(`span`,{className:`text-muted`,children:f?.keepsDaemonAlive?t.holdingDaemon:t.notHolding}),(0,U.jsx)(`button`,{type:`button`,className:`${Jr} ${Yw.header}`,onClick:()=>void ye(),children:V(`pages.new`)})]})]}),Ae]})}var hk=[`project`,`state`],gk=`rove.railGroup`,_k=y(hk.find(e=>e===localStorage.getItem(gk))??`project`);function vk(e){e!==_k.get()&&(_k.set(e),localStorage.setItem(gk,e))}jw.subscribe(()=>{let{loaded:e,prefs:t}=jw.get();e&&hk.includes(t.railGroup)&&vk(t.railGroup)});function yk(e){vk(e),Lw(`railGroup`,e)}var bk=`rove.activeSortMode`;function xk(){let e=localStorage.getItem(bk);return So.find(t=>t===e)??`recent`}var Sk=y(xk());function Ck(e){e!==Sk.get()&&(Sk.set(e),localStorage.setItem(bk,e))}jw.subscribe(()=>{let{loaded:e,prefs:t}=jw.get();e&&So.includes(t.railSort)&&Ck(t.railSort)});function wk(e){Ck(e),Lw(`railSort`,e)}function Tk(){wk(So[(So.indexOf(Sk.get())+1)%So.length]??`default`)}var Ek=y(!1);function Dk(e){e&&(Sk.get()!=="default"||_k.get()===`state`)&&(wk(`default`),yk(`project`),z(K(`tasks`,`sort.reorderSwitched`))),Ek.set(e)}async function Ok(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(K(`tasks`,`toast.moveFailed`,{error:e instanceof Error?e.message:String(e)}),`error`)}}async function kk(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(K(`tasks`,`toast.moveFailed`,{error:e instanceof Error?e.message:String(e)}),`error`)}}var Ak=new Map(Ms.map(e=>[e.id,{keys:[...e.keys],prefixKeys:e.prefixKeys&&[...e.prefixKeys],hint:e.hint?{...e.hint}:void 0}]));function jk(){return Ms.map(e=>{let t=Ak.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 Mk=new Map(Ms.map(e=>[e.id,e]));function Nk(e){return Mk.get(e)}function Pk(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 Fk(e){return e.hint?.keys??e.keys[0]}function Ik(e){let t=Nk(e);if(!t)return null;let n=Fk(t);return n&&n.length>0?n:null}function Lk(e){return e.keys.length>0?e.hint?.keys??e.keys[0]??null:e.prefixKeys?.length?null:e.hint?.keys??null}function Rk(e,t){return e.scope===`global`?!0:t===null?!1:e.scope===t||t===`terminal`&&e.scope===`workspace`}function zk(e,t,n,r){let i=[],a=[],o=[],s=new Map;for(let c of e){let e=Lk(c),l=Rk(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 Bk={global:`Global`,sidebar:`Sidebar`,workspace:`Workspace`,files:`Files`,inbox:`Inbox`,terminal:`Terminal`};function Vk(e){return e?Bk[e]:`Global`}function Hk(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`:Nk(e)?.category??`Global`}function Uk(e,t,n){let r=e.trim();return co(r,t)||co(r,n)}var Wk=`prefix.moreCommands`,Gk=/^ctrl\+[^+]+$/;function Kk(e){return Gk.test(e)?e.slice(5):null}function qk(e){let t=Nk(e.bindingId);if(!t)return null;if(e.reachability.direct.has(e.bindingId)){let e=t.keys[0];if(e)return Is(e)}if(e.prefixKey&&e.reachability.prefix.has(e.bindingId)){let n=t.prefixKeys?.[0];if(n)return`${Is(e.prefixKey)} ${Is(n)}`}return null}function Jk(e,t){let n=Ms.filter(t=>e.direct.has(t.id)).flatMap(e=>{let t=e.keys.flatMap(e=>Kk(e)??[]);return t.length>2?[{stroke:`${t[0]}-${t.at(-1)}`,action:e.id}]:t.map(t=>({stroke:t,action:e.id}))}),r=t?Kk(t):null;return r&&e.prefix.size>0&&n.push({stroke:r,action:Wk}),n}var Yk={Enter:`return`," ":`space`,Escape:`escape`,ArrowUp:`up`,ArrowDown:`down`,ArrowLeft:`left`,ArrowRight:`right`,PageUp:`pageup`,PageDown:`pagedown`};function Xk(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 Yk[e.key]??e.key.toLowerCase()}function Zk(e){let t=Xk(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 Qk(e){return e.startsWith(`shift+`)&&e.length===7?e.slice(6).toUpperCase():e}var $k={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`}},eA={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:`例行任务运行失败`}},tA={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.search.enter":`Search file names and text`,"files.hidden":`Show or hide dot files and folders on the All tab`,"files.changesView":`Show Changes as a folder tree or a flat list`,"files.search.nav":`Move highlight in file search results`,"files.search.submit":`Open the highlighted search result`,"files.search.cancel":`Close file search`,"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`}},nA={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.search.enter":`搜索文件名和文件内容`,"files.hidden":`在「全部」标签页显示或隐藏以点开头的文件和文件夹`,"files.changesView":`将「改动」显示为文件夹树或平铺列表`,"files.search.nav":`在文件搜索结果中移动高亮`,"files.search.submit":`打开高亮的搜索结果`,"files.search.cancel":`关闭文件搜索`,"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 rA(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 iA(e,t){return Bt.get()===`zh`?t:e}function aA(e,t){return t?e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??e)):e}var oA=(e,t)=>aA(rA(iA($k,eA),e)??rA($k,e)??e,t),sA=(e,t)=>aA(rA(iA(ja,Ma),e)??rA(ja,e)??e,t);function cA(e){return iA(tA,nA).desc[e]??tA.desc[e]??e}function lA(e){let t=cA(e),n=t.search(/\s—\s|——/);return n>0?t.slice(0,n):t}function uA(e){return iA(tA,nA).category[e]??e}var dA=(e,t)=>aA(rA(iA(Fa,Ia),e)??rA(Fa,e)??e,t),fA=(e,t)=>aA(rA(iA(ka,Aa),e)??rA(ka,e)??e,t),pA=4e3,mA=180,hA=pA,gA=y({guide:null,entries:[]}),_A=1;function vA(e,t){let n={id:_A++,stroke:e,action:t,at:Date.now()};gA.set({guide:null,entries:[...gA.get().entries,n].slice(-3)})}function yA(e,t){let n=e.querySelector(`[data-field="${t}"]`);(n?.matches(`input, textarea`)?n:n?.querySelector(`[tabindex='0']`))?.focus()}function bA(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&&yA(e,a)}var xA=[`1`,`2`,`3`,`4`,`5`],SA=[`tab`,`fork`,`scratch`],CA=[`message`,`attempts`,`engine`,`fork-base`,`destination`];function wA(e){H();let{model:t,taskId:n}=e,r=t.tasks.get()?.tasks.find(e=>e.id===n),i=Ty(t),[a,o]=(0,h.useState)(e.destination??`tab`),[s,c]=(0,h.useState)(e.context??`fresh`),[l,u]=(0,h.useState)(``),d=ni(l),[f,p]=(0,h.useState)(`1`),[m,g]=(0,h.useState)(r?.branch??`main`),{busy:_,error:v,setError:y,submit:b}=aa(),{attachments:x,attach:S,remove:C,ready:w}=bd(t,y,void 0,n),T=s===`fresh`&&a!==`fork`,E=a===`tab`&&s===`fresh`,D=Ay(t),O=i.engine===`shell`&&!T||Oy(i.engine)&&!E?``:i.engine,k=O===Ey,A=Oy(O),j=a===`fork`,ee=(e,t)=>{let n=e===`scratch`&&t===`continue`&&a===`scratch`?`tab`:e;o(n),c(n===`scratch`?`fresh`:t)},te=()=>{let r=t.selection.get();return e.sourceTabId??(r.taskId===n?r.tabId:null)??`tab-1`},M=()=>t.tasks.get()?.tasks.find(e=>e.id===n)?.tabStatus?.[te()]?.reason===`dead`,ne=async()=>{let e=await t.client.request(`tab.handoff`,{taskId:n,tabId:te()});if(e.kind===`handoff`&&e.prompt)return e.prompt;throw Error(e.kind===`no-transcript`?K(`terminal`,`tab.noTranscriptToHandOff`,{engine:e.engine??``}):K(`terminal`,`tab.nothingToFork`))},N=()=>b(async()=>{let e=s===`continue`&&a===`tab`&&!k&&!A&&M(),i=[s===`continue`&&!e?await ne():``,hd(l.trim(),await w())].filter(Boolean).join(`
55
55
 
56
- `);if(a===`scratch`){let e=await t.client.request(`task.openScratch`,k?{}:{engine:O});k?await Ny(t,e.taskId,{kind:`shell`}):t.selectWhenListed(e.taskId)}else if(j){if(!r)throw Error(K(`terminal`,`tab.tabGone`));if(!l.trim())throw Error(V(`taskops.forkNeedsMessage`));let e=m.trim()||r.branch,a;try{a=await t.client.request(`tab.forkTask`,{repo:r.repo,baseBranch:e,prompt:i,...O?{engine:O}:{},...Number(f)>1?{count:Number(f)}:{},...e===r.branch?{forkFrom:n}:{}})}catch(e){let t=Ug(e);if(!t)throw e;z(e instanceof Error?e.message:String(e),`error`),Se(t);return}a.forkRefused&&z(V(`taskops.forkLeftBehind`,{reason:a.forkRefused}));let o=a.taskIds[0];a.groupId?Se(a.groupId):o&&t.selectWhenListed(o)}else if(k)await Ny(t,n,{kind:`shell`});else if(A){let{selection:e}=t,r=e.get().taskId===n?e.get().tabId:null,i=await t.client.request(`plugin.paneOpen`,{taskId:n,pane:ky(O),...r?{tabId:r}:{}});await t.refreshTabsNow(n),t.select(n,i.tabId)}else await Ny(t,n,{kind:`engine`,engine:O,prompt:i,...e?{replaceTab:te()}:{}})});return(0,U.jsx)(ia,{title:K(`terminal`,`tab.newChat.title`),wide:!0,children:(0,U.jsxs)(`form`,{className:hi,onKeyDown:e=>{if(e.key===`Tab`&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&(j||!e.shiftKey))e.preventDefault(),e.stopPropagation(),j?yA(e.currentTarget,SA,e.shiftKey?-1:1):ee(xA[(xA.indexOf(a)+1)%xA.length]??`tab`,s);else if(e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.toLowerCase()===`e`){e.preventDefault(),e.stopPropagation();let t=i.engines.filter(e=>e.ready!==!1),n=t[(t.findIndex(e=>e.id===i.engine)+1)%t.length];n&&i.setEngine(n.id)}else e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.toLowerCase()===`f`?(e.preventDefault(),e.stopPropagation(),ee(a,s===`fresh`?`continue`:`fresh`)):e.key===`Enter`&&j&&e.target.closest(`[data-field=attempts], [data-field=engine]`)&&(e.preventDefault(),e.currentTarget.requestSubmit())},onSubmit:e=>{e.preventDefault(),N()},onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault(),S(Array.from(e.dataTransfer.files))},children:[(0,U.jsxs)(`div`,{className:ri,children:[(0,U.jsx)(`span`,{className:`${ii}`,children:K(`terminal`,`tab.newChat.engine`)}),(0,U.jsx)(jy,{engines:i.engines,value:O,onChange:i.setEngine,withShell:T,panes:E?D:[]})]}),(0,U.jsxs)(`div`,{className:ri,children:[(0,U.jsx)(`span`,{className:`${ii}`,children:K(`terminal`,`tab.newChat.destLabel`)}),(0,U.jsx)(xy,{label:K(`terminal`,`tab.newChat.destLabel`),field:`destination`,value:a,onChange:e=>ee(e,s),choices:xA.map(e=>({id:e,label:K(`terminal`,`tab.newChat.dest${e===`tab`?`Tab`:e===`fork`?`Fork`:`Scratch`}`)}))})]}),(0,U.jsxs)(`div`,{className:ri,children:[(0,U.jsxs)(`span`,{className:`${ii}`,children:[K(`terminal`,`tab.newChat.ctxLabel`),` `,(0,U.jsx)(`span`,{className:`keys-only`,children:`ctrl+f`})]}),(0,U.jsx)(xy,{label:K(`terminal`,`tab.newChat.ctxLabel`),field:`context`,value:s,onChange:e=>ee(a,e===`continue`?`continue`:`fresh`),choices:[`fresh`,`continue`].map(e=>({id:e,label:K(`terminal`,`tab.newChat.ctx${e===`fresh`?`Fresh`:`Continue`}`)}))})]}),j&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(`span`,{className:`font-sans text-meta font-normal normal-nums text-muted`,children:K(`quickTask`,`attemptsLabel`)}),(0,U.jsx)(xy,{label:K(`quickTask`,`attemptsLabel`),field:`attempts`,value:f,onChange:p,choices:bA.map(e=>({id:e,label:e}))})]}),(0,U.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(`span`,{className:`font-sans text-meta font-normal normal-nums text-muted`,children:V(`taskops.forkBranch`)}),(0,U.jsx)(`input`,{className:Zr,"data-field":`fork-base`,spellCheck:!1,value:m,onChange:e=>g(e.target.value)})]})]}),!k&&!A&&a!==`scratch`&&(0,U.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(`span`,{className:`font-sans text-meta font-normal normal-nums text-muted`,children:V(`newChat.prompt`)}),(0,U.jsx)(`textarea`,{ref:d,className:`${Zr} ${ai}`,"data-field":`message`,autoFocus:!0,rows:4,placeholder:V(`newChat.promptPlaceholder`),value:l,onChange:e=>u(e.target.value),onPaste:e=>{let t=Array.from(e.clipboardData.files);t.length!==0&&(e.preventDefault(),S(t))},onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&e.currentTarget.form?.requestSubmit()}})]}),(0,U.jsx)(xd,{attachments:x,onRemove:C}),ff()?(0,U.jsx)(`p`,{className:`text-muted`,children:V(`pages.attachHintTouch`)}):(0,U.jsx)(`p`,{className:`keys-only mx-0 mt-2 mb-0 ${Hr}`,children:K(`quickTask`,`legend`)}),v&&(0,U.jsx)(`p`,{className:`text-error`,children:v}),(0,U.jsx)(la,{busy:_,submitLabel:V(`newChat.start`)})]})})}var wA=[`needs`,`working`,`ready`,`idle`],TA=`~state:`;function EA(e){switch(e.rowStatus?.kind){case`attention`:case`needs-input`:case`unseen`:return`needs`;case`busy`:case`running`:return`working`}switch(e.group){case`waiting-on-you`:return`needs`;case`working`:return`working`;case`landing`:case`ready-for-review`:return`ready`}return e.pr?.lifecycle===`open`||e.status===`done`?`ready`:`idle`}var DA=e=>e&&!Mo(e)?fo(e.repo):void 0;function OA(e,t){let n=No(e,t.sort),{children:r,nested:i}=Ro([{repo:``,label:``,tasks:n}]),a=n.filter(e=>!i.has(e.id)),o=yo(a),s=e=>{let t=[],n=new Set,i=e=>{if(!n.has(e.id)){n.add(e.id),t.push(e);for(let t of r.get(e.id)??[])i(t)}};return i(e),t},c=new Map;for(let e of a){let t=vo(e),n=((t===null?void 0:o.get(t))??[e]).map(s),r=n.flat().map(EA).reduce((e,t)=>wA.indexOf(t)<wA.indexOf(e)?t:e);for(let e of n)for(let t of e)c.set(t.id,r)}return wA.flatMap(e=>{let t=n.filter(t=>c.get(t.id)===e);return t.length===0?[]:[{repo:``,label:V(`rail.state.${e}`),key:`${TA}${e}`,tasks:t}]})}function kA(e){let t=new Set(e.machines.map(e=>e.alias));return{rows:Vo(OA([...e.tasks.filter(e=>!e.routine),...e.remote.filter(e=>!e.routine&&e.machine!==void 0&&t.has(e.machine.id))],e),e.query,e.fold).map(e=>{if(e.kind!==`project`)return e;let t=e.id.slice(`project:${TA}`.length);return{id:`state:${t}`,kind:`state`,state:t,label:e.label}}),groups:[]}}var AA=new Set([`refused`,`timeout`,`host-key-changed`,`host-key-unverified`,`auth-denied`,`unresolved`,`ssh-failed`,`no-rove`,`no-daemon`,`bad-status`,`handshake`,`no-forwarding`,`lost`]);function jA(e){return e&&AA.has(e)?`machines.reason.${e}`:null}function MA(e,t){return e.filter(e=>e.machine?.id===t&&!e.routine&&!e.deleting)}function NA(e){let t=wA.map(e=>({state:e,tasks:[]}));for(let n of e)t[wA.indexOf(EA(n))]?.tasks.push(n);return t.filter(e=>e.tasks.length>0)}var PA=`flex flex-col font-mono text-meta`,FA=`flex flex-col gap-1 border-t-hairline border-line py-2.5 first:border-t-0 first:pt-0`,IA=`flex flex-wrap items-baseline gap-x-2.5 gap-y-0.5`,LA=`min-w-0 text-ink wrap-anywhere`,RA=`m-0 text-muted wrap-anywhere`,zA=`flex flex-wrap gap-x-3.5 gap-y-1 pt-0.5 whitespace-nowrap`,BA=`mt-1.5 mb-0.5 text-subtle`,VA=`flex min-w-0 items-baseline gap-2 pl-2`,HA=`min-w-0 flex-1 truncate text-left`,UA=`min-w-0 max-w-[55%] flex-none truncate text-muted`;function WA(e){k.set((0,U.jsx)(JA,{model:e}))}function GA({model:e,tasks:t}){let n=t=>{B(),e.select(t.id),ye()};return NA(t).map(e=>(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`${BA} m-0`,children:V(`rail.state.${e.state}`)}),e.tasks.map(e=>(0,U.jsxs)(W,{variant:`row`,className:`${VA} w-full rounded-sm py-0.5 hover:bg-hover`,onClick:()=>n(e),children:[(0,U.jsx)(`span`,{className:HA,children:e.label}),(0,U.jsx)(`span`,{className:UA,children:e.branch})]},e.id))]},e.state))}function KA({model:e,alias:t}){let[n,r]=(0,h.useState)(null);return(0,h.useEffect)(()=>{let n=!0;return ss(e,`machines.repos`,{machine:t}).then(e=>n&&r(e),e=>n&&r({failed:e instanceof Error?e.message:String(e)})),()=>{n=!1}},[e,t]),n?`failed`in n?(0,U.jsx)(`p`,{className:RA,children:V(`machines.reposFailed`,{message:n.failed})}):n.reason?(0,U.jsx)(`p`,{className:RA,children:V(`machines.reposFailed`,{message:n.message??n.reason})}):n.repos.length===0?(0,U.jsx)(`p`,{className:RA,children:V(`machines.noRepos`)}):n.repos.map(e=>(0,U.jsxs)(`div`,{className:VA,children:[(0,U.jsx)(`span`,{className:HA,children:e.id}),(0,U.jsx)(`span`,{className:UA,title:e.primary??e.checkouts[0],children:e.primary??e.checkouts[0]??``})]},e.id)):(0,U.jsx)(`p`,{className:RA,children:V(`machines.loading`)})}function qA(e){let{model:t,row:n,tasks:r,words:i}=e,[a,o]=(0,h.useState)(null),s=n.state===`online`,c=jA(n.reason),l=NA(r).map(e=>`${e.tasks.length} ${V(`rail.state.${e.state}`)}`),u=e=>o(a===e?null:e),[d,f]=(0,h.useState)({busy:!1});return(0,U.jsxs)(`section`,{className:FA,children:[(0,U.jsxs)(`div`,{className:IA,children:[(0,U.jsx)(`span`,{className:`${LA} ${s?``:Ou.warning}`,children:vg(n,i)}),(0,U.jsx)(`span`,{className:`text-muted`,children:l.length>0?l.join(` · `):V(`machines.noTasks`)})]}),c&&(0,U.jsx)(`p`,{className:`m-0 text-muted wrap-anywhere`,children:V(c)}),(d.busy||d.note)&&(0,U.jsx)(`p`,{className:`m-0 text-muted wrap-anywhere`,children:d.busy?V(`machines.updating`):d.note}),(0,U.jsxs)(`div`,{className:zA,children:[n.behind&&(0,U.jsx)(W,{hit:`tight`,disabled:d.busy,onClick:()=>{f({busy:!0}),t.client.request(`machines.update`,{machine:n.alias}).then(e=>f({busy:!1,note:e.ok?V(e.result.changed?`machines.updated`:`machines.upToDate`,{from:e.result.from??`?`,to:e.result.to??`?`}):V(`machines.updateFailed`,{message:e.message})}),e=>f({busy:!1,note:V(`machines.updateFailed`,{message:e instanceof Error?e.message:String(e)})}))},children:V(`machines.update`)}),s&&(0,U.jsx)(W,{hit:`tight`,onClick:()=>{B(),Yb(void 0,n.alias)},children:V(`machines.newHere`)}),r.length>0&&(0,U.jsx)(W,{hit:`tight`,"aria-expanded":a===`tasks`,onClick:()=>u(`tasks`),children:V(a===`tasks`?`machines.hide`:`machines.tasks`)}),s&&(0,U.jsx)(W,{hit:`tight`,"aria-expanded":a===`repos`,onClick:()=>u(`repos`),children:V(a===`repos`?`machines.hide`:`machines.repos`)})]}),a===`tasks`&&(0,U.jsx)(GA,{model:t,tasks:r}),a===`repos`&&(0,U.jsx)(KA,{model:t,alias:n.alias})]})}function JA({model:e}){let t=H(),n=Cg(e),r=b(e.remote),i=(t===`zh`?Aa:ka).machine;return(0,U.jsx)(ia,{title:V(`machines.title`),wide:!0,children:(0,U.jsxs)(`div`,{className:`${hi} ${PA}`,children:[n.length===0&&(0,U.jsx)(`p`,{className:`m-0 text-muted wrap-anywhere`,children:V(`machines.none`)}),n.map(t=>(0,U.jsx)(qA,{model:e,row:t,tasks:MA(r,t.alias),words:i},t.alias))]})})}function YA(e,t,n=300){let r=0,i,a=()=>{r++,i?.(),i=void 0};return{stop:a,run:o=>{a();let s=o.trim();if(s.length<2){t({kind:`idle`});return}let c=r,l=setTimeout(()=>{t({kind:`searching`}),e(s).then(e=>c===r&&t({kind:`done`,query:s,reply:e}),e=>c===r&&t({kind:`failed`,message:e instanceof Error?e.message:String(e)}))},n);i=()=>clearTimeout(l)}}}var XA=`mx-1.5 mt-2 mb-0.5 font-mono text-meta font-semibold normal-nums text-subtle first:mt-0`,ZA=`mx-1.5 my-1 text-meta text-muted [overflow-wrap:anywhere]`,QA=e=>`flex w-full min-w-0 cursor-pointer flex-col gap-0.5 rounded-sm px-1.5 py-1.5 text-left text-ink [font:inherit] touch:py-2.5 ${e?`is-selected bg-hover`:``}`,$A=`flex min-w-0 items-baseline gap-2`,ej=`min-w-0 flex-1 truncate text-body`,tj=`whitespace-nowrap text-meta text-muted`,nj=`text-meta text-muted [overflow-wrap:anywhere]`,rj=`rounded-xs bg-accent/25 text-ink`;function ij(e,t){let[n,r]=(0,h.useState)({kind:`idle`});return(0,h.useEffect)(()=>{let n=YA(t=>e.client.request(`sessions.search`,{query:t}),r);return n.run(t),n.stop},[e,t]),n}function aj(e,t){let n=[],r=e.toLowerCase(),i=t.toLowerCase(),a=0;for(let t=r.indexOf(i);i&&t>=0;t=r.indexOf(i,t+i.length))t>a&&n.push(e.slice(a,t)),n.push({hit:e.slice(t,t+i.length),at:t}),a=t+i.length;return n.push(e.slice(a)),n.map(e=>typeof e==`string`?e:(0,U.jsx)(`mark`,{className:rj,children:e.hit},e.at))}function oj({children:e}){return(0,U.jsx)(`h3`,{className:XA,children:e})}function sj({children:e,error:t}){return(0,U.jsx)(`p`,{className:`${ZA} ${t?`text-error`:``}`,children:e})}function cj(e){return(0,U.jsx)(W,{variant:`row`,className:QA(e.selected),onMouseEnter:e.onHover,onClick:e.onOpen,children:(0,U.jsxs)(`span`,{className:$A,children:[(0,U.jsx)(`span`,{className:ej,children:e.title}),(0,U.jsx)(`span`,{className:tj,children:e.repo})]})})}function lj(e){let{hit:t}=e;return(0,U.jsxs)(W,{variant:`row`,className:QA(e.selected),onMouseEnter:e.onHover,onClick:e.onOpen,children:[(0,U.jsxs)(`span`,{className:$A,children:[(0,U.jsx)(`span`,{className:ej,children:t.title}),(0,U.jsxs)(`span`,{className:tj,children:[V(t.role===`user`?`search.you`:`search.agent`),` · `,_c(Date.now()-Date.parse(t.at))]})]}),(0,U.jsx)(`span`,{className:nj,children:aj(t.snippet,e.query)})]})}async function uj(e,t){let{taskId:n}=await e.client.request(`task.openScratch`);await Ny(e,n,{kind:`engine`,prompt:t}),B()}function dj(e,t){let n=V(`settings.feedback.reportPrompt`);return uj(e,t?`${n}\n\n${V(`settings.feedback.reportGiven`,t)}`:n)}function fj(e,t,n){let r=`worktrees.land.refusal.${t.refusal}`,i=e(r,{branch:t.branch??n,landedOn:t.landedOn??``,files:(t.dirtyFiles??[]).join(`, `)});return i===r?e(`worktrees.land.failed`,{error:t.message??t.refusal}):i}function pj(e){let t=e.todos;return!t||t.length===0?null:{done:t.filter(e=>e.done).length,total:t.length}}function mj(e){return(e.todos??[]).filter(e=>!e.done)}var hj=/LAND_CONFLICT/,gj=/MAIN_CHECKOUT_DIRTY/,_j=/SYNC_CONFLICT(?:: )?(.*)/,vj=/SYNC_WORKTREE_DIRTY(?:: )?(.*)/;function yj(e){let t=G(e);return hj.test(t)?K(`worktrees`,`land.conflict`,{files:t}):gj.test(t)?K(`worktrees`,`land.dirtyBase`):K(`worktrees`,`land.failed`,{error:t})}async function bj(e,t,n){if(t.machine){xj(e,t,t.machine.label,n);return}let r;try{r=await e.client.request(`task.landPreflight`,{taskId:t.id})}catch(e){z(K(`worktrees`,`land.failed`,{error:G(e)}),`error`);return}if(r.refusal){z(r.refusal===`MAIN_CHECKOUT_DIRTY`?K(`worktrees`,`land.dirtyBase`):fj((e,t)=>{let n=K(`worktrees`,e.replace(/^worktrees\./,``),t);return n===e.replace(/^worktrees\./,``)?e:n},{...r,refusal:r.refusal},t.branch||t.title),`error`);return}let i=t.branch||t.title,a=mj(e.tasks.get()?.tasks.find(e=>e.id===t.id)??{}).length;k.set((0,U.jsx)(sa,{title:K(`worktrees`,`land.confirmTitle`),body:[K(`worktrees`,r.ahead===1?`land.confirmBodyOne`:`land.confirmBody`,{branch:i,landedOn:r.landedOn,commits:r.ahead??`?`}),...a>0?[V(`files.landTodos`,{count:a})]:[]].join(`
56
+ `);if(a===`scratch`){let e=await t.client.request(`task.openScratch`,k?{}:{engine:O});k?await Ny(t,e.taskId,{kind:`shell`}):t.selectWhenListed(e.taskId)}else if(j){if(!r)throw Error(K(`terminal`,`tab.tabGone`));if(!l.trim())throw Error(V(`taskops.forkNeedsMessage`));let e=m.trim()||r.branch,a;try{a=await t.client.request(`tab.forkTask`,{repo:r.repo,baseBranch:e,prompt:i,...O?{engine:O}:{},...Number(f)>1?{count:Number(f)}:{},...e===r.branch?{forkFrom:n}:{}})}catch(e){let t=Ug(e);if(!t)throw e;z(e instanceof Error?e.message:String(e),`error`),Se(t);return}a.forkRefused&&z(V(`taskops.forkLeftBehind`,{reason:a.forkRefused}));let o=a.taskIds[0];a.groupId?Se(a.groupId):o&&t.selectWhenListed(o)}else if(k)await Ny(t,n,{kind:`shell`});else if(A){let{selection:e}=t,r=e.get().taskId===n?e.get().tabId:null,i=await t.client.request(`plugin.paneOpen`,{taskId:n,pane:ky(O),...r?{tabId:r}:{}});await t.refreshTabsNow(n),t.select(n,i.tabId)}else await Ny(t,n,{kind:`engine`,engine:O,prompt:i,...e?{replaceTab:te()}:{}})});return(0,U.jsx)(ia,{title:K(`terminal`,`tab.newChat.title`),wide:!0,children:(0,U.jsxs)(`form`,{className:hi,onKeyDown:e=>{if(e.key===`Tab`&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&(j||!e.shiftKey))e.preventDefault(),e.stopPropagation(),j?bA(e.currentTarget,CA,e.shiftKey?-1:1):ee(SA[(SA.indexOf(a)+1)%SA.length]??`tab`,s);else if(e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.toLowerCase()===`e`){e.preventDefault(),e.stopPropagation();let t=i.engines.filter(e=>e.ready!==!1),n=t[(t.findIndex(e=>e.id===i.engine)+1)%t.length];n&&i.setEngine(n.id)}else e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.toLowerCase()===`f`?(e.preventDefault(),e.stopPropagation(),ee(a,s===`fresh`?`continue`:`fresh`)):e.key===`Enter`&&j&&e.target.closest(`[data-field=attempts], [data-field=engine]`)&&(e.preventDefault(),e.currentTarget.requestSubmit())},onSubmit:e=>{e.preventDefault(),N()},onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault(),S(Array.from(e.dataTransfer.files))},children:[(0,U.jsxs)(`div`,{className:ri,children:[(0,U.jsx)(`span`,{className:`${ii}`,children:K(`terminal`,`tab.newChat.engine`)}),(0,U.jsx)(jy,{engines:i.engines,value:O,onChange:i.setEngine,withShell:T,panes:E?D:[]})]}),(0,U.jsxs)(`div`,{className:ri,children:[(0,U.jsx)(`span`,{className:`${ii}`,children:K(`terminal`,`tab.newChat.destLabel`)}),(0,U.jsx)(xy,{label:K(`terminal`,`tab.newChat.destLabel`),field:`destination`,value:a,onChange:e=>ee(e,s),choices:SA.map(e=>({id:e,label:K(`terminal`,`tab.newChat.dest${e===`tab`?`Tab`:e===`fork`?`Fork`:`Scratch`}`)}))})]}),(0,U.jsxs)(`div`,{className:ri,children:[(0,U.jsxs)(`span`,{className:`${ii}`,children:[K(`terminal`,`tab.newChat.ctxLabel`),` `,(0,U.jsx)(`span`,{className:`keys-only`,children:`ctrl+f`})]}),(0,U.jsx)(xy,{label:K(`terminal`,`tab.newChat.ctxLabel`),field:`context`,value:s,onChange:e=>ee(a,e===`continue`?`continue`:`fresh`),choices:[`fresh`,`continue`].map(e=>({id:e,label:K(`terminal`,`tab.newChat.ctx${e===`fresh`?`Fresh`:`Continue`}`)}))})]}),j&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(`span`,{className:`font-sans text-meta font-normal normal-nums text-muted`,children:K(`quickTask`,`attemptsLabel`)}),(0,U.jsx)(xy,{label:K(`quickTask`,`attemptsLabel`),field:`attempts`,value:f,onChange:p,choices:xA.map(e=>({id:e,label:e}))})]}),(0,U.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(`span`,{className:`font-sans text-meta font-normal normal-nums text-muted`,children:V(`taskops.forkBranch`)}),(0,U.jsx)(`input`,{className:Zr,"data-field":`fork-base`,spellCheck:!1,value:m,onChange:e=>g(e.target.value)})]})]}),!k&&!A&&a!==`scratch`&&(0,U.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(`span`,{className:`font-sans text-meta font-normal normal-nums text-muted`,children:V(`newChat.prompt`)}),(0,U.jsx)(`textarea`,{ref:d,className:`${Zr} ${ai}`,"data-field":`message`,autoFocus:!0,rows:4,placeholder:V(`newChat.promptPlaceholder`),value:l,onChange:e=>u(e.target.value),onPaste:e=>{let t=Array.from(e.clipboardData.files);t.length!==0&&(e.preventDefault(),S(t))},onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&e.currentTarget.form?.requestSubmit()}})]}),(0,U.jsx)(xd,{attachments:x,onRemove:C}),ff()?(0,U.jsx)(`p`,{className:`text-muted`,children:V(`pages.attachHintTouch`)}):(0,U.jsx)(`p`,{className:`keys-only mx-0 mt-2 mb-0 ${Hr}`,children:K(`quickTask`,`legend`)}),v&&(0,U.jsx)(`p`,{className:`text-error`,children:v}),(0,U.jsx)(la,{busy:_,submitLabel:V(`newChat.start`)})]})})}var TA=[`needs`,`working`,`ready`,`idle`],EA=`~state:`;function DA(e){switch(e.rowStatus?.kind){case`attention`:case`needs-input`:case`unseen`:return`needs`;case`busy`:case`running`:return`working`}switch(e.group){case`waiting-on-you`:return`needs`;case`working`:return`working`;case`landing`:case`ready-for-review`:return`ready`}return e.pr?.lifecycle===`open`||e.status===`done`?`ready`:`idle`}var OA=e=>e&&!Mo(e)?fo(e.repo):void 0;function kA(e,t){let n=No(e,t.sort),{children:r,nested:i}=Ro([{repo:``,label:``,tasks:n}]),a=n.filter(e=>!i.has(e.id)),o=yo(a),s=e=>{let t=[],n=new Set,i=e=>{if(!n.has(e.id)){n.add(e.id),t.push(e);for(let t of r.get(e.id)??[])i(t)}};return i(e),t},c=new Map;for(let e of a){let t=vo(e),n=((t===null?void 0:o.get(t))??[e]).map(s),r=n.flat().map(DA).reduce((e,t)=>TA.indexOf(t)<TA.indexOf(e)?t:e);for(let e of n)for(let t of e)c.set(t.id,r)}return TA.flatMap(e=>{let t=n.filter(t=>c.get(t.id)===e);return t.length===0?[]:[{repo:``,label:V(`rail.state.${e}`),key:`${EA}${e}`,tasks:t}]})}function AA(e){let t=new Set(e.machines.map(e=>e.alias));return{rows:Vo(kA([...e.tasks.filter(e=>!e.routine),...e.remote.filter(e=>!e.routine&&e.machine!==void 0&&t.has(e.machine.id))],e),e.query,e.fold).map(e=>{if(e.kind!==`project`)return e;let t=e.id.slice(`project:${EA}`.length);return{id:`state:${t}`,kind:`state`,state:t,label:e.label}}),groups:[]}}var jA=new Set([`refused`,`timeout`,`host-key-changed`,`host-key-unverified`,`auth-denied`,`unresolved`,`ssh-failed`,`no-rove`,`no-daemon`,`bad-status`,`handshake`,`no-forwarding`,`lost`]);function MA(e){return e&&jA.has(e)?`machines.reason.${e}`:null}function NA(e,t){return e.filter(e=>e.machine?.id===t&&!e.routine&&!e.deleting)}function PA(e){let t=TA.map(e=>({state:e,tasks:[]}));for(let n of e)t[TA.indexOf(DA(n))]?.tasks.push(n);return t.filter(e=>e.tasks.length>0)}var FA=`flex flex-col font-mono text-meta`,IA=`flex flex-col gap-1 border-t-hairline border-line py-2.5 first:border-t-0 first:pt-0`,LA=`flex flex-wrap items-baseline gap-x-2.5 gap-y-0.5`,RA=`min-w-0 text-ink wrap-anywhere`,zA=`m-0 text-muted wrap-anywhere`,BA=`flex flex-wrap gap-x-3.5 gap-y-1 pt-0.5 whitespace-nowrap`,VA=`mt-1.5 mb-0.5 text-subtle`,HA=`flex min-w-0 items-baseline gap-2 pl-2`,UA=`min-w-0 flex-1 truncate text-left`,WA=`min-w-0 max-w-[55%] flex-none truncate text-muted`;function GA(e){k.set((0,U.jsx)(YA,{model:e}))}function KA({model:e,tasks:t}){let n=t=>{B(),e.select(t.id),ye()};return PA(t).map(e=>(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`${VA} m-0`,children:V(`rail.state.${e.state}`)}),e.tasks.map(e=>(0,U.jsxs)(W,{variant:`row`,className:`${HA} w-full rounded-sm py-0.5 hover:bg-hover`,onClick:()=>n(e),children:[(0,U.jsx)(`span`,{className:UA,children:e.label}),(0,U.jsx)(`span`,{className:WA,children:e.branch})]},e.id))]},e.state))}function qA({model:e,alias:t}){let[n,r]=(0,h.useState)(null);return(0,h.useEffect)(()=>{let n=!0;return ss(e,`machines.repos`,{machine:t}).then(e=>n&&r(e),e=>n&&r({failed:e instanceof Error?e.message:String(e)})),()=>{n=!1}},[e,t]),n?`failed`in n?(0,U.jsx)(`p`,{className:zA,children:V(`machines.reposFailed`,{message:n.failed})}):n.reason?(0,U.jsx)(`p`,{className:zA,children:V(`machines.reposFailed`,{message:n.message??n.reason})}):n.repos.length===0?(0,U.jsx)(`p`,{className:zA,children:V(`machines.noRepos`)}):n.repos.map(e=>(0,U.jsxs)(`div`,{className:HA,children:[(0,U.jsx)(`span`,{className:UA,children:e.id}),(0,U.jsx)(`span`,{className:WA,title:e.primary??e.checkouts[0],children:e.primary??e.checkouts[0]??``})]},e.id)):(0,U.jsx)(`p`,{className:zA,children:V(`machines.loading`)})}function JA(e){let{model:t,row:n,tasks:r,words:i}=e,[a,o]=(0,h.useState)(null),s=n.state===`online`,c=MA(n.reason),l=PA(r).map(e=>`${e.tasks.length} ${V(`rail.state.${e.state}`)}`),u=e=>o(a===e?null:e),[d,f]=(0,h.useState)({busy:!1});return(0,U.jsxs)(`section`,{className:IA,children:[(0,U.jsxs)(`div`,{className:LA,children:[(0,U.jsx)(`span`,{className:`${RA} ${s?``:Ou.warning}`,children:vg(n,i)}),(0,U.jsx)(`span`,{className:`text-muted`,children:l.length>0?l.join(` · `):V(`machines.noTasks`)})]}),c&&(0,U.jsx)(`p`,{className:`m-0 text-muted wrap-anywhere`,children:V(c)}),(d.busy||d.note)&&(0,U.jsx)(`p`,{className:`m-0 text-muted wrap-anywhere`,children:d.busy?V(`machines.updating`):d.note}),(0,U.jsxs)(`div`,{className:BA,children:[n.behind&&(0,U.jsx)(W,{hit:`tight`,disabled:d.busy,onClick:()=>{f({busy:!0}),t.client.request(`machines.update`,{machine:n.alias}).then(e=>f({busy:!1,note:e.ok?V(e.result.changed?`machines.updated`:`machines.upToDate`,{from:e.result.from??`?`,to:e.result.to??`?`}):V(`machines.updateFailed`,{message:e.message})}),e=>f({busy:!1,note:V(`machines.updateFailed`,{message:e instanceof Error?e.message:String(e)})}))},children:V(`machines.update`)}),s&&(0,U.jsx)(W,{hit:`tight`,onClick:()=>{B(),Yb(void 0,n.alias)},children:V(`machines.newHere`)}),r.length>0&&(0,U.jsx)(W,{hit:`tight`,"aria-expanded":a===`tasks`,onClick:()=>u(`tasks`),children:V(a===`tasks`?`machines.hide`:`machines.tasks`)}),s&&(0,U.jsx)(W,{hit:`tight`,"aria-expanded":a===`repos`,onClick:()=>u(`repos`),children:V(a===`repos`?`machines.hide`:`machines.repos`)})]}),a===`tasks`&&(0,U.jsx)(KA,{model:t,tasks:r}),a===`repos`&&(0,U.jsx)(qA,{model:t,alias:n.alias})]})}function YA({model:e}){let t=H(),n=Cg(e),r=b(e.remote),i=(t===`zh`?Aa:ka).machine;return(0,U.jsx)(ia,{title:V(`machines.title`),wide:!0,children:(0,U.jsxs)(`div`,{className:`${hi} ${FA}`,children:[n.length===0&&(0,U.jsx)(`p`,{className:`m-0 text-muted wrap-anywhere`,children:V(`machines.none`)}),n.map(t=>(0,U.jsx)(JA,{model:e,row:t,tasks:NA(r,t.alias),words:i},t.alias))]})})}function XA(e,t,n=300){let r=0,i,a=()=>{r++,i?.(),i=void 0};return{stop:a,run:o=>{a();let s=o.trim();if(s.length<2){t({kind:`idle`});return}let c=r,l=setTimeout(()=>{t({kind:`searching`}),e(s).then(e=>c===r&&t({kind:`done`,query:s,reply:e}),e=>c===r&&t({kind:`failed`,message:e instanceof Error?e.message:String(e)}))},n);i=()=>clearTimeout(l)}}}var ZA=`mx-1.5 mt-2 mb-0.5 font-mono text-meta font-semibold normal-nums text-subtle first:mt-0`,QA=`mx-1.5 my-1 text-meta text-muted [overflow-wrap:anywhere]`,$A=e=>`flex w-full min-w-0 cursor-pointer flex-col gap-0.5 rounded-sm px-1.5 py-1.5 text-left text-ink [font:inherit] touch:py-2.5 ${e?`is-selected bg-hover`:``}`,ej=`flex min-w-0 items-baseline gap-2`,tj=`min-w-0 flex-1 truncate text-body`,nj=`whitespace-nowrap text-meta text-muted`,rj=`text-meta text-muted [overflow-wrap:anywhere]`,ij=`rounded-xs bg-accent/25 text-ink`;function aj(e,t){let[n,r]=(0,h.useState)({kind:`idle`});return(0,h.useEffect)(()=>{let n=XA(t=>e.client.request(`sessions.search`,{query:t}),r);return n.run(t),n.stop},[e,t]),n}function oj(e,t){let n=[],r=e.toLowerCase(),i=t.toLowerCase(),a=0;for(let t=r.indexOf(i);i&&t>=0;t=r.indexOf(i,t+i.length))t>a&&n.push(e.slice(a,t)),n.push({hit:e.slice(t,t+i.length),at:t}),a=t+i.length;return n.push(e.slice(a)),n.map(e=>typeof e==`string`?e:(0,U.jsx)(`mark`,{className:ij,children:e.hit},e.at))}function sj({children:e}){return(0,U.jsx)(`h3`,{className:ZA,children:e})}function cj({children:e,error:t}){return(0,U.jsx)(`p`,{className:`${QA} ${t?`text-error`:``}`,children:e})}function lj(e){return(0,U.jsx)(W,{variant:`row`,className:$A(e.selected),onMouseEnter:e.onHover,onClick:e.onOpen,children:(0,U.jsxs)(`span`,{className:ej,children:[(0,U.jsx)(`span`,{className:tj,children:e.title}),(0,U.jsx)(`span`,{className:nj,children:e.repo})]})})}function uj(e){let{hit:t}=e;return(0,U.jsxs)(W,{variant:`row`,className:$A(e.selected),onMouseEnter:e.onHover,onClick:e.onOpen,children:[(0,U.jsxs)(`span`,{className:ej,children:[(0,U.jsx)(`span`,{className:tj,children:t.title}),(0,U.jsxs)(`span`,{className:nj,children:[V(t.role===`user`?`search.you`:`search.agent`),` · `,_c(Date.now()-Date.parse(t.at))]})]}),(0,U.jsx)(`span`,{className:rj,children:oj(t.snippet,e.query)})]})}async function dj(e,t){let{taskId:n}=await e.client.request(`task.openScratch`);await Ny(e,n,{kind:`engine`,prompt:t}),B()}function fj(e,t){let n=V(`settings.feedback.reportPrompt`);return dj(e,t?`${n}\n\n${V(`settings.feedback.reportGiven`,t)}`:n)}function pj(e,t,n){let r=`worktrees.land.refusal.${t.refusal}`,i=e(r,{branch:t.branch??n,landedOn:t.landedOn??``,files:(t.dirtyFiles??[]).join(`, `)});return i===r?e(`worktrees.land.failed`,{error:t.message??t.refusal}):i}function mj(e){let t=e.todos;return!t||t.length===0?null:{done:t.filter(e=>e.done).length,total:t.length}}function hj(e){return(e.todos??[]).filter(e=>!e.done)}var gj=/LAND_CONFLICT/,_j=/MAIN_CHECKOUT_DIRTY/,vj=/SYNC_CONFLICT(?:: )?(.*)/,yj=/SYNC_WORKTREE_DIRTY(?:: )?(.*)/;function bj(e){let t=G(e);return gj.test(t)?K(`worktrees`,`land.conflict`,{files:t}):_j.test(t)?K(`worktrees`,`land.dirtyBase`):K(`worktrees`,`land.failed`,{error:t})}async function xj(e,t,n){if(t.machine){Sj(e,t,t.machine.label,n);return}let r;try{r=await e.client.request(`task.landPreflight`,{taskId:t.id})}catch(e){z(K(`worktrees`,`land.failed`,{error:G(e)}),`error`);return}if(r.refusal){z(r.refusal===`MAIN_CHECKOUT_DIRTY`?K(`worktrees`,`land.dirtyBase`):pj((e,t)=>{let n=K(`worktrees`,e.replace(/^worktrees\./,``),t);return n===e.replace(/^worktrees\./,``)?e:n},{...r,refusal:r.refusal},t.branch||t.title),`error`);return}let i=t.branch||t.title,a=hj(e.tasks.get()?.tasks.find(e=>e.id===t.id)??{}).length;k.set((0,U.jsx)(sa,{title:K(`worktrees`,`land.confirmTitle`),body:[K(`worktrees`,r.ahead===1?`land.confirmBodyOne`:`land.confirmBody`,{branch:i,landedOn:r.landedOn,commits:r.ahead??`?`}),...a>0?[V(`files.landTodos`,{count:a})]:[]].join(`
57
57
 
58
- `),confirmLabel:K(`worktrees`,`land.button`),onConfirm:async()=>{try{let r=await e.client.request(`task.land`,{taskId:t.id});z(K(`worktrees`,`land.done`,{branch:i,landedOn:r.landedOn,commit:r.commit.slice(0,8)})),n?.()}catch(e){throw Error(yj(e))}}}))}function xj(e,t,n,r){let i=t.branch||t.title;k.set((0,U.jsx)(sa,{title:V(`taskops.publishTitle`),body:V(`taskops.publishBody`,{branch:i,host:n}),confirmLabel:V(`taskops.publishButton`),onConfirm:async()=>{let n=await e.client.request(`task.land`,{taskId:t.id}),a=n.published?.prUrl;a?z(V(`taskops.publishedPr`,{branch:i,url:a})):z(V(`taskops.publishedNoPr`,{branch:i,reason:Cj(n.published?.prError??``)}),`error`),r?.()}}))}async function Sj(e,t){try{let n=await e.client.request(`task.syncBase`,{taskId:t});z(K(`tasks`,n.alreadyCurrent?`sync.alreadyCurrent`:`sync.done`,{base:n.baseRef}))}catch(e){let t=G(e),n=_j.exec(t),r=vj.exec(t);z(n?K(`tasks`,`sync.conflict`,{files:n[1]?.trim()||`?`}):r?K(`tasks`,`sync.dirty`,{files:r[1]?.trim()||`?`}):K(`tasks`,`sync.failed`,{error:t}),`error`)}}function Cj(e){return e.split(`
59
- `).find(e=>e.trim().length>0)?.trim()??e.trim()}async function wj(e,t,n){try{let r=await e.client.request(`task.fixChecks`,e.engineTarget(t));r.outcome===`unavailable`?z(K(`files`,`toast.ciChecksUnavailable`,{detail:Cj(r.detail??``)}),`error`):r.outcome===`none`?z(K(`files`,`toast.ciNoFailingChecks`),`error`):z(n)}catch(e){z(G(e),`error`)}}async function Tj(e,t){try{let n=await e.client.request(`task.openEditor`,{taskId:t});n.outcome===`noEditor`?z(K(`tasks`,`toast.noEditor`),`error`):n.outcome===`failed`&&z(K(`tasks`,`toast.openWorktreeFailed`,{label:n.label??``}),`error`)}catch(e){z(Fp(e)?K(`tasks`,`toast.noDiskSpace`):K(`tasks`,`toast.worktreeErrorGeneric`,{message:G(e)}),`error`)}}function Ej(e,t){let n=e.tasks.get();return[...n?.tasks??[],...n?.archived??[]].filter(e=>e.parentTaskId===t)}function Dj(e,t){let n=Ej(e,t.id),r=n.length>0,i=n=>e.act(`task.delete`,{taskId:t.id,...n}).then(()=>{}),a=e=>`${K(`worktrees`,`delete.forceBody`,{branch:t.branch||t.title})}\n\n${K(`worktrees`,`delete.forceReason`,{reason:G(e).replace(`task ${t.id} `,``)})}`,o=async e=>{i(e).catch(n=>{if(e.force||!(n instanceof Pc)||n.code!==`DIRTY_WORKTREE`){z(G(n),`error`);return}k.set((0,U.jsx)(sa,{title:K(`tasks`,`confirm.forceDeleteTitle`,{title:t.label}),body:a(n),confirmLabel:K(`tasks`,`confirm.forceDeleteConfirm`),onConfirm:()=>o({...e,force:!0})}))})};return(0,U.jsx)(sa,{title:r?K(`tasks`,`confirm.childrenTitle`,{title:t.label,count:String(n.length)}):K(`tasks`,t.kind===`dir`?`confirm.deleteTitleDir`:`confirm.deleteTitle`,{title:t.label}),body:r?K(`tasks`,`confirm.childrenBody`):K(`tasks`,t.kind===`dir`?`confirm.deleteBodyDir`:`confirm.deleteBodyTask`),confirmLabel:K(`tasks`,r?`confirm.childrenPromote`:`confirm.deleteConfirm`),onConfirm:()=>o({}),...r?{secondary:{label:K(`tasks`,`confirm.childrenCascade`),onConfirm:()=>o({cascade:!0})}}:{}})}async function Oj(e,t){let n=t.archived!==!0,r=t.label,i=async i=>{await e.act(`task.archive`,{taskId:t.id,archived:n,...i}),z(K(`tasks`,n?`archive.done`:`archive.restored`,{title:r}))},a=async e=>{try{await i(e)}catch(t){if(n&&t instanceof Pc&&t.code===`TASK_BUSY`){k.set((0,U.jsx)(sa,{title:K(`tasks`,`archive.busyTitle`),body:K(`tasks`,`archive.busyBody`,{title:r}),confirmLabel:K(`tasks`,`archive.busyConfirm`),onConfirm:()=>i({...e,force:!0})}));return}z(K(`tasks`,n?`archive.failed`:`archive.restoreFailed`,{error:G(t)}),`error`)}},o=n?(e.tasks.get()?.tasks??[]).filter(e=>e.parentTaskId===t.id):[];if(o.length===0)return a({});k.set((0,U.jsx)(sa,{title:K(`tasks`,`confirm.childrenTitle`,{title:r,count:String(o.length)}),body:K(`tasks`,`confirm.archiveChildrenBody`),confirmLabel:K(`tasks`,`confirm.childrenPromote`),onConfirm:async()=>void a({promote:!0}),secondary:{label:K(`tasks`,`confirm.archiveChildrenAll`),onConfirm:async()=>void a({})}}))}function kj(e,t,n){return(0,U.jsx)(sa,{title:K(`tasks`,`confirm.forgetProjectTitle`,{title:n}),body:K(`tasks`,`confirm.forgetProjectBody`),confirmLabel:K(`tasks`,`confirm.forgetProjectConfirm`),onConfirm:async()=>{try{await e.client.request(`project.forget`,{repo:t})}catch(e){throw Error(K(`tasks`,`toast.forgetProjectFailed`,{error:G(e)}))}}})}var Aj=y(null),jj=0;function Mj(e,t){Aj.set({taskId:e,hit:t,nonce:++jj}),_w(e,`chat`)}var Nj=10;function Pj(e,t){let n=e=>e.surface===t?0:e.surface?1:2,r=tc().filter(n=>nc(n,t)&&n.live?.(e)!==!1).map((e,t)=>({command:e,index:t})).sort((e,t)=>n(e.command)-n(t.command)||Number(e.command.prefix)-Number(t.command.prefix)||e.index-t.index),i=new Set,a=[];for(let{command:e}of r){let t=e.chords[0];!t||e.id===`palette.open`||i.has(e.id)||(i.add(e.id),a.push({command:e,name:sA(e.id),raw:e.prefix?`${Us()} + ${t}`:t}))}return a}function Fj(e){let t=document.activeElement instanceof HTMLElement?document.activeElement:null;k.set((0,U.jsx)(Lj,{model:e,surface:ic(),origin:t}))}var Ij=8;function Lj({model:e,surface:t,origin:n}){H();let[r,i]=(0,h.useState)(``),[a,o]=(0,h.useState)(0),s=(0,h.useRef)(null),c=b(Rs),l=b(e.tasks),u=b(e.remote),d=(0,h.useMemo)(()=>Pj(e,t),[e,t,c]).filter(e=>Hk(r,e.name,e.raw)),f=(Cg(e).length>0?[{name:V(`machines.title`)}]:[]).filter(e=>Hk(r,e.name,``)),p=[{name:V(`settings.feedback.report`)}].filter(e=>Hk(r,e.name,``)),m=r.trim(),g=m===``?[]:[...l?.tasks??[],...u,...l?.archived??[]].filter(e=>!e.routine&&!e.deleting&&[e.label,e.title,e.branch,fo(e.repo)].some(e=>e!==``&&co(m,e))).slice(0,Ij),_=b(e.installedMods).has(`issues`),v=[{id:`usage`,name:V(`usage.title`)},..._?[{id:`issues`,name:V(`reviewQueue.palette`),source:`reviews`}]:[]].filter(e=>m===``||co(m,e.name)),y=ij(e,r),x=y.kind===`done`?y.reply.matches:[],S=[...d.map(e=>({kind:`command`,row:e})),...v.map(e=>({kind:`page`,...e})),...f.map(e=>({kind:`machines`,...e})),...p.map(e=>({kind:`report`,...e})),...g.map(e=>({kind:`task`,task:e})),...x.map(e=>({kind:`hit`,hit:e}))],C=Math.min(a,Math.max(0,S.length-1));(0,h.useEffect)(()=>()=>n?.focus(),[n]),(0,h.useEffect)(()=>{s.current?.querySelector(`.is-selected`)?.scrollIntoView({block:`nearest`})},[C]);let w=t=>{if(t.kind===`machines`){WA(e);return}if(B(),n?.focus(),t.kind===`report`){dj(e).catch(()=>z(V(`settings.feedback.reportFailed`),`error`));return}if(t.kind===`command`){t.row.command.live?.(e)===!1?z(aA(`unavailable`),`error`):t.row.command.run(e);return}if(t.kind===`page`){t.source&&_T.set(t.source),xe(t.id);return}t.kind===`task`&&t.task.archived&&Oj(e,t.task),t.kind===`task`?e.select(t.task.id):e.select(t.hit.taskId,t.hit.tabId??null),ye(),t.kind===`hit`&&Mj(t.hit.taskId,t.hit)},T=e=>{if(e.key===`ArrowDown`)o(Math.min(S.length-1,C+1));else if(e.key===`ArrowUp`)o(Math.max(0,C-1));else if(e.key===`Enter`){let e=S[C];e&&w(e)}else return;e.preventDefault()},E=m!==``&&(g.length>0||m.length>=2),D=0,O=()=>D++;return(0,U.jsx)(ia,{title:aA(`palette`),wide:!0,children:(0,U.jsxs)(`div`,{className:`${hi} palette`,onKeyDown:T,children:[(0,U.jsx)(`input`,{className:An,autoFocus:!0,spellCheck:!1,value:r,placeholder:aA(`search`),onChange:e=>{i(e.target.value),o(0)}}),(0,U.jsxs)(`div`,{className:Dn,ref:s,style:{maxHeight:`${(E?18:Nj)*1.9}em`},children:[S.length===0&&y.kind!==`searching`&&(0,U.jsx)(`p`,{className:`text-muted`,children:aA(`noResults`)}),E&&d.length>0&&(0,U.jsx)(oj,{children:V(`search.commands`)}),d.map(e=>{let t=O();return(0,U.jsx)(`button`,{type:`button`,className:On(t===C),title:e.name,onMouseEnter:()=>o(t),onClick:()=>w({kind:`command`,row:e}),children:(0,U.jsx)(`span`,{className:kn,children:`${t===C?`› `:` `}${e.name}`})},e.command.id)}),v.map(e=>{let t=O();return(0,U.jsx)(W,{variant:`row`,className:On(t===C),title:e.name,onMouseEnter:()=>o(t),onClick:()=>w({kind:`page`,...e}),children:(0,U.jsx)(`span`,{className:kn,children:`${t===C?`› `:` `}${e.name}`})},e.id)}),f.map(e=>{let t=O();return(0,U.jsx)(W,{variant:`row`,className:On(t===C),title:e.name,onMouseEnter:()=>o(t),onClick:()=>w({kind:`machines`,...e}),children:(0,U.jsx)(`span`,{className:kn,children:`${t===C?`› `:` `}${e.name}`})},`machines`)}),p.map(e=>{let t=O();return(0,U.jsx)(W,{variant:`row`,className:On(t===C),title:e.name,onMouseEnter:()=>o(t),onClick:()=>w({kind:`report`,...e}),children:(0,U.jsx)(`span`,{className:kn,children:`${t===C?`› `:` `}${e.name}`})},`report`)}),g.length>0&&(0,U.jsx)(oj,{children:V(`search.tasks`)}),g.map(e=>{let t=O();return(0,U.jsx)(cj,{title:e.label,repo:e.archived?V(`search.archived`,{repo:fo(e.repo)}):fo(e.repo),selected:t===C,onHover:()=>o(t),onOpen:()=>w({kind:`task`,task:e})},e.id)}),y.kind!==`idle`&&(0,U.jsx)(oj,{children:V(`search.inConversations`)}),y.kind===`searching`&&(0,U.jsx)(sj,{children:V(`search.searching`)}),y.kind===`failed`&&(0,U.jsx)(sj,{error:!0,children:y.message}),y.kind===`done`&&x.length===0&&(0,U.jsx)(sj,{children:V(`search.none`,{query:y.query})}),x.map(e=>{let t=O();return(0,U.jsx)(lj,{hit:e,query:y.kind===`done`?y.query:``,selected:t===C,onHover:()=>o(t),onOpen:()=>w({kind:`hit`,hit:e})},`${e.taskId}:${e.tabId??``}:${e.at}:${t}`)}),y.kind===`done`&&y.reply.truncated&&(0,U.jsx)(sj,{children:V(`search.truncated`)}),y.kind===`done`&&y.reply.skipped.length>0&&(0,U.jsx)(sj,{children:V(`search.skipped`,{count:y.reply.skipped.length})})]}),(0,U.jsx)(`p`,{className:`keys-only text-muted`,children:aA(`run`)})]})})}var Rj=y(null);function zj(e){let t=(document.activeElement?.closest(`.rail`)==null?null:Rj.get())??e.selection.get().taskId;return e.tasks.get()?.tasks.find(e=>e.id===t)??null}var Bj=[`latest`,`next`,`nightly`],Vj={appearance:{enabled:`On`,disabled:`Off`,borderFlow:`Flowing gradient`,borderStill:`Still`,glyphsBraille:`Braille`,glyphsStarburst:`Starburst (needs a font with the Dingbats block)`,glyphsAscii:`ASCII`,titleShimmer:`Shimmer`,titleStill:`Still`,preview:`Workspace preview`,tasks:`Tasks`,terminal:`Terminal`,files:`Files`,testsPassed:`Tests passed`,transparent:`Transparent background`,opaque:`Opaque background`,modeDark:`Dark`,modeLight:`Light`,modeAuto:`Auto (follow the terminal)`,openHint:`Enter to choose an option and preview it.`,chooseHint:`↑/↓ or j/k preview · enter apply · esc cancel`,importFromTerminal:`Import from {terminal}`,themePackage:`· package: colours here, layout and components in the web client`,syncFromTerminal:`Sync from {terminal}`}},Hj={appearance:{enabled:`开启`,disabled:`关闭`,borderFlow:`流动渐变`,borderStill:`静止`,glyphsBraille:`盲文点`,glyphsStarburst:`星芒(需要含 Dingbats 符号区的字体)`,glyphsAscii:`ASCII`,titleShimmer:`流光`,titleStill:`静止`,preview:`工作区预览`,tasks:`任务`,terminal:`终端`,files:`文件`,testsPassed:`测试通过`,transparent:`透明背景`,opaque:`不透明背景`,modeDark:`深色`,modeLight:`浅色`,modeAuto:`自动(跟随终端)`,openHint:`按 Enter 打开选项和预览。`,chooseHint:`↑/↓ 或 j/k 预览 · enter 应用 · esc 取消`,importFromTerminal:`从 {terminal} 导入`,themePackage:`· 主题包:这里只画配色,布局和组件在 web 端`,syncFromTerminal:`从 {terminal} 重新同步`}},Uj={autoRouting:{title:`Auto routing`,hint:"Routing by depth: a task says how deep the work is — swift, standard, deep — and this table says which engine, model and reasoning effort that depth runs on. Pick a depth in the new-task dialog (or `rove api add --tier`) and Rove fills those three fields from the row; you still see them and can change them before the task starts. enter (or click) a row to point it somewhere else, with the same picker a task uses. A row whose target cannot start says why here, not at launch.",unconfigured:`Auto routing is off: a depth has nowhere to route — its engine is blank. Point it somewhere below, or remove the empty autoRouting.<tier>.engine from state.json.`,engineDefault:`engine default`,ready:`● ready`,unavailable:`! unavailable — {reason}`,classifierTitle:`Classifier`,classifierHint:"The rows above say what each depth RUNS. This says who CHOOSES one: switch it on and `rove api add --tier auto` reads the task's first message and picks the depth for you. It is off by default, it is never required, and it can never fail a create — no key, no network, a timeout, or an answer it is not confident enough about all leave you on the depth you would have had.",classifierDataFlow:"! Turning the classifier on sends the task's first message to a third party that is NOT the engine vendor you picked — TypeSafe System One for `jev`, or whatever address you point `custom` at. It reads the text before your engine does. Nothing leaves this machine while it is off.",classifierLabel:`Choose with`,classifierOff:`off`,classifierCustomLabel:`custom`,classifierOffHint:`— nothing is sent anywhere`,classifierJevHint:`— TypeSafe System One, billed to your own key`,classifierCustomHint:`— your endpoint: POST the text, answer with a depth and a confidence`,endpointLabel:`Endpoint`,endpointUnset:`(none — enter one, then set Choose with to custom)`,endpointTitle:`Custom classifier endpoint`,endpointField:`URL`,endpointInvalidTitle:`Not a URL`,endpointInvalidBody:`The endpoint has to start with https://, or http:// for a loopback address (127.0.0.1, localhost, ::1) — over a network, plain http would carry the task's first 1,200 characters in cleartext. Leave it empty to clear it.`,thresholdLabel:`Confidence floor`,thresholdHint:`— below this, the depth is left alone`,thresholdTitle:`Confidence floor`,thresholdField:`0 to 1`,thresholdInvalidTitle:`Not a confidence`,thresholdInvalidBody:`The floor is a number between 0 and 1. 0.5 is the shipped default.`,keyLabel:`API key`,keyStored:`stored {hint} — enter to replace, empty to clear`,keyFromEnv:"from ${env} — the environment wins over a stored key",keyNone:`not set — enter to paste one`,keyTitle:`{env}`,keyPlaceholder:`paste the key; leave empty to clear the stored one`,keySaved:`● key stored in ~/.rove/secrets.json (owner-only, never in state.json)`,keyCustomUnused:`● no Authorization header is sent to a custom endpoint — set autoRouting.classifierCustomKeyEnv to the variable holding its key if it needs one`,keyNoVariableTitle:`No key variable for this endpoint`,keyNoVariableBody:`A custom classifier endpoint is sent no Authorization header until autoRouting.classifierCustomKeyEnv names the variable its key lives in. Set that first — a key stored under a name nothing reads is a key at rest for no purpose.`,keyWriteFailedTitle:`Key not saved`,keyWriteFailedBody:`~/.rove/secrets.json could not be written: {reason}. Check directory permissions and disk space, then save again.`,keyMissing:`! no key — nothing is chosen and tasks keep their usual depth`,keyPresentEnv:"● key read from ${env} in this process's environment"}},Wj={autoRouting:{title:`自动路由`,hint:"按深度路由:任务说明这活有多深——轻快、标准、深入——这张表说明那一档跑在哪个引擎、哪个模型、哪个推理强度上。在新建任务对话框里选一档(或 `rove api add --tier`),Rove 就照那一行填进这三个字段;任务启动前你仍然看得见、改得了。enter(或点击)某一行,用和任务一样的选择器把它指到别处。目标起不来的行会在这里说明原因,而不是等到启动时才炸。",unconfigured:`自动路由已关闭:有一档无处可去——它的引擎是空的。在下面把它指到某个引擎,或从 state.json 里删掉空的 autoRouting.<tier>.engine。`,engineDefault:`引擎默认`,ready:`● 可用`,unavailable:`! 不可用——{reason}`,classifierTitle:`分类器`,classifierHint:"上面几行说的是每一档**跑什么**,这里决定**由谁来选**:打开之后,`rove api add --tier auto` 会读任务的第一句话替你选档。默认关着,从来不是必需的,也永远不会让建 task 失败——没 key、断网、超时、或者它自己没把握,都只是让你停在本来就会用的那一档上。",classifierDataFlow:"! 打开分类器,任务的第一句话会发给一个**不是你选的那个引擎厂商**的第三方——`jev` 是 TypeSafe System One,`custom` 是你自己填的地址。它比你的引擎更早读到这段文字。关着的时候什么都不发。",classifierLabel:`选档方式`,classifierOff:`关`,classifierCustomLabel:`自定义`,classifierOffHint:`——不向任何地方发送`,classifierJevHint:`——TypeSafe System One,走你自己的 key 计费`,classifierCustomHint:`——你自己的接口:POST 那段文本,返回一个档位加一个置信度`,endpointLabel:`接口地址`,endpointUnset:`(未填——先填一个,再把「选档方式」切到自定义)`,endpointTitle:`自定义分类器接口`,endpointField:`URL`,endpointInvalidTitle:`不是一个 URL`,endpointInvalidBody:`接口地址要以 https:// 开头;http:// 只在回环地址(127.0.0.1、localhost、::1)上接受——发到网络上的话,明文 http 会把任务的前 1200 个字符原样带走。留空则清除。`,thresholdLabel:`置信度下限`,thresholdHint:`——低于这个值就不动档位`,thresholdTitle:`置信度下限`,thresholdField:`0 到 1`,thresholdInvalidTitle:`不是一个置信度`,thresholdInvalidBody:`下限是 0 到 1 之间的数。出厂默认 0.5。`,keyLabel:`API key`,keyStored:`已存 {hint}——enter 可替换,留空清除`,keyFromEnv:"来自环境变量 ${env}——环境变量优先于存起来的那个",keyNone:`未设置——enter 粘贴一个`,keyTitle:`{env}`,keyPlaceholder:`粘贴 key;留空则清除已存的那个`,keySaved:`● key 存在 ~/.rove/secrets.json(仅本人可读,不会进 state.json)`,keyCustomUnused:`● 自定义接口不会收到 Authorization 头——它若需要凭据,把 autoRouting.classifierCustomKeyEnv 指向存它的变量`,keyNoVariableTitle:`这个接口还没有 key 变量`,keyNoVariableBody:`在 autoRouting.classifierCustomKeyEnv 指定存 key 的变量之前,自定义分类器接口不会收到任何 Authorization 头。先设那个——存在一个没人读的名字下面的 key,只是白白落在盘上。`,keyWriteFailedTitle:`key 没存下`,keyWriteFailedBody:`写不了 ~/.rove/secrets.json:{reason}。请检查目录权限和磁盘空间,再次保存。`,keyMissing:`! 没有 key——不会替你选档,任务保持原来的档位`,keyPresentEnv:"● key 来自本进程环境变量 ${env}"}},Gj={dev:{reset:`Reset UI state`,resetHint:`Clears ~/.config/rove/state.json and ~/.rove/tasks.json, then quits Rove — relaunch to start fresh. Working session list, pane sizes, theme, model picks all reset. Worktrees on disk and engine session history are not touched.`,resetButton:`[enter] Reset`,restart:`Restart backend`,restartHint:`Stops the Rove daemon and relaunches this window on the installed build — picks up daemon / orchestrator / engine edits without quitting by hand. Running engine sessions live in the PTY host and survive it; other attached Rove windows reconnect on their own.`,restartButton:`[enter] Restart`,reload:`Reload settings`,reloadHint:"Applies hand edits to ~/.config/rove/state.json (from `rove config`) to this window without a restart.",reloadButton:`[enter] Reload`,reloadDone:`Reloaded: {count} changed.`,reloadUnchanged:`Already matches state.json; nothing changed.`,reloadFailed:`state.json could not be read, nothing changed: {error}`,doctorHint:"Daemon wedged or unresponsive? Restart backend does it from here; from a shell it is `rove daemon restart`. Hosted engine sessions stay alive across a daemon restart.",experimental:`Experimental`,remoteHint:"Remote projects (SSH): register a project whose git worktrees live on another host, driven from this local Rove. Unfinished — Hosted PTY engine launch over SSH is not implemented, and file/diff panes still degrade. Enables `rove add --remote`.",remote:`Remote projects`,autoStatusHint:`Auto status flow: a backlog task moves to in_progress when its engine starts a turn, and new sessions get a system-prompt note telling the agent to set in_review itself when the work is done. Never touches done/canceled.`,autoStatus:`Auto status flow`,dispatcherHint:"Field-notes dispatcher: task sessions file one-line gotchas (`rove api note`), and every session of that repo that starts later is handed them.",dispatcher:`Field-notes dispatcher`}},Kj={dev:{reset:`重置 UI 状态`,resetHint:`清空 ~/.config/rove/state.json 和 ~/.rove/tasks.json,然后退出 Rove——重新启动即可从头开始。工作会话列表、面板尺寸、主题、模型选择都会重置。磁盘上的 worktree 和引擎会话历史不受影响。`,resetButton:`[enter] 重置`,restart:`重启后端`,restartHint:`停止 Rove daemon,并以已安装的版本重新启动当前窗口——无需手动退出即可应用 daemon / orchestrator / engine 的改动。正在运行的引擎会话由 PTY host 托管,不受影响;其他已连接的 Rove 窗口会自行重连。`,restartButton:`[enter] 重启`,reload:`重新加载设置`,reloadHint:"把对 ~/.config/rove/state.json 的手动修改(来自 `rove config`)应用到当前窗口,无需重启。",reloadButton:`[enter] 重新加载`,reloadDone:`已重新加载:{count} 项有变化。`,reloadUnchanged:`已与 state.json 一致,没有变化。`,reloadFailed:`无法读取 state.json,未做任何改动:{error}`,doctorHint:"daemon 卡住或无响应?「重启后端」就能在这里完成;在 shell 里则是 `rove daemon restart`。Hosted PTY 引擎会话不会因 daemon 重启而退出。",experimental:`实验性`,remoteHint:"远程项目(SSH):注册一个 git worktree + 引擎都通过 SSH 跑在另一台主机上、由本地 Rove 驱动的项目。尚未完成——文件/diff 面板对远程仍会降级。启用 `rove add --remote`。",remote:`远程项目`,autoStatusHint:`自动状态流转:backlog 任务在其引擎开始一轮时移到 in_progress,新会话会拿到一条系统提示,告诉 agent 完成后自行设为 in_review。绝不触碰 done/canceled。`,autoStatus:`自动状态流转`,dispatcherHint:"现场笔记调度器:任务会话提交一行经验(`rove api note`),之后在该仓库启动的每个会话都会拿到这些笔记。",dispatcher:`现场笔记调度器`}},qj={engines:{title:`Engines`,hint:`Engines Rove can start on this machine. New tasks start with the default engine; switch an engine off to stop offering it.`,keys:`space available · d default · enter launch command · r rename · x reset/remove`,customTag:`custom`,available:`available`,off:`off`,defaultMark:`default`,makeDefault:`Make default`,status:{checking:`Checking…`,unknown:`Status unknown`,ready:`Ready`,notInstalled:`Not installed`,notOnPath:`Not on PATH`,signIn:`Sign in needed`,integrationMissing:`Integration not installed`,integrationOutdated:`Integration outdated`,integrationBlocked:`Integration blocked`},detail:{program:`Program`,command:`Command`,signIn:`Sign-in`,reporting:`Live status`,adapter:`Adapter`,programFound:`{binary} found at {path}.`,programFoundVersion:`{binary} {version} found at {path}.`,programMissing:`{binary} is not on PATH. Install the engine's CLI, or point its launch command at it.`,programUnknown:`Rove could not check for {binary}.`,commandDefault:`{command} (the default)`,commandCustom:`{command} (yours)`,signedIn:`Signed in.`,signedInAs:`Signed in as {who}.`,apiKey:`An API key is configured.`,token:`A token is configured ({source}).`,signedOut:`Not signed in. Sign in with the engine's own CLI.`,signInUnknown:`Rove can't see whether this engine is signed in.`,signInFailed:`Sign-in check failed: {error}`,hooksInstalled:`Rove's hooks are installed, so tabs report their state as it changes.`,hooksOutdated:`Rove's hooks are from an older version; reinstall them under Engine integrations.`,hooksMissing:`Rove's hooks are not installed; install them under Engine integrations.`,hooksAwaitEngine:`Rove's hooks can be installed once the engine is.`,hooksUnsupported:`This engine has no hooks for Rove to install.`,hooksBlocked:`Rove can't write its hooks into {file}: {reason}`,hooksBlockedHere:`Rove can't write its hooks into the engine's config: {reason}`,markersYes:`It leaves turn-complete markers that Rove reads back.`,markersNo:`It leaves no turn-complete markers.`,screenYes:`Screen rules cover what the hooks don't.`,screenNo:`No screen rules.`,screenNotNeeded:`No screen rules; the hooks report everything.`,adapterDeclared:`Borrows the {protocol} adapter.`,adapterGeneric:`Generic adapter: no transcript reader, sign-in check or resume.`,skill:`Rove skill`,skillInstalled:`Installed in {dir}.`,skillInstalledHere:`Installed and current.`,skillOutdated:`From an older Rove; reinstall it under Rove agent skill.`,skillMissing:`Not installed; install it under Rove agent skill.`},skill:{title:`Rove agent skill`,hint:`Teaches the agent in each engine to drive Rove itself (rove api): start tasks, read other sessions, message them.`,install:`Install ({count})`,noEngines:`No engine here takes the skill`,failed:`Install failed: {reason}`,bannerTitle:`ROVE SKILL NOT INSTALLED`,bannerHint:`{engines} can't drive Rove yet (start tasks, read other sessions). Click here to install.`,bannerHintWeb:`{engines} can't drive Rove yet (start tasks, read other sessions).`},integrations:{title:`Engine integrations`,hint:`Hooks Rove writes into each engine's own config, so a tab shows working, waiting or done the moment it happens.`,summary:`{installed} of {total} installed`,install:`Install missing ({count})`,upToDate:`All up to date`,remove:`Remove all ({count})`,noneInstalled:`Nothing to remove`},addEngine:`+ Add engine`,permissionsTitle:`Permissions`,permissionBypass:`Skip permission prompts`,permissionBypassHint:`Starts Claude, Codex, Antigravity and Cursor with their skip-permissions flag so unattended sessions don't stall on an approval. Left alone if your launch command already picks a mode.`,launchCommandTitle:`{name} launch command`,displayNameTitle:`{name} display name (blank = default)`,addTitle:`Add engine`,addStepTitle:`Add engine · {id}`,protocolTitle:`Add engine · {id} — protocol`,protocolNone:`None — generic adapter`,protocolFooter:`↑↓ choose · enter pick · esc cancel`,protocolRow:`protocol {protocol}`,protocolGeneric:`generic`,idPlaceholder:`lowercase slug, e.g. aider`,commandPlaceholder:`e.g. aider --model sonnet`,hookTrustHint:`Open {command} in the engine and approve hooks yourself. Written hooks are not proof of trust.`,readiness:`CLI: {cli} · login: {login} · hooks: {hooks}`,cliReady:`available`,cliMissing:`missing; install the engine CLI`,loginReady:`detected`,loginMissing:`sign in with the engine CLI`,readinessUnknown:`not observable`,hooksWritten:`written`,hooksMissing:`not written; Settings → Engines`,hooksOutdated:`outdated; Settings → Engines`,hookWaiting:`No hook event received yet. After approval, send a short prompt to verify activity.`,hookReceived:`Hook event recorded for this tab. Send a short prompt to check current reporting; current trust is not inferred.`,readinessFailed:`Readiness check unavailable; run rove doctor. No authorization is inferred.`},accounts:{checking:`Checking…`,notLoggedIn:`○ Not logged in`,loggedIn:`● Logged in: {email}`,apiKeyConfigured:`● API key configured`,chatgptLogin:`● ChatGPT login: {email}`,tokenConfigured:`● Token configured ({source})`,detected:`● Login detected`}},Jj={engines:{title:`引擎`,hint:`Rove 能在这台机器上启动的引擎。新任务默认用「默认」引擎;关掉某个引擎,选引擎时就不再列出它。`,keys:`space 可用 · d 设为默认 · enter 启动命令 · r 重命名 · x 重置/移除`,customTag:`自定义`,available:`可用`,off:`已关`,defaultMark:`默认`,makeDefault:`设为默认`,status:{checking:`检查中…`,unknown:`状态未知`,ready:`就绪`,notInstalled:`未安装`,notOnPath:`不在 PATH 上`,signIn:`需要登录`,integrationMissing:`未安装接入`,integrationOutdated:`接入已过期`,integrationBlocked:`接入被拒绝`},detail:{program:`程序`,command:`命令`,signIn:`登录`,reporting:`实时状态`,adapter:`适配器`,programFound:`{binary} 位于 {path}。`,programFoundVersion:`{binary} {version} 位于 {path}。`,programMissing:`{binary} 不在 PATH 上。请安装引擎 CLI,或把启动命令指向它。`,programUnknown:`Rove 无法检查 {binary}。`,commandDefault:`{command}(默认)`,commandCustom:`{command}(自定义)`,signedIn:`已登录。`,signedInAs:`已登录:{who}。`,apiKey:`已配置 API key。`,token:`已配置 Token({source})。`,signedOut:`未登录。请用引擎自己的命令行登录。`,signInUnknown:`Rove 无法得知该引擎是否已登录。`,signInFailed:`登录检查失败:{error}`,hooksInstalled:`Rove 的钩子已安装,标签页的状态会实时上报。`,hooksOutdated:`Rove 的钩子来自旧版本;请在「引擎接入」里重新安装。`,hooksMissing:`Rove 的钩子未安装;请在「引擎接入」里安装。`,hooksAwaitEngine:`引擎安装后才能装 Rove 的钩子。`,hooksUnsupported:`该引擎没有可供 Rove 安装的钩子。`,hooksBlocked:`Rove 无法把钩子写入 {file}:{reason}`,hooksBlockedHere:`Rove 无法把钩子写入引擎配置:{reason}`,markersYes:`它会留下回合完成标记,Rove 可以读回。`,markersNo:`它不留下回合完成标记。`,screenYes:`读屏规则兜底钩子覆盖不到的状态。`,screenNo:`没有读屏规则。`,screenNotNeeded:`没有读屏规则;钩子已报全所有状态。`,adapterDeclared:`借用 {protocol} 适配器。`,adapterGeneric:`通用适配器:没有会话记录读取、登录检查和恢复。`,skill:`Rove 技能`,skillInstalled:`已安装在 {dir}。`,skillInstalledHere:`已安装,是最新版。`,skillOutdated:`来自旧版 Rove;请在「Rove 智能体技能」里重新安装。`,skillMissing:`未安装;请在「Rove 智能体技能」里安装。`},skill:{title:`Rove 智能体技能`,hint:`教会各引擎里的智能体自己操作 Rove(rove api):开任务、读其他会话、给它们发消息。`,install:`安装({count})`,noEngines:`这台机器上没有能装技能的引擎`,failed:`安装失败:{reason}`,bannerTitle:`ROVE 技能未安装`,bannerHint:`{engines} 还不能操作 Rove(开任务、读其他会话)。点这里安装。`,bannerHintWeb:`{engines} 还不能操作 Rove(开任务、读其他会话)。`},integrations:{title:`引擎接入`,hint:`Rove 写进各引擎自身配置的钩子,让标签页在工作、等待、完成的那一刻就显示出来。`,summary:`已安装 {installed}/{total}`,install:`安装缺失的({count})`,upToDate:`全部已是最新`,remove:`全部移除({count})`,noneInstalled:`没有可移除的`},addEngine:`+ 添加引擎`,permissionsTitle:`权限`,permissionBypass:`跳过权限确认`,permissionBypassHint:`启动 Claude、Codex、Antigravity、Cursor 时带上它们跳过权限确认的参数,免得无人值守的会话卡在审批上。启动命令里已经选了权限模式的不再追加。`,launchCommandTitle:`{name} 的启动命令`,displayNameTitle:`{name} 的显示名称(留空 = 默认)`,addTitle:`添加引擎`,addStepTitle:`添加引擎 · {id}`,protocolTitle:`添加引擎 · {id} —— 协议`,protocolNone:`无 —— 通用适配器`,protocolFooter:`↑↓ 选择 · enter 确认 · esc 取消`,protocolRow:`协议 {protocol}`,protocolGeneric:`通用`,idPlaceholder:`小写短名,如 aider`,commandPlaceholder:`如 aider --model sonnet`,hookTrustHint:`在引擎中打开 {command},由你自行批准 hooks。写入不代表已授权。`,readiness:`CLI:{cli} · 登录:{login} · hooks:{hooks}`,cliReady:`可用`,cliMissing:`缺失;请安装引擎 CLI`,loginReady:`已检测到`,loginMissing:`请通过引擎 CLI 登录`,readinessUnknown:`无法观测`,hooksWritten:`已写入`,hooksMissing:`未写入;设置 → 引擎`,hooksOutdated:`已过时;设置 → 引擎`,hookWaiting:`尚未收到 hook 事件。授权后发送一条简短提示,验证活动状态。`,hookReceived:`已记录此标签页的 hook 事件。发送简短提示以检查当前上报;不据此推断当前授权。`,readinessFailed:`无法检查就绪状态;请运行 rove doctor。不会据此推断已授权。`},accounts:{checking:`检查中…`,notLoggedIn:`○ 未登录`,loggedIn:`● 已登录: {email}`,apiKeyConfigured:`● 已配置 API key`,chatgptLogin:`● ChatGPT 登录: {email}`,tokenConfigured:`● 已配置 Token ({source})`,detected:`● 检测到登录`}},Yj={plugins:{title:`Plugins`,hint:"Rove's first-party mods first: enter (or click) installs or uninstalls one, and uninstalling keeps its data on disk. Then the plugins registered in ~/.rove/plugins.json: enter toggles one on or off — the daemon watches the file, so the change applies live. Rows indented under a plugin are the settings it declares; enter edits one, and the value reaches the plugin on its next run. Install and remove them from the shell: `rove plugin install <owner/repo>`, `rove plugin link <dir>`.",empty:"Kanban and Issues are first-party mods: enter (or click) installs one. No other plugins registered; add one with `rove plugin install <owner/repo>` — browse the `rove-plugin` topic on GitHub.",sourceLink:`linked {path}`,sourceGithub:`{spec}`,sourceBuiltIn:`first-party mod · not installed`,sourceBuiltInInstalled:`first-party mod · installed`,updateAvailable:`update available — rove plugin update`,declares:`{actions} actions · {events} events · {panes} panes`,declaresWithEngines:`{actions} actions · {events} events · {panes} panes · {engines} engines`,declaresPages:`· {pages} pages`,pageFailed:`page {detail}`,manifestUnreadable:`manifest unreadable; check the rove-plugin.toml path and TOML syntax`,unsupportedPlatform:`· not supported on this platform`,noHooks:`· no hooks declared`,lastRun:`· last run {label} {status} {ago} ago`,neverRun:`· never run`,runOk:`ok`,runRunning:`still running`,runFailed:"failed to start; inspect `rove plugin log <id>`",runExit:`exit {code}`,settingUnset:`(unset — enter to edit)`,settingInvalidTitle:`Not a number`,settingInvalidBody:`{label} only accepts a number. Keeping the previous value.`},marketplace:{title:`Marketplace`,hint:"Plugins published under the `rove-plugin` topic on GitHub, most-starred first. enter (or click) shows what the install would run and asks before running any of it. The listing is re-queried each time you open this section.",loading:`Searching GitHub…`,empty:`No plugins listed.`,offline:`GitHub is unreachable — showing first-party plugins only. Re-open this section to retry.`,installedTag:`installed`,firstParty:`first-party`,preparing:`cloning {ref}…`,installing:`building and registering {name}…`,installed:`installed {id} v{version} — it is enabled, and appears under Plugins.`,cancelled:`install cancelled; nothing was run.`,failed:`install failed: {error}. Check the build output and retry from Marketplace.`,alreadyInstalled:`already installed as {id} — manage it under Plugins.`,confirmTitle:`Install {name}?`,confirmInstall:`install`,previewSource:`source: {source}`,previewCommands:`Commands this plugin declares:`,previewNoCommands:`This plugin declares no commands.`,previewWarning:`warning: {warning}`,previewTrust:`Installing runs the build commands above, and the rest run later on the events they declare. They run as you, with your environment, and nothing is sandboxed.`}},Xj={plugins:{title:`插件`,hint:"先列 Rove 官方 mod:enter(或点击)安装或卸载,卸载后数据仍留在磁盘上。再列在 ~/.rove/plugins.json 里注册的插件:enter 切换启用/禁用——daemon 监听该文件,改动实时生效。插件下方缩进的行是它声明的设置项,enter 编辑,新值在插件下次运行时生效。安装与移除在 shell 里做:`rove plugin install <owner/repo>`、`rove plugin link <dir>`。",empty:"Kanban 和 Issues 是官方 mod:enter(或点击)安装。尚未注册其他插件;用 `rove plugin install <owner/repo>` 安装一个——可在 GitHub 的 `rove-plugin` 话题下浏览。",sourceLink:`本地链接 {path}`,sourceGithub:`{spec}`,sourceBuiltIn:`官方 mod · 未安装`,sourceBuiltInInstalled:`官方 mod · 已安装`,updateAvailable:`有新版本 — rove plugin update`,declares:`{actions} 个动作 · {events} 个事件 · {panes} 个面板`,declaresWithEngines:`{actions} 个动作 · {events} 个事件 · {panes} 个面板 · {engines} 个引擎`,declaresPages:`· {pages} 个页面`,pageFailed:`页面 {detail}`,manifestUnreadable:`manifest 无法解析;请检查rove-plugin.toml 的路径和 TOML 语法`,unsupportedPlatform:`· 不支持当前平台`,noHooks:`· 未声明钩子`,lastRun:`· 上次运行 {label} {status} {ago}前`,neverRun:`· 尚未运行过`,runOk:`成功`,runRunning:`仍在运行`,runFailed:"启动失败;请查看 `rove plugin log <id>`",runExit:`退出码 {code}`,settingUnset:`(未设置 — enter 编辑)`,settingInvalidTitle:`不是数字`,settingInvalidBody:`{label} 只接受数字,保留原值。`},marketplace:{title:`插件市场`,hint:"GitHub 上 `rove-plugin` 话题下发布的插件,按 star 数排序。enter(或点击)会先列出安装会执行的命令,确认后才真正执行。每次进入本区块都会重新查询列表。",loading:`正在搜索 GitHub…`,empty:`列表为空。`,offline:`GitHub 不可达——只显示首方插件。重新进入本区块可再试一次。`,installedTag:`已安装`,firstParty:`首方`,preparing:`正在克隆 {ref}…`,installing:`正在构建并注册 {name}…`,installed:`已安装 {id} v{version}——已启用,可在「插件」区块管理。`,cancelled:`已取消安装,没有执行任何命令。`,failed:`安装失败:{error}。请检查构建输出,再从插件市场重试。`,alreadyInstalled:`已安装为 {id}——在「插件」区块管理。`,confirmTitle:`安装 {name}?`,confirmInstall:`安装`,previewSource:`来源:{source}`,previewCommands:`该插件声明的命令:`,previewNoCommands:`该插件未声明任何命令。`,previewWarning:`警告:{warning}`,previewTrust:`安装会执行上面的 build 命令,其余命令会在它们声明的事件发生时执行。它们以你的身份、带你的环境变量运行,没有任何沙箱。`}},Zj={en:{...Vj,title:`Settings`,esc:`esc`,search:{placeholder:`Search settings…`,hint:`/ Search settings…`,title:`Search results`,count:`{count} results`,countOne:`1 result`,empty:`No settings match "{query}".`,emptyHint:`Try another keyword or press esc to return.`,clear:`Clear search`},nav:{default:`j/k pick · h/l switch level · / search · enter activate · esc close`,keys:`j/k pick · / search · enter record a key · backspace default · x unbind · esc close`,feedback:`tab next field · enter sends on Send · esc close`,search:`↑/↓ pick · enter jump · esc cancel`},groups:{preferences:`Preferences`,agents:`Agents`,more:`More`},sections:{general:`General`,engines:`Engines`,autoRouting:`Auto routing`,plugins:`Plugins`,marketplace:`Marketplace`,keys:`Keybindings`,feedback:`Feedback`,dev:`Dev`},general:{usage:`USAGE`,theme:`Theme`,themeMode:`Mode`,themeHint:`l to enter list · j/k to highlight · enter to apply`,language:`Language`,languageHint:`Display language for Rove's UI. l to enter list · j/k to highlight · enter to apply.`,transparent:`Transparent background`,transparentHint:`Drops the renderer's bg fill so the host terminal shows through. enter toggles.`,on:`[x] on`,off:`[ ] off`,focusAccent:`Focus accent`,focusAccentHint:`Color of focused pane title, ▌ marker, and split borders.`,accentPrimary:`Primary (brand accent)`,accentSuccess:`Success (legacy green)`,accentInfo:`Info (cool blue)`,appearance:`Appearance`,appearanceHint:`How split panes draw.`,splitStyle:`Split panes`,workingBorder:`Working border`,taskColors:`Task colors`,glyphSet:`State glyphs`,colorblind:`Colorblind diff colours`,runningTitle:`Running title`,splitBox:`Box frames`,splitLine:`Divider line`,splitRail:`Accent rail`,splitRule:`Top rule`,notifications:`Notifications`,notificationsHint:`When a background tab finishes or pauses on an approval.`,toast:`Toast`,toastHint:`bottom-right popup`,sound:`Sound`,soundHint:`bell + chime + an OSC 9 desktop notification (rides SSH)`,soundVolume:`Chime volume — {percent}%`,soundVolumeHint:`enter cycles; applies to the next chime`,crossTask:`Cross-task`,crossTaskHint:`also for a task you switched away from`,finishedAlerts:`Finished turns`,finishedAlertsHint:`off: only approvals and errors alert; the unread dot stays`,keyHints:`Keyboard hints`,keyHintsHint:`The status-bar reminder of the command and help keys.`,keyHintsShow:`Show keyboard hints`,updates:`Updates`,updatesHint:`Stable is the default channel; next previews the coming release; nightly is built from main every day.`,updateChannelTitle:`Release channel`,updateChannel:`Channel: {channel}`,updateChannelHint:"enter cycles stable / next / nightly; `rove update` follows it",updateChannelName:{latest:`stable`,next:`next preview`,nightly:`nightly preview`},updateNotify:`Notify on updates`,updateNotifyHint:`new versions on this channel; off hides the update chip, and checking by hand still reports`,updateCheck:`[ Check for updates ]`,updateCheckHint:`asks npm for the newest release on this channel right now`,updateCheckButton:`Check for updates`,updateChecking:`Checking…`,updateOpenPage:`Open Update page`,updateOpenPageRow:`[ Open Update page ]`,railFold:`Folded task rail`,railFoldHint:`What the rail shows once folded away from its corner control.`,railFoldRow:`Folded rail shows: {style}`,railFoldRowHint:`enter cycles`,railFoldGlyphs:`status glyphs`,railFoldInitials:`glyph + initials`,railFoldHairline:`colour band only`,editor:`Editor`,editorHint:`What enter opens a file with in the file tree — diff mode when the editor supports it, the read-only preview when it isn't installed.`,editorRow:`editor: < {kind} >`,editorRowHint:`auto follows $VISUAL / $EDITOR, else nvim / vim / emacs / nano`,editorCustom:`custom: {cmd}`,editorCustomUnset:`(unset — enter to edit)`,worktree:`Worktree location`,worktreeHint:`Where new task worktrees are created. New tasks only.`,worktreeBase:`location: < {kind} >`,worktreeBaseHint:"custom takes `~`, a relative path, or a leading `$project_dir`",worktreeKindDefault:`default ~/.rove/worktrees`,worktreeKindNext:`next to project`,worktreeKindCustom:`custom`,worktreeCustom:`custom: {path}`,worktreeCustomUnset:`(unset — enter to edit)`,worktreeBaseTitle:`Custom worktree location (blank = default; $project_dir = project root)`,worktreeBaseField:`PATH`,editorCustomTitle:`Custom editor command (use {file} for the path)`,worktreeBaseInvalidTitle:`Can't use that worktree location`,worktreeBaseTokenBody:`{token} only expands as the leading path segment (e.g. {token}/../rove-worktrees). Keeping the previous setting.`,worktreeBaseUnusableBody:`{path} isn't usable ({error}). Keeping the previous setting — pick a writable directory.`,terminal:`Terminal`,terminalHint:`Applies to terminals opened after the change.`,scrollbackRow:`scrollback: {rows} rows`,scrollbackRowHint:`100–100000 · larger costs proportionally more CPU per redraw`,scrollbackTitle:`Terminal scrollback rows (100–100000)`,scrollbackField:`ROWS`,scrollbackInvalidTitle:`Not a number`,scrollbackInvalidBody:`Scrollback must be a number of rows (e.g. 1000). Keeping the previous setting.`,tabStripRow:`tab strip: {mode}`,tabStripMode:{never:`off — the sidebar tree lists tabs`,multipleOnly:`only with 2+ tabs`,always:`always`},usageShowTitle:`Usage`,usageShowHint:`How plan quota and context percentages read, in the footer and here.`,usageShowRow:`percentages: {mode}`,usageShowMode:{used:`used`,left:`left`}},field:{command:`COMMAND`,name:`NAME`,id:`ID`},action:{save:`save`,next:`next`,add:`add`},reset:{title:`Reset UI state?`,body:`Wipes ~/.config/rove/state.json and ~/.rove/tasks.json, then quits Rove — relaunch for a fresh start with an empty working session list. Worktrees on disk and engine session history are NOT touched.`,done:`Rove: UI state reset. Relaunch Rove to start fresh.`,failedTitle:`UI state was not reset`,failedBody:`Could not write the settings file. Your settings and tasks have been kept. Try resetting again.`},restart:{title:`Restart backend?`,body:`Stops the daemon and relaunches this Rove on the installed build, so daemon / orchestrator / engine edits take effect. Running engine sessions live in the PTY host and keep going; open tabs come back. Any other attached windows reconnect on their own.`,done:`Rove: restarting the backend...`},stateWrite:{failedTitle:`Settings were not saved`,failedBody:`{file} could not be written ({keys}). Check its directory permissions and free disk space, then save again.`},...Uj,...qj,...Yj,keybindings:{title:`Keybindings`,hint:`Press enter on a binding, then the key you want. To put it behind the prefix, press the prefix key first. Changes are saved to the file below and apply at once.`,configFile:`Config file`,notCreated:` (not created yet)`,prefixTitle:`Command layer ({prefix})`,prefixHint:`Bare keys act in the focused pane; a small one-press set covers frequent Rove actions; {prefix} opens the command layer ({timeout}ms second-stroke window). Prefix bindings keep their pane scope and modal rules.`,tapPresentation:`Prefix tap`,tapPresentationHint:`Choose whether the complete guide also marks controls already on screen.`,tapPresentationLocal:`On-screen entries + complete guide (default)`,tapPresentationGuide:`Complete guide only`,prefixDisabled:`disabled`,prefixKey:`Prefix key`,recording:`press the new key… (esc cancels)`,recordingPrefix:`{prefix}, then… (esc cancels)`,recordingSlot:`press the key for {slot}… (esc cancels)`,unbound:`(unbound)`,defaultKeys:`default: {keys}`,warnings:`Warnings`},feedback:{title:`Feedback`,hint:"Files a GitHub issue on the Rove repo through `gh`. Requires `gh auth login`; without it you get a prefilled link to open.",titleLabel:`title`,titlePlaceholder:`Short summary`,descriptionLabel:`description`,descriptionPlaceholder:`What happened? (enter for a new line · tab to Send)`,send:`[enter] File a GitHub issue`,submitting:`submitting...`,sent:`filed #{number}: {url}`,notFiled:`not filed: {hint}
58
+ `),confirmLabel:K(`worktrees`,`land.button`),onConfirm:async()=>{try{let r=await e.client.request(`task.land`,{taskId:t.id});z(K(`worktrees`,`land.done`,{branch:i,landedOn:r.landedOn,commit:r.commit.slice(0,8)})),n?.()}catch(e){throw Error(bj(e))}}}))}function Sj(e,t,n,r){let i=t.branch||t.title;k.set((0,U.jsx)(sa,{title:V(`taskops.publishTitle`),body:V(`taskops.publishBody`,{branch:i,host:n}),confirmLabel:V(`taskops.publishButton`),onConfirm:async()=>{let n=await e.client.request(`task.land`,{taskId:t.id}),a=n.published?.prUrl;a?z(V(`taskops.publishedPr`,{branch:i,url:a})):z(V(`taskops.publishedNoPr`,{branch:i,reason:wj(n.published?.prError??``)}),`error`),r?.()}}))}async function Cj(e,t){try{let n=await e.client.request(`task.syncBase`,{taskId:t});z(K(`tasks`,n.alreadyCurrent?`sync.alreadyCurrent`:`sync.done`,{base:n.baseRef}))}catch(e){let t=G(e),n=vj.exec(t),r=yj.exec(t);z(n?K(`tasks`,`sync.conflict`,{files:n[1]?.trim()||`?`}):r?K(`tasks`,`sync.dirty`,{files:r[1]?.trim()||`?`}):K(`tasks`,`sync.failed`,{error:t}),`error`)}}function wj(e){return e.split(`
59
+ `).find(e=>e.trim().length>0)?.trim()??e.trim()}async function Tj(e,t,n){try{let r=await e.client.request(`task.fixChecks`,e.engineTarget(t));r.outcome===`unavailable`?z(K(`files`,`toast.ciChecksUnavailable`,{detail:wj(r.detail??``)}),`error`):r.outcome===`none`?z(K(`files`,`toast.ciNoFailingChecks`),`error`):z(n)}catch(e){z(G(e),`error`)}}async function Ej(e,t){try{let n=await e.client.request(`task.openEditor`,{taskId:t});n.outcome===`noEditor`?z(K(`tasks`,`toast.noEditor`),`error`):n.outcome===`failed`&&z(K(`tasks`,`toast.openWorktreeFailed`,{label:n.label??``}),`error`)}catch(e){z(Fp(e)?K(`tasks`,`toast.noDiskSpace`):K(`tasks`,`toast.worktreeErrorGeneric`,{message:G(e)}),`error`)}}function Dj(e,t){let n=e.tasks.get();return[...n?.tasks??[],...n?.archived??[]].filter(e=>e.parentTaskId===t)}function Oj(e,t){let n=Dj(e,t.id),r=n.length>0,i=n=>e.act(`task.delete`,{taskId:t.id,...n}).then(()=>{}),a=e=>`${K(`worktrees`,`delete.forceBody`,{branch:t.branch||t.title})}\n\n${K(`worktrees`,`delete.forceReason`,{reason:G(e).replace(`task ${t.id} `,``)})}`,o=async e=>{i(e).catch(n=>{if(e.force||!(n instanceof Pc)||n.code!==`DIRTY_WORKTREE`){z(G(n),`error`);return}k.set((0,U.jsx)(sa,{title:K(`tasks`,`confirm.forceDeleteTitle`,{title:t.label}),body:a(n),confirmLabel:K(`tasks`,`confirm.forceDeleteConfirm`),onConfirm:()=>o({...e,force:!0})}))})};return(0,U.jsx)(sa,{title:r?K(`tasks`,`confirm.childrenTitle`,{title:t.label,count:String(n.length)}):K(`tasks`,t.kind===`dir`?`confirm.deleteTitleDir`:`confirm.deleteTitle`,{title:t.label}),body:r?K(`tasks`,`confirm.childrenBody`):K(`tasks`,t.kind===`dir`?`confirm.deleteBodyDir`:`confirm.deleteBodyTask`),confirmLabel:K(`tasks`,r?`confirm.childrenPromote`:`confirm.deleteConfirm`),onConfirm:()=>o({}),...r?{secondary:{label:K(`tasks`,`confirm.childrenCascade`),onConfirm:()=>o({cascade:!0})}}:{}})}async function kj(e,t){let n=t.archived!==!0,r=t.label,i=async i=>{await e.act(`task.archive`,{taskId:t.id,archived:n,...i}),z(K(`tasks`,n?`archive.done`:`archive.restored`,{title:r}))},a=async e=>{try{await i(e)}catch(t){if(n&&t instanceof Pc&&t.code===`TASK_BUSY`){k.set((0,U.jsx)(sa,{title:K(`tasks`,`archive.busyTitle`),body:K(`tasks`,`archive.busyBody`,{title:r}),confirmLabel:K(`tasks`,`archive.busyConfirm`),onConfirm:()=>i({...e,force:!0})}));return}z(K(`tasks`,n?`archive.failed`:`archive.restoreFailed`,{error:G(t)}),`error`)}},o=n?(e.tasks.get()?.tasks??[]).filter(e=>e.parentTaskId===t.id):[];if(o.length===0)return a({});k.set((0,U.jsx)(sa,{title:K(`tasks`,`confirm.childrenTitle`,{title:r,count:String(o.length)}),body:K(`tasks`,`confirm.archiveChildrenBody`),confirmLabel:K(`tasks`,`confirm.childrenPromote`),onConfirm:async()=>void a({promote:!0}),secondary:{label:K(`tasks`,`confirm.archiveChildrenAll`),onConfirm:async()=>void a({})}}))}function Aj(e,t,n){return(0,U.jsx)(sa,{title:K(`tasks`,`confirm.forgetProjectTitle`,{title:n}),body:K(`tasks`,`confirm.forgetProjectBody`),confirmLabel:K(`tasks`,`confirm.forgetProjectConfirm`),onConfirm:async()=>{try{await e.client.request(`project.forget`,{repo:t})}catch(e){throw Error(K(`tasks`,`toast.forgetProjectFailed`,{error:G(e)}))}}})}var jj=y(null),Mj=0;function Nj(e,t){jj.set({taskId:e,hit:t,nonce:++Mj}),_w(e,`chat`)}var Pj=10;function Fj(e,t){let n=e=>e.surface===t?0:e.surface?1:2,r=tc().filter(n=>nc(n,t)&&n.live?.(e)!==!1).map((e,t)=>({command:e,index:t})).sort((e,t)=>n(e.command)-n(t.command)||Number(e.command.prefix)-Number(t.command.prefix)||e.index-t.index),i=new Set,a=[];for(let{command:e}of r){let t=e.chords[0];!t||e.id===`palette.open`||i.has(e.id)||(i.add(e.id),a.push({command:e,name:cA(e.id),raw:e.prefix?`${Us()} + ${t}`:t}))}return a}function Ij(e){let t=document.activeElement instanceof HTMLElement?document.activeElement:null;k.set((0,U.jsx)(Rj,{model:e,surface:ic(),origin:t}))}var Lj=8;function Rj({model:e,surface:t,origin:n}){H();let[r,i]=(0,h.useState)(``),[a,o]=(0,h.useState)(0),s=(0,h.useRef)(null),c=b(Rs),l=b(e.tasks),u=b(e.remote),d=(0,h.useMemo)(()=>Fj(e,t),[e,t,c]).filter(e=>Uk(r,e.name,e.raw)),f=(Cg(e).length>0?[{name:V(`machines.title`)}]:[]).filter(e=>Uk(r,e.name,``)),p=[{name:V(`settings.feedback.report`)}].filter(e=>Uk(r,e.name,``)),m=r.trim(),g=m===``?[]:[...l?.tasks??[],...u,...l?.archived??[]].filter(e=>!e.routine&&!e.deleting&&[e.label,e.title,e.branch,fo(e.repo)].some(e=>e!==``&&co(m,e))).slice(0,Lj),_=b(e.installedMods).has(`issues`),v=[{id:`usage`,name:V(`usage.title`)},..._?[{id:`issues`,name:V(`reviewQueue.palette`),source:`reviews`}]:[]].filter(e=>m===``||co(m,e.name)),y=aj(e,r),x=y.kind===`done`?y.reply.matches:[],S=[...d.map(e=>({kind:`command`,row:e})),...v.map(e=>({kind:`page`,...e})),...f.map(e=>({kind:`machines`,...e})),...p.map(e=>({kind:`report`,...e})),...g.map(e=>({kind:`task`,task:e})),...x.map(e=>({kind:`hit`,hit:e}))],C=Math.min(a,Math.max(0,S.length-1));(0,h.useEffect)(()=>()=>n?.focus(),[n]),(0,h.useEffect)(()=>{s.current?.querySelector(`.is-selected`)?.scrollIntoView({block:`nearest`})},[C]);let w=t=>{if(t.kind===`machines`){GA(e);return}if(B(),n?.focus(),t.kind===`report`){fj(e).catch(()=>z(V(`settings.feedback.reportFailed`),`error`));return}if(t.kind===`command`){t.row.command.live?.(e)===!1?z(oA(`unavailable`),`error`):t.row.command.run(e);return}if(t.kind===`page`){t.source&&_T.set(t.source),xe(t.id);return}t.kind===`task`&&t.task.archived&&kj(e,t.task),t.kind===`task`?e.select(t.task.id):e.select(t.hit.taskId,t.hit.tabId??null),ye(),t.kind===`hit`&&Nj(t.hit.taskId,t.hit)},T=e=>{if(e.key===`ArrowDown`)o(Math.min(S.length-1,C+1));else if(e.key===`ArrowUp`)o(Math.max(0,C-1));else if(e.key===`Enter`){let e=S[C];e&&w(e)}else return;e.preventDefault()},E=m!==``&&(g.length>0||m.length>=2),D=0,O=()=>D++;return(0,U.jsx)(ia,{title:oA(`palette`),wide:!0,children:(0,U.jsxs)(`div`,{className:`${hi} palette`,onKeyDown:T,children:[(0,U.jsx)(`input`,{className:An,autoFocus:!0,spellCheck:!1,value:r,placeholder:oA(`search`),onChange:e=>{i(e.target.value),o(0)}}),(0,U.jsxs)(`div`,{className:Dn,ref:s,style:{maxHeight:`${(E?18:Pj)*1.9}em`},children:[S.length===0&&y.kind!==`searching`&&(0,U.jsx)(`p`,{className:`text-muted`,children:oA(`noResults`)}),E&&d.length>0&&(0,U.jsx)(sj,{children:V(`search.commands`)}),d.map(e=>{let t=O();return(0,U.jsx)(`button`,{type:`button`,className:On(t===C),title:e.name,onMouseEnter:()=>o(t),onClick:()=>w({kind:`command`,row:e}),children:(0,U.jsx)(`span`,{className:kn,children:`${t===C?`› `:` `}${e.name}`})},e.command.id)}),v.map(e=>{let t=O();return(0,U.jsx)(W,{variant:`row`,className:On(t===C),title:e.name,onMouseEnter:()=>o(t),onClick:()=>w({kind:`page`,...e}),children:(0,U.jsx)(`span`,{className:kn,children:`${t===C?`› `:` `}${e.name}`})},e.id)}),f.map(e=>{let t=O();return(0,U.jsx)(W,{variant:`row`,className:On(t===C),title:e.name,onMouseEnter:()=>o(t),onClick:()=>w({kind:`machines`,...e}),children:(0,U.jsx)(`span`,{className:kn,children:`${t===C?`› `:` `}${e.name}`})},`machines`)}),p.map(e=>{let t=O();return(0,U.jsx)(W,{variant:`row`,className:On(t===C),title:e.name,onMouseEnter:()=>o(t),onClick:()=>w({kind:`report`,...e}),children:(0,U.jsx)(`span`,{className:kn,children:`${t===C?`› `:` `}${e.name}`})},`report`)}),g.length>0&&(0,U.jsx)(sj,{children:V(`search.tasks`)}),g.map(e=>{let t=O();return(0,U.jsx)(lj,{title:e.label,repo:e.archived?V(`search.archived`,{repo:fo(e.repo)}):fo(e.repo),selected:t===C,onHover:()=>o(t),onOpen:()=>w({kind:`task`,task:e})},e.id)}),y.kind!==`idle`&&(0,U.jsx)(sj,{children:V(`search.inConversations`)}),y.kind===`searching`&&(0,U.jsx)(cj,{children:V(`search.searching`)}),y.kind===`failed`&&(0,U.jsx)(cj,{error:!0,children:y.message}),y.kind===`done`&&x.length===0&&(0,U.jsx)(cj,{children:V(`search.none`,{query:y.query})}),x.map(e=>{let t=O();return(0,U.jsx)(uj,{hit:e,query:y.kind===`done`?y.query:``,selected:t===C,onHover:()=>o(t),onOpen:()=>w({kind:`hit`,hit:e})},`${e.taskId}:${e.tabId??``}:${e.at}:${t}`)}),y.kind===`done`&&y.reply.truncated&&(0,U.jsx)(cj,{children:V(`search.truncated`)}),y.kind===`done`&&y.reply.skipped.length>0&&(0,U.jsx)(cj,{children:V(`search.skipped`,{count:y.reply.skipped.length})})]}),(0,U.jsx)(`p`,{className:`keys-only text-muted`,children:oA(`run`)})]})})}var zj=y(null);function Bj(e){let t=(document.activeElement?.closest(`.rail`)==null?null:zj.get())??e.selection.get().taskId;return e.tasks.get()?.tasks.find(e=>e.id===t)??null}var Vj=[`latest`,`next`,`nightly`],Hj={appearance:{enabled:`On`,disabled:`Off`,borderFlow:`Flowing gradient`,borderStill:`Still`,glyphsBraille:`Braille`,glyphsStarburst:`Starburst (needs a font with the Dingbats block)`,glyphsAscii:`ASCII`,titleShimmer:`Shimmer`,titleStill:`Still`,preview:`Workspace preview`,tasks:`Tasks`,terminal:`Terminal`,files:`Files`,testsPassed:`Tests passed`,transparent:`Transparent background`,opaque:`Opaque background`,modeDark:`Dark`,modeLight:`Light`,modeAuto:`Auto (follow the terminal)`,openHint:`Enter to choose an option and preview it.`,chooseHint:`↑/↓ or j/k preview · enter apply · esc cancel`,importFromTerminal:`Import from {terminal}`,themePackage:`· package: colours here, layout and components in the web client`,syncFromTerminal:`Sync from {terminal}`}},Uj={appearance:{enabled:`开启`,disabled:`关闭`,borderFlow:`流动渐变`,borderStill:`静止`,glyphsBraille:`盲文点`,glyphsStarburst:`星芒(需要含 Dingbats 符号区的字体)`,glyphsAscii:`ASCII`,titleShimmer:`流光`,titleStill:`静止`,preview:`工作区预览`,tasks:`任务`,terminal:`终端`,files:`文件`,testsPassed:`测试通过`,transparent:`透明背景`,opaque:`不透明背景`,modeDark:`深色`,modeLight:`浅色`,modeAuto:`自动(跟随终端)`,openHint:`按 Enter 打开选项和预览。`,chooseHint:`↑/↓ 或 j/k 预览 · enter 应用 · esc 取消`,importFromTerminal:`从 {terminal} 导入`,themePackage:`· 主题包:这里只画配色,布局和组件在 web 端`,syncFromTerminal:`从 {terminal} 重新同步`}},Wj={autoRouting:{title:`Auto routing`,hint:"Routing by depth: a task says how deep the work is — swift, standard, deep — and this table says which engine, model and reasoning effort that depth runs on. Pick a depth in the new-task dialog (or `rove api add --tier`) and Rove fills those three fields from the row; you still see them and can change them before the task starts. enter (or click) a row to point it somewhere else, with the same picker a task uses. A row whose target cannot start says why here, not at launch.",unconfigured:`Auto routing is off: a depth has nowhere to route — its engine is blank. Point it somewhere below, or remove the empty autoRouting.<tier>.engine from state.json.`,engineDefault:`engine default`,ready:`● ready`,unavailable:`! unavailable — {reason}`,classifierTitle:`Classifier`,classifierHint:"The rows above say what each depth RUNS. This says who CHOOSES one: switch it on and `rove api add --tier auto` reads the task's first message and picks the depth for you. It is off by default, it is never required, and it can never fail a create — no key, no network, a timeout, or an answer it is not confident enough about all leave you on the depth you would have had.",classifierDataFlow:"! Turning the classifier on sends the task's first message to a third party that is NOT the engine vendor you picked — TypeSafe System One for `jev`, or whatever address you point `custom` at. It reads the text before your engine does. Nothing leaves this machine while it is off.",classifierLabel:`Choose with`,classifierOff:`off`,classifierCustomLabel:`custom`,classifierOffHint:`— nothing is sent anywhere`,classifierJevHint:`— TypeSafe System One, billed to your own key`,classifierCustomHint:`— your endpoint: POST the text, answer with a depth and a confidence`,endpointLabel:`Endpoint`,endpointUnset:`(none — enter one, then set Choose with to custom)`,endpointTitle:`Custom classifier endpoint`,endpointField:`URL`,endpointInvalidTitle:`Not a URL`,endpointInvalidBody:`The endpoint has to start with https://, or http:// for a loopback address (127.0.0.1, localhost, ::1) — over a network, plain http would carry the task's first 1,200 characters in cleartext. Leave it empty to clear it.`,thresholdLabel:`Confidence floor`,thresholdHint:`— below this, the depth is left alone`,thresholdTitle:`Confidence floor`,thresholdField:`0 to 1`,thresholdInvalidTitle:`Not a confidence`,thresholdInvalidBody:`The floor is a number between 0 and 1. 0.5 is the shipped default.`,keyLabel:`API key`,keyStored:`stored {hint} — enter to replace, empty to clear`,keyFromEnv:"from ${env} — the environment wins over a stored key",keyNone:`not set — enter to paste one`,keyTitle:`{env}`,keyPlaceholder:`paste the key; leave empty to clear the stored one`,keySaved:`● key stored in ~/.rove/secrets.json (owner-only, never in state.json)`,keyCustomUnused:`● no Authorization header is sent to a custom endpoint — set autoRouting.classifierCustomKeyEnv to the variable holding its key if it needs one`,keyNoVariableTitle:`No key variable for this endpoint`,keyNoVariableBody:`A custom classifier endpoint is sent no Authorization header until autoRouting.classifierCustomKeyEnv names the variable its key lives in. Set that first — a key stored under a name nothing reads is a key at rest for no purpose.`,keyWriteFailedTitle:`Key not saved`,keyWriteFailedBody:`~/.rove/secrets.json could not be written: {reason}. Check directory permissions and disk space, then save again.`,keyMissing:`! no key — nothing is chosen and tasks keep their usual depth`,keyPresentEnv:"● key read from ${env} in this process's environment"}},Gj={autoRouting:{title:`自动路由`,hint:"按深度路由:任务说明这活有多深——轻快、标准、深入——这张表说明那一档跑在哪个引擎、哪个模型、哪个推理强度上。在新建任务对话框里选一档(或 `rove api add --tier`),Rove 就照那一行填进这三个字段;任务启动前你仍然看得见、改得了。enter(或点击)某一行,用和任务一样的选择器把它指到别处。目标起不来的行会在这里说明原因,而不是等到启动时才炸。",unconfigured:`自动路由已关闭:有一档无处可去——它的引擎是空的。在下面把它指到某个引擎,或从 state.json 里删掉空的 autoRouting.<tier>.engine。`,engineDefault:`引擎默认`,ready:`● 可用`,unavailable:`! 不可用——{reason}`,classifierTitle:`分类器`,classifierHint:"上面几行说的是每一档**跑什么**,这里决定**由谁来选**:打开之后,`rove api add --tier auto` 会读任务的第一句话替你选档。默认关着,从来不是必需的,也永远不会让建 task 失败——没 key、断网、超时、或者它自己没把握,都只是让你停在本来就会用的那一档上。",classifierDataFlow:"! 打开分类器,任务的第一句话会发给一个**不是你选的那个引擎厂商**的第三方——`jev` 是 TypeSafe System One,`custom` 是你自己填的地址。它比你的引擎更早读到这段文字。关着的时候什么都不发。",classifierLabel:`选档方式`,classifierOff:`关`,classifierCustomLabel:`自定义`,classifierOffHint:`——不向任何地方发送`,classifierJevHint:`——TypeSafe System One,走你自己的 key 计费`,classifierCustomHint:`——你自己的接口:POST 那段文本,返回一个档位加一个置信度`,endpointLabel:`接口地址`,endpointUnset:`(未填——先填一个,再把「选档方式」切到自定义)`,endpointTitle:`自定义分类器接口`,endpointField:`URL`,endpointInvalidTitle:`不是一个 URL`,endpointInvalidBody:`接口地址要以 https:// 开头;http:// 只在回环地址(127.0.0.1、localhost、::1)上接受——发到网络上的话,明文 http 会把任务的前 1200 个字符原样带走。留空则清除。`,thresholdLabel:`置信度下限`,thresholdHint:`——低于这个值就不动档位`,thresholdTitle:`置信度下限`,thresholdField:`0 到 1`,thresholdInvalidTitle:`不是一个置信度`,thresholdInvalidBody:`下限是 0 到 1 之间的数。出厂默认 0.5。`,keyLabel:`API key`,keyStored:`已存 {hint}——enter 可替换,留空清除`,keyFromEnv:"来自环境变量 ${env}——环境变量优先于存起来的那个",keyNone:`未设置——enter 粘贴一个`,keyTitle:`{env}`,keyPlaceholder:`粘贴 key;留空则清除已存的那个`,keySaved:`● key 存在 ~/.rove/secrets.json(仅本人可读,不会进 state.json)`,keyCustomUnused:`● 自定义接口不会收到 Authorization 头——它若需要凭据,把 autoRouting.classifierCustomKeyEnv 指向存它的变量`,keyNoVariableTitle:`这个接口还没有 key 变量`,keyNoVariableBody:`在 autoRouting.classifierCustomKeyEnv 指定存 key 的变量之前,自定义分类器接口不会收到任何 Authorization 头。先设那个——存在一个没人读的名字下面的 key,只是白白落在盘上。`,keyWriteFailedTitle:`key 没存下`,keyWriteFailedBody:`写不了 ~/.rove/secrets.json:{reason}。请检查目录权限和磁盘空间,再次保存。`,keyMissing:`! 没有 key——不会替你选档,任务保持原来的档位`,keyPresentEnv:"● key 来自本进程环境变量 ${env}"}},Kj={dev:{reset:`Reset UI state`,resetHint:`Clears ~/.config/rove/state.json and ~/.rove/tasks.json, then quits Rove — relaunch to start fresh. Working session list, pane sizes, theme, model picks all reset. Worktrees on disk and engine session history are not touched.`,resetButton:`[enter] Reset`,restart:`Restart backend`,restartHint:`Stops the Rove daemon and relaunches this window on the installed build — picks up daemon / orchestrator / engine edits without quitting by hand. Running engine sessions live in the PTY host and survive it; other attached Rove windows reconnect on their own.`,restartButton:`[enter] Restart`,reload:`Reload settings`,reloadHint:"Applies hand edits to ~/.config/rove/state.json (from `rove config`) to this window without a restart.",reloadButton:`[enter] Reload`,reloadDone:`Reloaded: {count} changed.`,reloadUnchanged:`Already matches state.json; nothing changed.`,reloadFailed:`state.json could not be read, nothing changed: {error}`,doctorHint:"Daemon wedged or unresponsive? Restart backend does it from here; from a shell it is `rove daemon restart`. Hosted engine sessions stay alive across a daemon restart.",experimental:`Experimental`,remoteHint:"Remote projects (SSH): register a project whose git worktrees live on another host, driven from this local Rove. Unfinished — Hosted PTY engine launch over SSH is not implemented, and file/diff panes still degrade. Enables `rove add --remote`.",remote:`Remote projects`,autoStatusHint:`Auto status flow: a backlog task moves to in_progress when its engine starts a turn, and new sessions get a system-prompt note telling the agent to set in_review itself when the work is done. Never touches done/canceled.`,autoStatus:`Auto status flow`,dispatcherHint:"Field-notes dispatcher: task sessions file one-line gotchas (`rove api note`), and every session of that repo that starts later is handed them.",dispatcher:`Field-notes dispatcher`}},qj={dev:{reset:`重置 UI 状态`,resetHint:`清空 ~/.config/rove/state.json 和 ~/.rove/tasks.json,然后退出 Rove——重新启动即可从头开始。工作会话列表、面板尺寸、主题、模型选择都会重置。磁盘上的 worktree 和引擎会话历史不受影响。`,resetButton:`[enter] 重置`,restart:`重启后端`,restartHint:`停止 Rove daemon,并以已安装的版本重新启动当前窗口——无需手动退出即可应用 daemon / orchestrator / engine 的改动。正在运行的引擎会话由 PTY host 托管,不受影响;其他已连接的 Rove 窗口会自行重连。`,restartButton:`[enter] 重启`,reload:`重新加载设置`,reloadHint:"把对 ~/.config/rove/state.json 的手动修改(来自 `rove config`)应用到当前窗口,无需重启。",reloadButton:`[enter] 重新加载`,reloadDone:`已重新加载:{count} 项有变化。`,reloadUnchanged:`已与 state.json 一致,没有变化。`,reloadFailed:`无法读取 state.json,未做任何改动:{error}`,doctorHint:"daemon 卡住或无响应?「重启后端」就能在这里完成;在 shell 里则是 `rove daemon restart`。Hosted PTY 引擎会话不会因 daemon 重启而退出。",experimental:`实验性`,remoteHint:"远程项目(SSH):注册一个 git worktree + 引擎都通过 SSH 跑在另一台主机上、由本地 Rove 驱动的项目。尚未完成——文件/diff 面板对远程仍会降级。启用 `rove add --remote`。",remote:`远程项目`,autoStatusHint:`自动状态流转:backlog 任务在其引擎开始一轮时移到 in_progress,新会话会拿到一条系统提示,告诉 agent 完成后自行设为 in_review。绝不触碰 done/canceled。`,autoStatus:`自动状态流转`,dispatcherHint:"现场笔记调度器:任务会话提交一行经验(`rove api note`),之后在该仓库启动的每个会话都会拿到这些笔记。",dispatcher:`现场笔记调度器`}},Jj={engines:{title:`Engines`,hint:`Engines Rove can start on this machine. New tasks start with the default engine; switch an engine off to stop offering it.`,keys:`space available · d default · enter launch command · r rename · x reset/remove`,customTag:`custom`,available:`available`,off:`off`,defaultMark:`default`,makeDefault:`Make default`,status:{checking:`Checking…`,unknown:`Status unknown`,ready:`Ready`,notInstalled:`Not installed`,notOnPath:`Not on PATH`,signIn:`Sign in needed`,integrationMissing:`Integration not installed`,integrationOutdated:`Integration outdated`,integrationBlocked:`Integration blocked`},detail:{program:`Program`,command:`Command`,signIn:`Sign-in`,reporting:`Live status`,adapter:`Adapter`,programFound:`{binary} found at {path}.`,programFoundVersion:`{binary} {version} found at {path}.`,programMissing:`{binary} is not on PATH. Install the engine's CLI, or point its launch command at it.`,programUnknown:`Rove could not check for {binary}.`,commandDefault:`{command} (the default)`,commandCustom:`{command} (yours)`,signedIn:`Signed in.`,signedInAs:`Signed in as {who}.`,apiKey:`An API key is configured.`,token:`A token is configured ({source}).`,signedOut:`Not signed in. Sign in with the engine's own CLI.`,signInUnknown:`Rove can't see whether this engine is signed in.`,signInFailed:`Sign-in check failed: {error}`,hooksInstalled:`Rove's hooks are installed, so tabs report their state as it changes.`,hooksOutdated:`Rove's hooks are from an older version; reinstall them under Engine integrations.`,hooksMissing:`Rove's hooks are not installed; install them under Engine integrations.`,hooksAwaitEngine:`Rove's hooks can be installed once the engine is.`,hooksUnsupported:`This engine has no hooks for Rove to install.`,hooksBlocked:`Rove can't write its hooks into {file}: {reason}`,hooksBlockedHere:`Rove can't write its hooks into the engine's config: {reason}`,markersYes:`It leaves turn-complete markers that Rove reads back.`,markersNo:`It leaves no turn-complete markers.`,screenYes:`Screen rules cover what the hooks don't.`,screenNo:`No screen rules.`,screenNotNeeded:`No screen rules; the hooks report everything.`,adapterDeclared:`Borrows the {protocol} adapter.`,adapterGeneric:`Generic adapter: no transcript reader, sign-in check or resume.`,skill:`Rove skill`,skillInstalled:`Installed in {dir}.`,skillInstalledHere:`Installed and current.`,skillOutdated:`From an older Rove; reinstall it under Rove agent skill.`,skillMissing:`Not installed; install it under Rove agent skill.`},skill:{title:`Rove agent skill`,hint:`Teaches the agent in each engine to drive Rove itself (rove api): start tasks, read other sessions, message them.`,install:`Install ({count})`,noEngines:`No engine here takes the skill`,failed:`Install failed: {reason}`,bannerTitle:`ROVE SKILL NOT INSTALLED`,bannerHint:`{engines} can't drive Rove yet (start tasks, read other sessions). Click here to install.`,bannerHintWeb:`{engines} can't drive Rove yet (start tasks, read other sessions).`},integrations:{title:`Engine integrations`,hint:`Hooks Rove writes into each engine's own config, so a tab shows working, waiting or done the moment it happens.`,summary:`{installed} of {total} installed`,install:`Install missing ({count})`,upToDate:`All up to date`,remove:`Remove all ({count})`,noneInstalled:`Nothing to remove`},addEngine:`+ Add engine`,permissionsTitle:`Permissions`,permissionBypass:`Skip permission prompts`,permissionBypassHint:`Starts Claude, Codex, Antigravity and Cursor with their skip-permissions flag so unattended sessions don't stall on an approval. Left alone if your launch command already picks a mode.`,launchCommandTitle:`{name} launch command`,displayNameTitle:`{name} display name (blank = default)`,addTitle:`Add engine`,addStepTitle:`Add engine · {id}`,protocolTitle:`Add engine · {id} — protocol`,protocolNone:`None — generic adapter`,protocolFooter:`↑↓ choose · enter pick · esc cancel`,protocolRow:`protocol {protocol}`,protocolGeneric:`generic`,idPlaceholder:`lowercase slug, e.g. aider`,commandPlaceholder:`e.g. aider --model sonnet`,hookTrustHint:`Open {command} in the engine and approve hooks yourself. Written hooks are not proof of trust.`,readiness:`CLI: {cli} · login: {login} · hooks: {hooks}`,cliReady:`available`,cliMissing:`missing; install the engine CLI`,loginReady:`detected`,loginMissing:`sign in with the engine CLI`,readinessUnknown:`not observable`,hooksWritten:`written`,hooksMissing:`not written; Settings → Engines`,hooksOutdated:`outdated; Settings → Engines`,hookWaiting:`No hook event received yet. After approval, send a short prompt to verify activity.`,hookReceived:`Hook event recorded for this tab. Send a short prompt to check current reporting; current trust is not inferred.`,readinessFailed:`Readiness check unavailable; run rove doctor. No authorization is inferred.`},accounts:{checking:`Checking…`,notLoggedIn:`○ Not logged in`,loggedIn:`● Logged in: {email}`,apiKeyConfigured:`● API key configured`,chatgptLogin:`● ChatGPT login: {email}`,tokenConfigured:`● Token configured ({source})`,detected:`● Login detected`}},Yj={engines:{title:`引擎`,hint:`Rove 能在这台机器上启动的引擎。新任务默认用「默认」引擎;关掉某个引擎,选引擎时就不再列出它。`,keys:`space 可用 · d 设为默认 · enter 启动命令 · r 重命名 · x 重置/移除`,customTag:`自定义`,available:`可用`,off:`已关`,defaultMark:`默认`,makeDefault:`设为默认`,status:{checking:`检查中…`,unknown:`状态未知`,ready:`就绪`,notInstalled:`未安装`,notOnPath:`不在 PATH 上`,signIn:`需要登录`,integrationMissing:`未安装接入`,integrationOutdated:`接入已过期`,integrationBlocked:`接入被拒绝`},detail:{program:`程序`,command:`命令`,signIn:`登录`,reporting:`实时状态`,adapter:`适配器`,programFound:`{binary} 位于 {path}。`,programFoundVersion:`{binary} {version} 位于 {path}。`,programMissing:`{binary} 不在 PATH 上。请安装引擎 CLI,或把启动命令指向它。`,programUnknown:`Rove 无法检查 {binary}。`,commandDefault:`{command}(默认)`,commandCustom:`{command}(自定义)`,signedIn:`已登录。`,signedInAs:`已登录:{who}。`,apiKey:`已配置 API key。`,token:`已配置 Token({source})。`,signedOut:`未登录。请用引擎自己的命令行登录。`,signInUnknown:`Rove 无法得知该引擎是否已登录。`,signInFailed:`登录检查失败:{error}`,hooksInstalled:`Rove 的钩子已安装,标签页的状态会实时上报。`,hooksOutdated:`Rove 的钩子来自旧版本;请在「引擎接入」里重新安装。`,hooksMissing:`Rove 的钩子未安装;请在「引擎接入」里安装。`,hooksAwaitEngine:`引擎安装后才能装 Rove 的钩子。`,hooksUnsupported:`该引擎没有可供 Rove 安装的钩子。`,hooksBlocked:`Rove 无法把钩子写入 {file}:{reason}`,hooksBlockedHere:`Rove 无法把钩子写入引擎配置:{reason}`,markersYes:`它会留下回合完成标记,Rove 可以读回。`,markersNo:`它不留下回合完成标记。`,screenYes:`读屏规则兜底钩子覆盖不到的状态。`,screenNo:`没有读屏规则。`,screenNotNeeded:`没有读屏规则;钩子已报全所有状态。`,adapterDeclared:`借用 {protocol} 适配器。`,adapterGeneric:`通用适配器:没有会话记录读取、登录检查和恢复。`,skill:`Rove 技能`,skillInstalled:`已安装在 {dir}。`,skillInstalledHere:`已安装,是最新版。`,skillOutdated:`来自旧版 Rove;请在「Rove 智能体技能」里重新安装。`,skillMissing:`未安装;请在「Rove 智能体技能」里安装。`},skill:{title:`Rove 智能体技能`,hint:`教会各引擎里的智能体自己操作 Rove(rove api):开任务、读其他会话、给它们发消息。`,install:`安装({count})`,noEngines:`这台机器上没有能装技能的引擎`,failed:`安装失败:{reason}`,bannerTitle:`ROVE 技能未安装`,bannerHint:`{engines} 还不能操作 Rove(开任务、读其他会话)。点这里安装。`,bannerHintWeb:`{engines} 还不能操作 Rove(开任务、读其他会话)。`},integrations:{title:`引擎接入`,hint:`Rove 写进各引擎自身配置的钩子,让标签页在工作、等待、完成的那一刻就显示出来。`,summary:`已安装 {installed}/{total}`,install:`安装缺失的({count})`,upToDate:`全部已是最新`,remove:`全部移除({count})`,noneInstalled:`没有可移除的`},addEngine:`+ 添加引擎`,permissionsTitle:`权限`,permissionBypass:`跳过权限确认`,permissionBypassHint:`启动 Claude、Codex、Antigravity、Cursor 时带上它们跳过权限确认的参数,免得无人值守的会话卡在审批上。启动命令里已经选了权限模式的不再追加。`,launchCommandTitle:`{name} 的启动命令`,displayNameTitle:`{name} 的显示名称(留空 = 默认)`,addTitle:`添加引擎`,addStepTitle:`添加引擎 · {id}`,protocolTitle:`添加引擎 · {id} —— 协议`,protocolNone:`无 —— 通用适配器`,protocolFooter:`↑↓ 选择 · enter 确认 · esc 取消`,protocolRow:`协议 {protocol}`,protocolGeneric:`通用`,idPlaceholder:`小写短名,如 aider`,commandPlaceholder:`如 aider --model sonnet`,hookTrustHint:`在引擎中打开 {command},由你自行批准 hooks。写入不代表已授权。`,readiness:`CLI:{cli} · 登录:{login} · hooks:{hooks}`,cliReady:`可用`,cliMissing:`缺失;请安装引擎 CLI`,loginReady:`已检测到`,loginMissing:`请通过引擎 CLI 登录`,readinessUnknown:`无法观测`,hooksWritten:`已写入`,hooksMissing:`未写入;设置 → 引擎`,hooksOutdated:`已过时;设置 → 引擎`,hookWaiting:`尚未收到 hook 事件。授权后发送一条简短提示,验证活动状态。`,hookReceived:`已记录此标签页的 hook 事件。发送简短提示以检查当前上报;不据此推断当前授权。`,readinessFailed:`无法检查就绪状态;请运行 rove doctor。不会据此推断已授权。`},accounts:{checking:`检查中…`,notLoggedIn:`○ 未登录`,loggedIn:`● 已登录: {email}`,apiKeyConfigured:`● 已配置 API key`,chatgptLogin:`● ChatGPT 登录: {email}`,tokenConfigured:`● 已配置 Token ({source})`,detected:`● 检测到登录`}},Xj={plugins:{title:`Plugins`,hint:"Rove's first-party mods first: enter (or click) installs or uninstalls one, and uninstalling keeps its data on disk. Then the plugins registered in ~/.rove/plugins.json: enter toggles one on or off — the daemon watches the file, so the change applies live. Rows indented under a plugin are the settings it declares; enter edits one, and the value reaches the plugin on its next run. Install and remove them from the shell: `rove plugin install <owner/repo>`, `rove plugin link <dir>`.",empty:"Kanban and Issues are first-party mods: enter (or click) installs one. No other plugins registered; add one with `rove plugin install <owner/repo>` — browse the `rove-plugin` topic on GitHub.",sourceLink:`linked {path}`,sourceGithub:`{spec}`,sourceBuiltIn:`first-party mod · not installed`,sourceBuiltInInstalled:`first-party mod · installed`,updateAvailable:`update available — rove plugin update`,declares:`{actions} actions · {events} events · {panes} panes`,declaresWithEngines:`{actions} actions · {events} events · {panes} panes · {engines} engines`,declaresPages:`· {pages} pages`,pageFailed:`page {detail}`,manifestUnreadable:`manifest unreadable; check the rove-plugin.toml path and TOML syntax`,unsupportedPlatform:`· not supported on this platform`,noHooks:`· no hooks declared`,lastRun:`· last run {label} {status} {ago} ago`,neverRun:`· never run`,runOk:`ok`,runRunning:`still running`,runFailed:"failed to start; inspect `rove plugin log <id>`",runExit:`exit {code}`,settingUnset:`(unset — enter to edit)`,settingInvalidTitle:`Not a number`,settingInvalidBody:`{label} only accepts a number. Keeping the previous value.`},marketplace:{title:`Marketplace`,hint:"Plugins published under the `rove-plugin` topic on GitHub, most-starred first. enter (or click) shows what the install would run and asks before running any of it. The listing is re-queried each time you open this section.",loading:`Searching GitHub…`,empty:`No plugins listed.`,offline:`GitHub is unreachable — showing first-party plugins only. Re-open this section to retry.`,installedTag:`installed`,firstParty:`first-party`,preparing:`cloning {ref}…`,installing:`building and registering {name}…`,installed:`installed {id} v{version} — it is enabled, and appears under Plugins.`,cancelled:`install cancelled; nothing was run.`,failed:`install failed: {error}. Check the build output and retry from Marketplace.`,alreadyInstalled:`already installed as {id} — manage it under Plugins.`,confirmTitle:`Install {name}?`,confirmInstall:`install`,previewSource:`source: {source}`,previewCommands:`Commands this plugin declares:`,previewNoCommands:`This plugin declares no commands.`,previewWarning:`warning: {warning}`,previewTrust:`Installing runs the build commands above, and the rest run later on the events they declare. They run as you, with your environment, and nothing is sandboxed.`}},Zj={plugins:{title:`插件`,hint:"先列 Rove 官方 mod:enter(或点击)安装或卸载,卸载后数据仍留在磁盘上。再列在 ~/.rove/plugins.json 里注册的插件:enter 切换启用/禁用——daemon 监听该文件,改动实时生效。插件下方缩进的行是它声明的设置项,enter 编辑,新值在插件下次运行时生效。安装与移除在 shell 里做:`rove plugin install <owner/repo>`、`rove plugin link <dir>`。",empty:"Kanban 和 Issues 是官方 mod:enter(或点击)安装。尚未注册其他插件;用 `rove plugin install <owner/repo>` 安装一个——可在 GitHub 的 `rove-plugin` 话题下浏览。",sourceLink:`本地链接 {path}`,sourceGithub:`{spec}`,sourceBuiltIn:`官方 mod · 未安装`,sourceBuiltInInstalled:`官方 mod · 已安装`,updateAvailable:`有新版本 — rove plugin update`,declares:`{actions} 个动作 · {events} 个事件 · {panes} 个面板`,declaresWithEngines:`{actions} 个动作 · {events} 个事件 · {panes} 个面板 · {engines} 个引擎`,declaresPages:`· {pages} 个页面`,pageFailed:`页面 {detail}`,manifestUnreadable:`manifest 无法解析;请检查rove-plugin.toml 的路径和 TOML 语法`,unsupportedPlatform:`· 不支持当前平台`,noHooks:`· 未声明钩子`,lastRun:`· 上次运行 {label} {status} {ago}前`,neverRun:`· 尚未运行过`,runOk:`成功`,runRunning:`仍在运行`,runFailed:"启动失败;请查看 `rove plugin log <id>`",runExit:`退出码 {code}`,settingUnset:`(未设置 — enter 编辑)`,settingInvalidTitle:`不是数字`,settingInvalidBody:`{label} 只接受数字,保留原值。`},marketplace:{title:`插件市场`,hint:"GitHub 上 `rove-plugin` 话题下发布的插件,按 star 数排序。enter(或点击)会先列出安装会执行的命令,确认后才真正执行。每次进入本区块都会重新查询列表。",loading:`正在搜索 GitHub…`,empty:`列表为空。`,offline:`GitHub 不可达——只显示首方插件。重新进入本区块可再试一次。`,installedTag:`已安装`,firstParty:`首方`,preparing:`正在克隆 {ref}…`,installing:`正在构建并注册 {name}…`,installed:`已安装 {id} v{version}——已启用,可在「插件」区块管理。`,cancelled:`已取消安装,没有执行任何命令。`,failed:`安装失败:{error}。请检查构建输出,再从插件市场重试。`,alreadyInstalled:`已安装为 {id}——在「插件」区块管理。`,confirmTitle:`安装 {name}?`,confirmInstall:`安装`,previewSource:`来源:{source}`,previewCommands:`该插件声明的命令:`,previewNoCommands:`该插件未声明任何命令。`,previewWarning:`警告:{warning}`,previewTrust:`安装会执行上面的 build 命令,其余命令会在它们声明的事件发生时执行。它们以你的身份、带你的环境变量运行,没有任何沙箱。`}},Qj={en:{...Hj,title:`Settings`,esc:`esc`,search:{placeholder:`Search settings…`,hint:`/ Search settings…`,title:`Search results`,count:`{count} results`,countOne:`1 result`,empty:`No settings match "{query}".`,emptyHint:`Try another keyword or press esc to return.`,clear:`Clear search`},nav:{default:`j/k pick · h/l switch level · / search · enter activate · esc close`,keys:`j/k pick · / search · enter record a key · backspace default · x unbind · esc close`,feedback:`tab next field · enter sends on Send · esc close`,search:`↑/↓ pick · enter jump · esc cancel`},groups:{preferences:`Preferences`,agents:`Agents`,more:`More`},sections:{general:`General`,engines:`Engines`,autoRouting:`Auto routing`,plugins:`Plugins`,marketplace:`Marketplace`,keys:`Keybindings`,feedback:`Feedback`,dev:`Dev`},general:{usage:`USAGE`,theme:`Theme`,themeMode:`Mode`,themeHint:`l to enter list · j/k to highlight · enter to apply`,language:`Language`,languageHint:`Display language for Rove's UI. l to enter list · j/k to highlight · enter to apply.`,transparent:`Transparent background`,transparentHint:`Drops the renderer's bg fill so the host terminal shows through. enter toggles.`,on:`[x] on`,off:`[ ] off`,focusAccent:`Focus accent`,focusAccentHint:`Color of focused pane title, ▌ marker, and split borders.`,accentPrimary:`Primary (brand accent)`,accentSuccess:`Success (legacy green)`,accentInfo:`Info (cool blue)`,appearance:`Appearance`,appearanceHint:`How split panes draw.`,splitStyle:`Split panes`,workingBorder:`Working border`,taskColors:`Task colors`,glyphSet:`State glyphs`,colorblind:`Colorblind diff colours`,runningTitle:`Running title`,splitBox:`Box frames`,splitLine:`Divider line`,splitRail:`Accent rail`,splitRule:`Top rule`,notifications:`Notifications`,notificationsHint:`When a background tab finishes or pauses on an approval.`,toast:`Toast`,toastHint:`bottom-right popup`,sound:`Sound`,soundHint:`bell + chime + an OSC 9 desktop notification (rides SSH)`,soundVolume:`Chime volume — {percent}%`,soundVolumeHint:`enter cycles; applies to the next chime`,crossTask:`Cross-task`,crossTaskHint:`also for a task you switched away from`,finishedAlerts:`Finished turns`,finishedAlertsHint:`off: only approvals and errors alert; the unread dot stays`,keyHints:`Keyboard hints`,keyHintsHint:`The status-bar reminder of the command and help keys.`,keyHintsShow:`Show keyboard hints`,updates:`Updates`,updatesHint:`Stable is the default channel; next previews the coming release; nightly is built from main every day.`,updateChannelTitle:`Release channel`,updateChannel:`Channel: {channel}`,updateChannelHint:"enter cycles stable / next / nightly; `rove update` follows it",updateChannelName:{latest:`stable`,next:`next preview`,nightly:`nightly preview`},updateNotify:`Notify on updates`,updateNotifyHint:`new versions on this channel; off hides the update chip, and checking by hand still reports`,updateCheck:`[ Check for updates ]`,updateCheckHint:`asks npm for the newest release on this channel right now`,updateCheckButton:`Check for updates`,updateChecking:`Checking…`,updateOpenPage:`Open Update page`,updateOpenPageRow:`[ Open Update page ]`,railFold:`Folded task rail`,railFoldHint:`What the rail shows once folded away from its corner control.`,railFoldRow:`Folded rail shows: {style}`,railFoldRowHint:`enter cycles`,railFoldGlyphs:`status glyphs`,railFoldInitials:`glyph + initials`,railFoldHairline:`colour band only`,editor:`Editor`,editorHint:`What enter opens a file with in the file tree — diff mode when the editor supports it, the read-only preview when it isn't installed.`,editorRow:`editor: < {kind} >`,editorRowHint:`auto follows $VISUAL / $EDITOR, else nvim / vim / emacs / nano`,editorCustom:`custom: {cmd}`,editorCustomUnset:`(unset — enter to edit)`,worktree:`Worktree location`,worktreeHint:`Where new task worktrees are created. New tasks only.`,worktreeBase:`location: < {kind} >`,worktreeBaseHint:"custom takes `~`, a relative path, or a leading `$project_dir`",worktreeKindDefault:`default ~/.rove/worktrees`,worktreeKindNext:`next to project`,worktreeKindCustom:`custom`,worktreeCustom:`custom: {path}`,worktreeCustomUnset:`(unset — enter to edit)`,worktreeBaseTitle:`Custom worktree location (blank = default; $project_dir = project root)`,worktreeBaseField:`PATH`,editorCustomTitle:`Custom editor command (use {file} for the path)`,worktreeBaseInvalidTitle:`Can't use that worktree location`,worktreeBaseTokenBody:`{token} only expands as the leading path segment (e.g. {token}/../rove-worktrees). Keeping the previous setting.`,worktreeBaseUnusableBody:`{path} isn't usable ({error}). Keeping the previous setting — pick a writable directory.`,terminal:`Terminal`,terminalHint:`Applies to terminals opened after the change.`,scrollbackRow:`scrollback: {rows} rows`,scrollbackRowHint:`100–100000 · larger costs proportionally more CPU per redraw`,scrollbackTitle:`Terminal scrollback rows (100–100000)`,scrollbackField:`ROWS`,scrollbackInvalidTitle:`Not a number`,scrollbackInvalidBody:`Scrollback must be a number of rows (e.g. 1000). Keeping the previous setting.`,tabStripRow:`tab strip: {mode}`,tabStripMode:{never:`off — the sidebar tree lists tabs`,multipleOnly:`only with 2+ tabs`,always:`always`},usageShowTitle:`Usage`,usageShowHint:`How plan quota and context percentages read, in the footer and here.`,usageShowRow:`percentages: {mode}`,usageShowMode:{used:`used`,left:`left`}},field:{command:`COMMAND`,name:`NAME`,id:`ID`},action:{save:`save`,next:`next`,add:`add`},reset:{title:`Reset UI state?`,body:`Wipes ~/.config/rove/state.json and ~/.rove/tasks.json, then quits Rove — relaunch for a fresh start with an empty working session list. Worktrees on disk and engine session history are NOT touched.`,done:`Rove: UI state reset. Relaunch Rove to start fresh.`,failedTitle:`UI state was not reset`,failedBody:`Could not write the settings file. Your settings and tasks have been kept. Try resetting again.`},restart:{title:`Restart backend?`,body:`Stops the daemon and relaunches this Rove on the installed build, so daemon / orchestrator / engine edits take effect. Running engine sessions live in the PTY host and keep going; open tabs come back. Any other attached windows reconnect on their own.`,done:`Rove: restarting the backend...`},stateWrite:{failedTitle:`Settings were not saved`,failedBody:`{file} could not be written ({keys}). Check its directory permissions and free disk space, then save again.`},...Wj,...Jj,...Xj,keybindings:{title:`Keybindings`,hint:`Press enter on a binding, then the key you want. To put it behind the prefix, press the prefix key first. Changes are saved to the file below and apply at once.`,configFile:`Config file`,notCreated:` (not created yet)`,prefixTitle:`Command layer ({prefix})`,prefixHint:`Bare keys act in the focused pane; a small one-press set covers frequent Rove actions; {prefix} opens the command layer ({timeout}ms second-stroke window). Prefix bindings keep their pane scope and modal rules.`,tapPresentation:`Prefix tap`,tapPresentationHint:`Choose whether the complete guide also marks controls already on screen.`,tapPresentationLocal:`On-screen entries + complete guide (default)`,tapPresentationGuide:`Complete guide only`,prefixDisabled:`disabled`,prefixKey:`Prefix key`,recording:`press the new key… (esc cancels)`,recordingPrefix:`{prefix}, then… (esc cancels)`,recordingSlot:`press the key for {slot}… (esc cancels)`,unbound:`(unbound)`,defaultKeys:`default: {keys}`,warnings:`Warnings`},feedback:{title:`Feedback`,hint:"Files a GitHub issue on the Rove repo through `gh`. Requires `gh auth login`; without it you get a prefilled link to open.",titleLabel:`title`,titlePlaceholder:`Short summary`,descriptionLabel:`description`,descriptionPlaceholder:`What happened? (enter for a new line · tab to Send)`,send:`[enter] File a GitHub issue`,submitting:`submitting...`,sent:`filed #{number}: {url}`,notFiled:`not filed: {hint}
60
60
  {url}`,error:`error: {message}
61
- {hint}`},...Gj},zh:{...Hj,title:`设置`,esc:`esc`,search:{placeholder:`搜索设置…`,hint:`/ 搜索设置…`,title:`搜索结果`,count:`{count} 项结果`,countOne:`1 项结果`,empty:`没有匹配「{query}」的设置。`,emptyHint:`换个关键词试试,或按 esc 返回。`,clear:`清除搜索`},nav:{default:`j/k 选择 · h/l 切换层级 · / 搜索 · enter 确认 · esc 关闭`,keys:`j/k 选择 · / 搜索 · enter 录入按键 · backspace 恢复默认 · x 解绑 · esc 关闭`,feedback:`tab 下一项 · enter 在发送项发送 · esc 关闭`,search:`↑/↓ 选择 · enter 跳转 · esc 取消`},groups:{preferences:`偏好`,agents:`智能体`,more:`更多`},sections:{general:`通用`,autoRouting:`自动路由`,engines:`引擎`,plugins:`插件`,marketplace:`插件市场`,keys:`快捷键`,feedback:`反馈`,dev:`开发`},general:{usage:`用量`,theme:`主题`,themeMode:`明暗`,themeHint:`l 进入列表 · j/k 高亮 · enter 应用`,language:`语言`,languageHint:`Rove 界面的显示语言。l 进入列表 · j/k 高亮 · enter 应用。`,transparent:`透明背景`,transparentHint:`去掉渲染器的背景填充,让宿主终端透出来。按 enter 切换。`,on:`[x] 开`,off:`[ ] 关`,focusAccent:`聚焦强调色`,focusAccentHint:`聚焦面板标题、▌ 标记和分隔边框的颜色。`,accentPrimary:`主色(品牌强调色)`,accentSuccess:`成功色(传统绿)`,accentInfo:`信息色(冷蓝)`,appearance:`外观`,appearanceHint:`分屏面板怎么画边。`,splitStyle:`分屏面板`,workingBorder:`运行中边框`,taskColors:`任务配色`,glyphSet:`状态符号`,colorblind:`色盲友好的增删配色`,runningTitle:`运行中标题`,splitBox:`方框边框`,splitLine:`单线分隔`,splitRail:`左侧强调条`,splitRule:`顶部横线`,notifications:`通知`,notificationsHint:`后台标签完成或在审批处暂停时触发。`,toast:`Toast 弹窗`,toastHint:`右下角弹窗`,sound:`声音`,soundHint:`响铃 + 提示音 + OSC 9 桌面通知(经 SSH 直达本地)`,soundVolume:`提示音音量 — {percent}%`,soundVolumeHint:`回车循环切换;下一声提示音生效`,crossTask:`跨任务`,crossTaskHint:`你已切走的任务也通知`,finishedAlerts:`回合完成`,finishedAlertsHint:`关闭后只有审批和错误会提醒;未读标记照常`,keyHints:`键盘提示`,keyHintsHint:`状态栏里的命令键和帮助键提醒。`,keyHintsShow:`显示键盘提示`,updates:`更新`,updatesHint:`稳定版是默认渠道;next 预览即将发布的版本;nightly 每天从 main 自动构建。`,updateChannelTitle:`发布渠道`,updateChannel:`渠道:{channel}`,updateChannelHint:"enter 在稳定版 / next / nightly 间切换;`rove update` 跟随它",updateChannelName:{latest:`稳定版`,next:`next 预览版`,nightly:`nightly 预览版`},updateNotify:`有新版本时通知我`,updateNotifyHint:`只针对所选渠道;关闭后不再显示更新标记,手动检查仍会给出结果`,updateCheck:`[ 检查更新 ]`,updateCheckHint:`立即向 npm 查询所选渠道的最新版本`,updateCheckButton:`检查更新`,updateChecking:`检查中…`,updateOpenPage:`打开更新页`,updateOpenPageRow:`[ 打开更新页 ]`,railFold:`折叠后的任务栏`,railFoldHint:`任务栏从角标折叠之后显示什么。`,railFoldRow:`折叠后显示:{style}`,railFoldRowHint:`enter 切换`,railFoldGlyphs:`状态字形`,railFoldInitials:`字形 + 首字母`,railFoldHairline:`仅色带`,editor:`编辑器`,editorHint:`文件树里按 enter 用什么打开文件——支持时走编辑器 diff 模式,未安装时回退到只读预览。`,editorRow:`编辑器: < {kind} >`,editorRowHint:`auto 跟随 $VISUAL / $EDITOR,否则 nvim / vim / emacs / nano`,editorCustom:`自定义: {cmd}`,editorCustomUnset:`(未设置 — enter 编辑)`,worktree:`工作树位置`,worktreeHint:`新任务工作树的创建位置。仅对新任务生效。`,worktreeBase:`位置: < {kind} >`,worktreeBaseHint:"自定义可填 `~`、相对路径或以 `$project_dir` 开头",worktreeKindDefault:`默认 ~/.rove/worktrees`,worktreeKindNext:`项目旁边`,worktreeKindCustom:`自定义`,worktreeCustom:`自定义: {path}`,worktreeCustomUnset:`(未设置 — enter 编辑)`,worktreeBaseTitle:`自定义工作树位置(留空 = 默认;$project_dir = 项目根目录)`,worktreeBaseField:`路径`,editorCustomTitle:`自定义编辑器命令(用 {file} 代表文件路径)`,worktreeBaseInvalidTitle:`无法使用该工作树位置`,worktreeBaseTokenBody:`{token} 只能作为路径的第一段展开(如 {token}/../rove-worktrees)。保留原设置。`,worktreeBaseUnusableBody:`{path} 不可用({error})。保留原设置 —— 请选择一个可写目录。`,terminal:`终端`,terminalHint:`对修改后新打开的终端生效。`,scrollbackRow:`回滚行数: {rows} 行`,scrollbackRowHint:`100–100000 · 调大会按比例增加每次重绘的 CPU`,scrollbackTitle:`终端回滚行数(100–100000)`,scrollbackField:`行数`,scrollbackInvalidTitle:`不是数字`,scrollbackInvalidBody:`回滚行数必须是数字(如 1000)。保留原设置。`,tabStripRow:`标签栏: {mode}`,tabStripMode:{never:`关闭 — 标签在左侧树里`,multipleOnly:`仅 2 个以上标签时显示`,always:`始终显示`},usageShowTitle:`用量`,usageShowHint:`套餐额度和上下文百分比的显示方式,作用于底栏和此处。`,usageShowRow:`百分比: {mode}`,usageShowMode:{used:`已用`,left:`剩余`}},field:{command:`命令`,name:`名称`,id:`标识`},action:{save:`保存`,next:`下一步`,add:`添加`},reset:{title:`重置界面状态?`,body:`将清除 ~/.config/rove/state.json 和 ~/.rove/tasks.json 并退出 Rove —— 重新启动后会是一个干净的开始,工作会话列表为空。磁盘上的工作树和引擎会话历史不受影响。`,done:`Rove:界面状态已重置。重新启动 Rove 即可从头开始。`,failedTitle:`UI 状态未能重置`,failedBody:`无法写入设置文件。设置和任务均已保留,请稍后重新尝试重置。`},restart:{title:`重启后端?`,body:`会停掉 daemon,并以已安装的版本重新启动当前 Rove 窗口,从而让 daemon / orchestrator / 引擎的改动生效。正在运行的引擎会话由 PTY host 托管,不会中断;已打开的标签页会恢复。其他已连接的窗口会自行重连。`,done:`Rove:正在重启后端……`},stateWrite:{failedTitle:`设置未能保存`,failedBody:`{file} 写入失败({keys})。请检查目录权限和磁盘空间,再次保存。`},...Wj,...Jj,...Xj,keybindings:{title:`快捷键`,hint:`在某一行按 enter,再按你想要的键。想放到 prefix 后面,就先按 prefix 键。改动会写进下面的文件,立即生效。`,configFile:`配置文件`,notCreated:` (尚未创建)`,prefixTitle:`命令层({prefix})`,prefixHint:`裸键作用于当前聚焦面板;少量单次快捷键覆盖高频 Rove 操作;{prefix} 打开命令层(第二击窗口 {timeout}ms)。Prefix 绑定保持原有的面板作用域和 modal 规则。`,tapPresentation:`点按 Prefix`,tapPresentationHint:`选择完整指南是否同时标记当前屏幕上的入口。`,tapPresentationLocal:`屏幕入口 + 完整指南(默认)`,tapPresentationGuide:`仅完整指南`,prefixDisabled:`已禁用`,prefixKey:`Prefix 键`,recording:`按下新的键…(esc 取消)`,recordingPrefix:`{prefix},然后…(esc 取消)`,recordingSlot:`按下「{slot}」对应的键…(esc 取消)`,unbound:`(已解绑)`,defaultKeys:`默认: {keys}`,warnings:`警告`},feedback:{title:`反馈`,hint:"通过 `gh` 在 Rove 仓库提一个 GitHub issue。需要 `gh auth login`;没登录时会给你一条预填好的链接。",titleLabel:`标题`,titlePlaceholder:`简短概括`,descriptionLabel:`描述`,descriptionPlaceholder:`发生了什么?(enter 换行 · tab 跳到发送)`,send:`[enter] 提交 GitHub issue`,submitting:`提交中...`,sent:`已提交 #{number}:{url}`,notFiled:`未提交:{hint}
61
+ {hint}`},...Kj},zh:{...Uj,title:`设置`,esc:`esc`,search:{placeholder:`搜索设置…`,hint:`/ 搜索设置…`,title:`搜索结果`,count:`{count} 项结果`,countOne:`1 项结果`,empty:`没有匹配「{query}」的设置。`,emptyHint:`换个关键词试试,或按 esc 返回。`,clear:`清除搜索`},nav:{default:`j/k 选择 · h/l 切换层级 · / 搜索 · enter 确认 · esc 关闭`,keys:`j/k 选择 · / 搜索 · enter 录入按键 · backspace 恢复默认 · x 解绑 · esc 关闭`,feedback:`tab 下一项 · enter 在发送项发送 · esc 关闭`,search:`↑/↓ 选择 · enter 跳转 · esc 取消`},groups:{preferences:`偏好`,agents:`智能体`,more:`更多`},sections:{general:`通用`,autoRouting:`自动路由`,engines:`引擎`,plugins:`插件`,marketplace:`插件市场`,keys:`快捷键`,feedback:`反馈`,dev:`开发`},general:{usage:`用量`,theme:`主题`,themeMode:`明暗`,themeHint:`l 进入列表 · j/k 高亮 · enter 应用`,language:`语言`,languageHint:`Rove 界面的显示语言。l 进入列表 · j/k 高亮 · enter 应用。`,transparent:`透明背景`,transparentHint:`去掉渲染器的背景填充,让宿主终端透出来。按 enter 切换。`,on:`[x] 开`,off:`[ ] 关`,focusAccent:`聚焦强调色`,focusAccentHint:`聚焦面板标题、▌ 标记和分隔边框的颜色。`,accentPrimary:`主色(品牌强调色)`,accentSuccess:`成功色(传统绿)`,accentInfo:`信息色(冷蓝)`,appearance:`外观`,appearanceHint:`分屏面板怎么画边。`,splitStyle:`分屏面板`,workingBorder:`运行中边框`,taskColors:`任务配色`,glyphSet:`状态符号`,colorblind:`色盲友好的增删配色`,runningTitle:`运行中标题`,splitBox:`方框边框`,splitLine:`单线分隔`,splitRail:`左侧强调条`,splitRule:`顶部横线`,notifications:`通知`,notificationsHint:`后台标签完成或在审批处暂停时触发。`,toast:`Toast 弹窗`,toastHint:`右下角弹窗`,sound:`声音`,soundHint:`响铃 + 提示音 + OSC 9 桌面通知(经 SSH 直达本地)`,soundVolume:`提示音音量 — {percent}%`,soundVolumeHint:`回车循环切换;下一声提示音生效`,crossTask:`跨任务`,crossTaskHint:`你已切走的任务也通知`,finishedAlerts:`回合完成`,finishedAlertsHint:`关闭后只有审批和错误会提醒;未读标记照常`,keyHints:`键盘提示`,keyHintsHint:`状态栏里的命令键和帮助键提醒。`,keyHintsShow:`显示键盘提示`,updates:`更新`,updatesHint:`稳定版是默认渠道;next 预览即将发布的版本;nightly 每天从 main 自动构建。`,updateChannelTitle:`发布渠道`,updateChannel:`渠道:{channel}`,updateChannelHint:"enter 在稳定版 / next / nightly 间切换;`rove update` 跟随它",updateChannelName:{latest:`稳定版`,next:`next 预览版`,nightly:`nightly 预览版`},updateNotify:`有新版本时通知我`,updateNotifyHint:`只针对所选渠道;关闭后不再显示更新标记,手动检查仍会给出结果`,updateCheck:`[ 检查更新 ]`,updateCheckHint:`立即向 npm 查询所选渠道的最新版本`,updateCheckButton:`检查更新`,updateChecking:`检查中…`,updateOpenPage:`打开更新页`,updateOpenPageRow:`[ 打开更新页 ]`,railFold:`折叠后的任务栏`,railFoldHint:`任务栏从角标折叠之后显示什么。`,railFoldRow:`折叠后显示:{style}`,railFoldRowHint:`enter 切换`,railFoldGlyphs:`状态字形`,railFoldInitials:`字形 + 首字母`,railFoldHairline:`仅色带`,editor:`编辑器`,editorHint:`文件树里按 enter 用什么打开文件——支持时走编辑器 diff 模式,未安装时回退到只读预览。`,editorRow:`编辑器: < {kind} >`,editorRowHint:`auto 跟随 $VISUAL / $EDITOR,否则 nvim / vim / emacs / nano`,editorCustom:`自定义: {cmd}`,editorCustomUnset:`(未设置 — enter 编辑)`,worktree:`工作树位置`,worktreeHint:`新任务工作树的创建位置。仅对新任务生效。`,worktreeBase:`位置: < {kind} >`,worktreeBaseHint:"自定义可填 `~`、相对路径或以 `$project_dir` 开头",worktreeKindDefault:`默认 ~/.rove/worktrees`,worktreeKindNext:`项目旁边`,worktreeKindCustom:`自定义`,worktreeCustom:`自定义: {path}`,worktreeCustomUnset:`(未设置 — enter 编辑)`,worktreeBaseTitle:`自定义工作树位置(留空 = 默认;$project_dir = 项目根目录)`,worktreeBaseField:`路径`,editorCustomTitle:`自定义编辑器命令(用 {file} 代表文件路径)`,worktreeBaseInvalidTitle:`无法使用该工作树位置`,worktreeBaseTokenBody:`{token} 只能作为路径的第一段展开(如 {token}/../rove-worktrees)。保留原设置。`,worktreeBaseUnusableBody:`{path} 不可用({error})。保留原设置 —— 请选择一个可写目录。`,terminal:`终端`,terminalHint:`对修改后新打开的终端生效。`,scrollbackRow:`回滚行数: {rows} 行`,scrollbackRowHint:`100–100000 · 调大会按比例增加每次重绘的 CPU`,scrollbackTitle:`终端回滚行数(100–100000)`,scrollbackField:`行数`,scrollbackInvalidTitle:`不是数字`,scrollbackInvalidBody:`回滚行数必须是数字(如 1000)。保留原设置。`,tabStripRow:`标签栏: {mode}`,tabStripMode:{never:`关闭 — 标签在左侧树里`,multipleOnly:`仅 2 个以上标签时显示`,always:`始终显示`},usageShowTitle:`用量`,usageShowHint:`套餐额度和上下文百分比的显示方式,作用于底栏和此处。`,usageShowRow:`百分比: {mode}`,usageShowMode:{used:`已用`,left:`剩余`}},field:{command:`命令`,name:`名称`,id:`标识`},action:{save:`保存`,next:`下一步`,add:`添加`},reset:{title:`重置界面状态?`,body:`将清除 ~/.config/rove/state.json 和 ~/.rove/tasks.json 并退出 Rove —— 重新启动后会是一个干净的开始,工作会话列表为空。磁盘上的工作树和引擎会话历史不受影响。`,done:`Rove:界面状态已重置。重新启动 Rove 即可从头开始。`,failedTitle:`UI 状态未能重置`,failedBody:`无法写入设置文件。设置和任务均已保留,请稍后重新尝试重置。`},restart:{title:`重启后端?`,body:`会停掉 daemon,并以已安装的版本重新启动当前 Rove 窗口,从而让 daemon / orchestrator / 引擎的改动生效。正在运行的引擎会话由 PTY host 托管,不会中断;已打开的标签页会恢复。其他已连接的窗口会自行重连。`,done:`Rove:正在重启后端……`},stateWrite:{failedTitle:`设置未能保存`,failedBody:`{file} 写入失败({keys})。请检查目录权限和磁盘空间,再次保存。`},...Gj,...Yj,...Zj,keybindings:{title:`快捷键`,hint:`在某一行按 enter,再按你想要的键。想放到 prefix 后面,就先按 prefix 键。改动会写进下面的文件,立即生效。`,configFile:`配置文件`,notCreated:` (尚未创建)`,prefixTitle:`命令层({prefix})`,prefixHint:`裸键作用于当前聚焦面板;少量单次快捷键覆盖高频 Rove 操作;{prefix} 打开命令层(第二击窗口 {timeout}ms)。Prefix 绑定保持原有的面板作用域和 modal 规则。`,tapPresentation:`点按 Prefix`,tapPresentationHint:`选择完整指南是否同时标记当前屏幕上的入口。`,tapPresentationLocal:`屏幕入口 + 完整指南(默认)`,tapPresentationGuide:`仅完整指南`,prefixDisabled:`已禁用`,prefixKey:`Prefix 键`,recording:`按下新的键…(esc 取消)`,recordingPrefix:`{prefix},然后…(esc 取消)`,recordingSlot:`按下「{slot}」对应的键…(esc 取消)`,unbound:`(已解绑)`,defaultKeys:`默认: {keys}`,warnings:`警告`},feedback:{title:`反馈`,hint:"通过 `gh` 在 Rove 仓库提一个 GitHub issue。需要 `gh auth login`;没登录时会给你一条预填好的链接。",titleLabel:`标题`,titlePlaceholder:`简短概括`,descriptionLabel:`描述`,descriptionPlaceholder:`发生了什么?(enter 换行 · tab 跳到发送)`,send:`[enter] 提交 GitHub issue`,submitting:`提交中...`,sent:`已提交 #{number}:{url}`,notFiled:`未提交:{hint}
62
62
  {url}`,error:`错误:{message}
63
- {hint}`},...Kj}},Qj={en:ka,zh:Aa};function Q(e,t){return Wt(Zj,e,t)}function $j(e,t){return Wt(Qj,e,t)}function eM({label:e,value:t,picks:n,onPick:r}){let i=(0,h.useRef)(!1),[a,o]=(0,h.useState)(!1),s=e=>{if(Ee())return o(!0);let i=e.getBoundingClientRect();O.set({x:i.left,y:i.bottom+4,right:i.right,minWidth:i.width,start:Math.max(n.findIndex(e=>e.value===t),0),target:e,items:n.map(n=>({label:n.label,checked:n.value===t,run:()=>{e.focus(),n.value!==t&&r(n.value)}}))})};return(0,U.jsxs)(U.Fragment,{children:[a&&(0,U.jsx)(xu,{title:e,value:t,picks:n,onPick:r,onClose:()=>o(!1)}),(0,U.jsxs)(`button`,{type:`button`,"aria-label":`${e}: ${n.find(e=>e.value===t)?.label??t}`,"aria-haspopup":`menu`,className:`relative inline-flex max-w-full min-w-0 items-center rounded-sm border-hairline border-line bg-inset py-1.5 pr-7 pl-2.5 text-left font-sans text-meta text-ink hover:border-line-active focus-visible:border-line-active focus-visible:outline-none data-menu-open:border-line-active touch:min-h-10 w-narrow:border-0 w-narrow:bg-transparent w-narrow:pr-5 w-narrow:pl-0 w-narrow:text-body w-narrow:text-muted`,onMouseDown:e=>{i.current=e.currentTarget.hasAttribute(`data-menu-open`)},onClick:e=>{i.current||s(e.currentTarget),i.current=!1},onKeyDown:e=>{(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),s(e.currentTarget))},children:[(0,U.jsx)(`span`,{className:`min-w-0 truncate`,children:n.find(e=>e.value===t)?.label??t}),(0,U.jsx)(Bv,{className:`pointer-events-none absolute top-1/2 right-2.5 -translate-y-1/2 text-subtle w-narrow:right-0`})]})]})}var tM=`${li} w-narrow:pt-0`,nM=`dialog relative m-0 flex h-[min(640px,80vh)] w-[min(880px,calc(100vw-32px))] overflow-hidden rounded-md border-hairline border-line bg-surface text-inherit shadow-dialog focus:outline-none motion-safe:animate-rise-in [.is-leaving_&]:animate-sink-out w-narrow:motion-safe:animate-push-in w-narrow:[.is-leaving_&]:animate-push-out w-narrow:bg-paper w-narrow:h-dvh w-narrow:w-screen w-narrow:flex-col w-narrow:rounded-none w-narrow:border-0 w-narrow:pt-[env(safe-area-inset-top)] w-narrow:translate-x-[var(--back-x,0px)] w-narrow:px-0 w-narrow:pb-[env(safe-area-inset-bottom)] short:h-[calc(100dvh-24px)]`,rM=`absolute top-3 right-3 z-1 grid size-7 place-items-center rounded-sm text-display leading-none text-muted hover:bg-inset hover:text-ink focus-visible:bg-inset focus-visible:text-ink touch:size-10`,iM=e=>`flex min-h-0 min-w-0 flex-1 flex-col w-narrow:motion-safe:animate-push-in ${e?`absolute inset-0 z-1 translate-x-(--back-x) bg-surface [padding:inherit] shadow-dialog w-narrow:bg-paper`:``}`,aM=`flex w-56 flex-none flex-col gap-5 overflow-y-auto scrollbar-none [border-right:var(--hairline)_solid_var(--line)] px-2.5 py-4`,oM=`m-0 px-2 pb-0.5 font-sans text-title font-semibold normal-nums text-ink`,sM=`flex flex-col gap-2.5`,cM=`relative flex items-center`,lM=`pointer-events-none absolute left-2.5 block size-3.5 text-subtle w-narrow:left-3 w-narrow:size-4`,uM=`${Yr} w-full py-1.25 pr-7 pl-7.5 font-sans text-body w-narrow:min-h-10 w-narrow:rounded-[10px] w-narrow:border-0 w-narrow:bg-surface w-narrow:py-2 w-narrow:pr-9 w-narrow:pl-9`,dM=`flex flex-col border-t-hairline border-t-line [&>*]:border-b-hairline [&>*]:border-b-line`,fM=e=>`flex w-full flex-col gap-0.5 px-2.5 py-2.5 text-left transition-none focus-visible:outline-1 focus-visible:outline-offset-[-1px] focus-visible:outline-focus ${e?`bg-menu`:`hover:bg-hover`}`,pM=`flex w-full min-w-0 items-baseline justify-between gap-3`,mM=`flex-none whitespace-nowrap font-mono text-meta text-subtle`,hM=`data-[setting-flash=true]:-mx-2 data-[setting-flash=true]:rounded-sm data-[setting-flash=true]:border-b-transparent data-[setting-flash=true]:bg-accent-soft data-[setting-flash=true]:px-2 w-narrow:data-[setting-flash=true]:mx-0 w-narrow:data-[setting-flash=true]:rounded-none w-narrow:data-[setting-flash=true]:px-3`,gM=`flex flex-col gap-0.5`,_M=`m-0 px-2 pb-1 font-mono text-meta font-normal text-subtle`,vM=`flex flex-col gap-0.5`,yM=e=>`flex items-center rounded-sm px-2 py-1.25 text-left font-sans text-body text-ink touch:min-h-10 ${e?`bg-menu`:`hover:bg-hover`}`,bM=`ml-auto block text-subtle`,xM=`block size-5 flex-none fill-none stroke-current text-muted [stroke-linecap:round] [stroke-linejoin:round] [stroke-width:1.4]`,SM=`min-h-0 min-w-0 flex-1 overflow-y-auto scrollbar-none`,CM=`flex w-full flex-col gap-7 px-8 pt-7 pb-10 w-narrow:gap-4 w-narrow:px-3 w-narrow:pt-0 w-narrow:pb-10`,wM=`flex flex-col gap-1 pr-8 w-narrow:pr-0`,TM=`m-0 font-sans text-display font-semibold normal-nums text-ink`,EM=`m-0 text-body text-muted w-narrow:px-3 w-narrow:text-meta`,DM=`flex flex-col gap-7 w-narrow:gap-4`,OM=`flex flex-col`,kM=`flex min-w-0 flex-wrap gap-x-4 text-meta`,AM=`inline-flex min-h-6.5 min-w-0 items-center gap-2`,jM=`block h-7 w-36 rounded-md border-hairline border-line bg-paper w-narrow:hidden`,MM=`m-0 pb-1.5 font-sans text-meta font-medium normal-nums text-muted w-narrow:px-3 w-narrow:font-normal w-narrow:text-subtle`,NM=`m-0 pb-2 text-meta text-subtle w-narrow:order-last w-narrow:px-3 w-narrow:pt-1.5 w-narrow:pb-0`,PM=`flex flex-col border-t-hairline border-t-line [&>*]:border-b-hairline [&>*]:border-b-line w-narrow:overflow-hidden w-narrow:rounded-[12px] w-narrow:border-t-0 w-narrow:bg-surface w-narrow:[&>*]:px-3 w-narrow:[&>*:last-child]:border-b-0`,FM=`w-narrow:grid w-narrow:grid-cols-[minmax(0,1fr)_auto] w-narrow:items-center w-narrow:gap-x-3 w-narrow:gap-y-0.5`,IM=`flex items-center justify-between gap-x-6 gap-y-2 py-3 w-narrow:min-h-11 ${FM}`,LM=`flex items-center justify-between gap-x-6 py-3 ${FM}`,RM=`w-narrow:col-start-1 w-narrow:row-start-1 w-narrow:line-clamp-2`,zM=`flex flex-col gap-3 py-3`,BM=`flex min-w-0 flex-1 flex-col gap-0.5 w-narrow:contents`,VM=`text-body text-ink w-narrow:text-title`,HM=`text-meta text-muted [&_a]:text-accent`,UM=`max-w-90 min-w-0 truncate font-mono text-meta text-muted [overflow-wrap:anywhere]`,WM=`flex min-h-13 w-full items-center gap-3 py-2 text-left active:bg-hover`,GM=`flex min-w-0 flex-1 flex-col gap-0.5`,KM=`w-narrow:order-last`,qM=`flex flex-wrap items-center justify-between gap-2.5 w-narrow:flex-col w-narrow:items-stretch w-narrow:[&>fieldset]:self-start`,JM=`m-0 py-3 text-body text-muted`,YM=`${Yr} px-2.5 py-1.5 font-sans text-body`,XM=`${YM} w-24 text-right`,ZM=`flex flex-col gap-1.5`,QM=`flex flex-wrap items-center justify-end gap-2.5`,$M=`flex items-center gap-2.5 rounded-sm bg-inset px-3 py-2 text-meta`,eN=`grid grid-cols-[minmax(0,1fr)_104px_72px] items-center gap-3`,tN=`flex flex-col`,nN=`${eN} pb-1.5 pl-7.5 font-sans text-meta font-medium normal-nums text-subtle [&>span:not(:first-child)]:text-center`,rN=`border-b-hairline border-b-line first:border-t-hairline first:border-t-line`,iN=`${eN} group/eng rounded-sm py-1.5 pr-1 pl-0`,aN=`flex min-w-0 items-center gap-2 rounded-sm py-1.5 pr-0 pl-1.5 text-left focus-visible:outline-1 focus-visible:outline-offset-1 focus-visible:outline-focus`,oN=e=>`mx-0.5 ${e?`text-muted`:`text-subtle`}`,sN=`flex min-w-0 flex-col gap-0.5`,cN=e=>`truncate text-body leading-[inherit] font-medium ${e?`text-muted`:`text-ink`}`,lN=`ml-2 text-meta leading-[inherit] font-normal text-subtle`,uN={ready:`bg-success`,attention:`bg-warning`,error:`bg-error`,absent:`bg-subtle`},dN=e=>`inline-flex items-center gap-1.5 text-meta leading-[inherit] ${e===`error`?`text-error`:`text-muted`}`,fN=e=>`size-1.75 flex-none rounded-full ${uN[e]}`,pN=`flex justify-center`,mN=`rounded-full bg-accent-soft px-2.5 py-0.5 font-sans text-meta font-medium normal-nums capitalize text-accent`,hN=`rounded-full border-hairline border-line px-2.5 py-0.5 text-meta leading-[inherit] whitespace-nowrap text-muted opacity-0 transition-opacity duration-120 ease-[ease] group-hover/eng:opacity-100 group-focus-within/eng:opacity-100 hover:border-line-active hover:text-ink motion-reduce:transition-none touch:opacity-100`,gN=`relative flex min-h-13 items-center gap-3 px-3 py-2`,_N=`flex min-w-0 flex-1 items-center gap-3 text-left after:absolute after:inset-0 after:content-[''] active:after:bg-hover focus-visible:outline-none focus-visible:after:bg-hover`,vN=`truncate font-sans text-title text-ink`,yN=`block text-subtle`,bN=`px-2 pt-1 pb-3`,xN=`mt-0 mr-1 mb-3 ml-7 flex flex-col gap-2.5 px-1.5 py-1`,SN=`m-0 grid grid-cols-[max-content_minmax(0,1fr)] gap-x-3.5 gap-y-1.5 text-meta leading-[1.5]`,CN=`text-subtle`,wN=e=>`m-0 wrap-anywhere ${e?`text-warning`:`text-ink`}`,TN=`flex items-center gap-2`,EN=`flex-1 px-2 py-1.25`,DN=`text-meta leading-[inherit] text-success`,ON=(e=!1)=>`overflow-hidden text-ellipsis text-meta text-muted ${e?`whitespace-normal`:`whitespace-nowrap`}`,kN=`flex flex-col gap-1 py-3 w-narrow:py-0`,AN=`flex items-baseline gap-3`,jN=`flex flex-col gap-2.5 pt-2 w-narrow:pb-3`,MN=`grid grid-cols-[repeat(auto-fill,minmax(96px,1fr))] gap-2`,NN=`m-0 pb-1.5 text-meta font-medium text-subtle`,PN=e=>e?`border-accent bg-accent-soft`:`border-line hover:bg-hover`,FN=`flex h-9 overflow-hidden rounded-xs border-hairline`,IN=`flex w-2/5 flex-col gap-0.75 p-1`,LN=`flex min-w-0 flex-1 flex-col gap-0.75 p-1`,RN=`h-0.75 rounded-xs`,zN=`mt-auto flex gap-0.75`,BN=`size-1 rounded-xs`,VN=`flex min-w-0 items-baseline gap-1.5 font-sans text-meta`,HN=`grid grid-cols-2 gap-2.5 w-narrow:grid-cols-1`,UN=(e=!1)=>`flex min-w-0 flex-col gap-2.5 rounded-md border-hairline border-line bg-surface p-3.5 w-narrow:rounded-[12px] w-narrow:border-0 w-narrow:p-3 ${e?`col-span-2 w-narrow:col-span-1`:``}`,WN=`flex min-w-0 items-center gap-3`,GN=`flex min-w-0 flex-wrap items-center justify-end gap-x-3 gap-y-2`,KN=`flex min-w-0 grow basis-60 items-center gap-3`,qN=e=>`grid transition-[grid-template-rows,opacity] duration-300 ease-out motion-reduce:transition-none ${e?`grid-rows-[1fr] opacity-100`:`grid-rows-[0fr] opacity-0`}`,JN=`group relative h-4.5 w-7.5 flex-none justify-self-center rounded-full border-hairline border-line bg-inset transition-[background,border-color] duration-120 ease-[ease] aria-checked:border-accent aria-checked:bg-accent motion-reduce:transition-none`,YN=`absolute top-0.5 left-0.5 size-3 rounded-full bg-muted transition-[transform,background] duration-120 ease-[ease] group-aria-checked:[transform:translateX(12px)] group-aria-checked:bg-paper motion-reduce:transition-none`;function XN({on:e,...t}){return(0,U.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,className:JN,...t,children:(0,U.jsx)(`span`,{className:YN})})}function ZN(e){return(0,U.jsxs)(`section`,{className:e.settingId?`${OM} ${hM}`:OM,"data-setting-id":e.settingId,children:[e.title&&(0,U.jsx)(`h2`,{className:`m-0 pb-1.5 font-sans text-meta font-medium normal-nums text-muted w-narrow:px-3 w-narrow:font-normal w-narrow:text-subtle`,children:e.title}),e.hint&&(0,U.jsx)(`p`,{className:`m-0 pb-2 text-meta text-subtle w-narrow:order-last w-narrow:px-3 w-narrow:pt-1.5 w-narrow:pb-0`,children:e.hint}),(0,U.jsx)(`div`,{className:PM,children:e.children})]})}function QN(e){let t=(0,U.jsxs)(`div`,{className:BM,children:[(0,U.jsx)(`span`,{id:e.labelId,className:`${VM} ${RM}`,children:e.label}),e.hint&&(0,U.jsx)(`span`,{className:`text-meta text-muted [&_a]:text-accent w-narrow:col-span-2`,children:e.hint}),e.sample&&(0,U.jsx)(`span`,{className:`mt-1.5 flex min-w-0 w-narrow:col-span-2`,children:e.sample})]}),n=e.settingId?` ${hM}`:``;return e.stack?(0,U.jsxs)(`div`,{className:`${zM}${n}`,"data-setting-id":e.settingId,children:[t,e.children]}):(0,U.jsxs)(`div`,{className:`${e.inline?LM:IM}${n}`,"data-setting-id":e.settingId,children:[t,e.children&&(0,U.jsx)(`div`,{className:`flex min-w-0 flex-none items-center justify-end gap-2 w-narrow:col-start-2 w-narrow:row-start-1 w-narrow:max-w-[55vw]`,children:e.children})]})}function $N(e){let t=(0,h.useId)();return(0,U.jsx)(QN,{label:e.label,hint:e.hint,labelId:t,settingId:e.settingId,inline:!0,children:(0,U.jsx)(XN,{on:e.checked,"aria-labelledby":t,disabled:e.disabled,onClick:()=>e.onChange(!e.checked)})})}var eP=36,tP=/[\u2e80-\u9fff\uac00-\ud7af\uf900-\ufaff\uff00-\uffef]/,nP=20;function rP(e,t=!1){let n=0;for(let t of e)for(let e of t.label)n+=tP.test(e)?2:1;return t?e.length===2&&n<=nP:e.length<=4&&n<=eP}function iP(e){let t=rP(e.picks,Oe())?wO:eM;return(0,U.jsx)(QN,{label:e.label,hint:e.hint,sample:e.sample,settingId:e.settingId,children:(0,U.jsx)(t,{label:e.label,value:e.value,picks:e.picks,onPick:e.onPick})})}function aP(e){return(0,U.jsx)(QN,{label:e.label,hint:e.note,settingId:e.settingId,children:(0,U.jsx)(`span`,{className:UM,children:e.value})})}function oP(e,t){let[n,r]=(0,h.useState)(()=>J(e,t)),[i,a]=(0,h.useState)(null),o=(0,h.useCallback)(()=>ss(e,t).then(e=>{r(e),a(null)},e=>a(G(e))),[e,t]);return(0,h.useEffect)(()=>e.onOpen(()=>void o()),[e,o]),{value:n,failed:i,reload:o}}function sP(e){return e.failed===null?(0,U.jsx)(`p`,{className:JM,children:V(`preview.loading`)}):(0,U.jsxs)(`p`,{className:JM,children:[V(`settings.loadFailed`,{error:e.failed}),` `,(0,U.jsx)(W,{onClick:e.onRetry,children:V(`settings.retry`)})]})}var cP=[`web`,`tui`,`ios`,`android`,`cli`,`daemon`],lP=[`ios`,`web`,`daemon`],uP=[`ios`,`web`,`tui`,`cli`,`daemon`,`android`],dP=/^([-*]\s+(?:(?:\[[^\]]*\]\([^)]*\)|#\d+|`[0-9a-f]{7,40}`)\s+)*)/,fP=/^\*\*([a-z]+(?: · [a-z]+)*)\*\*([ \t]+|$)/,pP=/^(?:feat|fix|refactor|perf|chore|docs|style|test|build|ci|revert)\(([a-z0-9_/-]+(?:\s*,\s*[a-z0-9_/-]+)*)\)!?:\s/,mP={web:`web`,"rove-web":`web`,bridge:`web`,"rove-bridge":`web`,ios:`ios`,"rove-ios":`ios`,iphone:`ios`,phone:`ios`,mobile:`ios`,android:`android`,"rove-android":`android`,tui:`tui`,"tui-react":`tui`,terminal:`tui`,cli:`cli`,api:`cli`,daemon:`daemon`,"rove-daemon":`daemon`,pty:`daemon`,"pty-host":`daemon`,orchestrator:`daemon`},hP=e=>cP.includes(e);function gP(e){let t=dP.exec(e);if(!t)return null;let n=e.slice(t[0].length),r=fP.exec(n);if(r){let e=r[1]?.split(` · `)??[];return e.length>0&&e.every(hP)?e:null}let i=pP.exec(n);if(!i?.[1])return null;let a=[];for(let e of i[1].split(/[,/]/)){let t=mP[e.trim().toLowerCase()];t&&!a.includes(t)&&a.push(t)}return a.length>0?a:null}function _P(e){let t=dP.exec(e);if(!t)return e;let n=e.slice(t[0].length),r=fP.exec(n);if(!r)return e;let i=r[1]?.split(` · `)??[];return i.length===0||!i.every(hP)?e:`${t[0]}${n.slice(r[0].length)}`}function vP(e){let t=e.trim().toLowerCase();return t===`major changes`||t===`重大更新`?`major`:t===`minor changes`||t===`功能更新`?`minor`:t===`patch changes`||t===`补丁更新`?`patch`:`custom`}function yP(e,t){let n=new Map;for(let t of e){let e=n.get(t.scope),r=t.lines.join(`
64
- `).trimEnd();e?e.push(r):n.set(t.scope,[r])}let r=[];for(let e of t){let t=n.get(e);t&&t.length>0&&r.push({scope:e,entries:t,count:t.length})}return r}function bP(e,t){let n=[{heading:null,kind:null,preface:[],entries:[]}],r=[...t,`other`],i=uP.filter(e=>!t.includes(e));for(let r of e.replace(/\r\n/g,`
63
+ {hint}`},...qj}},$j={en:ka,zh:Aa};function Q(e,t){return Wt(Qj,e,t)}function eM(e,t){return Wt($j,e,t)}function tM({label:e,value:t,picks:n,onPick:r}){let i=(0,h.useRef)(!1),[a,o]=(0,h.useState)(!1),s=e=>{if(Ee())return o(!0);let i=e.getBoundingClientRect();O.set({x:i.left,y:i.bottom+4,right:i.right,minWidth:i.width,start:Math.max(n.findIndex(e=>e.value===t),0),target:e,items:n.map(n=>({label:n.label,checked:n.value===t,run:()=>{e.focus(),n.value!==t&&r(n.value)}}))})};return(0,U.jsxs)(U.Fragment,{children:[a&&(0,U.jsx)(xu,{title:e,value:t,picks:n,onPick:r,onClose:()=>o(!1)}),(0,U.jsxs)(`button`,{type:`button`,"aria-label":`${e}: ${n.find(e=>e.value===t)?.label??t}`,"aria-haspopup":`menu`,className:`relative inline-flex max-w-full min-w-0 items-center rounded-sm border-hairline border-line bg-inset py-1.5 pr-7 pl-2.5 text-left font-sans text-meta text-ink hover:border-line-active focus-visible:border-line-active focus-visible:outline-none data-menu-open:border-line-active touch:min-h-10 w-narrow:border-0 w-narrow:bg-transparent w-narrow:pr-5 w-narrow:pl-0 w-narrow:text-body w-narrow:text-muted`,onMouseDown:e=>{i.current=e.currentTarget.hasAttribute(`data-menu-open`)},onClick:e=>{i.current||s(e.currentTarget),i.current=!1},onKeyDown:e=>{(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),s(e.currentTarget))},children:[(0,U.jsx)(`span`,{className:`min-w-0 truncate`,children:n.find(e=>e.value===t)?.label??t}),(0,U.jsx)(Bv,{className:`pointer-events-none absolute top-1/2 right-2.5 -translate-y-1/2 text-subtle w-narrow:right-0`})]})]})}var nM=`${li} w-narrow:pt-0`,rM=`dialog relative m-0 flex h-[min(640px,80vh)] w-[min(880px,calc(100vw-32px))] overflow-hidden rounded-md border-hairline border-line bg-surface text-inherit shadow-dialog focus:outline-none motion-safe:animate-rise-in [.is-leaving_&]:animate-sink-out w-narrow:motion-safe:animate-push-in w-narrow:[.is-leaving_&]:animate-push-out w-narrow:bg-paper w-narrow:h-dvh w-narrow:w-screen w-narrow:flex-col w-narrow:rounded-none w-narrow:border-0 w-narrow:pt-[env(safe-area-inset-top)] w-narrow:translate-x-[var(--back-x,0px)] w-narrow:px-0 w-narrow:pb-[env(safe-area-inset-bottom)] short:h-[calc(100dvh-24px)]`,iM=`absolute top-3 right-3 z-1 grid size-7 place-items-center rounded-sm text-display leading-none text-muted hover:bg-inset hover:text-ink focus-visible:bg-inset focus-visible:text-ink touch:size-10`,aM=e=>`flex min-h-0 min-w-0 flex-1 flex-col w-narrow:motion-safe:animate-push-in ${e?`absolute inset-0 z-1 translate-x-(--back-x) bg-surface [padding:inherit] shadow-dialog w-narrow:bg-paper`:``}`,oM=`flex w-56 flex-none flex-col gap-5 overflow-y-auto scrollbar-none [border-right:var(--hairline)_solid_var(--line)] px-2.5 py-4`,sM=`m-0 px-2 pb-0.5 font-sans text-title font-semibold normal-nums text-ink`,cM=`flex flex-col gap-2.5`,lM=`relative flex items-center`,uM=`pointer-events-none absolute left-2.5 block size-3.5 text-subtle w-narrow:left-3 w-narrow:size-4`,dM=`${Yr} w-full py-1.25 pr-7 pl-7.5 font-sans text-body w-narrow:min-h-10 w-narrow:rounded-[10px] w-narrow:border-0 w-narrow:bg-surface w-narrow:py-2 w-narrow:pr-9 w-narrow:pl-9`,fM=`flex flex-col border-t-hairline border-t-line [&>*]:border-b-hairline [&>*]:border-b-line`,pM=e=>`flex w-full flex-col gap-0.5 px-2.5 py-2.5 text-left transition-none focus-visible:outline-1 focus-visible:outline-offset-[-1px] focus-visible:outline-focus ${e?`bg-menu`:`hover:bg-hover`}`,mM=`flex w-full min-w-0 items-baseline justify-between gap-3`,hM=`flex-none whitespace-nowrap font-mono text-meta text-subtle`,gM=`data-[setting-flash=true]:-mx-2 data-[setting-flash=true]:rounded-sm data-[setting-flash=true]:border-b-transparent data-[setting-flash=true]:bg-accent-soft data-[setting-flash=true]:px-2 w-narrow:data-[setting-flash=true]:mx-0 w-narrow:data-[setting-flash=true]:rounded-none w-narrow:data-[setting-flash=true]:px-3`,_M=`flex flex-col gap-0.5`,vM=`m-0 px-2 pb-1 font-mono text-meta font-normal text-subtle`,yM=`flex flex-col gap-0.5`,bM=e=>`flex items-center rounded-sm px-2 py-1.25 text-left font-sans text-body text-ink touch:min-h-10 ${e?`bg-menu`:`hover:bg-hover`}`,xM=`ml-auto block text-subtle`,SM=`block size-5 flex-none fill-none stroke-current text-muted [stroke-linecap:round] [stroke-linejoin:round] [stroke-width:1.4]`,CM=`min-h-0 min-w-0 flex-1 overflow-y-auto scrollbar-none`,wM=`flex w-full flex-col gap-7 px-8 pt-7 pb-10 w-narrow:gap-4 w-narrow:px-3 w-narrow:pt-0 w-narrow:pb-10`,TM=`flex flex-col gap-1 pr-8 w-narrow:pr-0`,EM=`m-0 font-sans text-display font-semibold normal-nums text-ink`,DM=`m-0 text-body text-muted w-narrow:px-3 w-narrow:text-meta`,OM=`flex flex-col gap-7 w-narrow:gap-4`,kM=`flex flex-col`,AM=`flex min-w-0 flex-wrap gap-x-4 text-meta`,jM=`inline-flex min-h-6.5 min-w-0 items-center gap-2`,MM=`block h-7 w-36 rounded-md border-hairline border-line bg-paper w-narrow:hidden`,NM=`m-0 pb-1.5 font-sans text-meta font-medium normal-nums text-muted w-narrow:px-3 w-narrow:font-normal w-narrow:text-subtle`,PM=`m-0 pb-2 text-meta text-subtle w-narrow:order-last w-narrow:px-3 w-narrow:pt-1.5 w-narrow:pb-0`,FM=`flex flex-col border-t-hairline border-t-line [&>*]:border-b-hairline [&>*]:border-b-line w-narrow:overflow-hidden w-narrow:rounded-[12px] w-narrow:border-t-0 w-narrow:bg-surface w-narrow:[&>*]:px-3 w-narrow:[&>*:last-child]:border-b-0`,IM=`w-narrow:grid w-narrow:grid-cols-[minmax(0,1fr)_auto] w-narrow:items-center w-narrow:gap-x-3 w-narrow:gap-y-0.5`,LM=`flex items-center justify-between gap-x-6 gap-y-2 py-3 w-narrow:min-h-11 ${IM}`,RM=`flex items-center justify-between gap-x-6 py-3 ${IM}`,zM=`w-narrow:col-start-1 w-narrow:row-start-1 w-narrow:line-clamp-2`,BM=`flex flex-col gap-3 py-3`,VM=`flex min-w-0 flex-1 flex-col gap-0.5 w-narrow:contents`,HM=`text-body text-ink w-narrow:text-title`,UM=`text-meta text-muted [&_a]:text-accent`,WM=`max-w-90 min-w-0 truncate font-mono text-meta text-muted [overflow-wrap:anywhere]`,GM=`flex min-h-13 w-full items-center gap-3 py-2 text-left active:bg-hover`,KM=`flex min-w-0 flex-1 flex-col gap-0.5`,qM=`w-narrow:order-last`,JM=`flex flex-wrap items-center justify-between gap-2.5 w-narrow:flex-col w-narrow:items-stretch w-narrow:[&>fieldset]:self-start`,YM=`m-0 py-3 text-body text-muted`,XM=`${Yr} px-2.5 py-1.5 font-sans text-body`,ZM=`${XM} w-24 text-right`,QM=`flex flex-col gap-1.5`,$M=`flex flex-wrap items-center justify-end gap-2.5`,eN=`flex items-center gap-2.5 rounded-sm bg-inset px-3 py-2 text-meta`,tN=`grid grid-cols-[minmax(0,1fr)_104px_72px] items-center gap-3`,nN=`flex flex-col`,rN=`${tN} pb-1.5 pl-7.5 font-sans text-meta font-medium normal-nums text-subtle [&>span:not(:first-child)]:text-center`,iN=`border-b-hairline border-b-line first:border-t-hairline first:border-t-line`,aN=`${tN} group/eng rounded-sm py-1.5 pr-1 pl-0`,oN=`flex min-w-0 items-center gap-2 rounded-sm py-1.5 pr-0 pl-1.5 text-left focus-visible:outline-1 focus-visible:outline-offset-1 focus-visible:outline-focus`,sN=e=>`mx-0.5 ${e?`text-muted`:`text-subtle`}`,cN=`flex min-w-0 flex-col gap-0.5`,lN=e=>`truncate text-body leading-[inherit] font-medium ${e?`text-muted`:`text-ink`}`,uN=`ml-2 text-meta leading-[inherit] font-normal text-subtle`,dN={ready:`bg-success`,attention:`bg-warning`,error:`bg-error`,absent:`bg-subtle`},fN=e=>`inline-flex items-center gap-1.5 text-meta leading-[inherit] ${e===`error`?`text-error`:`text-muted`}`,pN=e=>`size-1.75 flex-none rounded-full ${dN[e]}`,mN=`flex justify-center`,hN=`rounded-full bg-accent-soft px-2.5 py-0.5 font-sans text-meta font-medium normal-nums capitalize text-accent`,gN=`rounded-full border-hairline border-line px-2.5 py-0.5 text-meta leading-[inherit] whitespace-nowrap text-muted opacity-0 transition-opacity duration-120 ease-[ease] group-hover/eng:opacity-100 group-focus-within/eng:opacity-100 hover:border-line-active hover:text-ink motion-reduce:transition-none touch:opacity-100`,_N=`relative flex min-h-13 items-center gap-3 px-3 py-2`,vN=`flex min-w-0 flex-1 items-center gap-3 text-left after:absolute after:inset-0 after:content-[''] active:after:bg-hover focus-visible:outline-none focus-visible:after:bg-hover`,yN=`truncate font-sans text-title text-ink`,bN=`block text-subtle`,xN=`px-2 pt-1 pb-3`,SN=`mt-0 mr-1 mb-3 ml-7 flex flex-col gap-2.5 px-1.5 py-1`,CN=`m-0 grid grid-cols-[max-content_minmax(0,1fr)] gap-x-3.5 gap-y-1.5 text-meta leading-[1.5]`,wN=`text-subtle`,TN=e=>`m-0 wrap-anywhere ${e?`text-warning`:`text-ink`}`,EN=`flex items-center gap-2`,DN=`flex-1 px-2 py-1.25`,ON=`text-meta leading-[inherit] text-success`,kN=(e=!1)=>`overflow-hidden text-ellipsis text-meta text-muted ${e?`whitespace-normal`:`whitespace-nowrap`}`,AN=`flex flex-col gap-1 py-3 w-narrow:py-0`,jN=`flex items-baseline gap-3`,MN=`flex flex-col gap-2.5 pt-2 w-narrow:pb-3`,NN=`grid grid-cols-[repeat(auto-fill,minmax(96px,1fr))] gap-2`,PN=`m-0 pb-1.5 text-meta font-medium text-subtle`,FN=e=>e?`border-accent bg-accent-soft`:`border-line hover:bg-hover`,IN=`flex h-9 overflow-hidden rounded-xs border-hairline`,LN=`flex w-2/5 flex-col gap-0.75 p-1`,RN=`flex min-w-0 flex-1 flex-col gap-0.75 p-1`,zN=`h-0.75 rounded-xs`,BN=`mt-auto flex gap-0.75`,VN=`size-1 rounded-xs`,HN=`flex min-w-0 items-baseline gap-1.5 font-sans text-meta`,UN=`grid grid-cols-2 gap-2.5 w-narrow:grid-cols-1`,WN=(e=!1)=>`flex min-w-0 flex-col gap-2.5 rounded-md border-hairline border-line bg-surface p-3.5 w-narrow:rounded-[12px] w-narrow:border-0 w-narrow:p-3 ${e?`col-span-2 w-narrow:col-span-1`:``}`,GN=`flex min-w-0 items-center gap-3`,KN=`flex min-w-0 flex-wrap items-center justify-end gap-x-3 gap-y-2`,qN=`flex min-w-0 grow basis-60 items-center gap-3`,JN=e=>`grid transition-[grid-template-rows,opacity] duration-300 ease-out motion-reduce:transition-none ${e?`grid-rows-[1fr] opacity-100`:`grid-rows-[0fr] opacity-0`}`,YN=`group relative h-4.5 w-7.5 flex-none justify-self-center rounded-full border-hairline border-line bg-inset transition-[background,border-color] duration-120 ease-[ease] aria-checked:border-accent aria-checked:bg-accent motion-reduce:transition-none`,XN=`absolute top-0.5 left-0.5 size-3 rounded-full bg-muted transition-[transform,background] duration-120 ease-[ease] group-aria-checked:[transform:translateX(12px)] group-aria-checked:bg-paper motion-reduce:transition-none`;function ZN({on:e,...t}){return(0,U.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,className:YN,...t,children:(0,U.jsx)(`span`,{className:XN})})}function QN(e){return(0,U.jsxs)(`section`,{className:e.settingId?`${kM} ${gM}`:kM,"data-setting-id":e.settingId,children:[e.title&&(0,U.jsx)(`h2`,{className:`m-0 pb-1.5 font-sans text-meta font-medium normal-nums text-muted w-narrow:px-3 w-narrow:font-normal w-narrow:text-subtle`,children:e.title}),e.hint&&(0,U.jsx)(`p`,{className:`m-0 pb-2 text-meta text-subtle w-narrow:order-last w-narrow:px-3 w-narrow:pt-1.5 w-narrow:pb-0`,children:e.hint}),(0,U.jsx)(`div`,{className:FM,children:e.children})]})}function $N(e){let t=(0,U.jsxs)(`div`,{className:VM,children:[(0,U.jsx)(`span`,{id:e.labelId,className:`${HM} ${zM}`,children:e.label}),e.hint&&(0,U.jsx)(`span`,{className:`text-meta text-muted [&_a]:text-accent w-narrow:col-span-2`,children:e.hint}),e.sample&&(0,U.jsx)(`span`,{className:`mt-1.5 flex min-w-0 w-narrow:col-span-2`,children:e.sample})]}),n=e.settingId?` ${gM}`:``;return e.stack?(0,U.jsxs)(`div`,{className:`${BM}${n}`,"data-setting-id":e.settingId,children:[t,e.children]}):(0,U.jsxs)(`div`,{className:`${e.inline?RM:LM}${n}`,"data-setting-id":e.settingId,children:[t,e.children&&(0,U.jsx)(`div`,{className:`flex min-w-0 flex-none items-center justify-end gap-2 w-narrow:col-start-2 w-narrow:row-start-1 w-narrow:max-w-[55vw]`,children:e.children})]})}function eP(e){let t=(0,h.useId)();return(0,U.jsx)($N,{label:e.label,hint:e.hint,labelId:t,settingId:e.settingId,inline:!0,children:(0,U.jsx)(ZN,{on:e.checked,"aria-labelledby":t,disabled:e.disabled,onClick:()=>e.onChange(!e.checked)})})}var tP=36,nP=/[\u2e80-\u9fff\uac00-\ud7af\uf900-\ufaff\uff00-\uffef]/,rP=20;function iP(e,t=!1){let n=0;for(let t of e)for(let e of t.label)n+=nP.test(e)?2:1;return t?e.length===2&&n<=rP:e.length<=4&&n<=tP}function aP(e){let t=iP(e.picks,Oe())?wO:tM;return(0,U.jsx)($N,{label:e.label,hint:e.hint,sample:e.sample,settingId:e.settingId,children:(0,U.jsx)(t,{label:e.label,value:e.value,picks:e.picks,onPick:e.onPick})})}function oP(e){return(0,U.jsx)($N,{label:e.label,hint:e.note,settingId:e.settingId,children:(0,U.jsx)(`span`,{className:WM,children:e.value})})}function sP(e,t){let[n,r]=(0,h.useState)(()=>J(e,t)),[i,a]=(0,h.useState)(null),o=(0,h.useCallback)(()=>ss(e,t).then(e=>{r(e),a(null)},e=>a(G(e))),[e,t]);return(0,h.useEffect)(()=>e.onOpen(()=>void o()),[e,o]),{value:n,failed:i,reload:o}}function cP(e){return e.failed===null?(0,U.jsx)(`p`,{className:YM,children:V(`preview.loading`)}):(0,U.jsxs)(`p`,{className:YM,children:[V(`settings.loadFailed`,{error:e.failed}),` `,(0,U.jsx)(W,{onClick:e.onRetry,children:V(`settings.retry`)})]})}var lP=[`web`,`tui`,`ios`,`android`,`cli`,`daemon`],uP=[`ios`,`web`,`daemon`],dP=[`ios`,`web`,`tui`,`cli`,`daemon`,`android`],fP=/^([-*]\s+(?:(?:\[[^\]]*\]\([^)]*\)|#\d+|`[0-9a-f]{7,40}`)\s+)*)/,pP=/^\*\*([a-z]+(?: · [a-z]+)*)\*\*([ \t]+|$)/,mP=/^(?:feat|fix|refactor|perf|chore|docs|style|test|build|ci|revert)\(([a-z0-9_/-]+(?:\s*,\s*[a-z0-9_/-]+)*)\)!?:\s/,hP={web:`web`,"rove-web":`web`,bridge:`web`,"rove-bridge":`web`,ios:`ios`,"rove-ios":`ios`,iphone:`ios`,phone:`ios`,mobile:`ios`,android:`android`,"rove-android":`android`,tui:`tui`,"tui-react":`tui`,terminal:`tui`,cli:`cli`,api:`cli`,daemon:`daemon`,"rove-daemon":`daemon`,pty:`daemon`,"pty-host":`daemon`,orchestrator:`daemon`},gP=e=>lP.includes(e);function _P(e){let t=fP.exec(e);if(!t)return null;let n=e.slice(t[0].length),r=pP.exec(n);if(r){let e=r[1]?.split(` · `)??[];return e.length>0&&e.every(gP)?e:null}let i=mP.exec(n);if(!i?.[1])return null;let a=[];for(let e of i[1].split(/[,/]/)){let t=hP[e.trim().toLowerCase()];t&&!a.includes(t)&&a.push(t)}return a.length>0?a:null}function vP(e){let t=fP.exec(e);if(!t)return e;let n=e.slice(t[0].length),r=pP.exec(n);if(!r)return e;let i=r[1]?.split(` · `)??[];return i.length===0||!i.every(gP)?e:`${t[0]}${n.slice(r[0].length)}`}function yP(e){let t=e.trim().toLowerCase();return t===`major changes`||t===`重大更新`?`major`:t===`minor changes`||t===`功能更新`?`minor`:t===`patch changes`||t===`补丁更新`?`patch`:`custom`}function bP(e,t){let n=new Map;for(let t of e){let e=n.get(t.scope),r=t.lines.join(`
64
+ `).trimEnd();e?e.push(r):n.set(t.scope,[r])}let r=[];for(let e of t){let t=n.get(e);t&&t.length>0&&r.push({scope:e,entries:t,count:t.length})}return r}function xP(e,t){let n=[{heading:null,kind:null,preface:[],entries:[]}],r=[...t,`other`],i=dP.filter(e=>!t.includes(e));for(let r of e.replace(/\r\n/g,`
65
65
  `).split(`
66
- `)){let e=n[n.length-1],a=/^#{1,6}\s+(.*)$/.exec(r);if(a){let t=(a[1]??``).trim();e={heading:t,kind:vP(t),preface:[],entries:[]},n.push(e)}else if(/^[-*]\s/.test(r)){let n=gP(r),a,o;if(n===null)a=!0,o=`other`;else{let e=t.find(e=>n.includes(e));e?(a=!0,o=e):(a=!1,o=i.find(e=>n.includes(e))??n[0])}e.entries.push({lines:[_P(r)],own:a,scope:o})}else{let t=e.entries[e.entries.length-1];(t?t.lines:e.preface).push(r)}}let a=n.some(e=>e.heading!==null&&e.kind!==`patch`&&(e.entries.length>0||e.preface.some(e=>e.trim()!==``))),o=n.filter(e=>e.heading===null||!a&&e.kind===`patch`).map(e=>e.preface.join(`
66
+ `)){let e=n[n.length-1],a=/^#{1,6}\s+(.*)$/.exec(r);if(a){let t=(a[1]??``).trim();e={heading:t,kind:yP(t),preface:[],entries:[]},n.push(e)}else if(/^[-*]\s/.test(r)){let n=_P(r),a,o;if(n===null)a=!0,o=`other`;else{let e=t.find(e=>n.includes(e));e?(a=!0,o=e):(a=!1,o=i.find(e=>n.includes(e))??n[0])}e.entries.push({lines:[vP(r)],own:a,scope:o})}else{let t=e.entries[e.entries.length-1];(t?t.lines:e.preface).push(r)}}let a=n.some(e=>e.heading!==null&&e.kind!==`patch`&&(e.entries.length>0||e.preface.some(e=>e.trim()!==``))),o=n.filter(e=>e.heading===null||!a&&e.kind===`patch`).map(e=>e.preface.join(`
67
67
  `).trim()).filter(Boolean).join(`
68
68
 
69
- `),s=[],c=[];if(a)for(let e of n){let t=yP(e.entries.filter(e=>e.own),r),n=yP(e.entries.filter(e=>!e.own),i);t.length>0&&s.push({heading:e.heading,sections:t}),n.length>0&&c.push({heading:e.heading,sections:n})}else{let e=n.flatMap(e=>e.entries),t=yP(e.filter(e=>e.own),r),a=yP(e.filter(e=>!e.own),i);t.length>0&&s.push({heading:null,sections:t}),a.length>0&&c.push({heading:null,sections:a})}return{preface:o,hasSignificantBump:a,own:s,other:c,ownCount:s.reduce((e,t)=>e+t.sections.reduce((e,t)=>e+t.count,0),0),otherCount:c.reduce((e,t)=>e+t.sections.reduce((e,t)=>e+t.count,0),0),hasScopedEntries:[...s,...c].some(e=>e.sections.some(e=>e.scope!==`other`))}}var xP=`[&_b]:mr-2.5`,SP=`${Uw} flex flex-col overflow-hidden`,CP=`min-h-0 flex-1 overflow-y-auto`,wP=`[&_h2]:mx-0 [&_h2]:mt-3.5 [&_h2]:mb-1 [&_h2]:text-[length:var(--fs-body)]`,TP=`mt-5 first:mt-0`,EP=`mx-0 mt-0 mb-2 font-sans text-[length:var(--fs-body)] font-semibold text-accent`,DP=`mt-4 first:mt-0`,OP=`max-h-[55vh] overflow-x-hidden overflow-y-auto`,kP=`mr-auto text-[length:var(--fs-meta)]`,AP=`flex min-h-0 flex-1 flex-col gap-3 overflow-x-hidden overflow-y-auto px-5 pt-1 pb-3 [&_p]:m-0`,jP=`flex flex-none px-3 pt-2`,MP=`text-[length:var(--fs-body)] leading-[1.55] wrap-anywhere [&_ul]:m-0 [&_ul]:pl-4.5 [&_li+li]:mt-2 [&_p]:mx-0 [&_p]:mt-0 [&_p]:mb-2 [&_a]:text-accent [&_a]:underline [&_a]:underline-offset-2 [&_code]:rounded-sm [&_code]:bg-inset [&_code]:px-1 [&_code]:py-0 [&_code]:font-mono [&_code]:text-meta [&_code]:font-normal [&_code]:normal-nums`,NP=`mx-0 mt-3 mb-1.5 font-sans text-meta font-medium normal-nums text-muted first:mt-0`,PP=`mt-3`,FP=e=>`rounded-sm px-2 py-1.25 ${e?`bg-menu`:``}`,IP=`flex items-baseline gap-2 text-[length:var(--fs-body)]`,LP=`flex items-baseline justify-between gap-2`,RP=`font-mono`,zP=`truncate`,BP=`mt-4 text-[length:var(--fs-meta)]`;function VP(e){return e.replace(/\[`[0-9a-f]{7,40}`\]\([^)]*\)\s*/g,``).replace(/\s+[—-]\s+\[@[^\]]+\]\([^)]*\)\s*$/,``).trim()}function HP(e){let t=[],n=(e,n)=>t.push({kind:e,text:n,id:t.length});for(let r of e.split(/\r?\n/)){let e=r.trimEnd();if(e.trim()===``)continue;let i=/^#{1,6}\s+(.*)$/.exec(e);if(i){n(`heading`,i[1]??``);continue}let a=/^\s*[-*]\s+(.*)$/.exec(e);if(a){n(`item`,a[1]??``);continue}let o=t.at(-1);o&&o.kind!==`heading`?o.text=`${o.text} ${e.trim()}`:n(`para`,e.trim())}return t.map(e=>e.kind===`item`?{...e,text:VP(e.text)}:e)}var UP=/\[([^\]]+)\]\((https?:\/\/[^)\s]+)\)|`([^`]+)`|\*\*([^*]+)\*\*/g;function WP(e){let t=[],n=0;for(let r of e.matchAll(UP)){let i=r.index??0;i>n&&t.push(e.slice(n,i));let[a,o,s,c,l]=r;o!==void 0&&s!==void 0?t.push((0,U.jsx)(`a`,{href:s,target:`_blank`,rel:`noopener noreferrer`,children:WP(o)},i)):c===void 0?l!==void 0&&t.push((0,U.jsx)(`b`,{children:l},i)):t.push((0,U.jsx)(`code`,{children:c},i)),n=i+a.length}return n<e.length&&t.push(e.slice(n)),t}function GP({body:e}){let t=H()===`zh`?Pa:Na,n=bP(e,lP),r=e=>t.scopes[e];return(0,U.jsxs)(`div`,{className:MP,children:[n.preface&&(0,U.jsx)(qP,{body:n.preface}),(0,U.jsx)(KP,{groups:n.own,scopeLabel:r,showScopeHeading:n.hasScopedEntries}),n.otherCount>0&&(0,U.jsxs)(`details`,{className:`mt-4 [&>summary]:cursor-pointer [&>summary]:select-none [&>summary]:py-1 [&>summary]:text-meta [&>summary]:text-muted [&>summary]:hover:text-ink touch:[&>summary]:py-2.5`,children:[(0,U.jsx)(`summary`,{children:t.otherClients.replace(`{count}`,String(n.otherCount))}),(0,U.jsx)(`div`,{className:`mt-2`,children:(0,U.jsx)(KP,{groups:n.other,scopeLabel:r,showScopeHeading:n.hasScopedEntries})})]})]})}function KP({groups:e,scopeLabel:t,showScopeHeading:n}){return e.map(e=>{let r=e.sections.map(e=>(0,U.jsxs)(`section`,{className:DP,children:[n&&(0,U.jsxs)(`div`,{className:`mx-0 mt-0 mb-1.5 flex items-baseline gap-2`,children:[(0,U.jsx)(`span`,{className:`font-mono text-meta font-semibold text-ink`,children:t(e.scope)}),(0,U.jsx)(`span`,{className:`rounded-xs bg-inset px-1.5 font-mono text-meta font-normal text-muted`,children:e.count})]}),(0,U.jsx)(qP,{body:e.entries.join(`
69
+ `),s=[],c=[];if(a)for(let e of n){let t=bP(e.entries.filter(e=>e.own),r),n=bP(e.entries.filter(e=>!e.own),i);t.length>0&&s.push({heading:e.heading,sections:t}),n.length>0&&c.push({heading:e.heading,sections:n})}else{let e=n.flatMap(e=>e.entries),t=bP(e.filter(e=>e.own),r),a=bP(e.filter(e=>!e.own),i);t.length>0&&s.push({heading:null,sections:t}),a.length>0&&c.push({heading:null,sections:a})}return{preface:o,hasSignificantBump:a,own:s,other:c,ownCount:s.reduce((e,t)=>e+t.sections.reduce((e,t)=>e+t.count,0),0),otherCount:c.reduce((e,t)=>e+t.sections.reduce((e,t)=>e+t.count,0),0),hasScopedEntries:[...s,...c].some(e=>e.sections.some(e=>e.scope!==`other`))}}var SP=`[&_b]:mr-2.5`,CP=`${Uw} flex flex-col overflow-hidden`,wP=`min-h-0 flex-1 overflow-y-auto`,TP=`[&_h2]:mx-0 [&_h2]:mt-3.5 [&_h2]:mb-1 [&_h2]:text-[length:var(--fs-body)]`,EP=`mt-5 first:mt-0`,DP=`mx-0 mt-0 mb-2 font-sans text-[length:var(--fs-body)] font-semibold text-accent`,OP=`mt-4 first:mt-0`,kP=`max-h-[55vh] overflow-x-hidden overflow-y-auto`,AP=`mr-auto text-[length:var(--fs-meta)]`,jP=`flex min-h-0 flex-1 flex-col gap-3 overflow-x-hidden overflow-y-auto px-5 pt-1 pb-3 [&_p]:m-0`,MP=`flex flex-none px-3 pt-2`,NP=`text-[length:var(--fs-body)] leading-[1.55] wrap-anywhere [&_ul]:m-0 [&_ul]:pl-4.5 [&_li+li]:mt-2 [&_p]:mx-0 [&_p]:mt-0 [&_p]:mb-2 [&_a]:text-accent [&_a]:underline [&_a]:underline-offset-2 [&_code]:rounded-sm [&_code]:bg-inset [&_code]:px-1 [&_code]:py-0 [&_code]:font-mono [&_code]:text-meta [&_code]:font-normal [&_code]:normal-nums`,PP=`mx-0 mt-3 mb-1.5 font-sans text-meta font-medium normal-nums text-muted first:mt-0`,FP=`mt-3`,IP=e=>`rounded-sm px-2 py-1.25 ${e?`bg-menu`:``}`,LP=`flex items-baseline gap-2 text-[length:var(--fs-body)]`,RP=`flex items-baseline justify-between gap-2`,zP=`font-mono`,BP=`truncate`,VP=`mt-4 text-[length:var(--fs-meta)]`;function HP(e){return e.replace(/\[`[0-9a-f]{7,40}`\]\([^)]*\)\s*/g,``).replace(/\s+[—-]\s+\[@[^\]]+\]\([^)]*\)\s*$/,``).trim()}function UP(e){let t=[],n=(e,n)=>t.push({kind:e,text:n,id:t.length});for(let r of e.split(/\r?\n/)){let e=r.trimEnd();if(e.trim()===``)continue;let i=/^#{1,6}\s+(.*)$/.exec(e);if(i){n(`heading`,i[1]??``);continue}let a=/^\s*[-*]\s+(.*)$/.exec(e);if(a){n(`item`,a[1]??``);continue}let o=t.at(-1);o&&o.kind!==`heading`?o.text=`${o.text} ${e.trim()}`:n(`para`,e.trim())}return t.map(e=>e.kind===`item`?{...e,text:HP(e.text)}:e)}var WP=/\[([^\]]+)\]\((https?:\/\/[^)\s]+)\)|`([^`]+)`|\*\*([^*]+)\*\*/g;function GP(e){let t=[],n=0;for(let r of e.matchAll(WP)){let i=r.index??0;i>n&&t.push(e.slice(n,i));let[a,o,s,c,l]=r;o!==void 0&&s!==void 0?t.push((0,U.jsx)(`a`,{href:s,target:`_blank`,rel:`noopener noreferrer`,children:GP(o)},i)):c===void 0?l!==void 0&&t.push((0,U.jsx)(`b`,{children:l},i)):t.push((0,U.jsx)(`code`,{children:c},i)),n=i+a.length}return n<e.length&&t.push(e.slice(n)),t}function KP({body:e}){let t=H()===`zh`?Pa:Na,n=xP(e,uP),r=e=>t.scopes[e];return(0,U.jsxs)(`div`,{className:NP,children:[n.preface&&(0,U.jsx)(JP,{body:n.preface}),(0,U.jsx)(qP,{groups:n.own,scopeLabel:r,showScopeHeading:n.hasScopedEntries}),n.otherCount>0&&(0,U.jsxs)(`details`,{className:`mt-4 [&>summary]:cursor-pointer [&>summary]:select-none [&>summary]:py-1 [&>summary]:text-meta [&>summary]:text-muted [&>summary]:hover:text-ink touch:[&>summary]:py-2.5`,children:[(0,U.jsx)(`summary`,{children:t.otherClients.replace(`{count}`,String(n.otherCount))}),(0,U.jsx)(`div`,{className:`mt-2`,children:(0,U.jsx)(qP,{groups:n.other,scopeLabel:r,showScopeHeading:n.hasScopedEntries})})]})]})}function qP({groups:e,scopeLabel:t,showScopeHeading:n}){return e.map(e=>{let r=e.sections.map(e=>(0,U.jsxs)(`section`,{className:OP,children:[n&&(0,U.jsxs)(`div`,{className:`mx-0 mt-0 mb-1.5 flex items-baseline gap-2`,children:[(0,U.jsx)(`span`,{className:`font-mono text-meta font-semibold text-ink`,children:t(e.scope)}),(0,U.jsx)(`span`,{className:`rounded-xs bg-inset px-1.5 font-mono text-meta font-normal text-muted`,children:e.count})]}),(0,U.jsx)(JP,{body:e.entries.join(`
70
70
 
71
- `)})]},e.scope)),i=e.heading??e.sections.map(e=>e.scope).join(`,`);return e.heading?(0,U.jsxs)(`div`,{className:TP,children:[(0,U.jsx)(`h3`,{className:EP,children:e.heading}),r]},i):(0,U.jsx)(`div`,{children:r},i)})}function qP({body:e}){let t=HP(e),n=[],r=[],i=()=>{r.length>0&&n.push((0,U.jsx)(`ul`,{children:r},`ul-${n.length}`)),r=[]};for(let e of t){if(e.kind===`item`){r.push((0,U.jsx)(`li`,{children:WP(e.text)},e.id));continue}i(),n.push(e.kind===`heading`?(0,U.jsx)(`h3`,{className:NP,children:e.text},e.id):(0,U.jsx)(`p`,{children:WP(e.text)},e.id))}return i(),n}var JP=y(null),YP=y(!1),XP=(e,t)=>e.replace(/\{(\w+)\}/g,(e,n)=>t[n]??e),ZP=e=>`https://github.com/Sma1lboy/rove/releases/tag/v${e}`;function QP(){return H()===`zh`?Pa:Na}function $P(e,t){return e.request(`update.check`,{force:!0,locale:Bt.get(),channel:t}).then(e=>(JP.set(e),!0),()=>!1)}function eF(){let e=QP(),t=b(JP),{prefs:n}=Rw();if(!n.updateNotify||!t?.info?.hasUpdate)return null;let r=XP(e.available,{version:t.info.latest});return(0,U.jsxs)(W,{variant:`row`,className:`${dn} whitespace-nowrap font-mono text-meta text-warning`,"aria-label":`${V(`rail.update`)} · ${r}`,title:r,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&e.stopPropagation()},onClick:()=>xe(`update`),children:[`↑`,(0,U.jsxs)(`span`,{className:`rail-tight:hidden`,children:[` `,t.info.latest]})]})}function tF({notes:e}){return e.map(e=>(0,U.jsxs)(`section`,{className:wP,children:[(0,U.jsxs)(`h2`,{className:`mono`,children:[`v`,e.version]}),(0,U.jsx)(GP,{body:e.body})]},e.version))}var nF=1e3;function rF(e){let[t,n]=(0,h.useState)(null),[r,i]=(0,h.useState)(!0);return(0,h.useEffect)(()=>{if(!r)return;let t=!0,a,o=()=>e.request(`update.status`,{}).then(e=>{t&&(n(e.status),e.status?.running?a=setTimeout(o,nF):i(!1))},()=>t&&i(!1));return o(),()=>{t=!1,clearTimeout(a)}},[e,r]),{run:t,setRun:n,poll:()=>i(!0)}}function iF({client:e}){let t=QP(),n=b(JP),[r,i]=(0,h.useState)(!1),a=b(YP),[o,s]=(0,h.useState)(null),{run:c,setRun:l,poll:u}=rF(e),d=(0,h.useRef)(null),f=Oe();(0,h.useEffect)(()=>{d.current?.focus(),$P(e).finally(()=>i(!0))},[e]);let p=n?.info??null,m=n?.current??``,g=p?.latest??m,_=p?.hasUpdate===!0,v=r&&p===null,y=r&&p!==null&&!_,x=n?.notes??[],S=x[0]?.url??(g?ZP(g):null),C=c?.code===0,[w,T]=(0,h.useState)(!1),E=_&&!c?.running&&!C,D=n=>{if(n===`close`)return M.set(null);if(n===`restart`){if(!C||w)return;T(!0),e.request(`update.restart`,{}).catch(e=>e instanceof Pc&&T(!1));return}if(n===`update`){if(!E)return;s(null),e.request(`update.run`,{}).then(e=>{l(e.status),u()},e=>{if(e instanceof Pc&&e.code===`BUSY`)return u();s(XP(t.webStartFailed,{error:e instanceof Error?e.message:String(e)}))});return}s(S&&window.open(S,`_blank`,`noopener`)!==null?t.statusReleaseOpened:t.statusReleaseError)};(0,h.useEffect)(()=>{!r||!a||(YP.set(!1),_&&D(`update`))},[r,_,a]);let O=e=>{if(e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.toLowerCase()===`c`&&!window.getSelection()?.toString())return e.preventDefault(),D(`close`);if(!(e.metaKey||e.ctrlKey||e.altKey)){if(e.key===`Enter`&&e.target===d.current)D(C?`restart`:E?`update`:`release`);else if(e.key===`Enter`)return;else if(e.key===`u`)D(`update`);else if(e.key===`r`)D(`release`);else if(e.key===`q`||e.key===`Escape`)D(`close`);else return;e.preventDefault()}},[k,A]=(0,h.useState)(null);(0,h.useEffect)(()=>{if(!f||!y||!m)return;let t=!0;return e.request(`release.notes`,{version:m.replace(/-.*$/,``),locale:Bt.get()}).then(e=>t&&A(e.notes)).catch(()=>{}),()=>{t=!1}},[e,f,y,m]);let j=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`mono ${xP}`,children:[(0,U.jsx)(`span`,{className:`text-muted`,children:t.current}),` `,(0,U.jsxs)(`b`,{children:[`v`,m]}),` `,(0,U.jsx)(`span`,{className:`text-muted`,children:t.latest}),` `,v?(0,U.jsx)(`b`,{className:`text-muted`,children:t.latestUnknown}):r?(0,U.jsxs)(`b`,{className:_?`text-warning`:`text-success`,children:[`v`,g]}):(0,U.jsx)(`span`,{className:`text-muted`,children:`…`})]}),v&&(0,U.jsx)(`p`,{className:`text-muted`,children:t.registryRetry}),y&&(0,U.jsx)(`p`,{className:`text-success`,children:t.upToDate}),o&&(0,U.jsx)(`p`,{className:`mono text-accent`,children:o}),c&&(0,U.jsxs)(U.Fragment,{children:[c.output&&(0,U.jsx)(`pre`,{className:`my-2 max-h-[40vh] overflow-auto whitespace-pre-wrap wrap-anywhere rounded-sm bg-inset p-2 font-mono text-[length:var(--fs-meta)]`,children:c.output}),(0,U.jsx)(`p`,{className:`mono ${c.running?`text-muted`:c.code===0?`text-success`:`text-error`}`,children:c.running?XP(t.webRunning,{command:c.command}):c.code===0?w?t.webRestarting:XP(t.webInstalled,{latest:g}):XP(t.updateFailed,{code:String(c.code)})})]}),_&&(0,U.jsx)(`p`,{className:`mono text-muted`,children:XP(t.changesSectionHeader,{from:m,to:g})}),!r&&(0,U.jsx)(`p`,{className:`text-muted`,children:t.loadingNotes}),r&&_&&x.length===0&&(0,U.jsx)(`p`,{className:`text-muted`,children:t.notesUnavailable}),(0,U.jsx)(tF,{notes:x})]}),ee=(0,U.jsxs)(`div`,{className:`${Qr} pt-2.5`,children:[S?(0,U.jsx)(`a`,{className:Rr({secondary:!0}),href:S,target:`_blank`,rel:`noopener noreferrer`,"aria-keyshortcuts":`r`,children:t.actions.openRelease}):(0,U.jsx)(`span`,{className:`text-muted`,children:t.releaseUrlUnavailable}),C&&(0,U.jsx)(W,{variant:`filled`,disabled:w,onClick:()=>D(`restart`),children:t.webRestart}),E&&(0,U.jsx)(W,{variant:`filled`,"aria-keyshortcuts":`u`,onClick:()=>D(`update`),children:t.actions.updateNow})]});return f?(0,U.jsxs)(ru,{title:V(`rail.update`),rootRef:d,action:C?{label:t.webRestart,tone:`accent`,disabled:w,onClick:()=>D(`restart`)}:E?{label:V(`pages.phone.updateTo`,{version:g}),tone:`accent`,onClick:()=>D(`update`)}:{label:V(`pages.phone.viewNotes`),disabled:!S,onClick:()=>D(`release`)},children:[j,k&&(0,U.jsx)(tF,{notes:[k]})]}):(0,U.jsxs)(`div`,{className:SP,tabIndex:0,ref:d,onKeyDown:O,children:[(0,U.jsx)(`h1`,{className:Gw,children:V(`rail.update`)}),(0,U.jsx)(`div`,{className:CP,children:j}),ee]})}var aF=`rove.whatsNewSeenVersion`,oF=e=>e.split(/[.-]/).slice(0,3).map(Number),sF=(e,t)=>{let[n,r]=[oF(e),oF(t)];for(let e=0;e<3;e++)if((n[e]??0)!==(r[e]??0))return(n[e]??0)>(r[e]??0);return!1};function cF(e,t){let n=localStorage.getItem(aF);localStorage.setItem(aF,t),!(!n||!sF(t,n))&&e.request(`release.notes`,{version:t.replace(/-.*$/,``),locale:Bt.get()}).then(e=>k.set((0,U.jsx)(lF,{from:n,to:t,notes:e.notes})),()=>k.set((0,U.jsx)(lF,{from:n,to:t,notes:null})))}function lF(e){let t=QP(),n=Oe(),r=V(`whatsNew.title`),i=e.notes?.url??ZP(e.to),a=(0,h.useRef)(null),o=(0,h.useRef)(B);(0,h.useEffect)(()=>{n||a.current?.focus()},[n]),(0,h.useEffect)(()=>{let e=e=>{e.key===`q`&&o.current()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let s=e.notes?(0,U.jsx)(GP,{body:e.notes.body}):(0,U.jsx)(`p`,{className:`text-muted`,children:t.whatsNew.notesUnavailable});return n?(0,U.jsx)(vu,{label:r,title:r,onClose:B,children:n=>(o.current=n,(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:AP,children:[(0,U.jsx)(`p`,{className:`text-muted`,children:XP(t.whatsNew.upgraded,{from:e.from,to:e.to})}),s]}),(0,U.jsx)(`div`,{className:jP,children:(0,U.jsx)(Ll,{actions:[{label:V(`whatsNew.openRelease`),href:i},{label:V(`whatsNew.continue`),tone:`accent`,onClick:n}]})})]}))}):(o.current=B,(0,U.jsxs)(ia,{title:r,wide:!0,children:[(0,U.jsx)(`p`,{className:`m-0 text-muted`,children:XP(t.whatsNew.upgraded,{from:e.from,to:e.to})}),(0,U.jsx)(`div`,{className:OP,children:s}),(0,U.jsxs)(`div`,{className:Qr,children:[(0,U.jsx)(`span`,{className:`mono text-muted ${kP} touch:hidden!`,children:V(`whatsNew.keys`)}),(0,U.jsx)(`a`,{className:Rr({secondary:!0}),href:i,target:`_blank`,rel:`noopener noreferrer`,children:V(`whatsNew.openRelease`)}),(0,U.jsx)(W,{ref:a,variant:`filled`,onClick:B,children:V(`whatsNew.continue`)})]})]}))}var uF=(e,t)=>e.replace(`{version}`,t);function dF({client:e}){let t=QP(),n=b(JP),{prefs:r}=Rw(),[i,a]=(0,h.useState)(`idle`),o=()=>{a(`checking`),$P(e,r.updateChannel).then(e=>a(e?`done`:`failed`))},s=t=>{a(`idle`),Iw(e,`updateChannel`,t)},c=n?.info??null,l=i===`failed`||i===`done`&&c===null,u=i===`done`&&n&&c?c.hasUpdate?uF(t.available,c.latest):t.upToDate:l?t.latestUnknown:void 0,d=l?`text-muted`:c?.hasUpdate?`text-warning`:`text-success`;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(iP,{settingId:`about.updateChannel`,label:Q(`general.updateChannelTitle`),hint:Q(`general.updatesHint`),value:r.updateChannel,picks:Bj.map(e=>({value:e,label:Q(`general.updateChannelName.${e}`)})),onPick:s}),(0,U.jsx)($N,{settingId:`about.updateNotify`,label:Q(`general.updateNotify`),hint:Q(`general.updateNotifyHint`),checked:r.updateNotify,onChange:t=>void Iw(e,`updateNotify`,t)}),(0,U.jsxs)(QN,{settingId:`about.updateCheck`,label:Q(`general.updates`),hint:Q(`general.updateCheckHint`),children:[i===`done`&&c?.hasUpdate&&(0,U.jsx)(W,{variant:`action`,onClick:()=>{B(),xe(`update`)},children:Q(`general.updateOpenPage`)}),(0,U.jsx)(W,{variant:`action`,disabled:i===`checking`,onClick:o,children:Q(i===`checking`?`general.updateChecking`:`general.updateCheckButton`)})]}),u&&(0,U.jsx)(QN,{label:(0,U.jsx)(`span`,{className:d,children:u}),hint:c?.hasUpdate?(0,U.jsx)(`code`,{className:`font-mono`,children:`rove update`}):void 0,children:i===`done`&&n&&c&&(0,U.jsx)(`span`,{className:`max-w-90 min-w-0 truncate font-mono text-meta text-muted [overflow-wrap:anywhere]`,title:`${t.latest} v${c.latest}`,children:`${t.current} v${n.current} · ${t.latest} v${c.latest}`})})]})}function fF({client:e}){let[t,n]=(0,h.useState)(null),[r,i]=(0,h.useState)(!1),[o,s]=(0,h.useState)(``),[c,l]=(0,h.useState)(null),u=()=>e.request(`auth.status`).then(n,()=>n(null));if((0,h.useEffect)(()=>void u(),[e]),!t)return null;let d=async(t,n)=>{l(null);try{let r=n===void 0?{mode:t}:{mode:t,password:n},{token:o}=await e.request(`auth.setMode`,r);if(o){a(o),window.location.reload();return}i(!1),s(``),await u()}catch(e){l(e instanceof Error?e.message:String(e))}},f=r?`password`:t.mode,p=o.length<t.minPassword;return(0,U.jsxs)(ZN,{title:V(`settings.about.access`),children:[(0,U.jsx)(iP,{settingId:`about.signIn`,label:V(`settings.about.signIn`),hint:V(`settings.about.signInHint.${f}`),value:f,picks:t.modes.map(e=>({value:e,label:V(`settings.about.signInMode.${e}`)})),onPick:e=>{e===`password`&&!t.hasPassword?i(!0):d(e)}}),f===`password`&&(0,U.jsxs)(QN,{label:V(t.hasPassword?`settings.about.passwordChange`:`settings.about.passwordSet`),hint:c??V(`settings.about.passwordHint`,{min:t.minPassword}),children:[(0,U.jsx)(`input`,{className:`${YM} w-48`,type:`password`,autoComplete:`new-password`,"aria-label":V(`settings.about.passwordField`),placeholder:V(`settings.about.passwordField`),value:o,onChange:e=>s(e.target.value),onKeyDown:e=>e.key===`Enter`&&!p&&void d(`password`,o)}),(0,U.jsx)(W,{variant:`action`,disabled:p,onClick:()=>void d(`password`,o),children:V(`settings.about.passwordSave`)})]})]})}function pF({client:e}){let t=b(e.conn).hello?.host,[n,r]=(0,h.useState)(()=>J(e,`daemon.info`)??null);return(0,h.useEffect)(()=>{ss(e,`daemon.info`).then(r,()=>r(null))},[e]),(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(ZN,{title:V(`settings.about.groupRove`),children:[t&&(0,U.jsx)(QN,{label:V(`settings.about.computer`),hint:t}),n?.daemonVersion&&(0,U.jsx)(QN,{settingId:`about.daemon`,label:V(`settings.about.daemon`),hint:V(n.stale?`settings.about.daemonStale`:`settings.about.daemonCurrent`,{version:n.daemonVersion})}),(0,U.jsx)(dF,{client:e})]}),(0,U.jsx)(fF,{client:e}),(0,U.jsx)(ZN,{title:V(`settings.about.browser`),children:(0,U.jsx)(QN,{settingId:`about.signOut`,label:V(`settings.about.signOut`),hint:V(`settings.about.browserHint`),children:(0,U.jsx)(W,{variant:`action`,onClick:()=>void Yu().then(()=>window.location.reload()),children:V(`settings.about.signOut`)})})})]})}var mF=[{label:`settings.appearance.previewWorking`,status:{kind:`running`,since:0}},{label:`settings.appearance.previewDone`,status:{kind:`unseen`,since:0}},{label:`settings.appearance.previewIdle`,status:{kind:`idle`,since:0}},{label:`settings.appearance.previewWaiting`,status:{kind:`needs-input`,since:0}},{label:`settings.appearance.previewBroken`,status:{kind:`attention`,reason:`error`,since:0}}];function hF({model:e}){let t=Vw(),[n]=[...lS(e).values()];return(0,U.jsx)(`span`,{className:kM,"aria-hidden":`true`,children:mF.map(({label:e,status:r})=>(0,U.jsxs)(`span`,{className:AM,children:[t!==`dots`&&(0,U.jsx)(Ev,{icon:n,status:t===`engine`?D_(r):void 0}),(0,U.jsx)(`span`,{className:`text-ink`,children:V(e)}),t!==`engine`&&(0,U.jsx)(U_,{status:r})]},e))})}function gF(){return(0,U.jsx)(`span`,{className:`${AM} ${Qi} ${$i}`,"aria-hidden":`true`,children:V(`settings.appearance.previewTitle`)})}function _F(){return(0,U.jsx)(`span`,{className:`${jM} ${Wn}`,"aria-hidden":`true`})}function vF(e,t){return e===`auto`?t?`dark`:`light`:e}function yF(e,t,n){let r=e.find(e=>e.name===t)??e.find(e=>e.name===`claude`);return r?r[n]:null}function bF(e,t){return(e.find(e=>e.name===t)??e.find(e=>e.name===`claude`))?.fontFamily??null}function xF(e){return`"${e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`}function SF(e){return`${xF(e)}, "Rove Nerd Symbols", "JetBrains Mono", "IBM Plex Mono", "SF Mono", Menlo, Consolas, ui-monospace, monospace`}function CF(e){return`${xF(e)}, "Rove Nerd Symbols", "JetBrains Mono", "SF Mono", ui-monospace, Menlo, monospace`}var wF=e=>[1,3,5].map(t=>Number.parseInt(e.slice(t,t+2),16));function TF(e){let[t=0,n=0,r=0]=wF(e).map(e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4});return .2126*t+.7152*n+.0722*r}function EF(e,t){let[n=0,r=0]=[TF(e),TF(t)].sort((e,t)=>t-e);return(n+.05)/(r+.05)}var DF=4.5,OF=1.1;function kF(e,t,n){let r=e=>t.every(t=>EF(e,t)>=n(t));if(r(e))return e;let i=wF(e),a=TF(t[0])<.18?255:0;for(let e=.02;e<1;e+=.02){let t=i.map(t=>Math.round(t+(a-t)*e).toString(16).padStart(2,`0`)).join(``);if(r(`#${t}`))return`#${t}`}return a?`#ffffff`:`#000000`}function AF(e){let t=[e.background,e.backgroundPanel,e.backgroundElement,e.backgroundMenu],n=kF(e.diffLineNumber,t,()=>DF);return{muted:kF(e.textMuted,t,e=>Math.max(DF,EF(n,e)*OF)),subtle:n}}var jF=e=>{let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4},MF=e=>{let t=e<=.0031308?e*12.92:1.055*Math.max(e,0)**(1/2.4)-.055;return Math.round(Math.min(1,Math.max(0,t))*255)};function NF(e,t){let[n=0,r=0,i=0]=wF(e).map(jF),a=Math.cbrt(.4122214708*n+.5363325363*r+.0514459929*i),o=Math.cbrt(.2119034982*n+.6806995451*r+.1073969566*i),s=Math.cbrt(.0883024619*n+.2817188376*r+.6299787005*i),c=.2104542553*a+.793617785*o-.0040720468*s+t,l=1.9779984951*a-2.428592205*o+.4505937099*s,u=.0259040371*a+.7827717662*o-.808675766*s,d=(c+.3963377774*l+.2158037573*u)**3,f=(c-.1055613458*l-.0638541728*u)**3,p=(c-.0894841775*l-1.291485548*u)**3;return`#${[4.0767416621*d-3.3077115913*f+.2309699292*p,-1.2684380046*d+2.6097574011*f-.3413193965*p,-.0041960863*d-.7034186147*f+1.707614701*p].map(e=>MF(e).toString(16).padStart(2,`0`)).join(``)}`}var PF=e=>NF(e,TF(e)<.18?-.01:-.008);function FF(e,t){let n=t.colorblind===`on`,r=AF(e);return{"--paper":e.background,"--sidebar":PF(e.background),"--surface":e.backgroundPanel,"--inset":e.backgroundElement,"--menu":e.backgroundMenu,"--line":e.border,"--line-active":e.borderActive,"--line-subtle":e.borderSubtle,"--ink":e.text,"--muted":r.muted,"--subtle":r.subtle,"--accent":e.primary,"--error":e.error,"--success":e.success,"--warning":e.warning,"--info":e.info,"--merged":e.syntaxType,"--focus":e[t.focusAccent]??e.primary,"--diff-added":(n?e.diffAddedColorblind:e.diffAdded)??e.diffAdded,"--diff-removed":e.diffRemoved,"--diff-added-bg":(n?e.diffAddedBgColorblind:e.diffAddedBg)??e.diffAddedBg,"--diff-removed-bg":e.diffRemovedBg}}function IF(e){return{background:e.background,foreground:e.text,cursor:e.cursor??e.primary,cursorAccent:e.background,selectionBackground:e.backgroundMenu,black:e.terminalBlack??e.background,red:e.terminalRed??e.error,green:e.terminalGreen??e.success,yellow:e.terminalYellow??e.warning,blue:e.terminalBlue??e.info,magenta:e.terminalMagenta??e.syntaxType,cyan:e.terminalCyan??e.secondary,white:e.terminalWhite??e.textMuted,brightBlack:e.terminalBrightBlack??e.diffLineNumber,brightRed:e.terminalBrightRed??e.error,brightGreen:e.terminalBrightGreen??e.success,brightYellow:e.terminalBrightYellow??e.warning,brightBlue:e.terminalBrightBlue??e.info,brightMagenta:e.terminalBrightMagenta??e.syntaxType,brightCyan:e.terminalBrightCyan??e.secondary,brightWhite:e.terminalBrightWhite??e.text}}var LF=y(null),RF=y(null),zF=y(null),BF=`claude`,VF=new Map,HF=new Set,UF=(e,t)=>`${e}/${t}`,WF=e=>VF.get(e)??``;function GF(e,t){t===``?VF.delete(e):VF.set(e,t);for(let e of HF)e()}function KF(e){return HF.add(e),()=>HF.delete(e)}function qF(e,t){let n=WF(e).trimEnd();GF(e,n===``?t:`${n}\n\n${t}`)}function JF(e,t,n,r,i,a){let o=n.length-t.length;return{base:n,spans:[...e?.base===t?e.spans.filter(([e,t])=>t<=r||e>=i).map(([e,t])=>e>=i?[e+o,t+o]:[e,t]):[],a]}}async function YF(e,t,n){if(n===t.base)return;let r;try{r=(await e.request(`voice.learn`,{base:t.base,spans:t.spans,sent:n})).learned??[]}catch{return}r.length!==0&&z(V(`voice.learned`,{pairs:r.map(e=>V(`voice.learnedPair`,{spoken:e.spoken,term:e.term})).join(`, `)}),`info`,{label:V(`voice.undo`),run:()=>void e.request(`voice.unlearn`,{learned:r}).then(()=>z(V(`voice.unlearned`)),()=>z(V(`voice.unlearnFailed`),`error`))})}var XF=new WeakSet,ZF=y({}),QF=6e4,$F=e=>{let t=ZF.get();if(!t[e])return;let{[e]:n=0,...r}=t;ZF.set(n>1?{...r,[e]:n-1}:r)};function eI(e){XF.has(e)||(XF.add(e),e.on(`voice.sendFailed`,e=>{let t=e,n=t.taskId&&t.tabId?UF(t.taskId,t.tabId):null,r=[n?WF(n):``,t.prefix,t.text].filter(Boolean).join(` `);n&&r&&GF(n,r),n&&$F(n),z(V(`layout.composerNotSent`,{reason:t.reason??``}),`error`)}),e.on(`voice.sent`,e=>{let t=e;t.taskId&&t.tabId&&$F(UF(t.taskId,t.tabId))}))}function tI({model:e,taskId:t,tabId:n,inPackage:r}){let i=b(e.tasks)?.tasks.find(e=>e.id===t)!==void 0,a=UF(t,n),o=(0,h.useSyncExternalStore)(KF,()=>WF(a)),[s,c]=(0,h.useState)(!1),{attachments:l,attach:u,remove:d,ready:f,clear:p}=bd(e,e=>z(e,`error`),void 0,t),m=(0,h.useRef)(null),g=Kb(e.client),[_,v]=(0,h.useState)(!1),y=by({value:o,onChange:e=>GF(a,e),area:m,listClassName:`m-0`,onEnter:()=>void O()}),x=(0,h.useRef)(null),S=e=>{let t=m.current,n=t?.selectionStart??o.length,r=t?.selectionEnd??o.length,i=n>0&&!/\s$/.test(o.slice(0,n))?` `:``,s=`${o.slice(0,n)}${i}${e}${o.slice(r)}`;GF(a,s);let c=n+i.length+e.length;x.current=JF(x.current,o,s,n,r,[n+i.length,c]),requestAnimationFrame(()=>t?.setSelectionRange(c,c))},C=async e=>{let t=o.trim()?`${o.trimEnd()} ${e}`:e;await O(t)||GF(a,t)},w=e=>void C(e);(0,h.useEffect)(()=>eI(e.client),[e.client]);let T=async()=>({taskId:t,tabId:n,prefix:hd(o.trim(),await f()).trim()}),E=(b(ZF)[a]??0)>0,D=()=>{ZF.set({...ZF.get(),[a]:(ZF.get()[a]??0)+1}),window.setTimeout(()=>$F(a),QF),GF(a,``),p(),x.current=null},O=async(r=o)=>{c(!0);try{let i=hd(r.trim(),await f()).trim();if(!i)return!1;let o=await e.client.request(`tab.send`,{taskId:t,tabId:n,prompt:i});return o.delivered?(GF(a,``),p(),window.setTimeout(()=>v(!1),140),x.current&&YF(e.client,x.current,r),x.current=null,!0):(z(V(`layout.composerNotSent`,{reason:o.reason??``}),`error`),!1)}catch(e){let t=e instanceof Pc?e.code:void 0;return z(t===`UNKNOWN_OP`?V(`layout.composerOldBridge`):t===`AWAITING_PERMISSION`?V(`layout.composerAtMenu`):e instanceof Error?e.message:String(e),`error`),!1}finally{c(!1)}},k=fd(u);if(!i)return null;let A=u,j={client:e.client,context:()=>({draft:o,taskId:t,tabId:n}),onText:e=>void S(e),disabled:s},ee=g===!0&&!_&&o===``,te=()=>{(0,au.flushSync)(()=>v(!0)),m.current?.focus()};return(0,U.jsx)(pb,{value:o,placeholder:r?.placeholder??V(`layout.composerPlaceholder`),inPackage:r&&{send:r.sendLabel?(0,U.jsx)(W,{variant:`filled`,type:`submit`,className:`m-1 flex-none`,"data-tp-part":`composer-send`,disabled:s,children:r.sendLabel}):void 0},busy:s,attached:l.length>0&&(0,U.jsx)(xd,{attachments:l,onRemove:d}),attach:(0,U.jsxs)(pd,{className:Jy(),title:V(`layout.composerAttach`),disabled:s,onFiles:A,children:[(0,U.jsx)(`span`,{className:`sr-only`,children:V(`layout.composerAttach`)}),(0,U.jsx)(nb,{})]}),dictate:(0,U.jsx)(Jb,{...j,look:Yy,face:e=>(0,U.jsx)(db,{state:e})}),voice:ee?(0,U.jsx)(Jb,{...j,onSend:w,handoff:T,onHandedOff:D,look:Qy,onTap:te,idle:V(E?`voice.sending`:`voice.holdOrType`),face:e=>(0,U.jsx)(ub,{state:e,idle:V(E?`voice.sending`:`voice.holdOrType`),working:V(`voice.working`),slide:V(`voice.slideToEdit`),release:V(`voice.tipEdit`)})}):void 0,composerKey:a,fieldRef:m,suggest:y.list,...y.field,onPaste:k.onPaste,drop:k.drop,dropHint:k.over?V(`layout.composerDrop`):void 0,onBlur:()=>o===``&&v(!1),onSend:()=>void O()})}var nI={md:`md`,markdown:`md`,html:`html`,htm:`html`,svg:`svg`,png:`image`,jpg:`image`,jpeg:`image`,gif:`image`,webp:`image`,pdf:`pdf`};function rI(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<0?null:nI[t.slice(n+1).toLowerCase()]??null}function iI(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}var aI=e=>new TextDecoder().decode(iI(e));function oI(e,t){if(e===`svg`)return`image/svg+xml`;if(e===`pdf`)return`application/pdf`;let n=t.slice(t.lastIndexOf(`.`)+1).toLowerCase();return n===`jpg`||n===`jpeg`?`image/jpeg`:n===`gif`?`image/gif`:n===`webp`?`image/webp`:`image/png`}var sI=`default-src 'none'; img-src data:; style-src 'unsafe-inline'`;function cI(e){let t=`<meta http-equiv="Content-Security-Policy" content="${sI}">`,n=/^\s*<!doctype[^>]*>/i.exec(e);return n?`${n[0]}${t}${e.slice(n[0].length)}`:`${t}${e}`}var lI=/^\[([^\]\n]+)\]\((https?:\/\/[^\s)]+)\)/,uI=/^https?:\/\/[^\s<>)\]]+/,dI=/[\p{L}\p{N}]/u;function fI(e){let t=[],n=``,r=()=>{n&&t.push({t:`text`,v:n}),n=``},i=0;for(;i<e.length;){let a=e.slice(i),o=e[i]??``;if(o==="`"){let n=e.indexOf("`",i+1);if(n>i+1){r(),t.push({t:`code`,v:e.slice(i+1,n)}),i=n+1;continue}}else if(a.startsWith(`**`)){let n=e.indexOf(`**`,i+2);if(n>i+2){r(),t.push({t:`bold`,c:fI(e.slice(i+2,n))}),i=n+2;continue}}else if(o===`*`||o===`_`&&!dI.test(e[i-1]??``)){let n=e.indexOf(o,i+1);if(n>i+1&&!/\s/.test(e[i+1]??` `)&&(o===`*`||!dI.test(e[n+1]??``))){r(),t.push({t:`em`,c:fI(e.slice(i+1,n))}),i=n+1;continue}}else if(o===`[`){let e=lI.exec(a);if(e){r(),t.push({t:`link`,href:e[2],c:fI(e[1])}),i+=e[0].length;continue}}else if(o===`h`&&!dI.test(e[i-1]??``)){let e=uI.exec(a);if(e){let n=e[0].replace(/[.,;:!?]+$/,``);r(),t.push({t:`link`,href:n,c:[{t:`text`,v:n}]}),i+=n.length;continue}}n+=o,i++}return r(),t}var pI=/^\s*(```+|~~~+)\s*([\w+#.-]*)\s*$/,mI=/^(#{1,6})\s+(.*?)\s*#*\s*$/,hI=/^(\s*)([-*+])\s+(.*)$/,gI=/^(\s*)\d+[.)]\s+(.*)$/,_I=/^\s*([-*_])(\s*\1){2,}\s*$/,vI=/^\s*\|.*\|\s*$/,yI=/^\s*\|?\s*:?-{2,}:?\s*(\|\s*:?-{2,}:?\s*)*\|?\s*$/,bI=e=>e.trim().replace(/^\|/,``).replace(/\|$/,``).split(`|`).map(e=>e.trim());function xI(e){let t=e.replace(/\r\n?/g,`
71
+ `)})]},e.scope)),i=e.heading??e.sections.map(e=>e.scope).join(`,`);return e.heading?(0,U.jsxs)(`div`,{className:EP,children:[(0,U.jsx)(`h3`,{className:DP,children:e.heading}),r]},i):(0,U.jsx)(`div`,{children:r},i)})}function JP({body:e}){let t=UP(e),n=[],r=[],i=()=>{r.length>0&&n.push((0,U.jsx)(`ul`,{children:r},`ul-${n.length}`)),r=[]};for(let e of t){if(e.kind===`item`){r.push((0,U.jsx)(`li`,{children:GP(e.text)},e.id));continue}i(),n.push(e.kind===`heading`?(0,U.jsx)(`h3`,{className:PP,children:e.text},e.id):(0,U.jsx)(`p`,{children:GP(e.text)},e.id))}return i(),n}var YP=y(null),XP=y(!1),ZP=(e,t)=>e.replace(/\{(\w+)\}/g,(e,n)=>t[n]??e),QP=e=>`https://github.com/Sma1lboy/rove/releases/tag/v${e}`;function $P(){return H()===`zh`?Pa:Na}function eF(e,t){return e.request(`update.check`,{force:!0,locale:Bt.get(),channel:t}).then(e=>(YP.set(e),!0),()=>!1)}function tF(){let e=$P(),t=b(YP),{prefs:n}=Rw();if(!n.updateNotify||!t?.info?.hasUpdate)return null;let r=ZP(e.available,{version:t.info.latest});return(0,U.jsxs)(W,{variant:`row`,className:`${dn} whitespace-nowrap font-mono text-meta text-warning`,"aria-label":`${V(`rail.update`)} · ${r}`,title:r,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&e.stopPropagation()},onClick:()=>xe(`update`),children:[`↑`,(0,U.jsxs)(`span`,{className:`rail-tight:hidden`,children:[` `,t.info.latest]})]})}function nF({notes:e}){return e.map(e=>(0,U.jsxs)(`section`,{className:TP,children:[(0,U.jsxs)(`h2`,{className:`mono`,children:[`v`,e.version]}),(0,U.jsx)(KP,{body:e.body})]},e.version))}var rF=1e3;function iF(e){let[t,n]=(0,h.useState)(null),[r,i]=(0,h.useState)(!0);return(0,h.useEffect)(()=>{if(!r)return;let t=!0,a,o=()=>e.request(`update.status`,{}).then(e=>{t&&(n(e.status),e.status?.running?a=setTimeout(o,rF):i(!1))},()=>t&&i(!1));return o(),()=>{t=!1,clearTimeout(a)}},[e,r]),{run:t,setRun:n,poll:()=>i(!0)}}function aF({client:e}){let t=$P(),n=b(YP),[r,i]=(0,h.useState)(!1),a=b(XP),[o,s]=(0,h.useState)(null),{run:c,setRun:l,poll:u}=iF(e),d=(0,h.useRef)(null),f=Oe();(0,h.useEffect)(()=>{d.current?.focus(),eF(e).finally(()=>i(!0))},[e]);let p=n?.info??null,m=n?.current??``,g=p?.latest??m,_=p?.hasUpdate===!0,v=r&&p===null,y=r&&p!==null&&!_,x=n?.notes??[],S=x[0]?.url??(g?QP(g):null),C=c?.code===0,[w,T]=(0,h.useState)(!1),E=_&&!c?.running&&!C,D=n=>{if(n===`close`)return M.set(null);if(n===`restart`){if(!C||w)return;T(!0),e.request(`update.restart`,{}).catch(e=>e instanceof Pc&&T(!1));return}if(n===`update`){if(!E)return;s(null),e.request(`update.run`,{}).then(e=>{l(e.status),u()},e=>{if(e instanceof Pc&&e.code===`BUSY`)return u();s(ZP(t.webStartFailed,{error:e instanceof Error?e.message:String(e)}))});return}s(S&&window.open(S,`_blank`,`noopener`)!==null?t.statusReleaseOpened:t.statusReleaseError)};(0,h.useEffect)(()=>{!r||!a||(XP.set(!1),_&&D(`update`))},[r,_,a]);let O=e=>{if(e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.toLowerCase()===`c`&&!window.getSelection()?.toString())return e.preventDefault(),D(`close`);if(!(e.metaKey||e.ctrlKey||e.altKey)){if(e.key===`Enter`&&e.target===d.current)D(C?`restart`:E?`update`:`release`);else if(e.key===`Enter`)return;else if(e.key===`u`)D(`update`);else if(e.key===`r`)D(`release`);else if(e.key===`q`||e.key===`Escape`)D(`close`);else return;e.preventDefault()}},[k,A]=(0,h.useState)(null);(0,h.useEffect)(()=>{if(!f||!y||!m)return;let t=!0;return e.request(`release.notes`,{version:m.replace(/-.*$/,``),locale:Bt.get()}).then(e=>t&&A(e.notes)).catch(()=>{}),()=>{t=!1}},[e,f,y,m]);let j=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`mono ${SP}`,children:[(0,U.jsx)(`span`,{className:`text-muted`,children:t.current}),` `,(0,U.jsxs)(`b`,{children:[`v`,m]}),` `,(0,U.jsx)(`span`,{className:`text-muted`,children:t.latest}),` `,v?(0,U.jsx)(`b`,{className:`text-muted`,children:t.latestUnknown}):r?(0,U.jsxs)(`b`,{className:_?`text-warning`:`text-success`,children:[`v`,g]}):(0,U.jsx)(`span`,{className:`text-muted`,children:`…`})]}),v&&(0,U.jsx)(`p`,{className:`text-muted`,children:t.registryRetry}),y&&(0,U.jsx)(`p`,{className:`text-success`,children:t.upToDate}),o&&(0,U.jsx)(`p`,{className:`mono text-accent`,children:o}),c&&(0,U.jsxs)(U.Fragment,{children:[c.output&&(0,U.jsx)(`pre`,{className:`my-2 max-h-[40vh] overflow-auto whitespace-pre-wrap wrap-anywhere rounded-sm bg-inset p-2 font-mono text-[length:var(--fs-meta)]`,children:c.output}),(0,U.jsx)(`p`,{className:`mono ${c.running?`text-muted`:c.code===0?`text-success`:`text-error`}`,children:c.running?ZP(t.webRunning,{command:c.command}):c.code===0?w?t.webRestarting:ZP(t.webInstalled,{latest:g}):ZP(t.updateFailed,{code:String(c.code)})})]}),_&&(0,U.jsx)(`p`,{className:`mono text-muted`,children:ZP(t.changesSectionHeader,{from:m,to:g})}),!r&&(0,U.jsx)(`p`,{className:`text-muted`,children:t.loadingNotes}),r&&_&&x.length===0&&(0,U.jsx)(`p`,{className:`text-muted`,children:t.notesUnavailable}),(0,U.jsx)(nF,{notes:x})]}),ee=(0,U.jsxs)(`div`,{className:`${Qr} pt-2.5`,children:[S?(0,U.jsx)(`a`,{className:Rr({secondary:!0}),href:S,target:`_blank`,rel:`noopener noreferrer`,"aria-keyshortcuts":`r`,children:t.actions.openRelease}):(0,U.jsx)(`span`,{className:`text-muted`,children:t.releaseUrlUnavailable}),C&&(0,U.jsx)(W,{variant:`filled`,disabled:w,onClick:()=>D(`restart`),children:t.webRestart}),E&&(0,U.jsx)(W,{variant:`filled`,"aria-keyshortcuts":`u`,onClick:()=>D(`update`),children:t.actions.updateNow})]});return f?(0,U.jsxs)(ru,{title:V(`rail.update`),rootRef:d,action:C?{label:t.webRestart,tone:`accent`,disabled:w,onClick:()=>D(`restart`)}:E?{label:V(`pages.phone.updateTo`,{version:g}),tone:`accent`,onClick:()=>D(`update`)}:{label:V(`pages.phone.viewNotes`),disabled:!S,onClick:()=>D(`release`)},children:[j,k&&(0,U.jsx)(nF,{notes:[k]})]}):(0,U.jsxs)(`div`,{className:CP,tabIndex:0,ref:d,onKeyDown:O,children:[(0,U.jsx)(`h1`,{className:Gw,children:V(`rail.update`)}),(0,U.jsx)(`div`,{className:wP,children:j}),ee]})}var oF=`rove.whatsNewSeenVersion`,sF=e=>e.split(/[.-]/).slice(0,3).map(Number),cF=(e,t)=>{let[n,r]=[sF(e),sF(t)];for(let e=0;e<3;e++)if((n[e]??0)!==(r[e]??0))return(n[e]??0)>(r[e]??0);return!1};function lF(e,t){let n=localStorage.getItem(oF);localStorage.setItem(oF,t),!(!n||!cF(t,n))&&e.request(`release.notes`,{version:t.replace(/-.*$/,``),locale:Bt.get()}).then(e=>k.set((0,U.jsx)(uF,{from:n,to:t,notes:e.notes})),()=>k.set((0,U.jsx)(uF,{from:n,to:t,notes:null})))}function uF(e){let t=$P(),n=Oe(),r=V(`whatsNew.title`),i=e.notes?.url??QP(e.to),a=(0,h.useRef)(null),o=(0,h.useRef)(B);(0,h.useEffect)(()=>{n||a.current?.focus()},[n]),(0,h.useEffect)(()=>{let e=e=>{e.key===`q`&&o.current()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let s=e.notes?(0,U.jsx)(KP,{body:e.notes.body}):(0,U.jsx)(`p`,{className:`text-muted`,children:t.whatsNew.notesUnavailable});return n?(0,U.jsx)(vu,{label:r,title:r,onClose:B,children:n=>(o.current=n,(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:jP,children:[(0,U.jsx)(`p`,{className:`text-muted`,children:ZP(t.whatsNew.upgraded,{from:e.from,to:e.to})}),s]}),(0,U.jsx)(`div`,{className:MP,children:(0,U.jsx)(Ll,{actions:[{label:V(`whatsNew.openRelease`),href:i},{label:V(`whatsNew.continue`),tone:`accent`,onClick:n}]})})]}))}):(o.current=B,(0,U.jsxs)(ia,{title:r,wide:!0,children:[(0,U.jsx)(`p`,{className:`m-0 text-muted`,children:ZP(t.whatsNew.upgraded,{from:e.from,to:e.to})}),(0,U.jsx)(`div`,{className:kP,children:s}),(0,U.jsxs)(`div`,{className:Qr,children:[(0,U.jsx)(`span`,{className:`mono text-muted ${AP} touch:hidden!`,children:V(`whatsNew.keys`)}),(0,U.jsx)(`a`,{className:Rr({secondary:!0}),href:i,target:`_blank`,rel:`noopener noreferrer`,children:V(`whatsNew.openRelease`)}),(0,U.jsx)(W,{ref:a,variant:`filled`,onClick:B,children:V(`whatsNew.continue`)})]})]}))}var dF=(e,t)=>e.replace(`{version}`,t);function fF({client:e}){let t=$P(),n=b(YP),{prefs:r}=Rw(),[i,a]=(0,h.useState)(`idle`),o=()=>{a(`checking`),eF(e,r.updateChannel).then(e=>a(e?`done`:`failed`))},s=t=>{a(`idle`),Iw(e,`updateChannel`,t)},c=n?.info??null,l=i===`failed`||i===`done`&&c===null,u=i===`done`&&n&&c?c.hasUpdate?dF(t.available,c.latest):t.upToDate:l?t.latestUnknown:void 0,d=l?`text-muted`:c?.hasUpdate?`text-warning`:`text-success`;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(aP,{settingId:`about.updateChannel`,label:Q(`general.updateChannelTitle`),hint:Q(`general.updatesHint`),value:r.updateChannel,picks:Vj.map(e=>({value:e,label:Q(`general.updateChannelName.${e}`)})),onPick:s}),(0,U.jsx)(eP,{settingId:`about.updateNotify`,label:Q(`general.updateNotify`),hint:Q(`general.updateNotifyHint`),checked:r.updateNotify,onChange:t=>void Iw(e,`updateNotify`,t)}),(0,U.jsxs)($N,{settingId:`about.updateCheck`,label:Q(`general.updates`),hint:Q(`general.updateCheckHint`),children:[i===`done`&&c?.hasUpdate&&(0,U.jsx)(W,{variant:`action`,onClick:()=>{B(),xe(`update`)},children:Q(`general.updateOpenPage`)}),(0,U.jsx)(W,{variant:`action`,disabled:i===`checking`,onClick:o,children:Q(i===`checking`?`general.updateChecking`:`general.updateCheckButton`)})]}),u&&(0,U.jsx)($N,{label:(0,U.jsx)(`span`,{className:d,children:u}),hint:c?.hasUpdate?(0,U.jsx)(`code`,{className:`font-mono`,children:`rove update`}):void 0,children:i===`done`&&n&&c&&(0,U.jsx)(`span`,{className:`max-w-90 min-w-0 truncate font-mono text-meta text-muted [overflow-wrap:anywhere]`,title:`${t.latest} v${c.latest}`,children:`${t.current} v${n.current} · ${t.latest} v${c.latest}`})})]})}function pF({client:e}){let[t,n]=(0,h.useState)(null),[r,i]=(0,h.useState)(!1),[o,s]=(0,h.useState)(``),[c,l]=(0,h.useState)(null),u=()=>e.request(`auth.status`).then(n,()=>n(null));if((0,h.useEffect)(()=>void u(),[e]),!t)return null;let d=async(t,n)=>{l(null);try{let r=n===void 0?{mode:t}:{mode:t,password:n},{token:o}=await e.request(`auth.setMode`,r);if(o){a(o),window.location.reload();return}i(!1),s(``),await u()}catch(e){l(e instanceof Error?e.message:String(e))}},f=r?`password`:t.mode,p=o.length<t.minPassword;return(0,U.jsxs)(QN,{title:V(`settings.about.access`),children:[(0,U.jsx)(aP,{settingId:`about.signIn`,label:V(`settings.about.signIn`),hint:V(`settings.about.signInHint.${f}`),value:f,picks:t.modes.map(e=>({value:e,label:V(`settings.about.signInMode.${e}`)})),onPick:e=>{e===`password`&&!t.hasPassword?i(!0):d(e)}}),f===`password`&&(0,U.jsxs)($N,{label:V(t.hasPassword?`settings.about.passwordChange`:`settings.about.passwordSet`),hint:c??V(`settings.about.passwordHint`,{min:t.minPassword}),children:[(0,U.jsx)(`input`,{className:`${XM} w-48`,type:`password`,autoComplete:`new-password`,"aria-label":V(`settings.about.passwordField`),placeholder:V(`settings.about.passwordField`),value:o,onChange:e=>s(e.target.value),onKeyDown:e=>e.key===`Enter`&&!p&&void d(`password`,o)}),(0,U.jsx)(W,{variant:`action`,disabled:p,onClick:()=>void d(`password`,o),children:V(`settings.about.passwordSave`)})]})]})}function mF({client:e}){let t=b(e.conn).hello?.host,[n,r]=(0,h.useState)(()=>J(e,`daemon.info`)??null);return(0,h.useEffect)(()=>{ss(e,`daemon.info`).then(r,()=>r(null))},[e]),(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(QN,{title:V(`settings.about.groupRove`),children:[t&&(0,U.jsx)($N,{label:V(`settings.about.computer`),hint:t}),n?.daemonVersion&&(0,U.jsx)($N,{settingId:`about.daemon`,label:V(`settings.about.daemon`),hint:V(n.stale?`settings.about.daemonStale`:`settings.about.daemonCurrent`,{version:n.daemonVersion})}),(0,U.jsx)(fF,{client:e})]}),(0,U.jsx)(pF,{client:e}),(0,U.jsx)(QN,{title:V(`settings.about.browser`),children:(0,U.jsx)($N,{settingId:`about.signOut`,label:V(`settings.about.signOut`),hint:V(`settings.about.browserHint`),children:(0,U.jsx)(W,{variant:`action`,onClick:()=>void Yu().then(()=>window.location.reload()),children:V(`settings.about.signOut`)})})})]})}var hF=[{label:`settings.appearance.previewWorking`,status:{kind:`running`,since:0}},{label:`settings.appearance.previewDone`,status:{kind:`unseen`,since:0}},{label:`settings.appearance.previewIdle`,status:{kind:`idle`,since:0}},{label:`settings.appearance.previewWaiting`,status:{kind:`needs-input`,since:0}},{label:`settings.appearance.previewBroken`,status:{kind:`attention`,reason:`error`,since:0}}];function gF({model:e}){let t=Vw(),[n]=[...lS(e).values()];return(0,U.jsx)(`span`,{className:AM,"aria-hidden":`true`,children:hF.map(({label:e,status:r})=>(0,U.jsxs)(`span`,{className:jM,children:[t!==`dots`&&(0,U.jsx)(Ev,{icon:n,status:t===`engine`?D_(r):void 0}),(0,U.jsx)(`span`,{className:`text-ink`,children:V(e)}),t!==`engine`&&(0,U.jsx)(U_,{status:r})]},e))})}function _F(){return(0,U.jsx)(`span`,{className:`${jM} ${Qi} ${$i}`,"aria-hidden":`true`,children:V(`settings.appearance.previewTitle`)})}function vF(){return(0,U.jsx)(`span`,{className:`${MM} ${Wn}`,"aria-hidden":`true`})}function yF(e,t){return e===`auto`?t?`dark`:`light`:e}function bF(e,t,n){let r=e.find(e=>e.name===t)??e.find(e=>e.name===`claude`);return r?r[n]:null}function xF(e,t){return(e.find(e=>e.name===t)??e.find(e=>e.name===`claude`))?.fontFamily??null}function SF(e){return`"${e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`}function CF(e){return`${SF(e)}, "Rove Nerd Symbols", "JetBrains Mono", "IBM Plex Mono", "SF Mono", Menlo, Consolas, ui-monospace, monospace`}function wF(e){return`${SF(e)}, "Rove Nerd Symbols", "JetBrains Mono", "SF Mono", ui-monospace, Menlo, monospace`}var TF=e=>[1,3,5].map(t=>Number.parseInt(e.slice(t,t+2),16));function EF(e){let[t=0,n=0,r=0]=TF(e).map(e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4});return .2126*t+.7152*n+.0722*r}function DF(e,t){let[n=0,r=0]=[EF(e),EF(t)].sort((e,t)=>t-e);return(n+.05)/(r+.05)}var OF=4.5,kF=1.1;function AF(e,t,n){let r=e=>t.every(t=>DF(e,t)>=n(t));if(r(e))return e;let i=TF(e),a=EF(t[0])<.18?255:0;for(let e=.02;e<1;e+=.02){let t=i.map(t=>Math.round(t+(a-t)*e).toString(16).padStart(2,`0`)).join(``);if(r(`#${t}`))return`#${t}`}return a?`#ffffff`:`#000000`}function jF(e){let t=[e.background,e.backgroundPanel,e.backgroundElement,e.backgroundMenu],n=AF(e.diffLineNumber,t,()=>OF);return{muted:AF(e.textMuted,t,e=>Math.max(OF,DF(n,e)*kF)),subtle:n}}var MF=e=>{let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4},NF=e=>{let t=e<=.0031308?e*12.92:1.055*Math.max(e,0)**(1/2.4)-.055;return Math.round(Math.min(1,Math.max(0,t))*255)};function PF(e,t){let[n=0,r=0,i=0]=TF(e).map(MF),a=Math.cbrt(.4122214708*n+.5363325363*r+.0514459929*i),o=Math.cbrt(.2119034982*n+.6806995451*r+.1073969566*i),s=Math.cbrt(.0883024619*n+.2817188376*r+.6299787005*i),c=.2104542553*a+.793617785*o-.0040720468*s+t,l=1.9779984951*a-2.428592205*o+.4505937099*s,u=.0259040371*a+.7827717662*o-.808675766*s,d=(c+.3963377774*l+.2158037573*u)**3,f=(c-.1055613458*l-.0638541728*u)**3,p=(c-.0894841775*l-1.291485548*u)**3;return`#${[4.0767416621*d-3.3077115913*f+.2309699292*p,-1.2684380046*d+2.6097574011*f-.3413193965*p,-.0041960863*d-.7034186147*f+1.707614701*p].map(e=>NF(e).toString(16).padStart(2,`0`)).join(``)}`}var FF=e=>PF(e,EF(e)<.18?-.01:-.008);function IF(e,t){let n=t.colorblind===`on`,r=jF(e);return{"--paper":e.background,"--sidebar":FF(e.background),"--surface":e.backgroundPanel,"--inset":e.backgroundElement,"--menu":e.backgroundMenu,"--line":e.border,"--line-active":e.borderActive,"--line-subtle":e.borderSubtle,"--ink":e.text,"--muted":r.muted,"--subtle":r.subtle,"--accent":e.primary,"--error":e.error,"--success":e.success,"--warning":e.warning,"--info":e.info,"--merged":e.syntaxType,"--focus":e[t.focusAccent]??e.primary,"--diff-added":(n?e.diffAddedColorblind:e.diffAdded)??e.diffAdded,"--diff-removed":e.diffRemoved,"--diff-added-bg":(n?e.diffAddedBgColorblind:e.diffAddedBg)??e.diffAddedBg,"--diff-removed-bg":e.diffRemovedBg}}function LF(e){return{background:e.background,foreground:e.text,cursor:e.cursor??e.primary,cursorAccent:e.background,selectionBackground:e.backgroundMenu,black:e.terminalBlack??e.background,red:e.terminalRed??e.error,green:e.terminalGreen??e.success,yellow:e.terminalYellow??e.warning,blue:e.terminalBlue??e.info,magenta:e.terminalMagenta??e.syntaxType,cyan:e.terminalCyan??e.secondary,white:e.terminalWhite??e.textMuted,brightBlack:e.terminalBrightBlack??e.diffLineNumber,brightRed:e.terminalBrightRed??e.error,brightGreen:e.terminalBrightGreen??e.success,brightYellow:e.terminalBrightYellow??e.warning,brightBlue:e.terminalBrightBlue??e.info,brightMagenta:e.terminalBrightMagenta??e.syntaxType,brightCyan:e.terminalBrightCyan??e.secondary,brightWhite:e.terminalBrightWhite??e.text}}var RF=y(null),zF=y(null),BF=y(null),VF=`claude`,HF=new Map,UF=new Set,WF=(e,t)=>`${e}/${t}`,GF=e=>HF.get(e)??``;function KF(e,t){t===``?HF.delete(e):HF.set(e,t);for(let e of UF)e()}function qF(e){return UF.add(e),()=>UF.delete(e)}function JF(e,t){let n=GF(e).trimEnd();KF(e,n===``?t:`${n}\n\n${t}`)}function YF(e,t,n,r,i,a){let o=n.length-t.length;return{base:n,spans:[...e?.base===t?e.spans.filter(([e,t])=>t<=r||e>=i).map(([e,t])=>e>=i?[e+o,t+o]:[e,t]):[],a]}}async function XF(e,t,n){if(n===t.base)return;let r;try{r=(await e.request(`voice.learn`,{base:t.base,spans:t.spans,sent:n})).learned??[]}catch{return}r.length!==0&&z(V(`voice.learned`,{pairs:r.map(e=>V(`voice.learnedPair`,{spoken:e.spoken,term:e.term})).join(`, `)}),`info`,{label:V(`voice.undo`),run:()=>void e.request(`voice.unlearn`,{learned:r}).then(()=>z(V(`voice.unlearned`)),()=>z(V(`voice.unlearnFailed`),`error`))})}var ZF=new WeakSet,QF=y({}),$F=6e4,eI=e=>{let t=QF.get();if(!t[e])return;let{[e]:n=0,...r}=t;QF.set(n>1?{...r,[e]:n-1}:r)};function tI(e){ZF.has(e)||(ZF.add(e),e.on(`voice.sendFailed`,e=>{let t=e,n=t.taskId&&t.tabId?WF(t.taskId,t.tabId):null,r=[n?GF(n):``,t.prefix,t.text].filter(Boolean).join(` `);n&&r&&KF(n,r),n&&eI(n),z(V(`layout.composerNotSent`,{reason:t.reason??``}),`error`)}),e.on(`voice.sent`,e=>{let t=e;t.taskId&&t.tabId&&eI(WF(t.taskId,t.tabId))}))}function nI({model:e,taskId:t,tabId:n,inPackage:r}){let i=b(e.tasks)?.tasks.find(e=>e.id===t)!==void 0,a=WF(t,n),o=(0,h.useSyncExternalStore)(qF,()=>GF(a)),[s,c]=(0,h.useState)(!1),{attachments:l,attach:u,remove:d,ready:f,clear:p}=bd(e,e=>z(e,`error`),void 0,t),m=(0,h.useRef)(null),g=Kb(e.client),[_,v]=(0,h.useState)(!1),y=by({value:o,onChange:e=>KF(a,e),area:m,listClassName:`m-0`,onEnter:()=>void O()}),x=(0,h.useRef)(null),S=e=>{let t=m.current,n=t?.selectionStart??o.length,r=t?.selectionEnd??o.length,i=n>0&&!/\s$/.test(o.slice(0,n))?` `:``,s=`${o.slice(0,n)}${i}${e}${o.slice(r)}`;KF(a,s);let c=n+i.length+e.length;x.current=YF(x.current,o,s,n,r,[n+i.length,c]),requestAnimationFrame(()=>t?.setSelectionRange(c,c))},C=async e=>{let t=o.trim()?`${o.trimEnd()} ${e}`:e;await O(t)||KF(a,t)},w=e=>void C(e);(0,h.useEffect)(()=>tI(e.client),[e.client]);let T=async()=>({taskId:t,tabId:n,prefix:hd(o.trim(),await f()).trim()}),E=(b(QF)[a]??0)>0,D=()=>{QF.set({...QF.get(),[a]:(QF.get()[a]??0)+1}),window.setTimeout(()=>eI(a),$F),KF(a,``),p(),x.current=null},O=async(r=o)=>{c(!0);try{let i=hd(r.trim(),await f()).trim();if(!i)return!1;let o=await e.client.request(`tab.send`,{taskId:t,tabId:n,prompt:i});return o.delivered?(KF(a,``),p(),window.setTimeout(()=>v(!1),140),x.current&&XF(e.client,x.current,r),x.current=null,!0):(z(V(`layout.composerNotSent`,{reason:o.reason??``}),`error`),!1)}catch(e){let t=e instanceof Pc?e.code:void 0;return z(t===`UNKNOWN_OP`?V(`layout.composerOldBridge`):t===`AWAITING_PERMISSION`?V(`layout.composerAtMenu`):e instanceof Error?e.message:String(e),`error`),!1}finally{c(!1)}},k=fd(u);if(!i)return null;let A=u,j={client:e.client,context:()=>({draft:o,taskId:t,tabId:n}),onText:e=>void S(e),disabled:s},ee=g===!0&&!_&&o===``,te=()=>{(0,au.flushSync)(()=>v(!0)),m.current?.focus()};return(0,U.jsx)(pb,{value:o,placeholder:r?.placeholder??V(`layout.composerPlaceholder`),inPackage:r&&{send:r.sendLabel?(0,U.jsx)(W,{variant:`filled`,type:`submit`,className:`m-1 flex-none`,"data-tp-part":`composer-send`,disabled:s,children:r.sendLabel}):void 0},busy:s,attached:l.length>0&&(0,U.jsx)(xd,{attachments:l,onRemove:d}),attach:(0,U.jsxs)(pd,{className:Jy(),title:V(`layout.composerAttach`),disabled:s,onFiles:A,children:[(0,U.jsx)(`span`,{className:`sr-only`,children:V(`layout.composerAttach`)}),(0,U.jsx)(nb,{})]}),dictate:(0,U.jsx)(Jb,{...j,look:Yy,face:e=>(0,U.jsx)(db,{state:e})}),voice:ee?(0,U.jsx)(Jb,{...j,onSend:w,handoff:T,onHandedOff:D,look:Qy,onTap:te,idle:V(E?`voice.sending`:`voice.holdOrType`),face:e=>(0,U.jsx)(ub,{state:e,idle:V(E?`voice.sending`:`voice.holdOrType`),working:V(`voice.working`),slide:V(`voice.slideToEdit`),release:V(`voice.tipEdit`)})}):void 0,composerKey:a,fieldRef:m,suggest:y.list,...y.field,onPaste:k.onPaste,drop:k.drop,dropHint:k.over?V(`layout.composerDrop`):void 0,onBlur:()=>o===``&&v(!1),onSend:()=>void O()})}var rI={md:`md`,markdown:`md`,html:`html`,htm:`html`,svg:`svg`,png:`image`,jpg:`image`,jpeg:`image`,gif:`image`,webp:`image`,pdf:`pdf`};function iI(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<0?null:rI[t.slice(n+1).toLowerCase()]??null}function aI(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}var oI=e=>new TextDecoder().decode(aI(e));function sI(e,t){if(e===`svg`)return`image/svg+xml`;if(e===`pdf`)return`application/pdf`;let n=t.slice(t.lastIndexOf(`.`)+1).toLowerCase();return n===`jpg`||n===`jpeg`?`image/jpeg`:n===`gif`?`image/gif`:n===`webp`?`image/webp`:`image/png`}var cI=`default-src 'none'; img-src data:; style-src 'unsafe-inline'`;function lI(e){let t=`<meta http-equiv="Content-Security-Policy" content="${cI}">`,n=/^\s*<!doctype[^>]*>/i.exec(e);return n?`${n[0]}${t}${e.slice(n[0].length)}`:`${t}${e}`}var uI=/^\[([^\]\n]+)\]\((https?:\/\/[^\s)]+)\)/,dI=/^https?:\/\/[^\s<>)\]]+/,fI=/[\p{L}\p{N}]/u;function pI(e){let t=[],n=``,r=()=>{n&&t.push({t:`text`,v:n}),n=``},i=0;for(;i<e.length;){let a=e.slice(i),o=e[i]??``;if(o==="`"){let n=e.indexOf("`",i+1);if(n>i+1){r(),t.push({t:`code`,v:e.slice(i+1,n)}),i=n+1;continue}}else if(a.startsWith(`**`)){let n=e.indexOf(`**`,i+2);if(n>i+2){r(),t.push({t:`bold`,c:pI(e.slice(i+2,n))}),i=n+2;continue}}else if(o===`*`||o===`_`&&!fI.test(e[i-1]??``)){let n=e.indexOf(o,i+1);if(n>i+1&&!/\s/.test(e[i+1]??` `)&&(o===`*`||!fI.test(e[n+1]??``))){r(),t.push({t:`em`,c:pI(e.slice(i+1,n))}),i=n+1;continue}}else if(o===`[`){let e=uI.exec(a);if(e){r(),t.push({t:`link`,href:e[2],c:pI(e[1])}),i+=e[0].length;continue}}else if(o===`h`&&!fI.test(e[i-1]??``)){let e=dI.exec(a);if(e){let n=e[0].replace(/[.,;:!?]+$/,``);r(),t.push({t:`link`,href:n,c:[{t:`text`,v:n}]}),i+=n.length;continue}}n+=o,i++}return r(),t}var mI=/^\s*(```+|~~~+)\s*([\w+#.-]*)\s*$/,hI=/^(#{1,6})\s+(.*?)\s*#*\s*$/,gI=/^(\s*)([-*+])\s+(.*)$/,_I=/^(\s*)\d+[.)]\s+(.*)$/,vI=/^\s*([-*_])(\s*\1){2,}\s*$/,yI=/^\s*\|.*\|\s*$/,bI=/^\s*\|?\s*:?-{2,}:?\s*(\|\s*:?-{2,}:?\s*)*\|?\s*$/,xI=e=>e.trim().replace(/^\|/,``).replace(/\|$/,``).split(`|`).map(e=>e.trim());function SI(e){let t=e.replace(/\r\n?/g,`
72
72
  `).split(`
73
- `),n=[],r=[],i=()=>{r.length>0&&n.push({t:`para`,c:fI(r.join(`
74
- `))}),r=[]};for(let e=0;e<t.length;e++){let a=t[e],o=pI.exec(a);if(o){i();let r=o[1][0],a=[];for(e++;e<t.length&&!RegExp(`^\\s*${r}{3,}\\s*$`).test(t[e]);e++)a.push(t[e]);n.push({t:`code`,lang:o[2]??``,v:a.join(`
75
- `)});continue}if(a.trim()===``){i();continue}let s=mI.exec(a);if(s){i(),n.push({t:`heading`,level:s[1].length,c:fI(s[2])});continue}if(_I.test(a)){i(),n.push({t:`hr`});continue}if(vI.test(a)){i();let r=[];for(;e<t.length&&vI.test(t[e]);e++){let n=t[e];yI.test(n)||r.push(bI(n))}e--,n.push({t:`table`,rows:r.map(e=>e.map(e=>fI(e)))});continue}if(a.startsWith(`>`)){i();let r=[];for(;e<t.length&&t[e].startsWith(`>`);e++)r.push(t[e].replace(/^>\s?/,``));e--,n.push({t:`quote`,c:fI(r.join(`
76
- `))});continue}let c=hI.exec(a),l=c?null:gI.exec(a);if(c||l){i();let r=!c,a=[];for(;e<t.length;e++){let n=r?gI.exec(t[e]):hI.exec(t[e]);if(!n)break;let i=n[1].length;a.push({depth:Math.min(3,Math.floor(i/2)),c:fI(r?n[2]:n[3])})}e--,n.push({t:`list`,ordered:r,items:a});continue}r.push(a)}return i(),n}var SI=`flex min-h-0 min-w-0 flex-1 flex-col font-sans text-body`,CI=`flex flex-none flex-wrap items-center gap-x-3 gap-y-1 px-3 pb-1.5 font-mono text-meta`,wI=`min-h-0 flex-1 overflow-y-auto px-3 pb-3`,TI=`m-0 px-3 py-2 font-mono text-meta text-subtle`,EI=`m-0 whitespace-pre-wrap px-3 pb-3 font-mono text-meta leading-[1.45] text-muted wrap-anywhere`,DI=e=>`group/entry mt-3 rounded-sm border-l-2 py-0.5 pl-2.5 ${e.flash?`border-accent bg-accent-soft`:e.current?`border-line-active`:`border-transparent`}`,OI=`mb-0.5 flex items-center gap-2 font-mono text-meta`,kI=e=>e===`user`?`text-accent`:`text-muted`,AI=`text-subtle`,jI=`ml-auto opacity-0 group-hover/entry:opacity-100 focus-visible:opacity-100 touch:opacity-100`,MI=`m-0 mt-0.5 flex min-w-0 items-baseline gap-1.5 font-mono text-meta text-subtle`,NI=`flex-none text-muted`,PI=`min-w-0 flex-1 truncate`,FI=`group/tool mt-0.5`,II=`${MI} mt-0 cursor-pointer list-none hover:text-muted focus-visible:outline focus-visible:outline-1 focus-visible:outline-focus [&::-webkit-details-marker]:hidden`,LI=`m-0 mt-1 mb-1 max-h-60 overflow-auto rounded-sm border-hairline border-line bg-inset px-2.5 py-1.5 font-mono text-meta leading-[1.45] whitespace-pre-wrap text-muted wrap-anywhere`,RI=`text-diff-added`,zI=`text-diff-removed`,BI=`m-0 mt-1 mb-1 line-clamp-3 font-mono text-meta text-subtle italic`,VI=e=>`group/notice mt-3 rounded-sm border-hairline px-2.5 py-1 ${e.flash?`border-accent bg-accent-soft`:e.current?`border-line-active bg-inset`:`border-line bg-inset`}`,HI=`flex min-w-0 cursor-pointer list-none items-baseline gap-2 font-mono text-meta text-muted focus-visible:outline focus-visible:outline-1 focus-visible:outline-focus [&::-webkit-details-marker]:hidden`,UI=`flex-none text-subtle`,WI=`min-w-0 flex-1 truncate font-sans text-body text-ink`,GI=e=>`flex-none ${/fail|error|kill|cancel/i.test(e)?`text-error`:/complet|success|done|pass/i.test(e)?`text-success`:`text-warning`}`,KI=`group/fold mt-0.5`,qI=`flex cursor-pointer list-none items-baseline gap-1.5 font-mono text-meta text-subtle hover:text-muted focus-visible:outline focus-visible:outline-1 focus-visible:outline-focus [&::-webkit-details-marker]:hidden`,JI=`inline-block flex-none group-open/fold:rotate-90`,YI=`cursor-zoom-in rounded-sm p-0`,XI=`overlay fixed inset-0 z-20 grid cursor-zoom-out place-items-center bg-(--scrim) motion-safe:animate-fade-in [&.is-leaving]:pointer-events-none [&.is-leaving]:animate-fade-out`,ZI=`dialog static m-0 cursor-default border-0 bg-transparent p-0`,QI=`block max-h-[calc(100dvh-32px)] max-w-[calc(100vw-32px)] rounded-sm object-contain shadow-dialog`,$I=`block h-20 min-w-20 max-w-48 rounded-sm border-hairline border-line bg-inset object-cover hover:border-line-active`,eL=`leading-[1.5] wrap-anywhere`,tL=`m-0 mb-2 whitespace-pre-wrap last:mb-0`,nL=`m-0 mt-3 mb-1.5 font-semibold first:mt-0`,rL=`m-0 mb-2 flex flex-col gap-0.5 pl-5 last:mb-0`,iL=`m-0 mb-2 border-l-2 border-line pl-2.5 whitespace-pre-wrap text-muted last:mb-0`,aL=`m-0 mb-2 overflow-x-auto rounded-sm border-hairline border-line bg-inset px-2.5 py-2 font-mono text-meta leading-[1.45] last:mb-0`,oL=`rounded-xs bg-inset px-1 font-mono text-meta`,sL=`text-accent underline`,cL=`mb-2 block max-w-full overflow-x-auto border-collapse font-mono text-meta last:mb-0`,lL=`border-hairline border-line px-2 py-0.5 text-left align-top`,uL=`my-2 border-0 border-t border-line`;function dL(e,t){let n=t.trim().toLowerCase();if(!n)return e;let r=e.toLowerCase(),i=[],a=0;for(let t=r.indexOf(n);t>=0;t=r.indexOf(n,a))t>a&&i.push(e.slice(a,t)),i.push((0,U.jsx)(`mark`,{className:rj,"data-hit":``,children:e.slice(t,t+n.length)},t)),a=t+n.length;return i.push(e.slice(a)),h.Children.toArray(i)}var fL=[`h3`,`h3`,`h4`,`h5`,`h6`,`h6`];function pL({level:e,children:t}){let n=fL[Math.min(5,Math.max(0,e-1))]??`h6`;return(0,U.jsx)(n,{className:nL,children:t})}function mL(e,t){return e.map((e,n)=>(0,U.jsx)(h.Fragment,{children:t(e)},n))}function hL({nodes:e,needle:t}){return mL(e,e=>e.t===`text`?dL(e.v,t):e.t===`code`?(0,U.jsx)(`code`,{className:oL,children:dL(e.v,t)}):e.t===`bold`?(0,U.jsx)(`strong`,{children:(0,U.jsx)(hL,{nodes:e.c,needle:t})}):e.t===`em`?(0,U.jsx)(`em`,{children:(0,U.jsx)(hL,{nodes:e.c,needle:t})}):(0,U.jsx)(`a`,{className:sL,href:e.href,target:`_blank`,rel:`noopener noreferrer`,children:(0,U.jsx)(hL,{nodes:e.c,needle:t})}))}function gL({block:e,needle:t}){switch(e.t){case`heading`:return(0,U.jsx)(pL,{level:e.level,children:(0,U.jsx)(hL,{nodes:e.c,needle:t})});case`para`:return(0,U.jsx)(`p`,{className:tL,children:(0,U.jsx)(hL,{nodes:e.c,needle:t})});case`code`:return(0,U.jsx)(`pre`,{className:aL,children:(0,U.jsx)(`code`,{children:dL(e.v,t)})});case`quote`:return(0,U.jsx)(`blockquote`,{className:iL,children:(0,U.jsx)(hL,{nodes:e.c,needle:t})});case`hr`:return(0,U.jsx)(`hr`,{className:uL});case`list`:{let n=e.ordered?`ol`:`ul`;return(0,U.jsx)(n,{className:`${rL} ${e.ordered?`list-decimal`:`list-disc`}`,children:mL(e.items,e=>(0,U.jsx)(`li`,{style:{marginLeft:`${e.depth*1.25}rem`},children:(0,U.jsx)(hL,{nodes:e.c,needle:t})}))})}case`table`:return(0,U.jsx)(`table`,{className:cL,children:(0,U.jsx)(`tbody`,{children:mL(e.rows,e=>(0,U.jsx)(`tr`,{children:mL(e,e=>(0,U.jsx)(`td`,{className:lL,children:(0,U.jsx)(hL,{nodes:e,needle:t})}))}))})})}}function _L({source:e,needle:t=``}){let n=(0,h.useMemo)(()=>xI(e),[e]);return(0,U.jsx)(`div`,{className:eL,children:mL(n,e=>(0,U.jsx)(gL,{block:e,needle:t}))})}function vL(e){if(e instanceof Pc){if(e.code===`TOO_LARGE`){let t=e.detail?.size;return Z(V(`artifact.tooLarge`),{size:typeof t==`number`?`${(t/1048576).toFixed(1)} MB`:`5 MB+`})}if(e.code===`NOT_PREVIEWABLE`)return V(`artifact.notPreviewable`);if(e.code===`NOT_FOUND`)return V(`artifact.gone`)}return Z(V(`artifact.failed`),{error:e instanceof Error?e.message:String(e)})}function yL(e,t,n,r){let[i,a]=(0,h.useState)({kind:`loading`});return(0,h.useEffect)(()=>{let r=!0;return e.client.request(`file.read`,{taskId:t,path:n}).then(e=>r&&a({kind:`ready`,file:e}),e=>r&&a({kind:`failed`,text:vL(e)})),()=>{r=!1}},[e,t,n,r]),i}function bL(e,t){let n=(0,h.useMemo)(()=>e===null?null:URL.createObjectURL(new Blob([iI(e)],{type:t})),[e,t]);return(0,h.useEffect)(()=>()=>void(n&&URL.revokeObjectURL(n)),[n]),n}function xL({model:e,taskId:t,path:n,kind:r,changeKey:i}){H();let a=yL(e,t,n,i),o=bL(a.kind===`ready`&&(r===`svg`||r===`image`||r===`pdf`)?a.file.base64:null,r===`md`||r===`html`?``:oI(r,n));return a.kind===`loading`?(0,U.jsx)(`p`,{className:Vr,children:V(`artifact.loading`)}):a.kind===`failed`?(0,U.jsx)(`p`,{className:`${Vr} text-error`,children:a.text}):r===`md`?(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto px-3 py-2`,children:(0,U.jsx)(_L,{source:aI(a.file.base64)})}):r===`html`?(0,U.jsx)(`iframe`,{title:n,sandbox:``,srcDoc:cI(aI(a.file.base64)),style:{colorScheme:`light`,background:`#fff`},className:`min-h-0 w-full flex-1 border-none`}):o?r===`pdf`?(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,U.jsx)(`a`,{className:`${Jr} px-3 py-1 font-mono text-meta`,href:o,target:`_blank`,rel:`noreferrer noopener`,children:V(`artifact.open`)}),(0,U.jsx)(`iframe`,{title:n,src:o,className:`min-h-0 w-full flex-1 border-none`})]}):(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-3`,children:(0,U.jsx)(`img`,{src:o,alt:n,className:`max-w-full`})}):null}function SL(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.taskId==`string`&&(t.source===`history`||t.source===`terminal`)}var CL={entries:[],failed:new Set,outputs:new Map,ended:new Map,thoughts:new Map},wL=4e3;function TL(e){return(typeof e==`string`?e:Array.isArray(e)?e.map(e=>typeof e?.text==`string`?e.text:``).join(`
77
- `):e==null?``:JSON.stringify(e)).slice(0,wL)}var EL=[`command`,`cmd`,`file_path`,`path`,`pattern`,`query`,`url`,`description`,`prompt`],DL=new Set([`command`,`cmd`]),OL=new Set([`file_path`,`path`]),kL=100,AL=4e3,jL=48;function ML(e){let t=(e.split(`
78
- `).find(e=>e.trim()!==``)??``).trim();return t.length>kL?`${t.slice(0,99)}…`:t}function NL(e){if(e.length<=jL)return e;let t=e.split(`/`).filter(e=>e!==``);return t.length>3?`…/${t.slice(-3).join(`/`)}`:e}function PL(e){let t=e.split(`
79
- `),n=(t.find(e=>e.trim()!==``)??``).trim();for(let e=``;e!==n;)e=n,n=n.replace(/^cd\s+(?:"[^"]*"|'[^']*'|\S+)\s*(?:&&|;)\s*/,``).replace(/^[A-Za-z_][A-Za-z0-9_]*=\S*\s+/,``);let r=n.match(/\s*<<-?\s*['"]?\w+['"]?/);if(r?.index!==void 0){let e=t.length-2;n=`${n.slice(0,r.index)}${e>0?` (${e} lines)`:``}`}return n=n.replace(/(?:~|\.{0,2})?\/[^\s"'|;&<>()]+/g,e=>NL(e)),n.length>kL?`${n.slice(0,99)}…`:n}function FL(e){let t=e.trim().match(/^<([a-z][a-z0-9]*(?:-[a-z0-9]+)+)>([\s\S]*)<\/\1>$/);if(!t)return null;let[,n=``,r=``]=t,i=[...r.matchAll(/<([a-z][a-z0-9-]*)>([\s\S]*?)<\/\1>/g)].map(([,e=``,t=``])=>[e,t.trim()]),a=e=>i.find(([t])=>t===e)?.[1],o=r.replace(/<[^>]+>/g,` `).trim(),s=a(`status`);return{kind:n.replaceAll(`-`,` `),...s?{status:s}:{},summary:ML(a(`summary`)??o),details:i.length>0?i.map(([e,t])=>`${e}: ${t}`).join(`
80
- `):o}}function IL(e){if(typeof e==`string`)return{text:e,kind:`other`};if(!e||typeof e!=`object`)return{text:``,kind:`other`};let t=e,n=e=>typeof e==`string`?e:Array.isArray(e)&&e.every(e=>typeof e==`string`)?e.join(` `):``,r=new Map;for(let[e,n]of Object.entries(t))r.set(e.toLowerCase(),n);for(let e of EL){let i=n(t[e]??r.get(e));if(i.trim())return{text:i,kind:DL.has(e)?`command`:OL.has(e)?`path`:`other`}}for(let e of Object.values(t)){let t=n(e);if(t.trim())return{text:t,kind:`other`}}return{text:``,kind:`other`}}function LL(e){let{text:t,kind:n}=IL(e),r=t.trim(),i=n===`command`?PL(r):ML(n===`path`?NL(r):r);return i===r?{summary:i}:{summary:i,full:r.slice(0,AL)}}function RL(e){return e===`user`||e===`assistant`||e===`system`?e:null}function zL(e,t){let n=[],r=[],i=[],a=[],o=[];return e.forEach((e,s)=>{let c=RL(e.role);if(!c)return;let l=[],u=[],d=[],f=(e.blocks??[]).flatMap(e=>e.type===`thinking`&&e.text?.trim()?[e.text.trim()]:[]);f.length>0&&o.push([t+s,{at:e.timestamp??``,text:f.join(`
81
-
82
- `).slice(0,wL)}]);for(let t of e.blocks??[])if(t.type===`text`&&t.text?.trim())l.push(t.text.trim());else if(t.type===`image`&&t.path)d.push(t.path);else if(t.type===`tool_call`)u.push({callId:t.callId??``,name:t.name??`tool`,...LL(t.input),input:t.input});else if(t.type===`tool_result`&&t.callId){t.isError&&r.push(t.callId);let n=TL(t.output);n&&i.push([t.callId,n]),e.timestamp&&a.push([t.callId,e.timestamp])}if(l.length===0&&u.length===0&&d.length===0)return;let p=l.join(`
83
-
84
- `),m=u.length===0&&c!==`assistant`?FL(p):null,h=m?{index:t+s,role:`system`,at:e.timestamp??``,text:m.summary,tools:u,notice:m}:{index:t+s,role:c,at:e.timestamp??``,text:p,tools:u};n.push(d.length>0?{...h,images:d}:h)}),{entries:n,failed:r,outputs:i,ended:a,thoughts:o}}function BL(e,t,n){let r=zL(t,n),i=new Map(e.entries.map(e=>[e.index,e]));for(let e of r.entries)i.set(e.index,e);let a=r.failed.length>0?new Set([...e.failed,...r.failed]):e.failed,o=r.outputs.length>0?new Map([...e.outputs,...r.outputs]):e.outputs,s=r.ended.length>0?new Map([...e.ended,...r.ended]):e.ended,c=r.thoughts.length>0?new Map([...e.thoughts,...r.thoughts]):e.thoughts;return{entries:[...i.values()].sort((e,t)=>e.index-t.index),failed:a,outputs:o,ended:s,thoughts:c}}function VL(e){let t=[];return{text:e.replace(/^images\[\d+\]: (\/.+)\n?/gm,(e,n)=>(t.push(n.trim()),``)).trim(),images:t}}function HL(e){let t=[];for(let n of e){let e=t.at(-1);e&&n.text===``&&n.role===`assistant`&&e.role===`assistant`?t[t.length-1]={...e,tools:[...e.tools,...n.tools]}:t.push(n)}return t}function UL(e,t){let n=t.trim().toLowerCase();return n!==``&&e.tools.some(e=>`${e.name} ${e.summary}`.toLowerCase().includes(n))}function WL(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>e.text.toLowerCase().includes(n)||e.tools.some(e=>`${e.name} ${e.summary}`.toLowerCase().includes(n))).map(e=>e.index):[]}var GL=e=>e.replace(/[*_`]+/g,``).replace(/[…\s]+/g,` `).trim().toLowerCase();function KL(e,t){let n=e.find(e=>e.at===t.at&&e.role===t.role);if(n)return n.index;let r=GL(t.snippet);return r?e.find(e=>e.role===t.role&&GL(e.text).includes(r))?.index??null:null}function qL(e,t){let n=e[0];if(!n)return!0;let[r,i]=[Date.parse(n.at),Date.parse(t.at)];return Number.isNaN(r)||Number.isNaN(i)?!0:r>i}function JL(e,t){let n=e.tools.map(e=>`- \`${e.name}\`${e.summary?` ${e.summary}`:``}${t.has(e.callId)?` (failed)`:``}`);return[e.text,n.join(`
73
+ `),n=[],r=[],i=()=>{r.length>0&&n.push({t:`para`,c:pI(r.join(`
74
+ `))}),r=[]};for(let e=0;e<t.length;e++){let a=t[e],o=mI.exec(a);if(o){i();let r=o[1][0],a=[];for(e++;e<t.length&&!RegExp(`^\\s*${r}{3,}\\s*$`).test(t[e]);e++)a.push(t[e]);n.push({t:`code`,lang:o[2]??``,v:a.join(`
75
+ `)});continue}if(a.trim()===``){i();continue}let s=hI.exec(a);if(s){i(),n.push({t:`heading`,level:s[1].length,c:pI(s[2])});continue}if(vI.test(a)){i(),n.push({t:`hr`});continue}if(yI.test(a)){i();let r=[];for(;e<t.length&&yI.test(t[e]);e++){let n=t[e];bI.test(n)||r.push(xI(n))}e--,n.push({t:`table`,rows:r.map(e=>e.map(e=>pI(e)))});continue}if(a.startsWith(`>`)){i();let r=[];for(;e<t.length&&t[e].startsWith(`>`);e++)r.push(t[e].replace(/^>\s?/,``));e--,n.push({t:`quote`,c:pI(r.join(`
76
+ `))});continue}let c=gI.exec(a),l=c?null:_I.exec(a);if(c||l){i();let r=!c,a=[];for(;e<t.length;e++){let n=r?_I.exec(t[e]):gI.exec(t[e]);if(!n)break;let i=n[1].length;a.push({depth:Math.min(3,Math.floor(i/2)),c:pI(r?n[2]:n[3])})}e--,n.push({t:`list`,ordered:r,items:a});continue}r.push(a)}return i(),n}var CI=`flex min-h-0 min-w-0 flex-1 flex-col font-sans text-body`,wI=`flex flex-none flex-wrap items-center gap-x-3 gap-y-1 px-3 pb-1.5 font-mono text-meta`,TI=`min-h-0 flex-1 overflow-y-auto px-3 pb-3`,EI=`m-0 px-3 py-2 font-mono text-meta text-subtle`,DI=`m-0 whitespace-pre-wrap px-3 pb-3 font-mono text-meta leading-[1.45] text-muted wrap-anywhere`,OI=e=>`group/entry mt-3 rounded-sm border-l-2 py-0.5 pl-2.5 ${e.flash?`border-accent bg-accent-soft`:e.current?`border-line-active`:`border-transparent`}`,kI=`mb-0.5 flex items-center gap-2 font-mono text-meta`,AI=e=>e===`user`?`text-accent`:`text-muted`,jI=`text-subtle`,MI=`ml-auto opacity-0 group-hover/entry:opacity-100 focus-visible:opacity-100 touch:opacity-100`,NI=`m-0 mt-0.5 flex min-w-0 items-baseline gap-1.5 font-mono text-meta text-subtle`,PI=`flex-none text-muted`,FI=`min-w-0 flex-1 truncate`,II=`group/tool mt-0.5`,LI=`${NI} mt-0 cursor-pointer list-none hover:text-muted focus-visible:outline focus-visible:outline-1 focus-visible:outline-focus [&::-webkit-details-marker]:hidden`,RI=`m-0 mt-1 mb-1 max-h-60 overflow-auto rounded-sm border-hairline border-line bg-inset px-2.5 py-1.5 font-mono text-meta leading-[1.45] whitespace-pre-wrap text-muted wrap-anywhere`,zI=`text-diff-added`,BI=`text-diff-removed`,VI=`m-0 mt-1 mb-1 line-clamp-3 font-mono text-meta text-subtle italic`,HI=e=>`group/notice mt-3 rounded-sm border-hairline px-2.5 py-1 ${e.flash?`border-accent bg-accent-soft`:e.current?`border-line-active bg-inset`:`border-line bg-inset`}`,UI=`flex min-w-0 cursor-pointer list-none items-baseline gap-2 font-mono text-meta text-muted focus-visible:outline focus-visible:outline-1 focus-visible:outline-focus [&::-webkit-details-marker]:hidden`,WI=`flex-none text-subtle`,GI=`min-w-0 flex-1 truncate font-sans text-body text-ink`,KI=e=>`flex-none ${/fail|error|kill|cancel/i.test(e)?`text-error`:/complet|success|done|pass/i.test(e)?`text-success`:`text-warning`}`,qI=`group/fold mt-0.5`,JI=`flex cursor-pointer list-none items-baseline gap-1.5 font-mono text-meta text-subtle hover:text-muted focus-visible:outline focus-visible:outline-1 focus-visible:outline-focus [&::-webkit-details-marker]:hidden`,YI=`inline-block flex-none group-open/fold:rotate-90`,XI=`cursor-zoom-in rounded-sm p-0`,ZI=`overlay fixed inset-0 z-20 grid cursor-zoom-out place-items-center bg-(--scrim) motion-safe:animate-fade-in [&.is-leaving]:pointer-events-none [&.is-leaving]:animate-fade-out`,QI=`dialog static m-0 cursor-default border-0 bg-transparent p-0`,$I=`block max-h-[calc(100dvh-32px)] max-w-[calc(100vw-32px)] rounded-sm object-contain shadow-dialog`,eL=`block h-20 min-w-20 max-w-48 rounded-sm border-hairline border-line bg-inset object-cover hover:border-line-active`,tL=`leading-[1.5] wrap-anywhere`,nL=`m-0 mb-2 whitespace-pre-wrap last:mb-0`,rL=`m-0 mt-3 mb-1.5 font-semibold first:mt-0`,iL=`m-0 mb-2 flex flex-col gap-0.5 pl-5 last:mb-0`,aL=`m-0 mb-2 border-l-2 border-line pl-2.5 whitespace-pre-wrap text-muted last:mb-0`,oL=`m-0 mb-2 overflow-x-auto rounded-sm border-hairline border-line bg-inset px-2.5 py-2 font-mono text-meta leading-[1.45] last:mb-0`,sL=`rounded-xs bg-inset px-1 font-mono text-meta`,cL=`text-accent underline`,lL=`mb-2 block max-w-full overflow-x-auto border-collapse font-mono text-meta last:mb-0`,uL=`border-hairline border-line px-2 py-0.5 text-left align-top`,dL=`my-2 border-0 border-t border-line`;function fL(e,t){let n=t.trim().toLowerCase();if(!n)return e;let r=e.toLowerCase(),i=[],a=0;for(let t=r.indexOf(n);t>=0;t=r.indexOf(n,a))t>a&&i.push(e.slice(a,t)),i.push((0,U.jsx)(`mark`,{className:ij,"data-hit":``,children:e.slice(t,t+n.length)},t)),a=t+n.length;return i.push(e.slice(a)),h.Children.toArray(i)}var pL=[`h3`,`h3`,`h4`,`h5`,`h6`,`h6`];function mL({level:e,children:t}){let n=pL[Math.min(5,Math.max(0,e-1))]??`h6`;return(0,U.jsx)(n,{className:rL,children:t})}function hL(e,t){return e.map((e,n)=>(0,U.jsx)(h.Fragment,{children:t(e)},n))}function gL({nodes:e,needle:t}){return hL(e,e=>e.t===`text`?fL(e.v,t):e.t===`code`?(0,U.jsx)(`code`,{className:sL,children:fL(e.v,t)}):e.t===`bold`?(0,U.jsx)(`strong`,{children:(0,U.jsx)(gL,{nodes:e.c,needle:t})}):e.t===`em`?(0,U.jsx)(`em`,{children:(0,U.jsx)(gL,{nodes:e.c,needle:t})}):(0,U.jsx)(`a`,{className:cL,href:e.href,target:`_blank`,rel:`noopener noreferrer`,children:(0,U.jsx)(gL,{nodes:e.c,needle:t})}))}function _L({block:e,needle:t}){switch(e.t){case`heading`:return(0,U.jsx)(mL,{level:e.level,children:(0,U.jsx)(gL,{nodes:e.c,needle:t})});case`para`:return(0,U.jsx)(`p`,{className:nL,children:(0,U.jsx)(gL,{nodes:e.c,needle:t})});case`code`:return(0,U.jsx)(`pre`,{className:oL,children:(0,U.jsx)(`code`,{children:fL(e.v,t)})});case`quote`:return(0,U.jsx)(`blockquote`,{className:aL,children:(0,U.jsx)(gL,{nodes:e.c,needle:t})});case`hr`:return(0,U.jsx)(`hr`,{className:dL});case`list`:{let n=e.ordered?`ol`:`ul`;return(0,U.jsx)(n,{className:`${iL} ${e.ordered?`list-decimal`:`list-disc`}`,children:hL(e.items,e=>(0,U.jsx)(`li`,{style:{marginLeft:`${e.depth*1.25}rem`},children:(0,U.jsx)(gL,{nodes:e.c,needle:t})}))})}case`table`:return(0,U.jsx)(`table`,{className:lL,children:(0,U.jsx)(`tbody`,{children:hL(e.rows,e=>(0,U.jsx)(`tr`,{children:hL(e,e=>(0,U.jsx)(`td`,{className:uL,children:(0,U.jsx)(gL,{nodes:e,needle:t})}))}))})})}}function vL({source:e,needle:t=``}){let n=(0,h.useMemo)(()=>SI(e),[e]);return(0,U.jsx)(`div`,{className:tL,children:hL(n,e=>(0,U.jsx)(_L,{block:e,needle:t}))})}function yL(e){if(e instanceof Pc){if(e.code===`TOO_LARGE`){let t=e.detail?.size;return Z(V(`artifact.tooLarge`),{size:typeof t==`number`?`${(t/1048576).toFixed(1)} MB`:`5 MB+`})}if(e.code===`NOT_PREVIEWABLE`)return V(`artifact.notPreviewable`);if(e.code===`NOT_FOUND`)return V(`artifact.gone`)}return Z(V(`artifact.failed`),{error:e instanceof Error?e.message:String(e)})}function bL(e,t,n,r){let[i,a]=(0,h.useState)({kind:`loading`});return(0,h.useEffect)(()=>{let r=!0;return e.client.request(`file.read`,{taskId:t,path:n}).then(e=>r&&a({kind:`ready`,file:e}),e=>r&&a({kind:`failed`,text:yL(e)})),()=>{r=!1}},[e,t,n,r]),i}function xL(e,t){let n=(0,h.useMemo)(()=>e===null?null:URL.createObjectURL(new Blob([aI(e)],{type:t})),[e,t]);return(0,h.useEffect)(()=>()=>void(n&&URL.revokeObjectURL(n)),[n]),n}function SL({model:e,taskId:t,path:n,kind:r,changeKey:i}){H();let a=bL(e,t,n,i),o=xL(a.kind===`ready`&&(r===`svg`||r===`image`||r===`pdf`)?a.file.base64:null,r===`md`||r===`html`?``:sI(r,n));return a.kind===`loading`?(0,U.jsx)(`p`,{className:Vr,children:V(`artifact.loading`)}):a.kind===`failed`?(0,U.jsx)(`p`,{className:`${Vr} text-error`,children:a.text}):r===`md`?(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto px-3 py-2`,children:(0,U.jsx)(vL,{source:oI(a.file.base64)})}):r===`html`?(0,U.jsx)(`iframe`,{title:n,sandbox:``,srcDoc:lI(oI(a.file.base64)),style:{colorScheme:`light`,background:`#fff`},className:`min-h-0 w-full flex-1 border-none`}):o?r===`pdf`?(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,U.jsx)(`a`,{className:`${Jr} px-3 py-1 font-mono text-meta`,href:o,target:`_blank`,rel:`noreferrer noopener`,children:V(`artifact.open`)}),(0,U.jsx)(`iframe`,{title:n,src:o,className:`min-h-0 w-full flex-1 border-none`})]}):(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-3`,children:(0,U.jsx)(`img`,{src:o,alt:n,className:`max-w-full`})}):null}function CL(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.taskId==`string`&&(t.source===`history`||t.source===`terminal`)}var wL={entries:[],failed:new Set,outputs:new Map,ended:new Map,thoughts:new Map},TL=4e3;function EL(e){return(typeof e==`string`?e:Array.isArray(e)?e.map(e=>typeof e?.text==`string`?e.text:``).join(`
77
+ `):e==null?``:JSON.stringify(e)).slice(0,TL)}var DL=[`command`,`cmd`,`file_path`,`path`,`pattern`,`query`,`url`,`description`,`prompt`],OL=new Set([`command`,`cmd`]),kL=new Set([`file_path`,`path`]),AL=100,jL=4e3,ML=48;function NL(e){let t=(e.split(`
78
+ `).find(e=>e.trim()!==``)??``).trim();return t.length>AL?`${t.slice(0,99)}…`:t}function PL(e){if(e.length<=ML)return e;let t=e.split(`/`).filter(e=>e!==``);return t.length>3?`…/${t.slice(-3).join(`/`)}`:e}function FL(e){let t=e.split(`
79
+ `),n=(t.find(e=>e.trim()!==``)??``).trim();for(let e=``;e!==n;)e=n,n=n.replace(/^cd\s+(?:"[^"]*"|'[^']*'|\S+)\s*(?:&&|;)\s*/,``).replace(/^[A-Za-z_][A-Za-z0-9_]*=\S*\s+/,``);let r=n.match(/\s*<<-?\s*['"]?\w+['"]?/);if(r?.index!==void 0){let e=t.length-2;n=`${n.slice(0,r.index)}${e>0?` (${e} lines)`:``}`}return n=n.replace(/(?:~|\.{0,2})?\/[^\s"'|;&<>()]+/g,e=>PL(e)),n.length>AL?`${n.slice(0,99)}…`:n}function IL(e){let t=e.trim().match(/^<([a-z][a-z0-9]*(?:-[a-z0-9]+)+)>([\s\S]*)<\/\1>$/);if(!t)return null;let[,n=``,r=``]=t,i=[...r.matchAll(/<([a-z][a-z0-9-]*)>([\s\S]*?)<\/\1>/g)].map(([,e=``,t=``])=>[e,t.trim()]),a=e=>i.find(([t])=>t===e)?.[1],o=r.replace(/<[^>]+>/g,` `).trim(),s=a(`status`);return{kind:n.replaceAll(`-`,` `),...s?{status:s}:{},summary:NL(a(`summary`)??o),details:i.length>0?i.map(([e,t])=>`${e}: ${t}`).join(`
80
+ `):o}}function LL(e){if(typeof e==`string`)return{text:e,kind:`other`};if(!e||typeof e!=`object`)return{text:``,kind:`other`};let t=e,n=e=>typeof e==`string`?e:Array.isArray(e)&&e.every(e=>typeof e==`string`)?e.join(` `):``,r=new Map;for(let[e,n]of Object.entries(t))r.set(e.toLowerCase(),n);for(let e of DL){let i=n(t[e]??r.get(e));if(i.trim())return{text:i,kind:OL.has(e)?`command`:kL.has(e)?`path`:`other`}}for(let e of Object.values(t)){let t=n(e);if(t.trim())return{text:t,kind:`other`}}return{text:``,kind:`other`}}function RL(e){let{text:t,kind:n}=LL(e),r=t.trim(),i=n===`command`?FL(r):NL(n===`path`?PL(r):r);return i===r?{summary:i}:{summary:i,full:r.slice(0,jL)}}function zL(e){return e===`user`||e===`assistant`||e===`system`?e:null}function BL(e,t){let n=[],r=[],i=[],a=[],o=[];return e.forEach((e,s)=>{let c=zL(e.role);if(!c)return;let l=[],u=[],d=[],f=(e.blocks??[]).flatMap(e=>e.type===`thinking`&&e.text?.trim()?[e.text.trim()]:[]);f.length>0&&o.push([t+s,{at:e.timestamp??``,text:f.join(`
81
+
82
+ `).slice(0,TL)}]);for(let t of e.blocks??[])if(t.type===`text`&&t.text?.trim())l.push(t.text.trim());else if(t.type===`image`&&t.path)d.push(t.path);else if(t.type===`tool_call`)u.push({callId:t.callId??``,name:t.name??`tool`,...RL(t.input),input:t.input});else if(t.type===`tool_result`&&t.callId){t.isError&&r.push(t.callId);let n=EL(t.output);n&&i.push([t.callId,n]),e.timestamp&&a.push([t.callId,e.timestamp])}if(l.length===0&&u.length===0&&d.length===0)return;let p=l.join(`
83
+
84
+ `),m=u.length===0&&c!==`assistant`?IL(p):null,h=m?{index:t+s,role:`system`,at:e.timestamp??``,text:m.summary,tools:u,notice:m}:{index:t+s,role:c,at:e.timestamp??``,text:p,tools:u};n.push(d.length>0?{...h,images:d}:h)}),{entries:n,failed:r,outputs:i,ended:a,thoughts:o}}function VL(e,t,n){let r=BL(t,n),i=new Map(e.entries.map(e=>[e.index,e]));for(let e of r.entries)i.set(e.index,e);let a=r.failed.length>0?new Set([...e.failed,...r.failed]):e.failed,o=r.outputs.length>0?new Map([...e.outputs,...r.outputs]):e.outputs,s=r.ended.length>0?new Map([...e.ended,...r.ended]):e.ended,c=r.thoughts.length>0?new Map([...e.thoughts,...r.thoughts]):e.thoughts;return{entries:[...i.values()].sort((e,t)=>e.index-t.index),failed:a,outputs:o,ended:s,thoughts:c}}function HL(e){let t=[];return{text:e.replace(/^images\[\d+\]: (\/.+)\n?/gm,(e,n)=>(t.push(n.trim()),``)).trim(),images:t}}function UL(e){let t=[];for(let n of e){let e=t.at(-1);e&&n.text===``&&n.role===`assistant`&&e.role===`assistant`?t[t.length-1]={...e,tools:[...e.tools,...n.tools]}:t.push(n)}return t}function WL(e,t){let n=t.trim().toLowerCase();return n!==``&&e.tools.some(e=>`${e.name} ${e.summary}`.toLowerCase().includes(n))}function GL(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>e.text.toLowerCase().includes(n)||e.tools.some(e=>`${e.name} ${e.summary}`.toLowerCase().includes(n))).map(e=>e.index):[]}var KL=e=>e.replace(/[*_`]+/g,``).replace(/[…\s]+/g,` `).trim().toLowerCase();function qL(e,t){let n=e.find(e=>e.at===t.at&&e.role===t.role);if(n)return n.index;let r=KL(t.snippet);return r?e.find(e=>e.role===t.role&&KL(e.text).includes(r))?.index??null:null}function JL(e,t){let n=e[0];if(!n)return!0;let[r,i]=[Date.parse(n.at),Date.parse(t.at)];return Number.isNaN(r)||Number.isNaN(i)?!0:r>i}function YL(e,t){let n=e.tools.map(e=>`- \`${e.name}\`${e.summary?` ${e.summary}`:``}${t.has(e.callId)?` (failed)`:``}`);return[e.text,n.join(`
85
85
  `)].filter(e=>e!==``).join(`
86
86
 
87
- `)}function YL(e,t){return e.text===``?JL(e,t):e.text}function XL(e,t,n,r){return`# ${e}\n\n${t.map(e=>`${`## ${r[e.role]}${e.at?` · ${e.at}`:``}`}\n\n${JL(e,n)}`).join(`
87
+ `)}function XL(e,t){return e.text===``?YL(e,t):e.text}function ZL(e,t,n,r){return`# ${e}\n\n${t.map(e=>`${`## ${r[e.role]}${e.at?` · ${e.at}`:``}`}\n\n${YL(e,n)}`).join(`
88
88
 
89
- `)}\n`}var ZL=50;function QL(e,t){if(t.reset)return t.source===`terminal`||!t.history?{kind:`terminal`,tail:t.terminal?.tail??[]}:{kind:`ready`,transcript:BL(CL,t.history.messages??[],t.history.firstIndex??0),cursor:t.cursor??null,older:t.olderCursor??null};if(t.source===`history`&&t.history){let n=t.history.messages??[],r=t.history.firstIndex??0;return e.kind===`ready`?{...e,transcript:BL(e.transcript,n,r),cursor:t.cursor??e.cursor}:{kind:`ready`,transcript:BL(CL,n,r),cursor:t.cursor??null,older:t.olderCursor??null}}return t.source===`terminal`&&t.terminal?{kind:`terminal`,tail:t.terminal.tail??[]}:e}function $L(e,t,n=!0){let[r,i]=(0,h.useState)({kind:`loading`}),[a,o]=(0,h.useState)(!1),[s,c]=(0,h.useState)(!1),l=(0,h.useRef)(r);l.current=r;let u=(0,h.useRef)(!1),d=(0,h.useRef)(0),f=(0,h.useCallback)(n=>e.client.request(`output.read`,{taskId:t,limit:ZL,...n}),[e,t]),p=(0,h.useCallback)(async()=>{let e=++d.current;u.current=!0;try{let t=await f({});if(e!==d.current)return;if(t.source===`terminal`||!t.history){i({kind:`terminal`,tail:t.terminal?.tail??[]});return}let n=BL(CL,t.history.messages??[],t.history.firstIndex??0);i({kind:`ready`,transcript:n,cursor:t.cursor??null,older:t.olderCursor??null})}catch(t){e===d.current&&i({kind:`error`,message:G(t)})}finally{e===d.current&&(u.current=!1)}},[f]);(0,h.useEffect)(()=>{if(i({kind:`loading`}),c(!1),t)return p(),()=>{d.current++,u.current=!1}},[p,t]);let m=r.kind===`ready`||r.kind===`terminal`?r.kind:null;(0,h.useEffect)(()=>{if(!n||!m){c(!1);return}let r=!1,a=!1,o=e.client.on(`transcript.update`,e=>{r||!SL(e)||e.taskId!==t||e.tab||i(t=>QL(t,e))}),s=e.client.onOpen(()=>{let n=l.current,i=n.kind===`ready`?n.cursor:null;e.client.request(`transcript.subscribe`,{taskId:t,...i?{cursor:i}:{}}).then(e=>{if(r)return;let t=e?.streaming===!0;a=t,c(t)},()=>{r||c(!1)})});return()=>{r=!0,o(),s(),c(!1),a&&e.client.request(`transcript.unsubscribe`,{taskId:t}).catch(()=>{})}},[n,m,e,t]);let g=(0,h.useCallback)(async()=>{let e=l.current;if(u.current)return;if(e.kind===`terminal`)return p();if(e.kind!==`ready`||!e.cursor)return;let t=d.current;u.current=!0;try{let n=await f({cursor:e.cursor,source:`history`});if(t!==d.current)return;i(e=>e.kind===`ready`?{...e,transcript:BL(e.transcript,n.history?.messages??[],n.history?.firstIndex??0),cursor:n.cursor??e.cursor}:e)}catch{t===d.current&&(u.current=!1,await p())}finally{t===d.current&&(u.current=!1)}},[f,p]);return{state:r,paging:a,streaming:s,loadOlder:(0,h.useCallback)(async()=>{let e=l.current;if(u.current||e.kind!==`ready`||!e.older)return;let t=d.current;u.current=!0,o(!0);try{let n=await f({cursor:e.older,source:`history`});if(t!==d.current)return;i(e=>e.kind===`ready`?{...e,transcript:BL(e.transcript,n.history?.messages??[],n.history?.firstIndex??0),older:n.olderCursor??null}:e)}catch(e){t===d.current&&i({kind:`error`,message:G(e)})}finally{t===d.current&&(u.current=!1,o(!1))}},[f]),loadAll:(0,h.useCallback)(async()=>{let e=l.current;if(e.kind!==`ready`)return null;if(u.current||!e.older)return e.transcript;let t=d.current;u.current=!0,o(!0);let n=[],r=e.transcript;try{for(let i=e.older;i&&t===d.current;){let e=await f({cursor:i,source:`history`}),t={messages:e.history?.messages??[],firstIndex:e.history?.firstIndex??0};n.push(t),r=BL(r,t.messages,t.firstIndex),i=e.olderCursor??null}return t===d.current?(i(e=>e.kind===`ready`?{...e,transcript:n.reduce((e,t)=>BL(e,t.messages,t.firstIndex),e.transcript),older:null}:e),r):null}catch(e){return t===d.current&&i({kind:`error`,message:G(e)}),null}finally{t===d.current&&(u.current=!1,o(!1))}},[f]),refresh:g,reload:(0,h.useCallback)(()=>{i({kind:`loading`}),p()},[p])}}var eR=8,tR=14;function nR(e){return e<1e3?`${Math.max(1,Math.round(e))}ms`:e<6e4?`${(e/1e3).toFixed(+(e<1e4))}s`:`${Math.floor(e/6e4)}m ${String(Math.round(e%6e4/1e3)).padStart(2,`0`)}s`}function rR(e){if(!e||typeof e!=`object`)return null;let t=Object.fromEntries(Object.entries(e).map(([e,t])=>[e.toLowerCase(),t])),n=t.old_string??t.oldtext??t.old_str??t.old,r=t.new_string??t.newtext??t.new_str??t.new;return typeof n==`string`&&typeof r==`string`?{before:n,after:r}:null}function iR({before:e,after:t}){let n=[...e.split(`
89
+ `)}\n`}var QL=50;function $L(e,t){if(t.reset)return t.source===`terminal`||!t.history?{kind:`terminal`,tail:t.terminal?.tail??[]}:{kind:`ready`,transcript:VL(wL,t.history.messages??[],t.history.firstIndex??0),cursor:t.cursor??null,older:t.olderCursor??null};if(t.source===`history`&&t.history){let n=t.history.messages??[],r=t.history.firstIndex??0;return e.kind===`ready`?{...e,transcript:VL(e.transcript,n,r),cursor:t.cursor??e.cursor}:{kind:`ready`,transcript:VL(wL,n,r),cursor:t.cursor??null,older:t.olderCursor??null}}return t.source===`terminal`&&t.terminal?{kind:`terminal`,tail:t.terminal.tail??[]}:e}function eR(e,t,n=!0){let[r,i]=(0,h.useState)({kind:`loading`}),[a,o]=(0,h.useState)(!1),[s,c]=(0,h.useState)(!1),l=(0,h.useRef)(r);l.current=r;let u=(0,h.useRef)(!1),d=(0,h.useRef)(0),f=(0,h.useCallback)(n=>e.client.request(`output.read`,{taskId:t,limit:QL,...n}),[e,t]),p=(0,h.useCallback)(async()=>{let e=++d.current;u.current=!0;try{let t=await f({});if(e!==d.current)return;if(t.source===`terminal`||!t.history){i({kind:`terminal`,tail:t.terminal?.tail??[]});return}let n=VL(wL,t.history.messages??[],t.history.firstIndex??0);i({kind:`ready`,transcript:n,cursor:t.cursor??null,older:t.olderCursor??null})}catch(t){e===d.current&&i({kind:`error`,message:G(t)})}finally{e===d.current&&(u.current=!1)}},[f]);(0,h.useEffect)(()=>{if(i({kind:`loading`}),c(!1),t)return p(),()=>{d.current++,u.current=!1}},[p,t]);let m=r.kind===`ready`||r.kind===`terminal`?r.kind:null;(0,h.useEffect)(()=>{if(!n||!m){c(!1);return}let r=!1,a=!1,o=e.client.on(`transcript.update`,e=>{r||!CL(e)||e.taskId!==t||e.tab||i(t=>$L(t,e))}),s=e.client.onOpen(()=>{let n=l.current,i=n.kind===`ready`?n.cursor:null;e.client.request(`transcript.subscribe`,{taskId:t,...i?{cursor:i}:{}}).then(e=>{if(r)return;let t=e?.streaming===!0;a=t,c(t)},()=>{r||c(!1)})});return()=>{r=!0,o(),s(),c(!1),a&&e.client.request(`transcript.unsubscribe`,{taskId:t}).catch(()=>{})}},[n,m,e,t]);let g=(0,h.useCallback)(async()=>{let e=l.current;if(u.current)return;if(e.kind===`terminal`)return p();if(e.kind!==`ready`||!e.cursor)return;let t=d.current;u.current=!0;try{let n=await f({cursor:e.cursor,source:`history`});if(t!==d.current)return;i(e=>e.kind===`ready`?{...e,transcript:VL(e.transcript,n.history?.messages??[],n.history?.firstIndex??0),cursor:n.cursor??e.cursor}:e)}catch{t===d.current&&(u.current=!1,await p())}finally{t===d.current&&(u.current=!1)}},[f,p]);return{state:r,paging:a,streaming:s,loadOlder:(0,h.useCallback)(async()=>{let e=l.current;if(u.current||e.kind!==`ready`||!e.older)return;let t=d.current;u.current=!0,o(!0);try{let n=await f({cursor:e.older,source:`history`});if(t!==d.current)return;i(e=>e.kind===`ready`?{...e,transcript:VL(e.transcript,n.history?.messages??[],n.history?.firstIndex??0),older:n.olderCursor??null}:e)}catch(e){t===d.current&&i({kind:`error`,message:G(e)})}finally{t===d.current&&(u.current=!1,o(!1))}},[f]),loadAll:(0,h.useCallback)(async()=>{let e=l.current;if(e.kind!==`ready`)return null;if(u.current||!e.older)return e.transcript;let t=d.current;u.current=!0,o(!0);let n=[],r=e.transcript;try{for(let i=e.older;i&&t===d.current;){let e=await f({cursor:i,source:`history`}),t={messages:e.history?.messages??[],firstIndex:e.history?.firstIndex??0};n.push(t),r=VL(r,t.messages,t.firstIndex),i=e.olderCursor??null}return t===d.current?(i(e=>e.kind===`ready`?{...e,transcript:n.reduce((e,t)=>VL(e,t.messages,t.firstIndex),e.transcript),older:null}:e),r):null}catch(e){return t===d.current&&i({kind:`error`,message:G(e)}),null}finally{t===d.current&&(u.current=!1,o(!1))}},[f]),refresh:g,reload:(0,h.useCallback)(()=>{i({kind:`loading`}),p()},[p])}}var tR=8,nR=14;function rR(e){return e<1e3?`${Math.max(1,Math.round(e))}ms`:e<6e4?`${(e/1e3).toFixed(+(e<1e4))}s`:`${Math.floor(e/6e4)}m ${String(Math.round(e%6e4/1e3)).padStart(2,`0`)}s`}function iR(e){if(!e||typeof e!=`object`)return null;let t=Object.fromEntries(Object.entries(e).map(([e,t])=>[e.toLowerCase(),t])),n=t.old_string??t.oldtext??t.old_str??t.old,r=t.new_string??t.newtext??t.new_str??t.new;return typeof n==`string`&&typeof r==`string`?{before:n,after:r}:null}function aR({before:e,after:t}){let n=[...e.split(`
90
90
  `).map(e=>({kind:`del`,text:e})),...t.split(`
91
- `).map(e=>({kind:`add`,text:e}))],r=n.slice(0,tR);return(0,U.jsxs)(`pre`,{className:LI,"data-tp-part":`tool-edit`,children:[r.map((e,t)=>(0,U.jsxs)(`span`,{className:e.kind===`add`?RI:zI,"data-line":e.kind,children:[e.kind===`add`?`+ `:`- `,e.text,`
92
- `]},t)),n.length>r.length&&(0,U.jsxs)(`span`,{className:`text-subtle`,children:[`… +`,n.length-r.length]})]})}function aR(e){let{tool:t,show:n}=e,r=n.edits?rR(t.input):null,i=n.output&&e.output?e.output.trimEnd().split(`
93
- `):null,a=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:NI,"data-tp-part":`tool-name`,children:dL(t.name,e.needle)},`name`),(0,U.jsx)(`span`,{className:PI,"data-tp-part":`tool-arg`,children:dL(t.summary,e.needle)},`text`),n.duration&&e.ran!==void 0&&(0,U.jsx)(`span`,{className:`text-subtle`,"data-tp-part":`tool-time`,children:nR(e.ran)},`ran`),e.failed&&(0,U.jsx)(`span`,{className:`flex-none text-error`,children:V(`transcript.failed`)},`failed`)]}),o={"data-tp-part":`tool`,"data-tool":t.name.toLowerCase(),"data-failed":e.failed||void 0};return!t.full&&!r&&!i?(0,U.jsx)(`p`,{className:MI,title:`${t.name} ${t.summary}`,...o,children:a}):(0,U.jsxs)(`details`,{className:FI,open:n.open&&(r!==null||i!==null),...o,children:[(0,U.jsx)(`summary`,{className:II,"data-tp-part":`tool-line`,title:`${t.name} ${t.full??t.summary}`.slice(0,600),children:a}),t.full&&(0,U.jsx)(`pre`,{className:`m-0 mt-1 mb-1 max-h-60 overflow-auto rounded-sm border-hairline border-line bg-inset px-2.5 py-1.5 font-mono text-meta leading-[1.45] whitespace-pre-wrap text-muted wrap-anywhere`,"data-tp-part":`tool-full`,children:t.full}),r&&(0,U.jsx)(iR,{...r}),i&&(0,U.jsxs)(`pre`,{className:`m-0 mt-1 mb-1 max-h-60 overflow-auto rounded-sm border-hairline border-line bg-inset px-2.5 py-1.5 font-mono text-meta leading-[1.45] whitespace-pre-wrap text-muted wrap-anywhere`,"data-tp-part":`tool-output`,"data-failed":e.failed||void 0,children:[i.length>eR&&(0,U.jsxs)(`span`,{className:`text-subtle`,children:[`… +`,i.length-eR,`
91
+ `).map(e=>({kind:`add`,text:e}))],r=n.slice(0,nR);return(0,U.jsxs)(`pre`,{className:RI,"data-tp-part":`tool-edit`,children:[r.map((e,t)=>(0,U.jsxs)(`span`,{className:e.kind===`add`?zI:BI,"data-line":e.kind,children:[e.kind===`add`?`+ `:`- `,e.text,`
92
+ `]},t)),n.length>r.length&&(0,U.jsxs)(`span`,{className:`text-subtle`,children:[`… +`,n.length-r.length]})]})}function oR(e){let{tool:t,show:n}=e,r=n.edits?iR(t.input):null,i=n.output&&e.output?e.output.trimEnd().split(`
93
+ `):null,a=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:PI,"data-tp-part":`tool-name`,children:fL(t.name,e.needle)},`name`),(0,U.jsx)(`span`,{className:FI,"data-tp-part":`tool-arg`,children:fL(t.summary,e.needle)},`text`),n.duration&&e.ran!==void 0&&(0,U.jsx)(`span`,{className:`text-subtle`,"data-tp-part":`tool-time`,children:rR(e.ran)},`ran`),e.failed&&(0,U.jsx)(`span`,{className:`flex-none text-error`,children:V(`transcript.failed`)},`failed`)]}),o={"data-tp-part":`tool`,"data-tool":t.name.toLowerCase(),"data-failed":e.failed||void 0};return!t.full&&!r&&!i?(0,U.jsx)(`p`,{className:NI,title:`${t.name} ${t.summary}`,...o,children:a}):(0,U.jsxs)(`details`,{className:II,open:n.open&&(r!==null||i!==null),...o,children:[(0,U.jsx)(`summary`,{className:LI,"data-tp-part":`tool-line`,title:`${t.name} ${t.full??t.summary}`.slice(0,600),children:a}),t.full&&(0,U.jsx)(`pre`,{className:`m-0 mt-1 mb-1 max-h-60 overflow-auto rounded-sm border-hairline border-line bg-inset px-2.5 py-1.5 font-mono text-meta leading-[1.45] whitespace-pre-wrap text-muted wrap-anywhere`,"data-tp-part":`tool-full`,children:t.full}),r&&(0,U.jsx)(aR,{...r}),i&&(0,U.jsxs)(`pre`,{className:`m-0 mt-1 mb-1 max-h-60 overflow-auto rounded-sm border-hairline border-line bg-inset px-2.5 py-1.5 font-mono text-meta leading-[1.45] whitespace-pre-wrap text-muted wrap-anywhere`,"data-tp-part":`tool-output`,"data-failed":e.failed||void 0,children:[i.length>tR&&(0,U.jsxs)(`span`,{className:`text-subtle`,children:[`… +`,i.length-tR,`
94
94
  `]}),i.slice(-8).join(`
95
- `)]})]})}function oR({text:e}){return(0,U.jsx)(`p`,{className:BI,"data-tp-part":`thinking`,title:e.slice(0,600),children:e})}var sR=3e3,cR=15e3,lR=80,uR=2500,dR=new Map;function fR(e,t){let n=URL.createObjectURL(new Blob([t],{type:`text/markdown;charset=utf-8`})),r=document.createElement(`a`);r.href=n,r.download=e,r.click(),URL.revokeObjectURL(n)}var pR=e=>{let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})};function mR({url:e,name:t}){return(0,h.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(e.preventDefault(),B())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,U.jsx)(`div`,{className:XI,onMouseDown:e=>e.target===e.currentTarget&&B(),children:(0,U.jsx)(`dialog`,{open:!0,"aria-label":t,className:ZI,children:(0,U.jsx)(`img`,{src:e,alt:t,className:QI})})})}function hR({model:e,path:t}){let[n,r]=(0,h.useState)(null),[i,a]=(0,h.useState)(!1);(0,h.useEffect)(()=>{let n=!0;return e.client.request(`attachment.get`,{path:t}).then(e=>n&&r(e.base64),()=>n&&a(!0)),()=>{n=!1}},[e,t]);let o=bL(n,oI(`image`,t)),s=t.split(`/`).pop()??t;return i?(0,U.jsx)(`span`,{className:MI,children:t}):o?(0,U.jsx)(W,{variant:`row`,className:YI,title:s,onClick:()=>k.set((0,U.jsx)(mR,{url:o,name:s})),children:(0,U.jsx)(`img`,{src:o,alt:s,className:$I})}):(0,U.jsx)(`span`,{className:$I})}function gR(e){let{entry:t}=e,n=V(t.role===`user`?`transcript.you`:t.role===`assistant`?`transcript.agent`:`transcript.system`),r=Date.parse(t.at),i=t.tools.map((t,n)=>{let i=Date.parse(e.ended.get(t.callId)??``);return(0,U.jsx)(aR,{tool:t,failed:e.failed.has(t.callId),needle:e.needle,output:e.outputs.get(t.callId),ran:i>=r?i-r:void 0,show:e.show},n)}),a=(0,h.useMemo)(()=>VL(t.text),[t.text]),o=[...new Set([...a.images,...t.images??[]])],s=t.tools.filter(t=>e.failed.has(t.callId)).length;if(t.notice){let{kind:n,status:r,summary:i,details:a}=t.notice;return(0,U.jsxs)(`details`,{className:VI(e),"data-index":t.index,"data-tp-part":`notice`,"data-status":r,children:[(0,U.jsxs)(`summary`,{className:HI,children:[(0,U.jsx)(`span`,{className:UI,children:n}),r&&(0,U.jsx)(`span`,{className:GI(r),children:r}),(0,U.jsx)(`span`,{className:WI,children:dL(i,e.needle)}),(0,U.jsx)(`span`,{className:AI,children:pR(t.at)})]}),(0,U.jsx)(`pre`,{className:LI,children:a})]})}return(0,U.jsxs)(`article`,{className:DI(e),"data-index":t.index,"data-tp-part":`entry`,"data-role":t.role,children:[e.thinking&&(0,U.jsx)(oR,{text:e.thinking}),(0,U.jsxs)(`header`,{className:OI,"data-tp-part":`entry-head`,children:[(0,U.jsx)(`span`,{className:kI(t.role),"data-tp-part":`entry-who`,children:n}),(0,U.jsx)(`span`,{className:AI,"data-tp-part":`entry-time`,children:pR(t.at)}),(0,U.jsx)(W,{className:jI,"data-tp-part":`entry-copy`,onClick:e.onCopy,children:V(`transcript.copy`)})]}),a.text!==``&&(0,U.jsx)(`div`,{"data-tp-part":`entry-text`,children:(0,U.jsx)(_L,{source:a.text,needle:e.needle})}),o.length>0&&(0,U.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:o.map(t=>(0,U.jsx)(hR,{model:e.model,path:t},t))}),t.tools.length>1?(0,U.jsxs)(`details`,{className:KI,open:e.show.open||UL(t,e.needle),"data-tp-part":`tools-fold`,children:[(0,U.jsxs)(`summary`,{className:qI,"data-tp-part":`tools-summary`,children:[(0,U.jsx)(`span`,{className:JI,children:`›`}),V(`transcript.tools`,{count:t.tools.length}),s>0&&(0,U.jsx)(`span`,{className:`flex-none text-error`,children:V(`transcript.toolsFailed`,{count:s})})]}),i]}):i]})}var _R={};function vR({model:e,task:t,active:n,show:r=_R,bar:i=!0}){H();let a=$L(e,t.id,n),{state:o,streaming:s}=a,[c,l]=(0,h.useState)(``),[u,d]=(0,h.useState)(0),[f,p]=(0,h.useState)(null),m=(0,h.useRef)(null),g=(0,h.useRef)(!0),_=(0,h.useRef)(null),v=b(Aj),y=o.kind===`ready`?o:null,x=(0,h.useMemo)(()=>HL(y?.transcript.entries??[]),[y?.transcript]),S=y?.transcript.failed??new Set,C=y?.transcript.outputs??dR,w=y?.transcript.ended??dR,T=(0,h.useMemo)(()=>{let e=new Map;if(!r.thinking||!y)return e;for(let[t,n]of y.transcript.thoughts){let r=(x.find(e=>e.index>=t)??x.at(-1))?.index;r!==void 0&&e.set(r,e.has(r)?`${e.get(r)}\n${n.text}`:n.text)}return e},[r.thinking,y,x]),E=(0,h.useMemo)(()=>WL(x,c),[x,c]),D=E.length===0?0:Math.min(u,E.length-1),O=E[D]??null,k=e=>{g.current=!1,m.current?.querySelector(`[data-index="${e}"]`)?.scrollIntoView({block:`center`})},A=t.rowStatus?.kind,j=A===`running`||A===`needs-input`,{refresh:ee}=a;(0,h.useEffect)(()=>{n&&ee()},[n,A,ee]),(0,h.useEffect)(()=>{if(!n||!j)return;let e=setInterval(()=>void ee(),s?cR:sR);return()=>clearInterval(e)},[n,j,ee,s]),(0,h.useLayoutEffect)(()=>{let e=m.current;e&&(_.current?(e.scrollTop=_.current.top+(e.scrollHeight-_.current.height),_.current=null):g.current&&(e.scrollTop=e.scrollHeight))},[x]);let te=async()=>{let e=m.current;e&&(_.current={height:e.scrollHeight,top:e.scrollTop}),await a.loadOlder()};(0,h.useEffect)(()=>{if(!v||v.taskId!==t.id||!y||!n)return;let e=KL(x,v.hit);e===null?y.older&&qL(x,v.hit)?te():Aj.set(null):(p(e),k(e),Aj.set(null))},[v,y,x,n,t.id]),(0,h.useEffect)(()=>{if(f===null)return;let e=setTimeout(()=>p(null),uR);return()=>clearTimeout(e)},[f]),(0,h.useEffect)(()=>{d(0);let e=WL(x,c)[0];e!==void 0&&k(e)},[c]);let M=e=>{if(E.length===0)return;let t=(D+e+E.length)%E.length;d(t),k(E[t])},ne=e=>{e.key===`Enter`&&!e.nativeEvent.isComposing?(e.preventDefault(),M(e.shiftKey?-1:1)):e.key===`Escape`&&c!==``&&(e.stopPropagation(),l(``))},N=e=>void navigator.clipboard.writeText(YL(e,S)).then(()=>z(V(`transcript.copied`)),()=>z(V(`menu.copyFailed`),`error`)),P=async()=>{let e=await a.loadAll();if(!e)return;let n={user:V(`transcript.you`),assistant:V(`transcript.agent`),system:V(`transcript.system`)};fR(`${t.label.replace(/[^\p{L}\p{N}]+/gu,`-`).replace(/^-|-$/g,``)||`conversation`}.md`,XL(t.label,HL(e.entries),e.failed,n))};return o.kind===`loading`?(0,U.jsx)(`div`,{className:SI,children:(0,U.jsx)(`p`,{className:TI,children:V(`transcript.loading`)})}):o.kind===`error`?(0,U.jsxs)(`div`,{className:SI,children:[(0,U.jsx)(`p`,{className:`${TI} text-error`,children:V(`transcript.error`,{error:o.message})}),(0,U.jsx)(`p`,{className:TI,children:(0,U.jsx)(W,{onClick:a.reload,children:V(`transcript.retry`)})})]}):o.kind===`terminal`?(0,U.jsxs)(`div`,{className:SI,children:[(0,U.jsx)(`p`,{className:TI,children:V(`transcript.noHistory`)}),(0,U.jsx)(`pre`,{className:`${EI} min-h-0 flex-1 overflow-y-auto`,children:o.tail.join(`
96
- `)})]}):(0,U.jsxs)(`div`,{className:SI,"data-tp-part":`transcript`,"data-live":j||void 0,children:[i&&(0,U.jsxs)(`div`,{className:`flex flex-none flex-wrap items-center gap-x-3 gap-y-1 px-3 pb-1.5 font-mono text-meta`,"data-tp-part":`transcript-bar`,children:[(0,U.jsx)(`input`,{className:`${Zr} min-w-0 flex-1 basis-32 py-1 text-meta`,value:c,placeholder:V(`transcript.findPlaceholder`),"aria-label":V(`transcript.findPlaceholder`),spellCheck:!1,autoComplete:`off`,onChange:e=>l(e.target.value),onKeyDown:ne}),c.trim()!==``&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:`whitespace-nowrap text-muted`,children:E.length===0?V(`transcript.findNone`):V(`transcript.findCount`,{at:D+1,total:E.length})}),(0,U.jsx)(W,{onClick:()=>M(-1),disabled:E.length===0,children:V(`transcript.prev`)}),(0,U.jsx)(W,{onClick:()=>M(1),disabled:E.length===0,children:V(`transcript.next`)})]}),(0,U.jsx)(W,{onClick:()=>void P(),disabled:x.length===0,children:V(`transcript.export`)})]}),(0,U.jsxs)(`div`,{ref:m,className:wI,"data-tp-part":`transcript-thread`,onScroll:e=>{let t=e.currentTarget;g.current=t.scrollHeight-t.scrollTop-t.clientHeight<lR,t.scrollTop<lR&&y?.older&&!a.paging&&te()},children:[y?.older&&(0,U.jsx)(`p`,{className:`m-0 px-3 py-2 font-mono text-meta text-subtle`,children:(0,U.jsx)(W,{onClick:()=>void te(),disabled:a.paging,children:V(`transcript.older`)})}),x.length===0&&(0,U.jsx)(`p`,{className:`m-0 px-3 py-2 font-mono text-meta text-subtle`,children:V(`transcript.empty`)}),x.map(t=>(0,U.jsx)(gR,{model:e,entry:t,failed:S,outputs:C,ended:w,thinking:T.get(t.index),show:r,needle:c,flash:f===t.index,current:O===t.index,onCopy:()=>N(t)},t.index))]})]})}var yR=y(null),bR=(0,h.createContext)(null);function xR(e){let t=b(yR),n=b(t?.tabs??SR);if(!t)return null;let r=t.engineTarget(e.taskId).tabId??n[e.taskId]?.find(e=>e.kind===`engine`)?.id;return r?(0,U.jsx)(tI,{model:t,taskId:e.taskId,tabId:r,inPackage:{placeholder:e.placeholder,sendLabel:e.sendLabel}}):null}var SR=y({});function CR(e){H();let t=t=>{t.key===`Escape`&&e.value!==``&&(t.stopPropagation(),e.onChange(``))},n=e.label??e.placeholder??V(`rail.searchPlaceholder`);return(0,U.jsx)(`input`,{className:Zr,"data-tp-part":`search`,type:`text`,value:e.value,placeholder:e.placeholder??V(`rail.searchPlaceholder`),"aria-label":n,spellCheck:!1,autoComplete:`off`,autoCapitalize:`off`,enterKeyHint:`search`,onChange:t=>e.onChange(t.target.value),onKeyDown:t})}function wR(){return(0,h.useContext)(bR)}function TR(e){let t=b(yR),n=b(t?.tasks??ER),r=t?_s(n,e.taskId):void 0;return!t||!r?null:(0,U.jsx)(vR,{model:t,task:r,active:!0,show:e.show,bar:e.bar??!1})}var ER=y(null);function DR({decision:e,sendLabel:t}){H();let[n,r]=(0,h.useState)(!1),[i,a]=(0,h.useState)(``),o=t=>{r(!0),e.onAnswer(t)};return(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,"data-tp-part":`decision`,"data-answered":n||void 0,children:[e.options.map(t=>(0,U.jsx)(W,{variant:t.key===e.recommended?`filled`:`action`,"data-tp-part":`decision-option`,"data-recommended":t.key===e.recommended||void 0,title:t.detail,disabled:n,onClick:()=>o({option:t.key}),children:t.label},t.key)),e.options.length===0&&(0,U.jsxs)(`form`,{className:`flex min-w-0 flex-1 items-center gap-2`,onSubmit:e=>{e.preventDefault(),i.trim()&&o({text:i.trim()})},children:[(0,U.jsx)(`input`,{className:Zr,"data-tp-part":`decision-input`,value:i,disabled:n,"aria-label":e.question,onChange:e=>a(e.target.value)}),(0,U.jsx)(W,{variant:`action`,type:`submit`,"data-tp-part":`decision-option`,disabled:n||!i.trim(),children:t??V(`inbox.gateAnswer`)})]})]})}var OR={Composer:xR,SearchField:CR,Terminal:wR,Transcript:TR,Decision:DR},kR=y({loaded:!1,dir:``,activeId:null,activePack:null,packs:[],loadErrors:[],slotComponents:{},runtimeErrors:[],disabledByCrash:!1}),AR=y({}),jR=String(Date.now());function MR(){return AR.get()}function NR(){return b(AR)}function PR(){let e=globalThis;e.__ROVE_THEME_HOST__||=Object.freeze({React:h,jsxRuntime:U,ui:Object.freeze({Button:W,Chip:Px,StatusDots:U_,EngineIcon:Ev,Chevron:Bv,...OR}),getTokens:MR,useTokens:NR})}PR();var FR=``,IR={};async function LR(e){if(!e.hasComponents||!e.bundleUrl)return{slots:{}};let t=`${e.id}@${e.fingerprint}`;if(FR===t)return{slots:IR};PR();let n=e.bundleUrl.includes(`?`)?`&`:`?`,r=`${e.bundleUrl}${n}boot=${jR}`;try{let n=await Wc(()=>import(r),[]);if(!n||typeof n.slots!=`object`||n.slots===null)return{slots:{},error:{packId:e.id,phase:`import`,file:e.bundleUrl,message:`theme bundle exported no slots map`,timestamp:Date.now()}};let i=n.slots,a={};for(let[t,n]of Object.entries(i)){if(typeof n!=`function`){let n=e.manifest.slots?.[t];return{slots:{},error:{packId:e.id,phase:`import`,slot:t,file:n?.component??e.bundleUrl,message:`slot "${t}" export "${n?.export??`default`}" is not a React component function`,timestamp:Date.now()}}}a[t]=n}return FR=t,IR=a,{slots:IR}}catch(t){return{slots:{},error:{packId:e.id,phase:`import`,file:e.bundleUrl,message:t instanceof Error?t.message:String(t),stack:t instanceof Error?t.stack:void 0,timestamp:Date.now()}}}}async function RR(e){let t=e.active,n=e.errors.find(e=>e.id===t),r=e.packs.find(e=>e.id===t)??null;if(!t||!r){FR=``,IR={},kR.set({loaded:!0,dir:e.dir,activeId:t,activePack:null,packs:e.packs,loadErrors:e.errors,slotComponents:{},runtimeErrors:t&&n?[{packId:t,phase:`manifest`,file:n.file,slot:n.slot,message:n.message,issues:n.issues,timestamp:Date.now()}]:[],disabledByCrash:!1});return}if(r.bundleError){let n=r.bundleError.line?`:${r.bundleError.line}`:``;kR.set({loaded:!0,dir:e.dir,activeId:t,activePack:null,packs:e.packs,loadErrors:e.errors,slotComponents:{},runtimeErrors:[{packId:t,phase:`bundle`,file:`${r.bundleError.file}${n}`,slot:r.bundleError.slot,message:r.bundleError.message,timestamp:Date.now()}],disabledByCrash:!1});return}let i=await LR(r);if(i.error){kR.set({loaded:!0,dir:e.dir,activeId:t,activePack:null,packs:e.packs,loadErrors:e.errors,slotComponents:{},runtimeErrors:[i.error],disabledByCrash:!1});return}let a=kR.get(),o=a.activePack?.id===r.id&&a.activePack?.fingerprint===r.fingerprint,s=o?a.runtimeErrors.filter(e=>e.packId===r.id&&(e.phase===`render`||e.phase===`shell`)):[];kR.set({loaded:!0,dir:e.dir,activeId:t,activePack:o&&a.disabledByCrash?null:r,packs:e.packs,loadErrors:e.errors,slotComponents:o&&a.disabledByCrash?{}:i.slots,runtimeErrors:s,disabledByCrash:o?a.disabledByCrash:!1})}async function zR(e){await RR(await e.request(`theme.packages`))}async function BR(e){await Iw(e,`theme`,BF),await zR(e)}function VR(e,t,n,r,i){let a=kR.get(),o=[r.stack,i].filter(Boolean).join(`
97
- `);a.runtimeErrors.some(n=>n.packId===e&&n.slot===t&&n.phase===`render`&&n.message===r.message)||kR.set({...a,runtimeErrors:[...a.runtimeErrors,{packId:e,phase:`render`,slot:t,file:n,message:r.message,stack:o,timestamp:Date.now()}]})}function HR(e,t){let n=kR.get(),r=[e.stack,t].filter(Boolean).join(`
98
- `);kR.set({...n,activePack:null,slotComponents:{},disabledByCrash:!0,runtimeErrors:[...n.runtimeErrors,{packId:n.activeId??``,phase:`shell`,message:e.message,stack:r,timestamp:Date.now()}]})}function UR(){return b(kR)}function WR(){let e=b(kR);return e.disabledByCrash?null:e.activePack}var GR=`flex flex-wrap items-center gap-2 border-b-hairline border-error bg-surface px-3 py-1.5 font-mono text-meta text-ink`,KR=`rounded-xs bg-error px-1.5 py-0.5 font-semibold text-paper`,qR=`min-w-0 flex-1 truncate text-error`,JR=`ml-auto flex flex-none items-center gap-2`,YR=`flex w-full min-w-0 flex-col gap-0.5 rounded-sm px-2.5 py-1.5 text-left transition-colors`,XR=`flex min-w-0 items-center gap-1.5 text-title text-ink`,ZR=`inline-flex items-center gap-1 rounded-xs bg-inset px-1.5 py-0.5 font-mono text-meta text-muted`,QR=`rounded-md border-hairline border-line bg-surface overflow-hidden`;function $R(e){return e===`cards`?`bg-paper p-[var(--tp-shell-pad,8px)] gap-[var(--tp-pane-gap,8px)]`:``}function ez(e){return e===`cards`?QR:``}function tz(e){return e===`compact`?`min-h-6 py-0.5 px-2`:e===`spacious`?`min-h-11 py-2 px-3`:`min-h-8 py-1.25 px-2.5`}function nz(e,t){return e===`surface`?t?`bg-menu border-hairline border-accent`:`bg-surface border-hairline border-line hover:bg-hover`:e===`inset`?t?`bg-menu border-hairline border-accent`:`bg-inset hover:bg-hover`:e===`accentSoft`?t?`bg-accent-soft border-hairline border-accent`:`bg-accent-soft/60 hover:bg-accent-soft`:e===`paper`?t?`bg-menu`:`bg-paper hover:bg-hover`:e===`sidebar`?t?`bg-menu`:`bg-sidebar hover:bg-hover`:e===`engineTint`?t?`border-hairline border-accent bg-[color-mix(in_srgb,var(--tp-engine-color,var(--accent))_22%,var(--surface))]`:`border-hairline border-line bg-[color-mix(in_srgb,var(--tp-engine-color,var(--surface))_11%,var(--surface))] hover:bg-[color-mix(in_srgb,var(--tp-engine-color,var(--surface))_17%,var(--surface))]`:t?`bg-menu`:`hover:bg-hover`}function rz(e){return e===`card`?`rounded-md mb-1`:e===`pill`?`rounded-full px-3`:e===`compact`?`rounded-xs py-0.5`:e===`minimal`?`rounded-none px-1.5`:`rounded-sm`}var iz=`col-span-full flex min-w-0 items-center gap-3 border-t-hairline border-line bg-surface px-3 py-1 font-mono text-meta whitespace-nowrap text-muted`,az=`flex min-w-0 items-center justify-between gap-2 border-b-hairline border-line bg-surface px-2.5 py-1.5 font-mono text-meta text-ink`;function oz({model:e}){H();let t=UR(),n=t.runtimeErrors[t.runtimeErrors.length-1]??null;return(0,U.jsxs)(U.Fragment,{children:[t.packs.length>0&&(0,U.jsx)(`p`,{className:`text-meta text-muted [&_a]:text-accent m-0`,children:V(`settings.appearance.themePackageNote`)}),n&&(0,U.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-sm border-hairline border-error bg-inset p-3 font-mono text-meta text-ink`,"data-theme-package-last-error":!0,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,U.jsxs)(`span`,{className:`font-semibold text-error`,children:[V(`settings.appearance.themeLastError`,{theme:n.packId}),n.slot?` · ${n.slot}`:``,n.file?` (${n.file})`:``]}),(0,U.jsx)(W,{variant:`action`,onClick:()=>void BR(e.client),children:V(`settings.appearance.themeSwitchDefault`)})]}),(0,U.jsx)(`p`,{className:`m-0 text-ink`,children:n.message}),n.stack&&(0,U.jsx)(`pre`,{className:`m-0 max-h-40 overflow-auto whitespace-pre-wrap break-all rounded-xs bg-paper p-2 font-mono text-meta text-muted`,children:n.stack})]}),t.loadErrors.length>0&&(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,"data-theme-package-load-errors":!0,children:[(0,U.jsx)(`span`,{className:`text-meta text-muted [&_a]:text-accent`,children:V(`settings.appearance.themeInvalidHeading`)}),t.loadErrors.map(e=>(0,U.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-sm border-hairline border-error bg-inset p-3 font-mono text-meta text-ink`,children:[(0,U.jsxs)(`span`,{className:`font-semibold text-error`,children:[e.id,` · `,e.file,e.slot?` (${e.slot})`:``]}),e.issues&&e.issues.length>0?(0,U.jsx)(`ul`,{className:`m-0 list-disc pl-4 text-ink`,children:e.issues.map(e=>(0,U.jsxs)(`li`,{children:[e.path?`${e.path}: `:``,e.message]},`${e.path}:${e.message}`))}):(0,U.jsx)(`span`,{className:`text-ink`,children:e.message})]},e.id))]})]})}var sz=y(null);function cz({theme:e,mode:t}){let n=e[t],r=(e,t)=>({background:e,width:t});return(0,U.jsxs)(`span`,{className:FN,style:{background:n.background,borderColor:n.border},"aria-hidden":!0,children:[(0,U.jsxs)(`span`,{className:IN,style:{background:n.backgroundPanel},children:[(0,U.jsx)(`span`,{className:RN,style:r(n.primary,`70%`)}),(0,U.jsx)(`span`,{className:RN,style:r(n.textMuted,`85%`)}),(0,U.jsx)(`span`,{className:RN,style:r(n.textMuted,`55%`)})]}),(0,U.jsxs)(`span`,{className:LN,children:[(0,U.jsx)(`span`,{className:RN,style:r(n.text,`90%`)}),(0,U.jsx)(`span`,{className:RN,style:r(n.textMuted,`65%`)}),(0,U.jsx)(`span`,{className:RN,style:r(n.accent??n.primary,`40%`)}),(0,U.jsx)(`span`,{className:zN,children:[n.success,n.warning,n.error,n.info].map((e,t)=>(0,U.jsx)(`span`,{className:BN,style:{background:e}},t))})]})]})}function lz(e){return(0,U.jsxs)(W,{variant:`card`,title:e.title,"aria-pressed":e.active,className:PN(e.active),onMouseEnter:()=>zF.set(e.theme),onFocus:()=>zF.set(e.theme),onClick:e.onClick,children:[(0,U.jsx)(cz,{theme:e.theme,mode:e.mode}),(0,U.jsxs)(`span`,{className:VN,children:[(0,U.jsx)(`span`,{className:`truncate text-ink`,children:e.label??e.theme.name}),e.tag&&(0,U.jsx)(`span`,{className:`text-subtle`,children:e.tag})]})]})}function uz({children:e}){return(0,U.jsx)(`div`,{className:MN,onMouseLeave:()=>zF.set(null),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||zF.set(null)},children:e})}function dz(e){let{model:t}=e,{client:n}=t,r=b(sz),[i,a]=(0,h.useState)([]),[o,s]=(0,h.useState)(null),[c,l]=(0,h.useState)(null),[u,d]=(0,h.useState)(null),[f,p]=(0,h.useState)(null),[m,g]=(0,h.useState)(!1),[_,v]=(0,h.useState)(!1),y=Oe(),x=new Map(UR().packs.map(e=>[e.id,e]));(0,h.useEffect)(()=>()=>zF.set(null),[]),(0,h.useEffect)(()=>void Fw(n).catch(()=>void 0),[n]),(0,h.useEffect)(()=>{let e=!0;return n.request(`theme.terminals`).then(t=>{e&&a(t.terminals)},()=>{e&&a([])}),()=>{e=!1}},[n]),(0,h.useEffect)(()=>{sz.get()===null&&n.request(`theme.hosted`).then(e=>sz.set(e),()=>sz.set({themes:[],dir:null}))},[n]);let S=e=>{g(!1),uj(t,V(`prefs.themeAgentPrompt`,{dir:e})).catch(()=>g(!0))},C=r?.dir??null,w=async e=>{s(e),l(null);try{await n.request(`theme.install`,{name:e}),await Fw(n),await Iw(n,`theme`,e)}catch{l(e)}finally{s(null)}},T=async e=>{d(e.id),p(null);try{let t=await n.request(`theme.importTerminal`,{terminal:e.id});await Fw(n),await Iw(n,`theme`,t.name),a(t=>t.map(t=>t.id===e.id?{...t,installed:!0}:t))}catch{p(e.id)}finally{d(null)}},E=new Set(e.themes.map(e=>e.name)),D=(r?.themes??[]).filter(e=>!E.has(e.name));return(0,U.jsxs)(QN,{settingId:`appearance.theme`,label:e.label,hint:V(`prefs.themePreviewHint`),stack:!0,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:NN,children:V(`prefs.themeInstalled`)}),(0,U.jsx)(uz,{children:e.themes.map(t=>(0,U.jsx)(lz,{theme:t,mode:e.mode,active:t.name===e.value,title:[t.name,x.get(t.name)?.manifest.description].filter(Boolean).join(`: `),tag:x.has(t.name)?V(`prefs.themePackage`):t.bundled?void 0:V(`prefs.themeUser`),onClick:()=>t.name!==e.value&&void Iw(n,`theme`,t.name)},t.name))})]}),(0,U.jsx)(oz,{model:t}),i.length>0&&(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`m-0 pb-1.5 text-meta font-medium text-subtle`,children:V(`prefs.themeTerminals`)}),(0,U.jsx)(`p`,{className:`text-meta text-muted [&_a]:text-accent m-0 pb-2`,children:V(`prefs.themeTerminalsHint`)}),(0,U.jsx)(uz,{children:i.map(t=>(0,U.jsx)(lz,{theme:t,label:t.label,title:t.fontFamily?`${t.configPath} · ${t.fontFamily}`:t.configPath,mode:e.mode,active:!1,tag:u===t.id?V(`prefs.themeImporting`):f===t.id?V(`prefs.themeImportFailed`):E.has(t.name)?V(`prefs.themeSync`):V(`prefs.themeImport`),onClick:()=>u===null&&void T(t)},t.id))})]}),D.length>0&&(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(W,{className:y?`flex min-h-11 w-full items-center gap-3 text-left`:`inline-flex items-center gap-1.5`,"aria-expanded":_,onClick:()=>v(!_),children:[!y&&(0,U.jsx)(Bv,{right:!_}),_?V(`prefs.themeHide`):V(`prefs.themeBrowse`,{count:D.length}),y&&(0,U.jsx)(Bv,{right:!_,className:`ml-auto block text-subtle`})]}),_&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`m-0 pb-1.5 text-meta font-medium text-subtle mt-2.5`,children:V(`prefs.themeMoreHint`)}),(0,U.jsx)(uz,{children:D.map(t=>(0,U.jsx)(lz,{theme:t,mode:e.mode,active:!1,title:[t.name,t.description].filter(Boolean).join(`: `),tag:o===t.name?V(`prefs.themeInstalling`):c===t.name?V(`prefs.themeInstallFailed`):t.package?V(`prefs.themePackage`):V(`prefs.themeGet`),onClick:()=>o===null&&void w(t.name)},t.name))})]})]}),C&&(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2.5`,children:[(0,U.jsx)(W,{variant:`action`,onClick:()=>S(C),children:V(`prefs.themeAgent`)}),(0,U.jsx)(`span`,{className:`text-meta text-muted [&_a]:text-accent`,children:V(m?`prefs.themeAgentFailed`:`prefs.themeAgentHint`)})]})]})}var fz=y({}),pz=``,mz=`(prefers-color-scheme: dark)`;function hz(e){let t=window.matchMedia(mz);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)}function gz(){return(0,h.useSyncExternalStore)(hz,()=>window.matchMedia(mz).matches,()=>!0)}function _z(){let e=gz();return vF(Rw().prefs.themeMode,e)}function vz(e){let t=_z(),n=Rw();(0,h.useEffect)(()=>{if(!n.loaded||n.prefs.taskColors!==`on`)return;let r=`${n.prefs.theme}/${t}`;r!==pz&&(pz=r,fz.set({}));let i=()=>{let i=fz.get(),a=e.tasks.get(),o=[...a?.tasks??[],...a?.archived??[]].map(e=>e.id).filter(e=>!(e in i));o.length!==0&&e.client.request(`theme.taskColors`,{theme:n.prefs.theme,mode:t,taskIds:o}).then(e=>{pz===r&&fz.set({...fz.get(),...e.colors})}).catch(()=>void 0)};return i(),e.tasks.subscribe(i)},[e,t,n.loaded,n.prefs.taskColors,n.prefs.theme])}function yz(e){let t=Rw(),n=b(fz);return e&&t.prefs.taskColors===`on`?n[e]:void 0}var bz={themeMode:{dark:`appearance.modeDark`,light:`appearance.modeLight`,auto:`appearance.modeAuto`},focusAccent:{primary:`general.accentPrimary`,success:`general.accentSuccess`,info:`general.accentInfo`},splitStyle:{box:`general.splitBox`,line:`general.splitLine`,rail:`general.splitRail`,rule:`general.splitRule`},railFold:{glyphs:`general.railFoldGlyphs`,initials:`general.railFoldInitials`,hairline:`general.railFoldHairline`},workingBorder:{flow:`appearance.borderFlow`,still:`appearance.borderStill`},runningTitle:{shimmer:`appearance.titleShimmer`,still:`appearance.titleStill`}},xz={engine:`settings.appearance.statusMarkEngine`,both:`settings.appearance.statusMarkBoth`,dots:`settings.appearance.statusMarkDots`};function Sz({model:e}){let{client:t}=e,n=Rw(),r=_z(),i=b(gk),a=Vw(),o=(e,n)=>void Iw(t,e,n),s=(e,t,r,i)=>(0,U.jsx)(iP,{settingId:`appearance.${e}`,label:Q(t),hint:r,sample:i,value:n.prefs[e],picks:zw(n,e).map(t=>({value:t,label:e===`themeMode`&&t===`auto`?V(`prefs.modeAuto`):Q(bz[e]?.[String(t)]??String(t))})),onPick:t=>o(e,t)}),c=(e,t,r)=>(0,U.jsx)($N,{settingId:`appearance.${e}`,label:Q(t),hint:r,checked:n.prefs[e]===`on`,onChange:t=>o(e,t?`on`:`off`)});return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(ZN,{children:[(0,U.jsx)(dz,{model:e,label:Q(`general.theme`),themes:n.themes,value:n.prefs.theme,mode:r}),s(`themeMode`,`general.themeMode`)]}),(0,U.jsxs)(ZN,{title:V(`settings.appearance.groupColours`),children:[s(`focusAccent`,`general.focusAccent`,Q(`general.focusAccentHint`)),c(`taskColors`,`general.taskColors`,V(`settings.appearance.taskColorsNote`)),c(`colorblind`,`general.colorblind`,V(`settings.appearance.colorblindNote`))]}),(0,U.jsxs)(ZN,{title:V(`settings.appearance.groupTasks`),children:[s(`workingBorder`,`general.workingBorder`,V(`settings.appearance.workingBorderNote`),(0,U.jsx)(_F,{})),s(`runningTitle`,`general.runningTitle`,void 0,(0,U.jsx)(gF,{})),s(`splitStyle`,`general.splitStyle`),s(`railFold`,`general.railFold`,Q(`general.railFoldHint`)),(0,U.jsx)(iP,{settingId:`appearance.railGroup`,label:V(`settings.appearance.railGroup`),value:i,picks:mk.map(e=>({value:e,label:V(e===`state`?`settings.appearance.railGroupState`:`settings.appearance.railGroupProject`)})),onPick:vk}),(0,U.jsx)(iP,{settingId:`appearance.statusMark`,label:V(`settings.appearance.statusMark`),sample:(0,U.jsx)(hF,{model:e}),value:a,picks:Bw.map(e=>({value:e,label:V(xz[e])})),onPick:e=>Hw(t,e)})]})]})}function Cz(e,t,n){if(t===`offline`)return`offline`;if(t===`unsupported`||t===`mismatch`)return`outdated`;if(!e)return`loading`;let r=e.status;return r?r.gh?r.account?r.account===n?`same`:`different`:`signedOut`:`noGh`:e.reason===`failed`||!e.reason?`failed`:e.reason}var wz=e=>e===``?{}:{machine:e},Tz=2e3,Ez=e=>e?.login?.state===`pending`||e?.login?.state===`syncing`;function Dz(e){let{client:t}=e,n=Cg(e),[r,i]=(0,h.useState)({}),[a,o]=(0,h.useState)(!1),s=(0,h.useMemo)(()=>{let e={};for(let i of[``,...n.map(e=>e.alias)]){let n=r[i]??J(t,`github.status`,wz(i));n&&(e[i]=n)}return e},[r,n,t]),c=n.flatMap(e=>e.state===`online`?[e.alias]:[]).join(`
95
+ `)]})]})}function sR({text:e}){return(0,U.jsx)(`p`,{className:VI,"data-tp-part":`thinking`,title:e.slice(0,600),children:e})}var cR=3e3,lR=15e3,uR=80,dR=2500,fR=new Map;function pR(e,t){let n=URL.createObjectURL(new Blob([t],{type:`text/markdown;charset=utf-8`})),r=document.createElement(`a`);r.href=n,r.download=e,r.click(),URL.revokeObjectURL(n)}var mR=e=>{let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})};function hR({url:e,name:t}){return(0,h.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(e.preventDefault(),B())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,U.jsx)(`div`,{className:ZI,onMouseDown:e=>e.target===e.currentTarget&&B(),children:(0,U.jsx)(`dialog`,{open:!0,"aria-label":t,className:QI,children:(0,U.jsx)(`img`,{src:e,alt:t,className:$I})})})}function gR({model:e,path:t}){let[n,r]=(0,h.useState)(null),[i,a]=(0,h.useState)(!1);(0,h.useEffect)(()=>{let n=!0;return e.client.request(`attachment.get`,{path:t}).then(e=>n&&r(e.base64),()=>n&&a(!0)),()=>{n=!1}},[e,t]);let o=xL(n,sI(`image`,t)),s=t.split(`/`).pop()??t;return i?(0,U.jsx)(`span`,{className:NI,children:t}):o?(0,U.jsx)(W,{variant:`row`,className:XI,title:s,onClick:()=>k.set((0,U.jsx)(hR,{url:o,name:s})),children:(0,U.jsx)(`img`,{src:o,alt:s,className:eL})}):(0,U.jsx)(`span`,{className:eL})}function _R(e){let{entry:t}=e,n=V(t.role===`user`?`transcript.you`:t.role===`assistant`?`transcript.agent`:`transcript.system`),r=Date.parse(t.at),i=t.tools.map((t,n)=>{let i=Date.parse(e.ended.get(t.callId)??``);return(0,U.jsx)(oR,{tool:t,failed:e.failed.has(t.callId),needle:e.needle,output:e.outputs.get(t.callId),ran:i>=r?i-r:void 0,show:e.show},n)}),a=(0,h.useMemo)(()=>HL(t.text),[t.text]),o=[...new Set([...a.images,...t.images??[]])],s=t.tools.filter(t=>e.failed.has(t.callId)).length;if(t.notice){let{kind:n,status:r,summary:i,details:a}=t.notice;return(0,U.jsxs)(`details`,{className:HI(e),"data-index":t.index,"data-tp-part":`notice`,"data-status":r,children:[(0,U.jsxs)(`summary`,{className:UI,children:[(0,U.jsx)(`span`,{className:WI,children:n}),r&&(0,U.jsx)(`span`,{className:KI(r),children:r}),(0,U.jsx)(`span`,{className:GI,children:fL(i,e.needle)}),(0,U.jsx)(`span`,{className:jI,children:mR(t.at)})]}),(0,U.jsx)(`pre`,{className:RI,children:a})]})}return(0,U.jsxs)(`article`,{className:OI(e),"data-index":t.index,"data-tp-part":`entry`,"data-role":t.role,children:[e.thinking&&(0,U.jsx)(sR,{text:e.thinking}),(0,U.jsxs)(`header`,{className:kI,"data-tp-part":`entry-head`,children:[(0,U.jsx)(`span`,{className:AI(t.role),"data-tp-part":`entry-who`,children:n}),(0,U.jsx)(`span`,{className:jI,"data-tp-part":`entry-time`,children:mR(t.at)}),(0,U.jsx)(W,{className:MI,"data-tp-part":`entry-copy`,onClick:e.onCopy,children:V(`transcript.copy`)})]}),a.text!==``&&(0,U.jsx)(`div`,{"data-tp-part":`entry-text`,children:(0,U.jsx)(vL,{source:a.text,needle:e.needle})}),o.length>0&&(0,U.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:o.map(t=>(0,U.jsx)(gR,{model:e.model,path:t},t))}),t.tools.length>1?(0,U.jsxs)(`details`,{className:qI,open:e.show.open||WL(t,e.needle),"data-tp-part":`tools-fold`,children:[(0,U.jsxs)(`summary`,{className:JI,"data-tp-part":`tools-summary`,children:[(0,U.jsx)(`span`,{className:YI,children:`›`}),V(`transcript.tools`,{count:t.tools.length}),s>0&&(0,U.jsx)(`span`,{className:`flex-none text-error`,children:V(`transcript.toolsFailed`,{count:s})})]}),i]}):i]})}var vR={};function yR({model:e,task:t,active:n,show:r=vR,bar:i=!0}){H();let a=eR(e,t.id,n),{state:o,streaming:s}=a,[c,l]=(0,h.useState)(``),[u,d]=(0,h.useState)(0),[f,p]=(0,h.useState)(null),m=(0,h.useRef)(null),g=(0,h.useRef)(!0),_=(0,h.useRef)(null),v=b(jj),y=o.kind===`ready`?o:null,x=(0,h.useMemo)(()=>UL(y?.transcript.entries??[]),[y?.transcript]),S=y?.transcript.failed??new Set,C=y?.transcript.outputs??fR,w=y?.transcript.ended??fR,T=(0,h.useMemo)(()=>{let e=new Map;if(!r.thinking||!y)return e;for(let[t,n]of y.transcript.thoughts){let r=(x.find(e=>e.index>=t)??x.at(-1))?.index;r!==void 0&&e.set(r,e.has(r)?`${e.get(r)}\n${n.text}`:n.text)}return e},[r.thinking,y,x]),E=(0,h.useMemo)(()=>GL(x,c),[x,c]),D=E.length===0?0:Math.min(u,E.length-1),O=E[D]??null,k=e=>{g.current=!1,m.current?.querySelector(`[data-index="${e}"]`)?.scrollIntoView({block:`center`})},A=t.rowStatus?.kind,j=A===`running`||A===`needs-input`,{refresh:ee}=a;(0,h.useEffect)(()=>{n&&ee()},[n,A,ee]),(0,h.useEffect)(()=>{if(!n||!j)return;let e=setInterval(()=>void ee(),s?lR:cR);return()=>clearInterval(e)},[n,j,ee,s]),(0,h.useLayoutEffect)(()=>{let e=m.current;e&&(_.current?(e.scrollTop=_.current.top+(e.scrollHeight-_.current.height),_.current=null):g.current&&(e.scrollTop=e.scrollHeight))},[x]);let te=async()=>{let e=m.current;e&&(_.current={height:e.scrollHeight,top:e.scrollTop}),await a.loadOlder()};(0,h.useEffect)(()=>{if(!v||v.taskId!==t.id||!y||!n)return;let e=qL(x,v.hit);e===null?y.older&&JL(x,v.hit)?te():jj.set(null):(p(e),k(e),jj.set(null))},[v,y,x,n,t.id]),(0,h.useEffect)(()=>{if(f===null)return;let e=setTimeout(()=>p(null),dR);return()=>clearTimeout(e)},[f]),(0,h.useEffect)(()=>{d(0);let e=GL(x,c)[0];e!==void 0&&k(e)},[c]);let M=e=>{if(E.length===0)return;let t=(D+e+E.length)%E.length;d(t),k(E[t])},ne=e=>{e.key===`Enter`&&!e.nativeEvent.isComposing?(e.preventDefault(),M(e.shiftKey?-1:1)):e.key===`Escape`&&c!==``&&(e.stopPropagation(),l(``))},N=e=>void navigator.clipboard.writeText(XL(e,S)).then(()=>z(V(`transcript.copied`)),()=>z(V(`menu.copyFailed`),`error`)),P=async()=>{let e=await a.loadAll();if(!e)return;let n={user:V(`transcript.you`),assistant:V(`transcript.agent`),system:V(`transcript.system`)};pR(`${t.label.replace(/[^\p{L}\p{N}]+/gu,`-`).replace(/^-|-$/g,``)||`conversation`}.md`,ZL(t.label,UL(e.entries),e.failed,n))};return o.kind===`loading`?(0,U.jsx)(`div`,{className:CI,children:(0,U.jsx)(`p`,{className:EI,children:V(`transcript.loading`)})}):o.kind===`error`?(0,U.jsxs)(`div`,{className:CI,children:[(0,U.jsx)(`p`,{className:`${EI} text-error`,children:V(`transcript.error`,{error:o.message})}),(0,U.jsx)(`p`,{className:EI,children:(0,U.jsx)(W,{onClick:a.reload,children:V(`transcript.retry`)})})]}):o.kind===`terminal`?(0,U.jsxs)(`div`,{className:CI,children:[(0,U.jsx)(`p`,{className:EI,children:V(`transcript.noHistory`)}),(0,U.jsx)(`pre`,{className:`${DI} min-h-0 flex-1 overflow-y-auto`,children:o.tail.join(`
96
+ `)})]}):(0,U.jsxs)(`div`,{className:CI,"data-tp-part":`transcript`,"data-live":j||void 0,children:[i&&(0,U.jsxs)(`div`,{className:`flex flex-none flex-wrap items-center gap-x-3 gap-y-1 px-3 pb-1.5 font-mono text-meta`,"data-tp-part":`transcript-bar`,children:[(0,U.jsx)(`input`,{className:`${Zr} min-w-0 flex-1 basis-32 py-1 text-meta`,value:c,placeholder:V(`transcript.findPlaceholder`),"aria-label":V(`transcript.findPlaceholder`),spellCheck:!1,autoComplete:`off`,onChange:e=>l(e.target.value),onKeyDown:ne}),c.trim()!==``&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:`whitespace-nowrap text-muted`,children:E.length===0?V(`transcript.findNone`):V(`transcript.findCount`,{at:D+1,total:E.length})}),(0,U.jsx)(W,{onClick:()=>M(-1),disabled:E.length===0,children:V(`transcript.prev`)}),(0,U.jsx)(W,{onClick:()=>M(1),disabled:E.length===0,children:V(`transcript.next`)})]}),(0,U.jsx)(W,{onClick:()=>void P(),disabled:x.length===0,children:V(`transcript.export`)})]}),(0,U.jsxs)(`div`,{ref:m,className:TI,"data-tp-part":`transcript-thread`,onScroll:e=>{let t=e.currentTarget;g.current=t.scrollHeight-t.scrollTop-t.clientHeight<uR,t.scrollTop<uR&&y?.older&&!a.paging&&te()},children:[y?.older&&(0,U.jsx)(`p`,{className:`m-0 px-3 py-2 font-mono text-meta text-subtle`,children:(0,U.jsx)(W,{onClick:()=>void te(),disabled:a.paging,children:V(`transcript.older`)})}),x.length===0&&(0,U.jsx)(`p`,{className:`m-0 px-3 py-2 font-mono text-meta text-subtle`,children:V(`transcript.empty`)}),x.map(t=>(0,U.jsx)(_R,{model:e,entry:t,failed:S,outputs:C,ended:w,thinking:T.get(t.index),show:r,needle:c,flash:f===t.index,current:O===t.index,onCopy:()=>N(t)},t.index))]})]})}var bR=y(null),xR=(0,h.createContext)(null);function SR(e){let t=b(bR),n=b(t?.tabs??CR);if(!t)return null;let r=t.engineTarget(e.taskId).tabId??n[e.taskId]?.find(e=>e.kind===`engine`)?.id;return r?(0,U.jsx)(nI,{model:t,taskId:e.taskId,tabId:r,inPackage:{placeholder:e.placeholder,sendLabel:e.sendLabel}}):null}var CR=y({});function wR(e){H();let t=t=>{t.key===`Escape`&&e.value!==``&&(t.stopPropagation(),e.onChange(``))},n=e.label??e.placeholder??V(`rail.searchPlaceholder`);return(0,U.jsx)(`input`,{className:Zr,"data-tp-part":`search`,type:`text`,value:e.value,placeholder:e.placeholder??V(`rail.searchPlaceholder`),"aria-label":n,spellCheck:!1,autoComplete:`off`,autoCapitalize:`off`,enterKeyHint:`search`,onChange:t=>e.onChange(t.target.value),onKeyDown:t})}function TR(){return(0,h.useContext)(xR)}function ER(e){let t=b(bR),n=b(t?.tasks??DR),r=t?_s(n,e.taskId):void 0;return!t||!r?null:(0,U.jsx)(yR,{model:t,task:r,active:!0,show:e.show,bar:e.bar??!1})}var DR=y(null);function OR({decision:e,sendLabel:t}){H();let[n,r]=(0,h.useState)(!1),[i,a]=(0,h.useState)(``),o=t=>{r(!0),e.onAnswer(t)};return(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,"data-tp-part":`decision`,"data-answered":n||void 0,children:[e.options.map(t=>(0,U.jsx)(W,{variant:t.key===e.recommended?`filled`:`action`,"data-tp-part":`decision-option`,"data-recommended":t.key===e.recommended||void 0,title:t.detail,disabled:n,onClick:()=>o({option:t.key}),children:t.label},t.key)),e.options.length===0&&(0,U.jsxs)(`form`,{className:`flex min-w-0 flex-1 items-center gap-2`,onSubmit:e=>{e.preventDefault(),i.trim()&&o({text:i.trim()})},children:[(0,U.jsx)(`input`,{className:Zr,"data-tp-part":`decision-input`,value:i,disabled:n,"aria-label":e.question,onChange:e=>a(e.target.value)}),(0,U.jsx)(W,{variant:`action`,type:`submit`,"data-tp-part":`decision-option`,disabled:n||!i.trim(),children:t??V(`inbox.gateAnswer`)})]})]})}var kR={Composer:SR,SearchField:wR,Terminal:TR,Transcript:ER,Decision:OR},AR=y({loaded:!1,dir:``,activeId:null,activePack:null,packs:[],loadErrors:[],slotComponents:{},runtimeErrors:[],disabledByCrash:!1}),jR=y({}),MR=String(Date.now());function NR(){return jR.get()}function PR(){return b(jR)}function FR(){let e=globalThis;e.__ROVE_THEME_HOST__||=Object.freeze({React:h,jsxRuntime:U,ui:Object.freeze({Button:W,Chip:Px,StatusDots:U_,EngineIcon:Ev,Chevron:Bv,...kR}),getTokens:NR,useTokens:PR})}FR();var IR=``,LR={};async function RR(e){if(!e.hasComponents||!e.bundleUrl)return{slots:{}};let t=`${e.id}@${e.fingerprint}`;if(IR===t)return{slots:LR};FR();let n=e.bundleUrl.includes(`?`)?`&`:`?`,r=`${e.bundleUrl}${n}boot=${MR}`;try{let n=await Wc(()=>import(r),[]);if(!n||typeof n.slots!=`object`||n.slots===null)return{slots:{},error:{packId:e.id,phase:`import`,file:e.bundleUrl,message:`theme bundle exported no slots map`,timestamp:Date.now()}};let i=n.slots,a={};for(let[t,n]of Object.entries(i)){if(typeof n!=`function`){let n=e.manifest.slots?.[t];return{slots:{},error:{packId:e.id,phase:`import`,slot:t,file:n?.component??e.bundleUrl,message:`slot "${t}" export "${n?.export??`default`}" is not a React component function`,timestamp:Date.now()}}}a[t]=n}return IR=t,LR=a,{slots:LR}}catch(t){return{slots:{},error:{packId:e.id,phase:`import`,file:e.bundleUrl,message:t instanceof Error?t.message:String(t),stack:t instanceof Error?t.stack:void 0,timestamp:Date.now()}}}}async function zR(e){let t=e.active,n=e.errors.find(e=>e.id===t),r=e.packs.find(e=>e.id===t)??null;if(!t||!r){IR=``,LR={},AR.set({loaded:!0,dir:e.dir,activeId:t,activePack:null,packs:e.packs,loadErrors:e.errors,slotComponents:{},runtimeErrors:t&&n?[{packId:t,phase:`manifest`,file:n.file,slot:n.slot,message:n.message,issues:n.issues,timestamp:Date.now()}]:[],disabledByCrash:!1});return}if(r.bundleError){let n=r.bundleError.line?`:${r.bundleError.line}`:``;AR.set({loaded:!0,dir:e.dir,activeId:t,activePack:null,packs:e.packs,loadErrors:e.errors,slotComponents:{},runtimeErrors:[{packId:t,phase:`bundle`,file:`${r.bundleError.file}${n}`,slot:r.bundleError.slot,message:r.bundleError.message,timestamp:Date.now()}],disabledByCrash:!1});return}let i=await RR(r);if(i.error){AR.set({loaded:!0,dir:e.dir,activeId:t,activePack:null,packs:e.packs,loadErrors:e.errors,slotComponents:{},runtimeErrors:[i.error],disabledByCrash:!1});return}let a=AR.get(),o=a.activePack?.id===r.id&&a.activePack?.fingerprint===r.fingerprint,s=o?a.runtimeErrors.filter(e=>e.packId===r.id&&(e.phase===`render`||e.phase===`shell`)):[];AR.set({loaded:!0,dir:e.dir,activeId:t,activePack:o&&a.disabledByCrash?null:r,packs:e.packs,loadErrors:e.errors,slotComponents:o&&a.disabledByCrash?{}:i.slots,runtimeErrors:s,disabledByCrash:o?a.disabledByCrash:!1})}async function BR(e){await zR(await e.request(`theme.packages`))}async function VR(e){await Iw(e,`theme`,VF),await BR(e)}function HR(e,t,n,r,i){let a=AR.get(),o=[r.stack,i].filter(Boolean).join(`
97
+ `);a.runtimeErrors.some(n=>n.packId===e&&n.slot===t&&n.phase===`render`&&n.message===r.message)||AR.set({...a,runtimeErrors:[...a.runtimeErrors,{packId:e,phase:`render`,slot:t,file:n,message:r.message,stack:o,timestamp:Date.now()}]})}function UR(e,t){let n=AR.get(),r=[e.stack,t].filter(Boolean).join(`
98
+ `);AR.set({...n,activePack:null,slotComponents:{},disabledByCrash:!0,runtimeErrors:[...n.runtimeErrors,{packId:n.activeId??``,phase:`shell`,message:e.message,stack:r,timestamp:Date.now()}]})}function WR(){return b(AR)}function GR(){let e=b(AR);return e.disabledByCrash?null:e.activePack}var KR=`flex flex-wrap items-center gap-2 border-b-hairline border-error bg-surface px-3 py-1.5 font-mono text-meta text-ink`,qR=`rounded-xs bg-error px-1.5 py-0.5 font-semibold text-paper`,JR=`min-w-0 flex-1 truncate text-error`,YR=`ml-auto flex flex-none items-center gap-2`,XR=`flex w-full min-w-0 flex-col gap-0.5 rounded-sm px-2.5 py-1.5 text-left transition-colors`,ZR=`flex min-w-0 items-center gap-1.5 text-title text-ink`,QR=`inline-flex items-center gap-1 rounded-xs bg-inset px-1.5 py-0.5 font-mono text-meta text-muted`,$R=`rounded-md border-hairline border-line bg-surface overflow-hidden`;function ez(e){return e===`cards`?`bg-paper p-[var(--tp-shell-pad,8px)] gap-[var(--tp-pane-gap,8px)]`:``}function tz(e){return e===`cards`?$R:``}function nz(e){return e===`compact`?`min-h-6 py-0.5 px-2`:e===`spacious`?`min-h-11 py-2 px-3`:`min-h-8 py-1.25 px-2.5`}function rz(e,t){return e===`surface`?t?`bg-menu border-hairline border-accent`:`bg-surface border-hairline border-line hover:bg-hover`:e===`inset`?t?`bg-menu border-hairline border-accent`:`bg-inset hover:bg-hover`:e===`accentSoft`?t?`bg-accent-soft border-hairline border-accent`:`bg-accent-soft/60 hover:bg-accent-soft`:e===`paper`?t?`bg-menu`:`bg-paper hover:bg-hover`:e===`sidebar`?t?`bg-menu`:`bg-sidebar hover:bg-hover`:e===`engineTint`?t?`border-hairline border-accent bg-[color-mix(in_srgb,var(--tp-engine-color,var(--accent))_22%,var(--surface))]`:`border-hairline border-line bg-[color-mix(in_srgb,var(--tp-engine-color,var(--surface))_11%,var(--surface))] hover:bg-[color-mix(in_srgb,var(--tp-engine-color,var(--surface))_17%,var(--surface))]`:t?`bg-menu`:`hover:bg-hover`}function iz(e){return e===`card`?`rounded-md mb-1`:e===`pill`?`rounded-full px-3`:e===`compact`?`rounded-xs py-0.5`:e===`minimal`?`rounded-none px-1.5`:`rounded-sm`}var az=`col-span-full flex min-w-0 items-center gap-3 border-t-hairline border-line bg-surface px-3 py-1 font-mono text-meta whitespace-nowrap text-muted`,oz=`flex min-w-0 items-center justify-between gap-2 border-b-hairline border-line bg-surface px-2.5 py-1.5 font-mono text-meta text-ink`;function sz({model:e}){H();let t=WR(),n=t.runtimeErrors[t.runtimeErrors.length-1]??null;return(0,U.jsxs)(U.Fragment,{children:[t.packs.length>0&&(0,U.jsx)(`p`,{className:`text-meta text-muted [&_a]:text-accent m-0`,children:V(`settings.appearance.themePackageNote`)}),n&&(0,U.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-sm border-hairline border-error bg-inset p-3 font-mono text-meta text-ink`,"data-theme-package-last-error":!0,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,U.jsxs)(`span`,{className:`font-semibold text-error`,children:[V(`settings.appearance.themeLastError`,{theme:n.packId}),n.slot?` · ${n.slot}`:``,n.file?` (${n.file})`:``]}),(0,U.jsx)(W,{variant:`action`,onClick:()=>void VR(e.client),children:V(`settings.appearance.themeSwitchDefault`)})]}),(0,U.jsx)(`p`,{className:`m-0 text-ink`,children:n.message}),n.stack&&(0,U.jsx)(`pre`,{className:`m-0 max-h-40 overflow-auto whitespace-pre-wrap break-all rounded-xs bg-paper p-2 font-mono text-meta text-muted`,children:n.stack})]}),t.loadErrors.length>0&&(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,"data-theme-package-load-errors":!0,children:[(0,U.jsx)(`span`,{className:`text-meta text-muted [&_a]:text-accent`,children:V(`settings.appearance.themeInvalidHeading`)}),t.loadErrors.map(e=>(0,U.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-sm border-hairline border-error bg-inset p-3 font-mono text-meta text-ink`,children:[(0,U.jsxs)(`span`,{className:`font-semibold text-error`,children:[e.id,` · `,e.file,e.slot?` (${e.slot})`:``]}),e.issues&&e.issues.length>0?(0,U.jsx)(`ul`,{className:`m-0 list-disc pl-4 text-ink`,children:e.issues.map(e=>(0,U.jsxs)(`li`,{children:[e.path?`${e.path}: `:``,e.message]},`${e.path}:${e.message}`))}):(0,U.jsx)(`span`,{className:`text-ink`,children:e.message})]},e.id))]})]})}var cz=y(null);function lz({theme:e,mode:t}){let n=e[t],r=(e,t)=>({background:e,width:t});return(0,U.jsxs)(`span`,{className:IN,style:{background:n.background,borderColor:n.border},"aria-hidden":!0,children:[(0,U.jsxs)(`span`,{className:LN,style:{background:n.backgroundPanel},children:[(0,U.jsx)(`span`,{className:zN,style:r(n.primary,`70%`)}),(0,U.jsx)(`span`,{className:zN,style:r(n.textMuted,`85%`)}),(0,U.jsx)(`span`,{className:zN,style:r(n.textMuted,`55%`)})]}),(0,U.jsxs)(`span`,{className:RN,children:[(0,U.jsx)(`span`,{className:zN,style:r(n.text,`90%`)}),(0,U.jsx)(`span`,{className:zN,style:r(n.textMuted,`65%`)}),(0,U.jsx)(`span`,{className:zN,style:r(n.accent??n.primary,`40%`)}),(0,U.jsx)(`span`,{className:BN,children:[n.success,n.warning,n.error,n.info].map((e,t)=>(0,U.jsx)(`span`,{className:VN,style:{background:e}},t))})]})]})}function uz(e){return(0,U.jsxs)(W,{variant:`card`,title:e.title,"aria-pressed":e.active,className:FN(e.active),onMouseEnter:()=>BF.set(e.theme),onFocus:()=>BF.set(e.theme),onClick:e.onClick,children:[(0,U.jsx)(lz,{theme:e.theme,mode:e.mode}),(0,U.jsxs)(`span`,{className:HN,children:[(0,U.jsx)(`span`,{className:`truncate text-ink`,children:e.label??e.theme.name}),e.tag&&(0,U.jsx)(`span`,{className:`text-subtle`,children:e.tag})]})]})}function dz({children:e}){return(0,U.jsx)(`div`,{className:NN,onMouseLeave:()=>BF.set(null),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||BF.set(null)},children:e})}function fz(e){let{model:t}=e,{client:n}=t,r=b(cz),[i,a]=(0,h.useState)([]),[o,s]=(0,h.useState)(null),[c,l]=(0,h.useState)(null),[u,d]=(0,h.useState)(null),[f,p]=(0,h.useState)(null),[m,g]=(0,h.useState)(!1),[_,v]=(0,h.useState)(!1),y=Oe(),x=new Map(WR().packs.map(e=>[e.id,e]));(0,h.useEffect)(()=>()=>BF.set(null),[]),(0,h.useEffect)(()=>void Fw(n).catch(()=>void 0),[n]),(0,h.useEffect)(()=>{let e=!0;return n.request(`theme.terminals`).then(t=>{e&&a(t.terminals)},()=>{e&&a([])}),()=>{e=!1}},[n]),(0,h.useEffect)(()=>{cz.get()===null&&n.request(`theme.hosted`).then(e=>cz.set(e),()=>cz.set({themes:[],dir:null}))},[n]);let S=e=>{g(!1),dj(t,V(`prefs.themeAgentPrompt`,{dir:e})).catch(()=>g(!0))},C=r?.dir??null,w=async e=>{s(e),l(null);try{await n.request(`theme.install`,{name:e}),await Fw(n),await Iw(n,`theme`,e)}catch{l(e)}finally{s(null)}},T=async e=>{d(e.id),p(null);try{let t=await n.request(`theme.importTerminal`,{terminal:e.id});await Fw(n),await Iw(n,`theme`,t.name),a(t=>t.map(t=>t.id===e.id?{...t,installed:!0}:t))}catch{p(e.id)}finally{d(null)}},E=new Set(e.themes.map(e=>e.name)),D=(r?.themes??[]).filter(e=>!E.has(e.name));return(0,U.jsxs)($N,{settingId:`appearance.theme`,label:e.label,hint:V(`prefs.themePreviewHint`),stack:!0,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:PN,children:V(`prefs.themeInstalled`)}),(0,U.jsx)(dz,{children:e.themes.map(t=>(0,U.jsx)(uz,{theme:t,mode:e.mode,active:t.name===e.value,title:[t.name,x.get(t.name)?.manifest.description].filter(Boolean).join(`: `),tag:x.has(t.name)?V(`prefs.themePackage`):t.bundled?void 0:V(`prefs.themeUser`),onClick:()=>t.name!==e.value&&void Iw(n,`theme`,t.name)},t.name))})]}),(0,U.jsx)(sz,{model:t}),i.length>0&&(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`m-0 pb-1.5 text-meta font-medium text-subtle`,children:V(`prefs.themeTerminals`)}),(0,U.jsx)(`p`,{className:`text-meta text-muted [&_a]:text-accent m-0 pb-2`,children:V(`prefs.themeTerminalsHint`)}),(0,U.jsx)(dz,{children:i.map(t=>(0,U.jsx)(uz,{theme:t,label:t.label,title:t.fontFamily?`${t.configPath} · ${t.fontFamily}`:t.configPath,mode:e.mode,active:!1,tag:u===t.id?V(`prefs.themeImporting`):f===t.id?V(`prefs.themeImportFailed`):E.has(t.name)?V(`prefs.themeSync`):V(`prefs.themeImport`),onClick:()=>u===null&&void T(t)},t.id))})]}),D.length>0&&(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(W,{className:y?`flex min-h-11 w-full items-center gap-3 text-left`:`inline-flex items-center gap-1.5`,"aria-expanded":_,onClick:()=>v(!_),children:[!y&&(0,U.jsx)(Bv,{right:!_}),_?V(`prefs.themeHide`):V(`prefs.themeBrowse`,{count:D.length}),y&&(0,U.jsx)(Bv,{right:!_,className:`ml-auto block text-subtle`})]}),_&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`m-0 pb-1.5 text-meta font-medium text-subtle mt-2.5`,children:V(`prefs.themeMoreHint`)}),(0,U.jsx)(dz,{children:D.map(t=>(0,U.jsx)(uz,{theme:t,mode:e.mode,active:!1,title:[t.name,t.description].filter(Boolean).join(`: `),tag:o===t.name?V(`prefs.themeInstalling`):c===t.name?V(`prefs.themeInstallFailed`):t.package?V(`prefs.themePackage`):V(`prefs.themeGet`),onClick:()=>o===null&&void w(t.name)},t.name))})]})]}),C&&(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2.5`,children:[(0,U.jsx)(W,{variant:`action`,onClick:()=>S(C),children:V(`prefs.themeAgent`)}),(0,U.jsx)(`span`,{className:`text-meta text-muted [&_a]:text-accent`,children:V(m?`prefs.themeAgentFailed`:`prefs.themeAgentHint`)})]})]})}var pz=y({}),mz=``,hz=`(prefers-color-scheme: dark)`;function gz(e){let t=window.matchMedia(hz);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)}function _z(){return(0,h.useSyncExternalStore)(gz,()=>window.matchMedia(hz).matches,()=>!0)}function vz(){let e=_z();return yF(Rw().prefs.themeMode,e)}function yz(e){let t=vz(),n=Rw();(0,h.useEffect)(()=>{if(!n.loaded||n.prefs.taskColors!==`on`)return;let r=`${n.prefs.theme}/${t}`;r!==mz&&(mz=r,pz.set({}));let i=()=>{let i=pz.get(),a=e.tasks.get(),o=[...a?.tasks??[],...a?.archived??[]].map(e=>e.id).filter(e=>!(e in i));o.length!==0&&e.client.request(`theme.taskColors`,{theme:n.prefs.theme,mode:t,taskIds:o}).then(e=>{mz===r&&pz.set({...pz.get(),...e.colors})}).catch(()=>void 0)};return i(),e.tasks.subscribe(i)},[e,t,n.loaded,n.prefs.taskColors,n.prefs.theme])}function bz(e){let t=Rw(),n=b(pz);return e&&t.prefs.taskColors===`on`?n[e]:void 0}var xz={themeMode:{dark:`appearance.modeDark`,light:`appearance.modeLight`,auto:`appearance.modeAuto`},focusAccent:{primary:`general.accentPrimary`,success:`general.accentSuccess`,info:`general.accentInfo`},splitStyle:{box:`general.splitBox`,line:`general.splitLine`,rail:`general.splitRail`,rule:`general.splitRule`},railFold:{glyphs:`general.railFoldGlyphs`,initials:`general.railFoldInitials`,hairline:`general.railFoldHairline`},workingBorder:{flow:`appearance.borderFlow`,still:`appearance.borderStill`},runningTitle:{shimmer:`appearance.titleShimmer`,still:`appearance.titleStill`}},Sz={engine:`settings.appearance.statusMarkEngine`,both:`settings.appearance.statusMarkBoth`,dots:`settings.appearance.statusMarkDots`};function Cz({model:e}){let{client:t}=e,n=Rw(),r=vz(),i=b(_k),a=Vw(),o=(e,n)=>void Iw(t,e,n),s=(e,t,r,i)=>(0,U.jsx)(aP,{settingId:`appearance.${e}`,label:Q(t),hint:r,sample:i,value:n.prefs[e],picks:zw(n,e).map(t=>({value:t,label:e===`themeMode`&&t===`auto`?V(`prefs.modeAuto`):Q(xz[e]?.[String(t)]??String(t))})),onPick:t=>o(e,t)}),c=(e,t,r)=>(0,U.jsx)(eP,{settingId:`appearance.${e}`,label:Q(t),hint:r,checked:n.prefs[e]===`on`,onChange:t=>o(e,t?`on`:`off`)});return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(QN,{children:[(0,U.jsx)(fz,{model:e,label:Q(`general.theme`),themes:n.themes,value:n.prefs.theme,mode:r}),s(`themeMode`,`general.themeMode`)]}),(0,U.jsxs)(QN,{title:V(`settings.appearance.groupColours`),children:[s(`focusAccent`,`general.focusAccent`,Q(`general.focusAccentHint`)),c(`taskColors`,`general.taskColors`,V(`settings.appearance.taskColorsNote`)),c(`colorblind`,`general.colorblind`,V(`settings.appearance.colorblindNote`))]}),(0,U.jsxs)(QN,{title:V(`settings.appearance.groupTasks`),children:[s(`workingBorder`,`general.workingBorder`,V(`settings.appearance.workingBorderNote`),(0,U.jsx)(vF,{})),s(`runningTitle`,`general.runningTitle`,void 0,(0,U.jsx)(_F,{})),s(`splitStyle`,`general.splitStyle`),s(`railFold`,`general.railFold`,Q(`general.railFoldHint`)),(0,U.jsx)(aP,{settingId:`appearance.railGroup`,label:V(`settings.appearance.railGroup`),value:i,picks:hk.map(e=>({value:e,label:V(e===`state`?`settings.appearance.railGroupState`:`settings.appearance.railGroupProject`)})),onPick:yk}),(0,U.jsx)(aP,{settingId:`appearance.statusMark`,label:V(`settings.appearance.statusMark`),sample:(0,U.jsx)(gF,{model:e}),value:a,picks:Bw.map(e=>({value:e,label:V(Sz[e])})),onPick:e=>Hw(t,e)})]})]})}function wz(e,t,n){if(t===`offline`)return`offline`;if(t===`unsupported`||t===`mismatch`)return`outdated`;if(!e)return`loading`;let r=e.status;return r?r.gh?r.account?r.account===n?`same`:`different`:`signedOut`:`noGh`:e.reason===`failed`||!e.reason?`failed`:e.reason}var Tz=e=>e===``?{}:{machine:e},Ez=2e3,Dz=e=>e?.login?.state===`pending`||e?.login?.state===`syncing`;function Oz(e){let{client:t}=e,n=Cg(e),[r,i]=(0,h.useState)({}),[a,o]=(0,h.useState)(!1),s=(0,h.useMemo)(()=>{let e={};for(let i of[``,...n.map(e=>e.alias)]){let n=r[i]??J(t,`github.status`,Tz(i));n&&(e[i]=n)}return e},[r,n,t]),c=n.flatMap(e=>e.state===`online`?[e.alias]:[]).join(`
99
99
  `),l=(0,h.useMemo)(()=>c?c.split(`
100
- `):[],[c]),u=(0,h.useRef)(new Set),d=(0,h.useCallback)(async e=>{let n=await ss(t,`github.status`,wz(e)).catch(n=>J(t,`github.status`,wz(e))??{status:null,reason:`failed`,message:G(n)});i(t=>({...t,[e]:n}))},[t]),f=(0,h.useCallback)(async()=>{o(!0);try{await Promise.all([``,...l].map(d))}finally{o(!1)}},[d,l]);return(0,h.useEffect)(()=>t.onOpen(()=>void f()),[t,f]),(0,h.useEffect)(()=>{let e=new Set(Object.entries(s).flatMap(([e,t])=>Ez(t.status)?[e]:[])),t=[...u.current].some(t=>!e.has(t));if(u.current=e,t&&f(),e.size===0)return;let n=window.setTimeout(()=>{for(let t of e)d(t)},Tz);return()=>window.clearTimeout(n)},[s,d,f]),{machines:n,probes:s,refreshing:a,refresh:f,probe:d,act:(0,h.useCallback)(async(e,n)=>{try{let r=await t.request(e,n);return r.ok||z(r.message,`error`),r}catch(e){return z(G(e),`error`),null}},[t])}}function Oz({term:e,children:t}){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`dt`,{className:CN,children:e}),(0,U.jsx)(`dd`,{className:`${wN(!1)} flex min-w-0 flex-wrap items-baseline gap-x-2.5 gap-y-1`,children:t})]})}var kz=(e,t)=>V(`settings.connectors.${e}`,t),Az={weixin:{copy:`weixin`,command:`rove weixin login`},lark:{copy:`lark`,command:`rove lark connect`}};function jz({id:e}){return(0,U.jsx)(`svg`,{className:`size-7 flex-none`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:e===`lark`?(0,U.jsx)(`path`,{fill:`currentColor`,d:`M14.6 1.6 1.5 7.2c-.5.2-.5.9 0 1.1l3.4 1.3 1.3 3.9c.2.5.8.6 1.1.2l1.9-2.1 3.3 2.4c.4.3 1 .1 1.1-.4l2-11.2c.1-.5-.5-1-1-.8ZM6 9.3l6.2-5.1-4.8 6-.4 2.1L6 9.3Z`}):(0,U.jsx)(`path`,{fill:`currentColor`,d:`M6 2C3.2 2 1 3.9 1 6.2c0 1.3.7 2.5 1.8 3.2L2.3 11l1.9-1c.6.2 1.2.3 1.8.3h.3A3.6 3.6 0 0 1 6.2 9c0-2.2 2-3.9 4.5-3.9h.2C10.4 3.3 8.4 2 6 2Zm4.7 3.9c-2.1 0-3.7 1.4-3.7 3.1s1.6 3.1 3.7 3.1c.5 0 .9-.1 1.3-.2l1.5.8-.4-1.3c.8-.6 1.3-1.4 1.3-2.4 0-1.7-1.6-3.1-3.7-3.1Z`})})}function Mz(e){let[t,n]=(0,h.useState)(e.initial);return(0,U.jsx)(`input`,{autoFocus:!0,className:`${YM} min-w-0 flex-1 py-0 text-meta`,placeholder:e.placeholder,value:t,spellCheck:!1,onChange:e=>n(e.target.value),onKeyDown:n=>{n.nativeEvent.isComposing||(n.key===`Enter`?(e.onCommit(t),e.onDone()):n.key===`Escape`&&(n.stopPropagation(),e.onDone()))},onBlur:e.onDone})}function Nz({model:e,row:t,reload:n}){let{client:r}=e,i=Az[t.id],[a,o]=(0,h.useState)(!1),[s,c]=(0,h.useState)(!1),[l,u]=(0,h.useState)(null),[d,f]=(0,h.useState)(null),p=async(e,i={})=>{o(!0);try{return await r.request(e,{id:t.id,...i})}catch(e){return z(e instanceof Error?e.message:String(e)),null}finally{o(!1),await n()}},m=async()=>{let e=await p(`connectors.chatConnect`);u(e?.ok===!1&&typeof e.message==`string`?e.message:null)},g=t.allow??[],_=e=>void p(`connectors.chatUpdate`,{allow:e}),v=t=>{B(),e.select(t)};return(0,U.jsxs)(`div`,{className:UN(!0),children:[(0,U.jsxs)(`div`,{className:GN,children:[(0,U.jsxs)(`span`,{className:KN,children:[(0,U.jsx)(jz,{id:t.id}),(0,U.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,U.jsx)(`span`,{className:VM,children:kz(`${i.copy}Name`)}),(0,U.jsx)(`span`,{className:HM,children:kz(`${i.copy}Description`)})]})]}),t.connected?(0,U.jsx)(W,{variant:`action`,disabled:a,onClick:()=>c(!0),children:kz(`disconnect`)}):t.connectable&&(0,U.jsx)(W,{variant:`filled`,disabled:a,onClick:()=>void m(),children:kz(a?`chatConnecting`:`connect`)})]}),!t.connected&&(l??!t.connectable)&&(0,U.jsx)(`p`,{className:`text-meta text-muted [&_a]:text-accent m-0 pl-10 w-narrow:pl-0`,children:kz(`chatRunInTerminal`,{command:l??i.command})}),t.connected&&(0,U.jsxs)(`dl`,{className:`m-0 grid grid-cols-[max-content_minmax(0,1fr)] gap-x-3.5 gap-y-1.5 text-meta leading-[1.5] pl-10 w-narrow:pl-0`,children:[t.account&&(0,U.jsx)(Oz,{term:kz(`chatBot`),children:(0,U.jsx)(`span`,{title:t.since?kz(`chatSince`,{date:t.since.slice(0,10)}):void 0,children:t.account})}),(0,U.jsx)(Oz,{term:kz(`chatAgent`),children:t.agentTaskId?(0,U.jsx)(W,{onClick:()=>v(t.agentTaskId),children:kz(`chatOpen`)}):(0,U.jsx)(`span`,{className:`text-muted`,children:kz(`chatAgentNotYet`)})}),(0,U.jsxs)(Oz,{term:kz(`chatAllowed`),children:[(0,U.jsx)(`span`,{children:t.owner?kz(`chatYouNamed`,{name:t.owner}):kz(`chatYou`)}),g.map(e=>(0,U.jsxs)(`span`,{className:`inline-flex min-w-0 items-baseline gap-1 text-muted`,children:[(0,U.jsx)(`span`,{className:`max-w-40 truncate`,title:e,children:e}),(0,U.jsx)(W,{hit:`tight`,disabled:a,"aria-label":kz(`chatRemove`,{id:e}),title:kz(`chatRemove`,{id:e}),onClick:()=>_(g.filter(t=>t!==e)),children:`×`})]},e)),d===`allow`?(0,U.jsx)(Mz,{initial:``,placeholder:kz(`chatAllowAdd`),onCommit:e=>e.trim()&&_([...g,e.trim()]),onDone:()=>f(null)}):(0,U.jsx)(W,{disabled:a,onClick:()=>f(`allow`),children:kz(`chatAdd`)})]}),t.tone!==void 0&&(0,U.jsx)(Oz,{term:kz(`chatTone`),children:d===`tone`?(0,U.jsx)(Mz,{initial:t.tone,onCommit:e=>e.trim()!==t.tone&&void p(`connectors.chatUpdate`,{tone:e}),onDone:()=>f(null)}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:`min-w-0`,children:t.tone}),(0,U.jsx)(W,{disabled:a,onClick:()=>f(`tone`),children:kz(`chatEdit`)})]})})]}),s&&(0,U.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-sm border-hairline border-line bg-inset px-3 py-2.5 [&_p]:m-0 [&_p]:text-meta [&_p]:text-muted`,children:[(0,U.jsx)(`p`,{children:kz(`chatDisconnectBody`,{name:kz(`${i.copy}Name`),command:i.command})}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2.5`,children:[(0,U.jsx)(W,{onClick:()=>c(!1),children:V(`dialog.cancel`)}),(0,U.jsx)(W,{variant:`danger`,disabled:a,onClick:()=>void p(`connectors.chatDisconnect`).then(()=>c(!1)),children:kz(`disconnect`)})]})]})]})}function Pz({model:e}){let{client:t}=e,[n,r]=(0,h.useState)(()=>J(t,`connectors.chat`)?.connectors),i=()=>ss(t,`connectors.chat`).then(e=>r(e.connectors),()=>r(e=>e??[]));(0,h.useEffect)(()=>{i()},[t]);let a=(n??[]).filter(e=>Az[e.id]);return a.length===0?null:(0,U.jsxs)(`section`,{className:`flex flex-col pt-4`,children:[(0,U.jsx)(`h2`,{className:MM,children:kz(`chat`)}),(0,U.jsx)(`p`,{className:NM,children:kz(`chatHint`)}),(0,U.jsx)(`div`,{className:HN,children:a.map(t=>(0,U.jsx)(Nz,{model:e,row:t,reload:i},t.id))})]})}var $=(e,t)=>V(`settings.connectors.${e}`,t),Fz=[`1/m`,`10/m`,`1/s`,`2/s`,`5/s`],Iz=[``,`7d`,`30d`,`90d`],Lz=e=>e>=1?`${e}/s`:e*60>=1?`${+(e*60).toFixed(2)}/m`:`${+(e*3600).toFixed(2)}/h`,Rz=e=>new Date(e).toLocaleString();function zz(e){navigator.clipboard.writeText(e).then(()=>z($(`inboxCopied`)),()=>{})}var Bz=e=>()=>k.set((0,U.jsx)(aU,{model:e,section:`connectors`}));function Vz({label:e,value:t}){return(0,U.jsxs)(`div`,{className:ri,children:[(0,U.jsx)(`span`,{className:ii,children:e}),(0,U.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[(0,U.jsx)(`code`,{className:`min-w-0 flex-1 select-all break-all rounded-sm bg-inset px-2 py-1 text-meta`,children:t}),(0,U.jsx)(W,{onClick:()=>zz(t),children:$(`inboxCopy`)})]})]})}function Hz({model:e}){let{client:t}=e,n=Bz(e),[r,i]=(0,h.useState)(()=>J(t,`routine.list`)?.automations.filter(e=>!e.script)??null),[a,o]=(0,h.useState)(``),[s,c]=(0,h.useState)(``),[l,u]=(0,h.useState)(``),[d,f]=(0,h.useState)(`2/s`),[p,m]=(0,h.useState)(`5`),[g,_]=(0,h.useState)(``),[v,y]=(0,h.useState)(!1),[b,x]=(0,h.useState)(null),[S,C]=(0,h.useState)(null);(0,h.useEffect)(()=>{ss(t,`routine.list`).then(e=>i(e.automations.filter(e=>!e.script)),()=>i(e=>e??[]))},[t]);let w=async()=>{y(!0),x(null);try{C(await t.request(`inbox.tokenAdd`,{name:a.trim(),...s.trim()?{id:s.trim()}:{},...l===`agent`?{agent:!0}:l?{to:`routine:${l}`}:{},rate:d,burst:Number(p),...g?{expires:g}:{}}))}catch(e){x(G(e))}finally{y(!1)}};return S?(0,U.jsx)(ia,{title:$(`inboxCreatedTitle`,{name:S.name}),wide:!0,onClose:n,children:(0,U.jsxs)(`div`,{className:hi,children:[(0,U.jsx)(`p`,{className:`m-0 text-warning`,children:$(`inboxCreated`)}),(0,U.jsx)(Vz,{label:$(`inboxAddress`),value:S.url}),(0,U.jsx)(Vz,{label:$(`inboxKey`),value:S.recipient}),(0,U.jsx)(Vz,{label:$(`inboxToken`),value:S.token}),(0,U.jsx)(Vz,{label:$(`inboxCommand`),value:S.command}),(0,U.jsx)(`p`,{className:`${HM} m-0`,children:$(`inboxCopyPromptNote`)}),(0,U.jsxs)(`div`,{className:Qr,children:[(0,U.jsx)(W,{variant:`action`,onClick:()=>zz(S.prompt),children:$(`inboxCopyPrompt`)}),(0,U.jsx)(W,{variant:`filled`,onClick:n,children:$(`inboxDone`)})]})]})}):(0,U.jsx)(ia,{title:$(`inboxDialogTitle`),onClose:n,children:(0,U.jsxs)(`form`,{className:hi,onSubmit:e=>{e.preventDefault(),a.trim()&&w()},children:[(0,U.jsxs)(`label`,{className:ri,children:[(0,U.jsx)(`span`,{className:ii,children:$(`inboxName`)}),(0,U.jsx)(`input`,{className:YM,autoFocus:!0,spellCheck:!1,placeholder:`Grok Bot`,value:a,onChange:e=>o(e.target.value)})]}),(0,U.jsxs)(`label`,{className:ri,children:[(0,U.jsx)(`span`,{className:ii,children:$(`inboxId`)}),(0,U.jsx)(`input`,{className:`${YM} font-mono`,spellCheck:!1,autoCapitalize:`off`,placeholder:$(`inboxIdAuto`),value:s,onChange:e=>c(e.target.value)})]}),(0,U.jsxs)(`div`,{className:ri,children:[(0,U.jsx)(`span`,{className:ii,children:$(`inboxPickRoutine`)}),(0,U.jsx)(eM,{label:$(`inboxPickRoutine`),value:l,picks:[{value:``,label:$(`inboxDeliverOnly`)},{value:`agent`,label:$(`inboxStartsAgent`)},...(r??[]).map(e=>({value:e.id,label:$(`inboxStartsRoutine`,{name:e.name})}))],onPick:u})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-4`,children:[(0,U.jsxs)(`div`,{className:ri,children:[(0,U.jsx)(`span`,{className:ii,children:$(`inboxRate`)}),(0,U.jsx)(eM,{label:$(`inboxRate`),value:d,picks:Fz.map(e=>({value:e,label:e})),onPick:f})]}),(0,U.jsxs)(`label`,{className:ri,children:[(0,U.jsx)(`span`,{className:ii,children:$(`inboxBurst`)}),(0,U.jsx)(`input`,{className:`${YM} w-20`,inputMode:`numeric`,value:p,onChange:e=>m(e.target.value.replace(/\D/g,``))})]}),(0,U.jsxs)(`div`,{className:ri,children:[(0,U.jsx)(`span`,{className:ii,children:$(`inboxExpiry`)}),(0,U.jsx)(eM,{label:$(`inboxExpiry`),value:g,picks:Iz.map(e=>({value:e,label:e?$(`inboxExpiryDays`,{days:Number.parseInt(e,10)}):$(`inboxExpiryNever`)})),onPick:_})]})]}),b&&(0,U.jsx)(`p`,{className:`m-0 text-error`,children:b}),(0,U.jsxs)(`div`,{className:Qr,children:[(0,U.jsx)(W,{onClick:n,children:V(`dialog.cancel`)}),(0,U.jsx)(W,{type:`submit`,variant:`filled`,disabled:v||!a.trim(),children:$(`inboxCreate`)})]})]})})}function Uz({row:e,onRevoke:t}){let[n,r]=(0,h.useState)(!1),[i,a]=(0,h.useState)(!1),o=[$(`inboxRateValue`,{rate:Lz(e.rate),burst:e.burst}),e.daily?$(`inboxDaily`,{daily:e.daily}):``,e.expiresAt?$(`inboxExpires`,{date:Rz(e.expiresAt)}):``].filter(Boolean);return(0,U.jsxs)(`div`,{className:UN(!0),children:[(0,U.jsxs)(`div`,{className:GN,children:[(0,U.jsx)(`span`,{className:KN,children:(0,U.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,U.jsx)(`span`,{className:VM,children:e.name}),e.id!==e.name&&(0,U.jsx)(`span`,{className:`text-meta text-muted [&_a]:text-accent font-mono`,children:e.id})]}),(0,U.jsx)(`span`,{className:HM,children:e.routineId?e.routineName??$(`inboxMissingRoutine`):$(e.agent?`inboxStartsAgent`:`inboxKeeps`)})]})}),(0,U.jsx)(W,{variant:`action`,disabled:i,onClick:()=>r(!0),children:$(`inboxRevoke`)})]}),(0,U.jsxs)(`dl`,{className:SN,children:[(0,U.jsx)(Oz,{term:$(`inboxRate`),children:o.join(` · `)}),(0,U.jsx)(Oz,{term:$(`inboxLastUsed`),children:e.lastUsedAt?Rz(e.lastUsedAt):$(`inboxNever`)}),(0,U.jsx)(Oz,{term:$(`inboxDay`),children:$(`inboxDayValue`,e.last24h)}),e.recent.length>0&&(0,U.jsx)(Oz,{term:$(`inboxRecent`),children:(0,U.jsx)(`ul`,{className:`m-0 flex w-full list-none flex-col gap-0.5 p-0`,children:e.recent.slice(0,8).map(e=>(0,U.jsxs)(`li`,{className:`flex min-w-0 gap-2`,children:[(0,U.jsx)(`span`,{className:`text-subtle tabular-nums`,children:Rz(e.at)}),(0,U.jsx)(`span`,{className:e.accepted?`text-diff-added`:`text-diff-removed`,children:e.accepted?$(`inboxAccepted`):$(`inboxRefused`,{reason:e.reason})})]},e.at))})})]}),n&&(0,U.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-sm border-hairline border-line bg-inset px-3 py-2.5 [&_p]:m-0 [&_p]:text-meta [&_p]:text-muted`,children:[(0,U.jsx)(`p`,{children:$(`inboxRevokeBody`,{name:e.name})}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2.5`,children:[(0,U.jsx)(W,{onClick:()=>r(!1),children:V(`dialog.cancel`)}),(0,U.jsx)(W,{variant:`danger`,disabled:i,onClick:()=>{a(!0),t().finally(()=>a(!1))},children:$(`inboxRevoke`)})]})]})]})}function Wz({model:e}){let{client:t}=e,[n,r]=(0,h.useState)(()=>J(t,`inbox.status`)??null),[i,a]=(0,h.useState)(!1),[o,s]=(0,h.useState)(!1),c=()=>ss(t,`inbox.status`).then(r,e=>z($(`inboxFailed`,{error:G(e)}),`error`));(0,h.useEffect)(()=>{c()},[t]);let l=async(e,n={})=>{s(!0);try{await t.request(e,n)}catch(e){z(G(e),`error`)}finally{s(!1),await c()}},u=n?.address;return(0,U.jsxs)(`section`,{className:`flex flex-col pt-4`,children:[(0,U.jsx)(`h2`,{className:MM,children:$(`inbox`)}),(0,U.jsx)(`p`,{className:NM,children:$(`inboxHint`)}),(0,U.jsxs)(`div`,{className:HN,children:[(0,U.jsxs)(`div`,{className:UN(!0),children:[(0,U.jsxs)(`div`,{className:GN,children:[(0,U.jsx)(`span`,{className:KN,children:(0,U.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,U.jsx)(`span`,{className:VM,children:$(`inboxTitle`)}),(0,U.jsx)(`span`,{className:HM,children:$(`inboxNote`)})]})}),(0,U.jsx)(W,{variant:`filled`,onClick:()=>k.set((0,U.jsx)(Hz,{model:e})),children:$(`inboxNew`)})]}),u?(0,U.jsxs)(`dl`,{className:SN,children:[(0,U.jsx)(Oz,{term:$(`inboxAddress`),children:(0,U.jsx)(`code`,{className:`min-w-0 select-all break-all`,children:u.url})}),(0,U.jsxs)(Oz,{term:$(`inboxKey`),children:[(0,U.jsx)(`code`,{className:`min-w-0 select-all break-all`,children:u.recipient}),(0,U.jsx)(W,{disabled:o,onClick:()=>a(!0),children:$(`inboxRotate`)})]})]}):n&&(0,U.jsx)(`p`,{className:`text-meta text-muted [&_a]:text-accent m-0`,children:$(`inboxNone`)}),i&&(0,U.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-sm border-hairline border-line bg-inset px-3 py-2.5 [&_p]:m-0 [&_p]:text-meta [&_p]:text-muted`,children:[(0,U.jsx)(`p`,{children:$(`inboxRotateBody`)}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2.5`,children:[(0,U.jsx)(W,{onClick:()=>a(!1),children:V(`dialog.cancel`)}),(0,U.jsx)(W,{variant:`danger`,disabled:o,onClick:()=>void l(`inbox.rotate`).then(()=>{a(!1),z($(`inboxRotated`))}),children:$(`inboxRotate`)})]})]})]}),n?.tokens.map(e=>(0,U.jsx)(Uz,{row:e,onRevoke:()=>l(`inbox.tokenRevoke`,{id:e.id})},e.id))]})]})}function Gz(e){let t=e?/\bRoveApp\/(\S+) \(([\w,]+); ([0-9a-f]{8,})(?:; ([\d.]+))?\)/.exec(e):null;return t?{build:t[1],model:t[2],deviceId:t[3],...t[4]?{os:t[4]}:{}}:null}var Kz=(e=>(e[e.Border=-1]=`Border`,e[e.Data=0]=`Data`,e[e.Function=1]=`Function`,e[e.Position=2]=`Position`,e[e.Timing=3]=`Timing`,e[e.Alignment=4]=`Alignment`,e))(Kz||{}),qz=[0,1],Jz=[1,0],Yz=[2,3],Xz=[3,2],Zz={L:qz,M:Jz,Q:Yz,H:Xz},Qz=/^\d*$/,$z=/^[A-Z0-9 $%*+./:-]*$/,eB=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`,tB=1,nB=40,rB=3,iB=3,aB=40,oB=10,sB=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],cB=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],lB=class{constructor(e,t,n,r){if(this.version=e,this.ecc=t,e<tB||e>nB)throw RangeError(`Version value out of range`);if(r<-1||r>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let i=Array.from({length:this.size}).fill(!1);for(let e=0;e<this.size;e++)this.modules.push(i.slice()),this.types.push(i.map(()=>0));this.drawFunctionPatterns();let a=this.addEccAndInterleave(n);if(this.drawCodewords(a),r===-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(r=t,e=n),this.applyMask(t)}}this.mask=r,this.applyMask(r),this.drawFormatBits(r)}size;mask;modules=[];types=[];getModule(e,t){return e>=0&&e<this.size&&t>=0&&t<this.size&&this.modules[t][e]}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0,Kz.Timing),this.setFunctionModule(e,6,e%2==0,Kz.Timing);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n===0&&r===0||n===0&&r===t-1||n===t-1&&r===0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.ecc[1]<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let r=(t<<10|n)^21522;for(let e=0;e<=5;e++)this.setFunctionModule(8,e,dB(r,e));this.setFunctionModule(8,7,dB(r,6)),this.setFunctionModule(8,8,dB(r,7)),this.setFunctionModule(7,8,dB(r,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,dB(r,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,dB(r,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,dB(r,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;for(let e=0;e<18;e++){let n=dB(t,e),r=this.size-11+e%3,i=Math.floor(e/3);this.setFunctionModule(r,i,n),this.setFunctionModule(i,r,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;a>=0&&a<this.size&&o>=0&&o<this.size&&this.setFunctionModule(a,o,i!==2&&i!==4,Kz.Position)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!==1,Kz.Alignment)}setFunctionModule(e,t,n,r=Kz.Function){this.modules[t][e]=n,this.types[t][e]=r}addEccAndInterleave(e){let t=this.version,n=this.ecc;if(e.length!==EB(t,n))throw RangeError(`Invalid argument`);let r=cB[n[0]][t],i=sB[n[0]][t],a=Math.floor(TB(t)/8),o=r-a%r,s=Math.floor(a/r),c=[],l=DB(i);for(let t=0,n=0;t<r;t++){let r=e.slice(n,n+s-i+(t<o?0:1));n+=r.length;let a=OB(r,l);t<o&&r.push(0),c.push(r.concat(a))}let u=[];for(let e=0;e<c[0].length;e++)c.forEach((t,n)=>{(e!==s-i||n>=o)&&u.push(t[e])});return u}drawCodewords(e){if(e.length!==Math.floor(TB(this.version)/8))throw RangeError(`Invalid argument`);let t=0;for(let n=this.size-1;n>=1;n-=2){n===6&&(n=5);for(let r=0;r<this.size;r++)for(let i=0;i<2;i++){let a=n-i,o=n+1&2?r:this.size-1-r;!this.types[o][a]&&t<e.length*8&&(this.modules[o][a]=dB(e[t>>>3],7-(t&7)),t++)}}}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.types[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let t=0;t<this.size;t++){let n=!1,r=0,i=[0,0,0,0,0,0,0];for(let a=0;a<this.size;a++)this.modules[t][a]===n?(r++,r===5?e+=rB:r>5&&e++):(this.finderPenaltyAddHistory(r,i),n||(e+=this.finderPenaltyCountPatterns(i)*aB),n=this.modules[t][a],r=1);e+=this.finderPenaltyTerminateAndCount(n,r,i)*aB}for(let t=0;t<this.size;t++){let n=!1,r=0,i=[0,0,0,0,0,0,0];for(let a=0;a<this.size;a++)this.modules[a][t]===n?(r++,r===5?e+=rB:r>5&&e++):(this.finderPenaltyAddHistory(r,i),n||(e+=this.finderPenaltyCountPatterns(i)*aB),n=this.modules[a][t],r=1);e+=this.finderPenaltyTerminateAndCount(n,r,i)*aB}for(let t=0;t<this.size-1;t++)for(let n=0;n<this.size-1;n++){let r=this.modules[t][n];r===this.modules[t][n+1]&&r===this.modules[t+1][n]&&r===this.modules[t+1][n+1]&&(e+=iB)}let t=0;for(let e of this.modules)t=e.reduce((e,t)=>e+ +!!t,t);let n=this.size*this.size,r=Math.ceil(Math.abs(t*20-n*10)/n)-1;return e+=r*oB,e}getAlignmentPatternPositions(){if(this.version===1)return[];{let e=Math.floor(this.version/7)+2,t=this.version===32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}finderPenaltyCountPatterns(e){let t=e[1],n=t>0&&e[2]===t&&e[3]===t*3&&e[4]===t&&e[5]===t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]===0&&(e+=this.size),t.pop(),t.unshift(e)}};function uB(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function dB(e,t){return!!(e>>>t&1)}var fB=class{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}getData(){return this.bitData.slice()}},pB=[1,10,12,14],mB=[2,9,11,13],hB=[4,8,16,16];function gB(e,t){return e[Math.floor((t+7)/17)+1]}function _B(e){let t=[];for(let n of e)uB(n,8,t);return new fB(hB,e.length,t)}function vB(e){if(!xB(e))throw RangeError(`String contains non-numeric characters`);let t=[];for(let n=0;n<e.length;){let r=Math.min(e.length-n,3);uB(Number.parseInt(e.substring(n,n+r),10),r*3+1,t),n+=r}return new fB(pB,e.length,t)}function yB(e){if(!SB(e))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let t=[],n;for(n=0;n+2<=e.length;n+=2){let r=eB.indexOf(e.charAt(n))*45;r+=eB.indexOf(e.charAt(n+1)),uB(r,11,t)}return n<e.length&&uB(eB.indexOf(e.charAt(n)),6,t),new fB(mB,e.length,t)}function bB(e){return e===``?[]:xB(e)?[vB(e)]:SB(e)?[yB(e)]:[_B(wB(e))]}function xB(e){return Qz.test(e)}function SB(e){return $z.test(e)}function CB(e,t){let n=0;for(let r of e){let e=gB(r.mode,t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}function wB(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)===`%`?(t.push(Number.parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}function TB(e){if(e<tB||e>nB)throw RangeError(`Version number out of range`);let t=(16*e+128)*e+64;if(e>=2){let n=Math.floor(e/7)+2;t-=(25*n-10)*n-55,e>=7&&(t-=36)}return t}function EB(e,t){return Math.floor(TB(e)/8)-sB[t[0]][e]*cB[t[0]][e]}function DB(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let t=[];for(let n=0;n<e-1;n++)t.push(0);t.push(1);let n=1;for(let r=0;r<e;r++){for(let e=0;e<t.length;e++)t[e]=kB(t[e],n),e+1<t.length&&(t[e]^=t[e+1]);n=kB(n,2)}return t}function OB(e,t){let n=t.map(e=>0);for(let r of e){let e=r^n.shift();n.push(0),t.forEach((t,r)=>n[r]^=kB(t,e))}return n}function kB(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return n}function AB(e,t,n=1,r=40,i=-1,a=!0){if(!(tB<=n&&n<=r&&r<=nB)||i<-1||i>7)throw RangeError(`Invalid value`);let o,s;for(o=n;;o++){let n=EB(o,t)*8,i=CB(e,o);if(i<=n){s=i;break}if(o>=r)throw RangeError(`Data too long`)}for(let e of[Jz,Yz,Xz])a&&s<=EB(o,e)*8&&(t=e);let c=[];for(let t of e){uB(t.mode[0],4,c),uB(t.numChars,gB(t.mode,o),c);for(let e of t.getData())c.push(e)}let l=EB(o,t)*8;uB(0,Math.min(4,l-c.length),c),uB(0,(8-c.length%8)%8,c);for(let e=236;c.length<l;e^=253)uB(e,8,c);let u=Array.from({length:Math.ceil(c.length/8)},()=>0);return c.forEach((e,t)=>u[t>>>3]|=e<<7-(t&7)),new lB(o,t,u,i)}function jB(e,t){let{ecc:n=`L`,boostEcc:r=!1,minVersion:i=1,maxVersion:a=40,maskPattern:o=-1,border:s=1}=t||{},c=typeof e==`string`?bB(e):Array.isArray(e)?[_B(e)]:void 0;if(!c)throw Error(`uqr only supports encoding string and binary data, but got: ${typeof e}`);let l=AB(c,Zz[n],i,a,o,r),u=MB({version:l.version,maskPattern:l.mask,size:l.size,data:l.modules,types:l.types},s);return t?.invert&&(u.data=u.data.map(e=>e.map(e=>!e))),t?.onEncoded?.(u),u}function MB(e,t=1){if(!t)return e;let{size:n}=e,r=n+t*2;e.size=r,e.data.forEach(e=>{for(let n=0;n<t;n++)e.unshift(!1),e.push(!1)});for(let n=0;n<t;n++)e.data.unshift(Array.from({length:r},e=>!1)),e.data.push(Array.from({length:r},e=>!1));let i=Kz.Border;e.types.forEach(e=>{for(let n=0;n<t;n++)e.unshift(i),e.push(i)});for(let n=0;n<t;n++)e.types.unshift(Array.from({length:r},e=>i)),e.types.push(Array.from({length:r},e=>i));return e}function NB(e){return e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function PB(e,t={}){let n=jB(e,t),{pixelSize:r=10,whiteColor:i=`white`,blackColor:a=`black`}=t,o=n.size*r,s=n.size*r,c=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${s} ${o}">`,l=[];for(let e=0;e<n.size;e++)for(let t=0;t<n.size;t++){let i=t*r,a=e*r;n.data[e][t]&&l.push(`M${i},${a}h${r}v${r}h-${r}z`)}return c+=`<rect fill="${NB(i)}" width="${s}" height="${o}"/>`,c+=`<path fill="${NB(a)}" d="${l.join(``)}"/>`,c+=`</svg>`,c}var FB=(e,t)=>V(`settings.connectors.${e}`,t),IB=5e3,LB={"iPhone14,4":`iPhone 13 mini`,"iPhone14,5":`iPhone 13`,"iPhone14,2":`iPhone 13 Pro`,"iPhone14,3":`iPhone 13 Pro Max`,"iPhone14,6":`iPhone SE`,"iPhone14,7":`iPhone 14`,"iPhone14,8":`iPhone 14 Plus`,"iPhone15,2":`iPhone 14 Pro`,"iPhone15,3":`iPhone 14 Pro Max`,"iPhone15,4":`iPhone 15`,"iPhone15,5":`iPhone 15 Plus`,"iPhone16,1":`iPhone 15 Pro`,"iPhone16,2":`iPhone 15 Pro Max`,"iPhone17,3":`iPhone 16`,"iPhone17,4":`iPhone 16 Plus`,"iPhone17,1":`iPhone 16 Pro`,"iPhone17,2":`iPhone 16 Pro Max`,"iPhone17,5":`iPhone 16e`,"iPhone18,3":`iPhone 17`,"iPhone18,1":`iPhone 17 Pro`,"iPhone18,2":`iPhone 17 Pro Max`,"iPhone18,4":`iPhone Air`};function RB(e){if(!e)return null;let t=Gz(e),n=/\b(iPhone|iPad)\b.*? OS (\d+)_(\d+)/.exec(e);if(n){let e=t?LB[t.model]??t.model:n[1],r=`${n[1]===`iPad`?`iPadOS`:`iOS`} ${t?.os??`${n[2]}.${n[3]}`}`;return t?`${e} · ${r} · Rove app`:`${e} · ${r}`}let r=/Android (\d+(?:\.\d+)?)/.exec(e);return r?`Android ${r[1]}`:null}function zB(e){let[t,n]=(0,h.useState)([]),r=(0,h.useCallback)(async()=>{try{n((await e.client.request(`phone.list`)).phones)}catch{}},[e]);return(0,h.useEffect)(()=>{let t=window.setInterval(()=>void r(),IB),n=e.client.onOpen(()=>void r());return r(),()=>{window.clearInterval(t),n()}},[e,r]),{phones:t,load:r}}function BB({phone:e,model:t,onForgot:n}){let r=H()===`zh`?`zh-CN`:`en-US`,[i,a]=(0,h.useState)(!1),[o,s]=(0,h.useState)(!1),c=e=>new Date(e).toLocaleDateString(r,{month:`short`,day:`numeric`}),l=e.connected?FB(`phoneConnected`):FB(`phoneLastSeen`,{time:(e=>new Date(e).toLocaleString(r,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}))(e.lastSeenAt)}),u=async()=>{s(!0);try{await t.client.request(`phone.forget`,{device:e.device}),n()}catch(e){z(FB(`phoneForgetFailed`,{error:G(e)}),`error`)}finally{s(!1),a(!1)}};return(0,U.jsxs)(`li`,{className:`flex flex-col gap-2 py-2.5`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,U.jsx)(`span`,{className:VM,children:RB(e.userAgent)??FB(`phoneUnknown`)}),(0,U.jsxs)(`span`,{className:`${HM} truncate`,children:[(0,U.jsx)(`span`,{className:e.connected?`text-success`:void 0,children:l}),` · `,FB(`phonePairedOn`,{date:c(e.pairedAt)}),` · `,(0,U.jsx)(`span`,{className:`font-mono`,children:Gz(e.userAgent)?.deviceId??e.device})]})]}),!i&&(0,U.jsx)(W,{variant:`action`,onClick:()=>a(!0),children:FB(`phoneForget`)})]}),i&&(0,U.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-sm border-hairline border-line bg-inset px-3 py-2.5 [&_p]:m-0 [&_p]:text-meta [&_p]:text-muted`,children:[(0,U.jsx)(`p`,{children:FB(`phoneForgetBody`)}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2.5`,children:[(0,U.jsx)(W,{onClick:()=>a(!1),children:V(`dialog.cancel`)}),(0,U.jsx)(W,{variant:`danger`,disabled:o,onClick:()=>void u(),children:FB(`phoneForget`)})]})]})]})}function VB({model:e}){let{phones:t,load:n}=zB(e),[r,i]=(0,h.useState)(!1),a=(0,h.useRef)(null),[o,s]=(0,h.useState)(null),c=async()=>{s(null),i(!0);try{s(await e.client.request(`phone.pair`)),n()}catch(e){i(!1),z(FB(`phoneFailed`,{error:G(e)}),`error`)}};return(0,U.jsxs)(`section`,{className:`flex flex-col pt-4`,children:[(0,U.jsx)(`h2`,{className:MM,children:FB(`phone`)}),(0,U.jsx)(`p`,{className:NM,children:FB(`phoneHint`)}),(0,U.jsx)(`div`,{className:HN,children:(0,U.jsxs)(`div`,{className:UN(!0),ref:a,children:[(0,U.jsxs)(`div`,{className:GN,children:[(0,U.jsx)(`span`,{className:KN,children:(0,U.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,U.jsx)(`span`,{className:VM,children:FB(`phoneTitle`)}),(0,U.jsx)(`span`,{className:HM,children:FB(`phoneNote`)})]})}),r?(0,U.jsx)(W,{onClick:()=>i(!1),children:FB(`phoneHide`)}):(0,U.jsx)(W,{variant:`filled`,onClick:()=>void c(),children:FB(`phoneShow`)})]}),(0,U.jsx)(`div`,{className:qN(r),inert:!r,onTransitionEnd:e=>{e.target===e.currentTarget&&(r?a.current?.scrollIntoView({block:`nearest`,behavior:`smooth`}):s(null))},children:(0,U.jsx)(`div`,{className:`min-h-0 overflow-hidden`,children:(0,U.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4 pt-1`,children:[o?(0,U.jsx)(`img`,{className:`size-48 flex-none rounded-sm bg-white p-2 motion-safe:animate-qr-in`,alt:FB(`phoneQrAlt`),src:`data:image/svg+xml;utf8,${encodeURIComponent(PB(o.link,{blackColor:`#000`,whiteColor:`#fff`}))}`}):(0,U.jsxs)(`output`,{className:`flex size-48 flex-none flex-col items-center justify-center gap-2 rounded-sm border-hairline border-dashed border-line text-meta text-muted`,children:[(0,U.jsx)(Fy,{}),FB(`phoneMaking`)]}),o&&(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2 text-meta text-muted motion-safe:animate-rise-in`,children:[(0,U.jsx)(`p`,{children:FB(`phoneSecret`)}),(0,U.jsx)(`p`,{children:FB(`phoneDevice`,{device:o.device})}),(0,U.jsx)(`div`,{children:(0,U.jsx)(W,{onClick:()=>navigator.clipboard.writeText(o.link).then(()=>z(FB(`phoneCopied`)),()=>{}),children:FB(`phoneCopy`)})})]})]})})}),t.length>0&&(0,U.jsx)(`ul`,{className:`m-0 flex list-none flex-col border-t-hairline border-t-line p-0 [&>li+li]:border-t-hairline [&>li+li]:border-t-line`,children:t.map(t=>(0,U.jsx)(BB,{phone:t,model:e,onForgot:()=>void n()},t.device))})]})})]})}var HB={same:`markSame`,different:`markDifferent`,signedOut:`markSignedOut`,noGh:`markNoGh`,outdated:`markOutdated`,offline:`markOffline`,denied:`markDenied`,failed:`markFailed`},UB=(e,t)=>V(`settings.connectors.${e}`,t),WB={same:`text-diff-added`,signedOut:`text-diff-removed`,failed:`text-diff-removed`,denied:`text-diff-removed`,different:`text-warning`,outdated:`text-warning`,offline:`text-muted`,noGh:`text-muted`,loading:`text-muted`};function GB(e,t){return e===`loading`?UB(`loading`):UB(HB[e],{login:t?.account??``})}function KB(e){if(!e?.gh)return``;let t=e.ssh.ok?`✓ ${e.ssh.user??``}`.trim():`✗`;return UB(`detail`,{protocol:e.protocol??`—`,ssh:t})}function qB(){return(0,U.jsx)(`svg`,{className:`size-7 flex-none`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,U.jsx)(`path`,{fill:`currentColor`,d:`M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z`})})}function JB(e){navigator.clipboard.writeText(e).then(()=>z(UB(`codeCopied`)),()=>{})}function YB({login:e,onCancel:t}){return e.state===`failed`?(0,U.jsxs)(`div`,{className:$M,children:[(0,U.jsx)(`span`,{className:`text-muted`,children:UB(`loginFailed`,{error:e.error??``})}),(0,U.jsx)(W,{className:`ml-auto`,onClick:t,children:UB(`dismiss`)})]}):e.state===`syncing`?(0,U.jsx)(`div`,{className:$M,children:(0,U.jsx)(`span`,{className:`text-muted`,children:UB(`syncing`)})}):(0,U.jsxs)(`div`,{className:$M,children:[e.code?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`button`,{type:`button`,className:`font-mono font-normal normal-nums rounded-sm border-hairline border-dashed border-line px-2 py-0.5 text-display tracking-code`,title:UB(`codeHint`),onClick:()=>JB(e.code??``),children:e.code}),(0,U.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,children:UB(`openGithub`)})]}):(0,U.jsx)(`span`,{className:`text-muted`,children:UB(`loading`)}),(0,U.jsx)(W,{className:`ml-auto`,onClick:t,children:V(`dialog.cancel`)})]})}function XB(e){let t=Cz(e.probe,e.machine,e.rove),n=e.probe?.status??null,r=Ez(n),i=t===`different`||t===`signedOut`,a=n?.login,o=KB(n),s=i&&!r;return(0,U.jsxs)(`div`,{className:UN(),children:[(0,U.jsxs)(`div`,{className:WN,children:[(0,U.jsx)(`span`,{className:`${VM} min-w-0 flex-1 truncate`,children:e.name}),(0,U.jsx)(`span`,{className:`whitespace-nowrap text-meta ${WB[t]}`,title:e.probe?.message,children:GB(t,n)})]}),o&&(0,U.jsx)(`span`,{className:ON(),title:[n?.authDetail,n?.ssh.detail].filter(Boolean).join(`, `)||void 0,children:o}),s&&(e.onSync||e.onLogin)&&(0,U.jsxs)(`div`,{className:`mt-auto flex flex-wrap gap-2`,children:[e.onSync&&e.rove&&(0,U.jsx)(W,{variant:`action`,disabled:e.busy,onClick:e.onSync,children:UB(`useRove`)}),e.onLogin&&(0,U.jsx)(W,{variant:`action`,disabled:e.busy,onClick:e.onLogin,children:UB(`loginThere`)})]}),a&&(0,U.jsx)(YB,{login:a,onCancel:e.onCancel})]})}function ZB({model:e}){let{machines:t,probes:n,refreshing:r,refresh:i,probe:a,act:o}=Dz(e),[s,c]=(0,h.useState)(null),[l,u]=(0,h.useState)(!1),d=n[``],f=d?.status?.account??null,p=Ez(d?.status),m=async(e,t)=>{c(e);try{await t()}finally{c(null)}},g=e=>m(e,async()=>{await o(`github.login`,e===``?{}:{machine:e}),await a(e)}),_=e=>m(e,async()=>{await o(`github.login`,e===``?{cancel:!0}:{machine:e,cancel:!0}),await a(e)}),v=e=>m(e,async()=>{(await o(`github.sync`,{machine:e}))?.ok&&z(UB(`synced`,{machine:e,login:f??``})),await a(e)}),y=()=>m(``,async()=>{(await o(`github.logout`,{}))?.ok&&u(!1),await i()});return(0,U.jsxs)(`div`,{className:HN,children:[(0,U.jsxs)(`div`,{className:UN(!0),children:[(0,U.jsxs)(`div`,{className:GN,children:[(0,U.jsxs)(`span`,{className:KN,children:[(0,U.jsx)(qB,{}),(0,U.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,U.jsx)(`span`,{className:VM,children:`GitHub`}),(0,U.jsx)(`span`,{className:HM,children:UB(`githubDescription`)})]})]}),f?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`span`,{className:UM,children:[`@`,f]}),(0,U.jsx)(W,{variant:`action`,disabled:s!==null,onClick:()=>u(!0),children:UB(`disconnect`)})]}):d?.status?!p&&(0,U.jsx)(W,{variant:`filled`,disabled:s!==null,onClick:()=>void g(``),children:UB(`connect`)}):(0,U.jsx)(`span`,{className:`text-meta text-muted`,title:d?.message,children:d?GB(Cz(d,null,null),null):UB(`loading`)})]}),l&&(0,U.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-sm border-hairline border-line bg-inset px-3 py-2.5 [&_p]:m-0 [&_p]:text-meta [&_p]:text-muted`,children:[(0,U.jsx)(`p`,{children:UB(`disconnectBody`)}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2.5`,children:[(0,U.jsx)(W,{onClick:()=>u(!1),children:V(`dialog.cancel`)}),(0,U.jsx)(W,{variant:`danger`,disabled:s!==null,onClick:()=>void y(),children:UB(`disconnect`)})]})]}),!f&&d?.status?.login&&(0,U.jsx)(YB,{login:d.status.login,onCancel:()=>void _(``)})]}),(f||!d?.status)&&(0,U.jsxs)(`section`,{className:`col-span-2 flex flex-col pt-4 w-narrow:col-span-1`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3 pb-1.5 [&>h2]:pb-0`,children:[(0,U.jsx)(`h2`,{className:`m-0 pb-1.5 font-sans text-meta font-medium normal-nums text-muted w-narrow:px-3 w-narrow:font-normal w-narrow:text-subtle`,children:UB(`machines`)}),r?(0,U.jsx)(`span`,{className:`text-meta text-muted`,children:UB(`refreshing`)}):(0,U.jsx)(W,{onClick:()=>void i(),children:UB(`refresh`)})]}),(0,U.jsx)(`p`,{className:`m-0 pb-2 text-meta text-subtle w-narrow:order-last w-narrow:px-3 w-narrow:pt-1.5 w-narrow:pb-0`,children:UB(`machinesHint`)}),(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-2.5 w-narrow:grid-cols-1`,children:[(0,U.jsx)(XB,{name:UB(`thisMachine`),probe:d,machine:null,rove:f,busy:s!==null,onCancel:()=>void _(``)}),t.map(e=>(0,U.jsx)(XB,{name:e.alias,probe:n[e.alias],machine:e.state,rove:f,busy:s!==null,onSync:()=>void v(e.alias),onLogin:()=>void g(e.alias),onCancel:()=>void _(e.alias)},e.alias))]})]})]})}function QB({model:e}){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{"data-setting-id":`connectors.github`,className:hM,children:(0,U.jsx)(ZB,{model:e})}),(0,U.jsx)(`div`,{"data-setting-id":`connectors.chat`,className:hM,children:(0,U.jsx)(Pz,{model:e})}),(0,U.jsx)(`div`,{"data-setting-id":`connectors.phone`,className:hM,children:(0,U.jsx)(VB,{model:e})}),(0,U.jsx)(`div`,{"data-setting-id":`connectors.inbox`,className:hM,children:(0,U.jsx)(Wz,{model:e})})]})}var $B=[{key:`remoteProjects`,label:`dev.remote`,hint:`dev.remoteHint`},{key:`autoStatus`,label:`dev.autoStatus`,hint:`dev.autoStatusHint`},{key:`dispatcher`,label:`dev.dispatcher`,hint:`dev.dispatcherHint`}];function eV({client:e}){let{prefs:t}=Rw(),[n,r]=(0,h.useState)(null),[i,a]=(0,h.useState)(!1),o=async()=>{if(n){a(!0);try{if(n===`reset`){await e.request(`dev.reset`),localStorage.removeItem(`rove.prefs`),window.location.reload();return}await e.request(`daemon.restart`),z(Q(`restart.done`)),r(null)}catch(e){z(G(e),`error`)}finally{a(!1)}}},s=(e,t,a,s,c)=>(0,U.jsxs)(`div`,{children:[(0,U.jsx)(QN,{settingId:`dev.${e}`,label:t,hint:a,children:(0,U.jsx)(W,{variant:`action`,onClick:()=>r(e),children:s})}),n===e&&(0,U.jsx)(`div`,{className:`pb-3`,children:(0,U.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-sm border-hairline border-line bg-inset px-3 py-2.5 [&_p]:m-0 [&_p]:text-meta [&_p]:text-muted`,children:[(0,U.jsx)(`strong`,{children:Q(`${e}.title`)}),(0,U.jsx)(`p`,{children:V(e===`reset`?`prefs.resetBody`:`prefs.restartBody`)}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2.5`,children:[(0,U.jsx)(W,{onClick:()=>r(null),children:V(`dialog.cancel`)}),(0,U.jsx)(W,{variant:c?`danger`:`filled`,disabled:i,onClick:()=>void o(),children:s})]})]})})]});return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(ZN,{title:Q(`dev.experimental`),children:$B.map(n=>(0,U.jsx)($N,{settingId:`dev.${n.key}`,label:Q(n.label),hint:Q(n.hint),checked:t[n.key],onChange:t=>void Iw(e,n.key,t)},n.key))}),(0,U.jsxs)(ZN,{hint:Q(`dev.doctorHint`),children:[s(`restart`,Q(`dev.restart`),V(`prefs.restartHint`),V(`prefs.restartButton`),!1),s(`reset`,Q(`dev.reset`),V(`prefs.resetHint`),V(`prefs.resetButton`),!0)]})]})}function tV(e){return e.binaryFound===void 0?{key:`settings.engines.status.checking`,tone:`unknown`}:e.binaryFound===null?{key:`settings.engines.status.unknown`,tone:`unknown`}:e.binaryFound?e.configIssue?{key:`settings.engines.status.integrationBlocked`,tone:`error`}:e.login===`no`?{key:`settings.engines.status.signIn`,tone:`attention`}:e.hooks===`outdated`?{key:`settings.engines.status.integrationOutdated`,tone:`attention`}:e.hooks===`not-installed`?{key:`settings.engines.status.integrationMissing`,tone:`attention`}:{key:`settings.engines.status.ready`,tone:`ready`}:e.commandChosen?{key:`settings.engines.status.notOnPath`,tone:`attention`}:{key:`settings.engines.status.notInstalled`,tone:`absent`}}function nV(e){return tV({binaryFound:e.binaryFound,login:e.login,hooks:e.hooks,configIssue:e.configIssue,commandChosen:e.custom||e.customized})}var rV={ready:`ready`,attention:`attention`,error:`error`,absent:`absent`,unknown:`absent`};function iV(e){if(e.configIssue)return Q(`engines.detail.hooksBlockedHere`,{reason:e.configIssue});switch(e.hooks){case`installed`:return Q(`engines.detail.hooksInstalled`);case`outdated`:return Q(`engines.detail.hooksOutdated`);case`not-installed`:return e.binaryFound===!1?Q(`engines.detail.hooksAwaitEngine`):Q(`engines.detail.hooksMissing`);default:return Q(`engines.detail.hooksUnsupported`)}}function aV({engine:e}){let t=e.binaryFound===!0?Q(`engines.detail.programFound`,{binary:e.binary,path:e.binaryPath??e.binary}):e.binaryFound===!1?Q(`engines.detail.programMissing`,{binary:e.binary}):Q(`engines.detail.programUnknown`,{binary:e.binary}),n=e.login===`yes`?Q(`engines.detail.signedIn`):e.login===`no`?Q(`engines.detail.signedOut`):Q(`engines.detail.signInUnknown`),r=[iV(e),Q(e.markers?`engines.detail.markersYes`:`engines.detail.markersNo`),Q(e.screen?`engines.detail.screenYes`:e.hooks===`installed`?`engines.detail.screenNotNeeded`:`engines.detail.screenNo`)];return(0,U.jsxs)(`dl`,{className:SN,children:[(0,U.jsx)(`dt`,{className:CN,children:Q(`engines.detail.program`)}),(0,U.jsx)(`dd`,{className:wN(e.binaryFound===!1),children:t}),(0,U.jsx)(`dt`,{className:CN,children:Q(`engines.detail.signIn`)}),(0,U.jsx)(`dd`,{className:wN(e.login===`no`),children:n}),(0,U.jsx)(`dt`,{className:CN,children:Q(`engines.detail.reporting`)}),(0,U.jsx)(`dd`,{className:wN(!1),children:r.map(e=>(0,U.jsx)(`span`,{className:`block`,children:e},e))}),e.skill===`unsupported`?null:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`dt`,{className:CN,children:Q(`engines.detail.skill`)}),(0,U.jsx)(`dd`,{className:wN(e.skill!==`installed`),children:Q(e.skill===`installed`?`engines.detail.skillInstalledHere`:e.skill===`outdated`?`engines.detail.skillOutdated`:`engines.detail.skillMissing`)})]}),e.custom?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`dt`,{className:CN,children:Q(`engines.detail.adapter`)}),(0,U.jsx)(`dd`,{className:wN(!1),children:e.protocol?Q(`engines.detail.adapterDeclared`,{protocol:e.protocol}):Q(`engines.detail.adapterGeneric`)})]}):null]})}function oV(e){let[t,n]=(0,h.useState)(e.name);return(0,U.jsxs)(`form`,{className:TN,onSubmit:n=>{n.preventDefault(),e.onSave(t)},children:[(0,U.jsx)(`input`,{className:`${Xr} w-full ${EN}`,autoFocus:!0,value:t,"aria-label":V(`settings.engines.rename`),placeholder:V(`settings.engines.namePlaceholder`),onChange:e=>n(e.target.value),onKeyDown:t=>{t.key===`Escape`&&(t.stopPropagation(),e.onCancel())}}),(0,U.jsx)(W,{variant:`filled`,type:`submit`,children:V(`settings.engines.save`)}),(0,U.jsx)(W,{variant:`action`,onClick:e.onCancel,children:V(`settings.engines.cancel`)})]})}function sV(e){let[t,n]=(0,h.useState)(null),r=e.engines.find(e=>e.id===t);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Fl,{children:e.engines.map(t=>(0,U.jsx)(cV,{engine:t,icon:e.icons.get(t.id),run:e.run,onOpen:()=>n(t.id)},t.id))}),r&&(0,U.jsx)(lV,{engine:r,run:e.run,onClose:()=>n(null)})]})}function cV(e){let{engine:t,run:n}=e,r=rV[nV(t).tone];return(0,U.jsxs)(`div`,{className:`${gN} ${hM}`,"data-setting-id":`engines.item:${t.id}`,children:[(0,U.jsxs)(W,{variant:`row`,className:_N,"aria-haspopup":`dialog`,onClick:e.onOpen,children:[(0,U.jsx)(Ev,{icon:e.icon}),(0,U.jsxs)(`span`,{className:sN,children:[(0,U.jsxs)(`span`,{className:vN,children:[t.name,t.renamedFrom?(0,U.jsx)(`span`,{className:lN,children:t.renamedFrom}):null,t.custom&&!t.renamedFrom?(0,U.jsx)(`span`,{className:lN,children:Q(`engines.customTag`)}):null]}),(0,U.jsxs)(`span`,{className:dN(r),children:[(0,U.jsx)(`span`,{className:fN(r),"aria-hidden":`true`}),Q(nV(t).key.slice(9)),t.isDefault&&(0,U.jsxs)(`span`,{className:`text-accent capitalize`,children:[`· `,Q(`engines.defaultMark`)]})]})]})]}),t.binaryFound!==!1&&(0,U.jsx)(`span`,{className:`relative z-1 flex flex-none items-center`,children:(0,U.jsx)(XN,{on:t.enabled,"aria-label":V(`settings.engines.enabled`,{name:t.name}),onClick:()=>n(`engine.setEnabled`,{id:t.id,enabled:!t.enabled})})}),(0,U.jsx)(Bv,{right:!0,className:yN})]})}function lV(e){let{engine:t,run:n}=e,[r,i]=(0,h.useState)(!1),a=!t.isDefault&&t.canBeDefault&&t.binaryFound!==!1;return(0,U.jsx)(vu,{label:t.name,title:t.name,onClose:e.onClose,children:e=>(0,U.jsxs)(`div`,{className:du,children:[(0,U.jsx)(`div`,{className:bN,children:(0,U.jsx)(aV,{engine:t})}),r?(0,U.jsx)(`div`,{className:bN,children:(0,U.jsx)(oV,{name:t.name,onCancel:()=>i(!1),onSave:e=>{n(`engine.rename`,{id:t.id,name:e}),i(!1)}})}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`hr`,{className:hu}),a&&(0,U.jsx)(yu,{onClick:()=>{n(`engine.setDefault`,{id:t.id}),e()},children:Q(`engines.makeDefault`)}),(0,U.jsx)(yu,{onClick:()=>i(!0),children:V(`settings.engines.rename`)}),(t.custom||t.customized)&&(0,U.jsx)(yu,{tone:t.custom?`danger`:`ink`,onClick:()=>{n(`engine.reset`,{id:t.id}),e()},children:t.custom?V(`settings.engines.remove`):V(`settings.engines.reset`)}),(0,U.jsx)(`hr`,{className:hu}),(0,U.jsx)(yu,{tone:`cancel`,onClick:e,children:V(`menu.cancel`)})]})]})})}var uV=y([]),dV=3e4;function fV(e){return e.request(`skill.missing`).then(e=>uV.set(e.engines),()=>{})}function pV(e){(0,h.useEffect)(()=>{let t=e.onOpen(()=>void fV(e)),n=ua(dV,()=>void fV(e));return()=>{t(),n()}},[e])}function mV(e){return e.request(`skill.install`).then(e=>{e.error&&z(Q(`engines.skill.failed`,{reason:e.error}),`error`)}).catch(e=>z(G(e),`error`)).then(()=>fV(e))}function hV({model:e}){let{client:t}=e,n=Oe(),r=lS(e),{value:i,failed:a,reload:o}=oP(t,`engines.settings`),s=i?.engines,[c,l]=(0,h.useState)(null),u=(e,n={})=>void t.request(e,n).then(o).catch(e=>z(G(e),`error`));return s?(0,U.jsxs)(U.Fragment,{children:[n?(0,U.jsx)(sV,{engines:s,icons:r,run:u}):(0,U.jsxs)(`section`,{"data-setting-id":`engines.list`,className:hM,children:[(0,U.jsx)(`p`,{className:NM,children:Q(`engines.hint`)}),(0,U.jsxs)(`div`,{className:tN,children:[(0,U.jsxs)(`div`,{className:nN,"aria-hidden":`true`,children:[(0,U.jsx)(`span`,{}),(0,U.jsx)(`span`,{children:Q(`engines.defaultMark`)}),(0,U.jsx)(`span`,{children:Q(`engines.available`)})]}),s.map(e=>(0,U.jsx)(gV,{engine:e,open:c===e.id,onToggleOpen:()=>l(c===e.id?null:e.id),run:u},e.id))]})]}),(0,U.jsx)(vV,{engines:s,run:u}),(0,U.jsx)(yV,{engines:s,client:t,reload:o}),(0,U.jsx)(bV,{client:t})]}):(0,U.jsx)(sP,{failed:a,onRetry:o})}function gV(e){let{engine:t,run:n}=e,r=(0,h.useId)(),i=nV(t),a=t.binaryFound===!1;return(0,U.jsxs)(`div`,{className:`${rN} ${hM}`,"data-setting-id":`engines.item:${t.id}`,children:[(0,U.jsxs)(`div`,{className:iN,children:[(0,U.jsxs)(`button`,{type:`button`,className:aN,"aria-expanded":e.open,"aria-controls":r,onClick:e.onToggleOpen,children:[(0,U.jsx)(Bv,{right:!e.open,className:oN(e.open)}),(0,U.jsxs)(`span`,{className:sN,children:[(0,U.jsxs)(`span`,{className:cN(!t.enabled),children:[t.name,t.renamedFrom?(0,U.jsx)(`span`,{className:lN,children:t.renamedFrom}):null,t.custom&&!t.renamedFrom?(0,U.jsx)(`span`,{className:lN,children:Q(`engines.customTag`)}):null]}),(0,U.jsxs)(`span`,{className:dN(rV[i.tone]),children:[(0,U.jsx)(`span`,{className:fN(rV[i.tone]),"aria-hidden":`true`}),Q(i.key.slice(9))]})]})]}),(0,U.jsx)(`div`,{className:pN,children:t.isDefault?(0,U.jsx)(`span`,{className:mN,children:Q(`engines.defaultMark`)}):t.canBeDefault&&!a?(0,U.jsx)(`button`,{type:`button`,className:hN,"aria-label":V(`settings.engines.default`,{name:t.name}),onClick:()=>n(`engine.setDefault`,{id:t.id}),children:Q(`engines.makeDefault`)}):null}),a?(0,U.jsx)(`span`,{}):(0,U.jsx)(XN,{on:t.enabled,"aria-label":V(`settings.engines.enabled`,{name:t.name}),onClick:()=>n(`engine.setEnabled`,{id:t.id,enabled:!t.enabled})})]}),e.open?(0,U.jsx)(_V,{id:r,engine:t,run:n}):null]})}function _V(e){let{engine:t,run:n}=e,[r,i]=(0,h.useState)(!1);return(0,U.jsxs)(`div`,{id:e.id,className:xN,children:[(0,U.jsx)(aV,{engine:t}),r?(0,U.jsx)(oV,{name:t.name,onCancel:()=>i(!1),onSave:e=>{n(`engine.rename`,{id:t.id,name:e}),i(!1)}}):(0,U.jsxs)(`div`,{className:TN,children:[(0,U.jsx)(W,{variant:`action`,onClick:()=>i(!0),children:V(`settings.engines.rename`)}),t.custom||t.customized?(0,U.jsx)(W,{variant:`action`,onClick:()=>n(`engine.reset`,{id:t.id}),children:t.custom?V(`settings.engines.remove`):V(`settings.engines.reset`)}):null]})]})}function vV({engines:e,run:t}){let n=e.filter(e=>e.hooks!==`unsupported`),r=n.filter(e=>e.binaryFound!==!1),i=r.filter(e=>e.hooks===`installed`).length,a=r.length-i,o=n.filter(e=>e.hooks!==`not-installed`).length;return n.length===0?null:(0,U.jsx)(ZN,{settingId:`engines.integrations`,title:Q(`engines.integrations.title`),hint:Q(`engines.integrations.hint`),children:(0,U.jsx)(QN,{label:Q(`engines.integrations.summary`,{installed:i,total:r.length}),children:(0,U.jsxs)(`div`,{className:QM,children:[a>0?(0,U.jsx)(W,{variant:`filled`,onClick:()=>t(`engines.hooks.install`),children:Q(`engines.integrations.install`,{count:a})}):(0,U.jsx)(`span`,{className:DN,children:Q(`engines.integrations.upToDate`)}),o>0?(0,U.jsx)(W,{variant:`action`,onClick:()=>t(`engines.hooks.uninstall`),children:Q(`engines.integrations.remove`,{count:o})}):null]})})})}function yV(e){let t=e.engines.filter(e=>e.skill!==`unsupported`),n=t.filter(e=>e.skill===`installed`).length,r=t.length-n;return(0,U.jsx)(ZN,{settingId:`engines.skill`,title:Q(`engines.skill.title`),hint:Q(`engines.skill.hint`),children:(0,U.jsx)(QN,{label:t.length>0?Q(`engines.integrations.summary`,{installed:n,total:t.length}):Q(`engines.skill.noEngines`),children:r>0?(0,U.jsx)(W,{variant:`filled`,onClick:()=>void mV(e.client).then(e.reload),children:Q(`engines.skill.install`,{count:r})}):t.length>0?(0,U.jsx)(`span`,{className:DN,children:Q(`engines.integrations.upToDate`)}):null})})}function bV({client:e}){let{prefs:t}=Rw();return(0,U.jsx)(ZN,{title:Q(`engines.permissionsTitle`),hint:Q(`engines.permissionBypassHint`),children:(0,U.jsx)($N,{settingId:`engines.permissionBypass`,label:Q(`engines.permissionBypass`),checked:t.permissionBypass,onChange:t=>void Iw(e,`permissionBypass`,t)})})}var xV={bug:`settings.feedback.kindBug`,idea:`settings.feedback.kindIdea`,question:`settings.feedback.kindQuestion`};function SV(e){let t=e.split(`
101
- `).find(e=>e.trim())?.trim()??``;return t.length>120?`${t.slice(0,119).trimEnd()}…`:t}function CV({model:e}){let[t,n]=(0,h.useState)(`bug`),[r,i]=(0,h.useState)(``),a=ni(r),[o,s]=(0,h.useState)(!1),[c,l]=(0,h.useState)(null),[u,d]=(0,h.useState)(!1),f=!r.trim();return(0,U.jsxs)(`form`,{"data-setting-id":`feedback.form`,className:`flex flex-col gap-3 ${hM}`,onSubmit:n=>{n.preventDefault(),s(!0),d(!1),dj(e,f?void 0:{text:r.trim(),kind:t}).catch(()=>d(!0)).finally(()=>s(!1))},children:[(0,U.jsx)(`p`,{className:`m-0 ${HM} ${KM}`,children:V(`settings.feedback.hint`)}),(0,U.jsx)(`textarea`,{ref:a,className:`${YM} ${ai} w-full`,"aria-label":V(`settings.feedback.prompt`),placeholder:V(`settings.feedback.prompt`),value:r,onChange:e=>i(e.target.value)}),(c||u)&&(0,U.jsxs)(`p`,{className:`m-0 text-meta text-muted [&_a]:text-accent break-words`,children:[u?V(`settings.feedback.reportFailed`):c?.filed?V(`settings.feedback.sent`,{number:c.number??0}):V(`settings.feedback.notFiled`,{hint:c?.hint??``}),` `,c&&!u&&(0,U.jsx)(`a`,{className:`underline`,href:c.url,target:`_blank`,rel:`noreferrer`,children:c.filed?c.url:V(`settings.feedback.openLink`)})]}),(0,U.jsxs)(`div`,{className:qM,children:[(0,U.jsx)(wO,{label:V(`settings.feedback.kindLabel`),value:t,picks:Object.keys(xV).map(e=>({value:e,label:V(xV[e])})),onPick:n}),(0,U.jsxs)(`div`,{className:Qr,children:[(0,U.jsx)(W,{variant:`action`,type:`button`,disabled:o||f,onClick:()=>{s(!0),l(null),d(!1),e.client.request(`feedback.send`,{title:SV(r),body:r.trim(),kind:t}).then(e=>{l(e),e.filed&&i(``)}).catch(e=>z(G(e),`error`)).finally(()=>s(!1))},children:V(`settings.feedback.fileAsIs`)}),(0,U.jsx)(W,{variant:`filled`,type:`submit`,disabled:o,children:V(`settings.feedback.draft`)})]})]}),(0,U.jsx)(`p`,{className:`m-0 ${HM}`,children:V(`settings.feedback.note`)})]})}var wV=[{value:`en`,label:`English`},{value:`zh`,label:`中文`}],TV={default:`general.worktreeKindDefault`,nextToProject:`general.worktreeKindNext`,custom:`general.worktreeKindCustom`};function EV({model:e}){let{client:t}=e,n=Rw(),{prefs:r,info:i}=n,a=(e,n)=>void Iw(t,e,n),o=[`default`,`nextToProject`];(i.worktreeCustomPath||r.worktreeBase===`custom`)&&o.push(`custom`);let s=o.map(e=>({value:e,label:Q(TV[e])}));return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(ZN,{title:V(`settings.general.groupInterface`),children:[(0,U.jsx)(iP,{settingId:`general.language`,label:Q(`general.language`),hint:V(`prefs.languageHint`),value:r.locale,picks:wV,onPick:e=>a(`locale`,e)}),(0,U.jsx)($N,{settingId:`general.keyHints`,label:Q(`general.keyHintsShow`),hint:V(`settings.general.tuiKeyHints`),checked:r.keyHints,onChange:e=>a(`keyHints`,e)}),(0,U.jsx)(iP,{settingId:`general.tabStrip`,label:V(`settings.general.tabStrip`),value:r.tabStrip,picks:zw(n,`tabStrip`).map(e=>({value:e,label:Q(`general.tabStripMode.${e}`)})),onPick:e=>a(`tabStrip`,e)})]}),(0,U.jsx)(ZN,{title:V(`settings.general.groupFiles`),children:(0,U.jsx)(iP,{settingId:`general.worktree`,label:Q(`general.worktree`),hint:Q(`general.worktreeHint`),value:r.worktreeBase,picks:s,onPick:e=>a(`worktreeBase`,e)})}),(0,U.jsx)(ZN,{title:V(`settings.general.groupTerminal`),hint:Q(`general.terminalHint`),children:(0,U.jsx)(DV,{client:t})})]})}function DV({client:e}){let t=Rw(),n=t.options.scrollbackRows,r=n&&`min`in n?n:{min:100,max:1e5},[i,a]=(0,h.useState)(String(t.prefs.scrollbackRows));return(0,h.useEffect)(()=>a(String(t.prefs.scrollbackRows)),[t.prefs.scrollbackRows]),(0,U.jsx)(QN,{settingId:`general.scrollback`,label:V(`settings.general.scrollback`),hint:Q(`general.scrollbackRowHint`),children:(0,U.jsx)(`input`,{className:XM,inputMode:`numeric`,value:i,"aria-label":Q(`general.scrollbackTitle`),onChange:e=>a(e.target.value),onBlur:()=>{let n=Number(i);if(i.trim()===``||!Number.isInteger(n)){a(String(t.prefs.scrollbackRows));return}let o=Math.min(r.max,Math.max(r.min,n));o===t.prefs.scrollbackRows?a(String(o)):Iw(e,`scrollbackRows`,o)},onKeyDown:e=>e.key===`Enter`&&e.currentTarget.blur()})})}var OV={general:`M2 4.5h7m3 0h2M2 11.5h2m3 0h7M10.5 3v3M5.5 10v3`,appearance:`M8 2a6 6 0 1 0 0 12A6 6 0 0 0 8 2zM8 2v12M8 5h4.5M8 8h6M8 11h4.5`,notifications:`M4 11V7a4 4 0 0 1 8 0v4l1 1.5H3zM6.5 14h3`,snippets:`M3 4h10M3 8h6M3 12h8`,keys:`M2 4.5h12v7H2zM4.5 7h.01M7 7h.01M9.5 7h.01M12 7h.01M5 9.5h6`,engines:`M2.5 3.5h11v9h-11zM5 6.5 7 8l-2 1.5M8.5 10H11`,autoRouting:`M2 4h3l6 8h3M2 12h3l1.5-2M9.5 6 11 4h3`,voice:`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`,connectors:`M6.5 9.5l3-3M5 8 3.5 9.5a2.1 2.1 0 0 0 3 3L8 11M11 8l1.5-1.5a2.1 2.1 0 0 0-3-3L8 5`,plugins:`M2.5 2.5H7V7H2.5zM9 2.5h4.5V7H9zM2.5 9H7v4.5H2.5zM11.25 9v4.5M9 11.25h4.5`,about:`M8 2a6 6 0 1 0 0 12A6 6 0 0 0 8 2zM8 7.5V11M8 5h.01`,feedback:`M2.5 3.5h11v7h-6L4.5 13v-2.5h-2z`,dev:`M5.5 4.5 2 8l3.5 3.5M10.5 4.5 14 8l-3.5 3.5`};function kV({id:e}){return(0,U.jsx)(`svg`,{viewBox:`0 0 16 16`,className:xM,"aria-hidden":`true`,children:(0,U.jsx)(`path`,{d:OV[e]})})}var AV=`prefix.key`;function jV(e,t,n){let r=t.find(e=>e===`enter`||e.endsWith(`+enter`))??t[0];if(r===void 0)return{kind:`more`,recording:e};if(t.includes(`escape`))return{kind:`cancel`};if(e.prefixArmed)return{kind:`done`,mode:`prefix`,keys:[r]};if(e.got.length===0&&n.some(e=>t.includes(e)))return{kind:`more`,recording:{...e,prefixArmed:!0}};let i=[...e.got,r];return i.length<e.slots?{kind:`more`,recording:{...e,got:i}}:{kind:`done`,mode:`direct`,keys:i}}function MV(){return Nk(Ak().filter(e=>e.keys.length>0||e.prefixKeys!==void 0)).flatMap(e=>[...e.rows])}[...Array.from({length:12},(e,t)=>`f${t+1}`)];function NV(e,t){let n=`alternating [${e}, ${t}] pairs`;return{layout:n,slots:[e,t],validateCount:e=>e>=2&&e%2==0?null:`needs ${n} (an even number of chords — got ${e})`}}var PV={"sidebar.goto":NV(`top (double-tap)`,`bottom`),"sidebar.nav":NV(`down`,`up`),"files.nav":NV(`down`,`up`),"diff.review.cursor":NV(`down`,`up`),"sidebar.search.nav":NV(`down`,`up`),"files.search.nav":NV(`down`,`up`),"files.hierarchy":NV(`collapse`,`expand`),"files.tab":NV(`previous tab`,`next tab`),"app.quit":{layout:`[quit confirm, hard exit] (second chord optional)`,validateCount:e=>e<=2?null:`needs [quit confirm, hard exit] (1 or 2 chords — got ${e})`}};function FV(e){return PV[e]?.slots??[]}var IV=`group/cap relative inline-flex flex-none items-stretch rounded-sm border-hairline bg-surface font-mono text-meta has-[:focus-visible]:outline-1 has-[:focus-visible]:outline-offset-1 has-[:focus-visible]:outline-focus`,LV={idle:`border-line text-ink hover:border-line-active`,changed:`border-line text-accent hover:border-line-active`,empty:`border-dashed border-line text-subtle hover:border-line-active`,active:`border-accent text-accent`},RV=`absolute -top-1.5 -right-1.5 flex size-4 cursor-pointer items-center justify-center rounded-full border-hairline border-line bg-paper p-0 leading-none text-subtle hover:border-line-active hover:text-error focus-visible:opacity-100 group-hover/cap:opacity-100 touch:size-5 touch:opacity-100 touch:after:absolute touch:after:-inset-2.5 touch:after:content-['']`;function zV(e){return(0,U.jsxs)(`span`,{className:Kt(IV,LV[e.tone??`idle`]),children:[(0,U.jsx)(`button`,{type:`button`,"aria-label":e.label,className:`px-2 py-1 touch:min-h-10`,onClick:e.onPress,children:e.children}),e.onRemove&&(0,U.jsx)(`button`,{type:`button`,"aria-label":e.removeLabel,className:Kt(RV,!e.removeShown&&`opacity-0`),onClick:e.onRemove,children:`×`})]})}var BV=new Set([`app.quit`,`view.redraw`]),VV=Nk(MV().filter(e=>!BV.has(e.id)));function HV(e){let[t,n]=(0,h.useState)(null),[r,i]=(0,h.useState)(null),a=(0,h.useRef)(t);a.current=t;let o=async(t,n)=>{try{let r=await e.request(`keybindings.set`,{id:t,...n});i({id:t,lines:r.lines}),await Vs(e)}catch(e){z(G(e),`error`)}},s=(0,h.useRef)(o);s.current=o;let c=t!==null;return(0,h.useEffect)(()=>{if(!c)return;let e=e=>{e.preventDefault(),e.stopImmediatePropagation();let t=a.current;if(!t||[`Control`,`Shift`,`Alt`,`Meta`].includes(e.key))return;let r=t.id===`prefix.key`?[]:Rs.get().prefix.firstStrokes,i=jV(t,Xk(e),r);if(i.kind===`more`)return n(i.recording);n(null),i.kind===`done`&&s.current(t.id,{[i.mode]:i.keys})};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},[c]),{recording:t,notice:r,record:e=>{i(null),n({id:e,slots:Math.max(1,FV(e).length),got:[],prefixArmed:!1})},save:(e,t)=>void o(e,t)}}function UV(e,t){if(e.prefixArmed)return Q(`keybindings.recordingPrefix`,{prefix:t});let n=FV(e.id)[e.got.length];return n?Q(`keybindings.recordingSlot`,{slot:n}):Q(`keybindings.recording`)}function WV(e){let{editor:t,id:n}=e,r=()=>t.record(n),i=V(`keys.recordFor`,{name:e.name});if(t.recording?.id===n)return(0,U.jsx)(zV,{tone:`active`,label:i,onPress:r,children:UV(t.recording,e.prefixName)});let a=e.changed?`changed`:`idle`,o=t.notice?.id===n,s=e.prefix??[];return e.direct.length===0&&s.length===0?(0,U.jsx)(zV,{tone:`empty`,label:i,onPress:r,children:Q(`keybindings.unbound`)}):(0,U.jsxs)(U.Fragment,{children:[e.direct.length>0&&(0,U.jsx)(zV,{tone:a,label:i,onPress:r,onRemove:()=>t.save(n,{direct:[]}),removeLabel:V(`keys.removeFor`,{name:e.name}),removeShown:o,children:e.direct.join(` / `)}),s.length>0&&(0,U.jsx)(zV,{tone:a,label:i,onPress:r,onRemove:()=>t.save(n,{prefix:[]}),removeLabel:V(`keys.removeFor`,{name:e.name}),removeShown:o,children:s.map(t=>`${e.prefixName} ${t}`).join(` / `)})]})}function GV(e,t,n,r){let i=e.notice?.id===t?e.notice.lines:[];return i.length>0?(0,U.jsx)(`span`,{className:`text-warning`,children:i.join(` `)}):n===null?r:(0,U.jsxs)(`span`,{className:`inline-flex flex-wrap items-baseline gap-x-2`,children:[Q(`keybindings.defaultKeys`,{keys:n}),(0,U.jsx)(W,{hit:`tight`,onClick:()=>e.save(t,{direct:`default`,prefix:`default`}),children:V(`keys.reset`)})]})}function KV({editor:e,keys:t}){let n=t.prefix.key??Q(`keybindings.prefixDisabled`),r=(e,t=[])=>[...e,...t.map(e=>`${n} ${e}`)].join(` / `);return(0,U.jsx)(U.Fragment,{children:VV.map(i=>(0,U.jsx)(ZN,{title:lA(i.category),children:i.rows.map(i=>{let a=t.rows.find(e=>e.id===i.id),o=sA(i.id);return(0,U.jsx)(QN,{settingId:`keys.binding:${i.id}`,label:o,hint:GV(e,i.id,a?r(i.keys,i.prefixKeys):null),children:(0,U.jsx)(WV,{editor:e,id:i.id,name:o,direct:a?.keys??i.keys,prefix:a?a.prefixKeys:i.prefixKeys,prefixName:n,changed:a!==void 0})},i.id)})},i.category))})}function qV({model:e}){let{client:t}=e,{prefs:n}=Rw(),r=b(Rs),[i,a]=(0,h.useState)(!1);(0,h.useEffect)(()=>void Vs(t),[t]);let o=r.prefix.key??Q(`keybindings.prefixDisabled`),s=HV(t),c=Ls.prefix.firstStrokes,l=r.prefix.firstStrokes.join()!==c.join();return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(ZN,{hint:V(`keys.editHint`),children:[(0,U.jsx)(iP,{settingId:`keys.tapPresentation`,label:Q(`keybindings.tapPresentation`),hint:Q(`keybindings.tapPresentationHint`),value:n.prefixTap,picks:[{value:`local`,label:Q(`keybindings.tapPresentationLocal`)},{value:`guide`,label:Q(`keybindings.tapPresentationGuide`)}],onPick:e=>void Iw(t,`prefixTap`,e)}),(0,U.jsx)(QN,{settingId:`keys.prefix`,label:Q(`keybindings.prefixTitle`,{prefix:o}),hint:GV(s,AV,l?c.join(` / `):null,Q(`keybindings.prefixHint`,{prefix:o,timeout:r.prefix.timeoutMs})),children:(0,U.jsx)(WV,{editor:s,id:AV,name:Q(`keybindings.prefixKey`),direct:r.prefix.firstStrokes,prefixName:o,changed:l})})]}),r.warnings.length>0&&(0,U.jsx)(ZN,{title:Q(`keybindings.warnings`),children:r.warnings.map(e=>(0,U.jsx)(QN,{label:(0,U.jsx)(`span`,{className:`text-warning`,children:e})},e))}),(0,U.jsx)(KV,{editor:s,keys:r}),r.plugins.length>0&&(0,U.jsx)(ZN,{title:V(`keys.pluginChords`),children:r.plugins.map(e=>(0,U.jsx)(QN,{label:(0,U.jsx)(`span`,{className:`font-mono`,children:e.chord}),hint:(0,U.jsx)(`span`,{className:`font-mono`,children:`${e.kind}:${e.target}`})},e.chord))}),(0,U.jsx)(ZN,{settingId:`keys.configFile`,title:Q(`keybindings.configFile`),hint:V(`prefs.keysYaml`),children:(0,U.jsx)(QN,{label:(0,U.jsx)(`span`,{className:`font-mono break-all`,children:r.path+(r.exists?``:Q(`keybindings.notCreated`))}),hint:V(i?`keys.agentFailed`:`keys.agentHint`),children:(0,U.jsx)(W,{variant:`action`,onClick:()=>{a(!1),uj(e,V(`keys.agentPrompt`,{path:r.path})).catch(()=>a(!0))},children:V(`keys.agent`)})})})]})}var JV=`/assets/pulse-3XJkP4CJ.wav`;function YV(e,t){return e===`error`||t}function XV(e,t,n=!1){return n?e.kind===`error`:t||e.kind!==`done`||e.turnEnd!==!0}function ZV(e,t,n=!1){return t&&e.silent!==!0&&!n}function QV(e){return e===`permission_needed`?`needs_input`:e===`error`||e===`rate_limited`||e===`dead`?`error`:e===`turn_complete`?`done`:null}function $V(e,t,n,r){if(e===null)return[];let i=[];for(let[a,o]of t){if(a===n||e.get(a)===o)continue;let t=r(o);t&&i.push({key:a,kind:t})}return i}function eH(){return window.isSecureContext&&`serviceWorker`in navigator&&`PushManager`in window&&`Notification`in window}var tH=()=>navigator.serviceWorker.register(`sw.js`);async function nH(e){if(!eH())return`unsupported`;if(Notification.permission===`denied`)return`blocked`;let t=await(await navigator.serviceWorker.getRegistration())?.pushManager.getSubscription();if(!t)return`off`;let{subscribed:n}=await e.request(`push.status`,{endpoint:t.endpoint});return n?`on`:`off`}async function rH(e){if(!eH())return`unsupported`;if(await Notification.requestPermission()!==`granted`)return`blocked`;let t=await tH();await navigator.serviceWorker.ready;let{publicKey:n}=await e.request(`push.key`),r=await t.pushManager.getSubscription();return r?.options.applicationServerKey&&lH(r.options.applicationServerKey)!==n&&(await r.unsubscribe(),r=null),r??=await t.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:cH(n)}),await e.request(`push.subscribe`,{subscription:r.toJSON()}),`on`}async function iH(e){let t=await(await navigator.serviceWorker.getRegistration())?.pushManager.getSubscription();return t&&(await e.request(`push.unsubscribe`,{endpoint:t.endpoint}),await t.unsubscribe()),`off`}async function aH(e,t,n,r){let i={body:r,tag:`task:${e}:${t}`,icon:`icon-192.png`,data:{taskId:e}},a=`serviceWorker`in navigator?await navigator.serviceWorker.getRegistration():void 0;if(a)return a.showNotification(`Rove — ${n}`,i);let o=new Notification(`Rove — ${n}`,i);o.onclick=()=>{window.focus(),oH?.(e),o.close()}}var oH=null;function sH(e){oH=t=>e.selectWhenListed(t);let t=new URLSearchParams(window.location.search),n=t.get(`task`);if(n){t.delete(`task`);let r=t.toString();history.replaceState(null,``,`${window.location.pathname}${r?`?${r}`:``}${window.location.hash}`),e.selectWhenListed(n)}let r=()=>{oH=null};if(!(`serviceWorker`in navigator))return r;let i=t=>{let n=t.data;n?.type===`rove.openTask`&&typeof n.taskId==`string`&&n.taskId&&e.selectWhenListed(n.taskId)};return navigator.serviceWorker.addEventListener(`message`,i),()=>{r(),navigator.serviceWorker.removeEventListener(`message`,i)}}function cH(e){let t=atob(e.replace(/-/g,`+`).replace(/_/g,`/`));return Uint8Array.from(t,e=>e.charCodeAt(0))}function lH(e){return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}var uH={done:`✓`,needs_input:`?`,error:`✕`};function dH(e){let t=new Audio(JV);t.volume=Math.min(1,Math.max(0,e)),t.play().catch(()=>void 0)}function fH(e,t,n){!document.hidden||typeof Notification>`u`||Notification.permission!==`granted`||aH(e,t,n,uH[t]).catch(()=>void 0)}function pH(){typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission()}function mH(e){let t=new Map;for(let n of e.tasks)n.activity&&t.set(n.id,n.activity.state);return t}function hH(e){let t=(0,h.useRef)(null);(0,h.useEffect)(()=>{let n=()=>{let n=e.tasks.get();if(!n)return;let r=mH(n),i=$V(t.current,r,null,QV);t.current=r;let{prefs:a}=jw.get();if(!a.crossTask)return;let o=e.selection.get().taskId,s=new Map(n.tasks.map(e=>[e.id,e.label]));for(let{key:t,kind:n}of i){if(t===o||!XV({kind:n,turnEnd:!0},a.finishedAlerts))continue;let r=s.get(t)??t;YV(n,a.toast)&&z(`${uH[n]} ${r}`,n===`error`?`error`:`info`,{label:V(`workspace.openTask`),run:()=>e.select(t)}),ZV({},a.sound)&&(dH(a.soundVolume),fH(t,n,r))}};return n(),e.tasks.subscribe(n)},[e])}function gH({client:e}){let[t,n]=(0,h.useState)(null),[r,i]=(0,h.useState)(null);(0,h.useEffect)(()=>{nH(e).then(n,()=>n(`off`))},[e]);let a=t=>{i(null),(t?rH(e):iH(e)).then(n,e=>i(e instanceof Error?e.message:String(e)))},o=r?V(`prefs.pushFailed`,{error:r}):V(t===`unsupported`?`prefs.pushUnsupported`:t===`blocked`?`prefs.pushBlocked`:`prefs.pushHint`);return(0,U.jsx)($N,{settingId:`notifications.push`,label:V(`prefs.push`),hint:o,checked:t===`on`,disabled:t===null||t===`unsupported`||t===`blocked`,onChange:a})}function _H({model:e}){let{client:t}=e,n=Rw(),{prefs:r}=n,i=(e,n)=>void Iw(t,e,n);return(0,U.jsxs)(ZN,{children:[(0,U.jsx)($N,{settingId:`notifications.toast`,label:Q(`general.toast`),hint:V(`settings.notifications.toastNote`),checked:r.toast,onChange:e=>i(`toast`,e)}),(0,U.jsx)($N,{settingId:`notifications.sound`,label:Q(`general.sound`),hint:V(`prefs.soundHint`),checked:r.sound,onChange:e=>{e&&pH(),i(`sound`,e)}}),(0,U.jsx)(iP,{settingId:`notifications.soundVolume`,label:V(`settings.notifications.volume`),hint:V(`prefs.soundVolumeHint`),value:r.soundVolume,picks:zw(n,`soundVolume`).map(e=>({value:e,label:`${Math.round(e*100)}%`})),onPick:e=>{jw.get().prefs.sound&&dH(e),i(`soundVolume`,e)}}),(0,U.jsx)($N,{settingId:`notifications.crossTask`,label:Q(`general.crossTask`),hint:Q(`general.crossTaskHint`),checked:r.crossTask,onChange:e=>i(`crossTask`,e)}),(0,U.jsx)($N,{settingId:`notifications.finishedAlerts`,label:Q(`general.finishedAlerts`),hint:Q(`general.finishedAlertsHint`),checked:r.finishedAlerts,onChange:e=>i(`finishedAlerts`,e)}),(0,U.jsx)(gH,{client:t})]})}var vH={kanban:`kanban`,issues:`issues`};function yH({model:e}){let t=b(e.installedMods),{value:n,failed:r,reload:i}=oP(e.client,`builtinMods.list`),a=n?.mods;if((0,h.useEffect)(()=>{e.refreshMods()},[e]),!a)return r===null?null:(0,U.jsx)(ZN,{title:V(`settings.plugins.builtIn`),children:(0,U.jsx)(sP,{failed:r,onRetry:i})});if(a.length===0)return null;let o=n=>{let r=!t.has(n.id);e.client.request(`builtinMod.setInstalled`,{id:n.id,installed:r}).then(()=>(!r&&M.get()===vH[n.id]&&M.set(null),e.refreshMods())).catch(e=>z(G(e),`error`))};return(0,U.jsx)(ZN,{settingId:`plugins.builtIn`,title:V(`settings.plugins.builtIn`),hint:V(`settings.plugins.builtInHint`),children:a.map(e=>(0,U.jsx)(QN,{label:e.name,hint:e.description,inline:!0,children:(0,U.jsx)(XN,{on:t.has(e.id),"aria-label":V(`settings.plugins.turnOn`,{name:e.name}),onClick:()=>o(e)})},e.id))})}function bH({model:e}){let{client:t}=e,{value:n,failed:r,reload:i}=oP(t,`plugins.list`),a=n?.plugins;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(yH,{model:e}),(0,U.jsx)(ZN,{settingId:`plugins.registered`,title:V(`settings.plugins.registered`),children:a?a.length===0?(0,U.jsx)(`p`,{className:JM,children:V(`settings.plugins.empty`)}):a.map(e=>(0,U.jsx)(QN,{label:e.id,hint:[e.version,e.linked?V(`settings.plugins.linked`):null,e.platformOk===!1?V(`settings.plugins.unsupportedPlatform`):null].filter(Boolean).join(`, `),inline:!0,children:(0,U.jsx)(XN,{on:e.enabled,"aria-label":e.id,onClick:()=>void t.request(`plugin.setEnabled`,{id:e.id,enabled:!e.enabled}).then(i).catch(e=>z(G(e),`error`))})},e.id)):(0,U.jsx)(sP,{failed:r,onRetry:i})})]})}function xH(e){let[t,n]=(0,h.useState)(e.tier.engine),[r,i]=(0,h.useState)(e.tier.model??``),[a,o]=(0,h.useState)(e.tier.effort??``),s=e.engines.find(e=>e.id===t),c=Oe();return(0,U.jsxs)(`form`,{className:jN,onSubmit:n=>{n.preventDefault(),e.onSave(t,s?.takesModel?r.trim():``,a)},onKeyDown:t=>{t.key===`Escape`&&(t.stopPropagation(),e.onCancel())},children:[(0,U.jsx)(wO,{label:Q(`sections.engines`),value:t,picks:e.engines.map(e=>({value:e.id,label:e.name})),onPick:t=>{let r=e.engines.find(e=>e.id===t);n(t),r&&!r.effortLevels.includes(a)&&o(``),r&&!r.takesModel&&i(``)}}),s&&s.effortLevels.length>0&&(0,U.jsx)(wO,{label:V(`prefs.tierEffort`),value:a,picks:[``,...s.effortLevels].map(e=>({value:e,label:e||Q(`autoRouting.engineDefault`)})),onPick:o}),s?.takesModel&&(0,U.jsx)(`input`,{className:YM,value:r,spellCheck:!1,placeholder:Q(`autoRouting.engineDefault`),"aria-label":V(`prefs.tierModel`),onChange:e=>i(e.target.value)}),(0,U.jsxs)(`div`,{className:QM,children:[(0,U.jsx)(W,{variant:c?`action`:`link`,onClick:e.onCancel,children:V(`dialog.cancel`)}),(0,U.jsx)(W,{variant:`filled`,type:`submit`,children:Q(`action.save`)})]})]})}function SH({client:e}){let{value:t,failed:n,reload:r}=oP(e,`autoRouting.get`),[i,a]=(0,h.useState)(null),o=Oe(),s=(t,n)=>e.request(t,n).then(r).catch(e=>z(G(e),`error`));if(!t)return(0,U.jsx)(sP,{failed:n,onRetry:r});let c=t.classifier,l=[{value:`off`,label:Q(`autoRouting.classifierOff`)},{value:`jev`,label:`jev`},...c.canCustom||c.mode===`custom`?[{value:`custom`,label:Q(`autoRouting.classifierCustomLabel`)}]:[]],u=c.mode===`off`?Q(`autoRouting.classifierOffHint`):c.mode===`jev`?Q(`autoRouting.classifierJevHint`):Q(`autoRouting.classifierCustomHint`),d=c.keySource===`env`?Q(`autoRouting.keyPresentEnv`,{env:c.keyEnv??``}):c.keySource===`file`?Q(`autoRouting.keySaved`):c.keyConfigured?Q(`autoRouting.keyMissing`):Q(`autoRouting.keyCustomUnused`);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(ZN,{hint:Q(`autoRouting.hint`),children:[!t.configured&&(0,U.jsx)(QN,{label:(0,U.jsx)(`span`,{className:`text-warning`,children:Q(`autoRouting.unconfigured`)})}),t.tiers.map(e=>{let n=()=>a(i===e.tier?null:e.tier),r=(0,U.jsx)(`span`,{className:`${HM} min-w-0 truncate`,children:[e.engineName,e.model??Q(`autoRouting.engineDefault`),e.effort??Q(`autoRouting.engineDefault`)].join(` · `)}),c=(0,U.jsx)(`span`,{className:`text-meta ${e.block?`text-warning`:`text-success`}`,children:e.block?Q(`autoRouting.unavailable`,{reason:e.block}):Q(`autoRouting.ready`)});return(0,U.jsxs)(`div`,{className:`${kN} ${hM}`,"data-setting-id":`autoRouting.tier.${e.tier}`,children:[o?(0,U.jsxs)(W,{variant:`row`,className:WM,"aria-expanded":i===e.tier,onClick:n,children:[(0,U.jsxs)(`span`,{className:GM,children:[(0,U.jsx)(`span`,{className:VM,children:$j(`tier.${e.tier}`)}),r,(0,U.jsx)(`span`,{className:HM,children:$j(`tierDesc.${e.tier}`)}),c]}),(0,U.jsx)(Bv,{right:i!==e.tier,className:bM})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:AN,children:[(0,U.jsx)(`span`,{className:VM,children:$j(`tier.${e.tier}`)}),r,(0,U.jsx)(W,{className:`ml-auto`,onClick:n,children:V(`prefs.tierEdit`)})]}),(0,U.jsx)(`span`,{className:HM,children:$j(`tierDesc.${e.tier}`)}),c]}),i===e.tier&&(0,U.jsx)(xH,{tier:e,engines:t.engines,onCancel:()=>a(null),onSave:(t,n,r)=>{a(null),s(`autoRouting.setTier`,{tier:e.tier,engine:t,model:n,effort:r})}})]},e.tier)})]}),(0,U.jsxs)(ZN,{title:Q(`autoRouting.classifierTitle`),hint:Q(`autoRouting.classifierHint`),children:[(0,U.jsx)(QN,{label:(0,U.jsx)(`span`,{className:c.mode===`off`?`text-muted`:`text-warning`,children:Q(`autoRouting.classifierDataFlow`)})}),(0,U.jsx)(iP,{settingId:`autoRouting.classifier`,label:Q(`autoRouting.classifierLabel`),hint:u.replace(/^[—\s]+/,``),value:c.mode,picks:l,onPick:e=>void s(`autoRouting.setClassifier`,{mode:e})})]}),(0,U.jsxs)(ZN,{title:V(`prefs.classifierConnection`),hint:V(`prefs.editInTui`),children:[(0,U.jsx)(aP,{settingId:`autoRouting.endpoint`,label:Q(`autoRouting.endpointLabel`),value:c.endpointHost||V(`prefs.unset`)}),(0,U.jsx)(aP,{settingId:`autoRouting.threshold`,label:Q(`autoRouting.thresholdLabel`),value:c.threshold.toFixed(2)}),(0,U.jsx)(QN,{settingId:`autoRouting.key`,label:Q(`autoRouting.keyLabel`),hint:d})]})]})}function CH(){return(0,U.jsxs)(`svg`,{className:lM,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,"aria-hidden":`true`,children:[(0,U.jsx)(`circle`,{cx:`7`,cy:`7`,r:`4.75`,strokeWidth:`1.4`}),(0,U.jsx)(`path`,{d:`M10.5 10.5 14 14`,strokeWidth:`1.4`,strokeLinecap:`round`})]})}function wH(e){return(0,U.jsxs)(`div`,{className:cM,children:[(0,U.jsx)(CH,{}),(0,U.jsx)(`input`,{ref:e.inputRef,type:`text`,role:`searchbox`,className:uM,value:e.query,placeholder:Q(`search.placeholder`),"aria-label":Q(`search.placeholder`),spellCheck:!1,autoComplete:`off`,"data-settings-search":!0,onChange:t=>e.onChange(t.target.value),onKeyDown:e.onKeyDown}),e.query!==``&&(0,U.jsx)(W,{variant:`row`,className:`absolute right-1 grid size-5.5 place-items-center rounded-xs text-body leading-none text-muted hover:bg-hover hover:text-ink focus-visible:outline-1 focus-visible:outline-focus w-narrow:right-1.5 w-narrow:size-7`,"aria-label":Q(`search.clear`),title:Q(`search.clear`),onClick:()=>{e.onChange(``),e.inputRef.current?.focus()},children:`×`})]})}function TH(e){return e.groupLabel&&e.groupLabel!==e.sectionLabel?`${e.sectionLabel} · ${e.groupLabel}`:e.sectionLabel}function EH(e){return e===1?Q(`search.countOne`):Q(`search.count`,{count:e})}function DH(e){let t=(0,h.useRef)(null);return(0,h.useEffect)(()=>{t.current?.querySelector(`[data-selected="true"]`)?.scrollIntoView({block:`nearest`})},[e.selected]),(0,U.jsx)(`div`,{className:SM,children:(0,U.jsxs)(`div`,{className:CM,children:[(0,U.jsxs)(`header`,{className:wM,children:[(0,U.jsx)(`h1`,{className:TM,children:Q(`search.title`)}),(0,U.jsx)(`p`,{className:EM,children:EH(e.results.length)})]}),(0,U.jsx)(`div`,{className:DM,children:e.results.length===0?(0,U.jsxs)(`div`,{className:`flex flex-col items-start gap-2`,children:[(0,U.jsx)(`p`,{className:JM,children:Q(`search.empty`,{query:e.query.trim()})}),(0,U.jsx)(W,{variant:`action`,onClick:e.onClear,children:Q(`search.clear`)})]}):(0,U.jsx)(`div`,{ref:t,className:dM,children:e.results.map((t,n)=>{let r=n===e.selected;return(0,U.jsxs)(W,{variant:`row`,"aria-current":r?`true`:void 0,"data-selected":r?`true`:void 0,"data-search-result":t.id,className:fM(r),onMouseEnter:()=>e.onSelect(n),onClick:()=>e.onPick(t),children:[(0,U.jsxs)(`span`,{className:pM,children:[(0,U.jsx)(`span`,{className:`${VM} truncate`,children:t.label}),(0,U.jsx)(`span`,{className:mM,children:TH(t)})]}),t.hint&&(0,U.jsx)(`span`,{className:`text-meta text-muted [&_a]:text-accent line-clamp-2`,children:t.hint})]},`${t.section}:${t.id}`)})})})]})})}function OH(e){return e.results.length===0?(0,U.jsx)(`p`,{className:JM,children:Q(`search.empty`,{query:e.query.trim()})}):(0,U.jsx)(Fl,{label:EH(e.results.length),children:e.results.map(t=>(0,U.jsxs)(W,{variant:`row`,"data-search-result":t.id,className:`${WM} px-3`,onClick:()=>e.onPick(t),children:[(0,U.jsxs)(`span`,{className:GM,children:[(0,U.jsx)(`span`,{className:`${VM} truncate`,children:t.label}),(0,U.jsx)(`span`,{className:`${HM} truncate`,children:t.hint?`${TH(t)} · ${t.hint}`:TH(t)})]}),(0,U.jsx)(Bv,{right:!0,className:bM})]},`${t.section}:${t.id}`))})}function kH(e,t){let n=t.toLowerCase(),r=e.length*2+2,i=e.charCodeAt(0);for(let t=0;t<n.length;t++){if(n.charCodeAt(t)!==i)continue;let a=Math.min(n.length,t+r),o=1;for(let r=t+1;r<a&&o<e.length;r++)n.charCodeAt(r)===e.charCodeAt(o)&&o++;if(o===e.length)return!0}return!1}function AH(e,t){let n=t.label.toLowerCase();if(n===e)return 0;if(n.startsWith(e))return 1;let r=n.indexOf(e);if(r>=0)return r===0||/[\s/_.:-]/.test(n[r-1]??``)?2:3;let i=t.sectionLabel.toLowerCase(),a=t.groupLabel?.toLowerCase()??``;if(i.includes(e)||a!==``&&a.includes(e))return 4;if(t.keywords)for(let n of t.keywords){let t=n.toLowerCase();if(t===e||t.startsWith(e))return 4;if(t.includes(e))return 5}let o=t.hint?.toLowerCase()??``;if(o!==``&&o.includes(e))return 6;if(e.length>=2){if(kH(e,n))return 7;if(kH(e,i)||a!==``&&kH(e,a))return 8;if(t.keywords?.some(t=>kH(e,t)))return 9}return 1/0}function jH(e,t){let n=t.trim().toLowerCase();if(!n)return[];let r=n.split(/\s+/).filter(Boolean);if(r.length===0)return[];let i=[];for(let t=0;t<e.length;t++){let n=e[t];if(!n)continue;let a=0,o=!0;for(let e of r){let t=AH(e,n);if(!Number.isFinite(t)){o=!1;break}a+=t}o&&i.push({entry:n,score:a,index:t})}return i.sort((e,t)=>e.score-t.score||e.index-t.index),i.map(e=>e.entry)}var MH=new Set([`app.quit`,`view.redraw`]),NH={general:`sections.general`,engines:`sections.engines`,autoRouting:`sections.autoRouting`,plugins:`sections.plugins`,keys:`sections.keys`,feedback:`sections.feedback`,dev:`sections.dev`},PH=e=>{let t=NH[e];return t?Q(t):V(`settings.sections.${e}`)};function FH(e=[]){let t=(e,t,n,r)=>({id:t,section:e,sectionLabel:PH(e),groupLabel:r?.groupLabel,label:n,hint:r?.hint,keywords:r?.keywords}),n=V(`settings.general.groupInterface`),r=V(`settings.general.groupFiles`),i=V(`settings.general.groupTerminal`),a=V(`settings.appearance.groupColours`),o=V(`settings.appearance.groupTasks`),s=V(`settings.about.groupRove`),c=V(`settings.about.access`),l=V(`settings.about.browser`),u=Q(`autoRouting.classifierTitle`),d=V(`prefs.classifierConnection`),f=Q(`dev.experimental`),p=MV().filter(e=>!MH.has(e.id)).map(e=>{let n=e.prefixKeys??[];return t(`keys`,`keys.binding:${e.id}`,sA(e.id),{groupLabel:lA(e.category),hint:[...e.keys,...n.map(e=>`prefix ${e}`)].join(` / `)||void 0,keywords:[`keybinding`,`shortcut`,`hotkey`,`chord`,e.id,...e.keys,...n]})}),m=e.map(e=>t(`engines`,`engines.item:${e.id}`,e.name,{groupLabel:Q(`sections.engines`),keywords:[`engine`,`agent`,`default`,e.id,e.name]}));return[t(`general`,`general.language`,Q(`general.language`),{groupLabel:n,hint:V(`prefs.languageHint`),keywords:[`language`,`locale`,`english`,`chinese`,`中文`,`语言`]}),t(`general`,`general.keyHints`,Q(`general.keyHintsShow`),{groupLabel:n,hint:V(`settings.general.tuiKeyHints`),keywords:[`keyboard`,`hints`,`shortcut`,`status bar`,`key hints`]}),t(`general`,`general.tabStrip`,V(`settings.general.tabStrip`),{groupLabel:n,keywords:[`tab`,`tab strip`,`tabs`,`标签栏`]}),t(`general`,`general.worktree`,Q(`general.worktree`),{groupLabel:r,hint:Q(`general.worktreeHint`),keywords:[`worktree`,`git`,`directory`,`folder`,`location`,`path`,`工作树`]}),t(`general`,`general.scrollback`,V(`settings.general.scrollback`),{groupLabel:i,hint:Q(`general.scrollbackRowHint`),keywords:[`scrollback`,`terminal`,`buffer`,`history`,`rows`,`lines`,`回滚`]}),t(`appearance`,`appearance.theme`,Q(`general.theme`),{hint:V(`prefs.themePreviewHint`),keywords:[`theme`,`palette`,`color`,`package`,`ghostty`,`kitty`,`alacritty`,`wezterm`,`主题`,`配色`]}),t(`appearance`,`appearance.themeMode`,Q(`general.themeMode`),{keywords:[`dark`,`light`,`auto`,`mode`,`theme mode`,`深色`,`浅色`,`明暗`]}),t(`appearance`,`appearance.focusAccent`,Q(`general.focusAccent`),{groupLabel:a,hint:Q(`general.focusAccentHint`),keywords:[`focus`,`accent`,`color`,`primary`,`highlight`,`强调色`]}),t(`appearance`,`appearance.taskColors`,Q(`general.taskColors`),{groupLabel:a,hint:V(`settings.appearance.taskColorsNote`),keywords:[`task colors`,`hue`,`border`,`任务配色`]}),t(`appearance`,`appearance.colorblind`,Q(`general.colorblind`),{groupLabel:a,hint:V(`settings.appearance.colorblindNote`),keywords:[`colorblind`,`diff`,`accessibility`,`a11y`,`色盲`]}),t(`appearance`,`appearance.workingBorder`,Q(`general.workingBorder`),{groupLabel:o,hint:V(`settings.appearance.workingBorderNote`),keywords:[`working border`,`gradient`,`flow`,`still`,`border`,`边框`]}),t(`appearance`,`appearance.runningTitle`,Q(`general.runningTitle`),{groupLabel:o,keywords:[`running title`,`shimmer`,`still`,`title`,`流光`]}),t(`appearance`,`appearance.splitStyle`,Q(`general.splitStyle`),{groupLabel:o,keywords:[`split`,`panes`,`divider`,`box`,`rail`,`rule`,`分屏`]}),t(`appearance`,`appearance.railFold`,Q(`general.railFold`),{groupLabel:o,hint:Q(`general.railFoldHint`),keywords:[`rail`,`sidebar`,`fold`,`collapse`,`glyphs`,`initials`,`折叠`]}),t(`appearance`,`appearance.railGroup`,V(`settings.appearance.railGroup`),{groupLabel:o,keywords:[`task list`,`rail`,`sidebar`,`group`,`project`,`state`,`任务列表`]}),t(`appearance`,`appearance.statusMark`,V(`settings.appearance.statusMark`),{groupLabel:o,keywords:[`task status`,`icon`,`dots`,`status mark`,`engine icon`,`任务状态`]}),t(`notifications`,`notifications.toast`,Q(`general.toast`),{hint:V(`settings.notifications.toastNote`),keywords:[`toast`,`popup`,`notification`,`alert`,`弹窗`]}),t(`notifications`,`notifications.sound`,Q(`general.sound`),{hint:V(`prefs.soundHint`),keywords:[`sound`,`audio`,`chime`,`bell`,`desktop notification`,`声音`,`提示音`]}),t(`notifications`,`notifications.soundVolume`,V(`settings.notifications.volume`),{hint:V(`prefs.soundVolumeHint`),keywords:[`volume`,`chime`,`sound`,`audio`,`音量`]}),t(`notifications`,`notifications.crossTask`,Q(`general.crossTask`),{hint:Q(`general.crossTaskHint`),keywords:[`cross-task`,`background`,`notification`,`跨任务`]}),t(`notifications`,`notifications.finishedAlerts`,Q(`general.finishedAlerts`),{hint:Q(`general.finishedAlertsHint`),keywords:[`finished`,`turns`,`approval`,`alert`,`unread`,`回合完成`]}),t(`notifications`,`notifications.push`,V(`prefs.push`),{hint:V(`prefs.pushHint`),keywords:[`push`,`web push`,`closed`,`notification`,`推送`]}),t(`snippets`,`snippets.list`,V(`settings.sections.snippets`),{hint:V(`settings.pages.snippets`),keywords:[`snippets`,`prompt`,`template`,`@name`,`reusable`,`片段`]}),t(`keys`,`keys.tapPresentation`,Q(`keybindings.tapPresentation`),{hint:Q(`keybindings.tapPresentationHint`),keywords:[`prefix tap`,`guide`,`badges`,`command layer`,`keybindings`,`点按`]}),t(`keys`,`keys.prefix`,Q(`keybindings.prefixKey`),{hint:Q(`keybindings.title`),keywords:[`prefix`,`ctrl+a`,`leader`,`chord`,`keybinding`,`shortcut`,`快捷键`]}),t(`keys`,`keys.configFile`,Q(`keybindings.configFile`),{hint:V(`prefs.keysYaml`),keywords:[`keybindings.yaml`,`yaml`,`config file`,`keybindings`,`配置文件`]}),...p,t(`engines`,`engines.list`,Q(`sections.engines`),{hint:Q(`engines.hint`),keywords:[`engines`,`agent`,`default engine`,`cli`,`coding agent`,`引擎`]}),...m,t(`engines`,`engines.integrations`,Q(`engines.integrations.title`),{hint:Q(`engines.integrations.hint`),keywords:[`hooks`,`integrations`,`install`,`uninstall`,`activity`,`集成`]}),t(`engines`,`engines.skill`,Q(`engines.skill.title`),{hint:Q(`engines.skill.hint`),keywords:[`skill`,`agent skill`,`install`,`技能`]}),t(`engines`,`engines.permissionBypass`,Q(`engines.permissionBypass`),{groupLabel:Q(`engines.permissionsTitle`),hint:Q(`engines.permissionBypassHint`),keywords:[`permission`,`bypass`,`auto approve`,`yolo`,`权限`]}),...[`swift`,`standard`,`deep`].map(e=>t(`autoRouting`,`autoRouting.tier.${e}`,$j(`tier.${e}`),{groupLabel:Q(`sections.autoRouting`),hint:$j(`tierDesc.${e}`),keywords:[`auto routing`,`tier`,`model`,`effort`,e,`自动路由`,`档位`]})),t(`autoRouting`,`autoRouting.classifier`,Q(`autoRouting.classifierLabel`),{groupLabel:u,hint:Q(`autoRouting.classifierHint`),keywords:[`classifier`,`jev`,`custom`,`auto routing`,`分类器`]}),t(`autoRouting`,`autoRouting.endpoint`,Q(`autoRouting.endpointLabel`),{groupLabel:d,keywords:[`endpoint`,`url`,`classifier`,`端点`]}),t(`autoRouting`,`autoRouting.threshold`,Q(`autoRouting.thresholdLabel`),{groupLabel:d,keywords:[`threshold`,`confidence`,`classifier`,`阈值`]}),t(`autoRouting`,`autoRouting.key`,Q(`autoRouting.keyLabel`),{groupLabel:d,keywords:[`api key`,`secret`,`classifier`,`密钥`]}),t(`voice`,`voice.dictation`,V(`voice.setup.dictation`),{hint:V(`settings.pages.voice`),keywords:[`voice`,`dictation`,`speech`,`microphone`,`whisper`,`transcribe`,`asr`,`语音`,`口述`]}),t(`connectors`,`connectors.github`,`GitHub`,{hint:V(`settings.connectors.githubDescription`),keywords:[`github`,`gh`,`git`,`pr`,`ssh`,`machines`,`account`,`账号`]}),t(`connectors`,`connectors.chat`,V(`settings.connectors.chat`),{hint:V(`settings.connectors.chatHint`),keywords:[`chat`,`wechat`,`weixin`,`lark`,`feishu`,`bot`,`微信`,`飞书`,`聊天`]}),t(`connectors`,`connectors.phone`,V(`settings.connectors.phoneTitle`),{hint:V(`settings.connectors.phoneHint`),keywords:[`phone`,`pair`,`qr`,`ios`,`iphone`,`android`,`mobile`,`relay`,`手机`,`配对`,`扫码`]}),t(`connectors`,`connectors.inbox`,V(`settings.connectors.inboxTitle`),{hint:V(`settings.connectors.inboxHint`),keywords:[`inbox`,`encrypted`,`token`,`external`,`age`,`relay`,`收件箱`]}),t(`plugins`,`plugins.builtIn`,V(`settings.plugins.builtIn`),{hint:V(`settings.plugins.builtInHint`),keywords:[`mods`,`built-in`,`kanban`,`issues`,`plugins`,`内置`,`插件`]}),t(`plugins`,`plugins.registered`,V(`settings.plugins.registered`),{hint:V(`settings.pages.plugins`),keywords:[`plugins`,`registered`,`extensions`,`插件`]}),t(`about`,`about.daemon`,V(`settings.about.daemon`),{groupLabel:s,hint:V(`settings.pages.about`),keywords:[`daemon`,`version`,`computer`,`host`,`build`,`守护进程`,`版本`]}),t(`about`,`about.updateChannel`,Q(`general.updateChannelTitle`),{groupLabel:s,hint:Q(`general.updatesHint`),keywords:[`update`,`channel`,`stable`,`next`,`nightly`,`release`,`发布渠道`,`更新`]}),t(`about`,`about.updateNotify`,Q(`general.updateNotify`),{groupLabel:s,hint:Q(`general.updateNotifyHint`),keywords:[`update`,`notify`,`version`,`更新通知`]}),t(`about`,`about.updateCheck`,Q(`general.updates`),{groupLabel:s,hint:Q(`general.updateCheckHint`),keywords:[`check for updates`,`update`,`npm`,`upgrade`,`检查更新`]}),t(`about`,`about.signIn`,V(`settings.about.signIn`),{groupLabel:c,keywords:[`sign in`,`login`,`password`,`token`,`auth`,`access`,`security`,`登录`,`密码`]}),t(`about`,`about.signOut`,V(`settings.about.signOut`),{groupLabel:l,hint:V(`settings.about.browserHint`),keywords:[`sign out`,`logout`,`token`,`browser`,`退出登录`]}),t(`feedback`,`feedback.form`,Q(`sections.feedback`),{hint:V(`settings.pages.feedback`),keywords:[`feedback`,`bug`,`idea`,`question`,`issue`,`github`,`report`,`反馈`]}),t(`dev`,`dev.remoteProjects`,Q(`dev.remote`),{groupLabel:f,hint:Q(`dev.remoteHint`),keywords:[`remote`,`ssh`,`experimental`,`dev`,`远程项目`]}),t(`dev`,`dev.autoStatus`,Q(`dev.autoStatus`),{groupLabel:f,hint:Q(`dev.autoStatusHint`),keywords:[`auto status`,`in_progress`,`in_review`,`experimental`,`dev`,`自动状态`]}),t(`dev`,`dev.dispatcher`,Q(`dev.dispatcher`),{groupLabel:f,hint:Q(`dev.dispatcherHint`),keywords:[`dispatcher`,`field notes`,`note`,`experimental`,`dev`,`现场笔记`]}),t(`dev`,`dev.restart`,Q(`dev.restart`),{hint:V(`prefs.restartHint`),keywords:[`restart`,`daemon`,`backend`,`dev`,`重启`]}),t(`dev`,`dev.reset`,Q(`dev.reset`),{hint:V(`prefs.resetHint`),keywords:[`reset`,`wipe`,`clear`,`state.json`,`tasks.json`,`dev`,`重置`]})]}function IH(e,t=[]){return jH(FH(t),e)}var LH=[{id:`preferences`,sections:[`general`,`appearance`,`notifications`,`snippets`,`keys`]},{id:`agents`,sections:[`engines`,`autoRouting`,`voice`,`connectors`,`plugins`]},{id:`more`,sections:[`about`,`feedback`,`dev`]}],RH=e=>({section:e??`general`,drilled:e!==void 0});function zH(e,t){return t&&e.drilled?`list`:`close`}var BH=e=>e.split(`
102
- `,1)[0]??``;function VH(e){let t=Oe(),[n,r]=(0,h.useState)(e.editing?.name??``),[i,a]=(0,h.useState)(e.editing?.text??``),o=ni(i),[s,c]=(0,h.useState)(!1),l=my.test(n)&&i.trim()!==``;return(0,U.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:t=>{t.preventDefault(),l&&(c(!0),fy(e.client,{name:n,text:i}).then(e.onDone).catch(e=>{z(G(e),`error`),c(!1)}))},children:[(0,U.jsxs)(`label`,{className:ZM,children:[(0,U.jsx)(`span`,{className:ii,children:V(`snippets.name`)}),(0,U.jsx)(`input`,{className:`${YM} w-full font-mono`,value:n,maxLength:32,spellCheck:!1,autoComplete:`off`,autoFocus:!e.editing,readOnly:e.editing!==void 0,placeholder:V(`snippets.namePlaceholder`),onChange:e=>r(e.target.value)}),n!==``&&!my.test(n)&&(0,U.jsx)(`span`,{className:`text-meta text-muted [&_a]:text-accent`,children:V(`snippets.badName`)})]}),(0,U.jsxs)(`label`,{className:ZM,children:[(0,U.jsx)(`span`,{className:ii,children:V(`snippets.text`)}),(0,U.jsx)(`textarea`,{ref:o,className:`${YM} ${ai} w-full`,rows:5,value:i,maxLength:8e3,placeholder:V(`snippets.textPlaceholder`),onChange:e=>a(e.target.value)})]}),t?(0,U.jsxs)(`div`,{className:QM,children:[e.onRemove&&(0,U.jsx)(W,{variant:`actionDanger`,className:`mr-auto`,onClick:e.onRemove,children:V(`snippets.phone.remove`)}),(0,U.jsx)(W,{variant:`action`,onClick:e.onDone,children:V(`snippets.phone.cancel`)}),(0,U.jsx)(W,{variant:`filled`,type:`submit`,disabled:s||!l,children:V(`snippets.phone.save`)})]}):(0,U.jsxs)(`div`,{className:QM,children:[(0,U.jsx)(W,{onClick:e.onDone,children:V(`snippets.cancel`)}),(0,U.jsx)(W,{type:`submit`,disabled:s||!l,children:V(`snippets.save`)})]})]})}function HH({model:e}){let{client:t}=e,n=uy(),[r,i]=(0,h.useState)(null),[a,o]=(0,h.useState)({done:!1,failed:null}),s=(0,h.useCallback)(()=>dy(t).then(()=>o({done:!0,failed:null}),e=>o(t=>({...t,failed:G(e)}))),[t]);(0,h.useEffect)(()=>t.onOpen(()=>void s()),[t,s]);let c=Oe(),l=e=>void py(t,e).then(()=>{i(null),z(V(`snippets.removed`,{name:e}))}).catch(e=>z(G(e),`error`));return(0,U.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,U.jsxs)(ZN,{settingId:`snippets.list`,children:[n.length===0&&r===null&&(a.done?(0,U.jsx)(QN,{label:V(`snippets.empty`)}):(0,U.jsx)(sP,{failed:a.failed,onRetry:s})),n.map(e=>c?(0,U.jsxs)(W,{variant:`row`,className:WM,onClick:()=>i(e),children:[(0,U.jsxs)(`span`,{className:GM,children:[(0,U.jsxs)(`span`,{className:`${VM} font-mono`,children:[`@`,e.name]}),(0,U.jsx)(`span`,{className:`${HM} truncate`,children:BH(e.text)})]}),(0,U.jsx)(Bv,{right:!0,className:bM})]},e.name):(0,U.jsxs)(QN,{label:(0,U.jsxs)(`span`,{className:`font-mono`,children:[`@`,e.name]}),hint:BH(e.text),children:[(0,U.jsx)(W,{onClick:()=>i(e),children:V(`snippets.edit`)}),(0,U.jsx)(W,{onClick:()=>l(e.name),children:V(`snippets.remove`)})]},e.name)),c&&r===null&&(0,U.jsx)(W,{variant:`row`,className:`flex min-h-11 w-full items-center py-2 text-left font-sans text-title text-accent active:bg-hover`,onClick:()=>i(`new`),children:V(`snippets.phone.add`)})]}),c&&r===null?null:r===null?(0,U.jsx)(`div`,{className:QM,children:(0,U.jsx)(W,{onClick:()=>i(`new`),children:V(`snippets.add`)})}):(0,U.jsx)(VH,{client:t,editing:r===`new`?void 0:r,onDone:()=>i(null),onRemove:c&&r!==`new`?()=>l(r.name):void 0},r===`new`?`new`:r.name)]})}function UH(e,t){return t===`left`?100-Math.min(100,Math.max(0,e)):e}var WH=e=>e>=95?`crit`:e>=75?`warn`:`ok`,GH=e=>String(e).padStart(2,`0`);function KH(e,t){if(e==null||e<=t)return``;let n=new Date(e),r=`${GH(n.getHours())}:${GH(n.getMinutes())}`;return e-t<864e5?`→ ${r}`:`→ ${n.getMonth()+1}/${n.getDate()} ${r}`}function qH(e,t,n=`used`){let r=e.windows.find(e=>e.kind===`session`)??e.windows[0];return r?{label:r.label,percentText:`${UH(r.percent,n)}%`,resetText:KH(r.resetsAt,t),tone:WH(r.percent)}:null}var JH=1e4;function YH({client:e,inset:t=!0}){let n=b(e.conn),[r,i]=(0,h.useState)(null);(0,h.useEffect)(()=>{if(n.state!==`open`)return;let t=!0,r=()=>e.request(`usage.get`,{}).then(e=>{t&&i(e.usage)}).catch(()=>{});r();let a=ua(JH,r);return()=>{t=!1,a()}},[e,n.state]);let a=Date.now(),o=(r??[]).flatMap(e=>{let t=qH({capturedAt:e.capturedAt,windows:e.windows},a);return t?[{vendor:e.vendor,name:e.name,chip:t}]:[]});return o.length===0?null:(0,U.jsx)(`div`,{className:`${er} ${t?`px-2`:``}`,children:o.map(({vendor:e,name:t,chip:n})=>{let r=Math.min(100,Math.max(0,Number.parseInt(n.percentText,10)||0));return(0,U.jsxs)(W,{variant:`row`,className:tr,title:`${t} · ${n.label} ${n.percentText} ${n.resetText}`.trim(),"aria-label":`${V(`usage.open`)}: ${t}`,onClick:()=>{B(),xe(`usage`)},children:[(0,U.jsx)(`span`,{className:`truncate`,children:t}),(0,U.jsx)(`span`,{className:ir(n.tone),style:{"--fill":`${r}%`}}),(0,U.jsxs)(`span`,{children:[n.label,` `,(0,U.jsx)(`span`,{className:nr[n.tone],children:n.percentText})]})]},e)})})}var XH=2e3;function ZH(e){let[t,n]=(0,h.useState)(null),[r,i]=(0,h.useState)(null),a=(0,h.useCallback)(t=>{n(t),Wb(e,t.available)},[e]),o=(0,h.useCallback)(()=>e.request(`voice.status`).then(a,e=>i(G(e))),[e,a]);(0,h.useEffect)(()=>void o(),[o]);let s=t?.setup?.install.phase===`running`||t?.available===!0&&!t.ready;return(0,h.useEffect)(()=>{if(!s)return;let e=window.setInterval(()=>void o(),XH);return()=>window.clearInterval(e)},[s,o]),{status:t,error:r,setError:i,accept:a}}function QH(e){let[t,n]=(0,h.useState)(!1);return t?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:UM,children:e.ask}),(0,U.jsx)(W,{variant:`action`,disabled:e.disabled,onClick:()=>{n(!1),e.onConfirm()},children:e.label}),(0,U.jsx)(W,{variant:`action`,onClick:()=>n(!1),children:V(`voice.setup.cancel`)})]}):(0,U.jsx)(W,{variant:`action`,disabled:e.disabled,onClick:()=>n(!0),children:e.label})}function $H({client:e}){let{status:t,error:n,setError:r,accept:i}=ZH(e),[a,o]=(0,h.useState)(!1),s=t?.setup,[c,l]=(0,h.useState)(!1),[u,d]=(0,h.useState)(``),[f,p]=(0,h.useState)(``),[m,g]=(0,h.useState)(``);(0,h.useEffect)(()=>{s?.cloud&&(d(e=>e||s.cloud?.baseURL||``),p(e=>e||s.cloud?.model||``))},[s?.cloud]);let _=(t,n)=>(o(!0),r(null),e.request(t,n).then(i,e=>r(G(e))).finally(()=>o(!1)));if(!t)return(0,U.jsx)(`p`,{className:JM,children:n??`…`});if(!s)return(0,U.jsx)(`p`,{className:JM,children:t.model??V(`voice.setup.unavailable`)});let v=s.install,y=v.phase===`running`,b=c?`cloud`:s.backend,x=e=>{if(e===`cloud`&&!s.cloud?.hasKey)return l(!0);l(!1),_(`voice.configure`,{backend:e})},S=b===`off`?V(`voice.setup.offHint`):c?V(`voice.setup.cloudNeeded`):b===`local`&&!s.localInstalled?V(y?`voice.setup.localInstalling`:`voice.setup.localNeeded`):t.ready?V(`voice.setup.ready`,{model:t.model??``}):t.error??V(`voice.setup.starting`),C=y?v.line??V(`voice.setup.installing`):v.phase===`failed`&&!s.localInstalled?V(`voice.setup.failed`,{line:v.line??``}):s.localInstalled?V(`voice.setup.installed`):s.blocked??V(`voice.setup.localHint`);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(ZN,{children:(0,U.jsx)(iP,{settingId:`voice.dictation`,label:V(`voice.setup.dictation`),hint:S,value:b,picks:[`off`,`local`,`cloud`].map(e=>({value:e,label:V(`voice.setup.backend.${e}`)})),onPick:x})}),(b===`local`||s.localInstalled||y)&&(0,U.jsx)(ZN,{title:V(`voice.setup.backend.local`),children:(0,U.jsx)(QN,{label:V(`voice.setup.localTitle`),hint:C,children:y?(0,U.jsx)(`span`,{className:`max-w-90 min-w-0 truncate font-mono text-meta text-muted [overflow-wrap:anywhere]`,children:V(`voice.setup.installing`)}):s.localInstalled?(0,U.jsx)(QH,{label:V(`voice.setup.uninstall`),ask:V(`voice.setup.uninstallAsk`),disabled:a,onConfirm:()=>void _(`voice.uninstall`)}):!s.blocked&&(0,U.jsx)(W,{variant:`action`,disabled:a,onClick:()=>void _(`voice.install`),children:V(`voice.setup.install`)})})}),(b===`cloud`||s.cloud)&&(0,U.jsx)(ZN,{title:V(`voice.setup.cloudTitle`),hint:V(`voice.setup.cloudHint`),children:(0,U.jsxs)(`form`,{className:`flex flex-col gap-3 py-3`,onSubmit:e=>{e.preventDefault(),_(`voice.configure`,{backend:`cloud`,baseURL:u,model:f,apiKey:m}).then(()=>l(!1)),g(``)},children:[(0,U.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(`span`,{className:`font-sans text-meta font-normal normal-nums text-muted`,children:V(`voice.setup.baseURL`)}),(0,U.jsx)(`input`,{className:`${YM} font-mono`,value:u,placeholder:`https://api.openai.com/v1`,spellCheck:!1,autoComplete:`off`,onChange:e=>d(e.target.value)})]}),(0,U.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(`span`,{className:`font-sans text-meta font-normal normal-nums text-muted`,children:V(`voice.setup.model`)}),(0,U.jsx)(`input`,{className:`${YM} font-mono`,value:f,placeholder:`gpt-4o-mini-transcribe`,spellCheck:!1,autoComplete:`off`,onChange:e=>p(e.target.value)})]}),(0,U.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(`span`,{className:`font-sans text-meta font-normal normal-nums text-muted`,children:V(`voice.setup.apiKey`)}),(0,U.jsx)(`input`,{className:`${YM} font-mono`,type:`password`,value:m,placeholder:s.cloud?.hasKey?V(`voice.setup.keySaved`):``,autoComplete:`off`,onChange:e=>g(e.target.value)})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2.5`,children:[s.cloud&&(0,U.jsx)(QH,{label:V(`voice.setup.forget`),ask:V(`voice.setup.forgetAsk`),disabled:a,onConfirm:()=>{d(``),p(``),_(`voice.forgetCloud`)}}),(0,U.jsx)(W,{variant:`action`,type:`submit`,disabled:a||!u.trim()||!f.trim()||!(m||s.cloud?.hasKey),children:V(s.backend===`cloud`?`voice.setup.save`:`voice.setup.saveAndUse`)})]})]})}),n&&(0,U.jsx)(`p`,{className:`m-0 py-3 text-body text-muted text-error`,children:n})]})}var eU={general:e=>(0,U.jsx)(EV,{model:e}),appearance:e=>(0,U.jsx)(Sz,{model:e}),notifications:e=>(0,U.jsx)(_H,{model:e}),snippets:e=>(0,U.jsx)(HH,{model:e}),keys:e=>(0,U.jsx)(qV,{model:e}),engines:e=>(0,U.jsx)(hV,{model:e}),autoRouting:e=>(0,U.jsx)(SH,{client:e.client}),voice:e=>(0,U.jsx)($H,{client:e.client}),connectors:e=>(0,U.jsx)(QB,{model:e}),plugins:e=>(0,U.jsx)(bH,{model:e}),about:e=>(0,U.jsx)(pF,{client:e.client}),feedback:e=>(0,U.jsx)(CV,{model:e}),dev:e=>(0,U.jsx)(eV,{client:e.client})},tU=1800,nU=4e3;function rU(e){return(e?.engines??[]).map(e=>({id:e.id,name:e.name??e.id}))}function iU(e){return e.narrow?(0,U.jsxs)(`nav`,{className:Nl,"aria-label":V(`settings.title`),children:[(0,U.jsx)(Pl,{children:V(`settings.title`)}),e.searchField,e.searching?e.phoneResults:(0,U.jsxs)(U.Fragment,{children:[LH.map(t=>(0,U.jsx)(Fl,{label:V(`settings.groups.${t.id}`),children:t.sections.map(t=>(0,U.jsxs)(W,{variant:`row`,className:Il,"data-section":t,onClick:()=>e.onPick(t),children:[(0,U.jsx)(kV,{id:t}),PH(t),(0,U.jsx)(Bv,{right:!0,className:bM})]},t))},t.id)),e.foot]})]}):(0,U.jsxs)(`nav`,{className:aM,"aria-label":V(`settings.title`),children:[(0,U.jsxs)(`div`,{className:sM,children:[(0,U.jsx)(`h1`,{className:oM,children:V(`settings.title`)}),e.searchField]}),LH.map(t=>(0,U.jsxs)(`div`,{className:gM,children:[(0,U.jsx)(`p`,{className:_M,children:V(`settings.groups.${t.id}`)}),(0,U.jsx)(`div`,{className:vM,children:t.sections.map(t=>{let n=!e.searching&&e.current===t;return(0,U.jsx)(W,{variant:`row`,"data-section":t,className:yM(n),"aria-current":n?`page`:void 0,onClick:()=>e.onPick(t),children:PH(t)},t)})})]},t.id))]})}function aU({model:e,section:t}){let n=H(),[r,i]=(0,h.useState)(()=>RH(t)),[a,o]=(0,h.useState)(``),[s,c]=(0,h.useState)(0),[l,u]=(0,h.useState)(null),[d,f]=(0,h.useState)(()=>rU(J(e.client,`engines.list`))),p=(0,h.useRef)(null),m=(0,h.useRef)(null),g=Oe();(0,h.useEffect)(()=>{let t=!0;return ss(e.client,`engines.list`).then(e=>{t&&f(rU(e))},()=>{}),()=>{t=!1}},[e.client]);let _=a.trim()!==``,v=(0,h.useMemo)(()=>IH(a,d),[a,d,n]),y=Math.min(s,Math.max(0,v.length-1)),x=()=>{o(``),c(0)},S=e=>{x(),i({section:e.section,drilled:!0}),u(t=>({section:e.section,id:e.id,seq:(t?.seq??0)+1}))},C=()=>{if(_){x();return}zH(r,g)===`list`?i({...r,drilled:!1}):B()};(0,h.useEffect)(()=>{let e=document.querySelector(`.dialog`);e&&!e.contains(document.activeElement)&&e.focus()},[]),(0,h.useEffect)(()=>{let e=e=>{if(!e.defaultPrevented){if(e.key===`Escape`){e.preventDefault(),C();return}if(e.key===`/`&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let t=e.target;if(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement)return;e.preventDefault(),p.current?.focus()}}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)});let w=b(Pe)===`panel`&&g&&r.drilled,T=!g||!r.drilled||w,E=!g||r.drilled;(0,h.useEffect)(()=>{if(!l||!E||_||l.section!==r.section)return;let e=m.current;if(!e)return;let t=`[data-setting-id="${CSS.escape(l.id)}"]`,n=null,i=null,a=null,o=e=>{let t=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1;e.scrollIntoView({block:`center`,behavior:t?`auto`:`smooth`}),e.dataset.settingFlash=`true`,a=e,n=window.setTimeout(()=>{delete e.dataset.settingFlash},tU)},s=e.querySelector(t);if(s)return o(s),()=>{n!==null&&window.clearTimeout(n),a&&delete a.dataset.settingFlash};let c=new MutationObserver(()=>{let n=e.querySelector(t);n&&(c.disconnect(),i!==null&&window.clearTimeout(i),o(n))});return c.observe(e,{childList:!0,subtree:!0}),i=window.setTimeout(()=>c.disconnect(),nU),()=>{c.disconnect(),i!==null&&window.clearTimeout(i),n!==null&&window.clearTimeout(n),a&&delete a.dataset.settingFlash}},[l,E,_,r.section]);let D=(0,U.jsx)(wH,{inputRef:p,query:a,onChange:e=>{o(e),c(0)},onKeyDown:e=>{if(e.key===`ArrowDown`&&v.length>0)e.preventDefault(),c(Math.min(v.length-1,y+1));else if(e.key===`ArrowUp`&&v.length>0)e.preventDefault(),c(Math.max(0,y-1));else if(e.key===`Enter`&&v.length>0){e.preventDefault();let t=v[y];t&&S(t)}else e.key===`Escape`&&a!==``&&(e.preventDefault(),e.stopPropagation(),e.nativeEvent.stopImmediatePropagation(),x())}});return(0,U.jsx)(`div`,{className:tM,onMouseDown:e=>e.target===e.currentTarget&&B(),children:(0,U.jsxs)(`dialog`,{ref:g&&!r.drilled?Fe(B):void 0,tabIndex:-1,open:!0,className:nM,"aria-label":V(`settings.title`),onKeyDown:e=>{let t=e.target;e.key===`Escape`&&(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)&&(t.blur(),e.stopPropagation(),e.nativeEvent.stopImmediatePropagation())},children:[g?T&&(0,U.jsx)(Ml,{frame:`screen`,back:{label:ge.get()===`sidebar`?uA(`narrowBack`):V(`dialog.close`),onClick:B}}):(0,U.jsx)(W,{variant:`row`,className:rM,"aria-label":V(`dialog.close`),title:V(`dialog.close`),onClick:B,children:`×`}),T&&(0,U.jsx)(iU,{current:r.section,narrow:g,searching:_,searchField:D,phoneResults:g&&_?(0,U.jsx)(OH,{query:a,results:v,onPick:S}):void 0,onPick:e=>{x(),i({section:e,drilled:!0})},foot:g&&(0,U.jsx)(`div`,{className:`rounded-[12px] bg-surface px-3 py-1`,children:(0,U.jsx)(YH,{client:e.client,inset:!1})})}),E&&(0,U.jsxs)(`div`,{ref:g?Fe(C):void 0,className:iM(w),children:[g&&(0,U.jsx)(Ml,{frame:`screen`,back:{label:V(`settings.title`),onClick:C},title:PH(r.section),titleKind:`heading`}),!g&&_?(0,U.jsx)(DH,{query:a,results:v,selected:y,onSelect:c,onPick:S,onClear:()=>{x(),p.current?.focus()}}):(0,U.jsx)(`div`,{ref:m,className:`min-h-0 min-w-0 flex-1 overflow-y-auto scrollbar-none`,children:(0,U.jsxs)(`div`,{className:`flex w-full flex-col gap-7 px-8 pt-7 pb-10 w-narrow:gap-4 w-narrow:px-3 w-narrow:pt-0 w-narrow:pb-10`,children:[(0,U.jsxs)(`header`,{className:`flex flex-col gap-1 pr-8 w-narrow:pr-0`,children:[!g&&(0,U.jsx)(`h1`,{className:`m-0 font-sans text-display font-semibold normal-nums text-ink`,children:PH(r.section)}),(0,U.jsx)(`p`,{className:`m-0 text-body text-muted w-narrow:px-3 w-narrow:text-meta`,children:V(`settings.pages.${r.section}`)})]}),(0,U.jsx)(`div`,{className:`flex flex-col gap-7 w-narrow:gap-4`,children:eU[r.section](e)})]})},r.section)]})]})})}function oU(e){return e.kind===`leaf`?[e]:e.children.flatMap(oU)}function sU(e){return!!e&&oU(e.root).length>1}function cU(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 lU(e,t,n=1){let r=oU(e.root).map(e=>e.id),i=r.indexOf(t);return r[(Math.max(0,i)+n+r.length)%r.length]??t}function uU(e,t){let n=new Map,r=new Map;for(let i of oU(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 dU(e,t,n){return e.kind===`engine`&&oU(t.root).some(e=>e.id===n&&e.own)}function fU(e){return e.alive!==!1||!!e.split&&!oU(e.split.root).some(e=>e.own)}function pU(e){return oU(e.root).map(e=>e.id).join(`,`)}var mU=e=>{let{taskId:t}=e.selection.get();return e.tasks.get()?.tasks.find(e=>e.id===t)??null},hU=e=>{let{taskId:t,tabId:n}=e.selection.get(),r=t?e.tabs.get()[t]?.find(e=>e.id===n):void 0;return!!r&&!sU(r.split)},gU=[{id:`app.refresh`,live:()=>Va.get().stale,run:e=>Ga(e.client)},{id:`palette.open`,live:()=>!0,run:Fj},{id:`task.new.global`,live:()=>!0,run:()=>Yb()},{id:`chat.tab.fork`,live:e=>!!mU(e),run:e=>{let t=mU(e);t&&k.set((0,U.jsx)(CA,{model:e,taskId:t.id,context:`continue`}))}},{id:`chat.fork.new`,live:e=>!!mU(e),run:e=>{let t=mU(e);t&&k.set((0,U.jsx)(CA,{model:e,taskId:t.id,destination:`fork`}))}},{id:`settings.open`,live:()=>!0,run:e=>k.set((0,U.jsx)(aU,{model:e}))},{id:`inbox.show`,live:()=>!0,run:e=>k.set((0,U.jsx)(Mu,{model:e}))},{id:`focus.previous`,live:()=>!0,run:()=>Os(-1)},{id:`focus.next`,live:()=>!0,run:()=>Os(1)},{id:`workspace.filesToggle`,live:e=>!!mU(e),run:e=>{let t=mU(e);t&&vw(t.id,`files`)}},{id:`files.createPR`,live:e=>!!mU(e),run:e=>{let t=mU(e);t&&e.client.request(`tab.requestPR`,e.engineTarget(t.id)).then(()=>z(V(`files.prRequested`))).catch(e=>z(e instanceof Error?e.message:String(e),`error`))}},{id:`chat.tab.close`,live:e=>!!e.selection.get().tabId&&hU(e),run:e=>{let{taskId:t,tabId:n}=e.selection.get();!t||!n||e.closeTab(t,n).catch(e=>z(e instanceof Error?e.message:String(e),`error`))}},{id:`kanban.open`,live:e=>e.installedMods.get().has(`kanban`),run:()=>xe(`kanban`)},{id:`automations.open`,live:()=>!0,run:()=>xe(`routines`)},{id:`workItems.open`,live:e=>e.installedMods.get().has(`issues`),run:()=>xe(`issues`)},{id:`task.moveMode`,live:e=>!!zj(e),run:()=>{Ek(!Tk.get()),document.querySelector(`.rail`)?.focus()}},{id:`files.syncBase`,live:e=>zj(e)?.kind===`task`,run:e=>{let t=zj(e);t&&Sj(e,t.id)}},{id:`files.fixChecks`,live:e=>!!zj(e),run:e=>{let t=zj(e);t&&wj(e,t.id,V(`taskops.fixSent`))}},{id:`task.openEditor`,live:e=>!!zj(e),run:e=>{let t=zj(e);t&&Tj(e,t.id)}}];$s(()=>gU.map(e=>({id:e.id,chords:Js(e.id),prefix:!0,live:e.live,run:e.run})));function _U(e){return Zk(e[0]??``)}function vU(e,t){let n=ic(),r=tc().filter(t=>t.prefix&&nc(t,n)&&t.live?.(e)!==!1);for(let e of t){let t=r.filter(t=>t.chords.includes(e)).sort((e,t)=>rc(e,n)-rc(t,n))[0];if(t)return t}}var yU=null,bU=null;function xU(){yU=null,bU!==null&&window.clearTimeout(bU),bU=null;let e=hA.get();e.guide?.kind===`prefix`&&hA.set({...e,guide:null})}function SU(){if(yU!==null){xU();return}k.get()||Us()===null||(yU=Date.now(),hA.set({...hA.get(),guide:{kind:`prefix`,armedAt:yU}}),bU!==null&&window.clearTimeout(bU),bU=window.setTimeout(xU,Rs.get().prefix.timeoutMs))}function CU(e,t){xU();let n=typeof t==`string`?[t]:t,r=vU(e,n);_A(_U(n),r?.id??null),r?.run(e)}var wU=null;function TU(){wU!==null&&window.clearTimeout(wU),wU=null;let e=hA.get();e.guide?.kind===`direct`&&hA.set({...e,guide:null})}function EU(){wU!==null||k.get()||(wU=window.setTimeout(()=>{xU(),hA.set({...hA.get(),guide:{kind:`direct`}})},400))}function DU(e){(0,h.useEffect)(()=>{let t=t=>{if(t.key===`Control`){t.repeat||EU();return}if(TU(),[`Shift`,`Alt`,`Meta`].includes(t.key))return;let n=Xk(t),{firstStrokes:r,timeoutMs:i}=Rs.get().prefix;if(yU!==null&&Date.now()-yU<=i){if(t.preventDefault(),t.stopImmediatePropagation(),t.key===`Escape`)return xU();CU(e,n);return}xU();let a=document.activeElement,o=pc(a instanceof HTMLElement?a:null)===`field`;!k.get()&&!o&&n.some(e=>r.includes(e))&&(t.preventDefault(),t.stopImmediatePropagation(),SU())},n=e=>e.key===`Control`&&TU(),r=e=>{yU!==null&&(e.target instanceof Element&&e.target.closest(`.prefix-guide, .shortcut-badge, [data-prefix-arm]`)||xU())};return window.addEventListener(`keydown`,t,{capture:!0}),window.addEventListener(`keyup`,n,{capture:!0}),window.addEventListener(`pointerdown`,r,{capture:!0}),window.addEventListener(`blur`,TU),()=>{window.removeEventListener(`keydown`,t,{capture:!0}),window.removeEventListener(`keyup`,n,{capture:!0}),window.removeEventListener(`pointerdown`,r,{capture:!0}),window.removeEventListener(`blur`,TU),TU(),xU()}},[e])}function OU(e){let t=ic(),n=new Map;for(let r of tc()){if(!r.prefix||!nc(r,t)||r.live?.(e)===!1)continue;let i=rc(r,t);for(let e of r.chords){let t=n.get(e);(!t||i<t.rank)&&n.set(e,{action:r.id,rank:i})}}return[...n].map(([e,{action:t}])=>({stroke:e,action:t}))}function kU(e){let t=new Map(Ms.map((e,t)=>[e.id,t])),n=new Map;for(let{stroke:t,action:r}of e)n.set(r,[...n.get(r)??[],t]);let r=new Map,i=[...n].sort(([e],[n])=>(t.get(e)??2**53-1)-(t.get(n)??2**53-1));for(let[e,t]of i){let n=Vk(e);r.set(n,[...r.get(n)??[],{action:e,strokes:t}])}return[...r].map(([e,t])=>({category:e,actions:t}))}var AU=e=>e===`prefix.moreCommands`?aA(`moreCommandsPrefix`):cA(e);function jU(e){let[,t]=(0,h.useState)(0);(0,h.useEffect)(()=>{if(e===null)return;let n=window.setTimeout(()=>t(e=>e+1),Math.max(30,e-Date.now()));return()=>window.clearTimeout(n)},[e])}function MU({model:e}){H();let t=b(hA);b(Rs),b(e.selection);let n=Date.now(),r=t.entries.filter(e=>n-e.at<mA),i=t.guide?.kind===`prefix`?t.guide.armedAt:null,a=i!==null&&n-i<pA?i+pA:null;jU(a??(r[0]?r[0].at+mA:null));let o=t.guide?.kind===`direct`||i!==null&&a===null;if(!o&&!t.guide&&r.length===0)return null;if(o&&t.guide){let n=t.guide.kind===`direct`,r=n?qk(ac(e,ic()),Us()):OU(e);return(0,U.jsxs)(`output`,{className:`mono ${xn}`,onMouseDown:e=>e.preventDefault(),children:[(0,U.jsxs)(`div`,{className:Cn,children:[(0,U.jsx)(`span`,{className:`text-accent`,children:n?aA(`directLayer`):aA(`commandLayer`,{prefix:Us()??``})}),(0,U.jsx)(`span`,{className:`keys-only text-muted`,children:aA(n?`releaseCtrl`:`escCancel`)})]}),(0,U.jsx)(`div`,{className:wn,children:kU(r).map(t=>(0,U.jsxs)(`div`,{className:Tn,children:[(0,U.jsx)(`div`,{className:`text-accent`,children:lA(t.category)}),t.actions.map(({action:t,strokes:r})=>(0,U.jsxs)(`button`,{type:`button`,className:En,disabled:n,onClick:()=>r[0]&&CU(e,r[0]),children:[(0,U.jsx)(`span`,{className:Sn,children:r.map(Zk).join(`/`)}),(0,U.jsx)(`span`,{children:AU(t)})]},t))]},t.category))})]})}return(0,U.jsxs)(`output`,{className:Rn,children:[r.map(e=>(0,U.jsxs)(NU,{at:e.at,children:[(0,U.jsx)(`span`,{className:`text-accent`,children:Us()}),` + `,e.stroke,` →`,` `,e.action?AU(e.action):(0,U.jsx)(`span`,{className:`text-muted`,children:`∅`})]},e.id)),i!==null&&(0,U.jsxs)(`div`,{className:zn(!1),children:[(0,U.jsx)(`span`,{className:`text-accent`,children:Us()}),` ⋯`]})]})}function NU({at:e,children:t}){let[n]=(0,h.useState)(Date.now),r=n-e>140,i={"--hud-out":`${e+mA-140-n}ms`};return(0,U.jsx)(`div`,{className:zn(r),style:i,children:t})}function PU({model:e,bindingId:t,head:n=!1}){let r=b(hA);b(Rs);let i=Rw().prefs.prefixTap;if(r.guide?.kind!==`prefix`||i!==`local`)return null;let a=Kk({bindingId:t,reachability:ac(e,ic()),prefixKey:Us()});if(!a)return null;let o=tc().find(e=>e.id===t&&e.prefix)?.chords[0];return(0,U.jsx)(`button`,{type:`button`,className:`mono ${fn(n)}`,onMouseDown:e=>e.preventDefault(),onClick:t=>{t.stopPropagation(),o&&CU(e,o)},children:a})}function FU(e,t,n){let r=t(n),i=[];for(let a=2;a<=r;a++){let o=n+1;for(;o<e&&t(o)>a;)o++;let s=o<e&&t(o)===a;i.push(a===r?s?`tee`:`elbow`:s?`pipe`:`blank`)}return i}function IU(e,t,n){let r=e=>e.repo===t.repo&&!e.pinned==!t.pinned;if(t.id===n.id||!r(n))return null;let i=e.filter(r).sort((e,t)=>(e.order??e.rank)-(t.order??t.rank)).map(e=>e.id);return i.indexOf(n.id)-i.indexOf(t.id)}function LU(e,t,n,r){let i=IU(e,t,n);return i===null?null:r===`above`&&i>0?i-1:r===`below`&&i<0?i+1:i}function RU(e,t){return e.id!==t.id&&t.repo===e.repo&&!t.pinned==!e.pinned}var zU=e=>e===void 0||e.kind===`project`||e.kind===`state`?0:e.kind===`task`||e.kind===`pane`||e.kind===`round`?e.depth:1;function BU(e,t){let n=zU(e[t]),r=t+1;for(;r<e.length&&zU(e[r])>n;)r++;return r}function VU(e,t){return FU(e.length,t=>zU(e[t]),t)}function HU(e,t,n,r){let i=e.findIndex(e=>e.id===t);if(i<0||t===n)return e;let a=BU(e,i),o=e.slice(i,a),s=[...e.slice(0,i),...e.slice(a)],c=s.findIndex(e=>e.id===n);if(c<0)return e;let l=r===`above`?c:BU(s,c);return[...s.slice(0,l),...o,...s.slice(l)]}var UU=globalThis.webkit?.messageHandlers?.roveMac;function WU(e){let t=t=>e(t.detail);return window.addEventListener(`rove-mac`,t),()=>window.removeEventListener(`rove-mac`,t)}function GU(e,t,n,r,i,a){(0,h.useEffect)(()=>{if(UU)return UU.postMessage({op:`toolbar`,folded:e,waiting:t,back:n,forward:r,dark:getComputedStyle(document.documentElement).colorScheme!==`light`}),WU(({action:e})=>{e===`fold`&&a(),e===`back`&&n&&i(-1),e===`forward`&&r&&i(1)})},[e,t,n,r,i,a])}function KU(e,t){return e.kind===`task`&&t.kind===`task`?e.taskId===t.taskId:e.kind===`page`&&t.kind===`page`?e.id===t.id:e.kind===`new`&&t.kind===`new`}var qU={entries:[],at:-1};function JU(e,t){let n=e.entries[e.at];if(n&&KU(n,t)){let n=[...e.entries];return n[e.at]=t,{entries:n,at:e.at}}let r=[...e.entries.slice(0,e.at+1),t].slice(-50);return{entries:r,at:r.length-1}}function YU(e,t,n){for(let r=e.at+t;r>=0&&r<e.entries.length;r+=t){let t=e.entries[r];if(t&&n(t))return r}return-1}var XU=y(qU);function ZU(e){let t=M.get();if(t)return{kind:`page`,id:t};let n=I.get();if(n)return{kind:`new`,start:n};let{taskId:r,tabId:i}=e.selection.get();return r?{kind:`task`,taskId:r,tabId:i}:null}function QU(e,t){if(t.kind!==`task`)return!0;let n=e.tasks.get()?.tasks.find(e=>e.id===t.taskId);return n!==void 0&&!n.deleting}var $U=!1;function eW(e){let t=!1,n=()=>{t||(t=!0,queueMicrotask(()=>{if(t=!1,$U)return;let n=ZU(e);n&&XU.set(JU(XU.get(),n))}))};n();let r=[e.selection.subscribe(n),M.subscribe(n),I.subscribe(n)];return()=>{for(let e of r)e()}}function tW(e,t){let n=XU.get(),r=YU(n,t,t=>QU(e,t)),i=n.entries[r];i&&($U=!0,i.kind===`task`?(M.set(null),I.set(null),e.select(i.taskId,i.tabId)):i.kind===`page`?(I.set(null),xe(i.id)):(M.set(null),I.set(i.start)),XU.set({entries:n.entries,at:r}),queueMicrotask(()=>{$U=!1}))}function nW({children:e}){return(0,U.jsx)(`svg`,{className:`size-3.5 ${ur}`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:e})}var rW={chat:(0,U.jsx)(`path`,{d:`M3 3.5h10a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1H8l-3 2.5v-2.5H3a1 1 0 0 1-1-1v-6a1 1 0 0 1 1-1zM5 6.5h6M5 8.5h4`}),files:(0,U.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`}),diff:(0,U.jsx)(`path`,{d:`M3.5 2.5h9a1 1 0 0 1 1 1v9a1 1 0 0 1-1 1h-9a1 1 0 0 1-1-1v-9a1 1 0 0 1 1-1zM8 5v4M6 7h4M6 11h4`}),browser:(0,U.jsx)(`path`,{d:`M8 2a6 6 0 1 0 0 12A6 6 0 0 0 8 2zM2 8h12M8 2c2.2 2 2.2 10 0 12M8 2c-2.2 2-2.2 10 0 12`}),quota:(0,U.jsx)(`path`,{d:`M2 10a6 6 0 1 1 12 0M8 10l2.5-3.5M4 13h8`})};function iW(e){let t=BS(e);return t?VS(t):V(`panel.browser`)}var aW=7.3,oW=22,sW=160,cW=2,lW=24;function uW(e,t){let n=0;for(let t of e){let e=0;for(let n of t)e+=(n.codePointAt(0)??0)>11903?2:1;n+=Math.min(sW,oW+e*aW)+cW}return n<=t}function dW(e,t,n){let r=[{label:V(`panel.close`),section:`close`,run:()=>Tw(e,n.id)}];return t.tabs.length>1&&r.push({label:V(`panel.closeOthers`),section:`close`,run:()=>ww(e,e=>eC(e,n.id))}),r}function fW({taskId:e,column:t}){H();let n=(0,h.useRef)(null),r=(0,h.useRef)(null),[i,a]=(0,h.useState)(0);(0,h.useEffect)(()=>{let e=n.current;if(!e)return;let t=new ResizeObserver(([e])=>a(e?.contentRect.width??0));return t.observe(e),()=>t.disconnect()},[]);let o=i>0&&!uW(t.tabs.map(iW),i-lW);return(0,h.useEffect)(()=>{r.current?.querySelector(`.is-active`)?.scrollIntoView({block:`nearest`,inline:`nearest`})},[t.active,t.tabs.length,o]),(0,U.jsxs)(`div`,{className:br,ref:n,children:[(0,U.jsx)(`div`,{className:xr,role:`tablist`,"aria-label":V(`panel.tabs`),ref:r,children:t.tabs.map(n=>{let r=n.id===t.active;return(0,U.jsxs)(`div`,{role:`presentation`,className:Sr({active:r,compact:o}),onMouseDown:e=>{e.button===1&&e.preventDefault()},onAuxClick:t=>{t.button===1&&(t.preventDefault(),Tw(e,n.id))},onContextMenu:r=>Sq(r,dW(e,t,n)),children:[(0,U.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":r,className:Cr(r),title:BS(n)||iW(n),onClick:()=>ww(e,e=>US(e,n.id)),children:(0,U.jsx)(`span`,{className:wr,children:iW(n)})}),(0,U.jsx)(`button`,{type:`button`,className:Tr(r),"aria-label":V(`panel.close`),tabIndex:-1,onClick:()=>Tw(e,n.id),children:`×`})]},n.id)})}),(0,U.jsx)(`button`,{type:`button`,className:dr({tool:!0}),title:V(`panel.new`),"aria-label":V(`panel.new`),onClick:()=>ww(e,KS),children:(0,U.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,U.jsx)(`path`,{d:`M8 3.5v9M3.5 8h9`})})})]})}var pW=192,mW=`rove.web.railWidth`,hW=`rove.web.railFolded`;function gW(){let e=Number(localStorage.getItem(mW));return Number.isFinite(e)&&e>0?e:null}var _W=y(gW());_W.subscribe(()=>{let e=_W.get();e===null?localStorage.removeItem(mW):localStorage.setItem(mW,String(Math.round(e)))}),_W.subscribe(pe);var vW=y(localStorage.getItem(hW)===`1`);vW.subscribe(()=>localStorage.setItem(hW,vW.get()?`1`:`0`));var yW=y(!1),bW=null,xW=!1;function SW(e){bW!==null&&window.clearTimeout(bW),bW=null,xW=e,e?yW.set(!0):bW=window.setTimeout(()=>O.get()===null&&yW.set(!1),250)}O.subscribe(()=>{O.get()===null&&yW.get()&&!xW&&SW(!1)}),vW.subscribe(()=>yW.set(!1)),vW.subscribe(pe);function CW(e,t=window.innerWidth){let n=Math.max(pW,t-320);return Math.max(pW,Math.min(n,Math.round(e)))}function wW({client:e,railBar:t}){H(),b(Rs);let{stale:n,bridgeVersion:r,daemonVersion:i}=b(Va);if(!n)return null;let a=V(`layout.refreshRove`),o=[V(`layout.refreshVersions`,{bridge:r?`v${r}`:V(`layout.unknownVersion`),daemon:i?`v${i}`:V(`layout.unknownVersion`)}),qs(`app.refresh`)].filter(Boolean).join(` · `),s=(0,U.jsxs)(W,{variant:`pill`,className:`ml-auto min-h-6 min-w-6 justify-center touch:min-h-8 rounded-sm focus-visible:outline-1 focus-visible:outline-focus`,"aria-label":a,title:o,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&e.stopPropagation()},onClick:()=>Ga(e),children:[(0,U.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 shrink-0 rounded-full bg-warning`}),(0,U.jsx)(`span`,{className:t?`@max-[6.25rem]/refresh:sr-only`:void 0,children:a})]});return t?(0,U.jsx)(`div`,{className:`@container/refresh absolute top-2 right-2.5 left-[calc(5.75rem+var(--shell-inset-left,0px))] flex h-6.5 items-center justify-end @max-[13rem]:right-1`,children:s}):s}function TW({edge:e,className:t,...n}){return(0,U.jsx)(`div`,{"data-grip":``,className:Kt(`absolute inset-y-0 z-5 w-1.5 cursor-col-resize touch-none`,`after:absolute after:inset-y-0 after:w-0.5 after:bg-line-active after:opacity-0 after:transition-opacity after:duration-120`,`hover:after:opacity-100 hover:after:delay-250 active:after:bg-accent active:after:opacity-100 active:after:delay-0`,e===`right`?`right-0 after:right-0`:`left-0 after:left-0`,t),...n})}var EW=400;function DW({rail:e}){H();let t=(0,h.useRef)(null),n=(0,h.useRef)(0),r=(0,h.useRef)(null);return(0,U.jsx)(TW,{edge:`right`,title:V(`layout.railResize`),onPointerDown:n=>{t.current={x:n.clientX,width:e.current?.getBoundingClientRect().width??0,moved:!1},n.currentTarget.setPointerCapture(n.pointerId),me(!0)},onPointerMove:e=>{let n=t.current;!n||e.clientX===n.x||(n.moved=!0,_W.set(CW(n.width+e.clientX-n.x)))},onPointerUp:()=>{let e=t.current;if(t.current=null,!e)return;if(e.moved){n.current=0;return}let i=Date.now();r.current!==null&&window.clearTimeout(r.current),r.current=null,i-n.current<EW?(n.current=0,_W.set(null)):(n.current=i,r.current=window.setTimeout(()=>vW.set(!0),EW))},onLostPointerCapture:()=>me(!1)})}function OW({side:e}){return(0,U.jsxs)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,U.jsx)(`rect`,{x:`1.5`,y:`2.5`,width:`13`,height:`11`,rx:`2.5`}),(0,U.jsx)(`path`,{d:e===`left`?`M6 2.5v11`:`M10 2.5v11`})]})}function kW({model:e,hidden:t=!1}){H();let n=b(XU),r=b(vW),i=b(e.tasks),a=t=>QU(e,t),o=V(r?`layout.railUnfold`:`layout.railFold`),s=r&&(i?.tasks??[]).some(k_);return GU(r,s,YU(n,-1,a)>=0,YU(n,1,a)>=0,t=>tW(e,t<0?-1:1),()=>vW.set(!r)),UU||t?null:(0,U.jsxs)(`div`,{className:fr,onMouseEnter:()=>r&&yW.get()&&SW(!0),onMouseLeave:()=>r&&yW.get()&&SW(!1),children:[(0,U.jsxs)(`button`,{type:`button`,className:dr(),title:o,"aria-label":o,onClick:()=>vW.set(!r),children:[(0,U.jsx)(OW,{side:`left`}),s&&(0,U.jsx)(`span`,{className:`absolute top-0.75 right-0.75 size-1.5 rounded-full bg-accent`})]}),(0,U.jsx)(`button`,{type:`button`,className:dr(),title:V(`layout.navBack`),"aria-label":V(`layout.navBack`),disabled:YU(n,-1,a)<0,onClick:()=>tW(e,-1),children:(0,U.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,U.jsx)(`path`,{d:`M10 3.5 5.5 8l4.5 4.5`})})}),(0,U.jsx)(`button`,{type:`button`,className:dr(),title:V(`layout.navForward`),"aria-label":V(`layout.navForward`),disabled:YU(n,1,a)<0,onClick:()=>tW(e,1),children:(0,U.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,U.jsx)(`path`,{d:`M6 3.5 10.5 8 6 12.5`})})})]})}var AW=(0,U.jsx)(`path`,{d:`M3 3.5h10a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1v-7a1 1 0 0 1 1-1zM4.5 6.5 6.5 8l-2 1.5M8 10h3`}),jW=[`terminal`,`chat`,...LC],MW=e=>V(e===`terminal`?`layout.narrowTerminal`:`panel.${e}`);function NW(e,t,n){n!==`terminal`&&_w(e,n),HC(e,t,n)}function PW({client:e,taskId:t,tabId:n=null,title:r}){H();let i=b(RC),[a,o]=(0,h.useState)(!1);return(0,U.jsxs)(Ml,{back:{label:uA(`narrowBack`),onClick:be},title:r,children:[t&&(0,U.jsx)(zi,{size:`nav`,kind:`view`,label:`${V(`layout.narrowViews`)}: ${MW(i)}`,onClick:()=>o(!0),children:(0,U.jsx)(`svg`,{className:`size-5.5 fill-none stroke-current [stroke-linecap:round] [stroke-linejoin:round] [stroke-width:1.2]`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:i===`terminal`?AW:rW[i]})}),t&&a&&(0,U.jsx)(xu,{title:V(`layout.narrowViews`),value:i,picks:jW.map(e=>({value:e,label:MW(e)})),onPick:e=>NW(t,n,e),onClose:()=>o(!1)}),(0,U.jsx)(wW,{client:e})]})}function FW({title:e}){return H(),(0,U.jsxs)(`button`,{type:`button`,className:Xi({}),onClick:ye,children:[(0,U.jsx)(`span`,{className:`${ea} font-bold text-accent`,children:`↩`}),(0,U.jsx)(`span`,{className:Zi,children:dA(`recentJump`,{title:e})})]})}var IW={duration:180,easing:`cubic-bezier(0.16, 1, 0.3, 1)`};function LW(e,t){let n=(0,h.useRef)(null);(0,h.useLayoutEffect)(()=>{let r=[...document.querySelectorAll(`[data-rail-body] > [data-row]`)],i=new Map(r.map(e=>[e.dataset.row??``,e.offsetTop])),a=n.current;if(n.current={list:e,tops:i},!(!a||a.list===e||a.tops.size===0||t)&&!window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)for(let e of r){let t=a.tops.get(e.dataset.row??``);t===void 0?e.animate([{opacity:0},{opacity:1}],IW):t!==e.offsetTop&&e.animate([{transform:`translateY(${t-e.offsetTop}px)`},{transform:`none`}],IW)}})}var RW=null,zW=()=>(RW||(RW=new Image,RW.src=`data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7`),RW);function BW(e,t,n,r){let[i,a]=(0,h.useState)(null),o=(0,h.useRef)(t);o.current=t;let[s,c]=(0,h.useState)(null),l=(0,h.useRef)(()=>a(null));(0,h.useEffect)(()=>{if(!s)return;let e=()=>{c(null),l.current()};if(t!==s)return e();let n=window.setTimeout(e,3e3);return()=>window.clearTimeout(n)},[t,s]);let u=(0,h.useRef)(null),d=(0,h.useRef)(null);LW(t,i!==null||s!==null);let f=()=>[...u.current?.querySelectorAll(`[data-row]`)??[]];(0,h.useLayoutEffect)(()=>{let e=d.current;if(!e||(d.current=null,window.matchMedia(`(prefers-reduced-motion: reduce)`).matches))return;let t=f().flatMap(t=>{let n=e.get(t.dataset.row??``),r=n===void 0?0:n-t.getBoundingClientRect().top;return r?[{el:t,dy:r}]:[]});for(let{el:e,dy:n}of t)e.style.transition=`none`,e.style.transform=`translateY(${n}px)`;u.current?.getBoundingClientRect();for(let{el:e}of t)e.style.transition=`transform 150ms ease-out`,e.style.transform=``,e.addEventListener(`transitionend`,()=>e.style.removeProperty(`transition`),{once:!0})});let p=(0,h.useRef)(null),m=(0,h.useRef)([]),g=(0,h.useRef)(new Map),_=(0,h.useRef)(0),v=(0,h.useRef)(0),y=e=>{p.current=e,a(e)},b=e=>!n||e.machine!==void 0?null:e.kind===`project`?e.noProject?null:t.find(t=>t.repo===e.repo&&!Mo(t))??null:e.kind===`task`&&e.depth===1?e.task:null,x=e=>{let t=b(e);if(t)return{draggable:!0,onDragStart:n=>{n.dataTransfer.effectAllowed=`move`,n.dataTransfer.setDragImage(zW(),0,0),n.dataTransfer.setData(`text/plain`,t.id),u.current=n.currentTarget.closest(`[data-rail-body]`),w(u.current);let r=m.current,i=r.findIndex(t=>t.id===e.id);_.current=r.slice(i,BU(r,i)).reduce((e,t,n)=>e+(g.current.get(t.id)?.height??0)+(n>0?g.current.get(t.id)?.gap??0:0),0),v.current=n.clientY,y({fromRow:e.id,from:t,toRow:e.id,to:t,side:`above`,project:e.kind===`project`})},onDragEnd:()=>p.current&&y(null)}},S=(e,t,n)=>{let r=t;if(n.project)for(;r>0&&e[r]?.kind!==`project`;)r--;let i=e[r];if(!i||i.kind===`project`!==n.project)return null;let a=b(i);return!a||!n.project&&!RU(n.from,a)?null:{row:i.id,task:a}},C={onDragOver:e=>{let t=p.current;if(!t)return;e.preventDefault();let n=e.clientY-v.current;v.current=e.clientY;let r=e.target.closest(`[data-row]`)?.dataset.row,i=m.current,a=S(i,i.findIndex(e=>e.id===r),t);if(!a||a.row===t.fromRow)return;let o=e.currentTarget.querySelector(`[data-row="${CSS.escape(t.fromRow)}"]`)?.getBoundingClientRect().top;if(o===void 0||e.clientY>=o&&e.clientY<o+_.current)return;let s=e.clientY<o?`above`:`below`;(s===`above`?n>=0:n<=0)||(t.toRow!==a.row||t.side!==s)&&y({...t,toRow:a.row,to:a.task,side:s})},onDrop:n=>{let i=p.current;if(!i)return;n.preventDefault(),p.current=null,r?l.current=()=>a(null):l.current=()=>{d.current=new Map(f().map(e=>[e.dataset.row??``,e.getBoundingClientRect().top])),a(null),Ck(`default`),z(K(`tasks`,`sort.label`,{mode:K(`tasks`,`sort.modes.default`)}))};let s=o.current,u=()=>o.current===s?c(s):l.current();if(i.project){if(i.toRow===i.fromRow)return l.current();let t={repo:i.from.repo,target:i.to.repo,side:i.side===`above`?`before`:`after`};e.client.request(`project.move`,t).catch(e=>z(K(`tasks`,`toast.moveFailed`,{error:e instanceof Error?e.message:String(e)}),`error`)).finally(u);return}let m=LU(t,i.from,i.to,i.side);m?Ok(e,i.from.id,m).finally(u):l.current()}},w=e=>{let t=[...e?.querySelectorAll(`[data-row]`)??[]];g.current=new Map(t.map((e,n)=>{let r=t[n-1],i=r?e.offsetTop-r.offsetTop-r.offsetHeight:0;return[e.dataset.row??``,{top:e.offsetTop,gap:i,height:e.offsetHeight}]}))},T=(e,t)=>{m.current=t?HU(e,t.fromRow,t.toRow,t.side):e;let n=new Map;if(!t)return n;let r=Math.min(...[...g.current.values()].map(e=>e.top)),i=e=>e.kind===`project`||e.kind===`state`,a=Math.max(0,...e.filter(i).map(e=>g.current.get(e.id)?.gap??0));for(let[e,t]of m.current.entries()){let o=g.current.get(t.id);if(!o)return new Map;e>0&&(r+=i(t)?a:o.gap),r!==o.top&&n.set(t.id,r-o.top),r+=o.height}return n};return{props:x,body:C,places:e=>{let t=[...g.current.keys()],n=i&&e.length===t.length&&e.every((e,n)=>e.id===t[n])?i:null,r=T(e,n),a=n?e.findIndex(e=>e.id===n.fromRow):-1,o=new Set(a<0?[]:e.slice(a,BU(e,a)).map(e=>e.id));return{dragging:n?.fromRow??null,place:e=>{let t=r.get(e.id);return{"data-row":e.id,...o.has(e.id)?{"data-lifted":``}:{},...t?{style:{transform:`translateY(${t}px)`}}:{}}}}}}}var VW=/^rgba?\(([^()]*)\)$/i;function HW(e){return VW.test(e.trim())}var UW=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/;function WW(e){return UW.test(e)}function GW(e,t){let n=e.defs??{},r={};for(let[i,a]of Object.entries(e.engineColors??{})){let e=typeof a==`string`?a:a[t],o=new Set;for(;!WW(e)&&!HW(e)&&Object.hasOwn(n,e)&&!o.has(e);)o.add(e),e=n[e];r[i]=e}return r}var KW=[`shell.frame`,`shell.topBar`,`rail.frame`,`rail.header`,`rail.groupHeader`,`rail.row`,`rail.footer`,`session.header`,`session.body`,`session.footer`,`panel.frame`,`panel.tabs`,`panel.section`,`status.bar`,`package.view`,`phone.topBar`,`phone.listHeader`,`phone.groupHeader`,`phone.row`,`phone.sessionHeader`,`phone.tabs`],qW=/\{\{([a-zA-Z0-9_]+)\}\}/g;function JW(e,t){return e.replace(qW,(e,n)=>{let r=t[n];return r==null||r===!1?``:String(r)})}var YW=`theme.json`;new Set(KW);var XW=class extends h.Component{state={tripped:!1};static getDerivedStateFromError(e){let t=kR.get();if(t.activePack!==null&&!t.disabledByCrash)return{tripped:!0};throw e}componentDidCatch(e,t){let n=kR.get();n.activePack!==null&&!n.disabledByCrash&&(HR(e,t.componentStack??void 0),this.setState({tripped:!1}))}render(){return this.state.tripped?null:this.props.children}},ZW=class extends h.Component{state={crashed:!1};static getDerivedStateFromError(){return{crashed:!0}}componentDidCatch(e,t){VR(this.props.packId,this.props.slot,this.props.file,e,t.componentStack??void 0)}render(){return this.state.crashed?this.props.fallback:this.props.children}};function QW({client:e,onOpenSettings:t}){H();let n=UR();if(n.runtimeErrors.length===0)return null;let r=n.runtimeErrors[n.runtimeErrors.length-1];if(!r)return null;let i=[r.slot,r.file].filter(Boolean).join(` · `);return(0,U.jsxs)(`div`,{className:GR,role:`alert`,"data-theme-package-error-banner":!0,children:[(0,U.jsx)(`span`,{className:KR,children:V(`settings.appearance.themeErrorBadge`)}),(0,U.jsx)(`span`,{className:`font-semibold text-ink`,children:r.packId}),i&&(0,U.jsx)(`span`,{className:`text-muted`,children:i}),(0,U.jsx)(`span`,{className:qR,title:r.message,children:r.message}),(0,U.jsxs)(`div`,{className:JR,children:[(0,U.jsx)(W,{variant:`link`,onClick:t,children:V(`settings.appearance.themeErrorDetails`)}),(0,U.jsx)(W,{variant:`action`,onClick:()=>void BR(e),children:V(`settings.appearance.themeSwitchDefault`)})]})]})}var $W=[`--radius`,`--radius-sm`,`--radius-xs`,`--hairline`,`--tp-pane-gap`,`--tp-shell-pad`];function eG(e,t,n){for(let t of $W)e.style.removeProperty(t);if(delete e.dataset.tpFrame,delete e.dataset.tpDensity,delete e.dataset.tpPack,AR.set(n),!t)return;let r=t.manifest.layout;r&&(r.radius!==void 0&&e.style.setProperty(`--radius`,`${r.radius}px`),r.radiusSm!==void 0&&e.style.setProperty(`--radius-sm`,`${r.radiusSm}px`),r.radiusXs!==void 0&&e.style.setProperty(`--radius-xs`,`${r.radiusXs}px`),r.paneGap!==void 0&&e.style.setProperty(`--tp-pane-gap`,`${r.paneGap}px`),r.shellPadding!==void 0&&e.style.setProperty(`--tp-shell-pad`,`${r.shellPadding}px`),r.borderStyle===`none`?e.style.setProperty(`--hairline`,`0px`):r.borderStyle===`solid`&&e.style.setProperty(`--hairline`,`1px`),r.frame&&(e.dataset.tpFrame=r.frame),r.density&&(e.dataset.tpDensity=r.density)),e.dataset.tpPack=t.id}function tG(e,t,n){if(!e?.engineColors)return;let r=GW(e,n),i=typeof t==`string`?t:t?.id,a=typeof t==`string`?void 0:t?.protocol;return i&&r[i]||a&&r[a]||r.default}var nG=15e3,rG=24,iG=3,aG=e=>e.changes&&!(`unreadable`in e.changes)?e.changes.ahead:void 0,oG=e=>e.repo?e.repo.split(`/`).pop():void 0,sG=e=>e.workspace&&e.workspace!==e.repo?e.workspace.split(`/`).pop():void 0,cG=e=>e&&Date.parse(e)||0;function lG(e,t,n,r,i){let a=e.changes&&!(`unreadable`in e.changes)?e.changes:void 0;return{id:e.id,title:e.label,repo:oG(e),branch:e.branch||void 0,worktree:sG(e),engineId:e.engine?.id??void 0,engineName:e.engine?.name,engineColor:tG(n,e.engine,r),model:e.model,engineFamily:e.engine?.protocol,baseRef:e.baseRef,statusKind:e.rowStatus?.kind??`idle`,since:e.rowStatus?.since??0,ahead:aG(e),diffStats:a?{files:0,added:a.added,removed:a.deleted}:void 0,pr:e.pr?.number?{number:e.pr.number,state:e.pr.lifecycle,url:e.pr.url,checkState:e.pr.checkState}:void 0,parentId:e.parentTaskId,createdAt:cG(e.createdAt)||void 0,selected:e.id===i,onSelect:()=>t.select(e.id)}}function uG(e,t,n,r=0,i=0){let a=n?JSON.stringify(n):null,[,o]=(0,h.useState)(0);return(0,h.useEffect)(()=>{if(!n)return;let r=!0,a=()=>ss(e,t,n).then(()=>r&&o(e=>e+1),()=>{});a();let s=i>0?ua(i,a):void 0;return()=>{r=!1,s?.()}},[e,t,a,r,i]),n?J(e,t,n):void 0}function dG(e,t,n){let r=Date.now();return e.flatMap(e=>e.windows.map(i=>({label:e.name,pct:i.percent,tone:qH({capturedAt:e.capturedAt,windows:[i]},r)?.tone??`ok`,detail:i.label,engineId:e.vendor,engineColor:tG(t,{id:e.vendor,protocol:e.vendor},n),window:i.kind,resetsAt:i.resetsAt??void 0})))}async function fG(e,t){let[n,r]=await Promise.all([(async()=>{let n=CL,r;for(let i=0;i<iG&&r!==null;i++){let i=await e.client.request(`output.read`,{taskId:t,limit:50,...r?{cursor:r,source:`history`}:{}}).catch(()=>null);n=BL(n,i?.history?.messages??[],i?.history?.firstIndex??0),r=i?.olderCursor??null}return n})(),e.client.request(`task.events`,{taskId:t,limit:100}).catch(()=>null)]),i=n.entries.flatMap(e=>e.tools.map(r=>({sessionId:t,kind:n.failed.has(r.callId)?`tool-failed`:`tool`,at:cG(e.at),detail:r.name,summary:r.summary,endedAt:cG(n.ended.get(r.callId))||void 0}))),a=[...n.thoughts.values()].map(e=>({sessionId:t,kind:`thinking`,at:cG(e.at),detail:``,summary:e.text.slice(0,200)})),o=(r?.events??[]).map(e=>({sessionId:t,kind:e.kind,at:e.at,detail:e.detail??``}));return[...i,...a,...o].filter(e=>e.at>0)}function pG(e,t){let[n,r]=(0,h.useState)(new Map),i=(0,h.useRef)(new Map),a=t?[...t].sort((e,t)=>cG(t.updatedAt)-cG(e.updatedAt)).slice(0,rG):null,o=a?.map(e=>`${e.id}@${e.updatedAt}:${e.rowStatus?.since??0}`).join(`,`)??null,s=a?.filter(e=>e.rowStatus?.kind===`running`).map(e=>e.id).join(`,`)??``;return(0,h.useEffect)(()=>{if(!o)return;let t=!0,n=n=>void Promise.all(n.map(async t=>[t,await fG(e,t)])).then(e=>t&&e.length>0&&r(t=>new Map([...t,...e])));n(o.split(`,`).filter(e=>{let[t=``,n=``]=e.split(`@`),r=i.current.get(t)===n;return i.current.set(t,n),!r}).map(e=>e.split(`@`)[0]??``));let a=s?ua(nG,()=>n(s.split(`,`))):void 0;return()=>{t=!1,a?.()}},[e,o,s]),(0,h.useMemo)(()=>o?[...n.values()].flat().sort((e,t)=>e.at-t.at):void 0,[n,o])}function mG(e,t){let n=e?.slots?.[t];return n?.component?n.data??(t===`panel.section`?[`commits`,`sessions`]:[]):[]}function hG(e,t,n,r){let i=e=>t.includes(e),a=b(e.tasks),o=b(e.selection),s=b(e.tabs),c=_s(a,o.taskId)??null,l=c?.id??null,u=(c&&aG(c))??0,d=c?.changes&&!(`unreadable`in c.changes)?c.changes.added+c.changes.deleted:0,f=uG(e,`diff.refs`,i(`commits`)&&l&&u>0?{taskId:l}:null,u),p=uG(e,`diff.files`,i(`files`)&&l?{taskId:l}:null,`${u}:${d}`),m=uG(e,`usage.get`,i(`usage`)?{}:null,0,6e4),g=l?(s[l]??[]).find(e=>e.kind===`engine`)?.id:void 0,_=uG(e,`context.usage`,i(`context`)&&l&&g?{taskId:l,tabId:g,probe:!1}:null,0,nG),v=uG(e,`pr.checks`,i(`checks`)&&l&&c?.pr?.number?{taskId:l}:null,c?.pr?.checkState,6e4),y=$L(e,i(`transcript`)&&l?l:``,i(`transcript`)),x=(0,h.useMemo)(()=>{if(y.state.kind!==`ready`)return;let{entries:e,failed:t,outputs:n,ended:r,thoughts:i}=y.state.transcript,a=new Set(e.map(e=>e.index)),o=[...i].flatMap(([e,t])=>a.has(e)?[]:[{index:e,role:`assistant`,at:t.at,text:``,tools:[]}]);return[...e,...o].sort((e,t)=>e.index-t.index).map(e=>({index:e.index,role:e.role,at:cG(e.at),text:e.text,thinking:i.get(e.index)?.text,tools:e.tools.map(e=>({id:e.callId,name:e.name,summary:e.summary,failed:t.has(e.callId),input:e.input,output:n.get(e.callId),endedAt:cG(r.get(e.callId))||void 0}))}))},[y.state]),S=a?.tasks??[],C=pG(e,i(`activity`)?S:null);return{...i(`sessions`)?{sessions:S.map(t=>lG(t,e,n,r,l))}:{},...i(`commits`)?{commits:f?.commits.slice(0,u)??[]}:{},...i(`files`)?{files:(p?.files??[]).map(e=>({path:e.path,status:e.status,added:e.added??0,removed:e.deleted??0}))}:{},...i(`transcript`)?{transcript:x??[]}:{},...i(`usage`)?{usage:dG(m?.usage??[],n,r)}:{},...i(`context`)?{context:_?.meter??null}:{},...i(`checks`)?{checks:v?.checks??[]}:{},...i(`activity`)?{activity:C??[]}:{},...i(`decisions`)?{decisions:(a?.gates??[]).filter(e=>e.status===`open`).map(t=>({id:t.id,sessionId:t.taskId,question:t.question,options:t.options,recommended:t.recommended,at:cG(t.createdAt),onAnswer:n=>void fl(e,t.id,n)}))}:{}}}var gG=[0,4,8,14],_G=e=>e===`rail.row`||e===`phone.row`,vG=e=>e===`rail.groupHeader`||e===`phone.groupHeader`,yG=(0,h.createContext)({});function bG(e,t){if(_G(e)){let e=t;return{title:e.title,branch:e.branch??``,repo:e.repo??``,engine:e.engineName??e.engineId??``,status:e.statusKind,statusLabel:e.statusLabel,pr:e.pr?`#${e.pr.number} ${e.pr.state}`:``,todos:e.todos?`${e.todos.done}/${e.todos.total}`:``,tokens:e.tokens?.map(e=>e.text).join(` · `)??``,age:e.age??``,cloud:e.cloud??``,pinned:e.pinned?`pinned`:``,diffStats:e.diffStats?`+${e.diffStats.added} -${e.diffStats.removed}`:``,cost:e.cost??``}}if(vG(e)){let e=t;return{label:e.label,repo:e.repo??``,count:e.count,collapsed:e.collapsed,kind:e.kind}}if(e===`rail.footer`){let e=t;return{usageSummary:e.usageSummary,settingsLabel:e.settingsLabel,unreadCount:e.unreadCount}}if(e===`session.header`){let e=t;return{title:e.title,branch:e.branch??``,repo:e.repo??``,engine:e.engineName??e.engineId??``,status:e.statusKind,tabCount:e.tabCount,activeTab:e.activeTab??``}}if(e===`panel.tabs`){let e=t;return{kind:e.kind,title:e.title,hint:e.hint,tabCount:e.tabCount,expanded:e.expanded}}if(e===`panel.section`){let e=t;return{kind:e.kind,title:e.title,branch:e.branch??``,repo:e.repo??``,engine:e.engineName??e.engineId??``,status:e.statusKind,diffStats:e.diffStats?`+${e.diffStats.added} -${e.diffStats.removed}`:``,todos:e.todos?`${e.todos.done}/${e.todos.total}`:``,pr:e.pr?`#${e.pr.number}`:``,cost:e.cost??``}}if(e===`status.bar`){let e=t;return{connection:e.connection,taskTitle:e.taskTitle??``,branch:e.branch??``,engine:e.engineName??``,status:e.statusKind??``,diffStats:e.diffStats?`+${e.diffStats.added} -${e.diffStats.removed}`:``,usageSummary:e.usageSummary}}return t}function xG({node:e,values:t,onAction:n}){if(e.type===`text`){let n=JW(e.text,t);return n?(0,U.jsx)(`span`,{className:UE(e.tone,e.bold===!0),children:n}):null}return e.type===`button`?(0,U.jsx)(W,{variant:`action`,onClick:()=>n?.(e.key),children:JW(e.label,t)}):e.type===`input`?null:(0,U.jsx)(`div`,{className:HE(e.direction===`row`,e.border===!0),style:{flexDirection:e.direction??`column`,gap:gG[e.gap??0],padding:gG[e.padding??0]},children:e.children.map((e,r)=>(0,U.jsx)(xG,{node:e,values:t,onAction:n},r))})}function SG(e,t,n,r,i){let a=bG(e,n);if(t.tree)return(0,U.jsx)(xG,{node:t.tree,values:a,onAction:t=>{_G(e)&&t===`select`&&n.onSelect(),vG(e)&&t===`toggle`&&n.onToggle(),vG(e)&&t===`newTask`&&n.onNewTask?.(),e===`rail.footer`&&t===`settings`&&n.onOpenSettings(),e===`rail.footer`&&t===`inbox`&&n.onOpenInbox(),e===`panel.tabs`&&t===`close`&&n.onClose(),e===`panel.tabs`&&t===`expand`&&n.onToggleExpand?.(),e===`status.bar`&&t===`retry`&&n.onRetry()}});if(_G(e)&&(t.fields||t.secondaryFields||t.surface||t.variant)){let e=n,r=t.fields??[`title`,`pr`,`statusLabel`],o=t.secondaryFields??[],s=e.engineColor?{"--tp-engine-color":e.engineColor}:void 0;return(0,U.jsxs)(W,{variant:`row`,className:`${YR} ${tz(i)} ${nz(t.surface,e.selected)} ${rz(t.variant)}`,style:s,onClick:e.onSelect,"data-tp-slot":`rail.row`,children:[(0,U.jsx)(`span`,{className:XR,children:r.map(e=>{let t=a[e];return t?e===`title`?(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium`,children:String(t)},e):(0,U.jsx)(`span`,{className:ZR,children:String(t)},e):null})}),o.length>0&&(0,U.jsx)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 font-mono text-meta text-muted`,children:o.map(e=>{let t=a[e];return t?(0,U.jsx)(`span`,{className:`truncate`,children:String(t)},e):null})})]})}if(e===`panel.section`&&(t.fields||t.secondaryFields)){let e=[...t.fields??[],...t.secondaryFields??[]].map(e=>[e,a[e]]).filter(([,e])=>!!e);return(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,"data-tp-slot":`panel.section`,children:[e.length>0&&(0,U.jsx)(`div`,{className:`flex flex-wrap items-center gap-2 border-b-hairline border-line bg-inset px-2.5 py-1.5 font-mono text-meta text-muted`,children:e.map(([e,t])=>(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-xs bg-inset px-1.5 py-0.5 font-mono text-meta text-muted`,children:[e,`: `,String(t)]},e))}),r]})}if(e===`panel.tabs`&&(t.fields||t.surface||t.variant)){let e=n,r=t.fields??[`title`];return(0,U.jsxs)(`div`,{className:az,"data-tp-slot":`panel.tabs`,children:[(0,U.jsx)(`span`,{className:`flex min-w-0 items-center gap-2 truncate`,children:r.map(e=>a[e]?(0,U.jsx)(`span`,{children:String(a[e])},e):null)}),(0,U.jsx)(W,{variant:`action`,onClick:e.onClose,children:`×`})]})}if(e===`status.bar`&&(t.fields||t.secondaryFields)){let e=[...t.fields??[],...t.secondaryFields??[]].map(e=>[e,a[e]]).filter(([,e])=>!!e);return e.length===0?r:(0,U.jsx)(`footer`,{className:iz,"data-tp-slot":`status.bar`,children:e.map(([e,t])=>(0,U.jsx)(`span`,{className:`truncate`,children:String(t)},e))})}return r}function CG({slot:e,data:t,fallback:n}){let r=UR(),i=WR(),a=_z(),o=H(),s=b(AR);if(!i)return n;let c=i.manifest.slots?.[e];if(!c)return n;if(c.hidden)return null;let l=r.slotComponents[e],u=`${i.id}:${i.fingerprint}:${e}`;if(l){let r={slot:e,data:t,defaultNode:n,spec:c,tokens:s,mode:a,locale:o},d=t=>e===`session.body`?(0,U.jsx)(bR,{value:n,children:t}):t,f=mG(i.manifest,e);return(0,U.jsx)(ZW,{packId:i.id,slot:e,file:c.component,fallback:n,children:d(f.length>0?(0,U.jsx)(wG,{Comp:l,props:r,kinds:f}):(0,U.jsx)(l,{...r,children:n}))},u)}return c.tree||c.fields||c.secondaryFields||c.surface||c.variant?(0,U.jsx)(ZW,{packId:i.id,slot:e,file:YW,fallback:n,children:SG(e,c,t,n,i.manifest.layout?.density)},u):n}function wG({Comp:e,props:t,kinds:n}){let r=(0,h.useContext)(yG),i=Object.fromEntries(n.flatMap(e=>e in r?[[e,r[e]]]:[]));return(0,U.jsx)(e,{...t,data:{...t.data,...i},children:t.defaultNode})}function TG({model:e,children:t}){let n=WR(),r=_z(),i=Object.keys(n?.manifest.slots??{}),a=hG(e,[...new Set(i.flatMap(e=>mG(n?.manifest,e)))],n?.manifest,r);return(0,h.useEffect)(()=>(yR.set(e),()=>yR.set(null)),[e]),(0,U.jsx)(yG,{value:a,children:t})}function EG({className:e}){return(0,U.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[(0,U.jsx)(`path`,{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`}),(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`})]})}function DG({model:e,narrow:t,onSettings:n,inbox:r}){H();let i=b(uV),a=Q(`engines.skill.bannerHintWeb`,{engines:i.join(`, `)});if(Rl(`list`,t?{wide:{label:V(`rail.newTask`),note:V(`rail.newTaskMode.${Cv()}`),onClick:()=>Yb()},capsule:(0,U.jsx)(Vi,{settings:{label:i.length>0?`${V(`rail.settings`)}, ${a}`:V(`rail.settings`),onClick:n,glyph:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(EG,{className:aT}),i.length>0&&(0,U.jsx)(`span`,{className:`absolute top-0.75 right-0.75 size-1.5 rounded-full bg-accent`})]})},inbox:{label:V(`rail.inbox`,{count:r.count}),onClick:r.onClick,count:r.count}})}:null),t)return null;let o=(0,U.jsxs)(`div`,{className:rT,children:[!t&&(0,U.jsx)(YH,{client:e.client}),(0,U.jsxs)(`div`,{className:iT,children:[(0,U.jsxs)(`button`,{type:`button`,className:`rail-nav-row ${oT(!1)}`,onClick:n,children:[(0,U.jsx)(EG,{className:cT}),(0,U.jsx)(`span`,{children:V(`rail.settings`)}),i.length>0&&(0,U.jsx)(`span`,{className:`ml-2 min-w-0 truncate text-meta text-subtle`,title:a,children:V(`rail.skillCue`)})]}),(0,U.jsx)(PU,{model:e,bindingId:`settings.open`})]})]});return(0,U.jsx)(CG,{slot:`rail.footer`,data:{unreadCount:r.count,settingsLabel:V(`rail.settings`),usage:[],usageSummary:``,onOpenSettings:n,onOpenInbox:r.onClick},fallback:o})}var OG=y({});function kG(e,t,n){let r=OG.get()[`${e}::${t.id}`];return r&&r.sig===pU(n)&&oU(n.root).some(e=>e.id===r.leaf)?r.leaf:n.activeLeafId}function AG(e,t,n,r){OG.set({...OG.get(),[`${e}::${t}`]:{sig:pU(n),leaf:r}})}function jG(e,t,n,r){AG(e,t.id,n,r),uc(Bc(e,t.id,r))?.focus()}function MG(e){let{taskId:t,tabId:n}=e.selection.get(),r=t?e.tabs.get()[t]?.find(e=>e.id===n):void 0;return t&&r?{taskId:t,tab:r}:null}async function NG(e,t,n){try{let r=await e.client.request(`tab.split`,t);typeof t.taskId==`string`&&await e.refreshTabsNow(t.taskId),n?.(r)}catch(e){z(e instanceof Error?e.message:String(e),`error`)}}function PG(e,t,n,r,i){let a=i??(n.split?kG(t,n,n.split):`leaf-1`),o=e.selection.get();(o.taskId!==t||o.tabId!==n.id)&&e.select(t,n.id);let s=uc(Bc(t,n.id,a))?.size();NG(e,{taskId:t,tabId:n.id,action:`open`,direction:r,leafId:a,...s},e=>{e.changed?e.split&&AG(t,n.id,e.split,e.leaf):z(V(`layout.splitTooSmall`),`error`)})}function FG(e,t,n,r){let i=n.split,a=i?kG(t,n,i):r,o=()=>NG(e,{taskId:t,tabId:n.id,action:`close`,leafId:r},e=>{let i=e.split;if(!i)return;let o=a!==r&&oU(i.root).some(e=>e.id===a);AG(t,n.id,i,o?a:i.activeLeafId)});if(!i||!dU(n,i,r)){o();return}k.set((0,U.jsx)(sa,{title:V(`confirm.closePaneTitle`,{pane:uU(i,Go(n)).get(r)??r}),body:V(`confirm.closePaneBody`),confirmLabel:V(`menu.closePane`),onConfirm:o}))}function IG(e,t,n,r){let i=n.split;i&&k.set((0,U.jsx)(oa,{title:oA(`split.renameTitle`),initial:uU(i,Go(n)).get(r)??``,allowEmpty:!0,submitLabel:V(`dialog.save`),onSubmit:i=>NG(e,{taskId:t,tabId:n.id,action:`rename`,leafId:r,title:i})}))}function LG(e,t,n,r){return[{label:V(`menu.renamePane`),section:`split`,key:Fk(`workspace.split.rename`)??void 0,run:()=>IG(e,t,n,r)},{label:V(`menu.closePane`),section:`split`,key:qs(`workspace.split.close`)||void 0,run:()=>FG(e,t,n,r)}]}function RG(e,t,n,r){return[{label:V(`menu.splitRight`),section:`split`,key:Fk(`workspace.split.right`)??void 0,run:()=>PG(e,t,n,`right`,r)},{label:V(`menu.splitDown`),section:`split`,key:Fk(`workspace.split.down`)??void 0,run:()=>PG(e,t,n,`down`,r)}]}function zG(e,t,n,r){let i=n.split,a=r??(i?kG(t,n,i):`leaf-1`);return[...RG(e,t,n,a),...sU(i)?LG(e,t,n,a):[]]}function BG(e,t){let n=e.tabs.get()[t]??[],r=e.selection.get(),i=(r.taskId===t?n.find(e=>e.id===r.tabId):void 0)??bs(n);return!i||!fU(i)?[]:RG(e,t,i,i.split?kG(t,i,i.split):`leaf-1`)}function VG(e,{task:t,tab:n,leaf:r}){n.split&&jG(t.id,n,n.split,r),e.select(t.id,n.id)}function HG(e){let{row:t}=e;b(OG);let n=e.selectedTabId===t.tab.id&&!!t.tab.split&&kG(t.task.id,t.tab,t.tab.split)===t.leaf;return(0,U.jsxs)(`button`,{type:`button`,className:`${Xi({size:`pane`})} ${e.cursor?lg:``}`,"aria-current":n||void 0,onClick:e.onClick,onContextMenu:e.onMenu,...e.place,children:[(0,U.jsx)(`span`,{className:Vh,"aria-hidden":`true`,children:e.guides?.map((e,t)=>(0,U.jsx)(`span`,{className:Wh(e)},t))}),(0,U.jsx)(`span`,{className:`${Zi} text-(length:--fs-meta) ${n?`text-ink`:`text-muted`}`,children:t.label})]})}function UG({model:e,task:t}){let[n,r]=(0,h.useState)(()=>J(e,`task.get`,{taskId:t.id})?.task??null),[i,a]=(0,h.useState)(null),{busy:o,error:s,submit:c}=aa();(0,h.useEffect)(()=>{ss(e,`task.get`,{taskId:t.id}).then(e=>r(e.task)).catch(e=>a(G(e)))},[e,t.id]);let l=()=>c(async()=>{if(!n?.prompt)return;let t=(await e.client.request(`task.spawn`,{repo:n.repo,prompt:n.prompt,...n.engine?{engine:n.engine}:{},...n.baseRef?{baseBranch:n.baseRef}:{}})).taskIds[0];t&&e.selectWhenListed(t)});return(0,U.jsx)(ia,{title:K(`tasks`,`runAgain.title`),wide:!0,children:(0,U.jsxs)(`form`,{className:hi,onSubmit:e=>{e.preventDefault(),l()},children:[(0,U.jsx)(`p`,{className:`text-muted`,children:K(`tasks`,`runAgain.source`,{title:t.label})}),(0,U.jsx)(`pre`,{className:Ur,children:n?.prompt??i??K(`tasks`,`fieldNotes.loading`)}),(0,U.jsx)(`p`,{className:Hr,children:K(`tasks`,`runAgain.hint`)}),s&&(0,U.jsx)(`p`,{className:`text-error`,children:s}),(0,U.jsx)(la,{busy:o||!n?.prompt,submitLabel:K(`tasks`,`runAgain.confirm`)})]})})}function WG(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`}function GG({model:e,repo:t}){let[n,r]=(0,h.useState)({kind:`loading`}),[i,a]=(0,h.useState)(0),[o,s]=(0,h.useState)(null),[c,l]=(0,h.useState)(null),u=(0,h.useRef)(null),d=()=>e.client.request(`notes.list`,{repo:t}).then(e=>r({kind:`ready`,notes:e.notes})).catch(e=>r({kind:`error`,message:G(e)}));(0,h.useEffect)(()=>void d(),[]);let f=n.kind===`ready`?n.notes:[];(0,h.useEffect)(()=>a(e=>Math.max(0,Math.min(e,f.length-1))),[f.length]),(0,h.useEffect)(()=>{u.current?.querySelector(`.is-selected`)?.scrollIntoView({block:`nearest`})},[i]);let p=async n=>{if(n.id!==void 0){l(null);try{await e.client.request(`notes.delete`,{repo:t,id:n.id}),s(null),await d()}catch(e){l(G(e))}}};return(0,U.jsx)(ia,{title:K(`tasks`,`fieldNotes.title`),wide:!0,children:(0,U.jsxs)(`div`,{className:hi,onKeyDown:e=>{if(!o){if(e.key===`ArrowDown`||e.key===`j`)a(e=>Math.min(f.length-1,e+1));else if(e.key===`ArrowUp`||e.key===`k`)a(e=>Math.max(0,e-1));else if(e.key===`d`&&f[i]?.id!==void 0)s(f[i]??null);else return;e.preventDefault()}},children:[(0,U.jsx)(`p`,{className:`font-mono text-meta break-all text-muted`,children:t}),n.kind===`loading`&&(0,U.jsx)(`p`,{className:`text-muted`,children:K(`tasks`,`fieldNotes.loading`)}),n.kind===`error`&&(0,U.jsx)(`p`,{className:`text-error`,children:n.message}),n.kind===`ready`&&f.length===0&&(0,U.jsx)(`p`,{className:`text-muted`,children:K(`tasks`,`fieldNotes.empty`)}),f.length>0&&(0,U.jsx)(`ul`,{className:`m-0 list-none p-0 flex max-h-[44vh] flex-col gap-2 overflow-y-auto`,ref:u,children:f.map((e,t)=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(`button`,{type:`button`,className:Wr(t===i),onClick:()=>a(t),autoFocus:t===0,children:[(0,U.jsxs)(`span`,{className:`font-mono text-meta whitespace-pre text-accent`,children:[t===i?`▸ `:` `,WG(e.at),`, `,e.author]}),(0,U.jsx)(`span`,{className:`text-ink whitespace-pre-wrap wrap-anywhere`,children:e.text})]})},`${e.at}:${t}`))}),o&&(0,U.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-sm border-hairline border-line bg-paper px-3 py-2.5`,children:[(0,U.jsx)(`p`,{children:(0,U.jsx)(`strong`,{children:K(`tasks`,`fieldNotes.confirmDelete.title`)})}),(0,U.jsx)(`p`,{className:`text-muted`,children:K(`tasks`,`fieldNotes.confirmDelete.body`,{text:o.text})}),c&&(0,U.jsx)(`p`,{className:`text-error`,children:c}),(0,U.jsxs)(`div`,{className:`actions flex items-center justify-end gap-3.5 w-narrow:grid w-narrow:auto-cols-fr w-narrow:grid-flow-col w-narrow:items-stretch w-narrow:gap-2.5 w-narrow:[&>:is(a,button)]:inline-flex w-narrow:[&>:is(a,button)]:min-h-11! w-narrow:[&>:is(a,button)]:items-center w-narrow:[&>:is(a,button)]:justify-center w-narrow:[&>:is(a,button)]:px-3.5 w-narrow:[&>:is(a,button)]:py-1.5 w-narrow:[&>:is(a,button)]:text-center w-narrow:[&>:is(a,button)]:text-body w-narrow:[&>.link]:rounded-sm w-narrow:[&>.link]:border-hairline w-narrow:[&>.link]:border-line w-narrow:[&>.link]:bg-inset w-narrow:[&>.link]:text-ink w-narrow:[&>.link]:no-underline! w-narrow:[&>.link]:active:scale-97 w-narrow:[&>.link]:motion-reduce:active:scale-none`,children:[(0,U.jsx)(`button`,{type:`button`,className:`link text-accent hover:underline touch-hit`,onClick:()=>s(null),children:V(`dialog.cancel`)}),(0,U.jsx)(`button`,{type:`button`,className:Rr({danger:!0}),onClick:()=>void p(o),children:V(`taskops.retire`)})]})]}),!o&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`keys-only font-sans text-meta text-subtle`,children:K(`tasks`,`fieldNotes.footerDeletable`)}),(0,U.jsxs)(`div`,{className:`actions flex items-center justify-end gap-3.5 w-narrow:grid w-narrow:auto-cols-fr w-narrow:grid-flow-col w-narrow:items-stretch w-narrow:gap-2.5 w-narrow:[&>:is(a,button)]:inline-flex w-narrow:[&>:is(a,button)]:min-h-11! w-narrow:[&>:is(a,button)]:items-center w-narrow:[&>:is(a,button)]:justify-center w-narrow:[&>:is(a,button)]:px-3.5 w-narrow:[&>:is(a,button)]:py-1.5 w-narrow:[&>:is(a,button)]:text-center w-narrow:[&>:is(a,button)]:text-body w-narrow:[&>.link]:rounded-sm w-narrow:[&>.link]:border-hairline w-narrow:[&>.link]:border-line w-narrow:[&>.link]:bg-inset w-narrow:[&>.link]:text-ink w-narrow:[&>.link]:no-underline! w-narrow:[&>.link]:active:scale-97 w-narrow:[&>.link]:motion-reduce:active:scale-none`,children:[(0,U.jsx)(`button`,{type:`button`,className:`link text-accent hover:underline touch-hit`,disabled:f[i]?.id===void 0,onClick:()=>s(f[i]??null),children:V(`taskops.retire`)}),(0,U.jsx)(`button`,{type:`button`,className:`link text-accent hover:underline touch-hit`,onClick:B,children:V(`taskops.close`)})]})]})]})})}var KG=[`backlog`,`in_progress`,`in_review`,`done`,`canceled`,`error`],qG={backlog:`status.backlog`,in_progress:`status.inProgress`,in_review:`status.inReview`,done:`status.done`,canceled:`status.canceled`,error:`status.error`},JG=e=>({binding:e,key:Fk(e)??void 0});async function YG(e,t){if(!e){z(V(`menu.nothingToCopy`,{what:t}),`error`);return}try{await navigator.clipboard.writeText(e),z(V(`menu.copied`,{text:e}))}catch{z(V(`menu.copyFailed`),`error`)}}function XG(e,t,n){let r=[{label:V(`menu.newTask`),section:`open`,run:()=>Yb(t)}],i=(n,i,a)=>{i!==null&&r.push({label:n,section:`edit`,run:()=>void e.client.request(`project.move`,{repo:t,target:i,side:a}).catch(e=>z(K(`tasks`,`toast.moveFailed`,{error:String(e)}),`error`))})};return i(K(`tasks`,`menu.moveToTop`),n.top,`before`),i(K(`tasks`,`menu.moveProjectUp`),n.above,`before`),i(K(`tasks`,`menu.moveProjectDown`),n.below,`after`),r.push({label:V(`menu.viewSessions`),section:`open`,run:()=>Ce(t)}),r.push({label:K(`tasks`,`menu.fieldNotes`),section:`notes`,run:()=>k.set((0,U.jsx)(GG,{model:e,repo:t}))}),n.local&&r.push({label:K(`tasks`,`menu.forgetProject`),section:`danger`,danger:!0,run:()=>k.set(kj(e,t,n.label))}),r}function ZG(e){return[{label:V(`menu.newChatNoFolder`),section:`open`,run:()=>Xb()},{label:V(`menu.newShell`),section:`open`,run:()=>void Py(e).catch(e=>z(String(e),`error`))}]}function QG(){Ek(!Tk.get()),document.querySelector(`.rail`)?.focus()}function $G(e,t,n){let r=Mo(t),i=n.filter(e=>!e.startsWith(`ssh://`)&&(r||e!==t.repo)),a=i.map(e=>{let t=e.slice(e.lastIndexOf(`/`)+1);return{value:e,label:i.filter(e=>e.endsWith(`/${t}`)).length>1?e:t}});return t.kind===`dir`&&!r&&a.unshift({value:``,label:K(`tasks`,`moveToProject.ungrouped`)}),a.length===0?(z(K(`tasks`,`moveToProject.empty`),`error`),null):(0,U.jsx)(ca,{title:K(`tasks`,`moveToProject.title`),choices:a,onPick:async n=>{await e.client.request(`task.moveToProject`,{taskId:t.id,repo:n||null}),z(K(`tasks`,`toast.movedToProject`,{project:a.find(e=>e.value===n)?.label??n}))}})}function eK(e,t){return{left:{label:K(`tasks`,`menu.archive`),tone:`neutral`,run:()=>void Oj(e,t)},right:{label:t.pinned?V(`menu.unpin`):V(`menu.pin`),tone:`accent`,run:()=>void e.act(`task.pin`,{taskId:t.id,pinned:!t.pinned}).catch(e=>z(String(e),`error`))}}}function tK(e,t,n){let r=e.client,i=[];n&&(i.push({label:V(`menu.closeTab`),section:`tab`,run:()=>k.set((0,U.jsx)(sa,{title:V(`confirm.closeTabTitle`,{tab:n.title??n.engineName??n.id}),body:V(`confirm.closeTabBody`),confirmLabel:V(`menu.closeTab`),onConfirm:async()=>{await e.closeTab(t.id,n.id)}}))}),i.push(...zG(e,t.id,n))),i.push({label:V(`menu.newChat`),section:`open`,run:()=>void My(e,t.id)}),i.push({label:V(`menu.newChatPick`),section:`open`,rare:!0,run:()=>k.set((0,U.jsx)(CA,{model:e,taskId:t.id}))}),i.push({label:V(`menu.continueEngine`),section:`open`,rare:!0,...JG(`chat.tab.fork`),run:()=>k.set((0,U.jsx)(CA,{model:e,taskId:t.id,context:`continue`,sourceTabId:n?.id}))}),i.push({label:V(`menu.newShell`),section:`open`,run:()=>void Ny(e,t.id,{kind:`shell`}).catch(e=>z(String(e),`error`))}),t.kind===`task`&&t.ownsBranch===!0&&t.branch&&!t.sharesWorkspaceOf&&!t.machine&&!t.extraRepoCount&&i.push({label:K(`tasks`,`menu.newTaskFromBranch`),section:`open`,rare:!0,run:()=>L({repo:t.repo,baseBranch:t.branch,worktree:!0})}),t.startsAt&&(i.push({label:V(`menu.startNow`),section:`open`,run:()=>void e.client.request(`task.startScheduledNow`,{taskId:t.id}).catch(e=>z(String(e),`error`))}),i.push({label:V(`menu.cancelStart`),section:`open`,run:()=>void e.client.request(`task.cancelScheduledStart`,{taskId:t.id}).catch(e=>z(String(e),`error`))})),t.hasPrompt&&(i.push({label:K(`tasks`,`menu.runAgain`),section:`open`,run:()=>k.set((0,U.jsx)(UG,{model:e,task:t}))}),i.push({label:V(`menu.retryEdit`),section:`open`,rare:!0,run:()=>void sy(e,t)}));let a=!t.machine;if(a&&i.push({label:K(`tasks`,`menu.openEditor`),section:`open`,...JG(`tasks.openWorktree`),run:()=>void Tj(e,t.id)}),t.groupId){let e=t.groupId;i.push({label:V(`compare.menu`),section:`open`,run:()=>Se(e)})}i.push({label:V(`menu.rename`),section:`edit`,...JG(`sidebar.rename`),run:()=>k.set((0,U.jsx)(oa,{title:V(`menu.rename`),initial:t.title,submitLabel:V(`dialog.save`),onSubmit:n=>e.act(`task.rename`,{taskId:t.id,title:n}).then(()=>{})}))}),i.push({label:t.pinned?V(`menu.unpin`):V(`menu.pin`),section:`edit`,...JG(`sidebar.pin`),run:()=>void e.act(`task.pin`,{taskId:t.id,pinned:!t.pinned}).catch(e=>z(String(e),`error`))}),a&&!t.archived&&i.push({label:K(`tasks`,`menu.reorder`),section:`edit`,rare:!0,...JG(`sidebar.localMerge`),run:()=>QG()}),i.push({label:V(`menu.setStatus`),section:`edit`,children:KG.map(n=>({label:V(qG[n]),checked:n===t.status,run:()=>void e.act(`task.setStatus`,{taskId:t.id,status:n}).catch(e=>z(String(e),`error`))}))}),a&&!t.routine&&!t.parentTaskId&&!t.extraRepoCount&&i.push({label:K(`tasks`,`menu.moveToProject`),section:`edit`,rare:!0,run:()=>void e.client.request(`repos.list`).then(n=>{let r=$G(e,t,n.repos);r&&k.set(r)}).catch(e=>z(String(e),`error`))}),a&&i.push({label:V(`menu.changeEngine`),section:`edit`,rare:!0,...JG(`tasks.cycleEngine`),run:()=>k.set((0,U.jsx)(XD,{model:e,current:async()=>(await e.client.request(`task.get`,{taskId:t.id})).task,onSet:async n=>{await e.client.request(`task.setEngine`,{taskId:t.id,engine:n.engine.id,...n.effort===void 0?{}:{effort:n.effort},...n.model===void 0?{}:{model:n.model}}),z(K(`tasks`,`toast.engineSwitched`,{engine:n.engine.name}))}}))}),t.pr?.checkState===`failing`&&i.push({label:K(`tasks`,`menu.fixChecks`),section:`git`,key:qs(`files.fixChecks`),run:()=>void wj(e,t.id,V(`taskops.fixSent`))}),t.kind===`task`&&t.branch&&a&&i.push({label:K(`tasks`,`menu.syncBase`),section:`git`,rare:!0,key:qs(`files.syncBase`),run:()=>void Sj(e,t.id)}),t.branch&&i.push({label:V(`menu.renameBranch`),section:`git`,rare:!0,...JG(`tasks.renameBranch`),run:()=>k.set((0,U.jsx)(oa,{title:V(`menu.renameBranch`),initial:t.branch,submitLabel:V(`dialog.save`),onSubmit:e=>r.request(`task.setBranch`,{taskId:t.id,branch:e}).then(()=>{})}))}),t.kind===`task`&&t.branch&&i.push({label:V(`menu.land`),section:`git`,run:()=>void bj(e,t)});let o=[{label:V(`menu.copyWhat.id`),run:()=>void YG(t.id,V(`menu.what.id`))}];return t.branch&&o.push({label:V(`menu.copyWhat.branch`),run:()=>void YG(t.branch,V(`menu.what.branch`))}),o.push({label:V(`menu.copyWhat.path`),run:()=>void r.request(`task.get`,{taskId:t.id}).then(e=>YG(e.task.worktreePath,V(`menu.what.path`))).catch(e=>z(String(e),`error`))}),i.push({label:V(`menu.copy`),section:`copy`,children:o}),i.push({label:K(`tasks`,t.archived?`menu.unarchive`:`menu.archive`),section:`danger`,run:()=>void Oj(e,t)}),i.push({label:V(`menu.removeSession`),section:`danger`,...JG(`sidebar.delete`),danger:!0,run:()=>k.set(Dj(e,t))}),i}var nK=`rove.collapsedProjects`,rK=`rove.foldedTasks`,iK=`rove.openedTasks`,aK=600;function oK(e){try{let t=JSON.parse(localStorage.getItem(e)??`[]`);return new Set(Array.isArray(t)?t.filter(e=>typeof e==`string`):[])}catch{return new Set}}function sK(e,t){try{localStorage.setItem(e,JSON.stringify([...t]))}catch{}}var cK=(e,t)=>{let n=new Set(e);return n.delete(t)||n.add(t),n};function lK(){let e=b(xk),[t,n]=(0,h.useState)({active:!1,query:``}),[r,i]=(0,h.useState)(()=>oK(nK)),a=e=>i(t=>{let n=cK(t,e);return sK(nK,n),n}),[o,s]=(0,h.useState)(()=>({folded:oK(rK),opened:oK(iK)}));return{sort:e,cycleSort:wk,search:t,setSearch:n,collapsed:r,toggleProject:a,hand:o,toggleTaskFold:(e,t)=>s(n=>{let r=new Set(n.folded),i=new Set(n.opened);return t?(r.delete(e),i.add(e)):(i.delete(e),r.add(e)),sK(rK,r),sK(iK,i),{folded:r,opened:i}})}}var uK=[`sidebar.nav`,`sidebar.goto`,`sidebar.select`,`sidebar.tree.open`,`sidebar.rename`,`sidebar.pin`,`sidebar.localMerge`,`sidebar.delete`,`sidebar.sort`,`sidebar.search.enter`,`tasks.renameBranch`,`tasks.cycleEngine`,`tasks.openWorktree`,`tasks.update`,`tasks.focusEngine`,`task.new`,`settings.open.sidebar`,`worktrees.open.sidebar`];function dK(e){for(let t of e)for(let e of uK){let n=Ks(e).indexOf(t);if(n>=0)return{id:e,slot:n}}return null}function fK(e,t){let n=e.selection.get().taskId===t;e.select(t),ye(),n&&!qb(e.client)&&Ds()}function pK(e,t,n,r){let{search:i,setSearch:a}=n,[o,s]=(0,h.useState)(null),c=(0,h.useRef)(0),l=t.filter(e=>e.kind!==`project`&&e.kind!==`state`),u=l.findIndex(e=>e.id===o);(0,h.useEffect)(()=>{u<0&&s(r.selectedId&&l.some(e=>e.id===r.selectedId)?r.selectedId:l[0]?.id??null)},[u,l,r.selectedId]);let d=l[u],f=d?.kind===`task`||d?.kind===`pane`?d.task.id:null;(0,h.useEffect)(()=>Rj.set(f),[f]);let p=l[0]?.id??null;(0,h.useEffect)(()=>{i.query,i.active&&s(p)},[i.active,i.query,p]);let m=e=>{let t=l[Math.max(0,Math.min(l.length-1,e))];t&&s(t.id)},g=t=>{t?.kind===`task`&&e.select(t.task.id),t?.kind===`round`&&Se(t.groupId),t?.kind===`pane`&&VG(e,t),t&&ye()},_=(t,n)=>{t?.kind===`task`&&D(tK(e,t.task,null),n)?.run?.()},v=async t=>{if(t?.kind===`task`&&t.machine===void 0)try{let{engines:n}=await e.client.request(`engines.list`),r=Lg(n).filter(e=>e.ready!==!1),i=r[(r.findIndex(e=>e.id===t.task.engine?.id)+1)%r.length];if(!i||i.id===t.task.engine?.id)return;await e.client.request(`task.setCommand`,{taskId:t.task.id,engine:i.id}),z(V(`rail.engineSwitched`,{engine:i.name}))}catch(e){z(V(`rail.engineSwitchFailed`,{error:e instanceof Error?e.message:String(e)}),`error`)}};return{cursor:o,setCursor:s,onKeyDown:t=>{let o=l[u],s=t.target instanceof HTMLInputElement;if(i.active){if(t.metaKey||t.ctrlKey||t.altKey)return;if(t.key===`Escape`)a({active:!1,query:``});else if(t.key===`Enter`)g(o),a({active:!1,query:``});else if(t.key===`ArrowDown`)m(u+1);else if(t.key===`ArrowUp`)m(u-1);else if(t.key===`Backspace`&&!s)a(e=>({...e,query:e.query.slice(0,-1)}));else if(t.key.length===1&&!s)a(e=>({...e,query:e.query+t.key}));else return;t.preventDefault();return}let d=dK(Xk(t));if(Tk.get()){let n=o?.kind===`task`&&o.machine===void 0;if(d?.id===`sidebar.nav`)n&&Dk(e,o,d.slot%2==0?1:-1);else if(d?.id===`sidebar.localMerge`||t.key===`Enter`||t.key===`Escape`)Ek(!1);else return;t.preventDefault();return}switch(d?.id){case`sidebar.nav`:m(d.slot%2==0?u+1:u-1);break;case`sidebar.goto`:d.slot%2==1?m(l.length-1):Date.now()-c.current<aK?(m(0),c.current=0):c.current=Date.now();break;case`sidebar.select`:case`sidebar.tree.open`:g(o);break;case`tasks.focusEngine`:Ds();break;case`sidebar.rename`:case`sidebar.pin`:case`sidebar.delete`:case`tasks.renameBranch`:case`tasks.openWorktree`:_(o,d.id);break;case`tasks.cycleEngine`:v(o);break;case`sidebar.localMerge`:o?.machine===void 0&&Ek(!0);break;case`sidebar.sort`:n.cycleSort(),z(K(`tasks`,`sort.label`,{mode:K(`tasks`,`sort.modes.${xk.get()}`)}));break;case`sidebar.search.enter`:a({active:!0,query:``});break;case`task.new`:r.onNewTask(o?.kind===`task`||o?.kind===`pane`?o.task.repo:void 0,o?.machine);break;case`settings.open.sidebar`:r.onSettings();break;case`worktrees.open.sidebar`:xe(`worktrees`);break;case`tasks.update`:xe(`update`);break;default:return}t.preventDefault()},onPress:e=>{let t=e.target.closest(`[data-row]`)?.dataset.row;t&&s(t)}}}var mK=(e,t,n)=>`~pane:${e}:${t}:${n}`;function hK(e,t){return e.flatMap(e=>e.kind===`task`?[e,...(t[e.task.id]??[]).flatMap(t=>{let n=t.split;if(!n||!sU(n))return[];let r=uU(n,Go(t));return oU(n.root).map(n=>({id:mK(e.task.id,t.id,n.id),kind:`pane`,task:e.task,tab:t,leaf:n.id,label:r.get(n.id)??n.id,depth:e.depth+1,...e.machine===void 0?{}:{machine:e.machine}}))})]:[e])}function gK(e){return e?.match(/^https?:\/\/[^/]+\/([^/]+\/[^/]+)\/(?:pull|merge_requests|-\/merge_requests)\//)?.[1]}var _K=e=>e.charAt(0).toUpperCase()+e.slice(1);function vK(e){return[V(`rail.pr.state.${e.state}`),...e.checks?[V(`rail.pr.checks.${e.checks}`)]:[]].join(`, `)}function yK(e){let t=new Map;for(let n of e){let e=N_(n),r=[...e&&n.pr?[{pr:n.pr,mark:e}]:[],...(n.sessionPrs??[]).flatMap(e=>{let t=P_(e);return t?[{pr:e,mark:t}]:[]})];for(let{pr:e,mark:i}of r){let r=e.url??(e.number===void 0?n.id:`${n.repo}#${e.number}`),a=t.get(r),o=e.lifecycle===`unknown`,s=a?.pr.lifecycle===`unknown`;(!a||s&&!o||o===s&&F_([a.mark,i])!==a.mark)&&t.set(r,{task:n,pr:e,mark:i})}}return[...t.values()]}var bK={open:0,merged:1,closed:2},xK=e=>[...e].sort((e,t)=>bK[e.mark.state]-bK[t.mark.state]),SK=(e,t)=>t.url??`${e.id}#${t.number??``}`;function CK({task:e,pr:t,mark:n}){let r=gK(t.url),i=t.additions!==void 0&&t.deletions!==void 0;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:Zh,children:t.title||e.label}),(0,U.jsxs)(`span`,{className:Qh,children:[(0,U.jsxs)(`span`,{className:`${$h} ${n.tone}`,children:[(0,U.jsx)(`span`,{className:eg,children:n.glyph}),_K(V(`rail.pr.state.${n.state}`))]}),(0,U.jsx)(`span`,{className:tg,children:[...n.checks?[V(`rail.pr.checks.${n.checks}`)]:[],[r,t.number===void 0?``:`#${t.number}`].filter(Boolean).join(` `)].filter(Boolean).map(e=>`, ${e}`).join(``)}),i&&(0,U.jsxs)(`span`,{className:`ml-auto flex gap-1.5 pl-3 tabular-nums`,children:[(0,U.jsxs)(`span`,{className:`text-success`,children:[`+`,t.additions]}),(0,U.jsxs)(`span`,{className:`text-error`,children:[`−`,t.deletions]})]})]})]})}var wK=(e,t)=>e.length===1?`PR #${e[0]?.pr.number??``}, ${vK(t)}`:V(`rail.pr.many`,{count:e.length});function TK({entries:e,lead:t}){let[n,r]=(0,h.useState)(!1);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:Jh,"data-pr-chip":!0,"aria-label":wK(e,t),onClick:e=>{e.stopPropagation(),kl(),r(!0)},children:(0,U.jsxs)(`span`,{className:`${Yh} ${t.tone}`,children:[t.glyph,e.length>1&&(0,U.jsx)(`span`,{className:`font-sans`,children:e.length})]})}),n&&(0,U.jsx)(`span`,{className:`contents`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),onContextMenu:e=>e.stopPropagation(),children:(0,U.jsx)(vu,{label:wK(e,t),title:e.length>1?wK(e,t):void 0,onClose:()=>r(!1),children:t=>(0,U.jsx)(`div`,{className:`flex min-h-0 flex-col overflow-y-auto px-3 pb-1 max-h-[60dvh] overscroll-contain`,"data-pr-sheet":!0,children:xK(e).map(e=>(0,U.jsx)(yu,{stacked:!0,disabled:!e.pr.url,onClick:()=>{t(),window.open(e.pr.url,`_blank`,`noopener`)},children:(0,U.jsx)(CK,{...e})},SK(e.task,e.pr)))})})})]})}function EK({tasks:e,onOpen:t,sheet:n}){if(n){let t=yK(e),n=F_(t.map(e=>e.mark));return n?(0,U.jsx)(TK,{entries:t,lead:n}):null}return(0,U.jsx)(DK,{tasks:e,onOpen:t})}function DK({tasks:e,onOpen:t}){let[n,r]=(0,h.useState)(null),[i,a]=(0,h.useState)(!1),o=(0,h.useRef)(null),s=(0,h.useRef)(null),c=(0,h.useRef)(null),l=ff();(0,h.useLayoutEffect)(()=>{let e=c.current;if(!e||!n)return;let t=e.getBoundingClientRect();t.right>window.innerWidth-8&&(e.style.left=`${Math.max(8,window.innerWidth-t.width-8)}px`,e.style.top=`${n.bottom+6}px`);let r=e.getBoundingClientRect().bottom-(window.innerHeight-8);r>0&&(e.style.top=`${Math.max(8,e.getBoundingClientRect().top-r)}px`)},[n]);let u=()=>{t?.(),s.current!==null&&window.clearTimeout(s.current),s.current=null,a(!1),o.current&&!n&&r(o.current.getBoundingClientRect())},d=()=>{a(!0),s.current=window.setTimeout(()=>r(null),140)};(0,h.useEffect)(()=>{if(!l||!n)return;let e=e=>{let t=e.target;o.current?.contains(t)||c.current?.contains(t)||(a(!0),s.current=window.setTimeout(()=>r(null),140))};return document.addEventListener(`pointerdown`,e,!0),()=>document.removeEventListener(`pointerdown`,e,!0)},[l,n]),(0,h.useEffect)(()=>()=>{s.current!==null&&window.clearTimeout(s.current)},[]);let f=yK(e),p=F_(f.map(e=>e.mark));if(!p)return null;let m=wK(f,p);return(0,U.jsxs)(`span`,{ref:o,className:`chip ${qh} ${p.tone}`,"aria-label":m,onMouseEnter:l?void 0:u,onMouseLeave:l?void 0:d,onClick:e=>{l&&(e.stopPropagation(),n&&!i?d():u())},children:[p.glyph,f.length>1&&(0,U.jsx)(`span`,{className:`font-sans`,children:f.length}),n&&(0,au.createPortal)((0,U.jsx)(`div`,{ref:c,className:Xh(i),style:{top:n.top-6,left:n.right+8},onMouseEnter:l?void 0:u,onMouseLeave:l?void 0:d,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onContextMenu:e=>e.stopPropagation(),children:f.map(({task:e,pr:t,mark:n})=>(0,U.jsx)(`button`,{type:`button`,className:`flex flex-col gap-1 rounded-[calc(var(--radius)-6px)] px-3 py-2 text-left font-sans enabled:hover:bg-hover`,disabled:!t?.url,onClick:()=>t?.url&&window.open(t.url,`_blank`,`noopener`),children:(0,U.jsx)(CK,{task:e,pr:t,mark:n})},SK(e,t)))}),document.body)]})}var OK=450,kK=e=>{let t=e.querySelector(`.row-title`);return!!t&&t.scrollWidth>t.clientWidth};function AK(e,t){let n=(0,h.useRef)(null),r=(0,h.useRef)(null),i=(0,h.useRef)(e);i.current=e;let a=()=>{n.current!==null&&window.clearTimeout(n.current),n.current=null},o=e=>{a(),n.current=window.setTimeout(()=>Fh(e,i.current,`right`),OK)},s=()=>{a(),Ih()};return(0,h.useEffect)(()=>{let e=r.current,n=e?.closest(`.rail`);if(!t||!e||!n||!Mh()||!n.contains(document.activeElement)||!kK(e))return;let i=e=>{e.relatedTarget instanceof Node&&n.contains(e.relatedTarget)||s()};return o(e),n.addEventListener(`focusout`,i),()=>{n.removeEventListener(`focusout`,i),s()}},[t]),(0,h.useEffect)(()=>()=>{n.current!==null&&window.clearTimeout(n.current)},[]),{ref:e=>{r.current=e},onPointerEnter:e=>{e.pointerType===`touch`||!kK(e.currentTarget)||o(e.currentTarget)},onPointerLeave:s,hide:s}}var jK={info:`text-info`,success:`text-success`,warning:`text-warning`,error:`text-error`};function MK(e){return e.tokens?.map(e=>(0,U.jsx)(`span`,{className:`max-w-32 truncate ${jK[e.tone??``]??`text-subtle`}`,title:e.source,children:e.text},`${e.source}:${e.text}`))}function NK({at:e}){let t=new Date(e);if(Number.isNaN(t.getTime()))return null;let n=Rv(t);return(0,U.jsxs)(`span`,{className:`text-subtle`,title:V(`rail.startsAt`,{time:t.toLocaleString()}),children:[`◷ `,n]})}function PK(e){let{repo:t,label:n,collapsed:r}=e,i=V(r?`rail.expandGroup`:`rail.collapseGroup`,{name:n});return(0,U.jsxs)(U.Fragment,{children:[t&&(0,U.jsx)(`button`,{type:`button`,className:pg,title:t,onClick:()=>Ce(t),children:(0,U.jsx)(`span`,{className:`truncate`,children:n})}),(0,U.jsxs)(`button`,{type:`button`,className:`${mg} ${t?`min-w-6 shrink-0 justify-center`:`-ml-1`}`,"aria-label":t?i:void 0,"aria-expanded":!r,title:i,onClick:e.onToggle,children:[!t&&(0,U.jsx)(`span`,{className:`truncate`,children:n}),(0,U.jsx)(Bv,{right:r,className:hg(r)})]}),e.onNewTask&&(0,U.jsx)(`button`,{type:`button`,className:gg,title:V(`rail.newTask`),onClick:e.onNewTask,children:`+`})]})}function FK(e){let{row:t}=e,n=WR(),r=_z(),i=AK(t.kind===`task`?t.task.label:``,e.cursor&&t.kind===`task`),a=e.cursor?lg:``;if(t.kind===`project`||t.kind===`state`){let n=(0,U.jsx)(`h2`,{className:ug({moving:e.moving,dragging:e.dragging,grab:e.drag!==void 0}),onContextMenu:e.onMenu,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&e.stopPropagation()},...e.place,...e.drag,children:(0,U.jsx)(PK,{label:t.label,repo:t.kind===`project`&&!t.noProject?t.repo:void 0,collapsed:!!e.collapsed,onToggle:e.onClick,onNewTask:e.onNewTask})});return(0,U.jsx)(CG,{slot:`rail.groupHeader`,data:IK(e),fallback:n})}let o=t.task,s=o.rowStatus?.kind===`running`,c=pj(o),l=Vw(),u=O_(o,e.tabs),d=l===`engine`&&!u,f=t.fold?.collapsed?e.rollup:o.rowStatus,p=(0,U.jsxs)(`button`,{type:`button`,ref:i.ref,className:`group/row ${Xi({selected:e.selected,moving:e.moving,lifted:e.dragging,grab:e.drag!==void 0})} ${a}`,onClick:e.onClick,onContextMenu:e.onMenu,onPointerEnter:i.onPointerEnter,onPointerLeave:i.onPointerLeave,...e.place,...e.drag,children:[e.guides&&(0,U.jsx)(`span`,{className:`-mr-0.5 ml-0 flex flex-none self-stretch`,"aria-hidden":`true`,children:e.guides.map((e,t)=>(0,U.jsx)(`span`,{className:Wh(e)},t))}),l!==`dots`&&(0,U.jsx)(Ev,{icon:e.engineIcon,name:o.engine?.name,status:d?D_(f):void 0,blank:u}),(0,U.jsx)(`span`,{className:`${Qi} ${e.stale?`text-subtle`:``} ${s?$i:``}`,children:t.attempt??o.label}),(0,U.jsxs)(`span`,{className:`${na} ml-auto items-center`,children:[(0,U.jsx)(MK,{tokens:o.rowTokens}),e.repo&&(0,U.jsx)(`span`,{className:`max-w-24 truncate text-subtle`,children:e.repo}),t.level!==void 0&&(0,U.jsx)(`span`,{className:`text-subtle`,children:t.level}),(o.extraRepoCount??0)>0&&(0,U.jsxs)(`span`,{className:`text-subtle`,title:V(o.extraRepoCount===1?`rail.extraReposOne`:`rail.extraRepos`,{count:o.extraRepoCount??0}),children:[`+`,o.extraRepoCount]}),c&&(0,U.jsxs)(`span`,{className:`text-subtle tabular-nums`,title:V(c.total===1?`rail.todosOne`:`rail.todos`,c),children:[c.done,`/`,c.total]}),t.fold&&(0,U.jsx)(RK,{fold:t.fold,onToggle:e.onToggleFold}),o.kept&&(0,U.jsx)(`span`,{className:`text-accent`,title:V(`compare.kept`),children:`✓`}),o.pinned&&(0,U.jsx)(`span`,{className:`text-subtle`,children:`▴`}),o.startsAt&&(0,U.jsx)(NK,{at:o.startsAt}),(0,U.jsx)(EK,{tasks:e.prTasks??[o],onOpen:i.hide}),e.cloud&&(0,U.jsx)(xg,{label:e.cloud,onOpen:i.hide}),!d&&(0,U.jsx)(U_,{status:f})]})]}),m=e.swipe?(0,U.jsx)(Du,{left:e.swipe.left,right:e.swipe.right,ground:`paper`,children:p}):p;return(0,U.jsx)(CG,{slot:`rail.row`,data:LK(e,n?.manifest,r),fallback:m})}function IK(e){let t=e.row;return{id:t.id,kind:t.kind,label:t.label,repo:t.kind===`project`&&!t.noProject?t.repo:void 0,count:e.count??0,collapsed:!!e.collapsed,onToggle:()=>e.onClick(),onNewTask:e.onNewTask}}function LK(e,t,n){let r=e.row,i=r.task,a=r.fold?.collapsed?e.rollup:i.rowStatus,o=i.changes&&!(`unreadable`in i.changes)?{files:0,added:i.changes.added,removed:i.changes.deleted}:void 0,s=i.activity?.forMs,c=s===void 0?void 0:s<6e4?`${Math.max(1,Math.round(s/1e3))}s`:s<36e5?`${Math.round(s/6e4)}m`:`${Math.round(s/36e5)}h`;return{id:i.id,title:r.attempt??i.label,branch:i.branch||void 0,repo:e.repo??(i.repo?i.repo.split(`/`).pop():void 0),worktree:sG(i),engineId:i.engine?.id??void 0,engineName:i.engine?.name,model:i.model,engineFamily:i.engine?.protocol,engineColor:tG(t,i.engine,n),statusKind:a?.kind??`idle`,statusLabel:a?.kind??`idle`,selected:e.selected,cursor:e.cursor,stale:e.stale,pinned:!!i.pinned,depth:r.depth,pr:i.pr?.number?{number:i.pr.number,state:i.pr.lifecycle,url:i.pr.url}:void 0,todos:pj(i)??void 0,tokens:i.rowTokens?.map(e=>({key:e.source,text:e.text})),age:c,cloud:e.cloud,diffStats:o,onSelect:()=>e.onClick(),onMenu:t=>e.onMenu(t)}}function RK(e){let{collapsed:t}=e.fold,n=K(`tasks`,t?`menu.expandChildren`:`menu.collapseChildren`);return(0,U.jsxs)(`span`,{role:`button`,tabIndex:-1,"aria-label":n,"aria-expanded":!t,className:`${Gh} ${t?``:Kh}`,title:n,onClick:t=>{t.stopPropagation(),e.onToggle()},children:[t&&e.fold.count,(0,U.jsx)(Bv,{right:t})]})}var zK=1500,BK=8e3;function VK(e,t){let n=b(e.conn).state!==`open`,[r,i]=(0,h.useState)(!1);return(0,h.useEffect)(()=>{if(i(!1),!n)return;let e=window.setTimeout(()=>i(!0),t);return()=>window.clearTimeout(e)},[n,t]),n&&r}function HK({model:e,narrow:t}){let n=e.client,r=b(n.conn),i=b(e.tasks),a=b(e.selection),o=WR(),s=_s(i,a.taskId),c=VK(n,t?BK:r.state===`connecting`?zK:0),l=o?.manifest.layout?.statusBar??`auto`,u=!!o?.manifest.slots?.[`status.bar`];if(l===`hidden`&&!c||!c&&l!==`always`&&!u)return null;let d=s?.changes&&!(`unreadable`in s.changes)?{files:0,added:s.changes.added,removed:s.changes.deleted}:void 0,f=c?(0,U.jsxs)(`footer`,{className:Qn,children:[(0,U.jsx)(`span`,{className:$n(r.state===`retrying`)}),(0,U.jsx)(`span`,{children:r.state===`retrying`?V(`status.retrying`,{count:r.failures}):V(`status.connecting`)}),r.state===`retrying`&&(0,U.jsx)(`button`,{type:`button`,className:`link text-accent hover:underline touch-hit`,onClick:()=>n.retryNow(),children:V(`status.retry`)})]}):(0,U.jsxs)(`footer`,{className:iz,children:[(0,U.jsx)(`span`,{children:r.state}),s?.label&&(0,U.jsx)(`span`,{className:`truncate text-ink`,children:s.label}),s?.branch&&(0,U.jsx)(`span`,{className:`truncate`,children:s.branch}),s?.engine?.name&&(0,U.jsx)(`span`,{children:s.engine.name})]});return(0,U.jsx)(CG,{slot:`status.bar`,data:{connection:r.state===`open`?`open`:r.state===`retrying`?`retrying`:`connecting`,failures:r.failures,taskTitle:s?.label,branch:s?.branch,engineName:s?.engine?.name,statusKind:s?.rowStatus?.kind,diffStats:d,usageSummary:``,onRetry:()=>n.retryNow()},fallback:f})}function UK(e){let{row:t}=e,n=b(_e),r=WR(),i=_z();if(t.kind===`project`||t.kind===`state`){let n=(0,U.jsx)(`h2`,{className:`${ug({moving:e.moving,dragging:!1,grab:!1})} narrow:mb-0`,onContextMenu:e.onMenu,...e.place,children:(0,U.jsx)(nk,{label:t.label,collapsed:!!e.collapsed,foldLabel:V(e.collapsed?`rail.expandGroup`:`rail.collapseGroup`,{name:t.label}),onToggle:e.onClick,add:e.onNewTask?{label:V(`rail.newTask`),onClick:e.onNewTask}:void 0})});return(0,U.jsx)(CG,{slot:`phone.groupHeader`,data:IK(e),fallback:n})}let a=t.task,o=ME(a),s=t.fold?.collapsed?e.rollup:a.rowStatus,c=(0,U.jsx)(ek,{lead:e.guides&&(0,U.jsx)(`span`,{className:`-mr-0.5 ml-0 flex flex-none self-stretch`,"aria-hidden":`true`,children:e.guides.map((e,t)=>(0,U.jsx)(`span`,{className:Wh(e)},t))}),mark:(0,U.jsx)(Ev,{icon:e.engineIcon,name:a.engine?.name,blank:O_(a,e.tabs)}),title:t.attempt??a.label,dim:e.stale,flash:e.selected?n:0,line2:(0,U.jsxs)(U.Fragment,{children:[e.repo&&(0,U.jsx)(`span`,{className:`max-w-24 flex-none truncate text-subtle`,children:e.repo}),o.branch&&(0,U.jsx)(`span`,{className:`min-w-0 truncate`,children:o.branch}),o.behind&&(0,U.jsx)(`span`,{className:`flex-none tabular-nums`,children:o.behind}),t.fold?.collapsed&&(0,U.jsxs)(`span`,{className:`flex-none text-subtle`,children:[`+`,t.fold.count]}),a.pinned&&(0,U.jsx)(`span`,{className:`flex-none text-subtle`,children:`▴`}),e.cloud&&(0,U.jsx)(xg,{label:e.cloud})]}),trail:(0,U.jsx)(EK,{tasks:e.prTasks??[a],sheet:!0}),status:(0,U.jsx)(U_,{status:s}),onClick:e.onClick,onContextMenu:e.onMenu,...e.place}),l=(0,U.jsx)(CG,{slot:`phone.row`,data:LK(e,r?.manifest,i),fallback:c});return e.swipe?(0,U.jsx)(Du,{left:e.swipe.left,right:e.swipe.right,ground:`paper`,children:l}):l}function WK({model:e}){H();let t=b(e.client.conn);return VK(e.client,8e3)?(0,U.jsx)(`div`,{className:`relative z-1 h-0`,children:(0,U.jsx)(`p`,{className:`absolute inset-x-0 top-0 m-0 truncate bg-paper px-4 pb-2 font-sans text-meta text-muted`,"data-rail-note":!0,children:V(t.state===`retrying`?`rail.reconnecting`:`status.connecting`)})}):null}var GK=3e4;function KK({model:e}){let{nav:t}=gS(),n=e.client,[r]=wS(GK),[i,a]=(0,h.useState)(()=>J(n,`routine.list`)??null);(0,h.useEffect)(()=>{let e=!0,t=n.onOpen(()=>ss(n,`routine.list`).then(t=>e&&a(t)).catch(()=>{}));return()=>{e=!1,t()}},[n,r]);let o=(i?.automations??[]).filter(e=>qO(i,e.id)).length;return(0,U.jsx)(ik,{label:t.automations,count:o,onClick:()=>xe(`routines`)})}function qK({model:e}){let{nav:t}=gS(),[n,r]=(0,h.useState)(!1),i=b(FE),a=[...NE(b(e.installedMods),b(e.mods),t)].sort((e,t)=>Number(t.id===i)-Number(e.id===i)),o=V(`rail.extensions`);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(ak,{label:o,onClick:()=>r(!0)}),n&&(0,U.jsx)(vu,{label:o,title:o,onClose:()=>r(!1),children:t=>(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-y-auto px-3 pb-1`,children:[a.map(e=>(0,U.jsxs)(yu,{"data-ext-row":e.id,onClick:()=>{t(),LE(e),xe(e.page)},children:[(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.title}),(0,U.jsx)(`span`,{className:`flex-none font-mono text-meta text-subtle`,children:e.id===i?V(`rail.lastOpened`):e.note})]},e.id)),a.length>0&&(0,U.jsx)(`hr`,{className:`mx-2 my-1 h-px flex-none border-none bg-line`}),(0,U.jsxs)(yu,{"data-ext-row":`add`,onClick:()=>{t(),k.set((0,U.jsx)(aU,{model:e,section:`plugins`}))},children:[(0,U.jsx)(`span`,{className:`w-4 flex-none text-center text-accent`,children:`+`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:V(`rail.addExtension`)})]})]})})]})}var JK=y({ids:new Set,anchor:null});function YK(){JK.get().ids.size>0&&JK.set({ids:new Set,anchor:JK.get().anchor})}function XK(e,t,n,r){let{ids:i,anchor:a}=JK.get();if(e.shiftKey){let e=n.flatMap(e=>e.kind===`task`?[e.id]:[]),i=e.indexOf(a??r??t),o=e.indexOf(t),[s,c]=i<0?[o,o]:[Math.min(i,o),Math.max(i,o)];return JK.set({ids:new Set(e.slice(s,c+1)),anchor:a??r}),!0}if(e.metaKey||e.ctrlKey){let e=new Set(i);return e.size===0&&r&&n.some(e=>e.kind===`task`&&e.id===r)&&e.add(r),e.has(t)?e.delete(t):e.add(t),JK.set({ids:e,anchor:t}),!0}return JK.set({ids:new Set,anchor:t}),!1}function ZK(e){return e.key!==`Escape`||JK.get().ids.size===0?!1:(YK(),e.preventDefault(),!0)}function QK(e,t,n){let{ids:r}=JK.get(),i=n.flatMap(e=>e.kind===`task`&&r.has(e.id)?[e.task]:[]);return r.has(t)&&i.length>1?$K(e,i):(YK(),null)}function $K(e,t){let n=t.length;return[{label:V(`menu.archiveMany`,{count:n}),section:`danger`,run:()=>void rq(e,t)},{label:V(`menu.removeMany`,{count:n}),section:`danger`,danger:!0,run:()=>k.set((0,U.jsx)(sa,{title:V(`menu.removeManyTitle`,{count:n}),body:V(`menu.removeManyBody`),confirmLabel:K(`tasks`,`confirm.deleteConfirm`),onConfirm:async()=>void iq(e,t)}))}]}function eq(e){let t=new Set(e.map(e=>e.id)),n=new Map(e.map(e=>[e.id,e.parentTaskId]));return e.filter(e=>{for(let r=e.parentTaskId;r;r=n.get(r))if(t.has(r))return!1;return!0})}function tq(e,t,n,r){let i=new Map;return Promise.allSettled(t.map(t=>{let a={taskId:t.id,...r(t)},o=t.machine?.id??``,s=(i.get(o)??Promise.resolve()).then(()=>e.client.request(n,a));i.set(o,s.catch(()=>{}));let c=ts(n,a);return c?e.optimistic(c,()=>s):s}))}async function nq(e,t,n,r,i,a,o){YK();let s=await tq(e,t,n,r),c=t.filter((e,t)=>{let n=s[t];return n?.status===`rejected`&&n.reason instanceof Pc&&n.reason.code===i}),l=t.flatMap((e,t)=>{let n=s[t];return n?.status===`rejected`&&!c.includes(e)?[`${e.label}: ${G(n.reason)}`]:[]}),u=s.filter(e=>e.status===`fulfilled`).length;u>0&&o(u),l.length>0&&z(l.join(`
100
+ `):[],[c]),u=(0,h.useRef)(new Set),d=(0,h.useCallback)(async e=>{let n=await ss(t,`github.status`,Tz(e)).catch(n=>J(t,`github.status`,Tz(e))??{status:null,reason:`failed`,message:G(n)});i(t=>({...t,[e]:n}))},[t]),f=(0,h.useCallback)(async()=>{o(!0);try{await Promise.all([``,...l].map(d))}finally{o(!1)}},[d,l]);return(0,h.useEffect)(()=>t.onOpen(()=>void f()),[t,f]),(0,h.useEffect)(()=>{let e=new Set(Object.entries(s).flatMap(([e,t])=>Dz(t.status)?[e]:[])),t=[...u.current].some(t=>!e.has(t));if(u.current=e,t&&f(),e.size===0)return;let n=window.setTimeout(()=>{for(let t of e)d(t)},Ez);return()=>window.clearTimeout(n)},[s,d,f]),{machines:n,probes:s,refreshing:a,refresh:f,probe:d,act:(0,h.useCallback)(async(e,n)=>{try{let r=await t.request(e,n);return r.ok||z(r.message,`error`),r}catch(e){return z(G(e),`error`),null}},[t])}}function kz({term:e,children:t}){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`dt`,{className:wN,children:e}),(0,U.jsx)(`dd`,{className:`${TN(!1)} flex min-w-0 flex-wrap items-baseline gap-x-2.5 gap-y-1`,children:t})]})}var Az=(e,t)=>V(`settings.connectors.${e}`,t),jz={weixin:{copy:`weixin`,command:`rove weixin login`},lark:{copy:`lark`,command:`rove lark connect`}};function Mz({id:e}){return(0,U.jsx)(`svg`,{className:`size-7 flex-none`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:e===`lark`?(0,U.jsx)(`path`,{fill:`currentColor`,d:`M14.6 1.6 1.5 7.2c-.5.2-.5.9 0 1.1l3.4 1.3 1.3 3.9c.2.5.8.6 1.1.2l1.9-2.1 3.3 2.4c.4.3 1 .1 1.1-.4l2-11.2c.1-.5-.5-1-1-.8ZM6 9.3l6.2-5.1-4.8 6-.4 2.1L6 9.3Z`}):(0,U.jsx)(`path`,{fill:`currentColor`,d:`M6 2C3.2 2 1 3.9 1 6.2c0 1.3.7 2.5 1.8 3.2L2.3 11l1.9-1c.6.2 1.2.3 1.8.3h.3A3.6 3.6 0 0 1 6.2 9c0-2.2 2-3.9 4.5-3.9h.2C10.4 3.3 8.4 2 6 2Zm4.7 3.9c-2.1 0-3.7 1.4-3.7 3.1s1.6 3.1 3.7 3.1c.5 0 .9-.1 1.3-.2l1.5.8-.4-1.3c.8-.6 1.3-1.4 1.3-2.4 0-1.7-1.6-3.1-3.7-3.1Z`})})}function Nz(e){let[t,n]=(0,h.useState)(e.initial);return(0,U.jsx)(`input`,{autoFocus:!0,className:`${XM} min-w-0 flex-1 py-0 text-meta`,placeholder:e.placeholder,value:t,spellCheck:!1,onChange:e=>n(e.target.value),onKeyDown:n=>{n.nativeEvent.isComposing||(n.key===`Enter`?(e.onCommit(t),e.onDone()):n.key===`Escape`&&(n.stopPropagation(),e.onDone()))},onBlur:e.onDone})}function Pz({model:e,row:t,reload:n}){let{client:r}=e,i=jz[t.id],[a,o]=(0,h.useState)(!1),[s,c]=(0,h.useState)(!1),[l,u]=(0,h.useState)(null),[d,f]=(0,h.useState)(null),p=async(e,i={})=>{o(!0);try{return await r.request(e,{id:t.id,...i})}catch(e){return z(e instanceof Error?e.message:String(e)),null}finally{o(!1),await n()}},m=async()=>{let e=await p(`connectors.chatConnect`);u(e?.ok===!1&&typeof e.message==`string`?e.message:null)},g=t.allow??[],_=e=>void p(`connectors.chatUpdate`,{allow:e}),v=t=>{B(),e.select(t)};return(0,U.jsxs)(`div`,{className:WN(!0),children:[(0,U.jsxs)(`div`,{className:KN,children:[(0,U.jsxs)(`span`,{className:qN,children:[(0,U.jsx)(Mz,{id:t.id}),(0,U.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,U.jsx)(`span`,{className:HM,children:Az(`${i.copy}Name`)}),(0,U.jsx)(`span`,{className:UM,children:Az(`${i.copy}Description`)})]})]}),t.connected?(0,U.jsx)(W,{variant:`action`,disabled:a,onClick:()=>c(!0),children:Az(`disconnect`)}):t.connectable&&(0,U.jsx)(W,{variant:`filled`,disabled:a,onClick:()=>void m(),children:Az(a?`chatConnecting`:`connect`)})]}),!t.connected&&(l??!t.connectable)&&(0,U.jsx)(`p`,{className:`text-meta text-muted [&_a]:text-accent m-0 pl-10 w-narrow:pl-0`,children:Az(`chatRunInTerminal`,{command:l??i.command})}),t.connected&&(0,U.jsxs)(`dl`,{className:`m-0 grid grid-cols-[max-content_minmax(0,1fr)] gap-x-3.5 gap-y-1.5 text-meta leading-[1.5] pl-10 w-narrow:pl-0`,children:[t.account&&(0,U.jsx)(kz,{term:Az(`chatBot`),children:(0,U.jsx)(`span`,{title:t.since?Az(`chatSince`,{date:t.since.slice(0,10)}):void 0,children:t.account})}),(0,U.jsx)(kz,{term:Az(`chatAgent`),children:t.agentTaskId?(0,U.jsx)(W,{onClick:()=>v(t.agentTaskId),children:Az(`chatOpen`)}):(0,U.jsx)(`span`,{className:`text-muted`,children:Az(`chatAgentNotYet`)})}),(0,U.jsxs)(kz,{term:Az(`chatAllowed`),children:[(0,U.jsx)(`span`,{children:t.owner?Az(`chatYouNamed`,{name:t.owner}):Az(`chatYou`)}),g.map(e=>(0,U.jsxs)(`span`,{className:`inline-flex min-w-0 items-baseline gap-1 text-muted`,children:[(0,U.jsx)(`span`,{className:`max-w-40 truncate`,title:e,children:e}),(0,U.jsx)(W,{hit:`tight`,disabled:a,"aria-label":Az(`chatRemove`,{id:e}),title:Az(`chatRemove`,{id:e}),onClick:()=>_(g.filter(t=>t!==e)),children:`×`})]},e)),d===`allow`?(0,U.jsx)(Nz,{initial:``,placeholder:Az(`chatAllowAdd`),onCommit:e=>e.trim()&&_([...g,e.trim()]),onDone:()=>f(null)}):(0,U.jsx)(W,{disabled:a,onClick:()=>f(`allow`),children:Az(`chatAdd`)})]}),t.tone!==void 0&&(0,U.jsx)(kz,{term:Az(`chatTone`),children:d===`tone`?(0,U.jsx)(Nz,{initial:t.tone,onCommit:e=>e.trim()!==t.tone&&void p(`connectors.chatUpdate`,{tone:e}),onDone:()=>f(null)}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:`min-w-0`,children:t.tone}),(0,U.jsx)(W,{disabled:a,onClick:()=>f(`tone`),children:Az(`chatEdit`)})]})})]}),s&&(0,U.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-sm border-hairline border-line bg-inset px-3 py-2.5 [&_p]:m-0 [&_p]:text-meta [&_p]:text-muted`,children:[(0,U.jsx)(`p`,{children:Az(`chatDisconnectBody`,{name:Az(`${i.copy}Name`),command:i.command})}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2.5`,children:[(0,U.jsx)(W,{onClick:()=>c(!1),children:V(`dialog.cancel`)}),(0,U.jsx)(W,{variant:`danger`,disabled:a,onClick:()=>void p(`connectors.chatDisconnect`).then(()=>c(!1)),children:Az(`disconnect`)})]})]})]})}function Fz({model:e}){let{client:t}=e,[n,r]=(0,h.useState)(()=>J(t,`connectors.chat`)?.connectors),i=()=>ss(t,`connectors.chat`).then(e=>r(e.connectors),()=>r(e=>e??[]));(0,h.useEffect)(()=>{i()},[t]);let a=(n??[]).filter(e=>jz[e.id]);return a.length===0?null:(0,U.jsxs)(`section`,{className:`flex flex-col pt-4`,children:[(0,U.jsx)(`h2`,{className:NM,children:Az(`chat`)}),(0,U.jsx)(`p`,{className:PM,children:Az(`chatHint`)}),(0,U.jsx)(`div`,{className:UN,children:a.map(t=>(0,U.jsx)(Pz,{model:e,row:t,reload:i},t.id))})]})}var $=(e,t)=>V(`settings.connectors.${e}`,t),Iz=[`1/m`,`10/m`,`1/s`,`2/s`,`5/s`],Lz=[``,`7d`,`30d`,`90d`],Rz=e=>e>=1?`${e}/s`:e*60>=1?`${+(e*60).toFixed(2)}/m`:`${+(e*3600).toFixed(2)}/h`,zz=e=>new Date(e).toLocaleString();function Bz(e){navigator.clipboard.writeText(e).then(()=>z($(`inboxCopied`)),()=>{})}var Vz=e=>()=>k.set((0,U.jsx)(oU,{model:e,section:`connectors`}));function Hz({label:e,value:t}){return(0,U.jsxs)(`div`,{className:ri,children:[(0,U.jsx)(`span`,{className:ii,children:e}),(0,U.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[(0,U.jsx)(`code`,{className:`min-w-0 flex-1 select-all break-all rounded-sm bg-inset px-2 py-1 text-meta`,children:t}),(0,U.jsx)(W,{onClick:()=>Bz(t),children:$(`inboxCopy`)})]})]})}function Uz({model:e}){let{client:t}=e,n=Vz(e),[r,i]=(0,h.useState)(()=>J(t,`routine.list`)?.automations.filter(e=>!e.script)??null),[a,o]=(0,h.useState)(``),[s,c]=(0,h.useState)(``),[l,u]=(0,h.useState)(``),[d,f]=(0,h.useState)(`2/s`),[p,m]=(0,h.useState)(`5`),[g,_]=(0,h.useState)(``),[v,y]=(0,h.useState)(!1),[b,x]=(0,h.useState)(null),[S,C]=(0,h.useState)(null);(0,h.useEffect)(()=>{ss(t,`routine.list`).then(e=>i(e.automations.filter(e=>!e.script)),()=>i(e=>e??[]))},[t]);let w=async()=>{y(!0),x(null);try{C(await t.request(`inbox.tokenAdd`,{name:a.trim(),...s.trim()?{id:s.trim()}:{},...l===`agent`?{agent:!0}:l?{to:`routine:${l}`}:{},rate:d,burst:Number(p),...g?{expires:g}:{}}))}catch(e){x(G(e))}finally{y(!1)}};return S?(0,U.jsx)(ia,{title:$(`inboxCreatedTitle`,{name:S.name}),wide:!0,onClose:n,children:(0,U.jsxs)(`div`,{className:hi,children:[(0,U.jsx)(`p`,{className:`m-0 text-warning`,children:$(`inboxCreated`)}),(0,U.jsx)(Hz,{label:$(`inboxAddress`),value:S.url}),(0,U.jsx)(Hz,{label:$(`inboxKey`),value:S.recipient}),(0,U.jsx)(Hz,{label:$(`inboxToken`),value:S.token}),(0,U.jsx)(Hz,{label:$(`inboxCommand`),value:S.command}),(0,U.jsx)(`p`,{className:`${UM} m-0`,children:$(`inboxCopyPromptNote`)}),(0,U.jsxs)(`div`,{className:Qr,children:[(0,U.jsx)(W,{variant:`action`,onClick:()=>Bz(S.prompt),children:$(`inboxCopyPrompt`)}),(0,U.jsx)(W,{variant:`filled`,onClick:n,children:$(`inboxDone`)})]})]})}):(0,U.jsx)(ia,{title:$(`inboxDialogTitle`),onClose:n,children:(0,U.jsxs)(`form`,{className:hi,onSubmit:e=>{e.preventDefault(),a.trim()&&w()},children:[(0,U.jsxs)(`label`,{className:ri,children:[(0,U.jsx)(`span`,{className:ii,children:$(`inboxName`)}),(0,U.jsx)(`input`,{className:XM,autoFocus:!0,spellCheck:!1,placeholder:`Grok Bot`,value:a,onChange:e=>o(e.target.value)})]}),(0,U.jsxs)(`label`,{className:ri,children:[(0,U.jsx)(`span`,{className:ii,children:$(`inboxId`)}),(0,U.jsx)(`input`,{className:`${XM} font-mono`,spellCheck:!1,autoCapitalize:`off`,placeholder:$(`inboxIdAuto`),value:s,onChange:e=>c(e.target.value)})]}),(0,U.jsxs)(`div`,{className:ri,children:[(0,U.jsx)(`span`,{className:ii,children:$(`inboxPickRoutine`)}),(0,U.jsx)(tM,{label:$(`inboxPickRoutine`),value:l,picks:[{value:``,label:$(`inboxDeliverOnly`)},{value:`agent`,label:$(`inboxStartsAgent`)},...(r??[]).map(e=>({value:e.id,label:$(`inboxStartsRoutine`,{name:e.name})}))],onPick:u})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-4`,children:[(0,U.jsxs)(`div`,{className:ri,children:[(0,U.jsx)(`span`,{className:ii,children:$(`inboxRate`)}),(0,U.jsx)(tM,{label:$(`inboxRate`),value:d,picks:Iz.map(e=>({value:e,label:e})),onPick:f})]}),(0,U.jsxs)(`label`,{className:ri,children:[(0,U.jsx)(`span`,{className:ii,children:$(`inboxBurst`)}),(0,U.jsx)(`input`,{className:`${XM} w-20`,inputMode:`numeric`,value:p,onChange:e=>m(e.target.value.replace(/\D/g,``))})]}),(0,U.jsxs)(`div`,{className:ri,children:[(0,U.jsx)(`span`,{className:ii,children:$(`inboxExpiry`)}),(0,U.jsx)(tM,{label:$(`inboxExpiry`),value:g,picks:Lz.map(e=>({value:e,label:e?$(`inboxExpiryDays`,{days:Number.parseInt(e,10)}):$(`inboxExpiryNever`)})),onPick:_})]})]}),b&&(0,U.jsx)(`p`,{className:`m-0 text-error`,children:b}),(0,U.jsxs)(`div`,{className:Qr,children:[(0,U.jsx)(W,{onClick:n,children:V(`dialog.cancel`)}),(0,U.jsx)(W,{type:`submit`,variant:`filled`,disabled:v||!a.trim(),children:$(`inboxCreate`)})]})]})})}function Wz({row:e,onRevoke:t}){let[n,r]=(0,h.useState)(!1),[i,a]=(0,h.useState)(!1),o=[$(`inboxRateValue`,{rate:Rz(e.rate),burst:e.burst}),e.daily?$(`inboxDaily`,{daily:e.daily}):``,e.expiresAt?$(`inboxExpires`,{date:zz(e.expiresAt)}):``].filter(Boolean);return(0,U.jsxs)(`div`,{className:WN(!0),children:[(0,U.jsxs)(`div`,{className:KN,children:[(0,U.jsx)(`span`,{className:qN,children:(0,U.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,U.jsx)(`span`,{className:HM,children:e.name}),e.id!==e.name&&(0,U.jsx)(`span`,{className:`text-meta text-muted [&_a]:text-accent font-mono`,children:e.id})]}),(0,U.jsx)(`span`,{className:UM,children:e.routineId?e.routineName??$(`inboxMissingRoutine`):$(e.agent?`inboxStartsAgent`:`inboxKeeps`)})]})}),(0,U.jsx)(W,{variant:`action`,disabled:i,onClick:()=>r(!0),children:$(`inboxRevoke`)})]}),(0,U.jsxs)(`dl`,{className:CN,children:[(0,U.jsx)(kz,{term:$(`inboxRate`),children:o.join(` · `)}),(0,U.jsx)(kz,{term:$(`inboxLastUsed`),children:e.lastUsedAt?zz(e.lastUsedAt):$(`inboxNever`)}),(0,U.jsx)(kz,{term:$(`inboxDay`),children:$(`inboxDayValue`,e.last24h)}),e.recent.length>0&&(0,U.jsx)(kz,{term:$(`inboxRecent`),children:(0,U.jsx)(`ul`,{className:`m-0 flex w-full list-none flex-col gap-0.5 p-0`,children:e.recent.slice(0,8).map(e=>(0,U.jsxs)(`li`,{className:`flex min-w-0 gap-2`,children:[(0,U.jsx)(`span`,{className:`text-subtle tabular-nums`,children:zz(e.at)}),(0,U.jsx)(`span`,{className:e.accepted?`text-diff-added`:`text-diff-removed`,children:e.accepted?$(`inboxAccepted`):$(`inboxRefused`,{reason:e.reason})})]},e.at))})})]}),n&&(0,U.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-sm border-hairline border-line bg-inset px-3 py-2.5 [&_p]:m-0 [&_p]:text-meta [&_p]:text-muted`,children:[(0,U.jsx)(`p`,{children:$(`inboxRevokeBody`,{name:e.name})}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2.5`,children:[(0,U.jsx)(W,{onClick:()=>r(!1),children:V(`dialog.cancel`)}),(0,U.jsx)(W,{variant:`danger`,disabled:i,onClick:()=>{a(!0),t().finally(()=>a(!1))},children:$(`inboxRevoke`)})]})]})]})}function Gz({model:e}){let{client:t}=e,[n,r]=(0,h.useState)(()=>J(t,`inbox.status`)??null),[i,a]=(0,h.useState)(!1),[o,s]=(0,h.useState)(!1),c=()=>ss(t,`inbox.status`).then(r,e=>z($(`inboxFailed`,{error:G(e)}),`error`));(0,h.useEffect)(()=>{c()},[t]);let l=async(e,n={})=>{s(!0);try{await t.request(e,n)}catch(e){z(G(e),`error`)}finally{s(!1),await c()}},u=n?.address;return(0,U.jsxs)(`section`,{className:`flex flex-col pt-4`,children:[(0,U.jsx)(`h2`,{className:NM,children:$(`inbox`)}),(0,U.jsx)(`p`,{className:PM,children:$(`inboxHint`)}),(0,U.jsxs)(`div`,{className:UN,children:[(0,U.jsxs)(`div`,{className:WN(!0),children:[(0,U.jsxs)(`div`,{className:KN,children:[(0,U.jsx)(`span`,{className:qN,children:(0,U.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,U.jsx)(`span`,{className:HM,children:$(`inboxTitle`)}),(0,U.jsx)(`span`,{className:UM,children:$(`inboxNote`)})]})}),(0,U.jsx)(W,{variant:`filled`,onClick:()=>k.set((0,U.jsx)(Uz,{model:e})),children:$(`inboxNew`)})]}),u?(0,U.jsxs)(`dl`,{className:CN,children:[(0,U.jsx)(kz,{term:$(`inboxAddress`),children:(0,U.jsx)(`code`,{className:`min-w-0 select-all break-all`,children:u.url})}),(0,U.jsxs)(kz,{term:$(`inboxKey`),children:[(0,U.jsx)(`code`,{className:`min-w-0 select-all break-all`,children:u.recipient}),(0,U.jsx)(W,{disabled:o,onClick:()=>a(!0),children:$(`inboxRotate`)})]})]}):n&&(0,U.jsx)(`p`,{className:`text-meta text-muted [&_a]:text-accent m-0`,children:$(`inboxNone`)}),i&&(0,U.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-sm border-hairline border-line bg-inset px-3 py-2.5 [&_p]:m-0 [&_p]:text-meta [&_p]:text-muted`,children:[(0,U.jsx)(`p`,{children:$(`inboxRotateBody`)}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2.5`,children:[(0,U.jsx)(W,{onClick:()=>a(!1),children:V(`dialog.cancel`)}),(0,U.jsx)(W,{variant:`danger`,disabled:o,onClick:()=>void l(`inbox.rotate`).then(()=>{a(!1),z($(`inboxRotated`))}),children:$(`inboxRotate`)})]})]})]}),n?.tokens.map(e=>(0,U.jsx)(Wz,{row:e,onRevoke:()=>l(`inbox.tokenRevoke`,{id:e.id})},e.id))]})]})}function Kz(e){let t=e?/\bRoveApp\/(\S+) \(([\w,]+); ([0-9a-f]{8,})(?:; ([\d.]+))?\)/.exec(e):null;return t?{build:t[1],model:t[2],deviceId:t[3],...t[4]?{os:t[4]}:{}}:null}var qz=(e=>(e[e.Border=-1]=`Border`,e[e.Data=0]=`Data`,e[e.Function=1]=`Function`,e[e.Position=2]=`Position`,e[e.Timing=3]=`Timing`,e[e.Alignment=4]=`Alignment`,e))(qz||{}),Jz=[0,1],Yz=[1,0],Xz=[2,3],Zz=[3,2],Qz={L:Jz,M:Yz,Q:Xz,H:Zz},$z=/^\d*$/,eB=/^[A-Z0-9 $%*+./:-]*$/,tB=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`,nB=1,rB=40,iB=3,aB=3,oB=40,sB=10,cB=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],lB=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],uB=class{constructor(e,t,n,r){if(this.version=e,this.ecc=t,e<nB||e>rB)throw RangeError(`Version value out of range`);if(r<-1||r>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let i=Array.from({length:this.size}).fill(!1);for(let e=0;e<this.size;e++)this.modules.push(i.slice()),this.types.push(i.map(()=>0));this.drawFunctionPatterns();let a=this.addEccAndInterleave(n);if(this.drawCodewords(a),r===-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(r=t,e=n),this.applyMask(t)}}this.mask=r,this.applyMask(r),this.drawFormatBits(r)}size;mask;modules=[];types=[];getModule(e,t){return e>=0&&e<this.size&&t>=0&&t<this.size&&this.modules[t][e]}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0,qz.Timing),this.setFunctionModule(e,6,e%2==0,qz.Timing);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n===0&&r===0||n===0&&r===t-1||n===t-1&&r===0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.ecc[1]<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let r=(t<<10|n)^21522;for(let e=0;e<=5;e++)this.setFunctionModule(8,e,fB(r,e));this.setFunctionModule(8,7,fB(r,6)),this.setFunctionModule(8,8,fB(r,7)),this.setFunctionModule(7,8,fB(r,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,fB(r,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,fB(r,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,fB(r,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;for(let e=0;e<18;e++){let n=fB(t,e),r=this.size-11+e%3,i=Math.floor(e/3);this.setFunctionModule(r,i,n),this.setFunctionModule(i,r,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;a>=0&&a<this.size&&o>=0&&o<this.size&&this.setFunctionModule(a,o,i!==2&&i!==4,qz.Position)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!==1,qz.Alignment)}setFunctionModule(e,t,n,r=qz.Function){this.modules[t][e]=n,this.types[t][e]=r}addEccAndInterleave(e){let t=this.version,n=this.ecc;if(e.length!==DB(t,n))throw RangeError(`Invalid argument`);let r=lB[n[0]][t],i=cB[n[0]][t],a=Math.floor(EB(t)/8),o=r-a%r,s=Math.floor(a/r),c=[],l=OB(i);for(let t=0,n=0;t<r;t++){let r=e.slice(n,n+s-i+(t<o?0:1));n+=r.length;let a=kB(r,l);t<o&&r.push(0),c.push(r.concat(a))}let u=[];for(let e=0;e<c[0].length;e++)c.forEach((t,n)=>{(e!==s-i||n>=o)&&u.push(t[e])});return u}drawCodewords(e){if(e.length!==Math.floor(EB(this.version)/8))throw RangeError(`Invalid argument`);let t=0;for(let n=this.size-1;n>=1;n-=2){n===6&&(n=5);for(let r=0;r<this.size;r++)for(let i=0;i<2;i++){let a=n-i,o=n+1&2?r:this.size-1-r;!this.types[o][a]&&t<e.length*8&&(this.modules[o][a]=fB(e[t>>>3],7-(t&7)),t++)}}}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.types[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let t=0;t<this.size;t++){let n=!1,r=0,i=[0,0,0,0,0,0,0];for(let a=0;a<this.size;a++)this.modules[t][a]===n?(r++,r===5?e+=iB:r>5&&e++):(this.finderPenaltyAddHistory(r,i),n||(e+=this.finderPenaltyCountPatterns(i)*oB),n=this.modules[t][a],r=1);e+=this.finderPenaltyTerminateAndCount(n,r,i)*oB}for(let t=0;t<this.size;t++){let n=!1,r=0,i=[0,0,0,0,0,0,0];for(let a=0;a<this.size;a++)this.modules[a][t]===n?(r++,r===5?e+=iB:r>5&&e++):(this.finderPenaltyAddHistory(r,i),n||(e+=this.finderPenaltyCountPatterns(i)*oB),n=this.modules[a][t],r=1);e+=this.finderPenaltyTerminateAndCount(n,r,i)*oB}for(let t=0;t<this.size-1;t++)for(let n=0;n<this.size-1;n++){let r=this.modules[t][n];r===this.modules[t][n+1]&&r===this.modules[t+1][n]&&r===this.modules[t+1][n+1]&&(e+=aB)}let t=0;for(let e of this.modules)t=e.reduce((e,t)=>e+ +!!t,t);let n=this.size*this.size,r=Math.ceil(Math.abs(t*20-n*10)/n)-1;return e+=r*sB,e}getAlignmentPatternPositions(){if(this.version===1)return[];{let e=Math.floor(this.version/7)+2,t=this.version===32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}finderPenaltyCountPatterns(e){let t=e[1],n=t>0&&e[2]===t&&e[3]===t*3&&e[4]===t&&e[5]===t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]===0&&(e+=this.size),t.pop(),t.unshift(e)}};function dB(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function fB(e,t){return!!(e>>>t&1)}var pB=class{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}getData(){return this.bitData.slice()}},mB=[1,10,12,14],hB=[2,9,11,13],gB=[4,8,16,16];function _B(e,t){return e[Math.floor((t+7)/17)+1]}function vB(e){let t=[];for(let n of e)dB(n,8,t);return new pB(gB,e.length,t)}function yB(e){if(!SB(e))throw RangeError(`String contains non-numeric characters`);let t=[];for(let n=0;n<e.length;){let r=Math.min(e.length-n,3);dB(Number.parseInt(e.substring(n,n+r),10),r*3+1,t),n+=r}return new pB(mB,e.length,t)}function bB(e){if(!CB(e))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let t=[],n;for(n=0;n+2<=e.length;n+=2){let r=tB.indexOf(e.charAt(n))*45;r+=tB.indexOf(e.charAt(n+1)),dB(r,11,t)}return n<e.length&&dB(tB.indexOf(e.charAt(n)),6,t),new pB(hB,e.length,t)}function xB(e){return e===``?[]:SB(e)?[yB(e)]:CB(e)?[bB(e)]:[vB(TB(e))]}function SB(e){return $z.test(e)}function CB(e){return eB.test(e)}function wB(e,t){let n=0;for(let r of e){let e=_B(r.mode,t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}function TB(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)===`%`?(t.push(Number.parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}function EB(e){if(e<nB||e>rB)throw RangeError(`Version number out of range`);let t=(16*e+128)*e+64;if(e>=2){let n=Math.floor(e/7)+2;t-=(25*n-10)*n-55,e>=7&&(t-=36)}return t}function DB(e,t){return Math.floor(EB(e)/8)-cB[t[0]][e]*lB[t[0]][e]}function OB(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let t=[];for(let n=0;n<e-1;n++)t.push(0);t.push(1);let n=1;for(let r=0;r<e;r++){for(let e=0;e<t.length;e++)t[e]=AB(t[e],n),e+1<t.length&&(t[e]^=t[e+1]);n=AB(n,2)}return t}function kB(e,t){let n=t.map(e=>0);for(let r of e){let e=r^n.shift();n.push(0),t.forEach((t,r)=>n[r]^=AB(t,e))}return n}function AB(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return n}function jB(e,t,n=1,r=40,i=-1,a=!0){if(!(nB<=n&&n<=r&&r<=rB)||i<-1||i>7)throw RangeError(`Invalid value`);let o,s;for(o=n;;o++){let n=DB(o,t)*8,i=wB(e,o);if(i<=n){s=i;break}if(o>=r)throw RangeError(`Data too long`)}for(let e of[Yz,Xz,Zz])a&&s<=DB(o,e)*8&&(t=e);let c=[];for(let t of e){dB(t.mode[0],4,c),dB(t.numChars,_B(t.mode,o),c);for(let e of t.getData())c.push(e)}let l=DB(o,t)*8;dB(0,Math.min(4,l-c.length),c),dB(0,(8-c.length%8)%8,c);for(let e=236;c.length<l;e^=253)dB(e,8,c);let u=Array.from({length:Math.ceil(c.length/8)},()=>0);return c.forEach((e,t)=>u[t>>>3]|=e<<7-(t&7)),new uB(o,t,u,i)}function MB(e,t){let{ecc:n=`L`,boostEcc:r=!1,minVersion:i=1,maxVersion:a=40,maskPattern:o=-1,border:s=1}=t||{},c=typeof e==`string`?xB(e):Array.isArray(e)?[vB(e)]:void 0;if(!c)throw Error(`uqr only supports encoding string and binary data, but got: ${typeof e}`);let l=jB(c,Qz[n],i,a,o,r),u=NB({version:l.version,maskPattern:l.mask,size:l.size,data:l.modules,types:l.types},s);return t?.invert&&(u.data=u.data.map(e=>e.map(e=>!e))),t?.onEncoded?.(u),u}function NB(e,t=1){if(!t)return e;let{size:n}=e,r=n+t*2;e.size=r,e.data.forEach(e=>{for(let n=0;n<t;n++)e.unshift(!1),e.push(!1)});for(let n=0;n<t;n++)e.data.unshift(Array.from({length:r},e=>!1)),e.data.push(Array.from({length:r},e=>!1));let i=qz.Border;e.types.forEach(e=>{for(let n=0;n<t;n++)e.unshift(i),e.push(i)});for(let n=0;n<t;n++)e.types.unshift(Array.from({length:r},e=>i)),e.types.push(Array.from({length:r},e=>i));return e}function PB(e){return e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function FB(e,t={}){let n=MB(e,t),{pixelSize:r=10,whiteColor:i=`white`,blackColor:a=`black`}=t,o=n.size*r,s=n.size*r,c=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${s} ${o}">`,l=[];for(let e=0;e<n.size;e++)for(let t=0;t<n.size;t++){let i=t*r,a=e*r;n.data[e][t]&&l.push(`M${i},${a}h${r}v${r}h-${r}z`)}return c+=`<rect fill="${PB(i)}" width="${s}" height="${o}"/>`,c+=`<path fill="${PB(a)}" d="${l.join(``)}"/>`,c+=`</svg>`,c}var IB=(e,t)=>V(`settings.connectors.${e}`,t),LB=5e3,RB={"iPhone14,4":`iPhone 13 mini`,"iPhone14,5":`iPhone 13`,"iPhone14,2":`iPhone 13 Pro`,"iPhone14,3":`iPhone 13 Pro Max`,"iPhone14,6":`iPhone SE`,"iPhone14,7":`iPhone 14`,"iPhone14,8":`iPhone 14 Plus`,"iPhone15,2":`iPhone 14 Pro`,"iPhone15,3":`iPhone 14 Pro Max`,"iPhone15,4":`iPhone 15`,"iPhone15,5":`iPhone 15 Plus`,"iPhone16,1":`iPhone 15 Pro`,"iPhone16,2":`iPhone 15 Pro Max`,"iPhone17,3":`iPhone 16`,"iPhone17,4":`iPhone 16 Plus`,"iPhone17,1":`iPhone 16 Pro`,"iPhone17,2":`iPhone 16 Pro Max`,"iPhone17,5":`iPhone 16e`,"iPhone18,3":`iPhone 17`,"iPhone18,1":`iPhone 17 Pro`,"iPhone18,2":`iPhone 17 Pro Max`,"iPhone18,4":`iPhone Air`};function zB(e){if(!e)return null;let t=Kz(e),n=/\b(iPhone|iPad)\b.*? OS (\d+)_(\d+)/.exec(e);if(n){let e=t?RB[t.model]??t.model:n[1],r=`${n[1]===`iPad`?`iPadOS`:`iOS`} ${t?.os??`${n[2]}.${n[3]}`}`;return t?`${e} · ${r} · Rove app`:`${e} · ${r}`}let r=/Android (\d+(?:\.\d+)?)/.exec(e);return r?`Android ${r[1]}`:null}function BB(e){let[t,n]=(0,h.useState)([]),r=(0,h.useCallback)(async()=>{try{n((await e.client.request(`phone.list`)).phones)}catch{}},[e]);return(0,h.useEffect)(()=>{let t=window.setInterval(()=>void r(),LB),n=e.client.onOpen(()=>void r());return r(),()=>{window.clearInterval(t),n()}},[e,r]),{phones:t,load:r}}function VB({phone:e,model:t,onForgot:n}){let r=H()===`zh`?`zh-CN`:`en-US`,[i,a]=(0,h.useState)(!1),[o,s]=(0,h.useState)(!1),c=e=>new Date(e).toLocaleDateString(r,{month:`short`,day:`numeric`}),l=e.connected?IB(`phoneConnected`):IB(`phoneLastSeen`,{time:(e=>new Date(e).toLocaleString(r,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}))(e.lastSeenAt)}),u=async()=>{s(!0);try{await t.client.request(`phone.forget`,{device:e.device}),n()}catch(e){z(IB(`phoneForgetFailed`,{error:G(e)}),`error`)}finally{s(!1),a(!1)}};return(0,U.jsxs)(`li`,{className:`flex flex-col gap-2 py-2.5`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,U.jsx)(`span`,{className:HM,children:zB(e.userAgent)??IB(`phoneUnknown`)}),(0,U.jsxs)(`span`,{className:`${UM} truncate`,children:[(0,U.jsx)(`span`,{className:e.connected?`text-success`:void 0,children:l}),` · `,IB(`phonePairedOn`,{date:c(e.pairedAt)}),` · `,(0,U.jsx)(`span`,{className:`font-mono`,children:Kz(e.userAgent)?.deviceId??e.device})]})]}),!i&&(0,U.jsx)(W,{variant:`action`,onClick:()=>a(!0),children:IB(`phoneForget`)})]}),i&&(0,U.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-sm border-hairline border-line bg-inset px-3 py-2.5 [&_p]:m-0 [&_p]:text-meta [&_p]:text-muted`,children:[(0,U.jsx)(`p`,{children:IB(`phoneForgetBody`)}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2.5`,children:[(0,U.jsx)(W,{onClick:()=>a(!1),children:V(`dialog.cancel`)}),(0,U.jsx)(W,{variant:`danger`,disabled:o,onClick:()=>void u(),children:IB(`phoneForget`)})]})]})]})}function HB({model:e}){let{phones:t,load:n}=BB(e),[r,i]=(0,h.useState)(!1),a=(0,h.useRef)(null),[o,s]=(0,h.useState)(null),c=async()=>{s(null),i(!0);try{s(await e.client.request(`phone.pair`)),n()}catch(e){i(!1),z(IB(`phoneFailed`,{error:G(e)}),`error`)}};return(0,U.jsxs)(`section`,{className:`flex flex-col pt-4`,children:[(0,U.jsx)(`h2`,{className:NM,children:IB(`phone`)}),(0,U.jsx)(`p`,{className:PM,children:IB(`phoneHint`)}),(0,U.jsx)(`div`,{className:UN,children:(0,U.jsxs)(`div`,{className:WN(!0),ref:a,children:[(0,U.jsxs)(`div`,{className:KN,children:[(0,U.jsx)(`span`,{className:qN,children:(0,U.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,U.jsx)(`span`,{className:HM,children:IB(`phoneTitle`)}),(0,U.jsx)(`span`,{className:UM,children:IB(`phoneNote`)})]})}),r?(0,U.jsx)(W,{onClick:()=>i(!1),children:IB(`phoneHide`)}):(0,U.jsx)(W,{variant:`filled`,onClick:()=>void c(),children:IB(`phoneShow`)})]}),(0,U.jsx)(`div`,{className:JN(r),inert:!r,onTransitionEnd:e=>{e.target===e.currentTarget&&(r?a.current?.scrollIntoView({block:`nearest`,behavior:`smooth`}):s(null))},children:(0,U.jsx)(`div`,{className:`min-h-0 overflow-hidden`,children:(0,U.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4 pt-1`,children:[o?(0,U.jsx)(`img`,{className:`size-48 flex-none rounded-sm bg-white p-2 motion-safe:animate-qr-in`,alt:IB(`phoneQrAlt`),src:`data:image/svg+xml;utf8,${encodeURIComponent(FB(o.link,{blackColor:`#000`,whiteColor:`#fff`}))}`}):(0,U.jsxs)(`output`,{className:`flex size-48 flex-none flex-col items-center justify-center gap-2 rounded-sm border-hairline border-dashed border-line text-meta text-muted`,children:[(0,U.jsx)(Fy,{}),IB(`phoneMaking`)]}),o&&(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2 text-meta text-muted motion-safe:animate-rise-in`,children:[(0,U.jsx)(`p`,{children:IB(`phoneSecret`)}),(0,U.jsx)(`p`,{children:IB(`phoneDevice`,{device:o.device})}),(0,U.jsx)(`div`,{children:(0,U.jsx)(W,{onClick:()=>navigator.clipboard.writeText(o.link).then(()=>z(IB(`phoneCopied`)),()=>{}),children:IB(`phoneCopy`)})})]})]})})}),t.length>0&&(0,U.jsx)(`ul`,{className:`m-0 flex list-none flex-col border-t-hairline border-t-line p-0 [&>li+li]:border-t-hairline [&>li+li]:border-t-line`,children:t.map(t=>(0,U.jsx)(VB,{phone:t,model:e,onForgot:()=>void n()},t.device))})]})})]})}var UB={same:`markSame`,different:`markDifferent`,signedOut:`markSignedOut`,noGh:`markNoGh`,outdated:`markOutdated`,offline:`markOffline`,denied:`markDenied`,failed:`markFailed`},WB=(e,t)=>V(`settings.connectors.${e}`,t),GB={same:`text-diff-added`,signedOut:`text-diff-removed`,failed:`text-diff-removed`,denied:`text-diff-removed`,different:`text-warning`,outdated:`text-warning`,offline:`text-muted`,noGh:`text-muted`,loading:`text-muted`};function KB(e,t){return e===`loading`?WB(`loading`):WB(UB[e],{login:t?.account??``})}function qB(e){if(!e?.gh)return``;let t=e.ssh.ok?`✓ ${e.ssh.user??``}`.trim():`✗`;return WB(`detail`,{protocol:e.protocol??`—`,ssh:t})}function JB(){return(0,U.jsx)(`svg`,{className:`size-7 flex-none`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,U.jsx)(`path`,{fill:`currentColor`,d:`M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z`})})}function YB(e){navigator.clipboard.writeText(e).then(()=>z(WB(`codeCopied`)),()=>{})}function XB({login:e,onCancel:t}){return e.state===`failed`?(0,U.jsxs)(`div`,{className:eN,children:[(0,U.jsx)(`span`,{className:`text-muted`,children:WB(`loginFailed`,{error:e.error??``})}),(0,U.jsx)(W,{className:`ml-auto`,onClick:t,children:WB(`dismiss`)})]}):e.state===`syncing`?(0,U.jsx)(`div`,{className:eN,children:(0,U.jsx)(`span`,{className:`text-muted`,children:WB(`syncing`)})}):(0,U.jsxs)(`div`,{className:eN,children:[e.code?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`button`,{type:`button`,className:`font-mono font-normal normal-nums rounded-sm border-hairline border-dashed border-line px-2 py-0.5 text-display tracking-code`,title:WB(`codeHint`),onClick:()=>YB(e.code??``),children:e.code}),(0,U.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,children:WB(`openGithub`)})]}):(0,U.jsx)(`span`,{className:`text-muted`,children:WB(`loading`)}),(0,U.jsx)(W,{className:`ml-auto`,onClick:t,children:V(`dialog.cancel`)})]})}function ZB(e){let t=wz(e.probe,e.machine,e.rove),n=e.probe?.status??null,r=Dz(n),i=t===`different`||t===`signedOut`,a=n?.login,o=qB(n),s=i&&!r;return(0,U.jsxs)(`div`,{className:WN(),children:[(0,U.jsxs)(`div`,{className:GN,children:[(0,U.jsx)(`span`,{className:`${HM} min-w-0 flex-1 truncate`,children:e.name}),(0,U.jsx)(`span`,{className:`whitespace-nowrap text-meta ${GB[t]}`,title:e.probe?.message,children:KB(t,n)})]}),o&&(0,U.jsx)(`span`,{className:kN(),title:[n?.authDetail,n?.ssh.detail].filter(Boolean).join(`, `)||void 0,children:o}),s&&(e.onSync||e.onLogin)&&(0,U.jsxs)(`div`,{className:`mt-auto flex flex-wrap gap-2`,children:[e.onSync&&e.rove&&(0,U.jsx)(W,{variant:`action`,disabled:e.busy,onClick:e.onSync,children:WB(`useRove`)}),e.onLogin&&(0,U.jsx)(W,{variant:`action`,disabled:e.busy,onClick:e.onLogin,children:WB(`loginThere`)})]}),a&&(0,U.jsx)(XB,{login:a,onCancel:e.onCancel})]})}function QB({model:e}){let{machines:t,probes:n,refreshing:r,refresh:i,probe:a,act:o}=Oz(e),[s,c]=(0,h.useState)(null),[l,u]=(0,h.useState)(!1),d=n[``],f=d?.status?.account??null,p=Dz(d?.status),m=async(e,t)=>{c(e);try{await t()}finally{c(null)}},g=e=>m(e,async()=>{await o(`github.login`,e===``?{}:{machine:e}),await a(e)}),_=e=>m(e,async()=>{await o(`github.login`,e===``?{cancel:!0}:{machine:e,cancel:!0}),await a(e)}),v=e=>m(e,async()=>{(await o(`github.sync`,{machine:e}))?.ok&&z(WB(`synced`,{machine:e,login:f??``})),await a(e)}),y=()=>m(``,async()=>{(await o(`github.logout`,{}))?.ok&&u(!1),await i()});return(0,U.jsxs)(`div`,{className:UN,children:[(0,U.jsxs)(`div`,{className:WN(!0),children:[(0,U.jsxs)(`div`,{className:KN,children:[(0,U.jsxs)(`span`,{className:qN,children:[(0,U.jsx)(JB,{}),(0,U.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,U.jsx)(`span`,{className:HM,children:`GitHub`}),(0,U.jsx)(`span`,{className:UM,children:WB(`githubDescription`)})]})]}),f?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`span`,{className:WM,children:[`@`,f]}),(0,U.jsx)(W,{variant:`action`,disabled:s!==null,onClick:()=>u(!0),children:WB(`disconnect`)})]}):d?.status?!p&&(0,U.jsx)(W,{variant:`filled`,disabled:s!==null,onClick:()=>void g(``),children:WB(`connect`)}):(0,U.jsx)(`span`,{className:`text-meta text-muted`,title:d?.message,children:d?KB(wz(d,null,null),null):WB(`loading`)})]}),l&&(0,U.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-sm border-hairline border-line bg-inset px-3 py-2.5 [&_p]:m-0 [&_p]:text-meta [&_p]:text-muted`,children:[(0,U.jsx)(`p`,{children:WB(`disconnectBody`)}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2.5`,children:[(0,U.jsx)(W,{onClick:()=>u(!1),children:V(`dialog.cancel`)}),(0,U.jsx)(W,{variant:`danger`,disabled:s!==null,onClick:()=>void y(),children:WB(`disconnect`)})]})]}),!f&&d?.status?.login&&(0,U.jsx)(XB,{login:d.status.login,onCancel:()=>void _(``)})]}),(f||!d?.status)&&(0,U.jsxs)(`section`,{className:`col-span-2 flex flex-col pt-4 w-narrow:col-span-1`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3 pb-1.5 [&>h2]:pb-0`,children:[(0,U.jsx)(`h2`,{className:`m-0 pb-1.5 font-sans text-meta font-medium normal-nums text-muted w-narrow:px-3 w-narrow:font-normal w-narrow:text-subtle`,children:WB(`machines`)}),r?(0,U.jsx)(`span`,{className:`text-meta text-muted`,children:WB(`refreshing`)}):(0,U.jsx)(W,{onClick:()=>void i(),children:WB(`refresh`)})]}),(0,U.jsx)(`p`,{className:`m-0 pb-2 text-meta text-subtle w-narrow:order-last w-narrow:px-3 w-narrow:pt-1.5 w-narrow:pb-0`,children:WB(`machinesHint`)}),(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-2.5 w-narrow:grid-cols-1`,children:[(0,U.jsx)(ZB,{name:WB(`thisMachine`),probe:d,machine:null,rove:f,busy:s!==null,onCancel:()=>void _(``)}),t.map(e=>(0,U.jsx)(ZB,{name:e.alias,probe:n[e.alias],machine:e.state,rove:f,busy:s!==null,onSync:()=>void v(e.alias),onLogin:()=>void g(e.alias),onCancel:()=>void _(e.alias)},e.alias))]})]})]})}function $B({model:e}){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{"data-setting-id":`connectors.github`,className:gM,children:(0,U.jsx)(QB,{model:e})}),(0,U.jsx)(`div`,{"data-setting-id":`connectors.chat`,className:gM,children:(0,U.jsx)(Fz,{model:e})}),(0,U.jsx)(`div`,{"data-setting-id":`connectors.phone`,className:gM,children:(0,U.jsx)(HB,{model:e})}),(0,U.jsx)(`div`,{"data-setting-id":`connectors.inbox`,className:gM,children:(0,U.jsx)(Gz,{model:e})})]})}var eV=[{key:`remoteProjects`,label:`dev.remote`,hint:`dev.remoteHint`},{key:`autoStatus`,label:`dev.autoStatus`,hint:`dev.autoStatusHint`},{key:`dispatcher`,label:`dev.dispatcher`,hint:`dev.dispatcherHint`}];function tV({client:e}){let{prefs:t}=Rw(),[n,r]=(0,h.useState)(null),[i,a]=(0,h.useState)(!1),o=async()=>{if(n){a(!0);try{if(n===`reset`){await e.request(`dev.reset`),localStorage.removeItem(`rove.prefs`),window.location.reload();return}await e.request(`daemon.restart`),z(Q(`restart.done`)),r(null)}catch(e){z(G(e),`error`)}finally{a(!1)}}},s=(e,t,a,s,c)=>(0,U.jsxs)(`div`,{children:[(0,U.jsx)($N,{settingId:`dev.${e}`,label:t,hint:a,children:(0,U.jsx)(W,{variant:`action`,onClick:()=>r(e),children:s})}),n===e&&(0,U.jsx)(`div`,{className:`pb-3`,children:(0,U.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-sm border-hairline border-line bg-inset px-3 py-2.5 [&_p]:m-0 [&_p]:text-meta [&_p]:text-muted`,children:[(0,U.jsx)(`strong`,{children:Q(`${e}.title`)}),(0,U.jsx)(`p`,{children:V(e===`reset`?`prefs.resetBody`:`prefs.restartBody`)}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2.5`,children:[(0,U.jsx)(W,{onClick:()=>r(null),children:V(`dialog.cancel`)}),(0,U.jsx)(W,{variant:c?`danger`:`filled`,disabled:i,onClick:()=>void o(),children:s})]})]})})]});return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(QN,{title:Q(`dev.experimental`),children:eV.map(n=>(0,U.jsx)(eP,{settingId:`dev.${n.key}`,label:Q(n.label),hint:Q(n.hint),checked:t[n.key],onChange:t=>void Iw(e,n.key,t)},n.key))}),(0,U.jsxs)(QN,{hint:Q(`dev.doctorHint`),children:[s(`restart`,Q(`dev.restart`),V(`prefs.restartHint`),V(`prefs.restartButton`),!1),s(`reset`,Q(`dev.reset`),V(`prefs.resetHint`),V(`prefs.resetButton`),!0)]})]})}function nV(e){return e.binaryFound===void 0?{key:`settings.engines.status.checking`,tone:`unknown`}:e.binaryFound===null?{key:`settings.engines.status.unknown`,tone:`unknown`}:e.binaryFound?e.configIssue?{key:`settings.engines.status.integrationBlocked`,tone:`error`}:e.login===`no`?{key:`settings.engines.status.signIn`,tone:`attention`}:e.hooks===`outdated`?{key:`settings.engines.status.integrationOutdated`,tone:`attention`}:e.hooks===`not-installed`?{key:`settings.engines.status.integrationMissing`,tone:`attention`}:{key:`settings.engines.status.ready`,tone:`ready`}:e.commandChosen?{key:`settings.engines.status.notOnPath`,tone:`attention`}:{key:`settings.engines.status.notInstalled`,tone:`absent`}}function rV(e){return nV({binaryFound:e.binaryFound,login:e.login,hooks:e.hooks,configIssue:e.configIssue,commandChosen:e.custom||e.customized})}var iV={ready:`ready`,attention:`attention`,error:`error`,absent:`absent`,unknown:`absent`};function aV(e){if(e.configIssue)return Q(`engines.detail.hooksBlockedHere`,{reason:e.configIssue});switch(e.hooks){case`installed`:return Q(`engines.detail.hooksInstalled`);case`outdated`:return Q(`engines.detail.hooksOutdated`);case`not-installed`:return e.binaryFound===!1?Q(`engines.detail.hooksAwaitEngine`):Q(`engines.detail.hooksMissing`);default:return Q(`engines.detail.hooksUnsupported`)}}function oV({engine:e}){let t=e.binaryFound===!0?Q(`engines.detail.programFound`,{binary:e.binary,path:e.binaryPath??e.binary}):e.binaryFound===!1?Q(`engines.detail.programMissing`,{binary:e.binary}):Q(`engines.detail.programUnknown`,{binary:e.binary}),n=e.login===`yes`?Q(`engines.detail.signedIn`):e.login===`no`?Q(`engines.detail.signedOut`):Q(`engines.detail.signInUnknown`),r=[aV(e),Q(e.markers?`engines.detail.markersYes`:`engines.detail.markersNo`),Q(e.screen?`engines.detail.screenYes`:e.hooks===`installed`?`engines.detail.screenNotNeeded`:`engines.detail.screenNo`)];return(0,U.jsxs)(`dl`,{className:CN,children:[(0,U.jsx)(`dt`,{className:wN,children:Q(`engines.detail.program`)}),(0,U.jsx)(`dd`,{className:TN(e.binaryFound===!1),children:t}),(0,U.jsx)(`dt`,{className:wN,children:Q(`engines.detail.signIn`)}),(0,U.jsx)(`dd`,{className:TN(e.login===`no`),children:n}),(0,U.jsx)(`dt`,{className:wN,children:Q(`engines.detail.reporting`)}),(0,U.jsx)(`dd`,{className:TN(!1),children:r.map(e=>(0,U.jsx)(`span`,{className:`block`,children:e},e))}),e.skill===`unsupported`?null:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`dt`,{className:wN,children:Q(`engines.detail.skill`)}),(0,U.jsx)(`dd`,{className:TN(e.skill!==`installed`),children:Q(e.skill===`installed`?`engines.detail.skillInstalledHere`:e.skill===`outdated`?`engines.detail.skillOutdated`:`engines.detail.skillMissing`)})]}),e.custom?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`dt`,{className:wN,children:Q(`engines.detail.adapter`)}),(0,U.jsx)(`dd`,{className:TN(!1),children:e.protocol?Q(`engines.detail.adapterDeclared`,{protocol:e.protocol}):Q(`engines.detail.adapterGeneric`)})]}):null]})}function sV(e){let[t,n]=(0,h.useState)(e.name);return(0,U.jsxs)(`form`,{className:EN,onSubmit:n=>{n.preventDefault(),e.onSave(t)},children:[(0,U.jsx)(`input`,{className:`${Xr} w-full ${DN}`,autoFocus:!0,value:t,"aria-label":V(`settings.engines.rename`),placeholder:V(`settings.engines.namePlaceholder`),onChange:e=>n(e.target.value),onKeyDown:t=>{t.key===`Escape`&&(t.stopPropagation(),e.onCancel())}}),(0,U.jsx)(W,{variant:`filled`,type:`submit`,children:V(`settings.engines.save`)}),(0,U.jsx)(W,{variant:`action`,onClick:e.onCancel,children:V(`settings.engines.cancel`)})]})}function cV(e){let[t,n]=(0,h.useState)(null),r=e.engines.find(e=>e.id===t);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Fl,{children:e.engines.map(t=>(0,U.jsx)(lV,{engine:t,icon:e.icons.get(t.id),run:e.run,onOpen:()=>n(t.id)},t.id))}),r&&(0,U.jsx)(uV,{engine:r,run:e.run,onClose:()=>n(null)})]})}function lV(e){let{engine:t,run:n}=e,r=iV[rV(t).tone];return(0,U.jsxs)(`div`,{className:`${_N} ${gM}`,"data-setting-id":`engines.item:${t.id}`,children:[(0,U.jsxs)(W,{variant:`row`,className:vN,"aria-haspopup":`dialog`,onClick:e.onOpen,children:[(0,U.jsx)(Ev,{icon:e.icon}),(0,U.jsxs)(`span`,{className:cN,children:[(0,U.jsxs)(`span`,{className:yN,children:[t.name,t.renamedFrom?(0,U.jsx)(`span`,{className:uN,children:t.renamedFrom}):null,t.custom&&!t.renamedFrom?(0,U.jsx)(`span`,{className:uN,children:Q(`engines.customTag`)}):null]}),(0,U.jsxs)(`span`,{className:fN(r),children:[(0,U.jsx)(`span`,{className:pN(r),"aria-hidden":`true`}),Q(rV(t).key.slice(9)),t.isDefault&&(0,U.jsxs)(`span`,{className:`text-accent capitalize`,children:[`· `,Q(`engines.defaultMark`)]})]})]})]}),t.binaryFound!==!1&&(0,U.jsx)(`span`,{className:`relative z-1 flex flex-none items-center`,children:(0,U.jsx)(ZN,{on:t.enabled,"aria-label":V(`settings.engines.enabled`,{name:t.name}),onClick:()=>n(`engine.setEnabled`,{id:t.id,enabled:!t.enabled})})}),(0,U.jsx)(Bv,{right:!0,className:bN})]})}function uV(e){let{engine:t,run:n}=e,[r,i]=(0,h.useState)(!1),a=!t.isDefault&&t.canBeDefault&&t.binaryFound!==!1;return(0,U.jsx)(vu,{label:t.name,title:t.name,onClose:e.onClose,children:e=>(0,U.jsxs)(`div`,{className:du,children:[(0,U.jsx)(`div`,{className:xN,children:(0,U.jsx)(oV,{engine:t})}),r?(0,U.jsx)(`div`,{className:xN,children:(0,U.jsx)(sV,{name:t.name,onCancel:()=>i(!1),onSave:e=>{n(`engine.rename`,{id:t.id,name:e}),i(!1)}})}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`hr`,{className:hu}),a&&(0,U.jsx)(yu,{onClick:()=>{n(`engine.setDefault`,{id:t.id}),e()},children:Q(`engines.makeDefault`)}),(0,U.jsx)(yu,{onClick:()=>i(!0),children:V(`settings.engines.rename`)}),(t.custom||t.customized)&&(0,U.jsx)(yu,{tone:t.custom?`danger`:`ink`,onClick:()=>{n(`engine.reset`,{id:t.id}),e()},children:t.custom?V(`settings.engines.remove`):V(`settings.engines.reset`)}),(0,U.jsx)(`hr`,{className:hu}),(0,U.jsx)(yu,{tone:`cancel`,onClick:e,children:V(`menu.cancel`)})]})]})})}var dV=y([]),fV=3e4;function pV(e){return e.request(`skill.missing`).then(e=>dV.set(e.engines),()=>{})}function mV(e){(0,h.useEffect)(()=>{let t=e.onOpen(()=>void pV(e)),n=ua(fV,()=>void pV(e));return()=>{t(),n()}},[e])}function hV(e){return e.request(`skill.install`).then(e=>{e.error&&z(Q(`engines.skill.failed`,{reason:e.error}),`error`)}).catch(e=>z(G(e),`error`)).then(()=>pV(e))}function gV({model:e}){let{client:t}=e,n=Oe(),r=lS(e),{value:i,failed:a,reload:o}=sP(t,`engines.settings`),s=i?.engines,[c,l]=(0,h.useState)(null),u=(e,n={})=>void t.request(e,n).then(o).catch(e=>z(G(e),`error`));return s?(0,U.jsxs)(U.Fragment,{children:[n?(0,U.jsx)(cV,{engines:s,icons:r,run:u}):(0,U.jsxs)(`section`,{"data-setting-id":`engines.list`,className:gM,children:[(0,U.jsx)(`p`,{className:PM,children:Q(`engines.hint`)}),(0,U.jsxs)(`div`,{className:nN,children:[(0,U.jsxs)(`div`,{className:rN,"aria-hidden":`true`,children:[(0,U.jsx)(`span`,{}),(0,U.jsx)(`span`,{children:Q(`engines.defaultMark`)}),(0,U.jsx)(`span`,{children:Q(`engines.available`)})]}),s.map(e=>(0,U.jsx)(_V,{engine:e,open:c===e.id,onToggleOpen:()=>l(c===e.id?null:e.id),run:u},e.id))]})]}),(0,U.jsx)(yV,{engines:s,run:u}),(0,U.jsx)(bV,{engines:s,client:t,reload:o}),(0,U.jsx)(xV,{client:t})]}):(0,U.jsx)(cP,{failed:a,onRetry:o})}function _V(e){let{engine:t,run:n}=e,r=(0,h.useId)(),i=rV(t),a=t.binaryFound===!1;return(0,U.jsxs)(`div`,{className:`${iN} ${gM}`,"data-setting-id":`engines.item:${t.id}`,children:[(0,U.jsxs)(`div`,{className:aN,children:[(0,U.jsxs)(`button`,{type:`button`,className:oN,"aria-expanded":e.open,"aria-controls":r,onClick:e.onToggleOpen,children:[(0,U.jsx)(Bv,{right:!e.open,className:sN(e.open)}),(0,U.jsxs)(`span`,{className:cN,children:[(0,U.jsxs)(`span`,{className:lN(!t.enabled),children:[t.name,t.renamedFrom?(0,U.jsx)(`span`,{className:uN,children:t.renamedFrom}):null,t.custom&&!t.renamedFrom?(0,U.jsx)(`span`,{className:uN,children:Q(`engines.customTag`)}):null]}),(0,U.jsxs)(`span`,{className:fN(iV[i.tone]),children:[(0,U.jsx)(`span`,{className:pN(iV[i.tone]),"aria-hidden":`true`}),Q(i.key.slice(9))]})]})]}),(0,U.jsx)(`div`,{className:mN,children:t.isDefault?(0,U.jsx)(`span`,{className:hN,children:Q(`engines.defaultMark`)}):t.canBeDefault&&!a?(0,U.jsx)(`button`,{type:`button`,className:gN,"aria-label":V(`settings.engines.default`,{name:t.name}),onClick:()=>n(`engine.setDefault`,{id:t.id}),children:Q(`engines.makeDefault`)}):null}),a?(0,U.jsx)(`span`,{}):(0,U.jsx)(ZN,{on:t.enabled,"aria-label":V(`settings.engines.enabled`,{name:t.name}),onClick:()=>n(`engine.setEnabled`,{id:t.id,enabled:!t.enabled})})]}),e.open?(0,U.jsx)(vV,{id:r,engine:t,run:n}):null]})}function vV(e){let{engine:t,run:n}=e,[r,i]=(0,h.useState)(!1);return(0,U.jsxs)(`div`,{id:e.id,className:SN,children:[(0,U.jsx)(oV,{engine:t}),r?(0,U.jsx)(sV,{name:t.name,onCancel:()=>i(!1),onSave:e=>{n(`engine.rename`,{id:t.id,name:e}),i(!1)}}):(0,U.jsxs)(`div`,{className:EN,children:[(0,U.jsx)(W,{variant:`action`,onClick:()=>i(!0),children:V(`settings.engines.rename`)}),t.custom||t.customized?(0,U.jsx)(W,{variant:`action`,onClick:()=>n(`engine.reset`,{id:t.id}),children:t.custom?V(`settings.engines.remove`):V(`settings.engines.reset`)}):null]})]})}function yV({engines:e,run:t}){let n=e.filter(e=>e.hooks!==`unsupported`),r=n.filter(e=>e.binaryFound!==!1),i=r.filter(e=>e.hooks===`installed`).length,a=r.length-i,o=n.filter(e=>e.hooks!==`not-installed`).length;return n.length===0?null:(0,U.jsx)(QN,{settingId:`engines.integrations`,title:Q(`engines.integrations.title`),hint:Q(`engines.integrations.hint`),children:(0,U.jsx)($N,{label:Q(`engines.integrations.summary`,{installed:i,total:r.length}),children:(0,U.jsxs)(`div`,{className:$M,children:[a>0?(0,U.jsx)(W,{variant:`filled`,onClick:()=>t(`engines.hooks.install`),children:Q(`engines.integrations.install`,{count:a})}):(0,U.jsx)(`span`,{className:ON,children:Q(`engines.integrations.upToDate`)}),o>0?(0,U.jsx)(W,{variant:`action`,onClick:()=>t(`engines.hooks.uninstall`),children:Q(`engines.integrations.remove`,{count:o})}):null]})})})}function bV(e){let t=e.engines.filter(e=>e.skill!==`unsupported`),n=t.filter(e=>e.skill===`installed`).length,r=t.length-n;return(0,U.jsx)(QN,{settingId:`engines.skill`,title:Q(`engines.skill.title`),hint:Q(`engines.skill.hint`),children:(0,U.jsx)($N,{label:t.length>0?Q(`engines.integrations.summary`,{installed:n,total:t.length}):Q(`engines.skill.noEngines`),children:r>0?(0,U.jsx)(W,{variant:`filled`,onClick:()=>void hV(e.client).then(e.reload),children:Q(`engines.skill.install`,{count:r})}):t.length>0?(0,U.jsx)(`span`,{className:ON,children:Q(`engines.integrations.upToDate`)}):null})})}function xV({client:e}){let{prefs:t}=Rw();return(0,U.jsx)(QN,{title:Q(`engines.permissionsTitle`),hint:Q(`engines.permissionBypassHint`),children:(0,U.jsx)(eP,{settingId:`engines.permissionBypass`,label:Q(`engines.permissionBypass`),checked:t.permissionBypass,onChange:t=>void Iw(e,`permissionBypass`,t)})})}var SV={bug:`settings.feedback.kindBug`,idea:`settings.feedback.kindIdea`,question:`settings.feedback.kindQuestion`};function CV(e){let t=e.split(`
101
+ `).find(e=>e.trim())?.trim()??``;return t.length>120?`${t.slice(0,119).trimEnd()}…`:t}function wV({model:e}){let[t,n]=(0,h.useState)(`bug`),[r,i]=(0,h.useState)(``),a=ni(r),[o,s]=(0,h.useState)(!1),[c,l]=(0,h.useState)(null),[u,d]=(0,h.useState)(!1),f=!r.trim();return(0,U.jsxs)(`form`,{"data-setting-id":`feedback.form`,className:`flex flex-col gap-3 ${gM}`,onSubmit:n=>{n.preventDefault(),s(!0),d(!1),fj(e,f?void 0:{text:r.trim(),kind:t}).catch(()=>d(!0)).finally(()=>s(!1))},children:[(0,U.jsx)(`p`,{className:`m-0 ${UM} ${qM}`,children:V(`settings.feedback.hint`)}),(0,U.jsx)(`textarea`,{ref:a,className:`${XM} ${ai} w-full`,"aria-label":V(`settings.feedback.prompt`),placeholder:V(`settings.feedback.prompt`),value:r,onChange:e=>i(e.target.value)}),(c||u)&&(0,U.jsxs)(`p`,{className:`m-0 text-meta text-muted [&_a]:text-accent break-words`,children:[u?V(`settings.feedback.reportFailed`):c?.filed?V(`settings.feedback.sent`,{number:c.number??0}):V(`settings.feedback.notFiled`,{hint:c?.hint??``}),` `,c&&!u&&(0,U.jsx)(`a`,{className:`underline`,href:c.url,target:`_blank`,rel:`noreferrer`,children:c.filed?c.url:V(`settings.feedback.openLink`)})]}),(0,U.jsxs)(`div`,{className:JM,children:[(0,U.jsx)(wO,{label:V(`settings.feedback.kindLabel`),value:t,picks:Object.keys(SV).map(e=>({value:e,label:V(SV[e])})),onPick:n}),(0,U.jsxs)(`div`,{className:Qr,children:[(0,U.jsx)(W,{variant:`action`,type:`button`,disabled:o||f,onClick:()=>{s(!0),l(null),d(!1),e.client.request(`feedback.send`,{title:CV(r),body:r.trim(),kind:t}).then(e=>{l(e),e.filed&&i(``)}).catch(e=>z(G(e),`error`)).finally(()=>s(!1))},children:V(`settings.feedback.fileAsIs`)}),(0,U.jsx)(W,{variant:`filled`,type:`submit`,disabled:o,children:V(`settings.feedback.draft`)})]})]}),(0,U.jsx)(`p`,{className:`m-0 ${UM}`,children:V(`settings.feedback.note`)})]})}var TV=[{value:`en`,label:`English`},{value:`zh`,label:`中文`}],EV={default:`general.worktreeKindDefault`,nextToProject:`general.worktreeKindNext`,custom:`general.worktreeKindCustom`};function DV({model:e}){let{client:t}=e,n=Rw(),{prefs:r,info:i}=n,a=(e,n)=>void Iw(t,e,n),o=[`default`,`nextToProject`];(i.worktreeCustomPath||r.worktreeBase===`custom`)&&o.push(`custom`);let s=o.map(e=>({value:e,label:Q(EV[e])}));return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(QN,{title:V(`settings.general.groupInterface`),children:[(0,U.jsx)(aP,{settingId:`general.language`,label:Q(`general.language`),hint:V(`prefs.languageHint`),value:r.locale,picks:TV,onPick:e=>a(`locale`,e)}),(0,U.jsx)(eP,{settingId:`general.keyHints`,label:Q(`general.keyHintsShow`),hint:V(`settings.general.tuiKeyHints`),checked:r.keyHints,onChange:e=>a(`keyHints`,e)}),(0,U.jsx)(aP,{settingId:`general.tabStrip`,label:V(`settings.general.tabStrip`),value:r.tabStrip,picks:zw(n,`tabStrip`).map(e=>({value:e,label:Q(`general.tabStripMode.${e}`)})),onPick:e=>a(`tabStrip`,e)})]}),(0,U.jsx)(QN,{title:V(`settings.general.groupFiles`),children:(0,U.jsx)(aP,{settingId:`general.worktree`,label:Q(`general.worktree`),hint:Q(`general.worktreeHint`),value:r.worktreeBase,picks:s,onPick:e=>a(`worktreeBase`,e)})}),(0,U.jsx)(QN,{title:V(`settings.general.groupTerminal`),hint:Q(`general.terminalHint`),children:(0,U.jsx)(OV,{client:t})})]})}function OV({client:e}){let t=Rw(),n=t.options.scrollbackRows,r=n&&`min`in n?n:{min:100,max:1e5},[i,a]=(0,h.useState)(String(t.prefs.scrollbackRows));return(0,h.useEffect)(()=>a(String(t.prefs.scrollbackRows)),[t.prefs.scrollbackRows]),(0,U.jsx)($N,{settingId:`general.scrollback`,label:V(`settings.general.scrollback`),hint:Q(`general.scrollbackRowHint`),children:(0,U.jsx)(`input`,{className:ZM,inputMode:`numeric`,value:i,"aria-label":Q(`general.scrollbackTitle`),onChange:e=>a(e.target.value),onBlur:()=>{let n=Number(i);if(i.trim()===``||!Number.isInteger(n)){a(String(t.prefs.scrollbackRows));return}let o=Math.min(r.max,Math.max(r.min,n));o===t.prefs.scrollbackRows?a(String(o)):Iw(e,`scrollbackRows`,o)},onKeyDown:e=>e.key===`Enter`&&e.currentTarget.blur()})})}var kV={general:`M2 4.5h7m3 0h2M2 11.5h2m3 0h7M10.5 3v3M5.5 10v3`,appearance:`M8 2a6 6 0 1 0 0 12A6 6 0 0 0 8 2zM8 2v12M8 5h4.5M8 8h6M8 11h4.5`,notifications:`M4 11V7a4 4 0 0 1 8 0v4l1 1.5H3zM6.5 14h3`,snippets:`M3 4h10M3 8h6M3 12h8`,keys:`M2 4.5h12v7H2zM4.5 7h.01M7 7h.01M9.5 7h.01M12 7h.01M5 9.5h6`,engines:`M2.5 3.5h11v9h-11zM5 6.5 7 8l-2 1.5M8.5 10H11`,autoRouting:`M2 4h3l6 8h3M2 12h3l1.5-2M9.5 6 11 4h3`,voice:`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`,connectors:`M6.5 9.5l3-3M5 8 3.5 9.5a2.1 2.1 0 0 0 3 3L8 11M11 8l1.5-1.5a2.1 2.1 0 0 0-3-3L8 5`,plugins:`M2.5 2.5H7V7H2.5zM9 2.5h4.5V7H9zM2.5 9H7v4.5H2.5zM11.25 9v4.5M9 11.25h4.5`,about:`M8 2a6 6 0 1 0 0 12A6 6 0 0 0 8 2zM8 7.5V11M8 5h.01`,feedback:`M2.5 3.5h11v7h-6L4.5 13v-2.5h-2z`,dev:`M5.5 4.5 2 8l3.5 3.5M10.5 4.5 14 8l-3.5 3.5`};function AV({id:e}){return(0,U.jsx)(`svg`,{viewBox:`0 0 16 16`,className:SM,"aria-hidden":`true`,children:(0,U.jsx)(`path`,{d:kV[e]})})}var jV=`prefix.key`;function MV(e,t,n){let r=t.find(e=>e===`enter`||e.endsWith(`+enter`))??t[0];if(r===void 0)return{kind:`more`,recording:e};if(t.includes(`escape`))return{kind:`cancel`};if(e.prefixArmed)return{kind:`done`,mode:`prefix`,keys:[r]};if(e.got.length===0&&n.some(e=>t.includes(e)))return{kind:`more`,recording:{...e,prefixArmed:!0}};let i=[...e.got,r];return i.length<e.slots?{kind:`more`,recording:{...e,got:i}}:{kind:`done`,mode:`direct`,keys:i}}function NV(){return Pk(jk().filter(e=>e.keys.length>0||e.prefixKeys!==void 0)).flatMap(e=>[...e.rows])}[...Array.from({length:12},(e,t)=>`f${t+1}`)];function PV(e,t){let n=`alternating [${e}, ${t}] pairs`;return{layout:n,slots:[e,t],validateCount:e=>e>=2&&e%2==0?null:`needs ${n} (an even number of chords — got ${e})`}}var FV={"sidebar.goto":PV(`top (double-tap)`,`bottom`),"sidebar.nav":PV(`down`,`up`),"files.nav":PV(`down`,`up`),"diff.review.cursor":PV(`down`,`up`),"sidebar.search.nav":PV(`down`,`up`),"files.search.nav":PV(`down`,`up`),"files.hierarchy":PV(`collapse`,`expand`),"files.tab":PV(`previous tab`,`next tab`),"app.quit":{layout:`[quit confirm, hard exit] (second chord optional)`,validateCount:e=>e<=2?null:`needs [quit confirm, hard exit] (1 or 2 chords — got ${e})`}};function IV(e){return FV[e]?.slots??[]}var LV=`group/cap relative inline-flex flex-none items-stretch rounded-sm border-hairline bg-surface font-mono text-meta has-[:focus-visible]:outline-1 has-[:focus-visible]:outline-offset-1 has-[:focus-visible]:outline-focus`,RV={idle:`border-line text-ink hover:border-line-active`,changed:`border-line text-accent hover:border-line-active`,empty:`border-dashed border-line text-subtle hover:border-line-active`,active:`border-accent text-accent`},zV=`absolute -top-1.5 -right-1.5 flex size-4 cursor-pointer items-center justify-center rounded-full border-hairline border-line bg-paper p-0 leading-none text-subtle hover:border-line-active hover:text-error focus-visible:opacity-100 group-hover/cap:opacity-100 touch:size-5 touch:opacity-100 touch:after:absolute touch:after:-inset-2.5 touch:after:content-['']`;function BV(e){return(0,U.jsxs)(`span`,{className:Kt(LV,RV[e.tone??`idle`]),children:[(0,U.jsx)(`button`,{type:`button`,"aria-label":e.label,className:`px-2 py-1 touch:min-h-10`,onClick:e.onPress,children:e.children}),e.onRemove&&(0,U.jsx)(`button`,{type:`button`,"aria-label":e.removeLabel,className:Kt(zV,!e.removeShown&&`opacity-0`),onClick:e.onRemove,children:`×`})]})}var VV=new Set([`app.quit`,`view.redraw`]),HV=Pk(NV().filter(e=>!VV.has(e.id)));function UV(e){let[t,n]=(0,h.useState)(null),[r,i]=(0,h.useState)(null),a=(0,h.useRef)(t);a.current=t;let o=async(t,n)=>{try{let r=await e.request(`keybindings.set`,{id:t,...n});i({id:t,lines:r.lines}),await Vs(e)}catch(e){z(G(e),`error`)}},s=(0,h.useRef)(o);s.current=o;let c=t!==null;return(0,h.useEffect)(()=>{if(!c)return;let e=e=>{e.preventDefault(),e.stopImmediatePropagation();let t=a.current;if(!t||[`Control`,`Shift`,`Alt`,`Meta`].includes(e.key))return;let r=t.id===`prefix.key`?[]:Rs.get().prefix.firstStrokes,i=MV(t,Zk(e),r);if(i.kind===`more`)return n(i.recording);n(null),i.kind===`done`&&s.current(t.id,{[i.mode]:i.keys})};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},[c]),{recording:t,notice:r,record:e=>{i(null),n({id:e,slots:Math.max(1,IV(e).length),got:[],prefixArmed:!1})},save:(e,t)=>void o(e,t)}}function WV(e,t){if(e.prefixArmed)return Q(`keybindings.recordingPrefix`,{prefix:t});let n=IV(e.id)[e.got.length];return n?Q(`keybindings.recordingSlot`,{slot:n}):Q(`keybindings.recording`)}function GV(e){let{editor:t,id:n}=e,r=()=>t.record(n),i=V(`keys.recordFor`,{name:e.name});if(t.recording?.id===n)return(0,U.jsx)(BV,{tone:`active`,label:i,onPress:r,children:WV(t.recording,e.prefixName)});let a=e.changed?`changed`:`idle`,o=t.notice?.id===n,s=e.prefix??[];return e.direct.length===0&&s.length===0?(0,U.jsx)(BV,{tone:`empty`,label:i,onPress:r,children:Q(`keybindings.unbound`)}):(0,U.jsxs)(U.Fragment,{children:[e.direct.length>0&&(0,U.jsx)(BV,{tone:a,label:i,onPress:r,onRemove:()=>t.save(n,{direct:[]}),removeLabel:V(`keys.removeFor`,{name:e.name}),removeShown:o,children:e.direct.join(` / `)}),s.length>0&&(0,U.jsx)(BV,{tone:a,label:i,onPress:r,onRemove:()=>t.save(n,{prefix:[]}),removeLabel:V(`keys.removeFor`,{name:e.name}),removeShown:o,children:s.map(t=>`${e.prefixName} ${t}`).join(` / `)})]})}function KV(e,t,n,r){let i=e.notice?.id===t?e.notice.lines:[];return i.length>0?(0,U.jsx)(`span`,{className:`text-warning`,children:i.join(` `)}):n===null?r:(0,U.jsxs)(`span`,{className:`inline-flex flex-wrap items-baseline gap-x-2`,children:[Q(`keybindings.defaultKeys`,{keys:n}),(0,U.jsx)(W,{hit:`tight`,onClick:()=>e.save(t,{direct:`default`,prefix:`default`}),children:V(`keys.reset`)})]})}function qV({editor:e,keys:t}){let n=t.prefix.key??Q(`keybindings.prefixDisabled`),r=(e,t=[])=>[...e,...t.map(e=>`${n} ${e}`)].join(` / `);return(0,U.jsx)(U.Fragment,{children:HV.map(i=>(0,U.jsx)(QN,{title:uA(i.category),children:i.rows.map(i=>{let a=t.rows.find(e=>e.id===i.id),o=cA(i.id);return(0,U.jsx)($N,{settingId:`keys.binding:${i.id}`,label:o,hint:KV(e,i.id,a?r(i.keys,i.prefixKeys):null),children:(0,U.jsx)(GV,{editor:e,id:i.id,name:o,direct:a?.keys??i.keys,prefix:a?a.prefixKeys:i.prefixKeys,prefixName:n,changed:a!==void 0})},i.id)})},i.category))})}function JV({model:e}){let{client:t}=e,{prefs:n}=Rw(),r=b(Rs),[i,a]=(0,h.useState)(!1);(0,h.useEffect)(()=>void Vs(t),[t]);let o=r.prefix.key??Q(`keybindings.prefixDisabled`),s=UV(t),c=Ls.prefix.firstStrokes,l=r.prefix.firstStrokes.join()!==c.join();return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(QN,{hint:V(`keys.editHint`),children:[(0,U.jsx)(aP,{settingId:`keys.tapPresentation`,label:Q(`keybindings.tapPresentation`),hint:Q(`keybindings.tapPresentationHint`),value:n.prefixTap,picks:[{value:`local`,label:Q(`keybindings.tapPresentationLocal`)},{value:`guide`,label:Q(`keybindings.tapPresentationGuide`)}],onPick:e=>void Iw(t,`prefixTap`,e)}),(0,U.jsx)($N,{settingId:`keys.prefix`,label:Q(`keybindings.prefixTitle`,{prefix:o}),hint:KV(s,jV,l?c.join(` / `):null,Q(`keybindings.prefixHint`,{prefix:o,timeout:r.prefix.timeoutMs})),children:(0,U.jsx)(GV,{editor:s,id:jV,name:Q(`keybindings.prefixKey`),direct:r.prefix.firstStrokes,prefixName:o,changed:l})})]}),r.warnings.length>0&&(0,U.jsx)(QN,{title:Q(`keybindings.warnings`),children:r.warnings.map(e=>(0,U.jsx)($N,{label:(0,U.jsx)(`span`,{className:`text-warning`,children:e})},e))}),(0,U.jsx)(qV,{editor:s,keys:r}),r.plugins.length>0&&(0,U.jsx)(QN,{title:V(`keys.pluginChords`),children:r.plugins.map(e=>(0,U.jsx)($N,{label:(0,U.jsx)(`span`,{className:`font-mono`,children:e.chord}),hint:(0,U.jsx)(`span`,{className:`font-mono`,children:`${e.kind}:${e.target}`})},e.chord))}),(0,U.jsx)(QN,{settingId:`keys.configFile`,title:Q(`keybindings.configFile`),hint:V(`prefs.keysYaml`),children:(0,U.jsx)($N,{label:(0,U.jsx)(`span`,{className:`font-mono break-all`,children:r.path+(r.exists?``:Q(`keybindings.notCreated`))}),hint:V(i?`keys.agentFailed`:`keys.agentHint`),children:(0,U.jsx)(W,{variant:`action`,onClick:()=>{a(!1),dj(e,V(`keys.agentPrompt`,{path:r.path})).catch(()=>a(!0))},children:V(`keys.agent`)})})})]})}var YV=`/assets/pulse-3XJkP4CJ.wav`;function XV(e,t){return e===`error`||t}function ZV(e,t,n=!1){return n?e.kind===`error`:t||e.kind!==`done`||e.turnEnd!==!0}function QV(e,t,n=!1){return t&&e.silent!==!0&&!n}function $V(e){return e===`permission_needed`?`needs_input`:e===`error`||e===`rate_limited`||e===`dead`?`error`:e===`turn_complete`?`done`:null}function eH(e,t,n,r){if(e===null)return[];let i=[];for(let[a,o]of t){if(a===n||e.get(a)===o)continue;let t=r(o);t&&i.push({key:a,kind:t})}return i}function tH(){return window.isSecureContext&&`serviceWorker`in navigator&&`PushManager`in window&&`Notification`in window}var nH=()=>navigator.serviceWorker.register(`sw.js`);async function rH(e){if(!tH())return`unsupported`;if(Notification.permission===`denied`)return`blocked`;let t=await(await navigator.serviceWorker.getRegistration())?.pushManager.getSubscription();if(!t)return`off`;let{subscribed:n}=await e.request(`push.status`,{endpoint:t.endpoint});return n?`on`:`off`}async function iH(e){if(!tH())return`unsupported`;if(await Notification.requestPermission()!==`granted`)return`blocked`;let t=await nH();await navigator.serviceWorker.ready;let{publicKey:n}=await e.request(`push.key`),r=await t.pushManager.getSubscription();return r?.options.applicationServerKey&&uH(r.options.applicationServerKey)!==n&&(await r.unsubscribe(),r=null),r??=await t.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:lH(n)}),await e.request(`push.subscribe`,{subscription:r.toJSON()}),`on`}async function aH(e){let t=await(await navigator.serviceWorker.getRegistration())?.pushManager.getSubscription();return t&&(await e.request(`push.unsubscribe`,{endpoint:t.endpoint}),await t.unsubscribe()),`off`}async function oH(e,t,n,r){let i={body:r,tag:`task:${e}:${t}`,icon:`icon-192.png`,data:{taskId:e}},a=`serviceWorker`in navigator?await navigator.serviceWorker.getRegistration():void 0;if(a)return a.showNotification(`Rove — ${n}`,i);let o=new Notification(`Rove — ${n}`,i);o.onclick=()=>{window.focus(),sH?.(e),o.close()}}var sH=null;function cH(e){sH=t=>e.selectWhenListed(t);let t=new URLSearchParams(window.location.search),n=t.get(`task`);if(n){t.delete(`task`);let r=t.toString();history.replaceState(null,``,`${window.location.pathname}${r?`?${r}`:``}${window.location.hash}`),e.selectWhenListed(n)}let r=()=>{sH=null};if(!(`serviceWorker`in navigator))return r;let i=t=>{let n=t.data;n?.type===`rove.openTask`&&typeof n.taskId==`string`&&n.taskId&&e.selectWhenListed(n.taskId)};return navigator.serviceWorker.addEventListener(`message`,i),()=>{r(),navigator.serviceWorker.removeEventListener(`message`,i)}}function lH(e){let t=atob(e.replace(/-/g,`+`).replace(/_/g,`/`));return Uint8Array.from(t,e=>e.charCodeAt(0))}function uH(e){return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}var dH={done:`✓`,needs_input:`?`,error:`✕`};function fH(e){let t=new Audio(YV);t.volume=Math.min(1,Math.max(0,e)),t.play().catch(()=>void 0)}function pH(e,t,n){!document.hidden||typeof Notification>`u`||Notification.permission!==`granted`||oH(e,t,n,dH[t]).catch(()=>void 0)}function mH(){typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission()}function hH(e){let t=new Map;for(let n of e.tasks)n.activity&&t.set(n.id,n.activity.state);return t}function gH(e){let t=(0,h.useRef)(null);(0,h.useEffect)(()=>{let n=()=>{let n=e.tasks.get();if(!n)return;let r=hH(n),i=eH(t.current,r,null,$V);t.current=r;let{prefs:a}=jw.get();if(!a.crossTask)return;let o=e.selection.get().taskId,s=new Map(n.tasks.map(e=>[e.id,e.label]));for(let{key:t,kind:n}of i){if(t===o||!ZV({kind:n,turnEnd:!0},a.finishedAlerts))continue;let r=s.get(t)??t;XV(n,a.toast)&&z(`${dH[n]} ${r}`,n===`error`?`error`:`info`,{label:V(`workspace.openTask`),run:()=>e.select(t)}),QV({},a.sound)&&(fH(a.soundVolume),pH(t,n,r))}};return n(),e.tasks.subscribe(n)},[e])}function _H({client:e}){let[t,n]=(0,h.useState)(null),[r,i]=(0,h.useState)(null);(0,h.useEffect)(()=>{rH(e).then(n,()=>n(`off`))},[e]);let a=t=>{i(null),(t?iH(e):aH(e)).then(n,e=>i(e instanceof Error?e.message:String(e)))},o=r?V(`prefs.pushFailed`,{error:r}):V(t===`unsupported`?`prefs.pushUnsupported`:t===`blocked`?`prefs.pushBlocked`:`prefs.pushHint`);return(0,U.jsx)(eP,{settingId:`notifications.push`,label:V(`prefs.push`),hint:o,checked:t===`on`,disabled:t===null||t===`unsupported`||t===`blocked`,onChange:a})}function vH({model:e}){let{client:t}=e,n=Rw(),{prefs:r}=n,i=(e,n)=>void Iw(t,e,n);return(0,U.jsxs)(QN,{children:[(0,U.jsx)(eP,{settingId:`notifications.toast`,label:Q(`general.toast`),hint:V(`settings.notifications.toastNote`),checked:r.toast,onChange:e=>i(`toast`,e)}),(0,U.jsx)(eP,{settingId:`notifications.sound`,label:Q(`general.sound`),hint:V(`prefs.soundHint`),checked:r.sound,onChange:e=>{e&&mH(),i(`sound`,e)}}),(0,U.jsx)(aP,{settingId:`notifications.soundVolume`,label:V(`settings.notifications.volume`),hint:V(`prefs.soundVolumeHint`),value:r.soundVolume,picks:zw(n,`soundVolume`).map(e=>({value:e,label:`${Math.round(e*100)}%`})),onPick:e=>{jw.get().prefs.sound&&fH(e),i(`soundVolume`,e)}}),(0,U.jsx)(eP,{settingId:`notifications.crossTask`,label:Q(`general.crossTask`),hint:Q(`general.crossTaskHint`),checked:r.crossTask,onChange:e=>i(`crossTask`,e)}),(0,U.jsx)(eP,{settingId:`notifications.finishedAlerts`,label:Q(`general.finishedAlerts`),hint:Q(`general.finishedAlertsHint`),checked:r.finishedAlerts,onChange:e=>i(`finishedAlerts`,e)}),(0,U.jsx)(_H,{client:t})]})}var yH={kanban:`kanban`,issues:`issues`};function bH({model:e}){let t=b(e.installedMods),{value:n,failed:r,reload:i}=sP(e.client,`builtinMods.list`),a=n?.mods;if((0,h.useEffect)(()=>{e.refreshMods()},[e]),!a)return r===null?null:(0,U.jsx)(QN,{title:V(`settings.plugins.builtIn`),children:(0,U.jsx)(cP,{failed:r,onRetry:i})});if(a.length===0)return null;let o=n=>{let r=!t.has(n.id);e.client.request(`builtinMod.setInstalled`,{id:n.id,installed:r}).then(()=>(!r&&M.get()===yH[n.id]&&M.set(null),e.refreshMods())).catch(e=>z(G(e),`error`))};return(0,U.jsx)(QN,{settingId:`plugins.builtIn`,title:V(`settings.plugins.builtIn`),hint:V(`settings.plugins.builtInHint`),children:a.map(e=>(0,U.jsx)($N,{label:e.name,hint:e.description,inline:!0,children:(0,U.jsx)(ZN,{on:t.has(e.id),"aria-label":V(`settings.plugins.turnOn`,{name:e.name}),onClick:()=>o(e)})},e.id))})}function xH({model:e}){let{client:t}=e,{value:n,failed:r,reload:i}=sP(t,`plugins.list`),a=n?.plugins;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(bH,{model:e}),(0,U.jsx)(QN,{settingId:`plugins.registered`,title:V(`settings.plugins.registered`),children:a?a.length===0?(0,U.jsx)(`p`,{className:YM,children:V(`settings.plugins.empty`)}):a.map(e=>(0,U.jsx)($N,{label:e.id,hint:[e.version,e.linked?V(`settings.plugins.linked`):null,e.platformOk===!1?V(`settings.plugins.unsupportedPlatform`):null].filter(Boolean).join(`, `),inline:!0,children:(0,U.jsx)(ZN,{on:e.enabled,"aria-label":e.id,onClick:()=>void t.request(`plugin.setEnabled`,{id:e.id,enabled:!e.enabled}).then(i).catch(e=>z(G(e),`error`))})},e.id)):(0,U.jsx)(cP,{failed:r,onRetry:i})})]})}function SH(e){let[t,n]=(0,h.useState)(e.tier.engine),[r,i]=(0,h.useState)(e.tier.model??``),[a,o]=(0,h.useState)(e.tier.effort??``),s=e.engines.find(e=>e.id===t),c=Oe();return(0,U.jsxs)(`form`,{className:MN,onSubmit:n=>{n.preventDefault(),e.onSave(t,s?.takesModel?r.trim():``,a)},onKeyDown:t=>{t.key===`Escape`&&(t.stopPropagation(),e.onCancel())},children:[(0,U.jsx)(wO,{label:Q(`sections.engines`),value:t,picks:e.engines.map(e=>({value:e.id,label:e.name})),onPick:t=>{let r=e.engines.find(e=>e.id===t);n(t),r&&!r.effortLevels.includes(a)&&o(``),r&&!r.takesModel&&i(``)}}),s&&s.effortLevels.length>0&&(0,U.jsx)(wO,{label:V(`prefs.tierEffort`),value:a,picks:[``,...s.effortLevels].map(e=>({value:e,label:e||Q(`autoRouting.engineDefault`)})),onPick:o}),s?.takesModel&&(0,U.jsx)(`input`,{className:XM,value:r,spellCheck:!1,placeholder:Q(`autoRouting.engineDefault`),"aria-label":V(`prefs.tierModel`),onChange:e=>i(e.target.value)}),(0,U.jsxs)(`div`,{className:$M,children:[(0,U.jsx)(W,{variant:c?`action`:`link`,onClick:e.onCancel,children:V(`dialog.cancel`)}),(0,U.jsx)(W,{variant:`filled`,type:`submit`,children:Q(`action.save`)})]})]})}function CH({client:e}){let{value:t,failed:n,reload:r}=sP(e,`autoRouting.get`),[i,a]=(0,h.useState)(null),o=Oe(),s=(t,n)=>e.request(t,n).then(r).catch(e=>z(G(e),`error`));if(!t)return(0,U.jsx)(cP,{failed:n,onRetry:r});let c=t.classifier,l=[{value:`off`,label:Q(`autoRouting.classifierOff`)},{value:`jev`,label:`jev`},...c.canCustom||c.mode===`custom`?[{value:`custom`,label:Q(`autoRouting.classifierCustomLabel`)}]:[]],u=c.mode===`off`?Q(`autoRouting.classifierOffHint`):c.mode===`jev`?Q(`autoRouting.classifierJevHint`):Q(`autoRouting.classifierCustomHint`),d=c.keySource===`env`?Q(`autoRouting.keyPresentEnv`,{env:c.keyEnv??``}):c.keySource===`file`?Q(`autoRouting.keySaved`):c.keyConfigured?Q(`autoRouting.keyMissing`):Q(`autoRouting.keyCustomUnused`);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(QN,{hint:Q(`autoRouting.hint`),children:[!t.configured&&(0,U.jsx)($N,{label:(0,U.jsx)(`span`,{className:`text-warning`,children:Q(`autoRouting.unconfigured`)})}),t.tiers.map(e=>{let n=()=>a(i===e.tier?null:e.tier),r=(0,U.jsx)(`span`,{className:`${UM} min-w-0 truncate`,children:[e.engineName,e.model??Q(`autoRouting.engineDefault`),e.effort??Q(`autoRouting.engineDefault`)].join(` · `)}),c=(0,U.jsx)(`span`,{className:`text-meta ${e.block?`text-warning`:`text-success`}`,children:e.block?Q(`autoRouting.unavailable`,{reason:e.block}):Q(`autoRouting.ready`)});return(0,U.jsxs)(`div`,{className:`${AN} ${gM}`,"data-setting-id":`autoRouting.tier.${e.tier}`,children:[o?(0,U.jsxs)(W,{variant:`row`,className:GM,"aria-expanded":i===e.tier,onClick:n,children:[(0,U.jsxs)(`span`,{className:KM,children:[(0,U.jsx)(`span`,{className:HM,children:eM(`tier.${e.tier}`)}),r,(0,U.jsx)(`span`,{className:UM,children:eM(`tierDesc.${e.tier}`)}),c]}),(0,U.jsx)(Bv,{right:i!==e.tier,className:xM})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:jN,children:[(0,U.jsx)(`span`,{className:HM,children:eM(`tier.${e.tier}`)}),r,(0,U.jsx)(W,{className:`ml-auto`,onClick:n,children:V(`prefs.tierEdit`)})]}),(0,U.jsx)(`span`,{className:UM,children:eM(`tierDesc.${e.tier}`)}),c]}),i===e.tier&&(0,U.jsx)(SH,{tier:e,engines:t.engines,onCancel:()=>a(null),onSave:(t,n,r)=>{a(null),s(`autoRouting.setTier`,{tier:e.tier,engine:t,model:n,effort:r})}})]},e.tier)})]}),(0,U.jsxs)(QN,{title:Q(`autoRouting.classifierTitle`),hint:Q(`autoRouting.classifierHint`),children:[(0,U.jsx)($N,{label:(0,U.jsx)(`span`,{className:c.mode===`off`?`text-muted`:`text-warning`,children:Q(`autoRouting.classifierDataFlow`)})}),(0,U.jsx)(aP,{settingId:`autoRouting.classifier`,label:Q(`autoRouting.classifierLabel`),hint:u.replace(/^[—\s]+/,``),value:c.mode,picks:l,onPick:e=>void s(`autoRouting.setClassifier`,{mode:e})})]}),(0,U.jsxs)(QN,{title:V(`prefs.classifierConnection`),hint:V(`prefs.editInTui`),children:[(0,U.jsx)(oP,{settingId:`autoRouting.endpoint`,label:Q(`autoRouting.endpointLabel`),value:c.endpointHost||V(`prefs.unset`)}),(0,U.jsx)(oP,{settingId:`autoRouting.threshold`,label:Q(`autoRouting.thresholdLabel`),value:c.threshold.toFixed(2)}),(0,U.jsx)($N,{settingId:`autoRouting.key`,label:Q(`autoRouting.keyLabel`),hint:d})]})]})}function wH(){return(0,U.jsxs)(`svg`,{className:uM,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,"aria-hidden":`true`,children:[(0,U.jsx)(`circle`,{cx:`7`,cy:`7`,r:`4.75`,strokeWidth:`1.4`}),(0,U.jsx)(`path`,{d:`M10.5 10.5 14 14`,strokeWidth:`1.4`,strokeLinecap:`round`})]})}function TH(e){return(0,U.jsxs)(`div`,{className:lM,children:[(0,U.jsx)(wH,{}),(0,U.jsx)(`input`,{ref:e.inputRef,type:`text`,role:`searchbox`,className:dM,value:e.query,placeholder:Q(`search.placeholder`),"aria-label":Q(`search.placeholder`),spellCheck:!1,autoComplete:`off`,"data-settings-search":!0,onChange:t=>e.onChange(t.target.value),onKeyDown:e.onKeyDown}),e.query!==``&&(0,U.jsx)(W,{variant:`row`,className:`absolute right-1 grid size-5.5 place-items-center rounded-xs text-body leading-none text-muted hover:bg-hover hover:text-ink focus-visible:outline-1 focus-visible:outline-focus w-narrow:right-1.5 w-narrow:size-7`,"aria-label":Q(`search.clear`),title:Q(`search.clear`),onClick:()=>{e.onChange(``),e.inputRef.current?.focus()},children:`×`})]})}function EH(e){return e.groupLabel&&e.groupLabel!==e.sectionLabel?`${e.sectionLabel} · ${e.groupLabel}`:e.sectionLabel}function DH(e){return e===1?Q(`search.countOne`):Q(`search.count`,{count:e})}function OH(e){let t=(0,h.useRef)(null);return(0,h.useEffect)(()=>{t.current?.querySelector(`[data-selected="true"]`)?.scrollIntoView({block:`nearest`})},[e.selected]),(0,U.jsx)(`div`,{className:CM,children:(0,U.jsxs)(`div`,{className:wM,children:[(0,U.jsxs)(`header`,{className:TM,children:[(0,U.jsx)(`h1`,{className:EM,children:Q(`search.title`)}),(0,U.jsx)(`p`,{className:DM,children:DH(e.results.length)})]}),(0,U.jsx)(`div`,{className:OM,children:e.results.length===0?(0,U.jsxs)(`div`,{className:`flex flex-col items-start gap-2`,children:[(0,U.jsx)(`p`,{className:YM,children:Q(`search.empty`,{query:e.query.trim()})}),(0,U.jsx)(W,{variant:`action`,onClick:e.onClear,children:Q(`search.clear`)})]}):(0,U.jsx)(`div`,{ref:t,className:fM,children:e.results.map((t,n)=>{let r=n===e.selected;return(0,U.jsxs)(W,{variant:`row`,"aria-current":r?`true`:void 0,"data-selected":r?`true`:void 0,"data-search-result":t.id,className:pM(r),onMouseEnter:()=>e.onSelect(n),onClick:()=>e.onPick(t),children:[(0,U.jsxs)(`span`,{className:mM,children:[(0,U.jsx)(`span`,{className:`${HM} truncate`,children:t.label}),(0,U.jsx)(`span`,{className:hM,children:EH(t)})]}),t.hint&&(0,U.jsx)(`span`,{className:`text-meta text-muted [&_a]:text-accent line-clamp-2`,children:t.hint})]},`${t.section}:${t.id}`)})})})]})})}function kH(e){return e.results.length===0?(0,U.jsx)(`p`,{className:YM,children:Q(`search.empty`,{query:e.query.trim()})}):(0,U.jsx)(Fl,{label:DH(e.results.length),children:e.results.map(t=>(0,U.jsxs)(W,{variant:`row`,"data-search-result":t.id,className:`${GM} px-3`,onClick:()=>e.onPick(t),children:[(0,U.jsxs)(`span`,{className:KM,children:[(0,U.jsx)(`span`,{className:`${HM} truncate`,children:t.label}),(0,U.jsx)(`span`,{className:`${UM} truncate`,children:t.hint?`${EH(t)} · ${t.hint}`:EH(t)})]}),(0,U.jsx)(Bv,{right:!0,className:xM})]},`${t.section}:${t.id}`))})}function AH(e,t){let n=t.toLowerCase(),r=e.length*2+2,i=e.charCodeAt(0);for(let t=0;t<n.length;t++){if(n.charCodeAt(t)!==i)continue;let a=Math.min(n.length,t+r),o=1;for(let r=t+1;r<a&&o<e.length;r++)n.charCodeAt(r)===e.charCodeAt(o)&&o++;if(o===e.length)return!0}return!1}function jH(e,t){let n=t.label.toLowerCase();if(n===e)return 0;if(n.startsWith(e))return 1;let r=n.indexOf(e);if(r>=0)return r===0||/[\s/_.:-]/.test(n[r-1]??``)?2:3;let i=t.sectionLabel.toLowerCase(),a=t.groupLabel?.toLowerCase()??``;if(i.includes(e)||a!==``&&a.includes(e))return 4;if(t.keywords)for(let n of t.keywords){let t=n.toLowerCase();if(t===e||t.startsWith(e))return 4;if(t.includes(e))return 5}let o=t.hint?.toLowerCase()??``;if(o!==``&&o.includes(e))return 6;if(e.length>=2){if(AH(e,n))return 7;if(AH(e,i)||a!==``&&AH(e,a))return 8;if(t.keywords?.some(t=>AH(e,t)))return 9}return 1/0}function MH(e,t){let n=t.trim().toLowerCase();if(!n)return[];let r=n.split(/\s+/).filter(Boolean);if(r.length===0)return[];let i=[];for(let t=0;t<e.length;t++){let n=e[t];if(!n)continue;let a=0,o=!0;for(let e of r){let t=jH(e,n);if(!Number.isFinite(t)){o=!1;break}a+=t}o&&i.push({entry:n,score:a,index:t})}return i.sort((e,t)=>e.score-t.score||e.index-t.index),i.map(e=>e.entry)}var NH=new Set([`app.quit`,`view.redraw`]),PH={general:`sections.general`,engines:`sections.engines`,autoRouting:`sections.autoRouting`,plugins:`sections.plugins`,keys:`sections.keys`,feedback:`sections.feedback`,dev:`sections.dev`},FH=e=>{let t=PH[e];return t?Q(t):V(`settings.sections.${e}`)};function IH(e=[]){let t=(e,t,n,r)=>({id:t,section:e,sectionLabel:FH(e),groupLabel:r?.groupLabel,label:n,hint:r?.hint,keywords:r?.keywords}),n=V(`settings.general.groupInterface`),r=V(`settings.general.groupFiles`),i=V(`settings.general.groupTerminal`),a=V(`settings.appearance.groupColours`),o=V(`settings.appearance.groupTasks`),s=V(`settings.about.groupRove`),c=V(`settings.about.access`),l=V(`settings.about.browser`),u=Q(`autoRouting.classifierTitle`),d=V(`prefs.classifierConnection`),f=Q(`dev.experimental`),p=NV().filter(e=>!NH.has(e.id)).map(e=>{let n=e.prefixKeys??[];return t(`keys`,`keys.binding:${e.id}`,cA(e.id),{groupLabel:uA(e.category),hint:[...e.keys,...n.map(e=>`prefix ${e}`)].join(` / `)||void 0,keywords:[`keybinding`,`shortcut`,`hotkey`,`chord`,e.id,...e.keys,...n]})}),m=e.map(e=>t(`engines`,`engines.item:${e.id}`,e.name,{groupLabel:Q(`sections.engines`),keywords:[`engine`,`agent`,`default`,e.id,e.name]}));return[t(`general`,`general.language`,Q(`general.language`),{groupLabel:n,hint:V(`prefs.languageHint`),keywords:[`language`,`locale`,`english`,`chinese`,`中文`,`语言`]}),t(`general`,`general.keyHints`,Q(`general.keyHintsShow`),{groupLabel:n,hint:V(`settings.general.tuiKeyHints`),keywords:[`keyboard`,`hints`,`shortcut`,`status bar`,`key hints`]}),t(`general`,`general.tabStrip`,V(`settings.general.tabStrip`),{groupLabel:n,keywords:[`tab`,`tab strip`,`tabs`,`标签栏`]}),t(`general`,`general.worktree`,Q(`general.worktree`),{groupLabel:r,hint:Q(`general.worktreeHint`),keywords:[`worktree`,`git`,`directory`,`folder`,`location`,`path`,`工作树`]}),t(`general`,`general.scrollback`,V(`settings.general.scrollback`),{groupLabel:i,hint:Q(`general.scrollbackRowHint`),keywords:[`scrollback`,`terminal`,`buffer`,`history`,`rows`,`lines`,`回滚`]}),t(`appearance`,`appearance.theme`,Q(`general.theme`),{hint:V(`prefs.themePreviewHint`),keywords:[`theme`,`palette`,`color`,`package`,`ghostty`,`kitty`,`alacritty`,`wezterm`,`主题`,`配色`]}),t(`appearance`,`appearance.themeMode`,Q(`general.themeMode`),{keywords:[`dark`,`light`,`auto`,`mode`,`theme mode`,`深色`,`浅色`,`明暗`]}),t(`appearance`,`appearance.focusAccent`,Q(`general.focusAccent`),{groupLabel:a,hint:Q(`general.focusAccentHint`),keywords:[`focus`,`accent`,`color`,`primary`,`highlight`,`强调色`]}),t(`appearance`,`appearance.taskColors`,Q(`general.taskColors`),{groupLabel:a,hint:V(`settings.appearance.taskColorsNote`),keywords:[`task colors`,`hue`,`border`,`任务配色`]}),t(`appearance`,`appearance.colorblind`,Q(`general.colorblind`),{groupLabel:a,hint:V(`settings.appearance.colorblindNote`),keywords:[`colorblind`,`diff`,`accessibility`,`a11y`,`色盲`]}),t(`appearance`,`appearance.workingBorder`,Q(`general.workingBorder`),{groupLabel:o,hint:V(`settings.appearance.workingBorderNote`),keywords:[`working border`,`gradient`,`flow`,`still`,`border`,`边框`]}),t(`appearance`,`appearance.runningTitle`,Q(`general.runningTitle`),{groupLabel:o,keywords:[`running title`,`shimmer`,`still`,`title`,`流光`]}),t(`appearance`,`appearance.splitStyle`,Q(`general.splitStyle`),{groupLabel:o,keywords:[`split`,`panes`,`divider`,`box`,`rail`,`rule`,`分屏`]}),t(`appearance`,`appearance.railFold`,Q(`general.railFold`),{groupLabel:o,hint:Q(`general.railFoldHint`),keywords:[`rail`,`sidebar`,`fold`,`collapse`,`glyphs`,`initials`,`折叠`]}),t(`appearance`,`appearance.railGroup`,V(`settings.appearance.railGroup`),{groupLabel:o,keywords:[`task list`,`rail`,`sidebar`,`group`,`project`,`state`,`任务列表`]}),t(`appearance`,`appearance.statusMark`,V(`settings.appearance.statusMark`),{groupLabel:o,keywords:[`task status`,`icon`,`dots`,`status mark`,`engine icon`,`任务状态`]}),t(`notifications`,`notifications.toast`,Q(`general.toast`),{hint:V(`settings.notifications.toastNote`),keywords:[`toast`,`popup`,`notification`,`alert`,`弹窗`]}),t(`notifications`,`notifications.sound`,Q(`general.sound`),{hint:V(`prefs.soundHint`),keywords:[`sound`,`audio`,`chime`,`bell`,`desktop notification`,`声音`,`提示音`]}),t(`notifications`,`notifications.soundVolume`,V(`settings.notifications.volume`),{hint:V(`prefs.soundVolumeHint`),keywords:[`volume`,`chime`,`sound`,`audio`,`音量`]}),t(`notifications`,`notifications.crossTask`,Q(`general.crossTask`),{hint:Q(`general.crossTaskHint`),keywords:[`cross-task`,`background`,`notification`,`跨任务`]}),t(`notifications`,`notifications.finishedAlerts`,Q(`general.finishedAlerts`),{hint:Q(`general.finishedAlertsHint`),keywords:[`finished`,`turns`,`approval`,`alert`,`unread`,`回合完成`]}),t(`notifications`,`notifications.push`,V(`prefs.push`),{hint:V(`prefs.pushHint`),keywords:[`push`,`web push`,`closed`,`notification`,`推送`]}),t(`snippets`,`snippets.list`,V(`settings.sections.snippets`),{hint:V(`settings.pages.snippets`),keywords:[`snippets`,`prompt`,`template`,`@name`,`reusable`,`片段`]}),t(`keys`,`keys.tapPresentation`,Q(`keybindings.tapPresentation`),{hint:Q(`keybindings.tapPresentationHint`),keywords:[`prefix tap`,`guide`,`badges`,`command layer`,`keybindings`,`点按`]}),t(`keys`,`keys.prefix`,Q(`keybindings.prefixKey`),{hint:Q(`keybindings.title`),keywords:[`prefix`,`ctrl+a`,`leader`,`chord`,`keybinding`,`shortcut`,`快捷键`]}),t(`keys`,`keys.configFile`,Q(`keybindings.configFile`),{hint:V(`prefs.keysYaml`),keywords:[`keybindings.yaml`,`yaml`,`config file`,`keybindings`,`配置文件`]}),...p,t(`engines`,`engines.list`,Q(`sections.engines`),{hint:Q(`engines.hint`),keywords:[`engines`,`agent`,`default engine`,`cli`,`coding agent`,`引擎`]}),...m,t(`engines`,`engines.integrations`,Q(`engines.integrations.title`),{hint:Q(`engines.integrations.hint`),keywords:[`hooks`,`integrations`,`install`,`uninstall`,`activity`,`集成`]}),t(`engines`,`engines.skill`,Q(`engines.skill.title`),{hint:Q(`engines.skill.hint`),keywords:[`skill`,`agent skill`,`install`,`技能`]}),t(`engines`,`engines.permissionBypass`,Q(`engines.permissionBypass`),{groupLabel:Q(`engines.permissionsTitle`),hint:Q(`engines.permissionBypassHint`),keywords:[`permission`,`bypass`,`auto approve`,`yolo`,`权限`]}),...[`swift`,`standard`,`deep`].map(e=>t(`autoRouting`,`autoRouting.tier.${e}`,eM(`tier.${e}`),{groupLabel:Q(`sections.autoRouting`),hint:eM(`tierDesc.${e}`),keywords:[`auto routing`,`tier`,`model`,`effort`,e,`自动路由`,`档位`]})),t(`autoRouting`,`autoRouting.classifier`,Q(`autoRouting.classifierLabel`),{groupLabel:u,hint:Q(`autoRouting.classifierHint`),keywords:[`classifier`,`jev`,`custom`,`auto routing`,`分类器`]}),t(`autoRouting`,`autoRouting.endpoint`,Q(`autoRouting.endpointLabel`),{groupLabel:d,keywords:[`endpoint`,`url`,`classifier`,`端点`]}),t(`autoRouting`,`autoRouting.threshold`,Q(`autoRouting.thresholdLabel`),{groupLabel:d,keywords:[`threshold`,`confidence`,`classifier`,`阈值`]}),t(`autoRouting`,`autoRouting.key`,Q(`autoRouting.keyLabel`),{groupLabel:d,keywords:[`api key`,`secret`,`classifier`,`密钥`]}),t(`voice`,`voice.dictation`,V(`voice.setup.dictation`),{hint:V(`settings.pages.voice`),keywords:[`voice`,`dictation`,`speech`,`microphone`,`whisper`,`transcribe`,`asr`,`语音`,`口述`]}),t(`connectors`,`connectors.github`,`GitHub`,{hint:V(`settings.connectors.githubDescription`),keywords:[`github`,`gh`,`git`,`pr`,`ssh`,`machines`,`account`,`账号`]}),t(`connectors`,`connectors.chat`,V(`settings.connectors.chat`),{hint:V(`settings.connectors.chatHint`),keywords:[`chat`,`wechat`,`weixin`,`lark`,`feishu`,`bot`,`微信`,`飞书`,`聊天`]}),t(`connectors`,`connectors.phone`,V(`settings.connectors.phoneTitle`),{hint:V(`settings.connectors.phoneHint`),keywords:[`phone`,`pair`,`qr`,`ios`,`iphone`,`android`,`mobile`,`relay`,`手机`,`配对`,`扫码`]}),t(`connectors`,`connectors.inbox`,V(`settings.connectors.inboxTitle`),{hint:V(`settings.connectors.inboxHint`),keywords:[`inbox`,`encrypted`,`token`,`external`,`age`,`relay`,`收件箱`]}),t(`plugins`,`plugins.builtIn`,V(`settings.plugins.builtIn`),{hint:V(`settings.plugins.builtInHint`),keywords:[`mods`,`built-in`,`kanban`,`issues`,`plugins`,`内置`,`插件`]}),t(`plugins`,`plugins.registered`,V(`settings.plugins.registered`),{hint:V(`settings.pages.plugins`),keywords:[`plugins`,`registered`,`extensions`,`插件`]}),t(`about`,`about.daemon`,V(`settings.about.daemon`),{groupLabel:s,hint:V(`settings.pages.about`),keywords:[`daemon`,`version`,`computer`,`host`,`build`,`守护进程`,`版本`]}),t(`about`,`about.updateChannel`,Q(`general.updateChannelTitle`),{groupLabel:s,hint:Q(`general.updatesHint`),keywords:[`update`,`channel`,`stable`,`next`,`nightly`,`release`,`发布渠道`,`更新`]}),t(`about`,`about.updateNotify`,Q(`general.updateNotify`),{groupLabel:s,hint:Q(`general.updateNotifyHint`),keywords:[`update`,`notify`,`version`,`更新通知`]}),t(`about`,`about.updateCheck`,Q(`general.updates`),{groupLabel:s,hint:Q(`general.updateCheckHint`),keywords:[`check for updates`,`update`,`npm`,`upgrade`,`检查更新`]}),t(`about`,`about.signIn`,V(`settings.about.signIn`),{groupLabel:c,keywords:[`sign in`,`login`,`password`,`token`,`auth`,`access`,`security`,`登录`,`密码`]}),t(`about`,`about.signOut`,V(`settings.about.signOut`),{groupLabel:l,hint:V(`settings.about.browserHint`),keywords:[`sign out`,`logout`,`token`,`browser`,`退出登录`]}),t(`feedback`,`feedback.form`,Q(`sections.feedback`),{hint:V(`settings.pages.feedback`),keywords:[`feedback`,`bug`,`idea`,`question`,`issue`,`github`,`report`,`反馈`]}),t(`dev`,`dev.remoteProjects`,Q(`dev.remote`),{groupLabel:f,hint:Q(`dev.remoteHint`),keywords:[`remote`,`ssh`,`experimental`,`dev`,`远程项目`]}),t(`dev`,`dev.autoStatus`,Q(`dev.autoStatus`),{groupLabel:f,hint:Q(`dev.autoStatusHint`),keywords:[`auto status`,`in_progress`,`in_review`,`experimental`,`dev`,`自动状态`]}),t(`dev`,`dev.dispatcher`,Q(`dev.dispatcher`),{groupLabel:f,hint:Q(`dev.dispatcherHint`),keywords:[`dispatcher`,`field notes`,`note`,`experimental`,`dev`,`现场笔记`]}),t(`dev`,`dev.restart`,Q(`dev.restart`),{hint:V(`prefs.restartHint`),keywords:[`restart`,`daemon`,`backend`,`dev`,`重启`]}),t(`dev`,`dev.reset`,Q(`dev.reset`),{hint:V(`prefs.resetHint`),keywords:[`reset`,`wipe`,`clear`,`state.json`,`tasks.json`,`dev`,`重置`]})]}function LH(e,t=[]){return MH(IH(t),e)}var RH=[{id:`preferences`,sections:[`general`,`appearance`,`notifications`,`snippets`,`keys`]},{id:`agents`,sections:[`engines`,`autoRouting`,`voice`,`connectors`,`plugins`]},{id:`more`,sections:[`about`,`feedback`,`dev`]}],zH=e=>({section:e??`general`,drilled:e!==void 0});function BH(e,t){return t&&e.drilled?`list`:`close`}var VH=e=>e.split(`
102
+ `,1)[0]??``;function HH(e){let t=Oe(),[n,r]=(0,h.useState)(e.editing?.name??``),[i,a]=(0,h.useState)(e.editing?.text??``),o=ni(i),[s,c]=(0,h.useState)(!1),l=my.test(n)&&i.trim()!==``;return(0,U.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:t=>{t.preventDefault(),l&&(c(!0),fy(e.client,{name:n,text:i}).then(e.onDone).catch(e=>{z(G(e),`error`),c(!1)}))},children:[(0,U.jsxs)(`label`,{className:QM,children:[(0,U.jsx)(`span`,{className:ii,children:V(`snippets.name`)}),(0,U.jsx)(`input`,{className:`${XM} w-full font-mono`,value:n,maxLength:32,spellCheck:!1,autoComplete:`off`,autoFocus:!e.editing,readOnly:e.editing!==void 0,placeholder:V(`snippets.namePlaceholder`),onChange:e=>r(e.target.value)}),n!==``&&!my.test(n)&&(0,U.jsx)(`span`,{className:`text-meta text-muted [&_a]:text-accent`,children:V(`snippets.badName`)})]}),(0,U.jsxs)(`label`,{className:QM,children:[(0,U.jsx)(`span`,{className:ii,children:V(`snippets.text`)}),(0,U.jsx)(`textarea`,{ref:o,className:`${XM} ${ai} w-full`,rows:5,value:i,maxLength:8e3,placeholder:V(`snippets.textPlaceholder`),onChange:e=>a(e.target.value)})]}),t?(0,U.jsxs)(`div`,{className:$M,children:[e.onRemove&&(0,U.jsx)(W,{variant:`actionDanger`,className:`mr-auto`,onClick:e.onRemove,children:V(`snippets.phone.remove`)}),(0,U.jsx)(W,{variant:`action`,onClick:e.onDone,children:V(`snippets.phone.cancel`)}),(0,U.jsx)(W,{variant:`filled`,type:`submit`,disabled:s||!l,children:V(`snippets.phone.save`)})]}):(0,U.jsxs)(`div`,{className:$M,children:[(0,U.jsx)(W,{onClick:e.onDone,children:V(`snippets.cancel`)}),(0,U.jsx)(W,{type:`submit`,disabled:s||!l,children:V(`snippets.save`)})]})]})}function UH({model:e}){let{client:t}=e,n=uy(),[r,i]=(0,h.useState)(null),[a,o]=(0,h.useState)({done:!1,failed:null}),s=(0,h.useCallback)(()=>dy(t).then(()=>o({done:!0,failed:null}),e=>o(t=>({...t,failed:G(e)}))),[t]);(0,h.useEffect)(()=>t.onOpen(()=>void s()),[t,s]);let c=Oe(),l=e=>void py(t,e).then(()=>{i(null),z(V(`snippets.removed`,{name:e}))}).catch(e=>z(G(e),`error`));return(0,U.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,U.jsxs)(QN,{settingId:`snippets.list`,children:[n.length===0&&r===null&&(a.done?(0,U.jsx)($N,{label:V(`snippets.empty`)}):(0,U.jsx)(cP,{failed:a.failed,onRetry:s})),n.map(e=>c?(0,U.jsxs)(W,{variant:`row`,className:GM,onClick:()=>i(e),children:[(0,U.jsxs)(`span`,{className:KM,children:[(0,U.jsxs)(`span`,{className:`${HM} font-mono`,children:[`@`,e.name]}),(0,U.jsx)(`span`,{className:`${UM} truncate`,children:VH(e.text)})]}),(0,U.jsx)(Bv,{right:!0,className:xM})]},e.name):(0,U.jsxs)($N,{label:(0,U.jsxs)(`span`,{className:`font-mono`,children:[`@`,e.name]}),hint:VH(e.text),children:[(0,U.jsx)(W,{onClick:()=>i(e),children:V(`snippets.edit`)}),(0,U.jsx)(W,{onClick:()=>l(e.name),children:V(`snippets.remove`)})]},e.name)),c&&r===null&&(0,U.jsx)(W,{variant:`row`,className:`flex min-h-11 w-full items-center py-2 text-left font-sans text-title text-accent active:bg-hover`,onClick:()=>i(`new`),children:V(`snippets.phone.add`)})]}),c&&r===null?null:r===null?(0,U.jsx)(`div`,{className:$M,children:(0,U.jsx)(W,{onClick:()=>i(`new`),children:V(`snippets.add`)})}):(0,U.jsx)(HH,{client:t,editing:r===`new`?void 0:r,onDone:()=>i(null),onRemove:c&&r!==`new`?()=>l(r.name):void 0},r===`new`?`new`:r.name)]})}function WH(e,t){return t===`left`?100-Math.min(100,Math.max(0,e)):e}var GH=e=>e>=95?`crit`:e>=75?`warn`:`ok`,KH=e=>String(e).padStart(2,`0`);function qH(e,t){if(e==null||e<=t)return``;let n=new Date(e),r=`${KH(n.getHours())}:${KH(n.getMinutes())}`;return e-t<864e5?`→ ${r}`:`→ ${n.getMonth()+1}/${n.getDate()} ${r}`}function JH(e,t,n=`used`){let r=e.windows.find(e=>e.kind===`session`)??e.windows[0];return r?{label:r.label,percentText:`${WH(r.percent,n)}%`,resetText:qH(r.resetsAt,t),tone:GH(r.percent)}:null}var YH=1e4;function XH({client:e,inset:t=!0}){let n=b(e.conn),[r,i]=(0,h.useState)(null);(0,h.useEffect)(()=>{if(n.state!==`open`)return;let t=!0,r=()=>e.request(`usage.get`,{}).then(e=>{t&&i(e.usage)}).catch(()=>{});r();let a=ua(YH,r);return()=>{t=!1,a()}},[e,n.state]);let a=Date.now(),o=(r??[]).flatMap(e=>{let t=JH({capturedAt:e.capturedAt,windows:e.windows},a);return t?[{vendor:e.vendor,name:e.name,chip:t}]:[]});return o.length===0?null:(0,U.jsx)(`div`,{className:`${er} ${t?`px-2`:``}`,children:o.map(({vendor:e,name:t,chip:n})=>{let r=Math.min(100,Math.max(0,Number.parseInt(n.percentText,10)||0));return(0,U.jsxs)(W,{variant:`row`,className:tr,title:`${t} · ${n.label} ${n.percentText} ${n.resetText}`.trim(),"aria-label":`${V(`usage.open`)}: ${t}`,onClick:()=>{B(),xe(`usage`)},children:[(0,U.jsx)(`span`,{className:`truncate`,children:t}),(0,U.jsx)(`span`,{className:ir(n.tone),style:{"--fill":`${r}%`}}),(0,U.jsxs)(`span`,{children:[n.label,` `,(0,U.jsx)(`span`,{className:nr[n.tone],children:n.percentText})]})]},e)})})}var ZH=2e3;function QH(e){let[t,n]=(0,h.useState)(null),[r,i]=(0,h.useState)(null),a=(0,h.useCallback)(t=>{n(t),Wb(e,t.available)},[e]),o=(0,h.useCallback)(()=>e.request(`voice.status`).then(a,e=>i(G(e))),[e,a]);(0,h.useEffect)(()=>void o(),[o]);let s=t?.setup?.install.phase===`running`||t?.available===!0&&!t.ready;return(0,h.useEffect)(()=>{if(!s)return;let e=window.setInterval(()=>void o(),ZH);return()=>window.clearInterval(e)},[s,o]),{status:t,error:r,setError:i,accept:a}}function $H(e){let[t,n]=(0,h.useState)(!1);return t?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:WM,children:e.ask}),(0,U.jsx)(W,{variant:`action`,disabled:e.disabled,onClick:()=>{n(!1),e.onConfirm()},children:e.label}),(0,U.jsx)(W,{variant:`action`,onClick:()=>n(!1),children:V(`voice.setup.cancel`)})]}):(0,U.jsx)(W,{variant:`action`,disabled:e.disabled,onClick:()=>n(!0),children:e.label})}function eU({client:e}){let{status:t,error:n,setError:r,accept:i}=QH(e),[a,o]=(0,h.useState)(!1),s=t?.setup,[c,l]=(0,h.useState)(!1),[u,d]=(0,h.useState)(``),[f,p]=(0,h.useState)(``),[m,g]=(0,h.useState)(``);(0,h.useEffect)(()=>{s?.cloud&&(d(e=>e||s.cloud?.baseURL||``),p(e=>e||s.cloud?.model||``))},[s?.cloud]);let _=(t,n)=>(o(!0),r(null),e.request(t,n).then(i,e=>r(G(e))).finally(()=>o(!1)));if(!t)return(0,U.jsx)(`p`,{className:YM,children:n??`…`});if(!s)return(0,U.jsx)(`p`,{className:YM,children:t.model??V(`voice.setup.unavailable`)});let v=s.install,y=v.phase===`running`,b=c?`cloud`:s.backend,x=e=>{if(e===`cloud`&&!s.cloud?.hasKey)return l(!0);l(!1),_(`voice.configure`,{backend:e})},S=b===`off`?V(`voice.setup.offHint`):c?V(`voice.setup.cloudNeeded`):b===`local`&&!s.localInstalled?V(y?`voice.setup.localInstalling`:`voice.setup.localNeeded`):t.ready?V(`voice.setup.ready`,{model:t.model??``}):t.error??V(`voice.setup.starting`),C=y?v.line??V(`voice.setup.installing`):v.phase===`failed`&&!s.localInstalled?V(`voice.setup.failed`,{line:v.line??``}):s.localInstalled?V(`voice.setup.installed`):s.blocked??V(`voice.setup.localHint`);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(QN,{children:(0,U.jsx)(aP,{settingId:`voice.dictation`,label:V(`voice.setup.dictation`),hint:S,value:b,picks:[`off`,`local`,`cloud`].map(e=>({value:e,label:V(`voice.setup.backend.${e}`)})),onPick:x})}),(b===`local`||s.localInstalled||y)&&(0,U.jsx)(QN,{title:V(`voice.setup.backend.local`),children:(0,U.jsx)($N,{label:V(`voice.setup.localTitle`),hint:C,children:y?(0,U.jsx)(`span`,{className:`max-w-90 min-w-0 truncate font-mono text-meta text-muted [overflow-wrap:anywhere]`,children:V(`voice.setup.installing`)}):s.localInstalled?(0,U.jsx)($H,{label:V(`voice.setup.uninstall`),ask:V(`voice.setup.uninstallAsk`),disabled:a,onConfirm:()=>void _(`voice.uninstall`)}):!s.blocked&&(0,U.jsx)(W,{variant:`action`,disabled:a,onClick:()=>void _(`voice.install`),children:V(`voice.setup.install`)})})}),(b===`cloud`||s.cloud)&&(0,U.jsx)(QN,{title:V(`voice.setup.cloudTitle`),hint:V(`voice.setup.cloudHint`),children:(0,U.jsxs)(`form`,{className:`flex flex-col gap-3 py-3`,onSubmit:e=>{e.preventDefault(),_(`voice.configure`,{backend:`cloud`,baseURL:u,model:f,apiKey:m}).then(()=>l(!1)),g(``)},children:[(0,U.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(`span`,{className:`font-sans text-meta font-normal normal-nums text-muted`,children:V(`voice.setup.baseURL`)}),(0,U.jsx)(`input`,{className:`${XM} font-mono`,value:u,placeholder:`https://api.openai.com/v1`,spellCheck:!1,autoComplete:`off`,onChange:e=>d(e.target.value)})]}),(0,U.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(`span`,{className:`font-sans text-meta font-normal normal-nums text-muted`,children:V(`voice.setup.model`)}),(0,U.jsx)(`input`,{className:`${XM} font-mono`,value:f,placeholder:`gpt-4o-mini-transcribe`,spellCheck:!1,autoComplete:`off`,onChange:e=>p(e.target.value)})]}),(0,U.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(`span`,{className:`font-sans text-meta font-normal normal-nums text-muted`,children:V(`voice.setup.apiKey`)}),(0,U.jsx)(`input`,{className:`${XM} font-mono`,type:`password`,value:m,placeholder:s.cloud?.hasKey?V(`voice.setup.keySaved`):``,autoComplete:`off`,onChange:e=>g(e.target.value)})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2.5`,children:[s.cloud&&(0,U.jsx)($H,{label:V(`voice.setup.forget`),ask:V(`voice.setup.forgetAsk`),disabled:a,onConfirm:()=>{d(``),p(``),_(`voice.forgetCloud`)}}),(0,U.jsx)(W,{variant:`action`,type:`submit`,disabled:a||!u.trim()||!f.trim()||!(m||s.cloud?.hasKey),children:V(s.backend===`cloud`?`voice.setup.save`:`voice.setup.saveAndUse`)})]})]})}),n&&(0,U.jsx)(`p`,{className:`m-0 py-3 text-body text-muted text-error`,children:n})]})}var tU={general:e=>(0,U.jsx)(DV,{model:e}),appearance:e=>(0,U.jsx)(Cz,{model:e}),notifications:e=>(0,U.jsx)(vH,{model:e}),snippets:e=>(0,U.jsx)(UH,{model:e}),keys:e=>(0,U.jsx)(JV,{model:e}),engines:e=>(0,U.jsx)(gV,{model:e}),autoRouting:e=>(0,U.jsx)(CH,{client:e.client}),voice:e=>(0,U.jsx)(eU,{client:e.client}),connectors:e=>(0,U.jsx)($B,{model:e}),plugins:e=>(0,U.jsx)(xH,{model:e}),about:e=>(0,U.jsx)(mF,{client:e.client}),feedback:e=>(0,U.jsx)(wV,{model:e}),dev:e=>(0,U.jsx)(tV,{client:e.client})},nU=1800,rU=4e3;function iU(e){return(e?.engines??[]).map(e=>({id:e.id,name:e.name??e.id}))}function aU(e){return e.narrow?(0,U.jsxs)(`nav`,{className:Nl,"aria-label":V(`settings.title`),children:[(0,U.jsx)(Pl,{children:V(`settings.title`)}),e.searchField,e.searching?e.phoneResults:(0,U.jsxs)(U.Fragment,{children:[RH.map(t=>(0,U.jsx)(Fl,{label:V(`settings.groups.${t.id}`),children:t.sections.map(t=>(0,U.jsxs)(W,{variant:`row`,className:Il,"data-section":t,onClick:()=>e.onPick(t),children:[(0,U.jsx)(AV,{id:t}),FH(t),(0,U.jsx)(Bv,{right:!0,className:xM})]},t))},t.id)),e.foot]})]}):(0,U.jsxs)(`nav`,{className:oM,"aria-label":V(`settings.title`),children:[(0,U.jsxs)(`div`,{className:cM,children:[(0,U.jsx)(`h1`,{className:sM,children:V(`settings.title`)}),e.searchField]}),RH.map(t=>(0,U.jsxs)(`div`,{className:_M,children:[(0,U.jsx)(`p`,{className:vM,children:V(`settings.groups.${t.id}`)}),(0,U.jsx)(`div`,{className:yM,children:t.sections.map(t=>{let n=!e.searching&&e.current===t;return(0,U.jsx)(W,{variant:`row`,"data-section":t,className:bM(n),"aria-current":n?`page`:void 0,onClick:()=>e.onPick(t),children:FH(t)},t)})})]},t.id))]})}function oU({model:e,section:t}){let n=H(),[r,i]=(0,h.useState)(()=>zH(t)),[a,o]=(0,h.useState)(``),[s,c]=(0,h.useState)(0),[l,u]=(0,h.useState)(null),[d,f]=(0,h.useState)(()=>iU(J(e.client,`engines.list`))),p=(0,h.useRef)(null),m=(0,h.useRef)(null),g=Oe();(0,h.useEffect)(()=>{let t=!0;return ss(e.client,`engines.list`).then(e=>{t&&f(iU(e))},()=>{}),()=>{t=!1}},[e.client]);let _=a.trim()!==``,v=(0,h.useMemo)(()=>LH(a,d),[a,d,n]),y=Math.min(s,Math.max(0,v.length-1)),x=()=>{o(``),c(0)},S=e=>{x(),i({section:e.section,drilled:!0}),u(t=>({section:e.section,id:e.id,seq:(t?.seq??0)+1}))},C=()=>{if(_){x();return}BH(r,g)===`list`?i({...r,drilled:!1}):B()};(0,h.useEffect)(()=>{let e=document.querySelector(`.dialog`);e&&!e.contains(document.activeElement)&&e.focus()},[]),(0,h.useEffect)(()=>{let e=e=>{if(!e.defaultPrevented){if(e.key===`Escape`){e.preventDefault(),C();return}if(e.key===`/`&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let t=e.target;if(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement)return;e.preventDefault(),p.current?.focus()}}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)});let w=b(Pe)===`panel`&&g&&r.drilled,T=!g||!r.drilled||w,E=!g||r.drilled;(0,h.useEffect)(()=>{if(!l||!E||_||l.section!==r.section)return;let e=m.current;if(!e)return;let t=`[data-setting-id="${CSS.escape(l.id)}"]`,n=null,i=null,a=null,o=e=>{let t=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1;e.scrollIntoView({block:`center`,behavior:t?`auto`:`smooth`}),e.dataset.settingFlash=`true`,a=e,n=window.setTimeout(()=>{delete e.dataset.settingFlash},nU)},s=e.querySelector(t);if(s)return o(s),()=>{n!==null&&window.clearTimeout(n),a&&delete a.dataset.settingFlash};let c=new MutationObserver(()=>{let n=e.querySelector(t);n&&(c.disconnect(),i!==null&&window.clearTimeout(i),o(n))});return c.observe(e,{childList:!0,subtree:!0}),i=window.setTimeout(()=>c.disconnect(),rU),()=>{c.disconnect(),i!==null&&window.clearTimeout(i),n!==null&&window.clearTimeout(n),a&&delete a.dataset.settingFlash}},[l,E,_,r.section]);let D=(0,U.jsx)(TH,{inputRef:p,query:a,onChange:e=>{o(e),c(0)},onKeyDown:e=>{if(e.key===`ArrowDown`&&v.length>0)e.preventDefault(),c(Math.min(v.length-1,y+1));else if(e.key===`ArrowUp`&&v.length>0)e.preventDefault(),c(Math.max(0,y-1));else if(e.key===`Enter`&&v.length>0){e.preventDefault();let t=v[y];t&&S(t)}else e.key===`Escape`&&a!==``&&(e.preventDefault(),e.stopPropagation(),e.nativeEvent.stopImmediatePropagation(),x())}});return(0,U.jsx)(`div`,{className:nM,onMouseDown:e=>e.target===e.currentTarget&&B(),children:(0,U.jsxs)(`dialog`,{ref:g&&!r.drilled?Fe(B):void 0,tabIndex:-1,open:!0,className:rM,"aria-label":V(`settings.title`),onKeyDown:e=>{let t=e.target;e.key===`Escape`&&(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)&&(t.blur(),e.stopPropagation(),e.nativeEvent.stopImmediatePropagation())},children:[g?T&&(0,U.jsx)(Ml,{frame:`screen`,back:{label:ge.get()===`sidebar`?dA(`narrowBack`):V(`dialog.close`),onClick:B}}):(0,U.jsx)(W,{variant:`row`,className:iM,"aria-label":V(`dialog.close`),title:V(`dialog.close`),onClick:B,children:`×`}),T&&(0,U.jsx)(aU,{current:r.section,narrow:g,searching:_,searchField:D,phoneResults:g&&_?(0,U.jsx)(kH,{query:a,results:v,onPick:S}):void 0,onPick:e=>{x(),i({section:e,drilled:!0})},foot:g&&(0,U.jsx)(`div`,{className:`rounded-[12px] bg-surface px-3 py-1`,children:(0,U.jsx)(XH,{client:e.client,inset:!1})})}),E&&(0,U.jsxs)(`div`,{ref:g?Fe(C):void 0,className:aM(w),children:[g&&(0,U.jsx)(Ml,{frame:`screen`,back:{label:V(`settings.title`),onClick:C},title:FH(r.section),titleKind:`heading`}),!g&&_?(0,U.jsx)(OH,{query:a,results:v,selected:y,onSelect:c,onPick:S,onClear:()=>{x(),p.current?.focus()}}):(0,U.jsx)(`div`,{ref:m,className:`min-h-0 min-w-0 flex-1 overflow-y-auto scrollbar-none`,children:(0,U.jsxs)(`div`,{className:`flex w-full flex-col gap-7 px-8 pt-7 pb-10 w-narrow:gap-4 w-narrow:px-3 w-narrow:pt-0 w-narrow:pb-10`,children:[(0,U.jsxs)(`header`,{className:`flex flex-col gap-1 pr-8 w-narrow:pr-0`,children:[!g&&(0,U.jsx)(`h1`,{className:`m-0 font-sans text-display font-semibold normal-nums text-ink`,children:FH(r.section)}),(0,U.jsx)(`p`,{className:`m-0 text-body text-muted w-narrow:px-3 w-narrow:text-meta`,children:V(`settings.pages.${r.section}`)})]}),(0,U.jsx)(`div`,{className:`flex flex-col gap-7 w-narrow:gap-4`,children:tU[r.section](e)})]})},r.section)]})]})})}function sU(e){return e.kind===`leaf`?[e]:e.children.flatMap(sU)}function cU(e){return!!e&&sU(e.root).length>1}function lU(e){let t=[],n=(e,r,i,a,o,s,c)=>{if(e.kind===`leaf`){t.push({id:e.id,x:r,y:i,w:a,h:o,left:s,top:c});return}let l=e.children.length;e.children.forEach((t,u)=>{e.orientation===`row`?n(t,r+a*u/l,i,a/l,o,u>0||s,c):n(t,r,i+o*u/l,a,o/l,s,u>0||c)})};return n(e,0,0,1,1,!1,!1),t}function uU(e,t,n=1){let r=sU(e.root).map(e=>e.id),i=r.indexOf(t);return r[(Math.max(0,i)+n+r.length)%r.length]??t}function dU(e,t){let n=new Map,r=new Map;for(let i of sU(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 fU(e,t,n){return e.kind===`engine`&&sU(t.root).some(e=>e.id===n&&e.own)}function pU(e){return e.alive!==!1||!!e.split&&!sU(e.split.root).some(e=>e.own)}function mU(e){return sU(e.root).map(e=>e.id).join(`,`)}var hU=e=>{let{taskId:t}=e.selection.get();return e.tasks.get()?.tasks.find(e=>e.id===t)??null},gU=e=>{let{taskId:t,tabId:n}=e.selection.get(),r=t?e.tabs.get()[t]?.find(e=>e.id===n):void 0;return!!r&&!cU(r.split)},_U=[{id:`app.refresh`,live:()=>Va.get().stale,run:e=>Ga(e.client)},{id:`palette.open`,live:()=>!0,run:Ij},{id:`task.new.global`,live:()=>!0,run:()=>Yb()},{id:`chat.tab.fork`,live:e=>!!hU(e),run:e=>{let t=hU(e);t&&k.set((0,U.jsx)(wA,{model:e,taskId:t.id,context:`continue`}))}},{id:`chat.fork.new`,live:e=>!!hU(e),run:e=>{let t=hU(e);t&&k.set((0,U.jsx)(wA,{model:e,taskId:t.id,destination:`fork`}))}},{id:`settings.open`,live:()=>!0,run:e=>k.set((0,U.jsx)(oU,{model:e}))},{id:`inbox.show`,live:()=>!0,run:e=>k.set((0,U.jsx)(Mu,{model:e}))},{id:`focus.previous`,live:()=>!0,run:()=>Os(-1)},{id:`focus.next`,live:()=>!0,run:()=>Os(1)},{id:`workspace.filesToggle`,live:e=>!!hU(e),run:e=>{let t=hU(e);t&&vw(t.id,`files`)}},{id:`files.createPR`,live:e=>!!hU(e),run:e=>{let t=hU(e);t&&e.client.request(`tab.requestPR`,e.engineTarget(t.id)).then(()=>z(V(`files.prRequested`))).catch(e=>z(e instanceof Error?e.message:String(e),`error`))}},{id:`chat.tab.close`,live:e=>!!e.selection.get().tabId&&gU(e),run:e=>{let{taskId:t,tabId:n}=e.selection.get();!t||!n||e.closeTab(t,n).catch(e=>z(e instanceof Error?e.message:String(e),`error`))}},{id:`kanban.open`,live:e=>e.installedMods.get().has(`kanban`),run:()=>xe(`kanban`)},{id:`automations.open`,live:()=>!0,run:()=>xe(`routines`)},{id:`workItems.open`,live:e=>e.installedMods.get().has(`issues`),run:()=>xe(`issues`)},{id:`task.moveMode`,live:e=>!!Bj(e),run:()=>{Dk(!Ek.get()),document.querySelector(`.rail`)?.focus()}},{id:`files.syncBase`,live:e=>Bj(e)?.kind===`task`,run:e=>{let t=Bj(e);t&&Cj(e,t.id)}},{id:`files.fixChecks`,live:e=>!!Bj(e),run:e=>{let t=Bj(e);t&&Tj(e,t.id,V(`taskops.fixSent`))}},{id:`task.openEditor`,live:e=>!!Bj(e),run:e=>{let t=Bj(e);t&&Ej(e,t.id)}}];$s(()=>_U.map(e=>({id:e.id,chords:Js(e.id),prefix:!0,live:e.live,run:e.run})));function vU(e){return Qk(e[0]??``)}function yU(e,t){let n=ic(),r=tc().filter(t=>t.prefix&&nc(t,n)&&t.live?.(e)!==!1);for(let e of t){let t=r.filter(t=>t.chords.includes(e)).sort((e,t)=>rc(e,n)-rc(t,n))[0];if(t)return t}}var bU=null,xU=null;function SU(){bU=null,xU!==null&&window.clearTimeout(xU),xU=null;let e=gA.get();e.guide?.kind===`prefix`&&gA.set({...e,guide:null})}function CU(){if(bU!==null){SU();return}k.get()||Us()===null||(bU=Date.now(),gA.set({...gA.get(),guide:{kind:`prefix`,armedAt:bU}}),xU!==null&&window.clearTimeout(xU),xU=window.setTimeout(SU,Rs.get().prefix.timeoutMs))}function wU(e,t){SU();let n=typeof t==`string`?[t]:t,r=yU(e,n);vA(vU(n),r?.id??null),r?.run(e)}var TU=null;function EU(){TU!==null&&window.clearTimeout(TU),TU=null;let e=gA.get();e.guide?.kind===`direct`&&gA.set({...e,guide:null})}function DU(){TU!==null||k.get()||(TU=window.setTimeout(()=>{SU(),gA.set({...gA.get(),guide:{kind:`direct`}})},400))}function OU(e){(0,h.useEffect)(()=>{let t=t=>{if(t.key===`Control`){t.repeat||DU();return}if(EU(),[`Shift`,`Alt`,`Meta`].includes(t.key))return;let n=Zk(t),{firstStrokes:r,timeoutMs:i}=Rs.get().prefix;if(bU!==null&&Date.now()-bU<=i){if(t.preventDefault(),t.stopImmediatePropagation(),t.key===`Escape`)return SU();wU(e,n);return}SU();let a=document.activeElement,o=pc(a instanceof HTMLElement?a:null)===`field`;!k.get()&&!o&&n.some(e=>r.includes(e))&&(t.preventDefault(),t.stopImmediatePropagation(),CU())},n=e=>e.key===`Control`&&EU(),r=e=>{bU!==null&&(e.target instanceof Element&&e.target.closest(`.prefix-guide, .shortcut-badge, [data-prefix-arm]`)||SU())};return window.addEventListener(`keydown`,t,{capture:!0}),window.addEventListener(`keyup`,n,{capture:!0}),window.addEventListener(`pointerdown`,r,{capture:!0}),window.addEventListener(`blur`,EU),()=>{window.removeEventListener(`keydown`,t,{capture:!0}),window.removeEventListener(`keyup`,n,{capture:!0}),window.removeEventListener(`pointerdown`,r,{capture:!0}),window.removeEventListener(`blur`,EU),EU(),SU()}},[e])}function kU(e){let t=ic(),n=new Map;for(let r of tc()){if(!r.prefix||!nc(r,t)||r.live?.(e)===!1)continue;let i=rc(r,t);for(let e of r.chords){let t=n.get(e);(!t||i<t.rank)&&n.set(e,{action:r.id,rank:i})}}return[...n].map(([e,{action:t}])=>({stroke:e,action:t}))}function AU(e){let t=new Map(Ms.map((e,t)=>[e.id,t])),n=new Map;for(let{stroke:t,action:r}of e)n.set(r,[...n.get(r)??[],t]);let r=new Map,i=[...n].sort(([e],[n])=>(t.get(e)??2**53-1)-(t.get(n)??2**53-1));for(let[e,t]of i){let n=Hk(e);r.set(n,[...r.get(n)??[],{action:e,strokes:t}])}return[...r].map(([e,t])=>({category:e,actions:t}))}var jU=e=>e===`prefix.moreCommands`?oA(`moreCommandsPrefix`):lA(e);function MU(e){let[,t]=(0,h.useState)(0);(0,h.useEffect)(()=>{if(e===null)return;let n=window.setTimeout(()=>t(e=>e+1),Math.max(30,e-Date.now()));return()=>window.clearTimeout(n)},[e])}function NU({model:e}){H();let t=b(gA);b(Rs),b(e.selection);let n=Date.now(),r=t.entries.filter(e=>n-e.at<hA),i=t.guide?.kind===`prefix`?t.guide.armedAt:null,a=i!==null&&n-i<mA?i+mA:null;MU(a??(r[0]?r[0].at+hA:null));let o=t.guide?.kind===`direct`||i!==null&&a===null;if(!o&&!t.guide&&r.length===0)return null;if(o&&t.guide){let n=t.guide.kind===`direct`,r=n?Jk(ac(e,ic()),Us()):kU(e);return(0,U.jsxs)(`output`,{className:`mono ${xn}`,onMouseDown:e=>e.preventDefault(),children:[(0,U.jsxs)(`div`,{className:Cn,children:[(0,U.jsx)(`span`,{className:`text-accent`,children:n?oA(`directLayer`):oA(`commandLayer`,{prefix:Us()??``})}),(0,U.jsx)(`span`,{className:`keys-only text-muted`,children:oA(n?`releaseCtrl`:`escCancel`)})]}),(0,U.jsx)(`div`,{className:wn,children:AU(r).map(t=>(0,U.jsxs)(`div`,{className:Tn,children:[(0,U.jsx)(`div`,{className:`text-accent`,children:uA(t.category)}),t.actions.map(({action:t,strokes:r})=>(0,U.jsxs)(`button`,{type:`button`,className:En,disabled:n,onClick:()=>r[0]&&wU(e,r[0]),children:[(0,U.jsx)(`span`,{className:Sn,children:r.map(Qk).join(`/`)}),(0,U.jsx)(`span`,{children:jU(t)})]},t))]},t.category))})]})}return(0,U.jsxs)(`output`,{className:Rn,children:[r.map(e=>(0,U.jsxs)(PU,{at:e.at,children:[(0,U.jsx)(`span`,{className:`text-accent`,children:Us()}),` + `,e.stroke,` →`,` `,e.action?jU(e.action):(0,U.jsx)(`span`,{className:`text-muted`,children:`∅`})]},e.id)),i!==null&&(0,U.jsxs)(`div`,{className:zn(!1),children:[(0,U.jsx)(`span`,{className:`text-accent`,children:Us()}),` ⋯`]})]})}function PU({at:e,children:t}){let[n]=(0,h.useState)(Date.now),r=n-e>140,i={"--hud-out":`${e+hA-140-n}ms`};return(0,U.jsx)(`div`,{className:zn(r),style:i,children:t})}function FU({model:e,bindingId:t,head:n=!1}){let r=b(gA);b(Rs);let i=Rw().prefs.prefixTap;if(r.guide?.kind!==`prefix`||i!==`local`)return null;let a=qk({bindingId:t,reachability:ac(e,ic()),prefixKey:Us()});if(!a)return null;let o=tc().find(e=>e.id===t&&e.prefix)?.chords[0];return(0,U.jsx)(`button`,{type:`button`,className:`mono ${fn(n)}`,onMouseDown:e=>e.preventDefault(),onClick:t=>{t.stopPropagation(),o&&wU(e,o)},children:a})}function IU(e,t,n){let r=t(n),i=[];for(let a=2;a<=r;a++){let o=n+1;for(;o<e&&t(o)>a;)o++;let s=o<e&&t(o)===a;i.push(a===r?s?`tee`:`elbow`:s?`pipe`:`blank`)}return i}function LU(e,t,n){let r=e=>e.repo===t.repo&&!e.pinned==!t.pinned;if(t.id===n.id||!r(n))return null;let i=e.filter(r).sort((e,t)=>(e.order??e.rank)-(t.order??t.rank)).map(e=>e.id);return i.indexOf(n.id)-i.indexOf(t.id)}function RU(e,t,n,r){let i=LU(e,t,n);return i===null?null:r===`above`&&i>0?i-1:r===`below`&&i<0?i+1:i}function zU(e,t){return e.id!==t.id&&t.repo===e.repo&&!t.pinned==!e.pinned}var BU=e=>e===void 0||e.kind===`project`||e.kind===`state`?0:e.kind===`task`||e.kind===`pane`||e.kind===`round`?e.depth:1;function VU(e,t){let n=BU(e[t]),r=t+1;for(;r<e.length&&BU(e[r])>n;)r++;return r}function HU(e,t){return IU(e.length,t=>BU(e[t]),t)}function UU(e,t,n,r){let i=e.findIndex(e=>e.id===t);if(i<0||t===n)return e;let a=VU(e,i),o=e.slice(i,a),s=[...e.slice(0,i),...e.slice(a)],c=s.findIndex(e=>e.id===n);if(c<0)return e;let l=r===`above`?c:VU(s,c);return[...s.slice(0,l),...o,...s.slice(l)]}var WU=globalThis.webkit?.messageHandlers?.roveMac;function GU(e){let t=t=>e(t.detail);return window.addEventListener(`rove-mac`,t),()=>window.removeEventListener(`rove-mac`,t)}function KU(e,t,n,r,i,a){(0,h.useEffect)(()=>{if(WU)return WU.postMessage({op:`toolbar`,folded:e,waiting:t,back:n,forward:r,dark:getComputedStyle(document.documentElement).colorScheme!==`light`}),GU(({action:e})=>{e===`fold`&&a(),e===`back`&&n&&i(-1),e===`forward`&&r&&i(1)})},[e,t,n,r,i,a])}function qU(e,t){return e.kind===`task`&&t.kind===`task`?e.taskId===t.taskId:e.kind===`page`&&t.kind===`page`?e.id===t.id:e.kind===`new`&&t.kind===`new`}var JU={entries:[],at:-1};function YU(e,t){let n=e.entries[e.at];if(n&&qU(n,t)){let n=[...e.entries];return n[e.at]=t,{entries:n,at:e.at}}let r=[...e.entries.slice(0,e.at+1),t].slice(-50);return{entries:r,at:r.length-1}}function XU(e,t,n){for(let r=e.at+t;r>=0&&r<e.entries.length;r+=t){let t=e.entries[r];if(t&&n(t))return r}return-1}var ZU=y(JU);function QU(e){let t=M.get();if(t)return{kind:`page`,id:t};let n=I.get();if(n)return{kind:`new`,start:n};let{taskId:r,tabId:i}=e.selection.get();return r?{kind:`task`,taskId:r,tabId:i}:null}function $U(e,t){if(t.kind!==`task`)return!0;let n=e.tasks.get()?.tasks.find(e=>e.id===t.taskId);return n!==void 0&&!n.deleting}var eW=!1;function tW(e){let t=!1,n=()=>{t||(t=!0,queueMicrotask(()=>{if(t=!1,eW)return;let n=QU(e);n&&ZU.set(YU(ZU.get(),n))}))};n();let r=[e.selection.subscribe(n),M.subscribe(n),I.subscribe(n)];return()=>{for(let e of r)e()}}function nW(e,t){let n=ZU.get(),r=XU(n,t,t=>$U(e,t)),i=n.entries[r];i&&(eW=!0,i.kind===`task`?(M.set(null),I.set(null),e.select(i.taskId,i.tabId)):i.kind===`page`?(I.set(null),xe(i.id)):(M.set(null),I.set(i.start)),ZU.set({entries:n.entries,at:r}),queueMicrotask(()=>{eW=!1}))}function rW({children:e}){return(0,U.jsx)(`svg`,{className:`size-3.5 ${ur}`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:e})}var iW={chat:(0,U.jsx)(`path`,{d:`M3 3.5h10a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1H8l-3 2.5v-2.5H3a1 1 0 0 1-1-1v-6a1 1 0 0 1 1-1zM5 6.5h6M5 8.5h4`}),files:(0,U.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`}),diff:(0,U.jsx)(`path`,{d:`M3.5 2.5h9a1 1 0 0 1 1 1v9a1 1 0 0 1-1 1h-9a1 1 0 0 1-1-1v-9a1 1 0 0 1 1-1zM8 5v4M6 7h4M6 11h4`}),browser:(0,U.jsx)(`path`,{d:`M8 2a6 6 0 1 0 0 12A6 6 0 0 0 8 2zM2 8h12M8 2c2.2 2 2.2 10 0 12M8 2c-2.2 2-2.2 10 0 12`}),quota:(0,U.jsx)(`path`,{d:`M2 10a6 6 0 1 1 12 0M8 10l2.5-3.5M4 13h8`})};function aW(e){let t=BS(e);return t?VS(t):V(`panel.browser`)}var oW=7.3,sW=22,cW=160,lW=2,uW=24;function dW(e,t){let n=0;for(let t of e){let e=0;for(let n of t)e+=(n.codePointAt(0)??0)>11903?2:1;n+=Math.min(cW,sW+e*oW)+lW}return n<=t}function fW(e,t,n){let r=[{label:V(`panel.close`),section:`close`,run:()=>Tw(e,n.id)}];return t.tabs.length>1&&r.push({label:V(`panel.closeOthers`),section:`close`,run:()=>ww(e,e=>eC(e,n.id))}),r}function pW({taskId:e,column:t}){H();let n=(0,h.useRef)(null),r=(0,h.useRef)(null),[i,a]=(0,h.useState)(0);(0,h.useEffect)(()=>{let e=n.current;if(!e)return;let t=new ResizeObserver(([e])=>a(e?.contentRect.width??0));return t.observe(e),()=>t.disconnect()},[]);let o=i>0&&!dW(t.tabs.map(aW),i-uW);return(0,h.useEffect)(()=>{r.current?.querySelector(`.is-active`)?.scrollIntoView({block:`nearest`,inline:`nearest`})},[t.active,t.tabs.length,o]),(0,U.jsxs)(`div`,{className:br,ref:n,children:[(0,U.jsx)(`div`,{className:xr,role:`tablist`,"aria-label":V(`panel.tabs`),ref:r,children:t.tabs.map(n=>{let r=n.id===t.active;return(0,U.jsxs)(`div`,{role:`presentation`,className:Sr({active:r,compact:o}),onMouseDown:e=>{e.button===1&&e.preventDefault()},onAuxClick:t=>{t.button===1&&(t.preventDefault(),Tw(e,n.id))},onContextMenu:r=>Tq(r,fW(e,t,n)),children:[(0,U.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":r,className:Cr(r),title:BS(n)||aW(n),onClick:()=>ww(e,e=>US(e,n.id)),children:(0,U.jsx)(`span`,{className:wr,children:aW(n)})}),(0,U.jsx)(`button`,{type:`button`,className:Tr(r),"aria-label":V(`panel.close`),tabIndex:-1,onClick:()=>Tw(e,n.id),children:`×`})]},n.id)})}),(0,U.jsx)(`button`,{type:`button`,className:dr({tool:!0}),title:V(`panel.new`),"aria-label":V(`panel.new`),onClick:()=>ww(e,KS),children:(0,U.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,U.jsx)(`path`,{d:`M8 3.5v9M3.5 8h9`})})})]})}var mW=192,hW=`rove.web.railWidth`,gW=`rove.web.railFolded`;function _W(){let e=Number(localStorage.getItem(hW));return Number.isFinite(e)&&e>0?e:null}var vW=y(_W());vW.subscribe(()=>{let e=vW.get();e===null?localStorage.removeItem(hW):localStorage.setItem(hW,String(Math.round(e)))}),vW.subscribe(pe);var yW=y(localStorage.getItem(gW)===`1`);yW.subscribe(()=>localStorage.setItem(gW,yW.get()?`1`:`0`));var bW=y(!1),xW=null,SW=!1;function CW(e){xW!==null&&window.clearTimeout(xW),xW=null,SW=e,e?bW.set(!0):xW=window.setTimeout(()=>O.get()===null&&bW.set(!1),250)}O.subscribe(()=>{O.get()===null&&bW.get()&&!SW&&CW(!1)}),yW.subscribe(()=>bW.set(!1)),yW.subscribe(pe);function wW(e,t=window.innerWidth){let n=Math.max(mW,t-320);return Math.max(mW,Math.min(n,Math.round(e)))}function TW({client:e,railBar:t}){H(),b(Rs);let{stale:n,bridgeVersion:r,daemonVersion:i}=b(Va);if(!n)return null;let a=V(`layout.refreshRove`),o=[V(`layout.refreshVersions`,{bridge:r?`v${r}`:V(`layout.unknownVersion`),daemon:i?`v${i}`:V(`layout.unknownVersion`)}),qs(`app.refresh`)].filter(Boolean).join(` · `),s=(0,U.jsxs)(W,{variant:`pill`,className:`ml-auto min-h-6 min-w-6 justify-center touch:min-h-8 rounded-sm focus-visible:outline-1 focus-visible:outline-focus`,"aria-label":a,title:o,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&e.stopPropagation()},onClick:()=>Ga(e),children:[(0,U.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 shrink-0 rounded-full bg-warning`}),(0,U.jsx)(`span`,{className:t?`@max-[6.25rem]/refresh:sr-only`:void 0,children:a})]});return t?(0,U.jsx)(`div`,{className:`@container/refresh absolute top-2 right-2.5 left-[calc(5.75rem+var(--shell-inset-left,0px))] flex h-6.5 items-center justify-end @max-[13rem]:right-1`,children:s}):s}function EW({edge:e,className:t,...n}){return(0,U.jsx)(`div`,{"data-grip":``,className:Kt(`absolute inset-y-0 z-5 w-1.5 cursor-col-resize touch-none`,`after:absolute after:inset-y-0 after:w-0.5 after:bg-line-active after:opacity-0 after:transition-opacity after:duration-120`,`hover:after:opacity-100 hover:after:delay-250 active:after:bg-accent active:after:opacity-100 active:after:delay-0`,e===`right`?`right-0 after:right-0`:`left-0 after:left-0`,t),...n})}var DW=400;function OW({rail:e}){H();let t=(0,h.useRef)(null),n=(0,h.useRef)(0),r=(0,h.useRef)(null);return(0,U.jsx)(EW,{edge:`right`,title:V(`layout.railResize`),onPointerDown:n=>{t.current={x:n.clientX,width:e.current?.getBoundingClientRect().width??0,moved:!1},n.currentTarget.setPointerCapture(n.pointerId),me(!0)},onPointerMove:e=>{let n=t.current;!n||e.clientX===n.x||(n.moved=!0,vW.set(wW(n.width+e.clientX-n.x)))},onPointerUp:()=>{let e=t.current;if(t.current=null,!e)return;if(e.moved){n.current=0;return}let i=Date.now();r.current!==null&&window.clearTimeout(r.current),r.current=null,i-n.current<DW?(n.current=0,vW.set(null)):(n.current=i,r.current=window.setTimeout(()=>yW.set(!0),DW))},onLostPointerCapture:()=>me(!1)})}function kW({side:e}){return(0,U.jsxs)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,U.jsx)(`rect`,{x:`1.5`,y:`2.5`,width:`13`,height:`11`,rx:`2.5`}),(0,U.jsx)(`path`,{d:e===`left`?`M6 2.5v11`:`M10 2.5v11`})]})}function AW({model:e,hidden:t=!1}){H();let n=b(ZU),r=b(yW),i=b(e.tasks),a=t=>$U(e,t),o=V(r?`layout.railUnfold`:`layout.railFold`),s=r&&(i?.tasks??[]).some(k_);return KU(r,s,XU(n,-1,a)>=0,XU(n,1,a)>=0,t=>nW(e,t<0?-1:1),()=>yW.set(!r)),WU||t?null:(0,U.jsxs)(`div`,{className:fr,onMouseEnter:()=>r&&bW.get()&&CW(!0),onMouseLeave:()=>r&&bW.get()&&CW(!1),children:[(0,U.jsxs)(`button`,{type:`button`,className:dr(),title:o,"aria-label":o,onClick:()=>yW.set(!r),children:[(0,U.jsx)(kW,{side:`left`}),s&&(0,U.jsx)(`span`,{className:`absolute top-0.75 right-0.75 size-1.5 rounded-full bg-accent`})]}),(0,U.jsx)(`button`,{type:`button`,className:dr(),title:V(`layout.navBack`),"aria-label":V(`layout.navBack`),disabled:XU(n,-1,a)<0,onClick:()=>nW(e,-1),children:(0,U.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,U.jsx)(`path`,{d:`M10 3.5 5.5 8l4.5 4.5`})})}),(0,U.jsx)(`button`,{type:`button`,className:dr(),title:V(`layout.navForward`),"aria-label":V(`layout.navForward`),disabled:XU(n,1,a)<0,onClick:()=>nW(e,1),children:(0,U.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,U.jsx)(`path`,{d:`M6 3.5 10.5 8 6 12.5`})})})]})}var jW=(0,U.jsx)(`path`,{d:`M3 3.5h10a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1v-7a1 1 0 0 1 1-1zM4.5 6.5 6.5 8l-2 1.5M8 10h3`}),MW=[`terminal`,`chat`,...LC],NW=e=>V(e===`terminal`?`layout.narrowTerminal`:`panel.${e}`);function PW(e,t,n){n!==`terminal`&&_w(e,n),HC(e,t,n)}function FW({client:e,taskId:t,tabId:n=null,title:r}){H();let i=b(RC),[a,o]=(0,h.useState)(!1);return(0,U.jsxs)(Ml,{back:{label:dA(`narrowBack`),onClick:be},title:r,children:[t&&(0,U.jsx)(zi,{size:`nav`,kind:`view`,label:`${V(`layout.narrowViews`)}: ${NW(i)}`,onClick:()=>o(!0),children:(0,U.jsx)(`svg`,{className:`size-5.5 fill-none stroke-current [stroke-linecap:round] [stroke-linejoin:round] [stroke-width:1.2]`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:i===`terminal`?jW:iW[i]})}),t&&a&&(0,U.jsx)(xu,{title:V(`layout.narrowViews`),value:i,picks:MW.map(e=>({value:e,label:NW(e)})),onPick:e=>PW(t,n,e),onClose:()=>o(!1)}),(0,U.jsx)(TW,{client:e})]})}function IW({title:e}){return H(),(0,U.jsxs)(`button`,{type:`button`,className:Xi({}),onClick:ye,children:[(0,U.jsx)(`span`,{className:`${ea} font-bold text-accent`,children:`↩`}),(0,U.jsx)(`span`,{className:Zi,children:fA(`recentJump`,{title:e})})]})}var LW={duration:180,easing:`cubic-bezier(0.16, 1, 0.3, 1)`};function RW(e,t){let n=(0,h.useRef)(null);(0,h.useLayoutEffect)(()=>{let r=[...document.querySelectorAll(`[data-rail-body] > [data-row]`)],i=new Map(r.map(e=>[e.dataset.row??``,e.offsetTop])),a=n.current;if(n.current={list:e,tops:i},!(!a||a.list===e||a.tops.size===0||t)&&!window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)for(let e of r){let t=a.tops.get(e.dataset.row??``);t===void 0?e.animate([{opacity:0},{opacity:1}],LW):t!==e.offsetTop&&e.animate([{transform:`translateY(${t-e.offsetTop}px)`},{transform:`none`}],LW)}})}var zW=null,BW=()=>(zW||(zW=new Image,zW.src=`data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7`),zW);function VW(e,t,n,r){let[i,a]=(0,h.useState)(null),o=(0,h.useRef)(t);o.current=t;let[s,c]=(0,h.useState)(null),l=(0,h.useRef)(()=>a(null));(0,h.useEffect)(()=>{if(!s)return;let e=()=>{c(null),l.current()};if(t!==s)return e();let n=window.setTimeout(e,3e3);return()=>window.clearTimeout(n)},[t,s]);let u=(0,h.useRef)(null),d=(0,h.useRef)(null);RW(t,i!==null||s!==null);let f=()=>[...u.current?.querySelectorAll(`[data-row]`)??[]];(0,h.useLayoutEffect)(()=>{let e=d.current;if(!e||(d.current=null,window.matchMedia(`(prefers-reduced-motion: reduce)`).matches))return;let t=f().flatMap(t=>{let n=e.get(t.dataset.row??``),r=n===void 0?0:n-t.getBoundingClientRect().top;return r?[{el:t,dy:r}]:[]});for(let{el:e,dy:n}of t)e.style.transition=`none`,e.style.transform=`translateY(${n}px)`;u.current?.getBoundingClientRect();for(let{el:e}of t)e.style.transition=`transform 150ms ease-out`,e.style.transform=``,e.addEventListener(`transitionend`,()=>e.style.removeProperty(`transition`),{once:!0})});let p=(0,h.useRef)(null),m=(0,h.useRef)([]),g=(0,h.useRef)(new Map),_=(0,h.useRef)(0),v=(0,h.useRef)(0),y=e=>{p.current=e,a(e)},b=e=>!n||e.machine!==void 0?null:e.kind===`project`?e.noProject?null:t.find(t=>t.repo===e.repo&&!Mo(t))??null:e.kind===`task`&&e.depth===1?e.task:null,x=e=>{let t=b(e);if(t)return{draggable:!0,onDragStart:n=>{n.dataTransfer.effectAllowed=`move`,n.dataTransfer.setDragImage(BW(),0,0),n.dataTransfer.setData(`text/plain`,t.id),u.current=n.currentTarget.closest(`[data-rail-body]`),w(u.current);let r=m.current,i=r.findIndex(t=>t.id===e.id);_.current=r.slice(i,VU(r,i)).reduce((e,t,n)=>e+(g.current.get(t.id)?.height??0)+(n>0?g.current.get(t.id)?.gap??0:0),0),v.current=n.clientY,y({fromRow:e.id,from:t,toRow:e.id,to:t,side:`above`,project:e.kind===`project`})},onDragEnd:()=>p.current&&y(null)}},S=(e,t,n)=>{let r=t;if(n.project)for(;r>0&&e[r]?.kind!==`project`;)r--;let i=e[r];if(!i||i.kind===`project`!==n.project)return null;let a=b(i);return!a||!n.project&&!zU(n.from,a)?null:{row:i.id,task:a}},C={onDragOver:e=>{let t=p.current;if(!t)return;e.preventDefault();let n=e.clientY-v.current;v.current=e.clientY;let r=e.target.closest(`[data-row]`)?.dataset.row,i=m.current,a=S(i,i.findIndex(e=>e.id===r),t);if(!a||a.row===t.fromRow)return;let o=e.currentTarget.querySelector(`[data-row="${CSS.escape(t.fromRow)}"]`)?.getBoundingClientRect().top;if(o===void 0||e.clientY>=o&&e.clientY<o+_.current)return;let s=e.clientY<o?`above`:`below`;(s===`above`?n>=0:n<=0)||(t.toRow!==a.row||t.side!==s)&&y({...t,toRow:a.row,to:a.task,side:s})},onDrop:n=>{let i=p.current;if(!i)return;n.preventDefault(),p.current=null,r?l.current=()=>a(null):l.current=()=>{d.current=new Map(f().map(e=>[e.dataset.row??``,e.getBoundingClientRect().top])),a(null),wk(`default`),z(K(`tasks`,`sort.label`,{mode:K(`tasks`,`sort.modes.default`)}))};let s=o.current,u=()=>o.current===s?c(s):l.current();if(i.project){if(i.toRow===i.fromRow)return l.current();let t={repo:i.from.repo,target:i.to.repo,side:i.side===`above`?`before`:`after`};e.client.request(`project.move`,t).catch(e=>z(K(`tasks`,`toast.moveFailed`,{error:e instanceof Error?e.message:String(e)}),`error`)).finally(u);return}let m=RU(t,i.from,i.to,i.side);m?kk(e,i.from.id,m).finally(u):l.current()}},w=e=>{let t=[...e?.querySelectorAll(`[data-row]`)??[]];g.current=new Map(t.map((e,n)=>{let r=t[n-1],i=r?e.offsetTop-r.offsetTop-r.offsetHeight:0;return[e.dataset.row??``,{top:e.offsetTop,gap:i,height:e.offsetHeight}]}))},T=(e,t)=>{m.current=t?UU(e,t.fromRow,t.toRow,t.side):e;let n=new Map;if(!t)return n;let r=Math.min(...[...g.current.values()].map(e=>e.top)),i=e=>e.kind===`project`||e.kind===`state`,a=Math.max(0,...e.filter(i).map(e=>g.current.get(e.id)?.gap??0));for(let[e,t]of m.current.entries()){let o=g.current.get(t.id);if(!o)return new Map;e>0&&(r+=i(t)?a:o.gap),r!==o.top&&n.set(t.id,r-o.top),r+=o.height}return n};return{props:x,body:C,places:e=>{let t=[...g.current.keys()],n=i&&e.length===t.length&&e.every((e,n)=>e.id===t[n])?i:null,r=T(e,n),a=n?e.findIndex(e=>e.id===n.fromRow):-1,o=new Set(a<0?[]:e.slice(a,VU(e,a)).map(e=>e.id));return{dragging:n?.fromRow??null,place:e=>{let t=r.get(e.id);return{"data-row":e.id,...o.has(e.id)?{"data-lifted":``}:{},...t?{style:{transform:`translateY(${t}px)`}}:{}}}}}}}var HW=/^rgba?\(([^()]*)\)$/i;function UW(e){return HW.test(e.trim())}var WW=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/;function GW(e){return WW.test(e)}function KW(e,t){let n=e.defs??{},r={};for(let[i,a]of Object.entries(e.engineColors??{})){let e=typeof a==`string`?a:a[t],o=new Set;for(;!GW(e)&&!UW(e)&&Object.hasOwn(n,e)&&!o.has(e);)o.add(e),e=n[e];r[i]=e}return r}var qW=[`shell.frame`,`shell.topBar`,`rail.frame`,`rail.header`,`rail.groupHeader`,`rail.row`,`rail.footer`,`session.header`,`session.body`,`session.footer`,`panel.frame`,`panel.tabs`,`panel.section`,`status.bar`,`package.view`,`phone.topBar`,`phone.listHeader`,`phone.groupHeader`,`phone.row`,`phone.sessionHeader`,`phone.tabs`],JW=/\{\{([a-zA-Z0-9_]+)\}\}/g;function YW(e,t){return e.replace(JW,(e,n)=>{let r=t[n];return r==null||r===!1?``:String(r)})}var XW=`theme.json`;new Set(qW);var ZW=class extends h.Component{state={tripped:!1};static getDerivedStateFromError(e){let t=AR.get();if(t.activePack!==null&&!t.disabledByCrash)return{tripped:!0};throw e}componentDidCatch(e,t){let n=AR.get();n.activePack!==null&&!n.disabledByCrash&&(UR(e,t.componentStack??void 0),this.setState({tripped:!1}))}render(){return this.state.tripped?null:this.props.children}},QW=class extends h.Component{state={crashed:!1};static getDerivedStateFromError(){return{crashed:!0}}componentDidCatch(e,t){HR(this.props.packId,this.props.slot,this.props.file,e,t.componentStack??void 0)}render(){return this.state.crashed?this.props.fallback:this.props.children}};function $W({client:e,onOpenSettings:t}){H();let n=WR();if(n.runtimeErrors.length===0)return null;let r=n.runtimeErrors[n.runtimeErrors.length-1];if(!r)return null;let i=[r.slot,r.file].filter(Boolean).join(` · `);return(0,U.jsxs)(`div`,{className:KR,role:`alert`,"data-theme-package-error-banner":!0,children:[(0,U.jsx)(`span`,{className:qR,children:V(`settings.appearance.themeErrorBadge`)}),(0,U.jsx)(`span`,{className:`font-semibold text-ink`,children:r.packId}),i&&(0,U.jsx)(`span`,{className:`text-muted`,children:i}),(0,U.jsx)(`span`,{className:JR,title:r.message,children:r.message}),(0,U.jsxs)(`div`,{className:YR,children:[(0,U.jsx)(W,{variant:`link`,onClick:t,children:V(`settings.appearance.themeErrorDetails`)}),(0,U.jsx)(W,{variant:`action`,onClick:()=>void VR(e),children:V(`settings.appearance.themeSwitchDefault`)})]})]})}var eG=[`--radius`,`--radius-sm`,`--radius-xs`,`--hairline`,`--tp-pane-gap`,`--tp-shell-pad`];function tG(e,t,n){for(let t of eG)e.style.removeProperty(t);if(delete e.dataset.tpFrame,delete e.dataset.tpDensity,delete e.dataset.tpPack,jR.set(n),!t)return;let r=t.manifest.layout;r&&(r.radius!==void 0&&e.style.setProperty(`--radius`,`${r.radius}px`),r.radiusSm!==void 0&&e.style.setProperty(`--radius-sm`,`${r.radiusSm}px`),r.radiusXs!==void 0&&e.style.setProperty(`--radius-xs`,`${r.radiusXs}px`),r.paneGap!==void 0&&e.style.setProperty(`--tp-pane-gap`,`${r.paneGap}px`),r.shellPadding!==void 0&&e.style.setProperty(`--tp-shell-pad`,`${r.shellPadding}px`),r.borderStyle===`none`?e.style.setProperty(`--hairline`,`0px`):r.borderStyle===`solid`&&e.style.setProperty(`--hairline`,`1px`),r.frame&&(e.dataset.tpFrame=r.frame),r.density&&(e.dataset.tpDensity=r.density)),e.dataset.tpPack=t.id}function nG(e,t,n){if(!e?.engineColors)return;let r=KW(e,n),i=typeof t==`string`?t:t?.id,a=typeof t==`string`?void 0:t?.protocol;return i&&r[i]||a&&r[a]||r.default}var rG=15e3,iG=24,aG=3,oG=e=>e.changes&&!(`unreadable`in e.changes)?e.changes.ahead:void 0,sG=e=>e.repo?e.repo.split(`/`).pop():void 0,cG=e=>e.workspace&&e.workspace!==e.repo?e.workspace.split(`/`).pop():void 0,lG=e=>e&&Date.parse(e)||0;function uG(e,t,n,r,i){let a=e.changes&&!(`unreadable`in e.changes)?e.changes:void 0;return{id:e.id,title:e.label,repo:sG(e),branch:e.branch||void 0,worktree:cG(e),engineId:e.engine?.id??void 0,engineName:e.engine?.name,engineColor:nG(n,e.engine,r),model:e.model,engineFamily:e.engine?.protocol,baseRef:e.baseRef,statusKind:e.rowStatus?.kind??`idle`,since:e.rowStatus?.since??0,ahead:oG(e),diffStats:a?{files:0,added:a.added,removed:a.deleted}:void 0,pr:e.pr?.number?{number:e.pr.number,state:e.pr.lifecycle,url:e.pr.url,checkState:e.pr.checkState}:void 0,parentId:e.parentTaskId,createdAt:lG(e.createdAt)||void 0,selected:e.id===i,onSelect:()=>t.select(e.id)}}function dG(e,t,n,r=0,i=0){let a=n?JSON.stringify(n):null,[,o]=(0,h.useState)(0);return(0,h.useEffect)(()=>{if(!n)return;let r=!0,a=()=>ss(e,t,n).then(()=>r&&o(e=>e+1),()=>{});a();let s=i>0?ua(i,a):void 0;return()=>{r=!1,s?.()}},[e,t,a,r,i]),n?J(e,t,n):void 0}function fG(e,t,n){let r=Date.now();return e.flatMap(e=>e.windows.map(i=>({label:e.name,pct:i.percent,tone:JH({capturedAt:e.capturedAt,windows:[i]},r)?.tone??`ok`,detail:i.label,engineId:e.vendor,engineColor:nG(t,{id:e.vendor,protocol:e.vendor},n),window:i.kind,resetsAt:i.resetsAt??void 0})))}async function pG(e,t){let[n,r]=await Promise.all([(async()=>{let n=wL,r;for(let i=0;i<aG&&r!==null;i++){let i=await e.client.request(`output.read`,{taskId:t,limit:50,...r?{cursor:r,source:`history`}:{}}).catch(()=>null);n=VL(n,i?.history?.messages??[],i?.history?.firstIndex??0),r=i?.olderCursor??null}return n})(),e.client.request(`task.events`,{taskId:t,limit:100}).catch(()=>null)]),i=n.entries.flatMap(e=>e.tools.map(r=>({sessionId:t,kind:n.failed.has(r.callId)?`tool-failed`:`tool`,at:lG(e.at),detail:r.name,summary:r.summary,endedAt:lG(n.ended.get(r.callId))||void 0}))),a=[...n.thoughts.values()].map(e=>({sessionId:t,kind:`thinking`,at:lG(e.at),detail:``,summary:e.text.slice(0,200)})),o=(r?.events??[]).map(e=>({sessionId:t,kind:e.kind,at:e.at,detail:e.detail??``}));return[...i,...a,...o].filter(e=>e.at>0)}function mG(e,t){let[n,r]=(0,h.useState)(new Map),i=(0,h.useRef)(new Map),a=t?[...t].sort((e,t)=>lG(t.updatedAt)-lG(e.updatedAt)).slice(0,iG):null,o=a?.map(e=>`${e.id}@${e.updatedAt}:${e.rowStatus?.since??0}`).join(`,`)??null,s=a?.filter(e=>e.rowStatus?.kind===`running`).map(e=>e.id).join(`,`)??``;return(0,h.useEffect)(()=>{if(!o)return;let t=!0,n=n=>void Promise.all(n.map(async t=>[t,await pG(e,t)])).then(e=>t&&e.length>0&&r(t=>new Map([...t,...e])));n(o.split(`,`).filter(e=>{let[t=``,n=``]=e.split(`@`),r=i.current.get(t)===n;return i.current.set(t,n),!r}).map(e=>e.split(`@`)[0]??``));let a=s?ua(rG,()=>n(s.split(`,`))):void 0;return()=>{t=!1,a?.()}},[e,o,s]),(0,h.useMemo)(()=>o?[...n.values()].flat().sort((e,t)=>e.at-t.at):void 0,[n,o])}function hG(e,t){let n=e?.slots?.[t];return n?.component?n.data??(t===`panel.section`?[`commits`,`sessions`]:[]):[]}function gG(e,t,n,r){let i=e=>t.includes(e),a=b(e.tasks),o=b(e.selection),s=b(e.tabs),c=_s(a,o.taskId)??null,l=c?.id??null,u=(c&&oG(c))??0,d=c?.changes&&!(`unreadable`in c.changes)?c.changes.added+c.changes.deleted:0,f=dG(e,`diff.refs`,i(`commits`)&&l&&u>0?{taskId:l}:null,u),p=dG(e,`diff.files`,i(`files`)&&l?{taskId:l}:null,`${u}:${d}`),m=dG(e,`usage.get`,i(`usage`)?{}:null,0,6e4),g=l?(s[l]??[]).find(e=>e.kind===`engine`)?.id:void 0,_=dG(e,`context.usage`,i(`context`)&&l&&g?{taskId:l,tabId:g,probe:!1}:null,0,rG),v=dG(e,`pr.checks`,i(`checks`)&&l&&c?.pr?.number?{taskId:l}:null,c?.pr?.checkState,6e4),y=eR(e,i(`transcript`)&&l?l:``,i(`transcript`)),x=(0,h.useMemo)(()=>{if(y.state.kind!==`ready`)return;let{entries:e,failed:t,outputs:n,ended:r,thoughts:i}=y.state.transcript,a=new Set(e.map(e=>e.index)),o=[...i].flatMap(([e,t])=>a.has(e)?[]:[{index:e,role:`assistant`,at:t.at,text:``,tools:[]}]);return[...e,...o].sort((e,t)=>e.index-t.index).map(e=>({index:e.index,role:e.role,at:lG(e.at),text:e.text,thinking:i.get(e.index)?.text,tools:e.tools.map(e=>({id:e.callId,name:e.name,summary:e.summary,failed:t.has(e.callId),input:e.input,output:n.get(e.callId),endedAt:lG(r.get(e.callId))||void 0}))}))},[y.state]),S=a?.tasks??[],C=mG(e,i(`activity`)?S:null);return{...i(`sessions`)?{sessions:S.map(t=>uG(t,e,n,r,l))}:{},...i(`commits`)?{commits:f?.commits.slice(0,u)??[]}:{},...i(`files`)?{files:(p?.files??[]).map(e=>({path:e.path,status:e.status,added:e.added??0,removed:e.deleted??0}))}:{},...i(`transcript`)?{transcript:x??[]}:{},...i(`usage`)?{usage:fG(m?.usage??[],n,r)}:{},...i(`context`)?{context:_?.meter??null}:{},...i(`checks`)?{checks:v?.checks??[]}:{},...i(`activity`)?{activity:C??[]}:{},...i(`decisions`)?{decisions:(a?.gates??[]).filter(e=>e.status===`open`).map(t=>({id:t.id,sessionId:t.taskId,question:t.question,options:t.options,recommended:t.recommended,at:lG(t.createdAt),onAnswer:n=>void fl(e,t.id,n)}))}:{}}}var _G=[0,4,8,14],vG=e=>e===`rail.row`||e===`phone.row`,yG=e=>e===`rail.groupHeader`||e===`phone.groupHeader`,bG=(0,h.createContext)({});function xG(e,t){if(vG(e)){let e=t;return{title:e.title,branch:e.branch??``,repo:e.repo??``,engine:e.engineName??e.engineId??``,status:e.statusKind,statusLabel:e.statusLabel,pr:e.pr?`#${e.pr.number} ${e.pr.state}`:``,todos:e.todos?`${e.todos.done}/${e.todos.total}`:``,tokens:e.tokens?.map(e=>e.text).join(` · `)??``,age:e.age??``,cloud:e.cloud??``,pinned:e.pinned?`pinned`:``,diffStats:e.diffStats?`+${e.diffStats.added} -${e.diffStats.removed}`:``,cost:e.cost??``}}if(yG(e)){let e=t;return{label:e.label,repo:e.repo??``,count:e.count,collapsed:e.collapsed,kind:e.kind}}if(e===`rail.footer`){let e=t;return{usageSummary:e.usageSummary,settingsLabel:e.settingsLabel,unreadCount:e.unreadCount}}if(e===`session.header`){let e=t;return{title:e.title,branch:e.branch??``,repo:e.repo??``,engine:e.engineName??e.engineId??``,status:e.statusKind,tabCount:e.tabCount,activeTab:e.activeTab??``}}if(e===`panel.tabs`){let e=t;return{kind:e.kind,title:e.title,hint:e.hint,tabCount:e.tabCount,expanded:e.expanded}}if(e===`panel.section`){let e=t;return{kind:e.kind,title:e.title,branch:e.branch??``,repo:e.repo??``,engine:e.engineName??e.engineId??``,status:e.statusKind,diffStats:e.diffStats?`+${e.diffStats.added} -${e.diffStats.removed}`:``,todos:e.todos?`${e.todos.done}/${e.todos.total}`:``,pr:e.pr?`#${e.pr.number}`:``,cost:e.cost??``}}if(e===`status.bar`){let e=t;return{connection:e.connection,taskTitle:e.taskTitle??``,branch:e.branch??``,engine:e.engineName??``,status:e.statusKind??``,diffStats:e.diffStats?`+${e.diffStats.added} -${e.diffStats.removed}`:``,usageSummary:e.usageSummary}}return t}function SG({node:e,values:t,onAction:n}){if(e.type===`text`){let n=YW(e.text,t);return n?(0,U.jsx)(`span`,{className:UE(e.tone,e.bold===!0),children:n}):null}return e.type===`button`?(0,U.jsx)(W,{variant:`action`,onClick:()=>n?.(e.key),children:YW(e.label,t)}):e.type===`input`?null:(0,U.jsx)(`div`,{className:HE(e.direction===`row`,e.border===!0),style:{flexDirection:e.direction??`column`,gap:_G[e.gap??0],padding:_G[e.padding??0]},children:e.children.map((e,r)=>(0,U.jsx)(SG,{node:e,values:t,onAction:n},r))})}function CG(e,t,n,r,i){let a=xG(e,n);if(t.tree)return(0,U.jsx)(SG,{node:t.tree,values:a,onAction:t=>{vG(e)&&t===`select`&&n.onSelect(),yG(e)&&t===`toggle`&&n.onToggle(),yG(e)&&t===`newTask`&&n.onNewTask?.(),e===`rail.footer`&&t===`settings`&&n.onOpenSettings(),e===`rail.footer`&&t===`inbox`&&n.onOpenInbox(),e===`panel.tabs`&&t===`close`&&n.onClose(),e===`panel.tabs`&&t===`expand`&&n.onToggleExpand?.(),e===`status.bar`&&t===`retry`&&n.onRetry()}});if(vG(e)&&(t.fields||t.secondaryFields||t.surface||t.variant)){let e=n,r=t.fields??[`title`,`pr`,`statusLabel`],o=t.secondaryFields??[],s=e.engineColor?{"--tp-engine-color":e.engineColor}:void 0;return(0,U.jsxs)(W,{variant:`row`,className:`${XR} ${nz(i)} ${rz(t.surface,e.selected)} ${iz(t.variant)}`,style:s,onClick:e.onSelect,"data-tp-slot":`rail.row`,children:[(0,U.jsx)(`span`,{className:ZR,children:r.map(e=>{let t=a[e];return t?e===`title`?(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium`,children:String(t)},e):(0,U.jsx)(`span`,{className:QR,children:String(t)},e):null})}),o.length>0&&(0,U.jsx)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 font-mono text-meta text-muted`,children:o.map(e=>{let t=a[e];return t?(0,U.jsx)(`span`,{className:`truncate`,children:String(t)},e):null})})]})}if(e===`panel.section`&&(t.fields||t.secondaryFields)){let e=[...t.fields??[],...t.secondaryFields??[]].map(e=>[e,a[e]]).filter(([,e])=>!!e);return(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,"data-tp-slot":`panel.section`,children:[e.length>0&&(0,U.jsx)(`div`,{className:`flex flex-wrap items-center gap-2 border-b-hairline border-line bg-inset px-2.5 py-1.5 font-mono text-meta text-muted`,children:e.map(([e,t])=>(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-xs bg-inset px-1.5 py-0.5 font-mono text-meta text-muted`,children:[e,`: `,String(t)]},e))}),r]})}if(e===`panel.tabs`&&(t.fields||t.surface||t.variant)){let e=n,r=t.fields??[`title`];return(0,U.jsxs)(`div`,{className:oz,"data-tp-slot":`panel.tabs`,children:[(0,U.jsx)(`span`,{className:`flex min-w-0 items-center gap-2 truncate`,children:r.map(e=>a[e]?(0,U.jsx)(`span`,{children:String(a[e])},e):null)}),(0,U.jsx)(W,{variant:`action`,onClick:e.onClose,children:`×`})]})}if(e===`status.bar`&&(t.fields||t.secondaryFields)){let e=[...t.fields??[],...t.secondaryFields??[]].map(e=>[e,a[e]]).filter(([,e])=>!!e);return e.length===0?r:(0,U.jsx)(`footer`,{className:az,"data-tp-slot":`status.bar`,children:e.map(([e,t])=>(0,U.jsx)(`span`,{className:`truncate`,children:String(t)},e))})}return r}function wG({slot:e,data:t,fallback:n}){let r=WR(),i=GR(),a=vz(),o=H(),s=b(jR);if(!i)return n;let c=i.manifest.slots?.[e];if(!c)return n;if(c.hidden)return null;let l=r.slotComponents[e],u=`${i.id}:${i.fingerprint}:${e}`;if(l){let r={slot:e,data:t,defaultNode:n,spec:c,tokens:s,mode:a,locale:o},d=t=>e===`session.body`?(0,U.jsx)(xR,{value:n,children:t}):t,f=hG(i.manifest,e);return(0,U.jsx)(QW,{packId:i.id,slot:e,file:c.component,fallback:n,children:d(f.length>0?(0,U.jsx)(TG,{Comp:l,props:r,kinds:f}):(0,U.jsx)(l,{...r,children:n}))},u)}return c.tree||c.fields||c.secondaryFields||c.surface||c.variant?(0,U.jsx)(QW,{packId:i.id,slot:e,file:XW,fallback:n,children:CG(e,c,t,n,i.manifest.layout?.density)},u):n}function TG({Comp:e,props:t,kinds:n}){let r=(0,h.useContext)(bG),i=Object.fromEntries(n.flatMap(e=>e in r?[[e,r[e]]]:[]));return(0,U.jsx)(e,{...t,data:{...t.data,...i},children:t.defaultNode})}function EG({model:e,children:t}){let n=GR(),r=vz(),i=Object.keys(n?.manifest.slots??{}),a=gG(e,[...new Set(i.flatMap(e=>hG(n?.manifest,e)))],n?.manifest,r);return(0,h.useEffect)(()=>(bR.set(e),()=>bR.set(null)),[e]),(0,U.jsx)(bG,{value:a,children:t})}function DG({className:e}){return(0,U.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[(0,U.jsx)(`path`,{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`}),(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`})]})}function OG({model:e,narrow:t,onSettings:n,inbox:r}){H();let i=b(dV),a=Q(`engines.skill.bannerHintWeb`,{engines:i.join(`, `)});if(Rl(`list`,t?{wide:{label:V(`rail.newTask`),note:V(`rail.newTaskMode.${Cv()}`),onClick:()=>Yb()},capsule:(0,U.jsx)(Vi,{settings:{label:i.length>0?`${V(`rail.settings`)}, ${a}`:V(`rail.settings`),onClick:n,glyph:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(DG,{className:aT}),i.length>0&&(0,U.jsx)(`span`,{className:`absolute top-0.75 right-0.75 size-1.5 rounded-full bg-accent`})]})},inbox:{label:V(`rail.inbox`,{count:r.count}),onClick:r.onClick,count:r.count}})}:null),t)return null;let o=(0,U.jsxs)(`div`,{className:rT,children:[!t&&(0,U.jsx)(XH,{client:e.client}),(0,U.jsxs)(`div`,{className:iT,children:[(0,U.jsxs)(`button`,{type:`button`,className:`rail-nav-row ${oT(!1)}`,onClick:n,children:[(0,U.jsx)(DG,{className:cT}),(0,U.jsx)(`span`,{children:V(`rail.settings`)}),i.length>0&&(0,U.jsx)(`span`,{className:`ml-2 min-w-0 truncate text-meta text-subtle`,title:a,children:V(`rail.skillCue`)})]}),(0,U.jsx)(FU,{model:e,bindingId:`settings.open`})]})]});return(0,U.jsx)(wG,{slot:`rail.footer`,data:{unreadCount:r.count,settingsLabel:V(`rail.settings`),usage:[],usageSummary:``,onOpenSettings:n,onOpenInbox:r.onClick},fallback:o})}var kG=y({});function AG(e,t,n){let r=kG.get()[`${e}::${t.id}`];return r&&r.sig===mU(n)&&sU(n.root).some(e=>e.id===r.leaf)?r.leaf:n.activeLeafId}function jG(e,t,n,r){kG.set({...kG.get(),[`${e}::${t}`]:{sig:mU(n),leaf:r}})}function MG(e,t,n,r){jG(e,t.id,n,r),uc(Bc(e,t.id,r))?.focus()}function NG(e){let{taskId:t,tabId:n}=e.selection.get(),r=t?e.tabs.get()[t]?.find(e=>e.id===n):void 0;return t&&r?{taskId:t,tab:r}:null}async function PG(e,t,n){try{let r=await e.client.request(`tab.split`,t);typeof t.taskId==`string`&&await e.refreshTabsNow(t.taskId),n?.(r)}catch(e){z(e instanceof Error?e.message:String(e),`error`)}}function FG(e,t,n,r,i){let a=i??(n.split?AG(t,n,n.split):`leaf-1`),o=e.selection.get();(o.taskId!==t||o.tabId!==n.id)&&e.select(t,n.id);let s=uc(Bc(t,n.id,a))?.size();PG(e,{taskId:t,tabId:n.id,action:`open`,direction:r,leafId:a,...s},e=>{e.changed?e.split&&jG(t,n.id,e.split,e.leaf):z(V(`layout.splitTooSmall`),`error`)})}function IG(e,t,n,r){let i=n.split,a=i?AG(t,n,i):r,o=()=>PG(e,{taskId:t,tabId:n.id,action:`close`,leafId:r},e=>{let i=e.split;if(!i)return;let o=a!==r&&sU(i.root).some(e=>e.id===a);jG(t,n.id,i,o?a:i.activeLeafId)});if(!i||!fU(n,i,r)){o();return}k.set((0,U.jsx)(sa,{title:V(`confirm.closePaneTitle`,{pane:dU(i,Go(n)).get(r)??r}),body:V(`confirm.closePaneBody`),confirmLabel:V(`menu.closePane`),onConfirm:o}))}function LG(e,t,n,r){let i=n.split;i&&k.set((0,U.jsx)(oa,{title:sA(`split.renameTitle`),initial:dU(i,Go(n)).get(r)??``,allowEmpty:!0,submitLabel:V(`dialog.save`),onSubmit:i=>PG(e,{taskId:t,tabId:n.id,action:`rename`,leafId:r,title:i})}))}function RG(e,t,n,r){return[{label:V(`menu.renamePane`),section:`split`,key:Ik(`workspace.split.rename`)??void 0,run:()=>LG(e,t,n,r)},{label:V(`menu.closePane`),section:`split`,key:qs(`workspace.split.close`)||void 0,run:()=>IG(e,t,n,r)}]}function zG(e,t,n,r){return[{label:V(`menu.splitRight`),section:`split`,key:Ik(`workspace.split.right`)??void 0,run:()=>FG(e,t,n,`right`,r)},{label:V(`menu.splitDown`),section:`split`,key:Ik(`workspace.split.down`)??void 0,run:()=>FG(e,t,n,`down`,r)}]}function BG(e,t,n,r){let i=n.split,a=r??(i?AG(t,n,i):`leaf-1`);return[...zG(e,t,n,a),...cU(i)?RG(e,t,n,a):[]]}function VG(e,t){let n=e.tabs.get()[t]??[],r=e.selection.get(),i=(r.taskId===t?n.find(e=>e.id===r.tabId):void 0)??bs(n);return!i||!pU(i)?[]:zG(e,t,i,i.split?AG(t,i,i.split):`leaf-1`)}function HG(e,{task:t,tab:n,leaf:r}){n.split&&MG(t.id,n,n.split,r),e.select(t.id,n.id)}function UG(e){let{row:t}=e;b(kG);let n=e.selectedTabId===t.tab.id&&!!t.tab.split&&AG(t.task.id,t.tab,t.tab.split)===t.leaf;return(0,U.jsxs)(`button`,{type:`button`,className:`${Xi({size:`pane`})} ${e.cursor?lg:``}`,"aria-current":n||void 0,onClick:e.onClick,onContextMenu:e.onMenu,...e.place,children:[(0,U.jsx)(`span`,{className:Vh,"aria-hidden":`true`,children:e.guides?.map((e,t)=>(0,U.jsx)(`span`,{className:Wh(e)},t))}),(0,U.jsx)(`span`,{className:`${Zi} text-(length:--fs-meta) ${n?`text-ink`:`text-muted`}`,children:t.label})]})}function WG({model:e,task:t}){let[n,r]=(0,h.useState)(()=>J(e,`task.get`,{taskId:t.id})?.task??null),[i,a]=(0,h.useState)(null),{busy:o,error:s,submit:c}=aa();(0,h.useEffect)(()=>{ss(e,`task.get`,{taskId:t.id}).then(e=>r(e.task)).catch(e=>a(G(e)))},[e,t.id]);let l=()=>c(async()=>{if(!n?.prompt)return;let t=(await e.client.request(`task.spawn`,{repo:n.repo,prompt:n.prompt,...n.engine?{engine:n.engine}:{},...n.baseRef?{baseBranch:n.baseRef}:{}})).taskIds[0];t&&e.selectWhenListed(t)});return(0,U.jsx)(ia,{title:K(`tasks`,`runAgain.title`),wide:!0,children:(0,U.jsxs)(`form`,{className:hi,onSubmit:e=>{e.preventDefault(),l()},children:[(0,U.jsx)(`p`,{className:`text-muted`,children:K(`tasks`,`runAgain.source`,{title:t.label})}),(0,U.jsx)(`pre`,{className:Ur,children:n?.prompt??i??K(`tasks`,`fieldNotes.loading`)}),(0,U.jsx)(`p`,{className:Hr,children:K(`tasks`,`runAgain.hint`)}),s&&(0,U.jsx)(`p`,{className:`text-error`,children:s}),(0,U.jsx)(la,{busy:o||!n?.prompt,submitLabel:K(`tasks`,`runAgain.confirm`)})]})})}function GG(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`}function KG({model:e,repo:t}){let[n,r]=(0,h.useState)({kind:`loading`}),[i,a]=(0,h.useState)(0),[o,s]=(0,h.useState)(null),[c,l]=(0,h.useState)(null),u=(0,h.useRef)(null),d=()=>e.client.request(`notes.list`,{repo:t}).then(e=>r({kind:`ready`,notes:e.notes})).catch(e=>r({kind:`error`,message:G(e)}));(0,h.useEffect)(()=>void d(),[]);let f=n.kind===`ready`?n.notes:[];(0,h.useEffect)(()=>a(e=>Math.max(0,Math.min(e,f.length-1))),[f.length]),(0,h.useEffect)(()=>{u.current?.querySelector(`.is-selected`)?.scrollIntoView({block:`nearest`})},[i]);let p=async n=>{if(n.id!==void 0){l(null);try{await e.client.request(`notes.delete`,{repo:t,id:n.id}),s(null),await d()}catch(e){l(G(e))}}};return(0,U.jsx)(ia,{title:K(`tasks`,`fieldNotes.title`),wide:!0,children:(0,U.jsxs)(`div`,{className:hi,onKeyDown:e=>{if(!o){if(e.key===`ArrowDown`||e.key===`j`)a(e=>Math.min(f.length-1,e+1));else if(e.key===`ArrowUp`||e.key===`k`)a(e=>Math.max(0,e-1));else if(e.key===`d`&&f[i]?.id!==void 0)s(f[i]??null);else return;e.preventDefault()}},children:[(0,U.jsx)(`p`,{className:`font-mono text-meta break-all text-muted`,children:t}),n.kind===`loading`&&(0,U.jsx)(`p`,{className:`text-muted`,children:K(`tasks`,`fieldNotes.loading`)}),n.kind===`error`&&(0,U.jsx)(`p`,{className:`text-error`,children:n.message}),n.kind===`ready`&&f.length===0&&(0,U.jsx)(`p`,{className:`text-muted`,children:K(`tasks`,`fieldNotes.empty`)}),f.length>0&&(0,U.jsx)(`ul`,{className:`m-0 list-none p-0 flex max-h-[44vh] flex-col gap-2 overflow-y-auto`,ref:u,children:f.map((e,t)=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(`button`,{type:`button`,className:Wr(t===i),onClick:()=>a(t),autoFocus:t===0,children:[(0,U.jsxs)(`span`,{className:`font-mono text-meta whitespace-pre text-accent`,children:[t===i?`▸ `:` `,GG(e.at),`, `,e.author]}),(0,U.jsx)(`span`,{className:`text-ink whitespace-pre-wrap wrap-anywhere`,children:e.text})]})},`${e.at}:${t}`))}),o&&(0,U.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-sm border-hairline border-line bg-paper px-3 py-2.5`,children:[(0,U.jsx)(`p`,{children:(0,U.jsx)(`strong`,{children:K(`tasks`,`fieldNotes.confirmDelete.title`)})}),(0,U.jsx)(`p`,{className:`text-muted`,children:K(`tasks`,`fieldNotes.confirmDelete.body`,{text:o.text})}),c&&(0,U.jsx)(`p`,{className:`text-error`,children:c}),(0,U.jsxs)(`div`,{className:`actions flex items-center justify-end gap-3.5 w-narrow:grid w-narrow:auto-cols-fr w-narrow:grid-flow-col w-narrow:items-stretch w-narrow:gap-2.5 w-narrow:[&>:is(a,button)]:inline-flex w-narrow:[&>:is(a,button)]:min-h-11! w-narrow:[&>:is(a,button)]:items-center w-narrow:[&>:is(a,button)]:justify-center w-narrow:[&>:is(a,button)]:px-3.5 w-narrow:[&>:is(a,button)]:py-1.5 w-narrow:[&>:is(a,button)]:text-center w-narrow:[&>:is(a,button)]:text-body w-narrow:[&>.link]:rounded-sm w-narrow:[&>.link]:border-hairline w-narrow:[&>.link]:border-line w-narrow:[&>.link]:bg-inset w-narrow:[&>.link]:text-ink w-narrow:[&>.link]:no-underline! w-narrow:[&>.link]:active:scale-97 w-narrow:[&>.link]:motion-reduce:active:scale-none`,children:[(0,U.jsx)(`button`,{type:`button`,className:`link text-accent hover:underline touch-hit`,onClick:()=>s(null),children:V(`dialog.cancel`)}),(0,U.jsx)(`button`,{type:`button`,className:Rr({danger:!0}),onClick:()=>void p(o),children:V(`taskops.retire`)})]})]}),!o&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`keys-only font-sans text-meta text-subtle`,children:K(`tasks`,`fieldNotes.footerDeletable`)}),(0,U.jsxs)(`div`,{className:`actions flex items-center justify-end gap-3.5 w-narrow:grid w-narrow:auto-cols-fr w-narrow:grid-flow-col w-narrow:items-stretch w-narrow:gap-2.5 w-narrow:[&>:is(a,button)]:inline-flex w-narrow:[&>:is(a,button)]:min-h-11! w-narrow:[&>:is(a,button)]:items-center w-narrow:[&>:is(a,button)]:justify-center w-narrow:[&>:is(a,button)]:px-3.5 w-narrow:[&>:is(a,button)]:py-1.5 w-narrow:[&>:is(a,button)]:text-center w-narrow:[&>:is(a,button)]:text-body w-narrow:[&>.link]:rounded-sm w-narrow:[&>.link]:border-hairline w-narrow:[&>.link]:border-line w-narrow:[&>.link]:bg-inset w-narrow:[&>.link]:text-ink w-narrow:[&>.link]:no-underline! w-narrow:[&>.link]:active:scale-97 w-narrow:[&>.link]:motion-reduce:active:scale-none`,children:[(0,U.jsx)(`button`,{type:`button`,className:`link text-accent hover:underline touch-hit`,disabled:f[i]?.id===void 0,onClick:()=>s(f[i]??null),children:V(`taskops.retire`)}),(0,U.jsx)(`button`,{type:`button`,className:`link text-accent hover:underline touch-hit`,onClick:B,children:V(`taskops.close`)})]})]})]})})}var qG=[`backlog`,`in_progress`,`in_review`,`done`,`canceled`,`error`],JG={backlog:`status.backlog`,in_progress:`status.inProgress`,in_review:`status.inReview`,done:`status.done`,canceled:`status.canceled`,error:`status.error`},YG=e=>({binding:e,key:Ik(e)??void 0});async function XG(e,t){if(!e){z(V(`menu.nothingToCopy`,{what:t}),`error`);return}try{await navigator.clipboard.writeText(e),z(V(`menu.copied`,{text:e}))}catch{z(V(`menu.copyFailed`),`error`)}}function ZG(e,t,n){let r=[{label:V(`menu.newTask`),section:`open`,run:()=>Yb(t)}],i=(n,i,a)=>{i!==null&&r.push({label:n,section:`edit`,run:()=>void e.client.request(`project.move`,{repo:t,target:i,side:a}).catch(e=>z(K(`tasks`,`toast.moveFailed`,{error:String(e)}),`error`))})};return i(K(`tasks`,`menu.moveToTop`),n.top,`before`),i(K(`tasks`,`menu.moveProjectUp`),n.above,`before`),i(K(`tasks`,`menu.moveProjectDown`),n.below,`after`),r.push({label:V(`menu.viewSessions`),section:`open`,run:()=>Ce(t)}),r.push({label:K(`tasks`,`menu.fieldNotes`),section:`notes`,run:()=>k.set((0,U.jsx)(KG,{model:e,repo:t}))}),n.local&&r.push({label:K(`tasks`,`menu.forgetProject`),section:`danger`,danger:!0,run:()=>k.set(Aj(e,t,n.label))}),r}function QG(e){return[{label:V(`menu.newChatNoFolder`),section:`open`,run:()=>Xb()},{label:V(`menu.newShell`),section:`open`,run:()=>void Py(e).catch(e=>z(String(e),`error`))}]}function $G(){Dk(!Ek.get()),document.querySelector(`.rail`)?.focus()}function eK(e,t,n){let r=Mo(t),i=n.filter(e=>!e.startsWith(`ssh://`)&&(r||e!==t.repo)),a=i.map(e=>{let t=e.slice(e.lastIndexOf(`/`)+1);return{value:e,label:i.filter(e=>e.endsWith(`/${t}`)).length>1?e:t}});return t.kind===`dir`&&!r&&a.unshift({value:``,label:K(`tasks`,`moveToProject.ungrouped`)}),a.length===0?(z(K(`tasks`,`moveToProject.empty`),`error`),null):(0,U.jsx)(ca,{title:K(`tasks`,`moveToProject.title`),choices:a,onPick:async n=>{await e.client.request(`task.moveToProject`,{taskId:t.id,repo:n||null}),z(K(`tasks`,`toast.movedToProject`,{project:a.find(e=>e.value===n)?.label??n}))}})}function tK(e,t){return{left:{label:K(`tasks`,`menu.archive`),tone:`neutral`,run:()=>void kj(e,t)},right:{label:t.pinned?V(`menu.unpin`):V(`menu.pin`),tone:`accent`,run:()=>void e.act(`task.pin`,{taskId:t.id,pinned:!t.pinned}).catch(e=>z(String(e),`error`))}}}function nK(e,t,n){let r=e.client,i=[];n&&(i.push({label:V(`menu.closeTab`),section:`tab`,run:()=>k.set((0,U.jsx)(sa,{title:V(`confirm.closeTabTitle`,{tab:n.title??n.engineName??n.id}),body:V(`confirm.closeTabBody`),confirmLabel:V(`menu.closeTab`),onConfirm:async()=>{await e.closeTab(t.id,n.id)}}))}),i.push(...BG(e,t.id,n))),i.push({label:V(`menu.newChat`),section:`open`,run:()=>void My(e,t.id)}),i.push({label:V(`menu.newChatPick`),section:`open`,rare:!0,run:()=>k.set((0,U.jsx)(wA,{model:e,taskId:t.id}))}),i.push({label:V(`menu.continueEngine`),section:`open`,rare:!0,...YG(`chat.tab.fork`),run:()=>k.set((0,U.jsx)(wA,{model:e,taskId:t.id,context:`continue`,sourceTabId:n?.id}))}),i.push({label:V(`menu.newShell`),section:`open`,run:()=>void Ny(e,t.id,{kind:`shell`}).catch(e=>z(String(e),`error`))}),t.kind===`task`&&t.ownsBranch===!0&&t.branch&&!t.sharesWorkspaceOf&&!t.machine&&!t.extraRepoCount&&i.push({label:K(`tasks`,`menu.newTaskFromBranch`),section:`open`,rare:!0,run:()=>L({repo:t.repo,baseBranch:t.branch,worktree:!0})}),t.startsAt&&(i.push({label:V(`menu.startNow`),section:`open`,run:()=>void e.client.request(`task.startScheduledNow`,{taskId:t.id}).catch(e=>z(String(e),`error`))}),i.push({label:V(`menu.cancelStart`),section:`open`,run:()=>void e.client.request(`task.cancelScheduledStart`,{taskId:t.id}).catch(e=>z(String(e),`error`))})),t.hasPrompt&&(i.push({label:K(`tasks`,`menu.runAgain`),section:`open`,run:()=>k.set((0,U.jsx)(WG,{model:e,task:t}))}),i.push({label:V(`menu.retryEdit`),section:`open`,rare:!0,run:()=>void sy(e,t)}));let a=!t.machine;if(a&&i.push({label:K(`tasks`,`menu.openEditor`),section:`open`,...YG(`tasks.openWorktree`),run:()=>void Ej(e,t.id)}),t.groupId){let e=t.groupId;i.push({label:V(`compare.menu`),section:`open`,run:()=>Se(e)})}i.push({label:V(`menu.rename`),section:`edit`,...YG(`sidebar.rename`),run:()=>k.set((0,U.jsx)(oa,{title:V(`menu.rename`),initial:t.title,submitLabel:V(`dialog.save`),onSubmit:n=>e.act(`task.rename`,{taskId:t.id,title:n}).then(()=>{})}))}),i.push({label:t.pinned?V(`menu.unpin`):V(`menu.pin`),section:`edit`,...YG(`sidebar.pin`),run:()=>void e.act(`task.pin`,{taskId:t.id,pinned:!t.pinned}).catch(e=>z(String(e),`error`))}),a&&!t.archived&&i.push({label:K(`tasks`,`menu.reorder`),section:`edit`,rare:!0,...YG(`sidebar.localMerge`),run:()=>$G()}),i.push({label:V(`menu.setStatus`),section:`edit`,children:qG.map(n=>({label:V(JG[n]),checked:n===t.status,run:()=>void e.act(`task.setStatus`,{taskId:t.id,status:n}).catch(e=>z(String(e),`error`))}))}),a&&!t.routine&&!t.parentTaskId&&!t.extraRepoCount&&i.push({label:K(`tasks`,`menu.moveToProject`),section:`edit`,rare:!0,run:()=>void e.client.request(`repos.list`).then(n=>{let r=eK(e,t,n.repos);r&&k.set(r)}).catch(e=>z(String(e),`error`))}),a&&i.push({label:V(`menu.changeEngine`),section:`edit`,rare:!0,...YG(`tasks.cycleEngine`),run:()=>k.set((0,U.jsx)(XD,{model:e,current:async()=>(await e.client.request(`task.get`,{taskId:t.id})).task,onSet:async n=>{await e.client.request(`task.setEngine`,{taskId:t.id,engine:n.engine.id,...n.effort===void 0?{}:{effort:n.effort},...n.model===void 0?{}:{model:n.model}}),z(K(`tasks`,`toast.engineSwitched`,{engine:n.engine.name}))}}))}),t.pr?.checkState===`failing`&&i.push({label:K(`tasks`,`menu.fixChecks`),section:`git`,key:qs(`files.fixChecks`),run:()=>void Tj(e,t.id,V(`taskops.fixSent`))}),t.kind===`task`&&t.branch&&a&&i.push({label:K(`tasks`,`menu.syncBase`),section:`git`,rare:!0,key:qs(`files.syncBase`),run:()=>void Cj(e,t.id)}),t.branch&&i.push({label:V(`menu.renameBranch`),section:`git`,rare:!0,...YG(`tasks.renameBranch`),run:()=>k.set((0,U.jsx)(oa,{title:V(`menu.renameBranch`),initial:t.branch,submitLabel:V(`dialog.save`),onSubmit:e=>r.request(`task.setBranch`,{taskId:t.id,branch:e}).then(()=>{})}))}),t.kind===`task`&&t.branch&&i.push({label:V(`menu.land`),section:`git`,run:()=>void xj(e,t)});let o=[{label:V(`menu.copyWhat.id`),run:()=>void XG(t.id,V(`menu.what.id`))}];return t.branch&&o.push({label:V(`menu.copyWhat.branch`),run:()=>void XG(t.branch,V(`menu.what.branch`))}),o.push({label:V(`menu.copyWhat.path`),run:()=>void r.request(`task.get`,{taskId:t.id}).then(e=>XG(e.task.worktreePath,V(`menu.what.path`))).catch(e=>z(String(e),`error`))}),i.push({label:V(`menu.copy`),section:`copy`,children:o}),i.push({label:K(`tasks`,t.archived?`menu.unarchive`:`menu.archive`),section:`danger`,run:()=>void kj(e,t)}),i.push({label:V(`menu.removeSession`),section:`danger`,...YG(`sidebar.delete`),danger:!0,run:()=>k.set(Oj(e,t))}),i}var rK=`rove.collapsedProjects`,iK=`rove.foldedTasks`,aK=`rove.openedTasks`,oK=600;function sK(e){try{let t=JSON.parse(localStorage.getItem(e)??`[]`);return new Set(Array.isArray(t)?t.filter(e=>typeof e==`string`):[])}catch{return new Set}}function cK(e,t){try{localStorage.setItem(e,JSON.stringify([...t]))}catch{}}var lK=(e,t)=>{let n=new Set(e);return n.delete(t)||n.add(t),n};function uK(){let e=b(Sk),[t,n]=(0,h.useState)({active:!1,query:``}),[r,i]=(0,h.useState)(()=>sK(rK)),a=e=>i(t=>{let n=lK(t,e);return cK(rK,n),n}),[o,s]=(0,h.useState)(()=>({folded:sK(iK),opened:sK(aK)}));return{sort:e,cycleSort:Tk,search:t,setSearch:n,collapsed:r,toggleProject:a,hand:o,toggleTaskFold:(e,t)=>s(n=>{let r=new Set(n.folded),i=new Set(n.opened);return t?(r.delete(e),i.add(e)):(i.delete(e),r.add(e)),cK(iK,r),cK(aK,i),{folded:r,opened:i}})}}var dK=[`sidebar.nav`,`sidebar.goto`,`sidebar.select`,`sidebar.tree.open`,`sidebar.rename`,`sidebar.pin`,`sidebar.localMerge`,`sidebar.delete`,`sidebar.sort`,`sidebar.search.enter`,`tasks.renameBranch`,`tasks.cycleEngine`,`tasks.openWorktree`,`tasks.update`,`tasks.focusEngine`,`task.new`,`settings.open.sidebar`,`worktrees.open.sidebar`];function fK(e){for(let t of e)for(let e of dK){let n=Ks(e).indexOf(t);if(n>=0)return{id:e,slot:n}}return null}function pK(e,t){let n=e.selection.get().taskId===t;e.select(t),ye(),n&&!qb(e.client)&&Ds()}function mK(e,t,n,r){let{search:i,setSearch:a}=n,[o,s]=(0,h.useState)(null),c=(0,h.useRef)(0),l=t.filter(e=>e.kind!==`project`&&e.kind!==`state`),u=l.findIndex(e=>e.id===o);(0,h.useEffect)(()=>{u<0&&s(r.selectedId&&l.some(e=>e.id===r.selectedId)?r.selectedId:l[0]?.id??null)},[u,l,r.selectedId]);let d=l[u],f=d?.kind===`task`||d?.kind===`pane`?d.task.id:null;(0,h.useEffect)(()=>zj.set(f),[f]);let p=l[0]?.id??null;(0,h.useEffect)(()=>{i.query,i.active&&s(p)},[i.active,i.query,p]);let m=e=>{let t=l[Math.max(0,Math.min(l.length-1,e))];t&&s(t.id)},g=t=>{t?.kind===`task`&&e.select(t.task.id),t?.kind===`round`&&Se(t.groupId),t?.kind===`pane`&&HG(e,t),t&&ye()},_=(t,n)=>{t?.kind===`task`&&D(nK(e,t.task,null),n)?.run?.()},v=async t=>{if(t?.kind===`task`&&t.machine===void 0)try{let{engines:n}=await e.client.request(`engines.list`),r=Lg(n).filter(e=>e.ready!==!1),i=r[(r.findIndex(e=>e.id===t.task.engine?.id)+1)%r.length];if(!i||i.id===t.task.engine?.id)return;await e.client.request(`task.setCommand`,{taskId:t.task.id,engine:i.id}),z(V(`rail.engineSwitched`,{engine:i.name}))}catch(e){z(V(`rail.engineSwitchFailed`,{error:e instanceof Error?e.message:String(e)}),`error`)}};return{cursor:o,setCursor:s,onKeyDown:t=>{let o=l[u],s=t.target instanceof HTMLInputElement;if(i.active){if(t.metaKey||t.ctrlKey||t.altKey)return;if(t.key===`Escape`)a({active:!1,query:``});else if(t.key===`Enter`)g(o),a({active:!1,query:``});else if(t.key===`ArrowDown`)m(u+1);else if(t.key===`ArrowUp`)m(u-1);else if(t.key===`Backspace`&&!s)a(e=>({...e,query:e.query.slice(0,-1)}));else if(t.key.length===1&&!s)a(e=>({...e,query:e.query+t.key}));else return;t.preventDefault();return}let d=fK(Zk(t));if(Ek.get()){let n=o?.kind===`task`&&o.machine===void 0;if(d?.id===`sidebar.nav`)n&&Ok(e,o,d.slot%2==0?1:-1);else if(d?.id===`sidebar.localMerge`||t.key===`Enter`||t.key===`Escape`)Dk(!1);else return;t.preventDefault();return}switch(d?.id){case`sidebar.nav`:m(d.slot%2==0?u+1:u-1);break;case`sidebar.goto`:d.slot%2==1?m(l.length-1):Date.now()-c.current<oK?(m(0),c.current=0):c.current=Date.now();break;case`sidebar.select`:case`sidebar.tree.open`:g(o);break;case`tasks.focusEngine`:Ds();break;case`sidebar.rename`:case`sidebar.pin`:case`sidebar.delete`:case`tasks.renameBranch`:case`tasks.openWorktree`:_(o,d.id);break;case`tasks.cycleEngine`:v(o);break;case`sidebar.localMerge`:o?.machine===void 0&&Dk(!0);break;case`sidebar.sort`:n.cycleSort(),z(K(`tasks`,`sort.label`,{mode:K(`tasks`,`sort.modes.${Sk.get()}`)}));break;case`sidebar.search.enter`:a({active:!0,query:``});break;case`task.new`:r.onNewTask(o?.kind===`task`||o?.kind===`pane`?o.task.repo:void 0,o?.machine);break;case`settings.open.sidebar`:r.onSettings();break;case`worktrees.open.sidebar`:xe(`worktrees`);break;case`tasks.update`:xe(`update`);break;default:return}t.preventDefault()},onPress:e=>{let t=e.target.closest(`[data-row]`)?.dataset.row;t&&s(t)}}}var hK=(e,t,n)=>`~pane:${e}:${t}:${n}`;function gK(e,t){return e.flatMap(e=>e.kind===`task`?[e,...(t[e.task.id]??[]).flatMap(t=>{let n=t.split;if(!n||!cU(n))return[];let r=dU(n,Go(t));return sU(n.root).map(n=>({id:hK(e.task.id,t.id,n.id),kind:`pane`,task:e.task,tab:t,leaf:n.id,label:r.get(n.id)??n.id,depth:e.depth+1,...e.machine===void 0?{}:{machine:e.machine}}))})]:[e])}function _K(e){return e?.match(/^https?:\/\/[^/]+\/([^/]+\/[^/]+)\/(?:pull|merge_requests|-\/merge_requests)\//)?.[1]}var vK=e=>e.charAt(0).toUpperCase()+e.slice(1);function yK(e){return[V(`rail.pr.state.${e.state}`),...e.checks?[V(`rail.pr.checks.${e.checks}`)]:[]].join(`, `)}function bK(e){let t=new Map;for(let n of e){let e=N_(n),r=[...e&&n.pr?[{pr:n.pr,mark:e}]:[],...(n.sessionPrs??[]).flatMap(e=>{let t=P_(e);return t?[{pr:e,mark:t}]:[]})];for(let{pr:e,mark:i}of r){let r=e.url??(e.number===void 0?n.id:`${n.repo}#${e.number}`),a=t.get(r),o=e.lifecycle===`unknown`,s=a?.pr.lifecycle===`unknown`;(!a||s&&!o||o===s&&F_([a.mark,i])!==a.mark)&&t.set(r,{task:n,pr:e,mark:i})}}return[...t.values()]}var xK={open:0,merged:1,closed:2},SK=e=>[...e].sort((e,t)=>xK[e.mark.state]-xK[t.mark.state]),CK=(e,t)=>t.url??`${e.id}#${t.number??``}`;function wK({task:e,pr:t,mark:n}){let r=_K(t.url),i=t.additions!==void 0&&t.deletions!==void 0;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:Zh,children:t.title||e.label}),(0,U.jsxs)(`span`,{className:Qh,children:[(0,U.jsxs)(`span`,{className:`${$h} ${n.tone}`,children:[(0,U.jsx)(`span`,{className:eg,children:n.glyph}),vK(V(`rail.pr.state.${n.state}`))]}),(0,U.jsx)(`span`,{className:tg,children:[...n.checks?[V(`rail.pr.checks.${n.checks}`)]:[],[r,t.number===void 0?``:`#${t.number}`].filter(Boolean).join(` `)].filter(Boolean).map(e=>`, ${e}`).join(``)}),i&&(0,U.jsxs)(`span`,{className:`ml-auto flex gap-1.5 pl-3 tabular-nums`,children:[(0,U.jsxs)(`span`,{className:`text-success`,children:[`+`,t.additions]}),(0,U.jsxs)(`span`,{className:`text-error`,children:[`−`,t.deletions]})]})]})]})}var TK=(e,t)=>e.length===1?`PR #${e[0]?.pr.number??``}, ${yK(t)}`:V(`rail.pr.many`,{count:e.length});function EK({entries:e,lead:t}){let[n,r]=(0,h.useState)(!1);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:Jh,"data-pr-chip":!0,"aria-label":TK(e,t),onClick:e=>{e.stopPropagation(),kl(),r(!0)},children:(0,U.jsxs)(`span`,{className:`${Yh} ${t.tone}`,children:[t.glyph,e.length>1&&(0,U.jsx)(`span`,{className:`font-sans`,children:e.length})]})}),n&&(0,U.jsx)(`span`,{className:`contents`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),onContextMenu:e=>e.stopPropagation(),children:(0,U.jsx)(vu,{label:TK(e,t),title:e.length>1?TK(e,t):void 0,onClose:()=>r(!1),children:t=>(0,U.jsx)(`div`,{className:`flex min-h-0 flex-col overflow-y-auto px-3 pb-1 max-h-[60dvh] overscroll-contain`,"data-pr-sheet":!0,children:SK(e).map(e=>(0,U.jsx)(yu,{stacked:!0,disabled:!e.pr.url,onClick:()=>{t(),window.open(e.pr.url,`_blank`,`noopener`)},children:(0,U.jsx)(wK,{...e})},CK(e.task,e.pr)))})})})]})}function DK({tasks:e,onOpen:t,sheet:n}){if(n){let t=bK(e),n=F_(t.map(e=>e.mark));return n?(0,U.jsx)(EK,{entries:t,lead:n}):null}return(0,U.jsx)(OK,{tasks:e,onOpen:t})}function OK({tasks:e,onOpen:t}){let[n,r]=(0,h.useState)(null),[i,a]=(0,h.useState)(!1),o=(0,h.useRef)(null),s=(0,h.useRef)(null),c=(0,h.useRef)(null),l=ff();(0,h.useLayoutEffect)(()=>{let e=c.current;if(!e||!n)return;let t=e.getBoundingClientRect();t.right>window.innerWidth-8&&(e.style.left=`${Math.max(8,window.innerWidth-t.width-8)}px`,e.style.top=`${n.bottom+6}px`);let r=e.getBoundingClientRect().bottom-(window.innerHeight-8);r>0&&(e.style.top=`${Math.max(8,e.getBoundingClientRect().top-r)}px`)},[n]);let u=()=>{t?.(),s.current!==null&&window.clearTimeout(s.current),s.current=null,a(!1),o.current&&!n&&r(o.current.getBoundingClientRect())},d=()=>{a(!0),s.current=window.setTimeout(()=>r(null),140)};(0,h.useEffect)(()=>{if(!l||!n)return;let e=e=>{let t=e.target;o.current?.contains(t)||c.current?.contains(t)||(a(!0),s.current=window.setTimeout(()=>r(null),140))};return document.addEventListener(`pointerdown`,e,!0),()=>document.removeEventListener(`pointerdown`,e,!0)},[l,n]),(0,h.useEffect)(()=>()=>{s.current!==null&&window.clearTimeout(s.current)},[]);let f=bK(e),p=F_(f.map(e=>e.mark));if(!p)return null;let m=TK(f,p);return(0,U.jsxs)(`span`,{ref:o,className:`chip ${qh} ${p.tone}`,"aria-label":m,onMouseEnter:l?void 0:u,onMouseLeave:l?void 0:d,onClick:e=>{l&&(e.stopPropagation(),n&&!i?d():u())},children:[p.glyph,f.length>1&&(0,U.jsx)(`span`,{className:`font-sans`,children:f.length}),n&&(0,au.createPortal)((0,U.jsx)(`div`,{ref:c,className:Xh(i),style:{top:n.top-6,left:n.right+8},onMouseEnter:l?void 0:u,onMouseLeave:l?void 0:d,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onContextMenu:e=>e.stopPropagation(),children:f.map(({task:e,pr:t,mark:n})=>(0,U.jsx)(`button`,{type:`button`,className:`flex flex-col gap-1 rounded-[calc(var(--radius)-6px)] px-3 py-2 text-left font-sans enabled:hover:bg-hover`,disabled:!t?.url,onClick:()=>t?.url&&window.open(t.url,`_blank`,`noopener`),children:(0,U.jsx)(wK,{task:e,pr:t,mark:n})},CK(e,t)))}),document.body)]})}var kK=450,AK=e=>{let t=e.querySelector(`.row-title`);return!!t&&t.scrollWidth>t.clientWidth};function jK(e,t){let n=(0,h.useRef)(null),r=(0,h.useRef)(null),i=(0,h.useRef)(e);i.current=e;let a=()=>{n.current!==null&&window.clearTimeout(n.current),n.current=null},o=e=>{a(),n.current=window.setTimeout(()=>Fh(e,i.current,`right`),kK)},s=()=>{a(),Ih()};return(0,h.useEffect)(()=>{let e=r.current,n=e?.closest(`.rail`);if(!t||!e||!n||!Mh()||!n.contains(document.activeElement)||!AK(e))return;let i=e=>{e.relatedTarget instanceof Node&&n.contains(e.relatedTarget)||s()};return o(e),n.addEventListener(`focusout`,i),()=>{n.removeEventListener(`focusout`,i),s()}},[t]),(0,h.useEffect)(()=>()=>{n.current!==null&&window.clearTimeout(n.current)},[]),{ref:e=>{r.current=e},onPointerEnter:e=>{e.pointerType===`touch`||!AK(e.currentTarget)||o(e.currentTarget)},onPointerLeave:s,hide:s}}var MK={info:`text-info`,success:`text-success`,warning:`text-warning`,error:`text-error`};function NK(e){return e.tokens?.map(e=>(0,U.jsx)(`span`,{className:`max-w-32 truncate ${MK[e.tone??``]??`text-subtle`}`,title:e.source,children:e.text},`${e.source}:${e.text}`))}function PK({at:e}){let t=new Date(e);if(Number.isNaN(t.getTime()))return null;let n=Rv(t);return(0,U.jsxs)(`span`,{className:`text-subtle`,title:V(`rail.startsAt`,{time:t.toLocaleString()}),children:[`◷ `,n]})}function FK(e){let{repo:t,label:n,collapsed:r}=e,i=V(r?`rail.expandGroup`:`rail.collapseGroup`,{name:n});return(0,U.jsxs)(U.Fragment,{children:[t&&(0,U.jsx)(`button`,{type:`button`,className:pg,title:t,onClick:()=>Ce(t),children:(0,U.jsx)(`span`,{className:`truncate`,children:n})}),(0,U.jsxs)(`button`,{type:`button`,className:`${mg} ${t?`min-w-6 shrink-0 justify-center`:`-ml-1`}`,"aria-label":t?i:void 0,"aria-expanded":!r,title:i,onClick:e.onToggle,children:[!t&&(0,U.jsx)(`span`,{className:`truncate`,children:n}),(0,U.jsx)(Bv,{right:r,className:hg(r)})]}),e.onNewTask&&(0,U.jsx)(`button`,{type:`button`,className:gg,title:V(`rail.newTask`),onClick:e.onNewTask,children:`+`})]})}function IK(e){let{row:t}=e,n=GR(),r=vz(),i=jK(t.kind===`task`?t.task.label:``,e.cursor&&t.kind===`task`),a=e.cursor?lg:``;if(t.kind===`project`||t.kind===`state`){let n=(0,U.jsx)(`h2`,{className:ug({moving:e.moving,dragging:e.dragging,grab:e.drag!==void 0}),onContextMenu:e.onMenu,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&e.stopPropagation()},...e.place,...e.drag,children:(0,U.jsx)(FK,{label:t.label,repo:t.kind===`project`&&!t.noProject?t.repo:void 0,collapsed:!!e.collapsed,onToggle:e.onClick,onNewTask:e.onNewTask})});return(0,U.jsx)(wG,{slot:`rail.groupHeader`,data:LK(e),fallback:n})}let o=t.task,s=o.rowStatus?.kind===`running`,c=mj(o),l=Vw(),u=O_(o,e.tabs),d=l===`engine`&&!u,f=t.fold?.collapsed?e.rollup:o.rowStatus,p=(0,U.jsxs)(`button`,{type:`button`,ref:i.ref,className:`group/row ${Xi({selected:e.selected,moving:e.moving,lifted:e.dragging,grab:e.drag!==void 0})} ${a}`,onClick:e.onClick,onContextMenu:e.onMenu,onPointerEnter:i.onPointerEnter,onPointerLeave:i.onPointerLeave,...e.place,...e.drag,children:[e.guides&&(0,U.jsx)(`span`,{className:`-mr-0.5 ml-0 flex flex-none self-stretch`,"aria-hidden":`true`,children:e.guides.map((e,t)=>(0,U.jsx)(`span`,{className:Wh(e)},t))}),l!==`dots`&&(0,U.jsx)(Ev,{icon:e.engineIcon,name:o.engine?.name,status:d?D_(f):void 0,blank:u}),(0,U.jsx)(`span`,{className:`${Qi} ${e.stale?`text-subtle`:``} ${s?$i:``}`,children:t.attempt??o.label}),(0,U.jsxs)(`span`,{className:`${na} ml-auto items-center`,children:[(0,U.jsx)(NK,{tokens:o.rowTokens}),e.repo&&(0,U.jsx)(`span`,{className:`max-w-24 truncate text-subtle`,children:e.repo}),t.level!==void 0&&(0,U.jsx)(`span`,{className:`text-subtle`,children:t.level}),(o.extraRepoCount??0)>0&&(0,U.jsxs)(`span`,{className:`text-subtle`,title:V(o.extraRepoCount===1?`rail.extraReposOne`:`rail.extraRepos`,{count:o.extraRepoCount??0}),children:[`+`,o.extraRepoCount]}),c&&(0,U.jsxs)(`span`,{className:`text-subtle tabular-nums`,title:V(c.total===1?`rail.todosOne`:`rail.todos`,c),children:[c.done,`/`,c.total]}),t.fold&&(0,U.jsx)(zK,{fold:t.fold,onToggle:e.onToggleFold}),o.kept&&(0,U.jsx)(`span`,{className:`text-accent`,title:V(`compare.kept`),children:`✓`}),o.pinned&&(0,U.jsx)(`span`,{className:`text-subtle`,children:`▴`}),o.startsAt&&(0,U.jsx)(PK,{at:o.startsAt}),(0,U.jsx)(DK,{tasks:e.prTasks??[o],onOpen:i.hide}),e.cloud&&(0,U.jsx)(xg,{label:e.cloud,onOpen:i.hide}),!d&&(0,U.jsx)(U_,{status:f})]})]}),m=e.swipe?(0,U.jsx)(Du,{left:e.swipe.left,right:e.swipe.right,ground:`paper`,children:p}):p;return(0,U.jsx)(wG,{slot:`rail.row`,data:RK(e,n?.manifest,r),fallback:m})}function LK(e){let t=e.row;return{id:t.id,kind:t.kind,label:t.label,repo:t.kind===`project`&&!t.noProject?t.repo:void 0,count:e.count??0,collapsed:!!e.collapsed,onToggle:()=>e.onClick(),onNewTask:e.onNewTask}}function RK(e,t,n){let r=e.row,i=r.task,a=r.fold?.collapsed?e.rollup:i.rowStatus,o=i.changes&&!(`unreadable`in i.changes)?{files:0,added:i.changes.added,removed:i.changes.deleted}:void 0,s=i.activity?.forMs,c=s===void 0?void 0:s<6e4?`${Math.max(1,Math.round(s/1e3))}s`:s<36e5?`${Math.round(s/6e4)}m`:`${Math.round(s/36e5)}h`;return{id:i.id,title:r.attempt??i.label,branch:i.branch||void 0,repo:e.repo??(i.repo?i.repo.split(`/`).pop():void 0),worktree:cG(i),engineId:i.engine?.id??void 0,engineName:i.engine?.name,model:i.model,engineFamily:i.engine?.protocol,engineColor:nG(t,i.engine,n),statusKind:a?.kind??`idle`,statusLabel:a?.kind??`idle`,selected:e.selected,cursor:e.cursor,stale:e.stale,pinned:!!i.pinned,depth:r.depth,pr:i.pr?.number?{number:i.pr.number,state:i.pr.lifecycle,url:i.pr.url}:void 0,todos:mj(i)??void 0,tokens:i.rowTokens?.map(e=>({key:e.source,text:e.text})),age:c,cloud:e.cloud,diffStats:o,onSelect:()=>e.onClick(),onMenu:t=>e.onMenu(t)}}function zK(e){let{collapsed:t}=e.fold,n=K(`tasks`,t?`menu.expandChildren`:`menu.collapseChildren`);return(0,U.jsxs)(`span`,{role:`button`,tabIndex:-1,"aria-label":n,"aria-expanded":!t,className:`${Gh} ${t?``:Kh}`,title:n,onClick:t=>{t.stopPropagation(),e.onToggle()},children:[t&&e.fold.count,(0,U.jsx)(Bv,{right:t})]})}var BK=1500,VK=8e3;function HK(e,t){let n=b(e.conn).state!==`open`,[r,i]=(0,h.useState)(!1);return(0,h.useEffect)(()=>{if(i(!1),!n)return;let e=window.setTimeout(()=>i(!0),t);return()=>window.clearTimeout(e)},[n,t]),n&&r}function UK({model:e,narrow:t}){let n=e.client,r=b(n.conn),i=b(e.tasks),a=b(e.selection),o=GR(),s=_s(i,a.taskId),c=HK(n,t?VK:r.state===`connecting`?BK:0),l=o?.manifest.layout?.statusBar??`auto`,u=!!o?.manifest.slots?.[`status.bar`];if(l===`hidden`&&!c||!c&&l!==`always`&&!u)return null;let d=s?.changes&&!(`unreadable`in s.changes)?{files:0,added:s.changes.added,removed:s.changes.deleted}:void 0,f=c?(0,U.jsxs)(`footer`,{className:Qn,children:[(0,U.jsx)(`span`,{className:$n(r.state===`retrying`)}),(0,U.jsx)(`span`,{children:r.state===`retrying`?V(`status.retrying`,{count:r.failures}):V(`status.connecting`)}),r.state===`retrying`&&(0,U.jsx)(`button`,{type:`button`,className:`link text-accent hover:underline touch-hit`,onClick:()=>n.retryNow(),children:V(`status.retry`)})]}):(0,U.jsxs)(`footer`,{className:az,children:[(0,U.jsx)(`span`,{children:r.state}),s?.label&&(0,U.jsx)(`span`,{className:`truncate text-ink`,children:s.label}),s?.branch&&(0,U.jsx)(`span`,{className:`truncate`,children:s.branch}),s?.engine?.name&&(0,U.jsx)(`span`,{children:s.engine.name})]});return(0,U.jsx)(wG,{slot:`status.bar`,data:{connection:r.state===`open`?`open`:r.state===`retrying`?`retrying`:`connecting`,failures:r.failures,taskTitle:s?.label,branch:s?.branch,engineName:s?.engine?.name,statusKind:s?.rowStatus?.kind,diffStats:d,usageSummary:``,onRetry:()=>n.retryNow()},fallback:f})}function WK(e){let{row:t}=e,n=b(_e),r=GR(),i=vz();if(t.kind===`project`||t.kind===`state`){let n=(0,U.jsx)(`h2`,{className:`${ug({moving:e.moving,dragging:!1,grab:!1})} narrow:mb-0`,onContextMenu:e.onMenu,...e.place,children:(0,U.jsx)(nk,{label:t.label,collapsed:!!e.collapsed,foldLabel:V(e.collapsed?`rail.expandGroup`:`rail.collapseGroup`,{name:t.label}),onToggle:e.onClick,add:e.onNewTask?{label:V(`rail.newTask`),onClick:e.onNewTask}:void 0})});return(0,U.jsx)(wG,{slot:`phone.groupHeader`,data:LK(e),fallback:n})}let a=t.task,o=ME(a),s=t.fold?.collapsed?e.rollup:a.rowStatus,c=(0,U.jsx)(ek,{lead:e.guides&&(0,U.jsx)(`span`,{className:`-mr-0.5 ml-0 flex flex-none self-stretch`,"aria-hidden":`true`,children:e.guides.map((e,t)=>(0,U.jsx)(`span`,{className:Wh(e)},t))}),mark:(0,U.jsx)(Ev,{icon:e.engineIcon,name:a.engine?.name,blank:O_(a,e.tabs)}),title:t.attempt??a.label,dim:e.stale,flash:e.selected?n:0,line2:(0,U.jsxs)(U.Fragment,{children:[e.repo&&(0,U.jsx)(`span`,{className:`max-w-24 flex-none truncate text-subtle`,children:e.repo}),o.branch&&(0,U.jsx)(`span`,{className:`min-w-0 truncate`,children:o.branch}),o.behind&&(0,U.jsx)(`span`,{className:`flex-none tabular-nums`,children:o.behind}),t.fold?.collapsed&&(0,U.jsxs)(`span`,{className:`flex-none text-subtle`,children:[`+`,t.fold.count]}),a.pinned&&(0,U.jsx)(`span`,{className:`flex-none text-subtle`,children:`▴`}),e.cloud&&(0,U.jsx)(xg,{label:e.cloud})]}),trail:(0,U.jsx)(DK,{tasks:e.prTasks??[a],sheet:!0}),status:(0,U.jsx)(U_,{status:s}),onClick:e.onClick,onContextMenu:e.onMenu,...e.place}),l=(0,U.jsx)(wG,{slot:`phone.row`,data:RK(e,r?.manifest,i),fallback:c});return e.swipe?(0,U.jsx)(Du,{left:e.swipe.left,right:e.swipe.right,ground:`paper`,children:l}):l}function GK({model:e}){H();let t=b(e.client.conn);return HK(e.client,8e3)?(0,U.jsx)(`div`,{className:`relative z-1 h-0`,children:(0,U.jsx)(`p`,{className:`absolute inset-x-0 top-0 m-0 truncate bg-paper px-4 pb-2 font-sans text-meta text-muted`,"data-rail-note":!0,children:V(t.state===`retrying`?`rail.reconnecting`:`status.connecting`)})}):null}var KK=3e4;function qK({model:e}){let{nav:t}=gS(),n=e.client,[r]=wS(KK),[i,a]=(0,h.useState)(()=>J(n,`routine.list`)??null);(0,h.useEffect)(()=>{let e=!0,t=n.onOpen(()=>ss(n,`routine.list`).then(t=>e&&a(t)).catch(()=>{}));return()=>{e=!1,t()}},[n,r]);let o=(i?.automations??[]).filter(e=>qO(i,e.id)).length;return(0,U.jsx)(ik,{label:t.automations,count:o,onClick:()=>xe(`routines`)})}function JK({model:e}){let{nav:t}=gS(),[n,r]=(0,h.useState)(!1),i=b(FE),a=[...NE(b(e.installedMods),b(e.mods),t)].sort((e,t)=>Number(t.id===i)-Number(e.id===i)),o=V(`rail.extensions`);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(ak,{label:o,onClick:()=>r(!0)}),n&&(0,U.jsx)(vu,{label:o,title:o,onClose:()=>r(!1),children:t=>(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-y-auto px-3 pb-1`,children:[a.map(e=>(0,U.jsxs)(yu,{"data-ext-row":e.id,onClick:()=>{t(),LE(e),xe(e.page)},children:[(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.title}),(0,U.jsx)(`span`,{className:`flex-none font-mono text-meta text-subtle`,children:e.id===i?V(`rail.lastOpened`):e.note})]},e.id)),a.length>0&&(0,U.jsx)(`hr`,{className:`mx-2 my-1 h-px flex-none border-none bg-line`}),(0,U.jsxs)(yu,{"data-ext-row":`add`,onClick:()=>{t(),k.set((0,U.jsx)(oU,{model:e,section:`plugins`}))},children:[(0,U.jsx)(`span`,{className:`w-4 flex-none text-center text-accent`,children:`+`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:V(`rail.addExtension`)})]})]})})]})}function YK(){return Reflect.get(globalThis,`webkit`)?.messageHandlers?.shell}function XK({model:e}){H();let t=b(e.client.conn).hello?.host,n=YK();return(0,h.useEffect)(()=>{t&&n?.postMessage(`host:${t}`)},[t,n]),n?(0,U.jsx)(ok,{name:t??V(`rail.computer`),label:V(`rail.switchComputer`),onClick:()=>n.postMessage(`computers`)}):null}var ZK=y({ids:new Set,anchor:null});function QK(){ZK.get().ids.size>0&&ZK.set({ids:new Set,anchor:ZK.get().anchor})}function $K(e,t,n,r){let{ids:i,anchor:a}=ZK.get();if(e.shiftKey){let e=n.flatMap(e=>e.kind===`task`?[e.id]:[]),i=e.indexOf(a??r??t),o=e.indexOf(t),[s,c]=i<0?[o,o]:[Math.min(i,o),Math.max(i,o)];return ZK.set({ids:new Set(e.slice(s,c+1)),anchor:a??r}),!0}if(e.metaKey||e.ctrlKey){let e=new Set(i);return e.size===0&&r&&n.some(e=>e.kind===`task`&&e.id===r)&&e.add(r),e.has(t)?e.delete(t):e.add(t),ZK.set({ids:e,anchor:t}),!0}return ZK.set({ids:new Set,anchor:t}),!1}function eq(e){return e.key!==`Escape`||ZK.get().ids.size===0?!1:(QK(),e.preventDefault(),!0)}function tq(e,t,n){let{ids:r}=ZK.get(),i=n.flatMap(e=>e.kind===`task`&&r.has(e.id)?[e.task]:[]);return r.has(t)&&i.length>1?nq(e,i):(QK(),null)}function nq(e,t){let n=t.length;return[{label:V(`menu.archiveMany`,{count:n}),section:`danger`,run:()=>void oq(e,t)},{label:V(`menu.removeMany`,{count:n}),section:`danger`,danger:!0,run:()=>k.set((0,U.jsx)(sa,{title:V(`menu.removeManyTitle`,{count:n}),body:V(`menu.removeManyBody`),confirmLabel:K(`tasks`,`confirm.deleteConfirm`),onConfirm:async()=>void sq(e,t)}))}]}function rq(e){let t=new Set(e.map(e=>e.id)),n=new Map(e.map(e=>[e.id,e.parentTaskId]));return e.filter(e=>{for(let r=e.parentTaskId;r;r=n.get(r))if(t.has(r))return!1;return!0})}function iq(e,t,n,r){let i=new Map;return Promise.allSettled(t.map(t=>{let a={taskId:t.id,...r(t)},o=t.machine?.id??``,s=(i.get(o)??Promise.resolve()).then(()=>e.client.request(n,a));i.set(o,s.catch(()=>{}));let c=ts(n,a);return c?e.optimistic(c,()=>s):s}))}async function aq(e,t,n,r,i,a,o){QK();let s=await iq(e,t,n,r),c=t.filter((e,t)=>{let n=s[t];return n?.status===`rejected`&&n.reason instanceof Pc&&n.reason.code===i}),l=t.flatMap((e,t)=>{let n=s[t];return n?.status===`rejected`&&!c.includes(e)?[`${e.label}: ${G(n.reason)}`]:[]}),u=s.filter(e=>e.status===`fulfilled`).length;u>0&&o(u),l.length>0&&z(l.join(`
103
103
  `),`error`),c.length!==0&&k.set((0,U.jsx)(sa,{title:a.title,body:`${a.body}\n\n${c.map(e=>e.label).join(`
104
- `)}`,confirmLabel:a.confirm,onConfirm:async()=>{let t=await tq(e,c,n,e=>({...r(e),force:!0})),i=t.filter(e=>e.status===`fulfilled`).length;i>0&&o(i);let a=c.flatMap((e,n)=>{let r=t[n];return r?.status===`rejected`?[`${e.label}: ${G(r.reason)}`]:[]});a.length>0&&z(a.join(`
105
- `),`error`)}}))}function rq(e,t){return nq(e,eq(t),`task.archive`,()=>({archived:!0}),`TASK_BUSY`,{title:K(`tasks`,`archive.busyTitle`),body:V(`menu.archiveManyBusy`),confirm:K(`tasks`,`archive.busyConfirm`)},e=>z(V(`menu.archivedMany`,{count:e})))}function iq(e,t){return nq(e,t,`task.delete`,()=>({}),`DIRTY_WORKTREE`,{title:V(`menu.removeManyDirtyTitle`),body:V(`menu.removeManyDirtyBody`),confirm:K(`tasks`,`confirm.forceDeleteConfirm`)},e=>z(V(`menu.removedMany`,{count:e})))}function aq(e){let{row:t}=e;return(0,U.jsxs)(`button`,{type:`button`,className:`${Xi({size:`pane`})} ${e.cursor?lg:``}`,title:V(`compare.menu`),onClick:()=>{e.onClick(),Se(t.groupId)},...e.place,children:[e.guides&&(0,U.jsx)(`span`,{className:`-mr-0.5 ml-0 flex flex-none self-stretch`,"aria-hidden":`true`,children:e.guides.map((e,t)=>(0,U.jsx)(`span`,{className:Wh(e)},t))}),(0,U.jsx)(`span`,{className:`${Zi} text-(length:--fs-meta) text-muted`,children:t.title}),(0,U.jsxs)(`span`,{className:`${na} ml-auto items-center`,children:[e.repo&&(0,U.jsx)(`span`,{className:`max-w-24 truncate text-subtle`,children:e.repo}),(0,U.jsx)(`span`,{className:`text-subtle`,children:t.tasks.length}),(0,U.jsx)(U_,{status:j_(t.tasks)})]})]})}function oq(e){let t=(0,h.useRef)(null);return(0,h.useEffect)(()=>{let e=t.current;return()=>{e&&document.activeElement===e&&e.closest(`nav`)?.focus()}},[]),(0,U.jsxs)(`div`,{className:`${og} mono items-center`,children:[(0,U.jsx)(`span`,{className:`text-accent`,children:`/`}),(0,U.jsx)(`input`,{ref:t,className:sg,type:`text`,autoFocus:!0,spellCheck:!1,autoComplete:`off`,autoCapitalize:`off`,enterKeyHint:`go`,value:e.query,placeholder:V(`rail.searchPlaceholder`),"aria-label":V(`rail.searchPlaceholder`),onChange:t=>e.onChange(t.target.value)}),e.query&&(0,U.jsx)(`span`,{className:`ml-1.5 text-muted`,children:e.count})]})}var sq=y(null);function cq(e,t){return t===`attention`?e.rowStatus?.kind===`attention`:t===`merged`?e.pr?.lifecycle===`merged`:e.group===t}function lq(e){let t=b(sq),n={attention:0,merged:0};for(let t of e){n[t.group]=(n[t.group]??0)+1;for(let e of[`attention`,`merged`])cq(t,e)&&(n[e]=(n[e]??0)+1)}return{counts:n,filter:t,onFilter:e=>sq.set(e)}}var uq=2e4;function dq(e,t){let n=Rw().prefs.statusMarkNoticeSeen===!1,r=Vw();(0,h.useEffect)(()=>{!n||t===void 0||(Iw(e.client,`statusMarkNoticeSeen`,!0),t!==0&&r!==`dots`&&z(V(`rail.markNotice`),`info`,{label:V(`rail.markNoticeUndo`),run:()=>Hw(e.client,`dots`)},uq))},[e,n,t,r])}var fq=(0,h.createContext)(null),pq=(0,h.createContext)(null);function mq({slot:e,fallback:t}){let n=(0,h.useContext)(fq);return n?(0,U.jsx)(CG,{slot:e,data:n,fallback:t}):t}function hq(e){let t=WR(),{runtimeErrors:n}=UR();return t?.manifest.slots?.[e]?.component?!n.some(n=>n.packId===t.id&&n.slot===e&&n.phase===`render`):!1}var gq=`flex flex-col gap-0.5 px-2 pb-2 font-mono text-meta`,_q=`flex items-start gap-2`,vq=`flex min-w-0 flex-1 flex-wrap items-center gap-x-2 text-left text-ink`,yq=e=>e.replace(/^'|'$/g,``).split(`/`).pop()||e;function bq(e,t){let n=e=>e.map(e=>e.name).join(`, `),r=e.engines.length+e.signedOut.length>0,i=e.signedOut[0],a=e.engines.filter(e=>e.login!==`unknown`),o=[{id:`engine`,ok:r,label:r?V(`firstRun.engineFound`,{list:n([...e.engines,...e.signedOut])}):V(`firstRun.engineMissing`),fix:V(`firstRun.engineFix`),run:()=>k.set((0,U.jsx)(aU,{model:t,section:`engines`}))},{id:`login`,ok:e.engines.length>0,label:a.length>0?V(`firstRun.loginFound`,{list:n(a)}):e.engines.length>0?V(`firstRun.loginUnknown`,{list:n(e.engines)}):V(i?`firstRun.loginMissing`:`firstRun.loginWaiting`,{list:n(e.signedOut)}),fix:V(`firstRun.loginFix`,{name:i?.name??``}),...ff()&&i?{instead:V(`firstRun.loginFixTouch`,{command:yq(i.signIn??i.id)})}:{},run:()=>void ty((e,n)=>t.client.request(e,n),null,i?.signIn??i?.id??``).then(e=>e&&t.selectWhenListed(e)).catch(e=>z(e instanceof Error?e.message:String(e),`error`))}];return e.project!==void 0&&o.push({id:`project`,ok:e.project!==null,label:e.project?V(`firstRun.projectFound`,{name:e.project.split(/[\\/]/).pop()??e.project}):V(`firstRun.projectMissing`),fix:V(`firstRun.projectFix`),run:()=>L({pickProject:!0})}),o}function xq({model:e}){H(),b(Rs);let[t,n]=(0,h.useState)(()=>J(e,`welcome.env`)??null),r=b(k)!==null;(0,h.useEffect)(()=>{if(r)return;let t=!0,i=()=>ss(e,`welcome.env`).then(e=>t&&n(e)).catch(()=>{});return i(),window.addEventListener(`focus`,i),()=>{t=!1,window.removeEventListener(`focus`,i)}},[e,r]);let i=t===null?[]:bq(t,e),a=i.find(e=>!e.ok);return(0,U.jsx)(`div`,{className:Vd,"data-field":`welcome`,children:(0,U.jsxs)(`div`,{className:Hd,children:[(0,U.jsx)(df,{scene:`rings`}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(`h1`,{className:`m-0 font-sans text-title font-semibold text-ink`,children:V(`firstRun.title`)}),(0,U.jsx)(`p`,{className:`m-0 font-sans text-body text-muted`,children:V(`firstRun.body`)})]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,U.jsx)(`button`,{type:`button`,className:Rr(),"data-field":`start-first-task`,onClick:()=>Yb(t?.start?.repo),children:V(`firstRun.start`)}),(0,U.jsx)(`span`,{className:`keys-only mono text-meta text-subtle`,children:qs(`task.new.global`)})]}),t!==null&&(0,U.jsxs)(`div`,{className:`flex w-full flex-col gap-2 font-sans text-meta`,"data-field":`first-run-checks`,children:[(0,U.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1.5 p-0 text-left`,children:i.map(e=>(0,U.jsxs)(`li`,{className:`flex min-h-7 items-center gap-2`,"data-check":e.id,"data-ok":e.ok,children:[(0,U.jsx)(`span`,{className:`mono w-[1ch] flex-none text-center ${e.ok?`text-success`:`text-warning`}`,"aria-hidden":!0,children:e.ok?`✓`:`✗`}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1 ${e.ok?`text-subtle`:`text-ink`}`,children:[e.label,e===a&&e.instead&&(0,U.jsx)(`span`,{className:`block text-muted`,children:e.instead})]}),e===a&&!e.instead&&(0,U.jsx)(W,{variant:`action`,onClick:e.run,children:e.fix})]},e.id))}),!t.git&&(0,U.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,U.jsx)(`p`,{className:`m-0 text-warning`,children:K(`workspace`,`welcome.gitMissing`)}),(0,U.jsx)(`p`,{className:`mono m-0 text-accent`,children:K(`doctor`,`fix.gitAction`)})]})]})]})})}function Sq(e,t){e.preventDefault(),O.set({x:e.clientX,y:e.clientY,items:t,target:e.currentTarget,fromKeyboard:e.button!==2})}function Cq({model:e,narrow:t}){let n=H(),r=b(e.tasks),i=b(e.remote),a=Cg(e),o=b(e.tabs),s=lS(e);dq(e,r?.tasks.length);let c=b(e.selection),l=r?.tasks??[],u=lq(l),d=u.filter?l.filter(e=>cq(e,u.filter??``)):l,f=r?.attention.filter(e=>e.unread).length??0,p=c.taskId,m=b(M)===null?p:null,g=new Map([...d,...i].map(e=>[e.id,e])),_=lK(),v=b(Tk),y=b(JK).ids,x=b(gk)===`state`,S=e=>(x?kA:Wo)({tasks:d,remote:i,machines:a,sort:_.sort,query:e,fold:{..._.hand,selectedId:p??void 0}}),C=S(_.search.active?_.search.query:``),{groups:w}=C,T=_.search.active?C.rows:Ko(hK(C.rows,o),_.collapsed),D=new Map,O=``;for(let e of C.rows)e.kind===`project`||e.kind===`state`?O=e.id:e.kind===`task`&&D.set(O,(D.get(O)??0)+1);let A=e=>e.filter(e=>e.kind!==`project`&&e.kind!==`state`&&e.kind!==`round`),j=(n===`zh`?Aa:ka).machine,ee=new Set(a.filter(e=>e.state!==`online`).map(e=>e.alias)),te=w.filter(e=>!e.noProject&&e.machine===void 0).map(e=>e.repo),ne=e=>{let t=te.indexOf(e);return{label:fo(e),local:t>=0,top:t>0?te[0]??null:null,above:t>0?te[t-1]??null:null,below:t>=0?te[t+1]??null:null}},N=BW(e,d,!_.search.active&&!x,_.sort==="default"),{place:P,dragging:re}=N.places(T),ie=()=>k.set((0,U.jsx)(aU,{model:e})),F=()=>k.set((0,U.jsx)(Mu,{model:e})),I=pK(e,T,_,{selectedId:p,onNewTask:Yb,onSettings:ie}),ae=A(S(``).rows).length,L=(0,h.useRef)(null),R=b(vW)&&!t,oe=b(yW)&&R,se=t?d.find(e=>e.id===c.taskId&&!e.deleting)??null:null,ce=t?UK:FK,z=WR(),le=!t&&!R?ez(z?.manifest.layout?.frame):``,ue=kJ(e),B=(0,h.useContext)(fq),de=!t&&!!z?.manifest.slots?.[`rail.header`],fe=!t&&!!z?.manifest.slots?.[`shell.topBar`]?.component,pe=(0,U.jsxs)(`header`,{className:ag,children:[(0,U.jsxs)(`span`,{className:`${ar} mr-auto`,"data-wordmark":!0,children:[(0,U.jsx)(`span`,{className:or,children:`[`}),` rove `,(0,U.jsx)(`span`,{className:or,children:`]`})]}),!t&&(0,U.jsxs)(`span`,{className:`relative`,children:[(0,U.jsx)(`button`,{type:`button`,className:`m-0 text-meta font-medium normal-nums inbox-chip relative font-mono hover:text-accent ${dn} ${f>0?`text-accent`:`text-muted`}`,onClick:F,children:V(`rail.inbox`,{count:f})}),(0,U.jsx)(PU,{model:e,bindingId:`inbox.show`,head:!0})]}),!t&&(0,U.jsx)(eF,{}),!t&&(0,U.jsx)(wW,{client:e.client,railBar:!0}),t&&(0,U.jsx)(KK,{model:e}),t&&(0,U.jsx)(qK,{model:e})]}),me=(0,U.jsxs)(`nav`,{"data-tp-region":`rail`,className:`${ig} ${le} ${R?`is-folded`:``}`,ref:L,style:fe?{paddingTop:0}:void 0,inert:R&&!oe,"aria-hidden":R&&!oe,onMouseEnter:R?()=>SW(!0):void 0,onMouseLeave:R?()=>SW(!1):void 0,tabIndex:0,onKeyDown:e=>ZK(e)||I.onKeyDown(e),children:[t?B?(0,U.jsx)(CG,{slot:`phone.listHeader`,data:{...B,query:_.search.active?_.search.query:``,onSearch:e=>_.setSearch(t=>({...t,active:e!==``,query:e}))},fallback:pe}):pe:(0,U.jsx)(CG,{slot:`rail.header`,data:{...u,taskCount:l.length+i.length,unreadCount:f,narrow:t,query:_.search.active?_.search.query:``,onSearch:e=>_.setSearch(t=>({...t,active:e!==``,query:e})),onNewSession:()=>Xb(),onOpenInbox:F,pages:ue},fallback:pe}),t&&(0,U.jsxs)(`div`,{className:`-mt-1 flex items-center gap-2 px-4 pb-2 empty:hidden`,children:[(0,U.jsx)(eF,{}),(0,U.jsx)(wW,{client:e.client})]}),t&&r&&(0,U.jsx)(WK,{model:e}),v&&(0,U.jsxs)(`div`,{className:`flex gap-1 px-3.5 pb-2 text-meta mono`,children:[(0,U.jsx)(`span`,{className:`text-accent`,children:K(`tasks`,`moveChip`).trim()}),(0,U.jsx)(`span`,{className:`keys-only ml-1.5 text-muted`,children:(0,U.jsx)(ju,{text:V(`taskops.moveHint`)})})]}),_.search.active&&(0,U.jsx)(oq,{query:_.search.query,count:`${A(T).length}/${ae}`,onChange:e=>_.setSearch(t=>({...t,query:e}))}),!t&&!de&&(0,U.jsx)(AJ,{model:e}),(0,U.jsxs)(`div`,{"data-rail-body":!0,className:cg(re!==null),...N.body,onPointerDownCapture:I.onPress,children:[r&&d.length===0&&i.length===0&&t&&(0,U.jsx)(xq,{model:e}),r&&d.length===0&&i.length===0&&!t&&(0,U.jsx)(`p`,{className:`m-0 px-2 py-3 font-mono text-meta text-subtle`,children:V(`rail.empty`)}),se&&(0,U.jsx)(FW,{title:se.title}),T.map((n,r)=>n.kind===`round`?(0,U.jsx)(aq,{row:n,guides:n.depth>1?VU(T,r):void 0,repo:x&&n.depth===1?DA(n.tasks[0]):void 0,cursor:n.id===I.cursor,place:P(n),onClick:()=>I.setCursor(n.id)},n.id):n.kind===`pane`?(0,U.jsx)(HG,{selectedTabId:n.task.id===m?c.tabId:null,row:n,guides:VU(T,r),cursor:n.id===I.cursor,place:P(n),onClick:()=>{I.setCursor(n.id),VG(e,n),ye()},onMenu:t=>{I.setCursor(n.id),Sq(t,LG(e,n.task.id,n.tab,n.leaf))}},n.id):(0,U.jsx)(ce,{row:n,guides:n.kind===`task`&&n.depth>1?VU(T,r):void 0,cloud:bg(n,a,j),repo:x&&n.kind===`task`&&n.depth===1?DA(n.task):void 0,tabs:n.kind===`task`?o[n.task.id]:void 0,engineIcon:n.kind===`task`?s.get(n.task.engine?.id??``):void 0,selected:n.id===m,cursor:n.id===I.cursor&&re===null,stale:n.machine!==void 0&&ee.has(n.machine),collapsed:(n.kind===`project`||n.kind===`state`)&&_.collapsed.has(n.id),count:D.get(n.id),drag:N.props(n),swipe:t&&n.kind===`task`&&n.machine===void 0&&!n.task.archived?eK(e,n.task):void 0,dragging:re===n.id,place:P(n),onNewTask:n.kind===`project`?n.noProject?Xb:()=>Yb(n.repo,n.machine):void 0,moving:y.has(n.id)||v&&n.machine===void 0&&n.kind!==`project`&&n.id===I.cursor,prTasks:n.kind===`task`&&n.fold?.collapsed?[n.task,...n.fold.descendantIds.flatMap(e=>g.get(e)??[])]:void 0,rollup:n.kind===`task`&&n.fold?.collapsed?j_([n.task,...n.fold.descendantIds.flatMap(e=>g.get(e)??[])]):void 0,onToggleFold:()=>{n.kind===`task`&&_.toggleTaskFold(n.id,n.fold?.collapsed===!0)},onClick:t=>{n.kind===`task`&&t&&XK(t,n.id,T,m)||(I.setCursor(n.id),(n.kind===`project`||n.kind===`state`)&&_.toggleProject(n.id),n.kind===`task`&&fK(e,n.task.id))},onMenu:t=>{if(n.kind===`project`&&n.machine!==void 0)return;if(n.kind===`project`&&n.noProject){Sq(t,ZG(e));return}if(n.kind===`project`){Sq(t,XG(e,n.repo,ne(n.repo)));return}if(n.kind!==`task`)return;I.setCursor(n.id);let r=QK(e,n.id,T);if(r)return Sq(t,r);Sq(t,E(Tq(wq(tK(e,n.task,null),n.fold,()=>_.toggleTaskFold(n.id,n.fold?.collapsed===!0)),BG(e,n.task.id)),V(`menu.more`)))}},n.id))]}),(0,U.jsx)(DG,{model:e,narrow:t,onSettings:ie,inbox:{count:f,onClick:F}}),!t&&!R&&(0,U.jsx)(DW,{rail:L})]});return(0,U.jsx)(CG,{slot:`rail.frame`,data:{unreadCount:f,taskCount:d.length+i.length,groupBy:x?`state`:`project`,sortBy:_.sort,folded:R,narrow:t},fallback:me})}function wq(e,t,n){if(!t)return e;let r={label:K(`tasks`,t.collapsed?`menu.expandChildren`:`menu.collapseChildren`),section:`open`,rare:!0,run:n},i=e.map(e=>e.section).lastIndexOf(`open`);return[...e.slice(0,i+1),r,...e.slice(i+1)]}function Tq(e,t){let n=e.map(e=>e.section).lastIndexOf(`open`);return[...e.slice(0,n+1),...t.map(e=>({...e,rare:!0})),...e.slice(n+1)]}var Eq=e=>Date.parse(e.updatedAt??e.createdAt??``)||0;function Dq(e,t,n){return(n===`archived`?e?.archived??[]:e?.tasks??[]).filter(e=>!e.routine).filter(e=>t===null||!Mo(e)&&yS(e.repo)===yS(t)).sort((e,t)=>Eq(t)-Eq(e))}function Oq(e){let t=new Set,n=[];for(let r of[...e?.tasks??[],...e?.archived??[]]){if(r.routine||Mo(r)||r.repo.startsWith(`ssh://`))continue;let e=yS(r.repo);t.has(e)||(t.add(e),n.push(r.repo))}return n}function kq({tabs:e,value:t,onChange:n,className:r}){return(0,U.jsx)(`div`,{className:Kt(`flex gap-1`,r),role:`tablist`,children:e.map(e=>{let r=e.id===t;return(0,U.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":r,className:Kt(`relative rounded-sm px-2.5 py-0.75 font-mono text-meta font-semibold`,`touch:after:absolute touch:after:content-[''] touch:after:-inset-x-0.5 touch:after:-top-2 touch:after:-bottom-1.5`,r?`bg-inset text-ink group-focus-within/pane:text-accent`:`text-muted`),onClick:()=>n(e.id),children:e.label},e.id)})})}function Aq({model:e}){let{common:t}=gS(),n=b(e.tasks),r=b(P)??``,[i,a]=(0,h.useState)(`active`),[o,s]=(0,h.useState)(0),c=Oq(n),l=r===``?null:r,u=Dq(n,l,i),d=Math.min(o,Math.max(0,u.length-1)),f=(0,h.useRef)(null);(0,h.useEffect)(()=>f.current?.focus(),[]);let p=(0,h.useRef)(null);(0,h.useEffect)(()=>{p.current?.querySelector(`[data-row="${d}"]`)?.scrollIntoView({block:`nearest`})},[d]);let m=t=>{M.set(null),e.select(t)},g=e=>{a(e),s(0)},_=e=>{let t=[``,...c],n=t.findIndex(e=>e===``?r===``:yS(e)===yS(r));P.set(t[(Math.max(0,n)+(e?t.length-1:1))%t.length]??``),s(0)};ES(e=>{if(e.ctrlKey)return e.key===`c`&&(M.set(null),!0);let t=u[d];switch(e.key){case`Escape`:case`q`:return M.set(null),!0;case`j`:case`ArrowDown`:return s(Math.min(u.length-1,d+1)),!0;case`k`:case`ArrowUp`:return s(Math.max(0,d-1)),!0;case`Tab`:return _(e.shiftKey),!0;case`a`:return g(i===`active`?`archived`:`active`),!0;case`Enter`:return t&&m(t.id),!0;default:return!1}});let v=Date.now();return(0,U.jsxs)(`div`,{className:`group/pane ${Ww}`,tabIndex:0,ref:f,children:[(0,U.jsxs)(`div`,{className:Kw,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,U.jsx)(`h1`,{className:Gw,children:V(`sessions.title`)}),(0,U.jsx)(kq,{tabs:[{id:`active`,label:V(`sessions.active`)},{id:`archived`,label:V(`sessions.archived`)}],value:i,onChange:g})]}),(0,U.jsx)(`span`,{className:`mono touch:empty:hidden! text-muted ${qw(!0)}`,children:l?bS(l,c):V(`sessions.allProjects`)})]}),n?u.length===0?(0,U.jsx)(`p`,{className:`text-muted`,children:V(i===`archived`?`sessions.emptyArchived`:`sessions.emptyActive`)}):(0,U.jsx)(`div`,{className:Xw,ref:p,children:u.map((t,n)=>{let r=Date.parse(t.updatedAt??t.createdAt??``);return(0,U.jsx)(`div`,{"data-row":n,className:Zw(n===d),onClick:()=>m(t.id),onContextMenu:r=>{s(n),Sq(r,E(tK(e,t,null),V(`menu.more`)))},children:(0,U.jsxs)(`div`,{className:Qw,children:[(0,U.jsx)(`span`,{className:tT,title:t.label,children:t.label}),l===null&&!Mo(t)?(0,U.jsx)(`span`,{className:`mono text-meta ${$w}`,children:bS(t.repo,c)}):null,(0,U.jsx)(`span`,{className:`mono text-meta ${$w}`,children:Number.isFinite(r)?gT(r,v):``})]})},t.id)})}):(0,U.jsx)(`p`,{className:`text-muted`,children:t.loading}),(0,U.jsx)(`p`,{className:`mt-2.5 mb-0 text-meta text-subtle touch:hidden`,children:V(`sessions.keys`)})]})}function jq({active:e=!1,onSelect:t,plus:n=!1,children:r}){return(0,U.jsxs)(`button`,{type:`button`,className:`rail-nav-row ${oT(e)}`,"aria-current":e?`page`:void 0,onClick:t,children:[r,n?(0,U.jsx)(`span`,{className:sT,"aria-hidden":`true`,children:`+`}):null]})}var Mq=`mx-auto flex max-w-[76rem] flex-col font-mono text-meta leading-[1.5]`,Nq=`flex items-end justify-between gap-[4ch]`,Pq=`m-0 text-title font-bold tracking-[0.02em]`,Fq=`font-bold tracking-code uppercase`,Iq=`text-muted`,Lq=`text-subtle`,Rq=`my-4 border-t-hairline border-dashed! border-line-active`,zq=`m-0 mb-1.5 text-meta text-muted ${Fq}`,Bq=`${zq} flex flex-wrap items-baseline justify-between gap-x-[4ch]`,Vq=`flex flex-wrap items-start gap-x-[8ch] gap-y-4`,Hq=`min-w-[min(100%,36ch)] flex-1`,Uq=`text-[3.5rem] leading-none font-bold tracking-[-0.03em]`,Wq=`grid grid-cols-[repeat(auto-fit,minmax(min(100%,34ch),1fr))] items-start gap-x-[6ch] gap-y-5`,Gq=`flex min-w-0 items-baseline gap-[1ch] whitespace-nowrap`,Kq=`min-w-0 truncate`,qq=`min-w-[2ch] flex-1 -translate-y-0.75 border-b-hairline border-dotted! border-line-active`,Jq=`pl-[2ch] text-subtle`,Yq=`-mx-[1ch] block rounded-sm px-[1ch] py-0.5 text-left`,Xq=`${Yq} w-[calc(100%+2ch)] cursor-pointer hover:bg-hover focus-visible:outline-1 focus-visible:-outline-offset-1 focus-visible:outline-focus`,Zq=`grid grid-cols-[6ch_minmax(0,1fr)_5ch_5ch_8ch] items-center gap-x-[2ch] py-0.5 whitespace-nowrap`,Qq=[`bg-accent`,`bg-info`,`bg-merged`,`bg-subtle`],$q=`grid grid-cols-[minmax(0,1fr)_minmax(8ch,14ch)_5ch] items-center gap-x-[1ch] whitespace-nowrap`,eJ=`relative h-2.5 border-hairline border-current after:absolute after:inset-y-0 after:left-0 after:w-(--fill) after:bg-current after:content-['']`,tJ={ok:`${eJ} text-success`,warn:`${eJ} text-warning`,crit:`${eJ} text-error`},nJ=`flex h-9 flex-none items-stretch text-ink`,rJ=`flex-none bg-current`,iJ=`flex flex-wrap items-baseline justify-between gap-x-[4ch] gap-y-1 text-subtle`,aJ={turns:0,tokens:0,ms:0},oJ=e=>(e.usage?.input_tokens??0)+(e.usage?.output_tokens??0),sJ=e=>Math.max(0,e.endedAt-e.startedAt),cJ=(e,t)=>({turns:e.turns+1,tokens:e.tokens+oJ(t),ms:e.ms+sJ(t)});function lJ(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function uJ(e,t,n,r){let i=[];for(let e=n-1;e>=0;e--){let n=new Date(t);n.setDate(n.getDate()-e),i.push(lJ(n.getTime()))}let a=new Map(i.map(e=>[e,{sum:aJ,byEngine:{}}]));for(let t of e){let e=a.get(lJ(t.startedAt));if(!e)continue;let n=t.vendor??`unknown`;e.sum=cJ(e.sum,t),e.byEngine[n]=(e.byEngine[n]??0)+oJ(t)}let o=e.reduce((e,t)=>Math.min(e,t.startedAt),1/0),s=e.length>=r&&Number.isFinite(o)?{count:e.length,day:lJ(o)}:null;return{cutoff:s,days:i.map(e=>{let t=a.get(e);return{day:e,...t?.sum??aJ,byEngine:t?.byEngine??{},partial:s!==null&&e<=s.day}})}}function dJ(e){let t=new Map;for(let n of e){let e=n.vendor??`unknown`,r=n.model??`unknown`,i=`${e}\0${r}`;t.set(i,{engine:e,model:r,...cJ(t.get(i)??aJ,n)})}return[...t.values()].sort((e,t)=>t.tokens-e.tokens||t.turns-e.turns)}function fJ(e,t){let n=new Map;for(let t of e)n.set(t.taskId,{taskId:t.taskId,...cJ(n.get(t.taskId)??aJ,t)});return[...n.values()].sort((e,t)=>t.tokens-e.tokens||t.turns-e.turns).slice(0,t)}function pJ(e){return e<1e3?String(e):e<1e6?`${(e/1e3).toFixed(+(e<1e4)).replace(/\.0$/,``)}k`:`${(e/1e6).toFixed(+(e<1e7)).replace(/\.0$/,``)}M`}var mJ=.1,hJ=/^(\d+)\s*(h|d)$/;function gJ(e,t){let n=hJ.exec(e.label.trim());if(!n||e.resetsAt===null||e.percent<=0)return null;let r=Number(n[1])*(n[2]===`d`?24:1)*36e5,i=r-(e.resetsAt-t);if(!(i>=r*mJ)||i>r)return null;if(e.percent>=100)return{kind:`full`,at:t};let a=t+(100-e.percent)/e.percent*i;return a<e.resetsAt?{kind:`full`,at:a}:{kind:`lasts`}}var _J=14,vJ=500,yJ=3e4,bJ=8;function xJ(e,t,n,r){let i=J(e,t,n),[a,o]=(0,h.useState)(i?{kind:`ready`,value:i}:{kind:`loading`}),s=b(e.client.conn).state===`open`,c=JSON.stringify(n);return(0,h.useEffect)(()=>{if(!s)return;let r=!0;return ss(e,t,n).then(e=>r&&o({kind:`ready`,value:e})).catch(e=>r&&o(t=>t.kind===`ready`?t:{kind:`failed`,error:vS(e)})),()=>{r=!1}},[e,t,c,r,s]),a}var SJ=()=>(0,U.jsx)(`div`,{className:Rq});function CJ({name:e,title:t,sum:n,sub:r,open:i}){let a=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`span`,{className:Gq,children:[(0,U.jsx)(`span`,{className:Kq,title:t,children:e}),(0,U.jsx)(`span`,{className:qq}),(0,U.jsx)(`span`,{children:pJ(n.tokens)})]}),(0,U.jsx)(`span`,{className:`block truncate ${Jq}`,children:[r,`${n.turns}t`,AO(n.ms)].filter(Boolean).join(` · `)})]});return i?(0,U.jsx)(W,{variant:`row`,className:Xq,onClick:i,children:a}):(0,U.jsx)(`div`,{className:Yq,children:a})}function wJ({sum:e}){let t=`${e.tokens}${e.turns}${e.ms}`.repeat(4).slice(0,36);return(0,U.jsx)(`div`,{className:nJ,"aria-hidden":`true`,children:[...t].map((e,t)=>(0,U.jsx)(`span`,{className:rJ,style:{width:1+Number(e)%3,marginRight:1+Number(e)%2}},t))})}function TJ({usage:e,nameOf:t}){let n=Date.now(),r=e.flatMap(e=>e.windows.map(r=>{let i=gJ(r,n),a=i?.kind===`full`&&i.at-n<72e6,o=i?.kind===`full`?Z(V(`usage.full`),{time:new Date(i.at).toLocaleString([],{...a?{}:{weekday:`short`},hour:`2-digit`,minute:`2-digit`})}):i?V(`usage.lasts`):``;return{key:`${e.vendor}:${r.kind}`,name:`${e.name||t(e.vendor)} ${r.label}`,percent:Math.round(r.percent),tone:qH({capturedAt:e.capturedAt,windows:[r]},n)?.tone??`ok`,note:o}}));return r.length===0?null:(0,U.jsxs)(`section`,{children:[(0,U.jsx)(`h2`,{className:zq,children:V(`usage.quota`)}),r.map(e=>(0,U.jsxs)(`div`,{className:`py-0.5`,children:[(0,U.jsxs)(`div`,{className:$q,children:[(0,U.jsx)(`span`,{className:Kq,children:e.name}),(0,U.jsx)(`span`,{className:tJ[e.tone]??tJ.ok,style:{"--fill":`${Math.min(100,Math.max(0,e.percent))}%`}}),(0,U.jsx)(`span`,{className:`text-right ${nr[e.tone]}`,children:`${e.percent}%`})]}),e.note&&(0,U.jsx)(`div`,{className:`pl-[2ch] text-subtle`,children:e.note})]},e.key))]})}function EJ({model:e}){H();let t=DS(),[n]=wS(yJ),r=xJ(e,`turns.list`,{sinceDays:_J,limit:vJ},n),i=xJ(e,`engines.list`,{},n),a=xJ(e,`usage.get`,{},n),o=b(e.tasks),s=i.kind===`ready`?i.value.engines:[],c=e=>s.find(t=>t.id===e)?.name??e,l=e=>o?.tasks.find(t=>t.id===e)?.label??V(`usage.removedTask`),u=a.kind===`ready`&&a.value.usage&&(0,U.jsx)(TJ,{usage:a.value.usage,nameOf:c});return(0,U.jsx)(`div`,{className:Ww,tabIndex:0,ref:t,onKeyDown:e=>{e.metaKey||e.ctrlKey||e.altKey||e.key!==`q`&&e.key!==`Escape`||(e.preventDefault(),M.set(null))},children:(0,U.jsx)(`div`,{className:Mq,children:(()=>{if(r.kind===`loading`)return(0,U.jsx)(`p`,{className:`m-0 ${Iq}`,children:V(`usage.loading`)});if(r.kind===`failed`)return(0,U.jsx)(`p`,{className:`m-0 text-error`,children:Z(V(`usage.failed`),{error:r.error})});let t=r.value.turns,n=new Set(r.value.readers??[]),i=uJ(t,Date.now(),_J,vJ),a=new Map;for(let e of i.days)for(let[t,n]of Object.entries(e.byEngine))a.set(t,(a.get(t)??0)+n);let s=[...a].sort((e,t)=>t[1]-e[1]).map(([e])=>e),d=e=>Qq[Math.max(0,s.indexOf(e))%Qq.length]??Qq[0],f=Math.max(0,...i.days.map(e=>e.tokens)),p=i.days.slice(Math.max(0,i.days.findIndex(e=>e.turns>0))),m=i.days.reduce((e,t)=>({turns:e.turns+t.turns,tokens:e.tokens+t.tokens,ms:e.ms+t.ms}),{turns:0,tokens:0,ms:0}),h=[...new Set((o?.tasks??[]).flatMap(e=>e.engine?.id&&!n.has(e.engine.id)?[e.engine.id]:[]))];return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:Nq,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`h1`,{className:Pq,children:[(0,U.jsx)(`span`,{className:or,children:`[`}),` rove `,(0,U.jsx)(`span`,{className:or,children:`]`})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{className:Fq,children:V(`usage.receipt`)}),(0,U.jsx)(`span`,{className:Iq,children:` ${i.days[0]?.day.slice(5)} → ${i.days.at(-1)?.day.slice(5)}`})]})]}),t.length>0&&(0,U.jsx)(wJ,{sum:m})]}),(0,U.jsx)(SJ,{}),t.length===0?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`m-0 ${Iq}`,children:V(`usage.empty`)}),u&&(0,U.jsx)(SJ,{}),u]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:Vq,children:[(0,U.jsxs)(`section`,{children:[(0,U.jsx)(`h2`,{className:zq,children:V(`usage.total`)}),(0,U.jsx)(`div`,{className:Uq,children:pJ(m.tokens)}),(0,U.jsx)(`div`,{className:`mt-1.5 ${Iq}`,children:`${Z(V(m.turns===1?`usage.turnsOne`:`usage.turns`),{count:m.turns})} · ${AO(m.ms)}`})]}),(0,U.jsxs)(`section`,{className:Hq,children:[(0,U.jsxs)(`h2`,{className:Bq,children:[V(`usage.perDay`),s.length>1&&(0,U.jsx)(`span`,{className:`flex flex-wrap gap-x-[2ch] font-normal tracking-normal normal-case`,children:s.map(e=>(0,U.jsxs)(`span`,{children:[(0,U.jsx)(`span`,{className:`mr-[1ch] inline-block size-2 align-baseline ${d(e)}`}),c(e)]},e))})]}),p.map(e=>(0,U.jsxs)(`div`,{className:Zq,children:[(0,U.jsx)(`span`,{className:Iq,children:`${e.day.slice(5)}${e.partial?`~`:``}`}),(0,U.jsx)(`span`,{className:`flex min-w-0`,children:e.tokens>0&&f>0&&(0,U.jsx)(`span`,{className:`flex h-2.5 w-(--fill) min-w-0.5 gap-px`,style:{"--fill":`${e.tokens/f*100}%`},children:s.map(t=>(e.byEngine[t]??0)>0&&(0,U.jsx)(`span`,{className:`min-w-0.5 basis-0 ${d(t)}`,style:{flexGrow:e.byEngine[t]}},t))})}),e.turns>0&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:`text-right`,children:pJ(e.tokens)}),(0,U.jsx)(`span`,{className:`text-right text-subtle`,children:`${e.turns}t`}),(0,U.jsx)(`span`,{className:`text-right text-subtle`,children:AO(e.ms)})]})]},e.day))]})]}),(0,U.jsx)(SJ,{}),(0,U.jsxs)(`div`,{className:Wq,children:[(0,U.jsxs)(`section`,{children:[(0,U.jsx)(`h2`,{className:zq,children:V(`usage.byModel`)}),dJ(t).map(e=>(0,U.jsx)(CJ,{name:e.model,title:`${c(e.engine)} · ${e.model}`,sum:e,sub:c(e.engine)},`${e.engine}\0${e.model}`))]}),(0,U.jsxs)(`section`,{children:[(0,U.jsx)(`h2`,{className:zq,children:V(`usage.topTasks`)}),fJ(t,bJ).map(t=>{let n=o?.tasks.some(e=>e.id===t.taskId),r=l(t.taskId);return(0,U.jsx)(CJ,{name:n?r:(0,U.jsx)(`span`,{className:Lq,children:r}),title:r,sum:t,open:n?()=>{M.set(null),e.select(t.taskId)}:null},t.taskId)})]}),u]})]}),(0,U.jsx)(SJ,{}),(0,U.jsxs)(`div`,{className:iJ,children:[(0,U.jsx)(`span`,{children:Z(V(`usage.range`),{days:_J})}),i.cutoff&&(0,U.jsx)(`span`,{children:Z(V(`usage.cutoff`),{count:i.cutoff.count,day:i.cutoff.day.slice(5)})}),h.length>0&&(0,U.jsx)(`span`,{children:Z(V(`usage.noReader`),{engines:h.map(c).join(`, `)})}),(0,U.jsx)(`span`,{className:`${Fq} ml-auto`,children:V(`usage.thanks`)})]})]})})()})})}var DJ={id:`mods`,label:`mods`},OJ=[{id:`kanban`,label:`kanban`,mod:`kanban`},{id:`routines`,label:`automations`},{id:`issues`,label:`issues`,mod:`issues`}];function kJ(e){let{nav:t}=gS(),n=b(M),r=b(e.mods).length>0,i=b(e.installedMods);return[...OJ.filter(e=>!e.mod||i.has(e.mod)),...r?[DJ]:[]].map(e=>({id:e.id,label:t[e.label],active:n===e.id,onOpen:()=>xe(e.id)}))}function AJ({model:e}){let t=kJ(e);return(0,U.jsxs)(`div`,{className:nT,children:[(0,U.jsx)(jq,{plus:!0,onSelect:()=>Yb(),children:V(`rail.newTask`)}),t.map(e=>(0,U.jsx)(jq,{active:e.active,onSelect:e.onOpen,children:e.label},e.id))]})}function jJ({model:e,page:t}){let n=b(e.installedMods);return t===`kanban`&&n.has(`kanban`)?(0,U.jsx)(kE,{model:e}):t===`routines`?(0,U.jsx)(pk,{model:e}):t===`issues`&&n.has(`issues`)?(0,U.jsx)(OT,{model:e}):t===`mods`?(0,U.jsx)(ZE,{model:e}):t===`compare`?(0,U.jsx)(mT,{model:e}):t===`usage`?(0,U.jsx)(EJ,{model:e}):t===`sessions`?(0,U.jsx)(Aq,{model:e}):t===`update`?(0,U.jsx)(iF,{client:e.client}):null}var MJ=e=>e.split(` + `).map(e=>Is(e)).join(` + `);function NJ(e){let t=lA(Bk(e.scope));return e.kind===`here`?aA(`here`,{surface:t}):e.kind===`direct`?aA(`direct`):e.kind===`prefix`?aA(`afterPrefix`):aA(`otherPane`,{surface:t})}function PJ(e){let t=document.activeElement instanceof HTMLElement?document.activeElement:null;k.set((0,U.jsx)(FJ,{model:e,surface:ic(),origin:t}))}function FJ({model:e,surface:t,origin:n}){H();let r=b(Rs),[i,a]=(0,h.useState)(!1),[o,s]=(0,h.useState)(``),c=(0,h.useRef)(null),l=(0,h.useMemo)(()=>ac(e,t),[e,t]),u=(0,h.useMemo)(()=>Rk(oc(),t===`terminal`?`terminal`:t,Us(),l),[l,t,r]).map(e=>({...e,rows:e.rows.filter(e=>Hk(o,sA(e.binding.id),e.primary))})).filter(e=>e.rows.length>0);return(0,h.useEffect)(()=>()=>n?.focus(),[n]),(0,h.useEffect)(()=>{let e=c.current,t=t=>{if(!e||t.ctrlKey||t.metaKey||t.altKey)return;let n=e.clientHeight;if(t.key===`ArrowUp`)e.scrollBy({top:-24});else if(t.key===`ArrowDown`)e.scrollBy({top:24});else if(t.key===`PageUp`)e.scrollBy({top:-n});else if(t.key===`PageDown`)e.scrollBy({top:n});else if(t.key===`Home`)e.scrollTo({top:0});else if(t.key===`End`)e.scrollTo({top:e.scrollHeight});else if(!i&&t.key===`?`)B();else if(!i&&t.key===`/`)a(!0);else return;t.preventDefault()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[i]),(0,U.jsx)(ia,{title:aA(`title`),wide:!0,children:(0,U.jsxs)(`div`,{className:`${hi} help`,children:[(0,U.jsxs)(`div`,{className:jn,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`text-muted`,children:t?aA(`focused`,{surface:lA(Bk(t))}):aA(`allBindings`)}),(0,U.jsx)(`p`,{className:`text-muted`,children:aA(`grammar`,{prefix:Ws()})})]}),(0,U.jsxs)(`div`,{className:Mn,children:[(0,U.jsx)(`span`,{className:`subtle`,children:aA(`scrollKeys`)}),(0,U.jsx)(`button`,{type:`button`,className:Jr,onClick:B,children:aA(`esc`)})]})]}),i?(0,U.jsx)(`input`,{className:Zr,autoFocus:!0,spellCheck:!1,value:o,placeholder:aA(`search`),onChange:e=>{s(e.target.value),c.current?.scrollTo({top:0})}}):(0,U.jsx)(`p`,{className:`text-muted`,children:aA(`filter`)}),u.length===0&&(0,U.jsx)(`p`,{className:`text-muted`,children:aA(`noResults`)}),(0,U.jsx)(`div`,{className:Nn,ref:c,children:u.map((e,t)=>(0,U.jsxs)(`section`,{className:Pn,children:[(0,U.jsx)(`h2`,{className:Fn,children:NJ(e)}),e.rows.map(t=>(0,U.jsxs)(`div`,{className:In,children:[(0,U.jsx)(`span`,{className:`mono ${Ln}`,children:MJ(t.primary)}),(0,U.jsx)(`span`,{className:`flex-1`,children:sA(t.binding.id)}),t.aliases.length>0&&(0,U.jsx)(`span`,{className:`text-muted`,children:`(${t.aliases.map(MJ).join(`, `)})`})]},`${e.kind}-${t.binding.id}`))]},`${e.kind}-${e.scope??t}`))})]})})}function IJ(e){return!(e instanceof HTMLElement)||e.closest(`.xterm`)?!1:e.isContentEditable||[`INPUT`,`TEXTAREA`,`SELECT`].includes(e.tagName)}function LJ(e){return e instanceof HTMLElement&&!!e.closest(`.rail, button, a`)}var RJ=e=>e.tabs.get()[e.selection.get().taskId??``]??[];function zJ(e){let{taskId:t,tabId:n}=e.selection.get(),r=RJ(e);return{taskId:t,tabs:r,at:r.findIndex(e=>e.id===n)}}function BJ(e,t){let{taskId:n,tabs:r}=zJ(e),i=r[t];!n||!i||e.select(n,i.id)}function VJ(e){let{taskId:t,tabs:n,at:r}=zJ(e),i=n[r];!t||!i||k.set((0,U.jsx)(oa,{title:V(`menu.renameTab`),initial:Go(i),submitLabel:V(`dialog.save`),onSubmit:async n=>{await e.renameTab(t,i.id,n)}}))}var HJ=e=>!!e.selection.get().taskId,UJ=e=>RJ(e).length>0,WJ=[{id:`help.open`,chords:[`f1`],prefix:!1,run:PJ},{id:`focus.next`,chords:[`f4`],prefix:!1,run:()=>Os(1)},{id:`chat.tab.chooseEngine`,chords:[`ctrl+e`],prefix:!1,surface:`workspace`,live:HJ,run:e=>{let{taskId:t}=e.selection.get();t&&k.set((0,U.jsx)(CA,{model:e,taskId:t}))}},{id:`chat.tab.rename`,chords:[`f2`],prefix:!1,surface:`workspace`,live:e=>{let{tabs:t,at:n}=zJ(e);return!!t[n]&&!sU(t[n]?.split)},run:VJ},{id:`chat.tab.cycle-next`,chords:[`ctrl+]`],prefix:!1,surface:`workspace`,live:UJ,run:e=>BJ(e,(zJ(e).at+1)%RJ(e).length)},{id:`chat.tab.cycle-prev`,chords:[`ctrl+[`],prefix:!1,surface:`workspace`,live:UJ,run:e=>BJ(e,(zJ(e).at-1+RJ(e).length)%RJ(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:UJ,run:(e,t=``)=>{let n=tc().find(e=>e.id===`chat.tab.goto`&&!e.prefix)?.chords.indexOf(t)??-1;n>=0&&BJ(e,n)}},{id:`attention.next`,chords:[`f7`],prefix:!1,run:e=>KJ(e)}];$s(()=>WJ);function GJ(e){(0,h.useEffect)(()=>{let t=t=>{if(k.get()||IJ(t.target))return;let n=M.get();if(n===`worktrees`)return;let r=ic()??(HJ(e)?`workspace`:`sidebar`),{taskId:i}=e.selection.get();if(!n&&i&&!t.ctrlKey&&!t.shiftKey&&!t.metaKey&&!t.altKey&&t.key===`Enter`&&!UJ(e)&&!LJ(t.target)){t.preventDefault(),t.stopPropagation(),k.set((0,U.jsx)(CA,{model:e,taskId:i}));return}let a=Xk(t),o=tc().filter(t=>!t.prefix&&!t.native&&t.chords.some(e=>a.includes(e))&&nc(t,r)&&!(n&&t.surface)&&t.live?.(e)!==!1).sort((e,t)=>rc(e,r)-rc(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 KJ(e){let t=e.tasks.get();if(!t)return;let n=xc(t.attention,t.tasks.map(e=>e.id),e.selection.get());if(!n){z(V(`inbox.empty`));return}if(vc(n.state)){Tc(e,n);return}n.taskId!==null&&(e.select(n.taskId,n.tabId),wc(e,n))}async function qJ(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(V(`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(G(e),`error`)}}function JJ(e){(0,h.useEffect)(()=>{let t=t=>{let n=Rs.get().plugins;if(n.length===0||!Zs({dialog:k.get()!==null,page:M.get()})||IJ(t.target))return;let r=Xs(n,Xk(t));r&&(t.preventDefault(),t.stopImmediatePropagation(),qJ(e,r))};return window.addEventListener(`keydown`,t,{capture:!0}),()=>window.removeEventListener(`keydown`,t,{capture:!0})},[e])}var YJ=[`workingBorder`,`runningTitle`,`taskColors`,`colorblind`];function XJ(e){let{client:t}=e,n=Rw(),r=_z(),i=b(zF),a=WR();vz(e),hH(e),(0,h.useEffect)(()=>{let e=()=>{Fw(t).catch(()=>void 0),dy(t).catch(()=>void 0)},n=()=>document.visibilityState===`visible`&&e(),r=t.onOpen(e);return window.addEventListener(`focus`,e),document.addEventListener(`visibilitychange`,n),()=>{r(),window.removeEventListener(`focus`,e),document.removeEventListener(`visibilitychange`,n)}},[t]),(0,h.useEffect)(()=>{zR(t).catch(()=>void 0)},[t,n]),(0,h.useEffect)(()=>{let e=document.documentElement,t=n.prefs.theme,o=i?i[r]:yF(n.themes,t,r),s=i?i.fontFamily??null:bF(n.themes,t),c=o?FF(o,n.prefs):{};for(let[t,n]of Object.entries(c))e.style.setProperty(t,n);s?e.style.setProperty(`--mono`,SF(s)):e.style.removeProperty(`--mono`),eG(e,i&&i.name!==t?null:a,c),e.style.colorScheme=r;for(let t of YJ)e.dataset[t]=String(n.prefs[t]);LF.set(o?IF(o):null),RF.set(s?CF(s):null);let l=document.querySelector(`meta[name="theme-color"]`);l||(l=document.createElement(`meta`),l.name=`theme-color`,document.head.append(l)),l.content=getComputedStyle(document.body).backgroundColor},[n,r,i,a])}function ZJ(e,t,n){let r=n.width/t.width,i=n.height/t.height,a=Math.min(n.width,Math.max(0,Math.round(e.left*r))),o=Math.min(n.height,Math.max(0,Math.round(e.top*i)));return{x:a,y:o,width:Math.min(n.width-a,Math.round(e.width*r)),height:Math.min(n.height-o,Math.round(e.height*i))}}function QJ(e,t,n){let r={left:0,top:0,width:n.innerWidth,height:n.innerHeight},i={left:(n.outerWidth-n.innerWidth)/2,top:n.outerHeight-n.innerHeight},a={...i,width:n.outerWidth,height:n.outerHeight},o={left:n.screenX+i.left,top:n.screenY+i.top,...n.screen},s={browser:r,window:a,monitor:o}[e??``];if(s)return s;let c=e=>Math.abs(e.width/e.height-t.width/t.height);return[r,a,o].reduce((e,t)=>c(t)<c(e)?t:e)}function $J(){return typeof navigator.mediaDevices?.getDisplayMedia==`function`}async function eY(e,t){let n=await navigator.mediaDevices.getDisplayMedia({video:{displaySurface:`browser`},preferCurrentTab:!0,selfBrowserSurface:`include`});try{let r=document.createElement(`video`);r.muted=!0,r.srcObject=n,await r.play();let i={width:r.videoWidth,height:r.videoHeight},a=e.getBoundingClientRect(),o=QJ(n.getVideoTracks()[0]?.getSettings().displaySurface,i,window),s=ZJ({left:a.left+o.left,top:a.top+o.top,width:a.width,height:a.height},o,i),c=document.createElement(`canvas`);c.width=s.width,c.height=s.height,c.getContext(`2d`)?.drawImage(r,s.x,s.y,s.width,s.height,0,0,s.width,s.height);let l=await new Promise(e=>c.toBlob(e,`image/png`));if(!l)throw Error(`empty capture`);return new File([l],t,{type:`image/png`})}finally{for(let e of n.getTracks())e.stop()}}async function tY(e,t,n){let r=new Image;r.src=e,await r.decode();let i=document.createElement(`canvas`);i.width=r.naturalWidth||r.width,i.height=r.naturalHeight||r.height;let a=i.getContext(`2d`);if(!a)throw Error(`canvas unavailable`);if(a.drawImage(r,0,0,i.width,i.height),t){let e=t.getBoundingClientRect(),n=t.cloneNode(!0);n.setAttribute(`xmlns`,`http://www.w3.org/2000/svg`),n.setAttribute(`width`,String(e.width||i.width)),n.setAttribute(`height`,String(e.height||i.height));let r=getComputedStyle(t).stroke||`#e5734a`;n.setAttribute(`stroke`,r),n.setAttribute(`fill`,`none`),n.setAttribute(`stroke-width`,`2.5`),n.setAttribute(`stroke-linecap`,`round`),n.setAttribute(`stroke-linejoin`,`round`);let o=URL.createObjectURL(new Blob([new XMLSerializer().serializeToString(n)],{type:`image/svg+xml`}));try{let e=new Image;e.src=o,await e.decode(),a.drawImage(e,0,0,i.width,i.height)}finally{URL.revokeObjectURL(o)}}let o=await new Promise(e=>i.toBlob(e,`image/png`));if(!o)throw Error(`empty capture`);return new File([o],n,{type:`image/png`})}var nY=new Set,rY=2e3;function iY(e){nY.add(e)}function aY(e,t=rY){setTimeout(()=>nY.delete(e),t)}var oY=e=>nY.has(e),sY=()=>Ee()?14:13,cY=(e,t)=>{let n=De(()=>{e.options.fontSize=sY(),t()}),r=RF.subscribe(()=>{let n=RF.get()??dY;e.options.fontFamily!==n&&(e.options.fontFamily=n,t())});return()=>{n(),r()}},lY={background:`#141413`,foreground:`#eae7df`,cursor:`#cc785c`,cursorAccent:`#141413`,selectionBackground:`#33312e`,black:`#141413`,red:`#ec6f74`,green:`#9aca86`,yellow:`#e8c96b`,blue:`#61aaf2`,magenta:`#9b87f5`,cyan:`#d4967e`,white:`#a9a39a`,brightBlack:`#6b665f`,brightRed:`#ec6f74`,brightGreen:`#9aca86`,brightYellow:`#e8c96b`,brightBlue:`#61aaf2`,brightMagenta:`#9b87f5`,brightCyan:`#e0ab96`,brightWhite:`#eae7df`},uY=`Rove Nerd Symbols`,dY=[`"JetBrains Mono"`,`"${uY}"`,`"SF Mono"`,`ui-monospace`,`Menlo`,`monospace`].join(`, `);function fY(e){switch(e.kind){case`restored`:return V(`workspace.restored`);case`notLive`:return V(`workspace.tabNotLive`);case`exited`:return e.code===null?V(`workspace.exitedNoCode`):V(`workspace.exited`,{code:e.code});case`failed`:return V(`workspace.attachFailed`,{message:e.message});case`none`:return``}}function pY(e){return e===null?V(`workspace.engineExitedNoCode`):V(`workspace.engineExited`,{code:e})}function mY(e){H();let{notice:t,engineExit:n,model:r,taskId:i,tabId:a,revive:o}=e,s=t.kind===`none`?n:null,c=t.kind===`none`&&!s&&e.usageLimit===!0&&!o.error,[l,u]=(0,h.useState)(!1);if(t.kind===`none`&&!s&&!c)return null;let d=c?r.tasks.get()?.attention.find(e=>e.taskId===i&&e.state===`rate_limited`)?.resumeAt:void 0,f=t.kind===`notLive`||t.kind===`restored`||t.kind===`exited`,p=t.kind===`exited`||s!==null,m=o.error?V(`workspace.reopenFailed`,{message:o.error}):s?pY(s.code):c?d?V(`workspace.usageLimitUntil`,{time:new Date(d).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}):V(`workspace.usageLimit`):fY(t);return(0,U.jsxs)(`div`,{className:Zn(t.kind===`failed`||!!o.error),children:[(0,U.jsx)(`span`,{children:m}),e.onReopen&&(f||s)&&(0,U.jsx)(`button`,{type:`button`,className:`link text-accent hover:underline touch-hit`,disabled:o.busy,onClick:()=>e.onReopen?.(s!==null),children:o.busy?V(`workspace.reopening`):V(s?`workspace.retry`:`workspace.reopen`)}),t.kind===`failed`&&e.onRetryAttach&&(0,U.jsx)(`button`,{type:`button`,className:`link text-accent hover:underline touch-hit`,onClick:e.onRetryAttach,children:V(`workspace.retry`)}),c&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(W,{variant:`link`,hit:`tight`,onClick:()=>k.set((0,U.jsx)(CA,{model:r,taskId:i,context:`continue`,sourceTabId:a})),children:V(`menu.continueEngine`)}),(0,U.jsx)(W,{variant:`link`,hit:`tight`,disabled:l,onClick:()=>{u(!0),r.client.request(`task.resumeQuota`,{taskId:i}).catch(e=>z(e instanceof Error?e.message:String(e),`error`)).finally(()=>u(!1))},children:V(l?`workspace.resumingQuota`:`workspace.resumeQuota`)}),(0,U.jsx)(W,{variant:`link`,hit:`tight`,onClick:e.onDismissLimit,children:V(`workspace.dismiss`)})]}),p&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`button`,{type:`button`,className:`link text-accent hover:underline touch-hit`,onClick:()=>k.set((0,U.jsx)(aU,{model:r,section:`engines`})),children:V(`workspace.engineSettings`)}),(0,U.jsx)(`button`,{type:`button`,className:`link text-accent hover:underline touch-hit`,onClick:()=>k.set((0,U.jsx)(CA,{model:r,taskId:i})),children:V(`menu.newChatPick`)}),(0,U.jsx)(W,{variant:`link`,hit:`tight`,onClick:()=>k.set((0,U.jsx)(CA,{model:r,taskId:i,context:`continue`,sourceTabId:a})),children:V(`menu.continueEngine`)})]})]})}var hY=/\x1b\[\?[0-9;]*c|\x1b\[\??[0-9;]*\$y|\x1b\](?:10|11);[^\x07\x1b]*(?:\x07|\x1b\\)/g,gY=/\x1b\[[?>=]?[0-9;]*(?:[cnRt]|\$y)|\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)|\x1bP[^\x1b]*\x1b\\/g;function _Y(e){let t=0;return{forward(n){let r=(t>0?n.replace(gY,``):n).replace(hY,``);r&&e(r)},replay(e){t++,e(()=>{t--})}}}function vY(e){return Uint8Array.from(atob(e),e=>e.charCodeAt(0))}function yY(e){return!e||typeof e!=`object`||!(`stream`in e)||typeof e.stream!=`string`?null:{stream:e.stream,...`data`in e&&typeof e.data==`string`?{data:e.data}:{},...`code`in e&&(typeof e.code==`number`||e.code===null)?{code:e.code}:{}}}var bY=65536,xY=20;function SY(e){let t=0,n=null,r=()=>{n!==null&&window.clearTimeout(n),n=null,t>0&&e(t),t=0};return{parsed(e){t+=e,t>=bY?r():n??=window.setTimeout(r,xY)},dispose(){n!==null&&window.clearTimeout(n),n=null,t=0}}}function CY(e){return!e||typeof e!=`object`||!(`stream`in e)||!(`replay`in e)?null:typeof e.stream==`string`&&typeof e.replay==`string`?{stream:e.stream,replay:e.replay}:null}function wY(e,t,n,r,i,a){let o=Bc(t,n,r);k.set((0,U.jsx)(sa,{title:oA(`reset.title`),body:oA(`reset.body`),confirmLabel:V(`workspace.reset`),onConfirm:async()=>{iY(o);try{await e.request(`tab.split`,{taskId:t,tabId:n,action:`reset`,leafId:r??`leaf-1`,...i}),await a()}finally{aY(o)}}}))}function TY(e,t){let n=``,r=0,i=()=>{r=0;let i=e.getBoundingClientRect(),a=i.width>1&&i.height>1&&[[.02,.03],[.5,.5],[.98,.97],[.02,.97],[.98,.03]].every(([t,n])=>e.contains(document.elementFromPoint(i.x+i.width*t,i.y+i.height*n)))&&!document.querySelector(`[role="menu"], [aria-modal="true"], .overlay`),o=[i.x,i.y,i.width,i.height,a].join(`,`);o!==n&&(n=o,t(i,a))},a=()=>{document.hidden?i():r||=requestAnimationFrame(i)},o=new ResizeObserver(a);o.observe(e);let s=new MutationObserver(a);return s.observe(document.body,{childList:!0,attributes:!0,subtree:!0}),window.addEventListener(`resize`,a),window.addEventListener(`scroll`,a,!0),document.addEventListener(`transitionend`,a),document.addEventListener(`visibilitychange`,a),i(),()=>{o.disconnect(),s.disconnect(),cancelAnimationFrame(r),window.removeEventListener(`resize`,a),window.removeEventListener(`scroll`,a,!0),document.removeEventListener(`transitionend`,a),document.removeEventListener(`visibilitychange`,a)}}function EY(e){let{client:t,taskId:n,tabId:r,leafId:i}=e,a=(0,h.useRef)(null),o=(0,h.useRef)(e);o.current=e;let[s,c]=(0,h.useState)({kind:`none`}),[l,u]=(0,h.useState)(0),[d,f]=(0,h.useState)(!1),p=Bc(n,r,i);return(0,h.useEffect)(()=>{if(!a.current||!UU)return;let e=a.current,s=String(l)+crypto.randomUUID(),u=(e,t={})=>UU?.postMessage({id:s,op:e,...t}),d=(e,n)=>void t.request(e,n).catch(()=>{}),f=!1,m=0,h=!1,g=0,_=0,v=null,y=SY(e=>{h&&d(`term.ack`,{stream:p,chars:e})}),b=async()=>{if(!f||!g||!_)return;let e={cols:g,rows:_},a=++m;h=!1,v=[];try{let o=await t.request(`term.attach`,{taskId:n,tabId:r,...i&&i!==`leaf-1`?{leafId:i}:{},...e,acks:!0});if(m!==a)return;h=o.alive,h&&(g!==e.cols||_!==e.rows)&&d(`term.resize`,{stream:p,cols:g,rows:_}),u(`replay`,{data:o.replay});for(let e of v??[])u(`data`,{data:e});v=null,c(o.alive?{kind:`none`}:{kind:o.restored?`restored`:`notLive`})}catch(e){m===a&&(v=null,c({kind:`failed`,message:String(e)}))}},x=!1,S=e=>{h&&d(`term.input`,{stream:p,data:e})},C=_Y(S),w={stream:p,input:S,focus:()=>u(`focus`),size:()=>({cols:g,rows:_}),reattach:b,scrollPages:e=>u(`scroll`,{direction:e}),hasSelection:()=>x,copySelection:()=>(x&&u(`copy`),x),reset:()=>wY(t,n,r,i,{cols:g,rows:_},async()=>{await b(),u(`focus`)})},T=lc(w),E=WU(e=>{if(e.id===s&&((e.action===`input`||e.action===`reply`)&&e.data&&C.forward(e.data),e.action===`selection`&&(x=e.selected===!0),e.action===`blur`&&cc.get()===w&&cc.set(null),e.action===`parsed`&&e.chars&&y.parsed(e.chars),e.action===`focus`&&(cc.set(w),o.current.onActivate?.()),e.action===`size`&&e.cols&&e.rows)){let t=!g;g=e.cols,_=e.rows,t?b():h&&d(`term.resize`,{stream:p,cols:g,rows:_})}}),D=[t.on(`term.data`,e=>{let t=yY(e);t?.stream!==p||!t.data||(v?v.push(t.data):h&&u(`data`,{data:t.data}))}),t.on(`term.reset`,e=>{let t=CY(e);h&&t?.stream===p&&u(`reset`,{data:t.replay})}),t.on(`term.exit`,e=>{let t=yY(e);t?.stream===p&&(h=!1,++m,v=null,c({kind:`exited`,code:t.code??null}),oY(p)||o.current.onExit?.())}),t.conn.subscribe(()=>{t.conn.get().state!==`open`&&(f=!1,h=!1,v=null,++m)}),t.onOpen(()=>{f=!0,b()})],O=()=>{let e=LF.get()??lY,t=getComputedStyle(document.documentElement);return{dark:t.colorScheme!==`light`,subtle:t.getPropertyValue(`--subtle`).trim(),muted:t.getPropertyValue(`--muted`).trim(),foreground:e.foreground,background:e.background,scrollback:jw.get().prefs.scrollbackRows}},k=()=>u(`appearance`,O());D.push(LF.subscribe(k),jw.subscribe(k));let A=TY(e,(e,t)=>u(`frame`,{x:e.x,y:e.y,width:e.width,height:e.height,visible:t,focus:o.current.focused!==!1,...O()}));return()=>{++m,h=!1;for(let e of D)e();T(),E(),y.dispose(),A(),u(`remove`),f&&g&&d(`term.detach`,{stream:p}),f=!1}},[t,n,r,i,p,l]),(0,U.jsx)(`div`,{className:Gn,"data-stream":p,children:(0,U.jsxs)(`div`,{className:Kn,children:[(0,U.jsx)(`div`,{className:qn,ref:a,"data-native-terminal":``}),(0,U.jsx)(mY,{model:e.model,taskId:n,tabId:r,notice:s,engineExit:e.engineExit??null,revive:{busy:d,error:null},onRetryAttach:()=>u(e=>e+1),onReopen:async e=>{f(!0);try{await t.request(`term.revive`,{taskId:n,tabId:r,...e?{restartExited:e}:{}}),u(e=>e+1)}catch(e){c({kind:`failed`,message:String(e)})}finally{f(!1)}}})]})})}var DY={up:`layout.termKeyUp`,down:`layout.termKeyDown`,left:`layout.termKeyLeft`,right:`layout.termKeyRight`,interrupt:`layout.termKeyInterrupt`,enter:`layout.termKeyEnter`};function OY({to:e,atMenu:t}){H();let n=typeof e==`function`?null:e,[r,i]=(0,h.useState)(!1),[a,o]=(0,h.useState)(!1);(0,h.useEffect)(()=>{n?.armCtrl(r?()=>i(!1):null)},[n,r]),(0,h.useEffect)(()=>()=>n?.armCtrl(null),[n]);let s=t=>typeof e==`function`?e(t.bytes(!1)):e.term.input(t.bytes(e.term.modes.applicationCursorKeysMode),!0),c=e=>(0,U.jsx)(`button`,{type:`button`,className:bn(`off`),"aria-label":DY[e.id]?V(DY[e.id]):void 0,onClick:()=>{i(!1),s(e)},children:e.cap},e.id),l=_l(t);return(0,U.jsxs)(`div`,{className:`mono ${vn}`,role:`toolbar`,"aria-label":V(`layout.termKeys`),onPointerDown:e=>e.preventDefault(),children:[a&&n&&(0,U.jsx)(`button`,{type:`button`,className:bn(r?`on`:`off`),"aria-pressed":r,onClick:()=>i(!r),children:`ctrl`}),(a?l.rest:l.first).map(c),(0,U.jsx)(`button`,{type:`button`,className:bn(r&&!a?`hint`:`off`),"aria-expanded":a,"aria-label":V(`layout.termKeyMore`),onClick:()=>o(!a),children:`⋯`}),(0,U.jsx)(iu,{label:V(`layout.termKeyHideKeyboard`)})]})}function kY(e){let t=e.split(`
104
+ `)}`,confirmLabel:a.confirm,onConfirm:async()=>{let t=await iq(e,c,n,e=>({...r(e),force:!0})),i=t.filter(e=>e.status===`fulfilled`).length;i>0&&o(i);let a=c.flatMap((e,n)=>{let r=t[n];return r?.status===`rejected`?[`${e.label}: ${G(r.reason)}`]:[]});a.length>0&&z(a.join(`
105
+ `),`error`)}}))}function oq(e,t){return aq(e,rq(t),`task.archive`,()=>({archived:!0}),`TASK_BUSY`,{title:K(`tasks`,`archive.busyTitle`),body:V(`menu.archiveManyBusy`),confirm:K(`tasks`,`archive.busyConfirm`)},e=>z(V(`menu.archivedMany`,{count:e})))}function sq(e,t){return aq(e,t,`task.delete`,()=>({}),`DIRTY_WORKTREE`,{title:V(`menu.removeManyDirtyTitle`),body:V(`menu.removeManyDirtyBody`),confirm:K(`tasks`,`confirm.forceDeleteConfirm`)},e=>z(V(`menu.removedMany`,{count:e})))}function cq(e){let{row:t}=e;return(0,U.jsxs)(`button`,{type:`button`,className:`${Xi({size:`pane`})} ${e.cursor?lg:``}`,title:V(`compare.menu`),onClick:()=>{e.onClick(),Se(t.groupId)},...e.place,children:[e.guides&&(0,U.jsx)(`span`,{className:`-mr-0.5 ml-0 flex flex-none self-stretch`,"aria-hidden":`true`,children:e.guides.map((e,t)=>(0,U.jsx)(`span`,{className:Wh(e)},t))}),(0,U.jsx)(`span`,{className:`${Zi} text-(length:--fs-meta) text-muted`,children:t.title}),(0,U.jsxs)(`span`,{className:`${na} ml-auto items-center`,children:[e.repo&&(0,U.jsx)(`span`,{className:`max-w-24 truncate text-subtle`,children:e.repo}),(0,U.jsx)(`span`,{className:`text-subtle`,children:t.tasks.length}),(0,U.jsx)(U_,{status:j_(t.tasks)})]})]})}function lq(e){let t=(0,h.useRef)(null);return(0,h.useEffect)(()=>{let e=t.current;return()=>{e&&document.activeElement===e&&e.closest(`nav`)?.focus()}},[]),(0,U.jsxs)(`div`,{className:`${og} mono items-center`,children:[(0,U.jsx)(`span`,{className:`text-accent`,children:`/`}),(0,U.jsx)(`input`,{ref:t,className:sg,type:`text`,autoFocus:!0,spellCheck:!1,autoComplete:`off`,autoCapitalize:`off`,enterKeyHint:`go`,value:e.query,placeholder:V(`rail.searchPlaceholder`),"aria-label":V(`rail.searchPlaceholder`),onChange:t=>e.onChange(t.target.value)}),e.query&&(0,U.jsx)(`span`,{className:`ml-1.5 text-muted`,children:e.count})]})}var uq=y(null);function dq(e,t){return t===`attention`?e.rowStatus?.kind===`attention`:t===`merged`?e.pr?.lifecycle===`merged`:e.group===t}function fq(e){let t=b(uq),n={attention:0,merged:0};for(let t of e){n[t.group]=(n[t.group]??0)+1;for(let e of[`attention`,`merged`])dq(t,e)&&(n[e]=(n[e]??0)+1)}return{counts:n,filter:t,onFilter:e=>uq.set(e)}}var pq=2e4;function mq(e,t){let n=Rw().prefs.statusMarkNoticeSeen===!1,r=Vw();(0,h.useEffect)(()=>{!n||t===void 0||(Iw(e.client,`statusMarkNoticeSeen`,!0),t!==0&&r!==`dots`&&z(V(`rail.markNotice`),`info`,{label:V(`rail.markNoticeUndo`),run:()=>Hw(e.client,`dots`)},pq))},[e,n,t,r])}var hq=(0,h.createContext)(null),gq=(0,h.createContext)(null);function _q({slot:e,fallback:t}){let n=(0,h.useContext)(hq);return n?(0,U.jsx)(wG,{slot:e,data:n,fallback:t}):t}function vq(e){let t=GR(),{runtimeErrors:n}=WR();return t?.manifest.slots?.[e]?.component?!n.some(n=>n.packId===t.id&&n.slot===e&&n.phase===`render`):!1}var yq=`flex flex-col gap-0.5 px-2 pb-2 font-mono text-meta`,bq=`flex items-start gap-2`,xq=`flex min-w-0 flex-1 flex-wrap items-center gap-x-2 text-left text-ink`,Sq=e=>e.replace(/^'|'$/g,``).split(`/`).pop()||e;function Cq(e,t){let n=e=>e.map(e=>e.name).join(`, `),r=e.engines.length+e.signedOut.length>0,i=e.signedOut[0],a=e.engines.filter(e=>e.login!==`unknown`),o=[{id:`engine`,ok:r,label:r?V(`firstRun.engineFound`,{list:n([...e.engines,...e.signedOut])}):V(`firstRun.engineMissing`),fix:V(`firstRun.engineFix`),run:()=>k.set((0,U.jsx)(oU,{model:t,section:`engines`}))},{id:`login`,ok:e.engines.length>0,label:a.length>0?V(`firstRun.loginFound`,{list:n(a)}):e.engines.length>0?V(`firstRun.loginUnknown`,{list:n(e.engines)}):V(i?`firstRun.loginMissing`:`firstRun.loginWaiting`,{list:n(e.signedOut)}),fix:V(`firstRun.loginFix`,{name:i?.name??``}),...ff()&&i?{instead:V(`firstRun.loginFixTouch`,{command:Sq(i.signIn??i.id)})}:{},run:()=>void ty((e,n)=>t.client.request(e,n),null,i?.signIn??i?.id??``).then(e=>e&&t.selectWhenListed(e)).catch(e=>z(e instanceof Error?e.message:String(e),`error`))}];return e.project!==void 0&&o.push({id:`project`,ok:e.project!==null,label:e.project?V(`firstRun.projectFound`,{name:e.project.split(/[\\/]/).pop()??e.project}):V(`firstRun.projectMissing`),fix:V(`firstRun.projectFix`),run:()=>L({pickProject:!0})}),o}function wq({model:e}){H(),b(Rs);let[t,n]=(0,h.useState)(()=>J(e,`welcome.env`)??null),r=b(k)!==null;(0,h.useEffect)(()=>{if(r)return;let t=!0,i=()=>ss(e,`welcome.env`).then(e=>t&&n(e)).catch(()=>{});return i(),window.addEventListener(`focus`,i),()=>{t=!1,window.removeEventListener(`focus`,i)}},[e,r]);let i=t===null?[]:Cq(t,e),a=i.find(e=>!e.ok);return(0,U.jsx)(`div`,{className:Vd,"data-field":`welcome`,children:(0,U.jsxs)(`div`,{className:Hd,children:[(0,U.jsx)(df,{scene:`rings`}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(`h1`,{className:`m-0 font-sans text-title font-semibold text-ink`,children:V(`firstRun.title`)}),(0,U.jsx)(`p`,{className:`m-0 font-sans text-body text-muted`,children:V(`firstRun.body`)})]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,U.jsx)(`button`,{type:`button`,className:Rr(),"data-field":`start-first-task`,onClick:()=>Yb(t?.start?.repo),children:V(`firstRun.start`)}),(0,U.jsx)(`span`,{className:`keys-only mono text-meta text-subtle`,children:qs(`task.new.global`)})]}),t!==null&&(0,U.jsxs)(`div`,{className:`flex w-full flex-col gap-2 font-sans text-meta`,"data-field":`first-run-checks`,children:[(0,U.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1.5 p-0 text-left`,children:i.map(e=>(0,U.jsxs)(`li`,{className:`flex min-h-7 items-center gap-2`,"data-check":e.id,"data-ok":e.ok,children:[(0,U.jsx)(`span`,{className:`mono w-[1ch] flex-none text-center ${e.ok?`text-success`:`text-warning`}`,"aria-hidden":!0,children:e.ok?`✓`:`✗`}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1 ${e.ok?`text-subtle`:`text-ink`}`,children:[e.label,e===a&&e.instead&&(0,U.jsx)(`span`,{className:`block text-muted`,children:e.instead})]}),e===a&&!e.instead&&(0,U.jsx)(W,{variant:`action`,onClick:e.run,children:e.fix})]},e.id))}),!t.git&&(0,U.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,U.jsx)(`p`,{className:`m-0 text-warning`,children:K(`workspace`,`welcome.gitMissing`)}),(0,U.jsx)(`p`,{className:`mono m-0 text-accent`,children:K(`doctor`,`fix.gitAction`)})]})]})]})})}function Tq(e,t){e.preventDefault(),O.set({x:e.clientX,y:e.clientY,items:t,target:e.currentTarget,fromKeyboard:e.button!==2})}function Eq({model:e,narrow:t}){let n=H(),r=b(e.tasks),i=b(e.remote),a=Cg(e),o=b(e.tabs),s=lS(e);mq(e,r?.tasks.length);let c=b(e.selection),l=r?.tasks??[],u=fq(l),d=u.filter?l.filter(e=>dq(e,u.filter??``)):l,f=r?.attention.filter(e=>e.unread).length??0,p=c.taskId,m=b(M)===null?p:null,g=new Map([...d,...i].map(e=>[e.id,e])),_=uK(),v=b(Ek),y=b(ZK).ids,x=b(_k)===`state`,S=e=>(x?AA:Wo)({tasks:d,remote:i,machines:a,sort:_.sort,query:e,fold:{..._.hand,selectedId:p??void 0}}),C=S(_.search.active?_.search.query:``),{groups:w}=C,T=_.search.active?C.rows:Ko(gK(C.rows,o),_.collapsed),D=new Map,O=``;for(let e of C.rows)e.kind===`project`||e.kind===`state`?O=e.id:e.kind===`task`&&D.set(O,(D.get(O)??0)+1);let A=e=>e.filter(e=>e.kind!==`project`&&e.kind!==`state`&&e.kind!==`round`),j=(n===`zh`?Aa:ka).machine,ee=new Set(a.filter(e=>e.state!==`online`).map(e=>e.alias)),te=w.filter(e=>!e.noProject&&e.machine===void 0).map(e=>e.repo),ne=e=>{let t=te.indexOf(e);return{label:fo(e),local:t>=0,top:t>0?te[0]??null:null,above:t>0?te[t-1]??null:null,below:t>=0?te[t+1]??null:null}},N=VW(e,d,!_.search.active&&!x,_.sort==="default"),{place:P,dragging:re}=N.places(T),ie=()=>k.set((0,U.jsx)(oU,{model:e})),F=()=>k.set((0,U.jsx)(Mu,{model:e})),I=mK(e,T,_,{selectedId:p,onNewTask:Yb,onSettings:ie}),ae=A(S(``).rows).length,L=(0,h.useRef)(null),R=b(yW)&&!t,oe=b(bW)&&R,se=t?d.find(e=>e.id===c.taskId&&!e.deleting)??null:null,ce=t?WK:IK,z=GR(),le=!t&&!R?tz(z?.manifest.layout?.frame):``,ue=MJ(e),B=(0,h.useContext)(hq),de=!t&&!!z?.manifest.slots?.[`rail.header`],fe=!t&&!!z?.manifest.slots?.[`shell.topBar`]?.component,pe=(0,U.jsxs)(`header`,{className:ag,children:[(0,U.jsxs)(`span`,{className:`${ar} ${t?``:`mr-auto`}`,"data-wordmark":!0,children:[(0,U.jsx)(`span`,{className:or,children:`[`}),` rove `,(0,U.jsx)(`span`,{className:or,children:`]`})]}),t&&(0,U.jsx)(XK,{model:e}),t&&(0,U.jsx)(`span`,{className:`mr-auto`}),!t&&(0,U.jsxs)(`span`,{className:`relative`,children:[(0,U.jsx)(`button`,{type:`button`,className:`m-0 text-meta font-medium normal-nums inbox-chip relative font-mono hover:text-accent ${dn} ${f>0?`text-accent`:`text-muted`}`,onClick:F,children:V(`rail.inbox`,{count:f})}),(0,U.jsx)(FU,{model:e,bindingId:`inbox.show`,head:!0})]}),!t&&(0,U.jsx)(tF,{}),!t&&(0,U.jsx)(TW,{client:e.client,railBar:!0}),t&&(0,U.jsx)(qK,{model:e}),t&&(0,U.jsx)(JK,{model:e})]}),me=(0,U.jsxs)(`nav`,{"data-tp-region":`rail`,className:`${ig} ${le} ${R?`is-folded`:``}`,ref:L,style:fe?{paddingTop:0}:void 0,inert:R&&!oe,"aria-hidden":R&&!oe,onMouseEnter:R?()=>CW(!0):void 0,onMouseLeave:R?()=>CW(!1):void 0,tabIndex:0,onKeyDown:e=>eq(e)||I.onKeyDown(e),children:[t?B?(0,U.jsx)(wG,{slot:`phone.listHeader`,data:{...B,query:_.search.active?_.search.query:``,onSearch:e=>_.setSearch(t=>({...t,active:e!==``,query:e}))},fallback:pe}):pe:(0,U.jsx)(wG,{slot:`rail.header`,data:{...u,taskCount:l.length+i.length,unreadCount:f,narrow:t,query:_.search.active?_.search.query:``,onSearch:e=>_.setSearch(t=>({...t,active:e!==``,query:e})),onNewSession:()=>Xb(),onOpenInbox:F,pages:ue},fallback:pe}),t&&(0,U.jsxs)(`div`,{className:`-mt-1 flex items-center gap-2 px-4 pb-2 empty:hidden`,children:[(0,U.jsx)(tF,{}),(0,U.jsx)(TW,{client:e.client})]}),t&&r&&(0,U.jsx)(GK,{model:e}),v&&(0,U.jsxs)(`div`,{className:`flex gap-1 px-3.5 pb-2 text-meta mono`,children:[(0,U.jsx)(`span`,{className:`text-accent`,children:K(`tasks`,`moveChip`).trim()}),(0,U.jsx)(`span`,{className:`keys-only ml-1.5 text-muted`,children:(0,U.jsx)(ju,{text:V(`taskops.moveHint`)})})]}),_.search.active&&(0,U.jsx)(lq,{query:_.search.query,count:`${A(T).length}/${ae}`,onChange:e=>_.setSearch(t=>({...t,query:e}))}),!t&&!de&&(0,U.jsx)(NJ,{model:e}),(0,U.jsxs)(`div`,{"data-rail-body":!0,className:cg(re!==null),...N.body,onPointerDownCapture:I.onPress,children:[r&&d.length===0&&i.length===0&&t&&(0,U.jsx)(wq,{model:e}),r&&d.length===0&&i.length===0&&!t&&(0,U.jsx)(`p`,{className:`m-0 px-2 py-3 font-mono text-meta text-subtle`,children:V(`rail.empty`)}),se&&(0,U.jsx)(IW,{title:se.title}),T.map((n,r)=>n.kind===`round`?(0,U.jsx)(cq,{row:n,guides:n.depth>1?HU(T,r):void 0,repo:x&&n.depth===1?OA(n.tasks[0]):void 0,cursor:n.id===I.cursor,place:P(n),onClick:()=>I.setCursor(n.id)},n.id):n.kind===`pane`?(0,U.jsx)(UG,{selectedTabId:n.task.id===m?c.tabId:null,row:n,guides:HU(T,r),cursor:n.id===I.cursor,place:P(n),onClick:()=>{I.setCursor(n.id),HG(e,n),ye()},onMenu:t=>{I.setCursor(n.id),Tq(t,RG(e,n.task.id,n.tab,n.leaf))}},n.id):(0,U.jsx)(ce,{row:n,guides:n.kind===`task`&&n.depth>1?HU(T,r):void 0,cloud:bg(n,a,j),repo:x&&n.kind===`task`&&n.depth===1?OA(n.task):void 0,tabs:n.kind===`task`?o[n.task.id]:void 0,engineIcon:n.kind===`task`?s.get(n.task.engine?.id??``):void 0,selected:n.id===m,cursor:n.id===I.cursor&&re===null,stale:n.machine!==void 0&&ee.has(n.machine),collapsed:(n.kind===`project`||n.kind===`state`)&&_.collapsed.has(n.id),count:D.get(n.id),drag:N.props(n),swipe:t&&n.kind===`task`&&n.machine===void 0&&!n.task.archived?tK(e,n.task):void 0,dragging:re===n.id,place:P(n),onNewTask:n.kind===`project`?n.noProject?Xb:()=>Yb(n.repo,n.machine):void 0,moving:y.has(n.id)||v&&n.machine===void 0&&n.kind!==`project`&&n.id===I.cursor,prTasks:n.kind===`task`&&n.fold?.collapsed?[n.task,...n.fold.descendantIds.flatMap(e=>g.get(e)??[])]:void 0,rollup:n.kind===`task`&&n.fold?.collapsed?j_([n.task,...n.fold.descendantIds.flatMap(e=>g.get(e)??[])]):void 0,onToggleFold:()=>{n.kind===`task`&&_.toggleTaskFold(n.id,n.fold?.collapsed===!0)},onClick:t=>{n.kind===`task`&&t&&$K(t,n.id,T,m)||(I.setCursor(n.id),(n.kind===`project`||n.kind===`state`)&&_.toggleProject(n.id),n.kind===`task`&&pK(e,n.task.id))},onMenu:t=>{if(n.kind===`project`&&n.machine!==void 0)return;if(n.kind===`project`&&n.noProject){Tq(t,QG(e));return}if(n.kind===`project`){Tq(t,ZG(e,n.repo,ne(n.repo)));return}if(n.kind!==`task`)return;I.setCursor(n.id);let r=tq(e,n.id,T);if(r)return Tq(t,r);Tq(t,E(Oq(Dq(nK(e,n.task,null),n.fold,()=>_.toggleTaskFold(n.id,n.fold?.collapsed===!0)),VG(e,n.task.id)),V(`menu.more`)))}},n.id))]}),(0,U.jsx)(OG,{model:e,narrow:t,onSettings:ie,inbox:{count:f,onClick:F}}),!t&&!R&&(0,U.jsx)(OW,{rail:L})]});return(0,U.jsx)(wG,{slot:`rail.frame`,data:{unreadCount:f,taskCount:d.length+i.length,groupBy:x?`state`:`project`,sortBy:_.sort,folded:R,narrow:t},fallback:me})}function Dq(e,t,n){if(!t)return e;let r={label:K(`tasks`,t.collapsed?`menu.expandChildren`:`menu.collapseChildren`),section:`open`,rare:!0,run:n},i=e.map(e=>e.section).lastIndexOf(`open`);return[...e.slice(0,i+1),r,...e.slice(i+1)]}function Oq(e,t){let n=e.map(e=>e.section).lastIndexOf(`open`);return[...e.slice(0,n+1),...t.map(e=>({...e,rare:!0})),...e.slice(n+1)]}var kq=e=>Date.parse(e.updatedAt??e.createdAt??``)||0;function Aq(e,t,n){return(n===`archived`?e?.archived??[]:e?.tasks??[]).filter(e=>!e.routine).filter(e=>t===null||!Mo(e)&&yS(e.repo)===yS(t)).sort((e,t)=>kq(t)-kq(e))}function jq(e){let t=new Set,n=[];for(let r of[...e?.tasks??[],...e?.archived??[]]){if(r.routine||Mo(r)||r.repo.startsWith(`ssh://`))continue;let e=yS(r.repo);t.has(e)||(t.add(e),n.push(r.repo))}return n}function Mq({tabs:e,value:t,onChange:n,className:r}){return(0,U.jsx)(`div`,{className:Kt(`flex gap-1`,r),role:`tablist`,children:e.map(e=>{let r=e.id===t;return(0,U.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":r,className:Kt(`relative rounded-sm px-2.5 py-0.75 font-mono text-meta font-semibold`,`touch:after:absolute touch:after:content-[''] touch:after:-inset-x-0.5 touch:after:-top-2 touch:after:-bottom-1.5`,r?`bg-inset text-ink group-focus-within/pane:text-accent`:`text-muted`),onClick:()=>n(e.id),children:e.label},e.id)})})}function Nq({model:e}){let{common:t}=gS(),n=b(e.tasks),r=b(P)??``,[i,a]=(0,h.useState)(`active`),[o,s]=(0,h.useState)(0),c=jq(n),l=r===``?null:r,u=Aq(n,l,i),d=Math.min(o,Math.max(0,u.length-1)),f=(0,h.useRef)(null);(0,h.useEffect)(()=>f.current?.focus(),[]);let p=(0,h.useRef)(null);(0,h.useEffect)(()=>{p.current?.querySelector(`[data-row="${d}"]`)?.scrollIntoView({block:`nearest`})},[d]);let m=t=>{M.set(null),e.select(t)},g=e=>{a(e),s(0)},_=e=>{let t=[``,...c],n=t.findIndex(e=>e===``?r===``:yS(e)===yS(r));P.set(t[(Math.max(0,n)+(e?t.length-1:1))%t.length]??``),s(0)};ES(e=>{if(e.ctrlKey)return e.key===`c`&&(M.set(null),!0);let t=u[d];switch(e.key){case`Escape`:case`q`:return M.set(null),!0;case`j`:case`ArrowDown`:return s(Math.min(u.length-1,d+1)),!0;case`k`:case`ArrowUp`:return s(Math.max(0,d-1)),!0;case`Tab`:return _(e.shiftKey),!0;case`a`:return g(i===`active`?`archived`:`active`),!0;case`Enter`:return t&&m(t.id),!0;default:return!1}});let v=Date.now();return(0,U.jsxs)(`div`,{className:`group/pane ${Ww}`,tabIndex:0,ref:f,children:[(0,U.jsxs)(`div`,{className:Kw,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,U.jsx)(`h1`,{className:Gw,children:V(`sessions.title`)}),(0,U.jsx)(Mq,{tabs:[{id:`active`,label:V(`sessions.active`)},{id:`archived`,label:V(`sessions.archived`)}],value:i,onChange:g})]}),(0,U.jsx)(`span`,{className:`mono touch:empty:hidden! text-muted ${qw(!0)}`,children:l?bS(l,c):V(`sessions.allProjects`)})]}),n?u.length===0?(0,U.jsx)(`p`,{className:`text-muted`,children:V(i===`archived`?`sessions.emptyArchived`:`sessions.emptyActive`)}):(0,U.jsx)(`div`,{className:Xw,ref:p,children:u.map((t,n)=>{let r=Date.parse(t.updatedAt??t.createdAt??``);return(0,U.jsx)(`div`,{"data-row":n,className:Zw(n===d),onClick:()=>m(t.id),onContextMenu:r=>{s(n),Tq(r,E(nK(e,t,null),V(`menu.more`)))},children:(0,U.jsxs)(`div`,{className:Qw,children:[(0,U.jsx)(`span`,{className:tT,title:t.label,children:t.label}),l===null&&!Mo(t)?(0,U.jsx)(`span`,{className:`mono text-meta ${$w}`,children:bS(t.repo,c)}):null,(0,U.jsx)(`span`,{className:`mono text-meta ${$w}`,children:Number.isFinite(r)?gT(r,v):``})]})},t.id)})}):(0,U.jsx)(`p`,{className:`text-muted`,children:t.loading}),(0,U.jsx)(`p`,{className:`mt-2.5 mb-0 text-meta text-subtle touch:hidden`,children:V(`sessions.keys`)})]})}function Pq({active:e=!1,onSelect:t,plus:n=!1,children:r}){return(0,U.jsxs)(`button`,{type:`button`,className:`rail-nav-row ${oT(e)}`,"aria-current":e?`page`:void 0,onClick:t,children:[r,n?(0,U.jsx)(`span`,{className:sT,"aria-hidden":`true`,children:`+`}):null]})}var Fq=`mx-auto flex max-w-[76rem] flex-col font-mono text-meta leading-[1.5]`,Iq=`flex items-end justify-between gap-[4ch]`,Lq=`m-0 text-title font-bold tracking-[0.02em]`,Rq=`font-bold tracking-code uppercase`,zq=`text-muted`,Bq=`text-subtle`,Vq=`my-4 border-t-hairline border-dashed! border-line-active`,Hq=`m-0 mb-1.5 text-meta text-muted ${Rq}`,Uq=`${Hq} flex flex-wrap items-baseline justify-between gap-x-[4ch]`,Wq=`flex flex-wrap items-start gap-x-[8ch] gap-y-4`,Gq=`min-w-[min(100%,36ch)] flex-1`,Kq=`text-[3.5rem] leading-none font-bold tracking-[-0.03em]`,qq=`grid grid-cols-[repeat(auto-fit,minmax(min(100%,34ch),1fr))] items-start gap-x-[6ch] gap-y-5`,Jq=`flex min-w-0 items-baseline gap-[1ch] whitespace-nowrap`,Yq=`min-w-0 truncate`,Xq=`min-w-[2ch] flex-1 -translate-y-0.75 border-b-hairline border-dotted! border-line-active`,Zq=`pl-[2ch] text-subtle`,Qq=`-mx-[1ch] block rounded-sm px-[1ch] py-0.5 text-left`,$q=`${Qq} w-[calc(100%+2ch)] cursor-pointer hover:bg-hover focus-visible:outline-1 focus-visible:-outline-offset-1 focus-visible:outline-focus`,eJ=`grid grid-cols-[6ch_minmax(0,1fr)_5ch_5ch_8ch] items-center gap-x-[2ch] py-0.5 whitespace-nowrap`,tJ=[`bg-accent`,`bg-info`,`bg-merged`,`bg-subtle`],nJ=`grid grid-cols-[minmax(0,1fr)_minmax(8ch,14ch)_5ch] items-center gap-x-[1ch] whitespace-nowrap`,rJ=`relative h-2.5 border-hairline border-current after:absolute after:inset-y-0 after:left-0 after:w-(--fill) after:bg-current after:content-['']`,iJ={ok:`${rJ} text-success`,warn:`${rJ} text-warning`,crit:`${rJ} text-error`},aJ=`flex h-9 flex-none items-stretch text-ink`,oJ=`flex-none bg-current`,sJ=`flex flex-wrap items-baseline justify-between gap-x-[4ch] gap-y-1 text-subtle`,cJ={turns:0,tokens:0,ms:0},lJ=e=>(e.usage?.input_tokens??0)+(e.usage?.output_tokens??0),uJ=e=>Math.max(0,e.endedAt-e.startedAt),dJ=(e,t)=>({turns:e.turns+1,tokens:e.tokens+lJ(t),ms:e.ms+uJ(t)});function fJ(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function pJ(e,t,n,r){let i=[];for(let e=n-1;e>=0;e--){let n=new Date(t);n.setDate(n.getDate()-e),i.push(fJ(n.getTime()))}let a=new Map(i.map(e=>[e,{sum:cJ,byEngine:{}}]));for(let t of e){let e=a.get(fJ(t.startedAt));if(!e)continue;let n=t.vendor??`unknown`;e.sum=dJ(e.sum,t),e.byEngine[n]=(e.byEngine[n]??0)+lJ(t)}let o=e.reduce((e,t)=>Math.min(e,t.startedAt),1/0),s=e.length>=r&&Number.isFinite(o)?{count:e.length,day:fJ(o)}:null;return{cutoff:s,days:i.map(e=>{let t=a.get(e);return{day:e,...t?.sum??cJ,byEngine:t?.byEngine??{},partial:s!==null&&e<=s.day}})}}function mJ(e){let t=new Map;for(let n of e){let e=n.vendor??`unknown`,r=n.model??`unknown`,i=`${e}\0${r}`;t.set(i,{engine:e,model:r,...dJ(t.get(i)??cJ,n)})}return[...t.values()].sort((e,t)=>t.tokens-e.tokens||t.turns-e.turns)}function hJ(e,t){let n=new Map;for(let t of e)n.set(t.taskId,{taskId:t.taskId,...dJ(n.get(t.taskId)??cJ,t)});return[...n.values()].sort((e,t)=>t.tokens-e.tokens||t.turns-e.turns).slice(0,t)}function gJ(e){return e<1e3?String(e):e<1e6?`${(e/1e3).toFixed(+(e<1e4)).replace(/\.0$/,``)}k`:`${(e/1e6).toFixed(+(e<1e7)).replace(/\.0$/,``)}M`}var _J=.1,vJ=/^(\d+)\s*(h|d)$/;function yJ(e,t){let n=vJ.exec(e.label.trim());if(!n||e.resetsAt===null||e.percent<=0)return null;let r=Number(n[1])*(n[2]===`d`?24:1)*36e5,i=r-(e.resetsAt-t);if(!(i>=r*_J)||i>r)return null;if(e.percent>=100)return{kind:`full`,at:t};let a=t+(100-e.percent)/e.percent*i;return a<e.resetsAt?{kind:`full`,at:a}:{kind:`lasts`}}var bJ=14,xJ=500,SJ=3e4,CJ=8;function wJ(e,t,n,r){let i=J(e,t,n),[a,o]=(0,h.useState)(i?{kind:`ready`,value:i}:{kind:`loading`}),s=b(e.client.conn).state===`open`,c=JSON.stringify(n);return(0,h.useEffect)(()=>{if(!s)return;let r=!0;return ss(e,t,n).then(e=>r&&o({kind:`ready`,value:e})).catch(e=>r&&o(t=>t.kind===`ready`?t:{kind:`failed`,error:vS(e)})),()=>{r=!1}},[e,t,c,r,s]),a}var TJ=()=>(0,U.jsx)(`div`,{className:Vq});function EJ({name:e,title:t,sum:n,sub:r,open:i}){let a=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`span`,{className:Jq,children:[(0,U.jsx)(`span`,{className:Yq,title:t,children:e}),(0,U.jsx)(`span`,{className:Xq}),(0,U.jsx)(`span`,{children:gJ(n.tokens)})]}),(0,U.jsx)(`span`,{className:`block truncate ${Zq}`,children:[r,`${n.turns}t`,AO(n.ms)].filter(Boolean).join(` · `)})]});return i?(0,U.jsx)(W,{variant:`row`,className:$q,onClick:i,children:a}):(0,U.jsx)(`div`,{className:Qq,children:a})}function DJ({sum:e}){let t=`${e.tokens}${e.turns}${e.ms}`.repeat(4).slice(0,36);return(0,U.jsx)(`div`,{className:aJ,"aria-hidden":`true`,children:[...t].map((e,t)=>(0,U.jsx)(`span`,{className:oJ,style:{width:1+Number(e)%3,marginRight:1+Number(e)%2}},t))})}function OJ({usage:e,nameOf:t}){let n=Date.now(),r=e.flatMap(e=>e.windows.map(r=>{let i=yJ(r,n),a=i?.kind===`full`&&i.at-n<72e6,o=i?.kind===`full`?Z(V(`usage.full`),{time:new Date(i.at).toLocaleString([],{...a?{}:{weekday:`short`},hour:`2-digit`,minute:`2-digit`})}):i?V(`usage.lasts`):``;return{key:`${e.vendor}:${r.kind}`,name:`${e.name||t(e.vendor)} ${r.label}`,percent:Math.round(r.percent),tone:JH({capturedAt:e.capturedAt,windows:[r]},n)?.tone??`ok`,note:o}}));return r.length===0?null:(0,U.jsxs)(`section`,{children:[(0,U.jsx)(`h2`,{className:Hq,children:V(`usage.quota`)}),r.map(e=>(0,U.jsxs)(`div`,{className:`py-0.5`,children:[(0,U.jsxs)(`div`,{className:nJ,children:[(0,U.jsx)(`span`,{className:Yq,children:e.name}),(0,U.jsx)(`span`,{className:iJ[e.tone]??iJ.ok,style:{"--fill":`${Math.min(100,Math.max(0,e.percent))}%`}}),(0,U.jsx)(`span`,{className:`text-right ${nr[e.tone]}`,children:`${e.percent}%`})]}),e.note&&(0,U.jsx)(`div`,{className:`pl-[2ch] text-subtle`,children:e.note})]},e.key))]})}function kJ({model:e}){H();let t=DS(),[n]=wS(SJ),r=wJ(e,`turns.list`,{sinceDays:bJ,limit:xJ},n),i=wJ(e,`engines.list`,{},n),a=wJ(e,`usage.get`,{},n),o=b(e.tasks),s=i.kind===`ready`?i.value.engines:[],c=e=>s.find(t=>t.id===e)?.name??e,l=e=>o?.tasks.find(t=>t.id===e)?.label??V(`usage.removedTask`),u=a.kind===`ready`&&a.value.usage&&(0,U.jsx)(OJ,{usage:a.value.usage,nameOf:c});return(0,U.jsx)(`div`,{className:Ww,tabIndex:0,ref:t,onKeyDown:e=>{e.metaKey||e.ctrlKey||e.altKey||e.key!==`q`&&e.key!==`Escape`||(e.preventDefault(),M.set(null))},children:(0,U.jsx)(`div`,{className:Fq,children:(()=>{if(r.kind===`loading`)return(0,U.jsx)(`p`,{className:`m-0 ${zq}`,children:V(`usage.loading`)});if(r.kind===`failed`)return(0,U.jsx)(`p`,{className:`m-0 text-error`,children:Z(V(`usage.failed`),{error:r.error})});let t=r.value.turns,n=new Set(r.value.readers??[]),i=pJ(t,Date.now(),bJ,xJ),a=new Map;for(let e of i.days)for(let[t,n]of Object.entries(e.byEngine))a.set(t,(a.get(t)??0)+n);let s=[...a].sort((e,t)=>t[1]-e[1]).map(([e])=>e),d=e=>tJ[Math.max(0,s.indexOf(e))%tJ.length]??tJ[0],f=Math.max(0,...i.days.map(e=>e.tokens)),p=i.days.slice(Math.max(0,i.days.findIndex(e=>e.turns>0))),m=i.days.reduce((e,t)=>({turns:e.turns+t.turns,tokens:e.tokens+t.tokens,ms:e.ms+t.ms}),{turns:0,tokens:0,ms:0}),h=[...new Set((o?.tasks??[]).flatMap(e=>e.engine?.id&&!n.has(e.engine.id)?[e.engine.id]:[]))];return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:Iq,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`h1`,{className:Lq,children:[(0,U.jsx)(`span`,{className:or,children:`[`}),` rove `,(0,U.jsx)(`span`,{className:or,children:`]`})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{className:Rq,children:V(`usage.receipt`)}),(0,U.jsx)(`span`,{className:zq,children:` ${i.days[0]?.day.slice(5)} → ${i.days.at(-1)?.day.slice(5)}`})]})]}),t.length>0&&(0,U.jsx)(DJ,{sum:m})]}),(0,U.jsx)(TJ,{}),t.length===0?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`m-0 ${zq}`,children:V(`usage.empty`)}),u&&(0,U.jsx)(TJ,{}),u]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:Wq,children:[(0,U.jsxs)(`section`,{children:[(0,U.jsx)(`h2`,{className:Hq,children:V(`usage.total`)}),(0,U.jsx)(`div`,{className:Kq,children:gJ(m.tokens)}),(0,U.jsx)(`div`,{className:`mt-1.5 ${zq}`,children:`${Z(V(m.turns===1?`usage.turnsOne`:`usage.turns`),{count:m.turns})} · ${AO(m.ms)}`})]}),(0,U.jsxs)(`section`,{className:Gq,children:[(0,U.jsxs)(`h2`,{className:Uq,children:[V(`usage.perDay`),s.length>1&&(0,U.jsx)(`span`,{className:`flex flex-wrap gap-x-[2ch] font-normal tracking-normal normal-case`,children:s.map(e=>(0,U.jsxs)(`span`,{children:[(0,U.jsx)(`span`,{className:`mr-[1ch] inline-block size-2 align-baseline ${d(e)}`}),c(e)]},e))})]}),p.map(e=>(0,U.jsxs)(`div`,{className:eJ,children:[(0,U.jsx)(`span`,{className:zq,children:`${e.day.slice(5)}${e.partial?`~`:``}`}),(0,U.jsx)(`span`,{className:`flex min-w-0`,children:e.tokens>0&&f>0&&(0,U.jsx)(`span`,{className:`flex h-2.5 w-(--fill) min-w-0.5 gap-px`,style:{"--fill":`${e.tokens/f*100}%`},children:s.map(t=>(e.byEngine[t]??0)>0&&(0,U.jsx)(`span`,{className:`min-w-0.5 basis-0 ${d(t)}`,style:{flexGrow:e.byEngine[t]}},t))})}),e.turns>0&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:`text-right`,children:gJ(e.tokens)}),(0,U.jsx)(`span`,{className:`text-right text-subtle`,children:`${e.turns}t`}),(0,U.jsx)(`span`,{className:`text-right text-subtle`,children:AO(e.ms)})]})]},e.day))]})]}),(0,U.jsx)(TJ,{}),(0,U.jsxs)(`div`,{className:qq,children:[(0,U.jsxs)(`section`,{children:[(0,U.jsx)(`h2`,{className:Hq,children:V(`usage.byModel`)}),mJ(t).map(e=>(0,U.jsx)(EJ,{name:e.model,title:`${c(e.engine)} · ${e.model}`,sum:e,sub:c(e.engine)},`${e.engine}\0${e.model}`))]}),(0,U.jsxs)(`section`,{children:[(0,U.jsx)(`h2`,{className:Hq,children:V(`usage.topTasks`)}),hJ(t,CJ).map(t=>{let n=o?.tasks.some(e=>e.id===t.taskId),r=l(t.taskId);return(0,U.jsx)(EJ,{name:n?r:(0,U.jsx)(`span`,{className:Bq,children:r}),title:r,sum:t,open:n?()=>{M.set(null),e.select(t.taskId)}:null},t.taskId)})]}),u]})]}),(0,U.jsx)(TJ,{}),(0,U.jsxs)(`div`,{className:sJ,children:[(0,U.jsx)(`span`,{children:Z(V(`usage.range`),{days:bJ})}),i.cutoff&&(0,U.jsx)(`span`,{children:Z(V(`usage.cutoff`),{count:i.cutoff.count,day:i.cutoff.day.slice(5)})}),h.length>0&&(0,U.jsx)(`span`,{children:Z(V(`usage.noReader`),{engines:h.map(c).join(`, `)})}),(0,U.jsx)(`span`,{className:`${Rq} ml-auto`,children:V(`usage.thanks`)})]})]})})()})})}var AJ={id:`mods`,label:`mods`},jJ=[{id:`kanban`,label:`kanban`,mod:`kanban`},{id:`routines`,label:`automations`},{id:`issues`,label:`issues`,mod:`issues`}];function MJ(e){let{nav:t}=gS(),n=b(M),r=b(e.mods).length>0,i=b(e.installedMods);return[...jJ.filter(e=>!e.mod||i.has(e.mod)),...r?[AJ]:[]].map(e=>({id:e.id,label:t[e.label],active:n===e.id,onOpen:()=>xe(e.id)}))}function NJ({model:e}){let t=MJ(e);return(0,U.jsxs)(`div`,{className:nT,children:[(0,U.jsx)(Pq,{plus:!0,onSelect:()=>Yb(),children:V(`rail.newTask`)}),t.map(e=>(0,U.jsx)(Pq,{active:e.active,onSelect:e.onOpen,children:e.label},e.id))]})}function PJ({model:e,page:t}){let n=b(e.installedMods);return t===`kanban`&&n.has(`kanban`)?(0,U.jsx)(kE,{model:e}):t===`routines`?(0,U.jsx)(mk,{model:e}):t===`issues`&&n.has(`issues`)?(0,U.jsx)(OT,{model:e}):t===`mods`?(0,U.jsx)(ZE,{model:e}):t===`compare`?(0,U.jsx)(mT,{model:e}):t===`usage`?(0,U.jsx)(kJ,{model:e}):t===`sessions`?(0,U.jsx)(Nq,{model:e}):t===`update`?(0,U.jsx)(aF,{client:e.client}):null}var FJ=e=>e.split(` + `).map(e=>Is(e)).join(` + `);function IJ(e){let t=uA(Vk(e.scope));return e.kind===`here`?oA(`here`,{surface:t}):e.kind===`direct`?oA(`direct`):e.kind===`prefix`?oA(`afterPrefix`):oA(`otherPane`,{surface:t})}function LJ(e){let t=document.activeElement instanceof HTMLElement?document.activeElement:null;k.set((0,U.jsx)(RJ,{model:e,surface:ic(),origin:t}))}function RJ({model:e,surface:t,origin:n}){H();let r=b(Rs),[i,a]=(0,h.useState)(!1),[o,s]=(0,h.useState)(``),c=(0,h.useRef)(null),l=(0,h.useMemo)(()=>ac(e,t),[e,t]),u=(0,h.useMemo)(()=>zk(oc(),t===`terminal`?`terminal`:t,Us(),l),[l,t,r]).map(e=>({...e,rows:e.rows.filter(e=>Uk(o,cA(e.binding.id),e.primary))})).filter(e=>e.rows.length>0);return(0,h.useEffect)(()=>()=>n?.focus(),[n]),(0,h.useEffect)(()=>{let e=c.current,t=t=>{if(!e||t.ctrlKey||t.metaKey||t.altKey)return;let n=e.clientHeight;if(t.key===`ArrowUp`)e.scrollBy({top:-24});else if(t.key===`ArrowDown`)e.scrollBy({top:24});else if(t.key===`PageUp`)e.scrollBy({top:-n});else if(t.key===`PageDown`)e.scrollBy({top:n});else if(t.key===`Home`)e.scrollTo({top:0});else if(t.key===`End`)e.scrollTo({top:e.scrollHeight});else if(!i&&t.key===`?`)B();else if(!i&&t.key===`/`)a(!0);else return;t.preventDefault()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[i]),(0,U.jsx)(ia,{title:oA(`title`),wide:!0,children:(0,U.jsxs)(`div`,{className:`${hi} help`,children:[(0,U.jsxs)(`div`,{className:jn,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`text-muted`,children:t?oA(`focused`,{surface:uA(Vk(t))}):oA(`allBindings`)}),(0,U.jsx)(`p`,{className:`text-muted`,children:oA(`grammar`,{prefix:Ws()})})]}),(0,U.jsxs)(`div`,{className:Mn,children:[(0,U.jsx)(`span`,{className:`subtle`,children:oA(`scrollKeys`)}),(0,U.jsx)(`button`,{type:`button`,className:Jr,onClick:B,children:oA(`esc`)})]})]}),i?(0,U.jsx)(`input`,{className:Zr,autoFocus:!0,spellCheck:!1,value:o,placeholder:oA(`search`),onChange:e=>{s(e.target.value),c.current?.scrollTo({top:0})}}):(0,U.jsx)(`p`,{className:`text-muted`,children:oA(`filter`)}),u.length===0&&(0,U.jsx)(`p`,{className:`text-muted`,children:oA(`noResults`)}),(0,U.jsx)(`div`,{className:Nn,ref:c,children:u.map((e,t)=>(0,U.jsxs)(`section`,{className:Pn,children:[(0,U.jsx)(`h2`,{className:Fn,children:IJ(e)}),e.rows.map(t=>(0,U.jsxs)(`div`,{className:In,children:[(0,U.jsx)(`span`,{className:`mono ${Ln}`,children:FJ(t.primary)}),(0,U.jsx)(`span`,{className:`flex-1`,children:cA(t.binding.id)}),t.aliases.length>0&&(0,U.jsx)(`span`,{className:`text-muted`,children:`(${t.aliases.map(FJ).join(`, `)})`})]},`${e.kind}-${t.binding.id}`))]},`${e.kind}-${e.scope??t}`))})]})})}function zJ(e){return!(e instanceof HTMLElement)||e.closest(`.xterm`)?!1:e.isContentEditable||[`INPUT`,`TEXTAREA`,`SELECT`].includes(e.tagName)}function BJ(e){return e instanceof HTMLElement&&!!e.closest(`.rail, button, a`)}var VJ=e=>e.tabs.get()[e.selection.get().taskId??``]??[];function HJ(e){let{taskId:t,tabId:n}=e.selection.get(),r=VJ(e);return{taskId:t,tabs:r,at:r.findIndex(e=>e.id===n)}}function UJ(e,t){let{taskId:n,tabs:r}=HJ(e),i=r[t];!n||!i||e.select(n,i.id)}function WJ(e){let{taskId:t,tabs:n,at:r}=HJ(e),i=n[r];!t||!i||k.set((0,U.jsx)(oa,{title:V(`menu.renameTab`),initial:Go(i),submitLabel:V(`dialog.save`),onSubmit:async n=>{await e.renameTab(t,i.id,n)}}))}var GJ=e=>!!e.selection.get().taskId,KJ=e=>VJ(e).length>0,qJ=[{id:`help.open`,chords:[`f1`],prefix:!1,run:LJ},{id:`focus.next`,chords:[`f4`],prefix:!1,run:()=>Os(1)},{id:`chat.tab.chooseEngine`,chords:[`ctrl+e`],prefix:!1,surface:`workspace`,live:GJ,run:e=>{let{taskId:t}=e.selection.get();t&&k.set((0,U.jsx)(wA,{model:e,taskId:t}))}},{id:`chat.tab.rename`,chords:[`f2`],prefix:!1,surface:`workspace`,live:e=>{let{tabs:t,at:n}=HJ(e);return!!t[n]&&!cU(t[n]?.split)},run:WJ},{id:`chat.tab.cycle-next`,chords:[`ctrl+]`],prefix:!1,surface:`workspace`,live:KJ,run:e=>UJ(e,(HJ(e).at+1)%VJ(e).length)},{id:`chat.tab.cycle-prev`,chords:[`ctrl+[`],prefix:!1,surface:`workspace`,live:KJ,run:e=>UJ(e,(HJ(e).at-1+VJ(e).length)%VJ(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:KJ,run:(e,t=``)=>{let n=tc().find(e=>e.id===`chat.tab.goto`&&!e.prefix)?.chords.indexOf(t)??-1;n>=0&&UJ(e,n)}},{id:`attention.next`,chords:[`f7`],prefix:!1,run:e=>YJ(e)}];$s(()=>qJ);function JJ(e){(0,h.useEffect)(()=>{let t=t=>{if(k.get()||zJ(t.target))return;let n=M.get();if(n===`worktrees`)return;let r=ic()??(GJ(e)?`workspace`:`sidebar`),{taskId:i}=e.selection.get();if(!n&&i&&!t.ctrlKey&&!t.shiftKey&&!t.metaKey&&!t.altKey&&t.key===`Enter`&&!KJ(e)&&!BJ(t.target)){t.preventDefault(),t.stopPropagation(),k.set((0,U.jsx)(wA,{model:e,taskId:i}));return}let a=Zk(t),o=tc().filter(t=>!t.prefix&&!t.native&&t.chords.some(e=>a.includes(e))&&nc(t,r)&&!(n&&t.surface)&&t.live?.(e)!==!1).sort((e,t)=>rc(e,r)-rc(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 YJ(e){let t=e.tasks.get();if(!t)return;let n=xc(t.attention,t.tasks.map(e=>e.id),e.selection.get());if(!n){z(V(`inbox.empty`));return}if(vc(n.state)){Tc(e,n);return}n.taskId!==null&&(e.select(n.taskId,n.tabId),wc(e,n))}async function XJ(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(V(`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(G(e),`error`)}}function ZJ(e){(0,h.useEffect)(()=>{let t=t=>{let n=Rs.get().plugins;if(n.length===0||!Zs({dialog:k.get()!==null,page:M.get()})||zJ(t.target))return;let r=Xs(n,Zk(t));r&&(t.preventDefault(),t.stopImmediatePropagation(),XJ(e,r))};return window.addEventListener(`keydown`,t,{capture:!0}),()=>window.removeEventListener(`keydown`,t,{capture:!0})},[e])}var QJ=[`workingBorder`,`runningTitle`,`taskColors`,`colorblind`];function $J(e){let{client:t}=e,n=Rw(),r=vz(),i=b(BF),a=GR();yz(e),gH(e),(0,h.useEffect)(()=>{let e=()=>{Fw(t).catch(()=>void 0),dy(t).catch(()=>void 0)},n=()=>document.visibilityState===`visible`&&e(),r=t.onOpen(e);return window.addEventListener(`focus`,e),document.addEventListener(`visibilitychange`,n),()=>{r(),window.removeEventListener(`focus`,e),document.removeEventListener(`visibilitychange`,n)}},[t]),(0,h.useEffect)(()=>{BR(t).catch(()=>void 0)},[t,n]),(0,h.useEffect)(()=>{let e=document.documentElement,t=n.prefs.theme,o=i?i[r]:bF(n.themes,t,r),s=i?i.fontFamily??null:xF(n.themes,t),c=o?IF(o,n.prefs):{};for(let[t,n]of Object.entries(c))e.style.setProperty(t,n);s?e.style.setProperty(`--mono`,CF(s)):e.style.removeProperty(`--mono`),tG(e,i&&i.name!==t?null:a,c),e.style.colorScheme=r;for(let t of QJ)e.dataset[t]=String(n.prefs[t]);RF.set(o?LF(o):null),zF.set(s?wF(s):null);let l=document.querySelector(`meta[name="theme-color"]`);l||(l=document.createElement(`meta`),l.name=`theme-color`,document.head.append(l)),l.content=getComputedStyle(document.body).backgroundColor},[n,r,i,a])}function eY(e,t,n){let r=n.width/t.width,i=n.height/t.height,a=Math.min(n.width,Math.max(0,Math.round(e.left*r))),o=Math.min(n.height,Math.max(0,Math.round(e.top*i)));return{x:a,y:o,width:Math.min(n.width-a,Math.round(e.width*r)),height:Math.min(n.height-o,Math.round(e.height*i))}}function tY(e,t,n){let r={left:0,top:0,width:n.innerWidth,height:n.innerHeight},i={left:(n.outerWidth-n.innerWidth)/2,top:n.outerHeight-n.innerHeight},a={...i,width:n.outerWidth,height:n.outerHeight},o={left:n.screenX+i.left,top:n.screenY+i.top,...n.screen},s={browser:r,window:a,monitor:o}[e??``];if(s)return s;let c=e=>Math.abs(e.width/e.height-t.width/t.height);return[r,a,o].reduce((e,t)=>c(t)<c(e)?t:e)}function nY(){return typeof navigator.mediaDevices?.getDisplayMedia==`function`}async function rY(e,t){let n=await navigator.mediaDevices.getDisplayMedia({video:{displaySurface:`browser`},preferCurrentTab:!0,selfBrowserSurface:`include`});try{let r=document.createElement(`video`);r.muted=!0,r.srcObject=n,await r.play();let i={width:r.videoWidth,height:r.videoHeight},a=e.getBoundingClientRect(),o=tY(n.getVideoTracks()[0]?.getSettings().displaySurface,i,window),s=eY({left:a.left+o.left,top:a.top+o.top,width:a.width,height:a.height},o,i),c=document.createElement(`canvas`);c.width=s.width,c.height=s.height,c.getContext(`2d`)?.drawImage(r,s.x,s.y,s.width,s.height,0,0,s.width,s.height);let l=await new Promise(e=>c.toBlob(e,`image/png`));if(!l)throw Error(`empty capture`);return new File([l],t,{type:`image/png`})}finally{for(let e of n.getTracks())e.stop()}}async function iY(e,t,n){let r=new Image;r.src=e,await r.decode();let i=document.createElement(`canvas`);i.width=r.naturalWidth||r.width,i.height=r.naturalHeight||r.height;let a=i.getContext(`2d`);if(!a)throw Error(`canvas unavailable`);if(a.drawImage(r,0,0,i.width,i.height),t){let e=t.getBoundingClientRect(),n=t.cloneNode(!0);n.setAttribute(`xmlns`,`http://www.w3.org/2000/svg`),n.setAttribute(`width`,String(e.width||i.width)),n.setAttribute(`height`,String(e.height||i.height));let r=getComputedStyle(t).stroke||`#e5734a`;n.setAttribute(`stroke`,r),n.setAttribute(`fill`,`none`),n.setAttribute(`stroke-width`,`2.5`),n.setAttribute(`stroke-linecap`,`round`),n.setAttribute(`stroke-linejoin`,`round`);let o=URL.createObjectURL(new Blob([new XMLSerializer().serializeToString(n)],{type:`image/svg+xml`}));try{let e=new Image;e.src=o,await e.decode(),a.drawImage(e,0,0,i.width,i.height)}finally{URL.revokeObjectURL(o)}}let o=await new Promise(e=>i.toBlob(e,`image/png`));if(!o)throw Error(`empty capture`);return new File([o],n,{type:`image/png`})}var aY=new Set,oY=2e3;function sY(e){aY.add(e)}function cY(e,t=oY){setTimeout(()=>aY.delete(e),t)}var lY=e=>aY.has(e),uY=()=>Ee()?14:13,dY=(e,t)=>{let n=De(()=>{e.options.fontSize=uY(),t()}),r=zF.subscribe(()=>{let n=zF.get()??mY;e.options.fontFamily!==n&&(e.options.fontFamily=n,t())});return()=>{n(),r()}},fY={background:`#141413`,foreground:`#eae7df`,cursor:`#cc785c`,cursorAccent:`#141413`,selectionBackground:`#33312e`,black:`#141413`,red:`#ec6f74`,green:`#9aca86`,yellow:`#e8c96b`,blue:`#61aaf2`,magenta:`#9b87f5`,cyan:`#d4967e`,white:`#a9a39a`,brightBlack:`#6b665f`,brightRed:`#ec6f74`,brightGreen:`#9aca86`,brightYellow:`#e8c96b`,brightBlue:`#61aaf2`,brightMagenta:`#9b87f5`,brightCyan:`#e0ab96`,brightWhite:`#eae7df`},pY=`Rove Nerd Symbols`,mY=[`"JetBrains Mono"`,`"${pY}"`,`"SF Mono"`,`ui-monospace`,`Menlo`,`monospace`].join(`, `);function hY(e){switch(e.kind){case`restored`:return V(`workspace.restored`);case`notLive`:return V(`workspace.tabNotLive`);case`exited`:return e.code===null?V(`workspace.exitedNoCode`):V(`workspace.exited`,{code:e.code});case`failed`:return V(`workspace.attachFailed`,{message:e.message});case`none`:return``}}function gY(e){return e===null?V(`workspace.engineExitedNoCode`):V(`workspace.engineExited`,{code:e})}function _Y(e){H();let{notice:t,engineExit:n,model:r,taskId:i,tabId:a,revive:o}=e,s=t.kind===`none`?n:null,c=t.kind===`none`&&!s&&e.usageLimit===!0&&!o.error,[l,u]=(0,h.useState)(!1);if(t.kind===`none`&&!s&&!c)return null;let d=c?r.tasks.get()?.attention.find(e=>e.taskId===i&&e.state===`rate_limited`)?.resumeAt:void 0,f=t.kind===`notLive`||t.kind===`restored`||t.kind===`exited`,p=t.kind===`exited`||s!==null,m=o.error?V(`workspace.reopenFailed`,{message:o.error}):s?gY(s.code):c?d?V(`workspace.usageLimitUntil`,{time:new Date(d).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}):V(`workspace.usageLimit`):hY(t);return(0,U.jsxs)(`div`,{className:Zn(t.kind===`failed`||!!o.error),children:[(0,U.jsx)(`span`,{children:m}),e.onReopen&&(f||s)&&(0,U.jsx)(`button`,{type:`button`,className:`link text-accent hover:underline touch-hit`,disabled:o.busy,onClick:()=>e.onReopen?.(s!==null),children:o.busy?V(`workspace.reopening`):V(s?`workspace.retry`:`workspace.reopen`)}),t.kind===`failed`&&e.onRetryAttach&&(0,U.jsx)(`button`,{type:`button`,className:`link text-accent hover:underline touch-hit`,onClick:e.onRetryAttach,children:V(`workspace.retry`)}),c&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(W,{variant:`link`,hit:`tight`,onClick:()=>k.set((0,U.jsx)(wA,{model:r,taskId:i,context:`continue`,sourceTabId:a})),children:V(`menu.continueEngine`)}),(0,U.jsx)(W,{variant:`link`,hit:`tight`,disabled:l,onClick:()=>{u(!0),r.client.request(`task.resumeQuota`,{taskId:i}).catch(e=>z(e instanceof Error?e.message:String(e),`error`)).finally(()=>u(!1))},children:V(l?`workspace.resumingQuota`:`workspace.resumeQuota`)}),(0,U.jsx)(W,{variant:`link`,hit:`tight`,onClick:e.onDismissLimit,children:V(`workspace.dismiss`)})]}),p&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`button`,{type:`button`,className:`link text-accent hover:underline touch-hit`,onClick:()=>k.set((0,U.jsx)(oU,{model:r,section:`engines`})),children:V(`workspace.engineSettings`)}),(0,U.jsx)(`button`,{type:`button`,className:`link text-accent hover:underline touch-hit`,onClick:()=>k.set((0,U.jsx)(wA,{model:r,taskId:i})),children:V(`menu.newChatPick`)}),(0,U.jsx)(W,{variant:`link`,hit:`tight`,onClick:()=>k.set((0,U.jsx)(wA,{model:r,taskId:i,context:`continue`,sourceTabId:a})),children:V(`menu.continueEngine`)})]})]})}var vY=/\x1b\[\?[0-9;]*c|\x1b\[\??[0-9;]*\$y|\x1b\](?:10|11);[^\x07\x1b]*(?:\x07|\x1b\\)/g,yY=/\x1b\[[?>=]?[0-9;]*(?:[cnRt]|\$y)|\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)|\x1bP[^\x1b]*\x1b\\/g;function bY(e){let t=0;return{forward(n){let r=(t>0?n.replace(yY,``):n).replace(vY,``);r&&e(r)},replay(e){t++,e(()=>{t--})}}}function xY(e){return Uint8Array.from(atob(e),e=>e.charCodeAt(0))}function SY(e){return!e||typeof e!=`object`||!(`stream`in e)||typeof e.stream!=`string`?null:{stream:e.stream,...`data`in e&&typeof e.data==`string`?{data:e.data}:{},...`code`in e&&(typeof e.code==`number`||e.code===null)?{code:e.code}:{}}}var CY=65536,wY=20;function TY(e){let t=0,n=null,r=()=>{n!==null&&window.clearTimeout(n),n=null,t>0&&e(t),t=0};return{parsed(e){t+=e,t>=CY?r():n??=window.setTimeout(r,wY)},dispose(){n!==null&&window.clearTimeout(n),n=null,t=0}}}function EY(e){return!e||typeof e!=`object`||!(`stream`in e)||!(`replay`in e)?null:typeof e.stream==`string`&&typeof e.replay==`string`?{stream:e.stream,replay:e.replay}:null}function DY(e,t,n,r,i,a){let o=Bc(t,n,r);k.set((0,U.jsx)(sa,{title:sA(`reset.title`),body:sA(`reset.body`),confirmLabel:V(`workspace.reset`),onConfirm:async()=>{sY(o);try{await e.request(`tab.split`,{taskId:t,tabId:n,action:`reset`,leafId:r??`leaf-1`,...i}),await a()}finally{cY(o)}}}))}function OY(e,t){let n=``,r=0,i=()=>{r=0;let i=e.getBoundingClientRect(),a=i.width>1&&i.height>1&&[[.02,.03],[.5,.5],[.98,.97],[.02,.97],[.98,.03]].every(([t,n])=>e.contains(document.elementFromPoint(i.x+i.width*t,i.y+i.height*n)))&&!document.querySelector(`[role="menu"], [aria-modal="true"], .overlay`),o=[i.x,i.y,i.width,i.height,a].join(`,`);o!==n&&(n=o,t(i,a))},a=()=>{document.hidden?i():r||=requestAnimationFrame(i)},o=new ResizeObserver(a);o.observe(e);let s=new MutationObserver(a);return s.observe(document.body,{childList:!0,attributes:!0,subtree:!0}),window.addEventListener(`resize`,a),window.addEventListener(`scroll`,a,!0),document.addEventListener(`transitionend`,a),document.addEventListener(`visibilitychange`,a),i(),()=>{o.disconnect(),s.disconnect(),cancelAnimationFrame(r),window.removeEventListener(`resize`,a),window.removeEventListener(`scroll`,a,!0),document.removeEventListener(`transitionend`,a),document.removeEventListener(`visibilitychange`,a)}}function kY(e){let{client:t,taskId:n,tabId:r,leafId:i}=e,a=(0,h.useRef)(null),o=(0,h.useRef)(e);o.current=e;let[s,c]=(0,h.useState)({kind:`none`}),[l,u]=(0,h.useState)(0),[d,f]=(0,h.useState)(!1),p=Bc(n,r,i);return(0,h.useEffect)(()=>{if(!a.current||!WU)return;let e=a.current,s=String(l)+crypto.randomUUID(),u=(e,t={})=>WU?.postMessage({id:s,op:e,...t}),d=(e,n)=>void t.request(e,n).catch(()=>{}),f=!1,m=0,h=!1,g=0,_=0,v=null,y=TY(e=>{h&&d(`term.ack`,{stream:p,chars:e})}),b=async()=>{if(!f||!g||!_)return;let e={cols:g,rows:_},a=++m;h=!1,v=[];try{let o=await t.request(`term.attach`,{taskId:n,tabId:r,...i&&i!==`leaf-1`?{leafId:i}:{},...e,acks:!0});if(m!==a)return;h=o.alive,h&&(g!==e.cols||_!==e.rows)&&d(`term.resize`,{stream:p,cols:g,rows:_}),u(`replay`,{data:o.replay});for(let e of v??[])u(`data`,{data:e});v=null,c(o.alive?{kind:`none`}:{kind:o.restored?`restored`:`notLive`})}catch(e){m===a&&(v=null,c({kind:`failed`,message:String(e)}))}},x=!1,S=e=>{h&&d(`term.input`,{stream:p,data:e})},C=bY(S),w={stream:p,input:S,focus:()=>u(`focus`),size:()=>({cols:g,rows:_}),reattach:b,scrollPages:e=>u(`scroll`,{direction:e}),hasSelection:()=>x,copySelection:()=>(x&&u(`copy`),x),reset:()=>DY(t,n,r,i,{cols:g,rows:_},async()=>{await b(),u(`focus`)})},T=lc(w),E=GU(e=>{if(e.id===s&&((e.action===`input`||e.action===`reply`)&&e.data&&C.forward(e.data),e.action===`selection`&&(x=e.selected===!0),e.action===`blur`&&cc.get()===w&&cc.set(null),e.action===`parsed`&&e.chars&&y.parsed(e.chars),e.action===`focus`&&(cc.set(w),o.current.onActivate?.()),e.action===`size`&&e.cols&&e.rows)){let t=!g;g=e.cols,_=e.rows,t?b():h&&d(`term.resize`,{stream:p,cols:g,rows:_})}}),D=[t.on(`term.data`,e=>{let t=SY(e);t?.stream!==p||!t.data||(v?v.push(t.data):h&&u(`data`,{data:t.data}))}),t.on(`term.reset`,e=>{let t=EY(e);h&&t?.stream===p&&u(`reset`,{data:t.replay})}),t.on(`term.exit`,e=>{let t=SY(e);t?.stream===p&&(h=!1,++m,v=null,c({kind:`exited`,code:t.code??null}),lY(p)||o.current.onExit?.())}),t.conn.subscribe(()=>{t.conn.get().state!==`open`&&(f=!1,h=!1,v=null,++m)}),t.onOpen(()=>{f=!0,b()})],O=()=>{let e=RF.get()??fY,t=getComputedStyle(document.documentElement);return{dark:t.colorScheme!==`light`,subtle:t.getPropertyValue(`--subtle`).trim(),muted:t.getPropertyValue(`--muted`).trim(),foreground:e.foreground,background:e.background,scrollback:jw.get().prefs.scrollbackRows}},k=()=>u(`appearance`,O());D.push(RF.subscribe(k),jw.subscribe(k));let A=OY(e,(e,t)=>u(`frame`,{x:e.x,y:e.y,width:e.width,height:e.height,visible:t,focus:o.current.focused!==!1,...O()}));return()=>{++m,h=!1;for(let e of D)e();T(),E(),y.dispose(),A(),u(`remove`),f&&g&&d(`term.detach`,{stream:p}),f=!1}},[t,n,r,i,p,l]),(0,U.jsx)(`div`,{className:Gn,"data-stream":p,children:(0,U.jsxs)(`div`,{className:Kn,children:[(0,U.jsx)(`div`,{className:qn,ref:a,"data-native-terminal":``}),(0,U.jsx)(_Y,{model:e.model,taskId:n,tabId:r,notice:s,engineExit:e.engineExit??null,revive:{busy:d,error:null},onRetryAttach:()=>u(e=>e+1),onReopen:async e=>{f(!0);try{await t.request(`term.revive`,{taskId:n,tabId:r,...e?{restartExited:e}:{}}),u(e=>e+1)}catch(e){c({kind:`failed`,message:String(e)})}finally{f(!1)}}})]})})}var AY={up:`layout.termKeyUp`,down:`layout.termKeyDown`,left:`layout.termKeyLeft`,right:`layout.termKeyRight`,interrupt:`layout.termKeyInterrupt`,enter:`layout.termKeyEnter`};function jY({to:e,atMenu:t}){H();let n=typeof e==`function`?null:e,[r,i]=(0,h.useState)(!1),[a,o]=(0,h.useState)(!1);(0,h.useEffect)(()=>{n?.armCtrl(r?()=>i(!1):null)},[n,r]),(0,h.useEffect)(()=>()=>n?.armCtrl(null),[n]);let s=t=>typeof e==`function`?e(t.bytes(!1)):e.term.input(t.bytes(e.term.modes.applicationCursorKeysMode),!0),c=e=>(0,U.jsx)(`button`,{type:`button`,className:bn(`off`),"aria-label":AY[e.id]?V(AY[e.id]):void 0,onClick:()=>{i(!1),s(e)},children:e.cap},e.id),l=_l(t);return(0,U.jsxs)(`div`,{className:`mono ${vn}`,role:`toolbar`,"aria-label":V(`layout.termKeys`),onPointerDown:e=>e.preventDefault(),children:[a&&n&&(0,U.jsx)(`button`,{type:`button`,className:bn(r?`on`:`off`),"aria-pressed":r,onClick:()=>i(!r),children:`ctrl`}),(a?l.rest:l.first).map(c),(0,U.jsx)(`button`,{type:`button`,className:bn(r&&!a?`hint`:`off`),"aria-expanded":a,"aria-label":V(`layout.termKeyMore`),onClick:()=>o(!a),children:`⋯`}),(0,U.jsx)(iu,{label:V(`layout.termKeyHideKeyboard`)})]})}function MY(e){let t=e.split(`
106
106
  `).map(e=>e.trimEnd());for(;t[0]===``;)t.shift();for(;t.at(-1)===``;)t.pop();if(t.length===0)return null;let n=Math.max(0,...Array.from(t.join(`
107
107
  `).matchAll(/`+/g),e=>e[0].length)),r="`".repeat(Math.max(3,n+1));return`${r}\n${t.join(`
108
- `)}\n${r}\n`}function AY(e){let t=document.querySelector(`[data-composer="${CSS.escape(e)}"]`);return t&&t.offsetParent!==null?t:null}function jY(e,t,n,r){let i=kY(e.term.getSelection());if(i===null)return!1;let a=UF(t,n),o=AY(a);if(o){qF(a,i),e.term.clearSelection();let t=o.querySelector(`textarea`);return t?.focus(),t?.setSelectionRange(t.value.length,t.value.length),!0}return r?(z(V(`quote.atMenu`),`error`),!1):e.term.modes.bracketedPasteMode?(e.term.paste(i),e.term.clearSelection(),e.term.focus(),!0):(z(V(`quote.notReady`),`error`),!1)}async function MY(e,t,n){for(let r of n){r.size>1048576&&z(V(`layout.dropUploading`,{name:r.name}));try{t.term.paste(`${await ad(e,r,t.stream.split(`::`)[0])} `)}catch(e){z(e instanceof Error?e.message:String(e),`error`)}}t.term.focus()}async function NY(){if(!navigator.clipboard?.read)throw Error(V(`layout.pasteNeedsHttps`));let e=[];for(let t of await navigator.clipboard.read())for(let n of t.types)(n.startsWith(`image/`)||n===`application/pdf`)&&e.push(new File([await t.getType(n)],`clipboard`,{type:n}));return e}async function PY(e,t){let n;try{n=await NY()}catch(e){z(V(`layout.pasteNoAccess`,{error:e instanceof Error?e.message:String(e)}),`error`);return}n.length===0?z(V(`layout.pasteNoImage`),`error`):await MY(e,t,n)}async function FY(e){try{return await navigator.clipboard.writeText(e),!0}catch{return z(V(`menu.copyFailed`),`error`),!1}}function IY(e){return UU?(0,U.jsx)(EY,{...e}):(0,U.jsx)(LY,{...e})}function LY(e){let{client:t,taskId:n,tabId:r,leafId:i}=e,a=b(e.model.tasks)?.tasks.find(e=>e.id===n)?.tabStatus?.[r]?.kind===`needs-input`;H();let o=(0,h.useRef)(null),[s,c]=(0,h.useState)({kind:`none`}),[l,u]=(0,h.useState)(null),[d,f]=(0,h.useState)(0),[p,m]=(0,h.useState)({busy:!1,error:null}),g=(0,h.useRef)(e);g.current=e,Kb(t);let _=e.composer===!0&&qb(t),v=(0,h.useRef)(_);v.current=_,(0,h.useEffect)(()=>{let e=o.current;if(!e)return;let a=null,s=!1,l=[document.fonts.load(`13px "JetBrains Mono"`),document.fonts.load(`bold 13px "JetBrains Mono"`)];document.fonts.load(`13px "${uY}"`,String.fromCodePoint(57504)).catch(()=>{});let d=()=>{s||il({client:t,host:e,taskId:n,tabId:r,leafId:i,focusOnMount:g.current.focused!==!1&&!v.current},{setNotice:c,onScrolled:f,onFocusChange:e=>{if(!a)return;let{stream:t}=a.handle;e?(g.current.onActivate?.(),cc.set(uc(t)??null)):cc.get()?.stream===t&&cc.set(null)},onExit:()=>{oY(Bc(n,r,i))||g.current.onExit?.()},copyText:FY,pasteImage:async()=>{a&&await PY(t,a.handle)}}).then(e=>{s?e.release():(a=e,u(e.handle))})};return rl(t,n,r,i)?d():Promise.allSettled(l).then(d),()=>{s=!0,u(null),a?.release()}},[t,n,r,i]);let[y,x]=(0,h.useState)(!1);(0,h.useEffect)(()=>{if(!l)return;x(l.term.hasSelection());let e=l.term.onSelectionChange(()=>x(l.term.hasSelection()));return()=>{e.dispose(),x(!1)}},[l]),(0,h.useEffect)(()=>{if(!l)return;let{term:e,stream:a}=l,o={stream:a,focus:()=>e.focus(),input:t=>e.input(t,!0),reattach:()=>l.reattach(),scrollPages:e=>l.scrollLines(e*10),hasSelection:()=>e.hasSelection(),copySelection:()=>{let t=e.getSelection();return t.trim().length!==0&&(FY(t),e.clearSelection(),!0)},reset:()=>wY(t,n,r,i,{cols:e.cols,rows:e.rows},async()=>{await l.reattach(),e.focus()}),size:()=>({cols:e.cols,rows:e.rows})},s=lc(o);return document.activeElement===e.textarea&&cc.set(o),()=>{s()}},[l,t,n,r,i]),(0,h.useEffect)(()=>{e.focused&&!_&&l&&document.activeElement!==l.term.textarea&&l.term.focus()},[e.focused,_,l]);let S=!i||i===`leaf-1`,[C,w]=(0,h.useState)(null),T=e.engineExit?.since===C,[E,D]=(0,h.useState)(null),O=e.usageLimit&&e.usageLimit.since!==E?e.usageLimit:null,k=(0,h.useRef)(!1),A=async(i,a)=>{if(!k.current){k.current=!0,m({busy:!0,error:null});try{await t.request(`term.revive`,{taskId:n,tabId:r,...a?{restartExited:a}:{}}),await i.reattach(),i.term.focus(),w(e.engineExit?.since??null),m({busy:!1,error:null})}catch(e){m({busy:!1,error:e instanceof Error?e.message:String(e)})}finally{k.current=!1}}};return(0,U.jsxs)(`div`,{className:Gn,"data-stream":Bc(n,r,i),onDragOver:e=>e.dataTransfer.types.includes(`Files`)&&e.preventDefault(),onDrop:e=>{!e.dataTransfer.files.length||!l||(e.preventDefault(),MY(t,l,Array.from(e.dataTransfer.files)))},onPasteCapture:e=>{if(!l||e.target.closest(`form[data-composer]`))return;let n=Array.from(e.clipboardData.files);(n.length!==0||e.clipboardData.getData(`text/plain`)===``)&&(e.preventDefault(),e.stopPropagation(),n.length>0?MY(t,l,n):PY(t,l))},children:[(0,U.jsxs)(`div`,{className:Kn,children:[(0,U.jsx)(`div`,{className:qn,ref:o}),(0,U.jsx)(mY,{notice:s,engineExit:T?null:e.engineExit??null,model:e.model,taskId:n,tabId:r,revive:p,onReopen:S&&l?e=>void A(l,e):void 0,onRetryAttach:l?()=>void l.reattach():void 0,usageLimit:O!==null,onDismissLimit:O?()=>D(O.since):void 0}),y&&e.composer&&l&&(0,U.jsx)(W,{variant:`floating`,className:`absolute top-2.5 right-2.5 z-4`,title:V(`quote.title`),onClick:()=>jY(l,n,r,a),children:V(`quote.action`)}),d>0&&l&&(0,U.jsxs)(`div`,{className:`mono absolute right-2.5 bottom-2.5 z-4 flex gap-3 rounded-sm border-hairline border-line bg-inset px-2.5 py-1 text-meta`,children:[(0,U.jsx)(`span`,{className:`text-warning`,children:oA(`scrolledBack`,{lines:d})}),(0,U.jsx)(`button`,{type:`button`,className:`link text-accent hover:underline touch-hit`,onClick:()=>l.scrollToTop(),children:oA(`scrollFirst`)}),(0,U.jsx)(`button`,{type:`button`,className:`link text-accent hover:underline touch-hit`,onClick:()=>l.scrollToBottom(),children:oA(`scrollLatest`)})]})]}),e.composer&&(0,U.jsx)(tI,{model:e.model,taskId:n,tabId:r}),l&&(0,U.jsx)(OY,{to:l,atMenu:a})]})}var RY=[{tool:`pen`,d:`M3 13l.6-2.6L10.9 3.1l2 2L5.6 12.4zM9.6 4.4l2 2`},{tool:`box`,d:`M3 4h10v8H3z`},{tool:`text`,d:`M4 4h8M8 4v8.5`}];function zY({mark:e}){return e.kind===`pen`?(0,U.jsx)(`path`,{d:e.d}):e.kind===`box`?(0,U.jsx)(`rect`,{x:e.x,y:e.y,width:e.w,height:e.h,rx:2}):(0,U.jsx)(`text`,{x:e.x,y:e.y,className:`fill-accent stroke-none font-mono text-body font-semibold`,children:e.text})}function BY({model:e,taskId:t,url:n,target:r,backdrop:i,onClose:a}){let[o,s]=(0,h.useState)(`pen`),[c,l]=(0,h.useState)([]),[u,d]=(0,h.useState)(null),[f,p]=(0,h.useState)(null),[m,g]=(0,h.useState)(!1),_=(0,h.useRef)(null),v=e=>{let t=e.currentTarget.getBoundingClientRect();return{x:Math.round(e.clientX-t.left),y:Math.round(e.clientY-t.top)}},y=e=>{let{x:t,y:n}=v(e);o!==`text`&&(e.currentTarget.setPointerCapture(e.pointerId),d(o===`pen`?{kind:`pen`,d:`M${t} ${n}`}:{kind:`box`,x:t,y:n,w:0,h:0}))},b=e=>{if(!u)return;let{x:t,y:n}=v(e);u.kind===`pen`?d({kind:`pen`,d:`${u.d} L${t} ${n}`}):u.kind===`box`&&d({...u,w:Math.max(0,t-u.x),h:Math.max(0,n-u.y)})},x=()=>{u&&(u.kind!==`box`||u.w>2&&u.h>2)&&l([...c,u]),d(null)},S=e=>{f&&e.trim()&&l([...c,{kind:`text`,...f,text:e.trim()}]),p(null)},C=async()=>{let o=re.get(),s=o?.startsWith(`${t}::`)?nl(e.client,o):null,c=r.current;if(!s||!c){z(V(`browser.noEngine`),`error`);return}g(!0);try{let t=`browser-${VS(n)}.png`,r=i?await tY(i,_.current,t):await eY(c,t);await MY(e.client,s,[r]),a()}catch(e){e instanceof DOMException&&e.name===`NotAllowedError`||z(V(`browser.captureFailed`,{error:e instanceof Error?e.message:String(e)}),`error`),g(!1)}};return(0,U.jsxs)(U.Fragment,{children:[i&&(0,U.jsx)(`img`,{src:i,alt:``,className:`size-full object-contain`}),(0,U.jsxs)(`svg`,{ref:_,className:Pr,"aria-label":V(`browser.annotate`),onPointerDown:y,onPointerMove:b,onPointerUp:x,onPointerCancel:x,onClick:e=>o===`text`&&p(v(e)),children:[(0,U.jsx)(`title`,{children:V(`browser.annotate`)}),[...c,...u?[u]:[]].map((e,t)=>(0,U.jsx)(zY,{mark:e},t))]}),f&&(0,U.jsx)(`input`,{autoFocus:!0,className:`absolute min-w-24 rounded-xs border-hairline border-accent bg-paper px-1 font-mono text-body text-accent focus:outline-none`,style:{left:f.x,top:f.y-14},"aria-label":V(`browser.text`),onBlur:e=>S(e.target.value),onKeyDown:e=>e.key===`Enter`&&e.currentTarget.blur()},`${f.x},${f.y}`),!m&&(0,U.jsxs)(`div`,{className:`absolute bottom-3 left-1/2 flex w-max -translate-x-1/2 items-center whitespace-nowrap gap-0.5 rounded-md border-hairline border-line bg-surface p-1 shadow-popover [&_svg]:flex-none`,children:[RY.map(e=>(0,U.jsx)(W,{variant:o===e.tool?`iconOn`:`icon`,title:V(`browser.${e.tool}`),"aria-label":V(`browser.${e.tool}`),"aria-pressed":o===e.tool,onClick:()=>s(e.tool),children:(0,U.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,U.jsx)(`path`,{d:e.d})})},e.tool)),(0,U.jsx)(W,{variant:`icon`,disabled:c.length===0,title:V(`browser.undo`),"aria-label":V(`browser.undo`),onClick:()=>l(c.slice(0,-1)),children:(0,U.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,U.jsx)(`path`,{d:`M5.5 3.5 3 6l2.5 2.5M3 6h6.5a3 3 0 0 1 0 6H7`})})}),(0,U.jsx)(W,{variant:`filled`,onClick:()=>void C(),children:V(`browser.addToChat`)}),(0,U.jsx)(W,{variant:`icon`,title:V(`browser.annotateDone`),"aria-label":V(`browser.annotateDone`),onClick:a,children:(0,U.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,U.jsx)(`path`,{d:`M4 4l8 8M12 4l-8 8`})})})]})]})}var VY=5e3;function HY(e,t){let[n,r]=(0,h.useState)([]);return(0,h.useEffect)(()=>{r([]);let n=!0,i=()=>e.client.request(`browser.ports`,{taskId:t}).then(e=>n&&r(e.ports),()=>{});i();let a=window.setInterval(()=>void i(),VY);return()=>{n=!1,window.clearInterval(a)}},[e,t]),n}function UY({model:e,task:t}){H();let n=t.id,r=HY(e,n);return r.length===0?null:(0,U.jsx)(`div`,{className:`flex flex-wrap justify-end gap-x-3.5 gap-y-1 px-2 pb-2 font-mono text-meta whitespace-nowrap`,children:r.map(e=>(0,U.jsx)(W,{onClick:()=>xw(n,e.url),children:V(`files.openPort`,{port:e.port})},e.port))})}function WY(e){let[t,n]=(0,h.useState)(0),r=e.open&&e.items.length>0,i=Math.min(t,Math.max(0,e.items.length-1)),a=(0,h.useRef)(null),{onCursor:o}=e;return(0,h.useEffect)(()=>o?.(i),[i,o]),(0,h.useEffect)(()=>{a.current?.scrollIntoView({block:`nearest`})},[i,e.items]),(0,U.jsxs)(`div`,{className:`relative`,children:[(0,U.jsx)(`input`,{className:Zr,"data-field":e.field,spellCheck:!1,autoComplete:`off`,autoFocus:e.autoFocus,placeholder:e.placeholder,value:e.value,onChange:t=>{n(0),e.onChange(t.target.value.replace(/[\r\n]+/g,``))},onKeyDown:t=>{if(!t.nativeEvent.isComposing){if(t.key===`ArrowDown`||t.key===`ArrowUp`){if(!r)return;t.preventDefault(),n(Math.max(0,Math.min(e.items.length-1,i+(t.key===`ArrowDown`?1:-1))))}else t.key===`Tab`&&!t.shiftKey&&r&&e.onComplete?.(i)?(t.preventDefault(),n(0)):t.key===`Enter`&&!t.ctrlKey&&!t.metaKey&&(t.preventDefault(),r?((e.onEnterRow??e.onPick)(i),n(0)):e.onEnter?.())}}}),r&&(0,U.jsx)(`ul`,{className:`mx-0 mt-1 mb-0 max-h-47 list-none overflow-y-auto rounded-sm border-hairline border-line bg-inset p-0.5 font-mono text-meta`,children:e.items.map((t,n)=>(0,U.jsx)(`li`,{ref:n===i?a:void 0,children:(0,U.jsxs)(`button`,{type:`button`,tabIndex:-1,"aria-pressed":n===i,className:Kr({cursor:n===i,accent:!!t.accent}),onMouseDown:t=>{t.preventDefault(),e.onPick(n)},children:[(0,U.jsx)(`span`,{children:t.text}),t.dim&&(0,U.jsxs)(`span`,{className:`text-muted`,children:[` `,t.dim]})]})},t.key))})]})}function GY(e,t,n){let r=[{ref:null,suggestion:{key:`default`,text:t,dim:V(`review.baseDefault`),accent:!0}}],i=(e,n)=>{for(let i of e)i!==t&&r.push({ref:i,suggestion:{key:`${n}:${i}`,text:i,dim:n}})};i(e?.branches??[],V(`review.baseBranch`)),i(e?.remotes??[],V(`review.baseRemote`)),i(e?.tags??[],V(`review.baseTag`));for(let t of e?.commits??[])r.push({ref:t.sha,suggestion:{key:`commit:${t.sha}`,text:t.sha,dim:t.subject}});let a=n.trim().toLowerCase();if(a===``)return r.slice(0,40);let o=e=>{if(e.suggestion.text.toLowerCase()===a)return 0;let t=Gf(e.suggestion.text,a);return t===`substring`||(e.suggestion.dim??``).toLowerCase().includes(a)?1:t===`segments`?2:null};return r.flatMap(e=>{let t=o(e);return t===null?[]:[{c:e,r:t}]}).sort((e,t)=>e.r-t.r).map(e=>e.c).slice(0,40)}function KY(e){let[t,n]=(0,h.useState)(!1),[r,i]=(0,h.useState)(``),[a,o]=(0,h.useState)(null),s=e.model.client;(0,h.useEffect)(()=>{if(!t)return;let n=!0;return ss(s,`diff.refs`,{taskId:e.taskId}).then(e=>n&&o(e),()=>{}),()=>{n=!1}},[t,s,e.taskId]);let c=GY(a,e.base,r),l=t=>{e.onPick(t),n(!1),i(``)},u=e.custom??e.base,d=[{id:`task`,label:V(`review.scopeTask`)},{id:`working`,label:V(`review.scopeWorking`)},{id:`branch`,label:V(`review.scopeBranch`)}],f=d.find(t=>t.id===e.scope)?.label??``;return(0,U.jsxs)(`span`,{className:`relative`,onKeyDown:e=>{e.stopPropagation(),e.key===`Escape`&&t&&n(!1)},children:[(0,U.jsx)(W,{hit:`tight`,"aria-expanded":t,"aria-haspopup":`menu`,onClick:t=>{let r=t.currentTarget.getBoundingClientRect();O.set({x:r.left,y:r.bottom+2,target:t.currentTarget,items:[...d.map(t=>({label:t.label,section:`scope`,checked:t.id===e.scope,run:()=>e.onScope(t.id)})),{label:V(`review.compareAgainst`,{base:u}),section:`base`,run:()=>n(!0)}]})},children:V(`review.scopeMenu`,{base:u,scope:f})}),t&&(0,U.jsx)(`div`,{className:`absolute top-full left-0 z-3 mt-1 w-64 max-w-full rounded-sm border-hairline border-line-active bg-surface p-1 shadow-popover`,children:(0,U.jsx)(WY,{field:`diff-base`,autoFocus:!0,value:r,onChange:i,items:c.map(e=>e.suggestion),open:!0,placeholder:V(`review.basePlaceholder`),onPick:e=>l(c[e]?.ref??null),onEnter:()=>l(r.trim()===``?null:r.trim())})})]})}var qY=`rove.diffBase`;function JY(){try{let e=JSON.parse(localStorage.getItem(qY)??`{}`);return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`string`))}catch{return{}}}function YY(e){return JY()[e]??null}function XY(e,t){let n=JY();t===null?delete n[e]:n[e]=t;try{localStorage.setItem(qY,JSON.stringify(n))}catch{}}function ZY(e){let[t,n]=(0,h.useState)(()=>YY(e.taskId));return[t,t=>{XY(e.taskId,t),n(t),t!==null&&e.scope!==`task`&&yw({taskId:e.taskId,path:e.path,scope:`task`})}]}var QY=(0,h.memo)(function(e){return(0,U.jsxs)(`div`,{className:`flex items-center ${e.viewed?`opacity-60`:``}`,children:[(0,U.jsxs)(W,{variant:`row`,"data-row":e.index,"aria-expanded":!e.closed,"aria-label":V(e.closed?`review.unfold`:`review.fold`,{path:e.name}),className:`${Yx(`file`,{cursor:e.cursor,noted:!1})} min-w-0 flex-1 text-left`,onClick:()=>e.onToggleFold(e.index,e.path),children:[(0,U.jsx)(`span`,{className:`grid place-items-center text-subtle`,children:(0,U.jsx)(Bv,{right:e.closed})}),(0,U.jsxs)(`span`,{className:tS,children:[(0,U.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name}),e.added?(0,U.jsxs)(Px,{tone:`added`,children:[`+`,e.added]}):null,e.removed?(0,U.jsxs)(Px,{tone:`removed`,children:[`−`,e.removed]}):null]})]}),e.path!==null&&(0,U.jsx)(W,{hit:`tight`,className:`flex-none px-2`,"aria-pressed":e.viewed,"aria-label":V(e.viewed?`review.unmarkViewed`:`review.markViewed`,{path:e.name}),onClick:()=>e.path!==null&&e.onToggleViewed(e.path),children:e.viewed?V(`review.viewedOn`):V(`review.viewed`)})]})});function $Y(e){return(0,U.jsxs)(`div`,{className:`absolute top-full right-3 z-1 flex gap-1.5`,children:[(0,U.jsx)(W,{variant:`floating`,onMouseDown:e=>e.preventDefault(),onClick:t=>{t.stopPropagation(),e.onComment()},children:V(`review.comment`)}),e.showRange&&(0,U.jsx)(W,{variant:`floating`,onClick:t=>{t.stopPropagation(),e.onRange()},children:V(`review.range`)}),e.ranged&&(0,U.jsx)(W,{variant:`floating`,title:V(`preview.askInChatHint`),onMouseDown:e=>e.preventDefault(),onClick:t=>{t.stopPropagation(),e.onAsk()},children:V(`preview.askInChat`)})]})}function eX({note:e,onEdit:t}){return(0,U.jsxs)(W,{variant:`row`,className:`${Yx(`note`,{cursor:!1,noted:!1})} w-full text-left`,onClick:t,children:[(0,U.jsx)(`span`,{className:Zx}),(0,U.jsx)(`span`,{}),(0,U.jsx)(`span`,{className:`text-accent`,children:`●`}),(0,U.jsx)(`span`,{className:eS,children:e.body})]})}function tX(e){let t=(0,h.useRef)(e);return t.current=e,(0,h.useMemo)(()=>({rowClick:(e,n)=>t.current.rowClick(e,n),fileClick:(e,n)=>t.current.fileClick(e,n),viewedClick:e=>t.current.viewedClick(e),editNote:e=>t.current.editNote(e)}),[])}var nX=2e3,rX=(0,h.memo)(function(e){let{index:t,row:n,noted:r}=e;return(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`div`,{"data-row":t,className:Yx(n.kind,{cursor:e.cursor,noted:r}),onClick:n=>e.onClick(t,n),children:[(0,U.jsx)(`span`,{className:Zx,children:n.oldNo??``}),(0,U.jsx)(`span`,{className:Xx,children:n.newNo??``}),(0,U.jsx)(`span`,{className:Qx(n.kind,r,e.changed),children:n.kind===`add`?`+`:n.kind===`del`?`−`:r?`●`:e.changed?`▎`:` `}),(0,U.jsxs)(`span`,{className:$x(n.kind),children:[n.text.length>nX?n.text.slice(0,nX):n.text,n.text.length>nX&&(0,U.jsxs)(`span`,{className:`text-subtle`,children:[` `,V(`review.lineClipped`,{count:(n.text.length-nX).toLocaleString()})]})]}),e.actions]}),e.notes?.map(t=>t.id===e.editId?(0,U.jsx)(h.Fragment,{children:e.composer},t.id):(0,U.jsx)(eX,{note:t,onEdit:()=>e.onEditNote(t)},t.id)),e.editId===void 0&&e.composer]})});function iX(e){return(0,U.jsxs)(`div`,{className:`flex flex-none flex-wrap items-center gap-x-3 gap-y-1 px-2 pt-1.5 font-mono text-meta`,children:[e.picker,(0,U.jsx)(W,{hit:`tight`,"aria-pressed":e.ignoreWs,title:V(`review.ignoreWsHint`),className:`opacity-60 aria-pressed:underline aria-pressed:opacity-100`,onClick:e.onToggleWs,children:V(`review.ignoreWs`)}),(0,U.jsxs)(`span`,{className:`flex min-w-0 basis-full flex-wrap items-center gap-x-1.5 text-muted`,children:[V(e.files===1?`review.totalsOne`:`review.totals`,{files:e.files,added:e.added,removed:e.removed}),e.shape&&(0,U.jsxs)(`span`,{children:[`· `,e.shape]}),e.files>0&&(0,U.jsxs)(`span`,{className:`whitespace-nowrap`,children:[`· `,V(`review.viewedCount`,{done:e.viewed,files:e.files})]})]}),(0,U.jsxs)(`span`,{className:`ml-auto flex items-center gap-x-3`,children:[e.files>1&&(0,U.jsx)(W,{hit:`tight`,onClick:e.onNextFile,children:V(`review.nextFile`)}),e.onNextComment&&(0,U.jsx)(W,{hit:`tight`,onClick:e.onNextComment,children:V(`review.nextComment`)}),e.files>1&&(0,U.jsx)(W,{hit:`tight`,onClick:e.onFoldAll,children:e.allFolded?V(`review.unfoldAll`):V(`review.foldAll`)})]})]})}var aX=`rove.diffViewed`,oX=(e,t)=>`${e}\0${t}`,sX=4096;function cX(e){let t=2166136261;for(let n of e){let e=n.text.length>sX?`${n.text.slice(0,sX/2)}${n.text.length}${n.text.slice(-2048)}`:n.text,r=`${n.kind}${e}\n`;for(let e=0;e<r.length;e++)t=Math.imul(t^r.charCodeAt(e),16777619)}return(t>>>0).toString(16)}function lX(e){let t=new Map,n=-1,r=r=>{let i=n>=0?e[n]?.path:null;i&&t.set(i,cX(e.slice(n+1,r)))};return e.forEach((e,t)=>{e.kind===`file`&&(r(t),n=t)}),r(e.length),t}function uX(){try{let e=JSON.parse(localStorage.getItem(aX)??`{}`);return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`string`))}catch{return{}}}function dX(e){try{localStorage.setItem(aX,JSON.stringify(e))}catch{}}function fX(e,t,n){let r=new Set;for(let[i,a]of n)e[oX(t,i)]===a&&r.add(i);return r}function pX(e,t,n,r){let i={...e};return r===void 0?delete i[oX(t,n)]:i[oX(t,n)]=r,i}function mX(e,t){return e.find(e=>e>t)??e[0]??null}var hX=`rove.diffIgnoreWs`;function gX(){try{return localStorage.getItem(hX)===`1`}catch{return!1}}function _X(e){try{localStorage.setItem(hX,e?`1`:`0`)}catch{}}function vX(e){return(0,U.jsx)(`div`,{className:`flex flex-none items-center gap-3 px-2 pt-1.5 font-mono text-meta`,children:(0,U.jsx)(W,{hit:`tight`,onClick:()=>e.file?yw({taskId:e.taskId,path:e.path,scope:`working`}):bw(e.taskId,e.path),children:V(e.file?`preview.modeDiff`:`preview.modeFile`)})})}function yX(e,t,n,r,i){let[a,o]=(0,h.useState)(null);return(0,h.useEffect)(()=>{if(!r)return;let i=!0;return ss(e,`diff.file`,{taskId:t,path:n,scope:`working`}).then(e=>{if(!i)return;let t=e.kind===`diff`&&typeof e.text==`string`?lx(e.text,n):[];o(new Set(t.flatMap(e=>e.kind===`add`&&e.newNo!==null?[e.newNo]:[])))},()=>i&&o(null)),()=>{i=!1}},[e,t,n,r,i]),r?a:null}var bX=[`renamed`,`added`,`untracked`,`modified`,`deleted`,`conflict`],xX={U:`conflict`,D:`deleted`,M:`modified`,T:`modified`,"?":`untracked`,A:`added`,R:`renamed`,C:`renamed`},SX={conflict:`attention`,deleted:`attention`,modified:`warning`,untracked:`success`,added:`success`,renamed:`accent`},CX={conflict:`!`,deleted:`D`,modified:`M`,untracked:`U`,added:`A`,renamed:`R`};function wX(e){let t=new Map;for(let n of[`branch`,`working`])for(let r of e){let e=r.scope===n?xX[r.status]:void 0;e&&t.set(r.path,e)}let n=new Map(t);for(let[e,r]of t)for(let t=e.indexOf(`/`);t>=0;t=e.indexOf(`/`,t+1)){let i=e.slice(0,t+1),a=n.get(i);(a===void 0||bX.indexOf(r)>bX.indexOf(a))&&n.set(i,r)}return n}function TX(e,t){return e.some(e=>e.scope===`working`&&e.path===t&&e.status!==`?`)}var EX={add:`+`,del:`-`},DX=40,OX=160,kX=e=>`${EX[e.kind]??` `}${e.text.slice(0,OX)}`,AX=e=>e.startLine!==void 0&&e.startLine!==e.line?`${e.filePath}:${e.startLine}-${e.line}`:`${e.filePath}:${e.line}`;function jX(e,t,n){let r=[];for(let i=t;i<=n&&r.length<DX;i++){let t=e[i];t&&dx(t)!==null&&r.push(kX(t))}return r.join(`
109
- `)}function MX(e,t){let n=e.startLine??e.line,r=t.flatMap((t,n)=>t.path===e.filePath&&dx(t)!==null?[n]:[]);if(!e.code){let i=r.filter(r=>{let i=dx(t[r]);return i>=n&&i<=e.line}),a=i[0],o=i[i.length-1];return a===void 0||o===void 0?null:{first:a,last:o}}let i=e.code.split(`
110
- `);for(let e=0;e+i.length<=r.length;e++){let a=r.slice(e,e+i.length),o=a[0],s=a[a.length-1];if(o!==void 0&&s!==void 0&&dx(t[o])===n&&a.every((e,n)=>kX(t[e])===i[n]))return{first:o,last:s}}return null}function NX(e,t,n){return MX(e,t)?`ok`:t.some(t=>t.path===e.filePath)||n?`moved`:`unknown`}function PX(e){let[t,n]=(0,h.useState)(null),r=()=>{n(null),e.focusView()},i=async n=>{if(t){if(t.kind===`add`){let{target:r}=t;await e.client.request(`review.add`,{taskId:e.taskId,filePath:r.path,line:r.line,...r.startLine?{startLine:r.startLine}:{},code:jX(e.rows,r.first,r.last),body:n})}else await e.client.request(`review.edit`,{taskId:e.taskId,id:t.note.id,body:n}).catch(e=>{throw Mx(e)});e.onSaved(t.kind===`add`),r()}};return{node:t&&(0,U.jsx)(FX,{location:t.kind===`add`?AX({filePath:t.target.path,startLine:t.target.startLine,line:t.target.line}):AX(t.note),...t.kind===`edit`?{initial:t.note.body}:{},onSubmit:i,onCancel:r}),row:t?t.kind===`add`?t.target.last:MX(t.note,e.rows)?.last??-1:null,editId:t?.kind===`edit`?t.note.id:void 0,add:()=>e.target&&n({kind:`add`,target:e.target}),edit:e=>n({kind:`edit`,note:e})}}function FX(e){let[t,n]=(0,h.useState)(e.initial??``),r=ni(t),[i,a]=(0,h.useState)(!1),[o,s]=(0,h.useState)(null),c=e.initial!==void 0,l=t.trim(),u=async()=>{if(!(!l||i)){a(!0),s(null);try{await e.onSubmit(l)}catch(e){s(e instanceof Error?e.message:String(e)),a(!1)}}};return(0,U.jsxs)(`div`,{className:Yx(`note`,{cursor:!1,noted:!1}),onKeyDown:e=>e.stopPropagation(),onMouseUp:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:[(0,U.jsx)(`span`,{className:Zx}),(0,U.jsx)(`span`,{}),(0,U.jsx)(`span`,{className:`text-accent`,children:`●`}),(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5 whitespace-normal`,children:[(0,U.jsx)(`textarea`,{ref:r,className:`${Zr} ${ai} font-mono`,"aria-label":V(c?`review.noteEditOn`:`review.noteOn`,{location:e.location}),autoFocus:!0,rows:3,value:t,disabled:i,onChange:e=>n(e.target.value),onFocus:e=>e.currentTarget.setSelectionRange(t.length,t.length),onKeyDown:t=>{t.key===`Enter`&&(t.ctrlKey||t.metaKey)?(t.preventDefault(),u()):t.key===`Escape`&&(t.preventDefault(),e.onCancel())}}),o&&(0,U.jsx)(`p`,{className:`m-0 text-error`,children:o}),(0,U.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,U.jsx)(W,{hit:`tight`,disabled:i||!l,onClick:()=>void u(),children:V(c?`review.noteSave`:`review.noteAdd`)}),(0,U.jsx)(W,{hit:`tight`,className:`text-muted`,disabled:i,onClick:e.onCancel,children:V(`review.noteCancel`)})]})]})]})}function IX({notes:e,states:t,sending:n,onShow:r,onEdit:i,onDrop:a,onSend:o}){H();let[s,c]=(0,h.useState)(!1);if(e.length===0)return null;let l=e.length;return(0,U.jsxs)(`div`,{className:`flex max-h-2/5 min-h-0 flex-none flex-col border-t-hairline border-line font-mono text-meta`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-1.5 narrow:px-2`,children:[(0,U.jsxs)(W,{variant:`row`,className:`flex min-w-0 flex-1 items-center gap-2 text-left text-ink`,"aria-expanded":s,onClick:()=>c(!s),children:[(0,U.jsx)(Bv,{right:!s}),(0,U.jsx)(`span`,{children:V(`review.count`,{count:l})})]}),(0,U.jsx)(W,{disabled:n,onClick:o,children:n?V(`review.sending`):V(`review.send`,{count:l})})]}),s&&(0,U.jsx)(`ul`,{className:`m-0 min-h-0 list-none overflow-y-auto p-0 pb-1`,children:e.map(e=>(0,U.jsxs)(`li`,{className:`flex flex-col gap-0.5 px-3 py-1 narrow:px-2`,children:[(0,U.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,U.jsx)(W,{variant:`row`,className:`min-w-0 flex-1 truncate text-left text-ink hover:underline`,title:V(`review.show`),onClick:()=>r(e),children:AX(e)}),t.get(e.id)===`moved`&&(0,U.jsx)(`span`,{title:V(`review.movedHint`),children:(0,U.jsx)(Px,{tone:`warning`,children:V(`review.moved`)})}),(0,U.jsx)(W,{hit:`tight`,onClick:()=>i(e),children:V(`review.edit`)}),(0,U.jsx)(W,{hit:`tight`,onClick:()=>a(e),children:V(`review.drop`)})]}),(0,U.jsx)(`p`,{className:`m-0 line-clamp-2 whitespace-pre-wrap wrap-anywhere text-muted`,children:e.body})]},e.id))})]})}var LX=[];function RX({model:e,view:t,active:n,restored:r,onClose:i}){H();let a=ff(),[o,s]=(0,h.useState)(gX),[c,l]=(0,h.useState)(uX),[u,d]=ZY(t),f=t.scope===`task`?u:null,p=f!==null,m=t.file===!0,g={taskId:t.taskId,path:t.path,scope:t.scope,...m?{content:!0}:{},...o?{ignoreWhitespace:!0}:{},...f?{base:f}:{}},_=Nx(e,t.taskId),v={...g,taskId:_},[y,x]=(0,h.useState)(()=>{let n=J(e,`diff.file`,v);return n===void 0?null:jx(n,t.path,p)}),[S,C]=(0,h.useState)(()=>J(e,`review.list`,{taskId:t.taskId})?.notes??[]),[w,T]=(0,h.useState)(()=>J(e,`diff.files`,{taskId:_})),[E,D]=(0,h.useState)(0),[O,k]=(0,h.useState)(null),[A,j]=(0,h.useState)(!1),[ee,te]=(0,h.useState)(new Map),[M,ne]=(0,h.useState)(!1),[N,P]=(0,h.useState)(0),ie=(0,h.useRef)(null),F=e.client,I=b(F.conn).state;(0,h.useEffect)(()=>{let e=!0;return F.request(`diff.file`,g).then(n=>e&&x(jx(os(F,`diff.file`,v,n),t.path,p)),t=>{if(e){if(f&&t instanceof Pc&&t.code===`BAD_REF`){d(null),z(t.message,`error`);return}x({kind:`text`,text:Pu(t),error:!0})}}),()=>{e=!1}},[F,t.taskId,t.path,t.scope,o,f,N,I]),(0,h.useEffect)(()=>{let e=!0;return F.request(`diff.files`,{taskId:t.taskId}).then(t=>e&&T(os(F,`diff.files`,{taskId:_},t)),()=>{}),()=>{e=!1}},[F,t.taskId,N]);let ae=()=>void ss(F,`review.list`,{taskId:t.taskId}).then(e=>C(e.notes));(0,h.useEffect)(ae,[F,t.taskId,N]);let L=(0,h.useRef)(!1);(0,h.useEffect)(()=>{n&&(L.current||!r)&&ie.current?.focus(),L.current=!0},[n,r]);let R=y?.kind===`rows`?y.rows:LX,oe=y?.kind===`rows`&&y.diff,se=w?.base??null,ce=t.path!==`.`&&t.scope===`working`&&TX(w?.files??[],t.path),le=yX(F,t.taskId,t.path,m&&ce&&!oe,N),ue=(0,h.useMemo)(()=>R.map((e,t)=>`row-${t}`),[R]),B=(0,h.useMemo)(()=>gx(R),[R]),de=(0,h.useMemo)(()=>lX(R),[R]),fe=(0,h.useMemo)(()=>fX(c,t.taskId,de),[c,t.taskId,de]),pe=(0,h.useMemo)(()=>{let e=new Set;for(let t of de.keys())(ee.get(t)??(Tx(t)||fe.has(t)))&&e.add(t);return e},[de,fe,ee]),me=(e,t)=>te(n=>{let r=new Map(n);for(let n of e)r.set(n,t);return r}),he=(0,h.useMemo)(()=>hx(R,pe),[R,pe]),ge=(0,h.useMemo)(()=>S.filter(e=>e.sentAt===void 0),[S]),_e=(0,h.useMemo)(()=>ge.map(e=>({note:e,at:MX(e,R)})),[ge,R]),ve=(0,h.useMemo)(()=>{let e=new Set;for(let{at:t}of _e)if(t)for(let n=t.first;n<=t.last;n++)e.add(n);return e},[_e]),ye=(0,h.useMemo)(()=>{let e=new Map;for(let{note:t,at:n}of _e)n&&e.set(n.last,[...e.get(n.last)??[],t]);return e},[_e]),be=t.path===`.`&&y!==null&&!(y.kind===`text`&&y.error),xe=(0,h.useMemo)(()=>{let e=new Map;for(let{note:t}of _e)e.set(t.id,NX(t,R,be));return e},[_e,R,be]);(0,h.useEffect)(()=>{if(he.includes(E))return;let e=E;for(;e>0&&R[e]?.kind!==`file`;)e--;D(e),k(null)},[he,E,R]);let Se=(0,h.useRef)(!1);(0,h.useEffect)(()=>{if(!Se.current){Se.current=!0;return}ie.current?.querySelector(`[data-row="${E}"]`)?.scrollIntoView({block:`nearest`})},[E]);let Ce=mx(R,E,O),we=e=>me([e],!pe.has(e)),Te=[...B.keys()].flatMap(e=>R[e]?.path?[R[e]?.path]:[]),Ee=(0,h.useMemo)(()=>Ax(B,R),[B,R]),De=Te.length>0&&Te.every(e=>pe.has(e)),Oe=[...B.values()].reduce((e,t)=>({added:e.added+t.added,removed:e.removed+t.removed}),{added:0,removed:0}),ke=e=>{let n=pX(c,t.taskId,e,fe.has(e)?void 0:de.get(e));l(n),dX(n),te(t=>{let n=new Map(t);return n.delete(e),n})},Ae=()=>{_X(!o),s(!o)},je=PX({client:F,taskId:t.taskId,rows:R,target:Ce,onSaved:e=>{e&&(k(null),j(!1)),ae()},focusView:()=>ie.current?.focus()}),Me=e=>{Ie(e),(t.path===`.`||t.path===e.filePath)&&je.edit(e)},Ne=e=>void F.request(`review.remove`,{taskId:t.taskId,id:e.id}).then(ae).catch(e=>z(Mx(e).message,`error`)),Pe=b(re),Fe=()=>{let e=px(R,E,O);if(e){if(!Pe?.startsWith(`${t.taskId}::`)){z(V(`files.mentionNoEngine`),`error`);return}F.request(`term.input`,{stream:Pe,data:fx(e)}).then(()=>{k(null),uc(Pe)?.focus()}).catch(e=>z(e instanceof Error?e.message:String(e),`error`))}},Ie=e=>{let n=MX(e,R),r=R.findIndex(t=>t.kind===`file`&&t.path===e.filePath);n?(me([e.filePath],!1),D(n.first)):t.path===`.`&&r>=0?D(r):t.path!==e.filePath&&t.path!==`.`&&yw({taskId:t.taskId,path:e.filePath,scope:t.scope}),k(null),j(!1)},Le=()=>{ne(!0),F.request(`review.send`,e.engineTarget(t.taskId)).then(e=>{z(e.delivered?V(`preview.sent`,{count:e.sent}):V(`preview.notSent`,{reason:e.reason??``}),e.delivered?`info`:`error`),ae()}).catch(e=>z(e instanceof Error?e.message:String(e),`error`)).finally(()=>ne(!1))},Re=()=>{let e=mX([...B.keys()],E);e!==null&&(D(e),k(null),j(!1))},ze=()=>{let e=mX(_e.flatMap(({at:e})=>e?[e.first]:[]).sort((e,t)=>e-t),E);if(e===null)return;let t=R[e]?.path;t&&me([t],!1),D(e),k(null),j(!1)},Be=e=>D(t=>{let n=Math.max(0,he.indexOf(t));return he[Math.min(he.length-1,Math.max(0,n+e))]??t}),Ve=e=>{let t=e.key;if(t===`j`||t===`ArrowDown`)Be(1);else if(t===`k`||t===`ArrowUp`)Be(-1);else if(t===`v`)k(e=>e===null?E:null),j(!0);else if(t===`c`&&!e.ctrlKey)je.add();else if(t===`x`){let e=_e.find(({at:e})=>e&&E>=e.first&&E<=e.last);e&&Ne(e.note)}else if(t===`s`)Le();else if(t===`z`){let e=R[E]?.path;e&&oe&&we(e)}else if(t===`r`)P(e=>e+1);else if(t===`q`||t===`Escape`)i();else if(e.ctrlKey&&!e.metaKey&&t.toLowerCase()===`c`&&!window.getSelection()?.toString())i();else return;e.preventDefault()},He=()=>{let e=window.getSelection();if(!e||e.isCollapsed)return;let t=e=>(e instanceof Element?e:e?.parentElement)?.closest(`[data-row]`),n=t(e.anchorNode),r=t(e.focusNode);!n||!r||(k(Number(n.dataset.row)),D(Number(r.dataset.row)),j(!0))},Ue=tX({rowClick:(e,t)=>{window.getSelection()?.isCollapsed!==!1&&(t.shiftKey?k(e=>e??E):(!a||O===null)&&k(null),D(e),j(!0))},fileClick:(e,t)=>{D(e),k(null),j(!1),t&&we(t)},viewedClick:ke,editNote:Me}),We=O===null?E:Math.min(O,E),Ge=O===null?E:Math.max(O,E);return(0,U.jsxs)(`div`,{className:`group/preview @container/preview flex min-h-0 min-w-0 flex-1 flex-col outline-none`,"data-file":m&&!oe?``:void 0,tabIndex:0,ref:ie,onKeyDown:Ve,children:[ce&&(0,U.jsx)(vX,{taskId:t.taskId,path:t.path,file:m}),oe&&(0,U.jsx)(iX,{picker:se!==null&&(0,U.jsx)(KY,{taskId:t.taskId,model:e,scope:t.scope,onScope:e=>yw({taskId:t.taskId,path:t.path,scope:e}),base:se,custom:u,onPick:d}),ignoreWs:o,onToggleWs:Ae,files:Te.length,shape:Ee,added:Oe.added,removed:Oe.removed,viewed:fe.size,allFolded:De,onFoldAll:()=>me(Te,!De),onNextFile:Re,onNextComment:_e.some(({at:e})=>e)?ze:null}),(0,U.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto py-1.5 font-mono text-meta/normal`,onMouseUp:He,children:[!y&&(0,U.jsx)(`p`,{className:`mx-2.5 my-3 font-mono text-meta text-subtle`,children:V(`preview.loading`)}),y?.kind===`text`&&(0,U.jsx)(`p`,{className:`mx-2.5 my-3 font-mono text-meta text-subtle ${y.error?`text-error`:``}`,children:y.text}),he.map(e=>{let t=R[e],n=e>=We&&e<=Ge;if(t.kind===`file`){let r=B.get(e),i=t.path;return(0,U.jsx)(QY,{index:e,name:t.text,path:i,closed:i!==null&&pe.has(i),viewed:i!==null&&fe.has(i),cursor:n,added:r?.added??0,removed:r?.removed??0,onToggleFold:Ue.fileClick,onToggleViewed:Ue.viewedClick},ue[e])}return(0,U.jsx)(rX,{index:e,row:t,cursor:n,noted:ve.has(e),actions:A&&Ce&&!je.node&&e===Ge&&(0,U.jsx)($Y,{showRange:a&&O===null,ranged:O!==null,onComment:je.add,onRange:()=>k(E),onAsk:Fe}),notes:ye.get(e),changed:t.newNo!==null&&le?.has(t.newNo)===!0,composer:e===je.row?je.node:void 0,editId:e===je.row?je.editId:void 0,onClick:Ue.rowClick,onEditNote:Ue.editNote},ue[e])}),je.row===-1&&je.node]}),(0,U.jsx)(IX,{notes:ge,states:xe,sending:M,onShow:Ie,onEdit:Me,onDrop:Ne,onSend:Le})]})}function zX(e){H();let{model:t,view:n}=e,r=n.path===`.`?null:rI(n.path),[i,a]=(0,h.useState)(null),o=b(t.tasks);if(!r)return(0,U.jsx)(RX,{...e});let s=i===n.path,c=JSON.stringify(o?.tasks.find(e=>e.id===n.taskId)?.changes??null);return(0,U.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,U.jsxs)(`div`,{className:`flex gap-x-3 px-2.5 py-1`,children:[(0,U.jsx)(W,{variant:`pill`,hit:`tight`,"aria-current":!s,onClick:()=>a(null),children:`[ ${V(`artifact.preview`)} ]`}),(0,U.jsx)(W,{variant:`pill`,hit:`tight`,"aria-current":s,onClick:()=>a(n.path),children:`[ ${V(`artifact.source`)} ]`})]}),s?(0,U.jsx)(RX,{...e}):(0,U.jsx)(xL,{model:t,taskId:n.taskId,path:n.path,kind:r,changeKey:c})]})}var BX=6e4,VX=new class{known=new Map;get(e){return this.known.get(e)}due(e,t){let n=this.known.get(e);return!n||t-n.at>=BX}set(e,t,n){t===null&&this.known.get(e)?.probe||this.known.set(e,{probe:t,at:n})}};function HX(e,t,n){let[,r]=(0,h.useState)(0);(0,h.useEffect)(()=>{if(!n||!VX.due(t,Date.now()))return;let i=!0;return e.request(`browser.probe`,{url:t,origin:window.location.origin}).then(e=>VX.set(t,e,Date.now()),()=>VX.set(t,null,Date.now())).then(()=>i&&r(e=>e+1)),()=>{i=!1}},[e,t,n]);let i=n?VX.get(t):void 0;return{pending:n&&!i,probe:i?.probe??null}}function UX(e){let t=rC(),n=aC(e.taskId,e.tabId),[r,i]=(0,h.useState)(null),[a,o]=(0,h.useState)(!1),s=(0,h.useRef)(null),c=(0,h.useRef)(e.url);c.current=e.url;let l=(0,h.useRef)(e.onUrlSync);l.current=e.onUrlSync,(0,h.useEffect)(()=>{if(t)return dC(o)},[t]),(0,h.useEffect)(()=>{if(!t||!e.enabled||!e.url)return;let r=!0,a=cC(n);return t.attach({panelKey:n,taskId:e.taskId,url:e.url,...a?{adoptTabId:a}:{}}).then(n=>{r&&(s.current=n.id,i(n),n.url&&n.url!==e.url&&!a&&t.navigate(n.id,e.url))}).catch(()=>{}),()=>{r=!1;let e=s.current;e&&t.setVisible(e,!1).catch(()=>{})}},[t,e.enabled,e.taskId,n,e.url]),(0,h.useEffect)(()=>{if(!(!t||!e.enabled))return t.onState(e=>{(e.panelKey===n||e.id===s.current)&&(s.current=e.id,i(e),e.url&&/^https?:\/\//i.test(e.url)&&e.url!==c.current&&l.current(e.url))})},[t,e.enabled,n]);let u=r?.id??null,d=!!(t&&e.enabled&&e.shown&&!e.paused&&!a&&u);(0,h.useEffect)(()=>{if(!t||!u)return;let n=e.stage.current;if(!d||!n){t.setVisible(u,!1).catch(()=>{});return}let r=0,i=()=>{let e=n.getBoundingClientRect();if(e.width<=0||e.height<=0){t.setVisible(u,!1).catch(()=>{});return}t.setBounds(u,{x:e.left,y:e.top,width:e.width,height:e.height}).catch(()=>{})},a=()=>{cancelAnimationFrame(r),r=requestAnimationFrame(i)};i();let o=new ResizeObserver(a);return o.observe(n),window.addEventListener(`resize`,a),()=>{cancelAnimationFrame(r),o.disconnect(),window.removeEventListener(`resize`,a),t.setVisible(u,!1).catch(()=>{})}},[t,u,d,e.stage]);let f=(0,h.useCallback)(e=>{let n=s.current;!t||!n||t.navigate(n,e).then(e=>i(e)).catch(()=>{})},[t]),p=(0,h.useCallback)(()=>{let e=s.current;!t||!e||t.goBack(e).then(e=>i(e)).catch(()=>{})},[t]),m=(0,h.useCallback)(()=>{let e=s.current;!t||!e||t.goForward(e).then(e=>i(e)).catch(()=>{})},[t]),g=(0,h.useCallback)(()=>{let e=s.current;!t||!e||t.reload(e).then(e=>i(e)).catch(()=>{})},[t]),_=(0,h.useCallback)(()=>{let e=s.current;if(!t||!e)return;let n=r?.owner===`agent`?`human`:`agent`;t.handoff(e,n).then(e=>{z(V(e.owner===`agent`?`browser.handedToAgent`:`browser.handedToHuman`,{id:e.id}),`info`)}).catch(()=>{})},[t,r?.owner]),v=(0,h.useCallback)(async()=>{let e=s.current;if(!t||!e)throw Error(`native browser tab is not ready`);return`data:image/png;base64,${await t.capture(e)}`},[t]);return t?{state:r,navigate:f,goBack:p,goForward:m,reload:g,toggleHandoff:_,captureDataUrl:v}:null}function WX({d:e}){return(0,U.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,U.jsx)(`path`,{d:e})})}function GX(e){let t=HY(e.model,e.taskId);return(0,U.jsxs)(`div`,{className:kr,children:[t.length>0&&(0,U.jsx)(`div`,{className:`flex w-[36ch] max-w-full flex-col text-left text-ink`,children:t.map(t=>(0,U.jsxs)(`button`,{type:`button`,className:Xi({size:`file`}),title:t.url,onClick:()=>e.onOpen(t.url),children:[(0,U.jsx)(`span`,{className:`row-title min-w-0 flex-1 truncate`,children:t.command}),(0,U.jsx)(`span`,{className:`flex-none text-subtle`,children:`:${t.port}`})]},t.port))}),(0,U.jsx)(`p`,{children:V(t.length>0?`browser.empty`:`browser.emptyPorts`)})]})}var KX=`M6.5 3.5h-3v9h9v-3M9.5 3.5h3v3M12.5 3.5l-5 5`;function qX({model:e,taskId:t,tab:n,root:r,shown:i,restored:a,onClose:o,onNavigate:s,onStep:c}){H();let l=BS(n),u=AS(l),d=u===null?l:jS(u,r),[f,p]=(0,h.useState)(d),[m,g]=(0,h.useState)(null),[_,v]=(0,h.useState)(0),[y,x]=(0,h.useState)(!1),[S,C]=(0,h.useState)(void 0),w=(0,h.useRef)(null),T=(0,h.useRef)(null),E=b(e.client.conn).hello?.peer?.local,D=iC(),O=l&&u===null?RS(l,window.location,E,D):null;(0,h.useEffect)(()=>{p(d),g(null)},[d]);let[k,A]=(0,h.useState)(!1),[j,ee]=(0,h.useState)(0);(0,h.useEffect)(()=>{let e=T.current;if(!e)return;let t=new ResizeObserver(()=>ee(e.clientWidth));return t.observe(e),()=>t.disconnect()},[]);let te=u===null||k||!T.current?f:YX(T.current,f,j),M=O?new URL(l).hostname:``,ne=!D&&O===`yes`&&l.startsWith(`https:`)&&!PS(M),{pending:N,probe:P}=HX(e.client,l,ne),re=l&&O?zS(l,O,P):null,ie=O===`yes`&&!re&&!N,F=UX({taskId:t,tabId:n.id,url:l,enabled:D&&u===null&&ie,shown:i,paused:y,stage:w,onUrlSync:s}),I=e=>{let t=NS(e,r),n=t===`outside`?null:t??LS(e);g(t===`outside`?`outside`:n===null&&e.trim()!==``?`invalid`:null),n!==null&&(n===l?(p(d),F&&u===null?F.reload():v(_+1)):(s(n),F&&AS(n)===null&&F.navigate(n)))},ae=()=>{if(y){x(!1),C(void 0);return}if(F){F.captureDataUrl().then(e=>{C(e),x(!0)},()=>{C(void 0),x(!1)});return}x(!0)},L=F&&u===null?!F.state?.canGoBack:n.at<=0,R=F&&u===null?!F.state?.canGoForward:n.at>=n.urls.length-1,oe=re?V(`browser.${re.key}`,{host:re.host}):O===null&&u===null?V(`browser.${m??`empty`}`):null;return(0,U.jsxs)(`div`,{className:Ar,children:[(0,U.jsxs)(`form`,{className:jr,onSubmit:e=>{e.preventDefault(),I(f)},children:[(0,U.jsx)(`button`,{type:`button`,className:dr({small:!0}),disabled:L,title:V(`browser.back`),"aria-label":V(`browser.back`),onClick:()=>F&&u===null?F.goBack():c(n.at-1),children:(0,U.jsx)(WX,{d:`M10 3.5 5.5 8l4.5 4.5`})}),(0,U.jsx)(`button`,{type:`button`,className:dr({small:!0}),disabled:R,title:V(`browser.forward`),"aria-label":V(`browser.forward`),onClick:()=>F&&u===null?F.goForward():c(n.at+1),children:(0,U.jsx)(WX,{d:`M6 3.5 10.5 8 6 12.5`})}),(0,U.jsx)(`button`,{type:`button`,className:dr({small:!0}),disabled:!ie&&u===null,title:V(`browser.reload`),"aria-label":V(`browser.reload`),onClick:()=>F&&u===null?F.reload():v(_+1),children:(0,U.jsx)(WX,{d:`M12.5 8a4.5 4.5 0 1 1-1.4-3.3M12.5 2.5v2.7H9.8`})}),(0,U.jsx)(`input`,{ref:T,className:`browser-url mono ${Mr}`,value:te,placeholder:V(`browser.placeholder`),onFocus:()=>A(!0),onBlur:()=>A(!1),"aria-label":V(`browser.address`),"aria-invalid":m!==null,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,inputMode:`url`,onChange:e=>p(e.target.value)}),F?.state&&ie&&(0,U.jsx)(W,{variant:`pill`,"aria-current":F.state.owner===`agent`?`true`:void 0,title:F.state.handoffReason??(F.state.owner===`agent`?V(`browser.takeControl`):V(`browser.handToAgent`)),onClick:()=>F.toggleHandoff(),children:F.state.owner===`agent`?V(`browser.takeControl`):V(`browser.handToAgent`)}),($J()||D)&&(0,U.jsx)(W,{variant:y&&ie?`iconOn`:`icon`,disabled:!ie,title:V(`browser.annotate`),"aria-label":V(`browser.annotate`),"aria-pressed":y&&ie,onClick:ae,children:(0,U.jsx)(WX,{d:`M3 13l.6-2.6L10.9 3.1l2 2L5.6 12.4zM9.6 4.4l2 2`})}),l&&u===null?(0,U.jsx)(`a`,{className:dr({small:!0}),href:l,target:`_blank`,rel:`noopener noreferrer`,title:V(`browser.openTab`),"aria-label":V(`browser.openTab`),children:(0,U.jsx)(WX,{d:KX})}):(0,U.jsx)(`button`,{type:`button`,className:dr({small:!0}),disabled:!0,"aria-label":V(`browser.openTab`),children:(0,U.jsx)(WX,{d:KX})})]}),u===null?ie?(0,U.jsxs)(`div`,{ref:w,className:Nr,"data-native-browser":F?.state?.id??void 0,children:[!D&&(0,U.jsx)(`iframe`,{className:`min-w-0 flex-1 rounded-sm border-none bg-paper`,src:l,title:l,sandbox:`allow-scripts allow-same-origin allow-forms allow-popups`,referrerPolicy:`no-referrer`},`${l}#${_}`),y&&(0,U.jsx)(BY,{model:e,taskId:t,url:l,target:w,backdrop:S,onClose:()=>{x(!1),C(void 0)}},`${l}#${_}`)]}):O===null&&m===null?(0,U.jsx)(GX,{model:e,taskId:t,onOpen:s}):oe?(0,U.jsx)(`p`,{className:kr,children:oe}):null:(0,U.jsx)(zX,{model:e,view:{taskId:t,path:u,scope:`working`,file:!0},active:i,restored:a,onClose:o},`${u}#${_}#${n.read??``}`)]})}var JX=document.createElement(`canvas`).getContext(`2d`);function YX(e,t,n){let r=getComputedStyle(e),i=n-Number.parseFloat(r.paddingLeft)-Number.parseFloat(r.paddingRight);return!JX||!(i>0)?t:(JX.font=r.font,MS(t,e=>JX.measureText(e).width<=i))}var XX=`scrollbar-none flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto p-3`,ZX=`m-0 p-3 font-mono text-meta text-muted`,QX=`flex items-baseline justify-between gap-3 font-mono text-meta normal-nums`,$X=`flex h-1.5 w-full gap-px overflow-hidden rounded-full bg-inset`,eZ=`h-full min-w-[2px] flex-none`,tZ=`m-0 flex list-none flex-col p-0`,nZ=`-mx-1 flex h-5.5 min-w-0 items-center gap-2 rounded-xs px-1 font-mono text-meta normal-nums`,rZ=`mt-2`,iZ=`size-2 flex-none rounded-full bg-line`,aZ=`flex min-w-0 flex-1 items-center gap-1.5`,oZ=`min-w-0 truncate text-muted`,sZ=`w-[7ch] flex-none text-right text-ink`,cZ=`w-[6ch] flex-none text-right text-muted`,lZ=`group/fold`,uZ=`${nZ} cursor-pointer list-none hover:bg-hover focus-visible:outline focus-visible:outline-1 focus-visible:outline-focus [&::-webkit-details-marker]:hidden`,dZ=`m-0 flex list-none flex-col p-0`,fZ=`${nZ} pl-5`,pZ=`flex min-w-0 flex-1 overflow-hidden`,mZ=`min-w-0 truncate text-subtle`,hZ=`flex-none text-muted`,gZ=`w-[7ch] flex-none text-right text-muted`,_Z=`w-[6ch] flex-none`,vZ=1e4,yZ={system:`var(--info)`,system_prompt:`var(--info)`,system_tools:`var(--success)`,mcp_tools:`var(--warning)`,mcp_instructions:`var(--warning)`,custom_agents:`var(--ink)`,memory_files:`var(--merged)`,skills:`var(--muted)`,messages:`var(--accent)`,used:`var(--accent)`},bZ=[`var(--info)`,`var(--success)`,`var(--warning)`,`var(--merged)`];function xZ({model:e,task:t,active:n}){H();let r=b(e.client.conn),i=b(e.selection),a=b(e.tabs)[t.id]??[],o=i.taskId===t.id?a.find(e=>e.id===i.tabId):void 0,s=(o?.kind===`engine`?o:a.find(e=>e.kind===`engine`))?.id??null,[c,l]=(0,h.useState)({kind:`loading`}),[u,d]=(0,h.useState)(!1),f=(0,h.useRef)(``);if((0,h.useEffect)(()=>{if(!n||r.state!==`open`)return;let i=`${t.id}::${s}`;if(f.current!==i&&l({kind:`loading`}),f.current=i,!s){l({kind:`ready`,meter:null});return}let a=!0,o=n=>e.client.request(`context.usage`,{taskId:t.id,tabId:s,probe:n}).then(e=>a&&l({kind:`ready`,meter:e.meter})).catch(e=>a&&l(t=>t.kind===`ready`?t:{kind:`failed`,error:vS(e)})),c=()=>{d(!0),o(!0).finally(()=>a&&d(!1))};o(!1).then(c);let u=ua(vZ,c);return()=>{a=!1,d(!1),u()}},[e,n,r.state,t.id,s]),c.kind===`loading`)return(0,U.jsx)(`p`,{className:ZX,children:V(`context.loading`)});if(c.kind===`failed`)return(0,U.jsx)(`p`,{className:ZX,children:V(`context.failed`,{error:c.error})});if(!c.meter)return(0,U.jsx)(`p`,{className:ZX,children:V(`context.none`)});let p=c.meter,m=p.rows.filter(e=>e.share!==void 0),g=e=>e.share===void 0?void 0:yZ[e.key]??bZ[m.indexOf(e)%bZ.length],_=`${p.approximate?`~`:``}${CZ(p.used)}`;return(0,U.jsxs)(`div`,{className:XX,children:[(0,U.jsxs)(`div`,{className:QX,children:[(0,U.jsx)(`span`,{className:`text-ink`,children:p.percent===null?V(`context.usedTokens`,{tokens:_}):V(`context.used`,{percent:wZ(p.percent)})}),p.window!==null&&(0,U.jsxs)(`span`,{className:`text-muted`,children:[_,` / `,CZ(p.window)]})]}),(0,U.jsx)(`div`,{className:$X,role:`meter`,"aria-valuenow":Math.round(p.percent??100),"aria-valuemin":0,"aria-valuemax":100,children:m.map(e=>(0,U.jsx)(`span`,{className:eZ,style:{width:`${e.share}%`,background:g(e)}},e.key))}),(0,U.jsx)(`ul`,{className:tZ,children:p.rows.map((e,t)=>{let n=`context.part.${e.key}`,r=V(n)===n?e.label??e.key:V(n),i=g(e),a=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:iZ,style:i?{background:i}:void 0}),(0,U.jsxs)(`span`,{className:aZ,children:[(0,U.jsx)(`span`,{className:oZ,title:r,children:r}),e.items&&(0,U.jsx)(`span`,{className:`inline-block flex-none text-subtle group-open/fold:rotate-90`,children:`›`})]}),(0,U.jsx)(`span`,{className:sZ,children:CZ(e.tokens)}),(0,U.jsx)(`span`,{className:cZ,children:e.deferred?`—`:wZ(e.tokens/(p.window??p.used)*100)})]}),o=(e.deferred?!p.rows[t-1]?.deferred:e.share===void 0)?rZ:void 0;if(!e.items)return(0,U.jsx)(`li`,{className:o,children:(0,U.jsx)(`div`,{className:nZ,children:a})},e.key);let s=e.items.reduce((e,t)=>e+t.tokens,0),c=(e.itemCount??e.items.length)-e.items.length;return(0,U.jsx)(`li`,{className:o,children:(0,U.jsxs)(`details`,{className:lZ,children:[(0,U.jsx)(`summary`,{className:uZ,children:a}),(0,U.jsxs)(`ul`,{className:dZ,children:[e.items.map(e=>(0,U.jsx)(SZ,{name:e.name,tokens:e.tokens},e.name)),c>0&&(0,U.jsx)(SZ,{name:V(`context.more`,{count:c}),tokens:e.tokens-s})]})]})},e.key)})}),u&&m.length<2&&(0,U.jsx)(`p`,{className:`m-0 font-mono text-meta text-subtle`,children:V(`context.probing`)})]})}function SZ({name:e,tokens:t}){let n=e.lastIndexOf(`/`)+1;return(0,U.jsxs)(`li`,{className:fZ,title:e,children:[(0,U.jsxs)(`span`,{className:pZ,children:[n>0&&(0,U.jsx)(`span`,{className:`min-w-0 truncate text-subtle`,children:e.slice(0,n)}),(0,U.jsx)(`span`,{className:n>0?hZ:mZ,children:e.slice(n)})]}),(0,U.jsx)(`span`,{className:gZ,children:CZ(Math.max(0,t))}),(0,U.jsx)(`span`,{className:_Z})]})}function CZ(e){return e>=1e6?`${+(e/1e6).toFixed(1)}M`:e>=1e3?`${+(e/1e3).toFixed(1)}k`:String(e)}function wZ(e){return e>0&&e<.1?`<0.1%`:`${e<10?+e.toFixed(1):Math.round(e)}%`}var TZ=3;function EZ({model:e,task:t}){H();let n=t.autoFixCi,r=n=>void e.client.request(`task.autoFixCi`,{taskId:t.id,enabled:n}).catch(e=>z(e instanceof Error?e.message:String(e),`error`));return(0,U.jsx)(`div`,{className:`flex items-center gap-3 px-2 pt-1 font-mono text-meta`,children:n?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:n.stopped?Ou.attention:`text-muted`,title:V(`files.autoFix.hint`),children:V(n.stopped?`files.autoFix.stopped`:`files.autoFix.count`,{n:n.attempts,max:TZ})}),(0,U.jsx)(W,{hit:`tight`,onClick:()=>r(!1),children:V(`files.autoFix.off`)})]}):(0,U.jsx)(W,{hit:`tight`,title:V(`files.autoFix.hint`),onClick:()=>r(!0),children:V(`files.autoFix.on`)})})}function DZ(e){let t=e.pr;return!!t&&t.number!==void 0&&!e.machine&&(t.lifecycle===`open`||t.lifecycle===`ready_to_merge`)}function OZ(e){let t={fail:0,pending:0,pass:0,skipped:0};for(let n of e)t[n.state]++;return t}function kZ(e){let t=Math.max(0,Math.round(e/1e3));if(t<60)return`${t}s`;let n=Math.floor(t/60);return n<60?`${n}m${String(t%60).padStart(2,`0`)}s`:`${Math.floor(n/60)}h${String(n%60).padStart(2,`0`)}m`}function AZ(e,t){let{startedAt:n,completedAt:r,durationMs:i}=e;return e.state===`pending`?n?{key:`files.checks.runningFor`,vars:{elapsed:kZ(t-n)}}:null:i===null?r?{key:`files.checks.finishedAgo`,vars:{age:_c(t-r)}}:null:r?{key:`files.checks.tookAgo`,vars:{duration:kZ(i),age:_c(t-r)}}:{key:`files.checks.took`,vars:{duration:kZ(i)}}}function jZ(e){let t=[],n=e.mergeState.toUpperCase();e.draft&&t.push({key:`files.merge.draft`,tone:`warning`}),e.mergeable.toUpperCase()===`CONFLICTING`||n===`DIRTY`?t.push({key:`files.merge.conflicts`,tone:`attention`}):n===`BEHIND`?t.push({key:`files.merge.behind`,tone:`warning`}):n===`UNSTABLE`?t.push({key:`files.merge.unstable`,tone:`warning`}):n===`BLOCKED`?t.push({key:`files.merge.blocked`,tone:`warning`}):n===`CLEAN`&&!e.draft&&t.push({key:`files.merge.clean`,tone:`success`});let r=e.review.toUpperCase();return r===`APPROVED`?t.push({key:`files.merge.approved`,tone:`success`}):r===`CHANGES_REQUESTED`?t.push({key:`files.merge.changes`,tone:`attention`}):r===`REVIEW_REQUIRED`&&t.push({key:`files.merge.reviewRequired`,tone:`warning`}),t}var MZ={pass:{glyph:`✓`,tone:`success`},fail:{glyph:`✗`,tone:`attention`},pending:{glyph:`●`,tone:`warning`},skipped:{glyph:`–`,tone:`muted`}};function NZ({model:e,task:t}){H();let n=t.pr,r=t.id,[i,a]=(0,h.useState)(()=>J(e,`pr.checks`,{taskId:r})??null),[o,s]=(0,h.useState)(null),[c,l]=(0,h.useState)({}),[u,d]=(0,h.useState)(0),f=`${n?.number}:${n?.checkState}:${n?.mergeable}:${n?.reviewDecision}`;(0,h.useEffect)(()=>{let t=!0,n={taskId:r};return e.client.request(`pr.checks`,u>0?{...n,fresh:!0}:n).then(r=>{t&&(os(e,`pr.checks`,n,r),a(r))},e=>t&&a({outcome:`unavailable`,detail:e instanceof Error?e.message:String(e)})),()=>{t=!1}},[e,r,f,u]);let p=t=>{let n=`${t.runId}:${t.name}`;if(c[n]){l(({[n]:e,...t})=>t);return}l(e=>({...e,[n]:{state:`loading`}})),e.client.request(`pr.checkLog`,{taskId:r,runId:t.runId,job:t.name}).then(e=>e.outcome===`ok`?{state:`text`,text:e.tail}:e.outcome===`none`?{state:`note`,text:V(`files.checks.noLog`)}:{state:`note`,text:V(`files.checks.logUnavailable`,{detail:e.detail})}).catch(e=>({state:`note`,text:V(`files.checks.logUnavailable`,{detail:e instanceof Error?e.message:String(e)})})).then(e=>l(t=>n in t?{...t,[n]:e}:t))},m=(0,U.jsx)(W,{hit:`tight`,className:`flex-none whitespace-nowrap`,onClick:()=>d(e=>e+1),children:V(`files.checks.refresh`)});if(!i)return(0,U.jsx)(`div`,{className:gq,children:(0,U.jsx)(`div`,{className:_q,children:(0,U.jsxs)(`span`,{className:`flex-1 text-muted`,children:[V(`files.checks.title`),` `,V(`files.checks.loading`)]})})});if(i.outcome!==`ok`)return(0,U.jsx)(`div`,{className:gq,children:(0,U.jsxs)(`div`,{className:_q,children:[(0,U.jsx)(`span`,{className:`min-w-0 flex-1 text-muted wrap-anywhere`,children:i.outcome===`none`?V(`files.checks.none`):V(`files.checks.unavailable`,{detail:i.detail})}),m]})});let g=OZ(i.checks),_=Date.now(),v=o??(g.fail>0||g.pending>0),y=jZ(i);return(0,U.jsxs)(`div`,{className:gq,children:[(0,U.jsxs)(`div`,{className:_q,children:[(0,U.jsxs)(W,{variant:`row`,className:vq,"aria-expanded":v,disabled:i.total===0,onClick:()=>s(!v),children:[i.total>0&&(0,U.jsx)(Bv,{right:!v}),(0,U.jsx)(`span`,{children:i.total===0?V(`files.checks.none`):V(`files.checks.summary`,{pass:g.pass+g.skipped,total:i.total})}),g.fail>0&&(0,U.jsx)(`span`,{className:Ou.attention,children:V(`files.checks.failed`,{count:g.fail})}),g.pending>0&&(0,U.jsx)(`span`,{className:Ou.warning,children:V(`files.checks.running`,{count:g.pending})}),y.map(e=>(0,U.jsx)(`span`,{className:Ou[e.tone],children:V(e.key)},e.key))]}),m]}),v&&i.checks.map(e=>{let{glyph:t,tone:n}=MZ[e.state],r=AZ(e,_),i=`${e.runId}:${e.name}`,a=c[i];return(0,U.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,U.jsxs)(`div`,{className:`flex items-baseline gap-2 pl-4`,children:[(0,U.jsx)(`span`,{className:`w-[1ch] flex-none text-center ${Ou[n]}`,children:t}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.name,children:e.name}),r&&(0,U.jsx)(`span`,{className:`flex-none text-subtle`,children:V(r.key,r.vars)}),e.state===`fail`&&e.runId&&(0,U.jsx)(W,{hit:`tight`,className:`flex-none whitespace-nowrap`,onClick:()=>p(e),children:V(a?`files.checks.hideLog`:`files.checks.log`)})]}),a&&(0,U.jsx)(`pre`,{className:`m-0 ml-4 mb-1 max-h-40 overflow-y-auto rounded-sm border-hairline border-line bg-inset px-2 py-1.5 whitespace-pre-wrap wrap-anywhere text-muted`,children:a.state===`loading`?V(`files.checks.loading`):a.text})]},`${e.name}:${e.url}`)}),v&&i.total>i.checks.length&&(0,U.jsx)(`span`,{className:`pl-4 text-subtle`,children:V(`files.checks.more`,{count:i.total-i.checks.length})})]})}function PZ({model:e,task:t}){return DZ(t)?(0,U.jsxs)(`div`,{onKeyDown:e=>e.stopPropagation(),children:[(0,U.jsx)(NZ,{model:e,task:t}),(0,U.jsx)(EZ,{model:e,task:t})]}):null}function FZ(e,t){return e.dir===t.dir?e.name<t.name?-1:+(e.name>t.name):e.dir?-1:1}function IZ(e,t){let n={children:new Map,file:!1};for(let t of e){let e=n;for(let n of t.split(`/`)){let t=e.children.get(n);t||(t={children:new Map,file:!1},e.children.set(n,t)),e=t}e.file=!0}let r=[],i=(e,n,a)=>{let o=[...e.children].sort(([e,t],[n,r])=>FZ({name:e,dir:t.children.size>0&&!t.file},{name:n,dir:r.children.size>0&&!r.file}));for(let[e,s]of o){let o=s.children.size>0&&!s.file,c=o?`${n}${e}/`:`${n}${e}`,l=o&&t.has(c);r.push({path:c,name:e,depth:a,dir:o,open:l}),l&&i(s,c,a+1)}};return i(n,``,0),r}var LZ={start:`\x1B[200~`,end:`\x1B[201~`};function RZ(e,t){return e.engineTarget(t).tabId??e.tabs.get()[t]?.find(e=>e.kind===`engine`)?.id}async function zZ(e,t,n){let r=RZ(e,t);if(!r)return z(V(`files.stripNoEngine`),`error`),!1;try{return e.selection.get().tabId!==r&&e.select(t,r),await e.client.request(`term.input`,{stream:Bc(t,r),data:`${LZ.start}${n}${LZ.end}`}),z(V(`files.stripFilled`)),!0}catch(e){return z(e instanceof Error?e.message:String(e),`error`),!1}}function BZ(e){let t=e.kind===`task`&&!e.noWorktree&&!e.machine&&!e.archived,n=e.changes;return t&&!!n&&`added`in n&&n.added+n.deleted>0}function VZ(e){return[...BZ(e)?[`commit`]:[],...HZ(e)]}function HZ(e){let t=e.pr;if(!t)return e.kind===`task`&&!e.noWorktree&&!e.machine&&!e.archived&&!e.sessionPrs?.length?[`createPR`]:[];if(t.lifecycle===`merged`)return e.archived?[]:[`archive`];if(t.lifecycle!==`open`&&t.lifecycle!==`ready_to_merge`)return[];let n=[];return((t.mergeable??``).toUpperCase()===`CONFLICTING`||e.prChip===`conflict`)&&n.push(`conflicts`),t.checkState===`failing`&&n.push(`fixCI`),(t.reviewDecision??``).toUpperCase()===`CHANGES_REQUESTED`&&n.push(`comments`),n}async function UZ(e,t,n){try{let r=await e.client.request(`task.prompt`,{taskId:t.id,kind:n});r.outcome===`unavailable`?z(V(`files.stripUnavailable`,{detail:r.detail??``}),`error`):r.outcome===`none`||!r.prompt?z(V(`files.stripNothing`),`error`):await zZ(e,t.id,r.prompt)}catch(e){z(e instanceof Error?e.message:String(e),`error`)}}var WZ={commit:`files.stripCommit`,createPR:`files.stripCreate`,conflicts:`files.stripConflicts`,fixCI:`files.stripFixCi`,comments:`files.stripComments`,archive:`files.stripArchive`};function GZ({model:e,task:t}){let n=VZ(t);return n.length===0?null:(0,U.jsx)(`div`,{className:`flex flex-wrap justify-end gap-x-3.5 gap-y-1 px-2 pb-2 font-mono text-meta whitespace-nowrap`,children:n.map(n=>(0,U.jsx)(W,{onClick:()=>n===`archive`?void Oj(e,t):void UZ(e,t,n),children:V(WZ[n])},n))})}function KZ({model:e,task:t,narrow:n=!1}){H();let[r,i]=(0,h.useState)(()=>J(e,`files.list`,{taskId:t.id})?.files??null),[a,o]=(0,h.useState)(()=>wX(J(e,`diff.files`,{taskId:t.id})?.files??[])),[s,c]=(0,h.useState)(null),[l,u]=(0,h.useState)(!1),[d,f]=(0,h.useState)(null),[p,m]=(0,h.useState)(new Set),[g,_]=(0,h.useState)(0),[v,y]=(0,h.useState)(0),x=(0,h.useRef)(null),S=b(re),C=b(e.client.conn),w=JSON.stringify(t.changes??null);(0,h.useEffect)(()=>{let n=!0;return ss(e,`files.list`,{taskId:t.id}).then(e=>{n&&(i(e.files),u(e.truncated===!0),c(e.root??null),f(null))},e=>n&&f(Pu(e))),()=>{n=!1}},[e,t.id,w,v,C.state]),(0,h.useEffect)(()=>{let n=!0;return ss(e,`diff.files`,{taskId:t.id}).then(e=>n&&o(wX(e.files)),()=>{}),()=>{n=!1}},[e,t.id,w,v,C.state]);let T=r!==null,E=IZ(r??[],p).map(e=>({path:e.path,label:e.name,depth:e.depth,dir:e.dir,open:e.open,state:a.get(e.path)})),D=Math.min(g,Math.max(0,E.length-1)),O=E[D],k=(e,t)=>m(n=>{let r=new Set(n);return t??!r.has(e)?r.add(e):r.delete(e),r}),A=e=>bw(t.id,e),j=e=>yw({taskId:t.id,path:e,scope:`working`}),ee=n=>{if(!S?.startsWith(`${t.id}::`)){z(V(`files.mentionNoEngine`),`error`);return}e.client.request(`term.input`,{stream:S,data:`@${n} `}).catch(e=>z(String(e),`error`))},te=(n,r,i)=>t.machine?z(V(`files.remoteNoExternal`,{host:t.machine.label}),`error`):void e.client.request(n,{taskId:t.id,path:r}).then(()=>i&&z(i)).catch(e=>z(e instanceof Error?e.message:String(e),`error`)),M=e=>te(`file.openExternal`,e,V(`taskops.openedExternal`)),ne=n=>void e.client.request(`file.openTerminal`,{taskId:t.id,path:n}).catch(e=>z(e instanceof Error?e.message:String(e),`error`)),N=e=>{let t=e.dir?e.path.slice(0,-1):e.path;return[{label:V(`files.menu.attach`),key:`a`,run:()=>ee(e.path)},{label:V(`files.menu.copy`),children:[{label:V(`files.menu.copyRelative`),run:()=>void YG(t,t)},...s?[{label:V(`files.menu.copyAbsolute`),run:()=>void YG(`${s}/${t}`,t)}]:[],{label:V(`files.menu.copyName`),run:()=>void YG(e.label,t)}]},{label:V(`files.menu.diff`),key:`d`,section:`open`,run:()=>j(e.path)},...e.dir?[]:[{label:V(`files.menu.openExternal`),key:`o`,section:`open`,run:()=>M(e.path)}],{label:V(`files.menu.reveal`),section:`open`,run:()=>te(`file.reveal`,t)},{label:V(`files.menu.terminal`),section:`terminal`,run:()=>ne(t)}]};return(0,U.jsxs)(`div`,{className:`group/pane flex min-h-0 min-w-0 flex-1 flex-col outline-none ${n?`px-1.5 pt-2.5 pb-2`:`p-1.5`}`,tabIndex:0,ref:x,onKeyDown:e=>{let t=e.key;if(t===`j`||t===`ArrowDown`)_(Math.min(E.length-1,D+1));else if(t===`k`||t===`ArrowUp`)_(Math.max(0,D-1));else if((t===`l`||t===`ArrowRight`)&&O?.dir)k(O.path,!0);else if((t===`h`||t===`ArrowLeft`)&&O?.dir)k(O.path,!1);else if(t===`r`)y(e=>e+1);else if(t===`D`&&e.shiftKey)j(`.`);else if(t===`d`&&O)j(O.path);else if(t===`Enter`&&O)O.dir?k(O.path):A(O.path);else if(t===`a`&&O)ee(O.path);else if(t===`o`&&O&&!O.dir)M(O.path);else return;e.preventDefault()},children:[(0,U.jsx)(GZ,{model:e,task:t}),(0,U.jsx)(PZ,{model:e,task:t}),(0,U.jsx)(UY,{model:e,task:t}),(0,U.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[d&&(0,U.jsx)(`p`,{className:`mono text-error`,children:d}),!d&&T&&E.length===0&&(0,U.jsx)(`p`,{className:`mx-2.5 my-3 font-mono text-meta text-subtle`,children:V(`files.emptyAll`)}),E.map((e,t)=>(0,U.jsxs)(`button`,{type:`button`,className:Xi({selected:t===D,size:n?`file-narrow`:`file`}),style:{paddingLeft:8+e.depth*14},title:e.path,onContextMenu:n=>{_(t),Sq(n,N(e))},onClick:()=>{_(t),x.current?.focus(),e.dir?k(e.path):A(e.path)},children:[(0,U.jsx)(`span`,{className:ta,children:e.dir?(0,U.jsx)(Bv,{right:!e.open}):null}),(0,U.jsx)(`span`,{className:`${Zi} ${e.state?Ou[SX[e.state]]:``}`,children:e.label}),e.state&&(0,U.jsx)(`span`,{className:`w-[1ch] flex-none text-center font-mono ${Ou[SX[e.state]]}`,title:V(`files.state.${e.state}`),children:e.dir?`•`:CX[e.state]})]},e.path)),!d&&l&&(0,U.jsx)(`p`,{className:`mx-2.5 my-3 font-mono text-meta text-subtle`,children:V(`files.truncated`,{count:(r?.length??0).toLocaleString()})})]})]})}var qZ={working:`review.scopeWorking`,branch:`review.scopeBranch`,task:`review.scopeTask`};function JZ(e){return e.kind===`diff`?e.path===`.`?{text:V(qZ[e.scope]),hint:V(`preview.whole`)}:{text:_C(e.path),hint:e.path}:{text:V(`panel.${e.kind}`),hint:V(`panel.${e.kind}`)}}function YZ({taskId:e,kind:t,expand:n}){H();let r=b(qC),i=V(r?`panel.restore`:`panel.expand`);return(0,U.jsxs)(U.Fragment,{children:[n&&(0,U.jsx)(`button`,{type:`button`,className:dr({tool:!0}),title:i,"aria-label":i,"aria-pressed":r,onClick:()=>qC.set(!r),children:(0,U.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,U.jsx)(`path`,{d:r?`M13.5 6.5h-4v-4M2.5 9.5h4v4M9.5 6.5l4-4M6.5 9.5l-4 4`:`M9.5 2.5h4v4M6.5 13.5h-4v-4M13.5 2.5l-4.5 4.5M2.5 13.5 7 9`})})}),(0,U.jsx)(`button`,{type:`button`,className:dr({tool:!0}),title:V(`panel.close`),"aria-label":V(`panel.close`),onClick:()=>Cw(e,t),children:(0,U.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,U.jsx)(`path`,{d:`M4 4l8 8M12 4l-8 8`})})})]})}function XZ({taskId:e,column:t,narrow:n}){H();let r=b(qC);if(t.kind===`browser`){let i=(0,U.jsxs)(`div`,{className:vr(n),children:[(0,U.jsx)(fW,{taskId:e,column:t}),!n&&(0,U.jsx)(YZ,{taskId:e,kind:`browser`,expand:!0})]});return(0,U.jsx)(CG,{slot:`panel.tabs`,data:{taskId:e,kind:`browser`,title:V(`panel.browser`),hint:V(`panel.browser`),tabCount:t.tabs.length,expanded:r,onToggleExpand:n?void 0:()=>qC.set(!r),onClose:()=>Cw(e,`browser`)},fallback:i})}if(n&&t.kind!==`diff`)return null;let{text:i,hint:a}=JZ(t),o=(0,U.jsxs)(`div`,{className:vr(n),children:[(0,U.jsx)(`span`,{className:yr,title:a,children:i}),(0,U.jsx)(YZ,{taskId:e,kind:t.kind,expand:!n})]});return(0,U.jsx)(CG,{slot:`panel.tabs`,data:{taskId:e,kind:t.kind,title:i,hint:a,tabCount:1,expanded:r,onToggleExpand:n?void 0:()=>qC.set(!r),onClose:()=>Cw(e,t.kind)},fallback:o})}var ZZ=e=>`${e.id}:${BS(e)}`;function QZ({model:e,task:t,column:n,restored:r}){let i=(0,h.useRef)([]);i.current=tC(i.current,n.active,n.tabs);let a=(0,h.useRef)(n.tabs.map(ZZ));return n.tabs.filter(e=>i.current.includes(e.id)).map(i=>(0,U.jsx)(`div`,{className:Or,hidden:i.id!==n.active,children:(0,U.jsx)(qX,{model:e,taskId:t.id,tab:i,root:t.workspace,shown:i.id===n.active,restored:r&&a.current.includes(ZZ(i)),onClose:()=>Tw(t.id,i.id),onNavigate:e=>ww(t.id,t=>JS(t,i.id,e)),onStep:e=>ww(t.id,t=>YS(t,i.id,e))})},i.id))}function $Z({model:e,task:t,column:n,narrow:r,restored:i,index:a}){let o=WR(),s=_z(),c=n.kind===`browser`?(0,U.jsx)(QZ,{model:e,task:t,column:n,restored:i}):(0,U.jsxs)(`div`,{className:Or,children:[n.kind===`files`&&(0,U.jsx)(KZ,{model:e,task:t,narrow:r}),n.kind===`chat`&&(0,U.jsx)(vR,{model:e,task:t,active:!0}),n.kind===`quota`&&(0,U.jsx)(xZ,{model:e,task:t,active:!0}),n.kind===`diff`&&(0,U.jsx)(zX,{model:e,view:{taskId:t.id,path:n.path,scope:n.scope},active:!0,restored:i,onClose:()=>Cw(t.id,`diff`)},`${t.id}:${n.path}:${n.scope}:${n.at??``}`)]}),l=t.changes&&!(`unreadable`in t.changes)?{files:0,added:t.changes.added,removed:t.changes.deleted}:void 0,u=pj(t)??void 0;return(0,U.jsx)(CG,{slot:`panel.section`,data:{taskId:t.id,index:a,kind:n.kind,title:t.label,branch:t.branch||void 0,repo:t.repo?t.repo.split(`/`).pop():void 0,engineId:t.engine?.id??void 0,engineName:t.engine?.name,model:t.model,engineFamily:t.engine?.protocol,engineColor:tG(o?.manifest,t.engine,s),statusKind:t.rowStatus?.kind??`idle`,diffStats:l,todos:u,pr:t.pr?.number?{number:t.pr.number,state:t.pr.lifecycle,url:t.pr.url}:void 0},fallback:c})}function eQ({taskId:e,kinds:t,index:n,body:r,slot:i}){H();let a=(0,h.useRef)(null);return(0,U.jsx)(`div`,{className:Dr,style:{gridColumn:i},title:V(`panel.resizeSplit`),onPointerDown:e=>{let n=t.map(e=>r.current?.querySelector(`[data-kind="${e}"]`)?.getBoundingClientRect().width??0);a.current={x:e.clientX,widths:n},r.current?.classList.add(`is-resizing`),e.currentTarget.setPointerCapture(e.pointerId)},onPointerMove:t=>{let r=a.current;if(!r)return;let i=jC(r.widths,n,t.clientX-r.x,220);gw(e,e=>kC(e,i))},onLostPointerCapture:()=>{a.current=null,r.current?.classList.remove(`is-resizing`)},onDoubleClick:()=>gw(e,AC)})}function tQ({panel:e}){H();let t=(0,h.useRef)(null);return(0,U.jsx)(TW,{edge:`left`,title:V(`panel.resize`),onPointerDown:n=>{t.current={x:n.clientX,width:e.current?.getBoundingClientRect().width??0},e.current?.classList.add(`is-resizing`),n.currentTarget.setPointerCapture(n.pointerId),me(!0)},onPointerMove:e=>{let n=t.current;if(!n||e.clientX===n.x)return;let r=vW.get()?0:CW(_W.get()??280);GC.set(JC(n.width-(e.clientX-n.x),r))},onLostPointerCapture:()=>{t.current=null,e.current?.classList.remove(`is-resizing`),me(!1)},onDoubleClick:()=>GC.set(null)})}var nQ=e=>e.kind===`diff`?`diff:${e.path}:${e.scope}`:e.kind;function rQ({model:e,task:t,narrow:n}){H();let r=fw(t.id),i=b(RC),a=b(qC),o=(0,h.useRef)(null),s=(0,h.useRef)(null),c=i===`terminal`?`files`:i,l=n?gC(r,c):void 0;(0,h.useEffect)(()=>{n&&!l&&gw(t.id,e=>xC(e,c))},[n,l,c,t.id]);let u=n?l?[l]:[]:r.columns,d=u.map(e=>e.kind),f=(n?[1]:OC(r)).map((e,t)=>`${t>0?`var(--divider) `:``}minmax(0, ${e}fr)`).join(` `),p=(0,h.useRef)(u.map(nQ)),m=WR(),g=n?``:ez(m?.manifest.layout?.frame),_=_z(),v=!n&&m?.manifest.slots?.[`panel.frame`]?.component!==void 0,y=t.changes&&!(`unreadable`in t.changes)?t.changes:void 0,x=(0,U.jsxs)(`div`,{className:gr,ref:s,style:{gridTemplateColumns:f},children:[u.map((r,i)=>(0,U.jsxs)(`section`,{className:_r,"data-kind":r.kind,style:{gridColumn:2*d.indexOf(r.kind)+1},children:[(0,U.jsx)(XZ,{taskId:t.id,column:r,narrow:n}),(0,U.jsx)($Z,{model:e,task:t,column:r,narrow:n,restored:p.current.includes(nQ(r)),index:i})]},r.kind)),!n&&u.slice(1).map((e,n)=>(0,U.jsx)(eQ,{taskId:t.id,kinds:d,index:n,body:s,slot:2*n+2},`divider:${e.kind}`))]});return(0,U.jsxs)(`aside`,{"data-tp-region":`panel`,className:`${hr(n)} ${g}`,ref:o,style:v?{padding:0}:void 0,children:[!n&&!a&&(0,U.jsx)(tQ,{panel:o}),n?x:(0,U.jsx)(CG,{slot:`panel.frame`,data:{taskId:t.id,title:t.label,branch:t.branch||void 0,repo:t.repo?t.repo.split(`/`).pop():void 0,worktree:sG(t),engineId:t.engine?.id??void 0,engineName:t.engine?.name,model:t.model,engineFamily:t.engine?.protocol,engineColor:tG(m?.manifest,t.engine,_),statusKind:t.rowStatus?.kind??`idle`,diffStats:y?{files:0,added:y.added,removed:y.deleted}:void 0,pr:t.pr?.number?{number:t.pr.number,state:t.pr.lifecycle,url:t.pr.url,checkState:t.pr.checkState}:void 0,views:fC.map(e=>({kind:e,title:V(`panel.${e}`),open:d.includes(e)})),activeView:d.length===1?d[0]:void 0,onShowView:e=>gw(t.id,t=>xC({...t,columns:t.columns.filter(t=>t.kind===e)},e))},fallback:x})]})}function iQ({model:e,task:t,remoteHost:n,narrow:r=!1}){let i=pw(t?.id??null),a=WR()?.manifest.slots?.[`panel.frame`]?.component!==void 0;return!r&&!(i||a&&t)?null:t?(0,U.jsx)(rQ,{model:e,task:t,narrow:r},t.id):n?(0,U.jsx)(`aside`,{"data-tp-region":`panel`,className:hr(!1),children:(0,U.jsx)(Sg,{host:n,onMachines:()=>WA(e)})}):null}var aQ=y(null);function oQ(e){aQ.set(e),!(e===null||!Ee())&&(RC.set(`terminal`),ye())}var sQ=`rove.web.update.skipped`,cQ=`rove.web.update.askedAt`;function lQ(e){return!e.latest||!e.notify||e.latest===e.skipped||e.askedAt!==null&&e.now-e.askedAt<18e6?null:e.latest}function uQ(){let e=JP.get(),t=lQ({latest:e?.info?.hasUpdate?e.info.latest:null,notify:jw.get().prefs.updateNotify,skipped:localStorage.getItem(sQ),askedAt:Number(localStorage.getItem(cQ))||null,now:Date.now()});!t||k.get()!==null||(localStorage.setItem(cQ,String(Date.now())),k.set((0,U.jsx)(dQ,{current:e?.current??``,latest:t,notes:e?.notes??[]})))}function dQ(e){let[t]=e.notes;return(0,U.jsx)(ia,{title:V(`updatePrompt.title`,{version:e.latest}),wide:e.notes.length>0,children:(0,U.jsxs)(`div`,{className:hi,children:[(0,U.jsx)(`p`,{className:`text-muted`,children:V(`updatePrompt.body`,{current:e.current})}),e.notes.length===1&&t?(0,U.jsx)(GP,{body:t.body}):(0,U.jsx)(tF,{notes:e.notes}),(0,U.jsxs)(`div`,{className:Qr,children:[(0,U.jsx)(W,{onClick:()=>{localStorage.setItem(sQ,e.latest),B()},children:V(`updatePrompt.skip`)}),(0,U.jsx)(W,{onClick:B,children:V(`updatePrompt.later`)}),(0,U.jsx)(W,{variant:`filled`,autoFocus:!0,onClick:()=>{B(),YP.set(!0),xe(`update`)},children:V(`updatePrompt.yes`)})]})]})})}function fQ({model:e,task:t}){return(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col pt-2`,children:[(0,U.jsxs)(`div`,{className:CI,children:[(0,U.jsx)(`span`,{className:`text-warning`,children:V(`workspace.archived`)}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-subtle`,children:V(`workspace.archivedNote`)}),(0,U.jsx)(W,{variant:`filled`,onClick:()=>void Oj(e,t),children:K(`tasks`,`menu.unarchive`)})]}),(0,U.jsx)(vR,{model:e,task:t,active:!0})]})}function pQ({model:e,taskId:t,groupId:n}){H();let r=b(e.tasks),i=r?ix(r.tasks,n):[];return i.length<2||!i.some(e=>e.id===t)?null:(0,U.jsxs)(`nav`,{className:Kx,"aria-label":V(`compare.menu`),children:[i.map((n,r)=>(0,U.jsxs)(W,{variant:`pill`,hit:`tight`,"aria-current":n.id===t,onClick:()=>e.select(n.id),children:[`[ `,(0,U.jsx)(U_,{status:n.rowStatus}),r+1,` `,n.engine?.name??n.label,n.kept&&(0,U.jsx)(`span`,{className:`text-accent`,children:`✓`}),` ]`]},n.id)),(0,U.jsx)(W,{hit:`tight`,className:`ml-auto flex-none whitespace-nowrap`,onClick:()=>Se(n),children:V(`compare.strip`)})]})}function mQ({model:e,taskId:t,fallback:n}){let[r,i]=(0,h.useState)(null),[a,o]=(0,h.useState)(!1);return(0,h.useEffect)(()=>{i(null),e.client.request(`inbox.message`,{id:t}).then(i,()=>i(`none`))},[e,t]),r===null?null:r===`none`?n:(0,U.jsx)(`div`,{className:SI,children:(0,U.jsx)(`div`,{className:wI,children:(0,U.jsxs)(`article`,{className:DI({flash:!1,current:!1}),children:[(0,U.jsxs)(`header`,{className:OI,children:[(0,U.jsx)(`span`,{className:kI(`user`),children:r.from}),(0,U.jsx)(`span`,{className:AI,children:new Date(r.at).toLocaleString()}),(0,U.jsx)(W,{className:`ml-auto`,disabled:a,onClick:()=>{o(!0),e.client.request(`inbox.toAgent`,{id:t}).catch(e=>{o(!1),z(G(e),`error`)})},children:V(`workspace.external.toAgent`)})]}),(0,U.jsx)(_L,{source:r.text})]})})})}var hQ=e=>MG(e)!==null,gQ=e=>sU(MG(e)?.tab.split);function _Q(e){let t=MG(e),n=t?.tab.split;return t&&n?{...t,split:n,leaf:kG(t.taskId,t.tab,n)}:null}$s(()=>[{id:`workspace.split.right`,chords:[`ctrl+\\`],prefix:!1,surface:`workspace`,live:hQ,run:e=>{let t=MG(e);t&&PG(e,t.taskId,t.tab,`right`)}},{id:`workspace.split.down`,chords:[`ctrl+=`],prefix:!1,surface:`workspace`,live:hQ,run:e=>{let t=MG(e);t&&PG(e,t.taskId,t.tab,`down`)}},{id:`workspace.split.focus-next`,chords:[`f3`],prefix:!1,surface:`workspace`,live:gQ,run:e=>{let t=_Q(e);t&&jG(t.taskId,t.tab,t.split,lU(t.split,t.leaf))}},{id:`workspace.split.close`,chords:[`w`],prefix:!0,surface:`workspace`,live:gQ,run:e=>{let t=_Q(e);t&&FG(e,t.taskId,t.tab,t.leaf)}},{id:`workspace.split.rename`,chords:[`f2`],prefix:!1,surface:`workspace`,live:gQ,run:e=>{let t=_Q(e);t&&IG(e,t.taskId,t.tab,t.leaf)}}]);var vQ=4e3,yQ=[{id:`leaf-1`,x:0,y:0,w:1,h:1,left:!1,top:!1}];function bQ({model:e,taskId:t,tab:n}){let r=n.split;b(OG);let i=r?kG(t,n,r):`leaf-1`,a=r?uU(r,Go(n)):new Map,o=sU(r),{prefs:s}=Rw(),c=b(e.tasks)?.tasks.find(e=>e.id===t)?.tabStatus?.[n.id]??n.status,l=n.kind===`engine`&&c?.reason===`dead`?c.since:null;(0,h.useEffect)(()=>{l!==null&&e.refreshTabsNow(t)},[l,e,t]),(0,h.useEffect)(()=>{if(!o)return;let n=window.setInterval(()=>{document.hidden||e.refreshTabsNow(t)},vQ);return()=>window.clearInterval(n)},[o,e,t]);let u=l!==null&&n.alive!==!1?{code:n.exit?.code??null,since:l}:null,d=n.kind===`engine`&&c?.reason===`rate_limited`?{since:c.since}:null;return(0,U.jsx)(`div`,{className:pn,children:(r?cU(r.root):yQ).map(c=>(0,U.jsxs)(`div`,{className:gn(o?s.splitStyle:null,{left:c.left,top:c.top,active:c.id===i}),style:{left:`calc(${c.x*100}% + var(--ml, 0px))`,top:`calc(${c.y*100}% + var(--mt, 0px))`,width:`calc(${c.w*100}% - var(--ml, 0px))`,height:`calc(${c.h*100}% - var(--mt, 0px))`},children:[(0,U.jsx)(IY,{client:e.client,model:e,engineExit:c.id===`leaf-1`?u:null,usageLimit:c.id===`leaf-1`?d:null,composer:n.kind===`engine`&&c.id===`leaf-1`,taskId:t,tabId:n.id,leafId:c.id,focused:c.id===i,onActivate:()=>r&&AG(t,n.id,r,c.id),onExit:()=>{o?NG(e,{taskId:t,tabId:n.id,action:`close`,leafId:c.id}):n.kind!==`engine`&&e.closeTab(t,n.id).catch(()=>{})}}),o&&(0,U.jsx)(`span`,{className:_n(s.splitStyle===`rule`,c.id===i),onContextMenu:r=>Sq(r,zG(e,t,n,c.id)),children:a.get(c.id)})]},c.id))})}var xQ=/^[0-9a-f]{7,40}$/i;function SQ(e,t){return t.sharesWorkspaceOf||!t.baseRef?null:e.find(e=>e.id!==t.id&&e.branch!==``&&e.branch===t.baseRef)||(xQ.test(t.baseRef)&&t.parentTaskId?e.find(e=>e.id===t.parentTaskId)??null:null)}var CQ=(e,t)=>(e.createdAt??``).localeCompare(t.createdAt??``),wQ=(e,t)=>e.filter(n=>!n.deleting&&SQ(e,n)?.id===t).sort(CQ);function TQ(e,t){let n=[];for(let r=SQ(e,t);r&&n.length<20&&!n.includes(r);r=SQ(e,r))n.unshift(r);let r=wQ(e,t.id);if(n.length===0&&r.length===0)return null;let i=n[n.length-1],a=i?wQ(e,i.id):[t];a.includes(t)||a.push(t);let o=n[0]??t;return{path:n,level:a,kids:r,base:o.baseRef&&!xQ.test(o.baseRef)?o.baseRef:null}}var EQ=e=>e.pr?.lifecycle===`merged`;function DQ(e,t){let n=e.level.find(e=>e.id===t),r=n?[...e.path,n]:e.path,[i,...a]=e.kids;return r.find(e=>!EQ(e))??(i&&a.length===0&&!EQ(i)?i:null)}var OQ=`min-h-11 flex-none cursor-pointer whitespace-nowrap font-sans text-meta`;function kQ(e){let t=t=>(0,U.jsxs)(`button`,{type:`button`,className:`${OQ} max-w-[20ch] truncate ${t.id===e.taskId?`text-ink`:`text-muted`}`,"aria-current":t.id===e.taskId,title:t.title,onClick:()=>e.onSelect(t.id),children:[t.label||t.title,EQ(t)&&(0,U.jsx)(`span`,{className:`text-accent`,children:` ✓`})]},t.id),n=(e,t)=>e.length===1?t(e[0]):(0,U.jsxs)(`span`,{className:`flex flex-none items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`text-subtle`,children:`{`}),e.map((e,n)=>(0,U.jsxs)(`span`,{className:`flex flex-none items-center gap-2`,children:[n>0&&(0,U.jsx)(`span`,{className:`text-subtle`,children:`|`}),t(e)]},e.id)),(0,U.jsx)(`span`,{className:`text-subtle`,children:`}`})]});return(0,U.jsxs)(`nav`,{className:`flex min-w-0 flex-none items-center gap-3 px-2 font-sans text-meta text-muted`,"aria-label":V(`compare.stackLabel`),children:[(0,U.jsxs)(`div`,{ref:e.scroller,className:`flex min-w-0 flex-1 items-center gap-2 overflow-x-auto scrollbar-none mask-r-from-[calc(100%-1.5rem)]`,children:[e.stack.base&&(0,U.jsxs)(`span`,{className:`flex-none text-subtle`,children:[e.stack.base,` ←`]}),e.stack.path.map(e=>(0,U.jsxs)(`span`,{className:`flex flex-none items-center gap-2`,children:[t(e),(0,U.jsx)(`span`,{className:`text-subtle`,children:`←`})]},e.id)),n(e.stack.level,r=>r.id===e.taskId&&e.stack.kids.length>0?(0,U.jsxs)(`span`,{className:`flex flex-none items-center gap-2`,children:[t(r),(0,U.jsx)(`span`,{className:`text-subtle`,children:`←`}),n(e.stack.kids,t)]},r.id):t(r)),(0,U.jsx)(`span`,{className:`w-4 flex-none`,"aria-hidden":`true`})]}),e.onLand&&(0,U.jsx)(`button`,{type:`button`,className:`${OQ} text-accent`,onClick:e.onLand,children:V(`compare.landBottomPhone`)})]})}function AQ({model:e,taskId:t}){H();let n=Oe(),r=b(e.tasks)?.tasks??[],i=r.find(e=>e.id===t),a=i?TQ(r,i):null,o=MQ(t,a!==null);if(!a)return null;let s=DQ(a,t),c=s&&!s.machine?()=>void bj(e,s):void 0,l=t=>e.select(t);if(n)return(0,U.jsx)(kQ,{stack:a,taskId:t,onSelect:l,onLand:c,scroller:o});let u=(e,n)=>(0,U.jsxs)(W,{variant:`pill`,hit:`tight`,"aria-current":e.id===t,title:e.title,onClick:()=>l(e.id),children:[n&&`[ `,(0,U.jsx)(U_,{status:e.rowStatus}),(0,U.jsx)(`span`,{className:`max-w-48 truncate`,children:e.label||e.title}),EQ(e)?(0,U.jsx)(`span`,{className:`text-accent`,children:`✓`}):e.pr?.number?(0,U.jsx)(`span`,{children:`PR`}):null,n&&`]`]},e.id),d=(e,n)=>e.id===t&&a.kids.length>0?(0,U.jsxs)(`span`,{className:`flex flex-none items-center gap-x-3.5`,children:[u(e,n),(0,U.jsx)(`span`,{className:`text-subtle`,children:`←`}),(0,U.jsx)(jQ,{nodes:a.kids,render:u})]},e.id):u(e,n);return(0,U.jsxs)(`nav`,{className:`flex min-w-0 items-center gap-x-3.5 px-2.5 py-1 font-mono text-meta`,"aria-label":V(`compare.stackLabel`),children:[(0,U.jsxs)(`div`,{ref:o,className:`flex min-w-0 flex-1 items-center gap-x-3.5 overflow-x-auto scrollbar-none`,children:[a.base&&(0,U.jsxs)(`span`,{className:`flex-none text-subtle`,children:[a.base,` ←`]}),a.path.map(e=>(0,U.jsxs)(`span`,{className:`flex flex-none items-center gap-x-3.5`,children:[d(e,!0),(0,U.jsx)(`span`,{className:`text-subtle`,children:`←`})]},e.id)),(0,U.jsx)(jQ,{nodes:a.level,render:d})]}),c&&(0,U.jsx)(W,{hit:`tight`,className:`flex-none whitespace-nowrap`,onClick:c,children:V(`compare.landBottom`)})]})}function jQ({nodes:e,render:t}){return e.length===1?t(e[0],!0):(0,U.jsxs)(`span`,{className:`flex flex-none items-center gap-x-2`,children:[(0,U.jsx)(`span`,{className:`text-subtle`,children:`{`}),e.map((e,n)=>(0,U.jsxs)(`span`,{className:`flex items-center gap-x-2`,children:[n>0&&(0,U.jsx)(`span`,{className:`text-subtle`,children:`|`}),t(e,!1)]},e.id)),(0,U.jsx)(`span`,{className:`text-subtle`,children:`}`})]})}function MQ(e,t){let n=(0,h.useRef)(null);return(0,h.useEffect)(()=>{n.current?.querySelector(`[aria-current="true"]`)?.scrollIntoView({block:`nearest`,inline:`nearest`})},[e,t]),n}function NQ(e,t){return e===`never`?!1:e!==`multipleOnly`||t>=2}function PQ({taskId:e}){H();let t=fw(e),n=pw(e);return(0,U.jsx)(`div`,{className:Er,children:LC.map(r=>{let i=n&&!!gC(t,r);return(0,U.jsx)(`button`,{type:`button`,className:dr({on:i}),title:V(`panel.${r}`),"aria-label":V(`panel.${r}`),"aria-pressed":i,onClick:()=>vw(e,r),children:(0,U.jsx)(nW,{children:rW[r]})},r)})})}function FQ({model:e,task:t,tabs:n,narrow:r}){let i=b(e.selection),{prefs:a}=Rw(),o=b(aQ),s=WR(),c=_z(),l=!NQ(a.tabStrip,n.length),u=(0,U.jsxs)(`div`,{className:pr,role:`tablist`,children:[n.map((n,r)=>(0,U.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":n.id===i.tabId,className:`group/tab flex items-center gap-1.5 whitespace-nowrap rounded-sm px-2.5 py-1 active:scale-97 motion-reduce:active:scale-none touch:select-none touch:touch-callout-none ${l?`hidden`:``} ${n.id===i.tabId?`bg-inset text-ink`:`text-muted hover:bg-hover data-menu-open:bg-hover`}`,onClick:()=>e.select(t.id,n.id),onContextMenu:r=>Sq(r,E(tK(e,t,n),V(`menu.more`))),children:[(0,U.jsx)(`span`,{className:`text-subtle group-aria-selected/tab:text-accent`,children:r+1}),Go(n)]},n.id)),!r&&(0,U.jsx)(PQ,{taskId:t.id})]});return(0,U.jsx)(CG,{slot:`session.header`,data:IQ(e,t,n,i.tabId,s?.manifest,c,r,o),fallback:u})}function IQ(e,t,n,r,i,a,o,s){let c=n.find(e=>e.id===r);return{taskId:t.id,title:t.label,branch:t.branch||void 0,repo:t.repo?t.repo.split(`/`).pop():void 0,worktree:sG(t),engineId:t.engine?.id??void 0,engineName:t.engine?.name,model:t.model,engineFamily:t.engine?.protocol,engineColor:tG(i,t.engine,a),statusKind:t.rowStatus?.kind??`idle`,tabs:n.map(e=>({id:e.id,label:Go(e),active:e.id===r})),activeTab:c?Go(c):void 0,tabCount:n.length,onSelectTab:n=>e.select(t.id,n),narrow:o,packageView:s,onPackageView:oQ,view:o?RC.get():`terminal`,onShowView:e=>{if(jW.includes(e)){if(!o)return e===`terminal`?void 0:_w(t.id,e);aQ.set(null),NW(t.id,r,e)}}}}function LQ(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??e))}function RQ({model:e}){let t=H()===`zh`?Ra:La,n=e.client,[r,i]=(0,h.useState)(()=>(J(n,`worktrees.list`,{network:!0})??J(n,`worktrees.list`,{network:!1}))?.projects??null),[a,o]=(0,h.useState)([]),[s,c]=(0,h.useState)(null),[l,u]=(0,h.useState)(0),[d,f]=(0,h.useState)(0),p=(0,h.useRef)(null);(0,h.useEffect)(()=>{let e=!0,t=n.onOpen(()=>{let t=!1,r=r=>ss(n,`worktrees.list`,{network:r}).then(n=>{if(!(!e||!r&&t)&&(r&&(t=!0),c(null),i(n.projects),r)){let e=new Set(n.projects.flatMap(e=>e.worktrees.map(e=>e.path)));o(t=>t.filter(t=>e.has(t)))}}).catch(t=>{e&&c(Pu(t))});r(!1),r(!0)});return()=>{e=!1,t()}},[n,d]),(0,h.useEffect)(()=>p.current?.focus(),[]);let m=(r??[]).map(e=>({...e,worktrees:e.worktrees.filter(e=>!a.includes(e.path))})),g=m.flatMap(e=>e.worktrees),_=Math.min(l,Math.max(0,g.length-1));(0,h.useEffect)(()=>{p.current?.querySelector(`[data-row="${_}"]`)?.scrollIntoView({block:`nearest`})},[_]);let v=(0,h.useCallback)(()=>f(e=>e+1),[]),y=async(e,r)=>{o(t=>[...t,e.path]);try{let i=await n.request(`worktrees.remove`,{path:e.path,force:r});i.residue&&z(LQ(t.delete.residue,i.residue)),v()}catch(n){o(t=>t.filter(t=>t!==e.path));let i=n&&typeof n==`object`&&`code`in n?n.code:null;if(!r&&i===`DIRTY_WORKTREE`){k.set((0,U.jsx)(sa,{title:t.delete.forceTitle,body:`${LQ(t.delete.forceBody,{branch:e.branch||e.path})}\n\n${LQ(t.delete.forceReason,{reason:G(n)})}`,confirmLabel:t.delete.button,onConfirm:()=>y(e,!0)}));return}z(LQ(t.delete.failed,{error:G(n)}),`error`)}},b=e=>k.set((0,U.jsx)(sa,{title:t.delete.confirmTitle,body:LQ(t.delete.confirmBody,{branch:e.branch||e.path}),confirmLabel:t.delete.button,onConfirm:async()=>{y(e,!1)}})),x=n=>{if(!n.taskId){z(t.land.noTask,`error`);return}bj(e,{id:n.taskId,title:n.branch,branch:n.branch},v)},S=e=>{if(e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.toLowerCase()===`c`&&!window.getSelection()?.toString())return e.preventDefault(),M.set(null);if(e.metaKey||e.ctrlKey||e.altKey)return;let t=g[_];if(e.key===`j`||e.key===`ArrowDown`)u(Math.min(g.length-1,_+1));else if(e.key===`k`||e.key===`ArrowUp`)u(Math.max(0,_-1));else if(e.key===`d`&&t)b(t);else if(e.key===`l`&&t)x(t);else if(e.key===`q`||e.key===`Escape`)M.set(null);else return;e.preventDefault()},C=0;return(0,U.jsxs)(`div`,{className:Ww,tabIndex:0,ref:p,onKeyDown:S,children:[(0,U.jsx)(`h1`,{className:Gw,children:t.title}),s!==null&&(0,U.jsxs)(`p`,{className:`flex flex-wrap items-baseline gap-3 text-error`,children:[LQ(t.loadFailed,{message:s}),(0,U.jsx)(W,{onClick:v,children:V(`workspace.retry`)})]}),r===null?s===null&&(0,U.jsx)(`p`,{className:`text-muted`,children:t.loading}):m.length===0?(0,U.jsx)(`p`,{className:`text-muted`,children:t.noProjects}):m.map(e=>{let n=C;return C+=e.worktrees.length,(0,U.jsxs)(`section`,{className:PP,children:[(0,U.jsxs)(`h2`,{className:`mt-1.5 mr-2 mb-1 ml-0 flex items-center gap-1 font-mono text-meta font-semibold normal-nums text-subtle`,children:[(0,U.jsx)(`span`,{children:e.repo}),(0,U.jsx)(`span`,{className:`rule`})]}),e.worktrees.length===0&&(0,U.jsx)(`p`,{className:`mono text-muted`,children:t.noWorktrees}),e.worktrees.map((e,r)=>{let i=n+r;return(0,U.jsxs)(`div`,{"data-row":i,className:FP(i===_),onClick:()=>u(i),children:[(0,U.jsxs)(`div`,{className:IP,children:[(0,U.jsx)(`span`,{className:RP,children:e.branch||t.row.detached}),e.roveManaged&&(0,U.jsx)(`span`,{className:`chip text-muted`,children:t.badge.roveManaged}),e.dirty===!0&&(0,U.jsx)(`span`,{className:`chip text-warning`,children:t.badge.dirty}),e.dirty===null&&(0,U.jsx)(`span`,{className:`chip text-muted`,children:t.badge.dirtyUnknown}),(0,U.jsx)(`span`,{className:`chip ${e.branchOnRemote===!0?`text-success`:e.branchOnRemote===!1?`text-warning`:`text-muted`}`,children:e.branchOnRemote===!0?t.badge.remoteOn:e.branchOnRemote===!1?t.badge.remoteOff:t.badge.remoteUnknown}),e.verdictReason!==`dirty`&&e.verdictReason!==`fresh`&&(0,U.jsx)(`span`,{className:`chip ${e.verdict===`merged`?`text-success`:e.verdict===`stale`?`text-warning`:`text-accent`}`,children:t.verdict[e.verdictReason]??e.verdictReason})]}),(0,U.jsxs)(`div`,{className:`${LP} mono text-muted`,children:[(0,U.jsx)(`span`,{className:zP,children:e.path}),e.createdAtMs>0&&(0,U.jsx)(`span`,{children:LQ(t.row.created,{age:_c(Date.now()-e.createdAtMs)})})]}),i===_&&(0,U.jsxs)(`div`,{className:`flex items-baseline gap-2 text-[length:var(--fs-body)]`,children:[(0,U.jsx)(`button`,{type:`button`,className:`link text-accent hover:underline touch-hit`,onClick:()=>b(e),children:t.delete.button}),e.taskId&&(0,U.jsx)(`button`,{type:`button`,className:`link text-accent hover:underline touch-hit`,onClick:()=>x(e),children:t.land.button})]})]},e.path)})]},e.repo)}),(0,U.jsx)(`p`,{className:`${BP} mono keys-only text-muted`,children:(0,U.jsx)(ju,{text:`j/k · d ${t.delete.button} · l ${t.land.button} · q/esc`})})]})}function zQ({model:e,narrow:t}){let n=b(e.selection),r=b(e.tabs),i=b(e.tasks),a=b(e.remote),o=a.find(e=>e.id===n.taskId&&!e.machine?.stale),s=_s(i,n.taskId)??o??null,c=o?void 0:a.find(e=>e.id===n.taskId),l=s?r[s.id]??[]:[],u=s?s.id in r:!1,d=b(M),f=yz(s?.id),p=s?.rowStatus?.kind===`running`,m=b(I),g=WR(),_=_z(),v=t?``:ez(g?.manifest.layout?.frame),y=b(RC),x=b(aQ),S=(0,h.useContext)(pq),C=hq(`package.view`),w=y!==`terminal`&&t&&!!s,T=l.find(e=>e.id===n.tabId);if((0,h.useEffect)(()=>{let t=e.selection.get();return VC(t.taskId,t.tabId),e.selection.subscribe(()=>{M.set(null),I.set(null);let n=e.selection.get();n.taskId!==t.taskId&&kR.get().activePack?.manifest.slots?.[`package.view`]&&aQ.set(null),(n.taskId!==t.taskId||n.tabId!==t.tabId)&&VC(n.taskId,n.tabId),t=n})},[e]),(0,h.useEffect)(()=>eW(e),[e]),d===`worktrees`)return(0,U.jsxs)(`main`,{"data-tp-region":`workspace`,className:`${Hn} ${ln}`,children:[t&&(0,U.jsx)(mq,{slot:`phone.sessionHeader`,fallback:(0,U.jsx)(PW,{client:e.client})}),(0,U.jsx)(RQ,{model:e})]});if(d)return(0,U.jsxs)(`main`,{"data-tp-region":`workspace`,className:`${Hn} ${ln}`,children:[t&&(0,U.jsx)(mq,{slot:`phone.sessionHeader`,fallback:(0,U.jsx)(PW,{client:e.client})}),(0,U.jsx)(jJ,{model:e,page:d})]});if(S&&x!==null&&C)return(0,U.jsxs)(`main`,{"data-tp-region":`workspace`,className:`${Hn} ${ln}`,children:[t&&(0,U.jsx)(mq,{slot:`phone.sessionHeader`,fallback:(0,U.jsx)(PW,{client:e.client})}),(0,U.jsx)(CG,{slot:`package.view`,data:{...S,narrow:t,onShowView:e=>{!s||!jW.includes(e)||(aQ.set(null),t?NW(s.id,n.tabId,e):e!==`terminal`&&_w(s.id,e))}},fallback:null})]});if(m)return(0,U.jsxs)(`main`,{"data-tp-region":`workspace`,className:`${Hn} ${ln}`,children:[t&&(0,U.jsx)(mq,{slot:`phone.sessionHeader`,fallback:(0,U.jsx)(PW,{client:e.client})}),(0,U.jsx)(`div`,{className:Un,children:(0,U.jsx)(Zb,{model:e,seed:m},ay(m))})]});if(s?.archived)return(0,U.jsxs)(`main`,{"data-tp-region":`workspace`,className:`${Hn} ${ln}`,children:[t&&(0,U.jsx)(mq,{slot:`phone.sessionHeader`,fallback:(0,U.jsx)(PW,{client:e.client,title:s.title})}),(0,U.jsx)(`div`,{className:Un,children:(0,U.jsx)(fQ,{model:e,task:s})})]});let E=t=>(0,U.jsxs)(`div`,{className:Vn,children:[(0,U.jsx)(`p`,{children:V(`workspace.noTabs`)}),(0,U.jsx)(W,{variant:`filled`,onClick:()=>void Ny(e,t.id,{kind:`engine`}).catch(e=>z(String(e),`error`)),children:t.engine?V(`workspace.startEngine`,{engine:t.engine.name}):V(`workspace.startSession`)}),` `,(0,U.jsx)(W,{variant:`filled`,onClick:()=>void My(e,t.id),children:V(`menu.newChat`)}),` `,(0,U.jsx)(W,{variant:`filled`,onClick:()=>k.set((0,U.jsx)(CA,{model:e,taskId:t.id})),children:V(`menu.newChatPick`)})]}),D=s?{...IQ(e,s,l,n.tabId,g?.manifest,_,t,x),onSend:t=>void e.client.request(`tab.send`,{...e.engineTarget(s.id),prompt:t}).catch(e=>z(String(e),`error`))}:null;return(0,U.jsxs)(`main`,{"data-tp-region":`workspace`,className:`${Hn} ${ln} ${v}`,children:[t&&(0,U.jsx)(mq,{slot:`phone.sessionHeader`,fallback:(0,U.jsx)(PW,{client:e.client,taskId:s?.id,tabId:n.tabId,title:s?.title})}),s&&(0,U.jsx)(FQ,{model:e,task:s,tabs:l,narrow:t}),s&&!s.groupId&&(0,U.jsx)(AQ,{model:e,taskId:s.id}),s?.groupId&&(0,U.jsx)(pQ,{model:e,taskId:s.id,groupId:s.groupId}),(e=>D&&!w?(0,U.jsx)(CG,{slot:`session.body`,data:D,fallback:e}):e)((0,U.jsxs)(`div`,{className:`${Un} ${p?Wn:``}`,style:f?{"--task-ink":f}:void 0,children:[!t&&!s&&!c&&i&&i.tasks.length+a.length===0&&(0,U.jsx)(xq,{model:e}),!s&&!c&&i&&i.tasks.length+a.length>0&&(0,U.jsx)(`p`,{className:Bn,children:V(`workspace.pickTask`)}),c?.machine&&(0,U.jsx)(`div`,{className:Vn,children:(0,U.jsx)(Sg,{host:c.machine.label,onMachines:()=>WA(e)})}),s&&u&&l.length===0&&!w&&s.connector!==`inbox`&&E(s),s&&u&&l.length===0&&!w&&s.connector===`inbox`&&(0,U.jsx)(mQ,{model:e,taskId:s.id,fallback:E(s)}),s&&w&&(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,U.jsx)(iQ,{model:e,task:s,narrow:!0}),y===`chat`&&T?.kind===`engine`&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(tI,{model:e,taskId:s.id,tabId:T.id}),(0,U.jsx)(OY,{to:t=>void e.client.request(`term.input`,{stream:Bc(s.id,T.id),data:t}).catch(e=>z(String(e),`error`)),atMenu:s.tabStatus?.[T.id]?.kind===`needs-input`})]})]}),s&&n.tabId&&l.some(e=>e.id===n.tabId)&&(0,U.jsx)(`div`,{className:`min-w-0 flex-1 ${w?`hidden`:`flex`}`,children:(0,U.jsx)(bQ,{model:e,taskId:s.id,tab:l.find(e=>e.id===n.tabId)??l[0]},`${s.id}::${n.tabId}`)})]})),D&&(0,U.jsx)(CG,{slot:`session.footer`,data:D,fallback:null})]})}function BQ({model:e}){H();let t=b(e.client.conn);return t.hello===null&&t.failures>=2?(0,U.jsx)(VQ,{}):(0,U.jsx)(XW,{children:(0,U.jsx)(HQ,{model:e})})}function VQ(){let[e,t]=(0,h.useState)(null);return(0,h.useEffect)(()=>{Ku().then(t)},[]),e===null?null:e?(0,U.jsx)(Zu,{}):(0,U.jsx)($r,{failing:!0})}function HQ({model:e}){DU(e);let t=b(e.client.conn).hello;(0,h.useEffect)(()=>{if(!t)return;cF(e.client,t.roveVersion);let n=()=>void $P(e.client).then(uQ);n();let r=window.setInterval(n,36e5);return()=>window.clearInterval(r)},[t,e.client]),(0,h.useEffect)(()=>{t&&Uu(e)},[t,e]),JJ(e),GJ(e),hc(),Hs(e.client),XJ(e),Wa(e.client),pV(e.client),(0,h.useEffect)(()=>{e.onSelect=ye;let t=I.subscribe(()=>{I.get()!==null&&ye()});return R(),t},[e]),(0,h.useEffect)(()=>sH(e),[e]);let n=b(e.selection),r=b(e.tasks),i=b(e.remote),a=Oe(),o=b(vW),s=b(yW),c=b(_W),l=b(ge),u=b(Pe)===`app`,d=b(GC),f=b(qC),p=b(M),m=b(de)===`drag`,g=b(I)!==null,_=i.find(e=>e.id===n.taskId&&!e.machine?.stale),v=_s(r,n.taskId)??_??null,y=_?void 0:i.find(e=>e.id===n.taskId),x=pw(v?.id??null),S=fw(v?.id??``).columns.length,C=b(aQ),w=hq(`package.view`)&&C!==null,T=a?ke(l,!!v||!!y,p!==null||g||w):null;(0,h.useEffect)(()=>e.setTaskShown(T===null||T===`content`&&p===null&&!g),[e,T,p,g]);let E=WR(),D=E?.manifest.layout?.frame,O=E?.manifest.layout?.railWidth,A=E?.manifest.slots?.[`panel.frame`]?.component!==void 0&&!!v,j=A?E?.manifest.layout?.panelWidth:void 0,{prefs:ee}=Rw(),te=lq(r?.tasks??[]),ne=hq(`phone.tabs`)&&a;(0,h.useEffect)(()=>aQ.set(null),[E?.id]);let N=kJ(e),P=CW(c??O??280),re=d??j??null,ie=re===null?null:JC(re,o?0:P),F=Math.max(1,S),ae=`max(280px, min(calc((100% - var(--rail-w)) * ${F} / ${F+2}), calc(100% - var(--rail-w) - 320px)))`,L={"--rail-w":`${o?0:P}px`,"--rail-open-w":`${o?CW(280):P}px`,"--panel-w":ie===null?ae:`${ie}px`},oe=(0,U.jsxs)(`div`,{className:`${sn({panel:(x||A)&&(!!v||!!y)&&!a,expanded:f&&(x||A)&&!a,surface:T&&u?`back`:T,folded:o&&!a,peek:o&&s&&!a,dragging:m})} ${a?``:$R(D)}`,style:a?void 0:L,children:[!a&&(0,U.jsx)(kW,{model:e,hidden:!!E?.manifest.slots?.[`shell.topBar`]?.component}),o&&!a&&(0,U.jsx)(`div`,{className:`absolute inset-y-0 left-0 z-5 col-1 row-1 w-2.5`,title:V(`layout.railUnfold`),onMouseEnter:()=>SW(!0),onMouseLeave:()=>SW(!1),onMouseUp:()=>vW.set(!1)}),(0,U.jsx)(Cq,{model:e,narrow:a}),(0,U.jsx)(zQ,{model:e,narrow:a}),T&&!ne&&(0,U.jsx)(tu,{show:T===`sidebar`?`list`:`page`}),!a&&(0,U.jsx)(iQ,{model:e,task:v,remoteHost:y?.machine?.label}),(0,U.jsx)(HK,{model:e,narrow:a}),(0,U.jsx)(rx,{}),(0,U.jsx)(MU,{model:e}),(0,U.jsx)(xs,{model:e})]}),se=vF(ee.themeMode,matchMedia(`(prefers-color-scheme: dark)`).matches),ce={...te,taskCount:(r?.tasks.length??0)+i.length,selectedId:v?.id,selectedTitle:v?.label??``,railFolded:o&&!a,onToggleRail:()=>vW.set(!o),mode:se,onSetMode:t=>void Iw(e.client,`themeMode`,t),unreadCount:r?.attention.filter(e=>e.unread).length??0,pages:N,onNewSession:()=>Xb(),onOpenSettings:()=>k.set((0,U.jsx)(aU,{model:e})),onOpenInbox:()=>k.set((0,U.jsx)(Mu,{model:e})),packageView:C,onPackageView:oQ},z=b(RC),le=a?{...ce,pane:T===`sidebar`?`list`:p!==null||g?`page`:w?`view`:`session`,title:N.find(e=>e.active)?.label??(p===null&&!g?v?.label??``:``),onShowList:be,onShowSession:()=>{M.set(null),I.set(null),v&&ye()},views:jW.map(e=>({kind:e,title:MW(e)})),view:z,onShowView:e=>{!v||!jW.includes(e)||(aQ.set(null),NW(v.id,n.tabId,e),ye())}}:null;return(0,U.jsx)(TG,{model:e,children:(0,U.jsx)(pq,{value:ce,children:(0,U.jsx)(fq,{value:le,children:(0,U.jsxs)(`div`,{className:on,children:[(0,U.jsx)(QW,{client:e.client,onOpenSettings:()=>k.set((0,U.jsx)(aU,{model:e,section:`appearance`}))}),!a&&(0,U.jsx)(CG,{slot:`shell.topBar`,data:ce,fallback:null}),(0,U.jsx)(mq,{slot:`phone.topBar`,fallback:null}),(0,U.jsx)(CG,{slot:`shell.frame`,data:{...ce,panelOpen:(x||A)&&!a,narrow:a},fallback:oe}),ne&&(0,U.jsx)(mq,{slot:`phone.tabs`,fallback:null})]})})})})}var UQ=`rove.crashLog`,WQ=4e3;function GQ(){try{let e=JSON.parse(localStorage.getItem(UQ)??`[]`);return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}catch{return[]}}function KQ(e){if(e instanceof Error)return`${e.message}\n${e.stack??``}`;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function qQ(e,...t){let n=`${new Date().toISOString()} [${e}] ${t.map(KQ).join(` `)}`.slice(0,WQ);try{localStorage.setItem(UQ,JSON.stringify([...GQ(),n].slice(-100)))}catch{}}function JQ(){return GQ().join(`
111
- `)}function YQ(){let e=console.error.bind(console);console.error=(...t)=>{qQ(`error`,...t),e(...t)},window.addEventListener(`error`,e=>qQ(`uncaught`,e.error??e.message)),window.addEventListener(`unhandledrejection`,e=>qQ(`rejection`,e.reason)),document.addEventListener(`webglcontextlost`,()=>qQ(`webgl`,`context lost`),!0)}var XQ=class extends h.Component{state={error:null,componentStack:``};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.setState({componentStack:t.componentStack??``})}render(){let{error:e,componentStack:t}=this.state;if(!e)return this.props.children;let n=[`${e.message}\n${e.stack??``}`,t,JQ()].filter(Boolean).join(`
108
+ `)}\n${r}\n`}function NY(e){let t=document.querySelector(`[data-composer="${CSS.escape(e)}"]`);return t&&t.offsetParent!==null?t:null}function PY(e,t,n,r){let i=MY(e.term.getSelection());if(i===null)return!1;let a=WF(t,n),o=NY(a);if(o){JF(a,i),e.term.clearSelection();let t=o.querySelector(`textarea`);return t?.focus(),t?.setSelectionRange(t.value.length,t.value.length),!0}return r?(z(V(`quote.atMenu`),`error`),!1):e.term.modes.bracketedPasteMode?(e.term.paste(i),e.term.clearSelection(),e.term.focus(),!0):(z(V(`quote.notReady`),`error`),!1)}async function FY(e,t,n){for(let r of n){r.size>1048576&&z(V(`layout.dropUploading`,{name:r.name}));try{t.term.paste(`${await ad(e,r,t.stream.split(`::`)[0])} `)}catch(e){z(e instanceof Error?e.message:String(e),`error`)}}t.term.focus()}async function IY(){if(!navigator.clipboard?.read)throw Error(V(`layout.pasteNeedsHttps`));let e=[];for(let t of await navigator.clipboard.read())for(let n of t.types)(n.startsWith(`image/`)||n===`application/pdf`)&&e.push(new File([await t.getType(n)],`clipboard`,{type:n}));return e}async function LY(e,t){let n;try{n=await IY()}catch(e){z(V(`layout.pasteNoAccess`,{error:e instanceof Error?e.message:String(e)}),`error`);return}n.length===0?z(V(`layout.pasteNoImage`),`error`):await FY(e,t,n)}async function RY(e){try{return await navigator.clipboard.writeText(e),!0}catch{return z(V(`menu.copyFailed`),`error`),!1}}function zY(e){return WU?(0,U.jsx)(kY,{...e}):(0,U.jsx)(BY,{...e})}function BY(e){let{client:t,taskId:n,tabId:r,leafId:i}=e,a=b(e.model.tasks)?.tasks.find(e=>e.id===n)?.tabStatus?.[r]?.kind===`needs-input`;H();let o=(0,h.useRef)(null),[s,c]=(0,h.useState)({kind:`none`}),[l,u]=(0,h.useState)(null),[d,f]=(0,h.useState)(0),[p,m]=(0,h.useState)({busy:!1,error:null}),g=(0,h.useRef)(e);g.current=e,Kb(t);let _=e.composer===!0&&qb(t),v=(0,h.useRef)(_);v.current=_,(0,h.useEffect)(()=>{let e=o.current;if(!e)return;let a=null,s=!1,l=[document.fonts.load(`13px "JetBrains Mono"`),document.fonts.load(`bold 13px "JetBrains Mono"`)];document.fonts.load(`13px "${pY}"`,String.fromCodePoint(57504)).catch(()=>{});let d=()=>{s||il({client:t,host:e,taskId:n,tabId:r,leafId:i,focusOnMount:g.current.focused!==!1&&!v.current},{setNotice:c,onScrolled:f,onFocusChange:e=>{if(!a)return;let{stream:t}=a.handle;e?(g.current.onActivate?.(),cc.set(uc(t)??null)):cc.get()?.stream===t&&cc.set(null)},onExit:()=>{lY(Bc(n,r,i))||g.current.onExit?.()},copyText:RY,pasteImage:async()=>{a&&await LY(t,a.handle)}}).then(e=>{s?e.release():(a=e,u(e.handle))})};return rl(t,n,r,i)?d():Promise.allSettled(l).then(d),()=>{s=!0,u(null),a?.release()}},[t,n,r,i]);let[y,x]=(0,h.useState)(!1);(0,h.useEffect)(()=>{if(!l)return;x(l.term.hasSelection());let e=l.term.onSelectionChange(()=>x(l.term.hasSelection()));return()=>{e.dispose(),x(!1)}},[l]),(0,h.useEffect)(()=>{if(!l)return;let{term:e,stream:a}=l,o={stream:a,focus:()=>e.focus(),input:t=>e.input(t,!0),reattach:()=>l.reattach(),scrollPages:e=>l.scrollLines(e*10),hasSelection:()=>e.hasSelection(),copySelection:()=>{let t=e.getSelection();return t.trim().length!==0&&(RY(t),e.clearSelection(),!0)},reset:()=>DY(t,n,r,i,{cols:e.cols,rows:e.rows},async()=>{await l.reattach(),e.focus()}),size:()=>({cols:e.cols,rows:e.rows})},s=lc(o);return document.activeElement===e.textarea&&cc.set(o),()=>{s()}},[l,t,n,r,i]),(0,h.useEffect)(()=>{e.focused&&!_&&l&&document.activeElement!==l.term.textarea&&l.term.focus()},[e.focused,_,l]);let S=!i||i===`leaf-1`,[C,w]=(0,h.useState)(null),T=e.engineExit?.since===C,[E,D]=(0,h.useState)(null),O=e.usageLimit&&e.usageLimit.since!==E?e.usageLimit:null,k=(0,h.useRef)(!1),A=async(i,a)=>{if(!k.current){k.current=!0,m({busy:!0,error:null});try{await t.request(`term.revive`,{taskId:n,tabId:r,...a?{restartExited:a}:{}}),await i.reattach(),i.term.focus(),w(e.engineExit?.since??null),m({busy:!1,error:null})}catch(e){m({busy:!1,error:e instanceof Error?e.message:String(e)})}finally{k.current=!1}}};return(0,U.jsxs)(`div`,{className:Gn,"data-stream":Bc(n,r,i),onDragOver:e=>e.dataTransfer.types.includes(`Files`)&&e.preventDefault(),onDrop:e=>{!e.dataTransfer.files.length||!l||(e.preventDefault(),FY(t,l,Array.from(e.dataTransfer.files)))},onPasteCapture:e=>{if(!l||e.target.closest(`form[data-composer]`))return;let n=Array.from(e.clipboardData.files);(n.length!==0||e.clipboardData.getData(`text/plain`)===``)&&(e.preventDefault(),e.stopPropagation(),n.length>0?FY(t,l,n):LY(t,l))},children:[(0,U.jsxs)(`div`,{className:Kn,children:[(0,U.jsx)(`div`,{className:qn,ref:o}),(0,U.jsx)(_Y,{notice:s,engineExit:T?null:e.engineExit??null,model:e.model,taskId:n,tabId:r,revive:p,onReopen:S&&l?e=>void A(l,e):void 0,onRetryAttach:l?()=>void l.reattach():void 0,usageLimit:O!==null,onDismissLimit:O?()=>D(O.since):void 0}),y&&e.composer&&l&&(0,U.jsx)(W,{variant:`floating`,className:`absolute top-2.5 right-2.5 z-4`,title:V(`quote.title`),onClick:()=>PY(l,n,r,a),children:V(`quote.action`)}),d>0&&l&&(0,U.jsxs)(`div`,{className:`mono absolute right-2.5 bottom-2.5 z-4 flex gap-3 rounded-sm border-hairline border-line bg-inset px-2.5 py-1 text-meta`,children:[(0,U.jsx)(`span`,{className:`text-warning`,children:sA(`scrolledBack`,{lines:d})}),(0,U.jsx)(`button`,{type:`button`,className:`link text-accent hover:underline touch-hit`,onClick:()=>l.scrollToTop(),children:sA(`scrollFirst`)}),(0,U.jsx)(`button`,{type:`button`,className:`link text-accent hover:underline touch-hit`,onClick:()=>l.scrollToBottom(),children:sA(`scrollLatest`)})]})]}),e.composer&&(0,U.jsx)(nI,{model:e.model,taskId:n,tabId:r}),l&&(0,U.jsx)(jY,{to:l,atMenu:a})]})}var VY=[{tool:`pen`,d:`M3 13l.6-2.6L10.9 3.1l2 2L5.6 12.4zM9.6 4.4l2 2`},{tool:`box`,d:`M3 4h10v8H3z`},{tool:`text`,d:`M4 4h8M8 4v8.5`}];function HY({mark:e}){return e.kind===`pen`?(0,U.jsx)(`path`,{d:e.d}):e.kind===`box`?(0,U.jsx)(`rect`,{x:e.x,y:e.y,width:e.w,height:e.h,rx:2}):(0,U.jsx)(`text`,{x:e.x,y:e.y,className:`fill-accent stroke-none font-mono text-body font-semibold`,children:e.text})}function UY({model:e,taskId:t,url:n,target:r,backdrop:i,onClose:a}){let[o,s]=(0,h.useState)(`pen`),[c,l]=(0,h.useState)([]),[u,d]=(0,h.useState)(null),[f,p]=(0,h.useState)(null),[m,g]=(0,h.useState)(!1),_=(0,h.useRef)(null),v=e=>{let t=e.currentTarget.getBoundingClientRect();return{x:Math.round(e.clientX-t.left),y:Math.round(e.clientY-t.top)}},y=e=>{let{x:t,y:n}=v(e);o!==`text`&&(e.currentTarget.setPointerCapture(e.pointerId),d(o===`pen`?{kind:`pen`,d:`M${t} ${n}`}:{kind:`box`,x:t,y:n,w:0,h:0}))},b=e=>{if(!u)return;let{x:t,y:n}=v(e);u.kind===`pen`?d({kind:`pen`,d:`${u.d} L${t} ${n}`}):u.kind===`box`&&d({...u,w:Math.max(0,t-u.x),h:Math.max(0,n-u.y)})},x=()=>{u&&(u.kind!==`box`||u.w>2&&u.h>2)&&l([...c,u]),d(null)},S=e=>{f&&e.trim()&&l([...c,{kind:`text`,...f,text:e.trim()}]),p(null)},C=async()=>{let o=re.get(),s=o?.startsWith(`${t}::`)?nl(e.client,o):null,c=r.current;if(!s||!c){z(V(`browser.noEngine`),`error`);return}g(!0);try{let t=`browser-${VS(n)}.png`,r=i?await iY(i,_.current,t):await rY(c,t);await FY(e.client,s,[r]),a()}catch(e){e instanceof DOMException&&e.name===`NotAllowedError`||z(V(`browser.captureFailed`,{error:e instanceof Error?e.message:String(e)}),`error`),g(!1)}};return(0,U.jsxs)(U.Fragment,{children:[i&&(0,U.jsx)(`img`,{src:i,alt:``,className:`size-full object-contain`}),(0,U.jsxs)(`svg`,{ref:_,className:Pr,"aria-label":V(`browser.annotate`),onPointerDown:y,onPointerMove:b,onPointerUp:x,onPointerCancel:x,onClick:e=>o===`text`&&p(v(e)),children:[(0,U.jsx)(`title`,{children:V(`browser.annotate`)}),[...c,...u?[u]:[]].map((e,t)=>(0,U.jsx)(HY,{mark:e},t))]}),f&&(0,U.jsx)(`input`,{autoFocus:!0,className:`absolute min-w-24 rounded-xs border-hairline border-accent bg-paper px-1 font-mono text-body text-accent focus:outline-none`,style:{left:f.x,top:f.y-14},"aria-label":V(`browser.text`),onBlur:e=>S(e.target.value),onKeyDown:e=>e.key===`Enter`&&e.currentTarget.blur()},`${f.x},${f.y}`),!m&&(0,U.jsxs)(`div`,{className:`absolute bottom-3 left-1/2 flex w-max -translate-x-1/2 items-center whitespace-nowrap gap-0.5 rounded-md border-hairline border-line bg-surface p-1 shadow-popover [&_svg]:flex-none`,children:[VY.map(e=>(0,U.jsx)(W,{variant:o===e.tool?`iconOn`:`icon`,title:V(`browser.${e.tool}`),"aria-label":V(`browser.${e.tool}`),"aria-pressed":o===e.tool,onClick:()=>s(e.tool),children:(0,U.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,U.jsx)(`path`,{d:e.d})})},e.tool)),(0,U.jsx)(W,{variant:`icon`,disabled:c.length===0,title:V(`browser.undo`),"aria-label":V(`browser.undo`),onClick:()=>l(c.slice(0,-1)),children:(0,U.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,U.jsx)(`path`,{d:`M5.5 3.5 3 6l2.5 2.5M3 6h6.5a3 3 0 0 1 0 6H7`})})}),(0,U.jsx)(W,{variant:`filled`,onClick:()=>void C(),children:V(`browser.addToChat`)}),(0,U.jsx)(W,{variant:`icon`,title:V(`browser.annotateDone`),"aria-label":V(`browser.annotateDone`),onClick:a,children:(0,U.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,U.jsx)(`path`,{d:`M4 4l8 8M12 4l-8 8`})})})]})]})}var WY=5e3;function GY(e,t){let[n,r]=(0,h.useState)([]);return(0,h.useEffect)(()=>{r([]);let n=!0,i=()=>e.client.request(`browser.ports`,{taskId:t}).then(e=>n&&r(e.ports),()=>{});i();let a=window.setInterval(()=>void i(),WY);return()=>{n=!1,window.clearInterval(a)}},[e,t]),n}function KY({model:e,task:t}){H();let n=t.id,r=GY(e,n);return r.length===0?null:(0,U.jsx)(`div`,{className:`flex flex-wrap justify-end gap-x-3.5 gap-y-1 px-2 pb-2 font-mono text-meta whitespace-nowrap`,children:r.map(e=>(0,U.jsx)(W,{onClick:()=>xw(n,e.url),children:V(`files.openPort`,{port:e.port})},e.port))})}function qY(e){let[t,n]=(0,h.useState)(0),r=e.open&&e.items.length>0,i=Math.min(t,Math.max(0,e.items.length-1)),a=(0,h.useRef)(null),{onCursor:o}=e;return(0,h.useEffect)(()=>o?.(i),[i,o]),(0,h.useEffect)(()=>{a.current?.scrollIntoView({block:`nearest`})},[i,e.items]),(0,U.jsxs)(`div`,{className:`relative`,children:[(0,U.jsx)(`input`,{className:Zr,"data-field":e.field,spellCheck:!1,autoComplete:`off`,autoFocus:e.autoFocus,placeholder:e.placeholder,value:e.value,onChange:t=>{n(0),e.onChange(t.target.value.replace(/[\r\n]+/g,``))},onKeyDown:t=>{if(!t.nativeEvent.isComposing){if(t.key===`ArrowDown`||t.key===`ArrowUp`){if(!r)return;t.preventDefault(),n(Math.max(0,Math.min(e.items.length-1,i+(t.key===`ArrowDown`?1:-1))))}else t.key===`Tab`&&!t.shiftKey&&r&&e.onComplete?.(i)?(t.preventDefault(),n(0)):t.key===`Enter`&&!t.ctrlKey&&!t.metaKey&&(t.preventDefault(),r?((e.onEnterRow??e.onPick)(i),n(0)):e.onEnter?.())}}}),r&&(0,U.jsx)(`ul`,{className:`mx-0 mt-1 mb-0 max-h-47 list-none overflow-y-auto rounded-sm border-hairline border-line bg-inset p-0.5 font-mono text-meta`,children:e.items.map((t,n)=>(0,U.jsx)(`li`,{ref:n===i?a:void 0,children:(0,U.jsxs)(`button`,{type:`button`,tabIndex:-1,"aria-pressed":n===i,className:Kr({cursor:n===i,accent:!!t.accent}),onMouseDown:t=>{t.preventDefault(),e.onPick(n)},children:[(0,U.jsx)(`span`,{children:t.text}),t.dim&&(0,U.jsxs)(`span`,{className:`text-muted`,children:[` `,t.dim]})]})},t.key))})]})}function JY(e,t,n){let r=[{ref:null,suggestion:{key:`default`,text:t,dim:V(`review.baseDefault`),accent:!0}}],i=(e,n)=>{for(let i of e)i!==t&&r.push({ref:i,suggestion:{key:`${n}:${i}`,text:i,dim:n}})};i(e?.branches??[],V(`review.baseBranch`)),i(e?.remotes??[],V(`review.baseRemote`)),i(e?.tags??[],V(`review.baseTag`));for(let t of e?.commits??[])r.push({ref:t.sha,suggestion:{key:`commit:${t.sha}`,text:t.sha,dim:t.subject}});let a=n.trim().toLowerCase();if(a===``)return r.slice(0,40);let o=e=>{if(e.suggestion.text.toLowerCase()===a)return 0;let t=Gf(e.suggestion.text,a);return t===`substring`||(e.suggestion.dim??``).toLowerCase().includes(a)?1:t===`segments`?2:null};return r.flatMap(e=>{let t=o(e);return t===null?[]:[{c:e,r:t}]}).sort((e,t)=>e.r-t.r).map(e=>e.c).slice(0,40)}function YY(e){let[t,n]=(0,h.useState)(!1),[r,i]=(0,h.useState)(``),[a,o]=(0,h.useState)(null),s=e.model.client;(0,h.useEffect)(()=>{if(!t)return;let n=!0;return ss(s,`diff.refs`,{taskId:e.taskId}).then(e=>n&&o(e),()=>{}),()=>{n=!1}},[t,s,e.taskId]);let c=JY(a,e.base,r),l=t=>{e.onPick(t),n(!1),i(``)},u=e.custom??e.base,d=[{id:`task`,label:V(`review.scopeTask`)},{id:`working`,label:V(`review.scopeWorking`)},{id:`branch`,label:V(`review.scopeBranch`)}],f=d.find(t=>t.id===e.scope)?.label??``;return(0,U.jsxs)(`span`,{className:`relative`,onKeyDown:e=>{e.stopPropagation(),e.key===`Escape`&&t&&n(!1)},children:[(0,U.jsx)(W,{hit:`tight`,"aria-expanded":t,"aria-haspopup":`menu`,onClick:t=>{let r=t.currentTarget.getBoundingClientRect();O.set({x:r.left,y:r.bottom+2,target:t.currentTarget,items:[...d.map(t=>({label:t.label,section:`scope`,checked:t.id===e.scope,run:()=>e.onScope(t.id)})),{label:V(`review.compareAgainst`,{base:u}),section:`base`,run:()=>n(!0)}]})},children:V(`review.scopeMenu`,{base:u,scope:f})}),t&&(0,U.jsx)(`div`,{className:`absolute top-full left-0 z-3 mt-1 w-64 max-w-full rounded-sm border-hairline border-line-active bg-surface p-1 shadow-popover`,children:(0,U.jsx)(qY,{field:`diff-base`,autoFocus:!0,value:r,onChange:i,items:c.map(e=>e.suggestion),open:!0,placeholder:V(`review.basePlaceholder`),onPick:e=>l(c[e]?.ref??null),onEnter:()=>l(r.trim()===``?null:r.trim())})})]})}var XY=`rove.diffBase`;function ZY(){try{let e=JSON.parse(localStorage.getItem(XY)??`{}`);return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`string`))}catch{return{}}}function QY(e){return ZY()[e]??null}function $Y(e,t){let n=ZY();t===null?delete n[e]:n[e]=t;try{localStorage.setItem(XY,JSON.stringify(n))}catch{}}function eX(e){let[t,n]=(0,h.useState)(()=>QY(e.taskId));return[t,t=>{$Y(e.taskId,t),n(t),t!==null&&e.scope!==`task`&&yw({taskId:e.taskId,path:e.path,scope:`task`})}]}var tX=(0,h.memo)(function(e){return(0,U.jsxs)(`div`,{className:`flex items-center ${e.viewed?`opacity-60`:``}`,children:[(0,U.jsxs)(W,{variant:`row`,"data-row":e.index,"aria-expanded":!e.closed,"aria-label":V(e.closed?`review.unfold`:`review.fold`,{path:e.name}),className:`${Yx(`file`,{cursor:e.cursor,noted:!1})} min-w-0 flex-1 text-left`,onClick:()=>e.onToggleFold(e.index,e.path),children:[(0,U.jsx)(`span`,{className:`grid place-items-center text-subtle`,children:(0,U.jsx)(Bv,{right:e.closed})}),(0,U.jsxs)(`span`,{className:tS,children:[(0,U.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name}),e.added?(0,U.jsxs)(Px,{tone:`added`,children:[`+`,e.added]}):null,e.removed?(0,U.jsxs)(Px,{tone:`removed`,children:[`−`,e.removed]}):null]})]}),e.path!==null&&(0,U.jsx)(W,{hit:`tight`,className:`flex-none px-2`,"aria-pressed":e.viewed,"aria-label":V(e.viewed?`review.unmarkViewed`:`review.markViewed`,{path:e.name}),onClick:()=>e.path!==null&&e.onToggleViewed(e.path),children:e.viewed?V(`review.viewedOn`):V(`review.viewed`)})]})});function nX(e){return(0,U.jsxs)(`div`,{className:`absolute top-full right-3 z-1 flex gap-1.5`,children:[(0,U.jsx)(W,{variant:`floating`,onMouseDown:e=>e.preventDefault(),onClick:t=>{t.stopPropagation(),e.onComment()},children:V(`review.comment`)}),e.showRange&&(0,U.jsx)(W,{variant:`floating`,onClick:t=>{t.stopPropagation(),e.onRange()},children:V(`review.range`)}),e.ranged&&(0,U.jsx)(W,{variant:`floating`,title:V(`preview.askInChatHint`),onMouseDown:e=>e.preventDefault(),onClick:t=>{t.stopPropagation(),e.onAsk()},children:V(`preview.askInChat`)})]})}function rX({note:e,onEdit:t}){return(0,U.jsxs)(W,{variant:`row`,className:`${Yx(`note`,{cursor:!1,noted:!1})} w-full text-left`,onClick:t,children:[(0,U.jsx)(`span`,{className:Zx}),(0,U.jsx)(`span`,{}),(0,U.jsx)(`span`,{className:`text-accent`,children:`●`}),(0,U.jsx)(`span`,{className:eS,children:e.body})]})}function iX(e){let t=(0,h.useRef)(e);return t.current=e,(0,h.useMemo)(()=>({rowClick:(e,n)=>t.current.rowClick(e,n),fileClick:(e,n)=>t.current.fileClick(e,n),viewedClick:e=>t.current.viewedClick(e),editNote:e=>t.current.editNote(e)}),[])}var aX=2e3,oX=(0,h.memo)(function(e){let{index:t,row:n,noted:r}=e;return(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`div`,{"data-row":t,className:Yx(n.kind,{cursor:e.cursor,noted:r}),onClick:n=>e.onClick(t,n),children:[(0,U.jsx)(`span`,{className:Zx,children:n.oldNo??``}),(0,U.jsx)(`span`,{className:Xx,children:n.newNo??``}),(0,U.jsx)(`span`,{className:Qx(n.kind,r,e.changed),children:n.kind===`add`?`+`:n.kind===`del`?`−`:r?`●`:e.changed?`▎`:` `}),(0,U.jsxs)(`span`,{className:$x(n.kind),children:[n.text.length>aX?n.text.slice(0,aX):n.text,n.text.length>aX&&(0,U.jsxs)(`span`,{className:`text-subtle`,children:[` `,V(`review.lineClipped`,{count:(n.text.length-aX).toLocaleString()})]})]}),e.actions]}),e.notes?.map(t=>t.id===e.editId?(0,U.jsx)(h.Fragment,{children:e.composer},t.id):(0,U.jsx)(rX,{note:t,onEdit:()=>e.onEditNote(t)},t.id)),e.editId===void 0&&e.composer]})});function sX(e){return(0,U.jsxs)(`div`,{className:`flex flex-none flex-wrap items-center gap-x-3 gap-y-1 px-2 pt-1.5 font-mono text-meta`,children:[e.picker,(0,U.jsx)(W,{hit:`tight`,"aria-pressed":e.ignoreWs,title:V(`review.ignoreWsHint`),className:`opacity-60 aria-pressed:underline aria-pressed:opacity-100`,onClick:e.onToggleWs,children:V(`review.ignoreWs`)}),(0,U.jsxs)(`span`,{className:`flex min-w-0 basis-full flex-wrap items-center gap-x-1.5 text-muted`,children:[V(e.files===1?`review.totalsOne`:`review.totals`,{files:e.files,added:e.added,removed:e.removed}),e.shape&&(0,U.jsxs)(`span`,{children:[`· `,e.shape]}),e.files>0&&(0,U.jsxs)(`span`,{className:`whitespace-nowrap`,children:[`· `,V(`review.viewedCount`,{done:e.viewed,files:e.files})]})]}),(0,U.jsxs)(`span`,{className:`ml-auto flex items-center gap-x-3`,children:[e.files>1&&(0,U.jsx)(W,{hit:`tight`,onClick:e.onNextFile,children:V(`review.nextFile`)}),e.onNextComment&&(0,U.jsx)(W,{hit:`tight`,onClick:e.onNextComment,children:V(`review.nextComment`)}),e.files>1&&(0,U.jsx)(W,{hit:`tight`,onClick:e.onFoldAll,children:e.allFolded?V(`review.unfoldAll`):V(`review.foldAll`)})]})]})}var cX=`rove.diffViewed`,lX=(e,t)=>`${e}\0${t}`,uX=4096;function dX(e){let t=2166136261;for(let n of e){let e=n.text.length>uX?`${n.text.slice(0,uX/2)}${n.text.length}${n.text.slice(-2048)}`:n.text,r=`${n.kind}${e}\n`;for(let e=0;e<r.length;e++)t=Math.imul(t^r.charCodeAt(e),16777619)}return(t>>>0).toString(16)}function fX(e){let t=new Map,n=-1,r=r=>{let i=n>=0?e[n]?.path:null;i&&t.set(i,dX(e.slice(n+1,r)))};return e.forEach((e,t)=>{e.kind===`file`&&(r(t),n=t)}),r(e.length),t}function pX(){try{let e=JSON.parse(localStorage.getItem(cX)??`{}`);return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`string`))}catch{return{}}}function mX(e){try{localStorage.setItem(cX,JSON.stringify(e))}catch{}}function hX(e,t,n){let r=new Set;for(let[i,a]of n)e[lX(t,i)]===a&&r.add(i);return r}function gX(e,t,n,r){let i={...e};return r===void 0?delete i[lX(t,n)]:i[lX(t,n)]=r,i}function _X(e,t){return e.find(e=>e>t)??e[0]??null}var vX=`rove.diffIgnoreWs`;function yX(){try{return localStorage.getItem(vX)===`1`}catch{return!1}}function bX(e){try{localStorage.setItem(vX,e?`1`:`0`)}catch{}}function xX(e){return(0,U.jsx)(`div`,{className:`flex flex-none items-center gap-3 px-2 pt-1.5 font-mono text-meta`,children:(0,U.jsx)(W,{hit:`tight`,onClick:()=>e.file?yw({taskId:e.taskId,path:e.path,scope:`working`}):bw(e.taskId,e.path),children:V(e.file?`preview.modeDiff`:`preview.modeFile`)})})}function SX(e,t,n,r,i){let[a,o]=(0,h.useState)(null);return(0,h.useEffect)(()=>{if(!r)return;let i=!0;return ss(e,`diff.file`,{taskId:t,path:n,scope:`working`}).then(e=>{if(!i)return;let t=e.kind===`diff`&&typeof e.text==`string`?lx(e.text,n):[];o(new Set(t.flatMap(e=>e.kind===`add`&&e.newNo!==null?[e.newNo]:[])))},()=>i&&o(null)),()=>{i=!1}},[e,t,n,r,i]),r?a:null}var CX=[`renamed`,`added`,`untracked`,`modified`,`deleted`,`conflict`],wX={U:`conflict`,D:`deleted`,M:`modified`,T:`modified`,"?":`untracked`,A:`added`,R:`renamed`,C:`renamed`},TX={conflict:`attention`,deleted:`attention`,modified:`warning`,untracked:`success`,added:`success`,renamed:`accent`},EX={conflict:`!`,deleted:`D`,modified:`M`,untracked:`U`,added:`A`,renamed:`R`};function DX(e){let t=new Map;for(let n of[`branch`,`working`])for(let r of e){let e=r.scope===n?wX[r.status]:void 0;e&&t.set(r.path,e)}let n=new Map(t);for(let[e,r]of t)for(let t=e.indexOf(`/`);t>=0;t=e.indexOf(`/`,t+1)){let i=e.slice(0,t+1),a=n.get(i);(a===void 0||CX.indexOf(r)>CX.indexOf(a))&&n.set(i,r)}return n}function OX(e,t){return e.some(e=>e.scope===`working`&&e.path===t&&e.status!==`?`)}var kX={add:`+`,del:`-`},AX=40,jX=160,MX=e=>`${kX[e.kind]??` `}${e.text.slice(0,jX)}`,NX=e=>e.startLine!==void 0&&e.startLine!==e.line?`${e.filePath}:${e.startLine}-${e.line}`:`${e.filePath}:${e.line}`;function PX(e,t,n){let r=[];for(let i=t;i<=n&&r.length<AX;i++){let t=e[i];t&&dx(t)!==null&&r.push(MX(t))}return r.join(`
109
+ `)}function FX(e,t){let n=e.startLine??e.line,r=t.flatMap((t,n)=>t.path===e.filePath&&dx(t)!==null?[n]:[]);if(!e.code){let i=r.filter(r=>{let i=dx(t[r]);return i>=n&&i<=e.line}),a=i[0],o=i[i.length-1];return a===void 0||o===void 0?null:{first:a,last:o}}let i=e.code.split(`
110
+ `);for(let e=0;e+i.length<=r.length;e++){let a=r.slice(e,e+i.length),o=a[0],s=a[a.length-1];if(o!==void 0&&s!==void 0&&dx(t[o])===n&&a.every((e,n)=>MX(t[e])===i[n]))return{first:o,last:s}}return null}function IX(e,t,n){return FX(e,t)?`ok`:t.some(t=>t.path===e.filePath)||n?`moved`:`unknown`}function LX(e){let[t,n]=(0,h.useState)(null),r=()=>{n(null),e.focusView()},i=async n=>{if(t){if(t.kind===`add`){let{target:r}=t;await e.client.request(`review.add`,{taskId:e.taskId,filePath:r.path,line:r.line,...r.startLine?{startLine:r.startLine}:{},code:PX(e.rows,r.first,r.last),body:n})}else await e.client.request(`review.edit`,{taskId:e.taskId,id:t.note.id,body:n}).catch(e=>{throw Mx(e)});e.onSaved(t.kind===`add`),r()}};return{node:t&&(0,U.jsx)(RX,{location:t.kind===`add`?NX({filePath:t.target.path,startLine:t.target.startLine,line:t.target.line}):NX(t.note),...t.kind===`edit`?{initial:t.note.body}:{},onSubmit:i,onCancel:r}),row:t?t.kind===`add`?t.target.last:FX(t.note,e.rows)?.last??-1:null,editId:t?.kind===`edit`?t.note.id:void 0,add:()=>e.target&&n({kind:`add`,target:e.target}),edit:e=>n({kind:`edit`,note:e})}}function RX(e){let[t,n]=(0,h.useState)(e.initial??``),r=ni(t),[i,a]=(0,h.useState)(!1),[o,s]=(0,h.useState)(null),c=e.initial!==void 0,l=t.trim(),u=async()=>{if(!(!l||i)){a(!0),s(null);try{await e.onSubmit(l)}catch(e){s(e instanceof Error?e.message:String(e)),a(!1)}}};return(0,U.jsxs)(`div`,{className:Yx(`note`,{cursor:!1,noted:!1}),onKeyDown:e=>e.stopPropagation(),onMouseUp:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:[(0,U.jsx)(`span`,{className:Zx}),(0,U.jsx)(`span`,{}),(0,U.jsx)(`span`,{className:`text-accent`,children:`●`}),(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5 whitespace-normal`,children:[(0,U.jsx)(`textarea`,{ref:r,className:`${Zr} ${ai} font-mono`,"aria-label":V(c?`review.noteEditOn`:`review.noteOn`,{location:e.location}),autoFocus:!0,rows:3,value:t,disabled:i,onChange:e=>n(e.target.value),onFocus:e=>e.currentTarget.setSelectionRange(t.length,t.length),onKeyDown:t=>{t.key===`Enter`&&(t.ctrlKey||t.metaKey)?(t.preventDefault(),u()):t.key===`Escape`&&(t.preventDefault(),e.onCancel())}}),o&&(0,U.jsx)(`p`,{className:`m-0 text-error`,children:o}),(0,U.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,U.jsx)(W,{hit:`tight`,disabled:i||!l,onClick:()=>void u(),children:V(c?`review.noteSave`:`review.noteAdd`)}),(0,U.jsx)(W,{hit:`tight`,className:`text-muted`,disabled:i,onClick:e.onCancel,children:V(`review.noteCancel`)})]})]})]})}function zX({notes:e,states:t,sending:n,onShow:r,onEdit:i,onDrop:a,onSend:o}){H();let[s,c]=(0,h.useState)(!1);if(e.length===0)return null;let l=e.length;return(0,U.jsxs)(`div`,{className:`flex max-h-2/5 min-h-0 flex-none flex-col border-t-hairline border-line font-mono text-meta`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-1.5 narrow:px-2`,children:[(0,U.jsxs)(W,{variant:`row`,className:`flex min-w-0 flex-1 items-center gap-2 text-left text-ink`,"aria-expanded":s,onClick:()=>c(!s),children:[(0,U.jsx)(Bv,{right:!s}),(0,U.jsx)(`span`,{children:V(`review.count`,{count:l})})]}),(0,U.jsx)(W,{disabled:n,onClick:o,children:n?V(`review.sending`):V(`review.send`,{count:l})})]}),s&&(0,U.jsx)(`ul`,{className:`m-0 min-h-0 list-none overflow-y-auto p-0 pb-1`,children:e.map(e=>(0,U.jsxs)(`li`,{className:`flex flex-col gap-0.5 px-3 py-1 narrow:px-2`,children:[(0,U.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,U.jsx)(W,{variant:`row`,className:`min-w-0 flex-1 truncate text-left text-ink hover:underline`,title:V(`review.show`),onClick:()=>r(e),children:NX(e)}),t.get(e.id)===`moved`&&(0,U.jsx)(`span`,{title:V(`review.movedHint`),children:(0,U.jsx)(Px,{tone:`warning`,children:V(`review.moved`)})}),(0,U.jsx)(W,{hit:`tight`,onClick:()=>i(e),children:V(`review.edit`)}),(0,U.jsx)(W,{hit:`tight`,onClick:()=>a(e),children:V(`review.drop`)})]}),(0,U.jsx)(`p`,{className:`m-0 line-clamp-2 whitespace-pre-wrap wrap-anywhere text-muted`,children:e.body})]},e.id))})]})}var BX=[];function VX({model:e,view:t,active:n,restored:r,onClose:i}){H();let a=ff(),[o,s]=(0,h.useState)(yX),[c,l]=(0,h.useState)(pX),[u,d]=eX(t),f=t.scope===`task`?u:null,p=f!==null,m=t.file===!0,g={taskId:t.taskId,path:t.path,scope:t.scope,...m?{content:!0}:{},...o?{ignoreWhitespace:!0}:{},...f?{base:f}:{}},_=Nx(e,t.taskId),v={...g,taskId:_},[y,x]=(0,h.useState)(()=>{let n=J(e,`diff.file`,v);return n===void 0?null:jx(n,t.path,p)}),[S,C]=(0,h.useState)(()=>J(e,`review.list`,{taskId:t.taskId})?.notes??[]),[w,T]=(0,h.useState)(()=>J(e,`diff.files`,{taskId:_})),[E,D]=(0,h.useState)(0),[O,k]=(0,h.useState)(null),[A,j]=(0,h.useState)(!1),[ee,te]=(0,h.useState)(new Map),[M,ne]=(0,h.useState)(!1),[N,P]=(0,h.useState)(0),ie=(0,h.useRef)(null),F=e.client,I=b(F.conn).state;(0,h.useEffect)(()=>{let e=!0;return F.request(`diff.file`,g).then(n=>e&&x(jx(os(F,`diff.file`,v,n),t.path,p)),t=>{if(e){if(f&&t instanceof Pc&&t.code===`BAD_REF`){d(null),z(t.message,`error`);return}x({kind:`text`,text:Pu(t),error:!0})}}),()=>{e=!1}},[F,t.taskId,t.path,t.scope,o,f,N,I]),(0,h.useEffect)(()=>{let e=!0;return F.request(`diff.files`,{taskId:t.taskId}).then(t=>e&&T(os(F,`diff.files`,{taskId:_},t)),()=>{}),()=>{e=!1}},[F,t.taskId,N]);let ae=()=>void ss(F,`review.list`,{taskId:t.taskId}).then(e=>C(e.notes));(0,h.useEffect)(ae,[F,t.taskId,N]);let L=(0,h.useRef)(!1);(0,h.useEffect)(()=>{n&&(L.current||!r)&&ie.current?.focus(),L.current=!0},[n,r]);let R=y?.kind===`rows`?y.rows:BX,oe=y?.kind===`rows`&&y.diff,se=w?.base??null,ce=t.path!==`.`&&t.scope===`working`&&OX(w?.files??[],t.path),le=SX(F,t.taskId,t.path,m&&ce&&!oe,N),ue=(0,h.useMemo)(()=>R.map((e,t)=>`row-${t}`),[R]),B=(0,h.useMemo)(()=>gx(R),[R]),de=(0,h.useMemo)(()=>fX(R),[R]),fe=(0,h.useMemo)(()=>hX(c,t.taskId,de),[c,t.taskId,de]),pe=(0,h.useMemo)(()=>{let e=new Set;for(let t of de.keys())(ee.get(t)??(Tx(t)||fe.has(t)))&&e.add(t);return e},[de,fe,ee]),me=(e,t)=>te(n=>{let r=new Map(n);for(let n of e)r.set(n,t);return r}),he=(0,h.useMemo)(()=>hx(R,pe),[R,pe]),ge=(0,h.useMemo)(()=>S.filter(e=>e.sentAt===void 0),[S]),_e=(0,h.useMemo)(()=>ge.map(e=>({note:e,at:FX(e,R)})),[ge,R]),ve=(0,h.useMemo)(()=>{let e=new Set;for(let{at:t}of _e)if(t)for(let n=t.first;n<=t.last;n++)e.add(n);return e},[_e]),ye=(0,h.useMemo)(()=>{let e=new Map;for(let{note:t,at:n}of _e)n&&e.set(n.last,[...e.get(n.last)??[],t]);return e},[_e]),be=t.path===`.`&&y!==null&&!(y.kind===`text`&&y.error),xe=(0,h.useMemo)(()=>{let e=new Map;for(let{note:t}of _e)e.set(t.id,IX(t,R,be));return e},[_e,R,be]);(0,h.useEffect)(()=>{if(he.includes(E))return;let e=E;for(;e>0&&R[e]?.kind!==`file`;)e--;D(e),k(null)},[he,E,R]);let Se=(0,h.useRef)(!1);(0,h.useEffect)(()=>{if(!Se.current){Se.current=!0;return}ie.current?.querySelector(`[data-row="${E}"]`)?.scrollIntoView({block:`nearest`})},[E]);let Ce=mx(R,E,O),we=e=>me([e],!pe.has(e)),Te=[...B.keys()].flatMap(e=>R[e]?.path?[R[e]?.path]:[]),Ee=(0,h.useMemo)(()=>Ax(B,R),[B,R]),De=Te.length>0&&Te.every(e=>pe.has(e)),Oe=[...B.values()].reduce((e,t)=>({added:e.added+t.added,removed:e.removed+t.removed}),{added:0,removed:0}),ke=e=>{let n=gX(c,t.taskId,e,fe.has(e)?void 0:de.get(e));l(n),mX(n),te(t=>{let n=new Map(t);return n.delete(e),n})},Ae=()=>{bX(!o),s(!o)},je=LX({client:F,taskId:t.taskId,rows:R,target:Ce,onSaved:e=>{e&&(k(null),j(!1)),ae()},focusView:()=>ie.current?.focus()}),Me=e=>{Ie(e),(t.path===`.`||t.path===e.filePath)&&je.edit(e)},Ne=e=>void F.request(`review.remove`,{taskId:t.taskId,id:e.id}).then(ae).catch(e=>z(Mx(e).message,`error`)),Pe=b(re),Fe=()=>{let e=px(R,E,O);if(e){if(!Pe?.startsWith(`${t.taskId}::`)){z(V(`files.mentionNoEngine`),`error`);return}F.request(`term.input`,{stream:Pe,data:fx(e)}).then(()=>{k(null),uc(Pe)?.focus()}).catch(e=>z(e instanceof Error?e.message:String(e),`error`))}},Ie=e=>{let n=FX(e,R),r=R.findIndex(t=>t.kind===`file`&&t.path===e.filePath);n?(me([e.filePath],!1),D(n.first)):t.path===`.`&&r>=0?D(r):t.path!==e.filePath&&t.path!==`.`&&yw({taskId:t.taskId,path:e.filePath,scope:t.scope}),k(null),j(!1)},Le=()=>{ne(!0),F.request(`review.send`,e.engineTarget(t.taskId)).then(e=>{z(e.delivered?V(`preview.sent`,{count:e.sent}):V(`preview.notSent`,{reason:e.reason??``}),e.delivered?`info`:`error`),ae()}).catch(e=>z(e instanceof Error?e.message:String(e),`error`)).finally(()=>ne(!1))},Re=()=>{let e=_X([...B.keys()],E);e!==null&&(D(e),k(null),j(!1))},ze=()=>{let e=_X(_e.flatMap(({at:e})=>e?[e.first]:[]).sort((e,t)=>e-t),E);if(e===null)return;let t=R[e]?.path;t&&me([t],!1),D(e),k(null),j(!1)},Be=e=>D(t=>{let n=Math.max(0,he.indexOf(t));return he[Math.min(he.length-1,Math.max(0,n+e))]??t}),Ve=e=>{let t=e.key;if(t===`j`||t===`ArrowDown`)Be(1);else if(t===`k`||t===`ArrowUp`)Be(-1);else if(t===`v`)k(e=>e===null?E:null),j(!0);else if(t===`c`&&!e.ctrlKey)je.add();else if(t===`x`){let e=_e.find(({at:e})=>e&&E>=e.first&&E<=e.last);e&&Ne(e.note)}else if(t===`s`)Le();else if(t===`z`){let e=R[E]?.path;e&&oe&&we(e)}else if(t===`r`)P(e=>e+1);else if(t===`q`||t===`Escape`)i();else if(e.ctrlKey&&!e.metaKey&&t.toLowerCase()===`c`&&!window.getSelection()?.toString())i();else return;e.preventDefault()},He=()=>{let e=window.getSelection();if(!e||e.isCollapsed)return;let t=e=>(e instanceof Element?e:e?.parentElement)?.closest(`[data-row]`),n=t(e.anchorNode),r=t(e.focusNode);!n||!r||(k(Number(n.dataset.row)),D(Number(r.dataset.row)),j(!0))},Ue=iX({rowClick:(e,t)=>{window.getSelection()?.isCollapsed!==!1&&(t.shiftKey?k(e=>e??E):(!a||O===null)&&k(null),D(e),j(!0))},fileClick:(e,t)=>{D(e),k(null),j(!1),t&&we(t)},viewedClick:ke,editNote:Me}),We=O===null?E:Math.min(O,E),Ge=O===null?E:Math.max(O,E);return(0,U.jsxs)(`div`,{className:`group/preview @container/preview flex min-h-0 min-w-0 flex-1 flex-col outline-none`,"data-file":m&&!oe?``:void 0,tabIndex:0,ref:ie,onKeyDown:Ve,children:[ce&&(0,U.jsx)(xX,{taskId:t.taskId,path:t.path,file:m}),oe&&(0,U.jsx)(sX,{picker:se!==null&&(0,U.jsx)(YY,{taskId:t.taskId,model:e,scope:t.scope,onScope:e=>yw({taskId:t.taskId,path:t.path,scope:e}),base:se,custom:u,onPick:d}),ignoreWs:o,onToggleWs:Ae,files:Te.length,shape:Ee,added:Oe.added,removed:Oe.removed,viewed:fe.size,allFolded:De,onFoldAll:()=>me(Te,!De),onNextFile:Re,onNextComment:_e.some(({at:e})=>e)?ze:null}),(0,U.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto py-1.5 font-mono text-meta/normal`,onMouseUp:He,children:[!y&&(0,U.jsx)(`p`,{className:`mx-2.5 my-3 font-mono text-meta text-subtle`,children:V(`preview.loading`)}),y?.kind===`text`&&(0,U.jsx)(`p`,{className:`mx-2.5 my-3 font-mono text-meta text-subtle ${y.error?`text-error`:``}`,children:y.text}),he.map(e=>{let t=R[e],n=e>=We&&e<=Ge;if(t.kind===`file`){let r=B.get(e),i=t.path;return(0,U.jsx)(tX,{index:e,name:t.text,path:i,closed:i!==null&&pe.has(i),viewed:i!==null&&fe.has(i),cursor:n,added:r?.added??0,removed:r?.removed??0,onToggleFold:Ue.fileClick,onToggleViewed:Ue.viewedClick},ue[e])}return(0,U.jsx)(oX,{index:e,row:t,cursor:n,noted:ve.has(e),actions:A&&Ce&&!je.node&&e===Ge&&(0,U.jsx)(nX,{showRange:a&&O===null,ranged:O!==null,onComment:je.add,onRange:()=>k(E),onAsk:Fe}),notes:ye.get(e),changed:t.newNo!==null&&le?.has(t.newNo)===!0,composer:e===je.row?je.node:void 0,editId:e===je.row?je.editId:void 0,onClick:Ue.rowClick,onEditNote:Ue.editNote},ue[e])}),je.row===-1&&je.node]}),(0,U.jsx)(zX,{notes:ge,states:xe,sending:M,onShow:Ie,onEdit:Me,onDrop:Ne,onSend:Le})]})}function HX(e){H();let{model:t,view:n}=e,r=n.path===`.`?null:iI(n.path),[i,a]=(0,h.useState)(null),o=b(t.tasks);if(!r)return(0,U.jsx)(VX,{...e});let s=i===n.path,c=JSON.stringify(o?.tasks.find(e=>e.id===n.taskId)?.changes??null);return(0,U.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,U.jsxs)(`div`,{className:`flex gap-x-3 px-2.5 py-1`,children:[(0,U.jsx)(W,{variant:`pill`,hit:`tight`,"aria-current":!s,onClick:()=>a(null),children:`[ ${V(`artifact.preview`)} ]`}),(0,U.jsx)(W,{variant:`pill`,hit:`tight`,"aria-current":s,onClick:()=>a(n.path),children:`[ ${V(`artifact.source`)} ]`})]}),s?(0,U.jsx)(VX,{...e}):(0,U.jsx)(SL,{model:t,taskId:n.taskId,path:n.path,kind:r,changeKey:c})]})}var UX=6e4,WX=new class{known=new Map;get(e){return this.known.get(e)}due(e,t){let n=this.known.get(e);return!n||t-n.at>=UX}set(e,t,n){t===null&&this.known.get(e)?.probe||this.known.set(e,{probe:t,at:n})}};function GX(e,t,n){let[,r]=(0,h.useState)(0);(0,h.useEffect)(()=>{if(!n||!WX.due(t,Date.now()))return;let i=!0;return e.request(`browser.probe`,{url:t,origin:window.location.origin}).then(e=>WX.set(t,e,Date.now()),()=>WX.set(t,null,Date.now())).then(()=>i&&r(e=>e+1)),()=>{i=!1}},[e,t,n]);let i=n?WX.get(t):void 0;return{pending:n&&!i,probe:i?.probe??null}}function KX(e){let t=rC(),n=aC(e.taskId,e.tabId),[r,i]=(0,h.useState)(null),[a,o]=(0,h.useState)(!1),s=(0,h.useRef)(null),c=(0,h.useRef)(e.url);c.current=e.url;let l=(0,h.useRef)(e.onUrlSync);l.current=e.onUrlSync,(0,h.useEffect)(()=>{if(t)return dC(o)},[t]),(0,h.useEffect)(()=>{if(!t||!e.enabled||!e.url)return;let r=!0,a=cC(n);return t.attach({panelKey:n,taskId:e.taskId,url:e.url,...a?{adoptTabId:a}:{}}).then(n=>{r&&(s.current=n.id,i(n),n.url&&n.url!==e.url&&!a&&t.navigate(n.id,e.url))}).catch(()=>{}),()=>{r=!1;let e=s.current;e&&t.setVisible(e,!1).catch(()=>{})}},[t,e.enabled,e.taskId,n,e.url]),(0,h.useEffect)(()=>{if(!(!t||!e.enabled))return t.onState(e=>{(e.panelKey===n||e.id===s.current)&&(s.current=e.id,i(e),e.url&&/^https?:\/\//i.test(e.url)&&e.url!==c.current&&l.current(e.url))})},[t,e.enabled,n]);let u=r?.id??null,d=!!(t&&e.enabled&&e.shown&&!e.paused&&!a&&u);(0,h.useEffect)(()=>{if(!t||!u)return;let n=e.stage.current;if(!d||!n){t.setVisible(u,!1).catch(()=>{});return}let r=0,i=()=>{let e=n.getBoundingClientRect();if(e.width<=0||e.height<=0){t.setVisible(u,!1).catch(()=>{});return}t.setBounds(u,{x:e.left,y:e.top,width:e.width,height:e.height}).catch(()=>{})},a=()=>{cancelAnimationFrame(r),r=requestAnimationFrame(i)};i();let o=new ResizeObserver(a);return o.observe(n),window.addEventListener(`resize`,a),()=>{cancelAnimationFrame(r),o.disconnect(),window.removeEventListener(`resize`,a),t.setVisible(u,!1).catch(()=>{})}},[t,u,d,e.stage]);let f=(0,h.useCallback)(e=>{let n=s.current;!t||!n||t.navigate(n,e).then(e=>i(e)).catch(()=>{})},[t]),p=(0,h.useCallback)(()=>{let e=s.current;!t||!e||t.goBack(e).then(e=>i(e)).catch(()=>{})},[t]),m=(0,h.useCallback)(()=>{let e=s.current;!t||!e||t.goForward(e).then(e=>i(e)).catch(()=>{})},[t]),g=(0,h.useCallback)(()=>{let e=s.current;!t||!e||t.reload(e).then(e=>i(e)).catch(()=>{})},[t]),_=(0,h.useCallback)(()=>{let e=s.current;if(!t||!e)return;let n=r?.owner===`agent`?`human`:`agent`;t.handoff(e,n).then(e=>{z(V(e.owner===`agent`?`browser.handedToAgent`:`browser.handedToHuman`,{id:e.id}),`info`)}).catch(()=>{})},[t,r?.owner]),v=(0,h.useCallback)(async()=>{let e=s.current;if(!t||!e)throw Error(`native browser tab is not ready`);return`data:image/png;base64,${await t.capture(e)}`},[t]);return t?{state:r,navigate:f,goBack:p,goForward:m,reload:g,toggleHandoff:_,captureDataUrl:v}:null}function qX({d:e}){return(0,U.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,U.jsx)(`path`,{d:e})})}function JX(e){let t=GY(e.model,e.taskId);return(0,U.jsxs)(`div`,{className:kr,children:[t.length>0&&(0,U.jsx)(`div`,{className:`flex w-[36ch] max-w-full flex-col text-left text-ink`,children:t.map(t=>(0,U.jsxs)(`button`,{type:`button`,className:Xi({size:`file`}),title:t.url,onClick:()=>e.onOpen(t.url),children:[(0,U.jsx)(`span`,{className:`row-title min-w-0 flex-1 truncate`,children:t.command}),(0,U.jsx)(`span`,{className:`flex-none text-subtle`,children:`:${t.port}`})]},t.port))}),(0,U.jsx)(`p`,{children:V(t.length>0?`browser.empty`:`browser.emptyPorts`)})]})}var YX=`M6.5 3.5h-3v9h9v-3M9.5 3.5h3v3M12.5 3.5l-5 5`;function XX({model:e,taskId:t,tab:n,root:r,shown:i,restored:a,onClose:o,onNavigate:s,onStep:c}){H();let l=BS(n),u=AS(l),d=u===null?l:jS(u,r),[f,p]=(0,h.useState)(d),[m,g]=(0,h.useState)(null),[_,v]=(0,h.useState)(0),[y,x]=(0,h.useState)(!1),[S,C]=(0,h.useState)(void 0),w=(0,h.useRef)(null),T=(0,h.useRef)(null),E=b(e.client.conn).hello?.peer?.local,D=iC(),O=l&&u===null?RS(l,window.location,E,D):null;(0,h.useEffect)(()=>{p(d),g(null)},[d]);let[k,A]=(0,h.useState)(!1),[j,ee]=(0,h.useState)(0);(0,h.useEffect)(()=>{let e=T.current;if(!e)return;let t=new ResizeObserver(()=>ee(e.clientWidth));return t.observe(e),()=>t.disconnect()},[]);let te=u===null||k||!T.current?f:QX(T.current,f,j),M=O?new URL(l).hostname:``,ne=!D&&O===`yes`&&l.startsWith(`https:`)&&!PS(M),{pending:N,probe:P}=GX(e.client,l,ne),re=l&&O?zS(l,O,P):null,ie=O===`yes`&&!re&&!N,F=KX({taskId:t,tabId:n.id,url:l,enabled:D&&u===null&&ie,shown:i,paused:y,stage:w,onUrlSync:s}),I=e=>{let t=NS(e,r),n=t===`outside`?null:t??LS(e);g(t===`outside`?`outside`:n===null&&e.trim()!==``?`invalid`:null),n!==null&&(n===l?(p(d),F&&u===null?F.reload():v(_+1)):(s(n),F&&AS(n)===null&&F.navigate(n)))},ae=()=>{if(y){x(!1),C(void 0);return}if(F){F.captureDataUrl().then(e=>{C(e),x(!0)},()=>{C(void 0),x(!1)});return}x(!0)},L=F&&u===null?!F.state?.canGoBack:n.at<=0,R=F&&u===null?!F.state?.canGoForward:n.at>=n.urls.length-1,oe=re?V(`browser.${re.key}`,{host:re.host}):O===null&&u===null?V(`browser.${m??`empty`}`):null;return(0,U.jsxs)(`div`,{className:Ar,children:[(0,U.jsxs)(`form`,{className:jr,onSubmit:e=>{e.preventDefault(),I(f)},children:[(0,U.jsx)(`button`,{type:`button`,className:dr({small:!0}),disabled:L,title:V(`browser.back`),"aria-label":V(`browser.back`),onClick:()=>F&&u===null?F.goBack():c(n.at-1),children:(0,U.jsx)(qX,{d:`M10 3.5 5.5 8l4.5 4.5`})}),(0,U.jsx)(`button`,{type:`button`,className:dr({small:!0}),disabled:R,title:V(`browser.forward`),"aria-label":V(`browser.forward`),onClick:()=>F&&u===null?F.goForward():c(n.at+1),children:(0,U.jsx)(qX,{d:`M6 3.5 10.5 8 6 12.5`})}),(0,U.jsx)(`button`,{type:`button`,className:dr({small:!0}),disabled:!ie&&u===null,title:V(`browser.reload`),"aria-label":V(`browser.reload`),onClick:()=>F&&u===null?F.reload():v(_+1),children:(0,U.jsx)(qX,{d:`M12.5 8a4.5 4.5 0 1 1-1.4-3.3M12.5 2.5v2.7H9.8`})}),(0,U.jsx)(`input`,{ref:T,className:`browser-url mono ${Mr}`,value:te,placeholder:V(`browser.placeholder`),onFocus:()=>A(!0),onBlur:()=>A(!1),"aria-label":V(`browser.address`),"aria-invalid":m!==null,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,inputMode:`url`,onChange:e=>p(e.target.value)}),F?.state&&ie&&(0,U.jsx)(W,{variant:`pill`,"aria-current":F.state.owner===`agent`?`true`:void 0,title:F.state.handoffReason??(F.state.owner===`agent`?V(`browser.takeControl`):V(`browser.handToAgent`)),onClick:()=>F.toggleHandoff(),children:F.state.owner===`agent`?V(`browser.takeControl`):V(`browser.handToAgent`)}),(nY()||D)&&(0,U.jsx)(W,{variant:y&&ie?`iconOn`:`icon`,disabled:!ie,title:V(`browser.annotate`),"aria-label":V(`browser.annotate`),"aria-pressed":y&&ie,onClick:ae,children:(0,U.jsx)(qX,{d:`M3 13l.6-2.6L10.9 3.1l2 2L5.6 12.4zM9.6 4.4l2 2`})}),l&&u===null?(0,U.jsx)(`a`,{className:dr({small:!0}),href:l,target:`_blank`,rel:`noopener noreferrer`,title:V(`browser.openTab`),"aria-label":V(`browser.openTab`),children:(0,U.jsx)(qX,{d:YX})}):(0,U.jsx)(`button`,{type:`button`,className:dr({small:!0}),disabled:!0,"aria-label":V(`browser.openTab`),children:(0,U.jsx)(qX,{d:YX})})]}),u===null?ie?(0,U.jsxs)(`div`,{ref:w,className:Nr,"data-native-browser":F?.state?.id??void 0,children:[!D&&(0,U.jsx)(`iframe`,{className:`min-w-0 flex-1 rounded-sm border-none bg-paper`,src:l,title:l,sandbox:`allow-scripts allow-same-origin allow-forms allow-popups`,referrerPolicy:`no-referrer`},`${l}#${_}`),y&&(0,U.jsx)(UY,{model:e,taskId:t,url:l,target:w,backdrop:S,onClose:()=>{x(!1),C(void 0)}},`${l}#${_}`)]}):O===null&&m===null?(0,U.jsx)(JX,{model:e,taskId:t,onOpen:s}):oe?(0,U.jsx)(`p`,{className:kr,children:oe}):null:(0,U.jsx)(HX,{model:e,view:{taskId:t,path:u,scope:`working`,file:!0},active:i,restored:a,onClose:o},`${u}#${_}#${n.read??``}`)]})}var ZX=document.createElement(`canvas`).getContext(`2d`);function QX(e,t,n){let r=getComputedStyle(e),i=n-Number.parseFloat(r.paddingLeft)-Number.parseFloat(r.paddingRight);return!ZX||!(i>0)?t:(ZX.font=r.font,MS(t,e=>ZX.measureText(e).width<=i))}var $X=`scrollbar-none flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto p-3`,eZ=`m-0 p-3 font-mono text-meta text-muted`,tZ=`flex items-baseline justify-between gap-3 font-mono text-meta normal-nums`,nZ=`flex h-1.5 w-full gap-px overflow-hidden rounded-full bg-inset`,rZ=`h-full min-w-[2px] flex-none`,iZ=`m-0 flex list-none flex-col p-0`,aZ=`-mx-1 flex h-5.5 min-w-0 items-center gap-2 rounded-xs px-1 font-mono text-meta normal-nums`,oZ=`mt-2`,sZ=`size-2 flex-none rounded-full bg-line`,cZ=`flex min-w-0 flex-1 items-center gap-1.5`,lZ=`min-w-0 truncate text-muted`,uZ=`w-[7ch] flex-none text-right text-ink`,dZ=`w-[6ch] flex-none text-right text-muted`,fZ=`group/fold`,pZ=`${aZ} cursor-pointer list-none hover:bg-hover focus-visible:outline focus-visible:outline-1 focus-visible:outline-focus [&::-webkit-details-marker]:hidden`,mZ=`m-0 flex list-none flex-col p-0`,hZ=`${aZ} pl-5`,gZ=`flex min-w-0 flex-1 overflow-hidden`,_Z=`min-w-0 truncate text-subtle`,vZ=`flex-none text-muted`,yZ=`w-[7ch] flex-none text-right text-muted`,bZ=`w-[6ch] flex-none`,xZ=1e4,SZ={system:`var(--info)`,system_prompt:`var(--info)`,system_tools:`var(--success)`,mcp_tools:`var(--warning)`,mcp_instructions:`var(--warning)`,custom_agents:`var(--ink)`,memory_files:`var(--merged)`,skills:`var(--muted)`,messages:`var(--accent)`,used:`var(--accent)`},CZ=[`var(--info)`,`var(--success)`,`var(--warning)`,`var(--merged)`];function wZ({model:e,task:t,active:n}){H();let r=b(e.client.conn),i=b(e.selection),a=b(e.tabs)[t.id]??[],o=i.taskId===t.id?a.find(e=>e.id===i.tabId):void 0,s=(o?.kind===`engine`?o:a.find(e=>e.kind===`engine`))?.id??null,[c,l]=(0,h.useState)({kind:`loading`}),[u,d]=(0,h.useState)(!1),f=(0,h.useRef)(``);if((0,h.useEffect)(()=>{if(!n||r.state!==`open`)return;let i=`${t.id}::${s}`;if(f.current!==i&&l({kind:`loading`}),f.current=i,!s){l({kind:`ready`,meter:null});return}let a=!0,o=n=>e.client.request(`context.usage`,{taskId:t.id,tabId:s,probe:n}).then(e=>a&&l({kind:`ready`,meter:e.meter})).catch(e=>a&&l(t=>t.kind===`ready`?t:{kind:`failed`,error:vS(e)})),c=()=>{d(!0),o(!0).finally(()=>a&&d(!1))};o(!1).then(c);let u=ua(xZ,c);return()=>{a=!1,d(!1),u()}},[e,n,r.state,t.id,s]),c.kind===`loading`)return(0,U.jsx)(`p`,{className:eZ,children:V(`context.loading`)});if(c.kind===`failed`)return(0,U.jsx)(`p`,{className:eZ,children:V(`context.failed`,{error:c.error})});if(!c.meter)return(0,U.jsx)(`p`,{className:eZ,children:V(`context.none`)});let p=c.meter,m=p.rows.filter(e=>e.share!==void 0),g=e=>e.share===void 0?void 0:SZ[e.key]??CZ[m.indexOf(e)%CZ.length],_=`${p.approximate?`~`:``}${EZ(p.used)}`;return(0,U.jsxs)(`div`,{className:$X,children:[(0,U.jsxs)(`div`,{className:tZ,children:[(0,U.jsx)(`span`,{className:`text-ink`,children:p.percent===null?V(`context.usedTokens`,{tokens:_}):V(`context.used`,{percent:DZ(p.percent)})}),p.window!==null&&(0,U.jsxs)(`span`,{className:`text-muted`,children:[_,` / `,EZ(p.window)]})]}),(0,U.jsx)(`div`,{className:nZ,role:`meter`,"aria-valuenow":Math.round(p.percent??100),"aria-valuemin":0,"aria-valuemax":100,children:m.map(e=>(0,U.jsx)(`span`,{className:rZ,style:{width:`${e.share}%`,background:g(e)}},e.key))}),(0,U.jsx)(`ul`,{className:iZ,children:p.rows.map((e,t)=>{let n=`context.part.${e.key}`,r=V(n)===n?e.label??e.key:V(n),i=g(e),a=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:sZ,style:i?{background:i}:void 0}),(0,U.jsxs)(`span`,{className:cZ,children:[(0,U.jsx)(`span`,{className:lZ,title:r,children:r}),e.items&&(0,U.jsx)(`span`,{className:`inline-block flex-none text-subtle group-open/fold:rotate-90`,children:`›`})]}),(0,U.jsx)(`span`,{className:uZ,children:EZ(e.tokens)}),(0,U.jsx)(`span`,{className:dZ,children:e.deferred?`—`:DZ(e.tokens/(p.window??p.used)*100)})]}),o=(e.deferred?!p.rows[t-1]?.deferred:e.share===void 0)?oZ:void 0;if(!e.items)return(0,U.jsx)(`li`,{className:o,children:(0,U.jsx)(`div`,{className:aZ,children:a})},e.key);let s=e.items.reduce((e,t)=>e+t.tokens,0),c=(e.itemCount??e.items.length)-e.items.length;return(0,U.jsx)(`li`,{className:o,children:(0,U.jsxs)(`details`,{className:fZ,children:[(0,U.jsx)(`summary`,{className:pZ,children:a}),(0,U.jsxs)(`ul`,{className:mZ,children:[e.items.map(e=>(0,U.jsx)(TZ,{name:e.name,tokens:e.tokens},e.name)),c>0&&(0,U.jsx)(TZ,{name:V(`context.more`,{count:c}),tokens:e.tokens-s})]})]})},e.key)})}),u&&m.length<2&&(0,U.jsx)(`p`,{className:`m-0 font-mono text-meta text-subtle`,children:V(`context.probing`)})]})}function TZ({name:e,tokens:t}){let n=e.lastIndexOf(`/`)+1;return(0,U.jsxs)(`li`,{className:hZ,title:e,children:[(0,U.jsxs)(`span`,{className:gZ,children:[n>0&&(0,U.jsx)(`span`,{className:`min-w-0 truncate text-subtle`,children:e.slice(0,n)}),(0,U.jsx)(`span`,{className:n>0?vZ:_Z,children:e.slice(n)})]}),(0,U.jsx)(`span`,{className:yZ,children:EZ(Math.max(0,t))}),(0,U.jsx)(`span`,{className:bZ})]})}function EZ(e){return e>=1e6?`${+(e/1e6).toFixed(1)}M`:e>=1e3?`${+(e/1e3).toFixed(1)}k`:String(e)}function DZ(e){return e>0&&e<.1?`<0.1%`:`${e<10?+e.toFixed(1):Math.round(e)}%`}var OZ=3;function kZ({model:e,task:t}){H();let n=t.autoFixCi,r=n=>void e.client.request(`task.autoFixCi`,{taskId:t.id,enabled:n}).catch(e=>z(e instanceof Error?e.message:String(e),`error`));return(0,U.jsx)(`div`,{className:`flex items-center gap-3 px-2 pt-1 font-mono text-meta`,children:n?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:n.stopped?Ou.attention:`text-muted`,title:V(`files.autoFix.hint`),children:V(n.stopped?`files.autoFix.stopped`:`files.autoFix.count`,{n:n.attempts,max:OZ})}),(0,U.jsx)(W,{hit:`tight`,onClick:()=>r(!1),children:V(`files.autoFix.off`)})]}):(0,U.jsx)(W,{hit:`tight`,title:V(`files.autoFix.hint`),onClick:()=>r(!0),children:V(`files.autoFix.on`)})})}function AZ(e){let t=e.pr;return!!t&&t.number!==void 0&&!e.machine&&(t.lifecycle===`open`||t.lifecycle===`ready_to_merge`)}function jZ(e){let t={fail:0,pending:0,pass:0,skipped:0};for(let n of e)t[n.state]++;return t}function MZ(e){let t=Math.max(0,Math.round(e/1e3));if(t<60)return`${t}s`;let n=Math.floor(t/60);return n<60?`${n}m${String(t%60).padStart(2,`0`)}s`:`${Math.floor(n/60)}h${String(n%60).padStart(2,`0`)}m`}function NZ(e,t){let{startedAt:n,completedAt:r,durationMs:i}=e;return e.state===`pending`?n?{key:`files.checks.runningFor`,vars:{elapsed:MZ(t-n)}}:null:i===null?r?{key:`files.checks.finishedAgo`,vars:{age:_c(t-r)}}:null:r?{key:`files.checks.tookAgo`,vars:{duration:MZ(i),age:_c(t-r)}}:{key:`files.checks.took`,vars:{duration:MZ(i)}}}function PZ(e){let t=[],n=e.mergeState.toUpperCase();e.draft&&t.push({key:`files.merge.draft`,tone:`warning`}),e.mergeable.toUpperCase()===`CONFLICTING`||n===`DIRTY`?t.push({key:`files.merge.conflicts`,tone:`attention`}):n===`BEHIND`?t.push({key:`files.merge.behind`,tone:`warning`}):n===`UNSTABLE`?t.push({key:`files.merge.unstable`,tone:`warning`}):n===`BLOCKED`?t.push({key:`files.merge.blocked`,tone:`warning`}):n===`CLEAN`&&!e.draft&&t.push({key:`files.merge.clean`,tone:`success`});let r=e.review.toUpperCase();return r===`APPROVED`?t.push({key:`files.merge.approved`,tone:`success`}):r===`CHANGES_REQUESTED`?t.push({key:`files.merge.changes`,tone:`attention`}):r===`REVIEW_REQUIRED`&&t.push({key:`files.merge.reviewRequired`,tone:`warning`}),t}var FZ={pass:{glyph:`✓`,tone:`success`},fail:{glyph:`✗`,tone:`attention`},pending:{glyph:`●`,tone:`warning`},skipped:{glyph:`–`,tone:`muted`}};function IZ({model:e,task:t}){H();let n=t.pr,r=t.id,[i,a]=(0,h.useState)(()=>J(e,`pr.checks`,{taskId:r})??null),[o,s]=(0,h.useState)(null),[c,l]=(0,h.useState)({}),[u,d]=(0,h.useState)(0),f=`${n?.number}:${n?.checkState}:${n?.mergeable}:${n?.reviewDecision}`;(0,h.useEffect)(()=>{let t=!0,n={taskId:r};return e.client.request(`pr.checks`,u>0?{...n,fresh:!0}:n).then(r=>{t&&(os(e,`pr.checks`,n,r),a(r))},e=>t&&a({outcome:`unavailable`,detail:e instanceof Error?e.message:String(e)})),()=>{t=!1}},[e,r,f,u]);let p=t=>{let n=`${t.runId}:${t.name}`;if(c[n]){l(({[n]:e,...t})=>t);return}l(e=>({...e,[n]:{state:`loading`}})),e.client.request(`pr.checkLog`,{taskId:r,runId:t.runId,job:t.name}).then(e=>e.outcome===`ok`?{state:`text`,text:e.tail}:e.outcome===`none`?{state:`note`,text:V(`files.checks.noLog`)}:{state:`note`,text:V(`files.checks.logUnavailable`,{detail:e.detail})}).catch(e=>({state:`note`,text:V(`files.checks.logUnavailable`,{detail:e instanceof Error?e.message:String(e)})})).then(e=>l(t=>n in t?{...t,[n]:e}:t))},m=(0,U.jsx)(W,{hit:`tight`,className:`flex-none whitespace-nowrap`,onClick:()=>d(e=>e+1),children:V(`files.checks.refresh`)});if(!i)return(0,U.jsx)(`div`,{className:yq,children:(0,U.jsx)(`div`,{className:bq,children:(0,U.jsxs)(`span`,{className:`flex-1 text-muted`,children:[V(`files.checks.title`),` `,V(`files.checks.loading`)]})})});if(i.outcome!==`ok`)return(0,U.jsx)(`div`,{className:yq,children:(0,U.jsxs)(`div`,{className:bq,children:[(0,U.jsx)(`span`,{className:`min-w-0 flex-1 text-muted wrap-anywhere`,children:i.outcome===`none`?V(`files.checks.none`):V(`files.checks.unavailable`,{detail:i.detail})}),m]})});let g=jZ(i.checks),_=Date.now(),v=o??(g.fail>0||g.pending>0),y=PZ(i);return(0,U.jsxs)(`div`,{className:yq,children:[(0,U.jsxs)(`div`,{className:bq,children:[(0,U.jsxs)(W,{variant:`row`,className:xq,"aria-expanded":v,disabled:i.total===0,onClick:()=>s(!v),children:[i.total>0&&(0,U.jsx)(Bv,{right:!v}),(0,U.jsx)(`span`,{children:i.total===0?V(`files.checks.none`):V(`files.checks.summary`,{pass:g.pass+g.skipped,total:i.total})}),g.fail>0&&(0,U.jsx)(`span`,{className:Ou.attention,children:V(`files.checks.failed`,{count:g.fail})}),g.pending>0&&(0,U.jsx)(`span`,{className:Ou.warning,children:V(`files.checks.running`,{count:g.pending})}),y.map(e=>(0,U.jsx)(`span`,{className:Ou[e.tone],children:V(e.key)},e.key))]}),m]}),v&&i.checks.map(e=>{let{glyph:t,tone:n}=FZ[e.state],r=NZ(e,_),i=`${e.runId}:${e.name}`,a=c[i];return(0,U.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,U.jsxs)(`div`,{className:`flex items-baseline gap-2 pl-4`,children:[(0,U.jsx)(`span`,{className:`w-[1ch] flex-none text-center ${Ou[n]}`,children:t}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.name,children:e.name}),r&&(0,U.jsx)(`span`,{className:`flex-none text-subtle`,children:V(r.key,r.vars)}),e.state===`fail`&&e.runId&&(0,U.jsx)(W,{hit:`tight`,className:`flex-none whitespace-nowrap`,onClick:()=>p(e),children:V(a?`files.checks.hideLog`:`files.checks.log`)})]}),a&&(0,U.jsx)(`pre`,{className:`m-0 ml-4 mb-1 max-h-40 overflow-y-auto rounded-sm border-hairline border-line bg-inset px-2 py-1.5 whitespace-pre-wrap wrap-anywhere text-muted`,children:a.state===`loading`?V(`files.checks.loading`):a.text})]},`${e.name}:${e.url}`)}),v&&i.total>i.checks.length&&(0,U.jsx)(`span`,{className:`pl-4 text-subtle`,children:V(`files.checks.more`,{count:i.total-i.checks.length})})]})}function LZ({model:e,task:t}){return AZ(t)?(0,U.jsxs)(`div`,{onKeyDown:e=>e.stopPropagation(),children:[(0,U.jsx)(IZ,{model:e,task:t}),(0,U.jsx)(kZ,{model:e,task:t})]}):null}function RZ(e,t){return e.dir===t.dir?e.name<t.name?-1:+(e.name>t.name):e.dir?-1:1}function zZ(e,t){let n={children:new Map,file:!1};for(let t of e){let e=n;for(let n of t.split(`/`)){let t=e.children.get(n);t||(t={children:new Map,file:!1},e.children.set(n,t)),e=t}e.file=!0}let r=[],i=(e,n,a)=>{let o=[...e.children].sort(([e,t],[n,r])=>RZ({name:e,dir:t.children.size>0&&!t.file},{name:n,dir:r.children.size>0&&!r.file}));for(let[e,s]of o){let o=s.children.size>0&&!s.file,c=o?`${n}${e}/`:`${n}${e}`,l=o&&t.has(c);r.push({path:c,name:e,depth:a,dir:o,open:l}),l&&i(s,c,a+1)}};return i(n,``,0),r}var BZ={start:`\x1B[200~`,end:`\x1B[201~`};function VZ(e,t){return e.engineTarget(t).tabId??e.tabs.get()[t]?.find(e=>e.kind===`engine`)?.id}async function HZ(e,t,n){let r=VZ(e,t);if(!r)return z(V(`files.stripNoEngine`),`error`),!1;try{return e.selection.get().tabId!==r&&e.select(t,r),await e.client.request(`term.input`,{stream:Bc(t,r),data:`${BZ.start}${n}${BZ.end}`}),z(V(`files.stripFilled`)),!0}catch(e){return z(e instanceof Error?e.message:String(e),`error`),!1}}function UZ(e){let t=e.kind===`task`&&!e.noWorktree&&!e.machine&&!e.archived,n=e.changes;return t&&!!n&&`added`in n&&n.added+n.deleted>0}function WZ(e){return[...UZ(e)?[`commit`]:[],...GZ(e)]}function GZ(e){let t=e.pr;if(!t)return e.kind===`task`&&!e.noWorktree&&!e.machine&&!e.archived&&!e.sessionPrs?.length?[`createPR`]:[];if(t.lifecycle===`merged`)return e.archived?[]:[`archive`];if(t.lifecycle!==`open`&&t.lifecycle!==`ready_to_merge`)return[];let n=[];return((t.mergeable??``).toUpperCase()===`CONFLICTING`||e.prChip===`conflict`)&&n.push(`conflicts`),t.checkState===`failing`&&n.push(`fixCI`),(t.reviewDecision??``).toUpperCase()===`CHANGES_REQUESTED`&&n.push(`comments`),n}async function KZ(e,t,n){try{let r=await e.client.request(`task.prompt`,{taskId:t.id,kind:n});r.outcome===`unavailable`?z(V(`files.stripUnavailable`,{detail:r.detail??``}),`error`):r.outcome===`none`||!r.prompt?z(V(`files.stripNothing`),`error`):await HZ(e,t.id,r.prompt)}catch(e){z(e instanceof Error?e.message:String(e),`error`)}}var qZ={commit:`files.stripCommit`,createPR:`files.stripCreate`,conflicts:`files.stripConflicts`,fixCI:`files.stripFixCi`,comments:`files.stripComments`,archive:`files.stripArchive`};function JZ({model:e,task:t}){let n=WZ(t);return n.length===0?null:(0,U.jsx)(`div`,{className:`flex flex-wrap justify-end gap-x-3.5 gap-y-1 px-2 pb-2 font-mono text-meta whitespace-nowrap`,children:n.map(n=>(0,U.jsx)(W,{onClick:()=>n===`archive`?void kj(e,t):void KZ(e,t,n),children:V(qZ[n])},n))})}function YZ({model:e,task:t,narrow:n=!1}){H();let[r,i]=(0,h.useState)(()=>J(e,`files.list`,{taskId:t.id})?.files??null),[a,o]=(0,h.useState)(()=>DX(J(e,`diff.files`,{taskId:t.id})?.files??[])),[s,c]=(0,h.useState)(null),[l,u]=(0,h.useState)(!1),[d,f]=(0,h.useState)(null),[p,m]=(0,h.useState)(new Set),[g,_]=(0,h.useState)(0),[v,y]=(0,h.useState)(0),x=(0,h.useRef)(null),S=b(re),C=b(e.client.conn),w=JSON.stringify(t.changes??null);(0,h.useEffect)(()=>{let n=!0;return ss(e,`files.list`,{taskId:t.id}).then(e=>{n&&(i(e.files),u(e.truncated===!0),c(e.root??null),f(null))},e=>n&&f(Pu(e))),()=>{n=!1}},[e,t.id,w,v,C.state]),(0,h.useEffect)(()=>{let n=!0;return ss(e,`diff.files`,{taskId:t.id}).then(e=>n&&o(DX(e.files)),()=>{}),()=>{n=!1}},[e,t.id,w,v,C.state]);let T=r!==null,E=zZ(r??[],p).map(e=>({path:e.path,label:e.name,depth:e.depth,dir:e.dir,open:e.open,state:a.get(e.path)})),D=Math.min(g,Math.max(0,E.length-1)),O=E[D],k=(e,t)=>m(n=>{let r=new Set(n);return t??!r.has(e)?r.add(e):r.delete(e),r}),A=e=>bw(t.id,e),j=e=>yw({taskId:t.id,path:e,scope:`working`}),ee=n=>{if(!S?.startsWith(`${t.id}::`)){z(V(`files.mentionNoEngine`),`error`);return}e.client.request(`term.input`,{stream:S,data:`@${n} `}).catch(e=>z(String(e),`error`))},te=(n,r,i)=>t.machine?z(V(`files.remoteNoExternal`,{host:t.machine.label}),`error`):void e.client.request(n,{taskId:t.id,path:r}).then(()=>i&&z(i)).catch(e=>z(e instanceof Error?e.message:String(e),`error`)),M=e=>te(`file.openExternal`,e,V(`taskops.openedExternal`)),ne=n=>void e.client.request(`file.openTerminal`,{taskId:t.id,path:n}).catch(e=>z(e instanceof Error?e.message:String(e),`error`)),N=e=>{let t=e.dir?e.path.slice(0,-1):e.path;return[{label:V(`files.menu.attach`),key:`a`,run:()=>ee(e.path)},{label:V(`files.menu.copy`),children:[{label:V(`files.menu.copyRelative`),run:()=>void XG(t,t)},...s?[{label:V(`files.menu.copyAbsolute`),run:()=>void XG(`${s}/${t}`,t)}]:[],{label:V(`files.menu.copyName`),run:()=>void XG(e.label,t)}]},{label:V(`files.menu.diff`),key:`d`,section:`open`,run:()=>j(e.path)},...e.dir?[]:[{label:V(`files.menu.openExternal`),key:`o`,section:`open`,run:()=>M(e.path)}],{label:V(`files.menu.reveal`),section:`open`,run:()=>te(`file.reveal`,t)},{label:V(`files.menu.terminal`),section:`terminal`,run:()=>ne(t)}]};return(0,U.jsxs)(`div`,{className:`group/pane flex min-h-0 min-w-0 flex-1 flex-col outline-none ${n?`px-1.5 pt-2.5 pb-2`:`p-1.5`}`,tabIndex:0,ref:x,onKeyDown:e=>{let t=e.key;if(t===`j`||t===`ArrowDown`)_(Math.min(E.length-1,D+1));else if(t===`k`||t===`ArrowUp`)_(Math.max(0,D-1));else if((t===`l`||t===`ArrowRight`)&&O?.dir)k(O.path,!0);else if((t===`h`||t===`ArrowLeft`)&&O?.dir)k(O.path,!1);else if(t===`r`)y(e=>e+1);else if(t===`D`&&e.shiftKey)j(`.`);else if(t===`d`&&O)j(O.path);else if(t===`Enter`&&O)O.dir?k(O.path):A(O.path);else if(t===`a`&&O)ee(O.path);else if(t===`o`&&O&&!O.dir)M(O.path);else return;e.preventDefault()},children:[(0,U.jsx)(JZ,{model:e,task:t}),(0,U.jsx)(LZ,{model:e,task:t}),(0,U.jsx)(KY,{model:e,task:t}),(0,U.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[d&&(0,U.jsx)(`p`,{className:`mono text-error`,children:d}),!d&&T&&E.length===0&&(0,U.jsx)(`p`,{className:`mx-2.5 my-3 font-mono text-meta text-subtle`,children:V(`files.emptyAll`)}),E.map((e,t)=>(0,U.jsxs)(`button`,{type:`button`,className:Xi({selected:t===D,size:n?`file-narrow`:`file`}),style:{paddingLeft:8+e.depth*14},title:e.path,onContextMenu:n=>{_(t),Tq(n,N(e))},onClick:()=>{_(t),x.current?.focus(),e.dir?k(e.path):A(e.path)},children:[(0,U.jsx)(`span`,{className:ta,children:e.dir?(0,U.jsx)(Bv,{right:!e.open}):null}),(0,U.jsx)(`span`,{className:`${Zi} ${e.state?Ou[TX[e.state]]:``}`,children:e.label}),e.state&&(0,U.jsx)(`span`,{className:`w-[1ch] flex-none text-center font-mono ${Ou[TX[e.state]]}`,title:V(`files.state.${e.state}`),children:e.dir?`•`:EX[e.state]})]},e.path)),!d&&l&&(0,U.jsx)(`p`,{className:`mx-2.5 my-3 font-mono text-meta text-subtle`,children:V(`files.truncated`,{count:(r?.length??0).toLocaleString()})})]})]})}var XZ={working:`review.scopeWorking`,branch:`review.scopeBranch`,task:`review.scopeTask`};function ZZ(e){return e.kind===`diff`?e.path===`.`?{text:V(XZ[e.scope]),hint:V(`preview.whole`)}:{text:_C(e.path),hint:e.path}:{text:V(`panel.${e.kind}`),hint:V(`panel.${e.kind}`)}}function QZ({taskId:e,kind:t,expand:n}){H();let r=b(qC),i=V(r?`panel.restore`:`panel.expand`);return(0,U.jsxs)(U.Fragment,{children:[n&&(0,U.jsx)(`button`,{type:`button`,className:dr({tool:!0}),title:i,"aria-label":i,"aria-pressed":r,onClick:()=>qC.set(!r),children:(0,U.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,U.jsx)(`path`,{d:r?`M13.5 6.5h-4v-4M2.5 9.5h4v4M9.5 6.5l4-4M6.5 9.5l-4 4`:`M9.5 2.5h4v4M6.5 13.5h-4v-4M13.5 2.5l-4.5 4.5M2.5 13.5 7 9`})})}),(0,U.jsx)(`button`,{type:`button`,className:dr({tool:!0}),title:V(`panel.close`),"aria-label":V(`panel.close`),onClick:()=>Cw(e,t),children:(0,U.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,U.jsx)(`path`,{d:`M4 4l8 8M12 4l-8 8`})})})]})}function $Z({taskId:e,column:t,narrow:n}){H();let r=b(qC);if(t.kind===`browser`){let i=(0,U.jsxs)(`div`,{className:vr(n),children:[(0,U.jsx)(pW,{taskId:e,column:t}),!n&&(0,U.jsx)(QZ,{taskId:e,kind:`browser`,expand:!0})]});return(0,U.jsx)(wG,{slot:`panel.tabs`,data:{taskId:e,kind:`browser`,title:V(`panel.browser`),hint:V(`panel.browser`),tabCount:t.tabs.length,expanded:r,onToggleExpand:n?void 0:()=>qC.set(!r),onClose:()=>Cw(e,`browser`)},fallback:i})}if(n&&t.kind!==`diff`)return null;let{text:i,hint:a}=ZZ(t),o=(0,U.jsxs)(`div`,{className:vr(n),children:[(0,U.jsx)(`span`,{className:yr,title:a,children:i}),(0,U.jsx)(QZ,{taskId:e,kind:t.kind,expand:!n})]});return(0,U.jsx)(wG,{slot:`panel.tabs`,data:{taskId:e,kind:t.kind,title:i,hint:a,tabCount:1,expanded:r,onToggleExpand:n?void 0:()=>qC.set(!r),onClose:()=>Cw(e,t.kind)},fallback:o})}var eQ=e=>`${e.id}:${BS(e)}`;function tQ({model:e,task:t,column:n,restored:r}){let i=(0,h.useRef)([]);i.current=tC(i.current,n.active,n.tabs);let a=(0,h.useRef)(n.tabs.map(eQ));return n.tabs.filter(e=>i.current.includes(e.id)).map(i=>(0,U.jsx)(`div`,{className:Or,hidden:i.id!==n.active,children:(0,U.jsx)(XX,{model:e,taskId:t.id,tab:i,root:t.workspace,shown:i.id===n.active,restored:r&&a.current.includes(eQ(i)),onClose:()=>Tw(t.id,i.id),onNavigate:e=>ww(t.id,t=>JS(t,i.id,e)),onStep:e=>ww(t.id,t=>YS(t,i.id,e))})},i.id))}function nQ({model:e,task:t,column:n,narrow:r,restored:i,index:a}){let o=GR(),s=vz(),c=n.kind===`browser`?(0,U.jsx)(tQ,{model:e,task:t,column:n,restored:i}):(0,U.jsxs)(`div`,{className:Or,children:[n.kind===`files`&&(0,U.jsx)(YZ,{model:e,task:t,narrow:r}),n.kind===`chat`&&(0,U.jsx)(yR,{model:e,task:t,active:!0}),n.kind===`quota`&&(0,U.jsx)(wZ,{model:e,task:t,active:!0}),n.kind===`diff`&&(0,U.jsx)(HX,{model:e,view:{taskId:t.id,path:n.path,scope:n.scope},active:!0,restored:i,onClose:()=>Cw(t.id,`diff`)},`${t.id}:${n.path}:${n.scope}:${n.at??``}`)]}),l=t.changes&&!(`unreadable`in t.changes)?{files:0,added:t.changes.added,removed:t.changes.deleted}:void 0,u=mj(t)??void 0;return(0,U.jsx)(wG,{slot:`panel.section`,data:{taskId:t.id,index:a,kind:n.kind,title:t.label,branch:t.branch||void 0,repo:t.repo?t.repo.split(`/`).pop():void 0,engineId:t.engine?.id??void 0,engineName:t.engine?.name,model:t.model,engineFamily:t.engine?.protocol,engineColor:nG(o?.manifest,t.engine,s),statusKind:t.rowStatus?.kind??`idle`,diffStats:l,todos:u,pr:t.pr?.number?{number:t.pr.number,state:t.pr.lifecycle,url:t.pr.url}:void 0},fallback:c})}function rQ({taskId:e,kinds:t,index:n,body:r,slot:i}){H();let a=(0,h.useRef)(null);return(0,U.jsx)(`div`,{className:Dr,style:{gridColumn:i},title:V(`panel.resizeSplit`),onPointerDown:e=>{let n=t.map(e=>r.current?.querySelector(`[data-kind="${e}"]`)?.getBoundingClientRect().width??0);a.current={x:e.clientX,widths:n},r.current?.classList.add(`is-resizing`),e.currentTarget.setPointerCapture(e.pointerId)},onPointerMove:t=>{let r=a.current;if(!r)return;let i=jC(r.widths,n,t.clientX-r.x,220);gw(e,e=>kC(e,i))},onLostPointerCapture:()=>{a.current=null,r.current?.classList.remove(`is-resizing`)},onDoubleClick:()=>gw(e,AC)})}function iQ({panel:e}){H();let t=(0,h.useRef)(null);return(0,U.jsx)(EW,{edge:`left`,title:V(`panel.resize`),onPointerDown:n=>{t.current={x:n.clientX,width:e.current?.getBoundingClientRect().width??0},e.current?.classList.add(`is-resizing`),n.currentTarget.setPointerCapture(n.pointerId),me(!0)},onPointerMove:e=>{let n=t.current;if(!n||e.clientX===n.x)return;let r=yW.get()?0:wW(vW.get()??280);GC.set(JC(n.width-(e.clientX-n.x),r))},onLostPointerCapture:()=>{t.current=null,e.current?.classList.remove(`is-resizing`),me(!1)},onDoubleClick:()=>GC.set(null)})}var aQ=e=>e.kind===`diff`?`diff:${e.path}:${e.scope}`:e.kind;function oQ({model:e,task:t,narrow:n}){H();let r=fw(t.id),i=b(RC),a=b(qC),o=(0,h.useRef)(null),s=(0,h.useRef)(null),c=i===`terminal`?`files`:i,l=n?gC(r,c):void 0;(0,h.useEffect)(()=>{n&&!l&&gw(t.id,e=>xC(e,c))},[n,l,c,t.id]);let u=n?l?[l]:[]:r.columns,d=u.map(e=>e.kind),f=(n?[1]:OC(r)).map((e,t)=>`${t>0?`var(--divider) `:``}minmax(0, ${e}fr)`).join(` `),p=(0,h.useRef)(u.map(aQ)),m=GR(),g=n?``:tz(m?.manifest.layout?.frame),_=vz(),v=!n&&m?.manifest.slots?.[`panel.frame`]?.component!==void 0,y=t.changes&&!(`unreadable`in t.changes)?t.changes:void 0,x=(0,U.jsxs)(`div`,{className:gr,ref:s,style:{gridTemplateColumns:f},children:[u.map((r,i)=>(0,U.jsxs)(`section`,{className:_r,"data-kind":r.kind,style:{gridColumn:2*d.indexOf(r.kind)+1},children:[(0,U.jsx)($Z,{taskId:t.id,column:r,narrow:n}),(0,U.jsx)(nQ,{model:e,task:t,column:r,narrow:n,restored:p.current.includes(aQ(r)),index:i})]},r.kind)),!n&&u.slice(1).map((e,n)=>(0,U.jsx)(rQ,{taskId:t.id,kinds:d,index:n,body:s,slot:2*n+2},`divider:${e.kind}`))]});return(0,U.jsxs)(`aside`,{"data-tp-region":`panel`,className:`${hr(n)} ${g}`,ref:o,style:v?{padding:0}:void 0,children:[!n&&!a&&(0,U.jsx)(iQ,{panel:o}),n?x:(0,U.jsx)(wG,{slot:`panel.frame`,data:{taskId:t.id,title:t.label,branch:t.branch||void 0,repo:t.repo?t.repo.split(`/`).pop():void 0,worktree:cG(t),engineId:t.engine?.id??void 0,engineName:t.engine?.name,model:t.model,engineFamily:t.engine?.protocol,engineColor:nG(m?.manifest,t.engine,_),statusKind:t.rowStatus?.kind??`idle`,diffStats:y?{files:0,added:y.added,removed:y.deleted}:void 0,pr:t.pr?.number?{number:t.pr.number,state:t.pr.lifecycle,url:t.pr.url,checkState:t.pr.checkState}:void 0,views:fC.map(e=>({kind:e,title:V(`panel.${e}`),open:d.includes(e)})),activeView:d.length===1?d[0]:void 0,onShowView:e=>gw(t.id,t=>xC({...t,columns:t.columns.filter(t=>t.kind===e)},e))},fallback:x})]})}function sQ({model:e,task:t,remoteHost:n,narrow:r=!1}){let i=pw(t?.id??null),a=GR()?.manifest.slots?.[`panel.frame`]?.component!==void 0;return!r&&!(i||a&&t)?null:t?(0,U.jsx)(oQ,{model:e,task:t,narrow:r},t.id):n?(0,U.jsx)(`aside`,{"data-tp-region":`panel`,className:hr(!1),children:(0,U.jsx)(Sg,{host:n,onMachines:()=>GA(e)})}):null}var cQ=y(null);function lQ(e){cQ.set(e),!(e===null||!Ee())&&(RC.set(`terminal`),ye())}var uQ=`rove.web.update.skipped`,dQ=`rove.web.update.askedAt`;function fQ(e){return!e.latest||!e.notify||e.latest===e.skipped||e.askedAt!==null&&e.now-e.askedAt<18e6?null:e.latest}function pQ(){let e=YP.get(),t=fQ({latest:e?.info?.hasUpdate?e.info.latest:null,notify:jw.get().prefs.updateNotify,skipped:localStorage.getItem(uQ),askedAt:Number(localStorage.getItem(dQ))||null,now:Date.now()});!t||k.get()!==null||(localStorage.setItem(dQ,String(Date.now())),k.set((0,U.jsx)(mQ,{current:e?.current??``,latest:t,notes:e?.notes??[]})))}function mQ(e){let[t]=e.notes;return(0,U.jsx)(ia,{title:V(`updatePrompt.title`,{version:e.latest}),wide:e.notes.length>0,children:(0,U.jsxs)(`div`,{className:hi,children:[(0,U.jsx)(`p`,{className:`text-muted`,children:V(`updatePrompt.body`,{current:e.current})}),e.notes.length===1&&t?(0,U.jsx)(KP,{body:t.body}):(0,U.jsx)(nF,{notes:e.notes}),(0,U.jsxs)(`div`,{className:Qr,children:[(0,U.jsx)(W,{onClick:()=>{localStorage.setItem(uQ,e.latest),B()},children:V(`updatePrompt.skip`)}),(0,U.jsx)(W,{onClick:B,children:V(`updatePrompt.later`)}),(0,U.jsx)(W,{variant:`filled`,autoFocus:!0,onClick:()=>{B(),XP.set(!0),xe(`update`)},children:V(`updatePrompt.yes`)})]})]})})}function hQ({model:e,task:t}){return(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col pt-2`,children:[(0,U.jsxs)(`div`,{className:wI,children:[(0,U.jsx)(`span`,{className:`text-warning`,children:V(`workspace.archived`)}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-subtle`,children:V(`workspace.archivedNote`)}),(0,U.jsx)(W,{variant:`filled`,onClick:()=>void kj(e,t),children:K(`tasks`,`menu.unarchive`)})]}),(0,U.jsx)(yR,{model:e,task:t,active:!0})]})}function gQ({model:e,taskId:t,groupId:n}){H();let r=b(e.tasks),i=r?ix(r.tasks,n):[];return i.length<2||!i.some(e=>e.id===t)?null:(0,U.jsxs)(`nav`,{className:Kx,"aria-label":V(`compare.menu`),children:[i.map((n,r)=>(0,U.jsxs)(W,{variant:`pill`,hit:`tight`,"aria-current":n.id===t,onClick:()=>e.select(n.id),children:[`[ `,(0,U.jsx)(U_,{status:n.rowStatus}),r+1,` `,n.engine?.name??n.label,n.kept&&(0,U.jsx)(`span`,{className:`text-accent`,children:`✓`}),` ]`]},n.id)),(0,U.jsx)(W,{hit:`tight`,className:`ml-auto flex-none whitespace-nowrap`,onClick:()=>Se(n),children:V(`compare.strip`)})]})}function _Q({model:e,taskId:t,fallback:n}){let[r,i]=(0,h.useState)(null),[a,o]=(0,h.useState)(!1);return(0,h.useEffect)(()=>{i(null),e.client.request(`inbox.message`,{id:t}).then(i,()=>i(`none`))},[e,t]),r===null?null:r===`none`?n:(0,U.jsx)(`div`,{className:CI,children:(0,U.jsx)(`div`,{className:TI,children:(0,U.jsxs)(`article`,{className:OI({flash:!1,current:!1}),children:[(0,U.jsxs)(`header`,{className:kI,children:[(0,U.jsx)(`span`,{className:AI(`user`),children:r.from}),(0,U.jsx)(`span`,{className:jI,children:new Date(r.at).toLocaleString()}),(0,U.jsx)(W,{className:`ml-auto`,disabled:a,onClick:()=>{o(!0),e.client.request(`inbox.toAgent`,{id:t}).catch(e=>{o(!1),z(G(e),`error`)})},children:V(`workspace.external.toAgent`)})]}),(0,U.jsx)(vL,{source:r.text})]})})})}var vQ=e=>NG(e)!==null,yQ=e=>cU(NG(e)?.tab.split);function bQ(e){let t=NG(e),n=t?.tab.split;return t&&n?{...t,split:n,leaf:AG(t.taskId,t.tab,n)}:null}$s(()=>[{id:`workspace.split.right`,chords:[`ctrl+\\`],prefix:!1,surface:`workspace`,live:vQ,run:e=>{let t=NG(e);t&&FG(e,t.taskId,t.tab,`right`)}},{id:`workspace.split.down`,chords:[`ctrl+=`],prefix:!1,surface:`workspace`,live:vQ,run:e=>{let t=NG(e);t&&FG(e,t.taskId,t.tab,`down`)}},{id:`workspace.split.focus-next`,chords:[`f3`],prefix:!1,surface:`workspace`,live:yQ,run:e=>{let t=bQ(e);t&&MG(t.taskId,t.tab,t.split,uU(t.split,t.leaf))}},{id:`workspace.split.close`,chords:[`w`],prefix:!0,surface:`workspace`,live:yQ,run:e=>{let t=bQ(e);t&&IG(e,t.taskId,t.tab,t.leaf)}},{id:`workspace.split.rename`,chords:[`f2`],prefix:!1,surface:`workspace`,live:yQ,run:e=>{let t=bQ(e);t&&LG(e,t.taskId,t.tab,t.leaf)}}]);var xQ=4e3,SQ=[{id:`leaf-1`,x:0,y:0,w:1,h:1,left:!1,top:!1}];function CQ({model:e,taskId:t,tab:n}){let r=n.split;b(kG);let i=r?AG(t,n,r):`leaf-1`,a=r?dU(r,Go(n)):new Map,o=cU(r),{prefs:s}=Rw(),c=b(e.tasks)?.tasks.find(e=>e.id===t)?.tabStatus?.[n.id]??n.status,l=n.kind===`engine`&&c?.reason===`dead`?c.since:null;(0,h.useEffect)(()=>{l!==null&&e.refreshTabsNow(t)},[l,e,t]),(0,h.useEffect)(()=>{if(!o)return;let n=window.setInterval(()=>{document.hidden||e.refreshTabsNow(t)},xQ);return()=>window.clearInterval(n)},[o,e,t]);let u=l!==null&&n.alive!==!1?{code:n.exit?.code??null,since:l}:null,d=n.kind===`engine`&&c?.reason===`rate_limited`?{since:c.since}:null;return(0,U.jsx)(`div`,{className:pn,children:(r?lU(r.root):SQ).map(c=>(0,U.jsxs)(`div`,{className:gn(o?s.splitStyle:null,{left:c.left,top:c.top,active:c.id===i}),style:{left:`calc(${c.x*100}% + var(--ml, 0px))`,top:`calc(${c.y*100}% + var(--mt, 0px))`,width:`calc(${c.w*100}% - var(--ml, 0px))`,height:`calc(${c.h*100}% - var(--mt, 0px))`},children:[(0,U.jsx)(zY,{client:e.client,model:e,engineExit:c.id===`leaf-1`?u:null,usageLimit:c.id===`leaf-1`?d:null,composer:n.kind===`engine`&&c.id===`leaf-1`,taskId:t,tabId:n.id,leafId:c.id,focused:c.id===i,onActivate:()=>r&&jG(t,n.id,r,c.id),onExit:()=>{o?PG(e,{taskId:t,tabId:n.id,action:`close`,leafId:c.id}):n.kind!==`engine`&&e.closeTab(t,n.id).catch(()=>{})}}),o&&(0,U.jsx)(`span`,{className:_n(s.splitStyle===`rule`,c.id===i),onContextMenu:r=>Tq(r,BG(e,t,n,c.id)),children:a.get(c.id)})]},c.id))})}var wQ=/^[0-9a-f]{7,40}$/i;function TQ(e,t){return t.sharesWorkspaceOf||!t.baseRef?null:e.find(e=>e.id!==t.id&&e.branch!==``&&e.branch===t.baseRef)||(wQ.test(t.baseRef)&&t.parentTaskId?e.find(e=>e.id===t.parentTaskId)??null:null)}var EQ=(e,t)=>(e.createdAt??``).localeCompare(t.createdAt??``),DQ=(e,t)=>e.filter(n=>!n.deleting&&TQ(e,n)?.id===t).sort(EQ);function OQ(e,t){let n=[];for(let r=TQ(e,t);r&&n.length<20&&!n.includes(r);r=TQ(e,r))n.unshift(r);let r=DQ(e,t.id);if(n.length===0&&r.length===0)return null;let i=n[n.length-1],a=i?DQ(e,i.id):[t];a.includes(t)||a.push(t);let o=n[0]??t;return{path:n,level:a,kids:r,base:o.baseRef&&!wQ.test(o.baseRef)?o.baseRef:null}}var kQ=e=>e.pr?.lifecycle===`merged`;function AQ(e,t){let n=e.level.find(e=>e.id===t),r=n?[...e.path,n]:e.path,[i,...a]=e.kids;return r.find(e=>!kQ(e))??(i&&a.length===0&&!kQ(i)?i:null)}var jQ=`min-h-11 flex-none cursor-pointer whitespace-nowrap font-sans text-meta`;function MQ(e){let t=t=>(0,U.jsxs)(`button`,{type:`button`,className:`${jQ} max-w-[20ch] truncate ${t.id===e.taskId?`text-ink`:`text-muted`}`,"aria-current":t.id===e.taskId,title:t.title,onClick:()=>e.onSelect(t.id),children:[t.label||t.title,kQ(t)&&(0,U.jsx)(`span`,{className:`text-accent`,children:` ✓`})]},t.id),n=(e,t)=>e.length===1?t(e[0]):(0,U.jsxs)(`span`,{className:`flex flex-none items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`text-subtle`,children:`{`}),e.map((e,n)=>(0,U.jsxs)(`span`,{className:`flex flex-none items-center gap-2`,children:[n>0&&(0,U.jsx)(`span`,{className:`text-subtle`,children:`|`}),t(e)]},e.id)),(0,U.jsx)(`span`,{className:`text-subtle`,children:`}`})]});return(0,U.jsxs)(`nav`,{className:`flex min-w-0 flex-none items-center gap-3 px-2 font-sans text-meta text-muted`,"aria-label":V(`compare.stackLabel`),children:[(0,U.jsxs)(`div`,{ref:e.scroller,className:`flex min-w-0 flex-1 items-center gap-2 overflow-x-auto scrollbar-none mask-r-from-[calc(100%-1.5rem)]`,children:[e.stack.base&&(0,U.jsxs)(`span`,{className:`flex-none text-subtle`,children:[e.stack.base,` ←`]}),e.stack.path.map(e=>(0,U.jsxs)(`span`,{className:`flex flex-none items-center gap-2`,children:[t(e),(0,U.jsx)(`span`,{className:`text-subtle`,children:`←`})]},e.id)),n(e.stack.level,r=>r.id===e.taskId&&e.stack.kids.length>0?(0,U.jsxs)(`span`,{className:`flex flex-none items-center gap-2`,children:[t(r),(0,U.jsx)(`span`,{className:`text-subtle`,children:`←`}),n(e.stack.kids,t)]},r.id):t(r)),(0,U.jsx)(`span`,{className:`w-4 flex-none`,"aria-hidden":`true`})]}),e.onLand&&(0,U.jsx)(`button`,{type:`button`,className:`${jQ} text-accent`,onClick:e.onLand,children:V(`compare.landBottomPhone`)})]})}function NQ({model:e,taskId:t}){H();let n=Oe(),r=b(e.tasks)?.tasks??[],i=r.find(e=>e.id===t),a=i?OQ(r,i):null,o=FQ(t,a!==null);if(!a)return null;let s=AQ(a,t),c=s&&!s.machine?()=>void xj(e,s):void 0,l=t=>e.select(t);if(n)return(0,U.jsx)(MQ,{stack:a,taskId:t,onSelect:l,onLand:c,scroller:o});let u=(e,n)=>(0,U.jsxs)(W,{variant:`pill`,hit:`tight`,"aria-current":e.id===t,title:e.title,onClick:()=>l(e.id),children:[n&&`[ `,(0,U.jsx)(U_,{status:e.rowStatus}),(0,U.jsx)(`span`,{className:`max-w-48 truncate`,children:e.label||e.title}),kQ(e)?(0,U.jsx)(`span`,{className:`text-accent`,children:`✓`}):e.pr?.number?(0,U.jsx)(`span`,{children:`PR`}):null,n&&`]`]},e.id),d=(e,n)=>e.id===t&&a.kids.length>0?(0,U.jsxs)(`span`,{className:`flex flex-none items-center gap-x-3.5`,children:[u(e,n),(0,U.jsx)(`span`,{className:`text-subtle`,children:`←`}),(0,U.jsx)(PQ,{nodes:a.kids,render:u})]},e.id):u(e,n);return(0,U.jsxs)(`nav`,{className:`flex min-w-0 items-center gap-x-3.5 px-2.5 py-1 font-mono text-meta`,"aria-label":V(`compare.stackLabel`),children:[(0,U.jsxs)(`div`,{ref:o,className:`flex min-w-0 flex-1 items-center gap-x-3.5 overflow-x-auto scrollbar-none`,children:[a.base&&(0,U.jsxs)(`span`,{className:`flex-none text-subtle`,children:[a.base,` ←`]}),a.path.map(e=>(0,U.jsxs)(`span`,{className:`flex flex-none items-center gap-x-3.5`,children:[d(e,!0),(0,U.jsx)(`span`,{className:`text-subtle`,children:`←`})]},e.id)),(0,U.jsx)(PQ,{nodes:a.level,render:d})]}),c&&(0,U.jsx)(W,{hit:`tight`,className:`flex-none whitespace-nowrap`,onClick:c,children:V(`compare.landBottom`)})]})}function PQ({nodes:e,render:t}){return e.length===1?t(e[0],!0):(0,U.jsxs)(`span`,{className:`flex flex-none items-center gap-x-2`,children:[(0,U.jsx)(`span`,{className:`text-subtle`,children:`{`}),e.map((e,n)=>(0,U.jsxs)(`span`,{className:`flex items-center gap-x-2`,children:[n>0&&(0,U.jsx)(`span`,{className:`text-subtle`,children:`|`}),t(e,!1)]},e.id)),(0,U.jsx)(`span`,{className:`text-subtle`,children:`}`})]})}function FQ(e,t){let n=(0,h.useRef)(null);return(0,h.useEffect)(()=>{n.current?.querySelector(`[aria-current="true"]`)?.scrollIntoView({block:`nearest`,inline:`nearest`})},[e,t]),n}function IQ(e,t){return e===`never`?!1:e!==`multipleOnly`||t>=2}function LQ({taskId:e}){H();let t=fw(e),n=pw(e);return(0,U.jsx)(`div`,{className:Er,children:LC.map(r=>{let i=n&&!!gC(t,r);return(0,U.jsx)(`button`,{type:`button`,className:dr({on:i}),title:V(`panel.${r}`),"aria-label":V(`panel.${r}`),"aria-pressed":i,onClick:()=>vw(e,r),children:(0,U.jsx)(rW,{children:iW[r]})},r)})})}function RQ({model:e,task:t,tabs:n,narrow:r}){let i=b(e.selection),{prefs:a}=Rw(),o=b(cQ),s=GR(),c=vz(),l=!IQ(a.tabStrip,n.length),u=(0,U.jsxs)(`div`,{className:pr,role:`tablist`,children:[n.map((n,r)=>(0,U.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":n.id===i.tabId,className:`group/tab flex items-center gap-1.5 whitespace-nowrap rounded-sm px-2.5 py-1 active:scale-97 motion-reduce:active:scale-none touch:select-none touch:touch-callout-none ${l?`hidden`:``} ${n.id===i.tabId?`bg-inset text-ink`:`text-muted hover:bg-hover data-menu-open:bg-hover`}`,onClick:()=>e.select(t.id,n.id),onContextMenu:r=>Tq(r,E(nK(e,t,n),V(`menu.more`))),children:[(0,U.jsx)(`span`,{className:`text-subtle group-aria-selected/tab:text-accent`,children:r+1}),Go(n)]},n.id)),!r&&(0,U.jsx)(LQ,{taskId:t.id})]});return(0,U.jsx)(wG,{slot:`session.header`,data:zQ(e,t,n,i.tabId,s?.manifest,c,r,o),fallback:u})}function zQ(e,t,n,r,i,a,o,s){let c=n.find(e=>e.id===r);return{taskId:t.id,title:t.label,branch:t.branch||void 0,repo:t.repo?t.repo.split(`/`).pop():void 0,worktree:cG(t),engineId:t.engine?.id??void 0,engineName:t.engine?.name,model:t.model,engineFamily:t.engine?.protocol,engineColor:nG(i,t.engine,a),statusKind:t.rowStatus?.kind??`idle`,tabs:n.map(e=>({id:e.id,label:Go(e),active:e.id===r})),activeTab:c?Go(c):void 0,tabCount:n.length,onSelectTab:n=>e.select(t.id,n),narrow:o,packageView:s,onPackageView:lQ,view:o?RC.get():`terminal`,onShowView:e=>{if(MW.includes(e)){if(!o)return e===`terminal`?void 0:_w(t.id,e);cQ.set(null),PW(t.id,r,e)}}}}function BQ(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??e))}function VQ({model:e}){let t=H()===`zh`?Ra:La,n=e.client,[r,i]=(0,h.useState)(()=>(J(n,`worktrees.list`,{network:!0})??J(n,`worktrees.list`,{network:!1}))?.projects??null),[a,o]=(0,h.useState)([]),[s,c]=(0,h.useState)(null),[l,u]=(0,h.useState)(0),[d,f]=(0,h.useState)(0),p=(0,h.useRef)(null);(0,h.useEffect)(()=>{let e=!0,t=n.onOpen(()=>{let t=!1,r=r=>ss(n,`worktrees.list`,{network:r}).then(n=>{if(!(!e||!r&&t)&&(r&&(t=!0),c(null),i(n.projects),r)){let e=new Set(n.projects.flatMap(e=>e.worktrees.map(e=>e.path)));o(t=>t.filter(t=>e.has(t)))}}).catch(t=>{e&&c(Pu(t))});r(!1),r(!0)});return()=>{e=!1,t()}},[n,d]),(0,h.useEffect)(()=>p.current?.focus(),[]);let m=(r??[]).map(e=>({...e,worktrees:e.worktrees.filter(e=>!a.includes(e.path))})),g=m.flatMap(e=>e.worktrees),_=Math.min(l,Math.max(0,g.length-1));(0,h.useEffect)(()=>{p.current?.querySelector(`[data-row="${_}"]`)?.scrollIntoView({block:`nearest`})},[_]);let v=(0,h.useCallback)(()=>f(e=>e+1),[]),y=async(e,r)=>{o(t=>[...t,e.path]);try{let i=await n.request(`worktrees.remove`,{path:e.path,force:r});i.residue&&z(BQ(t.delete.residue,i.residue)),v()}catch(n){o(t=>t.filter(t=>t!==e.path));let i=n&&typeof n==`object`&&`code`in n?n.code:null;if(!r&&i===`DIRTY_WORKTREE`){k.set((0,U.jsx)(sa,{title:t.delete.forceTitle,body:`${BQ(t.delete.forceBody,{branch:e.branch||e.path})}\n\n${BQ(t.delete.forceReason,{reason:G(n)})}`,confirmLabel:t.delete.button,onConfirm:()=>y(e,!0)}));return}z(BQ(t.delete.failed,{error:G(n)}),`error`)}},b=e=>k.set((0,U.jsx)(sa,{title:t.delete.confirmTitle,body:BQ(t.delete.confirmBody,{branch:e.branch||e.path}),confirmLabel:t.delete.button,onConfirm:async()=>{y(e,!1)}})),x=n=>{if(!n.taskId){z(t.land.noTask,`error`);return}xj(e,{id:n.taskId,title:n.branch,branch:n.branch},v)},S=e=>{if(e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.toLowerCase()===`c`&&!window.getSelection()?.toString())return e.preventDefault(),M.set(null);if(e.metaKey||e.ctrlKey||e.altKey)return;let t=g[_];if(e.key===`j`||e.key===`ArrowDown`)u(Math.min(g.length-1,_+1));else if(e.key===`k`||e.key===`ArrowUp`)u(Math.max(0,_-1));else if(e.key===`d`&&t)b(t);else if(e.key===`l`&&t)x(t);else if(e.key===`q`||e.key===`Escape`)M.set(null);else return;e.preventDefault()},C=0;return(0,U.jsxs)(`div`,{className:Ww,tabIndex:0,ref:p,onKeyDown:S,children:[(0,U.jsx)(`h1`,{className:Gw,children:t.title}),s!==null&&(0,U.jsxs)(`p`,{className:`flex flex-wrap items-baseline gap-3 text-error`,children:[BQ(t.loadFailed,{message:s}),(0,U.jsx)(W,{onClick:v,children:V(`workspace.retry`)})]}),r===null?s===null&&(0,U.jsx)(`p`,{className:`text-muted`,children:t.loading}):m.length===0?(0,U.jsx)(`p`,{className:`text-muted`,children:t.noProjects}):m.map(e=>{let n=C;return C+=e.worktrees.length,(0,U.jsxs)(`section`,{className:FP,children:[(0,U.jsxs)(`h2`,{className:`mt-1.5 mr-2 mb-1 ml-0 flex items-center gap-1 font-mono text-meta font-semibold normal-nums text-subtle`,children:[(0,U.jsx)(`span`,{children:e.repo}),(0,U.jsx)(`span`,{className:`rule`})]}),e.worktrees.length===0&&(0,U.jsx)(`p`,{className:`mono text-muted`,children:t.noWorktrees}),e.worktrees.map((e,r)=>{let i=n+r;return(0,U.jsxs)(`div`,{"data-row":i,className:IP(i===_),onClick:()=>u(i),children:[(0,U.jsxs)(`div`,{className:LP,children:[(0,U.jsx)(`span`,{className:zP,children:e.branch||t.row.detached}),e.roveManaged&&(0,U.jsx)(`span`,{className:`chip text-muted`,children:t.badge.roveManaged}),e.dirty===!0&&(0,U.jsx)(`span`,{className:`chip text-warning`,children:t.badge.dirty}),e.dirty===null&&(0,U.jsx)(`span`,{className:`chip text-muted`,children:t.badge.dirtyUnknown}),(0,U.jsx)(`span`,{className:`chip ${e.branchOnRemote===!0?`text-success`:e.branchOnRemote===!1?`text-warning`:`text-muted`}`,children:e.branchOnRemote===!0?t.badge.remoteOn:e.branchOnRemote===!1?t.badge.remoteOff:t.badge.remoteUnknown}),e.verdictReason!==`dirty`&&e.verdictReason!==`fresh`&&(0,U.jsx)(`span`,{className:`chip ${e.verdict===`merged`?`text-success`:e.verdict===`stale`?`text-warning`:`text-accent`}`,children:t.verdict[e.verdictReason]??e.verdictReason})]}),(0,U.jsxs)(`div`,{className:`${RP} mono text-muted`,children:[(0,U.jsx)(`span`,{className:BP,children:e.path}),e.createdAtMs>0&&(0,U.jsx)(`span`,{children:BQ(t.row.created,{age:_c(Date.now()-e.createdAtMs)})})]}),i===_&&(0,U.jsxs)(`div`,{className:`flex items-baseline gap-2 text-[length:var(--fs-body)]`,children:[(0,U.jsx)(`button`,{type:`button`,className:`link text-accent hover:underline touch-hit`,onClick:()=>b(e),children:t.delete.button}),e.taskId&&(0,U.jsx)(`button`,{type:`button`,className:`link text-accent hover:underline touch-hit`,onClick:()=>x(e),children:t.land.button})]})]},e.path)})]},e.repo)}),(0,U.jsx)(`p`,{className:`${VP} mono keys-only text-muted`,children:(0,U.jsx)(ju,{text:`j/k · d ${t.delete.button} · l ${t.land.button} · q/esc`})})]})}function HQ({model:e,narrow:t}){let n=b(e.selection),r=b(e.tabs),i=b(e.tasks),a=b(e.remote),o=a.find(e=>e.id===n.taskId&&!e.machine?.stale),s=_s(i,n.taskId)??o??null,c=o?void 0:a.find(e=>e.id===n.taskId),l=s?r[s.id]??[]:[],u=s?s.id in r:!1,d=b(M),f=bz(s?.id),p=s?.rowStatus?.kind===`running`,m=b(I),g=GR(),_=vz(),v=t?``:tz(g?.manifest.layout?.frame),y=b(RC),x=b(cQ),S=(0,h.useContext)(gq),C=vq(`package.view`),w=y!==`terminal`&&t&&!!s,T=l.find(e=>e.id===n.tabId);if((0,h.useEffect)(()=>{let t=e.selection.get();return VC(t.taskId,t.tabId),e.selection.subscribe(()=>{M.set(null),I.set(null);let n=e.selection.get();n.taskId!==t.taskId&&AR.get().activePack?.manifest.slots?.[`package.view`]&&cQ.set(null),(n.taskId!==t.taskId||n.tabId!==t.tabId)&&VC(n.taskId,n.tabId),t=n})},[e]),(0,h.useEffect)(()=>tW(e),[e]),d===`worktrees`)return(0,U.jsxs)(`main`,{"data-tp-region":`workspace`,className:`${Hn} ${ln}`,children:[t&&(0,U.jsx)(_q,{slot:`phone.sessionHeader`,fallback:(0,U.jsx)(FW,{client:e.client})}),(0,U.jsx)(VQ,{model:e})]});if(d)return(0,U.jsxs)(`main`,{"data-tp-region":`workspace`,className:`${Hn} ${ln}`,children:[t&&(0,U.jsx)(_q,{slot:`phone.sessionHeader`,fallback:(0,U.jsx)(FW,{client:e.client})}),(0,U.jsx)(PJ,{model:e,page:d})]});if(S&&x!==null&&C)return(0,U.jsxs)(`main`,{"data-tp-region":`workspace`,className:`${Hn} ${ln}`,children:[t&&(0,U.jsx)(_q,{slot:`phone.sessionHeader`,fallback:(0,U.jsx)(FW,{client:e.client})}),(0,U.jsx)(wG,{slot:`package.view`,data:{...S,narrow:t,onShowView:e=>{!s||!MW.includes(e)||(cQ.set(null),t?PW(s.id,n.tabId,e):e!==`terminal`&&_w(s.id,e))}},fallback:null})]});if(m)return(0,U.jsxs)(`main`,{"data-tp-region":`workspace`,className:`${Hn} ${ln}`,children:[t&&(0,U.jsx)(_q,{slot:`phone.sessionHeader`,fallback:(0,U.jsx)(FW,{client:e.client})}),(0,U.jsx)(`div`,{className:Un,children:(0,U.jsx)(Zb,{model:e,seed:m},ay(m))})]});if(s?.archived)return(0,U.jsxs)(`main`,{"data-tp-region":`workspace`,className:`${Hn} ${ln}`,children:[t&&(0,U.jsx)(_q,{slot:`phone.sessionHeader`,fallback:(0,U.jsx)(FW,{client:e.client,title:s.title})}),(0,U.jsx)(`div`,{className:Un,children:(0,U.jsx)(hQ,{model:e,task:s})})]});let E=t=>(0,U.jsxs)(`div`,{className:Vn,children:[(0,U.jsx)(`p`,{children:V(`workspace.noTabs`)}),(0,U.jsx)(W,{variant:`filled`,onClick:()=>void Ny(e,t.id,{kind:`engine`}).catch(e=>z(String(e),`error`)),children:t.engine?V(`workspace.startEngine`,{engine:t.engine.name}):V(`workspace.startSession`)}),` `,(0,U.jsx)(W,{variant:`filled`,onClick:()=>void My(e,t.id),children:V(`menu.newChat`)}),` `,(0,U.jsx)(W,{variant:`filled`,onClick:()=>k.set((0,U.jsx)(wA,{model:e,taskId:t.id})),children:V(`menu.newChatPick`)})]}),D=s?{...zQ(e,s,l,n.tabId,g?.manifest,_,t,x),onSend:t=>void e.client.request(`tab.send`,{...e.engineTarget(s.id),prompt:t}).catch(e=>z(String(e),`error`))}:null;return(0,U.jsxs)(`main`,{"data-tp-region":`workspace`,className:`${Hn} ${ln} ${v}`,children:[t&&(0,U.jsx)(_q,{slot:`phone.sessionHeader`,fallback:(0,U.jsx)(FW,{client:e.client,taskId:s?.id,tabId:n.tabId,title:s?.title})}),s&&(0,U.jsx)(RQ,{model:e,task:s,tabs:l,narrow:t}),s&&!s.groupId&&(0,U.jsx)(NQ,{model:e,taskId:s.id}),s?.groupId&&(0,U.jsx)(gQ,{model:e,taskId:s.id,groupId:s.groupId}),(e=>D&&!w?(0,U.jsx)(wG,{slot:`session.body`,data:D,fallback:e}):e)((0,U.jsxs)(`div`,{className:`${Un} ${p?Wn:``}`,style:f?{"--task-ink":f}:void 0,children:[!t&&!s&&!c&&i&&i.tasks.length+a.length===0&&(0,U.jsx)(wq,{model:e}),!s&&!c&&i&&i.tasks.length+a.length>0&&(0,U.jsx)(`p`,{className:Bn,children:V(`workspace.pickTask`)}),c?.machine&&(0,U.jsx)(`div`,{className:Vn,children:(0,U.jsx)(Sg,{host:c.machine.label,onMachines:()=>GA(e)})}),s&&u&&l.length===0&&!w&&s.connector!==`inbox`&&E(s),s&&u&&l.length===0&&!w&&s.connector===`inbox`&&(0,U.jsx)(_Q,{model:e,taskId:s.id,fallback:E(s)}),s&&w&&(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,U.jsx)(sQ,{model:e,task:s,narrow:!0}),y===`chat`&&T?.kind===`engine`&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(nI,{model:e,taskId:s.id,tabId:T.id}),(0,U.jsx)(jY,{to:t=>void e.client.request(`term.input`,{stream:Bc(s.id,T.id),data:t}).catch(e=>z(String(e),`error`)),atMenu:s.tabStatus?.[T.id]?.kind===`needs-input`})]})]}),s&&n.tabId&&l.some(e=>e.id===n.tabId)&&(0,U.jsx)(`div`,{className:`min-w-0 flex-1 ${w?`hidden`:`flex`}`,children:(0,U.jsx)(CQ,{model:e,taskId:s.id,tab:l.find(e=>e.id===n.tabId)??l[0]},`${s.id}::${n.tabId}`)})]})),D&&(0,U.jsx)(wG,{slot:`session.footer`,data:D,fallback:null})]})}function UQ({model:e}){H();let t=b(e.client.conn);return t.hello===null&&t.failures>=2?(0,U.jsx)(WQ,{}):(0,U.jsx)(ZW,{children:(0,U.jsx)(GQ,{model:e})})}function WQ(){let[e,t]=(0,h.useState)(null);return(0,h.useEffect)(()=>{Ku().then(t)},[]),e===null?null:e?(0,U.jsx)(Zu,{}):(0,U.jsx)($r,{failing:!0})}function GQ({model:e}){OU(e);let t=b(e.client.conn).hello;(0,h.useEffect)(()=>{if(!t)return;lF(e.client,t.roveVersion);let n=()=>void eF(e.client).then(pQ);n();let r=window.setInterval(n,36e5);return()=>window.clearInterval(r)},[t,e.client]),(0,h.useEffect)(()=>{t&&Uu(e)},[t,e]),ZJ(e),JJ(e),hc(),Hs(e.client),$J(e),Wa(e.client),mV(e.client),(0,h.useEffect)(()=>{e.onSelect=ye;let t=I.subscribe(()=>{I.get()!==null&&ye()});return R(),t},[e]),(0,h.useEffect)(()=>cH(e),[e]);let n=b(e.selection),r=b(e.tasks),i=b(e.remote),a=Oe(),o=b(yW),s=b(bW),c=b(vW),l=b(ge),u=b(Pe)===`app`,d=b(GC),f=b(qC),p=b(M),m=b(de)===`drag`,g=b(I)!==null,_=i.find(e=>e.id===n.taskId&&!e.machine?.stale),v=_s(r,n.taskId)??_??null,y=_?void 0:i.find(e=>e.id===n.taskId),x=pw(v?.id??null),S=fw(v?.id??``).columns.length,C=b(cQ),w=vq(`package.view`)&&C!==null,T=a?ke(l,!!v||!!y,p!==null||g||w):null;(0,h.useEffect)(()=>e.setTaskShown(T===null||T===`content`&&p===null&&!g),[e,T,p,g]);let E=GR(),D=E?.manifest.layout?.frame,O=E?.manifest.layout?.railWidth,A=E?.manifest.slots?.[`panel.frame`]?.component!==void 0&&!!v,j=A?E?.manifest.layout?.panelWidth:void 0,{prefs:ee}=Rw(),te=fq(r?.tasks??[]),ne=vq(`phone.tabs`)&&a;(0,h.useEffect)(()=>cQ.set(null),[E?.id]);let N=MJ(e),P=wW(c??O??280),re=d??j??null,ie=re===null?null:JC(re,o?0:P),F=Math.max(1,S),ae=`max(280px, min(calc((100% - var(--rail-w)) * ${F} / ${F+2}), calc(100% - var(--rail-w) - 320px)))`,L={"--rail-w":`${o?0:P}px`,"--rail-open-w":`${o?wW(280):P}px`,"--panel-w":ie===null?ae:`${ie}px`},oe=(0,U.jsxs)(`div`,{className:`${sn({panel:(x||A)&&(!!v||!!y)&&!a,expanded:f&&(x||A)&&!a,surface:T&&u?`back`:T,folded:o&&!a,peek:o&&s&&!a,dragging:m})} ${a?``:ez(D)}`,style:a?void 0:L,children:[!a&&(0,U.jsx)(AW,{model:e,hidden:!!E?.manifest.slots?.[`shell.topBar`]?.component}),o&&!a&&(0,U.jsx)(`div`,{className:`absolute inset-y-0 left-0 z-5 col-1 row-1 w-2.5`,title:V(`layout.railUnfold`),onMouseEnter:()=>CW(!0),onMouseLeave:()=>CW(!1),onMouseUp:()=>yW.set(!1)}),(0,U.jsx)(Eq,{model:e,narrow:a}),(0,U.jsx)(HQ,{model:e,narrow:a}),T&&!ne&&(0,U.jsx)(tu,{show:T===`sidebar`?`list`:`page`}),!a&&(0,U.jsx)(sQ,{model:e,task:v,remoteHost:y?.machine?.label}),(0,U.jsx)(UK,{model:e,narrow:a}),(0,U.jsx)(rx,{}),(0,U.jsx)(NU,{model:e}),(0,U.jsx)(xs,{model:e})]}),se=yF(ee.themeMode,matchMedia(`(prefers-color-scheme: dark)`).matches),ce={...te,taskCount:(r?.tasks.length??0)+i.length,selectedId:v?.id,selectedTitle:v?.label??``,railFolded:o&&!a,onToggleRail:()=>yW.set(!o),mode:se,onSetMode:t=>void Iw(e.client,`themeMode`,t),unreadCount:r?.attention.filter(e=>e.unread).length??0,pages:N,onNewSession:()=>Xb(),onOpenSettings:()=>k.set((0,U.jsx)(oU,{model:e})),onOpenInbox:()=>k.set((0,U.jsx)(Mu,{model:e})),packageView:C,onPackageView:lQ},z=b(RC),le=a?{...ce,pane:T===`sidebar`?`list`:p!==null||g?`page`:w?`view`:`session`,title:N.find(e=>e.active)?.label??(p===null&&!g?v?.label??``:``),onShowList:be,onShowSession:()=>{M.set(null),I.set(null),v&&ye()},views:MW.map(e=>({kind:e,title:NW(e)})),view:z,onShowView:e=>{!v||!MW.includes(e)||(cQ.set(null),PW(v.id,n.tabId,e),ye())}}:null;return(0,U.jsx)(EG,{model:e,children:(0,U.jsx)(gq,{value:ce,children:(0,U.jsx)(hq,{value:le,children:(0,U.jsxs)(`div`,{className:on,children:[(0,U.jsx)($W,{client:e.client,onOpenSettings:()=>k.set((0,U.jsx)(oU,{model:e,section:`appearance`}))}),!a&&(0,U.jsx)(wG,{slot:`shell.topBar`,data:ce,fallback:null}),(0,U.jsx)(_q,{slot:`phone.topBar`,fallback:null}),(0,U.jsx)(wG,{slot:`shell.frame`,data:{...ce,panelOpen:(x||A)&&!a,narrow:a},fallback:oe}),ne&&(0,U.jsx)(_q,{slot:`phone.tabs`,fallback:null})]})})})})}var KQ=`rove.crashLog`,qQ=4e3;function JQ(){try{let e=JSON.parse(localStorage.getItem(KQ)??`[]`);return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}catch{return[]}}function YQ(e){if(e instanceof Error)return`${e.message}\n${e.stack??``}`;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function XQ(e,...t){let n=`${new Date().toISOString()} [${e}] ${t.map(YQ).join(` `)}`.slice(0,qQ);try{localStorage.setItem(KQ,JSON.stringify([...JQ(),n].slice(-100)))}catch{}}function ZQ(){return JQ().join(`
111
+ `)}function QQ(){let e=console.error.bind(console);console.error=(...t)=>{XQ(`error`,...t),e(...t)},window.addEventListener(`error`,e=>XQ(`uncaught`,e.error??e.message)),window.addEventListener(`unhandledrejection`,e=>XQ(`rejection`,e.reason)),document.addEventListener(`webglcontextlost`,()=>XQ(`webgl`,`context lost`),!0)}var $Q=class extends h.Component{state={error:null,componentStack:``};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.setState({componentStack:t.componentStack??``})}render(){let{error:e,componentStack:t}=this.state;if(!e)return this.props.children;let n=[`${e.message}\n${e.stack??``}`,t,ZQ()].filter(Boolean).join(`
112
112
 
113
- `);return(0,U.jsx)(ZQ,{report:n})}};function ZQ({report:e}){let[t,n]=(0,h.useState)(!1);return(0,U.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-3 bg-surface p-4 text-ink`,children:[(0,U.jsx)(`p`,{className:`font-sans text-title`,children:V(`crash.title`)}),(0,U.jsxs)(`div`,{className:`flex gap-4`,children:[(0,U.jsx)(W,{variant:`filled`,onClick:()=>void navigator.clipboard.writeText(e).then(()=>n(!0),()=>n(!1)),children:V(t?`crash.copied`:`crash.copy`)}),(0,U.jsx)(W,{variant:`action`,onClick:()=>location.reload(),children:V(`crash.reload`)})]}),(0,U.jsx)(`pre`,{className:`min-h-0 flex-1 select-text overflow-auto whitespace-pre-wrap break-all font-mono text-meta text-muted`,children:e})]})}var QQ=`a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`;function $Q(e){return[...e.querySelectorAll(QQ)].filter(e=>e.tabIndex>=0&&e.offsetParent!==null)}function e$(){window.addEventListener(`keydown`,e=>{if(e.key!==`Tab`||e.defaultPrevented||e.ctrlKey||e.metaKey||e.altKey)return;let t=[...document.querySelectorAll(`.overlay:not(.is-leaving)`)].at(-1);if(!t)return;let n=$Q(t);if(n.length===0)return;let r=document.activeElement,i=r instanceof HTMLElement&&t.contains(r),a=e.shiftKey?n.filter(e=>i&&!!(r.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)).at(-1)??n.at(-1):n.find(e=>i&&!!(r.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING))??n[0];e.preventDefault(),a?.focus()})}function t$(e){if(!le())for(let t of document.querySelectorAll(`${e}:not(.is-leaving)`)){let e=t.cloneNode(!0);e.classList.add(`is-leaving`),e.inert=!0,e.setAttribute(`aria-hidden`,`true`),document.body.append(e);let n=t.querySelectorAll(`*`),r=e.querySelectorAll(`*`);n.forEach((e,t)=>{let n=r[t];e.scrollTop&&(n.scrollTop=e.scrollTop),(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&(n.value=e.value)}),window.setTimeout(()=>e.remove(),200)}}function n$(e){for(let t of document.querySelectorAll(`${e}.is-leaving`))t.remove()}function r$(){for(let e of document.querySelectorAll(`.overlay:not(.is-leaving)`))for(let t of e.getAnimations())t instanceof CSSAnimation&&t.animationName===`fade-in`&&t.finish()}function i$(){let e=k.get(),t=-1/0;k.subscribe(()=>{let n=k.get();if(n===null&&e!==null)t=performance.now(),t$(`.overlay`);else if(n!==null){let n=e!==null||performance.now()-t<140;n$(`.overlay`),n&&requestAnimationFrame(r$)}e=n});let n=O.get();O.subscribe(()=>{let e=O.get();e===null&&n!==null?t$(`.menu`):e!==null&&n$(`.menu`),n=e});let r=hA.get().guide;hA.subscribe(()=>{let e=hA.get().guide;e===null&&r!==null?t$(`.prefix-guide`):e!==null&&n$(`.prefix-guide`),r=e})}var a$=500,o$=10,s$=`input, textarea, select, [contenteditable], .xterm`,c$=[`mousedown`,`mouseup`,`click`,`contextmenu`];function l$(){let e=null,t=()=>{e&&window.clearTimeout(e.timer),e=null},n=()=>{let e=e=>{e.preventDefault(),e.stopPropagation()},t=()=>{for(let t of c$)document.removeEventListener(t,e,!0);document.removeEventListener(`pointerdown`,t,!0),document.removeEventListener(`keydown`,t,!0)};for(let t of c$)document.addEventListener(t,e,!0);document.addEventListener(`pointerdown`,t,!0),document.addEventListener(`keydown`,t,!0)};document.addEventListener(`pointerdown`,r=>{if(t(),r.pointerType!==`touch`||!(r.target instanceof Element)||r.target.closest(s$))return;let i=r.target,a={x:r.clientX,y:r.clientY,native:!1,timer:window.setTimeout(()=>{e=null,!(a.native||!i.isConnected)&&(i.dispatchEvent(new MouseEvent(`contextmenu`,{bubbles:!0,cancelable:!0,clientX:a.x,clientY:a.y,button:2})),n())},a$)};e=a},!0),document.addEventListener(`pointermove`,n=>{e&&Math.hypot(n.clientX-e.x,n.clientY-e.y)>o$&&t()},!0),document.addEventListener(`pointerup`,t,!0),document.addEventListener(`pointercancel`,t,!0),document.addEventListener(`contextmenu`,t=>{e&&t.isTrusted&&(e.native=!0)},!0)}function u$(e,t){e.viewingExtras=()=>PC({narrow:Ee(),panelOpen:mw(e.selection.get().taskId)});let n=()=>e.reportViewing();KC.subscribe(n),hw(n),I.subscribe(n),M.subscribe(n),De(n),t.on(`panel`,t=>{NC(t)&&Dw(t,e.selection.get().taskId)});let r=rC();if(r){let t=t=>{let n=t.taskId??e.selection.get().taskId;!n||!t.url||Ew({taskId:n,desktopTabId:t.id,panelKey:t.panelKey,url:t.url})};r.onHandoff(e=>{e.owner===`human`&&t(e)}),r.onFocus(e=>t(e))}}function d$(e){let t=e;return!!t&&typeof t.promptId==`string`&&typeof t.title==`string`}function f$({client:e,prompt:t}){let n=(H()===`zh`?fa:da).prompt,[r,i]=(0,h.useState)(t.initial??``),a=(0,h.useRef)(!1),{busy:o,error:s,submit:c}=aa();return(0,h.useEffect)(()=>()=>{a.current||e.request(`ui.promptReply`,{promptId:t.promptId}).catch(()=>{})},[e,t.promptId]),(0,U.jsx)(ia,{title:t.title,children:(0,U.jsxs)(`form`,{className:hi,onSubmit:n=>{n.preventDefault(),c(async()=>{await e.request(`ui.promptReply`,{promptId:t.promptId,value:r}),a.current=!0})},children:[(0,U.jsx)(`input`,{className:Zr,"aria-label":n.fieldLabel,autoFocus:!0,spellCheck:!1,value:r,placeholder:t.placeholder,onChange:e=>i(e.target.value)}),s&&(0,U.jsx)(`p`,{className:`text-error`,children:s}),(0,U.jsx)(la,{busy:o,submitLabel:n.submitLabel})]})})}function p$(e,t){k.get()||k.set((0,U.jsx)(f$,{client:e,prompt:t},t.promptId))}var m$=900,h$=new WeakMap;function g$(e){e.setAttribute(`data-scrolling`,``),window.clearTimeout(h$.get(e)),h$.set(e,window.setTimeout(()=>e.removeAttribute(`data-scrolling`),m$))}function _$(){document.addEventListener(`scroll`,e=>{let t=e.target instanceof Element?e.target:document.scrollingElement;t&&g$(t)},{capture:!0,passive:!0})}var v$=`rove-web.reloadedFor`;function y$(e,t,n){return e===null?`adopt`:t===e||t===n?`stay`:`reload`}function b$(){let e=null;try{e=window.sessionStorage}catch{}return{storage:e,reload:()=>window.location.reload()}}function x$(e,t=b$()){let n=null,r=null,i=()=>{try{return t.storage?.getItem(v$)??r}catch{return r}};return e.conn.subscribe(()=>{let{state:a,hello:o}=e.conn.get();if(a!==`open`||!o)return;let s=y$(n,o.roveVersion,i());if(s===`adopt`&&(n=o.roveVersion),s===`reload`){r=o.roveVersion;try{t.storage?.setItem(v$,o.roveVersion)}catch{}t.reload()}})}function S$(){let e=window.visualViewport;if(!e)return;let t=document.documentElement,n=window.matchMedia(`(pointer: coarse)`),r=0,i=0,a=()=>{let a=e.height*e.scale;window.innerWidth!==i&&(i=window.innerWidth,r=0),r=n.matches?Math.max(r,a,window.innerHeight):window.innerHeight;let o=r-a>120,s=o===t.hasAttribute(`data-keyboard`)?null:document.querySelector(`.overlay:not(.is-leaving) .dialog`),c=s?.getBoundingClientRect().top;if(t.style.setProperty(`--vvh`,`${a}px`),t.toggleAttribute(`data-keyboard`,o),s&&c!==void 0&&!window.matchMedia(`(prefers-reduced-motion: reduce)`).matches){let e=c-s.getBoundingClientRect().top;e&&s.animate({translate:[`0 ${e}px`,`0 0`]},{duration:240,easing:`cubic-bezier(0.2, 0, 0, 1)`})}e.scale===1&&window.scrollY!==0&&window.scrollTo(0,0)};e.addEventListener(`resize`,a),e.addEventListener(`scroll`,a),window.addEventListener(`scroll`,a,{passive:!0}),a()}YQ();var C$=(0,g.createRoot)(document.getElementById(`root`));S$(),l$(),Be(),_$(),i$(),e$(),Bh();var w$=e=>C$.render((0,U.jsx)(h.StrictMode,{children:(0,U.jsx)(XQ,{children:e})}));function T$(e){let t=new Rc(zc(),e),n=new ys(t);t.on(`prompt`,e=>{d$(e)&&p$(t,e)}),u$(n,t),x$(t),t.start(),w$((0,U.jsx)(BQ,{model:n}))}var E$=i();E$?T$(E$):Promise.all([qu(),Ku()]).then(([e,t])=>{e?T$(``):w$(t?(0,U.jsx)(Zu,{}):(0,U.jsx)($r,{}))});export{re as C,Xn as S,Sl as _,yY as a,Pc as b,lY as c,RF as d,LF as f,Cl as g,bl as h,CY as i,cY as l,xl as m,SY as n,_Y as o,jw as p,vY as r,dY as s,g$ as t,sY as u,Wc as v,de as w,Jn as x,Bc as y};
113
+ `);return(0,U.jsx)(e$,{report:n})}};function e$({report:e}){let[t,n]=(0,h.useState)(!1);return(0,U.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-3 bg-surface p-4 text-ink`,children:[(0,U.jsx)(`p`,{className:`font-sans text-title`,children:V(`crash.title`)}),(0,U.jsxs)(`div`,{className:`flex gap-4`,children:[(0,U.jsx)(W,{variant:`filled`,onClick:()=>void navigator.clipboard.writeText(e).then(()=>n(!0),()=>n(!1)),children:V(t?`crash.copied`:`crash.copy`)}),(0,U.jsx)(W,{variant:`action`,onClick:()=>location.reload(),children:V(`crash.reload`)})]}),(0,U.jsx)(`pre`,{className:`min-h-0 flex-1 select-text overflow-auto whitespace-pre-wrap break-all font-mono text-meta text-muted`,children:e})]})}var t$=`a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`;function n$(e){return[...e.querySelectorAll(t$)].filter(e=>e.tabIndex>=0&&e.offsetParent!==null)}function r$(){window.addEventListener(`keydown`,e=>{if(e.key!==`Tab`||e.defaultPrevented||e.ctrlKey||e.metaKey||e.altKey)return;let t=[...document.querySelectorAll(`.overlay:not(.is-leaving)`)].at(-1);if(!t)return;let n=n$(t);if(n.length===0)return;let r=document.activeElement,i=r instanceof HTMLElement&&t.contains(r),a=e.shiftKey?n.filter(e=>i&&!!(r.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)).at(-1)??n.at(-1):n.find(e=>i&&!!(r.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING))??n[0];e.preventDefault(),a?.focus()})}function i$(e){if(!le())for(let t of document.querySelectorAll(`${e}:not(.is-leaving)`)){let e=t.cloneNode(!0);e.classList.add(`is-leaving`),e.inert=!0,e.setAttribute(`aria-hidden`,`true`),document.body.append(e);let n=t.querySelectorAll(`*`),r=e.querySelectorAll(`*`);n.forEach((e,t)=>{let n=r[t];e.scrollTop&&(n.scrollTop=e.scrollTop),(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&(n.value=e.value)}),window.setTimeout(()=>e.remove(),200)}}function a$(e){for(let t of document.querySelectorAll(`${e}.is-leaving`))t.remove()}function o$(){for(let e of document.querySelectorAll(`.overlay:not(.is-leaving)`))for(let t of e.getAnimations())t instanceof CSSAnimation&&t.animationName===`fade-in`&&t.finish()}function s$(){let e=k.get(),t=-1/0;k.subscribe(()=>{let n=k.get();if(n===null&&e!==null)t=performance.now(),i$(`.overlay`);else if(n!==null){let n=e!==null||performance.now()-t<140;a$(`.overlay`),n&&requestAnimationFrame(o$)}e=n});let n=O.get();O.subscribe(()=>{let e=O.get();e===null&&n!==null?i$(`.menu`):e!==null&&a$(`.menu`),n=e});let r=gA.get().guide;gA.subscribe(()=>{let e=gA.get().guide;e===null&&r!==null?i$(`.prefix-guide`):e!==null&&a$(`.prefix-guide`),r=e})}var c$=500,l$=10,u$=`input, textarea, select, [contenteditable], .xterm`,d$=[`mousedown`,`mouseup`,`click`,`contextmenu`];function f$(){let e=null,t=()=>{e&&window.clearTimeout(e.timer),e=null},n=()=>{let e=e=>{e.preventDefault(),e.stopPropagation()},t=()=>{for(let t of d$)document.removeEventListener(t,e,!0);document.removeEventListener(`pointerdown`,t,!0),document.removeEventListener(`keydown`,t,!0)};for(let t of d$)document.addEventListener(t,e,!0);document.addEventListener(`pointerdown`,t,!0),document.addEventListener(`keydown`,t,!0)};document.addEventListener(`pointerdown`,r=>{if(t(),r.pointerType!==`touch`||!(r.target instanceof Element)||r.target.closest(u$))return;let i=r.target,a={x:r.clientX,y:r.clientY,native:!1,timer:window.setTimeout(()=>{e=null,!(a.native||!i.isConnected)&&(i.dispatchEvent(new MouseEvent(`contextmenu`,{bubbles:!0,cancelable:!0,clientX:a.x,clientY:a.y,button:2})),n())},c$)};e=a},!0),document.addEventListener(`pointermove`,n=>{e&&Math.hypot(n.clientX-e.x,n.clientY-e.y)>l$&&t()},!0),document.addEventListener(`pointerup`,t,!0),document.addEventListener(`pointercancel`,t,!0),document.addEventListener(`contextmenu`,t=>{e&&t.isTrusted&&(e.native=!0)},!0)}function p$(e,t){e.viewingExtras=()=>PC({narrow:Ee(),panelOpen:mw(e.selection.get().taskId)});let n=()=>e.reportViewing();KC.subscribe(n),hw(n),I.subscribe(n),M.subscribe(n),De(n),t.on(`panel`,t=>{NC(t)&&Dw(t,e.selection.get().taskId)});let r=rC();if(r){let t=t=>{let n=t.taskId??e.selection.get().taskId;!n||!t.url||Ew({taskId:n,desktopTabId:t.id,panelKey:t.panelKey,url:t.url})};r.onHandoff(e=>{e.owner===`human`&&t(e)}),r.onFocus(e=>t(e))}}function m$(e){let t=e;return!!t&&typeof t.promptId==`string`&&typeof t.title==`string`}function h$({client:e,prompt:t}){let n=(H()===`zh`?fa:da).prompt,[r,i]=(0,h.useState)(t.initial??``),a=(0,h.useRef)(!1),{busy:o,error:s,submit:c}=aa();return(0,h.useEffect)(()=>()=>{a.current||e.request(`ui.promptReply`,{promptId:t.promptId}).catch(()=>{})},[e,t.promptId]),(0,U.jsx)(ia,{title:t.title,children:(0,U.jsxs)(`form`,{className:hi,onSubmit:n=>{n.preventDefault(),c(async()=>{await e.request(`ui.promptReply`,{promptId:t.promptId,value:r}),a.current=!0})},children:[(0,U.jsx)(`input`,{className:Zr,"aria-label":n.fieldLabel,autoFocus:!0,spellCheck:!1,value:r,placeholder:t.placeholder,onChange:e=>i(e.target.value)}),s&&(0,U.jsx)(`p`,{className:`text-error`,children:s}),(0,U.jsx)(la,{busy:o,submitLabel:n.submitLabel})]})})}function g$(e,t){k.get()||k.set((0,U.jsx)(h$,{client:e,prompt:t},t.promptId))}var _$=900,v$=new WeakMap;function y$(e){e.setAttribute(`data-scrolling`,``),window.clearTimeout(v$.get(e)),v$.set(e,window.setTimeout(()=>e.removeAttribute(`data-scrolling`),_$))}function b$(){document.addEventListener(`scroll`,e=>{let t=e.target instanceof Element?e.target:document.scrollingElement;t&&y$(t)},{capture:!0,passive:!0})}var x$=`rove-web.reloadedFor`;function S$(e,t,n){return e===null?`adopt`:t===e||t===n?`stay`:`reload`}function C$(){let e=null;try{e=window.sessionStorage}catch{}return{storage:e,reload:()=>window.location.reload()}}function w$(e,t=C$()){let n=null,r=null,i=()=>{try{return t.storage?.getItem(x$)??r}catch{return r}};return e.conn.subscribe(()=>{let{state:a,hello:o}=e.conn.get();if(a!==`open`||!o)return;let s=S$(n,o.roveVersion,i());if(s===`adopt`&&(n=o.roveVersion),s===`reload`){r=o.roveVersion;try{t.storage?.setItem(x$,o.roveVersion)}catch{}t.reload()}})}function T$(){let e=window.visualViewport;if(!e)return;let t=document.documentElement,n=window.matchMedia(`(pointer: coarse)`),r=0,i=0,a=()=>{let a=e.height*e.scale;window.innerWidth!==i&&(i=window.innerWidth,r=0),r=n.matches?Math.max(r,a,window.innerHeight):window.innerHeight;let o=r-a>120,s=o===t.hasAttribute(`data-keyboard`)?null:document.querySelector(`.overlay:not(.is-leaving) .dialog`),c=s?.getBoundingClientRect().top;if(t.style.setProperty(`--vvh`,`${a}px`),t.toggleAttribute(`data-keyboard`,o),s&&c!==void 0&&!window.matchMedia(`(prefers-reduced-motion: reduce)`).matches){let e=c-s.getBoundingClientRect().top;e&&s.animate({translate:[`0 ${e}px`,`0 0`]},{duration:240,easing:`cubic-bezier(0.2, 0, 0, 1)`})}e.scale===1&&window.scrollY!==0&&window.scrollTo(0,0)};e.addEventListener(`resize`,a),e.addEventListener(`scroll`,a),window.addEventListener(`scroll`,a,{passive:!0}),a()}QQ();var E$=(0,g.createRoot)(document.getElementById(`root`));T$(),f$(),Be(),b$(),s$(),r$(),Bh();var D$=e=>E$.render((0,U.jsx)(h.StrictMode,{children:(0,U.jsx)($Q,{children:e})}));function O$(e){let t=new Rc(zc(),e),n=new ys(t);t.on(`prompt`,e=>{m$(e)&&g$(t,e)}),p$(n,t),w$(t),t.start(),D$((0,U.jsx)(UQ,{model:n}))}var k$=i();k$?O$(k$):Promise.all([qu(),Ku()]).then(([e,t])=>{e?O$(``):D$(t?(0,U.jsx)(Zu,{}):(0,U.jsx)($r,{}))});export{re as C,Xn as S,Sl as _,SY as a,Pc as b,fY as c,zF as d,RF as f,Cl as g,bl as h,EY as i,dY as l,xl as m,TY as n,bY as o,jw as p,xY as r,mY as s,y$ as t,uY as u,Wc as v,de as w,Jn as x,Bc as y};