@sma1lboy/rove 0.9.276 → 0.9.277-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/{chunk-mkfc9a09.js → chunk-0a65j1zj.js} +1 -1
- package/dist/cli/{chunk-xb3p11g0.js → chunk-0rvydb9q.js} +1 -1
- package/dist/cli/chunk-1g6vhgfe.js +14 -0
- package/dist/cli/{chunk-eq7vey2j.js → chunk-1vxtd8rh.js} +2 -2
- package/dist/cli/chunk-1wwqf6kx.js +3 -0
- package/dist/cli/{chunk-1jjqk7sq.js → chunk-2kbzb24j.js} +1 -1
- package/dist/cli/chunk-2kt0mfvf.js +2 -0
- package/dist/cli/{chunk-mz1ffkqb.js → chunk-2vph030z.js} +3 -3
- package/dist/cli/{chunk-nr7e3e82.js → chunk-2y70y8na.js} +1 -1
- package/dist/cli/{chunk-jckx79gk.js → chunk-36eyrv4r.js} +3 -3
- package/dist/cli/chunk-37fas9aj.js +2 -0
- package/dist/cli/chunk-3dhv5n19.js +2 -0
- package/dist/cli/{chunk-zkp6nty3.js → chunk-3x5g06mw.js} +1 -1
- package/dist/cli/{chunk-c6fy8xew.js → chunk-3y0z478f.js} +1 -1
- package/dist/cli/{chunk-91tcwxph.js → chunk-4w4tpsqx.js} +1 -1
- package/dist/cli/chunk-5apxck3d.js +97 -0
- package/dist/cli/chunk-5vrg6h71.js +3 -0
- package/dist/cli/{chunk-k1pwp155.js → chunk-5xpvd182.js} +1 -1
- package/dist/cli/{chunk-8dd60adw.js → chunk-5yh5trgy.js} +1 -1
- package/dist/cli/{chunk-r7ntkd6y.js → chunk-61cn88e7.js} +1 -1
- package/dist/cli/{chunk-e3cd4qd2.js → chunk-671ak750.js} +2 -2
- package/dist/cli/{chunk-82apkcrk.js → chunk-676f3tva.js} +1 -1
- package/dist/cli/chunk-6hcyvg0m.js +3 -0
- package/dist/cli/{chunk-h2gznz46.js → chunk-6mg5zp8y.js} +1 -1
- package/dist/cli/chunk-6q4br0pt.js +2 -0
- package/dist/cli/chunk-6wfhq8xd.js +4 -0
- package/dist/cli/{chunk-3xkhcfet.js → chunk-748656h7.js} +3 -3
- package/dist/cli/{chunk-2kqxz9a4.js → chunk-7bakcyes.js} +1 -1
- package/dist/cli/{chunk-yk9b8zgn.js → chunk-7kgcy89w.js} +1 -1
- package/dist/cli/{chunk-e3t1zbv1.js → chunk-8qkyd589.js} +1 -1
- package/dist/cli/chunk-9ckvdy0j.js +3 -0
- package/dist/cli/{chunk-5e9y8aw5.js → chunk-9fdy8vne.js} +1 -1
- package/dist/cli/chunk-9x2xd1rz.js +2 -0
- package/dist/cli/{chunk-je80r59s.js → chunk-9zswhjkv.js} +1 -1
- package/dist/cli/{chunk-c7mz2aq0.js → chunk-aq4j8ar4.js} +1 -1
- package/dist/cli/{chunk-dt676ks9.js → chunk-aqwckba5.js} +1 -1
- package/dist/cli/chunk-atg13xab.js +3 -0
- package/dist/cli/{chunk-wvqn1t55.js → chunk-bagwgxsg.js} +1 -1
- package/dist/cli/{chunk-syn0tfwy.js → chunk-bcyex84w.js} +1 -1
- package/dist/cli/chunk-bv050ssb.js +8 -0
- package/dist/cli/chunk-bykqhbvy.js +2 -0
- package/dist/cli/{chunk-81thm1eb.js → chunk-ca4x8s96.js} +3 -3
- package/dist/cli/{chunk-syfs63r2.js → chunk-cakyme4s.js} +1 -1
- package/dist/cli/{chunk-63cwjceg.js → chunk-ccmke5sx.js} +1 -1
- package/dist/cli/{chunk-5nvg3ek8.js → chunk-cf3vpsm5.js} +1 -1
- package/dist/cli/{chunk-zat16a83.js → chunk-d552cvb2.js} +1 -1
- package/dist/cli/{chunk-awh7np6x.js → chunk-dsdtq087.js} +1 -1
- package/dist/cli/{chunk-d0hpes59.js → chunk-e58kj4gm.js} +1 -1
- package/dist/cli/chunk-ee314raa.js +2 -0
- package/dist/cli/{chunk-f76gzvq3.js → chunk-fgtc1xq9.js} +1 -1
- package/dist/cli/{chunk-h7vwn62z.js → chunk-fq2pefc5.js} +1 -1
- package/dist/cli/{chunk-4117kgmx.js → chunk-g4p5znv1.js} +1 -1
- package/dist/cli/{chunk-1ca2j9w6.js → chunk-g9xknhjq.js} +1 -1
- package/dist/cli/chunk-gbd5j3dv.js +2 -0
- package/dist/cli/{chunk-4xvmrg86.js → chunk-ggjmcqpt.js} +1 -1
- package/dist/cli/chunk-hv79ys32.js +1 -1
- package/dist/cli/chunk-hz1x3hak.js +3 -0
- package/dist/cli/{chunk-h64rsbrx.js → chunk-hzz020xx.js} +1 -1
- package/dist/cli/{chunk-ma21srvx.js → chunk-j1qy79fd.js} +1 -1
- package/dist/cli/chunk-j9tsdn1d.js +2 -0
- package/dist/cli/chunk-jejmt4k0.js +140 -0
- package/dist/cli/chunk-jj5f4n51.js +1 -1
- package/dist/cli/{chunk-x3n4y5sp.js → chunk-k225696b.js} +1 -1
- package/dist/cli/{chunk-d7xbm9jp.js → chunk-kag7cfbr.js} +1 -1
- package/dist/cli/{chunk-283vd9h7.js → chunk-kdnk8m5j.js} +1 -1
- package/dist/cli/{chunk-xd93fm1k.js → chunk-kxp04jnp.js} +1 -1
- package/dist/cli/chunk-m4z6kepz.js +3 -0
- package/dist/cli/{chunk-372g44dg.js → chunk-mjyhy152.js} +1 -1
- package/dist/cli/chunk-mqvkd2g1.js +2 -0
- package/dist/cli/{chunk-t4qr9sv4.js → chunk-mvtqstte.js} +1 -1
- package/dist/cli/{chunk-m2a19yt4.js → chunk-mxx0y791.js} +1 -1
- package/dist/cli/{chunk-d9643dwf.js → chunk-n2zgej1a.js} +1 -1
- package/dist/cli/{chunk-xn2f56tg.js → chunk-n94vzkbe.js} +1 -1
- package/dist/cli/{chunk-9gh8kgjs.js → chunk-njncqdwf.js} +1 -1
- package/dist/cli/{chunk-t52gzaeb.js → chunk-nw092jak.js} +1 -1
- package/dist/cli/{chunk-gafkp74h.js → chunk-pfagrkt6.js} +1 -1
- package/dist/cli/{chunk-511103e8.js → chunk-pnrftncm.js} +1 -1
- package/dist/cli/{chunk-9c3brkb3.js → chunk-pqr6td4z.js} +1 -1
- package/dist/cli/{chunk-tvdrvgen.js → chunk-qcjkactr.js} +1 -1
- package/dist/cli/{chunk-v1r83m3n.js → chunk-qs359899.js} +1 -1
- package/dist/cli/{chunk-n6marmjn.js → chunk-qzzmd63x.js} +2 -3
- package/dist/cli/{chunk-fn7ffyam.js → chunk-r2bb8b11.js} +1 -1
- package/dist/cli/chunk-rjy900p4.js +4 -0
- package/dist/cli/{chunk-b035pej7.js → chunk-rmsdybs3.js} +1 -1
- package/dist/cli/{chunk-6mtfafaw.js → chunk-rztqccs3.js} +1 -1
- package/dist/cli/chunk-s1308b3d.js +63 -0
- package/dist/cli/{chunk-ne6x6g2c.js → chunk-se00fc8v.js} +1 -1
- package/dist/cli/{chunk-zcrs4sm2.js → chunk-shtm72c0.js} +1 -1
- package/dist/cli/{chunk-gq57he03.js → chunk-t9vjj8sy.js} +1 -1
- package/dist/cli/{chunk-0d7517kk.js → chunk-ta1p2nwa.js} +1 -1
- package/dist/cli/chunk-teh40faw.js +1 -1
- package/dist/cli/{chunk-eyvw70yb.js → chunk-tnatqcy7.js} +1 -1
- package/dist/cli/{chunk-mq88bvj6.js → chunk-tt58819p.js} +1 -1
- package/dist/cli/{chunk-pdq3ya2e.js → chunk-tw9tfs1d.js} +2 -2
- package/dist/cli/chunk-v6dz59gy.js +2 -0
- package/dist/cli/chunk-v6v272b3.js +3 -0
- package/dist/cli/{chunk-hhcmzs67.js → chunk-vkv1v3xn.js} +6 -28
- package/dist/cli/chunk-vkz6kkmm.js +24 -0
- package/dist/cli/chunk-vp29jgbt.js +4 -0
- package/dist/cli/chunk-vpsarakj.js +2 -0
- package/dist/cli/{chunk-745pg3xm.js → chunk-vr2r2ncm.js} +1 -1
- package/dist/cli/{chunk-3y9xzbqh.js → chunk-vvqwgcge.js} +1 -1
- package/dist/cli/{chunk-m73x5nry.js → chunk-vwpf55cr.js} +2 -2
- package/dist/cli/{chunk-vz0f8e8q.js → chunk-vytrhm50.js} +1 -1
- package/dist/cli/{chunk-c63vgbkw.js → chunk-w7v71t7e.js} +1 -1
- package/dist/cli/{chunk-hcvp84b3.js → chunk-wfgrn8p2.js} +1 -1
- package/dist/cli/chunk-wzss4pzh.js +3 -0
- package/dist/cli/chunk-x1ghdmp1.js +1 -1
- package/dist/cli/chunk-x1jxxmtc.js +3 -0
- package/dist/cli/{chunk-d7f022eb.js → chunk-x83xbzjd.js} +3 -3
- package/dist/cli/{chunk-22rgewg0.js → chunk-x85rcep5.js} +1 -1
- package/dist/cli/{chunk-j9b285x6.js → chunk-x89zw7br.js} +1 -1
- package/dist/cli/{chunk-ccwe9n56.js → chunk-xg42e2ff.js} +1 -1
- package/dist/cli/{chunk-jfcn77n9.js → chunk-xte4phd1.js} +1 -1
- package/dist/cli/chunk-y8b2p44q.js +1 -1
- package/dist/cli/chunk-ys6v36ph.js +2 -0
- package/dist/cli/{chunk-n8t4y0bj.js → chunk-yzdrhytj.js} +1 -1
- package/dist/cli/{chunk-qna1s1r4.js → chunk-z3qz6enf.js} +1 -1
- package/dist/cli/chunk-z3wrbtcq.js +22 -0
- package/dist/cli/{chunk-cfzg8q3e.js → chunk-z43e08kw.js} +1 -1
- package/dist/cli/{chunk-ehm9abge.js → chunk-zpwvjt14.js} +7 -5
- package/dist/cli/{chunk-k235z3ct.js → chunk-zrf93zrx.js} +1 -1
- package/dist/cli/index.js +9 -12
- package/dist/cli/pty-host-node.mjs +1 -3
- package/dist/cli/rove-run.js +1 -1
- package/dist/completions/rove.bash +1 -1
- package/dist/completions/rove.fish +1 -1
- package/dist/completions/rove.zsh +1 -1
- package/dist/skills/rove/SKILL.md +4 -3
- package/dist/skills/rove/references/api-flags.md +12 -5
- package/dist/web/assets/index-BVQbpUea.css +1 -0
- package/dist/web/assets/index-Cn_7vMHX.js +152 -0
- package/dist/web/assets/jetbrains-mono-cyrillic-500-normal-DJqRU3vO.woff +0 -0
- package/dist/web/assets/jetbrains-mono-cyrillic-500-normal-DmUKJPL_.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-cyrillic-600-normal-8K4wrrwR.woff +0 -0
- package/dist/web/assets/jetbrains-mono-cyrillic-600-normal-EVf6-Yzo.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-greek-500-normal-D7SFKleX.woff +0 -0
- package/dist/web/assets/jetbrains-mono-greek-500-normal-JpySY46c.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-greek-600-normal-H7WoG9Et.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-greek-600-normal-mc2nkWzM.woff +0 -0
- package/dist/web/assets/jetbrains-mono-latin-500-normal-BWZEU5yA.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-latin-500-normal-CJOVTJB7.woff +0 -0
- package/dist/web/assets/jetbrains-mono-latin-600-normal-BfsvjouI.woff +0 -0
- package/dist/web/assets/jetbrains-mono-latin-600-normal-C8RAYTDA.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-latin-ext-500-normal-Cut-4mMH.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-latin-ext-500-normal-ckzbgY84.woff +0 -0
- package/dist/web/assets/jetbrains-mono-latin-ext-600-normal-BfB_LPfz.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-latin-ext-600-normal-DObL3zCW.woff +0 -0
- package/dist/web/assets/jetbrains-mono-vietnamese-500-normal-DNRqzVM1.woff +0 -0
- package/dist/web/assets/jetbrains-mono-vietnamese-600-normal-OWROknRo.woff +0 -0
- package/dist/web/index.html +2 -2
- package/dist/web/relay/index.html +34 -0
- package/dist/web-ui/assets/{harness-pEyVtWV4.js → harness-C7ciHx2w.js} +2 -2
- package/dist/web-ui/assets/{index-Dyg-qcgB.js → index-B1FLht5L.js} +2 -2
- package/dist/web-ui/assets/{index-Bsn8NuKa.css → index-BDIkPexK.css} +1 -1
- package/dist/web-ui/index.html +2 -2
- package/package.json +1 -1
- package/dist/cli/chunk-1eef3z5v.js +0 -3
- package/dist/cli/chunk-1n03wzx4.js +0 -3
- package/dist/cli/chunk-387w0db1.js +0 -2
- package/dist/cli/chunk-4a05fgdh.js +0 -2
- package/dist/cli/chunk-59p3h5e9.js +0 -2
- package/dist/cli/chunk-6xga1a2d.js +0 -3
- package/dist/cli/chunk-84pvn784.js +0 -2
- package/dist/cli/chunk-883fyezq.js +0 -3
- package/dist/cli/chunk-a4r45qdn.js +0 -3
- package/dist/cli/chunk-brgfsm5v.js +0 -2
- package/dist/cli/chunk-bw98jn7g.js +0 -18
- package/dist/cli/chunk-cbrt4s7m.js +0 -3
- package/dist/cli/chunk-d9e4ssy7.js +0 -12
- package/dist/cli/chunk-dgx02565.js +0 -3
- package/dist/cli/chunk-g4dtqbrj.js +0 -2
- package/dist/cli/chunk-gctqthxq.js +0 -97
- package/dist/cli/chunk-hmjg1qh3.js +0 -2
- package/dist/cli/chunk-jn10xeft.js +0 -2
- package/dist/cli/chunk-nbpq1tkx.js +0 -98
- package/dist/cli/chunk-ns35rdyk.js +0 -3
- package/dist/cli/chunk-pap7k3b4.js +0 -3
- package/dist/cli/chunk-r7kmn4js.js +0 -2
- package/dist/cli/chunk-tz373e5w.js +0 -3
- package/dist/cli/chunk-vp171as9.js +0 -65
- package/dist/cli/chunk-vtcr71fs.js +0 -8
- package/dist/cli/chunk-w7v4jzwy.js +0 -3
- package/dist/cli/chunk-xv3217yv.js +0 -2
- package/dist/cli/chunk-yhytkwpv.js +0 -2
- package/dist/web/assets/index-C5t3gibI.css +0 -1
- package/dist/web/assets/index-Djp7M6r8.js +0 -122
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
var e=Object.defineProperty,t=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),n=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var r=`rove.bridge.token`,i=new URLSearchParams(window.location.hash.slice(1)).get(`token`);i&&(localStorage.setItem(r,i),history.replaceState(null,``,window.location.pathname+window.location.search));function a(){return localStorage.getItem(r)}function o(e){localStorage.setItem(r,e)}function s(){localStorage.removeItem(r)}var c=t((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function N(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+j(a,u),c+=N(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+j(a,u++),c+=N(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return N(M(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function P(e,t,n){if(e==null)return e;var r=[],i=0;return N(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function F(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 I=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)},L={map:P,forEach:function(e,t,n){P(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return P(e,function(){t++}),t},toArray:function(e){return P(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=L,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:F}},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,I)}catch(e){I(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`})),l=t(((e,t)=>{t.exports=c()})),u=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),d=t(((e,t)=>{t.exports=u()})),f=t((e=>{var t=l();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 c(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=c(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=c(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=c(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=c(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`})),p=t(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=f()})),m=t((e=>{var t=d(),n=l(),r=p();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 c(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 u(e){if(o(e)!==e)throw Error(i(188))}function f(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 u(a),e;if(s===r)return u(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,l=a.child;l;){if(l===n){c=!0,n=a,r=s;break}if(l===r){c=!0,r=a,n=s;break}l=l.sibling}if(!c){for(l=s.child;l;){if(l===n){c=!0,n=s,r=a;break}if(l===r){c=!0,r=s,n=a;break}l=l.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function m(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=m(e),t!==null)return t;e=e.sibling}return null}var h=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),w=Symbol.for(`react.forward_ref`),T=Symbol.for(`react.suspense`),E=Symbol.for(`react.suspense_list`),D=Symbol.for(`react.memo`),O=Symbol.for(`react.lazy`),k=Symbol.for(`react.activity`),A=Symbol.for(`react.memo_cache_sentinel`),j=Symbol.iterator;function M(e){return typeof e!=`object`||!e?null:(e=j&&e[j]||e[`@@iterator`],typeof e==`function`?e:null)}var N=Symbol.for(`react.client.reference`);function P(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===N?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case T:return`Suspense`;case E:return`SuspenseList`;case k:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case w:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case D:return t=e.displayName||null,t===null?P(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return P(e(t))}catch{}}return null}var F=Array.isArray,I=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ee={pending:!1,data:null,method:null,action:null},te=[],ne=-1;function re(e){return{current:e}}function R(e){0>ne||(e.current=te[ne],te[ne]=null,ne--)}function ie(e,t){ne++,te[ne]=e.current,e.current=t}var z=re(null),ae=re(null),oe=re(null),se=re(null);function B(e,t){switch(ie(oe,t),ie(ae,e),ie(z,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Kd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Kd(t),e=qd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}R(z),ie(z,e)}function V(){R(z),R(ae),R(oe)}function ce(e){e.memoizedState!==null&&ie(se,e);var t=z.current,n=qd(t,e.type);t!==n&&(ie(ae,e),ie(z,n))}function le(e){ae.current===e&&(R(z),R(ae)),se.current===e&&(R(se),np._currentValue=ee)}var ue,de;function fe(e){if(ue===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ue=t&&t[1]||``,de=-1<e.stack.indexOf(`
|
|
2
|
-
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
3
|
-
`+ue+e+de}var pe=!1;function me(e,t){if(!e||pe)return``;pe=!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(`
|
|
4
|
-
`),l=s.split(`
|
|
5
|
-
`);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
|
|
6
|
-
`+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{pe=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?fe(n):``}function he(e,t){switch(e.tag){case 26:case 27:case 5:return fe(e.type);case 16:return fe(`Lazy`);case 13:return e.child!==t&&t!==null?fe(`Suspense Fallback`):fe(`Suspense`);case 19:return fe(`SuspenseList`);case 0:case 15:return me(e.type,!1);case 11:return me(e.type.render,!1);case 1:return me(e.type,!0);case 31:return fe(`Activity`);default:return``}}function ge(e){try{var t=``,n=null;do t+=he(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
7
|
-
Error generating stack: `+e.message+`
|
|
8
|
-
`+e.stack}}var _e=Object.prototype.hasOwnProperty,ve=t.unstable_scheduleCallback,ye=t.unstable_cancelCallback,be=t.unstable_shouldYield,xe=t.unstable_requestPaint,Se=t.unstable_now,Ce=t.unstable_getCurrentPriorityLevel,we=t.unstable_ImmediatePriority,Te=t.unstable_UserBlockingPriority,Ee=t.unstable_NormalPriority,De=t.unstable_LowPriority,Oe=t.unstable_IdlePriority,ke=t.log,Ae=t.unstable_setDisableYieldValue,je=null,Me=null;function Ne(e){if(typeof ke==`function`&&Ae(e),Me&&typeof Me.setStrictMode==`function`)try{Me.setStrictMode(je,e)}catch{}}var Pe=Math.clz32?Math.clz32:Le,Fe=Math.log,Ie=Math.LN2;function Le(e){return e>>>=0,e===0?32:31-(Fe(e)/Ie|0)|0}var Re=256,ze=262144,Be=4194304;function Ve(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 He(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=Ve(n))):i=Ve(o):i=Ve(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Ve(n))):i=Ve(o)):i=Ve(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 Ue(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function We(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 Ge(){var e=Be;return Be<<=1,!(Be&62914560)&&(Be=4194304),e}function Ke(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function qe(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Je(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-Pe(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&&Ye(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Ye(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Pe(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function Xe(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Pe(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function Ze(e,t){var n=t&-t;return n=n&42?1:Qe(n),(n&(e.suspendedLanes|t))===0?n:0}function Qe(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 $e(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function et(){var e=L.p;return e===0?(e=window.event,e===void 0?32:vp(e.type)):e}function tt(e,t){var n=L.p;try{return L.p=e,t()}finally{L.p=n}}var nt=Math.random().toString(36).slice(2),rt=`__reactFiber$`+nt,it=`__reactProps$`+nt,at=`__reactContainer$`+nt,ot=`__reactEvents$`+nt,st=`__reactListeners$`+nt,ct=`__reactHandles$`+nt,lt=`__reactResources$`+nt,ut=`__reactMarker$`+nt;function dt(e){delete e[rt],delete e[it],delete e[ot],delete e[st],delete e[ct]}function ft(e){var t=e[rt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[at]||n[rt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=hf(e);e!==null;){if(n=e[rt])return n;e=hf(e)}return t}e=n,n=e.parentNode}return null}function pt(e){if(e=e[rt]||e[at]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function mt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function ht(e){var t=e[lt];return t||=e[lt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function gt(e){e[ut]=!0}var _t=new Set,vt={};function yt(e,t){bt(e,t),bt(e+`Capture`,t)}function bt(e,t){for(vt[e]=t,e=0;e<t.length;e++)_t.add(t[e])}var xt=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]*$`),St={},Ct={};function wt(e){return _e.call(Ct,e)?!0:_e.call(St,e)?!1:xt.test(e)?Ct[e]=!0:(St[e]=!0,!1)}function H(e,t,n){if(wt(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 Tt(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 Et(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 U(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Dt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Ot(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 kt(e){if(!e._valueTracker){var t=Dt(e)?`checked`:`value`;e._valueTracker=Ot(e,t,``+e[t])}}function At(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Dt(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function W(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 jt=/[\n"\\]/g;function Mt(e){return e.replace(jt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Nt(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=``+U(t)):e.value!==``+U(t)&&(e.value=``+U(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Ft(e,o,U(n)):Ft(e,o,U(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=``+U(s):e.removeAttribute(`name`)}function Pt(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)){kt(e);return}n=n==null?``:``+U(n),t=t==null?n:``+U(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),kt(e)}function Ft(e,t,n){t===`number`&&W(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function It(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=``+U(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 Lt(e,t,n){if(t!=null&&(t=``+U(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+U(n)}function Rt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(F(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=U(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),kt(e)}function zt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Bt=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 Vt(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||Bt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function G(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&&Vt(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&Vt(e,o,t[o])}function Ht(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 Ut=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`]]),Wt=/^[\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 Gt(e){return Wt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function Kt(){}var qt=null;function Jt(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Yt=null,Xt=null;function Zt(e){var t=pt(e);if(t&&(e=t.stateNode)){var n=e[it]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Nt(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="`+Mt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[it]||null;if(!a)throw Error(i(90));Nt(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&&At(r)}break a;case`textarea`:Lt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&It(e,!!n.multiple,t,!1)}}}var Qt=!1;function $t(e,t,n){if(Qt)return e(t,n);Qt=!0;try{return e(t)}finally{if(Qt=!1,(Yt!==null||Xt!==null)&&(Cu(),Yt&&(t=Yt,e=Xt,Xt=Yt=null,Zt(t),e)))for(t=0;t<e.length;t++)Zt(e[t])}}function en(e,t){var n=e.stateNode;if(n===null)return null;var r=n[it]||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 tn=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),nn=!1;if(tn)try{var rn={};Object.defineProperty(rn,"passive",{get:function(){nn=!0}}),window.addEventListener(`test`,rn,rn),window.removeEventListener(`test`,rn,rn)}catch{nn=!1}var an=null,on=null,sn=null;function cn(){if(sn)return sn;var e,t=on,n=t.length,r,i=`value`in an?an.value:an.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 sn=i.slice(e,1<r?1-r:void 0)}function ln(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 un(){return!0}function dn(){return!1}function fn(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)?un:dn,this.isPropagationStopped=dn,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=un)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=un)},persist:function(){},isPersistent:un}),t}var pn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},mn=fn(pn),hn=h({},pn,{view:0,detail:0}),gn=fn(hn),_n,vn,yn,bn=h({},hn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:jn,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!==yn&&(yn&&e.type===`mousemove`?(_n=e.screenX-yn.screenX,vn=e.screenY-yn.screenY):vn=_n=0,yn=e),_n)},movementY:function(e){return`movementY`in e?e.movementY:vn}}),xn=fn(bn),Sn=fn(h({},bn,{dataTransfer:0})),Cn=fn(h({},hn,{relatedTarget:0})),wn=fn(h({},pn,{animationName:0,elapsedTime:0,pseudoElement:0})),Tn=fn(h({},pn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),En=fn(h({},pn,{data:0})),Dn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},On={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`},kn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function An(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=kn[e])?!!t[e]:!1}function jn(){return An}var Mn=fn(h({},hn,{key:function(e){if(e.key){var t=Dn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=ln(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?On[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:jn,charCode:function(e){return e.type===`keypress`?ln(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?ln(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Nn=fn(h({},bn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Pn=fn(h({},hn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:jn})),Fn=fn(h({},pn,{propertyName:0,elapsedTime:0,pseudoElement:0})),In=fn(h({},bn,{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})),Ln=fn(h({},pn,{newState:0,oldState:0})),Rn=[9,13,27,32],zn=tn&&`CompositionEvent`in window,Bn=null;tn&&`documentMode`in document&&(Bn=document.documentMode);var Vn=tn&&`TextEvent`in window&&!Bn,Hn=tn&&(!zn||Bn&&8<Bn&&11>=Bn),Un=` `,Wn=!1;function Gn(e,t){switch(e){case`keyup`:return Rn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Kn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var qn=!1;function Jn(e,t){switch(e){case`compositionend`:return Kn(t);case`keypress`:return t.which===32?(Wn=!0,Un):null;case`textInput`:return e=t.data,e===Un&&Wn?null:e;default:return null}}function Yn(e,t){if(qn)return e===`compositionend`||!zn&&Gn(e,t)?(e=cn(),sn=on=an=null,qn=!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 Hn&&t.locale!==`ko`?null:t.data;default:return null}}var Xn={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 Zn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!Xn[e.type]:t===`textarea`}function Qn(e,t,n,r){Yt?Xt?Xt.push(r):Xt=[r]:Yt=r,t=Ad(t,`onChange`),0<t.length&&(n=new mn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var $n=null,er=null;function tr(e){Cd(e,0)}function nr(e){if(At(mt(e)))return e}function rr(e,t){if(e===`change`)return t}var ir=!1;if(tn){var ar;if(tn){var or=`oninput`in document;if(!or){var sr=document.createElement(`div`);sr.setAttribute(`oninput`,`return;`),or=typeof sr.oninput==`function`}ar=or}else ar=!1;ir=ar&&(!document.documentMode||9<document.documentMode)}function K(){$n&&($n.detachEvent(`onpropertychange`,cr),er=$n=null)}function cr(e){if(e.propertyName===`value`&&nr(er)){var t=[];Qn(t,er,e,Jt(e)),$t(tr,t)}}function lr(e,t,n){e===`focusin`?(K(),$n=t,er=n,$n.attachEvent(`onpropertychange`,cr)):e===`focusout`&&K()}function ur(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return nr(er)}function dr(e,t){if(e===`click`)return nr(t)}function fr(e,t){if(e===`input`||e===`change`)return nr(t)}function pr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var mr=typeof Object.is==`function`?Object.is:pr;function hr(e,t){if(mr(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(!_e.call(t,i)||!mr(e[i],t[i]))return!1}return!0}function gr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function _r(e,t){var n=gr(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=gr(n)}}function vr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?vr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function yr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=W(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=W(e.document)}return t}function br(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 xr=tn&&`documentMode`in document&&11>=document.documentMode,Sr=null,Cr=null,wr=null,Tr=!1;function Er(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Tr||Sr==null||Sr!==W(r)||(r=Sr,`selectionStart`in r&&br(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}),wr&&hr(wr,r)||(wr=r,r=Ad(Cr,`onSelect`),0<r.length&&(t=new mn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Sr)))}function Dr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Or={animationend:Dr(`Animation`,`AnimationEnd`),animationiteration:Dr(`Animation`,`AnimationIteration`),animationstart:Dr(`Animation`,`AnimationStart`),transitionrun:Dr(`Transition`,`TransitionRun`),transitionstart:Dr(`Transition`,`TransitionStart`),transitioncancel:Dr(`Transition`,`TransitionCancel`),transitionend:Dr(`Transition`,`TransitionEnd`)},kr={},Ar={};tn&&(Ar=document.createElement(`div`).style,`AnimationEvent`in window||(delete Or.animationend.animation,delete Or.animationiteration.animation,delete Or.animationstart.animation),`TransitionEvent`in window||delete Or.transitionend.transition);function jr(e){if(kr[e])return kr[e];if(!Or[e])return e;var t=Or[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Ar)return kr[e]=t[n];return e}var Mr=jr(`animationend`),Nr=jr(`animationiteration`),Pr=jr(`animationstart`),Fr=jr(`transitionrun`),Ir=jr(`transitionstart`),Lr=jr(`transitioncancel`),Rr=jr(`transitionend`),zr=new Map,Br=`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(` `);Br.push(`scrollEnd`);function Vr(e,t){zr.set(e,t),yt(t,[e])}var Hr=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)},Ur=[],Wr=0,Gr=0;function Kr(){for(var e=Wr,t=Gr=Wr=0;t<e;){var n=Ur[t];Ur[t++]=null;var r=Ur[t];Ur[t++]=null;var i=Ur[t];Ur[t++]=null;var a=Ur[t];if(Ur[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&&Xr(n,i,a)}}function qr(e,t,n,r){Ur[Wr++]=e,Ur[Wr++]=t,Ur[Wr++]=n,Ur[Wr++]=r,Gr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Jr(e,t,n,r){return qr(e,t,n,r),Zr(e)}function Yr(e,t){return qr(e,null,null,t),Zr(e)}function Xr(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-Pe(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function Zr(e){if(50<mu)throw mu=0,hu=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Qr={};function $r(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 ei(e,t,n,r){return new $r(e,t,n,r)}function ti(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ni(e,t){var n=e.alternate;return n===null?(n=ei(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 ri(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 ii(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)ti(e)&&(s=1);else if(typeof e==`string`)s=qf(e,n,z.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case k:return e=ei(31,n,t,a),e.elementType=k,e.lanes=o,e;case y:return ai(n.children,a,o,t);case b:s=8,a|=24;break;case x:return e=ei(12,n,t,a|2),e.elementType=x,e.lanes=o,e;case T:return e=ei(13,n,t,a),e.elementType=T,e.lanes=o,e;case E:return e=ei(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=ei(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function ai(e,t,n,r){return e=ei(7,e,r,t),e.lanes=n,e}function oi(e,t,n){return e=ei(6,e,null,t),e.lanes=n,e}function si(e){var t=ei(18,null,null,0);return t.stateNode=e,t}function ci(e,t,n){return t=ei(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var li=new WeakMap;function ui(e,t){if(typeof e==`object`&&e){var n=li.get(e);return n===void 0?(t={value:e,source:t,stack:ge(t)},li.set(e,t),t):n}return{value:e,source:t,stack:ge(t)}}var di=[],fi=0,pi=null,mi=0,hi=[],gi=0,_i=null,vi=1,yi=``;function bi(e,t){di[fi++]=mi,di[fi++]=pi,pi=e,mi=t}function xi(e,t,n){hi[gi++]=vi,hi[gi++]=yi,hi[gi++]=_i,_i=e;var r=vi;e=yi;var i=32-Pe(r)-1;r&=~(1<<i),n+=1;var a=32-Pe(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,vi=1<<32-Pe(t)+i|n<<i|r,yi=a+e}else vi=1<<a|n<<i|r,yi=e}function Si(e){e.return!==null&&(bi(e,1),xi(e,1,0))}function Ci(e){for(;e===pi;)pi=di[--fi],di[fi]=null,mi=di[--fi],di[fi]=null;for(;e===_i;)_i=hi[--gi],hi[gi]=null,yi=hi[--gi],hi[gi]=null,vi=hi[--gi],hi[gi]=null}function wi(e,t){hi[gi++]=vi,hi[gi++]=yi,hi[gi++]=_i,vi=t.id,yi=t.overflow,_i=e}var Ti=null,Ei=null,Di=!1,Oi=null,ki=!1,Ai=Error(i(519));function ji(e){throw Li(ui(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Ai}function Mi(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[rt]=e,t[it]=r,n){case`dialog`:J(`cancel`,t),J(`close`,t);break;case`iframe`:case`object`:case`embed`:J(`load`,t);break;case`video`:case`audio`:for(n=0;n<xd.length;n++)J(xd[n],t);break;case`source`:J(`error`,t);break;case`img`:case`image`:case`link`:J(`error`,t),J(`load`,t);break;case`details`:J(`toggle`,t);break;case`input`:J(`invalid`,t),Pt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:J(`invalid`,t);break;case`textarea`:J(`invalid`,t),Rt(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||Id(t.textContent,n)?(r.popover!=null&&(J(`beforetoggle`,t),J(`toggle`,t)),r.onScroll!=null&&J(`scroll`,t),r.onScrollEnd!=null&&J(`scrollend`,t),r.onClick!=null&&(t.onclick=Kt),t=!0):t=!1,t||ji(e,!0)}function Ni(e){for(Ti=e.return;Ti;)switch(Ti.tag){case 5:case 31:case 13:ki=!1;return;case 27:case 3:ki=!0;return;default:Ti=Ti.return}}function Pi(e){if(e!==Ti)return!1;if(!Di)return Ni(e),Di=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||Jd(e.type,e.memoizedProps)),n=!n),n&&Ei&&ji(e),Ni(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Ei=mf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Ei=mf(e)}else t===27?(t=Ei,tf(e.type)?(e=pf,pf=null,Ei=e):Ei=t):Ei=Ti?ff(e.stateNode.nextSibling):null;return!0}function Fi(){Ei=Ti=null,Di=!1}function Ii(){var e=Oi;return e!==null&&(eu===null?eu=e:eu.push.apply(eu,e),Oi=null),e}function Li(e){Oi===null?Oi=[e]:Oi.push(e)}var Ri=re(null),zi=null,Bi=null;function Vi(e,t,n){ie(Ri,t._currentValue),t._currentValue=n}function Hi(e){e._currentValue=Ri.current,R(Ri)}function Ui(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 Wi(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),Ui(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),Ui(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 Gi(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;mr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===se.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[np]:e.push(np))}a=a.return}e!==null&&Wi(t,e,n,r),t.flags|=262144}function Ki(e){for(e=e.firstContext;e!==null;){if(!mr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function qi(e){zi=e,Bi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Ji(e){return Xi(zi,e)}function Yi(e,t){return zi===null&&qi(e),Xi(e,t)}function Xi(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Bi===null){if(e===null)throw Error(i(308));Bi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Bi=Bi.next=t;return n}var Zi=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()})}},Qi=t.unstable_scheduleCallback,$i=t.unstable_NormalPriority,ea={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ta(){return{controller:new Zi,data:new Map,refCount:0}}function na(e){e.refCount--,e.refCount===0&&Qi($i,function(){e.controller.abort()})}var ra=null,ia=0,aa=0,oa=null;function sa(e,t){if(ra===null){var n=ra=[];ia=0,aa=hd(),oa={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return ia++,t.then(ca,ca),t}function ca(){if(--ia===0&&ra!==null){oa!==null&&(oa.status=`fulfilled`);var e=ra;ra=null,aa=0,oa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function la(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 ua=I.S;I.S=function(e,t){ru=Se(),typeof t==`object`&&t&&typeof t.then==`function`&&sa(e,t),ua!==null&&ua(e,t)};var da=re(null);function fa(){var e=da.current;return e===null?Rl.pooledCache:e}function pa(e,t){t===null?ie(da,da.current):ie(da,t.pool)}function ma(){var e=fa();return e===null?null:{parent:ea._currentValue,pool:e}}var ha=Error(i(460)),ga=Error(i(474)),_a=Error(i(542)),va={then:function(){}};function ya(e){return e=e.status,e===`fulfilled`||e===`rejected`}function ba(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Kt,Kt),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,wa(e),e;default:if(typeof t.status==`string`)t.then(Kt,Kt);else{if(e=Rl,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,wa(e),e}throw Sa=t,ha}}function xa(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Sa=e,ha):e}}var Sa=null;function Ca(){if(Sa===null)throw Error(i(459));var e=Sa;return Sa=null,e}function wa(e){if(e===ha||e===_a)throw Error(i(483))}var Ta=null,Ea=0;function Da(e){var t=Ea;return Ea+=1,Ta===null&&(Ta=[]),ba(Ta,e,t)}function Oa(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function ka(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 Aa(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=ni(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=oi(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&&xa(i)===t.type)?(t=a(t,n.props),Oa(t,n),t.return=e,t):(t=ii(n.type,n.key,n.props,null,e.mode,r),Oa(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=ci(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=ai(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=oi(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case _:return n=ii(t.type,t.key,t.props,null,e.mode,n),Oa(n,t),n.return=e,n;case v:return t=ci(t,e.mode,n),t.return=e,t;case O:return t=xa(t),f(e,t,n)}if(F(t)||M(t))return t=ai(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Da(t),n);if(t.$$typeof===C)return f(e,Yi(e,t),n);ka(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=xa(n),p(e,t,n,r)}if(F(n)||M(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Da(n),r);if(n.$$typeof===C)return p(e,t,Yi(e,n),r);ka(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=xa(r),m(e,t,n,r,i)}if(F(r)||M(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,Da(r),i);if(r.$$typeof===C)return m(e,t,n,Yi(t,r),i);ka(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),Di&&bi(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 Di&&bi(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)}),Di&&bi(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),Di&&bi(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 Di&&bi(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)}),Di&&bi(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&&xa(l)===r.type){n(e,r.sibling),c=a(r,o.props),Oa(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===y?(c=ai(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=ii(o.type,o.key,o.props,null,e.mode,c),Oa(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=ci(o,e.mode,c),c.return=e,e=c}return s(e);case O:return o=xa(o),b(e,r,o,c)}if(F(o))return h(e,r,o,c);if(M(o)){if(l=M(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,Da(o),c);if(o.$$typeof===C)return b(e,r,Yi(e,o),c);ka(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=oi(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Ea=0;var i=b(e,t,n,r);return Ta=null,i}catch(t){if(t===ha||t===_a)throw t;var a=ei(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var ja=Aa(!0),Ma=Aa(!1),Na=!1;function Pa(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Fa(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 Ia(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function La(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Ll&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Zr(e),Xr(e,null,n),t}return qr(e,r,t,n),Zr(e)}function Ra(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,Xe(e,n)}}function za(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 Ba=!1;function Va(){if(Ba){var e=oa;if(e!==null)throw e}}function Ha(e,t,n,r){Ba=!1;var i=e.updateQueue;Na=!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?(Bl&f)===f:(r&f)===f){f!==0&&f===aa&&(Ba=!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:Na=!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),Jl|=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=re(null),Ka=re(0);function qa(e,t){e=Kl,ie(Ka,e),ie(Ga,t),Kl=e|t.baseLanes}function Ja(){ie(Ka,Kl),ie(Ga,Ga.current)}function Ya(){Kl=Ka.current,R(Ga),R(Ka)}var Xa=re(null),Za=null;function Qa(e){var t=e.alternate;ie(ro,ro.current&1),ie(Xa,e),Za===null&&(t===null||Ga.current!==null||t.memoizedState!==null)&&(Za=e)}function $a(e){ie(ro,ro.current),ie(Xa,e),Za===null&&(Za=e)}function eo(e){e.tag===22?(ie(ro,ro.current),ie(Xa,e),Za===null&&(Za=e)):to(e)}function to(){ie(ro,ro.current),ie(Xa,Xa.current)}function no(e){R(Xa),Za===e&&(Za=null),R(ro)}var ro=re(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||lf(n)||uf(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(!mr(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,I.H=e===null||e.memoizedState===null?Fs:Is,uo=!1,a=n(r,i),uo=!1,lo&&(a=bo(t,n,r,i)),yo(e),a}function yo(e){I.H=Ps;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||$s||(e=e.dependencies,e!==null&&Ki(e)&&($s=!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)}I.H=Ls,o=t(n,r)}while(lo);return o}function xo(){var e=I.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=ba(mo,e,t),t=q,(so===null?t.memoizedState:so.next)===null&&(t=t.alternate,I.H=t===null||t.memoizedState===null?Fs:Is),e}function ko(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Oo(e);if(e.$$typeof===C)return Ji(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:(Bl&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===aa&&(d=!0);else if((ao&p)===p){u=u.next,p===aa&&(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,Jl|=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,Jl|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!mr(o,e.memoizedState)&&($s=!0,d&&(n=oa,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);mr(o,t.memoizedState)||($s=!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=Di;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!mr((oo||a).memoizedState,n);if(s&&(a.memoizedState=n,$s=!0),a=a.queue,os(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),Rl===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!mr(e,n)}catch{return!0}}function Bo(e){var t=Yr(e,2);t!==null&&vu(t,e,2)}function Vo(e){var t=To();if(typeof e==`function`){var n=e;if(e=n(),uo){Ne(!0);try{n()}finally{Ne(!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(js(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)}};I.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=I.T,o={};I.T=o;try{var s=n(i,r),c=I.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),I.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(Di){var n=Rl.formState;if(n!==null){a:{var r=q;if(Di){if(Ei){b:{for(var i=Ei,a=ki;i.nodeType!==8;){if(!a){i=null;break b}if(i=ff(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Ei=ff(i.nextSibling),r=i.data===`F!`;break a}}ji(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=Os.bind(null,q,r),r.dispatch=n,r=Vo(!1),a=As.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===ha?_a: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 os(e,t){is(2048,8,e,t)}function ss(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 cs(e){var t=Eo().memoizedState;return ss({ref:t,nextImpl:e}),function(){if(Ll&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function ls(e,t){return is(4,2,e,t)}function us(e,t){return is(4,4,e,t)}function ds(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 fs(e,t,n){n=n==null?null:n.concat([e]),is(4,4,ds.bind(null,t,e),n)}function ps(){}function ms(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 hs(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){Ne(!0);try{e()}finally{Ne(!1)}}return n.memoizedState=[r,t],r}function gs(e,t,n){return n===void 0||ao&1073741824&&!(Bl&261930)?e.memoizedState=t:(e.memoizedState=n,e=_u(),q.lanes|=e,Jl|=e,n)}function _s(e,t,n,r){return mr(n,t)?n:Ga.current===null?!(ao&42)||ao&1073741824&&!(Bl&261930)?($s=!0,e.memoizedState=n):(e=_u(),q.lanes|=e,Jl|=e,t):(e=gs(e,n,r),mr(e,t)||($s=!0),e)}function vs(e,t,n,r,i){var a=L.p;L.p=a!==0&&8>a?a:8;var o=I.T,s={};I.T=s,As(e,!1,t,n);try{var c=i(),l=I.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?ks(e,t,la(c,r),gu(e)):ks(e,t,r,gu(e))}catch(n){ks(e,t,{then:function(){},status:`rejected`,reason:n},gu())}finally{L.p=a,o!==null&&s.types!==null&&(o.types=s.types),I.T=o}}function ys(){}function bs(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=xs(e).queue;vs(e,a,t,ee,n===null?ys:function(){return Ss(e),n(r)})}function xs(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ee,baseState:ee,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:jo,lastRenderedState:ee},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 Ss(e){var t=xs(e);t.next===null&&(t=e.alternate.memoizedState),ks(e,t.next.queue,{},gu())}function Cs(){return Ji(np)}function ws(){return Eo().memoizedState}function Ts(){return Eo().memoizedState}function Es(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=gu();e=Ia(n);var r=La(t,e,n);r!==null&&(vu(r,t,n),Ra(r,t,n)),t={cache:ta()},e.payload=t;return}t=t.return}}function Ds(e,t,n){var r=gu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},js(e)?Ms(t,n):(n=Jr(e,t,n,r),n!==null&&(vu(n,e,r),Ns(n,t,r)))}function Os(e,t,n){ks(e,t,n,gu())}function ks(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(js(e))Ms(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,mr(s,o))return qr(e,t,i,0),Rl===null&&Kr(),!1}catch{}if(n=Jr(e,t,i,r),n!==null)return vu(n,e,r),Ns(n,t,r),!0}return!1}function As(e,t,n,r){if(r={lane:2,revertLane:hd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},js(e)){if(t)throw Error(i(479))}else t=Jr(e,n,r,2),t!==null&&vu(t,e,2)}function js(e){var t=e.alternate;return e===q||t!==null&&t===q}function Ms(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 Ns(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Xe(e,n)}}var Ps={readContext:Ji,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};Ps.useEffectEvent=go;var Fs={readContext:Ji,use:ko,useCallback:function(e,t){return To().memoizedState=[e,t===void 0?null:t],e},useContext:Ji,useEffect:as,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),rs(4194308,4,ds.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){Ne(!0);try{e()}finally{Ne(!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){Ne(!0);try{n(t)}finally{Ne(!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=Ds.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=Os.bind(null,q,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:ps,useDeferredValue:function(e,t){return gs(To(),e,t)},useTransition:function(){var e=Vo(!1);return e=vs.bind(null,q,e.queue,!0,!1),To().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=q,a=To();if(Di){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Rl===null)throw Error(i(349));Bl&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=Rl.identifierPrefix;if(Di){var n=yi,r=vi;n=(r&~(1<<32-Pe(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:Cs,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=As.bind(null,q,!0,n),n.dispatch=t,[e,t]},useMemoCache:Ao,useCacheRefresh:function(){return To().memoizedState=Es.bind(null,q)},useEffectEvent:function(e){var t=To(),n={impl:e};return t.memoizedState=n,function(){if(Ll&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Is={readContext:Ji,use:ko,useCallback:ms,useContext:Ji,useEffect:os,useImperativeHandle:fs,useInsertionEffect:ls,useLayoutEffect:us,useMemo:hs,useReducer:Mo,useRef:ns,useState:function(){return Mo(jo)},useDebugValue:ps,useDeferredValue:function(e,t){return _s(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:ws,useHostTransitionStatus:Cs,useFormState:Zo,useActionState:Zo,useOptimistic:function(e,t){return Ho(Eo(),oo,e,t)},useMemoCache:Ao,useCacheRefresh:Ts};Is.useEffectEvent=cs;var Ls={readContext:Ji,use:ko,useCallback:ms,useContext:Ji,useEffect:os,useImperativeHandle:fs,useInsertionEffect:ls,useLayoutEffect:us,useMemo:hs,useReducer:Po,useRef:ns,useState:function(){return Po(jo)},useDebugValue:ps,useDeferredValue:function(e,t){var n=Eo();return oo===null?gs(n,e,t):_s(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:ws,useHostTransitionStatus:Cs,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:Ts};Ls.useEffectEvent=cs;function Rs(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 zs={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=gu(),i=Ia(r);i.payload=t,n!=null&&(i.callback=n),t=La(e,i,r),t!==null&&(vu(t,e,r),Ra(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=gu(),i=Ia(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=La(e,i,r),t!==null&&(vu(t,e,r),Ra(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=gu(),r=Ia(n);r.tag=2,t!=null&&(r.callback=t),t=La(e,r,n),t!==null&&(vu(t,e,n),Ra(t,e,n))}};function Bs(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?!hr(n,r)||!hr(i,a):!0}function Vs(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&&zs.enqueueReplaceState(t,t.state,null)}function Hs(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 Us(e){Hr(e)}function Ws(e){console.error(e)}function Gs(e){Hr(e)}function Ks(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function qs(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 Js(e,t,n){return n=Ia(n),n.tag=3,n.payload={element:null},n.callback=function(){Ks(e,t)},n}function Ys(e){return e=Ia(e),e.tag=3,e}function Xs(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(){qs(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){qs(t,n,r),typeof i!=`function`&&(ou===null?ou=new Set([this]):ou.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Zs(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Gi(t,n,a,!0),n=Xa.current,n!==null){switch(n.tag){case 31:case 13:return Za===null?Au():n.alternate===null&&ql===0&&(ql=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===va?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Yu(e,r,a)),!1;case 22:return n.flags|=65536,r===va?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)),Yu(e,r,a)),!1}throw Error(i(435,n.tag))}return Yu(e,r,a),Au(),!1}if(Di)return t=Xa.current,t===null?(r!==Ai&&(t=Error(i(423),{cause:r}),Li(ui(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=ui(r,n),a=Js(e.stateNode,r,a),za(e,a),ql!==4&&(ql=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==Ai&&(e=Error(i(422),{cause:r}),Li(ui(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=ui(o,n),$l===null?$l=[o]:$l.push(o),ql!==4&&(ql=2),t===null)return!0;r=ui(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=Js(n.stateNode,r,e),za(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`&&(ou===null||!ou.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=Ys(a),Xs(a,e,n,r),za(n,a),!1}n=n.return}while(n!==null);return!1}var Qs=Error(i(461)),$s=!1;function ec(e,t,n,r){t.child=e===null?Ma(t,null,n,r):ja(t,e.child,n,r)}function tc(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 qi(t),r=vo(e,t,n,o,a,i),s=So(),e!==null&&!$s?(Co(e,t,i),Tc(e,t,i)):(Di&&s&&Si(t),t.flags|=1,ec(e,t,r,i),t.child)}function nc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ti(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,rc(e,t,a,r,i)):(e=ii(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Ec(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?hr:n,n(o,r)&&e.ref===t.ref)return Tc(e,t,i)}return t.flags|=1,e=ni(a,r),e.ref=t.ref,e.return=t,t.child=e}function rc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(hr(a,r)&&e.ref===t.ref){if($s=!1,t.pendingProps=r=a,Ec(e,i))e.flags&131072&&($s=!0);else return t.lanes=e.lanes,Tc(e,t,i)}}return dc(e,t,n,r,i)}function ic(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 oc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&pa(t,a===null?null:a.cachePool),a===null?Ja():qa(t,a),eo(t);else return r=t.lanes=536870912,oc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&pa(t,null),Ja(),to(t)):(pa(t,a.cachePool),qa(t,a),to(t),t.memoizedState=null);return ec(e,t,i,n),t.child}function ac(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function oc(e,t,n,r,i){var a=fa();return a=a===null?null:{parent:ea._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&pa(t,null),Ja(),eo(t),e!==null&&Gi(e,t,r,!0),t.childLanes=i,null}function sc(e,t){return t=bc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function cc(e,t,n){return ja(t,e.child,null,n),e=sc(t,t.pendingProps),e.flags|=2,no(t),t.memoizedState=null,e}function lc(e,t,n){var r=t.pendingProps,a=!!(t.flags&128);if(t.flags&=-129,e===null){if(Di){if(r.mode===`hidden`)return e=sc(t,r),t.lanes=536870912,ac(null,e);if($a(t),(e=Ei)?(e=cf(e,ki),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:_i===null?null:{id:vi,overflow:yi},retryLane:536870912,hydrationErrors:null},n=si(e),n.return=t,t.child=n,Ti=t,Ei=null)):e=null,e===null)throw ji(t);return t.lanes=536870912,null}return sc(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=cc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558))}else if($s||Gi(e,t,n,!1),a=(n&e.childLanes)!==0,$s||a){if(r=Rl,r!==null&&(s=Ze(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,Yr(e,s),vu(r,e,s),Qs;Au(),t=cc(e,t,n)}else e=o.treeContext,Ei=ff(s.nextSibling),Ti=t,Di=!0,Oi=null,ki=!1,e!==null&&wi(t,e),t=sc(t,r),t.flags|=4096;return t}return e=ni(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function uc(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 dc(e,t,n,r,i){return qi(t),n=vo(e,t,n,r,void 0,i),r=So(),e!==null&&!$s?(Co(e,t,i),Tc(e,t,i)):(Di&&r&&Si(t),t.flags|=1,ec(e,t,n,i),t.child)}function fc(e,t,n,r,i,a){return qi(t),t.updateQueue=null,n=bo(t,r,n,i),yo(e),r=So(),e!==null&&!$s?(Co(e,t,a),Tc(e,t,a)):(Di&&r&&Si(t),t.flags|=1,ec(e,t,n,a),t.child)}function pc(e,t,n,r,i){if(qi(t),t.stateNode===null){var a=Qr,o=n.contextType;typeof o==`object`&&o&&(a=Ji(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=zs,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Pa(t),o=n.contextType,a.context=typeof o==`object`&&o?Ji(o):Qr,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Rs(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&&zs.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=Hs(n,s);a.props=c;var l=a.context,u=n.contextType;o=Qr,typeof u==`object`&&u&&(o=Ji(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)&&Vs(t,a,r,o),Na=!1;var f=t.memoizedState;a.state=f,Ha(t,r,a,i),Va(),l=t.memoizedState,s||f!==l||Na?(typeof d==`function`&&(Rs(t,n,d,r),l=t.memoizedState),(c=Na||Bs(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,Fa(e,t),o=t.memoizedProps,u=Hs(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=Qr,typeof l==`object`&&l&&(c=Ji(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)&&Vs(t,a,r,c),Na=!1,f=t.memoizedState,a.state=f,Ha(t,r,a,i),Va();var p=t.memoizedState;o!==d||f!==p||Na||e!==null&&e.dependencies!==null&&Ki(e.dependencies)?(typeof s==`function`&&(Rs(t,n,s,r),p=t.memoizedState),(u=Na||Bs(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Ki(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,uc(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=ja(t,e.child,null,i),t.child=ja(t,null,n,i)):ec(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Tc(e,t,i),e}function mc(e,t,n,r){return Fi(),t.flags|=256,ec(e,t,n,r),t.child}var hc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function gc(e){return{baseLanes:e,cachePool:ma()}}function _c(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=Zl),e}function vc(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(Di){if(a?Qa(t):to(t),(e=Ei)?(e=cf(e,ki),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:_i===null?null:{id:vi,overflow:yi},retryLane:536870912,hydrationErrors:null},n=si(e),n.return=t,t.child=n,Ti=t,Ei=null)):e=null,e===null)throw ji(t);return uf(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(to(t),a=t.mode,c=bc({mode:`hidden`,children:c},a),r=ai(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=gc(n),r.childLanes=_c(e,s,n),t.memoizedState=hc,ac(null,r)):(Qa(t),yc(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=xc(e,t,n)):t.memoizedState===null?(to(t),c=r.fallback,a=t.mode,r=bc({mode:`visible`,children:r.children},a),c=ai(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,ja(t,e.child,null,n),r=t.child,r.memoizedState=gc(n),r.childLanes=_c(e,s,n),t.memoizedState=hc,t=ac(null,r)):(to(t),t.child=e.child,t.flags|=128,t=null);else if(Qa(t),uf(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,Li({value:r,source:null,stack:null}),t=xc(e,t,n)}else if($s||Gi(e,t,n,!1),s=(n&e.childLanes)!==0,$s||s){if(s=Rl,s!==null&&(r=Ze(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,Yr(e,r),vu(s,e,r),Qs;lf(c)||Au(),t=xc(e,t,n)}else lf(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Ei=ff(c.nextSibling),Ti=t,Di=!0,Oi=null,ki=!1,e!==null&&wi(t,e),t=yc(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=ni(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=ai(c,a,n,null),c.flags|=2):c=ni(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,ac(null,r),r=t.child,c=e.child.memoizedState,c===null?c=gc(n):(a=c.cachePool,a===null?a=ma():(l=ea._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=_c(e,s,n),t.memoizedState=hc,ac(e.child,r)):(Qa(t),n=e.child,e=n.sibling,n=ni(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 yc(e,t){return t=bc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function bc(e,t){return e=ei(22,e,null,t),e.lanes=0,e}function xc(e,t,n){return ja(t,e.child,null,n),e=yc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Sc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ui(e.return,t,n)}function Cc(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 wc(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,ie(ro,o),ec(e,t,r,n),r=Di?mi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Sc(e,n,t);else if(e.tag===19)Sc(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),Cc(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}Cc(t,!0,n,null,a,r);break;case`together`:Cc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Tc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Jl|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(Gi(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=ni(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ni(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Ec(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&Ki(e)))}function Dc(e,t,n){switch(t.tag){case 3:B(t,t.stateNode.containerInfo),Vi(t,ea,e.memoizedState.cache),Fi();break;case 27:case 5:ce(t);break;case 4:B(t,t.stateNode.containerInfo);break;case 10:Vi(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=Tc(e,t,n),e===null?null:e.sibling):vc(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||=(Gi(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return wc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),ie(ro,ro.current),r)break;return null;case 22:return t.lanes=0,ic(e,t,n,t.pendingProps);case 24:Vi(t,ea,e.memoizedState.cache)}return Tc(e,t,n)}function Oc(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)$s=!0;else{if(!Ec(e,n)&&!(t.flags&128))return $s=!1,Dc(e,t,n);$s=!!(e.flags&131072)}}else $s=!1,Di&&t.flags&1048576&&xi(t,mi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=xa(t.elementType),t.type=e,typeof e==`function`)ti(e)?(r=Hs(e,r),t.tag=1,t=pc(null,t,e,r,n)):(t.tag=0,t=dc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===w){t.tag=11,t=tc(null,t,e,r,n);break a}if(a===D){t.tag=14,t=nc(null,t,e,r,n);break a}}throw t=P(e)||e,Error(i(306,t,``))}}return t;case 0:return dc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=Hs(r,t.pendingProps),pc(e,t,r,a,n);case 3:a:{if(B(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,Fa(e,t),Ha(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Vi(t,ea,r),r!==o.cache&&Wi(t,[ea],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=mc(e,t,r,n);break a}if(r!==a){a=ui(Error(i(424)),t),Li(a),t=mc(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(Ei=ff(e.firstChild),Ti=t,Di=!0,Oi=null,ki=!0,n=Ma(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Fi(),r===a){t=Tc(e,t,n);break a}ec(e,t,r,n)}t=t.child}return t;case 26:return uc(e,t),e===null?(n=Nf(t.type,null,t.pendingProps,null))?t.memoizedState=n:Di||(n=t.type,e=t.pendingProps,r=Gd(oe.current).createElement(n),r[rt]=t,r[it]=e,zd(r,n,e),gt(r),t.stateNode=r):t.memoizedState=Nf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ce(t),e===null&&Di&&(r=t.stateNode=gf(t.type,t.pendingProps,oe.current),Ti=t,ki=!0,a=Ei,tf(t.type)?(pf=a,Ei=ff(r.firstChild)):Ei=a),ec(e,t,t.pendingProps.children,n),uc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Di&&((a=r=Ei)&&(r=of(r,t.type,t.pendingProps,ki),r===null?a=!1:(t.stateNode=r,Ti=t,Ei=ff(r.firstChild),ki=!1,a=!0)),a||ji(t)),ce(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,Jd(a,o)?r=null:s!==null&&Jd(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=vo(e,t,xo,null,null,n),np._currentValue=a),uc(e,t),ec(e,t,r,n),t.child;case 6:return e===null&&Di&&((e=n=Ei)&&(n=sf(n,t.pendingProps,ki),n===null?e=!1:(t.stateNode=n,Ti=t,Ei=null,e=!0)),e||ji(t)),null;case 13:return vc(e,t,n);case 4:return B(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=ja(t,null,r,n):ec(e,t,r,n),t.child;case 11:return tc(e,t,t.type,t.pendingProps,n);case 7:return ec(e,t,t.pendingProps,n),t.child;case 8:return ec(e,t,t.pendingProps.children,n),t.child;case 12:return ec(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Vi(t,t.type,r.value),ec(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,qi(t),a=Ji(a),r=r(a),t.flags|=1,ec(e,t,r,n),t.child;case 14:return nc(e,t,t.type,t.pendingProps,n);case 15:return rc(e,t,t.type,t.pendingProps,n);case 19:return wc(e,t,n);case 31:return lc(e,t,n);case 22:return ic(e,t,n,t.pendingProps);case 24:return qi(t),r=Ji(ea),e===null?(a=fa(),a===null&&(a=Rl,o=ta(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},Pa(t),Vi(t,ea,a)):((e.lanes&n)!==0&&(Fa(e,t),Ha(t,null,null,n),Va()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,Vi(t,ea,r),r!==a.cache&&Wi(t,[ea],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Vi(t,ea,r))),ec(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function kc(e){e.flags|=4}function Ac(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(Du())e.flags|=8192;else throw Sa=va,ga}}else e.flags&=-16777217}function jc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Jf(t)){if(Du())e.flags|=8192;else throw Sa=va,ga}}function Mc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:Ge(),e.lanes|=t,Ql|=t)}function Nc(e,t){if(!Di)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 Pc(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 Fc(e,t,n){var r=t.pendingProps;switch(Ci(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Pc(t),null;case 1:return Pc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Hi(ea),V(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Pi(t)?kc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ii())),Pc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(kc(t),o===null?(Pc(t),Ac(t,a,null,r,n)):(Pc(t),jc(t,o))):o?o===e.memoizedState?(Pc(t),t.flags&=-16777217):(kc(t),Pc(t),jc(t,o)):(e=e.memoizedProps,e!==r&&kc(t),Pc(t),Ac(t,a,e,r,n)),null;case 27:if(le(t),n=oe.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&kc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Pc(t),null}e=z.current,Pi(t)?Mi(t,e):(e=gf(a,r,n),t.stateNode=e,kc(t))}return Pc(t),null;case 5:if(le(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&kc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Pc(t),null}if(o=z.current,Pi(t))Mi(t,o);else{var s=Gd(oe.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[rt]=t,o[it]=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(zd(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&&kc(t)}}return Pc(t),Ac(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&kc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=oe.current,Pi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Ti,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[rt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Id(e.nodeValue,n)),e||ji(t,!0)}else e=Gd(e).createTextNode(r),e[rt]=t,t.stateNode=e}return Pc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Pi(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[rt]=t}else Fi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Pc(t),e=!1}else n=Ii(),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 Pc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Pi(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[rt]=t}else Fi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Pc(t),a=!1}else a=Ii(),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),Mc(t,t.updateQueue),Pc(t),null);case 4:return V(),e===null&&Ed(t.stateNode.containerInfo),Pc(t),null;case 10:return Hi(t.type),Pc(t),null;case 19:if(R(ro),r=t.memoizedState,r===null)return Pc(t),null;if(a=!!(t.flags&128),o=r.rendering,o===null){if(a)Nc(r,!1);else{if(ql!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=io(e),o!==null){for(t.flags|=128,Nc(r,!1),e=o.updateQueue,t.updateQueue=e,Mc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ri(n,e),n=n.sibling;return ie(ro,ro.current&1|2),Di&&bi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Se()>iu&&(t.flags|=128,a=!0,Nc(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,Mc(t,e),Nc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!Di)return Pc(t),null}else 2*Se()-r.renderingStartTime>iu&&n!==536870912&&(t.flags|=128,a=!0,Nc(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?(Pc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Se(),e.sibling=null,n=ro.current,ie(ro,a?n&1|2:n&1),Di&&bi(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)&&(Pc(t),t.subtreeFlags&6&&(t.flags|=8192)):Pc(t),n=t.updateQueue,n!==null&&Mc(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&&R(da),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Hi(ea),Pc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Ic(e,t){switch(Ci(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Hi(ea),V(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return le(t),null;case 31:if(t.memoizedState!==null){if(no(t),t.alternate===null)throw Error(i(340));Fi()}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));Fi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return R(ro),null;case 4:return V(),null;case 10:return Hi(t.type),null;case 22:case 23:return no(t),Ya(),e!==null&&R(da),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Hi(ea),null;case 25:return null;default:return null}}function Lc(e,t){switch(Ci(t),t.tag){case 3:Hi(ea),V();break;case 26:case 27:case 5:le(t);break;case 4:V();break;case 31:t.memoizedState!==null&&no(t);break;case 13:no(t);break;case 19:R(ro);break;case 10:Hi(t.type);break;case 22:case 23:no(t),Ya(),e!==null&&R(da);break;case 24:Hi(ea)}}function Rc(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){Ju(t,t.return,e)}}function zc(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){Ju(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Ju(t,t.return,e)}}function Bc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Wa(t,n)}catch(t){Ju(e,e.return,t)}}}function Vc(e,t,n){n.props=Hs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Ju(e,t,n)}}function Hc(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){Ju(e,t,n)}}function Uc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){Ju(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){Ju(e,t,n)}else n.current=null}}function Wc(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){Ju(e,e.return,t)}}function Gc(e,t,n){try{var r=e.stateNode;Bd(r,e.type,n,t),r[it]=t}catch(t){Ju(e,e.return,t)}}function Kc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&tf(e.type)||e.tag===4}function qc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Kc(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&&tf(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 Jc(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=Kt));else if(r!==4&&(r===27&&tf(e.type)&&(n=e.stateNode,t=null),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,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&&tf(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Yc(e,t,n),e=e.sibling;e!==null;)Yc(e,t,n),e=e.sibling}function Xc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);zd(t,r,n),t[rt]=e,t[it]=n}catch(t){Ju(e,e.return,t)}}var Zc=!1,Qc=!1,$c=!1,el=typeof WeakSet==`function`?WeakSet:Set,tl=null;function nl(e,t){if(e=e.containerInfo,Ud=dp,e=yr(e),br(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(Wd={focusedElem:e,selectionRange:n},dp=!1,tl=t;tl!==null;)if(t=tl,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,tl=e;else for(;tl!==null;){switch(t=tl,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=Hs(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Ju(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)af(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:af(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,tl=e;break}tl=t.return}}function rl(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:vl(e,n),r&4&&Rc(5,n);break;case 1:if(vl(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Ju(n,n.return,e)}else{var i=Hs(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Ju(n,n.return,e)}}}r&64&&Bc(n),r&512&&Hc(n,n.return);break;case 3:if(vl(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){Ju(n,n.return,e)}}break;case 27:t===null&&r&4&&Xc(n);case 26:case 5:vl(e,n),t===null&&r&4&&Wc(n),r&512&&Hc(n,n.return);break;case 12:vl(e,n);break;case 31:vl(e,n),r&4&&ll(e,n);break;case 13:vl(e,n),r&4&&ul(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Qu.bind(null,n),df(e,n))));break;case 22:if(r=n.memoizedState!==null||Zc,!r){t=t!==null&&t.memoizedState!==null||Qc,i=Zc;var a=Qc;Zc=r,(Qc=t)&&!a?bl(e,n,!!(n.subtreeFlags&8772)):vl(e,n),Zc=i,Qc=a}break;case 30:break;default:vl(e,n)}}function il(e){var t=e.alternate;t!==null&&(e.alternate=null,il(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&dt(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 al=null,ol=!1;function sl(e,t,n){for(n=n.child;n!==null;)cl(e,t,n),n=n.sibling}function cl(e,t,n){if(Me&&typeof Me.onCommitFiberUnmount==`function`)try{Me.onCommitFiberUnmount(je,n)}catch{}switch(n.tag){case 26:Qc||Uc(n,t),sl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Qc||Uc(n,t);var r=al,i=ol;tf(n.type)&&(al=n.stateNode,ol=!1),sl(e,t,n),_f(n.stateNode),al=r,ol=i;break;case 5:Qc||Uc(n,t);case 6:if(r=al,i=ol,al=null,sl(e,t,n),al=r,ol=i,al!==null){if(ol)try{(al.nodeType===9?al.body:al.nodeName===`HTML`?al.ownerDocument.body:al).removeChild(n.stateNode)}catch(e){Ju(n,t,e)}else try{al.removeChild(n.stateNode)}catch(e){Ju(n,t,e)}}break;case 18:al!==null&&(ol?(e=al,nf(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Lp(e)):nf(al,n.stateNode));break;case 4:r=al,i=ol,al=n.stateNode.containerInfo,ol=!0,sl(e,t,n),al=r,ol=i;break;case 0:case 11:case 14:case 15:zc(2,n,t),Qc||zc(4,n,t),sl(e,t,n);break;case 1:Qc||(Uc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Vc(n,t,r)),sl(e,t,n);break;case 21:sl(e,t,n);break;case 22:Qc=(r=Qc)||n.memoizedState!==null,sl(e,t,n),Qc=r;break;default:sl(e,t,n)}}function ll(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Lp(e)}catch(e){Ju(t,t.return,e)}}}function ul(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Lp(e)}catch(e){Ju(t,t.return,e)}}function dl(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new el),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new el),t;default:throw Error(i(435,e.tag))}}function fl(e,t){var n=dl(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=$u.bind(null,e,t);t.then(r,r)}})}function pl(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(tf(c.type)){al=c.stateNode,ol=!1;break a}break;case 5:al=c.stateNode,ol=!1;break a;case 3:case 4:al=c.stateNode.containerInfo,ol=!0;break a}c=c.return}if(al===null)throw Error(i(160));cl(o,s,a),al=null,ol=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)hl(t,e),t=t.sibling}var ml=null;function hl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:pl(t,e),gl(e),r&4&&(zc(3,e,e.return),Rc(3,e),zc(5,e,e.return));break;case 1:pl(t,e),gl(e),r&512&&(Qc||n===null||Uc(n,n.return)),r&64&&Zc&&(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=ml;if(pl(t,e),gl(e),r&512&&(Qc||n===null||Uc(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[ut]||o[rt]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),zd(o,r,n),o[rt]=e,gt(o),r=o;break a;case`link`:var s=Gf(`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),zd(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=Gf(`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),zd(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[rt]=e,gt(o),r=o}e.stateNode=r}else Kf(a,e.type,e.stateNode)}else e.stateNode=Bf(a,r,e.memoizedProps)}else o===r?r===null&&e.stateNode!==null&&Gc(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Kf(a,e.type,e.stateNode):Bf(a,r,e.memoizedProps))}break;case 27:pl(t,e),gl(e),r&512&&(Qc||n===null||Uc(n,n.return)),n!==null&&r&4&&Gc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(pl(t,e),gl(e),r&512&&(Qc||n===null||Uc(n,n.return)),e.flags&32){a=e.stateNode;try{zt(a,``)}catch(t){Ju(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,Gc(e,a,n===null?a:n.memoizedProps)),r&1024&&($c=!0);break;case 6:if(pl(t,e),gl(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Ju(e,e.return,t)}}break;case 3:if(Wf=null,a=ml,ml=bf(t.containerInfo),pl(t,e),ml=a,gl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Lp(t.containerInfo)}catch(t){Ju(e,e.return,t)}$c&&($c=!1,_l(e));break;case 4:r=ml,ml=bf(e.stateNode.containerInfo),pl(t,e),gl(e),ml=r;break;case 12:pl(t,e),gl(e);break;case 31:pl(t,e),gl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,fl(e,r)));break;case 13:pl(t,e),gl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(nu=Se()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,fl(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=Zc,d=Qc;if(Zc=u||a,Qc=d||l,pl(t,e),Qc=d,Zc=u,gl(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||Zc||Qc||yl(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){Ju(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){Ju(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?rf(m,!0):rf(l.stateNode,!1)}catch(e){Ju(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,fl(e,n))));break;case 19:pl(t,e),gl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,fl(e,r)));break;case 30:break;case 21:break;default:pl(t,e),gl(e)}}function gl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Kc(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;Yc(e,qc(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(zt(o,``),n.flags&=-33),Yc(e,qc(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;Jc(e,qc(e),s);break;default:throw Error(i(161))}}catch(t){Ju(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function _l(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;_l(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function vl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)rl(e,t.alternate,t),t=t.sibling}function yl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:zc(4,t,t.return),yl(t);break;case 1:Uc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Vc(t,t.return,n),yl(t);break;case 27:_f(t.stateNode);case 26:case 5:Uc(t,t.return),yl(t);break;case 22:t.memoizedState===null&&yl(t);break;case 30:yl(t);break;default:yl(t)}e=e.sibling}}function bl(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:bl(i,a,n),Rc(4,a);break;case 1:if(bl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Ju(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){Ju(r,r.return,e)}}n&&o&64&&Bc(a),Hc(a,a.return);break;case 27:Xc(a);case 26:case 5:bl(i,a,n),n&&r===null&&o&4&&Wc(a),Hc(a,a.return);break;case 12:bl(i,a,n);break;case 31:bl(i,a,n),n&&o&4&&ll(i,a);break;case 13:bl(i,a,n),n&&o&4&&ul(i,a);break;case 22:a.memoizedState===null&&bl(i,a,n),Hc(a,a.return);break;case 30:break;default:bl(i,a,n)}t=t.sibling}}function xl(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&&na(n))}function Sl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&na(e))}function Cl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)wl(e,t,n,r),t=t.sibling}function wl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Cl(e,t,n,r),i&2048&&Rc(9,t);break;case 1:Cl(e,t,n,r);break;case 3:Cl(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&&na(e)));break;case 12:if(i&2048){Cl(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){Ju(t,t.return,e)}}else Cl(e,t,n,r);break;case 31:Cl(e,t,n,r);break;case 13:Cl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?Cl(e,t,n,r):(a._visibility|=2,Tl(e,t,n,r,!!(t.subtreeFlags&10256)||!1)):a._visibility&2?Cl(e,t,n,r):El(e,t),i&2048&&xl(o,t);break;case 24:Cl(e,t,n,r),i&2048&&Sl(t.alternate,t);break;default:Cl(e,t,n,r)}}function Tl(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:Tl(a,o,s,c,i),Rc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Tl(a,o,s,c,i)):u._visibility&2?Tl(a,o,s,c,i):El(a,o),i&&l&2048&&xl(o.alternate,o);break;case 24:Tl(a,o,s,c,i),i&&l&2048&&Sl(o.alternate,o);break;default:Tl(a,o,s,c,i)}t=t.sibling}}function El(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:El(n,r),i&2048&&xl(r.alternate,r);break;case 24:El(n,r),i&2048&&Sl(r.alternate,r);break;default:El(n,r)}t=t.sibling}}var Dl=8192;function Ol(e,t,n){if(e.subtreeFlags&Dl)for(e=e.child;e!==null;)kl(e,t,n),e=e.sibling}function kl(e,t,n){switch(e.tag){case 26:Ol(e,t,n),e.flags&Dl&&e.memoizedState!==null&&Yf(n,ml,e.memoizedState,e.memoizedProps);break;case 5:Ol(e,t,n);break;case 3:case 4:var r=ml;ml=bf(e.stateNode.containerInfo),Ol(e,t,n),ml=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Dl,Dl=16777216,Ol(e,t,n),Dl=r):Ol(e,t,n));break;default:Ol(e,t,n)}}function Al(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 jl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];tl=r,Pl(r,e)}Al(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Ml(e),e=e.sibling}function Ml(e){switch(e.tag){case 0:case 11:case 15:jl(e),e.flags&2048&&zc(9,e,e.return);break;case 3:jl(e);break;case 12:jl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Nl(e)):jl(e);break;default:jl(e)}}function Nl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];tl=r,Pl(r,e)}Al(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:zc(8,t,t.return),Nl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Nl(t));break;default:Nl(t)}e=e.sibling}}function Pl(e,t){for(;tl!==null;){var n=tl;switch(n.tag){case 0:case 11:case 15:zc(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:na(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,tl=r;else a:for(n=e;tl!==null;){r=tl;var i=r.sibling,a=r.return;if(il(r),r===n){tl=null;break a}if(i!==null){i.return=a,tl=i;break a}tl=a}}}var Fl={getCacheForType:function(e){var t=Ji(ea),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Ji(ea).controller.signal}},Il=typeof WeakMap==`function`?WeakMap:Map,Ll=0,Rl=null,zl=null,Bl=0,Vl=0,Hl=null,Ul=!1,Wl=!1,Gl=!1,Kl=0,ql=0,Jl=0,Yl=0,Xl=0,Zl=0,Ql=0,$l=null,eu=null,tu=!1,nu=0,ru=0,iu=1/0,au=null,ou=null,su=0,cu=null,lu=null,uu=0,du=0,fu=null,pu=null,mu=0,hu=null;function gu(){return Ll&2&&Bl!==0?Bl&-Bl:I.T===null?et():hd()}function _u(){if(Zl===0){if(!(Bl&536870912)||Di){var e=ze;ze<<=1,!(ze&3932160)&&(ze=262144),Zl=e}else Zl=536870912}return e=Xa.current,e!==null&&(e.flags|=32),Zl}function vu(e,t,n){(e===Rl&&(Vl===2||Vl===9)||e.cancelPendingCommit!==null)&&(Tu(e,0),Su(e,Bl,Zl,!1)),qe(e,n),(!(Ll&2)||e!==Rl)&&(e===Rl&&(!(Ll&2)&&(Yl|=n),ql===4&&Su(e,Bl,Zl,!1)),sd(e))}function yu(e,t,n){if(Ll&6)throw Error(i(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||Ue(e,t),a=r?Nu(e,t):ju(e,t,!0),o=r;do{if(a===0){Wl&&!r&&Su(e,t,0,!1);break}if(n=e.current.alternate,o&&!xu(n)){a=ju(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=$l;var l=c.current.memoizedState.isDehydrated;if(l&&(Tu(c,s).flags|=256),s=ju(c,s,!1),s!==2){if(Gl&&!l){c.errorRecoveryDisabledLanes|=o,Yl|=o,a=4;break a}o=eu,eu=a,o!==null&&(eu===null?eu=o:eu.push.apply(eu,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Tu(e,0),Su(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:Su(r,t,Zl,!Ul);break a;case 2:eu=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=nu+300-Se(),10<a)){if(Su(r,t,Zl,!Ul),He(r,0,!0)!==0)break a;uu=t,r.timeoutHandle=Xd(bu.bind(null,r,n,eu,au,tu,t,Zl,Yl,Ql,Ul,o,`Throttled`,-0,0),a);break a}bu(r,n,eu,au,tu,t,Zl,Yl,Ql,Ul,o,null,-0,0)}break}while(1);sd(e)}function bu(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:Kt},kl(t,a,d);var m=(a&62914560)===a?nu-Se():(a&4194048)===a?ru-Se():0;if(m=Zf(d,m),m!==null){uu=a,e.cancelPendingCommit=m(Bu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),Su(e,a,o,!l);return}}Bu(e,t,a,n,r,i,o,s,c)}function xu(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(!mr(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 Su(e,t,n,r){t&=~Xl,t&=~Yl,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Pe(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Ye(e,n,t)}function Cu(){return Ll&6?!0:(cd(0,!1),!1)}function wu(){if(zl!==null){if(Vl===0)var e=zl.return;else e=zl,Bi=zi=null,wo(e),Ta=null,Ea=0,e=zl;for(;e!==null;)Lc(e.alternate,e),e=e.return;zl=null}}function Tu(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,Zd(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),uu=0,wu(),Rl=e,zl=n=ni(e.current,null),Bl=t,Vl=0,Hl=null,Ul=!1,Wl=Ue(e,t),Gl=!1,Ql=Zl=Xl=Yl=Jl=ql=0,eu=$l=null,tu=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Pe(r),a=1<<i;t|=e[i],r&=~a}return Kl=t,Kr(),n}function Eu(e,t){q=null,I.H=Ps,t===ha||t===_a?(t=Ca(),Vl=3):t===ga?(t=Ca(),Vl=4):Vl=t===Qs?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Hl=t,zl===null&&(ql=1,Ks(e,ui(t,e.current)))}function Du(){var e=Xa.current;return e===null?!0:(Bl&4194048)===Bl?Za===null:(Bl&62914560)===Bl||Bl&536870912?e===Za:!1}function Ou(){var e=I.H;return I.H=Ps,e===null?Ps:e}function ku(){var e=I.A;return I.A=Fl,e}function Au(){ql=4,Ul||(Bl&4194048)!==Bl&&Xa.current!==null||(Wl=!0),!(Jl&134217727)&&!(Yl&134217727)||Rl===null||Su(Rl,Bl,Zl,!1)}function ju(e,t,n){var r=Ll;Ll|=2;var i=Ou(),a=ku();(Rl!==e||Bl!==t)&&(au=null,Tu(e,t)),t=!1;var o=ql;a:do try{if(Vl!==0&&zl!==null){var s=zl,c=Hl;switch(Vl){case 8:wu(),o=6;break a;case 3:case 2:case 9:case 6:Xa.current===null&&(t=!0);var l=Vl;if(Vl=0,Hl=null,Lu(e,s,c,l),n&&Wl){o=0;break a}break;default:l=Vl,Vl=0,Hl=null,Lu(e,s,c,l)}}Mu(),o=ql;break}catch(t){Eu(e,t)}while(1);return t&&e.shellSuspendCounter++,Bi=zi=null,Ll=r,I.H=i,I.A=a,zl===null&&(Rl=null,Bl=0,Kr()),o}function Mu(){for(;zl!==null;)Fu(zl)}function Nu(e,t){var n=Ll;Ll|=2;var r=Ou(),a=ku();Rl!==e||Bl!==t?(au=null,iu=Se()+500,Tu(e,t)):Wl=Ue(e,t);a:do try{if(Vl!==0&&zl!==null){t=zl;var o=Hl;b:switch(Vl){case 1:Vl=0,Hl=null,Lu(e,t,o,1);break;case 2:case 9:if(ya(o)){Vl=0,Hl=null,Iu(t);break}t=function(){Vl!==2&&Vl!==9||Rl!==e||(Vl=7),sd(e)},o.then(t,t);break a;case 3:Vl=7;break a;case 4:Vl=5;break a;case 7:ya(o)?(Vl=0,Hl=null,Iu(t)):(Vl=0,Hl=null,Lu(e,t,o,7));break;case 5:var s=null;switch(zl.tag){case 26:s=zl.memoizedState;case 5:case 27:var c=zl;if(s?Jf(s):c.stateNode.complete){Vl=0,Hl=null;var l=c.sibling;if(l!==null)zl=l;else{var u=c.return;u===null?zl=null:(zl=u,Ru(u))}break b}}Vl=0,Hl=null,Lu(e,t,o,5);break;case 6:Vl=0,Hl=null,Lu(e,t,o,6);break;case 8:wu(),ql=6;break a;default:throw Error(i(462))}}Pu();break}catch(t){Eu(e,t)}while(1);return Bi=zi=null,I.H=r,I.A=a,Ll=n,zl===null?(Rl=null,Bl=0,Kr(),ql):0}function Pu(){for(;zl!==null&&!be();)Fu(zl)}function Fu(e){var t=Oc(e.alternate,e,Kl);e.memoizedProps=e.pendingProps,t===null?Ru(e):zl=t}function Iu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=fc(n,t,t.pendingProps,t.type,void 0,Bl);break;case 11:t=fc(n,t,t.pendingProps,t.type.render,t.ref,Bl);break;case 5:wo(t);default:Lc(n,t),t=zl=ri(t,Kl),t=Oc(n,t,Kl)}e.memoizedProps=e.pendingProps,t===null?Ru(e):zl=t}function Lu(e,t,n,r){Bi=zi=null,wo(t),Ta=null,Ea=0;var i=t.return;try{if(Zs(e,i,t,n,Bl)){ql=1,Ks(e,ui(n,e.current)),zl=null;return}}catch(t){if(i!==null)throw zl=i,t;ql=1,Ks(e,ui(n,e.current)),zl=null;return}t.flags&32768?(Di||r===1?e=!0:Wl||Bl&536870912?e=!1:(Ul=e=!0,(r===2||r===9||r===3||r===6)&&(r=Xa.current,r!==null&&r.tag===13&&(r.flags|=16384))),zu(t,e)):Ru(t)}function Ru(e){var t=e;do{if(t.flags&32768){zu(t,Ul);return}e=t.return;var n=Fc(t.alternate,t,Kl);if(n!==null){zl=n;return}if(t=t.sibling,t!==null){zl=t;return}zl=t=e}while(t!==null);ql===0&&(ql=5)}function zu(e,t){do{var n=Ic(e.alternate,e);if(n!==null){n.flags&=32767,zl=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){zl=e;return}zl=e=n}while(e!==null);ql=6,zl=null}function Bu(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do Gu();while(su!==0);if(Ll&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=Gr,Je(e,n,o,s,c,l),e===Rl&&(zl=Rl=null,Bl=0),lu=t,cu=e,uu=n,du=o,fu=a,pu=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,ed(Ee,function(){return Ku(),null})):(e.callbackNode=null,e.callbackPriority=0),r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=I.T,I.T=null,a=L.p,L.p=2,s=Ll,Ll|=4;try{nl(e,t,n)}finally{Ll=s,L.p=a,I.T=r}}su=1,Vu(),Hu(),Uu()}}function Vu(){if(su===1){su=0;var e=cu,t=lu,n=!!(t.flags&13878);if(t.subtreeFlags&13878||n){n=I.T,I.T=null;var r=L.p;L.p=2;var i=Ll;Ll|=4;try{hl(t,e);var a=Wd,o=yr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&vr(s.ownerDocument.documentElement,s)){if(c!==null&&br(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 _=_r(s,h),v=_r(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}}dp=!!Ud,Wd=Ud=null}finally{Ll=i,L.p=r,I.T=n}}e.current=t,su=2}}function Hu(){if(su===2){su=0;var e=cu,t=lu,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=I.T,I.T=null;var r=L.p;L.p=2;var i=Ll;Ll|=4;try{rl(e,t.alternate,t)}finally{Ll=i,L.p=r,I.T=n}}su=3}}function Uu(){if(su===4||su===3){su=0,xe();var e=cu,t=lu,n=uu,r=pu;t.subtreeFlags&10256||t.flags&10256?su=5:(su=0,lu=cu=null,Wu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(ou=null),$e(n),t=t.stateNode,Me&&typeof Me.onCommitFiberRoot==`function`)try{Me.onCommitFiberRoot(je,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=I.T,i=L.p,L.p=2,I.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{I.T=t,L.p=i}}uu&3&&Gu(),sd(e),i=e.pendingLanes,n&261930&&i&42?e===hu?mu++:(mu=0,hu=e):mu=0,cd(0,!1)}}function Wu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,na(t)))}function Gu(){return Vu(),Hu(),Uu(),Ku()}function Ku(){if(su!==5)return!1;var e=cu,t=du;du=0;var n=$e(uu),r=I.T,a=L.p;try{L.p=32>n?32:n,I.T=null,n=fu,fu=null;var o=cu,s=uu;if(su=0,lu=cu=null,uu=0,Ll&6)throw Error(i(331));var c=Ll;if(Ll|=4,Ml(o.current),wl(o,o.current,s,n),Ll=c,cd(0,!1),Me&&typeof Me.onPostCommitFiberRoot==`function`)try{Me.onPostCommitFiberRoot(je,o)}catch{}return!0}finally{L.p=a,I.T=r,Wu(e,t)}}function qu(e,t,n){t=ui(n,t),t=Js(e.stateNode,t,2),e=La(e,t,2),e!==null&&(qe(e,2),sd(e))}function Ju(e,t,n){if(e.tag===3)qu(e,e,n);else for(;t!==null;){if(t.tag===3){qu(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(ou===null||!ou.has(r))){e=ui(n,e),n=Ys(2),r=La(t,n,2),r!==null&&(Xs(n,r,t,e),qe(r,2),sd(r));break}}t=t.return}}function Yu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Il;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)||(Gl=!0,i.add(n),e=Xu.bind(null,e,t,n),t.then(e,e))}function Xu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Rl===e&&(Bl&n)===n&&(ql===4||ql===3&&(Bl&62914560)===Bl&&300>Se()-nu?!(Ll&2)&&Tu(e,0):Xl|=n,Ql===Bl&&(Ql=0)),sd(e)}function Zu(e,t){t===0&&(t=Ge()),e=Yr(e,t),e!==null&&(qe(e,t),sd(e))}function Qu(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Zu(e,n)}function $u(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),Zu(e,n)}function ed(e,t){return ve(e,t)}var td=null,nd=null,rd=!1,id=!1,ad=!1,od=0;function sd(e){e!==nd&&e.next===null&&(nd===null?td=nd=e:nd=nd.next=e),id=!0,rd||(rd=!0,md())}function cd(e,t){if(!ad&&id){ad=!0;do for(var n=!1,r=td;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-Pe(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,pd(r,a))}else a=Bl,a=He(r,r===Rl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Ue(r,a)||(n=!0,pd(r,a))}r=r.next}while(n);ad=!1}}function ld(){ud()}function ud(){id=rd=!1;var e=0;od!==0&&Yd()&&(e=od);for(var t=Se(),n=null,r=td;r!==null;){var i=r.next,a=dd(r,t);a===0?(r.next=null,n===null?td=i:n.next=i,i===null&&(nd=n)):(n=r,(e!==0||a&3)&&(id=!0)),r=i}su!==0&&su!==5||cd(e,!1),od!==0&&(od=0)}function dd(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Pe(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=We(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Rl,n=Bl,n=He(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Vl===2||Vl===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&ye(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Ue(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&ye(r),$e(n)){case 2:case 8:n=Te;break;case 32:n=Ee;break;case 268435456:n=Oe;break;default:n=Ee}return r=fd.bind(null,e),n=ve(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&ye(r),e.callbackPriority=2,e.callbackNode=null,2}function fd(e,t){if(su!==0&&su!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Gu()&&e.callbackNode!==n)return null;var r=Bl;return r=He(e,e===Rl?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(yu(e,r,t),dd(e,Se()),e.callbackNode!=null&&e.callbackNode===n?fd.bind(null,e):null)}function pd(e,t){if(Gu())return null;yu(e,t,!0)}function md(){$d(function(){Ll&6?ve(we,ld):ud()})}function hd(){if(od===0){var e=aa;e===0&&(e=Re,Re<<=1,!(Re&261888)&&(Re=256)),od=e}return od}function gd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Gt(``+e)}function _d(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 vd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=gd((i[it]||null).action),o=r.submitter;o&&(t=(t=o[it]||null)?gd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new mn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(od!==0){var e=o?_d(i,o):new FormData(i);bs(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?_d(i,o):new FormData(i),bs(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var yd=0;yd<Br.length;yd++){var bd=Br[yd];Vr(bd.toLowerCase(),`on`+(bd[0].toUpperCase()+bd.slice(1)))}Vr(Mr,`onAnimationEnd`),Vr(Nr,`onAnimationIteration`),Vr(Pr,`onAnimationStart`),Vr(`dblclick`,`onDoubleClick`),Vr(`focusin`,`onFocus`),Vr(`focusout`,`onBlur`),Vr(Fr,`onTransitionRun`),Vr(Ir,`onTransitionStart`),Vr(Lr,`onTransitionCancel`),Vr(Rr,`onTransitionEnd`),bt(`onMouseEnter`,[`mouseout`,`mouseover`]),bt(`onMouseLeave`,[`mouseout`,`mouseover`]),bt(`onPointerEnter`,[`pointerout`,`pointerover`]),bt(`onPointerLeave`,[`pointerout`,`pointerover`]),yt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),yt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),yt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),yt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),yt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),yt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var xd=`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(` `),Sd=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(xd));function Cd(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){Hr(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){Hr(e)}i.currentTarget=null,a=c}}}}function J(e,t){var n=t[ot];n===void 0&&(n=t[ot]=new Set);var r=e+`__bubble`;n.has(r)||(Dd(t,e,2,!1),n.add(r))}function wd(e,t,n){var r=0;t&&(r|=4),Dd(n,e,r,t)}var Td=`_reactListening`+Math.random().toString(36).slice(2);function Ed(e){if(!e[Td]){e[Td]=!0,_t.forEach(function(t){t!==`selectionchange`&&(Sd.has(t)||wd(t,!1,e),wd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Td]||(t[Td]=!0,wd(`selectionchange`,!1,t))}}function Dd(e,t,n,r){switch(vp(t)){case 2:var i=fp;break;case 8:i=pp;break;default:i=mp}n=i.bind(null,t,n,e),i=void 0,!nn||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 Od(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=ft(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}$t(function(){var r=a,i=Jt(n),s=[];a:{var c=zr.get(e);if(c!==void 0){var l=mn,u=e;switch(e){case`keypress`:if(ln(n)===0)break a;case`keydown`:case`keyup`:l=Mn;break;case`focusin`:u=`focus`,l=Cn;break;case`focusout`:u=`blur`,l=Cn;break;case`beforeblur`:case`afterblur`:l=Cn;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=xn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Sn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=Pn;break;case Mr:case Nr:case Pr:l=wn;break;case Rr:l=Fn;break;case`scroll`:case`scrollend`:l=gn;break;case`wheel`:l=In;break;case`copy`:case`cut`:case`paste`:l=Tn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Nn;break;case`toggle`:case`beforetoggle`:l=Ln}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=en(m,p),g!=null&&d.push(kd(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!==qt&&(u=n.relatedTarget||n.fromElement)&&(ft(u)||u[at]))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?ft(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=xn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Nn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:mt(l),h=u==null?c:mt(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,ft(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=jd,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&&Md(s,c,l,d,!1),u!==null&&f!==null&&Md(s,f,u,d,!0)}}a:{if(c=r?mt(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=rr;else if(Zn(c)){if(ir)v=fr;else{v=ur;var y=lr}}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&Ht(r.elementType)&&(v=rr):v=dr;if(v&&=v(e,r)){Qn(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&Ft(c,`number`,c.value)}switch(y=r?mt(r):window,e){case`focusin`:(Zn(y)||y.contentEditable===`true`)&&(Sr=y,Cr=r,wr=null);break;case`focusout`:wr=Cr=Sr=null;break;case`mousedown`:Tr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Tr=!1,Er(s,n,i);break;case`selectionchange`:if(xr)break;case`keydown`:case`keyup`:Er(s,n,i)}var b;if(zn)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 qn?Gn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Hn&&n.locale!==`ko`&&(qn||x!==`onCompositionStart`?x===`onCompositionEnd`&&qn&&(b=cn()):(an=i,on=`value`in an?an.value:an.textContent,qn=!0)),y=Ad(r,x),0<y.length&&(x=new En(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=Kn(n),b!==null&&(x.data=b)))),(b=Vn?Jn(e,n):Yn(e,n))&&(x=Ad(r,`onBeforeInput`),0<x.length&&(y=new En(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),vd(s,e,r,n,i)}Cd(s,t)})}function kd(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Ad(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=en(e,n),i!=null&&r.unshift(kd(e,i,a)),i=en(e,t),i!=null&&r.push(kd(e,i,a))),e.tag===3)return r;e=e.return}return[]}function jd(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Md(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=en(n,a),l!=null&&o.unshift(kd(n,l,c))):i||(l=en(n,a),l!=null&&o.push(kd(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Nd=/\r\n?/g,Pd=/\u0000|\uFFFD/g;function Fd(e){return(typeof e==`string`?e:``+e).replace(Nd,`
|
|
9
|
-
`).replace(Pd,``)}function Id(e,t){return t=Fd(t),Fd(e)===t}function Ld(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||zt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&zt(e,``+r);break;case`className`:Tt(e,`class`,r);break;case`tabIndex`:Tt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Tt(e,n,r);break;case`style`:G(e,r,o);break;case`data`:if(t!==`object`){Tt(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=Gt(``+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`&&Ld(e,t,`name`,a.name,a,null),Ld(e,t,`formEncType`,a.formEncType,a,null),Ld(e,t,`formMethod`,a.formMethod,a,null),Ld(e,t,`formTarget`,a.formTarget,a,null)):(Ld(e,t,`encType`,a.encType,a,null),Ld(e,t,`method`,a.method,a,null),Ld(e,t,`target`,a.target,a,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Gt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Kt);break;case`onScroll`:r!=null&&J(`scroll`,e);break;case`onScrollEnd`:r!=null&&J(`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=Gt(``+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`:J(`beforetoggle`,e),J(`toggle`,e),H(e,`popover`,r);break;case`xlinkActuate`:Et(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Et(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Et(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Et(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Et(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Et(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Et(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Et(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Et(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:H(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=Ut.get(n)||n,H(e,n,r))}}function Rd(e,t,n,r,a,o){switch(n){case`style`:G(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`?zt(e,r):(typeof r==`number`||typeof r==`bigint`)&&zt(e,``+r);break;case`onScroll`:r!=null&&J(`scroll`,e);break;case`onScrollEnd`:r!=null&&J(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=Kt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!vt.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[it]||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,``):H(e,n,r)}}}function zd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:J(`error`,e),J(`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:Ld(e,t,o,s,n,null)}}a&&Ld(e,t,`srcSet`,n.srcSet,n,null),r&&Ld(e,t,`src`,n.src,n,null);return;case`input`:J(`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:Ld(e,t,r,d,n,null)}}Pt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in J(`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:Ld(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&It(e,!!r,n,!0):It(e,!!r,t,!1);return;case`textarea`:for(s in J(`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:Ld(e,t,s,c,n,null)}Rt(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:Ld(e,t,l,r,n,null)}return;case`dialog`:J(`beforetoggle`,e),J(`toggle`,e),J(`cancel`,e),J(`close`,e);break;case`iframe`:case`object`:J(`load`,e);break;case`video`:case`audio`:for(r=0;r<xd.length;r++)J(xd[r],e);break;case`image`:J(`error`,e),J(`load`,e);break;case`details`:J(`toggle`,e);break;case`embed`:case`source`:case`link`:J(`error`,e),J(`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:Ld(e,t,u,r,n,null)}return;default:if(Ht(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Rd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Ld(e,t,c,r,n,null))}function Bd(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)||Ld(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&&Ld(e,t,p,m,r,f)}}Nt(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)||Ld(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&&Ld(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?It(e,!!n,n?[]:``,!1):It(e,!!n,t,!0)):It(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:Ld(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&&Ld(e,t,s,a,r,o)}Lt(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:Ld(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:Ld(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)&&Ld(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:Ld(e,t,u,p,r,m)}return;default:if(Ht(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Rd(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||Rd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Ld(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||Ld(e,t,f,p,r,m)}function Vd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Hd(){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&&Vd(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&&Vd(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 Ud=null,Wd=null;function Gd(e){return e.nodeType===9?e:e.ownerDocument}function Kd(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 qd(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 Jd(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 Y=null;function Yd(){var e=window.event;return e&&e.type===`popstate`?e!==Y&&(Y=e,!0):(Y=null,!1)}var Xd=typeof setTimeout==`function`?setTimeout:void 0,Zd=typeof clearTimeout==`function`?clearTimeout:void 0,Qd=typeof Promise==`function`?Promise:void 0,$d=typeof queueMicrotask==`function`?queueMicrotask:Qd===void 0?Xd:function(e){return Qd.resolve(null).then(e).catch(ef)};function ef(e){setTimeout(function(){throw e})}function tf(e){return e===`head`}function nf(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),Lp(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)_f(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,_f(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[ut]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&_f(e.ownerDocument.body)}n=i}while(n);Lp(t)}function rf(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 af(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`:af(n),dt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function of(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[ut])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=ff(e.nextSibling),e===null)break}return null}function sf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=ff(e.nextSibling),e===null))return null;return e}function cf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=ff(e.nextSibling),e===null))return null;return e}function lf(e){return e.data===`$?`||e.data===`$~`}function uf(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function df(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 ff(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 pf=null;function mf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return ff(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function hf(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 gf(e,t,n){switch(t=Gd(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 _f(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);dt(e)}var vf=new Map,yf=new Set;function bf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var xf=L.d;L.d={f:Sf,r:Cf,D:Ef,C:Df,L:Of,m:kf,X:jf,S:Af,M:Mf};function Sf(){var e=xf.f(),t=Cu();return e||t}function Cf(e){var t=pt(e);t!==null&&t.tag===5&&t.type===`form`?Ss(t):xf.r(e)}var wf=typeof document>`u`?null:document;function Tf(e,t,n){var r=wf;if(r&&typeof t==`string`&&t){var i=Mt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),yf.has(i)||(yf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),zd(t,`link`,e),gt(t),r.head.appendChild(t)))}}function Ef(e){xf.D(e),Tf(`dns-prefetch`,e,null)}function Df(e,t){xf.C(e,t),Tf(`preconnect`,e,t)}function Of(e,t,n){xf.L(e,t,n);var r=wf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Mt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Mt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Mt(n.imageSizes)+`"]`)):i+=`[href="`+Mt(e)+`"]`;var a=i;switch(t){case`style`:a=Pf(e);break;case`script`:a=Rf(e)}vf.has(a)||(e=h({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),vf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Ff(a))||t===`script`&&r.querySelector(zf(a))||(t=r.createElement(`link`),zd(t,`link`,e),gt(t),r.head.appendChild(t)))}}function kf(e,t){xf.m(e,t);var n=wf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Mt(r)+`"][href="`+Mt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Rf(e)}if(!vf.has(a)&&(e=h({rel:`modulepreload`,href:e},t),vf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(zf(a)))return}r=n.createElement(`link`),zd(r,`link`,e),gt(r),n.head.appendChild(r)}}}function Af(e,t,n){xf.S(e,t,n);var r=wf;if(r&&e){var i=ht(r).hoistableStyles,a=Pf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Ff(a)))s.loading=5;else{e=h({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=vf.get(a))&&Hf(e,n);var c=o=r.createElement(`link`);gt(c),zd(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,Vf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function jf(e,t){xf.X(e,t);var n=wf;if(n&&e){var r=ht(n).hoistableScripts,i=Rf(e),a=r.get(i);a||(a=n.querySelector(zf(i)),a||(e=h({src:e,async:!0},t),(t=vf.get(i))&&Uf(e,t),a=n.createElement(`script`),gt(a),zd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Mf(e,t){xf.M(e,t);var n=wf;if(n&&e){var r=ht(n).hoistableScripts,i=Rf(e),a=r.get(i);a||(a=n.querySelector(zf(i)),a||(e=h({src:e,async:!0,type:`module`},t),(t=vf.get(i))&&Uf(e,t),a=n.createElement(`script`),gt(a),zd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Nf(e,t,n,r){var a=(a=oe.current)?bf(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=Pf(n.href),n=ht(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=Pf(n.href);var o=ht(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(Ff(e)))&&!o._p&&(s.instance=o,s.state.loading=5),vf.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},vf.set(e,n),o||Lf(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=Rf(n),n=ht(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 Pf(e){return`href="`+Mt(e)+`"`}function Ff(e){return`link[rel="stylesheet"][`+e+`]`}function If(e){return h({},e,{"data-precedence":e.precedence,precedence:null})}function Lf(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}),zd(t,`link`,n),gt(t),e.head.appendChild(t))}function Rf(e){return`[src="`+Mt(e)+`"]`}function zf(e){return`script[async]`+e}function Bf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Mt(n.href)+`"]`);if(r)return t.instance=r,gt(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`),gt(r),zd(r,`style`,a),Vf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Pf(n.href);var o=e.querySelector(Ff(a));if(o)return t.state.loading|=4,t.instance=o,gt(o),o;r=If(n),(a=vf.get(a))&&Hf(r,a),o=(e.ownerDocument||e).createElement(`link`),gt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),zd(o,`link`,r),t.state.loading|=4,Vf(o,n.precedence,e),t.instance=o;case`script`:return o=Rf(n.src),(a=e.querySelector(zf(o)))?(t.instance=a,gt(a),a):(r=n,(a=vf.get(o))&&(r=h({},n),Uf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),gt(a),zd(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,Vf(r,n.precedence,e));return t.instance}function Vf(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 Hf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Uf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Wf=null;function Gf(e,t,n){if(Wf===null){var r=new Map,i=Wf=new Map;i.set(n,r)}else i=Wf,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[ut]||a[rt]||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 Kf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function qf(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 Jf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Yf(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=Pf(r.href),a=t.querySelector(Ff(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Qf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,gt(a);return}a=t.ownerDocument||t,r=If(r),(i=vf.get(i))&&Hf(r,i),a=a.createElement(`link`),gt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),zd(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=Qf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Xf=0;function Zf(e,t){return e.stylesheets&&e.count===0&&ep(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&ep(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Xf===0&&(Xf=62500*Hd());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ep(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Xf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Qf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ep(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var $f=null;function ep(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,$f=new Map,t.forEach(tp,e),$f=null,Qf.call(e))}function tp(e,t){if(!(t.state.loading&4)){var n=$f.get(e);if(n)var r=n.get(null);else{n=new Map,$f.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=Qf.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 np={$$typeof:C,Provider:null,Consumer:null,_currentValue:ee,_currentValue2:ee,_threadCount:0};function rp(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=Ke(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ke(0),this.hiddenUpdates=Ke(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 ip(e,t,n,r,i,a,o,s,c,l,u,d){return e=new rp(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=ei(3,null,null,t),e.current=a,a.stateNode=e,t=ta(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Pa(a),e}function ap(e){return e?(e=Qr,e):Qr}function op(e,t,n,r,i,a){i=ap(i),r.context===null?r.context=i:r.pendingContext=i,r=Ia(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=La(e,r,t),n!==null&&(vu(n,e,t),Ra(n,e,t))}function sp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function cp(e,t){sp(e,t),(e=e.alternate)&&sp(e,t)}function lp(e){if(e.tag===13||e.tag===31){var t=Yr(e,67108864);t!==null&&vu(t,e,67108864),cp(e,67108864)}}function up(e){if(e.tag===13||e.tag===31){var t=gu();t=Qe(t);var n=Yr(e,t);n!==null&&vu(n,e,t),cp(e,t)}}var dp=!0;function fp(e,t,n,r){var i=I.T;I.T=null;var a=L.p;try{L.p=2,mp(e,t,n,r)}finally{L.p=a,I.T=i}}function pp(e,t,n,r){var i=I.T;I.T=null;var a=L.p;try{L.p=8,mp(e,t,n,r)}finally{L.p=a,I.T=i}}function mp(e,t,n,r){if(dp){var i=hp(r);if(i===null)Od(e,t,r,gp,n),Dp(e,r);else if(kp(i,e,t,n,r))r.stopPropagation();else if(Dp(e,r),t&4&&-1<Ep.indexOf(e)){for(;i!==null;){var a=pt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Ve(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Pe(o);s.entanglements[1]|=c,o&=~c}sd(a),!(Ll&6)&&(iu=Se()+500,cd(0,!1))}}break;case 31:case 13:s=Yr(a,2),s!==null&&vu(s,a,2),Cu(),cp(a,2)}if(a=hp(r),a===null&&Od(e,t,r,gp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Od(e,t,r,null,n)}}function hp(e){return e=Jt(e),_p(e)}var gp=null;function _p(e){if(gp=null,e=ft(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=c(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 gp=e,null}function vp(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(Ce()){case we:return 2;case Te:return 8;case Ee:case De:return 32;case Oe:return 268435456;default:return 32}default:return 32}}var yp=!1,bp=null,xp=null,Sp=null,Cp=new Map,wp=new Map,Tp=[],Ep=`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 Dp(e,t){switch(e){case`focusin`:case`focusout`:bp=null;break;case`dragenter`:case`dragleave`:xp=null;break;case`mouseover`:case`mouseout`:Sp=null;break;case`pointerover`:case`pointerout`:Cp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:wp.delete(t.pointerId)}}function Op(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=pt(t),t!==null&&lp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function kp(e,t,n,r,i){switch(t){case`focusin`:return bp=Op(bp,e,t,n,r,i),!0;case`dragenter`:return xp=Op(xp,e,t,n,r,i),!0;case`mouseover`:return Sp=Op(Sp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Cp.set(a,Op(Cp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,wp.set(a,Op(wp.get(a)||null,e,t,n,r,i)),!0}return!1}function Ap(e){var t=ft(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,tt(e.priority,function(){up(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,tt(e.priority,function(){up(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 jp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=hp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);qt=r,n.target.dispatchEvent(r),qt=null}else return t=pt(n),t!==null&&lp(t),e.blockedOn=n,!1;t.shift()}return!0}function Mp(e,t,n){jp(e)&&n.delete(t)}function Np(){yp=!1,bp!==null&&jp(bp)&&(bp=null),xp!==null&&jp(xp)&&(xp=null),Sp!==null&&jp(Sp)&&(Sp=null),Cp.forEach(Mp),wp.forEach(Mp)}function Pp(e,n){e.blockedOn===n&&(e.blockedOn=null,yp||(yp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Np)))}var Fp=null;function Ip(e){Fp!==e&&(Fp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Fp===e&&(Fp=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(_p(r||n)===null)continue;break}var a=pt(n);a!==null&&(e.splice(t,3),t-=3,bs(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Lp(e){function t(t){return Pp(t,e)}bp!==null&&Pp(bp,e),xp!==null&&Pp(xp,e),Sp!==null&&Pp(Sp,e),Cp.forEach(t),wp.forEach(t);for(var n=0;n<Tp.length;n++){var r=Tp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Tp.length&&(n=Tp[0],n.blockedOn===null);)Ap(n),n.blockedOn===null&&Tp.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[it]||null;if(typeof a==`function`)o||Ip(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[it]||null)s=o.formAction;else if(_p(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Ip(n)}}}function Rp(){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 zp(e){this._internalRoot=e}Bp.prototype.render=zp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;op(n,gu(),e,t,null,null)},Bp.prototype.unmount=zp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;op(e.current,2,null,e,null,null),Cu(),t[at]=null}};function Bp(e){this._internalRoot=e}Bp.prototype.unstable_scheduleHydration=function(e){if(e){var t=et();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Tp.length&&t!==0&&t<Tp[n].priority;n++);Tp.splice(n,0,e),n===0&&Ap(e)}};var Vp=n.version;if(Vp!==`19.2.8`)throw Error(i(527,Vp,`19.2.8`));L.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=f(t),e=e===null?null:m(e),e=e===null?null:e.stateNode,e};var Hp={bundleType:0,version:`19.2.8`,rendererPackageName:`react-dom`,currentDispatcherRef:I,reconcilerVersion:`19.2.8`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Up=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Up.isDisabled&&Up.supportsFiber)try{je=Up.inject(Hp),Me=Up}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Us,s=Ws,c=Gs;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=ip(e,1,!1,null,null,n,r,null,o,s,c,Rp),e[at]=t.current,Ed(e),new zp(t)}})),h=t(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=m()}))(),g=l();function _(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 v(e){return(0,g.useSyncExternalStore)(e.subscribe,e.get)}var y=n({en:()=>b,zh:()=>x}),b={dialog:{cancel:`cancel`,save:`save`,close:`close`},whatsNew:{continue:`Continue`,openRelease:`Open release notes`,keys:`q / esc`},menu:{closeTab:`Close tab`,newChat:`New conversation`,newChatPick:`New conversation with…`,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`,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`,createOnly:`Create without starting`,needRepo:`Pick a project first`,needPrompt:`Describe the task first`,repo:`Project`,repoSearch:`Search projects or type a path`,repoEmpty:`No matching project`,cloneRow:`Clone {source}`,cloning:`Cloning {source}…`,githubGroup:`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`,effort:`Effort`,modelDefault:`Default`,effortDefault:`Default`,moreWays:`Clone or adopt a worktree…`,attach:`Attach`,attachHint:`Add images or PDFs to the first message; you can also paste or drop them on the prompt`,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`,machine:`Machine`,thisMachine:`This machine`,cloneRowOn:`Clone {source} on {machine}`,cloningOn:`Cloning {source} on {machine}…`,startingOn:`Starting the task on {machine}…`,repoSearchRemote:`Search or type owner/repo`,cloneTag:`clone`,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`},search:{nav:`Search`,title:`search conversations`,placeholder:`Find something said in any task`,hint:`Searches what you and the agents wrote, newest first; tool output is left out. A hit opens its task.`,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.`},machines:{nav:`Machines`,troubled:`{count} not connected`,title:`machines`,hint:`Every computer this Rove watches. Add or remove one in a terminal here: rove machine add / rove machine remove.`,tasks:`{count} task(s)`,fix:`Fix it from a terminal on this computer:`,reason:{unresolved:`Its name does not resolve. Check the host in ~/.ssh/config, or add it again with the right address.`,refused:`Nothing answers SSH there. Turn on Remote Login (macOS) or start sshd (Windows: Start-Service sshd).`,timeout:`SSH timed out: the machine is asleep, off, or on another network.`,"host-key-changed":`Its host key changed. Rove will not trust it on its own: check why, then fix known_hosts.`,"host-key-unverified":`Its host key is not trusted yet. Connect once with ssh from a terminal here, check the fingerprint and accept it, then check again.`,"auth-denied":`SSH refused this Rove's key. The fix offers to install one (you type that machine's password once).`,"ssh-failed":`SSH failed for a reason Rove could not tell.`,"no-rove":`Rove is not installed there, or not on the PATH SSH sees. The fix offers to install it.`,"no-daemon":`Rove is there, but its daemon would not start.`,"bad-status":`Its Rove answered with something this one cannot read. Update both.`,handshake:`Connected, but its daemon refused to talk: usually two Rove versions too far apart.`,"no-forwarding":`SSH on this computer cannot forward Rove's socket (Windows).`,lost:`The connection dropped. Rove keeps retrying on its own.`,unknown:`Not reachable right now. Rove keeps retrying on its own.`}},dispatch:{nav:`Dispatch`,title:`dispatch`,hint:`who hands prompts to whom · click a session to open it · q close`,recent:`recent`,emptyHint:`rove api send, add and dispatch from an agent, and routine firings, run across this map`,you:`you`,idle:`idle`,inFlightCount:`{count} in flight`},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`}},x={dialog:{cancel:`取消`,save:`保存`,close:`关闭`},whatsNew:{continue:`继续`,openRelease:`打开发布说明`,keys:`q / esc`},menu:{closeTab:`关闭该标签页`,newChat:`新建会话`,newChatPick:`选择引擎新建会话…`,newShell:`新建终端`,newChatNoFolder:`新建会话(无文件夹)`,renameTab:`重命名标签页`,splitRight:`向右分屏`,splitDown:`向下分屏`,renamePane:`重命名分屏`,closePane:`关闭分屏`,newTask:`新建任务`,rename:`重命名`,pin:`置顶`,unpin:`取消置顶`,setStatus:`设置状态`,copy:`复制`,copyWhat:{id:`任务 ID`,branch:`分支名`,path:`worktree 路径`},renameBranch:`重命名分支`,changeEngine:`切换引擎`,land:`合入基础分支`,delete:`删除`,removeSession:`移除会话`,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:`开始会话`,createOnly:`仅创建,不启动`,needRepo:`先选一个项目`,needPrompt:`先描述一下任务`,repo:`项目`,repoSearch:`搜索项目,或输入路径`,repoEmpty:`没有匹配的项目`,cloneRow:`克隆 {source}`,cloning:`正在克隆 {source}…`,githubGroup:`你的 GitHub 仓库`,branch:`分支`,branchSearch:`搜索分支`,branches:`分支`,branchName:`分支名,所有仓库共用`,branchNamePlaceholder:`不填就从提示词生成`,primary:`主仓库`,repoCount:`{count} 个仓库,第一个是主仓库`,branchEmpty:`没有匹配的分支`,model:`模型`,modelHeading:`本次会话的模型`,engine:`引擎`,effort:`强度`,modelDefault:`默认`,effortDefault:`默认`,moreWays:`克隆,或接管 worktree…`,attach:`附件`,attachHint:`给第一条消息加图片或 PDF;也可以直接粘贴或拖到输入框里`,worktree:`Worktree`,worktreeOn:`在独立的 worktree 和分支里运行。点击改为直接在项目目录里运行`,worktreeOff:`直接在项目目录里运行,用它当前的分支。点击改为独立 worktree`,worktreeMulti:`跨多个仓库的任务每个仓库都会有 worktree`,machine:`机器`,thisMachine:`本机`,cloneRowOn:`在 {machine} 上克隆 {source}`,cloningOn:`正在 {machine} 上克隆 {source}…`,startingOn:`正在 {machine} 上启动任务…`,repoSearchRemote:`搜索,或输入 owner/repo`,cloneTag:`克隆`,remoteOffline:`{machine} 已离线`,remoteOutdated:`{machine} 上的 Rove 太旧,列不出它的项目`,remoteFailed:`读不到 {machine} 上的项目:{message}`,remoteNone:`{machine} 上还没有项目。输入 owner/repo 就能在那里克隆`,remoteLoading:`正在读取 {machine} 上的项目…`,branchTypeRef:`输入要基于的分支或 ref`,branchRemoteDefault:`它当前的分支`},search:{nav:`搜索`,title:`搜索会话`,placeholder:`在所有任务的对话里找`,hint:`搜你和 agent 写过的话,新的在前;不含工具输出。点结果打开那个任务。`,searching:`搜索中…`,none:`没有说过「{query}」。`,you:`你`,agent:`agent`,truncated:`为了快提前停了;多加一个词缩小范围。`,skipped:`有 {count} 个任务没搜:在别的机器上,或 Rove 读不了它的引擎记录。`},machines:{nav:`机器`,troubled:`{count} 台没连上`,title:`机器`,hint:`这个 Rove 看着的每一台电脑。增删请在这台电脑的终端里:rove machine add / rove machine remove。`,tasks:`{count} 个任务`,fix:`在这台电脑的终端里修:`,reason:{unresolved:`名字解析不出来。检查 ~/.ssh/config 里的 host,或用正确的地址重新添加。`,refused:`那边没有 SSH 在听。打开「远程登录」(macOS),或启动 sshd(Windows:Start-Service sshd)。`,timeout:`SSH 超时:机器睡着了、关机了,或不在同一个网络。`,"host-key-changed":`它的 host key 变了。Rove 不会自己信任它:先查清原因,再改 known_hosts。`,"host-key-unverified":`它的 host key 还没被信任。先在这台电脑的终端里用 ssh 连一次,核对指纹并接受,再重新检查。`,"auth-denied":`SSH 拒绝了这个 Rove 的密钥。修复命令会帮你装一把(输一次那台机器的密码)。`,"ssh-failed":`SSH 失败,Rove 看不出原因。`,"no-rove":`那边没装 Rove,或 SSH 的 PATH 里找不到。修复命令会帮你装。`,"no-daemon":`那边有 Rove,但 daemon 起不来。`,"bad-status":`它的 Rove 回了这边读不懂的内容。两边都更新一下。`,handshake:`连上了,但它的 daemon 拒绝通信:通常是两边 Rove 版本差太多。`,"no-forwarding":`这台电脑的 SSH 转发不了 Rove 的 socket(Windows)。`,lost:`连接断了。Rove 会自己一直重试。`,unknown:`现在连不上。Rove 会自己一直重试。`}},dispatch:{nav:`调度`,title:`调度`,hint:`谁在给谁派活 · 点节点打开会话 · q 关闭`,recent:`最近`,emptyHint:`agent 用 rove api send、add、dispatch 派活,或 routine 触发时,会从这张图上跑过`,you:`你`,idle:`空闲`,inFlightCount:`{count} 条在路上`},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 上用系统应用打开`}},S=n({en:()=>C,zh:()=>w}),C={files:{createPR:`Ask agent to create PR`,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.`,all:`All`,changes:`Changes`,scopeWorking:`scope: working tree`,scopeBranch:`scope: vs {base}`,toggleScope:`b to toggle`,toggleScopeTouch:`switch`,noBase:`no base ref for branch scope`,legend:`M modified · A added · D deleted · ? untracked`,diffAll:`[D] diff everything`,diffAllTouch:`diff everything`,emptyAll:`(empty worktree)`,emptyChanges:`(no changes — clean worktree)`},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})`,noteTitle:`note on {location}`,noteSubmit:`add note`,askInChat:`ask in chat`,askInChatHint:`Put the selected lines in the engine's prompt`,sent:`sent {count} notes to the engine`,notSent:`notes not sent: {reason}`},panel:{tabs:`Side panel views`,files:`Files`,diff:`Diff`,browser:`Browser`,resize:`Drag to resize the panel, double-click to reset`,empty:`Nothing open. Use + to open Files, a diff or a Browser.`,new:`New tab`,newFiles:`New Files`,newDiff:`Diff of whole worktree`,newBrowser:`New Browser`,close:`Close`,hide:`Close the side panel`,expand:`Expand the side panel`,restore:`Restore the side panel size`,closeOthers:`Close others`,splitDown:`Split down`,moveBottom:`Move to bottom`,moveTop:`Move to top`,resizeSplit:`Drag to resize, double-click to split evenly`},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.`,empty:`Enter a web address, or a local dev server.`,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.`}},w={files:{createPR:`让代理创建 PR`,prRequested:`已让代理去创建 PR`,remoteNoExternal:`这个文件在 {host} 上,请到那台机器上打开`,mentionNoEngine:`这个任务没有打开的引擎会话——没有地方可以提及。`,all:`全部`,changes:`变更`,scopeWorking:`范围:工作区`,scopeBranch:`范围:对比 {base}`,toggleScope:`b 切换`,toggleScopeTouch:`切换`,noBase:`没有基础分支,无法按分支范围查看`,legend:`M 修改 · A 新增 · D 删除 · ? 未跟踪`,diffAll:`[D] 查看全部差异`,diffAllTouch:`查看全部差异`,emptyAll:`(空工作区)`,emptyChanges:`(没有变更——工作区是干净的)`},preview:{loading:`加载中…`,whole:`整个工作区`,unknown:`没有可显示的内容`,binary:`二进制文件——不以文本显示`,empty:`没有变更`,noHunks:`没有文本变更({kind})`,noteTitle:`批注 {location}`,noteSubmit:`添加批注`,askInChat:`在对话里问`,askInChatHint:`把选中的几行放进引擎的输入框`,sent:`已把 {count} 条批注发给引擎`,notSent:`批注没有发出:{reason}`},panel:{tabs:`侧边栏视图`,files:`文件`,diff:`差异`,browser:`浏览器`,resize:`拖动调整侧边栏宽度,双击复位`,empty:`没有打开的内容。点 + 打开文件、差异或浏览器。`,new:`新建标签页`,newFiles:`新建文件`,newDiff:`整个工作区的差异`,newBrowser:`新建浏览器`,close:`关闭`,hide:`关闭侧边栏`,expand:`展开侧边栏`,restore:`还原侧边栏大小`,closeOthers:`关闭其他`,splitDown:`向下分屏`,moveBottom:`移到下方`,moveTop:`移到上方`,resizeSplit:`拖动调整高度,双击恢复均分`},browser:{address:`地址`,placeholder:`https://… 或 localhost:3000`,back:`后退`,forward:`前进`,reload:`刷新`,openTab:`在新标签页打开`,invalid:`这不是网页地址;这里只能打开 http 和 https 页面。`,empty:`输入网页地址,或本地开发服务器的地址。`,noFrame:`这里只能打开 https 页面;这个地址用的是 http。点 ↗ 在新标签页打开。`,self:`这个地址就是 Rove 本身,不能嵌入。点 ↗ 在新标签页打开。`,refuses:`{host} 不允许嵌入其他页面。`,unreachable:`从这里访问不到 {host}。`,remote:`{host} 运行在 Rove 所在的机器上,不在这台设备上。`}},T=n({en:()=>E,zh:()=>D}),E={rail:{inbox:`inbox {count}`,empty:`no tasks yet`,emptyHint:`New task above: pick a project folder, then say what to do`,newTask:`New task`,settings:`Settings`,noProject:`Ungrouped`,extraRepos:`{count} more repos in this task`,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 clear · esc close`,attention:`attention`,recent:`recent`,empty:`no pending attention`,state:{done:`done`,needsInput:`needs input`,error:`error`,rateLimited:`rate limited`,dead:`engine exited`,routineFailed:`routine needs you`}}},D={rail:{inbox:`收件箱 {count}`,empty:`还没有任务`,emptyHint:`点上面的「新建任务」:选一个项目文件夹,再写要做什么`,newTask:`新建任务`,settings:`设置`,noProject:`未分组`,extraRepos:`这个任务还含 {count} 个仓库`,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:`暂无待处理`,state:{done:`完成`,needsInput:`需要输入`,error:`出错`,rateLimited:`限流`,dead:`引擎已退出`,routineFailed:`例行任务需要处理`}}},O=n({en:()=>k,zh:()=>A}),k={settings:{title:`Settings`,open:`settings`,sections:{connectors:`Connectors`},connectors:{githubDescription:`Clone, push and open PRs on every machine with one GitHub account`,connect:`Connect`,disconnect:`Disconnect`,disconnectBody:`Signs this machine's gh out of GitHub, for every tool that uses gh and not only Rove. Other machines keep their own sign-ins.`,machines:`Machines`,thisMachine:`This machine`,refresh:`Refresh`,useRove:`Use Rove's account`,loginThere:`Log in there`,codeHint:`Enter this code at GitHub (click the code to copy it)`,openGithub:`Open github.com/login/device`,codeCopied:`Code copied`,syncing:`Signed in. Bringing the other machines along…`,loginFailed:`Sign-in failed: {error}`,dismiss:`Dismiss`,loading:`checking…`,markSame:`✓ same account`,markDifferent:`⚠ @{login}`,markSignedOut:`✗ signed out`,markNoGh:`gh is not installed`,markOutdated:`Rove there is outdated`,markOffline:`offline`,markDenied:`refuses credential changes`,markFailed:`could not check`,detail:`{protocol}, ssh {ssh}`,synced:`{machine} now uses @{login}`},general:{daemon:`Daemon`,daemonCurrent:`rove {version}, same build as this page`,daemonStale:"rove {version} is out of date; run `rove daemon restart`",browser:`This browser`,browserHint:`Forget this browser's token. A login token is revoked on the host too.`,signOut:`Sign out`},engines:{enabled:`Offer {name} when picking an engine`,default:`Make {name} the default engine`,namePlaceholder:`Display name (blank = default)`,rename:`Rename`,reset:`Reset to defaults`,remove:`Remove engine`,save:`Save`,cancel:`Cancel`},plugins:{empty:`no other plugins registered`,install:`install`,uninstall:`uninstall`,modInstalled:`first-party mod, installed`,modAvailable:`first-party mod, not installed`},feedback:{hint:"Posts a public GitHub Discussion in the Rove repo, through `gh` on the machine running rove.",titleLabel:`title`,body:`what happened`,send:`send`,sent:`feedback posted {url}`}},prefs:{terminalOnly:`Terminal only: the TUI changes, this page has nothing to draw.`,languageHint:`Display language, shared with the TUI.`,soundHint:`chime, plus a desktop notification while this tab is in the background`,soundVolumeHint:`click cycles; plays the new level`,push:`Notify when this page is closed`,pushHint:`This browser gets a notification when a task finishes, needs you or fails, even with no Rove page open. Follows the cross-task switch.`,pushUnsupported:`This browser can't receive push here: it needs https (or localhost), and on iPhone/iPad the page added to the home screen.`,pushBlocked:`Notifications are blocked for this site; allow them in the browser's site settings.`,pushFailed:`Couldn't turn it on: {error}`,zenHint:`Hide the Files pane. The zen chip and ctrl+a z toggle it and write this same setting.`,editorCustomSet:`(set)`,editInTui:`edit it in the TUI`,tierModel:`model`,tierEdit:`edit`,unset:`(none)`,modeAuto:`Auto (follow the browser)`,themePreviewHint:`Point at a theme to see this page in it; click to keep it. The TUI follows.`,themeUser:`yours`,themeMoreHint:`More from rove.run: point to preview, click to install and switch.`,themeGet:`get`,themeInstalling:`installing…`,themeInstallFailed:`failed, retry`,themeAgent:`Make one with an agent`,themeAgentHint:`opens a Scratch session; reopen Settings to see what it wrote.`,themeAgentFailed:`couldn't open the session; try again.`,themeAgentPrompt:"Make me a new Rove color theme. Ask me first what look I want, unless I already said. Save it as one JSON file in {dir} (for example {dir}/my-theme.json); the file name is the theme's name. The format is in https://github.com/sma1lboy/rove/blob/main/docs/themes.md and the JSON schema is https://raw.githubusercontent.com/sma1lboy/rove/main/packages/rove/src/tui/context/theme/theme.schema.json. Start from https://raw.githubusercontent.com/sma1lboy/rove/main/packages/rove/src/tui/context/theme/claude.json, give each color slot a { dark, light } pair, and keep text readable on every background. When it's saved, run `rove theme list` to check it loads, then tell me the name: it appears in Settings → General → Theme.",resetButton:`Reset`,resetHint:`Clears this Mac's saved settings and task list, restarts the Rove daemon, then reloads this page. Worktrees on disk and engine session history are not touched.`,resetBody:`Wipes ~/.config/rove/state.json and ~/.rove/tasks.json and restarts the daemon, then reloads this page with an empty task list. Worktrees on disk and engine session history are NOT touched.`,restartButton:`Restart`,restartHint:`Stops the Rove daemon and starts a fresh one; this page reconnects on its own. Running engine sessions live in the PTY host and survive it.`,restartBody:`Stops the Rove daemon and starts a fresh one, picking up daemon edits. This page reconnects in a few seconds. Running engine sessions survive.`,keysYaml:`The file is read on the Mac; changes apply when you come back to this page.`},keys:{createFile:`Create keybindings.yaml`,exists:`keybindings.yaml already exists; nothing was changed.`,pluginNoTask:`Select a task before using a plugin chord.`,pluginChords:`Plugin chords`,agent:`Change them with an agent`,agentHint:`opens a Scratch session; reopen Settings to see what it changed.`,agentFailed:`couldn't open the session; try again.`,agentPrompt:"Change my Rove keybindings. Ask me first what I want changed, unless I already said. Edit {path} (create it if it is missing; keep existing entries and comments you were not asked to change). The format, every binding id and its default chord are in https://github.com/sma1lboy/rove/blob/main/docs/KEYBINDINGS.md (see Customizing). Only use binding ids listed there; a direct override replaces that binding's whole chord list, and null unbinds. The file must stay valid YAML: check it parses (for example with `ruby -ryaml -e 'YAML.load_file(ARGV[0])' {path}` or any YAML parser you have). Rove reloads it live, and unknown ids or invalid chords are ignored with a warning, so when you are done tell me what you changed and ask me to reopen Settings → Keybindings: it lists every applied override and every warning."},pages:{attachTooLarge:`{name} is larger than 5 MB`,new:`[ new ]`,routinePause:`[ pause ]`,routineEnable:`[ enable ]`,delete:`[ delete ]`,routinesNeedYou:`NEEDS YOU`,routinesActive:`ACTIVE`,routinesPaused:`PAUSED`,routineSchedule:`Schedule`,routineNext:`Next run`,routineProject:`Project`,routineDelivers:`Delivers to`,routinePrompt:`PROMPT`,routineScript:`SCRIPT`,cronDown:`Decrease {field}`,cronUp:`Increase {field}`,storySave:`save`,storySaveStart:`save & start`,storyStart:`start`,attachHintTouch:`paste a path / a screenshot → inserts an image placeholder`,quickIntentTouch:`Creates an isolated worktree and branch.`}},A={settings:{title:`设置`,open:`设置`,sections:{connectors:`连接器`},connectors:{githubDescription:`用同一个 GitHub 账号在每台机器上克隆、推送和开 PR`,connect:`连接`,disconnect:`断开`,disconnectBody:`把这台机器的 gh 从 GitHub 退出登录,所有用 gh 的工具都会受影响,不只是 Rove。其他机器保持各自的登录。`,machines:`机器`,thisMachine:`本机`,refresh:`刷新`,useRove:`使用 Rove 的账号`,loginThere:`在那里登录`,codeHint:`到 GitHub 输入这个验证码(点击验证码可复制)`,openGithub:`打开 github.com/login/device`,codeCopied:`验证码已复制`,syncing:`已登录,正在同步其他机器…`,loginFailed:`登录失败:{error}`,dismiss:`关闭`,loading:`检查中…`,markSame:`✓ 同一账号`,markDifferent:`⚠ @{login}`,markSignedOut:`✗ 未登录`,markNoGh:`未安装 gh`,markOutdated:`那边的 Rove 版本过旧`,markOffline:`离线`,markDenied:`拒绝修改凭据`,markFailed:`无法检查`,detail:`{protocol}, ssh {ssh}`,synced:`{machine} 现在使用 @{login}`},general:{daemon:`守护进程`,daemonCurrent:`rove {version},与本页同一版本`,daemonStale:"rove {version} 版本过旧;运行 `rove daemon restart`",browser:`此浏览器`,browserHint:`忘掉此浏览器的令牌。登录得到的令牌也会在主机上吊销。`,signOut:`退出登录`},engines:{enabled:`选引擎时列出 {name}`,default:`把 {name} 设为默认引擎`,namePlaceholder:`显示名称(留空 = 默认)`,rename:`重命名`,reset:`恢复默认`,remove:`移除引擎`,save:`保存`,cancel:`取消`},plugins:{empty:`没有其他已注册的插件`,install:`安装`,uninstall:`卸载`,modInstalled:`官方 mod,已安装`,modAvailable:`官方 mod,未安装`},feedback:{hint:"通过运行 rove 那台机器上的 `gh`,在 Rove 仓库发一条公开的 GitHub Discussion。",titleLabel:`标题`,body:`发生了什么`,send:`发送`,sent:`反馈已发布 {url}`}},prefs:{terminalOnly:`仅终端:TUI 会变化,网页没有可画的东西。`,languageHint:`显示语言,与 TUI 共用同一设置。`,soundHint:`提示音;本页在后台时另发桌面通知`,soundVolumeHint:`点击切换;会播放新音量`,push:`页面关闭时也通知`,pushHint:`任务完成、需要你或出错时,即使没有打开任何 Rove 页面,这个浏览器也会收到通知。跟随「跨任务通知」开关。`,pushUnsupported:`这个浏览器在这里收不到推送:需要 https(或 localhost),iPhone/iPad 上还要先把页面添加到主屏幕。`,pushBlocked:`这个网站的通知被浏览器屏蔽了,去浏览器的网站设置里允许。`,pushFailed:`没能开启:{error}`,zenHint:`收起文件栏。zen 按钮和 ctrl+a z 切换时会写入同一个设置。`,editorCustomSet:`(已设置)`,editInTui:`请在 TUI 中编辑`,tierModel:`模型`,tierEdit:`编辑`,unset:`(无)`,modeAuto:`自动(跟随浏览器)`,themePreviewHint:`鼠标指向一个主题,整页就换成它看看;点一下就定下来。TUI 也会跟着换。`,themeUser:`自装`,themeMoreHint:`rove.run 上的更多主题:指向即预览,点一下安装并切换。`,themeGet:`安装`,themeInstalling:`安装中…`,themeInstallFailed:`失败,重试`,themeAgent:`让 agent 做一个`,themeAgentHint:`会开一个 Scratch 会话;做好后重新打开设置就能看到。`,themeAgentFailed:`会话没打开,再试一次。`,themeAgentPrompt:"帮我做一个新的 Rove 配色主题。先问我想要什么风格,除非我已经说过。把它存成 {dir} 下的一个 JSON 文件(比如 {dir}/my-theme.json),文件名就是主题名。格式说明见 https://github.com/sma1lboy/rove/blob/main/docs/themes.md,JSON schema 是 https://raw.githubusercontent.com/sma1lboy/rove/main/packages/rove/src/tui/context/theme/theme.schema.json。以 https://raw.githubusercontent.com/sma1lboy/rove/main/packages/rove/src/tui/context/theme/claude.json 为起点,每个颜色槽都给 { dark, light } 两个值,并保证文字在每种背景上都看得清。存好后运行 `rove theme list` 确认能加载,然后告诉我主题名:它会出现在 设置 → 通用 → 主题 里。",resetButton:`重置`,resetHint:`清空这台 Mac 上保存的设置和任务列表,重启 Rove 守护进程,然后刷新本页。磁盘上的工作树和引擎会话历史不受影响。`,resetBody:`清空 ~/.config/rove/state.json 和 ~/.rove/tasks.json 并重启守护进程,然后刷新本页,任务列表为空。磁盘上的工作树和引擎会话历史不会被动。`,restartButton:`重启`,restartHint:`停止 Rove 守护进程并启动新的进程,本页会自动重连。运行中的引擎会话在 PTY 宿主里,不受影响。`,restartBody:`停止 Rove 守护进程并启动新的进程,载入守护进程的改动。本页几秒后自动重连,运行中的引擎会话不受影响。`,keysYaml:`该文件在 Mac 上读取,改动会在你回到本页时生效。`},keys:{createFile:`创建 keybindings.yaml`,exists:`keybindings.yaml 已存在,未做任何改动。`,pluginNoTask:`使用插件快捷键前请先选中一个任务。`,pluginChords:`插件快捷键`,agent:`让 agent 来改`,agentHint:`会开一个 Scratch 会话;改好后重新打开设置就能看到。`,agentFailed:`会话没打开,再试一次。`,agentPrompt:"帮我改 Rove 的快捷键。先问我想改什么,除非我已经说过。编辑 {path}(不存在就新建;没让你改的条目和注释都保留)。格式、每个 binding id 及其默认按键见 https://github.com/sma1lboy/rove/blob/main/docs/KEYBINDINGS.md(Customizing 一节)。只用那里列出的 binding id;直接覆盖会替换该 binding 的整个按键列表,null 表示解绑。文件必须保持合法 YAML:确认它能解析(比如 `ruby -ryaml -e 'YAML.load_file(ARGV[0])' {path}`,或任何你有的 YAML 解析器)。Rove 会实时重新加载它,未知 id 或无效按键会被忽略并给出警告,所以改完后告诉我改了什么,并请我重新打开 设置 → 快捷键:那里会列出所有生效的覆盖和所有警告。"},pages:{attachTooLarge:`{name} 超过 5 MB`,new:`[ 新建 ]`,routinePause:`[ 暂停 ]`,routineEnable:`[ 启用 ]`,delete:`[ 删除 ]`,routinesNeedYou:`需要处理`,routinesActive:`运行中`,routinesPaused:`已暂停`,routineSchedule:`调度`,routineNext:`下次执行`,routineProject:`项目`,routineDelivers:`投递到`,routinePrompt:`提示词`,routineScript:`脚本`,cronDown:`减小{field}`,cronUp:`增大{field}`,storySave:`保存`,storySaveStart:`保存并启动`,storyStart:`启动`,attachHintTouch:`粘贴路径 / 截图 → 插入图片占位行`,quickIntentTouch:`创建独立 worktree 和分支。`}},j=n({en:()=>M,zh:()=>N}),M={workspace:{pickTask:`pick a task on the left`,noTabs:`no open sessions in this task`,startEngine:`Start {engine}`,startSession:`Start session`,tabNotLive:`this tab has no running session`,restored:`restored session, read-only until reopened`,exited:`session ended (exit {code})`,attachFailed:`could not open this session: {message}`,reopen:`Reopen session`,reopening:`Reopening…`,reopenFailed:`could not reopen this session: {message}`,engineExited:`engine exited (code {code})`,retry:`Retry`,engineSettings:`Settings → Engines`},tab:{shell:`shell`,engine:`engine`},status:{connecting:`connecting`,retrying:`reconnecting, attempt {count}`,retry:`retry now`,backlog:`Backlog`,inProgress:`In progress`,inReview:`In review`,done:`Done`,canceled:`Canceled`,error:`Error`},connect:{title:`open the link rove printed`,body:"Run `rove --web` and open the link it prints, or paste it here.",placeholder:`http://127.0.0.1:7878/#token=…`,submit:`connect`,invalid:"that is not a `rove --web` link",failing:"can't reach rove. Is `rove --web` still running? After `--rotate-token`, open the new link.",forget:`forget this link`},login:{title:`sign in`,body:"Enter the password set with `rove --web --set-password`.",field:`password`,submit:`sign in`,checking:`checking…`,wrong:`that did not work`,locked:`too many tries from here; try again in {minutes} min`,lockedHost:"password login is locked; run `rove --web --unlock` on the host",unreachable:"can't reach rove. Is `rove --web` still running?"},layout:{splitTooSmall:`Not enough room to split here`,railFold:`Fold the task list`,navBack:`Back`,navForward:`Forward`,railUnfold:`Unfold the task list`,dropUnsupported:`Only images and PDFs can be dropped into a terminal`,pasteNoImage:`No image on this browser's clipboard`,pasteNoAccess:`Can't read this browser's clipboard: {error}`,pasteNeedsHttps:`the page needs https or localhost`,refreshTimeout:"The daemon did not come back on the new build in time; check `rove daemon status`",railResize:`Drag to resize the task list, double-click to reset`,composerPlaceholder:`Message the agent`,composerSend:`Send`,composerAttach:`Attach an image or PDF`,composerNotSent:`Not sent: {reason}`,composerOldBridge:`This Mac's rove --web is older than this page; restart it to send from here.`,composerAtMenu:`The agent is waiting on a choice. Answer it with the 1–4 and ⏎ keys below; your message is kept.`,composerQueued:`The agent is working: sent when this turn ends (#{position} in line).`,queuedChip:`queued`,queueCancel:`Take this message back`,termKeys:`Terminal keys`,termKeyUp:`Up arrow`,termKeyDown:`Down arrow`,termKeyLeft:`Left arrow`,termKeyRight:`Right arrow`,termKeyInterrupt:`Ctrl+C, interrupt`,termKeyEnter:`Enter`,narrowTerminal:`Terminal`,narrowFiles:`Files`,narrowDiff:`Diff`,narrowBrowser:`Browser`}},N={workspace:{pickTask:`从左边选一个任务`,noTabs:`这个任务没有打开的会话`,startEngine:`启动 {engine}`,startSession:`启动会话`,tabNotLive:`这个标签没有在运行的会话`,restored:`已恢复的会话,重新打开前只读`,exited:`会话已结束(退出码 {code})`,attachFailed:`打不开这个会话:{message}`,reopen:`重新打开会话`,reopening:`正在重新打开…`,reopenFailed:`重新打开失败:{message}`,engineExited:`引擎已退出(退出码 {code})`,retry:`重试`,engineSettings:`设置 → 引擎`},tab:{shell:`终端`,engine:`引擎`},status:{connecting:`连接中`,retrying:`重连中,第 {count} 次`,retry:`立即重试`,backlog:`待办`,inProgress:`进行中`,inReview:`待评审`,done:`已完成`,canceled:`已取消`,error:`出错`},connect:{title:`打开 rove 打印的链接`,body:"运行 `rove --web`,打开它打印的链接,或者把链接粘贴到这里。",placeholder:`http://127.0.0.1:7878/#token=…`,submit:`连接`,invalid:"这不是 `rove --web` 打印的链接",failing:"连不上 rove。`rove --web` 还在运行吗?用过 `--rotate-token` 的话,请打开新的链接。",forget:`忘掉这个链接`},login:{title:`登录`,body:"输入用 `rove --web --set-password` 设置的密码。",field:`密码`,submit:`登录`,checking:`验证中…`,wrong:`登录失败`,locked:`这里尝试次数过多;{minutes} 分钟后再试`,lockedHost:"密码登录已锁定;在主机上运行 `rove --web --unlock`",unreachable:"连不上 rove。`rove --web` 还在运行吗?"},layout:{splitTooSmall:`这里放不下分屏了`,railFold:`折叠任务列表`,navBack:`后退`,navForward:`前进`,railUnfold:`展开任务列表`,dropUnsupported:`终端里只能拖入图片和 PDF`,pasteNoImage:`浏览器剪贴板里没有图片`,pasteNoAccess:`读不到浏览器剪贴板:{error}`,pasteNeedsHttps:`页面要走 https 或 localhost`,refreshTimeout:"守护进程没能及时以新版本重新上线,请检查 `rove daemon status`",railResize:`拖动调整任务列表宽度,双击还原`,composerPlaceholder:`给 agent 发消息`,composerSend:`发送`,composerAttach:`附加图片或 PDF`,composerNotSent:`没发出去:{reason}`,composerOldBridge:`这台 Mac 上的 rove --web 比页面旧,重启它之后才能从这里发送。`,composerAtMenu:`agent 正在等你选择。用下方的 1–4 和 ⏎ 键回答;你的消息已保留。`,composerQueued:`agent 正在干活:这一轮结束后发出(排第 {position})。`,queuedChip:`排队中`,queueCancel:`撤回这条消息`,termKeys:`终端按键`,termKeyUp:`上方向键`,termKeyDown:`下方向键`,termKeyLeft:`左方向键`,termKeyRight:`右方向键`,termKeyInterrupt:`Ctrl+C 中断`,termKeyEnter:`回车`,narrowTerminal:`终端`,narrowFiles:`文件`,narrowDiff:`差异`,narrowBrowser:`浏览器`}},P=[T,j,y,S,O],F=Object.assign({},...P.map(e=>e.en)),I={en:F,zh:Object.assign({},...P.map(e=>e.zh))};function L(){try{let e=JSON.parse(localStorage.getItem(`rove.prefs`)??`null`);if(e&&typeof e==`object`&&`prefs`in e){let t=e.prefs;if(t&&typeof t==`object`&&`locale`in t&&(t.locale===`en`||t.locale===`zh`))return t.locale}}catch{}return globalThis.navigator?.language?.toLowerCase().startsWith(`zh`)?`zh`:`en`}var ee=_(L());function te(){let e=typeof document>`u`?void 0:document.documentElement;e&&(e.lang=ee.get()===`zh`?`zh-CN`:`en`)}te(),ee.subscribe(te);function ne(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 re(e,t){return t?e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??e)):e}function R(e,t){return re(ne(I[ee.get()],e)??ne(F,e)??e,t)}function ie(e,t,n){return re(ne(e[ee.get()],t)??ne(e.en,t)??t,n)}function z(){return v(ee)}function ae(e){let t=e.trim(),n=t.indexOf(`#`),r=n>=0?new URLSearchParams(t.slice(n+1)).get(`token`):t;return r&&/^[A-Za-z0-9_-]{43}$/.test(r)?r:null}var oe=(...e)=>e.filter(Boolean).join(` `),se=t((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),B=t(((e,t)=>{t.exports=se()}))(),V=({danger:e=!1,box:t=!1}={})=>`rounded-sm font-sans text-meta not-italic normal-nums text-paper active:scale-97 motion-reduce:active:scale-none disabled:cursor-default disabled:opacity-50 touch:min-h-10 ${e?`bg-error`:`bg-accent`} ${t?`px-3 py-1.25 font-medium`:`px-3.5 py-1.5 font-semibold`}`,ce={link:`text-accent hover:underline`,filled:V(),floating:`whitespace-nowrap rounded-sm border-hairline border-line-active bg-surface px-2 py-0.5 font-mono text-meta text-ink shadow-popover`,row:``,card:`flex min-w-0 flex-col gap-1.5 rounded-sm border-hairline p-1.5 text-left focus-visible:outline-1 focus-visible:outline-offset-1 focus-visible:outline-focus`},le={roomy:`relative touch:after:absolute touch:after:content-[''] touch:after:-inset-x-1.5 touch:after:-inset-y-3`,tight:`relative touch:after:absolute touch:after:content-[''] touch:after:-inset-x-0.75 touch:after:-inset-y-0.5`,none:``};function ue({variant:e=`link`,hit:t=e===`link`?`roomy`:`none`,className:n,type:r=`button`,...i}){return(0,B.jsx)(`button`,{type:r,className:oe(ce[e],le[t],n),...i})}var de=`text-meta leading-[inherit]`,fe=`font-normal normal-nums`,pe=`touch:relative touch:after:absolute touch:after:content-['']`,me=`flex h-full flex-col`,he=e=>[`app relative grid min-h-0 flex-1 grid-rows-[1fr_auto] transition-[grid-template-columns] duration-220 ease-snap motion-reduce:transition-none`,e.surface?`is-narrow narrow-${e.surface} grid-cols-[minmax(0,1fr)]`:e.zen?`grid-cols-[var(--rail-w,minmax(220px,280px))_1fr]`:`grid-cols-[var(--rail-w,minmax(220px,280px))_1fr_var(--panel-w,clamp(300px,28vw,440px))]`,e.zen?`is-zen`:``,e.expanded?`is-panel-expanded`:``,e.folded?`is-rail-folded`:``,e.peek?`is-rail-peek`:``,e.dragging?`is-dragging transition-none`:``].join(` `),ge=[`relative narrow-content:hidden touch:select-none touch:touch-callout-none`,`wide:overflow-x-clip wide:pt-8.5 wide:[&>:not([data-grip])]:min-w-(--rail-open-w)`,`rail-folded:absolute rail-folded:inset-y-1.5 rail-folded:left-1.5 rail-folded:z-6 rail-folded:col-1 rail-folded:row-1 rail-folded:box-border rail-folded:w-(--rail-open-w) rail-folded:-translate-x-[calc(100%+12px)] rail-folded:rounded-md rail-folded:border-hairline rail-folded:border-line rail-folded:bg-surface rail-folded:shadow-none rail-folded:transition-[translate] rail-folded:duration-200 rail-folded:ease-snap rail-folded:motion-reduce:transition-none rail-folded:[&>:not([data-grip])]:min-w-0`,`rail-peek:translate-none rail-peek:shadow-dialog`].join(` `),_e=`rail-folded:col-2 panel-expanded:invisible panel-expanded:col-2 narrow-sidebar:hidden`,ve=`rail-folded:col-3 panel-expanded:z-2 panel-expanded:col-[2/-1] panel-expanded:bg-paper panel-expanded:pl-2`,ye=`${pe} touch:after:-inset-x-1.5 touch:after:-inset-y-3`,be=`flex items-center gap-2`,xe=`px-1.5 py-0.5 text-meta font-bold ${pe} touch:after:-inset-2.5 touch:after:-bottom-1`,Se=`rounded-sm px-2.5 py-1 font-mono text-meta font-semibold normal-nums text-muted aria-selected:bg-inset aria-selected:text-ink ${pe} touch:after:-inset-x-px touch:after:-top-2 touch:after:-bottom-1.5`,Ce=`keys-only m-0 overflow-hidden px-3.5 py-1 text-meta text-ellipsis whitespace-nowrap`,we=e=>`shortcut-badge absolute z-8 cursor-pointer rounded-sm border-hairline border-accent bg-surface px-1.25 py-px text-meta text-accent ${e?`top-full right-0`:`top-1/2 right-1 -translate-y-1/2`}`,Te=`relative min-w-0 flex-1`,Ee={left:[`[border-left:var(--hairline)_solid_var(--line)]`,`[border-left:var(--hairline)_solid_var(--accent)]`],top:[`[border-top:var(--hairline)_solid_var(--line)]`,`[border-top:var(--hairline)_solid_var(--accent)]`]},De=(e,t)=>Ee[e][+!!t],Oe=(e,t)=>{let n=`split-leaf absolute box-border flex min-h-0 min-w-0 ${t.active?`is-active`:``}`,r=t.active?`border-accent`:``;return e===`box`?`${n} rounded-[calc(var(--radius)-1px)] border-hairline ${t.active?`border-accent`:`border-line`}`:e===`line`?`${n} ${t.left?De(`left`,t.active):``} ${t.top?De(`top`,t.active):``} ${t.left||t.top?r:``}`:e===`rail`?`${n} ${De(`left`,t.active)} ${r} ${t.top?`[--mt:6px]`:``}`:e===`rule`?`${n} ${De(`top`,t.active)} ${r} ${t.left?`[--ml:8px]`:``}`:n},ke=(e,t)=>`absolute right-2 z-3 bg-paper px-1 font-mono text-meta ${fe} ${e?`-top-2`:`top-0.5`} ${t?`text-accent`:`text-subtle`}`,Ae=`absolute inset-x-2 bottom-2 z-5 flex items-center gap-2.5 rounded-sm border-hairline border-line bg-surface px-2.5 py-1 font-mono text-meta ${fe} touch:text-display`,je=`min-w-0 flex-1 border-none bg-transparent text-ink [font:inherit] outline-none`,Me=`hidden gap-1 overflow-x-auto scrollbar-none [border-top:var(--hairline)_solid_var(--line)] bg-surface px-1.5 py-1 touch:flex`,Ne=e=>`h-8 min-w-max touch-manipulation [flex:1_1_0] rounded-[6px] border-hairline bg-inset px-0.5 py-0 font-mono text-meta ${fe} ${e?`border-accent text-accent`:`border-line text-ink`}`,Pe=`prefix-guide fixed bottom-19 left-3 z-40 max-h-[60vh] w-[min(560px,calc(100vw-24px))] overflow-y-auto rounded-sm border-hairline border-line bg-surface px-3 py-2 text-meta shadow-popover motion-safe:animate-rise-in [&.is-leaving]:pointer-events-none [&.is-leaving]:animate-sink-out`,Fe=`min-w-[3ch] text-accent`,Ie=`mb-1.5 flex justify-between gap-4`,Le=`columns-[2_220px] gap-x-5`,Re=`mb-2 break-inside-avoid`,ze=`flex w-full gap-2.5 px-0 py-px text-left text-ink enabled:hover:bg-hover disabled:cursor-default touch:py-2.5`,Be=`mx-0 my-2 overflow-y-auto`,Ve=e=>`flex w-full justify-between gap-4 rounded-sm px-1.5 py-0.75 text-left font-mono text-meta ${fe} whitespace-pre text-ink touch:py-2.5 ${e?`is-selected bg-hover`:``}`,He=`flex justify-between gap-4`,Ue=`flex flex-col items-end ${de}`,We=`mt-2 max-h-[52vh] overflow-y-auto`,Ge=`mb-2.5`,Ke=`m-0 mb-1 font-sans text-meta font-bold normal-nums text-accent`,qe=`flex gap-3 py-px ${de}`,Je=`min-w-[14ch] text-ink`,Ye=`flex flex-wrap items-baseline gap-3 [border-bottom:var(--hairline)_solid_var(--warning)] bg-inset px-3.5 py-1 text-meta text-warning [&_span]:text-muted`,Xe=`keys-only fixed bottom-[34px] left-3 z-40 min-w-55 rounded-sm border-hairline border-line bg-surface px-3 py-2 font-mono text-meta ${fe} text-ink shadow-popover`,Ze=e=>`mb-0.5 ${e?`motion-safe:[animation:sink-out_140ms_ease-in_var(--hud-out,3860ms)_forwards]`:`motion-safe:[animation:rise-in_140ms_ease-out,sink-out_140ms_ease-in_var(--hud-out,3860ms)_forwards]`}`,Qe=`m-auto font-mono text-meta ${fe} text-subtle`,$e=`${Qe} flex flex-col items-center gap-3 [&_p]:m-0`,et=`workspace row-1 flex min-h-0 min-w-0 flex-col gap-1.5 px-1 pt-2 pb-1`,tt=`flex min-h-0 flex-1 overflow-hidden rounded-md border-hairline border-line bg-paper focus-within:border-focus`,nt=`working-flow:border-transparent working-flow:[background:linear-gradient(var(--paper),var(--paper))_0_0/100%_100%_padding-box,linear-gradient(90deg,var(--line),var(--task-ink,var(--focus)),var(--line),var(--task-ink,var(--focus)),var(--line))_0_0/300%_100%_border-box] working-flow:motion-safe:animate-flow-border`,rt=`relative flex min-w-0 flex-1 flex-col`,it=`relative flex min-h-0 min-w-0 flex-1 flex-col`,at=`term-host relative min-h-0 min-w-0 flex-1 touch-none overflow-hidden`,ot=`pointer-events-none absolute inset-0 z-5 h-full w-full`,st=`relative h-full [&.is-leaving]:pointer-events-none [&.is-leaving]:absolute [&.is-leaving]:inset-0 [&.is-leaving]:z-6`,ct=`pointer-events-none absolute inset-0 z-1 overflow-hidden pt-1.5 pr-1 pb-1 pl-2 [&_pre]:m-0 [&_pre>div>div]:overflow-hidden [&_pre>div>div]:[height:var(--row-h,1.15em)] [&_pre>div>div]:[line-height:var(--row-h,1.15em)]`,lt=e=>`absolute right-2.5 bottom-2.5 z-5 flex items-center gap-3 rounded-sm border-hairline border-line bg-inset px-2.5 py-1.25 font-mono text-meta ${fe} ${e?`text-error`:`text-muted`} [&_.link:disabled]:pointer-events-none [&_.link:disabled]:opacity-60`,ut=`col-span-full touch:[&_.link]:after:inset-[-2px_-6px_-4px] flex min-w-0 items-center gap-2 [border-top:var(--hairline)_solid_var(--line)] bg-surface px-3 py-1 font-mono text-meta ${fe} whitespace-nowrap text-muted`,dt=e=>`size-1.5 rounded-full ${e?`bg-warning`:`bg-subtle`}`,ft=`flex min-w-0 flex-wrap gap-x-3 gap-y-0.5 px-3.5 pt-1 pb-0.5 whitespace-nowrap text-meta text-muted`,pt={ok:`text-success`,warn:`text-warning`,crit:`text-error`},mt=e=>`relative mx-1.25 mt-0 mb-px inline-block h-1 w-7 overflow-hidden rounded-[2px] bg-[color-mix(in_srgb,currentColor_20%,transparent)] align-middle after:absolute after:inset-y-0 after:left-0 after:w-(--fill) after:bg-current after:content-[''] ${pt[e]??``}`,ht=`font-mono text-title font-bold normal-nums tracking-[0.02em] whitespace-nowrap`,gt=`text-accent`,_t=`grid h-full place-items-center p-6`,vt=`flex w-[min(460px,100%)] flex-col gap-3 rounded-md border-hairline border-line bg-surface p-6 [&_p]:m-0`,yt=`flex flex-col gap-2 p-3.5 text-left font-sans text-meta ${fe} leading-[1.5]`,bt=`mx-2.5 my-3 font-mono text-meta text-subtle`,xt=`font-sans text-meta text-subtle`,St=`m-0 max-h-[38vh] overflow-auto rounded-sm border-hairline border-line bg-paper px-3 py-2.5 font-mono text-meta leading-[1.5] whitespace-pre-wrap wrap-anywhere`,Ct=e=>`flex w-full flex-col gap-0.5 rounded-sm px-2.5 py-1.5 text-left focus-visible:bg-accent-soft focus-visible:outline-none ${e?`bg-accent-soft`:``}`,wt=e=>`block w-full cursor-pointer overflow-hidden rounded-[calc(var(--radius-sm)-2px)] px-2 py-0.75 text-left text-ellipsis whitespace-nowrap [font:inherit] touch:py-2.5 ${e.cursor?`bg-hover`:``} ${e.accent?`text-accent`:e.cursor?`text-ink`:`text-muted`}`,H=`m-0 font-sans text-meta font-medium normal-nums`,Tt=`link text-accent [&:hover]:underline touch-hit`,Et=`rounded-sm border-hairline border-line bg-paper font-mono text-meta font-normal normal-nums text-ink focus-visible:border-line-active focus-visible:outline-none`,U=`${Et} w-full px-2.5 py-2`,Dt=`actions flex items-center justify-end gap-3.5`;function Ot({failing:e=!1}){z();let[t,n]=(0,g.useState)(``),[r,i]=(0,g.useState)(!1);return(0,B.jsx)(`div`,{className:_t,children:(0,B.jsxs)(`form`,{className:vt,onSubmit:e=>{e.preventDefault();let n=ae(t);if(!n){i(!0);return}o(n),window.location.reload()},children:[(0,B.jsxs)(`span`,{className:ht,children:[(0,B.jsx)(`span`,{className:gt,children:`[`}),` rove `,(0,B.jsx)(`span`,{className:gt,children:`]`})]}),(0,B.jsx)(`h1`,{className:`${H} text-muted`,children:R(`connect.title`)}),(0,B.jsx)(`p`,{className:e?`text-error`:`text-muted`,children:R(e?`connect.failing`:`connect.body`)}),(0,B.jsx)(`input`,{className:U,autoFocus:!0,spellCheck:!1,placeholder:R(`connect.placeholder`),value:t,onChange:e=>{n(e.target.value),i(!1)}}),r&&(0,B.jsx)(`p`,{className:`text-error`,children:R(`connect.invalid`)}),(0,B.jsxs)(`div`,{className:Dt,children:[e&&(0,B.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>{s(),window.location.reload()},children:R(`connect.forget`)}),(0,B.jsx)(`button`,{type:`submit`,className:V(),children:R(`connect.submit`)})]})]})})}function kt(e,t){for(let n of e){if(n.binding===t)return n;let e=n.children&&kt(n.children,t);if(e)return e}}var At=_(null),W=_(null),jt=null;W.subscribe(()=>{let e=document.activeElement;if(W.get()!==null){!jt&&e instanceof HTMLElement&&!e.closest(`.dialog`)&&(jt=e);return}let t=jt;jt=null,window.setTimeout(()=>{t?.isConnected&&(!document.activeElement||document.activeElement===document.body)&&t.focus()},0)});var Mt=_([]),Nt=_(null),Pt=_(null),Ft=_(null),It=_(!0),Lt=_(null);function Rt(e,t,n,r,i){Nt.set(null),W.set(null),Lt.set({...e?{repo:e}:{},...t?{baseBranch:t}:{},...n?{machine:n}:{},...r?{prompt:r}:{},...i?{ungrouped:!0}:{}})}function zt(){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}`),Rt(n,void 0,void 0,t)}var Bt=1,Vt=4e3;function G(e,t=`info`){let n=Bt++;Mt.set([...Mt.get(),{id:n,text:e,tone:t}].slice(-3)),window.setTimeout(()=>Ut(n),Vt)}function Ht(){return typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches}function Ut(e){if(!Mt.get().some(t=>t.id===e&&!t.leaving))return;let t=()=>Mt.set(Mt.get().filter(t=>t.id!==e));if(Ht()){t();return}Mt.set(Mt.get().map(t=>t.id===e?{...t,leaving:!0}:t)),window.setTimeout(t,140)}function Wt(){W.set(null)}var Gt=_(null),Kt=null;function qt(){Gt.get()!==`drag`&&(Kt!==null&&window.clearTimeout(Kt),Gt.set(`slide`),Kt=window.setTimeout(()=>Gt.set(null),240))}function Jt(e){Kt!==null&&window.clearTimeout(Kt),Kt=null,Gt.set(e?`drag`:null)}var Yt=`flex flex-col gap-1.5`,Xt=`min-h-18 max-h-[50vh] leading-[1.45]`,Zt=`flex flex-wrap gap-1.5`,Qt=(e=!1,t=!1)=>`rounded-sm border-hairline px-2.5 py-1 font-mono text-meta font-normal not-italic normal-nums ${e?`border-accent bg-accent-soft text-ink`:`border-line hover:bg-hover ${t?`text-subtle`:`text-muted`}`}`,$t=`m-0 list-none p-0`,en=`overlay fixed inset-0 z-20 grid justify-items-center [align-items:start] bg-(--scrim) pt-[12vh] motion-safe:animate-fade-in [&.is-leaving]:pointer-events-none [&.is-leaving]:animate-fade-out short:pt-3`,tn=(e=!1)=>`dialog static m-0 flex max-h-[76vh] ${e?`w-[min(620px,calc(100vw-32px))]`:`w-[min(440px,calc(100vw-32px))]`} flex-col gap-3 rounded-md border-hairline border-line bg-surface px-5 py-4.5 text-inherit shadow-dialog focus:outline-none motion-safe:animate-rise-in [.is-leaving_&]:animate-sink-out short:max-h-[calc(100dvh-24px)] short:px-4 short:py-3`,nn=`flex items-center justify-between gap-3`,rn=`m-0 min-w-0 font-sans text-body leading-[1.4] font-semibold normal-nums text-ink wrap-anywhere`,an=`grid size-6 place-items-center -my-1 mr-[-6px] ml-0 rounded-sm text-display leading-none text-muted hover:bg-inset hover:text-ink focus-visible:bg-inset focus-visible:text-ink touch:relative touch:after:absolute touch:after:-inset-2.5 touch:after:content-['']`,on=`dialog-body -m-0.5 flex min-h-0 flex-col gap-3 overflow-y-auto p-0.5 [&_p]:m-0 [&>.actions]:sticky [&>.actions]:-bottom-0.5 [&>.actions]:bg-surface [.dialog-body+div>&]:mt-3.5`,sn=(e=!1)=>`menu fixed z-30 flex max-h-[calc(100vh-16px)] ${e?`min-w-40`:`min-w-50`} origin-top-left flex-col overflow-y-auto rounded-md border-hairline border-line bg-surface p-1 shadow-popover motion-safe:animate-menu-in [&.is-leaving]:pointer-events-none [&.is-leaving]:animate-sink-out`,cn=e=>`flex items-baseline justify-between gap-6 rounded-[calc(var(--radius)-4px)] px-2.5 py-1.25 text-left text-body leading-[inherit] touch:py-2.5 ${e.danger&&e.selected?`bg-error text-paper`:e.selected||e.open?`bg-hover`:``} ${e.danger&&!e.selected?`text-error`:``} ${e.selected?`forced-colors:outline-2 forced-colors:-outline-offset-2 forced-colors:outline-[Highlight] forced-colors:outline-solid`:``}`,ln=`font-mono text-meta normal-nums`,un=e=>`${ln} ${e.danger&&e.selected?`text-inherit`:e.selected?`text-muted`:`text-subtle`} touch:hidden!`,dn=e=>`${ln} ${e?`text-ink`:`text-subtle`}`,fn=`${ln} text-accent`,pn=`fixed right-3.5 bottom-8.5 z-40 flex flex-col gap-1.5`,mn=e=>`toast max-w-105 cursor-pointer rounded-sm border-hairline border-line bg-inset px-3 py-1.75 text-left font-sans text-meta normal-nums wrap-anywhere ${e?`text-error`:`text-ink`} motion-safe:animate-rise-in [&.is-leaving]:pointer-events-none [&.is-leaving]:animate-sink-out`,hn=`text-subtle`,gn=`mt-1`,_n=`m-0 flex list-none flex-col gap-0.5 p-0`,vn=`flex min-w-0 items-baseline gap-2.5`,yn=`flex-none font-mono text-meta font-normal normal-nums text-subtle`,bn=`font-mono [&:hover]:text-accent`,xn={row:`min-h-6.5 touch:min-h-10`,file:`min-h-6 font-mono text-meta touch:min-h-10`,"file-narrow":`min-h-9 font-mono text-meta`,pane:`min-h-5.5 touch:min-h-10`};function Sn(e){let t=e.stack?`flex-col items-stretch gap-0.5 px-2.5 py-1.5`:`items-center gap-2 px-2 py-0.75`,n=e.moving?`bg-accent-soft`:e.selected?`bg-inset`:`hover:bg-hover data-menu-open:bg-hover`;return`relative flex w-full rounded-sm text-left active:scale-97 motion-reduce:active:scale-none ${t} ${xn[e.size??`row`]} ${n}`}var Cn=`row-title min-w-0 flex-1 truncate`,wn=`row-title min-w-0 flex-auto truncate text-(length:--fs-title)`,Tn=`running-shimmer:bg-[linear-gradient(90deg,var(--ink)_0%,var(--ink)_35%,var(--accent)_50%,var(--ink)_65%,var(--ink)_100%)] running-shimmer:bg-size-[300%_100%] running-shimmer:bg-clip-text running-shimmer:text-transparent running-shimmer:animate-shimmer`,En=`w-[1ch] flex-none text-center font-mono`,Dn=`flex flex-none gap-1.5 font-mono text-meta`;function On(e){return e instanceof Error?e.message:String(e)}function kn(e){z();let t=(0,g.useRef)(null);return(0,g.useEffect)(()=>{t.current&&!t.current.contains(document.activeElement)&&t.current.focus();let e=e=>{e.key===`Escape`&&(e.preventDefault(),Wt())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,B.jsx)(`div`,{className:en,onMouseDown:e=>e.target===e.currentTarget&&Wt(),children:(0,B.jsxs)(`dialog`,{ref:t,tabIndex:-1,open:!0,className:tn(e.wide),"aria-label":e.title,children:[(0,B.jsxs)(`div`,{className:nn,children:[(0,B.jsx)(`h1`,{className:rn,children:e.title}),(0,B.jsx)(`button`,{type:`button`,className:an,"aria-label":R(`dialog.close`),title:R(`dialog.close`),onClick:Wt,children:`×`})]}),e.children]})})}function An(){let[e,t]=(0,g.useState)(!1),[n,r]=(0,g.useState)(null);return{busy:e,error:n,setError:r,submit:async e=>{t(!0),r(null);try{await e(),Wt()}catch(e){r(On(e))}finally{t(!1)}}}}function jn(e){let[t,n]=(0,g.useState)(e.initial??``),{busy:r,error:i,submit:a}=An();return(0,B.jsx)(kn,{title:e.title,children:(0,B.jsxs)(`form`,{className:on,onSubmit:n=>{n.preventDefault(),(t.trim()||e.allowEmpty)&&a(()=>e.onSubmit(t.trim()))},children:[(0,B.jsx)(`input`,{className:U,"aria-label":e.title,autoFocus:!0,spellCheck:!1,value:t,onChange:e=>n(e.target.value),onFocus:e=>e.currentTarget.select()}),i&&(0,B.jsx)(`p`,{className:`text-error`,children:i}),(0,B.jsx)(Nn,{busy:r,submitLabel:e.submitLabel})]})})}function Mn(e){let{busy:t,error:n,setError:r,submit:i}=An(),[a,o]=(0,g.useState)(!1),[s,c]=(0,g.useState)(null),[l,u]=(0,g.useState)(!1),d=(0,g.useRef)(null);(0,g.useEffect)(()=>d.current?.focus(),[]);let f=t=>void i(async()=>{try{a&&e.escalate?await e.escalate.run(l):await(t&&e.secondary?e.secondary.onConfirm():e.onConfirm())}catch(n){throw!a&&e.escalate?.when(n)&&(o(!0),c(n),u(t),r(On(n))),n}});return(0,B.jsx)(kn,{title:a&&e.escalate?.title||e.title,children:(0,B.jsxs)(`div`,{className:on,children:[(0,B.jsx)(`p`,{className:`whitespace-pre-line text-muted`,children:a&&e.escalate?.body?e.escalate.body(s):e.body}),n&&!(a&&e.escalate?.body)&&(0,B.jsx)(`p`,{className:`text-error`,children:n}),(0,B.jsxs)(`div`,{className:Dt,children:[(0,B.jsx)(`button`,{type:`button`,className:Tt,onClick:Wt,children:R(`dialog.cancel`)}),e.secondary&&!a&&(0,B.jsx)(`button`,{type:`button`,className:V({danger:!0}),disabled:t,onClick:()=>f(!0),children:e.secondary.label}),(0,B.jsx)(`button`,{ref:d,type:`button`,className:V({danger:!0}),disabled:t,onClick:()=>f(!1),children:a&&e.escalate?e.escalate.label:e.confirmLabel})]})]})})}function Nn({busy:e,submitLabel:t}){return(0,B.jsxs)(`div`,{className:Dt,children:[(0,B.jsx)(`button`,{type:`button`,className:Tt,onClick:Wt,children:R(`dialog.cancel`)}),(0,B.jsx)(`button`,{type:`submit`,className:V(),disabled:e,children:t})]})}var Pn={cancel:`Cancel`,failureHint:"Run `{command}` for diagnosis and next steps.",toastFailureHint:`Next: run rove doctor`,loading:`Loading…`,create:`create`,confirm:`Confirm`,paneCrash:{title:`This pane crashed`,hint:`The error was logged to client.log. Retry, or restart Rove if it keeps happening.`,regionTitle:`The {region} hit an error`,regionHint:"The rest of Rove keeps working. Retry below; if it persists, inspect client.log and run `rove doctor`.",retry:`[ retry ]`,region:{sidebar:`task list`,workspace:`workspace`,files:`file tree`,page:`page`}},rename:{defaultTitle:`Rename task`,defaultFieldLabel:`TITLE`,footerHint:`enter {submitLabel} · esc cancel`,defaultSubmitLabel:`rename`},prompt:{fieldLabel:`input`,submitLabel:`submit`}},Fn={cancel:`取消`,failureHint:"运行 `{command}` 查看诊断和后续步骤。",toastFailureHint:`下一步:运行 rove doctor`,loading:`加载中…`,create:`创建`,confirm:`确认`,paneCrash:{title:`此面板已崩溃`,hint:`错误已记录到 client.log。可重试;若反复出现请重启 Rove。`,regionTitle:`{region}出错了`,regionHint:"Rove 的其余部分仍可正常使用。请在下方重试;若问题持续,请查看 client.log 并运行 `rove doctor`。",retry:`[ 重试 ]`,region:{sidebar:`任务列表`,workspace:`工作区`,files:`文件树`,page:`页面`}},rename:{defaultTitle:`重命名任务`,defaultFieldLabel:`名称`,footerHint:`enter {submitLabel} · esc 取消`,defaultSubmitLabel:`重命名`},prompt:{fieldLabel:`输入`,submitLabel:`提交`}},In={fix:{hint:"{count} finding(s) above have a known fix — run `{command}` to review them one by one",none:`fix: nothing to fix — no known remediation applies to this report`,header:`fixes — each one asks before running:`,willRun:`will run: {command}`,confirmPrompt:`apply this fix? [y/N] `,done:`✓ done`,failed:`✗ exited with code {code}; inspect the command output above, then rerun rove doctor`,skipped:`· skipped`,nonInteractive:`no interactive terminal — nothing was executed; run the commands above yourself`,manualHeader:`manual steps — doctor prints these but never runs them:`,daemonRestartWhy:`safe to run: engine sessions live in the separate PTY host and survive a daemon restart`,daemonStale:`restart the daemon — it is running an older build than this CLI`,daemonDown:`start the daemon — it is not running`,hooksDown:`restart the daemon to re-establish the engine hook channel`,inspectStale:`restart the daemon — it predates the hook-channel check`,skillInstallWhy:`safe to run: installs skill files only; re-running is idempotent`,skillMissing:`install the Rove agent skill`,skillStale:`update the Rove agent skill to the version this build expects`,spawnHelper:`restore the exec bit on node-pty's spawn-helper — every node-pty PTY spawn fails without it`,spawnHelperWhy:"safe to run: chmod on two prebuilt binaries; idempotent, and `bun install` does the same",resetWhy:`stops the daemon, the PTY host, and every live session — not undoable, so doctor only prints it`,resetDaemonWedged:`the daemon process is alive but unreachable (wedged)`,resetPty:`the PTY host process is alive but its socket is unreachable (wedged)`,resetPtyStale:`the PTY host is still running an older build than the one you launched`,resetLegacy:`pre-v0.8 tmux sessions are still holding processes and memory`,orphans:`{count} process(es) outlived the PTY session that spawned them and are still running`,orphansWhy:`kills processes, which is not undoable — and a task you backgrounded on purpose looks the same; read the list, then run it yourself`,engineTabs:`engine tabs may hold a stale daemon socket path`,engineTabsAction:`close and reopen the affected engine tabs in the TUI`,engineTabsWhy:`kills that tab's live engine session — your call, not doctor's`,staleInstall:`the install this Rove runs from no longer exists on disk`,staleInstallAction:`npm install -g @sma1lboy/rove, then relaunch Rove`,staleInstallWhy:`doctor cannot reinstall Rove over the running process — a human has to, then relaunch`,humanOnlyWhy:`doctor does not install software or log in to accounts for you`,git:`git is not on PATH`,gitAction:`install git with your OS package manager`,noEngine:`no usable engine — no engine CLI is both installed and logged in`,noEngineAction:`install an engine CLI (claude, codex, copilot, or kimi) and log in`,noEngineLogin:`no usable engine — an engine CLI is installed but not signed in`,noEngineLoginAction:`run one of the installed engine CLIs ({list}) in a shell and complete its login`,windowsNode:`Node.js is missing — the Windows PTY host cannot start`,windowsNodeAction:`install Node.js from https://nodejs.org`,staleBun:`the Bun running Rove is older than this build supports — terminals will not paint`,staleBunAction:"upgrade Bun (`bun upgrade`, `brew upgrade bun`, or `npm install -g bun@latest`), then relaunch Rove"}},Ln={fix:{hint:"上面有 {count} 项发现存在已知修法 — 运行 `{command}` 逐条查看",none:`fix: 无可修项 — 本次报告没有匹配到已知修法`,header:`修复项 — 每一条都会先询问再执行:`,willRun:`将执行: {command}`,confirmPrompt:`执行这条修复吗? [y/N] `,done:`✓ 完成`,failed:`✗ 退出码 {code};请检查上方命令输出,再运行 rove doctor`,skipped:`· 已跳过`,nonInteractive:`没有交互终端 — 未执行任何命令; 请自行运行上面的命令`,manualHeader:`人工步骤 — doctor 只打印, 永远不会替你执行:`,daemonRestartWhy:`可安全执行: 引擎会话在独立的 PTY host 里, daemon 重启后仍然存活`,daemonStale:`重启 daemon — 它运行的构建比当前 CLI 旧`,daemonDown:`启动 daemon — 它当前没有在运行`,hooksDown:`重启 daemon 以重建引擎 hook 通道`,inspectStale:`重启 daemon — 它的版本早于 hook 通道检查`,skillInstallWhy:`可安全执行: 只写入 skill 文件; 重复运行是幂等的`,skillMissing:`安装 Rove agent skill`,skillStale:`把 Rove agent skill 更新到当前构建期望的版本`,spawnHelper:`恢复 node-pty spawn-helper 的可执行位 — 缺了它 node-pty 的每次 PTY 启动都会失败`,spawnHelperWhy:"可安全执行: 只对两个预编译二进制做 chmod; 幂等, `bun install` 也会做同样的事",resetWhy:`会停掉 daemon、PTY host 和所有活动会话 — 不可撤销, 所以 doctor 只打印`,resetDaemonWedged:`daemon 进程存活但无法连接 (卡死)`,resetPty:`PTY host 进程存活但 socket 无法连接 (卡死)`,resetPtyStale:`PTY host 仍在跑比你启动的版本更旧的构建`,resetLegacy:`v0.8 之前的 tmux 会话仍占用进程和内存`,orphans:`有 {count} 个进程比启动它们的 PTY 会话活得更久, 现在还在运行`,orphansWhy:`会杀进程, 不可撤销 — 而且你故意放后台的任务看起来一模一样; 先看清单, 再自己执行`,engineTabs:`引擎 tab 可能持有过期的 daemon socket 路径`,engineTabsAction:`在 TUI 里关闭并重开受影响的引擎 tab`,engineTabsWhy:`会杀掉该 tab 的活动引擎会话 — 由你决定, doctor 不代劳`,staleInstall:`当前 Rove 所在的安装已从磁盘删除`,staleInstallAction:`npm install -g @sma1lboy/rove, 然后重新启动 Rove`,staleInstallWhy:`doctor 无法在运行中的进程上重装 Rove — 需要人工重装后重新启动`,humanOnlyWhy:`doctor 不会替你安装软件或登录账号`,git:`PATH 上找不到 git`,gitAction:`用你的系统包管理器安装 git`,noEngine:`没有可用引擎 — 没有任何引擎 CLI 同时满足已安装且已登录`,noEngineAction:`安装任一引擎 CLI(claude、codex、copilot 或 kimi)并登录`,noEngineLogin:`没有可用引擎 — 引擎 CLI 已安装, 但没有登录`,noEngineLoginAction:`在 shell 里运行已安装的引擎 CLI({list})之一并完成登录`,windowsNode:`缺少 Node.js — Windows PTY host 无法启动`,windowsNodeAction:`从 https://nodejs.org 安装 Node.js`,staleBun:`运行 Rove 的 Bun 版本低于本构建的要求 — 终端不会有任何输出`,staleBunAction:"升级 Bun (`bun upgrade` / `brew upgrade bun` / `npm install -g bun@latest`), 然后重新启动 Rove"}},Rn={mentionNoEngine:`No engine session in this task — nothing to mention into. Open one with ctrl+t.`,tabs:{all:`All`,changes:`Changes`},actions:{zen:`Zen`,createPR:`Ask agent to create PR`,diffAll:`[D] diff everything`},legend:{changes:`M modified · A added · D deleted · ? untracked`},scope:{working:`scope: working tree`,branch:`scope: vs {base}`,toggleHint:`b to toggle`,noBase:`no base ref for branch scope (no origin/HEAD, main or master)`},empty:{noTask:`(no task — press n to create)`,noFiles:`(empty worktree)`,noChanges:`(no changes — clean worktree)`},error:{retryHint:`press r to retry`,notGitRepo:"not a git repository — run `git init` here, or open a task in a repo",pathMissing:`the worktree directory is gone — reopen the task to re-create it`,permissionDenied:`permission denied reading the worktree — check the directory's owner and mode`,gitNotInstalled:`git is not on PATH — install it with your OS package manager`,gitFailed:"git command failed; run `git status` in this worktree to diagnose"},toast:{prOnTargetBranch:`Already on the target branch ({branch}) — ask the agent to create the PR from a task branch`,noPausedOperation:`Nothing to resolve — no merge, rebase or cherry-pick is paused here`,conflictReadFailed:`Git could not read the conflicted files. Run git status in this worktree, then retry.`,conflictSendFailed:`Could not send the conflict prompt. Open an engine tab in this task, then retry.`,ciNoFailingChecks:`No failing check logs to read — the run may have expired, or the checks are no longer red`,ciChecksUnavailable:"gh could not read this PR's checks: {detail}. Run `gh auth status`, then retry."}},zn={mentionNoEngine:`这个任务没有引擎会话——没有地方可以提及。用 ctrl+t 开一个。`,tabs:{all:`全部`,changes:`改动`},actions:{zen:`专注模式`,createPR:`让 agent 创建 PR`,diffAll:`[D] 查看全部改动`},legend:{changes:`M 已修改 · A 已添加 · D 已删除 · ? 未跟踪`},scope:{working:`范围:工作区改动`,branch:`范围:对比 {base}`,toggleHint:`按 b 切换`,noBase:`分支范围没有基准 ref(没有 origin/HEAD、main 或 master)`},empty:{noTask:`(暂无任务 — 按 n 创建)`,noFiles:`(worktree 为空)`,noChanges:`(无改动 — worktree 干净)`},error:{retryHint:`按 r 重试`,notGitRepo:"不是 git 仓库——在这里执行 `git init`,或改为打开仓库里的任务",pathMissing:`worktree 目录已不存在——重新打开该任务会重建它`,permissionDenied:`读取 worktree 时权限不足——请检查该目录的属主和权限`,gitNotInstalled:`PATH 上找不到 git——请用系统包管理器安装`,gitFailed:"git 命令失败;请在此 worktree 运行 `git status` 诊断"},toast:{prOnTargetBranch:`当前就在目标分支({branch})— 请在任务分支上让 agent 创建 PR`,noPausedOperation:`没有要解决的冲突——这里没有暂停中的合并、变基或拣选`,conflictReadFailed:`Git 无法读取冲突文件。请在此 worktree 运行 git status,然后重试。`,conflictSendFailed:`无法发送冲突提示。请在此任务中打开一个引擎标签页,然后重试。`,ciNoFailingChecks:`没有可读的失败检查日志——运行记录可能已过期,或检查已不再是红的`,ciChecksUnavailable:"gh 读不到这个 PR 的检查状态:{detail}。请运行 `gh auth status`,然后重试。"}},Bn={retryHint:`Correct the field above, then choose Create again.`,title:`New task`,legend:`{enter} · tab complete/fields · ctrl+[ ] mode · ctrl+e engine · esc cancel`,enterCreate:`enter create`,enterNext:`enter next field`,tabs:{existing:`For Existing`,clone:`For New Repo`,adopt:`Adopt Worktree`},field:{mode:`MODE`,tier:`DEPTH`,engine:`ENGINE`,effort:`EFFORT`,repo:`REPO`,fromBranch:`FROM BRANCH`,prompt:`FIRST MESSAGE`,extras:`ALSO INCLUDE`,gitUrl:`GIT URL`,parentDir:`PARENT DIR`,folderName:`FOLDER NAME`,baseBranch:`BASE BRANCH`,adoptFilter:`FILTER (PATH GLOB)`,opens:`OPENS`},intent:{task:`a new task worktree`,project:`the project itself`},placeholder:{folderName:`auto from url`,adoptFilter:`* — type e.g. feature-* to narrow`,prompt:`Describe a task or ask a question (optional)`},hint:{modeCycle:`ctrl+[ ]`,engineCycle:`ctrl+e`,remembered:`(remembered — next clone defaults to this dir)`,currentDir:`(current dir)`,noBranchesFound:`(no local branches found — typed text will be used as ref)`,noMatchBranch:`(no match — typed text will be used as ref)`,scanningWorktrees:`scanning worktrees…`,extrasNone:`(none — enter picks a repo; the first is the primary)`,extrasPicked:`{count} more repo(s) in this task`},picker:{moreAbove:`↑ {count} more`,moreBelow:`↓ {count} more`},scroll:{moreAbove:`↑ {count} more rows`,moreBelow:`↓ {count} more rows`},open:{failed:`Couldn't open the project: {error}`},adopt:{repoLine:`repo: {path}`,repoNone:`(none)`,noUnlinked:`no unlinked worktrees — every git worktree here is already a task`,noMatch:`no worktrees match the filter`,hintSelected:`{count} selected · enter toggles · ctrl+a all · Create imports`,hintDefault:`enter toggles · ctrl+a all · Create imports the highlighted row`,summaryAll:`Adopted {count} worktree(s)`,summaryPartial:`Adopted {done}/{total} worktrees — the rest failed (see log)`,summaryNone:`Couldn't adopt any worktree: {error}`},clone:{progressFallback:`Cloning…`,progressInto:`Cloning into {target}…`},button:{create:`Create`,cloning:`Cloning…`},error:{gitUrlRequired:`git URL is required`,gitUrlInvalid:`does not look like a git URL: {url}`,folderRequired:`folder name is required`,folderHasSeparator:`folder name cannot contain path separators`,parentRequired:`parent directory is required`,parentNotFound:`parent directory does not exist: {path}`,parentNotDir:`not a directory: {path}`,targetExists:`target already exists: {path}`,cloneFailed:`git clone failed: {error}`,noAdoptable:`no adoptable worktrees to import`,repoAmbiguous:`more than one saved repo is named {name} — pick the one you mean from the list`,tierUnavailable:`{tier} points at engine {engine}, which is not available here — retarget it in Settings → Auto routing`}},Vn={retryHint:`请修正上方字段,然后再次选择创建。`,title:`新建任务`,legend:`{enter} · tab 补全/切字段 · ctrl+[ ] 切模式 · ctrl+e 引擎 · esc 取消`,enterCreate:`enter 创建`,enterNext:`enter 下一个字段`,tabs:{existing:`已有仓库`,clone:`克隆新仓库`,adopt:`接管 Worktree`},field:{mode:`模式`,tier:`深度`,engine:`引擎`,effort:`推理强度`,repo:`仓库`,fromBranch:`基准分支`,prompt:`第一条消息`,extras:`同时包含`,gitUrl:`git 地址`,parentDir:`父目录`,folderName:`文件夹名`,baseBranch:`基准分支`,adoptFilter:`过滤(路径 glob)`,opens:`打开`},intent:{task:`新建任务 worktree`,project:`项目本身`},placeholder:{folderName:`自动从地址推导`,adoptFilter:`* — 输入如 feature-* 来缩小范围`,prompt:`描述一个任务,或提个问题(可选)`},hint:{modeCycle:`ctrl+[ ]`,engineCycle:`ctrl+e`,remembered:`(已记住 — 下次克隆默认使用此目录)`,currentDir:`(当前目录)`,noBranchesFound:`(未找到本地分支 — 将直接使用输入文本作为 ref)`,noMatchBranch:`(无匹配 — 将直接使用输入文本作为 ref)`,scanningWorktrees:`正在扫描 worktree…`,extrasNone:`(未选 — 回车选一个仓库,第一个是主仓库)`,extrasPicked:`任务里另含 {count} 个仓库`},picker:{moreAbove:`↑ 还有 {count} 项`,moreBelow:`↓ 还有 {count} 项`},scroll:{moreAbove:`↑ 上方还有 {count} 行`,moreBelow:`↓ 下方还有 {count} 行`},open:{failed:`无法打开项目:{error}`},adopt:{repoLine:`仓库:{path}`,repoNone:`(无)`,noUnlinked:`没有未关联的 worktree — 此仓库所有 git worktree 均已是任务`,noMatch:`没有 worktree 匹配此过滤条件`,hintSelected:`已选 {count} 项 · enter 切换选中 · ctrl+a 全选 · 创建 导入`,hintDefault:`enter 切换选中 · ctrl+a 全选 · 创建 将导入高亮行`,summaryAll:`已接管 {count} 个 worktree`,summaryPartial:`已接管 {done}/{total} 个 worktree — 其余失败(详见日志)`,summaryNone:`没有 worktree 接管成功:{error}`},clone:{progressFallback:`克隆中…`,progressInto:`正在克隆到 {target}…`},button:{create:`创建`,cloning:`克隆中…`},error:{gitUrlRequired:`git 地址不能为空`,gitUrlInvalid:`不像是有效的 git 地址:{url}`,folderRequired:`文件夹名不能为空`,folderHasSeparator:`文件夹名不能包含路径分隔符`,parentRequired:`父目录不能为空`,parentNotFound:`父目录不存在:{path}`,parentNotDir:`不是目录:{path}`,targetExists:`目标路径已存在:{path}`,cloneFailed:`git clone 失败:{error}`,noAdoptable:`没有可接管的 worktree`,repoAmbiguous:`有多个已保存仓库都叫 {name} — 请从列表中选择你要的那个`,tierUnavailable:`{tier} 指向的引擎 {engine} 在这台机器上不可用——去 设置 → 自动路由 重新指定`}},Hn={engineTitle:`Engine and account`,engineChecking:`Checking installed engines and accounts…`,engineReady:`✓ Ready to start a task`,engineMissing:`No usable engine yet`,engineUsable:`✓ {engine}: ready`,engineSignedOut:`! {engine}: installed, not signed in`,engineSetup:"Install an engine using docs.rove.run/rove/engines, then run its CLI and sign in. Run `rove doctor --fix` to check setup; Settings → Engines lists integrations.",engineContinue:`❯ Continue to optional setup`,engineLegend:`enter continue · esc skip optional setup`,quickStart:`Start a task with a prompt`,quickIntent:`Creates an isolated worktree and branch. Use {key} for the full task dialog.`,tabShared:`New conversations share this task’s files`,tabIsolated:`{key}: new task, isolated worktree`,title:`Welcome to Rove`,subtitle:`Managed tasks get isolated worktrees and branches. Directory and project tasks reuse existing files.`,completionsLabel:`Shell completions for {shell}`,completionsExplain:`Tab-completes rove subcommands. One line is added to your shell config.`,skillLabel:`Rove agent skill`,skillExplain:`Lets the coding agents on this machine drive Rove themselves: start tasks, read other sessions, message them.`,optionYes:`Install`,recommended:`recommended`,stepCounter:`{n} / {total}`,optionNo:`Not now`,queued:`Queued — installs when you quit Rove`,skillInstalled:`Installed for {engines}`,skillFailed:`Install failed: {reason}`,skillNoEngines:`No coding agent here takes the skill`,skipped:`Skipped`,installFailed:`! {item} failed: {reason}. Retry: {command} (or quit Rove again).`,legend:`↑↓ select · enter confirm · esc close`,keysTitle:`Keyboard basics`,keysBare:`Bare keys act in the focused pane — {nav} moves, {open} opens.`,keysOnePress:`A few one-press chords are Rove's own — {newTab} new tab, {focusNext} next pane.`,keysPrefix:`{prefix} opens the command map — hold it a beat and a guide appears.`,keysHelp:`{help} shows the full live reference anytime.`,keysNext:`Next: Settings → Engines lists every engine and installs its activity hooks.`,keysLegend:`enter finish`,appliedCompletions:`✓ completions hooked into {path} (takes effect in new shells)`,keptCompletions:`· {path} already has a completions block — left untouched`},Un={engineTitle:`引擎与账户`,engineChecking:`正在检查引擎与账户…`,engineReady:`✓ 可以开始任务`,engineMissing:`还没有可用的引擎`,engineUsable:`✓ {engine}:可用`,engineSignedOut:`! {engine}:已安装,未登录`,engineSetup:"从 docs.rove.run/rove/engines 安装引擎,然后运行其 CLI 并登录。运行 `rove doctor --fix` 检查配置;设置 → 引擎 可查看集成。",engineContinue:`❯ 继续可选设置`,engineLegend:`enter 继续 · esc 跳过可选设置`,quickStart:`输入提示词开始任务`,quickIntent:`创建独立 worktree 和分支。按 {key} 打开完整任务对话框。`,tabShared:`新对话共享当前任务的文件`,tabIsolated:`{key}:新建任务,使用独立 worktree`,title:`欢迎使用 Rove`,subtitle:`托管任务使用独立的 worktree 和分支;目录与项目任务复用现有文件。`,completionsLabel:`{shell} 的 shell 补全`,completionsExplain:`让 rove 子命令支持 Tab 补全,会在你的 shell 配置里加一行。`,skillLabel:`Rove agent skill`,skillExplain:`让本机的编码 agent 自己操作 Rove:开任务、读其他会话、给它们发消息。`,optionYes:`安装`,recommended:`推荐`,stepCounter:`{n} / {total}`,optionNo:`跳过`,queued:`已排队 — 退出 Rove 后安装`,skillInstalled:`已为 {engines} 安装`,skillFailed:`安装失败:{reason}`,skillNoEngines:`这台机器上没有能装 skill 的编码 agent`,skipped:`已跳过`,installFailed:`! {item} 安装失败:{reason}。重试:{command}(或再次退出 Rove)。`,legend:`↑↓ 选择 · enter 确认 · esc 关闭`,keysTitle:`键盘基础`,keysBare:`裸键作用于当前聚焦面板 — {nav} 移动,{open} 打开。`,keysOnePress:`少量单次快捷键属于 Rove 自己 — {newTab} 新标签页,{focusNext} 切换面板。`,keysPrefix:`{prefix} 打开命令层 — 按住稍等会出现命令指南。`,keysHelp:`随时按 {help} 查看完整的实时键位表。`,keysNext:`接下来:设置 → 引擎 里列出每个引擎,并可在那里安装它们的活动钩子。`,keysLegend:`enter 完成`,appliedCompletions:`✓ 补全已写入 {path}(新开的 shell 生效)`,keptCompletions:`· {path} 里已有补全配置 — 未改动`},Wn={title:`Quick task · {repoLabel}`,promptLabel:`PROMPT`,promptPlaceholder:`what should this task do?`,attemptsLabel:`ATTEMPTS`,engineLabel:`ENGINE`,branchLabel:`BRANCH`,legend:`enter create · tab fields · ctrl+e engine · ctrl+v attach · esc cancel`,startedRound:`Started {count} attempts`,roundPartial:`Started {ok}/{count} attempts — {failed} failed`},Gn={title:`快速任务 · {repoLabel}`,promptLabel:`提示词`,promptPlaceholder:`这个任务要做什么?`,attemptsLabel:`尝试次数`,engineLabel:`引擎`,branchLabel:`分支`,legend:`enter 创建 · tab 切换字段 · ctrl+e 引擎 · ctrl+v 附件 · esc 取消`,startedRound:`已启动 {count} 个尝试`,roundPartial:`已启动 {ok}/{count} 个尝试 —— {failed} 个失败`},Kn={cancel:`cancel`,forgetProjectTitle:`Remove project "{title}"?`,forgetProjectBody:"Forgets it from the projects list. The repo, its branches, worktrees, and any tasks under it stay on disk — re-add it with `rove add`.",forgetProjectConfirm:`remove`,deleteTitle:`Remove session "{title}"?`,deleteTitleDir:`Remove session "{title}"?`,deleteBodyDir:`Ends this session and closes all its tabs. Nothing on disk changes: the folder and its files stay.`,deleteBodyMain:`Ends this session and closes all its tabs. The project stays in your list and nothing on disk changes: the repo, its branches and worktrees stay.`,deleteBodyTask:`Ends this session, closes all its tabs and removes its worktree folder. The git branch stays.`,deleteBodyTaskBranch:`Ends this session, closes all its tabs and removes its worktree folder, and its git branch if it is merged. An unmerged branch stays.`,deleteConfirm:`remove`,childrenTitle:`"{title}" has {count} child tasks`,childrenBody:`Promote moves them up one level and keeps their worktrees and sessions. Remove with children removes them too.`,childrenPromote:`promote children`,childrenCascade:`remove with children`,childrenBodyMain:`Ends this session and closes its tabs; nothing on disk changes. Its child tasks keep running unless you delete them too.`,childrenKeepMain:`remove session`,childrenCascadeMain:`remove with children`,forceDeleteTitle:`"{title}" has uncommitted changes`,forceDeleteConfirm:`force remove`},qn={cancel:`取消`,forgetProjectTitle:`从列表中移除项目「{title}」?`,forgetProjectBody:"只是把它从项目列表里忘掉。仓库、分支、worktree 以及它下面的任务都会留在磁盘上——之后可以用 `rove add` 重新加回来。",forgetProjectConfirm:`移除`,deleteTitle:`移除会话「{title}」?`,deleteTitleDir:`移除会话「{title}」?`,deleteBodyDir:`结束这个会话,关闭它的所有标签页。磁盘上什么都不动:文件夹和里面的文件都会保留。`,deleteBodyMain:`结束这个会话,关闭它的所有标签页。项目仍留在列表里,磁盘上什么都不动:仓库、分支和 worktree 都会保留。`,deleteBodyTask:`结束这个会话,关闭它的所有标签页,并删除它的 worktree 文件夹。git 分支会保留。`,deleteBodyTaskBranch:`结束这个会话,关闭它的所有标签页,删除它的 worktree 文件夹,以及已合并的 git 分支。未合并的分支会保留。`,deleteConfirm:`移除`,childrenTitle:`「{title}」有 {count} 个子任务`,childrenBody:`提升会把它们上移一级,并保留它们的 worktree 和会话。连同子任务移除会把它们一并移除。`,childrenPromote:`提升子任务`,childrenCascade:`连同子任务移除`,childrenBodyMain:`结束这个会话并关闭它的标签页,磁盘上什么都不动。它的子任务会继续运行,除非你也选择把它们一并删除。`,childrenKeepMain:`移除会话`,childrenCascadeMain:`连同子任务移除`,forceDeleteTitle:`「{title}」有未提交的改动`,forceDeleteConfirm:`强制移除`},Jn={noDaemonWorktree:"No daemon running — can't create the worktree. Start it with `rove daemon restart`.",noEditor:`No editor found — set ROVE_OPEN_EDITOR (e.g. 'code', 'cursor', 'nvim')`,openWorktreeFailed:`Couldn't open worktree with {label}`,worktreeErrorDeleting:`This task is being deleted — it can't be opened`,worktreeErrorNotGit:"This project isn't a git repo yet — a task needs a git branch. Run `git init` (+ a first commit) in the project, then open the task. Non-git support is coming.",worktreeErrorGeneric:`Couldn't create the worktree: {message}`,scratchAdopted:`Adopted into {repo} — save it as a project from New Task if you want it in the picker`,scratchOpenFailed:`Couldn't open a scratch shell: {message}`,scratchCloseFailed:`Couldn't close the scratch task: {message}`,worktreeGoneTitle:`Worktree for "{title}" is gone`,worktreeGoneBody:`Closed {count} tab(s). The branch {branch} is still there — reopen the task to re-create its worktree.`,checksPassingTitle:`Checks passed for "{title}"`,checksFailingTitle:`Checks failed for "{title}"`,checksResolvedBody:`PR {pr} on {branch}`,copiedId:`Copied task ID {text}`,copiedTab:`Copied tab address {text}`,copiedBranch:`Copied branch {text}`,copiedPath:`Copied path {text}`,copyFailed:`Couldn't reach a clipboard — no clipboard command on PATH, and this terminal refused OSC 52.`,forgetProjectFailed:`Couldn't remove the project — it stays in the projects list: {error}`,deleteFailed:`Couldn't delete "{title}" — the task and its worktree are untouched: {error}`,createFailed:`Couldn't create the task — nothing was created: {error}`,forkFailed:`Couldn't fork the task — the original is untouched: {error}`,forkLeftBehind:`Started from the last commit — uncommitted work stays in the original task ({reason})`,childFailed:`Couldn't start the new conversation — the current one is untouched: {error}`,renameFailed:`Couldn't rename the task — it keeps its old title: {error}`,renameBranchFailed:`Couldn't rename the branch — it stays "{branch}": {error}`,switchEngineFailed:`Couldn't switch the engine — the task keeps the one it had: {error}`,setStatusFailed:`Couldn't set the status — it stays {status}: {error}`,pinFailed:`Couldn't change the pin — the task keeps its current place: {error}`,moveFailed:`Couldn't move the task — it keeps its current place: {error}`,issueChatFailed:`Couldn't start the issue chat — the issue is unchanged: {error}`,inboxMarkReadFailed:`Couldn't mark it read — it stays in the inbox: {error}`,inboxDismissFailed:`Couldn't dismiss it — it stays in the inbox: {error}`,engineSwitched:`Engine → {engine} (applies on reopen)`,statusSet:`Status → {status}`},Yn={noDaemonWorktree:"守护进程未运行——无法创建 worktree。请运行 `rove daemon restart` 启动它。",noEditor:`未找到编辑器——请设置 ROVE_OPEN_EDITOR(如 'code'、'cursor'、'nvim')`,openWorktreeFailed:`无法用 {label} 打开 worktree`,worktreeErrorDeleting:`该任务正在删除中——无法打开`,worktreeErrorNotGit:"该项目尚非 git 仓库——任务需要 git 分支。请在项目中执行 `git init`(+ 首次提交)后再打开任务。非 git 项目的支持即将推出。",worktreeErrorGeneric:`无法创建 worktree:{message}`,scratchAdopted:`已归入 {repo}——若要出现在项目选择器里,可在新建任务中保存为项目`,scratchOpenFailed:`无法打开临时 Shell:{message}`,scratchCloseFailed:`无法关闭临时任务:{message}`,worktreeGoneTitle:`"{title}" 的 worktree 已消失`,worktreeGoneBody:`已关闭 {count} 个标签页。分支 {branch} 仍在——重新打开该任务会重建 worktree。`,checksPassingTitle:`「{title}」的 PR 检查已通过`,checksFailingTitle:`「{title}」的 PR 检查失败了`,checksResolvedBody:`PR {pr},分支 {branch}`,copiedId:`已复制任务 ID {text}`,copiedTab:`已复制标签页地址 {text}`,copiedBranch:`已复制分支 {text}`,copiedPath:`已复制路径 {text}`,copyFailed:`无法访问剪贴板——PATH 上没有剪贴板命令,这个终端也拒绝了 OSC 52。`,forgetProjectFailed:`移除项目失败——它仍在项目列表里:{error}`,deleteFailed:`删除「{title}」失败——任务和它的 worktree 都没有被改动:{error}`,createFailed:`创建任务失败——什么都没有被创建:{error}`,forkFailed:`fork 任务失败——原任务没有被改动:{error}`,forkLeftBehind:`已从最近一次提交开始——未提交的改动留在原任务里({reason})`,childFailed:`无法开始新对话——当前对话没有被改动:{error}`,renameFailed:`重命名任务失败——它仍用原来的标题:{error}`,renameBranchFailed:`重命名分支失败——它仍是「{branch}」:{error}`,switchEngineFailed:`切换引擎失败——任务仍使用原来的引擎:{error}`,setStatusFailed:`设置状态失败——它仍是 {status}:{error}`,pinFailed:`修改置顶状态失败——任务仍在原来的位置:{error}`,moveFailed:`移动任务失败——它仍在原来的位置:{error}`,issueChatFailed:`启动议题会话失败——议题没有被改动:{error}`,inboxMarkReadFailed:`标记为已读失败——它仍留在收件箱里:{error}`,inboxDismissFailed:`忽略失败——它仍留在收件箱里:{error}`,engineSwitched:`引擎 → {engine}(重新打开后生效)`,statusSet:`状态 → {status}`},Xn={nav:{kanban:`Kanban`,automations:`Routines`,issues:`Issues`,mods:`Mods`},header:{scratch:`Ungrouped`},search:{placeholder:`fuzzy filter`},sort:{label:`sort: {mode}`,hint:`Change the order (manual → newest → attention → name)`,reorderSwitched:`Reorder needs manual order — switched`,modes:{default:`manual`,recent:`newest`,attention:`attention`,name:`name`}},menu:{open:`Open`,collapseChildren:`Collapse children`,expandChildren:`Expand children`,newChat:`New conversation`,newShell:`New shell`,newScratchChat:`New conversation (no folder)`,newTask:`New task`,forgetProject:`Remove project`,fieldNotes:`Field notes`,rename:`Rename`,pin:`Pin`,unpin:`Unpin`,reorder:`Reorder row`,moveToTop:`Move to top`,reorderProject:`Reorder project`,runAgain:`Run again`,setStatus:`Set status`,copyId:`Copy task ID`,copyBranch:`Copy branch name`,copyPath:`Copy path`,openEditor:`Open in editor`,renameBranch:`Rename branch`,changeEngine:`Change engine`,fixChecks:`Fix failing checks`,rerunChecks:`Re-run failed checks`,syncBase:`Sync with base`,resolveConflicts:`Resolve conflicts`,land:`Land into base branch`,archive:`Archive`,unarchive:`Unarchive`,delete:`Remove session`},status:{backlog:`Backlog`,inProgress:`In progress`,inReview:`In review`,done:`Done`,canceled:`Canceled`,error:`Error`},setStatus:{title:`Set status`,current:`current`,footer:`↑↓ choose · enter set · esc cancel`},sync:{done:`Merged {base} into this worktree`,alreadyCurrent:`Already up to date with {base}`,conflict:`Merge conflict — resolve then commit: {files}`,dirty:`Commit the worktree's changes first, then sync: {files}`,failed:`Sync failed: {error}`},archive:{done:`Archived {title}. Its worktree, branch and sessions are untouched`,restored:`Restored {title}`,busyTitle:`Archive while it's working?`,busyBody:`An engine in {title} is still working or waiting on you. Archiving hides the row without stopping it.`,busyConfirm:`Archive anyway`,failed:`Couldn't archive: {error}`,restoreFailed:`Couldn't restore: {error}`},rerun:{started:`Re-running failed checks`,none:`No failed checks to re-run`,external:`These checks didn't run on GitHub Actions; re-run them where they ran`,refused:`Re-run refused: {detail}`},changeEngine:{title:`Change engine`,current:`current`,effortLabel:`EFFORT`,noEffort:`engine default`,footer:{engine:`↑↓ engine`,effort:`←→ effort`,model:`tab model`,set:`enter set`,cancel:`esc cancel`}},engineModel:{label:`MODEL`,placeholder:`engine default`,loading:`listing models…`},tier:{swift:`swift`,standard:`standard`,deep:`deep`,manual:`manual`},tierDesc:{swift:`small, well-specified edits — the fastest, cheapest setting`,standard:`everyday feature work and bug fixes`,deep:`hard problems: unclear root causes, large refactors, design decisions`},runAgain:{title:`Run again`,source:`Brief from “{title}”`,hint:`Runs this brief again in a new task, on its own branch and worktree.`,confirm:`Run again`,footer:`↑↓ scroll · ←→ choose · enter run · esc cancel`},fieldNotes:{title:`Field notes`,empty:"No field notes for this repo yet — agents file one with `rove api note`.",loading:`Loading…`,footer:`↑↓ scroll · esc close`,footerDeletable:`↑↓ select · d delete · esc close`,confirmDelete:{title:`Delete this field note?`,body:`“{text}” stops being injected into new sessions on this repo. Nothing else changes.`}},confirm:Kn,renameBranch:{title:`Rename branch`,fieldLabel:`branch`},moveChip:` move`,recentJump:`Recent: {title}`,routinesRow:`{count} routine sessions`,routinesRowOne:`1 routine session`,archivedRow:`Archived · {count}`,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:Jn},Zn={nav:{kanban:`看板`,automations:`例行任务`,issues:`议题`,mods:`Mods`},header:{scratch:`未分组`},search:{placeholder:`模糊搜索`},sort:{label:`排序:{mode}`,hint:`切换排序(手动 → 最新 → 关注 → 名称)`,reorderSwitched:`调整顺序需手动排序,已切换`,modes:{default:`手动`,recent:`最新`,attention:`关注`,name:`名称`}},menu:{open:`打开`,collapseChildren:`折叠子任务`,expandChildren:`展开子任务`,newChat:`新建会话`,newShell:`新建终端`,newScratchChat:`新建会话(无文件夹)`,newTask:`新建任务`,forgetProject:`移除项目`,fieldNotes:`现场笔记`,rename:`重命名`,pin:`置顶`,unpin:`取消置顶`,reorder:`重新排序`,moveToTop:`移到顶部`,reorderProject:`调整项目顺序`,runAgain:`重新运行`,setStatus:`设置状态`,copyId:`复制任务 ID`,copyBranch:`复制分支名`,copyPath:`复制路径`,openEditor:`在编辑器中打开`,renameBranch:`重命名分支`,changeEngine:`切换引擎`,fixChecks:`修复失败的检查`,rerunChecks:`重新运行失败的检查`,syncBase:`同步基础分支`,resolveConflicts:`让 agent 解决冲突`,land:`合入基础分支`,archive:`归档`,unarchive:`取消归档`,delete:`移除会话`},status:{backlog:`待办`,inProgress:`进行中`,inReview:`待评审`,done:`已完成`,canceled:`已取消`,error:`出错`},setStatus:{title:`设置状态`,current:`当前`,footer:`↑↓ 选择 · enter 设置 · esc 取消`},sync:{done:`已把 {base} 合并进该工作树`,alreadyCurrent:`已经和 {base} 同步`,conflict:`合并冲突——解决后提交:{files}`,dirty:`请先提交工作树里的改动,再同步:{files}`,failed:`同步失败:{error}`},archive:{done:`已归档 {title}。工作树、分支和会话都保持原样`,restored:`已恢复 {title}`,busyTitle:`它还在工作,仍要归档?`,busyBody:`{title} 里有引擎仍在工作或在等你。归档只隐藏这一行,不会停止它。`,busyConfirm:`仍要归档`,failed:`归档失败:{error}`,restoreFailed:`恢复失败:{error}`},rerun:{started:`正在重新运行失败的检查`,none:`没有可重新运行的失败检查`,external:`这些检查不是在 GitHub Actions 上运行的,请到它们运行的地方重新运行`,refused:`无法重新运行:{detail}`},changeEngine:{title:`切换引擎`,current:`当前`,effortLabel:`推理强度`,noEffort:`引擎默认`,footer:{engine:`↑↓ 引擎`,effort:`←→ 强度`,model:`tab 模型`,set:`enter 设置`,cancel:`esc 取消`}},engineModel:{label:`模型`,placeholder:`引擎默认`,loading:`正在列出模型…`},tier:{swift:`轻快`,standard:`标准`,deep:`深入`,manual:`手动`},tierDesc:{swift:`小而明确的改动——最快、最省的一档`,standard:`日常的功能开发和修 bug`,deep:`难题:根因不明、大重构、设计决策`},runAgain:{title:`重新运行`,source:`来自任务「{title}」的指令`,hint:`在新任务里重新执行这段指令,新任务有自己的分支和工作树。`,confirm:`重新运行`,footer:`↑↓ 滚动 · ←→ 选择 · enter 运行 · esc 取消`},confirm:qn,renameBranch:{title:`重命名分支`,fieldLabel:`分支`},fieldNotes:{title:`现场笔记`,empty:"该仓库暂无现场笔记——agent 可用 `rove api note` 记录。",loading:`加载中…`,footer:`↑↓ 滚动 · esc 关闭`,footerDeletable:`↑↓ 选择 · d 删除 · esc 关闭`,confirmDelete:{title:`删除这条现场笔记?`,body:`「{text}」将不再注入该仓库的新会话。其他内容不受影响。`}},moveChip:` 移动`,recentJump:`最近:{title}`,routinesRow:`{count} 个 routine 会话`,routinesRowOne:`1 个 routine 会话`,archivedRow:`已归档 · {count}`,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:Yn},Qn={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`},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`,closeOthers:`Close other tabs`,close:`Close tab`},nothingToFork:`No conversation in this tab to fork yet`,noTranscriptToHandOff:`{engine} keeps no readable transcript to hand over`},split:{renameTitle:`Rename split`,renameField:`SPLIT NAME`},scrolledBack:`↑ scrolled {lines}L`,scrollFirst:`[first]`,scrollLatest:`[latest]`,search:{placeholder:`search scrollback — enter/↑ older, ↓ newer, esc close`,position:`{index}/{total}`,noMatches:`no matches`,unavailable:`this app owns its own scrollback — nothing local to search (esc)`},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.`}},$n={recovery:{live:`已重新连接仍在运行的进程`,relaunched:`命令已在新进程中重启。如有恢复的输出,它属于历史记录;请在引擎内确认会话恢复或继续操作。`,restored:`已恢复历史画面;原进程已结束。请重启并确认引擎状态后继续。`},noTask:`(无任务 —— 按 n 创建)`,exited:`进程已退出 —— 按 F5 重启`,engineExit:{title:`引擎已退出`,titleCode:`引擎已退出(退出码 {code})`,retry:`重试`,settings:`设置 → 引擎`,another:`换个引擎`},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:`复制标签页地址`,closeOthers:`关闭其他标签页`,close:`关闭标签页`},nothingToFork:`这个标签页还没有可派生的对话`,noTranscriptToHandOff:`{engine} 没有可读的对话记录,无法交接`},split:{renameTitle:`重命名分屏`,renameField:`分屏名称`},scrolledBack:`↑ 已回滚 {lines} 行`,scrollFirst:`[最早]`,scrollLatest:`[最新]`,search:{placeholder:`搜索回滚缓冲区 —— enter/↑ 更早,↓ 更晚,esc 关闭`,position:`{index}/{total}`,noMatches:`没有匹配`,unavailable:`这个程序自己管理回滚缓冲区 —— 本地没有可搜索的内容(esc)`},unavailable:{shellMissing:`终端不可用 —— $SHELL 指向的 shell 在这台机器上不存在。请把 $SHELL 指向一个真实存在的 shell,或取消设置以回退到系统默认。`,spawnFailed:`终端不可用 —— shell 启动后立即退出。具体错误见 ~/.rove/pty.log。`,retry:`按 F5 重试`},reset:{title:`重置终端?`,body:`正在运行的 shell 会被杀掉并在 worktree 重新启动,进行中的进程(vim、htop、暂停的任务)会立即结束。`}},er={pageTitle:`ROVE UPDATE`,closeHint:`q / esc close`,chip:`↑ {version}`,current:`current`,available:`v{version} available`,latest:`latest`,latestUnknown:`unknown — could not reach the registry`,registryRetry:`Check your connection, then close and reopen Update to retry.`,upToDate:`No newer release — nothing to install.`,releaseUrlUnavailable:`release URL unavailable; visit github.com/Sma1lboy/rove/releases`,statusReleaseOpened:`Opened release page in your browser.`,statusReleaseError:`Could not open release URL. Visit github.com/Sma1lboy/rove/releases in your browser.`,statusRunningUpdater:`Closing the TUI and running the updater in this terminal...`,loadingNotes:`Loading release notes...`,notesUnavailable:`Release notes are unavailable. Use Open release to view the GitHub release page.`,changesSectionHeader:`── changes from v{from} to v{to} ──`,updateComplete:`Rove update complete. Relaunch Rove to use the new version.`,updateFailed:"Rove update failed with exit code {code}. Check the output above, then run `rove update` to retry.",pressAnyKey:`Press any key to close this update window.`,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`}},tr={pageTitle:`ROVE 更新`,closeHint:`q / esc 关闭`,chip:`↑ {version}`,current:`当前`,available:`有新版本 v{version}`,latest:`最新`,latestUnknown:`未知 —— 无法连接到 registry`,registryRetry:`请检查网络,然后关闭并重新打开更新页重试。`,upToDate:`没有更新的版本 —— 无需安装。`,releaseUrlUnavailable:`发布链接不可用;请访问 github.com/Sma1lboy/rove/releases`,statusReleaseOpened:`已在浏览器中打开发布说明页面。`,statusReleaseError:`无法打开发布链接。请在浏览器访问 github.com/Sma1lboy/rove/releases。`,statusRunningUpdater:`正在关闭 TUI,并在当前终端中运行更新程序……`,loadingNotes:`正在加载发布说明……`,notesUnavailable:`发布说明不可用。请使用「打开发布页」查看 GitHub 发布页面。`,changesSectionHeader:`── v{from} 至 v{to} 的变更 ──`,updateComplete:`Rove 更新完成。请重新启动 Rove 以使用新版本。`,updateFailed:"Rove 更新失败,退出码为 {code}。请检查上方输出,再运行 `rove update` 重试。",pressAnyKey:`按任意键关闭此更新窗口。`,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 关闭`}},nr={quit:{confirmTitle:`Quit Rove?`,confirmBody:`The daemon and task sessions keep running. This closes only the native workspace.`,confirmLabel:`Quit`},narrowBack:`Tasks`,empty:{selectTask:`Select a task with a worktree`,noSessions:`No sessions here — press ⏎ to start {engine}, or ctrl+e to pick another`,noSessionsShell:`No sessions here — press ⏎ to start a shell, or ctrl+e to pick another`,remoteUnsupported:`Hosted engine launch over SSH is not implemented — this task's worktree is on {host}`},welcome:{title:`Welcome to Rove`,tagline:`Run several AI coding sessions side by side — use managed tasks for isolated worktrees.`,worktreeExplain:`Managed tasks create isolated worktrees and branches. Directory and project tasks reuse existing files; tabs within a task share its directory.`,stepNew:`creates your first task — pick a repo, a base branch, an engine`,stepHelp:`shows every shortcut reachable from the current focus`,stepPrefix:`opens the command menu`,enginesFound:`✓ engines: {list}`,enginesSignedOut:`✗ installed but not signed in: {list} — run one of them in a shell and log in`,enginesMissing:`✗ no engine CLI found — install claude, codex, copilot, or kimi, then restart Rove`,gitMissing:`✗ git not found on PATH — Rove needs git to create worktrees`,doctorHint:"run `rove doctor` in a shell for the full diagnosis",docsHint:`docs: https://docs.rove.run`},attention:{none:`No available Inbox items`},inbox:{title:`INBOX`,empty:`No pending attention`,openHint:`enter open`,clearHint:`d clear`,more:`+{count} more`,section:{attention:`ATTENTION`,recent:`RECENT`},state:{done:`done`,needsInput:`needs input`,error:`error`,rateLimited:`rate limited`,running:`running`,dead:`engine exited`,routineFailed:`routine needs you`,reportMissing:`report missing`,decisionNeeded:`decision needed`,gateAnswered:`answered · engine not running`},resumesAt:`resumes {time}`}},rr={quit:{confirmTitle:`退出 Rove?`,confirmBody:`守护进程和任务会话会继续运行,这里只关闭原生工作区。`,confirmLabel:`退出`},narrowBack:`任务`,empty:{selectTask:`请选择一个带 worktree 的任务`,noSessions:`这里没有会话——按 ⏎ 启动 {engine},或按 ctrl+e 另选一个`,noSessionsShell:`这里没有会话——按 ⏎ 启动 shell,或按 ctrl+e 另选一个`,remoteUnsupported:`尚未实现通过 SSH 启动托管引擎——该任务的 worktree 在 {host} 上`},welcome:{title:`欢迎使用 Rove`,tagline:`并行运行多个 AI 编码会话——使用托管任务获得独立的 worktree。`,worktreeExplain:`托管任务创建独立的 worktree 和分支。目录与项目任务复用现有文件;同一任务内的标签页共享目录。`,stepNew:`创建你的第一个任务——选仓库、基础分支和引擎`,stepHelp:`查看当前焦点下的全部快捷键`,stepPrefix:`打开命令菜单`,enginesFound:`✓ 已检测到引擎:{list}`,enginesSignedOut:`✗ 已安装但未登录:{list}——请在 shell 里运行其中之一并完成登录`,enginesMissing:`✗ 未找到引擎 CLI——请安装 claude、codex、copilot 或 kimi 后重启 Rove`,gitMissing:`✗ PATH 上没有 git——Rove 需要 git 来创建 worktree`,doctorHint:"在 shell 里运行 `rove doctor` 查看完整诊断",docsHint:`文档:https://docs.rove.run`},attention:{none:`收件箱中没有可打开的项目`},inbox:{title:`收件箱`,empty:`暂无待处理`,openHint:`enter 打开`,clearHint:`d 清除`,more:`还有 {count} 条`,section:{attention:`待处理`,recent:`最近使用`},state:{done:`完成`,needsInput:`需要输入`,error:`出错`,rateLimited:`限流`,running:`进行中`,dead:`引擎已退出`,routineFailed:`例行任务需要处理`,reportMissing:`未回报`,decisionNeeded:`等你决定`,gateAnswered:`已回答 · 引擎未运行`},resumesAt:`{time} 恢复`}},ir={title:`Worktrees`,loading:`Loading worktrees…`,noProjects:`No local projects known to Rove yet.`,noWorktrees:`No worktrees.`,badge:{roveManaged:`rove`,dirty:`dirty`,dirtyUnknown:`dirty?`,remoteOn:`on remote`,remoteOff:`not pushed`,remoteUnknown:`remote unknown`},verdict:{prOpen:`PR open`,prMerged:`merged (PR)`,inMain:`in main`,prClosed:`PR closed`,idle:`stale`},row:{detached:`(detached)`,created:`created {age} ago`},delete:{button:`Delete`,confirmTitle:`Delete worktree?`,confirmBody:`Delete the worktree for "{branch}"? This removes the working directory; the branch itself is kept.`,forceTitle:`Force delete worktree?`,forceBody:'"{branch}" has uncommitted, untracked, or gitignored work. Force delete removes the worktree, but the work is snapshotted first to a salvage ref — list them with `git for-each-ref refs/rove/salvage`. Force delete anyway?',forceReason:`Refused because: {reason}`,failed:`Failed to delete worktree: {error}`,residue:`Git deregistered the worktree, but couldn't delete {path} ({reason}). Rove is done with it — retrying won't help; delete the directory by hand if you want the space.`},land:{button:`Land`,confirmTitle:`Land branch?`,confirmBody:`Merge "{branch}" into {landedOn} ({commits} commits), then remove this worktree? The branch is kept. Conflicts abort with a file list.`,confirmBodyOne:`Merge "{branch}" into {landedOn} (1 commit), then remove this worktree? The branch is kept. Conflicts abort with a file list.`,noTask:`This worktree isn't tracked as a Rove task — nothing to land.`,conflict:`Land hit conflicts (merge aborted). Resolve by hand: {files}`,dirtyBase:"The base checkout has uncommitted changes — commit them, then land. Never `git stash` here: the stash stack lives in the repo's common dir and is shared by every linked worktree, so a stash can entangle other tasks' work.",failed:`Land failed: {error}`,done:`Landed "{branch}" onto {landedOn} ({commit}).`,worktreeKept:`Landed, but the worktree was kept: {reason}`,worktreePathStale:`Landed and removed the worktree, but the task still points at it: {reason}`,worktreeResidue:`Landed. Git deregistered the worktree, but couldn't delete {path} ({reason}) — delete the directory by hand if you want the space.`},hint:{}},ar={title:`工作树`,loading:`正在加载 worktree…`,noProjects:`Rove 还没有已知的本地项目。`,noWorktrees:`没有 worktree。`,badge:{roveManaged:`rove`,dirty:`有改动`,dirtyUnknown:`改动未知`,remoteOn:`已推送`,remoteOff:`未推送`,remoteUnknown:`远端未知`},verdict:{prOpen:`PR 评审中`,prMerged:`已合入 (PR)`,inMain:`已在主分支`,prClosed:`PR 已关闭`,idle:`陈旧`},row:{detached:`(游离状态)`,created:`{age}前创建`},delete:{button:`删除`,confirmTitle:`删除 worktree?`,confirmBody:`确定删除 "{branch}" 对应的 worktree?工作目录会被移除,分支本身会保留。`,forceTitle:`强制删除 worktree?`,forceBody:'"{branch}" 存在未提交、未跟踪或被 gitignore 的改动。强制删除会移除 worktree,但这些改动会先被快照到一个 salvage ref——用 `git for-each-ref refs/rove/salvage` 可以列出它们。仍要强制删除吗?',forceReason:`拒绝原因:{reason}`,failed:`删除 worktree 失败:{error}`,residue:`Git 已注销该 worktree,但没能删掉 {path}({reason})。Rove 这边已经处理完了——重试没有用;想要回磁盘空间请手动删除该目录。`},land:{button:`合入`,confirmTitle:`合入分支?`,confirmBody:`把 "{branch}" 合入 {landedOn}({commits} 个提交),然后移除这个 worktree?分支会保留。冲突会中止并给出文件清单。`,confirmBodyOne:`把 "{branch}" 合入 {landedOn}(1 个提交),然后移除这个 worktree?分支会保留。冲突会中止并给出文件清单。`,noTask:`该 worktree 未作为 Rove 任务被跟踪——没有可合入的对象。`,conflict:`合入遇到冲突(已中止)。请手动解决:{files}`,dirtyBase:"基础检出有未提交改动——请先提交再合入。绝不要在这里 `git stash`:stash 栈存放在仓库的 common dir 中,该仓库所有 linked worktree 共享,一次 stash 可能纠缠其他任务的工作。",failed:`合入失败:{error}`,done:`已把 "{branch}" 合入 {landedOn}({commit})。`,worktreeKept:`已合入,但 worktree 保留了:{reason}`,worktreePathStale:`已合入并移除 worktree,但任务仍指向它:{reason}`,worktreeResidue:`已合入。Git 已注销该 worktree,但没能删掉 {path}({reason})——想要回磁盘空间请手动删除该目录。`},hint:{}},or={common:{en:Pn,zh:Fn},doctor:{en:In,zh:Ln},files:{en:Rn,zh:zn},newTask:{en:Bn,zh:Vn},onboarding:{en:Hn,zh:Un},quickTask:{en:Wn,zh:Gn},tasks:{en:Xn,zh:Zn},terminal:{en:Qn,zh:$n},update:{en:er,zh:tr},workspace:{en:nr,zh:rr},worktrees:{en:ir,zh:ar}};function sr(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=or[e],i=sr(r[ee.get()],t)??sr(r.en,t)??t;return n?i.replace(/\{(\w+)\}/g,(e,t)=>String(n[t]??e)):i}var cr=[{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`}],lr=[{id:`files.nav`,scope:`files`,keys:[`j`,`k`,`down`,`up`],category:`Files`,description:`Move cursor up/down`,hint:{keys:`j/k`}},{id:`files.hierarchy`,scope:`files`,keys:[`h`,`l`,`left`,`right`],category:`Files`,description:`Collapse / expand tree level`,hint:{keys:`h/l`}},{id:`files.open`,scope:`files`,keys:[`return`],category:`Files`,description:`Open file in configured editor (diff when supported)`,hint:{keys:`enter`}},{id:`files.tab`,scope:`files`,keys:[`[`,`]`],category:`Files`,description:`Switch tab (cycle All / Changes)`,hint:{keys:`[/]`}},{id:`files.refresh`,scope:`files`,keys:[`r`],category:`Files`,description:`Refresh`,hint:{keys:`r`}},{id:`files.scope`,scope:`files`,keys:[`b`],category:`Files`,description:`Toggle Changes scope (working ↔ branch vs base)`,hint:{keys:`b`}},{id:`files.diff`,scope:`files`,keys:[`d`],category:`Files`,description:`Open read-only diff in a workspace tab`,hint:{keys:`d`}},{id:`files.diffAll`,scope:`files`,keys:[`shift+d`],category:`Files`,description:`Open the whole worktree's diff in one workspace tab`,hint:{keys:`D`}},{id:`files.openExternal`,scope:`files`,keys:[`o`],category:`Files`,description:`Open file in system default app (audio / video / pdf preview)`,hint:{keys:`o`}},{id:`files.mention`,scope:`files`,keys:[`a`],category:`Files`,description:`Inject @<path> mention into the engine pane`,hint:{keys:`a`}},{id:`files.createPR`,scope:`global`,keys:[],prefixKeys:[`p`,`shift+p`],category:`Files`,description:`Ask the agent to create a PR from the current task`},{id:`files.fixChecks`,scope:`global`,keys:[],prefixKeys:[`k`],category:`Files`,description:`Ask the agent to fix the failing PR checks`},{id:`files.syncBase`,scope:`global`,keys:[],prefixKeys:[`u`],category:`Files`,description:`Merge the base branch into this task's worktree`},{id:`diff.review.cursor`,scope:`workspace`,keys:[],category:`Diff review`,description:`Move the line cursor over the diff`,hint:{keys:`j/k`}},{id:`diff.review.range`,scope:`workspace`,keys:[],category:`Diff review`,description:`Toggle range anchor at the cursor`,hint:{keys:`v`}},{id:`diff.review.note`,scope:`workspace`,keys:[],category:`Diff review`,description:`Add a review note at the cursor`,hint:{keys:`c`}},{id:`diff.review.send`,scope:`workspace`,keys:[],category:`Diff review`,description:`Send all unsent review notes to the engine`,hint:{keys:`s`}},{id:`diff.review.drop`,scope:`workspace`,keys:[],category:`Diff review`,description:`Drop the review note the cursor sits inside`,hint:{keys:`x`}},{id:`diff.review.reload`,scope:`workspace`,keys:[],category:`Diff review`,description:`Reload the previewed file from disk`,hint:{keys:`r`}}],ur=[{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:`Remove the selected Inbox item`,hint:{keys:`d`}}],dr=[{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`],category:`Workspace`,description:`Back to sidebar (tasks)`,hint:{keys:`ctrl+q`},presentation:`onePress`},{id:`focus.previous`,scope:`global`,keys:[],prefixKeys:[`h`],category:`Navigation`,description:`Focus previous pane (files → workspace → sidebar)`},{id:`focus.next`,scope:`global`,keys:[`f4`],prefixKeys:[`l`],category:`Navigation`,description:`Focus next pane (sidebar → workspace → files)`,hint:{keys:`f4`},presentation:`onePress`},{id:`attention.next`,scope:`global`,keys:[`f7`],category:`Navigation`,description:`Jump to the next available Inbox item`,hint:{keys:`f7`},presentation:`onePress`},{id:`workspace.zenToggle`,scope:`global`,keys:[],prefixKeys:[`z`],category:`Navigation`,description:`Toggle zen mode (hide the files column)`},{id:`view.redraw`,scope:`global`,keys:[],prefixKeys:[`r`],category:`Global`,description:`Redraw the screen`},{id:`sidebar.nav`,scope:`sidebar`,keys:[`j`,`k`,`down`,`up`],category:`Sidebar`,description:`Move cursor up/down`,hint:{keys:`j/k`}},{id:`sidebar.select`,scope:`sidebar`,keys:[`return`],category:`Sidebar`,description:`Open the selected task`,hint:{keys:`enter`}},{id:`sidebar.tree.open`,scope:`sidebar`,keys:[`l`,`space`],category:`Sidebar`,description:`Open the row under the cursor (a tab row enters its chat)`,hint:{keys:`l`}},{id:`sidebar.goto`,scope:`sidebar`,keys:[`g`,`shift+g`],category:`Sidebar`,description:`Top / bottom of list (gg or shift-G)`},{id:`sidebar.rename`,scope:`sidebar`,keys:[`r`],category:`Sidebar`,description:`Rename task`,hint:{keys:`r`}},{id:`sidebar.localMerge`,scope:`sidebar`,keys:[`shift+m`],category:`Sidebar`,description:`Reorder row (Shift+M, then j/k)`,hint:{keys:`M`}},{id:`sidebar.pin`,scope:`sidebar`,keys:[`shift+p`],category:`Sidebar`,description:`Pin / unpin task at top (Shift+P)`,hint:{keys:`P`}},{id:`sidebar.sort`,scope:`sidebar`,keys:[`t`],category:`Sidebar`,description:`Cycle task sort (default → recent → attention → name)`,hint:{keys:`t`}},{id:`sidebar.delete`,scope:`sidebar`,keys:[`d`],category:`Sidebar`,description:`Remove session (with confirm)`,hint:{keys:`d`}},{id:`sidebar.search.enter`,scope:`sidebar`,keys:[`/`],category:`Sidebar`,description:`Search tasks (fuzzy filter)`,hint:{keys:`/`}},{id:`sidebar.search.nav`,scope:`sidebar`,keys:[`down`,`up`],category:`Sidebar`,description:`Move highlight in search results`},{id:`sidebar.search.submit`,scope:`sidebar`,keys:[`return`],category:`Sidebar`,description:`Select search match and exit search`},{id:`sidebar.search.cancel`,scope:`sidebar`,keys:[`escape`],category:`Sidebar`,description:`Cancel search (restore prior selection)`},{id:`tasks.openWorktree`,scope:`sidebar`,keys:[`o`],category:`Tasks pane`,description:`Open selected Task directory in your editor`,hint:{keys:`o`}},{id:`tasks.renameBranch`,scope:`sidebar`,keys:[`b`],category:`Tasks pane`,description:`Rename the selected task's git branch`,hint:{keys:`b`}},{id:`tasks.cycleEngine`,scope:`sidebar`,keys:[`v`],category:`Tasks pane`,description:`Cycle engine vendor — applies on reopen`,hint:{keys:`v`}},{id:`tasks.update`,scope:`sidebar`,keys:[`u`],category:`Tasks pane`,description:`Open the update page — version check + release notes`,hint:{keys:`u`}},{id:`tasks.focusEngine`,scope:`sidebar`,keys:[`right`],category:`Tasks pane`,description:`Focus the engine pane of the current window`,hint:{keys:`→`}},...cr,...lr,...ur,{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`},{id:`terminal.search`,scope:`terminal`,keys:[],prefixKeys:[`/`],category:`Terminal`,description:`Search the scrollback`},{id:`terminal.search.older`,scope:`terminal`,keys:[`up`,`return`],category:`Terminal`,description:`Scrollback search: walk to the older match`},{id:`terminal.search.newer`,scope:`terminal`,keys:[`down`],category:`Terminal`,description:`Scrollback search: walk to the newer match`},{id:`terminal.search.cancel`,scope:`terminal`,keys:[`escape`],category:`Terminal`,description:`Close scrollback search (restore prior scroll position)`}],fr={ctrl:`⌃`,control:`⌃`,alt:`⌥`,opt:`⌥`,option:`⌥`,shift:`⇧`,cmd:`⌘`,command:`⌘`,meta:`⌘`,super:`⌘`},pr={enter:`⏎`,return:`⏎`,esc:`⎋`,escape:`⎋`,space:`␣`,up:`↑`,down:`↓`,left:`←`,right:`→`,backspace:`⌫`,delete:`⌦`,del:`⌦`,pgup:`⇞`,pageup:`⇞`,pgdn:`⇟`,pagedown:`⇟`,home:`↖`,end:`↘`};function mr(e,t){if(e.includes(`/`))return e.split(`/`).map(e=>mr(e,t)).join(`/`);let n=e.toLowerCase();return n===`tab`?`tab`:pr[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 hr(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(`+`)?hr(e,t):mr(e,!0)}`}let i=n.split(`+`);if(i.length===1)return mr(i[0]??``,!1);let a=i[i.length-1]??``;return`${i.slice(0,-1).map(e=>fr[e.toLowerCase().trim()]??e).join(``)} ${mr(a,!0)}`}var gr=_({path:``,exists:!1,rows:[],prefix:{key:`ctrl+a`,firstStrokes:[`ctrl+a`],timeoutMs:5e3},plugins:[],applied:[],warnings:[]}),_r=new Map(dr.map(e=>[e.id,{keys:[...e.keys],prefixKeys:e.prefixKeys&&[...e.prefixKeys],hint:e.hint&&{...e.hint}}]));function vr(e){for(let e of dr){let t=_r.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=dr.find(e=>e.id===t.id);e&&(e.keys=[...t.keys],e.prefixKeys=t.prefixKeys&&[...t.prefixKeys],e.hint=t.hint&&{...t.hint})}gr.set(e)}async function yr(e){try{vr(await e.request(`keybindings.get`))}catch{}}function br(e){let t=v(e.conn).hello;(0,g.useEffect)(()=>{if(!t)return;let n=()=>void yr(e);return n(),window.addEventListener(`focus`,n),()=>window.removeEventListener(`focus`,n)},[t,e])}var xr=()=>gr.get().prefix.key,Sr=()=>{let e=xr();return e===null?``:hr(e)};function Cr(e,t=`direct`){let n=dr.find(t=>t.id===e),r=t===`prefix`?n?.prefixKeys?.[0]:n?.keys[0];return r===void 0?void 0:hr(r)}var wr=e=>dr.find(t=>t.id===e)?.keys??[];function Tr(e){let t=Sr(),n=Cr(e,`prefix`);return t&&n?`${t} ${n}`:``}var Er=e=>_r.get(e)?.prefixKeys??[];function Dr(e,t){let n=gr.get().rows.find(t=>t.id===e),r=_r.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 Or(e,t){for(let n of t){let t=e.find(e=>e.chord===n);if(t)return t}}function kr(e){return!e.dialog&&e.page!==`worktrees`&&e.page!==`update`}var Ar=_({stale:!1,daemonVersion:null,bridgeVersion:null}),jr=2e4;async function Mr(e){try{let t=await e.request(`daemon.info`);return Ar.set({stale:t.stale,daemonVersion:t.daemonVersion,bridgeVersion:t.bridgeVersion}),t.stale}catch{return Ar.get().stale}}function Nr(e){(0,g.useEffect)(()=>{let t=e.onOpen(()=>void Mr(e)),n=window.setInterval(()=>void Mr(e),jr);return()=>{t(),window.clearInterval(n)}},[e])}function Pr(e){if(!Ar.get().stale){G(K(`update`,`refresh.alreadyCurrent`),`error`);return}W.set((0,B.jsx)(Mn,{title:K(`update`,`refresh.confirmTitle`),body:K(`update`,`refresh.confirmBody`),confirmLabel:K(`update`,`refresh.confirmLabel`),onConfirm:async()=>{await e.request(`daemon.restart`),G(K(`update`,`refresh.relaunching`));for(let t=0;t<20;t++)if(await new Promise(e=>window.setTimeout(e,1e3)),!await Mr(e))return;throw Error(R(`layout.refreshTimeout`))}}))}function Fr({onRefresh:e}){z();let{stale:t,daemonVersion:n,bridgeVersion:r}=v(Ar);if(v(gr),!t)return null;let i=K(`update`,`skew.hint`,{daemon:n?`v${n}`:K(`update`,`skew.olderBuild`),clientVersion:r??``,keys:Tr(`app.refresh`)});return(0,B.jsxs)(`div`,{className:`mono ${Ye}`,role:`alert`,children:[(0,B.jsx)(`b`,{children:K(`update`,`skew.title`)}),(0,B.jsx)(`span`,{children:i}),(0,B.jsx)(`button`,{type:`button`,className:Tt,onClick:e,children:K(`update`,`refresh.confirmLabel`)})]})}var Ir=[`info`,`success`,`warning`,`error`,`muted`],Lr=4e3,Rr=4e3,zr=/^[A-Za-z0-9._:-]{1,64}$/,Br={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 Vr(e){return typeof e==`string`&&Ir.includes(e)}function Hr(e){return e===0||e===1||e===2||e===3}var Ur=class extends Error{};function Wr(e){let t=0,n=new Set,r=(e,i,a)=>{if(a>12)throw new Ur(`${i}: deeper than 12`);if(++t>400)throw new Ur(`more than 400 elements`);if(!e||typeof e!=`object`||Array.isArray(e))throw new Ur(`${i}: not an element`);let o=e,s=o.type;if(s!==`box`&&s!==`text`&&s!==`button`&&s!==`input`)throw new Ur(`${i}: unknown element ${JSON.stringify(s)}`);for(let e of Object.keys(o))if(!Br[s].has(e))throw new Ur(`${i}: ${s} has no prop "${e}"`);if(o.tone!==void 0&&!Vr(o.tone))throw new Ur(`${i}: tone must be one of ${Ir.join(`, `)}`);if(s===`text`){if(typeof o.text!=`string`||o.text.length>4e3)throw new Ur(`${i}: text must be a string of at most ${Lr} chars`);if(o.bold!==void 0&&typeof o.bold!=`boolean`)throw new Ur(`${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`||!zr.test(o.key))throw new Ur(`${i}: bad ${s} key`);if(n.has(o.key))throw new Ur(`${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 Ur(`${i}: ${e} must be a string of at most ${Rr} 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 Ur(`${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 Ur(`${i}: direction must be "row" or "column"`);for(let e of[`gap`,`padding`])if(o[e]!==void 0&&!Hr(o[e]))throw new Ur(`${i}: ${e} must be 0-3`);if(o.border!==void 0&&typeof o.border!=`boolean`)throw new Ur(`${i}: border must be boolean`);if(!Array.isArray(o.children))throw new Ur(`${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 Ur)return{ok:!1,error:e.message};throw e}}function Gr(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=Wr(t.tree);r.ok&&n.push({plugin:t.plugin,id:t.id,title:t.title,tree:r.tree})}return n}function Kr(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 qr(e,t){return e!==null&&t!==null&&e.plugin===t.plugin&&e.pane===t.pane&&e.key===t.key}function Jr(e,t){return e.find(e=>qr(e,t))??e[0]??null}function Yr(e,t,n){if(e.length===0)return null;let r=e.findIndex(e=>qr(e,t));return r<0?e[0]??null:e[(r+n+e.length)%e.length]??null}var Xr=`rove.web.selection`,Zr=`null`,Qr=300;function $r(){try{let e=JSON.parse(localStorage.getItem(Xr)??`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 ei(e){return!!e&&typeof e==`object`&&`tasks`in e&&Array.isArray(e.tasks)}var ti=`rove.web.visits`,ni=20;function ri(){try{let e=JSON.parse(localStorage.getItem(ti)??`[]`);return Array.isArray(e)?e.filter(e=>!!e&&typeof e==`object`&&typeof e.taskId==`string`):[]}catch{return[]}}function ii(e,t){if(t)return e?.tasks.find(e=>e.id===t)??e?.archived?.find(e=>e.id===t)}function ai(e,t,n,r){let i=(e,t)=>e.some(e=>e.id===t&&!e.deleting),a=n.taskId;if(a===null||!i(e,a)||i(t,a))return null;let o=r.find(e=>e.taskId!==a&&i(t,e.taskId));return o?{taskId:o.taskId,tabId:o.tabId}:{taskId:null,tabId:null}}var oi=class{client;tasks=_(null);remote=_([]);tabs=_({});tabsSettled=_(!1);mods=_([]);dispatches=_(null);installedMods=_(new Set);selection=_($r());visits=_(ri());tabTimer=null;tabsLoaded=!1;tabSweep=0;pendingSelect=null;selectIntent=0;provisioning=new Map;viewingSent=Zr;taskShown=!0;viewingExtras=()=>({});constructor(e){this.client=e,e.onOpen(()=>{e.request(`tasks.subscribe`).then(e=>this.acceptTasks(e)),this.viewingSent=Zr,this.reportViewing(),this.refreshMods()}),typeof document<`u`&&typeof document.addEventListener==`function`&&document.addEventListener(`visibilitychange`,()=>{this.reportViewing(),document.visibilityState===`visible`&&this.refreshMods()}),typeof window<`u`&&typeof window.addEventListener==`function`&&window.addEventListener(`pagehide`,()=>this.reportViewing(!0)),e.on(`tasks`,e=>{ei(e)&&this.acceptTasks(e)}),e.on(`tabs`,()=>this.scheduleTabRefresh()),e.on(`mods`,e=>this.mods.set(Gr(e)??[])),e.on(`dispatch`,e=>{e&&typeof e==`object`&&`rows`in e&&Array.isArray(e.rows)&&this.dispatches.set(e)})}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??si(n)?.id??null};this.selection.set(r),localStorage.setItem(Xr,JSON.stringify(r));let i=[{...r,at:Date.now()},...this.visits.get().filter(e=>e.taskId!==r.taskId||e.tabId!==r.tabId)].slice(0,ni);this.visits.set(i),localStorage.setItem(ti,JSON.stringify(i)),this.reportViewing(),e in this.tabs.get()||this.scheduleTabRefresh()}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=Zr)}))}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,G(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(){await this.refreshTabs(this.tabbedTasks())}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)]}acceptTasks(e){let t=[...this.tasks.get()?.tasks??[],...this.remote.get()];this.remote.set(e.tasks.filter(e=>e.machine)),this.tasks.set({...e,tasks:e.tasks.filter(e=>!e.machine)});let n=ai(t,e.tasks,this.selection.get(),this.visits.get());n?.taskId?this.commitSelection(n.taskId,n.tabId):n&&(this.selection.set(n),localStorage.setItem(Xr,JSON.stringify(n)),this.reportViewing()),this.pendingSelect&&e.tasks.some(e=>e.id===this.pendingSelect)&&(this.select(this.pendingSelect),this.pendingSelect=null),this.scheduleTabRefresh()}scheduleTabRefresh(){if(this.tabTimer!==null)return;let e=this.tabsLoaded?Qr:0;this.tabsLoaded=!0,this.tabTimer=window.setTimeout(()=>{this.tabTimer=null,this.refreshTabs(this.tabbedTasks())},e)}async refreshTabs(e){let t=++this.tabSweep,n=e.filter(e=>!e.deleting);if(await Promise.all(n.map(async e=>{let n;try{n=(await this.client.request(`task.tabs`,{taskId:e.id})).tabs}catch{return}t===this.tabSweep&&(this.tabs.set({...this.tabs.get(),[e.id]:n}),this.reselectIfClosed(e.id))})),t!==this.tabSweep)return;this.tabsSettled.get()||this.tabsSettled.set(!0);let r=new Set(n.map(e=>e.id));this.tabs.set(Object.fromEntries(Object.entries(this.tabs.get()).filter(([e])=>r.has(e))))}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 si(e){return e.find(e=>e.alive!==!1)??e[0]}function ci(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 li=[`default`,`recent`,`attention`,`name`],ui={folded:new Set,opened:new Set},di=e=>{let t=Date.parse(e??``);return Number.isFinite(t)?t:0},fi=e=>di(e.updatedAt??e.createdAt),pi=e=>di(e.createdAt),mi=(e,t)=>pi(t)-pi(e)||t.id.localeCompare(e.id),hi=(e,t)=>fi(t)-fi(e)||t.id.localeCompare(e.id),gi=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`}),_i={default:null,recent:mi,attention:(e,t)=>e.rank-t.rank||hi(e,t),name:(e,t)=>gi.compare(e.title.trim(),t.title.trim())||e.id.localeCompare(t.id)},vi=e=>e.split(`/`).filter(Boolean).pop()??e;function yi(e,t,n=``){let r=vi(e),i=t.filter(t=>(t.repo!==e||t.host!==n)&&vi(t.repo)===r);if(i.length===0)return r;let a=e=>e.split(`/`).filter(Boolean).slice(-2).join(`/`);return i.some(e=>e.host===n)?i.some(t=>t.host!==n&&a(t.repo)===a(e))&&n?`${n}:${a(e)}`:a(e):n?`${n}:${r}`:r}var bi=`~scratch`,xi=e=>e.kind===`dir`&&(e.scratch===!0||e.noProject===!0);function Si(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=xi(e)?bi:e.repo,n=r.get(t);n?n.push(e):r.set(t,[e])}let i=_i[t],a=[...r].map(([e,t])=>{let n=t.sort(wi(i));if(e===`~scratch`&&t.every(xi))return{repo:``,label:R(`rail.noProject`),tasks:n,key:bi,noProject:!0};let r=t.find(e=>e.repoId)?.repoId;return{repo:e,label:vi(e),tasks:n,...r?{repoId:r}:{}}});return[...a.filter(e=>e.noProject),...a.filter(e=>!e.noProject)]}var Ci=e=>e.kind===`main`?0:e.pinned?1:2,wi=e=>(t,n)=>Ci(t)-Ci(n)||(e?e(t,n):0);function Ti(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 Ei(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)||Ti(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 Di(e,t,n=[]){for(let r of e.get(t)??[])n.push(r.id),Di(e,r.id,n);return n}function Oi(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 ki(e,t=``,n=ui,r=0){let i=t.trim(),a=(...e)=>e.some(e=>e!==``&&ci(i,e)),{children:o,nested:s}=Ei(e),c=[];for(let t of e){let e=i===``||a(t.label),l=t.machine===void 0?{}:{machine:t.machine},u=t.key??t.repo,d=t=>e||a(t.title,t.branch,vi(t.repo)),f=e=>d(e)||(o.get(e.id)??[]).some(f),p=(e,t,r,a=!1)=>{let s=r+1,c=t.machine?{machine:t.machine.id}:{},l=o.get(t.id),u=l?Di(o,t.id):[],m=l!==void 0&&i===``&&Oi(t.id,l.length,u,n);e.push({id:t.id,kind:`task`,task:t,depth:Math.min(s,3),...s>3?{level:s}:{},...l?{fold:{count:u.length,collapsed:m,descendantIds:u}}:{},...c});let h=a||d(t);if(!m)for(let t of l??[])(h||f(t))&&p(e,t,r+1,h)},m=[];for(let e of t.tasks)!s.has(e.id)&&f(e)&&p(m,e,r);m.length===0&&!e||c.push({id:`project:${u}`,kind:`project`,repo:t.repo,label:t.label,...t.noProject?{noProject:!0}:{},...l},...m)}return c}var Ai=e=>Math.max(0,...e.tasks.map(pi)),ji=e=>e.startsWith(`root:`)?null:e.split(`/`).slice(-2).join(`/`);function Mi(e,t){let n=vi(e.repo),r=t.filter(t=>t!==e&&vi(t.repo)===n);if(r.length===0)return n;let i=e.repoId,a=i?ji(i):null;return i&&a?r.some(e=>e.repoId&&e.repoId!==i&&ji(e.repoId)===a)?i:a:yi(e.repo,[e,...r].map(e=>({repo:e.repo,host:``})))}function Ni(e){let t=e.tasks.filter(e=>!e.routine),n=e.remote.filter(e=>!e.routine),r=[...Si(t,e.sort).map(e=>({group:e})),...e.machines.flatMap(t=>Si(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?bi:t??(e.machine===void 0?n:`${e.machine}\0${n}`),a=i.get(r);a?a.push(e):i.set(r,[e])}let a=_i[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(wi(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:Mi(e,s)])),l=s.map(e=>({...e,label:c.get(e)??e.label}));return e.sort===`recent`&&l.sort((e,t)=>Ai(t)-Ai(e)),e.sort===`name`&&l.sort((e,t)=>gi.compare(e.label,t.label)),l.sort((e,t)=>Number(t.noProject===!0)-Number(e.noProject===!0)),{rows:ki(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 Pi(e,t){return e.kind===`dir`?e.title:t?.find(e=>e.kind===`engine`&&e.conversation)?.conversation??e.title}function Fi(e){return e.title??e.engineName??(e.kind===`engine`?R(`tab.engine`):R(`tab.shell`))}function Ii(e,t){if(t.size===0)return e;let n=!1;return e.filter(e=>e.kind===`project`?(n=t.has(e.id),!0):!n)}function Li({model:e}){let t=v(e.selection),n=v(e.tasks),r=v(e.tabs),i=v(e.remote),a=ii(n,t.taskId)??i.find(e=>e.id===t.taskId),o=n?.attention.filter(e=>e.unread).length??0,s=`${o>0?`(${o}) `:``}${a?`${Pi(a,r[a.id])} - `:``}rove`;return(0,g.useEffect)(()=>{document.title=s},[s]),null}function Ri(e){return e.focusedPane===`sidebar`?`sidebar`:e.hasSelection||e.hasOpenPage?`content`:`sidebar`}var zi=`(max-width: 559px)`,Bi=_(`sidebar`),Vi=()=>Bi.set(`workspace`),Hi=()=>Bi.set(`sidebar`);function Ui(e){Nt.set(e),Vi()}var Wi=window.matchMedia(zi),Gi=()=>Wi.matches,Ki=e=>(Wi.addEventListener(`change`,e),()=>Wi.removeEventListener(`change`,e));function qi(){return(0,g.useSyncExternalStore)(e=>(Wi.addEventListener(`change`,e),()=>Wi.removeEventListener(`change`,e)),()=>Wi.matches)}function Ji(e,t,n){return Ri({focusedPane:e,hasSelection:t,hasOpenPage:n})}function Yi(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 Xi(e=fetch){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 Zi(e,t=fetch){try{let n=await t(`/login`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({password:e}),credentials:`omit`}),r=Yi(n.status,await n.json().catch(()=>null));return r.kind===`ok`&&o(r.token),r}catch{return{kind:`unreachable`}}}async function Qi(e=fetch){let t=a();s(),t&&await e(`/logout`,{method:`POST`,headers:{Authorization:`Bearer ${t}`}}).catch(()=>{})}function $i(e){if(!e)return null;switch(e.kind){case`ok`:return null;case`wrong`:return R(`login.wrong`);case`locked`:return R(`login.locked`,{minutes:e.minutes});case`lockedHost`:return R(`login.lockedHost`);case`unreachable`:return R(`login.unreachable`)}}function ea(){z();let[e,t]=(0,g.useState)(``),[n,r]=(0,g.useState)(!1),[i,a]=(0,g.useState)(null),o=$i(i);return(0,B.jsx)(`div`,{className:_t,children:(0,B.jsxs)(`form`,{className:vt,onSubmit:async i=>{if(i.preventDefault(),n||!e)return;r(!0);let o=await Zi(e);if(o.kind===`ok`){window.location.reload();return}t(``),a(o),r(!1)},children:[(0,B.jsxs)(`span`,{className:ht,children:[(0,B.jsx)(`span`,{className:gt,children:`[`}),` rove `,(0,B.jsx)(`span`,{className:gt,children:`]`})]}),(0,B.jsx)(`h1`,{className:`${H} text-muted`,children:R(`login.title`)}),(0,B.jsx)(`p`,{className:`text-muted`,children:R(`login.body`)}),(0,B.jsx)(`input`,{className:U,type:`password`,autoComplete:`current-password`,"aria-label":R(`login.field`),placeholder:R(`login.field`),autoFocus:!0,value:e,disabled:n,onChange:e=>{t(e.target.value),a(null)}}),o&&(0,B.jsx)(`p`,{className:`text-error`,role:`alert`,children:o}),(0,B.jsx)(`div`,{className:Dt,children:(0,B.jsx)(`button`,{type:`submit`,className:V(),disabled:n||!e,children:R(n?`login.checking`:`login.submit`)})})]})})}function ta(e){return(0,B.jsx)(`svg`,{className:`block size-2.5 flex-none transition-[rotate,opacity] duration-120 ease-[ease] motion-reduce:transition-none ${e.right?`-rotate-90 is-right`:``} ${e.className??``}`,viewBox:`0 0 10 10`,"aria-hidden":`true`,children:(0,B.jsx)(`path`,{d:`M2.5 3.75 5 6.25l2.5-2.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.3`,strokeLinecap:`round`,strokeLinejoin:`round`})})}var na=120;function ra(e,t,n,r=e-t){return e+t+8<=n?e:Math.max(8,Math.min(r,n-t-8))}function ia(e){let{item:t}=e;return(0,B.jsxs)(`button`,{ref:e.rowRef,type:`button`,role:t.checked===void 0?`menuitem`:`menuitemradio`,"aria-checked":t.checked,"aria-haspopup":t.children?`menu`:void 0,"aria-expanded":t.children?!!e.open:void 0,className:cn({selected:e.selected,open:e.open,danger:t.danger}),onMouseEnter:e.onEnter,onMouseLeave:e.onLeave,onClick:e.onPick,children:[(0,B.jsx)(`span`,{children:t.label}),t.children?(0,B.jsx)(ta,{right:!0,className:dn(!!(e.selected||e.open))}):t.checked?(0,B.jsx)(`span`,{className:fn,"aria-hidden":!0,children:`✓`}):t.key&&(0,B.jsx)(`span`,{className:un({selected:e.selected,danger:t.danger}),children:t.key})]})}function aa(){let e=v(At),[t,n]=(0,g.useState)(0),[r,i]=(0,g.useState)(null),[a,o]=(0,g.useState)(-1),[s,c]=(0,g.useState)(!1),l=(0,g.useRef)(null),u=(0,g.useRef)(null),d=(0,g.useRef)([]),f=(0,g.useRef)(void 0),[p,m]=(0,g.useState)({x:0,y:0}),[h,_]=(0,g.useState)({x:0,y:0});if((0,g.useLayoutEffect)(()=>{if(!e||!l.current)return;n(e.fromKeyboard?0:-1),i(null),c(!1);let{width:t,height:r}=l.current.getBoundingClientRect();m({x:ra(e.x,t,window.innerWidth),y:ra(e.y,r,window.innerHeight)});let a=e.target;return a?.setAttribute(`data-menu-open`,``),()=>a?.removeAttribute(`data-menu-open`)},[e]),(0,g.useLayoutEffect)(()=>{let e=r===null?null:d.current[r];if(!e||!l.current||!u.current)return;let t=l.current.getBoundingClientRect(),n=e.getBoundingClientRect(),{width:i,height:a}=u.current.getBoundingClientRect();_({x:ra(t.right+2,i,window.innerWidth,t.left-i-2),y:ra(n.top-5,a,window.innerHeight,n.bottom+5-a)})},[r]),(0,g.useEffect)(()=>()=>window.clearTimeout(f.current),[]),(0,g.useEffect)(()=>{if(!e)return;let d=e.items,f=r===null?[]:d[r]?.children??[],p=()=>At.set(null),m=e=>{e?.run&&(p(),e.run())},h=(e,t,n)=>e(e=>n===1?e>=t?0:e+1:e<=0?t:e-1),g=e=>{let l=e.key;if(s&&r!==null){let t=f.length-1;if(l===`Escape`||l===`ArrowLeft`||l===`h`)i(null),c(!1);else if(l===`ArrowDown`||l===`j`)h(o,t,1);else if(l===`ArrowUp`||l===`k`)h(o,t,-1);else if(l===`Home`)o(0);else if(l===`End`)o(t);else if(l===`Enter`)m(f[a]);else return;e.preventDefault(),e.stopPropagation();return}let u=d.length-1,g=d[t],_=()=>{i(t),c(!0),o(0)};if(l===`Escape`)p();else if(l===`ArrowDown`||l===`j`)h(n,u,1);else if(l===`ArrowUp`||l===`k`)h(n,u,-1);else if(l===`Home`)n(0);else if(l===`End`)n(u);else if((l===`ArrowRight`||l===`l`)&&g?.children)_();else if(l===`Enter`)g?.children?_():m(g);else return;e.preventDefault(),e.stopPropagation()},_=e=>{e.target instanceof Node&&(l.current?.contains(e.target)||u.current?.contains(e.target))||p()};return window.addEventListener(`keydown`,g,!0),window.addEventListener(`mousedown`,_),()=>{window.removeEventListener(`keydown`,g,!0),window.removeEventListener(`mousedown`,_)}},[e,t,r,a,s]),!e)return null;let y=r===null?null:e.items[r]?.children,b=e=>{e.run&&(At.set(null),e.run())},x=e=>{window.clearTimeout(f.current),i(e),c(!1),o(-1)};return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{ref:l,className:sn(),role:`menu`,style:{left:p.x,top:p.y},children:e.items.map((a,o)=>(0,B.jsxs)(g.Fragment,{children:[o>0&&a.section!==e.items[o-1]?.section&&(0,B.jsx)(`hr`,{className:`-mx-1 my-1 h-px flex-none border-none bg-line`}),(0,B.jsx)(ia,{item:a,rowRef:e=>{d.current[o]=e},selected:o===t,open:o===r,onEnter:()=>{n(o),window.clearTimeout(f.current),a.children?f.current=window.setTimeout(()=>x(o),na):i(null)},onLeave:()=>{window.clearTimeout(f.current),o!==r&&n(-1)},onPick:()=>a.children?x(o):b(a)})]},a.label))}),y&&(0,B.jsx)(`div`,{ref:u,className:sn(!0),role:`menu`,style:{left:h.x,top:h.y},children:y.map((e,t)=>(0,B.jsx)(ia,{item:e,selected:t===a,onEnter:()=>{o(t),c(!0)},onLeave:()=>o(-1),onPick:()=>b(e)},e.label))})]})}function oa(){let e=v(W),t=v(Mt);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(aa,{}),e,(0,B.jsx)(`div`,{className:pn,"aria-live":`polite`,children:t.map(e=>(0,B.jsx)(`button`,{type:`button`,className:`${mn(e.tone===`error`)} ${e.leaving?`is-leaving`:``}`,onClick:()=>Ut(e.id),children:e.text},e.id))})]})}var sa=[`files`,`diff`,`browser`],ca=_(`terminal`),la=`rove.web.panelWidth`,ua=`rove.web.panelOpen`,da=_((()=>{let e=Number(localStorage.getItem(la));return Number.isFinite(e)&&e>0?e:null})());da.subscribe(()=>{let e=da.get();e===null?localStorage.removeItem(la):localStorage.setItem(la,String(Math.round(e)))}),da.subscribe(qt);var fa=_(localStorage.getItem(ua)===`1`);fa.subscribe(()=>localStorage.setItem(ua,fa.get()?`1`:`0`));var pa=_(!1);fa.subscribe(()=>{fa.get()||pa.set(!1)});function ma(e,t,n=window.innerWidth){let r=Math.max(280,n-t-320);return Math.max(280,Math.min(r,Math.round(e)))}var ha={Enter:`return`," ":`space`,Escape:`escape`,ArrowUp:`up`,ArrowDown:`down`,ArrowLeft:`left`,ArrowRight:`right`,PageUp:`pageup`,PageDown:`pagedown`};function ga(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 ha[e.key]??e.key.toLowerCase()}function _a(e){let t=ga(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 va(e){return e.startsWith(`shift+`)&&e.length===7?e.slice(6).toUpperCase():e}var ya=[];function ba(e){ya.push(e)}var xa={workspace:`workspace`,sidebar:`sidebar`,files:`files`,terminal:`terminal`};function Sa(){let e=ya.flatMap(e=>e()),t=new Set(e.filter(e=>!e.prefix).map(e=>e.id)),n=e.map(e=>{let t=Dr(e.id,e.prefix?`prefix`:`direct`);return t?{...e,chords:t}:e});for(let r of e){let e=r.prefix?Dr(r.id,`direct`):void 0;if(!e||e.length===0||t.has(r.id))continue;t.add(r.id);let i=dr.find(e=>e.id===r.id)?.scope??`global`;n.push({...r,prefix:!1,chords:e,...xa[i]?{surface:xa[i]}:{}})}return n}function Ca(e,t){return!e.surface||e.surface===t||t===`terminal`&&e.surface===`workspace`}function wa(e,t){return e.surface===t?0:e.surface?1:2}function Ta(){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 Ea(e,t){let n=new Set,r=new Set;for(let i of Sa())!Ca(i,t)||i.live?.(e)===!1||(i.prefix?r:n).add(i.id);return{direct:n,prefix:r,inputPassthrough:t===`terminal`}}function Da(){let e=new Set(Sa().map(e=>e.id));return dr.filter(t=>e.has(t.id))}new Map(dr.map(e=>[e.id,{keys:[...e.keys],prefixKeys:e.prefixKeys&&[...e.prefixKeys],hint:e.hint?{...e.hint}:void 0}]));var Oa=new Map(dr.map(e=>[e.id,e]));function ka(e){return Oa.get(e)}function Aa(e){return e.hint?.keys??e.keys[0]}function ja(e){let t=ka(e);if(!t)return null;let n=Aa(t);return n&&n.length>0?n:null}function Ma(e){return e.keys.length>0?e.hint?.keys??e.keys[0]??null:e.prefixKeys?.length?null:e.hint?.keys??null}function Na(e,t){return e.scope===`global`?!0:t===null?!1:e.scope===t||t===`terminal`&&e.scope===`workspace`}function Pa(e,t,n,r){let i=[],a=[],o=[],s=new Map;for(let c of e){let e=Ma(c),l=Na(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 Fa={global:`Global`,sidebar:`Sidebar`,workspace:`Workspace`,files:`Files`,inbox:`Inbox`,terminal:`Terminal`};function Ia(e){return e?Fa[e]:`Global`}function La(e){return[`kanban.open`,`automations.open`,`workItems.open`].includes(e)?`Views`:e.startsWith(`focus.`)?`Navigation`:e.startsWith(`inbox.`)||e.startsWith(`attention.`)?`Attention`:e.startsWith(`chat.tab.`)||e.startsWith(`chat.session.`)?`Sessions`:e.startsWith(`chat.fork.`)||e.startsWith(`task.`)?`Tasks`:e.startsWith(`settings.`)||e===`workspace.zenToggle`?`Tools`:ka(e)?.category??`Global`}function Ra(e,t,n){let r=e.trim();return ci(r,t)||ci(r,n)}var za={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`,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}`},Ba={title:`Rove — 快捷键`,palette:`搜索命令`,search:`输入操作名称或快捷键…`,filter:`/ 筛选操作`,noResults:`没有匹配的操作。请换个名称或清空筛选。`,run:`↑↓ 选择 · enter 执行 · esc 取消`,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}`},Va={status:{commands:`{key} commands`,help:`{key} help`,sidebar:`{key} sidebar`,settings:`settings`},pane:{move:`move`,open:`open`,collapse:`collapse`,diff:`diff`}},Ha={status:{commands:`{key} 命令`,help:`{key} 帮助`,sidebar:`{key} 侧栏`,settings:`设置`},pane:{move:`移动`,open:`打开`,collapse:`折叠`,diff:`差异`}},Ua={category:{Global:`Global`,Sidebar:`Sidebar`,Workspace:`Workspace`,Navigation:`Navigation`,"Tasks pane":`Tasks pane`,Files:`Files`,Terminal:`Terminal`,Views:`Views`,Tasks:`Tasks`,Sessions:`Sessions`,Attention:`Attention`,Tools:`Tools`,"Diff review":`Diff review`,Inbox:`Inbox`},desc:{"palette.open":`Search commands`,"help.open":`Show keybindings help`,"task.new":`New task`,"task.new.global":`New task`,"task.openEditor":`Open active Task directory in editor`,"task.moveMode":`Reorder sidebar rows (then j/k — tab, task, or project)`,"settings.open":`Open settings`,"app.refresh":`Refresh Rove onto the installed build (after an update)`,"settings.open.sidebar":`Open settings`,"inbox.show":`Open Inbox`,"worktrees.open.sidebar":`Open worktrees`,"kanban.open":`Open kanban (issues board)`,"automations.open":`Open routines (scheduled tasks)`,"workItems.open":`Open GitHub issues (external tracker)`,"app.quit":`Quit (with confirm)`,"focus.sidebar":`Back to sidebar (tasks)`,"focus.previous":`Focus previous pane (files → workspace → sidebar)`,"focus.next":`Focus next pane (sidebar → workspace → files)`,"workspace.zenToggle":`Toggle zen mode`,"view.redraw":`Redraw the screen`,"attention.next":`Jump to the next Inbox item`,"sidebar.nav":`Move cursor up/down`,"sidebar.select":`Open the selected task`,"sidebar.tree.open":`Open the row under the cursor`,"sidebar.goto":`Top / bottom of list (gg or shift-G)`,"sidebar.rename":`Rename task`,"sidebar.localMerge":`Reorder row (Shift+M, then j/k — tab, task, or project)`,"sidebar.pin":`Pin / unpin task at top (Shift+P)`,"sidebar.sort":`Cycle task sort (default → recent → attention → name)`,"sidebar.delete":`Remove session (with confirm)`,"sidebar.search.enter":`Search tasks (fuzzy filter)`,"sidebar.search.nav":`Move highlight in search results`,"sidebar.search.submit":`Select search match and exit search`,"sidebar.search.cancel":`Cancel search (restore prior selection)`,"tasks.openWorktree":`Open selected Task directory in your editor`,"tasks.renameBranch":`Rename the selected task's git branch`,"tasks.cycleEngine":`Cycle engine vendor — applies on reopen`,"tasks.update":`Open the update page (when a new version is available)`,"tasks.focusEngine":`Focus the engine pane of the current window`,"chat.tab.new":`New conversation here (a child task sharing this directory)`,"chat.tab.chooseEngine":`New conversation — engine/shell picker with destination + context toggles`,"chat.tab.fork":`Continue this chat in a new child task (same directory, keeps the conversation)`,"chat.fork.new":`Quick-fork: create child task seeded with current repo/branch/model`,"chat.tab.close":`Close chat tab`,"chat.tab.rename":`Rename active chat tab`,"chat.tab.cycle-next":`Next chat tab`,"chat.tab.cycle-prev":`Previous chat tab`,"chat.tab.goto":`Go to chat tab N`,"workspace.split.right":`Split right`,"workspace.split.down":`Split down`,"workspace.split.focus-next":`Focus next split`,"workspace.split.close":`Close active split (tab when unsplit)`,"workspace.split.rename":`Rename active split (tab when unsplit)`,"workspace.reopenSession":`Reopen a session in a task whose tabs are all closed`,"files.nav":`Move cursor up/down`,"files.hierarchy":`Collapse / expand tree level`,"files.open":`Open file in configured editor (diff when supported)`,"files.tab":`Switch tab (cycle All / Changes)`,"files.refresh":`Refresh`,"files.scope":`Toggle Changes scope (working ↔ branch vs base)`,"files.diff":`Open a read-only diff in a workspace tab`,"files.diffAll":`Open the whole worktree's diff in one workspace tab`,"files.openExternal":`Open file in system default app (audio / video / pdf preview)`,"files.mention":`Inject @<path> mention into the engine pane`,"files.createPR":`Ask the agent to create a PR from the current task`,"files.fixChecks":`Ask the agent to fix the failing PR checks`,"files.syncBase":`Merge the base branch into this task's worktree`,"diff.review.cursor":`Move the line cursor over the diff`,"diff.review.range":`Toggle range anchor at the cursor`,"diff.review.note":`Add a review note at the cursor`,"diff.review.send":`Send all unsent review notes to the engine`,"diff.review.drop":`Drop the review note the cursor sits inside`,"diff.review.reload":`Reload the previewed file from disk`,"inbox.nav":`Move through Inbox items`,"inbox.open":`Open the selected Inbox item`,"inbox.delete":`Clear the selected Inbox item`,"terminal.scroll-up":`Scroll scrollback up`,"terminal.scroll-down":`Scroll scrollback down`,"terminal.reset":`Reset terminal — kill the current shell and respawn`,"terminal.search":`Search the scrollback`,"terminal.search.older":`Scrollback search: walk to the older match`,"terminal.search.newer":`Scrollback search: walk to the newer match`,"terminal.search.cancel":`Close scrollback search (restore prior scroll position)`}},Wa={category:{Global:`全局`,Sidebar:`侧边栏`,Workspace:`工作区`,Navigation:`导航`,"Tasks pane":`任务面板`,Files:`文件`,Terminal:`终端`,Views:`视图`,Tasks:`任务`,Sessions:`会话`,Attention:`提醒`,Tools:`工具`,"Diff review":`差异审阅`,Inbox:`收件箱`},desc:{"palette.open":`搜索命令`,"help.open":`显示快捷键帮助`,"task.new":`新建任务`,"task.new.global":`新建任务`,"task.openEditor":`在编辑器中打开当前 Task 的目录`,"task.moveMode":`调整侧边栏行顺序(然后 j/k——tab / 任务 / 项目)`,"settings.open":`打开设置`,"app.refresh":`让 Rove 刷新到已安装的版本(更新之后)`,"settings.open.sidebar":`打开设置`,"inbox.show":`打开收件箱`,"worktrees.open.sidebar":`打开 worktrees`,"kanban.open":`打开看板(issues)`,"automations.open":`打开例行任务(定时任务)`,"workItems.open":`打开 GitHub issues(外部跟踪器)`,"app.quit":`退出(需确认)`,"focus.sidebar":`返回侧边栏(任务列表)`,"focus.previous":`聚焦上一个面板(文件 → 工作区 → 侧边栏)`,"focus.next":`聚焦下一个面板(侧边栏 → 工作区 → 文件)`,"workspace.zenToggle":`切换禅模式`,"view.redraw":`重绘屏幕`,"attention.next":`跳到下一个收件箱条目`,"sidebar.nav":`上下移动光标`,"sidebar.select":`打开选中的任务`,"sidebar.tree.open":`打开光标所在行`,"sidebar.goto":`跳到列表顶部 / 底部(gg 或 shift-G)`,"sidebar.rename":`重命名任务`,"sidebar.localMerge":`调整当前行顺序(Shift+M,然后 j/k——tab / 任务 / 项目)`,"sidebar.pin":`置顶 / 取消置顶任务(Shift+P)`,"sidebar.sort":`切换任务排序方式(默认 → 最近 → 关注 → 名称)`,"sidebar.delete":`移除会话(需确认)`,"sidebar.search.enter":`搜索任务(模糊过滤)`,"sidebar.search.nav":`在搜索结果中移动高亮`,"sidebar.search.submit":`选中搜索匹配项并退出搜索`,"sidebar.search.cancel":`取消搜索(恢复之前的选中项)`,"tasks.openWorktree":`在编辑器中打开选中 Task 的目录`,"tasks.renameBranch":`重命名选中任务的 git 分支`,"tasks.cycleEngine":`循环切换引擎厂商——重新打开后生效`,"tasks.update":`打开更新页面(有新版本时)`,"tasks.focusEngine":`聚焦当前窗口的引擎面板`,"chat.tab.new":`在此新建对话(共享当前目录的子任务)`,"chat.tab.chooseEngine":`新建对话 —— 选择引擎或 shell,可切换落点与上下文`,"chat.tab.fork":`把当前对话接到新子任务(同一目录,带上已有对话)`,"chat.fork.new":`快速派生:以当前仓库/分支/模型创建子任务`,"chat.tab.close":`关闭聊天标签页`,"chat.tab.rename":`重命名当前聊天标签页`,"chat.tab.cycle-next":`下一个聊天标签页`,"chat.tab.cycle-prev":`上一个聊天标签页`,"chat.tab.goto":`跳到第 N 个聊天标签页`,"workspace.split.right":`向右分屏`,"workspace.split.down":`向下分屏`,"workspace.split.focus-next":`聚焦下一个分屏`,"workspace.split.close":`关闭当前分屏(未分屏时关闭标签页)`,"workspace.split.rename":`重命名当前分屏(未分屏时重命名标签页)`,"workspace.reopenSession":`在标签页全部关闭的任务中重新打开会话`,"files.nav":`上下移动光标`,"files.hierarchy":`折叠 / 展开树层级`,"files.open":`在已配置的编辑器中打开文件(支持时显示 diff)`,"files.tab":`切换标签页(循环 全部 / 变更)`,"files.refresh":`刷新`,"files.scope":`切换变更范围(工作区 ↔ 分支对比 base)`,"files.diff":`在工作区标签页中打开只读 diff`,"files.diffAll":`把整个 worktree 的 diff 打开在一个工作区标签页里`,"files.openExternal":`在系统默认应用中打开文件(音频 / 视频 / pdf 预览)`,"files.mention":`将 @<path> 提及注入引擎面板`,"files.createPR":`让 agent 从当前任务创建 PR`,"files.fixChecks":`让 agent 修复失败的 PR 检查`,"files.syncBase":`把基础分支合并进该任务的工作树`,"diff.review.cursor":`在 diff 中移动行光标`,"diff.review.range":`在光标处切换范围锚点`,"diff.review.note":`在光标处添加审阅备注`,"diff.review.send":`将所有未发送的审阅备注发给引擎`,"diff.review.drop":`删除光标所在的评审备注`,"diff.review.reload":`从磁盘重新加载当前预览的文件`,"inbox.nav":`在收件箱条目之间移动`,"inbox.open":`打开选中的收件箱条目`,"inbox.delete":`清除选中的收件箱条目`,"terminal.scroll-up":`向上滚动回滚`,"terminal.scroll-down":`向下滚动回滚`,"terminal.reset":`重置终端——关闭当前 shell 并重新启动`,"terminal.search":`搜索回滚缓冲区`,"terminal.search.older":`回滚搜索:跳到更早的匹配`,"terminal.search.newer":`回滚搜索:跳到更晚的匹配`,"terminal.search.cancel":`关闭回滚搜索(恢复原来的滚动位置)`}};function Ga(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 Ka(e,t){return ee.get()===`zh`?t:e}function qa(e,t){return t?e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??e)):e}var Ja=(e,t)=>qa(Ga(Ka(za,Ba),e)??Ga(za,e)??e,t),Ya=(e,t)=>qa(Ga(Ka(Va,Ha),e)??Ga(Va,e)??e,t),Xa=(e,t)=>qa(Ga(Ka(Qn,$n),e)??Ga(Qn,e)??e,t);function Za(e){return Ka(Ua,Wa).desc[e]??Ua.desc[e]??e}function Qa(e){let t=Za(e),n=t.search(/\s—\s|——/);return n>0?t.slice(0,n):t}function $a(e){return Ka(Ua,Wa).category[e]??e}var eo=(e,t)=>qa(Ga(Ka(nr,rr),e)??Ga(nr,e)??e,t),to=(e,t)=>qa(Ga(Ka(Xn,Zn),e)??Ga(Xn,e)??e,t),no=e=>e.split(` + `).map(e=>hr(e)).join(` + `);function ro(e){let t=$a(Ia(e.scope));return e.kind===`here`?Ja(`here`,{surface:t}):e.kind===`direct`?Ja(`direct`):e.kind===`prefix`?Ja(`afterPrefix`):Ja(`otherPane`,{surface:t})}function io(e){let t=document.activeElement instanceof HTMLElement?document.activeElement:null;W.set((0,B.jsx)(ao,{model:e,surface:Ta(),origin:t}))}function ao({model:e,surface:t,origin:n}){z();let r=v(gr),[i,a]=(0,g.useState)(!1),[o,s]=(0,g.useState)(``),c=(0,g.useRef)(null),l=(0,g.useMemo)(()=>Ea(e,t),[e,t]),u=(0,g.useMemo)(()=>Pa(Da(),t===`terminal`?`terminal`:t,xr(),l),[l,t,r]).map(e=>({...e,rows:e.rows.filter(e=>Ra(o,Za(e.binding.id),e.primary))})).filter(e=>e.rows.length>0);return(0,g.useEffect)(()=>()=>n?.focus(),[n]),(0,g.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===`?`)Wt();else if(!i&&t.key===`/`)a(!0);else return;t.preventDefault()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[i]),(0,B.jsx)(kn,{title:Ja(`title`),wide:!0,children:(0,B.jsxs)(`div`,{className:`${on} help`,children:[(0,B.jsxs)(`div`,{className:He,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`text-muted`,children:t?Ja(`focused`,{surface:$a(Ia(t))}):Ja(`allBindings`)}),(0,B.jsx)(`p`,{className:`text-muted`,children:Ja(`grammar`,{prefix:Sr()})})]}),(0,B.jsxs)(`div`,{className:Ue,children:[(0,B.jsx)(`span`,{className:`subtle`,children:Ja(`scrollKeys`)}),(0,B.jsx)(`button`,{type:`button`,className:Tt,onClick:Wt,children:Ja(`esc`)})]})]}),i?(0,B.jsx)(`input`,{className:U,autoFocus:!0,spellCheck:!1,value:o,placeholder:Ja(`search`),onChange:e=>{s(e.target.value),c.current?.scrollTo({top:0})}}):(0,B.jsx)(`p`,{className:`text-muted`,children:Ja(`filter`)}),u.length===0&&(0,B.jsx)(`p`,{className:`text-muted`,children:Ja(`noResults`)}),(0,B.jsx)(`div`,{className:We,ref:c,children:u.map((e,t)=>(0,B.jsxs)(`section`,{className:Ge,children:[(0,B.jsx)(`h2`,{className:Ke,children:ro(e)}),e.rows.map(t=>(0,B.jsxs)(`div`,{className:qe,children:[(0,B.jsx)(`span`,{className:`mono ${Je}`,children:no(t.primary)}),(0,B.jsx)(`span`,{className:`flex-1`,children:Za(t.binding.id)}),t.aliases.length>0&&(0,B.jsx)(`span`,{className:`text-muted`,children:`(${t.aliases.map(no).join(`, `)})`})]},`${e.kind}-${t.binding.id}`))]},`${e.kind}-${e.scope??t}`))})]})})}function q(e,t){t.automationId&&e.client.request(`attention.dismissRoutine`,{automationId:t.automationId}).catch(e=>G(String(e),`error`))}function oo(e,t){q(e,t),Wt(),Pt.set(t.automationId??null),Ui(`routines`)}function so(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`routine_failed`:return{glyph:`↻`,tone:`attention`,stateKey:`inbox.state.routineFailed`};default:return{glyph:`!`,tone:`attention`,stateKey:`inbox.state.error`}}}function co(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 lo=e=>e===`routine_failed`,uo=e=>`${e.taskId??``}:${e.tabId??``}`;function fo(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)||uo(e).localeCompare(uo(t)))}function po(e,t,n){let r=new Set(t),i=fo(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=>uo(e)===uo(n));return a<0||i.length===1?i[0]??null:i[(a+1)%i.length]??null}var mo=[`image/png`,`image/jpeg`,`image/gif`,`image/webp`,`application/pdf`];function ho(e){return{drop:{onDragOver:e=>e.dataTransfer.types.includes(`Files`)&&e.preventDefault(),onDrop:t=>{t.dataTransfer.files.length!==0&&(t.preventDefault(),e(Array.from(t.dataTransfer.files)))}},onPaste:t=>{let n=Array.from(t.clipboardData.files);n.length!==0&&(t.preventDefault(),e(n))}}}function go(e){return(0,B.jsxs)(`label`,{className:e.className,title:e.title,children:[e.children,(0,B.jsx)(`input`,{type:`file`,accept:mo.join(`,`),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)}})]})}function _o(e,t){return t.length===0?e:`${e}\n\n${t.map((e,t)=>`${e.kind===`pdf`?`pdf`:`images`}[${t}]: ${e.path}`).join(`
|
|
10
|
-
`)}`}async function vo(e){let t=new Uint8Array(await e.arrayBuffer()),n=``;for(let e=0;e<t.length;e+=32768)n+=String.fromCharCode(...t.subarray(e,e+32768));return btoa(n)}function yo(e,t){let[n,r]=(0,g.useState)([]);return{attachments:n,attach:async n=>{for(let i of n)if(mo.includes(i.type))try{let t=await e.client.request(`attachment.put`,{mime:i.type,data:await vo(i)});r(e=>[...e,{path:t.path,kind:t.kind,name:i.name||t.path}])}catch(e){t(e instanceof Error?e.message:String(e))}},remove:e=>r(t=>t.filter(t=>t.path!==e)),clear:()=>r([])}}function bo(e){return e.attachments.length===0?null:(0,B.jsx)(`div`,{className:Zt,"data-field":`attachments`,children:e.attachments.map((t,n)=>(0,B.jsxs)(`button`,{type:`button`,className:Qt(!0),title:t.path,onClick:()=>e.onRemove(t.path),children:[t.kind===`pdf`?`pdf`:`images`,`[`,n,`] ×`]},t.path))})}function xo(e){let t=(0,g.useRef)(null),n=(0,g.useRef)(e.value);n.current=e.value;let r=(r,i)=>{r.preventDefault();let a=e.choices.findIndex(e=>e.id===n.current),o=e.choices[(a+i+e.choices.length)%e.choices.length];o&&(n.current=o.id,e.onChange(o.id),requestAnimationFrame(()=>t.current?.querySelector(`[aria-pressed=true]`)?.focus()))};return(0,B.jsx)(`div`,{ref:t,className:Zt,"aria-label":e.label,"data-field":e.field,onKeyDown:t=>{t.ctrlKey||t.metaKey||t.altKey||e.choices.length===0||(t.key===`ArrowRight`||t.key===`l`?r(t,1):(t.key===`ArrowLeft`||t.key===`h`)&&r(t,-1))},children:e.choices.map(t=>(0,B.jsx)(`button`,{type:`button`,"aria-pressed":t.id===e.value,tabIndex:t.id===e.value||!e.choices.some(t=>t.id===e.value)?0:-1,className:Qt(t.id===e.value,t.dim),title:t.title,onClick:()=>e.onChange(t.id),children:t.label},t.id))})}function So(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(hover: none) and (pointer: coarse)`).matches}var Co=/^(?:enter|return|tab|esc|space|shift|ctrl\+\S+|cmd\+\S+|alt\+\S+|[↑↓←→]+(?:\/[↑↓←→]+)?|[b-hj-z](?:\/[b-hj-z])?)(?:\/\S+)?(?:\s|$)/i;function wo(e){return e.split(`·`).map(e=>e.trim()).filter(e=>e&&!Co.test(e)).join(` · `)}function To(e){return So()?wo(e):e}function Eo(e,t){let n=e.querySelector(`[data-field="${t}"]`);(n?.matches(`input, textarea`)?n:n?.querySelector(`[tabindex='0']`))?.focus()}function Do(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&&Eo(e,a)}var Oo=[`1`,`2`,`3`,`4`,`5`],ko=[`message`,`attempts`,`engine`,`base`];function Ao(e){let{model:t,start:n,engines:r}=e,[i,a]=(0,g.useState)(``),[o,s]=(0,g.useState)(`1`),[c,l]=(0,g.useState)(n.engine),[u,d]=(0,g.useState)(n.baseRef),{busy:f,error:p,setError:m,submit:h}=An(),{attachments:_,attach:v,remove:y}=yo(t,m),b=()=>{let e=r.findIndex(e=>e.id===c),t=r[(e+1)%r.length];t&&l(t.id)},x=()=>h(async()=>{if(i.trim().length===0)throw document.querySelector(`[data-field=message]`)?.focus(),Error(K(`quickTask`,`promptPlaceholder`));let e=Number(o),r=await t.client.request(`task.spawn`,{repo:n.repo,engine:c,baseBranch:u.trim()||n.baseRef,prompt:_o(i.trim(),_),...e>1?{count:e}:{}});e>1&&G(K(`quickTask`,`startedRound`,{count:r.taskIds.length}));let a=r.taskIds[0];a&&t.selectWhenListed(a)});return(0,B.jsx)(kn,{title:K(`quickTask`,`title`,{repoLabel:n.label}),wide:!0,children:(0,B.jsxs)(`form`,{className:on,onKeyDown:e=>{if(e.key===`Tab`&&!e.ctrlKey&&!e.metaKey&&!e.altKey)e.preventDefault(),Do(e.currentTarget,ko,e.shiftKey?-1:1);else if(e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.toLowerCase()===`e`)e.preventDefault(),e.stopPropagation(),b();else if(e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.toLowerCase()===`x`){e.preventDefault();let t=_.at(-1);t&&y(t.path)}else e.key===`Enter`&&!e.shiftKey&&e.target.closest(`[data-field=attempts], [data-field=engine]`)&&(e.preventDefault(),e.currentTarget.requestSubmit())},onSubmit:e=>{e.preventDefault(),x()},onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault(),v(Array.from(e.dataTransfer.files))},children:[(0,B.jsx)(`p`,{className:`text-muted`,children:So()?R(`pages.quickIntentTouch`):K(`onboarding`,`quickIntent`,{key:Tr(`task.new.global`)})}),(0,B.jsxs)(`label`,{className:Yt,children:[(0,B.jsx)(`span`,{className:`${H} text-muted`,children:K(`quickTask`,`promptLabel`)}),(0,B.jsx)(`textarea`,{className:`${U} ${Xt}`,"data-field":`message`,autoFocus:!0,rows:3,placeholder:K(`quickTask`,`promptPlaceholder`),value:i,onChange:e=>a(e.target.value),onPaste:e=>{let t=Array.from(e.clipboardData.files);t.length!==0&&(e.preventDefault(),v(t))},onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}})]}),(0,B.jsxs)(`div`,{className:Yt,children:[(0,B.jsx)(`span`,{className:`${H} text-muted`,children:K(`quickTask`,`attemptsLabel`)}),(0,B.jsx)(xo,{label:K(`quickTask`,`attemptsLabel`),field:`attempts`,value:o,onChange:s,choices:Oo.map(e=>({id:e,label:e}))})]}),(0,B.jsxs)(`div`,{className:Yt,children:[(0,B.jsx)(`span`,{className:`${H} text-muted`,children:K(`quickTask`,`engineLabel`)}),(0,B.jsx)(xo,{label:K(`quickTask`,`engineLabel`),field:`engine`,value:c,onChange:l,choices:r.map(e=>({id:e.id,label:e.name}))})]}),(0,B.jsxs)(`label`,{className:Yt,children:[(0,B.jsx)(`span`,{className:`${H} text-muted`,children:K(`quickTask`,`branchLabel`)}),(0,B.jsx)(`input`,{className:U,"data-field":`base`,spellCheck:!1,value:u,onChange:e=>d(e.target.value)})]}),(0,B.jsx)(bo,{attachments:_,onRemove:y}),So()?(0,B.jsx)(`p`,{className:`text-muted`,children:R(`pages.attachHintTouch`)}):(0,B.jsx)(`p`,{className:`keys-only mx-0 mt-2 mb-0 ${xt}`,children:K(`quickTask`,`legend`)}),p&&(0,B.jsx)(`p`,{className:`text-error`,children:p}),(0,B.jsx)(Nn,{busy:f,submitLabel:R(`newChat.start`)})]})})}function jo(e){if(typeof e!=`string`)return``;let t=e.replace(/\s+/g,` `).trim();if(t.length===0)return``;let n=[...t];return n.length<=40?t:`${n.slice(0,40).join(``)}…`}function Mo(e){let t=e.lastIndexOf(`/`);return t<0||t===e.length-1?{base:e,dir:``}:{base:e.slice(t+1),dir:e.slice(0,t+1)}}function No(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>e.toLowerCase().includes(n)):e}function Po(e){return e.startsWith(`~`)||e.includes(`/`)}function Fo(e,t){return t?e===`~`?t:e.startsWith(`~/`)?t+e.slice(1):e:e}function Io(e){return e.length>1?e.replace(/\/+$/,``):e}function Lo(e,t){return t?e===t?`~`:e.startsWith(`${t}/`)?`~${e.slice(t.length)}`:e:e}function Ro(e,t,n,r){let i=t+n;return e.startsWith(`~`)?Lo(i,r):i}function zo(e,t,n,r){return`${Ro(e,t,n,r)}/`}function Bo(e,t){let n=e.trim();if(!n||Po(n))return{kind:`path`,path:n};let r=t.filter(e=>Mo(e).base===n);return r.length===1?{kind:`path`,path:r[0]}:r.length>1?{kind:`ambiguous`,name:n}:{kind:`path`,path:n}}function Vo(e,t){let n=Mo(e).base,r=Bo(n,t);return r.kind===`path`&&r.path===e?n:e}function Ho(e){let t=e.trim().replace(/\/+$/,``),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`:`));return(n>=0?t.slice(n+1):t).replace(/\.git$/i,``)}var Uo=`rove.web.cloneParent`,Wo=/^(?:(?:https?|ssh|git):\/\/[A-Za-z0-9[]\S*|[A-Za-z0-9._-]+@[A-Za-z0-9][A-Za-z0-9.-]*:\S+)$/i,Go=/^[A-Za-z0-9][A-Za-z0-9-]{0,38}\/(?![.]+(?:git)?$)[A-Za-z0-9._-]{1,100}$/i;function Ko(e){let t=e.trim();return Wo.test(t)||Go.test(t)?t:null}function qo(e,t){let n=``;for(let t=0;t<e.length;t++){let r=e[t];r===`*`?e[t+1]===`*`?(n+=`.*`,t++):n+=`[^/]*`:n+=r===`?`?`[^/]`:r.replace(/[.+^${}()|[\]\\]/g,`\\$&`)}let r=RegExp(`^${n}$`);return r.test(t)||r.test(t.slice(t.lastIndexOf(`/`)+1))}function Jo(e,t){let n=t.trim();return n?e.filter(e=>qo(n,e.path)):e}function Yo(e,t){return e.filter(e=>e.enabled!==!1||e.id===t)}function Xo(e,t){let n=e.filter(e=>e.ready!==!1);return(n.find(e=>e.id===t)??n[0]??e[0])?.id??``}function Zo(e,t){return!e||e.acceptsModel===!1?[]:[{id:``,label:t},...(e.models??[]).map(e=>({id:e.id,label:e.label??e.id}))]}function Qo(e,t){let n=e?.effortLevels??[];return n.length===0?[]:[{id:``,label:t},...n.map(e=>({id:e,label:e}))]}function $o(e,t,n,r){let i=t?e.find(e=>e.id===t)?.label??t:r;return n?`${i} ${n}`:i}function es(e){let[t,...n]=e;if(!t)return``;let r=Mo(t).base;return n.length>0?`${r} +${n.length}`:r}function ts(e,t){return e.includes(t)?e.filter(e=>e!==t):e.length>=8?e:[...e,t]}function ns(e,t){if(!/^[1-9]$/.test(e))return null;let n=Number(e)-1;return n<t?n:null}function rs(e){let[t,...n]=e.repos;if(!t)throw Error(`no repo`);let r=e.begin?``:jo(e.prompt);return{repo:t.repo,...t.baseRef?{baseBranch:t.baseRef}:{},...n.length>0?{extraRepos:n.map(e=>({repo:e.repo,...e.baseRef?{baseRef:e.baseRef}:{}}))}:{},...n.length>0&&e.branch?{branch:e.branch}:{},...e.begin&&e.prompt?{prompt:e.prompt}:{},...r?{title:r}:{},...e.engine?{engine:e.engine}:{},...e.model?{model:e.model}:{},...e.effort?{effort:e.effort}:{}}}async function is(e,t,n,r){let i=t?{engine:t}:{},{taskId:a}=await e(`task.openScratch`,i);return r?await e(`tab.new`,{taskId:a,kind:`engine`,...i,prompt:n.trim()}):n.trim()&&await e(`task.rename`,{taskId:a,title:jo(n)}),a}var as=new WeakMap,os=e=>`client`in e?e.client:e,ss=(e,t)=>t?`${e} ${JSON.stringify(t)}`:e;function cs(e,t,n){return as.get(os(e))?.get(ss(t,n))}function ls(e,t,n,r){let i=os(e),a=as.get(i)??new Map;return as.set(i,a.set(ss(t,n),r)),r}function us(e,t,n){return os(e).request(t,n).then(r=>ls(e,t,n,r))}function ds(e,t){let n=t?{repo:t}:{},[r]=(0,g.useState)(()=>{let t=cs(e,`engines.list`,n),r=t?Yo(t.engines):[];return{offered:r,engine:t?Xo(r,t.preferred):``}}),[i,a]=(0,g.useState)(r.offered),[o,s]=(0,g.useState)(r.engine);return(0,g.useEffect)(()=>{us(e,`engines.list`,n).then(e=>{let t=Yo(e.engines);a(t),s(Xo(t,e.preferred))}).catch(()=>a([]))},[e]),{engines:i,engine:o,setEngine:s}}var fs=`shell`,ps=`pane:`,ms=e=>e.startsWith(ps),hs=e=>e.slice(5);function gs(e){let[t,n]=(0,g.useState)(()=>cs(e,`plugin.panes`)?.panes??[]);return(0,g.useEffect)(()=>{us(e,`plugin.panes`).then(e=>n(e.panes)).catch(()=>n([]))},[e]),t}function _s(e){let t=[...e.engines,...e.withShell?[{id:fs,name:R(`tab.shell`)}]:[],...(e.panes??[]).map(e=>({id:ps+e.id,name:e.title}))];return(0,B.jsx)(xo,{label:R(`newTask.engine`),field:`engine`,value:e.value,onChange:e.onChange,choices:t.map(e=>({id:e.id,label:e.name,dim:`ready`in e&&e.ready===!1,title:`ready`in e&&e.ready===!1?R(`newTask.notReady`):void 0}))})}function vs(e,t){return ys(e,t,{kind:`engine`,latest:!0}).catch(e=>G(String(e),`error`))}async function ys(e,t,n){let{tabId:r,taskId:i}=await e.client.request(`tab.new`,{taskId:t,kind:n.kind,...n.engine?{engine:n.engine}:{},...n.prompt?{prompt:n.prompt}:{},...n.latest?{latest:!0}:{}});if(i){e.selectWhenListed(i);return}await e.refreshTabsNow(),e.select(t,r)}async function bs(e){await ys(e,(await e.client.request(`task.openScratch`,{})).taskId,{kind:`shell`})}var xs=[`tab`,`fork`,`scratch`],Ss=[`message`,`attempts`,`engine`,`fork-base`,`destination`];function Cs(e){z();let{model:t,taskId:n}=e,r=t.tasks.get()?.tasks.find(e=>e.id===n),i=ds(t,r?.repo),[a,o]=(0,g.useState)(e.destination??`tab`),[s,c]=(0,g.useState)(e.context??`fresh`),[l,u]=(0,g.useState)(``),[d,f]=(0,g.useState)(`1`),[p,m]=(0,g.useState)(r?.branch??`main`),{busy:h,error:_,setError:v,submit:y}=An(),{attachments:b,attach:x,remove:S}=yo(t,v),C=s===`fresh`&&a!==`fork`,w=a===`tab`&&s===`fresh`,T=gs(t),E=i.engine===`shell`&&!C||ms(i.engine)&&!w?``:i.engine,D=E===fs,O=ms(E),k=a===`fork`,A=(e,t)=>{let n=e===`scratch`&&t===`continue`&&a===`scratch`?`tab`:e;o(n),c(n===`scratch`?`fresh`:t)},j=async()=>{let e=await t.client.request(`tab.handoff`,{taskId:n,tabId:t.selection.get().tabId??void 0});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`))},M=()=>y(async()=>{let e=[s===`continue`?await j():``,_o(l.trim(),b)].filter(Boolean).join(`
|
|
11
|
-
|
|
12
|
-
`);if(a===`scratch`){let e=await t.client.request(`task.openScratch`,D?{}:{engine:E});D?await ys(t,e.taskId,{kind:`shell`}):t.selectWhenListed(e.taskId)}else if(k){if(!r)throw Error(K(`terminal`,`tab.tabGone`));if(!l.trim())throw Error(R(`taskops.forkNeedsMessage`));let i=p.trim()||r.branch,a=await t.client.request(`tab.forkTask`,{repo:r.repo,baseBranch:i,prompt:e,...E?{engine:E}:{},...Number(d)>1?{count:Number(d)}:{},...i===r.branch?{forkFrom:n}:{}});a.forkRefused&&G(R(`taskops.forkLeftBehind`,{reason:a.forkRefused}));let o=a.taskIds[0];o&&t.selectWhenListed(o)}else if(D)await ys(t,n,{kind:`shell`});else if(O){let{selection:e}=t,r=e.get().taskId===n?e.get().tabId:null,i=await t.client.request(`plugin.paneOpen`,{taskId:n,pane:hs(E),...r?{tabId:r}:{}});await t.refreshTabsNow(),t.select(n,i.tabId)}else await ys(t,n,{kind:`engine`,engine:E,prompt:e})});return(0,B.jsx)(kn,{title:K(`terminal`,`tab.newChat.title`),wide:!0,children:(0,B.jsxs)(`form`,{className:on,onKeyDown:e=>{if(e.key===`Tab`&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&(k||!e.shiftKey))e.preventDefault(),e.stopPropagation(),k?Do(e.currentTarget,Ss,e.shiftKey?-1:1):A(xs[(xs.indexOf(a)+1)%xs.length]??`tab`,s);else if(e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.toLowerCase()===`e`){e.preventDefault(),e.stopPropagation();let t=i.engines.filter(e=>e.ready!==!1),n=t[(t.findIndex(e=>e.id===i.engine)+1)%t.length];n&&i.setEngine(n.id)}else e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.toLowerCase()===`f`?(e.preventDefault(),e.stopPropagation(),A(a,s===`fresh`?`continue`:`fresh`)):e.key===`Enter`&&k&&e.target.closest(`[data-field=attempts], [data-field=engine]`)&&(e.preventDefault(),e.currentTarget.requestSubmit())},onSubmit:e=>{e.preventDefault(),M()},onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault(),x(Array.from(e.dataTransfer.files))},children:[(0,B.jsxs)(`div`,{className:Yt,children:[(0,B.jsx)(`span`,{className:`${H} text-muted`,children:K(`terminal`,`tab.newChat.engine`)}),(0,B.jsx)(_s,{engines:i.engines,value:E,onChange:i.setEngine,withShell:C,panes:w?T:[]})]}),(0,B.jsxs)(`div`,{className:Yt,children:[(0,B.jsx)(`span`,{className:`${H} text-muted`,children:K(`terminal`,`tab.newChat.destLabel`)}),(0,B.jsx)(xo,{label:K(`terminal`,`tab.newChat.destLabel`),field:`destination`,value:a,onChange:e=>A(e,s),choices:xs.map(e=>({id:e,label:K(`terminal`,`tab.newChat.dest${e===`tab`?`Tab`:e===`fork`?`Fork`:`Scratch`}`)}))})]}),(0,B.jsxs)(`div`,{className:Yt,children:[(0,B.jsxs)(`span`,{className:`${H} text-muted`,children:[K(`terminal`,`tab.newChat.ctxLabel`),` `,(0,B.jsx)(`span`,{className:`keys-only`,children:`ctrl+f`})]}),(0,B.jsx)(xo,{label:K(`terminal`,`tab.newChat.ctxLabel`),field:`context`,value:s,onChange:e=>A(a,e===`continue`?`continue`:`fresh`),choices:[`fresh`,`continue`].map(e=>({id:e,label:K(`terminal`,`tab.newChat.ctx${e===`fresh`?`Fresh`:`Continue`}`)}))})]}),k&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,B.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:K(`quickTask`,`attemptsLabel`)}),(0,B.jsx)(xo,{label:K(`quickTask`,`attemptsLabel`),field:`attempts`,value:d,onChange:f,choices:Oo.map(e=>({id:e,label:e}))})]}),(0,B.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,B.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:R(`taskops.forkBranch`)}),(0,B.jsx)(`input`,{className:U,"data-field":`fork-base`,spellCheck:!1,value:p,onChange:e=>m(e.target.value)})]})]}),!D&&!O&&a!==`scratch`&&(0,B.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,B.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:R(`newChat.prompt`)}),(0,B.jsx)(`textarea`,{className:`${U} min-h-18 max-h-[50vh] leading-[1.45]`,"data-field":`message`,autoFocus:!0,rows:4,placeholder:R(`newChat.promptPlaceholder`),value:l,onChange:e=>u(e.target.value),onPaste:e=>{let t=Array.from(e.clipboardData.files);t.length!==0&&(e.preventDefault(),x(t))},onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&e.currentTarget.form?.requestSubmit()}})]}),(0,B.jsx)(bo,{attachments:b,onRemove:S}),So()?(0,B.jsx)(`p`,{className:`text-muted`,children:R(`pages.attachHintTouch`)}):(0,B.jsx)(`p`,{className:`keys-only mx-0 mt-2 mb-0 ${xt}`,children:K(`quickTask`,`legend`)}),_&&(0,B.jsx)(`p`,{className:`text-error`,children:_}),(0,B.jsx)(Nn,{busy:h,submitLabel:R(`newChat.start`)})]})})}var ws=[`sidebar`,`workspace`,`files`];function Ts(e,t,n){let r=ws.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 Es={sidebar:[`.rail`,`.rail`],workspace:[`.workspace`,`.term-slot:not(.is-hidden) .split-leaf.is-active textarea`],files:[`.side-panel`,`.side-view:not([hidden]) :is([tabindex='0'], input)`]};function Ds(e){let t=Ts(Object.keys(Es).find(e=>document.activeElement?.closest(Es[e][0]))??`sidebar`,e,{filesVisible:document.querySelector(Es.files[0])!==null});t&&document.querySelector(Es[t][1])?.focus()}function Os(e){return e.kind===`leaf`?[e]:e.children.flatMap(Os)}function ks(e){return!!e&&Os(e.root).length>1}function As(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 js(e,t,n=1){let r=Os(e.root).map(e=>e.id),i=r.indexOf(t);return r[(Math.max(0,i)+n+r.length)%r.length]??t}function Ms(e,t){let n=new Map,r=new Map;for(let i of Os(e.root)){if(i.title){r.set(i.id,i.title);continue}let e=i.own?t:`shell`,a=(n.get(e)??0)+1;n.set(e,a),r.set(i.id,a===1?e:`${e} ${a}`)}return r}function Ns(e,t,n){return e.kind===`engine`&&Os(t.root).some(e=>e.id===n&&e.own)}function Ps(e){return e.alive!==!1||!!e.split&&!Os(e.split.root).some(e=>e.own)}function Fs(e){return Os(e.root).map(e=>e.id).join(`,`)}function Is(e){return!(e instanceof HTMLElement)||e.closest(`.xterm`)?!1:e.isContentEditable||[`INPUT`,`TEXTAREA`,`SELECT`].includes(e.tagName)}function Ls(e){return e instanceof HTMLElement&&!!e.closest(`.rail, button, a`)}var Rs=e=>e.tabs.get()[e.selection.get().taskId??``]??[];function zs(e){let{taskId:t,tabId:n}=e.selection.get(),r=Rs(e);return{taskId:t,tabs:r,at:r.findIndex(e=>e.id===n)}}function Bs(e,t){let{taskId:n,tabs:r}=zs(e),i=r[t];!n||!i||e.select(n,i.id)}function Vs(e){let{taskId:t,tabs:n,at:r}=zs(e),i=n[r];!t||!i||W.set((0,B.jsx)(jn,{title:R(`menu.renameTab`),initial:Fi(i),submitLabel:R(`dialog.save`),onSubmit:async n=>{await e.client.request(`tab.rename`,{taskId:t,tabId:i.id,title:n}),await e.refreshTabsNow()}}))}var Hs=e=>!!e.selection.get().taskId,Us=e=>Rs(e).length>0,Ws=[{id:`help.open`,chords:[`f1`],prefix:!1,run:io},{id:`focus.next`,chords:[`f4`],prefix:!1,run:()=>Ds(1)},{id:`chat.tab.chooseEngine`,chords:[`ctrl+e`],prefix:!1,surface:`workspace`,live:Hs,run:e=>{let{taskId:t}=e.selection.get();t&&W.set((0,B.jsx)(Cs,{model:e,taskId:t}))}},{id:`chat.tab.rename`,chords:[`f2`],prefix:!1,surface:`workspace`,live:e=>{let{tabs:t,at:n}=zs(e);return!!t[n]&&!ks(t[n]?.split)},run:Vs},{id:`chat.tab.cycle-next`,chords:[`ctrl+]`],prefix:!1,surface:`workspace`,live:Us,run:e=>Bs(e,(zs(e).at+1)%Rs(e).length)},{id:`chat.tab.cycle-prev`,chords:[`ctrl+[`],prefix:!1,surface:`workspace`,live:Us,run:e=>Bs(e,(zs(e).at-1+Rs(e).length)%Rs(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:Us,run:(e,t=``)=>{let n=Sa().find(e=>e.id===`chat.tab.goto`&&!e.prefix)?.chords.indexOf(t)??-1;n>=0&&Bs(e,n)}},{id:`attention.next`,chords:[`f7`],prefix:!1,run:e=>Ks(e)}];ba(()=>Ws);function Gs(e){(0,g.useEffect)(()=>{let t=t=>{if(W.get()||Is(t.target))return;let n=Nt.get();if(n===`worktrees`)return;let r=Ta()??(Hs(e)?`workspace`:`sidebar`),{taskId:i}=e.selection.get();if(!n&&i&&!t.ctrlKey&&!t.shiftKey&&!t.metaKey&&!t.altKey&&t.key===`Enter`&&!Us(e)&&!Ls(t.target)){t.preventDefault(),t.stopPropagation(),W.set((0,B.jsx)(Cs,{model:e,taskId:i}));return}let a=_a(t),o=Sa().filter(t=>!t.prefix&&!t.native&&t.chords.some(e=>a.includes(e))&&Ca(t,r)&&!(n&&t.surface)&&t.live?.(e)!==!1).sort((e,t)=>wa(e,r)-wa(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 Ks(e){let t=e.tasks.get();if(!t)return;let n=po(t.attention,t.tasks.map(e=>e.id),e.selection.get());if(!n){G(R(`inbox.empty`));return}if(lo(n.state)){oo(e,n);return}n.taskId!==null&&(e.select(n.taskId,n.tabId),e.client.request(`attention.dismiss`,{taskId:n.taskId,...n.tabId?{tabId:n.tabId}:{}}).catch(e=>G(String(e),`error`)))}async function qs(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){G(R(`keys.pluginNoTask`),`error`);return}let i=await e.client.request(`plugin.paneOpen`,{taskId:n,pane:t.target,...r?{tabId:r}:{}});await e.refreshTabsNow(),e.select(n,i.tabId)}catch(e){G(On(e),`error`)}}function Js(e){(0,g.useEffect)(()=>{let t=t=>{let n=gr.get().plugins;if(n.length===0||!kr({dialog:W.get()!==null,page:Nt.get()})||Is(t.target))return;let r=Or(n,_a(t));r&&(t.preventDefault(),t.stopImmediatePropagation(),qs(e,r))};return window.addEventListener(`keydown`,t,{capture:!0}),()=>window.removeEventListener(`keydown`,t,{capture:!0})},[e])}var Ys=`prefix.moreCommands`,Xs=/^ctrl\+[^+]+$/;function Zs(e){return Xs.test(e)?e.slice(5):null}function Qs(e){let t=ka(e.bindingId);if(!t)return null;if(e.reachability.direct.has(e.bindingId)){let e=t.keys[0];if(e)return hr(e)}if(e.prefixKey&&e.reachability.prefix.has(e.bindingId)){let n=t.prefixKeys?.[0];if(n)return`${hr(e.prefixKey)} ${hr(n)}`}return null}function $s(e,t){let n=dr.filter(t=>e.direct.has(t.id)).flatMap(e=>{let t=e.keys.flatMap(e=>Zs(e)??[]);return t.length>2?[{stroke:`${t[0]}-${t.at(-1)}`,action:e.id}]:t.map(t=>({stroke:t,action:e.id}))}),r=t?Zs(t):null;return r&&e.prefix.size>0&&n.push({stroke:r,action:Ys}),n}var ec=4e3,tc=180,nc=ec,rc=_({guide:null,entries:[]}),ic=1;function ac(e,t){let n={id:ic++,stroke:e,action:t,at:Date.now()};rc.set({guide:null,entries:[...rc.get().entries,n].slice(-3)})}function oc({text:e}){return(0,B.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,B.jsx)(`span`,{children:e},e))})}var sc={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`},cc={accent:`text-accent`,muted:`text-subtle`,attention:`text-error`,warning:`text-warning`,success:`text-success`,info:`text-accent`,ink:`text-ink`},lc=6;function uc(e,t){return e?`${e.repo.split(`/`).filter(Boolean).pop()??e.repo} › ${e.title}`:t}function dc({model:e}){z();let t=v(e.tasks),n=v(e.visits),r=v(e.tabs),[i,a]=(0,g.useState)(0),[o,s]=(0,g.useState)(Date.now());(0,g.useEffect)(()=>{let e=window.setInterval(()=>s(Date.now()),3e4);return()=>window.clearInterval(e)},[]);let c=new Map((t?.tasks??[]).map(e=>[e.id,e])),l=(e,t)=>e&&t&&r[e]?.find(e=>e.id===t)?.title||``,u=fo(t?.attention??[],t?.tasks.map(e=>e.id)??[]).map((e,t)=>{let n=e.taskId?c.get(e.taskId):void 0;return{key:`a${t}:${e.taskId}:${e.tabId}`,section:`attention`,taskId:e.taskId,tabId:e.tabId,identity:uc(n,e.label??e.taskId??``),subtitle:l(e.taskId,e.tabId)||n?.branch||``,at:e.at,attention:e}}),d=new Set(u.map(e=>`${e.taskId}:${e.tabId}`)),f=n.filter(e=>c.has(e.taskId)&&!d.has(`${e.taskId}:${e.tabId}`)).slice(0,lc).map(e=>({key:`r:${e.taskId}:${e.tabId}`,section:`recent`,taskId:e.taskId,tabId:e.tabId,identity:uc(c.get(e.taskId),e.taskId),subtitle:l(e.taskId,e.tabId)||c.get(e.taskId)?.branch||``,at:e.at})),p=[...u,...f],m=p[Math.min(i,p.length-1)],h=async t=>{if(t.attention&&lo(t.attention.state))return q(e,t.attention);t.attention?.taskId&&await e.client.request(`attention.dismiss`,{taskId:t.attention.taskId,...t.tabId?{tabId:t.tabId}:{}}).catch(e=>G(String(e),`error`))},_=t=>{if(t.attention&&lo(t.attention.state))return oo(e,t.attention);t.attention&&h(t),t.taskId&&c.has(t.taskId)&&(e.select(t.taskId,t.tabId),Wt())};(0,g.useEffect)(()=>{let e=e=>{if(e.key===`ArrowDown`||e.key===`j`)a(e=>Math.min(p.length-1,e+1));else if(e.key===`ArrowUp`||e.key===`k`)a(e=>Math.max(0,e-1));else if(e.key===`Enter`&&m)_(m);else if(e.key===`d`&&m?.attention)h(m);else return;e.preventDefault()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)});let y=e=>{let t=e.attention?so(e.attention.state):null;return(0,B.jsx)(`li`,{children:(0,B.jsxs)(`button`,{type:`button`,className:Sn({selected:e===m,stack:!0}),onMouseEnter:()=>a(p.indexOf(e)),onClick:()=>_(e),children:[(0,B.jsxs)(`span`,{className:vn,children:[(0,B.jsx)(`span`,{className:Cn,children:e.identity}),t&&(0,B.jsxs)(`span`,{className:`flex-none font-mono text-meta font-normal normal-nums ${cc[t.tone]}`,children:[t.glyph,` `,R(t.stateKey)]}),(0,B.jsx)(`span`,{className:yn,children:co(o-e.at)})]}),e.subtitle&&(0,B.jsx)(`span`,{className:`truncate font-mono text-meta font-normal normal-nums text-muted`,children:e.subtitle})]})},e.key)};return(0,B.jsx)(kn,{title:R(`inbox.title`),wide:!0,children:(0,B.jsxs)(`div`,{className:on,children:[(0,B.jsx)(`p`,{className:`${H} text-muted ${hn} touch:hidden!`,children:(0,B.jsx)(oc,{text:R(`inbox.hints`)})}),(0,B.jsx)(`h2`,{className:`${H} text-muted ${gn}`,children:R(`inbox.attention`)}),u.length===0?(0,B.jsx)(`p`,{className:`mono text-muted`,children:R(`inbox.empty`)}):(0,B.jsx)(`ul`,{className:_n,children:u.map(y)}),f.length>0&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`h2`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted mt-1`,children:R(`inbox.recent`)}),(0,B.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-0.5 p-0`,children:f.map(y)})]})]})})}var fc=`rove.activeSortMode`;function pc(){let e=localStorage.getItem(fc);return li.find(t=>t===e)??`recent`}var mc=_(pc());function hc(e){mc.set(e),localStorage.setItem(fc,e)}function gc(){hc(li[(li.indexOf(mc.get())+1)%li.length]??`default`)}var _c=_(!1);function vc(e){e&&mc.get()!=="default"&&(hc(`default`),G(K(`tasks`,`sort.reorderSwitched`))),_c.set(e)}async function yc(e,t,n){let r=n<0?`up`:`down`;try{await e.client.request(`task.move`,{taskId:t.task.id,direction:r})}catch(e){G(K(`tasks`,`toast.moveFailed`,{error:e instanceof Error?e.message:String(e)}),`error`)}}async function bc(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){G(K(`tasks`,`toast.moveFailed`,{error:e instanceof Error?e.message:String(e)}),`error`)}}async function xc(e,t,n){if(n.pin!==void 0)try{await e.client.request(`task.pin`,{taskId:t,pinned:n.pin})}catch(e){G(K(`tasks`,`toast.moveFailed`,{error:e instanceof Error?e.message:String(e)}),`error`);return}await bc(e,t,n.steps)}var Sc=`-my-0.75 -mr-0.5 ml-0 flex flex-none self-stretch`,Cc=`before:absolute before:top-0 before:left-1 before:content-[''] before:[border-left:var(--hairline)_solid_var(--line-active)]`,wc={blank:``,pipe:`${Cc} before:bottom-0`,tee:`${Cc} before:bottom-0`,elbow:`${Cc} before:right-0 before:bottom-1/2 before:rounded-bl-[6px] before:[border-bottom:var(--hairline)_solid_var(--line-active)]`},Tc=e=>`relative w-3 ${wc[e]}`,Ec=`-mx-1 inline-flex min-w-6 cursor-pointer items-center justify-center gap-1 self-stretch rounded-[4px] px-2 font-mono hover:bg-hover`,Dc=`inline-flex items-center gap-1`,Oc=e=>`fixed z-35 flex max-h-[60vh] w-110 max-w-[calc(100vw-24px)] animate-pr-list-in flex-col overflow-y-auto rounded-md border-hairline border-line bg-surface p-1.5 shadow-popover transition-[opacity,translate] duration-120 ease-in motion-reduce:animate-none motion-reduce:transition-none ${e?`-translate-x-1 opacity-0`:``}`,kc=`pointer-events-none fixed z-35 max-w-80 -translate-y-1/2 animate-row-tip-in rounded-sm border-hairline border-line bg-inset px-2.5 py-1.5 text-meta leading-[1.4] whitespace-normal wrap-anywhere text-ink shadow-popover motion-reduce:animate-none`,Ac=`inline-flex flex-none items-center text-subtle`,jc=`group/rail rail @container row-1 flex min-h-0 flex-col focus:outline-none ${ge}`,Mc=`flex min-w-0 items-center gap-2.5 overflow-hidden px-3.5 pt-3.5 pb-2.5 whitespace-nowrap`,Nc=e=>`flex-1 overflow-y-auto px-1.5 pt-1 pb-3 scrollbar-none ${e?`[&>[data-row]]:[transition:transform_150ms_ease-out] motion-reduce:[&>[data-row]]:transition-none`:``}`,Pc=`group-focus-within/rail:[box-shadow:inset_0_0_0_1px_var(--focus)]`,Fc=e=>`group/head mx-2 mt-1.5 mb-1 flex items-center gap-1 font-mono text-meta font-semibold normal-nums text-subtle not-first:mt-4.5 ${e.moving||e.dragging?`bg-accent-soft`:``} ${e.moving?`after:font-mono after:text-meta after:font-medium after:normal-nums after:text-accent after:content-['move']`:``}`,Ic=`touch:relative touch:after:absolute touch:after:-inset-x-1.5 touch:after:-inset-y-3 touch:after:content-['']`,Lc=`group/toggle -ml-1 inline-flex min-w-0 cursor-pointer items-center gap-1 rounded-[4px] border-none bg-transparent px-1 py-0.5 text-inherit [font:inherit] hover:text-ink ${Ic}`,Rc=e=>e?``:`opacity-0 group-hover/head:opacity-100 group-focus-visible/toggle:opacity-100 touch:opacity-100`,zc=`-mr-[6.7px] ml-auto size-5 cursor-pointer rounded-[4px] border-none bg-transparent text-muted opacity-0 [font:400_var(--fs-display)/1_var(--sans)] group-hover/head:opacity-100 hover:bg-hover hover:text-ink focus-visible:opacity-100 touch:opacity-100 ${Ic}`,Bc=1e4;function Vc(e,t){let n=e.hostLabel||e.alias;if(e.state===`online`)return e.version?`${n} · v${e.version}`:n;let r=t[e.state];return e.state===`mismatch`?e.version?`${n} · ⚠ v${e.version} (${r})`:`${n} · ⚠ ${r}`:`${n} · ${r}`}function Hc(e,t,n,r=e){let i=t?.hostLabel&&t.hostLabel!==e?` (${t.hostLabel})`:``,a=n.runsOn.replace(`{host}`,t?`${e}${i}`:r);return!t||t.state===`online`?a:`${a}${Vc(t,n).slice((t.hostLabel||t.alias).length)}`}function Uc(e,t,n){if(e.kind!==`task`||e.machine===void 0)return null;let r=e.machine;return Hc(r,t.find(e=>e.alias===r),n,e.task.machine?.label)}function Wc({label:e}){return(0,B.jsx)(`span`,{className:Ac,title:e,role:`img`,"aria-label":e,children:(0,B.jsx)(`svg`,{viewBox:`0 0 16 16`,width:`12`,height:`12`,"aria-hidden":`true`,children:(0,B.jsx)(`path`,{d:`M4.5 13a3 3 0 0 1-.4-5.97A4.5 4.5 0 0 1 12.8 6.6 3.2 3.2 0 0 1 12.3 13Z`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.4`,strokeLinejoin:`round`})})})}function Gc({host:e}){return z(),(0,B.jsxs)(`div`,{className:yt,children:[(0,B.jsx)(`p`,{className:`text-muted`,children:K(`tasks`,`machine.filesElsewhere`,{host:e})}),(0,B.jsx)(`p`,{className:`text-muted`,children:K(`tasks`,`machine.filesHint`,{host:e})})]})}function Kc(e){let t=v(e.client.conn),n=v(e.remote),[r,i]=(0,g.useState)(()=>cs(e,`machines.list`)?.machines??[]),a=[...new Set(n.map(e=>`${e.machine?.id}:${e.machine?.stale??!1}`))].join();return(0,g.useEffect)(()=>{if(t.state!==`open`)return;let n=!0,r=()=>us(e,`machines.list`).then(e=>n&&i(e.machines),()=>{});r();let a=window.setInterval(r,Bc);return()=>{n=!1,window.clearInterval(a)}},[e.client,t.state,a]),r}var qc=`flex min-h-0 min-w-0 flex-1 flex-col p-4 font-mono text-meta leading-[1.5] font-normal not-italic normal-nums`,Jc=`flex flex-1 flex-col items-center justify-center gap-1.5 text-center`,Yc=`mx-auto flex w-full max-w-[104ch] flex-col gap-2`,Xc=`flex flex-col gap-2 rounded-md border-hairline border-line bg-surface px-3 py-2.5 focus-within:border-line-active`,Zc=`flex items-center justify-end gap-1.5`,Qc=`max-h-[40vh] min-h-[4.5em] w-full bg-transparent text-ink [border:0] [outline:0]`,$c=`flex flex-wrap items-center gap-1.5 px-1`,el=`flex-1`,tl=`size-3.25 flex-none fill-none stroke-current [stroke-linecap:round] [stroke-linejoin:round] [stroke-width:1.3]`,nl=(e=!1)=>`inline-flex max-w-[28ch] items-center gap-1.5 overflow-hidden rounded-[999px] border-hairline px-2.25 py-0.75 text-ellipsis whitespace-nowrap touch:py-1.75 [&:hover]:bg-hover [&:hover]:text-ink aria-expanded:bg-hover aria-expanded:text-ink ${e?`border-[color-mix(in_srgb,var(--accent)_45%,transparent)] bg-accent-soft text-accent`:`border-line text-muted`}`,rl=`disabled:cursor-default disabled:opacity-60`,il=`group/chip relative inline-flex`,al=`flex min-h-0 flex-col gap-1 overflow-y-auto p-1.5 [outline:0]`,ol=`flex min-h-0 flex-col overflow-y-auto`,sl=`sticky top-0 z-1 m-0 bg-surface px-1.5 pt-1.5 pb-0.5 text-left`,cl=e=>`flex w-full items-baseline gap-2 rounded-[calc(var(--radius)-6px)] px-2 py-1 text-left touch:py-2.5 disabled:cursor-default disabled:opacity-50 ${e.dim?`text-subtle`:`text-ink`} ${e.cursor?`bg-hover`:``}`,ll=`flex-[0_0_1.5ch] text-accent`,ul=`ml-auto pl-3 inline-flex items-center gap-1`,dl=`flex-none whitespace-nowrap`,fl=`flex flex-col gap-0.5 px-1.5 py-0.5`,pl=`min-w-[36ch]`;function ml(){return(0,B.jsx)(`svg`,{className:tl,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,B.jsx)(`path`,{d:`M2 4.5a1 1 0 0 1 1-1h3l1.5 1.5H13a1 1 0 0 1 1 1V12a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1z`})})}function hl(){return(0,B.jsxs)(`svg`,{className:tl,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,B.jsx)(`circle`,{cx:`4.5`,cy:`3.5`,r:`1.5`}),(0,B.jsx)(`circle`,{cx:`4.5`,cy:`12.5`,r:`1.5`}),(0,B.jsx)(`circle`,{cx:`11.5`,cy:`5`,r:`1.5`}),(0,B.jsx)(`path`,{d:`M4.5 5v6M11.5 6.5c0 3-7 2-7 4.5`})]})}function gl(){return(0,B.jsx)(`svg`,{className:tl,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,B.jsx)(`path`,{d:`M10.5 4.5 5.8 9.2a1.4 1.4 0 0 0 2 2l5-5a2.8 2.8 0 0 0-4-4l-5.2 5.2a4.2 4.2 0 0 0 6 6L13 9`})})}var _l=class extends Error{code;constructor(e,t){super(t),this.code=e}},vl=[500,1e3,2e3,4e3,8e3,15e3],yl=4e3,bl=1e4,xl=class{url;token;conn=_({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,yl),this.request(`hello`).then(()=>this.clearDeadline(),e=>{e instanceof _l&&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 _l(`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=new WebSocket(this.url,[`rove.v1`,`rove.bearer.${this.token}`]);this.ws=e,this.armDeadline(e,bl),e.onmessage=e=>this.receive(String(e.data)),e.onopen=()=>{this.request(`hello`).then(e=>{this.clearDeadline(),this.conn.set({state:`open`,hello:e,failures:0});for(let e of this.openHooks)e()},()=>this.lost(e))},e.onclose=()=>this.lost(e)}lost(e){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 _l(`NOT_CONNECTED`,`connection lost`));this.pending.clear();let t=this.conn.get().failures+1;this.conn.set({state:`retrying`,hello:this.conn.get().hello,failures:t});let n=vl[Math.min(t-1,vl.length-1)];this.retryTimer=window.setTimeout(()=>this.connect(),n)}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 _l(i,a))}retryNow(){this.retryTimer!==null&&(window.clearTimeout(this.retryTimer),this.connect())}};function Sl(){return`${window.location.protocol===`https:`?`wss:`:`ws:`}//${window.location.host}/ws`}function Cl(e){let[t,n]=(0,g.useState)(!1),r=(0,g.useRef)(null),i=(0,g.useRef)(null),a=(0,g.useRef)(null);(0,g.useLayoutEffect)(()=>{let e=a.current;if(!t||!e)return;let n=e.getBoundingClientRect(),r=n.right>window.innerWidth-8?window.innerWidth-8-n.right:n.left<8?8-n.left:0;r&&(e.style.transform=`translateX(${Math.round(r)}px)`)},[t]);let o=()=>{n(!1),i.current?.focus()};return(0,g.useEffect)(()=>{if(!t)return;let e=e=>{r.current?.contains(e.target)||n(!1)};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[t]),(0,B.jsxs)(`span`,{ref:r,className:il,onKeyDown:e=>{e.key!==`Escape`||!t||(e.preventDefault(),e.stopPropagation(),o())},children:[(0,B.jsx)(`button`,{ref:i,type:`button`,className:nl(),"data-field":e.field,title:e.title,"aria-haspopup":`menu`,"aria-expanded":t,disabled:e.disabled,onClick:()=>n(e=>!e),children:e.label}),t&&(0,B.jsx)(`div`,{ref:a,className:`absolute bottom-[calc(100%+6px)] left-0 z-20 flex max-h-[min(50vh,420px)] max-w-[min(52ch,calc(100vw-16px))] min-w-[min(34ch,calc(100vw-16px))] flex-col overflow-hidden rounded-md border-hairline border-line-active bg-surface shadow-popover group-last-of-type/chip:right-0 group-last-of-type/chip:left-auto`,children:e.children(o)})]})}function wl(e){let[t,n]=(0,g.useState)(0),r=[...e.extra?[e.extra]:[],...e.rows,...e.more??[]],i=Math.min(t,Math.max(0,r.length-1)),a=(0,g.useRef)(null);return(0,g.useEffect)(()=>{a.current?.scrollIntoView({block:`nearest`})},[i,e.rows]),(0,B.jsxs)(`div`,{className:al,children:[(0,B.jsx)(`input`,{className:U,autoFocus:!0,spellCheck:!1,placeholder:e.placeholder,value:e.query,onChange:t=>{n(0),e.onQuery(t.target.value)},onKeyDown:t=>{if(!t.nativeEvent.isComposing){if(t.key===`ArrowDown`||t.key===`ArrowUp`)t.preventDefault(),n(Math.max(0,Math.min(r.length-1,i+(t.key===`ArrowDown`?1:-1))));else if(t.key===`Enter`){t.preventDefault();let n=r[i];n&&e.onPick(n.key)}}}}),(0,B.jsxs)(`div`,{className:ol,children:[r.length===0&&(0,B.jsx)(`p`,{className:`mx-2 my-1 text-muted`,children:e.empty}),r.map((t,r)=>(0,B.jsxs)(g.Fragment,{children:[e.moreLabel&&t===e.more?.[0]&&(0,B.jsx)(`p`,{className:`mx-2 mt-2 mb-0.5 text-muted`,children:e.moreLabel}),(0,B.jsxs)(`button`,{type:`button`,"aria-current":t.checked===!0,ref:r===i?a:void 0,tabIndex:-1,title:t.title,className:cl({cursor:r===i}),onMouseMove:()=>n(r),onClick:()=>e.onPick(t.key),children:[(0,B.jsx)(`span`,{className:ll,children:t.checked?`✓`:``}),(0,B.jsx)(`span`,{className:dl,children:t.text}),t.dim&&(0,B.jsx)(`span`,{className:`ml-auto pl-3 text-muted ${t.title?`min-w-0 overflow-hidden text-ellipsis whitespace-nowrap`:``}`,children:t.dim})]})]},t.key))]})]})}function Tl(e){return(0,B.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":e.checked,tabIndex:-1,disabled:e.option.disabled,className:cl({cursor:e.cursor,dim:e.option.dim}),onMouseMove:e.onHover,onClick:e.onPick,children:[(0,B.jsx)(`span`,{className:ll,children:e.checked?`✓`:``}),(0,B.jsx)(`span`,{children:e.option.label}),!e.checked&&e.digit!==void 0&&!e.option.disabled&&(0,B.jsx)(`span`,{className:`ml-auto pl-3 text-muted`,children:e.digit})]})}function El(e){let[t,n]=(0,g.useState)(()=>Math.max(0,e.options.findIndex(t=>t.id===e.value))),r=(0,g.useRef)(null);return(0,g.useEffect)(()=>r.current?.focus(),[]),(0,B.jsxs)(`div`,{ref:r,role:`menu`,tabIndex:-1,className:al,onKeyDown:r=>{if(!(r.ctrlKey||r.metaKey||r.altKey||r.nativeEvent.isComposing)){if(r.key===`ArrowDown`||r.key===`ArrowUp`)r.preventDefault(),n(Math.max(0,Math.min(e.options.length-1,t+(r.key===`ArrowDown`?1:-1))));else if(r.key===`Enter`){r.preventDefault();let n=e.options[t];n&&!n.disabled&&e.onPick(n.id)}else if(e.onBack&&(r.key===`Escape`||r.key===`ArrowLeft`))r.preventDefault(),r.stopPropagation(),e.onBack();else{let t=e.digits?ns(r.key,e.options.length):null,n=t===null?void 0:e.options[t];if(!n||n.disabled)return;r.preventDefault(),e.onPick(n.id)}}},children:[e.onBack?(0,B.jsxs)(`button`,{type:`button`,className:`${sl} ${H} text-muted`,tabIndex:-1,onClick:e.onBack,children:[`‹ `,e.heading]}):(0,B.jsx)(`p`,{className:`${sl} ${H} text-muted`,children:e.heading}),e.options.map((r,i)=>(0,B.jsx)(Tl,{option:r,checked:r.id===e.value,cursor:i===t,digit:e.digits&&i<9?i+1:void 0,onHover:()=>n(i),onPick:()=>e.onPick(r.id)},r.id))]})}function Dl(e){let[t,n]=(0,g.useState)(`root`),r=e.models.length+ +(e.efforts.length>0),[i,a]=(0,g.useState)(()=>Math.max(0,e.models.findIndex(t=>t.id===e.model))),o=(0,g.useRef)(null);if((0,g.useEffect)(()=>{t===`root`&&o.current?.focus()},[t]),t===`effort`)return(0,B.jsx)(El,{heading:R(`newSession.effort`),options:e.efforts,value:e.effort,onBack:()=>n(`root`),onPick:t=>{e.onEffort(t),e.close()}});let s=t=>{e.onModel(t),e.close()},c=e.efforts.find(t=>t.id===e.effort)?.label??``;return(0,B.jsxs)(`div`,{ref:o,role:`menu`,tabIndex:-1,className:al,onKeyDown:t=>{if(!(t.ctrlKey||t.metaKey||t.altKey||t.nativeEvent.isComposing)){if(t.key===`ArrowDown`||t.key===`ArrowUp`)t.preventDefault(),a(Math.max(0,Math.min(r-1,i+(t.key===`ArrowDown`?1:-1))));else if(t.key===`Enter`||t.key===`ArrowRight`&&i>=e.models.length){t.preventDefault();let r=e.models[i];r?s(r.id):e.efforts.length>0&&n(`effort`)}else{let n=ns(t.key,e.models.length),r=n===null?void 0:e.models[n];if(!r)return;t.preventDefault(),s(r.id)}}},children:[(0,B.jsx)(`p`,{className:`${sl} ${H} text-muted`,children:R(`newSession.modelHeading`)}),e.models.map((t,n)=>(0,B.jsx)(Tl,{option:t,checked:t.id===e.model,cursor:n===i,digit:n<9?n+1:void 0,onHover:()=>a(n),onPick:()=>s(t.id)},t.id)),e.efforts.length>0&&(0,B.jsxs)(`button`,{type:`button`,role:`menuitem`,tabIndex:-1,className:`${cl({cursor:i===e.models.length})} mt-1 border-t-hairline border-t-line`,onMouseMove:()=>a(e.models.length),onClick:()=>n(`effort`),children:[(0,B.jsx)(`span`,{className:`flex-[0_0_1.5ch] text-accent`}),(0,B.jsx)(`span`,{children:R(`newSession.effort`)}),(0,B.jsxs)(`span`,{className:`${ul} text-muted`,children:[c,(0,B.jsx)(ta,{right:!0})]})]})]})}function Ol(e){return(0,B.jsxs)(`div`,{className:`${al} ${pl}`,children:[(0,B.jsx)(`p`,{className:`${sl} ${H} text-muted`,children:R(`newSession.branches`)}),(0,B.jsxs)(`label`,{className:fl,children:[(0,B.jsx)(`span`,{className:`text-muted`,children:R(`newSession.branchName`)}),(0,B.jsx)(`input`,{className:U,autoFocus:!0,spellCheck:!1,placeholder:R(`newSession.branchNamePlaceholder`),value:e.branch,onChange:t=>e.onBranch(t.target.value)})]}),e.repos.map(t=>(0,B.jsxs)(`label`,{className:fl,children:[(0,B.jsxs)(`span`,{children:[t.name,t.primary&&(0,B.jsxs)(`span`,{className:`text-muted`,children:[` `,R(`newSession.primary`)]})]}),(0,B.jsx)(`select`,{className:U,"aria-label":t.name,value:t.base||t.current,onChange:n=>e.onBase(t.path,n.target.value),children:(t.branches.includes(t.base||t.current)?t.branches:[t.base||t.current,...t.branches]).filter(e=>e!==``).map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))})]},t.path))]})}function kl(e){return e.id.startsWith(`root:`)?e.primary??e.checkouts[0]??e.id:e.id}function Al(e,t){if(!e)return null;let n=t.find(t=>t.id===e||t.checkouts.includes(e));return n?{ref:kl(n),clone:!1}:e.startsWith(`/`)?{ref:e,clone:!1}:null}function jl(e,t,n){let r=t.toLowerCase();return n?e.some(e=>e.toLowerCase()===`github.com/${r}`):e.some(e=>Mo(e).base.toLowerCase()===(r.split(`/`)[1]??``))}function Ml(e){let t=e.begin?``:jo(e.prompt);return{repo:e.pick.ref,machine:e.machine,...e.pick.clone?{clone:!0}:{},...e.baseRef?{baseBranch:e.baseRef}:{},...e.begin&&e.prompt?{prompt:e.prompt}:{},...t?{title:t}:{},...e.engine?{engine:e.engine}:{}}}var Nl={offline:`newSession.remoteOffline`,outdated:`newSession.remoteOutdated`},Pl=(e,t)=>us(e,`machines.repos`,{machine:t});function Fl(e,t){let n=t.filter(e=>e.state===`online`).map(e=>e.alias).join(`
|
|
13
|
-
`);(0,g.useEffect)(()=>{for(let t of n?n.split(`
|
|
14
|
-
`):[])Pl(e,t).catch(()=>{})},[e,n])}function Il(e,t){z();let[n,r]=(0,g.useState)(null);if((0,g.useEffect)(()=>{if(!t)return;let n=!1;return Pl(e,t).then(e=>!n&&r({machine:t,reply:e,failed:``})).catch(e=>!n&&r({machine:t,reply:null,failed:String(e)})),()=>{n=!0}},[e,t]),!t)return{repos:[],loaded:!0,problem:``};let i=n?.machine===t?n:void 0,a=cs(e,`machines.repos`,{machine:t});if(!i&&!a)return{repos:[],loaded:!1,problem:``};let o=i?i.reply:a;if(!o)return{repos:[],loaded:!0,problem:R(`newSession.remoteFailed`,{machine:t,message:i?.failed??``})};let s=o.reason?Nl[o.reason]:void 0,c=o.reason?s?R(s,{machine:t}):R(`newSession.remoteFailed`,{machine:t,message:o.message??o.reason}):``;return{repos:o.repos,loaded:!0,problem:c}}function Ll(e,t){return t.problem?t.problem:t.loaded?R(`newSession.remoteNone`,{machine:e}):R(`newSession.remoteLoading`,{machine:e})}function Rl(){return(0,B.jsxs)(`svg`,{className:tl,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,B.jsx)(`rect`,{x:`2`,y:`3`,width:`12`,height:`8`,rx:`1`}),(0,B.jsx)(`path`,{d:`M5.5 13.5h5M8 11v2.5`})]})}function zl(e){let t=(z()===`zh`?Zn:Xn).machine,n=e.machines.find(t=>t.alias===e.value),r=e.value?n?.hostLabel||e.value:R(`newSession.thisMachine`);return(0,B.jsx)(Cl,{field:`machine`,title:R(`newSession.machine`),label:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Rl,{}),r]}),children:n=>(0,B.jsx)(El,{heading:R(`newSession.machine`),options:[{id:``,label:R(`newSession.thisMachine`)},...e.machines.map(e=>({id:e.alias,label:Vc(e,t),disabled:e.state!==`online`}))],value:e.value,digits:!0,onPick:t=>{e.onPick(t),n()}})})}function Bl(e){let[t,n]=(0,g.useState)(``),r=t.trim();return(0,B.jsx)(Cl,{field:`branch`,title:R(`newSession.branch`),label:e.value||R(`newSession.branch`),children:i=>(0,B.jsx)(wl,{placeholder:R(`newSession.branchTypeRef`),empty:``,rows:[{key:``,text:R(`newSession.branchRemoteDefault`),checked:e.value===``}],query:t,onQuery:n,extra:r?{key:r,text:r,checked:e.value===r}:null,onPick:t=>{e.onPick(t),n(``),i()}})})}async function Vl(e,t){return(await e.client.request(`task.spawn`,Ml(t))).taskIds[0]}function Hl(e){return e instanceof _l&&e.code===`CLONE_FAILED`?K(`newTask`,`error.cloneFailed`,{error:e.message}):e instanceof Error?e.message:String(e)}var Ul=`clone:`;function Wl(e){let{model:t,saved:n,picked:r,primary:i,home:a,query:o,remote:s}=e,[c,l]=(0,g.useState)(()=>cs(t,`github.repos`)??null);(0,g.useEffect)(()=>{let e=!1;return us(t,`github.repos`).then(t=>!e&&l(t)).catch(()=>!e&&l({repos:[],reason:`failed`})),()=>{e=!0}},[t]);let u=o.trim(),d=No(n,o),f=R(`rail.noProject`),p=e.ungrouped&&(!u||f.toLowerCase().includes(u.toLowerCase()))?[{key:bi,text:f,dim:a,checked:e.ungrouped.on}]:[],m=d.map(e=>{let{base:t,dir:n}=Mo(e);return{key:e,text:t,dim:e===i&&r.length>1?`${R(`newSession.primary`)}, ${n}`:n,checked:r.includes(e)}}),h=Ko(u),_=h&&(h.includes(`:`)||d.length===0)?h:null,v=!_&&Po(u)&&!n.includes(u)&&(!s||u.startsWith(`/`))?Io(Fo(u,a)):``,y=_?{key:Ul+_,text:s?R(`newSession.cloneRowOn`,{source:_,machine:s.name}):R(`newSession.cloneRow`,{source:_})}:v?{key:v,text:v,checked:r.includes(v)}:null,b=u.toLowerCase(),x=(c?.repos??[]).filter(e=>e.nameWithOwner.toLowerCase().includes(b)).filter(e=>!jl(n,e.nameWithOwner,s!==void 0)).map(e=>({key:Ul+e.nameWithOwner,text:e.nameWithOwner,dim:e.description,title:e.description}));return(0,B.jsx)(wl,{placeholder:R(s?`newSession.repoSearchRemote`:`newSession.repoSearch`),empty:s?.empty??R(`newSession.repoEmpty`),rows:s?.blocked?[]:[...p,...m],query:o,onQuery:e.onQuery,extra:s?.blocked?null:y,more:s?.blocked?[]:x,moreLabel:R(`newSession.githubGroup`),onPick:t=>{if(t===`~scratch`)return e.ungrouped?.pick(),e.close();if(!t.startsWith(`clone:`))return e.onToggle(t);e.onClone(t.slice(6)),e.close()}})}function Gl(e){document.querySelector(`.dialog [data-field="${e}"]:not([hidden] *)`)?.focus()}function Kl(e){let[t,n]=(0,g.useState)(0),r=e.open&&e.items.length>0,i=Math.min(t,Math.max(0,e.items.length-1)),a=(0,g.useRef)(null),{onCursor:o}=e;return(0,g.useEffect)(()=>o?.(i),[i,o]),(0,g.useEffect)(()=>{a.current?.scrollIntoView({block:`nearest`})},[i,e.items]),(0,B.jsxs)(`div`,{className:`relative`,children:[(0,B.jsx)(`input`,{className:U,"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,B.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,B.jsx)(`li`,{ref:n===i?a:void 0,children:(0,B.jsxs)(`button`,{type:`button`,tabIndex:-1,"aria-pressed":n===i,className:wt({cursor:n===i,accent:!!t.accent}),onMouseDown:t=>{t.preventDefault(),e.onPick(n)},children:[(0,B.jsx)(`span`,{children:t.text}),t.dim&&(0,B.jsxs)(`span`,{className:`text-muted`,children:[` `,t.dim]})]})},t.key))})]})}function ql({model:e,engine:t,busy:n,error:r,run:i}){let[a,o]=(0,g.useState)(``),[s,c]=(0,g.useState)(()=>localStorage.getItem(`rove.web.cloneParent`)||`~/`),[l,u]=(0,g.useState)(null),[d,f]=(0,g.useState)(`main`),[p,m]=(0,g.useState)(``),[h,_]=(0,g.useState)(!1),[v,y]=(0,g.useState)({base:``,home:``,names:[]});(0,g.useEffect)(()=>{let t=!1,n=setTimeout(()=>{e.client.request(`fs.subdirs`,{path:s}).then(e=>!t&&y(e)).catch(()=>{})},60);return()=>{t=!0,clearTimeout(n)}},[e,s]);let b=l??Ho(a),x=Fo(s.trim(),v.home),S=()=>i(async()=>{if(!a.trim())throw Gl(`url`),Error(K(`newTask`,`error.gitUrlRequired`));let n;try{m(``),n=await e.client.request(`repo.clone`,{url:a.trim(),parentDir:x,...l?.trim()?{folder:l.trim()}:{}},m)}catch(e){throw e instanceof _l&&e.code===`CLONE_FAILED`?Error(K(`newTask`,`error.cloneFailed`,{error:e.message})):e}localStorage.setItem(Uo,s.trim());let r=(await e.client.request(`task.spawn`,{repo:n.path,...t?{engine:t}:{},...d.trim()?{baseBranch:d.trim()}:{}})).taskIds[0];r&&e.selectWhenListed(r)});return(0,B.jsxs)(`form`,{className:on,onSubmit:e=>{e.preventDefault(),S()},children:[(0,B.jsxs)(`div`,{className:Yt,children:[(0,B.jsx)(`span`,{className:`${H} text-muted`,children:K(`newTask`,`field.gitUrl`)}),(0,B.jsx)(`input`,{className:U,"data-field":`url`,spellCheck:!1,placeholder:`https://github.com/user/repo.git`,value:a,onChange:e=>o(e.target.value.replace(/[\r\n]+/g,``)),onKeyDown:e=>{e.key!==`Enter`||e.ctrlKey||e.metaKey||(e.preventDefault(),a.trim()&&Gl(`parent`))}})]}),(0,B.jsxs)(`div`,{className:Yt,children:[(0,B.jsx)(`span`,{className:`${H} text-muted`,children:K(`newTask`,`field.parentDir`)}),(0,B.jsx)(Kl,{field:`parent`,value:s,placeholder:`~/`,onChange:e=>{_(!0),c(e)},items:v.names.map(e=>({key:e,text:`${e}/`})),open:h,onPick:e=>{let t=v.names[e];t!==void 0&&c(Ro(s,v.base,t,v.home)),_(!1),Gl(`folder`)},onComplete:e=>{let t=v.names[e];if(t===void 0)return!1;let n=`${Ro(s,v.base,t,v.home)}/`;return n!==s&&(c(n),!0)},onEnter:()=>Gl(`folder`)}),(0,B.jsx)(`span`,{className:`text-muted`,children:K(`newTask`,`hint.remembered`)})]}),(0,B.jsxs)(`div`,{className:Yt,children:[(0,B.jsx)(`span`,{className:`${H} text-muted`,children:K(`newTask`,`field.folderName`)}),(0,B.jsx)(`input`,{className:U,"data-field":`folder`,spellCheck:!1,placeholder:K(`newTask`,`placeholder.folderName`),value:b,onChange:e=>u(e.target.value.replace(/[\r\n]+/g,``)),onKeyDown:e=>{e.key!==`Enter`||e.ctrlKey||e.metaKey||(e.preventDefault(),Gl(`clone-base`))}})]}),(0,B.jsxs)(`div`,{className:Yt,children:[(0,B.jsx)(`span`,{className:`${H} text-muted`,children:K(`newTask`,`field.baseBranch`)}),(0,B.jsx)(`input`,{className:U,"data-field":`clone-base`,spellCheck:!1,placeholder:`main`,value:d,onChange:e=>f(e.target.value.replace(/[\r\n]+/g,``))})]}),n&&(0,B.jsx)(`p`,{className:`text-muted`,"data-field":`clone-progress`,children:p||K(`newTask`,`clone.progressInto`,{target:`${x}/${b}`})}),r&&(0,B.jsxs)(`p`,{className:`text-error`,children:[`※ `,r]}),(0,B.jsx)(Nn,{busy:n,submitLabel:K(`newTask`,n?`button.cloning`:`button.create`)})]})}function Jl({model:e,engine:t,busy:n,error:r,run:i,repo:a,active:o}){let[s,c]=(0,g.useState)(``),[l,u]=(0,g.useState)(null),[d,f]=(0,g.useState)(new Set),[p,m]=(0,g.useState)(0),h=a.expanded;(0,g.useEffect)(()=>{if(!o||!h)return;let t=!1;return u(null),f(new Set),e.client.request(`repo.probe`,{path:h,adoptable:!0}).then(e=>!t&&u(e.worktrees??[])).catch(()=>!t&&u([])),()=>{t=!0}},[e,o,h]);let _=Jo(l??[],s),v=e=>f(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n}),y=()=>i(async()=>{let n=d.size>0?_.filter(e=>d.has(e.path)):_.slice(p,p+1);if(n.length===0)throw Error(K(`newTask`,`error.noAdoptable`));let r=0,i,a;for(let o of n){let n={repo:h,worktreePath:o.path,branch:o.branch,...t?{engine:t}:{}};try{let t;try{t=await e.client.request(`worktree.adopt`,n)}catch(r){if(!(r instanceof _l&&r.code===`UNKNOWN_REPO`))throw r;await e.client.request(`task.openMain`,{repo:h}),t=await e.client.request(`worktree.adopt`,n)}a=t.taskId,r++}catch(e){i??=e instanceof Error?e.message:String(e)}}if(r===0)throw Error(K(`newTask`,`adopt.summaryNone`,{error:i??``}));G(r<n.length?K(`newTask`,`adopt.summaryPartial`,{done:r,total:n.length}):K(`newTask`,`adopt.summaryAll`,{count:r})),a&&e.selectWhenListed(a)}),b=d.size>0?K(`newTask`,`adopt.hintSelected`,{count:d.size}):K(`newTask`,`adopt.hintDefault`);return(0,B.jsxs)(`form`,{className:on,onSubmit:e=>{e.preventDefault(),y()},onKeyDown:e=>{e.ctrlKey&&!e.shiftKey&&!e.metaKey&&e.key.toLowerCase()===`a`&&(e.preventDefault(),e.stopPropagation(),f(e=>_.every(t=>e.has(t.path))?new Set:new Set(_.map(e=>e.path))))},children:[(0,B.jsxs)(`div`,{className:Yt,children:[(0,B.jsx)(`span`,{className:`${H} text-muted`,children:K(`newTask`,`field.adoptFilter`)}),(0,B.jsx)(Kl,{field:`filter`,value:s,placeholder:K(`newTask`,`placeholder.adoptFilter`),onChange:c,items:_.map(e=>{let t=[e.dirty===!0?`dirty`:e.dirty===null?`dirty?`:``,e.roveManaged?``:`external`].filter(Boolean).join(`,`);return{key:e.path,text:`${d.has(e.path)?`[x]`:`[ ]`} ${e.branch}${t?` (${t})`:``}`,dim:e.path,accent:d.has(e.path)}}),open:!0,onPick:e=>{let t=_[e];t&&v(t.path)},onCursor:m,onEnter:()=>{}}),(0,B.jsx)(`span`,{className:`text-muted`,children:K(`newTask`,`adopt.repoLine`,{path:h||K(`newTask`,`adopt.repoNone`)})}),l===null&&h&&(0,B.jsx)(`span`,{className:`text-muted`,children:K(`newTask`,`hint.scanningWorktrees`)}),l!==null&&_.length===0&&(0,B.jsx)(`span`,{className:`text-muted`,children:K(`newTask`,l.length===0?`adopt.noUnlinked`:`adopt.noMatch`)}),_.length>0&&(0,B.jsx)(`span`,{className:`text-muted`,children:(0,B.jsx)(oc,{text:To(b)})})]}),r&&(0,B.jsxs)(`p`,{className:`text-error`,children:[`※ `,r]}),(0,B.jsx)(Nn,{busy:n,submitLabel:K(`newTask`,`button.create`)})]})}var Yl=[`existing`,`clone`,`adopt`];function Xl(e,t){let n=cs(e,`repos.list`)?.repos,[r,i]=(0,g.useState)(n??[]),[a,o]=(0,g.useState)(()=>cs(e,`fs.subdirs`,{path:`~/`})?.home??``),[s,c]=(0,g.useState)(()=>{let e=t??n?.[0];return e?Vo(e,n??[]):``}),[l,u]=(0,g.useState)(!1),[d,f]=(0,g.useState)(null),[p,m]=(0,g.useState)(null);(0,g.useEffect)(()=>{Promise.all([us(e,`repos.list`),us(e,`fs.subdirs`,{path:`~/`})]).then(([e,n])=>{i(e.repos),o(n.home);let r=t??e.repos[0]??``;c(t=>t||Vo(r,e.repos))}).catch(()=>{})},[e,t]);let h=Po(s.trim())&&!r.includes(s.trim());(0,g.useEffect)(()=>{if(!h)return;let t=!1,n=setTimeout(()=>{e.client.request(`fs.subdirs`,{path:s}).then(e=>!t&&f({base:e.base,names:e.names})).catch(()=>!t&&f({base:``,names:[]}))},60);return()=>{t=!0,clearTimeout(n)}},[e,h,s]);let _=Bo(s,r),v=_.kind===`path`?_.path:``,y=v.startsWith(`~`)&&!a?``:v.replace(/^~(?=\/|$)/,a).replace(/(.)\/+$/,`$1`);(0,g.useEffect)(()=>{if(m(null),!y)return;let t=!1,n=setTimeout(()=>{e.client.request(`repo.probe`,{path:y}).then(e=>!t&&m(e)).catch(()=>{})},150);return()=>{t=!0,clearTimeout(n)}},[e,y]);let b=new Set((e.tasks.get()?.tasks??[]).filter(e=>e.kind===`main`).map(e=>e.repo.replace(/\/+$/,``))),x=h?d?.names??[]:[],S=No(r,s),C=h?x.map(e=>({key:e,text:`${e}/`})):S.map(e=>{let{base:t,dir:n}=Mo(e);return{key:e,text:t,dim:n,accent:e===y}});return{text:s,saved:r,home:a,expanded:y,ambiguous:_.kind===`ambiguous`?_.name:null,mainRepos:b,open:!l,items:C,probe:p,setText:e=>{u(!1),c(e)},pick:e=>{if(h){let t=x[e];t!==void 0&&c(Ro(s,d?.base??``,t,a))}else{let t=S[e];t!==void 0&&c(Vo(t,r))}u(!0),Gl(`branch`)},complete:e=>{if(l)return!1;if(h){let t=x[e];if(t===void 0)return!1;let n=zo(s,d?.base??``,t,a);return n!==s&&(c(n),!0)}let t=S[e];if(t===void 0)return!1;let n=Vo(t,r);return n!==s.trim()&&(c(n),u(!0),!0)},reopen:()=>u(!1)}}function Zl(e){let{model:t,repo:n}=e,[r,i]=(0,g.useState)(``),[a,o]=(0,g.useState)(!1),[s,c]=(0,g.useState)(!0),[l,u]=(0,g.useState)(`task`),d=n.mainRepos.has(n.expanded),f=n.probe?.ok?n.probe:null,p=f?.branches??[];(0,g.useEffect)(()=>{!a&&f?.current&&i(f.current)},[a,f]),(0,g.useEffect)(()=>u(`task`),[n.expanded]);let m=No(p,r),h=i=>e.run(async()=>{if(n.ambiguous)throw n.reopen(),Gl(`repo`),Error(K(`newTask`,`error.repoAmbiguous`,{name:n.ambiguous}));if(!n.expanded)throw Gl(`repo`),Error(R(`newTask.needRepo`));let e=await t.client.request(`repo.probe`,{path:n.expanded});if(!e.ok)throw Gl(`repo`),Error(e.reason??n.expanded);if(l===`project`&&d){let n=await t.client.request(`task.openMain`,{repo:e.repo});t.selectWhenListed(n.taskId);return}Rt(e.repo,(i??r).trim())});return(0,B.jsxs)(`form`,{className:on,onSubmit:e=>{e.preventDefault(),h()},children:[(0,B.jsxs)(`div`,{className:Yt,children:[(0,B.jsx)(`span`,{className:`${H} text-muted`,children:K(`newTask`,`field.repo`)}),(0,B.jsx)(Kl,{field:`repo`,value:n.text,onChange:n.setText,items:n.items,open:n.open,onPick:n.pick,onComplete:n.complete,onEnter:()=>Gl(`branch`)})]}),d&&(0,B.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,B.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:K(`newTask`,`field.opens`)}),(0,B.jsx)(xo,{label:K(`newTask`,`field.opens`),field:`intent`,value:l,onChange:e=>u(e===`project`?`project`:`task`),choices:[{id:`task`,label:K(`newTask`,`intent.task`)},{id:`project`,label:K(`newTask`,`intent.project`)}]})]}),!(l===`project`&&d)&&(0,B.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,B.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:K(`newTask`,`field.fromBranch`)}),(0,B.jsx)(Kl,{field:`branch`,value:r,placeholder:`main`,onChange:e=>{o(!0),c(!0),i(e)},items:m.map(e=>({key:e,text:e,accent:e===r.trim()})),open:s,onPick:e=>{let t=m[e];t!==void 0&&(i(t),o(!0),c(!1),Gl(`create`))},onEnterRow:e=>{let t=r.trim(),n=t?m.find(e=>e.toLowerCase()===t.toLowerCase()):void 0;h(n??m[e]??t)},onEnter:()=>void h()}),m.length===0&&e.error==null&&(0,B.jsx)(`span`,{className:`text-muted`,children:K(`newTask`,p.length===0?`hint.noBranchesFound`:`hint.noMatchBranch`)})]}),e.error&&(0,B.jsxs)(`p`,{className:`text-error`,children:[`※ `,e.error]}),(0,B.jsx)(Nn,{busy:e.busy,submitLabel:K(`newTask`,`button.create`)})]})}function Ql({model:e,repo:t}){z();let[n,r]=(0,g.useState)(`existing`),{busy:i,error:a,setError:o,submit:s}=An(),c=e.selection.get().taskId,l=e.tasks.get()?.tasks.find(e=>e.id===c)?.repo,u=ds(e,t??l),d=Xl(e,t??l),f=(0,g.useRef)(null),p=(0,g.useRef)(!0);(0,g.useEffect)(()=>{if(o(null),p.current){p.current=!1,f.current?.querySelector(`[data-field=mode] [aria-pressed=true]`)?.focus();return}Gl(n===`existing`?`repo`:n===`clone`?`url`:`filter`)},[n]);let m=u.engines.filter(e=>e.ready!==!1),h=()=>{let e=m.length>0?m:u.engines,t=e[(e.findIndex(e=>e.id===u.engine)+1)%e.length];t&&u.setEngine(t.id)},_=e=>r(t=>Yl[(Yl.indexOf(t)+e+Yl.length)%Yl.length]),v={model:e,engine:u.engine,busy:i,error:a,setError:o,run:s};return(0,B.jsx)(kn,{title:K(`newTask`,`title`),wide:!0,children:(0,B.jsxs)(`div`,{ref:f,onKeyDown:e=>{if(!(!e.ctrlKey||e.metaKey||e.altKey)){if(e.key===`]`||e.key===`[`)_(e.key===`]`?1:-1);else if(e.key.toLowerCase()===`e`&&!e.shiftKey)h();else return;e.preventDefault(),e.stopPropagation()}},children:[(0,B.jsxs)(`div`,{className:on,children:[(0,B.jsxs)(`div`,{className:Yt,children:[(0,B.jsx)(`span`,{className:`${H} text-muted`,children:K(`newTask`,`field.mode`)}),(0,B.jsx)(xo,{label:K(`newTask`,`field.mode`),field:`mode`,value:n,onChange:e=>r(e),choices:Yl.map(e=>({id:e,label:K(`newTask`,`tabs.${e}`)}))})]}),(0,B.jsxs)(`div`,{className:Yt,children:[(0,B.jsx)(`span`,{className:`${H} text-muted`,children:K(`newTask`,`field.engine`)}),(0,B.jsx)(_s,{engines:u.engines,value:u.engine,onChange:u.setEngine})]})]}),(0,B.jsx)(`div`,{hidden:n!==`existing`,children:(0,B.jsx)(Zl,{...v,repo:d})}),(0,B.jsx)(`div`,{hidden:n!==`clone`,children:(0,B.jsx)(ql,{...v})}),(0,B.jsx)(`div`,{hidden:n!==`adopt`,children:(0,B.jsx)(Jl,{...v,repo:d,active:n===`adopt`})}),(0,B.jsx)(`p`,{className:`keys-only mx-0 mt-2 mb-0 ${xt}`,children:K(`newTask`,`legend`,{enter:K(`newTask`,`enterNext`)})})]})})}function $l(e,t){Rt(e,void 0,t)}function eu(){Rt(void 0,void 0,void 0,void 0,!0)}var tu=`rove.web.newSession.worktree`,nu=``;function ru({model:e,seed:t}){let n=t.repo;z();let r=v(e.selection).taskId,i=e.tasks.get()?.tasks.find(e=>e.id===r)?.repo,a=ds(e,n??i),o=cs(e,`repos.list`)?.repos,s=e=>t.ungrouped?void 0:(t.machine?void 0:n)??i??e?.[0],[c,l]=(0,g.useState)(o??[]),[u,d]=(0,g.useState)(()=>cs(e,`fs.subdirs`,{path:`~/`})?.home??``),[f,p]=(0,g.useState)(()=>{let e=s(o);return e?[e]:[]}),[m,h]=(0,g.useState)(()=>Object.fromEntries(f.flatMap(t=>{let n=cs(e,`repo.probe`,{path:t});return n?[[t,n]]:[]}))),_=(0,g.useRef)(new Set),[y,b]=(0,g.useState)(t.ungrouped===!0),x=()=>{b(!0),p([])},[S,C]=(0,g.useState)(()=>{let e=s(o);return e&&t.baseBranch?{[e]:t.baseBranch}:{}}),[w,T]=(0,g.useState)(``),[E,D]=(0,g.useState)(``),[O,k]=(0,g.useState)(``),[A,j]=(0,g.useState)(()=>(t.prompt!==void 0&&(nu=t.prompt),nu)),M=e=>{nu=e,j(e)},[N,P]=(0,g.useState)(``),[F,I]=(0,g.useState)(``),[L,ee]=(0,g.useState)(!1),[te,ne]=(0,g.useState)(``),[re,ie]=(0,g.useState)(()=>localStorage.getItem(tu)!==`0`),ae=e=>{localStorage.setItem(tu,e?`1`:`0`),ie(e)},[oe,se]=(0,g.useState)(null),{attachments:ce,attach:le,remove:ue,clear:de}=yo(e,se),fe=(0,g.useRef)(null),pe=Kc(e),[me,he]=(0,g.useState)(t.machine??``),ge=me!==``,_e=ge?null:ho(e=>void le(e)),ve=pe.find(e=>e.alias===me)?.hostLabel||me,ye=Il(e,me);Fl(e,pe);let[be,xe]=(0,g.useState)(null),[Se,Ce]=(0,g.useState)(``);(0,g.useEffect)(()=>{Promise.all([us(e,`repos.list`),us(e,`fs.subdirs`,{path:`~/`})]).then(([e,n])=>{l(e.repos),d(n.home);let r=s(e.repos);p(e=>e.length>0||!r?e:[r]),r&&t.baseBranch&&C(e=>({...e,[r]:t.baseBranch??``}))}).catch(()=>{})},[e,n]);let we=!ge&&!re&&f.length===1,Te=f[0]??``,Ee=m[Te]??null;(0,g.useEffect)(()=>{for(let t of f)_.current.has(t)||(_.current.add(t),us(e,`repo.probe`,{path:t}).then(e=>h(n=>({...n,[t]:e}))).catch(()=>{}))},[e,f]),(0,g.useEffect)(()=>{!ge||!ye.loaded||me!==t.machine||xe(e=>e??Al(n,ye.repos))},[ye.loaded]),(0,g.useEffect)(()=>fe.current?.focus(),[]);let De=a.engines.find(e=>e.id===a.engine),Oe=Zo(De,R(`newSession.modelDefault`)),ke=Qo(De,R(`newSession.effortDefault`)),Ae=Oe.some(e=>e.id===N)?N:``,je=ke.some(e=>e.id===F)?F:``,Me=async t=>{se(null),ee(!0),ne(R(`newSession.cloning`,{source:t}));try{let n=Io(Fo((localStorage.getItem(`rove.web.cloneParent`)||`~/`).trim(),u)),r=await e.client.request(`repo.clone`,{url:t,parentDir:n},ne);l(e=>e.includes(r.path)?e:[...e,r.path]),p(e=>e.includes(r.path)?e:ts(e,r.path)),b(!1),D(``)}catch(e){se(Hl(e))}finally{ee(!1),ne(``)}},Ne=async t=>{if(!be)return se(R(`newSession.needRepo`));if(t&&!A.trim())return se(R(`newSession.needPrompt`));ee(!0),ne(be.clone?R(`newSession.cloningOn`,{source:be.ref,machine:ve}):R(`newSession.startingOn`,{machine:ve}));try{let n=await Vl(e,{pick:be,machine:me,engine:a.engine,prompt:A.trim(),begin:t,baseRef:Se});nu=``,Lt.set(null),n&&e.selectWhenListed(n)}catch(e){se(Hl(e))}finally{ee(!1),ne(``)}},Pe=async(t=!0)=>{if(se(null),ge)return Ne(t);if(!Te&&!y)return se(R(`newSession.needRepo`));if(t&&!A.trim())return se(R(`newSession.needPrompt`));ee(!0);let n=_o(A.trim(),ce);try{let r=await Promise.all(f.map(t=>e.client.request(`repo.probe`,{path:t}))),i=r.find(e=>!e.ok);if(i)throw Error(i.reason??i.repo);let o;if(y)o=await is(e.client.request.bind(e.client),a.engine,A,t);else if(we){let i=await e.client.request(`task.openMain`,{repo:r[0]?.repo??Te}),s=await e.client.request(`tab.new`,{taskId:i.taskId,kind:`engine`,...a.engine?{engine:a.engine}:{},...t?{prompt:n}:{}});o=s.taskId??i.taskId;let c=!t&&s.taskId?jo(A):``;c&&await e.client.request(`task.rename`,{taskId:s.taskId,title:c})}else o=(await e.client.request(`task.spawn`,rs({repos:f.map((e,t)=>({repo:r[t]?.repo??e,baseRef:S[e]??``})),branch:w.trim(),engine:a.engine,prompt:n,begin:t,model:Ae,effort:je}))).taskIds[0];nu=``,de(),Lt.set(null),o&&e.selectWhenListed(o)}catch(e){se(e instanceof Error?e.message:String(e))}finally{ee(!1)}},Fe=No(Ee?.branches??[],O).map(e=>({key:e,text:e,checked:e===(S[Te]||Ee?.current)})),Ie=S[Te]||Ee?.current||``,Le=f.map(e=>({path:e,name:Mo(e).base,primary:e===Te,branches:m[e]?.branches??[],current:m[e]?.current??``,base:S[e]??``}));return(0,B.jsxs)(`div`,{className:qc,children:[(0,B.jsxs)(`div`,{className:Jc,children:[(0,B.jsx)(`h1`,{className:`m-0 font-sans text-title font-semibold text-accent`,children:R(`newSession.title`)}),(0,B.jsx)(`p`,{className:`m-0 text-muted`,children:R(`newSession.tagline`)})]}),(0,B.jsxs)(`form`,{className:Yc,onSubmit:e=>{e.preventDefault(),Pe()},children:[(0,B.jsxs)(`div`,{className:Xc,..._e?.drop,children:[(0,B.jsx)(`textarea`,{ref:fe,className:Qc,rows:4,spellCheck:!1,placeholder:R(`newSession.placeholder`),value:A,disabled:L,onChange:e=>M(e.target.value),onPaste:_e?.onPaste,onKeyDown:e=>{e.key!==`Enter`||e.shiftKey||e.nativeEvent.isComposing||(e.preventDefault(),Pe())}}),(0,B.jsxs)(`div`,{className:Zc,children:[(0,B.jsx)(`button`,{type:`button`,className:nl(),disabled:L,onClick:()=>void Pe(!1),children:R(`newSession.createOnly`)}),(0,B.jsx)(`button`,{type:`submit`,className:V(),disabled:L,children:R(`newSession.start`)})]})]}),(0,B.jsxs)(`div`,{className:$c,children:[(0,B.jsx)(zl,{machines:pe,value:me,onPick:e=>{he(e),xe(null),Ce(``),D(``),se(null),b(!1)}}),(0,B.jsx)(Cl,{field:`repo`,title:!ge&&f.length>1?R(`newSession.repoCount`,{count:f.length}):R(`newSession.repo`),label:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(ml,{}),es(ge?be?[be.ref]:[]:f)||R(y?`rail.noProject`:`newSession.repo`),be?.clone&&(0,B.jsxs)(`span`,{className:`text-muted`,children:[` `,R(`newSession.cloneTag`)]})]}),children:t=>(0,B.jsx)(Wl,{model:e,saved:ge?ye.repos.map(kl):c,picked:ge?be?[be.ref]:[]:f,primary:ge?``:Te,home:ge?``:u,query:E,onQuery:D,onToggle:e=>{if(se(null),!ge)return b(!1),p(t=>ts(t,e));xe({ref:e,clone:!1}),t()},onClone:e=>ge?xe({ref:e,clone:!0}):void Me(e),close:t,remote:ge?{name:ve,empty:Ll(me,ye),blocked:ye.problem!==``}:void 0,ungrouped:ge?void 0:{on:y,pick:x}})}),y?null:ge?be&&(0,B.jsx)(Bl,{value:Se,onPick:Ce}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`button`,{type:`button`,className:`${nl(!we)} ${rl}`,"aria-pressed":!we,disabled:f.length>1,title:f.length>1?R(`newSession.worktreeMulti`):R(we?`newSession.worktreeOff`:`newSession.worktreeOn`),onClick:()=>ae(!re),children:[(0,B.jsx)(hl,{}),R(`newSession.worktree`)]}),f.length>1?(0,B.jsx)(Cl,{field:`branch`,title:R(`newSession.branches`),label:R(`newSession.branches`),children:()=>(0,B.jsx)(Ol,{repos:Le,branch:w,onBranch:T,onBase:(e,t)=>C(n=>({...n,[e]:t}))})}):!we&&Ee?.ok&&Ie&&(0,B.jsx)(Cl,{field:`branch`,title:R(`newSession.branch`),label:Ie,children:e=>(0,B.jsx)(wl,{placeholder:R(`newSession.branchSearch`),empty:R(`newSession.branchEmpty`),rows:Fe,query:O,onQuery:k,onPick:t=>{C(e=>({...e,[Te]:t})),k(``),e()}})})]}),_e&&(0,B.jsxs)(go,{className:`${nl(ce.length>0)} cursor-pointer`,title:R(`newSession.attachHint`),disabled:L,onFiles:e=>void le(e),children:[(0,B.jsx)(gl,{}),R(`newSession.attach`)]}),(0,B.jsx)(`span`,{className:el}),a.engines.length>1&&(0,B.jsx)(Cl,{field:`engine`,title:R(`newSession.engine`),label:De?.name??R(`newSession.engine`),children:e=>(0,B.jsx)(El,{heading:R(`newSession.engine`),options:a.engines.map(e=>({id:e.id,label:e.name,dim:e.ready===!1})),value:a.engine,onPick:t=>{a.setEngine(t),e()}})}),!we&&!ge&&!y&&(Oe.length>0||ke.length>0)&&(0,B.jsx)(Cl,{field:`model`,title:R(`newSession.model`),label:$o(Oe,Ae,je,R(`newSession.modelDefault`)),children:e=>(0,B.jsx)(Dl,{models:Oe,model:Ae,onModel:P,efforts:ke,effort:je,onEffort:I,close:e})})]}),!ge&&(0,B.jsx)(bo,{attachments:ce,onRemove:ue}),L&&te&&(0,B.jsx)(`p`,{className:`text-muted`,"data-field":`clone-progress`,children:te}),oe&&(0,B.jsxs)(`p`,{className:`text-error`,children:[`※ `,oe]})]}),!ge&&(0,B.jsx)(`button`,{type:`button`,className:`mt-2 self-center px-1.5 py-0.5 text-subtle focus-visible:text-ink touch:mt-0.5 touch:py-2 [&:hover]:text-ink`,onClick:()=>W.set((0,B.jsx)(Ql,{model:e,repo:Te||void 0})),children:R(`newSession.moreWays`)})]})}var iu=10;function au(e,t){let n=e=>e.surface===t?0:e.surface?1:2,r=Sa().filter(n=>Ca(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:Za(e.id),chord:e.prefix?`${Sr()} + ${hr(t)}`:hr(t),raw:e.prefix?`${xr()} + ${t}`:t}))}return a}function ou(e){let t=document.activeElement instanceof HTMLElement?document.activeElement:null;W.set((0,B.jsx)(su,{model:e,surface:Ta(),origin:t}))}function su({model:e,surface:t,origin:n}){z();let[r,i]=(0,g.useState)(``),[a,o]=(0,g.useState)(0),s=(0,g.useRef)(null),c=v(gr),l=(0,g.useMemo)(()=>au(e,t),[e,t,c]).filter(e=>Ra(r,e.name,e.raw)),u=Math.min(a,Math.max(0,l.length-1));(0,g.useEffect)(()=>()=>n?.focus(),[n]),(0,g.useEffect)(()=>{s.current?.querySelector(`.is-selected`)?.scrollIntoView({block:`nearest`})},[u]);let d=t=>{Wt(),n?.focus(),t.command.live?.(e)===!1?G(Ja(`unavailable`),`error`):t.command.run(e)};return(0,B.jsx)(kn,{title:Ja(`palette`),wide:!0,children:(0,B.jsxs)(`div`,{className:`${on} palette`,onKeyDown:e=>{if(e.key===`ArrowDown`)o(Math.min(l.length-1,u+1));else if(e.key===`ArrowUp`)o(Math.max(0,u-1));else if(e.key===`Enter`){let e=l[u];e&&d(e)}else return;e.preventDefault()},children:[(0,B.jsx)(`input`,{className:U,autoFocus:!0,spellCheck:!1,value:r,placeholder:Ja(`search`),onChange:e=>{i(e.target.value),o(0)}}),(0,B.jsxs)(`div`,{className:Be,ref:s,style:{maxHeight:`${iu*1.9}em`},children:[l.length===0&&(0,B.jsx)(`p`,{className:`text-muted`,children:Ja(`noResults`)}),l.map((e,t)=>(0,B.jsxs)(`button`,{type:`button`,className:Ve(t===u),onMouseEnter:()=>o(t),onClick:()=>d(e),children:[(0,B.jsx)(`span`,{children:`${t===u?`› `:` `}${e.name}`}),(0,B.jsx)(`span`,{className:`keys-only mono text-accent`,children:e.chord})]},e.command.id))]}),(0,B.jsx)(`p`,{className:`keys-only text-muted`,children:Ja(`run`)})]})})}var cu=_(null);function lu(e){let t=(document.activeElement?.closest(`.rail`)==null?null:cu.get())??e.selection.get().taskId;return e.tasks.get()?.tasks.find(e=>e.id===t)??null}function uu(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 du=2e3,fu=e=>e?.login?.state===`pending`||e?.login?.state===`syncing`;function pu(e){let{client:t}=e,n=Kc(e),[r,i]=(0,g.useState)({}),a=n.flatMap(e=>e.state===`online`?[e.alias]:[]).join(`
|
|
15
|
-
`),o=(0,g.useMemo)(()=>a?a.split(`
|
|
16
|
-
`):[],[a]),s=(0,g.useRef)(new Set),c=(0,g.useCallback)(async e=>{let n=e===``?{}:{machine:e},r=await t.request(`github.status`,n).catch(e=>({status:null,reason:`failed`,message:On(e)}));i(t=>({...t,[e]:r}))},[t]),l=(0,g.useCallback)(()=>Promise.all([``,...o].map(c)).then(()=>{}),[c,o]);return(0,g.useEffect)(()=>{l()},[l]),(0,g.useEffect)(()=>{let e=new Set(Object.entries(r).flatMap(([e,t])=>fu(t.status)?[e]:[])),t=[...s.current].some(t=>!e.has(t));if(s.current=e,t&&l(),e.size===0)return;let n=window.setTimeout(()=>{for(let t of e)c(t)},du);return()=>window.clearTimeout(n)},[r,c,l]),{machines:n,probes:r,refresh:l,probe:c,act:(0,g.useCallback)(async(e,n)=>{try{let r=await t.request(e,n);return r.ok||G(r.message,`error`),r}catch(e){return G(On(e),`error`),null}},[t])}}var mu=`-mx-1 flex w-[calc(100%+8px)] items-baseline gap-2.5 px-1 py-1.25 text-left text-body leading-[inherit]`,hu=`${mu} cursor-pointer`,gu=`${mu} enabled:hover:bg-hover`,_u=mu,vu=`self-center accent-accent`,yu=`text-meta leading-[inherit]`,bu=`${yu} max-w-2/5 shrink-0`,xu=`${yu} after:ml-1.5 after:inline-block after:size-2.5 after:bg-subtle after:align-[-1px] after:content-[''] after:chevron-mask`,Su=`m-0 text-meta leading-[inherit]`,Cu=`text-meta`,wu=`m-0 flex min-w-0 flex-col gap-1.5 border-none border-current px-0 py-1 [&_p]:wrap-anywhere`,Tu=`${yu} float-left mb-1.5 w-full p-0`,Eu=`w-[9ch] px-1.5 py-0.75`,Du=`flex flex-col gap-0.75 border-b-hairline border-b-line px-1 py-2`,Ou=`flex items-baseline gap-3`,ku=`flex flex-col gap-2 pt-2 pb-0.5`,Au=`flex flex-col gap-1.5 rounded-sm border-hairline border-line bg-inset px-2.5 py-2 [&_p]:m-0`,ju=`grid grid-cols-[minmax(0,1fr)_104px_72px] items-center gap-3`,Mu=`flex flex-col`,Nu=`${ju} border-b-hairline border-b-line pt-0 pr-1 pb-1.5 pl-7.5 font-sans text-meta font-medium normal-nums text-subtle [&>span:not(:first-child)]:text-center`,Pu=`border-b-hairline border-b-line`,Fu=`${ju} group/eng rounded-sm py-1 pr-1 pl-0 hover:bg-hover`,Iu=`focus-visible:outline-1 focus-visible:outline-offset-1 focus-visible:outline-focus`,Lu=`flex min-w-0 items-center gap-2 rounded-sm py-1.5 pr-0 pl-1.5 text-left ${Iu}`,Ru=e=>`mx-0.5 ${e?`text-muted`:`text-subtle`}`,zu=`flex min-w-0 flex-col gap-0.5`,Bu=e=>`truncate text-body leading-[inherit] font-medium ${e?`text-muted`:`text-ink`}`,Vu=`ml-2 text-meta leading-[inherit] font-normal text-subtle`,Hu={ready:`bg-success`,attention:`bg-warning`,error:`bg-error`,absent:`bg-subtle`},Uu=e=>`inline-flex items-center gap-1.5 text-meta leading-[inherit] ${e===`error`?`text-error`:`text-muted`}`,Wu=e=>`size-1.75 flex-none rounded-full ${Hu[e]}`,Gu=`flex justify-center`,Ku=`rounded-full bg-accent-soft px-2.25 py-0.5 font-sans text-meta font-medium normal-nums capitalize text-accent`,qu=`rounded-full border-hairline border-line px-2.25 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`,Ju=`mt-0 mr-1 mb-2.5 ml-7 flex flex-col gap-2.5 rounded-sm bg-inset px-3 py-2.5`,Yu=`m-0 grid grid-cols-[max-content_minmax(0,1fr)] gap-x-3.5 gap-y-1.5 text-meta leading-[1.5]`,Xu=`text-subtle`,Zu=e=>`m-0 wrap-anywhere ${e?`text-warning`:`text-ink`}`,Qu=`flex items-center gap-2`,$u=`flex-1 px-2 py-1.25`,ed=`rounded-sm border-hairline border-line px-2.5 py-1 text-meta leading-[inherit] text-ink hover:border-line-active hover:bg-hover touch:min-h-10 ${Iu}`,td=`mt-1.5 flex flex-col gap-1.5 rounded-md border-hairline border-line px-3.5 py-3`,nd=`flex items-baseline gap-2.5`,rd=`m-0 text-body leading-[inherit] font-medium`,id=`${Qu} mt-1`,ad=`text-meta leading-[inherit] text-success`,od=`grid min-h-90 grid-cols-[140px_1fr] gap-4.5 w-narrow:min-h-0 w-narrow:grid-cols-[minmax(0,1fr)] w-narrow:gap-3`,sd=`flex flex-col gap-0.5 pr-2.5 [border-right:var(--hairline)_solid_var(--line)] w-narrow:flex-row w-narrow:overflow-x-auto w-narrow:scrollbar-none w-narrow:[border-right:none] w-narrow:[border-bottom:var(--hairline)_solid_var(--line)] w-narrow:p-0 w-narrow:pb-2`,cd=e=>`rounded-sm px-2.5 py-1.25 text-left w-narrow:flex-none w-narrow:whitespace-nowrap ${e?`bg-inset text-ink`:`text-muted [&:hover]:bg-hover`}`,ld=`flex max-h-[60vh] flex-col gap-4.5 overflow-y-auto px-1.5`,ud=`flex flex-col gap-2 [&_p]:m-0 [&_p]:text-[length:var(--fs-meta)]`,dd=`flex flex-col`,fd=`flex items-center gap-2.5 border-b-hairline border-b-line px-1 py-1.5`,pd=`flex min-w-0 flex-1 flex-col gap-0.5`,md=(e=!1)=>`overflow-hidden text-ellipsis text-[length:var(--fs-meta)] ${e?`whitespace-normal`:`whitespace-nowrap`}`,hd=`grid grid-cols-[repeat(auto-fill,minmax(112px,1fr))] gap-2 clear-both`,gd=e=>e?`border-accent bg-accent-soft`:`border-line hover:bg-hover`,_d=`flex h-12 overflow-hidden rounded-sm border-hairline`,vd=`flex w-2/5 flex-col gap-1 p-1.5`,yd=`flex min-w-0 flex-1 flex-col gap-1 p-1.5`,bd=`h-1 rounded-sm`,xd=`mt-auto flex gap-1`,Sd=`size-1.5 rounded-sm`,Cd=`flex min-w-0 items-baseline gap-1.5 font-mono text-meta`;function J(e){return(0,B.jsxs)(`section`,{className:ud,children:[(0,B.jsx)(`h2`,{className:`${H} text-muted`,children:e.title}),e.hint&&(0,B.jsx)(`p`,{className:`text-muted`,children:e.hint}),e.children]})}function wd(e){return(0,B.jsxs)(`label`,{className:hu,children:[(0,B.jsx)(`input`,{type:`checkbox`,className:`${vu} touch:size-5`,checked:e.checked,disabled:e.disabled,onChange:t=>e.onChange(t.target.checked)}),(0,B.jsx)(`span`,{className:e.hint?bu:yu,children:e.label}),e.hint&&(0,B.jsx)(`span`,{className:`m-0 text-meta leading-[inherit] text-muted`,children:e.hint})]})}function Td(e){return(0,B.jsxs)(`fieldset`,{className:wu,children:[(0,B.jsx)(`legend`,{className:Tu,children:e.label}),(0,B.jsx)(`div`,{className:`${Zt} clear-both`,children:e.picks.map(t=>(0,B.jsx)(`button`,{type:`button`,"aria-pressed":t.value===e.value,className:Qt(t.value===e.value),onClick:()=>t.value!==e.value&&e.onPick(t.value),children:t.label},t.value))}),e.hint&&(0,B.jsx)(`p`,{className:`m-0 text-meta leading-[inherit] text-muted`,children:e.hint})]})}function Ed(e){return(0,B.jsxs)(`button`,{type:`button`,className:gu,disabled:e.disabled,onClick:e.onCycle,children:[(0,B.jsx)(`span`,{className:xu,children:e.label}),e.hint&&(0,B.jsx)(`span`,{className:`m-0 text-meta leading-[inherit] text-muted`,children:e.hint})]})}function Dd(e){return(0,B.jsxs)(`div`,{className:_u,children:[(0,B.jsx)(`span`,{className:`${Cu} mono text-muted`,children:e.label}),(0,B.jsx)(`span`,{className:`${Su} text-muted`,children:e.note})]})}var Od={same:`markSame`,different:`markDifferent`,signedOut:`markSignedOut`,noGh:`markNoGh`,outdated:`markOutdated`,offline:`markOffline`,denied:`markDenied`,failed:`markFailed`},kd=(e,t)=>R(`settings.connectors.${e}`,t),Ad={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 jd(e,t){return e===`loading`?kd(`loading`):kd(Od[e],{login:t?.account??``})}function Md(e){if(!e?.gh)return``;let t=e.ssh.ok?`✓ ${e.ssh.user??``}`.trim():`✗`;return kd(`detail`,{protocol:e.protocol??`—`,ssh:t})}function Nd(){return(0,B.jsx)(`svg`,{className:`flex-none`,viewBox:`0 0 16 16`,width:`22`,height:`22`,"aria-hidden":`true`,children:(0,B.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 Pd(e){navigator.clipboard.writeText(e).then(()=>G(kd(`codeCopied`)),()=>{})}function Fd({login:e,onCancel:t}){return e.state===`failed`?(0,B.jsxs)(`div`,{className:`flex items-center gap-2.5 rounded-sm bg-inset px-2 py-1.5 text-meta`,children:[(0,B.jsx)(`span`,{className:`text-muted`,children:kd(`loginFailed`,{error:e.error??``})}),(0,B.jsx)(`button`,{type:`button`,className:Tt,onClick:t,children:kd(`dismiss`)})]}):e.state===`syncing`?(0,B.jsx)(`div`,{className:`flex items-center gap-2.5 rounded-sm bg-inset px-2 py-1.5 text-meta`,children:(0,B.jsx)(`span`,{className:`text-muted`,children:kd(`syncing`)})}):(0,B.jsxs)(`div`,{className:`flex items-center gap-2.5 rounded-sm bg-inset px-2 py-1.5 text-meta`,children:[e.code?(0,B.jsxs)(B.Fragment,{children:[(0,B.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:kd(`codeHint`),onClick:()=>Pd(e.code??``),children:e.code}),(0,B.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,children:kd(`openGithub`)})]}):(0,B.jsx)(`span`,{className:`text-muted`,children:kd(`loading`)}),(0,B.jsx)(`button`,{type:`button`,className:Tt,onClick:t,children:R(`dialog.cancel`)})]})}function Id(e){let t=uu(e.probe,e.machine,e.rove),n=e.probe?.status??null,r=fu(n),i=t===`different`||t===`signedOut`,a=n?.login;return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:fd,children:[(0,B.jsxs)(`div`,{className:pd,children:[(0,B.jsx)(`span`,{className:`engine-name`,children:e.name}),(0,B.jsx)(`span`,{className:`text-muted ${md()}`,title:[n?.authDetail,n?.ssh.detail].filter(Boolean).join(`, `)||void 0,children:Md(n)})]}),(0,B.jsx)(`span`,{className:`whitespace-nowrap text-meta ${Ad[t]}`,title:e.probe?.message,children:jd(t,n)}),e.onSync&&i&&e.rove&&!r&&(0,B.jsx)(`button`,{type:`button`,disabled:e.busy,onClick:e.onSync,children:kd(`useRove`)}),e.onLogin&&i&&!r&&(0,B.jsx)(`button`,{type:`button`,disabled:e.busy,onClick:e.onLogin,children:kd(`loginThere`)})]}),a&&(0,B.jsx)(Fd,{login:a,onCancel:e.onCancel})]})}function Ld({model:e}){let{machines:t,probes:n,refresh:r,probe:i,act:a}=pu(e),[o,s]=(0,g.useState)(null),[c,l]=(0,g.useState)(!1),u=n[``],d=u?.status?.account??null,f=fu(u?.status),p=async(e,t)=>{s(e);try{await t()}finally{s(null)}},m=e=>p(e,async()=>{await a(`github.login`,e===``?{}:{machine:e}),await i(e)}),h=e=>p(e,async()=>{await a(`github.login`,e===``?{cancel:!0}:{machine:e,cancel:!0}),await i(e)}),_=e=>p(e,async()=>{(await a(`github.sync`,{machine:e}))?.ok&&G(kd(`synced`,{machine:e,login:d??``})),await i(e)}),v=()=>p(``,async()=>{(await a(`github.logout`,{}))?.ok&&l(!1),await r()});return(0,B.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-sm border-hairline border-line p-2.5`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,B.jsx)(Nd,{}),(0,B.jsxs)(`div`,{className:pd,children:[(0,B.jsx)(`span`,{className:`engine-name`,children:`GitHub`}),(0,B.jsx)(`span`,{className:`text-muted ${md(!0)}`,children:kd(`githubDescription`)})]}),d?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`span`,{className:`mono`,children:[`@`,d]}),(0,B.jsx)(`button`,{type:`button`,disabled:o!==null,onClick:()=>l(!0),children:kd(`disconnect`)})]}):!f&&(0,B.jsx)(`button`,{type:`button`,className:V(),disabled:o!==null||!u,onClick:()=>void m(``),children:kd(`connect`)})]}),c&&(0,B.jsxs)(`div`,{className:`flex flex-col gap-1.5 rounded-sm border-hairline border-line bg-inset px-2.5 py-2 [&_p]:m-0`,children:[(0,B.jsx)(`p`,{className:`text-muted`,children:kd(`disconnectBody`)}),(0,B.jsxs)(`div`,{className:`actions flex items-center justify-end gap-3.5`,children:[(0,B.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>l(!1),children:R(`dialog.cancel`)}),(0,B.jsx)(`button`,{type:`button`,className:V({danger:!0}),disabled:o!==null,onClick:()=>void v(),children:kd(`disconnect`)})]})]}),!d&&u?.status?.login&&(0,B.jsx)(Fd,{login:u.status.login,onCancel:()=>void h(``)}),d&&(0,B.jsxs)(J,{title:kd(`machines`),children:[(0,B.jsxs)(`div`,{className:`flex flex-col`,children:[(0,B.jsx)(Id,{name:kd(`thisMachine`),probe:u,machine:null,rove:d,busy:o!==null,onCancel:()=>void h(``)}),t.map(e=>(0,B.jsx)(Id,{name:e.alias,probe:n[e.alias],machine:e.state,rove:d,busy:o!==null,onSync:()=>void _(e.alias),onLogin:()=>void m(e.alias),onCancel:()=>void h(e.alias)},e.alias))]}),(0,B.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>void r(),children:kd(`refresh`)})]})]})}function Rd({model:e}){return(0,B.jsx)(Ld,{model:e})}var zd={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"}},Bd={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}"}},Vd={dev:{reset:`Reset UI state`,resetHint:`Clears ~/.config/rove/state.json and ~/.rove/tasks.json, then quits Rove — relaunch to start fresh. Working session list, pane sizes, theme, model picks all reset. Worktrees on disk and engine session history are not touched.`,resetButton:`[enter] Reset`,restart:`Restart backend`,restartHint:`Stops the Rove daemon and relaunches this window on the installed build — picks up daemon / orchestrator / engine edits without quitting by hand. Running engine sessions live in the PTY host and survive it; other attached Rove windows reconnect on their own.`,restartButton:`[enter] Restart`,reload:`Reload settings`,reloadHint:"Applies hand edits to ~/.config/rove/state.json (from `rove config`) to this window without a restart.",reloadButton:`[enter] Reload`,reloadDone:`Reloaded: {count} changed.`,reloadUnchanged:`Already matches state.json; nothing changed.`,reloadFailed:`state.json could not be read, nothing changed: {error}`,doctorHint:"Daemon wedged or unresponsive? Restart backend above does it from here; from a shell it is `rove daemon restart`. Hosted engine sessions stay alive across a daemon restart.",experimental:`Experimental`,remoteHint:"Remote projects (SSH): register a project whose git worktrees live on another host, driven from this local Rove. Unfinished — Hosted PTY engine launch over SSH is not implemented, and file/diff panes still degrade. Enables `rove add --remote`.",remote:`Remote projects`,autoStatusHint:`Auto status flow: a backlog task moves to in_progress when its engine starts a turn, and new sessions get a system-prompt note telling the agent to set in_review itself when the work is done. Never touches done/canceled.`,autoStatus:`Auto status flow`,dispatcherHint:"Field-notes dispatcher: task sessions file one-line gotchas (`rove api note`), the daemon forwards each to the repo's main session, and that session relays them to the in-flight tasks that benefit (`rove api dispatch`). Web-hosted sessions receive the relays today.",dispatcher:`Field-notes dispatcher`}},Hd={dev:{reset:`重置 UI 状态`,resetHint:`清空 ~/.config/rove/state.json 和 ~/.rove/tasks.json,然后退出 Rove——重新启动即可从头开始。工作会话列表、面板尺寸、主题、模型选择都会重置。磁盘上的 worktree 和引擎会话历史不受影响。`,resetButton:`[enter] 重置`,restart:`重启后端`,restartHint:`停止 Rove daemon,并以已安装的版本重新启动当前窗口——无需手动退出即可应用 daemon / orchestrator / engine 的改动。正在运行的引擎会话由 PTY host 托管,不受影响;其他已连接的 Rove 窗口会自行重连。`,restartButton:`[enter] 重启`,reload:`重新加载设置`,reloadHint:"把对 ~/.config/rove/state.json 的手动修改(来自 `rove config`)应用到当前窗口,无需重启。",reloadButton:`[enter] 重新加载`,reloadDone:`已重新加载:{count} 项有变化。`,reloadUnchanged:`已与 state.json 一致,没有变化。`,reloadFailed:`无法读取 state.json,未做任何改动:{error}`,doctorHint:"daemon 卡住或无响应?上面的「重启后端」就能在这里完成;在 shell 里则是 `rove daemon restart`。Hosted PTY 引擎会话不会因 daemon 重启而退出。",experimental:`实验性`,remoteHint:"远程项目(SSH):注册一个 git worktree + 引擎都通过 SSH 跑在另一台主机上、由本地 Rove 驱动的项目。尚未完成——文件/diff 面板对远程仍会降级。启用 `rove add --remote`。",remote:`远程项目`,autoStatusHint:`自动状态流转:backlog 任务在其引擎开始一轮时移到 in_progress,新会话会拿到一条系统提示,告诉 agent 完成后自行设为 in_review。绝不触碰 done/canceled。`,autoStatus:`自动状态流转`,dispatcherHint:"现场笔记调度器:任务会话提交一行经验(`rove api note`),daemon 将每条转发给仓库的主会话,主会话再把它们转达给能受益的进行中任务(`rove api dispatch`)。目前由 Web 托管的会话会收到转达。",dispatcher:`现场笔记调度器`}},Ud={engines:{title:`Engines`,hint:`Engines Rove can start on this machine. New tasks start with the default engine; switch an engine off to stop offering it.`,keys:`space available · d default · enter launch command · r rename · x reset/remove`,customTag:`custom`,available:`available`,off:`off`,defaultMark:`default`,makeDefault:`Make default`,status:{checking:`Checking…`,unknown:`Status unknown`,ready:`Ready`,notInstalled:`Not installed`,notOnPath:`Not on PATH`,signIn:`Sign in needed`,integrationMissing:`Integration not installed`,integrationOutdated:`Integration outdated`,integrationBlocked:`Integration blocked`},detail:{program:`Program`,command:`Command`,signIn:`Sign-in`,reporting:`Live status`,adapter:`Adapter`,programFound:`{binary} found at {path}.`,programMissing:`{binary} is not on PATH. Install the engine's CLI, or point its launch command at it.`,programUnknown:`Rove could not check for {binary}.`,commandDefault:`{command} (the default)`,commandCustom:`{command} (yours)`,signedIn:`Signed in.`,signedInAs:`Signed in as {who}.`,apiKey:`An API key is configured.`,token:`A token is configured ({source}).`,signedOut:`Not signed in. Sign in with the engine's own CLI.`,signInUnknown:`Rove can't see whether this engine is signed in.`,signInFailed:`Sign-in check failed: {error}`,hooksInstalled:`Rove's hooks are installed, so tabs report their state as it changes.`,hooksOutdated:`Rove's hooks are from an older version; reinstall them under Engine integrations.`,hooksMissing:`Rove's hooks are not installed; install them under Engine integrations.`,hooksAwaitEngine:`Rove's hooks can be installed once the engine is.`,hooksUnsupported:`This engine has no hooks for Rove to install.`,hooksBlocked:`Rove can't write its hooks into {file}: {reason}`,hooksBlockedHere:`Rove can't write its hooks into the engine's config: {reason}`,markersYes:`It leaves turn-complete markers that Rove reads back.`,markersNo:`It leaves no turn-complete markers.`,screenYes:`Screen rules cover what the hooks don't.`,screenNo:`No screen rules.`,screenNotNeeded:`No screen rules; the hooks report everything.`,adapterDeclared:`Borrows the {protocol} adapter.`,adapterGeneric:`Generic adapter: no transcript reader, sign-in check or resume.`,skill:`Rove skill`,skillInstalled:`Installed in {dir}.`,skillInstalledHere:`Installed and current.`,skillOutdated:`From an older Rove; reinstall it under Rove agent skill.`,skillMissing:`Not installed; install it under Rove agent skill.`},skill:{title:`Rove agent skill`,hint:`Teaches the agent in each engine to drive Rove itself (rove api): start tasks, read other sessions, message them.`,install:`Install ({count})`,noEngines:`No engine here takes the skill`,failed:`Install failed: {reason}`,bannerTitle:`ROVE SKILL NOT INSTALLED`,bannerHint:`{engines} can't drive Rove yet (start tasks, read other sessions). Click here to install.`,bannerHintWeb:`{engines} can't drive Rove yet (start tasks, read other sessions).`},integrations:{title:`Engine integrations`,hint:`Hooks Rove writes into each engine's own config, so a tab shows working, waiting or done the moment it happens.`,summary:`{installed} of {total} installed`,install:`Install missing ({count})`,upToDate:`All up to date`,remove:`Remove all ({count})`,noneInstalled:`Nothing to remove`},addEngine:`+ Add engine`,launchCommandTitle:`{name} launch command`,displayNameTitle:`{name} display name (blank = default)`,addTitle:`Add engine`,addStepTitle:`Add engine · {id}`,protocolTitle:`Add engine · {id} — protocol`,protocolNone:`None — generic adapter`,protocolFooter:`↑↓ choose · enter pick · esc cancel`,protocolRow:`protocol {protocol}`,protocolGeneric:`generic`,idPlaceholder:`lowercase slug, e.g. aider`,commandPlaceholder:`e.g. aider --model sonnet`,hookTrustHint:`Open {command} in the engine and approve hooks yourself. Written hooks are not proof of trust.`,readiness:`CLI: {cli} · login: {login} · hooks: {hooks}`,cliReady:`available`,cliMissing:`missing; install the engine CLI`,loginReady:`detected`,loginMissing:`sign in with the engine CLI`,readinessUnknown:`not observable`,hooksWritten:`written`,hooksMissing:`not written; Settings → Engines`,hooksOutdated:`outdated; Settings → Engines`,hookWaiting:`No hook event received yet. After approval, send a short prompt to verify activity.`,hookReceived:`Hook event recorded for this tab. Send a short prompt to check current reporting; current trust is not inferred.`,readinessFailed:`Readiness check unavailable; run rove doctor. No authorization is inferred.`},accounts:{checking:`Checking…`,notLoggedIn:`○ Not logged in`,loggedIn:`● Logged in: {email}`,apiKeyConfigured:`● API key configured`,chatgptLogin:`● ChatGPT login: {email}`,tokenConfigured:`● Token configured ({source})`,detected:`● Login detected`}},Wd={engines:{title:`引擎`,hint:`Rove 能在这台机器上启动的引擎。新任务默认用「默认」引擎;关掉某个引擎,选引擎时就不再列出它。`,keys:`space 可用 · d 设为默认 · enter 启动命令 · r 重命名 · x 重置/移除`,customTag:`自定义`,available:`可用`,off:`已关`,defaultMark:`默认`,makeDefault:`设为默认`,status:{checking:`检查中…`,unknown:`状态未知`,ready:`就绪`,notInstalled:`未安装`,notOnPath:`不在 PATH 上`,signIn:`需要登录`,integrationMissing:`未安装接入`,integrationOutdated:`接入已过期`,integrationBlocked:`接入被拒绝`},detail:{program:`程序`,command:`命令`,signIn:`登录`,reporting:`实时状态`,adapter:`适配器`,programFound:`{binary} 位于 {path}。`,programMissing:`{binary} 不在 PATH 上。请安装引擎 CLI,或把启动命令指向它。`,programUnknown:`Rove 无法检查 {binary}。`,commandDefault:`{command}(默认)`,commandCustom:`{command}(自定义)`,signedIn:`已登录。`,signedInAs:`已登录:{who}。`,apiKey:`已配置 API key。`,token:`已配置 Token({source})。`,signedOut:`未登录。请用引擎自己的命令行登录。`,signInUnknown:`Rove 无法得知该引擎是否已登录。`,signInFailed:`登录检查失败:{error}`,hooksInstalled:`Rove 的钩子已安装,标签页的状态会实时上报。`,hooksOutdated:`Rove 的钩子来自旧版本;请在「引擎接入」里重新安装。`,hooksMissing:`Rove 的钩子未安装;请在「引擎接入」里安装。`,hooksAwaitEngine:`引擎安装后才能装 Rove 的钩子。`,hooksUnsupported:`该引擎没有可供 Rove 安装的钩子。`,hooksBlocked:`Rove 无法把钩子写入 {file}:{reason}`,hooksBlockedHere:`Rove 无法把钩子写入引擎配置:{reason}`,markersYes:`它会留下回合完成标记,Rove 可以读回。`,markersNo:`它不留下回合完成标记。`,screenYes:`读屏规则兜底钩子覆盖不到的状态。`,screenNo:`没有读屏规则。`,screenNotNeeded:`没有读屏规则;钩子已报全所有状态。`,adapterDeclared:`借用 {protocol} 适配器。`,adapterGeneric:`通用适配器:没有会话记录读取、登录检查和恢复。`,skill:`Rove 技能`,skillInstalled:`已安装在 {dir}。`,skillInstalledHere:`已安装,是最新版。`,skillOutdated:`来自旧版 Rove;请在「Rove 智能体技能」里重新安装。`,skillMissing:`未安装;请在「Rove 智能体技能」里安装。`},skill:{title:`Rove 智能体技能`,hint:`教会各引擎里的智能体自己操作 Rove(rove api):开任务、读其他会话、给它们发消息。`,install:`安装({count})`,noEngines:`这台机器上没有能装技能的引擎`,failed:`安装失败:{reason}`,bannerTitle:`ROVE 技能未安装`,bannerHint:`{engines} 还不能操作 Rove(开任务、读其他会话)。点这里安装。`,bannerHintWeb:`{engines} 还不能操作 Rove(开任务、读其他会话)。`},integrations:{title:`引擎接入`,hint:`Rove 写进各引擎自身配置的钩子,让标签页在工作、等待、完成的那一刻就显示出来。`,summary:`已安装 {installed}/{total}`,install:`安装缺失的({count})`,upToDate:`全部已是最新`,remove:`全部移除({count})`,noneInstalled:`没有可移除的`},addEngine:`+ 添加引擎`,launchCommandTitle:`{name} 的启动命令`,displayNameTitle:`{name} 的显示名称(留空 = 默认)`,addTitle:`添加引擎`,addStepTitle:`添加引擎 · {id}`,protocolTitle:`添加引擎 · {id} —— 协议`,protocolNone:`无 —— 通用适配器`,protocolFooter:`↑↓ 选择 · enter 确认 · esc 取消`,protocolRow:`协议 {protocol}`,protocolGeneric:`通用`,idPlaceholder:`小写短名,如 aider`,commandPlaceholder:`如 aider --model sonnet`,hookTrustHint:`在引擎中打开 {command},由你自行批准 hooks。写入不代表已授权。`,readiness:`CLI:{cli} · 登录:{login} · hooks:{hooks}`,cliReady:`可用`,cliMissing:`缺失;请安装引擎 CLI`,loginReady:`已检测到`,loginMissing:`请通过引擎 CLI 登录`,readinessUnknown:`无法观测`,hooksWritten:`已写入`,hooksMissing:`未写入;设置 → 引擎`,hooksOutdated:`已过时;设置 → 引擎`,hookWaiting:`尚未收到 hook 事件。授权后发送一条简短提示,验证活动状态。`,hookReceived:`已记录此标签页的 hook 事件。发送简短提示以检查当前上报;不据此推断当前授权。`,readinessFailed:`无法检查就绪状态;请运行 rove doctor。不会据此推断已授权。`},accounts:{checking:`检查中…`,notLoggedIn:`○ 未登录`,loggedIn:`● 已登录: {email}`,apiKeyConfigured:`● 已配置 API key`,chatgptLogin:`● ChatGPT 登录: {email}`,tokenConfigured:`● 已配置 Token ({source})`,detected:`● 检测到登录`}},Gd={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.`}},Kd={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 命令,其余命令会在它们声明的事件发生时执行。它们以你的身份、带你的环境变量运行,没有任何沙箱。`}},qd={en:{appearance:{enabled:`On`,disabled:`Off`,borderFlow:`Flowing gradient`,borderStill:`Still`,glyphsBraille:`Braille`,glyphsStarburst:`Starburst (needs a font with the Dingbats block)`,glyphsAscii:`ASCII`,titleShimmer:`Shimmer`,titleStill:`Still`,preview:`Workspace preview`,tasks:`Tasks`,terminal:`Terminal`,files:`Files`,testsPassed:`Tests passed`,transparent:`Transparent background`,opaque:`Opaque background`,modeDark:`Dark`,modeLight:`Light`,modeAuto:`Auto (follow the terminal)`,openHint:`Enter to choose an option and preview it.`,chooseHint:`↑/↓ or j/k preview · enter apply · esc cancel`},title:`Settings`,esc:`esc`,nav:{default:`j/k pick · h/l switch level · enter activate · esc close`,feedback:`tab next field · enter sends on Send · esc close`},sections:{general:`General`,engines:`Engines`,autoRouting:`Auto routing`,plugins:`Plugins`,marketplace:`Marketplace`,keys:`Keybindings`,feedback:`Feedback`,dev:`Dev`},general:{usage:`USAGE`,theme:`Theme`,themeMode:`Mode`,themeHint:`l to enter list · j/k to highlight · enter to apply`,language:`Language`,languageHint:`Display language for Rove's UI. l to enter list · j/k to highlight · enter to apply.`,transparent:`Transparent background`,transparentHint:`Drops the renderer's bg fill so the host terminal shows through. enter toggles.`,on:`[x] on`,off:`[ ] off`,focusAccent:`Focus accent`,focusAccentHint:`Color of focused pane title, ▌ marker, and split borders.`,accentPrimary:`Primary (brand accent)`,accentSuccess:`Success (legacy green)`,accentInfo:`Info (cool blue)`,appearance:`Appearance`,appearanceHint:`How split panes draw.`,splitStyle:`Split panes`,workingBorder:`Working border`,taskColors:`Task colors`,glyphSet:`State glyphs`,colorblind:`Colorblind diff colours`,runningTitle:`Running title`,splitBox:`Box frames`,splitLine:`Divider line`,splitRail:`Accent rail`,splitRule:`Top rule`,notifications:`Notifications`,notificationsHint:`When a background tab finishes or pauses on an approval.`,toast:`Toast`,toastHint:`bottom-right popup`,sound:`Sound`,soundHint:`bell + chime + an OSC 9 desktop notification (rides SSH)`,soundVolume:`Chime volume — {percent}%`,soundVolumeHint:`enter cycles; applies to the next chime`,crossTask:`Cross-task`,crossTaskHint:`also for a task you switched away from`,finishedAlerts:`Finished turns`,finishedAlertsHint:`off: only approvals and errors alert; the unread dot stays`,keyHints:`Keyboard hints`,keyHintsHint:`The status-bar reminder and the first-use hints in the sidebar and files panes.`,keyHintsShow:`Show keyboard hints`,keyHintsShowHint:`re-enabling relights hints dismissed by use`,zen:`Zen mode`,zenHint:"The `zen` chip and `prefix`+z hide Files, keeping the Tasks rail and workspace.",zenDefaultOn:`Start in zen mode`,updates:`Updates`,updatesHint:`Stable releases are cut by hand; the nightly preview is built from main every day.`,updateChannel:`Channel: {channel}`,updateChannelHint:"enter switches; `rove update` follows it",updateChannelName:{latest:`stable`,nightly:`nightly preview`},updateTry:{latest:`[ Back to stable ]`,nightly:`[ Try the nightly preview ]`},updateTryHint:`installs it now and follows that channel`,updateCheck:`[ Check for updates ]`,updateCheckHint:`asks npm for the newest release`,updateCheckButton:`Check for updates`,updateChecking:`Checking…`,updateOpenPage:`Open Update page`,updateTryTitle:{latest:`Go back to stable?`,nightly:`Install the nightly preview?`},updateTryBody:{latest:`Rove installs the latest stable release, which can be older than this nightly, then quits.`,nightly:"Rove installs today's nightly build of main, then quits. It is newer and less tested; `rove update --stable` goes back."},railFold:`Folded task rail`,railFoldHint:`What the rail shows once folded away from its corner control.`,railFoldRow:`Folded rail shows: {style}`,railFoldRowHint:`enter cycles`,railFoldGlyphs:`status glyphs`,railFoldInitials:`glyph + initials`,railFoldHairline:`colour band only`,editor:`Editor`,editorHint:`What enter opens a file with in the file tree — diff mode when the editor supports it, the read-only preview when it isn't installed.`,editorRow:`editor: < {kind} >`,editorRowHint:`auto follows $VISUAL / $EDITOR, else nvim / vim / emacs / nano`,editorCustom:`custom: {cmd}`,editorCustomUnset:`(unset — enter to edit)`,worktree:`Worktree location`,worktreeHint:`Where new task worktrees are created. New tasks only.`,worktreeBase:`location: < {kind} >`,worktreeBaseHint:"custom takes `~`, a relative path, or a leading `$project_dir`",worktreeKindDefault:`default ~/.rove/worktrees`,worktreeKindNext:`next to project`,worktreeKindCustom:`custom`,worktreeCustom:`custom: {path}`,worktreeCustomUnset:`(unset — enter to edit)`,worktreeBaseTitle:`Custom worktree location (blank = default; $project_dir = project root)`,worktreeBaseField:`PATH`,editorCustomTitle:`Custom editor command (use {file} for the path)`,worktreeBaseInvalidTitle:`Can't use that worktree location`,worktreeBaseTokenBody:`{token} only expands as the leading path segment (e.g. {token}/../rove-worktrees). Keeping the previous setting.`,worktreeBaseUnusableBody:`{path} isn't usable ({error}). Keeping the previous setting — pick a writable directory.`,terminal:`Terminal`,terminalHint:`Applies to terminals opened after the change.`,scrollbackRow:`scrollback: {rows} rows`,scrollbackRowHint:`100–100000 · larger costs proportionally more CPU per redraw`,scrollbackTitle:`Terminal scrollback rows (100–100000)`,scrollbackField:`ROWS`,scrollbackInvalidTitle:`Not a number`,scrollbackInvalidBody:`Scrollback must be a number of rows (e.g. 1000). Keeping the previous setting.`,tabStripRow:`tab strip: {mode}`,tabStripMode:{never:`off — the sidebar tree lists tabs`,multipleOnly:`only with 2+ tabs`,always:`always`}},field:{command:`COMMAND`,name:`NAME`,id:`ID`},action:{save:`save`,next:`next`,add:`add`},reset:{title:`Reset UI state?`,body:`Wipes ~/.config/rove/state.json and ~/.rove/tasks.json, then quits Rove — relaunch for a fresh start with an empty working session list. Worktrees on disk and engine session history are NOT touched.`,done:`Rove: UI state reset. Relaunch Rove to start fresh.`,failedTitle:`UI state was not reset`,failedBody:`Could not write the settings file. Your settings and tasks have been kept. Try resetting again.`},restart:{title:`Restart backend?`,body:`Stops the daemon and relaunches this Rove on the installed build, so daemon / orchestrator / engine edits take effect. Running engine sessions live in the PTY host and keep going; open tabs come back. Any other attached windows reconnect on their own.`,done:`Rove: restarting the backend...`},stateWrite:{failedTitle:`Settings were not saved`,failedBody:`{file} could not be written ({keys}). Check its directory permissions and free disk space, then save again.`},...zd,...Ud,...Gd,keybindings:{title:`Keybindings`,hint:`Rebind direct and prefix chords in your own YAML file; changes reload live. Press F1 anywhere for the live keymap with every binding id.`,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`,fixed:`Fixed (not rebindable): {ids}.`,createHint:`No overrides file yet. Rove can write one for you, fully commented — nothing is rebound until you uncomment a line.`,createFile:`[enter] Create keybindings.yaml`,overridesApplied:`Overrides applied`,none:`none`,unbound:`(unbound)`,defaultKeys:`default: {keys}`,warnings:`Warnings`},feedback:{title:`Feedback`,hint:"Sends a GitHub Discussion to the Rove repo through `gh`. Requires `gh auth login`; category defaults to Feedback.",titleLabel:`title`,titlePlaceholder:`Short summary`,descriptionLabel:`description`,descriptionPlaceholder:`What happened? (enter for a new line · tab to Send)`,send:`[enter] Send to GitHub Discussions`},...Vd},zh:{appearance:{enabled:`开启`,disabled:`关闭`,borderFlow:`流动渐变`,borderStill:`静止`,glyphsBraille:`盲文点`,glyphsStarburst:`星芒(需要含 Dingbats 符号区的字体)`,glyphsAscii:`ASCII`,titleShimmer:`流光`,titleStill:`静止`,preview:`工作区预览`,tasks:`任务`,terminal:`终端`,files:`文件`,testsPassed:`测试通过`,transparent:`透明背景`,opaque:`不透明背景`,modeDark:`深色`,modeLight:`浅色`,modeAuto:`自动(跟随终端)`,openHint:`按 Enter 打开选项和预览。`,chooseHint:`↑/↓ 或 j/k 预览 · enter 应用 · esc 取消`},title:`设置`,esc:`esc`,nav:{default:`j/k 选择 · h/l 切换层级 · enter 确认 · esc 关闭`,feedback:`tab 下一项 · enter 在发送项发送 · esc 关闭`},sections:{general:`通用`,autoRouting:`自动路由`,engines:`引擎`,plugins:`插件`,marketplace:`插件市场`,keys:`快捷键`,feedback:`反馈`,dev:`开发`},general:{usage:`用量`,theme:`主题`,themeMode:`明暗`,themeHint:`l 进入列表 · j/k 高亮 · enter 应用`,language:`语言`,languageHint:`Rove 界面的显示语言。l 进入列表 · j/k 高亮 · enter 应用。`,transparent:`透明背景`,transparentHint:`去掉渲染器的背景填充,让宿主终端透出来。按 enter 切换。`,on:`[x] 开`,off:`[ ] 关`,focusAccent:`聚焦强调色`,focusAccentHint:`聚焦面板标题、▌ 标记和分隔边框的颜色。`,accentPrimary:`主色(品牌强调色)`,accentSuccess:`成功色(传统绿)`,accentInfo:`信息色(冷蓝)`,appearance:`外观`,appearanceHint:`分屏面板怎么画边。`,splitStyle:`分屏面板`,workingBorder:`运行中边框`,taskColors:`任务配色`,glyphSet:`状态符号`,colorblind:`色盲友好的增删配色`,runningTitle:`运行中标题`,splitBox:`方框边框`,splitLine:`单线分隔`,splitRail:`左侧强调条`,splitRule:`顶部横线`,notifications:`通知`,notificationsHint:`后台标签完成或在审批处暂停时触发。`,toast:`Toast 弹窗`,toastHint:`右下角弹窗`,sound:`声音`,soundHint:`响铃 + 提示音 + OSC 9 桌面通知(经 SSH 直达本地)`,soundVolume:`提示音音量 — {percent}%`,soundVolumeHint:`回车循环切换;下一声提示音生效`,crossTask:`跨任务`,crossTaskHint:`你已切走的任务也通知`,finishedAlerts:`回合完成`,finishedAlertsHint:`关闭后只有审批和错误会提醒;未读标记照常`,keyHints:`键盘提示`,keyHintsHint:`状态栏提醒,以及侧栏和文件面板的首用提示。`,keyHintsShow:`显示键盘提示`,keyHintsShowHint:`重新开启会点亮已因使用而熄灭的提示`,zen:`禅模式`,zenHint:"`zen` 标记和 `prefix`+z 隐藏 Files,保留 Tasks 侧栏与 workspace。",zenDefaultOn:`启动即进入禅模式`,updates:`更新`,updatesHint:`稳定版手动发布;nightly 预览版每天从 main 自动构建。`,updateChannel:`渠道:{channel}`,updateChannelHint:"enter 切换;`rove update` 跟随它",updateChannelName:{latest:`稳定版`,nightly:`nightly 预览版`},updateTry:{latest:`[ 回到稳定版 ]`,nightly:`[ 试用 nightly 预览版 ]`},updateTryHint:`立即安装并改为跟随该渠道`,updateCheck:`[ 检查更新 ]`,updateCheckHint:`向 npm 查询最新版本`,updateCheckButton:`检查更新`,updateChecking:`检查中…`,updateOpenPage:`打开更新页`,updateTryTitle:{latest:`回到稳定版?`,nightly:`安装 nightly 预览版?`},updateTryBody:{latest:`Rove 会安装最新稳定版(可能比当前 nightly 旧),然后退出。`,nightly:"Rove 会安装今天从 main 构建的 nightly,然后退出。它更新、但测试更少;`rove update --stable` 可回到稳定版。"},railFold:`折叠后的任务栏`,railFoldHint:`任务栏从角标折叠之后显示什么。`,railFoldRow:`折叠后显示:{style}`,railFoldRowHint:`enter 切换`,railFoldGlyphs:`状态字形`,railFoldInitials:`字形 + 首字母`,railFoldHairline:`仅色带`,editor:`编辑器`,editorHint:`文件树里按 enter 用什么打开文件——支持时走编辑器 diff 模式,未安装时回退到只读预览。`,editorRow:`编辑器: < {kind} >`,editorRowHint:`auto 跟随 $VISUAL / $EDITOR,否则 nvim / vim / emacs / nano`,editorCustom:`自定义: {cmd}`,editorCustomUnset:`(未设置 — enter 编辑)`,worktree:`工作树位置`,worktreeHint:`新任务工作树的创建位置。仅对新任务生效。`,worktreeBase:`位置: < {kind} >`,worktreeBaseHint:"自定义可填 `~`、相对路径或以 `$project_dir` 开头",worktreeKindDefault:`默认 ~/.rove/worktrees`,worktreeKindNext:`项目旁边`,worktreeKindCustom:`自定义`,worktreeCustom:`自定义: {path}`,worktreeCustomUnset:`(未设置 — enter 编辑)`,worktreeBaseTitle:`自定义工作树位置(留空 = 默认;$project_dir = 项目根目录)`,worktreeBaseField:`路径`,editorCustomTitle:`自定义编辑器命令(用 {file} 代表文件路径)`,worktreeBaseInvalidTitle:`无法使用该工作树位置`,worktreeBaseTokenBody:`{token} 只能作为路径的第一段展开(如 {token}/../rove-worktrees)。保留原设置。`,worktreeBaseUnusableBody:`{path} 不可用({error})。保留原设置 —— 请选择一个可写目录。`,terminal:`终端`,terminalHint:`对修改后新打开的终端生效。`,scrollbackRow:`回滚行数: {rows} 行`,scrollbackRowHint:`100–100000 · 调大会按比例增加每次重绘的 CPU`,scrollbackTitle:`终端回滚行数(100–100000)`,scrollbackField:`行数`,scrollbackInvalidTitle:`不是数字`,scrollbackInvalidBody:`回滚行数必须是数字(如 1000)。保留原设置。`,tabStripRow:`标签栏: {mode}`,tabStripMode:{never:`关闭 — 标签在左侧树里`,multipleOnly:`仅 2 个以上标签时显示`,always:`始终显示`}},field:{command:`命令`,name:`名称`,id:`标识`},action:{save:`保存`,next:`下一步`,add:`添加`},reset:{title:`重置界面状态?`,body:`将清除 ~/.config/rove/state.json 和 ~/.rove/tasks.json 并退出 Rove —— 重新启动后会是一个干净的开始,工作会话列表为空。磁盘上的工作树和引擎会话历史不受影响。`,done:`Rove:界面状态已重置。重新启动 Rove 即可从头开始。`,failedTitle:`UI 状态未能重置`,failedBody:`无法写入设置文件。设置和任务均已保留,请稍后重新尝试重置。`},restart:{title:`重启后端?`,body:`会停掉 daemon,并以已安装的版本重新启动当前 Rove 窗口,从而让 daemon / orchestrator / 引擎的改动生效。正在运行的引擎会话由 PTY host 托管,不会中断;已打开的标签页会恢复。其他已连接的窗口会自行重连。`,done:`Rove:正在重启后端……`},stateWrite:{failedTitle:`设置未能保存`,failedBody:`{file} 写入失败({keys})。请检查目录权限和磁盘空间,再次保存。`},...Bd,...Wd,...Kd,keybindings:{title:`快捷键`,hint:`在你自己的 YAML 文件里重绑定直接按键和 prefix 组合;修改会实时加载。任意位置按 F1 查看带每个绑定 id 的实时键位表。`,configFile:`配置文件`,notCreated:` (尚未创建)`,prefixTitle:`命令层({prefix})`,prefixHint:`裸键作用于当前聚焦面板;少量单次快捷键覆盖高频 Rove 操作;{prefix} 打开命令层(第二击窗口 {timeout}ms)。Prefix 绑定保持原有的面板作用域和 modal 规则。`,tapPresentation:`点按 Prefix`,tapPresentationHint:`选择完整指南是否同时标记当前屏幕上的入口。`,tapPresentationLocal:`屏幕入口 + 完整指南(默认)`,tapPresentationGuide:`仅完整指南`,prefixDisabled:`已禁用`,fixed:`固定(不可重绑定):{ids}。`,createHint:`还没有覆盖文件。Rove 可以帮你写一份带完整注释的——在你取消注释之前不会改动任何按键。`,createFile:`[enter] 创建 keybindings.yaml`,overridesApplied:`已应用的覆盖`,none:`无`,unbound:`(已解绑)`,defaultKeys:`默认: {keys}`,warnings:`警告`},feedback:{title:`反馈`,hint:"通过 `gh` 向 Rove 仓库发一条 GitHub Discussion。需要 `gh auth login`;分类默认为 Feedback。",titleLabel:`标题`,titlePlaceholder:`简短概括`,descriptionLabel:`描述`,descriptionPlaceholder:`发生了什么?(enter 换行 · tab 跳到发送)`,send:`[enter] 发送到 GitHub Discussions`},...Hd}},Jd={en:Xn,zh:Zn};function Y(e,t){return ie(qd,e,t)}function Yd(e,t){return ie(Jd,e,t)}var Xd=`rove.prefs`,Zd={locale:`en`,theme:`claude`,themeMode:`dark`,transparent:!0,focusAccent:`primary`,splitStyle:`line`,railFold:`glyphs`,workingBorder:`flow`,taskColors:`on`,glyphSet:`braille`,colorblind:`off`,runningTitle:`shimmer`,toast:!0,sound:!0,soundVolume:.4,crossTask:!0,finishedAlerts:!0,keyHints:!0,zen:!0,editorKind:`auto`,worktreeBase:`default`,scrollbackRows:1e3,tabStrip:`never`,prefixTap:`local`,remoteProjects:!1,autoStatus:!1,dispatcher:!1};function Qd(){try{let e=JSON.parse(localStorage.getItem(Xd)??`null`);if(e&&typeof e==`object`&&`prefs`in e&&`themes`in e)return{...e,loaded:!0}}catch{}return{loaded:!1,prefs:Zd,options:{},info:{editorCustomSet:!1,worktreeCustomPath:``},themes:[],glyphSets:{}}}var $d=_(Qd());function ef(e){(e.locale===`en`||e.locale===`zh`)&&ee.set(e.locale)}ef($d.get().prefs);function tf(e){let t={loaded:!0,prefs:e.prefs,options:e.options,info:e.info,themes:e.themes,glyphSets:e.glyphSets};$d.set(t),ef(t.prefs),localStorage.setItem(Xd,JSON.stringify(t))}async function nf(e){tf(await e.request(`prefs.get`))}async function rf(e,t,n){let r=$d.get();$d.set({...r,prefs:{...r.prefs,[t]:n}}),ef($d.get().prefs);try{let r=await e.request(`prefs.set`,{key:t,value:n});tf({...$d.get(),prefs:r.prefs})}catch(e){$d.set(r),ef(r.prefs),G(e instanceof Error?e.message:String(e),`error`)}}function af(){return v($d)}function of(e,t){let n=e.options[t];return Array.isArray(n)?n:[]}function sf(e,t){return e[(e.indexOf(t)+1)%e.length]??t}var cf=[{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 lf({client:e}){let{prefs:t}=af(),[n,r]=(0,g.useState)(null),[i,a]=(0,g.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`),G(Y(`restart.done`)),r(null)}catch(e){G(On(e),`error`)}finally{a(!1)}}},s=(e,t,a,s,c)=>(0,B.jsx)(J,{title:t,hint:a,children:n===e?(0,B.jsxs)(`div`,{className:Au,children:[(0,B.jsx)(`strong`,{children:Y(`${e}.title`)}),(0,B.jsx)(`p`,{className:`text-muted`,children:R(e===`reset`?`prefs.resetBody`:`prefs.restartBody`)}),(0,B.jsxs)(`div`,{className:Dt,children:[(0,B.jsx)(`button`,{type:`button`,className:Tt,onClick:()=>r(null),children:R(`dialog.cancel`)}),(0,B.jsx)(`button`,{type:`button`,className:V({danger:c}),disabled:i,onClick:()=>void o(),children:s})]})]}):(0,B.jsx)(`button`,{type:`button`,className:gu,onClick:()=>r(e),children:(0,B.jsx)(`span`,{className:xu,children:s})})});return(0,B.jsxs)(B.Fragment,{children:[s(`reset`,Y(`dev.reset`),R(`prefs.resetHint`),R(`prefs.resetButton`),!0),s(`restart`,Y(`dev.restart`),R(`prefs.restartHint`),R(`prefs.restartButton`),!1),(0,B.jsx)(`p`,{className:`text-muted`,children:Y(`dev.doctorHint`)}),(0,B.jsx)(J,{title:Y(`dev.experimental`),children:cf.map(n=>(0,B.jsx)(wd,{label:Y(n.label),hint:Y(n.hint),checked:t[n.key],onChange:t=>void rf(e,n.key,t)},n.key))})]})}function uf(e){return e.binaryFound===void 0?{key:`settings.engines.status.checking`,tone:`unknown`}:e.binaryFound===null?{key:`settings.engines.status.unknown`,tone:`unknown`}:e.binaryFound?e.configIssue?{key:`settings.engines.status.integrationBlocked`,tone:`error`}:e.login===`no`?{key:`settings.engines.status.signIn`,tone:`attention`}:e.hooks===`outdated`?{key:`settings.engines.status.integrationOutdated`,tone:`attention`}:e.hooks===`not-installed`?{key:`settings.engines.status.integrationMissing`,tone:`attention`}:{key:`settings.engines.status.ready`,tone:`ready`}:e.commandChosen?{key:`settings.engines.status.notOnPath`,tone:`attention`}:{key:`settings.engines.status.notInstalled`,tone:`absent`}}var df=_([]),ff=3e4;function pf(e){return e.request(`skill.missing`).then(e=>df.set(e.engines),()=>{})}function mf(e){(0,g.useEffect)(()=>{let t=e.onOpen(()=>void pf(e)),n=window.setInterval(()=>void pf(e),ff);return()=>{t(),window.clearInterval(n)}},[e])}function hf(e){return e.request(`skill.install`).then(e=>{e.error&&G(Y(`engines.skill.failed`,{reason:e.error}),`error`)}).catch(e=>G(On(e),`error`)).then(()=>pf(e))}var gf=`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`,_f=`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 vf({on:e,...t}){return(0,B.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,className:gf,...t,children:(0,B.jsx)(`span`,{className:_f})})}function yf(e){return uf({binaryFound:e.binaryFound,login:e.login,hooks:e.hooks,configIssue:e.configIssue,commandChosen:e.custom||e.customized})}var bf={ready:`ready`,attention:`attention`,error:`error`,absent:`absent`,unknown:`absent`};function xf({client:e}){let[t,n]=(0,g.useState)(()=>cs(e,`engines.settings`)?.engines??null),[r,i]=(0,g.useState)(null),a=(0,g.useCallback)(()=>us(e,`engines.settings`).then(e=>n(e.engines),e=>G(On(e),`error`)),[e]);(0,g.useEffect)(()=>{a()},[a]);let o=(t,n={})=>void e.request(t,n).then(a).catch(e=>G(On(e),`error`));return t?(0,B.jsxs)(`section`,{className:`${ud} engines`,children:[(0,B.jsx)(`p`,{className:`text-muted`,children:Y(`engines.hint`)}),(0,B.jsxs)(`div`,{className:Mu,children:[(0,B.jsxs)(`div`,{className:Nu,"aria-hidden":`true`,children:[(0,B.jsx)(`span`,{children:Y(`sections.engines`)}),(0,B.jsx)(`span`,{children:Y(`engines.defaultMark`)}),(0,B.jsx)(`span`,{children:Y(`engines.available`)})]}),t.map(e=>(0,B.jsx)(Sf,{engine:e,open:r===e.id,onToggleOpen:()=>i(r===e.id?null:e.id),run:o},e.id))]}),(0,B.jsx)(Tf,{engines:t,run:o}),(0,B.jsx)(Ef,{engines:t,client:e,reload:a})]}):(0,B.jsx)(`p`,{className:bt,children:R(`preview.loading`)})}function Sf(e){let{engine:t,run:n}=e,r=(0,g.useId)(),i=yf(t);return(0,B.jsxs)(`div`,{className:Pu,children:[(0,B.jsxs)(`div`,{className:Fu,children:[(0,B.jsxs)(`button`,{type:`button`,className:Lu,"aria-expanded":e.open,"aria-controls":r,onClick:e.onToggleOpen,children:[(0,B.jsx)(ta,{right:!e.open,className:Ru(e.open)}),(0,B.jsxs)(`span`,{className:zu,children:[(0,B.jsxs)(`span`,{className:Bu(!t.enabled),children:[t.name,t.renamedFrom?(0,B.jsx)(`span`,{className:Vu,children:t.renamedFrom}):null,t.custom&&!t.renamedFrom?(0,B.jsx)(`span`,{className:Vu,children:Y(`engines.customTag`)}):null]}),(0,B.jsxs)(`span`,{className:Uu(bf[i.tone]),children:[(0,B.jsx)(`span`,{className:Wu(bf[i.tone]),"aria-hidden":`true`}),Y(i.key.slice(9))]})]})]}),(0,B.jsx)(`div`,{className:Gu,children:t.isDefault?(0,B.jsx)(`span`,{className:Ku,children:Y(`engines.defaultMark`)}):t.canBeDefault?(0,B.jsx)(`button`,{type:`button`,className:qu,"aria-label":R(`settings.engines.default`,{name:t.name}),onClick:()=>n(`engine.setDefault`,{id:t.id}),children:Y(`engines.makeDefault`)}):null}),(0,B.jsx)(vf,{on:t.enabled,"aria-label":R(`settings.engines.enabled`,{name:t.name}),onClick:()=>n(`engine.setEnabled`,{id:t.id,enabled:!t.enabled})})]}),e.open?(0,B.jsx)(wf,{id:r,engine:t,run:n}):null]})}function Cf(e){if(e.configIssue)return Y(`engines.detail.hooksBlockedHere`,{reason:e.configIssue});switch(e.hooks){case`installed`:return Y(`engines.detail.hooksInstalled`);case`outdated`:return Y(`engines.detail.hooksOutdated`);case`not-installed`:return e.binaryFound===!1?Y(`engines.detail.hooksAwaitEngine`):Y(`engines.detail.hooksMissing`);default:return Y(`engines.detail.hooksUnsupported`)}}function wf(e){let{engine:t,run:n}=e,[r,i]=(0,g.useState)(null),a=t.binaryFound===!0?Y(`engines.detail.programFound`,{binary:t.binary,path:t.binaryPath??t.binary}):t.binaryFound===!1?Y(`engines.detail.programMissing`,{binary:t.binary}):Y(`engines.detail.programUnknown`,{binary:t.binary}),o=t.login===`yes`?Y(`engines.detail.signedIn`):t.login===`no`?Y(`engines.detail.signedOut`):Y(`engines.detail.signInUnknown`),s=[Cf(t),Y(t.markers?`engines.detail.markersYes`:`engines.detail.markersNo`),Y(t.screen?`engines.detail.screenYes`:t.hooks===`installed`?`engines.detail.screenNotNeeded`:`engines.detail.screenNo`)];return(0,B.jsxs)(`div`,{id:e.id,className:Ju,children:[(0,B.jsxs)(`dl`,{className:Yu,children:[(0,B.jsx)(`dt`,{className:Xu,children:Y(`engines.detail.program`)}),(0,B.jsx)(`dd`,{className:Zu(t.binaryFound===!1),children:a}),(0,B.jsx)(`dt`,{className:Xu,children:Y(`engines.detail.signIn`)}),(0,B.jsx)(`dd`,{className:Zu(t.login===`no`),children:o}),(0,B.jsx)(`dt`,{className:Xu,children:Y(`engines.detail.reporting`)}),(0,B.jsx)(`dd`,{className:Zu(!1),children:s.map(e=>(0,B.jsx)(`span`,{className:`block`,children:e},e))}),t.skill===`unsupported`?null:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`dt`,{className:Xu,children:Y(`engines.detail.skill`)}),(0,B.jsx)(`dd`,{className:Zu(t.skill!==`installed`),children:Y(t.skill===`installed`?`engines.detail.skillInstalledHere`:t.skill===`outdated`?`engines.detail.skillOutdated`:`engines.detail.skillMissing`)})]}),t.custom?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`dt`,{className:Xu,children:Y(`engines.detail.adapter`)}),(0,B.jsx)(`dd`,{className:Zu(!1),children:t.protocol?Y(`engines.detail.adapterDeclared`,{protocol:t.protocol}):Y(`engines.detail.adapterGeneric`)})]}):null]}),r===null?(0,B.jsxs)(`div`,{className:Qu,children:[(0,B.jsx)(`button`,{type:`button`,className:ed,onClick:()=>i(t.name),children:R(`settings.engines.rename`)}),t.custom||t.customized?(0,B.jsx)(`button`,{type:`button`,className:ed,onClick:()=>n(`engine.reset`,{id:t.id}),children:t.custom?R(`settings.engines.remove`):R(`settings.engines.reset`)}):null]}):(0,B.jsxs)(`form`,{className:Qu,onSubmit:e=>{e.preventDefault(),n(`engine.rename`,{id:t.id,name:r}),i(null)},children:[(0,B.jsx)(`input`,{className:`${Et} w-full ${$u}`,autoFocus:!0,value:r,"aria-label":R(`settings.engines.rename`),placeholder:R(`settings.engines.namePlaceholder`),onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),i(null))}}),(0,B.jsx)(`button`,{type:`submit`,className:V(),children:R(`settings.engines.save`)}),(0,B.jsx)(`button`,{type:`button`,className:ed,onClick:()=>i(null),children:R(`settings.engines.cancel`)})]})]})}function Tf({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,B.jsxs)(`div`,{className:td,children:[(0,B.jsxs)(`div`,{className:nd,children:[(0,B.jsx)(`h3`,{className:rd,children:Y(`engines.integrations.title`)}),(0,B.jsx)(`span`,{className:`text-muted`,children:Y(`engines.integrations.summary`,{installed:i,total:r.length})})]}),(0,B.jsx)(`p`,{className:`text-muted`,children:Y(`engines.integrations.hint`)}),(0,B.jsxs)(`div`,{className:id,children:[a>0?(0,B.jsx)(`button`,{type:`button`,className:V({box:!0}),onClick:()=>t(`engines.hooks.install`),children:Y(`engines.integrations.install`,{count:a})}):(0,B.jsx)(`span`,{className:ad,children:Y(`engines.integrations.upToDate`)}),o>0?(0,B.jsx)(`button`,{type:`button`,className:ed,onClick:()=>t(`engines.hooks.uninstall`),children:Y(`engines.integrations.remove`,{count:o})}):null]})]})}function Ef(e){let t=e.engines.filter(e=>e.skill!==`unsupported`),n=t.filter(e=>e.skill===`installed`).length,r=t.length-n;return(0,B.jsxs)(`div`,{className:td,children:[(0,B.jsxs)(`div`,{className:nd,children:[(0,B.jsx)(`h3`,{className:rd,children:Y(`engines.skill.title`)}),t.length>0?(0,B.jsx)(`span`,{className:`text-muted`,children:Y(`engines.integrations.summary`,{installed:n,total:t.length})}):null]}),(0,B.jsx)(`p`,{className:`text-muted`,children:Y(`engines.skill.hint`)}),(0,B.jsx)(`div`,{className:id,children:r>0?(0,B.jsx)(`button`,{type:`button`,className:V({box:!0}),onClick:()=>void hf(e.client).then(e.reload),children:Y(`engines.skill.install`,{count:r})}):(0,B.jsx)(`span`,{className:ad,children:Y(t.length>0?`engines.integrations.upToDate`:`engines.skill.noEngines`)})})]})}function Df({client:e}){let[t,n]=(0,g.useState)(``),[r,i]=(0,g.useState)(``),[a,o]=(0,g.useState)(!1);return(0,B.jsxs)(`form`,{className:ud,onSubmit:a=>{a.preventDefault(),!(!t.trim()||!r.trim())&&(o(!0),e.request(`feedback.send`,{title:t.trim(),body:r}).then(e=>{G(R(`settings.feedback.sent`,{url:e.discussion?.url??``})),n(``),i(``)}).catch(e=>G(On(e),`error`)).finally(()=>o(!1)))},children:[(0,B.jsx)(`p`,{className:`text-muted`,children:R(`settings.feedback.hint`)}),(0,B.jsxs)(`label`,{className:Yt,children:[(0,B.jsx)(`span`,{className:`${H} text-muted`,children:R(`settings.feedback.titleLabel`)}),(0,B.jsx)(`input`,{className:U,value:t,onChange:e=>n(e.target.value)})]}),(0,B.jsxs)(`label`,{className:Yt,children:[(0,B.jsx)(`span`,{className:`${H} text-muted`,children:R(`settings.feedback.body`)}),(0,B.jsx)(`textarea`,{className:`${U} ${Xt}`,rows:6,value:r,onChange:e=>i(e.target.value)})]}),(0,B.jsx)(`div`,{className:Dt,children:(0,B.jsx)(`button`,{type:`submit`,className:V(),disabled:a||!t.trim()||!r.trim(),children:R(`settings.feedback.send`)})})]})}var Of=`/assets/pulse-3XJkP4CJ.wav`;function kf(e,t){return e===`error`||t}function Af(e,t){return t||e.kind!==`done`||e.turnEnd!==!0}function jf(e,t){return t&&e.silent!==!0}function Mf(e){return e===`permission_needed`?`needs_input`:e===`error`||e===`rate_limited`||e===`dead`?`error`:e===`turn_complete`?`done`:null}function Nf(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 Pf(){return window.isSecureContext&&`serviceWorker`in navigator&&`PushManager`in window&&`Notification`in window}var Ff=()=>navigator.serviceWorker.register(`sw.js`);async function If(e){if(!Pf())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 Lf(e){if(!Pf())return`unsupported`;if(await Notification.requestPermission()!==`granted`)return`blocked`;let t=await Ff();await navigator.serviceWorker.ready;let{publicKey:n}=await e.request(`push.key`),r=await t.pushManager.getSubscription();return r?.options.applicationServerKey&&Hf(r.options.applicationServerKey)!==n&&(await r.unsubscribe(),r=null),r??=await t.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:Vf(n)}),await e.request(`push.subscribe`,{subscription:r.toJSON()}),`on`}async function Rf(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 zf(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;a?await a.showNotification(`Rove — ${n}`,i):new Notification(`Rove — ${n}`,i)}function Bf(e){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)}if(!(`serviceWorker`in navigator))return()=>{};let r=t=>{let n=t.data;n?.type===`rove.openTask`&&typeof n.taskId==`string`&&n.taskId&&e.selectWhenListed(n.taskId)};return navigator.serviceWorker.addEventListener(`message`,r),()=>navigator.serviceWorker.removeEventListener(`message`,r)}function Vf(e){let t=atob(e.replace(/-/g,`+`).replace(/_/g,`/`));return Uint8Array.from(t,e=>e.charCodeAt(0))}function Hf(e){return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}var Uf={done:`✓`,needs_input:`?`,error:`✕`};function Wf(e){let t=new Audio(Of);t.volume=Math.min(1,Math.max(0,e)),t.play().catch(()=>void 0)}function Gf(e,t,n){!document.hidden||typeof Notification>`u`||Notification.permission!==`granted`||zf(e,t,n,Uf[t]).catch(()=>void 0)}function Kf(){typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission()}function qf(e){let t=new Map;for(let n of e.tasks)n.activity&&t.set(n.id,n.activity.state);return t}function Jf(e){let t=(0,g.useRef)(null);(0,g.useEffect)(()=>{let n=()=>{let n=e.tasks.get();if(!n)return;let r=qf(n),i=Nf(t.current,r,null,Mf);t.current=r;let{prefs:a}=$d.get();if(!a.crossTask)return;let o=e.selection.get().taskId,s=new Map(n.tasks.map(e=>[e.id,e.title]));for(let{key:e,kind:t}of i){if(e===o||!Af({kind:t,turnEnd:!0},a.finishedAlerts))continue;let n=s.get(e)??e;kf(t,a.toast)&&G(`${Uf[t]} ${n}`,t===`error`?`error`:`info`),jf({},a.sound)&&(Wf(a.soundVolume),Gf(e,t,n))}};return n(),e.tasks.subscribe(n)},[e])}async function Yf(e,t){let{taskId:n}=await e.client.request(`task.openScratch`);await ys(e,n,{kind:`engine`,prompt:t}),Wt()}function Xf(e,t){return e===`auto`?t?`dark`:`light`:e}function Zf(e,t,n){let r=e.find(e=>e.name===t)??e.find(e=>e.name===`claude`);return r?r[n]:null}var Qf=e=>[1,3,5].map(t=>Number.parseInt(e.slice(t,t+2),16));function $f(e){let[t=0,n=0,r=0]=Qf(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 ep(e,t){let[n=0,r=0]=[$f(e),$f(t)].sort((e,t)=>t-e);return(n+.05)/(r+.05)}var tp=4.5;function np(e,t){let n=e=>t.every(t=>ep(e,t)>=tp);if(n(e))return e;let r=Qf(e),i=$f(t[0])<.18?255:0;for(let e=.02;e<1;e+=.02){let t=r.map(t=>Math.round(t+(i-t)*e).toString(16).padStart(2,`0`)).join(``);if(n(`#${t}`))return`#${t}`}return i?`#ffffff`:`#000000`}function rp(e,t){let n=t.colorblind===`on`;return{"--paper":e.background,"--surface":e.backgroundPanel,"--inset":e.backgroundElement,"--menu":e.backgroundMenu,"--line":e.border,"--line-active":e.borderActive,"--line-subtle":e.borderSubtle,"--ink":e.text,"--muted":e.textMuted,"--subtle":np(e.diffLineNumber,[e.background,e.backgroundPanel,e.backgroundElement,e.backgroundMenu]),"--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 ip(e){return{background:e.background,foreground:e.text,cursor:e.primary,cursorAccent:e.background,selectionBackground:e.backgroundMenu,black:e.background,red:e.error,green:e.success,yellow:e.warning,blue:e.info,magenta:e.syntaxType,cyan:e.secondary,white:e.textMuted,brightBlack:e.diffLineNumber,brightRed:e.error,brightGreen:e.success,brightYellow:e.warning,brightBlue:e.info,brightMagenta:e.syntaxType,brightCyan:e.secondary,brightWhite:e.text}}var ap=_(null),op=_(null),sp=_(null);function cp({theme:e,mode:t}){let n=e[t],r=(e,t)=>({background:e,width:t});return(0,B.jsxs)(`span`,{className:_d,style:{background:n.background,borderColor:n.border},"aria-hidden":!0,children:[(0,B.jsxs)(`span`,{className:vd,style:{background:n.backgroundPanel},children:[(0,B.jsx)(`span`,{className:bd,style:r(n.primary,`70%`)}),(0,B.jsx)(`span`,{className:bd,style:r(n.textMuted,`85%`)}),(0,B.jsx)(`span`,{className:bd,style:r(n.textMuted,`55%`)})]}),(0,B.jsxs)(`span`,{className:yd,children:[(0,B.jsx)(`span`,{className:bd,style:r(n.text,`90%`)}),(0,B.jsx)(`span`,{className:bd,style:r(n.textMuted,`65%`)}),(0,B.jsx)(`span`,{className:bd,style:r(n.accent??n.primary,`40%`)}),(0,B.jsx)(`span`,{className:xd,children:[n.success,n.warning,n.error,n.info].map((e,t)=>(0,B.jsx)(`span`,{className:Sd,style:{background:e}},t))})]})]})}function lp(e){return(0,B.jsxs)(ue,{variant:`card`,"aria-pressed":e.active,className:gd(e.active),onMouseEnter:()=>op.set(e.theme),onFocus:()=>op.set(e.theme),onClick:e.onClick,children:[(0,B.jsx)(cp,{theme:e.theme,mode:e.mode}),(0,B.jsxs)(`span`,{className:Cd,children:[(0,B.jsx)(`span`,{className:`truncate text-ink`,children:e.theme.name}),e.tag&&(0,B.jsx)(`span`,{className:`text-subtle`,children:e.tag})]})]})}function up({children:e}){return(0,B.jsx)(`div`,{className:hd,onMouseLeave:()=>op.set(null),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||op.set(null)},children:e})}function dp(e){let{model:t}=e,{client:n}=t,r=v(sp),[i,a]=(0,g.useState)(null),[o,s]=(0,g.useState)(null),[c,l]=(0,g.useState)(!1);(0,g.useEffect)(()=>()=>op.set(null),[]),(0,g.useEffect)(()=>void nf(n).catch(()=>void 0),[n]),(0,g.useEffect)(()=>{sp.get()===null&&n.request(`theme.hosted`).then(e=>sp.set(e),()=>sp.set({themes:[],dir:null}))},[n]);let u=e=>{l(!1),Yf(t,R(`prefs.themeAgentPrompt`,{dir:e})).catch(()=>l(!0))},d=r?.dir??null,f=async e=>{a(e),s(null);try{await n.request(`theme.install`,{name:e}),await nf(n),await rf(n,`theme`,e)}catch{s(e)}finally{a(null)}},p=new Set(e.themes.map(e=>e.name)),m=(r?.themes??[]).filter(e=>!p.has(e.name));return(0,B.jsxs)(`fieldset`,{className:wu,children:[(0,B.jsx)(`legend`,{className:Tu,children:e.label}),(0,B.jsx)(`p`,{className:`${Su} clear-both text-muted`,children:R(`prefs.themePreviewHint`)}),(0,B.jsx)(up,{children:e.themes.map(t=>(0,B.jsx)(lp,{theme:t,mode:e.mode,active:t.name===e.value,tag:t.bundled?void 0:R(`prefs.themeUser`),onClick:()=>t.name!==e.value&&void rf(n,`theme`,t.name)},t.name))}),m.length>0&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`p`,{className:`m-0 text-meta leading-[inherit] mt-2 text-muted`,children:R(`prefs.themeMoreHint`)}),(0,B.jsx)(up,{children:m.map(t=>(0,B.jsx)(lp,{theme:t,mode:e.mode,active:!1,tag:i===t.name?R(`prefs.themeInstalling`):o===t.name?R(`prefs.themeInstallFailed`):R(`prefs.themeGet`),onClick:()=>i===null&&void f(t.name)},t.name))})]}),d&&(0,B.jsxs)(`p`,{className:`m-0 text-meta leading-[inherit] mt-2 text-muted`,children:[(0,B.jsx)(ue,{onClick:()=>u(d),children:R(`prefs.themeAgent`)}),` `,R(c?`prefs.themeAgentFailed`:`prefs.themeAgentHint`)]})]})}var fp=_({}),pp=``,mp=`(prefers-color-scheme: dark)`;function hp(e){let t=window.matchMedia(mp);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)}function gp(){return(0,g.useSyncExternalStore)(hp,()=>window.matchMedia(mp).matches)}function _p(){let e=gp();return Xf(af().prefs.themeMode,e)}function vp(e){let t=_p(),n=af();(0,g.useEffect)(()=>{if(!n.loaded||n.prefs.taskColors!==`on`)return;let r=`${n.prefs.theme}/${t}`;r!==pp&&(pp=r,fp.set({}));let i=()=>{let i=fp.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=>{pp===r&&fp.set({...fp.get(),...e.colors})}).catch(()=>void 0)};return i(),e.tasks.subscribe(i)},[e,t,n.loaded,n.prefs.taskColors,n.prefs.theme])}function yp(e){let t=af(),n=v(fp);return e&&t.prefs.taskColors===`on`?n[e]:void 0}var bp={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`},taskColors:{on:`appearance.enabled`,off:`appearance.disabled`},glyphSet:{braille:`appearance.glyphsBraille`,starburst:`appearance.glyphsStarburst`,ascii:`appearance.glyphsAscii`},colorblind:{on:`appearance.enabled`,off:`appearance.disabled`},runningTitle:{shimmer:`appearance.titleShimmer`,still:`appearance.titleStill`}},xp=[{key:`theme`,label:`general.theme`},{key:`themeMode`,label:`general.themeMode`},{key:`transparent`,label:`general.transparent`,terminalOnly:!0},{key:`focusAccent`,label:`general.focusAccent`,hint:`general.focusAccentHint`},{key:`splitStyle`,label:`general.splitStyle`,terminalOnly:!0},{key:`railFold`,label:`general.railFold`,hint:`general.railFoldHint`,terminalOnly:!0},{key:`workingBorder`,label:`general.workingBorder`},{key:`taskColors`,label:`general.taskColors`},{key:`glyphSet`,label:`general.glyphSet`},{key:`colorblind`,label:`general.colorblind`},{key:`runningTitle`,label:`general.runningTitle`}];function Sp({model:e}){let{client:t}=e,n=af(),r=_p(),i=(e,n)=>void rf(t,e,n);return(0,B.jsx)(J,{title:Y(`general.appearance`),children:xp.map(t=>{let a=[t.hint?Y(t.hint):null,t.terminalOnly?R(`prefs.terminalOnly`):null].filter(Boolean).join(` `);if(t.key===`transparent`)return(0,B.jsx)(wd,{label:Y(t.label),hint:a,checked:n.prefs.transparent,onChange:e=>i(`transparent`,e)},t.key);if(t.key===`theme`)return(0,B.jsx)(dp,{model:e,label:Y(t.label),themes:n.themes,value:n.prefs.theme,mode:r},t.key);let o=bp[t.key],s=of(n,t.key).map(e=>({value:e,label:t.key===`themeMode`&&e===`auto`?R(`prefs.modeAuto`):Y(o?.[String(e)]??String(e))}));return(0,B.jsx)(Td,{label:Y(t.label),hint:a||void 0,value:n.prefs[t.key],picks:s,onPick:e=>i(t.key,e)},t.key)})})}var Cp=`flex items-baseline justify-between`,wp=`[&_b]:mr-2.5`,Tp=`my-2.5 flex flex-col`,Ep=e=>`flex gap-3 rounded-sm px-2 py-1 text-left text-[length:var(--fs-body)] ${e?`bg-inset`:``}`,Dp=`min-w-[14ch]`,Op=`whitespace-nowrap text-[length:var(--fs-meta)] text-warning`,kp=`rail-tight:hidden`,Ap=`[&_h2]:mx-0 [&_h2]:mt-3.5 [&_h2]:mb-1 [&_h2]:text-[length:var(--fs-body)]`,jp=`max-h-[55vh] overflow-x-hidden overflow-y-auto`,Mp=`mr-auto text-[length:var(--fs-meta)]`,Np=`text-[length:var(--fs-body)] leading-[1.55] wrap-anywhere [&_h3]:mx-0 [&_h3]:mt-3 [&_h3]:mb-1.5 [&_h3]:font-sans [&_h3]:text-meta [&_h3]:font-medium [&_h3]:normal-nums [&_h3]:text-muted [&_h3:first-child]:mt-0 [&_ul]:m-0 [&_ul]:pl-4.5 [&_li+li]:mt-2 [&_p]:mx-0 [&_p]:mt-0 [&_p]:mb-2 [&_a]:text-accent [&_a]:underline [&_a]:underline-offset-2 [&_code]:rounded-sm [&_code]:bg-inset [&_code]:px-1 [&_code]:py-0 [&_code]:font-mono [&_code]:text-meta [&_code]:font-normal [&_code]:normal-nums`,Pp=`mt-3`,Fp=e=>`rounded-sm px-2 py-1.25 ${e?`bg-inset`:``}`,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,B.jsx)(`a`,{href:s,target:`_blank`,rel:`noopener noreferrer`,children:Wp(o)},i)):c===void 0?l!==void 0&&t.push((0,B.jsx)(`b`,{children:l},i)):t.push((0,B.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=Hp(e),n=[],r=[],i=()=>{r.length>0&&n.push((0,B.jsx)(`ul`,{children:r},`ul-${n.length}`)),r=[]};for(let e of t){if(e.kind===`item`){r.push((0,B.jsx)(`li`,{children:Wp(e.text)},e.id));continue}i(),n.push(e.kind===`heading`?(0,B.jsx)(`h3`,{children:e.text},e.id):(0,B.jsx)(`p`,{children:Wp(e.text)},e.id))}return i(),(0,B.jsx)(`div`,{className:Np,children:n})}var Kp=`page min-h-0 flex-1 rounded-md border-hairline border-line bg-paper px-4.5 py-3.5 focus:outline-none`,qp=`${Kp} overflow-y-auto`,Jp=`page-title mx-0 mt-0 mb-1.5 font-sans text-title font-bold normal-nums`,Yp=`flex items-baseline justify-between gap-4 [&_.page-title]:m-0`,Xp=e=>`min-w-0 truncate text-meta ${e?``:`leading-[inherit]`}`,Zp=`flex flex-wrap items-center gap-2`,Qp={row:`touch:after:-inset-x-0.75 touch:after:-inset-y-0.5`,kanban:`touch:after:-inset-x-0.75 touch:after:-top-1.5 touch:after:-bottom-1`,header:`touch:after:-inset-x-0.75 touch:after:-top-2.5 touch:after:-bottom-1.25`},$p=`mt-2.5 flex flex-col gap-1.5`,em=`mx-0 mt-2 mb-0 text-meta leading-[inherit]`,tm=e=>`flex cursor-pointer flex-col gap-0.5 rounded-sm px-2.5 py-1.5 ${e?`bg-inset`:``}`,nm=`flex min-w-0 items-baseline gap-2.5`,rm=`whitespace-nowrap text-muted`,im=`flex gap-2.5 pl-[4ch] text-meta leading-[inherit] text-muted`,am=`min-w-0 flex-1 truncate`,om=`flex flex-col px-1.5 pb-2`,sm=`relative flex flex-col px-1.5 pt-1.5 pb-0.5`,cm=e=>`flex items-center rounded-sm px-2 py-0.75 text-left touch:min-h-10 [&:hover]:bg-inset ${e?`font-bold text-ink`:`text-muted`}`,lm=`ml-auto -mr-[6.7px] w-5 text-center font-sans text-display leading-none font-normal text-accent normal-nums`,um=`mr-[7px] size-3.5 flex-none fill-none stroke-current stroke-[1.75] [stroke-linecap:round] [stroke-linejoin:round]`,dm=_(null),fm=(e,t)=>e.replace(/\{(\w+)\}/g,(e,n)=>t[n]??e),pm=e=>`https://github.com/Sma1lboy/rove/releases/tag/v${e}`;function mm(){return z()===`zh`?tr:er}function hm(e){return e.request(`update.check`,{force:!0,locale:ee.get()}).then(e=>(dm.set(e),!0),()=>!1)}function gm(){let e=mm(),t=v(dm);return t?.info?.hasUpdate?(0,B.jsxs)(`button`,{type:`button`,className:`${H} text-muted ${Op} ${ye}`,title:fm(e.chip,{version:t.info.latest}),onClick:()=>Ui(`update`),children:[`↑`,(0,B.jsxs)(`span`,{className:kp,children:[` `,t.info.latest]})]}):null}function _m({client:e}){let t=mm(),n=v(dm),[r,i]=(0,g.useState)(!1),[a,o]=(0,g.useState)(`release`),[s,c]=(0,g.useState)(null),l=(0,g.useRef)(null);(0,g.useEffect)(()=>{l.current?.focus(),hm(e).finally(()=>i(!0))},[e]);let u=n?.info??null,d=n?.current??``,f=u?.latest??d,p=u?.hasUpdate===!0,m=r&&u===null,h=r&&u!==null&&!p,_=n?.notes??[],y=_[0]?.url??(f?pm(f):null),b=[{id:`release`,key:`R`,label:t.actions.openRelease,detail:y??t.releaseUrlUnavailable},{id:`close`,key:`Q`,label:t.actions.close,detail:t.actions.closeDetail}],x=e=>{if(e===`close`)return Nt.set(null);c(y&&window.open(y,`_blank`,`noopener`)!==null?t.statusReleaseOpened:t.statusReleaseError)};return(0,B.jsxs)(`div`,{className:qp,tabIndex:0,ref:l,onKeyDown:e=>{if(e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.toLowerCase()===`c`&&!window.getSelection()?.toString())return e.preventDefault(),x(`close`);if(e.metaKey||e.ctrlKey||e.altKey)return;let t=b.findIndex(e=>e.id===a);if(e.key===`j`||e.key===`ArrowDown`)o(b[(t+1)%b.length]?.id??`close`);else if(e.key===`k`||e.key===`ArrowUp`)o(b[(t-1+b.length)%b.length]?.id??`close`);else if(e.key===`Enter`)x(a);else if(e.key===`r`)x(`release`);else if(e.key===`q`||e.key===`Escape`)x(`close`);else return;e.preventDefault()},children:[(0,B.jsxs)(`div`,{className:Cp,children:[(0,B.jsx)(`h1`,{className:Jp,children:t.pageTitle}),(0,B.jsx)(`button`,{type:`button`,className:`${Tt} mono`,onClick:()=>x(`close`),children:So()?R(`dialog.close`):t.closeHint})]}),(0,B.jsxs)(`p`,{className:`mono ${wp}`,children:[(0,B.jsx)(`span`,{className:`text-muted`,children:t.current}),` `,(0,B.jsxs)(`b`,{children:[`v`,d]}),` `,(0,B.jsx)(`span`,{className:`text-muted`,children:t.latest}),` `,m?(0,B.jsx)(`b`,{className:`text-muted`,children:t.latestUnknown}):r?(0,B.jsxs)(`b`,{className:p?`text-warning`:`text-success`,children:[`v`,f]}):(0,B.jsx)(`span`,{className:`text-muted`,children:`…`})]}),m&&(0,B.jsx)(`p`,{className:`text-muted`,children:t.registryRetry}),h&&(0,B.jsx)(`p`,{className:`text-success`,children:t.upToDate}),p&&(0,B.jsx)(`p`,{className:`mono text-muted`,children:`rove update`}),(0,B.jsx)(`div`,{className:Tp,children:b.map(e=>(0,B.jsxs)(`button`,{type:`button`,className:Ep(a===e.id),onClick:()=>x(e.id),children:[(0,B.jsxs)(`span`,{className:`mono keys-only text-accent`,children:[`[`,e.key,`]`]}),(0,B.jsx)(`span`,{className:Dp,children:e.label}),(0,B.jsx)(`span`,{className:`text-muted`,children:e.detail})]},e.id))}),s&&(0,B.jsx)(`p`,{className:`mono text-accent`,children:s}),p&&(0,B.jsx)(`p`,{className:`mono text-muted`,children:fm(t.changesSectionHeader,{from:d,to:f})}),!r&&(0,B.jsx)(`p`,{className:`text-muted`,children:t.loadingNotes}),r&&p&&_.length===0&&(0,B.jsx)(`p`,{className:`text-muted`,children:t.notesUnavailable}),_.map(e=>(0,B.jsxs)(`section`,{className:Ap,children:[(0,B.jsxs)(`h2`,{className:`mono`,children:[`v`,e.version]}),(0,B.jsx)(Gp,{body:e.body})]},e.version))]})}var vm=`rove.whatsNewSeenVersion`,ym=e=>e.split(/[.-]/).slice(0,3).map(Number),bm=(e,t)=>{let[n,r]=[ym(e),ym(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 xm(e,t){let n=localStorage.getItem(vm);localStorage.setItem(vm,t),!(!n||!bm(t,n))&&e.request(`release.notes`,{version:t.replace(/-.*$/,``),locale:ee.get()}).then(e=>W.set((0,B.jsx)(Sm,{from:n,to:t,notes:e.notes})),()=>W.set((0,B.jsx)(Sm,{from:n,to:t,notes:null})))}function Sm(e){let t=mm(),n=(0,g.useRef)(null);return(0,g.useEffect)(()=>n.current?.focus(),[]),(0,g.useEffect)(()=>{let e=e=>{e.key===`q`&&W.set(null)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,B.jsxs)(kn,{title:t.whatsNew.title,wide:!0,children:[(0,B.jsx)(`p`,{className:`text-muted`,children:fm(t.whatsNew.upgraded,{from:e.from,to:e.to})}),(0,B.jsx)(`div`,{className:jp,children:e.notes?(0,B.jsx)(Gp,{body:e.notes.body}):(0,B.jsx)(`p`,{className:`text-muted`,children:t.whatsNew.notesUnavailable})}),(0,B.jsxs)(`div`,{className:Dt,children:[(0,B.jsx)(`span`,{className:`mono text-muted ${Mp} touch:hidden!`,children:R(`whatsNew.keys`)}),(0,B.jsx)(`a`,{className:Tt,href:e.notes?.url??pm(e.to),target:`_blank`,rel:`noopener noreferrer`,children:R(`whatsNew.openRelease`)}),(0,B.jsx)(`button`,{ref:n,type:`button`,className:V(),onClick:()=>W.set(null),children:R(`whatsNew.continue`)})]})]})}function Cm({client:e}){let[t,n]=(0,g.useState)(null),[r,i]=(0,g.useState)(null);(0,g.useEffect)(()=>{If(e).then(n,()=>n(`off`))},[e]);let a=t=>{i(null),(t?Lf(e):Rf(e)).then(n,e=>i(e instanceof Error?e.message:String(e)))},o=r?R(`prefs.pushFailed`,{error:r}):R(t===`unsupported`?`prefs.pushUnsupported`:t===`blocked`?`prefs.pushBlocked`:`prefs.pushHint`);return(0,B.jsx)(wd,{label:R(`prefs.push`),hint:o,checked:t===`on`,disabled:t===null||t===`unsupported`||t===`blocked`,onChange:a})}function wm({client:e}){let t=mm(),n=v(dm),[r,i]=(0,g.useState)(`idle`),a=()=>{i(`checking`),hm(e).then(e=>i(e?`done`:`failed`))},o=n?.info??null,s=r===`failed`||r===`done`&&o===null;return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:Dt,children:[(0,B.jsx)(`button`,{type:`button`,className:V(),disabled:r===`checking`,onClick:a,children:Y(r===`checking`?`general.updateChecking`:`general.updateCheckButton`)}),r===`done`&&o?.hasUpdate&&(0,B.jsx)(`button`,{type:`button`,className:V(),onClick:()=>Ui(`update`),children:Y(`general.updateOpenPage`)})]}),r===`done`&&n&&o&&(0,B.jsxs)(`output`,{className:`block mono`,children:[(0,B.jsx)(`span`,{className:`text-muted`,children:t.current}),` `,(0,B.jsxs)(`b`,{children:[`v`,n.current]}),` `,(0,B.jsx)(`span`,{className:`text-muted`,children:t.latest}),` `,(0,B.jsxs)(`b`,{className:o.hasUpdate?`text-warning`:`text-success`,children:[`v`,o.latest]})]}),r===`done`&&o&&!o.hasUpdate&&(0,B.jsx)(`output`,{className:`block text-success`,children:t.upToDate}),r===`done`&&o?.hasUpdate&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`output`,{className:`block text-warning`,children:Tm(t.available,o.latest)}),(0,B.jsx)(`p`,{className:`mono text-muted`,children:`rove update`})]}),s&&(0,B.jsx)(`output`,{className:`block text-muted`,children:t.latestUnknown})]})}var Tm=(e,t)=>e.replace(`{version}`,t),Em=[{value:`en`,label:`English`},{value:`zh`,label:`中文`}],Dm={default:`general.worktreeKindDefault`,nextToProject:`general.worktreeKindNext`,custom:`general.worktreeKindCustom`};function Om({model:e}){let{client:t}=e,n=af(),{prefs:r,info:i}=n,a=()=>$d.get().prefs,o=(e,n)=>void rf(t,e,n),[s,c]=(0,g.useState)(()=>cs(t,`daemon.info`)??null);(0,g.useEffect)(()=>{us(t,`daemon.info`).then(c,()=>c(null))},[t]);let l=()=>{let e=a().worktreeBase;return e==="default"?`nextToProject`:e===`nextToProject`&&i.worktreeCustomPath?`custom`:`default`};return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Td,{label:Y(`general.language`),hint:R(`prefs.languageHint`),value:r.locale,picks:Em,onPick:e=>o(`locale`,e)}),(0,B.jsx)(Sp,{model:e}),(0,B.jsxs)(J,{title:Y(`general.notifications`),hint:Y(`general.notificationsHint`),children:[(0,B.jsx)(wd,{label:Y(`general.toast`),checked:r.toast,onChange:e=>o(`toast`,e)}),(0,B.jsx)(wd,{label:Y(`general.sound`),hint:R(`prefs.soundHint`),checked:r.sound,onChange:e=>{e&&Kf(),o(`sound`,e)}}),(0,B.jsx)(Ed,{label:Y(`general.soundVolume`,{percent:Math.round(r.soundVolume*100)}),hint:R(`prefs.soundVolumeHint`),onCycle:()=>{let e=sf(of(n,`soundVolume`),a().soundVolume);a().sound&&Wf(e),o(`soundVolume`,e)}}),(0,B.jsx)(wd,{label:Y(`general.crossTask`),hint:Y(`general.crossTaskHint`),checked:r.crossTask,onChange:e=>o(`crossTask`,e)}),(0,B.jsx)(wd,{label:Y(`general.finishedAlerts`),hint:Y(`general.finishedAlertsHint`),checked:r.finishedAlerts,onChange:e=>o(`finishedAlerts`,e)}),(0,B.jsx)(Cm,{client:t})]}),(0,B.jsx)(J,{title:Y(`general.keyHints`),children:(0,B.jsx)(wd,{label:Y(`general.keyHintsShow`),hint:Y(`general.keyHintsShowHint`),checked:r.keyHints,onChange:e=>o(`keyHints`,e)})}),(0,B.jsx)(J,{title:Y(`general.zen`),hint:R(`prefs.zenHint`),children:(0,B.jsx)(wd,{label:Y(`general.zenDefaultOn`),checked:r.zen,onChange:e=>o(`zen`,e)})}),(0,B.jsxs)(J,{title:Y(`general.editor`),hint:Y(`general.editorHint`),children:[(0,B.jsx)(Ed,{label:Y(`general.editorRow`,{kind:r.editorKind}),hint:Y(`general.editorRowHint`),onCycle:()=>o(`editorKind`,sf(of(n,`editorKind`),a().editorKind))}),(0,B.jsx)(Dd,{label:Y(`general.editorCustom`,{cmd:i.editorCustomSet?R(`prefs.editorCustomSet`):Y(`general.editorCustomUnset`)}),note:R(`prefs.editInTui`)})]}),(0,B.jsxs)(J,{title:Y(`general.worktree`),hint:Y(`general.worktreeHint`),children:[(0,B.jsx)(Ed,{label:Y(`general.worktreeBase`,{kind:Y(Dm[r.worktreeBase])}),hint:Y(`general.worktreeBaseHint`),onCycle:()=>o(`worktreeBase`,l())}),(0,B.jsx)(Dd,{label:Y(`general.worktreeCustom`,{path:i.worktreeCustomPath||Y(`general.worktreeCustomUnset`)}),note:R(`prefs.editInTui`)})]}),(0,B.jsxs)(J,{title:Y(`general.terminal`),hint:Y(`general.terminalHint`),children:[(0,B.jsx)(km,{client:t}),(0,B.jsx)(Ed,{label:Y(`general.tabStripRow`,{mode:Y(`general.tabStripMode.${r.tabStrip}`)}),onCycle:()=>o(`tabStrip`,sf(of(n,`tabStrip`),a().tabStrip))})]}),(0,B.jsx)(J,{title:Y(`general.updates`),hint:Y(`general.updatesHint`),children:(0,B.jsx)(wm,{client:t})}),s?.daemonVersion&&(0,B.jsx)(J,{title:R(`settings.general.daemon`),children:(0,B.jsx)(`p`,{className:`mono ${s.stale?`text-warning`:`text-muted`}`,children:R(s.stale?`settings.general.daemonStale`:`settings.general.daemonCurrent`,{version:s.daemonVersion})})}),(0,B.jsx)(J,{title:R(`settings.general.browser`),hint:R(`settings.general.browserHint`),children:(0,B.jsx)(`div`,{className:Dt,children:(0,B.jsx)(`button`,{type:`button`,className:V(),onClick:()=>void Qi().then(()=>window.location.reload()),children:R(`settings.general.signOut`)})})})]})}function km({client:e}){let t=af(),n=t.options.scrollbackRows,r=n&&`min`in n?n:{min:100,max:1e5},[i,a]=(0,g.useState)(String(t.prefs.scrollbackRows));return(0,g.useEffect)(()=>a(String(t.prefs.scrollbackRows)),[t.prefs.scrollbackRows]),(0,B.jsxs)(`label`,{className:hu,children:[(0,B.jsx)(`span`,{className:yu,children:Y(`general.scrollbackTitle`)}),(0,B.jsx)(`input`,{className:`${Et} ${Eu}`,inputMode:`numeric`,value:i,"aria-label":Y(`general.scrollbackField`),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)):rf(e,`scrollbackRows`,o)},onKeyDown:e=>e.key===`Enter`&&e.currentTarget.blur()}),(0,B.jsx)(`span`,{className:`${Su} text-muted`,children:Y(`general.scrollbackRowHint`)})]})}[...Array.from({length:12},(e,t)=>`f${t+1}`)];var Am={"diff.review.cursor":`diff-review cursor is a fixed raw binding (j/k), not keymap-driven`,"diff.review.range":`diff-review range anchor is a fixed raw binding (v), not keymap-driven`,"diff.review.note":`diff-review note is a fixed raw binding (c), not keymap-driven`,"diff.review.send":`diff-review send is a fixed raw binding (s), not keymap-driven`,"diff.review.drop":`diff-review drop-note is a fixed raw binding (x), not keymap-driven`,"diff.review.reload":`preview reload is a fixed raw binding (r), not keymap-driven`};function jm(e,t){let n=`alternating [${e}, ${t}] pairs`;return{layout:n,validateCount:e=>e>=2&&e%2==0?null:`needs ${n} (an even number of chords — got ${e})`}}jm(`top (double-tap)`,`bottom`),jm(`down`,`up`),jm(`down`,`up`),jm(`down`,`up`),jm(`collapse`,`expand`),jm(`previous tab`,`next tab`);async function Mm(e){try{(await e.request(`keybindings.createFile`)).created||G(R(`keys.exists`),`error`),await yr(e)}catch(e){G(On(e),`error`)}}function Nm({model:e}){let{client:t}=e,{prefs:n}=af(),r=v(gr),[i,a]=(0,g.useState)(!1);(0,g.useEffect)(()=>void yr(t),[t]);let o=r.prefix.key??Y(`keybindings.prefixDisabled`),s=Object.keys(Am).sort();return(0,B.jsxs)(J,{title:Y(`keybindings.title`),hint:Y(`keybindings.hint`),children:[(0,B.jsxs)(`div`,{className:wu,children:[(0,B.jsx)(`span`,{className:yu,children:Y(`keybindings.configFile`)}),(0,B.jsx)(`p`,{className:`mono text-muted`,children:r.path+(r.exists?``:Y(`keybindings.notCreated`))})]}),(0,B.jsx)(Td,{label:Y(`keybindings.tapPresentation`),hint:Y(`keybindings.tapPresentationHint`),value:n.prefixTap,picks:[{value:`local`,label:Y(`keybindings.tapPresentationLocal`)},{value:`guide`,label:Y(`keybindings.tapPresentationGuide`)}],onPick:e=>void rf(t,`prefixTap`,e)}),(0,B.jsxs)(`div`,{className:wu,children:[(0,B.jsx)(`span`,{className:yu,children:Y(`keybindings.prefixTitle`,{prefix:o})}),(0,B.jsx)(`p`,{className:`${Su} text-muted`,children:Y(`keybindings.prefixHint`,{prefix:o,timeout:r.prefix.timeoutMs})})]}),r.exists?(0,B.jsxs)(`div`,{className:wu,children:[(0,B.jsx)(`span`,{className:yu,children:Y(`keybindings.overridesApplied`)}),r.applied.length===0&&(0,B.jsx)(`p`,{className:`text-muted`,children:Y(`keybindings.none`)}),r.applied.map(e=>(0,B.jsx)(`p`,{className:`mono keys-applied`,children:`${e.id} ${e.keys.length>0?e.keys.join(` / `):Y(`keybindings.unbound`)} (${Y(`keybindings.defaultKeys`,{keys:e.defaultKeys.join(` / `)})})`},e.id))]}):(0,B.jsxs)(`div`,{className:wu,children:[(0,B.jsx)(`p`,{className:`text-muted`,children:Y(`keybindings.createHint`)}),(0,B.jsx)(Ed,{label:R(`keys.createFile`),onCycle:()=>void Mm(t)})]}),r.warnings.length>0&&(0,B.jsxs)(`div`,{className:`m-0 flex min-w-0 flex-col gap-1.5 border-none border-current px-0 py-1 [&_p]:wrap-anywhere`,children:[(0,B.jsx)(`span`,{className:`text-meta leading-[inherit] text-warning`,children:Y(`keybindings.warnings`)}),r.warnings.map(e=>(0,B.jsx)(`p`,{className:`mono text-muted`,children:`! ${e}`},e))]}),r.plugins.length>0&&(0,B.jsxs)(`div`,{className:`m-0 flex min-w-0 flex-col gap-1.5 border-none border-current px-0 py-1 [&_p]:wrap-anywhere`,children:[(0,B.jsx)(`span`,{className:`text-meta leading-[inherit]`,children:R(`keys.pluginChords`)}),r.plugins.map(e=>(0,B.jsx)(`p`,{className:`mono`,children:`${e.chord} ${e.kind}:${e.target}`},e.chord))]}),(0,B.jsxs)(`p`,{className:`${Su} text-muted`,children:[(0,B.jsx)(ue,{onClick:()=>{a(!1),Yf(e,R(`keys.agentPrompt`,{path:r.path})).catch(()=>a(!0))},children:R(`keys.agent`)}),` `,R(i?`keys.agentFailed`:`keys.agentHint`)]}),(0,B.jsx)(`p`,{className:`text-muted`,children:Y(`keybindings.fixed`,{ids:s.join(`, `)})}),(0,B.jsx)(`p`,{className:`text-muted`,children:R(`prefs.keysYaml`)})]})}var Pm={kanban:`kanban`,issues:`issues`};function Fm({model:e}){let t=v(e.installedMods),[n,r]=(0,g.useState)(()=>cs(e,`builtinMods.list`)?.mods??null);if((0,g.useEffect)(()=>{us(e,`builtinMods.list`).then(e=>r(e.mods),()=>r([])),e.refreshMods()},[e]),!n||n.length===0)return null;let i=n=>{let r=!t.has(n.id);e.client.request(`builtinMod.setInstalled`,{id:n.id,installed:r}).then(()=>(!r&&Nt.get()===Pm[n.id]&&Nt.set(null),e.refreshMods())).catch(e=>G(On(e),`error`))};return(0,B.jsx)(`div`,{className:dd,children:n.map(e=>{let n=t.has(e.id);return(0,B.jsxs)(`div`,{className:fd,children:[(0,B.jsxs)(`div`,{className:pd,children:[(0,B.jsx)(`span`,{className:`engine-name`,children:e.name}),(0,B.jsx)(`span`,{className:`text-muted ${md()}`,children:`${R(n?`settings.plugins.modInstalled`:`settings.plugins.modAvailable`)}, ${e.description}`})]}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>i(e),children:R(n?`settings.plugins.uninstall`:`settings.plugins.install`)})]},e.id)})})}function Im({model:e}){let{client:t}=e,[n,r]=(0,g.useState)(()=>cs(t,`plugins.list`)?.plugins??null),i=(0,g.useCallback)(()=>us(t,`plugins.list`).then(e=>r(e.plugins),e=>G(On(e),`error`)),[t]);return(0,g.useEffect)(()=>{i()},[i]),(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Fm,{model:e}),n?n.length===0?(0,B.jsx)(`p`,{className:bt,children:R(`settings.plugins.empty`)}):(0,B.jsx)(`div`,{className:dd,children:n.map(e=>(0,B.jsxs)(`label`,{className:fd,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:e.enabled,onChange:()=>void t.request(`plugin.setEnabled`,{id:e.id,enabled:!e.enabled}).then(i).catch(e=>G(On(e),`error`))}),(0,B.jsxs)(`div`,{className:pd,children:[(0,B.jsx)(`span`,{className:`engine-name`,children:e.id}),(0,B.jsx)(`span`,{className:`mono text-muted ${md()}`,children:[e.version,e.linked?`linked`:null,e.platformOk===!1?`unsupported platform`:null].filter(Boolean).join(`, `)})]})]},e.id))}):(0,B.jsx)(`p`,{className:bt,children:R(`preview.loading`)})]})}function Lm(e){let[t,n]=(0,g.useState)(e.tier.engine),[r,i]=(0,g.useState)(e.tier.model??``),[a,o]=(0,g.useState)(e.tier.effort??``),s=e.engines.find(e=>e.id===t);return(0,B.jsxs)(`form`,{className:ku,onSubmit:n=>{n.preventDefault(),e.onSave(t,s?.takesModel?r.trim():``,a)},onKeyDown:t=>{t.key===`Escape`&&(t.stopPropagation(),e.onCancel())},children:[(0,B.jsx)(`div`,{className:Zt,children:e.engines.map(e=>(0,B.jsx)(`button`,{type:`button`,"aria-pressed":e.id===t,className:Qt(e.id===t),onClick:()=>{n(e.id),e.effortLevels.includes(a)||o(``),e.takesModel||i(``)},children:e.name},e.id))}),s&&s.effortLevels.length>0&&(0,B.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:[``,...s.effortLevels].map(e=>(0,B.jsx)(`button`,{type:`button`,"aria-pressed":e===a,className:Qt(e===a),onClick:()=>o(e),children:e||Y(`autoRouting.engineDefault`)},e||`default`))}),s?.takesModel&&(0,B.jsx)(`input`,{className:U,value:r,spellCheck:!1,placeholder:Y(`autoRouting.engineDefault`),"aria-label":R(`prefs.tierModel`),onChange:e=>i(e.target.value)}),(0,B.jsxs)(`div`,{className:Dt,children:[(0,B.jsx)(`button`,{type:`button`,className:Tt,onClick:e.onCancel,children:R(`dialog.cancel`)}),(0,B.jsx)(`button`,{type:`submit`,className:V(),children:Y(`action.save`)})]})]})}function Rm(e){return e.mode===`off`?`jev`:e.mode===`jev`&&e.canCustom?`custom`:`off`}function zm({client:e}){let[t,n]=(0,g.useState)(()=>cs(e,`autoRouting.get`)??null),[r,i]=(0,g.useState)(null),a=(0,g.useCallback)(()=>us(e,`autoRouting.get`).then(n,e=>G(On(e),`error`)),[e]);(0,g.useEffect)(()=>{a()},[a]);let o=(0,g.useRef)(null),s=(t,n)=>e.request(t,n).then(a).catch(e=>G(On(e),`error`));if(!t)return(0,B.jsx)(`p`,{className:bt,children:R(`preview.loading`)});let c=t.classifier,l=c.mode===`off`?Y(`autoRouting.classifierOff`):c.mode===`jev`?`jev`:Y(`autoRouting.classifierCustomLabel`),u=c.mode===`off`?Y(`autoRouting.classifierOffHint`):c.mode===`jev`?Y(`autoRouting.classifierJevHint`):Y(`autoRouting.classifierCustomHint`),d=c.keySource===`env`?Y(`autoRouting.keyPresentEnv`,{env:c.keyEnv??``}):c.keySource===`file`?Y(`autoRouting.keySaved`):c.keyConfigured?Y(`autoRouting.keyMissing`):Y(`autoRouting.keyCustomUnused`);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(J,{title:Y(`autoRouting.title`),hint:Y(`autoRouting.hint`),children:[!t.configured&&(0,B.jsx)(`p`,{className:`text-warning`,children:Y(`autoRouting.unconfigured`)}),(0,B.jsx)(`div`,{className:dd,children:t.tiers.map(e=>(0,B.jsxs)(`div`,{className:Du,children:[(0,B.jsxs)(`div`,{className:Ou,children:[(0,B.jsx)(`span`,{className:`engine-name`,children:Yd(`tier.${e.tier}`)}),(0,B.jsx)(`span`,{className:`mono text-muted`,children:[e.engineName,e.model??Y(`autoRouting.engineDefault`),e.effort??Y(`autoRouting.engineDefault`)].join(`, `)}),(0,B.jsx)(`button`,{type:`button`,className:`${Tt} ml-auto`,onClick:()=>i(r===e.tier?null:e.tier),children:R(`prefs.tierEdit`)})]}),(0,B.jsx)(`span`,{className:`text-muted ${md()}`,children:Yd(`tierDesc.${e.tier}`)}),(0,B.jsx)(`span`,{className:`${md()} ${e.block?`text-warning`:`text-success`}`,children:e.block?Y(`autoRouting.unavailable`,{reason:e.block}):Y(`autoRouting.ready`)}),r===e.tier&&(0,B.jsx)(Lm,{tier:e,engines:t.engines,onCancel:()=>i(null),onSave:(t,n,r)=>{i(null),s(`autoRouting.setTier`,{tier:e.tier,engine:t,model:n,effort:r})}})]},e.tier))})]}),(0,B.jsxs)(J,{title:Y(`autoRouting.classifierTitle`),hint:Y(`autoRouting.classifierHint`),children:[(0,B.jsx)(`p`,{className:c.mode===`off`?`text-muted`:`text-warning`,children:Y(`autoRouting.classifierDataFlow`)}),(0,B.jsxs)(`button`,{type:`button`,className:gu,onClick:()=>{let e=Rm({...c,mode:o.current?.next??c.mode}),t={next:e,inFlight:(o.current?.inFlight??0)+1};o.current=t,s(`autoRouting.setClassifier`,{mode:e}).then(()=>{o.current&&--o.current.inFlight===0&&(o.current=null)})},children:[(0,B.jsxs)(`span`,{className:xu,children:[Y(`autoRouting.classifierLabel`),`: `,l]}),(0,B.jsx)(`span`,{className:`${Su} text-muted`,children:u})]}),(0,B.jsx)(Dd,{label:`${Y(`autoRouting.endpointLabel`)}: ${c.endpointHost||R(`prefs.unset`)}`,note:R(`prefs.editInTui`)}),(0,B.jsx)(Dd,{label:`${Y(`autoRouting.thresholdLabel`)}: ${c.threshold.toFixed(2)}`,note:R(`prefs.editInTui`)}),(0,B.jsx)(Dd,{label:`${Y(`autoRouting.keyLabel`)}: ${d}`,note:R(`prefs.editInTui`)})]})]})}function Bm(e){return e<32||e>=127&&e<=159||e>=768&&e<=879||e>=4448&&e<=4607||e>=6832&&e<=6911||e>=7616&&e<=7679||e>=8203&&e<=8207||e>=8234&&e<=8238||e>=8288&&e<=8292||e>=8400&&e<=8447||e>=12330&&e<=12335||e>=12441&&e<=12442||e>=65024&&e<=65039||e>=65056&&e<=65071||e===65279?0:e>=4352&&e<=4447||e===9001||e===9002||e>=11904&&e<=12350||e>=12353&&e<=13311||e>=13312&&e<=19903||e>=19968&&e<=40959||e>=40960&&e<=42191||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65135||e>=65280&&e<=65376||e>=65504&&e<=65510||e===126980||e===127183||e>=127488&&e<=127743||e>=127744&&e<=129791||e>=131072&&e<=262141?2:1}function Vm(e){let t=0;for(let n of e)t+=Bm(n.codePointAt(0));return t}function Hm(e){return e>=4352?2:1}function Um(e,t,n){if(t<=0)return``;let r=0;for(let t of e)r+=n(t.codePointAt(0)??0);if(r<=t)return e;let i=0,a=``;for(let r of e){let e=n(r.codePointAt(0)??0);if(i+e>t-1)break;i+=e,a+=r}return`${a}…`}var Wm=e=>e>=95?`crit`:e>=75?`warn`:`ok`,Gm=e=>String(e).padStart(2,`0`);function Km(e,t){if(e==null||e<=t)return``;let n=new Date(e),r=`${Gm(n.getHours())}:${Gm(n.getMinutes())}`;return e-t<864e5?`→ ${r}`:`→ ${n.getMonth()+1}/${n.getDate()} ${r}`}function qm(e,t){return e.windows.map(e=>({label:e.label,percentText:`${e.percent}%`,resetText:Km(e.resetsAt,t),tone:Wm(e.percent)}))}function Jm(e,t){let n=e.windows.find(e=>e.kind===`session`)??e.windows[0];return n?{label:n.label,percentText:`${n.percent}%`,resetText:Km(n.resetsAt,t),tone:Wm(n.percent)}:null}function Ym(e,t){let n=[Vm(t===0?e.label:`· ${e.label}`),Vm(e.percentText)];return e.resetText&&n.push(Vm(e.resetText)),n.reduce((e,t)=>e+t,0)+(n.length-1)}function Xm(e){return Vm(e.vendor)+e.chips.reduce((e,t,n)=>e+Ym(t,n),0)+e.chips.length}function Zm(e){let t=[...e.usage.entries()].map(([t,n])=>({vendor:e.vendorLabel(t).toUpperCase(),snapshot:n,chips:qm(n,e.nowMs)})).filter(e=>e.chips.length>0);if(t.length===0)return null;if(!e.forceCompact){let n=t.map(e=>({vendor:e.vendor,chips:e.chips}));if(n.reduce((e,t)=>e+Xm(t),0)+(n.length-1)*2<=e.budget)return{form:`full`,vendors:n}}let n=[],r=e.budget;for(let i of t){let t=Jm(i.snapshot,e.nowMs);if(!t)continue;let a=n.length>0?2:0,o=Vm(i.vendor)+1+Vm(t.percentText);if(o+a<=r){n.push({vendor:i.vendor,percentText:t.percentText,tone:t.tone}),r-=o+a;continue}let s=r-a-1-Vm(t.percentText);s>=3&&n.push({vendor:Um(i.vendor,s,Hm),percentText:t.percentText,tone:t.tone});break}return{form:`compact`,vendors:n}}function Qm(e){if(!e)return null;let t=e.contextWindowTokens;if(t===void 0||t<=0)return null;let n=Math.min(100,Math.max(0,Math.round(e.contextTokens/t*100)));return{label:`ctx`,percentText:`${n}%${e.approximate?`~`:``}`,resetText:``,tone:Wm(n)}}function $m(e){return!e||e.inputTokens===void 0&&e.outputTokens===void 0?null:{label:`Σ`,text:eh((e.inputTokens??0)+(e.outputTokens??0))}}function eh(e){return e<1e3?String(e):e<1e6?`${Math.floor(e/1e3)}k`:`${(Math.floor(e/1e5)/10).toFixed(1)}M`}var th=1e4;function nh({percentText:e,tone:t}){let n=Math.min(100,Math.max(0,Number.parseInt(e,10)||0));return(0,B.jsx)(`span`,{className:mt(t),style:{"--fill":`${n}%`}})}function rh({client:e,taskId:t,tabId:n}){let r=v(e.conn),[i,a]=(0,g.useState)(null);(0,g.useEffect)(()=>{if(r.state!==`open`)return;let i=!0,o=()=>e.request(`usage.get`,t&&n?{taskId:t,tabId:n}:{}).then(e=>{i&&a(e)}).catch(()=>{});o();let s=window.setInterval(o,th);return()=>{i=!1,window.clearInterval(s)}},[e,r.state,t,n]);let o=Qm(i?.context),s=$m(i?.context),c=new Map((i?.usage??[]).map(e=>[e.vendor,e.name])),l=i?.usage??[],u=l.length?Zm({usage:new Map(l.map(e=>[e.vendor,{capturedAt:e.capturedAt,windows:e.windows}])),budget:1/0,nowMs:Date.now(),vendorLabel:e=>c.get(e)??e,forceCompact:!0}):null;return!o&&!s&&u?.form!==`compact`?null:(0,B.jsxs)(`div`,{className:ft,children:[o&&(0,B.jsxs)(`span`,{className:`[&>span:nth-child(n+3)]:ml-2`,children:[(0,B.jsx)(`span`,{children:o.label}),(0,B.jsx)(nh,{percentText:o.percentText,tone:o.tone}),(0,B.jsx)(`span`,{className:pt[o.tone],children:o.percentText})]}),s&&(0,B.jsxs)(`span`,{className:`[&>span:nth-child(n+3)]:ml-2`,children:[s.label,` `,s.text]}),u?.form===`compact`&&u.vendors.map(e=>(0,B.jsxs)(`span`,{className:`[&>span:nth-child(n+3)]:ml-2`,children:[e.vendor,` `,(0,B.jsx)(`span`,{className:pt[e.tone],children:e.percentText})]},e.vendor))]})}var ih=[`general`,`engines`,`connectors`,`autoRouting`,`plugins`,`keys`,`feedback`,`dev`],ah={general:e=>(0,B.jsx)(Om,{model:e.model}),engines:e=>(0,B.jsx)(xf,{client:e.client}),autoRouting:e=>(0,B.jsx)(zm,{client:e.client}),plugins:e=>(0,B.jsx)(Im,{model:e.model}),keys:e=>(0,B.jsx)(Nm,{model:e.model}),feedback:e=>(0,B.jsx)(Df,{client:e.client}),dev:e=>(0,B.jsx)(lf,{client:e.client}),connectors:e=>(0,B.jsx)(Rd,{model:e.model})};function oh({model:e,section:t=`general`}){let n=e.client;z();let[r,i]=(0,g.useState)(t),a=qi(),o=v(e.selection);return(0,B.jsxs)(kn,{title:R(`settings.title`),wide:!0,children:[a&&(0,B.jsx)(rh,{client:n,taskId:o.taskId,tabId:o.tabId}),(0,B.jsxs)(`div`,{className:od,children:[(0,B.jsx)(`nav`,{className:sd,"aria-label":R(`settings.title`),children:ih.map(e=>(0,B.jsx)(`button`,{type:`button`,className:cd(r===e),onClick:()=>i(e),children:e===`connectors`?R(`settings.sections.connectors`):Y(`sections.${e}`)},e))}),(0,B.jsx)(`div`,{className:ld,children:ah[r]({client:n,model:e})})]})]})}var sh=/LAND_CONFLICT/,ch=/MAIN_CHECKOUT_DIRTY/,lh=/SYNC_CONFLICT(?:: )?(.*)/,uh=/SYNC_WORKTREE_DIRTY(?:: )?(.*)/;function dh(e){let t=On(e);return sh.test(t)?K(`worktrees`,`land.conflict`,{files:t}):ch.test(t)?K(`worktrees`,`land.dirtyBase`):K(`worktrees`,`land.failed`,{error:t})}async function fh(e,t,n){if(t.machine){ph(e,t,t.machine.label,n);return}let r;try{r=await e.client.request(`task.landPreflight`,{taskId:t.id})}catch(e){G(K(`worktrees`,`land.failed`,{error:On(e)}),`error`);return}if(r.refusal){G(r.refusal===`MAIN_CHECKOUT_DIRTY`?K(`worktrees`,`land.dirtyBase`):K(`worktrees`,`land.failed`,{error:r.message??r.refusal}),`error`);return}let i=t.branch||t.title;W.set((0,B.jsx)(Mn,{title:K(`worktrees`,`land.confirmTitle`),body:K(`worktrees`,r.ahead===1?`land.confirmBodyOne`:`land.confirmBody`,{branch:i,landedOn:r.landedOn,commits:r.ahead??`?`}),confirmLabel:K(`worktrees`,`land.button`),onConfirm:async()=>{try{let r=await e.client.request(`task.land`,{taskId:t.id});G(K(`worktrees`,`land.done`,{branch:i,landedOn:r.landedOn,commit:r.commit.slice(0,8)})),n?.()}catch(e){throw Error(dh(e))}}}))}function ph(e,t,n,r){let i=t.branch||t.title;W.set((0,B.jsx)(Mn,{title:R(`taskops.publishTitle`),body:R(`taskops.publishBody`,{branch:i,host:n}),confirmLabel:R(`taskops.publishButton`),onConfirm:async()=>{let n=await e.client.request(`task.land`,{taskId:t.id}),a=n.published?.prUrl;a?G(R(`taskops.publishedPr`,{branch:i,url:a})):G(R(`taskops.publishedNoPr`,{branch:i,reason:hh(n.published?.prError??``)}),`error`),r?.()}}))}async function mh(e,t){try{let n=await e.client.request(`task.syncBase`,{taskId:t});G(K(`tasks`,n.alreadyCurrent?`sync.alreadyCurrent`:`sync.done`,{base:n.baseRef}))}catch(e){let t=On(e),n=lh.exec(t),r=uh.exec(t);G(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 hh(e){return e.split(`
|
|
17
|
-
`).find(e=>e.trim().length>0)?.trim()??e.trim()}async function gh(e,t,n){try{let r=await e.client.request(`task.fixChecks`,e.engineTarget(t));r.outcome===`unavailable`?G(K(`files`,`toast.ciChecksUnavailable`,{detail:hh(r.detail??``)}),`error`):r.outcome===`none`?G(K(`files`,`toast.ciNoFailingChecks`),`error`):G(n)}catch(e){G(On(e),`error`)}}async function _h(e,t){try{let n=await e.client.request(`task.openEditor`,{taskId:t});n.outcome===`noEditor`?G(K(`tasks`,`toast.noEditor`),`error`):n.outcome===`failed`&&G(K(`tasks`,`toast.openWorktreeFailed`,{label:n.label??``}),`error`)}catch(e){G(K(`tasks`,`toast.worktreeErrorGeneric`,{message:On(e)}),`error`)}}function vh(e,t){let n=e.tasks.get();return[...n?.tasks??[],...n?.archived??[]].filter(e=>e.parentTaskId===t)}function yh(e,t){let n=vh(e,t.id),r=n.length>0,i=n=>e.client.request(`task.delete`,{taskId:t.id,...n}).then(()=>{});return(0,B.jsx)(Mn,{title:r?K(`tasks`,`confirm.childrenTitle`,{title:t.title,count:String(n.length)}):K(`tasks`,t.kind===`dir`?`confirm.deleteTitleDir`:`confirm.deleteTitle`,{title:t.title}),body:r?K(`tasks`,`confirm.childrenBody`):K(`tasks`,t.kind===`dir`?`confirm.deleteBodyDir`:`confirm.deleteBodyTask`),confirmLabel:K(`tasks`,r?`confirm.childrenPromote`:`confirm.deleteConfirm`),onConfirm:()=>i({}),...r?{secondary:{label:K(`tasks`,`confirm.childrenCascade`),onConfirm:()=>i({cascade:!0})}}:{},escalate:{when:e=>e instanceof _l&&e.code===`DIRTY_WORKTREE`,label:K(`tasks`,`confirm.forceDeleteConfirm`),title:K(`tasks`,`confirm.forceDeleteTitle`,{title:t.title}),body:e=>`${K(`worktrees`,`delete.forceBody`,{branch:t.branch||t.title})}\n\n${K(`worktrees`,`delete.forceReason`,{reason:On(e).replace(`task ${t.id} `,``)})}`,run:e=>i({force:!0,...e?{cascade:!0}:{}})}})}function bh(e,t){let n=vh(e,t.id),r=n.length>0,i=Pi(t,e.tabs.get()[t.id]),a=async()=>{let{tabs:n}=await e.client.request(`task.tabs`,{taskId:t.id});for(let r of n)await e.client.request(`tab.close`,{taskId:t.id,tabId:r.id});await e.refreshTabsNow()},o,s=async t=>{for(let r of n)try{await e.client.request(`task.delete`,{taskId:r.id,cascade:!0,...t?{force:!0}:{}})}catch(e){throw o=r.title,e}await a()};return(0,B.jsx)(Mn,{title:r?K(`tasks`,`confirm.childrenTitle`,{title:i,count:String(n.length)}):K(`tasks`,`confirm.deleteTitleDir`,{title:i}),body:K(`tasks`,r?`confirm.childrenBodyMain`:`confirm.deleteBodyMain`),confirmLabel:K(`tasks`,r?`confirm.childrenKeepMain`:`confirm.deleteConfirm`),onConfirm:a,...r?{secondary:{label:K(`tasks`,`confirm.childrenCascadeMain`),onConfirm:()=>s(!1)}}:{},escalate:{when:e=>e instanceof _l&&e.code===`DIRTY_WORKTREE`,label:K(`tasks`,`confirm.forceDeleteConfirm`),title:K(`tasks`,`confirm.forceDeleteTitle`,{title:i}),body:e=>`${K(`worktrees`,`delete.forceBody`,{branch:o??i})}\n\n${On(e)}`,run:()=>s(!0)}})}async function xh(e,t){let n=t.archived!==!0,r=t.title,i=async i=>{await e.client.request(`task.archive`,{taskId:t.id,archived:n,...i?{force:!0}:{}}),G(K(`tasks`,n?`archive.done`:`archive.restored`,{title:r}))};try{await i(!1)}catch(e){if(n&&e instanceof _l&&e.code===`TASK_BUSY`){W.set((0,B.jsx)(Mn,{title:K(`tasks`,`archive.busyTitle`),body:K(`tasks`,`archive.busyBody`,{title:r}),confirmLabel:K(`tasks`,`archive.busyConfirm`),onConfirm:()=>i(!0)}));return}G(K(`tasks`,n?`archive.failed`:`archive.restoreFailed`,{error:On(e)}),`error`)}}function Sh(e,t,n){return(0,B.jsx)(Mn,{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:On(e)}))}}})}var Ch=e=>{let{taskId:t}=e.selection.get();return e.tasks.get()?.tasks.find(e=>e.id===t)??null},wh=e=>{let{taskId:t,tabId:n}=e.selection.get(),r=t?e.tabs.get()[t]?.find(e=>e.id===n):void 0;return!!r&&!ks(r.split)},Th=[{id:`app.refresh`,live:()=>Ar.get().stale,run:e=>Pr(e.client)},{id:`palette.open`,live:()=>!0,run:ou},{id:`task.new.global`,live:()=>!0,run:e=>$l(Ch(e)?.repo)},{id:`chat.tab.fork`,live:e=>!!Ch(e),run:e=>{let t=Ch(e);t&&W.set((0,B.jsx)(Cs,{model:e,taskId:t.id,context:`continue`}))}},{id:`chat.fork.new`,live:e=>!!Ch(e),run:e=>{let t=Ch(e);t&&W.set((0,B.jsx)(Cs,{model:e,taskId:t.id,destination:`fork`}))}},{id:`settings.open`,live:()=>!0,run:e=>W.set((0,B.jsx)(oh,{model:e}))},{id:`inbox.show`,live:()=>!0,run:e=>W.set((0,B.jsx)(dc,{model:e}))},{id:`focus.previous`,live:()=>!0,run:()=>Ds(-1)},{id:`focus.next`,live:()=>!0,run:()=>Ds(1)},{id:`workspace.zenToggle`,live:e=>!!Ch(e),run:()=>It.set(!It.get())},{id:`files.createPR`,live:e=>!!Ch(e),run:e=>{let t=Ch(e);t&&e.client.request(`tab.requestPR`,e.engineTarget(t.id)).then(()=>G(R(`files.prRequested`))).catch(e=>G(e instanceof Error?e.message:String(e),`error`))}},{id:`chat.tab.close`,live:e=>!!e.selection.get().tabId&&wh(e),run:e=>{let{taskId:t,tabId:n}=e.selection.get();!t||!n||e.client.request(`tab.close`,{taskId:t,tabId:n}).then(()=>e.refreshTabsNow()).catch(e=>G(e instanceof Error?e.message:String(e),`error`))}},{id:`kanban.open`,live:e=>e.installedMods.get().has(`kanban`),run:()=>Ui(`kanban`)},{id:`automations.open`,live:()=>!0,run:()=>Ui(`routines`)},{id:`workItems.open`,live:e=>e.installedMods.get().has(`issues`),run:()=>Ui(`issues`)},{id:`task.moveMode`,live:e=>!!lu(e),run:()=>{vc(!_c.get()),document.querySelector(`.rail`)?.focus()}},{id:`files.syncBase`,live:e=>lu(e)?.kind===`task`,run:e=>{let t=lu(e);t&&mh(e,t.id)}},{id:`files.fixChecks`,live:e=>!!lu(e),run:e=>{let t=lu(e);t&&gh(e,t.id,R(`taskops.fixSent`))}},{id:`task.openEditor`,live:e=>!!lu(e),run:e=>{let t=lu(e);t&&_h(e,t.id)}}];ba(()=>Th.map(e=>({id:e.id,chords:Er(e.id),prefix:!0,live:e.live,run:e.run})));function Eh(e){return va(e[0]??``)}function Dh(e,t){let n=Ta(),r=Sa().filter(t=>t.prefix&&Ca(t,n)&&t.live?.(e)!==!1);for(let e of t){let t=r.filter(t=>t.chords.includes(e)).sort((e,t)=>wa(e,n)-wa(t,n))[0];if(t)return t}}var Oh=null,kh=null;function Ah(){Oh=null,kh!==null&&window.clearTimeout(kh),kh=null;let e=rc.get();e.guide?.kind===`prefix`&&rc.set({...e,guide:null})}function jh(){if(Oh!==null){Ah();return}W.get()||xr()===null||(Oh=Date.now(),rc.set({...rc.get(),guide:{kind:`prefix`,armedAt:Oh}}),kh!==null&&window.clearTimeout(kh),kh=window.setTimeout(Ah,gr.get().prefix.timeoutMs))}function Mh(e,t){Ah();let n=typeof t==`string`?[t]:t,r=Dh(e,n);ac(Eh(n),r?.id??null),r?.run(e)}var Nh=null;function Ph(){Nh!==null&&window.clearTimeout(Nh),Nh=null;let e=rc.get();e.guide?.kind===`direct`&&rc.set({...e,guide:null})}function Fh(){Nh!==null||W.get()||(Nh=window.setTimeout(()=>{Ah(),rc.set({...rc.get(),guide:{kind:`direct`}})},400))}function Ih(e){(0,g.useEffect)(()=>{let t=t=>{if(t.key===`Control`){t.repeat||Fh();return}if(Ph(),[`Shift`,`Alt`,`Meta`].includes(t.key))return;let n=_a(t),{firstStrokes:r,timeoutMs:i}=gr.get().prefix;if(Oh!==null&&Date.now()-Oh<=i){if(t.preventDefault(),t.stopImmediatePropagation(),t.key===`Escape`)return Ah();Mh(e,n);return}Ah(),!W.get()&&n.some(e=>r.includes(e))&&(t.preventDefault(),t.stopImmediatePropagation(),jh())},n=e=>e.key===`Control`&&Ph(),r=e=>{Oh!==null&&(e.target instanceof Element&&e.target.closest(`.prefix-guide, .shortcut-badge, [data-prefix-arm]`)||Ah())};return window.addEventListener(`keydown`,t,{capture:!0}),window.addEventListener(`keyup`,n,{capture:!0}),window.addEventListener(`pointerdown`,r,{capture:!0}),window.addEventListener(`blur`,Ph),()=>{window.removeEventListener(`keydown`,t,{capture:!0}),window.removeEventListener(`keyup`,n,{capture:!0}),window.removeEventListener(`pointerdown`,r,{capture:!0}),window.removeEventListener(`blur`,Ph),Ph(),Ah()}},[e])}function Lh(e){let t=Ta(),n=new Map;for(let r of Sa()){if(!r.prefix||!Ca(r,t)||r.live?.(e)===!1)continue;let i=wa(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 Rh(e){let t=new Map(dr.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=La(e);r.set(n,[...r.get(n)??[],{action:e,strokes:t}])}return[...r].map(([e,t])=>({category:e,actions:t}))}var zh=e=>e===`prefix.moreCommands`?Ja(`moreCommandsPrefix`):Qa(e);function Bh(e){let[,t]=(0,g.useState)(0);(0,g.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 Vh({model:e}){z();let t=v(rc);v(gr),v(e.selection);let n=Date.now(),r=t.entries.filter(e=>n-e.at<nc),i=t.guide?.kind===`prefix`?t.guide.armedAt:null,a=i!==null&&n-i<tc?i+tc:null;Bh(a??(r[0]?r[0].at+nc: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?$s(Ea(e,Ta()),xr()):Lh(e);return(0,B.jsxs)(`output`,{className:`mono ${Pe}`,onMouseDown:e=>e.preventDefault(),children:[(0,B.jsxs)(`div`,{className:Ie,children:[(0,B.jsx)(`span`,{className:`text-accent`,children:n?Ja(`directLayer`):Ja(`commandLayer`,{prefix:xr()??``})}),(0,B.jsx)(`span`,{className:`keys-only text-muted`,children:Ja(n?`releaseCtrl`:`escCancel`)})]}),(0,B.jsx)(`div`,{className:Le,children:Rh(r).map(t=>(0,B.jsxs)(`div`,{className:Re,children:[(0,B.jsx)(`div`,{className:`text-accent`,children:$a(t.category)}),t.actions.map(({action:t,strokes:r})=>(0,B.jsxs)(`button`,{type:`button`,className:ze,disabled:n,onClick:()=>r[0]&&Mh(e,r[0]),children:[(0,B.jsx)(`span`,{className:Fe,children:r.map(va).join(`/`)}),(0,B.jsx)(`span`,{children:zh(t)})]},t))]},t.category))})]})}return(0,B.jsxs)(`output`,{className:Xe,children:[r.map(e=>(0,B.jsxs)(Hh,{at:e.at,children:[(0,B.jsx)(`span`,{className:`text-accent`,children:xr()}),` + `,e.stroke,` →`,` `,e.action?zh(e.action):(0,B.jsx)(`span`,{className:`text-muted`,children:`∅`})]},e.id)),i!==null&&(0,B.jsxs)(`div`,{className:Ze(!1),children:[(0,B.jsx)(`span`,{className:`text-accent`,children:xr()}),` ⋯`]})]})}function Hh({at:e,children:t}){let[n]=(0,g.useState)(Date.now),r=n-e>140,i={"--hud-out":`${e+nc-140-n}ms`};return(0,B.jsx)(`div`,{className:Ze(r),style:i,children:t})}function Uh({model:e,bindingId:t,head:n=!1}){let r=v(rc);v(gr);let i=af().prefs.prefixTap;if(r.guide?.kind!==`prefix`||i!==`local`)return null;let a=Qs({bindingId:t,reachability:Ea(e,Ta()),prefixKey:xr()});if(!a)return null;let o=Sa().find(e=>e.id===t&&e.prefix)?.chords[0];return(0,B.jsx)(`button`,{type:`button`,className:`mono ${we(n)}`,onMouseDown:e=>e.preventDefault(),onClick:t=>{t.stopPropagation(),o&&Mh(e,o)},children:a})}var Wh=[`workingBorder`,`runningTitle`,`taskColors`,`glyphSet`,`colorblind`];function Gh(e){let{client:t}=e,n=af(),r=_p(),i=v(op);vp(e),Jf(e),(0,g.useEffect)(()=>{let e=()=>void nf(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,g.useEffect)(()=>{let e=document.documentElement,t=i?i[r]:Zf(n.themes,n.prefs.theme,r),a=t?rp(t,n.prefs):{};for(let[t,n]of Object.entries(a))e.style.setProperty(t,n);e.style.colorScheme=r;for(let t of Wh)e.dataset[t]=String(n.prefs[t]);ap.set(t?ip(t):null);let o=document.querySelector(`meta[name="theme-color"]`);o||(o=document.createElement(`meta`),o.name=`theme-color`,document.head.append(o)),o.content=getComputedStyle(document.body).backgroundColor},[n,r,i]),(0,g.useEffect)(()=>{n.loaded&&It.get()!==n.prefs.zen&&It.set(n.prefs.zen)},[n.loaded,n.prefs.zen]),(0,g.useEffect)(()=>It.subscribe(()=>{It.get()!==$d.get().prefs.zen&&rf(t,`zen`,It.get())}),[t])}var Kh={sidebar:[{id:`sidebar.nav`,msg:`move`},{id:`sidebar.select`,msg:`open`}],files:[{id:`files.nav`,msg:`move`},{id:`files.hierarchy`,msg:`collapse`},{id:`files.open`,msg:`open`,always:!0},{id:`files.diff`,msg:`diff`,always:!0}]};function qh(e,t){return Kh[e].flatMap(e=>{if(t===`always`&&e.always!==!0)return[];let n=ja(e.id);return n?[{cap:n,msg:e.msg}]:[]})}var Jh=e=>`rove.web.hintUsed.${e}`,Yh=_({sidebar:localStorage.getItem(Jh(`sidebar`))===`1`});function Xh(e){Yh.get()[e]||(localStorage.setItem(Jh(e),`1`),Yh.set({...Yh.get(),[e]:!0}))}function Zh(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 Qh={entries:[],at:-1};function $h(e,t){let n=e.entries[e.at];if(n&&Zh(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 eg(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 tg=_(Qh);function ng(e){let t=Nt.get();if(t)return{kind:`page`,id:t};let n=Lt.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 rg(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 ig=!1;function ag(e){let t=!1,n=()=>{t||(t=!0,queueMicrotask(()=>{if(t=!1,ig)return;let n=ng(e);n&&tg.set($h(tg.get(),n))}))};n();let r=[e.selection.subscribe(n),Nt.subscribe(n),Lt.subscribe(n)];return()=>{for(let e of r)e()}}function og(e,t){let n=tg.get(),r=eg(n,t,t=>rg(e,t)),i=n.entries[r];i&&(ig=!0,i.kind===`task`?(Nt.set(null),Lt.set(null),e.select(i.taskId,i.tabId)):i.kind===`page`?(Lt.set(null),Ui(i.id)):(Nt.set(null),Lt.set(i.start)),tg.set({entries:n.entries,at:r}),queueMicrotask(()=>{ig=!1}))}var sg=.2,cg=[`files`,`diff`,`browser`];function lg(){return{top:{tabs:[{id:`t1`,kind:`files`}],active:`t1`},bottom:null,ratio:.5,focus:`top`,recent:[`t1`],next:2}}function ug(e){return e.bottom?[[`top`,e.top],[`bottom`,e.bottom]]:[[`top`,e.top]]}function dg(e){let t=e=>Number(e.id.slice(1));return ug(e).flatMap(([,e])=>e.tabs).sort((e,n)=>t(e)-t(n))}function fg(e,t){for(let[n,r]of ug(e)){let e=r.tabs.find(e=>e.id===t);if(e)return{tab:e,name:n,group:r}}return null}function pg(e,t){let n=dg(e).filter(e=>e.kind===t);for(let t of[...e.recent].reverse()){let e=n.find(e=>e.id===t);if(e)return e}return n[0]??null}function mg(e){return e.urls[e.at]??``}function hg(e){return e.slice(e.lastIndexOf(`/`)+1)}function gg(e){try{return new URL(e).host.replace(/^www\./,``)}catch{return e}}function _g(e,t){for(let[n,r]of ug(e))if(r.tabs.some(e=>e.kind===t))return n;return e.bottom?e.focus:`top`}function vg(e,t,n){let r=e.tabs.filter(e=>e.id!==n).map(e=>e.id);for(let e of[...t].reverse())if(r.includes(e))return e;return r[0]??null}function yg(e){let{top:t,bottom:n}=e;n&&n.tabs.length===0&&(n=null),t.tabs.length===0&&n&&([t,n]=[n,null]);let r=new Set([...t.tabs,...n?.tabs??[]].map(e=>e.id)),i=e.recent.filter(e=>r.has(e)),a=e=>e.active&&e.tabs.some(t=>t.id===e.active)?e:{...e,active:vg(e,i)};return{...e,top:a(t),bottom:n&&a(n),recent:i,focus:n?e.focus:`top`}}function bg(e,t,n){return t===`top`?{...e,top:n}:{...e,bottom:n}}function xg(e,t){let n=fg(e,t);if(!n)return e;let{group:r,name:i}=n,a=[...e.recent.filter(e=>e!==t),t];return r.active===t&&e.focus===i&&e.recent.at(-1)===t?e:{...bg(e,i,{...r,active:t}),focus:i,recent:a}}function Sg(e){let t=dg(e);if(t.length<=12)return e;let n=new Set(ug(e).map(([,e])=>e.active)),r=t.filter(e=>!n.has(e.id)).sort((t,n)=>e.recent.indexOf(t.id)-e.recent.indexOf(n.id))[0];return r?Fg(e,r.id):e}function Cg(e,t,n){let r=`t${e.next}`,i=t===`bottom`&&e.bottom?`bottom`:`top`,a=i===`bottom`&&e.bottom?e.bottom:e.top;return Sg(xg(bg({...e,next:e.next+1},i,{...a,tabs:[...a.tabs,n(r)]}),r))}var wg=e=>({id:e,kind:`browser`,urls:[],at:-1});function Tg(e,t){return Cg(e,t,e=>({id:e,kind:`files`}))}function Eg(e,t){return Cg(e,t,wg)}function Dg(e,t,n){let r=dg(e).find(e=>e.kind===`diff`&&e.path===t);return r?r.kind===`diff`&&r.scope!==n?xg(Mg(e,{...r,scope:n}),r.id):xg(e,r.id):Cg(e,_g(e,`diff`),e=>({id:e,kind:`diff`,path:t,scope:n}))}function Og(e,t){let n=dg(e).filter(e=>e.kind===`browser`),r=n.find(e=>mg(e)===t);if(r)return xg(e,r.id);let i=n.find(e=>mg(e)===``);return i?Ng(e,i.id,t):Ng(Cg(e,_g(e,`browser`),wg),`t${e.next}`,t)}function kg(e,t){let n=pg(e,t);return n?xg(e,n.id):t===`diff`?Dg(e,`.`,`working`):Cg(e,_g(e,t),e=>t===`files`?{id:e,kind:t}:wg(e))}function Ag(e){let t=e.recent.at(-1),n=t?fg(e,t):null,r=n&&n.group.active===t?t:e.top.active;return(r?fg(e,r)?.tab.kind:null)??null}function jg(e,t,n){return t&&Ag(e)===n?{panel:e,open:!1}:{panel:kg(e,n),open:!0}}function Mg(e,t){let n=e=>({...e,tabs:e.tabs.map(e=>e.id===t.id?t:e)});return{...e,top:n(e.top),bottom:e.bottom&&n(e.bottom)}}function Ng(e,t,n){let r=fg(e,t)?.tab;if(r?.kind!==`browser`||mg(r)===n)return e;let i=[...r.urls.slice(0,r.at+1),n].slice(-30);return Mg(e,{...r,urls:i,at:i.length-1})}function Pg(e,t,n){let r=fg(e,t)?.tab;return r?.kind!==`browser`||n===r.at||n<0||n>=r.urls.length?e:Mg(e,{...r,at:n})}function Fg(e,t){let n=fg(e,t);if(!n)return e;let{group:r}=n,i=r.tabs.filter(e=>e.id!==t),a=e.recent.filter(e=>e!==t),o=r.active===t?vg(r,a,t):r.active;return yg({...bg(e,n.name,{tabs:i,active:o}),recent:a})}function Ig(e,t){return dg(e).reduce((e,n)=>n.id===t?e:Fg(e,n.id),e)}function Lg(e,t,n,r){let i=fg(e,t);if(!i)return e;let a=i.group,o=a.tabs.filter(e=>e.id!==t),s=a.tabs.findIndex(e=>e.id===t);if(i.name===n){let c=Math.max(0,Math.min(o.length,(r??o.length)-+(r!==void 0&&r>s)));return xg(c===s?e:bg(e,n,{...a,tabs:[...o.slice(0,c),i.tab,...o.slice(c)]}),t)}let c=e.recent.filter(e=>e!==t),l=bg(e,i.name,{tabs:o,active:a.active===t?vg(a,c,t):a.active}),u=(n===`top`?l.top:l.bottom)?.tabs??[],d=Math.max(0,Math.min(u.length,r??u.length));return xg(yg(bg({...l,recent:c},n,{tabs:[...u.slice(0,d),i.tab,...u.slice(d)],active:t})),t)}function Rg(e,t){let n=Math.max(sg,Math.min(.8,t));return Math.abs(n-e.ratio)<.001?e:{...e,ratio:n}}function zg(e,t,n){let r=new Map(n.map(e=>[e.id,e.kind])),i=[...e.filter(e=>r.has(e)&&!t.includes(e)),...t.filter(e=>r.has(e))],a=i.filter(e=>r.get(e)===`browser`),o=new Set(a.slice(0,Math.max(0,a.length-3)).filter(e=>!t.includes(e)));return i=i.filter(e=>!o.has(e)),i}function Bg(e){if(!e||typeof e!=`object`)return null;let t=e;if(typeof t.id!=`string`||!/^t\d+$/.test(t.id))return null;if(t.kind===`files`)return{id:t.id,kind:`files`};if(t.kind===`diff`&&typeof t.path==`string`&&t.path!==``)return{id:t.id,kind:`diff`,path:t.path,scope:t.scope===`branch`?`branch`:`working`};if(t.kind===`browser`&&Array.isArray(t.urls)){let e=t.urls.filter(e=>typeof e==`string`&&e!==``).slice(-30),n=typeof t.at==`number`&&Number.isInteger(t.at)?Math.min(e.length-1,Math.max(-1,t.at)):e.length-1;return{id:t.id,kind:`browser`,urls:e,at:e.length===0?-1:Math.max(0,n)}}return null}function Vg(e,t){if(!e||typeof e!=`object`||!(`tabs`in e)||!Array.isArray(e.tabs))return null;let n=[];for(let r of e.tabs){let e=Bg(r);!e||t.has(e.id)||(t.add(e.id),n.push(e))}return{tabs:n,active:`active`in e&&typeof e.active==`string`?e.active:null}}function Hg(e){if(!e||typeof e!=`object`)return null;let t=e,n=new Set,r=Vg(t.top,n);if(!r)return null;let i=Vg(t.bottom,n),a=Math.max(0,...[...n].map(e=>Number(e.slice(1)))),o=typeof t.ratio==`number`&&Number.isFinite(t.ratio)?t.ratio:.5;return yg({top:r,bottom:i,ratio:Math.max(sg,Math.min(.8,o)),focus:t.focus===`bottom`?`bottom`:`top`,recent:Array.isArray(t.recent)?t.recent.filter(e=>typeof e==`string`):[],next:Math.max(a+1,typeof t.next==`number`&&Number.isInteger(t.next)?t.next:0)})}function Ug(e,t){let n=lg(),r=typeof t==`string`&&t!==``?t:``;if(e!==`browser`&&!r)return n;let i=Eg(n,`top`),a=r?Ng(i,`t2`,r):i;return e===`browser`?a:xg(a,`t1`)}function Wg(e){try{let t=JSON.parse(e??`{}`);return t&&typeof t==`object`&&!Array.isArray(t)?Object.entries(t):[]}catch{return[]}}function Gg(e,t,n){let r=Object.fromEntries(Object.entries(e).filter(([e])=>e!==t));r[t]=n;for(let e of Object.keys(r).slice(0,-50))delete r[e];return r}function Kg(e,t){let n={};for(let[t,r]of Wg(e)){let e=Hg(r);e&&(n[t]=e)}let r=new Map(Wg(t.tab).filter(([,e])=>cg.includes(e))),i=new Map(Wg(t.url)),a=[...new Set([...r.keys(),...i.keys()])].filter(e=>!(e in n));n={...Object.fromEntries(a.map(e=>[e,Ug(r.get(e),i.get(e))])),...n};for(let e of Object.keys(n).slice(0,-50))delete n[e];return n}var qg=[`files`,`diff`,`browser`];function Jg(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.taskId==`string`&&t.taskId!==``&&qg.includes(t.view)&&typeof t.at==`number`&&(t.url===void 0||typeof t.url==`string`)&&(t.path===void 0||typeof t.path==`string`)}function Yg(e){return e.narrow?{panel:!1,panelOpen:!1,narrow:!0}:{panel:!0,panelOpen:e.panelOpen&&!e.zen,narrow:!1}}function Xg(e,t){return{tab:e.path?`diff`:e.view,...e.view===`browser`&&e.url?{url:e.url}:{},...e.view!==`browser`&&e.path?{diff:e.path}:{},show:t.taskId===e.taskId&&!t.narrow}}function Zg(e,t){return t.url?Og(e,t.url):t.diff?Dg(e,t.diff,`working`):kg(e,t.tab)}var Qg=`rove.web.panels`,$g=`rove.web.panelTab`,e_=`rove.web.panelUrl`;function t_(){let e={tab:localStorage.getItem($g),url:localStorage.getItem(e_)},t=Kg(localStorage.getItem(Qg),e);return(e.tab!==null||e.url!==null)&&(localStorage.setItem(Qg,JSON.stringify(t)),localStorage.removeItem($g),localStorage.removeItem(e_)),t}var n_=_(t_()),r_=lg();function i_(e){return v(n_)[e]??r_}function a_(e,t){let n=n_.get()[e]??r_,r=t(n);if(r===n)return;let i=Gg(n_.get(),e,r);n_.set(i),localStorage.setItem(Qg,JSON.stringify(i))}function o_(e,t){a_(e,e=>kg(e,t)),fa.set(!0),Gi()&&ca.set(t)}function s_(e,t){let n=jg(n_.get()[e]??r_,fa.get()&&!It.get(),t);a_(e,()=>n.panel),fa.set(n.open),n.open&&It.get()&&It.set(!1)}function c_(e){a_(e.taskId,t=>Dg(t,e.path,e.scope)),fa.set(!0),Gi()&&ca.set(`diff`)}function l_(e,t){a_(e,e=>Fg(e,t));let n=ca.get();Gi()&&n!==`terminal`&&!pg(n_.get()[e]??r_,n)&&o_(e,`files`)}function u_(e,t){let n=Xg(e,{taskId:t,narrow:Gi()});a_(e.taskId,e=>Zg(e,n)),n.show&&(fa.set(!0),It.get()&&It.set(!1))}var d_={working:`info`,waiting:`warning`,error:`attention`,done:`success`,idle:`muted`},f_={prOpen:``,prMerged:``,prClosed:``};function p_(e){let t=m_(e);return{look:t,tone:d_[t]}}function m_(e){switch(e?.kind){case`busy`:case`running`:return`working`;case`needs-input`:return`waiting`;case`attention`:return e.reason===`rate_limited`?`waiting`:`error`;case`unseen`:return`done`;default:return`idle`}}function h_(e){return e.rowStatus?.kind===`needs-input`||e.rowStatus?.kind===`attention`}var g_={busy:0,attention:1,"needs-input":2,running:3,unseen:4,idle:5};function __(e){let t;for(let{rowStatus:n}of e)n&&(!t||g_[n.kind]<g_[t.kind]||n.kind===t.kind&&n.since>t.since)&&(t=n);return t}function v_(e,t,n){if(!e)return null;if(e.lifecycle===`merged`)return{glyph:f_.prMerged,tone:n?`text-muted`:`text-merged`,state:`merged`};if(e.lifecycle===`closed`)return{glyph:f_.prClosed,tone:`text-muted`,state:`closed`};if(e.lifecycle!==`open`&&e.lifecycle!==`ready_to_merge`&&e.lifecycle!==`unknown`)return null;let r=t===`conflict`?`conflict`:t===`failing`?`failing`:t===`passing`?`passing`:e.checkState===`pending`?`pending`:void 0,i=n?`text-muted`:r===`conflict`||r===`failing`?`text-error`:r===`passing`?`text-success`:`text-muted`;return{glyph:f_.prOpen,tone:i,state:`open`,...r?{checks:r}:{}}}function y_(e){return v_(e.pr,e.prChip,e.prChipStale===!0)}function b_(e){return v_(e,(e.mergeable??``).toUpperCase()===`CONFLICTING`?`conflict`:e.checkState===`failing`?`failing`:e.checkState===`passing`?`passing`:null,!1)}function x_(e){let t=e=>e.state===`open`?e.tone===`text-error`?0:1:e.state===`merged`?2:3;return[...e].sort((e,n)=>t(e)-t(n))[0]}var S_=192,C_=`rove.web.railWidth`,w_=`rove.web.railFolded`;function T_(){let e=Number(localStorage.getItem(C_));return Number.isFinite(e)&&e>0?e:null}var E_=_(T_());E_.subscribe(()=>{let e=E_.get();e===null?localStorage.removeItem(C_):localStorage.setItem(C_,String(Math.round(e)))}),E_.subscribe(qt);var D_=_(localStorage.getItem(w_)===`1`);D_.subscribe(()=>localStorage.setItem(w_,D_.get()?`1`:`0`));var O_=_(!1),k_=null;function A_(e){k_!==null&&window.clearTimeout(k_),k_=null,e?O_.set(!0):k_=window.setTimeout(()=>O_.set(!1),250)}D_.subscribe(()=>O_.set(!1)),D_.subscribe(qt);function j_(e,t=window.innerWidth){let n=Math.max(S_,t-320);return Math.max(S_,Math.min(n,Math.round(e)))}var M_=`flex-none fill-none stroke-current [stroke-linecap:round] [stroke-linejoin:round] [stroke-width:1.25]`,N_=(e={})=>`relative grid cursor-pointer place-items-center rounded-sm border-none p-0 disabled:cursor-default disabled:opacity-35 [&_svg]:fill-none [&_svg]:stroke-current [&_svg]:[stroke-linecap:round] [&_svg]:[stroke-linejoin:round] [&_svg]:[stroke-width:1.25] touch:after:absolute touch:after:-inset-x-px touch:after:-top-2 touch:after:-bottom-1.25 touch:after:content-[''] touch:first:after:-left-2 ${e.tool?`size-5.5 flex-none`:`size-6.5`} ${e.tool||e.small?`[&_svg]:size-3.5`:`[&_svg]:size-4`} ${e.on?`bg-accent-soft text-accent`:`bg-transparent text-subtle enabled:hover:bg-hover enabled:hover:text-ink`}`,P_=`absolute top-2 left-2 z-7 flex items-center gap-0.5`,F_=`[&.is-resizing_iframe]:pointer-events-none`,I_=e=>`side-panel ${ve} relative row-1 flex min-h-0 min-w-0 flex-col ${F_} ${e?`flex-1 p-0`:`pt-2 pr-1 pb-1 pl-0`}`,L_=`grid min-h-0 flex-1 grid-cols-[minmax(0,1fr)] [--divider:5px] *:col-1 ${F_}`,R_=e=>`side-head flex min-h-6.5 min-w-0 items-center gap-0.5 pb-1.5 font-mono text-meta normal-nums ${e?`px-2 pt-0`:`narrow:px-2 narrow:pt-0`}`,z_=`scrollbar-none flex min-w-0 flex-1 gap-0.5 overflow-x-auto`,B_=e=>`group/ptab relative flex max-w-40 items-center hover:text-ink data-[drop=after]:shadow-[inset_-2px_0_0_var(--accent)] data-[drop=before]:shadow-[inset_2px_0_0_var(--accent)] ${e.active?`is-active text-ink`:`text-muted`} ${e.compact&&!e.active?`min-w-0 flex-none`:`min-w-18 flex-initial`}`,V_=e=>`flex min-w-0 cursor-pointer items-center gap-1.5 border-none bg-transparent text-inherit [font:inherit] ${e?`px-1.75 py-1`:`py-1 pr-0.5 pl-2`}`,H_=`truncate`,U_=`touch:relative size-4 flex-none cursor-pointer rounded-[4px] border-none bg-transparent p-0 mr-1 font-mono text-title leading-none text-subtle opacity-0 group-hover/ptab:opacity-100 hover:bg-hover hover:text-ink focus-visible:opacity-100 [@media(hover:none)]:opacity-100 touch:after:absolute touch:after:-inset-1.5 touch:after:-left-1 touch:after:content-['']`,W_=`ml-auto flex gap-0.5`,G_=`relative row-3 cursor-row-resize touch-none before:absolute before:inset-x-0 before:top-[calc(var(--divider)/2)] before:h-px before:bg-line before:content-[''] hover:before:bg-line-active after:absolute after:inset-x-0 after:-inset-y-0.75 after:content-['']`,K_=`side-view flex min-h-0 min-w-0 flex-col [&[hidden]]:hidden`,q_=`row-2 m-auto flex max-w-[44ch] flex-col items-center gap-2.5 p-4 text-center font-mono text-meta leading-[1.5] text-subtle normal-nums`,J_=`flex min-h-0 flex-1 flex-col gap-1.5`,Y_=`flex items-center gap-0.5 [&_svg]:flex-none`,X_=`mx-0.5 min-w-0 flex-1 rounded-sm border-none bg-inset px-2 py-1 text-ink [font-size:var(--fs-meta)] focus:bg-hover focus:outline-none aria-invalid:text-muted`,Z_=`min-w-0 flex-1 rounded-sm border-none bg-[#fff]`;function Q_({edge:e,className:t,...n}){return(0,B.jsx)(`div`,{"data-grip":``,className:oe(`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 $_=400;function ev({rail:e}){z();let t=(0,g.useRef)(null),n=(0,g.useRef)(0);return(0,B.jsx)(Q_,{edge:`right`,title:R(`layout.railResize`),onPointerDown:n=>{t.current={x:n.clientX,width:e.current?.getBoundingClientRect().width??0,moved:!1},n.currentTarget.setPointerCapture(n.pointerId),Jt(!0)},onPointerMove:e=>{let n=t.current;!n||e.clientX===n.x||(n.moved=!0,E_.set(j_(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 r=Date.now();r-n.current<$_?(n.current=0,E_.set(null)):n.current=r},onLostPointerCapture:()=>Jt(!1)})}function tv({side:e}){return(0,B.jsxs)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,B.jsx)(`rect`,{x:`1.5`,y:`2.5`,width:`13`,height:`11`,rx:`2.5`}),(0,B.jsx)(`path`,{d:e===`left`?`M6 2.5v11`:`M10 2.5v11`})]})}function nv({model:e}){z();let t=v(tg),n=v(D_),r=v(e.tasks),i=t=>rg(e,t),a=R(n?`layout.railUnfold`:`layout.railFold`),o=n&&(r?.tasks??[]).some(h_);return(0,B.jsxs)(`div`,{className:P_,onMouseEnter:()=>n&&O_.get()&&A_(!0),onMouseLeave:()=>n&&O_.get()&&A_(!1),children:[(0,B.jsxs)(`button`,{type:`button`,className:N_(),title:a,"aria-label":a,onClick:()=>D_.set(!n),children:[(0,B.jsx)(tv,{side:`left`}),o&&(0,B.jsx)(`span`,{className:`absolute top-0.75 right-0.75 size-1.5 rounded-full bg-accent`})]}),(0,B.jsx)(`button`,{type:`button`,className:N_(),title:R(`layout.navBack`),"aria-label":R(`layout.navBack`),disabled:eg(t,-1,i)<0,onClick:()=>og(e,-1),children:(0,B.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,B.jsx)(`path`,{d:`M10 3.5 5.5 8l4.5 4.5`})})}),(0,B.jsx)(`button`,{type:`button`,className:N_(),title:R(`layout.navForward`),"aria-label":R(`layout.navForward`),disabled:eg(t,1,i)<0,onClick:()=>og(e,1),children:(0,B.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,B.jsx)(`path`,{d:`M6 3.5 10.5 8 6 12.5`})})})]})}var rv={terminal:`layout.narrowTerminal`,files:`layout.narrowFiles`,diff:`layout.narrowDiff`,browser:`layout.narrowBrowser`};function iv({taskId:e}){z();let t=v(ca);return(0,B.jsxs)(`div`,{className:be,children:[(0,B.jsx)(`button`,{type:`button`,className:`mono ${xe}`,onClick:Hi,children:(0,B.jsx)(`span`,{className:`text-accent`,children:`‹ ${eo(`narrowBack`)}`})}),e&&(0,B.jsx)(`span`,{className:`mono ml-auto flex gap-0.5`,role:`tablist`,children:[`terminal`,...sa].map(n=>(0,B.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":t===n,className:Se,onClick:()=>n===`terminal`?ca.set(n):o_(e,n),children:R(rv[n])},n))})]})}function av({title:e}){return z(),(0,B.jsxs)(`button`,{type:`button`,className:Sn({}),onClick:Vi,children:[(0,B.jsx)(`span`,{className:`${En} font-bold text-accent`,children:`↩`}),(0,B.jsx)(`span`,{className:Cn,children:to(`recentJump`,{title:e})})]})}function ov({pane:e}){z();let{prefs:t}=af(),n=v(Yh)[e];if(!t.keyHints)return null;let r=qh(e,n?`always`:`firstUse`);return r.length===0?null:(0,B.jsx)(`p`,{className:`mono text-muted ${Ce}`,children:(0,B.jsx)(oc,{text:r.map(e=>`${hr(e.cap)} ${Ya(`pane.${e.msg}`)}`).join(` · `)})})}var sv=(e,t)=>`${e}::${t??`tab-1`}`;function cv(e){return e.from?{key:sv(e.from.taskId,e.from.tabId),taskId:e.from.taskId,tabId:e.from.tabId}:e.routine?{key:`routine:${e.routine}`,taskId:null,tabId:null,routine:e.routine}:{key:`you`,taskId:null,tabId:null}}function lv(e){return{key:sv(e.to.taskId,e.to.tabId),taskId:e.to.taskId,tabId:e.to.tabId}}function uv(e){let t=new Map,n=new Map;for(let r of e){let e=cv(r),i=lv(r);t.has(e.key)||t.set(e.key,e),n.has(i.key)||n.set(i.key,i)}return{senders:[...t.values()],targets:[...n.values()]}}var dv={row:60,head:30,pad:8,gap:14};function fv(e,t,n){let r=new Map,i=new Set,a=[],o=new Map(n.map(e=>[e,[]])),s=0;for(let n of e){let e=t(n);if(e===void 0)r.set(n.key,s+dv.row/2),s+=dv.row;else{let t=o.get(e);t?t.push(n):o.set(e,[n])}}for(let[e,t]of o){s>0&&(s+=dv.gap);let n=s;s+=dv.head;for(let e of t)r.set(e.key,s+dv.row/2),i.add(e.key),s+=dv.row;s+=dv.pad,a.push({machine:e,top:n,height:s-n})}return{y:r,framed:i,frames:a,height:s}}function pv(e,t,n,r,i){let a=1-i;return{x:a*a*a*e.x+3*a*a*i*t.x+3*a*i*i*n.x+i*i*i*r.x,y:a*a*a*e.y+3*a*a*i*t.y+3*a*i*i*n.y+i*i*i*r.y}}function mv(e,t){let n=(e.x+t.x)/2;return[{x:n,y:e.y},{x:n,y:t.y}]}function hv(e){let[t,n]=mv(e.from,e.hubIn),[r,i]=mv(e.hubOut,e.to);return[`M${e.from.x} ${e.from.y} C${t.x} ${t.y} ${n.x} ${n.y} ${e.hubIn.x} ${e.hubIn.y}`,`M${e.hubOut.x} ${e.hubOut.y} C${r.x} ${r.y} ${i.x} ${i.y} ${e.to.x} ${e.to.y}`].join(` `)}function gv(e,t){let n=Math.min(1,Math.max(0,t));if(n<.5){let[t,r]=mv(e.from,e.hubIn);return pv(e.from,t,r,e.hubIn,n*2)}let[r,i]=mv(e.hubOut,e.to);return pv(e.hubOut,r,i,e.to,(n-.5)*2)}function _v(e){return(1-Math.cos(Math.PI*Math.min(1,Math.max(0,e))))/2}var vv=1800,yv={done:4e3,failed:1e4},bv={run:[[` o `,`/|>`,`/ \\`],[` o `,`<|\\`,` >\\`]],knock:[[` o `,` |)`,`/ \\`],[` o `,` |>`,`/ \\`]],work:[[` o_`,` |=`,`/ \\`],[`_o `,`=| `,`/ \\`]],ask:[[` o?`,`/|\\`,`/ \\`]],done:[[`\\o/`,` | `,`/ \\`]],failed:[[` `,` `,`o_/`]]};function xv(e){return e.status===`done`||e.status===`failed`}function Sv(e,t){return!xv(e)||t-e.statusAt<(yv[e.status]??0)}function Cv(e,t,n){let r=Math.min(1,Math.max(0,(t-e.at)/vv)),i=e.status===`failed`?`failed`:e.status===`done`?`done`:e.status===`asking`?`ask`:e.status===`working`?`work`:r<1?`run`:`knock`,a=i===`failed`?_v(Math.min(1,Math.max(0,(e.statusAt-e.at)/vv))):i===`run`?_v(r):1,o=bv[i];return{x:a,pose:i,sprite:o[n%o.length]??o[0]}}function wv(e,t){return e.some(e=>Sv(e,t)&&e.status!==`asking`)}function Tv(e,t=12){return e.filter(xv).slice(-t).reverse()}var Ev={title:`ROUTINES`,holdingDaemon:`keeping the daemon awake`,notHolding:`none active`,needAttention:`{count} of {total} need you ·`,paused:`paused`,newTitle:`New routine`,composerLegend:`enter create · tab fields · ←→ ↑↓ edit the focused field · esc cancel`,fieldName:`NAME`,fieldRepo:`REPO`,fieldTarget:`DELIVER TO`,fieldTargetTab:`EXISTING ENGINE TAB`,targetFresh:`New task on each run`,targetStanding:`Routine-owned standing task`,targetExisting:`Existing conversation: {task} / {tab}. Never creates or revives a session.`,fieldPrompt:`PROMPT`,fieldSchedule:`SCHEDULE (FIVE-FIELD CRON)`,namePlaceholder:`weekday dependency audit`,promptPlaceholder:`Audit dependencies and summarize risky changes.`,noProject:`Ungrouped`,cronInvalid:`not a five-field cron`,cronField:{minute:`min`,hour:`hour`,dayOfMonth:`day`,month:`month`,dayOfWeek:`weekday`},schedule:{everyDay:`every day {at}`,weekdays:`weekdays {at}`,weekends:`weekends {at}`,onWeekday:`{weekday} {at}`,everyMinute:`every minute`,everyMinutes:`every {n}m`,everyHours:`every {n}h`,hourlyAt:`hourly at :{minute}`,atClock:`at {time}`,dow:{MON:`Mondays`,TUE:`Tuesdays`,WED:`Wednesdays`,THU:`Thursdays`,FRI:`Fridays`,SAT:`Saturdays`,SUN:`Sundays`}},when:{inMinutes:`in {n}m`,inHours:`in {n}h`,inDays:`in {n}d`,minutesAgo:`{n}m ago`,hoursAgo:`{n}h ago`,now:`now`,justNow:`just now`,dateTime:`{date}, {time}`},runStatus:{dispatched:`dispatched`,revived:`revived`,skipped_cancelled:`cancelled before delivery`,skipped_precheck:`skipped (precheck)`,skipped_blocked:`skipped (task can't use it)`,skipped_missed:`skipped (missed)`,skipped_unavailable:`skipped (unavailable)`,dispatch_failed:`dispatch failed`,ran:`ran`,script_failed:`script failed`},cronNever:`valid, but never fires`,missing:{target:`Choose an existing task.`,targetTab:`Enter an existing tab id, e.g. tab-2.`,name:`Give it a name.`,repo:`Pick a project.`,prompt:`Say what it should do.`,schedule:`That schedule will not run.`},empty:`No routines scheduled.`,emptyHint:`Press n to create one.`,precheck:`precheck: {command}`,lastFailed:`last failed {when}: {reason}`,recentRuns:`RECENT RUNS`,precheckDetail:`WHY IT SKIPPED — precheck {exit} in {duration}ms`,precheckExited:`exited {code}`,precheckTimedOut:`timed out`,precheckStdout:`stdout`,precheckStderr:`stderr`,precheckNoOutput:`(no output)`,noRuns:`Not run yet.`,responses:`RESPONSES`,noResponses:"No run has reported back yet. Agents answer with `routine-respond`.",responseAwaiting:`awaiting response`,responseMissing:`no response`,noSelection:`A routine runs its prompt in a project on a schedule.`,running:`Running {name}…`,ranWith:`{name}: {status}`,latestRunNoTask:`The latest run created no task.`,runNow:`[ run now ]`,deleteTitle:`Delete routine?`,deleteBody:`{name} and its run history will be removed. Tasks it already created are untouched.`,deleteButton:`Delete`,createFailed:`Couldn't create the routine: {error}`,deleteFailed:`Couldn't delete "{name}": {error}`,enableFailed:`"{name}" stays paused: {error}`,disableFailed:`"{name}" stays enabled: {error}`,runFailed:`Couldn't run "{name}" now — schedule unchanged: {error}`},Dv={title:`例行任务`,holdingDaemon:`正在保持守护进程常驻`,notHolding:`无启用项`,needAttention:`{total} 个中有 {count} 个需要处理 ·`,paused:`已暂停`,newTitle:`新建例行任务`,composerLegend:`enter 创建 · tab 切字段 · ←→ ↑↓ 编辑当前字段 · esc 取消`,fieldName:`名称`,fieldTarget:`投递目标`,fieldTargetTab:`既有引擎标签页`,targetFresh:`每次新建任务`,targetStanding:`例行任务自有的常驻任务`,targetExisting:`既有会话:{task} / {tab}。不会创建或重启会话。`,fieldRepo:`仓库`,fieldPrompt:`提示词`,fieldSchedule:`调度(五段 cron)`,namePlaceholder:`工作日依赖审计`,promptPlaceholder:`审计依赖并总结有风险的变更。`,noProject:`未分组`,cronInvalid:`不是合法的五段 cron`,cronField:{minute:`分`,hour:`时`,dayOfMonth:`日`,month:`月`,dayOfWeek:`星期`},schedule:{everyDay:`每天{at}`,weekdays:`工作日{at}`,weekends:`周末{at}`,onWeekday:`{weekday}{at}`,everyMinute:`每分钟`,everyMinutes:`每 {n} 分钟`,everyHours:`每 {n} 小时`,hourlyAt:`每小时的 :{minute}`,atClock:`{time}`,dow:{MON:`每周一`,TUE:`每周二`,WED:`每周三`,THU:`每周四`,FRI:`每周五`,SAT:`每周六`,SUN:`每周日`}},when:{inMinutes:`{n} 分钟后`,inHours:`{n} 小时后`,inDays:`{n} 天后`,minutesAgo:`{n} 分钟前`,hoursAgo:`{n} 小时前`,now:`即将`,justNow:`刚刚`,dateTime:`{date} {time}`},runStatus:{dispatched:`已派发`,revived:`已重启会话`,skipped_cancelled:`交付前已取消`,skipped_precheck:`已跳过(预检)`,skipped_blocked:`已跳过(任务暂不能接收)`,skipped_missed:`已跳过(错过时间)`,skipped_unavailable:`已跳过(不可用)`,dispatch_failed:`派发失败`,ran:`已运行`,script_failed:`脚本失败`},cronNever:`语法合法,但永远不会触发`,missing:{target:`请选择既有任务。`,targetTab:`请输入既有标签页 ID,例如 tab-2。`,name:`起个名字。`,repo:`选一个项目。`,prompt:`说明它要做什么。`,schedule:`这个调度不会触发。`},empty:`还没有例行任务。`,emptyHint:`按 n 新建一条。`,precheck:`预检:{command}`,lastFailed:`上次失败({when}):{reason}`,recentRuns:`最近执行`,precheckDetail:`为什么跳过 —— 预检{exit},耗时 {duration}ms`,precheckExited:`退出码 {code}`,precheckTimedOut:`超时`,precheckStdout:`标准输出`,precheckStderr:`标准错误`,precheckNoOutput:`(无输出)`,noRuns:`尚未执行。`,responses:`回报`,noResponses:"还没有执行回报。agent 用 `routine-respond` 回报。",responseAwaiting:`等待回报`,responseMissing:`未回报`,noSelection:`例行任务会按调度在某个项目里跑它的提示词。`,running:`正在运行 {name}…`,ranWith:`{name}:{status}`,latestRunNoTask:`最近一次执行没有创建任务。`,runNow:`[ 立即运行 ]`,deleteTitle:`删除这条例行任务?`,deleteBody:`将删除 {name} 及其执行记录。它已经创建的任务不受影响。`,deleteButton:`删除`,createFailed:`创建例行任务失败:{error}`,deleteFailed:`删除“{name}”失败:{error}`,enableFailed:`“{name}”仍处于暂停状态:{error}`,disableFailed:`“{name}”仍处于启用状态:{error}`,runFailed:`无法立即运行“{name}”——排程未受影响:{error}`},Ov={title:`Kanban`,hint:`tab project · ←↓↑→ card · enter detail · n new · d delete · r refresh · esc close`,loading:`Loading issues…`,noRepos:"No projects yet — add one with `rove add <path>`, or file a story with `rove api issue-create`.",empty:"No issues — agents file them via `rove api issue-create`.",readFailed:"Couldn't read this project's stories: {error}. Run `rove doctor`, then reopen Kanban.",readFailedToast:`Couldn't read stories for {repo}: {error}`,columnEmpty:`No cards`,column:{backlog:`Backlog`,inProgress:`In progress`,parked:`Parked`,done:`Done`},more:`+{count} more`,attention:`{count} need you`,turnComplete:`turn done`,menu:{setStatus:`status → {status}`},detail:{status:{open:`open`,doing:`doing`,hold:`hold`,done:`done`},statusLabel:`STATUS`,created:`created {date}`,linked:`linked to a session`,titleLabel:`TITLE`,description:`DESCRIPTION`,noDescription:`No description.`,attachHint:`paste a path / ctrl+v screenshot → inserts an image placeholder`,engine:`ENGINE`,workspace:`WORKSPACE`,placement:{worktree:`New worktree task — its own workspace`,projectWorktree:`New worktree — as a chattab in the project workspace`,project:`Project checkout — a new chattab, no worktree`},jumpLabel:`AFTER START`,jump:{stay:`Stay on the board`,follow:`Jump to the session`},startLegend:`enter/ctrl+enter start · tab fields · ←→ status/engine · ↑↓ workspace · esc save & close`,sessionLabel:`SESSION`,openAction:`Open the linked session ↵`,unlinkAction:`Unlink`,openLegend:`enter open the focused action · tab fields · ←→ status · unlink returns the card to Backlog · esc save & close`,eventsLabel:`EVENTS`,eventsLoading:`Loading events…`,eventsNone:`No engine events recorded yet.`,doneNote:`Done stories have nothing left to start — set the status back to reopen one · esc save & close`,startedBackground:`Started in background: {title}`,newStory:`NEW STORY`,createLegend:`ctrl+s save · enter/ctrl+enter save & start · tab fields · esc cancel`},confirmDelete:{title:`Delete story #{id}?`,body:`“{title}” will be removed from the tracker. A linked task, branch, or worktree is left untouched.`},deleteFailed:`Couldn't delete story #{id}: {error}`,createFailed:`Couldn't create the story: {error}`,updateFailed:`Couldn't save story #{id}: {error}`,statusFailed:`Story #{id} stays in its old column: {error}`,linkFailed:`Story #{id} isn't linked to its task: {error}`,unlinkFailed:`Story #{id} is still linked: {error}`},kv={title:`看板`,hint:`tab 切项目 · ←↓↑→ 选卡片 · enter 详情 · n 新建 · d 删除 · r 刷新 · esc 关闭`,loading:`正在加载 issues…`,noRepos:"还没有项目——用 `rove add <路径>` 添加一个,或用 `rove api issue-create` 创建一个 story。",empty:"暂无 issue——agent 可通过 `rove api issue-create` 创建。",readFailed:"读取该项目的 story 失败:{error}。请运行 `rove doctor`,再重新打开看板。",readFailedToast:`读取 {repo} 的 story 失败:{error}`,columnEmpty:`暂无卡片`,column:{backlog:`待办`,inProgress:`进行中`,parked:`搁置`,done:`已完成`},more:`还有 {count} 条`,attention:`{count} 张等你处理`,turnComplete:`回合完成`,menu:{setStatus:`状态 → {status}`},detail:{status:{open:`待办`,doing:`进行中`,hold:`搁置`,done:`已完成`},statusLabel:`状态`,created:`创建于 {date}`,linked:`已关联会话`,titleLabel:`标题`,description:`描述`,noDescription:`暂无描述。`,attachHint:`粘贴路径 / ctrl+v 贴截图 → 插入图片占位行`,engine:`引擎`,workspace:`工作区`,placement:{worktree:`新建 worktree 任务——独立工作区`,projectWorktree:`新建 worktree——作为项目工作区里的 chattab`,project:`项目主目录——新开 chattab,不建 worktree`},jumpLabel:`启动后`,jump:{stay:`留在看板`,follow:`跳转到会话`},startLegend:`enter/ctrl+enter 启动 · tab 切字段 · ←→ 状态/引擎 · ↑↓ 工作区 · esc 保存关闭`,sessionLabel:`会话`,openAction:`打开关联会话 ↵`,unlinkAction:`解除关联`,openLegend:`enter 执行选中操作 · tab 切字段 · ←→ 状态 · 解除关联把卡片退回 Backlog · esc 保存关闭`,eventsLabel:`事件`,eventsLoading:`正在加载事件…`,eventsNone:`暂无引擎事件记录。`,doneNote:`已完成的 story 无需启动——改回状态即可重新打开 · esc 保存关闭`,startedBackground:`已在后台启动:{title}`,newStory:`新建 STORY`,createLegend:`ctrl+s 仅保存 · enter/ctrl+enter 保存并启动 · tab 切字段 · esc 取消`},confirmDelete:{title:`删除 story #{id}?`,body:`「{title}」将从 tracker 中移除。已关联的任务、分支、worktree 不受影响。`},deleteFailed:`删除 story #{id} 失败:{error}`,createFailed:`创建 story 失败:{error}`,updateFailed:`保存 story #{id} 失败:{error}`,statusFailed:`Story #{id} 仍留在原来的列:{error}`,linkFailed:`Story #{id} 未能关联到它的任务:{error}`,unlinkFailed:`Story #{id} 仍处于关联状态:{error}`},Av={title:`ISSUES`,noRepo:`no project`,empty:`No open issues.`,assignedFilter:`assigned to me`,starting:`Starting work on #{number}…`,startedNoEngine:`Created {title}, but its engine did not start.`,linkedChip:`→ {title}`,openingLinked:`Opening {title}…`,startFailed:`Couldn't start work on #{number}: {error}`,errorHint:{noRemote:"Add a GitHub remote (`git remote add origin <url>`) and try again, or press q / esc to close.",ghMissing:"Install the `gh` CLI and authenticate, or press q / esc to close.",auth:"Run `gh auth login`, or press q / esc to close.",fallback:`{message} · press q / esc to close`}},jv={title:`议题`,noRepo:`无项目`,empty:`没有开放的议题。`,assignedFilter:`分配给我的`,starting:`正在开始处理 #{number}…`,startedNoEngine:`已创建 {title},但引擎没有启动。`,linkedChip:`→ {title}`,openingLinked:`正在打开 {title}…`,startFailed:`开始处理 #{number} 失败:{error}`,errorHint:{noRemote:"添加 GitHub remote(`git remote add origin <url>`)后重试,或按 q / esc 关闭。",ghMissing:"安装 `gh` CLI 并登录,或按 q / esc 关闭。",auth:"执行 `gh auth login`,或按 q / esc 关闭。",fallback:`{message} · 按 q / esc 关闭`}};function Mv(){let e=z()===`zh`;return{kanban:e?kv:Ov,auto:e?Dv:Ev,items:e?jv:Av,nav:(e?Zn:Xn).nav,group:(e?Zn:Xn).group,common:e?Fn:Pn}}function Nv(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??e))}function Pv(){let{auto:e}=Mv();return(t,n)=>{let r=e;for(let e of t.replace(/^automations\./,``).split(`.`))r=r&&typeof r==`object`?Reflect.get(r,e):void 0;return typeof r==`string`?n?Nv(r,n):r:t}}function Fv(e){return e instanceof Error?e.message:String(e)}function Iv(e){return e.replace(/^\/private\//,`/`).replace(/\/+$/,``)}function Lv(e,t){let n=e.split(`/`).filter(Boolean),r=n[n.length-1]??e;return t.some(t=>t!==e&&t.split(`/`).filter(Boolean).pop()===r)&&n.length>1?`${n[n.length-2]}/${r}`:r}function Rv(...e){let t=new Set,n=[];for(let r of e.flat()){if(!r||r.startsWith(`ssh://`))continue;let e=Iv(r);t.has(e)||(t.add(e),n.push(r))}return n}function zv(e){return Rv((v(e.tasks)?.tasks??[]).filter(e=>!xi(e)).map(e=>e.repo))}function Bv(e){let t=v(e.tasks),{taskId:n}=v(e.selection);return t?.tasks.find(e=>e.id===n)?.repo}function Vv(e){let[t,n]=(0,g.useState)(0);return(0,g.useEffect)(()=>{let t=window.setInterval(()=>n(e=>e+1),e);return()=>window.clearInterval(t)},[e]),[t,(0,g.useCallback)(()=>n(e=>e+1),[])]}function Hv(e){return e instanceof HTMLElement?e.isContentEditable||[`INPUT`,`TEXTAREA`,`SELECT`].includes(e.tagName):!1}function Uv(e){let t=(0,g.useRef)(e);t.current=e,(0,g.useEffect)(()=>{let e=e=>{if(e.defaultPrevented||W.get()||At.get())return;let n=e.target instanceof HTMLElement?e.target:null;Hv(n)||n?.closest(`.rail, .side-panel, .xterm`)||e.metaKey||e.altKey||e.ctrlKey&&e.key.toLowerCase()===`c`&&window.getSelection()?.toString()||t.current(e)&&(e.preventDefault(),e.stopPropagation())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[])}function Wv(){let e=(0,g.useRef)(null);return(0,g.useEffect)(()=>e.current?.focus(),[]),e}var Gv=`text-meta leading-[inherit]`,Kv=`flex flex-col gap-4.5`,qv=`relative min-w-0 flex-[1_0_auto] overflow-hidden`,Jv=`absolute inset-0 overflow-visible`,Yv={live:`stroke-accent [stroke-dasharray:4_5] animate-dp-flow motion-reduce:animate-none`,failed:`stroke-error [stroke-dasharray:2_4]`,idle:`stroke-line`},Xv=e=>`fill-none [stroke-width:1.5] ${Yv[e]}`,Zv=e=>`absolute flex h-10.5 min-w-0 flex-col justify-center gap-px rounded-sm border-hairline border-line bg-paper px-2.5 text-left text-ink [font:inherit] ${e.plain?`cursor-default`:`cursor-pointer hover:bg-hover`}`,Qv=e=>`min-w-0 truncate text-body leading-[inherit] ${e?`text-subtle`:``}`,$v=`min-w-0 truncate ${Gv} text-subtle`,ey=e=>`absolute flex flex-col items-center justify-center rounded-md border-hairline bg-paper ${e?`border-accent`:`border-line-active`}`,ty=`text-title leading-[inherit] font-bold text-ink [&_b]:text-accent`,ny=`max-w-[calc(100%-16px)] truncate ${Gv} text-muted`,ry=`${Gv} text-subtle`,iy=`absolute rounded-md`,ay=e=>`h-7.5 truncate px-2.5 text-meta leading-[30px] ${e?`text-subtle`:`text-muted`}`,oy={knock:`text-warning`,ask:`text-warning`,done:`text-success`,failed:`text-error`},sy=e=>`pointer-events-none absolute top-0 left-0 w-6 font-mono text-meta leading-[14px] whitespace-pre [font-variant-ligatures:none] will-change-transform ${oy[e]??`text-accent`}`,cy=`absolute right-0 bottom-2.5 left-0 m-0 text-center ${Gv}`,ly=`flex flex-col gap-0.5`,uy=`m-0 mb-1`,dy=`grid w-full min-w-0 cursor-pointer grid-cols-[2ch_minmax(0,auto)_minmax(0,1fr)_auto] items-center gap-x-3 rounded-sm border-0 border-none bg-transparent px-2 py-0.75 text-left text-ink [font:inherit] hover:bg-hover touch:py-2.5`,fy=`min-w-0 truncate text-meta`,py=`min-w-0 truncate ${Gv} font-sans`,my=`text-meta`,hy={working:`text-accent`,asking:`text-warning`,failed:`text-error`,done:`text-success`},gy=e=>hy[e]??`text-muted`,_y={delivered:`→`,working:`●`,asking:`?`,done:`✓`,failed:`✗`},vy=dv.row,yy=232,by=96,xy=72,Sy=42,Cy=1080,wy=24,Ty=42,Ey=6;function Dy(){return typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches}function Oy(e){let[t,n]=(0,g.useState)(Date.now),r=wv(e,Date.now());return(0,g.useEffect)(()=>{if(!r)return;if(Dy()){let e=window.setInterval(()=>n(Date.now()),1e3);return()=>window.clearInterval(e)}let e=0,t=()=>{n(Date.now()),e=requestAnimationFrame(t)};return e=requestAnimationFrame(t),()=>cancelAnimationFrame(e)},[r]),t}function ky(){let e=(0,g.useRef)(null),[t,n]=(0,g.useState)({width:0,height:0});return(0,g.useEffect)(()=>{let t=e.current;if(!t)return;let r=new ResizeObserver(([e])=>n({width:e?.contentRect.width??0,height:e?.contentRect.height??0}));return r.observe(t),()=>r.disconnect()},[]),[e,t.width,t.height]}function Ay({model:e}){let t=z(),n=Wv(),r=v(e.dispatches),i=v(e.tasks),a=v(e.remote),o=Kc(e),s=v(e.client.conn),c=r?.rows??[],l=Oy(c),[u,d,f]=ky(),p=new Map([...i?.tasks??[],...a].map(e=>[e.id,e])),m=(t===`zh`?Zn:Xn).machine,h=v(e.tabs),g=e=>e.taskId?h[e.taskId]?.find(t=>t.id===(e.tabId??`tab-1`)):void 0;Uv(e=>e.key===`Escape`||e.key===`q`||e.ctrlKey&&e.key===`c`?(Nt.set(null),!0):!1);let _=new Set(c.filter(xv).slice(-16)),y=c.filter(e=>!xv(e)||_.has(e)),b=uv(y),x=c.filter(e=>!xv(e)).length,S=Math.min(d,Cy),C=(d-S)/2,w=Math.round(Math.min(260,Math.max(128,S*.26),(S-by-32)/2)),T=Math.max(by,Math.min(yy,S-2*w-32)),E=fv(b.targets,e=>e.taskId?p.get(e.taskId)?.machine?.id:void 0,o.map(e=>e.alias)),D=Math.max(3*vy,b.senders.length*vy,E.height,xy)+48,O=Math.max(D,f),k=(e,t)=>(O-e*vy)/2+t*vy+vy/2,A=new Map(b.senders.map((e,t)=>[e.key,k(b.senders.length,t)])),j=(O-E.height)/2,M=e=>j+(E.y.get(e)??E.height/2),N=e=>E.framed.has(e)?dv.pad:0,P=d/2,F=O/2,I=e=>({from:{x:C+w,y:A.get(cv(e).key)??F},hubIn:{x:P-T/2,y:F},hubOut:{x:P+T/2,y:F},to:{x:d-C-w+N(lv(e).key),y:M(lv(e).key)}}),L=new Map;for(let e of y){let t=`${cv(e).key}>${lv(e).key}`,n=xv(e)?e.status===`failed`&&Sv(e,l)?`failed`:`idle`:`live`,r=L.get(t);(!r||n===`live`||n===`failed`&&r.tone===`idle`)&&L.set(t,{wire:I(e),tone:n})}let ee=new Map;for(let e of y)ee.set(lv(e).key,e);let te=t=>{t.taskId&&e.select(t.taskId,t.tabId)},ne=Tv(c);return(0,B.jsxs)(`div`,{className:`${qp} ${Kv}`,tabIndex:0,ref:n,children:[(0,B.jsxs)(`div`,{className:Yp,children:[(0,B.jsx)(`h1`,{className:Jp,children:R(`dispatch.title`)}),(0,B.jsx)(`span`,{className:`mono touch:empty:hidden! text-muted ${Xp(!0)}`,children:(0,B.jsx)(oc,{text:To(R(`dispatch.hint`))})})]}),(0,B.jsx)(`div`,{className:qv,ref:u,style:{minHeight:D},children:d>0&&r!==null?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`svg`,{className:Jv,width:d,height:O,"aria-hidden":`true`,children:[...L.values()].map(({wire:e,tone:t})=>(0,B.jsx)(`path`,{d:hv(e),className:Xv(t)},hv(e)))}),b.senders.map(e=>(0,B.jsx)(Ny,{node:e,task:e.taskId?p.get(e.taskId):void 0,tab:g(e),style:{left:C,top:(A.get(e.key)??0)-Sy/2,width:w},onOpen:te},e.key)),(0,B.jsxs)(`div`,{className:`mono ${ey(x>0)}`,style:{left:P-T/2,top:F-xy/2,width:T,height:xy},title:s.hello?`${s.hello.host} v${s.hello.roveVersion}`:void 0,children:[(0,B.jsxs)(`span`,{className:ty,children:[(0,B.jsx)(`b`,{children:`[`}),` rove `,(0,B.jsx)(`b`,{children:`]`})]}),s.hello?(0,B.jsx)(`span`,{className:ny,children:s.hello.host}):null,(0,B.jsx)(`span`,{className:ry,children:x?R(`dispatch.inFlightCount`,{count:x}):R(`dispatch.idle`)})]}),E.frames.map(e=>{let t=o.find(t=>t.alias===e.machine),n=t?Vc(t,m):e.machine;return(0,B.jsx)(`div`,{className:iy,style:{right:C,top:j+e.top,width:w,height:e.height},children:(0,B.jsx)(`span`,{className:`mono ${ay(t?.state!==`online`)}`,title:Hc(e.machine,t,m),children:n})},e.machine)}),b.targets.map(e=>(0,B.jsx)(Ny,{node:e,task:e.taskId?p.get(e.taskId):void 0,tab:g(e),status:ee.get(e.key)?.status,style:{right:C+N(e.key),top:M(e.key)-Sy/2,width:w-N(e.key)*2},onOpen:te},e.key)),jy(y,l).map(e=>{let t=Cv(e,l,Math.floor(l/160)),n=gv(I(e),t.x),r=t.x>=1?n.x-wy-Ey:n.x-wy/2;return(0,B.jsx)(`span`,{className:sy(t.pose),style:{transform:`translate(${r}px, ${n.y-Ty+6}px)`},title:e.promptHead,"aria-hidden":`true`,children:t.sprite.join(`
|
|
18
|
-
`)},e.id)}),y.length===0?(0,B.jsx)(`p`,{className:`text-muted ${cy}`,children:R(`dispatch.emptyHint`)}):null]}):null}),ne.length>0?(0,B.jsxs)(`section`,{className:ly,children:[(0,B.jsx)(`h2`,{className:`${H} text-muted ${uy}`,children:R(`dispatch.recent`)}),ne.map(e=>(0,B.jsxs)(`button`,{type:`button`,className:dy,onClick:()=>te(lv(e)),title:e.promptHead,children:[(0,B.jsx)(`span`,{className:`mono ${gy(e.status)}`,children:_y[e.status]}),(0,B.jsxs)(`span`,{className:`mono ${fy}`,children:[My(cv(e),p),` → `,My(lv(e),p)]}),(0,B.jsxs)(`span`,{className:`text-muted ${py}`,children:[e.status===`failed`&&e.reason?`${e.reason}: `:``,e.promptHead]}),(0,B.jsx)(`span`,{className:`mono text-muted ${my}`,children:co(l-e.statusAt)})]},e.id))]}):null]})}function jy(e,t){let n=new Map,r=[];for(let i of e)Sv(i,t)&&(Cv(i,t,0).x<1?r.push(i):n.set(lv(i).key,i));return[...r,...n.values()]}function My(e,t){return e.routine?`⟳ ${e.routine}`:e.taskId?t.get(e.taskId)?.title||e.taskId:R(`dispatch.you`)}function Ny({node:e,task:t,tab:n,status:r,style:i,onOpen:a}){let o=e.routine?e.routine:e.taskId?t?.title||e.taskId:R(`dispatch.you`),s=e.taskId?n?Fi(n):e.tabId??`tab-1`:null;return(0,B.jsxs)(`button`,{type:`button`,className:Zv({plain:!e.taskId}),style:i,onClick:()=>a(e),disabled:!e.taskId,title:o,children:[(0,B.jsxs)(`span`,{className:Qv(!!t?.machine?.stale),children:[e.routine?`⟳ `:``,o]}),s!==null||r?(0,B.jsxs)(`span`,{className:$v,children:[s,r?(0,B.jsxs)(`span`,{className:`mono ${gy(r)}`,children:[` `,_y[r]]}):null]}):null]})}function Py(e){let t=Math.floor(e/6e4),n=Math.floor(t/60);return{minutes:t,hours:n,days:Math.floor(n/24)}}function Fy(e,t=Date.now()){let n=Math.max(0,t-e),r=Math.floor(n/1e3);if(r<60)return`${r}s`;let{minutes:i,hours:a,days:o}=Py(n);return i<60?`${i}m`:a<24?`${a}h`:`${o}d`}var Iy=30;function Ly(){let{items:e}=Mv();return t=>{let n=t.indexOf(`: `);switch(n>=0?t.slice(0,n):`failed`){case`no-remote`:return e.errorHint.noRemote;case`gh-missing`:return e.errorHint.ghMissing;case`auth`:return e.errorHint.auth;default:return Nv(e.errorHint.fallback,{message:t})}}}function Ry({model:e}){let{items:t,common:n}=Mv(),r=Ly(),i=e.client,a=v(e.tasks),o=zv(e),s=Bv(e),[c,l]=(0,g.useState)(()=>{let e=s?o.findIndex(e=>Iv(e)===Iv(s)):-1;return Math.max(0,e)}),u=o[c],d=(e,t)=>({repo:e,limit:Iy,...t?{assignee:`@me`}:{}}),f=e=>Object.fromEntries(e.links.map(e=>[e.number,e.taskId])),[p,m]=(0,g.useState)(()=>u?cs(i,`workitem.list`,d(u,!1))?.items??null:null),[h,_]=(0,g.useState)(()=>{let e=u?cs(i,`workitem.links`,{repo:u}):void 0;return e?f(e):{}}),[y,b]=(0,g.useState)(null),[x,S]=(0,g.useState)(!1),[C,w]=(0,g.useState)(0),[T,E]=(0,g.useState)(0),[D,O]=(0,g.useState)(!1),[k,A]=(0,g.useState)(null),j=Wv(),M=(0,g.useRef)(!1);(0,g.useEffect)(()=>{let e=!0;if(!u){m([]);return}b(null);let t=M.current;M.current=!1;let n=d(u,x),r=cs(i,`workitem.list`,n);return r&&m(r.items),i.request(`workitem.list`,{...n,...t?{refresh:!0}:{}}).then(t=>e&&m(ls(i,`workitem.list`,n,t).items)).catch(t=>{e&&(b(Fv(t)),m([]))}),us(i,`workitem.links`,{repo:u}).then(t=>e&&_(f(t))).catch(()=>e&&_({})),()=>{e=!1}},[i,u,x,C,a?.tasks.length]);let N=p??[],P=Math.min(T,Math.max(0,N.length-1));(0,g.useEffect)(()=>A(null),[u,x]);let F=(0,g.useRef)(null);(0,g.useEffect)(()=>{F.current?.querySelector(`[data-row="${P}"]`)?.scrollIntoView({block:`nearest`})},[P]);let I=e=>a?.tasks.find(t=>t.id===e)?.title??e,L=t=>{Nt.set(null),e.select(t)},ee=async()=>{let e=N[P];if(!e||!u||D)return;let n=h[e.number];if(n){A(Nv(t.openingLinked,{title:I(n)})),L(n);return}O(!0),A(Nv(t.starting,{number:e.number}));try{let n=await i.request(`workitem.start`,{repo:u,number:e.number});n.started?L(n.taskId):A(Nv(t.startedNoEngine,{title:n.title}))}catch(n){G(Nv(t.startFailed,{number:e.number,error:Fv(n)}),`error`)}finally{O(!1)}};Uv(e=>{if(e.ctrlKey)return e.key===`c`&&(Nt.set(null),!0);switch(e.key){case`Escape`:case`q`:return Nt.set(null),!0;case`j`:case`ArrowDown`:return E(Math.min(N.length-1,P+1)),!0;case`k`:case`ArrowUp`:return E(Math.max(0,P-1)),!0;case`Tab`:return l(t=>o.length?(t+(e.shiftKey?o.length-1:1))%o.length:0),!0;case`a`:return S(e=>!e),!0;case`r`:return M.current=!0,w(e=>e+1),!0;case`Enter`:return ee(),!0;default:return!1}});let te=Date.now();return(0,B.jsxs)(`div`,{className:qp,tabIndex:0,ref:j,children:[(0,B.jsxs)(`div`,{className:Yp,children:[(0,B.jsx)(`h1`,{className:Jp,children:t.title}),(0,B.jsxs)(`span`,{className:`mono touch:empty:hidden! text-muted ${Xp(!0)}`,children:[u?Lv(u,o):t.noRepo,x?` ${t.assignedFilter}`:``]})]}),y?(0,B.jsxs)(`div`,{className:$p,children:[(0,B.jsx)(`p`,{className:`text-error`,children:y}),(0,B.jsx)(`p`,{className:`text-muted`,children:r(y)})]}):p===null?(0,B.jsx)(`p`,{className:`text-muted`,children:n.loading}):N.length===0?(0,B.jsx)(`p`,{className:`text-muted`,children:t.empty}):(0,B.jsx)(`div`,{className:$p,ref:F,children:N.map((e,n)=>{let r=h[e.number],i=Date.parse(e.updatedAt);return(0,B.jsxs)(`div`,{"data-row":n,className:tm(n===P),onClick:()=>n===P?void ee():E(n),children:[(0,B.jsxs)(`div`,{className:nm,children:[(0,B.jsxs)(`span`,{className:`mono ${rm}`,children:[`#`,e.number]}),(0,B.jsx)(`span`,{children:e.title})]}),(0,B.jsxs)(`div`,{className:im,children:[(0,B.jsx)(`span`,{className:am,children:[e.author,...e.labels.slice(0,2)].filter(Boolean).join(`, `)}),r&&(0,B.jsx)(`span`,{children:Nv(t.linkedChip,{title:I(r)})}),(0,B.jsx)(`span`,{className:`mono`,children:Number.isFinite(i)?Fy(i,te):``})]})]},e.number)})}),k&&(0,B.jsx)(`p`,{className:`text-muted mx-0 mt-2 mb-0 text-meta leading-[inherit]`,children:k})]})}var zy={backlog:`active`,in_progress:`active`,in_review:`parked`,error:`parked`,done:`terminal`,canceled:`terminal`,open:`active`,doing:`active`,hold:`parked`};function By(e){return zy[e]??`parked`}var Vy=[`backlog`,`in_progress`,`parked`,`done`];function Hy(e,t,n){let r=e.find(e=>e.issues.length>0)?.issues[0]?.id??null;if(t==null)return r;let i=-1,a=-1;for(let[n,r]of e.entries()){let e=r.issues.findIndex(e=>e.id===t);if(e!==-1){i=n,a=e;break}}if(i===-1)return r;if(n===`up`||n===`down`){let r=e[i]?.issues??[],o=n===`up`?a-1:a+1;return r[Math.max(0,Math.min(o,r.length-1))]?.id??t}let o=n===`left`?-1:1;for(let n=i+o;n>=0&&n<e.length;n+=o){let r=e[n]?.issues??[];if(r.length!==0)return r[Math.min(a,r.length-1)]?.id??t}return t}function Uy(e,t){let n=By(e.status);return n===`terminal`?`done`:n===`parked`?`parked`:e.taskId!==void 0&&e.taskId!==``&&(t?.(e.taskId)??!0)||e.status===`doing`?`in_progress`:`backlog`}function Wy(e,t){let n=0;return{columns:e.map(e=>{if(e.key!==`in_progress`)return e;let r=[],i=[];for(let n of e.issues)n.taskId!==void 0&&n.taskId!==``&&t(n.taskId)?r.push(n):i.push(n);return n=r.length,r.length===0?e:{...e,issues:[...r,...i]}}),attentionCount:n}}function Gy(e,t){return e.created===t.created?t.id-e.id:e.created<t.created?1:-1}function Ky(e,t){let n={backlog:[],in_progress:[],parked:[],done:[]};for(let r of e)n[Uy(r,t)].push(r);return Vy.map(e=>{let t=e===`done`||e===`parked`,r=n[e].sort(Gy);return!t||r.length<=20?{key:e,issues:r,hiddenCount:0}:{key:e,issues:r.slice(0,20),hiddenCount:r.length-20}})}var qy=[`image/png`,`image/jpeg`,`image/gif`,`image/webp`,`application/pdf`],Jy=5242880;function Yy(e,t){return/\.pdf$/i.test(e)?`pdf[${t}]`:`images[${t}]`}function Xy(e){let t=-1;for(let n of e.matchAll(/^(?:images|pdf)\[(\d+)\]:/gm)){let e=Number.parseInt(n[1],10);e>t&&(t=e)}return t+1}function Zy(e,t){let n=e.replace(/\s+$/,``),r=Xy(e);for(let e of t){let t=`${Yy(e,r)}: ${e}`;n=n.length>0?`${n}\n${t}`:t,r+=1}return n}function Qy(e){return Array.from(e??[]).filter(e=>qy.includes(e.type))}function $y(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 eb(e,t){let n=$y(new Uint8Array(await t.arrayBuffer()));return(await e.request(`attachment.put`,{mime:t.type,data:n})).path}var tb=[`worktree`,`projectWorktree`,`project`];async function nb(e,t){let n=t.placement===`project`?`project`:`worktree`,{title:r,prompt:i}=await e.request(`issue.prompt`,{repo:t.repo,id:t.issue.id,where:n}),a=[];if(t.placement!==`project`){let{taskId:n}=await e.request(`task.create`,{repo:t.repo,engine:t.engine,title:r,prompt:i});if(await e.request(`issue.update`,{repo:t.repo,id:t.issue.id,task:n}).catch(e=>a.push({kind:`link`,error:Fv(e)})),t.placement===`worktree`)return{taskId:n,warnings:a};let o=await e.request(`task.openMain`,{repo:t.repo}),s=await e.request(`tab.openViewport`,{taskId:o.taskId,viewTaskId:n});return{taskId:o.taskId,tabId:s.tabId,warnings:a}}let{taskId:o}=await e.request(`task.openMain`,{repo:t.repo}),{tabId:s,taskId:c=o}=await e.request(`tab.new`,{taskId:o,kind:`engine`,engine:t.engine,prompt:i});return await e.request(`issue.setStatus`,{repo:t.repo,id:t.issue.id,status:`doing`}).catch(e=>a.push({kind:`status`,error:Fv(e)})),{taskId:c,tabId:s,warnings:a}}var rb=`text-meta leading-[inherit]`,ib=`text-meta`,ab=`flex flex-col gap-2 overflow-hidden`,ob=`flex min-w-0 items-baseline gap-3`,sb=`font-bold whitespace-nowrap text-accent touch:relative touch:after:absolute touch:after:-inset-x-2 touch:after:-inset-y-1 touch:after:content-['']`,cb=`min-w-0 truncate ${ib}`,lb=`ml-auto ${rb}`,ub=`grid min-h-0 flex-1 grid-cols-4 gap-2`,db=`flex min-h-0 flex-1 flex-col gap-2`,fb=`flex gap-4 ${ib}`,pb=e=>`touch:relative touch:after:absolute touch:after:-inset-x-1.5 touch:after:-top-1 touch:after:-bottom-3 touch:after:content-[''] ${e?`font-bold text-accent`:`text-muted`}`,mb={in_progress:`text-accent`,parked:`text-warning`,done:`text-success`},hb=e=>`flex min-h-0 flex-col rounded-md border-hairline border-line p-2 ${e?`flex-1`:``}`,gb=e=>`m-0 mb-2 flex justify-between gap-2 font-mono text-meta font-bold normal-nums ${mb[e]??`text-muted`}`,_b=`flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto`,vb=`m-0 ${ib}`,yb=e=>`flex flex-none cursor-pointer flex-col gap-1 rounded-sm border-hairline bg-surface px-2.5 py-2 ${e.selected?`border-accent`:e.attention?`border-warning`:`border-line hover:border-line-active`}`,bb=`flex justify-between gap-2`,xb=e=>`min-w-0 font-bold wrap-anywhere ${e?`text-muted`:``}`,Sb=`h-[2.8em] overflow-hidden whitespace-pre-wrap wrap-anywhere ${rb}`,Cb=`flex justify-between gap-2 ${ib}`,wb=`w-[min(680px,calc(100vw-32px))]!`,Tb=`flex items-baseline gap-3.5`,Eb=`flex items-baseline gap-2.5`,Db=`tracking-[0] normal-case`,Ob=`min-h-40 font-mono`,kb=`flex flex-col items-start gap-0.5`,Ab=e=>`text-left font-mono text-meta whitespace-pre-wrap normal-nums ${e?`font-bold text-accent`:`font-normal text-muted`}`,jb=rb,Mb=`flex flex-col gap-1 [&_p]:m-0`,Nb=`flex gap-2 ${ib}`,Pb=`min-w-[4ch] text-right`,Fb=`rounded-sm border-hairline border-transparent p-1 focus:border-accent focus:outline-none`,Ib={choice:`radiogroup`,list:`listbox`,cells:`group`};function Lb(e){return(0,B.jsx)(`div`,{ref:e.fieldRef,role:Ib[e.kind??`choice`],tabIndex:0,"aria-label":e.label,className:`${Fb} ${e.className??``}`,onKeyDown:e.onKeyDown,onClick:e.onClick,children:e.children})}var Rb=[`open`,`doing`,`hold`,`done`];function zb({model:e,taskId:t}){let{kanban:n}=Mv(),[r,i]=(0,g.useState)(null);return(0,g.useEffect)(()=>{let n=!0;return e.client.request(`task.events`,{taskId:t}).then(e=>n&&i(e.events)).catch(()=>n&&i([])),()=>{n=!1}},[e,t]),(0,B.jsxs)(`div`,{className:Mb,children:[(0,B.jsx)(`h2`,{className:`${H} text-muted`,children:n.detail.eventsLabel}),r===null?(0,B.jsx)(`p`,{className:`text-muted`,children:n.detail.eventsLoading}):r.length===0?(0,B.jsx)(`p`,{className:`text-muted`,children:n.detail.eventsNone}):r.map(e=>(0,B.jsxs)(`div`,{className:`mono ${Nb}`,children:[(0,B.jsx)(`span`,{className:`text-muted ${Pb}`,children:Fy(e.at)}),(0,B.jsx)(`span`,{children:e.kind}),e.tail&&(0,B.jsx)(`span`,{className:`text-muted`,children:e.tail})]},`${e.at}:${e.kind}:${e.tail}`))]})}function Bb(e){let{kanban:t}=Mv(),{issue:n,mode:r}=e,i=r===`create`,a=!i&&n.taskId?n.taskId:null,o=i||!a&&n.status!==`done`,[s,c]=(0,g.useState)(n.title),[l,u]=(0,g.useState)(n.body),[d,f]=(0,g.useState)(n.status),[p,m]=(0,g.useState)(e.defaultEngine),[h,_]=(0,g.useState)(tb[0]),[v,y]=(0,g.useState)(!1),[b,x]=(0,g.useState)(!1),S=(0,g.useRef)({}),C=e=>t=>{S.current[e]=t},w=i?`title`:o?`workspace`:a?`open`:`title`;(0,g.useEffect)(()=>S.current[w]?.focus(),[w]);let T=()=>({title:s.trim()||n.title,body:l,status:d}),E=()=>({engine:p,placement:h,jump:v}),D=t=>{Wt(),t&&e.onOutcome(t)},O=()=>s.trim()?!0:(S.current.title?.focus(),!1),k=()=>{i?O()&&D({kind:`create`,title:s.trim(),body:l,start:E()}):o?D({kind:`start`,...E(),...T()}):a&&D({kind:`open`,taskId:a,...T()})},A=()=>{i&&O()&&D({kind:`create`,title:s.trim(),body:l,start:null})},j=()=>D(i?null:{kind:`close`,...T()}),M=(0,g.useRef)({commit:k,saveOnly:A,close:j});M.current={commit:k,saveOnly:A,close:j},(0,g.useEffect)(()=>{let e=e=>{let t=e.key===`Escape`?M.current.close:e.key===`Enter`&&(e.ctrlKey||e.metaKey)?M.current.commit:e.key.toLowerCase()===`s`&&e.ctrlKey&&!e.metaKey?M.current.saveOnly:null;t&&(e.preventDefault(),e.stopImmediatePropagation(),t())};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},[]);let N=async t=>{let n=t.find(e=>e.size>Jy);if(n){G(R(`pages.attachTooLarge`,{name:n.name||n.type}),`error`);return}x(!0);try{let n=await Promise.all(t.map(t=>eb(e.model.client,t)));u(e=>Zy(e,n))}catch(e){G(On(e),`error`)}finally{x(!1)}},P=e=>{let t=Qy(e.clipboardData.files);t.length!==0&&(e.preventDefault(),N(t))},F=e=>{let t=Qy(e.dataTransfer.files);e.preventDefault(),t.length>0&&N(t)},I=(e,t,n)=>e[(Math.max(0,e.indexOf(t))+n+e.length)%e.length],L=(e,t,n)=>r=>{if(r.ctrlKey||r.metaKey||r.altKey)return;let i=(e===`x`?{ArrowRight:1,l:1,ArrowLeft:-1,h:-1}:{ArrowDown:1,ArrowUp:-1})[r.key];if(i)t(i);else if(r.key===`Enter`&&n)n();else return;r.preventDefault()},ee=d===`done`?`text-success`:d===`hold`?`text-warning`:d===`doing`?`text-accent`:`text-muted`,te=e=>t.detail.status[e];return(0,B.jsx)(`div`,{className:en,onMouseDown:e=>e.target===e.currentTarget&&M.current.close(),children:(0,B.jsxs)(`dialog`,{open:!0,className:`${tn(!0)} ${wb}`,"aria-label":i?t.detail.newStory:`#${n.id}`,onPaste:P,onDrop:F,onDragOver:e=>e.preventDefault(),children:[(0,B.jsxs)(`div`,{className:nn,children:[i?(0,B.jsx)(`h1`,{className:`${H} text-muted`,children:t.detail.newStory}):(0,B.jsxs)(`h1`,{className:`${H} text-muted ${Tb}`,children:[(0,B.jsxs)(`span`,{children:[`#`,n.id]}),(0,B.jsx)(`span`,{className:ee,children:te(d)}),(0,B.jsx)(`span`,{className:`text-muted`,children:Nv(t.detail.created,{date:n.created})}),a&&(0,B.jsx)(`span`,{className:`text-accent`,children:t.detail.linked})]}),(0,B.jsx)(`button`,{type:`button`,className:an,"aria-label":R(`dialog.close`),title:R(`dialog.close`),onClick:()=>M.current.close(),children:`×`})]}),(0,B.jsxs)(`div`,{className:on,children:[(0,B.jsxs)(`label`,{className:Yt,children:[(0,B.jsx)(`span`,{className:`${H} text-muted`,children:t.detail.titleLabel}),(0,B.jsx)(`input`,{ref:C(`title`),className:U,spellCheck:!1,value:s,onChange:e=>c(e.target.value.replace(/[\r\n]+/g,` `)),onKeyDown:e=>{e.key===`Enter`&&!e.ctrlKey&&!e.metaKey&&(e.preventDefault(),S.current.description?.focus())}})]}),(0,B.jsxs)(`label`,{className:Yt,children:[(0,B.jsxs)(`span`,{className:`${H} text-muted ${Eb}`,children:[t.detail.description,(0,B.jsx)(`span`,{className:`text-muted ${Db}`,children:So()?R(`pages.attachHintTouch`):t.detail.attachHint}),b&&(0,B.jsx)(`span`,{className:`text-accent`,children:`…`})]}),(0,B.jsx)(`textarea`,{ref:C(`description`),className:`${U} ${Xt} ${Ob}`,rows:8,spellCheck:!1,placeholder:t.detail.noDescription,value:l,onChange:e=>u(e.target.value)})]}),!i&&(0,B.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,B.jsxs)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted flex items-baseline gap-2.5`,children:[t.detail.statusLabel,(0,B.jsx)(`span`,{className:`keys-only text-muted tracking-[0] normal-case`,children:`←/→`})]}),(0,B.jsx)(Lb,{fieldRef:C(`status`),label:t.detail.statusLabel,className:`flex flex-wrap gap-1.5`,onKeyDown:L(`x`,e=>f(I(Rb,d,e))),children:Rb.map(e=>(0,B.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-pressed":e===d,className:Qt(e===d),onClick:()=>{f(e),S.current.status?.focus()},children:te(e)},e))})]}),o?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:Yt,children:[(0,B.jsxs)(`span`,{className:`${H} text-muted ${Eb}`,children:[t.detail.engine,(0,B.jsx)(`span`,{className:`keys-only text-muted ${Db}`,children:`←/→`})]}),(0,B.jsx)(Lb,{fieldRef:C(`engine`),label:t.detail.engine,className:Zt,onKeyDown:L(`x`,t=>m(I(e.engines.map(e=>e.id),p,t)),k),children:e.engines.map(e=>(0,B.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-pressed":e.id===p,className:Qt(e.id===p),onClick:()=>{m(e.id),S.current.engine?.focus()},children:e.name},e.id))})]}),(0,B.jsxs)(`div`,{className:Yt,children:[(0,B.jsxs)(`span`,{className:`${H} text-muted ${Eb}`,children:[t.detail.workspace,(0,B.jsx)(`span`,{className:`keys-only text-muted ${Db}`,children:`↑/↓`})]}),(0,B.jsx)(Lb,{fieldRef:C(`workspace`),label:t.detail.workspace,className:kb,onKeyDown:L(`y`,e=>_(I(tb,h,e)),k),children:tb.map(e=>(0,B.jsxs)(`button`,{type:`button`,tabIndex:-1,"aria-pressed":e===h,className:`touch:py-1.5 ${Ab(e===h)}`,onClick:()=>{_(e),S.current.workspace?.focus()},children:[e===h?`▸ `:` `,t.detail.placement[e]]},e))})]}),(0,B.jsxs)(`div`,{className:Yt,children:[(0,B.jsxs)(`span`,{className:`${H} text-muted ${Eb}`,children:[t.detail.jumpLabel,(0,B.jsx)(`span`,{className:`keys-only text-muted ${Db}`,children:`←/→`})]}),(0,B.jsx)(Lb,{fieldRef:C(`jump`),label:t.detail.jumpLabel,className:Zt,onKeyDown:L(`x`,()=>y(!v),k),children:[!1,!0].map(e=>(0,B.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-pressed":e===v,className:Qt(e===v),onClick:()=>{y(e),S.current.jump?.focus()},children:e?t.detail.jump.follow:t.detail.jump.stay},String(e)))})]}),(0,B.jsx)(`p`,{className:`touch:empty:hidden! text-muted ${jb}`,children:(0,B.jsx)(oc,{text:To(i?t.detail.createLegend:t.detail.startLegend)})}),(0,B.jsxs)(`div`,{className:Dt,children:[i&&(0,B.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:A,children:R(`pages.storySave`)}),(0,B.jsx)(`button`,{type:`button`,className:V(),onClick:k,children:R(i?`pages.storySaveStart`:`pages.storyStart`)})]})]}):a?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:Yt,children:[(0,B.jsx)(`span`,{className:`${H} text-muted`,children:t.detail.sessionLabel}),(0,B.jsxs)(`div`,{className:`${Zt} ${Fb}`,children:[(0,B.jsx)(`button`,{ref:C(`open`),type:`button`,className:Qt(!0),onClick:()=>D({kind:`open`,taskId:a,...T()}),children:t.detail.openAction}),(0,B.jsx)(`button`,{ref:C(`unlink`),type:`button`,className:Qt(),onClick:()=>D({kind:`unlink`,...T()}),children:t.detail.unlinkAction})]})]}),(0,B.jsx)(zb,{model:e.model,taskId:a}),(0,B.jsx)(`p`,{className:`touch:empty:hidden! text-muted ${jb}`,children:(0,B.jsx)(oc,{text:To(t.detail.openLegend)})})]}):(0,B.jsx)(`p`,{className:`touch:empty:hidden! text-muted ${jb}`,children:(0,B.jsx)(oc,{text:To(t.detail.doneNote)})})]})]})})}var Vb={"waiting-on-you":`text-error`,landing:`text-success`,"ready-for-review":`text-ink`,working:`text-accent`};function Hb(e){let[t,n]=(0,g.useState)(()=>{let t=cs(e,`engines.list`);return t?Yo(t.engines):[]});return(0,g.useEffect)(()=>{us(e,`engines.list`).then(e=>n(Yo(e.engines))).catch(()=>n([]))},[e]),{engines:t,defaultEngine:Xo(t)}}function Ub(e,t){let n=zv(e),r=n.join(`
|
|
19
|
-
`),[i,a]=(0,g.useState)(()=>cs(e,`kanban.boards`)??null);return(0,g.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])=>Rv(e,n,t)).then(e=>Promise.all(e.map(e=>r.request(`issue.list`,{repo:e}).catch(t=>({repoRoot:e,nextId:1,issues:[],readError:Fv(t)}))))).then(n=>{let r=ls(e,`kanban.boards`,void 0,[...n].sort((e,t)=>e.repoRoot.localeCompare(t.repoRoot)));t&&a(r)}),()=>{t=!1}},[e,t,r]),i}function Wb(e){let{issue:t}=e,n=t.body.trim();return(0,B.jsxs)(`div`,{"data-issue":t.id,className:yb({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,B.jsxs)(`div`,{className:bb,children:[(0,B.jsx)(`span`,{className:xb(e.column===`done`),children:t.title}),(0,B.jsxs)(`span`,{className:`mono text-muted`,children:[`#`,t.id]})]}),(0,B.jsx)(`div`,{className:`text-muted ${Sb}`,children:n}),(0,B.jsxs)(`div`,{className:`mono text-muted ${Cb}`,children:[(0,B.jsx)(`span`,{children:t.created}),e.badge&&(0,B.jsx)(`span`,{className:e.badge.tone,children:e.badge.label})]})]})}var Gb=5e3,Kb=760;function qb({model:e}){let{kanban:t,group:n,common:r}=Mv(),[i,a]=Vv(Gb),o=Ub(e,i),{engines:s,defaultEngine:c}=Hb(e),l=v(e.tasks),u=Bv(e),[d,f]=(0,g.useState)(null),[p,m]=(0,g.useState)(null),h=Wv(),[_,y]=(0,g.useState)(!1);(0,g.useEffect)(()=>{let e=h.current;if(!e)return;let t=new ResizeObserver(()=>y(e.clientWidth<Kb));return t.observe(e),()=>t.disconnect()},[h]);let b=o??[],x=u?b.find(e=>e.repoRoot.replace(/^\/private\//,`/`)===u.replace(/^\/private\//,`/`)):void 0,S=Math.max(0,b.findIndex(e=>e.repoRoot===(d??x?.repoRoot))),C=b[S],w=b.map(e=>e.repoRoot),T=b.filter(e=>e.readError).map(e=>`${e.repoRoot}\0${e.readError}`).join(`
|
|
20
|
-
`);(0,g.useEffect)(()=>{for(let e of b)e.readError&&G(Nv(t.readFailedToast,{repo:Lv(e.repoRoot,w),error:e.readError}),`error`)},[T]);let E=l?.tasks??[],D=new Set(E.map(e=>e.id)),O=e=>E.find(t=>t.id===e)?.group,{columns:k,attentionCount:A}=Wy(C?Ky(C.issues,D.size===0?void 0:e=>D.has(e)):[],e=>O(e)===`waiting-on-you`),j={backlog:t.column.backlog,in_progress:t.column.inProgress,parked:t.column.parked,done:t.column.done},M=(e,t)=>{let r=e.taskId&&(t===`in_progress`||t===`parked`)?O(e.taskId):void 0,i=r===`waiting-on-you`?n.waitingOnYou:r===`landing`?n.landing:r===`ready-for-review`?n.readyForReview:r===`working`?n.working:null;return r&&i?{label:i,tone:Vb[r]??`text-muted`}:null},N=async(t,n,r,i)=>{try{return await e.client.request(t,{repo:C?.repoRoot,...n})}catch(e){return G(Nv(r,{id:String(i),error:Fv(e)}),`error`),null}finally{a()}},P=(e,n)=>N(`issue.setStatus`,{id:e.id,status:n},t.statusFailed,e.id),F=t=>{Nt.set(null),e.select(t)},I=async(n,r,i)=>{try{let a=await nb(e.client,{repo:n,issue:r,engine:i.engine,placement:i.placement});for(let e of a.warnings)G(Nv(e.kind===`link`?t.linkFailed:t.statusFailed,{id:String(r.id),error:e.error}),`error`);i.jump?(Nt.set(null),e.selectWhenListed(a.taskId),a.tabId&&await e.refreshTabsNow().then(()=>e.select(a.taskId,a.tabId))):G(Nv(t.detail.startedBackground,{title:`#${r.id} ${r.title}`}))}catch(e){G(On(e),`error`)}finally{a()}},L=async(e,n)=>{if(!C||n.kind===`create`)return;let r={};n.title!==e.title&&(r.title=n.title),n.body!==e.body&&(r.body=n.body),(r.title!==void 0||r.body!==void 0)&&await N(`issue.update`,{id:e.id,...r},t.updateFailed,e.id),n.status!==e.status&&await P(e,n.status),n.kind===`open`?F(n.taskId):n.kind===`unlink`?await N(`issue.update`,{id:e.id,task:`none`},t.unlinkFailed,e.id):n.kind===`start`&&await I(C.repoRoot,{...e,...r},n)},ee=t=>{C&&(m(t.id),W.set((0,B.jsx)(Bb,{model:e,issue:t,mode:`detail`,engines:s,defaultEngine:c,onOutcome:e=>void L(t,e)})))},te=()=>{if(!C)return;let n=C.repoRoot,r={id:C.nextId,title:``,status:`open`,created:new Date().toISOString().slice(0,10),body:``};W.set((0,B.jsx)(Bb,{model:e,issue:r,mode:`create`,engines:s,defaultEngine:c,onOutcome:i=>{i.kind===`create`&&(async()=>{try{let t=await e.client.request(`issue.create`,{repo:n,title:i.title,body:i.body});if(a(),!i.start)return;let o=t.issues.find(e=>e.id===r.id)??t.issues.reduce((e,t)=>e&&e.id>t.id?e:t,null);o&&await I(n,o,i.start)}catch(e){G(Nv(t.createFailed,{error:Fv(e)}),`error`)}})()}}))},ne=()=>{let n=C?.issues.find(e=>e.id===p);if(!C||!n)return;let i=C.repoRoot;W.set((0,B.jsx)(Mn,{title:Nv(t.confirmDelete.title,{id:String(n.id)}),body:Nv(t.confirmDelete.body,{title:n.title}),confirmLabel:r.confirm,onConfirm:async()=>{try{await e.client.request(`issue.delete`,{repo:i,id:n.id}),m(null)}catch(e){G(Nv(t.deleteFailed,{id:String(n.id),error:Fv(e)}),`error`)}finally{a()}}}))},re=e=>{b.length!==0&&(f(b[(S+e+b.length)%b.length]?.repoRoot??null),m(null))},ie=e=>{let t=Hy(k,p,e);t!=null&&m(t)},z=e=>k.some(e=>e.issues.length>0)?ie(e):re(e===`left`?-1:1);Uv(e=>{if(e.ctrlKey)return e.key===`c`&&(Nt.set(null),!0);switch(e.key){case`Escape`:case`q`:return Nt.set(null),!0;case`r`:return a(),!0;case`Tab`:return re(e.shiftKey?-1:1),!0;case`ArrowUp`:return ie(`up`),!0;case`ArrowDown`:return ie(`down`),!0;case`ArrowRight`:case`l`:return z(`right`),!0;case`ArrowLeft`:case`h`:return z(`left`),!0;case`Enter`:{let e=C?.issues.find(e=>e.id===p);return e&&ee(e),!0}case`n`:return te(),!0;case`d`:return ne(),!0;default:return!1}});let ae=(0,g.useRef)(null);(0,g.useEffect)(()=>{ae.current?.querySelector(`[data-issue="${p}"]`)?.scrollIntoView({block:`nearest`})},[p]);let oe=(e,n,r)=>{m(e.id),At.set({x:n,y:r,items:Rb.filter(t=>t!==e.status).map(n=>({label:Nv(t.menu.setStatus,{status:t.detail.status[n]}),run:()=>void P(e,n)}))})},se=k.find(e=>e.issues.some(e=>e.id===p))??k.find(e=>e.issues.length>0)??k[0],V=(e,n)=>(0,B.jsxs)(`section`,{className:hb(!n),children:[n&&(0,B.jsxs)(`h2`,{className:gb(e.key),children:[(0,B.jsxs)(`span`,{children:[j[e.key],` (`,e.issues.length+e.hiddenCount,`)`]}),e.key===`in_progress`&&A>0&&(0,B.jsx)(`span`,{className:`text-warning`,children:Nv(t.attention,{count:String(A)})})]}),(0,B.jsxs)(`div`,{className:_b,children:[e.issues.map(t=>(0,B.jsx)(Wb,{issue:t,column:e.key,selected:t.id===p,badge:M(t,e.key),onSelect:()=>m(t.id),onOpen:()=>ee(t),onMenu:(e,n)=>oe(t,e,n)},t.id)),e.issues.length===0&&e.hiddenCount===0&&(0,B.jsx)(`p`,{className:`mono text-muted ${vb}`,children:t.columnEmpty}),e.hiddenCount>0&&(0,B.jsx)(`p`,{className:`mono text-muted ${vb}`,children:Nv(t.more,{count:String(e.hiddenCount)})})]})]},e.key);return(0,B.jsxs)(`div`,{className:`${Kp} ${ab}`,tabIndex:0,ref:h,children:[(0,B.jsxs)(`div`,{className:`kb-top`,children:[(0,B.jsx)(`h1`,{className:Jp,children:t.title}),(0,B.jsx)(`span`,{className:`mono keys-only text-muted`,children:t.hint}),(0,B.jsxs)(`span`,{className:`mono ${Zp}`,children:[(0,B.jsx)(`button`,{type:`button`,className:`${Tt} ${Qp.kanban}`,disabled:!C,onClick:te,children:R(`pages.new`)}),(0,B.jsx)(`button`,{type:`button`,className:`${Tt} ${Qp.kanban}`,disabled:!C?.issues.some(e=>e.id===p),onClick:ne,children:R(`pages.delete`)})]})]}),o===null?(0,B.jsx)(`p`,{className:`text-muted`,children:t.loading}):C?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:ob,children:[(0,B.jsxs)(`button`,{type:`button`,className:sb,onClick:()=>re(1),children:[Lv(C.repoRoot,w),b.length>1&&(0,B.jsx)(`span`,{className:`text-muted`,children:` ${S+1}/${b.length}`})]}),!_&&(0,B.jsx)(`span`,{className:`mono text-muted ${cb}`,children:C.repoRoot}),C.issues.length===0&&!C.readError&&(0,B.jsx)(`span`,{className:`text-muted ${lb}`,children:t.empty})]}),C.readError?(0,B.jsx)(`p`,{className:`text-error`,children:Nv(t.readFailed,{error:C.readError})}):_&&se?(0,B.jsxs)(`div`,{className:db,ref:ae,children:[(0,B.jsx)(`div`,{className:`mono ${fb}`,children:k.map(e=>(0,B.jsxs)(`button`,{type:`button`,className:pb(e.key===se.key),onClick:()=>{let t=e.issues[0];t&&m(t.id)},children:[j[e.key],` (`,e.issues.length+e.hiddenCount,`)`]},e.key))}),V(se,!1)]}):(0,B.jsx)(`div`,{className:ub,ref:ae,children:k.map(e=>V(e,!0))})]}):(0,B.jsx)(`p`,{className:`text-muted`,children:t.noRepos})]})}var Jb=`flex flex-col gap-1 border-line border-b-hairline px-0.5 py-2 last:border-b-0`,Yb=`flex min-w-0 items-baseline gap-2.5`,Xb=`min-w-0 truncate font-bold`,Zb=e=>e.state!==`online`&&e.state!==`connecting`;function Qb(e){return R(`machines.reason.${e.reason&&e.reason in F.machines.reason?e.reason:`unknown`}`)}function $b({row:e,tasks:t,locale:n}){let r=(n===`zh`?Zn:Xn).machine,i=Zb(e);return(0,B.jsxs)(`div`,{className:Jb,children:[(0,B.jsxs)(`div`,{className:Yb,children:[(0,B.jsx)(`span`,{className:`${Xb} ${i?`text-warning`:``}`,children:Vc(e,r)}),t>0&&(0,B.jsx)(`span`,{className:`ml-auto whitespace-nowrap text-meta text-muted`,children:R(`machines.tasks`,{count:t})})]}),i&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`p`,{className:`m-0 text-meta leading-[inherit]`,children:Qb(e)}),(0,B.jsxs)(`p`,{className:`m-0 flex flex-wrap items-baseline gap-x-2 gap-y-1 text-meta text-muted`,children:[(0,B.jsx)(`span`,{children:R(`machines.fix`)}),(0,B.jsx)(`code`,{className:`select-all rounded-xs bg-inset px-1.5 py-0.5 font-mono text-ink`,children:`rove machine doctor ${e.alias}`})]})]})]})}function ex({model:e}){let t=z(),n=Wv(),r=Kc(e),i=v(e.remote);return Uv(e=>e.key!==`Escape`&&e.key!==`q`?!1:(Nt.set(null),!0)),(0,B.jsxs)(`section`,{ref:n,tabIndex:-1,className:qp,children:[(0,B.jsx)(`h2`,{className:Jp,children:R(`machines.title`)}),(0,B.jsx)(`p`,{className:`${em} text-muted`,children:R(`machines.hint`)}),(0,B.jsx)(`div`,{className:$p,children:r.map(e=>(0,B.jsx)($b,{row:e,locale:t,tasks:i.filter(t=>t.machine?.id===e.alias).length},e.alias))})]})}var tx={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})`},nx={title:`Mods`,empty:`当前没有 mod 在绘制内容。`,emptyHint:`声明了 [mod] 的插件会在这里绘制面板,TUI 和 web 显示的是同一份。`,keys:`↑↓/tab 移动 · enter 按下 · esc 返回`,pressFailed:`{plugin}:按键没有送达 mod({reason})`},rx={info:`text-info`,success:`text-success`,warning:`text-warning`,error:`text-error`,muted:`text-muted`},ix=`flex flex-col gap-3`,ax=`[&_p]:mx-0 [&_p]:my-1`,ox=`rounded-md border-hairline border-line px-3 pt-2 pb-3 font-mono`,sx=`mb-2 text-meta leading-[inherit] text-ink`,cx=(e,t)=>`flex min-w-0 items-start ${e?`[&>form]:flex-[1_1_12em] [&>form]:self-center`:``} ${t?`rounded-sm border-hairline border-line`:``}`,lx=(e,t)=>`whitespace-pre-wrap wrap-anywhere ${e?rx[e]:`text-ink`} ${t?`font-bold`:``}`,ux=(e,t)=>`cursor-pointer rounded-sm border-hairline border-current px-2.5 py-0.5 [font:inherit] font-bold! ${rx[e]} ${t?`bg-[color-mix(in_srgb,currentcolor_18%,transparent)]`:`bg-transparent [&:hover]:bg-[color-mix(in_srgb,currentcolor_18%,transparent)]`}`,dx=`flex min-w-0 max-w-[40em] self-stretch`,fx=`w-full font-mono`,px=[0,6,12,20];function mx(e){return`mod-${e.kind}:${e.plugin}/${e.pane}/${e.key}`}function hx(e){let[t,n]=(0,g.useState)(e.value??``);return(0,B.jsx)(`form`,{className:dx,onSubmit:r=>{r.preventDefault(),e.onSubmit(t),n(e.value??``)},children:(0,B.jsx)(`input`,{id:e.id,className:`${U} ${fx}`,spellCheck:!1,value:t,placeholder:e.placeholder,onFocus:e.onFocus,onChange:e=>n(e.target.value)})})}function gx(e){let{node:t}=e;if(t.type===`text`)return(0,B.jsx)(`span`,{className:lx(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,B.jsx)(hx,{id:mx(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,B.jsx)(`button`,{type:`button`,id:mx(n),className:ux(t.tone??`info`,qr(n,e.cursor)),onFocus:()=>e.onFocus(n),onClick:()=>e.onPress(n),children:t.label})}return(0,B.jsx)(`div`,{className:cx(t.direction===`row`,t.border===!0),style:{flexDirection:t.direction??`column`,gap:px[t.gap??0],padding:px[t.padding??0]},children:t.children.map((t,n)=>(0,B.jsx)(gx,{...e,node:t},n))})}function _x({model:e}){let t=z()===`zh`?nx:tx,n=v(e.mods),r=Kr(n),[i,a]=(0,g.useState)(null),o=Jr(r,i),s=Wv(),c=(0,g.useRef)(!1),l=(t,n,r={})=>{a(t),!c.current&&(c.current=!0,e.client.request(n,{plugin:t.plugin,pane:t.pane,key:t.key,...r}).catch(e=>G(e instanceof Error?e.message:String(e),`error`)).finally(()=>{c.current=!1}))},u=e=>l(e,`mod.press`),d=(e,t)=>l(e,`mod.submit`,{value:t}),f=e=>{let t=Yr(r,o,e);a(t),t&&document.getElementById(mx(t))?.focus()};return Uv(e=>{if(e.ctrlKey)return e.key===`c`&&(Nt.set(null),!0);switch(e.key){case`Escape`:case`q`:return Nt.set(null),!0;case`ArrowDown`:return f(1),!0;case`ArrowUp`:return f(-1),!0;case`Enter`:return e.target instanceof HTMLButtonElement?!1:(o?.kind===`button`&&u(o),!0);default:return!1}}),(0,B.jsxs)(`div`,{className:`${qp} ${ix}`,tabIndex:0,ref:s,children:[(0,B.jsxs)(`div`,{className:Yp,children:[(0,B.jsx)(`h1`,{className:Jp,children:t.title}),(0,B.jsx)(`span`,{className:`keys-only touch:empty:hidden! text-muted ${Xp(!1)}`,children:t.keys})]}),n.length===0?(0,B.jsxs)(`div`,{className:ax,children:[(0,B.jsx)(`p`,{children:t.empty}),(0,B.jsx)(`p`,{className:`text-muted`,children:t.emptyHint})]}):n.map(e=>(0,B.jsxs)(`section`,{className:ox,children:[(0,B.jsxs)(`header`,{className:sx,children:[e.title,` `,(0,B.jsx)(`span`,{className:`text-muted`,children:e.plugin})]}),(0,B.jsx)(gx,{node:e.tree,pane:e,cursor:o,onPress:u,onSubmit:d,onFocus:a})]},`${e.plugin}/${e.id}`))]})}function vx(e){return e===`dispatch_failed`||e===`skipped_unavailable`||e===`script_failed`}function yx(e,t){return e.response?`responded`:e.status!==`dispatched`&&e.status!==`revived`?null:e.deliveryStatus===`missing`?`missing`:e.deliveryStatus===`awaiting`?`awaiting`:t-Date.parse(e.at)>72e5?`missing`:`awaiting`}var bx=6e4,xx=3294,Sx=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]]),Cx=new Map([[`SUN`,0],[`MON`,1],[`TUE`,2],[`WED`,3],[`THU`,4],[`FRI`,5],[`SAT`,6]]),wx=256;function Tx(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 Ex(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=Tx(t,e.names,e.field),c=Tx(i,e.names,e.field)}else s=Tx(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 Dx(e){if(e.length>wx)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:Ex({value:n,min:0,max:59,field:`minute`}),hours:Ex({value:r,min:0,max:23,field:`hour`}),daysOfMonth:Ex({value:i,min:1,max:31,field:`day-of-month`}),months:Ex({value:a,min:1,max:12,field:`month`,names:Sx}),daysOfWeek:Ex({value:o,min:0,max:7,field:`weekday`,names:Cx,normalize:e=>e%7}),dayOfMonthRestricted:!i.startsWith(`*`),dayOfWeekRestricted:!o.startsWith(`*`)}}function Ox(e){try{return Dx(e),!0}catch{return!1}}function kx(e,t,n){return new Date(e.year,e.month-1,e.day,t,n,0,0).getTime()}function Ax(e){let t=new Date(e);return{year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()}}function jx(e,t){return Ax(new Date(e.year,e.month-1,e.day+t,12,0,0,0).getTime())}function Mx(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 Nx(e){return e-e%bx}function Px(e,t){return[...e].sort((e,n)=>(e-n)*t)}function Fx(e,t){let n=Dx(e),r=Px(n.hours,1),i=Px(n.minutes,1),a=new Date(Nx(t)+bx),o=Ax(a.getTime()),s=a.getHours(),c=a.getMinutes();for(let e=0;e<xx;e++){if(Mx(n,o)){for(let e of r)if(!(e<s))for(let n of i){if(e===s&&n<c)continue;let r=kx(o,e,n);if(r>t)return r}}o=jx(o,1),s=0,c=0}throw Error(`cron expression never matches: ${e}`)}var Ix=[`minute`,`hour`,`dayOfMonth`,`month`,`dayOfWeek`];function Lx(e){let t=e.trim().split(/\s+/).filter(Boolean);return Ix.map((e,n)=>t[n]??`*`)}function Rx(e){return Ix.map((t,n)=>e[n]??`*`).join(` `)}var zx=[`*`,`*/5`,`*/10`,`*/15`,`*/30`,...Gx(0,59)],Bx=[`*`,`*/2`,`*/3`,`*/4`,`*/6`,`*/12`,...Gx(0,23)],Vx=[`*`,...Gx(1,31)],Hx=[`*`,`JAN`,`FEB`,`MAR`,`APR`,`MAY`,`JUN`,`JUL`,`AUG`,`SEP`,`OCT`,`NOV`,`DEC`],Ux=[`*`,`MON-FRI`,`SAT,SUN`,`MON`,`TUE`,`WED`,`THU`,`FRI`,`SAT`,`SUN`],Wx=[`MON`,`TUE`,`WED`,`THU`,`FRI`,`SAT`,`SUN`];function Gx(e,t){let n=[];for(let r=e;r<=t;r++)n.push(String(r));return n}var Kx={minute:zx,hour:Bx,dayOfMonth:Vx,month:Hx,dayOfWeek:Ux};function qx(e,t,n){let r=Kx[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 Jx(e,t){return Math.min(Math.max(e+t,0),Ix.length-1)}function Yx(e,t,n){let r=Lx(e);return t<0||t>=Ix.length||(r[t]=n),Rx(r)}function Xx(e,t){let[n,r,i,a,o]=Lx(e);if(a!==`*`||i!==`*`||n===void 0||r===void 0||o===void 0)return null;let s=Zx(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=Wx.find(e=>e===o.toUpperCase());return u?t(`automations.schedule.onWeekday`,{weekday:t(`automations.schedule.dow.${u}`),at:c}):null}function Zx(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 Qx(e,t,n,r){let i=e.trim();if(!Ox(i))return{kind:`invalid`};let a;try{a=Fx(i,t)}catch{return{kind:`never`}}return{kind:`ok`,nextRunMs:a,relative:$x(a-t,n),absolute:eS(a,t,n,r)}}function $x(e,t){let{minutes:n,hours:r,days:i}=Py(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 eS(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 tS={name:``,repo:``,prompt:``,schedule:`0 9 * * MON-FRI`};function nS(e){return e.name.trim().length>0&&(e.repo===null||e.repo.trim().length>0)&&e.prompt.trim().length>0&&(!e.target||e.target.taskId.trim().length>0&&/^tab-[\w-]+$/.test(e.target.tabId))&&Ox(e.schedule.trim())}function rS(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`:Ox(e.schedule.trim())?null:`schedule`}var iS=`flex flex-col overflow-hidden @container`,aS=`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`,oS=`flex min-h-0 flex-col gap-3 overflow-y-auto scrollbar-none rt-narrow:shrink-0 rt-narrow:overflow-visible`,sS=`flex gap-1.5 px-2 pt-0 pb-1`,cS=e=>`flex min-w-0 cursor-pointer flex-col gap-0.5 rounded-sm px-2 py-1.5 ${e?`bg-inset`:`[&:hover]:bg-hover`}`,lS=`flex min-w-0 items-baseline gap-2.5`,uS=e=>`min-w-0 flex-1 truncate font-bold ${e?`text-muted`:``}`,dS=`whitespace-nowrap text-meta`,fS=`truncate text-meta`,pS=`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)]`,mS=`flex flex-wrap items-baseline justify-between gap-3`,hS=`font-sans text-display font-bold normal-nums wrap-anywhere`,gS=`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`,_S=`max-h-[12lh] overflow-y-auto rounded-sm bg-inset px-2.5 py-2 whitespace-pre-wrap wrap-anywhere`,vS=`min-w-0 text-meta leading-[inherit]`,yS=`flex w-full min-w-0 gap-2 text-inherit`,bS=yS,xS=`${yS} cursor-pointer border-none bg-transparent p-0 text-left font-[inherit] [&:hover]:underline`,SS=`min-w-0 flex-1 truncate`,CS=`[&+&]:mt-1.5`,wS=e=>`whitespace-pre-wrap wrap-anywhere text-meta ${e?``:`leading-[inherit]`}`,TS=`text-meta`,ES=`flex gap-4.5`,DS=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`}`,OS=`hidden gap-2 px-1 pt-0.5 pb-1.5 touch:flex`,kS=`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 AS(e){let{auto:t,common:n}=Mv(),r=Pv(),i=z()===`zh`?`zh-CN`:`en-US`,[a,o]=(0,g.useState)(()=>({...tS,repo:e.repos.find(t=>e.defaultRepo&&Iv(t)===Iv(e.defaultRepo))??e.repos[0]??null})),[s,c]=(0,g.useState)(0),[l,u]=(0,g.useState)(null),d=(0,g.useRef)({}),f=e=>t=>{d.current[e]=t};(0,g.useEffect)(()=>d.current.name?.focus(),[]);let p=e=>{o(t=>({...t,...e})),u(null)};(0,g.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopImmediatePropagation(),Wt())};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},[]);let m=()=>{if(nS(a)){Wt(),e.onSubmit({name:a.name.trim(),repo:a.repo===null?null:a.repo.trim(),prompt:a.prompt.trim(),schedule:a.schedule.trim(),...a.target?{target:a.target}:{}});return}let n=rS(a);n&&(d.current[n]?.focus(),u(Reflect.get(t.missing,n)))},h=a.repo===null?[]:e.tasks.filter(e=>Iv(e.repo)===Iv(a.repo??``)),_=a.target?h.findIndex(e=>e.id===a.target?.taskId)+1:0,v=e=>{let t=(_+e+h.length+1)%(h.length+1),n=h[t-1];p({target:n?{kind:`existing-tab`,taskId:n.id,tabId:`tab-1`}:void 0})},y=[null,...e.repos],b=e=>{let t=Math.min(Math.max(y.indexOf(a.repo)+e,0),y.length-1),n=y[t];n!==void 0&&p({repo:n,target:void 0})},x=e=>t=>{(t.key===`ArrowUp`||t.key===`ArrowDown`)&&(t.preventDefault(),e(t.key===`ArrowDown`?1:-1))},S=e=>t=>{t.key===`Enter`&&(t.preventDefault(),d.current[e]?.focus())},C=Lx(a.schedule),w=e=>{let t=Ix[s];t&&p({schedule:Yx(a.schedule,s,qx(t,C[s]??`*`,e))})},T=e=>{if(!(e.ctrlKey||e.metaKey||e.altKey)){if(e.key===`ArrowLeft`||e.key===`h`)c(Jx(s,-1));else if(e.key===`ArrowRight`||e.key===`l`)c(Jx(s,1));else if(e.key===`ArrowUp`||e.key===`ArrowDown`)w(e.key===`ArrowUp`?1:-1);else return;e.preventDefault()}},E=Qx(a.schedule,Date.now(),r,i),D=Xx(a.schedule,r);return(0,B.jsx)(`div`,{className:en,onMouseDown:e=>e.target===e.currentTarget&&Wt(),children:(0,B.jsxs)(`dialog`,{open:!0,className:`${tn(!0)} ${wb}`,"aria-label":t.newTitle,children:[(0,B.jsx)(`h1`,{className:`${H} text-muted`,children:t.newTitle}),(0,B.jsxs)(`div`,{className:on,children:[(0,B.jsxs)(`label`,{className:Yt,children:[(0,B.jsx)(`span`,{className:`${H} text-muted`,children:t.fieldName}),(0,B.jsx)(`input`,{ref:f(`name`),className:U,spellCheck:!1,placeholder:t.namePlaceholder,value:a.name,onChange:e=>p({name:e.target.value}),onKeyDown:S(`repo`)})]}),(0,B.jsxs)(`div`,{className:Yt,children:[(0,B.jsxs)(`span`,{className:`${H} text-muted ${Eb}`,children:[t.fieldRepo,(0,B.jsx)(`span`,{className:`keys-only text-muted ${Db}`,children:`↑/↓`})]}),(0,B.jsx)(Lb,{fieldRef:f(`repo`),kind:`list`,label:t.fieldRepo,className:kb,onKeyDown:x(b),children:y.map(t=>(0,B.jsxs)(`button`,{type:`button`,tabIndex:-1,"aria-selected":t===a.repo,className:`touch:py-1.5 ${Ab(t===a.repo)}`,onClick:()=>{p({repo:t,target:void 0}),d.current.repo?.focus()},children:[t===a.repo?`▸ `:` `,t===null?R(`rail.noProject`):Lv(t,e.repos)]},t??``))})]}),(0,B.jsxs)(`div`,{className:Yt,children:[(0,B.jsxs)(`span`,{className:`${H} text-muted ${Eb}`,children:[t.fieldTarget,(0,B.jsx)(`span`,{className:`keys-only text-muted ${Db}`,children:`↑/↓`})]}),(0,B.jsx)(Lb,{fieldRef:f(`target`),kind:`list`,label:t.fieldTarget,onKeyDown:x(v),onClick:()=>v(1),children:a.target?h[_-1]?.title??a.target.taskId:t.targetFresh})]}),a.target&&(0,B.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,B.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:t.fieldTargetTab}),(0,B.jsx)(`input`,{ref:f(`targetTab`),className:U,spellCheck:!1,value:a.target.tabId,onChange:e=>a.target&&p({target:{...a.target,tabId:e.target.value}}),onKeyDown:S(`prompt`)})]}),(0,B.jsxs)(`label`,{className:Yt,children:[(0,B.jsx)(`span`,{className:`${H} text-muted`,children:t.fieldPrompt}),(0,B.jsx)(`input`,{ref:f(`prompt`),className:U,spellCheck:!1,placeholder:t.promptPlaceholder,value:a.prompt,onChange:e=>p({prompt:e.target.value}),onKeyDown:S(`schedule`)})]}),(0,B.jsxs)(`div`,{className:Yt,children:[(0,B.jsxs)(`span`,{className:`${H} text-muted ${Eb}`,children:[t.fieldSchedule,(0,B.jsx)(`span`,{className:`keys-only text-muted ${Db}`,children:`←/→ ↑/↓`})]}),(0,B.jsx)(Lb,{fieldRef:f(`schedule`),kind:`cells`,label:t.fieldSchedule,className:ES,onKeyDown:T,children:Ix.map((e,n)=>(0,B.jsxs)(`button`,{type:`button`,tabIndex:-1,className:DS(n===s),onClick:()=>{c(n),d.current.schedule?.focus()},children:[C[n]??`*`,(0,B.jsx)(`span`,{children:t.cronField[e]})]},e))}),(0,B.jsx)(`div`,{className:OS,children:[-1,1].map(e=>{let n=t.cronField[Ix[s]??`minute`]??``;return(0,B.jsx)(`button`,{type:`button`,tabIndex:-1,className:kS,"aria-label":R(e<0?`pages.cronDown`:`pages.cronUp`,{field:n}),onClick:()=>{w(e),d.current.schedule?.focus()},children:e<0?`−`:`+`},e)})}),E.kind===`ok`?(0,B.jsxs)(`p`,{className:`mono text-success`,children:[D?`${D}, `:``,E.relative,`, `,E.absolute]}):(0,B.jsx)(`p`,{className:`mono text-error`,children:E.kind===`never`?t.cronNever:t.cronInvalid})]}),l&&(0,B.jsxs)(`p`,{className:`text-error`,children:[`※ `,l]}),(0,B.jsx)(`p`,{className:`touch:empty:hidden! text-muted ${jb}`,children:(0,B.jsx)(oc,{text:To(t.composerLegend)})}),(0,B.jsxs)(`div`,{className:Dt,children:[(0,B.jsx)(`button`,{type:`button`,className:Tt,onClick:Wt,children:n.cancel}),(0,B.jsx)(`button`,{ref:f(`confirm`),type:`button`,className:V(),onClick:m,children:n.create})]})]})]})})}function jS(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 MS=(e,t)=>e&&typeof e==`object`?Reflect.get(e,t):void 0;function NS(e){let t=jS(e);if(!t)return{summary:e,full:e};let n=MS(t.value,`error`)??t.value,r=MS(n,`message`),i=MS(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 PS(e){let t=e.trim();if(!/^[[{]/.test(t))return e;try{return JSON.stringify(JSON.parse(t),null,2)}catch{return e}}var FS=5,IS={dispatched:`success`,revived:`success`,skipped_precheck:`muted`,skipped_cancelled:`muted`,skipped_missed:`warning`,skipped_unavailable:`warning`,dispatch_failed:`error`,ran:`success`,script_failed:`error`},LS={success:`text-success`,muted:`text-muted`,warning:`text-warning`,error:`text-error`},RS={success:`✓`,error:`†`,warning:`!`,muted:`·`},zS=e=>IS[e]??`muted`;function BS(e){let{auto:t}=Mv(),{runs:n,now:r,when:i}=e,a=e=>t.runStatus[e]??e,o=n.filter(e=>e.response);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`h2`,{className:`${H} text-muted`,children:t.recentRuns}),n.length===0?(0,B.jsx)(`p`,{className:`text-muted`,children:t.noRuns}):n.slice(0,FS).map(n=>{let o=yx(n,r),s=o===`awaiting`?`, ${t.responseAwaiting}`:o===`missing`?`, ${t.responseMissing}`:``,c=o===`missing`?`text-warning`:LS[zS(n.status)],l=(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{children:n.trigger===`manual`?`▸`:`·`}),(0,B.jsx)(`span`,{children:`#${n.runNumber}`}),(0,B.jsx)(`span`,{className:SS,children:`${a(n.status)}${n.tabId?`, ${n.tabId}`:``}${s}`}),(0,B.jsx)(`span`,{className:`text-muted`,children:i(n.at)})]}),u=n.error?NS(n.error):null,d=n.taskId;return(0,B.jsxs)(`div`,{className:`${vS} ${c}`,children:[d?(0,B.jsx)(`button`,{type:`button`,className:`mono ${xS}`,onClick:()=>e.openRun(d),children:l}):(0,B.jsx)(`span`,{className:`mono ${bS}`,children:l}),u&&(0,B.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,B.jsx)(`summary`,{children:u.summary}),(0,B.jsx)(`pre`,{children:u.full})]})]},n.id)}),n[0]?.precheckResult&&(0,B.jsx)(VS,{run:n[0]}),(0,B.jsx)(`h2`,{className:`${H} text-muted`,children:t.responses}),o.length===0?(0,B.jsx)(`p`,{className:`text-muted`,children:t.noResponses}):o.map(e=>(0,B.jsxs)(`div`,{className:CS,children:[(0,B.jsx)(`p`,{className:`mono ${TS} ${LS[zS(e.status)]}`,children:`#${e.runNumber} ${a(e.status)}, ${i(e.response?.at)}`}),(0,B.jsx)(`p`,{className:wS(!1),children:PS(e.response?.text??``)})]},e.id))]})}function VS({run:e}){let{auto:t}=Mv(),n=e.precheckResult;if(!n)return null;let r=n.timedOut?t.precheckTimedOut:Nv(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,B.jsxs)(`div`,{children:[(0,B.jsx)(`h2`,{className:`${H} text-muted`,children:Nv(t.precheckDetail,{exit:r,duration:String(n.durationMs)})}),i.length===0?(0,B.jsx)(`p`,{className:`text-muted`,children:t.precheckNoOutput}):i.map(e=>(0,B.jsx)(`p`,{className:`mono ${wS(!0)}`,children:`${e.label}: ${e.text.replace(/\s+$/,``).split(`
|
|
21
|
-
`).slice(-10).join(`
|
|
22
|
-
`)}`},e.label))]})}var HS=5e3;function US({model:e}){let{auto:t,common:n}=Mv(),r=e.client,[i,a]=Vv(HS),o=v(e.tasks),s=zv(e),c=Bv(e),[l,u]=(0,g.useState)(()=>cs(r,`routine.list`)??null),[d,f]=(0,g.useState)([]),[p,m]=(0,g.useState)(null),[h,_]=(0,g.useState)(null),[y,b]=(0,g.useState)(null),x=Wv(),S=Pv(),C=z()===`zh`?`zh-CN`:`en-US`,w=(0,g.useRef)(null);(0,g.useEffect)(()=>{let e=!0;return us(r,`routine.list`).then(t=>e&&u(t)).catch(()=>e&&u(e=>e??{automations:[],keepsDaemonAlive:!1})),()=>{e=!1}},[r,i]);let T=l?.automations??[],E=l?.lastRunStatus??{},D=l?.lastFailure??{},O=e=>{let t=E[e.id];return t!==void 0&&vx(t)},k=[{key:`pages.routinesNeedYou`,rows:T.filter(O)},{key:`pages.routinesActive`,rows:T.filter(e=>e.enabled&&!O(e))},{key:`pages.routinesPaused`,rows:T.filter(e=>!e.enabled&&!O(e))}],A=k.flatMap(e=>e.rows),j=Math.max(0,A.findIndex(e=>e.id===p)),M=A[j],N=e=>m(A[e]?.id??null),P=k[0]?.rows.length??0,F=v(Pt);(0,g.useEffect)(()=>{F===null||!l||(l.automations.some(e=>e.id===F)&&m(F),Pt.set(null))},[F,l]),(0,g.useEffect)(()=>{let e=!0;if(!M){f([]);return}let t=cs(r,`routine.runs`,{id:M.id});return t&&f(t.runs),us(r,`routine.runs`,{id:M.id}).then(t=>e&&f(t.runs)).catch(()=>e&&f([])),()=>{e=!1}},[r,M?.id,i]),(0,g.useEffect)(()=>b(null),[M?.id]);let I=(0,g.useRef)(null),[L,ee]=(0,g.useState)(0),te=(0,g.useRef)(0);(0,g.useEffect)(()=>{let e=w.current,t=L!==te.current;if(te.current=L,t&&e&&I.current&&e.offsetTop>I.current.offsetTop){e.scrollIntoView({block:`start`,behavior:`smooth`});return}I.current?.querySelector(`[data-row="${j}"]`)?.scrollIntoView({block:`nearest`})},[j,L]);let ne=Date.now(),re=e=>{let n=e?Date.parse(e):NaN;if(!Number.isFinite(n))return`—`;let r=n-ne,i=r>=0,a=Math.floor(Math.abs(r)/6e4),o=Math.floor(a/60);return a<1?i?t.when.now:t.when.justNow:a<60?Nv(i?t.when.inMinutes:t.when.minutesAgo,{n:a}):o<24?Nv(i?t.when.inHours:t.when.hoursAgo,{n:o}):new Date(n).toLocaleDateString()},ie=e=>o?.tasks.find(t=>t.id===e)?.title??e,ae=t=>{Nt.set(null),e.select(t)},oe=(e,t,n)=>G(Nv(e,{name:t,error:Fv(n)}),`error`),se=async()=>{if(!(!M||h)){_(M.id);try{await r.request(`routine.setEnabled`,{id:M.id,enabled:!M.enabled}),a()}catch(e){oe(M.enabled?t.disableFailed:t.enableFailed,M.name,e)}finally{_(null)}}},V=async()=>{if(!(!M||h)){_(M.id),b(Nv(t.running,{name:M.name}));try{let e=await r.request(`routine.runNow`,{id:M.id});b(Nv(t.ranWith,{name:M.name,status:e.status})),a()}catch(e){oe(t.runFailed,M.name,e)}finally{_(null)}}},ce=async()=>{if(h)return;let e=Rv(await r.request(`repos.list`).then(e=>e.repos).catch(()=>[]),s);W.set((0,B.jsx)(AS,{repos:e,tasks:(o?.tasks??[]).filter(e=>!e.deleting).map(e=>({id:e.id,title:e.title,repo:e.repo})),defaultRepo:c,onSubmit:e=>{(async()=>{_(`new`);try{await r.request(`routine.create`,{...e.repo===null?{}:{repo:e.repo},name:e.name,prompt:e.prompt,schedule:e.schedule,...e.target?{targetTask:e.target.taskId,targetTab:e.target.tabId}:{}}),a()}catch(e){G(Nv(t.createFailed,{error:Fv(e)}),`error`)}finally{_(null)}})()}}))},le=()=>{if(!M||h)return;let e=M;W.set((0,B.jsx)(Mn,{title:t.deleteTitle,body:Nv(t.deleteBody,{name:e.name}),confirmLabel:t.deleteButton,onConfirm:async()=>{_(e.id);try{await r.request(`routine.delete`,{id:e.id}),a()}catch(n){oe(t.deleteFailed,e.name,n)}finally{_(null)}}}))};Uv(e=>{if(e.ctrlKey)return e.key===`c`&&(Nt.set(null),!0);switch(e.key){case`Escape`:case`q`:return Nt.set(null),!0;case`j`:case`ArrowDown`:return N(Math.min(A.length-1,j+1)),!0;case`k`:case`ArrowUp`:return N(Math.max(0,j-1)),!0;case`n`:return ce(),!0;case`r`:return a(),!0;case`e`:return se(),!0;case`s`:return V(),!0;case`d`:return le(),!0;case`Enter`:{let e=d[0]?.taskId;return e?ae(e):d.length>0&&b(t.latestRunNoTask),!0}default:return!1}});let ue=M?.target,de=M?Xx(M.schedule,S):null,fe=e=>e===void 0?R(`rail.noProject`):Lv(e,T.flatMap(e=>e.repo??[])),pe=M?.nextRunAt?Date.parse(M.nextRunAt):NaN;return(0,B.jsxs)(`div`,{className:`${Kp} ${iS}`,tabIndex:0,ref:x,children:[(0,B.jsxs)(`div`,{className:Yp,children:[(0,B.jsx)(`h1`,{className:Jp,children:t.title}),(0,B.jsxs)(`span`,{className:`mono ${Zp}`,children:[P>0&&(0,B.jsx)(`span`,{className:`text-error`,children:Nv(t.needAttention,{count:String(P),total:String(A.length)})}),(0,B.jsx)(`span`,{className:l?.keepsDaemonAlive?`text-success`:`text-muted`,children:l?.keepsDaemonAlive?t.holdingDaemon:t.notHolding}),(0,B.jsx)(`button`,{type:`button`,className:`${Tt} ${Qp.header}`,onClick:()=>void ce(),children:R(`pages.new`)})]})]}),l===null?(0,B.jsx)(`p`,{className:`text-muted`,children:n.loading}):A.length===0?(0,B.jsxs)(`div`,{className:$p,children:[(0,B.jsx)(`p`,{className:`text-muted`,children:t.empty}),(0,B.jsx)(`p`,{className:`keys-only`,children:t.emptyHint})]}):(0,B.jsxs)(`div`,{className:aS,children:[(0,B.jsx)(`div`,{className:oS,ref:I,children:k.map(e=>e.rows.length===0?null:(0,B.jsxs)(`section`,{children:[(0,B.jsxs)(`h2`,{className:`${H} ${sS} ${e===k[0]?`text-error`:`text-muted`}`,children:[R(e.key),` `,(0,B.jsx)(`span`,{className:`mono`,children:e.rows.length})]}),e.rows.map(e=>{let n=A.indexOf(e),r=E[e.id],i=r?zS(r):null;return(0,B.jsxs)(`div`,{"data-row":n,className:cS(n===j),onClick:()=>{N(n),ee(e=>e+1)},children:[(0,B.jsxs)(`span`,{className:lS,children:[(0,B.jsx)(`span`,{className:uS(!e.enabled),children:e.name}),(0,B.jsx)(`span`,{className:`mono text-muted ${dS}`,children:e.enabled?re(e.nextRunAt):t.paused}),(0,B.jsx)(`span`,{className:`mono ${i?LS[i]:`text-muted`}`,style:{width:`1ch`},children:i?RS[i]:` `})]}),(0,B.jsx)(`span`,{className:`mono text-muted ${fS}`,title:e.schedule,children:`${fe(e.repo)} · ${Xx(e.schedule,S)??e.schedule}`}),D[e.id]?(0,B.jsx)(`span`,{className:`mono text-warning ${fS}`,title:D[e.id]?.reason,children:Nv(t.lastFailed,{when:re(D[e.id]?.at),reason:D[e.id]?.reason??``})}):null]},e.id)})]},e.key))}),(0,B.jsx)(`div`,{className:pS,ref:w,children:M?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:mS,children:[(0,B.jsx)(`h2`,{className:hS,children:M.name}),(0,B.jsxs)(`span`,{className:`mono ${Zp}`,children:[(0,B.jsx)(`button`,{type:`button`,className:`${Tt} ${Qp.row}`,disabled:h===M.id,onClick:()=>void V(),children:t.runNow}),(0,B.jsx)(`button`,{type:`button`,className:`${Tt} ${Qp.row}`,disabled:h===M.id,onClick:()=>void se(),children:R(M.enabled?`pages.routinePause`:`pages.routineEnable`)}),(0,B.jsx)(`button`,{type:`button`,className:`${Tt} ${Qp.row}`,disabled:h===M.id,onClick:le,children:R(`pages.delete`)})]})]}),(0,B.jsxs)(`dl`,{className:gS,children:[(0,B.jsx)(`dt`,{className:`text-muted`,children:R(`pages.routineSchedule`)}),(0,B.jsxs)(`dd`,{children:[de??(0,B.jsx)(`span`,{className:`mono`,children:M.schedule}),de&&(0,B.jsx)(`span`,{className:`mono text-muted`,children:` ${M.schedule}`})]}),(0,B.jsx)(`dt`,{className:`text-muted`,children:R(`pages.routineNext`)}),(0,B.jsx)(`dd`,{className:M.enabled?``:`text-warning`,children:M.enabled?Number.isFinite(pe)?`${re(M.nextRunAt)} · ${new Date(pe).toLocaleString(C,{weekday:`short`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}`:`—`:t.paused}),(0,B.jsx)(`dt`,{className:`text-muted`,children:R(`pages.routineProject`)}),(0,B.jsx)(`dd`,{children:fe(M.repo)}),!M.script&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`dt`,{className:`text-muted`,children:R(`pages.routineDelivers`)}),(0,B.jsx)(`dd`,{children:ue?Nv(t.targetExisting,{task:ie(ue.taskId),tab:ue.tabId}):M.persistentSession?t.targetStanding:t.targetFresh})]})]}),M.precheck&&(0,B.jsx)(`p`,{className:`mono text-muted`,children:Nv(t.precheck,{command:M.precheck.command})}),M.script?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`h2`,{className:`${H} text-muted`,children:R(`pages.routineScript`)}),(0,B.jsx)(`p`,{className:`mono ${_S}`,children:M.script.command})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`h2`,{className:`${H} text-muted`,children:R(`pages.routinePrompt`)}),(0,B.jsx)(`p`,{className:_S,children:M.prompt})]}),(0,B.jsx)(BS,{runs:d,now:ne,when:re,openRun:ae})]}):(0,B.jsx)(`p`,{className:`text-muted`,children:t.noSelection})})]}),y&&(0,B.jsx)(`p`,{className:`text-muted mx-0 mt-2 mb-0 text-meta leading-[inherit]`,children:y})]})}var WS=`mt-1 mb-1`,GS=e=>`flex w-full cursor-pointer flex-col gap-0.5 rounded-sm border-0 bg-transparent px-2.5 py-1.5 text-left text-ink ${e?`bg-inset`:``}`,KS=`rounded-xs bg-accent/25 text-ink`,qS=2,JS=300;function YS(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))n.push(e.slice(a,t),{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,B.jsx)(`mark`,{className:KS,children:e.hit},e.at))}function XS({model:e}){z();let[t,n]=(0,g.useState)(``),[r,i]=(0,g.useState)({kind:`idle`}),[a,o]=(0,g.useState)(0);(0,g.useEffect)(()=>{let n=t.trim();if(n.length<qS){i({kind:`idle`});return}let r=!0,a=window.setTimeout(()=>{i({kind:`searching`}),e.client.request(`sessions.search`,{query:n}).then(e=>{r&&(i({kind:`done`,query:n,reply:e}),o(0))},e=>r&&i({kind:`failed`,message:e instanceof Error?e.message:String(e)}))},JS);return()=>{r=!1,window.clearTimeout(a)}},[e,t]);let s=r.kind===`done`?r.reply.matches:[],c=t=>e.select(t.taskId,t.tabId??null);return Uv(e=>{if(e.key===`Escape`||e.key===`q`)Nt.set(null);else if(e.key===`ArrowDown`||e.key===`j`)o(e=>Math.min(s.length-1,e+1));else if(e.key===`ArrowUp`||e.key===`k`)o(e=>Math.max(0,e-1));else if(e.key===`Enter`&&s[a])c(s[a]);else return!1;return!0}),(0,B.jsxs)(`section`,{className:qp,children:[(0,B.jsx)(`h2`,{className:Jp,children:R(`search.title`)}),(0,B.jsx)(`input`,{className:`${U} ${WS}`,type:`search`,autoFocus:!0,spellCheck:!1,value:t,placeholder:R(`search.placeholder`),onChange:e=>n(e.target.value),onKeyDown:e=>{e.key===`ArrowDown`?(e.preventDefault(),o(e=>Math.min(s.length-1,e+1))):e.key===`ArrowUp`?(e.preventDefault(),o(e=>Math.max(0,e-1))):e.key===`Enter`&&s[a]?(e.preventDefault(),c(s[a])):e.key===`Escape`&&Nt.set(null)}}),r.kind===`idle`&&(0,B.jsx)(`p`,{className:`mx-0 mt-2 mb-0 text-meta leading-[inherit] text-muted`,children:R(`search.hint`)}),r.kind===`searching`&&(0,B.jsx)(`p`,{className:`mx-0 mt-2 mb-0 text-meta leading-[inherit] text-muted`,children:R(`search.searching`)}),r.kind===`failed`&&(0,B.jsx)(`p`,{className:`mx-0 mt-2 mb-0 text-meta leading-[inherit] text-error`,children:r.message}),r.kind===`done`&&s.length===0&&(0,B.jsx)(`p`,{className:`mx-0 mt-2 mb-0 text-meta leading-[inherit] text-muted`,children:R(`search.none`,{query:r.query})}),s.length>0&&(0,B.jsx)(`div`,{className:`mt-2.5 flex flex-col gap-1.5`,children:s.map((e,t)=>(0,B.jsxs)(ue,{variant:`row`,className:GS(t===a),onMouseEnter:()=>o(t),onClick:()=>c(e),children:[(0,B.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2.5`,children:[(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-bold`,children:e.title}),(0,B.jsxs)(`span`,{className:`whitespace-nowrap text-meta text-muted`,children:[R(e.role===`user`?`search.you`:`search.agent`),` ·`,` `,co(Date.now()-Date.parse(e.at))]})]}),(0,B.jsx)(`span`,{className:`text-meta text-muted [overflow-wrap:anywhere]`,children:YS(e.snippet,r.kind===`done`?r.query:``)})]},`${e.taskId}:${e.at}:${t}`))}),r.kind===`done`&&r.reply.truncated&&(0,B.jsx)(`p`,{className:`mx-0 mt-2 mb-0 text-meta leading-[inherit] text-muted`,children:R(`search.truncated`)}),r.kind===`done`&&r.reply.skipped.length>0&&(0,B.jsx)(`p`,{className:`mx-0 mt-2 mb-0 text-meta leading-[inherit] text-muted`,children:R(`search.skipped`,{count:r.reply.skipped.length})})]})}var ZS={id:`mods`,label:`mods`},QS={id:`machines`,label:`machines`},$S=[{id:`kanban`,label:`kanban`,mod:`kanban`},{id:`routines`,label:`automations`},{id:`issues`,label:`issues`,mod:`issues`},{id:`dispatch`,label:`dispatch`},{id:`search`,label:`search`}];function eC({model:e}){let{nav:t}=Mv(),n=v(Nt),r=v(e.mods).length>0,i=v(e.installedMods),a=Kc(e),o=a.filter(Zb).length,s=[...$S.filter(e=>!e.mod||i.has(e.mod)),...a.length>0?[QS]:[],...r?[ZS]:[]];return(0,B.jsxs)(`div`,{className:om,children:[(0,B.jsxs)(`button`,{type:`button`,className:`rail-nav-row ${cm(!1)}`,onClick:()=>$l(),children:[R(`rail.newTask`),(0,B.jsx)(`span`,{className:lm,"aria-hidden":`true`,children:`+`})]}),s.map(e=>(0,B.jsxs)(`button`,{type:`button`,className:`rail-nav-row ${cm(n===e.id)}`,"aria-current":n===e.id?`page`:void 0,onClick:()=>Ui(e.id),children:[e.label===`dispatch`||e.label===`search`||e.label===`machines`?R(`${e.label}.nav`):t[e.label],e.id===`machines`&&o>0&&(0,B.jsx)(`span`,{className:`ml-auto font-mono text-meta text-warning normal-nums`,title:R(`machines.troubled`,{count:o}),children:o})]},e.id))]})}function tC({model:e,page:t}){(0,g.useEffect)(()=>e.selection.subscribe(()=>Nt.set(null)),[e]);let n=v(e.installedMods);return t===`kanban`&&n.has(`kanban`)?(0,B.jsx)(qb,{model:e}):t===`routines`?(0,B.jsx)(US,{model:e}):t===`issues`&&n.has(`issues`)?(0,B.jsx)(Ry,{model:e}):t===`mods`?(0,B.jsx)(_x,{model:e}):t===`dispatch`?(0,B.jsx)(Ay,{model:e}):t===`search`?(0,B.jsx)(XS,{model:e}):t===`machines`?(0,B.jsx)(ex,{model:e}):null}var nC=p();function rC(e){return e?.match(/^https?:\/\/[^/]+\/([^/]+\/[^/]+)\/(?:pull|merge_requests|-\/merge_requests)\//)?.[1]}var iC=e=>e.charAt(0).toUpperCase()+e.slice(1);function aC(e){return[R(`rail.pr.state.${e.state}`),...e.checks?[R(`rail.pr.checks.${e.checks}`)]:[]].join(`, `)}function oC(e){let t=new Map;for(let n of e){let e=y_(n),r=[...e&&n.pr?[{pr:n.pr,mark:e}]:[],...(n.sessionPrs??[]).flatMap(e=>{let t=b_(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&&x_([a.mark,i])!==a.mark)&&t.set(r,{task:n,pr:e,mark:i})}}return[...t.values()]}function sC({tasks:e,onOpen:t}){let[n,r]=(0,g.useState)(null),[i,a]=(0,g.useState)(!1),o=(0,g.useRef)(null),s=(0,g.useRef)(null),c=(0,g.useRef)(null),l=So();(0,g.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,g.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,g.useEffect)(()=>()=>{s.current!==null&&window.clearTimeout(s.current)},[]);let f=oC(e),p=x_(f.map(e=>e.mark));if(!p)return null;let m=f.length===1?`PR #${f[0]?.pr.number??``}, ${aC(p)}`:R(`rail.pr.many`,{count:f.length});return(0,B.jsxs)(`span`,{ref:o,className:`chip ${Dc} ${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,B.jsx)(`span`,{className:`font-sans`,children:f.length}),n&&(0,nC.createPortal)((0,B.jsx)(`div`,{ref:c,className:Oc(i),style:{top:n.top-6,left:n.right+8},onMouseEnter:l?void 0:u,onMouseLeave:l?void 0:d,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onContextMenu:e=>e.stopPropagation(),children:f.map(({task:e,pr:t,mark:n})=>{let r=rC(t?.url),i=t?.additions!==void 0&&t.deletions!==void 0;return(0,B.jsxs)(`button`,{type:`button`,className:`flex flex-col gap-1 rounded-[calc(var(--radius)-6px)] px-3 py-2 text-left font-sans enabled:hover:bg-hover`,disabled:!t?.url,onClick:()=>t?.url&&window.open(t.url,`_blank`,`noopener`),children:[(0,B.jsx)(`span`,{className:`truncate font-semibold text-ink`,children:t.title||e.title}),(0,B.jsxs)(`span`,{className:`flex items-baseline gap-0 text-meta leading-[inherit] whitespace-nowrap`,children:[(0,B.jsxs)(`span`,{className:`inline-flex items-baseline gap-1.25 ${n.tone}`,children:[(0,B.jsx)(`span`,{className:`font-mono`,children:n.glyph}),iC(R(`rail.pr.state.${n.state}`))]}),(0,B.jsx)(`span`,{className:`overflow-hidden text-ellipsis whitespace-pre text-muted`,children:[...n.checks?[R(`rail.pr.checks.${n.checks}`)]:[],[r,t?.number===void 0?``:`#${t.number}`].filter(Boolean).join(` `)].filter(Boolean).map(e=>`, ${e}`).join(``)}),i&&(0,B.jsxs)(`span`,{className:`ml-auto flex gap-1.5 pl-3 tabular-nums`,children:[(0,B.jsxs)(`span`,{className:`text-success`,children:[`+`,t.additions]}),(0,B.jsxs)(`span`,{className:`text-error`,children:[`−`,t.deletions]})]})]})]},t.url??`${e.id}#${t.number??``}`)})}),document.body)]})}var cC=`~archived`;function lC(e,t,n,r){let i=t.filter(e=>!e.routine);if(i.length===0)return e;let a={id:cC,kind:`archived`,count:i.length,expanded:n};if(!n)return[...e,a];let o=ki([{repo:``,label:``,key:cC,tasks:i}],``,r,1);return[...e,a,...o.filter(e=>e.kind!==`project`)]}function uC(e,t,n){let r=t.kind===`main`,i=e=>r?e.kind===`main`:e.kind!==`main`&&e.repo===t.repo&&!e.pinned==!t.pinned;if(t.id===n.id||!i(n))return null;let a=e.filter(i).sort((e,t)=>(e.order??e.rank)-(t.order??t.rank)).map(e=>e.id);return a.indexOf(n.id)-a.indexOf(t.id)}function dC(e,t,n,r){let i=uC(e,t,n);return i===null?null:r===`above`&&i>0?i-1:r===`below`&&i<0?i+1:i}function fC(e,t){return e.id===t.id?!1:e.kind===`main`?t.kind===`main`:t.kind!==`main`&&t.repo===e.repo}function pC(e,t,n,r,i){if(!fC(t,n))return null;if(t.kind===`main`){let i=dC(e,t,n,r);return i?{steps:i}:null}let a=n.pinned===!0||i&&r===`above`,o={...t,pinned:a},s=a===(n.pinned===!0)?dC(e.map(e=>e.id===t.id?o:e),o,n,r)??0:0,c=a===(t.pinned===!0)?{}:{pin:a};return`pin`in c||s!==0?{...c,steps:s}:null}var mC=e=>e===void 0||e.kind===`project`?0:e.kind===`task`||e.kind===`pane`?e.depth:1;function hC(e,t){let n=mC(e[t]),r=t+1;for(;r<e.length&&mC(e[r])>n;)r++;return r}function gC(e,t,n){let r=e.findIndex(e=>e.id===t),i=r<0?e:[...e.slice(0,r),...e.slice(hC(e,r))];for(let e=i.findIndex(e=>e.id===n)-1;e>=0;e--){let t=i[e];if(!t||t.kind===`project`)return!0;if(t.kind===`task`&&t.depth===1&&t.task.kind!==`main`)return!1}return!1}function _C(e,t){let n=mC(e[t]),r=[];for(let i=2;i<=n;i++){let a=t+1;for(;a<e.length&&mC(e[a])>i;)a++;let o=a<e.length&&mC(e[a])===i;r.push(i===n?o?`tee`:`elbow`:o?`pipe`:`blank`)}return r}function vC(e,t,n,r){let i=e.findIndex(e=>e.id===t);if(i<0||t===n)return e;let a=hC(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:hC(s,c);return[...s.slice(0,l),...o,...s.slice(l)]}function yC(e,t,n,r,i){let[a,o]=(0,g.useState)(null),s=(0,g.useRef)(t);s.current=t;let[c,l]=(0,g.useState)(null),u=(0,g.useRef)(()=>o(null));(0,g.useEffect)(()=>{if(!c)return;let e=()=>{l(null),u.current()};if(t!==c)return e();let n=window.setTimeout(e,3e3);return()=>window.clearTimeout(n)},[t,c]);let d=(0,g.useRef)(null),f=(0,g.useRef)(null),p=()=>[...d.current?.querySelectorAll(`[data-row]`)??[]];(0,g.useLayoutEffect)(()=>{let e=f.current;if(!e||(f.current=null,window.matchMedia(`(prefers-reduced-motion: reduce)`).matches))return;let t=p().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)`;d.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 m=(0,g.useRef)(null),h=(0,g.useRef)([]),_=(0,g.useRef)(new Map),v=(0,g.useRef)(0),y=(0,g.useRef)(0),b=e=>{m.current=e,o(e)},x=e=>!n||e.machine!==void 0?null:e.kind===`project`?t.find(t=>t.id===i(e.repo).mainTaskId)??null:e.kind===`task`&&e.depth===1&&e.task.kind!==`main`?e.task:null,S=e=>{let t=x(e);if(t)return{draggable:!0,onDragStart:n=>{n.dataTransfer.effectAllowed=`move`,n.dataTransfer.setData(`text/plain`,t.id),d.current=n.currentTarget.closest(`[data-rail-body]`),T(d.current);let r=h.current,i=r.findIndex(t=>t.id===e.id);v.current=r.slice(i,hC(r,i)).reduce((e,t,n)=>e+(_.current.get(t.id)?.height??0)+(n>0?_.current.get(t.id)?.gap??0:0),0),y.current=n.clientY,b({fromRow:e.id,from:t,toRow:e.id,to:t,side:`above`})},onDragEnd:()=>m.current&&b(null)}},C=(e,t,n)=>{let r=t;if(n.from.kind===`main`)for(;r>0&&e[r]?.kind!==`project`;)r--;let i=e[r],a=i&&x(i);return!i||!a||!fC(n.from,a)?null:{row:i.id,task:a}},w={onDragOver:e=>{let t=m.current;if(!t)return;e.preventDefault();let n=e.clientY-y.current;y.current=e.clientY;let r=e.target.closest(`[data-row]`)?.dataset.row,i=h.current,a=C(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+v.current)return;let s=e.clientY<o?`above`:`below`;(s===`above`?n>=0:n<=0)||(t.toRow!==a.row||t.side!==s)&&b({...t,toRow:a.row,to:a.task,side:s})},onDrop:n=>{let i=m.current;if(!i)return;n.preventDefault();let a=pC(t,i.from,i.to,i.side,gC(h.current,i.fromRow,i.toRow));m.current=null,r?u.current=()=>o(null):u.current=()=>{f.current=new Map(p().map(e=>[e.dataset.row??``,e.getBoundingClientRect().top])),o(null),hc(`default`),G(K(`tasks`,`sort.label`,{mode:K(`tasks`,`sort.modes.default`)}))},a?xc(e,i.from.id,a).finally(()=>l(s.current)):u.current()}},T=e=>{let t=[...e?.querySelectorAll(`[data-row]`)??[]];_.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}]}))},E=e=>{h.current=a?vC(e,a.fromRow,a.toRow,a.side):e;let t=new Map;if(!a)return t;let n=Math.min(...[..._.current.values()].map(e=>e.top));for(let[e,r]of h.current.entries()){let i=_.current.get(r.id);if(!i)return new Map;e>0&&(n+=i.gap),n!==i.top&&t.set(r.id,n-i.top),n+=i.height}return t};return{props:S,body:w,dragging:a?.fromRow??null,places:e=>{let t=E(e);return e=>{let n=t.get(e.id);return n?{"data-row":e.id,style:{transform:`translateY(${n}px)`}}:{"data-row":e.id}}}}}function bC(e,t,n,r){let i=e=>e.kind===`task`&&e.task.kind===`main`&&e.task.id!==n&&(r?t[e.task.id]?.length===0:(t[e.task.id]?.length??0)===0),a=[];for(let t=0;t<e.length;t++){let n=e[t];if(n?.kind!==`project`){n&&a.push(n);continue}let r=t+1;for(;r<e.length&&e[r]?.kind!==`project`;)r++;let o=e.slice(t+1,r);o.every(i)||a.push(n,...o),t=r-1}return a}var xC=new Map,SC=_(null);function CC(e){return xC.set(e.stream,e),()=>{xC.get(e.stream)===e&&xC.delete(e.stream),SC.get()===e&&SC.set(null)}}function wC(e){return xC.get(e)}ba(()=>[{id:`terminal.scroll-up`,chords:[`ctrl+pageup`],prefix:!1,surface:`terminal`,run:()=>SC.get()?.scrollPages(-1)},{id:`terminal.scroll-down`,chords:[`ctrl+pagedown`],prefix:!1,surface:`terminal`,run:()=>SC.get()?.scrollPages(1)},{id:`terminal.reset`,chords:[`f5`],prefix:!1,surface:`terminal`,run:()=>SC.get()?.reset()},{id:`terminal.search`,chords:[`/`],prefix:!0,surface:`terminal`,live:()=>SC.get()!==null,run:()=>SC.get()?.openSearch()}]);var TC=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?AC.isErrorNoTelemetry(e)?new AC(e.message+`
|
|
23
|
-
|
|
24
|
-
`+e.stack):Error(e.message+`
|
|
25
|
-
|
|
26
|
-
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};function EC(e){OC(e)||TC.onUnexpectedError(e)}var DC=`Canceled`;function OC(e){return e instanceof kC||e instanceof Error&&e.name===DC&&e.message===DC}var kC=class extends Error{constructor(){super(DC),this.name=this.message}},AC=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}},jC;(e=>{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(jC||={});var MC=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>!t(n)||e(n)))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>!e(n)||(t=n,!1)),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||jC.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};MC.empty=new MC(e=>{});function NC(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var PC;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);t<n;t++)yield e[t]}e.slice=_;function v(t,n=1/0){let r=[];if(n===0)return[r,t];let i=t[Symbol.iterator]();for(let t=0;t<n;t++){let t=i.next();if(t.done)return[r,e.empty()];r.push(t.value)}return[r,{[Symbol.iterator](){return i}}]}e.consume=v;async function y(e){let t=[];for await(let n of e)t.push(n);return Promise.resolve(t)}e.asyncToArray=y})(PC||={});var FC=null;function IC(e){return FC?.trackDisposable(e),e}function LC(e){FC?.markAsDisposed(e)}function RC(e,t){FC?.setParent(e,t)}function zC(e){if(PC.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function BC(...e){return VC(()=>zC(e))}function VC(e){let t=IC({dispose:NC(()=>{LC(t),e()})});return t}var HC=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,IC(this)}dispose(){this._isDisposed||(LC(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{zC(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return RC(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error(`Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!`).stack):this._toDispose.add(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),RC(e,null))}};HC.DISABLE_DISPOSED_WARNING=!1;var UC=HC,WC=class{constructor(){this._store=new UC,IC(this),RC(this._store,this)}dispose(){LC(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}};WC.None=Object.freeze({dispose(){}});var GC=class{constructor(){this._isDisposed=!1,IC(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&RC(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,LC(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&RC(e,null),e}},KC=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};KC.Undefined=new KC(void 0);var qC=globalThis.performance&&typeof globalThis.performance.now==`function`,JC=class e{static create(t){return new e(t)}constructor(e){this._now=qC&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime===-1?this._now()-this._startTime:this._stopTime-this._startTime}},YC;(e=>{e.None=()=>WC.None;function t(e,t){return d(e,()=>{},0,void 0,!0,void 0,t)}e.defer=t;function n(e){return(t,n=null,r)=>{let i=!1,a;return a=e(e=>{if(!i)return a?a.dispose():i=!0,t.call(n,e)},null,r),i&&a.dispose(),a}}e.once=n;function r(e,t,n){return l((n,r=null,i)=>e(e=>n.call(r,t(e)),null,i),n)}e.map=r;function i(e,t,n){return l((n,r=null,i)=>e(e=>{t(e),n.call(r,e)},null,i),n)}e.forEach=i;function a(e,t,n){return l((n,r=null,i)=>e(e=>t(e)&&n.call(r,e),null,i),n)}e.filter=a;function o(e){return e}e.signal=o;function s(...e){return(t,n=null,r)=>u(BC(...e.map(e=>e(e=>t.call(n,e)))),r)}e.any=s;function c(e,t,n,i){let a=n;return r(e,e=>(a=t(a,e),a),i)}e.reduce=c;function l(e,t){let n,r=new sw({onWillAddFirstListener(){n=e(r.fire,r)},onDidRemoveLastListener(){n?.dispose()}});return t?.add(r),r.event}function u(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}function d(e,t,n=100,r=!1,i=!1,a,o){let s,c,l,u=0,d,f=new sw({leakWarningThreshold:a,onWillAddFirstListener(){s=e(e=>{u++,c=t(c,e),r&&!l&&(f.fire(c),c=void 0),d=()=>{let e=c;c=void 0,l=void 0,(!r||u>1)&&f.fire(e),u=0},typeof n==`number`?(clearTimeout(l),l=setTimeout(d,n)):l===void 0&&(l=0,queueMicrotask(d))})},onWillRemoveListener(){i&&u>0&&d?.()},onDidRemoveLastListener(){d=void 0,s.dispose()}});return o?.add(f),f.event}e.debounce=d;function f(t,n=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],n,void 0,!0,void 0,r)}e.accumulate=f;function p(e,t=(e,t)=>e===t,n){let r=!0,i;return a(e,e=>{let n=r||!t(e,i);return r=!1,i=e,n},n)}e.latch=p;function m(t,n,r){return[e.filter(t,n,r),e.filter(t,e=>!n(e),r)]}e.split=m;function h(e,t=!1,n=[],r){let i=n.slice(),a=e(e=>{i?i.push(e):s.fire(e)});r&&r.add(a);let o=()=>{i?.forEach(e=>s.fire(e)),i=null},s=new sw({onWillAddFirstListener(){a||(a=e(e=>s.fire(e)),r&&r.add(a))},onDidAddFirstListener(){i&&(t?setTimeout(o):o())},onDidRemoveLastListener(){a&&a.dispose(),a=null}});return r&&r.add(s),s.event}e.buffer=h;function g(e,t){return(n,r,i)=>{let a=t(new v);return e(function(e){let t=a.evaluate(e);t!==_&&n.call(r,t)},void 0,i)}}e.chain=g;let _=Symbol(`HaltChainable`);class v{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:_),this}reduce(e,t){let n=t;return this.steps.push(t=>(n=e(n,t),n)),this}latch(e=(e,t)=>e===t){let t=!0,n;return this.steps.push(r=>{let i=t||!e(r,n);return t=!1,n=r,i?r:_}),this}evaluate(e){for(let t of this.steps)if(e=t(e),e===_)break;return e}}function y(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new sw({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return i.event}e.fromNodeEventEmitter=y;function b(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new sw({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return i.event}e.fromDOMEventEmitter=b;function x(e){return new Promise(t=>n(e)(t))}e.toPromise=x;function S(e){let t=new sw;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event}e.fromPromise=S;function C(e,t){return e(e=>t.fire(e))}e.forward=C;function w(e,t,n){return t(n),e(e=>t(e))}e.runAndSubscribe=w;class T{constructor(e,t){this._observable=e,this._counter=0,this._hasChanged=!1;let n={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};this.emitter=new sw(n),t&&t.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function E(e,t){return new T(e,t).emitter.event}e.fromObservable=E;function D(e){return(t,n,r)=>{let i=0,a=!1,o={beginUpdate(){i++},endUpdate(){i--,i===0&&(e.reportChanges(),a&&(a=!1,t.call(n)))},handlePossibleChange(){},handleChange(){a=!0}};e.addObserver(o),e.reportChanges();let s={dispose(){e.removeObserver(o)}};return r instanceof UC?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=D})(YC||={});var XC=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new JC,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};XC.all=new Set,XC._idPool=0;var ZC=XC,QC=-1,$C=class e{constructor(t,n,r=(e._idPool++).toString(16).padStart(3,`0`)){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t<n)return;this._stacks||=new Map;let r=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,r+1),--this._warnCountdown,this._warnCountdown<=0){this._warnCountdown=n*.5;let[e,r]=this.getMostFrequentStack(),i=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${r}):`;console.warn(i),console.warn(e);let a=new nw(i,e);this._errorHandler(a)}return()=>{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[n,r]of this._stacks)(!e||t<r)&&(e=[n,r],t=r);return e}};$C._idPool=1;var ew=$C,tw=class e{constructor(e){this.value=e}static create(){return new e(Error().stack??``)}print(){console.warn(this.value.split(`
|
|
27
|
-
`).slice(2).join(`
|
|
28
|
-
`))}},nw=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},rw=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},iw=0,aw=class{constructor(e){this.value=e,this.id=iw++}},ow=2,sw=class{constructor(e){this._size=0,this._options=e,this._leakageMon=QC>0||this._options?.leakWarningThreshold?new ew(e?.onListenerError??EC,this._options?.leakWarningThreshold??QC):void 0,this._perfMon=this._options?._profName?new ZC(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new rw(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||EC)(n),WC.None}if(this._disposed)return WC.None;t&&(e=e.bind(t));let r=new aw(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=tw.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof aw?(this._deliveryQueue??=new cw,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=VC(()=>{i?.(),this._removeListener(r)});return n instanceof UC?n.add(a):Array.isArray(n)&&n.push(a),a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*ow<=t.length){let e=0;for(let n=0;n<t.length;n++)t[n]?t[e++]=t[n]:r&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=e}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||EC;if(!n){e.value(t);return}try{e.value(t)}catch(e){n(e)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners){if(this._listeners instanceof aw)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}}this._perfMon?.stop()}hasListeners(){return this._size>0}},cw=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},lw=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),uw;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof dw?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:YC.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:lw})})(uw||={});var dw=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?lw:(this._emitter||=new sw,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}},fw=`en`,pw=!1,mw=!1,hw=fw,gw,_w=globalThis,vw;typeof _w.vscode<`u`&&typeof _w.vscode.process<`u`?vw=_w.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(vw=process);var yw=typeof vw?.versions?.electron==`string`&&vw?.type===`renderer`;if(typeof vw==`object`){vw.platform,vw.platform,pw=vw.platform===`linux`,pw&&vw.env.SNAP&&vw.env.SNAP_REVISION,vw.env.CI||vw.env.BUILD_ARTIFACTSTAGINGDIRECTORY,hw=fw;let e=vw.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,hw=t.resolvedLanguage||fw,t.languagePack?.translationsConfigFile}catch{}}else typeof navigator==`object`&&!yw?(gw=navigator.userAgent,gw.indexOf(`Windows`),gw.indexOf(`Macintosh`),(gw.indexOf(`Macintosh`)>=0||gw.indexOf(`iPad`)>=0||gw.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,pw=gw.indexOf(`Linux`)>=0,gw?.indexOf(`Mobi`),mw=!0,hw=globalThis._VSCODE_NLS_LANGUAGE||fw,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);mw&&typeof _w.importScripts==`function`&&_w.origin;var bw=gw,xw=hw,Sw;(e=>{function t(){return xw}e.value=t;function n(){return xw.length===2?xw===`en`:xw.length>=3&&xw[0]===`e`&&xw[1]===`n`&&xw[2]===`-`}e.isDefaultVariant=n;function r(){return xw===`en`}e.isDefault=r})(Sw||={});var Cw=typeof _w.postMessage==`function`&&!_w.importScripts;(()=>{if(Cw){let e=[];_w.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r.id===t.data.vscodeScheduleAsyncWork){e.splice(n,1),r.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),_w.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var ww=!!(bw&&bw.indexOf(`Chrome`)>=0);bw&&bw.indexOf(`Firefox`),!ww&&bw&&bw.indexOf(`Safari`),bw&&bw.indexOf(`Edg/`),bw&&bw.indexOf(`Android`);function Tw(e,t=0,n){let r=setTimeout(()=>{e(),n&&i.dispose()},t),i=VC(()=>{clearTimeout(r),n?.deleteAndLeak(i)});return n?.add(i),i}(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var Ew;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(Ew||={});var Dw=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new sw,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await YC.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};Dw.EMPTY=Dw.fromArray([]);var Ow=class extends WC{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new GC),this._linesCacheDisposables=this._register(new GC),this._register(VC(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=BC(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=Tw(()=>this._destroyLinesCache(),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeout.clear()}getLineFromCache(e){return this._linesCache?.[e]}setLineInCache(e,t){this._linesCache&&(this._linesCache[e]=t)}translateBufferLineToStringWithWrap(e,t){let n=[],r=[0],i=this._terminal.buffer.active.getLine(e);for(;i;){let a=this._terminal.buffer.active.getLine(e+1),o=a?a.isWrapped:!1,s=i.translateToString(!o&&t);if(o&&a){let e=i.getCell(i.length-1);e&&e.getCode()===0&&e.getWidth()===1&&a.getCell(0)?.getWidth()===2&&(s=s.slice(0,-1))}if(n.push(s),o)r.push(r[r.length-1]+s.length);else break;e++,i=a}return[n.join(``),r]}},kw=class{get cachedSearchTerm(){return this._cachedSearchTerm}set cachedSearchTerm(e){this._cachedSearchTerm=e}get lastSearchOptions(){return this._lastSearchOptions}set lastSearchOptions(e){this._lastSearchOptions=e}isValidSearchTerm(e){return!!(e&&e.length>0)}didOptionsChange(e){return this._lastSearchOptions?e?this._lastSearchOptions.caseSensitive!==e.caseSensitive||this._lastSearchOptions.regex!==e.regex||this._lastSearchOptions.wholeWord!==e.wholeWord:!1:!0}shouldUpdateHighlighting(e,t){return t?.decorations?this._cachedSearchTerm===void 0||e!==this._cachedSearchTerm||this.didOptionsChange(t):!1}clearCachedTerm(){this._cachedSearchTerm=void 0}reset(){this._cachedSearchTerm=void 0,this._lastSearchOptions=void 0}},Aw=class{constructor(e,t){this._terminal=e,this._lineCache=t}find(e,t,n,r){if(!e||e.length===0){this._terminal.clearSelection();return}if(n>this._terminal.cols)throw Error(`Invalid col: ${n} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let i={startRow:t,startCol:n},a=this._findInLine(e,i,r);if(!a)for(let n=t+1;n<this._terminal.buffer.active.baseY+this._terminal.rows&&(i.startRow=n,i.startCol=0,a=this._findInLine(e,i,r),!a);n++);return a}findNextWithSelection(e,t,n){if(!e||e.length===0){this._terminal.clearSelection();return}let r=this._terminal.getSelectionPosition();this._terminal.clearSelection();let i=0,a=0;r&&(n===e?(i=r.end.x,a=r.end.y):(i=r.start.x,a=r.start.y)),this._lineCache.initLinesCache();let o={startRow:a,startCol:i},s=this._findInLine(e,o,t);if(!s)for(let n=a+1;n<this._terminal.buffer.active.baseY+this._terminal.rows&&(o.startRow=n,o.startCol=0,s=this._findInLine(e,o,t),!s);n++);if(!s&&a!==0)for(let n=0;n<a&&(o.startRow=n,o.startCol=0,s=this._findInLine(e,o,t),!s);n++);return!s&&r&&(o.startRow=r.start.y,o.startCol=0,s=this._findInLine(e,o,t)),s}findPreviousWithSelection(e,t,n){if(!e||e.length===0){this._terminal.clearSelection();return}let r=this._terminal.getSelectionPosition();this._terminal.clearSelection();let i=this._terminal.buffer.active.baseY+this._terminal.rows-1,a=this._terminal.cols;this._lineCache.initLinesCache();let o={startRow:i,startCol:a},s;if(r&&(o.startRow=i=r.start.y,o.startCol=a=r.start.x,n!==e&&(s=this._findInLine(e,o,t,!1),s||(o.startRow=i=r.end.y,o.startCol=a=r.end.x))),s||=this._findInLine(e,o,t,!0),!s){o.startCol=Math.max(o.startCol,this._terminal.cols);for(let n=i-1;n>=0&&(o.startRow=n,s=this._findInLine(e,o,t,!0),!s);n--);}if(!s&&i!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let n=this._terminal.buffer.active.baseY+this._terminal.rows-1;n>=i&&(o.startRow=n,s=this._findInLine(e,o,t,!0),!s);n--);return s}_isWholeWord(e,t,n){return(e===0||` ~!@#$%^&*()+\`-=[]{}|\\;:"',./<>?`.includes(t[e-1]))&&(e+n.length===t.length||` ~!@#$%^&*()+\`-=[]{}|\\;:"',./<>?`.includes(t[e+n.length]))}_findInLine(e,t,n={},r=!1){let i=t.startRow,a=t.startCol;if(this._terminal.buffer.active.getLine(i)?.isWrapped){if(r){t.startCol+=this._terminal.cols;return}return t.startRow--,t.startCol+=this._terminal.cols,this._findInLine(e,t,n)}let o=this._lineCache.getLineFromCache(i);o||(o=this._lineCache.translateBufferLineToStringWithWrap(i,!0),this._lineCache.setLineInCache(i,o));let[s,c]=o,l=this._bufferColsToStringOffset(i,a),u=e,d=s;n.regex||(u=n.caseSensitive?e:e.toLowerCase(),d=n.caseSensitive?s:s.toLowerCase());let f=-1;if(n.regex){let t=RegExp(u,n.caseSensitive?`g`:`gi`),i;if(r)for(;i=t.exec(d.slice(0,l));)f=t.lastIndex-i[0].length,e=i[0],t.lastIndex-=e.length-1;else i=t.exec(d.slice(l)),i&&i[0].length>0&&(f=l+(t.lastIndex-i[0].length),e=i[0])}else r?l-u.length>=0&&(f=d.lastIndexOf(u,l-u.length)):f=d.indexOf(u,l);if(f>=0){if(n.wholeWord&&!this._isWholeWord(f,d,e))return;let t=0;for(;t<c.length-1&&f>=c[t+1];)t++;let r=t;for(;r<c.length-1&&f+e.length>=c[r+1];)r++;let a=f-c[t],o=f+e.length-c[r],s=this._stringLengthToBufferSize(i+t,a),l=this._stringLengthToBufferSize(i+r,o)-s+this._terminal.cols*(r-t);return{term:e,col:s,row:i+t,size:l}}}_stringLengthToBufferSize(e,t){let n=this._terminal.buffer.active.getLine(e);if(!n)return 0;for(let e=0;e<t;e++){let r=n.getCell(e);if(!r)break;let i=r.getChars();i.length>1&&(t-=i.length-1);let a=n.getCell(e+1);a&&a.getWidth()===0&&t++}return t}_bufferColsToStringOffset(e,t){let n=e,r=0,i=this._terminal.buffer.active.getLine(n);for(;t>0&&i;){for(let e=0;e<t&&e<this._terminal.cols;e++){let t=i.getCell(e);if(!t)break;t.getWidth()&&(r+=t.getCode()===0?1:t.getChars().length)}if(n++,i=this._terminal.buffer.active.getLine(n),i&&!i.isWrapped)break;t-=this._terminal.cols}return r}},jw=class extends WC{constructor(e){super(),this._terminal=e,this._highlightDecorations=[],this._highlightedLines=new Set,this._register(VC(()=>this.clearHighlightDecorations()))}createHighlightDecorations(e,t){this.clearHighlightDecorations();for(let n of e){let e=this._createResultDecorations(n,t,!1);if(e)for(let t of e)this._storeDecoration(t,n)}}createActiveDecoration(e,t){let n=this._createResultDecorations(e,t,!0);if(n)return{decorations:n,match:e,dispose(){zC(n)}}}clearHighlightDecorations(){zC(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear()}_storeDecoration(e,t){this._highlightedLines.add(e.marker.line),this._highlightDecorations.push({decoration:e,match:t,dispose(){e.dispose()}})}_applyStyles(e,t,n){e.classList.contains(`xterm-find-result-decoration`)||(e.classList.add(`xterm-find-result-decoration`),t&&(e.style.outline=`1px solid ${t}`)),n&&e.classList.add(`xterm-find-active-result-decoration`)}_createResultDecorations(e,t,n){let r=[],i=e.col,a=e.size,o=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+e.row;for(;a>0;){let e=Math.min(this._terminal.cols-i,a);r.push([o,i,e]),i=0,a-=e,o++}let s=[];for(let e of r){let r=this._terminal.registerMarker(e[0]),i=this._terminal.registerDecoration({marker:r,x:e[1],width:e[2],backgroundColor:n?t.activeMatchBackground:t.matchBackground,overviewRulerOptions:this._highlightedLines.has(r.line)?void 0:{color:n?t.activeMatchColorOverviewRuler:t.matchOverviewRuler,position:`center`}});if(i){let e=[];e.push(r),e.push(i.onRender(e=>this._applyStyles(e,n?t.activeMatchBorder:t.matchBorder,!1))),e.push(i.onDispose(()=>zC(e))),s.push(i)}}return s.length===0?void 0:s}},Mw=class extends WC{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new sw)}get onDidChangeResults(){return this._onDidChangeResults.event}get searchResults(){return this._searchResults}get selectedDecoration(){return this._selectedDecoration}set selectedDecoration(e){this._selectedDecoration=e}updateResults(e,t){this._searchResults=e.slice(0,t)}clearResults(){this._searchResults=[]}clearSelectedDecoration(){this._selectedDecoration&&=(this._selectedDecoration.dispose(),void 0)}findResultIndex(e){for(let t=0;t<this._searchResults.length;t++){let n=this._searchResults[t];if(n.row===e.row&&n.col===e.col&&n.size===e.size)return t}return-1}fireResultsChanged(e){if(!e)return;let t=-1;this._selectedDecoration&&(t=this.findResultIndex(this._selectedDecoration.match)),this._onDidChangeResults.fire({resultIndex:t,resultCount:this._searchResults.length})}reset(){this.clearSelectedDecoration(),this.clearResults()}},Nw=class extends WC{constructor(e){super(),this._highlightTimeout=this._register(new GC),this._lineCache=this._register(new GC),this._state=new kw,this._resultTracker=this._register(new Mw),this._highlightLimit=e?.highlightLimit??1e3}get onDidChangeResults(){return this._resultTracker.onDidChangeResults}activate(e){this._terminal=e,this._lineCache.value=new Ow(e),this._engine=new Aw(e,this._lineCache.value),this._decorationManager=new jw(e),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(VC(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=Tw(()=>{let e=this._state.cachedSearchTerm;this._state.clearCachedTerm(),this.findPrevious(e,{...this._state.lastSearchOptions,incremental:!0},{noScroll:!0})},200))}clearDecorations(e){this._resultTracker.clearSelectedDecoration(),this._decorationManager?.clearHighlightDecorations(),this._resultTracker.clearResults(),e||this._state.clearCachedTerm()}clearActiveDecoration(){this._resultTracker.clearSelectedDecoration()}findNext(e,t,n){if(!this._terminal||!this._engine)throw Error(`Cannot use addon until it has been loaded`);this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let r=this._findNextAndSelect(e,t,n);return this._fireResults(t),this._state.cachedSearchTerm=e,r}_highlightAllMatches(e,t){if(!this._terminal||!this._engine||!this._decorationManager)throw Error(`Cannot use addon until it has been loaded`);if(!this._state.isValidSearchTerm(e)){this.clearDecorations();return}this.clearDecorations(!0);let n=[],r,i=this._engine.find(e,0,0,t);for(;i&&(r?.row!==i.row||r?.col!==i.col)&&!(n.length>=this._highlightLimit);)r=i,n.push(r),i=this._engine.find(e,r.col+r.term.length>=this._terminal.cols?r.row+1:r.row,r.col+r.term.length>=this._terminal.cols?0:r.col+1,t);this._resultTracker.updateResults(n,this._highlightLimit),t.decorations&&this._decorationManager.createHighlightDecorations(n,t.decorations)}_findNextAndSelect(e,t,n){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let r=this._engine.findNextWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(r,t?.decorations,n?.noScroll)}findPrevious(e,t,n){if(!this._terminal||!this._engine)throw Error(`Cannot use addon until it has been loaded`);this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let r=this._findPreviousAndSelect(e,t,n);return this._fireResults(t),this._state.cachedSearchTerm=e,r}_fireResults(e){this._resultTracker.fireResultsChanged(!!e?.decorations)}_findPreviousAndSelect(e,t,n){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let r=this._engine.findPreviousWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(r,t?.decorations,n?.noScroll)}_selectResult(e,t,n){if(!this._terminal||!this._decorationManager)return!1;if(this._resultTracker.clearSelectedDecoration(),!e)return this._terminal.clearSelection(),!1;if(this._terminal.select(e.col,e.row,e.size),t){let n=this._decorationManager.createActiveDecoration(e,t);n&&(this._resultTracker.selectedDecoration=n)}if(!n&&(e.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||e.row<this._terminal.buffer.active.viewportY)){let t=e.row-this._terminal.buffer.active.viewportY;t-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(t)}return!0}},Pw=0,Fw=0,Iw=0,Lw=0,Rw;(e=>{function t(e,t,n,r){return r===void 0?`#${Uw(e)}${Uw(t)}${Uw(n)}`:`#${Uw(e)}${Uw(t)}${Uw(n)}${Uw(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})(Rw||={});var zw;(e=>{function t(e,t){if(Lw=(t.rgba&255)/255,Lw===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return Pw=a+Math.round((n-a)*Lw),Fw=o+Math.round((r-o)*Lw),Iw=s+Math.round((i-s)*Lw),{css:Rw.toCss(Pw,Fw,Iw),rgba:Rw.toRgba(Pw,Fw,Iw)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=Hw.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return Rw.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[Pw,Fw,Iw]=Hw.toChannels(t),{css:Rw.toCss(Pw,Fw,Iw),rgba:t}}e.opaque=i;function a(e,t){return Lw=Math.round(t*255),[Pw,Fw,Iw]=Hw.toChannels(e.rgba),{css:Rw.toCss(Pw,Fw,Iw,Lw),rgba:Rw.toRgba(Pw,Fw,Iw,Lw)}}e.opacity=a;function o(e,t){return Lw=e.rgba&255,a(e,Lw*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(zw||={});var Bw;(e=>{let t,n;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let r=e.getContext(`2d`,{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation=`copy`,n=t.createLinearGradient(0,0,1,1))}catch{}function r(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return Pw=parseInt(e.slice(1,2).repeat(2),16),Fw=parseInt(e.slice(2,3).repeat(2),16),Iw=parseInt(e.slice(3,4).repeat(2),16),Rw.toColor(Pw,Fw,Iw);case 5:return Pw=parseInt(e.slice(1,2).repeat(2),16),Fw=parseInt(e.slice(2,3).repeat(2),16),Iw=parseInt(e.slice(3,4).repeat(2),16),Lw=parseInt(e.slice(4,5).repeat(2),16),Rw.toColor(Pw,Fw,Iw,Lw);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let r=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(r)return Pw=parseInt(r[1]),Fw=parseInt(r[2]),Iw=parseInt(r[3]),Lw=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),Rw.toColor(Pw,Fw,Iw,Lw);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[Pw,Fw,Iw,Lw]=t.getImageData(0,0,1,1).data,Lw!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:Rw.toRgba(Pw,Fw,Iw,Lw),css:e}}e.toColor=r})(Bw||={});var Vw;(e=>{function t(e){return n(e>>16&255,e>>8&255,e&255)}e.relativeLuminance=t;function n(e,t,n){let r=e/255,i=t/255,a=n/255,o=r<=.03928?r/12.92:((r+.055)/1.055)**2.4,s=i<=.03928?i/12.92:((i+.055)/1.055)**2.4,c=a<=.03928?a/12.92:((a+.055)/1.055)**2.4;return o*.2126+s*.7152+c*.0722}e.relativeLuminance2=n})(Vw||={});var Hw;(e=>{function t(e,t){if(Lw=(t&255)/255,Lw===1)return t;let n=t>>24&255,r=t>>16&255,i=t>>8&255,a=e>>24&255,o=e>>16&255,s=e>>8&255;return Pw=a+Math.round((n-a)*Lw),Fw=o+Math.round((r-o)*Lw),Iw=s+Math.round((i-s)*Lw),Rw.toRgba(Pw,Fw,Iw)}e.blend=t;function n(e,t,n){let a=Vw.relativeLuminance(e>>8),o=Vw.relativeLuminance(t>>8);if(Ww(a,o)<n){if(o<a){let o=r(e,t,n),s=Ww(a,Vw.relativeLuminance(o>>8));if(s<n){let r=i(e,t,n);return s>Ww(a,Vw.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=Ww(a,Vw.relativeLuminance(s>>8));if(c<n){let i=r(e,t,n);return c>Ww(a,Vw.relativeLuminance(i>>8))?s:i}return s}}e.ensureContrastRatio=n;function r(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=Ww(Vw.relativeLuminance2(o,s,c),Vw.relativeLuminance2(r,i,a));for(;l<n&&(o>0||s>0||c>0);)o-=Math.max(0,Math.ceil(o*.1)),s-=Math.max(0,Math.ceil(s*.1)),c-=Math.max(0,Math.ceil(c*.1)),l=Ww(Vw.relativeLuminance2(o,s,c),Vw.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.reduceLuminance=r;function i(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=Ww(Vw.relativeLuminance2(o,s,c),Vw.relativeLuminance2(r,i,a));for(;l<n&&(o<255||s<255||c<255);)o=Math.min(255,o+Math.ceil((255-o)*.1)),s=Math.min(255,s+Math.ceil((255-s)*.1)),c=Math.min(255,c+Math.ceil((255-c)*.1)),l=Ww(Vw.relativeLuminance2(o,s,c),Vw.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.increaseLuminance=i;function a(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]}e.toChannels=a})(Hw||={});function Uw(e){let t=e.toString(16);return t.length<2?`0`+t:t}function Ww(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var Gw=Object.freeze((()=>{let e=[Bw.toColor(`#2e3436`),Bw.toColor(`#cc0000`),Bw.toColor(`#4e9a06`),Bw.toColor(`#c4a000`),Bw.toColor(`#3465a4`),Bw.toColor(`#75507b`),Bw.toColor(`#06989a`),Bw.toColor(`#d3d7cf`),Bw.toColor(`#555753`),Bw.toColor(`#ef2929`),Bw.toColor(`#8ae234`),Bw.toColor(`#fce94f`),Bw.toColor(`#729fcf`),Bw.toColor(`#ad7fa8`),Bw.toColor(`#34e2e2`),Bw.toColor(`#eeeeec`)],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],a=t[n%6];e.push({css:Rw.toCss(r,i,a),rgba:Rw.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+t*10;e.push({css:Rw.toCss(n,n,n),rgba:Rw.toRgba(n,n,n)})}return e})());function Kw(e,t,n){return Math.max(t,Math.min(e,n))}function qw(e){switch(e){case`&`:return`&`;case`<`:return`<`}return e}var Jw=class{constructor(e){this._buffer=e}serialize(e,t){let n=this._buffer.getNullCell(),r=this._buffer.getNullCell(),i=n,a=e.start.y,o=e.end.y,s=e.start.x,c=e.end.x;this._beforeSerialize(o-a,a,o);for(let t=a;t<=o;t++){let a=this._buffer.getLine(t);if(a){let o=t===e.start.y?s:0,l=t===e.end.y?c:a.length;for(let e=o;e<l;e++){let o=a.getCell(e,i===n?r:n);if(!o){console.warn(`Can't get cell at row=${t}, col=${e}`);continue}this._nextCell(o,i,t,e),i=o}}this._rowEnd(t,t===o)}return this._afterSerialize(),this._serializeString(t)}_nextCell(e,t,n,r){}_rowEnd(e,t){}_beforeSerialize(e,t,n){}_afterSerialize(){}_serializeString(e){return``}};function Yw(e,t){return e.getFgColorMode()===t.getFgColorMode()&&e.getFgColor()===t.getFgColor()}function Xw(e,t){return e.getBgColorMode()===t.getBgColorMode()&&e.getBgColor()===t.getBgColor()}function Zw(e,t){return e.isInverse()===t.isInverse()&&e.isBold()===t.isBold()&&e.isUnderline()===t.isUnderline()&&e.isOverline()===t.isOverline()&&e.isBlink()===t.isBlink()&&e.isInvisible()===t.isInvisible()&&e.isItalic()===t.isItalic()&&e.isDim()===t.isDim()&&e.isStrikethrough()===t.isStrikethrough()}var Qw=class extends Jw{constructor(e,t){super(e),this._terminal=t,this._rowIndex=0,this._allRows=[],this._allRowSeparators=[],this._currentRow=``,this._nullCellCount=0,this._cursorStyle=this._buffer.getNullCell(),this._cursorStyleRow=0,this._cursorStyleCol=0,this._backgroundCell=this._buffer.getNullCell(),this._firstRow=0,this._lastCursorRow=0,this._lastCursorCol=0,this._lastContentCursorRow=0,this._lastContentCursorCol=0,this._thisRowLastChar=this._buffer.getNullCell(),this._thisRowLastSecondChar=this._buffer.getNullCell(),this._nextRowFirstChar=this._buffer.getNullCell()}_beforeSerialize(e,t,n){this._allRows=Array(e),this._lastContentCursorRow=t,this._lastCursorRow=t,this._firstRow=t}_rowEnd(e,t){this._nullCellCount>0&&!Xw(this._cursorStyle,this._backgroundCell)&&(this._currentRow+=`\x1B[${this._nullCellCount}X`);let n=``;if(!t){e-this._firstRow>=this._terminal.rows&&this._buffer.getLine(this._cursorStyleRow)?.getCell(this._cursorStyleCol,this._backgroundCell);let t=this._buffer.getLine(e),r=this._buffer.getLine(e+1);if(!r.isWrapped)n=`\r
|
|
29
|
-
`,this._lastCursorRow=e+1,this._lastCursorCol=0;else{n=``;let i=t.getCell(t.length-1,this._thisRowLastChar),a=t.getCell(t.length-2,this._thisRowLastSecondChar),o=r.getCell(0,this._nextRowFirstChar),s=o.getWidth()>1,c=!1;(o.getChars()&&s?this._nullCellCount<=1:this._nullCellCount<=0)&&((i.getChars()||i.getWidth()===0)&&Xw(i,o)&&(c=!0),s&&(a.getChars()||a.getWidth()===0)&&Xw(i,o)&&Xw(a,o)&&(c=!0)),c||(n=`-`.repeat(this._nullCellCount+1),n+=`\x1B[1D\x1B[1X`,this._nullCellCount>0&&(n+=`\x1B[A`,n+=`\x1B[${t.length-this._nullCellCount}C`,n+=`\x1B[${this._nullCellCount}X`,n+=`\x1B[${t.length-this._nullCellCount}D`,n+=`\x1B[B`),this._lastContentCursorRow=e+1,this._lastContentCursorCol=0,this._lastCursorRow=e+1,this._lastCursorCol=0)}}this._allRows[this._rowIndex]=this._currentRow,this._allRowSeparators[this._rowIndex++]=n,this._currentRow=``,this._nullCellCount=0}_diffStyle(e,t){let n=[],r=!Yw(e,t),i=!Xw(e,t),a=!Zw(e,t);if(r||i||a){if(e.isAttributeDefault())t.isAttributeDefault()||n.push(0);else{if(r){let t=e.getFgColor();e.isFgRGB()?n.push(38,2,t>>>16&255,t>>>8&255,t&255):e.isFgPalette()?t>=16?n.push(38,5,t):n.push(t&8?90+(t&7):30+(t&7)):n.push(39)}if(i){let t=e.getBgColor();e.isBgRGB()?n.push(48,2,t>>>16&255,t>>>8&255,t&255):e.isBgPalette()?t>=16?n.push(48,5,t):n.push(t&8?100+(t&7):40+(t&7)):n.push(49)}a&&(e.isInverse()!==t.isInverse()&&n.push(e.isInverse()?7:27),e.isBold()!==t.isBold()&&n.push(e.isBold()?1:22),e.isUnderline()!==t.isUnderline()&&n.push(e.isUnderline()?4:24),e.isOverline()!==t.isOverline()&&n.push(e.isOverline()?53:55),e.isBlink()!==t.isBlink()&&n.push(e.isBlink()?5:25),e.isInvisible()!==t.isInvisible()&&n.push(e.isInvisible()?8:28),e.isItalic()!==t.isItalic()&&n.push(e.isItalic()?3:23),e.isDim()!==t.isDim()&&n.push(e.isDim()?2:22),e.isStrikethrough()!==t.isStrikethrough()&&n.push(e.isStrikethrough()?9:29))}}return n}_nextCell(e,t,n,r){if(e.getWidth()===0)return;let i=e.getChars()===``,a=this._diffStyle(e,this._cursorStyle);if(i?!Xw(this._cursorStyle,e):a.length>0){this._nullCellCount>0&&(Xw(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._lastContentCursorRow=this._lastCursorRow=n,this._lastContentCursorCol=this._lastCursorCol=r,this._currentRow+=`\x1B[${a.join(`;`)}m`;let e=this._buffer.getLine(n);e!==void 0&&(e.getCell(r,this._cursorStyle),this._cursorStyleRow=n,this._cursorStyleCol=r)}i?this._nullCellCount+=e.getWidth():(this._nullCellCount>0&&(Xw(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._currentRow+=e.getChars(),this._lastContentCursorRow=this._lastCursorRow=n,this._lastContentCursorCol=this._lastCursorCol=r+e.getWidth())}_serializeString(e){let t=this._allRows.length;this._buffer.length-this._firstRow<=this._terminal.rows&&(t=this._lastContentCursorRow+1-this._firstRow,this._lastCursorCol=this._lastContentCursorCol,this._lastCursorRow=this._lastContentCursorRow);let n=``;for(let e=0;e<t;e++)n+=this._allRows[e],e+1<t&&(n+=this._allRowSeparators[e]);if(!e){let e=this._buffer.baseY+this._buffer.cursorY,t=this._buffer.cursorX;(e!==this._lastCursorRow||t!==this._lastCursorCol)&&((e=>{e>0?n+=`\x1B[${e}B`:e<0&&(n+=`\x1B[${-e}A`)})(e-this._lastCursorRow),(e=>{e>0?n+=`\x1B[${e}C`:e<0&&(n+=`\x1B[${-e}D`)})(t-this._lastCursorCol))}let r=this._terminal._core._inputHandler._curAttrData,i=this._diffStyle(r,this._cursorStyle);return i.length>0&&(n+=`\x1B[${i.join(`;`)}m`),n}},$w=class{activate(e){this._terminal=e}_serializeBufferByScrollback(e,t,n){let r=t.length,i=n===void 0?r:Kw(n+e.rows,0,r);return this._serializeBufferByRange(e,t,{start:r-i,end:r-1},!1)}_serializeBufferByRange(e,t,n,r){return new Qw(t,e).serialize({start:{x:0,y:typeof n.start==`number`?n.start:n.start.line},end:{x:e.cols,y:typeof n.end==`number`?n.end:n.end.line}},r)}_serializeBufferAsHTML(e,t){let n=e.buffer.active,r=new eT(n,e,t),i=t.onlySelection??!1,a=t.range;if(a)return r.serialize({start:{x:a.startCol,y:(a.startLine,a.startLine)},end:{x:e.cols,y:(a.endLine,a.endLine)}});if(!i){let i=n.length,a=t.scrollback,o=a===void 0?i:Kw(a+e.rows,0,i);return r.serialize({start:{x:0,y:i-o},end:{x:e.cols,y:i-1}})}let o=this._terminal?.getSelectionPosition();return o===void 0?``:r.serialize({start:{x:o.start.x,y:o.start.y},end:{x:o.end.x,y:o.end.y}})}_serializeModes(e){let t=``,n=e.modes;if(n.applicationCursorKeysMode&&(t+=`\x1B[?1h`),n.applicationKeypadMode&&(t+=`\x1B[?66h`),n.bracketedPasteMode&&(t+=`\x1B[?2004h`),n.insertMode&&(t+=`\x1B[4h`),n.originMode&&(t+=`\x1B[?6h`),n.reverseWraparoundMode&&(t+=`\x1B[?45h`),n.sendFocusMode&&(t+=`\x1B[?1004h`),n.wraparoundMode===!1&&(t+=`\x1B[?7l`),n.mouseTrackingMode!==`none`)switch(n.mouseTrackingMode){case`x10`:t+=`\x1B[?9h`;break;case`vt200`:t+=`\x1B[?1000h`;break;case`drag`:t+=`\x1B[?1002h`;break;case`any`:t+=`\x1B[?1003h`}return t}serialize(e){if(!this._terminal)throw Error(`Cannot use addon until it has been loaded`);let t=e?.range?this._serializeBufferByRange(this._terminal,this._terminal.buffer.normal,e.range,!0):this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.normal,e?.scrollback);if(!e?.excludeAltBuffer&&this._terminal.buffer.active.type===`alternate`){let e=this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.alternate,void 0);t+=`\x1B[?1049h\x1B[H${e}`}return e?.excludeModes||(t+=this._serializeModes(this._terminal)),t}serializeAsHTML(e){if(!this._terminal)throw Error(`Cannot use addon until it has been loaded`);return this._serializeBufferAsHTML(this._terminal,e||{})}dispose(){}},eT=class extends Jw{constructor(e,t,n){super(e),this._terminal=t,this._options=n,this._currentRow=``,this._htmlContent=``,this._ansiColors=t._core._themeService?t._core._themeService.colors.ansi:Gw}_padStart(e,t,n){return t>>=0,n??=` `,e.length>t?e:(t-=e.length,t>n.length&&(n+=n.repeat(t/n.length)),n.slice(0,t)+e)}_beforeSerialize(e,t,n){this._htmlContent+=`<html><body><!--StartFragment--><pre>`;let r=`#000000`,i=`#ffffff`;(this._options.includeGlobalBackground??!1)&&(r=this._terminal.options.theme?.foreground??`#ffffff`,i=this._terminal.options.theme?.background??`#000000`);let a=[];a.push(`color: `+r+`;`),a.push(`background-color: `+i+`;`),a.push(`font-family: `+this._terminal.options.fontFamily+`;`),a.push(`font-size: `+this._terminal.options.fontSize+`px;`),this._htmlContent+=`<div style='`+a.join(` `)+`'>`}_afterSerialize(){this._htmlContent+=`</div>`,this._htmlContent+=`</pre><!--EndFragment--></body></html>`}_rowEnd(e,t){this._htmlContent+=`<div><span>`+this._currentRow+`</span></div>`,this._currentRow=``}_getHexColor(e,t){let n=t?e.getFgColor():e.getBgColor();if(t?e.isFgRGB():e.isBgRGB())return`#`+[n>>16&255,n>>8&255,n&255].map(e=>this._padStart(e.toString(16),2,`0`)).join(``);if(t?e.isFgPalette():e.isBgPalette())return this._ansiColors[n].css}_diffStyle(e,t){let n=[],r=!Yw(e,t),i=!Xw(e,t),a=!Zw(e,t);if(r||i||a){let t=this._getHexColor(e,!0);t&&n.push(`color: `+t+`;`);let r=this._getHexColor(e,!1);return r&&n.push(`background-color: `+r+`;`),e.isInverse()&&n.push(`color: #000000; background-color: #BFBFBF;`),e.isBold()&&n.push(`font-weight: bold;`),e.isUnderline()&&e.isOverline()?n.push(`text-decoration: overline underline;`):e.isUnderline()?n.push(`text-decoration: underline;`):e.isOverline()&&n.push(`text-decoration: overline;`),e.isBlink()&&n.push(`text-decoration: blink;`),e.isInvisible()&&n.push(`visibility: hidden;`),e.isItalic()&&n.push(`font-style: italic;`),e.isDim()&&n.push(`opacity: 0.5;`),e.isStrikethrough()&&n.push(`text-decoration: line-through;`),n}}_nextCell(e,t,n,r){if(e.getWidth()===0)return;let i=e.getChars()===``,a=this._diffStyle(e,t);a&&(this._currentRow+=a.length===0?`</span><span>`:`</span><span style='`+a.join(` `)+`'>`),i?this._currentRow+=` `:this._currentRow+=qw(e.getChars())}_serializeString(){return this._htmlContent}},tT=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],nT=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],rT;function iT(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var aT=class{constructor(){if(this.version=`6`,!rT){rT=new Uint8Array(65536),rT.fill(1),rT[0]=0,rT.fill(0,1,32),rT.fill(0,127,160),rT.fill(2,4352,4448),rT[9001]=2,rT[9002]=2,rT.fill(2,11904,42192),rT[12351]=1,rT.fill(2,44032,55204),rT.fill(2,63744,64256),rT.fill(2,65040,65050),rT.fill(2,65072,65136),rT.fill(2,65280,65377),rT.fill(2,65504,65511);for(let e=0;e<tT.length;++e)rT.fill(0,tT[e][0],tT[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?rT[e]:iT(e,nT)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=UT.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return UT.createPropertyValue(0,n,r)}},oT=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?dT.isErrorNoTelemetry(e)?new dT(e.message+`
|
|
30
|
-
|
|
31
|
-
`+e.stack):Error(e.message+`
|
|
32
|
-
|
|
33
|
-
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};function sT(e){lT(e)||oT.onUnexpectedError(e)}var cT=`Canceled`;function lT(e){return e instanceof uT||e instanceof Error&&e.name===cT&&e.message===cT}var uT=class extends Error{constructor(){super(cT),this.name=this.message}},dT=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}};function fT(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var pT;(e=>{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(pT||={});var mT=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>!t(n)||e(n)))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>!e(n)||(t=n,!1)),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||pT.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};mT.empty=new mT(e=>{});var hT;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);t<n;t++)yield e[t]}e.slice=_;function v(t,n=1/0){let r=[];if(n===0)return[r,t];let i=t[Symbol.iterator]();for(let t=0;t<n;t++){let t=i.next();if(t.done)return[r,e.empty()];r.push(t.value)}return[r,{[Symbol.iterator](){return i}}]}e.consume=v;async function y(e){let t=[];for await(let n of e)t.push(n);return Promise.resolve(t)}e.asyncToArray=y})(hT||={});var gT=null;function _T(e){return gT?.trackDisposable(e),e}function vT(e){gT?.markAsDisposed(e)}function yT(e,t){gT?.setParent(e,t)}function bT(e){if(hT.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function xT(...e){return ST(()=>bT(e))}function ST(e){let t=_T({dispose:fT(()=>{vT(t),e()})});return t}var CT=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,_T(this)}dispose(){this._isDisposed||(vT(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{bT(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return yT(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error(`Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!`).stack):this._toDispose.add(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),yT(e,null))}};CT.DISABLE_DISPOSED_WARNING=!1;var wT=CT,TT=class{constructor(){this._store=new wT,_T(this),yT(this._store,this)}dispose(){vT(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}};TT.None=Object.freeze({dispose(){}});var ET=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};ET.Undefined=new ET(void 0);var DT=globalThis.performance&&typeof globalThis.performance.now==`function`,OT=class e{static create(t){return new e(t)}constructor(e){this._now=DT&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime===-1?this._now()-this._startTime:this._stopTime-this._startTime}},kT;(e=>{e.None=()=>TT.None;function t(e,t){return d(e,()=>{},0,void 0,!0,void 0,t)}e.defer=t;function n(e){return(t,n=null,r)=>{let i=!1,a;return a=e(e=>{if(!i)return a?a.dispose():i=!0,t.call(n,e)},null,r),i&&a.dispose(),a}}e.once=n;function r(e,t,n){return l((n,r=null,i)=>e(e=>n.call(r,t(e)),null,i),n)}e.map=r;function i(e,t,n){return l((n,r=null,i)=>e(e=>{t(e),n.call(r,e)},null,i),n)}e.forEach=i;function a(e,t,n){return l((n,r=null,i)=>e(e=>t(e)&&n.call(r,e),null,i),n)}e.filter=a;function o(e){return e}e.signal=o;function s(...e){return(t,n=null,r)=>u(xT(...e.map(e=>e(e=>t.call(n,e)))),r)}e.any=s;function c(e,t,n,i){let a=n;return r(e,e=>(a=t(a,e),a),i)}e.reduce=c;function l(e,t){let n,r=new VT({onWillAddFirstListener(){n=e(r.fire,r)},onDidRemoveLastListener(){n?.dispose()}});return t?.add(r),r.event}function u(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}function d(e,t,n=100,r=!1,i=!1,a,o){let s,c,l,u=0,d,f=new VT({leakWarningThreshold:a,onWillAddFirstListener(){s=e(e=>{u++,c=t(c,e),r&&!l&&(f.fire(c),c=void 0),d=()=>{let e=c;c=void 0,l=void 0,(!r||u>1)&&f.fire(e),u=0},typeof n==`number`?(clearTimeout(l),l=setTimeout(d,n)):l===void 0&&(l=0,queueMicrotask(d))})},onWillRemoveListener(){i&&u>0&&d?.()},onDidRemoveLastListener(){d=void 0,s.dispose()}});return o?.add(f),f.event}e.debounce=d;function f(t,n=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],n,void 0,!0,void 0,r)}e.accumulate=f;function p(e,t=(e,t)=>e===t,n){let r=!0,i;return a(e,e=>{let n=r||!t(e,i);return r=!1,i=e,n},n)}e.latch=p;function m(t,n,r){return[e.filter(t,n,r),e.filter(t,e=>!n(e),r)]}e.split=m;function h(e,t=!1,n=[],r){let i=n.slice(),a=e(e=>{i?i.push(e):s.fire(e)});r&&r.add(a);let o=()=>{i?.forEach(e=>s.fire(e)),i=null},s=new VT({onWillAddFirstListener(){a||(a=e(e=>s.fire(e)),r&&r.add(a))},onDidAddFirstListener(){i&&(t?setTimeout(o):o())},onDidRemoveLastListener(){a&&a.dispose(),a=null}});return r&&r.add(s),s.event}e.buffer=h;function g(e,t){return(n,r,i)=>{let a=t(new v);return e(function(e){let t=a.evaluate(e);t!==_&&n.call(r,t)},void 0,i)}}e.chain=g;let _=Symbol(`HaltChainable`);class v{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:_),this}reduce(e,t){let n=t;return this.steps.push(t=>(n=e(n,t),n)),this}latch(e=(e,t)=>e===t){let t=!0,n;return this.steps.push(r=>{let i=t||!e(r,n);return t=!1,n=r,i?r:_}),this}evaluate(e){for(let t of this.steps)if(e=t(e),e===_)break;return e}}function y(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new VT({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return i.event}e.fromNodeEventEmitter=y;function b(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new VT({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return i.event}e.fromDOMEventEmitter=b;function x(e){return new Promise(t=>n(e)(t))}e.toPromise=x;function S(e){let t=new VT;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event}e.fromPromise=S;function C(e,t){return e(e=>t.fire(e))}e.forward=C;function w(e,t,n){return t(n),e(e=>t(e))}e.runAndSubscribe=w;class T{constructor(e,t){this._observable=e,this._counter=0,this._hasChanged=!1;let n={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};this.emitter=new VT(n),t&&t.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function E(e,t){return new T(e,t).emitter.event}e.fromObservable=E;function D(e){return(t,n,r)=>{let i=0,a=!1,o={beginUpdate(){i++},endUpdate(){i--,i===0&&(e.reportChanges(),a&&(a=!1,t.call(n)))},handlePossibleChange(){},handleChange(){a=!0}};e.addObserver(o),e.reportChanges();let s={dispose(){e.removeObserver(o)}};return r instanceof wT?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=D})(kT||={});var AT=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new OT,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};AT.all=new Set,AT._idPool=0;var jT=AT,MT=-1,NT=class e{constructor(t,n,r=(e._idPool++).toString(16).padStart(3,`0`)){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t<n)return;this._stacks||=new Map;let r=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,r+1),--this._warnCountdown,this._warnCountdown<=0){this._warnCountdown=n*.5;let[e,r]=this.getMostFrequentStack(),i=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${r}):`;console.warn(i),console.warn(e);let a=new IT(i,e);this._errorHandler(a)}return()=>{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[n,r]of this._stacks)(!e||t<r)&&(e=[n,r],t=r);return e}};NT._idPool=1;var PT=NT,FT=class e{constructor(e){this.value=e}static create(){return new e(Error().stack??``)}print(){console.warn(this.value.split(`
|
|
34
|
-
`).slice(2).join(`
|
|
35
|
-
`))}},IT=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},LT=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},RT=0,zT=class{constructor(e){this.value=e,this.id=RT++}},BT=2,VT=class{constructor(e){this._size=0,this._options=e,this._leakageMon=MT>0||this._options?.leakWarningThreshold?new PT(e?.onListenerError??sT,this._options?.leakWarningThreshold??MT):void 0,this._perfMon=this._options?._profName?new jT(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new LT(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||sT)(n),TT.None}if(this._disposed)return TT.None;t&&(e=e.bind(t));let r=new zT(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=FT.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof zT?(this._deliveryQueue??=new HT,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=ST(()=>{i?.(),this._removeListener(r)});return n instanceof wT?n.add(a):Array.isArray(n)&&n.push(a),a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*BT<=t.length){let e=0;for(let n=0;n<t.length;n++)t[n]?t[e++]=t[n]:r&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=e}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||sT;if(!n){e.value(t);return}try{e.value(t)}catch(e){n(e)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners){if(this._listeners instanceof zT)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}}this._perfMon?.stop()}hasListeners(){return this._size>0}},HT=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},UT=class e{constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new VT,this.onChange=this._onChange.event;let e=new aT;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return!!(e&1)}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,n=!1){return(e&16777215)<<3|(t&3)<<1|!!n}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(t){let n=0,r=0,i=t.length;for(let a=0;a<i;++a){let o=t.charCodeAt(a);if(55296<=o&&o<=56319){if(++a>=i)return n+this.wcwidth(o);let e=t.charCodeAt(a);56320<=e&&e<=57343?o=(o-55296)*1024+e-56320+65536:n+=this.wcwidth(e)}let s=this.charProperties(o,r),c=e.extractWidth(s);e.extractShouldJoin(s)&&(c-=e.extractWidth(r)),n+=c,r=s}return n}charProperties(e,t){return this._activeProvider.charProperties(e,t)}},WT=[[768,879],[1155,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1541],[1552,1562],[1564,1564],[1611,1631],[1648,1648],[1750,1757],[1759,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2045,2045],[2070,2073],[2075,2083],[2085,2087],[2089,2093],[2137,2139],[2259,2306],[2362,2362],[2364,2364],[2369,2376],[2381,2381],[2385,2391],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2558,2558],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2641,2641],[2672,2673],[2677,2677],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2810,2815],[2817,2817],[2876,2876],[2879,2879],[2881,2884],[2893,2893],[2902,2902],[2914,2915],[2946,2946],[3008,3008],[3021,3021],[3072,3072],[3076,3076],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3170,3171],[3201,3201],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3328,3329],[3387,3388],[3393,3396],[3405,3405],[3426,3427],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3981,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4151],[4153,4154],[4157,4158],[4184,4185],[4190,4192],[4209,4212],[4226,4226],[4229,4230],[4237,4237],[4253,4253],[4448,4607],[4957,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6158],[6277,6278],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6683,6683],[6742,6742],[6744,6750],[6752,6752],[6754,6754],[6757,6764],[6771,6780],[6783,6783],[6832,6846],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7040,7041],[7074,7077],[7080,7081],[7083,7085],[7142,7142],[7144,7145],[7149,7149],[7151,7153],[7212,7219],[7222,7223],[7376,7378],[7380,7392],[7394,7400],[7405,7405],[7412,7412],[7416,7417],[7616,7673],[7675,7679],[8203,8207],[8234,8238],[8288,8292],[8294,8303],[8400,8432],[11503,11505],[11647,11647],[11744,11775],[12330,12333],[12441,12442],[42607,42610],[42612,42621],[42654,42655],[42736,42737],[43010,43010],[43014,43014],[43019,43019],[43045,43046],[43204,43205],[43232,43249],[43263,43263],[43302,43309],[43335,43345],[43392,43394],[43443,43443],[43446,43449],[43452,43453],[43493,43493],[43561,43566],[43569,43570],[43573,43574],[43587,43587],[43596,43596],[43644,43644],[43696,43696],[43698,43700],[43703,43704],[43710,43711],[43713,43713],[43756,43757],[43766,43766],[44005,44005],[44008,44008],[44013,44013],[64286,64286],[65024,65039],[65056,65071],[65279,65279],[65529,65531]],GT=[[66045,66045],[66272,66272],[66422,66426],[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[68325,68326],[68900,68903],[69446,69456],[69633,69633],[69688,69702],[69759,69761],[69811,69814],[69817,69818],[69821,69821],[69837,69837],[69888,69890],[69927,69931],[69933,69940],[70003,70003],[70016,70017],[70070,70078],[70089,70092],[70191,70193],[70196,70196],[70198,70199],[70206,70206],[70367,70367],[70371,70378],[70400,70401],[70459,70460],[70464,70464],[70502,70508],[70512,70516],[70712,70719],[70722,70724],[70726,70726],[70750,70750],[70835,70840],[70842,70842],[70847,70848],[70850,70851],[71090,71093],[71100,71101],[71103,71104],[71132,71133],[71219,71226],[71229,71229],[71231,71232],[71339,71339],[71341,71341],[71344,71349],[71351,71351],[71453,71455],[71458,71461],[71463,71467],[71727,71735],[71737,71738],[72148,72151],[72154,72155],[72160,72160],[72193,72202],[72243,72248],[72251,72254],[72263,72263],[72273,72278],[72281,72283],[72330,72342],[72344,72345],[72752,72758],[72760,72765],[72767,72767],[72850,72871],[72874,72880],[72882,72883],[72885,72886],[73009,73014],[73018,73018],[73020,73021],[73023,73029],[73031,73031],[73104,73105],[73109,73109],[73111,73111],[73459,73460],[78896,78904],[92912,92916],[92976,92982],[94031,94031],[94095,94098],[113821,113822],[113824,113827],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[121344,121398],[121403,121452],[121461,121461],[121476,121476],[121499,121503],[121505,121519],[122880,122886],[122888,122904],[122907,122913],[122915,122916],[122918,122922],[123184,123190],[123628,123631],[125136,125142],[125252,125258],[917505,917505],[917536,917631],[917760,917999]],KT=[[4352,4447],[8986,8987],[9001,9002],[9193,9196],[9200,9200],[9203,9203],[9725,9726],[9748,9749],[9800,9811],[9855,9855],[9875,9875],[9889,9889],[9898,9899],[9917,9918],[9924,9925],[9934,9934],[9940,9940],[9962,9962],[9970,9971],[9973,9973],[9978,9978],[9981,9981],[9989,9989],[9994,9995],[10024,10024],[10060,10060],[10062,10062],[10067,10069],[10071,10071],[10133,10135],[10160,10160],[10175,10175],[11035,11036],[11088,11088],[11093,11093],[11904,11929],[11931,12019],[12032,12245],[12272,12283],[12288,12329],[12334,12350],[12353,12438],[12443,12543],[12549,12591],[12593,12686],[12688,12730],[12736,12771],[12784,12830],[12832,12871],[12880,19903],[19968,42124],[42128,42182],[43360,43388],[44032,55203],[63744,64255],[65040,65049],[65072,65106],[65108,65126],[65128,65131],[65281,65376],[65504,65510]],qT=[[94176,94179],[94208,100343],[100352,101106],[110592,110878],[110928,110930],[110948,110951],[110960,111355],[126980,126980],[127183,127183],[127374,127374],[127377,127386],[127488,127490],[127504,127547],[127552,127560],[127568,127569],[127584,127589],[127744,127776],[127789,127797],[127799,127868],[127870,127891],[127904,127946],[127951,127955],[127968,127984],[127988,127988],[127992,128062],[128064,128064],[128066,128252],[128255,128317],[128331,128334],[128336,128359],[128378,128378],[128405,128406],[128420,128420],[128507,128591],[128640,128709],[128716,128716],[128720,128722],[128725,128725],[128747,128748],[128756,128762],[128992,129003],[129293,129393],[129395,129398],[129402,129442],[129445,129450],[129454,129482],[129485,129535],[129648,129651],[129656,129658],[129664,129666],[129680,129685],[131072,196605],[196608,262141]],JT;function YT(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var XT=class{constructor(){if(this.version=`11`,!JT){JT=new Uint8Array(65536),JT.fill(1),JT[0]=0,JT.fill(0,1,32),JT.fill(0,127,160);for(let e=0;e<WT.length;++e)JT.fill(0,WT[e][0],WT[e][1]+1);for(let e=0;e<KT.length;++e)JT.fill(2,KT[e][0],KT[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?JT[e]:YT(e,GT)?0:YT(e,qT)?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=UT.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return UT.createPropertyValue(0,n,r)}},ZT=class{activate(e){e.unicode.register(new XT)}dispose(){}},QT=class{constructor(e,t,n,r={}){this._terminal=e,this._regex=t,this._handler=n,this._options=r}provideLinks(e,t){let n=eE.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(n))}_addCallbacks(e){return e.map(e=>(e.leave=this._options.leave,e.hover=(t,n)=>{if(this._options.hover){let{range:r}=e;this._options.hover(t,n,r)}},e))}};function $T(e){try{let t=new URL(e),n=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(n.toLocaleLowerCase())}catch{return!1}}var eE=class e{static computeLink(t,n,r,i){let a=new RegExp(n.source,(n.flags||``)+`g`),[o,s]=e._getWindowedLineStrings(t-1,r),c=o.join(``),l,u=[];for(;l=a.exec(c);){let t=l[0];if(!$T(t))continue;let[n,a]=e._mapStrIdx(r,s,0,l.index),[o,c]=e._mapStrIdx(r,n,a,t.length);if(n===-1||a===-1||o===-1||c===-1)continue;let d={start:{x:a+1,y:n+1},end:{x:c,y:o+1}};u.push({range:d,text:t,activate:i})}return u}static _getWindowedLineStrings(e,t){let n,r=e,i=e,a=0,o=``,s=[];if(n=t.buffer.active.getLine(e)){let e=n.translateToString(!0);if(n.isWrapped&&e[0]!==` `){for(a=0;(n=t.buffer.active.getLine(--r))&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),!(!n.isWrapped||o.indexOf(` `)!==-1)););s.reverse()}for(s.push(e),a=0;(n=t.buffer.active.getLine(++i))&&n.isWrapped&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),o.indexOf(` `)===-1););}return[s,r]}static _mapStrIdx(e,t,n,r){let i=e.buffer.active,a=i.getNullCell(),o=n;for(;r;){let e=i.getLine(t);if(!e)return[-1,-1];for(let n=o;n<e.length;++n){e.getCell(n,a);let o=a.getChars();if(a.getWidth()&&(r-=o.length||1,n===e.length-1&&o===``)){let e=i.getLine(t+1);e&&e.isWrapped&&(e.getCell(0,a),a.getWidth()===2&&(r+=1))}if(r<0)return[t,n]}t++,o=0}return[t,o]}},tE=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function nE(e,t){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}var rE=class{constructor(e=nE,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,n=t.urlRegex||tE;this._linkProvider=this._terminal.registerLinkProvider(new QT(this._terminal,n,this._handler,t))}dispose(){this._linkProvider?.dispose()}},iE=Object.defineProperty,aE=Object.getOwnPropertyDescriptor,oE=(e,t)=>{for(var n in t)iE(e,n,{get:t[n],enumerable:!0})},sE=(e,t,n,r)=>{for(var i=r>1?void 0:r?aE(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&iE(t,n,i),i},X=(e,t)=>(n,r)=>t(n,r,e),cE=`Terminal input`,lE={get:()=>cE,set:e=>cE=e},uE=`Too much output to announce, navigate to rows manually to read`,dE={get:()=>uE,set:e=>uE=e};function fE(e){return e.replace(/\r?\n/g,`\r`)}function pE(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function mE(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function hE(e,t,n,r){e.stopPropagation(),e.clipboardData&&gE(e.clipboardData.getData(`text/plain`),t,n,r)}function gE(e,t,n,r){e=fE(e),e=pE(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function _E(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function vE(e,t,n,r,i){_E(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function yE(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function bE(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var xE=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},SE=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},CE=``,wE=` `,TE=class e{constructor(){this.fg=0,this.bg=0,this.extended=new EE}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return!(this.fg&50331648)}isBgDefault(){return!(this.bg&50331648)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?!(this.extended.underlineColor&50331648):this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},EE=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},DE=class e extends TE{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new EE,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?yE(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},OE=`di$target`,kE=`di$dependencies`,AE=new Map;function jE(e){return e[kE]||[]}function ME(e){if(AE.has(e))return AE.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);NE(t,e,r)};return t._id=e,AE.set(e,t),t}function NE(e,t,n){t[OE]===t?t[kE].push({id:e,index:n}):(t[kE]=[{id:e,index:n}],t[OE]=t)}var PE=ME(`BufferService`),FE=ME(`CoreMouseService`),IE=ME(`CoreService`),LE=ME(`CharsetService`),RE=ME(`InstantiationService`),zE=ME(`LogService`),BE=ME(`OptionsService`),VE=ME(`OscLinkService`),HE=ME(`UnicodeService`),UE=ME(`DecorationService`),WE=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new DE,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(!(c===-1&&!n.hasContent(t))){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId){if(c===-1){c=t,s=a.extended.urlId;continue}l=a.extended.urlId!==s}else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):GE(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};WE=sE([X(0,PE),X(1,BE),X(2,VE)],WE);function GE(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
36
|
-
|
|
37
|
-
WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var KE=ME(`CharSizeService`),qE=ME(`CoreBrowserService`),JE=ME(`MouseService`),YE=ME(`RenderService`),XE=ME(`SelectionService`),ZE=ME(`CharacterJoinerService`),QE=ME(`ThemeService`),$E=ME(`LinkProviderService`),eD=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?oD.isErrorNoTelemetry(e)?new oD(e.message+`
|
|
38
|
-
|
|
39
|
-
`+e.stack):Error(e.message+`
|
|
40
|
-
|
|
41
|
-
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};function tD(e){rD(e)||eD.onUnexpectedError(e)}var nD=`Canceled`;function rD(e){return e instanceof iD||e instanceof Error&&e.name===nD&&e.message===nD}var iD=class extends Error{constructor(){super(nD),this.name=this.message}};function aD(e){return Error(e?`Illegal argument: ${e}`:`Illegal argument`)}var oD=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}},sD=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}};function cD(e,t=0){return e[e.length-(1+t)]}var lD;(e=>{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(lD||={});var uD=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>!t(n)||e(n)))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>!e(n)||(t=n,!1)),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||lD.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};uD.empty=new uD(e=>{});function dD(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var fD;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);t<n;t++)yield e[t]}e.slice=_;function v(t,n=1/0){let r=[];if(n===0)return[r,t];let i=t[Symbol.iterator]();for(let t=0;t<n;t++){let t=i.next();if(t.done)return[r,e.empty()];r.push(t.value)}return[r,{[Symbol.iterator](){return i}}]}e.consume=v;async function y(e){let t=[];for await(let n of e)t.push(n);return Promise.resolve(t)}e.asyncToArray=y})(fD||={});var pD=null;function mD(e){return pD?.trackDisposable(e),e}function hD(e){pD?.markAsDisposed(e)}function gD(e,t){pD?.setParent(e,t)}function _D(e){return pD?.markAsSingleton(e),e}function vD(e){if(fD.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function yD(...e){return bD(()=>vD(e))}function bD(e){let t=mD({dispose:dD(()=>{hD(t),e()})});return t}var xD=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,mD(this)}dispose(){this._isDisposed||(hD(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{vD(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return gD(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error(`Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!`).stack):this._toDispose.add(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),gD(e,null))}};xD.DISABLE_DISPOSED_WARNING=!1;var SD=xD,CD=class{constructor(){this._store=new SD,mD(this),gD(this._store,this)}dispose(){hD(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}};CD.None=Object.freeze({dispose(){}});var wD=class{constructor(){this._isDisposed=!1,mD(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&gD(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,hD(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&gD(e,null),e}},TD=typeof window==`object`?window:globalThis,ED=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};ED.Undefined=new ED(void 0);var DD=ED,OD=class{constructor(){this._first=DD.Undefined,this._last=DD.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===DD.Undefined}clear(){let e=this._first;for(;e!==DD.Undefined;){let t=e.next;e.prev=DD.Undefined,e.next=DD.Undefined,e=t}this._first=DD.Undefined,this._last=DD.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new DD(e);if(this._first===DD.Undefined)this._first=n,this._last=n;else if(t){let e=this._last;this._last=n,n.prev=e,e.next=n}else{let e=this._first;this._first=n,n.next=e,e.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==DD.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==DD.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==DD.Undefined&&e.next!==DD.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===DD.Undefined&&e.next===DD.Undefined?(this._first=DD.Undefined,this._last=DD.Undefined):e.next===DD.Undefined?(this._last=this._last.prev,this._last.next=DD.Undefined):e.prev===DD.Undefined&&(this._first=this._first.next,this._first.prev=DD.Undefined);--this._size}*[Symbol.iterator](){let e=this._first;for(;e!==DD.Undefined;)yield e.element,e=e.next}},kD=globalThis.performance&&typeof globalThis.performance.now==`function`,AD=class e{static create(t){return new e(t)}constructor(e){this._now=kD&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime===-1?this._now()-this._startTime:this._stopTime-this._startTime}},jD;(e=>{e.None=()=>CD.None;function t(e,t){return d(e,()=>{},0,void 0,!0,void 0,t)}e.defer=t;function n(e){return(t,n=null,r)=>{let i=!1,a;return a=e(e=>{if(!i)return a?a.dispose():i=!0,t.call(n,e)},null,r),i&&a.dispose(),a}}e.once=n;function r(e,t,n){return l((n,r=null,i)=>e(e=>n.call(r,t(e)),null,i),n)}e.map=r;function i(e,t,n){return l((n,r=null,i)=>e(e=>{t(e),n.call(r,e)},null,i),n)}e.forEach=i;function a(e,t,n){return l((n,r=null,i)=>e(e=>t(e)&&n.call(r,e),null,i),n)}e.filter=a;function o(e){return e}e.signal=o;function s(...e){return(t,n=null,r)=>u(yD(...e.map(e=>e(e=>t.call(n,e)))),r)}e.any=s;function c(e,t,n,i){let a=n;return r(e,e=>(a=t(a,e),a),i)}e.reduce=c;function l(e,t){let n,r=new Z({onWillAddFirstListener(){n=e(r.fire,r)},onDidRemoveLastListener(){n?.dispose()}});return t?.add(r),r.event}function u(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}function d(e,t,n=100,r=!1,i=!1,a,o){let s,c,l,u=0,d,f=new Z({leakWarningThreshold:a,onWillAddFirstListener(){s=e(e=>{u++,c=t(c,e),r&&!l&&(f.fire(c),c=void 0),d=()=>{let e=c;c=void 0,l=void 0,(!r||u>1)&&f.fire(e),u=0},typeof n==`number`?(clearTimeout(l),l=setTimeout(d,n)):l===void 0&&(l=0,queueMicrotask(d))})},onWillRemoveListener(){i&&u>0&&d?.()},onDidRemoveLastListener(){d=void 0,s.dispose()}});return o?.add(f),f.event}e.debounce=d;function f(t,n=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],n,void 0,!0,void 0,r)}e.accumulate=f;function p(e,t=(e,t)=>e===t,n){let r=!0,i;return a(e,e=>{let n=r||!t(e,i);return r=!1,i=e,n},n)}e.latch=p;function m(t,n,r){return[e.filter(t,n,r),e.filter(t,e=>!n(e),r)]}e.split=m;function h(e,t=!1,n=[],r){let i=n.slice(),a=e(e=>{i?i.push(e):s.fire(e)});r&&r.add(a);let o=()=>{i?.forEach(e=>s.fire(e)),i=null},s=new Z({onWillAddFirstListener(){a||(a=e(e=>s.fire(e)),r&&r.add(a))},onDidAddFirstListener(){i&&(t?setTimeout(o):o())},onDidRemoveLastListener(){a&&a.dispose(),a=null}});return r&&r.add(s),s.event}e.buffer=h;function g(e,t){return(n,r,i)=>{let a=t(new v);return e(function(e){let t=a.evaluate(e);t!==_&&n.call(r,t)},void 0,i)}}e.chain=g;let _=Symbol(`HaltChainable`);class v{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:_),this}reduce(e,t){let n=t;return this.steps.push(t=>(n=e(n,t),n)),this}latch(e=(e,t)=>e===t){let t=!0,n;return this.steps.push(r=>{let i=t||!e(r,n);return t=!1,n=r,i?r:_}),this}evaluate(e){for(let t of this.steps)if(e=t(e),e===_)break;return e}}function y(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new Z({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return i.event}e.fromNodeEventEmitter=y;function b(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new Z({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return i.event}e.fromDOMEventEmitter=b;function x(e){return new Promise(t=>n(e)(t))}e.toPromise=x;function S(e){let t=new Z;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event}e.fromPromise=S;function C(e,t){return e(e=>t.fire(e))}e.forward=C;function w(e,t,n){return t(n),e(e=>t(e))}e.runAndSubscribe=w;class T{constructor(e,t){this._observable=e,this._counter=0,this._hasChanged=!1;let n={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};this.emitter=new Z(n),t&&t.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function E(e,t){return new T(e,t).emitter.event}e.fromObservable=E;function D(e){return(t,n,r)=>{let i=0,a=!1,o={beginUpdate(){i++},endUpdate(){i--,i===0&&(e.reportChanges(),a&&(a=!1,t.call(n)))},handlePossibleChange(){},handleChange(){a=!0}};e.addObserver(o),e.reportChanges();let s={dispose(){e.removeObserver(o)}};return r instanceof SD?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=D})(jD||={});var MD=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new AD,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};MD.all=new Set,MD._idPool=0;var ND=MD,PD=-1,FD=class e{constructor(t,n,r=(e._idPool++).toString(16).padStart(3,`0`)){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t<n)return;this._stacks||=new Map;let r=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,r+1),--this._warnCountdown,this._warnCountdown<=0){this._warnCountdown=n*.5;let[e,r]=this.getMostFrequentStack(),i=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${r}):`;console.warn(i),console.warn(e);let a=new RD(i,e);this._errorHandler(a)}return()=>{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[n,r]of this._stacks)(!e||t<r)&&(e=[n,r],t=r);return e}};FD._idPool=1;var ID=FD,LD=class e{constructor(e){this.value=e}static create(){return new e(Error().stack??``)}print(){console.warn(this.value.split(`
|
|
42
|
-
`).slice(2).join(`
|
|
43
|
-
`))}},RD=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},zD=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},BD=0,VD=class{constructor(e){this.value=e,this.id=BD++}},HD=2,Z=class{constructor(e){this._size=0,this._options=e,this._leakageMon=PD>0||this._options?.leakWarningThreshold?new ID(e?.onListenerError??tD,this._options?.leakWarningThreshold??PD):void 0,this._perfMon=this._options?._profName?new ND(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new zD(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||tD)(n),CD.None}if(this._disposed)return CD.None;t&&(e=e.bind(t));let r=new VD(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=LD.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof VD?(this._deliveryQueue??=new UD,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=bD(()=>{i?.(),this._removeListener(r)});return n instanceof SD?n.add(a):Array.isArray(n)&&n.push(a),a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*HD<=t.length){let e=0;for(let n=0;n<t.length;n++)t[n]?t[e++]=t[n]:r&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=e}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||tD;if(!n){e.value(t);return}try{e.value(t)}catch(e){n(e)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners){if(this._listeners instanceof VD)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}}this._perfMon?.stop()}hasListeners(){return this._size>0}},UD=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},WD=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Z,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Z,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};WD.INSTANCE=new WD;var GD=WD;function KD(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}GD.INSTANCE.onDidChangeZoomLevel;function qD(e){return GD.INSTANCE.getZoomFactor(e)}GD.INSTANCE.onDidChangeFullscreen;var JD=typeof navigator==`object`?navigator.userAgent:``,YD=JD.indexOf(`Firefox`)>=0,XD=JD.indexOf(`AppleWebKit`)>=0,ZD=JD.indexOf(`Chrome`)>=0,QD=!ZD&&JD.indexOf(`Safari`)>=0;JD.indexOf(`Electron/`),JD.indexOf(`Android`);var $D=!1;if(typeof TD.matchMedia==`function`){let e=TD.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=TD.matchMedia(`(display-mode: fullscreen)`);$D=e.matches,KD(TD,e,({matches:e})=>{$D&&t.matches||($D=e)})}function eO(){return $D}var tO=`en`,nO=!1,rO=!1,iO=!1,aO=!1,oO=!1,sO=tO,cO,lO=globalThis,uO;typeof lO.vscode<`u`&&typeof lO.vscode.process<`u`?uO=lO.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(uO=process);var dO=typeof uO?.versions?.electron==`string`&&uO?.type===`renderer`;if(typeof uO==`object`){nO=uO.platform===`win32`,rO=uO.platform===`darwin`,iO=uO.platform===`linux`,iO&&uO.env.SNAP&&uO.env.SNAP_REVISION,uO.env.CI||uO.env.BUILD_ARTIFACTSTAGINGDIRECTORY,sO=tO;let e=uO.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,sO=t.resolvedLanguage||tO,t.languagePack?.translationsConfigFile}catch{}aO=!0}else typeof navigator==`object`&&!dO?(cO=navigator.userAgent,nO=cO.indexOf(`Windows`)>=0,rO=cO.indexOf(`Macintosh`)>=0,(cO.indexOf(`Macintosh`)>=0||cO.indexOf(`iPad`)>=0||cO.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,iO=cO.indexOf(`Linux`)>=0,cO?.indexOf(`Mobi`),oO=!0,sO=globalThis._VSCODE_NLS_LANGUAGE||tO,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);var fO=nO,pO=rO,mO=iO,hO=aO;oO&&typeof lO.importScripts==`function`&&lO.origin;var gO=cO,_O=sO,vO;(e=>{function t(){return _O}e.value=t;function n(){return _O.length===2?_O===`en`:_O.length>=3&&_O[0]===`e`&&_O[1]===`n`&&_O[2]===`-`}e.isDefaultVariant=n;function r(){return _O===`en`}e.isDefault=r})(vO||={});var yO=typeof lO.postMessage==`function`&&!lO.importScripts;(()=>{if(yO){let e=[];lO.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r.id===t.data.vscodeScheduleAsyncWork){e.splice(n,1),r.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),lO.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var bO=!!(gO&&gO.indexOf(`Chrome`)>=0);gO&&gO.indexOf(`Firefox`),!bO&&gO&&gO.indexOf(`Safari`),gO&&gO.indexOf(`Edg/`),gO&&gO.indexOf(`Android`);var xO=typeof navigator==`object`?navigator:{};hO||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||xO&&xO.clipboard&&xO.clipboard.writeText,hO||xO&&xO.clipboard&&xO.clipboard.readText,hO||eO()||xO.keyboard,`ontouchstart`in TD||xO.maxTouchPoints,TD.PointerEvent&&(`ontouchstart`in TD||navigator.maxTouchPoints);var SO=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},CO=new SO,wO=new SO,TO=new SO,EO=Array(230),DO;(e=>{function t(e){return CO.keyCodeToStr(e)}e.toString=t;function n(e){return CO.strToKeyCode(e)}e.fromString=n;function r(e){return wO.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return TO.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return wO.strToKeyCode(e)||TO.strToKeyCode(e)}e.fromUserSettings=a;function o(e){if(e>=98&&e<=113)return null;switch(e){case 16:return`Up`;case 18:return`Down`;case 15:return`Left`;case 17:return`Right`}return CO.keyCodeToStr(e)}e.toElectronAccelerator=o})(DO||={});var OO=class e{constructor(e,t,n,r,i){this.ctrlKey=e,this.shiftKey=t,this.altKey=n,this.metaKey=r,this.keyCode=i}equals(t){return t instanceof e&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){return`K${this.ctrlKey?`1`:`0`}${this.shiftKey?`1`:`0`}${this.altKey?`1`:`0`}${this.metaKey?`1`:`0`}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new kO([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},kO=class{constructor(e){if(e.length===0)throw aD(`chords`);this.chords=e}getHashCode(){let e=``;for(let t=0,n=this.chords.length;t<n;t++)t!==0&&(e+=`;`),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function AO(e){if(e.charCode){let t=String.fromCharCode(e.charCode).toUpperCase();return DO.fromString(t)}let t=e.keyCode;if(t===3)return 7;if(YD)switch(t){case 59:return 85;case 60:if(mO)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(pO)return 57}else if(XD&&(pO&&t===93||!pO&&t===92))return 57;return EO[t]||0}var jO=pO?256:2048,MO=512,NO=1024,PO=pO?2048:256,FO=class{constructor(e){this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=t.getModifierState?.(`AltGraph`),this.keyCode=AO(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=jO),this.altKey&&(t|=MO),this.shiftKey&&(t|=NO),this.metaKey&&(t|=PO),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new OO(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},IO=new WeakMap;function LO(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!==`null`&&n.origin!==`null`&&t.origin!==n.origin)return null}catch{return null}return e.parent}var RO=class{static getSameOriginWindowChain(e){let t=IO.get(e);if(!t){t=[],IO.set(e,t);let n=e,r;do r=LO(n),r?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=r;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,r=0,i=this.getSameOriginWindowChain(e);for(let e of i){let i=e.window.deref();if(n+=i?.scrollY??0,r+=i?.scrollX??0,i===t||!e.iframeElement)break;let a=e.iframeElement.getBoundingClientRect();n+=a.top,r+=a.left}return{top:n,left:r}}},zO=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type===`dblclick`&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX==`number`?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let n=RO.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},BO=class{constructor(e,t=0,n=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let r=!1;if(ZD){let e=navigator.userAgent.match(/Chrome\/(\d+)/);r=(e?parseInt(e[1]):123)<=122}if(e){let t=e,n=e,i=e.view?.devicePixelRatio||1;if(typeof t.wheelDeltaY<`u`)this.deltaY=r?t.wheelDeltaY/(120*i):t.wheelDeltaY/120;else if(typeof n.VERTICAL_AXIS<`u`&&n.axis===n.VERTICAL_AXIS)this.deltaY=-n.detail/3;else if(e.type===`wheel`){let t=e;this.deltaY=t.deltaMode===t.DOM_DELTA_LINE?YD&&!pO?-e.deltaY/3:-e.deltaY:-e.deltaY/40}if(typeof t.wheelDeltaX<`u`)this.deltaX=QD&&fO?-(t.wheelDeltaX/120):r?t.wheelDeltaX/(120*i):t.wheelDeltaX/120;else if(typeof n.HORIZONTAL_AXIS<`u`&&n.axis===n.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type===`wheel`){let t=e;this.deltaX=t.deltaMode===t.DOM_DELTA_LINE?YD&&!pO?-e.deltaX/3:-e.deltaX:-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(this.deltaY=r?e.wheelDelta/(120*i):e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},VO=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),HO;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof UO?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:jD.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:VO})})(HO||={});var UO=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?VO:(this._emitter||=new Z,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}},WO=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e==`function`&&typeof t==`number`&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new sD(`Calling 'cancelAndSet' on a disposed TimeoutTimer`);this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new sD(`Calling 'setIfNotSet' on a disposed TimeoutTimer`);this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},GO=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new sD(`Calling 'cancelAndSet' on a disposed IntervalTimer`);this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=bD(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}};(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var KO;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(KO||={});var qO=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new Z,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await jD.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};qO.EMPTY=qO.fromArray([]);function JO(e){return YO(e,0)}function YO(e,t){switch(typeof e){case`object`:return e===null?XO(349,t):Array.isArray(e)?$O(e,t):ek(e,t);case`string`:return QO(e,t);case`boolean`:return ZO(e,t);case`number`:return XO(e,t);case`undefined`:return XO(937,t);default:return XO(617,t)}}function XO(e,t){return(t<<5)-t+e|0}function ZO(e,t){return XO(e?433:863,t)}function QO(e,t){t=XO(149417,t);for(let n=0,r=e.length;n<r;n++)t=XO(e.charCodeAt(n),t);return t}function $O(e,t){return t=XO(104579,t),e.reduce((e,t)=>YO(t,e),t)}function ek(e,t){return t=XO(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=QO(n,t),YO(e[n],t)),t)}var{registerWindow:tk,getWindow:nk,getDocument:rk,getWindows:ik,getWindowsCount:ak,getWindowId:ok,getWindowById:sk,hasWindow:ck,onDidRegisterWindow:lk,onWillUnregisterWindow:uk,onDidUnregisterWindow:dk}=function(){let e=new Map,t={window:TD,disposables:new SD};e.set(TD.vscodeWindowId,t);let n=new Z,r=new Z,i=new Z;function a(n,r){return(typeof n==`number`?e.get(n):void 0)??(r?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return CD.None;let a=new SD,o={window:t,disposables:a.add(new SD)};return e.set(t.vscodeWindowId,o),a.add(bD(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add(Q(t,xk.BEFORE_UNLOAD,()=>{i.fire(t)})),n.fire(o),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(e){return e.vscodeWindowId},hasWindow(t){return e.has(t)},getWindowById:a,getWindow(e){let t=e;if(t?.ownerDocument?.defaultView)return t.ownerDocument.defaultView.window;let n=e;return n?.view?n.view.window:TD},getDocument(e){return nk(e).document}}}(),fk=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&=(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,null)}};function Q(e,t,n,r){return new fk(e,t,n,r)}function pk(e,t){return function(n){return t(new zO(e,n))}}function mk(e){return function(t){return e(new FO(t))}}var hk=function(e,t,n,r){let i=n;return t===`click`||t===`mousedown`||t===`contextmenu`?i=pk(nk(e),n):(t===`keydown`||t===`keypress`||t===`keyup`)&&(i=mk(n)),Q(e,t,i,r)},gk,_k=class extends GO{constructor(e){super(),this.defaultTarget=e&&nk(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},vk=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){tD(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,r=new Map,i=i=>{n.set(i,!1);let a=e.get(i)??[];for(t.set(i,a),e.set(i,[]),r.set(i,!0);a.length>0;)a.sort(vk.sort),a.shift().execute();r.set(i,!1)};gk=(t,r,a=0)=>{let o=ok(t),s=new vk(r,a),c=e.get(o);return c||(c=[],e.set(o,c)),c.push(s),n.get(o)||(n.set(o,!0),t.requestAnimationFrame(()=>i(o))),s}})();var yk=class e{constructor(e,t){this.width=e,this.height=t}with(t=this.width,n=this.height){return t!==this.width||n!==this.height?new e(t,n):this}static is(e){return typeof e==`object`&&typeof e.height==`number`&&typeof e.width==`number`}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};yk.None=new yk(0,0);function bk(e){let t=e.getBoundingClientRect(),n=nk(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}new class{constructor(){this.mutationObservers=new Map}observe(e,t,n){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let i=JO(n),a=r.get(i);if(a)a.users+=1;else{let o=new Z,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add(bD(()=>{--c.users,c.users===0&&(o.dispose(),s.disconnect(),r?.delete(i),r?.size===0&&this.mutationObservers.delete(e))})),r.set(i,a)}return a.onDidMutate}};var xk={CLICK:`click`,AUXCLICK:`auxclick`,DBLCLICK:`dblclick`,MOUSE_UP:`mouseup`,MOUSE_DOWN:`mousedown`,MOUSE_OVER:`mouseover`,MOUSE_MOVE:`mousemove`,MOUSE_OUT:`mouseout`,MOUSE_ENTER:`mouseenter`,MOUSE_LEAVE:`mouseleave`,MOUSE_WHEEL:`wheel`,POINTER_UP:`pointerup`,POINTER_DOWN:`pointerdown`,POINTER_MOVE:`pointermove`,POINTER_LEAVE:`pointerleave`,CONTEXT_MENU:`contextmenu`,WHEEL:`wheel`,KEY_DOWN:`keydown`,KEY_PRESS:`keypress`,KEY_UP:`keyup`,LOAD:`load`,BEFORE_UNLOAD:`beforeunload`,UNLOAD:`unload`,PAGE_SHOW:`pageshow`,PAGE_HIDE:`pagehide`,PASTE:`paste`,ABORT:`abort`,ERROR:`error`,RESIZE:`resize`,SCROLL:`scroll`,FULLSCREEN_CHANGE:`fullscreenchange`,WK_FULLSCREEN_CHANGE:`webkitfullscreenchange`,SELECT:`select`,CHANGE:`change`,SUBMIT:`submit`,RESET:`reset`,FOCUS:`focus`,FOCUS_IN:`focusin`,FOCUS_OUT:`focusout`,BLUR:`blur`,INPUT:`input`,STORAGE:`storage`,DRAG_START:`dragstart`,DRAG:`drag`,DRAG_ENTER:`dragenter`,DRAG_LEAVE:`dragleave`,DRAG_OVER:`dragover`,DROP:`drop`,DRAG_END:`dragend`,ANIMATION_START:XD?`webkitAnimationStart`:`animationstart`,ANIMATION_END:XD?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:XD?`webkitAnimationIteration`:`animationiteration`},Sk=class{constructor(e){this.domNode=e,this._maxWidth=``,this._width=``,this._height=``,this._top=``,this._left=``,this._bottom=``,this._right=``,this._paddingTop=``,this._paddingLeft=``,this._paddingBottom=``,this._paddingRight=``,this._fontFamily=``,this._fontWeight=``,this._fontSize=``,this._fontStyle=``,this._fontFeatureSettings=``,this._fontVariationSettings=``,this._textDecoration=``,this._lineHeight=``,this._letterSpacing=``,this._className=``,this._display=``,this._position=``,this._visibility=``,this._color=``,this._backgroundColor=``,this._layerHint=!1,this._contain=`none`,this._boxShadow=``}setMaxWidth(e){let t=Ck(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Ck(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Ck(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Ck(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Ck(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Ck(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Ck(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Ck(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Ck(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Ck(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Ck(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=Ck(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=Ck(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Ck(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?`translate3d(0px, 0px, 0px)`:``)}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function Ck(e){return typeof e==`number`?`${e}px`:e}function wk(e){return new Sk(e)}var Tk=class{constructor(){this._hooks=new SD,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,r,i){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=i;let a=e;try{e.setPointerCapture(t),this._hooks.add(bD(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{a=nk(e)}this._hooks.add(Q(a,xk.POINTER_MOVE,e=>{if(e.buttons!==n){this.stopMonitoring(!0);return}e.preventDefault(),this._pointerMoveCallback(e)})),this._hooks.add(Q(a,xk.POINTER_UP,e=>this.stopMonitoring(!0)))}};function Ek(e,t,n){let r=null,i=null;if(typeof n.value==`function`?(r=`value`,i=n.value,i.length!==0&&console.warn(`Memoize should only be used in functions with zero parameters`)):typeof n.get==`function`&&(r=`get`,i=n.get),!i)throw Error(`not supported`);let a=`$memoize$${t}`;n[r]=function(...e){return this.hasOwnProperty(a)||Object.defineProperty(this,a,{configurable:!1,enumerable:!1,writable:!1,value:i.apply(this,e)}),this[a]}}var Dk;(e=>(e.Tap=`-xterm-gesturetap`,e.Change=`-xterm-gesturechange`,e.Start=`-xterm-gesturestart`,e.End=`-xterm-gesturesend`,e.Contextmenu=`-xterm-gesturecontextmenu`))(Dk||={});var Ok=class e extends CD{constructor(){super(),this.dispatched=!1,this.targets=new OD,this.ignoreTargets=new OD,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(jD.runAndSubscribe(lk,({window:e,disposables:t})=>{t.add(Q(e.document,`touchstart`,e=>this.onTouchStart(e),{passive:!1})),t.add(Q(e.document,`touchend`,t=>this.onTouchEnd(e,t))),t.add(Q(e.document,`touchmove`,e=>this.onTouchMove(e),{passive:!1}))},{window:TD,disposables:this._store}))}static addTarget(t){return e.isTouchDevice()?(e.INSTANCE||=_D(new e),bD(e.INSTANCE.targets.push(t))):CD.None}static ignoreTarget(t){return e.isTouchDevice()?(e.INSTANCE||=_D(new e),bD(e.INSTANCE.ignoreTargets.push(t))):CD.None}static isTouchDevice(){return`ontouchstart`in TD||navigator.maxTouchPoints>0}dispose(){this.handle&&=(this.handle.dispose(),null),super.dispose()}onTouchStart(e){let t=Date.now();this.handle&&=(this.handle.dispose(),null);for(let n=0,r=e.targetTouches.length;n<r;n++){let r=e.targetTouches.item(n);this.activeTouches[r.identifier]={id:r.identifier,initialTarget:r.target,initialTimeStamp:t,initialPageX:r.pageX,initialPageY:r.pageY,rollingTimestamps:[t],rollingPageX:[r.pageX],rollingPageY:[r.pageY]};let i=this.newGestureEvent(Dk.Start,r.target);i.pageX=r.pageX,i.pageY=r.pageY,this.dispatchEvent(i)}this.dispatched&&=(e.preventDefault(),e.stopPropagation(),!1)}onTouchEnd(t,n){let r=Date.now(),i=Object.keys(this.activeTouches).length;for(let a=0,o=n.changedTouches.length;a<o;a++){let o=n.changedTouches.item(a);if(!this.activeTouches.hasOwnProperty(String(o.identifier))){console.warn(`move of an UNKNOWN touch`,o);continue}let s=this.activeTouches[o.identifier],c=Date.now()-s.initialTimeStamp;if(c<e.HOLD_DELAY&&Math.abs(s.initialPageX-cD(s.rollingPageX))<30&&Math.abs(s.initialPageY-cD(s.rollingPageY))<30){let e=this.newGestureEvent(Dk.Tap,s.initialTarget);e.pageX=cD(s.rollingPageX),e.pageY=cD(s.rollingPageY),this.dispatchEvent(e)}else if(c>=e.HOLD_DELAY&&Math.abs(s.initialPageX-cD(s.rollingPageX))<30&&Math.abs(s.initialPageY-cD(s.rollingPageY))<30){let e=this.newGestureEvent(Dk.Contextmenu,s.initialTarget);e.pageX=cD(s.rollingPageX),e.pageY=cD(s.rollingPageY),this.dispatchEvent(e)}else if(i===1){let e=cD(s.rollingPageX),n=cD(s.rollingPageY),i=cD(s.rollingTimestamps)-s.rollingTimestamps[0],a=e-s.rollingPageX[0],o=n-s.rollingPageY[0],c=[...this.targets].filter(e=>s.initialTarget instanceof Node&&e.contains(s.initialTarget));this.inertia(t,c,r,Math.abs(a)/i,a>0?1:-1,e,Math.abs(o)/i,o>0?1:-1,n)}this.dispatchEvent(this.newGestureEvent(Dk.End,s.initialTarget)),delete this.activeTouches[o.identifier]}this.dispatched&&=(n.preventDefault(),n.stopPropagation(),!1)}newGestureEvent(e,t){let n=document.createEvent(`CustomEvent`);return n.initEvent(e,!1,!0),n.initialTarget=t,n.tapCount=0,n}dispatchEvent(t){if(t.type===Dk.Tap){let n=new Date().getTime(),r=0;r=n-this._lastSetTapCountTime>e.CLEAR_TAP_COUNT_TIME?1:2,this._lastSetTapCountTime=n,t.tapCount=r}else(t.type===Dk.Change||t.type===Dk.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let e of this.ignoreTargets)if(e.contains(t.initialTarget))return;let e=[];for(let n of this.targets)if(n.contains(t.initialTarget)){let r=0,i=t.initialTarget;for(;i&&i!==n;)r++,i=i.parentElement;e.push([r,n])}e.sort((e,t)=>e[0]-t[0]);for(let[n,r]of e)r.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,r,i,a,o,s,c,l){this.handle=gk(t,()=>{let u=Date.now(),d=u-r,f=0,p=0,m=!0;i+=e.SCROLL_FRICTION*d,s+=e.SCROLL_FRICTION*d,i>0&&(m=!1,f=a*i*d),s>0&&(m=!1,p=c*s*d);let h=this.newGestureEvent(Dk.Change);h.translationX=f,h.translationY=p,n.forEach(e=>e.dispatchEvent(h)),m||this.inertia(t,n,u,i,a,o+f,s,c,l+p)})}onTouchMove(e){let t=Date.now();for(let n=0,r=e.changedTouches.length;n<r;n++){let r=e.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(r.identifier))){console.warn(`end of an UNKNOWN touch`,r);continue}let i=this.activeTouches[r.identifier],a=this.newGestureEvent(Dk.Change,i.initialTarget);a.translationX=r.pageX-cD(i.rollingPageX),a.translationY=r.pageY-cD(i.rollingPageY),a.pageX=r.pageX,a.pageY=r.pageY,this.dispatchEvent(a),i.rollingPageX.length>3&&(i.rollingPageX.shift(),i.rollingPageY.shift(),i.rollingTimestamps.shift()),i.rollingPageX.push(r.pageX),i.rollingPageY.push(r.pageY),i.rollingTimestamps.push(t)}this.dispatched&&=(e.preventDefault(),e.stopPropagation(),!1)}};Ok.SCROLL_FRICTION=-.005,Ok.HOLD_DELAY=700,Ok.CLEAR_TAP_COUNT_TIME=400,sE([Ek],Ok,`isTouchDevice`,1);var kk=Ok,Ak=class extends CD{onclick(e,t){this._register(Q(e,xk.CLICK,n=>t(new zO(nk(e),n))))}onmousedown(e,t){this._register(Q(e,xk.MOUSE_DOWN,n=>t(new zO(nk(e),n))))}onmouseover(e,t){this._register(Q(e,xk.MOUSE_OVER,n=>t(new zO(nk(e),n))))}onmouseleave(e,t){this._register(Q(e,xk.MOUSE_LEAVE,n=>t(new zO(nk(e),n))))}onkeydown(e,t){this._register(Q(e,xk.KEY_DOWN,e=>t(new FO(e))))}onkeyup(e,t){this._register(Q(e,xk.KEY_UP,e=>t(new FO(e))))}oninput(e,t){this._register(Q(e,xk.INPUT,t))}onblur(e,t){this._register(Q(e,xk.BLUR,t))}onfocus(e,t){this._register(Q(e,xk.FOCUS,t))}onchange(e,t){this._register(Q(e,xk.CHANGE,t))}ignoreGesture(e){return kk.ignoreTarget(e)}},jk=11,Mk=class extends Ak{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement(`div`),this.bgDomNode.className=`arrow-background`,this.bgDomNode.style.position=`absolute`,this.bgDomNode.style.width=e.bgWidth+`px`,this.bgDomNode.style.height=e.bgHeight+`px`,typeof e.top<`u`&&(this.bgDomNode.style.top=`0px`),typeof e.left<`u`&&(this.bgDomNode.style.left=`0px`),typeof e.bottom<`u`&&(this.bgDomNode.style.bottom=`0px`),typeof e.right<`u`&&(this.bgDomNode.style.right=`0px`),this.domNode=document.createElement(`div`),this.domNode.className=e.className,this.domNode.style.position=`absolute`,this.domNode.style.width=jk+`px`,this.domNode.style.height=jk+`px`,typeof e.top<`u`&&(this.domNode.style.top=e.top+`px`),typeof e.left<`u`&&(this.domNode.style.left=e.left+`px`),typeof e.bottom<`u`&&(this.domNode.style.bottom=e.bottom+`px`),typeof e.right<`u`&&(this.domNode.style.right=e.right+`px`),this._pointerMoveMonitor=this._register(new Tk),this._register(hk(this.bgDomNode,xk.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(hk(this.domNode,xk.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new _k),this._pointerdownScheduleRepeatTimer=this._register(new WO)}_arrowPointerDown(e){!e.target||!(e.target instanceof Element)||(this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,nk(e))},200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault())}},Nk=class e{constructor(e,t,n,r,i,a,o){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(t|=0,n|=0,r|=0,i|=0,a|=0,o|=0),this.rawScrollLeft=r,this.rawScrollTop=o,t<0&&(t=0),r+t>n&&(r=n-t),r<0&&(r=0),i<0&&(i=0),o+i>a&&(o=a-i),o<0&&(o=0),this.width=t,this.scrollWidth=n,this.scrollLeft=r,this.height=i,this.scrollHeight=a,this.scrollTop=o}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(t,n){return new e(this._forceIntegerValues,typeof t.width<`u`?t.width:this.width,typeof t.scrollWidth<`u`?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<`u`?t.height:this.height,typeof t.scrollHeight<`u`?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new e(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<`u`?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<`u`?t.scrollTop:this.rawScrollTop)}createScrollEvent(e,t){let n=this.width!==e.width,r=this.scrollWidth!==e.scrollWidth,i=this.scrollLeft!==e.scrollLeft,a=this.height!==e.height,o=this.scrollHeight!==e.scrollHeight,s=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:t,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:n,scrollWidthChanged:r,scrollLeftChanged:i,heightChanged:a,scrollHeightChanged:o,scrollTopChanged:s}}},Pk=class extends CD{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new Z),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new Nk(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>`u`?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>`u`?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let r;r=t?new Rk(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let t=this._state.withScrollPosition(e);this._smoothScrolling=Rk.start(this._state,t,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},Fk=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function Ik(e,t){let n=t-e;return function(t){return e+n*Bk(t)}}function Lk(e,t,n){return function(r){return r<n?e(r/n):t((r-n)/(1-n))}}var Rk=class e{constructor(e,t,n,r){this.from=e,this.to=t,this.duration=r,this.startTime=n,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(e,t,n){if(Math.abs(e-t)>2.5*n){let r,i;return e<t?(r=e+.75*n,i=t-.75*n):(r=e-.75*n,i=t+.75*n),Lk(Ik(e,r),Ik(i,t),.33)}return Ik(e,t)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(e){this.to=e.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(e){let t=(e-this.startTime)/this.duration;return t<1?new Fk(this.scrollLeft(t),this.scrollTop(t),!1):new Fk(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,r){return e.start(t,n,r)}static start(t,n,r){r+=10;let i=Date.now()-10;return new e(t,n,i,r)}};function zk(e){return e**3}function Bk(e){return 1-zk(1-e)}var Vk=class extends CD{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new WO)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3||this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?` fade`:``)))}},Hk=140,Uk=class extends Ak{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new Vk(e.visibility,`visible scrollbar `+e.extraScrollbarClassName,`invisible scrollbar `+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new Tk),this._shouldRender=!0,this.domNode=wk(document.createElement(`div`)),this.domNode.setAttribute(`role`,`presentation`),this.domNode.setAttribute(`aria-hidden`,`true`),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition(`absolute`),this._register(Q(this.domNode.domNode,xk.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(e){let t=this._register(new Mk(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=wk(document.createElement(`div`)),this.slider.setClassName(`slider`),this.slider.setPosition(`absolute`),this.slider.setTop(e),this.slider.setLeft(t),typeof n==`number`&&this.slider.setWidth(n),typeof r==`number`&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain(`strict`),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Q(this.slider.domNode,xk.POINTER_DOWN,e=>{e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))})),this.onclick(this.slider.domNode,e=>{e.leftButton&&e.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),i=this._sliderPointerPosition(e);n<=i&&i<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX==`number`&&typeof e.offsetY==`number`)t=e.offsetX,n=e.offsetY;else{let r=bk(this.domNode.domNode);t=e.pageX-r.left,n=e.pageY-r.top}let r=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName(`active`,!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{let i=this._sliderOrthogonalPointerPosition(e),a=Math.abs(i-n);if(fO&&a>Hk){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let o=this._sliderPointerPosition(e)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(o))},()=>{this.slider.toggleClassName(`active`,!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},Wk=class e{constructor(e,t,n,r,i,a){this._scrollbarSize=Math.round(t),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(e),this._visibleSize=r,this._scrollSize=i,this._scrollPosition=a,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new e(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let t=Math.round(e);return this._visibleSize!==t&&(this._visibleSize=t,this._refreshComputedValues(),!0)}setScrollSize(e){let t=Math.round(e);return this._scrollSize!==t&&(this._scrollSize=t,this._refreshComputedValues(),!0)}setScrollPosition(e){let t=Math.round(e);return this._scrollPosition!==t&&(this._scrollPosition=t,this._refreshComputedValues(),!0)}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,t,n,r,i){let a=Math.max(0,n-e),o=Math.max(0,a-2*t),s=r>0&&r>n;if(!s)return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(o),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(n*o/r))),l=(o-c)/(r-n),u=i*l;return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(c),computedSliderRatio:l,computedSliderPosition:Math.round(u)}}_refreshComputedValues(){let t=e._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize-this._computedSliderSize/2;return Math.round(t/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize,n=this._scrollPosition;return t<this._computedSliderPosition?n-=this._visibleSize:n+=this._visibleSize,n}getDesiredScrollPositionFromDelta(e){if(!this._computedIsNeeded)return 0;let t=this._computedSliderPosition+e;return Math.round(t/this._computedSliderRatio)}},Gk=class extends Uk{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new Wk(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,i.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:`horizontal`,scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw Error(`horizontalHasArrows is not supported in xterm.js`);this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},Kk=class extends Uk{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new Wk(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,i.scrollTop),visibility:t.vertical,extraScrollbarClassName:`vertical`,scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw Error(`horizontalHasArrows is not supported in xterm.js`);this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},qk=500,Jk=50,Yk=!0,Xk=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},Zk=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let e=1,t=0,n=1,r=this._rear;do{let i=r===this._front?e:2**-n;if(e-=i,t+=this._memory[r].score*i,r===this._front)break;r=(this._capacity+r-1)%this._capacity,n++}while(!0);return t<=.5}acceptStandardWheelEvent(e){if(ZD){let t=qD(nk(e.browserEvent));this.accept(Date.now(),e.deltaX*t,e.deltaY*t)}else this.accept(Date.now(),e.deltaX,e.deltaY)}accept(e,t,n){let r=null,i=new Xk(e,t,n);this._front===-1&&this._rear===-1?(this._memory[0]=i,this._front=0,this._rear=0):(r=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=i),i.score=this._computeScore(i,r)}_computeScore(e,t){if(Math.abs(e.deltaX)>0&&Math.abs(e.deltaY)>0)return 1;let n=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(n+=.25),t){let r=Math.abs(e.deltaX),i=Math.abs(e.deltaY),a=Math.abs(t.deltaX),o=Math.abs(t.deltaY),s=Math.max(Math.min(r,a),1),c=Math.max(Math.min(i,o),1),l=Math.max(r,a),u=Math.max(i,o);l%s===0&&u%c===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};Zk.INSTANCE=new Zk;var Qk=Zk,$k=class extends Ak{constructor(e,t,n){super(),this._onScroll=this._register(new Z),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new Z),this.onWillScroll=this._onWillScroll.event,this._options=tA(t),this._scrollable=n,this._register(this._scrollable.onScroll(e=>{this._onWillScroll.fire(e),this._onDidScroll(e),this._onScroll.fire(e)}));let r={onMouseWheel:e=>this._onMouseWheel(e),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new Kk(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new Gk(this._scrollable,this._options,r)),this._domNode=document.createElement(`div`),this._domNode.className=`xterm-scrollable-element `+this._options.className,this._domNode.setAttribute(`role`,`presentation`),this._domNode.style.position=`relative`,this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=wk(document.createElement(`div`)),this._leftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=wk(document.createElement(`div`)),this._topShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=wk(document.createElement(`div`)),this._topLeftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,e=>this._onMouseOver(e)),this.onmouseleave(this._listenOnDomNode,e=>this._onMouseLeave(e)),this._hideTimeout=this._register(new WO),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=vD(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,pO&&(this._options.className+=` mac`),this._domNode.className=`xterm-scrollable-element `+this._options.className}updateOptions(e){typeof e.handleMouseWheel<`u`&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<`u`&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<`u`&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<`u`&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<`u`&&(this._options.horizontal=e.horizontal),typeof e.vertical<`u`&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<`u`&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<`u`&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<`u`&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new BO(e))}_setListeningToMouseWheel(e){this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=vD(this._mouseWheelToDispose),e)&&this._mouseWheelToDispose.push(Q(this._listenOnDomNode,xk.MOUSE_WHEEL,e=>{this._onMouseWheel(new BO(e))},{passive:!1}))}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=Qk.INSTANCE;Yk&&t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let r=e.deltaY*this._options.mouseWheelScrollSensitivity,i=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&i+r===0?i=r=0:Math.abs(r)>=Math.abs(i)?i=0:r=0),this._options.flipAxes&&([r,i]=[i,r]);let a=!pO&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!i&&(i=r,r=0),e.browserEvent&&e.browserEvent.altKey&&(i*=this._options.fastScrollSensitivity,r*=this._options.fastScrollSensitivity);let o=this._scrollable.getFutureScrollPosition(),s={};if(r){let e=Jk*r,t=o.scrollTop-(e<0?Math.floor(e):Math.ceil(e));this._verticalScrollbar.writeScrollPosition(s,t)}if(i){let e=Jk*i,t=o.scrollLeft-(e<0?Math.floor(e):Math.ceil(e));this._horizontalScrollbar.writeScrollPosition(s,t)}s=this._scrollable.validateScrollPosition(s),(o.scrollLeft!==s.scrollLeft||o.scrollTop!==s.scrollTop)&&(Yk&&this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(s):this._scrollable.setScrollPositionNow(s),n=!0)}let r=n;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,r=n?` left`:``,i=t?` top`:``,a=n||t?` top-left-corner`:``;this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${i}`),this._topLeftShadowDomNode.setClassName(`shadow${a}${i}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),qk)}},eA=class extends $k{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function tA(e){let t={lazyRender:typeof e.lazyRender<`u`&&e.lazyRender,className:typeof e.className<`u`?e.className:``,useShadows:typeof e.useShadows<`u`?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<`u`?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<`u`&&e.flipAxes,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<`u`&&e.consumeMouseWheelIfScrollbarIsNeeded,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<`u`&&e.alwaysConsumeMouseWheel,scrollYToX:typeof e.scrollYToX<`u`&&e.scrollYToX,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<`u`?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<`u`?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<`u`?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<`u`?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<`u`?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<`u`?e.listenOnDomNode:null,horizontal:typeof e.horizontal<`u`?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<`u`?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<`u`&&e.horizontalHasArrows,vertical:typeof e.vertical<`u`?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<`u`?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<`u`&&e.verticalHasArrows,verticalSliderSize:typeof e.verticalSliderSize<`u`?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<`u`&&e.scrollByPage};return t.horizontalSliderSize=typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<`u`?e.verticalSliderSize:t.verticalScrollbarSize,pO&&(t.className+=` mac`),t}var nA=class extends CD{constructor(e,t,n,r,i,a,o,s){super(),this._bufferService=n,this._optionsService=o,this._renderService=s,this._onRequestScrollLines=this._register(new Z),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let c=this._register(new Pk({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:e=>gk(r.window,e)}));this._register(this._optionsService.onSpecificOptionChange(`smoothScrollDuration`,()=>{c.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new eA(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},c)),this._register(this._optionsService.onMultipleOptionChange([`scrollSensitivity`,`fastScrollSensitivity`,`overviewRuler`],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(i.onProtocolChange(e=>{this._scrollableElement.updateOptions({handleMouseWheel:!(e&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(jD.runAndSubscribe(a.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=a.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(bD(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement(`style`),t.appendChild(this._styleElement),this._register(bD(()=>this._styleElement.remove())),this._register(jD.runAndSubscribe(a.onChangeColors,()=>{this._styleElement.textContent=[`.xterm .xterm-scrollable-element > .scrollbar > .slider {`,` background: ${a.colors.scrollbarSliderBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider:hover {`,` background: ${a.colors.scrollbarSliderHoverBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider.active {`,` background: ${a.colors.scrollbarSliderActiveBackground.css};`,`}`].join(`
|
|
44
|
-
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(e=>this._handleScroll(e)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};nA=sE([X(2,PE),X(3,qE),X(4,FE),X(5,QE),X(6,BE),X(7,YE)],nA);var rA=class extends CD{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement(`div`),this._container.classList.add(`xterm-decoration-container`),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(e=>this._removeDecoration(e))),this._register(bD(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement(`div`);t.classList.add(`xterm-decoration`),t.classList.toggle(`xterm-decoration-top-layer`,e?.options?.layer===`top`),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display=`none`),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display=`none`,e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?`none`:`block`,this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||`left`)===`right`?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:``:t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:``}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};rA=sE([X(1,PE),X(2,qE),X(3,UE),X(4,YE)],rA);var iA=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||`full`]&&t<=e.endBufferLine+this._linePadding[n||`full`]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},aA={full:0,left:0,center:0,right:0},oA={full:0,left:0,center:0,right:0},sA={full:0,left:0,center:0,right:0},cA=class extends CD{constructor(e,t,n,r,i,a,o,s){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=a,this._themeService=o,this._coreBrowserService=s,this._colorZoneStore=new iA,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-decoration-overview-ruler`),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(bD(()=>this._canvas?.remove()));let c=this._canvas.getContext(`2d`);if(c)this._ctx=c;else throw Error(`Ctx cannot be null`);this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?`none`:`block`})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange(`overviewRuler`,()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);oA.full=this._canvas.width,oA.left=e,oA.center=t,oA.right=e,this._refreshDrawHeightConstants(),sA.full=1,sA.left=1,sA.center=1+oA.left,sA.right=1+oA.left+oA.center}_refreshDrawHeightConstants(){aA.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);aA.left=t,aA.center=t,aA.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*aA.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*aA.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*aA.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*aA.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let e of this._decorationService.decorations)this._colorZoneStore.addDecoration(e);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!==`full`&&this._renderColorZone(t);for(let t of e)t.position===`full`&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(sA[e.position||`full`],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-aA[e.position||`full`]/2),oA[e.position||`full`],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+aA[e.position||`full`]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};cA=sE([X(2,PE),X(3,UE),X(4,YE),X(5,BE),X(6,QE),X(7,qE)],cA);var $;(e=>(e.NUL=`\0`,e.SOH=``,e.STX=``,e.ETX=``,e.EOT=``,e.ENQ=``,e.ACK=``,e.BEL=`\x07`,e.BS=`\b`,e.HT=` `,e.LF=`
|
|
45
|
-
`,e.VT=`\v`,e.FF=`\f`,e.CR=`\r`,e.SO=``,e.SI=``,e.DLE=``,e.DC1=``,e.DC2=``,e.DC3=``,e.DC4=``,e.NAK=``,e.SYN=``,e.ETB=``,e.CAN=``,e.EM=``,e.SUB=``,e.ESC=`\x1B`,e.FS=``,e.GS=``,e.RS=``,e.US=``,e.SP=` `,e.DEL=``))($||={});var lA;(e=>(e.PAD=``,e.HOP=``,e.BPH=``,e.NBH=``,e.IND=``,e.NEL=`
`,e.SSA=``,e.ESA=``,e.HTS=``,e.HTJ=``,e.VTS=``,e.PLD=``,e.PLU=``,e.RI=``,e.SS2=``,e.SS3=``,e.DCS=``,e.PU1=``,e.PU2=``,e.STS=``,e.CCH=``,e.MW=``,e.SPA=``,e.EPA=``,e.SOS=``,e.SGCI=``,e.SCI=``,e.CSI=``,e.ST=``,e.OSC=``,e.PM=``,e.APC=``))(lA||={});var uA;(e=>e.ST=`${$.ESC}\\`)(uA||={});var dA=class{constructor(e,t,n,r,i,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=``}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent=``,this._dataAlreadySent=``,this._compositionView.classList.add(`active`)}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove(`active`),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let t;e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,this._compositionPosition.start):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,``);this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${$.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+`px`,this._compositionView.style.top=n+`px`,this._compositionView.style.height=t+`px`,this._compositionView.style.lineHeight=t+`px`,this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+`px`;let i=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+`px`,this._textarea.style.top=n+`px`,this._textarea.style.width=Math.max(i.width,1)+`px`,this._textarea.style.height=Math.max(i.height,1)+`px`,this._textarea.style.lineHeight=i.height+`px`}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};dA=sE([X(2,PE),X(3,BE),X(4,IE),X(5,YE)],dA);var fA=0,pA=0,mA=0,hA=0,gA={css:`#00000000`,rgba:0},_A;(e=>{function t(e,t,n,r){return r===void 0?`#${SA(e)}${SA(t)}${SA(n)}`:`#${SA(e)}${SA(t)}${SA(n)}${SA(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})(_A||={});var vA;(e=>{function t(e,t){if(hA=(t.rgba&255)/255,hA===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return fA=a+Math.round((n-a)*hA),pA=o+Math.round((r-o)*hA),mA=s+Math.round((i-s)*hA),{css:_A.toCss(fA,pA,mA),rgba:_A.toRgba(fA,pA,mA)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=xA.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return _A.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[fA,pA,mA]=xA.toChannels(t),{css:_A.toCss(fA,pA,mA),rgba:t}}e.opaque=i;function a(e,t){return hA=Math.round(t*255),[fA,pA,mA]=xA.toChannels(e.rgba),{css:_A.toCss(fA,pA,mA,hA),rgba:_A.toRgba(fA,pA,mA,hA)}}e.opacity=a;function o(e,t){return hA=e.rgba&255,a(e,hA*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(vA||={});var yA;(e=>{let t,n;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let r=e.getContext(`2d`,{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation=`copy`,n=t.createLinearGradient(0,0,1,1))}catch{}function r(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return fA=parseInt(e.slice(1,2).repeat(2),16),pA=parseInt(e.slice(2,3).repeat(2),16),mA=parseInt(e.slice(3,4).repeat(2),16),_A.toColor(fA,pA,mA);case 5:return fA=parseInt(e.slice(1,2).repeat(2),16),pA=parseInt(e.slice(2,3).repeat(2),16),mA=parseInt(e.slice(3,4).repeat(2),16),hA=parseInt(e.slice(4,5).repeat(2),16),_A.toColor(fA,pA,mA,hA);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let r=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(r)return fA=parseInt(r[1]),pA=parseInt(r[2]),mA=parseInt(r[3]),hA=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),_A.toColor(fA,pA,mA,hA);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[fA,pA,mA,hA]=t.getImageData(0,0,1,1).data,hA!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:_A.toRgba(fA,pA,mA,hA),css:e}}e.toColor=r})(yA||={});var bA;(e=>{function t(e){return n(e>>16&255,e>>8&255,e&255)}e.relativeLuminance=t;function n(e,t,n){let r=e/255,i=t/255,a=n/255,o=r<=.03928?r/12.92:((r+.055)/1.055)**2.4,s=i<=.03928?i/12.92:((i+.055)/1.055)**2.4,c=a<=.03928?a/12.92:((a+.055)/1.055)**2.4;return o*.2126+s*.7152+c*.0722}e.relativeLuminance2=n})(bA||={});var xA;(e=>{function t(e,t){if(hA=(t&255)/255,hA===1)return t;let n=t>>24&255,r=t>>16&255,i=t>>8&255,a=e>>24&255,o=e>>16&255,s=e>>8&255;return fA=a+Math.round((n-a)*hA),pA=o+Math.round((r-o)*hA),mA=s+Math.round((i-s)*hA),_A.toRgba(fA,pA,mA)}e.blend=t;function n(e,t,n){let a=bA.relativeLuminance(e>>8),o=bA.relativeLuminance(t>>8);if(CA(a,o)<n){if(o<a){let o=r(e,t,n),s=CA(a,bA.relativeLuminance(o>>8));if(s<n){let r=i(e,t,n);return s>CA(a,bA.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=CA(a,bA.relativeLuminance(s>>8));if(c<n){let i=r(e,t,n);return c>CA(a,bA.relativeLuminance(i>>8))?s:i}return s}}e.ensureContrastRatio=n;function r(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=CA(bA.relativeLuminance2(o,s,c),bA.relativeLuminance2(r,i,a));for(;l<n&&(o>0||s>0||c>0);)o-=Math.max(0,Math.ceil(o*.1)),s-=Math.max(0,Math.ceil(s*.1)),c-=Math.max(0,Math.ceil(c*.1)),l=CA(bA.relativeLuminance2(o,s,c),bA.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.reduceLuminance=r;function i(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=CA(bA.relativeLuminance2(o,s,c),bA.relativeLuminance2(r,i,a));for(;l<n&&(o<255||s<255||c<255);)o=Math.min(255,o+Math.ceil((255-o)*.1)),s=Math.min(255,s+Math.ceil((255-s)*.1)),c=Math.min(255,c+Math.ceil((255-c)*.1)),l=CA(bA.relativeLuminance2(o,s,c),bA.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.increaseLuminance=i;function a(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]}e.toChannels=a})(xA||={});function SA(e){let t=e.toString(16);return t.length<2?`0`+t:t}function CA(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var wA=class extends TE{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},TA=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new DE}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],r=t.translateToString(!0),i=0,a=0,o=0,s=t.getFg(0),c=t.getBg(0);for(let e=0;e<t.getTrimmedLength();e++)if(t.loadCell(e,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==s||this._workCell.bg!==c){if(e-i>1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}i=e,o=a,s=this._workCell.fg,c=this._workCell.bg}a+=this._workCell.getChars().length||wE.length}if(this._bufferService.cols-i>1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}return n}_getJoinedRanges(e,t,n,r,i){let a=e.substring(t,n),o=[];try{o=this._characterJoiners[0].handler(a)}catch(e){console.error(e)}for(let e=1;e<this._characterJoiners.length;e++)try{let t=this._characterJoiners[e].handler(a);for(let e=0;e<t.length;e++)TA._mergeRanges(o,t[e])}catch(e){console.error(e)}return this._stringRangesToCellRanges(o,r,i),o}_stringRangesToCellRanges(e,t,n){let r=0,i=!1,a=0,o=e[r];if(o){for(let s=n;s<this._bufferService.cols;s++){let n=t.getWidth(s),c=t.getString(s).length||wE.length;if(n!==0){if(!i&&o[0]<=a&&(o[0]=s,i=!0),o[1]<=a){if(o[1]=s,o=e[++r],!o)break;o[0]<=a?(o[0]=s,i=!0):i=!1}a+=c}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(n){if(t[1]<=i[0])return e[r-1][1]=t[1],e;if(t[1]<=i[1])return e[r-1][1]=Math.max(t[1],i[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=i[0])return e.splice(r,0,t),e;if(t[1]<=i[1])return i[0]=Math.min(t[0],i[0]),e;t[0]<i[1]&&(i[0]=Math.min(t[0],i[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};TA=sE([X(0,PE)],TA);function EA(e){return 57508<=e&&e<=57558}function DA(e){return 9472<=e&&e<=9631}function OA(e){return EA(e)||DA(e)}function kA(){return{css:{canvas:AA(),cell:AA()},device:{canvas:AA(),cell:AA(),char:{width:0,height:0,left:0,top:0}}}}function AA(){return{width:0,height:0}}var jA=class{constructor(e,t,n,r,i,a,o){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._themeService=o,this._workCell=new DE,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,i,a,o,s,c,l,u){let d=[],f=this._characterJoinerService.getJoinedCharacters(t),p=this._themeService.colors,m=e.getNoBgTrimmedLength();n&&m<a+1&&(m=a+1);let h,g=0,_=``,v=0,y=0,b=0,x=0,S=!1,C=0,w=!1,T=0,E=0,D=[],O=l!==-1&&u!==-1;for(let k=0;k<m;k++){e.loadCell(k,this._workCell);let m=this._workCell.getWidth();if(m===0)continue;let A=!1,j=k>=E,M=k,N=this._workCell;if(f.length>0&&k===f[0][0]&&j){let r=f.shift(),i=this._isCellInSelection(r[0],t);for(v=r[0]+1;v<r[1];v++)j&&=i===this._isCellInSelection(v,t);j&&=!n||a<r[0]||a>=r[1],j?(A=!0,N=new wA(this._workCell,e.translateToString(!0,r[0],r[1]),r[1]-r[0]),M=r[1]-1,m=N.getWidth()):E=r[1]}let P=this._isCellInSelection(k,t),F=n&&k===a,I=O&&k>=l&&k<=u,L=!1;this._decorationService.forEachDecorationAtCell(k,t,void 0,e=>{L=!0});let ee=N.getChars()||wE;if(ee===` `&&(N.isUnderline()||N.isOverline())&&(ee=`\xA0`),T=m*s-c.get(ee,N.isBold(),N.isItalic()),!h)h=this._document.createElement(`span`);else if(g&&(P&&w||!P&&!w&&N.bg===y)&&(P&&w&&p.selectionForeground||N.fg===b)&&N.extended.ext===x&&I===S&&T===C&&!F&&!A&&!L&&j){N.isInvisible()?_+=wE:_+=ee,g++;continue}else g&&(h.textContent=_),h=this._document.createElement(`span`),g=0,_=``;if(y=N.bg,b=N.fg,x=N.extended.ext,S=I,C=T,w=P,A&&a>=k&&a<=M&&(a=k),!this._coreService.isCursorHidden&&F&&this._coreService.isCursorInitialized){if(D.push(`xterm-cursor`),this._coreBrowserService.isFocused)o&&D.push(`xterm-cursor-blink`),D.push(r===`bar`?`xterm-cursor-bar`:r===`underline`?`xterm-cursor-underline`:`xterm-cursor-block`);else if(i)switch(i){case`outline`:D.push(`xterm-cursor-outline`);break;case`block`:D.push(`xterm-cursor-block`);break;case`bar`:D.push(`xterm-cursor-bar`);break;case`underline`:D.push(`xterm-cursor-underline`)}}if(N.isBold()&&D.push(`xterm-bold`),N.isItalic()&&D.push(`xterm-italic`),N.isDim()&&D.push(`xterm-dim`),_=N.isInvisible()?wE:N.getChars()||wE,N.isUnderline()&&(D.push(`xterm-underline-${N.extended.underlineStyle}`),_===` `&&(_=`\xA0`),!N.isUnderlineColorDefault())){if(N.isUnderlineColorRGB())h.style.textDecorationColor=`rgb(${TE.toColorRGB(N.getUnderlineColor()).join(`,`)})`;else{let e=N.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&N.isBold()&&e<8&&(e+=8),h.style.textDecorationColor=p.ansi[e].css}}N.isOverline()&&(D.push(`xterm-overline`),_===` `&&(_=`\xA0`)),N.isStrikethrough()&&D.push(`xterm-strikethrough`),I&&(h.style.textDecoration=`underline`);let te=N.getFgColor(),ne=N.getFgColorMode(),re=N.getBgColor(),R=N.getBgColorMode(),ie=!!N.isInverse();if(ie){let e=te;te=re,re=e;let t=ne;ne=R,R=t}let z,ae,oe=!1;this._decorationService.forEachDecorationAtCell(k,t,void 0,e=>{e.options.layer!==`top`&&oe||(e.backgroundColorRGB&&(R=50331648,re=e.backgroundColorRGB.rgba>>8&16777215,z=e.backgroundColorRGB),e.foregroundColorRGB&&(ne=50331648,te=e.foregroundColorRGB.rgba>>8&16777215,ae=e.foregroundColorRGB),oe=e.options.layer===`top`)}),!oe&&P&&(z=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,re=z.rgba>>8&16777215,R=50331648,oe=!0,p.selectionForeground&&(ne=50331648,te=p.selectionForeground.rgba>>8&16777215,ae=p.selectionForeground)),oe&&D.push(`xterm-decoration-top`);let se;switch(R){case 16777216:case 33554432:se=p.ansi[re],D.push(`xterm-bg-${re}`);break;case 50331648:se=_A.toColor(re>>16,re>>8&255,re&255),this._addStyle(h,`background-color:#${MA((re>>>0).toString(16),`0`,6)}`);break;default:ie?(se=p.foreground,D.push(`xterm-bg-257`)):se=p.background}switch(z||N.isDim()&&(z=vA.multiplyOpacity(se,.5)),ne){case 16777216:case 33554432:N.isBold()&&te<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(te+=8),this._applyMinimumContrast(h,se,p.ansi[te],N,z,void 0)||D.push(`xterm-fg-${te}`);break;case 50331648:let e=_A.toColor(te>>16&255,te>>8&255,te&255);this._applyMinimumContrast(h,se,e,N,z,ae)||this._addStyle(h,`color:#${MA(te.toString(16),`0`,6)}`);break;default:this._applyMinimumContrast(h,se,p.foreground,N,z,ae)||ie&&D.push(`xterm-fg-257`)}D.length&&=(h.className=D.join(` `),0),!F&&!A&&!L&&j?g++:h.textContent=_,T!==this.defaultSpacing&&(h.style.letterSpacing=`${T}px`),d.push(h),k=M}return h&&g&&(h.textContent=_),d}_applyMinimumContrast(e,t,n,r,i,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||OA(r.getCode()))return!1;let o=this._getContrastCache(r),s;if(!i&&!a&&(s=o.getColor(t.rgba,n.rgba)),s===void 0){let e=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);s=vA.ensureContrastRatio(i||t,a||n,e),o.setColor((i||t).rgba,(a||n).rgba,s??null)}return s?(this._addStyle(e,`color:${s.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute(`style`,`${e.getAttribute(`style`)||``}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,r=this._selectionEnd;return!n||!r?!1:this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e<r[0]&&t<=r[1]:e<n[0]&&t>=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t<r[1]||n[1]===r[1]&&t===n[1]&&e>=n[0]&&e<r[0]||n[1]<r[1]&&t===r[1]&&e<r[0]||n[1]<r[1]&&t===n[1]&&e>=n[0]}};jA=sE([X(1,ZE),X(2,BE),X(3,qE),X(4,IE),X(5,UE),X(6,QE)],jA);function MA(e,t,n){for(;e.length<n;)e=t+e;return e}var NA=class{constructor(e,t){this._flat=new Float32Array(256),this._font=``,this._fontSize=0,this._weight=`normal`,this._weightBold=`bold`,this._measureElements=[],this._container=e.createElement(`div`),this._container.classList.add(`xterm-width-cache-measure-container`),this._container.setAttribute(`aria-hidden`,`true`),this._container.style.whiteSpace=`pre`,this._container.style.fontKerning=`none`;let n=e.createElement(`span`);n.classList.add(`xterm-char-measure-element`);let r=e.createElement(`span`);r.classList.add(`xterm-char-measure-element`),r.style.fontWeight=`bold`;let i=e.createElement(`span`);i.classList.add(`xterm-char-measure-element`),i.style.fontStyle=`italic`;let a=e.createElement(`span`);a.classList.add(`xterm-char-measure-element`),a.style.fontWeight=`bold`,a.style.fontStyle=`italic`,this._measureElements=[n,r,i,a],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(i),this._container.appendChild(a),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let t=this._measure(e,0);return t>0&&(this._flat[r]=t),t}let i=e;t&&(i+=`B`),n&&(i+=`I`);let a=this._holey.get(i);if(a===void 0){let r=0;t&&(r|=1),n&&(r|=2),a=this._measure(e,r),a>0&&this._holey.set(i,a)}return a}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},PA=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);if(s>=e.rows||c<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function FA(){return new PA}var IA=`xterm-dom-renderer-owner-`,LA=`xterm-rows`,RA=`xterm-fg-`,zA=`xterm-bg-`,BA=`xterm-focus`,VA=`xterm-selection`,HA=1,UA=class extends CD{constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=a,this._linkifier2=o,this._charSizeService=c,this._optionsService=l,this._bufferService=u,this._coreService=d,this._coreBrowserService=f,this._themeService=p,this._terminalClass=HA++,this._rowElements=[],this._selectionRenderModel=FA(),this.onRequestRedraw=this._register(new Z).event,this._rowContainer=this._document.createElement(`div`),this._rowContainer.classList.add(LA),this._rowContainer.style.lineHeight=`normal`,this._rowContainer.setAttribute(`aria-hidden`,`true`),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement(`div`),this._selectionContainer.classList.add(VA),this._selectionContainer.setAttribute(`aria-hidden`,`true`),this.dimensions=kA(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(e=>this._injectCss(e))),this._injectCss(this._themeService.colors),this._rowFactory=s.createInstance(jA,document),this._element.classList.add(IA+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(e=>this._handleLinkHover(e))),this._register(this._linkifier2.onHideLinkUnderline(e=>this._handleLinkLeave(e))),this._register(bD(()=>{this._element.classList.remove(IA+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new NA(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let e of this._rowElements)e.style.width=`${this.dimensions.css.canvas.width}px`,e.style.height=`${this.dimensions.css.cell.height}px`,e.style.lineHeight=`${this.dimensions.css.cell.height}px`,e.style.overflow=`hidden`;this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${LA} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${LA} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${LA} .xterm-dim { color: ${vA.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${LA}.${BA} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${LA}.${BA} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${LA}.${BA} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${LA} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${LA} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${LA} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${LA} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${LA} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${VA} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${VA} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${VA} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,r]of e.ansi.entries())t+=`${this._terminalSelector} .${RA}${n} { color: ${r.css}; }${this._terminalSelector} .${RA}${n}.xterm-dim { color: ${vA.multiplyOpacity(r,.5).css}; }${this._terminalSelector} .${zA}${n} { background-color: ${r.css}; }`;t+=`${this._terminalSelector} .${RA}257 { color: ${vA.opaque(e.background).css}; }${this._terminalSelector} .${RA}257.xterm-dim { color: ${vA.multiplyOpacity(vA.opaque(e.background),.5).css}; }${this._terminalSelector} .${zA}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get(`W`,!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let e=this._rowElements.length;e<=t;e++){let e=this._document.createElement(`div`);this._rowContainer.appendChild(e),this._rowElements.push(e)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(BA),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(BA),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,s=this._document.createDocumentFragment();if(n){let n=e[0]>t[0];s.appendChild(this._createSelectionElement(a,n?t[0]:e[0],n?e[0]:t[0],o-a+1))}else{let n=r===a?e[0]:0,c=a===i?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(a,n,c));let l=o-a-1;if(s.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,l)),a!==o){let e=i===o?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(o,0,e))}}this._selectionContainer.appendChild(s)}_createSelectionElement(e,t,n,r=1){let i=this._document.createElement(`div`),a=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return a+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-a),i.style.height=`${r*this.dimensions.css.cell.height}px`,i.style.top=`${e*this.dimensions.css.cell.height}px`,i.style.left=`${a}px`,i.style.width=`${o}px`,i}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),a=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,s=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=t;c++){let e=c+n.ydisp,t=this._rowElements[c],l=n.lines.get(e);if(!t||!l)break;t.replaceChildren(...this._rowFactory.createRow(l,e,e===r,o,s,i,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${IA}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,r,i,a){n<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),r=Math.max(Math.min(r,o),0),i=Math.min(i,this._bufferService.cols);let s=this._bufferService.buffer,c=s.ybase+s.y,l=Math.min(s.x,i-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let o=n;o<=r;++o){let p=o+s.ydisp,m=this._rowElements[o],h=s.lines.get(p);if(!m||!h)break;m.replaceChildren(...this._rowFactory.createRow(h,p,p===c,d,f,l,u,this.dimensions.css.cell.width,this._widthCache,a?o===n?e:0:-1,a?(o===r?t:i)-1:-1))}}};UA=sE([X(7,RE),X(8,KE),X(9,BE),X(10,PE),X(11,IE),X(12,qE),X(13,QE)],UA);var WA=class extends CD{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new Z),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new qA(this._optionsService))}catch{this._measureStrategy=this._register(new KA(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange([`fontFamily`,`fontSize`],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};WA=sE([X(2,BE)],WA);var GA=class extends CD{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},KA=class extends GA{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement(`span`),this._measureElement.classList.add(`xterm-char-measure-element`),this._measureElement.textContent=`W`.repeat(32),this._measureElement.setAttribute(`aria-hidden`,`true`),this._measureElement.style.whiteSpace=`pre`,this._measureElement.style.fontKerning=`none`,this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},qA=class extends GA{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext(`2d`);let t=this._ctx.measureText(`W`);if(!(`width`in t&&`fontBoundingBoxAscent`in t&&`fontBoundingBoxDescent`in t))throw Error(`Required font metrics not supported`)}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText(`W`);return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},JA=class extends CD{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new YA(this._window)),this._onDprChange=this._register(new Z),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new Z),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this._register(jD.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Q(this._textarea,`focus`,()=>this._isFocused=!0)),this._register(Q(this._textarea,`blur`,()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},YA=class extends CD{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new wD),this._onDprChange=this._register(new Z),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(bD(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Q(this._parentWindow,`resize`,()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},XA=class extends CD{constructor(){super(),this.linkProviders=[],this._register(bD(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function ZA(e,t,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),a=parseInt(i.getPropertyValue(`padding-left`)),o=parseInt(i.getPropertyValue(`padding-top`));return[t.clientX-r.left-a,t.clientY-r.top-o]}function QA(e,t,n,r,i,a,o,s,c){if(!a)return;let l=ZA(e,t,n);if(l)return l[0]=Math.ceil((l[0]+(c?o/2:0))/o),l[1]=Math.ceil(l[1]/s),l[0]=Math.min(Math.max(l[0],1),r+ +!!c),l[1]=Math.min(Math.max(l[1],1),i),l}var $A=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return QA(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=ZA(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};$A=sE([X(0,YE),X(1,KE)],$A);var ej=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t),!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},tj={};oE(tj,{getSafariVersion:()=>cj,isChromeOS:()=>mj,isFirefox:()=>aj,isIpad:()=>uj,isIphone:()=>dj,isLegacyEdge:()=>oj,isLinux:()=>pj,isMac:()=>lj,isNode:()=>nj,isSafari:()=>sj,isWindows:()=>fj});var nj=typeof process<`u`&&`title`in process,rj=nj?`node`:navigator.userAgent,ij=nj?`node`:navigator.platform,aj=rj.includes(`Firefox`),oj=rj.includes(`Edge`),sj=/^((?!chrome|android).)*safari/i.test(rj);function cj(){if(!sj)return 0;let e=rj.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var lj=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(ij),uj=ij===`iPad`,dj=ij===`iPhone`,fj=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(ij),pj=ij.indexOf(`Linux`)>=0,mj=/\bCrOS\b/.test(rj),hj=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&=(this._cancelCallback(this._idleCallback),void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||=this._requestCallback(this._process.bind(this))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),i=e.timeRemaining(),n*1.5>i){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=i}this.clear()}},gj=class extends hj{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},_j=class extends hj{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},vj=!nj&&`requestIdleCallback`in window?_j:gj,yj=class{constructor(){this._queue=new vj}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},bj=class extends CD{constructor(e,t,n,r,i,a,o,s,c){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=i,this._coreBrowserService=s,this._renderer=this._register(new wD),this._pausedResizeTask=new yj,this._observerDisposable=this._register(new wD),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new Z),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new Z),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new Z),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new Z),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new ej((e,t)=>this._renderRows(e,t),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new xj(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(bD(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(a.onDecorationRegistered(()=>this._fullRefresh())),this._register(a.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange([`customGlyphs`,`drawBoldTextInBrightColors`,`letterSpacing`,`lineHeight`,`fontFamily`,`fontSize`,`fontWeight`,`fontWeightBold`,`minimumContrastRatio`,`rescaleOverlappingGlyphs`],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange([`cursorBlink`,`cursorStyle`],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(c.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(e=>this._registerIntersectionObserver(e,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if(`IntersectionObserver`in e){let n=new e.IntersectionObserver(e=>this._handleIntersectionChange(e[e.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=bD(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&=(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(e=>this.refreshRows(e.start,e.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};bj=sE([X(2,BE),X(3,KE),X(4,IE),X(5,UE),X(6,PE),X(7,qE),X(8,QE)],bj);var xj=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function Sj(e,t,n,r){let i=n.buffer.x,a=n.buffer.y;if(!n.buffer.hasScrollback)return Tj(i,a,e,t,n,r)+Ej(a,t,n,r)+Dj(i,a,e,t,n,r);let o;if(a===t)return o=i>e?`D`:`C`,Pj(Math.abs(i-e),Nj(o,r));o=a>t?`D`:`C`;let s=Math.abs(a-t);return Pj(wj(a>t?e:i,n)+(s-1)*n.cols+1+Cj(a>t?i:e,n),Nj(o,r))}function Cj(e,t){return e-1}function wj(e,t){return t.cols-e}function Tj(e,t,n,r,i,a){return Ej(t,r,i,a).length===0?``:Pj(Mj(e,t,e,t-kj(t,i),!1,i).length,Nj(`D`,a))}function Ej(e,t,n,r){let i=e-kj(e,n),a=t-kj(t,n);return Pj(Math.abs(i-a)-Oj(e,t,n),Nj(jj(e,t),r))}function Dj(e,t,n,r,i,a){let o;o=Ej(t,r,i,a).length>0?r-kj(r,i):t;let s=r,c=Aj(e,t,n,r,i,a);return Pj(Mj(e,o,n,s,c===`C`,i).length,Nj(c,a))}function Oj(e,t,n){let r=0,i=e-kj(e,n),a=t-kj(t,n);for(let o=0;o<Math.abs(i-a);o++){let a=jj(e,t)===`A`?-1:1;n.buffer.lines.get(i+a*o)?.isWrapped&&r++}return r}function kj(e,t){let n=0,r=t.buffer.lines.get(e),i=r?.isWrapped;for(;i&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),i=r?.isWrapped;return n}function Aj(e,t,n,r,i,a){let o;return o=Ej(n,r,i,a).length>0?r-kj(r,i):t,e<n&&o<=r||e>=n&&o<r?`C`:`D`}function jj(e,t){return e>t?`A`:`B`}function Mj(e,t,n,r,i,a){let o=e,s=t,c=``;for(;(o!==n||s!==r)&&s>=0&&s<a.buffer.lines.length;)o+=i?1:-1,i&&o>a.cols-1?(c+=a.buffer.translateBufferLineToString(s,!1,e,o),o=0,e=0,s++):!i&&o<0&&(c+=a.buffer.translateBufferLineToString(s,!1,0,e+1),o=a.cols-1,e=o,s--);return c+a.buffer.translateBufferLineToString(s,!1,e,o)}function Nj(e,t){let n=t?`O`:`[`;return $.ESC+n+e}function Pj(e,t){e=Math.floor(e);let n=``;for(let r=0;r<e;r++)n+=t;return n}var Fj=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function Ij(e,t){if(e.start.y>e.end.y)throw Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var Lj=50,Rj=15,zj=50,Bj=500,Vj=RegExp(`\xA0`,`g`),Hj=class extends CD{constructor(e,t,n,r,i,a,o,s,c){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=a,this._optionsService=o,this._renderService=s,this._coreBrowserService=c,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new DE,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new Z),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new Z),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new Z),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new Z),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(e=>this._handleTrim(e)),this._register(this._bufferService.buffers.onBufferActivate(e=>this._handleBufferActivate(e))),this.enable(),this._model=new Fj(this._bufferService),this._activeSelectionMode=0,this._register(bD(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(e=>{e.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return``;let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return``;let i=e[0]<t[0]?e[0]:t[0],a=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let e=n.translateBufferLineToString(o,!0,i,a);r.push(e)}}else{let i=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],i));for(let i=e[1]+1;i<=t[1]-1;i++){let e=n.lines.get(i),t=n.translateBufferLineToString(i,!0);e?.isWrapped?r[r.length-1]+=t:r.push(t)}if(e[1]!==t[1]){let e=n.lines.get(t[1]),i=n.translateBufferLineToString(t[1],!0,0,t[0]);e&&e.isWrapped?r[r.length-1]+=i:r.push(i)}}return r.map(e=>e.replace(Vj,` `)).join(fj?`\r
|
|
46
|
-
`:`
|
|
47
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh()),pj&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=Ij(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=ZA(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-Lj),Lj),t/=Lj,t/Math.abs(t)+Math.round(t*(Rj-1)))}shouldForceSelection(e){return lj?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener(`mouseup`,this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),zj)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener(`mouseup`,this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(lj&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let e=n.lines.get(this._model.selectionEnd[1]);e&&e.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<Bj&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let t=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(t&&t[0]!==void 0&&t[1]!==void 0){let e=Sj(t[0]-1,t[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(e=>this._handleTrim(e))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let i=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:i>1&&t!==r&&(n+=i-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let i=this._bufferService.buffer,a=i.lines.get(e[1]);if(!a)return;let o=i.translateBufferLineToString(e[1],!1),s=this._convertViewportColToCharacterIndex(a,e[0]),c=s,l=e[0]-s,u=0,d=0,f=0,p=0;if(o.charAt(s)===` `){for(;s>0&&o.charAt(s-1)===` `;)s--;for(;c<o.length&&o.charAt(c+1)===` `;)c++}else{let t=e[0],n=e[0];a.getWidth(t)===0&&(u++,t--),a.getWidth(n)===2&&(d++,n++);let r=a.getString(n).length;for(r>1&&(p+=r-1,c+=r-1);t>0&&s>0&&!this._isCharWordSeparator(a.loadCell(t-1,this._workCell));){a.loadCell(t-1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===0?(u++,t--):e>1&&(f+=e-1,s-=e-1),s--,t--}for(;n<a.length&&c+1<o.length&&!this._isCharWordSeparator(a.loadCell(n+1,this._workCell));){a.loadCell(n+1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===2?(d++,n++):e>1&&(p+=e-1,c+=e-1),c++,n++}}c++;let m=s+l-u+f,h=Math.min(this._bufferService.cols,c-s+u+d-f-p);if(!(!t&&o.slice(s,c).trim()===``)){if(n&&m===0&&a.getCodePoint(0)!==32){let t=i.lines.get(e[1]-1);if(t&&a.isWrapped&&t.getCodePoint(this._bufferService.cols-1)!==32){let t=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(t){let e=this._bufferService.cols-t.start;m-=e,h+=e}}}if(r&&m+h===this._bufferService.cols&&a.getCodePoint(this._bufferService.cols-1)!==32){let t=i.lines.get(e[1]+1);if(t?.isWrapped&&t.getCodePoint(0)!==32){let t=this._getWordAt([0,e[1]+1],!1,!1,!0);t&&(h+=t.length)}}return{start:m,length:h}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=Ij(n,this._bufferService.cols)}};Hj=sE([X(3,PE),X(4,IE),X(5,JE),X(6,BE),X(7,YE),X(8,qE)],Hj);var Uj=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},Wj=class{constructor(){this._color=new Uj,this._css=new Uj}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},Gj=Object.freeze((()=>{let e=[yA.toColor(`#2e3436`),yA.toColor(`#cc0000`),yA.toColor(`#4e9a06`),yA.toColor(`#c4a000`),yA.toColor(`#3465a4`),yA.toColor(`#75507b`),yA.toColor(`#06989a`),yA.toColor(`#d3d7cf`),yA.toColor(`#555753`),yA.toColor(`#ef2929`),yA.toColor(`#8ae234`),yA.toColor(`#fce94f`),yA.toColor(`#729fcf`),yA.toColor(`#ad7fa8`),yA.toColor(`#34e2e2`),yA.toColor(`#eeeeec`)],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],a=t[n%6];e.push({css:_A.toCss(r,i,a),rgba:_A.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+t*10;e.push({css:_A.toCss(n,n,n),rgba:_A.toRgba(n,n,n)})}return e})()),Kj=yA.toColor(`#ffffff`),qj=yA.toColor(`#000000`),Jj=yA.toColor(`#ffffff`),Yj=qj,Xj={css:`rgba(255, 255, 255, 0.3)`,rgba:4294967117},Zj=Kj,Qj=class extends CD{constructor(e){super(),this._optionsService=e,this._contrastCache=new Wj,this._halfContrastCache=new Wj,this._onChangeColors=this._register(new Z),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Kj,background:qj,cursor:Jj,cursorAccent:Yj,selectionForeground:void 0,selectionBackgroundTransparent:Xj,selectionBackgroundOpaque:vA.blend(qj,Xj),selectionInactiveBackgroundTransparent:Xj,selectionInactiveBackgroundOpaque:vA.blend(qj,Xj),scrollbarSliderBackground:vA.opacity(Kj,.2),scrollbarSliderHoverBackground:vA.opacity(Kj,.4),scrollbarSliderActiveBackground:vA.opacity(Kj,.5),overviewRulerBorder:Kj,ansi:Gj.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange(`minimumContrastRatio`,()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange(`theme`,()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=$j(e.foreground,Kj),t.background=$j(e.background,qj),t.cursor=vA.blend(t.background,$j(e.cursor,Jj)),t.cursorAccent=vA.blend(t.background,$j(e.cursorAccent,Yj)),t.selectionBackgroundTransparent=$j(e.selectionBackground,Xj),t.selectionBackgroundOpaque=vA.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=$j(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=vA.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?$j(e.selectionForeground,gA):void 0,t.selectionForeground===gA&&(t.selectionForeground=void 0),vA.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=vA.opacity(t.selectionBackgroundTransparent,.3)),vA.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=vA.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=$j(e.scrollbarSliderBackground,vA.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=$j(e.scrollbarSliderHoverBackground,vA.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=$j(e.scrollbarSliderActiveBackground,vA.opacity(t.foreground,.5)),t.overviewRulerBorder=$j(e.overviewRulerBorder,Zj),t.ansi=Gj.slice(),t.ansi[0]=$j(e.black,Gj[0]),t.ansi[1]=$j(e.red,Gj[1]),t.ansi[2]=$j(e.green,Gj[2]),t.ansi[3]=$j(e.yellow,Gj[3]),t.ansi[4]=$j(e.blue,Gj[4]),t.ansi[5]=$j(e.magenta,Gj[5]),t.ansi[6]=$j(e.cyan,Gj[6]),t.ansi[7]=$j(e.white,Gj[7]),t.ansi[8]=$j(e.brightBlack,Gj[8]),t.ansi[9]=$j(e.brightRed,Gj[9]),t.ansi[10]=$j(e.brightGreen,Gj[10]),t.ansi[11]=$j(e.brightYellow,Gj[11]),t.ansi[12]=$j(e.brightBlue,Gj[12]),t.ansi[13]=$j(e.brightMagenta,Gj[13]),t.ansi[14]=$j(e.brightCyan,Gj[14]),t.ansi[15]=$j(e.brightWhite,Gj[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<n;r++)t.ansi[r+16]=$j(e.extendedAnsi[r],Gj[r+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let e=0;e<this._restoreColors.ansi.length;++e)this._colors.ansi[e]=this._restoreColors.ansi[e];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};Qj=sE([X(0,BE)],Qj);function $j(e,t){if(e!==void 0)try{return yA.toColor(e)}catch{}return t}var eM=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},tM=class{constructor(){this._services=new eM,this._services.set(RE,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=jE(e).sort((e,t)=>e.index-t.index),r=[];for(let t of n){let n=this._services.get(t.id);if(!n)throw Error(`[createInstance] ${e.name} depends on UNKNOWN service ${t.id._id}.`);r.push(n)}let i=n.length>0?n[0].index:t.length;if(t.length!==i)throw Error(`[createInstance] First service dependency of ${e.name} at position ${i+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},nM={trace:0,debug:1,info:2,warn:3,error:4,off:5},rM=`xterm.js: `,iM=class extends CD{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),aM=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=nM[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]==`function`&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?``:rM)+t,...n)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};iM=sE([X(0,BE)],iM);var aM,oM=class extends CD{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new Z),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new Z),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new Z),this.onTrim=this.onTrimEmitter.event,this._array=Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw Error(`Can only recycle when the buffer is full`);return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...n){if(t){for(let n=e;n<this._length-t;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let t=this._length-1;t>=e;t--)this._array[this._getCyclicIndex(t+n.length)]=this._array[this._getCyclicIndex(t)];for(let t=0;t<n.length;t++)this._array[this._getCyclicIndex(e+t)]=n[t];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let e=this._length+n.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw Error(`start argument out of range`);if(e+n<0)throw Error(`Cannot shift elements in list beyond index 0`);if(n>0){for(let r=t-1;r>=0;r--)this.set(e+r+n,this.get(e+r));let r=e+t+n-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+n,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},sM=3,cM=Object.freeze(new TE),lM=0,uM=2,dM=class e{constructor(e,t,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(e*sM);let r=t||DE.fromCharData([0,CE,1,0]);for(let t=0;t<e;++t)this.setCell(t,r);this.length=e}get(e){let t=this._data[e*sM+0],n=t&2097151;return[this._data[e*sM+1],t&2097152?this._combined[e]:n?yE(n):``,t>>22,t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,t){this._data[e*sM+1]=t[0],t[1].length>1?(this._combined[e]=t[1],this._data[e*sM+0]=e|2097152|t[2]<<22):this._data[e*sM+0]=t[1].charCodeAt(0)|t[2]<<22}getWidth(e){return this._data[e*sM+0]>>22}hasWidth(e){return this._data[e*sM+0]&12582912}getFg(e){return this._data[e*sM+1]}getBg(e){return this._data[e*sM+2]}hasContent(e){return this._data[e*sM+0]&4194303}getCodePoint(e){let t=this._data[e*sM+0];return t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):t&2097151}isCombined(e){return this._data[e*sM+0]&2097152}getString(e){let t=this._data[e*sM+0];return t&2097152?this._combined[e]:t&2097151?yE(t&2097151):``}isProtected(e){return this._data[e*sM+2]&536870912}loadCell(e,t){return lM=e*sM,t.content=this._data[lM+0],t.fg=this._data[lM+1],t.bg=this._data[lM+2],t.content&2097152&&(t.combinedData=this._combined[e]),t.bg&268435456&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){t.content&2097152&&(this._combined[e]=t.combinedData),t.bg&268435456&&(this._extendedAttrs[e]=t.extended),this._data[e*sM+0]=t.content,this._data[e*sM+1]=t.fg,this._data[e*sM+2]=t.bg}setCellFromCodepoint(e,t,n,r){r.bg&268435456&&(this._extendedAttrs[e]=r.extended),this._data[e*sM+0]=t|n<<22,this._data[e*sM+1]=r.fg,this._data[e*sM+2]=r.bg}addCodepointToCell(e,t,n){let r=this._data[e*sM+0];r&2097152?this._combined[e]+=yE(t):r&2097151?(this._combined[e]=yE(r&2097151)+yE(t),r&=-2097152,r|=2097152):r=t|1<<22,n&&(r&=-12582913,r|=n<<22),this._data[e*sM+0]=r}insertCells(e,t,n){if(e%=this.length,e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length-e){let r=new DE;for(let n=this.length-e-t-1;n>=0;--n)this.setCell(e+t+n,this.loadCell(e+n,r));for(let r=0;r<t;++r)this.setCell(e+r,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,n)}deleteCells(e,t,n){if(e%=this.length,t<this.length-e){let r=new DE;for(let n=0;n<this.length-e-t;++n)this.setCell(e+n,this.loadCell(e+t+n,r));for(let e=this.length-t;e<this.length;++e)this.setCell(e,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),this.getWidth(e)===0&&!this.hasContent(e)&&this.setCellFromCodepoint(e,0,1,n)}replaceCells(e,t,n,r=!1){if(r){for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&!this.isProtected(t)&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.isProtected(e)||this.setCell(e,n),e++;return}for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.setCell(e++,n)}resize(e,t){if(e===this.length)return this._data.length*4*uM<this._data.buffer.byteLength;let n=e*sM;if(e>this.length){if(this._data.buffer.byteLength>=n*4)this._data=new Uint32Array(this._data.buffer,0,n);else{let e=new Uint32Array(n);e.set(this._data),this._data=e}for(let n=this.length;n<e;++n)this.setCell(n,t)}else{this._data=this._data.subarray(0,n);let t=Object.keys(this._combined);for(let n=0;n<t.length;n++){let r=parseInt(t[n],10);r>=e&&delete this._combined[r]}let r=Object.keys(this._extendedAttrs);for(let t=0;t<r.length;t++){let n=parseInt(r[t],10);n>=e&&delete this._extendedAttrs[n]}}return this.length=e,n*4*uM<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*uM<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,t=!1){if(t){for(let t=0;t<this.length;++t)this.isProtected(t)||this.setCell(t,e);return}this._combined={},this._extendedAttrs={};for(let t=0;t<this.length;++t)this.setCell(t,e)}copyFrom(e){this.length===e.length?this._data.set(e._data):this._data=new Uint32Array(e._data),this.length=e.length,this._combined={};for(let t in e._combined)this._combined[t]=e._combined[t];this._extendedAttrs={};for(let t in e._extendedAttrs)this._extendedAttrs[t]=e._extendedAttrs[t];this.isWrapped=e.isWrapped}clone(){let t=new e(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let e in this._combined)t._combined[e]=this._combined[e];for(let e in this._extendedAttrs)t._extendedAttrs[e]=this._extendedAttrs[e];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*sM+0]&4194303)return e+(this._data[e*sM+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*sM+0]&4194303||this._data[e*sM+2]&50331648)return e+(this._data[e*sM+0]>>22);return 0}copyCellsFrom(e,t,n,r,i){let a=e._data;if(i)for(let i=r-1;i>=0;i--){for(let e=0;e<sM;e++)this._data[(n+i)*sM+e]=a[(t+i)*sM+e];a[(t+i)*sM+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}else for(let i=0;i<r;i++){for(let e=0;e<sM;e++)this._data[(n+i)*sM+e]=a[(t+i)*sM+e];a[(t+i)*sM+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}let o=Object.keys(e._combined);for(let r=0;r<o.length;r++){let i=parseInt(o[r],10);i>=t&&(this._combined[i-t+n]=e._combined[i])}}translateToString(e,t,n,r){t??=0,n??=this.length,e&&(n=Math.min(n,this.getTrimmedLength())),r&&(r.length=0);let i=``;for(;t<n;){let e=this._data[t*sM+0],n=e&2097151,a=e&2097152?this._combined[t]:n?yE(n):wE;if(i+=a,r)for(let e=0;e<a.length;++e)r.push(t);t+=e>>22||1}return r&&r.push(t),i}};function fM(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length-1;s++){let c=s,l=e.get(++c);if(!l.isWrapped)continue;let u=[e.get(s)];for(;c<e.length&&l.isWrapped;)u.push(l),l=e.get(++c);if(!a&&r>=s&&r<c){s+=u.length-1;continue}let d=0,f=gM(u,d,t),p=1,m=0;for(;p<u.length;){let e=gM(u,p,t),r=e-m,a=n-f,o=Math.min(r,a);u[d].copyCellsFrom(u[p],m,f,o,!1),f+=o,f===n&&(d++,f=0),m+=o,m===e&&(p++,m=0),f===0&&d!==0&&u[d-1].getWidth(n-1)===2&&(u[d].copyCellsFrom(u[d-1],n-1,f++,1,!1),u[d-1].setCell(n-1,i))}u[d].replaceCells(f,n,i);let h=0;for(let e=u.length-1;e>0&&(e>d||u[e].getTrimmedLength()===0);e--)h++;h>0&&(o.push(s+u.length-h),o.push(h)),s+=u.length-1}return o}function pM(e,t){let n=[],r=0,i=t[r],a=0;for(let o=0;o<e.length;o++)if(i===o){let n=t[++r];e.onDeleteEmitter.fire({index:o-a,amount:n}),o+=n-1,a+=n,i=t[++r]}else n.push(o);return{layout:n,countRemoved:a}}function mM(e,t){let n=[];for(let r=0;r<t.length;r++)n.push(e.get(t[r]));for(let t=0;t<n.length;t++)e.set(t,n[t]);e.length=t.length}function hM(e,t,n){let r=[],i=e.map((n,r)=>gM(e,r,t)).reduce((e,t)=>e+t),a=0,o=0,s=0;for(;s<i;){if(i-s<n){r.push(i-s);break}a+=n;let c=gM(e,o,t);a>c&&(a-=c,o++);let l=e[o].getWidth(a-1)===2;l&&a--;let u=l?n-1:n;r.push(u),s+=u}return r}function gM(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,i=e[t+1].getWidth(0)===2;return r&&i?n-1:n}var _M=class e{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=e._nextId++,this._onDispose=this.register(new Z),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),vD(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};_M._nextId=1;var vM=_M,yM={},bM=yM.B;yM[0]={"`":`◆`,a:`▒`,b:`␉`,c:`␌`,d:`␍`,e:`␊`,f:`°`,g:`±`,h:``,i:`␋`,j:`┘`,k:`┐`,l:`┌`,m:`└`,n:`┼`,o:`⎺`,p:`⎻`,q:`─`,r:`⎼`,s:`⎽`,t:`├`,u:`┤`,v:`┴`,w:`┬`,x:`│`,y:`≤`,z:`≥`,"{":`π`,"|":`≠`,"}":`£`,"~":`·`},yM.A={"#":`£`},yM.B=void 0,yM[4]={"#":`£`,"@":`¾`,"[":`ij`,"\\":`½`,"]":`|`,"{":`¨`,"|":`f`,"}":`¼`,"~":`´`},yM.C=yM[5]={"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},yM.R={"#":`£`,"@":`à`,"[":`°`,"\\":`ç`,"]":`§`,"{":`é`,"|":`ù`,"}":`è`,"~":`¨`},yM.Q={"@":`à`,"[":`â`,"\\":`ç`,"]":`ê`,"^":`î`,"`":`ô`,"{":`é`,"|":`ù`,"}":`è`,"~":`û`},yM.K={"@":`§`,"[":`Ä`,"\\":`Ö`,"]":`Ü`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`ß`},yM.Y={"#":`£`,"@":`§`,"[":`°`,"\\":`ç`,"]":`é`,"`":`ù`,"{":`à`,"|":`ò`,"}":`è`,"~":`ì`},yM.E=yM[6]={"@":`Ä`,"[":`Æ`,"\\":`Ø`,"]":`Å`,"^":`Ü`,"`":`ä`,"{":`æ`,"|":`ø`,"}":`å`,"~":`ü`},yM.Z={"#":`£`,"@":`§`,"[":`¡`,"\\":`Ñ`,"]":`¿`,"{":`°`,"|":`ñ`,"}":`ç`},yM.H=yM[7]={"@":`É`,"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},yM[`=`]={"#":`ù`,"@":`à`,"[":`é`,"\\":`ç`,"]":`ê`,"^":`î`,_:`è`,"`":`ô`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`û`};var xM=4294967295,SM=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=cM.clone(),this.savedCharset=bM,this.markers=[],this._nullCell=DE.fromCharData([0,CE,1,0]),this._whitespaceCell=DE.fromCharData([0,wE,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new vj,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new oM(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new EE),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new EE),this._whitespaceCell}getBlankLine(e,t){return new dM(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>xM?xM:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=cM);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new oM(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(cM),r=0,i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols<e)for(let t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);let a=0;if(this._rows<t)for(let r=this._rows;r<t;r++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new dM(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+a+1?(this.ybase--,a++,this.ydisp>0&&this.ydisp--):this.lines.push(new dM(e,n)));else for(let e=this._rows;e>t;e--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i<this.lines.maxLength){let e=this.lines.length-i;e>0&&(this.lines.trimStart(e),this.ybase=Math.max(this.ybase-e,0),this.ydisp=Math.max(this.ydisp-e,0),this.savedY=Math.max(this.savedY-e,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),a&&(this.y+=a),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend===`conpty`&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=fM(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(cM),n);if(r.length>0){let n=pM(this.lines,r);mM(this.lines,n.layout),this._reflowLargerAdjustViewport(e,t,n.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(cM),i=n;for(;i-->0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new dM(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(cM),i=[],a=0;for(let o=this.lines.length-1;o>=0;o--){let s=this.lines.get(o);if(!s||!s.isWrapped&&s.getTrimmedLength()<=e)continue;let c=[s];for(;s.isWrapped&&o>0;)s=this.lines.get(--o),c.unshift(s);if(!n){let e=this.ybase+this.y;if(e>=o&&e<o+c.length)continue}let l=c[c.length-1].getTrimmedLength(),u=hM(c,this._cols,e),d=u.length-c.length,f;f=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+d):Math.max(0,this.lines.length-this.lines.maxLength+d);let p=[];for(let e=0;e<d;e++){let e=this.getBlankLine(cM,!0);p.push(e)}p.length>0&&(i.push({start:o+c.length+a,newLines:p}),a+=p.length),c.push(...p);let m=u.length-1,h=u[m];h===0&&(m--,h=u[m]);let g=c.length-d-1,_=l;for(;g>=0;){let e=Math.min(_,h);if(c[m]===void 0)break;c[m].copyCellsFrom(c[g],_-e,h-e,e,!0),h-=e,h===0&&(m--,h=u[m]),_-=e,_===0&&(g--,_=gM(c,Math.max(g,0),this._cols))}for(let t=0;t<c.length;t++)u[t]<e&&c[t].setCell(u[t],r);let v=d-f;for(;v-->0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+a)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+d,this.ybase+t-1)}if(i.length>0){let e=[],t=[];for(let e=0;e<this.lines.length;e++)t.push(this.lines.get(e));let n=this.lines.length,r=n-1,o=0,s=i[o];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+a);let c=0;for(let l=Math.min(this.lines.maxLength-1,n+a-1);l>=0;l--)if(s&&s.start>r+c){for(let e=s.newLines.length-1;e>=0;e--)this.lines.set(l--,s.newLines[e]);l++,e.push({index:r+1,amount:s.newLines.length}),c+=s.newLines.length,s=i[++o]}else this.lines.set(l,t[r--]);let l=0;for(let t=e.length-1;t>=0;t--)e[t].index+=l,this.lines.onInsertEmitter.fire(e[t]),l+=e[t].amount;let u=Math.max(0,n+a-this.lines.maxLength);u>0&&this.lines.onTrimEmitter.fire(u)}}translateBufferLineToString(e,t,n=0,r){let i=this.lines.get(e);return i?i.translateToString(t,n,r):``}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e==null?(this.tabs={},e=0):this.tabs[e]||(e=this.prevStop(e));e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e??=this.x;!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e??=this.x;!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new vM(e);return this.markers.push(t),t.register(this.lines.onTrim(e=>{t.line-=e,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(e=>{t.line>=e.index&&(t.line+=e.amount)})),t.register(this.lines.onDelete(e=>{t.line>=e.index&&t.line<e.index+e.amount&&t.dispose(),t.line>e.index&&(t.line-=e.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},CM=class extends CD{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new Z),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange(`scrollback`,()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange(`tabStopWidth`,()=>this.setupTabStops()))}reset(){this._normal=new SM(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new SM(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},wM=2,TM=1,EM=class extends CD{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new Z),this.onResize=this._onResize.event,this._onScroll=this._register(new Z),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,wM),this.rows=Math.max(e.rawOptions.rows||0,TM),this.buffers=this._register(new CM(e,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let i=n.ybase+n.scrollTop,a=n.ybase+n.scrollBottom;if(n.scrollTop===0){let e=n.lines.isFull;a===n.lines.length-1?e?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(a+1,0,r.clone()),e?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let e=a-i+1;n.lines.shiftElements(i+1,e-1,-1),n.lines.set(a,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let r=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),r!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};EM=sE([X(0,BE)],EM);var DM={cols:80,rows:24,cursorBlink:!1,cursorStyle:`block`,cursorWidth:1,cursorInactiveStyle:`outline`,customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:`alt`,fastScrollSensitivity:5,fontFamily:`monospace`,fontSize:15,fontWeight:`normal`,fontWeightBold:`bold`,ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:`info`,logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:lj,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:` ()[]{}',"\``,altClickMovesCursor:!0,convertEol:!1,termName:`xterm`,cancelEvents:!1,overviewRuler:{}},OM=[`normal`,`bold`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`],kM=class extends CD{constructor(e){super(),this._onOptionChange=this._register(new Z),this.onOptionChange=this._onOptionChange.event;let t={...DM};for(let n in e)if(n in t)try{let r=e[n];t[n]=this._sanitizeAndValidateOption(n,r)}catch(e){console.error(e)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(bD(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=e=>{if(!(e in DM))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},t=(e,t)=>{if(!(e in DM))throw Error(`No option with key "${e}"`);t=this._sanitizeAndValidateOption(e,t),this.rawOptions[e]!==t&&(this.rawOptions[e]=t,this._onOptionChange.fire(e))};for(let n in this.rawOptions){let r={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(e,t){switch(e){case`cursorStyle`:if(t||=DM[e],!AM(t))throw Error(`"${t}" is not a valid value for ${e}`);break;case`wordSeparator`:t||=DM[e];break;case`fontWeight`:case`fontWeightBold`:if(typeof t==`number`&&1<=t&&t<=1e3)break;t=OM.includes(t)?t:DM[e];break;case`cursorWidth`:t=Math.floor(t);case`lineHeight`:case`tabStopWidth`:if(t<1)throw Error(`${e} cannot be less than 1, value: ${t}`);break;case`minimumContrastRatio`:t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case`scrollback`:if(t=Math.min(t,4294967295),t<0)throw Error(`${e} cannot be less than 0, value: ${t}`);break;case`fastScrollSensitivity`:case`scrollSensitivity`:if(t<=0)throw Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case`rows`:case`cols`:if(!t&&t!==0)throw Error(`${e} must be numeric, value: ${t}`);break;case`windowsPty`:t??={}}return t}};function AM(e){return e===`block`||e===`underline`||e===`bar`}function jM(e,t=5){if(typeof e!=`object`)return e;let n=Array.isArray(e)?[]:{};for(let r in e)n[r]=t<=1?e[r]:e[r]&&jM(e[r],t-1);return n}var MM=Object.freeze({insertMode:!1}),NM=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),PM=class extends CD{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new Z),this.onData=this._onData.event,this._onUserInput=this._register(new Z),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new Z),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new Z),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=jM(MM),this.decPrivateModes=jM(NM)}reset(){this.modes=jM(MM),this.decPrivateModes=jM(NM)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace(`sending data (codes)`,()=>e.split(``).map(e=>e.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace(`sending binary (codes)`,()=>e.split(``).map(e=>e.charCodeAt(0))),this._onBinary.fire(e))}};PM=sE([X(0,PE),X(1,zE),X(2,BE)],PM);var FM={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>e.action!==32||e.button!==3},ANY:{events:31,restrict:e=>!0}};function IM(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var LM=String.fromCharCode,RM={DEFAULT:e=>{let t=[IM(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?``:`\x1B[M${LM(t[0])}${LM(t[1])}${LM(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${IM(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${IM(e,!0)};${e.x};${e.y}${t}`}},zM=class extends CD{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol=``,this._activeEncoding=``,this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new Z),this.onProtocolChange=this._onProtocolChange.event;for(let e of Object.keys(FM))this.addProtocol(e,FM[e]);for(let e of Object.keys(RM))this.addEncoding(e,RM[e]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol=`NONE`,this.activeEncoding=`DEFAULT`,this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let r=t/n,i=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=r+0,Math.abs(e.deltaY)<50&&(i*=.3),this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding===`SGR_PIXELS`))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding===`DEFAULT`?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return e.button===t.button&&e.action===t.action&&e.ctrl===t.ctrl&&e.alt===t.alt&&e.shift===t.shift}};zM=sE([X(0,PE),X(1,IE),X(2,BE)],zM);var BM=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],VM=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],HM;function UM(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var WM=class{constructor(){if(this.version=`6`,!HM){HM=new Uint8Array(65536),HM.fill(1),HM[0]=0,HM.fill(0,1,32),HM.fill(0,127,160),HM.fill(2,4352,4448),HM[9001]=2,HM[9002]=2,HM.fill(2,11904,42192),HM[12351]=1,HM.fill(2,44032,55204),HM.fill(2,63744,64256),HM.fill(2,65040,65050),HM.fill(2,65072,65136),HM.fill(2,65280,65377),HM.fill(2,65504,65511);for(let e=0;e<BM.length;++e)HM.fill(0,BM[e][0],BM[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?HM[e]:UM(e,VM)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=GM.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return GM.createPropertyValue(0,n,r)}},GM=class e{constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new Z,this.onChange=this._onChange.event;let e=new WM;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return!!(e&1)}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,n=!1){return(e&16777215)<<3|(t&3)<<1|!!n}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(t){let n=0,r=0,i=t.length;for(let a=0;a<i;++a){let o=t.charCodeAt(a);if(55296<=o&&o<=56319){if(++a>=i)return n+this.wcwidth(o);let e=t.charCodeAt(a);56320<=e&&e<=57343?o=(o-55296)*1024+e-56320+65536:n+=this.wcwidth(e)}let s=this.charProperties(o,r),c=e.extractWidth(s);e.extractShouldJoin(s)&&(c-=e.extractWidth(r)),n+=c,r=s}return n}charProperties(e,t){return this._activeProvider.charProperties(e,t)}},KM=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function qM(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var JM=2147483647,YM=256,XM=class e{constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>YM)throw Error(`maxSubParamsLength must not be greater than 256`);this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new e;if(!t.length)return n;for(let e=+!!Array.isArray(t[0]);e<t.length;++e){let r=t[e];if(Array.isArray(r))for(let e=0;e<r.length;++e)n.addSubParam(r[e]);else n.addParam(r)}return n}clone(){let t=new e(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let e=[];for(let t=0;t<this.length;++t){e.push(this.params[t]);let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;r-n>0&&e.push(Array.prototype.slice.call(this._subParams,n,r))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>JM?JM:e}addSubParam(e){if(this._digitIsSub=!0,this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParams[this._subParamsLength++]=e>JM?JM:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(this._subParamsIdx[e]&255)-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let t=this._subParamsIdx[e]>>8,n=this._subParamsIdx[e]&255;return n-t>0?this._subParams.subarray(t,n):null}getSubParamsAll(){let e={};for(let t=0;t<this.length;++t){let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;r-n>0&&(e[t]=this._subParams.slice(n,r))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let n=this._digitIsSub?this._subParams:this.params,r=n[t-1];n[t-1]=~r?Math.min(r*10+e,JM):e}},ZM=[],QM=class{constructor(){this._state=0,this._active=ZM,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=ZM}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=ZM,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||ZM,!this._active.length)this._handlerFb(this._id,`START`);else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,n){if(!this._active.length)this._handlerFb(this._id,`PUT`,bE(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let n=e[t++];if(n===59){this._state=2,this._start();break}if(n<48||57<n){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+n-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3){if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,`END`,e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].end(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}}this._active=ZM,this._id=-1,this._state=0}}},$M=class{constructor(e){this._handler=e,this._data=``,this._hitLimit=!1}start(){this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=bE(e,t,n),this._data.length>1e7&&(this._data=``,this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(e=>(this._data=``,this._hitLimit=!1,e));return this._data=``,this._hitLimit=!1,t}},eN=[],tN=class{constructor(){this._handlers=Object.create(null),this._active=eN,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=eN}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=eN,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||eN,!this._active.length)this._handlerFb(this._ident,`HOOK`,t);else for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,`PUT`,bE(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,`UNHOOK`,e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].unhook(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=eN,this._ident=0}},nN=new XM;nN.addParam(0);var rN=class{constructor(e){this._handler=e,this._data=``,this._params=nN,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():nN,this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=bE(e,t,n),this._data.length>1e7&&(this._data=``,this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(e=>(this._params=nN,this._data=``,this._hitLimit=!1,e));return this._params=nN,this._data=``,this._hitLimit=!1,t}},iN=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let i=0;i<e.length;i++)this.table[t<<8|e[i]]=n<<4|r}},aN=160,oN=function(){let e=new iN(4095),t=Array.apply(null,Array(256)).map((e,t)=>t),n=(e,n)=>t.slice(e,n),r=n(32,127),i=n(0,24);i.push(25),i.push.apply(i,n(28,32));let a=n(0,14),o;for(o in e.setDefault(1,0),e.addMany(r,0,2,0),a)e.addMany([24,26,153,154],o,3,0),e.addMany(n(128,144),o,3,0),e.addMany(n(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(aN,0,2,0),e.add(aN,8,5,8),e.add(aN,6,0,6),e.add(aN,11,0,11),e.add(aN,13,13,13),e}(),sN=class extends CD{constructor(e=oN){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new XM,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,n)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(bD(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new QM),this._dcsParser=this._register(new tN),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:`\\`},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw Error(`only one byte as prefix supported`);if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw Error(`prefix must be in range 0x3c .. 0x3f`)}if(e.intermediates){if(e.intermediates.length>2)throw Error(`only two bytes as intermediates are supported`);for(let t=0;t<e.intermediates.length;++t){let r=e.intermediates.charCodeAt(t);if(32>r||r>47)throw Error(`intermediate must be in range 0x20 .. 0x2f`);n<<=8,n|=r}}if(e.final.length!==1)throw Error(`final must be a single byte`);let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join(``)}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,r,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=i}parse(e,t,n){let r=0,i=0,a=0,o;if(this._parseStack.state){if(this._parseStack.state===2)this._parseStack.state=0,a=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,Error(`improper continuation due to previous async handler, giving up parsing`);let t=this._parseStack.handlers,i=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](this._params),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 4:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],o=this._oscParser.end(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,a=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}}for(let n=a;n<t;++n){switch(r=e[n],i=this._transitions.table[this.currentState<<8|(r<160?r:aN)],i>>4){case 2:for(let i=n+1;;++i){if(i>=t||(r=e[i])<32||r>126&&r<aN){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<aN){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<aN){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<aN){this._printHandler(e,n,i),n=i-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:n,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let a=this._csiHandlers[this._collect<<8|r],s=a?a.length-1:-1;for(;s>=0&&(o=a[s](this._params),o!==!0);s--)if(o instanceof Promise)return this._preserveStack(3,a,s,i,n),o;s<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++n<t&&(r=e[n])>47&&r<60);n--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let c=this._escHandlers[this._collect<<8|r],l=c?c.length-1:-1;for(;l>=0&&(o=c[l](),o!==!0);l--)if(o instanceof Promise)return this._preserveStack(4,c,l,i,n),o;l<0&&this._escHandlerFb(this._collect<<8|r),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|r,this._params);break;case 13:for(let i=n+1;;++i)if(i>=t||(r=e[i])===24||r===26||r===27||r>127&&r<aN){this._dcsParser.put(e,n,i),n=i-1;break}break;case 14:if(o=this._dcsParser.unhook(r!==24&&r!==26),o)return this._preserveStack(6,[],0,i,n),o;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let i=n+1;;i++)if(i>=t||(r=e[i])<32||r>127&&r<aN){this._oscParser.put(e,n,i),n=i-1;break}break;case 6:if(o=this._oscParser.end(r!==24&&r!==26),o)return this._preserveStack(5,[],0,i,n),o;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=i&15}}},cN=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,lN=/^[\da-f]+$/;function uN(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf(`rgb:`)===0){t=t.slice(4);let e=cN.exec(t);if(e){let t=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/t*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/t*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/t*255)]}}else if(t.indexOf(`#`)===0&&(t=t.slice(1),lN.exec(t)&&[3,6,9,12].includes(t.length))){let e=t.length/3,n=[0,0,0];for(let r=0;r<3;++r){let i=parseInt(t.slice(e*r,e*r+e),16);n[r]=e===1?i<<4:e===2?i:e===3?i>>4:i>>8}return n}}function dN(e,t){let n=e.toString(16),r=n.length<2?`0`+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function fN(e,t=16){let[n,r,i]=e;return`rgb:${dN(n,t)}/${dN(r,t)}/${dN(i,t)}`}var pN={"(":0,")":1,"*":2,"+":3,"-":1,".":2},mN=131072,hN=10;function gN(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var _N=5e3,vN=0,yN=class extends CD{constructor(e,t,n,r,i,a,o,s,c=new sN){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=i,this._oscLinkService=a,this._coreMouseService=o,this._unicodeService=s,this._parser=c,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new xE,this._utf8Decoder=new SE,this._windowTitle=``,this._iconName=``,this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=cM.clone(),this._eraseAttrDataInternal=cM.clone(),this._onRequestBell=this._register(new Z),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new Z),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new Z),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new Z),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new Z),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new Z),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new Z),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new Z),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new Z),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new Z),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new Z),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new Z),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new Z),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new bN(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,t)=>{this._logService.debug(`Unknown CSI code: `,{identifier:this._parser.identToString(e),params:t.toArray()})}),this._parser.setEscHandlerFallback(e=>{this._logService.debug(`Unknown ESC code: `,{identifier:this._parser.identToString(e)})}),this._parser.setExecuteHandlerFallback(e=>{this._logService.debug(`Unknown EXECUTE code: `,{code:e})}),this._parser.setOscHandlerFallback((e,t,n)=>{this._logService.debug(`Unknown OSC code: `,{identifier:e,action:t,data:n})}),this._parser.setDcsHandlerFallback((e,t,n)=>{t===`HOOK`&&(n=n.toArray()),this._logService.debug(`Unknown DCS code: `,{identifier:this._parser.identToString(e),action:t,payload:n})}),this._parser.setPrintHandler((e,t,n)=>this.print(e,t,n)),this._parser.registerCsiHandler({final:`@`},e=>this.insertChars(e)),this._parser.registerCsiHandler({intermediates:` `,final:`@`},e=>this.scrollLeft(e)),this._parser.registerCsiHandler({final:`A`},e=>this.cursorUp(e)),this._parser.registerCsiHandler({intermediates:` `,final:`A`},e=>this.scrollRight(e)),this._parser.registerCsiHandler({final:`B`},e=>this.cursorDown(e)),this._parser.registerCsiHandler({final:`C`},e=>this.cursorForward(e)),this._parser.registerCsiHandler({final:`D`},e=>this.cursorBackward(e)),this._parser.registerCsiHandler({final:`E`},e=>this.cursorNextLine(e)),this._parser.registerCsiHandler({final:`F`},e=>this.cursorPrecedingLine(e)),this._parser.registerCsiHandler({final:`G`},e=>this.cursorCharAbsolute(e)),this._parser.registerCsiHandler({final:`H`},e=>this.cursorPosition(e)),this._parser.registerCsiHandler({final:`I`},e=>this.cursorForwardTab(e)),this._parser.registerCsiHandler({final:`J`},e=>this.eraseInDisplay(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`J`},e=>this.eraseInDisplay(e,!0)),this._parser.registerCsiHandler({final:`K`},e=>this.eraseInLine(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`K`},e=>this.eraseInLine(e,!0)),this._parser.registerCsiHandler({final:`L`},e=>this.insertLines(e)),this._parser.registerCsiHandler({final:`M`},e=>this.deleteLines(e)),this._parser.registerCsiHandler({final:`P`},e=>this.deleteChars(e)),this._parser.registerCsiHandler({final:`S`},e=>this.scrollUp(e)),this._parser.registerCsiHandler({final:`T`},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:`X`},e=>this.eraseChars(e)),this._parser.registerCsiHandler({final:`Z`},e=>this.cursorBackwardTab(e)),this._parser.registerCsiHandler({final:"`"},e=>this.charPosAbsolute(e)),this._parser.registerCsiHandler({final:`a`},e=>this.hPositionRelative(e)),this._parser.registerCsiHandler({final:`b`},e=>this.repeatPrecedingCharacter(e)),this._parser.registerCsiHandler({final:`c`},e=>this.sendDeviceAttributesPrimary(e)),this._parser.registerCsiHandler({prefix:`>`,final:`c`},e=>this.sendDeviceAttributesSecondary(e)),this._parser.registerCsiHandler({final:`d`},e=>this.linePosAbsolute(e)),this._parser.registerCsiHandler({final:`e`},e=>this.vPositionRelative(e)),this._parser.registerCsiHandler({final:`f`},e=>this.hVPosition(e)),this._parser.registerCsiHandler({final:`g`},e=>this.tabClear(e)),this._parser.registerCsiHandler({final:`h`},e=>this.setMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`h`},e=>this.setModePrivate(e)),this._parser.registerCsiHandler({final:`l`},e=>this.resetMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`l`},e=>this.resetModePrivate(e)),this._parser.registerCsiHandler({final:`m`},e=>this.charAttributes(e)),this._parser.registerCsiHandler({final:`n`},e=>this.deviceStatus(e)),this._parser.registerCsiHandler({prefix:`?`,final:`n`},e=>this.deviceStatusPrivate(e)),this._parser.registerCsiHandler({intermediates:`!`,final:`p`},e=>this.softReset(e)),this._parser.registerCsiHandler({intermediates:` `,final:`q`},e=>this.setCursorStyle(e)),this._parser.registerCsiHandler({final:`r`},e=>this.setScrollRegion(e)),this._parser.registerCsiHandler({final:`s`},e=>this.saveCursor(e)),this._parser.registerCsiHandler({final:`t`},e=>this.windowOptions(e)),this._parser.registerCsiHandler({final:`u`},e=>this.restoreCursor(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`}`},e=>this.insertColumns(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`~`},e=>this.deleteColumns(e)),this._parser.registerCsiHandler({intermediates:`"`,final:`q`},e=>this.selectProtected(e)),this._parser.registerCsiHandler({intermediates:`$`,final:`p`},e=>this.requestMode(e,!0)),this._parser.registerCsiHandler({prefix:`?`,intermediates:`$`,final:`p`},e=>this.requestMode(e,!1)),this._parser.setExecuteHandler($.BEL,()=>this.bell()),this._parser.setExecuteHandler($.LF,()=>this.lineFeed()),this._parser.setExecuteHandler($.VT,()=>this.lineFeed()),this._parser.setExecuteHandler($.FF,()=>this.lineFeed()),this._parser.setExecuteHandler($.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler($.BS,()=>this.backspace()),this._parser.setExecuteHandler($.HT,()=>this.tab()),this._parser.setExecuteHandler($.SO,()=>this.shiftOut()),this._parser.setExecuteHandler($.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(lA.IND,()=>this.index()),this._parser.setExecuteHandler(lA.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(lA.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new $M(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new $M(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new $M(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new $M(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new $M(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new $M(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new $M(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new $M(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new $M(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new $M(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new $M(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new $M(e=>this.restoreCursorColor(e))),this._parser.registerEscHandler({final:`7`},()=>this.saveCursor()),this._parser.registerEscHandler({final:`8`},()=>this.restoreCursor()),this._parser.registerEscHandler({final:`D`},()=>this.index()),this._parser.registerEscHandler({final:`E`},()=>this.nextLine()),this._parser.registerEscHandler({final:`H`},()=>this.tabSet()),this._parser.registerEscHandler({final:`M`},()=>this.reverseIndex()),this._parser.registerEscHandler({final:`=`},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:`>`},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:`c`},()=>this.fullReset()),this._parser.registerEscHandler({final:`n`},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:`o`},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:`|`},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:`}`},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:`~`},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:`%`,final:`@`},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:`%`,final:`G`},()=>this.selectDefaultCharset());for(let e in yM)this._parser.registerEscHandler({intermediates:`(`,final:e},()=>this.selectCharset(`(`+e)),this._parser.registerEscHandler({intermediates:`)`,final:e},()=>this.selectCharset(`)`+e)),this._parser.registerEscHandler({intermediates:`*`,final:e},()=>this.selectCharset(`*`+e)),this._parser.registerEscHandler({intermediates:`+`,final:e},()=>this.selectCharset(`+`+e)),this._parser.registerEscHandler({intermediates:`-`,final:e},()=>this.selectCharset(`-`+e)),this._parser.registerEscHandler({intermediates:`.`,final:e},()=>this.selectCharset(`.`+e)),this._parser.registerEscHandler({intermediates:`/`,final:e},()=>this.selectCharset(`/`+e));this._parser.registerEscHandler({intermediates:`#`,final:`8`},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(e=>(this._logService.error(`Parsing error: `,e),e)),this._parser.registerDcsHandler({intermediates:`$`,final:`q`},new rN((e,t)=>this.requestStatusString(e,t)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((e,t)=>setTimeout(()=>t(`#SLOW_TIMEOUT`),_N))]).catch(e=>{if(e!==`#SLOW_TIMEOUT`)throw e;console.warn(`async parser handler taking longer than ${_N} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,i=this._activeBuffer.y,a=0,o=this._parseStack.paused;if(o){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>mN&&(a=this._parseStack.position+mN)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e==`string`?` "${e}"`:` "${Array.prototype.map.call(e,e=>String.fromCharCode(e)).join(``)}"`}`),this._logService.logLevel===0&&this._logService.trace(`parsing data (codes)`,typeof e==`string`?e.split(``).map(e=>e.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<mN&&(this._parseBuffer=new Uint32Array(Math.min(e.length,mN))),o||this._dirtyRowTracker.clearRange(),e.length>mN)for(let t=a;t<e.length;t+=mN){let a=t+mN<e.length?t+mN:e.length,o=typeof e==`string`?this._stringDecoder.decode(e.substring(t,a),this._parseBuffer):this._utf8Decoder.decode(e.subarray(t,a),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,o))return this._preserveStack(r,i,o,t),this._logSlowResolvingAsync(n),n}else if(!o){let t=typeof e==`string`?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,t))return this._preserveStack(r,i,t,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==r||this._activeBuffer.y!==i)&&this._onCursorMove.fire();let s=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),c=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);c<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(c,this._bufferService.rows-1),end:Math.min(s,this._bufferService.rows-1)})}print(e,t,n){let r,i,a=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,s=this._bufferService.cols,c=this._coreService.decPrivateModes.wraparound,l=this._coreService.modes.insertMode,u=this._curAttrData,d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&d.getWidth(this._activeBuffer.x-1)===2&&d.setCellFromCodepoint(this._activeBuffer.x-1,0,1,u);let f=this._parser.precedingJoinState;for(let p=t;p<n;++p){if(r=e[p],r<127&&a){let e=a[String.fromCharCode(r)];e&&(r=e.charCodeAt(0))}let t=this._unicodeService.charProperties(r,f);i=GM.extractWidth(t);let n=GM.extractShouldJoin(t),m=n?GM.extractWidth(f):0;if(f=t,o&&this._onA11yChar.fire(yE(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-m>s){if(c){let e=d,t=this._activeBuffer.x-m;for(this._activeBuffer.x=m,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),m>0&&d instanceof dM&&d.copyCellsFrom(e,t,0,m,!1);t<s;)e.setCellFromCodepoint(t++,0,1,u)}else if(this._activeBuffer.x=s-1,i===2)continue}if(n&&this._activeBuffer.x){let e=d.getWidth(this._activeBuffer.x-1)?1:2;d.addCodepointToCell(this._activeBuffer.x-e,r,i);for(let e=i-m;--e>=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u);continue}if(l&&(d.insertCells(this._activeBuffer.x,i-m,this._activeBuffer.getNullCell(u)),d.getWidth(s-1)===2&&d.setCellFromCodepoint(s-1,0,1,u)),d.setCellFromCodepoint(this._activeBuffer.x++,r,i,u),i>0)for(;--i;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u)}this._parser.precedingJoinState=f,this._activeBuffer.x<s&&n-t>0&&d.getWidth(this._activeBuffer.x)===0&&!d.hasContent(this._activeBuffer.x)&&d.setCellFromCodepoint(this._activeBuffer.x,0,1,u),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final===`t`&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,e=>!gN(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e)):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new rN(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new $M(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,r=!1,i=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),i),r&&(a.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+n)?.getTrimmedLength(););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let e=this._activeBuffer.lines.length-this._bufferService.rows;e>0&&(this._activeBuffer.lines.trimStart(e),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-e,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-e,0),this._onScroll.fire(0))}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(i-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(cM));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,r=GM.extractWidth(t),i=this._activeBuffer.x-r,a=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),o=new Uint32Array(a.length*n),s=0;for(let e=0;e<a.length;){let t=a.codePointAt(e)||0;o[s++]=t,e+=t>65535?2:1}let c=s;for(let e=1;e<n;++e)o.copyWithin(c,0,s),c+=s;return this.print(o,0,c),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is(`xterm`)||this._is(`rxvt-unicode`)||this._is(`screen`)?this._coreService.triggerDataEvent($.ESC+`[?1;2c`):this._is(`linux`)&&this._coreService.triggerDataEvent($.ESC+`[?6c`)),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is(`xterm`)?this._coreService.triggerDataEvent($.ESC+`[>0;276;0c`):this._is(`rxvt-unicode`)?this._coreService.triggerDataEvent($.ESC+`[>85;95;0c`):this._is(`linux`)?this._coreService.triggerDataEvent(e.params[0]+`c`):this._is(`screen`)&&this._coreService.triggerDataEvent($.ESC+`[>83;40003;0c`)),!0}_is(e){return(this._optionsService.rawOptions.termName+``).indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,bM),this._charsetService.setgCharset(1,bM),this._charsetService.setgCharset(2,bM),this._charsetService.setgCharset(3,bM);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug(`Serial port requested application keypad.`),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol=`X10`;break;case 1e3:this._coreMouseService.activeProtocol=`VT200`;break;case 1002:this._coreMouseService.activeProtocol=`DRAG`;break;case 1003:this._coreMouseService.activeProtocol=`ANY`;break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug(`DECSET 1005 not supported (see #2507)`);break;case 1006:this._coreMouseService.activeEncoding=`SGR`;break;case 1015:this._logService.debug(`DECSET 1015 not supported (see #2507)`);break;case 1016:this._coreMouseService.activeEncoding=`SGR_PIXELS`;break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug(`Switching back to normal keypad.`),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol=`NONE`;break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug(`DECRST 1005 not supported (see #2507)`);break;case 1006:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 1015:this._logService.debug(`DECRST 1015 not supported (see #2507)`);break;case 1016:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0)}return!0}requestMode(e,t){let n;(e=>(e[e.NOT_RECOGNIZED=0]=`NOT_RECOGNIZED`,e[e.SET=1]=`SET`,e[e.RESET=2]=`RESET`,e[e.PERMANENTLY_SET=3]=`PERMANENTLY_SET`,e[e.PERMANENTLY_RESET=4]=`PERMANENTLY_RESET`))(n||={});let r=this._coreService.decPrivateModes,{activeProtocol:i,activeEncoding:a}=this._coreMouseService,o=this._coreService,{buffers:s,cols:c}=this._bufferService,{active:l,alt:u}=s,d=this._optionsService.rawOptions,f=(e,n)=>(o.triggerDataEvent(`${$.ESC}[${t?``:`?`}${e};${n}$y`),!0),p=e=>e?1:2,m=e.params[0];return t?m===2?f(m,4):m===4?f(m,p(o.modes.insertMode)):m===12?f(m,3):m===20?f(m,p(d.convertEol)):f(m,0):m===1?f(m,p(r.applicationCursorKeys)):m===3?f(m,d.windowOptions.setWinLines?c===80?2:+(c===132):0):m===6?f(m,p(r.origin)):m===7?f(m,p(r.wraparound)):m===8?f(m,3):m===9?f(m,p(i===`X10`)):m===12?f(m,p(d.cursorBlink)):m===25?f(m,p(!o.isCursorHidden)):m===45?f(m,p(r.reverseWraparound)):m===66?f(m,p(r.applicationKeypad)):m===67?f(m,4):m===1e3?f(m,p(i===`VT200`)):m===1002?f(m,p(i===`DRAG`)):m===1003?f(m,p(i===`ANY`)):m===1004?f(m,p(r.sendFocus)):m===1005?f(m,4):m===1006?f(m,p(a===`SGR`)):m===1015?f(m,4):m===1016?f(m,p(a===`SGR_PIXELS`)):m===1048?f(m,1):m===47||m===1047||m===1049?f(m,p(l===u)):m===2004?f(m,p(r.bracketedPasteMode)):m===2026?f(m,p(r.synchronizedOutput)):f(m,0)}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=TE.fromColorRGB([n,r,i])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],i=0,a=0;do{if(r[a+i]=e.params[t+a],e.hasSubParams(t+a)){let n=e.getSubParams(t+a),o=0;do r[1]===5&&(i=1),r[a+o+1+i]=n[o];while(++o<n.length&&o+a+1+i<r.length);break}if(r[1]===5&&a+i>=2||r[1]===2&&a+i>=5)break;r[1]&&(i=1)}while(++a+t<e.length&&a+i<r.length);for(let e=2;e<r.length;++e)r[e]===-1&&(r[e]=0);switch(r[0]){case 38:n.fg=this._updateAttrColor(n.fg,r[1],r[3],r[4],r[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,r[1],r[3],r[4],r[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,r[1],r[3],r[4],r[5])}return a}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=cM.fg,e.bg=cM.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,r=this._curAttrData;for(let i=0;i<t;i++)n=e.params[i],n>=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=n-90|16777224):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=n-100|16777224):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=cM.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=cM.bg&16777215):n===38||n===48||n===58?i+=this._extractColor(e,i,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=cM.fg&16777215,r.bg&=-67108864,r.bg|=cM.bg&16777215):this._logService.debug(`Unknown SGR attribute: %d.`,n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${$.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${$.ESC}[${e};${t}R`)}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${$.ESC}[?${e};${t}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=cM.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle=`block`;break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle=`underline`;break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle=`bar`}let e=t%2==1;this._coreService.decPrivateModes.cursorBlink=e}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!gN(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${$.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>hN&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>hN&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(`;`);for(;n.length>1;){let e=n.shift(),r=n.shift();if(/^\d+$/.exec(e)){let n=parseInt(e);if(xN(n)){if(r===`?`)t.push({type:0,index:n});else{let e=uN(r);e&&t.push({type:1,index:n,color:e})}}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(`;`);if(t===-1)return!0;let n=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(n,r):!n.trim()&&this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(`:`),r,i=n.findIndex(e=>e.startsWith(`id=`));return i!==-1&&(r=n[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(`;`);for(let e=0;e<n.length&&!(t>=this._specialColors.length);++e,++t)if(n[e]===`?`)this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=uN(n[e]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(`;`);for(let e=0;e<n.length;++e)if(/^\d+$/.exec(n[e])){let r=parseInt(n[e]);xN(r)&&t.push({type:2,index:r})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug(`Serial port requested application keypad.`),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug(`Switching back to normal keypad.`),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,bM),!0}selectCharset(e){return e.length===2?(e[0]===`/`||this._charsetService.setgCharset(pN[e[0]],yM[e[1]]||bM),!0):(this.selectDefaultCharset(),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=cM.clone(),this._eraseAttrDataInternal=cM.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new DE;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=e=>(this._coreService.triggerDataEvent(`${$.ESC}${e}${$.ESC}\\`),!0),r=this._bufferService.buffer,i=this._optionsService.rawOptions;return n(e===`"q`?`P1$r${+!!this._curAttrData.isProtected()}"q`:e===`"p`?`P1$r61;1"p`:e===`r`?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e===`m`?`P1$r0m`:e===` q`?`P1$r${{block:2,underline:4,bar:6}[i.cursorStyle]-+!!i.cursorBlink} q`:`P0$r`)}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},bN=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(vN=e,e=t,t=vN),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};bN=sE([X(0,PE)],bN);function xN(e){return 0<=e&&e<256}var SN=5e7,CN=12,wN=50,TN=class extends CD{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new Z),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>SN)throw Error(`write data discarded, use flow control to avoid losing data`);if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],r=this._action(e,t);if(r){r.catch(e=>(queueMicrotask(()=>{throw e}),Promise.resolve(!1))).then(e=>performance.now()-n>=CN?setTimeout(()=>this._innerWrite(0,e)):this._innerWrite(n,e));return}let i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,performance.now()-n>=CN)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>wN&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},EN=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let n=t.addMarker(t.ybase+t.y),r={data:e,id:this._nextId++,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(r,n)),this._dataByLinkId.set(r.id,r),r.id}let n=e,r=this._getEntryIdKey(n),i=this._entriesWithId.get(r);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let a=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(o,a)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(e=>e.line!==t)){let e=this._bufferService.buffer.addMarker(t);n.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(n,e))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};EN=sE([X(0,PE)],EN);var DN=!1,ON=class extends CD{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new wD),this._onBinary=this._register(new Z),this.onBinary=this._onBinary.event,this._onData=this._register(new Z),this.onData=this._onData.event,this._onLineFeed=this._register(new Z),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new Z),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new Z),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new Z),this._instantiationService=new tM,this.optionsService=this._register(new kM(e)),this._instantiationService.setService(BE,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(EM)),this._instantiationService.setService(PE,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(iM)),this._instantiationService.setService(zE,this._logService),this.coreService=this._register(this._instantiationService.createInstance(PM)),this._instantiationService.setService(IE,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(zM)),this._instantiationService.setService(FE,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(GM)),this._instantiationService.setService(HE,this.unicodeService),this._charsetService=this._instantiationService.createInstance(KM),this._instantiationService.setService(LE,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(EN),this._instantiationService.setService(VE,this._oscLinkService),this._inputHandler=this._register(new yN(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(jD.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(jD.forward(this._bufferService.onResize,this._onResize)),this._register(jD.forward(this.coreService.onData,this._onData)),this._register(jD.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange([`windowsMode`,`windowsPty`],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new TN((e,t)=>this._inputHandler.parse(e,t))),this._register(jD.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new Z),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!DN&&(this._logService.warn(`writeSync is unreliable and will be removed soon.`),DN=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,wM),t=Math.max(t,TM),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend===`conpty`&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(qM.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:`H`},()=>(qM(this._bufferService),!1))),this._windowsWrappingHeuristics.value=bD(()=>{for(let t of e)t.dispose()})}}},kN={48:[`0`,`)`],49:[`1`,`!`],50:[`2`,`@`],51:[`3`,`#`],52:[`4`,`$`],53:[`5`,`%`],54:[`6`,`^`],55:[`7`,`&`],56:[`8`,`*`],57:[`9`,`(`],186:[`;`,`:`],187:[`=`,`+`],188:[`,`,`<`],189:[`-`,`_`],190:[`.`,`>`],191:[`/`,`?`],192:["`",`~`],219:[`[`,`{`],220:[`\\`,`|`],221:[`]`,`}`],222:[`'`,`"`]};function AN(e,t,n,r){let i={type:0,cancel:!1,key:void 0},a=+!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key===`UIKeyInputUpArrow`?i.key=t?$.ESC+`OA`:$.ESC+`[A`:e.key===`UIKeyInputLeftArrow`?i.key=t?$.ESC+`OD`:$.ESC+`[D`:e.key===`UIKeyInputRightArrow`?i.key=t?$.ESC+`OC`:$.ESC+`[C`:e.key===`UIKeyInputDownArrow`&&(i.key=t?$.ESC+`OB`:$.ESC+`[B`);break;case 8:i.key=e.ctrlKey?`\b`:$.DEL,e.altKey&&(i.key=$.ESC+i.key);break;case 9:if(e.shiftKey){i.key=$.ESC+`[Z`;break}i.key=$.HT,i.cancel=!0;break;case 13:i.key=e.altKey?$.ESC+$.CR:$.CR,i.cancel=!0;break;case 27:i.key=$.ESC,e.altKey&&(i.key=$.ESC+$.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;i.key=a?$.ESC+`[1;`+(a+1)+`D`:t?$.ESC+`OD`:$.ESC+`[D`;break;case 39:if(e.metaKey)break;i.key=a?$.ESC+`[1;`+(a+1)+`C`:t?$.ESC+`OC`:$.ESC+`[C`;break;case 38:if(e.metaKey)break;i.key=a?$.ESC+`[1;`+(a+1)+`A`:t?$.ESC+`OA`:$.ESC+`[A`;break;case 40:if(e.metaKey)break;i.key=a?$.ESC+`[1;`+(a+1)+`B`:t?$.ESC+`OB`:$.ESC+`[B`;break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=$.ESC+`[2~`);break;case 46:i.key=a?$.ESC+`[3;`+(a+1)+`~`:$.ESC+`[3~`;break;case 36:i.key=a?$.ESC+`[1;`+(a+1)+`H`:t?$.ESC+`OH`:$.ESC+`[H`;break;case 35:i.key=a?$.ESC+`[1;`+(a+1)+`F`:t?$.ESC+`OF`:$.ESC+`[F`;break;case 33:e.shiftKey?i.type=2:i.key=e.ctrlKey?$.ESC+`[5;`+(a+1)+`~`:$.ESC+`[5~`;break;case 34:e.shiftKey?i.type=3:i.key=e.ctrlKey?$.ESC+`[6;`+(a+1)+`~`:$.ESC+`[6~`;break;case 112:i.key=a?$.ESC+`[1;`+(a+1)+`P`:$.ESC+`OP`;break;case 113:i.key=a?$.ESC+`[1;`+(a+1)+`Q`:$.ESC+`OQ`;break;case 114:i.key=a?$.ESC+`[1;`+(a+1)+`R`:$.ESC+`OR`;break;case 115:i.key=a?$.ESC+`[1;`+(a+1)+`S`:$.ESC+`OS`;break;case 116:i.key=a?$.ESC+`[15;`+(a+1)+`~`:$.ESC+`[15~`;break;case 117:i.key=a?$.ESC+`[17;`+(a+1)+`~`:$.ESC+`[17~`;break;case 118:i.key=a?$.ESC+`[18;`+(a+1)+`~`:$.ESC+`[18~`;break;case 119:i.key=a?$.ESC+`[19;`+(a+1)+`~`:$.ESC+`[19~`;break;case 120:i.key=a?$.ESC+`[20;`+(a+1)+`~`:$.ESC+`[20~`;break;case 121:i.key=a?$.ESC+`[21;`+(a+1)+`~`:$.ESC+`[21~`;break;case 122:i.key=a?$.ESC+`[23;`+(a+1)+`~`:$.ESC+`[23~`;break;case 123:i.key=a?$.ESC+`[24;`+(a+1)+`~`:$.ESC+`[24~`;break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?i.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?i.key=$.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=$.DEL:e.keyCode===219?i.key=$.ESC:e.keyCode===220?i.key=$.FS:e.keyCode===221&&(i.key=$.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let t=kN[e.keyCode]?.[+!!e.shiftKey];if(t)i.key=$.ESC+t;else if(e.keyCode>=65&&e.keyCode<=90){let t=e.ctrlKey?e.keyCode-64:e.keyCode+32,n=String.fromCharCode(t);e.shiftKey&&(n=n.toUpperCase()),i.key=$.ESC+n}else if(e.keyCode===32)i.key=$.ESC+(e.ctrlKey?$.NUL:` `);else if(e.key===`Dead`&&e.code.startsWith(`Key`)){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),i.key=$.ESC+t,i.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(i.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?i.key=e.key:e.key&&e.ctrlKey&&(e.key===`_`&&(i.key=$.US),e.key===`@`&&(i.key=$.NUL))}return i}var jN=0,MN=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new vj,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new vj,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((e,t)=>this._getKey(e)-this._getKey(t)),t=0,n=0,r=Array(this._array.length+this._insertedValues.length);for(let i=0;i<r.length;i++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[i]=e[t],t++):r[i]=this._array[n++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(jN=this._search(t),jN===-1)||this._getKey(this._array[jN])!==t)return!1;do if(this._array[jN]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(jN),!0;while(++jN<this._array.length&&this._getKey(this._array[jN])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((e,t)=>e-t),t=0,n=Array(this._array.length-e.length),r=0;for(let i=0;i<this._array.length;i++)e[t]===i?t++:n[r++]=this._array[i];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(jN=this._search(e),!(jN<0||jN>=this._array.length)&&this._getKey(this._array[jN])===e))do yield this._array[jN];while(++jN<this._array.length&&this._getKey(this._array[jN])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(jN=this._search(e),!(jN<0||jN>=this._array.length)&&this._getKey(this._array[jN])===e))do t(this._array[jN]);while(++jN<this._array.length&&this._getKey(this._array[jN])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let r=t+n>>1,i=this._getKey(this._array[r]);if(i>e)n=r-1;else if(i<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},NN=0,PN=0,FN=class extends CD{constructor(){super(),this._decorations=new MN(e=>e?.marker.line),this._onDecorationRegistered=this._register(new Z),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new Z),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(bD(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new IN(e);if(t){let e=t.marker.onDispose(()=>t.dispose()),n=t.onDispose(()=>{n.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),e.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let r=0,i=0;for(let a of this._decorations.getKeyIterator(t))r=a.options.x??0,i=r+(a.options.width??1),e>=r&&e<i&&(!n||(a.options.layer??`bottom`)===n)&&(yield a)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,t=>{NN=t.options.x??0,PN=NN+(t.options.width??1),e>=NN&&e<PN&&(!n||(t.options.layer??`bottom`)===n)&&r(t)})}},IN=class extends SD{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new Z),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new Z),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position=`full`)}get backgroundColorRGB(){return this._cachedBg===null&&(this._cachedBg=this.options.backgroundColor?yA.toColor(this.options.backgroundColor):void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this._cachedFg=this.options.foregroundColor?yA.toColor(this.options.foregroundColor):void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},LN=1e3,RN=class{constructor(e,t=LN){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t);let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=r-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},t)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},zN=20,BN=class extends CD{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce=``;let i=this._coreBrowserService.mainDocument;this._accessibilityContainer=i.createElement(`div`),this._accessibilityContainer.classList.add(`xterm-accessibility`),this._rowContainer=i.createElement(`div`),this._rowContainer.setAttribute(`role`,`list`),this._rowContainer.classList.add(`xterm-accessibility-tree`),this._rowElements=[];for(let e=0;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);if(this._topBoundaryFocusListener=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,1),this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=i.createElement(`div`),this._liveRegion.classList.add(`live-region`),this._liveRegion.setAttribute(`aria-live`,`assertive`),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new RN(this._renderRows.bind(this))),!this._terminal.element)throw Error(`Cannot enable accessibility before Terminal.open`);this._terminal.element.insertAdjacentElement(`afterbegin`,this._accessibilityContainer),this._register(this._terminal.onResize(e=>this._handleResize(e.rows))),this._register(this._terminal.onRender(e=>this._refreshRows(e.start,e.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(e=>this._handleChar(e))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
48
|
-
`))),this._register(this._terminal.onA11yTab(e=>this._handleTab(e))),this._register(this._terminal.onKey(e=>this._handleKey(e.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Q(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(bD(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<zN+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
49
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===zN+1&&(this._liveRegion.textContent+=dE.get())))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.textContent=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r),this._alignRowWidth(s))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error(`anchorNode and/or focusNode are null`);return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t<i.length?i[t]:i.slice(-1)[0]+1;return a>=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(!(!a||!o)){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener(`focus`,this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement(`div`);return e.setAttribute(`role`,`listitem`),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform=``;let t=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let r=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};BN=sE([X(1,RE),X(2,qE),X(3,YE)],BN);var VN=class extends CD{constructor(e,t,n,r,i){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new Z),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new Z),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(bD(()=>{vD(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Q(this._element,`mouseleave`,()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Q(this._element,`mousemove`,this._handleMouseMove.bind(this))),this._register(Q(this._element,`mousedown`,this._handleMouseDown.bind(this))),this._register(Q(this._element,`mouseup`,this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let e=0;e<n.length;e++){let t=n[e];if(t.classList.contains(`xterm`))break;if(t.classList.contains(`xterm-hover`))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){(!this._activeProviderReplies||!t)&&(this._activeProviderReplies?.forEach(e=>{e?.forEach(e=>{e.link.dispose&&e.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[r,i]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(r)&&(n=this._checkLinkProviderResult(r,e,n)):i.provideLinks(e.y,t=>{if(this._isMouseOut)return;let i=t?.map(e=>({link:e}));this._activeProviderReplies?.set(r,i),n=this._checkLinkProviderResult(r,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let i=t.get(r);if(i)for(let t=0;t<i.length;t++){let r=i[t],a=r.link.range.start.y<e?0:r.link.range.start.x,o=r.link.range.end.y>e?this._bufferService.cols:r.link.range.end.x;for(let e=a;e<=o;e++){if(n.has(e)){i.splice(t--,1);break}n.add(e)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),i=!1;for(let t=0;t<e;t++)(!this._activeProviderReplies.has(t)||this._activeProviderReplies.get(t))&&(i=!0);if(!i&&r){let e=r.find(e=>this._linkAtPosition(e.link,t));e&&(n=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let e=0;e<this._activeProviderReplies.size;e++){let r=this._activeProviderReplies.get(e)?.find(e=>this._linkAtPosition(e.link,t));if(r){n=!0,this._handleNewLink(r);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&HN(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,vD(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0||e.link.decorations.underline,pointerCursor:e.link.decorations===void 0||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle(`xterm-cursor-pointer`,e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e=>{if(!this._currentLink)return;let t=e.start===0?0:e.start+1+this._bufferService.buffer.ydisp,n=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=n&&(this._clearCurrentLink(t,n),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}})))}_linkHover(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add(`xterm-cursor-pointer`)),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove(`xterm-cursor-pointer`)),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};VN=sE([X(1,JE),X(2,YE),X(3,PE),X(4,$E)],VN);function HN(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var UN=class extends ON{constructor(e={}){super(e),this._linkifier=this._register(new wD),this.browser=tj,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new wD),this._onCursorMove=this._register(new Z),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new Z),this.onKey=this._onKey.event,this._onRender=this._register(new Z),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new Z),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new Z),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new Z),this.onBell=this._onBell.event,this._onFocus=this._register(new Z),this._onBlur=this._register(new Z),this._onA11yCharEmitter=this._register(new Z),this._onA11yTabEmitter=this._register(new Z),this._onWillOpen=this._register(new Z),this._setup(),this._decorationService=this._instantiationService.createInstance(FN),this._instantiationService.setService(UE,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(XA),this._instantiationService.setService($E,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(WE)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(e=>this.refresh(e?.start??0,e?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(e=>this._reportWindowsOptions(e))),this._register(this._inputHandler.onColor(e=>this._handleColorEvent(e))),this._register(jD.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(jD.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(jD.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(jD.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(bD(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let e,n=``;switch(t.index){case 256:e=`foreground`,n=`10`;break;case 257:e=`background`,n=`11`;break;case 258:e=`cursor`,n=`12`;break;default:e=`ansi`,n=`4;`+t.index}switch(t.type){case 0:let r=vA.toColorRGB(e===`ansi`?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${$.ESC}]${n};${fN(r)}${uA.ST}`);break;case 1:if(e===`ansi`)this._themeService.modifyColors(e=>e.ansi[t.index]=_A.toColor(...t.color));else{let n=e;this._themeService.modifyColors(e=>e[n]=_A.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(BN,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent($.ESC+`[I`),this.element.classList.add(`focus`),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value=``,this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent($.ESC+`[O`),this.element.classList.remove(`focus`),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),a=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,s=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=s+`px`,this.textarea.style.top=o+`px`,this.textarea.style.width=a+`px`,this.textarea.style.height=r+`px`,this.textarea.style.lineHeight=r+`px`,this.textarea.style.zIndex=`-5`}_initGlobal(){this._bindKeys(),this._register(Q(this.element,`copy`,e=>{this.hasSelection()&&mE(e,this._selectionService)}));let e=e=>hE(e,this.textarea,this.coreService,this.optionsService);this._register(Q(this.textarea,`paste`,e)),this._register(Q(this.element,`paste`,e)),aj?this._register(Q(this.element,`mousedown`,e=>{e.button===2&&vE(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Q(this.element,`contextmenu`,e=>{vE(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),pj&&this._register(Q(this.element,`auxclick`,e=>{e.button===1&&_E(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Q(this.textarea,`keyup`,e=>this._keyUp(e),!0)),this._register(Q(this.textarea,`keydown`,e=>this._keyDown(e),!0)),this._register(Q(this.textarea,`keypress`,e=>this._keyPress(e),!0)),this._register(Q(this.textarea,`compositionstart`,()=>this._compositionHelper.compositionstart())),this._register(Q(this.textarea,`compositionupdate`,e=>this._compositionHelper.compositionupdate(e))),this._register(Q(this.textarea,`compositionend`,()=>this._compositionHelper.compositionend())),this._register(Q(this.textarea,`input`,e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw Error(`Terminal requires a parent element.`);if(e.isConnected||this._logService.debug(`Terminal.open was called on an element that was not attached to the DOM`),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement(`div`),this.element.dir=`ltr`,this.element.classList.add(`terminal`),this.element.classList.add(`xterm`),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement(`div`),this._viewportElement.classList.add(`xterm-viewport`),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement(`div`),this.screenElement.classList.add(`xterm-screen`),this._register(Q(this.screenElement,`mousemove`,e=>this.updateCursorStyle(e))),this._helperContainer=this._document.createElement(`div`),this._helperContainer.classList.add(`xterm-helpers`),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement(`textarea`);this.textarea.classList.add(`xterm-helper-textarea`),this.textarea.setAttribute(`aria-label`,lE.get()),mj||this.textarea.setAttribute(`aria-multiline`,`false`),this.textarea.setAttribute(`autocorrect`,`off`),this.textarea.setAttribute(`autocapitalize`,`off`),this.textarea.setAttribute(`spellcheck`,`false`),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange(`disableStdin`,()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(JA,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<`u`?window.document:null)),this._instantiationService.setService(qE,this._coreBrowserService),this._register(Q(this.textarea,`focus`,e=>this._handleTextAreaFocus(e))),this._register(Q(this.textarea,`blur`,()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(WA,this._document,this._helperContainer),this._instantiationService.setService(KE,this._charSizeService),this._themeService=this._instantiationService.createInstance(Qj),this._instantiationService.setService(QE,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(TA),this._instantiationService.setService(ZE,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(bj,this.rows,this.screenElement)),this._instantiationService.setService(YE,this._renderService),this._register(this._renderService.onRenderedViewportChange(e=>this._onRender.fire(e))),this.onResize(e=>this._renderService.resize(e.cols,e.rows)),this._compositionView=this._document.createElement(`div`),this._compositionView.classList.add(`composition-view`),this._compositionHelper=this._instantiationService.createInstance(dA,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance($A),this._instantiationService.setService(JE,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(VN,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(nA,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(e=>{super.scrollLines(e,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Hj,this.element,this.screenElement,r)),this._instantiationService.setService(XE,this._selectionService),this._register(this._selectionService.onRequestScrollLines(e=>this.scrollLines(e.amount,e.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()})),this._register(jD.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(rA,this.screenElement)),this._register(Q(this.element,`mousedown`,e=>this._selectionService.handleMouseDown(e))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add(`enable-mouse-events`)):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(BN,this)),this._register(this.optionsService.onSpecificOptionChange(`screenReaderMode`,e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(cA,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange(`overviewRuler`,e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(cA,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(UA,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(t){let n=e._mouseService.getMouseReportCoords(t,e.screenElement);if(!n)return!1;let r,i;switch(t.overrideType||t.type){case`mousemove`:i=32,t.buttons===void 0?(r=3,t.button!==void 0&&(r=t.button<3?t.button:3)):r=t.buttons&1?0:t.buttons&4?1:t.buttons&2?2:3;break;case`mouseup`:i=0,r=t.button<3?t.button:3;break;case`mousedown`:i=1,r=t.button<3?t.button:3;break;case`wheel`:if(e._customWheelEventHandler&&e._customWheelEventHandler(t)===!1)return!1;let n=t.deltaY;if(n===0||e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;i=n<0?0:1,r=4;break;default:return!1}return i===void 0||r===void 0||r>4?!1:e.coreMouseService.triggerMouseEvent({col:n.col,row:n.row,x:n.x,y:n.y,button:r,action:i,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},i={mouseup:e=>(n(e),e.buttons||(this._document.removeEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.removeEventListener(`mousemove`,r.mousedrag)),this.cancel(e)),wheel:e=>(n(e),this.cancel(e,!0)),mousedrag:e=>{e.buttons&&n(e)},mousemove:e=>{e.buttons||n(e)}};this._register(this.coreMouseService.onProtocolChange(e=>{e?(this.optionsService.rawOptions.logLevel===`debug`&&this._logService.debug(`Binding to mouse events:`,this.coreMouseService.explainEvents(e)),this.element.classList.add(`enable-mouse-events`),this._selectionService.disable()):(this._logService.debug(`Unbinding from mouse events.`),this.element.classList.remove(`enable-mouse-events`),this._selectionService.enable()),e&8?r.mousemove||=(t.addEventListener(`mousemove`,i.mousemove),i.mousemove):(t.removeEventListener(`mousemove`,r.mousemove),r.mousemove=null),e&16?r.wheel||=(t.addEventListener(`wheel`,i.wheel,{passive:!1}),i.wheel):(t.removeEventListener(`wheel`,r.wheel),r.wheel=null),e&2?r.mouseup||=i.mouseup:(this._document.removeEventListener(`mouseup`,r.mouseup),r.mouseup=null),e&4?r.mousedrag||=i.mousedrag:(this._document.removeEventListener(`mousemove`,r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Q(t,`mousedown`,e=>{if(e.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(e)))return n(e),r.mouseup&&this._document.addEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.addEventListener(`mousemove`,r.mousedrag),this.cancel(e)})),this._register(Q(t,`wheel`,t=>{if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(t)===!1)return!1;if(!this.buffer.hasScrollback){if(t.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(t,!0);let n=$.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?`O`:`[`)+(t.deltaY<0?`A`:`B`);return this.coreService.triggerDataEvent(n,!0),this.cancel(t,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add(`column-select`):this.element.classList.remove(`column-select`)}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){gE(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:``}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key===`Dead`||e.key===`AltGraph`)&&(this._unprocessedDeadKey=!0);let n=AN(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let t=this.rows-1;return this.scrollLines(n.type===2?-t:t),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===$.ETX||n.key===$.CR)&&(this.textarea.value=``),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState(`AltGraph`);return t.type===`keypress`?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(WN(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType===`insertText`&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){this._charSizeService?.measure()}clear(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(cM));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains(`focus`)?this.coreService.triggerDataEvent($.ESC+`[I`):this.coreService.triggerDataEvent($.ESC+`[O`)}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let e=this._renderService.dimensions.css.canvas.width.toFixed(0),t=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${$.ESC}[4;${t};${e}t`);break;case 1:let n=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${$.ESC}[6;${r};${n}t`)}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function WN(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var GN=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw Error(`Could not dispose an addon that has not been loaded`);e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},KN=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new DE)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},qN=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new KN(t)}getNullCell(){return new DE}},JN=class extends CD{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new Z),this.onBufferChange=this._onBufferChange.event,this._normal=new qN(this._core.buffers.normal,`normal`),this._alternate=new qN(this._core.buffers.alt,`alternate`),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw Error(`Active buffer is neither normal nor alternate`)}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},YN=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,e=>t(e.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(e,n)=>t(e,n.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},XN=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},ZN=[`cols`,`rows`],QN=0,$N=class extends CD{constructor(e){super(),this._core=this._register(new UN(e)),this._addonManager=this._register(new GN),this._publicOptions={...this._core.options};let t=e=>this._core.options[e],n=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(let e in this._core.options){let r={get:t.bind(this,e),set:n.bind(this,e)};Object.defineProperty(this._publicOptions,e,r)}}_checkReadonlyOptions(e){if(ZN.includes(e))throw Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw Error(`You must set the allowProposedApi option to true to use proposed API`)}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||=new YN(this._core),this._parser}get unicode(){return this._checkProposedApi(),new XN(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||=this._register(new JN(this._core)),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t=`none`;switch(this._core.coreMouseService.activeProtocol){case`X10`:t=`x10`;break;case`VT200`:t=`vt200`;break;case`DRAG`:t=`drag`;break;case`ANY`:t=`any`}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
|
|
50
|
-
`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return lE.get()},set promptLabel(e){lE.set(e)},get tooMuchOutput(){return dE.get()},set tooMuchOutput(e){dE.set(e)}}}_verifyIntegers(...e){for(QN of e)if(QN===1/0||isNaN(QN)||QN%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(QN of e)if(QN&&(QN===1/0||isNaN(QN)||QN%1!=0||QN<0))throw Error(`This API only accepts positive integers`)}},eP={background:`#141413`,foreground:`#eae7df`,cursor:`#cc785c`,cursorAccent:`#141413`,selectionBackground:`#33312e`,black:`#141413`,red:`#d47563`,green:`#9aca86`,yellow:`#e8c96b`,blue:`#61aaf2`,magenta:`#9b87f5`,cyan:`#d4967e`,white:`#a9a39a`,brightBlack:`#6b665f`,brightRed:`#d47563`,brightGreen:`#9aca86`,brightYellow:`#e8c96b`,brightBlue:`#61aaf2`,brightMagenta:`#9b87f5`,brightCyan:`#e0ab96`,brightWhite:`#eae7df`},tP=`Rove Nerd Symbols`,nP=[`"JetBrains Mono"`,`"${tP}"`,`"SF Mono"`,`ui-monospace`,`Menlo`,`monospace`].join(`, `),rP=1500;function iP(e,t,n){let r=null,i=null,a=null,o=()=>{let t=e.element?.querySelector(`.xterm-screen`);if(!r||!t||e.rows<=0||e.cols<=0)return;let n=document.createElement(`canvas`).getContext(`2d`);n&&(n.font=`${e.options.fontSize??13}px ${nP}`);let i=n?.measureText(`W`).width??0;r.style.setProperty(`--row-h`,`${t.clientHeight/e.rows}px`),i>0&&(r.style.letterSpacing=`${t.clientWidth/e.cols-i}px`)},s=()=>{r?.remove(),r=null,i?.dispose(),i=null,a!==null&&window.clearTimeout(a),a=null};return{snapshot:()=>n.serializeAsHTML({scrollback:0,includeGlobalBackground:!0}),raise(n){s(),r=document.createElement(`div`),r.className=ct,r.innerHTML=n,r.style.backgroundColor=(ap.get()??eP).background??``,t.append(r),o(),requestAnimationFrame(o),i=e.onResize(o),a=window.setTimeout(s,rP)},lower:s,get raised(){return r!==null}}}var aP=2,oP=1,sP=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(aP,Math.floor(u/e.css.cell.width)),rows:Math.max(oP,Math.floor(l/e.css.cell.height))}}},cP=class extends sP{term;constructor(e){super(),this.term=e}proposeDimensions(){let e=super.proposeDimensions(),t=this.term.element,n=t?.parentElement,r=this.term._core?._renderService?.dimensions?.css.cell.width;if(!e||!t||!n||!r)return e;let i=getComputedStyle(t),a=Number.parseInt(getComputedStyle(n).width)-Number.parseInt(i.paddingLeft)-Number.parseInt(i.paddingRight);return{cols:Math.max(e.cols,Math.floor(a/r)),rows:e.rows}}},lP=64,uP=33554432,dP=27,fP=new TextDecoder(`latin1`);function pP(e){let t=new Map;for(let n of e.split(`,`)){let e=n.indexOf(`=`);e>0&&t.set(n.slice(0,e),n.slice(e+1))}return t}function mP(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}async function hP(e){let t=new Blob([e]).stream().pipeThrough(new DecompressionStream(`deflate`));return new Uint8Array(await new Response(t).arrayBuffer())}async function gP(e,t){let n=mP(t);e.get(`o`)===`z`&&(n=await hP(n));let r=e.get(`f`)??`32`;if(r===`100`)return createImageBitmap(new Blob([n],{type:`image/png`}));let i=Number(e.get(`s`)),a=Number(e.get(`v`)),o=r===`24`?3:r===`32`?4:0;if(!o||!(i>0&&a>0)||n.length<i*a*o)return null;let s=new Uint8ClampedArray(i*a*4);for(let e=0;e<i*a;e++)s[e*4]=n[e*o],s[e*4+1]=n[e*o+1],s[e*4+2]=n[e*o+2],s[e*4+3]=o===4?n[e*4+3]:255;return createImageBitmap(new ImageData(s,i,a))}var _P=class{changed;images=new Map;apc=null;apcBytes=0;escPending=!1;upload=null;constructor(e){this.changed=e}push(e){let t=0;for(this.escPending&&e.length>0&&(this.escPending=!1,this.apc&&e[0]===92?(this.finish(),t=1):(this.apc=null,e[0]===95&&(this.apc=[],this.apcBytes=0,t=1)));t<e.length;){let n=e.indexOf(dP,t);if(this.apc){if(n===-1){this.append(e.subarray(t));return}if(this.append(e.subarray(t,n)),n+1>=e.length){this.escPending=!0;return}e[n+1]===92?this.finish():this.apc=null,t=n+2;continue}if(n===-1)return;if(n+1>=e.length){this.escPending=!0;return}e[n+1]===95?(this.apc=[],this.apcBytes=0,t=n+2):t=n+1}}append(e){!this.apc||e.length===0||(this.apcBytes+=e.length,this.apcBytes>uP?this.apc=null:this.apc.push(e.slice()))}finish(){let e=this.apc;if(this.apc=null,!e)return;let t=e.map(e=>fP.decode(e)).join(``);if(t[0]!==`G`)return;let n=t.indexOf(`;`),r=pP(n===-1?t.slice(1):t.slice(1,n));this.command(r,n===-1?``:t.slice(n+1))}command(e,t){if(this.upload&&[...e.keys()].every(e=>e===`m`||e===`q`)){if(this.upload.parts.push(t),e.get(`m`)!==`1`){let{keys:e,parts:t}=this.upload;this.upload=null,this.transmitted(e,t.join(``))}return}this.upload=null;let n=e.get(`a`)??`t`;if(n===`t`||n===`T`){if((e.get(`t`)??`d`)!==`d`)return;e.get(`m`)===`1`?this.upload={keys:e,parts:[t]}:this.transmitted(e,t)}else n===`p`?this.placed(e):n===`d`&&this.deleted(e)}entry(e){let t=this.images.get(e)??{cols:null,rows:null,bitmap:null};this.images.delete(e),this.images.set(e,t);for(let e of this.images.keys()){if(this.images.size<=lP)break;this.images.get(e)?.bitmap?.close(),this.images.delete(e)}return t}transmitted(e,t){let n=Number(e.get(`i`));if(!(n>0))return;let r=this.entry(n);e.get(`a`)===`T`&&this.placed(e),gP(e,t).then(e=>{if(e){if(this.images.get(n)!==r)return e.close();r.bitmap?.close(),r.bitmap=e,this.changed()}}).catch(()=>{})}placed(e){let t=Number(e.get(`i`));if(!(t>0)||e.get(`U`)!==`1`)return;let n=this.entry(t),r=Number(e.get(`c`)),i=Number(e.get(`r`));n.cols=r>0?r:null,n.rows=i>0?i:null,this.changed()}deleted(e){let t=e.get(`d`)??`a`;if(t!==`i`&&t!==`I`)return;let n=Number(e.get(`i`));this.images.get(n)?.bitmap?.close(),this.images.delete(n)&&this.changed()}dispose(){for(let e of this.images.values())e.bitmap?.close();this.images.clear()}},vP=`305-305 30d-30e 310-310 312-312 33d-33f 346-346 34a-34c 350-352 357-357 35b-35b 363-36f 483-487
|
|
51
|
-
592-595 597-599 59c-5a1 5a8-5a9 5ab-5ac 5af-5af 5c4-5c4 610-617 657-65b 65d-65e 6d6-6dc 6df-6e2
|
|
52
|
-
6e4-6e4 6e7-6e8 6eb-6ec 730-730 732-733 735-736 73a-73a 73d-73d 73f-741 743-743 745-745 747-747
|
|
53
|
-
749-74a 7eb-7f1 7f3-7f3 816-819 81b-823 825-827 829-82d 951-951 953-954 f82-f83 f86-f87 135d-135f
|
|
54
|
-
17dd-17dd 193a-193a 1a17-1a17 1a75-1a7c 1b6b-1b6b 1b6d-1b73 1cd0-1cd2 1cda-1cdb 1ce0-1ce0 1dc0-1dc1 1dc3-1dc9 1dcb-1dcc
|
|
55
|
-
1dd1-1de6 1dfe-1dfe 20d0-20d1 20d4-20d7 20db-20dc 20e1-20e1 20e7-20e7 20e9-20e9 20f0-20f0 2cef-2cf1 2de0-2dff a66f-a66f
|
|
56
|
-
a67c-a67d a6f0-a6f1 a8e0-a8f1 aab0-aab0 aab2-aab3 aab7-aab8 aabe-aabf aac1-aac1 fe20-fe26 10a0f-10a0f 10a38-10a38 1d185-1d189
|
|
57
|
-
1d1aa-1d1ad 1d242-1d244`,yP=(()=>{let e=new Map;for(let t of vP.split(/\s+/)){let[n,r]=t.split(`-`).map(e=>Number.parseInt(e,16));for(let t=n;t<=r;t++)e.set(t,e.size)}return e})();function bP(e){if(e.codePointAt(0)!==1109742)return null;let t=[];for(let n of e.slice(2)){let e=yP.get(n.codePointAt(0));if(e===void 0)break;t.push(e)}return t}function xP(e,t,n){let r=t[2]===void 0?e:(e|t[2]<<24)>>>0,i=n!==null&&n.id===r,a=t[0]??(i?n.row:0);return{id:r,row:a,col:t[1]??(i&&n.row===a?n.col+1:0)}}var SP=``;function CP(e){return e.isFgRGB()||e.isFgPalette()?e.getFgColor():0}function wP(e){let t=e.buffer.active,n=t.getNullCell(),r=[];for(let i=0;i<e.rows;i++){let a=t.getLine(t.viewportY+i);if(!a?.translateToString(!1).includes(SP))continue;let o=null,s=null;for(let t=0;t<e.cols;t++){a.getCell(t,n);let e=bP(n.getChars());if(!e){o=null,s=null;continue}let c=xP(CP(n),e,o);s&&s.id===c.id&&s.row===c.row&&s.col+s.len===c.col?s.len++:(s={...c,x:t,y:i,len:1},r.push(s)),o=c}}return r}function TP(e){let t=null,n=0,r=()=>{n||=requestAnimationFrame(a)},i=new _P(r),a=()=>{n=0;let r=e.element?.querySelector(`.xterm-screen`);if(!r||e.rows<=0||e.cols<=0)return;let a=wP(e);if(a.length===0&&!t)return;t||(t=document.createElement(`canvas`),t.className=ot,r.append(t));let o=window.devicePixelRatio||1,s=r.clientWidth,c=r.clientHeight;(t.width!==Math.round(s*o)||t.height!==Math.round(c*o))&&(t.width=Math.round(s*o),t.height=Math.round(c*o));let l=t.getContext(`2d`);if(!l)return;l.setTransform(o,0,0,o,0,0),l.clearRect(0,0,s,c);let u=s/e.cols,d=c/e.rows,f=e.options.theme?.background??`#000`;for(let e of a){let t=e.x*u,n=e.y*d,r=e.len*u;l.fillStyle=f,l.fillRect(t,n,r,d);let a=i.images.get(e.id),o=a?.bitmap;if(!o){l.fillStyle=`rgba(128, 128, 128, 0.14)`,l.fillRect(t,n,r,d);continue}let s=a.cols??Math.ceil(o.width/u),c=a.rows??Math.ceil(o.height/d),p=Math.min(s*u/o.width,c*d/o.height),m=o.width*p,h=o.height*p,g=t-e.col*u+(s*u-m)/2,_=n-e.row*d+(c*d-h)/2;l.save(),l.beginPath(),l.rect(t,n,r,d),l.clip(),l.drawImage(o,g,_,m,h),l.restore()}},o=[e.onRender(r),e.onResize(r),e.onScroll(r)];return{push:e=>i.push(e),dispose(){n&&cancelAnimationFrame(n);for(let e of o)e.dispose();t?.remove(),i.dispose()}}}var EP=(e,t,n)=>({id:e,cap:t,bytes:e=>`\x1b${e?`O`:`[`}${n}`}),DP={id:`enter`,cap:`⏎`,bytes:()=>`\r`},OP=[{id:`esc`,cap:`esc`,bytes:()=>`\x1B`},{id:`tab`,cap:`tab`,bytes:()=>` `},{id:`backtab`,cap:`⇧tab`,bytes:()=>`\x1B[Z`},{id:`interrupt`,cap:`^C`,bytes:()=>``},EP(`up`,`↑`,`A`),EP(`down`,`↓`,`B`),EP(`left`,`←`,`D`),EP(`right`,`→`,`C`),DP],kP=e=>({id:`option-${e}`,cap:String(e),bytes:()=>String(e)}),AP=[kP(1),kP(2),kP(3),kP(4),DP];function jP(e){if(e.length!==1)return e;let t=e.toUpperCase().charCodeAt(0);return t===32?`\0`:t===63?``:t>=64&&t<=95?String.fromCharCode(t&31):e}var MP=/\x1b\[\?[0-9;]*c|\x1b\[\??[0-9;]*\$y|\x1b\](?:10|11);[^\x07\x1b]*(?:\x07|\x1b\\)/g,NP=/\x1b\[[?>=]?[0-9;]*(?:[cnRt]|\$y)|\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)|\x1bP[^\x1b]*\x1b\\/g;function PP(e){let t=0;return{forward(n){let r=(t>0?n.replace(NP,``):n).replace(MP,``);r&&e(r)},replay(e){t++,e(()=>{t--})}}}function FP(e){return e.alternateScreen||e.mouseTracking&&e.shift?`app`:`local`}function IP(e,t,n){let r=e.deltaMode===1?1:e.deltaMode===2?Math.max(1,n):1/Math.max(1,t);return e.deltaY*r}function LP(e){if(e.deltaMode!==0)return!0;let t=Math.abs(e.wheelDeltaY??0);return t>0&&t%120==0&&Math.abs(e.deltaY)*2>t}function RP(e,t){let n=e+t,r=Math.sign(n)*Math.round(Math.abs(n))||0;return{lines:r,carry:n-r}}function zP(e,t){return e>0&&t.viewportY>=t.baseY||e<0&&t.viewportY<=0?0:e}var BP=55;function VP(e,t){let n=e*(1-Math.exp(-Math.max(0,t)/BP));return Math.abs(e-n)<.02?e:n}function HP(e){return Math.max(0,e.baseY-e.viewportY)}function UP(e,t){if(e===null||e<=0)return null;let n=Math.max(0,t.baseY-e);return n===t.viewportY?null:n}function WP(e,t){let n=[t.black,t.red,t.green,t.yellow,t.blue,t.magenta,t.cyan,t.white,t.brightBlack,t.brightRed,t.brightGreen,t.brightYellow,t.brightBlue,t.brightMagenta,t.brightCyan,t.brightWhite];if(e<16)return n[e]??`#ffffff`;if(e>=232){let t=8+(e-232)*10;return`rgb(${t},${t},${t})`}let r=e-16,i=e=>e===0?0:55+e*40;return`rgb(${i(Math.floor(r/36))},${i(Math.floor(r/6)%6)},${i(r%6)})`}function GP(e,t){let n=t.foreground??`#ffffff`,r=t.background??`#000000`,i=n;if(!e.isFgDefault()){let n=e.getFgColor();i=e.isFgRGB()?`#${n.toString(16).padStart(6,`0`)}`:WP(e.isBold()&&n<8?n+8:n,t)}let a=r;if(!e.isBgDefault()){let n=e.getBgColor();a=e.isBgRGB()?`#${n.toString(16).padStart(6,`0`)}`:WP(n,t)}return e.isInverse()?{fg:a,bg:i}:{fg:i,bg:a}}function KP(e){let t={side:`top`,canvas:null,key:``},n={side:`bottom`,canvas:null,key:``},r=null,i=0;function a(t,n){let r=e.element?.querySelector(`.xterm-screen`);if(!r||e.cols<=0)return;t.canvas||(t.canvas=document.createElement(`canvas`),t.canvas.style.cssText=`position:absolute;left:0;pointer-events:none;display:none`);let i=t.canvas.getContext(`2d`);if(!i)return;t.canvas.parentElement!==r&&r.appendChild(t.canvas);let a=window.devicePixelRatio||1,o=r.clientWidth,s=Math.round(o*a),c=Math.round(n*a);(t.canvas.width!==s||t.canvas.height!==c)&&(t.canvas.width=s,t.canvas.height=c,t.key=``),t.canvas.style.width=`${o}px`,t.canvas.style.height=`${n}px`,t.canvas.style.top=t.side===`top`?`${-n}px`:`${n*e.rows}px`;let l=e.buffer.active,u=l.getLine(t.side===`top`?l.viewportY-1:l.viewportY+e.rows),d=e.options.theme??{},f=`${u?.translateToString(!1)??``}|${o}|${n}|${a}|${d.background}|${d.foreground}`;if(f===t.key||(t.key=f,i.setTransform(a,0,0,a,0,0),i.fillStyle=d.background??`#000000`,i.fillRect(0,0,o,n),!u))return;let p=o/e.cols,m=e.options.fontFamily??`monospace`,h=e.options.fontSize??13;i.textBaseline=`middle`;let g=l.getNullCell(),_=``;for(let t=0;t<e.cols;t++){u.getCell(t,g);let e=g.getWidth();if(e===0)continue;let{fg:r,bg:a}=GP(g,d);(!g.isBgDefault()||g.isInverse())&&(i.fillStyle=a,i.fillRect(t*p,0,p*e,n));let o=g.getChars();if(o===``||o===` `||g.isInvisible())continue;let s=`${g.isItalic()?`italic `:``}${g.isBold()?`bold `:``}${h}px ${m}`;s!==_&&(i.font=_=s),i.globalAlpha=g.isDim()?.5:1,i.fillStyle=r,i.fillText(o,t*p,n/2+.5),i.globalAlpha=1}}let o=(e,t,n,r)=>{let i=Math.max(0,r-n);t.style.clipPath=e.side===`top`?`inset(${i}px 0 0 0)`:`inset(0 0 ${i}px 0)`,t.style.display=``};return{show(e,s){if(e!==0&&(r=e>0?t:n),!r)return;let c=r===t?n:t;c.canvas&&(c.canvas.style.display=`none`),i=s,e!==0&&a(r,s),r.canvas&&o(r,r.canvas,Math.abs(e),s)},refresh(){r?.canvas&&r.canvas.style.display!==`none`&&a(r,i)},hide(){r=null,t.canvas&&(t.canvas.style.display=`none`),n.canvas&&(n.canvas.style.display=`none`)},transition(e){for(let r of[t,n])r.canvas&&(r.canvas.style.transition=e)},dispose(){t.canvas?.remove(),n.canvas?.remove()}}}var qP=140,JP=90,YP=15;function XP(e,t){let n=0,r=0,i=0,a=0,o=null,s=null,c=!1,l=()=>e.element?.querySelector(`.xterm-screen`)??null,u=()=>{let t=l();return t&&e.rows>0&&t.clientHeight/e.rows||YP},d=KP(e),f=()=>{c=!1;let e=l();if(!e)return;let t=u();e.style.transform=n===0?``:`translateY(${-n*t}px)`,n===0?e.style.transition===``?d.hide():d.show(0,t):d.show(-n*t,t)},p=e.onRender(()=>{c?f():d.refresh()}),m=()=>{c=!0,requestAnimationFrame(()=>{c&&f()})},h=()=>{s!==null&&window.clearTimeout(s),s=null;let e=l();e&&(e.style.transition=``),d.transition(``),n===0&&d.hide()},g=()=>{if(s===null)return;let e=l();e&&(n=-new DOMMatrix(getComputedStyle(e).transform).m42/u()),h()},_=()=>{o!==null&&window.clearTimeout(o),o=window.setTimeout(v,qP)};function v(){if(o!==null&&window.clearTimeout(o),o=null,n===0)return;let e=l();n=0,e&&(e.style.transition=`transform ${JP}ms ease-out`,d.transition(`clip-path ${JP}ms ease-out`),f(),s=window.setTimeout(h,130))}let y=r=>{if(r===0)return!0;g();let i=RP(n,r),a=e.buffer.active,o=a.viewportY;i.lines!==0&&(t(),e.scrollLines(i.lines));let s=i.lines!==0&&a.viewportY-o!==i.lines;return n=s?0:zP(i.carry,a),m(),_(),!s&&n===i.carry},b=e=>{i=0;let t=VP(r,e-a);a=e,r-=t,y(t)||(r=0),r!==0&&(i=requestAnimationFrame(b))},x=()=>{r=0,i&&cancelAnimationFrame(i),i=0},S=()=>{x(),o!==null&&window.clearTimeout(o),o=null,h(),n=0,f()};return{by:y,glide(e){Math.sign(e)!==Math.sign(r)&&(r=0),r+=e,i||=(a=performance.now(),requestAnimationFrame(b))},settle:v,reset:S,dispose(){p.dispose(),S(),d.dispose()}}}function ZP(e,t,n){let r=e=>{if(e.ctrlKey||Math.abs(e.deltaX)>Math.abs(e.deltaY))return;if(FP({alternateScreen:t.buffer.active.type===`alternate`,mouseTracking:t.modes.mouseTrackingMode!==`none`,shift:e.shiftKey})===`app`){n.reset();return}e.preventDefault(),e.stopPropagation();let r=t.element?.querySelector(`.xterm-screen`),i=IP(e,(r&&t.rows>0?r.clientHeight/t.rows:0)||YP,t.rows);LP(e)?n.glide(i):n.by(i)};return e.addEventListener(`wheel`,r,{capture:!0,passive:!1}),()=>e.removeEventListener(`wheel`,r,{capture:!0})}var QP=6;function $P(e,t,n){let r=null,i=!1,a=e=>{r=e.touches.length===1?e.touches[0].clientY:null,i=!1},o=e=>{if(r===null||e.touches.length!==1)return;let{clientX:a,clientY:o}=e.touches[0];if(!i&&Math.abs(o-r)<QP)return;i=!0,e.preventDefault();let s=r-o;r=o;let c=t.element?.querySelector(`.xterm-screen`);if(FP({alternateScreen:t.buffer.active.type===`alternate`,mouseTracking:t.modes.mouseTrackingMode!==`none`,shift:!1})===`app`){c?.dispatchEvent(new WheelEvent(`wheel`,{deltaY:s,deltaMode:0,clientX:a,clientY:o,bubbles:!0,cancelable:!0}));return}let l=c&&t.rows>0?c.clientHeight/t.rows:0;n.by(s/(l||15))},s=()=>{r=null,n.settle()};return e.addEventListener(`touchstart`,a,{passive:!0}),e.addEventListener(`touchmove`,o,{passive:!1}),e.addEventListener(`touchend`,s),e.addEventListener(`touchcancel`,s),()=>{e.removeEventListener(`touchstart`,a),e.removeEventListener(`touchmove`,o),e.removeEventListener(`touchend`,s),e.removeEventListener(`touchcancel`,s)}}var eF=Object.defineProperty,tF=Object.getOwnPropertyDescriptor,nF=(e,t,n,r)=>{for(var i=r>1?void 0:r?tF(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&eF(t,n,i),i},rF=(e,t)=>(n,r)=>t(n,r,e),iF=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?lF.isErrorNoTelemetry(e)?new lF(e.message+`
|
|
58
|
-
|
|
59
|
-
`+e.stack):Error(e.message+`
|
|
60
|
-
|
|
61
|
-
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};function aF(e){sF(e)||iF.onUnexpectedError(e)}var oF=`Canceled`;function sF(e){return e instanceof cF||e instanceof Error&&e.name===oF&&e.message===oF}var cF=class extends Error{constructor(){super(oF),this.name=this.message}},lF=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}},uF;(e=>{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(uF||={});var dF=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>!t(n)||e(n)))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>!e(n)||(t=n,!1)),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||uF.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};dF.empty=new dF(e=>{});function fF(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var pF;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);t<n;t++)yield e[t]}e.slice=_;function v(t,n=1/0){let r=[];if(n===0)return[r,t];let i=t[Symbol.iterator]();for(let t=0;t<n;t++){let t=i.next();if(t.done)return[r,e.empty()];r.push(t.value)}return[r,{[Symbol.iterator](){return i}}]}e.consume=v;async function y(e){let t=[];for await(let n of e)t.push(n);return Promise.resolve(t)}e.asyncToArray=y})(pF||={});var mF=null;function hF(e){return mF?.trackDisposable(e),e}function gF(e){mF?.markAsDisposed(e)}function _F(e,t){mF?.setParent(e,t)}function vF(e){if(pF.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function yF(...e){return bF(()=>vF(e))}function bF(e){let t=hF({dispose:fF(()=>{gF(t),e()})});return t}var xF=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,hF(this)}dispose(){this._isDisposed||(gF(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{vF(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return _F(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error(`Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!`).stack):this._toDispose.add(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),_F(e,null))}};xF.DISABLE_DISPOSED_WARNING=!1;var SF=xF,CF=class{constructor(){this._store=new SF,hF(this),_F(this._store,this)}dispose(){gF(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}};CF.None=Object.freeze({dispose(){}});var wF=class{constructor(){this._isDisposed=!1,hF(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&_F(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,gF(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&_F(e,null),e}},TF=typeof process<`u`&&`title`in process,EF=TF?`node`:navigator.userAgent,DF=TF?`node`:navigator.platform,OF=EF.includes(`Firefox`),kF=EF.includes(`Edge`),AF=/^((?!chrome|android).)*safari/i.test(EF);function jF(){if(!AF)return 0;let e=EF.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(DF),[`Windows`,`Win16`,`Win32`,`WinCE`].includes(DF),DF.indexOf(`Linux`),/\bCrOS\b/.test(EF);var MF=``,NF=0,PF=0,FF=0,IF=0,LF={css:`#00000000`,rgba:0},RF;(e=>{function t(e,t,n,r){return r===void 0?`#${UF(e)}${UF(t)}${UF(n)}`:`#${UF(e)}${UF(t)}${UF(n)}${UF(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})(RF||={});var zF;(e=>{function t(e,t){if(IF=(t.rgba&255)/255,IF===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return NF=a+Math.round((n-a)*IF),PF=o+Math.round((r-o)*IF),FF=s+Math.round((i-s)*IF),{css:RF.toCss(NF,PF,FF),rgba:RF.toRgba(NF,PF,FF)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=HF.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return RF.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[NF,PF,FF]=HF.toChannels(t),{css:RF.toCss(NF,PF,FF),rgba:t}}e.opaque=i;function a(e,t){return IF=Math.round(t*255),[NF,PF,FF]=HF.toChannels(e.rgba),{css:RF.toCss(NF,PF,FF,IF),rgba:RF.toRgba(NF,PF,FF,IF)}}e.opacity=a;function o(e,t){return IF=e.rgba&255,a(e,IF*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(zF||={});var BF;(e=>{let t,n;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let r=e.getContext(`2d`,{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation=`copy`,n=t.createLinearGradient(0,0,1,1))}catch{}function r(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return NF=parseInt(e.slice(1,2).repeat(2),16),PF=parseInt(e.slice(2,3).repeat(2),16),FF=parseInt(e.slice(3,4).repeat(2),16),RF.toColor(NF,PF,FF);case 5:return NF=parseInt(e.slice(1,2).repeat(2),16),PF=parseInt(e.slice(2,3).repeat(2),16),FF=parseInt(e.slice(3,4).repeat(2),16),IF=parseInt(e.slice(4,5).repeat(2),16),RF.toColor(NF,PF,FF,IF);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let r=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(r)return NF=parseInt(r[1]),PF=parseInt(r[2]),FF=parseInt(r[3]),IF=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),RF.toColor(NF,PF,FF,IF);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[NF,PF,FF,IF]=t.getImageData(0,0,1,1).data,IF!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:RF.toRgba(NF,PF,FF,IF),css:e}}e.toColor=r})(BF||={});var VF;(e=>{function t(e){return n(e>>16&255,e>>8&255,e&255)}e.relativeLuminance=t;function n(e,t,n){let r=e/255,i=t/255,a=n/255,o=r<=.03928?r/12.92:((r+.055)/1.055)**2.4,s=i<=.03928?i/12.92:((i+.055)/1.055)**2.4,c=a<=.03928?a/12.92:((a+.055)/1.055)**2.4;return o*.2126+s*.7152+c*.0722}e.relativeLuminance2=n})(VF||={});var HF;(e=>{function t(e,t){if(IF=(t&255)/255,IF===1)return t;let n=t>>24&255,r=t>>16&255,i=t>>8&255,a=e>>24&255,o=e>>16&255,s=e>>8&255;return NF=a+Math.round((n-a)*IF),PF=o+Math.round((r-o)*IF),FF=s+Math.round((i-s)*IF),RF.toRgba(NF,PF,FF)}e.blend=t;function n(e,t,n){let a=VF.relativeLuminance(e>>8),o=VF.relativeLuminance(t>>8);if(WF(a,o)<n){if(o<a){let o=r(e,t,n),s=WF(a,VF.relativeLuminance(o>>8));if(s<n){let r=i(e,t,n);return s>WF(a,VF.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=WF(a,VF.relativeLuminance(s>>8));if(c<n){let i=r(e,t,n);return c>WF(a,VF.relativeLuminance(i>>8))?s:i}return s}}e.ensureContrastRatio=n;function r(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=WF(VF.relativeLuminance2(o,s,c),VF.relativeLuminance2(r,i,a));for(;l<n&&(o>0||s>0||c>0);)o-=Math.max(0,Math.ceil(o*.1)),s-=Math.max(0,Math.ceil(s*.1)),c-=Math.max(0,Math.ceil(c*.1)),l=WF(VF.relativeLuminance2(o,s,c),VF.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.reduceLuminance=r;function i(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=WF(VF.relativeLuminance2(o,s,c),VF.relativeLuminance2(r,i,a));for(;l<n&&(o<255||s<255||c<255);)o=Math.min(255,o+Math.ceil((255-o)*.1)),s=Math.min(255,s+Math.ceil((255-s)*.1)),c=Math.min(255,c+Math.ceil((255-c)*.1)),l=WF(VF.relativeLuminance2(o,s,c),VF.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.increaseLuminance=i;function a(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]}e.toChannels=a})(HF||={});function UF(e){let t=e.toString(16);return t.length<2?`0`+t:t}function WF(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function GF(e){if(!e)throw Error(`value must not be falsy`);return e}function KF(e){return 57508<=e&&e<=57558}function qF(e){return 57520<=e&&e<=57527}function JF(e){return 57344<=e&&e<=63743}function YF(e){return 9472<=e&&e<=9631}function XF(e){return e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}function ZF(e,t,n,r){return t===1&&n>Math.ceil(r*1.5)&&e!==void 0&&e>255&&!XF(e)&&!KF(e)&&!JF(e)}function QF(e){return KF(e)||YF(e)}function $F(){return{css:{canvas:eI(),cell:eI()},device:{canvas:eI(),cell:eI(),char:{width:0,height:0,left:0,top:0}}}}function eI(){return{width:0,height:0}}function tI(e,t,n=0){return(e-(Math.round(t)*2-n))%(Math.round(t)*2)}var nI=0,rI=0,iI=!1,aI=!1,oI=!1,sI,cI=0,lI=class{constructor(e,t,n,r,i,a){this._terminal=e,this._optionService=t,this._selectionRenderModel=n,this._decorationService=r,this._coreBrowserService=i,this._themeService=a,this.result={fg:0,bg:0,ext:0}}resolve(e,t,n,r){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,rI=0,nI=0,aI=!1,iI=!1,oI=!1,sI=this._themeService.colors,cI=0,e.getCode()!==0&&e.extended.underlineStyle===4){let e=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));cI=t*r%(Math.round(e)*2)}if(this._decorationService.forEachDecorationAtCell(t,n,`bottom`,e=>{e.backgroundColorRGB&&(rI=e.backgroundColorRGB.rgba>>8&16777215,aI=!0),e.foregroundColorRGB&&(nI=e.foregroundColorRGB.rgba>>8&16777215,iI=!0)}),oI=this._selectionRenderModel.isCellSelected(this._terminal,t,n),oI){if(this.result.fg&67108864||this.result.bg&50331648){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:rI=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:rI=(this.result.fg&16777215)<<8|255;break;default:rI=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:rI=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:rI=(this.result.bg&16777215)<<8|255}rI=HF.blend(rI,(this._coreBrowserService.isFocused?sI.selectionBackgroundOpaque:sI.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else rI=(this._coreBrowserService.isFocused?sI.selectionBackgroundOpaque:sI.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(aI=!0,sI.selectionForeground&&(nI=sI.selectionForeground.rgba>>8&16777215,iI=!0),QF(e.getCode())){if(this.result.fg&67108864&&!(this.result.bg&50331648))nI=(this._coreBrowserService.isFocused?sI.selectionBackgroundOpaque:sI.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:nI=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:nI=(this.result.bg&16777215)<<8|255}else switch(this.result.fg&50331648){case 16777216:case 33554432:nI=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:nI=(this.result.fg&16777215)<<8|255;break;default:nI=this._themeService.colors.foreground.rgba}nI=HF.blend(nI,(this._coreBrowserService.isFocused?sI.selectionBackgroundOpaque:sI.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}iI=!0}}this._decorationService.forEachDecorationAtCell(t,n,`top`,e=>{e.backgroundColorRGB&&(rI=e.backgroundColorRGB.rgba>>8&16777215,aI=!0),e.foregroundColorRGB&&(nI=e.foregroundColorRGB.rgba>>8&16777215,iI=!0)}),aI&&(rI=oI?e.bg&-150994944|rI|50331648:e.bg&-16777216|rI|50331648),iI&&(nI=e.fg&-83886080|nI|50331648),this.result.fg&67108864&&(aI&&!iI&&(nI=this.result.bg&50331648?this.result.fg&-134217728|this.result.bg&67108863:this.result.fg&-134217728|sI.background.rgba>>8&16777215|50331648,iI=!0),!aI&&iI&&(rI=this.result.fg&50331648?this.result.bg&-67108864|this.result.fg&67108863:this.result.bg&-67108864|sI.foreground.rgba>>8&16777215|50331648,aI=!0)),sI=void 0,this.result.bg=aI?rI:this.result.bg,this.result.fg=iI?nI:this.result.fg,this.result.ext&=536870911,this.result.ext|=cI<<29&3758096384}},uI=.5,dI=OF||kF?`bottom`:`ideographic`,fI={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]},pI={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]},mI={"─":{1:`M0,.5 L1,.5`},"━":{3:`M0,.5 L1,.5`},"│":{1:`M.5,0 L.5,1`},"┃":{3:`M.5,0 L.5,1`},"┌":{1:`M0.5,1 L.5,.5 L1,.5`},"┏":{3:`M0.5,1 L.5,.5 L1,.5`},"┐":{1:`M0,.5 L.5,.5 L.5,1`},"┓":{3:`M0,.5 L.5,.5 L.5,1`},"└":{1:`M.5,0 L.5,.5 L1,.5`},"┗":{3:`M.5,0 L.5,.5 L1,.5`},"┘":{1:`M.5,0 L.5,.5 L0,.5`},"┛":{3:`M.5,0 L.5,.5 L0,.5`},"├":{1:`M.5,0 L.5,1 M.5,.5 L1,.5`},"┣":{3:`M.5,0 L.5,1 M.5,.5 L1,.5`},"┤":{1:`M.5,0 L.5,1 M.5,.5 L0,.5`},"┫":{3:`M.5,0 L.5,1 M.5,.5 L0,.5`},"┬":{1:`M0,.5 L1,.5 M.5,.5 L.5,1`},"┳":{3:`M0,.5 L1,.5 M.5,.5 L.5,1`},"┴":{1:`M0,.5 L1,.5 M.5,.5 L.5,0`},"┻":{3:`M0,.5 L1,.5 M.5,.5 L.5,0`},"┼":{1:`M0,.5 L1,.5 M.5,0 L.5,1`},"╋":{3:`M0,.5 L1,.5 M.5,0 L.5,1`},"╴":{1:`M.5,.5 L0,.5`},"╸":{3:`M.5,.5 L0,.5`},"╵":{1:`M.5,.5 L.5,0`},"╹":{3:`M.5,.5 L.5,0`},"╶":{1:`M.5,.5 L1,.5`},"╺":{3:`M.5,.5 L1,.5`},"╷":{1:`M.5,.5 L.5,1`},"╻":{3:`M.5,.5 L.5,1`},"═":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"║":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╒":{1:(e,t)=>`M.5,1 L.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╓":{1:(e,t)=>`M${.5-e},1 L${.5-e},.5 L1,.5 M${.5+e},.5 L${.5+e},1`},"╔":{1:(e,t)=>`M1,${.5-t} L${.5-e},${.5-t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╕":{1:(e,t)=>`M0,${.5-t} L.5,${.5-t} L.5,1 M0,${.5+t} L.5,${.5+t}`},"╖":{1:(e,t)=>`M${.5+e},1 L${.5+e},.5 L0,.5 M${.5-e},.5 L${.5-e},1`},"╗":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5+e},${.5-t} L${.5+e},1`},"╘":{1:(e,t)=>`M.5,0 L.5,${.5+t} L1,${.5+t} M.5,${.5-t} L1,${.5-t}`},"╙":{1:(e,t)=>`M1,.5 L${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╚":{1:(e,t)=>`M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0 M1,${.5+t} L${.5-e},${.5+t} L${.5-e},0`},"╛":{1:(e,t)=>`M0,${.5+t} L.5,${.5+t} L.5,0 M0,${.5-t} L.5,${.5-t}`},"╜":{1:(e,t)=>`M0,.5 L${.5+e},.5 L${.5+e},0 M${.5-e},.5 L${.5-e},0`},"╝":{1:(e,t)=>`M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M0,${.5+t} L${.5+e},${.5+t} L${.5+e},0`},"╞":{1:(e,t)=>`M.5,0 L.5,1 M.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╟":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1 M${.5+e},.5 L1,.5`},"╠":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╡":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L.5,${.5-t} M0,${.5+t} L.5,${.5+t}`},"╢":{1:(e,t)=>`M0,.5 L${.5-e},.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╣":{1:(e,t)=>`M${.5+e},0 L${.5+e},1 M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0`},"╤":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t} M.5,${.5+t} L.5,1`},"╥":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},1 M${.5+e},.5 L${.5+e},1`},"╦":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╧":{1:(e,t)=>`M.5,0 L.5,${.5-t} M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╨":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╩":{1:(e,t)=>`M0,${.5+t} L1,${.5+t} M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╪":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╫":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╬":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╱":{1:`M1,0 L0,1`},"╲":{1:`M0,0 L1,1`},"╳":{1:`M1,0 L0,1 M0,0 L1,1`},"╼":{1:`M.5,.5 L0,.5`,3:`M.5,.5 L1,.5`},"╽":{1:`M.5,.5 L.5,0`,3:`M.5,.5 L.5,1`},"╾":{1:`M.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"╿":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L.5,0`},"┍":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L1,.5`},"┎":{1:`M.5,.5 L1,.5`,3:`M.5,.5 L.5,1`},"┑":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L0,.5`},"┒":{1:`M.5,.5 L0,.5`,3:`M.5,.5 L.5,1`},"┕":{1:`M.5,.5 L.5,0`,3:`M.5,.5 L1,.5`},"┖":{1:`M.5,.5 L1,.5`,3:`M.5,.5 L.5,0`},"┙":{1:`M.5,.5 L.5,0`,3:`M.5,.5 L0,.5`},"┚":{1:`M.5,.5 L0,.5`,3:`M.5,.5 L.5,0`},"┝":{1:`M.5,0 L.5,1`,3:`M.5,.5 L1,.5`},"┞":{1:`M0.5,1 L.5,.5 L1,.5`,3:`M.5,.5 L.5,0`},"┟":{1:`M.5,0 L.5,.5 L1,.5`,3:`M.5,.5 L.5,1`},"┠":{1:`M.5,.5 L1,.5`,3:`M.5,0 L.5,1`},"┡":{1:`M.5,.5 L.5,1`,3:`M.5,0 L.5,.5 L1,.5`},"┢":{1:`M.5,.5 L.5,0`,3:`M0.5,1 L.5,.5 L1,.5`},"┥":{1:`M.5,0 L.5,1`,3:`M.5,.5 L0,.5`},"┦":{1:`M0,.5 L.5,.5 L.5,1`,3:`M.5,.5 L.5,0`},"┧":{1:`M.5,0 L.5,.5 L0,.5`,3:`M.5,.5 L.5,1`},"┨":{1:`M.5,.5 L0,.5`,3:`M.5,0 L.5,1`},"┩":{1:`M.5,.5 L.5,1`,3:`M.5,0 L.5,.5 L0,.5`},"┪":{1:`M.5,.5 L.5,0`,3:`M0,.5 L.5,.5 L.5,1`},"┭":{1:`M0.5,1 L.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"┮":{1:`M0,.5 L.5,.5 L.5,1`,3:`M.5,.5 L1,.5`},"┯":{1:`M.5,.5 L.5,1`,3:`M0,.5 L1,.5`},"┰":{1:`M0,.5 L1,.5`,3:`M.5,.5 L.5,1`},"┱":{1:`M.5,.5 L1,.5`,3:`M0,.5 L.5,.5 L.5,1`},"┲":{1:`M.5,.5 L0,.5`,3:`M0.5,1 L.5,.5 L1,.5`},"┵":{1:`M.5,0 L.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"┶":{1:`M.5,0 L.5,.5 L0,.5`,3:`M.5,.5 L1,.5`},"┷":{1:`M.5,.5 L.5,0`,3:`M0,.5 L1,.5`},"┸":{1:`M0,.5 L1,.5`,3:`M.5,.5 L.5,0`},"┹":{1:`M.5,.5 L1,.5`,3:`M.5,0 L.5,.5 L0,.5`},"┺":{1:`M.5,.5 L0,.5`,3:`M.5,0 L.5,.5 L1,.5`},"┽":{1:`M.5,0 L.5,1 M.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"┾":{1:`M.5,0 L.5,1 M.5,.5 L0,.5`,3:`M.5,.5 L1,.5`},"┿":{1:`M.5,0 L.5,1`,3:`M0,.5 L1,.5`},"╀":{1:`M0,.5 L1,.5 M.5,.5 L.5,1`,3:`M.5,.5 L.5,0`},"╁":{1:`M.5,.5 L.5,0 M0,.5 L1,.5`,3:`M.5,.5 L.5,1`},"╂":{1:`M0,.5 L1,.5`,3:`M.5,0 L.5,1`},"╃":{1:`M0.5,1 L.5,.5 L1,.5`,3:`M.5,0 L.5,.5 L0,.5`},"╄":{1:`M0,.5 L.5,.5 L.5,1`,3:`M.5,0 L.5,.5 L1,.5`},"╅":{1:`M.5,0 L.5,.5 L1,.5`,3:`M0,.5 L.5,.5 L.5,1`},"╆":{1:`M.5,0 L.5,.5 L0,.5`,3:`M0.5,1 L.5,.5 L1,.5`},"╇":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L.5,0 M0,.5 L1,.5`},"╈":{1:`M.5,.5 L.5,0`,3:`M0,.5 L1,.5 M.5,.5 L.5,1`},"╉":{1:`M.5,.5 L1,.5`,3:`M.5,0 L.5,1 M.5,.5 L0,.5`},"╊":{1:`M.5,.5 L0,.5`,3:`M.5,0 L.5,1 M.5,.5 L1,.5`},"╌":{1:`M.1,.5 L.4,.5 M.6,.5 L.9,.5`},"╍":{3:`M.1,.5 L.4,.5 M.6,.5 L.9,.5`},"┄":{1:`M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5`},"┅":{3:`M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5`},"┈":{1:`M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5`},"┉":{3:`M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5`},"╎":{1:`M.5,.1 L.5,.4 M.5,.6 L.5,.9`},"╏":{3:`M.5,.1 L.5,.4 M.5,.6 L.5,.9`},"┆":{1:`M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333`},"┇":{3:`M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333`},"┊":{1:`M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95`},"┋":{3:`M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95`},"╭":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,1,.5`},"╮":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,0,.5`},"╯":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,0,.5`},"╰":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,1,.5`}},hI={"":{d:`M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655`,type:0},"":{d:`M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5`,type:0},"":{d:`M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82`,type:0},"":{d:`M0,0 L1,.5 L0,1`,type:0,rightPadding:2},"":{d:`M-1,-.5 L1,.5 L-1,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M1,0 L0,.5 L1,1`,type:0,leftPadding:2},"":{d:`M2,-.5 L0,.5 L2,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0`,type:0,rightPadding:1},"":{d:`M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0`,type:1,rightPadding:1},"":{d:`M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0`,type:0,leftPadding:1},"":{d:`M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0`,type:1,leftPadding:1},"":{d:`M-.5,-.5 L1.5,1.5 L-.5,1.5`,type:0},"":{d:`M-.5,-.5 L1.5,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M1.5,-.5 L-.5,1.5 L1.5,1.5`,type:0},"":{d:`M1.5,-.5 L-.5,1.5 L-.5,-.5`,type:0},"":{d:`M1.5,-.5 L-.5,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M-.5,-.5 L1.5,1.5 L1.5,-.5`,type:0}};hI[``]=hI[``],hI[``]=hI[``];function gI(e,t,n,r,i,a,o,s){let c=fI[t];if(c)return _I(e,c,n,r,i,a),!0;let l=pI[t];if(l)return yI(e,l,n,r,i,a),!0;let u=mI[t];if(u)return bI(e,u,n,r,i,a,s),!0;let d=hI[t];return d?(xI(e,d,n,r,i,a,o,s),!0):!1}function _I(e,t,n,r,i,a){for(let o=0;o<t.length;o++){let s=t[o],c=i/8,l=a/8;e.fillRect(n+s.x*c,r+s.y*l,s.w*c,s.h*l)}}var vI=new Map;function yI(e,t,n,r,i,a){let o=vI.get(t);o||(o=new Map,vI.set(t,o));let s=e.fillStyle;if(typeof s!=`string`)throw Error(`Unexpected fillStyle type "${s}"`);let c=o.get(s);if(!c){let n=t[0].length,r=t.length,i=e.canvas.ownerDocument.createElement(`canvas`);i.width=n,i.height=r;let a=GF(i.getContext(`2d`)),l=new ImageData(n,r),u,d,f,p;if(s.startsWith(`#`))u=parseInt(s.slice(1,3),16),d=parseInt(s.slice(3,5),16),f=parseInt(s.slice(5,7),16),p=s.length>7&&parseInt(s.slice(7,9),16)||1;else if(s.startsWith(`rgba`))[u,d,f,p]=s.substring(5,s.length-1).split(`,`).map(e=>parseFloat(e));else throw Error(`Unexpected fillStyle color format "${s}" when drawing pattern glyph`);for(let e=0;e<r;e++)for(let r=0;r<n;r++)l.data[(e*n+r)*4]=u,l.data[(e*n+r)*4+1]=d,l.data[(e*n+r)*4+2]=f,l.data[(e*n+r)*4+3]=t[e][r]*(p*255);a.putImageData(l,0,0),c=GF(e.createPattern(i,null)),o.set(s,c)}e.fillStyle=c,e.fillRect(n,r,i,a)}function bI(e,t,n,r,i,a,o){e.strokeStyle=e.fillStyle;for(let[s,c]of Object.entries(t)){e.beginPath(),e.lineWidth=o*Number.parseInt(s);let t;t=typeof c==`function`?c(.15,.15/a*i):c;for(let s of t.split(` `)){let t=s[0],c=CI[t];if(!c){console.error(`Could not find drawing instructions for "${t}"`);continue}let l=s.substring(1).split(`,`);!l[0]||!l[1]||c(e,wI(l,i,a,n,r,!0,o))}e.stroke(),e.closePath()}}function xI(e,t,n,r,i,a,o,s){let c=new Path2D;c.rect(n,r,i,a),e.clip(c),e.beginPath();let l=o/12;e.lineWidth=s*l;for(let o of t.d.split(` `)){let c=o[0],u=CI[c];if(!u){console.error(`Could not find drawing instructions for "${c}"`);continue}let d=o.substring(1).split(`,`);!d[0]||!d[1]||u(e,wI(d,i,a,n,r,!1,s,(t.leftPadding??0)*(l/2),(t.rightPadding??0)*(l/2)))}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}function SI(e,t,n=0){return Math.max(Math.min(e,t),n)}var CI={C:(e,t)=>e.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5]),L:(e,t)=>e.lineTo(t[0],t[1]),M:(e,t)=>e.moveTo(t[0],t[1])};function wI(e,t,n,r,i,a,o,s=0,c=0){let l=e.map(e=>parseFloat(e)||parseInt(e));if(l.length<2)throw Error(`Too few arguments for instruction`);for(let e=0;e<l.length;e+=2)l[e]*=t-s*o-c*o,a&&l[e]!==0&&(l[e]=SI(Math.round(l[e]+.5)-.5,t,0)),l[e]+=r+s*o;for(let e=1;e<l.length;e+=2)l[e]*=n,a&&l[e]!==0&&(l[e]=SI(Math.round(l[e]+.5)-.5,n,0)),l[e]+=i;return l}var TI=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},EI=class{constructor(){this._data=new TI}set(e,t,n,r,i){this._data.get(e,t)||this._data.set(e,t,new TI),this._data.get(e,t).set(n,r,i)}get(e,t,n,r){return this._data.get(e,t)?.get(n,r)}clear(){this._data.clear()}},DI=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&=(this._cancelCallback(this._idleCallback),void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||=this._requestCallback(this._process.bind(this))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),i=e.timeRemaining(),n*1.5>i){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=i}this.clear()}},OI=class extends DI{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},kI=class extends DI{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},AI=!TF&&`requestIdleCallback`in window?kI:OI,jI=class e{constructor(){this.fg=0,this.bg=0,this.extended=new MI}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return!(this.fg&50331648)}isBgDefault(){return!(this.bg&50331648)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?!(this.extended.underlineColor&50331648):this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},MI=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},NI=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};NI.Undefined=new NI(void 0);var PI=globalThis.performance&&typeof globalThis.performance.now==`function`,FI=class e{static create(t){return new e(t)}constructor(e){this._now=PI&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime===-1?this._now()-this._startTime:this._stopTime-this._startTime}},II;(e=>{e.None=()=>CF.None;function t(e,t){return d(e,()=>{},0,void 0,!0,void 0,t)}e.defer=t;function n(e){return(t,n=null,r)=>{let i=!1,a;return a=e(e=>{if(!i)return a?a.dispose():i=!0,t.call(n,e)},null,r),i&&a.dispose(),a}}e.once=n;function r(e,t,n){return l((n,r=null,i)=>e(e=>n.call(r,t(e)),null,i),n)}e.map=r;function i(e,t,n){return l((n,r=null,i)=>e(e=>{t(e),n.call(r,e)},null,i),n)}e.forEach=i;function a(e,t,n){return l((n,r=null,i)=>e(e=>t(e)&&n.call(r,e),null,i),n)}e.filter=a;function o(e){return e}e.signal=o;function s(...e){return(t,n=null,r)=>u(yF(...e.map(e=>e(e=>t.call(n,e)))),r)}e.any=s;function c(e,t,n,i){let a=n;return r(e,e=>(a=t(a,e),a),i)}e.reduce=c;function l(e,t){let n,r=new JI({onWillAddFirstListener(){n=e(r.fire,r)},onDidRemoveLastListener(){n?.dispose()}});return t?.add(r),r.event}function u(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}function d(e,t,n=100,r=!1,i=!1,a,o){let s,c,l,u=0,d,f=new JI({leakWarningThreshold:a,onWillAddFirstListener(){s=e(e=>{u++,c=t(c,e),r&&!l&&(f.fire(c),c=void 0),d=()=>{let e=c;c=void 0,l=void 0,(!r||u>1)&&f.fire(e),u=0},typeof n==`number`?(clearTimeout(l),l=setTimeout(d,n)):l===void 0&&(l=0,queueMicrotask(d))})},onWillRemoveListener(){i&&u>0&&d?.()},onDidRemoveLastListener(){d=void 0,s.dispose()}});return o?.add(f),f.event}e.debounce=d;function f(t,n=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],n,void 0,!0,void 0,r)}e.accumulate=f;function p(e,t=(e,t)=>e===t,n){let r=!0,i;return a(e,e=>{let n=r||!t(e,i);return r=!1,i=e,n},n)}e.latch=p;function m(t,n,r){return[e.filter(t,n,r),e.filter(t,e=>!n(e),r)]}e.split=m;function h(e,t=!1,n=[],r){let i=n.slice(),a=e(e=>{i?i.push(e):s.fire(e)});r&&r.add(a);let o=()=>{i?.forEach(e=>s.fire(e)),i=null},s=new JI({onWillAddFirstListener(){a||(a=e(e=>s.fire(e)),r&&r.add(a))},onDidAddFirstListener(){i&&(t?setTimeout(o):o())},onDidRemoveLastListener(){a&&a.dispose(),a=null}});return r&&r.add(s),s.event}e.buffer=h;function g(e,t){return(n,r,i)=>{let a=t(new v);return e(function(e){let t=a.evaluate(e);t!==_&&n.call(r,t)},void 0,i)}}e.chain=g;let _=Symbol(`HaltChainable`);class v{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:_),this}reduce(e,t){let n=t;return this.steps.push(t=>(n=e(n,t),n)),this}latch(e=(e,t)=>e===t){let t=!0,n;return this.steps.push(r=>{let i=t||!e(r,n);return t=!1,n=r,i?r:_}),this}evaluate(e){for(let t of this.steps)if(e=t(e),e===_)break;return e}}function y(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new JI({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return i.event}e.fromNodeEventEmitter=y;function b(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new JI({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return i.event}e.fromDOMEventEmitter=b;function x(e){return new Promise(t=>n(e)(t))}e.toPromise=x;function S(e){let t=new JI;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event}e.fromPromise=S;function C(e,t){return e(e=>t.fire(e))}e.forward=C;function w(e,t,n){return t(n),e(e=>t(e))}e.runAndSubscribe=w;class T{constructor(e,t){this._observable=e,this._counter=0,this._hasChanged=!1;let n={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};this.emitter=new JI(n),t&&t.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function E(e,t){return new T(e,t).emitter.event}e.fromObservable=E;function D(e){return(t,n,r)=>{let i=0,a=!1,o={beginUpdate(){i++},endUpdate(){i--,i===0&&(e.reportChanges(),a&&(a=!1,t.call(n)))},handlePossibleChange(){},handleChange(){a=!0}};e.addObserver(o),e.reportChanges();let s={dispose(){e.removeObserver(o)}};return r instanceof SF?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=D})(II||={});var LI=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new FI,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};LI.all=new Set,LI._idPool=0;var RI=LI,zI=-1,BI=class e{constructor(t,n,r=(e._idPool++).toString(16).padStart(3,`0`)){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t<n)return;this._stacks||=new Map;let r=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,r+1),--this._warnCountdown,this._warnCountdown<=0){this._warnCountdown=n*.5;let[e,r]=this.getMostFrequentStack(),i=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${r}):`;console.warn(i),console.warn(e);let a=new UI(i,e);this._errorHandler(a)}return()=>{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[n,r]of this._stacks)(!e||t<r)&&(e=[n,r],t=r);return e}};BI._idPool=1;var VI=BI,HI=class e{constructor(e){this.value=e}static create(){return new e(Error().stack??``)}print(){console.warn(this.value.split(`
|
|
62
|
-
`).slice(2).join(`
|
|
63
|
-
`))}},UI=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},WI=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},GI=0,KI=class{constructor(e){this.value=e,this.id=GI++}},qI=2,JI=class{constructor(e){this._size=0,this._options=e,this._leakageMon=zI>0||this._options?.leakWarningThreshold?new VI(e?.onListenerError??aF,this._options?.leakWarningThreshold??zI):void 0,this._perfMon=this._options?._profName?new RI(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new WI(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||aF)(n),CF.None}if(this._disposed)return CF.None;t&&(e=e.bind(t));let r=new KI(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=HI.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof KI?(this._deliveryQueue??=new YI,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=bF(()=>{i?.(),this._removeListener(r)});return n instanceof SF?n.add(a):Array.isArray(n)&&n.push(a),a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*qI<=t.length){let e=0;for(let n=0;n<t.length;n++)t[n]?t[e++]=t[n]:r&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=e}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||aF;if(!n){e.value(t);return}try{e.value(t)}catch(e){n(e)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners){if(this._listeners instanceof KI)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}}this._perfMon?.stop()}hasListeners(){return this._size>0}},YI=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},XI={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},ZI=2,QI,$I=class e{constructor(e,t,n){this._document=e,this._config=t,this._unicodeService=n,this._didWarmUp=!1,this._cacheMap=new EI,this._cacheMapCombined=new EI,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new jI,this._textureSize=512,this._onAddTextureAtlasCanvas=new JI,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new JI,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=rL(e,this._config.deviceCellWidth*4+ZI*2,this._config.deviceCellHeight+ZI*2),this._tmpCtx=GF(this._tmpCanvas.getContext(`2d`,{alpha:this._config.allowTransparency,willReadFrequently:!0}))}get pages(){return this._pages}dispose(){this._tmpCanvas.remove();for(let e of this.pages)e.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||=(this._doWarmUp(),!0)}_doWarmUp(){let e=new AI;for(let t=33;t<126;t++)e.enqueue(()=>{if(!this._cacheMap.get(t,0,0,0)){let e=this._drawToCache(t,0,0,0,!1,void 0);this._cacheMap.set(t,0,0,0,e)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(this._pages[0].currentRow.x!==0||this._pages[0].currentRow.y!==0){for(let e of this._pages)e.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(e.maxAtlasPages&&this._pages.length>=Math.max(4,e.maxAtlasPages)){let t=this._pages.filter(t=>t.canvas.width*2<=(e.maxTextureSize||4096)).sort((e,t)=>t.canvas.width===e.canvas.width?t.percentageUsed-e.percentageUsed:t.canvas.width-e.canvas.width),n=-1,r=0;for(let e=0;e<t.length;e++)if(t[e].canvas.width!==r)n=e,r=t[e].canvas.width;else if(e-n===3)break;let i=t.slice(n,n+4),a=i.map(e=>e.glyphs[0].texturePage).sort((e,t)=>e>t?1:-1),o=this.pages.length-i.length,s=this._mergePages(i,o);s.version++;for(let e=a.length-1;e>=0;e--)this._deletePage(a[e]);this.pages.push(s),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(s.canvas)}let t=new eL(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(e,t){let n=e[0].canvas.width*2,r=new eL(this._document,n,e);for(let[i,a]of e.entries()){let e=i*a.canvas.width%n,o=Math.floor(i/2)*a.canvas.height;r.ctx.drawImage(a.canvas,e,o);for(let r of a.glyphs)r.texturePage=t,r.sizeClipSpace.x=r.size.x/n,r.sizeClipSpace.y=r.size.y/n,r.texturePosition.x+=e,r.texturePosition.y+=o,r.texturePositionClipSpace.x=r.texturePosition.x/n,r.texturePositionClipSpace.y=r.texturePosition.y/n;this._onRemoveTextureAtlasCanvas.fire(a.canvas);let s=this._activePages.indexOf(a);s!==-1&&this._activePages.splice(s,1)}return r}_deletePage(e){this._pages.splice(e,1);for(let t=e;t<this._pages.length;t++){let e=this._pages[t];for(let t of e.glyphs)t.texturePage--;e.version++}}getRasterizedGlyphCombinedChar(e,t,n,r,i,a){return this._getFromCacheMap(this._cacheMapCombined,e,t,n,r,i,a)}getRasterizedGlyph(e,t,n,r,i,a){return this._getFromCacheMap(this._cacheMap,e,t,n,r,i,a)}_getFromCacheMap(e,t,n,r,i,a,o){return QI=e.get(t,n,r,i),QI||(QI=this._drawToCache(t,n,r,i,a,o),e.set(t,n,r,i,QI)),QI}_getColorFromAnsiIndex(e){if(e>=this._config.colors.ansi.length)throw Error(`No color found for idx `+e);return this._config.colors.ansi[e]}_getBackgroundColor(e,t,n,r){if(this._config.allowTransparency)return LF;let i;switch(e){case 16777216:case 33554432:i=this._getColorFromAnsiIndex(t);break;case 50331648:let e=jI.toColorRGB(t);i=RF.toColor(e[0],e[1],e[2]);break;default:i=n?zF.opaque(this._config.colors.foreground):this._config.colors.background}return this._config.allowTransparency||(i=zF.opaque(i)),i}_getForegroundColor(e,t,n,r,i,a,o,s,c,l){let u=this._getMinimumContrastColor(e,t,n,r,i,a,o,c,s,l);if(u)return u;let d;switch(i){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&c&&a<8&&(a+=8),d=this._getColorFromAnsiIndex(a);break;case 50331648:let e=jI.toColorRGB(a);d=RF.toColor(e[0],e[1],e[2]);break;default:d=o?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(d=zF.opaque(d)),s&&(d=zF.multiplyOpacity(d,uI)),d}_resolveBackgroundRgba(e,t,n){switch(e){case 16777216:case 33554432:return this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;default:return n?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(e,t,n,r){switch(e){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&r&&t<8&&(t+=8),this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;default:return n?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(e,t,n,r,i,a,o,s,c,l){if(this._config.minimumContrastRatio===1||l)return;let u=this._getContrastCache(c),d=u.getColor(e,r);if(d!==void 0)return d||void 0;let f=this._resolveBackgroundRgba(t,n,o),p=this._resolveForegroundRgba(i,a,o,s),m=HF.ensureContrastRatio(f,p,this._config.minimumContrastRatio/(c?2:1));if(!m){u.setColor(e,r,null);return}let h=RF.toColor(m>>24&255,m>>16&255,m>>8&255);return u.setColor(e,r,h),h}_getContrastCache(e){return e?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,n,r,i,a,o){let s=typeof t==`number`?String.fromCharCode(t):t;o&&this._tmpCanvas.parentElement!==o&&(this._tmpCanvas.style.display=`none`,o.append(this._tmpCanvas));let c=Math.min(this._config.deviceCellWidth*Math.max(s.length,2)+ZI*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<c&&(this._tmpCanvas.width=c);let l=Math.min(this._config.deviceCellHeight+ZI*4,this._textureSize);if(this._tmpCanvas.height<l&&(this._tmpCanvas.height=l),this._tmpCtx.save(),this._workAttributeData.fg=r,this._workAttributeData.bg=n,this._workAttributeData.extended.ext=i,this._workAttributeData.isInvisible())return XI;let u=!!this._workAttributeData.isBold(),d=!!this._workAttributeData.isInverse(),f=!!this._workAttributeData.isDim(),p=!!this._workAttributeData.isItalic(),m=!!this._workAttributeData.isUnderline(),h=!!this._workAttributeData.isStrikethrough(),g=!!this._workAttributeData.isOverline(),_=this._workAttributeData.getFgColor(),v=this._workAttributeData.getFgColorMode(),y=this._workAttributeData.getBgColor(),b=this._workAttributeData.getBgColorMode();if(d){let e=_;_=y,y=e;let t=v;v=b,b=t}let x=this._getBackgroundColor(b,y,d,f);this._tmpCtx.globalCompositeOperation=`copy`,this._tmpCtx.fillStyle=x.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation=`source-over`;let S=u?this._config.fontWeightBold:this._config.fontWeight,C=p?`italic`:``;this._tmpCtx.font=`${C} ${S} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=dI;let w=s.length===1&&KF(s.charCodeAt(0)),T=s.length===1&&qF(s.charCodeAt(0)),E=this._getForegroundColor(n,b,y,r,v,_,d,f,u,QF(s.charCodeAt(0)));this._tmpCtx.fillStyle=E.css;let D=T?0:ZI*2,O=!1;this._config.customGlyphs!==!1&&(O=gI(this._tmpCtx,s,D,D,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let k=!w,A;if(A=typeof t==`number`?this._unicodeService.wcwidth(t):this._unicodeService.getStringCellWidth(t),m){this._tmpCtx.save();let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),t=e%2==1?.5:0;if(this._tmpCtx.lineWidth=e,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())k=!1,this._tmpCtx.strokeStyle=`rgb(${jI.toColorRGB(this._workAttributeData.getUnderlineColor()).join(`,`)})`;else{k=!1;let e=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&e<8&&(e+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(e).css}this._tmpCtx.beginPath();let n=D,r=Math.ceil(D+this._config.deviceCharHeight)-t-(a?e*2:0),i=r+e,o=r+e*2,c=this._workAttributeData.getUnderlineVariantOffset();for(let a=0;a<A;a++){this._tmpCtx.save();let s=n+a*this._config.deviceCellWidth,l=n+(a+1)*this._config.deviceCellWidth,u=s+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(s,r),this._tmpCtx.lineTo(l,r),this._tmpCtx.moveTo(s,o),this._tmpCtx.lineTo(l,o);break;case 3:let n=e<=1?o:Math.ceil(D+this._config.deviceCharHeight-e/2)-t,a=e<=1?r:Math.ceil(D+this._config.deviceCharHeight+e/2)-t,d=new Path2D;d.rect(s,r,this._config.deviceCellWidth,o-r),this._tmpCtx.clip(d),this._tmpCtx.moveTo(s-this._config.deviceCellWidth/2,i),this._tmpCtx.bezierCurveTo(s-this._config.deviceCellWidth/2,a,s,a,s,i),this._tmpCtx.bezierCurveTo(s,n,u,n,u,i),this._tmpCtx.bezierCurveTo(u,a,l,a,l,i),this._tmpCtx.bezierCurveTo(l,n,l+this._config.deviceCellWidth/2,n,l+this._config.deviceCellWidth/2,i);break;case 4:let f=c===0?0:c>=e?e*2-c:e-c;c>=e||f===0?(this._tmpCtx.setLineDash([Math.round(e),Math.round(e)]),this._tmpCtx.moveTo(s+f,r),this._tmpCtx.lineTo(l,r)):(this._tmpCtx.setLineDash([Math.round(e),Math.round(e)]),this._tmpCtx.moveTo(s,r),this._tmpCtx.lineTo(s+f,r),this._tmpCtx.moveTo(s+f+e,r),this._tmpCtx.lineTo(l,r)),c=tI(l-s,e,c);break;case 5:let p=l-s,m=Math.floor(.6*p),h=Math.floor(.3*p),g=p-m-h;this._tmpCtx.setLineDash([m,h,g]),this._tmpCtx.moveTo(s,r),this._tmpCtx.lineTo(l,r);break;default:this._tmpCtx.moveTo(s,r),this._tmpCtx.lineTo(l,r)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!O&&this._config.fontSize>=12&&!this._config.allowTransparency&&s!==` `){this._tmpCtx.save(),this._tmpCtx.textBaseline=`alphabetic`;let t=this._tmpCtx.measureText(s);if(this._tmpCtx.restore(),`actualBoundingBoxDescent`in t&&t.actualBoundingBoxDescent>0){this._tmpCtx.save();let t=new Path2D;t.rect(n,r-Math.ceil(e/2),this._config.deviceCellWidth*A,o-r+Math.ceil(e/2)),this._tmpCtx.clip(t),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=x.css,this._tmpCtx.strokeText(s,D,D+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(g){let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),t=e%2==1?.5:0;this._tmpCtx.lineWidth=e,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(D,D+t),this._tmpCtx.lineTo(D+this._config.deviceCharWidth*A,D+t),this._tmpCtx.stroke()}if(O||this._tmpCtx.fillText(s,D,D+this._config.deviceCharHeight),s===`_`&&!this._config.allowTransparency){let e=tL(this._tmpCtx.getImageData(D,D,this._config.deviceCellWidth,this._config.deviceCellHeight),x,E,k);if(e)for(let t=1;t<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=x.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(s,D,D+this._config.deviceCharHeight-t),e=tL(this._tmpCtx.getImageData(D,D,this._config.deviceCellWidth,this._config.deviceCellHeight),x,E,k),e);t++);}if(h){let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),t=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=e,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(D,D+Math.floor(this._config.deviceCharHeight/2)-t),this._tmpCtx.lineTo(D+this._config.deviceCharWidth*A,D+Math.floor(this._config.deviceCharHeight/2)-t),this._tmpCtx.stroke()}this._tmpCtx.restore();let j=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),M;if(M=this._config.allowTransparency?nL(j):tL(j,x,E,k),M)return XI;let N=this._findGlyphBoundingBox(j,this._workBoundingBox,c,T,O,D),P,F;for(;;){if(this._activePages.length===0){let e=this._createNewPage();P=e,F=e.currentRow,F.height=N.size.y;break}P=this._activePages[this._activePages.length-1],F=P.currentRow;for(let e of this._activePages)N.size.y<=e.currentRow.height&&(P=e,F=e.currentRow);for(let e=this._activePages.length-1;e>=0;e--)for(let t of this._activePages[e].fixedRows)t.height<=F.height&&N.size.y<=t.height&&(P=this._activePages[e],F=t);if(N.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new eL(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),P=this._overflowSizePage,F=this._overflowSizePage.currentRow,F.x+N.size.x>=P.canvas.width&&(F.x=0,F.y+=F.height,F.height=0);break}if(F.y+N.size.y>=P.canvas.height||F.height>N.size.y+2){let t=!1;if(P.currentRow.y+P.currentRow.height+N.size.y>=P.canvas.height){let n;for(let e of this._activePages)if(e.currentRow.y+e.currentRow.height+N.size.y<e.canvas.height){n=e;break}if(n)P=n;else if(e.maxAtlasPages&&this._pages.length>=e.maxAtlasPages&&F.y+N.size.y<=P.canvas.height&&F.height>=N.size.y&&F.x+N.size.x<=P.canvas.width)t=!0;else{let e=this._createNewPage();P=e,F=e.currentRow,F.height=N.size.y,t=!0}}t||(P.currentRow.height>0&&P.fixedRows.push(P.currentRow),F={x:0,y:P.currentRow.y+P.currentRow.height,height:N.size.y},P.fixedRows.push(F),P.currentRow={x:0,y:F.y+F.height,height:0})}if(F.x+N.size.x<=P.canvas.width)break;F===P.currentRow?(F.x=0,F.y+=F.height,F.height=0):P.fixedRows.splice(P.fixedRows.indexOf(F),1)}return N.texturePage=this._pages.indexOf(P),N.texturePosition.x=F.x,N.texturePosition.y=F.y,N.texturePositionClipSpace.x=F.x/P.canvas.width,N.texturePositionClipSpace.y=F.y/P.canvas.height,N.sizeClipSpace.x/=P.canvas.width,N.sizeClipSpace.y/=P.canvas.height,F.height=Math.max(F.height,N.size.y),F.x+=N.size.x,P.ctx.putImageData(j,N.texturePosition.x-this._workBoundingBox.left,N.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,N.size.x,N.size.y),P.addGlyph(N),P.version++,N}_findGlyphBoundingBox(e,t,n,r,i,a){t.top=0;let o=r?this._config.deviceCellHeight:this._tmpCanvas.height,s=r?this._config.deviceCellWidth:n,c=!1;for(let n=0;n<o;n++){for(let r=0;r<s;r++){let i=n*this._tmpCanvas.width*4+r*4+3;if(e.data[i]!==0){t.top=n,c=!0;break}}if(c)break}t.left=0,c=!1;for(let n=0;n<a+s;n++){for(let r=0;r<o;r++){let i=r*this._tmpCanvas.width*4+n*4+3;if(e.data[i]!==0){t.left=n,c=!0;break}}if(c)break}t.right=s,c=!1;for(let n=a+s-1;n>=a;n--){for(let r=0;r<o;r++){let i=r*this._tmpCanvas.width*4+n*4+3;if(e.data[i]!==0){t.right=n,c=!0;break}}if(c)break}t.bottom=o,c=!1;for(let n=o-1;n>=0;n--){for(let r=0;r<s;r++){let i=n*this._tmpCanvas.width*4+r*4+3;if(e.data[i]!==0){t.bottom=n,c=!0;break}}if(c)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:t.right-t.left+1,y:t.bottom-t.top+1},sizeClipSpace:{x:t.right-t.left+1,y:t.bottom-t.top+1},offset:{x:-t.left+a+(r||i?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-t.top+a+(r||i?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},eL=class{constructor(e,t,n){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],n)for(let e of n)this._glyphs.push(...e.glyphs),this._usedPixels+=e._usedPixels;this.canvas=rL(e,t,t),this.ctx=GF(this.canvas.getContext(`2d`,{alpha:!0}))}get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(e){this._glyphs.push(e),this._usedPixels+=e.size.x*e.size.y}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}};function tL(e,t,n,r){let i=t.rgba>>>24,a=t.rgba>>>16&255,o=t.rgba>>>8&255,s=n.rgba>>>24,c=n.rgba>>>16&255,l=n.rgba>>>8&255,u=Math.floor((Math.abs(i-s)+Math.abs(a-c)+Math.abs(o-l))/12),d=!0;for(let t=0;t<e.data.length;t+=4)e.data[t]===i&&e.data[t+1]===a&&e.data[t+2]===o||r&&Math.abs(e.data[t]-i)+Math.abs(e.data[t+1]-a)+Math.abs(e.data[t+2]-o)<u?e.data[t+3]=0:d=!1;return d}function nL(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function rL(e,t,n){let r=e.createElement(`canvas`);return r.width=t,r.height=n,r}function iL(e,t,n,r,i,a,o,s){let c={foreground:a.foreground,background:a.background,cursor:LF,cursorAccent:LF,selectionForeground:LF,selectionBackgroundTransparent:LF,selectionBackgroundOpaque:LF,selectionInactiveBackgroundTransparent:LF,selectionInactiveBackgroundOpaque:LF,overviewRulerBorder:LF,scrollbarSliderBackground:LF,scrollbarSliderHoverBackground:LF,scrollbarSliderActiveBackground:LF,ansi:a.ansi.slice(),contrastCache:a.contrastCache,halfContrastCache:a.halfContrastCache};return{customGlyphs:i.customGlyphs,devicePixelRatio:o,deviceMaxTextureSize:s,letterSpacing:i.letterSpacing,lineHeight:i.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:n,deviceCharHeight:r,fontFamily:i.fontFamily,fontSize:i.fontSize,fontWeight:i.fontWeight,fontWeightBold:i.fontWeightBold,allowTransparency:i.allowTransparency,drawBoldTextInBrightColors:i.drawBoldTextInBrightColors,minimumContrastRatio:i.minimumContrastRatio,colors:c}}function aL(e,t){for(let n=0;n<e.colors.ansi.length;n++)if(e.colors.ansi[n].rgba!==t.colors.ansi[n].rgba)return!1;return e.devicePixelRatio===t.devicePixelRatio&&e.customGlyphs===t.customGlyphs&&e.lineHeight===t.lineHeight&&e.letterSpacing===t.letterSpacing&&e.fontFamily===t.fontFamily&&e.fontSize===t.fontSize&&e.fontWeight===t.fontWeight&&e.fontWeightBold===t.fontWeightBold&&e.allowTransparency===t.allowTransparency&&e.deviceCharWidth===t.deviceCharWidth&&e.deviceCharHeight===t.deviceCharHeight&&e.drawBoldTextInBrightColors===t.drawBoldTextInBrightColors&&e.minimumContrastRatio===t.minimumContrastRatio&&e.colors.foreground.rgba===t.colors.foreground.rgba&&e.colors.background.rgba===t.colors.background.rgba}function oL(e){return(e&50331648)==16777216||(e&50331648)==33554432}var sL=[];function cL(e,t,n,r,i,a,o,s,c){let l=iL(r,i,a,o,t,n,s,c);for(let t=0;t<sL.length;t++){let n=sL[t],r=n.ownedBy.indexOf(e);if(r>=0){if(aL(n.config,l))return n.atlas;n.ownedBy.length===1?(n.atlas.dispose(),sL.splice(t,1)):n.ownedBy.splice(r,1);break}}for(let t=0;t<sL.length;t++){let n=sL[t];if(aL(n.config,l))return n.ownedBy.push(e),n.atlas}let u=e._core,d={atlas:new $I(document,l,u.unicodeService),config:l,ownedBy:[e]};return sL.push(d),d.atlas}function lL(e){for(let t=0;t<sL.length;t++){let n=sL[t].ownedBy.indexOf(e);if(n!==-1){sL[t].ownedBy.length===1?(sL[t].atlas.dispose(),sL.splice(t,1)):sL[t].ownedBy.splice(n,1);break}}}var uL=600,dL=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&=(this._coreBrowserService.window.clearInterval(this._blinkInterval),void 0),this._blinkStartTimeout&&=(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),void 0),this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}))}_restartInterval(e=uL){this._blinkInterval&&=(this._coreBrowserService.window.clearInterval(this._blinkInterval),void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let e=uL-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,e>0){this._restartInterval(e);return}}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){let e=uL-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(e);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},uL)},e)}pause(){this.isCursorVisible=!0,this._blinkInterval&&=(this._coreBrowserService.window.clearInterval(this._blinkInterval),void 0),this._blinkStartTimeout&&=(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),void 0),this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}};function fL(e,t,n){let r=new t.ResizeObserver(t=>{let i=t.find(t=>t.target===e);if(!i)return;if(!(`devicePixelContentBoxSize`in i)){r?.disconnect(),r=void 0;return}let a=i.devicePixelContentBoxSize[0].inlineSize,o=i.devicePixelContentBoxSize[0].blockSize;a>0&&o>0&&n(a,o)});try{r.observe(e,{box:[`device-pixel-content-box`]})}catch{r.disconnect(),r=void 0}return bF(()=>r?.disconnect())}function pL(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var mL=class e extends jI{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new MI,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?pL(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},hL=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function gL(e,t,n){let r=GF(e.createProgram());if(e.attachShader(r,GF(_L(e,e.VERTEX_SHADER,t))),e.attachShader(r,GF(_L(e,e.FRAGMENT_SHADER,n))),e.linkProgram(r),e.getProgramParameter(r,e.LINK_STATUS))return r;console.error(e.getProgramInfoLog(r)),e.deleteProgram(r)}function _L(e,t,n){let r=GF(e.createShader(t));if(e.shaderSource(r,n),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS))return r;console.error(e.getShaderInfoLog(r)),e.deleteShader(r)}function vL(e,t){let n=Math.min(e.length*2,t),r=new Float32Array(n);for(let t=0;t<e.length;t++)r[t]=e[t];return r}var yL=class{constructor(e){this.texture=e,this.version=-1}},bL=`#version 300 es
|
|
64
|
-
layout (location = 0) in vec2 a_unitquad;
|
|
65
|
-
layout (location = 1) in vec2 a_cellpos;
|
|
66
|
-
layout (location = 2) in vec2 a_offset;
|
|
67
|
-
layout (location = 3) in vec2 a_size;
|
|
68
|
-
layout (location = 4) in float a_texpage;
|
|
69
|
-
layout (location = 5) in vec2 a_texcoord;
|
|
70
|
-
layout (location = 6) in vec2 a_texsize;
|
|
71
|
-
|
|
72
|
-
uniform mat4 u_projection;
|
|
73
|
-
uniform vec2 u_resolution;
|
|
74
|
-
|
|
75
|
-
out vec2 v_texcoord;
|
|
76
|
-
flat out int v_texpage;
|
|
77
|
-
|
|
78
|
-
void main() {
|
|
79
|
-
vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
|
|
80
|
-
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
81
|
-
v_texpage = int(a_texpage);
|
|
82
|
-
v_texcoord = a_texcoord + a_unitquad * a_texsize;
|
|
83
|
-
}`;function xL(e){let t=``;for(let n=1;n<e;n++)t+=` else if (v_texpage == ${n}) { outColor = texture(u_texture[${n}], v_texcoord); }`;return`#version 300 es
|
|
84
|
-
precision lowp float;
|
|
85
|
-
|
|
86
|
-
in vec2 v_texcoord;
|
|
87
|
-
flat in int v_texpage;
|
|
88
|
-
|
|
89
|
-
uniform sampler2D u_texture[${e}];
|
|
90
|
-
|
|
91
|
-
out vec4 outColor;
|
|
92
|
-
|
|
93
|
-
void main() {
|
|
94
|
-
if (v_texpage == 0) {
|
|
95
|
-
outColor = texture(u_texture[0], v_texcoord);
|
|
96
|
-
} ${t}
|
|
97
|
-
}`}var SL=11,CL=SL*Float32Array.BYTES_PER_ELEMENT,wL=2,TL=0,EL,DL=0,OL=0,kL=class extends CF{constructor(e,t,n,r){super(),this._terminal=e,this._gl=t,this._dimensions=n,this._optionsService=r,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array,attributesBuffers:[new Float32Array,new Float32Array]};let i=this._gl;$I.maxAtlasPages===void 0&&($I.maxAtlasPages=Math.min(32,GF(i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS))),$I.maxTextureSize=GF(i.getParameter(i.MAX_TEXTURE_SIZE))),this._program=GF(gL(i,bL,xL($I.maxAtlasPages))),this._register(bF(()=>i.deleteProgram(this._program))),this._projectionLocation=GF(i.getUniformLocation(this._program,`u_projection`)),this._resolutionLocation=GF(i.getUniformLocation(this._program,`u_resolution`)),this._textureLocation=GF(i.getUniformLocation(this._program,`u_texture`)),this._vertexArrayObject=i.createVertexArray(),i.bindVertexArray(this._vertexArrayObject);let a=new Float32Array([0,0,1,0,0,1,1,1]),o=i.createBuffer();this._register(bF(()=>i.deleteBuffer(o))),i.bindBuffer(i.ARRAY_BUFFER,o),i.bufferData(i.ARRAY_BUFFER,a,i.STATIC_DRAW),i.enableVertexAttribArray(0),i.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let s=new Uint8Array([0,1,2,3]),c=i.createBuffer();this._register(bF(()=>i.deleteBuffer(c))),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,c),i.bufferData(i.ELEMENT_ARRAY_BUFFER,s,i.STATIC_DRAW),this._attributesBuffer=GF(i.createBuffer()),this._register(bF(()=>i.deleteBuffer(this._attributesBuffer))),i.bindBuffer(i.ARRAY_BUFFER,this._attributesBuffer),i.enableVertexAttribArray(2),i.vertexAttribPointer(2,2,i.FLOAT,!1,CL,0),i.vertexAttribDivisor(2,1),i.enableVertexAttribArray(3),i.vertexAttribPointer(3,2,i.FLOAT,!1,CL,2*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(3,1),i.enableVertexAttribArray(4),i.vertexAttribPointer(4,1,i.FLOAT,!1,CL,4*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(4,1),i.enableVertexAttribArray(5),i.vertexAttribPointer(5,2,i.FLOAT,!1,CL,5*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(5,1),i.enableVertexAttribArray(6),i.vertexAttribPointer(6,2,i.FLOAT,!1,CL,7*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(6,1),i.enableVertexAttribArray(1),i.vertexAttribPointer(1,2,i.FLOAT,!1,CL,9*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(1,1),i.useProgram(this._program);let l=new Int32Array($I.maxAtlasPages);for(let e=0;e<$I.maxAtlasPages;e++)l[e]=e;i.uniform1iv(this._textureLocation,l),i.uniformMatrix4fv(this._projectionLocation,!1,hL),this._atlasTextures=[];for(let e=0;e<$I.maxAtlasPages;e++){let t=new yL(GF(i.createTexture()));this._register(bF(()=>i.deleteTexture(t.texture))),i.activeTexture(i.TEXTURE0+e),i.bindTexture(i.TEXTURE_2D,t.texture),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[e]=t}i.enable(i.BLEND),i.blendFunc(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return!this._atlas||this._atlas.beginFrame()}updateCell(e,t,n,r,i,a,o,s,c){this._updateCell(this._vertices.attributes,e,t,n,r,i,a,o,s,c)}_updateCell(e,t,n,r,i,a,o,s,c,l){if(TL=(n*this._terminal.cols+t)*SL,r===0||r===void 0){e.fill(0,TL,TL+SL-1-wL);return}this._atlas&&(EL=s&&s.length>1?this._atlas.getRasterizedGlyphCombinedChar(s,i,a,o,!1,this._terminal.element):this._atlas.getRasterizedGlyph(r,i,a,o,!1,this._terminal.element),DL=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),i!==l&&EL.offset.x>DL?(OL=EL.offset.x-DL,e[TL]=-(EL.offset.x-OL)+this._dimensions.device.char.left,e[TL+1]=-EL.offset.y+this._dimensions.device.char.top,e[TL+2]=(EL.size.x-OL)/this._dimensions.device.canvas.width,e[TL+3]=EL.size.y/this._dimensions.device.canvas.height,e[TL+4]=EL.texturePage,e[TL+5]=EL.texturePositionClipSpace.x+OL/this._atlas.pages[EL.texturePage].canvas.width,e[TL+6]=EL.texturePositionClipSpace.y,e[TL+7]=EL.sizeClipSpace.x-OL/this._atlas.pages[EL.texturePage].canvas.width,e[TL+8]=EL.sizeClipSpace.y):(e[TL]=-EL.offset.x+this._dimensions.device.char.left,e[TL+1]=-EL.offset.y+this._dimensions.device.char.top,e[TL+2]=EL.size.x/this._dimensions.device.canvas.width,e[TL+3]=EL.size.y/this._dimensions.device.canvas.height,e[TL+4]=EL.texturePage,e[TL+5]=EL.texturePositionClipSpace.x,e[TL+6]=EL.texturePositionClipSpace.y,e[TL+7]=EL.sizeClipSpace.x,e[TL+8]=EL.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&ZF(r,c,EL.size.x,this._dimensions.device.cell.width)&&(e[TL+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let e=this._terminal,t=e.cols*e.rows*SL;this._vertices.count===t?this._vertices.attributes.fill(0):this._vertices.attributes=new Float32Array(t);let n=0;for(;n<this._vertices.attributesBuffers.length;n++)this._vertices.count===t?this._vertices.attributesBuffers[n].fill(0):this._vertices.attributesBuffers[n]=new Float32Array(t);this._vertices.count=t,n=0;for(let t=0;t<e.rows;t++)for(let r=0;r<e.cols;r++)this._vertices.attributes[n+9]=r/e.cols,this._vertices.attributes[n+10]=t/e.rows,n+=SL}handleResize(){let e=this._gl;e.useProgram(this._program),e.viewport(0,0,e.canvas.width,e.canvas.height),e.uniform2f(this._resolutionLocation,e.canvas.width,e.canvas.height),this.clear()}render(e){if(!this._atlas)return;let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let n=this._vertices.attributesBuffers[this._activeBuffer],r=0;for(let t=0;t<e.lineLengths.length;t++){let i=t*this._terminal.cols*SL,a=this._vertices.attributes.subarray(i,i+e.lineLengths[t]*SL);n.set(a,r),r+=a.length}t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,n.subarray(0,r),t.STREAM_DRAW);for(let e=0;e<this._atlas.pages.length;e++)this._atlas.pages[e].version!==this._atlasTextures[e].version&&this._bindAtlasPageTexture(t,this._atlas,e);t.drawElementsInstanced(t.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,r/SL)}setAtlas(e){this._atlas=e;for(let e of this._atlasTextures)e.version=-1}_bindAtlasPageTexture(e,t,n){e.activeTexture(e.TEXTURE0+n),e.bindTexture(e.TEXTURE_2D,this._atlasTextures[n].texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t.pages[n].canvas),e.generateMipmap(e.TEXTURE_2D),this._atlasTextures[n].version=t.pages[n].version}setDimensions(e){this._dimensions=e}},AL=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);if(s>=e.rows||c<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function jL(){return new AL}var ML=4,NL=1,PL=2,FL=3,IL=2147483648,LL=class{constructor(){this.cells=new Uint32Array,this.lineLengths=new Uint32Array,this.selection=jL()}resize(e,t){let n=e*t*ML;n!==this.cells.length&&(this.cells=new Uint32Array(n),this.lineLengths=new Uint32Array(t))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},RL=`#version 300 es
|
|
98
|
-
layout (location = 0) in vec2 a_position;
|
|
99
|
-
layout (location = 1) in vec2 a_size;
|
|
100
|
-
layout (location = 2) in vec4 a_color;
|
|
101
|
-
layout (location = 3) in vec2 a_unitquad;
|
|
102
|
-
|
|
103
|
-
uniform mat4 u_projection;
|
|
104
|
-
|
|
105
|
-
out vec4 v_color;
|
|
106
|
-
|
|
107
|
-
void main() {
|
|
108
|
-
vec2 zeroToOne = a_position + (a_unitquad * a_size);
|
|
109
|
-
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
110
|
-
v_color = a_color;
|
|
111
|
-
}`,zL=`#version 300 es
|
|
112
|
-
precision lowp float;
|
|
113
|
-
|
|
114
|
-
in vec4 v_color;
|
|
115
|
-
|
|
116
|
-
out vec4 outColor;
|
|
117
|
-
|
|
118
|
-
void main() {
|
|
119
|
-
outColor = v_color;
|
|
120
|
-
}`,BL=8,VL=BL*Float32Array.BYTES_PER_ELEMENT,HL=20*BL,UL=class{constructor(){this.attributes=new Float32Array(HL),this.count=0}},WL=0,GL=0,KL=0,qL=0,JL=0,YL=0,XL=0,ZL=class extends CF{constructor(e,t,n,r){super(),this._terminal=e,this._gl=t,this._dimensions=n,this._themeService=r,this._vertices=new UL,this._verticesCursor=new UL;let i=this._gl;this._program=GF(gL(i,RL,zL)),this._register(bF(()=>i.deleteProgram(this._program))),this._projectionLocation=GF(i.getUniformLocation(this._program,`u_projection`)),this._vertexArrayObject=i.createVertexArray(),i.bindVertexArray(this._vertexArrayObject);let a=new Float32Array([0,0,1,0,0,1,1,1]),o=i.createBuffer();this._register(bF(()=>i.deleteBuffer(o))),i.bindBuffer(i.ARRAY_BUFFER,o),i.bufferData(i.ARRAY_BUFFER,a,i.STATIC_DRAW),i.enableVertexAttribArray(3),i.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let s=new Uint8Array([0,1,2,3]),c=i.createBuffer();this._register(bF(()=>i.deleteBuffer(c))),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,c),i.bufferData(i.ELEMENT_ARRAY_BUFFER,s,i.STATIC_DRAW),this._attributesBuffer=GF(i.createBuffer()),this._register(bF(()=>i.deleteBuffer(this._attributesBuffer))),i.bindBuffer(i.ARRAY_BUFFER,this._attributesBuffer),i.enableVertexAttribArray(0),i.vertexAttribPointer(0,2,i.FLOAT,!1,VL,0),i.vertexAttribDivisor(0,1),i.enableVertexAttribArray(1),i.vertexAttribPointer(1,2,i.FLOAT,!1,VL,2*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(1,1),i.enableVertexAttribArray(2),i.vertexAttribPointer(2,4,i.FLOAT,!1,VL,4*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(2,1),this._updateCachedColors(r.colors),this._register(this._themeService.onChangeColors(e=>{this._updateCachedColors(e),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),t.uniformMatrix4fv(this._projectionLocation,!1,hL),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let t=this._terminal,n=this._vertices,r=1,i,a,o,s,c,l,u,d,f,p,m;for(i=0;i<t.rows;i++){for(o=-1,s=0,c=0,l=!1,a=0;a<t.cols;a++)u=(i*t.cols+a)*ML,d=e.cells[u+NL],f=e.cells[u+PL],p=!!(f&67108864),(d!==s||f!==c&&(l||p))&&((s!==0||l&&c!==0)&&(m=r++*BL,this._updateRectangle(n,m,c,s,o,a,i)),o=a,s=d,c=f,l=p);(s!==0||l&&c!==0)&&(m=r++*BL,this._updateRectangle(n,m,c,s,o,t.cols,i))}n.count=r}updateCursor(e){let t=this._verticesCursor,n=e.cursor;if(!n||n.style===`block`){t.count=0;return}let r,i=0;(n.style===`bar`||n.style===`outline`)&&(r=i++*BL,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.style===`bar`?n.dpr*n.cursorWidth:n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(n.style===`underline`||n.style===`outline`)&&(r=i++*BL,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,(n.y+1)*this._dimensions.device.cell.height-n.dpr,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat)),n.style===`outline`&&(r=i++*BL,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat),r=i++*BL,this._addRectangleFloat(t.attributes,r,(n.x+n.width)*this._dimensions.device.cell.width-n.dpr,n.y*this._dimensions.device.cell.height,n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=i}_updateRectangle(e,t,n,r,i,a,o){if(n&67108864)switch(n&50331648){case 16777216:case 33554432:WL=this._themeService.colors.ansi[n&255].rgba;break;case 50331648:WL=(n&16777215)<<8;break;default:WL=this._themeService.colors.foreground.rgba}else switch(r&50331648){case 16777216:case 33554432:WL=this._themeService.colors.ansi[r&255].rgba;break;case 50331648:WL=(r&16777215)<<8;break;default:WL=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=vL(e.attributes,this._terminal.rows*this._terminal.cols*BL)),GL=i*this._dimensions.device.cell.width,KL=o*this._dimensions.device.cell.height,qL=(WL>>24&255)/255,JL=(WL>>16&255)/255,YL=(WL>>8&255)/255,XL=1,this._addRectangle(e.attributes,t,GL,KL,(a-i)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,qL,JL,YL,XL)}_addRectangle(e,t,n,r,i,a,o,s,c,l){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o,e[t+5]=s,e[t+6]=c,e[t+7]=l}_addRectangleFloat(e,t,n,r,i,a,o){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o[0],e[t+5]=o[1],e[t+6]=o[2],e[t+7]=o[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(e.rgba&255)/255])}},QL=class extends CF{constructor(e,t,n,r,i,a,o,s){super(),this._container=t,this._alpha=i,this._coreBrowserService=a,this._optionsService=o,this._themeService=s,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-${n}-layer`),this._canvas.style.zIndex=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(t=>{this._refreshCharAtlas(e,t),this.reset(e)})),this._register(bF(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=GF(this._canvas.getContext(`2d`,{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,n){}handleSelectionChanged(e,t,n,r=!1){}_setTransparency(e,t){if(t===this._alpha)return;let n=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,n),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=cL(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(e,t){this._deviceCellWidth=t.device.cell.width,this._deviceCellHeight=t.device.cell.height,this._deviceCharWidth=t.device.char.width,this._deviceCharHeight=t.device.char.height,this._deviceCharLeft=t.device.char.left,this._deviceCharTop=t.device.char.top,this._canvas.width=t.device.canvas.width,this._canvas.height=t.device.canvas.height,this._canvas.style.width=`${t.css.canvas.width}px`,this._canvas.style.height=`${t.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,t,n=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,n*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(e,t,n,r){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight))}_fillCharTrueColor(e,t,n,r){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=dI,this._clipCell(n,r,t.getWidth()),this._ctx.fillText(t.getChars(),n*this._deviceCellWidth+this._deviceCharLeft,r*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,n){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,n){let r=t?e.options.fontWeightBold:e.options.fontWeight;return`${n?`italic`:``} ${r} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},$L=class extends QL{constructor(e,t,n,r,i,a,o){super(n,e,`link`,t,!0,i,a,o),this._register(r.onShowLinkUnderline(e=>this._handleShowLinkUnderline(e))),this._register(r.onHideLinkUnderline(e=>this._handleHideLinkUnderline(e)))}resize(e,t){super.resize(e,t),this._state=void 0}reset(e){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(e){if(e.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:e.fg!==void 0&&oL(e.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[e.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(let t=e.y1+1;t<e.y2;t++)this._fillBottomLineAtCells(0,t,e.cols);this._fillBottomLineAtCells(0,e.y2,e.x2)}this._state=e}_handleHideLinkUnderline(e){this._clearCurrentLink()}},eR=typeof window==`object`?window:globalThis,tR=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new JI,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new JI,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};tR.INSTANCE=new tR;var nR=tR;function rR(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}nR.INSTANCE.onDidChangeZoomLevel,nR.INSTANCE.onDidChangeFullscreen;var iR=typeof navigator==`object`?navigator.userAgent:``;iR.indexOf(`Firefox`);var aR=iR.indexOf(`AppleWebKit`)>=0;!(iR.indexOf(`Chrome`)>=0)&&iR.indexOf(`Safari`),iR.indexOf(`Electron/`),iR.indexOf(`Android`);var oR=!1;if(typeof eR.matchMedia==`function`){let e=eR.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=eR.matchMedia(`(display-mode: fullscreen)`);oR=e.matches,rR(eR,e,({matches:e})=>{oR&&t.matches||(oR=e)})}function sR(){return oR}var cR=`en`,lR=!1,uR=!1,dR=!1,fR=cR,pR,mR=globalThis,hR;typeof mR.vscode<`u`&&typeof mR.vscode.process<`u`?hR=mR.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(hR=process);var gR=typeof hR?.versions?.electron==`string`&&hR?.type===`renderer`;if(typeof hR==`object`){hR.platform,hR.platform,lR=hR.platform===`linux`,lR&&hR.env.SNAP&&hR.env.SNAP_REVISION,hR.env.CI||hR.env.BUILD_ARTIFACTSTAGINGDIRECTORY,fR=cR;let e=hR.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,fR=t.resolvedLanguage||cR,t.languagePack?.translationsConfigFile}catch{}uR=!0}else typeof navigator==`object`&&!gR?(pR=navigator.userAgent,pR.indexOf(`Windows`),pR.indexOf(`Macintosh`),(pR.indexOf(`Macintosh`)>=0||pR.indexOf(`iPad`)>=0||pR.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,lR=pR.indexOf(`Linux`)>=0,pR?.indexOf(`Mobi`),dR=!0,fR=globalThis._VSCODE_NLS_LANGUAGE||cR,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);var _R=uR;dR&&typeof mR.importScripts==`function`&&mR.origin;var vR=pR,yR=fR,bR;(e=>{function t(){return yR}e.value=t;function n(){return yR.length===2?yR===`en`:yR.length>=3&&yR[0]===`e`&&yR[1]===`n`&&yR[2]===`-`}e.isDefaultVariant=n;function r(){return yR===`en`}e.isDefault=r})(bR||={});var xR=typeof mR.postMessage==`function`&&!mR.importScripts;(()=>{if(xR){let e=[];mR.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r.id===t.data.vscodeScheduleAsyncWork){e.splice(n,1),r.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),mR.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var SR=!!(vR&&vR.indexOf(`Chrome`)>=0);vR&&vR.indexOf(`Firefox`),!SR&&vR&&vR.indexOf(`Safari`),vR&&vR.indexOf(`Edg/`),vR&&vR.indexOf(`Android`);var CR=typeof navigator==`object`?navigator:{};_R||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||CR&&CR.clipboard&&CR.clipboard.writeText,_R||CR&&CR.clipboard&&CR.clipboard.readText,_R||sR()||CR.keyboard,`ontouchstart`in eR||CR.maxTouchPoints,eR.PointerEvent&&(`ontouchstart`in eR||navigator.maxTouchPoints);var wR=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},TR=new wR,ER=new wR,DR=new wR;Array(230);var OR;(e=>{function t(e){return TR.keyCodeToStr(e)}e.toString=t;function n(e){return TR.strToKeyCode(e)}e.fromString=n;function r(e){return ER.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return DR.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return ER.strToKeyCode(e)||DR.strToKeyCode(e)}e.fromUserSettings=a;function o(e){if(e>=98&&e<=113)return null;switch(e){case 16:return`Up`;case 18:return`Down`;case 15:return`Left`;case 17:return`Right`}return TR.keyCodeToStr(e)}e.toElectronAccelerator=o})(OR||={});var kR=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),AR;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof jR?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:II.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:kR})})(AR||={});var jR=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?kR:(this._emitter||=new JI,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}};(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var MR;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(MR||={});var NR=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new JI,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await II.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};NR.EMPTY=NR.fromArray([]);function PR(e){return FR(e,0)}function FR(e,t){switch(typeof e){case`object`:return e===null?IR(349,t):Array.isArray(e)?zR(e,t):BR(e,t);case`string`:return RR(e,t);case`boolean`:return LR(e,t);case`number`:return IR(e,t);case`undefined`:return IR(937,t);default:return IR(617,t)}}function IR(e,t){return(t<<5)-t+e|0}function LR(e,t){return IR(e?433:863,t)}function RR(e,t){t=IR(149417,t);for(let n=0,r=e.length;n<r;n++)t=IR(e.charCodeAt(n),t);return t}function zR(e,t){return t=IR(104579,t),e.reduce((e,t)=>FR(t,e),t)}function BR(e,t){return t=IR(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=RR(n,t),FR(e[n],t)),t)}var{registerWindow:VR,getWindow:HR,getDocument:UR,getWindows:WR,getWindowsCount:GR,getWindowId:KR,getWindowById:qR,hasWindow:JR,onDidRegisterWindow:YR,onWillUnregisterWindow:XR,onDidUnregisterWindow:ZR}=function(){let e=new Map,t={window:eR,disposables:new SF};e.set(eR.vscodeWindowId,t);let n=new JI,r=new JI,i=new JI;function a(n,r){return(typeof n==`number`?e.get(n):void 0)??(r?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return CF.None;let a=new SF,o={window:t,disposables:a.add(new SF)};return e.set(t.vscodeWindowId,o),a.add(bF(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add($R(t,tz.BEFORE_UNLOAD,()=>{i.fire(t)})),n.fire(o),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(e){return e.vscodeWindowId},hasWindow(t){return e.has(t)},getWindowById:a,getWindow(e){let t=e;if(t?.ownerDocument?.defaultView)return t.ownerDocument.defaultView.window;let n=e;return n?.view?n.view.window:eR},getDocument(e){return HR(e).document}}}(),QR=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&=(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,null)}};function $R(e,t,n,r){return new QR(e,t,n,r)}var ez=class e{constructor(e,t){this.width=e,this.height=t}with(t=this.width,n=this.height){return t!==this.width||n!==this.height?new e(t,n):this}static is(e){return typeof e==`object`&&typeof e.height==`number`&&typeof e.width==`number`}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};ez.None=new ez(0,0),new class{constructor(){this.mutationObservers=new Map}observe(e,t,n){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let i=PR(n),a=r.get(i);if(a)a.users+=1;else{let o=new JI,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add(bF(()=>{--c.users,c.users===0&&(o.dispose(),s.disconnect(),r?.delete(i),r?.size===0&&this.mutationObservers.delete(e))})),r.set(i,a)}return a.onDidMutate}};var tz={CLICK:`click`,AUXCLICK:`auxclick`,DBLCLICK:`dblclick`,MOUSE_UP:`mouseup`,MOUSE_DOWN:`mousedown`,MOUSE_OVER:`mouseover`,MOUSE_MOVE:`mousemove`,MOUSE_OUT:`mouseout`,MOUSE_ENTER:`mouseenter`,MOUSE_LEAVE:`mouseleave`,MOUSE_WHEEL:`wheel`,POINTER_UP:`pointerup`,POINTER_DOWN:`pointerdown`,POINTER_MOVE:`pointermove`,POINTER_LEAVE:`pointerleave`,CONTEXT_MENU:`contextmenu`,WHEEL:`wheel`,KEY_DOWN:`keydown`,KEY_PRESS:`keypress`,KEY_UP:`keyup`,LOAD:`load`,BEFORE_UNLOAD:`beforeunload`,UNLOAD:`unload`,PAGE_SHOW:`pageshow`,PAGE_HIDE:`pagehide`,PASTE:`paste`,ABORT:`abort`,ERROR:`error`,RESIZE:`resize`,SCROLL:`scroll`,FULLSCREEN_CHANGE:`fullscreenchange`,WK_FULLSCREEN_CHANGE:`webkitfullscreenchange`,SELECT:`select`,CHANGE:`change`,SUBMIT:`submit`,RESET:`reset`,FOCUS:`focus`,FOCUS_IN:`focusin`,FOCUS_OUT:`focusout`,BLUR:`blur`,INPUT:`input`,STORAGE:`storage`,DRAG_START:`dragstart`,DRAG:`drag`,DRAG_ENTER:`dragenter`,DRAG_LEAVE:`dragleave`,DRAG_OVER:`dragover`,DROP:`drop`,DRAG_END:`dragend`,ANIMATION_START:aR?`webkitAnimationStart`:`animationstart`,ANIMATION_END:aR?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:aR?`webkitAnimationIteration`:`animationiteration`},nz=class extends CF{constructor(e,t,n,r,i,a,o,s,c){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._optionsService=o,this._themeService=s,this._cursorBlinkStateManager=new wF,this._charAtlasDisposable=this._register(new wF),this._observerDisposable=this._register(new wF),this._model=new LL,this._workCell=new mL,this._workCell2=new mL,this._rectangleRenderer=this._register(new wF),this._glyphRenderer=this._register(new wF),this._onChangeTextureAtlas=this._register(new JI),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new JI),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new JI),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new JI),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new JI),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`);let l={antialias:!1,depth:!1,preserveDrawingBuffer:c};if(this._gl=this._canvas.getContext(`webgl2`,l),!this._gl)throw Error(`WebGL2 not supported `+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new lI(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new $L(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,o,this._themeService)],this.dimensions=$F(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(o.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register($R(this._canvas,`webglcontextlost`,e=>{console.log(`webglcontextlost event received`),e.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn(`webgl context not restored; firing onContextLoss`),this._onContextLoss.fire(e)},3e3)})),this._register($R(this._canvas,`webglcontextrestored`,e=>{console.warn(`webglcontextrestored event received`),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,lL(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=fL(this._canvas,this._coreBrowserService.window,(e,t)=>this._setCanvasDevicePixelDimensions(e,t)),this._register(this._coreBrowserService.onWindowChange(e=>{this._observerDisposable.value=fL(this._canvas,e,(e,t)=>this._setCanvasDevicePixelDimensions(e,t))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(bF(()=>{for(let e of this._renderLayers)e.dispose();this._canvas.parentElement?.removeChild(this._canvas),lL(this._terminal)}))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(e,t){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let e of this._renderLayers)e.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(e,t,n){for(let r of this._renderLayers)r.handleSelectionChanged(this._terminal,e,t,n);this._model.selection.update(this._core,e,t,n),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new ZL(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new kL(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let e=cL(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize);this._charAtlas!==e&&(this._onChangeTextureAtlas.fire(e.pages[0].canvas),this._charAtlasDisposable.value=yF(II.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),II.forward(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(e,t){if(!this._isAttached){if(this._core.screenElement?.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return}for(let n of this._renderLayers)n.handleGridChanged(this._terminal,e,t);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new dL(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let n=this._core,r=this._workCell,i,a,o,s,c,l,u=0,d=!0,f,p,m,h,g,_,v,y,b;e=iz(e,n.rows-1,0),t=iz(t,n.rows-1,0);let x=this._coreService.decPrivateModes.cursorStyle??n.options.cursorStyle??`block`,S=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,C=S-n.buffer.ydisp,w=Math.min(this._terminal.buffer.active.cursorX,n.cols-1),T=-1,E=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let D=!1;for(a=e;a<=t;a++)for(o=a+n.buffer.ydisp,s=n.buffer.lines.get(o),this._model.lineLengths[a]=0,m=S===o,u=0,c=this._characterJoinerService.getJoinedCharacters(o),y=0;y<n.cols;y++){if(i=this._cellColorResolver.result.bg,s.loadCell(y,r),y===0&&(i=this._cellColorResolver.result.bg),l=!1,d=y>=u,f=y,c.length>0&&y===c[0][0]&&d){p=c.shift();let e=this._model.selection.isCellSelected(this._terminal,p[0],o);for(v=p[0]+1;v<p[1];v++)d&&=e===this._model.selection.isCellSelected(this._terminal,v,o);d&&=!m||w<p[0]||w>=p[1],d?(l=!0,r=new rz(r,s.translateToString(!0,p[0],p[1]),p[1]-p[0]),f=p[1]-1):u=p[1]}if(h=r.getChars(),g=r.getCode(),v=(a*n.cols+y)*ML,this._cellColorResolver.resolve(r,y,o,this.dimensions.device.cell.width),E&&o===S&&(y===w&&(this._model.cursor={x:w,y:C,width:r.getWidth(),style:this._coreBrowserService.isFocused?x:n.options.cursorInactiveStyle,cursorWidth:n.options.cursorWidth,dpr:this._devicePixelRatio},T=w+r.getWidth()-1),y>=w&&y<=T&&(this._coreBrowserService.isFocused&&x===`block`||this._coreBrowserService.isFocused===!1&&n.options.cursorInactiveStyle===`block`)&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),g!==0&&(this._model.lineLengths[a]=y+1),(this._model.cells[v]!==g||this._model.cells[v+NL]!==this._cellColorResolver.result.bg||this._model.cells[v+PL]!==this._cellColorResolver.result.fg||this._model.cells[v+FL]!==this._cellColorResolver.result.ext)&&(D=!0,h.length>1&&(g|=IL),this._model.cells[v]=g,this._model.cells[v+NL]=this._cellColorResolver.result.bg,this._model.cells[v+PL]=this._cellColorResolver.result.fg,this._model.cells[v+FL]=this._cellColorResolver.result.ext,_=r.getWidth(),this._glyphRenderer.value.updateCell(y,a,g,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,h,_,i),l)){for(r=this._workCell,y++;y<=f;y++)b=(a*n.cols+y)*ML,this._glyphRenderer.value.updateCell(y,a,0,0,0,0,MF,0,0),this._model.cells[b]=0,this._model.cells[b+NL]=this._cellColorResolver.result.bg,this._model.cells[b+PL]=this._cellColorResolver.result.fg,this._model.cells[b+FL]=this._cellColorResolver.result.ext;y--}}D&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(e,t){this._canvas.width===e&&this._canvas.height===t||(this._canvas.width=e,this._canvas.height=t,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}},rz=class extends jI{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function iz(e,t,n=0){return Math.max(Math.min(e,t),n)}var az=`di$target`,oz=`di$dependencies`,sz=new Map;function cz(e){if(sz.has(e))return sz.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);lz(t,e,r)};return t._id=e,sz.set(e,t),t}function lz(e,t,n){t[az]===t?t[oz].push({id:e,index:n}):(t[oz]=[{id:e,index:n}],t[az]=t)}cz(`BufferService`),cz(`CoreMouseService`),cz(`CoreService`),cz(`CharsetService`),cz(`InstantiationService`),cz(`LogService`);var uz=cz(`OptionsService`);cz(`OscLinkService`),cz(`UnicodeService`),cz(`DecorationService`);var dz={trace:0,debug:1,info:2,warn:3,error:4,off:5},fz=`xterm.js: `,pz=class extends CF{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),mz=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=dz[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]==`function`&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?``:fz)+t,...n)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};pz=nF([rF(0,uz)],pz);var mz,hz=class extends CF{constructor(e){if(AF&&jF()<16&&!document.createElement(`canvas`).getContext(`webgl2`,{antialias:!1,depth:!1,preserveDrawingBuffer:!0}))throw Error(`Webgl2 is only supported on Safari 16 and above`);super(),this._preserveDrawingBuffer=e,this._onChangeTextureAtlas=this._register(new JI),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new JI),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new JI),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new JI),this.onContextLoss=this._onContextLoss.event}activate(e){let t=e._core;if(!e.element){this._register(t.onWillOpen(()=>this.activate(e)));return}this._terminal=e;let n=t.coreService,r=t.optionsService,i=t,a=i._renderService,o=i._characterJoinerService,s=i._charSizeService,c=i._coreBrowserService,l=i._decorationService;i._logService;let u=i._themeService;this._renderer=this._register(new nz(e,o,s,c,n,l,r,u,this._preserveDrawingBuffer)),this._register(II.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(II.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(II.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(II.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),a.setRenderer(this._renderer),this._register(bF(()=>{if(this._terminal._core._store._isDisposed)return;let t=this._terminal._core._renderService;t.setRenderer(this._terminal._core._createRenderer()),t.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};function gz(e){let t=null,n=null;try{let r=new Set(e.element?.querySelectorAll(`canvas`)),i=new hz;i.onContextLoss(()=>{i.dispose(),t=null}),i.onRemoveTextureAtlasCanvas(()=>e.refresh(0,e.rows-1)),e.loadAddon(i),t=i,n=[...e.element?.querySelectorAll(`canvas`)??[]].find(e=>!r.has(e)&&!e.classList.contains(`xterm-link-layer`))??null}catch{}let r=new ResizeObserver(()=>{let n=e._core?._renderService;t&&n&&!n._isPaused&&typeof n._renderRows==`function`&&n._renderRows(0,e.rows-1)});if(n)try{r.observe(n,{box:`device-pixel-content-box`})}catch{}let i=()=>{t&&(t.clearTextureAtlas(),e.refresh(0,e.rows-1))};return document.fonts.addEventListener(`loadingdone`,i),{dispose(){document.fonts.removeEventListener(`loadingdone`,i),r.disconnect(),n?.getContext(`webgl2`)?.getExtension(`WEBGL_lose_context`)?.loseContext()}}}function _z(e){return Uint8Array.from(atob(e),e=>e.charCodeAt(0))}function vz(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 yz=65536,bz=20;function xz(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>=yz?r():n??=window.setTimeout(r,bz)},dispose(){n!==null&&window.clearTimeout(n),n=null,t=0}}}function Sz(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}var Cz=8;function wz(e,t,n){return n&&n!==`leaf-1`?`${e}::${t}::${n}`:`${e}::${t}`}function Tz(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 Ez=new WeakMap,Dz=new Uint8Array([27,99]);function Oz(e){let t=new Uint8Array(Dz.length+e.length);return t.set(Dz),t.set(e,Dz.length),t}function kz(e){let{client:t,el:n,taskId:r,tabId:i}=e,a=new $N({fontFamily:nP,fontSize:13,lineHeight:1.15,theme:ap.get()??eP,cursorBlink:!0,scrollback:$d.get().prefs.scrollbackRows,allowProposedApi:!0,overviewRuler:{width:Cz},scrollOnUserInput:!1}),o=new cP(a),s=new Nw;a.loadAddon(o),a.loadAddon(s);let c=new $w;a.loadAddon(c),a.loadAddon(new ZT),a.unicode.activeVersion=`11`,a.loadAddon(new rE),a.open(n);let l=gz(a),u=TP(a);o.fit();let d=iP(a,n,c),f=!1;e.snapshot&&d.raise(e.snapshot),e.focusOnMount&&a.focus();let p=wz(r,i,e.leafId),m=Ez.get(t);m||(m=new Map,Ez.set(t,m));let h=m.get(p)??{owners:0,attached:!1};h.owners++,m.set(p,h);let g=()=>void t.request(`term.detach`,{stream:p}).catch(()=>{}),_=null,v=!1,y=null,b=!1,x=PP(e=>{_&&v&&t.request(`term.input`,{stream:_,data:e}).catch(()=>{})}),S=xz(e=>{_&&t.request(`term.ack`,{stream:_,chars:e}).catch(()=>{})}),C=(e,t,n)=>{u.push(e),a.write(e,()=>{n?.(),S.parsed(t)})},w=t.on(`term.data`,e=>{let t=vz(e);if(!t?.data||t.stream!==p)return;let n=_z(t.data);y?y.push({bytes:n,chars:t.data.length}):_&&C(n,t.data.length)}),T=t.on(`term.reset`,e=>{let t=Sz(e);!t||t.stream!==p||!_||y||x.replay(e=>C(Oz(_z(t.replay)),t.replay.length,e))}),E=t.on(`term.exit`,t=>{let n=vz(t);!n||n.stream!==p||(v=!1,e.setNotice({kind:`exited`,code:n.code??null}),e.onExit(n.code??null))}),D=!1,O=t=>{D||(D=!0,t?requestAnimationFrame(()=>requestAnimationFrame(()=>e.onPainted?.())):e.onPainted?.())},k=async()=>{y=[],_=null;try{let n=await t.request(`term.attach`,{taskId:r,tabId:i,...e.leafId&&e.leafId!==`leaf-1`?{leafId:e.leafId}:{},cols:a.cols,rows:a.rows,acks:!0}),o=m.get(p);if(o?o.attached=!0:g(),b)return;de.reset(),f&&!d.raised&&d.raise(d.snapshot()),f=!0,ce=null,le=!0,x.replay(e=>{let t=_z(n.replay);u.push(t),a.write(Oz(t),()=>{le=!1,e(),O(!0)})});for(let e of y)C(e.bytes,e.chars);if(_=n.stream,v=n.alive,n.alive&&a.rows>2){let{cols:e,rows:r}=a,i=n.stream;t.request(`term.resize`,{stream:i,cols:e,rows:r-1}).then(()=>new Promise(e=>window.setTimeout(e,60))).then(()=>_===i?t.request(`term.resize`,{stream:i,cols:a.cols,rows:a.rows}):void 0).then(()=>window.setTimeout(d.lower,250)).catch(d.lower)}else d.lower();n.alive&&document.activeElement===a.textarea&&Ft.set(n.stream),e.setNotice(n.alive?{kind:`none`}:n.restored?{kind:`restored`}:{kind:`exited`,code:null})}catch(t){if(b)return;t instanceof _l&&t.code===`TAB_NOT_LIVE`?e.setNotice({kind:`notLive`}):t instanceof _l&&t.code===`NOT_CONNECTED`||e.setNotice({kind:`failed`,message:t instanceof Error?t.message:String(t)})}finally{y=null,_||(d.lower(),O(!1))}},A=()=>n.clientWidth>0&&n.clientHeight>0,j=!1,M=t.onOpen(()=>{j=!A(),j||k()}),N=null,P=a.onData(e=>{if(N&&e.length===1){let t=N;N=null,t(),x.forward(jP(e))}else x.forward(e)}),F=0,I=()=>{!_||!v||(F=Date.now(),t.request(`term.resize`,{stream:_,cols:a.cols,rows:a.rows}).catch(()=>{}))},L=a.onKey(()=>{Date.now()-F>1e3&&I()}),ee=null,te=a.onResize(({cols:e,rows:n})=>{ee!==null&&window.clearTimeout(ee),ee=window.setTimeout(()=>{_&&v&&t.request(`term.resize`,{stream:_,cols:e,rows:n}).catch(()=>{})},80)}),ne=()=>{Gt.get()!==null||!A()||(o.fit(),j&&(j=!1,k()))},re=new ResizeObserver(ne);re.observe(n);let R=Gt.subscribe(ne),ie=$d.subscribe(()=>{a.options.scrollback=$d.get().prefs.scrollbackRows}),z=()=>{n.style.backgroundColor=(ap.get()??eP).background??``};z();let ae=ap.subscribe(()=>{a.options.theme=ap.get()??eP,z()});a.attachCustomKeyEventHandler(t=>{if(t.type===`keydown`&&t.ctrlKey&&!t.metaKey&&!t.altKey&&!t.shiftKey&&t.key.toLowerCase()===`v`&&/Mac|iPhone|iPad/.test(navigator.platform))return e.pasteImage(),!1;let n=Tz(t);if(!n)return!0;let r=a.getSelection();return r.trim().length===0?n===`interrupt-or-copy`:(e.copyText(r),a.clearSelection(),!1)});let oe=!1,se=e=>{oe=e.button===0},B=()=>{if(!oe)return;oe=!1;let t=a.getSelection();t.trim().length>0&&e.copyText(t)};n.addEventListener(`mousedown`,se),document.addEventListener(`mouseup`,B);let V=a.textarea,ce=null,le=!1,ue=0,de=XP(a,()=>{ce=null}),fe=ZP(n,a,de),pe=$P(n,a,de),me=e=>{e.target instanceof Element&&e.target.closest(`.scrollbar`)&&(ce=null,de.reset())};n.addEventListener(`mousedown`,me,{capture:!0});let he=()=>{if(!le&&a.buffer.active.type===`normal`){let e=HP(a.buffer.active);ce===null&&e>0&&(ce=e),ue=performance.now()}return!1},ge=a.parser.registerCsiHandler({final:`J`},e=>e[0]===3&&he()),_e=a.parser.registerEscHandler({final:`c`},he),ve=()=>{ce=null,de.reset(),HP(a.buffer.active)>0&&a.scrollToBottom()},ye=a.onKey(ve);V?.addEventListener(`paste`,ve),V?.addEventListener(`compositionend`,ve);let be=()=>e.onScrolled(HP(a.buffer.active)),xe=a.onScroll(be),Se=a.onWriteParsed(()=>{ce!==null&&performance.now()-ue>1e3&&(ce=null);let e=UP(ce,a.buffer.active);e!==null&&a.scrollToLine(e),be()}),Ce=e=>{ce=null,de.reset(),e()},we=()=>{Ft.set(_),I(),e.onFocusChange(!0)},Te=()=>e.onFocusChange(!1);return V?.addEventListener(`focus`,we),V?.addEventListener(`blur`,Te),{term:a,search:s,stream:p,scrollLines:e=>Ce(()=>a.scrollLines(e)),scrollToTop:()=>Ce(()=>a.scrollToTop()),scrollToBottom:()=>Ce(()=>a.scrollToBottom()),armCtrl:e=>{N=e},reattach:k,snapshot:d.snapshot,dispose(){b=!0,d.lower(),re.disconnect(),fe(),pe(),de.dispose(),n.removeEventListener(`mousedown`,me,{capture:!0}),V?.removeEventListener(`paste`,ve),V?.removeEventListener(`compositionend`,ve),ge.dispose(),_e.dispose(),ye.dispose(),ae(),ie(),R(),ee!==null&&window.clearTimeout(ee),n.removeEventListener(`mousedown`,se),document.removeEventListener(`mouseup`,B),V?.removeEventListener(`focus`,we),V?.removeEventListener(`blur`,Te),xe.dispose(),Se.dispose(),P.dispose(),L.dispose(),te.dispose(),M(),w(),E(),T(),S.dispose(),_&&Ft.get()===_&&Ft.set(null),h.owners--,h.owners===0&&(m.delete(p),h.attached&&g()),u.dispose(),a.dispose(),l.dispose()}}}var Az=_({});function jz(e,t,n){let r=Az.get()[`${e}::${t.id}`];return r&&r.sig===Fs(n)&&Os(n.root).some(e=>e.id===r.leaf)?r.leaf:n.activeLeafId}function Mz(e,t,n,r){Az.set({...Az.get(),[`${e}::${t}`]:{sig:Fs(n),leaf:r}})}function Nz(e,t,n,r){Mz(e,t.id,n,r),wC(wz(e,t.id,r))?.focus()}function Pz(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 Fz(e,t,n){try{let r=await e.client.request(`tab.split`,t);await e.refreshTabsNow(),n?.(r)}catch(e){G(e instanceof Error?e.message:String(e),`error`)}}function Iz(e,t,n,r,i){let a=i??(n.split?jz(t,n,n.split):`leaf-1`),o=e.selection.get();(o.taskId!==t||o.tabId!==n.id)&&e.select(t,n.id);let s=wC(wz(t,n.id,a))?.size();Fz(e,{taskId:t,tabId:n.id,action:`open`,direction:r,leafId:a,...s},e=>{e.changed?e.split&&Mz(t,n.id,e.split,e.leaf):G(R(`layout.splitTooSmall`),`error`)})}function Lz(e,t,n,r){let i=n.split,a=i?jz(t,n,i):r,o=()=>Fz(e,{taskId:t,tabId:n.id,action:`close`,leafId:r},e=>{let i=e.split;if(!i)return;let o=a!==r&&Os(i.root).some(e=>e.id===a);Mz(t,n.id,i,o?a:i.activeLeafId)});if(!i||!Ns(n,i,r)){o();return}W.set((0,B.jsx)(Mn,{title:R(`confirm.closePaneTitle`,{pane:Ms(i,Fi(n)).get(r)??r}),body:R(`confirm.closePaneBody`),confirmLabel:R(`menu.closePane`),onConfirm:o}))}function Rz(e,t,n,r){let i=n.split;i&&W.set((0,B.jsx)(jn,{title:Xa(`split.renameTitle`),initial:Ms(i,Fi(n)).get(r)??``,allowEmpty:!0,submitLabel:R(`dialog.save`),onSubmit:i=>Fz(e,{taskId:t,tabId:n.id,action:`rename`,leafId:r,title:i})}))}function zz(e,t,n,r){return[{label:R(`menu.renamePane`),section:`split`,key:ja(`workspace.split.rename`)??void 0,run:()=>Rz(e,t,n,r)},{label:R(`menu.closePane`),section:`split`,key:Tr(`workspace.split.close`)||void 0,run:()=>Lz(e,t,n,r)}]}function Bz(e,t,n,r){return[{label:R(`menu.splitRight`),section:`split`,key:ja(`workspace.split.right`)??void 0,run:()=>Iz(e,t,n,`right`,r)},{label:R(`menu.splitDown`),section:`split`,key:ja(`workspace.split.down`)??void 0,run:()=>Iz(e,t,n,`down`,r)}]}function Vz(e,t,n,r){let i=n.split,a=r??(i?jz(t,n,i):`leaf-1`);return[...Bz(e,t,n,a),...ks(i)?zz(e,t,n,a):[]]}function Hz(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)??si(n);return!i||!Ps(i)?[]:Bz(e,t,i,i.split?jz(t,i,i.split):`leaf-1`)}function Uz(e,{task:t,tab:n,leaf:r}){n.split&&Nz(t.id,n,n.split,r),e.select(t.id,n.id)}function Wz(e){let{row:t}=e,n=v(e.model.selection);v(Az);let r=n.taskId===t.task.id&&n.tabId===t.tab.id&&!!t.tab.split&&jz(t.task.id,t.tab,t.tab.split)===t.leaf;return(0,B.jsxs)(`button`,{type:`button`,className:`${Sn({size:`pane`})} ${e.cursor?Pc:``}`,"aria-current":r||void 0,onClick:e.onClick,onContextMenu:e.onMenu,...e.place,children:[(0,B.jsx)(`span`,{className:Sc,"aria-hidden":`true`,children:e.guides?.map((e,t)=>(0,B.jsx)(`span`,{className:Tc(e)},t))}),(0,B.jsx)(`span`,{className:`${Cn} text-(length:--fs-meta) ${r?`text-ink`:`text-muted`}`,children:t.label})]})}function Gz(e,t){let n=t?.trim()??``;return n&&e?.effortLevels?.includes(n)?n:``}function Kz({model:e,taskId:t}){let[n,r]=(0,g.useState)([]),[i,a]=(0,g.useState)({}),[o,s]=(0,g.useState)(``),[c,l]=(0,g.useState)(``),[u,d]=(0,g.useState)(``),[f,p]=(0,g.useState)(!1),{busy:m,error:h,submit:_}=An();(0,g.useEffect)(()=>{Promise.all([e.client.request(`engines.list`),e.client.request(`task.get`,{taskId:t})]).then(([e,t])=>{let n=Yo(e.engines,t.task.engine).filter(e=>e.ready!==!1||e.id===t.task.engine),i=n.find(e=>e.id===t.task.engine)??n[0];r(n),a(t.task),s(i?.id??``),l(Gz(i,t.task.effort)),d(i?.id===t.task.engine?t.task.model??``:``),p(!0)})},[e,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(Gz(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 n=y.length>0?c:void 0,r=v.acceptsModel?u.trim():void 0;(v.id!==i.engine||n!==void 0&&n!==(i.effort??``)||r!==void 0&&r!==(i.model??``))&&(await e.client.request(`task.setEngine`,{taskId:t,engine:v.id,...n===void 0?{}:{effort:n},...r===void 0?{}:{model:r}}),G(K(`tasks`,`toast.engineSwitched`,{engine:v.name})))});return(0,B.jsx)(kn,{title:K(`tasks`,`changeEngine.title`),wide:!0,children:(0,B.jsxs)(`form`,{className:on,onKeyDown:T,onSubmit:e=>{e.preventDefault(),E()},children:[(0,B.jsx)(`ul`,{className:$t,"aria-label":K(`tasks`,`changeEngine.title`),children:n.map(e=>(0,B.jsx)(`li`,{children:(0,B.jsxs)(`button`,{type:`button`,"aria-pressed":e.id===o,className:Sn({selected:e.id===o}),onClick:()=>S(e.id),children:[(0,B.jsx)(`span`,{className:`${En} text-accent`,children:e.id===o?`●`:` `}),(0,B.jsx)(`span`,{className:Cn,children:e.name}),e.id===i.engine&&(0,B.jsx)(`span`,{className:`text-muted`,children:K(`tasks`,`changeEngine.current`)})]})},e.id))}),f&&v&&v.acceptsModel&&(0,B.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,B.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:K(`tasks`,`engineModel.label`)}),(0,B.jsx)(`input`,{className:U,spellCheck:!1,placeholder:K(`tasks`,`engineModel.placeholder`),value:u,onChange:e=>d(e.target.value)}),x.length>0&&(0,B.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:x.map(e=>(0,B.jsx)(`button`,{type:`button`,className:Qt(),onClick:()=>d(e),children:e},e))})]}),b.length>0&&(0,B.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,B.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:K(`tasks`,`changeEngine.effortLabel`)}),(0,B.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:b.map(e=>(0,B.jsx)(`button`,{type:`button`,"aria-pressed":e===c,className:Qt(e===c),onClick:()=>l(e),children:e===``?K(`tasks`,`changeEngine.noEffort`):e},e||`default`))})]}),(0,B.jsx)(`p`,{className:`keys-only ${xt}`,children:(0,B.jsx)(oc,{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(` · `)})}),h&&(0,B.jsx)(`p`,{className:`text-error`,children:h}),(0,B.jsx)(Nn,{busy:m||!f,submitLabel:R(`taskops.set`)})]})})}function qz({model:e,task:t}){let[n,r]=(0,g.useState)(()=>cs(e,`task.get`,{taskId:t.id})?.task??null),[i,a]=(0,g.useState)(null),{busy:o,error:s,submit:c}=An();(0,g.useEffect)(()=>{us(e,`task.get`,{taskId:t.id}).then(e=>r(e.task)).catch(e=>a(On(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,B.jsx)(kn,{title:K(`tasks`,`runAgain.title`),wide:!0,children:(0,B.jsxs)(`form`,{className:on,onSubmit:e=>{e.preventDefault(),l()},children:[(0,B.jsx)(`p`,{className:`text-muted`,children:K(`tasks`,`runAgain.source`,{title:t.title})}),(0,B.jsx)(`pre`,{className:St,children:n?.prompt??i??K(`tasks`,`fieldNotes.loading`)}),(0,B.jsx)(`p`,{className:xt,children:K(`tasks`,`runAgain.hint`)}),s&&(0,B.jsx)(`p`,{className:`text-error`,children:s}),(0,B.jsx)(Nn,{busy:o||!n?.prompt,submitLabel:K(`tasks`,`runAgain.confirm`)})]})})}function Jz(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 Yz({model:e,repo:t}){let[n,r]=(0,g.useState)({kind:`loading`}),[i,a]=(0,g.useState)(0),[o,s]=(0,g.useState)(null),[c,l]=(0,g.useState)(null),u=(0,g.useRef)(null),d=()=>e.client.request(`notes.list`,{repo:t}).then(e=>r({kind:`ready`,notes:e.notes})).catch(e=>r({kind:`error`,message:On(e)}));(0,g.useEffect)(()=>void d(),[]);let f=n.kind===`ready`?n.notes:[];(0,g.useEffect)(()=>a(e=>Math.max(0,Math.min(e,f.length-1))),[f.length]),(0,g.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(On(e))}}};return(0,B.jsx)(kn,{title:K(`tasks`,`fieldNotes.title`),wide:!0,children:(0,B.jsxs)(`div`,{className:on,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,B.jsx)(`p`,{className:`font-mono text-meta break-all text-muted`,children:t}),n.kind===`loading`&&(0,B.jsx)(`p`,{className:`text-muted`,children:K(`tasks`,`fieldNotes.loading`)}),n.kind===`error`&&(0,B.jsx)(`p`,{className:`text-error`,children:n.message}),n.kind===`ready`&&f.length===0&&(0,B.jsx)(`p`,{className:`text-muted`,children:K(`tasks`,`fieldNotes.empty`)}),f.length>0&&(0,B.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,B.jsx)(`li`,{children:(0,B.jsxs)(`button`,{type:`button`,className:Ct(t===i),onClick:()=>a(t),autoFocus:t===0,children:[(0,B.jsxs)(`span`,{className:`font-mono text-meta whitespace-pre text-accent`,children:[t===i?`▸ `:` `,Jz(e.at),`, `,e.author]}),(0,B.jsx)(`span`,{className:`text-ink whitespace-pre-wrap wrap-anywhere`,children:e.text})]})},`${e.at}:${t}`))}),o&&(0,B.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-sm border-hairline border-line bg-paper px-3 py-2.5`,children:[(0,B.jsx)(`p`,{children:(0,B.jsx)(`strong`,{children:K(`tasks`,`fieldNotes.confirmDelete.title`)})}),(0,B.jsx)(`p`,{className:`text-muted`,children:K(`tasks`,`fieldNotes.confirmDelete.body`,{text:o.text})}),c&&(0,B.jsx)(`p`,{className:`text-error`,children:c}),(0,B.jsxs)(`div`,{className:`actions flex items-center justify-end gap-3.5`,children:[(0,B.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>s(null),children:R(`dialog.cancel`)}),(0,B.jsx)(`button`,{type:`button`,className:V({danger:!0}),onClick:()=>void p(o),children:R(`taskops.retire`)})]})]}),!o&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`p`,{className:`keys-only font-sans text-meta text-subtle`,children:K(`tasks`,`fieldNotes.footerDeletable`)}),(0,B.jsxs)(`div`,{className:`actions flex items-center justify-end gap-3.5`,children:[(0,B.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,disabled:f[i]?.id===void 0,onClick:()=>s(f[i]??null),children:R(`taskops.retire`)}),(0,B.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:Wt,children:R(`taskops.close`)})]})]})]})})}var Xz=[`backlog`,`in_progress`,`in_review`,`done`,`canceled`,`error`],Zz={backlog:`status.backlog`,in_progress:`status.inProgress`,in_review:`status.inReview`,done:`status.done`,canceled:`status.canceled`,error:`status.error`},Qz=e=>({binding:e,key:ja(e)??void 0});async function $z(e,t){if(!e){G(R(`menu.nothingToCopy`,{what:t}),`error`);return}try{await navigator.clipboard.writeText(e),G(R(`menu.copied`,{text:e}))}catch{G(R(`menu.copyFailed`),`error`)}}function eB(e,t,n){let r=[{label:R(`menu.newTask`),section:`open`,run:()=>$l(t)}],i=n.mainTaskId;return i&&(n.first||r.push({label:K(`tasks`,`menu.moveToTop`),section:`edit`,run:()=>void e.client.request(`task.move`,{taskId:i,direction:`top`}).catch(e=>G(K(`tasks`,`toast.moveFailed`,{error:String(e)}),`error`))}),r.push({label:K(`tasks`,`menu.reorderProject`),section:`edit`,...Qz(`sidebar.localMerge`),run:()=>nB()})),r.push({label:K(`tasks`,`menu.fieldNotes`),section:`notes`,run:()=>W.set((0,B.jsx)(Yz,{model:e,repo:t}))}),i&&r.push({label:K(`tasks`,`menu.forgetProject`),section:`danger`,danger:!0,run:()=>W.set(Sh(e,t,n.label))}),r}function tB(e){return[{label:R(`menu.newChatNoFolder`),section:`open`,run:()=>eu()},{label:R(`menu.newShell`),section:`open`,run:()=>void bs(e).catch(e=>G(String(e),`error`))}]}function nB(){vc(!_c.get()),document.querySelector(`.rail`)?.focus()}function rB(e,t,n){let r=e.client,i=[];n&&(i.push({label:R(`menu.closeTab`),section:`tab`,run:()=>W.set((0,B.jsx)(Mn,{title:R(`confirm.closeTabTitle`,{tab:n.title??n.engineName??n.id}),body:R(`confirm.closeTabBody`),confirmLabel:R(`menu.closeTab`),onConfirm:async()=>{await r.request(`tab.close`,{taskId:t.id,tabId:n.id}),await e.refreshTabsNow()}}))}),i.push(...Vz(e,t.id,n))),i.push({label:R(`menu.newChat`),section:`open`,run:()=>void vs(e,t.id)}),i.push({label:R(`menu.newChatPick`),section:`open`,run:()=>W.set((0,B.jsx)(Cs,{model:e,taskId:t.id}))}),i.push({label:R(`menu.newShell`),section:`open`,run:()=>void ys(e,t.id,{kind:`shell`}).catch(e=>G(String(e),`error`))}),t.hasPrompt&&i.push({label:K(`tasks`,`menu.runAgain`),section:`open`,run:()=>W.set((0,B.jsx)(qz,{model:e,task:t}))});let a=!t.machine;a&&i.push({label:K(`tasks`,`menu.openEditor`),section:`open`,...Qz(`tasks.openWorktree`),run:()=>void _h(e,t.id)}),i.push({label:R(`menu.rename`),section:`edit`,...Qz(`sidebar.rename`),run:()=>W.set((0,B.jsx)(jn,{title:R(`menu.rename`),initial:t.title,submitLabel:R(`dialog.save`),onSubmit:e=>r.request(`task.rename`,{taskId:t.id,title:e}).then(()=>{})}))}),t.kind!==`main`&&i.push({label:t.pinned?R(`menu.unpin`):R(`menu.pin`),section:`edit`,...Qz(`sidebar.pin`),run:()=>void r.request(`task.pin`,{taskId:t.id,pinned:!t.pinned}).catch(e=>G(String(e),`error`))}),a&&i.push({label:K(`tasks`,`menu.reorder`),section:`edit`,...Qz(`sidebar.localMerge`),run:()=>nB()}),i.push({label:R(`menu.setStatus`),section:`edit`,children:Xz.map(e=>({label:R(Zz[e]),checked:e===t.status,run:()=>void r.request(`task.setStatus`,{taskId:t.id,status:e}).catch(e=>G(String(e),`error`))}))}),a&&i.push({label:R(`menu.changeEngine`),section:`edit`,...Qz(`tasks.cycleEngine`),run:()=>W.set((0,B.jsx)(Kz,{model:e,taskId:t.id}))}),t.pr?.checkState===`failing`&&i.push({label:K(`tasks`,`menu.fixChecks`),section:`git`,key:Tr(`files.fixChecks`),run:()=>void gh(e,t.id,R(`taskops.fixSent`))}),t.kind===`task`&&t.branch&&a&&i.push({label:K(`tasks`,`menu.syncBase`),section:`git`,key:Tr(`files.syncBase`),run:()=>void mh(e,t.id)}),t.branch&&i.push({label:R(`menu.renameBranch`),section:`git`,...Qz(`tasks.renameBranch`),run:()=>W.set((0,B.jsx)(jn,{title:R(`menu.renameBranch`),initial:t.branch,submitLabel:R(`dialog.save`),onSubmit:e=>r.request(`task.setBranch`,{taskId:t.id,branch:e}).then(()=>{})}))}),t.kind===`task`&&t.branch&&i.push({label:R(`menu.land`),section:`git`,run:()=>void fh(e,t)});let o=[{label:R(`menu.copyWhat.id`),run:()=>void $z(t.id,R(`menu.what.id`))}];return t.branch&&o.push({label:R(`menu.copyWhat.branch`),run:()=>void $z(t.branch,R(`menu.what.branch`))}),o.push({label:R(`menu.copyWhat.path`),run:()=>void r.request(`task.get`,{taskId:t.id}).then(e=>$z(e.task.worktreePath,R(`menu.what.path`))).catch(e=>G(String(e),`error`))}),i.push({label:R(`menu.copy`),section:`copy`,children:o}),t.kind!==`main`&&i.push({label:K(`tasks`,t.archived?`menu.unarchive`:`menu.archive`),section:`danger`,run:()=>void xh(e,t)}),i.push({label:R(`menu.removeSession`),section:`danger`,...Qz(`sidebar.delete`),danger:!0,run:()=>W.set(t.kind===`main`?bh(e,t):yh(e,t))}),i}var iB=`rove.collapsedProjects`,aB=`rove.foldedTasks`,oB=`rove.openedTasks`,sB=600;function cB(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 lB(e,t){try{localStorage.setItem(e,JSON.stringify([...t]))}catch{}}var uB=(e,t)=>{let n=new Set(e);return n.delete(t)||n.add(t),n};function dB(){let e=v(mc),[t,n]=(0,g.useState)({active:!1,query:``}),[r,i]=(0,g.useState)(!1),a=()=>i(e=>!e),[o,s]=(0,g.useState)(()=>cB(iB)),c=e=>s(t=>{let n=uB(t,e);return lB(iB,n),n}),[l,u]=(0,g.useState)(()=>({folded:cB(aB),opened:cB(oB)}));return{sort:e,cycleSort:gc,search:t,setSearch:n,archivedOpen:r,toggleArchived:a,collapsed:o,toggleProject:c,hand:l,toggleTaskFold:(e,t)=>u(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)),lB(aB,r),lB(oB,i),{folded:r,opened:i}})}}var fB=[`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 pB(e){for(let t of e)for(let e of fB){let n=wr(e).indexOf(t);if(n>=0)return{id:e,slot:n}}return null}function mB(e,t,n,r){let{search:i,setSearch:a}=n,[o,s]=(0,g.useState)(null),c=(0,g.useRef)(0),l=t.filter(e=>e.kind!==`project`),u=l.findIndex(e=>e.id===o);(0,g.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,g.useEffect)(()=>cu.set(f),[f]);let p=l[0]?.id??null;(0,g.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)},h=t=>{t?.kind===`archived`&&n.toggleArchived(),t?.kind===`task`&&e.select(t.task.id),t?.kind===`pane`&&Uz(e,t),t&&t.kind!==`archived`&&Vi()},_=(t,n)=>{t?.kind===`task`&&kt(rB(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=Yo(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}),G(R(`rail.engineSwitched`,{engine:i.name}))}catch(e){G(R(`rail.engineSwitchFailed`,{error:e instanceof Error?e.message:String(e)}),`error`)}};return{cursor:o,setCursor:s,onKeyDown:t=>{let o=l[u];if(i.active){if(t.metaKey||t.ctrlKey||t.altKey)return;if(t.key===`Escape`)a({active:!1,query:``});else if(t.key===`Enter`)h(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`)a(e=>({...e,query:e.query.slice(0,-1)}));else if(t.key.length===1)a(e=>({...e,query:e.query+t.key}));else return;t.preventDefault();return}let s=pB(_a(t));if(_c.get()){let n=o?.kind===`task`&&o.machine===void 0;if(s?.id===`sidebar.nav`)n&&yc(e,o,s.slot%2==0?1:-1);else if(s?.id===`sidebar.localMerge`||t.key===`Enter`||t.key===`Escape`)_c.set(!1);else return;t.preventDefault();return}switch(s?.id){case`sidebar.nav`:m(s.slot%2==0?u+1:u-1);break;case`sidebar.goto`:s.slot%2==1?m(l.length-1):Date.now()-c.current<sB?(m(0),c.current=0):c.current=Date.now();break;case`sidebar.select`:case`sidebar.tree.open`:h(o);break;case`tasks.focusEngine`:document.querySelector(`.term-slot:not(.is-hidden) textarea`)?.focus();break;case`sidebar.rename`:case`sidebar.pin`:case`sidebar.delete`:case`tasks.renameBranch`:case`tasks.openWorktree`:_(o,s.id);break;case`tasks.cycleEngine`:v(o);break;case`sidebar.localMerge`:o?.machine===void 0&&vc(!0);break;case`sidebar.sort`:n.cycleSort(),G(K(`tasks`,`sort.label`,{mode:K(`tasks`,`sort.modes.${mc.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`:Ui(`worktrees`);break;case`tasks.update`:Ui(`update`);break;default:return}t.preventDefault()}}}var hB=(e,t,n)=>`~pane:${e}:${t}:${n}`;function gB(e,t){return e.flatMap(e=>e.kind===`task`?[e,...(t[e.task.id]??[]).flatMap(t=>{let n=t.split;if(!n||!ks(n))return[];let r=Ms(n,Fi(t));return Os(n.root).map(n=>({id:hB(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])}var _B=450,vB=!1;typeof document<`u`&&(document.addEventListener(`keydown`,()=>{vB=!0},!0),document.addEventListener(`pointerdown`,()=>{vB=!1},!0));var yB=e=>{let t=e.querySelector(`.row-title`);return!!t&&t.scrollWidth>t.clientWidth};function bB(e,t){let[n,r]=(0,g.useState)(null),i=(0,g.useRef)(null),a=(0,g.useRef)(null),o=()=>{i.current!==null&&window.clearTimeout(i.current),i.current=null},s=e=>{o(),i.current=window.setTimeout(()=>r(e.getBoundingClientRect()),_B)},c=()=>{o(),r(null)};return(0,g.useEffect)(()=>{let e=a.current,n=e?.closest(`.rail`);if(!t||!e||!n||!vB||!n.contains(document.activeElement)||!yB(e))return;let i=()=>{o(),r(null)},c=e=>{e.relatedTarget instanceof Node&&n.contains(e.relatedTarget)||i()};return s(e),n.addEventListener(`focusout`,c),()=>{n.removeEventListener(`focusout`,c),i()}},[t]),(0,g.useEffect)(()=>()=>{i.current!==null&&window.clearTimeout(i.current)},[]),{ref:e=>{a.current=e},onPointerEnter:e=>{e.pointerType===`touch`||!yB(e.currentTarget)||s(e.currentTarget)},onPointerLeave:c,hide:c,tip:n?(0,nC.createPortal)((0,B.jsx)(`div`,{className:kc,role:`tooltip`,style:{top:n.top+n.height/2,left:n.right+8},children:e}),document.body):null}}var xB=1.2,SB=.3,CB=20,wB=.35,TB=.25,EB=.12,DB=2,OB=1,kB={error:{dots:[0,4,8,2,6],bright:1},done:{dots:[3,7,5,2],bright:1},idle:{dots:[1,2,5,8,7,6,3,0],bright:.6}},AB=Array.from({length:9},(e,t)=>Math.hypot(t%3-1,Math.floor(t/3)-1));function jB(e){return wB+.65*(.5+.5*Math.cos(2*Math.PI*e/xB))}function MB(e,t,n,r=1){switch(e){case`working`:{let e=t*80/1e3/r;return AB.map(t=>jB(e-t*SB))}case`waiting`:{let e=[0,1,4,5].includes(Math.floor(t/r)%CB);return Array(9).fill(e?TB:1)}default:{let t=kB[e],r=Array(9).fill(EB);return t?.dots.forEach((e,i)=>{let a=Math.min(Math.max(n-i*OB,0),DB)/DB;r[e]=t.bright*a+EB*(1-a)}),r}}}function NB(e,t){let n=kB[e];return!n||t<(n.dots.length-1)*OB+DB}var PB=3,FB=new Set,IB;function LB(e,t){let n=typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches,r=1/0,i=e.held+t-e.step,a=NB(e.look,n?r:i);return MB(e.look,t,n?r:i,n?PB:1).forEach((t,n)=>{let r=e.el.children[n].style;r.opacity=t.toFixed(3)}),a}function RB(){let e=Math.floor(performance.now()/80);for(let t of FB)LB(t,e)||FB.delete(t);zB()}function zB(){IB=FB.size?window.setTimeout(RB,80-performance.now()%80+2):void 0}function BB(e,t,n){let r=Math.floor(performance.now()/80),i=n>0?Math.max(Date.now()-n,0):1/0,a={el:e,look:t,step:r,held:Math.floor(i/80)};return LB(a,r)&&(FB.add(a),IB===void 0&&zB()),()=>{FB.delete(a)}}function VB({status:e}){let{look:t,tone:n}=p_(e);return(0,B.jsx)(UB,{look:t,tone:n,since:e?.since??0},t)}var HB=e=>e===`muted`?`text-muted`:e===`ink`?`text-ink`:sc[e];function UB({look:e,tone:t,since:n}){let r=(0,g.useRef)(null),[i]=(0,g.useState)(n);return(0,g.useLayoutEffect)(()=>{let t=r.current;return t?BB(t,e,i):void 0},[e,i]),(0,B.jsx)(`span`,{ref:r,className:`inline-grid flex-none grid-cols-[repeat(3,3px)] auto-rows-[3px] gap-px self-center ${HB(t)}`,"aria-hidden":`true`,children:Array.from({length:9},(e,t)=>(0,B.jsx)(`i`,{className:`rounded-full bg-current opacity-12`},t))})}function WB(e){let t=K(`doctor`,`fix.humanOnlyWhy`),n=[];if(e.git||n.push({id:`git`,label:K(`doctor`,`fix.git`),action:K(`doctor`,`fix.gitAction`),why:t}),e.engines.length===0){let r=e.signedOut.length>0;n.push({id:`engine`,label:K(`doctor`,r?`fix.noEngineLogin`:`fix.noEngine`),action:K(`doctor`,r?`fix.noEngineLoginAction`:`fix.noEngineAction`,{list:e.signedOut.map(e=>e.id).join(`, `)}),why:t})}return n}function GB({model:e}){z(),v(gr);let[t,n]=(0,g.useState)(()=>cs(e,`welcome.env`)??null);(0,g.useEffect)(()=>{let t=!0;return us(e,`welcome.env`).then(e=>t&&n(e)).catch(()=>{}),()=>{t=!1}},[e]);let r=[{cap:Tr(`task.new.global`),msg:`stepNew`},{cap:hr(`f1`),msg:`stepHelp`},{cap:Sr(),msg:`stepPrefix`}],i=t===null?null:t.engines.length>0?{key:`enginesFound`,warn:!1,list:t.engines.map(e=>e.name).join(`, `)}:t.signedOut.length>0?{key:`enginesSignedOut`,warn:!0,list:t.signedOut.map(e=>e.name).join(`, `)}:{key:`enginesMissing`,warn:!0,list:``},a=t!==null&&(t.engines.length===0||!t.git)?WB(t):[],o=t?.start??null;return(0,B.jsxs)(`div`,{className:`mx-auto flex max-w-reading flex-col gap-2.5 overflow-y-auto px-5 py-7 font-sans text-meta/normal`,"data-field":`welcome`,children:[(0,B.jsx)(`h1`,{className:`m-0 font-sans text-title font-semibold text-accent`,children:K(`workspace`,`welcome.title`)}),(0,B.jsx)(`p`,{className:`m-0 text-muted`,children:K(`workspace`,`welcome.tagline`)}),(0,B.jsx)(`dl`,{className:`keys-only m-0 flex flex-col gap-0.5 pt-1.5`,children:r.map(e=>(0,B.jsxs)(`div`,{className:`flex gap-3.5`,children:[(0,B.jsx)(`dt`,{className:`mono shrink-0 grow-0 basis-cap text-accent`,children:e.cap}),(0,B.jsx)(`dd`,{className:`m-0 text-muted`,children:K(`workspace`,`welcome.${e.msg}`)})]},e.msg))}),(0,B.jsx)(`p`,{className:`m-0 text-muted`,children:K(`workspace`,`welcome.worktreeExplain`)}),t!==null&&i!==null&&(0,B.jsxs)(`div`,{className:`flex flex-col gap-1.5 pt-1.5`,children:[(0,B.jsx)(`p`,{className:`m-0 ${i.warn?`text-warning`:`text-muted`}`,children:K(`workspace`,`welcome.${i.key}`,{list:i.list})}),!t.git&&(0,B.jsx)(`p`,{className:`m-0 text-warning`,children:K(`workspace`,`welcome.gitMissing`)}),a.map(e=>(0,B.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,B.jsx)(`p`,{className:`m-0 text-warning`,children:e.label}),(0,B.jsx)(`p`,{className:`mono m-0 text-accent`,children:e.action}),(0,B.jsx)(`p`,{className:`m-0 text-muted`,children:e.why})]},e.id)),a.length>0&&(0,B.jsx)(`p`,{className:`m-0 text-muted`,children:K(`common`,`failureHint`,{command:`rove doctor`})})]}),t!==null&&o!==null&&(0,B.jsxs)(`div`,{className:`flex flex-col gap-1.5 pt-1.5`,children:[(0,B.jsx)(`button`,{type:`button`,className:`${V()} self-start`,"data-field":`quick-start`,onClick:()=>W.set((0,B.jsx)(Ao,{model:e,start:o,engines:t.engines})),children:K(`onboarding`,`quickStart`)}),(0,B.jsx)(`p`,{className:`m-0 text-muted`,children:So()?R(`pages.quickIntentTouch`):K(`onboarding`,`quickIntent`,{key:Tr(`task.new.global`)})})]}),(0,B.jsx)(`p`,{className:`m-0 pt-1.5 opacity-70 text-muted`,children:K(`workspace`,`welcome.docsHint`)})]})}function KB(e,t){e.preventDefault(),At.set({x:e.clientX,y:e.clientY,items:t,target:e.currentTarget,fromKeyboard:e.button!==2})}function qB({model:e,narrow:t}){let n=z(),r=v(e.tasks),i=v(e.remote),a=Kc(e),o=v(e.tabs),s=v(e.tabsSettled),c=v(e.selection),l=r?.tasks??[],u=r?.attention.filter(e=>e.unread).length??0,d=c.taskId,f=v(df),p=Y(`engines.skill.bannerHintWeb`,{engines:f.join(`, `)}),m=new Map([...l,...i].map(e=>[e.id,e])),h=dB(),_=v(_c),y=e=>Ni({tasks:l,remote:i,machines:a,sort:h.sort,query:e,fold:{...h.hand,selectedId:d??void 0}}),b=y(h.search.active?h.search.query:``),{groups:x}=b,S=h.search.active?b.rows:lC(Ii(gB(bC(b.rows,o,c.taskId,s),o),h.collapsed),r?.archived??[],h.archivedOpen,{...h.hand,selectedId:d??void 0}),C=e=>e.filter(e=>e.kind!==`project`),w=(n===`zh`?Zn:Xn).machine,T=new Set(a.filter(e=>e.state!==`online`).map(e=>e.alias)),E=x.find(e=>e.tasks.some(e=>e.kind===`main`))?.repo,D=e=>({mainTaskId:x.find(t=>t.repo===e)?.tasks.find(e=>e.kind===`main`)?.id??null,label:vi(e),first:e===E}),O=yC(e,l,!h.search.active,h.sort==="default",D),k=O.places(S),A=()=>W.set((0,B.jsx)(oh,{model:e})),j=mB(e,S,h,{selectedId:d,onNewTask:$l,onSettings:A}),M=C(y(``).rows).length,N=(0,g.useRef)(null),P=v(D_)&&!t,F=v(O_)&&P,I=t?l.find(e=>e.id===c.taskId&&!e.deleting)??null:null;return(0,B.jsxs)(`nav`,{className:`${jc} ${P?`is-folded`:``}`,ref:N,inert:P&&!F,"aria-hidden":P&&!F,onMouseEnter:P?()=>A_(!0):void 0,onMouseLeave:P?()=>A_(!1):void 0,tabIndex:0,onKeyDown:e=>{Xh(`sidebar`),j.onKeyDown(e)},children:[(0,B.jsxs)(`header`,{className:Mc,children:[(0,B.jsxs)(`span`,{className:`${ht} mr-auto`,children:[(0,B.jsx)(`span`,{className:gt,children:`[`}),` rove `,(0,B.jsx)(`span`,{className:gt,children:`]`})]}),(0,B.jsxs)(`span`,{className:`relative`,children:[(0,B.jsx)(`button`,{type:`button`,className:`m-0 text-meta font-medium normal-nums inbox-chip relative ${bn} ${ye} ${u>0?`text-accent`:`text-muted`}`,onClick:()=>W.set((0,B.jsx)(dc,{model:e})),children:R(`rail.inbox`,{count:u})}),(0,B.jsx)(Uh,{model:e,bindingId:`inbox.show`,head:!0})]}),(0,B.jsx)(gm,{})]}),_&&(0,B.jsxs)(`div`,{className:`flex gap-1 px-3.5 pb-2 text-meta mono`,children:[(0,B.jsx)(`span`,{className:`text-accent`,children:K(`tasks`,`moveChip`).trim()}),(0,B.jsx)(`span`,{className:`keys-only ml-1.5 text-muted`,children:(0,B.jsx)(oc,{text:R(`taskops.moveHint`)})})]}),h.search.active&&(0,B.jsxs)(`div`,{className:`flex gap-1 px-3.5 pb-2 text-meta mono`,children:[(0,B.jsx)(`span`,{className:`text-accent`,children:`/`}),(0,B.jsx)(`span`,{children:h.search.query}),(0,B.jsx)(`span`,{className:`text-accent animate-blink motion-reduce:animate-none`,children:`█`}),(0,B.jsx)(`span`,{className:`ml-1.5 text-muted`,children:h.search.query?`${C(S).length}/${M}`:R(`rail.searchPlaceholder`)})]}),(0,B.jsx)(eC,{model:e}),(0,B.jsxs)(`div`,{"data-rail-body":!0,className:Nc(O.dragging!==null),...O.body,children:[r&&l.length===0&&i.length===0&&t&&(0,B.jsx)(GB,{model:e}),r&&l.length===0&&i.length===0&&!t&&(0,B.jsxs)(`div`,{className:`px-2.5 py-4 font-mono text-size-meta [&_p]:mx-0 [&_p]:mt-0 [&_p]:mb-1`,children:[(0,B.jsx)(`p`,{children:R(`rail.empty`)}),(0,B.jsx)(`p`,{className:`text-muted`,children:R(`rail.emptyHint`)})]}),I&&(0,B.jsx)(av,{title:I.title}),S.map((t,n)=>t.kind===`pane`?(0,B.jsx)(Wz,{model:e,row:t,guides:_C(S,n),cursor:t.id===j.cursor,place:k(t),onClick:()=>{j.setCursor(t.id),Uz(e,t),Vi()},onMenu:n=>{j.setCursor(t.id),KB(n,zz(e,t.task.id,t.tab,t.leaf))}},t.id):(0,B.jsx)(JB,{row:t,guides:t.kind===`task`&&t.depth>1?_C(S,n):void 0,cloud:Uc(t,a,w),tabs:t.kind===`task`?o[t.task.id]:void 0,selected:t.id===d,cursor:t.id===j.cursor,stale:t.machine!==void 0&&T.has(t.machine),collapsed:t.kind===`project`&&h.collapsed.has(t.id),drag:O.props(t),dragging:O.dragging===t.id,place:k(t),onNewTask:t.kind===`project`?t.noProject?eu:()=>$l(t.repo,t.machine):void 0,moving:_&&t.machine===void 0&&(t.kind===`project`?!t.noProject&&D(t.repo).mainTaskId===j.cursor:t.id===j.cursor&&(t.kind!==`task`||t.task.kind!==`main`)),prTasks:t.kind===`task`?[t.task,...(t.fold?.descendantIds??[]).flatMap(e=>m.get(e)??[])]:void 0,rollup:t.kind===`task`&&t.fold?.collapsed?__([t.task,...t.fold.descendantIds.flatMap(e=>m.get(e)??[])]):void 0,onToggleFold:()=>{t.kind===`task`&&h.toggleTaskFold(t.id,t.fold?.collapsed===!0),t.kind===`archived`&&h.toggleArchived()},onClick:()=>{j.setCursor(t.id),t.kind===`archived`&&h.toggleArchived(),t.kind===`project`&&h.toggleProject(t.id),t.kind===`task`&&(e.select(t.task.id),Vi())},onMenu:n=>{if(t.kind!==`project`||t.machine===void 0){if(t.kind===`project`&&t.noProject){KB(n,tB(e));return}if(t.kind===`project`){let r=D(t.repo);r.mainTaskId&&j.setCursor(r.mainTaskId),KB(n,eB(e,t.repo,r));return}t.kind===`task`&&(j.setCursor(t.id),KB(n,ZB(XB(rB(e,t.task,null),t.fold,()=>h.toggleTaskFold(t.id,t.fold?.collapsed===!0)),Hz(e,t.task.id))))}}},t.id))]}),!t&&(0,B.jsx)(rh,{client:e.client,taskId:c.taskId,tabId:c.tabId}),(0,B.jsxs)(`div`,{className:sm,children:[(0,B.jsxs)(`button`,{type:`button`,className:`rail-nav-row ${cm(!1)}`,onClick:A,children:[(0,B.jsxs)(`svg`,{className:um,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[(0,B.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,B.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`})]}),(0,B.jsx)(`span`,{children:R(`rail.settings`)}),f.length>0&&(0,B.jsx)(`span`,{className:`ml-1.5 size-1.5 flex-none rounded-full bg-accent`,role:`img`,title:p,"aria-label":p})]}),(0,B.jsx)(Uh,{model:e,bindingId:`settings.open`})]}),(0,B.jsx)(ov,{pane:`sidebar`}),!t&&!P&&(0,B.jsx)(ev,{rail:N})]})}function JB(e){let{row:t}=e,n=bB(t.kind===`task`?Pi(t.task,e.tabs):``,e.cursor&&t.kind===`task`),r=e.cursor?Pc:``;if(t.kind===`project`)return(0,B.jsxs)(`h2`,{className:Fc({moving:e.moving,dragging:e.dragging}),onContextMenu:e.onMenu,...e.place,...e.drag,children:[(0,B.jsxs)(`button`,{type:`button`,className:Lc,title:t.noProject?void 0:t.repo,"aria-expanded":!e.collapsed,onClick:e.onClick,children:[(0,B.jsx)(`span`,{className:`truncate`,children:t.label}),(0,B.jsx)(ta,{right:e.collapsed,className:Rc(!!e.collapsed)})]}),e.onNewTask&&(0,B.jsx)(`button`,{type:`button`,className:zc,title:R(`rail.newTask`),onClick:e.onNewTask,children:`+`})]});if(t.kind===`archived`)return(0,B.jsx)(`button`,{type:`button`,className:`${Sn({moving:e.moving||e.dragging})} ${r}`,"aria-expanded":t.expanded,onClick:e.onClick,...e.place,children:(0,B.jsx)(`span`,{className:`${wn} ${e.stale?`text-subtle`:`text-muted`}`,children:K(`tasks`,`archivedRow`,{count:t.count})})});let i=t.task,a=i.rowStatus?.kind===`running`;return(0,B.jsxs)(`button`,{type:`button`,ref:n.ref,className:`${Sn({selected:e.selected,moving:e.moving||e.dragging})} ${r}`,onClick:e.onClick,onContextMenu:e.onMenu,onPointerEnter:n.onPointerEnter,onPointerLeave:n.onPointerLeave,...e.place,...e.drag,children:[n.tip,e.guides&&(0,B.jsx)(`span`,{className:`-my-0.75 -mr-0.5 ml-0 flex flex-none self-stretch`,"aria-hidden":`true`,children:e.guides.map((e,t)=>(0,B.jsx)(`span`,{className:Tc(e)},t))}),(0,B.jsx)(`span`,{className:`${wn} ${e.stale?`text-subtle`:``} ${a?Tn:``}`,children:Pi(i,e.tabs)}),(0,B.jsxs)(`span`,{className:`${Dn} ml-auto items-center`,children:[t.level!==void 0&&(0,B.jsx)(`span`,{className:`text-subtle`,children:t.level}),(i.extraRepoCount??0)>0&&(0,B.jsxs)(`span`,{className:`text-subtle`,title:R(`rail.extraRepos`,{count:i.extraRepoCount??0}),children:[`+`,i.extraRepoCount]}),t.fold?.collapsed&&(0,B.jsx)(YB,{count:t.fold.count,onUnfold:e.onToggleFold}),i.pinned&&(0,B.jsx)(`span`,{className:`text-subtle`,children:`▴`}),(0,B.jsx)(sC,{tasks:e.prTasks??[i],onOpen:n.hide}),(0,B.jsx)(VB,{status:t.fold?.collapsed?e.rollup:i.rowStatus}),e.cloud&&(0,B.jsx)(Wc,{label:e.cloud})]})]})}function YB(e){let t=K(`tasks`,`menu.expandChildren`);return(0,B.jsxs)(`span`,{role:`button`,tabIndex:-1,"aria-label":t,"aria-expanded":!1,className:`chip text-muted ${Ec}`,title:t,onClick:t=>{t.stopPropagation(),e.onUnfold()},children:[e.count,(0,B.jsx)(ta,{right:!0})]})}function XB(e,t,n){if(!t)return e;let r={label:K(`tasks`,t.collapsed?`menu.expandChildren`:`menu.collapseChildren`),section:`open`,run:n},i=e.map(e=>e.section).lastIndexOf(`open`);return[...e.slice(0,i+1),r,...e.slice(i+1)]}function ZB(e,t){let n=e.map(e=>e.section).lastIndexOf(`open`);return[...e.slice(0,n+1),...t,...e.slice(n+1)]}function QB(e){return e===`localhost`||e.endsWith(`.localhost`)||e===`[::1]`||/^127(\.\d{1,3}){3}$/.test(e)}var $B=/^(localhost|127(\.\d{1,3}){3}|\[::1\])(:\d+)?([/?#]|$)/i,eV=/^[a-z][a-z0-9+.-]*:(?!\d+([/?#]|$))/i;function tV(e){let t=e.trim();if(!t||/\s/.test(t)||eV.test(t)&&!/^https?:\/\//i.test(t))return null;let n=/^https?:\/\//i.test(t)?t:$B.test(t)?`http://${t}`:`https://${t.replace(/^\/\//,``)}`;try{let e=new URL(n);return e.hostname?e.href:null}catch{return null}}function nV(e,t,n=QB(t.hostname)){let r=new URL(e);return r.origin===t.origin?`self`:QB(r.hostname)?n?`yes`:`remote`:r.protocol===`https:`?`yes`:`unreachable`}function rV(e,t,n){let r=new URL(e).host;return t===`self`?{key:`self`,host:r}:t===`remote`?{key:`remote`,host:r}:t===`unreachable`?{key:`noFrame`,host:r}:n&&!n.reachable?{key:`unreachable`,host:r}:n&&!n.frameable?{key:`refuses`,host:r}:null}var iV=6e4,aV=new Map;function oV(e){let t=aV.get(e);return t&&Date.now()-t.at<iV?t:null}function sV(e,t,n){let[,r]=(0,g.useState)(0);(0,g.useEffect)(()=>{if(!n||oV(t))return;let i=!0;return e.request(`browser.probe`,{url:t,origin:window.location.origin}).then(e=>aV.set(t,{probe:e,at:Date.now()}),()=>aV.set(t,{probe:null,at:Date.now()})).then(()=>i&&r(e=>e+1)),()=>{i=!1}},[e,t,n]);let i=n?oV(t):null;return{pending:n&&!i,probe:i?.probe??null}}function cV({d:e}){return(0,B.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,B.jsx)(`path`,{d:e})})}var lV=`M6.5 3.5h-3v9h9v-3M9.5 3.5h3v3M12.5 3.5l-5 5`;function uV({model:e,tab:t,onNavigate:n,onStep:r}){z();let i=mg(t),[a,o]=(0,g.useState)(i),[s,c]=(0,g.useState)(!1),[l,u]=(0,g.useState)(0),d=v(e.client.conn).hello?.peer?.local,f=i?nV(i,window.location,d):null;(0,g.useEffect)(()=>{o(i),c(!1)},[i]);let p=e=>{let t=tV(e);c(t===null&&e.trim()!==``),t!==null&&(o(t),t===i?u(l+1):n(t))},m=i?new URL(i).hostname:``,h=f===`yes`&&i.startsWith(`https:`)&&!QB(m),{pending:_,probe:y}=sV(e.client,i,h),b=i&&f?rV(i,f,y):null,x=f===`yes`&&!b&&!_,S=b?R(`browser.${b.key}`,{host:b.host}):f===null?R(s?`browser.invalid`:`browser.empty`):null;return(0,B.jsxs)(`div`,{className:J_,children:[(0,B.jsxs)(`form`,{className:Y_,onSubmit:e=>{e.preventDefault(),p(a)},children:[(0,B.jsx)(`button`,{type:`button`,className:N_({small:!0}),disabled:t.at<=0,title:R(`browser.back`),"aria-label":R(`browser.back`),onClick:()=>r(t.at-1),children:(0,B.jsx)(cV,{d:`M10 3.5 5.5 8l4.5 4.5`})}),(0,B.jsx)(`button`,{type:`button`,className:N_({small:!0}),disabled:t.at>=t.urls.length-1,title:R(`browser.forward`),"aria-label":R(`browser.forward`),onClick:()=>r(t.at+1),children:(0,B.jsx)(cV,{d:`M6 3.5 10.5 8 6 12.5`})}),(0,B.jsx)(`button`,{type:`button`,className:N_({small:!0}),disabled:!x,title:R(`browser.reload`),"aria-label":R(`browser.reload`),onClick:()=>u(l+1),children:(0,B.jsx)(cV,{d:`M12.5 8a4.5 4.5 0 1 1-1.4-3.3M12.5 2.5v2.7H9.8`})}),(0,B.jsx)(`input`,{className:`browser-url mono ${X_}`,value:a,placeholder:R(`browser.placeholder`),"aria-label":R(`browser.address`),"aria-invalid":s,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,inputMode:`url`,onChange:e=>o(e.target.value)}),i?(0,B.jsx)(`a`,{className:N_({small:!0}),href:i,target:`_blank`,rel:`noopener noreferrer`,title:R(`browser.openTab`),"aria-label":R(`browser.openTab`),children:(0,B.jsx)(cV,{d:lV})}):(0,B.jsx)(`button`,{type:`button`,className:N_({small:!0}),disabled:!0,"aria-label":R(`browser.openTab`),children:(0,B.jsx)(cV,{d:lV})})]}),x?(0,B.jsx)(`iframe`,{className:Z_,src:i,title:i,sandbox:`allow-scripts allow-same-origin allow-forms allow-popups`,referrerPolicy:`no-referrer`},`${i}#${l}`):S?(0,B.jsx)(`p`,{className:q_,children:S}):null]})}function dV(e,t){let n={children:new Map,file:!1};for(let t of e){let e=n;for(let n of t.split(`/`)){let t=e.children.get(n);t||(t={children:new Map,file:!1},e.children.set(n,t)),e=t}e.file=!0}let r=[],i=(e,n,a)=>{let o=[...e.children].sort(([e,t],[n,r])=>{let i=t.children.size>0&&!t.file;return i===(r.children.size>0&&!r.file)?e.localeCompare(n):i?-1:1});for(let[e,s]of o){let o=s.children.size>0&&!s.file,c=o?`${n}${e}/`:`${n}${e}`,l=o&&t.has(c);r.push({path:c,name:e,depth:a,dir:o,open:l}),l&&i(s,c,a+1)}};return i(n,``,0),r}function fV({tone:e,children:t}){return(0,B.jsx)(`span`,{className:oe(`flex-none font-mono text-meta`,e&&sc[e]),children:t})}function pV({tabs:e,value:t,onChange:n,className:r}){return(0,B.jsx)(`div`,{className:oe(`flex gap-1`,r),role:`tablist`,children:e.map(e=>{let r=e.id===t;return(0,B.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":r,className:oe(`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)})})}var mV={M:`text-warning`,A:`text-success`,"?":`text-success`,D:`text-error`,R:`text-accent`};function hV({model:e,task:t,narrow:n=!1}){let r=So();z();let[i,a]=(0,g.useState)(`all`),[o,s]=(0,g.useState)(`working`),[c,l]=(0,g.useState)(()=>cs(e,`files.list`,{taskId:t.id})?.files??null),[u,d]=(0,g.useState)(()=>cs(e,`diff.files`,{taskId:t.id})??null),[f,p]=(0,g.useState)(null),[m,h]=(0,g.useState)(new Set),[_,y]=(0,g.useState)(0),[b,x]=(0,g.useState)(0),S=(0,g.useRef)(null),C=v(Ft),w=JSON.stringify(t.changes??null);(0,g.useEffect)(()=>{let n=!0,r=e=>n&&p(e instanceof Error?e.message:String(e));return us(e,`files.list`,{taskId:t.id}).then(e=>{n&&(l(e.files),p(null))},r),us(e,`diff.files`,{taskId:t.id}).then(e=>n&&d(e),r),()=>{n=!1}},[e,t.id,w,b]);let T=u?.base??null,E=i===`all`?c!==null:u!==null,D=o===`branch`&&T!=null,O=i===`all`?dV(c??[],m).map(e=>({path:e.path,label:e.name,depth:e.depth,dir:e.dir,open:e.open})):(u?.files??[]).filter(e=>e.scope===(D?`branch`:`working`)).map(e=>({path:e.path,label:e.path,depth:0,dir:!1,open:!1,status:e.status,added:e.added,deleted:e.deleted})),k=Math.min(_,Math.max(0,O.length-1)),A=O[k],j=(e,t)=>h(n=>{let r=new Set(n);return t??!r.has(e)?r.add(e):r.delete(e),r}),M=e=>c_({taskId:t.id,path:e,scope:i===`changes`&&D?`branch`:`working`}),N=n=>{if(!C?.startsWith(`${t.id}::`)){G(R(`files.mentionNoEngine`),`error`);return}e.client.request(`term.input`,{stream:C,data:`@${n} `}).catch(e=>G(String(e),`error`))},P=n=>t.machine?G(R(`files.remoteNoExternal`,{host:t.machine.label}),`error`):void e.client.request(`file.openExternal`,{taskId:t.id,path:n}).then(()=>G(R(`taskops.openedExternal`))).catch(e=>G(e instanceof Error?e.message:String(e),`error`));return(0,B.jsxs)(`div`,{className:`group/pane flex min-h-0 min-w-0 flex-1 flex-col outline-none ${n?`px-1.5 pt-2.5 pb-2`:`pt-0.5 pr-1.5 pb-1.5 pl-0`}`,tabIndex:0,ref:S,onKeyDown:e=>{let t=e.key;if(t===`j`||t===`ArrowDown`)y(Math.min(O.length-1,k+1));else if(t===`k`||t===`ArrowUp`)y(Math.max(0,k-1));else if((t===`l`||t===`ArrowRight`)&&A?.dir)j(A.path,!0);else if((t===`h`||t===`ArrowLeft`)&&A?.dir)j(A.path,!1);else if(t===`[`||t===`]`)a(i===`all`?`changes`:`all`);else if(t===`b`&&i===`changes`&&T!=null)s(o===`working`?`branch`:`working`);else if(t===`r`)x(e=>e+1);else if(t===`D`&&e.shiftKey)M(`.`);else if(t===`d`&&A)M(A.path);else if(t===`Enter`&&A)A.dir?j(A.path):M(A.path);else if(t===`a`&&A)N(A.path);else if(t===`o`&&A&&!A.dir)P(A.path);else return;e.preventDefault()},children:[(0,B.jsx)(`div`,{className:`flex justify-end gap-3.5 px-2 pb-2 font-mono text-meta`,children:(0,B.jsx)(ue,{onClick:()=>void e.client.request(`tab.requestPR`,e.engineTarget(t.id)).then(()=>G(R(`files.prRequested`))).catch(e=>G(e instanceof Error?e.message:String(e),`error`)),children:R(`files.createPR`)})}),(0,B.jsx)(pV,{className:`px-1 pb-1.5`,tabs:[{id:`all`,label:R(`files.all`)},{id:`changes`,label:R(`files.changes`)}],value:i,onChange:e=>{a(e),y(0)}}),i===`changes`&&(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-x-2.5 gap-y-1 px-2 pb-2 font-mono text-meta text-muted`,children:[(0,B.jsx)(`span`,{children:D?R(`files.scopeBranch`,{base:T??``}):R(`files.scopeWorking`)}),T==null?u&&(0,B.jsx)(`span`,{children:R(`files.noBase`)}):(0,B.jsx)(ue,{hit:`tight`,onClick:()=>s(o===`working`?`branch`:`working`),children:R(r?`files.toggleScopeTouch`:`files.toggleScope`)}),(0,B.jsx)(oc,{text:R(`files.legend`)}),(0,B.jsx)(ue,{hit:`tight`,onClick:()=>M(`.`),children:R(r?`files.diffAllTouch`:`files.diffAll`)})]}),(0,B.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[f&&(0,B.jsx)(`p`,{className:`mono text-error`,children:f}),!f&&E&&O.length===0&&(0,B.jsx)(`p`,{className:`mx-2.5 my-3 font-mono text-meta text-subtle`,children:R(i===`all`?`files.emptyAll`:`files.emptyChanges`)}),O.map((e,t)=>(0,B.jsxs)(`button`,{type:`button`,className:Sn({selected:t===k,size:n?`file-narrow`:`file`}),style:{paddingLeft:8+e.depth*14},title:e.path,onClick:()=>{y(t),S.current?.focus(),e.dir?j(e.path):M(e.path)},children:[e.status?(0,B.jsx)(`span`,{className:`${En} ${mV[e.status]??``}`,children:e.status}):(0,B.jsx)(`span`,{className:`${En} grid place-items-center text-subtle`,children:e.dir?(0,B.jsx)(ta,{right:!e.open}):null}),(0,B.jsx)(`span`,{className:Cn,children:e.label}),e.added?(0,B.jsxs)(fV,{tone:`added`,children:[`+`,e.added]}):null,e.deleted?(0,B.jsxs)(fV,{tone:`removed`,children:[`−`,e.deleted]}):null]},e.path))]})]})}function gV({children:e}){return(0,B.jsx)(`svg`,{className:`size-3.5 ${M_}`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:e})}var _V={files:(0,B.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,B.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,B.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`})};function vV(e){if(e.kind===`files`)return R(`panel.files`);if(e.kind===`diff`)return e.path===`.`?R(`panel.diff`):hg(e.path);let t=mg(e);return t?gg(t):R(`panel.browser`)}function yV(e){return e.kind===`diff`?e.path===`.`?R(`preview.whole`):e.path:e.kind===`browser`&&mg(e)||vV(e)}var bV=7.3,xV=51,SV=160;function CV(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(SV,xV+e*bV)+2}return n<=t}var wV=null;function TV(e,t,n,r){let i=(t,r)=>({label:r,section:`move`,run:()=>a_(e,e=>Lg(e,n.id,t))}),a=[];return!t.bottom&&t.top.tabs.length>1?a.push(i(`bottom`,R(`panel.splitDown`))):t.bottom&&a.push(r===`top`?i(`bottom`,R(`panel.moveBottom`)):i(`top`,R(`panel.moveTop`))),a.push({label:R(`panel.close`),section:`close`,run:()=>l_(e,n.id)}),t.top.tabs.length+(t.bottom?.tabs.length??0)>1&&a.push({label:R(`panel.closeOthers`),section:`close`,run:()=>a_(e,e=>Ig(e,n.id))}),a}function EV(e,t){return[{label:R(`panel.newFiles`),run:()=>a_(e,e=>Tg(e,t))},{label:R(`panel.newDiff`),run:()=>a_(e,e=>Dg(e,`.`,`working`))},{label:R(`panel.newBrowser`),run:()=>a_(e,e=>Eg(e,t))}]}function DV({taskId:e,panel:t,group:n,tabs:r,active:i,narrow:a,children:o}){z();let[s,c]=(0,g.useState)(null),l=()=>wV?.taskId===e,u=t=>{let r=wV;wV=null,c(null),r?.taskId===e&&a_(e,e=>Lg(e,r.id,n,t))},d=t=>{let r=t.currentTarget.getBoundingClientRect();At.set({x:r.left,y:r.bottom+2,items:EV(e,n),target:t.currentTarget})},f=(e,t)=>{if(!l())return;e.preventDefault(),e.stopPropagation();let n=e.currentTarget.getBoundingClientRect();c({id:t,after:e.clientX>n.left+n.width/2})},p=(0,g.useRef)(null),[m,h]=(0,g.useState)(0);(0,g.useEffect)(()=>{let e=p.current;if(!e)return;let t=new ResizeObserver(([e])=>h(e?.contentRect.width??0));return t.observe(e),()=>t.disconnect()},[]);let _=m>0&&!CV(r.map(vV),m);return(0,g.useEffect)(()=>{p.current?.querySelector(`.is-active`)?.scrollIntoView({block:`nearest`,inline:`nearest`})},[i,r.length,_]),(0,B.jsxs)(`div`,{className:R_(a),style:{gridRow:n===`top`?1:4},onDragOver:e=>{l()&&(e.preventDefault(),c(null))},onDrop:e=>{e.preventDefault(),u()},children:[(0,B.jsx)(`div`,{className:z_,role:`tablist`,"aria-label":R(`panel.tabs`),ref:p,children:r.map((r,o)=>(0,B.jsxs)(`div`,{role:`presentation`,className:B_({active:r.id===i,compact:_}),"data-drop":s?.id===r.id?s.after?`after`:`before`:void 0,draggable:!a,onDragStart:()=>{wV={taskId:e,id:r.id}},onDragEnd:()=>{wV=null,c(null)},onDragOver:e=>f(e,r.id),onDrop:e=>{e.preventDefault(),e.stopPropagation(),u(o+(s?.id===r.id&&s.after?1:0))},onMouseDown:e=>{e.button===1&&e.preventDefault()},onAuxClick:t=>{t.button===1&&(t.preventDefault(),l_(e,r.id))},onContextMenu:i=>{a||KB(i,TV(e,t,r,n))},children:[(0,B.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":r.id===i,className:V_(_&&r.id!==i),title:yV(r),onClick:()=>a_(e,e=>xg(e,r.id)),children:[(0,B.jsx)(gV,{children:_V[r.kind]}),(0,B.jsx)(`span`,{className:`${H_} ${_&&r.id!==i?`hidden`:``}`,children:vV(r)})]}),(0,B.jsx)(`button`,{type:`button`,className:`${U_} ${_&&r.id!==i?`hidden`:``}`,"aria-label":R(`panel.close`),tabIndex:-1,onClick:()=>l_(e,r.id),children:`×`})]},r.id))}),!a&&(0,B.jsx)(`button`,{type:`button`,className:N_({tool:!0}),title:R(`panel.new`),"aria-label":R(`panel.new`),onClick:d,children:(0,B.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,B.jsx)(`path`,{d:`M8 3.5v9M3.5 8h9`})})}),o]})}var OV=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/;function kV(e,t=null){let n=[],r=0,i=0,a=t,o=!1;for(let t of e.replace(/\n$/,``).split(`
|
|
121
|
-
`)){if(t.startsWith(`diff --git `)){let e=/ b\/(.+)$/.exec(t);a=e?e[1]:a,o=!1,n.push({kind:`file`,text:a??t,oldNo:null,newNo:null,path:a});continue}let e=OV.exec(t);if(e){r=Number(e[1]),i=Number(e[2]),o=!0,n.push({kind:`hunk`,text:t,oldNo:null,newNo:null,path:a});continue}if(!o){n.push({kind:`meta`,text:t,oldNo:null,newNo:null,path:a});continue}t.startsWith(`+`)?n.push({kind:`add`,text:t.slice(1),oldNo:null,newNo:i++,path:a}):t.startsWith(`-`)?n.push({kind:`del`,text:t.slice(1),oldNo:r++,newNo:null,path:a}):t.startsWith(`\\`)?n.push({kind:`meta`,text:t,oldNo:null,newNo:null,path:a}):n.push({kind:`ctx`,text:t.slice(1),oldNo:r++,newNo:i++,path:a})}return n}function AV(e,t){return e.replace(/\n$/,``).split(`
|
|
122
|
-
`).map((e,n)=>({kind:`ctx`,text:e,oldNo:null,newNo:n+1,path:t}))}function jV(e){return e.kind===`del`?e.oldNo:e.kind===`add`||e.kind===`ctx`?e.newNo:null}function MV(e){let t=e.startLine?`lines ${e.startLine}-${e.line}`:`line ${e.line}`;return`@${e.path} (${t}) `}function NV(e,t,n){let r=e[t],i=r?jV(r):null;if(!r?.path||i===null)return null;if(n===null||n===t)return{path:r.path,line:i};let a=e[Math.min(n,t)],o=e[Math.max(n,t)],s=a?jV(a):null,c=o?jV(o):null;return s===null||c===null||a?.path!==o?.path?{path:r.path,line:i}:s===c?{path:r.path,line:c}:{path:r.path,startLine:Math.min(s,c),line:Math.max(s,c)}}var PV={add:`bg-diff-added-bg`,del:`bg-diff-removed-bg`},FV={add:`text-diff-added`,del:`text-diff-removed`};function IV(e,t){return`relative grid cursor-default grid-cols-[4ch_4ch_2ch_1fr] gap-x-2 gap-y-0 whitespace-pre px-3 narrow:grid-cols-[3ch_3ch_1ch_1fr] narrow:gap-x-1 narrow:px-1.5 ${t.cursor?`bg-inset group-focus/preview:bg-accent-soft`:t.noted?`bg-inset`:PV[e]??``} ${e===`file`?`mt-2 border-t-hairline border-line pt-1 font-bold text-ink`:e===`hunk`||e===`meta`?`text-subtle`:``}`}var LV=`text-right text-subtle`,RV=(e,t)=>t?`text-accent`:FV[e]??``,zV=e=>`min-w-0 narrow:whitespace-pre-wrap narrow:wrap-anywhere ${FV[e]??``}`;function BV(e,t){if(!e||typeof e!=`object`||!(`kind`in e))return{kind:`text`,text:R(`preview.unknown`)};let n=`text`in e&&typeof e.text==`string`?e.text:``;switch(e.kind){case`diff`:return{kind:`rows`,rows:kV(n,t===`.`?null:t),diff:!0};case`code`:return{kind:`rows`,rows:AV(n,t),diff:!1};case`binary`:return{kind:`text`,text:R(`preview.binary`)};case`empty`:return{kind:`text`,text:R(`preview.empty`)};case`error`:return{kind:`text`,text:`message`in e?String(e.message):R(`preview.unknown`),error:!0};default:return{kind:`text`,text:R(`preview.noHunks`,{kind:String(e.kind)})}}}function VV(e,t){let n=jV(t);return n!==null&&e.filePath===t.path&&n>=(e.startLine??e.line)&&n<=e.line}function HV({model:e,view:t,active:n,restored:r,onClose:i}){z();let a={taskId:t.taskId,path:t.path,scope:t.scope},[o,s]=(0,g.useState)(()=>{let n=cs(e,`diff.file`,a);return n===void 0?null:BV(n,t.path)}),[c,l]=(0,g.useState)(()=>cs(e,`review.list`,{taskId:t.taskId})?.notes??[]),[u,d]=(0,g.useState)(0),[f,p]=(0,g.useState)(null),[m,h]=(0,g.useState)(0),_=(0,g.useRef)(null),y=e.client;(0,g.useEffect)(()=>{let e=!0;return us(y,`diff.file`,a).then(n=>e&&s(BV(n,t.path)),t=>e&&s({kind:`text`,text:t instanceof Error?t.message:String(t),error:!0})),()=>{e=!1}},[y,t.taskId,t.path,t.scope,m]);let b=()=>void us(y,`review.list`,{taskId:t.taskId}).then(e=>l(e.notes));(0,g.useEffect)(b,[y,t.taskId,m]);let x=(0,g.useRef)(!1);(0,g.useEffect)(()=>{n&&(x.current||!r)&&_.current?.focus(),x.current=!0},[n,r]);let S=o?.kind===`rows`?o.rows:[],C=S.map((e,t)=>`row-${t}`);(0,g.useEffect)(()=>{_.current?.querySelector(`[data-row="${u}"]`)?.scrollIntoView({block:`nearest`})},[u]);let w=()=>{let e=NV(S,u,f);if(!e)return;let n=e.startLine?`${e.path}:${e.startLine}-${e.line}`:`${e.path}:${e.line}`;W.set((0,B.jsx)(jn,{title:R(`preview.noteTitle`,{location:n}),submitLabel:R(`preview.noteSubmit`),onSubmit:async n=>{await y.request(`review.add`,{taskId:t.taskId,filePath:e.path,line:e.line,...e.startLine?{startLine:e.startLine}:{},body:n}),p(null),b(),_.current?.focus()}}))},T=v(Ft),E=()=>{let e=NV(S,u,f);if(e){if(!T?.startsWith(`${t.taskId}::`)){G(R(`files.mentionNoEngine`),`error`);return}y.request(`term.input`,{stream:T,data:MV(e)}).then(()=>{p(null),wC(T)?.focus()}).catch(e=>G(e instanceof Error?e.message:String(e),`error`))}},D=()=>{let e=S[u],n=e&&c.find(t=>VV(t,e));n&&y.request(`review.remove`,{taskId:t.taskId,id:n.id}).then(b)},O=()=>void y.request(`review.send`,e.engineTarget(t.taskId)).then(e=>{G(e.delivered?R(`preview.sent`,{count:e.sent}):R(`preview.notSent`,{reason:e.reason??``}),e.delivered?`info`:`error`),b()}).catch(e=>G(e instanceof Error?e.message:String(e),`error`)),k=e=>{let t=e.key;if(t===`j`||t===`ArrowDown`)d(e=>Math.min(S.length-1,e+1));else if(t===`k`||t===`ArrowUp`)d(e=>Math.max(0,e-1));else if(t===`v`)p(e=>e===null?u:null);else if(t===`c`&&!e.ctrlKey)w();else if(t===`x`)D();else if(t===`s`)O();else if(t===`r`)h(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()},A=()=>{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||(p(Number(n.dataset.row)),d(Number(r.dataset.row)))},j=f===null?u:Math.min(f,u),M=f===null?u:Math.max(f,u);return(0,B.jsx)(`div`,{className:`group/preview flex min-w-0 flex-1 flex-col outline-none`,tabIndex:0,ref:_,onKeyDown:k,children:(0,B.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto py-1.5 font-mono text-meta/normal`,onMouseUp:A,children:[!o&&(0,B.jsx)(`p`,{className:`mx-2.5 my-3 font-mono text-meta text-subtle`,children:R(`preview.loading`)}),o?.kind===`text`&&(0,B.jsx)(`p`,{className:`mx-2.5 my-3 font-mono text-meta text-subtle ${o.error?`text-error`:``}`,children:o.text}),S.map((e,t)=>{let n=c.some(t=>VV(t,e));return(0,B.jsxs)(`div`,{"data-row":t,className:IV(e.kind,{cursor:t>=j&&t<=M,noted:n}),onClick:e=>{window.getSelection()?.isCollapsed!==!1&&(e.shiftKey?p(e=>e??u):p(null),d(t))},children:[(0,B.jsx)(`span`,{className:LV,children:e.oldNo??``}),(0,B.jsx)(`span`,{className:LV,children:e.newNo??``}),(0,B.jsx)(`span`,{className:RV(e.kind,n),children:e.kind===`add`?`+`:e.kind===`del`?`−`:n?`●`:` `}),(0,B.jsx)(`span`,{className:zV(e.kind),children:e.text}),f!==null&&t===M&&(0,B.jsx)(ue,{variant:`floating`,className:`absolute top-full right-3 z-1`,title:R(`preview.askInChatHint`),onMouseDown:e=>e.preventDefault(),onClick:e=>{e.stopPropagation(),E()},children:R(`preview.askInChat`)})]},C[t])})]})})}function UV(){z();let e=v(pa),t=R(e?`panel.restore`:`panel.expand`);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`button`,{type:`button`,className:N_({tool:!0}),title:t,"aria-label":t,"aria-pressed":e,onClick:()=>pa.set(!e),children:(0,B.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,B.jsx)(`path`,{d:e?`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,B.jsx)(`button`,{type:`button`,className:N_({tool:!0}),title:R(`panel.hide`),"aria-label":R(`panel.hide`),onClick:()=>fa.set(!1),children:(0,B.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,B.jsx)(`path`,{d:`M4 4l8 8M12 4l-8 8`})})})]})}function WV({panel:e}){z();let t=(0,g.useRef)(null);return(0,B.jsx)(Q_,{edge:`left`,title:R(`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),Jt(!0)},onPointerMove:e=>{let n=t.current;if(!n||e.clientX===n.x)return;let r=D_.get()?0:j_(E_.get()??280);da.set(ma(n.width-(e.clientX-n.x),r))},onLostPointerCapture:()=>{t.current=null,e.current?.classList.remove(`is-resizing`),Jt(!1)},onDoubleClick:()=>da.set(null)})}function GV({taskId:e,body:t}){z();let n=(0,g.useRef)(!1);return(0,B.jsx)(`div`,{className:G_,title:R(`panel.resizeSplit`),onPointerDown:e=>{n.current=!0,t.current?.classList.add(`is-resizing`),e.currentTarget.setPointerCapture(e.pointerId)},onPointerMove:r=>{let i=t.current?.getBoundingClientRect(),a=t.current?.querySelectorAll(`.side-head`);if(!n.current||!i||a?.length!==2)return;let o=a[0]?.getBoundingClientRect(),s=a[1]?.getBoundingClientRect();if(!o||!s)return;let c=r.currentTarget.getBoundingClientRect().height,l=i.bottom-o.bottom-s.height-c;l>0&&a_(e,e=>Rg(e,(r.clientY-o.bottom-c/2)/l))},onLostPointerCapture:()=>{n.current=!1,t.current?.classList.remove(`is-resizing`)},onDoubleClick:()=>a_(e,e=>Rg(e,.5))})}function KV({model:e,task:t,tab:n,narrow:r,active:i,restored:a}){return n.kind===`files`?(0,B.jsx)(hV,{model:e,task:t,narrow:r}):n.kind===`diff`?(0,B.jsx)(HV,{model:e,view:{taskId:t.id,path:n.path,scope:n.scope},active:i,restored:a,onClose:()=>l_(t.id,n.id)},`${t.id}:${n.path}:${n.scope}`):(0,B.jsx)(uV,{model:e,tab:n,onNavigate:e=>a_(t.id,t=>Ng(t,n.id,e)),onStep:e=>a_(t.id,t=>Pg(t,n.id,e))})}function qV({model:e,task:t,narrow:n}){z();let r=i_(t.id),i=v(ca),a=v(pa),o=(0,g.useRef)(null),s=(0,g.useRef)(null),c=i===`terminal`?`files`:i,l=dg(r),u=n?pg(r,c):null;(0,g.useEffect)(()=>{n&&!u&&a_(t.id,e=>kg(e,c))},[n,u,c,t.id]);let d=n?u?[u.id]:[]:ug(r).flatMap(([,e])=>e.active?[e.active]:[]),f=(0,g.useRef)([]);f.current=zg(f.current,d,l);let p=(0,g.useRef)(new Set(d)),m=!n&&r.bottom!==null,h=m?`auto minmax(0, ${r.ratio*100}fr) var(--divider) auto minmax(0, ${(1-r.ratio)*100}fr)`:`auto minmax(0, 1fr)`,_=l.filter(e=>e.kind===c),y=!n&&r.top.tabs.length===0;return(0,B.jsxs)(`aside`,{className:I_(n),ref:o,children:[!n&&!a&&(0,B.jsx)(WV,{panel:o}),(0,B.jsxs)(`div`,{className:L_,ref:s,style:{gridTemplateRows:h},children:[n?(_.length>1||c===`diff`)&&(0,B.jsx)(DV,{taskId:t.id,panel:r,group:`top`,tabs:_,active:u?.id??null,narrow:!0}):ug(r).map(([e,n])=>(0,B.jsx)(DV,{taskId:t.id,panel:r,group:e,tabs:n.tabs,active:n.active,narrow:!1,children:e===`top`&&(0,B.jsx)(UV,{})},e)),y&&(0,B.jsx)(`p`,{className:`row-2 m-auto flex max-w-[44ch] flex-col items-center gap-2.5 p-4 text-center font-mono text-meta leading-[1.5] text-subtle normal-nums`,children:R(`panel.empty`)}),m&&(0,B.jsx)(GV,{taskId:t.id,body:s}),l.filter(e=>f.current.includes(e.id)).map(i=>(0,B.jsx)(`div`,{className:K_,hidden:!d.includes(i.id),style:{gridRow:fg(r,i.id)?.name===`bottom`&&!n?5:2},children:(0,B.jsx)(KV,{model:e,task:t,tab:i,narrow:n,active:d.includes(i.id),restored:p.current.has(i.id)})},i.id))]})]})}function JV({model:e,task:t,remoteHost:n,narrow:r=!1}){let i=v(It),a=v(fa);return!r&&(i||!a)?null:t?(0,B.jsx)(qV,{model:e,task:t,narrow:r},t.id):n?(0,B.jsx)(`aside`,{className:I_(!1),children:(0,B.jsx)(Gc,{host:n})}):null}function YV({model:e}){let t=e.client,n=v(t.conn);return n.state===`open`?null:(0,B.jsxs)(`footer`,{className:ut,children:[(0,B.jsx)(`span`,{className:dt(n.state===`retrying`)}),(0,B.jsx)(`span`,{children:n.state===`retrying`?R(`status.retrying`,{count:n.failures}):R(`status.connecting`)}),n.state===`retrying`&&(0,B.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>t.retryNow(),children:R(`status.retry`)})]})}var XV=new Set,ZV=2e3;function QV(e){XV.add(e)}function $V(e,t=ZV){setTimeout(()=>XV.delete(e),t)}var eH=e=>XV.has(e),tH=3e3,nH=32;function rH(e){let{model:t,taskId:n,tabId:r,revision:i}=e,[a,o]=(0,g.useState)([]),[s,c]=(0,g.useState)(0);if((0,g.useEffect)(()=>{let e=!0,i=()=>t.client.request(`queue.list`,{taskId:n}).then(t=>e&&o(t.items.filter(e=>e.tabId===r)),()=>e&&o([]));i();let a=window.setInterval(i,tH);return()=>{e=!1,window.clearInterval(a)}},[t,n,r,i,s]),a.length===0)return null;let l=e=>void t.client.request(`queue.cancel`,{id:e}).finally(()=>c(e=>e+1));return(0,B.jsx)(`div`,{className:Zt,"data-field":`queued`,children:a.map(e=>(0,B.jsxs)(`span`,{className:Qt(!1),title:e.text,children:[`${R(`layout.queuedChip`)} · ${e.text.length>nH?`${e.text.slice(0,nH)}…`:e.text} `,(0,B.jsx)(ue,{hit:`tight`,"aria-label":R(`layout.queueCancel`),title:R(`layout.queueCancel`),onClick:()=>l(e.id),children:`×`})]},e.id))})}var iH=`relative hidden [border-top:var(--hairline)_solid_var(--line)] bg-surface px-1.5 py-1.5 touch:flex`,aH=`absolute inset-x-1.5 bottom-full z-5 mb-1`,oH=`flex min-w-0 flex-1 items-stretch gap-1.5`,sH=`h-10 min-w-0 flex-1 resize-none rounded-[6px] border-hairline border-line bg-inset px-2 py-2 font-sans text-[16px] leading-[1.35] text-ink outline-none focus:border-focus disabled:opacity-60`,cH=`h-10 shrink-0 rounded-[6px] bg-accent px-3.5 font-sans text-meta font-semibold text-paper touch-manipulation active:scale-97 motion-reduce:active:scale-none disabled:opacity-50`,lH=`flex h-10 w-10 shrink-0 cursor-pointer items-center justify-center rounded-[6px] border-hairline border-line bg-inset text-muted touch-manipulation has-[:disabled]:opacity-60`;function uH(){return(0,B.jsx)(`svg`,{viewBox:`0 0 16 16`,className:`size-4 fill-none stroke-current stroke-[1.4]`,"aria-hidden":`true`,children:(0,B.jsx)(`path`,{d:`M10.5 4.5 5.8 9.2a1.4 1.4 0 0 0 2 2l5-5a2.8 2.8 0 0 0-4-4l-5.2 5.2a4.2 4.2 0 0 0 6 6L13 9`})})}function dH(e){return(0,B.jsxs)(`form`,{className:iH,onSubmit:t=>{t.preventDefault(),e.onSend()},children:[e.attached&&(0,B.jsx)(`div`,{className:aH,children:e.attached}),(0,B.jsxs)(`div`,{className:oH,children:[e.attach,(0,B.jsx)(`textarea`,{className:sH,rows:1,value:e.value,placeholder:e.placeholder,disabled:e.busy,enterKeyHint:`send`,onChange:t=>e.onChange(t.target.value),onPaste:e.onPaste}),(0,B.jsx)(`button`,{type:`submit`,className:cH,disabled:e.busy||!e.ready,children:e.sendLabel})]})]})}var fH=new Map;function pH({model:e,taskId:t,tabId:n}){let r=v(e.tasks)?.tasks.some(e=>e.id===t)??!1,i=`${t}/${n}`,[a,o]=(0,g.useState)(()=>fH.get(i)??``),[s,c]=(0,g.useState)(!1),[l,u]=(0,g.useState)(0),{attachments:d,attach:f,remove:p,clear:m}=yo(e,e=>G(e,`error`)),h=e=>{fH.set(i,e),o(e)},_=async()=>{let r=_o(a.trim(),d).trim();if(r){c(!0);try{let a=await e.client.request(`tab.send`,{taskId:t,tabId:n,prompt:r,queue:!0});if(!a.delivered&&!a.queued){G(R(`layout.composerNotSent`,{reason:a.reason??``}),`error`);return}a.queued&&(G(R(`layout.composerQueued`,{position:a.position??1})),u(e=>e+1)),fH.delete(i),o(``),m()}catch(e){let t=e instanceof _l?e.code:void 0;G(t===`UNKNOWN_OP`?R(`layout.composerOldBridge`):t===`AWAITING_PERMISSION`?R(`layout.composerAtMenu`):e instanceof Error?e.message:String(e),`error`)}finally{c(!1)}}};if(!r)return null;let y=e=>void f(e);return(0,B.jsx)(dH,{value:a,placeholder:R(`layout.composerPlaceholder`),sendLabel:R(`layout.composerSend`),busy:s,ready:a.trim()!==``||d.length>0,attached:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(rH,{model:e,taskId:t,tabId:n,revision:l}),(0,B.jsx)(bo,{attachments:d,onRemove:p})]}),attach:(0,B.jsxs)(go,{className:lH,title:R(`layout.composerAttach`),disabled:s,onFiles:y,children:[(0,B.jsx)(`span`,{className:`sr-only`,children:R(`layout.composerAttach`)}),(0,B.jsx)(uH,{})]}),onChange:h,onPaste:ho(y).onPaste,onSend:()=>void _()})}var mH={up:`layout.termKeyUp`,down:`layout.termKeyDown`,left:`layout.termKeyLeft`,right:`layout.termKeyRight`,interrupt:`layout.termKeyInterrupt`,enter:`layout.termKeyEnter`};function hH({handle:e,atMenu:t}){z();let[n,r]=(0,g.useState)(!1);(0,g.useEffect)(()=>{e.armCtrl(n?()=>r(!1):null)},[e,n]),(0,g.useEffect)(()=>()=>e.armCtrl(null),[e]);let{term:i}=e,a=e=>(0,B.jsx)(`button`,{type:`button`,className:Ne(!1),"aria-label":mH[e.id]?R(mH[e.id]):void 0,onClick:()=>{r(!1),i.input(e.bytes(i.modes.applicationCursorKeysMode),!0)},children:e.cap},e.id);return(0,B.jsxs)(`div`,{className:`mono ${Me}`,role:`toolbar`,"aria-label":R(`layout.termKeys`),onPointerDown:e=>e.preventDefault(),children:[t&&AP.map(a),(0,B.jsx)(`button`,{type:`button`,className:Ne(n),"aria-pressed":n,onClick:()=>r(!n),children:`ctrl`}),OP.filter(e=>!(t&&AP.includes(e))).map(a)]})}function gH(e){switch(e.kind){case`restored`:return R(`workspace.restored`);case`notLive`:return R(`workspace.tabNotLive`);case`exited`:return R(`workspace.exited`,{code:e.code??`?`});case`failed`:return R(`workspace.attachFailed`,{message:e.message});case`none`:return``}}function _H(e){z();let{notice:t,engineExit:n,model:r,taskId:i,revive:a}=e,o=t.kind===`none`?n:null;if(t.kind===`none`&&!o)return null;let s=t.kind===`notLive`||t.kind===`restored`||t.kind===`exited`,c=t.kind===`exited`||o!==null,l=a.error?R(`workspace.reopenFailed`,{message:a.error}):o?R(`workspace.engineExited`,{code:o.code??`?`}):gH(t);return(0,B.jsxs)(`div`,{className:lt(t.kind===`failed`||!!a.error),children:[(0,B.jsx)(`span`,{children:l}),e.onReopen&&(s||o)&&(0,B.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,disabled:a.busy,onClick:()=>e.onReopen?.(o!==null),children:a.busy?R(`workspace.reopening`):R(o?`workspace.retry`:`workspace.reopen`)}),t.kind===`failed`&&e.onRetryAttach&&(0,B.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:e.onRetryAttach,children:R(`workspace.retry`)}),c&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>W.set((0,B.jsx)(oh,{model:r,section:`engines`})),children:R(`workspace.engineSettings`)}),(0,B.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>W.set((0,B.jsx)(Cs,{model:r,taskId:i})),children:R(`menu.newChatPick`)})]})]})}var vH=8,yH=32,bH=600,xH=100,SH=new WeakMap,CH=null;function wH(e){let t=SH.get(e);return t||(t={entries:new Map,snapshots:new Map,left:null},SH.set(e,t)),t}function TH(){return CH||(CH=document.createElement(`div`),CH.style.display=`none`,document.body.append(CH)),CH}function EH(e,t,n){e.snapshots.delete(t),e.snapshots.set(t,n);for(let t of e.snapshots.keys()){if(e.snapshots.size<=yH)break;e.snapshots.delete(t)}}function DH(e,t,n){e.entries.delete(t.key),t.leaving!==null&&window.clearTimeout(t.leaving),t.leaving=null,n?EH(e,t.key,t.handle.snapshot()):e.snapshots.delete(t.key),t.handle.dispose(),t.box.remove()}function OH(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-vH)))DH(e,n,!0)}function kH(e,t,n,r){return wH(e).entries.get(wz(t,n,r))?.slot.parkedAt!=null}function AH(e,t){let n=wH(e.client),r=wz(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,PH(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:()=>jH(n,i)}}let a=document.createElement(`div`);a.className=st,e.host.append(a),MH(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 u=kz({...e,el:a,snapshot:l,onPainted:()=>PH(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&&DH(n,c,!1)},copyText:e=>s.binding?.copyText(e)??Promise.resolve(!1),pasteImage:()=>s.binding?.pasteImage()??Promise.resolve()});if(!o)return{handle:u,release:()=>{u.dispose(),a.remove()}};let d={key:r,handle:u,box:a,slot:s,leaving:null};return c=d,n.entries.set(r,d),{handle:u,release:()=>jH(n,d)}}function jH(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(),TH().append(t.box),e.left=t,OH(e))}function MH(e,t){let n=e.left;e.left=null,!(!n||n.slot.parkedAt===null||performance.now()-n.slot.parkedAt>xH)&&e.entries.get(n.key)===n&&(n.box.classList.add(`is-leaving`),t.append(n.box),n.leaving=window.setTimeout(()=>NH(e,n),bH))}function NH(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&&TH().append(t.box))}function PH(e){for(let t of e.entries.values())NH(e,t)}var FH={matchBackground:`#a9a39a`,matchOverviewRuler:`#a9a39a`,activeMatchBackground:`#cc785c`,activeMatchColorOverviewRuler:`#cc785c`};function IH({handle:e,onClose:t}){let{term:n,search:r}=e,i=(0,g.useRef)(n.buffer.active.viewportY),a=n.buffer.active.type===`alternate`,[o,s]=(0,g.useState)(``),[c,l]=(0,g.useState)({index:-1,total:0});(0,g.useEffect)(()=>{let e=r.onDidChangeResults(({resultIndex:e,resultCount:t})=>l({index:e,total:t}));return()=>{e.dispose(),r.clearDecorations()}},[r]),(0,g.useEffect)(()=>{if(!a){if(n.clearSelection(),o.length===0){r.clearDecorations(),l({index:-1,total:0});return}r.findPrevious(o,{decorations:FH})}},[o,a,r,n]);let u=()=>{r.clearDecorations(),n.clearSelection(),n.scrollToLine(i.current),t()},d=e=>{if(e.key===`Escape`)u();else if(a)return;else if(e.key===`Enter`||e.key===`ArrowUp`)r.findPrevious(o,{decorations:FH});else if(e.key===`ArrowDown`)r.findNext(o,{decorations:FH});else return;e.preventDefault(),e.stopPropagation()},f=o.length===0?Xa(`search.placeholder`):c.total===0?Xa(`search.noMatches`):Xa(`search.position`,{index:c.index<0?`?`:c.index+1,total:c.total});return(0,B.jsxs)(`div`,{className:`mono ${Ae}`,children:[a?(0,B.jsx)(`span`,{className:`text-warning`,children:Xa(`search.unavailable`)}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`text-accent`,children:`/`}),(0,B.jsx)(`input`,{className:je,autoFocus:!0,spellCheck:!1,value:o,onChange:e=>s(e.target.value),onKeyDown:d}),(0,B.jsx)(`span`,{className:`text-muted`,children:f})]}),a&&(0,B.jsx)(`input`,{className:`is-hidden min-w-0 flex-1 border-none bg-transparent text-ink [font:inherit] outline-none`,autoFocus:!0,readOnly:!0,onKeyDown:d,"aria-label":Xa(`search.unavailable`)})]})}async function LH(e,t,n){let r=Qy(n);r.length<n.length&&G(R(`layout.dropUnsupported`),`error`);for(let n of r)try{t.term.paste(`${await eb(e,n)} `)}catch(e){G(e instanceof Error?e.message:String(e),`error`)}t.term.focus()}async function RH(){if(!navigator.clipboard?.read)throw Error(R(`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 Qy(e)}async function zH(e,t){let n;try{n=await RH()}catch(e){G(R(`layout.pasteNoAccess`,{error:e instanceof Error?e.message:String(e)}),`error`);return}n.length===0?G(R(`layout.pasteNoImage`),`error`):await LH(e,t,n)}async function BH(e){try{return await navigator.clipboard.writeText(e),!0}catch{return G(R(`menu.copyFailed`),`error`),!1}}function VH(e){let{client:t,taskId:n,tabId:r,leafId:i}=e,a=v(e.model.tasks)?.tasks.find(e=>e.id===n)?.tabStatus?.[r]?.kind===`needs-input`;z();let o=(0,g.useRef)(null),[s,c]=(0,g.useState)({kind:`none`}),[l,u]=(0,g.useState)(null),[d,f]=(0,g.useState)(0),[p,m]=(0,g.useState)(!1),[h,_]=(0,g.useState)({busy:!1,error:null}),y=(0,g.useRef)(e);y.current=e,(0,g.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 "${tP}"`,String.fromCodePoint(57504)).catch(()=>{});let d=()=>{s||(a=AH({client:t,host:e,taskId:n,tabId:r,leafId:i,focusOnMount:y.current.focused!==!1},{setNotice:c,onScrolled:f,onFocusChange:e=>{if(!a)return;let{stream:t}=a.handle;e?(y.current.onActivate?.(),SC.set(wC(t)??null)):SC.get()?.stream===t&&SC.set(null)},onExit:()=>{eH(wz(n,r,i))||y.current.onExit?.()},copyText:BH,pasteImage:async()=>{a&&await zH(t,a.handle)}}),u(a.handle))};return kH(t,n,r,i)?d():Promise.allSettled(l).then(d),()=>{s=!0,u(null),m(!1),a?.release()}},[t,n,r,i]),(0,g.useEffect)(()=>{if(!l)return;let{term:e,stream:a}=l,o={stream:a,focus:()=>e.focus(),scrollPages:e=>l.scrollLines(e*10),hasSelection:()=>e.hasSelection(),copySelection:()=>{let t=e.getSelection();return t.trim().length!==0&&(BH(t),e.clearSelection(),!0)},openSearch:()=>m(!0),reset:()=>{let o={cols:e.cols,rows:e.rows};W.set((0,B.jsx)(Mn,{title:Xa(`reset.title`),body:Xa(`reset.body`),confirmLabel:R(`workspace.reset`),onConfirm:async()=>{QV(a);try{await t.request(`tab.split`,{taskId:n,tabId:r,action:`reset`,leafId:i??`leaf-1`,...o}),await l.reattach(),e.focus()}finally{$V(a)}}}))},size:()=>({cols:e.cols,rows:e.rows})},s=CC(o);return document.activeElement===e.textarea&&SC.set(o),()=>{s()}},[l,t,n,r,i]),(0,g.useEffect)(()=>{e.focused&&l&&document.activeElement!==l.term.textarea&&l.term.focus()},[e.focused,l]);let b=!i||i===`leaf-1`,[x,S]=(0,g.useState)(null),C=e.engineExit?.since===x,w=(0,g.useRef)(!1),T=async(i,a)=>{if(!w.current){w.current=!0,_({busy:!0,error:null});try{await t.request(`term.revive`,{taskId:n,tabId:r,...a?{restartExited:a}:{}}),await i.reattach(),i.term.focus(),S(e.engineExit?.since??null),_({busy:!1,error:null})}catch(e){_({busy:!1,error:e instanceof Error?e.message:String(e)})}finally{w.current=!1}}};return(0,B.jsxs)(`div`,{className:rt,"data-stream":wz(n,r,i),onDragOver:e=>e.dataTransfer.types.includes(`Files`)&&e.preventDefault(),onDrop:e=>{!e.dataTransfer.files.length||!l||(e.preventDefault(),LH(t,l,Array.from(e.dataTransfer.files)))},onPasteCapture:e=>{if(!l)return;let n=Qy(e.clipboardData.files);(n.length!==0||e.clipboardData.getData(`text/plain`)===``)&&(e.preventDefault(),e.stopPropagation(),n.length>0?LH(t,l,n):zH(t,l))},children:[(0,B.jsxs)(`div`,{className:it,children:[(0,B.jsx)(`div`,{className:at,ref:o}),(0,B.jsx)(_H,{notice:s,engineExit:C?null:e.engineExit??null,model:e.model,taskId:n,revive:h,onReopen:b&&l?e=>void T(l,e):void 0,onRetryAttach:l?()=>void l.reattach():void 0}),d>0&&!p&&l&&(0,B.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,B.jsx)(`span`,{className:`text-warning`,children:Xa(`scrolledBack`,{lines:d})}),(0,B.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>l.scrollToTop(),children:Xa(`scrollFirst`)}),(0,B.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>l.scrollToBottom(),children:Xa(`scrollLatest`)})]}),p&&l&&(0,B.jsx)(IH,{handle:l,onClose:()=>{m(!1),l.term.focus()}})]}),e.composer&&(0,B.jsx)(pH,{model:e.model,taskId:n,tabId:r}),l&&(0,B.jsx)(hH,{handle:l,atMenu:a})]})}var HH=e=>Pz(e)!==null,UH=e=>ks(Pz(e)?.tab.split);function WH(e){let t=Pz(e),n=t?.tab.split;return t&&n?{...t,split:n,leaf:jz(t.taskId,t.tab,n)}:null}ba(()=>[{id:`workspace.split.right`,chords:[`ctrl+\\`],prefix:!1,surface:`workspace`,live:HH,run:e=>{let t=Pz(e);t&&Iz(e,t.taskId,t.tab,`right`)}},{id:`workspace.split.down`,chords:[`ctrl+=`],prefix:!1,surface:`workspace`,live:HH,run:e=>{let t=Pz(e);t&&Iz(e,t.taskId,t.tab,`down`)}},{id:`workspace.split.focus-next`,chords:[`f3`],prefix:!1,surface:`workspace`,live:UH,run:e=>{let t=WH(e);t&&Nz(t.taskId,t.tab,t.split,js(t.split,t.leaf))}},{id:`workspace.split.close`,chords:[`w`],prefix:!0,surface:`workspace`,live:UH,run:e=>{let t=WH(e);t&&Lz(e,t.taskId,t.tab,t.leaf)}},{id:`workspace.split.rename`,chords:[`f2`],prefix:!1,surface:`workspace`,live:UH,run:e=>{let t=WH(e);t&&Rz(e,t.taskId,t.tab,t.leaf)}}]);var GH=[{id:`leaf-1`,x:0,y:0,w:1,h:1,left:!1,top:!1}];function KH({model:e,taskId:t,tab:n}){let r=n.split;v(Az);let i=r?jz(t,n,r):`leaf-1`,a=r?Ms(r,Fi(n)):new Map,o=ks(r),{prefs:s}=af(),c=v(e.tasks)?.tasks.find(e=>e.id===t)?.tabStatus?.[n.id]??n.status,l=n.kind===`engine`&&c?.reason===`dead`?c.since:null;(0,g.useEffect)(()=>{l!==null&&e.refreshTabsNow()},[l,e]);let u=l!==null&&n.alive!==!1?{code:n.exit?.code??null,since:l}:null;return(0,B.jsx)(`div`,{className:Te,children:(r?As(r.root):GH).map(c=>(0,B.jsxs)(`div`,{className:Oe(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,B.jsx)(VH,{client:e.client,model:e,engineExit:c.id===`leaf-1`?u:null,composer:n.kind===`engine`&&c.id===`leaf-1`,taskId:t,tabId:n.id,leafId:c.id,focused:c.id===i,onActivate:()=>r&&Mz(t,n.id,r,c.id),onExit:()=>{o?Fz(e,{taskId:t,tabId:n.id,action:`close`,leafId:c.id}):n.kind!==`engine`&&e.client.request(`tab.close`,{taskId:t,tabId:n.id}).then(()=>e.refreshTabsNow()).catch(()=>{})}}),o&&(0,B.jsx)(`span`,{className:ke(s.splitStyle===`rule`,c.id===i),onContextMenu:r=>KB(r,Vz(e,t,n,c.id)),children:a.get(c.id)})]},c.id))})}function qH(e,t){return e===`never`?!1:e!==`multipleOnly`||t>=2}function JH({taskId:e}){z();let t=i_(e),n=v(fa),r=v(It),i=n&&!r?Ag(t):null;return(0,B.jsx)(`div`,{className:W_,children:sa.map(t=>(0,B.jsx)(`button`,{type:`button`,className:N_({on:i===t}),title:R(`panel.${t}`),"aria-label":R(`panel.${t}`),"aria-pressed":i===t,onClick:()=>s_(e,t),children:(0,B.jsx)(gV,{children:_V[t]})},t))})}function YH({model:e,task:t,tabs:n,narrow:r}){let i=v(e.selection),{prefs:a}=af(),o=!qH(a.tabStrip,n.length);return(0,B.jsxs)(`div`,{className:`flex min-w-0 items-center gap-0.5 font-mono text-meta/body transition-padding-left duration-220 ease-snap motion-reduce:transition-none rail-folded:min-h-6.5 rail-folded:pl-23`,role:`tablist`,children:[n.map((n,r)=>(0,B.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":n.id===i.tabId,className:`group/tab flex items-center gap-1.5 whitespace-nowrap rounded-sm px-2.5 py-1 active:scale-97 motion-reduce:active:scale-none touch:select-none touch:touch-callout-none ${o?`hidden`:``} ${n.id===i.tabId?`bg-inset text-ink`:`text-muted hover:bg-hover data-menu-open:bg-hover`}`,onClick:()=>e.select(t.id,n.id),onContextMenu:r=>KB(r,rB(e,t,n)),children:[(0,B.jsx)(`span`,{className:`text-subtle group-aria-selected/tab:text-accent`,children:r+1}),Fi(n)]},n.id)),!r&&(0,B.jsx)(JH,{taskId:t.id})]})}function XH(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??e))}function ZH({model:e}){let t=z()===`zh`?ar:ir,n=e.client,[r,i]=(0,g.useState)(()=>(cs(n,`worktrees.list`,{network:!0})??cs(n,`worktrees.list`,{network:!1}))?.projects??null),[a,o]=(0,g.useState)([]),[s,c]=(0,g.useState)(0),[l,u]=(0,g.useState)(0),d=(0,g.useRef)(null);(0,g.useEffect)(()=>{let e=!0,t=!1,r=r=>us(n,`worktrees.list`,{network:r}).then(n=>{if(!(!e||!r&&t)&&(r&&(t=!0),i(n.projects),r)){let e=new Set(n.projects.flatMap(e=>e.worktrees.map(e=>e.path)));o(t=>t.filter(t=>e.has(t)))}}).catch(()=>{});return r(!1),r(!0),()=>{e=!1}},[n,l]),(0,g.useEffect)(()=>d.current?.focus(),[]);let f=(r??[]).map(e=>({...e,worktrees:e.worktrees.filter(e=>!a.includes(e.path))})),p=f.flatMap(e=>e.worktrees),m=Math.min(s,Math.max(0,p.length-1));(0,g.useEffect)(()=>{d.current?.querySelector(`[data-row="${m}"]`)?.scrollIntoView({block:`nearest`})},[m]);let h=(0,g.useCallback)(()=>u(e=>e+1),[]),_=async(e,r)=>{o(t=>[...t,e.path]);try{let i=await n.request(`worktrees.remove`,{path:e.path,force:r});i.residue&&G(XH(t.delete.residue,i.residue)),h()}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`){W.set((0,B.jsx)(Mn,{title:t.delete.forceTitle,body:`${XH(t.delete.forceBody,{branch:e.branch||e.path})}\n\n${XH(t.delete.forceReason,{reason:On(n)})}`,confirmLabel:t.delete.button,onConfirm:()=>_(e,!0)}));return}G(XH(t.delete.failed,{error:On(n)}),`error`)}},v=e=>W.set((0,B.jsx)(Mn,{title:t.delete.confirmTitle,body:XH(t.delete.confirmBody,{branch:e.branch||e.path}),confirmLabel:t.delete.button,onConfirm:async()=>{_(e,!1)}})),y=n=>{if(!n.taskId){G(t.land.noTask,`error`);return}fh(e,{id:n.taskId,title:n.branch,branch:n.branch},h)},b=e=>{if(e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.toLowerCase()===`c`&&!window.getSelection()?.toString())return e.preventDefault(),Nt.set(null);if(e.metaKey||e.ctrlKey||e.altKey)return;let t=p[m];if(e.key===`j`||e.key===`ArrowDown`)c(Math.min(p.length-1,m+1));else if(e.key===`k`||e.key===`ArrowUp`)c(Math.max(0,m-1));else if(e.key===`d`&&t)v(t);else if(e.key===`l`&&t)y(t);else if(e.key===`q`||e.key===`Escape`)Nt.set(null);else return;e.preventDefault()},x=0;return(0,B.jsxs)(`div`,{className:qp,tabIndex:0,ref:d,onKeyDown:b,children:[(0,B.jsx)(`h1`,{className:Jp,children:t.title}),r===null?(0,B.jsx)(`p`,{className:`text-muted`,children:t.loading}):f.length===0?(0,B.jsx)(`p`,{className:`text-muted`,children:t.noProjects}):f.map(e=>{let n=x;return x+=e.worktrees.length,(0,B.jsxs)(`section`,{className:Pp,children:[(0,B.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,B.jsx)(`span`,{children:e.repo}),(0,B.jsx)(`span`,{className:`rule`})]}),e.worktrees.length===0&&(0,B.jsx)(`p`,{className:`mono text-muted`,children:t.noWorktrees}),e.worktrees.map((e,r)=>{let i=n+r;return(0,B.jsxs)(`div`,{"data-row":i,className:Fp(i===m),onClick:()=>c(i),children:[(0,B.jsxs)(`div`,{className:Ip,children:[(0,B.jsx)(`span`,{className:Rp,children:e.branch||t.row.detached}),e.roveManaged&&(0,B.jsx)(`span`,{className:`chip text-muted`,children:t.badge.roveManaged}),e.dirty===!0&&(0,B.jsx)(`span`,{className:`chip text-warning`,children:t.badge.dirty}),e.dirty===null&&(0,B.jsx)(`span`,{className:`chip text-muted`,children:t.badge.dirtyUnknown}),(0,B.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,B.jsx)(`span`,{className:`chip ${e.verdict===`merged`?`text-success`:e.verdict===`stale`?`text-warning`:`text-accent`}`,children:t.verdict[e.verdictReason]??e.verdictReason})]}),(0,B.jsxs)(`div`,{className:`${Lp} mono text-muted`,children:[(0,B.jsx)(`span`,{className:zp,children:e.path}),e.createdAtMs>0&&(0,B.jsx)(`span`,{children:XH(t.row.created,{age:co(Date.now()-e.createdAtMs)})})]}),i===m&&(0,B.jsxs)(`div`,{className:`flex items-baseline gap-2 text-[length:var(--fs-body)]`,children:[(0,B.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>v(e),children:t.delete.button}),e.taskId&&(0,B.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>y(e),children:t.land.button})]})]},e.path)})]},e.repo)}),(0,B.jsx)(`p`,{className:`${Bp} mono keys-only text-muted`,children:(0,B.jsx)(oc,{text:`j/k · d ${t.delete.button} · l ${t.land.button} · q/esc`})})]})}function QH({model:e,narrow:t}){let n=v(e.selection),r=v(e.tabs),i=v(e.tasks),a=v(e.remote),o=a.find(e=>e.id===n.taskId&&!e.machine?.stale),s=ii(i,n.taskId)??o??null,c=o?void 0:a.find(e=>e.id===n.taskId),l=s?r[s.id]??[]:[],u=s?s.id in r:!1,d=v(Nt),f=yp(s?.id),p=s?.rowStatus?.kind===`running`,m=v(Lt),h=v(ca)!==`terminal`&&t&&!!s;return(0,g.useEffect)(()=>{let t=e.selection.get();return e.selection.subscribe(()=>{Lt.set(null);let n=e.selection.get();(n.taskId!==t.taskId||n.tabId!==t.tabId)&&ca.set(`terminal`),t=n})},[e]),(0,g.useEffect)(()=>ag(e),[e]),d===`update`?(0,B.jsxs)(`main`,{className:`${et} ${_e}`,children:[t&&(0,B.jsx)(iv,{}),(0,B.jsx)(_m,{client:e.client})]}):d===`worktrees`?(0,B.jsxs)(`main`,{className:`${et} ${_e}`,children:[t&&(0,B.jsx)(iv,{}),(0,B.jsx)(ZH,{model:e})]}):d?(0,B.jsxs)(`main`,{className:`${et} ${_e}`,children:[t&&(0,B.jsx)(iv,{}),(0,B.jsx)(tC,{model:e,page:d})]}):m?(0,B.jsxs)(`main`,{className:`${et} ${_e}`,children:[t&&(0,B.jsx)(iv,{}),(0,B.jsx)(`div`,{className:tt,children:(0,B.jsx)(ru,{model:e,seed:m},`${m.machine??``}\0${m.repo??``}\0${m.ungrouped?`u`:``}`)})]}):(0,B.jsxs)(`main`,{className:`${et} ${_e}`,children:[t&&(0,B.jsx)(iv,{taskId:s?.id}),s&&(0,B.jsx)(YH,{model:e,task:s,tabs:l,narrow:t}),(0,B.jsxs)(`div`,{className:`${tt} ${p?nt:``}`,style:f?{"--task-ink":f}:void 0,children:[!t&&!s&&!c&&i&&i.tasks.length+a.length===0&&(0,B.jsx)(GB,{model:e}),!s&&!c&&i&&i.tasks.length+a.length>0&&(0,B.jsx)(`p`,{className:Qe,children:R(`workspace.pickTask`)}),c?.machine&&(0,B.jsx)(`div`,{className:$e,children:(0,B.jsx)(Gc,{host:c.machine.label})}),s&&u&&l.length===0&&!h&&(0,B.jsxs)(`div`,{className:$e,children:[(0,B.jsx)(`p`,{children:R(`workspace.noTabs`)}),(0,B.jsx)(ue,{variant:`filled`,onClick:()=>void ys(e,s.id,{kind:`engine`}).catch(e=>G(String(e),`error`)),children:s.engine?R(`workspace.startEngine`,{engine:s.engine.name}):R(`workspace.startSession`)}),` `,(0,B.jsx)(ue,{variant:`filled`,onClick:()=>void vs(e,s.id),children:R(`menu.newChat`)}),` `,(0,B.jsx)(ue,{variant:`filled`,onClick:()=>W.set((0,B.jsx)(Cs,{model:e,taskId:s.id})),children:R(`menu.newChatPick`)})]}),s&&h&&(0,B.jsx)(JV,{model:e,task:s,narrow:!0}),s&&n.tabId&&l.some(e=>e.id===n.tabId)&&(0,B.jsx)(`div`,{className:`min-w-0 flex-1 ${h?`hidden`:`flex`}`,children:(0,B.jsx)(KH,{model:e,taskId:s.id,tab:l.find(e=>e.id===n.tabId)??l[0]},`${s.id}::${n.tabId}`)})]})]})}function $H({model:e}){z();let t=v(e.client.conn);return t.hello===null&&t.failures>=2?(0,B.jsx)(eU,{}):(0,B.jsx)(tU,{model:e})}function eU(){let[e,t]=(0,g.useState)(null);return(0,g.useEffect)(()=>{Xi().then(t)},[]),e===null?null:e?(0,B.jsx)(ea,{}):(0,B.jsx)(Ot,{failing:!0})}function tU({model:e}){Ih(e);let t=v(e.client.conn).hello;(0,g.useEffect)(()=>{t&&(hm(e.client),xm(e.client,t.roveVersion))},[t,e.client]),Js(e),Gs(e),br(e.client),Gh(e),Nr(e.client),mf(e.client),(0,g.useEffect)(()=>{e.onSelect=Vi;let t=Lt.subscribe(()=>{Lt.get()!==null&&Vi()});return zt(),t},[e]),(0,g.useEffect)(()=>Bf(e),[e]);let n=v(It),r=v(e.selection),i=v(e.tasks),a=v(e.remote),o=qi(),s=v(D_),c=v(O_),l=v(E_),u=v(Bi),d=v(da),f=v(fa),p=v(pa),m=v(Nt),h=v(Gt)===`drag`,_=v(Lt)!==null,y=a.find(e=>e.id===r.taskId&&!e.machine?.stale),b=ii(i,r.taskId)??y??null,x=y?void 0:a.find(e=>e.id===r.taskId),S=o?Ji(u,!!b||!!x,m!==null||_):null;(0,g.useEffect)(()=>e.setTaskShown(S===null||S===`content`&&m===null&&!_),[e,S,m,_]);let C=j_(l??280),w={"--rail-w":`${s?0:C}px`,"--rail-open-w":`${C}px`,"--panel-w":d===null?void 0:`${ma(d,s?0:C)}px`};return(0,B.jsxs)(`div`,{className:me,children:[(0,B.jsx)(Fr,{onRefresh:()=>Pr(e.client)}),(0,B.jsxs)(`div`,{className:he({zen:n||!f||!b&&!x||o,expanded:p&&!n&&!o,surface:S,folded:s&&!o,peek:s&&c&&!o,dragging:h}),style:o?void 0:w,children:[!o&&(0,B.jsx)(nv,{model:e}),s&&!o&&(0,B.jsx)(`div`,{className:`absolute inset-y-0 left-0 z-5 col-1 row-1 w-2.5`,onMouseEnter:()=>A_(!0),onMouseLeave:()=>A_(!1)}),(0,B.jsx)(qB,{model:e,narrow:o}),(0,B.jsx)(QH,{model:e,narrow:o}),!o&&(0,B.jsx)(JV,{model:e,task:b,remoteHost:x?.machine?.label}),(0,B.jsx)(YV,{model:e}),(0,B.jsx)(oa,{}),(0,B.jsx)(Vh,{model:e}),(0,B.jsx)(Li,{model:e})]})]})}var nU=`a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`;function rU(e){return[...e.querySelectorAll(nU)].filter(e=>e.tabIndex>=0&&e.offsetParent!==null)}function iU(){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=rU(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 aU(e){if(!Ht())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 oU(e){for(let t of document.querySelectorAll(`${e}.is-leaving`))t.remove()}function sU(){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 cU(){let e=W.get(),t=-1/0;W.subscribe(()=>{let n=W.get();if(n===null&&e!==null)t=performance.now(),aU(`.overlay`);else if(n!==null){let n=e!==null||performance.now()-t<140;oU(`.overlay`),n&&requestAnimationFrame(sU)}e=n});let n=At.get();At.subscribe(()=>{let e=At.get();e===null&&n!==null?aU(`.menu`):e!==null&&oU(`.menu`),n=e});let r=rc.get().guide;rc.subscribe(()=>{let e=rc.get().guide;e===null&&r!==null?aU(`.prefix-guide`):e!==null&&oU(`.prefix-guide`),r=e})}var lU=500,uU=10,dU=`input, textarea, select, [contenteditable], .xterm`,fU=[`mousedown`,`mouseup`,`click`,`contextmenu`];function pU(){let e=null,t=()=>{e&&window.clearTimeout(e.timer),e=null},n=()=>{let e=e=>{e.preventDefault(),e.stopPropagation()},t=()=>{for(let t of fU)document.removeEventListener(t,e,!0);document.removeEventListener(`pointerdown`,t,!0),document.removeEventListener(`keydown`,t,!0)};for(let t of fU)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(dU))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())},lU)};e=a},!0),document.addEventListener(`pointermove`,n=>{e&&Math.hypot(n.clientX-e.x,n.clientY-e.y)>uU&&t()},!0),document.addEventListener(`pointerup`,t,!0),document.addEventListener(`pointercancel`,t,!0),document.addEventListener(`contextmenu`,t=>{e&&t.isTrusted&&(e.native=!0)},!0)}function mU(e,t){e.viewingExtras=()=>Yg({narrow:Gi(),panelOpen:fa.get(),zen:It.get()});let n=()=>e.reportViewing();fa.subscribe(n),It.subscribe(n),Ki(n),t.on(`panel`,t=>{Jg(t)&&u_(t,e.selection.get().taskId)})}function hU(e){let t=e;return!!t&&typeof t.promptId==`string`&&typeof t.title==`string`}function gU({client:e,prompt:t}){let n=(z()===`zh`?Fn:Pn).prompt,[r,i]=(0,g.useState)(t.initial??``),a=(0,g.useRef)(!1),{busy:o,error:s,submit:c}=An();return(0,g.useEffect)(()=>()=>{a.current||e.request(`ui.promptReply`,{promptId:t.promptId}).catch(()=>{})},[e,t.promptId]),(0,B.jsx)(kn,{title:t.title,children:(0,B.jsxs)(`form`,{className:on,onSubmit:n=>{n.preventDefault(),c(async()=>{await e.request(`ui.promptReply`,{promptId:t.promptId,value:r}),a.current=!0})},children:[(0,B.jsx)(`input`,{className:U,"aria-label":n.fieldLabel,autoFocus:!0,spellCheck:!1,value:r,placeholder:t.placeholder,onChange:e=>i(e.target.value)}),s&&(0,B.jsx)(`p`,{className:`text-error`,children:s}),(0,B.jsx)(Nn,{busy:o,submitLabel:n.submitLabel})]})})}function _U(e,t){W.get()||W.set((0,B.jsx)(gU,{client:e,prompt:t},t.promptId))}var vU=`rove-web.reloadedFor`;function yU(e,t,n){return e===null?`adopt`:t===e||t===n?`stay`:`reload`}function bU(){let e=null;try{e=window.sessionStorage}catch{}return{storage:e,reload:()=>window.location.reload()}}function xU(e,t=bU()){let n=null,r=null,i=()=>{try{return t.storage?.getItem(vU)??r}catch{return r}};return e.conn.subscribe(()=>{let{state:a,hello:o}=e.conn.get();if(a!==`open`||!o)return;let s=yU(n,o.roveVersion,i());if(s===`adopt`&&(n=o.roveVersion),s===`reload`){r=o.roveVersion;try{t.storage?.setItem(vU,o.roveVersion)}catch{}t.reload()}})}function SU(){let e=window.visualViewport;if(!e)return;let t=document.documentElement,n=()=>{t.style.setProperty(`--vvh`,`${e.height*e.scale}px`),e.scale===1&&window.scrollY!==0&&window.scrollTo(0,0)};e.addEventListener(`resize`,n),e.addEventListener(`scroll`,n),window.addEventListener(`scroll`,n,{passive:!0}),n()}var CU=(0,h.createRoot)(document.getElementById(`root`));SU(),pU(),cU(),iU();var wU=a();if(!wU)Xi().then(e=>CU.render((0,B.jsx)(g.StrictMode,{children:e?(0,B.jsx)(ea,{}):(0,B.jsx)(Ot,{})})));else{let e=new xl(Sl(),wU),t=new oi(e);e.on(`prompt`,t=>{hU(t)&&_U(e,t)}),mU(t,e),xU(e),e.start(),CU.render((0,B.jsx)(g.StrictMode,{children:(0,B.jsx)($H,{model:t})}))}
|