agent-workbench 0.7.0 → 0.8.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/README.md +71 -25
- package/dist/server.js +5773 -893
- package/dist/web/assets/de-CDXh9n3d.js +1 -0
- package/dist/web/assets/es-CLg7TmrV.js +1 -0
- package/dist/web/assets/fr-Pnm-P-lG.js +1 -0
- package/dist/web/assets/{highlight-DsNwA50i.js → highlight-BUWAzUc6.js} +1 -1
- package/dist/web/assets/index-B0Pd_BkE.css +32 -0
- package/dist/web/assets/index-Hua8TqlR.js +156 -0
- package/dist/web/assets/ja-COKYooK_.js +1 -0
- package/dist/web/assets/ko-CGAnMMHl.js +1 -0
- package/dist/web/assets/pt-BR-DPgHVjMQ.js +1 -0
- package/dist/web/assets/ru-BfcWzg67.js +1 -0
- package/dist/web/assets/zh-CN-Xcl7z1Nt.js +1 -0
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/web/assets/de-CmDQFS83.js +0 -1
- package/dist/web/assets/es-kfFlJ6C6.js +0 -1
- package/dist/web/assets/fr-CgQRflYh.js +0 -1
- package/dist/web/assets/index-mQpsIj-O.js +0 -149
- package/dist/web/assets/index-vJBDG99a.css +0 -32
- package/dist/web/assets/ja-BPlbe60x.js +0 -1
- package/dist/web/assets/ko-DeqZlJbl.js +0 -1
- package/dist/web/assets/pt-BR-Czz2tUjz.js +0 -1
- package/dist/web/assets/ru-Dxhm5BY3.js +0 -1
- package/dist/web/assets/zh-CN-CldKBtQb.js +0 -1
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
var Z_=Object.defineProperty;var ew=(t,e,s)=>e in t?Z_(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var $t=(t,e,s)=>ew(t,typeof e!="symbol"?e+"":e,s);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const u of document.querySelectorAll('link[rel="modulepreload"]'))l(u);new MutationObserver(u=>{for(const k of u)if(k.type==="childList")for(const y of k.addedNodes)y.tagName==="LINK"&&y.rel==="modulepreload"&&l(y)}).observe(document,{childList:!0,subtree:!0});function s(u){const k={};return u.integrity&&(k.integrity=u.integrity),u.referrerPolicy&&(k.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?k.credentials="include":u.crossOrigin==="anonymous"?k.credentials="omit":k.credentials="same-origin",k}function l(u){if(u.ep)return;u.ep=!0;const k=s(u);fetch(u.href,k)}})();function tw(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Zc={exports:{}},go={},eu={exports:{}},ht={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var Lf;function nw(){if(Lf)return ht;Lf=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),k=Symbol.for("react.provider"),y=Symbol.for("react.context"),i=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),h=Symbol.iterator;function b(U){return U===null||typeof U!="object"?null:(U=h&&U[h]||U["@@iterator"],typeof U=="function"?U:null)}var T={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,w={};function d(U,z,te){this.props=U,this.context=z,this.refs=w,this.updater=te||T}d.prototype.isReactComponent={},d.prototype.setState=function(U,z){if(typeof U!="object"&&typeof U!="function"&&U!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,U,z,"setState")},d.prototype.forceUpdate=function(U){this.updater.enqueueForceUpdate(this,U,"forceUpdate")};function g(){}g.prototype=d.prototype;function p(U,z,te){this.props=U,this.context=z,this.refs=w,this.updater=te||T}var f=p.prototype=new g;f.constructor=p,N(f,d.prototype),f.isPureReactComponent=!0;var E=Array.isArray,j=Object.prototype.hasOwnProperty,x={current:null},R={key:!0,ref:!0,__self:!0,__source:!0};function S(U,z,te){var ie,we={},ge=null,X=null;if(z!=null)for(ie in z.ref!==void 0&&(X=z.ref),z.key!==void 0&&(ge=""+z.key),z)j.call(z,ie)&&!R.hasOwnProperty(ie)&&(we[ie]=z[ie]);var G=arguments.length-2;if(G===1)we.children=te;else if(1<G){for(var ee=Array(G),Z=0;Z<G;Z++)ee[Z]=arguments[Z+2];we.children=ee}if(U&&U.defaultProps)for(ie in G=U.defaultProps,G)we[ie]===void 0&&(we[ie]=G[ie]);return{$$typeof:t,type:U,key:ge,ref:X,props:we,_owner:x.current}}function L(U,z){return{$$typeof:t,type:U.type,key:z,ref:U.ref,props:U.props,_owner:U._owner}}function I(U){return typeof U=="object"&&U!==null&&U.$$typeof===t}function P(U){var z={"=":"=0",":":"=2"};return"$"+U.replace(/[=:]/g,function(te){return z[te]})}var O=/\/+/g;function B(U,z){return typeof U=="object"&&U!==null&&U.key!=null?P(""+U.key):z.toString(36)}function $(U,z,te,ie,we){var ge=typeof U;(ge==="undefined"||ge==="boolean")&&(U=null);var X=!1;if(U===null)X=!0;else switch(ge){case"string":case"number":X=!0;break;case"object":switch(U.$$typeof){case t:case e:X=!0}}if(X)return X=U,we=we(X),U=ie===""?"."+B(X,0):ie,E(we)?(te="",U!=null&&(te=U.replace(O,"$&/")+"/"),$(we,z,te,"",function(Z){return Z})):we!=null&&(I(we)&&(we=L(we,te+(!we.key||X&&X.key===we.key?"":(""+we.key).replace(O,"$&/")+"/")+U)),z.push(we)),1;if(X=0,ie=ie===""?".":ie+":",E(U))for(var G=0;G<U.length;G++){ge=U[G];var ee=ie+B(ge,G);X+=$(ge,z,te,ee,we)}else if(ee=b(U),typeof ee=="function")for(U=ee.call(U),G=0;!(ge=U.next()).done;)ge=ge.value,ee=ie+B(ge,G++),X+=$(ge,z,te,ee,we);else if(ge==="object")throw z=String(U),Error("Objects are not valid as a React child (found: "+(z==="[object Object]"?"object with keys {"+Object.keys(U).join(", ")+"}":z)+"). If you meant to render a collection of children, use an array instead.");return X}function W(U,z,te){if(U==null)return U;var ie=[],we=0;return $(U,ie,"","",function(ge){return z.call(te,ge,we++)}),ie}function K(U){if(U._status===-1){var z=U._result;z=z(),z.then(function(te){(U._status===0||U._status===-1)&&(U._status=1,U._result=te)},function(te){(U._status===0||U._status===-1)&&(U._status=2,U._result=te)}),U._status===-1&&(U._status=0,U._result=z)}if(U._status===1)return U._result.default;throw U._result}var Y={current:null},V={transition:null},F={ReactCurrentDispatcher:Y,ReactCurrentBatchConfig:V,ReactCurrentOwner:x};function H(){throw Error("act(...) is not supported in production builds of React.")}return ht.Children={map:W,forEach:function(U,z,te){W(U,function(){z.apply(this,arguments)},te)},count:function(U){var z=0;return W(U,function(){z++}),z},toArray:function(U){return W(U,function(z){return z})||[]},only:function(U){if(!I(U))throw Error("React.Children.only expected to receive a single React element child.");return U}},ht.Component=d,ht.Fragment=s,ht.Profiler=u,ht.PureComponent=p,ht.StrictMode=l,ht.Suspense=c,ht.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=F,ht.act=H,ht.cloneElement=function(U,z,te){if(U==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+U+".");var ie=N({},U.props),we=U.key,ge=U.ref,X=U._owner;if(z!=null){if(z.ref!==void 0&&(ge=z.ref,X=x.current),z.key!==void 0&&(we=""+z.key),U.type&&U.type.defaultProps)var G=U.type.defaultProps;for(ee in z)j.call(z,ee)&&!R.hasOwnProperty(ee)&&(ie[ee]=z[ee]===void 0&&G!==void 0?G[ee]:z[ee])}var ee=arguments.length-2;if(ee===1)ie.children=te;else if(1<ee){G=Array(ee);for(var Z=0;Z<ee;Z++)G[Z]=arguments[Z+2];ie.children=G}return{$$typeof:t,type:U.type,key:we,ref:ge,props:ie,_owner:X}},ht.createContext=function(U){return U={$$typeof:y,_currentValue:U,_currentValue2:U,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},U.Provider={$$typeof:k,_context:U},U.Consumer=U},ht.createElement=S,ht.createFactory=function(U){var z=S.bind(null,U);return z.type=U,z},ht.createRef=function(){return{current:null}},ht.forwardRef=function(U){return{$$typeof:i,render:U}},ht.isValidElement=I,ht.lazy=function(U){return{$$typeof:v,_payload:{_status:-1,_result:U},_init:K}},ht.memo=function(U,z){return{$$typeof:m,type:U,compare:z===void 0?null:z}},ht.startTransition=function(U){var z=V.transition;V.transition={};try{U()}finally{V.transition=z}},ht.unstable_act=H,ht.useCallback=function(U,z){return Y.current.useCallback(U,z)},ht.useContext=function(U){return Y.current.useContext(U)},ht.useDebugValue=function(){},ht.useDeferredValue=function(U){return Y.current.useDeferredValue(U)},ht.useEffect=function(U,z){return Y.current.useEffect(U,z)},ht.useId=function(){return Y.current.useId()},ht.useImperativeHandle=function(U,z,te){return Y.current.useImperativeHandle(U,z,te)},ht.useInsertionEffect=function(U,z){return Y.current.useInsertionEffect(U,z)},ht.useLayoutEffect=function(U,z){return Y.current.useLayoutEffect(U,z)},ht.useMemo=function(U,z){return Y.current.useMemo(U,z)},ht.useReducer=function(U,z,te){return Y.current.useReducer(U,z,te)},ht.useRef=function(U){return Y.current.useRef(U)},ht.useState=function(U){return Y.current.useState(U)},ht.useSyncExternalStore=function(U,z,te){return Y.current.useSyncExternalStore(U,z,te)},ht.useTransition=function(){return Y.current.useTransition()},ht.version="18.3.1",ht}var Nf;function ch(){return Nf||(Nf=1,eu.exports=nw()),eu.exports}/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.production.min.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var Rf;function rw(){if(Rf)return go;Rf=1;var t=ch(),e=Symbol.for("react.element"),s=Symbol.for("react.fragment"),l=Object.prototype.hasOwnProperty,u=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,k={key:!0,ref:!0,__self:!0,__source:!0};function y(i,c,m){var v,h={},b=null,T=null;m!==void 0&&(b=""+m),c.key!==void 0&&(b=""+c.key),c.ref!==void 0&&(T=c.ref);for(v in c)l.call(c,v)&&!k.hasOwnProperty(v)&&(h[v]=c[v]);if(i&&i.defaultProps)for(v in c=i.defaultProps,c)h[v]===void 0&&(h[v]=c[v]);return{$$typeof:e,type:i,key:b,ref:T,props:h,_owner:u.current}}return go.Fragment=s,go.jsx=y,go.jsxs=y,go}var Mf;function sw(){return Mf||(Mf=1,Zc.exports=rw()),Zc.exports}var o=sw(),Gl={},tu={exports:{}},xn={},nu={exports:{}},ru={};/**
|
|
18
|
+
* @license React
|
|
19
|
+
* scheduler.production.min.js
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/var Af;function iw(){return Af||(Af=1,(function(t){function e(V,F){var H=V.length;V.push(F);e:for(;0<H;){var U=H-1>>>1,z=V[U];if(0<u(z,F))V[U]=F,V[H]=z,H=U;else break e}}function s(V){return V.length===0?null:V[0]}function l(V){if(V.length===0)return null;var F=V[0],H=V.pop();if(H!==F){V[0]=H;e:for(var U=0,z=V.length,te=z>>>1;U<te;){var ie=2*(U+1)-1,we=V[ie],ge=ie+1,X=V[ge];if(0>u(we,H))ge<z&&0>u(X,we)?(V[U]=X,V[ge]=H,U=ge):(V[U]=we,V[ie]=H,U=ie);else if(ge<z&&0>u(X,H))V[U]=X,V[ge]=H,U=ge;else break e}}return F}function u(V,F){var H=V.sortIndex-F.sortIndex;return H!==0?H:V.id-F.id}if(typeof performance=="object"&&typeof performance.now=="function"){var k=performance;t.unstable_now=function(){return k.now()}}else{var y=Date,i=y.now();t.unstable_now=function(){return y.now()-i}}var c=[],m=[],v=1,h=null,b=3,T=!1,N=!1,w=!1,d=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,p=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function f(V){for(var F=s(m);F!==null;){if(F.callback===null)l(m);else if(F.startTime<=V)l(m),F.sortIndex=F.expirationTime,e(c,F);else break;F=s(m)}}function E(V){if(w=!1,f(V),!N)if(s(c)!==null)N=!0,K(j);else{var F=s(m);F!==null&&Y(E,F.startTime-V)}}function j(V,F){N=!1,w&&(w=!1,g(S),S=-1),T=!0;var H=b;try{for(f(F),h=s(c);h!==null&&(!(h.expirationTime>F)||V&&!P());){var U=h.callback;if(typeof U=="function"){h.callback=null,b=h.priorityLevel;var z=U(h.expirationTime<=F);F=t.unstable_now(),typeof z=="function"?h.callback=z:h===s(c)&&l(c),f(F)}else l(c);h=s(c)}if(h!==null)var te=!0;else{var ie=s(m);ie!==null&&Y(E,ie.startTime-F),te=!1}return te}finally{h=null,b=H,T=!1}}var x=!1,R=null,S=-1,L=5,I=-1;function P(){return!(t.unstable_now()-I<L)}function O(){if(R!==null){var V=t.unstable_now();I=V;var F=!0;try{F=R(!0,V)}finally{F?B():(x=!1,R=null)}}else x=!1}var B;if(typeof p=="function")B=function(){p(O)};else if(typeof MessageChannel<"u"){var $=new MessageChannel,W=$.port2;$.port1.onmessage=O,B=function(){W.postMessage(null)}}else B=function(){d(O,0)};function K(V){R=V,x||(x=!0,B())}function Y(V,F){S=d(function(){V(t.unstable_now())},F)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(V){V.callback=null},t.unstable_continueExecution=function(){N||T||(N=!0,K(j))},t.unstable_forceFrameRate=function(V){0>V||125<V?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):L=0<V?Math.floor(1e3/V):5},t.unstable_getCurrentPriorityLevel=function(){return b},t.unstable_getFirstCallbackNode=function(){return s(c)},t.unstable_next=function(V){switch(b){case 1:case 2:case 3:var F=3;break;default:F=b}var H=b;b=F;try{return V()}finally{b=H}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(V,F){switch(V){case 1:case 2:case 3:case 4:case 5:break;default:V=3}var H=b;b=V;try{return F()}finally{b=H}},t.unstable_scheduleCallback=function(V,F,H){var U=t.unstable_now();switch(typeof H=="object"&&H!==null?(H=H.delay,H=typeof H=="number"&&0<H?U+H:U):H=U,V){case 1:var z=-1;break;case 2:z=250;break;case 5:z=1073741823;break;case 4:z=1e4;break;default:z=5e3}return z=H+z,V={id:v++,callback:F,priorityLevel:V,startTime:H,expirationTime:z,sortIndex:-1},H>U?(V.sortIndex=H,e(m,V),s(c)===null&&V===s(m)&&(w?(g(S),S=-1):w=!0,Y(E,H-U))):(V.sortIndex=z,e(c,V),N||T||(N=!0,K(j))),V},t.unstable_shouldYield=P,t.unstable_wrapCallback=function(V){var F=b;return function(){var H=b;b=F;try{return V.apply(this,arguments)}finally{b=H}}}})(ru)),ru}var If;function ow(){return If||(If=1,nu.exports=iw()),nu.exports}/**
|
|
26
|
+
* @license React
|
|
27
|
+
* react-dom.production.min.js
|
|
28
|
+
*
|
|
29
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the MIT license found in the
|
|
32
|
+
* LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/var jf;function lw(){if(jf)return xn;jf=1;var t=ch(),e=ow();function s(n){for(var r="https://reactjs.org/docs/error-decoder.html?invariant="+n,a=1;a<arguments.length;a++)r+="&args[]="+encodeURIComponent(arguments[a]);return"Minified React error #"+n+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var l=new Set,u={};function k(n,r){y(n,r),y(n+"Capture",r)}function y(n,r){for(u[n]=r,n=0;n<r.length;n++)l.add(r[n])}var i=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),c=Object.prototype.hasOwnProperty,m=/^[: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]*$/,v={},h={};function b(n){return c.call(h,n)?!0:c.call(v,n)?!1:m.test(n)?h[n]=!0:(v[n]=!0,!1)}function T(n,r,a,C){if(a!==null&&a.type===0)return!1;switch(typeof r){case"function":case"symbol":return!0;case"boolean":return C?!1:a!==null?!a.acceptsBooleans:(n=n.toLowerCase().slice(0,5),n!=="data-"&&n!=="aria-");default:return!1}}function N(n,r,a,C){if(r===null||typeof r>"u"||T(n,r,a,C))return!0;if(C)return!1;if(a!==null)switch(a.type){case 3:return!r;case 4:return r===!1;case 5:return isNaN(r);case 6:return isNaN(r)||1>r}return!1}function w(n,r,a,C,A,D,q){this.acceptsBooleans=r===2||r===3||r===4,this.attributeName=C,this.attributeNamespace=A,this.mustUseProperty=a,this.propertyName=n,this.type=r,this.sanitizeURL=D,this.removeEmptyString=q}var d={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){d[n]=new w(n,0,!1,n,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var r=n[0];d[r]=new w(r,1,!1,n[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(n){d[n]=new w(n,2,!1,n.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){d[n]=new w(n,2,!1,n,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(n){d[n]=new w(n,3,!1,n.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(n){d[n]=new w(n,3,!0,n,null,!1,!1)}),["capture","download"].forEach(function(n){d[n]=new w(n,4,!1,n,null,!1,!1)}),["cols","rows","size","span"].forEach(function(n){d[n]=new w(n,6,!1,n,null,!1,!1)}),["rowSpan","start"].forEach(function(n){d[n]=new w(n,5,!1,n.toLowerCase(),null,!1,!1)});var g=/[\-:]([a-z])/g;function p(n){return n[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(n){var r=n.replace(g,p);d[r]=new w(r,1,!1,n,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(n){var r=n.replace(g,p);d[r]=new w(r,1,!1,n,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(n){var r=n.replace(g,p);d[r]=new w(r,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(n){d[n]=new w(n,1,!1,n.toLowerCase(),null,!1,!1)}),d.xlinkHref=new w("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(n){d[n]=new w(n,1,!1,n.toLowerCase(),null,!0,!0)});function f(n,r,a,C){var A=d.hasOwnProperty(r)?d[r]:null;(A!==null?A.type!==0:C||!(2<r.length)||r[0]!=="o"&&r[0]!=="O"||r[1]!=="n"&&r[1]!=="N")&&(N(r,a,A,C)&&(a=null),C||A===null?b(r)&&(a===null?n.removeAttribute(r):n.setAttribute(r,""+a)):A.mustUseProperty?n[A.propertyName]=a===null?A.type===3?!1:"":a:(r=A.attributeName,C=A.attributeNamespace,a===null?n.removeAttribute(r):(A=A.type,a=A===3||A===4&&a===!0?"":""+a,C?n.setAttributeNS(C,r,a):n.setAttribute(r,a))))}var E=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,j=Symbol.for("react.element"),x=Symbol.for("react.portal"),R=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),L=Symbol.for("react.profiler"),I=Symbol.for("react.provider"),P=Symbol.for("react.context"),O=Symbol.for("react.forward_ref"),B=Symbol.for("react.suspense"),$=Symbol.for("react.suspense_list"),W=Symbol.for("react.memo"),K=Symbol.for("react.lazy"),Y=Symbol.for("react.offscreen"),V=Symbol.iterator;function F(n){return n===null||typeof n!="object"?null:(n=V&&n[V]||n["@@iterator"],typeof n=="function"?n:null)}var H=Object.assign,U;function z(n){if(U===void 0)try{throw Error()}catch(a){var r=a.stack.trim().match(/\n( *(at )?)/);U=r&&r[1]||""}return`
|
|
34
|
+
`+U+n}var te=!1;function ie(n,r){if(!n||te)return"";te=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(r)if(r=function(){throw Error()},Object.defineProperty(r.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(r,[])}catch(de){var C=de}Reflect.construct(n,[],r)}else{try{r.call()}catch(de){C=de}n.call(r.prototype)}else{try{throw Error()}catch(de){C=de}n()}}catch(de){if(de&&C&&typeof de.stack=="string"){for(var A=de.stack.split(`
|
|
35
|
+
`),D=C.stack.split(`
|
|
36
|
+
`),q=A.length-1,Q=D.length-1;1<=q&&0<=Q&&A[q]!==D[Q];)Q--;for(;1<=q&&0<=Q;q--,Q--)if(A[q]!==D[Q]){if(q!==1||Q!==1)do if(q--,Q--,0>Q||A[q]!==D[Q]){var ne=`
|
|
37
|
+
`+A[q].replace(" at new "," at ");return n.displayName&&ne.includes("<anonymous>")&&(ne=ne.replace("<anonymous>",n.displayName)),ne}while(1<=q&&0<=Q);break}}}finally{te=!1,Error.prepareStackTrace=a}return(n=n?n.displayName||n.name:"")?z(n):""}function we(n){switch(n.tag){case 5:return z(n.type);case 16:return z("Lazy");case 13:return z("Suspense");case 19:return z("SuspenseList");case 0:case 2:case 15:return n=ie(n.type,!1),n;case 11:return n=ie(n.type.render,!1),n;case 1:return n=ie(n.type,!0),n;default:return""}}function ge(n){if(n==null)return null;if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case R:return"Fragment";case x:return"Portal";case L:return"Profiler";case S:return"StrictMode";case B:return"Suspense";case $:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case P:return(n.displayName||"Context")+".Consumer";case I:return(n._context.displayName||"Context")+".Provider";case O:var r=n.render;return n=n.displayName,n||(n=r.displayName||r.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case W:return r=n.displayName||null,r!==null?r:ge(n.type)||"Memo";case K:r=n._payload,n=n._init;try{return ge(n(r))}catch{}}return null}function X(n){var r=n.type;switch(n.tag){case 24:return"Cache";case 9:return(r.displayName||"Context")+".Consumer";case 10:return(r._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return n=r.render,n=n.displayName||n.name||"",r.displayName||(n!==""?"ForwardRef("+n+")":"ForwardRef");case 7:return"Fragment";case 5:return r;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ge(r);case 8:return r===S?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r}return null}function G(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function ee(n){var r=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function Z(n){var r=ee(n)?"checked":"value",a=Object.getOwnPropertyDescriptor(n.constructor.prototype,r),C=""+n[r];if(!n.hasOwnProperty(r)&&typeof a<"u"&&typeof a.get=="function"&&typeof a.set=="function"){var A=a.get,D=a.set;return Object.defineProperty(n,r,{configurable:!0,get:function(){return A.call(this)},set:function(q){C=""+q,D.call(this,q)}}),Object.defineProperty(n,r,{enumerable:a.enumerable}),{getValue:function(){return C},setValue:function(q){C=""+q},stopTracking:function(){n._valueTracker=null,delete n[r]}}}}function ve(n){n._valueTracker||(n._valueTracker=Z(n))}function Se(n){if(!n)return!1;var r=n._valueTracker;if(!r)return!0;var a=r.getValue(),C="";return n&&(C=ee(n)?n.checked?"true":"false":n.value),n=C,n!==a?(r.setValue(n),!0):!1}function Ie(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function je(n,r){var a=r.checked;return H({},r,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:a??n._wrapperState.initialChecked})}function Je(n,r){var a=r.defaultValue==null?"":r.defaultValue,C=r.checked!=null?r.checked:r.defaultChecked;a=G(r.value!=null?r.value:a),n._wrapperState={initialChecked:C,initialValue:a,controlled:r.type==="checkbox"||r.type==="radio"?r.checked!=null:r.value!=null}}function tt(n,r){r=r.checked,r!=null&&f(n,"checked",r,!1)}function Ne(n,r){tt(n,r);var a=G(r.value),C=r.type;if(a!=null)C==="number"?(a===0&&n.value===""||n.value!=a)&&(n.value=""+a):n.value!==""+a&&(n.value=""+a);else if(C==="submit"||C==="reset"){n.removeAttribute("value");return}r.hasOwnProperty("value")?dt(n,r.type,a):r.hasOwnProperty("defaultValue")&&dt(n,r.type,G(r.defaultValue)),r.checked==null&&r.defaultChecked!=null&&(n.defaultChecked=!!r.defaultChecked)}function ce(n,r,a){if(r.hasOwnProperty("value")||r.hasOwnProperty("defaultValue")){var C=r.type;if(!(C!=="submit"&&C!=="reset"||r.value!==void 0&&r.value!==null))return;r=""+n._wrapperState.initialValue,a||r===n.value||(n.value=r),n.defaultValue=r}a=n.name,a!==""&&(n.name=""),n.defaultChecked=!!n._wrapperState.initialChecked,a!==""&&(n.name=a)}function dt(n,r,a){(r!=="number"||Ie(n.ownerDocument)!==n)&&(a==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+a&&(n.defaultValue=""+a))}var se=Array.isArray;function fe(n,r,a,C){if(n=n.options,r){r={};for(var A=0;A<a.length;A++)r["$"+a[A]]=!0;for(a=0;a<n.length;a++)A=r.hasOwnProperty("$"+n[a].value),n[a].selected!==A&&(n[a].selected=A),A&&C&&(n[a].defaultSelected=!0)}else{for(a=""+G(a),r=null,A=0;A<n.length;A++){if(n[A].value===a){n[A].selected=!0,C&&(n[A].defaultSelected=!0);return}r!==null||n[A].disabled||(r=n[A])}r!==null&&(r.selected=!0)}}function Ce(n,r){if(r.dangerouslySetInnerHTML!=null)throw Error(s(91));return H({},r,{value:void 0,defaultValue:void 0,children:""+n._wrapperState.initialValue})}function ye(n,r){var a=r.value;if(a==null){if(a=r.children,r=r.defaultValue,a!=null){if(r!=null)throw Error(s(92));if(se(a)){if(1<a.length)throw Error(s(93));a=a[0]}r=a}r==null&&(r=""),a=r}n._wrapperState={initialValue:G(a)}}function _e(n,r){var a=G(r.value),C=G(r.defaultValue);a!=null&&(a=""+a,a!==n.value&&(n.value=a),r.defaultValue==null&&n.defaultValue!==a&&(n.defaultValue=a)),C!=null&&(n.defaultValue=""+C)}function Te(n){var r=n.textContent;r===n._wrapperState.initialValue&&r!==""&&r!==null&&(n.value=r)}function ue(n){switch(n){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Fe(n,r){return n==null||n==="http://www.w3.org/1999/xhtml"?ue(r):n==="http://www.w3.org/2000/svg"&&r==="foreignObject"?"http://www.w3.org/1999/xhtml":n}var $e,Ye=(function(n){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(r,a,C,A){MSApp.execUnsafeLocalFunction(function(){return n(r,a,C,A)})}:n})(function(n,r){if(n.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in n)n.innerHTML=r;else{for($e=$e||document.createElement("div"),$e.innerHTML="<svg>"+r.valueOf().toString()+"</svg>",r=$e.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;r.firstChild;)n.appendChild(r.firstChild)}});function De(n,r){if(r){var a=n.firstChild;if(a&&a===n.lastChild&&a.nodeType===3){a.nodeValue=r;return}}n.textContent=r}var He={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},qe=["Webkit","ms","Moz","O"];Object.keys(He).forEach(function(n){qe.forEach(function(r){r=r+n.charAt(0).toUpperCase()+n.substring(1),He[r]=He[n]})});function xt(n,r,a){return r==null||typeof r=="boolean"||r===""?"":a||typeof r!="number"||r===0||He.hasOwnProperty(n)&&He[n]?(""+r).trim():r+"px"}function It(n,r){n=n.style;for(var a in r)if(r.hasOwnProperty(a)){var C=a.indexOf("--")===0,A=xt(a,r[a],C);a==="float"&&(a="cssFloat"),C?n.setProperty(a,A):n[a]=A}}var jt=H({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function gt(n,r){if(r){if(jt[n]&&(r.children!=null||r.dangerouslySetInnerHTML!=null))throw Error(s(137,n));if(r.dangerouslySetInnerHTML!=null){if(r.children!=null)throw Error(s(60));if(typeof r.dangerouslySetInnerHTML!="object"||!("__html"in r.dangerouslySetInnerHTML))throw Error(s(61))}if(r.style!=null&&typeof r.style!="object")throw Error(s(62))}}function Kt(n,r){if(n.indexOf("-")===-1)return typeof r.is=="string";switch(n){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 Ft=null;function pe(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var Ze=null,Qe=null,ct=null;function he(n){if(n=eo(n)){if(typeof Ze!="function")throw Error(s(280));var r=n.stateNode;r&&(r=cl(r),Ze(n.stateNode,n.type,r))}}function Ve(n){Qe?ct?ct.push(n):ct=[n]:Qe=n}function ut(){if(Qe){var n=Qe,r=ct;if(ct=Qe=null,he(n),r)for(n=0;n<r.length;n++)he(r[n])}}function be(n,r){return n(r)}function nt(){}var St=!1;function pt(n,r,a){if(St)return n(r,a);St=!0;try{return be(n,r,a)}finally{St=!1,(Qe!==null||ct!==null)&&(nt(),ut())}}function Ke(n,r){var a=n.stateNode;if(a===null)return null;var C=cl(a);if(C===null)return null;a=C[r];e:switch(r){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(C=!C.disabled)||(n=n.type,C=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!C;break e;default:n=!1}if(n)return null;if(a&&typeof a!="function")throw Error(s(231,r,typeof a));return a}var mt=!1;if(i)try{var ot={};Object.defineProperty(ot,"passive",{get:function(){mt=!0}}),window.addEventListener("test",ot,ot),window.removeEventListener("test",ot,ot)}catch{mt=!1}function Pt(n,r,a,C,A,D,q,Q,ne){var de=Array.prototype.slice.call(arguments,3);try{r.apply(a,de)}catch(Ee){this.onError(Ee)}}var zn=!1,An=null,_n=!1,En=null,Ir={onError:function(n){zn=!0,An=n}};function $s(n,r,a,C,A,D,q,Q,ne){zn=!1,An=null,Pt.apply(Ir,arguments)}function ps(n,r,a,C,A,D,q,Q,ne){if($s.apply(this,arguments),zn){if(zn){var de=An;zn=!1,An=null}else throw Error(s(198));_n||(_n=!0,En=de)}}function Gt(n){var r=n,a=n;if(n.alternate)for(;r.return;)r=r.return;else{n=r;do r=n,(r.flags&4098)!==0&&(a=r.return),n=r.return;while(n)}return r.tag===3?a:null}function gr(n){if(n.tag===13){var r=n.memoizedState;if(r===null&&(n=n.alternate,n!==null&&(r=n.memoizedState)),r!==null)return r.dehydrated}return null}function ms(n){if(Gt(n)!==n)throw Error(s(188))}function Ws(n){var r=n.alternate;if(!r){if(r=Gt(n),r===null)throw Error(s(188));return r!==n?null:n}for(var a=n,C=r;;){var A=a.return;if(A===null)break;var D=A.alternate;if(D===null){if(C=A.return,C!==null){a=C;continue}break}if(A.child===D.child){for(D=A.child;D;){if(D===a)return ms(A),n;if(D===C)return ms(A),r;D=D.sibling}throw Error(s(188))}if(a.return!==C.return)a=A,C=D;else{for(var q=!1,Q=A.child;Q;){if(Q===a){q=!0,a=A,C=D;break}if(Q===C){q=!0,C=A,a=D;break}Q=Q.sibling}if(!q){for(Q=D.child;Q;){if(Q===a){q=!0,a=D,C=A;break}if(Q===C){q=!0,C=D,a=A;break}Q=Q.sibling}if(!q)throw Error(s(189))}}if(a.alternate!==C)throw Error(s(190))}if(a.tag!==3)throw Error(s(188));return a.stateNode.current===a?n:r}function vr(n){return n=Ws(n),n!==null?jr(n):null}function jr(n){if(n.tag===5||n.tag===6)return n;for(n=n.child;n!==null;){var r=jr(n);if(r!==null)return r;n=n.sibling}return null}var Dr=e.unstable_scheduleCallback,nr=e.unstable_cancelCallback,Pr=e.unstable_shouldYield,zs=e.unstable_requestPaint,Et=e.unstable_now,Di=e.unstable_getCurrentPriorityLevel,gs=e.unstable_ImmediatePriority,Or=e.unstable_UserBlockingPriority,rr=e.unstable_NormalPriority,vs=e.unstable_LowPriority,me=e.unstable_IdlePriority,Pe=null,et=null;function wt(n){if(et&&typeof et.onCommitFiberRoot=="function")try{et.onCommitFiberRoot(Pe,n,void 0,(n.current.flags&128)===128)}catch{}}var lt=Math.clz32?Math.clz32:In,Tn=Math.log,Ln=Math.LN2;function In(n){return n>>>=0,n===0?32:31-(Tn(n)/Ln|0)|0}var _s=64,ws=4194304;function ys(n){switch(n&-n){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: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 n&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return n&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return n}}function Br(n,r){var a=n.pendingLanes;if(a===0)return 0;var C=0,A=n.suspendedLanes,D=n.pingedLanes,q=a&268435455;if(q!==0){var Q=q&~A;Q!==0?C=ys(Q):(D&=q,D!==0&&(C=ys(D)))}else q=a&~A,q!==0?C=ys(q):D!==0&&(C=ys(D));if(C===0)return 0;if(r!==0&&r!==C&&(r&A)===0&&(A=C&-C,D=r&-r,A>=D||A===16&&(D&4194240)!==0))return r;if((C&4)!==0&&(C|=a&16),r=n.entangledLanes,r!==0)for(n=n.entanglements,r&=C;0<r;)a=31-lt(r),A=1<<a,C|=n[a],r&=~A;return C}function ya(n,r){switch(n){case 1:case 2:case 4:return r+250;case 8:case 16:case 32:case 64: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 r+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Pi(n,r){for(var a=n.suspendedLanes,C=n.pingedLanes,A=n.expirationTimes,D=n.pendingLanes;0<D;){var q=31-lt(D),Q=1<<q,ne=A[q];ne===-1?((Q&a)===0||(Q&C)!==0)&&(A[q]=ya(Q,r)):ne<=r&&(n.expiredLanes|=Q),D&=~Q}}function bs(n){return n=n.pendingLanes&-1073741825,n!==0?n:n&1073741824?1073741824:0}function _r(){var n=_s;return _s<<=1,(_s&4194240)===0&&(_s=64),n}function sr(n){for(var r=[],a=0;31>a;a++)r.push(n);return r}function qn(n,r,a){n.pendingLanes|=r,r!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,r=31-lt(r),n[r]=a}function Do(n,r){var a=n.pendingLanes&~r;n.pendingLanes=r,n.suspendedLanes=0,n.pingedLanes=0,n.expiredLanes&=r,n.mutableReadLanes&=r,n.entangledLanes&=r,r=n.entanglements;var C=n.eventTimes;for(n=n.expirationTimes;0<a;){var A=31-lt(a),D=1<<A;r[A]=0,C[A]=-1,n[A]=-1,a&=~D}}function ir(n,r){var a=n.entangledLanes|=r;for(n=n.entanglements;a;){var C=31-lt(a),A=1<<C;A&r|n[C]&r&&(n[C]|=r),a&=~A}}var vt=0;function Vn(n){return n&=-n,1<n?4<n?(n&268435455)!==0?16:536870912:4:1}var Po,qs,wr,ks,Oo,Tt=!1,Fr=[],Kn=null,or=null,jn=null,Vs=new Map,Hr=new Map,yt=[],Ht="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 submit".split(" ");function Oi(n,r){switch(n){case"focusin":case"focusout":Kn=null;break;case"dragenter":case"dragleave":or=null;break;case"mouseover":case"mouseout":jn=null;break;case"pointerover":case"pointerout":Vs.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":Hr.delete(r.pointerId)}}function Dn(n,r,a,C,A,D){return n===null||n.nativeEvent!==D?(n={blockedOn:r,domEventName:a,eventSystemFlags:C,nativeEvent:D,targetContainers:[A]},r!==null&&(r=eo(r),r!==null&&qs(r)),n):(n.eventSystemFlags|=C,r=n.targetContainers,A!==null&&r.indexOf(A)===-1&&r.push(A),n)}function Bo(n,r,a,C,A){switch(r){case"focusin":return Kn=Dn(Kn,n,r,a,C,A),!0;case"dragenter":return or=Dn(or,n,r,a,C,A),!0;case"mouseover":return jn=Dn(jn,n,r,a,C,A),!0;case"pointerover":var D=A.pointerId;return Vs.set(D,Dn(Vs.get(D)||null,n,r,a,C,A)),!0;case"gotpointercapture":return D=A.pointerId,Hr.set(D,Dn(Hr.get(D)||null,n,r,a,C,A)),!0}return!1}function Fo(n){var r=Es(n.target);if(r!==null){var a=Gt(r);if(a!==null){if(r=a.tag,r===13){if(r=gr(a),r!==null){n.blockedOn=r,Oo(n.priority,function(){wr(a)});return}}else if(r===3&&a.stateNode.current.memoizedState.isDehydrated){n.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}n.blockedOn=null}function Ks(n){if(n.blockedOn!==null)return!1;for(var r=n.targetContainers;0<r.length;){var a=Bi(n.domEventName,n.eventSystemFlags,r[0],n.nativeEvent);if(a===null){a=n.nativeEvent;var C=new a.constructor(a.type,a);Ft=C,a.target.dispatchEvent(C),Ft=null}else return r=eo(a),r!==null&&qs(r),n.blockedOn=a,!1;r.shift()}return!0}function Ho(n,r,a){Ks(n)&&a.delete(r)}function Uo(){Tt=!1,Kn!==null&&Ks(Kn)&&(Kn=null),or!==null&&Ks(or)&&(or=null),jn!==null&&Ks(jn)&&(jn=null),Vs.forEach(Ho),Hr.forEach(Ho)}function Ur(n,r){n.blockedOn===r&&(n.blockedOn=null,Tt||(Tt=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Uo)))}function yr(n){function r(A){return Ur(A,n)}if(0<Fr.length){Ur(Fr[0],n);for(var a=1;a<Fr.length;a++){var C=Fr[a];C.blockedOn===n&&(C.blockedOn=null)}}for(Kn!==null&&Ur(Kn,n),or!==null&&Ur(or,n),jn!==null&&Ur(jn,n),Vs.forEach(r),Hr.forEach(r),a=0;a<yt.length;a++)C=yt[a],C.blockedOn===n&&(C.blockedOn=null);for(;0<yt.length&&(a=yt[0],a.blockedOn===null);)Fo(a),a.blockedOn===null&&yt.shift()}var $r=E.ReactCurrentBatchConfig,Cs=!0;function $o(n,r,a,C){var A=vt,D=$r.transition;$r.transition=null;try{vt=1,Gs(n,r,a,C)}finally{vt=A,$r.transition=D}}function Wo(n,r,a,C){var A=vt,D=$r.transition;$r.transition=null;try{vt=4,Gs(n,r,a,C)}finally{vt=A,$r.transition=D}}function Gs(n,r,a,C){if(Cs){var A=Bi(n,r,a,C);if(A===null)Wa(n,r,C,Ys,a),Oi(n,C);else if(Bo(A,n,r,a,C))C.stopPropagation();else if(Oi(n,C),r&4&&-1<Ht.indexOf(n)){for(;A!==null;){var D=eo(A);if(D!==null&&Po(D),D=Bi(n,r,a,C),D===null&&Wa(n,r,C,Ys,a),D===A)break;A=D}A!==null&&C.stopPropagation()}else Wa(n,r,C,null,a)}}var Ys=null;function Bi(n,r,a,C){if(Ys=null,n=pe(C),n=Es(n),n!==null)if(r=Gt(n),r===null)n=null;else if(a=r.tag,a===13){if(n=gr(r),n!==null)return n;n=null}else if(a===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;n=null}else r!==n&&(n=null);return Ys=n,null}function Fi(n){switch(n){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"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 1;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"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Di()){case gs:return 1;case Or:return 4;case rr:case vs:return 16;case me:return 536870912;default:return 16}default:return 16}}var sn=null,Xs=null,Wr=null;function Qs(){if(Wr)return Wr;var n,r=Xs,a=r.length,C,A="value"in sn?sn.value:sn.textContent,D=A.length;for(n=0;n<a&&r[n]===A[n];n++);var q=a-n;for(C=1;C<=q&&r[a-C]===A[D-C];C++);return Wr=A.slice(n,1<C?1-C:void 0)}function Js(n){var r=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&r===13&&(n=13)):n=r,n===10&&(n=13),32<=n||n===13?n:0}function Zs(){return!0}function zo(){return!1}function on(n){function r(a,C,A,D,q){this._reactName=a,this._targetInst=A,this.type=C,this.nativeEvent=D,this.target=q,this.currentTarget=null;for(var Q in n)n.hasOwnProperty(Q)&&(a=n[Q],this[Q]=a?a(D):D[Q]);return this.isDefaultPrevented=(D.defaultPrevented!=null?D.defaultPrevented:D.returnValue===!1)?Zs:zo,this.isPropagationStopped=zo,this}return H(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Zs)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Zs)},persist:function(){},isPersistent:Zs}),r}var mn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Hi=on(mn),zr=H({},mn,{view:0,detail:0}),ba=on(zr),ei,lr,qr,Vr=H({},zr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ss,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==qr&&(qr&&n.type==="mousemove"?(ei=n.screenX-qr.screenX,lr=n.screenY-qr.screenY):lr=ei=0,qr=n),ei)},movementY:function(n){return"movementY"in n?n.movementY:lr}}),qo=on(Vr),Ui=H({},Vr,{dataTransfer:0}),ka=on(Ui),ti=H({},zr,{relatedTarget:0}),ni=on(ti),Ca=H({},mn,{animationName:0,elapsedTime:0,pseudoElement:0}),Sa=on(Ca),ri=H({},mn,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),xa=on(ri),Vo=H({},mn,{data:0}),$i=on(Vo),Ea={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ta={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"},Ko={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function La(n){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(n):(n=Ko[n])?!!r[n]:!1}function Ss(){return La}var si=H({},zr,{key:function(n){if(n.key){var r=Ea[n.key]||n.key;if(r!=="Unidentified")return r}return n.type==="keypress"?(n=Js(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?Ta[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ss,charCode:function(n){return n.type==="keypress"?Js(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?Js(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),Na=on(si),Ra=H({},Vr,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ii=on(Ra),Ma=H({},zr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ss}),Go=on(Ma),Aa=H({},mn,{propertyName:0,elapsedTime:0,pseudoElement:0}),Ia=on(Aa),ja=H({},Vr,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),Yo=on(ja),Da=[9,13,27,32],Wi=i&&"CompositionEvent"in window,br=null;i&&"documentMode"in document&&(br=document.documentMode);var Xo=i&&"TextEvent"in window&&!br,oi=i&&(!Wi||br&&8<br&&11>=br),zi=" ",Qo=!1;function qi(n,r){switch(n){case"keyup":return Da.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Vi(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var kr=!1;function Jo(n,r){switch(n){case"compositionend":return Vi(r);case"keypress":return r.which!==32?null:(Qo=!0,zi);case"textInput":return n=r.data,n===zi&&Qo?null:n;default:return null}}function Zo(n,r){if(kr)return n==="compositionend"||!Wi&&qi(n,r)?(n=Qs(),Wr=Xs=sn=null,kr=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1<r.char.length)return r.char;if(r.which)return String.fromCharCode(r.which)}return null;case"compositionend":return oi&&r.locale!=="ko"?null:r.data;default:return null}}var el={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 tl(n){var r=n&&n.nodeName&&n.nodeName.toLowerCase();return r==="input"?!!el[n.type]:r==="textarea"}function Ki(n,r,a,C){Ve(C),r=ol(r,"onChange"),0<r.length&&(a=new Hi("onChange","change",null,a,C),n.push({event:a,listeners:r}))}var Gn=null,Kr=null;function nl(n){Wh(n,0)}function xs(n){var r=hi(n);if(Se(r))return n}function J(n,r){if(n==="change")return r}var ke=!1;if(i){var it;if(i){var Qt="oninput"in document;if(!Qt){var wn=document.createElement("div");wn.setAttribute("oninput","return;"),Qt=typeof wn.oninput=="function"}it=Qt}else it=!1;ke=it&&(!document.documentMode||9<document.documentMode)}function Lh(){Gn&&(Gn.detachEvent("onpropertychange",Nh),Kr=Gn=null)}function Nh(n){if(n.propertyName==="value"&&xs(Kr)){var r=[];Ki(r,Kr,n,pe(n)),pt(nl,r)}}function t_(n,r,a){n==="focusin"?(Lh(),Gn=r,Kr=a,Gn.attachEvent("onpropertychange",Nh)):n==="focusout"&&Lh()}function n_(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return xs(Kr)}function r_(n,r){if(n==="click")return xs(r)}function s_(n,r){if(n==="input"||n==="change")return xs(r)}function i_(n,r){return n===r&&(n!==0||1/n===1/r)||n!==n&&r!==r}var Yn=typeof Object.is=="function"?Object.is:i_;function Gi(n,r){if(Yn(n,r))return!0;if(typeof n!="object"||n===null||typeof r!="object"||r===null)return!1;var a=Object.keys(n),C=Object.keys(r);if(a.length!==C.length)return!1;for(C=0;C<a.length;C++){var A=a[C];if(!c.call(r,A)||!Yn(n[A],r[A]))return!1}return!0}function Rh(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function Mh(n,r){var a=Rh(n);n=0;for(var C;a;){if(a.nodeType===3){if(C=n+a.textContent.length,n<=r&&C>=r)return{node:a,offset:r-n};n=C}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Rh(a)}}function Ah(n,r){return n&&r?n===r?!0:n&&n.nodeType===3?!1:r&&r.nodeType===3?Ah(n,r.parentNode):"contains"in n?n.contains(r):n.compareDocumentPosition?!!(n.compareDocumentPosition(r)&16):!1:!1}function Ih(){for(var n=window,r=Ie();r instanceof n.HTMLIFrameElement;){try{var a=typeof r.contentWindow.location.href=="string"}catch{a=!1}if(a)n=r.contentWindow;else break;r=Ie(n.document)}return r}function Pa(n){var r=n&&n.nodeName&&n.nodeName.toLowerCase();return r&&(r==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||r==="textarea"||n.contentEditable==="true")}function o_(n){var r=Ih(),a=n.focusedElem,C=n.selectionRange;if(r!==a&&a&&a.ownerDocument&&Ah(a.ownerDocument.documentElement,a)){if(C!==null&&Pa(a)){if(r=C.start,n=C.end,n===void 0&&(n=r),"selectionStart"in a)a.selectionStart=r,a.selectionEnd=Math.min(n,a.value.length);else if(n=(r=a.ownerDocument||document)&&r.defaultView||window,n.getSelection){n=n.getSelection();var A=a.textContent.length,D=Math.min(C.start,A);C=C.end===void 0?D:Math.min(C.end,A),!n.extend&&D>C&&(A=C,C=D,D=A),A=Mh(a,D);var q=Mh(a,C);A&&q&&(n.rangeCount!==1||n.anchorNode!==A.node||n.anchorOffset!==A.offset||n.focusNode!==q.node||n.focusOffset!==q.offset)&&(r=r.createRange(),r.setStart(A.node,A.offset),n.removeAllRanges(),D>C?(n.addRange(r),n.extend(q.node,q.offset)):(r.setEnd(q.node,q.offset),n.addRange(r)))}}for(r=[],n=a;n=n.parentNode;)n.nodeType===1&&r.push({element:n,left:n.scrollLeft,top:n.scrollTop});for(typeof a.focus=="function"&&a.focus(),a=0;a<r.length;a++)n=r[a],n.element.scrollLeft=n.left,n.element.scrollTop=n.top}}var l_=i&&"documentMode"in document&&11>=document.documentMode,li=null,Oa=null,Yi=null,Ba=!1;function jh(n,r,a){var C=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Ba||li==null||li!==Ie(C)||(C=li,"selectionStart"in C&&Pa(C)?C={start:C.selectionStart,end:C.selectionEnd}:(C=(C.ownerDocument&&C.ownerDocument.defaultView||window).getSelection(),C={anchorNode:C.anchorNode,anchorOffset:C.anchorOffset,focusNode:C.focusNode,focusOffset:C.focusOffset}),Yi&&Gi(Yi,C)||(Yi=C,C=ol(Oa,"onSelect"),0<C.length&&(r=new Hi("onSelect","select",null,r,a),n.push({event:r,listeners:C}),r.target=li)))}function rl(n,r){var a={};return a[n.toLowerCase()]=r.toLowerCase(),a["Webkit"+n]="webkit"+r,a["Moz"+n]="moz"+r,a}var ai={animationend:rl("Animation","AnimationEnd"),animationiteration:rl("Animation","AnimationIteration"),animationstart:rl("Animation","AnimationStart"),transitionend:rl("Transition","TransitionEnd")},Fa={},Dh={};i&&(Dh=document.createElement("div").style,"AnimationEvent"in window||(delete ai.animationend.animation,delete ai.animationiteration.animation,delete ai.animationstart.animation),"TransitionEvent"in window||delete ai.transitionend.transition);function sl(n){if(Fa[n])return Fa[n];if(!ai[n])return n;var r=ai[n],a;for(a in r)if(r.hasOwnProperty(a)&&a in Dh)return Fa[n]=r[a];return n}var Ph=sl("animationend"),Oh=sl("animationiteration"),Bh=sl("animationstart"),Fh=sl("transitionend"),Hh=new Map,Uh="abort auxClick 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(" ");function Gr(n,r){Hh.set(n,r),k(r,[n])}for(var Ha=0;Ha<Uh.length;Ha++){var Ua=Uh[Ha],a_=Ua.toLowerCase(),c_=Ua[0].toUpperCase()+Ua.slice(1);Gr(a_,"on"+c_)}Gr(Ph,"onAnimationEnd"),Gr(Oh,"onAnimationIteration"),Gr(Bh,"onAnimationStart"),Gr("dblclick","onDoubleClick"),Gr("focusin","onFocus"),Gr("focusout","onBlur"),Gr(Fh,"onTransitionEnd"),y("onMouseEnter",["mouseout","mouseover"]),y("onMouseLeave",["mouseout","mouseover"]),y("onPointerEnter",["pointerout","pointerover"]),y("onPointerLeave",["pointerout","pointerover"]),k("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),k("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),k("onBeforeInput",["compositionend","keypress","textInput","paste"]),k("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),k("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),k("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Xi="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(" "),u_=new Set("cancel close invalid load scroll toggle".split(" ").concat(Xi));function $h(n,r,a){var C=n.type||"unknown-event";n.currentTarget=a,ps(C,r,void 0,n),n.currentTarget=null}function Wh(n,r){r=(r&4)!==0;for(var a=0;a<n.length;a++){var C=n[a],A=C.event;C=C.listeners;e:{var D=void 0;if(r)for(var q=C.length-1;0<=q;q--){var Q=C[q],ne=Q.instance,de=Q.currentTarget;if(Q=Q.listener,ne!==D&&A.isPropagationStopped())break e;$h(A,Q,de),D=ne}else for(q=0;q<C.length;q++){if(Q=C[q],ne=Q.instance,de=Q.currentTarget,Q=Q.listener,ne!==D&&A.isPropagationStopped())break e;$h(A,Q,de),D=ne}}}if(_n)throw n=En,_n=!1,En=null,n}function Rt(n,r){var a=r[Ya];a===void 0&&(a=r[Ya]=new Set);var C=n+"__bubble";a.has(C)||(zh(r,n,2,!1),a.add(C))}function $a(n,r,a){var C=0;r&&(C|=4),zh(a,n,C,r)}var il="_reactListening"+Math.random().toString(36).slice(2);function Qi(n){if(!n[il]){n[il]=!0,l.forEach(function(a){a!=="selectionchange"&&(u_.has(a)||$a(a,!1,n),$a(a,!0,n))});var r=n.nodeType===9?n:n.ownerDocument;r===null||r[il]||(r[il]=!0,$a("selectionchange",!1,r))}}function zh(n,r,a,C){switch(Fi(r)){case 1:var A=$o;break;case 4:A=Wo;break;default:A=Gs}a=A.bind(null,r,a,n),A=void 0,!mt||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(A=!0),C?A!==void 0?n.addEventListener(r,a,{capture:!0,passive:A}):n.addEventListener(r,a,!0):A!==void 0?n.addEventListener(r,a,{passive:A}):n.addEventListener(r,a,!1)}function Wa(n,r,a,C,A){var D=C;if((r&1)===0&&(r&2)===0&&C!==null)e:for(;;){if(C===null)return;var q=C.tag;if(q===3||q===4){var Q=C.stateNode.containerInfo;if(Q===A||Q.nodeType===8&&Q.parentNode===A)break;if(q===4)for(q=C.return;q!==null;){var ne=q.tag;if((ne===3||ne===4)&&(ne=q.stateNode.containerInfo,ne===A||ne.nodeType===8&&ne.parentNode===A))return;q=q.return}for(;Q!==null;){if(q=Es(Q),q===null)return;if(ne=q.tag,ne===5||ne===6){C=D=q;continue e}Q=Q.parentNode}}C=C.return}pt(function(){var de=D,Ee=pe(a),Le=[];e:{var xe=Hh.get(n);if(xe!==void 0){var Be=Hi,We=n;switch(n){case"keypress":if(Js(a)===0)break e;case"keydown":case"keyup":Be=Na;break;case"focusin":We="focus",Be=ni;break;case"focusout":We="blur",Be=ni;break;case"beforeblur":case"afterblur":Be=ni;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Be=qo;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Be=ka;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Be=Go;break;case Ph:case Oh:case Bh:Be=Sa;break;case Fh:Be=Ia;break;case"scroll":Be=ba;break;case"wheel":Be=Yo;break;case"copy":case"cut":case"paste":Be=xa;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Be=ii}var ze=(r&4)!==0,Wt=!ze&&n==="scroll",le=ze?xe!==null?xe+"Capture":null:xe;ze=[];for(var re=de,ae;re!==null;){ae=re;var Ae=ae.stateNode;if(ae.tag===5&&Ae!==null&&(ae=Ae,le!==null&&(Ae=Ke(re,le),Ae!=null&&ze.push(Ji(re,Ae,ae)))),Wt)break;re=re.return}0<ze.length&&(xe=new Be(xe,We,null,a,Ee),Le.push({event:xe,listeners:ze}))}}if((r&7)===0){e:{if(xe=n==="mouseover"||n==="pointerover",Be=n==="mouseout"||n==="pointerout",xe&&a!==Ft&&(We=a.relatedTarget||a.fromElement)&&(Es(We)||We[Cr]))break e;if((Be||xe)&&(xe=Ee.window===Ee?Ee:(xe=Ee.ownerDocument)?xe.defaultView||xe.parentWindow:window,Be?(We=a.relatedTarget||a.toElement,Be=de,We=We?Es(We):null,We!==null&&(Wt=Gt(We),We!==Wt||We.tag!==5&&We.tag!==6)&&(We=null)):(Be=null,We=de),Be!==We)){if(ze=qo,Ae="onMouseLeave",le="onMouseEnter",re="mouse",(n==="pointerout"||n==="pointerover")&&(ze=ii,Ae="onPointerLeave",le="onPointerEnter",re="pointer"),Wt=Be==null?xe:hi(Be),ae=We==null?xe:hi(We),xe=new ze(Ae,re+"leave",Be,a,Ee),xe.target=Wt,xe.relatedTarget=ae,Ae=null,Es(Ee)===de&&(ze=new ze(le,re+"enter",We,a,Ee),ze.target=ae,ze.relatedTarget=Wt,Ae=ze),Wt=Ae,Be&&We)t:{for(ze=Be,le=We,re=0,ae=ze;ae;ae=ci(ae))re++;for(ae=0,Ae=le;Ae;Ae=ci(Ae))ae++;for(;0<re-ae;)ze=ci(ze),re--;for(;0<ae-re;)le=ci(le),ae--;for(;re--;){if(ze===le||le!==null&&ze===le.alternate)break t;ze=ci(ze),le=ci(le)}ze=null}else ze=null;Be!==null&&qh(Le,xe,Be,ze,!1),We!==null&&Wt!==null&&qh(Le,Wt,We,ze,!0)}}e:{if(xe=de?hi(de):window,Be=xe.nodeName&&xe.nodeName.toLowerCase(),Be==="select"||Be==="input"&&xe.type==="file")var Ge=J;else if(tl(xe))if(ke)Ge=s_;else{Ge=n_;var rt=t_}else(Be=xe.nodeName)&&Be.toLowerCase()==="input"&&(xe.type==="checkbox"||xe.type==="radio")&&(Ge=r_);if(Ge&&(Ge=Ge(n,de))){Ki(Le,Ge,a,Ee);break e}rt&&rt(n,xe,de),n==="focusout"&&(rt=xe._wrapperState)&&rt.controlled&&xe.type==="number"&&dt(xe,"number",xe.value)}switch(rt=de?hi(de):window,n){case"focusin":(tl(rt)||rt.contentEditable==="true")&&(li=rt,Oa=de,Yi=null);break;case"focusout":Yi=Oa=li=null;break;case"mousedown":Ba=!0;break;case"contextmenu":case"mouseup":case"dragend":Ba=!1,jh(Le,a,Ee);break;case"selectionchange":if(l_)break;case"keydown":case"keyup":jh(Le,a,Ee)}var st;if(Wi)e:{switch(n){case"compositionstart":var at="onCompositionStart";break e;case"compositionend":at="onCompositionEnd";break e;case"compositionupdate":at="onCompositionUpdate";break e}at=void 0}else kr?qi(n,a)&&(at="onCompositionEnd"):n==="keydown"&&a.keyCode===229&&(at="onCompositionStart");at&&(oi&&a.locale!=="ko"&&(kr||at!=="onCompositionStart"?at==="onCompositionEnd"&&kr&&(st=Qs()):(sn=Ee,Xs="value"in sn?sn.value:sn.textContent,kr=!0)),rt=ol(de,at),0<rt.length&&(at=new $i(at,n,null,a,Ee),Le.push({event:at,listeners:rt}),st?at.data=st:(st=Vi(a),st!==null&&(at.data=st)))),(st=Xo?Jo(n,a):Zo(n,a))&&(de=ol(de,"onBeforeInput"),0<de.length&&(Ee=new $i("onBeforeInput","beforeinput",null,a,Ee),Le.push({event:Ee,listeners:de}),Ee.data=st))}Wh(Le,r)})}function Ji(n,r,a){return{instance:n,listener:r,currentTarget:a}}function ol(n,r){for(var a=r+"Capture",C=[];n!==null;){var A=n,D=A.stateNode;A.tag===5&&D!==null&&(A=D,D=Ke(n,a),D!=null&&C.unshift(Ji(n,D,A)),D=Ke(n,r),D!=null&&C.push(Ji(n,D,A))),n=n.return}return C}function ci(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5);return n||null}function qh(n,r,a,C,A){for(var D=r._reactName,q=[];a!==null&&a!==C;){var Q=a,ne=Q.alternate,de=Q.stateNode;if(ne!==null&&ne===C)break;Q.tag===5&&de!==null&&(Q=de,A?(ne=Ke(a,D),ne!=null&&q.unshift(Ji(a,ne,Q))):A||(ne=Ke(a,D),ne!=null&&q.push(Ji(a,ne,Q)))),a=a.return}q.length!==0&&n.push({event:r,listeners:q})}var h_=/\r\n?/g,d_=/\u0000|\uFFFD/g;function Vh(n){return(typeof n=="string"?n:""+n).replace(h_,`
|
|
38
|
+
`).replace(d_,"")}function ll(n,r,a){if(r=Vh(r),Vh(n)!==r&&a)throw Error(s(425))}function al(){}var za=null,qa=null;function Va(n,r){return n==="textarea"||n==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var Ka=typeof setTimeout=="function"?setTimeout:void 0,f_=typeof clearTimeout=="function"?clearTimeout:void 0,Kh=typeof Promise=="function"?Promise:void 0,p_=typeof queueMicrotask=="function"?queueMicrotask:typeof Kh<"u"?function(n){return Kh.resolve(null).then(n).catch(m_)}:Ka;function m_(n){setTimeout(function(){throw n})}function Ga(n,r){var a=r,C=0;do{var A=a.nextSibling;if(n.removeChild(a),A&&A.nodeType===8)if(a=A.data,a==="/$"){if(C===0){n.removeChild(A),yr(r);return}C--}else a!=="$"&&a!=="$?"&&a!=="$!"||C++;a=A}while(a);yr(r)}function Yr(n){for(;n!=null;n=n.nextSibling){var r=n.nodeType;if(r===1||r===3)break;if(r===8){if(r=n.data,r==="$"||r==="$!"||r==="$?")break;if(r==="/$")return null}}return n}function Gh(n){n=n.previousSibling;for(var r=0;n;){if(n.nodeType===8){var a=n.data;if(a==="$"||a==="$!"||a==="$?"){if(r===0)return n;r--}else a==="/$"&&r++}n=n.previousSibling}return null}var ui=Math.random().toString(36).slice(2),ar="__reactFiber$"+ui,Zi="__reactProps$"+ui,Cr="__reactContainer$"+ui,Ya="__reactEvents$"+ui,g_="__reactListeners$"+ui,v_="__reactHandles$"+ui;function Es(n){var r=n[ar];if(r)return r;for(var a=n.parentNode;a;){if(r=a[Cr]||a[ar]){if(a=r.alternate,r.child!==null||a!==null&&a.child!==null)for(n=Gh(n);n!==null;){if(a=n[ar])return a;n=Gh(n)}return r}n=a,a=n.parentNode}return null}function eo(n){return n=n[ar]||n[Cr],!n||n.tag!==5&&n.tag!==6&&n.tag!==13&&n.tag!==3?null:n}function hi(n){if(n.tag===5||n.tag===6)return n.stateNode;throw Error(s(33))}function cl(n){return n[Zi]||null}var Xa=[],di=-1;function Xr(n){return{current:n}}function Mt(n){0>di||(n.current=Xa[di],Xa[di]=null,di--)}function Lt(n,r){di++,Xa[di]=n.current,n.current=r}var Qr={},ln=Xr(Qr),yn=Xr(!1),Ts=Qr;function fi(n,r){var a=n.type.contextTypes;if(!a)return Qr;var C=n.stateNode;if(C&&C.__reactInternalMemoizedUnmaskedChildContext===r)return C.__reactInternalMemoizedMaskedChildContext;var A={},D;for(D in a)A[D]=r[D];return C&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=r,n.__reactInternalMemoizedMaskedChildContext=A),A}function bn(n){return n=n.childContextTypes,n!=null}function ul(){Mt(yn),Mt(ln)}function Yh(n,r,a){if(ln.current!==Qr)throw Error(s(168));Lt(ln,r),Lt(yn,a)}function Xh(n,r,a){var C=n.stateNode;if(r=r.childContextTypes,typeof C.getChildContext!="function")return a;C=C.getChildContext();for(var A in C)if(!(A in r))throw Error(s(108,X(n)||"Unknown",A));return H({},a,C)}function hl(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||Qr,Ts=ln.current,Lt(ln,n),Lt(yn,yn.current),!0}function Qh(n,r,a){var C=n.stateNode;if(!C)throw Error(s(169));a?(n=Xh(n,r,Ts),C.__reactInternalMemoizedMergedChildContext=n,Mt(yn),Mt(ln),Lt(ln,n)):Mt(yn),Lt(yn,a)}var Sr=null,dl=!1,Qa=!1;function Jh(n){Sr===null?Sr=[n]:Sr.push(n)}function __(n){dl=!0,Jh(n)}function Jr(){if(!Qa&&Sr!==null){Qa=!0;var n=0,r=vt;try{var a=Sr;for(vt=1;n<a.length;n++){var C=a[n];do C=C(!0);while(C!==null)}Sr=null,dl=!1}catch(A){throw Sr!==null&&(Sr=Sr.slice(n+1)),Dr(gs,Jr),A}finally{vt=r,Qa=!1}}return null}var pi=[],mi=0,fl=null,pl=0,Pn=[],On=0,Ls=null,xr=1,Er="";function Ns(n,r){pi[mi++]=pl,pi[mi++]=fl,fl=n,pl=r}function Zh(n,r,a){Pn[On++]=xr,Pn[On++]=Er,Pn[On++]=Ls,Ls=n;var C=xr;n=Er;var A=32-lt(C)-1;C&=~(1<<A),a+=1;var D=32-lt(r)+A;if(30<D){var q=A-A%5;D=(C&(1<<q)-1).toString(32),C>>=q,A-=q,xr=1<<32-lt(r)+A|a<<A|C,Er=D+n}else xr=1<<D|a<<A|C,Er=n}function Ja(n){n.return!==null&&(Ns(n,1),Zh(n,1,0))}function Za(n){for(;n===fl;)fl=pi[--mi],pi[mi]=null,pl=pi[--mi],pi[mi]=null;for(;n===Ls;)Ls=Pn[--On],Pn[On]=null,Er=Pn[--On],Pn[On]=null,xr=Pn[--On],Pn[On]=null}var Nn=null,Rn=null,Dt=!1,Xn=null;function ed(n,r){var a=Un(5,null,null,0);a.elementType="DELETED",a.stateNode=r,a.return=n,r=n.deletions,r===null?(n.deletions=[a],n.flags|=16):r.push(a)}function td(n,r){switch(n.tag){case 5:var a=n.type;return r=r.nodeType!==1||a.toLowerCase()!==r.nodeName.toLowerCase()?null:r,r!==null?(n.stateNode=r,Nn=n,Rn=Yr(r.firstChild),!0):!1;case 6:return r=n.pendingProps===""||r.nodeType!==3?null:r,r!==null?(n.stateNode=r,Nn=n,Rn=null,!0):!1;case 13:return r=r.nodeType!==8?null:r,r!==null?(a=Ls!==null?{id:xr,overflow:Er}:null,n.memoizedState={dehydrated:r,treeContext:a,retryLane:1073741824},a=Un(18,null,null,0),a.stateNode=r,a.return=n,n.child=a,Nn=n,Rn=null,!0):!1;default:return!1}}function ec(n){return(n.mode&1)!==0&&(n.flags&128)===0}function tc(n){if(Dt){var r=Rn;if(r){var a=r;if(!td(n,r)){if(ec(n))throw Error(s(418));r=Yr(a.nextSibling);var C=Nn;r&&td(n,r)?ed(C,a):(n.flags=n.flags&-4097|2,Dt=!1,Nn=n)}}else{if(ec(n))throw Error(s(418));n.flags=n.flags&-4097|2,Dt=!1,Nn=n}}}function nd(n){for(n=n.return;n!==null&&n.tag!==5&&n.tag!==3&&n.tag!==13;)n=n.return;Nn=n}function ml(n){if(n!==Nn)return!1;if(!Dt)return nd(n),Dt=!0,!1;var r;if((r=n.tag!==3)&&!(r=n.tag!==5)&&(r=n.type,r=r!=="head"&&r!=="body"&&!Va(n.type,n.memoizedProps)),r&&(r=Rn)){if(ec(n))throw rd(),Error(s(418));for(;r;)ed(n,r),r=Yr(r.nextSibling)}if(nd(n),n.tag===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));e:{for(n=n.nextSibling,r=0;n;){if(n.nodeType===8){var a=n.data;if(a==="/$"){if(r===0){Rn=Yr(n.nextSibling);break e}r--}else a!=="$"&&a!=="$!"&&a!=="$?"||r++}n=n.nextSibling}Rn=null}}else Rn=Nn?Yr(n.stateNode.nextSibling):null;return!0}function rd(){for(var n=Rn;n;)n=Yr(n.nextSibling)}function gi(){Rn=Nn=null,Dt=!1}function nc(n){Xn===null?Xn=[n]:Xn.push(n)}var w_=E.ReactCurrentBatchConfig;function to(n,r,a){if(n=a.ref,n!==null&&typeof n!="function"&&typeof n!="object"){if(a._owner){if(a=a._owner,a){if(a.tag!==1)throw Error(s(309));var C=a.stateNode}if(!C)throw Error(s(147,n));var A=C,D=""+n;return r!==null&&r.ref!==null&&typeof r.ref=="function"&&r.ref._stringRef===D?r.ref:(r=function(q){var Q=A.refs;q===null?delete Q[D]:Q[D]=q},r._stringRef=D,r)}if(typeof n!="string")throw Error(s(284));if(!a._owner)throw Error(s(290,n))}return n}function gl(n,r){throw n=Object.prototype.toString.call(r),Error(s(31,n==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":n))}function sd(n){var r=n._init;return r(n._payload)}function id(n){function r(le,re){if(n){var ae=le.deletions;ae===null?(le.deletions=[re],le.flags|=16):ae.push(re)}}function a(le,re){if(!n)return null;for(;re!==null;)r(le,re),re=re.sibling;return null}function C(le,re){for(le=new Map;re!==null;)re.key!==null?le.set(re.key,re):le.set(re.index,re),re=re.sibling;return le}function A(le,re){return le=os(le,re),le.index=0,le.sibling=null,le}function D(le,re,ae){return le.index=ae,n?(ae=le.alternate,ae!==null?(ae=ae.index,ae<re?(le.flags|=2,re):ae):(le.flags|=2,re)):(le.flags|=1048576,re)}function q(le){return n&&le.alternate===null&&(le.flags|=2),le}function Q(le,re,ae,Ae){return re===null||re.tag!==6?(re=Kc(ae,le.mode,Ae),re.return=le,re):(re=A(re,ae),re.return=le,re)}function ne(le,re,ae,Ae){var Ge=ae.type;return Ge===R?Ee(le,re,ae.props.children,Ae,ae.key):re!==null&&(re.elementType===Ge||typeof Ge=="object"&&Ge!==null&&Ge.$$typeof===K&&sd(Ge)===re.type)?(Ae=A(re,ae.props),Ae.ref=to(le,re,ae),Ae.return=le,Ae):(Ae=Hl(ae.type,ae.key,ae.props,null,le.mode,Ae),Ae.ref=to(le,re,ae),Ae.return=le,Ae)}function de(le,re,ae,Ae){return re===null||re.tag!==4||re.stateNode.containerInfo!==ae.containerInfo||re.stateNode.implementation!==ae.implementation?(re=Gc(ae,le.mode,Ae),re.return=le,re):(re=A(re,ae.children||[]),re.return=le,re)}function Ee(le,re,ae,Ae,Ge){return re===null||re.tag!==7?(re=Os(ae,le.mode,Ae,Ge),re.return=le,re):(re=A(re,ae),re.return=le,re)}function Le(le,re,ae){if(typeof re=="string"&&re!==""||typeof re=="number")return re=Kc(""+re,le.mode,ae),re.return=le,re;if(typeof re=="object"&&re!==null){switch(re.$$typeof){case j:return ae=Hl(re.type,re.key,re.props,null,le.mode,ae),ae.ref=to(le,null,re),ae.return=le,ae;case x:return re=Gc(re,le.mode,ae),re.return=le,re;case K:var Ae=re._init;return Le(le,Ae(re._payload),ae)}if(se(re)||F(re))return re=Os(re,le.mode,ae,null),re.return=le,re;gl(le,re)}return null}function xe(le,re,ae,Ae){var Ge=re!==null?re.key:null;if(typeof ae=="string"&&ae!==""||typeof ae=="number")return Ge!==null?null:Q(le,re,""+ae,Ae);if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case j:return ae.key===Ge?ne(le,re,ae,Ae):null;case x:return ae.key===Ge?de(le,re,ae,Ae):null;case K:return Ge=ae._init,xe(le,re,Ge(ae._payload),Ae)}if(se(ae)||F(ae))return Ge!==null?null:Ee(le,re,ae,Ae,null);gl(le,ae)}return null}function Be(le,re,ae,Ae,Ge){if(typeof Ae=="string"&&Ae!==""||typeof Ae=="number")return le=le.get(ae)||null,Q(re,le,""+Ae,Ge);if(typeof Ae=="object"&&Ae!==null){switch(Ae.$$typeof){case j:return le=le.get(Ae.key===null?ae:Ae.key)||null,ne(re,le,Ae,Ge);case x:return le=le.get(Ae.key===null?ae:Ae.key)||null,de(re,le,Ae,Ge);case K:var rt=Ae._init;return Be(le,re,ae,rt(Ae._payload),Ge)}if(se(Ae)||F(Ae))return le=le.get(ae)||null,Ee(re,le,Ae,Ge,null);gl(re,Ae)}return null}function We(le,re,ae,Ae){for(var Ge=null,rt=null,st=re,at=re=0,en=null;st!==null&&at<ae.length;at++){st.index>at?(en=st,st=null):en=st.sibling;var bt=xe(le,st,ae[at],Ae);if(bt===null){st===null&&(st=en);break}n&&st&&bt.alternate===null&&r(le,st),re=D(bt,re,at),rt===null?Ge=bt:rt.sibling=bt,rt=bt,st=en}if(at===ae.length)return a(le,st),Dt&&Ns(le,at),Ge;if(st===null){for(;at<ae.length;at++)st=Le(le,ae[at],Ae),st!==null&&(re=D(st,re,at),rt===null?Ge=st:rt.sibling=st,rt=st);return Dt&&Ns(le,at),Ge}for(st=C(le,st);at<ae.length;at++)en=Be(st,le,at,ae[at],Ae),en!==null&&(n&&en.alternate!==null&&st.delete(en.key===null?at:en.key),re=D(en,re,at),rt===null?Ge=en:rt.sibling=en,rt=en);return n&&st.forEach(function(ls){return r(le,ls)}),Dt&&Ns(le,at),Ge}function ze(le,re,ae,Ae){var Ge=F(ae);if(typeof Ge!="function")throw Error(s(150));if(ae=Ge.call(ae),ae==null)throw Error(s(151));for(var rt=Ge=null,st=re,at=re=0,en=null,bt=ae.next();st!==null&&!bt.done;at++,bt=ae.next()){st.index>at?(en=st,st=null):en=st.sibling;var ls=xe(le,st,bt.value,Ae);if(ls===null){st===null&&(st=en);break}n&&st&&ls.alternate===null&&r(le,st),re=D(ls,re,at),rt===null?Ge=ls:rt.sibling=ls,rt=ls,st=en}if(bt.done)return a(le,st),Dt&&Ns(le,at),Ge;if(st===null){for(;!bt.done;at++,bt=ae.next())bt=Le(le,bt.value,Ae),bt!==null&&(re=D(bt,re,at),rt===null?Ge=bt:rt.sibling=bt,rt=bt);return Dt&&Ns(le,at),Ge}for(st=C(le,st);!bt.done;at++,bt=ae.next())bt=Be(st,le,at,bt.value,Ae),bt!==null&&(n&&bt.alternate!==null&&st.delete(bt.key===null?at:bt.key),re=D(bt,re,at),rt===null?Ge=bt:rt.sibling=bt,rt=bt);return n&&st.forEach(function(J_){return r(le,J_)}),Dt&&Ns(le,at),Ge}function Wt(le,re,ae,Ae){if(typeof ae=="object"&&ae!==null&&ae.type===R&&ae.key===null&&(ae=ae.props.children),typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case j:e:{for(var Ge=ae.key,rt=re;rt!==null;){if(rt.key===Ge){if(Ge=ae.type,Ge===R){if(rt.tag===7){a(le,rt.sibling),re=A(rt,ae.props.children),re.return=le,le=re;break e}}else if(rt.elementType===Ge||typeof Ge=="object"&&Ge!==null&&Ge.$$typeof===K&&sd(Ge)===rt.type){a(le,rt.sibling),re=A(rt,ae.props),re.ref=to(le,rt,ae),re.return=le,le=re;break e}a(le,rt);break}else r(le,rt);rt=rt.sibling}ae.type===R?(re=Os(ae.props.children,le.mode,Ae,ae.key),re.return=le,le=re):(Ae=Hl(ae.type,ae.key,ae.props,null,le.mode,Ae),Ae.ref=to(le,re,ae),Ae.return=le,le=Ae)}return q(le);case x:e:{for(rt=ae.key;re!==null;){if(re.key===rt)if(re.tag===4&&re.stateNode.containerInfo===ae.containerInfo&&re.stateNode.implementation===ae.implementation){a(le,re.sibling),re=A(re,ae.children||[]),re.return=le,le=re;break e}else{a(le,re);break}else r(le,re);re=re.sibling}re=Gc(ae,le.mode,Ae),re.return=le,le=re}return q(le);case K:return rt=ae._init,Wt(le,re,rt(ae._payload),Ae)}if(se(ae))return We(le,re,ae,Ae);if(F(ae))return ze(le,re,ae,Ae);gl(le,ae)}return typeof ae=="string"&&ae!==""||typeof ae=="number"?(ae=""+ae,re!==null&&re.tag===6?(a(le,re.sibling),re=A(re,ae),re.return=le,le=re):(a(le,re),re=Kc(ae,le.mode,Ae),re.return=le,le=re),q(le)):a(le,re)}return Wt}var vi=id(!0),od=id(!1),vl=Xr(null),_l=null,_i=null,rc=null;function sc(){rc=_i=_l=null}function ic(n){var r=vl.current;Mt(vl),n._currentValue=r}function oc(n,r,a){for(;n!==null;){var C=n.alternate;if((n.childLanes&r)!==r?(n.childLanes|=r,C!==null&&(C.childLanes|=r)):C!==null&&(C.childLanes&r)!==r&&(C.childLanes|=r),n===a)break;n=n.return}}function wi(n,r){_l=n,rc=_i=null,n=n.dependencies,n!==null&&n.firstContext!==null&&((n.lanes&r)!==0&&(kn=!0),n.firstContext=null)}function Bn(n){var r=n._currentValue;if(rc!==n)if(n={context:n,memoizedValue:r,next:null},_i===null){if(_l===null)throw Error(s(308));_i=n,_l.dependencies={lanes:0,firstContext:n}}else _i=_i.next=n;return r}var Rs=null;function lc(n){Rs===null?Rs=[n]:Rs.push(n)}function ld(n,r,a,C){var A=r.interleaved;return A===null?(a.next=a,lc(r)):(a.next=A.next,A.next=a),r.interleaved=a,Tr(n,C)}function Tr(n,r){n.lanes|=r;var a=n.alternate;for(a!==null&&(a.lanes|=r),a=n,n=n.return;n!==null;)n.childLanes|=r,a=n.alternate,a!==null&&(a.childLanes|=r),a=n,n=n.return;return a.tag===3?a.stateNode:null}var Zr=!1;function ac(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function ad(n,r){n=n.updateQueue,r.updateQueue===n&&(r.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,effects:n.effects})}function Lr(n,r){return{eventTime:n,lane:r,tag:0,payload:null,callback:null,next:null}}function es(n,r,a){var C=n.updateQueue;if(C===null)return null;if(C=C.shared,(_t&2)!==0){var A=C.pending;return A===null?r.next=r:(r.next=A.next,A.next=r),C.pending=r,Tr(n,a)}return A=C.interleaved,A===null?(r.next=r,lc(C)):(r.next=A.next,A.next=r),C.interleaved=r,Tr(n,a)}function wl(n,r,a){if(r=r.updateQueue,r!==null&&(r=r.shared,(a&4194240)!==0)){var C=r.lanes;C&=n.pendingLanes,a|=C,r.lanes=a,ir(n,a)}}function cd(n,r){var a=n.updateQueue,C=n.alternate;if(C!==null&&(C=C.updateQueue,a===C)){var A=null,D=null;if(a=a.firstBaseUpdate,a!==null){do{var q={eventTime:a.eventTime,lane:a.lane,tag:a.tag,payload:a.payload,callback:a.callback,next:null};D===null?A=D=q:D=D.next=q,a=a.next}while(a!==null);D===null?A=D=r:D=D.next=r}else A=D=r;a={baseState:C.baseState,firstBaseUpdate:A,lastBaseUpdate:D,shared:C.shared,effects:C.effects},n.updateQueue=a;return}n=a.lastBaseUpdate,n===null?a.firstBaseUpdate=r:n.next=r,a.lastBaseUpdate=r}function yl(n,r,a,C){var A=n.updateQueue;Zr=!1;var D=A.firstBaseUpdate,q=A.lastBaseUpdate,Q=A.shared.pending;if(Q!==null){A.shared.pending=null;var ne=Q,de=ne.next;ne.next=null,q===null?D=de:q.next=de,q=ne;var Ee=n.alternate;Ee!==null&&(Ee=Ee.updateQueue,Q=Ee.lastBaseUpdate,Q!==q&&(Q===null?Ee.firstBaseUpdate=de:Q.next=de,Ee.lastBaseUpdate=ne))}if(D!==null){var Le=A.baseState;q=0,Ee=de=ne=null,Q=D;do{var xe=Q.lane,Be=Q.eventTime;if((C&xe)===xe){Ee!==null&&(Ee=Ee.next={eventTime:Be,lane:0,tag:Q.tag,payload:Q.payload,callback:Q.callback,next:null});e:{var We=n,ze=Q;switch(xe=r,Be=a,ze.tag){case 1:if(We=ze.payload,typeof We=="function"){Le=We.call(Be,Le,xe);break e}Le=We;break e;case 3:We.flags=We.flags&-65537|128;case 0:if(We=ze.payload,xe=typeof We=="function"?We.call(Be,Le,xe):We,xe==null)break e;Le=H({},Le,xe);break e;case 2:Zr=!0}}Q.callback!==null&&Q.lane!==0&&(n.flags|=64,xe=A.effects,xe===null?A.effects=[Q]:xe.push(Q))}else Be={eventTime:Be,lane:xe,tag:Q.tag,payload:Q.payload,callback:Q.callback,next:null},Ee===null?(de=Ee=Be,ne=Le):Ee=Ee.next=Be,q|=xe;if(Q=Q.next,Q===null){if(Q=A.shared.pending,Q===null)break;xe=Q,Q=xe.next,xe.next=null,A.lastBaseUpdate=xe,A.shared.pending=null}}while(!0);if(Ee===null&&(ne=Le),A.baseState=ne,A.firstBaseUpdate=de,A.lastBaseUpdate=Ee,r=A.shared.interleaved,r!==null){A=r;do q|=A.lane,A=A.next;while(A!==r)}else D===null&&(A.shared.lanes=0);Is|=q,n.lanes=q,n.memoizedState=Le}}function ud(n,r,a){if(n=r.effects,r.effects=null,n!==null)for(r=0;r<n.length;r++){var C=n[r],A=C.callback;if(A!==null){if(C.callback=null,C=a,typeof A!="function")throw Error(s(191,A));A.call(C)}}}var no={},cr=Xr(no),ro=Xr(no),so=Xr(no);function Ms(n){if(n===no)throw Error(s(174));return n}function cc(n,r){switch(Lt(so,r),Lt(ro,n),Lt(cr,no),n=r.nodeType,n){case 9:case 11:r=(r=r.documentElement)?r.namespaceURI:Fe(null,"");break;default:n=n===8?r.parentNode:r,r=n.namespaceURI||null,n=n.tagName,r=Fe(r,n)}Mt(cr),Lt(cr,r)}function yi(){Mt(cr),Mt(ro),Mt(so)}function hd(n){Ms(so.current);var r=Ms(cr.current),a=Fe(r,n.type);r!==a&&(Lt(ro,n),Lt(cr,a))}function uc(n){ro.current===n&&(Mt(cr),Mt(ro))}var Ot=Xr(0);function bl(n){for(var r=n;r!==null;){if(r.tag===13){var a=r.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||a.data==="$?"||a.data==="$!"))return r}else if(r.tag===19&&r.memoizedProps.revealOrder!==void 0){if((r.flags&128)!==0)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===n)break;for(;r.sibling===null;){if(r.return===null||r.return===n)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}var hc=[];function dc(){for(var n=0;n<hc.length;n++)hc[n]._workInProgressVersionPrimary=null;hc.length=0}var kl=E.ReactCurrentDispatcher,fc=E.ReactCurrentBatchConfig,As=0,Bt=null,Yt=null,Jt=null,Cl=!1,io=!1,oo=0,y_=0;function an(){throw Error(s(321))}function pc(n,r){if(r===null)return!1;for(var a=0;a<r.length&&a<n.length;a++)if(!Yn(n[a],r[a]))return!1;return!0}function mc(n,r,a,C,A,D){if(As=D,Bt=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,kl.current=n===null||n.memoizedState===null?S_:x_,n=a(C,A),io){D=0;do{if(io=!1,oo=0,25<=D)throw Error(s(301));D+=1,Jt=Yt=null,r.updateQueue=null,kl.current=E_,n=a(C,A)}while(io)}if(kl.current=El,r=Yt!==null&&Yt.next!==null,As=0,Jt=Yt=Bt=null,Cl=!1,r)throw Error(s(300));return n}function gc(){var n=oo!==0;return oo=0,n}function ur(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Jt===null?Bt.memoizedState=Jt=n:Jt=Jt.next=n,Jt}function Fn(){if(Yt===null){var n=Bt.alternate;n=n!==null?n.memoizedState:null}else n=Yt.next;var r=Jt===null?Bt.memoizedState:Jt.next;if(r!==null)Jt=r,Yt=n;else{if(n===null)throw Error(s(310));Yt=n,n={memoizedState:Yt.memoizedState,baseState:Yt.baseState,baseQueue:Yt.baseQueue,queue:Yt.queue,next:null},Jt===null?Bt.memoizedState=Jt=n:Jt=Jt.next=n}return Jt}function lo(n,r){return typeof r=="function"?r(n):r}function vc(n){var r=Fn(),a=r.queue;if(a===null)throw Error(s(311));a.lastRenderedReducer=n;var C=Yt,A=C.baseQueue,D=a.pending;if(D!==null){if(A!==null){var q=A.next;A.next=D.next,D.next=q}C.baseQueue=A=D,a.pending=null}if(A!==null){D=A.next,C=C.baseState;var Q=q=null,ne=null,de=D;do{var Ee=de.lane;if((As&Ee)===Ee)ne!==null&&(ne=ne.next={lane:0,action:de.action,hasEagerState:de.hasEagerState,eagerState:de.eagerState,next:null}),C=de.hasEagerState?de.eagerState:n(C,de.action);else{var Le={lane:Ee,action:de.action,hasEagerState:de.hasEagerState,eagerState:de.eagerState,next:null};ne===null?(Q=ne=Le,q=C):ne=ne.next=Le,Bt.lanes|=Ee,Is|=Ee}de=de.next}while(de!==null&&de!==D);ne===null?q=C:ne.next=Q,Yn(C,r.memoizedState)||(kn=!0),r.memoizedState=C,r.baseState=q,r.baseQueue=ne,a.lastRenderedState=C}if(n=a.interleaved,n!==null){A=n;do D=A.lane,Bt.lanes|=D,Is|=D,A=A.next;while(A!==n)}else A===null&&(a.lanes=0);return[r.memoizedState,a.dispatch]}function _c(n){var r=Fn(),a=r.queue;if(a===null)throw Error(s(311));a.lastRenderedReducer=n;var C=a.dispatch,A=a.pending,D=r.memoizedState;if(A!==null){a.pending=null;var q=A=A.next;do D=n(D,q.action),q=q.next;while(q!==A);Yn(D,r.memoizedState)||(kn=!0),r.memoizedState=D,r.baseQueue===null&&(r.baseState=D),a.lastRenderedState=D}return[D,C]}function dd(){}function fd(n,r){var a=Bt,C=Fn(),A=r(),D=!Yn(C.memoizedState,A);if(D&&(C.memoizedState=A,kn=!0),C=C.queue,wc(gd.bind(null,a,C,n),[n]),C.getSnapshot!==r||D||Jt!==null&&Jt.memoizedState.tag&1){if(a.flags|=2048,ao(9,md.bind(null,a,C,A,r),void 0,null),Zt===null)throw Error(s(349));(As&30)!==0||pd(a,r,A)}return A}function pd(n,r,a){n.flags|=16384,n={getSnapshot:r,value:a},r=Bt.updateQueue,r===null?(r={lastEffect:null,stores:null},Bt.updateQueue=r,r.stores=[n]):(a=r.stores,a===null?r.stores=[n]:a.push(n))}function md(n,r,a,C){r.value=a,r.getSnapshot=C,vd(r)&&_d(n)}function gd(n,r,a){return a(function(){vd(r)&&_d(n)})}function vd(n){var r=n.getSnapshot;n=n.value;try{var a=r();return!Yn(n,a)}catch{return!0}}function _d(n){var r=Tr(n,1);r!==null&&er(r,n,1,-1)}function wd(n){var r=ur();return typeof n=="function"&&(n=n()),r.memoizedState=r.baseState=n,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:lo,lastRenderedState:n},r.queue=n,n=n.dispatch=C_.bind(null,Bt,n),[r.memoizedState,n]}function ao(n,r,a,C){return n={tag:n,create:r,destroy:a,deps:C,next:null},r=Bt.updateQueue,r===null?(r={lastEffect:null,stores:null},Bt.updateQueue=r,r.lastEffect=n.next=n):(a=r.lastEffect,a===null?r.lastEffect=n.next=n:(C=a.next,a.next=n,n.next=C,r.lastEffect=n)),n}function yd(){return Fn().memoizedState}function Sl(n,r,a,C){var A=ur();Bt.flags|=n,A.memoizedState=ao(1|r,a,void 0,C===void 0?null:C)}function xl(n,r,a,C){var A=Fn();C=C===void 0?null:C;var D=void 0;if(Yt!==null){var q=Yt.memoizedState;if(D=q.destroy,C!==null&&pc(C,q.deps)){A.memoizedState=ao(r,a,D,C);return}}Bt.flags|=n,A.memoizedState=ao(1|r,a,D,C)}function bd(n,r){return Sl(8390656,8,n,r)}function wc(n,r){return xl(2048,8,n,r)}function kd(n,r){return xl(4,2,n,r)}function Cd(n,r){return xl(4,4,n,r)}function Sd(n,r){if(typeof r=="function")return n=n(),r(n),function(){r(null)};if(r!=null)return n=n(),r.current=n,function(){r.current=null}}function xd(n,r,a){return a=a!=null?a.concat([n]):null,xl(4,4,Sd.bind(null,r,n),a)}function yc(){}function Ed(n,r){var a=Fn();r=r===void 0?null:r;var C=a.memoizedState;return C!==null&&r!==null&&pc(r,C[1])?C[0]:(a.memoizedState=[n,r],n)}function Td(n,r){var a=Fn();r=r===void 0?null:r;var C=a.memoizedState;return C!==null&&r!==null&&pc(r,C[1])?C[0]:(n=n(),a.memoizedState=[n,r],n)}function Ld(n,r,a){return(As&21)===0?(n.baseState&&(n.baseState=!1,kn=!0),n.memoizedState=a):(Yn(a,r)||(a=_r(),Bt.lanes|=a,Is|=a,n.baseState=!0),r)}function b_(n,r){var a=vt;vt=a!==0&&4>a?a:4,n(!0);var C=fc.transition;fc.transition={};try{n(!1),r()}finally{vt=a,fc.transition=C}}function Nd(){return Fn().memoizedState}function k_(n,r,a){var C=ss(n);if(a={lane:C,action:a,hasEagerState:!1,eagerState:null,next:null},Rd(n))Md(r,a);else if(a=ld(n,r,a,C),a!==null){var A=vn();er(a,n,C,A),Ad(a,r,C)}}function C_(n,r,a){var C=ss(n),A={lane:C,action:a,hasEagerState:!1,eagerState:null,next:null};if(Rd(n))Md(r,A);else{var D=n.alternate;if(n.lanes===0&&(D===null||D.lanes===0)&&(D=r.lastRenderedReducer,D!==null))try{var q=r.lastRenderedState,Q=D(q,a);if(A.hasEagerState=!0,A.eagerState=Q,Yn(Q,q)){var ne=r.interleaved;ne===null?(A.next=A,lc(r)):(A.next=ne.next,ne.next=A),r.interleaved=A;return}}catch{}finally{}a=ld(n,r,A,C),a!==null&&(A=vn(),er(a,n,C,A),Ad(a,r,C))}}function Rd(n){var r=n.alternate;return n===Bt||r!==null&&r===Bt}function Md(n,r){io=Cl=!0;var a=n.pending;a===null?r.next=r:(r.next=a.next,a.next=r),n.pending=r}function Ad(n,r,a){if((a&4194240)!==0){var C=r.lanes;C&=n.pendingLanes,a|=C,r.lanes=a,ir(n,a)}}var El={readContext:Bn,useCallback:an,useContext:an,useEffect:an,useImperativeHandle:an,useInsertionEffect:an,useLayoutEffect:an,useMemo:an,useReducer:an,useRef:an,useState:an,useDebugValue:an,useDeferredValue:an,useTransition:an,useMutableSource:an,useSyncExternalStore:an,useId:an,unstable_isNewReconciler:!1},S_={readContext:Bn,useCallback:function(n,r){return ur().memoizedState=[n,r===void 0?null:r],n},useContext:Bn,useEffect:bd,useImperativeHandle:function(n,r,a){return a=a!=null?a.concat([n]):null,Sl(4194308,4,Sd.bind(null,r,n),a)},useLayoutEffect:function(n,r){return Sl(4194308,4,n,r)},useInsertionEffect:function(n,r){return Sl(4,2,n,r)},useMemo:function(n,r){var a=ur();return r=r===void 0?null:r,n=n(),a.memoizedState=[n,r],n},useReducer:function(n,r,a){var C=ur();return r=a!==void 0?a(r):r,C.memoizedState=C.baseState=r,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:r},C.queue=n,n=n.dispatch=k_.bind(null,Bt,n),[C.memoizedState,n]},useRef:function(n){var r=ur();return n={current:n},r.memoizedState=n},useState:wd,useDebugValue:yc,useDeferredValue:function(n){return ur().memoizedState=n},useTransition:function(){var n=wd(!1),r=n[0];return n=b_.bind(null,n[1]),ur().memoizedState=n,[r,n]},useMutableSource:function(){},useSyncExternalStore:function(n,r,a){var C=Bt,A=ur();if(Dt){if(a===void 0)throw Error(s(407));a=a()}else{if(a=r(),Zt===null)throw Error(s(349));(As&30)!==0||pd(C,r,a)}A.memoizedState=a;var D={value:a,getSnapshot:r};return A.queue=D,bd(gd.bind(null,C,D,n),[n]),C.flags|=2048,ao(9,md.bind(null,C,D,a,r),void 0,null),a},useId:function(){var n=ur(),r=Zt.identifierPrefix;if(Dt){var a=Er,C=xr;a=(C&~(1<<32-lt(C)-1)).toString(32)+a,r=":"+r+"R"+a,a=oo++,0<a&&(r+="H"+a.toString(32)),r+=":"}else a=y_++,r=":"+r+"r"+a.toString(32)+":";return n.memoizedState=r},unstable_isNewReconciler:!1},x_={readContext:Bn,useCallback:Ed,useContext:Bn,useEffect:wc,useImperativeHandle:xd,useInsertionEffect:kd,useLayoutEffect:Cd,useMemo:Td,useReducer:vc,useRef:yd,useState:function(){return vc(lo)},useDebugValue:yc,useDeferredValue:function(n){var r=Fn();return Ld(r,Yt.memoizedState,n)},useTransition:function(){var n=vc(lo)[0],r=Fn().memoizedState;return[n,r]},useMutableSource:dd,useSyncExternalStore:fd,useId:Nd,unstable_isNewReconciler:!1},E_={readContext:Bn,useCallback:Ed,useContext:Bn,useEffect:wc,useImperativeHandle:xd,useInsertionEffect:kd,useLayoutEffect:Cd,useMemo:Td,useReducer:_c,useRef:yd,useState:function(){return _c(lo)},useDebugValue:yc,useDeferredValue:function(n){var r=Fn();return Yt===null?r.memoizedState=n:Ld(r,Yt.memoizedState,n)},useTransition:function(){var n=_c(lo)[0],r=Fn().memoizedState;return[n,r]},useMutableSource:dd,useSyncExternalStore:fd,useId:Nd,unstable_isNewReconciler:!1};function Qn(n,r){if(n&&n.defaultProps){r=H({},r),n=n.defaultProps;for(var a in n)r[a]===void 0&&(r[a]=n[a]);return r}return r}function bc(n,r,a,C){r=n.memoizedState,a=a(C,r),a=a==null?r:H({},r,a),n.memoizedState=a,n.lanes===0&&(n.updateQueue.baseState=a)}var Tl={isMounted:function(n){return(n=n._reactInternals)?Gt(n)===n:!1},enqueueSetState:function(n,r,a){n=n._reactInternals;var C=vn(),A=ss(n),D=Lr(C,A);D.payload=r,a!=null&&(D.callback=a),r=es(n,D,A),r!==null&&(er(r,n,A,C),wl(r,n,A))},enqueueReplaceState:function(n,r,a){n=n._reactInternals;var C=vn(),A=ss(n),D=Lr(C,A);D.tag=1,D.payload=r,a!=null&&(D.callback=a),r=es(n,D,A),r!==null&&(er(r,n,A,C),wl(r,n,A))},enqueueForceUpdate:function(n,r){n=n._reactInternals;var a=vn(),C=ss(n),A=Lr(a,C);A.tag=2,r!=null&&(A.callback=r),r=es(n,A,C),r!==null&&(er(r,n,C,a),wl(r,n,C))}};function Id(n,r,a,C,A,D,q){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(C,D,q):r.prototype&&r.prototype.isPureReactComponent?!Gi(a,C)||!Gi(A,D):!0}function jd(n,r,a){var C=!1,A=Qr,D=r.contextType;return typeof D=="object"&&D!==null?D=Bn(D):(A=bn(r)?Ts:ln.current,C=r.contextTypes,D=(C=C!=null)?fi(n,A):Qr),r=new r(a,D),n.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,r.updater=Tl,n.stateNode=r,r._reactInternals=n,C&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=A,n.__reactInternalMemoizedMaskedChildContext=D),r}function Dd(n,r,a,C){n=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(a,C),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(a,C),r.state!==n&&Tl.enqueueReplaceState(r,r.state,null)}function kc(n,r,a,C){var A=n.stateNode;A.props=a,A.state=n.memoizedState,A.refs={},ac(n);var D=r.contextType;typeof D=="object"&&D!==null?A.context=Bn(D):(D=bn(r)?Ts:ln.current,A.context=fi(n,D)),A.state=n.memoizedState,D=r.getDerivedStateFromProps,typeof D=="function"&&(bc(n,r,D,a),A.state=n.memoizedState),typeof r.getDerivedStateFromProps=="function"||typeof A.getSnapshotBeforeUpdate=="function"||typeof A.UNSAFE_componentWillMount!="function"&&typeof A.componentWillMount!="function"||(r=A.state,typeof A.componentWillMount=="function"&&A.componentWillMount(),typeof A.UNSAFE_componentWillMount=="function"&&A.UNSAFE_componentWillMount(),r!==A.state&&Tl.enqueueReplaceState(A,A.state,null),yl(n,a,A,C),A.state=n.memoizedState),typeof A.componentDidMount=="function"&&(n.flags|=4194308)}function bi(n,r){try{var a="",C=r;do a+=we(C),C=C.return;while(C);var A=a}catch(D){A=`
|
|
39
|
+
Error generating stack: `+D.message+`
|
|
40
|
+
`+D.stack}return{value:n,source:r,stack:A,digest:null}}function Cc(n,r,a){return{value:n,source:null,stack:a??null,digest:r??null}}function Sc(n,r){try{console.error(r.value)}catch(a){setTimeout(function(){throw a})}}var T_=typeof WeakMap=="function"?WeakMap:Map;function Pd(n,r,a){a=Lr(-1,a),a.tag=3,a.payload={element:null};var C=r.value;return a.callback=function(){jl||(jl=!0,Fc=C),Sc(n,r)},a}function Od(n,r,a){a=Lr(-1,a),a.tag=3;var C=n.type.getDerivedStateFromError;if(typeof C=="function"){var A=r.value;a.payload=function(){return C(A)},a.callback=function(){Sc(n,r)}}var D=n.stateNode;return D!==null&&typeof D.componentDidCatch=="function"&&(a.callback=function(){Sc(n,r),typeof C!="function"&&(ns===null?ns=new Set([this]):ns.add(this));var q=r.stack;this.componentDidCatch(r.value,{componentStack:q!==null?q:""})}),a}function Bd(n,r,a){var C=n.pingCache;if(C===null){C=n.pingCache=new T_;var A=new Set;C.set(r,A)}else A=C.get(r),A===void 0&&(A=new Set,C.set(r,A));A.has(a)||(A.add(a),n=U_.bind(null,n,r,a),r.then(n,n))}function Fd(n){do{var r;if((r=n.tag===13)&&(r=n.memoizedState,r=r!==null?r.dehydrated!==null:!0),r)return n;n=n.return}while(n!==null);return null}function Hd(n,r,a,C,A){return(n.mode&1)===0?(n===r?n.flags|=65536:(n.flags|=128,a.flags|=131072,a.flags&=-52805,a.tag===1&&(a.alternate===null?a.tag=17:(r=Lr(-1,1),r.tag=2,es(a,r,1))),a.lanes|=1),n):(n.flags|=65536,n.lanes=A,n)}var L_=E.ReactCurrentOwner,kn=!1;function gn(n,r,a,C){r.child=n===null?od(r,null,a,C):vi(r,n.child,a,C)}function Ud(n,r,a,C,A){a=a.render;var D=r.ref;return wi(r,A),C=mc(n,r,a,C,D,A),a=gc(),n!==null&&!kn?(r.updateQueue=n.updateQueue,r.flags&=-2053,n.lanes&=~A,Nr(n,r,A)):(Dt&&a&&Ja(r),r.flags|=1,gn(n,r,C,A),r.child)}function $d(n,r,a,C,A){if(n===null){var D=a.type;return typeof D=="function"&&!Vc(D)&&D.defaultProps===void 0&&a.compare===null&&a.defaultProps===void 0?(r.tag=15,r.type=D,Wd(n,r,D,C,A)):(n=Hl(a.type,null,C,r,r.mode,A),n.ref=r.ref,n.return=r,r.child=n)}if(D=n.child,(n.lanes&A)===0){var q=D.memoizedProps;if(a=a.compare,a=a!==null?a:Gi,a(q,C)&&n.ref===r.ref)return Nr(n,r,A)}return r.flags|=1,n=os(D,C),n.ref=r.ref,n.return=r,r.child=n}function Wd(n,r,a,C,A){if(n!==null){var D=n.memoizedProps;if(Gi(D,C)&&n.ref===r.ref)if(kn=!1,r.pendingProps=C=D,(n.lanes&A)!==0)(n.flags&131072)!==0&&(kn=!0);else return r.lanes=n.lanes,Nr(n,r,A)}return xc(n,r,a,C,A)}function zd(n,r,a){var C=r.pendingProps,A=C.children,D=n!==null?n.memoizedState:null;if(C.mode==="hidden")if((r.mode&1)===0)r.memoizedState={baseLanes:0,cachePool:null,transitions:null},Lt(Ci,Mn),Mn|=a;else{if((a&1073741824)===0)return n=D!==null?D.baseLanes|a:a,r.lanes=r.childLanes=1073741824,r.memoizedState={baseLanes:n,cachePool:null,transitions:null},r.updateQueue=null,Lt(Ci,Mn),Mn|=n,null;r.memoizedState={baseLanes:0,cachePool:null,transitions:null},C=D!==null?D.baseLanes:a,Lt(Ci,Mn),Mn|=C}else D!==null?(C=D.baseLanes|a,r.memoizedState=null):C=a,Lt(Ci,Mn),Mn|=C;return gn(n,r,A,a),r.child}function qd(n,r){var a=r.ref;(n===null&&a!==null||n!==null&&n.ref!==a)&&(r.flags|=512,r.flags|=2097152)}function xc(n,r,a,C,A){var D=bn(a)?Ts:ln.current;return D=fi(r,D),wi(r,A),a=mc(n,r,a,C,D,A),C=gc(),n!==null&&!kn?(r.updateQueue=n.updateQueue,r.flags&=-2053,n.lanes&=~A,Nr(n,r,A)):(Dt&&C&&Ja(r),r.flags|=1,gn(n,r,a,A),r.child)}function Vd(n,r,a,C,A){if(bn(a)){var D=!0;hl(r)}else D=!1;if(wi(r,A),r.stateNode===null)Nl(n,r),jd(r,a,C),kc(r,a,C,A),C=!0;else if(n===null){var q=r.stateNode,Q=r.memoizedProps;q.props=Q;var ne=q.context,de=a.contextType;typeof de=="object"&&de!==null?de=Bn(de):(de=bn(a)?Ts:ln.current,de=fi(r,de));var Ee=a.getDerivedStateFromProps,Le=typeof Ee=="function"||typeof q.getSnapshotBeforeUpdate=="function";Le||typeof q.UNSAFE_componentWillReceiveProps!="function"&&typeof q.componentWillReceiveProps!="function"||(Q!==C||ne!==de)&&Dd(r,q,C,de),Zr=!1;var xe=r.memoizedState;q.state=xe,yl(r,C,q,A),ne=r.memoizedState,Q!==C||xe!==ne||yn.current||Zr?(typeof Ee=="function"&&(bc(r,a,Ee,C),ne=r.memoizedState),(Q=Zr||Id(r,a,Q,C,xe,ne,de))?(Le||typeof q.UNSAFE_componentWillMount!="function"&&typeof q.componentWillMount!="function"||(typeof q.componentWillMount=="function"&&q.componentWillMount(),typeof q.UNSAFE_componentWillMount=="function"&&q.UNSAFE_componentWillMount()),typeof q.componentDidMount=="function"&&(r.flags|=4194308)):(typeof q.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=C,r.memoizedState=ne),q.props=C,q.state=ne,q.context=de,C=Q):(typeof q.componentDidMount=="function"&&(r.flags|=4194308),C=!1)}else{q=r.stateNode,ad(n,r),Q=r.memoizedProps,de=r.type===r.elementType?Q:Qn(r.type,Q),q.props=de,Le=r.pendingProps,xe=q.context,ne=a.contextType,typeof ne=="object"&&ne!==null?ne=Bn(ne):(ne=bn(a)?Ts:ln.current,ne=fi(r,ne));var Be=a.getDerivedStateFromProps;(Ee=typeof Be=="function"||typeof q.getSnapshotBeforeUpdate=="function")||typeof q.UNSAFE_componentWillReceiveProps!="function"&&typeof q.componentWillReceiveProps!="function"||(Q!==Le||xe!==ne)&&Dd(r,q,C,ne),Zr=!1,xe=r.memoizedState,q.state=xe,yl(r,C,q,A);var We=r.memoizedState;Q!==Le||xe!==We||yn.current||Zr?(typeof Be=="function"&&(bc(r,a,Be,C),We=r.memoizedState),(de=Zr||Id(r,a,de,C,xe,We,ne)||!1)?(Ee||typeof q.UNSAFE_componentWillUpdate!="function"&&typeof q.componentWillUpdate!="function"||(typeof q.componentWillUpdate=="function"&&q.componentWillUpdate(C,We,ne),typeof q.UNSAFE_componentWillUpdate=="function"&&q.UNSAFE_componentWillUpdate(C,We,ne)),typeof q.componentDidUpdate=="function"&&(r.flags|=4),typeof q.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof q.componentDidUpdate!="function"||Q===n.memoizedProps&&xe===n.memoizedState||(r.flags|=4),typeof q.getSnapshotBeforeUpdate!="function"||Q===n.memoizedProps&&xe===n.memoizedState||(r.flags|=1024),r.memoizedProps=C,r.memoizedState=We),q.props=C,q.state=We,q.context=ne,C=de):(typeof q.componentDidUpdate!="function"||Q===n.memoizedProps&&xe===n.memoizedState||(r.flags|=4),typeof q.getSnapshotBeforeUpdate!="function"||Q===n.memoizedProps&&xe===n.memoizedState||(r.flags|=1024),C=!1)}return Ec(n,r,a,C,D,A)}function Ec(n,r,a,C,A,D){qd(n,r);var q=(r.flags&128)!==0;if(!C&&!q)return A&&Qh(r,a,!1),Nr(n,r,D);C=r.stateNode,L_.current=r;var Q=q&&typeof a.getDerivedStateFromError!="function"?null:C.render();return r.flags|=1,n!==null&&q?(r.child=vi(r,n.child,null,D),r.child=vi(r,null,Q,D)):gn(n,r,Q,D),r.memoizedState=C.state,A&&Qh(r,a,!0),r.child}function Kd(n){var r=n.stateNode;r.pendingContext?Yh(n,r.pendingContext,r.pendingContext!==r.context):r.context&&Yh(n,r.context,!1),cc(n,r.containerInfo)}function Gd(n,r,a,C,A){return gi(),nc(A),r.flags|=256,gn(n,r,a,C),r.child}var Tc={dehydrated:null,treeContext:null,retryLane:0};function Lc(n){return{baseLanes:n,cachePool:null,transitions:null}}function Yd(n,r,a){var C=r.pendingProps,A=Ot.current,D=!1,q=(r.flags&128)!==0,Q;if((Q=q)||(Q=n!==null&&n.memoizedState===null?!1:(A&2)!==0),Q?(D=!0,r.flags&=-129):(n===null||n.memoizedState!==null)&&(A|=1),Lt(Ot,A&1),n===null)return tc(r),n=r.memoizedState,n!==null&&(n=n.dehydrated,n!==null)?((r.mode&1)===0?r.lanes=1:n.data==="$!"?r.lanes=8:r.lanes=1073741824,null):(q=C.children,n=C.fallback,D?(C=r.mode,D=r.child,q={mode:"hidden",children:q},(C&1)===0&&D!==null?(D.childLanes=0,D.pendingProps=q):D=Ul(q,C,0,null),n=Os(n,C,a,null),D.return=r,n.return=r,D.sibling=n,r.child=D,r.child.memoizedState=Lc(a),r.memoizedState=Tc,n):Nc(r,q));if(A=n.memoizedState,A!==null&&(Q=A.dehydrated,Q!==null))return N_(n,r,q,C,Q,A,a);if(D){D=C.fallback,q=r.mode,A=n.child,Q=A.sibling;var ne={mode:"hidden",children:C.children};return(q&1)===0&&r.child!==A?(C=r.child,C.childLanes=0,C.pendingProps=ne,r.deletions=null):(C=os(A,ne),C.subtreeFlags=A.subtreeFlags&14680064),Q!==null?D=os(Q,D):(D=Os(D,q,a,null),D.flags|=2),D.return=r,C.return=r,C.sibling=D,r.child=C,C=D,D=r.child,q=n.child.memoizedState,q=q===null?Lc(a):{baseLanes:q.baseLanes|a,cachePool:null,transitions:q.transitions},D.memoizedState=q,D.childLanes=n.childLanes&~a,r.memoizedState=Tc,C}return D=n.child,n=D.sibling,C=os(D,{mode:"visible",children:C.children}),(r.mode&1)===0&&(C.lanes=a),C.return=r,C.sibling=null,n!==null&&(a=r.deletions,a===null?(r.deletions=[n],r.flags|=16):a.push(n)),r.child=C,r.memoizedState=null,C}function Nc(n,r){return r=Ul({mode:"visible",children:r},n.mode,0,null),r.return=n,n.child=r}function Ll(n,r,a,C){return C!==null&&nc(C),vi(r,n.child,null,a),n=Nc(r,r.pendingProps.children),n.flags|=2,r.memoizedState=null,n}function N_(n,r,a,C,A,D,q){if(a)return r.flags&256?(r.flags&=-257,C=Cc(Error(s(422))),Ll(n,r,q,C)):r.memoizedState!==null?(r.child=n.child,r.flags|=128,null):(D=C.fallback,A=r.mode,C=Ul({mode:"visible",children:C.children},A,0,null),D=Os(D,A,q,null),D.flags|=2,C.return=r,D.return=r,C.sibling=D,r.child=C,(r.mode&1)!==0&&vi(r,n.child,null,q),r.child.memoizedState=Lc(q),r.memoizedState=Tc,D);if((r.mode&1)===0)return Ll(n,r,q,null);if(A.data==="$!"){if(C=A.nextSibling&&A.nextSibling.dataset,C)var Q=C.dgst;return C=Q,D=Error(s(419)),C=Cc(D,C,void 0),Ll(n,r,q,C)}if(Q=(q&n.childLanes)!==0,kn||Q){if(C=Zt,C!==null){switch(q&-q){case 4:A=2;break;case 16:A=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:A=32;break;case 536870912:A=268435456;break;default:A=0}A=(A&(C.suspendedLanes|q))!==0?0:A,A!==0&&A!==D.retryLane&&(D.retryLane=A,Tr(n,A),er(C,n,A,-1))}return qc(),C=Cc(Error(s(421))),Ll(n,r,q,C)}return A.data==="$?"?(r.flags|=128,r.child=n.child,r=$_.bind(null,n),A._reactRetry=r,null):(n=D.treeContext,Rn=Yr(A.nextSibling),Nn=r,Dt=!0,Xn=null,n!==null&&(Pn[On++]=xr,Pn[On++]=Er,Pn[On++]=Ls,xr=n.id,Er=n.overflow,Ls=r),r=Nc(r,C.children),r.flags|=4096,r)}function Xd(n,r,a){n.lanes|=r;var C=n.alternate;C!==null&&(C.lanes|=r),oc(n.return,r,a)}function Rc(n,r,a,C,A){var D=n.memoizedState;D===null?n.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:C,tail:a,tailMode:A}:(D.isBackwards=r,D.rendering=null,D.renderingStartTime=0,D.last=C,D.tail=a,D.tailMode=A)}function Qd(n,r,a){var C=r.pendingProps,A=C.revealOrder,D=C.tail;if(gn(n,r,C.children,a),C=Ot.current,(C&2)!==0)C=C&1|2,r.flags|=128;else{if(n!==null&&(n.flags&128)!==0)e:for(n=r.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&Xd(n,a,r);else if(n.tag===19)Xd(n,a,r);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===r)break e;for(;n.sibling===null;){if(n.return===null||n.return===r)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}C&=1}if(Lt(Ot,C),(r.mode&1)===0)r.memoizedState=null;else switch(A){case"forwards":for(a=r.child,A=null;a!==null;)n=a.alternate,n!==null&&bl(n)===null&&(A=a),a=a.sibling;a=A,a===null?(A=r.child,r.child=null):(A=a.sibling,a.sibling=null),Rc(r,!1,A,a,D);break;case"backwards":for(a=null,A=r.child,r.child=null;A!==null;){if(n=A.alternate,n!==null&&bl(n)===null){r.child=A;break}n=A.sibling,A.sibling=a,a=A,A=n}Rc(r,!0,a,null,D);break;case"together":Rc(r,!1,null,null,void 0);break;default:r.memoizedState=null}return r.child}function Nl(n,r){(r.mode&1)===0&&n!==null&&(n.alternate=null,r.alternate=null,r.flags|=2)}function Nr(n,r,a){if(n!==null&&(r.dependencies=n.dependencies),Is|=r.lanes,(a&r.childLanes)===0)return null;if(n!==null&&r.child!==n.child)throw Error(s(153));if(r.child!==null){for(n=r.child,a=os(n,n.pendingProps),r.child=a,a.return=r;n.sibling!==null;)n=n.sibling,a=a.sibling=os(n,n.pendingProps),a.return=r;a.sibling=null}return r.child}function R_(n,r,a){switch(r.tag){case 3:Kd(r),gi();break;case 5:hd(r);break;case 1:bn(r.type)&&hl(r);break;case 4:cc(r,r.stateNode.containerInfo);break;case 10:var C=r.type._context,A=r.memoizedProps.value;Lt(vl,C._currentValue),C._currentValue=A;break;case 13:if(C=r.memoizedState,C!==null)return C.dehydrated!==null?(Lt(Ot,Ot.current&1),r.flags|=128,null):(a&r.child.childLanes)!==0?Yd(n,r,a):(Lt(Ot,Ot.current&1),n=Nr(n,r,a),n!==null?n.sibling:null);Lt(Ot,Ot.current&1);break;case 19:if(C=(a&r.childLanes)!==0,(n.flags&128)!==0){if(C)return Qd(n,r,a);r.flags|=128}if(A=r.memoizedState,A!==null&&(A.rendering=null,A.tail=null,A.lastEffect=null),Lt(Ot,Ot.current),C)break;return null;case 22:case 23:return r.lanes=0,zd(n,r,a)}return Nr(n,r,a)}var Jd,Mc,Zd,ef;Jd=function(n,r){for(var a=r.child;a!==null;){if(a.tag===5||a.tag===6)n.appendChild(a.stateNode);else if(a.tag!==4&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===r)break;for(;a.sibling===null;){if(a.return===null||a.return===r)return;a=a.return}a.sibling.return=a.return,a=a.sibling}},Mc=function(){},Zd=function(n,r,a,C){var A=n.memoizedProps;if(A!==C){n=r.stateNode,Ms(cr.current);var D=null;switch(a){case"input":A=je(n,A),C=je(n,C),D=[];break;case"select":A=H({},A,{value:void 0}),C=H({},C,{value:void 0}),D=[];break;case"textarea":A=Ce(n,A),C=Ce(n,C),D=[];break;default:typeof A.onClick!="function"&&typeof C.onClick=="function"&&(n.onclick=al)}gt(a,C);var q;a=null;for(de in A)if(!C.hasOwnProperty(de)&&A.hasOwnProperty(de)&&A[de]!=null)if(de==="style"){var Q=A[de];for(q in Q)Q.hasOwnProperty(q)&&(a||(a={}),a[q]="")}else de!=="dangerouslySetInnerHTML"&&de!=="children"&&de!=="suppressContentEditableWarning"&&de!=="suppressHydrationWarning"&&de!=="autoFocus"&&(u.hasOwnProperty(de)?D||(D=[]):(D=D||[]).push(de,null));for(de in C){var ne=C[de];if(Q=A!=null?A[de]:void 0,C.hasOwnProperty(de)&&ne!==Q&&(ne!=null||Q!=null))if(de==="style")if(Q){for(q in Q)!Q.hasOwnProperty(q)||ne&&ne.hasOwnProperty(q)||(a||(a={}),a[q]="");for(q in ne)ne.hasOwnProperty(q)&&Q[q]!==ne[q]&&(a||(a={}),a[q]=ne[q])}else a||(D||(D=[]),D.push(de,a)),a=ne;else de==="dangerouslySetInnerHTML"?(ne=ne?ne.__html:void 0,Q=Q?Q.__html:void 0,ne!=null&&Q!==ne&&(D=D||[]).push(de,ne)):de==="children"?typeof ne!="string"&&typeof ne!="number"||(D=D||[]).push(de,""+ne):de!=="suppressContentEditableWarning"&&de!=="suppressHydrationWarning"&&(u.hasOwnProperty(de)?(ne!=null&&de==="onScroll"&&Rt("scroll",n),D||Q===ne||(D=[])):(D=D||[]).push(de,ne))}a&&(D=D||[]).push("style",a);var de=D;(r.updateQueue=de)&&(r.flags|=4)}},ef=function(n,r,a,C){a!==C&&(r.flags|=4)};function co(n,r){if(!Dt)switch(n.tailMode){case"hidden":r=n.tail;for(var a=null;r!==null;)r.alternate!==null&&(a=r),r=r.sibling;a===null?n.tail=null:a.sibling=null;break;case"collapsed":a=n.tail;for(var C=null;a!==null;)a.alternate!==null&&(C=a),a=a.sibling;C===null?r||n.tail===null?n.tail=null:n.tail.sibling=null:C.sibling=null}}function cn(n){var r=n.alternate!==null&&n.alternate.child===n.child,a=0,C=0;if(r)for(var A=n.child;A!==null;)a|=A.lanes|A.childLanes,C|=A.subtreeFlags&14680064,C|=A.flags&14680064,A.return=n,A=A.sibling;else for(A=n.child;A!==null;)a|=A.lanes|A.childLanes,C|=A.subtreeFlags,C|=A.flags,A.return=n,A=A.sibling;return n.subtreeFlags|=C,n.childLanes=a,r}function M_(n,r,a){var C=r.pendingProps;switch(Za(r),r.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return cn(r),null;case 1:return bn(r.type)&&ul(),cn(r),null;case 3:return C=r.stateNode,yi(),Mt(yn),Mt(ln),dc(),C.pendingContext&&(C.context=C.pendingContext,C.pendingContext=null),(n===null||n.child===null)&&(ml(r)?r.flags|=4:n===null||n.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,Xn!==null&&($c(Xn),Xn=null))),Mc(n,r),cn(r),null;case 5:uc(r);var A=Ms(so.current);if(a=r.type,n!==null&&r.stateNode!=null)Zd(n,r,a,C,A),n.ref!==r.ref&&(r.flags|=512,r.flags|=2097152);else{if(!C){if(r.stateNode===null)throw Error(s(166));return cn(r),null}if(n=Ms(cr.current),ml(r)){C=r.stateNode,a=r.type;var D=r.memoizedProps;switch(C[ar]=r,C[Zi]=D,n=(r.mode&1)!==0,a){case"dialog":Rt("cancel",C),Rt("close",C);break;case"iframe":case"object":case"embed":Rt("load",C);break;case"video":case"audio":for(A=0;A<Xi.length;A++)Rt(Xi[A],C);break;case"source":Rt("error",C);break;case"img":case"image":case"link":Rt("error",C),Rt("load",C);break;case"details":Rt("toggle",C);break;case"input":Je(C,D),Rt("invalid",C);break;case"select":C._wrapperState={wasMultiple:!!D.multiple},Rt("invalid",C);break;case"textarea":ye(C,D),Rt("invalid",C)}gt(a,D),A=null;for(var q in D)if(D.hasOwnProperty(q)){var Q=D[q];q==="children"?typeof Q=="string"?C.textContent!==Q&&(D.suppressHydrationWarning!==!0&&ll(C.textContent,Q,n),A=["children",Q]):typeof Q=="number"&&C.textContent!==""+Q&&(D.suppressHydrationWarning!==!0&&ll(C.textContent,Q,n),A=["children",""+Q]):u.hasOwnProperty(q)&&Q!=null&&q==="onScroll"&&Rt("scroll",C)}switch(a){case"input":ve(C),ce(C,D,!0);break;case"textarea":ve(C),Te(C);break;case"select":case"option":break;default:typeof D.onClick=="function"&&(C.onclick=al)}C=A,r.updateQueue=C,C!==null&&(r.flags|=4)}else{q=A.nodeType===9?A:A.ownerDocument,n==="http://www.w3.org/1999/xhtml"&&(n=ue(a)),n==="http://www.w3.org/1999/xhtml"?a==="script"?(n=q.createElement("div"),n.innerHTML="<script><\/script>",n=n.removeChild(n.firstChild)):typeof C.is=="string"?n=q.createElement(a,{is:C.is}):(n=q.createElement(a),a==="select"&&(q=n,C.multiple?q.multiple=!0:C.size&&(q.size=C.size))):n=q.createElementNS(n,a),n[ar]=r,n[Zi]=C,Jd(n,r,!1,!1),r.stateNode=n;e:{switch(q=Kt(a,C),a){case"dialog":Rt("cancel",n),Rt("close",n),A=C;break;case"iframe":case"object":case"embed":Rt("load",n),A=C;break;case"video":case"audio":for(A=0;A<Xi.length;A++)Rt(Xi[A],n);A=C;break;case"source":Rt("error",n),A=C;break;case"img":case"image":case"link":Rt("error",n),Rt("load",n),A=C;break;case"details":Rt("toggle",n),A=C;break;case"input":Je(n,C),A=je(n,C),Rt("invalid",n);break;case"option":A=C;break;case"select":n._wrapperState={wasMultiple:!!C.multiple},A=H({},C,{value:void 0}),Rt("invalid",n);break;case"textarea":ye(n,C),A=Ce(n,C),Rt("invalid",n);break;default:A=C}gt(a,A),Q=A;for(D in Q)if(Q.hasOwnProperty(D)){var ne=Q[D];D==="style"?It(n,ne):D==="dangerouslySetInnerHTML"?(ne=ne?ne.__html:void 0,ne!=null&&Ye(n,ne)):D==="children"?typeof ne=="string"?(a!=="textarea"||ne!=="")&&De(n,ne):typeof ne=="number"&&De(n,""+ne):D!=="suppressContentEditableWarning"&&D!=="suppressHydrationWarning"&&D!=="autoFocus"&&(u.hasOwnProperty(D)?ne!=null&&D==="onScroll"&&Rt("scroll",n):ne!=null&&f(n,D,ne,q))}switch(a){case"input":ve(n),ce(n,C,!1);break;case"textarea":ve(n),Te(n);break;case"option":C.value!=null&&n.setAttribute("value",""+G(C.value));break;case"select":n.multiple=!!C.multiple,D=C.value,D!=null?fe(n,!!C.multiple,D,!1):C.defaultValue!=null&&fe(n,!!C.multiple,C.defaultValue,!0);break;default:typeof A.onClick=="function"&&(n.onclick=al)}switch(a){case"button":case"input":case"select":case"textarea":C=!!C.autoFocus;break e;case"img":C=!0;break e;default:C=!1}}C&&(r.flags|=4)}r.ref!==null&&(r.flags|=512,r.flags|=2097152)}return cn(r),null;case 6:if(n&&r.stateNode!=null)ef(n,r,n.memoizedProps,C);else{if(typeof C!="string"&&r.stateNode===null)throw Error(s(166));if(a=Ms(so.current),Ms(cr.current),ml(r)){if(C=r.stateNode,a=r.memoizedProps,C[ar]=r,(D=C.nodeValue!==a)&&(n=Nn,n!==null))switch(n.tag){case 3:ll(C.nodeValue,a,(n.mode&1)!==0);break;case 5:n.memoizedProps.suppressHydrationWarning!==!0&&ll(C.nodeValue,a,(n.mode&1)!==0)}D&&(r.flags|=4)}else C=(a.nodeType===9?a:a.ownerDocument).createTextNode(C),C[ar]=r,r.stateNode=C}return cn(r),null;case 13:if(Mt(Ot),C=r.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(Dt&&Rn!==null&&(r.mode&1)!==0&&(r.flags&128)===0)rd(),gi(),r.flags|=98560,D=!1;else if(D=ml(r),C!==null&&C.dehydrated!==null){if(n===null){if(!D)throw Error(s(318));if(D=r.memoizedState,D=D!==null?D.dehydrated:null,!D)throw Error(s(317));D[ar]=r}else gi(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;cn(r),D=!1}else Xn!==null&&($c(Xn),Xn=null),D=!0;if(!D)return r.flags&65536?r:null}return(r.flags&128)!==0?(r.lanes=a,r):(C=C!==null,C!==(n!==null&&n.memoizedState!==null)&&C&&(r.child.flags|=8192,(r.mode&1)!==0&&(n===null||(Ot.current&1)!==0?Xt===0&&(Xt=3):qc())),r.updateQueue!==null&&(r.flags|=4),cn(r),null);case 4:return yi(),Mc(n,r),n===null&&Qi(r.stateNode.containerInfo),cn(r),null;case 10:return ic(r.type._context),cn(r),null;case 17:return bn(r.type)&&ul(),cn(r),null;case 19:if(Mt(Ot),D=r.memoizedState,D===null)return cn(r),null;if(C=(r.flags&128)!==0,q=D.rendering,q===null)if(C)co(D,!1);else{if(Xt!==0||n!==null&&(n.flags&128)!==0)for(n=r.child;n!==null;){if(q=bl(n),q!==null){for(r.flags|=128,co(D,!1),C=q.updateQueue,C!==null&&(r.updateQueue=C,r.flags|=4),r.subtreeFlags=0,C=a,a=r.child;a!==null;)D=a,n=C,D.flags&=14680066,q=D.alternate,q===null?(D.childLanes=0,D.lanes=n,D.child=null,D.subtreeFlags=0,D.memoizedProps=null,D.memoizedState=null,D.updateQueue=null,D.dependencies=null,D.stateNode=null):(D.childLanes=q.childLanes,D.lanes=q.lanes,D.child=q.child,D.subtreeFlags=0,D.deletions=null,D.memoizedProps=q.memoizedProps,D.memoizedState=q.memoizedState,D.updateQueue=q.updateQueue,D.type=q.type,n=q.dependencies,D.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),a=a.sibling;return Lt(Ot,Ot.current&1|2),r.child}n=n.sibling}D.tail!==null&&Et()>Si&&(r.flags|=128,C=!0,co(D,!1),r.lanes=4194304)}else{if(!C)if(n=bl(q),n!==null){if(r.flags|=128,C=!0,a=n.updateQueue,a!==null&&(r.updateQueue=a,r.flags|=4),co(D,!0),D.tail===null&&D.tailMode==="hidden"&&!q.alternate&&!Dt)return cn(r),null}else 2*Et()-D.renderingStartTime>Si&&a!==1073741824&&(r.flags|=128,C=!0,co(D,!1),r.lanes=4194304);D.isBackwards?(q.sibling=r.child,r.child=q):(a=D.last,a!==null?a.sibling=q:r.child=q,D.last=q)}return D.tail!==null?(r=D.tail,D.rendering=r,D.tail=r.sibling,D.renderingStartTime=Et(),r.sibling=null,a=Ot.current,Lt(Ot,C?a&1|2:a&1),r):(cn(r),null);case 22:case 23:return zc(),C=r.memoizedState!==null,n!==null&&n.memoizedState!==null!==C&&(r.flags|=8192),C&&(r.mode&1)!==0?(Mn&1073741824)!==0&&(cn(r),r.subtreeFlags&6&&(r.flags|=8192)):cn(r),null;case 24:return null;case 25:return null}throw Error(s(156,r.tag))}function A_(n,r){switch(Za(r),r.tag){case 1:return bn(r.type)&&ul(),n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 3:return yi(),Mt(yn),Mt(ln),dc(),n=r.flags,(n&65536)!==0&&(n&128)===0?(r.flags=n&-65537|128,r):null;case 5:return uc(r),null;case 13:if(Mt(Ot),n=r.memoizedState,n!==null&&n.dehydrated!==null){if(r.alternate===null)throw Error(s(340));gi()}return n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 19:return Mt(Ot),null;case 4:return yi(),null;case 10:return ic(r.type._context),null;case 22:case 23:return zc(),null;case 24:return null;default:return null}}var Rl=!1,un=!1,I_=typeof WeakSet=="function"?WeakSet:Set,Ue=null;function ki(n,r){var a=n.ref;if(a!==null)if(typeof a=="function")try{a(null)}catch(C){Ut(n,r,C)}else a.current=null}function Ac(n,r,a){try{a()}catch(C){Ut(n,r,C)}}var tf=!1;function j_(n,r){if(za=Cs,n=Ih(),Pa(n)){if("selectionStart"in n)var a={start:n.selectionStart,end:n.selectionEnd};else e:{a=(a=n.ownerDocument)&&a.defaultView||window;var C=a.getSelection&&a.getSelection();if(C&&C.rangeCount!==0){a=C.anchorNode;var A=C.anchorOffset,D=C.focusNode;C=C.focusOffset;try{a.nodeType,D.nodeType}catch{a=null;break e}var q=0,Q=-1,ne=-1,de=0,Ee=0,Le=n,xe=null;t:for(;;){for(var Be;Le!==a||A!==0&&Le.nodeType!==3||(Q=q+A),Le!==D||C!==0&&Le.nodeType!==3||(ne=q+C),Le.nodeType===3&&(q+=Le.nodeValue.length),(Be=Le.firstChild)!==null;)xe=Le,Le=Be;for(;;){if(Le===n)break t;if(xe===a&&++de===A&&(Q=q),xe===D&&++Ee===C&&(ne=q),(Be=Le.nextSibling)!==null)break;Le=xe,xe=Le.parentNode}Le=Be}a=Q===-1||ne===-1?null:{start:Q,end:ne}}else a=null}a=a||{start:0,end:0}}else a=null;for(qa={focusedElem:n,selectionRange:a},Cs=!1,Ue=r;Ue!==null;)if(r=Ue,n=r.child,(r.subtreeFlags&1028)!==0&&n!==null)n.return=r,Ue=n;else for(;Ue!==null;){r=Ue;try{var We=r.alternate;if((r.flags&1024)!==0)switch(r.tag){case 0:case 11:case 15:break;case 1:if(We!==null){var ze=We.memoizedProps,Wt=We.memoizedState,le=r.stateNode,re=le.getSnapshotBeforeUpdate(r.elementType===r.type?ze:Qn(r.type,ze),Wt);le.__reactInternalSnapshotBeforeUpdate=re}break;case 3:var ae=r.stateNode.containerInfo;ae.nodeType===1?ae.textContent="":ae.nodeType===9&&ae.documentElement&&ae.removeChild(ae.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(s(163))}}catch(Ae){Ut(r,r.return,Ae)}if(n=r.sibling,n!==null){n.return=r.return,Ue=n;break}Ue=r.return}return We=tf,tf=!1,We}function uo(n,r,a){var C=r.updateQueue;if(C=C!==null?C.lastEffect:null,C!==null){var A=C=C.next;do{if((A.tag&n)===n){var D=A.destroy;A.destroy=void 0,D!==void 0&&Ac(r,a,D)}A=A.next}while(A!==C)}}function Ml(n,r){if(r=r.updateQueue,r=r!==null?r.lastEffect:null,r!==null){var a=r=r.next;do{if((a.tag&n)===n){var C=a.create;a.destroy=C()}a=a.next}while(a!==r)}}function Ic(n){var r=n.ref;if(r!==null){var a=n.stateNode;switch(n.tag){case 5:n=a;break;default:n=a}typeof r=="function"?r(n):r.current=n}}function nf(n){var r=n.alternate;r!==null&&(n.alternate=null,nf(r)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(r=n.stateNode,r!==null&&(delete r[ar],delete r[Zi],delete r[Ya],delete r[g_],delete r[v_])),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}function rf(n){return n.tag===5||n.tag===3||n.tag===4}function sf(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||rf(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function jc(n,r,a){var C=n.tag;if(C===5||C===6)n=n.stateNode,r?a.nodeType===8?a.parentNode.insertBefore(n,r):a.insertBefore(n,r):(a.nodeType===8?(r=a.parentNode,r.insertBefore(n,a)):(r=a,r.appendChild(n)),a=a._reactRootContainer,a!=null||r.onclick!==null||(r.onclick=al));else if(C!==4&&(n=n.child,n!==null))for(jc(n,r,a),n=n.sibling;n!==null;)jc(n,r,a),n=n.sibling}function Dc(n,r,a){var C=n.tag;if(C===5||C===6)n=n.stateNode,r?a.insertBefore(n,r):a.appendChild(n);else if(C!==4&&(n=n.child,n!==null))for(Dc(n,r,a),n=n.sibling;n!==null;)Dc(n,r,a),n=n.sibling}var tn=null,Jn=!1;function ts(n,r,a){for(a=a.child;a!==null;)of(n,r,a),a=a.sibling}function of(n,r,a){if(et&&typeof et.onCommitFiberUnmount=="function")try{et.onCommitFiberUnmount(Pe,a)}catch{}switch(a.tag){case 5:un||ki(a,r);case 6:var C=tn,A=Jn;tn=null,ts(n,r,a),tn=C,Jn=A,tn!==null&&(Jn?(n=tn,a=a.stateNode,n.nodeType===8?n.parentNode.removeChild(a):n.removeChild(a)):tn.removeChild(a.stateNode));break;case 18:tn!==null&&(Jn?(n=tn,a=a.stateNode,n.nodeType===8?Ga(n.parentNode,a):n.nodeType===1&&Ga(n,a),yr(n)):Ga(tn,a.stateNode));break;case 4:C=tn,A=Jn,tn=a.stateNode.containerInfo,Jn=!0,ts(n,r,a),tn=C,Jn=A;break;case 0:case 11:case 14:case 15:if(!un&&(C=a.updateQueue,C!==null&&(C=C.lastEffect,C!==null))){A=C=C.next;do{var D=A,q=D.destroy;D=D.tag,q!==void 0&&((D&2)!==0||(D&4)!==0)&&Ac(a,r,q),A=A.next}while(A!==C)}ts(n,r,a);break;case 1:if(!un&&(ki(a,r),C=a.stateNode,typeof C.componentWillUnmount=="function"))try{C.props=a.memoizedProps,C.state=a.memoizedState,C.componentWillUnmount()}catch(Q){Ut(a,r,Q)}ts(n,r,a);break;case 21:ts(n,r,a);break;case 22:a.mode&1?(un=(C=un)||a.memoizedState!==null,ts(n,r,a),un=C):ts(n,r,a);break;default:ts(n,r,a)}}function lf(n){var r=n.updateQueue;if(r!==null){n.updateQueue=null;var a=n.stateNode;a===null&&(a=n.stateNode=new I_),r.forEach(function(C){var A=W_.bind(null,n,C);a.has(C)||(a.add(C),C.then(A,A))})}}function Zn(n,r){var a=r.deletions;if(a!==null)for(var C=0;C<a.length;C++){var A=a[C];try{var D=n,q=r,Q=q;e:for(;Q!==null;){switch(Q.tag){case 5:tn=Q.stateNode,Jn=!1;break e;case 3:tn=Q.stateNode.containerInfo,Jn=!0;break e;case 4:tn=Q.stateNode.containerInfo,Jn=!0;break e}Q=Q.return}if(tn===null)throw Error(s(160));of(D,q,A),tn=null,Jn=!1;var ne=A.alternate;ne!==null&&(ne.return=null),A.return=null}catch(de){Ut(A,r,de)}}if(r.subtreeFlags&12854)for(r=r.child;r!==null;)af(r,n),r=r.sibling}function af(n,r){var a=n.alternate,C=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:if(Zn(r,n),hr(n),C&4){try{uo(3,n,n.return),Ml(3,n)}catch(ze){Ut(n,n.return,ze)}try{uo(5,n,n.return)}catch(ze){Ut(n,n.return,ze)}}break;case 1:Zn(r,n),hr(n),C&512&&a!==null&&ki(a,a.return);break;case 5:if(Zn(r,n),hr(n),C&512&&a!==null&&ki(a,a.return),n.flags&32){var A=n.stateNode;try{De(A,"")}catch(ze){Ut(n,n.return,ze)}}if(C&4&&(A=n.stateNode,A!=null)){var D=n.memoizedProps,q=a!==null?a.memoizedProps:D,Q=n.type,ne=n.updateQueue;if(n.updateQueue=null,ne!==null)try{Q==="input"&&D.type==="radio"&&D.name!=null&&tt(A,D),Kt(Q,q);var de=Kt(Q,D);for(q=0;q<ne.length;q+=2){var Ee=ne[q],Le=ne[q+1];Ee==="style"?It(A,Le):Ee==="dangerouslySetInnerHTML"?Ye(A,Le):Ee==="children"?De(A,Le):f(A,Ee,Le,de)}switch(Q){case"input":Ne(A,D);break;case"textarea":_e(A,D);break;case"select":var xe=A._wrapperState.wasMultiple;A._wrapperState.wasMultiple=!!D.multiple;var Be=D.value;Be!=null?fe(A,!!D.multiple,Be,!1):xe!==!!D.multiple&&(D.defaultValue!=null?fe(A,!!D.multiple,D.defaultValue,!0):fe(A,!!D.multiple,D.multiple?[]:"",!1))}A[Zi]=D}catch(ze){Ut(n,n.return,ze)}}break;case 6:if(Zn(r,n),hr(n),C&4){if(n.stateNode===null)throw Error(s(162));A=n.stateNode,D=n.memoizedProps;try{A.nodeValue=D}catch(ze){Ut(n,n.return,ze)}}break;case 3:if(Zn(r,n),hr(n),C&4&&a!==null&&a.memoizedState.isDehydrated)try{yr(r.containerInfo)}catch(ze){Ut(n,n.return,ze)}break;case 4:Zn(r,n),hr(n);break;case 13:Zn(r,n),hr(n),A=n.child,A.flags&8192&&(D=A.memoizedState!==null,A.stateNode.isHidden=D,!D||A.alternate!==null&&A.alternate.memoizedState!==null||(Bc=Et())),C&4&&lf(n);break;case 22:if(Ee=a!==null&&a.memoizedState!==null,n.mode&1?(un=(de=un)||Ee,Zn(r,n),un=de):Zn(r,n),hr(n),C&8192){if(de=n.memoizedState!==null,(n.stateNode.isHidden=de)&&!Ee&&(n.mode&1)!==0)for(Ue=n,Ee=n.child;Ee!==null;){for(Le=Ue=Ee;Ue!==null;){switch(xe=Ue,Be=xe.child,xe.tag){case 0:case 11:case 14:case 15:uo(4,xe,xe.return);break;case 1:ki(xe,xe.return);var We=xe.stateNode;if(typeof We.componentWillUnmount=="function"){C=xe,a=xe.return;try{r=C,We.props=r.memoizedProps,We.state=r.memoizedState,We.componentWillUnmount()}catch(ze){Ut(C,a,ze)}}break;case 5:ki(xe,xe.return);break;case 22:if(xe.memoizedState!==null){hf(Le);continue}}Be!==null?(Be.return=xe,Ue=Be):hf(Le)}Ee=Ee.sibling}e:for(Ee=null,Le=n;;){if(Le.tag===5){if(Ee===null){Ee=Le;try{A=Le.stateNode,de?(D=A.style,typeof D.setProperty=="function"?D.setProperty("display","none","important"):D.display="none"):(Q=Le.stateNode,ne=Le.memoizedProps.style,q=ne!=null&&ne.hasOwnProperty("display")?ne.display:null,Q.style.display=xt("display",q))}catch(ze){Ut(n,n.return,ze)}}}else if(Le.tag===6){if(Ee===null)try{Le.stateNode.nodeValue=de?"":Le.memoizedProps}catch(ze){Ut(n,n.return,ze)}}else if((Le.tag!==22&&Le.tag!==23||Le.memoizedState===null||Le===n)&&Le.child!==null){Le.child.return=Le,Le=Le.child;continue}if(Le===n)break e;for(;Le.sibling===null;){if(Le.return===null||Le.return===n)break e;Ee===Le&&(Ee=null),Le=Le.return}Ee===Le&&(Ee=null),Le.sibling.return=Le.return,Le=Le.sibling}}break;case 19:Zn(r,n),hr(n),C&4&&lf(n);break;case 21:break;default:Zn(r,n),hr(n)}}function hr(n){var r=n.flags;if(r&2){try{e:{for(var a=n.return;a!==null;){if(rf(a)){var C=a;break e}a=a.return}throw Error(s(160))}switch(C.tag){case 5:var A=C.stateNode;C.flags&32&&(De(A,""),C.flags&=-33);var D=sf(n);Dc(n,D,A);break;case 3:case 4:var q=C.stateNode.containerInfo,Q=sf(n);jc(n,Q,q);break;default:throw Error(s(161))}}catch(ne){Ut(n,n.return,ne)}n.flags&=-3}r&4096&&(n.flags&=-4097)}function D_(n,r,a){Ue=n,cf(n)}function cf(n,r,a){for(var C=(n.mode&1)!==0;Ue!==null;){var A=Ue,D=A.child;if(A.tag===22&&C){var q=A.memoizedState!==null||Rl;if(!q){var Q=A.alternate,ne=Q!==null&&Q.memoizedState!==null||un;Q=Rl;var de=un;if(Rl=q,(un=ne)&&!de)for(Ue=A;Ue!==null;)q=Ue,ne=q.child,q.tag===22&&q.memoizedState!==null?df(A):ne!==null?(ne.return=q,Ue=ne):df(A);for(;D!==null;)Ue=D,cf(D),D=D.sibling;Ue=A,Rl=Q,un=de}uf(n)}else(A.subtreeFlags&8772)!==0&&D!==null?(D.return=A,Ue=D):uf(n)}}function uf(n){for(;Ue!==null;){var r=Ue;if((r.flags&8772)!==0){var a=r.alternate;try{if((r.flags&8772)!==0)switch(r.tag){case 0:case 11:case 15:un||Ml(5,r);break;case 1:var C=r.stateNode;if(r.flags&4&&!un)if(a===null)C.componentDidMount();else{var A=r.elementType===r.type?a.memoizedProps:Qn(r.type,a.memoizedProps);C.componentDidUpdate(A,a.memoizedState,C.__reactInternalSnapshotBeforeUpdate)}var D=r.updateQueue;D!==null&&ud(r,D,C);break;case 3:var q=r.updateQueue;if(q!==null){if(a=null,r.child!==null)switch(r.child.tag){case 5:a=r.child.stateNode;break;case 1:a=r.child.stateNode}ud(r,q,a)}break;case 5:var Q=r.stateNode;if(a===null&&r.flags&4){a=Q;var ne=r.memoizedProps;switch(r.type){case"button":case"input":case"select":case"textarea":ne.autoFocus&&a.focus();break;case"img":ne.src&&(a.src=ne.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(r.memoizedState===null){var de=r.alternate;if(de!==null){var Ee=de.memoizedState;if(Ee!==null){var Le=Ee.dehydrated;Le!==null&&yr(Le)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(s(163))}un||r.flags&512&&Ic(r)}catch(xe){Ut(r,r.return,xe)}}if(r===n){Ue=null;break}if(a=r.sibling,a!==null){a.return=r.return,Ue=a;break}Ue=r.return}}function hf(n){for(;Ue!==null;){var r=Ue;if(r===n){Ue=null;break}var a=r.sibling;if(a!==null){a.return=r.return,Ue=a;break}Ue=r.return}}function df(n){for(;Ue!==null;){var r=Ue;try{switch(r.tag){case 0:case 11:case 15:var a=r.return;try{Ml(4,r)}catch(ne){Ut(r,a,ne)}break;case 1:var C=r.stateNode;if(typeof C.componentDidMount=="function"){var A=r.return;try{C.componentDidMount()}catch(ne){Ut(r,A,ne)}}var D=r.return;try{Ic(r)}catch(ne){Ut(r,D,ne)}break;case 5:var q=r.return;try{Ic(r)}catch(ne){Ut(r,q,ne)}}}catch(ne){Ut(r,r.return,ne)}if(r===n){Ue=null;break}var Q=r.sibling;if(Q!==null){Q.return=r.return,Ue=Q;break}Ue=r.return}}var P_=Math.ceil,Al=E.ReactCurrentDispatcher,Pc=E.ReactCurrentOwner,Hn=E.ReactCurrentBatchConfig,_t=0,Zt=null,Vt=null,nn=0,Mn=0,Ci=Xr(0),Xt=0,ho=null,Is=0,Il=0,Oc=0,fo=null,Cn=null,Bc=0,Si=1/0,Rr=null,jl=!1,Fc=null,ns=null,Dl=!1,rs=null,Pl=0,po=0,Hc=null,Ol=-1,Bl=0;function vn(){return(_t&6)!==0?Et():Ol!==-1?Ol:Ol=Et()}function ss(n){return(n.mode&1)===0?1:(_t&2)!==0&&nn!==0?nn&-nn:w_.transition!==null?(Bl===0&&(Bl=_r()),Bl):(n=vt,n!==0||(n=window.event,n=n===void 0?16:Fi(n.type)),n)}function er(n,r,a,C){if(50<po)throw po=0,Hc=null,Error(s(185));qn(n,a,C),((_t&2)===0||n!==Zt)&&(n===Zt&&((_t&2)===0&&(Il|=a),Xt===4&&is(n,nn)),Sn(n,C),a===1&&_t===0&&(r.mode&1)===0&&(Si=Et()+500,dl&&Jr()))}function Sn(n,r){var a=n.callbackNode;Pi(n,r);var C=Br(n,n===Zt?nn:0);if(C===0)a!==null&&nr(a),n.callbackNode=null,n.callbackPriority=0;else if(r=C&-C,n.callbackPriority!==r){if(a!=null&&nr(a),r===1)n.tag===0?__(pf.bind(null,n)):Jh(pf.bind(null,n)),p_(function(){(_t&6)===0&&Jr()}),a=null;else{switch(Vn(C)){case 1:a=gs;break;case 4:a=Or;break;case 16:a=rr;break;case 536870912:a=me;break;default:a=rr}a=kf(a,ff.bind(null,n))}n.callbackPriority=r,n.callbackNode=a}}function ff(n,r){if(Ol=-1,Bl=0,(_t&6)!==0)throw Error(s(327));var a=n.callbackNode;if(xi()&&n.callbackNode!==a)return null;var C=Br(n,n===Zt?nn:0);if(C===0)return null;if((C&30)!==0||(C&n.expiredLanes)!==0||r)r=Fl(n,C);else{r=C;var A=_t;_t|=2;var D=gf();(Zt!==n||nn!==r)&&(Rr=null,Si=Et()+500,Ds(n,r));do try{F_();break}catch(Q){mf(n,Q)}while(!0);sc(),Al.current=D,_t=A,Vt!==null?r=0:(Zt=null,nn=0,r=Xt)}if(r!==0){if(r===2&&(A=bs(n),A!==0&&(C=A,r=Uc(n,A))),r===1)throw a=ho,Ds(n,0),is(n,C),Sn(n,Et()),a;if(r===6)is(n,C);else{if(A=n.current.alternate,(C&30)===0&&!O_(A)&&(r=Fl(n,C),r===2&&(D=bs(n),D!==0&&(C=D,r=Uc(n,D))),r===1))throw a=ho,Ds(n,0),is(n,C),Sn(n,Et()),a;switch(n.finishedWork=A,n.finishedLanes=C,r){case 0:case 1:throw Error(s(345));case 2:Ps(n,Cn,Rr);break;case 3:if(is(n,C),(C&130023424)===C&&(r=Bc+500-Et(),10<r)){if(Br(n,0)!==0)break;if(A=n.suspendedLanes,(A&C)!==C){vn(),n.pingedLanes|=n.suspendedLanes&A;break}n.timeoutHandle=Ka(Ps.bind(null,n,Cn,Rr),r);break}Ps(n,Cn,Rr);break;case 4:if(is(n,C),(C&4194240)===C)break;for(r=n.eventTimes,A=-1;0<C;){var q=31-lt(C);D=1<<q,q=r[q],q>A&&(A=q),C&=~D}if(C=A,C=Et()-C,C=(120>C?120:480>C?480:1080>C?1080:1920>C?1920:3e3>C?3e3:4320>C?4320:1960*P_(C/1960))-C,10<C){n.timeoutHandle=Ka(Ps.bind(null,n,Cn,Rr),C);break}Ps(n,Cn,Rr);break;case 5:Ps(n,Cn,Rr);break;default:throw Error(s(329))}}}return Sn(n,Et()),n.callbackNode===a?ff.bind(null,n):null}function Uc(n,r){var a=fo;return n.current.memoizedState.isDehydrated&&(Ds(n,r).flags|=256),n=Fl(n,r),n!==2&&(r=Cn,Cn=a,r!==null&&$c(r)),n}function $c(n){Cn===null?Cn=n:Cn.push.apply(Cn,n)}function O_(n){for(var r=n;;){if(r.flags&16384){var a=r.updateQueue;if(a!==null&&(a=a.stores,a!==null))for(var C=0;C<a.length;C++){var A=a[C],D=A.getSnapshot;A=A.value;try{if(!Yn(D(),A))return!1}catch{return!1}}}if(a=r.child,r.subtreeFlags&16384&&a!==null)a.return=r,r=a;else{if(r===n)break;for(;r.sibling===null;){if(r.return===null||r.return===n)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function is(n,r){for(r&=~Oc,r&=~Il,n.suspendedLanes|=r,n.pingedLanes&=~r,n=n.expirationTimes;0<r;){var a=31-lt(r),C=1<<a;n[a]=-1,r&=~C}}function pf(n){if((_t&6)!==0)throw Error(s(327));xi();var r=Br(n,0);if((r&1)===0)return Sn(n,Et()),null;var a=Fl(n,r);if(n.tag!==0&&a===2){var C=bs(n);C!==0&&(r=C,a=Uc(n,C))}if(a===1)throw a=ho,Ds(n,0),is(n,r),Sn(n,Et()),a;if(a===6)throw Error(s(345));return n.finishedWork=n.current.alternate,n.finishedLanes=r,Ps(n,Cn,Rr),Sn(n,Et()),null}function Wc(n,r){var a=_t;_t|=1;try{return n(r)}finally{_t=a,_t===0&&(Si=Et()+500,dl&&Jr())}}function js(n){rs!==null&&rs.tag===0&&(_t&6)===0&&xi();var r=_t;_t|=1;var a=Hn.transition,C=vt;try{if(Hn.transition=null,vt=1,n)return n()}finally{vt=C,Hn.transition=a,_t=r,(_t&6)===0&&Jr()}}function zc(){Mn=Ci.current,Mt(Ci)}function Ds(n,r){n.finishedWork=null,n.finishedLanes=0;var a=n.timeoutHandle;if(a!==-1&&(n.timeoutHandle=-1,f_(a)),Vt!==null)for(a=Vt.return;a!==null;){var C=a;switch(Za(C),C.tag){case 1:C=C.type.childContextTypes,C!=null&&ul();break;case 3:yi(),Mt(yn),Mt(ln),dc();break;case 5:uc(C);break;case 4:yi();break;case 13:Mt(Ot);break;case 19:Mt(Ot);break;case 10:ic(C.type._context);break;case 22:case 23:zc()}a=a.return}if(Zt=n,Vt=n=os(n.current,null),nn=Mn=r,Xt=0,ho=null,Oc=Il=Is=0,Cn=fo=null,Rs!==null){for(r=0;r<Rs.length;r++)if(a=Rs[r],C=a.interleaved,C!==null){a.interleaved=null;var A=C.next,D=a.pending;if(D!==null){var q=D.next;D.next=A,C.next=q}a.pending=C}Rs=null}return n}function mf(n,r){do{var a=Vt;try{if(sc(),kl.current=El,Cl){for(var C=Bt.memoizedState;C!==null;){var A=C.queue;A!==null&&(A.pending=null),C=C.next}Cl=!1}if(As=0,Jt=Yt=Bt=null,io=!1,oo=0,Pc.current=null,a===null||a.return===null){Xt=1,ho=r,Vt=null;break}e:{var D=n,q=a.return,Q=a,ne=r;if(r=nn,Q.flags|=32768,ne!==null&&typeof ne=="object"&&typeof ne.then=="function"){var de=ne,Ee=Q,Le=Ee.tag;if((Ee.mode&1)===0&&(Le===0||Le===11||Le===15)){var xe=Ee.alternate;xe?(Ee.updateQueue=xe.updateQueue,Ee.memoizedState=xe.memoizedState,Ee.lanes=xe.lanes):(Ee.updateQueue=null,Ee.memoizedState=null)}var Be=Fd(q);if(Be!==null){Be.flags&=-257,Hd(Be,q,Q,D,r),Be.mode&1&&Bd(D,de,r),r=Be,ne=de;var We=r.updateQueue;if(We===null){var ze=new Set;ze.add(ne),r.updateQueue=ze}else We.add(ne);break e}else{if((r&1)===0){Bd(D,de,r),qc();break e}ne=Error(s(426))}}else if(Dt&&Q.mode&1){var Wt=Fd(q);if(Wt!==null){(Wt.flags&65536)===0&&(Wt.flags|=256),Hd(Wt,q,Q,D,r),nc(bi(ne,Q));break e}}D=ne=bi(ne,Q),Xt!==4&&(Xt=2),fo===null?fo=[D]:fo.push(D),D=q;do{switch(D.tag){case 3:D.flags|=65536,r&=-r,D.lanes|=r;var le=Pd(D,ne,r);cd(D,le);break e;case 1:Q=ne;var re=D.type,ae=D.stateNode;if((D.flags&128)===0&&(typeof re.getDerivedStateFromError=="function"||ae!==null&&typeof ae.componentDidCatch=="function"&&(ns===null||!ns.has(ae)))){D.flags|=65536,r&=-r,D.lanes|=r;var Ae=Od(D,Q,r);cd(D,Ae);break e}}D=D.return}while(D!==null)}_f(a)}catch(Ge){r=Ge,Vt===a&&a!==null&&(Vt=a=a.return);continue}break}while(!0)}function gf(){var n=Al.current;return Al.current=El,n===null?El:n}function qc(){(Xt===0||Xt===3||Xt===2)&&(Xt=4),Zt===null||(Is&268435455)===0&&(Il&268435455)===0||is(Zt,nn)}function Fl(n,r){var a=_t;_t|=2;var C=gf();(Zt!==n||nn!==r)&&(Rr=null,Ds(n,r));do try{B_();break}catch(A){mf(n,A)}while(!0);if(sc(),_t=a,Al.current=C,Vt!==null)throw Error(s(261));return Zt=null,nn=0,Xt}function B_(){for(;Vt!==null;)vf(Vt)}function F_(){for(;Vt!==null&&!Pr();)vf(Vt)}function vf(n){var r=bf(n.alternate,n,Mn);n.memoizedProps=n.pendingProps,r===null?_f(n):Vt=r,Pc.current=null}function _f(n){var r=n;do{var a=r.alternate;if(n=r.return,(r.flags&32768)===0){if(a=M_(a,r,Mn),a!==null){Vt=a;return}}else{if(a=A_(a,r),a!==null){a.flags&=32767,Vt=a;return}if(n!==null)n.flags|=32768,n.subtreeFlags=0,n.deletions=null;else{Xt=6,Vt=null;return}}if(r=r.sibling,r!==null){Vt=r;return}Vt=r=n}while(r!==null);Xt===0&&(Xt=5)}function Ps(n,r,a){var C=vt,A=Hn.transition;try{Hn.transition=null,vt=1,H_(n,r,a,C)}finally{Hn.transition=A,vt=C}return null}function H_(n,r,a,C){do xi();while(rs!==null);if((_t&6)!==0)throw Error(s(327));a=n.finishedWork;var A=n.finishedLanes;if(a===null)return null;if(n.finishedWork=null,n.finishedLanes=0,a===n.current)throw Error(s(177));n.callbackNode=null,n.callbackPriority=0;var D=a.lanes|a.childLanes;if(Do(n,D),n===Zt&&(Vt=Zt=null,nn=0),(a.subtreeFlags&2064)===0&&(a.flags&2064)===0||Dl||(Dl=!0,kf(rr,function(){return xi(),null})),D=(a.flags&15990)!==0,(a.subtreeFlags&15990)!==0||D){D=Hn.transition,Hn.transition=null;var q=vt;vt=1;var Q=_t;_t|=4,Pc.current=null,j_(n,a),af(a,n),o_(qa),Cs=!!za,qa=za=null,n.current=a,D_(a),zs(),_t=Q,vt=q,Hn.transition=D}else n.current=a;if(Dl&&(Dl=!1,rs=n,Pl=A),D=n.pendingLanes,D===0&&(ns=null),wt(a.stateNode),Sn(n,Et()),r!==null)for(C=n.onRecoverableError,a=0;a<r.length;a++)A=r[a],C(A.value,{componentStack:A.stack,digest:A.digest});if(jl)throw jl=!1,n=Fc,Fc=null,n;return(Pl&1)!==0&&n.tag!==0&&xi(),D=n.pendingLanes,(D&1)!==0?n===Hc?po++:(po=0,Hc=n):po=0,Jr(),null}function xi(){if(rs!==null){var n=Vn(Pl),r=Hn.transition,a=vt;try{if(Hn.transition=null,vt=16>n?16:n,rs===null)var C=!1;else{if(n=rs,rs=null,Pl=0,(_t&6)!==0)throw Error(s(331));var A=_t;for(_t|=4,Ue=n.current;Ue!==null;){var D=Ue,q=D.child;if((Ue.flags&16)!==0){var Q=D.deletions;if(Q!==null){for(var ne=0;ne<Q.length;ne++){var de=Q[ne];for(Ue=de;Ue!==null;){var Ee=Ue;switch(Ee.tag){case 0:case 11:case 15:uo(8,Ee,D)}var Le=Ee.child;if(Le!==null)Le.return=Ee,Ue=Le;else for(;Ue!==null;){Ee=Ue;var xe=Ee.sibling,Be=Ee.return;if(nf(Ee),Ee===de){Ue=null;break}if(xe!==null){xe.return=Be,Ue=xe;break}Ue=Be}}}var We=D.alternate;if(We!==null){var ze=We.child;if(ze!==null){We.child=null;do{var Wt=ze.sibling;ze.sibling=null,ze=Wt}while(ze!==null)}}Ue=D}}if((D.subtreeFlags&2064)!==0&&q!==null)q.return=D,Ue=q;else e:for(;Ue!==null;){if(D=Ue,(D.flags&2048)!==0)switch(D.tag){case 0:case 11:case 15:uo(9,D,D.return)}var le=D.sibling;if(le!==null){le.return=D.return,Ue=le;break e}Ue=D.return}}var re=n.current;for(Ue=re;Ue!==null;){q=Ue;var ae=q.child;if((q.subtreeFlags&2064)!==0&&ae!==null)ae.return=q,Ue=ae;else e:for(q=re;Ue!==null;){if(Q=Ue,(Q.flags&2048)!==0)try{switch(Q.tag){case 0:case 11:case 15:Ml(9,Q)}}catch(Ge){Ut(Q,Q.return,Ge)}if(Q===q){Ue=null;break e}var Ae=Q.sibling;if(Ae!==null){Ae.return=Q.return,Ue=Ae;break e}Ue=Q.return}}if(_t=A,Jr(),et&&typeof et.onPostCommitFiberRoot=="function")try{et.onPostCommitFiberRoot(Pe,n)}catch{}C=!0}return C}finally{vt=a,Hn.transition=r}}return!1}function wf(n,r,a){r=bi(a,r),r=Pd(n,r,1),n=es(n,r,1),r=vn(),n!==null&&(qn(n,1,r),Sn(n,r))}function Ut(n,r,a){if(n.tag===3)wf(n,n,a);else for(;r!==null;){if(r.tag===3){wf(r,n,a);break}else if(r.tag===1){var C=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof C.componentDidCatch=="function"&&(ns===null||!ns.has(C))){n=bi(a,n),n=Od(r,n,1),r=es(r,n,1),n=vn(),r!==null&&(qn(r,1,n),Sn(r,n));break}}r=r.return}}function U_(n,r,a){var C=n.pingCache;C!==null&&C.delete(r),r=vn(),n.pingedLanes|=n.suspendedLanes&a,Zt===n&&(nn&a)===a&&(Xt===4||Xt===3&&(nn&130023424)===nn&&500>Et()-Bc?Ds(n,0):Oc|=a),Sn(n,r)}function yf(n,r){r===0&&((n.mode&1)===0?r=1:(r=ws,ws<<=1,(ws&130023424)===0&&(ws=4194304)));var a=vn();n=Tr(n,r),n!==null&&(qn(n,r,a),Sn(n,a))}function $_(n){var r=n.memoizedState,a=0;r!==null&&(a=r.retryLane),yf(n,a)}function W_(n,r){var a=0;switch(n.tag){case 13:var C=n.stateNode,A=n.memoizedState;A!==null&&(a=A.retryLane);break;case 19:C=n.stateNode;break;default:throw Error(s(314))}C!==null&&C.delete(r),yf(n,a)}var bf;bf=function(n,r,a){if(n!==null)if(n.memoizedProps!==r.pendingProps||yn.current)kn=!0;else{if((n.lanes&a)===0&&(r.flags&128)===0)return kn=!1,R_(n,r,a);kn=(n.flags&131072)!==0}else kn=!1,Dt&&(r.flags&1048576)!==0&&Zh(r,pl,r.index);switch(r.lanes=0,r.tag){case 2:var C=r.type;Nl(n,r),n=r.pendingProps;var A=fi(r,ln.current);wi(r,a),A=mc(null,r,C,n,A,a);var D=gc();return r.flags|=1,typeof A=="object"&&A!==null&&typeof A.render=="function"&&A.$$typeof===void 0?(r.tag=1,r.memoizedState=null,r.updateQueue=null,bn(C)?(D=!0,hl(r)):D=!1,r.memoizedState=A.state!==null&&A.state!==void 0?A.state:null,ac(r),A.updater=Tl,r.stateNode=A,A._reactInternals=r,kc(r,C,n,a),r=Ec(null,r,C,!0,D,a)):(r.tag=0,Dt&&D&&Ja(r),gn(null,r,A,a),r=r.child),r;case 16:C=r.elementType;e:{switch(Nl(n,r),n=r.pendingProps,A=C._init,C=A(C._payload),r.type=C,A=r.tag=q_(C),n=Qn(C,n),A){case 0:r=xc(null,r,C,n,a);break e;case 1:r=Vd(null,r,C,n,a);break e;case 11:r=Ud(null,r,C,n,a);break e;case 14:r=$d(null,r,C,Qn(C.type,n),a);break e}throw Error(s(306,C,""))}return r;case 0:return C=r.type,A=r.pendingProps,A=r.elementType===C?A:Qn(C,A),xc(n,r,C,A,a);case 1:return C=r.type,A=r.pendingProps,A=r.elementType===C?A:Qn(C,A),Vd(n,r,C,A,a);case 3:e:{if(Kd(r),n===null)throw Error(s(387));C=r.pendingProps,D=r.memoizedState,A=D.element,ad(n,r),yl(r,C,null,a);var q=r.memoizedState;if(C=q.element,D.isDehydrated)if(D={element:C,isDehydrated:!1,cache:q.cache,pendingSuspenseBoundaries:q.pendingSuspenseBoundaries,transitions:q.transitions},r.updateQueue.baseState=D,r.memoizedState=D,r.flags&256){A=bi(Error(s(423)),r),r=Gd(n,r,C,a,A);break e}else if(C!==A){A=bi(Error(s(424)),r),r=Gd(n,r,C,a,A);break e}else for(Rn=Yr(r.stateNode.containerInfo.firstChild),Nn=r,Dt=!0,Xn=null,a=od(r,null,C,a),r.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(gi(),C===A){r=Nr(n,r,a);break e}gn(n,r,C,a)}r=r.child}return r;case 5:return hd(r),n===null&&tc(r),C=r.type,A=r.pendingProps,D=n!==null?n.memoizedProps:null,q=A.children,Va(C,A)?q=null:D!==null&&Va(C,D)&&(r.flags|=32),qd(n,r),gn(n,r,q,a),r.child;case 6:return n===null&&tc(r),null;case 13:return Yd(n,r,a);case 4:return cc(r,r.stateNode.containerInfo),C=r.pendingProps,n===null?r.child=vi(r,null,C,a):gn(n,r,C,a),r.child;case 11:return C=r.type,A=r.pendingProps,A=r.elementType===C?A:Qn(C,A),Ud(n,r,C,A,a);case 7:return gn(n,r,r.pendingProps,a),r.child;case 8:return gn(n,r,r.pendingProps.children,a),r.child;case 12:return gn(n,r,r.pendingProps.children,a),r.child;case 10:e:{if(C=r.type._context,A=r.pendingProps,D=r.memoizedProps,q=A.value,Lt(vl,C._currentValue),C._currentValue=q,D!==null)if(Yn(D.value,q)){if(D.children===A.children&&!yn.current){r=Nr(n,r,a);break e}}else for(D=r.child,D!==null&&(D.return=r);D!==null;){var Q=D.dependencies;if(Q!==null){q=D.child;for(var ne=Q.firstContext;ne!==null;){if(ne.context===C){if(D.tag===1){ne=Lr(-1,a&-a),ne.tag=2;var de=D.updateQueue;if(de!==null){de=de.shared;var Ee=de.pending;Ee===null?ne.next=ne:(ne.next=Ee.next,Ee.next=ne),de.pending=ne}}D.lanes|=a,ne=D.alternate,ne!==null&&(ne.lanes|=a),oc(D.return,a,r),Q.lanes|=a;break}ne=ne.next}}else if(D.tag===10)q=D.type===r.type?null:D.child;else if(D.tag===18){if(q=D.return,q===null)throw Error(s(341));q.lanes|=a,Q=q.alternate,Q!==null&&(Q.lanes|=a),oc(q,a,r),q=D.sibling}else q=D.child;if(q!==null)q.return=D;else for(q=D;q!==null;){if(q===r){q=null;break}if(D=q.sibling,D!==null){D.return=q.return,q=D;break}q=q.return}D=q}gn(n,r,A.children,a),r=r.child}return r;case 9:return A=r.type,C=r.pendingProps.children,wi(r,a),A=Bn(A),C=C(A),r.flags|=1,gn(n,r,C,a),r.child;case 14:return C=r.type,A=Qn(C,r.pendingProps),A=Qn(C.type,A),$d(n,r,C,A,a);case 15:return Wd(n,r,r.type,r.pendingProps,a);case 17:return C=r.type,A=r.pendingProps,A=r.elementType===C?A:Qn(C,A),Nl(n,r),r.tag=1,bn(C)?(n=!0,hl(r)):n=!1,wi(r,a),jd(r,C,A),kc(r,C,A,a),Ec(null,r,C,!0,n,a);case 19:return Qd(n,r,a);case 22:return zd(n,r,a)}throw Error(s(156,r.tag))};function kf(n,r){return Dr(n,r)}function z_(n,r,a,C){this.tag=n,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=r,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=C,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Un(n,r,a,C){return new z_(n,r,a,C)}function Vc(n){return n=n.prototype,!(!n||!n.isReactComponent)}function q_(n){if(typeof n=="function")return Vc(n)?1:0;if(n!=null){if(n=n.$$typeof,n===O)return 11;if(n===W)return 14}return 2}function os(n,r){var a=n.alternate;return a===null?(a=Un(n.tag,r,n.key,n.mode),a.elementType=n.elementType,a.type=n.type,a.stateNode=n.stateNode,a.alternate=n,n.alternate=a):(a.pendingProps=r,a.type=n.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=n.flags&14680064,a.childLanes=n.childLanes,a.lanes=n.lanes,a.child=n.child,a.memoizedProps=n.memoizedProps,a.memoizedState=n.memoizedState,a.updateQueue=n.updateQueue,r=n.dependencies,a.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},a.sibling=n.sibling,a.index=n.index,a.ref=n.ref,a}function Hl(n,r,a,C,A,D){var q=2;if(C=n,typeof n=="function")Vc(n)&&(q=1);else if(typeof n=="string")q=5;else e:switch(n){case R:return Os(a.children,A,D,r);case S:q=8,A|=8;break;case L:return n=Un(12,a,r,A|2),n.elementType=L,n.lanes=D,n;case B:return n=Un(13,a,r,A),n.elementType=B,n.lanes=D,n;case $:return n=Un(19,a,r,A),n.elementType=$,n.lanes=D,n;case Y:return Ul(a,A,D,r);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case I:q=10;break e;case P:q=9;break e;case O:q=11;break e;case W:q=14;break e;case K:q=16,C=null;break e}throw Error(s(130,n==null?n:typeof n,""))}return r=Un(q,a,r,A),r.elementType=n,r.type=C,r.lanes=D,r}function Os(n,r,a,C){return n=Un(7,n,C,r),n.lanes=a,n}function Ul(n,r,a,C){return n=Un(22,n,C,r),n.elementType=Y,n.lanes=a,n.stateNode={isHidden:!1},n}function Kc(n,r,a){return n=Un(6,n,null,r),n.lanes=a,n}function Gc(n,r,a){return r=Un(4,n.children!==null?n.children:[],n.key,r),r.lanes=a,r.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},r}function V_(n,r,a,C,A){this.tag=r,this.containerInfo=n,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=sr(0),this.expirationTimes=sr(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=sr(0),this.identifierPrefix=C,this.onRecoverableError=A,this.mutableSourceEagerHydrationData=null}function Yc(n,r,a,C,A,D,q,Q,ne){return n=new V_(n,r,a,Q,ne),r===1?(r=1,D===!0&&(r|=8)):r=0,D=Un(3,null,null,r),n.current=D,D.stateNode=n,D.memoizedState={element:C,isDehydrated:a,cache:null,transitions:null,pendingSuspenseBoundaries:null},ac(D),n}function K_(n,r,a){var C=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:x,key:C==null?null:""+C,children:n,containerInfo:r,implementation:a}}function Cf(n){if(!n)return Qr;n=n._reactInternals;e:{if(Gt(n)!==n||n.tag!==1)throw Error(s(170));var r=n;do{switch(r.tag){case 3:r=r.stateNode.context;break e;case 1:if(bn(r.type)){r=r.stateNode.__reactInternalMemoizedMergedChildContext;break e}}r=r.return}while(r!==null);throw Error(s(171))}if(n.tag===1){var a=n.type;if(bn(a))return Xh(n,a,r)}return r}function Sf(n,r,a,C,A,D,q,Q,ne){return n=Yc(a,C,!0,n,A,D,q,Q,ne),n.context=Cf(null),a=n.current,C=vn(),A=ss(a),D=Lr(C,A),D.callback=r??null,es(a,D,A),n.current.lanes=A,qn(n,A,C),Sn(n,C),n}function $l(n,r,a,C){var A=r.current,D=vn(),q=ss(A);return a=Cf(a),r.context===null?r.context=a:r.pendingContext=a,r=Lr(D,q),r.payload={element:n},C=C===void 0?null:C,C!==null&&(r.callback=C),n=es(A,r,q),n!==null&&(er(n,A,q,D),wl(n,A,q)),q}function Wl(n){if(n=n.current,!n.child)return null;switch(n.child.tag){case 5:return n.child.stateNode;default:return n.child.stateNode}}function xf(n,r){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var a=n.retryLane;n.retryLane=a!==0&&a<r?a:r}}function Xc(n,r){xf(n,r),(n=n.alternate)&&xf(n,r)}function G_(){return null}var Ef=typeof reportError=="function"?reportError:function(n){console.error(n)};function Qc(n){this._internalRoot=n}zl.prototype.render=Qc.prototype.render=function(n){var r=this._internalRoot;if(r===null)throw Error(s(409));$l(n,r,null,null)},zl.prototype.unmount=Qc.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var r=n.containerInfo;js(function(){$l(null,n,null,null)}),r[Cr]=null}};function zl(n){this._internalRoot=n}zl.prototype.unstable_scheduleHydration=function(n){if(n){var r=ks();n={blockedOn:null,target:n,priority:r};for(var a=0;a<yt.length&&r!==0&&r<yt[a].priority;a++);yt.splice(a,0,n),a===0&&Fo(n)}};function Jc(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function ql(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11&&(n.nodeType!==8||n.nodeValue!==" react-mount-point-unstable "))}function Tf(){}function Y_(n,r,a,C,A){if(A){if(typeof C=="function"){var D=C;C=function(){var de=Wl(q);D.call(de)}}var q=Sf(r,C,n,0,null,!1,!1,"",Tf);return n._reactRootContainer=q,n[Cr]=q.current,Qi(n.nodeType===8?n.parentNode:n),js(),q}for(;A=n.lastChild;)n.removeChild(A);if(typeof C=="function"){var Q=C;C=function(){var de=Wl(ne);Q.call(de)}}var ne=Yc(n,0,!1,null,null,!1,!1,"",Tf);return n._reactRootContainer=ne,n[Cr]=ne.current,Qi(n.nodeType===8?n.parentNode:n),js(function(){$l(r,ne,a,C)}),ne}function Vl(n,r,a,C,A){var D=a._reactRootContainer;if(D){var q=D;if(typeof A=="function"){var Q=A;A=function(){var ne=Wl(q);Q.call(ne)}}$l(r,q,n,A)}else q=Y_(a,r,n,A,C);return Wl(q)}Po=function(n){switch(n.tag){case 3:var r=n.stateNode;if(r.current.memoizedState.isDehydrated){var a=ys(r.pendingLanes);a!==0&&(ir(r,a|1),Sn(r,Et()),(_t&6)===0&&(Si=Et()+500,Jr()))}break;case 13:js(function(){var C=Tr(n,1);if(C!==null){var A=vn();er(C,n,1,A)}}),Xc(n,1)}},qs=function(n){if(n.tag===13){var r=Tr(n,134217728);if(r!==null){var a=vn();er(r,n,134217728,a)}Xc(n,134217728)}},wr=function(n){if(n.tag===13){var r=ss(n),a=Tr(n,r);if(a!==null){var C=vn();er(a,n,r,C)}Xc(n,r)}},ks=function(){return vt},Oo=function(n,r){var a=vt;try{return vt=n,r()}finally{vt=a}},Ze=function(n,r,a){switch(r){case"input":if(Ne(n,a),r=a.name,a.type==="radio"&&r!=null){for(a=n;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll("input[name="+JSON.stringify(""+r)+'][type="radio"]'),r=0;r<a.length;r++){var C=a[r];if(C!==n&&C.form===n.form){var A=cl(C);if(!A)throw Error(s(90));Se(C),Ne(C,A)}}}break;case"textarea":_e(n,a);break;case"select":r=a.value,r!=null&&fe(n,!!a.multiple,r,!1)}},be=Wc,nt=js;var X_={usingClientEntryPoint:!1,Events:[eo,hi,cl,Ve,ut,Wc]},mo={findFiberByHostInstance:Es,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Q_={bundleType:mo.bundleType,version:mo.version,rendererPackageName:mo.rendererPackageName,rendererConfig:mo.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:E.ReactCurrentDispatcher,findHostInstanceByFiber:function(n){return n=vr(n),n===null?null:n.stateNode},findFiberByHostInstance:mo.findFiberByHostInstance||G_,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Kl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Kl.isDisabled&&Kl.supportsFiber)try{Pe=Kl.inject(Q_),et=Kl}catch{}}return xn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=X_,xn.createPortal=function(n,r){var a=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Jc(r))throw Error(s(200));return K_(n,r,null,a)},xn.createRoot=function(n,r){if(!Jc(n))throw Error(s(299));var a=!1,C="",A=Ef;return r!=null&&(r.unstable_strictMode===!0&&(a=!0),r.identifierPrefix!==void 0&&(C=r.identifierPrefix),r.onRecoverableError!==void 0&&(A=r.onRecoverableError)),r=Yc(n,1,!1,null,null,a,!1,C,A),n[Cr]=r.current,Qi(n.nodeType===8?n.parentNode:n),new Qc(r)},xn.findDOMNode=function(n){if(n==null)return null;if(n.nodeType===1)return n;var r=n._reactInternals;if(r===void 0)throw typeof n.render=="function"?Error(s(188)):(n=Object.keys(n).join(","),Error(s(268,n)));return n=vr(r),n=n===null?null:n.stateNode,n},xn.flushSync=function(n){return js(n)},xn.hydrate=function(n,r,a){if(!ql(r))throw Error(s(200));return Vl(null,n,r,!0,a)},xn.hydrateRoot=function(n,r,a){if(!Jc(n))throw Error(s(405));var C=a!=null&&a.hydratedSources||null,A=!1,D="",q=Ef;if(a!=null&&(a.unstable_strictMode===!0&&(A=!0),a.identifierPrefix!==void 0&&(D=a.identifierPrefix),a.onRecoverableError!==void 0&&(q=a.onRecoverableError)),r=Sf(r,null,n,1,a??null,A,!1,D,q),n[Cr]=r.current,Qi(n),C)for(n=0;n<C.length;n++)a=C[n],A=a._getVersion,A=A(a._source),r.mutableSourceEagerHydrationData==null?r.mutableSourceEagerHydrationData=[a,A]:r.mutableSourceEagerHydrationData.push(a,A);return new zl(r)},xn.render=function(n,r,a){if(!ql(r))throw Error(s(200));return Vl(null,n,r,!1,a)},xn.unmountComponentAtNode=function(n){if(!ql(n))throw Error(s(40));return n._reactRootContainer?(js(function(){Vl(null,null,n,!1,function(){n._reactRootContainer=null,n[Cr]=null})}),!0):!1},xn.unstable_batchedUpdates=Wc,xn.unstable_renderSubtreeIntoContainer=function(n,r,a,C){if(!ql(a))throw Error(s(200));if(n==null||n._reactInternals===void 0)throw Error(s(38));return Vl(n,r,a,!1,C)},xn.version="18.3.1-next-f1338f8080-20240426",xn}var Df;function zm(){if(Df)return tu.exports;Df=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),tu.exports=lw(),tu.exports}var Pf;function aw(){if(Pf)return Gl;Pf=1;var t=zm();return Gl.createRoot=t.createRoot,Gl.hydrateRoot=t.hydrateRoot,Gl}var cw=aw(),M=ch();const uw=tw(M);function Me(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)?t:null}function Oe(t){return typeof t=="string"?t:null}function oe(t){return typeof t=="string"&&t.length>0?t:null}function ft(t){return typeof t=="boolean"?t:null}function Re(t){return typeof t=="number"&&Number.isFinite(t)?t:null}function hw(t){return typeof t=="number"&&Number.isInteger(t)&&t>0?t:null}function qt(t){if(!Array.isArray(t))return null;const e=[];for(const s of t){if(typeof s!="string")return null;e.push(s)}return e}function Ct(t,e){if(!Array.isArray(t))return null;const s=[];for(const l of t){const u=e(l);if(u===null)return null;s.push(u)}return s}function zt(t,e){if(!Array.isArray(t))return null;const s=[];for(const l of t){const u=e(l);u!==null&&s.push(u)}return s}function Xe(t,e){return typeof t=="string"&&e.includes(t)?t:null}function dw(t){try{return JSON.parse(t)}catch{return}}const fw=["auto","default","acceptEdits","plan"];function Hs(t){return typeof t=="string"&&fw.includes(t)}const pw={agentUnknown:[],answerFreeTextMulti:[],answerInterrupted:[],answerInvalid:[],answerMenuChanged:[],answerNoFreeText:[],answerNotPending:[],answerSendFailed:[],answersUnsupported:[],archiveOpenTab:[],attachmentEmpty:["name"],attachmentExecutable:["name"],attachmentSaveFailed:[],attachmentTooLarge:["max","name","size"],badMessage:[],cliFolderClosed:[],cliMissing:["command","url"],cliNotFound:[],cliNotInstalled:["label"],cliOpenFailed:[],continueFailed:[],continueHistoryMissing:[],continueNoFolder:[],continueNotInHistory:[],continueReadFailed:[],continueSameCli:[],continueTabFailed:[],continueTranscriptFailed:[],conversationNotFollowed:[],cwdMissing:["cwd"],cwdNotDir:["cwd"],diffBinaryUntracked:[],diffNewEmpty:[],diffNoStaged:[],diffNoUnstaged:[],diffReadFailed:[],dirReadFailed:[],dirSearchFailed:[],fileReadFailed:[],fileSaveBlocked:[],fileSaveFailed:[],fileSaveTooLarge:["max"],filesPerMessage:["max"],forceSendFailed:[],forceSendNoCli:[],forceSendNothing:[],forceSendUnsupported:[],forceSendWaiting:[],gitCommandFailed:["command"],gitMissing:[],gitNotFound:[],gitNotRepo:[],gitRunFailed:[],gitStatusUnknown:[],gitUnexpected:["command"],handoffEmpty:[],handoffNoTranscript:[],imageEmpty:[],imageTooLarge:["max","size"],imageTypeUnsupported:["type"],imageUnknownFormat:[],imagesPerMessage:["max"],imagesUnsupported:[],memoryAppeared:["file"],memoryBrokenBlock:["file"],memoryChooseFile:[],memoryGitFailed:["detail"],memoryHardLinks:["file"],memoryLinkOutside:["path"],memoryNotAFile:["label"],memoryNotInstalled:[],memoryNotUtf8:["file"],memoryNoteClaude:[],memoryNoteGone:[],memoryNoteHardLink:["path"],memoryNoteHardLinkCmd:["path"],memoryNoteName:[],memoryNoteOpenCode:[],memorySameFile:["file","other"],memoryViaEncoding:["file"],memoryViaFallback:[],memoryViaFile:["file"],memoryViaNoBlock:["file"],memoryViaNoBlockEither:[],memoryViaNoFolder:[],memoryViaNoIndex:[],memoryViaOutside:["file"],modePendingConfirmation:[],modeUnreachable:["key"],modesUnsupported:[],noteCliNotStarted:[],noteEmpty:[],noteExists:[],noteGone:[],noteIdInvalid:[],noteImageFailed:[],noteImagesMax:["max"],noteImagesUnsupported:[],noteInterrupted:[],noteNoAgent:[],noteNoReadySignal:[],noteSaveFailed:[],noteTooLong:["max"],notesMax:["max"],openToolSubmit:["label"],operationFailed:["detail"],pasteImageFailed:[],pathMissing:[],pathNotRelative:[],pathNullByte:[],pathOpenFailed:[],pathOutside:[],pendingSubmitAnswer:["label"],pendingSubmitPermission:["label"],pickerCliFolder:[],pickerClosed:[],pickerCreateFailed:[],pickerFolderExists:[],pickerListFailed:[],pickerNameChars:[],pickerNameInvalid:[],pickerNoProjectsHere:[],pickerNotListed:[],pickerRootMissing:[],pickerTooMany:[],planReadFailed:[],queueEditBusyEditor:[],queueEditDelivered:[],queueEditFailed:[],queueEditForced:[],queueEditNoCli:[],queueEditNotCleared:[],queueEditNotOnScreen:[],queueEditNothing:[],queueEditUnsupported:[],queueEditWaiting:[],raw:["text"],relaunchCloseFailed:[],remoteDeviceGone:[],remoteFailed:[],remoteHostOnly:[],remoteNotActive:[],remoteOpensOnHost:[],remotePortInvalid:["max","min"],remoteTooManyDevices:["max"],rewindBusy:[],rewindFailed:[],rewindNoCli:[],rewindUnknownMessage:[],rewindUnsupported:[],searchFailed:[],settingsFailed:[],settingsHostOnly:[],settingsShellMissing:[],shellNotFound:[],submitInterrupted:[],submitStartupDialog:["label"],submitStoppedTool:["label"],submitStoppedToolNoLabel:[],submitStoppedWaiting:["label"],submitStoppedWaitingNoLabel:[],tabClosedWhileOpening:[],tabDirGone:[],tabOpenFailed:[],terminalAsleep:[],terminalGone:[],terminalOpenFailed:[],tooManyTabs:["max"],vaultBusyMeasuring:[],vaultBusyMoving:[],vaultBusyWriting:[],vaultCannotWrite:[],vaultCurrentInsideTarget:[],vaultDiskFull:["detail"],vaultFailed:[],vaultIndexNotReady:[],vaultMeasureFirst:[],vaultMemoryFailed:["cwd","detail"],vaultMoveFailed:["detail"],vaultMoving:[],vaultNoCopyYet:[],vaultNotLoaded:[],vaultProjectGone:[],vaultReasonNewerFormat:[],vaultReasonOriginMissing:[],vaultReasonUnsafeId:[],vaultSessionFailed:["agent","detail","session"],vaultSessionMissing:[],vaultTargetCliFolder:[],vaultTargetInsideCurrent:[],vaultTargetNotAbsolute:[],waitingSubmit:["label"],worktreeBaseAdvanced:["base"],worktreeBaseMissing:["base"],worktreeBaseNotOpen:["base"],worktreeBranchExists:["branch"],worktreeBranchInUse:["branch"],worktreeBranchInvalid:["branch"],worktreeBranchMissing:["branch"],worktreeBranchMoved:["branch"],worktreeBranchNotIntegrated:["branch"],worktreeDiffEmpty:[],worktreeDiscardFailed:["detail"],worktreeFailed:[],worktreeFileNotInBranch:[],worktreeFolderExists:["folder"],worktreeGitFailed:["detail"],worktreeInUse:[],worktreeLocalChanges:["count"],worktreeNoConflicts:[],worktreeNoReview:[],worktreeNotRepo:[],worktreeNotesConflict:["count"],worktreeNotesFailed:["detail"],worktreeNothingToCommit:[],worktreeNothingToIntegrate:[],worktreeNothingToReview:[],worktreeProjectUnknown:[],worktreeReviewUnread:[],worktreeUncommitted:["count"],worktreeUnknown:[],worktreeUntrackedChanged:[],worktreeUpToDate:["base"]};function mw(t){return Object.prototype.hasOwnProperty.call(pw,t)}function mr(t,e=0){const s=Me(t);if(s===null)return null;const l=Oe(s.key);if(l===null||l.length===0)return null;const u=s.params;if(u===void 0)return{key:l};const k=Me(u);if(k===null)return null;const y={};for(const[i,c]of Object.entries(k)){if(typeof c=="string"||typeof c=="number"&&Number.isFinite(c)){y[i]=c;continue}const m=e===0?mr(c,e+1):null;if(m===null)return null;y[i]=m}return{key:l,params:y}}function gw(t){if(!Array.isArray(t))return null;const e=[];for(const s of t){const l=mr(s);if(l===null)return null;e.push(l)}return e}const Ar=["claude-code","codex","opencode","antigravity","pi"],vw=["gemini-cli","antigravity-ide"],va=[...Ar,...vw],_w={"gemini-cli":"Gemini CLI","antigravity-ide":"Antigravity IDE"};function Ai(t){return Ar.includes(t)}const ww=["at-quoted","bare-path-paste","quoted-path-line"],yw=["at"],bw=["usage-with-variants","token-count","usage-with-catalog","status-line"],kw=["child-session-marker"],Cw=["active","missing","other-command","disabled","unreadable"],Sw=["cli","tools"];function qm(t,e=null){return!t.statusSource||e==="unknown"}const Vm={sessionIdAtLaunch:!1,resume:!1,statusSource:!1,readySignal:!1,permissionCycle:null,models:null,efforts:null,questionCards:!1,imagesByPath:null,fileMentions:null,rewind:!1,contextWindowSource:null,plans:!1,waitingBlocksSubmit:!1,forceSend:!1,editQueue:!1,readOnlyLaunch:null};function xw(t,e){var u;const s=t.permissionCycle;if(s===null)return null;const l=e?((u=t.readOnlyLaunch)==null?void 0:u.mode)??null:null;return l!==null&&s.modes.includes(l)?l:s.launchMode}function uh(t){return t.filter(e=>e.available).length>1}function Ew(t){const e=Me(t);if(e===null)return null;const s=e.modes;if(!Array.isArray(s)||s.length===0)return null;const l=[];for(const y of s){if(!Hs(y))return null;l.push(y)}const u=e.launchMode;if(!Hs(u)||!l.includes(u))return null;const k=oe(e.keyLabel);return k===null?null:{modes:l,launchMode:u,keyLabel:k,approvesPendingOnCycle:e.approvesPendingOnCycle===!0}}function Tw(t){const e=Me(t);if(e===null)return null;const s=Xe(e.guard,Sw),l=e.mode;return s===null||l!==null&&!Hs(l)?null:{mode:l===null?null:l,guard:s}}function Of(t){const e=Me(t);if(e===null)return null;const s=Xe(e.state,Cw),l=oe(e.settingsPath),u=oe(e.scriptPath),k=e.fragment,y=k===null?null:oe(k);return s===null||l===null||u===null||k!==null&&y===null?null:{state:s,settingsPath:l,scriptPath:u,fragment:y}}function Lw(t){const e=Me(t);if(e===null)return null;const s=oe(e.value),l=Oe(e.label),u=Oe(e.family),k=ft(e.long),y=e.window,i=y===null?null:Re(y);return s===null||l===null||u===null||k===null||y!==null&&i===null?null:{value:s,label:l,family:u,long:k,window:i}}function Nw(t){const e=Me(t);if(e===null)return null;const s=oe(e.value),l=Oe(e.label);return s===null||l===null?null:{value:s,label:l}}function Bf(t,e){const s=Ct(t,e);return s===null||s.length===0?null:s}function Rw(t){const e=Me(t);return e===null?{...Vm}:{sessionIdAtLaunch:e.sessionIdAtLaunch===!0,resume:e.resume===!0,statusSource:e.statusSource===!0,readySignal:e.readySignal===!0,permissionCycle:Ew(e.permissionCycle),models:Bf(e.models,Lw),efforts:Bf(e.efforts,Nw),questionCards:e.questionCards===!0,imagesByPath:Xe(e.imagesByPath,ww),fileMentions:Xe(e.fileMentions,yw),rewind:e.rewind===!0,contextWindowSource:Xe(e.contextWindowSource,bw),plans:e.plans===!0,waitingBlocksSubmit:e.waitingBlocksSubmit===!0,forceSend:e.forceSend===!0,editQueue:e.editQueue===!0,readOnlyLaunch:Tw(e.readOnlyLaunch)}}function Ff(t){const e=Me(t);if(e===null)return null;const s=Xe(e.id,Ar),l=Oe(e.label),u=Oe(e.command),k=Oe(e.installUrl);return s===null||l===null||u===null||k===null?null:{id:s,label:l,command:u,available:e.available===!0,version:Oe(e.version),installUrl:k,missingMessage:mr(e.missingMessage),capabilities:Rw(e.capabilities),environmentNotice:Xe(e.environmentNotice,kw),statusLine:Of(e.statusLine),planLimitsSetup:Of(e.planLimitsSetup)}}const Mw=["staged","unstaged","untracked","conflict"],Km=["added","modified","deleted","renamed","copied","type-changed","untracked","conflict"],Aw=["ready","not-a-repo","git-missing","error"],su={state:"not-a-repo",message:null,repoRoot:"",branch:null,head:null,upstream:null,ahead:0,behind:0,changes:[],worktrees:[],truncated:!1,updatedAt:0},Iw=["meta","hunk","context","added","removed"];function jw(t){const e=Me(t);if(e===null)return null;const s=oe(e.path),l=Xe(e.kind,Km),u=Xe(e.stage,Mw);return s===null||l===null||u===null?null:{path:s,kind:l,stage:u,oldPath:Oe(e.oldPath)}}function Dw(t){const e=Me(t);if(e===null)return null;const s=oe(e.path);return s===null?null:{path:s,branch:Oe(e.branch),isCurrent:e.isCurrent===!0,isMain:e.isMain===!0}}function Pw(t){const e=Me(t);if(e===null)return null;const s=Xe(e.state,Aw),l=Oe(e.repoRoot),u=Re(e.ahead),k=Re(e.behind),y=Ct(e.changes,jw),i=Ct(e.worktrees,Dw),c=Re(e.updatedAt);return s===null||l===null||u===null||k===null||y===null||i===null||c===null?null:{state:s,message:mr(e.message),repoRoot:l,branch:Oe(e.branch),head:Oe(e.head),upstream:Oe(e.upstream),ahead:u,behind:k,changes:y,worktrees:i,truncated:e.truncated===!0,updatedAt:c}}function Ow(t){const e=Me(t);if(e===null)return null;const s=Xe(e.kind,Iw),l=Oe(e.text);return s===null||l===null?null:{kind:s,text:l,oldLine:Re(e.oldLine),newLine:Re(e.newLine)}}function Hf(t){const e=Me(t);if(e===null)return null;const s=oe(e.path),l=ft(e.staged),u=Ct(e.lines,Ow);return s===null||l===null||u===null?null:{path:s,staged:l,lines:u,truncated:e.truncated===!0,binary:e.binary===!0,message:mr(e.message)}}const Bw=100,Fw=/^[A-Za-z0-9._/-]+$/,Hw=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])$/i;function Uw(t){if(t.length===0)return"empty";if(t.length>Bw)return"too-long";if(!Fw.test(t))return"characters";if(t.startsWith("-"))return"starts-with-dash";if(t.startsWith("/")||t.endsWith("/")||t.includes("//"))return"slashes";const e=t.split("/");if(t.includes("..")||t.endsWith(".")||e.some(l=>l.startsWith(".")))return"dots";if(e.some(l=>l.endsWith(".lock")))return"lock";if(t==="HEAD")return"reserved";const s=Gm(t).split(".")[0]??"";return Hw.test(s)?"reserved":null}function Gm(t){return t.split("/").join("-")}const $w=8,Ww=["nested-repo","too-many","copied"],zw=2e4,qw=["clean","conflicts"],Vw=["ready","changes","none"],Kw=["working","pending","done"],Gw=["nothing","behind","no-base-folder","local-changes"],Yw=["not-integrated","checked-out"];function Xw(t,e){const s=y=>y==="cli"?0:y==="tools"?1:2,l=e.filter(y=>y.id!==t),u=l.length>0?l:e;let k=null;for(const y of u)(k===null||s(y.guard)<s(k.guard))&&(k=y);return(k==null?void 0:k.id)??null}function Qw(t){return typeof t=="string"&&/^[0-9a-f]{40}(?:[0-9a-f]{24})?$/.test(t)?t:null}function Jw(t){return typeof t=="string"&&/^[0-9a-f]{64}$/.test(t)?t:null}function Zw(t){const e=Me(t);if(e===null)return null;const s=Re(e.files),l=Re(e.bytes);if(s===null||l===null)return null;if(e.blocked!==null&&e.blocked!==void 0){const k=Xe(e.blocked,Ww);return k===null?null:{files:s,bytes:l,stamp:null,blocked:k}}const u=Jw(e.stamp);return u===null?null:{files:s,bytes:l,stamp:u,blocked:null}}function e0(t){const e=Me(t);if(e===null)return null;const s=oe(e.mainCwd),l=ft(e.linked);return s===null||l===null?null:{mainCwd:s,branch:oe(e.branch),linked:l}}function t0(t){const e=Me(t);if(e===null)return null;const s=oe(e.branch),l=ft(e.exists);return s===null||l===null?null:{branch:s,exists:l,reopenable:e.reopenable===!0}}function Uf(t){const e=Me(t);if(e===null)return null;const s=Re(e.files),l=Re(e.bytes),u=qt(e.sample);return s===null||l===null||u===null?null:{files:s,bytes:l,overCap:e.overCap===!0,sample:u}}function n0(t){const e=Me(t);if(e===null)return null;const s=oe(e.name);return s===null?null:{name:s,checkedOut:e.checkedOut===!0}}function r0(t){const e=Me(t);if(e===null)return null;const s=oe(e.mainRoot),l=oe(e.parentDir),u=oe(e.separator),k=Ct(e.branches,n0),y=Re(e.mainChanges),i=Uf(e.notes),c=e.include===null?null:Uf(e.include);return s===null||l===null||u===null||k===null||y===null||i===null||e.include!==null&&c===null?null:{mainRoot:s,parentDir:l,separator:u,currentBranch:oe(e.currentBranch),branches:k,mainChanges:y,include:c,notes:i}}function s0(t){const e=Me(t);if(e===null)return null;const s=oe(e.path);if(s===null)return null;const l=e.integrated;return{id:oe(e.id),path:s,branch:oe(e.branch),base:oe(e.base),isCurrent:e.isCurrent===!0,isMain:e.isMain===!0,changes:Re(e.changes),ahead:Re(e.ahead),integrated:typeof l=="boolean"?l:null,behind:Re(e.behind),merge:i0(e.merge),overlaps:zt(e.overlaps,o0)??[],review:Ym(e.review)}}function hh(t){const e=qt(t.files),s=Re(t.fileCount);return e===null||s===null?null:{files:e,fileCount:s}}function i0(t){const e=Me(t);if(e===null)return null;const s=Xe(e.state,qw),l=hh(e);return s===null||l===null?null:{state:s,...l}}function o0(t){const e=Me(t);if(e===null)return null;const s=oe(e.branch),l=hh(e);return s===null||l===null?null:{branch:s,...l}}function Ym(t){const e=Me(t);if(e===null)return null;const s=Xe(e.agent,Ar),l=Xe(e.state,Kw),u=Re(e.requestedAt);return s===null||l===null||u===null?null:{agent:s,state:l,verdict:l==="done"?Xe(e.verdict,Vw)??"none":null,stale:e.stale===!0,requestedAt:u,terminalId:oe(e.terminalId)}}function l0(t){const e=Me(t);if(e===null)return null;const s=oe(e.sha),l=Oe(e.subject),u=Re(e.at);return s===null||l===null||u===null?null:{sha:s,subject:l,at:u}}function a0(t){const e=Me(t);if(e===null)return null;const s=oe(e.path),l=Xe(e.kind,Km);return s===null||l===null?null:{path:s,oldPath:oe(e.oldPath),kind:l}}function c0(t){const e=Me(t);if(e===null)return null;const s=oe(e.id),l=oe(e.branch),u=oe(e.base),k=Ct(e.commits,l0),y=Re(e.commitCount),i=Ct(e.files,a0),c=Re(e.fileCount),m=Re(e.uncommitted);return s===null||l===null||u===null||k===null||y===null||i===null||c===null||m===null?null:{id:s,branch:l,base:u,commits:k,commitCount:y,files:i,fileCount:c,uncommitted:m}}function u0(t){const e=Me(t);if(e===null)return null;const s=oe(e.id),l=oe(e.branch),u=oe(e.base),k=oe(e.prompt),y=Re(e.ahead),i=Re(e.uncommitted),c=ft(e.branchBusy);return s===null||l===null||u===null||k===null||y===null||i===null||c===null?null:{id:s,branch:l,base:u,author:Xe(e.author,Ar),prompt:k,ahead:y,uncommitted:i,branchBusy:c}}function h0(t){const e=Me(t);if(e===null)return null;const s=oe(e.id),l=oe(e.branch),u=oe(e.base),k=Re(e.ahead),y=Re(e.behind),i=hh(e),c=Ct(e.tabs,Xm),m=qt(e.localConflicts),v=Re(e.branchUncommitted),h=e.blocker,b=h===null?null:Xe(h,Gw);return s===null||l===null||u===null||k===null||y===null||i===null||c===null||m===null||v===null||h!==null&&b===null?null:{id:s,branch:l,base:u,baseFolder:oe(e.baseFolder),command:oe(e.command),branchCommit:Qw(e.branchCommit),ahead:k,behind:y,...i,review:Ym(e.review),tabs:c,localConflicts:m,branchUncommitted:v,blocker:b,notes:d0(e.notes)}}function d0(t){const e=Me(t);if(e===null)return null;const s=qt(e.returning),l=qt(e.conflicts);return s===null||l===null?null:{returning:s,merging:qt(e.merging)??[],resolved:qt(e.resolved)??[],conflicts:l}}function f0(t){const e=Me(t);if(e===null)return null;const s=Re(e.commits),l=oe(e.base);if(s===null||l===null)return null;const u=Me(e.notes),k=Re(u==null?void 0:u.returned),y=qt(u==null?void 0:u.stayed);return k===null||y===null?{commits:s,base:l}:{commits:s,base:l,notes:{returned:k,stayed:y}}}function p0(t){const e=Me(t);if(e===null)return null;const s=oe(e.id),l=oe(e.branch),u=oe(e.base);return s===null||l===null||u===null?null:{id:s,branch:l,base:u,ahead:Re(e.ahead)}}function m0(t){const e=Me(t);if(e===null)return null;const s=oe(e.id),l=oe(e.branch),u=oe(e.base),k=oe(e.folder),y=oe(e.command),i=e.blocker,c=i===null?null:Xe(i,Yw);return s===null||l===null||u===null||k===null||y===null||i!==null&&c===null?null:{id:s,branch:l,base:u,folder:k,command:y,ahead:Re(e.ahead),blocker:c}}const g0=["agent","shell"];function Xm(t){const e=Me(t);if(e===null)return null;const s=oe(e.terminalId),l=Xe(e.kind,g0),u=Oe(e.label);return s===null||l===null||u===null?null:{terminalId:s,kind:l,label:u}}const $f=255;function v0(t){var k;const e=Me(t);if(e===null)return null;const s=hw(e.pid),l=oe(e.name);if(s===null||l===null||l.length>$f)return null;const u=((k=Oe(e.description))==null?void 0:k.trim())??"";return{pid:s,name:l,description:u.length>0&&u.length<=$f?u:null}}function _0(t){const e=Me(t);if(e===null)return null;const s=oe(e.id),l=oe(e.branch),u=oe(e.path),k=qt(e.commands),y=qt(e.uncommitted),i=Re(e.uncommittedCount),c=Ct(e.tabs,Xm),m=qt(e.returning),v=qt(e.conflicts),h=ft(e.deletesBranch);if(s===null||l===null||u===null||k===null||y===null||i===null||c===null||m===null||v===null||h===null)return null;const b=typeof e.inUse=="boolean"?e.inUse:null;return{id:s,branch:l,path:u,commands:k,uncommitted:y,uncommittedCount:i,untracked:i>0?Zw(e.untracked):null,tabs:c,returning:m,merging:(qt(e.merging)??[]).filter(T=>m.includes(T)),resolved:qt(e.resolved)??[],conflicts:v,inUse:b,holders:b===!0?(zt(e.holders,v0)??[]).slice(0,$w):[],deletesBranch:h,branchUnused:h&&e.branchUnused===!0,createdBranch:e.createdBranch!==!1}}function w0(t){const e=Me(t);if(e===null)return null;const s=ft(e.branchDeleted),l=Re(e.returned),u=Re(e.discarded);return s===null||l===null||u===null?null:{branchDeleted:s,returned:l,discarded:u,discardedFiles:Re(e.discardedFiles)??0}}const y0=["custom","ai","first-message","none"],b0=["native","vault"],k0=["idle","scanning","ready"],C0=["agent","shell"],S0=["busy","idle","waiting","offline","unknown"],x0=["server-closed"];function E0(t){const e=Me(t);if(e===null)return null;const s=oe(e.sessionId),l=Oe(e.title),u=Xe(e.titleSource,y0),k=Re(e.updatedAt),y=Re(e.sizeBytes);if(s===null||l===null||u===null||k===null||y===null)return null;const i=e.agent===void 0?"claude-code":Xe(e.agent,va);if(i===null)return null;const c=Oe(e.cwd)??"";return{agent:i,sessionId:s,cwd:c,title:l,titleSource:u,updatedAt:k,sizeBytes:y,archived:e.archived===!0,storage:Xe(e.storage,b0)??"native",partial:e.partial===!0,worktree:t0(e.worktree)}}function T0(t){const e=Me(t);if(e===null)return null;const s=Oe(e.cwd),l=ft(e.cwdExists),u=zt(e.sessions,E0),k=Re(e.lastActivityAt);if(s===null||l===null||u===null||k===null)return null;const y=oe(e.key);if(y!==null)return{key:y,fallbackName:Oe(e.fallbackName)??"",cwd:s,cwdExists:l,isGitRepo:e.isGitRepo===!0,sessions:u,lastActivityAt:k};const i=oe(e.slug);return i===null?null:{key:i,fallbackName:s.length===0?i:"",cwd:s,cwdExists:l,isGitRepo:!1,sessions:u,lastActivityAt:k}}function L0(t){const e=Me(t);if(e===null)return null;const s=Xe(e.state,k0),l=Re(e.scannedFiles),u=Re(e.totalFiles);return s===null||l===null||u===null?null:{state:s,scannedFiles:l,totalFiles:u}}function Wf(t){const e=Me(t);if(e===null)return null;const s=oe(e.terminalId),l=Xe(e.kind,C0)??"agent";let u=null;if(l==="agent"&&(u=e.agent===void 0?"claude-code":Xe(e.agent,Ar),u===null))return null;const k=Oe(e.cwd),y=Oe(e.sessionId),i=Oe(e.label),c=ft(e.resumed),m=Re(e.createdAt),v=ft(e.alive);if(s===null||k===null||y===null||i===null||c===null||m===null||v===null)return null;const h=e.exitCode;return{terminalId:s,kind:l,agent:u,cwd:k,sessionId:y,label:i,resumed:c,createdAt:m,alive:v,exitCode:typeof h=="number"?h:null,sleeping:e.sleeping===!0,launchedAt:Re(e.launchedAt),worktree:e0(e.worktree),review:l==="agent"&&e.review===!0}}const Qm=["user","assistant"];function Yl(t){return t.replace(/[`*_]/g,"").replace(/\s+/g," ").trim().toLowerCase()}function N0(t,e){return Yl(t.question)===Yl(e.question)&&t.multiSelect===e.multiSelect&&t.options.length===e.options.length&&t.options.every((s,l)=>{var y;const u=Yl(s.label),k=Yl(((y=e.options[l])==null?void 0:y.label)??"");return u.length>0&&k.length>0&&(u.startsWith(k)||k.startsWith(u))})}const Jm=["content","attachment","pasted"],R0=["compacted","interrupted","error"],M0=["cli-plans","project","scratch"],A0=120,I0=20,j0=20,zf=4e3,iu={lastRequestTokens:0,lastOutputTokens:0,lastModel:null,contextWindow:null,contextWindowEstimated:!1,totalInputTokens:0,totalOutputTokens:0,totalCacheReadTokens:0,assistantMessages:0},qf=["waiting","live","unavailable","no-transcript"];function D0(t){const e=Me(t);if(e===null)return null;const s=Re(e.inputTokens),l=Re(e.outputTokens),u=Re(e.cacheCreationInputTokens),k=Re(e.cacheReadInputTokens);return s===null||l===null||u===null||k===null?null:{inputTokens:s,outputTokens:l,cacheCreationInputTokens:u,cacheReadInputTokens:k}}function P0(t){const e=Me(t);if(e===null)return null;const s=oe(e.label);return s===null?null:{label:s,description:Oe(e.description)??""}}function O0(t){const e=Me(t);if(e===null)return null;const s=oe(e.question),l=Ct(e.options,P0);return s===null||l===null||l.length===0?null:{question:s,header:Oe(e.header)??"",multiSelect:e.multiSelect===!0,options:l}}function dh(t){const e=Me(t);if(e===null)return null;switch(e.kind){case"text":{const s=Oe(e.text),l=ft(e.truncated);return s===null||l===null?null:{kind:"text",text:s,truncated:l}}case"tool-call":{const s=Oe(e.toolUseId),l=Oe(e.name),u=Oe(e.input),k=ft(e.truncated);return s===null||l===null||u===null||k===null?null:{kind:"tool-call",toolUseId:s,name:l,input:u,truncated:k}}case"tool-result":{const s=Oe(e.toolUseId),l=Oe(e.text),u=ft(e.isError),k=ft(e.truncated),y=Re(e.imageCount);return s===null||l===null||u===null||k===null||y===null?null:{kind:"tool-result",toolUseId:s,text:l,isError:u,truncated:k,imageCount:y}}case"thinking":return{kind:"thinking"};case"question":{const s=oe(e.toolUseId),l=Ct(e.questions,O0);return s===null||l===null||l.length===0?null:{kind:"question",toolUseId:s,questions:l}}case"image":{const s=Re(e.index),l=Oe(e.mediaType);if(s===null||l===null)return null;const u=Xe(e.source,Jm)??"content";return{kind:"image",index:s,mediaType:l,source:u}}case"notice":{const s=Xe(e.notice,R0);return s===null?null:{kind:"notice",notice:s,detail:Oe(e.detail)??""}}default:return null}}function ou(t){const e=Me(t);if(e===null)return null;const s=oe(e.eventId),l=Xe(e.role,Qm),u=Re(e.at),k=Ct(e.parts,dh);return s===null||l===null||u===null||k===null?null:{eventId:s,role:l,at:u,parts:k,model:Oe(e.model),usage:D0(e.usage),effort:Oe(e.effort),durationMs:Re(e.durationMs),queued:e.queued===!0}}function B0(t){const e=Me(t);if(e===null)return null;const s=oe(e.toolUseId),l=Oe(e.description),u=Re(e.startedAt);return s===null||l===null||u===null?null:{toolUseId:s,description:l.slice(0,A0),background:e.background===!0,startedAt:u}}function F0(t){const e=Me(t);if(e===null)return null;const s=oe(e.id),l=Oe(e.text),u=Re(e.images),k=Re(e.at);if(s===null||l===null||u===null||k===null)return null;const y={id:s,text:l.slice(0,zf),truncated:e.truncated===!0||l.length>zf,images:Math.max(0,Math.floor(u)),at:k},i=oe(e.eventId);return i!==null&&(y.eventId=i),e.forced===!0&&(y.forced=!0),y}function Vf(t){const e=Me(t);if(e===null)return null;const s=Re(e.lastRequestTokens),l=Re(e.lastOutputTokens),u=Re(e.totalInputTokens),k=Re(e.totalOutputTokens),y=Re(e.totalCacheReadTokens),i=Re(e.assistantMessages);if(s===null||l===null||u===null||k===null||y===null||i===null)return null;const c=Oe(e.lastEffort);return{lastRequestTokens:s,lastOutputTokens:l,lastModel:Oe(e.lastModel),contextWindow:Re(e.contextWindow),contextWindowEstimated:e.contextWindowEstimated===!0,totalInputTokens:u,totalOutputTokens:k,totalCacheReadTokens:y,assistantMessages:i,...c!==null?{lastEffort:c}:{},...e.compacted===!0?{compacted:!0}:{}}}function H0(t){const e=Me(t);if(e===null)return null;const s=oe(e.fileName),l=oe(e.title),u=Re(e.modifiedAt),k=Re(e.sizeBytes);if(s===null||l===null||u===null||k===null)return null;const y=e.origin,i=M0.find(m=>m===y)??"cli-plans",c=Oe(e.path)??"";return{fileName:s,title:l,origin:i,path:c,absolutePath:Oe(e.absolutePath)??"",exists:e.exists===!0,modifiedAt:u,sizeBytes:k}}function U0(t){const e=Me(t);if(e===null)return null;const s=oe(e.fileName),l=Oe(e.text);return s===null||l===null?null:{fileName:s,text:l,truncated:e.truncated===!0}}const Zm=[{value:"default",label:"Por defecto",family:"",long:!1,window:null},{value:"opus",label:"Opus",family:"opus",long:!1,window:2e5},{value:"opus[1m]",label:"Opus",family:"opus",long:!0,window:1e6},{value:"sonnet",label:"Sonnet",family:"sonnet",long:!1,window:2e5},{value:"sonnet[1m]",label:"Sonnet",family:"sonnet",long:!0,window:1e6},{value:"haiku",label:"Haiku",family:"haiku",long:!1,window:2e5},{value:"fable",label:"Fable",family:"fable",long:!1,window:2e5},{value:"fable[1m]",label:"Fable",family:"fable",long:!0,window:1e6}];function $0(t){if(t.window===null)return t.label;const e=t.window>=1e6?`${Math.round(t.window/1e6)}M`:`${Math.round(t.window/1e3)}k`;return`${t.label} · ${e}`}function W0(t,e=Zm){const s=z0(t,e);if(s===null||t===null)return null;const l=t.includes("[1m]");return e.find(u=>u.family===s&&u.long===l)??null}function z0(t,e=Zm){var l;return t===null||t.length===0?null:((l=e.filter(u=>u.family.length>0).sort((u,k)=>k.family.length-u.family.length).find(u=>t.includes(u.family)))==null?void 0:l.family)??null}function q0(t){return`/model ${t}`}const fh="/effort";function V0(t,e=fh){return`${e} ${t}`}const K0=["dir","file"],G0=["ignored","always"];function Y0(t){return typeof t=="string"&&/^[0-9a-f]{64}$/.test(t)}function eg(t){const e=Me(t);if(e===null)return null;const s=oe(e.name),l=oe(e.path),u=Xe(e.kind,K0),k=Re(e.sizeBytes),y=Re(e.modifiedAt);if(s===null||l===null||u===null||k===null||y===null)return null;const i=Xe(e.hidden,G0),c={name:s,path:l,kind:u,sizeBytes:k,modifiedAt:y};return i===null?c:{...c,hidden:i}}function X0(t){const e=Me(t);if(e===null)return null;const s=Oe(e.query),l=Ct(e.entries,eg);return s===null||l===null?null:{query:s,entries:l,truncated:e.truncated===!0}}function Q0(t){const e=Me(t);if(e===null)return null;const s=Oe(e.path),l=Ct(e.entries,eg),u=Re(e.hiddenCount);return s===null||l===null||u===null?null:{path:s,entries:l,truncated:e.truncated===!0,hiddenCount:u}}function Kf(t){const e=Me(t);if(e===null)return null;const s=oe(e.path),l=Oe(e.text),u=Re(e.sizeBytes),k=ft(e.binary);if(s===null||l===null||u===null||k===null)return null;const y={path:s,language:Oe(e.language),text:l,sizeBytes:u,truncated:e.truncated===!0,binary:k},i=e.hash;return e.editable===!0&&Y0(i)?{...y,editable:!0,hash:i}:y}function J0(t){const e=Me(t);if(e===null)return null;const s=oe(e.pickerId),l=oe(e.path),u=Ct(e.entries,y=>oe(y)),k=Ct(e.roots,y=>oe(y));return s===null||l===null||u===null||k===null?null:{pickerId:s,path:l,entries:u,roots:k,canGoUp:e.canGoUp===!0,truncated:e.truncated===!0}}const tg=1e6,Z0=100,ey=999999;function ng(t){return t.pasted.reduce((e,s)=>e+s.text.length,t.text.length)}function oa(t){return t.text.trim().length===0&&t.pasted.every(e=>e.text.trim().length===0)}function rg(t,e){return t.text!==e.text||t.pasted.length!==e.pasted.length?!1:t.pasted.every((s,l)=>{const u=e.pasted[l];return u!==void 0&&u.number===s.number&&u.text===s.text})}function ty(t){const e=Me(t);if(e===null)return null;const s=e.number,l=Oe(e.text);return typeof s!="number"||!Number.isInteger(s)||s<1||s>ey||l===null?null:{number:s,text:l}}function ny(t){const e=Me(t);if(e===null)return null;const s=Oe(e.text),l=Ct(e.pasted,ty);return s===null||l===null||l.length>Z0||new Set(l.map(u=>u.number)).size!==l.length?null:{text:s,pasted:l}}const la="MEMORY.md",ph=["AGENTS.md","CLAUDE.md"],sg=["claude-code","codex","antigravity","opencode","pi"],ry=["outside","encoding"],sy=["create","append-block","replace-block","append-lines","copy"];function iy(t){return{instructionFiles:[...ph],gitMode:t!==null&&t.git.kind==="error"?"version":"ignore",importNative:t!==null&&t.native.pending>0,copyFromMainWorktree:t!==null&&t.git.kind==="repo"&&t.git.worktree!==null&&t.git.worktree.mainHasMemory}}function oy(t){const e=Me(t);if(e===null)return null;const s=Xe(e.name,ph),l=ft(e.exists),u=ft(e.hasBlock),k=ft(e.blockCurrent),y=ft(e.brokenBlock),i=e.problem,c=i===null?null:Xe(i,ry);return s===null||l===null||u===null||k===null||y===null||i!==null&&c===null?null:{name:s,exists:l,hasBlock:u,blockCurrent:k,brokenBlock:y,problem:c}}function ly(t){const e=Me(t);if(e===null)return null;switch(e.kind){case"not-repo":return{kind:"not-repo"};case"error":{const s=mr(e.message);return s===null?null:{kind:"error",message:s}}case"repo":{const s=ft(e.ignored);if(s===null)return null;if(e.worktree===null)return{kind:"repo",ignored:s,worktree:null};const l=Me(e.worktree);if(l===null)return null;const u=oe(l.mainPath),k=ft(l.mainHasMemory);return u===null||k===null?null:{kind:"repo",ignored:s,worktree:{mainPath:u,mainHasMemory:k}}}default:return null}}function ay(t){const e=Me(t);if(e===null)return null;const s=Xe(e.agent,sg),l=oe(e.label),u=ft(e.reaches),k=mr(e.via);return s===null||l===null||u===null||k===null?null:{agent:s,label:l,reaches:u,via:k}}function cy(t){const e=Me(t);if(e===null)return null;const s=oe(e.name),l=Oe(e.title),u=Oe(e.description),k=Re(e.sizeBytes),y=Re(e.modifiedAt);return s===null||l===null||u===null||k===null||y===null?null:{name:s,title:l,description:u,sizeBytes:k,modifiedAt:y}}const uy=["line","command","json"];function hy(t){const e=Me(t);if(e===null)return null;const s=Xe(e.agent,sg),l=oe(e.label),u=oe(e.target),k=Xe(e.kind,uy),y=oe(e.text),i=mr(e.note);return s===null||l===null||u===null||k===null||y===null||i===null?null:{agent:s,label:l,target:u,kind:k,text:y,note:i}}function dy(t){const e=Me(t);if(e===null)return null;const s=oe(e.cwd),l=ft(e.folderExists),u=ft(e.indexExists),k=ft(e.installed),y=Ct(e.notes,cy),i=Ct(e.files,oy),c=ly(e.git),m=Ct(e.reach,ay),v=Me(e.native),h=v===null?null:Re(v.available),b=v===null?null:Re(v.pending),T=Ct(e.globalFragments,hy);return s===null||l===null||u===null||k===null||y===null||i===null||c===null||m===null||h===null||b===null||T===null?null:{cwd:s,folderExists:l,indexExists:u,installed:k,notes:y,files:i,git:c,reach:m,native:{available:h,pending:b},globalFragments:T}}function Gf(t){const e=Me(t);if(e===null)return null;const s=oe(e.file),l=Xe(e.action,sy),u=Oe(e.preview),k=Oe(e.copiedFrom);return s===null||l===null||u===null?null:{file:s,action:l,preview:u,copiedFrom:k}}function fy(t){const e=Me(t);if(e===null)return null;const s=oe(e.name),l=Oe(e.text),u=ft(e.truncated);return s===null||l===null||u===null?null:{name:s,text:l,truncated:u}}const Yf=20;function py(t,e="Nota"){const s=t.text.split(`
|
|
41
|
+
`).map(l=>l.trim()).find(l=>l.length>0);return s===void 0?t.images.length>0?"Imagen":e:s.length>40?`${s.slice(0,40)}…`:s}function my(t){const e=Me(t);if(e===null)return null;const s=oe(e.imageId),l=oe(e.mediaType),u=Re(e.bytes);return s===null||l===null||u===null?null:{imageId:s,mediaType:l,bytes:u}}function gy(t){const e=Me(t);if(e===null)return null;const s=oe(e.noteId),l=Oe(e.text),u=Ct(e.images,my),k=Re(e.createdAt),y=Re(e.updatedAt);return s===null||l===null||u===null?null:{noteId:s,text:l,images:u,createdAt:k??0,updatedAt:y??0}}const Bs={fiveHours:300,day:1440,week:10080,month:43200},vy=8,_y=/^[A-Za-z0-9][A-Za-z0-9_.:-]{0,63}$/;function wy(t){const e=Me(t);if(e===null)return null;const s=e.id;if(typeof s!="string"||!_y.test(s))return null;const l=Re(e.usedPercent),u=Re(e.observedAt);if(l===null||l<0||u===null||u<=0)return null;const k=e.minutes,y=k===null?null:Re(k);if(k!==null&&(y===null||y<=0))return null;const i=e.resetsAt,c=i===null?null:Re(i);return i!==null&&(c===null||c<=0)?null:{id:s,minutes:y,usedPercent:l,resetsAt:c,observedAt:u}}function yy(t){var e;return((e=zt(t,wy))==null?void 0:e.slice(0,vy))??null}function by(t){const e=Me(t);if(e===null)return null;const s=Xe(e.agent,Ar),l=yy(e.windows);return s===null||l===null?null:{agent:s,windows:l}}function ky(t,e){return t.filter(s=>s.resetsAt===null||s.resetsAt>e)}const ig=3,Cy=3e4,Sy=["results","time"];function Ni(t){return typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}function bo(t,e){if(t==null)return null;const s=e(t);return s===null?void 0:s}function og(t){const e=Me(t);if(e===null)return null;const s=Xe(e.agent,va),l=oe(e.sessionId),u=bo(e.cwd,Oe),k=Oe(e.title),y=bo(e.eventId,oe),i=bo(e.role,b=>Xe(b,Qm)),c=bo(e.at,Re),m=Oe(e.snippet),v=Ni(e.matchStart),h=Ni(e.matchLength);return s===null||l===null||u===void 0||k===null||y===void 0||i===void 0||c===void 0||m===null||v===null||h===null||v+h>m.length?null:{agent:s,sessionId:l,cwd:u,title:k,eventId:y,role:i,at:c,snippet:m,matchStart:v,matchLength:h}}function xy(t){const e=Me(t);if(e===null)return null;const s=Oe(e.query),l=zt(e.hits,og),u=Ni(e.sessionsScanned),k=Ni(e.sessionsTotal),y=bo(e.truncated,i=>Xe(i,Sy));return s===null||l===null||u===null||k===null||u>k||y===void 0?null:{query:s,hits:l,sessionsScanned:u,sessionsTotal:k,truncated:y}}function Ey(t){const e=Me(t);if(e===null)return null;const s=Oe(e.query),l=zt(e.hits,og),u=Ni(e.sessionsScanned),k=Ni(e.sessionsTotal);return s===null||l===null||u===null||k===null||u>k?null:{query:s,hits:l,sessionsScanned:u,sessionsTotal:k}}const Ty=["off","idle","measuring","writing","moving"];function dn(t){return typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}function vo(t,e){if(t==null)return null;const s=e(t);return s===null?void 0:s}function Ly(t){const e=Me(t);if(e===null)return null;const s=Xe(e.agent,va),l=dn(e.sessions),u=dn(e.eventBytes),k=dn(e.images),y=dn(e.imageBytes),i=dn(e.skippedArchived),c=dn(e.skippedEmpty),m=dn(e.unsupported),v=dn(e.failed),h=gw(e.failureReasons);return s===null||l===null||u===null||k===null||y===null||i===null||c===null||m===null||v===null||h===null?null:{agent:s,sessions:l,eventBytes:u,images:k,imageBytes:y,skippedArchived:i,skippedEmpty:c,unsupported:m,failed:v,failureReasons:h}}function Ny(t){const e=Me(t);if(e===null)return null;const s=Re(e.measuredAt),l=Re(e.durationMs),u=zt(e.byAgent,Ly),k=dn(e.memoryProjects),y=dn(e.memoryBytes);return s===null||l===null||u===null||k===null||y===null?null:{measuredAt:s,durationMs:l,byAgent:u,memoryProjects:k,memoryBytes:y}}function Ry(t){const e=Me(t);if(e===null)return null;const s=dn(e.done),l=dn(e.total);return s===null||l===null?null:{done:s,total:l}}function My(t){const e=Me(t);if(e===null)return null;const s=ft(e.enabled),l=Oe(e.dir),u=ft(e.isDefaultDir),k=Xe(e.state,Ty),y=dn(e.sessions),i=dn(e.passSessions),c=dn(e.bytes),m=dn(e.pending),v=vo(e.progress,Ry),h=vo(e.lastPassAt,Re),b=vo(e.measurement,Ny),T=vo(e.previousDir,Oe),N=vo(e.lastError,mr);return s===null||l===null||u===null||k===null||y===null||i===null||c===null||m===null||v===void 0||h===void 0||b===void 0||T===void 0||N===void 0?null:{enabled:s,dir:l,isDefaultDir:u,state:k,progress:v,sessions:y,passSessions:i,bytes:c,lastPassAt:h,pending:m,measurement:b,previousDir:T,lastError:N}}const lg=1024,ag=65535,Ay="pair",Iy=4001;function jy(t){return typeof t=="number"&&Number.isInteger(t)&&t>=lg&&t<=ag}const Dy=["off","active","restart-needed","port-busy"];function Py(t){const e=Me(t);if(e===null)return null;const s=oe(e.id),l=Oe(e.label),u=Re(e.createdAt),k=ft(e.connected);if(s===null||l===null||u===null||k===null)return null;const y=e.lastSeenAt,i=y==null?null:Re(y);return y!=null&&i===null?null:{id:s,label:l,createdAt:u,lastSeenAt:i,connected:k}}function Oy(t){const e=Me(t);if(e===null)return null;const s=ft(e.enabled),l=Re(e.port),u=Xe(e.state,Dy),k=Re(e.listeningPort),y=Oe(e.sshUser),i=qt(e.hostNames),c=ft(e.pairingActive),m=Ct(e.devices,Py);return s===null||l===null||u===null||k===null||y===null||i===null||c===null||m===null?null:{enabled:s,port:l,state:u,listeningPort:k,sshUser:y,hostNames:i,pairingActive:c,devices:m}}function By(t){const e=Me(t);if(e===null)return null;const s=oe(e.code),l=Re(e.expiresAt);return s===null||l===null?null:{code:s,expiresAt:l}}const Fy=["powershell-admin","powershell","terminal"];function Hy(t){const e=Me(t);if(e===null)return null;const s=oe(e.payload),l=oe(e.authorizeCommand),u=Xe(e.shell,Fy),k=oe(e.code),y=Re(e.expiresAt);return s===null||l===null||u===null||k===null||y===null?null:{payload:s,authorizeCommand:l,shell:u,code:k,expiresAt:y}}const Uy=["auto","pwsh","powershell","cmd","git-bash","login","bash","sh","zsh"];function cg(t){return Xe(t,Uy)}function $y(t){const e=Me(t);if(e===null)return null;const s=cg(e.id),l=oe(e.label);return s===null||s==="auto"||l===null?null:{id:s,label:l}}function Xf(t){return Array.isArray(t)?[...new Set(t.filter(e=>typeof e=="string"&&Ai(e)))]:null}function Wy(t){const e=Me(t);if(e===null)return null;const s=cg(e.consoleShell),l=zt(e.consoleShells,$y),u=e.shellName,k=u===null?null:oe(u),y=Xf(e.disabledAgents),i=Xf(e.disabledAtStart);return s===null||l===null||y===null||i===null||u!==null&&k===null?null:{consoleShell:s,consoleShells:l,shellName:k,disabledAgents:y,disabledAtStart:i}}const Ti=8,zy="/ws",Fu="token",aa=12*1024*1024,lu=8,Qf=10*1024*1024,au=4,Jf=100,qy=512,Vy=["saved","changed"],Ky=["sending","prefilled"],Gy=["no-delivery","not-ready","send-failed","returned-by-cli","stopped-early","rewound","requested","queue-edit"],Yy=["cli-not-found","shell-not-found","spawn-failed","bad-message","unknown-terminal","terminal-asleep","invalid-cwd","too-many-terminals","invalid-path","read-failed","submit-failed","answer-failed","mode-failed","archive-failed","notes-failed","picker-failed","memory-failed","vault-failed","continue-failed","search-failed","remote-failed","settings-failed","rewind-failed","force-send-failed","queue-edit-failed","write-failed","worktree-failed","remote-refused","agent-unsupported","internal"];function Xy(t){const e={model:null,effort:null,contextWindow:null};if(typeof t!="object"||t===null)return e;const s=t;return{model:oe(s.model),effort:oe(s.effort),contextWindow:Re(s.contextWindow)}}function Qy(t){const e=Me(t);if(e===null)return null;const s=oe(e.terminalId),l=ny(e.draft);return s===null||l===null?null:{terminalId:s,draft:l}}function Zf(t){return typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}function Xl(t,e){const s=oe(e.requestId);return s!==null&&(t.requestId=s),t}function ep(t){var e;return((e=zt(t,B0))==null?void 0:e.slice(0,I0))??null}function cu(t){var e;return((e=zt(t,F0))==null?void 0:e.slice(0,j0))??null}function tp(t){const e=dh(t);return e!==null&&e.kind==="question"?e:null}function Jy(t){const e=Me(dw(t));if(e===null)return null;switch(e.type){case"hello":{const s=Re(e.protocolVersion),l=Oe(e.platform),u=Oe(e.defaultCwd);return s===null||l===null||u===null?null:{type:"hello",protocolVersion:s,agents:zt(e.agents,Ff)??[],defaultAgent:Xe(e.defaultAgent,Ar),platform:l,defaultCwd:u,shellName:oe(e.shellName),remoteClient:e.remoteClient===!0,fileCheck:e.fileCheck===!0,fileWrite:e.fileWrite===!0}}case"agents":{const s=zt(e.agents,Ff);return s===null?null:{type:"agents",agents:s,defaultAgent:Xe(e.defaultAgent,Ar)}}case"terminal.list":{const s=zt(e.terminals,Wf),l=qt(e.order);return s===null||l===null?null:{type:"terminal.list",terminals:s,order:l}}case"terminal.opened":{const s=oe(e.requestId),l=Wf(e.terminal);return s===null||l===null?null:{type:"terminal.opened",requestId:s,terminal:l}}case"terminal.output":{const s=oe(e.terminalId),l=Oe(e.data);return s===null||l===null?null:{type:"terminal.output",terminalId:s,data:l}}case"terminal.replay":{const s=oe(e.terminalId),l=Oe(e.data);return s===null||l===null?null:{type:"terminal.replay",terminalId:s,data:l,truncated:e.truncated===!0}}case"terminal.exit":{const s=oe(e.terminalId),l=Re(e.exitCode);if(s===null||l===null)return null;const u=e.signal;return{type:"terminal.exit",terminalId:s,exitCode:l,signal:typeof u=="number"?u:null}}case"terminal.closed":{const s=oe(e.terminalId);return s===null?null:{type:"terminal.closed",terminalId:s}}case"terminal.activity":{const s=oe(e.terminalId),l=Xe(e.activity,S0);if(s===null||l===null)return null;const u=l==="offline"?Xe(e.offlineReason,x0):null;return u===null?{type:"terminal.activity",terminalId:s,activity:l}:{type:"terminal.activity",terminalId:s,activity:l,offlineReason:u}}case"index.status":{const s=L0(e.status);return s===null?null:{type:"index.status",status:s}}case"index.projects":{const s=zt(e.projects,T0);return s===null?null:{type:"index.projects",projects:s,replace:e.replace===!0}}case"conversation.reset":{const s=oe(e.terminalId),l=Oe(e.sessionId),u=Xe(e.state,qf),k=zt(e.events,ou),y=Vf(e.usage);return s===null||l===null||u===null||k===null||y===null?null:{type:"conversation.reset",terminalId:s,sessionId:l,state:u,events:k,hasMore:e.hasMore===!0,usage:y,permissionMode:Hs(e.permissionMode)?e.permissionMode:null,defaults:Xy(e.defaults),waitingFor:oe(e.waitingFor),openToolCall:e.openToolCall===!0,subagents:ep(e.subagents)??[],queue:cu(e.queue)??[],liveQuestion:tp(e.liveQuestion)}}case"conversation.liveQuestion":{const s=oe(e.terminalId),l=e.question===null?null:tp(e.question);return s===null||e.question!==null&&l===null?null:{type:"conversation.liveQuestion",terminalId:s,question:l}}case"conversation.subagents":{const s=oe(e.terminalId),l=ep(e.subagents);return s===null||l===null?null:{type:"conversation.subagents",terminalId:s,subagents:l}}case"conversation.queue":{const s=oe(e.terminalId),l=cu(e.queue);return s===null||l===null?null:{type:"conversation.queue",terminalId:s,queue:l}}case"agent.forceSent":{const s=oe(e.terminalId),l=oe(e.requestId),u=ft(e.sent);return s===null||l===null||u===null?null:{type:"agent.forceSent",terminalId:s,requestId:l,sent:u}}case"agent.queueEdited":{const s=oe(e.terminalId),l=oe(e.requestId),u=ft(e.edited);return s===null||l===null||u===null?null:{type:"agent.queueEdited",terminalId:s,requestId:l,edited:u}}case"agent.submitted":{const s=oe(e.terminalId),l=oe(e.requestId),u=ft(e.delivered);return s===null||l===null||u===null?null:{type:"agent.submitted",terminalId:s,requestId:l,delivered:u}}case"agent.rewound":{const s=oe(e.terminalId),l=oe(e.requestId),u=ft(e.codeRestored);return s===null||l===null||u===null?null:{type:"agent.rewound",terminalId:s,requestId:l,codeRestored:u}}case"conversation.append":{const s=oe(e.terminalId),l=zt(e.events,ou),u=Vf(e.usage);if(s===null||l===null||u===null)return null;const k={type:"conversation.append",terminalId:s,events:l,usage:u,permissionMode:Hs(e.permissionMode)?e.permissionMode:null},y=cu(e.queue);return y!==null&&(k.queue=y),k}case"conversation.mode":{const s=oe(e.terminalId),l=e.mode;return s===null||!Hs(l)?null:{type:"conversation.mode",terminalId:s,mode:l}}case"conversation.waiting":{const s=oe(e.terminalId);return s===null?null:{type:"conversation.waiting",terminalId:s,waitingFor:oe(e.waitingFor)}}case"conversation.toolCall":{const s=oe(e.terminalId),l=ft(e.open);return s===null||l===null?null:{type:"conversation.toolCall",terminalId:s,open:l}}case"conversation.page":{const s=oe(e.terminalId),l=zt(e.events,ou);return s===null||l===null?null:{type:"conversation.page",terminalId:s,events:l,hasMore:e.hasMore===!0}}case"conversation.turns":{const s=oe(e.terminalId),l=Ct(e.turns,u=>{const k=Me(u);if(k===null)return null;const y=oe(k.eventId),i=Re(k.durationMs);return y===null||i===null?null:{eventId:y,durationMs:i}});return s===null||l===null?null:{type:"conversation.turns",terminalId:s,turns:l}}case"conversation.parts":{const s=oe(e.terminalId),l=Ct(e.updates,u=>{const k=Me(u);if(k===null)return null;const y=oe(k.eventId),i=Ct(k.parts,dh);return y===null||i===null?null:{eventId:y,parts:i}});return s===null||l===null?null:{type:"conversation.parts",terminalId:s,updates:l}}case"conversation.imageData":{const s=oe(e.terminalId),l=oe(e.eventId),u=Re(e.index),k=Oe(e.mediaType);if(s===null||l===null||u===null||k===null)return null;const y=e.data;return{type:"conversation.imageData",terminalId:s,eventId:l,index:u,source:Xe(e.source,Jm)??"content",mediaType:k,data:typeof y=="string"?y:null}}case"conversation.state":{const s=oe(e.terminalId),l=Xe(e.state,qf);return s===null||l===null?null:{type:"conversation.state",terminalId:s,state:l}}case"git.status":{const s=oe(e.terminalId),l=Pw(e.status);return s===null||l===null?null:{type:"git.status",terminalId:s,status:l}}case"git.diff":{const s=oe(e.terminalId),l=Hf(e.diff);return s===null||l===null?null:{type:"git.diff",terminalId:s,diff:l}}case"files.listing":{const s=oe(e.terminalId),l=Q0(e.listing);return s===null||l===null?null:{type:"files.listing",terminalId:s,listing:l}}case"picker.listing":{const s=J0(e.listing);return s===null?null:{type:"picker.listing",listing:s}}case"files.preview":{const s=oe(e.terminalId),l=Kf(e.preview);return s===null||l===null?null:{type:"files.preview",terminalId:s,preview:l}}case"files.checked":{const s=oe(e.terminalId),l=oe(e.requestId),u=qt(e.existing),k=qt(e.directories)??[];return s===null||l===null||u===null?null:{type:"files.checked",terminalId:s,requestId:l,existing:u,directories:k}}case"files.saved":{const s=oe(e.terminalId),l=oe(e.requestId),u=oe(e.path),k=Xe(e.outcome,Vy),y=e.preview===null?null:Kf(e.preview);return s===null||l===null||u===null||k===null||y===null&&(k==="saved"||e.preview!==null)?null:{type:"files.saved",terminalId:s,requestId:l,path:u,outcome:k,preview:y}}case"conversation.plans":{const s=oe(e.terminalId),l=Ct(e.plans,H0);return s===null||l===null?null:{type:"conversation.plans",terminalId:s,plans:l}}case"plans.content":{const s=oe(e.terminalId),l=U0(e.plan);return s===null||l===null?null:{type:"plans.content",terminalId:s,plan:l}}case"files.results":{const s=oe(e.terminalId),l=X0(e.result);return s===null||l===null?null:{type:"files.results",terminalId:s,result:l}}case"notes.list":{const s=Ct(e.notes,gy);return s===null?null:{type:"notes.list",notes:s}}case"notes.imageData":{const s=oe(e.imageId),l=Oe(e.mediaType);if(s===null||l===null)return null;const u=e.data;return{type:"notes.imageData",imageId:s,mediaType:l,data:typeof u=="string"?u:null}}case"memory.status":{const s=oe(e.terminalId),l=dy(e.status);return s===null||l===null?null:{type:"memory.status",terminalId:s,status:l}}case"memory.planned":{const s=oe(e.terminalId),l=Ct(e.changes,Gf);return s===null||l===null?null:Xl({type:"memory.planned",terminalId:s,changes:l},e)}case"memory.installed":{const s=oe(e.terminalId),l=Ct(e.applied,Gf);return s===null||l===null?null:Xl({type:"memory.installed",terminalId:s,applied:l},e)}case"memory.imported":{const s=oe(e.terminalId),l=qt(e.copied),u=qt(e.skipped);return s===null||l===null||u===null?null:Xl({type:"memory.imported",terminalId:s,copied:l,skipped:u},e)}case"memory.content":{const s=oe(e.terminalId),l=fy(e.note);return s===null||l===null?null:Xl({type:"memory.content",terminalId:s,note:l},e)}case"vault.status":{const s=My(e.status);return s===null?null:{type:"vault.status",status:s}}case"vault.exported":{const s=oe(e.projectKey),l=Re(e.sessions);return s===null||l===null?null:{type:"vault.exported",projectKey:s,sessions:l}}case"session.continued":{const s=oe(e.requestId),l=oe(e.terminalId),u=Me(e.source),k=Xe(u==null?void 0:u.agent,va),y=oe(u==null?void 0:u.sessionId),i=Oe(u==null?void 0:u.title),c=Zf(e.includedTurns),m=Zf(e.totalTurns),v=Xe(e.delivery,Ky);return s===null||l===null||k===null||y===null||i===null||c===null||m===null||c>m||v===null?null:{type:"session.continued",requestId:s,terminalId:l,source:{agent:k,sessionId:y,title:i},includedTurns:c,totalTurns:m,totalTurnsIsMinimum:e.totalTurnsIsMinimum===!0,delivery:v}}case"composer.prefill":{const s=oe(e.terminalId),l=oe(e.text),u=Xe(e.reason,Gy);if(s===null||l===null||u===null)return null;const k={type:"composer.prefill",terminalId:s,text:l,reason:u};if(e.pasted!==void 0){const i=qt(e.pasted);if(i===null)return null;i.length>0&&(k.pasted=i)}const y=oe(e.requestId);return y!==null&&(k.requestId=y),k}case"composer.drafts":{const s=zt(e.drafts,Qy);return s===null?null:{type:"composer.drafts",drafts:s}}case"search.progress":{const s=oe(e.searchId),l=Ey(e.progress);return s===null||l===null?null:{type:"search.progress",searchId:s,progress:l}}case"remote.status":{const s=Oy(e.status);return s===null?null:{type:"remote.status",status:s}}case"settings.status":{const s=Wy(e.settings);return s===null?null:{type:"settings.status",settings:s}}case"plan.limits":{const s=zt(e.limits,by);return s===null?null:{type:"plan.limits",limits:s}}case"remote.pairing.code":{const s=By(e.pairing);return s===null?null:{type:"remote.pairing.code",pairing:s}}case"remote.phone.pairing":{const s=Hy(e.pairing);return s===null?null:{type:"remote.phone.pairing",pairing:s}}case"search.results":{const s=oe(e.searchId),l=xy(e.result);return s===null||l===null?null:{type:"search.results",searchId:s,result:l}}case"worktree.inspected":{const s=oe(e.requestId),l=r0(e.inspection);return s===null||l===null?null:{type:"worktree.inspected",requestId:s,inspection:l}}case"worktree.rows":{const s=oe(e.terminalId),l=zt(e.rows,s0);if(s===null||l===null)return null;const u=zt(e.kept,p0);return u===null?{type:"worktree.rows",terminalId:s,rows:l}:{type:"worktree.rows",terminalId:s,rows:l,kept:u}}case"worktree.removePlan":{const s=oe(e.requestId),l=_0(e.plan);return s===null||l===null?null:{type:"worktree.removePlan",requestId:s,plan:l}}case"worktree.removed":{const s=oe(e.requestId),l=oe(e.worktreeId),u=w0(e.outcome);return s===null||l===null||u===null?null:{type:"worktree.removed",requestId:s,worktreeId:l,outcome:u}}case"worktree.changed":return{type:"worktree.changed"};case"worktree.branchChanges":{const s=oe(e.requestId),l=c0(e.changes);return s===null||l===null?null:{type:"worktree.branchChanges",requestId:s,changes:l}}case"worktree.branchDiff":{const s=oe(e.requestId),l=oe(e.worktreeId),u=Hf(e.diff);return s===null||l===null||u===null?null:{type:"worktree.branchDiff",requestId:s,worktreeId:l,diff:u}}case"worktree.reviewPlan":{const s=oe(e.requestId),l=u0(e.plan);return s===null||l===null?null:{type:"worktree.reviewPlan",requestId:s,plan:l}}case"worktree.integratePlan":{const s=oe(e.requestId),l=h0(e.plan);return s===null||l===null?null:{type:"worktree.integratePlan",requestId:s,plan:l}}case"worktree.integrated":{const s=oe(e.requestId),l=oe(e.worktreeId),u=f0(e.outcome);return s===null||l===null||u===null?null:{type:"worktree.integrated",requestId:s,worktreeId:l,outcome:u}}case"worktree.deleteBranchPlan":{const s=oe(e.requestId),l=m0(e.plan);return s===null||l===null?null:{type:"worktree.deleteBranchPlan",requestId:s,plan:l}}case"worktree.branchDeleted":{const s=oe(e.requestId),l=oe(e.worktreeId),u=oe(e.branch);return s===null||l===null||u===null?null:{type:"worktree.branchDeleted",requestId:s,worktreeId:l,branch:u}}case"error":{const s=mr(e.text);if(s===null)return null;const u={type:"error",code:Xe(e.code,Yy)??"internal",text:s},k=Oe(e.detail);k!==null&&(u.detail=k);const y=oe(e.requestId);return y!==null&&(u.requestId=y),u}default:return null}}function np(t){return JSON.stringify(t)}const Zy=/^[A-Za-z]:\\$/;function pr(t,e){return t.length===0?"":e==="win32"?eb(t):tb(t)}function eb(t){let e=t.replace(/\//g,"\\");for(e.startsWith("\\\\?\\UNC\\")?e=`\\\\${e.slice(8)}`:e.startsWith("\\\\?\\")&&(e=e.slice(4)),e=e.startsWith("\\\\")?`\\\\${e.slice(2).replace(/\\+/g,"\\")}`:e.replace(/\\+/g,"\\");e.endsWith("\\")&&!Zy.test(e);)e=e.slice(0,-1);return e.toLowerCase()}function ug(t,e,s){return t.length===0||s==="win32"&&t!==e&&t.toLowerCase()===e.toLowerCase()?e:t}function tb(t){let e=t.replace(/\/+/g,"/");for(;e.length>1&&e.endsWith("/");)e=e.slice(0,-1);return e}function Hu(t){var e;return((e=t.worktree)==null?void 0:e.mainCwd)??t.cwd}function nb(t,e,s,l){if(s.kind!=="agent")return t.length;const u=pr(Hu(s),l);let k=-1;for(const[y,i]of t.entries()){const c=e(i);c===void 0||c.kind!=="agent"||pr(Hu(c),l)===u&&(k=y)}return k===-1?t.length:k+1}function mh(t){return`[Pasted text #${t}]`}function rb(t){return`[Start of pasted text #${t}]`}function sb(t){return`[End of pasted text #${t}]`}function ib(){return/(^|\n)\[Start of pasted text #(\d{1,6})\]\n([\s\S]*?)\n\[End of pasted text #\2\](?=\n|$)/g}function ob(){return/(^|\n)\[Start of pasted text #(\d{1,6})\]\n/}function lb(){return/\[Pasted text #(\d{1,6})\]/g}const hg="https://buymeacoffee.com/cvelasquez",ab="modulepreload",cb=function(t){return"/"+t},rp={},dr=function(e,s,l){let u=Promise.resolve();if(s&&s.length>0){let y=function(m){return Promise.all(m.map(v=>Promise.resolve(v).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),c=(i==null?void 0:i.nonce)||(i==null?void 0:i.getAttribute("nonce"));u=y(s.map(m=>{if(m=cb(m),m in rp)return;rp[m]=!0;const v=m.endsWith(".css"),h=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${h}`))return;const b=document.createElement("link");if(b.rel=v?"stylesheet":ab,v||(b.as="script"),b.crossOrigin="",b.href=m,c&&b.setAttribute("nonce",c),document.head.appendChild(b),v)return new Promise((T,N)=>{b.addEventListener("load",T),b.addEventListener("error",()=>N(new Error(`Unable to preload CSS for ${m}`)))})}))}function k(y){const i=new Event("vite:preloadError",{cancelable:!0});if(i.payload=y,window.dispatchEvent(i),!i.defaultPrevented)throw y}return u.then(y=>{for(const i of y||[])i.status==="rejected"&&k(i.reason);return e().catch(k)})},ub={"agent.composer.imagesRefused":"This CLI doesn't take images from the message box.","agent.continue.discovering":"The session isn't in the history yet: it shows up with the first message.","agent.continue.noConversation":"This tab doesn't have a conversation to continue yet.","agent.continue.noMessages":"This conversation doesn't have any messages to continue yet.","agent.continue.title":"Continue this conversation with another CLI","agent.continue.titleMain":"Continue this conversation in the main folder","agent.dot.idle":"Ready, nothing in progress","agent.dot.noStatus":"This CLI doesn't publish its status","agent.dot.open":"CLI open","agent.dot.statusLineOnly":"This CLI only publishes its status with the status line configured","agent.dot.statusLinePending":"The status line hasn't published this conversation's status yet","agent.handoff.notice":"Continued from {{label}}: the agent starts from a transcript of {{turns}}, not from the context it had. Tool results are trimmed and images don't carry over.","agent.handoff.prefill.noDelivery":"The message is in the message box: check it and send it with Enter.","agent.handoff.prefill.notReady":"The CLI wasn't ready in time: the message is in the message box for you to send.","agent.handoff.prefill.sendFailed":"It couldn't be sent automatically: the message is in the message box for you to send.","agent.handoff.sending":"Sending the continuation…","agent.handoff.tabLabel":"Continued: {{title}}","agent.handoff.tabLabelNoTitle":"Continued","agent.handoff.turns.all_one":"the {{count}} turn","agent.handoff.turns.all_other":"the {{count}} turns","agent.handoff.turns.lastManyOfMore_one":"the last {{included}} of more than {{count}} turn","agent.handoff.turns.lastManyOfMore_other":"the last {{included}} of more than {{count}} turns","agent.handoff.turns.lastMany_one":"the last {{included}} of {{count}} turn","agent.handoff.turns.lastMany_other":"the last {{included}} of {{count}} turns","agent.handoff.turns.lastOne":"the last turn of {{total}}","agent.handoff.turns.lastOneOfMore":"the last turn of more than {{total}}","agent.handoff.turns.single":"the only turn","agent.meter.idle.compacted":"The context was compacted after the last measured response. The new size shows up with the next response.","agent.meter.idle.noFile":"The session hasn't measured any response yet. It doesn't start at zero: the system prompt, the tools and the project's instructions file already take up context, and the real number shows up with the first response.","agent.meter.idle.statusLine":"The status line hasn't published tokens for this conversation yet. It doesn't start at zero: the number shows up when the CLI runs it, with the first message or when the session resumes.","agent.meter.idle.withFile":"The session hasn't measured any response yet. It doesn't start at zero: the system prompt, the tools and {{file}} already take up context, and the real number shows up with the first response.","agent.meter.origin.catalog":"limit from the CLI's model catalog","agent.meter.origin.estimated":"limit inferred from the measured tokens","agent.meter.setup.disabled":"This CLI only publishes its tokens through its status line, and the app's status line is disabled. Configure explains how.","agent.meter.setup.missing":"This CLI only publishes its tokens through its status line, and it isn't configured yet. Configure explains how.","agent.meter.setup.otherCommand":"This CLI only publishes its tokens through its status line, and you have another status line configured. Configure explains how.","agent.meter.setup.unreadable":"This CLI only publishes its tokens through its status line, and its settings.json couldn't be read. Configure explains how.","agent.mode.blocked":"There's a confirmation pending in the CLI: changing the mode now would approve it. Answer it in the CLI tab.","agent.mode.title":"{{mode}} mode: {{hint}}. Changing it sends {{key}} to the CLI tab","agent.mode.titleBlind":"{{title}}. Without status line data the app can't tell whether a confirmation is pending; changing the mode at that moment approves it","agent.note.empty":"The note is empty","agent.note.needsTab":"Open a tab first: the conversation opens in its project","agent.note.noReadySignal":"This tab's CLI doesn't say when it's ready, so the note can't be sent","agent.note.send":"Send the note to the agent in a new conversation in {{cwd}}","agent.openBlocked":"Opening a tab in this project…","agent.openTool.noLabel":"The CLI has a tool without a result: it may be asking for approval. Answer it in the CLI tab.","agent.openTool.withLabel":"{{label}} has a tool without a result: it may be asking for approval. Answer it in the CLI tab.","agent.queueReturned.noLabel":"The CLI didn't get to deliver the message you sent while it was working: the interrupt came first. It's back in the message box, unsent.","agent.queueReturned.withLabel":"{{label}} didn't get to deliver the message you sent while it was working: the interrupt came first. It's back in the message box, unsent.","agent.serverClosed.noLabel":"The CLI server closed and this tab lost its connection.","agent.serverClosed.relaunch":"Relaunch","agent.serverClosed.relaunching":"Relaunching…","agent.serverClosed.withLabel":"The {{label}} server closed and this tab lost its connection.","agent.session.cliMissing":"{{label}} isn't installed.","agent.shortcuts.antigravity.answerPermission":"Answer a permission request: 1 allows it, 4 rejects it","agent.shortcuts.antigravity.cycleMode":"Change the mode: accept-edits, plan and default (with focus on the terminal)","agent.shortcuts.antigravity.help":"Show the CLI's shortcuts","agent.shortcuts.antigravity.interrupt":"Interrupt the current turn, or cancel a permission request","agent.shortcuts.claudeCode.cancel":"Cancel","agent.shortcuts.claudeCode.cycleMode":"Change the permission mode (with focus on the terminal)","agent.shortcuts.claudeCode.fullOutput":"Show the full output","agent.shortcuts.claudeCode.pasteImage":"Paste an image from the clipboard","agent.shortcuts.claudeCode.pasteText":"Paste text from the clipboard","agent.shortcuts.claudeCode.rewind":"Open the rewind menu","agent.shortcuts.claudeCode.searchHistory":"Search the command history","agent.shortcuts.codex.cycleMode":"Switch between the default mode and Plan (with focus on the terminal)","agent.shortcuts.codex.editPrevious":"Edit a previous message","agent.shortcuts.codex.effort":"Lower / raise the effort","agent.shortcuts.codex.externalEditor":"Edit the message in the external editor","agent.shortcuts.codex.interruptOrExit":"Interrupt, or exit if there's no turn","agent.shortcuts.codex.interruptTurn":"Interrupt the current turn","agent.shortcuts.codex.mention":"Mention a file, a skill or a plugin","agent.shortcuts.codex.note":"Alt + ← / → switch agents inside Codex, but here the app uses them to switch tabs.","agent.shortcuts.codex.queue":"Queue the message while the agent works","agent.shortcuts.codex.searchHistory":"Search the message history","agent.shortcuts.codex.transcript":"Show the transcript","agent.shortcuts.commands":"Commands","agent.shortcuts.composer.newline":"New line without sending","agent.shortcuts.composer.pasteText":"Paste text","agent.shortcuts.composer.pasteWithImages":"Paste text or an image (it stays as a thumbnail)","agent.shortcuts.composer.send":"Send the message","agent.shortcuts.interruptCli":"Interrupt whatever the CLI is doing","agent.shortcuts.leaderThen":"Ctrl + X, then {{key}}","agent.shortcuts.opencode.clearInput":"Clear the input; twice, exit","agent.shortcuts.opencode.commandList":"Command list, with the model variants","agent.shortcuts.opencode.cycleAgent":"Switch agent, build or plan (with focus on the terminal)","agent.shortcuts.opencode.interrupt":"Interrupt (the first press only warns)","agent.shortcuts.opencode.model":"Choose a model","agent.shortcuts.opencode.newSession":"New session: the tab stays tied to the session it was opened with","agent.shortcuts.opencode.newline":"New line","agent.shortcuts.opencode.note":"Ctrl + T switches the model variant inside OpenCode, but the browser keeps it for itself: it's under Ctrl + P.","agent.shortcuts.opencode.paste":"Paste","agent.shortcuts.pi.bash":"Run a shell command","agent.shortcuts.pi.clearOrExit":"Clear the editor; twice, exit","agent.shortcuts.pi.cycleThinking":"Change the thinking level (with focus on the terminal)","agent.shortcuts.pi.model":"Choose a model","agent.shortcuts.pi.newline":"New line","agent.shortcuts.pi.nextModel":"Switch to the next model","agent.shortcuts.pi.toolOutput":"Collapse or expand tool output","agent.shortcuts.pi.tree":"With the editor empty: open the session tree","agent.statusLine.noFragment":"The app's folder has characters the console interprets (such as & % ! or quotes), and with them there's no line the CLI can run: on Windows it runs it with cmd /c and no quote gets through. Moving the configuration folder to a path without those characters fixes it.","agent.statusLine.state.active":"Configured","agent.statusLine.state.disabled":"Disabled (enabled: false)","agent.statusLine.state.missing":"Not configured","agent.statusLine.state.otherCommand":"You have another status line: pasting this one replaces it","agent.statusLine.state.unreadable":"Couldn't read settings.json","agent.stoppedEarly":"You stopped it before the agent started: the message is back in the message box so you can fix it.","agent.thread.discovering":"The session shows up in the history with the first message.","agent.thread.noTranscript":"This conversation comes from a CLI version that didn't leave a readable transcript. It can be resumed from the sidebar, but there's nothing to show here.","agent.waiting.answer":"The CLI is waiting for an answer from you.","agent.waiting.permission":"The CLI is waiting for you to authorize a tool.","agent.waiting.question":"The agent asked you a question: answer it in the thread.","agentMenu.chooseTitle":"Choose which CLI to open with","agentMenu.openWith":"Open with","agentMenu.titleWithAgent":"{{title}} — with {{label}}","app.banner.revoked":"This device's access was revoked, or remote access was turned off. To come back, pair it again from the computer running Agent Workbench.","app.divider.consoleHeight":"Drag to change the console's height","app.divider.width":"Drag to change the width","app.empty.hint":"Pick a project on the left, or open a session from the history to resume it.","app.empty.newSession":"New session in {{cwd}}","app.empty.noTabs":"No open tabs.","app.empty.opening":"Opening…","app.header.cliVersion":"CLI {{version}}","app.header.remoteAccess":"Remote access","app.header.remoteBadge":"Remote","app.header.remoteBadgeTitle":"This window is connected from a paired device. Managing remote access, and anything that opens a file with the apps of the computer running Agent Workbench, is only available on that computer.","app.header.shortcuts":"Show keyboard shortcuts","app.markerNotice":"This server was started from inside a CLI session. The <code>{{variable}}</code> variable was removed from the tabs' environment: it turns off history saving, and without that there would be no conversation or context meter. The rest of the environment is left untouched.","app.panel.name":"Panel","app.panel.show":"Show the right panel (Alt+P)","app.picker.project.confirm":"Open here","app.picker.project.confirmTitle":"Open an agent tab in {{path}}","app.picker.project.title":"New project","app.picker.vault.confirm":"Use this folder","app.picker.vault.confirmTitle":"Move the backup to {{path}}. The current folder stays untouched","app.picker.vault.title":"Backup folder","app.sidebar.name":"Projects","app.sidebar.show":"Show the project list","app.status.connecting":"Connecting","app.status.failed":"No connection","app.status.open":"Connected","app.status.reconnecting":"Reconnecting","app.status.revoked":"Access revoked","archive.allBlocked_one":"Its only conversation has an open tab. Close it first.","archive.allBlocked_other":"Its {{count}} conversations have an open tab. Close them first.","archive.blockedStays_one":"Another one has an open tab and stays.","archive.blockedStays_other":"{{count}} others have an open tab and stay.","archive.confirm_one":"Archive {{count}} conversation?","archive.confirm_other":"Archive the {{count}} conversations?","archive.withBlocked":"{{confirm}} {{blocked}}","common.cancel":"Cancel","common.close":"Close","common.closeEsc":"Close (Esc)","common.copied":"Copied","common.copyCode":"Copy code","common.dismissNotice":"Dismiss the notice","common.gotIt":"Got it","composer.attach":"Attach a file","composer.attachTitle":"Attach a file: a log, a PDF, a document or an image","composer.chip.editHint":"Show and edit the pasted text","composer.chip.editorLabel":"Edit pasted text #{{number}}","composer.chip.pastedTextEmpty":"#{{number}} · Pasted text · empty, won't be sent","composer.chip.pastedText_one":"#{{number}} · Pasted text · {{count}} line","composer.chip.pastedText_other":"#{{number}} · Pasted text · {{count}} lines","composer.chip.remove":"Remove","composer.pastedImage":"pasted image","composer.placeholder.ended":"This tab's session has ended.","composer.placeholder.ready":"Type your message.","composer.placeholder.sleeping":"This tab doesn't have the CLI open yet.","composer.problem.draftTooLong":"This message is too long to keep as a draft: if you close Agent Workbench before sending it, it will be lost.","composer.problem.empty":'"{{name}}" is empty.',"composer.problem.imageTooBig":"The image is {{size}} MB; the maximum is {{max}} MB.","composer.problem.imageUnreadable":"Couldn't read the image from the clipboard.","composer.problem.tooBig":'"{{name}}" is {{size}} MB; the maximum is {{max}} MB.',"composer.problem.tooManyFiles_one":"Up to {{count}} file per message.","composer.problem.tooManyFiles_other":"Up to {{count}} files per message.","composer.problem.tooManyImages_one":"Up to {{count}} image per message.","composer.problem.tooManyImages_other":"Up to {{count}} images per message.","composer.problem.unreadable":`Couldn't read "{{name}}".`,"composer.resizeTitle":"Drag to resize the message box","composer.send":"Send","composer.sendTitle":"Send (Enter)","composer.stop":"Stop","composer.stopTitle":"Interrupt whatever the CLI is doing (Esc)","console.collapse":"Collapse. The processes keep running: to end them, use each terminal's ×","console.name":"Console","console.noShell":"No system console was found to open.","console.openAnother":"Open another {{shell}} in {{cwd}}","console.openAnyIn":"Open a console in {{cwd}}","console.openIn":"Open {{shell}} in {{cwd}}","console.tab.close":"Close this terminal and end its process","console.tab.exited":"Exited with code {{code}}","console.tab.label":"Terminal {{number}}","console.tab.title":"{{shell}} {{number}} in {{cwd}}","continue.menuLabel":"Continue with","controls.effort.high":"High","controls.effort.inUse":"Effort in use: {{effort}}. Changing it sends {{command}} to the CLI tab","controls.effort.inUseSaved":"Effort in use: {{effort}}. Changing it sends {{command}} to the CLI tab, and the CLI saves it as the default for the next tabs","controls.effort.low":"Low","controls.effort.max":"Max","controls.effort.medium":"Medium","controls.effort.minimal":"Minimal","controls.effort.noData":"Effort: no data. Not every model has levels — with haiku, /effort leaves no trace","controls.effort.off":"Off","controls.effort.placeholder":"effort — no data","controls.effort.provisional":"Effort from your configuration: {{effort}}. No response has confirmed it yet","controls.effort.xhigh":"Very high","controls.model.default":"Default","controls.model.inUse":"Model in use: {{model}}. Changing it sends /model to the CLI tab","controls.model.inUseSaved":"Model in use: {{model}}. Changing it sends /model to the CLI tab, and the CLI saves it as the default for the next tabs","controls.model.noData":"Model: there hasn't been any response in this session yet","controls.model.placeholder":"model — no data","controls.model.provisional":"Model from your configuration: {{model}}. No response has confirmed it yet","conversation.answerUnconfirmed":"The CLI didn't confirm this answer. Try again, or answer in the CLI tab.","diff.binary":"Binary file: there's no diff to show.","diff.noChanges":"No changes.","diff.truncated":"The diff was cut off because of its size. The full file is easier to read outside this panel.","docs.backToList":"Show the list","docs.edit.adopt":"Move my changes to the new version","docs.edit.button":"Edit","docs.edit.cancel":"Cancel","docs.edit.closeConfirm":"This file has unsaved changes. Discard them and close it?","docs.edit.conflict":"The file changed on disk while you were editing it. Your changes weren't saved.","docs.edit.discard":"Discard","docs.edit.discardAndClose":"Discard and close","docs.edit.discardConfirm":"Discard your changes?","docs.edit.discardMine":"Discard my changes","docs.edit.editing":"Editing {{name}}","docs.edit.gone":"The file is no longer on disk, or its new version can't be edited here. Your changes weren't saved: copy them if you need them.","docs.edit.keepEditing":"Keep editing","docs.edit.lost":"The connection dropped while saving. Save again to be sure.","docs.edit.noChanges":"No changes","docs.edit.pending":"Your changes, not saved yet. Move them into the file and save.","docs.edit.pendingDone":"Done","docs.edit.save":"Save","docs.edit.saveTitle":"Save (Ctrl+S)","docs.edit.saved":"Saved","docs.edit.saving":"Saving…","docs.edit.title":"Edit this file here","docs.edit.tooLarge":"It's too big to edit here","docs.edit.unsafe":"It isn't plain UTF-8 text: saving it from here could damage it","docs.edit.unsaved":"Unsaved changes","docs.failed":"Couldn't read the document. Use ⟳ to try again.","docs.mode.formatted":"Formatted","docs.mode.label":"How to show this Markdown","docs.mode.source":"Source","docs.reload":"Read the document again","docs.reloadFailed":"Couldn't read it again: this is the last version that arrived.","docs.search.placeholder":"Search this document","docs.tab.close":"Close this document","files.allHidden":"everything in it is hidden","files.empty":"empty","files.hidden.hide":"Hide again what .gitignore and the built-in list exclude","files.hidden.show":"Also show what .gitignore and the built-in list exclude","files.hiddenCount_one":"{{count}} hidden","files.hiddenCount_other":"{{count}} hidden","files.hiddenTitle":"Hidden: .git, node_modules, dist, bin, obj and whatever .gitignore says","files.insertFolderPath":"Put this folder's path in your message","files.insertPath":"Put the path of {{name}} in your message","files.loading":"loading…","files.menu.copyAbsolute":"Copy absolute path","files.menu.copyRelative":"Copy relative path","files.menu.insertMention":"Insert as @path","files.menu.openWithSystem":"Open with the default app","files.moreEntries":"there are more entries than shown","files.pathInserted":"Added to your message","files.preview.binary":"Binary file: no preview.","files.preview.insertPath":"Put the path in your message","files.preview.truncated":"The file was cut off because of its size. Open it with the default app to see all of it.","files.readDirFailed":"Couldn't read the directory.","files.readingDir":"Reading the directory…","files.readingFile":"Reading the file…","files.refresh":"Reload the tree","files.reveal":"Open {{name}} in the system's file explorer","files.revealFolder":"Open this folder in the system's file explorer","files.row.alwaysHidden":"always hidden: .git, node_modules, dist, bin, obj","files.row.ignored":"hidden by .gitignore","files.search.clear":"Clear (Esc)","files.search.more":"there are more results than shown","files.search.moreTitle":"Narrow the search to see them all","files.search.none":"No file with that name.","files.search.placeholder":"Search files by name…","files.search.prompt":"Type to search.","files.search.searching":"Searching…","format.bytes.b":"{{value}} B","format.bytes.gb":"{{value}} GB","format.bytes.kb":"{{value}} KB","format.bytes.mb":"{{value}} MB","format.duration.minutes":"{{value}} min","format.duration.minutesSeconds":"{{minutes}} min {{seconds}} s","format.duration.ms":"{{value}} ms","format.duration.seconds":"{{value}} s","format.duration.underSecond":"less than 1 s","format.timeLeft.daysHours":"{{days}}d {{hours}}h","format.timeLeft.hoursMinutes":"{{hours}}h {{minutes}}m","format.timeLeft.minutes":"{{minutes}}m","format.timeLeft.underMinute":"<1m","git.aheadBehindTitle":"Commits ahead of and behind the upstream branch","git.backToChanges":"Changes","git.clean":"The working tree is clean.","git.detached":"Detached HEAD","git.detachedAt":"Detached HEAD @ {{head}}","git.group.conflict":"Conflicted","git.group.conflictHint":"They need to be resolved before going on","git.group.staged":"Staged","git.group.stagedHint":"Already added with git add","git.group.unstaged":"Unstaged","git.group.unstagedHint":"Modified in the working tree","git.group.untracked":"Untracked","git.group.untrackedHint":"New files git doesn't know about","git.kind.added":"added","git.kind.conflict":"conflicted","git.kind.copied":"copied","git.kind.deleted":"deleted","git.kind.modified":"modified","git.kind.renamed":"renamed","git.kind.typeChanged":"type changed","git.kind.untracked":"untracked","git.newFolderTitle":"{{path}} — new folder; its contents show up in Files","git.readingDiff":"Reading the diff…","git.refresh":"Refresh the status now","git.stagedTag":"staged","git.truncated":"There are more changes than shown. It usually means a rule is missing from <code>.gitignore</code>.","git.unknownState":"The repository's status isn't known yet.","git.upstreamTitle":"Upstream branch: {{upstream}}","git.worktrees.detached":"detached","header.locale.auto":"Automatic (browser: {{name}})","header.locale.title":"Language: {{name}}","header.locale.titleAuto":"Language: {{name}} (automatic, from the browser)","memory.action.appendBlock":"the block will be added at the end","memory.action.appendLines":"lines will be added at the end","memory.action.copy":"will be copied","memory.action.create":"will be created","memory.action.replaceBlock":"the block will be replaced","memory.back":"← Memory","memory.error.connectionLost":"The connection dropped before the response. Once it reconnects, the status shows what got written.","memory.form.copyFromMain":"Copy the notes from the main worktree","memory.form.existingNotes":"Existing notes","memory.form.files":"Instruction files","memory.form.importNative_one":"Import {{count}} note from Claude Code's memory","memory.form.importNative_other":"Import {{count}} notes from Claude Code's memory","memory.form.noFiles":"Choose at least one instruction file","memory.form.planning":"Calculating…","memory.form.preview":"Preview changes","memory.git.alreadyIgnored":"This repo already ignores <code>.agents/memory/</code>. To track it, that rule has to be removed from <code>.gitignore</code> by hand.","memory.git.blocked":"With git returning an error, it can only be installed without touching .gitignore","memory.git.dontTouch":"Don't touch <code>.gitignore</code>","memory.git.errorHint":"git returned an error","memory.git.errorWarning":"git returned an error, so there's no telling whether the memory is ignored. It can be installed without touching <code>.gitignore</code>.","memory.git.ignore":"Ignore the memory","memory.git.ignoreHint":"recommended","memory.git.version":"Track it","memory.git.versionHint":"for private repos","memory.global.copy":"Copy the snippet","memory.global.intro":"What applies to all your projects goes in <code>~/.agents/global.md</code>. The app doesn't write it: each CLI reads it once you add its snippet.","memory.global.title":"Global memory","memory.index":"Index","memory.intro.what":"Shared memory keeps what the agents learn about this project —decisions, constraints, pitfalls they already ran into— for the next session.","memory.intro.where":"It lives in <code>.agents/memory/</code>: one note per file and an index, <code>MEMORY.md</code>. The four CLIs read it through a marked block in their instructions file. Nothing is written until you confirm the changes.","memory.list.empty":"No notes yet. The agents save them here when they learn something that's useful in another session.","memory.list.notes":"Notes","memory.loading":"Reading the memory…","memory.native.import_one":"Import {{count}} note","memory.native.import_other":"Import {{count}} notes","memory.native.importing":"Importing…","memory.native.pending_one":"Claude Code's own memory has {{count}} note that isn't here.","memory.native.pending_other":"Claude Code's own memory has {{count}} notes that aren't here.","memory.note.loading":"Reading the note…","memory.note.truncated":"The note was cut off because of its size.","memory.plan.back":"Back","memory.plan.changes":"Changes","memory.plan.copiedFrom":"Copy of {{path}}","memory.plan.install":"Install","memory.plan.nothing":"There's nothing to change: the bridge is already up to date.","memory.plan.update":"Update","memory.plan.writing":"Writing…","memory.problem.brokenBlock":"Its block markers are malformed","memory.problem.brokenBlockWarning":"<code>{{file}}</code> has malformed memory block markers: one without its pair, or the block repeated. The app won't touch it until you fix it by hand.","memory.problem.encoding":"It isn't in UTF-8","memory.problem.encodingWarning":"<code>{{file}}</code> isn't in UTF-8 (it looks like UTF-16, which is what <code>></code> writes in Windows PowerShell 5.1). Save it as UTF-8: the app won't touch it until then.","memory.problem.outside":"It's a link that points outside the project","memory.problem.outsideWarning":"<code>{{file}}</code> is a link that points outside the project: the app doesn't read or write it.","memory.reach.adjust":"Adjust","memory.reach.adjustTitle":"Choose the bridge's instruction files again","memory.reach.doesNotReach":": doesn't reach the memory, {{via}}","memory.reach.reaches":": reaches the memory through {{via}}","memory.reach.title":"{{label}}: {{via}}","memory.result.imported_one":"Imported {{count}} note.","memory.result.imported_other":"Imported {{count}} notes.","memory.result.installed_one":"Done: {{count}} file changed.","memory.result.installed_other":"Done: {{count}} files changed.","memory.result.nothingChanged":"There was nothing to change: the bridge was already up to date.","memory.result.nothingImported":"There were no new notes to import.","memory.result.skipped_one":"Not overwritten because it already existed with different content: {{files}}.","memory.result.skipped_other":"Not overwritten because they already existed with different content: {{files}}.","memory.result.withSkipped":"{{result}} {{skipped}}","memory.update.button":"Update the bridge","memory.update.missing":"The block is missing from {{files}}.","memory.update.outdatedAndMissing_one":"{{outdated}} has an outdated block; the block is missing from {{missing}}.","memory.update.outdatedAndMissing_other":"{{outdated}} have an outdated block; the block is missing from {{missing}}.","memory.update.outdated_one":"{{files}} has an outdated block.","memory.update.outdated_other":"{{files}} have an outdated block.","meter.compact":"Compact","meter.compactBusy":"Wait for the agent to finish to compact.","meter.compactNoCli":"Open the CLI to compact.","meter.compactTitle":"Sends {{command}} to the CLI: it summarizes the conversation to free up context.","meter.configure":"Configure","meter.label":"Context","meter.lastResponseTitle":"The model's last response","meter.modelWithOrigin":"{{model}} — {{origin}}","meter.noTokens":"this CLI doesn't publish tokens","meter.noTokensTitle":"This CLI doesn't publish how many tokens each response uses, so there's nothing to measure.","meter.output":"output {{tokens}}","meter.responses_one":"{{count}} response","meter.responses_other":"{{count}} responses","meter.sessionTitle":"Total for the whole session","meter.sessionTotals_one":"session {{output}} out · {{cache}} cache · {{count}} response","meter.sessionTotals_other":"session {{output}} out · {{cache}} cache · {{count}} responses","meter.unknownModel":"unrecognized model: showing the tokens, not the window size","meter.unknownModelShort":"unrecognized model: no window size","meter.unmeasured":"not measured","meter.windowPercent":"{{percent}}% of the window","mode.acceptEdits.hint":"Accepts file edits without asking","mode.acceptEdits.label":"Accept edits","mode.auto.hint":"The CLI decides on its own which tools to use, without asking","mode.auto.label":"Auto","mode.default.hint":"Asks before each tool that isn't allowed","mode.default.label":"Manual","mode.plan.hint":"Researches and proposes a plan, without touching anything until you approve it","mode.plan.label":"Plan","narrow.keys.ctrlO":"Ctrl+O (in Claude Code, expands what is shown cut short)","narrow.keys.ctrlX":"Ctrl+X","narrow.keys.down":"Down arrow","narrow.keys.esc":"Escape","narrow.keys.interrupt":"Ctrl+C: interrupt","narrow.keys.label":"Terminal keys","narrow.keys.left":"Left arrow","narrow.keys.right":"Right arrow","narrow.keys.shiftTab":"Shift+Tab (in Claude Code, cycles the permission mode)","narrow.keys.tab":"Tab","narrow.keys.up":"Up arrow","narrow.menu.chimePage":"This page","narrow.menu.chimeSystem":"System","narrow.menu.cli":"CLI","narrow.menu.connection":"Connection","narrow.menu.folder":"Folder","narrow.menu.language":"Language","narrow.menu.notifications":"System notifications","narrow.menu.phoneAppDisconnect":"Disconnect","narrow.menu.phoneAppSettings":"Settings","narrow.menu.shortcuts":"Keyboard shortcuts","narrow.menu.sound":"Notification sound","narrow.menu.theme":"Theme","narrow.more":"More","narrow.projects":"Projects","narrow.tabs.close":"Close tab","narrow.tabs.new":"New tab","narrow.tabs.none":"No tabs open.","narrow.tabs.open":"Tabs","narrow.tabs.rename":"Rename","narrow.view.chat":"Chat","notes.attach":"Attach an image from a file","notes.closeConfirm":"Closing this note deletes it, along with its images.","notes.closeNote":"Close the note. It's deleted, along with its images","notes.collapse":"Collapse. Notes aren't lost: the × on each tab is what closes them","notes.empty":"No notes. The <b>+</b> opens one; they're for jotting down an idea without leaving what you're doing.","notes.expand":"Expand the notes","notes.imageAlt":"note image","notes.imageFallbackName":"the image","notes.imageOnly":"Image","notes.imageTooBig":'"{{name}}" is {{size}} MB; the maximum is {{max}} MB.',"notes.imageUnavailable":"the image isn't available","notes.lightboxClose":"Click to close","notes.name":"Notes","notes.new":"New note","notes.placeholder":"Jot down an idea. Images can be pasted or dragged here.","notes.readFailed":"Couldn't read the image.","notes.removeImage":"Remove the image","notes.resize":"Drag to change the height","notes.thumbMissing":"missing","notes.tooManyImages_one":"Up to {{count}} image per note.","notes.tooManyImages_other":"Up to {{count}} images per note.","notes.untitled":"Note","notify.attention":"“{{tab}}” is waiting for you","notify.done":"“{{tab}}” finished","panel.cliUnseen":"The CLI wrote something","panel.hide":"Hide the panel (Alt+P)","panel.restoreWidth":"Restore the column's width","panel.tab.cli":"CLI","panel.tab.files":"Files","panel.tab.git":"Changes","panel.tab.memory":"Memory","panel.tab.plans":"Plans","panel.widen":"Widen the column — the CLI's interface needs room to draw diffs and tables","picker.create":"Create","picker.createHere":"Create a folder here","picker.empty":"There are no subfolders here.","picker.goTo":"Go to {{root}}","picker.loading":"Reading the disk...","picker.newFolderName":"Folder name","picker.truncated":"There are more subfolders than fit in the list. Open one to narrow it down.","picker.up":"parent folder","plan.label":"Plan","plan.noData":"no data","plan.noDataTitle":"The status line is configured, but it hasn't published your plan limits yet: they arrive with the first response of each session. The CLI only publishes them for subscription plans.","plan.noReset":"no reset time","plan.observed":"Last update: {{when}}","plan.resetsIn":"resets in {{time}} ({{at}})","plan.setup.disabled":"This CLI publishes your plan limits only through its status line, and the app's status line is disabled. Configure explains how.","plan.setup.missing":"This CLI publishes your plan limits (the 5-hour window and the week) only through its status line, and it isn't configured yet. Configure explains how.","plan.setup.otherCommand":"This CLI publishes your plan limits only through its status line, and you have another status line configured. Configure explains how.","plan.setup.unreadable":"This CLI publishes your plan limits only through its status line, and its settings.json couldn't be read. Configure explains how.","plan.used":"{{percent}} used","plan.window.day":"Day","plan.window.days":"{{value}}d","plan.window.fiveHours":"5h","plan.window.hours":"{{value}}h","plan.window.month":"Month","plan.window.quota":"Quota","plan.window.week":"Week","plans.empty":"This conversation hasn't written any documents yet. Plans from plan mode show up here, along with the <code>.md</code> files the agent saves in the project or in its temporary folder.","plans.loading":"Reading the plan…","plans.missing":"missing","plans.missingTitle":"The file is no longer on disk","plans.truncated":"The plan was cut off because of its size.","remote.address":"This computer's address","remote.copied":"Copied","remote.copy":"Copy","remote.device.connected":"Connected now","remote.device.lastSeen":"Last seen: {{when}}","remote.device.never":"Never connected","remote.device.paired":"Paired: {{when}}","remote.device.rename":"Rename","remote.device.revoke":"Revoke","remote.device.revokeConfirm":"Click again to revoke","remote.devices":"Paired devices","remote.devices.empty":"None yet.","remote.intro":"Use Agent Workbench from another computer on your network, or from your phone. Nothing is opened to the network: the connection goes through an SSH tunnel.","remote.onlyOnHost":"Only on the computer running Agent Workbench: it opens with that computer's apps.","remote.pair.after":"After that, the other computer just opens {{url}}.","remote.pair.cancel":"Cancel","remote.pair.expires":"It works once and expires in {{time}}.","remote.pair.needsActive":"You can pair once remote access is on and running.","remote.pair.open":"With the tunnel running, open this address in the other computer's browser:","remote.pair.start":"Pair a device","remote.phone.authorize.admin":"1. Authorize the phone's key: on this computer, paste this into PowerShell as administrator.","remote.phone.authorize.powershell":"1. Authorize the phone's key: on this computer, paste this into PowerShell.","remote.phone.authorize.terminal":"1. Authorize the phone's key: on this computer, paste this into a terminal.","remote.phone.authorizeOnce":"The key only opens the tunnel to Agent Workbench: no terminal and no commands. If you already pasted it, you don't need to do it again.","remote.phone.hint":"Using the Android app? It only needs step 1: it opens the tunnel and pairs itself.","remote.phone.qrLabel":"Code to scan with the phone","remote.phone.scan":"2. In the app, tap “Scan code” and point the camera here:","remote.phone.secret":"Don't share this code or a photo of it: it carries the phone's key.","remote.phone.start":"Pair a phone","remote.phone.title":"A phone","remote.port":"Port","remote.portInvalid":"A number between {{min}} and {{max}}.","remote.portSave":"Save","remote.restartHint":"Turning it on, or changing the port, takes effect when you restart Agent Workbench. Restarting closes the open CLIs: the tabs come back asleep.","remote.ssh.linux":"In a terminal (Ubuntu or Debian; on other distributions, install their OpenSSH server):","remote.ssh.macos":"System Settings → General → Sharing → turn on “Remote Login”.","remote.ssh.windows":"Open PowerShell as administrator and paste this. The first line downloads and installs the server: it takes a few minutes and shows “Running” meanwhile. Wait until the prompt comes back before moving on.","remote.state.active":"On, port {{port}}","remote.state.off":"Off","remote.state.portBusy":"Port {{port}} is busy, so remote access isn't working in this run. Close the other program (it may be another Agent Workbench) and restart, or choose another port.","remote.state.restartNeeded":"On, but it takes effect when you restart Agent Workbench","remote.step.host":"1. On this computer, once: turn on SSH","remote.step.hostHint":"It's a system setting that needs administrator rights, so the app doesn't do it for you. This computer's system is open:","remote.step.pair":"3. Pair it, once per device","remote.step.tunnel":"2. On the other computer, each time you use it","remote.step.tunnelHint":"Paste this command into its terminal and leave it open. It asks for the password of your user on this computer.","remote.title":"Remote access","remote.trouble":"Not connecting?","remote.trouble.network":"On Windows, check that this computer's Wi‑Fi network is set to Private.","remote.turnOff":"Turn off","remote.turnOffHint":"Turning it off takes effect right away: paired devices are disconnected, and stay paired.","remote.turnOn":"Turn on remote access","remote.userHint":"If SSH rejects “{{user}}”: with a Microsoft or work account, try the name of your user folder (C:\\Users\\<name>) and the account password, not the PIN.","remote.vpnHint":"A work VPN that blocks the local network cuts the connection while it's on. The app can't do anything about that.","rewind.filesHint":"Changes made by hand or with console commands are not undone.","rewind.filesSection":"Files the agent changed since then","rewind.intro":"This message and everything after it are undone. The message comes back to the message box so you can edit it.","rewind.running":"Going back…","rewind.title":"Go back to before this message","rewind.undo":"Undo","rewind.undoAll":"Undo conversation and code","rewind.undoConversation":"Conversation only","search.found":"{{hits}} in {{sessions}}","search.hits_one":"{{count}} match","search.hits_other":"{{count}} matches","search.mode.conversations":"In conversations","search.mode.conversationsTitle":"Searches the text of the conversations saved in the backup, ignoring case and accents","search.mode.titles":"In titles","search.off":"The backup is off: the search covers what it saved while it was on.","search.placeholder.conversations":"Search the conversations (Enter)","search.placeholder.titles":"Filter projects and sessions","search.role.assistant":"Response","search.role.title":"Title","search.role.user":"Request","search.sessions_one":"{{count}} session","search.sessions_other":"{{count}} sessions","search.status.done":"{{found}}.","search.status.none":"No results","search.status.noneIn":"No results in {{sessions}}.","search.status.progressFound_one":"Searching… {{scanned}} of {{count}} session, {{found}} so far.","search.status.progressFound_other":"Searching… {{scanned}} of {{count}} sessions, {{found}} so far.","search.status.progress_one":"Searching… {{scanned}} of {{count}} session.","search.status.progress_other":"Searching… {{scanned}} of {{count}} sessions.","search.status.searching":"Searching…","search.status.truncatedResults":"{{found}}: these are the first ones, refine the search to see the rest.","search.status.truncatedTime":"{{found}}: the search stopped after {{seconds}} s and {{left}} were left unchecked.","search.tooShort":"Type at least {{min}} characters and press Enter.","searchHook.connectionLost":"The connection to the server was lost: search again.","server.agentUnknown":"This server doesn't know how to launch that CLI.","server.answerFreeTextMulti":"In a multiple-choice question, write your own answer in the CLI tab.","server.answerInterrupted":"The answer wasn't fully sent: the interruption cut it off.","server.answerInvalid":"The answer doesn't match the question.","server.answerMenuChanged":"The question no longer looks the way it was read: answer it in the CLI tab.","server.answerNoFreeText":"This question doesn't accept a written answer: choose one of the options.","server.answerNotPending":"That question is no longer waiting for an answer.","server.answerSendFailed":"The answer couldn't be sent: answer it in the CLI tab.","server.answersUnsupported":"This CLI doesn't take answers from the conversation. Answer it in the CLI tab.","server.archiveOpenTab":"Sessions with an open tab aren't archived. Close it first.","server.attachmentEmpty":'"{{name}}" arrived empty.',"server.attachmentExecutable":`Executables aren't attached: "{{name}}".`,"server.attachmentSaveFailed":"The attached file couldn't be saved.","server.attachmentTooLarge":'"{{name}}" is {{size}} MB; the maximum is {{max}} MB.',"server.badMessage":"Message not recognized by the protocol.","server.cliFolderClosed":"That's inside a CLI's own folder: the app doesn't open it.","server.cliMissing":`The "{{command}}" command wasn't found in the PATH. Agent Workbench uses the CLI you already have installed: it doesn't include or download it. Install it from {{url}} and start again.`,"server.cliNotFound":"The CLI isn't installed or wasn't found in the PATH.","server.cliNotInstalled":"{{label}} isn't installed or wasn't found in the PATH.","server.cliOpenFailed":"The tab's CLI couldn't be opened.","server.continueFailed":"The continuation couldn't be prepared.","server.continueHistoryMissing":"That conversation's history wasn't found.","server.continueNoFolder":"That conversation doesn't say which folder it ran in.","server.continueNotInHistory":"That conversation isn't in the history: if it just started, try again in a few seconds.","server.continueReadFailed":"That conversation couldn't be read.","server.continueSameCli":"That conversation already belongs to that CLI: to continue it, open it from the sidebar.","server.continueTabFailed":"The continuation's tab couldn't be opened.","server.continueTranscriptFailed":"The continuation's transcript couldn't be saved.","server.conversationNotFollowed":"That conversation is no longer being followed.","server.cwdMissing":"The directory doesn't exist: {{cwd}}","server.cwdNotDir":"It isn't a directory: {{cwd}}","server.diffBinaryUntracked":"Untracked binary file.","server.diffNewEmpty":"New, empty file.","server.diffNoStaged":"There are no staged changes for this file.","server.diffNoUnstaged":"There are no unstaged changes for this file.","server.diffReadFailed":"The diff couldn't be read.","server.dirReadFailed":"The directory couldn't be read.","server.dirSearchFailed":"The directory couldn't be searched.","server.fileReadFailed":"The file couldn't be read.","server.fileSaveBlocked":"The file couldn't be saved: it's read-only, or another program has it open.","server.fileSaveFailed":"The file couldn't be saved.","server.fileSaveTooLarge":"It's too big to save from here: the limit is {{max}}.","server.filesPerMessage":"You can attach up to {{max}} files per message.","server.forceSendFailed":"Couldn't force the send: the message is still queued.","server.forceSendNoCli":"This tab's CLI isn't open.","server.forceSendNothing":"Nothing is queued: the message already reached the agent.","server.forceSendUnsupported":"This tab's CLI can't force a send from the app.","server.forceSendWaiting":"The CLI is waiting for your answer: answer it before forcing the send.","server.gitCommandFailed":"git {{command}} failed.","server.gitMissing":"git wasn't found in the PATH. The Changes panel needs git installed; the rest of the app works the same.","server.gitNotFound":"git wasn't found in the PATH.","server.gitNotRepo":"This folder isn't inside a git repository.","server.gitRunFailed":"git couldn't be run to read the repository's status.","server.gitStatusUnknown":"The repository's status isn't known yet.","server.gitUnexpected":"Unexpected answer from git {{command}}.","server.handoffEmpty":"That conversation has no messages to continue.","server.handoffNoTranscript":"That conversation has no messages to continue: that CLI didn't leave a readable transcript.","server.imageEmpty":"The image arrived empty.","server.imageTooLarge":"The image is {{size}} MB; the maximum is {{max}} MB.","server.imageTypeUnsupported":"Image type not supported: {{type}}","server.imageUnknownFormat":"The content isn't an image in a known format.","server.imagesPerMessage":"You can attach up to {{max}} images per message.","server.imagesUnsupported":"This CLI doesn't take images from the message box.","server.memoryAppeared":"{{file}} appeared during the installation. Review the changes again.","server.memoryBrokenBlock":"{{file}} has malformed memory block markers (one without its pair, or the block repeated). Fix it by hand: the app won't touch that file in the meantime.","server.memoryChooseFile":"Choose at least one instructions file.","server.memoryGitFailed":"git couldn't be queried ({{detail}}). Without that, there's no telling whether .gitignore needs changes.","server.memoryHardLinks":"{{file}} has hard links: the app doesn't modify it, because writing it would break the link. Add the block by hand.","server.memoryLinkOutside":"{{path}} points outside the project (a link or a junction): the app doesn't write there.","server.memoryNotAFile":"{{label}} exists but isn't a file.","server.memoryNotInstalled":"Install the bridge first: the .agents/memory folder is missing.","server.memoryNotUtf8":"{{file}} isn't UTF-8 (it looks like UTF-16, which is what `>` leaves in Windows PowerShell 5.1). Save it as UTF-8: the app won't touch it in the meantime.","server.memoryNoteClaude":"Add this line at the end. Claude Code imports the file at startup.","server.memoryNoteGone":"That note no longer exists.","server.memoryNoteHardLink":"Hard link. `~/{{path}}` has to exist first, and the CLI's file must not: if it exists, move what it has into `global.md` and delete it. If your editor saves by replacing the file, the link breaks: in that case copy the content.","server.memoryNoteHardLinkCmd":"Hard link, in cmd. `~/{{path}}` has to exist first, and the CLI's file must not: if it exists, move what it has into `global.md` and delete it. If your editor saves by replacing the file, the link breaks: in that case copy the content.","server.memoryNoteName":"That name isn't a memory note.","server.memoryNoteOpenCode":"Inside the root object. Absolute path: OpenCode doesn't expand `~` in this key (unverified).","server.memorySameFile":"{{other}} and {{file}} are the same file (a link). Choose just one.","server.memoryViaEncoding":"{{file}} isn't UTF-8","server.memoryViaFallback":"CLAUDE.md (fallback)","server.memoryViaFile":"{{file}}","server.memoryViaNoBlock":"the block is missing in {{file}}","server.memoryViaNoBlockEither":"the block is missing in AGENTS.md or CLAUDE.md","server.memoryViaNoFolder":"the .agents/memory folder is missing","server.memoryViaNoIndex":".agents/memory/MEMORY.md is missing","server.memoryViaOutside":"{{file}} points outside the project","server.modePendingConfirmation":"There's a confirmation pending in the CLI: changing the mode now would approve it. Answer it in the CLI tab.","server.modeUnreachable":"That mode can't be reached from the current one. Change it with {{key}} in the CLI tab.","server.modesUnsupported":"This CLI has no permission modes to change from here.","server.noteCliNotStarted":"That tab's CLI didn't manage to start; the note wasn't sent.","server.noteEmpty":"The note is empty.","server.noteExists":"That note already exists.","server.noteGone":"The note no longer exists.","server.noteIdInvalid":"The note's id isn't valid.","server.noteImageFailed":"An image from the note couldn't be attached.","server.noteImagesMax":"Up to {{max}} images per note.","server.noteImagesUnsupported":"This CLI doesn't take images; the note wasn't sent.","server.noteInterrupted":"The note wasn't fully sent: the interruption cut it off.","server.noteNoAgent":"That tab has no agent to send the note to.","server.noteNoReadySignal":"This CLI doesn't say when it's ready; the note wasn't sent.","server.noteSaveFailed":"The note couldn't be saved.","server.noteTooLong":"A note holds up to {{max}} characters.","server.notesMax":"Up to {{max}} open notes. Close one first.","server.openToolSubmit":"{{label}} has a tool without a result: it may be asking for approval. Answer it in the CLI tab.","server.operationFailed":"The operation couldn't be completed: {{detail}}","server.pasteImageFailed":"The pasted image couldn't be saved.","server.pathMissing":"The path doesn't exist.","server.pathNotRelative":"Only paths relative to the tab's directory are accepted.","server.pathNullByte":"The path contains a null byte.","server.pathOpenFailed":"The path couldn't be opened.","server.pathOutside":"The path goes outside the tab's directory.","server.pendingSubmitAnswer":"{{label}} is waiting for an answer: the message's Enter would answer it. Answer it in the CLI tab.","server.pendingSubmitPermission":"{{label}} is waiting for you to authorize a tool: the message's Enter would approve it. Answer it in the CLI tab.","server.pickerCliFolder":"That folder belongs to the CLI and can't be opened from here.","server.pickerClosed":"That folder picker is no longer open.","server.pickerCreateFailed":"The folder couldn't be created there.","server.pickerFolderExists":"There's already a folder with that name.","server.pickerListFailed":"That folder couldn't be listed.","server.pickerNameChars":"The name has characters that can't be used.","server.pickerNameInvalid":"The folder name isn't valid.","server.pickerNoProjectsHere":"Projects aren't created there: it's the CLI's folder.","server.pickerNotListed":"That folder isn't in the current listing.","server.pickerRootMissing":"That root doesn't exist.","server.pickerTooMany":"Too many folder pickers are open.","server.planReadFailed":"The plan couldn't be read.","server.queueEditBusyEditor":"The CLI's input box has text: edit the queue in the CLI tab.","server.queueEditDelivered":"The agent had just received it: it's no longer queued.","server.queueEditFailed":"Couldn't take it out of the queue: it's still queued.","server.queueEditForced":"You already forced the send: the CLI is handing it to the agent.","server.queueEditNoCli":"This tab's CLI isn't open.","server.queueEditNotCleared":"The queue went back to the CLI's input box, but the app couldn't clear it: your messages are there, in the CLI tab.","server.queueEditNotOnScreen":"The CLI doesn't show anything queued: it may have just handed it to the agent.","server.queueEditNothing":"Nothing is queued: the message already reached the agent.","server.queueEditUnsupported":"This tab's CLI can't edit its queue from the app.","server.queueEditWaiting":"The CLI is waiting for your answer: answer it before editing the queue.","server.raw":"{{text}}","server.relaunchCloseFailed":"The tab's CLI couldn't be closed to relaunch it.","server.remoteDeviceGone":"That device is no longer paired.","server.remoteFailed":"The remote access change couldn't be made.","server.remoteHostOnly":"Remote access is managed only from the computer running Agent Workbench.","server.remoteNotActive":"Remote access isn't on and running yet. Turn it on and restart Agent Workbench.","server.remoteOpensOnHost":"That opens a window on the computer running Agent Workbench, so it isn't available from a remote device.","server.remotePortInvalid":"The port has to be a number between {{min}} and {{max}}.","server.remoteTooManyDevices":"There are already {{max}} paired devices. Revoke one first.","server.rewindBusy":"The CLI is working: stop it before going back.","server.rewindFailed":"Couldn't go back from here, and nothing was undone. Do it in the CLI tab with Esc Esc.","server.rewindNoCli":"This tab's CLI isn't open: open it to go back.","server.rewindUnknownMessage":"That message is no longer in the conversation.","server.rewindUnsupported":"This tab's CLI can't go back from the app.","server.searchFailed":"The backup couldn't be searched.","server.settingsFailed":"Couldn't save the settings.","server.settingsHostOnly":"These settings can only be changed on the computer running Agent Workbench.","server.settingsShellMissing":"That console isn't installed anymore.","server.shellNotFound":"No system console was found to open.","server.submitInterrupted":"The message wasn't fully sent: the interruption cut it off.","server.submitStartupDialog":"{{label}} is asking something on its screen before it takes messages, like whether you trust this folder. Answer it in the CLI tab and send again: the message is back in the message box.","server.submitStoppedTool":"The message wasn't fully sent: {{label}} opened a tool while it was being typed and may be asking for approval. Check the CLI tab.","server.submitStoppedToolNoLabel":"The message wasn't fully sent: the CLI opened a tool while it was being typed and may be asking for approval. Check the CLI tab.","server.submitStoppedWaiting":"The message wasn't fully sent: {{label}} started waiting for an answer while it was being typed. Answer it before sending another message.","server.submitStoppedWaitingNoLabel":"The message wasn't fully sent: the CLI started waiting for an answer while it was being typed. Answer it before sending another message.","server.tabClosedWhileOpening":"The tab closed while it was opening.","server.tabDirGone":"The tab's directory no longer exists.","server.tabOpenFailed":"The tab couldn't be opened.","server.terminalAsleep":"This tab doesn't have its CLI open. Open it to write to the agent.","server.terminalGone":"The terminal no longer exists.","server.terminalOpenFailed":"The terminal couldn't be opened.","server.tooManyTabs":"You can't open more than {{max}} tabs at once.","server.vaultBusyMeasuring":"The backup is busy measuring. Try again when it's done.","server.vaultBusyMoving":"The backup is busy moving to another folder. Try again when it's done.","server.vaultBusyWriting":"The backup is busy copying. Try again when it's done.","server.vaultCannotWrite":"That folder can't be written to.","server.vaultCurrentInsideTarget":"The current backup can't end up inside the new folder.","server.vaultDiskFull":"Disk full: the pass stopped ({{detail}})","server.vaultFailed":"The backup operation couldn't be completed.","server.vaultIndexNotReady":"The history is still being read. Measure when it's done.","server.vaultMeasureFirst":"First measure how much it would take.","server.vaultMemoryFailed":"memory of {{cwd}}: {{detail}}","server.vaultMoveFailed":"The backup couldn't be moved: {{detail}}","server.vaultMoving":"The backup is moving to another folder. Try again when it's done.","server.vaultNoCopyYet":"There's no backup yet.","server.vaultNotLoaded":"The backup isn't loaded.","server.vaultProjectGone":"That project is no longer in the sidebar.","server.vaultReasonNewerFormat":"the existing copy is in a newer format","server.vaultReasonOriginMissing":"the source wasn't found","server.vaultReasonUnsafeId":"a session id that can't be copied","server.vaultSessionFailed":"{{agent}}/{{session}}: {{detail}}","server.vaultSessionMissing":"That session isn't in the backup.","server.vaultTargetCliFolder":"That folder belongs to a CLI: the backup isn't kept there.","server.vaultTargetInsideCurrent":"The new folder can't be inside the current backup.","server.vaultTargetNotAbsolute":"The backup folder has to be an absolute path.","server.waitingSubmit":"{{label}} is waiting for an answer: answer it before sending another message.","server.worktreeBaseAdvanced":"{{base}} moved ahead: the branch has to catch up first. Nothing was merged.","server.worktreeBaseMissing":"The branch {{base}} doesn't exist in this repository.","server.worktreeBaseNotOpen":"{{base}} isn't checked out in any folder, so there's nowhere to merge it.","server.worktreeBranchExists":"The branch {{branch}} already exists.","server.worktreeBranchInUse":"The branch {{branch}} is already open in another folder.","server.worktreeBranchInvalid":"{{branch}} isn't a valid branch name.","server.worktreeBranchMissing":"The branch {{branch}} doesn't exist anymore.","server.worktreeBranchMoved":"The branch {{branch}} changed after you opened this plan: close it and open it again to see what would go in. Nothing was integrated.","server.worktreeBranchNotIntegrated":"The branch {{branch}} has unmerged commits: it wasn't deleted.","server.worktreeDiffEmpty":"This file has no line changes against the base.","server.worktreeDiscardFailed":"Couldn't delete all the new files: {{detail}}. The branch wasn't removed.","server.worktreeFailed":"The separate branch couldn't be handled.","server.worktreeFileNotInBranch":"That file isn't among the ones the branch changed.","server.worktreeFolderExists":"The folder {{folder}} already exists. Choose another branch name.","server.worktreeGitFailed":"git refused: {{detail}}","server.worktreeInUse":"Another program has the branch's folder open. Close it and try again.","server.worktreeLocalChanges":"Uncommitted files in the base folder that the branch touches: {{count}}. git would refuse, so nothing was merged.","server.worktreeNoConflicts":"There are no notes left that can't be combined on their own.","server.worktreeNoReview":"That branch has no review yet.","server.worktreeNotRepo":"This folder isn't in a git repository.","server.worktreeNotesConflict":"Notes that changed on both sides and can't be combined: {{count}}. Nothing was removed.","server.worktreeNotesFailed":"The notes couldn't go back to the main folder, so nothing was removed: {{detail}}","server.worktreeNothingToCommit":"The branch has nothing uncommitted anymore.","server.worktreeNothingToIntegrate":"There's nothing to merge: the branch has no commits its base lacks.","server.worktreeNothingToReview":"There's nothing to review: the branch has no commits or changes of its own.","server.worktreeProjectUnknown":"The project's folder isn't there anymore.","server.worktreeReviewUnread":"The reviewer's answer couldn't be read: if it just finished, try again in a few seconds.","server.worktreeUncommitted":"Files with uncommitted changes: {{count}}. Nothing was removed.","server.worktreeUnknown":"That separate branch isn't in the app's list anymore.","server.worktreeUntrackedChanged":"The new files changed since you looked at them. Nothing was removed.","server.worktreeUpToDate":"The branch is already up to date with {{base}}.","session.untitled":"Untitled session","settings.cli.disabled":"Off","settings.cli.hint":"An unchecked CLI doesn't show in the menu or the sidebar, and its history isn't read.","settings.cli.install":"How to install it","settings.cli.notInstalled":"Not installed","settings.cli.restart":"Changes to the CLIs apply when you restart the app.","settings.console.auto":"Automatic","settings.console.autoWith":"Automatic ({{shell}})","settings.console.hint":"For consoles you open from now on; the open ones keep theirs.","settings.hiddenHint":"Hidden: {{name}}. You can show it again from ⚙ Settings.","settings.hide.console":"Hide the console (it comes back from ⚙ Settings)","settings.hide.notes":"Hide the notes (they come back from ⚙ Settings)","settings.hostOnly":"The console and the CLIs can only be changed on the computer running Agent Workbench.","settings.language":"Language","settings.more.open":"{{name}}…","settings.oldServer":"The server is from an older version: restart it to choose the console and the CLIs.","settings.open":"Settings","settings.panels.cliAlways":"The CLI tab is always shown: the agent's permissions and questions appear there.","settings.panels.consoleConfirmYes":"Hide and close","settings.panels.consoleConfirm_one":"Hiding the console closes {{count}} open terminal.","settings.panels.consoleConfirm_other":"Hiding the console closes {{count}} open terminals.","settings.section.appearance":"Appearance","settings.section.clis":"CLIs","settings.section.console":"Console","settings.section.more":"More","settings.section.panels":"Panels","settings.terminalTheme":"Terminal theme","settings.terminalTheme.dark":"Always dark","settings.terminalTheme.follow":"Follow the app's theme","settings.terminalTheme.hint":"CLIs pick their colors for a dark terminal: on a light one, some text is hard to read.","settings.title":"Settings","shortcuts.altNumber":"<strong>Alt + number</strong> isn't used either, on purpose: on Windows, Alt with the numeric keypad is how you type characters that aren't on the keyboard (<kbd>Alt + 164</kbd> = ñ). Intercepting it breaks typing accented characters. To switch tabs there are <kbd>Alt + ←</kbd> and <kbd>Alt + →</kbd>.","shortcuts.app.closeTab":"Close the active tab","shortcuts.app.newTab":"New tab in the current tab's directory","shortcuts.app.previousTab":"Go back to the previous tab (outside the terminal: inside, it goes to the CLI)","shortcuts.app.switchTab":"Previous / next tab (also Alt + PgUp / PgDn)","shortcuts.app.togglePanel":"Show or hide the right panel","shortcuts.ariaLabel":"Keyboard shortcuts","shortcuts.browserReserved":"<strong>Ctrl+T</strong>, <strong>Ctrl+W</strong> and <strong>Ctrl+Tab</strong> can't be used: the browser keeps them for its own tabs and the event never reaches the page.","shortcuts.cliHint":"The CLI handles these. The app doesn't intercept them: they reach it as they are. In the terminal, a new line is still <kbd>Ctrl + J</kbd> and images are pasted with <kbd>Alt + V</kbd>; the message box is the one with the keys above.","shortcuts.section.app":"Application","shortcuts.section.cli":"CLI, inside the terminal","shortcuts.section.composer":"In the message box","shortcuts.title":"Shortcuts","sidebar.action.archive":"Archive","sidebar.action.restore":"Restore","sidebar.action.undo":"Undo","sidebar.archived.hide_one":"Hide {{count}} archived","sidebar.archived.hide_other":"Hide {{count}} archived","sidebar.archived.show_one":"Show {{count}} archived","sidebar.archived.show_other":"Show {{count}} archived","sidebar.archived.toggleTitle":"Archived sessions stay on disk; this only shows or hides them","sidebar.empty.noMatch":"Nothing matches the filter.","sidebar.empty.noProjects":"No projects found in the history.","sidebar.hide":"Hide the projects","sidebar.history.button":"Archive history…","sidebar.history.buttonTitle":"Hide a CLI's sessions from before today in one go. Nothing is deleted","sidebar.history.confirm_one":"{{count}} {{label}} session will be hidden; nothing is deleted","sidebar.history.confirm_other":"{{count}} {{label}} sessions will be hidden; nothing is deleted","sidebar.history.count_one":"{{count}} session from before today","sidebar.history.count_other":"{{count}} sessions from before today","sidebar.history.heading":"Archive everything before today","sidebar.history.region":"Archive history","sidebar.indexing":"Indexing {{scanned}} / {{total}}","sidebar.newProject":"New project: choose or create a folder","sidebar.project.archive":"Archive project","sidebar.project.archiveTitle":"Archive the project: hides its conversations from the sidebar. Nothing is deleted","sidebar.project.export":"Export to Markdown","sidebar.project.folderGone":"The folder no longer exists on disk","sidebar.project.missing":"folder not found","sidebar.project.newSession":"New session in this project","sidebar.reindex":"Reindex the history","sidebar.searchMode.label":"Where to search","sidebar.searchMode.titlesTitle":"Filters the list by project name and session title","sidebar.selection.count_one":"{{count}} selected","sidebar.selection.count_other":"{{count}} selected","sidebar.session.archive":"Archive — hides it from the list, nothing is deleted","sidebar.session.blocked":"It has an open tab. Close it first.","sidebar.session.restore":"Restore to the list","sidebar.undo.dismissTitle":"Dismiss the notice; the sessions stay archived","sidebar.undo.text_one":"Archived {{count}} session from {{what}}","sidebar.undo.text_other":"Archived {{count}} sessions from {{what}}","sidebar.vaultLine.lastError":"Last error: {{error}}","sidebar.vaultLine.title":"See the backup's status and folder","sound.notify.blocked":"The browser is blocking this page's notifications. Allow them in the site's settings and click again.","sound.notify.off":"System notifications off — click to turn them on","sound.notify.on":"System notifications on — click to turn them off. They only show when this window isn't in view.","sound.off":"Notification sound muted — click to turn it on","sound.on":"Notification sound on — click to mute","sound.volume":"Notification sound volume","statusLine.benefit":"With the status line configured, this CLI's tabs show their status, the “waiting” bar when it asks for permission to use a tool, the context meter with the exact window, and how much of your quota is left. Without it there's no way to know: the CLI doesn't leave it in any other file.","statusLine.check":"Check","statusLine.checkHint":"The app also notices on its own within a couple of seconds.","statusLine.checking":"Checking…","statusLine.copied":"Copied","statusLine.copy":"Copy","statusLine.copyTitle":"Copy the line to the clipboard","statusLine.lineSection":"The line","statusLine.mergeHint":"Merge it with what the file below already has, without replacing it: if it already has braces, add only the <kbd>statusLine</kbd> key.","statusLine.planBenefit":"With the status line configured, the bar above the conversation shows how much of your plan you've used in the 5-hour window and in the week, and when each one resets. The CLI doesn't leave this in any other file, and only publishes it for subscription plans.","statusLine.planNoFragment":"The app's folder has characters that the shell interprets inside quotes ($, ` or \"), and with them there's no line the CLI can run. Moving the configuration folder to a path without those characters fixes it.","statusLine.planReplaces":"The CLI allows a single status line: this one replaces any other you have. And with a status line configured, the CLI stops showing some hints at its bottom, such as “esc to interrupt”.","statusLine.planScriptHint":"It only saves the two limits and the session id, in the app's folder, and prints them as a short line at the bottom of the CLI. It doesn't save the folder, the transcript, the cost or the model, which the CLI also passes to it.","statusLine.runsEverywhere":"With the line in place, every CLI session runs it, including the ones you open outside the app, and it needs <kbd>node</kbd> in the PATH.","statusLine.scriptHint":"It only saves the status, model and tokens of each conversation, and how much of your quota is left, in the app's folder. It doesn't save your email, your plan or the cost, which the CLI also passes to it, and it doesn't print anything: the CLI's own line stays as it is.","statusLine.scriptSection":"What the script does","statusLine.title":"{{agent}} status line","statusLine.whereHint":"The app doesn't touch that file: you edit it.","statusLine.whereSection":"Where","summary.alsoWorksWith":"Also works with: {{names}}","summary.newerServer":"The server is from a newer version than this page (protocol {{server}}, this page uses {{page}}). Reload the page with F5.","summary.outdatedServer":"The running server is from an older version than this page (protocol {{server}}, this page uses {{page}}). Restart it and reload the page.","support.dismiss":"Not now","support.link":"Support","support.notice":"If Agent Workbench is useful to you, consider supporting it.","tabs.aria.opening":"opening","tabs.aria.working":"working","tabs.close":"Close (Alt+W)","tabs.dot.busy":"The agent is working","tabs.dot.exited":"This tab's CLI has closed","tabs.dot.sleeping":"Sleeping: readable, no CLI open","tabs.dot.waiting":"The CLI is waiting for an answer from you","tabs.new":"New tab (Alt+T)","tabs.state.alive":"active","tabs.state.exited":"exited (code {{code}})","tabs.state.opening":"opening…","tabs.state.sleeping":"sleeping","terminal.exited":"the process exited (code {{code}})","terminal.replayTruncated":"earlier output trimmed","theme.dark":"Dark theme","theme.light":"Light theme","theme.system":"System theme","theme.title":"{{theme}} — click to change","thread.continueCli":"CLI","thread.copyMessage":"Copy this message's text","thread.empty.noMessages":"The session doesn't have any messages yet.","thread.empty.unavailable":"This tab doesn't have a known directory, so there's no session file to follow.","thread.empty.waiting":"Waiting for the first message. The session file is created when the conversation starts.","thread.fold.less":"show less","thread.fold.more_one":"show {{count}} line","thread.fold.more_other":"show all {{count}} lines","thread.goToCli":"Go to the CLI tab","thread.image.alt":"message image","thread.image.gone":"the image is no longer in the file","thread.image.loading":"loading image…","thread.image.openTitle":"Click to see it full size","thread.jumpToEnd":"Jump to the end","thread.jumpToEndNew_one":"Jump to the end: {{count}} new message","thread.jumpToEndNew_other":"Jump to the end: {{count}} new messages","thread.jumpToOwn":"Jump to your previous message","thread.loadEarlier":"Load earlier messages","thread.loadingMore":"Loading...","thread.notice.compacted":"Context compacted","thread.notice.compactedAuto":"Context compacted automatically","thread.notice.error":"The CLI returned an error: {{detail}}","thread.notice.errorNoDetail":"The CLI returned an error","thread.notice.interrupted":"Interrupted","thread.openFolder":"Open {{path}} in the system's file explorer","thread.openInFiles":"Open {{path}} in the Files tab","thread.pasted_one":"Pasted text #{{number}} · {{count}} line","thread.pasted_other":"Pasted text #{{number}} · {{count}} lines","thread.question.answerInCli":"Answer in the CLI tab","thread.question.answered":"Answered","thread.question.multi":"multiple","thread.question.pickEach":"Pick an option in each question · you can also answer in the CLI tab","thread.question.pickOne":"Pick an option · you can also answer in the CLI tab","thread.question.placeholder":"Write your answer","thread.question.send":"Send","thread.question.sendAnswers":"Send answers","thread.question.useText":"Use this text","thread.question.writeOther":"Write another answer…","thread.question.writeOtherHint":"To suggest an alternative, or give more context","thread.queue.edit":"Edit","thread.queue.editTitle_one":"Takes it out of the queue and brings it to the message box to edit. ↑ in the empty box does the same","thread.queue.editTitle_other":"Takes the {{count}} queued messages out together and brings them to the message box: the CLI doesn't take out just one. ↑ in the empty box does the same","thread.queue.editing":"Bringing it back…","thread.queue.forceBlocked":"The CLI is waiting for your answer: answer it first","thread.queue.forceSend":"Force send now","thread.queue.forceSendTitle":"The agent stops what it's doing and reads your message now. Use it when it's heading the wrong way","thread.queue.forced":"sent to the agent","thread.queue.forcedTitle":"You forced the send: the CLI is handing it to the agent, and it shows up in the conversation once the CLI records it","thread.queue.forcing":"Sending…","thread.queue.images_one":"+{{count}} image","thread.queue.images_other":"+{{count}} images","thread.queue.label":"queued","thread.queue.labelTitle":"You sent it while the agent was working: the CLI hands it over when the agent can read it","thread.rewind":"Go back to before this message","thread.rewindBusy":"Stop the agent first to go back to before this message","thread.search.next":"Next","thread.search.none":"no results","thread.search.placeholder":"Search the conversation","thread.search.previous":"Previous","thread.status.awaitingReply":"Delivered to the CLI · no reply yet · {{elapsed}}","thread.status.delivered":"Delivered to the CLI","thread.status.sending":"Sending to the CLI…","thread.status.subagent":"{{name}} ({{elapsed}})","thread.status.subagentUnnamed":"unnamed","thread.status.subagentsMore_one":"{{count}} more","thread.status.subagentsMore_other":"{{count}} more","thread.status.subagents_one":"{{count}} subagent still working: {{list}}","thread.status.subagents_other":"{{count}} subagents still working: {{list}}","thread.status.working":"The agent is working…","thread.status.workingDelivered":"The agent is working · message delivered","thread.status.workingFor":"The agent is working · {{elapsed}}","thread.status.workingForDelivered":"The agent is working · {{elapsed}} · message delivered","thread.tool.error":"error","thread.tool.imagesNotSent_one":"({{count}} image: not sent to the panel)","thread.tool.imagesNotSent_other":"({{count}} images: not sent to the panel)","thread.tool.images_one":"{{count}} image","thread.tool.images_other":"{{count}} images","thread.tool.input":"input","thread.tool.noOutput":"(no output)","thread.tool.orphanResult":"orphan result","thread.tool.result":"result","thread.truncated":"… (truncated)","thread.turn.effort":"effort {{effort}}","thread.turn.queued":"sent while it was working","thread.turn.queuedTitle":"You wrote it while the agent was working: it went into the turn already in progress","thread.turn.you":"You","thread.wake.exited":"This tab's CLI closed.","thread.wake.exitedWithCode":"This tab's CLI closed (exit code {{code}}).","thread.wake.open":"Open CLI","thread.wake.opening":"Opening…","thread.wake.sleeping":"You're reading this conversation without the CLI open. Open it to write to the agent.","threadFont.size.l":"large","threadFont.size.m":"normal","threadFont.size.s":"small","threadFont.title":"Font size: {{current}} (click: {{next}})","time.daysAgo":"{{count}} d ago","time.hoursAgo":"{{count}} h ago","time.justNow":"just now","time.minutesAgo":"{{count}} min ago","tools.run.agent_one":"{{count}} subagent","tools.run.agent_other":"{{count}} subagents","tools.run.callsTo_one":"{{count}} call to {{name}}","tools.run.callsTo_other":"{{count}} calls to {{name}}","tools.run.edit_one":"{{count}} edit","tools.run.edit_other":"{{count}} edits","tools.run.find_one":"{{count}} project search","tools.run.find_other":"{{count}} project searches","tools.run.read_one":"{{count}} file read","tools.run.read_other":"{{count}} files read","tools.run.shell_one":"{{count}} console command","tools.run.shell_other":"{{count}} console commands","tools.run.todo_one":"{{count}} to-do list","tools.run.todo_other":"{{count}} to-do lists","tools.run.web_one":"{{count}} search","tools.run.web_other":"{{count}} searches","vault.archived":"Archived sessions aren't copied, and archiving one that was already copied doesn't delete its copy. The app never deletes anything from this folder.","vault.busy":"A backup operation is in progress. Wait for it to finish.","vault.button.off":"Backup: off. Set it up","vault.button.on":"Backup: on. See the status and the folder","vault.dialog.activate":"Turn on","vault.dialog.activateExistingHint":"The folder already has a backup. Once on, it completes it and keeps it up to date.","vault.dialog.activateExistingTitle":"The folder already has a backup: turning it on completes it","vault.dialog.activateMeasuredHint":"Copies everything measured and, after that, every session that changes and stays quiet for a minute.","vault.dialog.activateMeasuredTitle":"Copies what was measured now and, after that, every session that changes","vault.dialog.changeDir":"Change folder…","vault.dialog.changeDirTitle":"Choose another folder. What was copied gets copied there; this one stays untouched","vault.dialog.defaultDir":"It's the default one, in the app's folder.","vault.dialog.folderSection":"Folder","vault.dialog.inFolder":"In the folder","vault.dialog.lastError":"Last error","vault.dialog.lastPass":"last pass {{when}}","vault.dialog.measure":"Measure","vault.dialog.measureAgain":"Measure again","vault.dialog.measureTitle":"Reads the whole history without writing anything, not even the folder","vault.dialog.needsMeasure":"First measure how much it would take: then “{{activate}}” shows up.","vault.dialog.openFolder":"Open folder","vault.dialog.openFolderTitle":"Open the folder in the system's file explorer","vault.dialog.pendingCalm_one":"{{count}} waiting for its quiet minute","vault.dialog.pendingCalm_other":"{{count}} waiting for their quiet minute","vault.dialog.sizeSection":"How much it would take","vault.dialog.table.archived":"Archived","vault.dialog.table.archivedTitle":"Archived sessions aren't copied","vault.dialog.table.images":"Images","vault.dialog.table.memory_one":"Memory of {{count}} project","vault.dialog.table.memory_other":"Memory of {{count}} projects","vault.dialog.table.sessions":"Sessions","vault.dialog.table.size":"Size","vault.dialog.table.total":"Total","vault.dialog.turnOff":"Turn off","vault.dialog.turnOffHint":"Turning it off doesn't delete anything: what was copied stays in the folder.","vault.dialog.waiting":"Waiting for the server's status…","vault.export.done":"Exported: the folder was opened","vault.export.exporting":"Exporting to Markdown…","vault.export.idle":"Export this project's sessions to Markdown","vault.indexNotReady":"The history is still being read. Measure when it's done.","vault.line.copying":"copying","vault.line.copyingProgress":"copying {{done}} / {{total}}","vault.line.measuring":"measuring","vault.line.moving":"moving to another folder","vault.line.neverCopied":"not copied yet","vault.line.pending_one":"{{count}} waiting","vault.line.pending_other":"{{count}} waiting","vault.mark.copy":"backup","vault.mark.copyTitle":"The CLI's history no longer has this session. The backup opens, in Markdown.","vault.mark.partial":"partial","vault.mark.partialTitle":"Only the summary and the documents were recovered: the conversation's content is encrypted.","vault.measure.summary":"Measured {{when}}, in {{duration}}","vault.measure.summaryNoWhen":"Measured in {{duration}}","vault.name":"Backup","vault.note.empty_one":"{{count}} empty","vault.note.empty_other":"{{count}} empty","vault.note.failedWithReasons_one":"{{count}} failed ({{reasons}})","vault.note.failedWithReasons_other":"{{count}} failed ({{reasons}})","vault.note.failed_one":"{{count}} failed","vault.note.failed_other":"{{count}} failed","vault.note.notCopied":"Not copied: {{parts}}","vault.note.unsupported_one":"{{count}} without a full read","vault.note.unsupported_other":"{{count}} without a full read","vault.previousDir":"The previous folder was left untouched: {{dir}}","vault.privacy":"It keeps the same as each CLI's history —messages, tool inputs and results, images— in a folder of yours. If you put it in a synced folder or in a repository, all that travels with it.","vault.sessions_one":"{{count}} session","vault.sessions_other":"{{count}} sessions","vault.state.measuring":"Measuring…","vault.state.measuringProgress":"Measuring… {{done}} / {{total}}","vault.state.moving":"Moving to another folder…","vault.state.off":"Off","vault.state.on":"On","vault.state.writing":"Copying…","vault.state.writingProgress":"Copying… {{done}} / {{total}}","workspace.connectFailed":"Couldn't connect to the local server. Open the URL it printed at startup again.","worktree.actions.catchUp":"Catch up","worktree.actions.catchUpTitle":"Leaves in the branch's box, without sending it, the request to bring in {{base}} with a rebase that its agent runs","worktree.actions.integrate":"Merge into {{base}}","worktree.actions.integrateTitle":"Moves {{base}} up to the tip of the branch with git merge --ff-only, without creating commits. It shows the plan first","worktree.actions.review":"Ask for a review","worktree.actions.reviewTitle":"Another CLI reviews the branch in its folder, without touching it, and answers with a verdict","worktree.actions.sendReview":"Send to the branch","worktree.actions.sendReviewTitle":"Leaves the reviewer's answer in the box of the branch's tab, without sending it: you read it and send it","worktree.actions.showReviewer":"Show","worktree.actions.showReviewerTitle":"Go to the reviewer's tab","worktree.actions.viewChanges":"See changes","worktree.actions.viewChangesTitle":"What the branch brings against its base: its commits and files, read only","worktree.branch.characters":"Use only letters without accents, numbers, -, _, . and /.","worktree.branch.dots":"No .., and no part that starts or ends with a dot.","worktree.branch.empty":"Write a name for the branch.","worktree.branch.lock":"No part can end in .lock.","worktree.branch.reserved":"That name is reserved.","worktree.branch.slashes":"No / at the start or at the end, and never two in a row.","worktree.branch.startsWithDash":"It can't start with -.","worktree.branch.tooLong":"Too long: 100 characters at most.","worktree.changes.commits":"Commits","worktree.changes.empty":"The branch brings no commits against {{base}}.","worktree.changes.files":"Files","worktree.changes.loading":"Reading what the branch brings…","worktree.changes.more_one":"and {{count}} more","worktree.changes.more_other":"and {{count}} more","worktree.changes.title":"{{branch}} against {{base}}","worktree.changes.uncommitted_one":"The branch has {{count}} uncommitted file: it isn't here, it's in its tab's Changes.","worktree.changes.uncommitted_other":"The branch has {{count}} uncommitted files: they aren't here, they're in its tab's Changes.","worktree.copy.summary_one":"{{count}} file, {{size}}","worktree.copy.summary_other":"{{count}} files, {{size}}","worktree.create.agent":"CLI","worktree.create.baseMissing":"Choose the branch it starts from.","worktree.create.branch":"Branch","worktree.create.branchExists":'That branch already exists. To open it, choose "A branch that already exists".',"worktree.create.branchInUse":"That branch is already open in another folder.","worktree.create.branchPlaceholder":"e.g. fix-login","worktree.create.command":"Command","worktree.create.copyList":"{{summary}}: {{list}}.","worktree.create.copyNone":"The repository doesn't ignore any instructions or memory, so there's nothing to copy.","worktree.create.copyNotes":"Copy the instructions and memory the repository ignores.","worktree.create.copySection":"Ignored notes","worktree.create.creating":"Creating…","worktree.create.folder":"Folder","worktree.create.include":"What .worktreeinclude asks for is copied too: {{summary}}.","worktree.create.includeOverCap":"What .worktreeinclude asks for is over the limit ({{summary}}), so it isn't copied.","worktree.create.intro":"The branch gets its own folder next to {{project}}, so its agent works without touching the main folder or the other branches. Only if you want it: projects where you don't open one stay as they are.","worktree.create.loading":"Reading the repository…","worktree.create.mainChanges_one":"The main folder has {{count}} file with uncommitted changes: the new branch starts from the last commit and doesn't take it.","worktree.create.mainChanges_other":"The main folder has {{count}} files with uncommitted changes: the new branch starts from the last commit and doesn't take them.","worktree.create.modeExisting":"A branch that already exists","worktree.create.modeNew":"New branch, from","worktree.create.noFreeBranch":"Every other branch is already open in a folder.","worktree.create.overCap":"{{summary}}: over the limit, so they aren't copied.","worktree.create.submit":"Create and open","worktree.create.title":"New session on a separate branch","worktree.deleteBranch.checkedOut":"The branch {{branch}} is open in a folder: remove that first.","worktree.deleteBranch.deleting":"Deleting…","worktree.deleteBranch.done":"The branch {{branch}} was deleted.","worktree.deleteBranch.intro":"The branch is already merged into {{base}}: no commit is lost, and its conversations can still be reopened from the sidebar.","worktree.deleteBranch.loading":"Looking at the branch…","worktree.deleteBranch.noBase":"{{base}} is gone: there's no way to know whether the branch has unmerged commits, so it isn't deleted from here. Delete it in the terminal if you know nothing is lost.","worktree.deleteBranch.notIntegrated_one":"It has {{count}} commit that {{base}} doesn't: it isn't deleted from here, so it isn't lost. Reopen it from the sidebar and merge it, or delete it in the terminal.","worktree.deleteBranch.notIntegrated_other":"It has {{count}} commits that {{base}} doesn't: it isn't deleted from here, so they aren't lost. Reopen it from the sidebar and merge it, or delete it in the terminal.","worktree.deleteBranch.submit":"Delete","worktree.deleteBranch.title":"Delete the branch {{branch}}","worktree.integrate.blockerBehind":"{{base}} moved ahead: catch up first.","worktree.integrate.blockerLocal_one":"The {{base}} folder has uncommitted changes in {{count}} file the branch touches, and git would refuse: {{list}}. Commit or undo it there first.","worktree.integrate.blockerLocal_other":"The {{base}} folder has uncommitted changes in {{count}} files the branch touches, and git would refuse: {{list}}. Commit or undo them there first.","worktree.integrate.blockerNoBase":"{{base}} isn't checked out in any folder.","worktree.integrate.blockerNothing":"There's nothing to merge: the branch has no commits that {{base}} lacks.","worktree.integrate.branchUncommitted_one":"The branch has {{count}} uncommitted file: it doesn't go in.","worktree.integrate.branchUncommitted_other":"The branch has {{count}} uncommitted files: they don't go in.","worktree.integrate.command":"Command","worktree.integrate.doneOthers":"The other branches will say that {{base}} moved ahead. The separate branch is still there: you can remove it now.","worktree.integrate.done_one":"Done: {{base}} now has the branch's {{count}} commit.","worktree.integrate.done_other":"Done: {{base}} now has the branch's {{count}} commits.","worktree.integrate.files_one":"{{count}} file changes: {{list}}","worktree.integrate.files_other":"{{count}} files change: {{list}}","worktree.integrate.folder":"Where","worktree.integrate.integrating":"Merging…","worktree.integrate.intro_one":"{{count}} commit goes into {{base}}, with no new commit: {{base}} moves forward to the branch's tip.","worktree.integrate.intro_other":"{{count}} commits go into {{base}}, with no new commit: {{base}} moves forward to the branch's tip.","worktree.integrate.loading":"Putting the plan together…","worktree.integrate.noReview":"Nobody reviewed this branch. That doesn't stop the merge: it's your call.","worktree.integrate.notesStay":"These notes changed on both sides and can't be combined on their own: {{list}}. They stay in the branch, and you decide what to do with them when you remove it.","worktree.integrate.notesStayed":"These stayed in the branch, because they can't be combined on their own: {{list}}. You decide what to do with them when you remove it.","worktree.integrate.remove":"Remove the separate branch","worktree.integrate.removeTitle":"Opens the plan to remove its folder","worktree.integrate.submit":"Merge","worktree.integrate.tabs":"The files of these tabs change: {{list}}.","worktree.integrate.title":"Merge {{branch}} into {{base}}","worktree.integrate.titleLoading":"Merge {{branch}}","worktree.new":"New session on a separate branch","worktree.notes.back_one":"{{count}} note goes back to the main folder.","worktree.notes.back_other":"{{count}} notes go back to the main folder.","worktree.notes.hide":"hide","worktree.notes.mergedMark":"combined","worktree.notes.merged_one":"{{count}} is combined with what changed there.","worktree.notes.merged_other":"{{count}} are combined with what changed there.","worktree.notes.resolved_one":"The branch's agent already combined {{list}}: it stays as it is in the main folder.","worktree.notes.resolved_other":"The branch's agent already combined {{list}}: they stay as they are in the main folder.","worktree.notes.returned_one":"{{count}} note went back to the main folder.","worktree.notes.returned_other":"{{count}} notes went back to the main folder.","worktree.notes.show":"show which","worktree.remove.askCommit_one":"Ask the agent to commit it","worktree.remove.askCommit_other":"Ask the agent to commit them","worktree.remove.askNotes":"Ask the agent to combine them","worktree.remove.askTitle":"Leaves the request in the branch tab's message box, without sending it","worktree.remove.commands":"Commands","worktree.remove.conflicts":"These notes changed on both sides and can't be combined on their own: {{list}}. If you remove the branch now, what it changed in them is lost.","worktree.remove.deletesBranch":"It's already merged: its folder and the branch {{branch}} are deleted. Its conversations can still be reopened from the sidebar.","worktree.remove.deletesUnusedBranch":"It has no commits of its own: its folder and the branch {{branch}} are deleted. Its conversations can still be reopened from the sidebar.","worktree.remove.discard":"Remove and lose those changes","worktree.remove.discardFiles":"Remove and lose these files","worktree.remove.done":"The separate branch was removed.","worktree.remove.doneBranch":"The branch was deleted too.","worktree.remove.doneDiscardedFiles_one":"{{count}} new file was lost, as you chose.","worktree.remove.doneDiscardedFiles_other":"{{count}} new files were lost, as you chose.","worktree.remove.doneDiscarded_one":"{{count}} note was lost, as you chose.","worktree.remove.doneDiscarded_other":"{{count}} notes were lost, as you chose.","worktree.remove.holder":"{{program}} ({{exe}}, PID {{pids}})","worktree.remove.holderExe":"{{exe}} (PID {{pids}})","worktree.remove.inUse":"Another program has the folder open (an editor, a development server). Close it and try again.","worktree.remove.inUseBy_one":"{{list}} has the folder open. Close it and try again.","worktree.remove.inUseBy_other":"{{list}} have the folder open. Close them and try again.","worktree.remove.keepsBranch":"It isn't merged yet: its folder is removed, and the branch {{branch}} stays saved in Changes, to merge it or open it again.","worktree.remove.keepsExistingBranch":"The branch {{branch}} already existed: only its folder is removed, and the branch stays.","worktree.remove.loading":"Checking what's in its folder…","worktree.remove.removing":"Removing…","worktree.remove.retry":"Try again","worktree.remove.submit":"Remove","worktree.remove.tabs":"These close: {{list}}.","worktree.remove.title":"Remove the separate branch {{branch}}","worktree.remove.uncommitted_one":"It has {{count}} uncommitted file, and a branch with uncommitted work isn't removed:","worktree.remove.uncommitted_other":"It has {{count}} uncommitted files, and a branch with uncommitted work isn't removed:","worktree.remove.untrackedAccepted":"Lost along with the branch:","worktree.remove.untrackedCopied":"It has new uncommitted files, and among them something that was copied from the main folder and that this branch doesn't ignore: that isn't lost from here. Ask the agent to commit it or delete it:","worktree.remove.untrackedNestedRepo":"It has new uncommitted files, and there's a git repository inside (it may have commits that exist nowhere else): that isn't lost from here. If it's not needed, ask the agent to delete it:","worktree.remove.untrackedTooMany":"It has more than {{max}} new uncommitted files: too many to check and lose from here. If they're not needed, ask the agent to delete them:","worktree.remove.untracked_one":"It has {{count}} new uncommitted file ({{size}}). If it's work, ask the agent to commit it; if not, you can remove the branch and lose it:","worktree.remove.untracked_other":"It has {{count}} new uncommitted files ({{size}}). If they're work, ask the agent to commit them; if not, you can remove the branch and lose them:","worktree.review.author":"{{agent}} worked on the branch: another CLI sees what it takes for granted.","worktree.review.branchBusy":"The branch's tab is working: the review may see something half done.","worktree.review.deliveryPrefill":"The request waits in its box: you send it with Enter.","worktree.review.deliverySent":"The request is sent by itself when the CLI is ready.","worktree.review.guardCli":"{{agent}} starts read-only: it can't edit the branch.","worktree.review.guardNone":"{{agent}} can edit the branch's files: the request tells it not to.","worktree.review.guardTools":"{{agent}} starts without its edit tools, but its shell could still write: the request tells it not to.","worktree.review.intro":"Another CLI reviews what the branch brings against {{base}}, in its folder, and ends with a verdict. Testing it and merging are still up to you.","worktree.review.loading":"Looking at the branch…","worktree.review.nothing":"The branch has nothing to review against {{base}}.","worktree.review.prompt":"What it receives","worktree.review.quota":"Each review uses the quota of the CLI that reviews.","worktree.review.requesting":"Opening…","worktree.review.reviewer":"Who reviews","worktree.review.sameCli":"{{agent}} reviews, in a new conversation.","worktree.review.stale":"{{text}} (of an earlier commit)","worktree.review.stateChanges":"{{agent}} review: asks for changes","worktree.review.stateNone":"{{agent}} review: no verdict","worktree.review.statePending":"{{agent}} review: no answer yet","worktree.review.stateReady":"{{agent}} review: ready to merge","worktree.review.stateWorking":"{{agent}} review: in progress","worktree.review.submit":"Ask for the review","worktree.review.title":"Ask for a review of {{branch}}","worktree.review.uncommitted_one":"The branch has {{count}} uncommitted file: the reviewer looks at it too.","worktree.review.uncommitted_other":"The branch has {{count}} uncommitted files: the reviewer looks at them too.","worktree.rows.ahead_one":"{{count}} commit ahead","worktree.rows.ahead_other":"{{count}} commits ahead","worktree.rows.behind_one":"{{base}} has {{count}} new commit","worktree.rows.behind_other":"{{base}} has {{count}} new commits","worktree.rows.changes_one":"{{count}} uncommitted","worktree.rows.changes_other":"{{count}} uncommitted","worktree.rows.clean":"no changes","worktree.rows.current":"this tab","worktree.rows.deleteBranch":"Delete branch","worktree.rows.deleteBranchTitle":"Opens the plan to delete the branch, with git branch -d","worktree.rows.heading":"Separate branches","worktree.rows.headingTitle":"The other folders of this repository, each with its branch","worktree.rows.integrated":"merged","worktree.rows.kept":"folder removed","worktree.rows.keptTitle":"The app removed its folder and the branch is still in the repository: its conversations can be reopened from the sidebar","worktree.rows.main":"main folder","worktree.rows.mergeClean":"no conflicts","worktree.rows.mergeConflicts_one":"conflicts in {{count}} file: {{list}}","worktree.rows.mergeConflicts_other":"conflicts in {{count}} files: {{list}}","worktree.rows.notIntegrated_one":"{{count}} commit not merged","worktree.rows.notIntegrated_other":"{{count}} commits not merged","worktree.rows.open":"Open","worktree.rows.openTitle":"Go to its tab, or open one in that folder","worktree.rows.overlap":"{{branch}} touches it too: {{list}}","worktree.rows.remove":"Remove","worktree.rows.removeTitle":"Remove its folder; the branch stays unless it's already merged","worktree.sidebar.branchTitle":"Worked on the separate branch {{branch}}","worktree.sidebar.removed":"removed","worktree.sidebar.removedTitle":"This conversation worked on a separate branch whose folder was removed","worktree.sidebar.reopen":"Reopen the branch","worktree.sidebar.reopenTitle":"Reopen the branch: takes it out again in the same folder (if it was deleted, it's created again at the commit where it ended) and resumes this conversation","worktree.tab.linkedTitle":"Branch {{branch}}, apart from {{main}}","worktree.tab.mainTitle":"Branch {{branch}}, in the main folder","worktree.tab.review":"review","worktree.tab.reviewTitle":"Review tab: its CLI started read-only, if it has a way to"},gh=["en","es","de","fr","pt-BR","ru","ja","ko","zh-CN"],dg="en",uu={en:"English",es:"Español",de:"Deutsch",fr:"Français","pt-BR":"Português (Brasil)",ru:"Русский",ja:"日本語",ko:"한국어","zh-CN":"简体中文"},hb={en:"EN",es:"ES",de:"DE",fr:"FR","pt-BR":"PT",ru:"RU",ja:"JA",ko:"KO","zh-CN":"ZH"},vh={en:"en-US",es:"es-419",de:"de-DE",fr:"fr-FR","pt-BR":"pt-BR",ru:"ru-RU",ja:"ja-JP",ko:"ko-KR","zh-CN":"zh-CN"},db={es:()=>dr(()=>import("./es-CLg7TmrV.js"),[]),de:()=>dr(()=>import("./de-CDXh9n3d.js"),[]),fr:()=>dr(()=>import("./fr-Pnm-P-lG.js"),[]),"pt-BR":()=>dr(()=>import("./pt-BR-DPgHVjMQ.js"),[]),ru:()=>dr(()=>import("./ru-BfcWzg67.js"),[]),ja:()=>dr(()=>import("./ja-COKYooK_.js"),[]),ko:()=>dr(()=>import("./ko-CGAnMMHl.js"),[]),"zh-CN":()=>dr(()=>import("./zh-CN-Xcl7z1Nt.js"),[])},fg=ub,Uu=new Map([["en",fg]]),sp=new Map,$u=new Set;let So=dg,Wu=vh[dg],ip=0;function pg(t){return gh.includes(t)}function zu(){return So}function Ii(){return Wu}function fb(t){return vh[t]}function mg(t){return $u.add(t),()=>$u.delete(t)}async function gg(t,e=vh[t]){const s=++ip;if(!Uu.has(t)&&t!=="en"){const l=await db[t]();Uu.set(t,l.default)}if(s===ip&&!(So===t&&Wu===e)){So=t,Wu=e;for(const l of $u)l()}}function pb(t,e){let s=sp.get(t);return s===void 0&&(s=new Intl.PluralRules(t),sp.set(t,s)),s.select(e)}function op(t,e,s,l){if(l!==void 0){const u=t[`${s}_${pb(e,l)}`]??t[`${s}_other`];if(u!==void 0)return u}return t[s]}function mb(t,e,s,l){const u=l==null?void 0:l.count,k=typeof u=="number"?u:void 0;return(t===void 0?void 0:op(t,e,s,k))??op(fg,"en",s,k)??s}function na(t,e){return e===void 0?t:t.replace(/\{\{\s*([A-Za-z0-9_]+)\s*\}\}/g,(s,l)=>{const u=e[l];return u===void 0?s:String(u)})}function vg(t,e){return mb(Uu.get(So),So,t,e)}function _(t,e){return na(vg(t,e),e)}function gb(){return[{keys:"Esc",description:_("agent.shortcuts.codex.interruptTurn")},{keys:"Esc Esc",description:_("agent.shortcuts.codex.editPrevious")},{keys:"Ctrl + C",description:_("agent.shortcuts.codex.interruptOrExit")},{keys:"Alt + , / Alt + .",description:_("agent.shortcuts.codex.effort")},{keys:"Shift + Tab",description:_("agent.shortcuts.codex.cycleMode")},{keys:"Tab",description:_("agent.shortcuts.codex.queue")},{keys:"Ctrl + T",description:_("agent.shortcuts.codex.transcript")},{keys:"Ctrl + R",description:_("agent.shortcuts.codex.searchHistory")},{keys:"@",description:_("agent.shortcuts.codex.mention")},{keys:"/",description:_("agent.shortcuts.commands")},{keys:"Ctrl + G",description:_("agent.shortcuts.codex.externalEditor")}]}function vb(){return[{keys:"Esc Esc",description:_("agent.shortcuts.opencode.interrupt")},{keys:"Tab / Shift + Tab",description:_("agent.shortcuts.opencode.cycleAgent")},{keys:"Ctrl + P",description:_("agent.shortcuts.opencode.commandList")},{keys:_("agent.shortcuts.leaderThen",{key:"M"}),description:_("agent.shortcuts.opencode.model")},{keys:_("agent.shortcuts.leaderThen",{key:"N"}),description:_("agent.shortcuts.opencode.newSession")},{keys:"Ctrl + J",description:_("agent.shortcuts.opencode.newline")},{keys:"Ctrl + C",description:_("agent.shortcuts.opencode.clearInput")},{keys:"Ctrl + V",description:_("agent.shortcuts.opencode.paste")}]}function _b(){return[{keys:"Esc",description:_("agent.shortcuts.antigravity.interrupt")},{keys:"Shift + Tab",description:_("agent.shortcuts.antigravity.cycleMode")},{keys:"1 … 4",description:_("agent.shortcuts.antigravity.answerPermission")},{keys:"/",description:_("agent.shortcuts.commands")},{keys:"?",description:_("agent.shortcuts.antigravity.help")}]}function wb(){return[{keys:"Esc",description:_("agent.shortcuts.interruptCli")},{keys:"Esc Esc",description:_("agent.shortcuts.pi.tree")},{keys:"Ctrl + C",description:_("agent.shortcuts.pi.clearOrExit")},{keys:"Shift + Tab",description:_("agent.shortcuts.pi.cycleThinking")},{keys:"Ctrl + L",description:_("agent.shortcuts.pi.model")},{keys:"Ctrl + P",description:_("agent.shortcuts.pi.nextModel")},{keys:"Ctrl + O",description:_("agent.shortcuts.pi.toolOutput")},{keys:"Ctrl + J",description:_("agent.shortcuts.pi.newline")},{keys:"!",description:_("agent.shortcuts.pi.bash")},{keys:"/",description:_("agent.shortcuts.commands")}]}function yb(){return[{keys:"Esc",description:_("agent.shortcuts.interruptCli")},{keys:"Esc Esc",description:_("agent.shortcuts.claudeCode.rewind")},{keys:"Ctrl + C",description:_("agent.shortcuts.claudeCode.cancel")},{keys:"Ctrl + R",description:_("agent.shortcuts.claudeCode.searchHistory")},{keys:"Ctrl + O",description:_("agent.shortcuts.claudeCode.fullOutput")},{keys:"Shift + Tab",description:_("agent.shortcuts.claudeCode.cycleMode")},{keys:"Alt + V",description:_("agent.shortcuts.claudeCode.pasteImage")},{keys:"Ctrl + V",description:_("agent.shortcuts.claudeCode.pasteText")}]}const fs={"claude-code":{shortLabel:"CC",get shortcuts(){return yb()},shortcutsNote:null,instructionsFile:"CLAUDE.md",savesModelChoice:!1,compactCommand:"/compact"},codex:{shortLabel:"CX",get shortcuts(){return gb()},get shortcutsNote(){return _("agent.shortcuts.codex.note")},instructionsFile:"AGENTS.md",savesModelChoice:!1,compactCommand:"/compact"},opencode:{shortLabel:"OC",get shortcuts(){return vb()},get shortcutsNote(){return _("agent.shortcuts.opencode.note")},instructionsFile:"AGENTS.md",savesModelChoice:!1,compactCommand:"/compact"},antigravity:{shortLabel:"AG",get shortcuts(){return _b()},shortcutsNote:null,instructionsFile:"AGENTS.md",savesModelChoice:!0,compactCommand:"/compact"},pi:{shortLabel:"PI",get shortcuts(){return wb()},shortcutsNote:null,instructionsFile:"AGENTS.md",savesModelChoice:!1,effortCommand:"/thinking",compactCommand:"/compact"}};function bb(t){return(t===null?void 0:fs[t].effortCommand)??fh}function kb(t){return t===null?null:fs[t].compactCommand}const Cb={"gemini-cli":"GC","antigravity-ide":"AI"};function Sb(t){return Ai(t)?fs[t].shortLabel:Cb[t]}function Mo(t,e){var s;return Ai(t)?((s=e.find(l=>l.id===t))==null?void 0:s.label)??t:_w[t]}const _g="Sesion sin titulo";function fr(t,e){return e==="none"||t===_g?_("session.untitled"):t}function xb(t,e){const s=new Map;for(const u of e)u.titleSource==="none"||u.title===_g||s.set(`${u.agent}\0${u.sessionId}`,u.title);const l=new Map;for(const u of t){if(u.agent===null||u.sessionId.length===0)continue;const k=s.get(`${u.agent}\0${u.sessionId}`);k!==void 0&&l.set(u.terminalId,k)}return l}function ra(t){return t.storage==="native"&&Ai(t.agent)}function Eb(t){return t!==null&&fs[t].savesModelChoice}function Tb(t,e,s){if(e!=null)return e;for(let l=t.length-1;l>=0;l-=1){const u=t[l];if(!(u===void 0||u.effort===null))return s===null||u.at>=s?u.effort:null}return null}function Lb(t){return t===null?null:fs[t].instructionsFile}function Nb(t,e=!1){const s=t.permissionCycle,l=xw(t,e);return{modeCycle:s===null||l===null||l===s.launchMode?s:{...s,launchMode:l},models:t.models,efforts:t.efforts,imagesAllowed:t.imagesByPath!==null,rewind:t.rewind,questionsAnswerable:t.questionCards,fileMentions:t.fileMentions!==null,plansAvailable:t.plans,contextWindowSource:t.contextWindowSource,noteSendable:t.readySignal,forceSend:t.forceSend,editQueue:t.editQueue}}function Rb(t,e){const s=W0(e,t);return s===null?null:t.find(l=>l.value===s.value)??null}function Mb(t,e){return t??e.launchMode}const Ab={auto:"mode.auto.label",default:"mode.default.label",acceptEdits:"mode.acceptEdits.label",plan:"mode.plan.label"},Ib={auto:"mode.auto.hint",default:"mode.default.hint",acceptEdits:"mode.acceptEdits.hint",plan:"mode.plan.hint"};function wg(t){return _(Ab[t])}function jb(t){return _(Ib[t])}function Db(t,e){return _("agent.mode.title",{mode:wg(t),hint:jb(t),key:e.keyLabel})}function yg(t,e){return t.approvesPendingOnCycle&&e!==null}function Pb(t,e,s,l){if(yg(e,l))return _("agent.mode.blocked");const u=Db(t,e);return!e.approvesPendingOnCycle||s?u:_("agent.mode.titleBlind",{title:u})}const Ob={active:"agent.statusLine.state.active",missing:"agent.statusLine.state.missing","other-command":"agent.statusLine.state.otherCommand",disabled:"agent.statusLine.state.disabled",unreadable:"agent.statusLine.state.unreadable"};function Bb(t){return _(Ob[t])}function Fb(){return _("agent.statusLine.noFragment")}function Hb(t,e,s=new Set){return t.filter(l=>(e||l.id!=="plans")&&(l.id==="cli"||!s.has(l.id)))}function Ub(t,e,s=new Set){return t==="plans"&&!e||t!=="cli"&&s.has(t)?"cli":t}function $b(t,e,s){const l=u=>u===null?void 0:e.find(k=>k.id===u);return l(t)??l(s)??e[0]??null}function Wb(t){return[{keys:"Enter",description:_("agent.shortcuts.composer.send")},{keys:"Shift + Enter",description:_("agent.shortcuts.composer.newline")},{keys:"Ctrl + V",description:_(t?"agent.shortcuts.composer.pasteWithImages":"agent.shortcuts.composer.pasteText")},{keys:"Esc",description:_("agent.shortcuts.interruptCli")}]}function zb(){return _("agent.composer.imagesRefused")}function qb(t,e,s){return e.compacted===!0&&e.contextWindow!==null&&e.contextWindowEstimated!==!0?e.contextWindow:s??(t==="token-count"||t==="status-line"?e.contextWindow:null)}function Vb(t,e){return e.compacted===!0?!1:t==="status-line"?e.lastRequestTokens>0:e.assistantMessages>0}function Kb(t,e){return t===null&&e!==null&&e.state!=="active"}function Gb(t){return _(t==="other-command"?"agent.meter.setup.otherCommand":t==="disabled"?"agent.meter.setup.disabled":t==="unreadable"?"agent.meter.setup.unreadable":"agent.meter.setup.missing")}function Yb(t,e){return e.contextWindowEstimated?_("agent.meter.origin.estimated"):t==="usage-with-catalog"&&e.contextWindow!==null?_("agent.meter.origin.catalog"):null}function Xb(t,e=null,s=!1){return s?_("agent.meter.idle.compacted"):e==="status-line"?_("agent.meter.idle.statusLine"):t===null?_("agent.meter.idle.noFile"):_("agent.meter.idle.withFile",{file:t})}function Qb(t,e=null){return t==="idle"?_("agent.dot.idle"):t==="unknown"?e===null?_("agent.dot.noStatus"):e.state==="active"?_("agent.dot.statusLinePending"):_("agent.dot.statusLineOnly"):_("agent.dot.open")}function lp(t,e){return t.length===0?!0:t.some(s=>s.id===e&&s.available&&s.capabilities.resume)}function Jb(t,e,s){return t?s?_("agent.note.empty"):_("agent.note.send",{cwd:e??""}):_(e===null?"agent.note.needsTab":"agent.note.noReadySignal")}function bg(t,e,s){const l=pr(e,s);let u=null;for(const k of t)k.kind!=="agent"||k.agent===null||pr(k.cwd,s)===l&&(u=k.agent);return u}function kg(t,e){var l;const s=e.filter(u=>u.available);for(const u of t)if(u!==null&&s.some(k=>k.id===u))return u;return((l=s[0])==null?void 0:l.id)??null}function Zb(t){let e=null;for(const s of t){const l=s.agent;Ai(l)&&(e===null||s.updatedAt>e.updatedAt)&&(e={agent:l,updatedAt:s.updatedAt})}return(e==null?void 0:e.agent)??null}function ek(t,e,s,l,u){return kg([bg(t,e,s),u],l)}function ap(t,e,s,l,u){return kg([bg(t,e.cwd,s),Zb(e.sessions),u],l)}function qu(t){return t.filter(e=>e.available)}function tk(t,e){const s=t.findIndex(l=>l.id===e);return s===-1?0:s}function nk(t,e,s){return s<=0?0:((t+e)%s+s)%s}function rk(t,e,s,l=4){const u=t.bottom+2,k=t.top-2-e.height,y=u+e.height+l<=s.height||k<l?Math.max(l,Math.min(u,s.height-e.height-l)):k;return{left:Math.max(l,Math.min(t.left,s.width-e.width-l)),top:y}}function sk(t,e,s){const l=t;return l===null||typeof l!="object"||typeof l.contains!="function"?!0:s!==null&&s.contains(t)?!1:l.contains(e)}function Cg(t,e,s=!1,l=!1){return e===null||s?[]:l?qu(t):uh(t)?qu(t).filter(u=>u.id!==e):[]}function _h(t=!1){return _(t?"agent.continue.titleMain":"agent.continue.title")}function ik(t,e,s){return e?_("agent.continue.discovering"):t.length===0?_("agent.continue.noConversation"):s?null:_("agent.continue.noMessages")}function ok(t,e,s,l){const u=e>=s&&!l?s===1?_("agent.handoff.turns.single"):_("agent.handoff.turns.all",{count:s}):e===1?l?_("agent.handoff.turns.lastOneOfMore",{total:s}):_("agent.handoff.turns.lastOne",{total:s}):l?_("agent.handoff.turns.lastManyOfMore",{count:s,included:e}):_("agent.handoff.turns.lastMany",{count:s,included:e});return _("agent.handoff.notice",{label:t,turns:u})}const cp=40;function up(t){const e=t.replace(/\s+/g," ").trim(),s=[...e],l=s.length>cp?`${s.slice(0,cp).join("").trimEnd()}…`:e;return l.length>0?_("agent.handoff.tabLabel",{title:l}):_("agent.handoff.tabLabelNoTitle")}function lk(){return _("agent.handoff.sending")}function ak(t){return t===null?_("agent.queueReturned.noLabel"):_("agent.queueReturned.withLabel",{label:t})}function ck(){return _("agent.stoppedEarly")}function uk(t){switch(t){case"no-delivery":return _("agent.handoff.prefill.noDelivery");case"not-ready":return _("agent.handoff.prefill.notReady");case"send-failed":return _("agent.handoff.prefill.sendFailed")}}function Sg(t,e){return t.trim().length===0?e:`${e}
|
|
42
|
+
|
|
43
|
+
${t}`}function hk(t,e){return t&&e!==null}function dk(t,e,s){if(!Ai(t))return{badge:!0,unavailableTitle:null};const l=e.find(y=>y.id===t),u=e.some(y=>y.available),k=l!==void 0&&!l.available&&u;return{badge:s||k,unavailableTitle:k?_("agent.session.cliMissing",{label:l.label}):null}}function fk(t,e,s){return t!==null&&e===""&&!s.sessionIdAtLaunch}function pk(){return _("agent.thread.noTranscript")}function mk(){return _("agent.thread.discovering")}function gk(t,e,s,l,u=null){return!l||!qm(t,u)||!e?null:s===null?_("agent.openTool.noLabel"):_("agent.openTool.withLabel",{label:s})}function xg(t,e=!1){return _(t==="permission prompt"?"agent.waiting.permission":t==="question"&&e?"agent.waiting.question":"agent.waiting.answer")}function vk(t){return t.relaunching?"relaunching":t.offlineReason==="server-closed"&&t.alive?"offer":null}function _k(t){return t===null?_("agent.serverClosed.noLabel"):_("agent.serverClosed.withLabel",{label:t})}function wk(){return _("agent.serverClosed.relaunch")}function yk(){return _("agent.serverClosed.relaunching")}function bk(t,e){const s=new Map,l=[];for(const[u,k]of t){const y=e.find(i=>i.terminalId===u);y===void 0||y.alive&&k==="exited"?l.push(u):s.set(u,y.alive?k:"exited")}return{phases:s,finished:l}}function kk(t,e,s){var l;return!s||e===null||((l=t.permissionCycle)==null?void 0:l.approvesPendingOnCycle)!==!0&&!t.waitingBlocksSubmit?null:xg(e,t.questionCards)}const hp=2e4;function Ck(t){if(t.label.length>0)return t.label;const e=t.cwd.split(/[\\/]/).filter(s=>s.length>0);return e[e.length-1]??t.cwd}function Sk(t,e,s){const l=t.map(k=>({terminalId:k.terminalId,kind:k.kind,cwd:k.cwd,worktree:k.worktree??null})),u=[];for(const k of e){const y=nb(l.map(i=>i.terminalId),i=>l.find(c=>c.terminalId===i),{kind:"agent",cwd:k.cwd},s);u.push({pending:k,index:y,label:Ck(k)}),l.splice(y,0,{terminalId:`pending:${k.requestId}`,kind:"agent",cwd:k.cwd})}return u}function dp(t,e,s){const l=pr(e,s);return t.some(u=>pr(u.cwd,s)===l)}function Eg(){return _("agent.openBlocked")}const xk={off:"controls.effort.off",minimal:"controls.effort.minimal",low:"controls.effort.low",medium:"controls.effort.medium",high:"controls.effort.high",xhigh:"controls.effort.xhigh",max:"controls.effort.max"};function Ek(t){const e=xk[t.value];return e===void 0?t.label:_(e)}function Tk(t){return t.value==="default"?_("controls.model.default"):$0(t)}function Lk({models:t,efforts:e,model:s,effort:l,modelProvisional:u=!1,effortProvisional:k=!1,savesChoice:y=!1,effortCommandName:i=fh,disabled:c,onCommand:m}){const v=t===null?null:Rb(t,s),h=v===null&&s!==null;return o.jsxs(o.Fragment,{children:[t!==null&&o.jsxs("select",{className:"agent-select",value:(v==null?void 0:v.value)??"",disabled:c,onChange:b=>{b.target.value.length>0&&m(q0(b.target.value))},title:s===null?_("controls.model.noData"):u?_("controls.model.provisional",{model:s}):y?_("controls.model.inUseSaved",{model:s}):_("controls.model.inUse",{model:s}),children:[v===null&&o.jsx("option",{value:"",children:h?s??"":_("controls.model.placeholder")}),t.map(b=>o.jsx("option",{value:b.value,children:Tk(b)},b.value))]}),e!==null&&o.jsxs("select",{className:"agent-select",value:l??"",disabled:c,onChange:b=>{b.target.value.length>0&&m(V0(b.target.value,i))},title:l===null?_("controls.effort.noData"):k?_("controls.effort.provisional",{effort:l}):y?_("controls.effort.inUseSaved",{effort:l,command:i}):_("controls.effort.inUse",{effort:l,command:i}),children:[l===null&&o.jsx("option",{value:"",children:_("controls.effort.placeholder")}),e.map(b=>o.jsx("option",{value:b.value,children:Ek(b)},b.value))]})]})}function Nk({mode:t,cycle:e,disabled:s,waitingFor:l=null,statusKnown:u=!0,onChange:k}){const y=Mb(t,e);return o.jsx("select",{className:"agent-select agent-select-mode",value:y,disabled:s||yg(e,l),onChange:i=>{Hs(i.target.value)&&k(i.target.value)},title:Pb(y,e,u,l),children:e.modes.map(i=>o.jsx("option",{value:i,children:wg(i)},i))})}function xo(t){const e=t.replace(/(\r?\n)+$/,"");return e.length===0?0:e.split(`
|
|
44
|
+
`).length}function Rk(t,e){return e===0?_("composer.chip.pastedTextEmpty",{number:t}):_("composer.chip.pastedText",{number:t,count:e})}function Tg(t){return t.length===0?1:Math.max(...t)+1}function Lg(t){const e=new Set;for(const s of t.matchAll(lb()))e.add(Number(s[1]));return[...e].sort((s,l)=>s-l)}const Mk=/[^\s([{"'¿¡«]/u,Ak=/[\p{L}\p{N}]/u;function Ik(t,e,s,l){const{start:u,end:k,before:y,after:i}=Ng(t,e,s),c=`${y!==""&&Mk.test(y)?" ":""}${mh(l)}${i!==""&&Ak.test(i)?" ":""}`;return Rg(t,u,k,c)}const jk=/[^\s([{¿¡«]/u,Dk=/[\p{L}\p{N}"'«]/u;function fp(t,e,s,l){const{start:u,end:k,before:y,after:i}=Ng(t,e,s),c=y!==""&&jk.test(y),m=i===""||Dk.test(i),v=`${c?" ":""}${l}${m?" ":""}`;return Rg(t,u,k,v)}function Ng(t,e,s){const l=Math.max(0,Math.min(e,t.length)),u=Math.max(l,Math.min(s,t.length));return{start:l,end:u,before:l>0?t.charAt(l-1):"",after:u<t.length?t.charAt(u):""}}function Rg(t,e,s,l){return{text:`${t.slice(0,e)}${l}${t.slice(s)}`,inserted:l,caret:e+l.length}}function Mg(t,e){const s=new RegExp(`( ?)${Bk(mh(e))}( ?)`,"g");return t.replace(s,(l,u,k)=>u!==""&&k!==""?" ":"")}function Pk(t,e){let s=e;const l=[];for(const u of t){const k=u.text.replace(/\r\n?/g,`
|
|
45
|
+
`).replace(/\n+$/,"");if(k.trim().length===0){s=Mg(s,u.number);continue}l.push(`${rb(u.number)}
|
|
46
|
+
${k}
|
|
47
|
+
${sb(u.number)}`)}return s.trim().length>0&&l.push(s),l.join(`
|
|
48
|
+
|
|
49
|
+
`)}function Ok(t,e=!1){const s=t.replace(/\r\n?/g,`
|
|
50
|
+
`),l=[],u=c=>{const m=c.replace(/^\n+|\n+$/g,"");m.trim().length>0&&l.push({kind:"text",text:m})};let k=0;for(const c of s.matchAll(ib())){const m=c[1]??"",v=(c.index??0)+m.length;u(s.slice(k,v)),l.push({kind:"pasted",number:Number(c[2]),text:c[3]??"",complete:!0}),k=(c.index??0)+c[0].length}const y=s.slice(k),i=e?ob().exec(y):null;if(i!==null){const c=i.index+(i[1]??"").length;u(y.slice(0,c)),l.push({kind:"pasted",number:Number(i[2]),text:y.slice(i.index+i[0].length),complete:!1})}else u(y);return l.some(c=>c.kind==="pasted")?l:[{kind:"text",text:t}]}function Bk(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const Fk=800;function sa(t){return{text:t.text,pasted:t.items.flatMap(e=>e.kind==="text"?[{number:e.number,text:e.text}]:[])}}function Hk(t,e){return{text:t.text,items:t.pasted.map(s=>({id:e(),kind:"text",number:s.number,text:s.text,lines:xo(s.text)}))}}function pp(t,e,s){const l=[...t.items.flatMap(i=>i.kind==="text"?[i.number]:[]),...Lg(t.text)],u=[];for(const i of e.pasted){const c=Tg([...l,...u.map(m=>m.kind==="text"?m.number:0)]);u.push({id:s(),kind:"text",number:c,text:i,lines:xo(i)})}const k=u.map(i=>i.kind==="text"?mh(i.number):"").join(" "),y=k.length===0?e.text:`${e.text}
|
|
51
|
+
|
|
52
|
+
${k}`;return{text:Sg(t.text,y),items:[...t.items,...u]}}function Uk(t,e){if(e===void 0)return{start:t,end:t,direction:"forward",scrollTop:"end"};const s=k=>Math.min(Math.max(0,k),t),l=s(e.selectionStart),u=Math.max(l,s(e.selectionEnd));return{start:l,end:u,direction:e.backward?"backward":"forward",scrollTop:Math.max(0,e.scrollTop)}}function $k(t){return ng(sa(t))>tg}function Ei(t,e){return t===void 0||oa(t)?oa(e):rg(t,e)}const mp={text:"",pasted:[]};function Wk(t,e,s){const l=Hk(t,s),u=((e==null?void 0:e.items)??[]).filter(k=>k.kind!=="text");return{text:l.text,items:[...l.items,...u]}}class zk{constructor(e){$t(this,"local",new Map);$t(this,"views",new Map);$t(this,"saved",new Map);$t(this,"heard",new Map);$t(this,"unconfirmed",new Map);$t(this,"submitting",new Map);$t(this,"pending",new Map);$t(this,"listeners",new Set);$t(this,"serverKeeps",!1);this.deps=e}get(e){return this.local.get(e)}put(e,s){this.local.set(e,s),this.schedule(e,sa(s))}rememberView(e,s){this.views.set(e,s)}viewOf(e){return this.views.get(e)}submitted(e,s){this.cancel(e),this.local.delete(e),this.views.delete(e),this.saved.delete(e),this.unconfirmed.delete(e),this.submitting.set(e,s?"sent":"queued")}restore(e){const s=!this.serverKeeps;this.serverKeeps=!0;const l=[];for(const{terminalId:u,draft:k}of e)this.receive(u,k,s)&&l.push(u);for(const u of l)for(const k of this.listeners)k(u);for(const[u,k]of[...this.pending])k.handle===null&&this.sendNow(u)}reconnected(){this.serverKeeps=!1;for(const[e,s]of[...this.submitting])s==="sent"?this.submitting.delete(e):this.submitting.set(e,"sent")}retain(e){const s=new Set(e);for(const l of new Set([...this.local.keys(),...this.views.keys(),...this.saved.keys(),...this.heard.keys(),...this.unconfirmed.keys(),...this.submitting.keys(),...this.pending.keys()]))s.has(l)||(this.cancel(l),this.local.delete(l),this.views.delete(l),this.saved.delete(l),this.heard.delete(l),this.unconfirmed.delete(l),this.submitting.delete(l))}flushAll(){for(const e of[...this.pending.keys()])this.sendNow(e)}onRestored(e){return this.listeners.add(e),()=>this.listeners.delete(e)}receive(e,s,l){const u=this.heard.get(e);if(this.heard.set(e,s),this.submitting.has(e)){if(!oa(s))return!1;this.submitting.delete(e)}const k=this.unconfirmed.get(e);if(k!==void 0)if(Ei(k,s))this.unconfirmed.delete(e);else if(l)if(Ei(u,s)){this.unconfirmed.delete(e),this.setSaved(e,s);const m=this.local.get(e);return m!==void 0&&this.schedule(e,sa(m)),!1}else this.unconfirmed.delete(e);else return!1;const y=this.local.get(e),i=y===void 0?mp:sa(y),c=Ei(this.saved.get(e),i);return this.setSaved(e,s),this.pending.has(e)||!c||Ei(s,i)?!1:(this.local.set(e,Wk(s,y,this.deps.newId)),this.views.delete(e),!0)}setSaved(e,s){oa(s)?this.saved.delete(e):this.saved.set(e,s)}schedule(e,s){const l=this.pending.get(e);if(l!==void 0&&rg(l.draft,s)||(this.cancel(e),Ei(this.saved.get(e),s)))return;const u=this.deps.setTimer(()=>this.sendNow(e),this.deps.delayMs??Fk);this.pending.set(e,{handle:u,draft:s})}cancel(e){const s=this.pending.get(e);s!==void 0&&(s.handle!==null&&this.deps.clearTimer(s.handle),this.pending.delete(e))}sendNow(e){const s=this.pending.get(e);if(s===void 0)return;if(s.handle!==null&&this.deps.clearTimer(s.handle),!this.serverKeeps||!this.deps.connected()){this.pending.set(e,{handle:null,draft:s.draft});return}this.pending.delete(e);const l=ng(s.draft)>tg?mp:s.draft;Ei(this.saved.get(e),l)||(this.deps.send(e,l),this.unconfirmed.set(e,l),this.setSaved(e,l))}}const Vu=1024,Ku=Vu*1024,gp=Ku*1024;function Li(t,e=0){return new Intl.NumberFormat(Ii(),{minimumFractionDigits:e,maximumFractionDigits:e,useGrouping:!1}).format(t)}function fn(t){return!Number.isFinite(t)||t<Vu?_("format.bytes.b",{value:Li(Math.max(0,Math.round(t)||0))}):t<Ku?_("format.bytes.kb",{value:Li(Math.round(t/Vu))}):t<gp?_("format.bytes.mb",{value:Li(t/Ku,1)}):_("format.bytes.gb",{value:Li(t/gp,2)})}function Ag(t){const e=Math.floor(t/60),s=t%60;return s===0?_("format.duration.minutes",{value:e}):_("format.duration.minutesSeconds",{minutes:e,seconds:s})}function qk(t){if(t<1e3)return _("format.duration.ms",{value:t});const e=Math.round(t/1e3);return e<60?_("format.duration.seconds",{value:e}):Ag(e)}function Eo(t){if(!Number.isFinite(t)||t<1e3)return _("format.duration.underSecond");const e=Math.round(t/1e3);return e<60?_("format.duration.seconds",{value:e}):Ag(e)}function Wn(t,e=Date.now()){if(t<=0)return"";const s=Math.floor((e-t)/6e4);if(s<1)return _("time.justNow");if(s<60)return _("time.minutesAgo",{count:s});const l=Math.floor(s/60);if(l<24)return _("time.hoursAgo",{count:l});const u=Math.floor(l/24);return u<30?_("time.daysAgo",{count:u}):wh(t)}function wh(t){return new Date(t).toLocaleDateString(Ii())}function Ri(t){return new Date(t).toLocaleTimeString(Ii(),{hour:"2-digit",minute:"2-digit"})}function Vk(t){return new Date(t).toLocaleString(Ii(),{weekday:"short",hour:"2-digit",minute:"2-digit"})}function Ig(t){const e=Math.floor(Math.max(0,t)/6e4);if(e<1)return _("format.timeLeft.underMinute");const s=Math.floor(e/1440),l=Math.floor(e%1440/60);return s>0?_("format.timeLeft.daysHours",{days:s,hours:l}):l>0?_("format.timeLeft.hoursMinutes",{hours:l,minutes:e%60}):_("format.timeLeft.minutes",{minutes:e})}function Kk(t){return new Intl.NumberFormat(Ii(),{style:"percent",maximumFractionDigits:0}).format(t/100)}function pn(t){return new Intl.ListFormat(Ii(),{type:"conjunction"}).format(t)}var jg=zm();function Dg({src:t,caption:e,onClose:s}){return M.useEffect(()=>{const l=u=>{u.key==="Escape"&&(u.preventDefault(),u.stopPropagation(),s())};return window.addEventListener("keydown",l,!0),()=>window.removeEventListener("keydown",l,!0)},[s]),jg.createPortal(o.jsxs("div",{className:"viewer",onClick:s,role:"presentation",children:[o.jsx("div",{className:"viewer-frame",onClick:l=>l.stopPropagation(),children:o.jsx("img",{className:"viewer-image",src:t,alt:e})}),o.jsxs("div",{className:"viewer-bar",children:[o.jsx("span",{className:"viewer-caption",children:e}),o.jsx("button",{className:"viewer-close",onClick:s,title:_("common.closeEsc"),children:"×"})]})]}),document.body)}const Gk=/^([ \t]*)(\d{1,3})([.)])([ \t]+)/,Yk=/^([ \t]*)([a-zA-Z])\)([ \t]+)/,Xk=/^([ \t]*)([-*•])([ \t]+)/;function vp(t){const e=Gk.exec(t);if(e!==null){const[u,k="",y="",i=".",c=" "]=e;return{kind:"number",indent:k,value:Number(y),upper:!1,sep:i,space:c,length:u.length}}const s=Yk.exec(t);if(s!==null){const[u,k="",y="a",i=" "]=s;return{kind:"letter",indent:k,value:y.toLowerCase().charCodeAt(0)-97,upper:y!==y.toLowerCase(),sep:")",space:i,length:u.length}}const l=Xk.exec(t);if(l!==null){const[u,k="",y="-",i=" "]=l;return{kind:"bullet",indent:k,value:0,upper:!1,sep:y,space:i,length:u.length}}return null}function _p(t,e){if(t.kind==="bullet")return`${t.indent}${t.sep}${t.space}`;if(t.kind==="number")return`${t.indent}${e}${t.sep}${t.space}`;if(e>25)return null;const s=String.fromCharCode(97+e);return`${t.indent}${t.upper?s.toUpperCase():s}${t.sep}${t.space}`}function Qk(t,e){return t.kind===e.kind&&t.indent===e.indent&&t.sep===e.sep&&t.upper===e.upper}function Jk(t,e,s){if(e!==s)return null;const l=t.lastIndexOf(`
|
|
53
|
+
`,e-1)+1,u=t.indexOf(`
|
|
54
|
+
`,e),k=u===-1?t.length:u,y=t.slice(l,k),i=vp(y);if(i===null||e-l<i.length)return null;if(y.slice(i.length).trim().length===0)return{from:l,to:k,text:"",caret:l};const c=_p(i,i.value+1);if(c===null)return null;let m="",v=k;if(i.kind!=="bullet"){let h=i.value+1;for(;v<t.length;){const b=v+1,T=t.indexOf(`
|
|
55
|
+
`,b),N=T===-1?t.length:T,w=t.slice(b,N),d=vp(w);if(d===null||!Qk(i,d)||d.value!==h)break;const g=_p(d,d.value+1);if(g===null)break;m+=`
|
|
56
|
+
${g}${w.slice(d.length)}`,h+=1,v=N}}return{from:e,to:v,text:`
|
|
57
|
+
${c}${t.slice(e,k)}${m}`,caret:e+1+c.length}}const Zk=768,eC=`(max-width: ${Zk}px)`,tC="(hover: none)",wp="agent-workbench.narrow-view",Pg="tab",Og=["chat","cli","git","files","plans","memory","notes","console"];function nC(t){return typeof t=="string"&&Og.includes(t)}function rC(t){return nC(t)?t:null}function sC(t){const e=t.hidden??new Set,s=l=>l==="chat"||l==="cli"||!e.has(l);return t.hasTab?Og.filter(l=>(l!=="plans"||t.plansAvailable)&&s(l)):["chat","notes"].filter(s)}function iC(t,e){return e.includes(t)?t:"chat"}function yp(t){switch(t){case"cli":case"git":case"files":case"plans":case"memory":return t;default:return null}}const oC={chat:"narrow.view.chat",cli:"panel.tab.cli",git:"panel.tab.git",files:"panel.tab.files",plans:"panel.tab.plans",memory:"panel.tab.memory",notes:"notes.name",console:"console.name"};function lC(t){return oC[t]}const aC=/^[A-Za-z0-9_-]{1,80}$/;function cC(t){const e=new URLSearchParams(t).get(Pg);return e!==null&&aC.test(e)?e:null}function uC(t,e){const s=new URLSearchParams(t);for(const u of e)s.delete(u);const l=s.toString();return l.length>0?`?${l}`:""}const hC=[{id:"esc",label:"Esc",data:"\x1B",titleKey:"narrow.keys.esc"},{id:"tab",label:"Tab",data:" ",titleKey:"narrow.keys.tab"},{id:"shift-tab",label:"⇧Tab",data:"\x1B[Z",titleKey:"narrow.keys.shiftTab"},{id:"up",label:"↑",data:"\x1B[A",titleKey:"narrow.keys.up"},{id:"down",label:"↓",data:"\x1B[B",titleKey:"narrow.keys.down"},{id:"left",label:"←",data:"\x1B[D",titleKey:"narrow.keys.left"},{id:"right",label:"→",data:"\x1B[C",titleKey:"narrow.keys.right"},{id:"interrupt",label:"^C",data:"",titleKey:"narrow.keys.interrupt"},{id:"ctrl-o",label:"^O",data:"",titleKey:"narrow.keys.ctrlO"},{id:"ctrl-x",label:"^X",data:"",titleKey:"narrow.keys.ctrlX"}];function dC(t,e){return t.shiftKey||t.altKey?!1:!e||t.ctrlKey||t.metaKey}const fC="AgentWorkbenchAndroid/",pC="agentworkbench://settings",mC="agentworkbench://disconnect",bp="agentWorkbenchBack";function Bg(t){return t.includes(fC)}function gC(t){return t.dialogOpen?"close-dialog":t.sheetOpen?"close-sheet":t.drawerOpen?"close-drawer":t.view!=="chat"?"show-chat":null}const vC=6e4,_C=10*6e4,wC=15e3,yC=4e3,bC=3,Fg={runStartedAt:null,busySeenAt:null};function kC(){return`submit-${typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}`}function CC(t,e){var l;let s=0;if(t!==null){const u=e.findIndex(k=>k.eventId===t);if(u===-1)return!0;s=u+1}for(let u=s;u<e.length;u+=1)if(((l=e[u])==null?void 0:l.role)==="assistant")return!0;return!1}function SC(t,e,s,l){const u=e==="busy"||t==="busy"?l:s.busySeenAt;let k=null;return e==="busy"?t==="idle"?k=l:(t==="busy"||t==="waiting")&&(k=s.runStartedAt):e==="waiting"&&(k=s.runStartedAt),{runStartedAt:k,busySeenAt:u}}function xC(t,e,s,l){const u=new Map;for(const[k,y]of e){const i=t.get(k),c=s.get(k);u.set(k,c!==void 0&&i===y?c:SC(i,y,c??Fg,l))}return u}function EC(t,e){const s=new Map;for(const[l,u]of t)u.phase!=="sending"?s.set(l,u):u.queued&&s.set(l,{...u,queued:!1,sentAt:e});return s}function TC(t,e,s){const l=t.get(e.terminalId);if(l===void 0||l.requestId!==e.requestId)return t;const u=new Map(t);return e.delivered?u.set(e.terminalId,{...l,phase:"delivered",queued:!1,deliveredAt:s}):u.delete(e.terminalId),u}function LC(t){if(!t.live||t.waitingFor!==null)return null;const{receipt:e,activity:s,now:l}=t,u=t.clock??Fg;if((e==null?void 0:e.phase)==="sending"&&(e.queued||l-e.sentAt<vC))return{kind:"sending"};const k=(e==null?void 0:e.phase)==="delivered"?e.deliveredAt:null;return s==="busy"?{kind:"working",since:u.runStartedAt,justDelivered:k!==null&&l-k<yC}:e===null||k===null||CC(e.afterEventId,t.events)?null:s==="unknown"?l-k<_C?{kind:"awaiting-reply",since:k}:null:s!=="idle"&&s!==null||u.busySeenAt!==null&&u.busySeenAt>=e.sentAt?null:l-k<wC?{kind:"delivered"}:null}function NC(t,e){switch(t.kind){case"sending":return _("thread.status.sending");case"delivered":return _("thread.status.delivered");case"working":{const s=t.since===null?0:e-t.since;if(s<1e3)return t.justDelivered?_("thread.status.workingDelivered"):_("thread.status.working");const l={elapsed:Eo(s)};return t.justDelivered?_("thread.status.workingForDelivered",l):_("thread.status.workingFor",l)}case"awaiting-reply":{const s=e-t.since;return s<1e3?_("thread.status.delivered"):_("thread.status.awaitingReply",{elapsed:Eo(s)})}}}function RC(t,e){const s=t.slice(0,bC).map(u=>_("thread.status.subagent",{name:u.description.length>0?u.description:_("thread.status.subagentUnnamed"),elapsed:Eo(Math.max(0,e-u.startedAt))})),l=t.length-s.length;return l>0&&s.push(_("thread.status.subagentsMore",{count:l})),_("thread.status.subagents",{count:t.length,list:pn(s)})}const MC=5,AC=1200;function hu(){return crypto.randomUUID()}function IC(t=!0){const[e,s]=M.useState([]),[l,u]=M.useState(null),k=M.useCallback(N=>{if(e.filter(d=>d.kind==="image").length>=lu){u(_("composer.problem.tooManyImages",{count:lu}));return}if(N.size>aa){const d=Math.round(N.size/1024/1024),g=aa/1024/1024;u(N.name.length>0?_("composer.problem.tooBig",{name:N.name,size:d,max:g}):_("composer.problem.imageTooBig",{size:d,max:g}));return}const w=new FileReader;w.onload=()=>{const d=w.result;if(typeof d!="string")return;const g=d.indexOf(",");g!==-1&&s(p=>p.filter(f=>f.kind==="image").length>=lu?p:[...p,{id:hu(),kind:"image",mediaType:N.type,base64:d.slice(g+1),dataUrl:d,bytes:N.size,name:N.name.length>0?N.name:_("composer.pastedImage")}])},w.onerror=()=>u(_("composer.problem.imageUnreadable")),w.readAsDataURL(N)},[e]),y=M.useCallback(N=>{if(e.filter(d=>d.kind==="file").length>=au){u(_("composer.problem.tooManyFiles",{count:au}));return}if(N.size===0){u(_("composer.problem.empty",{name:N.name}));return}if(N.size>Qf){u(_("composer.problem.tooBig",{name:N.name,size:Math.round(N.size/1024/1024),max:Qf/1024/1024}));return}const w=new FileReader;w.onload=()=>{const d=w.result;if(typeof d!="string")return;const g=d.indexOf(",");g!==-1&&s(p=>p.filter(f=>f.kind==="file").length>=au?p:[...p,{id:hu(),kind:"file",name:N.name.length>0?N.name:"archivo",base64:d.slice(g+1),bytes:N.size}])},w.onerror=()=>u(_("composer.problem.unreadable",{name:N.name})),w.readAsDataURL(N)},[e]),i=M.useCallback(N=>{const w=Array.from(N),d=w.filter(p=>p.type.startsWith("image/")),g=w.filter(p=>!p.type.startsWith("image/"));if(d.length>0&&!t)u(zb());else for(const p of d)k(p);for(const p of g)y(p)},[k,y,t]),c=M.useCallback((N,w=[])=>{if(N.files.length>0)return i(N.files),{consumed:!0,pastedNumber:null};const d=N.getData("text/plain");if(d.length===0)return{consumed:!1,pastedNumber:null};if(d.split(`
|
|
58
|
+
`).length<MC&&d.length<AC)return{consumed:!1,pastedNumber:null};const g=Tg([...e.flatMap(p=>p.kind==="text"?[p.number]:[]),...w]);return s(p=>[...p,{id:hu(),kind:"text",number:g,text:d,lines:xo(d)}]),{consumed:!0,pastedNumber:g}},[i,e]),m=M.useCallback(N=>{s(w=>w.filter(d=>d.id!==N))},[]),v=M.useCallback((N,w)=>{s(d=>d.map(g=>g.id===N&&g.kind==="text"?{...g,text:w,lines:xo(w)}:g))},[]),h=M.useCallback(N=>{s(N),u(null)},[]),b=M.useCallback(()=>h([]),[h]),T=M.useCallback(()=>u(null),[]);return{items:e,problem:l,acceptPaste:c,acceptFiles:i,remove:m,updateText:v,replace:h,clear:b,dismissProblem:T}}function ia({min:t,max:e,value:s,measure:l,onChange:u,onCommit:k,onStart:y}){const i=M.useRef(!1),c=M.useRef(s),m=M.useCallback(b=>{i.current=!0,c.current=s,y==null||y(b),b.currentTarget.setPointerCapture(b.pointerId),b.preventDefault()},[y,s]),v=M.useCallback(b=>{if(!i.current)return;const T=Math.min(e,Math.max(t,l(b)));c.current=T,u(T)},[e,t,l,u]),h=M.useCallback(b=>{i.current&&(i.current=!1,b.currentTarget.releasePointerCapture(b.pointerId),k(c.current))},[k]);return{onPointerDown:m,onPointerMove:v,onPointerUp:h,onPointerCancel:h}}function Hg(t){const[e,s]=M.useState(()=>typeof window<"u"&&window.matchMedia(t).matches);return M.useEffect(()=>{const l=window.matchMedia(t),u=()=>s(l.matches);return u(),l.addEventListener("change",u),()=>l.removeEventListener("change",u)},[t]),e}function jC(){return Hg(eC)}function DC(){return Hg(tC)}const Ug="agent_workbench_prefs",Gu="agent-workbench.",$g=/^[a-z0-9][a-z0-9.-]{0,59}$/,Wg=200,PC=400*24*60*60,OC=3500;function BC(t){const e=new Map;for(const s of t.split(";")){const l=s.indexOf("=");if(l===-1||s.slice(0,l).trim()!==Ug)continue;let u;try{u=JSON.parse(decodeURIComponent(s.slice(l+1).trim()))}catch{return e}if(u===null||typeof u!="object"||Array.isArray(u))return e;for(const[k,y]of Object.entries(u))!$g.test(k)||typeof y!="string"||y.length>Wg||e.set(`${Gu}${k}`,y);return e}return e}function FC(t){const e={};for(const[l,u]of t){if(!l.startsWith(Gu))continue;const k=l.slice(Gu.length);!$g.test(k)||u.length>Wg||(e[k]=u)}const s=encodeURIComponent(JSON.stringify(e));return s.length>OC?null:s}function HC(t){return`${Ug}=${t}; Path=/; Max-Age=${PC}; SameSite=Strict`}function zg(){try{return BC(document.cookie)}catch{return new Map}}function qg(t,e){const s=zg();if(s.get(t)===e)return;s.set(t,e);const l=FC(s);if(l!==null)try{document.cookie=HC(l)}catch{}}function Nt(t,e,s){const l=zg().get(t);if(l!==void 0){const u=s(l);if(u!==null)return u}try{const u=window.localStorage.getItem(t);if(u===null)return e;const k=s(u);return k===null?e:(l===void 0&&qg(t,u),k)}catch{return e}}function kt(t,e){qg(t,e);try{window.localStorage.setItem(t,e)}catch{}}function UC(t,e,s){const l=Number.parseInt(t,10);return Number.isFinite(l)&&l>=e&&l<=s?l:null}const kp=90,$C=260,Cp=720,Sp="agent-workbench.composer-height";function xp(t){return{selectionStart:t.selectionStart,selectionEnd:t.selectionEnd,backward:t.selectionDirection==="backward",scrollTop:t.scrollTop}}function WC({connection:t,drafts:e,terminalId:s,alive:l,sleeping:u=!1,projectColor:k,activity:y,controls:i,leading:c,imagesAllowed:m=!0,blockedReason:v=null,prefills:h,onPrefillApplied:b,notice:T=null,onDismissNotice:N,onSubmitted:w,fontSize:d,insertRef:g,onEditQueue:p}){const[f,E]=M.useState(""),[j,x]=M.useState(!1),R=IC(m),S=M.useRef(null),L=DC(),[I,P]=M.useState(()=>Nt(Sp,$C,se=>UC(se,kp,Cp))),[O,B]=M.useState(!1),$=M.useCallback(()=>{const se=S.current;if(se===null)return;se.style.height="auto";const fe=se.offsetHeight-se.clientHeight,Ce=se.scrollHeight+fe,ye=O?I:Math.min(Ce,I);se.style.height=`${ye}px`,se.style.overflowY=Ce>ye?"auto":"hidden"},[I,O]);M.useEffect($,[f,$,d]);const W=M.useRef(0),K=M.useRef(0),Y=ia({min:kp,max:Cp,value:I,measure:M.useCallback(se=>W.current-se.clientY-K.current,[]),onChange:P,onCommit:M.useCallback(se=>{B(!1),kt(Sp,String(se))},[]),onStart:M.useCallback(se=>{const fe=S.current,Ce=fe==null?void 0:fe.getBoundingClientRect();W.current=(Ce==null?void 0:Ce.bottom)??se.clientY,K.current=((Ce==null?void 0:Ce.bottom)??se.clientY)-se.clientY-((Ce==null?void 0:Ce.height)??0),B(!0)},[])}),V=M.useRef(null),[F,H]=M.useState(0),U=M.useCallback(()=>H(se=>se+1),[]),z=M.useRef(f);z.current=f;const te=M.useRef(R.items);te.current=R.items;const{replace:ie}=R;M.useEffect(()=>{const se=V.current;se!==null&&e.put(se,{text:f,items:R.items})},[f,R.items,e]),M.useEffect(()=>{var Ce;const se=V.current;if(se===s)return;if(V.current=s,se!==null){e.put(se,{text:z.current,items:te.current});const ye=S.current;ye!==null&&e.rememberView(se,xp(ye))}const fe=s===null?void 0:e.get(s);E((fe==null?void 0:fe.text)??""),ie((fe==null?void 0:fe.items)??[]),U(),s!==null&&((Ce=S.current)==null||Ce.focus())},[s,ie,e,U]),M.useEffect(()=>()=>{const se=V.current;se!==null&&e.put(se,{text:z.current,items:te.current})},[e]),M.useLayoutEffect(()=>()=>{const se=V.current,fe=S.current;se!==null&&fe!==null&&e.rememberView(se,xp(fe))},[e]),M.useEffect(()=>{if(F===0)return;const se=V.current,fe=S.current;if(se===null||fe===null)return;const Ce=Uk(fe.value.length,e.viewOf(se));fe.setSelectionRange(Ce.start,Ce.end,Ce.direction),fe.scrollTop=Ce.scrollTop==="end"?fe.scrollHeight:Ce.scrollTop},[F,e]),M.useEffect(()=>e.onRestored(se=>{if(se!==V.current)return;const fe=e.get(se);fe!==void 0&&(E(fe.text),ie(fe.items),U())}),[e,ie,U]);const we=M.useRef(new Set);M.useEffect(()=>{var se;if(!(h===void 0||h.length===0)){for(const fe of h)if(!we.current.has(fe.id)){if(we.current.add(fe.id),fe.terminalId===V.current&&fe.pasted.length===0)E(Ce=>Sg(Ce,fe.text)),fe.focus&&((se=S.current)==null||se.focus());else if(fe.terminalId===V.current){const Ce=pp({text:z.current,items:te.current},fe,()=>crypto.randomUUID());E(Ce.text),ie(Ce.items)}else{const Ce=e.get(fe.terminalId);e.put(fe.terminalId,pp({text:(Ce==null?void 0:Ce.text)??"",items:(Ce==null?void 0:Ce.items)??[]},fe,()=>crypto.randomUUID()))}b==null||b(fe.id)}}},[h,b,e,ie]);const ge=M.useCallback(()=>{if(s===null||v!==null)return;const se=R.items.filter(ue=>ue.kind==="text").map(ue=>({number:ue.number,text:ue.text})),fe=R.items.filter(ue=>ue.kind==="image").map(ue=>({mediaType:ue.mediaType,data:ue.base64})),Ce=R.items.filter(ue=>ue.kind==="file").map(ue=>({name:ue.name,data:ue.base64})),ye=Pk(se,f);if(ye.length===0&&fe.length===0&&Ce.length===0)return;const _e=kC(),Te=t.send({type:"agent.submit",terminalId:s,text:ye,images:fe,...Ce.length>0?{files:Ce}:{},requestId:_e});e.submitted(s,Te),E(""),R.clear(),w==null||w(s,_e,!Te)},[t,e,s,f,R,v,w]),X=M.useCallback(()=>{s!==null&&t.send({type:"agent.interrupt",terminalId:s})},[t,s]),G=M.useCallback((se,fe)=>{se.setSelectionRange(fe.from,fe.to);let Ce=!1;try{Ce=fe.text.length>0?document.execCommand("insertText",!1,fe.text):document.execCommand("delete")}catch{Ce=!1}Ce||(se.setRangeText(fe.text,fe.from,fe.to,"end"),E(se.value)),se.setSelectionRange(fe.caret,fe.caret)},[]),ee=M.useCallback(se=>{if(se.key==="Enter"&&dC(se,L)){se.preventDefault(),ge();return}if(se.key==="Enter"&&!se.nativeEvent.isComposing){const fe=se.currentTarget,Ce=Jk(fe.value,fe.selectionStart,fe.selectionEnd);if(Ce!==null){se.preventDefault(),G(fe,Ce);return}}if(se.key==="Escape"){se.preventDefault(),X();return}se.key==="ArrowUp"&&p!==void 0&&!se.shiftKey&&!se.altKey&&!se.ctrlKey&&!se.metaKey&&!se.nativeEvent.isComposing&&se.currentTarget.value.length===0&&R.items.length===0&&(se.preventDefault(),p())},[ge,X,L,G,p,R.items.length]),Z=M.useCallback((se,fe)=>{const{inserted:Ce}=Ik(se.value,se.selectionStart,se.selectionEnd,fe);let ye=!1;try{ye=document.execCommand("insertText",!1,Ce)}catch{ye=!1}ye||(se.setRangeText(Ce,se.selectionStart,se.selectionEnd,"end"),E(se.value))},[]),ve=M.useCallback((se,fe)=>{const Ce=S.current;if(Ce===null||Ce.disabled){E(Te=>fp(Te,Te.length,Te.length,se).text);return}const{inserted:ye}=fp(Ce.value,Ce.selectionStart,Ce.selectionEnd,se);let _e=!1;if(fe){Ce.focus();try{_e=document.execCommand("insertText",!1,ye)}catch{_e=!1}}_e||(Ce.setRangeText(ye,Ce.selectionStart,Ce.selectionEnd,"end"),E(Ce.value))},[]);M.useEffect(()=>{if(g!==void 0)return g.current=ve,()=>{g.current===ve&&(g.current=null)}},[g,ve]);const Se=M.useCallback(se=>{if(se.clipboardData===null)return;const fe=R.acceptPaste(se.clipboardData,Lg(se.currentTarget.value));fe.consumed&&(se.preventDefault(),fe.pastedNumber!==null&&Z(se.currentTarget,fe.pastedNumber))},[R,Z]),Ie=M.useCallback(se=>{R.remove(se.id),se.kind==="text"&&E(fe=>Mg(fe,se.number))},[R]),je=M.useRef(null),Je=s===null||!l,tt=f.trim().length>0||R.items.some(se=>se.kind!=="text"||se.text.trim().length>0),Ne=l&&y!=="idle",ce=tt||!Ne,dt=$k({text:f,items:R.items});return o.jsxs("div",{className:`composer${j?" composer-dragging":""}`,style:k===void 0?void 0:{"--composer-accent":k},onDragOver:se=>{Array.from(se.dataTransfer.types).includes("Files")&&(se.preventDefault(),x(!0))},onDragLeave:()=>x(!1),onDrop:se=>{se.preventDefault(),x(!1),R.acceptFiles(se.dataTransfer.files)},children:[o.jsx("div",{className:"hdivider composer-divider",...Y,title:_("composer.resizeTitle")}),T!==null&&o.jsxs("div",{className:"handoff-notice",role:"status",children:[o.jsxs("span",{className:"handoff-notice-text",children:[T.text,T.status!==null&&o.jsx("span",{className:"handoff-notice-status",children:T.status})]}),N!==void 0&&o.jsx("button",{className:"icon-button",onClick:N,title:_("common.dismissNotice"),children:"×"})]}),R.problem!==null&&o.jsxs("div",{className:"composer-problem",children:[o.jsx("span",{children:R.problem}),o.jsx("button",{className:"icon-button",onClick:R.dismissProblem,title:_("common.close"),children:"×"})]}),dt&&o.jsx("div",{className:"composer-problem",role:"status",children:o.jsx("span",{children:_("composer.problem.draftTooLong")})}),R.items.length>0&&o.jsx("div",{className:"composer-chips",children:R.items.map(se=>o.jsx(zC,{item:se,onRemove:()=>Ie(se),onEdit:fe=>R.updateText(se.id,fe),onDoneEditing:()=>{var fe;return(fe=S.current)==null?void 0:fe.focus()}},se.id))}),o.jsxs("div",{className:`composer-field${Ne&&ce?" composer-field-two":""}`,children:[o.jsx("textarea",{ref:S,className:"composer-input",value:f,rows:1,placeholder:_(Je?u?"composer.placeholder.sleeping":"composer.placeholder.ended":"composer.placeholder.ready"),disabled:Je,onChange:se=>E(se.target.value),onKeyDown:ee,onPaste:Se,spellCheck:!1}),o.jsxs("div",{className:"composer-field-actions",children:[Ne&&o.jsx("button",{className:"composer-icon composer-stop",onClick:X,disabled:Je,title:_("composer.stopTitle"),"aria-label":_("composer.stop"),children:o.jsx("svg",{viewBox:"0 0 24 24",width:"14",height:"14","aria-hidden":"true",children:o.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2",fill:"currentColor"})})}),ce&&o.jsx("button",{className:"composer-icon composer-send",onClick:ge,disabled:Je||!tt||v!==null,title:v??_("composer.sendTitle"),"aria-label":_("composer.send"),children:o.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16","aria-hidden":"true",children:o.jsx("path",{d:"M12 19V5M5.5 11.5 12 5l6.5 6.5",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]}),o.jsxs("div",{className:"composer-bar",children:[o.jsx("input",{ref:je,type:"file",multiple:!0,hidden:!0,onChange:se=>{se.target.files!==null&&R.acceptFiles(se.target.files),se.target.value=""}}),o.jsx("button",{className:"icon-button composer-attach",onClick:()=>{var se;return(se=je.current)==null?void 0:se.click()},disabled:Je,title:_("composer.attachTitle"),"aria-label":_("composer.attach"),children:o.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16","aria-hidden":"true",children:o.jsx("path",{d:"M21.4 11.1 12.3 20.2a6 6 0 0 1-8.5-8.5l9.2-9.2a4 4 0 0 1 5.7 5.7l-9.2 9.2a2 2 0 0 1-2.8-2.8l8.5-8.5",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),c,o.jsx("span",{className:"composer-spacer"}),i]})]})}function zC({item:t,onRemove:e,onEdit:s,onDoneEditing:l}){const[u,k]=M.useState(!1);if(t.kind==="image"){const y=`${t.name} · ${fn(t.bytes)}`;return o.jsxs("figure",{className:"chip chip-image",title:y,children:[o.jsx("img",{src:t.dataUrl,alt:t.name,onClick:()=>k(!0)}),o.jsx("button",{className:"chip-remove",onClick:e,title:_("composer.chip.remove"),children:"×"}),u&&o.jsx(Dg,{src:t.dataUrl,caption:y,onClose:()=>k(!1)})]})}return t.kind==="file"?o.jsxs("div",{className:"chip chip-text chip-file",title:`${t.name} · ${fn(t.bytes)}`,children:[o.jsxs("span",{className:"chip-toggle chip-file-label",children:[o.jsx("span",{className:"chip-icon",children:"▤"}),o.jsx("span",{className:"chip-file-name",children:t.name}),o.jsx("span",{className:"chip-file-size",children:fn(t.bytes)})]}),o.jsx("button",{className:"chip-remove",onClick:e,title:_("composer.chip.remove"),children:"×"})]}):o.jsxs("div",{className:`chip chip-text${u?" chip-open":""}`,children:[o.jsxs("button",{className:"chip-toggle",onClick:()=>k(y=>!y),title:_("composer.chip.editHint"),"aria-expanded":u,children:[o.jsx("span",{className:"chip-icon",children:"¶"}),Rk(t.number,t.lines),o.jsx("span",{className:"chip-chevron",children:u?"▾":"▸"})]}),o.jsx("button",{className:"chip-remove",onClick:e,title:_("composer.chip.remove"),children:"×"}),u&&o.jsx("textarea",{className:"chip-editor",value:t.text,onChange:y=>s(y.target.value),onKeyDown:y=>{y.key==="Escape"&&(y.preventDefault(),k(!1),l())},"aria-label":_("composer.chip.editorLabel",{number:t.number}),spellCheck:!1,autoFocus:!0})]})}var du={exports:{}},Ep;function qC(){return Ep||(Ep=1,(function(t,e){(function(s,l){t.exports=l()})(self,(()=>(()=>{var s={};return(()=>{var l=s;Object.defineProperty(l,"__esModule",{value:!0}),l.FitAddon=void 0,l.FitAddon=class{activate(u){this._terminal=u}dispose(){}fit(){const u=this.proposeDimensions();if(!u||!this._terminal||isNaN(u.cols)||isNaN(u.rows))return;const k=this._terminal._core;this._terminal.rows===u.rows&&this._terminal.cols===u.cols||(k._renderService.clear(),this._terminal.resize(u.cols,u.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const u=this._terminal._core,k=u._renderService.dimensions;if(k.css.cell.width===0||k.css.cell.height===0)return;const y=this._terminal.options.scrollback===0?0:u.viewport.scrollBarWidth,i=window.getComputedStyle(this._terminal.element.parentElement),c=parseInt(i.getPropertyValue("height")),m=Math.max(0,parseInt(i.getPropertyValue("width"))),v=window.getComputedStyle(this._terminal.element),h=c-(parseInt(v.getPropertyValue("padding-top"))+parseInt(v.getPropertyValue("padding-bottom"))),b=m-(parseInt(v.getPropertyValue("padding-right"))+parseInt(v.getPropertyValue("padding-left")))-y;return{cols:Math.max(2,Math.floor(b/k.css.cell.width)),rows:Math.max(1,Math.floor(h/k.css.cell.height))}}}})(),s})()))})(du)),du.exports}var VC=qC(),fu={exports:{}},Tp;function KC(){return Tp||(Tp=1,(function(t,e){(function(s,l){t.exports=l()})(self,(()=>(()=>{var s={6:(y,i)=>{function c(v){try{const h=new URL(v),b=h.password&&h.username?`${h.protocol}//${h.username}:${h.password}@${h.host}`:h.username?`${h.protocol}//${h.username}@${h.host}`:`${h.protocol}//${h.host}`;return v.toLocaleLowerCase().startsWith(b.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(i,"__esModule",{value:!0}),i.LinkComputer=i.WebLinkProvider=void 0,i.WebLinkProvider=class{constructor(v,h,b,T={}){this._terminal=v,this._regex=h,this._handler=b,this._options=T}provideLinks(v,h){const b=m.computeLink(v,this._regex,this._terminal,this._handler);h(this._addCallbacks(b))}_addCallbacks(v){return v.map((h=>(h.leave=this._options.leave,h.hover=(b,T)=>{if(this._options.hover){const{range:N}=h;this._options.hover(b,T,N)}},h)))}};class m{static computeLink(h,b,T,N){const w=new RegExp(b.source,(b.flags||"")+"g"),[d,g]=m._getWindowedLineStrings(h-1,T),p=d.join("");let f;const E=[];for(;f=w.exec(p);){const j=f[0];if(!c(j))continue;const[x,R]=m._mapStrIdx(T,g,0,f.index),[S,L]=m._mapStrIdx(T,x,R,j.length);if(x===-1||R===-1||S===-1||L===-1)continue;const I={start:{x:R+1,y:x+1},end:{x:L,y:S+1}};E.push({range:I,text:j,activate:N})}return E}static _getWindowedLineStrings(h,b){let T,N=h,w=h,d=0,g="";const p=[];if(T=b.buffer.active.getLine(h)){const f=T.translateToString(!0);if(T.isWrapped&&f[0]!==" "){for(d=0;(T=b.buffer.active.getLine(--N))&&d<2048&&(g=T.translateToString(!0),d+=g.length,p.push(g),T.isWrapped&&g.indexOf(" ")===-1););p.reverse()}for(p.push(f),d=0;(T=b.buffer.active.getLine(++w))&&T.isWrapped&&d<2048&&(g=T.translateToString(!0),d+=g.length,p.push(g),g.indexOf(" ")===-1););}return[p,N]}static _mapStrIdx(h,b,T,N){const w=h.buffer.active,d=w.getNullCell();let g=T;for(;N;){const p=w.getLine(b);if(!p)return[-1,-1];for(let f=g;f<p.length;++f){p.getCell(f,d);const E=d.getChars();if(d.getWidth()&&(N-=E.length||1,f===p.length-1&&E==="")){const j=w.getLine(b+1);j&&j.isWrapped&&(j.getCell(0,d),d.getWidth()===2&&(N+=1))}if(N<0)return[b,f]}b++,g=0}return[b,g]}}i.LinkComputer=m}},l={};function u(y){var i=l[y];if(i!==void 0)return i.exports;var c=l[y]={exports:{}};return s[y](c,c.exports,u),c.exports}var k={};return(()=>{var y=k;Object.defineProperty(y,"__esModule",{value:!0}),y.WebLinksAddon=void 0;const i=u(6),c=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function m(v,h){const b=window.open();if(b){try{b.opener=null}catch{}b.location.href=h}else console.warn("Opening link blocked as opener could not be cleared")}y.WebLinksAddon=class{constructor(v=m,h={}){this._handler=v,this._options=h}activate(v){this._terminal=v;const h=this._options,b=h.urlRegex||c;this._linkProvider=this._terminal.registerLinkProvider(new i.WebLinkProvider(this._terminal,b,this._handler,h))}dispose(){var v;(v=this._linkProvider)==null||v.dispose()}}})(),k})()))})(fu)),fu.exports}var GC=KC(),pu={exports:{}},Lp;function YC(){return Lp||(Lp=1,(function(t,e){(function(s,l){t.exports=l()})(self,(()=>(()=>{var s={965:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.GlyphRenderer=void 0;const m=c(374),v=c(509),h=c(855),b=c(859),T=c(381),N=11,w=N*Float32Array.BYTES_PER_ELEMENT;let d,g=0,p=0,f=0;class E extends b.Disposable{constructor(x,R,S,L){super(),this._terminal=x,this._gl=R,this._dimensions=S,this._optionsService=L,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};const I=this._gl;v.TextureAtlas.maxAtlasPages===void 0&&(v.TextureAtlas.maxAtlasPages=Math.min(32,(0,m.throwIfFalsy)(I.getParameter(I.MAX_TEXTURE_IMAGE_UNITS))),v.TextureAtlas.maxTextureSize=(0,m.throwIfFalsy)(I.getParameter(I.MAX_TEXTURE_SIZE))),this._program=(0,m.throwIfFalsy)((0,T.createProgram)(I,`#version 300 es
|
|
59
|
+
layout (location = 0) in vec2 a_unitquad;
|
|
60
|
+
layout (location = 1) in vec2 a_cellpos;
|
|
61
|
+
layout (location = 2) in vec2 a_offset;
|
|
62
|
+
layout (location = 3) in vec2 a_size;
|
|
63
|
+
layout (location = 4) in float a_texpage;
|
|
64
|
+
layout (location = 5) in vec2 a_texcoord;
|
|
65
|
+
layout (location = 6) in vec2 a_texsize;
|
|
66
|
+
|
|
67
|
+
uniform mat4 u_projection;
|
|
68
|
+
uniform vec2 u_resolution;
|
|
69
|
+
|
|
70
|
+
out vec2 v_texcoord;
|
|
71
|
+
flat out int v_texpage;
|
|
72
|
+
|
|
73
|
+
void main() {
|
|
74
|
+
vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
|
|
75
|
+
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
76
|
+
v_texpage = int(a_texpage);
|
|
77
|
+
v_texcoord = a_texcoord + a_unitquad * a_texsize;
|
|
78
|
+
}`,(function(K){let Y="";for(let V=1;V<K;V++)Y+=` else if (v_texpage == ${V}) { outColor = texture(u_texture[${V}], v_texcoord); }`;return`#version 300 es
|
|
79
|
+
precision lowp float;
|
|
80
|
+
|
|
81
|
+
in vec2 v_texcoord;
|
|
82
|
+
flat in int v_texpage;
|
|
83
|
+
|
|
84
|
+
uniform sampler2D u_texture[${K}];
|
|
85
|
+
|
|
86
|
+
out vec4 outColor;
|
|
87
|
+
|
|
88
|
+
void main() {
|
|
89
|
+
if (v_texpage == 0) {
|
|
90
|
+
outColor = texture(u_texture[0], v_texcoord);
|
|
91
|
+
} ${Y}
|
|
92
|
+
}`})(v.TextureAtlas.maxAtlasPages))),this.register((0,b.toDisposable)((()=>I.deleteProgram(this._program)))),this._projectionLocation=(0,m.throwIfFalsy)(I.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=(0,m.throwIfFalsy)(I.getUniformLocation(this._program,"u_resolution")),this._textureLocation=(0,m.throwIfFalsy)(I.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=I.createVertexArray(),I.bindVertexArray(this._vertexArrayObject);const P=new Float32Array([0,0,1,0,0,1,1,1]),O=I.createBuffer();this.register((0,b.toDisposable)((()=>I.deleteBuffer(O)))),I.bindBuffer(I.ARRAY_BUFFER,O),I.bufferData(I.ARRAY_BUFFER,P,I.STATIC_DRAW),I.enableVertexAttribArray(0),I.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);const B=new Uint8Array([0,1,2,3]),$=I.createBuffer();this.register((0,b.toDisposable)((()=>I.deleteBuffer($)))),I.bindBuffer(I.ELEMENT_ARRAY_BUFFER,$),I.bufferData(I.ELEMENT_ARRAY_BUFFER,B,I.STATIC_DRAW),this._attributesBuffer=(0,m.throwIfFalsy)(I.createBuffer()),this.register((0,b.toDisposable)((()=>I.deleteBuffer(this._attributesBuffer)))),I.bindBuffer(I.ARRAY_BUFFER,this._attributesBuffer),I.enableVertexAttribArray(2),I.vertexAttribPointer(2,2,I.FLOAT,!1,w,0),I.vertexAttribDivisor(2,1),I.enableVertexAttribArray(3),I.vertexAttribPointer(3,2,I.FLOAT,!1,w,2*Float32Array.BYTES_PER_ELEMENT),I.vertexAttribDivisor(3,1),I.enableVertexAttribArray(4),I.vertexAttribPointer(4,1,I.FLOAT,!1,w,4*Float32Array.BYTES_PER_ELEMENT),I.vertexAttribDivisor(4,1),I.enableVertexAttribArray(5),I.vertexAttribPointer(5,2,I.FLOAT,!1,w,5*Float32Array.BYTES_PER_ELEMENT),I.vertexAttribDivisor(5,1),I.enableVertexAttribArray(6),I.vertexAttribPointer(6,2,I.FLOAT,!1,w,7*Float32Array.BYTES_PER_ELEMENT),I.vertexAttribDivisor(6,1),I.enableVertexAttribArray(1),I.vertexAttribPointer(1,2,I.FLOAT,!1,w,9*Float32Array.BYTES_PER_ELEMENT),I.vertexAttribDivisor(1,1),I.useProgram(this._program);const W=new Int32Array(v.TextureAtlas.maxAtlasPages);for(let K=0;K<v.TextureAtlas.maxAtlasPages;K++)W[K]=K;I.uniform1iv(this._textureLocation,W),I.uniformMatrix4fv(this._projectionLocation,!1,T.PROJECTION_MATRIX),this._atlasTextures=[];for(let K=0;K<v.TextureAtlas.maxAtlasPages;K++){const Y=new T.GLTexture((0,m.throwIfFalsy)(I.createTexture()));this.register((0,b.toDisposable)((()=>I.deleteTexture(Y.texture)))),I.activeTexture(I.TEXTURE0+K),I.bindTexture(I.TEXTURE_2D,Y.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[K]=Y}I.enable(I.BLEND),I.blendFunc(I.SRC_ALPHA,I.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return!this._atlas||this._atlas.beginFrame()}updateCell(x,R,S,L,I,P,O,B,$){this._updateCell(this._vertices.attributes,x,R,S,L,I,P,O,B,$)}_updateCell(x,R,S,L,I,P,O,B,$,W){g=(S*this._terminal.cols+R)*N,L!==h.NULL_CELL_CODE&&L!==void 0?this._atlas&&(d=B&&B.length>1?this._atlas.getRasterizedGlyphCombinedChar(B,I,P,O,!1):this._atlas.getRasterizedGlyph(L,I,P,O,!1),p=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),I!==W&&d.offset.x>p?(f=d.offset.x-p,x[g]=-(d.offset.x-f)+this._dimensions.device.char.left,x[g+1]=-d.offset.y+this._dimensions.device.char.top,x[g+2]=(d.size.x-f)/this._dimensions.device.canvas.width,x[g+3]=d.size.y/this._dimensions.device.canvas.height,x[g+4]=d.texturePage,x[g+5]=d.texturePositionClipSpace.x+f/this._atlas.pages[d.texturePage].canvas.width,x[g+6]=d.texturePositionClipSpace.y,x[g+7]=d.sizeClipSpace.x-f/this._atlas.pages[d.texturePage].canvas.width,x[g+8]=d.sizeClipSpace.y):(x[g]=-d.offset.x+this._dimensions.device.char.left,x[g+1]=-d.offset.y+this._dimensions.device.char.top,x[g+2]=d.size.x/this._dimensions.device.canvas.width,x[g+3]=d.size.y/this._dimensions.device.canvas.height,x[g+4]=d.texturePage,x[g+5]=d.texturePositionClipSpace.x,x[g+6]=d.texturePositionClipSpace.y,x[g+7]=d.sizeClipSpace.x,x[g+8]=d.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&(0,m.allowRescaling)(L,$,d.size.x,this._dimensions.device.cell.width)&&(x[g+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width)):x.fill(0,g,g+N-1-2)}clear(){const x=this._terminal,R=x.cols*x.rows*N;this._vertices.count!==R?this._vertices.attributes=new Float32Array(R):this._vertices.attributes.fill(0);let S=0;for(;S<this._vertices.attributesBuffers.length;S++)this._vertices.count!==R?this._vertices.attributesBuffers[S]=new Float32Array(R):this._vertices.attributesBuffers[S].fill(0);this._vertices.count=R,S=0;for(let L=0;L<x.rows;L++)for(let I=0;I<x.cols;I++)this._vertices.attributes[S+9]=I/x.cols,this._vertices.attributes[S+10]=L/x.rows,S+=N}handleResize(){const x=this._gl;x.useProgram(this._program),x.viewport(0,0,x.canvas.width,x.canvas.height),x.uniform2f(this._resolutionLocation,x.canvas.width,x.canvas.height),this.clear()}render(x){if(!this._atlas)return;const R=this._gl;R.useProgram(this._program),R.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;const S=this._vertices.attributesBuffers[this._activeBuffer];let L=0;for(let I=0;I<x.lineLengths.length;I++){const P=I*this._terminal.cols*N,O=this._vertices.attributes.subarray(P,P+x.lineLengths[I]*N);S.set(O,L),L+=O.length}R.bindBuffer(R.ARRAY_BUFFER,this._attributesBuffer),R.bufferData(R.ARRAY_BUFFER,S.subarray(0,L),R.STREAM_DRAW);for(let I=0;I<this._atlas.pages.length;I++)this._atlas.pages[I].version!==this._atlasTextures[I].version&&this._bindAtlasPageTexture(R,this._atlas,I);R.drawElementsInstanced(R.TRIANGLE_STRIP,4,R.UNSIGNED_BYTE,0,L/N)}setAtlas(x){this._atlas=x;for(const R of this._atlasTextures)R.version=-1}_bindAtlasPageTexture(x,R,S){x.activeTexture(x.TEXTURE0+S),x.bindTexture(x.TEXTURE_2D,this._atlasTextures[S].texture),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_S,x.CLAMP_TO_EDGE),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_T,x.CLAMP_TO_EDGE),x.texImage2D(x.TEXTURE_2D,0,x.RGBA,x.RGBA,x.UNSIGNED_BYTE,R.pages[S].canvas),x.generateMipmap(x.TEXTURE_2D),this._atlasTextures[S].version=R.pages[S].version}setDimensions(x){this._dimensions=x}}i.GlyphRenderer=E},742:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.RectangleRenderer=void 0;const m=c(374),v=c(859),h=c(310),b=c(381),T=8*Float32Array.BYTES_PER_ELEMENT;class N{constructor(){this.attributes=new Float32Array(160),this.count=0}}let w=0,d=0,g=0,p=0,f=0,E=0,j=0;class x extends v.Disposable{constructor(S,L,I,P){super(),this._terminal=S,this._gl=L,this._dimensions=I,this._themeService=P,this._vertices=new N,this._verticesCursor=new N;const O=this._gl;this._program=(0,m.throwIfFalsy)((0,b.createProgram)(O,`#version 300 es
|
|
93
|
+
layout (location = 0) in vec2 a_position;
|
|
94
|
+
layout (location = 1) in vec2 a_size;
|
|
95
|
+
layout (location = 2) in vec4 a_color;
|
|
96
|
+
layout (location = 3) in vec2 a_unitquad;
|
|
97
|
+
|
|
98
|
+
uniform mat4 u_projection;
|
|
99
|
+
|
|
100
|
+
out vec4 v_color;
|
|
101
|
+
|
|
102
|
+
void main() {
|
|
103
|
+
vec2 zeroToOne = a_position + (a_unitquad * a_size);
|
|
104
|
+
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
105
|
+
v_color = a_color;
|
|
106
|
+
}`,`#version 300 es
|
|
107
|
+
precision lowp float;
|
|
108
|
+
|
|
109
|
+
in vec4 v_color;
|
|
110
|
+
|
|
111
|
+
out vec4 outColor;
|
|
112
|
+
|
|
113
|
+
void main() {
|
|
114
|
+
outColor = v_color;
|
|
115
|
+
}`)),this.register((0,v.toDisposable)((()=>O.deleteProgram(this._program)))),this._projectionLocation=(0,m.throwIfFalsy)(O.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=O.createVertexArray(),O.bindVertexArray(this._vertexArrayObject);const B=new Float32Array([0,0,1,0,0,1,1,1]),$=O.createBuffer();this.register((0,v.toDisposable)((()=>O.deleteBuffer($)))),O.bindBuffer(O.ARRAY_BUFFER,$),O.bufferData(O.ARRAY_BUFFER,B,O.STATIC_DRAW),O.enableVertexAttribArray(3),O.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);const W=new Uint8Array([0,1,2,3]),K=O.createBuffer();this.register((0,v.toDisposable)((()=>O.deleteBuffer(K)))),O.bindBuffer(O.ELEMENT_ARRAY_BUFFER,K),O.bufferData(O.ELEMENT_ARRAY_BUFFER,W,O.STATIC_DRAW),this._attributesBuffer=(0,m.throwIfFalsy)(O.createBuffer()),this.register((0,v.toDisposable)((()=>O.deleteBuffer(this._attributesBuffer)))),O.bindBuffer(O.ARRAY_BUFFER,this._attributesBuffer),O.enableVertexAttribArray(0),O.vertexAttribPointer(0,2,O.FLOAT,!1,T,0),O.vertexAttribDivisor(0,1),O.enableVertexAttribArray(1),O.vertexAttribPointer(1,2,O.FLOAT,!1,T,2*Float32Array.BYTES_PER_ELEMENT),O.vertexAttribDivisor(1,1),O.enableVertexAttribArray(2),O.vertexAttribPointer(2,4,O.FLOAT,!1,T,4*Float32Array.BYTES_PER_ELEMENT),O.vertexAttribDivisor(2,1),this._updateCachedColors(P.colors),this.register(this._themeService.onChangeColors((Y=>{this._updateCachedColors(Y),this._updateViewportRectangle()})))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(S){const L=this._gl;L.useProgram(this._program),L.bindVertexArray(this._vertexArrayObject),L.uniformMatrix4fv(this._projectionLocation,!1,b.PROJECTION_MATRIX),L.bindBuffer(L.ARRAY_BUFFER,this._attributesBuffer),L.bufferData(L.ARRAY_BUFFER,S.attributes,L.DYNAMIC_DRAW),L.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,L.UNSIGNED_BYTE,0,S.count)}handleResize(){this._updateViewportRectangle()}setDimensions(S){this._dimensions=S}_updateCachedColors(S){this._bgFloat=this._colorToFloat32Array(S.background),this._cursorFloat=this._colorToFloat32Array(S.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(S){const L=this._terminal,I=this._vertices;let P,O,B,$,W,K,Y,V,F,H,U,z=1;for(P=0;P<L.rows;P++){for(B=-1,$=0,W=0,K=!1,O=0;O<L.cols;O++)Y=(P*L.cols+O)*h.RENDER_MODEL_INDICIES_PER_CELL,V=S.cells[Y+h.RENDER_MODEL_BG_OFFSET],F=S.cells[Y+h.RENDER_MODEL_FG_OFFSET],H=!!(67108864&F),(V!==$||F!==W&&(K||H))&&(($!==0||K&&W!==0)&&(U=8*z++,this._updateRectangle(I,U,W,$,B,O,P)),B=O,$=V,W=F,K=H);($!==0||K&&W!==0)&&(U=8*z++,this._updateRectangle(I,U,W,$,B,L.cols,P))}I.count=z}updateCursor(S){const L=this._verticesCursor,I=S.cursor;if(!I||I.style==="block")return void(L.count=0);let P,O=0;I.style!=="bar"&&I.style!=="outline"||(P=8*O++,this._addRectangleFloat(L.attributes,P,I.x*this._dimensions.device.cell.width,I.y*this._dimensions.device.cell.height,I.style==="bar"?I.dpr*I.cursorWidth:I.dpr,this._dimensions.device.cell.height,this._cursorFloat)),I.style!=="underline"&&I.style!=="outline"||(P=8*O++,this._addRectangleFloat(L.attributes,P,I.x*this._dimensions.device.cell.width,(I.y+1)*this._dimensions.device.cell.height-I.dpr,I.width*this._dimensions.device.cell.width,I.dpr,this._cursorFloat)),I.style==="outline"&&(P=8*O++,this._addRectangleFloat(L.attributes,P,I.x*this._dimensions.device.cell.width,I.y*this._dimensions.device.cell.height,I.width*this._dimensions.device.cell.width,I.dpr,this._cursorFloat),P=8*O++,this._addRectangleFloat(L.attributes,P,(I.x+I.width)*this._dimensions.device.cell.width-I.dpr,I.y*this._dimensions.device.cell.height,I.dpr,this._dimensions.device.cell.height,this._cursorFloat)),L.count=O}_updateRectangle(S,L,I,P,O,B,$){if(67108864&I)switch(50331648&I){case 16777216:case 33554432:w=this._themeService.colors.ansi[255&I].rgba;break;case 50331648:w=(16777215&I)<<8;break;default:w=this._themeService.colors.foreground.rgba}else switch(50331648&P){case 16777216:case 33554432:w=this._themeService.colors.ansi[255&P].rgba;break;case 50331648:w=(16777215&P)<<8;break;default:w=this._themeService.colors.background.rgba}S.attributes.length<L+4&&(S.attributes=(0,b.expandFloat32Array)(S.attributes,this._terminal.rows*this._terminal.cols*8)),d=O*this._dimensions.device.cell.width,g=$*this._dimensions.device.cell.height,p=(w>>24&255)/255,f=(w>>16&255)/255,E=(w>>8&255)/255,j=1,this._addRectangle(S.attributes,L,d,g,(B-O)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,p,f,E,j)}_addRectangle(S,L,I,P,O,B,$,W,K,Y){S[L]=I/this._dimensions.device.canvas.width,S[L+1]=P/this._dimensions.device.canvas.height,S[L+2]=O/this._dimensions.device.canvas.width,S[L+3]=B/this._dimensions.device.canvas.height,S[L+4]=$,S[L+5]=W,S[L+6]=K,S[L+7]=Y}_addRectangleFloat(S,L,I,P,O,B,$){S[L]=I/this._dimensions.device.canvas.width,S[L+1]=P/this._dimensions.device.canvas.height,S[L+2]=O/this._dimensions.device.canvas.width,S[L+3]=B/this._dimensions.device.canvas.height,S[L+4]=$[0],S[L+5]=$[1],S[L+6]=$[2],S[L+7]=$[3]}_colorToFloat32Array(S){return new Float32Array([(S.rgba>>24&255)/255,(S.rgba>>16&255)/255,(S.rgba>>8&255)/255,(255&S.rgba)/255])}}i.RectangleRenderer=x},310:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.RenderModel=i.COMBINED_CHAR_BIT_MASK=i.RENDER_MODEL_EXT_OFFSET=i.RENDER_MODEL_FG_OFFSET=i.RENDER_MODEL_BG_OFFSET=i.RENDER_MODEL_INDICIES_PER_CELL=void 0;const m=c(296);i.RENDER_MODEL_INDICIES_PER_CELL=4,i.RENDER_MODEL_BG_OFFSET=1,i.RENDER_MODEL_FG_OFFSET=2,i.RENDER_MODEL_EXT_OFFSET=3,i.COMBINED_CHAR_BIT_MASK=2147483648,i.RenderModel=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=(0,m.createSelectionRenderModel)()}resize(v,h){const b=v*h*i.RENDER_MODEL_INDICIES_PER_CELL;b!==this.cells.length&&(this.cells=new Uint32Array(b),this.lineLengths=new Uint32Array(h))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}}},666:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.JoinedCellData=i.WebglRenderer=void 0;const m=c(820),v=c(274),h=c(627),b=c(457),T=c(56),N=c(374),w=c(345),d=c(859),g=c(147),p=c(782),f=c(855),E=c(965),j=c(742),x=c(310),R=c(733);class S extends d.Disposable{constructor(O,B,$,W,K,Y,V,F,H){super(),this._terminal=O,this._characterJoinerService=B,this._charSizeService=$,this._coreBrowserService=W,this._coreService=K,this._decorationService=Y,this._optionsService=V,this._themeService=F,this._cursorBlinkStateManager=new d.MutableDisposable,this._charAtlasDisposable=this.register(new d.MutableDisposable),this._observerDisposable=this.register(new d.MutableDisposable),this._model=new x.RenderModel,this._workCell=new p.CellData,this._workCell2=new p.CellData,this._rectangleRenderer=this.register(new d.MutableDisposable),this._glyphRenderer=this.register(new d.MutableDisposable),this._onChangeTextureAtlas=this.register(new w.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new w.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new w.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this.register(new w.EventEmitter),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this.register(new w.EventEmitter),this.onContextLoss=this._onContextLoss.event,this.register(this._themeService.onChangeColors((()=>this._handleColorChange()))),this._cellColorResolver=new v.CellColorResolver(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new R.LinkRenderLayer(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,V,this._themeService)],this.dimensions=(0,N.createRenderDimensions)(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this.register(V.onOptionChange((()=>this._handleOptionsChanged()))),this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");const U={antialias:!1,depth:!1,preserveDrawingBuffer:H};if(this._gl=this._canvas.getContext("webgl2",U),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this.register((0,m.addDisposableDomListener)(this._canvas,"webglcontextlost",(z=>{console.log("webglcontextlost event received"),z.preventDefault(),this._contextRestorationTimeout=setTimeout((()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(z)}),3e3)}))),this.register((0,m.addDisposableDomListener)(this._canvas,"webglcontextrestored",(z=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,(0,h.removeTerminalFromCache)(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()}))),this._observerDisposable.value=(0,T.observeDevicePixelDimensions)(this._canvas,this._coreBrowserService.window,((z,te)=>this._setCanvasDevicePixelDimensions(z,te))),this.register(this._coreBrowserService.onWindowChange((z=>{this._observerDisposable.value=(0,T.observeDevicePixelDimensions)(this._canvas,z,((te,ie)=>this._setCanvasDevicePixelDimensions(te,ie)))}))),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._coreBrowserService.window.document.body.contains(this._core.screenElement),this.register((0,d.toDisposable)((()=>{var z;for(const te of this._renderLayers)te.dispose();(z=this._canvas.parentElement)==null||z.removeChild(this._canvas),(0,h.removeTerminalFromCache)(this._terminal)})))}get textureAtlas(){var O;return(O=this._charAtlas)==null?void 0:O.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(O,B){var $,W,K,Y;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(const V of this._renderLayers)V.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)==null||$.setDimensions(this.dimensions),(W=this._rectangleRenderer.value)==null||W.handleResize(),(K=this._glyphRenderer.value)==null||K.setDimensions(this.dimensions),(Y=this._glyphRenderer.value)==null||Y.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){var O;for(const B of this._renderLayers)B.handleBlur(this._terminal);(O=this._cursorBlinkStateManager.value)==null||O.pause(),this._requestRedrawViewport()}handleFocus(){var O;for(const B of this._renderLayers)B.handleFocus(this._terminal);(O=this._cursorBlinkStateManager.value)==null||O.resume(),this._requestRedrawViewport()}handleSelectionChanged(O,B,$){for(const W of this._renderLayers)W.handleSelectionChanged(this._terminal,O,B,$);this._model.selection.update(this._core,O,B,$),this._requestRedrawViewport()}handleCursorMove(){var O;for(const B of this._renderLayers)B.handleCursorMove(this._terminal);(O=this._cursorBlinkStateManager.value)==null||O.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new j.RectangleRenderer(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new E.GlyphRenderer(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){var B;if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0)return void(this._isAttached=!1);const O=(0,h.acquireTextureAtlas)(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._charAtlas!==O&&(this._onChangeTextureAtlas.fire(O.pages[0].canvas),this._charAtlasDisposable.value=(0,d.getDisposeArrayDisposable)([(0,w.forwardEvent)(O.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),(0,w.forwardEvent)(O.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)])),this._charAtlas=O,this._charAtlas.warmUp(),(B=this._glyphRenderer.value)==null||B.setAtlas(this._charAtlas)}_clearModel(O){var B;this._model.clear(),O&&((B=this._glyphRenderer.value)==null||B.clear())}clearTextureAtlas(){var O;(O=this._charAtlas)==null||O.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var O;this._clearModel(!0);for(const B of this._renderLayers)B.reset(this._terminal);(O=this._cursorBlinkStateManager.value)==null||O.restartBlinkAnimation(),this._updateCursorBlink()}registerCharacterJoiner(O){return-1}deregisterCharacterJoiner(O){return!1}renderRows(O,B){if(!this._isAttached){if(!(this._coreBrowserService.window.document.body.contains(this._core.screenElement)&&this._charSizeService.width&&this._charSizeService.height))return;this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0}for(const $ of this._renderLayers)$.handleGridChanged(this._terminal,O,B);this._glyphRenderer.value&&this._rectangleRenderer.value&&(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(O,B),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),this._cursorBlinkStateManager.value&&!this._cursorBlinkStateManager.value.isCursorVisible||this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new b.CursorBlinkStateManager((()=>{this._requestRedrawCursor()}),this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(O,B){const $=this._core;let W,K,Y,V,F,H,U,z,te,ie,we,ge,X,G,ee=this._workCell;O=I(O,$.rows-1,0),B=I(B,$.rows-1,0);const Z=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,ve=Z-$.buffer.ydisp,Se=Math.min(this._terminal.buffer.active.cursorX,$.cols-1);let Ie=-1;const je=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let Je=!1;for(K=O;K<=B;K++)for(Y=K+$.buffer.ydisp,V=$.buffer.lines.get(Y),this._model.lineLengths[K]=0,F=this._characterJoinerService.getJoinedCharacters(Y),X=0;X<$.cols;X++)if(W=this._cellColorResolver.result.bg,V.loadCell(X,ee),X===0&&(W=this._cellColorResolver.result.bg),H=!1,U=X,F.length>0&&X===F[0][0]&&(H=!0,z=F.shift(),ee=new L(ee,V.translateToString(!0,z[0],z[1]),z[1]-z[0]),U=z[1]-1),te=ee.getChars(),ie=ee.getCode(),ge=(K*$.cols+X)*x.RENDER_MODEL_INDICIES_PER_CELL,this._cellColorResolver.resolve(ee,X,Y,this.dimensions.device.cell.width),je&&Y===Z&&(X===Se&&(this._model.cursor={x:Se,y:ve,width:ee.getWidth(),style:this._coreBrowserService.isFocused?$.options.cursorStyle||"block":$.options.cursorInactiveStyle,cursorWidth:$.options.cursorWidth,dpr:this._devicePixelRatio},Ie=Se+ee.getWidth()-1),X>=Se&&X<=Ie&&(this._coreBrowserService.isFocused&&($.options.cursorStyle||"block")==="block"||this._coreBrowserService.isFocused===!1&&$.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)),ie!==f.NULL_CELL_CODE&&(this._model.lineLengths[K]=X+1),(this._model.cells[ge]!==ie||this._model.cells[ge+x.RENDER_MODEL_BG_OFFSET]!==this._cellColorResolver.result.bg||this._model.cells[ge+x.RENDER_MODEL_FG_OFFSET]!==this._cellColorResolver.result.fg||this._model.cells[ge+x.RENDER_MODEL_EXT_OFFSET]!==this._cellColorResolver.result.ext)&&(Je=!0,te.length>1&&(ie|=x.COMBINED_CHAR_BIT_MASK),this._model.cells[ge]=ie,this._model.cells[ge+x.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[ge+x.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[ge+x.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext,we=ee.getWidth(),this._glyphRenderer.value.updateCell(X,K,ie,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,te,we,W),H))for(ee=this._workCell,X++;X<U;X++)G=(K*$.cols+X)*x.RENDER_MODEL_INDICIES_PER_CELL,this._glyphRenderer.value.updateCell(X,K,f.NULL_CELL_CODE,0,0,0,f.NULL_CELL_CHAR,0,0),this._model.cells[G]=f.NULL_CELL_CODE,this._model.cells[G+x.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[G+x.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[G+x.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext;Je&&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(O,B){this._canvas.width===O&&this._canvas.height===B||(this._canvas.width=O,this._canvas.height=B,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){const O=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:O,end:O})}}i.WebglRenderer=S;class L extends g.AttributeData{constructor(O,B,$){super(),this.content=0,this.combinedData="",this.fg=O.fg,this.bg=O.bg,this.combinedData=B,this._width=$}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(O){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}function I(P,O,B=0){return Math.max(Math.min(P,O),B)}i.JoinedCellData=L},381:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.GLTexture=i.expandFloat32Array=i.createShader=i.createProgram=i.PROJECTION_MATRIX=void 0;const m=c(374);function v(h,b,T){const N=(0,m.throwIfFalsy)(h.createShader(b));if(h.shaderSource(N,T),h.compileShader(N),h.getShaderParameter(N,h.COMPILE_STATUS))return N;console.error(h.getShaderInfoLog(N)),h.deleteShader(N)}i.PROJECTION_MATRIX=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]),i.createProgram=function(h,b,T){const N=(0,m.throwIfFalsy)(h.createProgram());if(h.attachShader(N,(0,m.throwIfFalsy)(v(h,h.VERTEX_SHADER,b))),h.attachShader(N,(0,m.throwIfFalsy)(v(h,h.FRAGMENT_SHADER,T))),h.linkProgram(N),h.getProgramParameter(N,h.LINK_STATUS))return N;console.error(h.getProgramInfoLog(N)),h.deleteProgram(N)},i.createShader=v,i.expandFloat32Array=function(h,b){const T=Math.min(2*h.length,b),N=new Float32Array(T);for(let w=0;w<h.length;w++)N[w]=h[w];return N},i.GLTexture=class{constructor(h){this.texture=h,this.version=-1}}},592:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BaseRenderLayer=void 0;const m=c(627),v=c(237),h=c(374),b=c(859);class T extends b.Disposable{constructor(w,d,g,p,f,E,j,x){super(),this._container=d,this._alpha=f,this._coreBrowserService=E,this._optionsService=j,this._themeService=x,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-${g}-layer`),this._canvas.style.zIndex=p.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this.register(this._themeService.onChangeColors((R=>{this._refreshCharAtlas(w,R),this.reset(w)}))),this.register((0,b.toDisposable)((()=>{this._canvas.remove()})))}_initCanvas(){this._ctx=(0,h.throwIfFalsy)(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(w){}handleFocus(w){}handleCursorMove(w){}handleGridChanged(w,d,g){}handleSelectionChanged(w,d,g,p=!1){}_setTransparency(w,d){if(d===this._alpha)return;const g=this._canvas;this._alpha=d,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,g),this._refreshCharAtlas(w,this._themeService.colors),this.handleGridChanged(w,0,w.rows-1)}_refreshCharAtlas(w,d){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=(0,m.acquireTextureAtlas)(w,this._optionsService.rawOptions,d,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr),this._charAtlas.warmUp())}resize(w,d){this._deviceCellWidth=d.device.cell.width,this._deviceCellHeight=d.device.cell.height,this._deviceCharWidth=d.device.char.width,this._deviceCharHeight=d.device.char.height,this._deviceCharLeft=d.device.char.left,this._deviceCharTop=d.device.char.top,this._canvas.width=d.device.canvas.width,this._canvas.height=d.device.canvas.height,this._canvas.style.width=`${d.css.canvas.width}px`,this._canvas.style.height=`${d.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(w,this._themeService.colors)}_fillBottomLineAtCells(w,d,g=1){this._ctx.fillRect(w*this._deviceCellWidth,(d+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,g*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(w,d,g,p){this._alpha?this._ctx.clearRect(w*this._deviceCellWidth,d*this._deviceCellHeight,g*this._deviceCellWidth,p*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(w*this._deviceCellWidth,d*this._deviceCellHeight,g*this._deviceCellWidth,p*this._deviceCellHeight))}_fillCharTrueColor(w,d,g,p){this._ctx.font=this._getFont(w,!1,!1),this._ctx.textBaseline=v.TEXT_BASELINE,this._clipCell(g,p,d.getWidth()),this._ctx.fillText(d.getChars(),g*this._deviceCellWidth+this._deviceCharLeft,p*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(w,d,g){this._ctx.beginPath(),this._ctx.rect(w*this._deviceCellWidth,d*this._deviceCellHeight,g*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(w,d,g){return`${g?"italic":""} ${d?w.options.fontWeightBold:w.options.fontWeight} ${w.options.fontSize*this._coreBrowserService.dpr}px ${w.options.fontFamily}`}}i.BaseRenderLayer=T},733:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.LinkRenderLayer=void 0;const m=c(197),v=c(237),h=c(592);class b extends h.BaseRenderLayer{constructor(N,w,d,g,p,f,E){super(d,N,"link",w,!0,p,f,E),this.register(g.onShowLinkUnderline((j=>this._handleShowLinkUnderline(j)))),this.register(g.onHideLinkUnderline((j=>this._handleHideLinkUnderline(j))))}resize(N,w){super.resize(N,w),this._state=void 0}reset(N){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);const N=this._state.y2-this._state.y1-1;N>0&&this._clearCells(0,this._state.y1+1,this._state.cols,N),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(N){if(N.fg===v.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._themeService.colors.background.css:N.fg!==void 0&&(0,m.is256Color)(N.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[N.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,N.y1===N.y2)this._fillBottomLineAtCells(N.x1,N.y1,N.x2-N.x1);else{this._fillBottomLineAtCells(N.x1,N.y1,N.cols-N.x1);for(let w=N.y1+1;w<N.y2;w++)this._fillBottomLineAtCells(0,w,N.cols);this._fillBottomLineAtCells(0,N.y2,N.x2)}this._state=N}_handleHideLinkUnderline(N){this._clearCurrentLink()}}i.LinkRenderLayer=b},820:(y,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.addDisposableDomListener=void 0,i.addDisposableDomListener=function(c,m,v,h){c.addEventListener(m,v,h);let b=!1;return{dispose:()=>{b||(b=!0,c.removeEventListener(m,v,h))}}}},274:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CellColorResolver=void 0;const m=c(855),v=c(160),h=c(374);let b,T=0,N=0,w=!1,d=!1,g=!1,p=0;i.CellColorResolver=class{constructor(f,E,j,x,R,S){this._terminal=f,this._optionService=E,this._selectionRenderModel=j,this._decorationService=x,this._coreBrowserService=R,this._themeService=S,this.result={fg:0,bg:0,ext:0}}resolve(f,E,j,x){if(this.result.bg=f.bg,this.result.fg=f.fg,this.result.ext=268435456&f.bg?f.extended.ext:0,N=0,T=0,d=!1,w=!1,g=!1,b=this._themeService.colors,p=0,f.getCode()!==m.NULL_CELL_CODE&&f.extended.underlineStyle===4){const R=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));p=E*x%(2*Math.round(R))}if(this._decorationService.forEachDecorationAtCell(E,j,"bottom",(R=>{R.backgroundColorRGB&&(N=R.backgroundColorRGB.rgba>>8&16777215,d=!0),R.foregroundColorRGB&&(T=R.foregroundColorRGB.rgba>>8&16777215,w=!0)})),g=this._selectionRenderModel.isCellSelected(this._terminal,E,j),g){if(67108864&this.result.fg||(50331648&this.result.bg)!=0){if(67108864&this.result.fg)switch(50331648&this.result.fg){case 16777216:case 33554432:N=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:N=(16777215&this.result.fg)<<8|255;break;default:N=this._themeService.colors.foreground.rgba}else switch(50331648&this.result.bg){case 16777216:case 33554432:N=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:N=(16777215&this.result.bg)<<8|255}N=v.rgba.blend(N,4294967040&(this._coreBrowserService.isFocused?b.selectionBackgroundOpaque:b.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}else N=(this._coreBrowserService.isFocused?b.selectionBackgroundOpaque:b.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(d=!0,b.selectionForeground&&(T=b.selectionForeground.rgba>>8&16777215,w=!0),(0,h.treatGlyphAsBackgroundColor)(f.getCode())){if(67108864&this.result.fg&&(50331648&this.result.bg)==0)T=(this._coreBrowserService.isFocused?b.selectionBackgroundOpaque:b.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(67108864&this.result.fg)switch(50331648&this.result.bg){case 16777216:case 33554432:T=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:T=(16777215&this.result.bg)<<8|255}else switch(50331648&this.result.fg){case 16777216:case 33554432:T=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:T=(16777215&this.result.fg)<<8|255;break;default:T=this._themeService.colors.foreground.rgba}T=v.rgba.blend(T,4294967040&(this._coreBrowserService.isFocused?b.selectionBackgroundOpaque:b.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}w=!0}}this._decorationService.forEachDecorationAtCell(E,j,"top",(R=>{R.backgroundColorRGB&&(N=R.backgroundColorRGB.rgba>>8&16777215,d=!0),R.foregroundColorRGB&&(T=R.foregroundColorRGB.rgba>>8&16777215,w=!0)})),d&&(N=g?-16777216&f.bg&-134217729|N|50331648:-16777216&f.bg|N|50331648),w&&(T=-16777216&f.fg&-67108865|T|50331648),67108864&this.result.fg&&(d&&!w&&(T=(50331648&this.result.bg)==0?-134217728&this.result.fg|16777215&b.background.rgba>>8|50331648:-134217728&this.result.fg|67108863&this.result.bg,w=!0),!d&&w&&(N=(50331648&this.result.fg)==0?-67108864&this.result.bg|16777215&b.foreground.rgba>>8|50331648:-67108864&this.result.bg|67108863&this.result.fg,d=!0)),b=void 0,this.result.bg=d?N:this.result.bg,this.result.fg=w?T:this.result.fg,this.result.ext&=536870911,this.result.ext|=p<<29&3758096384}}},627:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.removeTerminalFromCache=i.acquireTextureAtlas=void 0;const m=c(509),v=c(197),h=[];i.acquireTextureAtlas=function(b,T,N,w,d,g,p,f){const E=(0,v.generateConfig)(w,d,g,p,T,N,f);for(let R=0;R<h.length;R++){const S=h[R],L=S.ownedBy.indexOf(b);if(L>=0){if((0,v.configEquals)(S.config,E))return S.atlas;S.ownedBy.length===1?(S.atlas.dispose(),h.splice(R,1)):S.ownedBy.splice(L,1);break}}for(let R=0;R<h.length;R++){const S=h[R];if((0,v.configEquals)(S.config,E))return S.ownedBy.push(b),S.atlas}const j=b._core,x={atlas:new m.TextureAtlas(document,E,j.unicodeService),config:E,ownedBy:[b]};return h.push(x),x.atlas},i.removeTerminalFromCache=function(b){for(let T=0;T<h.length;T++){const N=h[T].ownedBy.indexOf(b);if(N!==-1){h[T].ownedBy.length===1?(h[T].atlas.dispose(),h.splice(T,1)):h[T].ownedBy.splice(N,1);break}}}},197:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.is256Color=i.configEquals=i.generateConfig=void 0;const m=c(160);i.generateConfig=function(v,h,b,T,N,w,d){const g={foreground:w.foreground,background:w.background,cursor:m.NULL_COLOR,cursorAccent:m.NULL_COLOR,selectionForeground:m.NULL_COLOR,selectionBackgroundTransparent:m.NULL_COLOR,selectionBackgroundOpaque:m.NULL_COLOR,selectionInactiveBackgroundTransparent:m.NULL_COLOR,selectionInactiveBackgroundOpaque:m.NULL_COLOR,ansi:w.ansi.slice(),contrastCache:w.contrastCache,halfContrastCache:w.halfContrastCache};return{customGlyphs:N.customGlyphs,devicePixelRatio:d,letterSpacing:N.letterSpacing,lineHeight:N.lineHeight,deviceCellWidth:v,deviceCellHeight:h,deviceCharWidth:b,deviceCharHeight:T,fontFamily:N.fontFamily,fontSize:N.fontSize,fontWeight:N.fontWeight,fontWeightBold:N.fontWeightBold,allowTransparency:N.allowTransparency,drawBoldTextInBrightColors:N.drawBoldTextInBrightColors,minimumContrastRatio:N.minimumContrastRatio,colors:g}},i.configEquals=function(v,h){for(let b=0;b<v.colors.ansi.length;b++)if(v.colors.ansi[b].rgba!==h.colors.ansi[b].rgba)return!1;return v.devicePixelRatio===h.devicePixelRatio&&v.customGlyphs===h.customGlyphs&&v.lineHeight===h.lineHeight&&v.letterSpacing===h.letterSpacing&&v.fontFamily===h.fontFamily&&v.fontSize===h.fontSize&&v.fontWeight===h.fontWeight&&v.fontWeightBold===h.fontWeightBold&&v.allowTransparency===h.allowTransparency&&v.deviceCharWidth===h.deviceCharWidth&&v.deviceCharHeight===h.deviceCharHeight&&v.drawBoldTextInBrightColors===h.drawBoldTextInBrightColors&&v.minimumContrastRatio===h.minimumContrastRatio&&v.colors.foreground.rgba===h.colors.foreground.rgba&&v.colors.background.rgba===h.colors.background.rgba},i.is256Color=function(v){return(50331648&v)==16777216||(50331648&v)==33554432}},237:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.TEXT_BASELINE=i.DIM_OPACITY=i.INVERTED_DEFAULT_COLOR=void 0;const m=c(399);i.INVERTED_DEFAULT_COLOR=257,i.DIM_OPACITY=.5,i.TEXT_BASELINE=m.isFirefox||m.isLegacyEdge?"bottom":"ideographic"},457:(y,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CursorBlinkStateManager=void 0,i.CursorBlinkStateManager=class{constructor(c,m){this._renderCallback=c,this._coreBrowserService=m,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0}))))}_restartInterval(c=600){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout((()=>{if(this._animationTimeRestarted){const m=600-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,m>0)return void this._restartInterval(m)}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0})),this._blinkInterval=this._coreBrowserService.window.setInterval((()=>{if(this._animationTimeRestarted){const m=600-(Date.now()-this._animationTimeRestarted);return this._animationTimeRestarted=void 0,void this._restartInterval(m)}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0}))}),600)}),c)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}}},860:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.tryDrawCustomChar=i.powerlineDefinitions=i.boxDrawingDefinitions=i.blockElementDefinitions=void 0;const m=c(374);i.blockElementDefinitions={"▀":[{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}]};const v={"░":[[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]]};i.boxDrawingDefinitions={"─":{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:(w,d)=>`M0,${.5-d} L1,${.5-d} M0,${.5+d} L1,${.5+d}`},"║":{1:(w,d)=>`M${.5-w},0 L${.5-w},1 M${.5+w},0 L${.5+w},1`},"╒":{1:(w,d)=>`M.5,1 L.5,${.5-d} L1,${.5-d} M.5,${.5+d} L1,${.5+d}`},"╓":{1:(w,d)=>`M${.5-w},1 L${.5-w},.5 L1,.5 M${.5+w},.5 L${.5+w},1`},"╔":{1:(w,d)=>`M1,${.5-d} L${.5-w},${.5-d} L${.5-w},1 M1,${.5+d} L${.5+w},${.5+d} L${.5+w},1`},"╕":{1:(w,d)=>`M0,${.5-d} L.5,${.5-d} L.5,1 M0,${.5+d} L.5,${.5+d}`},"╖":{1:(w,d)=>`M${.5+w},1 L${.5+w},.5 L0,.5 M${.5-w},.5 L${.5-w},1`},"╗":{1:(w,d)=>`M0,${.5+d} L${.5-w},${.5+d} L${.5-w},1 M0,${.5-d} L${.5+w},${.5-d} L${.5+w},1`},"╘":{1:(w,d)=>`M.5,0 L.5,${.5+d} L1,${.5+d} M.5,${.5-d} L1,${.5-d}`},"╙":{1:(w,d)=>`M1,.5 L${.5-w},.5 L${.5-w},0 M${.5+w},.5 L${.5+w},0`},"╚":{1:(w,d)=>`M1,${.5-d} L${.5+w},${.5-d} L${.5+w},0 M1,${.5+d} L${.5-w},${.5+d} L${.5-w},0`},"╛":{1:(w,d)=>`M0,${.5+d} L.5,${.5+d} L.5,0 M0,${.5-d} L.5,${.5-d}`},"╜":{1:(w,d)=>`M0,.5 L${.5+w},.5 L${.5+w},0 M${.5-w},.5 L${.5-w},0`},"╝":{1:(w,d)=>`M0,${.5-d} L${.5-w},${.5-d} L${.5-w},0 M0,${.5+d} L${.5+w},${.5+d} L${.5+w},0`},"╞":{1:(w,d)=>`M.5,0 L.5,1 M.5,${.5-d} L1,${.5-d} M.5,${.5+d} L1,${.5+d}`},"╟":{1:(w,d)=>`M${.5-w},0 L${.5-w},1 M${.5+w},0 L${.5+w},1 M${.5+w},.5 L1,.5`},"╠":{1:(w,d)=>`M${.5-w},0 L${.5-w},1 M1,${.5+d} L${.5+w},${.5+d} L${.5+w},1 M1,${.5-d} L${.5+w},${.5-d} L${.5+w},0`},"╡":{1:(w,d)=>`M.5,0 L.5,1 M0,${.5-d} L.5,${.5-d} M0,${.5+d} L.5,${.5+d}`},"╢":{1:(w,d)=>`M0,.5 L${.5-w},.5 M${.5-w},0 L${.5-w},1 M${.5+w},0 L${.5+w},1`},"╣":{1:(w,d)=>`M${.5+w},0 L${.5+w},1 M0,${.5+d} L${.5-w},${.5+d} L${.5-w},1 M0,${.5-d} L${.5-w},${.5-d} L${.5-w},0`},"╤":{1:(w,d)=>`M0,${.5-d} L1,${.5-d} M0,${.5+d} L1,${.5+d} M.5,${.5+d} L.5,1`},"╥":{1:(w,d)=>`M0,.5 L1,.5 M${.5-w},.5 L${.5-w},1 M${.5+w},.5 L${.5+w},1`},"╦":{1:(w,d)=>`M0,${.5-d} L1,${.5-d} M0,${.5+d} L${.5-w},${.5+d} L${.5-w},1 M1,${.5+d} L${.5+w},${.5+d} L${.5+w},1`},"╧":{1:(w,d)=>`M.5,0 L.5,${.5-d} M0,${.5-d} L1,${.5-d} M0,${.5+d} L1,${.5+d}`},"╨":{1:(w,d)=>`M0,.5 L1,.5 M${.5-w},.5 L${.5-w},0 M${.5+w},.5 L${.5+w},0`},"╩":{1:(w,d)=>`M0,${.5+d} L1,${.5+d} M0,${.5-d} L${.5-w},${.5-d} L${.5-w},0 M1,${.5-d} L${.5+w},${.5-d} L${.5+w},0`},"╪":{1:(w,d)=>`M.5,0 L.5,1 M0,${.5-d} L1,${.5-d} M0,${.5+d} L1,${.5+d}`},"╫":{1:(w,d)=>`M0,.5 L1,.5 M${.5-w},0 L${.5-w},1 M${.5+w},0 L${.5+w},1`},"╬":{1:(w,d)=>`M0,${.5+d} L${.5-w},${.5+d} L${.5-w},1 M1,${.5+d} L${.5+w},${.5+d} L${.5+w},1 M0,${.5-d} L${.5-w},${.5-d} L${.5-w},0 M1,${.5-d} L${.5+w},${.5-d} L${.5+w},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:(w,d)=>`M.5,1 L.5,${.5+d/.15*.5} C.5,${.5+d/.15*.5},.5,.5,1,.5`},"╮":{1:(w,d)=>`M.5,1 L.5,${.5+d/.15*.5} C.5,${.5+d/.15*.5},.5,.5,0,.5`},"╯":{1:(w,d)=>`M.5,0 L.5,${.5-d/.15*.5} C.5,${.5-d/.15*.5},.5,.5,0,.5`},"╰":{1:(w,d)=>`M.5,0 L.5,${.5-d/.15*.5} C.5,${.5-d/.15*.5},.5,.5,1,.5`}},i.powerlineDefinitions={"":{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}},i.powerlineDefinitions[""]=i.powerlineDefinitions[""],i.powerlineDefinitions[""]=i.powerlineDefinitions[""],i.tryDrawCustomChar=function(w,d,g,p,f,E,j,x){const R=i.blockElementDefinitions[d];if(R)return(function(P,O,B,$,W,K){for(let Y=0;Y<O.length;Y++){const V=O[Y],F=W/8,H=K/8;P.fillRect(B+V.x*F,$+V.y*H,V.w*F,V.h*H)}})(w,R,g,p,f,E),!0;const S=v[d];if(S)return(function(P,O,B,$,W,K){let Y=h.get(O);Y||(Y=new Map,h.set(O,Y));const V=P.fillStyle;if(typeof V!="string")throw new Error(`Unexpected fillStyle type "${V}"`);let F=Y.get(V);if(!F){const H=O[0].length,U=O.length,z=P.canvas.ownerDocument.createElement("canvas");z.width=H,z.height=U;const te=(0,m.throwIfFalsy)(z.getContext("2d")),ie=new ImageData(H,U);let we,ge,X,G;if(V.startsWith("#"))we=parseInt(V.slice(1,3),16),ge=parseInt(V.slice(3,5),16),X=parseInt(V.slice(5,7),16),G=V.length>7&&parseInt(V.slice(7,9),16)||1;else{if(!V.startsWith("rgba"))throw new Error(`Unexpected fillStyle color format "${V}" when drawing pattern glyph`);[we,ge,X,G]=V.substring(5,V.length-1).split(",").map((ee=>parseFloat(ee)))}for(let ee=0;ee<U;ee++)for(let Z=0;Z<H;Z++)ie.data[4*(ee*H+Z)]=we,ie.data[4*(ee*H+Z)+1]=ge,ie.data[4*(ee*H+Z)+2]=X,ie.data[4*(ee*H+Z)+3]=O[ee][Z]*(255*G);te.putImageData(ie,0,0),F=(0,m.throwIfFalsy)(P.createPattern(z,null)),Y.set(V,F)}P.fillStyle=F,P.fillRect(B,$,W,K)})(w,S,g,p,f,E),!0;const L=i.boxDrawingDefinitions[d];if(L)return(function(P,O,B,$,W,K,Y){P.strokeStyle=P.fillStyle;for(const[V,F]of Object.entries(O)){let H;P.beginPath(),P.lineWidth=Y*Number.parseInt(V),H=typeof F=="function"?F(.15,.15/K*W):F;for(const U of H.split(" ")){const z=U[0],te=T[z];if(!te){console.error(`Could not find drawing instructions for "${z}"`);continue}const ie=U.substring(1).split(",");ie[0]&&ie[1]&&te(P,N(ie,W,K,B,$,!0,Y))}P.stroke(),P.closePath()}})(w,L,g,p,f,E,x),!0;const I=i.powerlineDefinitions[d];return!!I&&((function(P,O,B,$,W,K,Y,V){const F=new Path2D;F.rect(B,$,W,K),P.clip(F),P.beginPath();const H=Y/12;P.lineWidth=V*H;for(const U of O.d.split(" ")){const z=U[0],te=T[z];if(!te){console.error(`Could not find drawing instructions for "${z}"`);continue}const ie=U.substring(1).split(",");ie[0]&&ie[1]&&te(P,N(ie,W,K,B,$,!1,V,(O.leftPadding??0)*(H/2),(O.rightPadding??0)*(H/2)))}O.type===1?(P.strokeStyle=P.fillStyle,P.stroke()):P.fill(),P.closePath()})(w,I,g,p,f,E,j,x),!0)};const h=new Map;function b(w,d,g=0){return Math.max(Math.min(w,d),g)}const T={C:(w,d)=>w.bezierCurveTo(d[0],d[1],d[2],d[3],d[4],d[5]),L:(w,d)=>w.lineTo(d[0],d[1]),M:(w,d)=>w.moveTo(d[0],d[1])};function N(w,d,g,p,f,E,j,x=0,R=0){const S=w.map((L=>parseFloat(L)||parseInt(L)));if(S.length<2)throw new Error("Too few arguments for instruction");for(let L=0;L<S.length;L+=2)S[L]*=d-x*j-R*j,E&&S[L]!==0&&(S[L]=b(Math.round(S[L]+.5)-.5,d,0)),S[L]+=p+x*j;for(let L=1;L<S.length;L+=2)S[L]*=g,E&&S[L]!==0&&(S[L]=b(Math.round(S[L]+.5)-.5,g,0)),S[L]+=f;return S}},56:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.observeDevicePixelDimensions=void 0;const m=c(859);i.observeDevicePixelDimensions=function(v,h,b){let T=new h.ResizeObserver((N=>{const w=N.find((p=>p.target===v));if(!w)return;if(!("devicePixelContentBoxSize"in w))return T==null||T.disconnect(),void(T=void 0);const d=w.devicePixelContentBoxSize[0].inlineSize,g=w.devicePixelContentBoxSize[0].blockSize;d>0&&g>0&&b(d,g)}));try{T.observe(v,{box:["device-pixel-content-box"]})}catch{T.disconnect(),T=void 0}return(0,m.toDisposable)((()=>T==null?void 0:T.disconnect()))}},374:(y,i)=>{function c(v){return 57508<=v&&v<=57558}function m(v){return v>=128512&&v<=128591||v>=127744&&v<=128511||v>=128640&&v<=128767||v>=9728&&v<=9983||v>=9984&&v<=10175||v>=65024&&v<=65039||v>=129280&&v<=129535||v>=127462&&v<=127487}Object.defineProperty(i,"__esModule",{value:!0}),i.computeNextVariantOffset=i.createRenderDimensions=i.treatGlyphAsBackgroundColor=i.allowRescaling=i.isEmoji=i.isRestrictedPowerlineGlyph=i.isPowerlineGlyph=i.throwIfFalsy=void 0,i.throwIfFalsy=function(v){if(!v)throw new Error("value must not be falsy");return v},i.isPowerlineGlyph=c,i.isRestrictedPowerlineGlyph=function(v){return 57520<=v&&v<=57527},i.isEmoji=m,i.allowRescaling=function(v,h,b,T){return h===1&&b>Math.ceil(1.5*T)&&v!==void 0&&v>255&&!m(v)&&!c(v)&&!(function(N){return 57344<=N&&N<=63743})(v)},i.treatGlyphAsBackgroundColor=function(v){return c(v)||(function(h){return 9472<=h&&h<=9631})(v)},i.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},i.computeNextVariantOffset=function(v,h,b=0){return(v-(2*Math.round(h)-b))%(2*Math.round(h))}},296:(y,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.createSelectionRenderModel=void 0;class c{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(v,h,b,T=!1){if(this.selectionStart=h,this.selectionEnd=b,!h||!b||h[0]===b[0]&&h[1]===b[1])return void this.clear();const N=v.buffers.active.ydisp,w=h[1]-N,d=b[1]-N,g=Math.max(w,0),p=Math.min(d,v.rows-1);g>=v.rows||p<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=T,this.viewportStartRow=w,this.viewportEndRow=d,this.viewportCappedStartRow=g,this.viewportCappedEndRow=p,this.startCol=h[0],this.endCol=b[0])}isCellSelected(v,h,b){return!!this.hasSelection&&(b-=v.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?h>=this.startCol&&b>=this.viewportCappedStartRow&&h<this.endCol&&b<=this.viewportCappedEndRow:h<this.startCol&&b>=this.viewportCappedStartRow&&h>=this.endCol&&b<=this.viewportCappedEndRow:b>this.viewportStartRow&&b<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&b===this.viewportStartRow&&h>=this.startCol&&h<this.endCol||this.viewportStartRow<this.viewportEndRow&&b===this.viewportEndRow&&h<this.endCol||this.viewportStartRow<this.viewportEndRow&&b===this.viewportStartRow&&h>=this.startCol)}}i.createSelectionRenderModel=function(){return new c}},509:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.TextureAtlas=void 0;const m=c(237),v=c(860),h=c(374),b=c(160),T=c(345),N=c(485),w=c(385),d=c(147),g=c(855),p={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}};let f;class E{get pages(){return this._pages}constructor(L,I,P){this._document=L,this._config=I,this._unicodeService=P,this._didWarmUp=!1,this._cacheMap=new N.FourKeyMap,this._cacheMapCombined=new N.FourKeyMap,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new d.AttributeData,this._textureSize=512,this._onAddTextureAtlasCanvas=new T.EventEmitter,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new T.EventEmitter,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=R(L,4*this._config.deviceCellWidth+4,this._config.deviceCellHeight+4),this._tmpCtx=(0,h.throwIfFalsy)(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}dispose(){for(const L of this.pages)L.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){const L=new w.IdleTaskQueue;for(let I=33;I<126;I++)L.enqueue((()=>{if(!this._cacheMap.get(I,g.DEFAULT_COLOR,g.DEFAULT_COLOR,g.DEFAULT_EXT)){const P=this._drawToCache(I,g.DEFAULT_COLOR,g.DEFAULT_COLOR,g.DEFAULT_EXT);this._cacheMap.set(I,g.DEFAULT_COLOR,g.DEFAULT_COLOR,g.DEFAULT_EXT,P)}}))}beginFrame(){return this._requestClearModel}clearTexture(){if(this._pages[0].currentRow.x!==0||this._pages[0].currentRow.y!==0){for(const L of this._pages)L.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(E.maxAtlasPages&&this._pages.length>=Math.max(4,E.maxAtlasPages)){const I=this._pages.filter((Y=>2*Y.canvas.width<=(E.maxTextureSize||4096))).sort(((Y,V)=>V.canvas.width!==Y.canvas.width?V.canvas.width-Y.canvas.width:V.percentageUsed-Y.percentageUsed));let P=-1,O=0;for(let Y=0;Y<I.length;Y++)if(I[Y].canvas.width!==O)P=Y,O=I[Y].canvas.width;else if(Y-P==3)break;const B=I.slice(P,P+4),$=B.map((Y=>Y.glyphs[0].texturePage)).sort(((Y,V)=>Y>V?1:-1)),W=this.pages.length-B.length,K=this._mergePages(B,W);K.version++;for(let Y=$.length-1;Y>=0;Y--)this._deletePage($[Y]);this.pages.push(K),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(K.canvas)}const L=new j(this._document,this._textureSize);return this._pages.push(L),this._activePages.push(L),this._onAddTextureAtlasCanvas.fire(L.canvas),L}_mergePages(L,I){const P=2*L[0].canvas.width,O=new j(this._document,P,L);for(const[B,$]of L.entries()){const W=B*$.canvas.width%P,K=Math.floor(B/2)*$.canvas.height;O.ctx.drawImage($.canvas,W,K);for(const V of $.glyphs)V.texturePage=I,V.sizeClipSpace.x=V.size.x/P,V.sizeClipSpace.y=V.size.y/P,V.texturePosition.x+=W,V.texturePosition.y+=K,V.texturePositionClipSpace.x=V.texturePosition.x/P,V.texturePositionClipSpace.y=V.texturePosition.y/P;this._onRemoveTextureAtlasCanvas.fire($.canvas);const Y=this._activePages.indexOf($);Y!==-1&&this._activePages.splice(Y,1)}return O}_deletePage(L){this._pages.splice(L,1);for(let I=L;I<this._pages.length;I++){const P=this._pages[I];for(const O of P.glyphs)O.texturePage--;P.version++}}getRasterizedGlyphCombinedChar(L,I,P,O,B){return this._getFromCacheMap(this._cacheMapCombined,L,I,P,O,B)}getRasterizedGlyph(L,I,P,O,B){return this._getFromCacheMap(this._cacheMap,L,I,P,O,B)}_getFromCacheMap(L,I,P,O,B,$=!1){return f=L.get(I,P,O,B),f||(f=this._drawToCache(I,P,O,B,$),L.set(I,P,O,B,f)),f}_getColorFromAnsiIndex(L){if(L>=this._config.colors.ansi.length)throw new Error("No color found for idx "+L);return this._config.colors.ansi[L]}_getBackgroundColor(L,I,P,O){if(this._config.allowTransparency)return b.NULL_COLOR;let B;switch(L){case 16777216:case 33554432:B=this._getColorFromAnsiIndex(I);break;case 50331648:const $=d.AttributeData.toColorRGB(I);B=b.channels.toColor($[0],$[1],$[2]);break;default:B=P?b.color.opaque(this._config.colors.foreground):this._config.colors.background}return B}_getForegroundColor(L,I,P,O,B,$,W,K,Y,V){const F=this._getMinimumContrastColor(L,I,P,O,B,$,W,Y,K,V);if(F)return F;let H;switch(B){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&Y&&$<8&&($+=8),H=this._getColorFromAnsiIndex($);break;case 50331648:const U=d.AttributeData.toColorRGB($);H=b.channels.toColor(U[0],U[1],U[2]);break;default:H=W?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(H=b.color.opaque(H)),K&&(H=b.color.multiplyOpacity(H,m.DIM_OPACITY)),H}_resolveBackgroundRgba(L,I,P){switch(L){case 16777216:case 33554432:return this._getColorFromAnsiIndex(I).rgba;case 50331648:return I<<8;default:return P?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(L,I,P,O){switch(L){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&O&&I<8&&(I+=8),this._getColorFromAnsiIndex(I).rgba;case 50331648:return I<<8;default:return P?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(L,I,P,O,B,$,W,K,Y,V){if(this._config.minimumContrastRatio===1||V)return;const F=this._getContrastCache(Y),H=F.getColor(L,O);if(H!==void 0)return H||void 0;const U=this._resolveBackgroundRgba(I,P,W),z=this._resolveForegroundRgba(B,$,W,K),te=b.rgba.ensureContrastRatio(U,z,this._config.minimumContrastRatio/(Y?2:1));if(!te)return void F.setColor(L,O,null);const ie=b.channels.toColor(te>>24&255,te>>16&255,te>>8&255);return F.setColor(L,O,ie),ie}_getContrastCache(L){return L?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(L,I,P,O,B=!1){const $=typeof L=="number"?String.fromCharCode(L):L,W=Math.min(this._config.deviceCellWidth*Math.max($.length,2)+4,this._textureSize);this._tmpCanvas.width<W&&(this._tmpCanvas.width=W);const K=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<K&&(this._tmpCanvas.height=K),this._tmpCtx.save(),this._workAttributeData.fg=P,this._workAttributeData.bg=I,this._workAttributeData.extended.ext=O,this._workAttributeData.isInvisible())return p;const Y=!!this._workAttributeData.isBold(),V=!!this._workAttributeData.isInverse(),F=!!this._workAttributeData.isDim(),H=!!this._workAttributeData.isItalic(),U=!!this._workAttributeData.isUnderline(),z=!!this._workAttributeData.isStrikethrough(),te=!!this._workAttributeData.isOverline();let ie=this._workAttributeData.getFgColor(),we=this._workAttributeData.getFgColorMode(),ge=this._workAttributeData.getBgColor(),X=this._workAttributeData.getBgColorMode();if(V){const ye=ie;ie=ge,ge=ye;const _e=we;we=X,X=_e}const G=this._getBackgroundColor(X,ge,V,F);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=G.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";const ee=Y?this._config.fontWeightBold:this._config.fontWeight,Z=H?"italic":"";this._tmpCtx.font=`${Z} ${ee} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=m.TEXT_BASELINE;const ve=$.length===1&&(0,h.isPowerlineGlyph)($.charCodeAt(0)),Se=$.length===1&&(0,h.isRestrictedPowerlineGlyph)($.charCodeAt(0)),Ie=this._getForegroundColor(I,X,ge,P,we,ie,V,F,Y,(0,h.treatGlyphAsBackgroundColor)($.charCodeAt(0)));this._tmpCtx.fillStyle=Ie.css;const je=Se?0:4;let Je=!1;this._config.customGlyphs!==!1&&(Je=(0,v.tryDrawCustomChar)(this._tmpCtx,$,je,je,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let tt,Ne=!ve;if(tt=typeof L=="number"?this._unicodeService.wcwidth(L):this._unicodeService.getStringCellWidth(L),U){this._tmpCtx.save();const ye=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),_e=ye%2==1?.5:0;if(this._tmpCtx.lineWidth=ye,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())Ne=!1,this._tmpCtx.strokeStyle=`rgb(${d.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{Ne=!1;let De=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&De<8&&(De+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(De).css}this._tmpCtx.beginPath();const Te=je,ue=Math.ceil(je+this._config.deviceCharHeight)-_e-(B?2*ye:0),Fe=ue+ye,$e=ue+2*ye;let Ye=this._workAttributeData.getUnderlineVariantOffset();for(let De=0;De<tt;De++){this._tmpCtx.save();const He=Te+De*this._config.deviceCellWidth,qe=Te+(De+1)*this._config.deviceCellWidth,xt=He+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(He,ue),this._tmpCtx.lineTo(qe,ue),this._tmpCtx.moveTo(He,$e),this._tmpCtx.lineTo(qe,$e);break;case 3:const It=ye<=1?$e:Math.ceil(je+this._config.deviceCharHeight-ye/2)-_e,jt=ye<=1?ue:Math.ceil(je+this._config.deviceCharHeight+ye/2)-_e,gt=new Path2D;gt.rect(He,ue,this._config.deviceCellWidth,$e-ue),this._tmpCtx.clip(gt),this._tmpCtx.moveTo(He-this._config.deviceCellWidth/2,Fe),this._tmpCtx.bezierCurveTo(He-this._config.deviceCellWidth/2,jt,He,jt,He,Fe),this._tmpCtx.bezierCurveTo(He,It,xt,It,xt,Fe),this._tmpCtx.bezierCurveTo(xt,jt,qe,jt,qe,Fe),this._tmpCtx.bezierCurveTo(qe,It,qe+this._config.deviceCellWidth/2,It,qe+this._config.deviceCellWidth/2,Fe);break;case 4:const Kt=Ye===0?0:Ye>=ye?2*ye-Ye:ye-Ye;Ye>=ye||Kt===0?(this._tmpCtx.setLineDash([Math.round(ye),Math.round(ye)]),this._tmpCtx.moveTo(He+Kt,ue),this._tmpCtx.lineTo(qe,ue)):(this._tmpCtx.setLineDash([Math.round(ye),Math.round(ye)]),this._tmpCtx.moveTo(He,ue),this._tmpCtx.lineTo(He+Kt,ue),this._tmpCtx.moveTo(He+Kt+ye,ue),this._tmpCtx.lineTo(qe,ue)),Ye=(0,h.computeNextVariantOffset)(qe-He,ye,Ye);break;case 5:const Ft=.6,pe=.3,Ze=qe-He,Qe=Math.floor(Ft*Ze),ct=Math.floor(pe*Ze),he=Ze-Qe-ct;this._tmpCtx.setLineDash([Qe,ct,he]),this._tmpCtx.moveTo(He,ue),this._tmpCtx.lineTo(qe,ue);break;default:this._tmpCtx.moveTo(He,ue),this._tmpCtx.lineTo(qe,ue)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!Je&&this._config.fontSize>=12&&!this._config.allowTransparency&&$!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";const De=this._tmpCtx.measureText($);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in De&&De.actualBoundingBoxDescent>0){this._tmpCtx.save();const He=new Path2D;He.rect(Te,ue-Math.ceil(ye/2),this._config.deviceCellWidth*tt,$e-ue+Math.ceil(ye/2)),this._tmpCtx.clip(He),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=G.css,this._tmpCtx.strokeText($,je,je+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(te){const ye=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),_e=ye%2==1?.5:0;this._tmpCtx.lineWidth=ye,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(je,je+_e),this._tmpCtx.lineTo(je+this._config.deviceCharWidth*tt,je+_e),this._tmpCtx.stroke()}if(Je||this._tmpCtx.fillText($,je,je+this._config.deviceCharHeight),$==="_"&&!this._config.allowTransparency){let ye=x(this._tmpCtx.getImageData(je,je,this._config.deviceCellWidth,this._config.deviceCellHeight),G,Ie,Ne);if(ye)for(let _e=1;_e<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=G.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText($,je,je+this._config.deviceCharHeight-_e),ye=x(this._tmpCtx.getImageData(je,je,this._config.deviceCellWidth,this._config.deviceCellHeight),G,Ie,Ne),ye);_e++);}if(z){const ye=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),_e=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=ye,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(je,je+Math.floor(this._config.deviceCharHeight/2)-_e),this._tmpCtx.lineTo(je+this._config.deviceCharWidth*tt,je+Math.floor(this._config.deviceCharHeight/2)-_e),this._tmpCtx.stroke()}this._tmpCtx.restore();const ce=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height);let dt;if(dt=this._config.allowTransparency?(function(ye){for(let _e=0;_e<ye.data.length;_e+=4)if(ye.data[_e+3]>0)return!1;return!0})(ce):x(ce,G,Ie,Ne),dt)return p;const se=this._findGlyphBoundingBox(ce,this._workBoundingBox,W,Se,Je,je);let fe,Ce;for(;;){if(this._activePages.length===0){const ye=this._createNewPage();fe=ye,Ce=ye.currentRow,Ce.height=se.size.y;break}fe=this._activePages[this._activePages.length-1],Ce=fe.currentRow;for(const ye of this._activePages)se.size.y<=ye.currentRow.height&&(fe=ye,Ce=ye.currentRow);for(let ye=this._activePages.length-1;ye>=0;ye--)for(const _e of this._activePages[ye].fixedRows)_e.height<=Ce.height&&se.size.y<=_e.height&&(fe=this._activePages[ye],Ce=_e);if(Ce.y+se.size.y>=fe.canvas.height||Ce.height>se.size.y+2){let ye=!1;if(fe.currentRow.y+fe.currentRow.height+se.size.y>=fe.canvas.height){let _e;for(const Te of this._activePages)if(Te.currentRow.y+Te.currentRow.height+se.size.y<Te.canvas.height){_e=Te;break}if(_e)fe=_e;else if(E.maxAtlasPages&&this._pages.length>=E.maxAtlasPages&&Ce.y+se.size.y<=fe.canvas.height&&Ce.height>=se.size.y&&Ce.x+se.size.x<=fe.canvas.width)ye=!0;else{const Te=this._createNewPage();fe=Te,Ce=Te.currentRow,Ce.height=se.size.y,ye=!0}}ye||(fe.currentRow.height>0&&fe.fixedRows.push(fe.currentRow),Ce={x:0,y:fe.currentRow.y+fe.currentRow.height,height:se.size.y},fe.fixedRows.push(Ce),fe.currentRow={x:0,y:Ce.y+Ce.height,height:0})}if(Ce.x+se.size.x<=fe.canvas.width)break;Ce===fe.currentRow?(Ce.x=0,Ce.y+=Ce.height,Ce.height=0):fe.fixedRows.splice(fe.fixedRows.indexOf(Ce),1)}return se.texturePage=this._pages.indexOf(fe),se.texturePosition.x=Ce.x,se.texturePosition.y=Ce.y,se.texturePositionClipSpace.x=Ce.x/fe.canvas.width,se.texturePositionClipSpace.y=Ce.y/fe.canvas.height,se.sizeClipSpace.x/=fe.canvas.width,se.sizeClipSpace.y/=fe.canvas.height,Ce.height=Math.max(Ce.height,se.size.y),Ce.x+=se.size.x,fe.ctx.putImageData(ce,se.texturePosition.x-this._workBoundingBox.left,se.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,se.size.x,se.size.y),fe.addGlyph(se),fe.version++,se}_findGlyphBoundingBox(L,I,P,O,B,$){I.top=0;const W=O?this._config.deviceCellHeight:this._tmpCanvas.height,K=O?this._config.deviceCellWidth:P;let Y=!1;for(let V=0;V<W;V++){for(let F=0;F<K;F++){const H=V*this._tmpCanvas.width*4+4*F+3;if(L.data[H]!==0){I.top=V,Y=!0;break}}if(Y)break}I.left=0,Y=!1;for(let V=0;V<$+K;V++){for(let F=0;F<W;F++){const H=F*this._tmpCanvas.width*4+4*V+3;if(L.data[H]!==0){I.left=V,Y=!0;break}}if(Y)break}I.right=K,Y=!1;for(let V=$+K-1;V>=$;V--){for(let F=0;F<W;F++){const H=F*this._tmpCanvas.width*4+4*V+3;if(L.data[H]!==0){I.right=V,Y=!0;break}}if(Y)break}I.bottom=W,Y=!1;for(let V=W-1;V>=0;V--){for(let F=0;F<K;F++){const H=V*this._tmpCanvas.width*4+4*F+3;if(L.data[H]!==0){I.bottom=V,Y=!0;break}}if(Y)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:I.right-I.left+1,y:I.bottom-I.top+1},sizeClipSpace:{x:I.right-I.left+1,y:I.bottom-I.top+1},offset:{x:-I.left+$+(O||B?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-I.top+$+(O||B?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}}i.TextureAtlas=E;class j{get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(L){this._glyphs.push(L),this._usedPixels+=L.size.x*L.size.y}constructor(L,I,P){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],P)for(const O of P)this._glyphs.push(...O.glyphs),this._usedPixels+=O._usedPixels;this.canvas=R(L,I,I),this.ctx=(0,h.throwIfFalsy)(this.canvas.getContext("2d",{alpha:!0}))}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 x(S,L,I,P){const O=L.rgba>>>24,B=L.rgba>>>16&255,$=L.rgba>>>8&255,W=I.rgba>>>24,K=I.rgba>>>16&255,Y=I.rgba>>>8&255,V=Math.floor((Math.abs(O-W)+Math.abs(B-K)+Math.abs($-Y))/12);let F=!0;for(let H=0;H<S.data.length;H+=4)S.data[H]===O&&S.data[H+1]===B&&S.data[H+2]===$||P&&Math.abs(S.data[H]-O)+Math.abs(S.data[H+1]-B)+Math.abs(S.data[H+2]-$)<V?S.data[H+3]=0:F=!1;return F}function R(S,L,I){const P=S.createElement("canvas");return P.width=L,P.height=I,P}},160:(y,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.contrastRatio=i.toPaddedHex=i.rgba=i.rgb=i.css=i.color=i.channels=i.NULL_COLOR=void 0;let c=0,m=0,v=0,h=0;var b,T,N,w,d;function g(f){const E=f.toString(16);return E.length<2?"0"+E:E}function p(f,E){return f<E?(E+.05)/(f+.05):(f+.05)/(E+.05)}i.NULL_COLOR={css:"#00000000",rgba:0},(function(f){f.toCss=function(E,j,x,R){return R!==void 0?`#${g(E)}${g(j)}${g(x)}${g(R)}`:`#${g(E)}${g(j)}${g(x)}`},f.toRgba=function(E,j,x,R=255){return(E<<24|j<<16|x<<8|R)>>>0},f.toColor=function(E,j,x,R){return{css:f.toCss(E,j,x,R),rgba:f.toRgba(E,j,x,R)}}})(b||(i.channels=b={})),(function(f){function E(j,x){return h=Math.round(255*x),[c,m,v]=d.toChannels(j.rgba),{css:b.toCss(c,m,v,h),rgba:b.toRgba(c,m,v,h)}}f.blend=function(j,x){if(h=(255&x.rgba)/255,h===1)return{css:x.css,rgba:x.rgba};const R=x.rgba>>24&255,S=x.rgba>>16&255,L=x.rgba>>8&255,I=j.rgba>>24&255,P=j.rgba>>16&255,O=j.rgba>>8&255;return c=I+Math.round((R-I)*h),m=P+Math.round((S-P)*h),v=O+Math.round((L-O)*h),{css:b.toCss(c,m,v),rgba:b.toRgba(c,m,v)}},f.isOpaque=function(j){return(255&j.rgba)==255},f.ensureContrastRatio=function(j,x,R){const S=d.ensureContrastRatio(j.rgba,x.rgba,R);if(S)return b.toColor(S>>24&255,S>>16&255,S>>8&255)},f.opaque=function(j){const x=(255|j.rgba)>>>0;return[c,m,v]=d.toChannels(x),{css:b.toCss(c,m,v),rgba:x}},f.opacity=E,f.multiplyOpacity=function(j,x){return h=255&j.rgba,E(j,h*x/255)},f.toColorRGB=function(j){return[j.rgba>>24&255,j.rgba>>16&255,j.rgba>>8&255]}})(T||(i.color=T={})),(function(f){let E,j;try{const x=document.createElement("canvas");x.width=1,x.height=1;const R=x.getContext("2d",{willReadFrequently:!0});R&&(E=R,E.globalCompositeOperation="copy",j=E.createLinearGradient(0,0,1,1))}catch{}f.toColor=function(x){if(x.match(/#[\da-f]{3,8}/i))switch(x.length){case 4:return c=parseInt(x.slice(1,2).repeat(2),16),m=parseInt(x.slice(2,3).repeat(2),16),v=parseInt(x.slice(3,4).repeat(2),16),b.toColor(c,m,v);case 5:return c=parseInt(x.slice(1,2).repeat(2),16),m=parseInt(x.slice(2,3).repeat(2),16),v=parseInt(x.slice(3,4).repeat(2),16),h=parseInt(x.slice(4,5).repeat(2),16),b.toColor(c,m,v,h);case 7:return{css:x,rgba:(parseInt(x.slice(1),16)<<8|255)>>>0};case 9:return{css:x,rgba:parseInt(x.slice(1),16)>>>0}}const R=x.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 c=parseInt(R[1]),m=parseInt(R[2]),v=parseInt(R[3]),h=Math.round(255*(R[5]===void 0?1:parseFloat(R[5]))),b.toColor(c,m,v,h);if(!E||!j)throw new Error("css.toColor: Unsupported css format");if(E.fillStyle=j,E.fillStyle=x,typeof E.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(E.fillRect(0,0,1,1),[c,m,v,h]=E.getImageData(0,0,1,1).data,h!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:b.toRgba(c,m,v,h),css:x}}})(N||(i.css=N={})),(function(f){function E(j,x,R){const S=j/255,L=x/255,I=R/255;return .2126*(S<=.03928?S/12.92:Math.pow((S+.055)/1.055,2.4))+.7152*(L<=.03928?L/12.92:Math.pow((L+.055)/1.055,2.4))+.0722*(I<=.03928?I/12.92:Math.pow((I+.055)/1.055,2.4))}f.relativeLuminance=function(j){return E(j>>16&255,j>>8&255,255&j)},f.relativeLuminance2=E})(w||(i.rgb=w={})),(function(f){function E(x,R,S){const L=x>>24&255,I=x>>16&255,P=x>>8&255;let O=R>>24&255,B=R>>16&255,$=R>>8&255,W=p(w.relativeLuminance2(O,B,$),w.relativeLuminance2(L,I,P));for(;W<S&&(O>0||B>0||$>0);)O-=Math.max(0,Math.ceil(.1*O)),B-=Math.max(0,Math.ceil(.1*B)),$-=Math.max(0,Math.ceil(.1*$)),W=p(w.relativeLuminance2(O,B,$),w.relativeLuminance2(L,I,P));return(O<<24|B<<16|$<<8|255)>>>0}function j(x,R,S){const L=x>>24&255,I=x>>16&255,P=x>>8&255;let O=R>>24&255,B=R>>16&255,$=R>>8&255,W=p(w.relativeLuminance2(O,B,$),w.relativeLuminance2(L,I,P));for(;W<S&&(O<255||B<255||$<255);)O=Math.min(255,O+Math.ceil(.1*(255-O))),B=Math.min(255,B+Math.ceil(.1*(255-B))),$=Math.min(255,$+Math.ceil(.1*(255-$))),W=p(w.relativeLuminance2(O,B,$),w.relativeLuminance2(L,I,P));return(O<<24|B<<16|$<<8|255)>>>0}f.blend=function(x,R){if(h=(255&R)/255,h===1)return R;const S=R>>24&255,L=R>>16&255,I=R>>8&255,P=x>>24&255,O=x>>16&255,B=x>>8&255;return c=P+Math.round((S-P)*h),m=O+Math.round((L-O)*h),v=B+Math.round((I-B)*h),b.toRgba(c,m,v)},f.ensureContrastRatio=function(x,R,S){const L=w.relativeLuminance(x>>8),I=w.relativeLuminance(R>>8);if(p(L,I)<S){if(I<L){const B=E(x,R,S),$=p(L,w.relativeLuminance(B>>8));if($<S){const W=j(x,R,S);return $>p(L,w.relativeLuminance(W>>8))?B:W}return B}const P=j(x,R,S),O=p(L,w.relativeLuminance(P>>8));if(O<S){const B=E(x,R,S);return O>p(L,w.relativeLuminance(B>>8))?P:B}return P}},f.reduceLuminance=E,f.increaseLuminance=j,f.toChannels=function(x){return[x>>24&255,x>>16&255,x>>8&255,255&x]}})(d||(i.rgba=d={})),i.toPaddedHex=g,i.contrastRatio=p},345:(y,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.runAndSubscribe=i.forwardEvent=i.EventEmitter=void 0,i.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=c=>(this._listeners.push(c),{dispose:()=>{if(!this._disposed){for(let m=0;m<this._listeners.length;m++)if(this._listeners[m]===c)return void this._listeners.splice(m,1)}}})),this._event}fire(c,m){const v=[];for(let h=0;h<this._listeners.length;h++)v.push(this._listeners[h]);for(let h=0;h<v.length;h++)v[h].call(void 0,c,m)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},i.forwardEvent=function(c,m){return c((v=>m.fire(v)))},i.runAndSubscribe=function(c,m){return m(void 0),c((v=>m(v)))}},859:(y,i)=>{function c(m){for(const v of m)v.dispose();m.length=0}Object.defineProperty(i,"__esModule",{value:!0}),i.getDisposeArrayDisposable=i.disposeArray=i.toDisposable=i.MutableDisposable=i.Disposable=void 0,i.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const m of this._disposables)m.dispose();this._disposables.length=0}register(m){return this._disposables.push(m),m}unregister(m){const v=this._disposables.indexOf(m);v!==-1&&this._disposables.splice(v,1)}},i.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(m){var v;this._isDisposed||m===this._value||((v=this._value)==null||v.dispose(),this._value=m)}clear(){this.value=void 0}dispose(){var m;this._isDisposed=!0,(m=this._value)==null||m.dispose(),this._value=void 0}},i.toDisposable=function(m){return{dispose:m}},i.disposeArray=c,i.getDisposeArrayDisposable=function(m){return{dispose:()=>c(m)}}},485:(y,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.FourKeyMap=i.TwoKeyMap=void 0;class c{constructor(){this._data={}}set(v,h,b){this._data[v]||(this._data[v]={}),this._data[v][h]=b}get(v,h){return this._data[v]?this._data[v][h]:void 0}clear(){this._data={}}}i.TwoKeyMap=c,i.FourKeyMap=class{constructor(){this._data=new c}set(m,v,h,b,T){this._data.get(m,v)||this._data.set(m,v,new c),this._data.get(m,v).set(h,b,T)}get(m,v,h,b){var T;return(T=this._data.get(m,v))==null?void 0:T.get(h,b)}clear(){this._data.clear()}}},399:(y,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.isChromeOS=i.isLinux=i.isWindows=i.isIphone=i.isIpad=i.isMac=i.getSafariVersion=i.isSafari=i.isLegacyEdge=i.isFirefox=i.isNode=void 0,i.isNode=typeof process<"u"&&"title"in process;const c=i.isNode?"node":navigator.userAgent,m=i.isNode?"node":navigator.platform;i.isFirefox=c.includes("Firefox"),i.isLegacyEdge=c.includes("Edge"),i.isSafari=/^((?!chrome|android).)*safari/i.test(c),i.getSafariVersion=function(){if(!i.isSafari)return 0;const v=c.match(/Version\/(\d+)/);return v===null||v.length<2?0:parseInt(v[1])},i.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(m),i.isIpad=m==="iPad",i.isIphone=m==="iPhone",i.isWindows=["Windows","Win16","Win32","WinCE"].includes(m),i.isLinux=m.indexOf("Linux")>=0,i.isChromeOS=/\bCrOS\b/.test(c)},385:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.DebouncedIdleTask=i.IdleTaskQueue=i.PriorityTaskQueue=void 0;const m=c(399);class v{constructor(){this._tasks=[],this._i=0}enqueue(T){this._tasks.push(T),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(T){this._idleCallback=void 0;let N=0,w=0,d=T.timeRemaining(),g=0;for(;this._i<this._tasks.length;){if(N=Date.now(),this._tasks[this._i]()||this._i++,N=Math.max(1,Date.now()-N),w=Math.max(N,w),g=T.timeRemaining(),1.5*w>g)return d-N<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(d-N))}ms`),void this._start();d=g}this.clear()}}class h extends v{_requestCallback(T){return setTimeout((()=>T(this._createDeadline(16))))}_cancelCallback(T){clearTimeout(T)}_createDeadline(T){const N=Date.now()+T;return{timeRemaining:()=>Math.max(0,N-Date.now())}}}i.PriorityTaskQueue=h,i.IdleTaskQueue=!m.isNode&&"requestIdleCallback"in window?class extends v{_requestCallback(b){return requestIdleCallback(b)}_cancelCallback(b){cancelIdleCallback(b)}}:h,i.DebouncedIdleTask=class{constructor(){this._queue=new i.IdleTaskQueue}set(b){this._queue.clear(),this._queue.enqueue(b)}flush(){this._queue.flush()}}},147:(y,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ExtendedAttrs=i.AttributeData=void 0;class c{constructor(){this.fg=0,this.bg=0,this.extended=new m}static toColorRGB(h){return[h>>>16&255,h>>>8&255,255&h]}static fromColorRGB(h){return(255&h[0])<<16|(255&h[1])<<8|255&h[2]}clone(){const h=new c;return h.fg=this.fg,h.bg=this.bg,h.extended=this.extended.clone(),h}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}i.AttributeData=c;class m{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(h){this._ext=h}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(h){this._ext&=-469762049,this._ext|=h<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(h){this._ext&=-67108864,this._ext|=67108863&h}get urlId(){return this._urlId}set urlId(h){this._urlId=h}get underlineVariantOffset(){const h=(3758096384&this._ext)>>29;return h<0?4294967288^h:h}set underlineVariantOffset(h){this._ext&=536870911,this._ext|=h<<29&3758096384}constructor(h=0,b=0){this._ext=0,this._urlId=0,this._ext=h,this._urlId=b}clone(){return new m(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}i.ExtendedAttrs=m},782:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CellData=void 0;const m=c(133),v=c(855),h=c(147);class b extends h.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new h.ExtendedAttrs,this.combinedData=""}static fromCharData(N){const w=new b;return w.setFromCharData(N),w}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,m.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(N){this.fg=N[v.CHAR_DATA_ATTR_INDEX],this.bg=0;let w=!1;if(N[v.CHAR_DATA_CHAR_INDEX].length>2)w=!0;else if(N[v.CHAR_DATA_CHAR_INDEX].length===2){const d=N[v.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=d&&d<=56319){const g=N[v.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=g&&g<=57343?this.content=1024*(d-55296)+g-56320+65536|N[v.CHAR_DATA_WIDTH_INDEX]<<22:w=!0}else w=!0}else this.content=N[v.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|N[v.CHAR_DATA_WIDTH_INDEX]<<22;w&&(this.combinedData=N[v.CHAR_DATA_CHAR_INDEX],this.content=2097152|N[v.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}i.CellData=b},855:(y,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.WHITESPACE_CELL_CODE=i.WHITESPACE_CELL_WIDTH=i.WHITESPACE_CELL_CHAR=i.NULL_CELL_CODE=i.NULL_CELL_WIDTH=i.NULL_CELL_CHAR=i.CHAR_DATA_CODE_INDEX=i.CHAR_DATA_WIDTH_INDEX=i.CHAR_DATA_CHAR_INDEX=i.CHAR_DATA_ATTR_INDEX=i.DEFAULT_EXT=i.DEFAULT_ATTR=i.DEFAULT_COLOR=void 0,i.DEFAULT_COLOR=0,i.DEFAULT_ATTR=256|i.DEFAULT_COLOR<<9,i.DEFAULT_EXT=0,i.CHAR_DATA_ATTR_INDEX=0,i.CHAR_DATA_CHAR_INDEX=1,i.CHAR_DATA_WIDTH_INDEX=2,i.CHAR_DATA_CODE_INDEX=3,i.NULL_CELL_CHAR="",i.NULL_CELL_WIDTH=1,i.NULL_CELL_CODE=0,i.WHITESPACE_CELL_CHAR=" ",i.WHITESPACE_CELL_WIDTH=1,i.WHITESPACE_CELL_CODE=32},133:(y,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Utf8ToUtf32=i.StringToUtf32=i.utf32ToString=i.stringFromCodePoint=void 0,i.stringFromCodePoint=function(c){return c>65535?(c-=65536,String.fromCharCode(55296+(c>>10))+String.fromCharCode(c%1024+56320)):String.fromCharCode(c)},i.utf32ToString=function(c,m=0,v=c.length){let h="";for(let b=m;b<v;++b){let T=c[b];T>65535?(T-=65536,h+=String.fromCharCode(55296+(T>>10))+String.fromCharCode(T%1024+56320)):h+=String.fromCharCode(T)}return h},i.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(c,m){const v=c.length;if(!v)return 0;let h=0,b=0;if(this._interim){const T=c.charCodeAt(b++);56320<=T&&T<=57343?m[h++]=1024*(this._interim-55296)+T-56320+65536:(m[h++]=this._interim,m[h++]=T),this._interim=0}for(let T=b;T<v;++T){const N=c.charCodeAt(T);if(55296<=N&&N<=56319){if(++T>=v)return this._interim=N,h;const w=c.charCodeAt(T);56320<=w&&w<=57343?m[h++]=1024*(N-55296)+w-56320+65536:(m[h++]=N,m[h++]=w)}else N!==65279&&(m[h++]=N)}return h}},i.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(c,m){const v=c.length;if(!v)return 0;let h,b,T,N,w=0,d=0,g=0;if(this.interim[0]){let E=!1,j=this.interim[0];j&=(224&j)==192?31:(240&j)==224?15:7;let x,R=0;for(;(x=63&this.interim[++R])&&R<4;)j<<=6,j|=x;const S=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,L=S-R;for(;g<L;){if(g>=v)return 0;if(x=c[g++],(192&x)!=128){g--,E=!0;break}this.interim[R++]=x,j<<=6,j|=63&x}E||(S===2?j<128?g--:m[w++]=j:S===3?j<2048||j>=55296&&j<=57343||j===65279||(m[w++]=j):j<65536||j>1114111||(m[w++]=j)),this.interim.fill(0)}const p=v-4;let f=g;for(;f<v;){for(;!(!(f<p)||128&(h=c[f])||128&(b=c[f+1])||128&(T=c[f+2])||128&(N=c[f+3]));)m[w++]=h,m[w++]=b,m[w++]=T,m[w++]=N,f+=4;if(h=c[f++],h<128)m[w++]=h;else if((224&h)==192){if(f>=v)return this.interim[0]=h,w;if(b=c[f++],(192&b)!=128){f--;continue}if(d=(31&h)<<6|63&b,d<128){f--;continue}m[w++]=d}else if((240&h)==224){if(f>=v)return this.interim[0]=h,w;if(b=c[f++],(192&b)!=128){f--;continue}if(f>=v)return this.interim[0]=h,this.interim[1]=b,w;if(T=c[f++],(192&T)!=128){f--;continue}if(d=(15&h)<<12|(63&b)<<6|63&T,d<2048||d>=55296&&d<=57343||d===65279)continue;m[w++]=d}else if((248&h)==240){if(f>=v)return this.interim[0]=h,w;if(b=c[f++],(192&b)!=128){f--;continue}if(f>=v)return this.interim[0]=h,this.interim[1]=b,w;if(T=c[f++],(192&T)!=128){f--;continue}if(f>=v)return this.interim[0]=h,this.interim[1]=b,this.interim[2]=T,w;if(N=c[f++],(192&N)!=128){f--;continue}if(d=(7&h)<<18|(63&b)<<12|(63&T)<<6|63&N,d<65536||d>1114111)continue;m[w++]=d}}return w}}},776:function(y,i,c){var m=this&&this.__decorate||function(d,g,p,f){var E,j=arguments.length,x=j<3?g:f===null?f=Object.getOwnPropertyDescriptor(g,p):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(d,g,p,f);else for(var R=d.length-1;R>=0;R--)(E=d[R])&&(x=(j<3?E(x):j>3?E(g,p,x):E(g,p))||x);return j>3&&x&&Object.defineProperty(g,p,x),x},v=this&&this.__param||function(d,g){return function(p,f){g(p,f,d)}};Object.defineProperty(i,"__esModule",{value:!0}),i.traceCall=i.setTraceLogger=i.LogService=void 0;const h=c(859),b=c(97),T={trace:b.LogLevelEnum.TRACE,debug:b.LogLevelEnum.DEBUG,info:b.LogLevelEnum.INFO,warn:b.LogLevelEnum.WARN,error:b.LogLevelEnum.ERROR,off:b.LogLevelEnum.OFF};let N,w=i.LogService=class extends h.Disposable{get logLevel(){return this._logLevel}constructor(d){super(),this._optionsService=d,this._logLevel=b.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),N=this}_updateLogLevel(){this._logLevel=T[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(d){for(let g=0;g<d.length;g++)typeof d[g]=="function"&&(d[g]=d[g]())}_log(d,g,p){this._evalLazyOptionalParams(p),d.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+g,...p)}trace(d,...g){var p;this._logLevel<=b.LogLevelEnum.TRACE&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.trace.bind(this._optionsService.options.logger))??console.log,d,g)}debug(d,...g){var p;this._logLevel<=b.LogLevelEnum.DEBUG&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.debug.bind(this._optionsService.options.logger))??console.log,d,g)}info(d,...g){var p;this._logLevel<=b.LogLevelEnum.INFO&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.info.bind(this._optionsService.options.logger))??console.info,d,g)}warn(d,...g){var p;this._logLevel<=b.LogLevelEnum.WARN&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.warn.bind(this._optionsService.options.logger))??console.warn,d,g)}error(d,...g){var p;this._logLevel<=b.LogLevelEnum.ERROR&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.error.bind(this._optionsService.options.logger))??console.error,d,g)}};i.LogService=w=m([v(0,b.IOptionsService)],w),i.setTraceLogger=function(d){N=d},i.traceCall=function(d,g,p){if(typeof p.value!="function")throw new Error("not supported");const f=p.value;p.value=function(...E){if(N.logLevel!==b.LogLevelEnum.TRACE)return f.apply(this,E);N.trace(`GlyphRenderer#${f.name}(${E.map((x=>JSON.stringify(x))).join(", ")})`);const j=f.apply(this,E);return N.trace(`GlyphRenderer#${f.name} return`,j),j}}},726:(y,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.createDecorator=i.getServiceDependencies=i.serviceRegistry=void 0;const c="di$target",m="di$dependencies";i.serviceRegistry=new Map,i.getServiceDependencies=function(v){return v[m]||[]},i.createDecorator=function(v){if(i.serviceRegistry.has(v))return i.serviceRegistry.get(v);const h=function(b,T,N){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(w,d,g){d[c]===d?d[m].push({id:w,index:g}):(d[m]=[{id:w,index:g}],d[c]=d)})(h,b,N)};return h.toString=()=>v,i.serviceRegistry.set(v,h),h}},97:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.IDecorationService=i.IUnicodeService=i.IOscLinkService=i.IOptionsService=i.ILogService=i.LogLevelEnum=i.IInstantiationService=i.ICharsetService=i.ICoreService=i.ICoreMouseService=i.IBufferService=void 0;const m=c(726);var v;i.IBufferService=(0,m.createDecorator)("BufferService"),i.ICoreMouseService=(0,m.createDecorator)("CoreMouseService"),i.ICoreService=(0,m.createDecorator)("CoreService"),i.ICharsetService=(0,m.createDecorator)("CharsetService"),i.IInstantiationService=(0,m.createDecorator)("InstantiationService"),(function(h){h[h.TRACE=0]="TRACE",h[h.DEBUG=1]="DEBUG",h[h.INFO=2]="INFO",h[h.WARN=3]="WARN",h[h.ERROR=4]="ERROR",h[h.OFF=5]="OFF"})(v||(i.LogLevelEnum=v={})),i.ILogService=(0,m.createDecorator)("LogService"),i.IOptionsService=(0,m.createDecorator)("OptionsService"),i.IOscLinkService=(0,m.createDecorator)("OscLinkService"),i.IUnicodeService=(0,m.createDecorator)("UnicodeService"),i.IDecorationService=(0,m.createDecorator)("DecorationService")}},l={};function u(y){var i=l[y];if(i!==void 0)return i.exports;var c=l[y]={exports:{}};return s[y].call(c.exports,c,c.exports,u),c.exports}var k={};return(()=>{var y=k;Object.defineProperty(y,"__esModule",{value:!0}),y.WebglAddon=void 0;const i=u(345),c=u(859),m=u(399),v=u(666),h=u(776);class b extends c.Disposable{constructor(N){if(m.isSafari&&(0,m.getSafariVersion)()<16){const w={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",w))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=N,this._onChangeTextureAtlas=this.register(new i.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new i.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new i.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this.register(new i.EventEmitter),this.onContextLoss=this._onContextLoss.event}activate(N){const w=N._core;if(!N.element)return void this.register(w.onWillOpen((()=>this.activate(N))));this._terminal=N;const d=w.coreService,g=w.optionsService,p=w,f=p._renderService,E=p._characterJoinerService,j=p._charSizeService,x=p._coreBrowserService,R=p._decorationService,S=p._logService,L=p._themeService;(0,h.setTraceLogger)(S),this._renderer=this.register(new v.WebglRenderer(N,E,j,x,d,R,g,L,this._preserveDrawingBuffer)),this.register((0,i.forwardEvent)(this._renderer.onContextLoss,this._onContextLoss)),this.register((0,i.forwardEvent)(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this.register((0,i.forwardEvent)(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this.register((0,i.forwardEvent)(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),f.setRenderer(this._renderer),this.register((0,c.toDisposable)((()=>{const I=this._terminal._core._renderService;I.setRenderer(this._terminal._core._createRenderer()),I.handleResize(N.cols,N.rows)})))}get textureAtlas(){var N;return(N=this._renderer)==null?void 0:N.textureAtlas}clearTextureAtlas(){var N;(N=this._renderer)==null||N.clearTextureAtlas()}}y.WebglAddon=b})(),k})()))})(pu)),pu.exports}var XC=YC(),mu={exports:{}},Np;function QC(){return Np||(Np=1,(function(t,e){(function(s,l){t.exports=l()})(globalThis,(()=>(()=>{var s={4567:function(y,i,c){var m=this&&this.__decorate||function(p,f,E,j){var x,R=arguments.length,S=R<3?f:j===null?j=Object.getOwnPropertyDescriptor(f,E):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(p,f,E,j);else for(var L=p.length-1;L>=0;L--)(x=p[L])&&(S=(R<3?x(S):R>3?x(f,E,S):x(f,E))||S);return R>3&&S&&Object.defineProperty(f,E,S),S},v=this&&this.__param||function(p,f){return function(E,j){f(E,j,p)}};Object.defineProperty(i,"__esModule",{value:!0}),i.AccessibilityManager=void 0;const h=c(9042),b=c(9924),T=c(844),N=c(4725),w=c(2585),d=c(3656);let g=i.AccessibilityManager=class extends T.Disposable{constructor(p,f,E,j){super(),this._terminal=p,this._coreBrowserService=E,this._renderService=j,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let x=0;x<this._terminal.rows;x++)this._rowElements[x]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[x]);if(this._topBoundaryFocusListener=x=>this._handleBoundaryFocus(x,0),this._bottomBoundaryFocusListener=x=>this._handleBoundaryFocus(x,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new b.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((x=>this._handleResize(x.rows)))),this.register(this._terminal.onRender((x=>this._refreshRows(x.start,x.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((x=>this._handleChar(x)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
|
|
116
|
+
`)))),this.register(this._terminal.onA11yTab((x=>this._handleTab(x)))),this.register(this._terminal.onKey((x=>this._handleKey(x.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,d.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,T.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(p){for(let f=0;f<p;f++)this._handleChar(" ")}_handleChar(p){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==p&&(this._charsToAnnounce+=p):this._charsToAnnounce+=p,p===`
|
|
117
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=h.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(p){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(p)||this._charsToConsume.push(p)}_refreshRows(p,f){this._liveRegionDebouncer.refresh(p,f,this._terminal.rows)}_renderRows(p,f){const E=this._terminal.buffer,j=E.lines.length.toString();for(let x=p;x<=f;x++){const R=E.lines.get(E.ydisp+x),S=[],L=(R==null?void 0:R.translateToString(!0,void 0,void 0,S))||"",I=(E.ydisp+x+1).toString(),P=this._rowElements[x];P&&(L.length===0?(P.innerText=" ",this._rowColumns.set(P,[0,1])):(P.textContent=L,this._rowColumns.set(P,S)),P.setAttribute("aria-posinset",I),P.setAttribute("aria-setsize",j))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(p,f){const E=p.target,j=this._rowElements[f===0?1:this._rowElements.length-2];if(E.getAttribute("aria-posinset")===(f===0?"1":`${this._terminal.buffer.lines.length}`)||p.relatedTarget!==j)return;let x,R;if(f===0?(x=E,R=this._rowElements.pop(),this._rowContainer.removeChild(R)):(x=this._rowElements.shift(),R=E,this._rowContainer.removeChild(x)),x.removeEventListener("focus",this._topBoundaryFocusListener),R.removeEventListener("focus",this._bottomBoundaryFocusListener),f===0){const S=this._createAccessibilityTreeNode();this._rowElements.unshift(S),this._rowContainer.insertAdjacentElement("afterbegin",S)}else{const S=this._createAccessibilityTreeNode();this._rowElements.push(S),this._rowContainer.appendChild(S)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(f===0?-1:1),this._rowElements[f===0?1:this._rowElements.length-2].focus(),p.preventDefault(),p.stopImmediatePropagation()}_handleSelectionChange(){var L;if(this._rowElements.length===0)return;const p=document.getSelection();if(!p)return;if(p.isCollapsed)return void(this._rowContainer.contains(p.anchorNode)&&this._terminal.clearSelection());if(!p.anchorNode||!p.focusNode)return void console.error("anchorNode and/or focusNode are null");let f={node:p.anchorNode,offset:p.anchorOffset},E={node:p.focusNode,offset:p.focusOffset};if((f.node.compareDocumentPosition(E.node)&Node.DOCUMENT_POSITION_PRECEDING||f.node===E.node&&f.offset>E.offset)&&([f,E]=[E,f]),f.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(f={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(f.node))return;const j=this._rowElements.slice(-1)[0];if(E.node.compareDocumentPosition(j)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(E={node:j,offset:((L=j.textContent)==null?void 0:L.length)??0}),!this._rowContainer.contains(E.node))return;const x=({node:I,offset:P})=>{const O=I instanceof Text?I.parentNode:I;let B=parseInt(O==null?void 0:O.getAttribute("aria-posinset"),10)-1;if(isNaN(B))return console.warn("row is invalid. Race condition?"),null;const $=this._rowColumns.get(O);if(!$)return console.warn("columns is null. Race condition?"),null;let W=P<$.length?$[P]:$.slice(-1)[0]+1;return W>=this._terminal.cols&&(++B,W=0),{row:B,column:W}},R=x(f),S=x(E);if(R&&S){if(R.row>S.row||R.row===S.row&&R.column>=S.column)throw new Error("invalid range");this._terminal.select(R.column,R.row,(S.row-R.row)*this._terminal.cols-R.column+S.column)}}_handleResize(p){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let f=this._rowContainer.children.length;f<this._terminal.rows;f++)this._rowElements[f]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[f]);for(;this._rowElements.length>p;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const p=this._coreBrowserService.mainDocument.createElement("div");return p.setAttribute("role","listitem"),p.tabIndex=-1,this._refreshRowDimensions(p),p}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let p=0;p<this._terminal.rows;p++)this._refreshRowDimensions(this._rowElements[p])}}_refreshRowDimensions(p){p.style.height=`${this._renderService.dimensions.css.cell.height}px`}};i.AccessibilityManager=g=m([v(1,w.IInstantiationService),v(2,N.ICoreBrowserService),v(3,N.IRenderService)],g)},3614:(y,i)=>{function c(b){return b.replace(/\r?\n/g,"\r")}function m(b,T){return T?"\x1B[200~"+b+"\x1B[201~":b}function v(b,T,N,w){b=m(b=c(b),N.decPrivateModes.bracketedPasteMode&&w.rawOptions.ignoreBracketedPasteMode!==!0),N.triggerDataEvent(b,!0),T.value=""}function h(b,T,N){const w=N.getBoundingClientRect(),d=b.clientX-w.left-10,g=b.clientY-w.top-10;T.style.width="20px",T.style.height="20px",T.style.left=`${d}px`,T.style.top=`${g}px`,T.style.zIndex="1000",T.focus()}Object.defineProperty(i,"__esModule",{value:!0}),i.rightClickHandler=i.moveTextAreaUnderMouseCursor=i.paste=i.handlePasteEvent=i.copyHandler=i.bracketTextForPaste=i.prepareTextForTerminal=void 0,i.prepareTextForTerminal=c,i.bracketTextForPaste=m,i.copyHandler=function(b,T){b.clipboardData&&b.clipboardData.setData("text/plain",T.selectionText),b.preventDefault()},i.handlePasteEvent=function(b,T,N,w){b.stopPropagation(),b.clipboardData&&v(b.clipboardData.getData("text/plain"),T,N,w)},i.paste=v,i.moveTextAreaUnderMouseCursor=h,i.rightClickHandler=function(b,T,N,w,d){h(b,T,N),d&&w.rightClickSelect(b),T.value=w.selectionText,T.select()}},7239:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ColorContrastCache=void 0;const m=c(1505);i.ColorContrastCache=class{constructor(){this._color=new m.TwoKeyMap,this._css=new m.TwoKeyMap}setCss(v,h,b){this._css.set(v,h,b)}getCss(v,h){return this._css.get(v,h)}setColor(v,h,b){this._color.set(v,h,b)}getColor(v,h){return this._color.get(v,h)}clear(){this._color.clear(),this._css.clear()}}},3656:(y,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.addDisposableDomListener=void 0,i.addDisposableDomListener=function(c,m,v,h){c.addEventListener(m,v,h);let b=!1;return{dispose:()=>{b||(b=!0,c.removeEventListener(m,v,h))}}}},3551:function(y,i,c){var m=this&&this.__decorate||function(g,p,f,E){var j,x=arguments.length,R=x<3?p:E===null?E=Object.getOwnPropertyDescriptor(p,f):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(g,p,f,E);else for(var S=g.length-1;S>=0;S--)(j=g[S])&&(R=(x<3?j(R):x>3?j(p,f,R):j(p,f))||R);return x>3&&R&&Object.defineProperty(p,f,R),R},v=this&&this.__param||function(g,p){return function(f,E){p(f,E,g)}};Object.defineProperty(i,"__esModule",{value:!0}),i.Linkifier=void 0;const h=c(3656),b=c(8460),T=c(844),N=c(2585),w=c(4725);let d=i.Linkifier=class extends T.Disposable{get currentLink(){return this._currentLink}constructor(g,p,f,E,j){super(),this._element=g,this._mouseService=p,this._renderService=f,this._bufferService=E,this._linkProviderService=j,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new b.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new b.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,T.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,T.toDisposable)((()=>{var x;this._lastMouseEvent=void 0,(x=this._activeProviderReplies)==null||x.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,h.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,h.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,h.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,h.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(g){this._lastMouseEvent=g;const p=this._positionFromMouseEvent(g,this._element,this._mouseService);if(!p)return;this._isMouseOut=!1;const f=g.composedPath();for(let E=0;E<f.length;E++){const j=f[E];if(j.classList.contains("xterm"))break;if(j.classList.contains("xterm-hover"))return}this._lastBufferCell&&p.x===this._lastBufferCell.x&&p.y===this._lastBufferCell.y||(this._handleHover(p),this._lastBufferCell=p)}_handleHover(g){if(this._activeLine!==g.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(g,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,g)||(this._clearCurrentLink(),this._askForLink(g,!0))}_askForLink(g,p){var E,j;this._activeProviderReplies&&p||((E=this._activeProviderReplies)==null||E.forEach((x=>{x==null||x.forEach((R=>{R.link.dispose&&R.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=g.y);let f=!1;for(const[x,R]of this._linkProviderService.linkProviders.entries())p?(j=this._activeProviderReplies)!=null&&j.get(x)&&(f=this._checkLinkProviderResult(x,g,f)):R.provideLinks(g.y,(S=>{var I,P;if(this._isMouseOut)return;const L=S==null?void 0:S.map((O=>({link:O})));(I=this._activeProviderReplies)==null||I.set(x,L),f=this._checkLinkProviderResult(x,g,f),((P=this._activeProviderReplies)==null?void 0:P.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(g.y,this._activeProviderReplies)}))}_removeIntersectingLinks(g,p){const f=new Set;for(let E=0;E<p.size;E++){const j=p.get(E);if(j)for(let x=0;x<j.length;x++){const R=j[x],S=R.link.range.start.y<g?0:R.link.range.start.x,L=R.link.range.end.y>g?this._bufferService.cols:R.link.range.end.x;for(let I=S;I<=L;I++){if(f.has(I)){j.splice(x--,1);break}f.add(I)}}}}_checkLinkProviderResult(g,p,f){var x;if(!this._activeProviderReplies)return f;const E=this._activeProviderReplies.get(g);let j=!1;for(let R=0;R<g;R++)this._activeProviderReplies.has(R)&&!this._activeProviderReplies.get(R)||(j=!0);if(!j&&E){const R=E.find((S=>this._linkAtPosition(S.link,p)));R&&(f=!0,this._handleNewLink(R))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!f)for(let R=0;R<this._activeProviderReplies.size;R++){const S=(x=this._activeProviderReplies.get(R))==null?void 0:x.find((L=>this._linkAtPosition(L.link,p)));if(S){f=!0,this._handleNewLink(S);break}}return f}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(g){if(!this._currentLink)return;const p=this._positionFromMouseEvent(g,this._element,this._mouseService);p&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,p)&&this._currentLink.link.activate(g,this._currentLink.link.text)}_clearCurrentLink(g,p){this._currentLink&&this._lastMouseEvent&&(!g||!p||this._currentLink.link.range.start.y>=g&&this._currentLink.link.range.end.y<=p)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,T.disposeArray)(this._linkCacheDisposables))}_handleNewLink(g){if(!this._lastMouseEvent)return;const p=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);p&&this._linkAtPosition(g.link,p)&&(this._currentLink=g,this._currentLink.state={decorations:{underline:g.link.decorations===void 0||g.link.decorations.underline,pointerCursor:g.link.decorations===void 0||g.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,g.link,this._lastMouseEvent),g.link.decorations={},Object.defineProperties(g.link.decorations,{pointerCursor:{get:()=>{var f,E;return(E=(f=this._currentLink)==null?void 0:f.state)==null?void 0:E.decorations.pointerCursor},set:f=>{var E;(E=this._currentLink)!=null&&E.state&&this._currentLink.state.decorations.pointerCursor!==f&&(this._currentLink.state.decorations.pointerCursor=f,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",f))}},underline:{get:()=>{var f,E;return(E=(f=this._currentLink)==null?void 0:f.state)==null?void 0:E.decorations.underline},set:f=>{var E,j,x;(E=this._currentLink)!=null&&E.state&&((x=(j=this._currentLink)==null?void 0:j.state)==null?void 0:x.decorations.underline)!==f&&(this._currentLink.state.decorations.underline=f,this._currentLink.state.isHovered&&this._fireUnderlineEvent(g.link,f))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((f=>{if(!this._currentLink)return;const E=f.start===0?0:f.start+1+this._bufferService.buffer.ydisp,j=this._bufferService.buffer.ydisp+1+f.end;if(this._currentLink.link.range.start.y>=E&&this._currentLink.link.range.end.y<=j&&(this._clearCurrentLink(E,j),this._lastMouseEvent)){const x=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);x&&this._askForLink(x,!1)}}))))}_linkHover(g,p,f){var E;(E=this._currentLink)!=null&&E.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(p,!0),this._currentLink.state.decorations.pointerCursor&&g.classList.add("xterm-cursor-pointer")),p.hover&&p.hover(f,p.text)}_fireUnderlineEvent(g,p){const f=g.range,E=this._bufferService.buffer.ydisp,j=this._createLinkUnderlineEvent(f.start.x-1,f.start.y-E-1,f.end.x,f.end.y-E-1,void 0);(p?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(j)}_linkLeave(g,p,f){var E;(E=this._currentLink)!=null&&E.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(p,!1),this._currentLink.state.decorations.pointerCursor&&g.classList.remove("xterm-cursor-pointer")),p.leave&&p.leave(f,p.text)}_linkAtPosition(g,p){const f=g.range.start.y*this._bufferService.cols+g.range.start.x,E=g.range.end.y*this._bufferService.cols+g.range.end.x,j=p.y*this._bufferService.cols+p.x;return f<=j&&j<=E}_positionFromMouseEvent(g,p,f){const E=f.getCoords(g,p,this._bufferService.cols,this._bufferService.rows);if(E)return{x:E[0],y:E[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(g,p,f,E,j){return{x1:g,y1:p,x2:f,y2:E,cols:this._bufferService.cols,fg:j}}};i.Linkifier=d=m([v(1,w.IMouseService),v(2,w.IRenderService),v(3,N.IBufferService),v(4,w.ILinkProviderService)],d)},9042:(y,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.tooMuchOutput=i.promptLabel=void 0,i.promptLabel="Terminal input",i.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(y,i,c){var m=this&&this.__decorate||function(w,d,g,p){var f,E=arguments.length,j=E<3?d:p===null?p=Object.getOwnPropertyDescriptor(d,g):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(w,d,g,p);else for(var x=w.length-1;x>=0;x--)(f=w[x])&&(j=(E<3?f(j):E>3?f(d,g,j):f(d,g))||j);return E>3&&j&&Object.defineProperty(d,g,j),j},v=this&&this.__param||function(w,d){return function(g,p){d(g,p,w)}};Object.defineProperty(i,"__esModule",{value:!0}),i.OscLinkProvider=void 0;const h=c(511),b=c(2585);let T=i.OscLinkProvider=class{constructor(w,d,g){this._bufferService=w,this._optionsService=d,this._oscLinkService=g}provideLinks(w,d){var L;const g=this._bufferService.buffer.lines.get(w-1);if(!g)return void d(void 0);const p=[],f=this._optionsService.rawOptions.linkHandler,E=new h.CellData,j=g.getTrimmedLength();let x=-1,R=-1,S=!1;for(let I=0;I<j;I++)if(R!==-1||g.hasContent(I)){if(g.loadCell(I,E),E.hasExtendedAttrs()&&E.extended.urlId){if(R===-1){R=I,x=E.extended.urlId;continue}S=E.extended.urlId!==x}else R!==-1&&(S=!0);if(S||R!==-1&&I===j-1){const P=(L=this._oscLinkService.getLinkData(x))==null?void 0:L.uri;if(P){const O={start:{x:R+1,y:w},end:{x:I+(S||I!==j-1?0:1),y:w}};let B=!1;if(!(f!=null&&f.allowNonHttpProtocols))try{const $=new URL(P);["http:","https:"].includes($.protocol)||(B=!0)}catch{B=!0}B||p.push({text:P,range:O,activate:($,W)=>f?f.activate($,W,O):N(0,W),hover:($,W)=>{var K;return(K=f==null?void 0:f.hover)==null?void 0:K.call(f,$,W,O)},leave:($,W)=>{var K;return(K=f==null?void 0:f.leave)==null?void 0:K.call(f,$,W,O)}})}S=!1,E.hasExtendedAttrs()&&E.extended.urlId?(R=I,x=E.extended.urlId):(R=-1,x=-1)}}d(p)}};function N(w,d){if(confirm(`Do you want to navigate to ${d}?
|
|
118
|
+
|
|
119
|
+
WARNING: This link could potentially be dangerous`)){const g=window.open();if(g){try{g.opener=null}catch{}g.location.href=d}else console.warn("Opening link blocked as opener could not be cleared")}}i.OscLinkProvider=T=m([v(0,b.IBufferService),v(1,b.IOptionsService),v(2,b.IOscLinkService)],T)},6193:(y,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.RenderDebouncer=void 0,i.RenderDebouncer=class{constructor(c,m){this._renderCallback=c,this._coreBrowserService=m,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(c){return this._refreshCallbacks.push(c),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(c,m,v){this._rowCount=v,c=c!==void 0?c:0,m=m!==void 0?m:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,c):c,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,m):m,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)return void this._runRefreshCallbacks();const c=Math.max(this._rowStart,0),m=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(c,m),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const c of this._refreshCallbacks)c(0);this._refreshCallbacks=[]}}},3236:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Terminal=void 0;const m=c(3614),v=c(3656),h=c(3551),b=c(9042),T=c(3730),N=c(1680),w=c(3107),d=c(5744),g=c(2950),p=c(1296),f=c(428),E=c(4269),j=c(5114),x=c(8934),R=c(3230),S=c(9312),L=c(4725),I=c(6731),P=c(8055),O=c(8969),B=c(8460),$=c(844),W=c(6114),K=c(8437),Y=c(2584),V=c(7399),F=c(5941),H=c(9074),U=c(2585),z=c(5435),te=c(4567),ie=c(779);class we extends O.CoreTerminal{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}constructor(X={}){super(X),this.browser=W,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new $.MutableDisposable),this._onCursorMove=this.register(new B.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new B.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new B.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new B.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new B.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new B.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new B.EventEmitter),this._onBlur=this.register(new B.EventEmitter),this._onA11yCharEmitter=this.register(new B.EventEmitter),this._onA11yTabEmitter=this.register(new B.EventEmitter),this._onWillOpen=this.register(new B.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(H.DecorationService),this._instantiationService.setService(U.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(ie.LinkProviderService),this._instantiationService.setService(L.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(T.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((G,ee)=>this.refresh(G,ee)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((G=>this._reportWindowsOptions(G)))),this.register(this._inputHandler.onColor((G=>this._handleColorEvent(G)))),this.register((0,B.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,B.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,B.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,B.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((G=>this._afterResize(G.cols,G.rows)))),this.register((0,$.toDisposable)((()=>{var G,ee;this._customKeyEventHandler=void 0,(ee=(G=this.element)==null?void 0:G.parentNode)==null||ee.removeChild(this.element)})))}_handleColorEvent(X){if(this._themeService)for(const G of X){let ee,Z="";switch(G.index){case 256:ee="foreground",Z="10";break;case 257:ee="background",Z="11";break;case 258:ee="cursor",Z="12";break;default:ee="ansi",Z="4;"+G.index}switch(G.type){case 0:const ve=P.color.toColorRGB(ee==="ansi"?this._themeService.colors.ansi[G.index]:this._themeService.colors[ee]);this.coreService.triggerDataEvent(`${Y.C0.ESC}]${Z};${(0,F.toRgbString)(ve)}${Y.C1_ESCAPED.ST}`);break;case 1:if(ee==="ansi")this._themeService.modifyColors((Se=>Se.ansi[G.index]=P.channels.toColor(...G.color)));else{const Se=ee;this._themeService.modifyColors((Ie=>Ie[Se]=P.channels.toColor(...G.color)))}break;case 2:this._themeService.restoreColor(G.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(X){X?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(te.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(X){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Y.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var X;return(X=this.textarea)==null?void 0:X.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Y.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const X=this.buffer.ybase+this.buffer.y,G=this.buffer.lines.get(X);if(!G)return;const ee=Math.min(this.buffer.x,this.cols-1),Z=this._renderService.dimensions.css.cell.height,ve=G.getWidth(ee),Se=this._renderService.dimensions.css.cell.width*ve,Ie=this.buffer.y*this._renderService.dimensions.css.cell.height,je=ee*this._renderService.dimensions.css.cell.width;this.textarea.style.left=je+"px",this.textarea.style.top=Ie+"px",this.textarea.style.width=Se+"px",this.textarea.style.height=Z+"px",this.textarea.style.lineHeight=Z+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,v.addDisposableDomListener)(this.element,"copy",(G=>{this.hasSelection()&&(0,m.copyHandler)(G,this._selectionService)})));const X=G=>(0,m.handlePasteEvent)(G,this.textarea,this.coreService,this.optionsService);this.register((0,v.addDisposableDomListener)(this.textarea,"paste",X)),this.register((0,v.addDisposableDomListener)(this.element,"paste",X)),W.isFirefox?this.register((0,v.addDisposableDomListener)(this.element,"mousedown",(G=>{G.button===2&&(0,m.rightClickHandler)(G,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,v.addDisposableDomListener)(this.element,"contextmenu",(G=>{(0,m.rightClickHandler)(G,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),W.isLinux&&this.register((0,v.addDisposableDomListener)(this.element,"auxclick",(G=>{G.button===1&&(0,m.moveTextAreaUnderMouseCursor)(G,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,v.addDisposableDomListener)(this.textarea,"keyup",(X=>this._keyUp(X)),!0)),this.register((0,v.addDisposableDomListener)(this.textarea,"keydown",(X=>this._keyDown(X)),!0)),this.register((0,v.addDisposableDomListener)(this.textarea,"keypress",(X=>this._keyPress(X)),!0)),this.register((0,v.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,v.addDisposableDomListener)(this.textarea,"compositionupdate",(X=>this._compositionHelper.compositionupdate(X)))),this.register((0,v.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,v.addDisposableDomListener)(this.textarea,"input",(X=>this._inputEvent(X)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(X){var ee;if(!X)throw new Error("Terminal requires a parent element.");if(X.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((ee=this.element)==null?void 0:ee.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=X.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"),X.appendChild(this.element);const G=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),G.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,v.addDisposableDomListener)(this.screenElement,"mousemove",(Z=>this.updateCursorStyle(Z)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),G.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",b.promptLabel),W.isChromeOS||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._coreBrowserService=this.register(this._instantiationService.createInstance(j.CoreBrowserService,this.textarea,X.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(L.ICoreBrowserService,this._coreBrowserService),this.register((0,v.addDisposableDomListener)(this.textarea,"focus",(Z=>this._handleTextAreaFocus(Z)))),this.register((0,v.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(f.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(L.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(I.ThemeService),this._instantiationService.setService(L.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(E.CharacterJoinerService),this._instantiationService.setService(L.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(R.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(L.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((Z=>this._onRender.fire(Z)))),this.onResize((Z=>this._renderService.resize(Z.cols,Z.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(g.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(x.MouseService),this._instantiationService.setService(L.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(h.Linkifier,this.screenElement)),this.element.appendChild(G);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(N.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((Z=>this.scrollLines(Z.amount,Z.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),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.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(S.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(L.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((Z=>this.scrollLines(Z.amount,Z.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((Z=>this._renderService.handleSelectionChanged(Z.start,Z.end,Z.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((Z=>{this.textarea.value=Z,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((Z=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,v.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(w.BufferDecorationRenderer,this.screenElement)),this.register((0,v.addDisposableDomListener)(this.element,"mousedown",(Z=>this._selectionService.handleMouseDown(Z)))),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(te.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(Z=>this._handleScreenReaderModeOptionChange(Z)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(d.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(Z=>{!this._overviewRulerRenderer&&Z&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(d.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(p.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const X=this,G=this.element;function ee(Se){const Ie=X._mouseService.getMouseReportCoords(Se,X.screenElement);if(!Ie)return!1;let je,Je;switch(Se.overrideType||Se.type){case"mousemove":Je=32,Se.buttons===void 0?(je=3,Se.button!==void 0&&(je=Se.button<3?Se.button:3)):je=1&Se.buttons?0:4&Se.buttons?1:2&Se.buttons?2:3;break;case"mouseup":Je=0,je=Se.button<3?Se.button:3;break;case"mousedown":Je=1,je=Se.button<3?Se.button:3;break;case"wheel":if(X._customWheelEventHandler&&X._customWheelEventHandler(Se)===!1||X.viewport.getLinesScrolled(Se)===0)return!1;Je=Se.deltaY<0?0:1,je=4;break;default:return!1}return!(Je===void 0||je===void 0||je>4)&&X.coreMouseService.triggerMouseEvent({col:Ie.col,row:Ie.row,x:Ie.x,y:Ie.y,button:je,action:Je,ctrl:Se.ctrlKey,alt:Se.altKey,shift:Se.shiftKey})}const Z={mouseup:null,wheel:null,mousedrag:null,mousemove:null},ve={mouseup:Se=>(ee(Se),Se.buttons||(this._document.removeEventListener("mouseup",Z.mouseup),Z.mousedrag&&this._document.removeEventListener("mousemove",Z.mousedrag)),this.cancel(Se)),wheel:Se=>(ee(Se),this.cancel(Se,!0)),mousedrag:Se=>{Se.buttons&&ee(Se)},mousemove:Se=>{Se.buttons||ee(Se)}};this.register(this.coreMouseService.onProtocolChange((Se=>{Se?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(Se)),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()),8&Se?Z.mousemove||(G.addEventListener("mousemove",ve.mousemove),Z.mousemove=ve.mousemove):(G.removeEventListener("mousemove",Z.mousemove),Z.mousemove=null),16&Se?Z.wheel||(G.addEventListener("wheel",ve.wheel,{passive:!1}),Z.wheel=ve.wheel):(G.removeEventListener("wheel",Z.wheel),Z.wheel=null),2&Se?Z.mouseup||(Z.mouseup=ve.mouseup):(this._document.removeEventListener("mouseup",Z.mouseup),Z.mouseup=null),4&Se?Z.mousedrag||(Z.mousedrag=ve.mousedrag):(this._document.removeEventListener("mousemove",Z.mousedrag),Z.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,v.addDisposableDomListener)(G,"mousedown",(Se=>{if(Se.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(Se))return ee(Se),Z.mouseup&&this._document.addEventListener("mouseup",Z.mouseup),Z.mousedrag&&this._document.addEventListener("mousemove",Z.mousedrag),this.cancel(Se)}))),this.register((0,v.addDisposableDomListener)(G,"wheel",(Se=>{if(!Z.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(Se)===!1)return!1;if(!this.buffer.hasScrollback){const Ie=this.viewport.getLinesScrolled(Se);if(Ie===0)return;const je=Y.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(Se.deltaY<0?"A":"B");let Je="";for(let tt=0;tt<Math.abs(Ie);tt++)Je+=je;return this.coreService.triggerDataEvent(Je,!0),this.cancel(Se,!0)}return this.viewport.handleWheel(Se)?this.cancel(Se):void 0}}),{passive:!1})),this.register((0,v.addDisposableDomListener)(G,"touchstart",(Se=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(Se),this.cancel(Se)}),{passive:!0})),this.register((0,v.addDisposableDomListener)(G,"touchmove",(Se=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(Se)?void 0:this.cancel(Se)}),{passive:!1}))}refresh(X,G){var ee;(ee=this._renderService)==null||ee.refreshRows(X,G)}updateCursorStyle(X){var G;(G=this._selectionService)!=null&&G.shouldColumnSelect(X)?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(X,G,ee=0){var Z;ee===1?(super.scrollLines(X,G,ee),this.refresh(0,this.rows-1)):(Z=this.viewport)==null||Z.scrollLines(X)}paste(X){(0,m.paste)(X,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(X){this._customKeyEventHandler=X}attachCustomWheelEventHandler(X){this._customWheelEventHandler=X}registerLinkProvider(X){return this._linkProviderService.registerLinkProvider(X)}registerCharacterJoiner(X){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const G=this._characterJoinerService.register(X);return this.refresh(0,this.rows-1),G}deregisterCharacterJoiner(X){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(X)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(X){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+X)}registerDecoration(X){return this._decorationService.registerDecoration(X)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(X,G,ee){this._selectionService.setSelection(X,G,ee)}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(){var X;(X=this._selectionService)==null||X.clearSelection()}selectAll(){var X;(X=this._selectionService)==null||X.selectAll()}selectLines(X,G){var ee;(ee=this._selectionService)==null||ee.selectLines(X,G)}_keyDown(X){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1)return!1;const G=this.browser.isMac&&this.options.macOptionIsMeta&&X.altKey;if(!G&&!this._compositionHelper.keydown(X))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;G||X.key!=="Dead"&&X.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const ee=(0,V.evaluateKeyboardEvent)(X,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(X),ee.type===3||ee.type===2){const Z=this.rows-1;return this.scrollLines(ee.type===2?-Z:Z),this.cancel(X,!0)}return ee.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,X)||(ee.cancel&&this.cancel(X,!0),!ee.key||!!(X.key&&!X.ctrlKey&&!X.altKey&&!X.metaKey&&X.key.length===1&&X.key.charCodeAt(0)>=65&&X.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(ee.key!==Y.C0.ETX&&ee.key!==Y.C0.CR||(this.textarea.value=""),this._onKey.fire({key:ee.key,domEvent:X}),this._showCursor(),this.coreService.triggerDataEvent(ee.key,!0),!this.optionsService.rawOptions.screenReaderMode||X.altKey||X.ctrlKey?this.cancel(X,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(X,G){const ee=X.isMac&&!this.options.macOptionIsMeta&&G.altKey&&!G.ctrlKey&&!G.metaKey||X.isWindows&&G.altKey&&G.ctrlKey&&!G.metaKey||X.isWindows&&G.getModifierState("AltGraph");return G.type==="keypress"?ee:ee&&(!G.keyCode||G.keyCode>47)}_keyUp(X){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1||((function(G){return G.keyCode===16||G.keyCode===17||G.keyCode===18})(X)||this.focus(),this.updateCursorStyle(X),this._keyPressHandled=!1)}_keyPress(X){let G;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1)return!1;if(this.cancel(X),X.charCode)G=X.charCode;else if(X.which===null||X.which===void 0)G=X.keyCode;else{if(X.which===0||X.charCode===0)return!1;G=X.which}return!(!G||(X.altKey||X.ctrlKey||X.metaKey)&&!this._isThirdLevelShift(this.browser,X)||(G=String.fromCharCode(G),this._onKey.fire({key:G,domEvent:X}),this._showCursor(),this.coreService.triggerDataEvent(G,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(X){if(X.data&&X.inputType==="insertText"&&(!X.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const G=X.data;return this.coreService.triggerDataEvent(G,!0),this.cancel(X),!0}return!1}resize(X,G){X!==this.cols||G!==this.rows?super.resize(X,G):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(X,G){var ee,Z;(ee=this._charSizeService)==null||ee.measure(),(Z=this.viewport)==null||Z.syncScrollArea(!0)}clear(){var X;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 G=1;G<this.rows;G++)this.buffer.lines.push(this.buffer.getBlankLine(K.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(X=this.viewport)==null||X.reset(),this.refresh(0,this.rows-1)}}reset(){var G,ee;this.options.rows=this.rows,this.options.cols=this.cols;const X=this._customKeyEventHandler;this._setup(),super.reset(),(G=this._selectionService)==null||G.reset(),this._decorationService.reset(),(ee=this.viewport)==null||ee.reset(),this._customKeyEventHandler=X,this.refresh(0,this.rows-1)}clearTextureAtlas(){var X;(X=this._renderService)==null||X.clearTextureAtlas()}_reportFocus(){var X;(X=this.element)!=null&&X.classList.contains("focus")?this.coreService.triggerDataEvent(Y.C0.ESC+"[I"):this.coreService.triggerDataEvent(Y.C0.ESC+"[O")}_reportWindowsOptions(X){if(this._renderService)switch(X){case z.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const G=this._renderService.dimensions.css.canvas.width.toFixed(0),ee=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${Y.C0.ESC}[4;${ee};${G}t`);break;case z.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const Z=this._renderService.dimensions.css.cell.width.toFixed(0),ve=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${Y.C0.ESC}[6;${ve};${Z}t`)}}cancel(X,G){if(this.options.cancelEvents||G)return X.preventDefault(),X.stopPropagation(),!1}}i.Terminal=we},9924:(y,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.TimeBasedDebouncer=void 0,i.TimeBasedDebouncer=class{constructor(c,m=1e3){this._renderCallback=c,this._debounceThresholdMS=m,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(c,m,v){this._rowCount=v,c=c!==void 0?c:0,m=m!==void 0?m:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,c):c,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,m):m;const h=Date.now();if(h-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=h,this._innerRefresh();else if(!this._additionalRefreshRequested){const b=h-this._lastRefreshMs,T=this._debounceThresholdMS-b;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.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;const c=Math.max(this._rowStart,0),m=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(c,m)}}},1680:function(y,i,c){var m=this&&this.__decorate||function(g,p,f,E){var j,x=arguments.length,R=x<3?p:E===null?E=Object.getOwnPropertyDescriptor(p,f):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(g,p,f,E);else for(var S=g.length-1;S>=0;S--)(j=g[S])&&(R=(x<3?j(R):x>3?j(p,f,R):j(p,f))||R);return x>3&&R&&Object.defineProperty(p,f,R),R},v=this&&this.__param||function(g,p){return function(f,E){p(f,E,g)}};Object.defineProperty(i,"__esModule",{value:!0}),i.Viewport=void 0;const h=c(3656),b=c(4725),T=c(8460),N=c(844),w=c(2585);let d=i.Viewport=class extends N.Disposable{constructor(g,p,f,E,j,x,R,S){super(),this._viewportElement=g,this._scrollArea=p,this._bufferService=f,this._optionsService=E,this._charSizeService=j,this._renderService=x,this._coreBrowserService=R,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new T.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,h.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((L=>this._activeBuffer=L.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((L=>this._renderDimensions=L))),this._handleThemeChange(S.colors),this.register(S.onChangeColors((L=>this._handleThemeChange(L)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(g){this._viewportElement.style.backgroundColor=g.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(g){if(g)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const p=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==p&&(this._lastRecordedBufferHeight=p,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const g=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==g&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=g),this._refreshAnimationFrame=null}syncScrollArea(g=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(g);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(g)}_handleScroll(g){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const p=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:p,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const g=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(g*(this._smoothScrollState.target-this._smoothScrollState.origin)),g<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(g,p){const f=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(p<0&&this._viewportElement.scrollTop!==0||p>0&&f<this._lastRecordedBufferHeight)||(g.cancelable&&g.preventDefault(),!1)}handleWheel(g){const p=this._getPixelsScrolled(g);return p!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+p:this._smoothScrollState.target+=p,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=p,this._bubbleScroll(g,p))}scrollLines(g){if(g!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const p=g*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+p,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:g,suppressScrollEvent:!1})}_getPixelsScrolled(g){if(g.deltaY===0||g.shiftKey)return 0;let p=this._applyScrollModifier(g.deltaY,g);return g.deltaMode===WheelEvent.DOM_DELTA_LINE?p*=this._currentRowHeight:g.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(p*=this._currentRowHeight*this._bufferService.rows),p}getBufferElements(g,p){var S;let f,E="";const j=[],x=p??this._bufferService.buffer.lines.length,R=this._bufferService.buffer.lines;for(let L=g;L<x;L++){const I=R.get(L);if(!I)continue;const P=(S=R.get(L+1))==null?void 0:S.isWrapped;if(E+=I.translateToString(!P),!P||L===R.length-1){const O=document.createElement("div");O.textContent=E,j.push(O),E.length>0&&(f=O),E=""}}return{bufferElements:j,cursorElement:f}}getLinesScrolled(g){if(g.deltaY===0||g.shiftKey)return 0;let p=this._applyScrollModifier(g.deltaY,g);return g.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(p/=this._currentRowHeight+0,this._wheelPartialScroll+=p,p=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):g.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(p*=this._bufferService.rows),p}_applyScrollModifier(g,p){const f=this._optionsService.rawOptions.fastScrollModifier;return f==="alt"&&p.altKey||f==="ctrl"&&p.ctrlKey||f==="shift"&&p.shiftKey?g*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:g*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(g){this._lastTouchY=g.touches[0].pageY}handleTouchMove(g){const p=this._lastTouchY-g.touches[0].pageY;return this._lastTouchY=g.touches[0].pageY,p!==0&&(this._viewportElement.scrollTop+=p,this._bubbleScroll(g,p))}};i.Viewport=d=m([v(2,w.IBufferService),v(3,w.IOptionsService),v(4,b.ICharSizeService),v(5,b.IRenderService),v(6,b.ICoreBrowserService),v(7,b.IThemeService)],d)},3107:function(y,i,c){var m=this&&this.__decorate||function(w,d,g,p){var f,E=arguments.length,j=E<3?d:p===null?p=Object.getOwnPropertyDescriptor(d,g):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(w,d,g,p);else for(var x=w.length-1;x>=0;x--)(f=w[x])&&(j=(E<3?f(j):E>3?f(d,g,j):f(d,g))||j);return E>3&&j&&Object.defineProperty(d,g,j),j},v=this&&this.__param||function(w,d){return function(g,p){d(g,p,w)}};Object.defineProperty(i,"__esModule",{value:!0}),i.BufferDecorationRenderer=void 0;const h=c(4725),b=c(844),T=c(2585);let N=i.BufferDecorationRenderer=class extends b.Disposable{constructor(w,d,g,p,f){super(),this._screenElement=w,this._bufferService=d,this._coreBrowserService=g,this._decorationService=p,this._renderService=f,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((0,b.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const w of this._decorationService.decorations)this._renderDecoration(w);this._dimensionsChanged=!1}_renderDecoration(w){this._refreshStyle(w),this._dimensionsChanged&&this._refreshXPosition(w)}_createElement(w){var p;const d=this._coreBrowserService.mainDocument.createElement("div");d.classList.add("xterm-decoration"),d.classList.toggle("xterm-decoration-top-layer",((p=w==null?void 0:w.options)==null?void 0:p.layer)==="top"),d.style.width=`${Math.round((w.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,d.style.height=(w.options.height||1)*this._renderService.dimensions.css.cell.height+"px",d.style.top=(w.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",d.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const g=w.options.x??0;return g&&g>this._bufferService.cols&&(d.style.display="none"),this._refreshXPosition(w,d),d}_refreshStyle(w){const d=w.marker.line-this._bufferService.buffers.active.ydisp;if(d<0||d>=this._bufferService.rows)w.element&&(w.element.style.display="none",w.onRenderEmitter.fire(w.element));else{let g=this._decorationElements.get(w);g||(g=this._createElement(w),w.element=g,this._decorationElements.set(w,g),this._container.appendChild(g),w.onDispose((()=>{this._decorationElements.delete(w),g.remove()}))),g.style.top=d*this._renderService.dimensions.css.cell.height+"px",g.style.display=this._altBufferIsActive?"none":"block",w.onRenderEmitter.fire(g)}}_refreshXPosition(w,d=w.element){if(!d)return;const g=w.options.x??0;(w.options.anchor||"left")==="right"?d.style.right=g?g*this._renderService.dimensions.css.cell.width+"px":"":d.style.left=g?g*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(w){var d;(d=this._decorationElements.get(w))==null||d.remove(),this._decorationElements.delete(w),w.dispose()}};i.BufferDecorationRenderer=N=m([v(1,T.IBufferService),v(2,h.ICoreBrowserService),v(3,T.IDecorationService),v(4,h.IRenderService)],N)},5871:(y,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ColorZoneStore=void 0,i.ColorZoneStore=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(c){if(c.options.overviewRulerOptions){for(const m of this._zones)if(m.color===c.options.overviewRulerOptions.color&&m.position===c.options.overviewRulerOptions.position){if(this._lineIntersectsZone(m,c.marker.line))return;if(this._lineAdjacentToZone(m,c.marker.line,c.options.overviewRulerOptions.position))return void this._addLineToZone(m,c.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=c.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=c.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=c.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=c.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:c.options.overviewRulerOptions.color,position:c.options.overviewRulerOptions.position,startBufferLine:c.marker.line,endBufferLine:c.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(c){this._linePadding=c}_lineIntersectsZone(c,m){return m>=c.startBufferLine&&m<=c.endBufferLine}_lineAdjacentToZone(c,m,v){return m>=c.startBufferLine-this._linePadding[v||"full"]&&m<=c.endBufferLine+this._linePadding[v||"full"]}_addLineToZone(c,m){c.startBufferLine=Math.min(c.startBufferLine,m),c.endBufferLine=Math.max(c.endBufferLine,m)}}},5744:function(y,i,c){var m=this&&this.__decorate||function(f,E,j,x){var R,S=arguments.length,L=S<3?E:x===null?x=Object.getOwnPropertyDescriptor(E,j):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(f,E,j,x);else for(var I=f.length-1;I>=0;I--)(R=f[I])&&(L=(S<3?R(L):S>3?R(E,j,L):R(E,j))||L);return S>3&&L&&Object.defineProperty(E,j,L),L},v=this&&this.__param||function(f,E){return function(j,x){E(j,x,f)}};Object.defineProperty(i,"__esModule",{value:!0}),i.OverviewRulerRenderer=void 0;const h=c(5871),b=c(4725),T=c(844),N=c(2585),w={full:0,left:0,center:0,right:0},d={full:0,left:0,center:0,right:0},g={full:0,left:0,center:0,right:0};let p=i.OverviewRulerRenderer=class extends T.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(f,E,j,x,R,S,L){var P;super(),this._viewportElement=f,this._screenElement=E,this._bufferService=j,this._decorationService=x,this._renderService=R,this._optionsService=S,this._coreBrowserService=L,this._colorZoneStore=new h.ColorZoneStore,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(),(P=this._viewportElement.parentElement)==null||P.insertBefore(this._canvas,this._viewportElement);const I=this._canvas.getContext("2d");if(!I)throw new Error("Ctx cannot be null");this._ctx=I,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,T.toDisposable)((()=>{var O;(O=this._canvas)==null||O.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){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())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const f=Math.floor(this._canvas.width/3),E=Math.ceil(this._canvas.width/3);d.full=this._canvas.width,d.left=f,d.center=E,d.right=f,this._refreshDrawHeightConstants(),g.full=0,g.left=0,g.center=d.left,g.right=d.left+d.center}_refreshDrawHeightConstants(){w.full=Math.round(2*this._coreBrowserService.dpr);const f=this._canvas.height/this._bufferService.buffer.lines.length,E=Math.round(Math.max(Math.min(f,12),6)*this._coreBrowserService.dpr);w.left=E,w.center=E,w.right=E}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*w.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*w.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*w.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*w.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(const E of this._decorationService.decorations)this._colorZoneStore.addDecoration(E);this._ctx.lineWidth=1;const f=this._colorZoneStore.zones;for(const E of f)E.position!=="full"&&this._renderColorZone(E);for(const E of f)E.position==="full"&&this._renderColorZone(E);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(f){this._ctx.fillStyle=f.color,this._ctx.fillRect(g[f.position||"full"],Math.round((this._canvas.height-1)*(f.startBufferLine/this._bufferService.buffers.active.lines.length)-w[f.position||"full"]/2),d[f.position||"full"],Math.round((this._canvas.height-1)*((f.endBufferLine-f.startBufferLine)/this._bufferService.buffers.active.lines.length)+w[f.position||"full"]))}_queueRefresh(f,E){this._shouldUpdateDimensions=f||this._shouldUpdateDimensions,this._shouldUpdateAnchor=E||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};i.OverviewRulerRenderer=p=m([v(2,N.IBufferService),v(3,N.IDecorationService),v(4,b.IRenderService),v(5,N.IOptionsService),v(6,b.ICoreBrowserService)],p)},2950:function(y,i,c){var m=this&&this.__decorate||function(w,d,g,p){var f,E=arguments.length,j=E<3?d:p===null?p=Object.getOwnPropertyDescriptor(d,g):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(w,d,g,p);else for(var x=w.length-1;x>=0;x--)(f=w[x])&&(j=(E<3?f(j):E>3?f(d,g,j):f(d,g))||j);return E>3&&j&&Object.defineProperty(d,g,j),j},v=this&&this.__param||function(w,d){return function(g,p){d(g,p,w)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CompositionHelper=void 0;const h=c(4725),b=c(2585),T=c(2584);let N=i.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(w,d,g,p,f,E){this._textarea=w,this._compositionView=d,this._bufferService=g,this._optionsService=p,this._coreService=f,this._renderService=E,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(w){this._compositionView.textContent=w.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(w){if(this._isComposing||this._isSendingComposition){if(w.keyCode===229||w.keyCode===16||w.keyCode===17||w.keyCode===18)return!1;this._finalizeComposition(!1)}return w.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(w){if(this._compositionView.classList.remove("active"),this._isComposing=!1,w){const d={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let g;this._isSendingComposition=!1,d.start+=this._dataAlreadySent.length,g=this._isComposing?this._textarea.value.substring(d.start,d.end):this._textarea.value.substring(d.start),g.length>0&&this._coreService.triggerDataEvent(g,!0)}}),0)}else{this._isSendingComposition=!1;const d=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(d,!0)}}_handleAnyTextareaChanges(){const w=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const d=this._textarea.value,g=d.replace(w,"");this._dataAlreadySent=g,d.length>w.length?this._coreService.triggerDataEvent(g,!0):d.length<w.length?this._coreService.triggerDataEvent(`${T.C0.DEL}`,!0):d.length===w.length&&d!==w&&this._coreService.triggerDataEvent(d,!0)}}),0)}updateCompositionElements(w){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const d=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),g=this._renderService.dimensions.css.cell.height,p=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,f=d*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=f+"px",this._compositionView.style.top=p+"px",this._compositionView.style.height=g+"px",this._compositionView.style.lineHeight=g+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const E=this._compositionView.getBoundingClientRect();this._textarea.style.left=f+"px",this._textarea.style.top=p+"px",this._textarea.style.width=Math.max(E.width,1)+"px",this._textarea.style.height=Math.max(E.height,1)+"px",this._textarea.style.lineHeight=E.height+"px"}w||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};i.CompositionHelper=N=m([v(2,b.IBufferService),v(3,b.IOptionsService),v(4,b.ICoreService),v(5,h.IRenderService)],N)},9806:(y,i)=>{function c(m,v,h){const b=h.getBoundingClientRect(),T=m.getComputedStyle(h),N=parseInt(T.getPropertyValue("padding-left")),w=parseInt(T.getPropertyValue("padding-top"));return[v.clientX-b.left-N,v.clientY-b.top-w]}Object.defineProperty(i,"__esModule",{value:!0}),i.getCoords=i.getCoordsRelativeToElement=void 0,i.getCoordsRelativeToElement=c,i.getCoords=function(m,v,h,b,T,N,w,d,g){if(!N)return;const p=c(m,v,h);return p?(p[0]=Math.ceil((p[0]+(g?w/2:0))/w),p[1]=Math.ceil(p[1]/d),p[0]=Math.min(Math.max(p[0],1),b+(g?1:0)),p[1]=Math.min(Math.max(p[1],1),T),p):void 0}},9504:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.moveToCellSequence=void 0;const m=c(2584);function v(d,g,p,f){const E=d-h(d,p),j=g-h(g,p),x=Math.abs(E-j)-(function(R,S,L){let I=0;const P=R-h(R,L),O=S-h(S,L);for(let B=0;B<Math.abs(P-O);B++){const $=b(R,S)==="A"?-1:1,W=L.buffer.lines.get(P+$*B);W!=null&&W.isWrapped&&I++}return I})(d,g,p);return w(x,N(b(d,g),f))}function h(d,g){let p=0,f=g.buffer.lines.get(d),E=f==null?void 0:f.isWrapped;for(;E&&d>=0&&d<g.rows;)p++,f=g.buffer.lines.get(--d),E=f==null?void 0:f.isWrapped;return p}function b(d,g){return d>g?"A":"B"}function T(d,g,p,f,E,j){let x=d,R=g,S="";for(;x!==p||R!==f;)x+=E?1:-1,E&&x>j.cols-1?(S+=j.buffer.translateBufferLineToString(R,!1,d,x),x=0,d=0,R++):!E&&x<0&&(S+=j.buffer.translateBufferLineToString(R,!1,0,d+1),x=j.cols-1,d=x,R--);return S+j.buffer.translateBufferLineToString(R,!1,d,x)}function N(d,g){const p=g?"O":"[";return m.C0.ESC+p+d}function w(d,g){d=Math.floor(d);let p="";for(let f=0;f<d;f++)p+=g;return p}i.moveToCellSequence=function(d,g,p,f){const E=p.buffer.x,j=p.buffer.y;if(!p.buffer.hasScrollback)return(function(S,L,I,P,O,B){return v(L,P,O,B).length===0?"":w(T(S,L,S,L-h(L,O),!1,O).length,N("D",B))})(E,j,0,g,p,f)+v(j,g,p,f)+(function(S,L,I,P,O,B){let $;$=v(L,P,O,B).length>0?P-h(P,O):L;const W=P,K=(function(Y,V,F,H,U,z){let te;return te=v(F,H,U,z).length>0?H-h(H,U):V,Y<F&&te<=H||Y>=F&&te<H?"C":"D"})(S,L,I,P,O,B);return w(T(S,$,I,W,K==="C",O).length,N(K,B))})(E,j,d,g,p,f);let x;if(j===g)return x=E>d?"D":"C",w(Math.abs(E-d),N(x,f));x=j>g?"D":"C";const R=Math.abs(j-g);return w((function(S,L){return L.cols-S})(j>g?d:E,p)+(R-1)*p.cols+1+((j>g?E:d)-1),N(x,f))}},1296:function(y,i,c){var m=this&&this.__decorate||function(B,$,W,K){var Y,V=arguments.length,F=V<3?$:K===null?K=Object.getOwnPropertyDescriptor($,W):K;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")F=Reflect.decorate(B,$,W,K);else for(var H=B.length-1;H>=0;H--)(Y=B[H])&&(F=(V<3?Y(F):V>3?Y($,W,F):Y($,W))||F);return V>3&&F&&Object.defineProperty($,W,F),F},v=this&&this.__param||function(B,$){return function(W,K){$(W,K,B)}};Object.defineProperty(i,"__esModule",{value:!0}),i.DomRenderer=void 0;const h=c(3787),b=c(2550),T=c(2223),N=c(6171),w=c(6052),d=c(4725),g=c(8055),p=c(8460),f=c(844),E=c(2585),j="xterm-dom-renderer-owner-",x="xterm-rows",R="xterm-fg-",S="xterm-bg-",L="xterm-focus",I="xterm-selection";let P=1,O=i.DomRenderer=class extends f.Disposable{constructor(B,$,W,K,Y,V,F,H,U,z,te,ie,we){super(),this._terminal=B,this._document=$,this._element=W,this._screenElement=K,this._viewportElement=Y,this._helperContainer=V,this._linkifier2=F,this._charSizeService=U,this._optionsService=z,this._bufferService=te,this._coreBrowserService=ie,this._themeService=we,this._terminalClass=P++,this._rowElements=[],this._selectionRenderModel=(0,w.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new p.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(x),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(I),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,N.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((ge=>this._injectCss(ge)))),this._injectCss(this._themeService.colors),this._rowFactory=H.createInstance(h.DomRendererRowFactory,document),this._element.classList.add(j+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((ge=>this._handleLinkHover(ge)))),this.register(this._linkifier2.onHideLinkUnderline((ge=>this._handleLinkLeave(ge)))),this.register((0,f.toDisposable)((()=>{this._element.classList.remove(j+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new b.WidthCache(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(){const B=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*B,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*B),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/B),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/B),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(const W of this._rowElements)W.style.width=`${this.dimensions.css.canvas.width}px`,W.style.height=`${this.dimensions.css.cell.height}px`,W.style.lineHeight=`${this.dimensions.css.cell.height}px`,W.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const $=`${this._terminalSelector} .${x} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=$,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(B){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let $=`${this._terminalSelector} .${x} { color: ${B.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;$+=`${this._terminalSelector} .${x} .xterm-dim { color: ${g.color.multiplyOpacity(B.foreground,.5).css};}`,$+=`${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;}`;const W=`blink_underline_${this._terminalClass}`,K=`blink_bar_${this._terminalClass}`,Y=`blink_block_${this._terminalClass}`;$+=`@keyframes ${W} { 50% { border-bottom-style: hidden; }}`,$+=`@keyframes ${K} { 50% { box-shadow: none; }}`,$+=`@keyframes ${Y} { 0% { background-color: ${B.cursor.css}; color: ${B.cursorAccent.css}; } 50% { background-color: inherit; color: ${B.cursor.css}; }}`,$+=`${this._terminalSelector} .${x}.${L} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${W} 1s step-end infinite;}${this._terminalSelector} .${x}.${L} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${K} 1s step-end infinite;}${this._terminalSelector} .${x}.${L} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${Y} 1s step-end infinite;}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-block { background-color: ${B.cursor.css}; color: ${B.cursorAccent.css};}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${B.cursor.css} !important; color: ${B.cursorAccent.css} !important;}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${B.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${B.cursor.css} inset;}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${B.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,$+=`${this._terminalSelector} .${I} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${I} div { position: absolute; background-color: ${B.selectionBackgroundOpaque.css};}${this._terminalSelector} .${I} div { position: absolute; background-color: ${B.selectionInactiveBackgroundOpaque.css};}`;for(const[V,F]of B.ansi.entries())$+=`${this._terminalSelector} .${R}${V} { color: ${F.css}; }${this._terminalSelector} .${R}${V}.xterm-dim { color: ${g.color.multiplyOpacity(F,.5).css}; }${this._terminalSelector} .${S}${V} { background-color: ${F.css}; }`;$+=`${this._terminalSelector} .${R}${T.INVERTED_DEFAULT_COLOR} { color: ${g.color.opaque(B.background).css}; }${this._terminalSelector} .${R}${T.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${g.color.multiplyOpacity(g.color.opaque(B.background),.5).css}; }${this._terminalSelector} .${S}${T.INVERTED_DEFAULT_COLOR} { background-color: ${B.foreground.css}; }`,this._themeStyleElement.textContent=$}_setDefaultSpacing(){const B=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${B}px`,this._rowFactory.defaultSpacing=B}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(B,$){for(let W=this._rowElements.length;W<=$;W++){const K=this._document.createElement("div");this._rowContainer.appendChild(K),this._rowElements.push(K)}for(;this._rowElements.length>$;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(B,$){this._refreshRowElements(B,$),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(L),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(L),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(B,$,W){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(B,$,W),this.renderRows(0,this._bufferService.rows-1),!B||!$)return;this._selectionRenderModel.update(this._terminal,B,$,W);const K=this._selectionRenderModel.viewportStartRow,Y=this._selectionRenderModel.viewportEndRow,V=this._selectionRenderModel.viewportCappedStartRow,F=this._selectionRenderModel.viewportCappedEndRow;if(V>=this._bufferService.rows||F<0)return;const H=this._document.createDocumentFragment();if(W){const U=B[0]>$[0];H.appendChild(this._createSelectionElement(V,U?$[0]:B[0],U?B[0]:$[0],F-V+1))}else{const U=K===V?B[0]:0,z=V===Y?$[0]:this._bufferService.cols;H.appendChild(this._createSelectionElement(V,U,z));const te=F-V-1;if(H.appendChild(this._createSelectionElement(V+1,0,this._bufferService.cols,te)),V!==F){const ie=Y===F?$[0]:this._bufferService.cols;H.appendChild(this._createSelectionElement(F,0,ie))}}this._selectionContainer.appendChild(H)}_createSelectionElement(B,$,W,K=1){const Y=this._document.createElement("div"),V=$*this.dimensions.css.cell.width;let F=this.dimensions.css.cell.width*(W-$);return V+F>this.dimensions.css.canvas.width&&(F=this.dimensions.css.canvas.width-V),Y.style.height=K*this.dimensions.css.cell.height+"px",Y.style.top=B*this.dimensions.css.cell.height+"px",Y.style.left=`${V}px`,Y.style.width=`${F}px`,Y}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(const B of this._rowElements)B.replaceChildren()}renderRows(B,$){const W=this._bufferService.buffer,K=W.ybase+W.y,Y=Math.min(W.x,this._bufferService.cols-1),V=this._optionsService.rawOptions.cursorBlink,F=this._optionsService.rawOptions.cursorStyle,H=this._optionsService.rawOptions.cursorInactiveStyle;for(let U=B;U<=$;U++){const z=U+W.ydisp,te=this._rowElements[U],ie=W.lines.get(z);if(!te||!ie)break;te.replaceChildren(...this._rowFactory.createRow(ie,z,z===K,F,H,Y,V,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${j}${this._terminalClass}`}_handleLinkHover(B){this._setCellUnderline(B.x1,B.x2,B.y1,B.y2,B.cols,!0)}_handleLinkLeave(B){this._setCellUnderline(B.x1,B.x2,B.y1,B.y2,B.cols,!1)}_setCellUnderline(B,$,W,K,Y,V){W<0&&(B=0),K<0&&($=0);const F=this._bufferService.rows-1;W=Math.max(Math.min(W,F),0),K=Math.max(Math.min(K,F),0),Y=Math.min(Y,this._bufferService.cols);const H=this._bufferService.buffer,U=H.ybase+H.y,z=Math.min(H.x,Y-1),te=this._optionsService.rawOptions.cursorBlink,ie=this._optionsService.rawOptions.cursorStyle,we=this._optionsService.rawOptions.cursorInactiveStyle;for(let ge=W;ge<=K;++ge){const X=ge+H.ydisp,G=this._rowElements[ge],ee=H.lines.get(X);if(!G||!ee)break;G.replaceChildren(...this._rowFactory.createRow(ee,X,X===U,ie,we,z,te,this.dimensions.css.cell.width,this._widthCache,V?ge===W?B:0:-1,V?(ge===K?$:Y)-1:-1))}}};i.DomRenderer=O=m([v(7,E.IInstantiationService),v(8,d.ICharSizeService),v(9,E.IOptionsService),v(10,E.IBufferService),v(11,d.ICoreBrowserService),v(12,d.IThemeService)],O)},3787:function(y,i,c){var m=this&&this.__decorate||function(x,R,S,L){var I,P=arguments.length,O=P<3?R:L===null?L=Object.getOwnPropertyDescriptor(R,S):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(x,R,S,L);else for(var B=x.length-1;B>=0;B--)(I=x[B])&&(O=(P<3?I(O):P>3?I(R,S,O):I(R,S))||O);return P>3&&O&&Object.defineProperty(R,S,O),O},v=this&&this.__param||function(x,R){return function(S,L){R(S,L,x)}};Object.defineProperty(i,"__esModule",{value:!0}),i.DomRendererRowFactory=void 0;const h=c(2223),b=c(643),T=c(511),N=c(2585),w=c(8055),d=c(4725),g=c(4269),p=c(6171),f=c(3734);let E=i.DomRendererRowFactory=class{constructor(x,R,S,L,I,P,O){this._document=x,this._characterJoinerService=R,this._optionsService=S,this._coreBrowserService=L,this._coreService=I,this._decorationService=P,this._themeService=O,this._workCell=new T.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(x,R,S){this._selectionStart=x,this._selectionEnd=R,this._columnSelectMode=S}createRow(x,R,S,L,I,P,O,B,$,W,K){const Y=[],V=this._characterJoinerService.getJoinedCharacters(R),F=this._themeService.colors;let H,U=x.getNoBgTrimmedLength();S&&U<P+1&&(U=P+1);let z=0,te="",ie=0,we=0,ge=0,X=!1,G=0,ee=!1,Z=0;const ve=[],Se=W!==-1&&K!==-1;for(let Ie=0;Ie<U;Ie++){x.loadCell(Ie,this._workCell);let je=this._workCell.getWidth();if(je===0)continue;let Je=!1,tt=Ie,Ne=this._workCell;if(V.length>0&&Ie===V[0][0]){Je=!0;const qe=V.shift();Ne=new g.JoinedCellData(this._workCell,x.translateToString(!0,qe[0],qe[1]),qe[1]-qe[0]),tt=qe[1]-1,je=Ne.getWidth()}const ce=this._isCellInSelection(Ie,R),dt=S&&Ie===P,se=Se&&Ie>=W&&Ie<=K;let fe=!1;this._decorationService.forEachDecorationAtCell(Ie,R,void 0,(qe=>{fe=!0}));let Ce=Ne.getChars()||b.WHITESPACE_CELL_CHAR;if(Ce===" "&&(Ne.isUnderline()||Ne.isOverline())&&(Ce=" "),Z=je*B-$.get(Ce,Ne.isBold(),Ne.isItalic()),H){if(z&&(ce&&ee||!ce&&!ee&&Ne.bg===ie)&&(ce&&ee&&F.selectionForeground||Ne.fg===we)&&Ne.extended.ext===ge&&se===X&&Z===G&&!dt&&!Je&&!fe){Ne.isInvisible()?te+=b.WHITESPACE_CELL_CHAR:te+=Ce,z++;continue}z&&(H.textContent=te),H=this._document.createElement("span"),z=0,te=""}else H=this._document.createElement("span");if(ie=Ne.bg,we=Ne.fg,ge=Ne.extended.ext,X=se,G=Z,ee=ce,Je&&P>=Ie&&P<=tt&&(P=Ie),!this._coreService.isCursorHidden&&dt&&this._coreService.isCursorInitialized){if(ve.push("xterm-cursor"),this._coreBrowserService.isFocused)O&&ve.push("xterm-cursor-blink"),ve.push(L==="bar"?"xterm-cursor-bar":L==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(I)switch(I){case"outline":ve.push("xterm-cursor-outline");break;case"block":ve.push("xterm-cursor-block");break;case"bar":ve.push("xterm-cursor-bar");break;case"underline":ve.push("xterm-cursor-underline")}}if(Ne.isBold()&&ve.push("xterm-bold"),Ne.isItalic()&&ve.push("xterm-italic"),Ne.isDim()&&ve.push("xterm-dim"),te=Ne.isInvisible()?b.WHITESPACE_CELL_CHAR:Ne.getChars()||b.WHITESPACE_CELL_CHAR,Ne.isUnderline()&&(ve.push(`xterm-underline-${Ne.extended.underlineStyle}`),te===" "&&(te=" "),!Ne.isUnderlineColorDefault()))if(Ne.isUnderlineColorRGB())H.style.textDecorationColor=`rgb(${f.AttributeData.toColorRGB(Ne.getUnderlineColor()).join(",")})`;else{let qe=Ne.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Ne.isBold()&&qe<8&&(qe+=8),H.style.textDecorationColor=F.ansi[qe].css}Ne.isOverline()&&(ve.push("xterm-overline"),te===" "&&(te=" ")),Ne.isStrikethrough()&&ve.push("xterm-strikethrough"),se&&(H.style.textDecoration="underline");let ye=Ne.getFgColor(),_e=Ne.getFgColorMode(),Te=Ne.getBgColor(),ue=Ne.getBgColorMode();const Fe=!!Ne.isInverse();if(Fe){const qe=ye;ye=Te,Te=qe;const xt=_e;_e=ue,ue=xt}let $e,Ye,De,He=!1;switch(this._decorationService.forEachDecorationAtCell(Ie,R,void 0,(qe=>{qe.options.layer!=="top"&&He||(qe.backgroundColorRGB&&(ue=50331648,Te=qe.backgroundColorRGB.rgba>>8&16777215,$e=qe.backgroundColorRGB),qe.foregroundColorRGB&&(_e=50331648,ye=qe.foregroundColorRGB.rgba>>8&16777215,Ye=qe.foregroundColorRGB),He=qe.options.layer==="top")})),!He&&ce&&($e=this._coreBrowserService.isFocused?F.selectionBackgroundOpaque:F.selectionInactiveBackgroundOpaque,Te=$e.rgba>>8&16777215,ue=50331648,He=!0,F.selectionForeground&&(_e=50331648,ye=F.selectionForeground.rgba>>8&16777215,Ye=F.selectionForeground)),He&&ve.push("xterm-decoration-top"),ue){case 16777216:case 33554432:De=F.ansi[Te],ve.push(`xterm-bg-${Te}`);break;case 50331648:De=w.channels.toColor(Te>>16,Te>>8&255,255&Te),this._addStyle(H,`background-color:#${j((Te>>>0).toString(16),"0",6)}`);break;default:Fe?(De=F.foreground,ve.push(`xterm-bg-${h.INVERTED_DEFAULT_COLOR}`)):De=F.background}switch($e||Ne.isDim()&&($e=w.color.multiplyOpacity(De,.5)),_e){case 16777216:case 33554432:Ne.isBold()&&ye<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ye+=8),this._applyMinimumContrast(H,De,F.ansi[ye],Ne,$e,void 0)||ve.push(`xterm-fg-${ye}`);break;case 50331648:const qe=w.channels.toColor(ye>>16&255,ye>>8&255,255&ye);this._applyMinimumContrast(H,De,qe,Ne,$e,Ye)||this._addStyle(H,`color:#${j(ye.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(H,De,F.foreground,Ne,$e,Ye)||Fe&&ve.push(`xterm-fg-${h.INVERTED_DEFAULT_COLOR}`)}ve.length&&(H.className=ve.join(" "),ve.length=0),dt||Je||fe?H.textContent=te:z++,Z!==this.defaultSpacing&&(H.style.letterSpacing=`${Z}px`),Y.push(H),Ie=tt}return H&&z&&(H.textContent=te),Y}_applyMinimumContrast(x,R,S,L,I,P){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,p.treatGlyphAsBackgroundColor)(L.getCode()))return!1;const O=this._getContrastCache(L);let B;if(I||P||(B=O.getColor(R.rgba,S.rgba)),B===void 0){const $=this._optionsService.rawOptions.minimumContrastRatio/(L.isDim()?2:1);B=w.color.ensureContrastRatio(I||R,P||S,$),O.setColor((I||R).rgba,(P||S).rgba,B??null)}return!!B&&(this._addStyle(x,`color:${B.css}`),!0)}_getContrastCache(x){return x.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(x,R){x.setAttribute("style",`${x.getAttribute("style")||""}${R};`)}_isCellInSelection(x,R){const S=this._selectionStart,L=this._selectionEnd;return!(!S||!L)&&(this._columnSelectMode?S[0]<=L[0]?x>=S[0]&&R>=S[1]&&x<L[0]&&R<=L[1]:x<S[0]&&R>=S[1]&&x>=L[0]&&R<=L[1]:R>S[1]&&R<L[1]||S[1]===L[1]&&R===S[1]&&x>=S[0]&&x<L[0]||S[1]<L[1]&&R===L[1]&&x<L[0]||S[1]<L[1]&&R===S[1]&&x>=S[0])}};function j(x,R,S){for(;x.length<S;)x=R+x;return x}i.DomRendererRowFactory=E=m([v(1,d.ICharacterJoinerService),v(2,N.IOptionsService),v(3,d.ICoreBrowserService),v(4,N.ICoreService),v(5,N.IDecorationService),v(6,d.IThemeService)],E)},2550:(y,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.WidthCache=void 0,i.WidthCache=class{constructor(c,m){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=c.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";const v=c.createElement("span");v.classList.add("xterm-char-measure-element");const h=c.createElement("span");h.classList.add("xterm-char-measure-element"),h.style.fontWeight="bold";const b=c.createElement("span");b.classList.add("xterm-char-measure-element"),b.style.fontStyle="italic";const T=c.createElement("span");T.classList.add("xterm-char-measure-element"),T.style.fontWeight="bold",T.style.fontStyle="italic",this._measureElements=[v,h,b,T],this._container.appendChild(v),this._container.appendChild(h),this._container.appendChild(b),this._container.appendChild(T),m.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(c,m,v,h){c===this._font&&m===this._fontSize&&v===this._weight&&h===this._weightBold||(this._font=c,this._fontSize=m,this._weight=v,this._weightBold=h,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${v}`,this._measureElements[1].style.fontWeight=`${h}`,this._measureElements[2].style.fontWeight=`${v}`,this._measureElements[3].style.fontWeight=`${h}`,this.clear())}get(c,m,v){let h=0;if(!m&&!v&&c.length===1&&(h=c.charCodeAt(0))<256){if(this._flat[h]!==-9999)return this._flat[h];const N=this._measure(c,0);return N>0&&(this._flat[h]=N),N}let b=c;m&&(b+="B"),v&&(b+="I");let T=this._holey.get(b);if(T===void 0){let N=0;m&&(N|=1),v&&(N|=2),T=this._measure(c,N),T>0&&this._holey.set(b,T)}return T}_measure(c,m){const v=this._measureElements[m];return v.textContent=c.repeat(32),v.offsetWidth/32}}},2223:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.TEXT_BASELINE=i.DIM_OPACITY=i.INVERTED_DEFAULT_COLOR=void 0;const m=c(6114);i.INVERTED_DEFAULT_COLOR=257,i.DIM_OPACITY=.5,i.TEXT_BASELINE=m.isFirefox||m.isLegacyEdge?"bottom":"ideographic"},6171:(y,i)=>{function c(v){return 57508<=v&&v<=57558}function m(v){return v>=128512&&v<=128591||v>=127744&&v<=128511||v>=128640&&v<=128767||v>=9728&&v<=9983||v>=9984&&v<=10175||v>=65024&&v<=65039||v>=129280&&v<=129535||v>=127462&&v<=127487}Object.defineProperty(i,"__esModule",{value:!0}),i.computeNextVariantOffset=i.createRenderDimensions=i.treatGlyphAsBackgroundColor=i.allowRescaling=i.isEmoji=i.isRestrictedPowerlineGlyph=i.isPowerlineGlyph=i.throwIfFalsy=void 0,i.throwIfFalsy=function(v){if(!v)throw new Error("value must not be falsy");return v},i.isPowerlineGlyph=c,i.isRestrictedPowerlineGlyph=function(v){return 57520<=v&&v<=57527},i.isEmoji=m,i.allowRescaling=function(v,h,b,T){return h===1&&b>Math.ceil(1.5*T)&&v!==void 0&&v>255&&!m(v)&&!c(v)&&!(function(N){return 57344<=N&&N<=63743})(v)},i.treatGlyphAsBackgroundColor=function(v){return c(v)||(function(h){return 9472<=h&&h<=9631})(v)},i.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},i.computeNextVariantOffset=function(v,h,b=0){return(v-(2*Math.round(h)-b))%(2*Math.round(h))}},6052:(y,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.createSelectionRenderModel=void 0;class c{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(v,h,b,T=!1){if(this.selectionStart=h,this.selectionEnd=b,!h||!b||h[0]===b[0]&&h[1]===b[1])return void this.clear();const N=v.buffers.active.ydisp,w=h[1]-N,d=b[1]-N,g=Math.max(w,0),p=Math.min(d,v.rows-1);g>=v.rows||p<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=T,this.viewportStartRow=w,this.viewportEndRow=d,this.viewportCappedStartRow=g,this.viewportCappedEndRow=p,this.startCol=h[0],this.endCol=b[0])}isCellSelected(v,h,b){return!!this.hasSelection&&(b-=v.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?h>=this.startCol&&b>=this.viewportCappedStartRow&&h<this.endCol&&b<=this.viewportCappedEndRow:h<this.startCol&&b>=this.viewportCappedStartRow&&h>=this.endCol&&b<=this.viewportCappedEndRow:b>this.viewportStartRow&&b<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&b===this.viewportStartRow&&h>=this.startCol&&h<this.endCol||this.viewportStartRow<this.viewportEndRow&&b===this.viewportEndRow&&h<this.endCol||this.viewportStartRow<this.viewportEndRow&&b===this.viewportStartRow&&h>=this.startCol)}}i.createSelectionRenderModel=function(){return new c}},456:(y,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.SelectionModel=void 0,i.SelectionModel=class{constructor(c){this._bufferService=c,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.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()){const c=this.selectionStart[0]+this.selectionStartLength;return c>this._bufferService.cols?c%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(c/this._bufferService.cols)-1]:[c%this._bufferService.cols,this.selectionStart[1]+Math.floor(c/this._bufferService.cols)]:[c,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const c=this.selectionStart[0]+this.selectionStartLength;return c>this._bufferService.cols?[c%this._bufferService.cols,this.selectionStart[1]+Math.floor(c/this._bufferService.cols)]:[Math.max(c,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const c=this.selectionStart,m=this.selectionEnd;return!(!c||!m)&&(c[1]>m[1]||c[1]===m[1]&&c[0]>m[0])}handleTrim(c){return this.selectionStart&&(this.selectionStart[1]-=c),this.selectionEnd&&(this.selectionEnd[1]-=c),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(y,i,c){var m=this&&this.__decorate||function(p,f,E,j){var x,R=arguments.length,S=R<3?f:j===null?j=Object.getOwnPropertyDescriptor(f,E):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(p,f,E,j);else for(var L=p.length-1;L>=0;L--)(x=p[L])&&(S=(R<3?x(S):R>3?x(f,E,S):x(f,E))||S);return R>3&&S&&Object.defineProperty(f,E,S),S},v=this&&this.__param||function(p,f){return function(E,j){f(E,j,p)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CharSizeService=void 0;const h=c(2585),b=c(8460),T=c(844);let N=i.CharSizeService=class extends T.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(p,f,E){super(),this._optionsService=E,this.width=0,this.height=0,this._onCharSizeChange=this.register(new b.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new g(this._optionsService))}catch{this._measureStrategy=this.register(new d(p,f,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const p=this._measureStrategy.measure();p.width===this.width&&p.height===this.height||(this.width=p.width,this.height=p.height,this._onCharSizeChange.fire())}};i.CharSizeService=N=m([v(2,h.IOptionsService)],N);class w extends T.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(f,E){f!==void 0&&f>0&&E!==void 0&&E>0&&(this._result.width=f,this._result.height=E)}}class d extends w{constructor(f,E,j){super(),this._document=f,this._parentElement=E,this._optionsService=j,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}}class g extends w{constructor(f){super(),this._optionsService=f,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const E=this._ctx.measureText("W");if(!("width"in E&&"fontBoundingBoxAscent"in E&&"fontBoundingBoxDescent"in E))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const f=this._ctx.measureText("W");return this._validateAndSet(f.width,f.fontBoundingBoxAscent+f.fontBoundingBoxDescent),this._result}}},4269:function(y,i,c){var m=this&&this.__decorate||function(g,p,f,E){var j,x=arguments.length,R=x<3?p:E===null?E=Object.getOwnPropertyDescriptor(p,f):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(g,p,f,E);else for(var S=g.length-1;S>=0;S--)(j=g[S])&&(R=(x<3?j(R):x>3?j(p,f,R):j(p,f))||R);return x>3&&R&&Object.defineProperty(p,f,R),R},v=this&&this.__param||function(g,p){return function(f,E){p(f,E,g)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CharacterJoinerService=i.JoinedCellData=void 0;const h=c(3734),b=c(643),T=c(511),N=c(2585);class w extends h.AttributeData{constructor(p,f,E){super(),this.content=0,this.combinedData="",this.fg=p.fg,this.bg=p.bg,this.combinedData=f,this._width=E}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(p){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}i.JoinedCellData=w;let d=i.CharacterJoinerService=class Vg{constructor(p){this._bufferService=p,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new T.CellData}register(p){const f={id:this._nextCharacterJoinerId++,handler:p};return this._characterJoiners.push(f),f.id}deregister(p){for(let f=0;f<this._characterJoiners.length;f++)if(this._characterJoiners[f].id===p)return this._characterJoiners.splice(f,1),!0;return!1}getJoinedCharacters(p){if(this._characterJoiners.length===0)return[];const f=this._bufferService.buffer.lines.get(p);if(!f||f.length===0)return[];const E=[],j=f.translateToString(!0);let x=0,R=0,S=0,L=f.getFg(0),I=f.getBg(0);for(let P=0;P<f.getTrimmedLength();P++)if(f.loadCell(P,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==L||this._workCell.bg!==I){if(P-x>1){const O=this._getJoinedRanges(j,S,R,f,x);for(let B=0;B<O.length;B++)E.push(O[B])}x=P,S=R,L=this._workCell.fg,I=this._workCell.bg}R+=this._workCell.getChars().length||b.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-x>1){const P=this._getJoinedRanges(j,S,R,f,x);for(let O=0;O<P.length;O++)E.push(P[O])}return E}_getJoinedRanges(p,f,E,j,x){const R=p.substring(f,E);let S=[];try{S=this._characterJoiners[0].handler(R)}catch(L){console.error(L)}for(let L=1;L<this._characterJoiners.length;L++)try{const I=this._characterJoiners[L].handler(R);for(let P=0;P<I.length;P++)Vg._mergeRanges(S,I[P])}catch(I){console.error(I)}return this._stringRangesToCellRanges(S,j,x),S}_stringRangesToCellRanges(p,f,E){let j=0,x=!1,R=0,S=p[j];if(S){for(let L=E;L<this._bufferService.cols;L++){const I=f.getWidth(L),P=f.getString(L).length||b.WHITESPACE_CELL_CHAR.length;if(I!==0){if(!x&&S[0]<=R&&(S[0]=L,x=!0),S[1]<=R){if(S[1]=L,S=p[++j],!S)break;S[0]<=R?(S[0]=L,x=!0):x=!1}R+=P}}S&&(S[1]=this._bufferService.cols)}}static _mergeRanges(p,f){let E=!1;for(let j=0;j<p.length;j++){const x=p[j];if(E){if(f[1]<=x[0])return p[j-1][1]=f[1],p;if(f[1]<=x[1])return p[j-1][1]=Math.max(f[1],x[1]),p.splice(j,1),p;p.splice(j,1),j--}else{if(f[1]<=x[0])return p.splice(j,0,f),p;if(f[1]<=x[1])return x[0]=Math.min(f[0],x[0]),p;f[0]<x[1]&&(x[0]=Math.min(f[0],x[0]),E=!0)}}return E?p[p.length-1][1]=f[1]:p.push(f),p}};i.CharacterJoinerService=d=m([v(0,N.IBufferService)],d)},5114:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CoreBrowserService=void 0;const m=c(844),v=c(8460),h=c(3656);class b extends m.Disposable{constructor(w,d,g){super(),this._textarea=w,this._window=d,this.mainDocument=g,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new T(this._window),this._onDprChange=this.register(new v.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new v.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((p=>this._screenDprMonitor.setWindow(p)))),this.register((0,v.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get window(){return this._window}set window(w){this._window!==w&&(this._window=w,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}}i.CoreBrowserService=b;class T extends m.Disposable{constructor(w){super(),this._parentWindow=w,this._windowResizeListener=this.register(new m.MutableDisposable),this._onDprChange=this.register(new v.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,m.toDisposable)((()=>this.clearListener())))}setWindow(w){this._parentWindow=w,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,h.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var w;this._outerListener&&((w=this._resolutionMediaMatchList)==null||w.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)}}},779:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.LinkProviderService=void 0;const m=c(844);class v extends m.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,m.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(b){return this.linkProviders.push(b),{dispose:()=>{const T=this.linkProviders.indexOf(b);T!==-1&&this.linkProviders.splice(T,1)}}}}i.LinkProviderService=v},8934:function(y,i,c){var m=this&&this.__decorate||function(N,w,d,g){var p,f=arguments.length,E=f<3?w:g===null?g=Object.getOwnPropertyDescriptor(w,d):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(N,w,d,g);else for(var j=N.length-1;j>=0;j--)(p=N[j])&&(E=(f<3?p(E):f>3?p(w,d,E):p(w,d))||E);return f>3&&E&&Object.defineProperty(w,d,E),E},v=this&&this.__param||function(N,w){return function(d,g){w(d,g,N)}};Object.defineProperty(i,"__esModule",{value:!0}),i.MouseService=void 0;const h=c(4725),b=c(9806);let T=i.MouseService=class{constructor(N,w){this._renderService=N,this._charSizeService=w}getCoords(N,w,d,g,p){return(0,b.getCoords)(window,N,w,d,g,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,p)}getMouseReportCoords(N,w){const d=(0,b.getCoordsRelativeToElement)(window,N,w);if(this._charSizeService.hasValidSize)return d[0]=Math.min(Math.max(d[0],0),this._renderService.dimensions.css.canvas.width-1),d[1]=Math.min(Math.max(d[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(d[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(d[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(d[0]),y:Math.floor(d[1])}}};i.MouseService=T=m([v(0,h.IRenderService),v(1,h.ICharSizeService)],T)},3230:function(y,i,c){var m=this&&this.__decorate||function(p,f,E,j){var x,R=arguments.length,S=R<3?f:j===null?j=Object.getOwnPropertyDescriptor(f,E):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(p,f,E,j);else for(var L=p.length-1;L>=0;L--)(x=p[L])&&(S=(R<3?x(S):R>3?x(f,E,S):x(f,E))||S);return R>3&&S&&Object.defineProperty(f,E,S),S},v=this&&this.__param||function(p,f){return function(E,j){f(E,j,p)}};Object.defineProperty(i,"__esModule",{value:!0}),i.RenderService=void 0;const h=c(6193),b=c(4725),T=c(8460),N=c(844),w=c(7226),d=c(2585);let g=i.RenderService=class extends N.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(p,f,E,j,x,R,S,L){super(),this._rowCount=p,this._charSizeService=j,this._renderer=this.register(new N.MutableDisposable),this._pausedResizeTask=new w.DebouncedIdleTask,this._observerDisposable=this.register(new N.MutableDisposable),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 T.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new T.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new T.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new T.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new h.RenderDebouncer(((I,P)=>this._renderRows(I,P)),S),this.register(this._renderDebouncer),this.register(S.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(R.onResize((()=>this._fullRefresh()))),this.register(R.buffers.onBufferActivate((()=>{var I;return(I=this._renderer.value)==null?void 0:I.clear()}))),this.register(E.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(x.onDecorationRegistered((()=>this._fullRefresh()))),this.register(x.onDecorationRemoved((()=>this._fullRefresh()))),this.register(E.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(R.cols,R.rows),this._fullRefresh()}))),this.register(E.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(R.buffer.y,R.buffer.y,!0)))),this.register(L.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(S.window,f),this.register(S.onWindowChange((I=>this._registerIntersectionObserver(I,f))))}_registerIntersectionObserver(p,f){if("IntersectionObserver"in p){const E=new p.IntersectionObserver((j=>this._handleIntersectionChange(j[j.length-1])),{threshold:0});E.observe(f),this._observerDisposable.value=(0,N.toDisposable)((()=>E.disconnect()))}}_handleIntersectionChange(p){this._isPaused=p.isIntersecting===void 0?p.intersectionRatio===0:!p.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(p,f,E=!1){this._isPaused?this._needsFullRefresh=!0:(E||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(p,f,this._rowCount))}_renderRows(p,f){this._renderer.value&&(p=Math.min(p,this._rowCount-1),f=Math.min(f,this._rowCount-1),this._renderer.value.renderRows(p,f),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:p,end:f}),this._onRender.fire({start:p,end:f}),this._isNextRenderRedrawOnly=!0)}resize(p,f){this._rowCount=f,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(p){this._renderer.value=p,this._renderer.value&&(this._renderer.value.onRequestRedraw((f=>this.refreshRows(f.start,f.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(p){return this._renderDebouncer.addRefreshCallback(p)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var p,f;this._renderer.value&&((f=(p=this._renderer.value).clearTextureAtlas)==null||f.call(p),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(p,f){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var E;return(E=this._renderer.value)==null?void 0:E.handleResize(p,f)})):this._renderer.value.handleResize(p,f),this._fullRefresh())}handleCharSizeChanged(){var p;(p=this._renderer.value)==null||p.handleCharSizeChanged()}handleBlur(){var p;(p=this._renderer.value)==null||p.handleBlur()}handleFocus(){var p;(p=this._renderer.value)==null||p.handleFocus()}handleSelectionChanged(p,f,E){var j;this._selectionState.start=p,this._selectionState.end=f,this._selectionState.columnSelectMode=E,(j=this._renderer.value)==null||j.handleSelectionChanged(p,f,E)}handleCursorMove(){var p;(p=this._renderer.value)==null||p.handleCursorMove()}clear(){var p;(p=this._renderer.value)==null||p.clear()}};i.RenderService=g=m([v(2,d.IOptionsService),v(3,b.ICharSizeService),v(4,d.IDecorationService),v(5,d.IBufferService),v(6,b.ICoreBrowserService),v(7,b.IThemeService)],g)},9312:function(y,i,c){var m=this&&this.__decorate||function(S,L,I,P){var O,B=arguments.length,$=B<3?L:P===null?P=Object.getOwnPropertyDescriptor(L,I):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")$=Reflect.decorate(S,L,I,P);else for(var W=S.length-1;W>=0;W--)(O=S[W])&&($=(B<3?O($):B>3?O(L,I,$):O(L,I))||$);return B>3&&$&&Object.defineProperty(L,I,$),$},v=this&&this.__param||function(S,L){return function(I,P){L(I,P,S)}};Object.defineProperty(i,"__esModule",{value:!0}),i.SelectionService=void 0;const h=c(9806),b=c(9504),T=c(456),N=c(4725),w=c(8460),d=c(844),g=c(6114),p=c(4841),f=c(511),E=c(2585),j=" ",x=new RegExp(j,"g");let R=i.SelectionService=class extends d.Disposable{constructor(S,L,I,P,O,B,$,W,K){super(),this._element=S,this._screenElement=L,this._linkifier=I,this._bufferService=P,this._coreService=O,this._mouseService=B,this._optionsService=$,this._renderService=W,this._coreBrowserService=K,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new f.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new w.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new w.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new w.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new w.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=Y=>this._handleMouseMove(Y),this._mouseUpListener=Y=>this._handleMouseUp(Y),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((Y=>this._handleTrim(Y))),this.register(this._bufferService.buffers.onBufferActivate((Y=>this._handleBufferActivate(Y)))),this.enable(),this._model=new T.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,d.toDisposable)((()=>{this._removeMouseDownListeners()})))}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(){const S=this._model.finalSelectionStart,L=this._model.finalSelectionEnd;return!(!S||!L||S[0]===L[0]&&S[1]===L[1])}get selectionText(){const S=this._model.finalSelectionStart,L=this._model.finalSelectionEnd;if(!S||!L)return"";const I=this._bufferService.buffer,P=[];if(this._activeSelectionMode===3){if(S[0]===L[0])return"";const O=S[0]<L[0]?S[0]:L[0],B=S[0]<L[0]?L[0]:S[0];for(let $=S[1];$<=L[1];$++){const W=I.translateBufferLineToString($,!0,O,B);P.push(W)}}else{const O=S[1]===L[1]?L[0]:void 0;P.push(I.translateBufferLineToString(S[1],!0,S[0],O));for(let B=S[1]+1;B<=L[1]-1;B++){const $=I.lines.get(B),W=I.translateBufferLineToString(B,!0);$!=null&&$.isWrapped?P[P.length-1]+=W:P.push(W)}if(S[1]!==L[1]){const B=I.lines.get(L[1]),$=I.translateBufferLineToString(L[1],!0,0,L[0]);B&&B.isWrapped?P[P.length-1]+=$:P.push($)}}return P.map((O=>O.replace(x," "))).join(g.isWindows?`\r
|
|
120
|
+
`:`
|
|
121
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(S){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),g.isLinux&&S&&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(S){const L=this._getMouseBufferCoords(S),I=this._model.finalSelectionStart,P=this._model.finalSelectionEnd;return!!(I&&P&&L)&&this._areCoordsInSelection(L,I,P)}isCellInSelection(S,L){const I=this._model.finalSelectionStart,P=this._model.finalSelectionEnd;return!(!I||!P)&&this._areCoordsInSelection([S,L],I,P)}_areCoordsInSelection(S,L,I){return S[1]>L[1]&&S[1]<I[1]||L[1]===I[1]&&S[1]===L[1]&&S[0]>=L[0]&&S[0]<I[0]||L[1]<I[1]&&S[1]===I[1]&&S[0]<I[0]||L[1]<I[1]&&S[1]===L[1]&&S[0]>=L[0]}_selectWordAtCursor(S,L){var O,B;const I=(B=(O=this._linkifier.currentLink)==null?void 0:O.link)==null?void 0:B.range;if(I)return this._model.selectionStart=[I.start.x-1,I.start.y-1],this._model.selectionStartLength=(0,p.getRangeLength)(I,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const P=this._getMouseBufferCoords(S);return!!P&&(this._selectWordAt(P,L),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(S,L){this._model.clearSelection(),S=Math.max(S,0),L=Math.min(L,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,S],this._model.selectionEnd=[this._bufferService.cols,L],this.refresh(),this._onSelectionChange.fire()}_handleTrim(S){this._model.handleTrim(S)&&this.refresh()}_getMouseBufferCoords(S){const L=this._mouseService.getCoords(S,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(L)return L[0]--,L[1]--,L[1]+=this._bufferService.buffer.ydisp,L}_getMouseEventScrollAmount(S){let L=(0,h.getCoordsRelativeToElement)(this._coreBrowserService.window,S,this._screenElement)[1];const I=this._renderService.dimensions.css.canvas.height;return L>=0&&L<=I?0:(L>I&&(L-=I),L=Math.min(Math.max(L,-50),50),L/=50,L/Math.abs(L)+Math.round(14*L))}shouldForceSelection(S){return g.isMac?S.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:S.shiftKey}handleMouseDown(S){if(this._mouseDownTimeStamp=S.timeStamp,(S.button!==2||!this.hasSelection)&&S.button===0){if(!this._enabled){if(!this.shouldForceSelection(S))return;S.stopPropagation()}S.preventDefault(),this._dragScrollAmount=0,this._enabled&&S.shiftKey?this._handleIncrementalClick(S):S.detail===1?this._handleSingleClick(S):S.detail===2?this._handleDoubleClick(S):S.detail===3&&this._handleTripleClick(S),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()),50)}_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(S){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(S))}_handleSingleClick(S){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(S)?3:0,this._model.selectionStart=this._getMouseBufferCoords(S),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const L=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);L&&L.length!==this._model.selectionStart[0]&&L.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(S){this._selectWordAtCursor(S,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(S){const L=this._getMouseBufferCoords(S);L&&(this._activeSelectionMode=2,this._selectLineAt(L[1]))}shouldColumnSelect(S){return S.altKey&&!(g.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(S){if(S.stopImmediatePropagation(),!this._model.selectionStart)return;const L=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(S),!this._model.selectionEnd)return void this.refresh(!0);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(S),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const I=this._bufferService.buffer;if(this._model.selectionEnd[1]<I.lines.length){const P=I.lines.get(this._model.selectionEnd[1]);P&&P.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}L&&L[0]===this._model.selectionEnd[0]&&L[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});const S=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(S.ydisp+this._bufferService.rows,S.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=S.ydisp),this.refresh()}}_handleMouseUp(S){const L=S.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&L<500&&S.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const I=this._mouseService.getCoords(S,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(I&&I[0]!==void 0&&I[1]!==void 0){const P=(0,b.moveToCellSequence)(I[0]-1,I[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(P,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const S=this._model.finalSelectionStart,L=this._model.finalSelectionEnd,I=!(!S||!L||S[0]===L[0]&&S[1]===L[1]);I?S&&L&&(this._oldSelectionStart&&this._oldSelectionEnd&&S[0]===this._oldSelectionStart[0]&&S[1]===this._oldSelectionStart[1]&&L[0]===this._oldSelectionEnd[0]&&L[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(S,L,I)):this._oldHasSelection&&this._fireOnSelectionChange(S,L,I)}_fireOnSelectionChange(S,L,I){this._oldSelectionStart=S,this._oldSelectionEnd=L,this._oldHasSelection=I,this._onSelectionChange.fire()}_handleBufferActivate(S){this.clearSelection(),this._trimListener.dispose(),this._trimListener=S.activeBuffer.lines.onTrim((L=>this._handleTrim(L)))}_convertViewportColToCharacterIndex(S,L){let I=L;for(let P=0;L>=P;P++){const O=S.loadCell(P,this._workCell).getChars().length;this._workCell.getWidth()===0?I--:O>1&&L!==P&&(I+=O-1)}return I}setSelection(S,L,I){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[S,L],this._model.selectionStartLength=I,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(S){this._isClickInSelection(S)||(this._selectWordAtCursor(S,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(S,L,I=!0,P=!0){if(S[0]>=this._bufferService.cols)return;const O=this._bufferService.buffer,B=O.lines.get(S[1]);if(!B)return;const $=O.translateBufferLineToString(S[1],!1);let W=this._convertViewportColToCharacterIndex(B,S[0]),K=W;const Y=S[0]-W;let V=0,F=0,H=0,U=0;if($.charAt(W)===" "){for(;W>0&&$.charAt(W-1)===" ";)W--;for(;K<$.length&&$.charAt(K+1)===" ";)K++}else{let ie=S[0],we=S[0];B.getWidth(ie)===0&&(V++,ie--),B.getWidth(we)===2&&(F++,we++);const ge=B.getString(we).length;for(ge>1&&(U+=ge-1,K+=ge-1);ie>0&&W>0&&!this._isCharWordSeparator(B.loadCell(ie-1,this._workCell));){B.loadCell(ie-1,this._workCell);const X=this._workCell.getChars().length;this._workCell.getWidth()===0?(V++,ie--):X>1&&(H+=X-1,W-=X-1),W--,ie--}for(;we<B.length&&K+1<$.length&&!this._isCharWordSeparator(B.loadCell(we+1,this._workCell));){B.loadCell(we+1,this._workCell);const X=this._workCell.getChars().length;this._workCell.getWidth()===2?(F++,we++):X>1&&(U+=X-1,K+=X-1),K++,we++}}K++;let z=W+Y-V+H,te=Math.min(this._bufferService.cols,K-W+V+F-H-U);if(L||$.slice(W,K).trim()!==""){if(I&&z===0&&B.getCodePoint(0)!==32){const ie=O.lines.get(S[1]-1);if(ie&&B.isWrapped&&ie.getCodePoint(this._bufferService.cols-1)!==32){const we=this._getWordAt([this._bufferService.cols-1,S[1]-1],!1,!0,!1);if(we){const ge=this._bufferService.cols-we.start;z-=ge,te+=ge}}}if(P&&z+te===this._bufferService.cols&&B.getCodePoint(this._bufferService.cols-1)!==32){const ie=O.lines.get(S[1]+1);if(ie!=null&&ie.isWrapped&&ie.getCodePoint(0)!==32){const we=this._getWordAt([0,S[1]+1],!1,!1,!0);we&&(te+=we.length)}}return{start:z,length:te}}}_selectWordAt(S,L){const I=this._getWordAt(S,L);if(I){for(;I.start<0;)I.start+=this._bufferService.cols,S[1]--;this._model.selectionStart=[I.start,S[1]],this._model.selectionStartLength=I.length}}_selectToWordAt(S){const L=this._getWordAt(S,!0);if(L){let I=S[1];for(;L.start<0;)L.start+=this._bufferService.cols,I--;if(!this._model.areSelectionValuesReversed())for(;L.start+L.length>this._bufferService.cols;)L.length-=this._bufferService.cols,I++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?L.start:L.start+L.length,I]}}_isCharWordSeparator(S){return S.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(S.getChars())>=0}_selectLineAt(S){const L=this._bufferService.buffer.getWrappedRangeForLine(S),I={start:{x:0,y:L.first},end:{x:this._bufferService.cols-1,y:L.last}};this._model.selectionStart=[0,L.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,p.getRangeLength)(I,this._bufferService.cols)}};i.SelectionService=R=m([v(3,E.IBufferService),v(4,E.ICoreService),v(5,N.IMouseService),v(6,E.IOptionsService),v(7,N.IRenderService),v(8,N.ICoreBrowserService)],R)},4725:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ILinkProviderService=i.IThemeService=i.ICharacterJoinerService=i.ISelectionService=i.IRenderService=i.IMouseService=i.ICoreBrowserService=i.ICharSizeService=void 0;const m=c(8343);i.ICharSizeService=(0,m.createDecorator)("CharSizeService"),i.ICoreBrowserService=(0,m.createDecorator)("CoreBrowserService"),i.IMouseService=(0,m.createDecorator)("MouseService"),i.IRenderService=(0,m.createDecorator)("RenderService"),i.ISelectionService=(0,m.createDecorator)("SelectionService"),i.ICharacterJoinerService=(0,m.createDecorator)("CharacterJoinerService"),i.IThemeService=(0,m.createDecorator)("ThemeService"),i.ILinkProviderService=(0,m.createDecorator)("LinkProviderService")},6731:function(y,i,c){var m=this&&this.__decorate||function(R,S,L,I){var P,O=arguments.length,B=O<3?S:I===null?I=Object.getOwnPropertyDescriptor(S,L):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(R,S,L,I);else for(var $=R.length-1;$>=0;$--)(P=R[$])&&(B=(O<3?P(B):O>3?P(S,L,B):P(S,L))||B);return O>3&&B&&Object.defineProperty(S,L,B),B},v=this&&this.__param||function(R,S){return function(L,I){S(L,I,R)}};Object.defineProperty(i,"__esModule",{value:!0}),i.ThemeService=i.DEFAULT_ANSI_COLORS=void 0;const h=c(7239),b=c(8055),T=c(8460),N=c(844),w=c(2585),d=b.css.toColor("#ffffff"),g=b.css.toColor("#000000"),p=b.css.toColor("#ffffff"),f=b.css.toColor("#000000"),E={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};i.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const R=[b.css.toColor("#2e3436"),b.css.toColor("#cc0000"),b.css.toColor("#4e9a06"),b.css.toColor("#c4a000"),b.css.toColor("#3465a4"),b.css.toColor("#75507b"),b.css.toColor("#06989a"),b.css.toColor("#d3d7cf"),b.css.toColor("#555753"),b.css.toColor("#ef2929"),b.css.toColor("#8ae234"),b.css.toColor("#fce94f"),b.css.toColor("#729fcf"),b.css.toColor("#ad7fa8"),b.css.toColor("#34e2e2"),b.css.toColor("#eeeeec")],S=[0,95,135,175,215,255];for(let L=0;L<216;L++){const I=S[L/36%6|0],P=S[L/6%6|0],O=S[L%6];R.push({css:b.channels.toCss(I,P,O),rgba:b.channels.toRgba(I,P,O)})}for(let L=0;L<24;L++){const I=8+10*L;R.push({css:b.channels.toCss(I,I,I),rgba:b.channels.toRgba(I,I,I)})}return R})());let j=i.ThemeService=class extends N.Disposable{get colors(){return this._colors}constructor(R){super(),this._optionsService=R,this._contrastCache=new h.ColorContrastCache,this._halfContrastCache=new h.ColorContrastCache,this._onChangeColors=this.register(new T.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:d,background:g,cursor:p,cursorAccent:f,selectionForeground:void 0,selectionBackgroundTransparent:E,selectionBackgroundOpaque:b.color.blend(g,E),selectionInactiveBackgroundTransparent:E,selectionInactiveBackgroundOpaque:b.color.blend(g,E),ansi:i.DEFAULT_ANSI_COLORS.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))))}_setTheme(R={}){const S=this._colors;if(S.foreground=x(R.foreground,d),S.background=x(R.background,g),S.cursor=x(R.cursor,p),S.cursorAccent=x(R.cursorAccent,f),S.selectionBackgroundTransparent=x(R.selectionBackground,E),S.selectionBackgroundOpaque=b.color.blend(S.background,S.selectionBackgroundTransparent),S.selectionInactiveBackgroundTransparent=x(R.selectionInactiveBackground,S.selectionBackgroundTransparent),S.selectionInactiveBackgroundOpaque=b.color.blend(S.background,S.selectionInactiveBackgroundTransparent),S.selectionForeground=R.selectionForeground?x(R.selectionForeground,b.NULL_COLOR):void 0,S.selectionForeground===b.NULL_COLOR&&(S.selectionForeground=void 0),b.color.isOpaque(S.selectionBackgroundTransparent)&&(S.selectionBackgroundTransparent=b.color.opacity(S.selectionBackgroundTransparent,.3)),b.color.isOpaque(S.selectionInactiveBackgroundTransparent)&&(S.selectionInactiveBackgroundTransparent=b.color.opacity(S.selectionInactiveBackgroundTransparent,.3)),S.ansi=i.DEFAULT_ANSI_COLORS.slice(),S.ansi[0]=x(R.black,i.DEFAULT_ANSI_COLORS[0]),S.ansi[1]=x(R.red,i.DEFAULT_ANSI_COLORS[1]),S.ansi[2]=x(R.green,i.DEFAULT_ANSI_COLORS[2]),S.ansi[3]=x(R.yellow,i.DEFAULT_ANSI_COLORS[3]),S.ansi[4]=x(R.blue,i.DEFAULT_ANSI_COLORS[4]),S.ansi[5]=x(R.magenta,i.DEFAULT_ANSI_COLORS[5]),S.ansi[6]=x(R.cyan,i.DEFAULT_ANSI_COLORS[6]),S.ansi[7]=x(R.white,i.DEFAULT_ANSI_COLORS[7]),S.ansi[8]=x(R.brightBlack,i.DEFAULT_ANSI_COLORS[8]),S.ansi[9]=x(R.brightRed,i.DEFAULT_ANSI_COLORS[9]),S.ansi[10]=x(R.brightGreen,i.DEFAULT_ANSI_COLORS[10]),S.ansi[11]=x(R.brightYellow,i.DEFAULT_ANSI_COLORS[11]),S.ansi[12]=x(R.brightBlue,i.DEFAULT_ANSI_COLORS[12]),S.ansi[13]=x(R.brightMagenta,i.DEFAULT_ANSI_COLORS[13]),S.ansi[14]=x(R.brightCyan,i.DEFAULT_ANSI_COLORS[14]),S.ansi[15]=x(R.brightWhite,i.DEFAULT_ANSI_COLORS[15]),R.extendedAnsi){const L=Math.min(S.ansi.length-16,R.extendedAnsi.length);for(let I=0;I<L;I++)S.ansi[I+16]=x(R.extendedAnsi[I],i.DEFAULT_ANSI_COLORS[I+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(R){this._restoreColor(R),this._onChangeColors.fire(this.colors)}_restoreColor(R){if(R!==void 0)switch(R){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[R]=this._restoreColors.ansi[R]}else for(let S=0;S<this._restoreColors.ansi.length;++S)this._colors.ansi[S]=this._restoreColors.ansi[S]}modifyColors(R){R(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()}}};function x(R,S){if(R!==void 0)try{return b.css.toColor(R)}catch{}return S}i.ThemeService=j=m([v(0,w.IOptionsService)],j)},6349:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CircularList=void 0;const m=c(8460),v=c(844);class h extends v.Disposable{constructor(T){super(),this._maxLength=T,this.onDeleteEmitter=this.register(new m.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new m.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new m.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(T){if(this._maxLength===T)return;const N=new Array(T);for(let w=0;w<Math.min(T,this.length);w++)N[w]=this._array[this._getCyclicIndex(w)];this._array=N,this._maxLength=T,this._startIndex=0}get length(){return this._length}set length(T){if(T>this._length)for(let N=this._length;N<T;N++)this._array[N]=void 0;this._length=T}get(T){return this._array[this._getCyclicIndex(T)]}set(T,N){this._array[this._getCyclicIndex(T)]=N}push(T){this._array[this._getCyclicIndex(this._length)]=T,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new 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(T,N,...w){if(N){for(let d=T;d<this._length-N;d++)this._array[this._getCyclicIndex(d)]=this._array[this._getCyclicIndex(d+N)];this._length-=N,this.onDeleteEmitter.fire({index:T,amount:N})}for(let d=this._length-1;d>=T;d--)this._array[this._getCyclicIndex(d+w.length)]=this._array[this._getCyclicIndex(d)];for(let d=0;d<w.length;d++)this._array[this._getCyclicIndex(T+d)]=w[d];if(w.length&&this.onInsertEmitter.fire({index:T,amount:w.length}),this._length+w.length>this._maxLength){const d=this._length+w.length-this._maxLength;this._startIndex+=d,this._length=this._maxLength,this.onTrimEmitter.fire(d)}else this._length+=w.length}trimStart(T){T>this._length&&(T=this._length),this._startIndex+=T,this._length-=T,this.onTrimEmitter.fire(T)}shiftElements(T,N,w){if(!(N<=0)){if(T<0||T>=this._length)throw new Error("start argument out of range");if(T+w<0)throw new Error("Cannot shift elements in list beyond index 0");if(w>0){for(let g=N-1;g>=0;g--)this.set(T+g+w,this.get(T+g));const d=T+N+w-this._length;if(d>0)for(this._length+=d;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let d=0;d<N;d++)this.set(T+d+w,this.get(T+d))}}_getCyclicIndex(T){return(this._startIndex+T)%this._maxLength}}i.CircularList=h},1439:(y,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.clone=void 0,i.clone=function c(m,v=5){if(typeof m!="object")return m;const h=Array.isArray(m)?[]:{};for(const b in m)h[b]=v<=1?m[b]:m[b]&&c(m[b],v-1);return h}},8055:(y,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.contrastRatio=i.toPaddedHex=i.rgba=i.rgb=i.css=i.color=i.channels=i.NULL_COLOR=void 0;let c=0,m=0,v=0,h=0;var b,T,N,w,d;function g(f){const E=f.toString(16);return E.length<2?"0"+E:E}function p(f,E){return f<E?(E+.05)/(f+.05):(f+.05)/(E+.05)}i.NULL_COLOR={css:"#00000000",rgba:0},(function(f){f.toCss=function(E,j,x,R){return R!==void 0?`#${g(E)}${g(j)}${g(x)}${g(R)}`:`#${g(E)}${g(j)}${g(x)}`},f.toRgba=function(E,j,x,R=255){return(E<<24|j<<16|x<<8|R)>>>0},f.toColor=function(E,j,x,R){return{css:f.toCss(E,j,x,R),rgba:f.toRgba(E,j,x,R)}}})(b||(i.channels=b={})),(function(f){function E(j,x){return h=Math.round(255*x),[c,m,v]=d.toChannels(j.rgba),{css:b.toCss(c,m,v,h),rgba:b.toRgba(c,m,v,h)}}f.blend=function(j,x){if(h=(255&x.rgba)/255,h===1)return{css:x.css,rgba:x.rgba};const R=x.rgba>>24&255,S=x.rgba>>16&255,L=x.rgba>>8&255,I=j.rgba>>24&255,P=j.rgba>>16&255,O=j.rgba>>8&255;return c=I+Math.round((R-I)*h),m=P+Math.round((S-P)*h),v=O+Math.round((L-O)*h),{css:b.toCss(c,m,v),rgba:b.toRgba(c,m,v)}},f.isOpaque=function(j){return(255&j.rgba)==255},f.ensureContrastRatio=function(j,x,R){const S=d.ensureContrastRatio(j.rgba,x.rgba,R);if(S)return b.toColor(S>>24&255,S>>16&255,S>>8&255)},f.opaque=function(j){const x=(255|j.rgba)>>>0;return[c,m,v]=d.toChannels(x),{css:b.toCss(c,m,v),rgba:x}},f.opacity=E,f.multiplyOpacity=function(j,x){return h=255&j.rgba,E(j,h*x/255)},f.toColorRGB=function(j){return[j.rgba>>24&255,j.rgba>>16&255,j.rgba>>8&255]}})(T||(i.color=T={})),(function(f){let E,j;try{const x=document.createElement("canvas");x.width=1,x.height=1;const R=x.getContext("2d",{willReadFrequently:!0});R&&(E=R,E.globalCompositeOperation="copy",j=E.createLinearGradient(0,0,1,1))}catch{}f.toColor=function(x){if(x.match(/#[\da-f]{3,8}/i))switch(x.length){case 4:return c=parseInt(x.slice(1,2).repeat(2),16),m=parseInt(x.slice(2,3).repeat(2),16),v=parseInt(x.slice(3,4).repeat(2),16),b.toColor(c,m,v);case 5:return c=parseInt(x.slice(1,2).repeat(2),16),m=parseInt(x.slice(2,3).repeat(2),16),v=parseInt(x.slice(3,4).repeat(2),16),h=parseInt(x.slice(4,5).repeat(2),16),b.toColor(c,m,v,h);case 7:return{css:x,rgba:(parseInt(x.slice(1),16)<<8|255)>>>0};case 9:return{css:x,rgba:parseInt(x.slice(1),16)>>>0}}const R=x.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 c=parseInt(R[1]),m=parseInt(R[2]),v=parseInt(R[3]),h=Math.round(255*(R[5]===void 0?1:parseFloat(R[5]))),b.toColor(c,m,v,h);if(!E||!j)throw new Error("css.toColor: Unsupported css format");if(E.fillStyle=j,E.fillStyle=x,typeof E.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(E.fillRect(0,0,1,1),[c,m,v,h]=E.getImageData(0,0,1,1).data,h!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:b.toRgba(c,m,v,h),css:x}}})(N||(i.css=N={})),(function(f){function E(j,x,R){const S=j/255,L=x/255,I=R/255;return .2126*(S<=.03928?S/12.92:Math.pow((S+.055)/1.055,2.4))+.7152*(L<=.03928?L/12.92:Math.pow((L+.055)/1.055,2.4))+.0722*(I<=.03928?I/12.92:Math.pow((I+.055)/1.055,2.4))}f.relativeLuminance=function(j){return E(j>>16&255,j>>8&255,255&j)},f.relativeLuminance2=E})(w||(i.rgb=w={})),(function(f){function E(x,R,S){const L=x>>24&255,I=x>>16&255,P=x>>8&255;let O=R>>24&255,B=R>>16&255,$=R>>8&255,W=p(w.relativeLuminance2(O,B,$),w.relativeLuminance2(L,I,P));for(;W<S&&(O>0||B>0||$>0);)O-=Math.max(0,Math.ceil(.1*O)),B-=Math.max(0,Math.ceil(.1*B)),$-=Math.max(0,Math.ceil(.1*$)),W=p(w.relativeLuminance2(O,B,$),w.relativeLuminance2(L,I,P));return(O<<24|B<<16|$<<8|255)>>>0}function j(x,R,S){const L=x>>24&255,I=x>>16&255,P=x>>8&255;let O=R>>24&255,B=R>>16&255,$=R>>8&255,W=p(w.relativeLuminance2(O,B,$),w.relativeLuminance2(L,I,P));for(;W<S&&(O<255||B<255||$<255);)O=Math.min(255,O+Math.ceil(.1*(255-O))),B=Math.min(255,B+Math.ceil(.1*(255-B))),$=Math.min(255,$+Math.ceil(.1*(255-$))),W=p(w.relativeLuminance2(O,B,$),w.relativeLuminance2(L,I,P));return(O<<24|B<<16|$<<8|255)>>>0}f.blend=function(x,R){if(h=(255&R)/255,h===1)return R;const S=R>>24&255,L=R>>16&255,I=R>>8&255,P=x>>24&255,O=x>>16&255,B=x>>8&255;return c=P+Math.round((S-P)*h),m=O+Math.round((L-O)*h),v=B+Math.round((I-B)*h),b.toRgba(c,m,v)},f.ensureContrastRatio=function(x,R,S){const L=w.relativeLuminance(x>>8),I=w.relativeLuminance(R>>8);if(p(L,I)<S){if(I<L){const B=E(x,R,S),$=p(L,w.relativeLuminance(B>>8));if($<S){const W=j(x,R,S);return $>p(L,w.relativeLuminance(W>>8))?B:W}return B}const P=j(x,R,S),O=p(L,w.relativeLuminance(P>>8));if(O<S){const B=E(x,R,S);return O>p(L,w.relativeLuminance(B>>8))?P:B}return P}},f.reduceLuminance=E,f.increaseLuminance=j,f.toChannels=function(x){return[x>>24&255,x>>16&255,x>>8&255,255&x]}})(d||(i.rgba=d={})),i.toPaddedHex=g,i.contrastRatio=p},8969:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CoreTerminal=void 0;const m=c(844),v=c(2585),h=c(4348),b=c(7866),T=c(744),N=c(7302),w=c(6975),d=c(8460),g=c(1753),p=c(1480),f=c(7994),E=c(9282),j=c(5435),x=c(5981),R=c(2660);let S=!1;class L extends m.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new d.EventEmitter),this._onScroll.event((P=>{var O;(O=this._onScrollApi)==null||O.fire(P.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(P){for(const O in P)this.optionsService.options[O]=P[O]}constructor(P){super(),this._windowsWrappingHeuristics=this.register(new m.MutableDisposable),this._onBinary=this.register(new d.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new d.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new d.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new d.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new d.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new d.EventEmitter),this._instantiationService=new h.InstantiationService,this.optionsService=this.register(new N.OptionsService(P)),this._instantiationService.setService(v.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(T.BufferService)),this._instantiationService.setService(v.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(b.LogService)),this._instantiationService.setService(v.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(w.CoreService)),this._instantiationService.setService(v.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(g.CoreMouseService)),this._instantiationService.setService(v.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(p.UnicodeService)),this._instantiationService.setService(v.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(f.CharsetService),this._instantiationService.setService(v.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(R.OscLinkService),this._instantiationService.setService(v.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new j.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,d.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,d.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,d.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,d.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((O=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((O=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new x.WriteBuffer(((O,B)=>this._inputHandler.parse(O,B)))),this.register((0,d.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(P,O){this._writeBuffer.write(P,O)}writeSync(P,O){this._logService.logLevel<=v.LogLevelEnum.WARN&&!S&&(this._logService.warn("writeSync is unreliable and will be removed soon."),S=!0),this._writeBuffer.writeSync(P,O)}input(P,O=!0){this.coreService.triggerDataEvent(P,O)}resize(P,O){isNaN(P)||isNaN(O)||(P=Math.max(P,T.MINIMUM_COLS),O=Math.max(O,T.MINIMUM_ROWS),this._bufferService.resize(P,O))}scroll(P,O=!1){this._bufferService.scroll(P,O)}scrollLines(P,O,B){this._bufferService.scrollLines(P,O,B)}scrollPages(P){this.scrollLines(P*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(P){const O=P-this._bufferService.buffer.ydisp;O!==0&&this.scrollLines(O)}registerEscHandler(P,O){return this._inputHandler.registerEscHandler(P,O)}registerDcsHandler(P,O){return this._inputHandler.registerDcsHandler(P,O)}registerCsiHandler(P,O){return this._inputHandler.registerCsiHandler(P,O)}registerOscHandler(P,O){return this._inputHandler.registerOscHandler(P,O)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let P=!1;const O=this.optionsService.rawOptions.windowsPty;O&&O.buildNumber!==void 0&&O.buildNumber!==void 0?P=O.backend==="conpty"&&O.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(P=!0),P?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const P=[];P.push(this.onLineFeed(E.updateWindowsModeWrappedState.bind(null,this._bufferService))),P.push(this.registerCsiHandler({final:"H"},(()=>((0,E.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,m.toDisposable)((()=>{for(const O of P)O.dispose()}))}}}i.CoreTerminal=L},8460:(y,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.runAndSubscribe=i.forwardEvent=i.EventEmitter=void 0,i.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=c=>(this._listeners.push(c),{dispose:()=>{if(!this._disposed){for(let m=0;m<this._listeners.length;m++)if(this._listeners[m]===c)return void this._listeners.splice(m,1)}}})),this._event}fire(c,m){const v=[];for(let h=0;h<this._listeners.length;h++)v.push(this._listeners[h]);for(let h=0;h<v.length;h++)v[h].call(void 0,c,m)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},i.forwardEvent=function(c,m){return c((v=>m.fire(v)))},i.runAndSubscribe=function(c,m){return m(void 0),c((v=>m(v)))}},5435:function(y,i,c){var m=this&&this.__decorate||function(V,F,H,U){var z,te=arguments.length,ie=te<3?F:U===null?U=Object.getOwnPropertyDescriptor(F,H):U;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")ie=Reflect.decorate(V,F,H,U);else for(var we=V.length-1;we>=0;we--)(z=V[we])&&(ie=(te<3?z(ie):te>3?z(F,H,ie):z(F,H))||ie);return te>3&&ie&&Object.defineProperty(F,H,ie),ie},v=this&&this.__param||function(V,F){return function(H,U){F(H,U,V)}};Object.defineProperty(i,"__esModule",{value:!0}),i.InputHandler=i.WindowsOptionsReportType=void 0;const h=c(2584),b=c(7116),T=c(2015),N=c(844),w=c(482),d=c(8437),g=c(8460),p=c(643),f=c(511),E=c(3734),j=c(2585),x=c(1480),R=c(6242),S=c(6351),L=c(5941),I={"(":0,")":1,"*":2,"+":3,"-":1,".":2},P=131072;function O(V,F){if(V>24)return F.setWinLines||!1;switch(V){case 1:return!!F.restoreWin;case 2:return!!F.minimizeWin;case 3:return!!F.setWinPosition;case 4:return!!F.setWinSizePixels;case 5:return!!F.raiseWin;case 6:return!!F.lowerWin;case 7:return!!F.refreshWin;case 8:return!!F.setWinSizeChars;case 9:return!!F.maximizeWin;case 10:return!!F.fullscreenWin;case 11:return!!F.getWinState;case 13:return!!F.getWinPosition;case 14:return!!F.getWinSizePixels;case 15:return!!F.getScreenSizePixels;case 16:return!!F.getCellSizePixels;case 18:return!!F.getWinSizeChars;case 19:return!!F.getScreenSizeChars;case 20:return!!F.getIconTitle;case 21:return!!F.getWinTitle;case 22:return!!F.pushTitle;case 23:return!!F.popTitle;case 24:return!!F.setWinLines}return!1}var B;(function(V){V[V.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",V[V.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(B||(i.WindowsOptionsReportType=B={}));let $=0;class W extends N.Disposable{getAttrData(){return this._curAttrData}constructor(F,H,U,z,te,ie,we,ge,X=new T.EscapeSequenceParser){super(),this._bufferService=F,this._charsetService=H,this._coreService=U,this._logService=z,this._optionsService=te,this._oscLinkService=ie,this._coreMouseService=we,this._unicodeService=ge,this._parser=X,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new w.StringToUtf32,this._utf8Decoder=new w.Utf8ToUtf32,this._workCell=new f.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=d.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=d.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new g.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new g.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new g.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new g.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new g.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new g.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new g.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new g.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new g.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new g.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new g.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new g.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new g.EventEmitter),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 K(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((G=>this._activeBuffer=G.activeBuffer))),this._parser.setCsiHandlerFallback(((G,ee)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(G),params:ee.toArray()})})),this._parser.setEscHandlerFallback((G=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(G)})})),this._parser.setExecuteHandlerFallback((G=>{this._logService.debug("Unknown EXECUTE code: ",{code:G})})),this._parser.setOscHandlerFallback(((G,ee,Z)=>{this._logService.debug("Unknown OSC code: ",{identifier:G,action:ee,data:Z})})),this._parser.setDcsHandlerFallback(((G,ee,Z)=>{ee==="HOOK"&&(Z=Z.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(G),action:ee,payload:Z})})),this._parser.setPrintHandler(((G,ee,Z)=>this.print(G,ee,Z))),this._parser.registerCsiHandler({final:"@"},(G=>this.insertChars(G))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(G=>this.scrollLeft(G))),this._parser.registerCsiHandler({final:"A"},(G=>this.cursorUp(G))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(G=>this.scrollRight(G))),this._parser.registerCsiHandler({final:"B"},(G=>this.cursorDown(G))),this._parser.registerCsiHandler({final:"C"},(G=>this.cursorForward(G))),this._parser.registerCsiHandler({final:"D"},(G=>this.cursorBackward(G))),this._parser.registerCsiHandler({final:"E"},(G=>this.cursorNextLine(G))),this._parser.registerCsiHandler({final:"F"},(G=>this.cursorPrecedingLine(G))),this._parser.registerCsiHandler({final:"G"},(G=>this.cursorCharAbsolute(G))),this._parser.registerCsiHandler({final:"H"},(G=>this.cursorPosition(G))),this._parser.registerCsiHandler({final:"I"},(G=>this.cursorForwardTab(G))),this._parser.registerCsiHandler({final:"J"},(G=>this.eraseInDisplay(G,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(G=>this.eraseInDisplay(G,!0))),this._parser.registerCsiHandler({final:"K"},(G=>this.eraseInLine(G,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(G=>this.eraseInLine(G,!0))),this._parser.registerCsiHandler({final:"L"},(G=>this.insertLines(G))),this._parser.registerCsiHandler({final:"M"},(G=>this.deleteLines(G))),this._parser.registerCsiHandler({final:"P"},(G=>this.deleteChars(G))),this._parser.registerCsiHandler({final:"S"},(G=>this.scrollUp(G))),this._parser.registerCsiHandler({final:"T"},(G=>this.scrollDown(G))),this._parser.registerCsiHandler({final:"X"},(G=>this.eraseChars(G))),this._parser.registerCsiHandler({final:"Z"},(G=>this.cursorBackwardTab(G))),this._parser.registerCsiHandler({final:"`"},(G=>this.charPosAbsolute(G))),this._parser.registerCsiHandler({final:"a"},(G=>this.hPositionRelative(G))),this._parser.registerCsiHandler({final:"b"},(G=>this.repeatPrecedingCharacter(G))),this._parser.registerCsiHandler({final:"c"},(G=>this.sendDeviceAttributesPrimary(G))),this._parser.registerCsiHandler({prefix:">",final:"c"},(G=>this.sendDeviceAttributesSecondary(G))),this._parser.registerCsiHandler({final:"d"},(G=>this.linePosAbsolute(G))),this._parser.registerCsiHandler({final:"e"},(G=>this.vPositionRelative(G))),this._parser.registerCsiHandler({final:"f"},(G=>this.hVPosition(G))),this._parser.registerCsiHandler({final:"g"},(G=>this.tabClear(G))),this._parser.registerCsiHandler({final:"h"},(G=>this.setMode(G))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(G=>this.setModePrivate(G))),this._parser.registerCsiHandler({final:"l"},(G=>this.resetMode(G))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(G=>this.resetModePrivate(G))),this._parser.registerCsiHandler({final:"m"},(G=>this.charAttributes(G))),this._parser.registerCsiHandler({final:"n"},(G=>this.deviceStatus(G))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(G=>this.deviceStatusPrivate(G))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(G=>this.softReset(G))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(G=>this.setCursorStyle(G))),this._parser.registerCsiHandler({final:"r"},(G=>this.setScrollRegion(G))),this._parser.registerCsiHandler({final:"s"},(G=>this.saveCursor(G))),this._parser.registerCsiHandler({final:"t"},(G=>this.windowOptions(G))),this._parser.registerCsiHandler({final:"u"},(G=>this.restoreCursor(G))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(G=>this.insertColumns(G))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(G=>this.deleteColumns(G))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(G=>this.selectProtected(G))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(G=>this.requestMode(G,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(G=>this.requestMode(G,!1))),this._parser.setExecuteHandler(h.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(h.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(h.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(h.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(h.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(h.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(h.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(h.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(h.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(h.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(h.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(h.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new R.OscHandler((G=>(this.setTitle(G),this.setIconName(G),!0)))),this._parser.registerOscHandler(1,new R.OscHandler((G=>this.setIconName(G)))),this._parser.registerOscHandler(2,new R.OscHandler((G=>this.setTitle(G)))),this._parser.registerOscHandler(4,new R.OscHandler((G=>this.setOrReportIndexedColor(G)))),this._parser.registerOscHandler(8,new R.OscHandler((G=>this.setHyperlink(G)))),this._parser.registerOscHandler(10,new R.OscHandler((G=>this.setOrReportFgColor(G)))),this._parser.registerOscHandler(11,new R.OscHandler((G=>this.setOrReportBgColor(G)))),this._parser.registerOscHandler(12,new R.OscHandler((G=>this.setOrReportCursorColor(G)))),this._parser.registerOscHandler(104,new R.OscHandler((G=>this.restoreIndexedColor(G)))),this._parser.registerOscHandler(110,new R.OscHandler((G=>this.restoreFgColor(G)))),this._parser.registerOscHandler(111,new R.OscHandler((G=>this.restoreBgColor(G)))),this._parser.registerOscHandler(112,new R.OscHandler((G=>this.restoreCursorColor(G)))),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(const G in b.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:G},(()=>this.selectCharset("("+G))),this._parser.registerEscHandler({intermediates:")",final:G},(()=>this.selectCharset(")"+G))),this._parser.registerEscHandler({intermediates:"*",final:G},(()=>this.selectCharset("*"+G))),this._parser.registerEscHandler({intermediates:"+",final:G},(()=>this.selectCharset("+"+G))),this._parser.registerEscHandler({intermediates:"-",final:G},(()=>this.selectCharset("-"+G))),this._parser.registerEscHandler({intermediates:".",final:G},(()=>this.selectCharset("."+G))),this._parser.registerEscHandler({intermediates:"/",final:G},(()=>this.selectCharset("/"+G)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((G=>(this._logService.error("Parsing error: ",G),G))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new S.DcsHandler(((G,ee)=>this.requestStatusString(G,ee))))}_preserveStack(F,H,U,z){this._parseStack.paused=!0,this._parseStack.cursorStartX=F,this._parseStack.cursorStartY=H,this._parseStack.decodedLength=U,this._parseStack.position=z}_logSlowResolvingAsync(F){this._logService.logLevel<=j.LogLevelEnum.WARN&&Promise.race([F,new Promise(((H,U)=>setTimeout((()=>U("#SLOW_TIMEOUT")),5e3)))]).catch((H=>{if(H!=="#SLOW_TIMEOUT")throw H;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(F,H){let U,z=this._activeBuffer.x,te=this._activeBuffer.y,ie=0;const we=this._parseStack.paused;if(we){if(U=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,H))return this._logSlowResolvingAsync(U),U;z=this._parseStack.cursorStartX,te=this._parseStack.cursorStartY,this._parseStack.paused=!1,F.length>P&&(ie=this._parseStack.position+P)}if(this._logService.logLevel<=j.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof F=="string"?` "${F}"`:` "${Array.prototype.map.call(F,(G=>String.fromCharCode(G))).join("")}"`),typeof F=="string"?F.split("").map((G=>G.charCodeAt(0))):F),this._parseBuffer.length<F.length&&this._parseBuffer.length<P&&(this._parseBuffer=new Uint32Array(Math.min(F.length,P))),we||this._dirtyRowTracker.clearRange(),F.length>P)for(let G=ie;G<F.length;G+=P){const ee=G+P<F.length?G+P:F.length,Z=typeof F=="string"?this._stringDecoder.decode(F.substring(G,ee),this._parseBuffer):this._utf8Decoder.decode(F.subarray(G,ee),this._parseBuffer);if(U=this._parser.parse(this._parseBuffer,Z))return this._preserveStack(z,te,Z,G),this._logSlowResolvingAsync(U),U}else if(!we){const G=typeof F=="string"?this._stringDecoder.decode(F,this._parseBuffer):this._utf8Decoder.decode(F,this._parseBuffer);if(U=this._parser.parse(this._parseBuffer,G))return this._preserveStack(z,te,G,0),this._logSlowResolvingAsync(U),U}this._activeBuffer.x===z&&this._activeBuffer.y===te||this._onCursorMove.fire();const ge=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),X=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);X<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(X,this._bufferService.rows-1),Math.min(ge,this._bufferService.rows-1))}print(F,H,U){let z,te;const ie=this._charsetService.charset,we=this._optionsService.rawOptions.screenReaderMode,ge=this._bufferService.cols,X=this._coreService.decPrivateModes.wraparound,G=this._coreService.modes.insertMode,ee=this._curAttrData;let Z=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&U-H>0&&Z.getWidth(this._activeBuffer.x-1)===2&&Z.setCellFromCodepoint(this._activeBuffer.x-1,0,1,ee);let ve=this._parser.precedingJoinState;for(let Se=H;Se<U;++Se){if(z=F[Se],z<127&&ie){const tt=ie[String.fromCharCode(z)];tt&&(z=tt.charCodeAt(0))}const Ie=this._unicodeService.charProperties(z,ve);te=x.UnicodeService.extractWidth(Ie);const je=x.UnicodeService.extractShouldJoin(Ie),Je=je?x.UnicodeService.extractWidth(ve):0;if(ve=Ie,we&&this._onA11yChar.fire((0,w.stringFromCodePoint)(z)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+te-Je>ge){if(X){const tt=Z;let Ne=this._activeBuffer.x-Je;for(this._activeBuffer.x=Je,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),Z=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),Je>0&&Z instanceof d.BufferLine&&Z.copyCellsFrom(tt,Ne,0,Je,!1);Ne<ge;)tt.setCellFromCodepoint(Ne++,0,1,ee)}else if(this._activeBuffer.x=ge-1,te===2)continue}if(je&&this._activeBuffer.x){const tt=Z.getWidth(this._activeBuffer.x-1)?1:2;Z.addCodepointToCell(this._activeBuffer.x-tt,z,te);for(let Ne=te-Je;--Ne>=0;)Z.setCellFromCodepoint(this._activeBuffer.x++,0,0,ee)}else if(G&&(Z.insertCells(this._activeBuffer.x,te-Je,this._activeBuffer.getNullCell(ee)),Z.getWidth(ge-1)===2&&Z.setCellFromCodepoint(ge-1,p.NULL_CELL_CODE,p.NULL_CELL_WIDTH,ee)),Z.setCellFromCodepoint(this._activeBuffer.x++,z,te,ee),te>0)for(;--te;)Z.setCellFromCodepoint(this._activeBuffer.x++,0,0,ee)}this._parser.precedingJoinState=ve,this._activeBuffer.x<ge&&U-H>0&&Z.getWidth(this._activeBuffer.x)===0&&!Z.hasContent(this._activeBuffer.x)&&Z.setCellFromCodepoint(this._activeBuffer.x,0,1,ee),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(F,H){return F.final!=="t"||F.prefix||F.intermediates?this._parser.registerCsiHandler(F,H):this._parser.registerCsiHandler(F,(U=>!O(U.params[0],this._optionsService.rawOptions.windowOptions)||H(U)))}registerDcsHandler(F,H){return this._parser.registerDcsHandler(F,new S.DcsHandler(H))}registerEscHandler(F,H){return this._parser.registerEscHandler(F,H)}registerOscHandler(F,H){return this._parser.registerOscHandler(F,new R.OscHandler(H))}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(){var F;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&&((F=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&F.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);H.hasWidth(this._activeBuffer.x)&&!H.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const F=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-F),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(F=this._bufferService.cols-1){this._activeBuffer.x=Math.min(F,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(F,H){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=F,this._activeBuffer.y=this._activeBuffer.scrollTop+H):(this._activeBuffer.x=F,this._activeBuffer.y=H),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(F,H){this._restrictCursor(),this._setCursor(this._activeBuffer.x+F,this._activeBuffer.y+H)}cursorUp(F){const H=this._activeBuffer.y-this._activeBuffer.scrollTop;return H>=0?this._moveCursor(0,-Math.min(H,F.params[0]||1)):this._moveCursor(0,-(F.params[0]||1)),!0}cursorDown(F){const H=this._activeBuffer.scrollBottom-this._activeBuffer.y;return H>=0?this._moveCursor(0,Math.min(H,F.params[0]||1)):this._moveCursor(0,F.params[0]||1),!0}cursorForward(F){return this._moveCursor(F.params[0]||1,0),!0}cursorBackward(F){return this._moveCursor(-(F.params[0]||1),0),!0}cursorNextLine(F){return this.cursorDown(F),this._activeBuffer.x=0,!0}cursorPrecedingLine(F){return this.cursorUp(F),this._activeBuffer.x=0,!0}cursorCharAbsolute(F){return this._setCursor((F.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(F){return this._setCursor(F.length>=2?(F.params[1]||1)-1:0,(F.params[0]||1)-1),!0}charPosAbsolute(F){return this._setCursor((F.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(F){return this._moveCursor(F.params[0]||1,0),!0}linePosAbsolute(F){return this._setCursor(this._activeBuffer.x,(F.params[0]||1)-1),!0}vPositionRelative(F){return this._moveCursor(0,F.params[0]||1),!0}hVPosition(F){return this.cursorPosition(F),!0}tabClear(F){const H=F.params[0];return H===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:H===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(F){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let H=F.params[0]||1;for(;H--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(F){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let H=F.params[0]||1;for(;H--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(F){const H=F.params[0];return H===1&&(this._curAttrData.bg|=536870912),H!==2&&H!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(F,H,U,z=!1,te=!1){const ie=this._activeBuffer.lines.get(this._activeBuffer.ybase+F);ie.replaceCells(H,U,this._activeBuffer.getNullCell(this._eraseAttrData()),te),z&&(ie.isWrapped=!1)}_resetBufferLine(F,H=!1){const U=this._activeBuffer.lines.get(this._activeBuffer.ybase+F);U&&(U.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),H),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+F),U.isWrapped=!1)}eraseInDisplay(F,H=!1){let U;switch(this._restrictCursor(this._bufferService.cols),F.params[0]){case 0:for(U=this._activeBuffer.y,this._dirtyRowTracker.markDirty(U),this._eraseInBufferLine(U++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,H);U<this._bufferService.rows;U++)this._resetBufferLine(U,H);this._dirtyRowTracker.markDirty(U);break;case 1:for(U=this._activeBuffer.y,this._dirtyRowTracker.markDirty(U),this._eraseInBufferLine(U,0,this._activeBuffer.x+1,!0,H),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(U+1).isWrapped=!1);U--;)this._resetBufferLine(U,H);this._dirtyRowTracker.markDirty(0);break;case 2:for(U=this._bufferService.rows,this._dirtyRowTracker.markDirty(U-1);U--;)this._resetBufferLine(U,H);this._dirtyRowTracker.markDirty(0);break;case 3:const z=this._activeBuffer.lines.length-this._bufferService.rows;z>0&&(this._activeBuffer.lines.trimStart(z),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-z,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-z,0),this._onScroll.fire(0))}return!0}eraseInLine(F,H=!1){switch(this._restrictCursor(this._bufferService.cols),F.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,H);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,H);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,H)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(F){this._restrictCursor();let H=F.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const U=this._activeBuffer.ybase+this._activeBuffer.y,z=this._bufferService.rows-1-this._activeBuffer.scrollBottom,te=this._bufferService.rows-1+this._activeBuffer.ybase-z+1;for(;H--;)this._activeBuffer.lines.splice(te-1,1),this._activeBuffer.lines.splice(U,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(F){this._restrictCursor();let H=F.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const U=this._activeBuffer.ybase+this._activeBuffer.y;let z;for(z=this._bufferService.rows-1-this._activeBuffer.scrollBottom,z=this._bufferService.rows-1+this._activeBuffer.ybase-z;H--;)this._activeBuffer.lines.splice(U,1),this._activeBuffer.lines.splice(z,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(F){this._restrictCursor();const H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return H&&(H.insertCells(this._activeBuffer.x,F.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(F){this._restrictCursor();const H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return H&&(H.deleteCells(this._activeBuffer.x,F.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(F){let H=F.params[0]||1;for(;H--;)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(F){let H=F.params[0]||1;for(;H--;)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(d.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(F){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const H=F.params[0]||1;for(let U=this._activeBuffer.scrollTop;U<=this._activeBuffer.scrollBottom;++U){const z=this._activeBuffer.lines.get(this._activeBuffer.ybase+U);z.deleteCells(0,H,this._activeBuffer.getNullCell(this._eraseAttrData())),z.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(F){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const H=F.params[0]||1;for(let U=this._activeBuffer.scrollTop;U<=this._activeBuffer.scrollBottom;++U){const z=this._activeBuffer.lines.get(this._activeBuffer.ybase+U);z.insertCells(0,H,this._activeBuffer.getNullCell(this._eraseAttrData())),z.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(F){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const H=F.params[0]||1;for(let U=this._activeBuffer.scrollTop;U<=this._activeBuffer.scrollBottom;++U){const z=this._activeBuffer.lines.get(this._activeBuffer.ybase+U);z.insertCells(this._activeBuffer.x,H,this._activeBuffer.getNullCell(this._eraseAttrData())),z.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(F){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const H=F.params[0]||1;for(let U=this._activeBuffer.scrollTop;U<=this._activeBuffer.scrollBottom;++U){const z=this._activeBuffer.lines.get(this._activeBuffer.ybase+U);z.deleteCells(this._activeBuffer.x,H,this._activeBuffer.getNullCell(this._eraseAttrData())),z.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(F){this._restrictCursor();const H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return H&&(H.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(F.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(F){const H=this._parser.precedingJoinState;if(!H)return!0;const U=F.params[0]||1,z=x.UnicodeService.extractWidth(H),te=this._activeBuffer.x-z,ie=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(te),we=new Uint32Array(ie.length*U);let ge=0;for(let G=0;G<ie.length;){const ee=ie.codePointAt(G)||0;we[ge++]=ee,G+=ee>65535?2:1}let X=ge;for(let G=1;G<U;++G)we.copyWithin(X,0,ge),X+=ge;return this.print(we,0,X),!0}sendDeviceAttributesPrimary(F){return F.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(h.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(h.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(F){return F.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(h.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(h.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(F.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(h.C0.ESC+"[>83;40003;0c")),!0}_is(F){return(this._optionsService.rawOptions.termName+"").indexOf(F)===0}setMode(F){for(let H=0;H<F.length;H++)switch(F.params[H]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(F){for(let H=0;H<F.length;H++)switch(F.params[H]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,b.DEFAULT_CHARSET),this._charsetService.setgCharset(1,b.DEFAULT_CHARSET),this._charsetService.setgCharset(2,b.DEFAULT_CHARSET),this._charsetService.setgCharset(3,b.DEFAULT_CHARSET);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(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(F){for(let H=0;H<F.length;H++)switch(F.params[H]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(F){for(let H=0;H<F.length;H++)switch(F.params[H]){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:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),F.params[H]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(F,H){const U=this._coreService.decPrivateModes,{activeProtocol:z,activeEncoding:te}=this._coreMouseService,ie=this._coreService,{buffers:we,cols:ge}=this._bufferService,{active:X,alt:G}=we,ee=this._optionsService.rawOptions,Z=je=>je?1:2,ve=F.params[0];return Se=ve,Ie=H?ve===2?4:ve===4?Z(ie.modes.insertMode):ve===12?3:ve===20?Z(ee.convertEol):0:ve===1?Z(U.applicationCursorKeys):ve===3?ee.windowOptions.setWinLines?ge===80?2:ge===132?1:0:0:ve===6?Z(U.origin):ve===7?Z(U.wraparound):ve===8?3:ve===9?Z(z==="X10"):ve===12?Z(ee.cursorBlink):ve===25?Z(!ie.isCursorHidden):ve===45?Z(U.reverseWraparound):ve===66?Z(U.applicationKeypad):ve===67?4:ve===1e3?Z(z==="VT200"):ve===1002?Z(z==="DRAG"):ve===1003?Z(z==="ANY"):ve===1004?Z(U.sendFocus):ve===1005?4:ve===1006?Z(te==="SGR"):ve===1015?4:ve===1016?Z(te==="SGR_PIXELS"):ve===1048?1:ve===47||ve===1047||ve===1049?Z(X===G):ve===2004?Z(U.bracketedPasteMode):0,ie.triggerDataEvent(`${h.C0.ESC}[${H?"":"?"}${Se};${Ie}$y`),!0;var Se,Ie}_updateAttrColor(F,H,U,z,te){return H===2?(F|=50331648,F&=-16777216,F|=E.AttributeData.fromColorRGB([U,z,te])):H===5&&(F&=-50331904,F|=33554432|255&U),F}_extractColor(F,H,U){const z=[0,0,-1,0,0,0];let te=0,ie=0;do{if(z[ie+te]=F.params[H+ie],F.hasSubParams(H+ie)){const we=F.getSubParams(H+ie);let ge=0;do z[1]===5&&(te=1),z[ie+ge+1+te]=we[ge];while(++ge<we.length&&ge+ie+1+te<z.length);break}if(z[1]===5&&ie+te>=2||z[1]===2&&ie+te>=5)break;z[1]&&(te=1)}while(++ie+H<F.length&&ie+te<z.length);for(let we=2;we<z.length;++we)z[we]===-1&&(z[we]=0);switch(z[0]){case 38:U.fg=this._updateAttrColor(U.fg,z[1],z[3],z[4],z[5]);break;case 48:U.bg=this._updateAttrColor(U.bg,z[1],z[3],z[4],z[5]);break;case 58:U.extended=U.extended.clone(),U.extended.underlineColor=this._updateAttrColor(U.extended.underlineColor,z[1],z[3],z[4],z[5])}return ie}_processUnderline(F,H){H.extended=H.extended.clone(),(!~F||F>5)&&(F=1),H.extended.underlineStyle=F,H.fg|=268435456,F===0&&(H.fg&=-268435457),H.updateExtended()}_processSGR0(F){F.fg=d.DEFAULT_ATTR_DATA.fg,F.bg=d.DEFAULT_ATTR_DATA.bg,F.extended=F.extended.clone(),F.extended.underlineStyle=0,F.extended.underlineColor&=-67108864,F.updateExtended()}charAttributes(F){if(F.length===1&&F.params[0]===0)return this._processSGR0(this._curAttrData),!0;const H=F.length;let U;const z=this._curAttrData;for(let te=0;te<H;te++)U=F.params[te],U>=30&&U<=37?(z.fg&=-50331904,z.fg|=16777216|U-30):U>=40&&U<=47?(z.bg&=-50331904,z.bg|=16777216|U-40):U>=90&&U<=97?(z.fg&=-50331904,z.fg|=16777224|U-90):U>=100&&U<=107?(z.bg&=-50331904,z.bg|=16777224|U-100):U===0?this._processSGR0(z):U===1?z.fg|=134217728:U===3?z.bg|=67108864:U===4?(z.fg|=268435456,this._processUnderline(F.hasSubParams(te)?F.getSubParams(te)[0]:1,z)):U===5?z.fg|=536870912:U===7?z.fg|=67108864:U===8?z.fg|=1073741824:U===9?z.fg|=2147483648:U===2?z.bg|=134217728:U===21?this._processUnderline(2,z):U===22?(z.fg&=-134217729,z.bg&=-134217729):U===23?z.bg&=-67108865:U===24?(z.fg&=-268435457,this._processUnderline(0,z)):U===25?z.fg&=-536870913:U===27?z.fg&=-67108865:U===28?z.fg&=-1073741825:U===29?z.fg&=2147483647:U===39?(z.fg&=-67108864,z.fg|=16777215&d.DEFAULT_ATTR_DATA.fg):U===49?(z.bg&=-67108864,z.bg|=16777215&d.DEFAULT_ATTR_DATA.bg):U===38||U===48||U===58?te+=this._extractColor(F,te,z):U===53?z.bg|=1073741824:U===55?z.bg&=-1073741825:U===59?(z.extended=z.extended.clone(),z.extended.underlineColor=-1,z.updateExtended()):U===100?(z.fg&=-67108864,z.fg|=16777215&d.DEFAULT_ATTR_DATA.fg,z.bg&=-67108864,z.bg|=16777215&d.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",U);return!0}deviceStatus(F){switch(F.params[0]){case 5:this._coreService.triggerDataEvent(`${h.C0.ESC}[0n`);break;case 6:const H=this._activeBuffer.y+1,U=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${h.C0.ESC}[${H};${U}R`)}return!0}deviceStatusPrivate(F){if(F.params[0]===6){const H=this._activeBuffer.y+1,U=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${h.C0.ESC}[?${H};${U}R`)}return!0}softReset(F){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=d.DEFAULT_ATTR_DATA.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(F){const H=F.params[0]||1;switch(H){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const U=H%2==1;return this._optionsService.options.cursorBlink=U,!0}setScrollRegion(F){const H=F.params[0]||1;let U;return(F.length<2||(U=F.params[1])>this._bufferService.rows||U===0)&&(U=this._bufferService.rows),U>H&&(this._activeBuffer.scrollTop=H-1,this._activeBuffer.scrollBottom=U-1,this._setCursor(0,0)),!0}windowOptions(F){if(!O(F.params[0],this._optionsService.rawOptions.windowOptions))return!0;const H=F.length>1?F.params[1]:0;switch(F.params[0]){case 14:H!==2&&this._onRequestWindowsOptionsReport.fire(B.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(B.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${h.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:H!==0&&H!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),H!==0&&H!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:H!==0&&H!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),H!==0&&H!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(F){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(F){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(F){return this._windowTitle=F,this._onTitleChange.fire(F),!0}setIconName(F){return this._iconName=F,!0}setOrReportIndexedColor(F){const H=[],U=F.split(";");for(;U.length>1;){const z=U.shift(),te=U.shift();if(/^\d+$/.exec(z)){const ie=parseInt(z);if(Y(ie))if(te==="?")H.push({type:0,index:ie});else{const we=(0,L.parseColor)(te);we&&H.push({type:1,index:ie,color:we})}}}return H.length&&this._onColor.fire(H),!0}setHyperlink(F){const H=F.split(";");return!(H.length<2)&&(H[1]?this._createHyperlink(H[0],H[1]):!H[0]&&this._finishHyperlink())}_createHyperlink(F,H){this._getCurrentLinkId()&&this._finishHyperlink();const U=F.split(":");let z;const te=U.findIndex((ie=>ie.startsWith("id=")));return te!==-1&&(z=U[te].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:z,uri:H}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(F,H){const U=F.split(";");for(let z=0;z<U.length&&!(H>=this._specialColors.length);++z,++H)if(U[z]==="?")this._onColor.fire([{type:0,index:this._specialColors[H]}]);else{const te=(0,L.parseColor)(U[z]);te&&this._onColor.fire([{type:1,index:this._specialColors[H],color:te}])}return!0}setOrReportFgColor(F){return this._setOrReportSpecialColor(F,0)}setOrReportBgColor(F){return this._setOrReportSpecialColor(F,1)}setOrReportCursorColor(F){return this._setOrReportSpecialColor(F,2)}restoreIndexedColor(F){if(!F)return this._onColor.fire([{type:2}]),!0;const H=[],U=F.split(";");for(let z=0;z<U.length;++z)if(/^\d+$/.exec(U[z])){const te=parseInt(U[z]);Y(te)&&H.push({type:2,index:te})}return H.length&&this._onColor.fire(H),!0}restoreFgColor(F){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(F){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(F){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,b.DEFAULT_CHARSET),!0}selectCharset(F){return F.length!==2?(this.selectDefaultCharset(),!0):(F[0]==="/"||this._charsetService.setgCharset(I[F[0]],b.CHARSETS[F[1]]||b.DEFAULT_CHARSET),!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){const F=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,F,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=d.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=d.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(F){return this._charsetService.setgLevel(F),!0}screenAlignmentPattern(){const F=new f.CellData;F.content=4194373,F.fg=this._curAttrData.fg,F.bg=this._curAttrData.bg,this._setCursor(0,0);for(let H=0;H<this._bufferService.rows;++H){const U=this._activeBuffer.ybase+this._activeBuffer.y+H,z=this._activeBuffer.lines.get(U);z&&(z.fill(F),z.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(F,H){const U=this._bufferService.buffer,z=this._optionsService.rawOptions;return(te=>(this._coreService.triggerDataEvent(`${h.C0.ESC}${te}${h.C0.ESC}\\`),!0))(F==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:F==='"p'?'P1$r61;1"p':F==="r"?`P1$r${U.scrollTop+1};${U.scrollBottom+1}r`:F==="m"?"P1$r0m":F===" q"?`P1$r${{block:2,underline:4,bar:6}[z.cursorStyle]-(z.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(F,H){this._dirtyRowTracker.markRangeDirty(F,H)}}i.InputHandler=W;let K=class{constructor(V){this._bufferService=V,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(V){V<this.start?this.start=V:V>this.end&&(this.end=V)}markRangeDirty(V,F){V>F&&($=V,V=F,F=$),V<this.start&&(this.start=V),F>this.end&&(this.end=F)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function Y(V){return 0<=V&&V<256}K=m([v(0,j.IBufferService)],K)},844:(y,i)=>{function c(m){for(const v of m)v.dispose();m.length=0}Object.defineProperty(i,"__esModule",{value:!0}),i.getDisposeArrayDisposable=i.disposeArray=i.toDisposable=i.MutableDisposable=i.Disposable=void 0,i.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const m of this._disposables)m.dispose();this._disposables.length=0}register(m){return this._disposables.push(m),m}unregister(m){const v=this._disposables.indexOf(m);v!==-1&&this._disposables.splice(v,1)}},i.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(m){var v;this._isDisposed||m===this._value||((v=this._value)==null||v.dispose(),this._value=m)}clear(){this.value=void 0}dispose(){var m;this._isDisposed=!0,(m=this._value)==null||m.dispose(),this._value=void 0}},i.toDisposable=function(m){return{dispose:m}},i.disposeArray=c,i.getDisposeArrayDisposable=function(m){return{dispose:()=>c(m)}}},1505:(y,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.FourKeyMap=i.TwoKeyMap=void 0;class c{constructor(){this._data={}}set(v,h,b){this._data[v]||(this._data[v]={}),this._data[v][h]=b}get(v,h){return this._data[v]?this._data[v][h]:void 0}clear(){this._data={}}}i.TwoKeyMap=c,i.FourKeyMap=class{constructor(){this._data=new c}set(m,v,h,b,T){this._data.get(m,v)||this._data.set(m,v,new c),this._data.get(m,v).set(h,b,T)}get(m,v,h,b){var T;return(T=this._data.get(m,v))==null?void 0:T.get(h,b)}clear(){this._data.clear()}}},6114:(y,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.isChromeOS=i.isLinux=i.isWindows=i.isIphone=i.isIpad=i.isMac=i.getSafariVersion=i.isSafari=i.isLegacyEdge=i.isFirefox=i.isNode=void 0,i.isNode=typeof process<"u"&&"title"in process;const c=i.isNode?"node":navigator.userAgent,m=i.isNode?"node":navigator.platform;i.isFirefox=c.includes("Firefox"),i.isLegacyEdge=c.includes("Edge"),i.isSafari=/^((?!chrome|android).)*safari/i.test(c),i.getSafariVersion=function(){if(!i.isSafari)return 0;const v=c.match(/Version\/(\d+)/);return v===null||v.length<2?0:parseInt(v[1])},i.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(m),i.isIpad=m==="iPad",i.isIphone=m==="iPhone",i.isWindows=["Windows","Win16","Win32","WinCE"].includes(m),i.isLinux=m.indexOf("Linux")>=0,i.isChromeOS=/\bCrOS\b/.test(c)},6106:(y,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.SortedList=void 0;let c=0;i.SortedList=class{constructor(m){this._getKey=m,this._array=[]}clear(){this._array.length=0}insert(m){this._array.length!==0?(c=this._search(this._getKey(m)),this._array.splice(c,0,m)):this._array.push(m)}delete(m){if(this._array.length===0)return!1;const v=this._getKey(m);if(v===void 0||(c=this._search(v),c===-1)||this._getKey(this._array[c])!==v)return!1;do if(this._array[c]===m)return this._array.splice(c,1),!0;while(++c<this._array.length&&this._getKey(this._array[c])===v);return!1}*getKeyIterator(m){if(this._array.length!==0&&(c=this._search(m),!(c<0||c>=this._array.length)&&this._getKey(this._array[c])===m))do yield this._array[c];while(++c<this._array.length&&this._getKey(this._array[c])===m)}forEachByKey(m,v){if(this._array.length!==0&&(c=this._search(m),!(c<0||c>=this._array.length)&&this._getKey(this._array[c])===m))do v(this._array[c]);while(++c<this._array.length&&this._getKey(this._array[c])===m)}values(){return[...this._array].values()}_search(m){let v=0,h=this._array.length-1;for(;h>=v;){let b=v+h>>1;const T=this._getKey(this._array[b]);if(T>m)h=b-1;else{if(!(T<m)){for(;b>0&&this._getKey(this._array[b-1])===m;)b--;return b}v=b+1}}return v}}},7226:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.DebouncedIdleTask=i.IdleTaskQueue=i.PriorityTaskQueue=void 0;const m=c(6114);class v{constructor(){this._tasks=[],this._i=0}enqueue(T){this._tasks.push(T),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(T){this._idleCallback=void 0;let N=0,w=0,d=T.timeRemaining(),g=0;for(;this._i<this._tasks.length;){if(N=Date.now(),this._tasks[this._i]()||this._i++,N=Math.max(1,Date.now()-N),w=Math.max(N,w),g=T.timeRemaining(),1.5*w>g)return d-N<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(d-N))}ms`),void this._start();d=g}this.clear()}}class h extends v{_requestCallback(T){return setTimeout((()=>T(this._createDeadline(16))))}_cancelCallback(T){clearTimeout(T)}_createDeadline(T){const N=Date.now()+T;return{timeRemaining:()=>Math.max(0,N-Date.now())}}}i.PriorityTaskQueue=h,i.IdleTaskQueue=!m.isNode&&"requestIdleCallback"in window?class extends v{_requestCallback(b){return requestIdleCallback(b)}_cancelCallback(b){cancelIdleCallback(b)}}:h,i.DebouncedIdleTask=class{constructor(){this._queue=new i.IdleTaskQueue}set(b){this._queue.clear(),this._queue.enqueue(b)}flush(){this._queue.flush()}}},9282:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.updateWindowsModeWrappedState=void 0;const m=c(643);i.updateWindowsModeWrappedState=function(v){const h=v.buffer.lines.get(v.buffer.ybase+v.buffer.y-1),b=h==null?void 0:h.get(v.cols-1),T=v.buffer.lines.get(v.buffer.ybase+v.buffer.y);T&&b&&(T.isWrapped=b[m.CHAR_DATA_CODE_INDEX]!==m.NULL_CELL_CODE&&b[m.CHAR_DATA_CODE_INDEX]!==m.WHITESPACE_CELL_CODE)}},3734:(y,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ExtendedAttrs=i.AttributeData=void 0;class c{constructor(){this.fg=0,this.bg=0,this.extended=new m}static toColorRGB(h){return[h>>>16&255,h>>>8&255,255&h]}static fromColorRGB(h){return(255&h[0])<<16|(255&h[1])<<8|255&h[2]}clone(){const h=new c;return h.fg=this.fg,h.bg=this.bg,h.extended=this.extended.clone(),h}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}i.AttributeData=c;class m{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(h){this._ext=h}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(h){this._ext&=-469762049,this._ext|=h<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(h){this._ext&=-67108864,this._ext|=67108863&h}get urlId(){return this._urlId}set urlId(h){this._urlId=h}get underlineVariantOffset(){const h=(3758096384&this._ext)>>29;return h<0?4294967288^h:h}set underlineVariantOffset(h){this._ext&=536870911,this._ext|=h<<29&3758096384}constructor(h=0,b=0){this._ext=0,this._urlId=0,this._ext=h,this._urlId=b}clone(){return new m(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}i.ExtendedAttrs=m},9092:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Buffer=i.MAX_BUFFER_SIZE=void 0;const m=c(6349),v=c(7226),h=c(3734),b=c(8437),T=c(4634),N=c(511),w=c(643),d=c(4863),g=c(7116);i.MAX_BUFFER_SIZE=4294967295,i.Buffer=class{constructor(p,f,E){this._hasScrollback=p,this._optionsService=f,this._bufferService=E,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=b.DEFAULT_ATTR_DATA.clone(),this.savedCharset=g.DEFAULT_CHARSET,this.markers=[],this._nullCell=N.CellData.fromCharData([0,w.NULL_CELL_CHAR,w.NULL_CELL_WIDTH,w.NULL_CELL_CODE]),this._whitespaceCell=N.CellData.fromCharData([0,w.WHITESPACE_CELL_CHAR,w.WHITESPACE_CELL_WIDTH,w.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new v.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new m.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(p){return p?(this._nullCell.fg=p.fg,this._nullCell.bg=p.bg,this._nullCell.extended=p.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new h.ExtendedAttrs),this._nullCell}getWhitespaceCell(p){return p?(this._whitespaceCell.fg=p.fg,this._whitespaceCell.bg=p.bg,this._whitespaceCell.extended=p.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new h.ExtendedAttrs),this._whitespaceCell}getBlankLine(p,f){return new b.BufferLine(this._bufferService.cols,this.getNullCell(p),f)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const p=this.ybase+this.y-this.ydisp;return p>=0&&p<this._rows}_getCorrectBufferLength(p){if(!this._hasScrollback)return p;const f=p+this._optionsService.rawOptions.scrollback;return f>i.MAX_BUFFER_SIZE?i.MAX_BUFFER_SIZE:f}fillViewportRows(p){if(this.lines.length===0){p===void 0&&(p=b.DEFAULT_ATTR_DATA);let f=this._rows;for(;f--;)this.lines.push(this.getBlankLine(p))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new m.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(p,f){const E=this.getNullCell(b.DEFAULT_ATTR_DATA);let j=0;const x=this._getCorrectBufferLength(f);if(x>this.lines.maxLength&&(this.lines.maxLength=x),this.lines.length>0){if(this._cols<p)for(let S=0;S<this.lines.length;S++)j+=+this.lines.get(S).resize(p,E);let R=0;if(this._rows<f)for(let S=this._rows;S<f;S++)this.lines.length<f+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new b.BufferLine(p,E)):this.ybase>0&&this.lines.length<=this.ybase+this.y+R+1?(this.ybase--,R++,this.ydisp>0&&this.ydisp--):this.lines.push(new b.BufferLine(p,E)));else for(let S=this._rows;S>f;S--)this.lines.length>f+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(x<this.lines.maxLength){const S=this.lines.length-x;S>0&&(this.lines.trimStart(S),this.ybase=Math.max(this.ybase-S,0),this.ydisp=Math.max(this.ydisp-S,0),this.savedY=Math.max(this.savedY-S,0)),this.lines.maxLength=x}this.x=Math.min(this.x,p-1),this.y=Math.min(this.y,f-1),R&&(this.y+=R),this.savedX=Math.min(this.savedX,p-1),this.scrollTop=0}if(this.scrollBottom=f-1,this._isReflowEnabled&&(this._reflow(p,f),this._cols>p))for(let R=0;R<this.lines.length;R++)j+=+this.lines.get(R).resize(p,E);this._cols=p,this._rows=f,this._memoryCleanupQueue.clear(),j>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let p=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,p=!1);let f=0;for(;this._memoryCleanupPosition<this.lines.length;)if(f+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),f>100)return!0;return p}get _isReflowEnabled(){const p=this._optionsService.rawOptions.windowsPty;return p&&p.buildNumber?this._hasScrollback&&p.backend==="conpty"&&p.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(p,f){this._cols!==p&&(p>this._cols?this._reflowLarger(p,f):this._reflowSmaller(p,f))}_reflowLarger(p,f){const E=(0,T.reflowLargerGetLinesToRemove)(this.lines,this._cols,p,this.ybase+this.y,this.getNullCell(b.DEFAULT_ATTR_DATA));if(E.length>0){const j=(0,T.reflowLargerCreateNewLayout)(this.lines,E);(0,T.reflowLargerApplyNewLayout)(this.lines,j.layout),this._reflowLargerAdjustViewport(p,f,j.countRemoved)}}_reflowLargerAdjustViewport(p,f,E){const j=this.getNullCell(b.DEFAULT_ATTR_DATA);let x=E;for(;x-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<f&&this.lines.push(new b.BufferLine(p,j))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-E,0)}_reflowSmaller(p,f){const E=this.getNullCell(b.DEFAULT_ATTR_DATA),j=[];let x=0;for(let R=this.lines.length-1;R>=0;R--){let S=this.lines.get(R);if(!S||!S.isWrapped&&S.getTrimmedLength()<=p)continue;const L=[S];for(;S.isWrapped&&R>0;)S=this.lines.get(--R),L.unshift(S);const I=this.ybase+this.y;if(I>=R&&I<R+L.length)continue;const P=L[L.length-1].getTrimmedLength(),O=(0,T.reflowSmallerGetNewLineLengths)(L,this._cols,p),B=O.length-L.length;let $;$=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+B):Math.max(0,this.lines.length-this.lines.maxLength+B);const W=[];for(let U=0;U<B;U++){const z=this.getBlankLine(b.DEFAULT_ATTR_DATA,!0);W.push(z)}W.length>0&&(j.push({start:R+L.length+x,newLines:W}),x+=W.length),L.push(...W);let K=O.length-1,Y=O[K];Y===0&&(K--,Y=O[K]);let V=L.length-B-1,F=P;for(;V>=0;){const U=Math.min(F,Y);if(L[K]===void 0)break;if(L[K].copyCellsFrom(L[V],F-U,Y-U,U,!0),Y-=U,Y===0&&(K--,Y=O[K]),F-=U,F===0){V--;const z=Math.max(V,0);F=(0,T.getWrappedLineTrimmedLength)(L,z,this._cols)}}for(let U=0;U<L.length;U++)O[U]<p&&L[U].setCell(O[U],E);let H=B-$;for(;H-- >0;)this.ybase===0?this.y<f-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+x)-f&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+B,this.ybase+f-1)}if(j.length>0){const R=[],S=[];for(let K=0;K<this.lines.length;K++)S.push(this.lines.get(K));const L=this.lines.length;let I=L-1,P=0,O=j[P];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+x);let B=0;for(let K=Math.min(this.lines.maxLength-1,L+x-1);K>=0;K--)if(O&&O.start>I+B){for(let Y=O.newLines.length-1;Y>=0;Y--)this.lines.set(K--,O.newLines[Y]);K++,R.push({index:I+1,amount:O.newLines.length}),B+=O.newLines.length,O=j[++P]}else this.lines.set(K,S[I--]);let $=0;for(let K=R.length-1;K>=0;K--)R[K].index+=$,this.lines.onInsertEmitter.fire(R[K]),$+=R[K].amount;const W=Math.max(0,L+x-this.lines.maxLength);W>0&&this.lines.onTrimEmitter.fire(W)}}translateBufferLineToString(p,f,E=0,j){const x=this.lines.get(p);return x?x.translateToString(f,E,j):""}getWrappedRangeForLine(p){let f=p,E=p;for(;f>0&&this.lines.get(f).isWrapped;)f--;for(;E+1<this.lines.length&&this.lines.get(E+1).isWrapped;)E++;return{first:f,last:E}}setupTabStops(p){for(p!=null?this.tabs[p]||(p=this.prevStop(p)):(this.tabs={},p=0);p<this._cols;p+=this._optionsService.rawOptions.tabStopWidth)this.tabs[p]=!0}prevStop(p){for(p==null&&(p=this.x);!this.tabs[--p]&&p>0;);return p>=this._cols?this._cols-1:p<0?0:p}nextStop(p){for(p==null&&(p=this.x);!this.tabs[++p]&&p<this._cols;);return p>=this._cols?this._cols-1:p<0?0:p}clearMarkers(p){this._isClearing=!0;for(let f=0;f<this.markers.length;f++)this.markers[f].line===p&&(this.markers[f].dispose(),this.markers.splice(f--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let p=0;p<this.markers.length;p++)this.markers[p].dispose(),this.markers.splice(p--,1);this._isClearing=!1}addMarker(p){const f=new d.Marker(p);return this.markers.push(f),f.register(this.lines.onTrim((E=>{f.line-=E,f.line<0&&f.dispose()}))),f.register(this.lines.onInsert((E=>{f.line>=E.index&&(f.line+=E.amount)}))),f.register(this.lines.onDelete((E=>{f.line>=E.index&&f.line<E.index+E.amount&&f.dispose(),f.line>E.index&&(f.line-=E.amount)}))),f.register(f.onDispose((()=>this._removeMarker(f)))),f}_removeMarker(p){this._isClearing||this.markers.splice(this.markers.indexOf(p),1)}}},8437:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferLine=i.DEFAULT_ATTR_DATA=void 0;const m=c(3734),v=c(511),h=c(643),b=c(482);i.DEFAULT_ATTR_DATA=Object.freeze(new m.AttributeData);let T=0;class N{constructor(d,g,p=!1){this.isWrapped=p,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*d);const f=g||v.CellData.fromCharData([0,h.NULL_CELL_CHAR,h.NULL_CELL_WIDTH,h.NULL_CELL_CODE]);for(let E=0;E<d;++E)this.setCell(E,f);this.length=d}get(d){const g=this._data[3*d+0],p=2097151&g;return[this._data[3*d+1],2097152&g?this._combined[d]:p?(0,b.stringFromCodePoint)(p):"",g>>22,2097152&g?this._combined[d].charCodeAt(this._combined[d].length-1):p]}set(d,g){this._data[3*d+1]=g[h.CHAR_DATA_ATTR_INDEX],g[h.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[d]=g[1],this._data[3*d+0]=2097152|d|g[h.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*d+0]=g[h.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|g[h.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(d){return this._data[3*d+0]>>22}hasWidth(d){return 12582912&this._data[3*d+0]}getFg(d){return this._data[3*d+1]}getBg(d){return this._data[3*d+2]}hasContent(d){return 4194303&this._data[3*d+0]}getCodePoint(d){const g=this._data[3*d+0];return 2097152&g?this._combined[d].charCodeAt(this._combined[d].length-1):2097151&g}isCombined(d){return 2097152&this._data[3*d+0]}getString(d){const g=this._data[3*d+0];return 2097152&g?this._combined[d]:2097151&g?(0,b.stringFromCodePoint)(2097151&g):""}isProtected(d){return 536870912&this._data[3*d+2]}loadCell(d,g){return T=3*d,g.content=this._data[T+0],g.fg=this._data[T+1],g.bg=this._data[T+2],2097152&g.content&&(g.combinedData=this._combined[d]),268435456&g.bg&&(g.extended=this._extendedAttrs[d]),g}setCell(d,g){2097152&g.content&&(this._combined[d]=g.combinedData),268435456&g.bg&&(this._extendedAttrs[d]=g.extended),this._data[3*d+0]=g.content,this._data[3*d+1]=g.fg,this._data[3*d+2]=g.bg}setCellFromCodepoint(d,g,p,f){268435456&f.bg&&(this._extendedAttrs[d]=f.extended),this._data[3*d+0]=g|p<<22,this._data[3*d+1]=f.fg,this._data[3*d+2]=f.bg}addCodepointToCell(d,g,p){let f=this._data[3*d+0];2097152&f?this._combined[d]+=(0,b.stringFromCodePoint)(g):2097151&f?(this._combined[d]=(0,b.stringFromCodePoint)(2097151&f)+(0,b.stringFromCodePoint)(g),f&=-2097152,f|=2097152):f=g|4194304,p&&(f&=-12582913,f|=p<<22),this._data[3*d+0]=f}insertCells(d,g,p){if((d%=this.length)&&this.getWidth(d-1)===2&&this.setCellFromCodepoint(d-1,0,1,p),g<this.length-d){const f=new v.CellData;for(let E=this.length-d-g-1;E>=0;--E)this.setCell(d+g+E,this.loadCell(d+E,f));for(let E=0;E<g;++E)this.setCell(d+E,p)}else for(let f=d;f<this.length;++f)this.setCell(f,p);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,p)}deleteCells(d,g,p){if(d%=this.length,g<this.length-d){const f=new v.CellData;for(let E=0;E<this.length-d-g;++E)this.setCell(d+E,this.loadCell(d+g+E,f));for(let E=this.length-g;E<this.length;++E)this.setCell(E,p)}else for(let f=d;f<this.length;++f)this.setCell(f,p);d&&this.getWidth(d-1)===2&&this.setCellFromCodepoint(d-1,0,1,p),this.getWidth(d)!==0||this.hasContent(d)||this.setCellFromCodepoint(d,0,1,p)}replaceCells(d,g,p,f=!1){if(f)for(d&&this.getWidth(d-1)===2&&!this.isProtected(d-1)&&this.setCellFromCodepoint(d-1,0,1,p),g<this.length&&this.getWidth(g-1)===2&&!this.isProtected(g)&&this.setCellFromCodepoint(g,0,1,p);d<g&&d<this.length;)this.isProtected(d)||this.setCell(d,p),d++;else for(d&&this.getWidth(d-1)===2&&this.setCellFromCodepoint(d-1,0,1,p),g<this.length&&this.getWidth(g-1)===2&&this.setCellFromCodepoint(g,0,1,p);d<g&&d<this.length;)this.setCell(d++,p)}resize(d,g){if(d===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const p=3*d;if(d>this.length){if(this._data.buffer.byteLength>=4*p)this._data=new Uint32Array(this._data.buffer,0,p);else{const f=new Uint32Array(p);f.set(this._data),this._data=f}for(let f=this.length;f<d;++f)this.setCell(f,g)}else{this._data=this._data.subarray(0,p);const f=Object.keys(this._combined);for(let j=0;j<f.length;j++){const x=parseInt(f[j],10);x>=d&&delete this._combined[x]}const E=Object.keys(this._extendedAttrs);for(let j=0;j<E.length;j++){const x=parseInt(E[j],10);x>=d&&delete this._extendedAttrs[x]}}return this.length=d,4*p*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const d=new Uint32Array(this._data.length);return d.set(this._data),this._data=d,1}return 0}fill(d,g=!1){if(g)for(let p=0;p<this.length;++p)this.isProtected(p)||this.setCell(p,d);else{this._combined={},this._extendedAttrs={};for(let p=0;p<this.length;++p)this.setCell(p,d)}}copyFrom(d){this.length!==d.length?this._data=new Uint32Array(d._data):this._data.set(d._data),this.length=d.length,this._combined={};for(const g in d._combined)this._combined[g]=d._combined[g];this._extendedAttrs={};for(const g in d._extendedAttrs)this._extendedAttrs[g]=d._extendedAttrs[g];this.isWrapped=d.isWrapped}clone(){const d=new N(0);d._data=new Uint32Array(this._data),d.length=this.length;for(const g in this._combined)d._combined[g]=this._combined[g];for(const g in this._extendedAttrs)d._extendedAttrs[g]=this._extendedAttrs[g];return d.isWrapped=this.isWrapped,d}getTrimmedLength(){for(let d=this.length-1;d>=0;--d)if(4194303&this._data[3*d+0])return d+(this._data[3*d+0]>>22);return 0}getNoBgTrimmedLength(){for(let d=this.length-1;d>=0;--d)if(4194303&this._data[3*d+0]||50331648&this._data[3*d+2])return d+(this._data[3*d+0]>>22);return 0}copyCellsFrom(d,g,p,f,E){const j=d._data;if(E)for(let R=f-1;R>=0;R--){for(let S=0;S<3;S++)this._data[3*(p+R)+S]=j[3*(g+R)+S];268435456&j[3*(g+R)+2]&&(this._extendedAttrs[p+R]=d._extendedAttrs[g+R])}else for(let R=0;R<f;R++){for(let S=0;S<3;S++)this._data[3*(p+R)+S]=j[3*(g+R)+S];268435456&j[3*(g+R)+2]&&(this._extendedAttrs[p+R]=d._extendedAttrs[g+R])}const x=Object.keys(d._combined);for(let R=0;R<x.length;R++){const S=parseInt(x[R],10);S>=g&&(this._combined[S-g+p]=d._combined[S])}}translateToString(d,g,p,f){g=g??0,p=p??this.length,d&&(p=Math.min(p,this.getTrimmedLength())),f&&(f.length=0);let E="";for(;g<p;){const j=this._data[3*g+0],x=2097151&j,R=2097152&j?this._combined[g]:x?(0,b.stringFromCodePoint)(x):h.WHITESPACE_CELL_CHAR;if(E+=R,f)for(let S=0;S<R.length;++S)f.push(g);g+=j>>22||1}return f&&f.push(g),E}}i.BufferLine=N},4841:(y,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.getRangeLength=void 0,i.getRangeLength=function(c,m){if(c.start.y>c.end.y)throw new Error(`Buffer range end (${c.end.x}, ${c.end.y}) cannot be before start (${c.start.x}, ${c.start.y})`);return m*(c.end.y-c.start.y)+(c.end.x-c.start.x+1)}},4634:(y,i)=>{function c(m,v,h){if(v===m.length-1)return m[v].getTrimmedLength();const b=!m[v].hasContent(h-1)&&m[v].getWidth(h-1)===1,T=m[v+1].getWidth(0)===2;return b&&T?h-1:h}Object.defineProperty(i,"__esModule",{value:!0}),i.getWrappedLineTrimmedLength=i.reflowSmallerGetNewLineLengths=i.reflowLargerApplyNewLayout=i.reflowLargerCreateNewLayout=i.reflowLargerGetLinesToRemove=void 0,i.reflowLargerGetLinesToRemove=function(m,v,h,b,T){const N=[];for(let w=0;w<m.length-1;w++){let d=w,g=m.get(++d);if(!g.isWrapped)continue;const p=[m.get(w)];for(;d<m.length&&g.isWrapped;)p.push(g),g=m.get(++d);if(b>=w&&b<d){w+=p.length-1;continue}let f=0,E=c(p,f,v),j=1,x=0;for(;j<p.length;){const S=c(p,j,v),L=S-x,I=h-E,P=Math.min(L,I);p[f].copyCellsFrom(p[j],x,E,P,!1),E+=P,E===h&&(f++,E=0),x+=P,x===S&&(j++,x=0),E===0&&f!==0&&p[f-1].getWidth(h-1)===2&&(p[f].copyCellsFrom(p[f-1],h-1,E++,1,!1),p[f-1].setCell(h-1,T))}p[f].replaceCells(E,h,T);let R=0;for(let S=p.length-1;S>0&&(S>f||p[S].getTrimmedLength()===0);S--)R++;R>0&&(N.push(w+p.length-R),N.push(R)),w+=p.length-1}return N},i.reflowLargerCreateNewLayout=function(m,v){const h=[];let b=0,T=v[b],N=0;for(let w=0;w<m.length;w++)if(T===w){const d=v[++b];m.onDeleteEmitter.fire({index:w-N,amount:d}),w+=d-1,N+=d,T=v[++b]}else h.push(w);return{layout:h,countRemoved:N}},i.reflowLargerApplyNewLayout=function(m,v){const h=[];for(let b=0;b<v.length;b++)h.push(m.get(v[b]));for(let b=0;b<h.length;b++)m.set(b,h[b]);m.length=v.length},i.reflowSmallerGetNewLineLengths=function(m,v,h){const b=[],T=m.map(((g,p)=>c(m,p,v))).reduce(((g,p)=>g+p));let N=0,w=0,d=0;for(;d<T;){if(T-d<h){b.push(T-d);break}N+=h;const g=c(m,w,v);N>g&&(N-=g,w++);const p=m[w].getWidth(N-1)===2;p&&N--;const f=p?h-1:h;b.push(f),d+=f}return b},i.getWrappedLineTrimmedLength=c},5295:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferSet=void 0;const m=c(8460),v=c(844),h=c(9092);class b extends v.Disposable{constructor(N,w){super(),this._optionsService=N,this._bufferService=w,this._onBufferActivate=this.register(new m.EventEmitter),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 h.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new h.Buffer(!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(N){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(N),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(N,w){this._normal.resize(N,w),this._alt.resize(N,w),this.setupTabStops(N)}setupTabStops(N){this._normal.setupTabStops(N),this._alt.setupTabStops(N)}}i.BufferSet=b},511:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CellData=void 0;const m=c(482),v=c(643),h=c(3734);class b extends h.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new h.ExtendedAttrs,this.combinedData=""}static fromCharData(N){const w=new b;return w.setFromCharData(N),w}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,m.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(N){this.fg=N[v.CHAR_DATA_ATTR_INDEX],this.bg=0;let w=!1;if(N[v.CHAR_DATA_CHAR_INDEX].length>2)w=!0;else if(N[v.CHAR_DATA_CHAR_INDEX].length===2){const d=N[v.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=d&&d<=56319){const g=N[v.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=g&&g<=57343?this.content=1024*(d-55296)+g-56320+65536|N[v.CHAR_DATA_WIDTH_INDEX]<<22:w=!0}else w=!0}else this.content=N[v.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|N[v.CHAR_DATA_WIDTH_INDEX]<<22;w&&(this.combinedData=N[v.CHAR_DATA_CHAR_INDEX],this.content=2097152|N[v.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}i.CellData=b},643:(y,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.WHITESPACE_CELL_CODE=i.WHITESPACE_CELL_WIDTH=i.WHITESPACE_CELL_CHAR=i.NULL_CELL_CODE=i.NULL_CELL_WIDTH=i.NULL_CELL_CHAR=i.CHAR_DATA_CODE_INDEX=i.CHAR_DATA_WIDTH_INDEX=i.CHAR_DATA_CHAR_INDEX=i.CHAR_DATA_ATTR_INDEX=i.DEFAULT_EXT=i.DEFAULT_ATTR=i.DEFAULT_COLOR=void 0,i.DEFAULT_COLOR=0,i.DEFAULT_ATTR=256|i.DEFAULT_COLOR<<9,i.DEFAULT_EXT=0,i.CHAR_DATA_ATTR_INDEX=0,i.CHAR_DATA_CHAR_INDEX=1,i.CHAR_DATA_WIDTH_INDEX=2,i.CHAR_DATA_CODE_INDEX=3,i.NULL_CELL_CHAR="",i.NULL_CELL_WIDTH=1,i.NULL_CELL_CODE=0,i.WHITESPACE_CELL_CHAR=" ",i.WHITESPACE_CELL_WIDTH=1,i.WHITESPACE_CELL_CODE=32},4863:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Marker=void 0;const m=c(8460),v=c(844);class h{get id(){return this._id}constructor(T){this.line=T,this.isDisposed=!1,this._disposables=[],this._id=h._nextId++,this._onDispose=this.register(new m.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,v.disposeArray)(this._disposables),this._disposables.length=0)}register(T){return this._disposables.push(T),T}}i.Marker=h,h._nextId=1},7116:(y,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.DEFAULT_CHARSET=i.CHARSETS=void 0,i.CHARSETS={},i.DEFAULT_CHARSET=i.CHARSETS.B,i.CHARSETS[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:"≥","{":"π","|":"≠","}":"£","~":"·"},i.CHARSETS.A={"#":"£"},i.CHARSETS.B=void 0,i.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},i.CHARSETS.C=i.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},i.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},i.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},i.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},i.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},i.CHARSETS.E=i.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},i.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},i.CHARSETS.H=i.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},i.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(y,i)=>{var c,m,v;Object.defineProperty(i,"__esModule",{value:!0}),i.C1_ESCAPED=i.C1=i.C0=void 0,(function(h){h.NUL="\0",h.SOH="",h.STX="",h.ETX="",h.EOT="",h.ENQ="",h.ACK="",h.BEL="\x07",h.BS="\b",h.HT=" ",h.LF=`
|
|
122
|
+
`,h.VT="\v",h.FF="\f",h.CR="\r",h.SO="",h.SI="",h.DLE="",h.DC1="",h.DC2="",h.DC3="",h.DC4="",h.NAK="",h.SYN="",h.ETB="",h.CAN="",h.EM="",h.SUB="",h.ESC="\x1B",h.FS="",h.GS="",h.RS="",h.US="",h.SP=" ",h.DEL=""})(c||(i.C0=c={})),(function(h){h.PAD="",h.HOP="",h.BPH="",h.NBH="",h.IND="",h.NEL="
",h.SSA="",h.ESA="",h.HTS="",h.HTJ="",h.VTS="",h.PLD="",h.PLU="",h.RI="",h.SS2="",h.SS3="",h.DCS="",h.PU1="",h.PU2="",h.STS="",h.CCH="",h.MW="",h.SPA="",h.EPA="",h.SOS="",h.SGCI="",h.SCI="",h.CSI="",h.ST="",h.OSC="",h.PM="",h.APC=""})(m||(i.C1=m={})),(function(h){h.ST=`${c.ESC}\\`})(v||(i.C1_ESCAPED=v={}))},7399:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.evaluateKeyboardEvent=void 0;const m=c(2584),v={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:["'",'"']};i.evaluateKeyboardEvent=function(h,b,T,N){const w={type:0,cancel:!1,key:void 0},d=(h.shiftKey?1:0)|(h.altKey?2:0)|(h.ctrlKey?4:0)|(h.metaKey?8:0);switch(h.keyCode){case 0:h.key==="UIKeyInputUpArrow"?w.key=b?m.C0.ESC+"OA":m.C0.ESC+"[A":h.key==="UIKeyInputLeftArrow"?w.key=b?m.C0.ESC+"OD":m.C0.ESC+"[D":h.key==="UIKeyInputRightArrow"?w.key=b?m.C0.ESC+"OC":m.C0.ESC+"[C":h.key==="UIKeyInputDownArrow"&&(w.key=b?m.C0.ESC+"OB":m.C0.ESC+"[B");break;case 8:w.key=h.ctrlKey?"\b":m.C0.DEL,h.altKey&&(w.key=m.C0.ESC+w.key);break;case 9:if(h.shiftKey){w.key=m.C0.ESC+"[Z";break}w.key=m.C0.HT,w.cancel=!0;break;case 13:w.key=h.altKey?m.C0.ESC+m.C0.CR:m.C0.CR,w.cancel=!0;break;case 27:w.key=m.C0.ESC,h.altKey&&(w.key=m.C0.ESC+m.C0.ESC),w.cancel=!0;break;case 37:if(h.metaKey)break;d?(w.key=m.C0.ESC+"[1;"+(d+1)+"D",w.key===m.C0.ESC+"[1;3D"&&(w.key=m.C0.ESC+(T?"b":"[1;5D"))):w.key=b?m.C0.ESC+"OD":m.C0.ESC+"[D";break;case 39:if(h.metaKey)break;d?(w.key=m.C0.ESC+"[1;"+(d+1)+"C",w.key===m.C0.ESC+"[1;3C"&&(w.key=m.C0.ESC+(T?"f":"[1;5C"))):w.key=b?m.C0.ESC+"OC":m.C0.ESC+"[C";break;case 38:if(h.metaKey)break;d?(w.key=m.C0.ESC+"[1;"+(d+1)+"A",T||w.key!==m.C0.ESC+"[1;3A"||(w.key=m.C0.ESC+"[1;5A")):w.key=b?m.C0.ESC+"OA":m.C0.ESC+"[A";break;case 40:if(h.metaKey)break;d?(w.key=m.C0.ESC+"[1;"+(d+1)+"B",T||w.key!==m.C0.ESC+"[1;3B"||(w.key=m.C0.ESC+"[1;5B")):w.key=b?m.C0.ESC+"OB":m.C0.ESC+"[B";break;case 45:h.shiftKey||h.ctrlKey||(w.key=m.C0.ESC+"[2~");break;case 46:w.key=d?m.C0.ESC+"[3;"+(d+1)+"~":m.C0.ESC+"[3~";break;case 36:w.key=d?m.C0.ESC+"[1;"+(d+1)+"H":b?m.C0.ESC+"OH":m.C0.ESC+"[H";break;case 35:w.key=d?m.C0.ESC+"[1;"+(d+1)+"F":b?m.C0.ESC+"OF":m.C0.ESC+"[F";break;case 33:h.shiftKey?w.type=2:h.ctrlKey?w.key=m.C0.ESC+"[5;"+(d+1)+"~":w.key=m.C0.ESC+"[5~";break;case 34:h.shiftKey?w.type=3:h.ctrlKey?w.key=m.C0.ESC+"[6;"+(d+1)+"~":w.key=m.C0.ESC+"[6~";break;case 112:w.key=d?m.C0.ESC+"[1;"+(d+1)+"P":m.C0.ESC+"OP";break;case 113:w.key=d?m.C0.ESC+"[1;"+(d+1)+"Q":m.C0.ESC+"OQ";break;case 114:w.key=d?m.C0.ESC+"[1;"+(d+1)+"R":m.C0.ESC+"OR";break;case 115:w.key=d?m.C0.ESC+"[1;"+(d+1)+"S":m.C0.ESC+"OS";break;case 116:w.key=d?m.C0.ESC+"[15;"+(d+1)+"~":m.C0.ESC+"[15~";break;case 117:w.key=d?m.C0.ESC+"[17;"+(d+1)+"~":m.C0.ESC+"[17~";break;case 118:w.key=d?m.C0.ESC+"[18;"+(d+1)+"~":m.C0.ESC+"[18~";break;case 119:w.key=d?m.C0.ESC+"[19;"+(d+1)+"~":m.C0.ESC+"[19~";break;case 120:w.key=d?m.C0.ESC+"[20;"+(d+1)+"~":m.C0.ESC+"[20~";break;case 121:w.key=d?m.C0.ESC+"[21;"+(d+1)+"~":m.C0.ESC+"[21~";break;case 122:w.key=d?m.C0.ESC+"[23;"+(d+1)+"~":m.C0.ESC+"[23~";break;case 123:w.key=d?m.C0.ESC+"[24;"+(d+1)+"~":m.C0.ESC+"[24~";break;default:if(!h.ctrlKey||h.shiftKey||h.altKey||h.metaKey)if(T&&!N||!h.altKey||h.metaKey)!T||h.altKey||h.ctrlKey||h.shiftKey||!h.metaKey?h.key&&!h.ctrlKey&&!h.altKey&&!h.metaKey&&h.keyCode>=48&&h.key.length===1?w.key=h.key:h.key&&h.ctrlKey&&(h.key==="_"&&(w.key=m.C0.US),h.key==="@"&&(w.key=m.C0.NUL)):h.keyCode===65&&(w.type=1);else{const g=v[h.keyCode],p=g==null?void 0:g[h.shiftKey?1:0];if(p)w.key=m.C0.ESC+p;else if(h.keyCode>=65&&h.keyCode<=90){const f=h.ctrlKey?h.keyCode-64:h.keyCode+32;let E=String.fromCharCode(f);h.shiftKey&&(E=E.toUpperCase()),w.key=m.C0.ESC+E}else if(h.keyCode===32)w.key=m.C0.ESC+(h.ctrlKey?m.C0.NUL:" ");else if(h.key==="Dead"&&h.code.startsWith("Key")){let f=h.code.slice(3,4);h.shiftKey||(f=f.toLowerCase()),w.key=m.C0.ESC+f,w.cancel=!0}}else h.keyCode>=65&&h.keyCode<=90?w.key=String.fromCharCode(h.keyCode-64):h.keyCode===32?w.key=m.C0.NUL:h.keyCode>=51&&h.keyCode<=55?w.key=String.fromCharCode(h.keyCode-51+27):h.keyCode===56?w.key=m.C0.DEL:h.keyCode===219?w.key=m.C0.ESC:h.keyCode===220?w.key=m.C0.FS:h.keyCode===221&&(w.key=m.C0.GS)}return w}},482:(y,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Utf8ToUtf32=i.StringToUtf32=i.utf32ToString=i.stringFromCodePoint=void 0,i.stringFromCodePoint=function(c){return c>65535?(c-=65536,String.fromCharCode(55296+(c>>10))+String.fromCharCode(c%1024+56320)):String.fromCharCode(c)},i.utf32ToString=function(c,m=0,v=c.length){let h="";for(let b=m;b<v;++b){let T=c[b];T>65535?(T-=65536,h+=String.fromCharCode(55296+(T>>10))+String.fromCharCode(T%1024+56320)):h+=String.fromCharCode(T)}return h},i.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(c,m){const v=c.length;if(!v)return 0;let h=0,b=0;if(this._interim){const T=c.charCodeAt(b++);56320<=T&&T<=57343?m[h++]=1024*(this._interim-55296)+T-56320+65536:(m[h++]=this._interim,m[h++]=T),this._interim=0}for(let T=b;T<v;++T){const N=c.charCodeAt(T);if(55296<=N&&N<=56319){if(++T>=v)return this._interim=N,h;const w=c.charCodeAt(T);56320<=w&&w<=57343?m[h++]=1024*(N-55296)+w-56320+65536:(m[h++]=N,m[h++]=w)}else N!==65279&&(m[h++]=N)}return h}},i.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(c,m){const v=c.length;if(!v)return 0;let h,b,T,N,w=0,d=0,g=0;if(this.interim[0]){let E=!1,j=this.interim[0];j&=(224&j)==192?31:(240&j)==224?15:7;let x,R=0;for(;(x=63&this.interim[++R])&&R<4;)j<<=6,j|=x;const S=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,L=S-R;for(;g<L;){if(g>=v)return 0;if(x=c[g++],(192&x)!=128){g--,E=!0;break}this.interim[R++]=x,j<<=6,j|=63&x}E||(S===2?j<128?g--:m[w++]=j:S===3?j<2048||j>=55296&&j<=57343||j===65279||(m[w++]=j):j<65536||j>1114111||(m[w++]=j)),this.interim.fill(0)}const p=v-4;let f=g;for(;f<v;){for(;!(!(f<p)||128&(h=c[f])||128&(b=c[f+1])||128&(T=c[f+2])||128&(N=c[f+3]));)m[w++]=h,m[w++]=b,m[w++]=T,m[w++]=N,f+=4;if(h=c[f++],h<128)m[w++]=h;else if((224&h)==192){if(f>=v)return this.interim[0]=h,w;if(b=c[f++],(192&b)!=128){f--;continue}if(d=(31&h)<<6|63&b,d<128){f--;continue}m[w++]=d}else if((240&h)==224){if(f>=v)return this.interim[0]=h,w;if(b=c[f++],(192&b)!=128){f--;continue}if(f>=v)return this.interim[0]=h,this.interim[1]=b,w;if(T=c[f++],(192&T)!=128){f--;continue}if(d=(15&h)<<12|(63&b)<<6|63&T,d<2048||d>=55296&&d<=57343||d===65279)continue;m[w++]=d}else if((248&h)==240){if(f>=v)return this.interim[0]=h,w;if(b=c[f++],(192&b)!=128){f--;continue}if(f>=v)return this.interim[0]=h,this.interim[1]=b,w;if(T=c[f++],(192&T)!=128){f--;continue}if(f>=v)return this.interim[0]=h,this.interim[1]=b,this.interim[2]=T,w;if(N=c[f++],(192&N)!=128){f--;continue}if(d=(7&h)<<18|(63&b)<<12|(63&T)<<6|63&N,d<65536||d>1114111)continue;m[w++]=d}}return w}}},225:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.UnicodeV6=void 0;const m=c(1480),v=[[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]],h=[[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]];let b;i.UnicodeV6=class{constructor(){if(this.version="6",!b){b=new Uint8Array(65536),b.fill(1),b[0]=0,b.fill(0,1,32),b.fill(0,127,160),b.fill(2,4352,4448),b[9001]=2,b[9002]=2,b.fill(2,11904,42192),b[12351]=1,b.fill(2,44032,55204),b.fill(2,63744,64256),b.fill(2,65040,65050),b.fill(2,65072,65136),b.fill(2,65280,65377),b.fill(2,65504,65511);for(let T=0;T<v.length;++T)b.fill(0,v[T][0],v[T][1]+1)}}wcwidth(T){return T<32?0:T<127?1:T<65536?b[T]:(function(N,w){let d,g=0,p=w.length-1;if(N<w[0][0]||N>w[p][1])return!1;for(;p>=g;)if(d=g+p>>1,N>w[d][1])g=d+1;else{if(!(N<w[d][0]))return!0;p=d-1}return!1})(T,h)?0:T>=131072&&T<=196605||T>=196608&&T<=262141?2:1}charProperties(T,N){let w=this.wcwidth(T),d=w===0&&N!==0;if(d){const g=m.UnicodeService.extractWidth(N);g===0?d=!1:g>w&&(w=g)}return m.UnicodeService.createPropertyValue(0,w,d)}}},5981:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.WriteBuffer=void 0;const m=c(8460),v=c(844);class h extends v.Disposable{constructor(T){super(),this._action=T,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new m.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(T,N){if(N!==void 0&&this._syncCalls>N)return void(this._syncCalls=0);if(this._pendingData+=T.length,this._writeBuffer.push(T),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let w;for(this._isSyncWriting=!0;w=this._writeBuffer.shift();){this._action(w);const d=this._callbacks.shift();d&&d()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(T,N){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=T.length,this._writeBuffer.push(T),this._callbacks.push(N),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=T.length,this._writeBuffer.push(T),this._callbacks.push(N)}_innerWrite(T=0,N=!0){const w=T||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const d=this._writeBuffer[this._bufferOffset],g=this._action(d,N);if(g){const f=E=>Date.now()-w>=12?setTimeout((()=>this._innerWrite(0,E))):this._innerWrite(w,E);return void g.catch((E=>(queueMicrotask((()=>{throw E})),Promise.resolve(!1)))).then(f)}const p=this._callbacks[this._bufferOffset];if(p&&p(),this._bufferOffset++,this._pendingData-=d.length,Date.now()-w>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(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()}}i.WriteBuffer=h},5941:(y,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.toRgbString=i.parseColor=void 0;const c=/^([\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})$/,m=/^[\da-f]+$/;function v(h,b){const T=h.toString(16),N=T.length<2?"0"+T:T;switch(b){case 4:return T[0];case 8:return N;case 12:return(N+N).slice(0,3);default:return N+N}}i.parseColor=function(h){if(!h)return;let b=h.toLowerCase();if(b.indexOf("rgb:")===0){b=b.slice(4);const T=c.exec(b);if(T){const N=T[1]?15:T[4]?255:T[7]?4095:65535;return[Math.round(parseInt(T[1]||T[4]||T[7]||T[10],16)/N*255),Math.round(parseInt(T[2]||T[5]||T[8]||T[11],16)/N*255),Math.round(parseInt(T[3]||T[6]||T[9]||T[12],16)/N*255)]}}else if(b.indexOf("#")===0&&(b=b.slice(1),m.exec(b)&&[3,6,9,12].includes(b.length))){const T=b.length/3,N=[0,0,0];for(let w=0;w<3;++w){const d=parseInt(b.slice(T*w,T*w+T),16);N[w]=T===1?d<<4:T===2?d:T===3?d>>4:d>>8}return N}},i.toRgbString=function(h,b=16){const[T,N,w]=h;return`rgb:${v(T,b)}/${v(N,b)}/${v(w,b)}`}},5770:(y,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.PAYLOAD_LIMIT=void 0,i.PAYLOAD_LIMIT=1e7},6351:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.DcsHandler=i.DcsParser=void 0;const m=c(482),v=c(8742),h=c(5770),b=[];i.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=b,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=b}registerHandler(N,w){this._handlers[N]===void 0&&(this._handlers[N]=[]);const d=this._handlers[N];return d.push(w),{dispose:()=>{const g=d.indexOf(w);g!==-1&&d.splice(g,1)}}}clearHandler(N){this._handlers[N]&&delete this._handlers[N]}setHandlerFallback(N){this._handlerFb=N}reset(){if(this._active.length)for(let N=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;N>=0;--N)this._active[N].unhook(!1);this._stack.paused=!1,this._active=b,this._ident=0}hook(N,w){if(this.reset(),this._ident=N,this._active=this._handlers[N]||b,this._active.length)for(let d=this._active.length-1;d>=0;d--)this._active[d].hook(w);else this._handlerFb(this._ident,"HOOK",w)}put(N,w,d){if(this._active.length)for(let g=this._active.length-1;g>=0;g--)this._active[g].put(N,w,d);else this._handlerFb(this._ident,"PUT",(0,m.utf32ToString)(N,w,d))}unhook(N,w=!0){if(this._active.length){let d=!1,g=this._active.length-1,p=!1;if(this._stack.paused&&(g=this._stack.loopPosition-1,d=w,p=this._stack.fallThrough,this._stack.paused=!1),!p&&d===!1){for(;g>=0&&(d=this._active[g].unhook(N),d!==!0);g--)if(d instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=g,this._stack.fallThrough=!1,d;g--}for(;g>=0;g--)if(d=this._active[g].unhook(!1),d instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=g,this._stack.fallThrough=!0,d}else this._handlerFb(this._ident,"UNHOOK",N);this._active=b,this._ident=0}};const T=new v.Params;T.addParam(0),i.DcsHandler=class{constructor(N){this._handler=N,this._data="",this._params=T,this._hitLimit=!1}hook(N){this._params=N.length>1||N.params[0]?N.clone():T,this._data="",this._hitLimit=!1}put(N,w,d){this._hitLimit||(this._data+=(0,m.utf32ToString)(N,w,d),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(N){let w=!1;if(this._hitLimit)w=!1;else if(N&&(w=this._handler(this._data,this._params),w instanceof Promise))return w.then((d=>(this._params=T,this._data="",this._hitLimit=!1,d)));return this._params=T,this._data="",this._hitLimit=!1,w}}},2015:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.EscapeSequenceParser=i.VT500_TRANSITION_TABLE=i.TransitionTable=void 0;const m=c(844),v=c(8742),h=c(6242),b=c(6351);class T{constructor(g){this.table=new Uint8Array(g)}setDefault(g,p){this.table.fill(g<<4|p)}add(g,p,f,E){this.table[p<<8|g]=f<<4|E}addMany(g,p,f,E){for(let j=0;j<g.length;j++)this.table[p<<8|g[j]]=f<<4|E}}i.TransitionTable=T;const N=160;i.VT500_TRANSITION_TABLE=(function(){const d=new T(4095),g=Array.apply(null,Array(256)).map(((R,S)=>S)),p=(R,S)=>g.slice(R,S),f=p(32,127),E=p(0,24);E.push(25),E.push.apply(E,p(28,32));const j=p(0,14);let x;for(x in d.setDefault(1,0),d.addMany(f,0,2,0),j)d.addMany([24,26,153,154],x,3,0),d.addMany(p(128,144),x,3,0),d.addMany(p(144,152),x,3,0),d.add(156,x,0,0),d.add(27,x,11,1),d.add(157,x,4,8),d.addMany([152,158,159],x,0,7),d.add(155,x,11,3),d.add(144,x,11,9);return d.addMany(E,0,3,0),d.addMany(E,1,3,1),d.add(127,1,0,1),d.addMany(E,8,0,8),d.addMany(E,3,3,3),d.add(127,3,0,3),d.addMany(E,4,3,4),d.add(127,4,0,4),d.addMany(E,6,3,6),d.addMany(E,5,3,5),d.add(127,5,0,5),d.addMany(E,2,3,2),d.add(127,2,0,2),d.add(93,1,4,8),d.addMany(f,8,5,8),d.add(127,8,5,8),d.addMany([156,27,24,26,7],8,6,0),d.addMany(p(28,32),8,0,8),d.addMany([88,94,95],1,0,7),d.addMany(f,7,0,7),d.addMany(E,7,0,7),d.add(156,7,0,0),d.add(127,7,0,7),d.add(91,1,11,3),d.addMany(p(64,127),3,7,0),d.addMany(p(48,60),3,8,4),d.addMany([60,61,62,63],3,9,4),d.addMany(p(48,60),4,8,4),d.addMany(p(64,127),4,7,0),d.addMany([60,61,62,63],4,0,6),d.addMany(p(32,64),6,0,6),d.add(127,6,0,6),d.addMany(p(64,127),6,0,0),d.addMany(p(32,48),3,9,5),d.addMany(p(32,48),5,9,5),d.addMany(p(48,64),5,0,6),d.addMany(p(64,127),5,7,0),d.addMany(p(32,48),4,9,5),d.addMany(p(32,48),1,9,2),d.addMany(p(32,48),2,9,2),d.addMany(p(48,127),2,10,0),d.addMany(p(48,80),1,10,0),d.addMany(p(81,88),1,10,0),d.addMany([89,90,92],1,10,0),d.addMany(p(96,127),1,10,0),d.add(80,1,11,9),d.addMany(E,9,0,9),d.add(127,9,0,9),d.addMany(p(28,32),9,0,9),d.addMany(p(32,48),9,9,12),d.addMany(p(48,60),9,8,10),d.addMany([60,61,62,63],9,9,10),d.addMany(E,11,0,11),d.addMany(p(32,128),11,0,11),d.addMany(p(28,32),11,0,11),d.addMany(E,10,0,10),d.add(127,10,0,10),d.addMany(p(28,32),10,0,10),d.addMany(p(48,60),10,8,10),d.addMany([60,61,62,63],10,0,11),d.addMany(p(32,48),10,9,12),d.addMany(E,12,0,12),d.add(127,12,0,12),d.addMany(p(28,32),12,0,12),d.addMany(p(32,48),12,9,12),d.addMany(p(48,64),12,0,11),d.addMany(p(64,127),12,12,13),d.addMany(p(64,127),10,12,13),d.addMany(p(64,127),9,12,13),d.addMany(E,13,13,13),d.addMany(f,13,13,13),d.add(127,13,0,13),d.addMany([27,156,24,26],13,14,0),d.add(N,0,2,0),d.add(N,8,5,8),d.add(N,6,0,6),d.add(N,11,0,11),d.add(N,13,13,13),d})();class w extends m.Disposable{constructor(g=i.VT500_TRANSITION_TABLE){super(),this._transitions=g,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new v.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(p,f,E)=>{},this._executeHandlerFb=p=>{},this._csiHandlerFb=(p,f)=>{},this._escHandlerFb=p=>{},this._errorHandlerFb=p=>p,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,m.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new h.OscParser),this._dcsParser=this.register(new b.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(g,p=[64,126]){let f=0;if(g.prefix){if(g.prefix.length>1)throw new Error("only one byte as prefix supported");if(f=g.prefix.charCodeAt(0),f&&60>f||f>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(g.intermediates){if(g.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let j=0;j<g.intermediates.length;++j){const x=g.intermediates.charCodeAt(j);if(32>x||x>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");f<<=8,f|=x}}if(g.final.length!==1)throw new Error("final must be a single byte");const E=g.final.charCodeAt(0);if(p[0]>E||E>p[1])throw new Error(`final must be in range ${p[0]} .. ${p[1]}`);return f<<=8,f|=E,f}identToString(g){const p=[];for(;g;)p.push(String.fromCharCode(255&g)),g>>=8;return p.reverse().join("")}setPrintHandler(g){this._printHandler=g}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(g,p){const f=this._identifier(g,[48,126]);this._escHandlers[f]===void 0&&(this._escHandlers[f]=[]);const E=this._escHandlers[f];return E.push(p),{dispose:()=>{const j=E.indexOf(p);j!==-1&&E.splice(j,1)}}}clearEscHandler(g){this._escHandlers[this._identifier(g,[48,126])]&&delete this._escHandlers[this._identifier(g,[48,126])]}setEscHandlerFallback(g){this._escHandlerFb=g}setExecuteHandler(g,p){this._executeHandlers[g.charCodeAt(0)]=p}clearExecuteHandler(g){this._executeHandlers[g.charCodeAt(0)]&&delete this._executeHandlers[g.charCodeAt(0)]}setExecuteHandlerFallback(g){this._executeHandlerFb=g}registerCsiHandler(g,p){const f=this._identifier(g);this._csiHandlers[f]===void 0&&(this._csiHandlers[f]=[]);const E=this._csiHandlers[f];return E.push(p),{dispose:()=>{const j=E.indexOf(p);j!==-1&&E.splice(j,1)}}}clearCsiHandler(g){this._csiHandlers[this._identifier(g)]&&delete this._csiHandlers[this._identifier(g)]}setCsiHandlerFallback(g){this._csiHandlerFb=g}registerDcsHandler(g,p){return this._dcsParser.registerHandler(this._identifier(g),p)}clearDcsHandler(g){this._dcsParser.clearHandler(this._identifier(g))}setDcsHandlerFallback(g){this._dcsParser.setHandlerFallback(g)}registerOscHandler(g,p){return this._oscParser.registerHandler(g,p)}clearOscHandler(g){this._oscParser.clearHandler(g)}setOscHandlerFallback(g){this._oscParser.setHandlerFallback(g)}setErrorHandler(g){this._errorHandler=g}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(g,p,f,E,j){this._parseStack.state=g,this._parseStack.handlers=p,this._parseStack.handlerPos=f,this._parseStack.transition=E,this._parseStack.chunkPos=j}parse(g,p,f){let E,j=0,x=0,R=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,R=this._parseStack.chunkPos+1;else{if(f===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const S=this._parseStack.handlers;let L=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(f===!1&&L>-1){for(;L>=0&&(E=S[L](this._params),E!==!0);L--)if(E instanceof Promise)return this._parseStack.handlerPos=L,E}this._parseStack.handlers=[];break;case 4:if(f===!1&&L>-1){for(;L>=0&&(E=S[L](),E!==!0);L--)if(E instanceof Promise)return this._parseStack.handlerPos=L,E}this._parseStack.handlers=[];break;case 6:if(j=g[this._parseStack.chunkPos],E=this._dcsParser.unhook(j!==24&&j!==26,f),E)return E;j===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(j=g[this._parseStack.chunkPos],E=this._oscParser.end(j!==24&&j!==26,f),E)return E;j===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,R=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let S=R;S<p;++S){switch(j=g[S],x=this._transitions.table[this.currentState<<8|(j<160?j:N)],x>>4){case 2:for(let B=S+1;;++B){if(B>=p||(j=g[B])<32||j>126&&j<N){this._printHandler(g,S,B),S=B-1;break}if(++B>=p||(j=g[B])<32||j>126&&j<N){this._printHandler(g,S,B),S=B-1;break}if(++B>=p||(j=g[B])<32||j>126&&j<N){this._printHandler(g,S,B),S=B-1;break}if(++B>=p||(j=g[B])<32||j>126&&j<N){this._printHandler(g,S,B),S=B-1;break}}break;case 3:this._executeHandlers[j]?this._executeHandlers[j]():this._executeHandlerFb(j),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:S,code:j,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const L=this._csiHandlers[this._collect<<8|j];let I=L?L.length-1:-1;for(;I>=0&&(E=L[I](this._params),E!==!0);I--)if(E instanceof Promise)return this._preserveStack(3,L,I,x,S),E;I<0&&this._csiHandlerFb(this._collect<<8|j,this._params),this.precedingJoinState=0;break;case 8:do switch(j){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(j-48)}while(++S<p&&(j=g[S])>47&&j<60);S--;break;case 9:this._collect<<=8,this._collect|=j;break;case 10:const P=this._escHandlers[this._collect<<8|j];let O=P?P.length-1:-1;for(;O>=0&&(E=P[O](),E!==!0);O--)if(E instanceof Promise)return this._preserveStack(4,P,O,x,S),E;O<0&&this._escHandlerFb(this._collect<<8|j),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|j,this._params);break;case 13:for(let B=S+1;;++B)if(B>=p||(j=g[B])===24||j===26||j===27||j>127&&j<N){this._dcsParser.put(g,S,B),S=B-1;break}break;case 14:if(E=this._dcsParser.unhook(j!==24&&j!==26),E)return this._preserveStack(6,[],0,x,S),E;j===27&&(x|=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 B=S+1;;B++)if(B>=p||(j=g[B])<32||j>127&&j<N){this._oscParser.put(g,S,B),S=B-1;break}break;case 6:if(E=this._oscParser.end(j!==24&&j!==26),E)return this._preserveStack(5,[],0,x,S),E;j===27&&(x|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&x}}}i.EscapeSequenceParser=w},6242:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.OscHandler=i.OscParser=void 0;const m=c(5770),v=c(482),h=[];i.OscParser=class{constructor(){this._state=0,this._active=h,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(b,T){this._handlers[b]===void 0&&(this._handlers[b]=[]);const N=this._handlers[b];return N.push(T),{dispose:()=>{const w=N.indexOf(T);w!==-1&&N.splice(w,1)}}}clearHandler(b){this._handlers[b]&&delete this._handlers[b]}setHandlerFallback(b){this._handlerFb=b}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=h}reset(){if(this._state===2)for(let b=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;b>=0;--b)this._active[b].end(!1);this._stack.paused=!1,this._active=h,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||h,this._active.length)for(let b=this._active.length-1;b>=0;b--)this._active[b].start();else this._handlerFb(this._id,"START")}_put(b,T,N){if(this._active.length)for(let w=this._active.length-1;w>=0;w--)this._active[w].put(b,T,N);else this._handlerFb(this._id,"PUT",(0,v.utf32ToString)(b,T,N))}start(){this.reset(),this._state=1}put(b,T,N){if(this._state!==3){if(this._state===1)for(;T<N;){const w=b[T++];if(w===59){this._state=2,this._start();break}if(w<48||57<w)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+w-48}this._state===2&&N-T>0&&this._put(b,T,N)}}end(b,T=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let N=!1,w=this._active.length-1,d=!1;if(this._stack.paused&&(w=this._stack.loopPosition-1,N=T,d=this._stack.fallThrough,this._stack.paused=!1),!d&&N===!1){for(;w>=0&&(N=this._active[w].end(b),N!==!0);w--)if(N instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=w,this._stack.fallThrough=!1,N;w--}for(;w>=0;w--)if(N=this._active[w].end(!1),N instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=w,this._stack.fallThrough=!0,N}else this._handlerFb(this._id,"END",b);this._active=h,this._id=-1,this._state=0}}},i.OscHandler=class{constructor(b){this._handler=b,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(b,T,N){this._hitLimit||(this._data+=(0,v.utf32ToString)(b,T,N),this._data.length>m.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(b){let T=!1;if(this._hitLimit)T=!1;else if(b&&(T=this._handler(this._data),T instanceof Promise))return T.then((N=>(this._data="",this._hitLimit=!1,N)));return this._data="",this._hitLimit=!1,T}}},8742:(y,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Params=void 0;const c=2147483647;class m{static fromArray(h){const b=new m;if(!h.length)return b;for(let T=Array.isArray(h[0])?1:0;T<h.length;++T){const N=h[T];if(Array.isArray(N))for(let w=0;w<N.length;++w)b.addSubParam(N[w]);else b.addParam(N)}return b}constructor(h=32,b=32){if(this.maxLength=h,this.maxSubParamsLength=b,b>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(h),this.length=0,this._subParams=new Int32Array(b),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(h),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const h=new m(this.maxLength,this.maxSubParamsLength);return h.params.set(this.params),h.length=this.length,h._subParams.set(this._subParams),h._subParamsLength=this._subParamsLength,h._subParamsIdx.set(this._subParamsIdx),h._rejectDigits=this._rejectDigits,h._rejectSubDigits=this._rejectSubDigits,h._digitIsSub=this._digitIsSub,h}toArray(){const h=[];for(let b=0;b<this.length;++b){h.push(this.params[b]);const T=this._subParamsIdx[b]>>8,N=255&this._subParamsIdx[b];N-T>0&&h.push(Array.prototype.slice.call(this._subParams,T,N))}return h}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(h){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(h<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=h>c?c:h}}addSubParam(h){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(h<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=h>c?c:h,this._subParamsIdx[this.length-1]++}}hasSubParams(h){return(255&this._subParamsIdx[h])-(this._subParamsIdx[h]>>8)>0}getSubParams(h){const b=this._subParamsIdx[h]>>8,T=255&this._subParamsIdx[h];return T-b>0?this._subParams.subarray(b,T):null}getSubParamsAll(){const h={};for(let b=0;b<this.length;++b){const T=this._subParamsIdx[b]>>8,N=255&this._subParamsIdx[b];N-T>0&&(h[b]=this._subParams.slice(T,N))}return h}addDigit(h){let b;if(this._rejectDigits||!(b=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const T=this._digitIsSub?this._subParams:this.params,N=T[b-1];T[b-1]=~N?Math.min(10*N+h,c):h}}i.Params=m},5741:(y,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.AddonManager=void 0,i.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let c=this._addons.length-1;c>=0;c--)this._addons[c].instance.dispose()}loadAddon(c,m){const v={instance:m,dispose:m.dispose,isDisposed:!1};this._addons.push(v),m.dispose=()=>this._wrappedAddonDispose(v),m.activate(c)}_wrappedAddonDispose(c){if(c.isDisposed)return;let m=-1;for(let v=0;v<this._addons.length;v++)if(this._addons[v]===c){m=v;break}if(m===-1)throw new Error("Could not dispose an addon that has not been loaded");c.isDisposed=!0,c.dispose.apply(c.instance),this._addons.splice(m,1)}}},8771:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferApiView=void 0;const m=c(3785),v=c(511);i.BufferApiView=class{constructor(h,b){this._buffer=h,this.type=b}init(h){return this._buffer=h,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(h){const b=this._buffer.lines.get(h);if(b)return new m.BufferLineApiView(b)}getNullCell(){return new v.CellData}}},3785:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferLineApiView=void 0;const m=c(511);i.BufferLineApiView=class{constructor(v){this._line=v}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(v,h){if(!(v<0||v>=this._line.length))return h?(this._line.loadCell(v,h),h):this._line.loadCell(v,new m.CellData)}translateToString(v,h,b){return this._line.translateToString(v,h,b)}}},8285:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferNamespaceApi=void 0;const m=c(8771),v=c(8460),h=c(844);class b extends h.Disposable{constructor(N){super(),this._core=N,this._onBufferChange=this.register(new v.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new m.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new m.BufferApiView(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 new 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)}}i.BufferNamespaceApi=b},7975:(y,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ParserApi=void 0,i.ParserApi=class{constructor(c){this._core=c}registerCsiHandler(c,m){return this._core.registerCsiHandler(c,(v=>m(v.toArray())))}addCsiHandler(c,m){return this.registerCsiHandler(c,m)}registerDcsHandler(c,m){return this._core.registerDcsHandler(c,((v,h)=>m(v,h.toArray())))}addDcsHandler(c,m){return this.registerDcsHandler(c,m)}registerEscHandler(c,m){return this._core.registerEscHandler(c,m)}addEscHandler(c,m){return this.registerEscHandler(c,m)}registerOscHandler(c,m){return this._core.registerOscHandler(c,m)}addOscHandler(c,m){return this.registerOscHandler(c,m)}}},7090:(y,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.UnicodeApi=void 0,i.UnicodeApi=class{constructor(c){this._core=c}register(c){this._core.unicodeService.register(c)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(c){this._core.unicodeService.activeVersion=c}}},744:function(y,i,c){var m=this&&this.__decorate||function(d,g,p,f){var E,j=arguments.length,x=j<3?g:f===null?f=Object.getOwnPropertyDescriptor(g,p):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(d,g,p,f);else for(var R=d.length-1;R>=0;R--)(E=d[R])&&(x=(j<3?E(x):j>3?E(g,p,x):E(g,p))||x);return j>3&&x&&Object.defineProperty(g,p,x),x},v=this&&this.__param||function(d,g){return function(p,f){g(p,f,d)}};Object.defineProperty(i,"__esModule",{value:!0}),i.BufferService=i.MINIMUM_ROWS=i.MINIMUM_COLS=void 0;const h=c(8460),b=c(844),T=c(5295),N=c(2585);i.MINIMUM_COLS=2,i.MINIMUM_ROWS=1;let w=i.BufferService=class extends b.Disposable{get buffer(){return this.buffers.active}constructor(d){super(),this.isUserScrolling=!1,this._onResize=this.register(new h.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new h.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(d.rawOptions.cols||0,i.MINIMUM_COLS),this.rows=Math.max(d.rawOptions.rows||0,i.MINIMUM_ROWS),this.buffers=this.register(new T.BufferSet(d,this))}resize(d,g){this.cols=d,this.rows=g,this.buffers.resize(d,g),this._onResize.fire({cols:d,rows:g})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(d,g=!1){const p=this.buffer;let f;f=this._cachedBlankLine,f&&f.length===this.cols&&f.getFg(0)===d.fg&&f.getBg(0)===d.bg||(f=p.getBlankLine(d,g),this._cachedBlankLine=f),f.isWrapped=g;const E=p.ybase+p.scrollTop,j=p.ybase+p.scrollBottom;if(p.scrollTop===0){const x=p.lines.isFull;j===p.lines.length-1?x?p.lines.recycle().copyFrom(f):p.lines.push(f.clone()):p.lines.splice(j+1,0,f.clone()),x?this.isUserScrolling&&(p.ydisp=Math.max(p.ydisp-1,0)):(p.ybase++,this.isUserScrolling||p.ydisp++)}else{const x=j-E+1;p.lines.shiftElements(E+1,x-1,-1),p.lines.set(j,f.clone())}this.isUserScrolling||(p.ydisp=p.ybase),this._onScroll.fire(p.ydisp)}scrollLines(d,g,p){const f=this.buffer;if(d<0){if(f.ydisp===0)return;this.isUserScrolling=!0}else d+f.ydisp>=f.ybase&&(this.isUserScrolling=!1);const E=f.ydisp;f.ydisp=Math.max(Math.min(f.ydisp+d,f.ybase),0),E!==f.ydisp&&(g||this._onScroll.fire(f.ydisp))}};i.BufferService=w=m([v(0,N.IOptionsService)],w)},7994:(y,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CharsetService=void 0,i.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(c){this.glevel=c,this.charset=this._charsets[c]}setgCharset(c,m){this._charsets[c]=m,this.glevel===c&&(this.charset=m)}}},1753:function(y,i,c){var m=this&&this.__decorate||function(f,E,j,x){var R,S=arguments.length,L=S<3?E:x===null?x=Object.getOwnPropertyDescriptor(E,j):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(f,E,j,x);else for(var I=f.length-1;I>=0;I--)(R=f[I])&&(L=(S<3?R(L):S>3?R(E,j,L):R(E,j))||L);return S>3&&L&&Object.defineProperty(E,j,L),L},v=this&&this.__param||function(f,E){return function(j,x){E(j,x,f)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CoreMouseService=void 0;const h=c(2585),b=c(8460),T=c(844),N={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:f=>f.button!==4&&f.action===1&&(f.ctrl=!1,f.alt=!1,f.shift=!1,!0)},VT200:{events:19,restrict:f=>f.action!==32},DRAG:{events:23,restrict:f=>f.action!==32||f.button!==3},ANY:{events:31,restrict:f=>!0}};function w(f,E){let j=(f.ctrl?16:0)|(f.shift?4:0)|(f.alt?8:0);return f.button===4?(j|=64,j|=f.action):(j|=3&f.button,4&f.button&&(j|=64),8&f.button&&(j|=128),f.action===32?j|=32:f.action!==0||E||(j|=3)),j}const d=String.fromCharCode,g={DEFAULT:f=>{const E=[w(f,!1)+32,f.col+32,f.row+32];return E[0]>255||E[1]>255||E[2]>255?"":`\x1B[M${d(E[0])}${d(E[1])}${d(E[2])}`},SGR:f=>{const E=f.action===0&&f.button!==4?"m":"M";return`\x1B[<${w(f,!0)};${f.col};${f.row}${E}`},SGR_PIXELS:f=>{const E=f.action===0&&f.button!==4?"m":"M";return`\x1B[<${w(f,!0)};${f.x};${f.y}${E}`}};let p=i.CoreMouseService=class extends T.Disposable{constructor(f,E){super(),this._bufferService=f,this._coreService=E,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new b.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const j of Object.keys(N))this.addProtocol(j,N[j]);for(const j of Object.keys(g))this.addEncoding(j,g[j]);this.reset()}addProtocol(f,E){this._protocols[f]=E}addEncoding(f,E){this._encodings[f]=E}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(f){if(!this._protocols[f])throw new Error(`unknown protocol "${f}"`);this._activeProtocol=f,this._onProtocolChange.fire(this._protocols[f].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(f){if(!this._encodings[f])throw new Error(`unknown encoding "${f}"`);this._activeEncoding=f}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(f){if(f.col<0||f.col>=this._bufferService.cols||f.row<0||f.row>=this._bufferService.rows||f.button===4&&f.action===32||f.button===3&&f.action!==32||f.button!==4&&(f.action===2||f.action===3)||(f.col++,f.row++,f.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,f,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(f))return!1;const E=this._encodings[this._activeEncoding](f);return E&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(E):this._coreService.triggerDataEvent(E,!0)),this._lastEvent=f,!0}explainEvents(f){return{down:!!(1&f),up:!!(2&f),drag:!!(4&f),move:!!(8&f),wheel:!!(16&f)}}_equalEvents(f,E,j){if(j){if(f.x!==E.x||f.y!==E.y)return!1}else if(f.col!==E.col||f.row!==E.row)return!1;return f.button===E.button&&f.action===E.action&&f.ctrl===E.ctrl&&f.alt===E.alt&&f.shift===E.shift}};i.CoreMouseService=p=m([v(0,h.IBufferService),v(1,h.ICoreService)],p)},6975:function(y,i,c){var m=this&&this.__decorate||function(p,f,E,j){var x,R=arguments.length,S=R<3?f:j===null?j=Object.getOwnPropertyDescriptor(f,E):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(p,f,E,j);else for(var L=p.length-1;L>=0;L--)(x=p[L])&&(S=(R<3?x(S):R>3?x(f,E,S):x(f,E))||S);return R>3&&S&&Object.defineProperty(f,E,S),S},v=this&&this.__param||function(p,f){return function(E,j){f(E,j,p)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CoreService=void 0;const h=c(1439),b=c(8460),T=c(844),N=c(2585),w=Object.freeze({insertMode:!1}),d=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let g=i.CoreService=class extends T.Disposable{constructor(p,f,E){super(),this._bufferService=p,this._logService=f,this._optionsService=E,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new b.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new b.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new b.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new b.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,h.clone)(w),this.decPrivateModes=(0,h.clone)(d)}reset(){this.modes=(0,h.clone)(w),this.decPrivateModes=(0,h.clone)(d)}triggerDataEvent(p,f=!1){if(this._optionsService.rawOptions.disableStdin)return;const E=this._bufferService.buffer;f&&this._optionsService.rawOptions.scrollOnUserInput&&E.ybase!==E.ydisp&&this._onRequestScrollToBottom.fire(),f&&this._onUserInput.fire(),this._logService.debug(`sending data "${p}"`,(()=>p.split("").map((j=>j.charCodeAt(0))))),this._onData.fire(p)}triggerBinaryEvent(p){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${p}"`,(()=>p.split("").map((f=>f.charCodeAt(0))))),this._onBinary.fire(p))}};i.CoreService=g=m([v(0,N.IBufferService),v(1,N.ILogService),v(2,N.IOptionsService)],g)},9074:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.DecorationService=void 0;const m=c(8055),v=c(8460),h=c(844),b=c(6106);let T=0,N=0;class w extends h.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new b.SortedList((p=>p==null?void 0:p.marker.line)),this._onDecorationRegistered=this.register(new v.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new v.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,h.toDisposable)((()=>this.reset())))}registerDecoration(p){if(p.marker.isDisposed)return;const f=new d(p);if(f){const E=f.marker.onDispose((()=>f.dispose()));f.onDispose((()=>{f&&(this._decorations.delete(f)&&this._onDecorationRemoved.fire(f),E.dispose())})),this._decorations.insert(f),this._onDecorationRegistered.fire(f)}return f}reset(){for(const p of this._decorations.values())p.dispose();this._decorations.clear()}*getDecorationsAtCell(p,f,E){let j=0,x=0;for(const R of this._decorations.getKeyIterator(f))j=R.options.x??0,x=j+(R.options.width??1),p>=j&&p<x&&(!E||(R.options.layer??"bottom")===E)&&(yield R)}forEachDecorationAtCell(p,f,E,j){this._decorations.forEachByKey(f,(x=>{T=x.options.x??0,N=T+(x.options.width??1),p>=T&&p<N&&(!E||(x.options.layer??"bottom")===E)&&j(x)}))}}i.DecorationService=w;class d extends h.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=m.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=m.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(p){super(),this.options=p,this.onRenderEmitter=this.register(new v.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new v.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=p.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.InstantiationService=i.ServiceCollection=void 0;const m=c(2585),v=c(8343);class h{constructor(...T){this._entries=new Map;for(const[N,w]of T)this.set(N,w)}set(T,N){const w=this._entries.get(T);return this._entries.set(T,N),w}forEach(T){for(const[N,w]of this._entries.entries())T(N,w)}has(T){return this._entries.has(T)}get(T){return this._entries.get(T)}}i.ServiceCollection=h,i.InstantiationService=class{constructor(){this._services=new h,this._services.set(m.IInstantiationService,this)}setService(b,T){this._services.set(b,T)}getService(b){return this._services.get(b)}createInstance(b,...T){const N=(0,v.getServiceDependencies)(b).sort(((g,p)=>g.index-p.index)),w=[];for(const g of N){const p=this._services.get(g.id);if(!p)throw new Error(`[createInstance] ${b.name} depends on UNKNOWN service ${g.id}.`);w.push(p)}const d=N.length>0?N[0].index:T.length;if(T.length!==d)throw new Error(`[createInstance] First service dependency of ${b.name} at position ${d+1} conflicts with ${T.length} static arguments`);return new b(...T,...w)}}},7866:function(y,i,c){var m=this&&this.__decorate||function(d,g,p,f){var E,j=arguments.length,x=j<3?g:f===null?f=Object.getOwnPropertyDescriptor(g,p):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(d,g,p,f);else for(var R=d.length-1;R>=0;R--)(E=d[R])&&(x=(j<3?E(x):j>3?E(g,p,x):E(g,p))||x);return j>3&&x&&Object.defineProperty(g,p,x),x},v=this&&this.__param||function(d,g){return function(p,f){g(p,f,d)}};Object.defineProperty(i,"__esModule",{value:!0}),i.traceCall=i.setTraceLogger=i.LogService=void 0;const h=c(844),b=c(2585),T={trace:b.LogLevelEnum.TRACE,debug:b.LogLevelEnum.DEBUG,info:b.LogLevelEnum.INFO,warn:b.LogLevelEnum.WARN,error:b.LogLevelEnum.ERROR,off:b.LogLevelEnum.OFF};let N,w=i.LogService=class extends h.Disposable{get logLevel(){return this._logLevel}constructor(d){super(),this._optionsService=d,this._logLevel=b.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),N=this}_updateLogLevel(){this._logLevel=T[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(d){for(let g=0;g<d.length;g++)typeof d[g]=="function"&&(d[g]=d[g]())}_log(d,g,p){this._evalLazyOptionalParams(p),d.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+g,...p)}trace(d,...g){var p;this._logLevel<=b.LogLevelEnum.TRACE&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.trace.bind(this._optionsService.options.logger))??console.log,d,g)}debug(d,...g){var p;this._logLevel<=b.LogLevelEnum.DEBUG&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.debug.bind(this._optionsService.options.logger))??console.log,d,g)}info(d,...g){var p;this._logLevel<=b.LogLevelEnum.INFO&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.info.bind(this._optionsService.options.logger))??console.info,d,g)}warn(d,...g){var p;this._logLevel<=b.LogLevelEnum.WARN&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.warn.bind(this._optionsService.options.logger))??console.warn,d,g)}error(d,...g){var p;this._logLevel<=b.LogLevelEnum.ERROR&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.error.bind(this._optionsService.options.logger))??console.error,d,g)}};i.LogService=w=m([v(0,b.IOptionsService)],w),i.setTraceLogger=function(d){N=d},i.traceCall=function(d,g,p){if(typeof p.value!="function")throw new Error("not supported");const f=p.value;p.value=function(...E){if(N.logLevel!==b.LogLevelEnum.TRACE)return f.apply(this,E);N.trace(`GlyphRenderer#${f.name}(${E.map((x=>JSON.stringify(x))).join(", ")})`);const j=f.apply(this,E);return N.trace(`GlyphRenderer#${f.name} return`,j),j}}},7302:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.OptionsService=i.DEFAULT_OPTIONS=void 0;const m=c(8460),v=c(844),h=c(6114);i.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:h.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const b=["normal","bold","100","200","300","400","500","600","700","800","900"];class T extends v.Disposable{constructor(w){super(),this._onOptionChange=this.register(new m.EventEmitter),this.onOptionChange=this._onOptionChange.event;const d={...i.DEFAULT_OPTIONS};for(const g in w)if(g in d)try{const p=w[g];d[g]=this._sanitizeAndValidateOption(g,p)}catch(p){console.error(p)}this.rawOptions=d,this.options={...d},this._setupOptions(),this.register((0,v.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(w,d){return this.onOptionChange((g=>{g===w&&d(this.rawOptions[w])}))}onMultipleOptionChange(w,d){return this.onOptionChange((g=>{w.indexOf(g)!==-1&&d()}))}_setupOptions(){const w=g=>{if(!(g in i.DEFAULT_OPTIONS))throw new Error(`No option with key "${g}"`);return this.rawOptions[g]},d=(g,p)=>{if(!(g in i.DEFAULT_OPTIONS))throw new Error(`No option with key "${g}"`);p=this._sanitizeAndValidateOption(g,p),this.rawOptions[g]!==p&&(this.rawOptions[g]=p,this._onOptionChange.fire(g))};for(const g in this.rawOptions){const p={get:w.bind(this,g),set:d.bind(this,g)};Object.defineProperty(this.options,g,p)}}_sanitizeAndValidateOption(w,d){switch(w){case"cursorStyle":if(d||(d=i.DEFAULT_OPTIONS[w]),!(function(g){return g==="block"||g==="underline"||g==="bar"})(d))throw new Error(`"${d}" is not a valid value for ${w}`);break;case"wordSeparator":d||(d=i.DEFAULT_OPTIONS[w]);break;case"fontWeight":case"fontWeightBold":if(typeof d=="number"&&1<=d&&d<=1e3)break;d=b.includes(d)?d:i.DEFAULT_OPTIONS[w];break;case"cursorWidth":d=Math.floor(d);case"lineHeight":case"tabStopWidth":if(d<1)throw new Error(`${w} cannot be less than 1, value: ${d}`);break;case"minimumContrastRatio":d=Math.max(1,Math.min(21,Math.round(10*d)/10));break;case"scrollback":if((d=Math.min(d,4294967295))<0)throw new Error(`${w} cannot be less than 0, value: ${d}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(d<=0)throw new Error(`${w} cannot be less than or equal to 0, value: ${d}`);break;case"rows":case"cols":if(!d&&d!==0)throw new Error(`${w} must be numeric, value: ${d}`);break;case"windowsPty":d=d??{}}return d}}i.OptionsService=T},2660:function(y,i,c){var m=this&&this.__decorate||function(T,N,w,d){var g,p=arguments.length,f=p<3?N:d===null?d=Object.getOwnPropertyDescriptor(N,w):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(T,N,w,d);else for(var E=T.length-1;E>=0;E--)(g=T[E])&&(f=(p<3?g(f):p>3?g(N,w,f):g(N,w))||f);return p>3&&f&&Object.defineProperty(N,w,f),f},v=this&&this.__param||function(T,N){return function(w,d){N(w,d,T)}};Object.defineProperty(i,"__esModule",{value:!0}),i.OscLinkService=void 0;const h=c(2585);let b=i.OscLinkService=class{constructor(T){this._bufferService=T,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(T){const N=this._bufferService.buffer;if(T.id===void 0){const E=N.addMarker(N.ybase+N.y),j={data:T,id:this._nextId++,lines:[E]};return E.onDispose((()=>this._removeMarkerFromLink(j,E))),this._dataByLinkId.set(j.id,j),j.id}const w=T,d=this._getEntryIdKey(w),g=this._entriesWithId.get(d);if(g)return this.addLineToLink(g.id,N.ybase+N.y),g.id;const p=N.addMarker(N.ybase+N.y),f={id:this._nextId++,key:this._getEntryIdKey(w),data:w,lines:[p]};return p.onDispose((()=>this._removeMarkerFromLink(f,p))),this._entriesWithId.set(f.key,f),this._dataByLinkId.set(f.id,f),f.id}addLineToLink(T,N){const w=this._dataByLinkId.get(T);if(w&&w.lines.every((d=>d.line!==N))){const d=this._bufferService.buffer.addMarker(N);w.lines.push(d),d.onDispose((()=>this._removeMarkerFromLink(w,d)))}}getLinkData(T){var N;return(N=this._dataByLinkId.get(T))==null?void 0:N.data}_getEntryIdKey(T){return`${T.id};;${T.uri}`}_removeMarkerFromLink(T,N){const w=T.lines.indexOf(N);w!==-1&&(T.lines.splice(w,1),T.lines.length===0&&(T.data.id!==void 0&&this._entriesWithId.delete(T.key),this._dataByLinkId.delete(T.id)))}};i.OscLinkService=b=m([v(0,h.IBufferService)],b)},8343:(y,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.createDecorator=i.getServiceDependencies=i.serviceRegistry=void 0;const c="di$target",m="di$dependencies";i.serviceRegistry=new Map,i.getServiceDependencies=function(v){return v[m]||[]},i.createDecorator=function(v){if(i.serviceRegistry.has(v))return i.serviceRegistry.get(v);const h=function(b,T,N){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(w,d,g){d[c]===d?d[m].push({id:w,index:g}):(d[m]=[{id:w,index:g}],d[c]=d)})(h,b,N)};return h.toString=()=>v,i.serviceRegistry.set(v,h),h}},2585:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.IDecorationService=i.IUnicodeService=i.IOscLinkService=i.IOptionsService=i.ILogService=i.LogLevelEnum=i.IInstantiationService=i.ICharsetService=i.ICoreService=i.ICoreMouseService=i.IBufferService=void 0;const m=c(8343);var v;i.IBufferService=(0,m.createDecorator)("BufferService"),i.ICoreMouseService=(0,m.createDecorator)("CoreMouseService"),i.ICoreService=(0,m.createDecorator)("CoreService"),i.ICharsetService=(0,m.createDecorator)("CharsetService"),i.IInstantiationService=(0,m.createDecorator)("InstantiationService"),(function(h){h[h.TRACE=0]="TRACE",h[h.DEBUG=1]="DEBUG",h[h.INFO=2]="INFO",h[h.WARN=3]="WARN",h[h.ERROR=4]="ERROR",h[h.OFF=5]="OFF"})(v||(i.LogLevelEnum=v={})),i.ILogService=(0,m.createDecorator)("LogService"),i.IOptionsService=(0,m.createDecorator)("OptionsService"),i.IOscLinkService=(0,m.createDecorator)("OscLinkService"),i.IUnicodeService=(0,m.createDecorator)("UnicodeService"),i.IDecorationService=(0,m.createDecorator)("DecorationService")},1480:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.UnicodeService=void 0;const m=c(8460),v=c(225);class h{static extractShouldJoin(T){return(1&T)!=0}static extractWidth(T){return T>>1&3}static extractCharKind(T){return T>>3}static createPropertyValue(T,N,w=!1){return(16777215&T)<<3|(3&N)<<1|(w?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new m.EventEmitter,this.onChange=this._onChange.event;const T=new v.UnicodeV6;this.register(T),this._active=T.version,this._activeProvider=T}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(T){if(!this._providers[T])throw new Error(`unknown Unicode version "${T}"`);this._active=T,this._activeProvider=this._providers[T],this._onChange.fire(T)}register(T){this._providers[T.version]=T}wcwidth(T){return this._activeProvider.wcwidth(T)}getStringCellWidth(T){let N=0,w=0;const d=T.length;for(let g=0;g<d;++g){let p=T.charCodeAt(g);if(55296<=p&&p<=56319){if(++g>=d)return N+this.wcwidth(p);const j=T.charCodeAt(g);56320<=j&&j<=57343?p=1024*(p-55296)+j-56320+65536:N+=this.wcwidth(j)}const f=this.charProperties(p,w);let E=h.extractWidth(f);h.extractShouldJoin(f)&&(E-=h.extractWidth(w)),N+=E,w=f}return N}charProperties(T,N){return this._activeProvider.charProperties(T,N)}}i.UnicodeService=h}},l={};function u(y){var i=l[y];if(i!==void 0)return i.exports;var c=l[y]={exports:{}};return s[y].call(c.exports,c,c.exports,u),c.exports}var k={};return(()=>{var y=k;Object.defineProperty(y,"__esModule",{value:!0}),y.Terminal=void 0;const i=u(9042),c=u(3236),m=u(844),v=u(5741),h=u(8285),b=u(7975),T=u(7090),N=["cols","rows"];class w extends m.Disposable{constructor(g){super(),this._core=this.register(new c.Terminal(g)),this._addonManager=this.register(new v.AddonManager),this._publicOptions={...this._core.options};const p=E=>this._core.options[E],f=(E,j)=>{this._checkReadonlyOptions(E),this._core.options[E]=j};for(const E in this._core.options){const j={get:p.bind(this,E),set:f.bind(this,E)};Object.defineProperty(this._publicOptions,E,j)}}_checkReadonlyOptions(g){if(N.includes(g))throw new Error(`Option "${g}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new 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||(this._parser=new b.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new T.UnicodeApi(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._buffer=this.register(new h.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const g=this._core.coreService.decPrivateModes;let p="none";switch(this._core.coreMouseService.activeProtocol){case"X10":p="x10";break;case"VT200":p="vt200";break;case"DRAG":p="drag";break;case"ANY":p="any"}return{applicationCursorKeysMode:g.applicationCursorKeys,applicationKeypadMode:g.applicationKeypad,bracketedPasteMode:g.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:p,originMode:g.origin,reverseWraparoundMode:g.reverseWraparound,sendFocusMode:g.sendFocus,wraparoundMode:g.wraparound}}get options(){return this._publicOptions}set options(g){for(const p in g)this._publicOptions[p]=g[p]}blur(){this._core.blur()}focus(){this._core.focus()}input(g,p=!0){this._core.input(g,p)}resize(g,p){this._verifyIntegers(g,p),this._core.resize(g,p)}open(g){this._core.open(g)}attachCustomKeyEventHandler(g){this._core.attachCustomKeyEventHandler(g)}attachCustomWheelEventHandler(g){this._core.attachCustomWheelEventHandler(g)}registerLinkProvider(g){return this._core.registerLinkProvider(g)}registerCharacterJoiner(g){return this._checkProposedApi(),this._core.registerCharacterJoiner(g)}deregisterCharacterJoiner(g){this._checkProposedApi(),this._core.deregisterCharacterJoiner(g)}registerMarker(g=0){return this._verifyIntegers(g),this._core.registerMarker(g)}registerDecoration(g){return this._checkProposedApi(),this._verifyPositiveIntegers(g.x??0,g.width??0,g.height??0),this._core.registerDecoration(g)}hasSelection(){return this._core.hasSelection()}select(g,p,f){this._verifyIntegers(g,p,f),this._core.select(g,p,f)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(g,p){this._verifyIntegers(g,p),this._core.selectLines(g,p)}dispose(){super.dispose()}scrollLines(g){this._verifyIntegers(g),this._core.scrollLines(g)}scrollPages(g){this._verifyIntegers(g),this._core.scrollPages(g)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(g){this._verifyIntegers(g),this._core.scrollToLine(g)}clear(){this._core.clear()}write(g,p){this._core.write(g,p)}writeln(g,p){this._core.write(g),this._core.write(`\r
|
|
123
|
+
`,p)}paste(g){this._core.paste(g)}refresh(g,p){this._verifyIntegers(g,p),this._core.refresh(g,p)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(g){this._addonManager.loadAddon(this,g)}static get strings(){return i}_verifyIntegers(...g){for(const p of g)if(p===1/0||isNaN(p)||p%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...g){for(const p of g)if(p&&(p===1/0||isNaN(p)||p%1!=0||p<0))throw new Error("This API only accepts positive integers")}}y.Terminal=w})(),k})()))})(mu)),mu.exports}var JC=QC();function ZC(t){return t.toLowerCase().startsWith("win")}function e1(t){return t.keyCode===86&&t.ctrlKey&&!t.shiftKey&&!t.altKey&&!t.metaKey}const t1=8,n1=100,r1=80,Rp=6,Mp=.02,s1=.95,i1=50;function o1(t,e){return Math.hypot(t,e)>t1}function l1(t,e){const s=t[t.length-1];if(s===void 0||e-s.t>r1)return 0;const l=t.filter(y=>s.t-y.t<=n1),u=l[0];if(u===void 0||l.length<2||s.t===u.t)return 0;const k=(u.y-s.y)/(s.t-u.t);return Math.max(-Rp,Math.min(Rp,k))}function a1(t,e){if(Math.abs(t)<Mp)return{delta:0,velocity:0};const s=Math.max(0,Math.min(i1,e)),l=t*s1**(s/16);return{delta:t*s,velocity:Math.abs(l)<Mp?0:l}}function c1(t){const e=Math.trunc(t);return{pixels:e,rest:t-e}}const u1=60;function h1(){return new URLSearchParams(window.location.search).get("renderer")==="webgl"?"webgl":"canvas"}const Ap={dark:{background:"#12141a",foreground:"#d8dee9",cursor:"#d8dee9",selectionBackground:"#2f3542"},light:{background:"#fbfbfd",foreground:"#22262e",cursor:"#22262e",selectionBackground:"#cfd8e3"}},Ip={dark:1,light:4.5};function Kg({terminalId:t,connection:e,active:s,theme:l,autoFocus:u=!0,pasteOnCtrlV:k=!1}){const y=M.useRef(null),i=M.useRef(null),c=M.useRef(null),m=M.useRef(l);return m.current=l,M.useEffect(()=>{const v=y.current;if(v===null)return;const h=new JC.Terminal({convertEol:!1,cursorBlink:!0,fontFamily:'"Cascadia Mono", "Consolas", "Menlo", "DejaVu Sans Mono", monospace',fontSize:14,lineHeight:1.2,scrollback:1e4,allowProposedApi:!0,theme:Ap[m.current],minimumContrastRatio:Ip[m.current]});i.current=h;const b=new VC.FitAddon;c.current=b,h.loadAddon(b),h.loadAddon(new GC.WebLinksAddon),h.open(v);let T=!1;const N=()=>{if(!(T||h1()!=="webgl")){T=!0;try{const ee=new XC.WebglAddon;ee.onContextLoss(()=>ee.dispose()),h.loadAddon(ee)}catch{console.info("[terminal] WebGL no disponible; se usa el renderer por defecto.")}}};let w={cols:0,rows:0},d;const g=()=>v.clientWidth>0&&v.clientHeight>0,p=ee=>{const{cols:Z,rows:ve}=h;Z<=0||ve<=0||!ee&&Z===w.cols&&ve===w.rows||(w={cols:Z,rows:ve},e.send({type:"resize",terminalId:t,cols:Z,rows:ve}))};let f={atBottom:!0,line:0},E=!1;const j=()=>{if(E||!g())return;const ee=h.buffer.active;f={atBottom:ee.viewportY>=ee.baseY,line:ee.viewportY}},x=()=>{const ee=h.buffer.active;if(ee.baseY===0)return;const Z=f.atBottom?ee.baseY:Math.min(f.line,ee.baseY);h.scrollToLine(Z>0?Z-1:Z+1),h.scrollToLine(Z)},R=h.onRender(j),S=h.onScroll(j);let L=g();const I=()=>{if(g()){try{b.fit()}catch{return}E&&(x(),E=!1),h.cols>0&&h.rows>0&&N(),p(!1)}},P=()=>{window.clearTimeout(d),d=window.setTimeout(I,u1)},O=new ResizeObserver(()=>{const ee=g();E=!0,ee&&!L&&x(),L=ee,P()});O.observe(v),window.addEventListener("resize",P);let B=null,$=0,W=0;const K=(ee,Z,ve)=>{const Se=h.element;if(Se===void 0)return;const Ie=c1(W+ee);W=Ie.rest,Ie.pixels!==0&&Se.dispatchEvent(new WheelEvent("wheel",{deltaY:Ie.pixels,deltaMode:WheelEvent.DOM_DELTA_PIXEL,clientX:Z,clientY:ve,bubbles:!0,cancelable:!0}))},Y=()=>{window.cancelAnimationFrame($),$=0},V=(ee,Z,ve)=>{let Se=ee,Ie=performance.now();const je=Je=>{if(!g()){$=0;return}const tt=a1(Se,Je-Ie);Ie=Je,K(tt.delta,Z,ve),Se=tt.velocity,$=Se===0?0:window.requestAnimationFrame(je)};$=window.requestAnimationFrame(je)},F=(ee,Z)=>{for(let ve=0;ve<ee.length;ve++){const Se=ee.item(ve);if(Se!==null&&Se.identifier===Z)return Se}return null},H=ee=>{Y(),W=0;const Z=ee.touches.length===1?ee.touches.item(0):null;B=Z===null?null:{id:Z.identifier,startX:Z.clientX,startY:Z.clientY,lastX:Z.clientX,lastY:Z.clientY,moving:!1,samples:[{t:ee.timeStamp,y:Z.clientY}]}},U=ee=>{if(ee.stopPropagation(),B===null)return;const Z=F(ee.touches,B.id);if(Z===null)return;if(!B.moving){if(!o1(Z.clientX-B.startX,Z.clientY-B.startY))return;B.moving=!0}ee.cancelable&&ee.preventDefault();const ve=B.lastY-Z.clientY;B.lastX=Z.clientX,B.lastY=Z.clientY,B.samples.push({t:ee.timeStamp,y:Z.clientY}),B.samples.length>32&&B.samples.shift(),K(ve,Z.clientX,Z.clientY)},z=ee=>{if(B===null||F(ee.changedTouches,B.id)===null)return;const Z=B;if(B=null,!Z.moving)return;const ve=l1(Z.samples,ee.timeStamp);ve!==0&&V(ve,Z.lastX,Z.lastY)},te=()=>{B=null};v.addEventListener("touchstart",H,{capture:!0,passive:!0}),v.addEventListener("touchmove",U,{capture:!0,passive:!1}),v.addEventListener("touchend",z,{capture:!0,passive:!0}),v.addEventListener("touchcancel",te,{capture:!0,passive:!0});const ie=()=>{if(!(document.visibilityState!=="visible"||!g())){try{b.fit()}catch{return}p(!0)}};window.addEventListener("focus",ie),document.addEventListener("visibilitychange",ie),k&&h.attachCustomKeyEventHandler(ee=>!e1(ee));const we=h.onData(ee=>{e.send({type:"input",terminalId:t,data:ee})}),ge=e.onMessage(ee=>{switch(ee.type){case"terminal.output":ee.terminalId===t&&h.write(ee.data);break;case"terminal.replay":if(ee.terminalId!==t)break;h.reset(),ee.truncated&&h.write(`\x1B[90m-- ${_("terminal.replayTruncated")} --\x1B[0m\r
|
|
124
|
+
`),h.write(ee.data);break;case"terminal.exit":if(ee.terminalId!==t)break;h.write(`\r
|
|
125
|
+
\x1B[90m-- ${_("terminal.exited",{code:ee.exitCode})} --\x1B[0m\r
|
|
126
|
+
`);break}}),X=()=>{if(g())try{b.fit()}catch{}const ee=h.cols>0?h.cols:80,Z=h.rows>0?h.rows:24;w={cols:ee,rows:Z},e.send({type:"terminal.attach",terminalId:t,cols:ee,rows:Z})};X();const G=e.onReopen(X);return()=>{window.clearTimeout(d),window.removeEventListener("resize",P),window.removeEventListener("focus",ie),document.removeEventListener("visibilitychange",ie),O.disconnect(),Y(),v.removeEventListener("touchstart",H,{capture:!0}),v.removeEventListener("touchmove",U,{capture:!0}),v.removeEventListener("touchend",z,{capture:!0}),v.removeEventListener("touchcancel",te,{capture:!0}),R.dispose(),S.dispose(),we.dispose(),ge(),G(),e.send({type:"terminal.detach",terminalId:t}),h.dispose(),i.current=null,c.current=null}},[t,e,k]),M.useEffect(()=>{const v=i.current;v!==null&&(v.options.theme=Ap[l],v.options.minimumContrastRatio=Ip[l])},[l]),M.useEffect(()=>{if(!s)return;const v=i.current,h=c.current;if(v===null||h===null)return;const b=window.setTimeout(()=>{const T=y.current;if(!(T===null||T.clientWidth===0||T.clientHeight===0)){try{h.fit()}catch{return}u&&v.focus(),v.cols>0&&v.rows>0&&e.send({type:"resize",terminalId:t,cols:v.cols,rows:v.rows})}},0);return()=>window.clearTimeout(b)},[s,u,t,e]),o.jsx("div",{className:`terminal-surface${s?"":" terminal-surface-hidden"}`,ref:y})}function d1(){return o.jsxs("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",focusable:"false",children:[o.jsx("path",{d:"M1.5 8s2.4-4.5 6.5-4.5S14.5 8 14.5 8s-2.4 4.5-6.5 4.5S1.5 8 1.5 8z",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"}),o.jsx("circle",{cx:"8",cy:"8",r:"1.8",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),o.jsx("path",{d:"M2.5 13.5l11-11",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]})}function ca({title:t,onHide:e,confirmText:s}){const[l,u]=M.useState(!1);return o.jsxs("span",{className:"section-hide",children:[o.jsx("button",{className:"icon-button",onClick:k=>{k.stopPropagation(),s===null?e():u(!0)},title:t,"aria-label":t,children:o.jsx(d1,{})}),l&&s!==null&&o.jsxs("span",{className:"section-hide-confirm",role:"alert",children:[o.jsx("span",{children:s}),o.jsx("button",{className:"link-button",onClick:()=>{u(!1),e()},children:_("settings.panels.consoleConfirmYes")}),o.jsx("button",{className:"link-button",onClick:()=>u(!1),children:_("common.cancel")})]})]})}const f1=typeof navigator<"u"&&ZC(navigator.platform);function p1({connection:t,shells:e,activeShellId:s,cwd:l,shellName:u,theme:k,onSelect:y,onOpen:i,onCloseShell:c,onCollapse:m,onHide:v,hideCount:h=0}){const b=u??_("console.name"),T=e.find(N=>N.terminalId===s)??e[0]??null;return o.jsxs("section",{className:"console-pane",children:[o.jsxs("header",{className:"console-header",children:[o.jsxs("div",{className:"strip-tabs",children:[e.map((N,w)=>o.jsxs("div",{className:`strip-tab${N.terminalId===(T==null?void 0:T.terminalId)?" is-active":""}${N.alive?"":" is-dead"}`,children:[o.jsx("button",{className:"strip-tab-label",onClick:()=>y(N.terminalId),title:N.alive?_("console.tab.title",{shell:N.label.length>0?N.label:b,number:w+1,cwd:l}):_("console.tab.exited",{code:N.exitCode??"?"}),children:_("console.tab.label",{number:w+1})}),o.jsx("button",{className:"strip-tab-close",onClick:()=>c(N.terminalId),title:_("console.tab.close"),children:"×"})]},N.terminalId)),u!==null&&o.jsx("button",{className:"strip-tab-new",onClick:i,title:_("console.openAnother",{shell:b,cwd:l}),children:"+"})]}),o.jsx("span",{className:"strip-spacer"}),o.jsx("button",{className:"icon-button",onClick:m,title:_("console.collapse"),children:"▾"}),v!==void 0&&o.jsx(ca,{title:_("settings.hide.console"),onHide:v,confirmText:h===0?null:_("settings.panels.consoleConfirm",{count:h})})]}),o.jsx("div",{className:"console-body",children:e.length===0?o.jsx("div",{className:"console-empty",children:u===null?o.jsx("p",{className:"panel-note",children:_("console.noShell")}):o.jsx("button",{className:"link-button",onClick:i,children:_("console.openIn",{shell:b,cwd:l})})}):o.jsx("div",{className:"terminal-stack",children:e.map(N=>o.jsx(Kg,{terminalId:N.terminalId,connection:t,active:N.terminalId===(T==null?void 0:T.terminalId),theme:k,pasteOnCtrlV:f1},N.terminalId))})})]})}function m1(t){return t.cwd===null||!t.shellAvailable||t.shellCwds.includes(t.cwd)?null:t.cwd}const g1=.75,v1=.9,_1=.7;function tr(t){if(t<1e3)return String(t);if(t<1e6){const e=t/1e3;return`${e<100?Li(e,1):Math.round(e)}k`}return`${Li(t/1e6,2)}M`}function w1({usage:t,source:e,instructionsFile:s,fallbackWindow:l=null,compact:u=!1,statusLineState:k=null,onConfigure:y,compactAction:i=null}){const{lastRequestTokens:c,contextWindow:m}=t;if(y!==void 0&&k!==null&&Kb(e,{state:k}))return o.jsxs("div",{className:`meter meter-idle${u?" meter-compact":""}`,title:Gb(k),children:[o.jsx("span",{className:"meter-label",children:_("meter.label")}),o.jsx("span",{className:`meter-bar${u?" meter-bar-inline":""}`}),o.jsx("span",{className:"meter-value",children:_("meter.unmeasured")}),o.jsx("button",{className:"link-button",onClick:y,children:_("meter.configure")})]});if(e===null)return o.jsxs("div",{className:`meter meter-idle${u?" meter-compact":""}`,title:_("meter.noTokensTitle"),children:[o.jsx("span",{className:"meter-label",children:_("meter.label")}),o.jsx("span",{className:`meter-bar${u?" meter-bar-inline":""}`}),o.jsx("span",{className:"meter-value",children:_("meter.noTokens")})]});if(!Vb(e,t)){const N=Xb(s,e,t.compacted===!0),w=qb(e,t,l);return o.jsxs("div",{className:`meter meter-idle${u?" meter-compact":""}`,title:N,children:[o.jsx("span",{className:"meter-label",children:_("meter.label")}),o.jsx("span",{className:`meter-bar${u?" meter-bar-inline":""}`}),o.jsxs("span",{className:"meter-value",children:[_("meter.unmeasured"),w!==null&&o.jsxs("span",{className:"meter-dim",children:[" / ",tr(w)]})]})]})}const v=m!==null&&m>0?Math.min(c/m,1):null,h=v===null?"unknown":v>=v1?"danger":v>=g1?"warn":"ok",b=m===null?"":` / ${tr(m)}${t.contextWindowEstimated?"+":""}`,T=Yb(e,t);if(u){const N=[t.lastModel===null?null:t.lastModel,T,v===null?_("meter.unknownModelShort"):_("meter.windowPercent",{percent:Math.round(v*100)}),_("meter.output",{tokens:tr(t.lastOutputTokens)}),e==="status-line"?_("meter.responses",{count:t.assistantMessages}):_("meter.sessionTotals",{output:tr(t.totalOutputTokens),cache:tr(t.totalCacheReadTokens),count:t.assistantMessages})].filter(d=>d!==null).join(" · "),w=i!==null&&v!==null&&v>=_1;return o.jsxs("div",{className:"meter meter-compact",title:N,children:[o.jsx("span",{className:"meter-label",children:_("meter.label")}),v!==null&&o.jsx("span",{className:"meter-bar meter-bar-inline",children:o.jsx("span",{className:`meter-fill meter-fill-${h}`,style:{width:`${v*100}%`}})}),o.jsxs("span",{className:"meter-value",children:[tr(c),b.length>0&&o.jsx("span",{className:"meter-dim",children:b})]}),w&&i!==null&&o.jsx("button",{className:"icon-button meter-compact-button",onClick:i.onCompact,disabled:i.blockedReason!==null,title:i.blockedReason??_("meter.compactTitle",{command:i.command}),children:_("meter.compact")})]})}return o.jsxs("div",{className:"meter",children:[o.jsxs("div",{className:"meter-row",children:[o.jsx("span",{className:"meter-label",children:_("meter.label")}),o.jsxs("span",{className:"meter-value",children:[tr(c),m!==null&&o.jsxs("span",{className:"meter-dim",title:t.lastModel===null?void 0:T!==null?_("meter.modelWithOrigin",{model:t.lastModel,origin:T}):t.lastModel,children:[" ","/ ",tr(m),t.contextWindowEstimated&&"+"]})]})]}),v!==null?o.jsx("div",{className:"meter-bar",title:_("meter.windowPercent",{percent:Math.round(v*100)}),children:o.jsx("div",{className:`meter-fill meter-fill-${h}`,style:{width:`${v*100}%`}})}):o.jsx("div",{className:"meter-note",title:t.lastModel??void 0,children:_("meter.unknownModel")}),o.jsxs("div",{className:"meter-row meter-row-dim",children:[o.jsx("span",{title:_("meter.lastResponseTitle"),children:_("meter.output",{tokens:tr(t.lastOutputTokens)})}),o.jsx("span",{title:_("meter.sessionTitle"),children:_("meter.sessionTotals",{output:tr(t.totalOutputTokens),cache:tr(t.totalCacheReadTokens),count:t.assistantMessages})})]})]})}const y1=75,ua=90,b1=3e4;function k1(t){return t>=ua?"danger":t>=y1?"warn":"ok"}function gu(t,e){return t.minutes===e.minutes?t.id.localeCompare(e.id):t.minutes===null?1:e.minutes===null?-1:t.minutes-e.minutes}function C1(t,e){const s=ky(t,e).sort(gu);if(s.length===0)return null;const l=new Map;for(const m of s){const v=m.minutes===null?`id:${m.id}`:`m:${m.minutes}`,h=l.get(v);(h===void 0||m.usedPercent>h.usedPercent)&&l.set(v,m)}const u=[...l.values()].sort(gu),k=u[0];if(k===void 0)return null;const y=u.find(m=>m.usedPercent>=ua),i=k.usedPercent<ua&&y!==void 0?y:k;let c=u.slice(0,2);return c.includes(i)||(c=[k,i]),{shown:c.sort(gu),priorityId:i.id,all:s}}function Gg(t){const{minutes:e}=t;return e===null?_("plan.window.quota"):e===Bs.fiveHours?_("plan.window.fiveHours"):e===Bs.day?_("plan.window.day"):e===Bs.week?_("plan.window.week"):Math.abs(e-Bs.month)<=Bs.day?_("plan.window.month"):e%Bs.day===0?_("plan.window.days",{value:e/Bs.day}):_("plan.window.hours",{value:Math.max(1,Math.round(e/60))})}function Yg(t){const e=t>=100?Math.round(t):Math.min(99,Math.round(t));return Kk(e)}function S1(t,e){return t.resetsAt===null?null:Ig(t.resetsAt-e)}function x1(t,e){return t-e<1440*60*1e3?Ri(t):t-e<10080*60*1e3?Vk(t):`${wh(t)} ${Ri(t)}`}function E1(t,e){const s=t.all.map(u=>{const k=_("plan.used",{percent:Yg(u.usedPercent)}),y=u.resetsAt===null?_("plan.noReset"):_("plan.resetsIn",{time:Ig(u.resetsAt-e),at:x1(u.resetsAt,e)});return`${Gg(u)}: ${k} · ${y}`}),l=Math.max(...t.all.map(u=>u.observedAt));return s.push(_("plan.observed",{when:Wn(l,e)})),s.join(`
|
|
127
|
+
`)}const T1={missing:"plan.setup.missing","other-command":"plan.setup.otherCommand",disabled:"plan.setup.disabled",unreadable:"plan.setup.unreadable"};function L1(t){return t===null?"hidden":t==="active"?"waiting":"configure"}function N1(t){return _(t==="active"?"plan.noDataTitle":T1[t])}function R1({windows:t,setupState:e,onConfigure:s}){const[l,u]=M.useState(()=>Date.now());M.useEffect(()=>{u(Date.now());const y=window.setInterval(()=>u(Date.now()),b1);return()=>window.clearInterval(y)},[t]);const k=C1(t,l);if(k===null){const y=L1(e);return y==="hidden"||e===null||y==="configure"&&s===void 0?null:o.jsxs("div",{className:"meter meter-idle meter-compact plan-meter",title:N1(e),children:[o.jsx("span",{className:"meter-label",children:_("plan.label")}),y==="configure"?o.jsx("button",{className:"link-button",onClick:s,children:_("meter.configure")}):o.jsx("span",{className:"meter-value",children:_("plan.noData")})]})}return o.jsx("div",{className:"meter meter-compact plan-meter",title:E1(k,l),children:k.shown.map(y=>{const i=k1(y.usedPercent),c=S1(y,l),m=y.id===k.priorityId;return o.jsxs("span",{className:`plan-window ${m?"plan-window-priority":"plan-window-extra"}`,children:[o.jsx("span",{className:"meter-label plan-label",children:Gg(y)}),o.jsx("span",{className:"meter-bar meter-bar-inline plan-bar",children:o.jsx("span",{className:`meter-fill meter-fill-${i}`,style:{width:`${Math.min(y.usedPercent,100)}%`}})}),o.jsxs("span",{className:"meter-value",children:[o.jsx("span",{className:y.usedPercent>=ua?"plan-danger":void 0,children:Yg(y.usedPercent)}),c!==null&&o.jsxs("span",{className:"meter-dim",children:[" · ",c]})]})]},y.id)})})}const vu=["s","m","l"],Xg="m",M1="agent-workbench.thread-font",A1="agent-workbench.notes-font",I1="s",j1={s:"threadFont.size.s",m:"threadFont.size.m",l:"threadFont.size.l"};function jp(t){return _(j1[t])}function Qg(t){const e=vu.indexOf(t);return vu[(e+1)%vu.length]??Xg}function D1(t){return t==="s"||t==="m"||t==="l"?t:null}function ha(t){return _("threadFont.title",{current:jp(t),next:jp(Qg(t))})}const P1=300,O1=200,B1=2,F1=P1+O1,Jg=B1*F1,H1=200;function Zg(t){return Math.max(H1,t)}function U1(t){return t.hasMore&&!t.loading&&t.searching!==!0&&t.scrollTop<t.previousScrollTop&&t.scrollTop<=Zg(t.clientHeight)}function $1(t,e,s){return t<0&&e<=Zg(s)}function W1(t,e){return Math.max(0,e-t)}function z1(t,e){return t===null||e.length===0||e[0]===t?!1:e.includes(t)}const q1=52,V1=10;function K1(t){return t.filter(e=>e.role==="user"&&e.parts.some(s=>s.kind==="text"||s.kind==="image")).map(e=>e.eventId)}function G1(t,e){for(let s=t-1;s>=0;s-=1){const l=e(s);if(l!==null&&l<-8)return s}return null}function Y1(t){return t.awayFromEnd&&(t.ownAbove||t.hasMore)}function Dp(t,e){return Math.max(0,t+e-q1)}function X1(t){return t.found?"jump":t.loading?"wait":!t.hasMore||t.pagesRequested>=V1?"give-up":"load"}const Q1=1;function J1(t,e){for(const s of t){const l=e(s);if(!(l===null||l.bottom<=Q1))return{eventId:s,offset:l.top,lastId:t[t.length-1]??null}}return null}function Z1(t,e,s,l){const u=e.indexOf(t.eventId);if(u===-1)return null;for(let k=u;k<e.length;k+=1){const y=e[k],i=y===void 0?null:s(y);if(i!==null)return Math.max(0,l+i.top-(k===u?t.offset:0))}return null}function eS(t,e){if(e===null)return 0;const s=t.lastIndexOf(e);return s===-1?0:t.length-1-s}const ev=80;function tS(t){return t.distanceFromEnd<=ev?!0:t.wasAtEnd&&t.scrollTop>=t.previousScrollTop}const Pp=2,nS=4;function rS(t,e,s,l=nS){const u=e.right-e.left,k=e.bottom-e.top;if(u<=0||k<=0)return 0;const y=t.right-Pp,i=y-u,c=t.top+Pp,m=c+k;return y<=s.left-l||i>=s.right+l||m<=s.top-l||c>=s.bottom+l?0:Math.ceil(y-(s.left-l))}function tv({agents:t,preselected:e,anchor:s,label:l=_("agentMenu.openWith"),onPick:u,onClose:k}){const y=M.useMemo(()=>qu(t),[t]),[i,c]=M.useState(()=>tk(y,e)),[m,v]=M.useState(null),h=M.useRef(null),b=M.useRef([]);return M.useLayoutEffect(()=>{const T=h.current;if(T===null)return;const N=s.getBoundingClientRect(),w=T.getBoundingClientRect();v(rk({left:N.left,top:N.top,bottom:N.bottom},{width:w.width,height:w.height},{width:window.innerWidth,height:window.innerHeight}))},[s]),M.useEffect(()=>{var T;(T=b.current[i])==null||T.focus()},[i,m]),M.useEffect(()=>{const T=d=>{if(!(d.altKey||d.ctrlKey||d.metaKey)){if(d.key==="Escape"){d.preventDefault(),d.stopPropagation(),k(),s.focus();return}if(d.key==="ArrowDown"||d.key==="ArrowUp"){d.preventDefault(),d.stopPropagation(),c(g=>nk(g,d.key==="ArrowDown"?1:-1,y.length));return}if(d.key==="Enter"){d.preventDefault(),d.stopPropagation();const g=y[i];g!==void 0&&u(g.id);return}d.key==="Tab"&&k()}},N=d=>{var p;const g=d.target;g instanceof Node&&((p=h.current)!=null&&p.contains(g)||s.contains(g))||k()},w=d=>{sk(d.target,s,h.current)&&k()};return window.addEventListener("keydown",T,!0),document.addEventListener("pointerdown",N,!0),window.addEventListener("scroll",w,!0),window.addEventListener("resize",k),()=>{window.removeEventListener("keydown",T,!0),document.removeEventListener("pointerdown",N,!0),window.removeEventListener("scroll",w,!0),window.removeEventListener("resize",k)}},[i,s,y,k,u]),jg.createPortal(o.jsx("div",{ref:h,className:"agent-menu",role:"menu","aria-label":l,style:m===null?{left:0,top:0,visibility:"hidden"}:{left:`${m.left}px`,top:`${m.top}px`},children:y.map((T,N)=>o.jsxs("button",{ref:w=>{b.current[N]=w},className:`agent-menu-item${N===i?" agent-menu-item-active":""}`,role:"menuitem",tabIndex:N===i?0:-1,onMouseEnter:()=>c(N),onClick:()=>u(T.id),children:[o.jsx("span",{className:"agent-menu-label",children:T.label}),T.version!==null&&o.jsx("span",{className:"agent-menu-version",children:T.version})]},T.id))}),document.body)}function sS(){return o.jsx("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",focusable:"false",children:o.jsx("path",{d:"M2.5 5h11M10.5 2l3 3-3 3M13.5 11h-11M5.5 8l-3 3 3 3",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})})}function nv({targets:t,className:e,text:s,label:l,blockedReason:u=null,title:k=_h(),onPick:y}){const[i,c]=M.useState(!1),m=M.useRef(null),v=M.useCallback(()=>c(!1),[]),h=M.useCallback(b=>{c(!1),y(b)},[y]);return t.length===0?null:o.jsxs(o.Fragment,{children:[o.jsx("button",{ref:m,className:e,onClick:()=>c(b=>!b),disabled:u!==null,"aria-haspopup":"menu","aria-expanded":i,"aria-label":l,title:u??k,children:s}),i&&m.current!==null&&o.jsx(tv,{agents:t,preselected:null,anchor:m.current,label:_("continue.menuLabel"),onPick:h,onClose:v})]})}function rv(t){switch(t.notice){case"compacted":return t.detail==="auto"?_("thread.notice.compactedAuto"):_("thread.notice.compacted");case"interrupted":return _("thread.notice.interrupted");case"error":return t.detail.length>0?_("thread.notice.error",{detail:t.detail}):_("thread.notice.errorNoDetail")}}const sv="agent-workbench.locale",iv="auto";function iS(t){return t==="auto"||pg(t)?t:null}function ov(t){const e=t.trim().replace(/_/g,"-").toLowerCase();if(e.length===0)return null;const s=gh.find(k=>k.toLowerCase()===e);if(s!==void 0)return s;const[l="",...u]=e.split("-");return l==="zh"?u.includes("hant")||u.some(y=>y==="tw"||y==="hk"||y==="mo")?null:_u("zh-CN"):_u(l==="pt"?"pt-BR":l)}function _u(t){return pg(t)?t:null}function lv(t,e){if(t!=="auto")return t;for(const s of e){const l=ov(s);if(l!==null)return l}return"en"}function av(t,e){for(const s of e)if(ov(s)===t)try{if(Intl.DateTimeFormat.supportedLocalesOf([s]).length>0)return s}catch{}return fb(t)}let da=iv;const Yu=new Set;function yh(){return Array.isArray(navigator.languages)&&navigator.languages.length>0?navigator.languages:typeof navigator.language=="string"?[navigator.language]:[]}function oS(){return lv("auto",yh())}async function cv(t){const e=yh(),s=lv(t,e);await gg(s,av(s,e))}async function lS(){da=Nt(sv,iv,iS);try{await cv(da)}catch{await gg("en",av("en",yh()))}document.documentElement.lang=zu(),mg(()=>{document.documentElement.lang=zu()})}async function aS(t){await cv(t),da=t,kt(sv,t);for(const e of Yu)e()}function cS(t){return Yu.add(t),()=>Yu.delete(t)}function uS(){return da}function Ao(){return M.useSyncExternalStore(mg,zu)}function hS(){return M.useSyncExternalStore(cS,uS)}const uv=String.raw`https?:\/\/[^\s<>"'\`]+`,dS=new RegExp([String.raw`(\`[^\`\n]+\`)`,String.raw`(\*\*[^*\n]+\*\*)`,String.raw`(__[^_\n]+__)`,String.raw`(\*[^*\n]+\*)`,String.raw`(~~[^~\n]+~~)`,String.raw`(\[[^\]\n]+\]\([^)\s]+\))`,`(${uv})`].join("|")),fS=/^(https?:|mailto:)/i,pS=new RegExp(uv);function mS(t){const e=pS.exec(t);if(e===null||e.index===void 0)return null;const s=hv(e[0]);return{index:e.index,length:s.length,href:s}}function Ql(t,e){let s=0;for(const l of t)l===e&&(s+=1);return s}function hv(t){let e=t;for(;;){const s=e.slice(-1);if(s.length===0)return e;if(".,;:!?".includes(s)){e=e.slice(0,-1);continue}if(s===")"&&Ql(e,"(")<Ql(e,")")){e=e.slice(0,-1);continue}if(s==="]"&&Ql(e,"[")<Ql(e,"]")){e=e.slice(0,-1);continue}return e}}function gS(t){const e=dS.exec(t);if(e===null||e.index===void 0)return null;const s=e[0],l=e.index,u=(y,i=s.length)=>({index:l,length:i,token:y});if(s.startsWith("`"))return u({kind:"code",text:s.slice(1,-1)});if(s.startsWith("**")||s.startsWith("__"))return u({kind:"strong",text:s.slice(2,-2)});if(s.startsWith("~~"))return u({kind:"del",text:s.slice(2,-2)});if(s.startsWith("*"))return u({kind:"em",text:s.slice(1,-1)});if(s.startsWith("[")){const y=s.indexOf("]("),i=s.slice(1,y),c=s.slice(y+2,-1);return fS.test(c)?u({kind:"link",label:i,href:c}):u({kind:"plain",text:s})}const k=hv(s);return u({kind:"link",label:k,href:k},k.length)}function _o(t,e,s){if(e.length===0)return[t];const l=t.toLowerCase(),u=e.toLowerCase(),k=[];let y=0,i=l.indexOf(u),c=0;for(;i!==-1;)i>y&&k.push(t.slice(y,i)),k.push(o.jsx("mark",{children:t.slice(i,i+e.length)},`${s}-m${c++}`)),y=i+e.length,i=l.indexOf(u,y);return y<t.length&&k.push(t.slice(y)),k}const vS=/^\[([^\]\n]+)\]\(([^)\s]+)\)$/;function _S(t,e){const s=vS.exec(t);if(s===null)return null;const l=s[2]??"",u=e(l);return u===null?null:{label:s[1]??"",href:l,open:u}}function Mr(t,e,s,l){const u=[];let k=t,y=0;for(;k.length>0;){const i=gS(k);if(i===null){u.push(..._o(k,e,`${s}-${y++}`));break}i.index>0&&u.push(..._o(k.slice(0,i.index),e,`${s}-${y++}`));const c=`${s}-i${y++}`,{token:m}=i;switch(m.kind){case"code":{const v=l.code===void 0?null:l.code(m.text);u.push(v===null?o.jsx("code",{children:m.text},c):o.jsx("code",{className:"md-file-link",role:"link",tabIndex:0,title:v.folder?_("thread.openFolder",{path:m.text}):_("thread.openInFiles",{path:m.text}),onClick:v.open,onKeyDown:h=>{h.key!=="Enter"&&h.key!==" "||(h.preventDefault(),v.open())},children:m.text},c));break}case"strong":u.push(o.jsx("strong",{children:Mr(m.text,e,c,l)},c));break;case"del":u.push(o.jsx("del",{children:Mr(m.text,e,c,l)},c));break;case"em":u.push(o.jsx("em",{children:Mr(m.text,e,c,l)},c));break;case"link":u.push(o.jsx("a",{href:m.href,target:"_blank",rel:"noreferrer noopener",children:_o(m.label,e,c)},c));break;default:{const v=l.local===void 0?null:_S(m.text,l.local);if(v!==null){u.push(o.jsx("button",{className:"md-local-link",onClick:v.open,title:v.href,children:_o(v.label,e,c)},c));break}u.push(o.jsx("span",{children:_o(m.text,e,c)},c));break}}k=k.slice(i.index+i.length)}return u}function wS({code:t,language:e}){const[s,l]=M.useState(null),[u,k]=M.useState(!1),y=M.useRef(null);M.useEffect(()=>()=>{y.current!==null&&window.clearTimeout(y.current)},[]);const i=()=>{navigator.clipboard.writeText(t).then(()=>{k(!0),y.current!==null&&window.clearTimeout(y.current),y.current=window.setTimeout(()=>k(!1),1200)}).catch(()=>k(!1))};return M.useEffect(()=>{let c=!0;return dr(async()=>{const{highlightCode:m}=await import("./highlight-BUWAzUc6.js");return{highlightCode:m}},[]).then(({highlightCode:m})=>{c&&l(m(t,e))}).catch(()=>{c&&l(null)}),()=>{c=!1}},[t,e]),o.jsxs("div",{className:"md-code-wrap",children:[o.jsx("pre",{className:"md-code hljs",children:s===null?o.jsx("code",{children:t}):o.jsx("code",{dangerouslySetInnerHTML:{__html:s}})}),o.jsxs("div",{className:"md-code-tools","data-search-skip":"",children:[e!==null&&o.jsx("span",{className:"md-code-lang",children:e}),o.jsx("button",{className:"md-code-copy",onClick:i,title:_(u?"common.copied":"common.copyCode"),"aria-label":_("common.copyCode"),children:u?"✓":"⧉"})]})]})}const Op=/^(#{1,6})\s+(.*)$/,wu=/^\s{0,3}[-*+]\s+(.*)$/,wo=/^\s{0,3}(\d{1,3})[.)]\s+(.*)$/,Jl=/^>\s?(.*)$/,yu=/^\s*```(\S*)\s*$/,Bp=/^\s*(-{3,}|\*{3,}|_{3,})\s*$/,bu=/^\s*\|.*\|\s*$/,yS=/^\s*\|[\s:|-]+\|\s*$/;function Fp(t){return t.trim().replace(/^\||\|$/g,"").split("|").map(e=>e.trim())}function bh({text:t,needle:e="",localLink:s,codeLink:l}){var c,m;const u={local:s,code:l},k=t.split(`
|
|
128
|
+
`),y=[];let i=0;for(;i<k.length;){const v=k[i]??"",h=`b${i}`,b=yu.exec(v);if(b!==null){const w=(b[1]??"").length>0?b[1]:null,d=[];for(i+=1;i<k.length&&!yu.test(k[i]??"");)d.push(k[i]??""),i+=1;i+=1,y.push({key:h,node:o.jsx(wS,{code:d.join(`
|
|
129
|
+
`),language:w},h)});continue}if(v.trim().length===0){i+=1;continue}if(Bp.test(v)){y.push({key:h,node:o.jsx("hr",{className:"md-rule"},h)}),i+=1;continue}const T=Op.exec(v);if(T!==null){const w=Math.min((T[1]??"#").length,6);y.push({key:h,node:o.jsx("p",{className:`md-heading md-h${w}`,children:Mr(T[2]??"",e,h,u)},h)}),i+=1;continue}if(bu.test(v)&&yS.test(k[i+1]??"")){const w=Fp(v);i+=2;const d=[];for(;i<k.length&&bu.test(k[i]??"");)d.push(Fp(k[i]??"")),i+=1;y.push({key:h,node:o.jsx("div",{className:"md-table-wrap",children:o.jsxs("table",{className:"md-table",children:[o.jsx("thead",{children:o.jsx("tr",{children:w.map((g,p)=>o.jsx("th",{children:Mr(g,e,`${h}-h${p}`,u)},p))})}),o.jsx("tbody",{children:d.map((g,p)=>o.jsx("tr",{children:g.map((f,E)=>o.jsx("td",{children:Mr(f,e,`${h}-${p}-${E}`,u)},E))},p))})]})},h)});continue}if(Jl.test(v)){const w=[];for(;i<k.length&&Jl.test(k[i]??"");)w.push(((c=Jl.exec(k[i]??""))==null?void 0:c[1])??""),i+=1;y.push({key:h,node:o.jsx("blockquote",{className:"md-quote",children:Mr(w.join(`
|
|
130
|
+
`),e,h,u)},h)});continue}if(wu.test(v)||wo.test(v)){const w=wo.test(v),d=w?Number(((m=wo.exec(v))==null?void 0:m[1])??"1"):1,g=[];for(;i<k.length;){const f=k[i]??"",E=wu.exec(f),j=wo.exec(f);if(w&&j!==null)g.push(j[2]??"");else if(!w&&E!==null)g.push(E[1]??"");else if(g.length>0&&/^\s{2,}\S/.test(f)&&E===null&&j===null)g[g.length-1]=`${g[g.length-1]??""} ${f.trim()}`;else break;i+=1}const p=g.map((f,E)=>o.jsx("li",{children:Mr(f,e,`${h}-l${E}`,u)},E));y.push({key:h,node:w?o.jsx("ol",{className:"md-list",start:d===1?void 0:d,children:p},h):o.jsx("ul",{className:"md-list",children:p},h)});continue}const N=[];for(;i<k.length;){const w=k[i]??"";if(w.trim().length===0||yu.test(w)||Op.test(w)||wu.test(w)||wo.test(w)||Jl.test(w)||Bp.test(w)||bu.test(w))break;N.push(w),i+=1}y.push({key:h,node:o.jsx("p",{className:"md-paragraph",children:Mr(N.join(`
|
|
131
|
+
`),e,h,u)},h)})}return o.jsx("div",{className:"md",children:y.map(v=>v.node)})}const dv=[{key:"shell",names:["Bash","PowerShell","BashOutput","KillShell","shell_command","bash"],run:"tools.run.shell"},{key:"read",names:["Read","NotebookRead","read"],run:"tools.run.read"},{key:"find",names:["Glob","Grep","LS","grep","glob","list"],run:"tools.run.find"},{key:"edit",names:["Edit","Write","NotebookEdit","MultiEdit","apply_patch","edit","write"],run:"tools.run.edit"},{key:"web",names:["WebSearch","WebFetch","ToolSearch","webfetch","websearch","codesearch"],run:"tools.run.web"},{key:"agent",names:["Task","Agent","task"],run:"tools.run.agent"},{key:"todo",names:["TodoWrite","update_plan","todowrite","todoread"],run:"tools.run.todo"}];function ku(t){const e=dv.find(s=>s.names.includes(t));return e===void 0?{key:`name:${t}`,known:!1}:{key:e.key,known:!0}}function bS(t,e,s){const l=dv.find(u=>u.key===t);return l===void 0?_("tools.run.callsTo",{count:e,name:s}):_(l.run,{count:e})}function At(t){if(!mw(t.key))return t.key;let e;if(t.params!==void 0){const s={};for(const[l,u]of Object.entries(t.params))s[l]=typeof u=="object"?At(u):u;e=s}return _(`server.${t.key}`,e)}function kS(t,e,s){var k;const l=[...e].filter(([,y])=>y.terminalId===s),u=[];for(let y=t.length-1;y>=0&&l.length>0;y-=1)for(const i of((k=t[y])==null?void 0:k.parts)??[]){if(i.kind!=="question"||i.questions.length!==1)continue;const c=i.questions[0];if(c===void 0)continue;const m=l.findIndex(([,T])=>N0(T.item,c)),[v]=m===-1?[]:l.splice(m,1);if(v===void 0)continue;const[h,b]=v;u.push({liveId:h,toolUseId:i.toolUseId,selections:b.selections,failure:b.failure})}return u}const Cu={model:null,effort:null,contextWindow:null},CS=200,SS=2e4,xS={},ES={},Hp=[],Up=[],TS=15e3,LS=2e4;function Xu(t,e,s){return`${t}:${s}:${e}`}function NS(t,e){const[s,l]=M.useState([]),[u,k]=M.useState(iu),[y,i]=M.useState(Cu),[c,m]=M.useState("waiting"),[v,h]=M.useState(!1),[b,T]=M.useState(!1),[N,w]=M.useState({}),[d,g]=M.useState(null),[p,f]=M.useState(null),[E,j]=M.useState(!1),[x,R]=M.useState(Hp),[S,L]=M.useState(Up),[I,P]=M.useState(null),O=M.useRef(new Map),B=M.useRef(new Map),[$,W]=M.useState(!1),K=M.useRef(null),Y=M.useRef(null),[V,F]=M.useState(!1),H=M.useRef(null),U=M.useRef(null),z=M.useCallback(()=>{K.current=null,Y.current!==null&&window.clearTimeout(Y.current),Y.current=null,W(!1)},[]),te=M.useCallback(()=>{H.current=null,U.current!==null&&window.clearTimeout(U.current),U.current=null,F(!1)},[]),[ie,we]=M.useState({}),[ge,X]=M.useState({}),G=(e===null?void 0:ie[e])??xS,ee=(e===null?void 0:ge[e])??ES,Z=M.useRef(new Set),ve=M.useRef(new Map),Se=M.useRef(new Set),Ie=M.useCallback((_e,Te,ue)=>{X(Fe=>({...Fe,[_e]:{...Fe[_e]??{},[Te]:ue}}))},[]),je=M.useCallback(_e=>{X(Te=>{let ue=!1;const Fe={};for(const[$e,Ye]of Object.entries(Te))if(_e in Ye){const De={...Ye};delete De[_e],Fe[$e]=De,ue=!0}else Fe[$e]=Ye;return ue?Fe:Te})},[]),Je=M.useCallback((_e,Te)=>{X(ue=>{const Fe=ue[_e];if(Fe===void 0||!(Te in Fe))return ue;const $e={...Fe};return delete $e[Te],{...ue,[_e]:$e}})},[]),tt=M.useCallback((_e,Te,ue)=>{const Fe=ve.current.get(Te);Fe!==void 0&&window.clearTimeout(Fe);const $e=window.setTimeout(()=>{ve.current.delete(Te),!Se.current.has(Te)&&(ue&&O.current.get(_e)!==Te||(we(Ye=>{const De=Ye[_e];if(De===void 0||!(Te in De))return Ye;const He={...De};return delete He[Te],{...Ye,[_e]:He}}),Ie(_e,Te,_("conversation.answerUnconfirmed"))))},SS);ve.current.set(Te,$e)},[Ie]);M.useEffect(()=>{for(const _e of s)for(const Te of _e.parts){if(Te.kind!=="tool-result")continue;Se.current.add(Te.toolUseId);const ue=ve.current.get(Te.toolUseId);ue!==void 0&&(window.clearTimeout(ue),ve.current.delete(Te.toolUseId)),je(Te.toolUseId)}},[s,je]),M.useEffect(()=>{if(!(e===null||B.current.size===0))for(const{liveId:_e,toolUseId:Te,selections:ue,failure:Fe}of kS(s,B.current,e))B.current.delete(_e),ue!==null&&(we($e=>{const Ye=$e[e]??{};return Te in Ye?$e:{...$e,[e]:{...Ye,[Te]:ue}}}),Se.current.has(Te)||tt(e,Te,!1)),Fe!==null&&Ie(e,Te,Fe)},[s,e,tt,Ie]),M.useEffect(()=>{const _e=ve.current;return()=>{for(const Te of _e.values())window.clearTimeout(Te);_e.clear()}},[]);const Ne=M.useRef(null);M.useEffect(()=>{if(e===null){l([]),k(iu),i(Cu),m("waiting"),h(!1),Ne.current=null;return}l([]),k(iu),i(Cu),m("waiting"),h(!1),T(!1),w({}),g(null),f(null),j(!1),R(Hp),L(Up),P(null),z(),te(),Z.current.clear(),Ne.current=null;const _e=t.onMessage(ue=>{var Fe;if(ue.type==="conversation.reset"||ue.type==="conversation.liveQuestion"){const $e=ue.type==="conversation.reset"?ue.liveQuestion:ue.question;$e===null?O.current.delete(ue.terminalId):O.current.set(ue.terminalId,$e.toolUseId)}switch(ue.type){case"conversation.reset":if(ue.terminalId!==e)break;P(ue.liveQuestion),l(ue.events),k(ue.usage),i(ue.defaults),g(ue.permissionMode),f(ue.waitingFor),j(ue.openToolCall),R(ue.subagents),L(ue.queue),m(ue.state),h(ue.hasMore),T(!1),Ne.current=((Fe=ue.events[0])==null?void 0:Fe.eventId)??null;break;case"conversation.append":{if(ue.terminalId!==e)break;l($e=>{var He;const Ye=new Set($e.map(qe=>qe.eventId)),De=ue.events.filter(qe=>!Ye.has(qe.eventId));return De.length===0?$e:(Ne.current===null&&(Ne.current=((He=De[0])==null?void 0:He.eventId)??null),[...$e,...De])}),k(ue.usage),ue.permissionMode!==null&&g(ue.permissionMode),ue.queue!==void 0&&L(ue.queue),m("live");break}case"conversation.page":{if(ue.terminalId!==e)break;l($e=>{var He;const Ye=new Set($e.map(qe=>qe.eventId)),De=ue.events.filter(qe=>!Ye.has(qe.eventId));return De.length===0?$e:(Ne.current=((He=De[0])==null?void 0:He.eventId)??Ne.current,[...De,...$e])}),h(ue.hasMore),T(!1);break}case"conversation.turns":{if(ue.terminalId!==e)break;const $e=new Map(ue.turns.map(Ye=>[Ye.eventId,Ye.durationMs]));l(Ye=>Ye.map(De=>{const He=$e.get(De.eventId);return He===void 0?De:{...De,durationMs:He}}));break}case"conversation.parts":{if(ue.terminalId!==e)break;const $e=new Map(ue.updates.map(Ye=>[Ye.eventId,Ye.parts]));l(Ye=>Ye.map(De=>{const He=$e.get(De.eventId);return He===void 0?De:{...De,parts:He}}));break}case"conversation.imageData":{if(ue.terminalId!==e)break;const $e=Xu(ue.eventId,ue.index,ue.source);w(Ye=>({...Ye,[$e]:ue.data===null?null:`data:${ue.mediaType};base64,${ue.data}`}));break}case"conversation.state":if(ue.terminalId!==e)break;m(ue.state);break;case"conversation.mode":if(ue.terminalId!==e)break;g(ue.mode);break;case"conversation.waiting":if(ue.terminalId!==e)break;f(ue.waitingFor);break;case"conversation.toolCall":if(ue.terminalId!==e)break;j(ue.open);break;case"conversation.subagents":if(ue.terminalId!==e)break;R(ue.subagents);break;case"conversation.queue":if(ue.terminalId!==e)break;L(ue.queue);break;case"conversation.liveQuestion":if(ue.terminalId!==e)break;P(ue.question);break;case"agent.forceSent":ue.requestId===K.current&&!ue.sent&&z();break;case"agent.queueEdited":ue.requestId===H.current&&te();break;case"error":{if(ue.requestId!==void 0&&ue.requestId===K.current){z();break}if(ue.requestId!==void 0&&ue.requestId===H.current){te();break}if(ue.code!=="answer-failed"||e===null)break;const $e=At(ue.text);for(const[Ye,De]of ve.current){window.clearTimeout(De),ve.current.delete(Ye),we(qe=>{const xt=qe[e];if(xt===void 0||!(Ye in xt))return qe;const It={...xt};return delete It[Ye],{...qe,[e]:It}}),Ie(e,Ye,$e);const He=B.current.get(Ye);He!==void 0&&B.current.set(Ye,{...He,selections:null,failure:$e})}break}}});t.send({type:"conversation.subscribe",terminalId:e});const Te=t.onReopen(()=>{t.send({type:"conversation.subscribe",terminalId:e})});return()=>{_e(),Te(),t.send({type:"conversation.unsubscribe",terminalId:e})}},[t,e,Ie,z,te]),M.useEffect(()=>{$&&S.every(_e=>_e.forced===!0)&&z()},[$,S,z]),M.useEffect(()=>()=>{Y.current!==null&&window.clearTimeout(Y.current),U.current!==null&&window.clearTimeout(U.current)},[]);const ce=M.useCallback(()=>{if(e===null||K.current!==null)return;const _e=crypto.randomUUID();K.current=_e,W(!0),Y.current!==null&&window.clearTimeout(Y.current),Y.current=window.setTimeout(z,TS),t.send({type:"agent.forceSend",terminalId:e,requestId:_e})},[t,e,z]),dt=M.useCallback(()=>{if(e===null||H.current!==null)return;const _e=crypto.randomUUID();H.current=_e,F(!0),U.current!==null&&window.clearTimeout(U.current),U.current=window.setTimeout(te,LS),t.send({type:"agent.editQueue",terminalId:e,requestId:_e})},[t,e,te]),se=M.useCallback(()=>{const _e=Ne.current;e===null||_e===null||b||(T(!0),t.send({type:"conversation.loadMore",terminalId:e,beforeEventId:_e,limit:CS}))},[t,e,b]),fe=M.useCallback((_e,Te,ue)=>{if(e===null)return;const Fe=Xu(_e,Te,ue);Z.current.has(Fe)||(Z.current.add(Fe),t.send({type:"conversation.image",terminalId:e,eventId:_e,index:Te,source:ue}))},[t,e]),Ce=M.useCallback((_e,Te)=>{if(e===null)return;we(Fe=>{const $e=Fe[e]??{};return _e in $e?Fe:{...Fe,[e]:{...$e,[_e]:Te}}}),Je(e,_e);const ue=(I==null?void 0:I.toolUseId)===_e?I.questions[0]:void 0;ue!==void 0&&B.current.set(_e,{terminalId:e,item:ue,selections:Te,failure:null}),t.send({type:"agent.answer",terminalId:e,toolUseId:_e,selections:Te}),tt(e,_e,ue!==void 0)},[t,e,Je,I,tt]),ye=M.useCallback(_e=>{e!==null&&t.send({type:"agent.mode",terminalId:e,mode:_e})},[t,e]);return{events:s,usage:u,defaults:y,state:c,permissionMode:d,waitingFor:p,openToolCall:E,subagents:x,queue:S,forceSend:ce,forcing:$,editQueue:dt,editingQueue:V,hasMore:v,loadingMore:b,loadMore:se,images:N,requestImage:fe,answer:Ce,answered:G,answerFailed:ee,setPermissionMode:ye,liveQuestion:I}}function RS(t){return t.role!=="user"||t.parts.some(e=>e.kind==="tool-result"||e.kind==="notice")?!1:t.parts.some(e=>e.kind==="text"||e.kind==="image")}const MS=new Set(["Write","Edit","MultiEdit","NotebookEdit"]);function AS(t){try{const s=JSON.parse(t),l=s.file_path??s.notebook_path;if(typeof l=="string"&&l.length>0)return l}catch{}const e=/"(?:file_path|notebook_path)"\s*:\s*"((?:[^"\\]|\\.)*)"/.exec(t);if(e===null||e[1]===void 0)return null;try{return JSON.parse(`"${e[1]}"`)}catch{return null}}function IS(t,e){const s=k=>k.replace(/\\/g,"/").replace(/\/+$/,""),l=s(t),u=s(e);return l.length>0&&u.toLowerCase().startsWith(`${l.toLowerCase()}/`)?e.slice(l.length+1):e}function jS(t,e,s){const l=t.findIndex(k=>k.eventId===e);if(l===-1)return[];const u=[];for(const k of t.slice(l))for(const y of k.parts){if(y.kind!=="tool-call"||!MS.has(y.name))continue;const i=AS(y.input);if(i===null)continue;const c=IS(s,i);u.includes(c)||u.push(c)}return u}function DS(t,e=6,s=400){if(t===void 0)return"";const l=t.parts.flatMap(y=>y.kind==="text"?[y.text]:[]).join(`
|
|
132
|
+
`).trim();let k=l.split(`
|
|
133
|
+
`).slice(0,e).join(`
|
|
134
|
+
`);return k.length>s&&(k=k.slice(0,s)),k.length<l.length?`${k.trimEnd()}…`:k}function Su(t){return t.scrollHeight-t.scrollTop-t.clientHeight>ev}const $p=5;function Zl(t){return!Array.isArray(t)}function Wp(t){const e=[];for(const s of t.parts){if(s.kind!=="tool-call")return null;e.push(s.name)}return e.length>0?e:null}function PS(t){const e=[];let s=0;for(;s<t.length;){const l=t[s];if(l===void 0)break;const u=Wp(l),k=u===null?null:ku(u[0]??"");if(!(u!==null&&k!==null&&u.every(v=>ku(v).key===k.key))||u===null||k===null){e.push({kind:"card",card:l}),s+=1;continue}const i=[l];let c=u.length,m=s+1;for(;m<t.length;){const v=t[m];if(v===void 0)break;const h=Wp(v);if(h===null||!h.every(b=>ku(b).key===k.key))break;i.push(v),c+=h.length,m+=1}if(c<2){e.push({kind:"card",card:l}),s+=1;continue}e.push({kind:"tools",id:`tools-${l.event.eventId}`,summary:bS(k.key,c,u[0]??""),at:l.event.at,cards:i}),s=m}return e}function OS(t){switch(t.kind){case"text":return t.text;case"tool-call":return`${t.name} ${t.input}`;case"tool-result":return t.text;case"question":return t.questions.map(e=>`${e.question} ${e.options.map(s=>s.label).join(" ")}`).join(`
|
|
135
|
+
`);case"notice":return rv(t);case"thinking":case"image":return""}}function zp(t,e){const s=[];for(const l of t.parts)if(s.push(OS(l)),l.kind==="tool-call"){const u=e.get(l.toolUseId);u!==void 0&&s.push(u.text)}return s.join(`
|
|
136
|
+
`)}function ds(t,e){if(e.length===0)return o.jsx(o.Fragment,{children:t});const s=t.toLowerCase(),l=e.toLowerCase(),u=[];let k=0,y=s.indexOf(l),i=0;for(;y!==-1;)y>k&&u.push(o.jsx("span",{children:t.slice(k,y)},i++)),u.push(o.jsx("mark",{children:t.slice(y,y+e.length)},i++)),k=y+e.length,y=s.indexOf(l,k);return k<t.length&&u.push(o.jsx("span",{children:t.slice(k)},i++)),o.jsx(o.Fragment,{children:u})}function fv(t,e){const s=[];let l=t,u=0;for(;l.length>0;){const k=mS(l);if(k===null){s.push(o.jsx("span",{children:ds(l,e)},u++));break}k.index>0&&s.push(o.jsx("span",{children:ds(l.slice(0,k.index),e)},u++)),s.push(o.jsx("a",{href:k.href,target:"_blank",rel:"noreferrer noopener",children:ds(k.href,e)},u++)),l=l.slice(k.index+k.length)}return o.jsx(o.Fragment,{children:s})}const pv=M.createContext(null);function BS({view:t,terminalId:e,onRewind:s,rewindBlocked:l=!1,questionsAnswerable:u,contextWindowSource:k,instructionsFile:y,onGoToCli:i,cliPresence:c,exitCode:m,onWakeCli:v,waking:h,discovering:b=!1,toolCallNotice:T=null,serverClosed:N=null,statusLineState:w=null,onConfigureStatusLine:d,threadFont:g,continueTargets:p=[],continueBlockedReason:f=null,onContinue:E,searchRequest:j=null,onSearchRequestApplied:x,activity:R=null,receipt:S=null,clock:L=null,takeNotice:I,fileLinks:P=null,forceSendAvailable:O=!1,queueEditAvailable:B=!1,planWindows:$=[],planSetupState:W=null,onConfigurePlanLimits:K,compactAction:Y=null}){const{events:V,usage:F,defaults:H,state:U,waitingFor:z,subagents:te,queue:ie,forceSend:we,forcing:ge,editQueue:X,editingQueue:G,hasMore:ee,loadingMore:Z,loadMore:ve,images:Se,requestImage:Ie,answer:je,answered:Je,answerFailed:tt,liveQuestion:Ne}=t,ce=Ao(),[dt,se]=M.useState(""),[fe,Ce]=M.useState(0),[ye,_e]=M.useState(null);M.useEffect(()=>{j!==null&&(se(j.query),x==null||x(j.seq))},[j,x]);const Te=M.useRef(null),ue=M.useRef(new Map),Fe=M.useRef(!0),[$e,Ye]=M.useState(!1),[De,He]=M.useState(0),qe=M.useRef(e),xt=M.useRef(new Map),It=M.useRef(null),jt=M.useRef(I);jt.current=I;const[gt,Kt]=M.useState(!1),Ft=M.useRef(null),[pe,Ze]=M.useState(!1),[Qe,ct]=M.useState(!1),he=M.useRef(null),Ve=M.useMemo(()=>new Set(ie.flatMap(me=>me.eventId===void 0?[]:[me.eventId])),[ie]),ut=M.useMemo(()=>Ve.size===0?V:V.filter(me=>!Ve.has(me.eventId)),[V,Ve]),be=M.useMemo(()=>K1(ut),[ut]),{cards:nt,results:St}=M.useMemo(()=>{const me=new Map,Pe=new Set;for(const wt of ut)for(const lt of wt.parts)lt.kind==="tool-result"?me.set(lt.toolUseId,lt):(lt.kind==="tool-call"||lt.kind==="question")&&Pe.add(lt.toolUseId);const et=[];for(const wt of ut){const lt=wt.parts.filter(Tn=>Tn.kind!=="thinking"&&!(Tn.kind==="tool-result"&&Pe.has(Tn.toolUseId)));lt.length!==0&&et.push({event:wt,parts:lt})}return{cards:et,results:me}},[ut]),pt=M.useRef([]);pt.current=M.useMemo(()=>nt.map(me=>me.event.eventId),[nt]);const Ke=M.useCallback(me=>{const Pe=me.getBoundingClientRect().top;return et=>{const wt=ue.current.get(et);if(wt===void 0)return null;const lt=wt.getBoundingClientRect();return lt.height<=0?null:{top:lt.top-Pe,bottom:lt.bottom-Pe}}},[]),mt=M.useMemo(()=>PS(nt),[nt,ce]),ot=dt.trim(),Pt=M.useMemo(()=>{if(ot.length===0)return[];const me=ot.toLowerCase();return nt.filter(Pe=>zp(Pe,St).toLowerCase().includes(me)).map(Pe=>Pe.event.eventId)},[nt,St,ot,ce]);M.useEffect(()=>{Ce(0)},[ot]);const zn=M.useMemo(()=>new Set(Pt),[Pt]),An=Pt[fe]??null;M.useEffect(()=>{var me;An!==null&&((me=ue.current.get(An))==null||me.scrollIntoView({block:"center"}))},[An]),M.useLayoutEffect(()=>{var et,wt;const me=qe.current;qe.current=e;const Pe=Te.current;if(me!==null&&me!==e){if(It.current===null){const lt=Pe===null||Fe.current?null:J1(pt.current,Ke(Pe));lt===null?xt.current.delete(me):xt.current.set(me,lt)}(et=jt.current)==null||et.call(jt,me)}e!==null&&me!==e&&((wt=jt.current)==null?void 0:wt.call(jt,e))===!0&&xt.current.delete(e),It.current=e===null?null:xt.current.get(e)??null,Fe.current=!0,Ye(!1),He(0),he.current=null,ct(!1),Ze(!1),Kt(!1)},[e,Ke]),M.useEffect(()=>()=>{Ft.current!==null&&window.clearTimeout(Ft.current)},[]);const _n=M.useCallback(()=>{const me=Te.current;if(me===null)return;const Pe=Su(me);Ye(Pe),Pe||He(0)},[]),En=M.useCallback(me=>{const Pe=me.getBoundingClientRect().top,et=lt=>{const Tn=be[lt],Ln=Tn===void 0?void 0:ue.current.get(Tn);return Ln===void 0?null:Ln.getBoundingClientRect().top-Pe},wt=G1(be.length,et);return wt===null?null:et(wt)},[be]),Ir=M.useCallback(()=>{const me=Te.current;me!==null&&Ze(Y1({awayFromEnd:Su(me),ownAbove:En(me)!==null,hasMore:ee}))},[En,ee]),$s=M.useRef(null),ps=M.useRef(0),Gt=M.useRef(0);M.useLayoutEffect(()=>{const me=$s.current,Pe=V.map(wt=>wt.eventId);$s.current=Pe[0]??null;const et=Te.current;et===null||!z1(me,Pe)||(et.scrollTop=W1(ps.current,et.scrollHeight))},[V]),M.useLayoutEffect(()=>{const me=Te.current,Pe=It.current;if(me!==null&&Pe!==null&&nt.length>0){It.current=null;const et=pt.current,wt=ot.length>0?null:Z1(Pe,et,Ke(me),me.scrollTop);wt!==null&&(me.scrollTop=wt,Fe.current=!Su(me),Fe.current||(He(eS(et,Pe.lastId)),Kt(!0),Ft.current!==null&&window.clearTimeout(Ft.current),Ft.current=window.setTimeout(()=>{Ft.current=null,Kt(!1)},Jg)))}me!==null&&Fe.current&&ot.length===0&&(me.scrollTop=me.scrollHeight),_n()},[nt,ie.length,Ne==null?void 0:Ne.toolUseId,ot,_n,Ke]);const gr=M.useCallback(()=>{const me=Te.current;me===null||!Fe.current||ot.length>0||(me.scrollTop=me.scrollHeight,_n())},[ot,_n]);M.useEffect(()=>{const me=Te.current;if(me===null)return;me.addEventListener("load",gr,!0);const Pe=typeof ResizeObserver>"u"?null:new ResizeObserver(gr);return Pe==null||Pe.observe(me),()=>{me.removeEventListener("load",gr,!0),Pe==null||Pe.disconnect()}},[gr]),M.useLayoutEffect(()=>{const me=he.current,Pe=Te.current;if(me===null||Pe===null)return;const et=En(Pe),wt=X1({found:et!==null,hasMore:ee,loading:Z,pagesRequested:me.pages});if(wt!=="wait"){if(wt==="load"){me.pages+=1,ve();return}he.current=null,ct(!1),et!==null&&(Fe.current=!1,Pe.scrollTop=Dp(Pe.scrollTop,et))}},[nt,ee,Z,Qe,En,ve]),M.useLayoutEffect(()=>{Ir()},[nt,Ir]);const ms=M.useRef(null),Ws=M.useRef(null),vr=M.useRef(new Map),jr=M.useCallback(()=>{const me=new Map;for(const Pe of[ms.current,Ws.current]){if(Pe===null)continue;const et=Pe.getBoundingClientRect();for(const wt of[et.top+1,(et.top+et.bottom)/2,et.bottom-1]){const lt=document.elementsFromPoint(et.left+1,wt).map(In=>In.closest(".turn")).find(In=>In!==null),Tn=(lt==null?void 0:lt.querySelector(":scope > .turn-actions"))??null;if(lt==null||Tn===null)continue;const Ln=rS(lt.getBoundingClientRect(),Tn.getBoundingClientRect(),et);Ln>0&&me.set(lt,Math.max(me.get(lt)??0,Ln))}}for(const Pe of vr.current.keys())me.has(Pe)||Pe.style.removeProperty("--turn-actions-shift");for(const[Pe,et]of me)vr.current.get(Pe)!==et&&Pe.style.setProperty("--turn-actions-shift",`${et}px`);vr.current=me},[]);M.useLayoutEffect(()=>{const me=Te.current;me!==null&&(ps.current=me.scrollHeight-me.scrollTop,Gt.current=me.scrollTop,jr())});const Dr=M.useRef(null),nr=M.useCallback(()=>{var Pe;const me=((Pe=V[0])==null?void 0:Pe.eventId)??null;me===null||Dr.current===me||(Dr.current=me,ve())},[V,ve]),Pr=M.useRef(null);M.useEffect(()=>{var wt;const me=((wt=nt[nt.length-1])==null?void 0:wt.event.eventId)??null,Pe=Pr.current;if(Pr.current=me,Pe===null||me===Pe||Fe.current&&ot.length===0)return;const et=nt.findIndex(lt=>lt.event.eventId===Pe);et!==-1&&He(lt=>lt+(nt.length-1-et))},[nt,ot]);const zs=M.useCallback(()=>{const me=Te.current;if(me===null)return;Fe.current=tS({wasAtEnd:Fe.current,distanceFromEnd:me.scrollHeight-me.scrollTop-me.clientHeight,scrollTop:me.scrollTop,previousScrollTop:Gt.current}),_n(),Ir(),jr();const Pe=U1({scrollTop:me.scrollTop,previousScrollTop:Gt.current,clientHeight:me.clientHeight,hasMore:ee,loading:Z,searching:ot.length>0});Gt.current=me.scrollTop,ps.current=me.scrollHeight-me.scrollTop,Pe&&nr()},[_n,Ir,jr,ee,Z,nr,ot]),Et=M.useCallback(me=>{const Pe=Te.current;Pe===null||!ee||Z||ot.length>0||$1(me.deltaY,Pe.scrollTop,Pe.clientHeight)&&nr()},[ee,Z,nr,ot]),Di=M.useCallback(()=>{const me=Te.current;me!==null&&(me.scrollTop=me.scrollHeight,Fe.current=!0,Ye(!1),He(0),he.current=null,ct(!1),Ze(!1))},[]),gs=M.useCallback(()=>{const me=Te.current;if(me===null)return;const Pe=En(me);if(Pe!==null){Fe.current=!1,me.scrollTop=Dp(me.scrollTop,Pe);return}he.current===null&&(he.current={pages:0},ct(!0))},[En]),Or=M.useCallback((me,Pe)=>{Pe===null?ue.current.delete(me):ue.current.set(me,Pe)},[]),rr=M.useCallback(me=>{const Pe=zp(me,St);navigator.clipboard.writeText(Pe).then(()=>{_e(me.event.eventId),window.setTimeout(()=>_e(null),1200)}).catch(()=>_e(null))},[St,ce]),vs=me=>{Pt.length!==0&&Ce(Pe=>(Pe+me+Pt.length)%Pt.length)};return o.jsx(pv.Provider,{value:P,children:o.jsxs("div",{className:"conversation-pane",children:[o.jsxs("div",{className:"conversation-search",children:[o.jsx("input",{className:"conversation-search-input",type:"search",placeholder:_("thread.search.placeholder"),value:dt,onChange:me=>se(me.target.value),onKeyDown:me=>{me.key==="Enter"&&vs(me.shiftKey?-1:1),me.stopPropagation()},spellCheck:!1}),ot.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"conversation-matches",children:Pt.length===0?_("thread.search.none"):`${fe+1}/${Pt.length}`}),o.jsx("button",{className:"icon-button",onClick:()=>vs(-1),disabled:Pt.length===0,title:_("thread.search.previous"),children:"↑"}),o.jsx("button",{className:"icon-button",onClick:()=>vs(1),disabled:Pt.length===0,title:_("thread.search.next"),children:"↓"})]}),o.jsx("span",{className:"conversation-spacer"}),E!==void 0&&o.jsx(nv,{targets:p,className:"icon-button conversation-continue",text:o.jsxs(o.Fragment,{children:[o.jsx(sS,{}),o.jsx("span",{children:_("thread.continueCli")})]}),label:_h(),blockedReason:f,onPick:E}),g!==void 0&&o.jsx("button",{className:"icon-button thread-font-button",onClick:g.cycle,title:ha(g.size),"aria-label":ha(g.size),children:o.jsxs("span",{"aria-hidden":"true",children:["a",o.jsx("span",{className:"thread-font-big",children:"A"})]})}),o.jsxs("div",{className:"thread-meters",children:[o.jsx(R1,{windows:$,setupState:W,onConfigure:K}),o.jsx(w1,{usage:F,source:k,instructionsFile:y,fallbackWindow:H.contextWindow,compact:!0,statusLineState:w,onConfigure:d,compactAction:Y})]})]}),o.jsxs("div",{className:"conversation-scroll-frame",children:[o.jsxs("div",{className:"conversation-scroll",ref:Te,onScroll:zs,onWheel:Et,children:[ee&&o.jsxs("button",{className:`conversation-more${Z?" conversation-more-loading":""}`,onClick:ve,disabled:Z,"aria-busy":Z,children:[Z&&o.jsx("span",{className:"conversation-more-spinner","aria-hidden":"true"}),_(Z?"thread.loadingMore":"thread.loadEarlier")]}),nt.length===0&&o.jsxs("p",{className:"conversation-empty",children:[U==="unavailable"?_("thread.empty.unavailable"):U==="no-transcript"?pk():_(U==="waiting"?"thread.empty.waiting":"thread.empty.noMessages"),U==="waiting"&&b&&o.jsxs(o.Fragment,{children:[o.jsx("br",{}),mk()]})]}),mt.map(me=>{if(me.kind==="card")return o.jsx(qp,{card:me.card,results:St,needle:ot,isMatch:me.card.event.eventId===An,copied:ye===me.card.event.eventId,images:Se,onRequestImage:Ie,onCopy:()=>rr(me.card),onRewind:s,rewindBlocked:l,register:Or,answered:Je,answerFailed:tt,answerable:u,onAnswer:je},me.card.event.eventId);const Pe=me.cards.some(et=>zn.has(et.event.eventId));return o.jsx(KS,{summary:me.summary,at:me.at,open:Pe,children:me.cards.map(et=>o.jsx(qp,{card:et,results:St,needle:ot,isMatch:et.event.eventId===An,copied:ye===et.event.eventId,images:Se,onRequestImage:Ie,onCopy:()=>rr(et),onRewind:s,rewindBlocked:l,register:Or,answered:Je,answerFailed:tt,answerable:u,onAnswer:je},et.event.eventId))},me.id)}),c==="live"&&Ne!==null&&o.jsx("article",{className:"turn turn-assistant turn-live-question",children:o.jsx(mv,{part:Ne,answeredAt:Je[Ne.toolUseId]??null,failure:tt[Ne.toolUseId]??null,answerable:u,onAnswer:je,needle:ot})}),c==="live"&&ie.length>0&&o.jsx(VS,{queue:ie,canForce:O&&ie.some(me=>me.forced!==!0),forceBlocked:z!==null,forcing:ge,onForce:we,canEdit:B&&ie.every(me=>me.forced!==!0),editing:G,onEdit:X})]}),$e&&(pe||Qe)&&o.jsx("button",{ref:ms,className:`conversation-jump conversation-jump-own${Qe?" is-seeking":""}`,onClick:gs,disabled:Qe,"aria-busy":Qe,title:_("thread.jumpToOwn"),"aria-label":_("thread.jumpToOwn"),children:o.jsx("span",{"aria-hidden":"true",children:"↑"})}),$e&&o.jsxs("button",{ref:Ws,className:`conversation-jump${De>0?" has-unseen":""}${gt?" is-hinting":""}`,onClick:Di,title:De>0?_("thread.jumpToEndNew",{count:De}):_("thread.jumpToEnd"),"aria-label":De>0?_("thread.jumpToEndNew",{count:De}):_("thread.jumpToEnd"),children:[o.jsx("span",{"aria-hidden":"true",children:"↓"}),De>0&&o.jsx("span",{className:"conversation-jump-count",children:De>99?"99+":De}),gt&&o.jsx("span",{className:"conversation-jump-tip","aria-hidden":"true",children:De>0?_("thread.jumpToEndNew",{count:De}):_("thread.jumpToEnd")})]})]}),o.jsx(HS,{live:c==="live"&&N===null,activity:R,waitingFor:z,receipt:S,events:V,clock:L,subagents:te}),N!==null&&(N.state==="relaunching"||c==="live")?o.jsx(WS,{text:N.text,relaunching:N.state==="relaunching",onRelaunch:v}):c==="live"?z===null&&T!==null?o.jsx(qS,{notice:T,onGoToCli:i}):o.jsx(zS,{waitingFor:z,questionsAnswerable:u,liveQuestion:Ne!==null,onGoToCli:i}):o.jsx($S,{presence:c,exitCode:m,waking:h,onWake:v})]})})}const FS=1e3;function HS({live:t,activity:e,waitingFor:s,receipt:l,events:u,clock:k,subagents:y}){const[,i]=M.useState(0),c=Date.now(),m=LC({live:t,activity:e,waitingFor:s,receipt:l,events:u,clock:k,now:c}),v=t?y:[],h=m!==null||v.length>0;return M.useEffect(()=>{if(!h)return;const b=window.setInterval(()=>i(T=>T+1),FS);return()=>window.clearInterval(b)},[h]),h?o.jsxs("div",{className:"thread-status",children:[m!==null&&o.jsxs("div",{className:`thread-status-row thread-status-${m.kind}`,children:[o.jsx(US,{kind:m.kind}),o.jsx("span",{className:"thread-status-text",children:NC(m,c)})]}),v.length>0&&o.jsxs("div",{className:"thread-status-row thread-status-subagents",children:[o.jsxs("span",{className:"tab-working thread-status-subagent-mark","aria-hidden":"true",children:[o.jsx("i",{}),o.jsx("i",{}),o.jsx("i",{})]}),o.jsx("span",{className:"thread-status-text",children:RC(v,c)})]})]}):null}function US({kind:t}){return t==="working"?o.jsxs("span",{className:"tab-working","aria-hidden":"true",children:[o.jsx("i",{}),o.jsx("i",{}),o.jsx("i",{})]}):t==="sending"?o.jsx("span",{className:"thread-status-sending-dot","aria-hidden":"true"}):o.jsx("span",{className:"thread-status-check","aria-hidden":"true",children:"✓"})}function $S({presence:t,exitCode:e,waking:s,onWake:l}){const u=t==="sleeping"?_("thread.wake.sleeping"):e===null?_("thread.wake.exited"):_("thread.wake.exitedWithCode",{code:e});return o.jsxs("div",{className:"conversation-waiting conversation-wake",role:"status",children:[o.jsx("span",{className:"conversation-wake-dot","aria-hidden":"true"}),o.jsx("span",{children:u}),o.jsx("button",{className:"primary-button primary-button-small",onClick:l,disabled:s,children:_(s?"thread.wake.opening":"thread.wake.open")})]})}function WS({text:t,relaunching:e,onRelaunch:s}){return o.jsxs("div",{className:"conversation-waiting conversation-wake",role:"status",children:[o.jsx("span",{className:"conversation-wake-dot","aria-hidden":"true"}),o.jsx("span",{children:t}),o.jsx("button",{className:"primary-button primary-button-small",onClick:s,disabled:e,children:e?yk():wk()})]})}function zS({waitingFor:t,questionsAnswerable:e,liveQuestion:s,onGoToCli:l}){if(t===null)return null;const u=s&&e?_("agent.waiting.question"):xg(t,e);return o.jsxs("div",{className:"conversation-waiting",role:"status",children:[o.jsx("span",{className:"conversation-waiting-dot","aria-hidden":"true"}),o.jsx("span",{children:u}),o.jsx("button",{className:"link-button",onClick:l,children:_("thread.goToCli")})]})}function qS({notice:t,onGoToCli:e}){return o.jsxs("div",{className:"conversation-waiting",role:"status",children:[o.jsx("span",{className:"conversation-waiting-dot","aria-hidden":"true"}),o.jsx("span",{children:t}),o.jsx("button",{className:"link-button",onClick:e,children:_("thread.goToCli")})]})}function qp({card:t,results:e,needle:s,isMatch:l,copied:u,images:k,onRequestImage:y,onCopy:i,onRewind:c,rewindBlocked:m=!1,register:v,answered:h,answerFailed:b,answerable:T,onAnswer:N}){const{event:w}=t,d=w.role==="user",g=p=>{const f=h[p.toolUseId];return f!==void 0?f:e.has(p.toolUseId)?[]:null};return o.jsxs("article",{ref:p=>v(w.eventId,p),className:`turn turn-${w.role}${l?" turn-match":""}`,children:[o.jsxs("div",{className:"turn-actions",children:[o.jsx("button",{className:"icon-button",onClick:i,title:_("thread.copyMessage"),children:u?"✓":"⧉"}),d&&c!==void 0&&RS(w)&&o.jsx("button",{className:"icon-button",onClick:()=>c(w.eventId),disabled:m,title:_(m?"thread.rewindBusy":"thread.rewind"),children:"↩"})]}),t.parts.map((p,f)=>o.jsx(YS,{part:p,eventId:w.eventId,mine:d,result:p.kind==="tool-call"?e.get(p.toolUseId)??null:null,needle:s,images:k,onRequestImage:y,answeredAt:p.kind==="question"?g(p):null,failure:p.kind==="question"?b[p.toolUseId]??null:null,answerable:T,onAnswer:N},f)),o.jsx(GS,{event:w,mine:d})]})}function VS({queue:t,canForce:e,forceBlocked:s,forcing:l,onForce:u,canEdit:k,editing:y,onEdit:i}){return o.jsxs("div",{className:"queued-prompts",children:[t.map(c=>o.jsxs("article",{className:`turn turn-user turn-pending${c.forced===!0?" turn-pending-forced":""}`,children:[c.text.length>0&&o.jsx(gv,{text:c.text,truncated:c.truncated,needle:""}),c.images>0&&o.jsx("div",{className:"turn-pending-images",children:_("thread.queue.images",{count:c.images})}),o.jsxs("div",{className:"turn-meta",children:[o.jsx("span",{className:"turn-who",children:_("thread.turn.you")}),c.at>0&&o.jsx("span",{children:Ri(c.at)}),o.jsx("span",{className:"turn-pending-state",title:c.forced===!0?_("thread.queue.forcedTitle"):_("thread.queue.labelTitle"),children:c.forced===!0?_("thread.queue.forced"):_("thread.queue.label")}),k&&o.jsx("button",{className:"queued-edit",onClick:i,disabled:y||l||s,"aria-busy":y,title:s?_("thread.queue.forceBlocked"):_("thread.queue.editTitle",{count:t.length}),children:_(y?"thread.queue.editing":"thread.queue.edit")})]})]},c.id)),e&&o.jsx("div",{className:"queued-prompts-actions",children:o.jsx("button",{className:"queued-force",onClick:u,disabled:l||s||y,"aria-busy":l,title:_(s?"thread.queue.forceBlocked":"thread.queue.forceSendTitle"),children:_(l?"thread.queue.forcing":"thread.queue.forceSend")})})]})}function KS({summary:t,at:e,open:s,children:l}){const u=e>0?Ri(e):"";return o.jsxs("details",{className:"tool-group",open:s,children:[o.jsxs("summary",{className:"tool-group-summary",children:[o.jsx("span",{className:"tool-group-chevron","aria-hidden":"true",children:"▸"}),o.jsx("span",{className:"tool-group-count",children:t}),u.length>0&&o.jsx("span",{className:"tool-group-time",children:u})]}),o.jsx("div",{className:"tool-group-body",children:l})]})}function GS({event:t,mine:e}){const s=t.at>0?Ri(t.at):"",l=[];return t.durationMs!==null&&l.push(qk(t.durationMs)),t.effort!==null&&l.push(_("thread.turn.effort",{effort:t.effort})),o.jsxs("div",{className:"turn-meta",children:[e&&o.jsx("span",{className:"turn-who",children:_("thread.turn.you")}),s.length>0&&o.jsx("span",{children:s}),t.queued&&o.jsx("span",{className:"turn-queued",title:_("thread.turn.queuedTitle"),children:_("thread.turn.queued")}),l.map(u=>o.jsx("span",{className:"turn-meta-bit",children:u},u))]})}function YS({part:t,eventId:e,mine:s,result:l,needle:u,images:k,onRequestImage:y,answeredAt:i,failure:c,answerable:m,onAnswer:v}){const h=M.useContext(pv);switch(t.kind){case"text":return s?o.jsx(gv,{text:t.text,truncated:t.truncated,needle:u}):o.jsxs("div",{className:"part-text",children:[o.jsx(bh,{text:t.text,needle:u,codeLink:h==null?void 0:h.code,localLink:h==null?void 0:h.link}),t.truncated&&o.jsxs("span",{className:"part-truncated",children:[" ",_("thread.truncated")]})]});case"image":return o.jsx(QS,{eventId:e,index:t.index,source:t.source,src:k[Xu(e,t.index,t.source)],onRequest:y});case"thinking":return null;case"notice":return o.jsx("div",{className:`turn-notice turn-notice-${t.notice}`,children:ds(rv(t),u)});case"question":return o.jsx(mv,{part:t,answeredAt:i,failure:c,answerable:m,onAnswer:v,needle:u});case"tool-call":{const b=u.length>0&&`${t.name} ${t.input} ${(l==null?void 0:l.text)??""}`.toLowerCase().includes(u.toLowerCase());return o.jsxs("details",{className:"tool",open:b,children:[o.jsxs("summary",{className:"tool-summary",children:[o.jsx("span",{className:"tool-name",children:t.name}),l!==null&&l.isError&&o.jsx("span",{className:"tool-error",children:_("thread.tool.error")}),l!==null&&l.imageCount>0&&o.jsx("span",{className:"tool-images",children:_("thread.tool.images",{count:l.imageCount})})]}),o.jsxs("div",{className:"tool-block",children:[o.jsx("span",{className:"tool-label",children:_("thread.tool.input")}),o.jsxs("pre",{className:"tool-pre",children:[ds(t.input,u),t.truncated&&o.jsxs("span",{className:"part-truncated",children:[" ",_("thread.truncated")]})]})]}),l!==null&&o.jsxs("div",{className:"tool-block",children:[o.jsx("span",{className:"tool-label",children:_("thread.tool.result")}),o.jsxs("pre",{className:`tool-pre${l.isError?" tool-pre-error":""}`,children:[l.text.length>0?ds(l.text,u):l.imageCount>0?_("thread.tool.imagesNotSent",{count:l.imageCount}):_("thread.tool.noOutput"),l.truncated&&o.jsxs("span",{className:"part-truncated",children:[" ",_("thread.truncated")]})]})]})]})}case"tool-result":return o.jsxs("div",{className:"tool-block",children:[o.jsx("span",{className:"tool-label",children:_("thread.tool.orphanResult")}),o.jsx("pre",{className:`tool-pre${t.isError?" tool-pre-error":""}`,children:ds(t.text,u)})]})}}function mv({part:t,answeredAt:e,failure:s,answerable:l,onAnswer:u,needle:k}){var j;const[y,i]=M.useState(()=>t.questions.map(()=>[])),[c,m]=M.useState(null),[v,h]=M.useState(""),b=e!==null,T=b||!l,N=e??y,w=t.questions.length===1&&((j=t.questions[0])==null?void 0:j.multiSelect)===!1,d=N.every(x=>Zl(x)?x.text.trim().length>0:x.length>0),g=x=>x===void 0||Zl(x)?[]:x,p=(x,R)=>{if(T)return;const S=t.questions[x];if(S!==void 0){if(w){u(t.toolUseId,[[R]]);return}m(L=>L===x?null:L),i(L=>L.map((I,P)=>{if(P!==x)return I;const O=g(I);return S.multiSelect?O.includes(R)?O.filter(B=>B!==R):[...O,R]:[R]}))}},f=x=>{const R=v.trim();if(R.length===0||T)return;const S={kind:"free",text:R};if(w){u(t.toolUseId,[S]);return}i(L=>L.map((I,P)=>P===x?S:I)),m(null),h("")},E=x=>{if(T)return;const R=N[x];h(R!==void 0&&Zl(R)?R.text:""),m(x)};return o.jsxs("div",{className:`question${b?" question-done":""}`,children:[t.questions.map((x,R)=>{const S=N[R],L=S!==void 0&&Zl(S)?S.text:null;return o.jsxs("div",{className:"question-item",children:[o.jsxs("div",{className:"question-head",children:[x.header.length>0&&o.jsx("span",{className:"question-header",children:x.header}),o.jsx("span",{className:"question-text",children:ds(x.question,k)}),x.multiSelect&&o.jsx("span",{className:"question-hint",children:_("thread.question.multi")})]}),o.jsxs("div",{className:"question-options",children:[x.options.map((I,P)=>{const O=g(S).includes(P);return o.jsxs("button",{type:"button",className:`question-option${O?" question-option-picked":""}`,disabled:T,onClick:()=>p(R,P),children:[o.jsx("span",{className:"question-option-label",children:I.label}),I.description.length>0&&o.jsx("span",{className:"question-option-desc",children:I.description})]},P)}),c===R&&!T?o.jsxs("div",{className:"question-write",children:[o.jsx("textarea",{className:"question-write-input",autoFocus:!0,rows:2,value:v,placeholder:_("thread.question.placeholder"),onChange:I=>h(I.target.value),onKeyDown:I=>{I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),f(R)),I.key==="Escape"&&m(null),I.stopPropagation()}}),o.jsxs("div",{className:"question-write-actions",children:[o.jsx("button",{type:"button",className:"question-send",disabled:v.trim().length===0,onClick:()=>f(R),children:_(w?"thread.question.send":"thread.question.useText")}),o.jsx("button",{type:"button",className:"question-write-cancel",onClick:()=>m(null),children:_("common.cancel")})]})]}):o.jsxs("button",{type:"button",className:`question-option question-option-write${L!==null?" question-option-picked":""}`,disabled:T,onClick:()=>E(R),children:[o.jsx("span",{className:"question-option-label",children:L!==null?L:_("thread.question.writeOther")}),L===null&&o.jsx("span",{className:"question-option-desc",children:_("thread.question.writeOtherHint")})]})]})]},R)}),o.jsxs("div",{className:"question-foot",children:[s!==null&&o.jsx("span",{className:"question-failed",children:s}),b?o.jsx("span",{className:"question-sent",children:_("thread.question.answered")}):l?o.jsxs(o.Fragment,{children:[!w&&o.jsx("button",{type:"button",className:"question-send",disabled:!d,onClick:()=>u(t.toolUseId,y),children:_("thread.question.sendAnswers")}),o.jsx("span",{className:"question-note",children:_(w?"thread.question.pickOne":"thread.question.pickEach")})]}):o.jsx("span",{className:"question-note",children:_("thread.question.answerInCli")})]})]})}function gv({text:t,truncated:e,needle:s}){const l=Ok(t,e),u=l.length===1?l[0]:void 0;if(u!==void 0&&u.kind==="text")return o.jsx(Vp,{text:t,truncated:e,needle:s});const k=l.length-1;return o.jsx("div",{className:"part-own",children:l.map((y,i)=>y.kind==="text"?o.jsx(Vp,{text:y.text,truncated:e&&i===k,needle:s},i):o.jsx(XS,{number:y.number,text:y.text,complete:y.complete,needle:s},i))})}function XS({number:t,text:e,complete:s,needle:l}){const[u,k]=M.useState(!1),y=l.length>0&&e.toLowerCase().includes(l.toLowerCase()),i=u||y;return o.jsxs("div",{className:`thread-pasted${i?" thread-pasted-open":""}`,children:[o.jsxs("button",{className:"thread-pasted-toggle",onClick:()=>k(c=>!c),"aria-expanded":i,children:[o.jsx("span",{className:"chip-icon",children:"¶"}),_("thread.pasted",{number:t,count:xo(e)}),!s&&o.jsxs("span",{className:"part-truncated",children:[" ",_("thread.truncated")]}),o.jsx("span",{className:"chip-chevron",children:i?"▾":"▸"})]}),i&&o.jsx("div",{className:"thread-pasted-text part-mine",children:fv(e,l)})]})}function Vp({text:t,truncated:e,needle:s}){const[l,u]=M.useState(!1),k=t.split(`
|
|
137
|
+
`),y=s.length>0&&t.toLowerCase().includes(s.toLowerCase()),i=k.length>=$p&&!y,c=i&&!l?k.slice(0,$p-1).join(`
|
|
138
|
+
`):t;return o.jsxs("div",{className:"part-text part-mine",children:[fv(c,s),e&&o.jsxs("span",{className:"part-truncated",children:[" ",_("thread.truncated")]}),i&&o.jsx("button",{className:"fold-toggle",onClick:()=>u(m=>!m),children:l?_("thread.fold.less"):_("thread.fold.more",{count:k.length})})]})}function QS({eventId:t,index:e,source:s,src:l,onRequest:u}){const[k,y]=M.useState(!1);return M.useEffect(()=>{l===void 0&&u(t,e,s)},[l,t,e,s,u]),l===void 0?o.jsx("div",{className:"conversation-image-placeholder",children:_("thread.image.loading")}):l===null?o.jsx("div",{className:"conversation-image-placeholder",children:_("thread.image.gone")}):o.jsxs(o.Fragment,{children:[o.jsx("img",{className:"conversation-image",src:l,alt:_("thread.image.alt"),onClick:()=>y(!0),title:_("thread.image.openTitle")}),k&&o.jsx(Dg,{src:l,caption:_("thread.image.alt"),onClose:()=>y(!1)})]})}function Kp({connection:t,title:e,confirmLabel:s,confirmTitle:l,onChoose:u,onClose:k}){const[y,i]=M.useState(null),[c,m]=M.useState(null),[v,h]=M.useState(!1),[b,T]=M.useState(""),N=M.useRef(null),w=M.useRef(null);M.useEffect(()=>{const f=t.onMessage(E=>{if(E.type==="picker.listing"){N.current=E.listing.pickerId,i(E.listing),m(null),h(!1),T("");return}E.type==="error"&&E.code==="picker-failed"&&m(At(E.text))});return t.send({type:"picker.open"}),()=>{f();const E=N.current;E!==null&&t.send({type:"picker.close",pickerId:E})}},[t]),M.useEffect(()=>{const f=E=>{E.key==="Escape"&&(E.preventDefault(),E.stopPropagation(),k())};return window.addEventListener("keydown",f,!0),()=>window.removeEventListener("keydown",f,!0)},[k]),M.useEffect(()=>{var f;v&&((f=w.current)==null||f.focus())},[v]);const d=M.useCallback(f=>{const E=N.current;E!==null&&t.send({type:"picker.enter",pickerId:E,name:f})},[t]),g=M.useCallback(f=>{const E=N.current;E!==null&&t.send({type:"picker.root",pickerId:E,rootIndex:f})},[t]),p=M.useCallback(()=>{const f=N.current,E=b.trim();f===null||E.length===0||t.send({type:"picker.create",pickerId:f,name:E})},[t,b]);return o.jsx("div",{className:"modal-backdrop",onClick:k,children:o.jsxs("div",{className:"modal picker-modal",role:"dialog","aria-label":e,onClick:f=>f.stopPropagation(),children:[o.jsxs("header",{className:"modal-header",children:[o.jsx("span",{className:"modal-title",children:e}),o.jsx("button",{className:"icon-button",onClick:k,title:_("common.close"),children:"×"})]}),y===null?o.jsx("p",{className:"panel-note",children:_("picker.loading")}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"picker-roots",children:y.roots.map((f,E)=>o.jsx("button",{className:"picker-root",onClick:()=>g(E),title:_("picker.goTo",{root:f}),children:f},f))}),o.jsx("p",{className:"picker-path",title:y.path,children:y.path}),o.jsxs("div",{className:"picker-list",children:[y.canGoUp&&o.jsxs("button",{className:"picker-entry picker-up",onClick:()=>d(".."),children:["‹ ",_("picker.up")]}),y.entries.length===0&&!y.canGoUp&&o.jsx("p",{className:"panel-note",children:_("picker.empty")}),y.entries.map(f=>o.jsx("button",{className:"picker-entry",onClick:()=>d(f),children:f},f)),y.truncated&&o.jsx("p",{className:"panel-note",children:_("picker.truncated")})]}),c!==null&&o.jsx("p",{className:"picker-problem",children:c}),o.jsxs("footer",{className:"picker-footer",children:[v?o.jsxs("div",{className:"picker-create",children:[o.jsx("input",{ref:w,className:"picker-create-input",value:b,placeholder:_("picker.newFolderName"),onChange:f=>T(f.target.value),onKeyDown:f=>{f.key==="Enter"&&p(),f.key==="Escape"&&(f.stopPropagation(),h(!1)),f.stopPropagation()},spellCheck:!1}),o.jsx("button",{className:"primary-button primary-button-small",onClick:p,children:_("picker.create")}),o.jsx("button",{className:"link-button",onClick:()=>h(!1),children:_("common.cancel")})]}):o.jsx("button",{className:"primary-button primary-button-small",onClick:()=>h(!0),children:_("picker.createHere")}),o.jsx("span",{className:"composer-spacer"}),o.jsx("button",{className:"picker-open",onClick:()=>u(y.pickerId,y.path),title:l(y.path),children:s})]})]})]})})}function JS(t,e){return uh(t)&&e!==null&&e.sessions>0}function ZS(){return _("search.mode.titles")}function ex(){return _("search.mode.conversations")}function tx(){return _("search.mode.conversationsTitle")}function nx(t){return _(t==="conversations"?"search.placeholder.conversations":"search.placeholder.titles")}function rx(){return _("search.tooShort",{min:ig})}function sx(t){return[...t.trim()].length<ig}function ix(){return _("search.off")}function ox(t){const e=new Map;for(const s of t){const l=`${s.agent}:${s.sessionId}`;let u=e.get(l);u===void 0&&(u={key:l,agent:s.agent,sessionId:s.sessionId,title:s.title,titleHit:null,hits:[],lastAt:null},e.set(l,u)),s.eventId===null?u.titleHit=s:u.hits.push(s),s.at!==null&&(u.lastAt=Math.max(u.lastAt??0,s.at))}return[...e.values()]}const lx=40;function vv(t,e=lx){const s=t.matchStart+t.matchLength;let l=t.snippet.slice(0,t.matchStart);if(l.length>e){let u=l.length-e;const k=l.charCodeAt(u);k>=56320&&k<=57343&&(u+=1),l=`…${l.slice(u)}`}return{before:l,match:t.snippet.slice(t.matchStart,s),after:t.snippet.slice(s)}}function ax(t){return t.role==="user"?_("search.role.user"):t.role==="assistant"?_("search.role.assistant"):_("search.role.title")}function _v(t){return vv(t).match.trim()}function cx(t){const e=t.hits[0]??t.titleHit;return e===null?"":_v(e)}const Qu=t=>_("search.sessions",{count:t});function ux(t,e){return{query:e.query,hits:t===null?[...e.hits]:[...t.hits,...e.hits],sessionsScanned:e.sessionsScanned,sessionsTotal:e.sessionsTotal,truncated:null}}function hx(t){const{result:e}=t;if(t.searching&&t.error===null){if(e===null)return _("search.status.searching");const l={count:e.sessionsTotal,scanned:e.sessionsScanned};return e.hits.length===0?_("search.status.progress",l):_("search.status.progressFound",{...l,found:Gp(e)})}if(t.error!==null)return t.error;if(e===null)return null;const s=e.hits.length===0?_("search.status.none"):Gp(e);if(e.truncated===null&&e.hits.length===0&&e.sessionsScanned>0)return _("search.status.noneIn",{sessions:Qu(e.sessionsScanned)});if(e.truncated==="results")return _("search.status.truncatedResults",{found:s});if(e.truncated==="time"){const l=Math.max(0,e.sessionsTotal-e.sessionsScanned);return _("search.status.truncatedTime",{found:s,seconds:Math.round(Cy/1e3),left:Qu(l)})}return _("search.status.done",{found:s})}function Gp(t){const e=new Set(t.hits.map(s=>`${s.agent}:${s.sessionId}`)).size;return _("search.found",{hits:_("search.hits",{count:t.hits.length}),sessions:Qu(e)})}function dx(t,e){const s=e.terminals.find(l=>l.kind==="agent"&&l.agent===t.agent&&l.sessionId===t.sessionId);if(s!==void 0)return{kind:"activate",terminalId:s.terminalId};for(const l of e.projects){const u=l.sessions.find(k=>k.agent===t.agent&&k.sessionId===t.sessionId);if(u!==void 0)return ra(u)&&l.cwdExists&&e.canResume(u.agent)?{kind:"resume",cwd:ug(u.cwd,l.cwd,e.platform),session:u}:{kind:"copy"}}return{kind:"copy"}}const fx=/<(code|kbd|b|strong|em)>([\s\S]*?)<\/\1>|<br\s*\/?>/g;function rn(t,e,s){const l=vg(t,e),u=[];let k=0;for(const y of l.matchAll(fx)){const i=y.index??0;i>k&&u.push(na(l.slice(k,i),e));const c=y[1];if(c===void 0)u.push(M.createElement("br",{key:u.length}));else{const m=na(y[2]??"",e);u.push(M.createElement(c,{key:u.length},m))}k=i+y[0].length}return k<l.length&&u.push(na(l.slice(k),e)),u.length===1?u[0]:u}const Yp="0.8.1",Xp="agent-workbench.support-notice",px=3e4;function mx(t){return/^[0-9A-Za-z][0-9A-Za-z.+-]{0,39}$/.test(t)?t:null}function gx(t,e){return t!==e}function vx(){return[{keys:"Alt + T",description:_("shortcuts.app.newTab")},{keys:"Alt + W",description:_("shortcuts.app.closeTab")},{keys:"Alt + ← / →",description:_("shortcuts.app.switchTab")},{keys:"Alt + P",description:_("shortcuts.app.togglePanel")},{keys:"Shift + Tab",description:_("shortcuts.app.previousTab")}]}function _x({agent:t,onClose:e}){return M.useEffect(()=>{const s=l=>{l.key==="Escape"&&(l.preventDefault(),l.stopPropagation(),e())};return window.addEventListener("keydown",s,!0),()=>window.removeEventListener("keydown",s,!0)},[e]),o.jsx("div",{className:"modal-backdrop",onClick:e,children:o.jsxs("div",{className:"modal",role:"dialog","aria-label":_("shortcuts.ariaLabel"),onClick:s=>s.stopPropagation(),children:[o.jsxs("header",{className:"modal-header",children:[o.jsx("span",{className:"modal-title",children:_("shortcuts.title")}),o.jsx("button",{className:"icon-button",onClick:e,title:_("common.close"),children:"×"})]}),o.jsxs("div",{className:"modal-body",children:[o.jsx("h3",{className:"modal-section",children:_("shortcuts.section.app")}),o.jsx(xu,{shortcuts:vx()}),o.jsx("h3",{className:"modal-section",children:_("shortcuts.section.composer")}),o.jsx(xu,{shortcuts:Wb(t!==null&&t.capabilities.imagesByPath!==null)}),t!==null&&o.jsxs(o.Fragment,{children:[o.jsx("h3",{className:"modal-section",children:_("shortcuts.section.cli")}),o.jsx("p",{className:"modal-hint",children:rn("shortcuts.cliHint")}),o.jsx(xu,{shortcuts:fs[t.id].shortcuts}),fs[t.id].shortcutsNote!==null&&o.jsx("p",{className:"modal-hint",children:fs[t.id].shortcutsNote})]}),o.jsx("p",{className:"modal-hint",children:rn("shortcuts.browserReserved")}),o.jsx("p",{className:"modal-hint",children:rn("shortcuts.altNumber")}),o.jsxs("p",{className:"modal-hint support-hint",children:[o.jsx("span",{"aria-hidden":"true",children:"☕"})," ",_("support.notice")," ",o.jsx("a",{href:hg,target:"_blank",rel:"noreferrer noopener",children:_("support.link")})]})]})]})})}function xu({shortcuts:t}){return o.jsx("dl",{className:"shortcut-list",children:t.map(e=>o.jsxs("div",{className:"shortcut-row",children:[o.jsx("dt",{children:o.jsx("kbd",{children:e.keys})}),o.jsx("dd",{children:e.description})]},e.keys))})}const wx=1e3,yx=5e3;function Qp({info:t,agentLabel:e,purpose:s="status",onRefresh:l,onClose:u}){const[k,y]=M.useState(!1),[i,c]=M.useState(!1),m=M.useRef(null),v=M.useRef(null);M.useEffect(()=>{const d=g=>{g.key==="Escape"&&(g.preventDefault(),g.stopPropagation(),u())};return window.addEventListener("keydown",d,!0),()=>window.removeEventListener("keydown",d,!0)},[u]),M.useEffect(()=>{c(!1)},[t]),M.useEffect(()=>()=>{m.current!==null&&window.clearTimeout(m.current),v.current!==null&&window.clearTimeout(v.current)},[]);const h=d=>{navigator.clipboard.writeText(d).then(()=>{y(!0),m.current!==null&&window.clearTimeout(m.current),m.current=window.setTimeout(()=>y(!1),wx)}).catch(()=>y(!1))},b=()=>{c(!0),l(),v.current!==null&&window.clearTimeout(v.current),v.current=window.setTimeout(()=>c(!1),yx)},T=t.state==="active",N=_("statusLine.title",{agent:e}),w=s==="plan-limits";return o.jsx("div",{className:"modal-backdrop",onClick:u,children:o.jsxs("div",{className:"modal",role:"dialog","aria-label":N,onClick:d=>d.stopPropagation(),children:[o.jsxs("header",{className:"modal-header",children:[o.jsx("span",{className:"modal-title",children:N}),o.jsx("button",{className:"icon-button",onClick:u,title:_("common.close"),children:"×"})]}),o.jsxs("div",{className:"modal-body",children:[o.jsx("p",{className:`status-line-state${T?" status-line-state-active":""}`,children:Bb(t.state)}),o.jsx("p",{className:"modal-hint",children:_(w?"statusLine.planBenefit":"statusLine.benefit")}),w&&o.jsx("p",{className:"modal-hint",children:_("statusLine.planReplaces")}),o.jsx("h3",{className:"modal-section",children:_("statusLine.lineSection")}),t.fragment===null?o.jsx("p",{className:"modal-hint",children:w?_("statusLine.planNoFragment"):Fb()}):o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"modal-hint",children:rn("statusLine.mergeHint")}),o.jsxs("div",{className:"status-line-fragment",children:[o.jsx("pre",{className:"tool-pre",children:t.fragment}),o.jsx("button",{className:"link-button",onClick:()=>h(t.fragment??""),title:_("statusLine.copyTitle"),children:k?o.jsxs(o.Fragment,{children:["✓ ",_("statusLine.copied")]}):_("statusLine.copy")})]})]}),o.jsx("h3",{className:"modal-section",children:_("statusLine.whereSection")}),o.jsx("p",{className:"status-line-path",children:t.settingsPath}),o.jsx("p",{className:"modal-hint",children:_("statusLine.whereHint")}),o.jsx("h3",{className:"modal-section",children:_("statusLine.scriptSection")}),o.jsx("p",{className:"modal-hint",children:_(w?"statusLine.planScriptHint":"statusLine.scriptHint")}),o.jsx("p",{className:"status-line-path",children:t.scriptPath}),o.jsx("p",{className:"modal-hint",children:rn("statusLine.runsEverywhere")}),o.jsxs("div",{className:"status-line-actions",children:[o.jsx("button",{className:"primary-button",onClick:b,disabled:i,children:_(i?"statusLine.checking":"statusLine.check")}),o.jsx("span",{className:"modal-hint",children:_("statusLine.checkHint")})]})]})]})})}function bx(){const[t,e]=M.useState(()=>gx(Nt(Xp,null,mx),Yp));return M.useEffect(()=>{if(!t)return;kt(Xp,Yp);const s=window.setTimeout(()=>e(!1),px);return()=>window.clearTimeout(s)},[t]),t?o.jsxs("div",{className:"banner banner-support",role:"status",children:[o.jsx("span",{children:_("support.notice")}),o.jsx("a",{className:"banner-support-link",href:hg,target:"_blank",rel:"noreferrer noopener",onClick:()=>e(!1),children:_("support.link")}),o.jsx("button",{className:"link-button banner-support-dismiss",onClick:()=>e(!1),children:_("support.dismiss")})]}):null}function Ju({agent:t,agents:e}){return o.jsx("span",{className:"agent-badge",title:Mo(t,e),children:Sb(t)})}function Zu(){return o.jsxs("svg",{className:"archive-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("circle",{cx:"6",cy:"5",r:"2.2"}),o.jsx("circle",{cx:"6",cy:"19",r:"2.2"}),o.jsx("circle",{cx:"18",cy:"7",r:"2.2"}),o.jsx("path",{d:"M6 7.2v9.6"}),o.jsx("path",{d:"M18 9.2c0 4.3-5.5 4-10.4 7.8"})]})}const kx=500,Jp=10;function Cx(t){const e=M.useRef(null),s=M.useRef(null),l=M.useRef(!1),u=M.useRef(t);u.current=t;const k=M.useCallback(()=>{e.current!==null&&window.clearTimeout(e.current),e.current=null,s.current=null},[]),y=M.useCallback(v=>{v.pointerType==="mouse"||v.button!==0||(k(),l.current=!1,s.current={x:v.clientX,y:v.clientY},e.current=window.setTimeout(()=>{e.current=null,l.current=!0,u.current()},kx))},[k]),i=M.useCallback(v=>{const h=s.current;h!==null&&(Math.abs(v.clientX-h.x)>Jp||Math.abs(v.clientY-h.y)>Jp)&&k()},[k]),c=M.useCallback(v=>{(l.current||e.current!==null)&&v.preventDefault()},[]),m=M.useCallback(v=>{l.current&&(l.current=!1,v.preventDefault(),v.stopPropagation())},[]);return{onPointerDown:y,onPointerMove:i,onPointerUp:k,onPointerCancel:k,onContextMenu:c,onClickCapture:m}}function Sx({onLongPress:t,...e}){const s=Cx(t);return o.jsx("button",{...e,...s})}function kh({className:t,text:e,title:s,disabled:l,offerAgentChoice:u,agents:k,agent:y,onOpen:i}){var N;const[c,m]=M.useState(!1),v=M.useRef(null),h=M.useCallback(()=>m(!1),[]),b=M.useCallback(w=>{m(!1),i(w)},[i]);if(!u)return o.jsx("button",{className:t,onClick:()=>i(),disabled:l,title:s,children:e});const T=((N=k.find(w=>w.id===y))==null?void 0:N.label)??null;return o.jsxs("span",{className:"split-button",children:[o.jsx("button",{className:`${t} split-button-main`,onClick:()=>i(y??void 0),disabled:l,title:T===null?s:_("agentMenu.titleWithAgent",{title:s,label:T}),children:e}),o.jsx("button",{ref:v,className:`${t} split-button-arrow`,onClick:()=>m(w=>!w),disabled:l,"aria-haspopup":"menu","aria-expanded":c,title:_("agentMenu.chooseTitle"),children:"▾"}),c&&v.current!==null&&o.jsx(tv,{agents:k,preselected:y,anchor:v.current,onPick:b,onClose:h})]})}function xx(t){const e=new Date(t);return e.setHours(0,0,0,0),e.getTime()}function wv(t,e,s,l){const u=new Set;for(const k of t)for(const y of k.sessions)y.agent===e&&(y.archived||y.updatedAt<s&&(l.has(y.sessionId)||u.add(y.sessionId)));return[...u]}function Ex(t,e,s,l){const u=[];for(const i of t)for(const c of i.sessions)u.includes(c.agent)||u.push(c.agent);const k=l,y=i=>{const c=k.indexOf(i);return c===-1?l.length:c};return u.sort((i,c)=>y(i)-y(c)).map(i=>({agent:i,count:wv(t,i,e,s).length})).filter(i=>i.count>0)}function yv(t,e){const s=new Set;let l=0;for(const u of t.sessions)if(!u.archived){if(e.has(u.sessionId)){l+=1;continue}s.add(u.sessionId)}return{sessionIds:[...s],blocked:l}}function Tx(t){const{sessionIds:e,blocked:s}=t;if(e.length===0)return _("archive.allBlocked",{count:s});const l=_("archive.confirm",{count:e.length});return s===0?l:_("archive.withBlocked",{confirm:l,blocked:_("archive.blockedStays",{count:s})})}const Zp=12;function Lx(t){let e=2166136261;for(let s=0;s<t.length;s+=1)e^=t.charCodeAt(s),e=Math.imul(e,16777619);return e>>>0}function Us(t){const e=t.toLowerCase().replace(/[\\/]+/g,"/").replace(/\/+$/,"");return`hsl(${Lx(e)%Zp*(360/Zp)} var(--project-color-s) var(--project-color-l))`}function Mi(){return _("vault.name")}function Nx(){return _("vault.privacy")}function Rx(){return _("vault.archived")}function Mx(){return _("vault.mark.copy")}function em(){return _("vault.mark.copyTitle")}function Ax(){return _("vault.mark.partial")}function Ix(){return _("vault.mark.partialTitle")}function bv(t){return _("vault.sessions",{count:t})}function Ch(t){return t==="measuring"||t==="writing"||t==="moving"}function jx(t){const e=t.progress;switch(t.state){case"measuring":return e===null?_("vault.state.measuring"):_("vault.state.measuringProgress",{done:e.done,total:e.total});case"writing":return e===null?_("vault.state.writing"):_("vault.state.writingProgress",{done:e.done,total:e.total});case"moving":return _("vault.state.moving");default:return t.enabled?_("vault.state.on"):_("vault.state.off")}}function Dx(t){if(t===null||!t.enabled)return null;const e=[Mi(),bv(t.sessions)];return t.state==="writing"?e.push(t.progress===null?_("vault.line.copying"):_("vault.line.copyingProgress",{done:t.progress.done,total:t.progress.total})):t.state==="moving"?e.push(_("vault.line.moving")):t.state==="measuring"?e.push(_("vault.line.measuring")):e.push(t.lastPassAt===null?_("vault.line.neverCopied"):Wn(t.lastPassAt)),t.pending>0&&e.push(_("vault.line.pending",{count:t.pending})),e.join(" · ")}function Px(t){return t===null?Mi():t.enabled?_("vault.button.on"):_("vault.button.off")}function Ox(t){return t.enabled?"enabled":Ch(t.state)?"busy":t.measurement!==null?"measured":t.passSessions>0?"existing":"needs-measure"}function Bx(t,e){return Ch(t.state)?_("vault.busy"):e?null:_("vault.indexNotReady")}function Fx(t){return Ch(t.state)?_("vault.busy"):null}function Hx(t){return _("vault.previousDir",{dir:t})}function Ux(t){const e=[];return t.skippedEmpty>0&&e.push(_("vault.note.empty",{count:t.skippedEmpty})),t.unsupported>0&&e.push(_("vault.note.unsupported",{count:t.unsupported})),t.failed>0&&e.push(t.failureReasons.length>0?_("vault.note.failedWithReasons",{count:t.failed,reasons:t.failureReasons.map(At).join("; ")}):_("vault.note.failed",{count:t.failed})),e.length===0?null:_("vault.note.notCopied",{parts:e.join(" · ")})}function $x(t,e){const s=t.byAgent.map(k=>({agent:k.agent,label:Mo(k.agent,e),sessions:k.sessions,bytes:k.eventBytes+k.imageBytes,images:k.images,imageBytes:k.imageBytes,skippedArchived:k.skippedArchived,note:Ux(k)})),l=s.reduce((k,y)=>({sessions:k.sessions+y.sessions,bytes:k.bytes+y.bytes,images:k.images+y.images,skippedArchived:k.skippedArchived+y.skippedArchived}),{sessions:0,bytes:t.memoryBytes,images:0,skippedArchived:0}),u=Wn(t.measuredAt);return{rows:s,memoryProjects:t.memoryProjects,memoryBytes:t.memoryBytes,total:l,summary:u.length>0?_("vault.measure.summary",{when:u,duration:Eo(t.durationMs)}):_("vault.measure.summaryNoWhen",{duration:Eo(t.durationMs)})}}function Wx(t){const e=t.storage==="vault";return{copy:e,partial:e&&t.partial}}function zx(t){switch(t){case"exporting":return _("vault.export.exporting");case"done":return _("vault.export.done");default:return _("vault.export.idle")}}const qx=1e3;function tm({hit:t}){const{before:e,match:s,after:l}=vv(t);return o.jsxs(o.Fragment,{children:[e,o.jsx("mark",{children:s}),l]})}function Vx({project:t,openSessionIds:e,onConfirm:s,onCancel:l}){const u=yv(t,e);return o.jsxs("div",{className:"project-archive-confirm",role:"group",children:[o.jsx("span",{className:"archive-history-text",children:Tx(u)}),u.sessionIds.length>0&&o.jsx("button",{className:"link-button",onClick:s,children:_("sidebar.action.archive")}),o.jsx("button",{className:"link-button",onClick:l,children:u.sessionIds.length>0?_("common.cancel"):_("common.close")})]})}function Eu(t){if(t.cwd.length===0)return t.fallbackName;const e=t.cwd.split(/[\\/]/).filter(s=>s.length>0);return e[e.length-1]??t.cwd}function nm({out:t}){return o.jsxs("svg",{className:"archive-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("rect",{x:"2.5",y:"3.5",width:"19",height:"5",rx:"1.2"}),o.jsx("path",{d:"M4.5 8.5v10a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2v-10"}),t?o.jsx("path",{d:"M12 18.5v-6M9.2 15.3 12 12.5l2.8 2.8"}):o.jsx("path",{d:"M10 12.5h4"})]})}function Kx(){return o.jsxs("svg",{className:"archive-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M8 6.5V4.5a1.5 1.5 0 0 1 1.5-1.5h9A1.5 1.5 0 0 1 20 4.5v11a1.5 1.5 0 0 1-1.5 1.5H17"}),o.jsx("rect",{x:"4",y:"7",width:"12",height:"14",rx:"1.5"}),o.jsx("path",{d:"M7.5 12h5M7.5 15.5h5"})]})}function Gx({done:t}){return o.jsx("svg",{className:"archive-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:t?o.jsx("path",{d:"M5 12.5l4.5 4.5L19 7.5"}):o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M14 3H7a1.5 1.5 0 0 0-1.5 1.5v15A1.5 1.5 0 0 0 7 21h10a1.5 1.5 0 0 0 1.5-1.5V7.5z"}),o.jsx("path",{d:"M12 10.5v6.5M9.2 14.2 12 17l2.8-2.8"})]})})}function Yx({candidates:t,agents:e,onArchiveAgent:s,onClose:l,anchorRef:u}){const[k,y]=M.useState(null),i=M.useRef(null);return M.useEffect(()=>{const c=h=>{var b,T;return h instanceof Node&&(((b=i.current)==null?void 0:b.contains(h))===!0||((T=u.current)==null?void 0:T.contains(h))===!0)},m=h=>{h.key!=="Escape"||!c(document.activeElement)||(h.preventDefault(),h.stopPropagation(),l())},v=h=>{c(h.target)||l()};return window.addEventListener("keydown",m,!0),document.addEventListener("pointerdown",v,!0),()=>{window.removeEventListener("keydown",m,!0),document.removeEventListener("pointerdown",v,!0)}},[u,l]),o.jsxs("div",{ref:i,className:"archive-history",role:"region","aria-label":_("sidebar.history.region"),children:[o.jsxs("div",{className:"archive-history-header",children:[o.jsx("span",{children:_("sidebar.history.heading")}),o.jsx("button",{className:"icon-button",onClick:l,title:_("common.closeEsc"),children:"×"})]}),t.map(({agent:c,count:m})=>{const v=Mo(c,e);return k===c?o.jsxs("div",{className:"archive-history-row archive-history-confirm",children:[o.jsx("span",{className:"archive-history-text",children:_("sidebar.history.confirm",{count:m,label:v})}),o.jsx("button",{className:"link-button",onClick:()=>s(c),children:_("sidebar.action.archive")}),o.jsx("button",{className:"link-button",onClick:()=>y(null),children:_("common.cancel")})]},c):o.jsxs("div",{className:"archive-history-row",children:[o.jsxs("span",{className:"archive-history-text",children:[o.jsx("span",{className:"archive-history-agent",children:v}),o.jsx("span",{className:"archive-history-count",children:_("sidebar.history.count",{count:m})})]}),o.jsx("button",{className:"link-button",onClick:()=>y(c),children:_("sidebar.action.archive")})]},c)})]})}function Xx({projects:t,indexStatus:e,disabled:s,openSessionIds:l,openBlocked:u,onOpenProject:k,agents:y,offerAgentChoice:i,agentForProject:c,onOpenSession:m,canResume:v,platform:h,onRefresh:b,onArchive:T,onHide:N,width:w,onNewProject:d,vault:g,onOpenVault:p,onOpenVaultSession:f,onExportProject:E,exporting:j,lastExported:x,onContinueSession:R,globalSearch:S,onOpenSearchHit:L,onNewWorktree:I,onReopenWorktree:P}){const[O,B]=M.useState(new Set),[$,W]=M.useState(null);M.useEffect(()=>{const pe=x===null?0:x.at+qx-Date.now();if(x===null||pe<=0)return;W(x.projectKey);const Ze=window.setTimeout(()=>W(null),pe);return()=>window.clearTimeout(Ze)},[x]);const K=pe=>j.has(pe)?"exporting":$===pe?"done":"idle",Y=Dx(g),[V,F]=M.useState(""),[H,U]=M.useState(!1),[z,te]=M.useState(new Set),[ie,we]=M.useState("titles"),ge=S===null?"titles":ie,[X,G]=M.useState(!1),ee=S!==null&&ge==="conversations"&&V.trim().length>0&&(X||S.submitted!==null),Z=(S==null?void 0:S.result)??null,ve=M.useMemo(()=>ee&&Z!==null?ox(Z.hits):[],[ee,Z]),Se=pe=>{we(pe),G(!1),S==null||S.clear()},Ie=()=>{if(S!==null){if(sx(V)){G(!0),S.clear();return}G(!1),S.search(V.trim(),H)}},je=(S==null?void 0:S.submitted)??null,Je=S==null?void 0:S.search;M.useEffect(()=>{ge!=="conversations"||je===null||Je===void 0||je.includeArchived!==H&&Je(je.query,H)},[ge,je,Je,H]);const tt=M.useMemo(()=>t.reduce((pe,Ze)=>pe+Ze.sessions.filter(Qe=>Qe.archived).length,0),[t]),Ne=M.useMemo(()=>{const pe=ge==="titles"?V.trim().toLowerCase():"";return t.map(Ze=>{const Qe=H?Ze.sessions:Ze.sessions.filter(Ve=>!Ve.archived);if(Qe.length===0)return null;if(pe.length===0)return{...Ze,sessions:Qe};if(Eu(Ze).toLowerCase().includes(pe)||Ze.cwd.toLowerCase().includes(pe))return{...Ze,sessions:Qe};const he=Qe.filter(Ve=>fr(Ve.title,Ve.titleSource).toLowerCase().includes(pe));return he.length>0?{...Ze,sessions:he}:null}).filter(Ze=>Ze!==null)},[t,V,H,ge]),ce=ge==="titles"&&V.trim().length>0,dt=pe=>pe.archived||!l.has(pe.sessionId),[se,fe]=M.useState(!1),Ce=M.useRef(null),ye=xx(Date.now()),_e=M.useMemo(()=>y.map(pe=>pe.id),[y]),Te=M.useMemo(()=>Ex(t,ye,l,_e),[t,ye,l,_e]),[ue,Fe]=M.useState(null);M.useEffect(()=>{Te.length===0&&fe(!1)},[Te.length]);const $e=M.useCallback(()=>fe(!1),[]),Ye=pe=>{const Ze=wv(t,pe,ye,l);Ze.length>0&&(T(Ze,!0),Fe({what:Mo(pe,y),sessionIds:Ze})),fe(!1)},[De,He]=M.useState(null),qe=pe=>{const Ze=yv(pe,l);Ze.sessionIds.length>0&&(T(Ze.sessionIds,!0),Fe({what:Eu(pe),sessionIds:Ze.sessionIds})),He(null)},xt=()=>{ue!==null&&T(ue.sessionIds,!1),Fe(null)},It=pe=>{te(Ze=>{const Qe=new Set(Ze);return Qe.has(pe)?Qe.delete(pe):Qe.add(pe),Qe})},jt=M.useMemo(()=>{const pe=[];for(const Ze of Ne)for(const Qe of Ze.sessions)z.has(Qe.sessionId)&&pe.push(Qe);return pe},[Ne,z]),gt=pe=>{const Ze=jt.filter(Qe=>pe?dt(Qe):!0).map(Qe=>Qe.sessionId);Ze.length>0&&T(Ze,pe),te(new Set)},Kt=pe=>{B(Ze=>{const Qe=new Set(Ze);return Qe.has(pe)?Qe.delete(pe):Qe.add(pe),Qe})},Ft=e.state==="scanning";return o.jsxs("aside",{className:"sidebar",style:{width:`${w}px`},children:[o.jsxs("div",{className:"sidebar-header",children:[o.jsx("input",{className:"sidebar-filter",type:"search",placeholder:nx(ge),value:V,onChange:pe=>{F(pe.target.value),ge==="conversations"&&(G(!1),pe.target.value.trim().length===0&&(S==null||S.clear()))},onKeyDown:pe=>{ge!=="conversations"||pe.key!=="Enter"||(pe.preventDefault(),Ie())},spellCheck:!1}),o.jsx("button",{className:"icon-button",onClick:d,title:_("sidebar.newProject"),disabled:s,children:"+"}),o.jsx("button",{className:"icon-button",onClick:b,title:_("sidebar.reindex"),disabled:Ft,children:"⟳"}),o.jsx("button",{className:`icon-button${(g==null?void 0:g.enabled)===!0?" icon-button-on":""}`,onClick:p,title:Px(g),"aria-label":Mi(),children:o.jsx(Kx,{})}),o.jsx("button",{className:"icon-button",onClick:N,title:_("sidebar.hide"),children:"«"})]}),S!==null&&o.jsxs("div",{className:"sidebar-search-mode",role:"group","aria-label":_("sidebar.searchMode.label"),children:[o.jsx("button",{className:`sidebar-search-mode-option${ge==="titles"?" is-on":""}`,"aria-pressed":ge==="titles",onClick:()=>Se("titles"),title:_("sidebar.searchMode.titlesTitle"),children:ZS()}),o.jsx("button",{className:`sidebar-search-mode-option${ge==="conversations"?" is-on":""}`,"aria-pressed":ge==="conversations",onClick:()=>Se("conversations"),title:tx(),children:ex()})]}),Ft&&o.jsx("div",{className:"sidebar-progress",children:_("sidebar.indexing",{scanned:e.scannedFiles,total:e.totalFiles})}),(tt>0||Te.length>0)&&o.jsxs("div",{className:"sidebar-archive-bar",children:[tt>0&&o.jsx("button",{className:`sidebar-archived-toggle${H?" is-on":""}`,onClick:()=>U(pe=>!pe),title:_("sidebar.archived.toggleTitle"),children:H?_("sidebar.archived.hide",{count:tt}):_("sidebar.archived.show",{count:tt})}),Te.length>0&&o.jsx("button",{ref:Ce,className:`link-button sidebar-archive-history${se?" is-on":""}`,onClick:()=>fe(pe=>!pe),"aria-expanded":se,title:_("sidebar.history.buttonTitle"),children:_("sidebar.history.button")})]}),se&&Te.length>0&&o.jsx(Yx,{candidates:Te,agents:y,onArchiveAgent:Ye,onClose:$e,anchorRef:Ce}),ue!==null&&!se&&o.jsxs("div",{className:"archive-history archive-history-undo",role:"status",children:[o.jsx("span",{className:"archive-history-text",children:_("sidebar.undo.text",{count:ue.sessionIds.length,what:ue.what})}),o.jsx("button",{className:"link-button",onClick:xt,children:_("sidebar.action.undo")}),o.jsx("button",{className:"icon-button",onClick:()=>Fe(null),title:_("sidebar.undo.dismissTitle"),children:"×"})]}),Y!==null&&o.jsx("button",{className:`sidebar-vault-line${(g==null?void 0:g.lastError)!=null?" is-problem":""}`,onClick:p,title:(g==null?void 0:g.lastError)!=null?_("sidebar.vaultLine.lastError",{error:At(g.lastError)}):_("sidebar.vaultLine.title"),children:Y}),o.jsxs("div",{className:"sidebar-scroll",children:[ee&&S!==null&&o.jsxs("div",{className:"search-results",children:[!S.vaultEnabled&&o.jsx("p",{className:"search-note",children:ix()}),o.jsx("p",{className:`search-status${S.error!==null?" is-problem":""}`,role:"status",children:X?rx():hx(S)}),!X&&ve.map(pe=>{const Ze=pe.hits[0]??pe.titleHit;return Ze===null?null:o.jsxs("div",{className:"search-group",children:[o.jsxs("button",{className:"search-group-title",onClick:()=>L(Ze,cx(pe)),title:fr(pe.title),children:[o.jsx(Ju,{agent:pe.agent,agents:y}),pe.titleHit!==null?o.jsx(tm,{hit:pe.titleHit}):fr(pe.title)]}),pe.hits.map(Qe=>o.jsxs("button",{className:"search-hit",onClick:()=>L(Qe,_v(Qe)),children:[o.jsx("span",{className:"search-hit-snippet",children:o.jsx(tm,{hit:Qe})}),o.jsxs("span",{className:"search-hit-meta",children:[ax(Qe),Qe.at!==null?` · ${Wn(Qe.at)}`:""]})]},Qe.eventId??"titulo"))]},pe.key)})]}),!ee&&Ne.length===0&&!Ft&&o.jsx("p",{className:"sidebar-empty",children:t.length===0?_("sidebar.empty.noProjects"):_("sidebar.empty.noMatch")}),!ee&&Ne.map(pe=>{const Ze=O.has(pe.key)||ce,Qe=!s&&pe.cwdExists,ct=u(pe.cwd);return o.jsxs("div",{className:"project",children:[o.jsxs("div",{className:"project-row",children:[o.jsxs("button",{className:"project-toggle",onClick:()=>Kt(pe.key),title:pe.cwd.length>0?pe.cwd:pe.fallbackName,children:[o.jsx("span",{className:`chevron${Ze?" chevron-open":""}`,children:"›"}),o.jsx("span",{className:"project-swatch",style:{background:Us(pe.cwd)},"aria-hidden":"true"}),o.jsx("span",{className:"project-name",children:Eu(pe)}),o.jsx("span",{className:"project-count",children:pe.sessions.length})]}),o.jsxs("span",{className:"project-actions",children:[I!==null&&pe.isGitRepo&&pe.cwdExists&&o.jsx("button",{className:"icon-button project-action",onClick:()=>I(pe),disabled:s,title:_("worktree.new"),"aria-label":_("worktree.new"),children:o.jsx(Zu,{})}),E!==null&&o.jsx("button",{className:`icon-button project-action${K(pe.key)!=="idle"?" project-action-busy":""}`,onClick:()=>E(pe.key),disabled:K(pe.key)==="exporting",title:zx(K(pe.key)),"aria-label":_("sidebar.project.export"),children:o.jsx(Gx,{done:K(pe.key)==="done"})}),o.jsx("button",{className:`icon-button project-action${De===pe.key?" project-action-busy":""}`,onClick:()=>He(he=>he===pe.key?null:pe.key),title:_("sidebar.project.archiveTitle"),"aria-label":_("sidebar.project.archive"),"aria-expanded":De===pe.key,children:o.jsx(nm,{out:!1})})]}),o.jsx(kh,{className:"icon-button",text:"+",title:ct?Eg():pe.cwdExists?_("sidebar.project.newSession"):_("sidebar.project.folderGone"),disabled:!Qe||ct,offerAgentChoice:i,agents:y,agent:i?c(pe):null,onOpen:he=>k(pe.cwd,he)})]}),!pe.cwdExists&&o.jsx("div",{className:"project-missing",title:pe.cwd,children:_("sidebar.project.missing")}),De===pe.key&&o.jsx(Vx,{project:pe,openSessionIds:l,onConfirm:()=>qe(pe),onCancel:()=>He(null)}),Ze&&o.jsx("ul",{className:"session-list",children:pe.sessions.map(he=>{var mt;const Ve=z.has(he.sessionId),ut=!dt(he),be=dk(he.agent,y,i),nt=Wx(he),St=ra(he)&&v(he.agent),pt=he.worktree!==null&&!he.worktree.exists,Ke=nt.copy?f!==null:Qe&&St&&!pt;return o.jsxs("li",{className:`session-row${he.archived?" session-archived":""}${Ve?" session-selected":""}`,children:[o.jsxs(Sx,{className:"session-item",onLongPress:()=>It(he.sessionId),onClick:ot=>{if(ot.ctrlKey||ot.metaKey){It(he.sessionId);return}if(nt.copy){f==null||f(he);return}ra(he)&&(he.archived&&T([he.sessionId],!1),m(ug(he.cwd,pe.cwd,h),he))},disabled:!Ke,title:nt.copy?`${fr(he.title,he.titleSource)}
|
|
139
|
+
${f===null?_("remote.onlyOnHost"):em()}`:be.unavailableTitle??fr(he.title,he.titleSource),children:[o.jsxs("span",{className:"session-title",children:[be.badge&&o.jsx(Ju,{agent:he.agent,agents:y}),nt.copy&&o.jsx("span",{className:"session-vault-mark",title:em(),children:Mx()}),nt.partial&&o.jsx("span",{className:"session-partial-mark",title:Ix(),children:Ax()}),he.worktree!==null&&o.jsxs("span",{className:`session-branch${pt?" session-branch-gone":""}`,title:pt?_("worktree.sidebar.removedTitle"):_("worktree.sidebar.branchTitle",{branch:he.worktree.branch}),children:[he.worktree.branch,pt&&o.jsx("span",{className:"session-branch-note",children:_("worktree.sidebar.removed")})]}),fr(he.title,he.titleSource)]}),o.jsx("span",{className:"session-meta",children:Wn(he.updatedAt)})]}),o.jsx(nv,{targets:Cg(y,he.agent,he.partial,pt),className:"icon-button session-continue",text:"↪",title:_h(pt),onPick:ot=>R(he,ot)}),pt&&((mt=he.worktree)==null?void 0:mt.reopenable)===!0&&Qe&&ra(he)&&v(he.agent)&&o.jsx("button",{className:"icon-button session-action session-reopen",onClick:()=>P(he,pe),title:_("worktree.sidebar.reopenTitle"),"aria-label":_("worktree.sidebar.reopen"),children:o.jsx(Zu,{})}),o.jsx("button",{className:"icon-button session-action",onClick:()=>T([he.sessionId],!he.archived),disabled:ut,title:he.archived?_("sidebar.session.restore"):_(ut?"sidebar.session.blocked":"sidebar.session.archive"),children:o.jsx(nm,{out:he.archived})})]},`${he.agent}:${he.sessionId}`)})})]},pe.key)})]}),jt.length>0&&o.jsxs("div",{className:"sidebar-selection",children:[o.jsx("span",{children:_("sidebar.selection.count",{count:jt.length})}),jt.some(pe=>!pe.archived)&&o.jsx("button",{className:"link-button",onClick:()=>gt(!0),children:_("sidebar.action.archive")}),jt.some(pe=>pe.archived)&&o.jsx("button",{className:"link-button",onClick:()=>gt(!1),children:_("sidebar.action.restore")}),o.jsx("button",{className:"link-button",onClick:()=>te(new Set),children:_("common.cancel")})]})]})}function eh({x:t,y:e,items:s,onClose:l,anchor:u=null}){const k=M.useRef(null),[y,i]=M.useState({left:t,top:e});return M.useLayoutEffect(()=>{const c=k.current;if(c===null)return;const{width:m,height:v}=c.getBoundingClientRect();i({left:Math.max(4,Math.min(t,window.innerWidth-m-4)),top:Math.max(4,Math.min(e,window.innerHeight-v-4))})},[t,e]),M.useEffect(()=>{const c=v=>{v.key==="Escape"&&(v.stopPropagation(),l())},m=v=>{var b;const h=v.target;h instanceof Node&&((b=k.current)!=null&&b.contains(h)||u!=null&&u.contains(h))||l()};return window.addEventListener("keydown",c,!0),window.addEventListener("pointerdown",m,!0),window.addEventListener("scroll",l,!0),window.addEventListener("resize",l),()=>{window.removeEventListener("keydown",c,!0),window.removeEventListener("pointerdown",m,!0),window.removeEventListener("scroll",l,!0),window.removeEventListener("resize",l)}},[u,l]),o.jsx("div",{ref:k,className:"context-menu",style:{left:`${y.left}px`,top:`${y.top}px`},onPointerDown:c=>c.stopPropagation(),children:s.map(c=>o.jsxs("button",{className:"context-menu-item",lang:c.lang,role:c.checked===void 0?void 0:"menuitemradio","aria-checked":c.checked,onClick:()=>{c.onSelect(),l()},children:[c.checked!==void 0&&o.jsx("span",{className:"context-menu-check","aria-hidden":"true",children:c.checked?"✓":""}),c.label]},c.label))})}function kv({listLabel:t,docs:e,active:s,tooltipOf:l,labelOf:u=c=>c.title,onShowList:k,onSelect:y,onClose:i}){return o.jsxs("div",{className:"panel-subhead doc-strip",children:[o.jsx("button",{className:`doc-strip-list${s===null?" is-active":""}`,onClick:k,title:_("docs.backToList"),children:s===null?t:`← ${t}`}),o.jsx("div",{className:"strip-tabs doc-tabs",children:e.map(c=>o.jsxs("div",{className:`strip-tab${c.key===s?" is-active":""}`,children:[o.jsx("button",{className:"strip-tab-label",onClick:()=>y(c.key),title:l(c),children:u(c)}),o.jsx("button",{className:"strip-tab-close",onClick:()=>i(c.key),title:_("docs.tab.close"),children:"×"})]},c.key))})]})}const Qx={added:"+",removed:"-",context:" ",hunk:"",meta:""};function Cv({diff:t}){return t.binary?o.jsx("p",{className:"panel-note",children:_("diff.binary")}):t.lines.length===0?o.jsx("p",{className:"panel-note",children:t.message===null?_("diff.noChanges"):At(t.message)}):o.jsxs("div",{className:"panel-scroll",children:[o.jsx(Sv,{lines:t.lines}),t.truncated&&o.jsx("p",{className:"panel-note",children:_("diff.truncated")})]})}function Sv({lines:t}){return o.jsx("div",{className:"diff",children:t.map((e,s)=>o.jsxs("div",{className:`diff-line diff-line-${e.kind}`,children:[o.jsx("span",{className:"diff-num","aria-hidden":"true",children:e.oldLine??""}),o.jsx("span",{className:"diff-num","aria-hidden":"true",children:e.newLine??""}),o.jsx("span",{className:"diff-marker","aria-hidden":"true",children:Qx[e.kind]}),o.jsx("span",{className:"diff-text",children:e.text})]},s))})}function rm(t){let e="";for(let s=0;s<t.length;s++){const l=t[s]??"",u=l.toLowerCase();e+=u.length===l.length?u:l}return e}function Jx(t,e){if(e.length===0)return[];const s=rm(t),l=rm(e),u=[];let k=s.indexOf(l);for(;k!==-1;)u.push(k),k=s.indexOf(l,k+l.length);return u}function sm(t,e,s){for(let k=0;k<t.length;k++){const y=t[k]??0;if(s==="start"?e<y:e<=y){const i=k===0?0:t[k-1]??0;return{node:k,offset:e-i}}}const l=Math.max(0,t.length-1),u=l===0?0:t[l-1]??0;return{node:l,offset:(t[l]??0)-u}}function Zx(t,e,s){return e===0?0:(t+s+e)%e}function eE(t){return/\.(md|markdown)$/i.test(t)}function tE(t,e){var k;const s=((k=e.split("#")[0])==null?void 0:k.split("?")[0])??"";if(s.length===0)return null;let l;try{l=decodeURIComponent(s)}catch{return null}if(/^[a-z][a-z0-9+.-]*:/i.test(l)||l.startsWith("/")||l.startsWith("\\"))return null;const u=t.split("/").slice(0,-1);for(const y of l.replace(/\\/g,"/").split("/")){if(y.includes(":"))return null;if(!(y===""||y===".")){if(y===".."){if(u.length===0)return null;u.pop();continue}u.push(y)}}return u.length===0?null:u.join("/")}function nE({text:t,language:e}){const[s,l]=M.useState(null);M.useEffect(()=>{if(e===null){l(null);return}let k=!1;return dr(async()=>{const{highlightCode:y}=await import("./highlight-BUWAzUc6.js");return{highlightCode:y}},[]).then(({highlightCode:y})=>{k||l(y(t,e))}).catch(()=>{k||l(null)}),()=>{k=!0,l(null)}},[t,e]);const u=M.useMemo(()=>t.split(`
|
|
140
|
+
`).length,[t]);return o.jsxs("div",{className:"preview",children:[o.jsx("div",{className:"preview-gutter","aria-hidden":"true","data-search-skip":"",children:Array.from({length:u},(k,y)=>o.jsx("span",{children:y+1},y))}),s!==null?o.jsx("pre",{className:"preview-code hljs",dangerouslySetInnerHTML:{__html:s}}):o.jsx("pre",{className:"preview-code",children:t})]})}function im({onInsert:t,onOpenWithSystem:e}){const[s,l]=M.useState(!1),u=M.useRef(null);M.useEffect(()=>()=>{u.current!==null&&window.clearTimeout(u.current)},[]);const k=()=>{t==null||t(),l(!0),u.current!==null&&window.clearTimeout(u.current),u.current=window.setTimeout(()=>l(!1),1200)};return o.jsxs("div",{className:"preview-actions",children:[t!==void 0&&o.jsx("button",{className:"primary-button primary-button-small preview-open",onClick:k,children:_(s?"files.pathInserted":"files.preview.insertPath")}),e!==null&&o.jsx("button",{className:"primary-button primary-button-small preview-open",onClick:e,children:_("files.menu.openWithSystem")})]})}const th="doc-search",nh="doc-search-current";function rh(){const t=CSS.highlights,e=window.Highlight;return t===void 0||typeof e!="function"?null:t}function om(t){const e=window.Highlight;return new e(...t)}function lm(){const t=rh();t==null||t.delete(th),t==null||t.delete(nh)}function rE(t,e){if(e===null)return;const s=t.getBoundingClientRect(),l=e.getBoundingClientRect();(s.top<l.top+16||s.bottom>l.bottom-16)&&(e.scrollTop+=s.top-l.top-l.height/3),(s.left<l.left||s.right>l.right)&&(e.scrollLeft+=s.left-l.left-48)}function sE(t,e,s,l){const[u,k]=M.useState(0),[y,i]=M.useState(0),[c,m]=M.useState(0),v=M.useRef([]);M.useEffect(()=>{const b=t.current;if(b===null||s.length===0)return;let T=0;const N=new MutationObserver(()=>{T===0&&(T=window.requestAnimationFrame(()=>{T=0,m(w=>w+1)}))});return N.observe(b,{childList:!0,subtree:!0,characterData:!0}),()=>{N.disconnect(),T!==0&&window.cancelAnimationFrame(T)}},[t,s,l]),M.useEffect(()=>{const b=t.current;if(v.current=[],b===null||s.length===0){lm(),k(0),i(0);return}const T=[],N=[];let w="";const d=document.createTreeWalker(b,NodeFilter.SHOW_TEXT,{acceptNode:p=>{var f;return(f=p.parentElement)!=null&&f.closest("[data-search-skip]")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}});for(let p=d.nextNode();p!==null;p=d.nextNode()){const f=p;T.push(f),w+=f.data,N.push(w.length)}v.current=Jx(w,s).map(p=>{const f=sm(N,p,"start"),E=sm(N,p+s.length,"end"),j=document.createRange();return j.setStart(T[f.node],f.offset),j.setEnd(T[E.node],E.offset),j}),k(v.current.length),i(p=>p<v.current.length?p:0);const g=rh();return g!==null&&v.current.length>0?g.set(th,om(v.current)):g==null||g.delete(th),lm},[t,s,c,l]),M.useEffect(()=>{i(0)},[s]),M.useEffect(()=>{const b=v.current[y],T=rh();if(b===void 0){T==null||T.delete(nh);return}T==null||T.set(nh,om([b])),rE(b,e.current)},[y,u,c,l,s,e]);const h=M.useCallback(b=>i(T=>Zx(T,u,b)),[u]);return{count:u,index:y,step:h}}function xv({doc:t,content:e,readingText:s,truncatedText:l,onReload:u,onModeChange:k,onOpenWithSystem:y,onInsert:i,onOpenLink:c,initialScroll:m,onScrollChange:v,editor:h=null,insertButton:b}){const[T,N]=M.useState(""),w=M.useRef(null),d=M.useRef(null),g=(e==null?void 0:e.loaded)??null,p=g===null?"":g.kind==="file"?g.preview.text:g.plan.text,f=g!==null&&g.kind==="file"&&g.preview.binary,E=g!==null&&(g.kind==="file"?g.preview.truncated:g.plan.truncated),j=g!==null&&(g.kind==="plan"||g.preview.language==="markdown"||eE(g.preview.path)),x=j&&(t.mode??"formatted")==="formatted",R=g!==null&&g.kind==="file"?g.preview.language:"markdown",S=T.trim(),L=sE(d,w,S,`${x?"f":"s"}:${p.length}:${p.slice(0,64)}`),I=M.useRef(!1);M.useLayoutEffect(()=>{I.current||g===null||(I.current=!0,m!==void 0&&w.current!==null&&(w.current.scrollTop=m))},[g,m]);const P=c===void 0||g===null||g.kind!=="file"?void 0:K=>{const Y=tE(t.key,K);return Y===null?null:()=>c(Y)},O=g!==null&&!f,B=(h==null?void 0:h.edit)??null;if(h!==null&&B!==null)return o.jsx(iE,{title:t.title,editor:h,insertButton:b});const $=g!==null&&g.kind==="file"&&g.preview.editable===!0,W=_($?"docs.edit.title":E?"docs.edit.tooLarge":"docs.edit.unsafe");return o.jsxs("div",{className:"panel-body doc-viewer",children:[o.jsxs("div",{className:"doc-toolbar",children:[o.jsx("input",{className:"conversation-search-input",type:"search",placeholder:_("docs.search.placeholder"),value:T,disabled:!O,onChange:K=>N(K.target.value),onKeyDown:K=>{K.key==="Enter"&&L.step(K.shiftKey?-1:1),K.key==="Escape"&&N(""),K.stopPropagation()},spellCheck:!1}),S.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"conversation-matches",children:L.count===0?_("thread.search.none"):`${L.index+1}/${L.count}`}),o.jsx("button",{className:"icon-button",onClick:()=>L.step(-1),disabled:L.count===0,title:_("thread.search.previous"),children:"↑"}),o.jsx("button",{className:"icon-button",onClick:()=>L.step(1),disabled:L.count===0,title:_("thread.search.next"),children:"↓"})]}),j&&o.jsxs("div",{className:"doc-mode",role:"group","aria-label":_("docs.mode.label"),children:[o.jsx("button",{className:x?"is-active":"","aria-pressed":x,onClick:()=>k("formatted"),children:_("docs.mode.formatted")}),o.jsx("button",{className:x?"":"is-active","aria-pressed":!x,onClick:()=>k("source"),children:_("docs.mode.source")})]}),h!==null&&g!==null&&g.kind==="file"&&!f&&o.jsx("button",{className:"primary-button primary-button-small doc-edit-button",onClick:h.begin,disabled:!$,title:W,children:h.justSaved?_("docs.edit.saved"):_("docs.edit.button")}),b,o.jsx("button",{className:"icon-button",onClick:u,disabled:(e==null?void 0:e.loading)===!0,title:_("docs.reload"),children:"⟳"})]}),(e==null?void 0:e.failed)===!0&&g!==null&&o.jsx("p",{className:"panel-note doc-note",children:_("docs.reloadFailed")}),g===null?o.jsx("p",{className:"panel-note",children:(e==null?void 0:e.failed)===!0?_("docs.failed"):s}):f?o.jsxs("div",{className:"preview-fallback",children:[o.jsx("p",{className:"panel-note",children:_("files.preview.binary")}),o.jsx(im,{onInsert:i,onOpenWithSystem:y})]}):o.jsxs("div",{className:"panel-scroll",ref:w,onScroll:K=>v(K.currentTarget.scrollTop),children:[o.jsx("div",{ref:d,className:x?"plan-body":"doc-source",children:x?o.jsx(bh,{text:p,localLink:P}):o.jsx(nE,{text:p,language:R})}),E&&o.jsxs("div",{className:"preview-fallback",children:[o.jsx("p",{className:"panel-note",children:l}),g.kind==="file"&&o.jsx(im,{onInsert:i,onOpenWithSystem:y})]})]})]})}function iE({title:t,editor:e,insertButton:s}){const[l,u]=M.useState(!1),k=e.edit;if(k===null)return o.jsx(o.Fragment,{});const y=k.text!==k.opened,i=k.conflict,c=y&&!k.saving&&i===null,m=k.saving?_("docs.edit.saving"):_(y?"docs.edit.unsaved":"docs.edit.noChanges"),v=()=>{e.unsaved?u(!0):e.discard()};return o.jsxs("div",{className:"panel-body doc-viewer",children:[o.jsxs("div",{className:"doc-toolbar",children:[o.jsxs("span",{className:"doc-edit-status",title:t,children:[_("docs.edit.editing",{name:t}),o.jsxs("span",{className:"doc-edit-state",children:[" · ",m]})]}),o.jsx("button",{className:"link-button",onClick:v,disabled:k.saving,children:_("docs.edit.cancel")}),o.jsx("button",{className:"primary-button primary-button-small",onClick:e.save,disabled:!c,title:_("docs.edit.saveTitle"),children:_("docs.edit.save")}),s,o.jsx("button",{className:"icon-button",disabled:!0,title:_("docs.reload"),children:"⟳"})]}),k.closing&&o.jsxs("div",{className:"note-closing doc-edit-bar",children:[o.jsx("span",{children:_("docs.edit.closeConfirm")}),o.jsx("button",{className:"link-button link-danger",onClick:e.confirmClose,children:_("docs.edit.discardAndClose")}),o.jsx("button",{className:"link-button",onClick:e.keepEditing,children:_("docs.edit.keepEditing")})]}),l&&!k.closing&&o.jsxs("div",{className:"note-closing doc-edit-bar",children:[o.jsx("span",{children:_("docs.edit.discardConfirm")}),o.jsx("button",{className:"link-button link-danger",onClick:e.discard,children:_("docs.edit.discard")}),o.jsx("button",{className:"link-button",onClick:()=>u(!1),children:_("docs.edit.keepEditing")})]}),i!==null&&o.jsxs("div",{className:"note-closing doc-edit-bar",children:[o.jsx("span",{children:i.next===null?_("docs.edit.gone"):_("docs.edit.conflict")}),i.next!==null&&o.jsx("button",{className:"primary-button primary-button-small",onClick:e.adopt,children:_("docs.edit.adopt")}),o.jsx("button",{className:"link-button link-danger",onClick:e.discard,children:_("docs.edit.discardMine")})]}),k.failure!==null&&o.jsx("div",{className:"composer-problem doc-edit-bar",children:o.jsx("span",{children:k.failure.kind==="lost"?_("docs.edit.lost"):At(k.failure.text)})}),k.pending!==null&&o.jsxs("div",{className:"doc-changes",children:[o.jsxs("div",{className:"doc-changes-head",children:[o.jsx("span",{children:_("docs.edit.pending")}),o.jsx("button",{className:"link-button",onClick:e.dismissPending,children:_("docs.edit.pendingDone")})]}),o.jsx("div",{className:"doc-changes-body",children:o.jsx(Sv,{lines:k.pending})})]}),o.jsx("textarea",{className:"doc-editor",value:k.text,readOnly:i!==null||k.saving,spellCheck:!1,autoFocus:!0,"aria-label":_("docs.edit.editing",{name:t}),onChange:h=>e.change(h.target.value),onKeyDown:h=>{(h.ctrlKey||h.metaKey)&&!h.altKey&&h.key.toLowerCase()==="s"&&(h.preventDefault(),c&&e.save()),h.stopPropagation()}})]})}function Sh(){return o.jsx("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",focusable:"false",children:o.jsx("path",{d:"M1.5 3.5h4l1.2 1.6h7.8v7.4a1 1 0 0 1-1 1h-12a1 1 0 0 1-1-1V3.5z",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"})})}function oE(){return o.jsxs("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",focusable:"false",children:[o.jsx("rect",{x:"5.5",y:"1.5",width:"9",height:"10",rx:"1.2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),o.jsx("path",{d:"M10.5 13.2v.3a1 1 0 0 1-1 1h-7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h.3",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}function lE({open:t}){return o.jsxs("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",focusable:"false",children:[o.jsx("path",{d:"M1.4 8S3.8 3.9 8 3.9 14.6 8 14.6 8 12.2 12.1 8 12.1 1.4 8 1.4 8z",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"}),o.jsx("circle",{cx:"8",cy:"8",r:"2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),!t&&o.jsx("path",{d:"M2.6 13.4L13.4 2.6",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}function aE(){return o.jsxs("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",focusable:"false",children:[o.jsx("rect",{x:"1.5",y:"10",width:"13",height:"4.5",rx:"1.2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),o.jsx("path",{d:"M8 1.5v6.2M5.4 5.3L8 7.9l2.6-2.6",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function cE(){return o.jsx("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",focusable:"false",children:o.jsx("path",{d:"M3 8.5l3.2 3.2L13 4.8",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function Ev({className:t,title:e,doneTitle:s,icon:l,onAction:u}){const[k,y]=M.useState(!1),i=M.useRef(null);M.useEffect(()=>()=>{i.current!==null&&window.clearTimeout(i.current)},[]);const c=m=>{m.stopPropagation(),u(),y(!0),i.current!==null&&window.clearTimeout(i.current),i.current=window.setTimeout(()=>y(!1),1200)};return o.jsx("button",{className:k?`${t} tree-action-done`:t,onClick:c,title:k?s:e,children:k?o.jsx(cE,{}):l})}function uE({className:t,title:e,onCopy:s}){return o.jsx(Ev,{className:t,title:e,doneTitle:_("common.copied"),icon:o.jsx(oE,{}),onAction:s})}function To({className:t,title:e,onInsert:s}){return o.jsx(Ev,{className:t,title:e,doneTitle:_("files.pathInserted"),icon:o.jsx(aE,{}),onAction:s})}function hE({view:t,cwd:e,platform:s,onInsert:l,onInsertPath:u,onReveal:k,docs:y}){const{listings:i,loading:c,refresh:m,query:v,setQuery:h,showHidden:b,toggleHidden:T}=t,N=Ao(),[w,d]=M.useState(null),g=s==="win32"?"\\":"/",p=M.useCallback(W=>{const K=W.split("/").join(g);return e.length===0?K:e.endsWith(g)?`${e}${K}`:`${e}${g}${K}`},[e,g]),f=M.useCallback(W=>{navigator.clipboard.writeText(W).catch(()=>{})},[]),E=M.useCallback(W=>u(`"${p(W)}"`),[p,u]),j=M.useCallback((W,K)=>{W.preventDefault(),W.stopPropagation(),d({x:W.clientX,y:W.clientY,items:[{label:_("files.menu.copyAbsolute"),onSelect:()=>f(p(K))},{label:_("files.menu.copyRelative"),onSelect:()=>f(K)},...l===void 0?[]:[{label:_("files.menu.insertMention"),onSelect:()=>l(`@${K}`)}],...k===null?[]:[{label:_("files.menu.openWithSystem"),onSelect:()=>k(K)}]]})},[p,f,l,k,N]),x=y.active===null?null:y.docs.find(W=>W.key===y.active)??null,R=x===null?void 0:y.content(x.key),S=x!==null&&R===void 0;M.useEffect(()=>{S&&x!==null&&y.reload(x.key)},[S,x==null?void 0:x.key]);const L=M.useCallback(W=>y.open({key:W,title:W.split("/").pop()??W}),[y]),I=M.useMemo(()=>({...t,openFile:L}),[t,L]),P=W=>{var Y;const K=(Y=y.content(W.key))==null?void 0:Y.loaded;return(K==null?void 0:K.kind)==="file"?`${W.key} · ${fn(K.preview.sizeBytes)}`:W.key},O=y.docs.length>0?o.jsx(kv,{listLabel:_("panel.tab.files"),docs:y.docs,active:y.active,tooltipOf:P,labelOf:W=>y.unsaved(W.key)?`${W.title} •`:W.title,onShowList:y.showList,onSelect:y.select,onClose:y.requestClose}):null;if(x!==null)return o.jsxs("div",{className:"panel-body",children:[O,o.jsx(xv,{doc:x,content:R,readingText:_("files.readingFile"),truncatedText:_("files.preview.truncated"),onReload:()=>y.reload(x.key),onModeChange:W=>y.setMode(x.key,W),onOpenWithSystem:k===null?null:()=>k(x.key),onInsert:()=>E(x.key),onOpenLink:L,initialScroll:y.scrollOf(x.key),onScrollChange:W=>y.rememberScroll(x.key,W),editor:y.editorFor(x.key),insertButton:o.jsx(To,{className:"icon-button",title:_("files.insertPath",{name:x.title}),onInsert:()=>E(x.key)})},x.key),w!==null&&o.jsx(eh,{x:w.x,y:w.y,items:w.items,onClose:()=>d(null)})]});const B=i.get(""),$=v.trim();return o.jsxs("div",{className:"panel-body",children:[O,o.jsxs("div",{className:"panel-subhead",children:[o.jsx("span",{className:"panel-subhead-title",title:e,children:e.split(/[\\/]/).filter(W=>W.length>0).pop()??e}),o.jsx(To,{className:"icon-button",title:_("files.insertFolderPath"),onInsert:()=>E("")}),o.jsx("button",{className:b?"icon-button icon-button-on":"icon-button",onClick:T,title:_(b?"files.hidden.hide":"files.hidden.show"),children:o.jsx(lE,{open:b})}),k!==null&&o.jsx("button",{className:"icon-button",onClick:()=>k(""),title:_("files.revealFolder"),children:o.jsx(Sh,{})}),o.jsx("button",{className:"icon-button",onClick:m,title:_("files.refresh"),children:"⟳"})]}),o.jsxs("div",{className:"tree-search",children:[o.jsx("input",{className:"tree-search-input",value:v,placeholder:_("files.search.placeholder"),onChange:W=>h(W.target.value),onKeyDown:W=>{W.key==="Escape"&&v.length>0&&(W.stopPropagation(),h(""))}}),v.length>0&&o.jsx("button",{className:"tree-search-clear",onClick:()=>h(""),title:_("files.search.clear"),children:"×"})]}),o.jsx("div",{className:"panel-scroll",children:$.length>0?o.jsx(dE,{view:I,onContextMenu:j,onReveal:k,onInsertPath:E}):B===void 0?o.jsx("p",{className:"panel-note",children:c.has("")?_("files.readingDir"):_("files.readDirFailed")}):o.jsx(Tv,{path:"",depth:0,view:I,onContextMenu:j,onReveal:k,onInsertPath:E})}),w!==null&&o.jsx(eh,{x:w.x,y:w.y,items:w.items,onClose:()=>d(null)})]})}function dE({view:t,onContextMenu:e,onReveal:s,onInsertPath:l}){const{results:u,searching:k,openFile:y,toggleDirectory:i}=t;return u===null?o.jsx("p",{className:"panel-note",children:_(k?"files.search.searching":"files.search.prompt")}):u.entries.length===0?o.jsx("p",{className:"panel-note",children:_("files.search.none")}):o.jsxs("ul",{className:"tree tree-results",children:[u.entries.map(c=>o.jsx("li",{children:o.jsxs("div",{className:"tree-item",children:[o.jsxs("button",{className:`tree-row tree-row-${c.kind}${c.hidden===void 0?"":" tree-row-hidden"}`,onClick:()=>c.kind==="dir"?i(c.path):y(c.path),onContextMenu:m=>e(m,c.path,c.kind),title:c.path,children:[o.jsx("span",{className:"tree-chevron",children:c.kind==="dir"?"›":""}),o.jsxs("span",{className:"tree-result",children:[o.jsx("span",{className:"tree-name",children:c.name}),o.jsx("span",{className:"tree-result-path",children:c.path})]}),c.kind==="file"&&o.jsx("span",{className:"tree-size",children:fn(c.sizeBytes)})]}),o.jsx(To,{className:"tree-action",title:_("files.insertPath",{name:c.name}),onInsert:()=>l(c.path)}),c.kind==="dir"&&s!==null&&o.jsx("button",{className:"tree-action",onClick:()=>s(c.path),title:_("files.reveal",{name:c.name}),children:o.jsx(Sh,{})})]})},c.path)),u.truncated&&o.jsx("li",{className:"tree-hidden",title:_("files.search.moreTitle"),children:_("files.search.more")})]})}function Tv({path:t,depth:e,view:s,onContextMenu:l,onReveal:u,onInsertPath:k}){const{listings:y,loading:i}=s,c=y.get(t);return c===void 0?i.has(t)?o.jsx("div",{className:"tree-loading",children:_("files.loading")}):null:o.jsxs("ul",{className:"tree",children:[c.entries.map(m=>o.jsx(fE,{entry:m,depth:e,view:s,onContextMenu:l,onReveal:u,onInsertPath:k},m.path)),c.entries.length===0&&o.jsx("li",{className:"tree-empty",style:{paddingLeft:`${e*12+8}px`},children:c.hiddenCount>0?_("files.allHidden"):_("files.empty")}),(c.truncated||c.hiddenCount>0)&&c.entries.length>0&&o.jsx("li",{className:"tree-hidden",style:{paddingLeft:`${e*12+8}px`},title:_("files.hiddenTitle"),children:c.truncated?_("files.moreEntries"):_("files.hiddenCount",{count:c.hiddenCount})})]})}function fE({entry:t,depth:e,view:s,onContextMenu:l,onReveal:u,onInsertPath:k}){const{expanded:y,toggleDirectory:i,openFile:c}=s,m=t.kind==="dir"&&y.has(t.path);return o.jsxs("li",{children:[o.jsxs("div",{className:"tree-item",children:[o.jsxs("button",{className:`tree-row tree-row-${t.kind}${t.hidden===void 0?"":" tree-row-hidden"}`,style:{paddingLeft:`${e*12+6}px`},onClick:()=>t.kind==="dir"?i(t.path):c(t.path),onContextMenu:v=>l(v,t.path,t.kind),title:t.hidden===void 0?t.path:`${t.path}
|
|
141
|
+
${t.hidden==="ignored"?_("files.row.ignored"):_("files.row.alwaysHidden")}`,children:[o.jsx("span",{className:`tree-chevron${m?" tree-chevron-open":""}`,children:t.kind==="dir"?"›":""}),o.jsx("span",{className:"tree-name",children:t.name}),t.kind==="file"&&o.jsx("span",{className:"tree-size",children:fn(t.sizeBytes)})]}),o.jsx(To,{className:"tree-action",title:_("files.insertPath",{name:t.name}),onInsert:()=>k(t.path)}),t.kind==="dir"&&u!==null&&o.jsx("button",{className:"tree-action",onClick:()=>u(t.path),title:_("files.reveal",{name:t.name}),children:o.jsx(Sh,{})})]}),m&&o.jsx(Tv,{path:t.path,depth:e+1,view:s,onContextMenu:l,onReveal:u,onInsertPath:k})]})}const Lv={added:"A",modified:"M",deleted:"D",renamed:"R",copied:"C","type-changed":"T",untracked:"?",conflict:"!"},Nv={added:"git.kind.added",modified:"git.kind.modified",deleted:"git.kind.deleted",renamed:"git.kind.renamed",copied:"git.kind.copied","type-changed":"git.kind.typeChanged",untracked:"git.kind.untracked",conflict:"git.kind.conflict"};function fa(t){const e=t.endsWith("/"),s=e?t.slice(0,-1):t,l=s.lastIndexOf("/"),u=l===-1?s:s.slice(l+1);return{dir:l===-1?"":s.slice(0,l+1),name:e?`${u}/`:u,isDirectory:e}}function pE({view:t,onBack:e,onOpenDiff:s,onCloseDiff:l,onRequestReview:u}){const{state:k}=t;if(t.diff!==null){const i=t.diff;return o.jsxs("div",{className:"panel-body",children:[o.jsxs("div",{className:"panel-subhead",children:[o.jsxs("button",{className:"link-button",onClick:l,children:["← ",t.branch]}),o.jsx("span",{className:"panel-subhead-title",title:i.path,children:fa(i.path).name})]}),i.message!==null?o.jsx("p",{className:"panel-note",children:i.message}):i.diff===null?o.jsx("p",{className:"panel-note",children:_("git.readingDiff")}):o.jsx(Cv,{diff:i.diff})]})}const y=k.phase==="ready"?k.changes:null;return o.jsxs("div",{className:"panel-body",children:[o.jsxs("div",{className:"panel-subhead",children:[o.jsxs("button",{className:"link-button",onClick:e,children:["← ",_("git.backToChanges")]}),o.jsx("span",{className:"panel-subhead-title",title:y===null?t.branch:_("worktree.changes.title",{branch:y.branch,base:y.base}),children:y===null?t.branch:_("worktree.changes.title",{branch:y.branch,base:y.base})}),u!==null&&y!==null&&y.commitCount>0&&o.jsx("button",{className:"link-button",onClick:u,title:_("worktree.actions.reviewTitle"),children:_("worktree.actions.review")})]}),o.jsxs("div",{className:"panel-scroll",children:[k.phase==="loading"&&o.jsx("p",{className:"panel-note",children:_("worktree.changes.loading")}),k.phase==="failed"&&o.jsx("p",{className:"panel-note",children:k.message}),y!==null&&o.jsxs(o.Fragment,{children:[y.uncommitted>0&&o.jsx("p",{className:"panel-note",children:_("worktree.changes.uncommitted",{count:y.uncommitted})}),y.commitCount===0&&y.files.length===0&&o.jsx("p",{className:"panel-note",children:_("worktree.changes.empty",{base:y.base})}),y.commits.length>0&&o.jsxs("section",{className:"git-group",children:[o.jsxs("h3",{className:"git-group-title",children:[_("worktree.changes.commits"),o.jsx("span",{className:"git-group-count",children:y.commitCount})]}),o.jsx("ul",{className:"git-list worktree-commits",children:y.commits.map(i=>o.jsxs("li",{className:"worktree-commit",title:`${wh(i.at)} ${Ri(i.at)}`,children:[o.jsx("span",{className:"worktree-commit-sha",children:i.sha}),o.jsx("span",{className:"worktree-commit-subject",children:i.subject}),o.jsx("span",{className:"worktree-commit-when",children:Wn(i.at)})]},i.sha))}),y.commitCount>y.commits.length&&o.jsx("p",{className:"panel-note",children:_("worktree.changes.more",{count:y.commitCount-y.commits.length})})]}),y.files.length>0&&o.jsxs("section",{className:"git-group",children:[o.jsxs("h3",{className:"git-group-title",children:[_("worktree.changes.files"),o.jsx("span",{className:"git-group-count",children:y.fileCount})]}),o.jsx("ul",{className:"git-list",children:y.files.map(i=>{const{dir:c,name:m}=fa(i.path);return o.jsx("li",{children:o.jsxs("button",{className:"git-item",onClick:()=>s(i.path),title:i.oldPath!==null?`${i.oldPath} → ${i.path}`:i.path,children:[o.jsx("span",{className:`git-badge git-badge-${i.kind}`,title:_(Nv[i.kind]),children:Lv[i.kind]}),o.jsxs("span",{className:"git-path",children:[o.jsx("span",{className:"git-path-name",children:m}),c.length>0&&o.jsx("span",{className:"git-path-dir",children:c})]})]})},i.path)})}),y.fileCount>y.files.length&&o.jsx("p",{className:"panel-note",children:_("worktree.changes.more",{count:y.fileCount-y.files.length})})]})]})]})]})}function Rv(t,e,s){const l=t.worktree;if(l===null||l.branch===null)return null;if(l.linked)return l.branch;const u=pr(l.mainCwd,s);return e.some(y=>{var i;return y.terminalId!==t.terminalId&&((i=y.worktree)==null?void 0:i.linked)===!0&&pr(y.worktree.mainCwd,s)===u})?l.branch:null}function mE(t,e){const s=t.worktree;return s===null||e===null?null:s.linked?_("worktree.tab.linkedTitle",{branch:e,main:s.mainCwd}):_("worktree.tab.mainTitle",{branch:e})}function Fs(t){return Hu(t)}const gE={empty:"worktree.branch.empty","too-long":"worktree.branch.tooLong",characters:"worktree.branch.characters","starts-with-dash":"worktree.branch.startsWithDash",slashes:"worktree.branch.slashes",dots:"worktree.branch.dots",lock:"worktree.branch.lock",reserved:"worktree.branch.reserved"};function vE(t){return _(gE[t])}function _E(t,e,s,l){if(e.length===0)return null;const u=Uw(e);if(u!==null)return vE(u);const k=t.branches.find(y=>y.name===e);return s==="new"&&k!==void 0?_("worktree.create.branchExists"):s==="existing"&&(k==null?void 0:k.checkedOut)===!0?_("worktree.create.branchInUse"):t.branches.some(y=>y.name===l)?null:_("worktree.create.baseMissing")}function Mv(t,e){return`${t.parentDir}${t.separator}${Gm(e)}`}const wE=t=>/[\s"]/.test(t)?`"${t}"`:t;function yE(t,e,s,l){const u=wE(Mv(t,e));return l==="new"?`git worktree add -b ${e} ${u} ${s}`:`git worktree add ${u} ${e}`}function ea(t){return _("worktree.copy.summary",{count:t.files,size:fn(t.bytes)})}function bE(t){const e=[];return t.changes!==null&&t.changes>0&&e.push(_("worktree.rows.changes",{count:t.changes})),t.ahead!==null&&t.ahead>0&&e.push(_("worktree.rows.ahead",{count:t.ahead})),t.integrated===!0&&e.push(_("worktree.rows.integrated")),e.length===0&&t.changes===0&&e.push(_("worktree.rows.clean")),e}function kE(t){return[...t].sort((e,s)=>e.isMain!==s.isMain?e.isMain?-1:1:(e.branch??e.path).localeCompare(s.branch??s.path))}function am(t,e){const s=pn(t.map(l=>l.split("/").pop()??l));return e>t.length?`${s}…`:s}function CE(t){var s,l;const e=[];if(t.behind!==null&&t.behind>0&&t.base!==null){const u=[_("worktree.rows.behind",{base:t.base,count:t.behind})];((s=t.merge)==null?void 0:s.state)==="clean"&&u.push(_("worktree.rows.mergeClean")),((l=t.merge)==null?void 0:l.state)==="conflicts"&&u.push(_("worktree.rows.mergeConflicts",{count:t.merge.fileCount,list:am(t.merge.files,t.merge.fileCount)})),e.push(u.join(" · "))}for(const u of t.overlaps)e.push(_("worktree.rows.overlap",{branch:u.branch,list:am(u.files,u.fileCount)}));return e}const cm={working:"worktree.review.stateWorking",pending:"worktree.review.statePending",ready:"worktree.review.stateReady",changes:"worktree.review.stateChanges",none:"worktree.review.stateNone"};function Av(t,e){const s=t.state==="done"?cm[t.verdict??"none"]:cm[t.state],l=_(s,{agent:e});return t.stale?_("worktree.review.stale",{text:l}):l}function SE(t){return t!==null&&t.state==="done"}function xE(t){const e=t.id!==null&&!t.isMain&&t.behind!==null,s=(t.ahead??0)>0;return{viewChanges:e&&s,review:e&&(s||(t.changes??0)>0),sendReview:e&&SE(t.review),catchUp:e&&t.base!==null&&(t.behind??0)>0,integrate:e&&t.base!==null&&s}}function EE(t){return t.base===null?null:t.ahead===0?_("worktree.integrate.blockerNothing",{base:t.base}):t.behind!==null&&t.behind>0?_("worktree.integrate.blockerBehind",{base:t.base}):null}function TE(t){switch(t.blocker){case"nothing":return _("worktree.integrate.blockerNothing",{base:t.base});case"behind":return _("worktree.integrate.blockerBehind",{base:t.base});case"no-base-folder":return _("worktree.integrate.blockerNoBase",{base:t.base});case"local-changes":return _("worktree.integrate.blockerLocal",{base:t.base,count:t.localConflicts.length,list:pn(t.localConflicts)});case null:return null}}function LE(t,e){var l;const s=((l=t.readOnlyLaunch)==null?void 0:l.guard)??null;return s==="cli"?_("worktree.review.guardCli",{agent:e}):s==="tools"?_("worktree.review.guardTools",{agent:e}):_("worktree.review.guardNone",{agent:e})}function NE(t){return t.filter(e=>e.available).map(e=>{var s;return{id:e.id,guard:((s=e.capabilities.readOnlyLaunch)==null?void 0:s.guard)??null}})}function RE(t){return t.ahead===null?null:t.ahead===0?_("worktree.rows.integrated"):_("worktree.rows.notIntegrated",{count:t.ahead})}function ME(t){switch(t.blocker){case"checked-out":return _("worktree.deleteBranch.checkedOut",{branch:t.branch});case"not-integrated":return t.ahead===null?_("worktree.deleteBranch.noBase",{base:t.base}):_("worktree.deleteBranch.notIntegrated",{count:t.ahead,base:t.base});case null:return null}}function Io(t,e){var s;return((s=t.untracked)==null?void 0:s.stamp)!=null&&e!==null&&t.untracked.stamp===e}function AE(t,e=null){return t.uncommittedCount>0&&!Io(t,e)?"uncommitted":t.inUse===!0?"in-use":t.conflicts.length>0?"conflicts":null}function Iv(t,e=null){switch(AE(t,e)){case"uncommitted":return"ask-commit";case"in-use":return"retry";case"conflicts":return"ask-notes";case null:return"remove"}}function IE(t,e){var s;return t.uncommittedCount>0&&((s=t.untracked)==null?void 0:s.stamp)!=null&&!Io(t,e)}const jE={"nested-repo":"worktree.remove.untrackedNestedRepo","too-many":"worktree.remove.untrackedTooMany",copied:"worktree.remove.untrackedCopied"};function DE(t,e){const s=t.untracked;return t.uncommittedCount===0||s===null?null:s.blocked!==null?_(jE[s.blocked],{max:zw}):Io(t,e)?_("worktree.remove.untrackedAccepted"):_("worktree.remove.untracked",{count:s.files,size:fn(s.bytes)})}function PE(t){if(t.holders.length===0)return _("worktree.remove.inUse");const e=[];for(const l of t.holders){const u=l.name.toLowerCase().replace(/\.exe$/,""),k=l.description!==null&&l.description.toLowerCase()!==u?l.description:null,y=e.find(i=>i.exe.toLowerCase()===l.name.toLowerCase()&&i.program===k);y!==void 0?y.pids.push(l.pid):e.push({exe:l.name,program:k,pids:[l.pid]})}const s=pn(e.map(({exe:l,program:u,pids:k})=>{const y={exe:l,pids:pn(k.map(String))};return u===null?_("worktree.remove.holderExe",y):_("worktree.remove.holder",{...y,program:u})}));return _("worktree.remove.inUseBy",{count:e.length,list:s})}function OE(t){return`${pn(t.uncommitted)}${t.uncommittedCount>t.uncommitted.length?"…":""}`}function BE(t){const{branch:e}=t;return t.deletesBranch?t.branchUnused?_("worktree.remove.deletesUnusedBranch",{branch:e}):_("worktree.remove.deletesBranch",{branch:e}):t.createdBranch?_("worktree.remove.keepsBranch",{branch:e}):_("worktree.remove.keepsExistingBranch",{branch:e})}const FE=[{stage:"conflict",title:"git.group.conflict",hint:"git.group.conflictHint"},{stage:"staged",title:"git.group.staged",hint:"git.group.stagedHint"},{stage:"unstaged",title:"git.group.unstaged",hint:"git.group.unstagedHint"},{stage:"untracked",title:"git.group.untracked",hint:"git.group.untrackedHint"}];function HE({status:t}){return o.jsxs("div",{className:"git-headline",children:[o.jsx("span",{className:"git-branch",title:t.repoRoot,children:t.branch??(t.head!==null?_("git.detachedAt",{head:t.head}):_("git.detached"))}),t.upstream!==null&&o.jsx("span",{className:"git-upstream",title:_("git.upstreamTitle",{upstream:t.upstream}),children:t.upstream}),(t.ahead>0||t.behind>0)&&o.jsxs("span",{className:"git-ab",title:_("git.aheadBehindTitle"),children:[t.ahead>0&&o.jsxs("span",{className:"git-ahead",children:["↑",t.ahead]}),t.behind>0&&o.jsxs("span",{className:"git-behind",children:["↓",t.behind]})]})]})}function UE(t){const e=t.review;return e===null||e.state!=="done"||e.stale?"":e.verdict==="ready"?" git-worktree-review-ready":e.verdict==="changes"?" git-worktree-review-changes":""}function $E({row:t,worktrees:e}){const s=bE(t),l=CE(t),u=t.id,k=u!==null&&!t.isMain?{...t,id:u}:null,y=xE(t),i=EE(t),c=t.review;return o.jsx("li",{children:o.jsxs("div",{className:"git-worktree",title:t.path,children:[o.jsxs("span",{className:"git-worktree-branch",children:[t.branch??_("git.worktrees.detached"),t.isMain&&o.jsx("span",{className:"git-worktree-main",children:_("worktree.rows.main")}),t.isCurrent&&o.jsx("span",{className:"git-worktree-main",children:_("worktree.rows.current")})]}),s.length>0&&o.jsx("span",{className:"git-worktree-state",children:s.join(" · ")}),l.map(m=>o.jsx("span",{className:"git-worktree-team",children:m},m)),c!==null&&o.jsxs("span",{className:`git-worktree-review${UE(t)}`,children:[Av(c,e.agentLabel(c.agent)),c.terminalId!==null&&o.jsx("button",{className:"link-button",onClick:()=>{c.terminalId!==null&&e.onShowReviewer(c.terminalId)},title:_("worktree.actions.showReviewerTitle"),children:_("worktree.actions.showReviewer")})]}),o.jsx("span",{className:"git-worktree-path",children:t.path}),o.jsxs("span",{className:"git-worktree-actions",children:[!t.isCurrent&&o.jsx("button",{className:"link-button",onClick:()=>e.onOpen(t),title:_("worktree.rows.openTitle"),children:_("worktree.rows.open")}),k!==null&&y.viewChanges&&o.jsx("button",{className:"link-button",onClick:()=>e.onViewChanges(k),title:_("worktree.actions.viewChangesTitle"),children:_("worktree.actions.viewChanges")}),k!==null&&y.review&&o.jsx("button",{className:"link-button",onClick:()=>e.onRequestReview(k),title:_("worktree.actions.reviewTitle"),children:_("worktree.actions.review")}),k!==null&&y.sendReview&&o.jsx("button",{className:"link-button",onClick:()=>e.onSendReview(k),title:_("worktree.actions.sendReviewTitle"),children:_("worktree.actions.sendReview")}),k!==null&&y.catchUp&&t.base!==null&&o.jsx("button",{className:"link-button",onClick:()=>e.onCatchUp(k),title:_("worktree.actions.catchUpTitle",{base:t.base}),children:_("worktree.actions.catchUp")}),k!==null&&y.integrate&&t.base!==null&&o.jsx("button",{className:"link-button",onClick:()=>e.onIntegrate(k),disabled:i!==null,title:i??_("worktree.actions.integrateTitle",{base:t.base}),children:_("worktree.actions.integrate",{base:t.base})}),k!==null&&o.jsx("button",{className:"link-button",onClick:()=>e.onRemove(k),title:_("worktree.rows.removeTitle"),children:_("worktree.rows.remove")})]})]})})}function WE({kept:t,worktrees:e}){const s=RE(t);return o.jsx("li",{children:o.jsxs("div",{className:"git-worktree",title:_("worktree.rows.keptTitle"),children:[o.jsxs("span",{className:"git-worktree-branch",children:[t.branch,o.jsx("span",{className:"git-worktree-main",children:_("worktree.rows.kept")})]}),s!==null&&o.jsx("span",{className:"git-worktree-state",children:s}),o.jsx("span",{className:"git-worktree-actions",children:o.jsx("button",{className:"link-button",onClick:()=>e.onDeleteBranch(t),title:_("worktree.rows.deleteBranchTitle"),children:_("worktree.rows.deleteBranch")})})]})})}function zE({view:t,worktrees:e}){const{status:s,diff:l,loadingDiff:u,openDiff:k,closeDiff:y,refresh:i}=t;if(e.changes!==null){const v=e.changes,h=e.rows.find(b=>b.id===v.worktreeId)??null;return o.jsx(pE,{view:v,onBack:e.onCloseChanges,onOpenDiff:e.onOpenChangeDiff,onCloseDiff:e.onCloseChangeDiff,onRequestReview:h===null||h.id===null?null:()=>e.onRequestReview({...h,id:v.worktreeId})})}if(l!==null||u)return o.jsxs("div",{className:"panel-body",children:[o.jsxs("div",{className:"panel-subhead",children:[o.jsxs("button",{className:"link-button",onClick:y,children:["← ",_("git.backToChanges")]}),l!==null&&o.jsxs("span",{className:"panel-subhead-title",title:l.path,children:[fa(l.path).name,l.staged&&o.jsxs("span",{className:"panel-tagline",children:[" ",_("git.stagedTag")]})]})]}),u?o.jsx("p",{className:"panel-note",children:_("git.readingDiff")}):l!==null&&o.jsx(Cv,{diff:l})]});if(s.state!=="ready")return o.jsx("div",{className:"panel-body",children:o.jsx("p",{className:"panel-note",children:s.message===null?_("git.unknownState"):At(s.message)})});const c=kE(e.rows).filter(v=>!(v.isCurrent&&v.isMain)),m=c.some(v=>!v.isMain)||e.kept.length>0;return o.jsxs("div",{className:"panel-body",children:[o.jsxs("div",{className:"panel-subhead",children:[o.jsx(HE,{status:s}),o.jsx("button",{className:"icon-button",onClick:e.onNew,title:_("worktree.new"),"aria-label":_("worktree.new"),children:o.jsx(Zu,{})}),o.jsx("button",{className:"icon-button",onClick:i,title:_("git.refresh"),children:"⟳"})]}),o.jsxs("div",{className:"panel-scroll",children:[s.changes.length===0&&o.jsx("p",{className:"panel-note",children:_("git.clean")}),FE.map(v=>{const h=s.changes.filter(b=>b.stage===v.stage);return h.length===0?null:o.jsxs("section",{className:"git-group",children:[o.jsxs("h3",{className:"git-group-title",title:_(v.hint),children:[_(v.title),o.jsx("span",{className:"git-group-count",children:h.length})]}),o.jsx("ul",{className:"git-list",children:h.map(b=>{const{dir:T,name:N,isDirectory:w}=fa(b.path),d=b.oldPath!==null?`${b.oldPath} → ${b.path}`:w?_("git.newFolderTitle",{path:b.path}):b.path,g=o.jsxs(o.Fragment,{children:[o.jsx("span",{className:`git-badge git-badge-${b.kind}`,title:_(Nv[b.kind]),children:Lv[b.kind]}),o.jsxs("span",{className:"git-path",children:[o.jsx("span",{className:"git-path-name",children:N}),T.length>0&&o.jsx("span",{className:"git-path-dir",children:T})]})]});return o.jsx("li",{children:w?o.jsx("div",{className:"git-item git-item-static",title:d,children:g}):o.jsx("button",{className:"git-item",onClick:()=>k(b.path,b.stage==="staged"),title:d,children:g})},`${v.stage}:${b.path}`)})})]},v.stage)}),s.truncated&&o.jsx("p",{className:"panel-note",children:rn("git.truncated")}),m&&o.jsxs("section",{className:"git-group",children:[o.jsxs("h3",{className:"git-group-title",title:_("worktree.rows.headingTitle"),children:[_("worktree.rows.heading"),o.jsx("span",{className:"git-group-count",children:c.length+e.kept.length})]}),o.jsxs("ul",{className:"git-list",children:[c.map(v=>o.jsx($E,{row:v,worktrees:e},v.path)),e.kept.map(v=>o.jsx(WE,{kept:v,worktrees:e},v.id))]})]})]})]})}const qE={create:"memory.action.create","append-block":"memory.action.appendBlock","replace-block":"memory.action.replaceBlock","append-lines":"memory.action.appendLines",copy:"memory.action.copy"},VE={"AGENTS.md":["Codex","Antigravity","OpenCode","Pi"],"CLAUDE.md":["Claude Code"]};function _a(t){return t.brokenBlock||t.problem!==null}function KE(t){return t.problem==="outside"?_("memory.problem.outside"):t.problem==="encoding"?_("memory.problem.encoding"):t.brokenBlock?_("memory.problem.brokenBlock"):null}function GE(t){const e=t.files.filter(s=>!_a(s));return t.installed?{instructionFiles:e.filter(s=>s.hasBlock||s.exists).map(s=>s.name),gitMode:t.git.kind==="error"||t.git.kind==="repo"&&!t.git.ignored?"version":"ignore",importNative:!1,copyFromMainWorktree:!1}:{...iy(t),instructionFiles:e.map(s=>s.name)}}function YE(t){const e=t.files.filter(u=>u.hasBlock&&!u.blockCurrent),s=t.files.filter(u=>u.exists&&!u.hasBlock&&!_a(u)),l=u=>pn(u.map(k=>k.name));return e.length===0?s.length===0?null:_("memory.update.missing",{files:l(s)}):s.length===0?_("memory.update.outdated",{count:e.length,files:l(e)}):_("memory.update.outdatedAndMissing",{count:e.length,outdated:l(e),missing:l(s)})}function XE(t){const e=t.replace(/^\uFEFF/,"").replace(/\r\n/g,`
|
|
142
|
+
`),s=/^---\n[\s\S]*?\n---(?:\n|$)/.exec(e);return s===null?e:e.slice(s[0].length)}function QE(t){return t.split(/`([^`]+)`/).map((e,s)=>s%2===1?o.jsx("code",{children:e},s):e)}function JE({view:t}){var d;const{status:e,open:s,loading:l,error:u,closeNote:k,openNote:y}=t,[i,c]=M.useState(null),[m,v]=M.useState(!1),h=(e==null?void 0:e.cwd)??null;M.useEffect(()=>{c(null),v(!1)},[h]),M.useEffect(()=>{t.lastResult!==null&&(c(null),v(!1))},[t.lastResult]);const b=M.useCallback(g=>{if(e===null)return null;let p=g.replace(/^\.\//,"");try{p=decodeURIComponent(p)}catch{return null}return p===la||e.notes.some(E=>E.name===p)?()=>y(p):null},[e,y]);if(e===null)return o.jsx("div",{className:"panel-body",children:o.jsx("p",{className:"panel-note",children:u??_("memory.loading")})});if(s!==null||l!==null){const g=(s==null?void 0:s.name)??l??"",p=g===la?_("memory.index"):((d=e.notes.find(f=>f.name===g))==null?void 0:d.title)??g;return o.jsxs("div",{className:"panel-body",children:[o.jsxs("div",{className:"panel-subhead",children:[o.jsx("button",{className:"link-button",onClick:k,children:_("memory.back")}),o.jsx("span",{className:"panel-subhead-title",title:g,children:p})]}),s===null?o.jsx("p",{className:"panel-note",children:_("memory.note.loading")}):o.jsxs("div",{className:"panel-scroll",children:[o.jsx("div",{className:"plan-body",children:o.jsx(bh,{text:XE(s.text),localLink:b})}),s.truncated&&o.jsx("p",{className:"panel-note",children:_("memory.note.truncated")})]})]})}const T=i??GE(e),N=e.installed?YE(e):null,w=!e.installed||m||t.planned!==null;return o.jsxs("div",{className:"panel-body",children:[o.jsx(ZE,{reach:e.reach,onAdjust:e.installed&&!w&&N===null&&e.reach.some(g=>!g.reaches)?()=>v(!0):null}),o.jsxs("div",{className:"panel-scroll",children:[(u??t.lastResult)!==null&&o.jsxs("div",{className:`memory-message${u!==null?" memory-message-error":""}`,children:[o.jsx("span",{children:u??t.lastResult}),o.jsx("button",{className:"link-button",onClick:t.dismissMessage,title:_("common.dismissNotice"),children:"×"})]}),e.git.kind==="error"&&o.jsxs("div",{className:"memory-warning",children:[o.jsx("p",{className:"memory-warning-line",children:rn("memory.git.errorWarning")}),o.jsx("pre",{className:"memory-git-message",children:At(e.git.message)})]}),e.files.filter(_a).map(g=>o.jsx("p",{className:"memory-warning",children:g.problem==="outside"?rn("memory.problem.outsideWarning",{file:g.name}):g.problem==="encoding"?rn("memory.problem.encodingWarning",{file:g.name}):rn("memory.problem.brokenBlockWarning",{file:g.name})},g.name)),!e.installed&&o.jsxs("div",{className:"memory-intro",children:[o.jsx("p",{children:_("memory.intro.what")}),o.jsx("p",{children:rn("memory.intro.where")})]}),e.installed&&N!==null&&!w&&o.jsxs("div",{className:"memory-callout",children:[o.jsx("span",{children:N}),o.jsx("button",{className:"primary-button primary-button-small",onClick:()=>v(!0),children:_("memory.update.button")})]}),w&&(t.planned===null?o.jsx(eT,{status:e,options:T,busy:t.busy,onChange:c,onPlan:()=>{c(T),t.requestPlan(T)},onCancel:e.installed?()=>{v(!1),c(null)}:null}):o.jsx(tT,{changes:t.planned,busy:t.busy,confirmLabel:e.installed?_("memory.plan.update"):_("memory.plan.install"),onConfirm:t.install,onCancel:t.cancelPlan})),e.installed&&e.native.pending>0&&!w&&o.jsxs("div",{className:"memory-callout",children:[o.jsx("span",{children:_("memory.native.pending",{count:e.native.pending})}),o.jsx("button",{className:"primary-button primary-button-small",disabled:t.busy!==null,onClick:t.importNative,children:t.busy==="import"?_("memory.native.importing"):_("memory.native.import",{count:e.native.pending})})]}),e.installed&&o.jsx(nT,{notes:e.notes,indexExists:e.indexExists,onOpen:y}),e.globalFragments.length>0&&o.jsx(rT,{fragments:e.globalFragments})]})]})}function ZE({reach:t,onAdjust:e}){return o.jsxs("div",{className:"memory-reach",children:[t.map(s=>o.jsxs("span",{className:`memory-reach-item${s.reaches?" memory-reach-on":""}`,title:_("memory.reach.title",{label:s.label,via:At(s.via)}),children:[o.jsx("span",{className:"memory-reach-mark","aria-hidden":"true",children:s.reaches?"✓":"—"}),s.label,o.jsx("span",{className:"visually-hidden",children:s.reaches?_("memory.reach.reaches",{via:At(s.via)}):_("memory.reach.doesNotReach",{via:At(s.via)})})]},s.agent)),e!==null&&o.jsx("button",{className:"link-button memory-reach-adjust",onClick:e,title:_("memory.reach.adjustTitle"),children:_("memory.reach.adjust")})]})}function eT({status:t,options:e,busy:s,onChange:l,onPlan:u,onCancel:k}){const{git:y}=t,i=y.kind==="repo"?y.worktree:null,c=y.kind==="error"&&e.gitMode==="ignore",m=(v,h)=>{const b=new Set(e.instructionFiles);h?b.add(v):b.delete(v),l({...e,instructionFiles:ph.filter(T=>b.has(T))})};return o.jsxs("div",{className:"memory-form",children:[o.jsx("p",{className:"memory-section-label",children:_("memory.form.files")}),t.files.map(v=>o.jsxs("label",{className:"memory-option",title:KE(v)??void 0,children:[o.jsx("input",{type:"checkbox",checked:e.instructionFiles.includes(v.name),disabled:_a(v),onChange:h=>m(v.name,h.target.checked)}),o.jsx("code",{children:v.name}),o.jsx("span",{className:"memory-option-hint",children:pn(VE[v.name])})]},v.name)),y.kind==="repo"&&o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"memory-section-label",children:"Git"}),o.jsxs("label",{className:"memory-option",children:[o.jsx("input",{type:"radio",name:"memory-git-mode",checked:e.gitMode==="ignore",onChange:()=>l({...e,gitMode:"ignore"})}),_("memory.git.ignore"),o.jsx("span",{className:"memory-option-hint",children:_("memory.git.ignoreHint")})]}),o.jsxs("label",{className:"memory-option",children:[o.jsx("input",{type:"radio",name:"memory-git-mode",checked:e.gitMode==="version",onChange:()=>l({...e,gitMode:"version"})}),_("memory.git.version"),o.jsx("span",{className:"memory-option-hint",children:_("memory.git.versionHint")})]}),y.ignored&&e.gitMode==="version"&&o.jsx("p",{className:"memory-warning",children:rn("memory.git.alreadyIgnored")})]}),y.kind==="error"&&o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"memory-section-label",children:"Git"}),o.jsxs("label",{className:"memory-option",children:[o.jsx("input",{type:"radio",name:"memory-git-mode",checked:e.gitMode==="version",onChange:()=>l({...e,gitMode:"version"})}),rn("memory.git.dontTouch"),o.jsx("span",{className:"memory-option-hint",children:_("memory.git.errorHint")})]})]}),(t.native.pending>0||(i==null?void 0:i.mainHasMemory)===!0)&&o.jsx("p",{className:"memory-section-label",children:_("memory.form.existingNotes")}),t.native.pending>0&&o.jsxs("label",{className:"memory-option",children:[o.jsx("input",{type:"checkbox",checked:e.importNative,onChange:v=>l({...e,importNative:v.target.checked})}),_("memory.form.importNative",{count:t.native.pending})]}),(i==null?void 0:i.mainHasMemory)===!0&&o.jsxs("label",{className:"memory-option",title:i.mainPath,children:[o.jsx("input",{type:"checkbox",checked:e.copyFromMainWorktree,onChange:v=>l({...e,copyFromMainWorktree:v.target.checked})}),_("memory.form.copyFromMain")]}),o.jsxs("div",{className:"memory-actions",children:[o.jsx("button",{className:"primary-button primary-button-small",disabled:s!==null||e.instructionFiles.length===0||c,onClick:u,title:e.instructionFiles.length===0?_("memory.form.noFiles"):c?_("memory.git.blocked"):void 0,children:_(s==="plan"?"memory.form.planning":"memory.form.preview")}),k!==null&&o.jsx("button",{className:"link-button",onClick:k,disabled:s!==null,children:_("common.cancel")})]})]})}function tT({changes:t,busy:e,confirmLabel:s,onConfirm:l,onCancel:u}){const k=e==="install";return o.jsxs("div",{className:"memory-form",children:[o.jsx("p",{className:"memory-section-label",children:_("memory.plan.changes")}),t.length===0?o.jsx("p",{className:"memory-empty",children:_("memory.plan.nothing")}):o.jsx("ul",{className:"memory-change-list",children:t.map((y,i)=>o.jsxs("li",{className:"memory-change",children:[o.jsxs("div",{className:"memory-change-head",children:[o.jsx("code",{className:"memory-change-file",children:y.file}),o.jsx("span",{className:"memory-option-hint",children:_(qE[y.action])})]}),y.copiedFrom!==null&&o.jsx("p",{className:"memory-option-hint",children:_("memory.plan.copiedFrom",{path:y.copiedFrom})}),y.preview.length>0&&o.jsx("pre",{className:"memory-preview",children:y.preview})]},`${y.file}-${i}`))}),o.jsxs("div",{className:"memory-actions",children:[t.length>0&&o.jsx("button",{className:"primary-button primary-button-small",disabled:e!==null,onClick:l,children:k?_("memory.plan.writing"):s}),o.jsx("button",{className:"link-button",onClick:u,disabled:k,children:t.length===0?_("memory.plan.back"):_("common.cancel")})]})]})}function nT({notes:t,indexExists:e,onOpen:s}){return o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"memory-section-label",children:_("memory.list.notes")}),o.jsxs("ul",{className:"plan-list",children:[e&&o.jsx("li",{children:o.jsxs("button",{className:"plan-row",onClick:()=>s(la),children:[o.jsx("span",{className:"plan-name",children:_("memory.index")}),o.jsx("span",{className:"plan-meta",children:la})]})}),t.map(l=>o.jsx("li",{children:o.jsxs("button",{className:"plan-row",onClick:()=>s(l.name),title:l.name,children:[o.jsx("span",{className:"plan-name",children:l.title}),l.description.length>0&&o.jsx("span",{className:"memory-note-description",children:l.description}),o.jsxs("span",{className:"plan-meta",children:[Wn(l.modifiedAt)," · ",fn(l.sizeBytes)]})]})},l.name))]}),t.length===0&&o.jsx("p",{className:"memory-empty",children:_("memory.list.empty")})]})}function rT({fragments:t}){const e=M.useCallback(s=>{navigator.clipboard.writeText(s).catch(()=>{})},[]);return o.jsxs("details",{className:"memory-global",children:[o.jsx("summary",{className:"memory-global-summary",children:_("memory.global.title")}),o.jsx("p",{className:"memory-empty",children:rn("memory.global.intro")}),t.map(s=>o.jsxs("div",{className:"memory-fragment",children:[o.jsxs("div",{className:"memory-change-head",children:[o.jsx("span",{className:"memory-fragment-label",children:s.label}),o.jsx("code",{className:"memory-fragment-target",title:s.target,children:s.target})]}),o.jsxs("div",{className:"memory-fragment-body",children:[o.jsx("pre",{className:"memory-preview",children:s.text}),o.jsx(uE,{className:"icon-button",title:_("memory.global.copy"),onCopy:()=>e(s.text)})]}),o.jsx("p",{className:"memory-fragment-note",children:QE(At(s.note))})]},s.agent))]})}function sT(t){for(const e of t.split(`
|
|
143
|
+
`,40)){const s=/^#{1,3}\s+(.+)$/.exec(e.trim());if(s!==null)return(s[1]??"").trim()}return null}function iT({view:t,docs:e,onInsertPath:s}){const{plans:l}=t,u=e.active===null?null:e.docs.find(m=>m.key===e.active)??null,k=u===null?void 0:e.content(u.key),y=u!==null&&k===void 0&&t.listFor!==null&&t.listFor===e.terminalId;M.useEffect(()=>{y&&u!==null&&e.reload(u.key)},[y,u==null?void 0:u.key]);const i=m=>{var h;const v=(h=e.content(m.key))==null?void 0:h.loaded;return(v==null?void 0:v.kind)==="plan"?sT(v.plan.text)??m.title:m.title},c=m=>{var h;const v=((h=l.find(b=>b.fileName===m.key))==null?void 0:h.path)??"";return v.length>0?v:i(m)};return o.jsxs("div",{className:"panel-body",children:[e.docs.length>0&&o.jsx(kv,{listLabel:_("panel.tab.plans"),docs:e.docs,active:e.active,tooltipOf:c,labelOf:i,onShowList:e.showList,onSelect:e.select,onClose:e.close}),u!==null?o.jsx(xv,{doc:u,content:k,readingText:_("plans.loading"),truncatedText:_("plans.truncated"),onReload:()=>e.reload(u.key),onModeChange:m=>e.setMode(u.key,m),onOpenWithSystem:null,initialScroll:e.scrollOf(u.key),onScrollChange:m=>e.rememberScroll(u.key,m)},u.key):o.jsx("div",{className:"panel-scroll",children:l.length===0?o.jsx("p",{className:"panel-note",children:rn("plans.empty")}):o.jsx("ul",{className:"plan-list",children:[...l].reverse().map(m=>o.jsx(oT,{plan:m,onOpen:()=>e.open({key:m.fileName,title:m.title}),onInsertPath:s},m.fileName))})})]})}function oT({plan:t,onOpen:e,onInsertPath:s}){const l=t.path.length>0?t.path:null;return t.exists?o.jsxs("li",{className:"plan-item",children:[o.jsxs("button",{className:"plan-row",onClick:e,title:l??void 0,children:[o.jsx("span",{className:"plan-name",children:t.title}),l!==null&&o.jsx("span",{className:"plan-path",children:l}),o.jsxs("span",{className:"plan-meta",children:[Wn(t.modifiedAt)," · ",fn(t.sizeBytes)]})]}),t.absolutePath.length>0&&o.jsx(To,{className:"tree-action plan-action",title:_("files.insertPath",{name:t.absolutePath.split(/[\\/]/).pop()??t.title}),onInsert:()=>s(`"${t.absolutePath}"`)})]}):o.jsxs("li",{className:"plan-row plan-row-missing",title:l??_("plans.missingTitle"),children:[o.jsx("span",{className:"plan-name",children:t.title}),l!==null&&o.jsx("span",{className:"plan-path",children:l}),o.jsx("span",{className:"plan-meta",children:_("plans.missing")})]})}const lT=[{id:"cli",labelKey:"panel.tab.cli"},{id:"git",labelKey:"panel.tab.git"},{id:"files",labelKey:"panel.tab.files"},{id:"plans",labelKey:"panel.tab.plans"},{id:"memory",labelKey:"panel.tab.memory"}];function jv(t){return t.state!=="ready"?0:new Set(t.changes.map(e=>e.path)).size}function aT({tab:t,plansAvailable:e,hiddenTabs:s,hidden:l,onTabChange:u,title:k,cwd:y,colorCwd:i,platform:c,cli:m,cliUnseen:v,expanded:h,onToggleExpanded:b,git:T,worktrees:N,files:w,plans:d,documents:g,memory:p,onInsert:f,onInsertPath:E,onReveal:j,onHide:x}){var L;const R=jv(T.status),S=((L=p.status)==null?void 0:L.installed)===!0?p.status.notes.length:0;return o.jsxs("section",{className:`side-panel${l?" side-panel-hidden":""}`,"aria-hidden":l,children:[o.jsxs("header",{className:"side-panel-header",children:[o.jsx("button",{className:"icon-button",onClick:x,title:_("panel.hide"),children:"»"}),y.length>0&&o.jsx("span",{className:"project-swatch",style:{background:Us(i)}}),o.jsx("span",{className:"side-panel-title",title:y,children:k}),o.jsx("button",{className:"icon-button",onClick:b,title:_(h?"panel.restoreWidth":"panel.widen"),children:h?"⇥":"⇤"})]}),o.jsx("nav",{className:"side-panel-tabs",children:Hb(lT,e,s).map(I=>o.jsxs("button",{className:`side-panel-tab${I.id===t?" side-panel-tab-active":""}`,onClick:()=>u(I.id),title:_(I.labelKey),children:[o.jsx("span",{className:"side-panel-tab-label",children:_(I.labelKey)}),I.id==="git"&&R>0&&o.jsx("span",{className:"side-panel-badge",children:R}),I.id==="plans"&&d.plans.length>0&&o.jsx("span",{className:"side-panel-badge",children:d.plans.length}),I.id==="memory"&&S>0&&o.jsx("span",{className:"side-panel-badge",children:S}),I.id==="cli"&&v&&t!=="cli"&&o.jsx("span",{className:"side-panel-dot",title:_("panel.cliUnseen")})]},I.id))}),o.jsxs("div",{className:"side-panel-body",children:[o.jsx("div",{className:`cli-slot${t==="cli"?"":" cli-slot-hidden"}`,children:m}),t==="git"&&o.jsx(zE,{view:T,worktrees:N}),t==="plans"&&o.jsx(iT,{view:d,docs:g.plans,onInsertPath:E}),t==="memory"&&o.jsx(JE,{view:p}),t==="files"&&o.jsx(hE,{view:w,cwd:y,platform:c,onInsert:f,onInsertPath:E,onReveal:j,docs:g.files})]})]})}function cT(t,e,s,l=null){const u=e===void 0||e.length===0?t:`${t} — ${e}`;return l===null?`${u}
|
|
144
|
+
${s}`:`${u}
|
|
145
|
+
${l}
|
|
146
|
+
${s}`}function uT(t,e){const s=[mE(t,e),t.review?_("worktree.tab.reviewTitle"):null].filter(l=>l!==null);return s.length===0?null:s.join(`
|
|
147
|
+
`)}function hT({placement:t}){return o.jsxs("div",{className:"tab tab-pending","aria-busy":"true",title:`${t.pending.cwd}
|
|
148
|
+
${_("tabs.state.opening")}`,style:{"--tab-project-color":Us(t.pending.cwd)},children:[o.jsx("span",{className:"tab-opening","aria-label":_("tabs.aria.opening"),children:o.jsx("i",{})}),o.jsx("span",{className:"tab-label",children:t.label})]})}function xh({terminal:t,activity:e,statusLine:s}){if(!t.alive){const l=t.sleeping;return o.jsx("span",{className:`tab-dot${l?" tab-dot-sleeping":" tab-dot-dead"}`,title:_(l?"tabs.dot.sleeping":"tabs.dot.exited")})}return e==="waiting"?o.jsx("span",{className:"tab-bang",title:_("tabs.dot.waiting"),children:"!"}):e==="busy"?o.jsxs("span",{className:"tab-working",title:_("tabs.dot.busy"),"aria-label":_("tabs.aria.working"),children:[o.jsx("i",{}),o.jsx("i",{}),o.jsx("i",{})]}):o.jsx("span",{className:"tab-dot",title:Qb(e,s)})}function Lo(t){var u;if(t.label.length>0)return t.label;const e=((u=t.worktree)==null?void 0:u.linked)===!0?t.worktree.mainCwd:t.cwd,s=e.split(/[\\/]/).filter(k=>k.length>0),l=s[s.length-1]??e;return t.resumed?`${l} ↩`:l}function dT(t){return t.alive?_("tabs.state.alive"):t.sleeping?_("tabs.state.sleeping"):_("tabs.state.exited",{code:t.exitCode??"?"})}function fT({terminals:t,activeTerminalId:e,activity:s,attention:l,canOpen:u,onSelect:k,onClose:y,onRename:i,onReorder:c,onNew:m,agents:v,offerAgentChoice:h,newTabAgent:b,pendingOpens:T,platform:N,newTabBlockedTitle:w,sessionTitles:d}){const[g,p]=M.useState(null),[f,E]=M.useState(""),[j,x]=M.useState(null),R=M.useRef(null);M.useEffect(()=>{var $;g!==null&&(($=R.current)==null||$.select())},[g]);const S=$=>{p($.terminalId),E($.label.length>0?$.label:Lo($))},L=()=>{g!==null&&i(g,f.trim()),p(null)},I=$=>{if(j===null||j===$)return;const W=t.map(V=>V.terminalId),K=W.indexOf(j),Y=W.indexOf($);K===-1||Y===-1||(W.splice(Y,0,...W.splice(K,1)),c(W),x(null))},P=Sk(t,T,N),O=new Map;for(const $ of P){const W=O.get($.index);W===void 0?O.set($.index,[$]):W.push($)}const B=$=>(O.get($)??[]).map(W=>o.jsx(hT,{placement:W},`pending:${W.pending.requestId}`));return o.jsxs("div",{className:"tab-bar",children:[t.map(($,W)=>{var F;const K=$.terminalId===e,Y=$.terminalId===g,V=Rv($,t,N);return o.jsxs(uw.Fragment,{children:[B(W),o.jsx("div",{className:`tab${K?" tab-active":""}${$.alive||$.sleeping?"":" tab-dead"}${(l==null?void 0:l.has($.terminalId))===!0?" tab-attention":""}`,draggable:!Y,onDragStart:()=>x($.terminalId),onDragOver:H=>H.preventDefault(),onDrop:()=>I($.terminalId),onDragEnd:()=>x(null),onClick:()=>k($.terminalId),onDoubleClick:()=>S($),title:cT($.cwd,d.get($.terminalId),dT($),uT($,V)),style:{"--tab-project-color":Us(Fs($))},children:Y?o.jsx("input",{ref:R,className:"tab-input",value:f,onChange:H=>E(H.target.value),onBlur:L,onKeyDown:H=>{H.key==="Enter"&&L(),H.key==="Escape"&&p(null),H.stopPropagation()},onClick:H=>H.stopPropagation()}):o.jsxs(o.Fragment,{children:[o.jsx(xh,{terminal:$,activity:s.get($.terminalId),statusLine:((F=v.find(H=>H.id===$.agent))==null?void 0:F.statusLine)??null}),o.jsxs("span",{className:"tab-label",children:[$.agent!==null&&hk(h,$.agent)&&o.jsx(Ju,{agent:$.agent,agents:v}),$.review&&o.jsx("span",{className:"tab-review",children:_("worktree.tab.review")}),V!==null&&o.jsx("span",{className:"tab-branch",children:V}),Lo($)]}),o.jsx("button",{className:"tab-close",onClick:H=>{H.stopPropagation(),y($.terminalId)},title:_("tabs.close"),children:"×"})]})})]},$.terminalId)}),B(t.length),o.jsx(kh,{className:"tab-new",text:"+",title:w??_("tabs.new"),disabled:!u||w!==null,offerAgentChoice:h,agents:v,agent:b,onOpen:m})]})}function pT(t,e,s){const[l,u]=M.useState(!1);return M.useEffect(()=>{if(u(!1),!(e===null||s))return t.onMessage(k=>{k.type==="terminal.output"&&k.terminalId===e&&u(!0)})},[t,e,s]),l&&!s}const mT=200,um="agent-workbench.files.hidden";function gT(t,e){const[s,l]=M.useState(new Map),[u,k]=M.useState(new Set),[y,i]=M.useState(new Set),[c,m]=M.useState(""),[v,h]=M.useState(null),[b,T]=M.useState(!1),[N,w]=M.useState(()=>Nt(um,!1,x=>x==="true"?!0:x==="false"?!1:null)),d=M.useRef(new Set),g=M.useRef(N);g.current=N;const p=M.useCallback(x=>{e===null||d.current.has(x)||(d.current.add(x),i(R=>new Set(R).add(x)),t.send({type:"files.list",terminalId:e,path:x,includeHidden:g.current}))},[t,e]);M.useEffect(()=>{if(l(new Map),k(new Set),i(new Set),m(""),h(null),T(!1),d.current=new Set,e===null)return;const x=t.onMessage(S=>{switch(S.type){case"files.listing":{if(S.terminalId!==e)break;const{listing:L}=S;d.current.delete(L.path),l(I=>new Map(I).set(L.path,L)),i(I=>{const P=new Set(I);return P.delete(L.path),P});break}case"files.results":if(S.terminalId!==e)break;h(S.result),T(!1);break;case"error":d.current=new Set,i(new Set),T(!1);break}});t.send({type:"files.list",terminalId:e,path:"",includeHidden:g.current}),d.current.add(""),i(new Set([""]));const R=t.onReopen(()=>{d.current=new Set,t.send({type:"files.list",terminalId:e,path:"",includeHidden:g.current})});return()=>{x(),R()}},[t,e]),M.useEffect(()=>{const x=c.trim();if(e===null||x.length===0){h(null),T(!1);return}T(!0);const R=window.setTimeout(()=>{t.send({type:"files.search",terminalId:e,query:x,includeHidden:g.current})},mT);return()=>window.clearTimeout(R)},[t,e,c,N]);const f=M.useCallback(x=>{k(R=>{const S=new Set(R);return S.has(x)?S.delete(x):(S.add(x),p(x)),S})},[p]),E=M.useCallback(()=>{if(e===null)return;d.current=new Set;const x=["",...u];for(const R of x)d.current.add(R),t.send({type:"files.list",terminalId:e,path:R,includeHidden:g.current});i(new Set(x))},[t,e,u]),j=M.useCallback(()=>{w(x=>{const R=!x;if(g.current=R,kt(um,String(R)),e!==null){d.current=new Set;const S=["",...u];for(const L of S)d.current.add(L),t.send({type:"files.list",terminalId:e,path:L,includeHidden:R});i(new Set(S))}return R})},[t,e,u]);return{listings:s,expanded:u,loading:y,query:c,setQuery:m,results:v,searching:b,showHidden:N,toggleHidden:j,toggleDirectory:f,refresh:E}}function vT(t){const[e,s]=M.useState(!1),[l,u]=M.useState(null),[k,y]=M.useState(null),[i,c]=M.useState(null),m=M.useRef(null);M.useEffect(()=>{const b=t.onMessage(N=>{switch(N.type){case"search.progress":if(m.current===null||N.searchId!==m.current)break;u(w=>ux(w,N.progress));break;case"search.results":if(m.current===null||N.searchId!==m.current)break;m.current=null,u(N.result),y(null),s(!1);break;case"error":if(N.code!=="search-failed"||m.current===null||N.requestId!==m.current)break;m.current=null,N.detail!==void 0&&console.error("[servidor]",N.detail),u(null),y(At(N.text)),s(!1);break}}),T=t.onReopen(()=>{m.current!==null&&(m.current=null,s(!1),y(_("searchHook.connectionLost")))});return()=>{b(),T()}},[t]);const v=M.useCallback((b,T)=>{const N=crypto.randomUUID();m.current=N,c({query:b,includeArchived:T}),s(!0),y(null),u(null),t.send({type:"search.global",searchId:N,query:b,includeArchived:T})},[t]),h=M.useCallback(()=>{const b=m.current;m.current=null,b!==null&&t.send({type:"search.cancel",searchId:b}),c(null),s(!1),u(null),y(null)},[t]);return{searching:e,result:l,error:k,submitted:i,search:v,clear:h}}function _T(t,e){const[s,l]=M.useState([]),[u,k]=M.useState(null);return M.useEffect(()=>{if(l([]),k(null),e!==null)return t.onMessage(y=>{switch(y.type){case"conversation.plans":if(y.terminalId!==e)break;l(y.plans),k(e);break}})},[t,e]),{plans:s,listFor:u}}const Dv=8,Pv=1024,wT=300,yT=["file","plan"],pa={docs:[],active:null,recent:[]},No={};function ma(t,e){return[...t.filter(s=>s!==e),e]}function bT(t,e,s=new Set){const l=t.docs.find(y=>y.key===e.key);if(l!==void 0)return{docs:l.title===e.title?t.docs:t.docs.map(i=>i.key===e.key?{...i,title:e.title}:i),active:e.key,recent:ma(t.recent,e.key)};let u=[...t.docs,{key:e.key,title:e.title}],k=ma(t.recent,e.key);for(;u.length>Dv;){const y=k.find(i=>i!==e.key&&!s.has(i));if(y===void 0)break;u=u.filter(i=>i.key!==y),k=k.filter(i=>i!==y)}return{docs:u,active:e.key,recent:k}}function hm(t,e){return t.docs.some(s=>s.key===e)?{...t,active:e,recent:ma(t.recent,e)}:t}function kT(t){return t.active===null?t:{...t,active:null}}function CT(t,e){const s=t.docs.findIndex(y=>y.key===e);if(s===-1)return t;const l=t.docs.filter(y=>y.key!==e),u=t.recent.filter(y=>y!==e);if(t.active!==e)return{docs:l,active:t.active,recent:u};const k=l[s]??l[s-1]??null;return{docs:l,active:k===null?null:k.key,recent:k===null?u:ma(u,k.key)}}function ST(t,e,s){return{...t,docs:t.docs.map(l=>l.key===e?{...l,mode:s}:l)}}function Tu(t,e,s){var l;return((l=t[e])==null?void 0:l[s])??pa}function xT(t,e,s,l){const u=t[e]??{file:pa,plan:pa};return{...t,[e]:{...u,[s]:l}}}function ET(t,e){if(e.length===0)return t;const s=new Set(e),l=Object.keys(t).filter(k=>!s.has(k));if(l.length===0)return t;const u={...t};for(const k of l)delete u[k];return u}function us(t,e,s){return`${t}\0${e}\0${s}`}function TT(t){const e=new Set;for(const[s,l]of Object.entries(t))for(const u of yT)for(const k of l[u].docs)e.add(us(s,u,k.key));return e}function LT(t){return JSON.stringify(t)}function ga(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)?t:null}function NT(t){const e=ga(t);if(e===null)return null;const{key:s,title:l,mode:u}=e;if(typeof s!="string"||s.length===0||s.length>Pv||typeof l!="string"||l.length>wT)return null;const k={key:s,title:l};return u==="formatted"||u==="source"?{...k,mode:u}:k}function dm(t){const e=ga(t);if(e===null||!Array.isArray(e.docs))return pa;const s=[];for(const i of e.docs){const c=NT(i);if(c!==null&&!s.some(m=>m.key===c.key)&&s.push(c),s.length===Dv)break}const l=s.map(i=>i.key),u=typeof e.active=="string"&&l.includes(e.active)?e.active:null,k=Array.isArray(e.recent)?e.recent.filter(i=>typeof i=="string"&&l.includes(i)):[],y=[...l.filter(i=>!k.includes(i)),...new Set(k)];return{docs:s,active:u,recent:y}}function RT(t){let e;try{e=JSON.parse(t)}catch{return No}const s=ga(e);if(s===null)return No;const l={};for(const[u,k]of Object.entries(s)){const y=ga(k);if(y===null||u.length===0||u.length>Pv)continue;const i=dm(y.file),c=dm(y.plan);i.docs.length===0&&c.docs.length===0||(l[u]={file:i,plan:c})}return l}const fm=1,MT=25e4,Ov={kind:"hunk",text:"…",oldLine:null,newLine:null};function sh(t){return t.replace(/\r\n?/g,`
|
|
149
|
+
`)}function pm(t){const e=sh(t).split(`
|
|
150
|
+
`);return e.length>0&&e[e.length-1]===""&&e.pop(),e}function AT(t,e){const s=pm(t),l=pm(e);let u=0;for(;u<s.length&&u<l.length&&s[u]===l[u];)u+=1;let k=s.length,y=l.length;for(;k>u&&y>u&&s[k-1]===l[y-1];)k-=1,y-=1;if(u===k&&u===y)return[];const i=[];for(let c=0;c<u;c+=1)i.push(ih(s,c,c));IT(s,l,u,k,u,y,i);for(let c=k,m=y;c<s.length;c+=1,m+=1)i.push(ih(s,c,m));return jT(i)}function ih(t,e,s){return{kind:"context",text:t[e]??"",oldLine:e+1,newLine:s+1}}function Lu(t,e){return{kind:"removed",text:t[e]??"",oldLine:e+1,newLine:null}}function Nu(t,e){return{kind:"added",text:t[e]??"",oldLine:null,newLine:e+1}}function IT(t,e,s,l,u,k,y){const i=l-s,c=k-u;if(i===0||c===0||i*c>MT){for(let N=s;N<l;N+=1)y.push(Lu(t,N));for(let N=u;N<k;N+=1)y.push(Nu(e,N));return}const m=c+1,v=new Uint32Array((i+1)*m),h=(N,w)=>v[N*m+w]??0;for(let N=i-1;N>=0;N-=1)for(let w=c-1;w>=0;w-=1)v[N*m+w]=t[s+N]===e[u+w]?h(N+1,w+1)+1:Math.max(h(N+1,w),h(N,w+1));let b=0,T=0;for(;b<i&&T<c;)t[s+b]===e[u+T]?(y.push(ih(t,s+b,u+T)),b+=1,T+=1):h(b+1,T)>=h(b,T+1)?(y.push(Lu(t,s+b)),b+=1):(y.push(Nu(e,u+T)),T+=1);for(;b<i;b+=1)y.push(Lu(t,s+b));for(;T<c;T+=1)y.push(Nu(e,u+T))}function jT(t){const e=t.map(u=>u.kind!=="context"),s=[];let l=-1;return t.forEach((u,k)=>{let y=!1;for(let i=-fm;i<=fm&&!y;i+=1)y=e[k+i]===!0;y&&(l!==-1&&k>l+1&&s.push(Ov),s.push(u),l=k)}),s}const Bv="agent-workbench.docTabs",DT=1600;function PT(){try{const t=window.sessionStorage.getItem(Bv);return t===null?No:RT(t)}catch{return No}}function Ru(t){return t!==void 0&&(t.text!==t.opened||t.conflict!==null||t.pending!==null)}function OT(t,e,s,l){const[u,k]=M.useState(PT),[y,i]=M.useState(new Map),[c,m]=M.useState(new Map),[v,h]=M.useState(new Set),b=M.useRef(y);b.current=y;const T=M.useRef(c);T.current=c;const N=M.useRef(new Map),w=M.useRef(new Map),d=M.useRef(new Map);M.useEffect(()=>{k(x=>ET(x,e.map(R=>R.terminalId)))},[e]),M.useEffect(()=>{const x=TT(u);for(const R of[...N.current.keys()])x.has(R)||N.current.delete(R);i(R=>{const S=[...R.keys()].filter(I=>!x.has(I));if(S.length===0)return R;const L=new Map(R);for(const I of S)L.delete(I);return L}),m(R=>{const S=[...R.keys()].filter(I=>!x.has(I));if(S.length===0)return R;const L=new Map(R);for(const I of S)L.delete(I);return L})},[u]),M.useEffect(()=>{try{window.sessionStorage.setItem(Bv,LT(u))}catch{}},[u]);const g=M.useMemo(()=>[...c.values()].some(Ru),[c]);M.useEffect(()=>{if(!g)return;const x=R=>{R.preventDefault(),R.returnValue=""};return window.addEventListener("beforeunload",x),()=>window.removeEventListener("beforeunload",x)},[g]),M.useEffect(()=>{const x=d.current;return()=>{for(const R of x.values())window.clearTimeout(R)}},[]);const p=M.useCallback((x,R,S)=>{const L=us(x,R,S);i(I=>{var P;return new Map(I).set(L,{loaded:((P=I.get(L))==null?void 0:P.loaded)??null,loading:!0,failed:!1})}),R==="file"?t.send({type:"files.read",terminalId:x,path:S}):t.send({type:"plans.read",terminalId:x,fileName:S})},[t]),f=M.useCallback((x,R)=>{m(S=>{const L=S.get(x);if(L===void 0)return S;const I=new Map(S),P=R(L);return P===null?I.delete(x):I.set(x,P),I})},[]),E=M.useCallback(x=>{h(S=>new Set(S).add(x));const R=d.current.get(x);R!==void 0&&window.clearTimeout(R),d.current.set(x,window.setTimeout(()=>{d.current.delete(x),h(S=>{if(!S.has(x))return S;const L=new Set(S);return L.delete(x),L})},DT))},[]);M.useEffect(()=>{const x=(L,I)=>i(P=>P.has(L)?new Map(P).set(L,{loaded:I,loading:!1,failed:!1}):P),R=t.onMessage(L=>{switch(L.type){case"files.preview":x(us(L.terminalId,"file",L.preview.path),{kind:"file",preview:L.preview});break;case"plans.content":x(us(L.terminalId,"plan",L.plan.fileName),{kind:"plan",plan:L.plan});break;case"files.saved":{const I=w.current.get(L.requestId);if(I===void 0)break;w.current.delete(L.requestId);const{id:P}=I,{preview:O}=L;if(O!==null&&x(P,{kind:"file",preview:O}),L.outcome==="saved")f(P,()=>null),E(P);else{const B=O!==null&&O.editable===!0?O:null;f(P,$=>({...$,saving:!1,conflict:{next:B}}))}break}case"error":{const I=L.requestId===void 0?void 0:w.current.get(L.requestId);if(I!==void 0&&L.requestId!==void 0){w.current.delete(L.requestId),f(I.id,P=>({...P,saving:!1,failure:{kind:"server",text:L.text}}));break}i(P=>{if(![...P.values()].some(B=>B.loading))return P;const O=new Map;for(const[B,$]of P)O.set(B,$.loading?{...$,loading:!1,failed:!0}:$);return O});break}}}),S=t.onReopen(()=>{for(const[L,I]of b.current){if(!I.loading)continue;const[P,O,B]=L.split("\0");P===void 0||B===void 0||(O==="file"&&t.send({type:"files.read",terminalId:P,path:B}),O==="plan"&&t.send({type:"plans.read",terminalId:P,fileName:B}))}for(const[L,I]of w.current){if(!I.sent){I.sent=!0;continue}w.current.delete(L),f(I.id,P=>({...P,saving:!1,failure:{kind:"lost"}}))}});return()=>{R(),S()}},[t,f,E]);const j=M.useCallback(x=>{const R=s,S=R===null?Tu(No,"",x):Tu(u,R,x),L=W=>R===null?null:us(R,x,W),I=W=>{R!==null&&k(K=>xT(K,R,x,W(Tu(K,R,x))))},P=W=>{const K=L(W);return K!==null&&Ru(c.get(K))},O=()=>new Set(S.docs.filter(W=>P(W.key)).map(W=>W.key)),B=W=>I(K=>CT(K,W)),$=W=>{const K=L(W);if(x!=="file"||!l||R===null||K===null)return null;const Y=c.get(K)??null;return{edit:Y,unsaved:Ru(Y??void 0),justSaved:v.has(K),begin:()=>{var U;const V=(U=y.get(K))==null?void 0:U.loaded;if((V==null?void 0:V.kind)!=="file"||V.preview.editable!==!0||V.preview.hash===void 0)return;const{hash:F}=V.preview,H=sh(V.preview.text);m(z=>z.has(K)?z:new Map(z).set(K,{opened:H,baseHash:F,text:H,saving:!1,failure:null,conflict:null,pending:null,closing:!1}))},change:V=>f(K,F=>F.conflict!==null?F:{...F,text:V,failure:null}),save:()=>{const V=T.current.get(K);if(V===void 0||V.saving||V.conflict!==null||V.text===V.opened)return;const F=crypto.randomUUID(),H=t.send({type:"files.write",terminalId:R,requestId:F,path:W,text:V.text,baseHash:V.baseHash});w.current.set(F,{id:K,sent:H}),f(K,U=>({...U,saving:!0,failure:null}))},discard:()=>{const V=T.current.get(K);f(K,()=>null),V!==void 0&&V.conflict!==null&&V.conflict.next===null&&p(R,x,W)},adopt:()=>f(K,V=>{var te;const F=((te=V.conflict)==null?void 0:te.next)??null;if(F===null||F.hash===void 0)return V;const H=AT(V.opened,V.text),U=H.length===0?V.pending:V.pending===null?H:[...V.pending,Ov,...H],z=sh(F.text);return{...V,opened:z,baseHash:F.hash,text:z,failure:null,conflict:null,pending:U,closing:!1}}),dismissPending:()=>f(K,V=>({...V,pending:null})),confirmClose:()=>{f(K,()=>null),B(W)},keepEditing:()=>f(K,V=>({...V,closing:!1}))}};return{terminalId:R,docs:S.docs,active:S.active,open:W=>{if(R===null)return;const K=O();I(Y=>bT(Y,W,K)),p(R,x,W.key)},select:W=>I(K=>hm(K,W)),showList:()=>I(kT),close:B,requestClose:W=>{const K=L(W);if(K===null||!P(W)){B(W);return}I(Y=>hm(Y,W)),f(K,Y=>({...Y,closing:!0}))},setMode:(W,K)=>I(Y=>ST(Y,W,K)),content:W=>R===null?void 0:y.get(us(R,x,W)),reload:W=>{R!==null&&p(R,x,W)},rememberScroll:(W,K)=>{R!==null&&N.current.set(us(R,x,W),K)},scrollOf:W=>R===null?void 0:N.current.get(us(R,x,W)),editorFor:$,unsaved:P}},[s,u,y,c,v,l,t,p,f]);return M.useMemo(()=>({files:j("file"),plans:j("plan")}),[j])}const BT=/(?::\d+(?:[:-]\d+)?|#L\d+(?:-L?\d+)?)$/,FT=/[\n\r\t*?<>|"`]/,HT=/\.[A-Za-z0-9_-]{1,12}$/,Fv=t=>t.replace(/\\/g,"/"),UT=t=>t.replace(/\/+$/,"");function mm(t,e){const s=UT(Fv(e.cwd));return s.length===0?null:(e.platform==="win32"?t.toLowerCase().startsWith(`${s.toLowerCase()}/`):t.startsWith(`${s}/`))?t.slice(s.length+1):null}function Eh(t,e){let s=t.trim();const l=/^(["'])(.*)\1$/.exec(s);if(l!==null&&(s=(l[2]??"").trim()),s.startsWith("@")&&(s=s.slice(1)),s.length===0||s.length>qy||FT.test(s)||s.includes("://")||s.startsWith("~")||s.startsWith("-")||(s=Fv(s.replace(BT,"")).replace(/[.,;:]+$/,""),s.length===0))return null;const u=e.platform==="win32";if(/^[A-Za-z]:\//.test(s)||s.startsWith("//")){const c=u?mm(s,e):null;if(c===null)return null;s=c}else if(s.startsWith("/")){const c=u?null:mm(s,e);if(c===null)return null;s=c}const k=s.endsWith("/"),y=[];for(const c of s.split("/"))if(!(c===""||c===".")){if(c===".."){if(y.length===0)return null;y.pop();continue}if(c.includes(":")||c!==c.trim())return null;y.push(c)}const i=y[y.length-1];return i===void 0||y.length===1&&!HT.test(i)&&!k?null:y.join("/")}function Hv(t,e){var u;const s=((u=t.split("#")[0])==null?void 0:u.split("?")[0])??"";if(s.length===0)return null;let l;try{l=decodeURIComponent(s)}catch{return null}return/^[a-z][a-z0-9+.-]+:/i.test(l)?null:Eh(l,e)}const $T=/`([^`\n]+)`/g,WT=/\]\(([^)\s]+)\)/g;function zT(t,e){const s=new Set;for(const l of t.matchAll($T)){const u=Eh(l[1]??"",e);u!==null&&s.add(u)}for(const l of t.matchAll(WT)){const u=Hv(l[1]??"",e);u!==null&&s.add(u)}return[...s]}function qT(t,e,s){return t.filter(l=>(e.get(l)??null)===null&&!s.has(l))}function VT(t,e,s,l=[]){const u=new Set(s),k=new Set(l),y=new Map(t);for(const i of e)y.set(i,u.has(i)?"file":k.has(i)?"directory":null);return y}const KT=1e3;function GT(t){const{connection:e,enabled:s,terminalId:l,cwd:u,platform:k,events:y,liveTerminalIds:i,onOpen:c,onOpenFolder:m}=t,v=M.useRef(new Map),h=M.useRef(new Map),b=M.useRef(0),[T,N]=M.useState(0),[w,d]=M.useState(0),g=M.useMemo(()=>({cwd:u,platform:k}),[u,k]);return M.useEffect(()=>{const p=e.onMessage(E=>{if(E.type!=="files.checked")return;const j=h.current.get(E.requestId);if(j===void 0)return;h.current.delete(E.requestId);const x=v.current.get(j.terminalId);if(x!==void 0){for(const R of j.paths)x.pending.delete(R);x.known=VT(x.known,j.paths,E.existing,E.directories),N(R=>R+1)}}),f=e.onReopen(()=>{h.current.clear();for(const E of v.current.values())E.pending.clear(),E.scanned=new WeakSet;d(E=>E+1)});return()=>{p(),f()}},[e]),M.useEffect(()=>{const p=new Set(i);for(const f of[...v.current.keys()])p.has(f)||v.current.delete(f)},[i]),M.useEffect(()=>{if(!s||l===null||u.length===0)return;let p=v.current.get(l);p===void 0&&(p={known:new Map,pending:new Set,scanned:new WeakSet},v.current.set(l,p));const f=new Set;for(const j of y)if(!p.scanned.has(j)&&(p.scanned.add(j),j.role==="assistant")){for(const x of j.parts)if(x.kind==="text")for(const R of zT(x.text,g))f.add(R)}const E=qT([...f],p.known,p.pending).slice(0,KT);for(let j=0;j<E.length;j+=Jf){const x=E.slice(j,j+Jf);b.current+=1;const R=`files-${b.current}`;h.current.set(R,{terminalId:l,paths:x});for(const S of x)p.pending.add(S);e.send({type:"files.check",terminalId:l,requestId:R,paths:x})}},[e,s,l,u,g,y,w]),M.useMemo(()=>{var E;if(!s||l===null)return null;const p=(E=v.current.get(l))==null?void 0:E.known,f=j=>{if(j===null)return null;const x=(p==null?void 0:p.get(j))??null;return x==="file"?{open:()=>c(j),folder:!1}:x==="directory"&&m!==null?{open:()=>m(j),folder:!0}:null};return{code:j=>f(Eh(j,g)),link:j=>{var x;return((x=f(Hv(j,g)))==null?void 0:x.open)??null}}},[s,l,g,c,m,T])}function YT(t,e){const[s,l]=M.useState(su),[u,k]=M.useState(null),[y,i]=M.useState(!1);M.useEffect(()=>{if(e===null){l(su),k(null);return}l(su),k(null),i(!1);const h=t.onMessage(T=>{switch(T.type){case"git.status":T.terminalId===e&&l(T.status);break;case"git.diff":if(T.terminalId!==e)break;k(T.diff),i(!1);break;case"error":i(!1);break}});t.send({type:"git.subscribe",terminalId:e});const b=t.onReopen(()=>{t.send({type:"git.subscribe",terminalId:e})});return()=>{h(),b(),t.send({type:"git.unsubscribe",terminalId:e})}},[t,e]);const c=M.useCallback((h,b)=>{e!==null&&(i(!0),k(null),t.send({type:"git.diff",terminalId:e,path:h,staged:b}))},[t,e]),m=M.useCallback(()=>{k(null),i(!1)},[]),v=M.useCallback(()=>{e!==null&&t.send({type:"git.refresh",terminalId:e})},[t,e]);return{status:s,diff:u,loadingDiff:y,openDiff:c,closeDiff:m,refresh:v}}const oh=new Set;function XT(t){return t!==void 0&&oh.has(t)}function QT(t){return t.length===0?_("memory.result.nothingChanged"):_("memory.result.installed",{count:t.length})}function JT(t,e){const s=t.length===0?_("memory.result.nothingImported"):_("memory.result.imported",{count:t.length});return e.length===0?s:_("memory.result.withSkipped",{result:s,skipped:_("memory.result.skipped",{count:e.length,files:e.join(", ")})})}function ZT(t,e){const[s,l]=M.useState(null),[u,k]=M.useState(null),[y,i]=M.useState(null),[c,m]=M.useState(null),[v,h]=M.useState(null),[b,T]=M.useState(null),[N,w]=M.useState(null),d=M.useRef(new Map),g=M.useRef(new Set),p=M.useRef(null),f=M.useRef(!1),E=M.useCallback($=>{const W=`memory-${crypto.randomUUID()}`;return d.current.set(W,$),g.current.add(W),oh.add(W),W},[]),j=M.useCallback($=>{for(const[W,K]of d.current)K===$&&d.current.delete(W)},[]);M.useEffect(()=>{l(null),k(null),i(null),m(null),h(null),T(null),w(null),d.current.clear();for(const F of g.current)oh.delete(F);if(g.current.clear(),p.current=null,f.current=!1,e===null)return;const $=(F,H)=>F===void 0||d.current.get(F)!==H?!1:(d.current.delete(F),!0),W=t.onMessage(F=>{switch(F.type){case"memory.status":if(F.terminalId!==e)break;l(F.status),f.current&&(f.current=!1,w(null));break;case"memory.planned":if(F.terminalId!==e||!$(F.requestId,"plan"))break;m(F.changes),h(null);break;case"memory.installed":if(F.terminalId!==e||!$(F.requestId,"install"))break;p.current=null,m(null),h(null),T(QT(F.applied));break;case"memory.imported":if(F.terminalId!==e||!$(F.requestId,"import"))break;h(null),T(JT(F.copied,F.skipped));break;case"memory.content":if(F.terminalId!==e||!$(F.requestId,"read"))break;k(F.note),i(null);break;case"error":{const H=F.requestId,U=H===void 0?void 0:d.current.get(H);if(H===void 0||U===void 0)break;d.current.delete(H),U==="read"?i(null):U!=="subscribe"&&h(null),w(At(F.text)),f.current=U==="subscribe";break}}}),K=t.onStatus(F=>{if(F!=="reconnecting"&&F!=="failed")return;const H=new Set(d.current.values());d.current.clear(),h(null),i(null),(H.has("install")||H.has("import"))&&(p.current=null,m(null),w(_("memory.error.connectionLost")))}),Y=()=>{t.send({type:"memory.subscribe",terminalId:e,requestId:E("subscribe")})};Y();const V=t.onReopen(Y);return()=>{W(),K(),V(),t.send({type:"memory.unsubscribe",terminalId:e})}},[t,e,E]);const x=M.useCallback(()=>{f.current=!1,w(null),T(null)},[]),R=M.useCallback($=>{e!==null&&(j("read"),x(),i($),k(null),t.send({type:"memory.read",terminalId:e,name:$,requestId:E("read")}))},[t,e,x,j,E]),S=M.useCallback(()=>{j("read"),k(null),i(null)},[j]),L=M.useCallback($=>{e!==null&&(x(),p.current=$,m(null),h("plan"),t.send({type:"memory.plan",terminalId:e,options:$,requestId:E("plan")}))},[t,e,x,E]),I=M.useCallback(()=>{const $=p.current;e===null||$===null||(x(),h("install"),t.send({type:"memory.install",terminalId:e,options:$,requestId:E("install")}))},[t,e,x,E]),P=M.useCallback(()=>{e!==null&&(x(),h("import"),t.send({type:"memory.import",terminalId:e,requestId:E("import")}))},[t,e,x,E]),O=M.useCallback(()=>{j("plan"),p.current=null,m(null)},[j]),B=M.useCallback(()=>{f.current=!1,w(null),T(null)},[]);return{status:s,open:u,loading:y,planned:c,busy:v,lastResult:b,error:N,openNote:R,closeNote:S,requestPlan:L,install:I,importNative:P,cancelPlan:O,dismissMessage:B}}function e5(t){const[e,s]=M.useState([]),[l,u]=M.useState({}),[k,y]=M.useState(null),i=M.useRef(new Set);M.useEffect(()=>{const d=t.onMessage(p=>{switch(p.type){case"notes.list":s(p.notes);break;case"notes.imageData":i.current.add(p.imageId),u(f=>({...f,[p.imageId]:p.data===null?null:`data:${p.mediaType};base64,${p.data}`}));break;case"error":p.code==="notes-failed"&&y(At(p.text));break}}),g=t.onReopen(()=>{i.current.clear()});return()=>{d(),g()}},[t]);const c=M.useCallback(d=>{i.current.has(d)||(i.current.add(d),t.send({type:"notes.image",imageId:d}))},[t]),m=M.useCallback(()=>{const d=crypto.randomUUID(),g=Date.now();return s(p=>[...p,{noteId:d,text:"",images:[],createdAt:g,updatedAt:g}]),t.send({type:"notes.create",noteId:d}),d},[t]),v=M.useCallback((d,g)=>{s(p=>p.map(f=>f.noteId===d?{...f,text:g,updatedAt:Date.now()}:f)),t.send({type:"notes.update",noteId:d,text:g})},[t]),h=M.useCallback(d=>{s(g=>g.filter(p=>p.noteId!==d)),t.send({type:"notes.delete",noteId:d})},[t]),b=M.useCallback((d,g)=>{const p=e.find(E=>E.noteId===d);if(p!==void 0&&p.images.length>=Yf){y(_("notes.tooManyImages",{count:Yf}));return}if(g.size>aa){y(_("notes.imageTooBig",{name:g.name||_("notes.imageFallbackName"),size:Math.round(g.size/1024/1024),max:aa/1024/1024}));return}const f=new FileReader;f.onload=()=>{const E=f.result;if(typeof E!="string")return;const j=E.indexOf(",");j!==-1&&t.send({type:"notes.addImage",noteId:d,image:{mediaType:g.type,data:E.slice(j+1)}})},f.onerror=()=>y(_("notes.readFailed")),f.readAsDataURL(g)},[t,e]),T=M.useCallback((d,g)=>{s(p=>p.map(f=>f.noteId===d?{...f,images:f.images.filter(E=>E.imageId!==g)}:f)),t.send({type:"notes.removeImage",noteId:d,imageId:g})},[t]),N=M.useCallback((d,g)=>{t.send({type:"notes.send",noteId:d,terminalId:g})},[t]),w=M.useCallback(()=>y(null),[]);return{notes:e,images:l,problem:k,requestImage:c,create:m,updateText:v,remove:h,addImage:b,removeImage:T,sendToAgent:N,dismissProblem:w}}function t5(t){const[e,s]=M.useState([]);return M.useEffect(()=>t.onMessage(l=>{l.type==="plan.limits"&&s(l.limits)}),[t]),e}const Uv="agent-workbench.theme",Mu=["system","light","dark"],n5={system:"theme.system",light:"theme.light",dark:"theme.dark"};function gm(t){return _("theme.title",{theme:_(n5[t])})}const vm={system:"◐",light:"☀",dark:"☾"};function r5(){return Nt(Uv,"system",t=>t==="light"||t==="dark"||t==="system"?t:null)}function s5(){return window.matchMedia("(prefers-color-scheme: dark)").matches}function i5(){const[t,e]=M.useState(r5),[s,l]=M.useState(s5);M.useEffect(()=>{const y=window.matchMedia("(prefers-color-scheme: dark)"),i=c=>l(c.matches);return y.addEventListener("change",i),()=>y.removeEventListener("change",i)},[]);const u=t==="system"?s?"dark":"light":t;M.useEffect(()=>{document.documentElement.dataset.theme=u,document.documentElement.style.colorScheme=u},[u]);const k=M.useCallback(()=>{e(y=>{const i=Mu[(Mu.indexOf(y)+1)%Mu.length]??"system";return kt(Uv,i),i})},[]);return{preference:t,resolved:u,cycle:k}}const _m="agent-workbench.terminalTheme";function o5(t){return t==="dark"||t==="follow"?t:null}function l5(t,e){return t==="follow"?e:"dark"}function a5(t){const[e,s]=M.useState(()=>Nt(_m,"dark",o5)),l=l5(e,t);M.useEffect(()=>{document.documentElement.dataset.terminalTheme=l},[l]);const u=M.useCallback(k=>{kt(_m,k),s(k)},[]);return{preference:e,resolved:l,setPreference:u}}const c5=1500;function u5(t,e){return t===void 0||t===e?null:e==="waiting"?"attention":e==="idle"&&t==="busy"?"done":null}function h5(t,e){const s={now:[],later:[],cancel:[]};for(const[l,u]of e){const k=t.get(l);if(k===u)continue;s.cancel.push(l);const y=u5(k,u);y==="attention"?s.now.push(l):y==="done"&&s.later.push(l)}for(const l of t.keys())e.has(l)||s.cancel.push(l);return s}const wm="agent-workbench.phone-chime";function d5(t){return t==="system"||t==="page"?t:null}function f5(t){return`agentworkbench://chime?source=${t}`}function p5(t,e,s,l){return t?e==="page"?wa:null:s?jo(l):null}const ym="agent-workbench.sound";function m5(t){return t==="on"?!0:t==="off"?!1:null}function g5(t){return _(t?"sound.on":"sound.off")}function v5(t,e){return t&&e>0}const _5={done:[{frequency:880,at:0,duration:.18},{frequency:659.25,at:.14,duration:.28}],attention:[{frequency:659.25,at:0,duration:.18},{frequency:987.77,at:.14,duration:.28}]},$v=.02,wa=.8,Wv=.2,bm="agent-workbench.sound-volume";function jo(t){return Math.min(wa,Math.max($v,t))}function w5(t){if(t.trim().length===0)return null;const e=Number(t);return Number.isFinite(e)?jo(e):null}function y5(t){return Math.round(jo(t)/wa*100)}class b5{constructor(){$t(this,"context",null);$t(this,"volume",Wv)}unlock(){typeof window>"u"||typeof window.AudioContext!="function"||(this.context??(this.context=new window.AudioContext),this.context.state==="suspended"&&this.context.resume().catch(()=>{}))}get ready(){var e;return((e=this.context)==null?void 0:e.state)==="running"}play(e){const s=this.context;if(s===null||s.state!=="running")return;const l=s.currentTime+.01;for(const u of _5[e]){const k=s.createOscillator(),y=s.createGain();k.type="sine",k.frequency.value=u.frequency;const i=l+u.at;y.gain.setValueAtTime(1e-4,i),y.gain.exponentialRampToValueAtTime(jo(this.volume),i+.012),y.gain.exponentialRampToValueAtTime(1e-4,i+u.duration),k.connect(y),y.connect(s.destination),k.start(i),k.stop(i+u.duration+.02)}}}const Au="agent-workbench.notify";function k5(t){return t==="on"?!0:t==="off"?!1:null}function C5(t,e,s){return t&&e==="granted"&&!s}function S5(t,e){return _(e==="denied"?"sound.notify.blocked":t?"sound.notify.on":"sound.notify.off")}function x5(t,e){return t==="attention"?_("notify.attention",{tab:e}):_("notify.done",{tab:e})}function E5(t){return t===void 0?"":t.label.length>0?t.label:t.cwd.split(/[\\/]/).filter(e=>e.length>0).pop()??t.cwd}function Co(){return typeof window>"u"||!("Notification"in window)||!window.isSecureContext?"unsupported":Notification.permission}async function T5(){if(Co()==="unsupported")return"unsupported";try{return await Notification.requestPermission()}catch{return Co()}}function L5(){return document.visibilityState==="visible"&&document.hasFocus()}function N5(t){try{const e=new Notification("Agent Workbench",{body:x5(t.chime,t.tabName),tag:`agent-workbench:${t.terminalId}`});e.onclick=()=>{window.focus(),t.onClick(),e.close()}}catch{}}function R5(t,e){const[s,l]=M.useState(()=>Nt(ym,!0,m5)),u=M.useRef(s);u.current=s;const[k,y]=M.useState(()=>Nt(bm,Wv,w5)),i=M.useRef(k);i.current=k;const[c]=M.useState(()=>typeof navigator<"u"&&Bg(navigator.userAgent)),[m,v]=M.useState(()=>Nt(wm,"system",d5)),h=M.useRef(m);h.current=m;const[b,T]=M.useState(()=>Co()),[N,w]=M.useState(()=>Nt(Au,!1,k5)),d=M.useRef(N);d.current=N;const g=M.useRef(e);g.current=e;const p=M.useCallback((H,U)=>{C5(d.current,Co(),L5())&&N5({chime:H,terminalId:U,tabName:g.current.nameOf(U),onClick:()=>g.current.activate(U)})},[]),f=M.useRef(null),E=M.useRef(new Map),j=M.useRef(new Map),[x,R]=M.useState(()=>new Set),S=M.useRef(new Map),L=M.useRef(new Set),I=M.useCallback(H=>L.current.delete(H),[]),P=M.useCallback(H=>{L.current.add(H);const U=S.current,z=U.get(H);z!==void 0&&window.clearTimeout(z),R(te=>te.has(H)?te:new Set(te).add(H)),U.set(H,window.setTimeout(()=>{U.delete(H),R(te=>{if(!te.has(H))return te;const ie=new Set(te);return ie.delete(H),ie})},Jg))},[]),O=M.useCallback(H=>{const U=f.current,z=p5(c,h.current,u.current,i.current);U===null||z===null||(U.volume=z,U.play(H))},[c]);M.useEffect(()=>{const H=new b5;H.volume=i.current,f.current=H;const U=()=>{H.unlock(),H.ready&&(window.removeEventListener("pointerdown",U),window.removeEventListener("keydown",U))};return window.addEventListener("pointerdown",U),window.addEventListener("keydown",U),()=>{window.removeEventListener("pointerdown",U),window.removeEventListener("keydown",U),f.current=null}},[]),M.useEffect(()=>{const H=h5(E.current,t);E.current=new Map(t);const U=j.current;for(const z of H.cancel){const te=U.get(z);te!==void 0&&(window.clearTimeout(te),U.delete(z))}H.now.length>0&&O("attention");for(const z of H.now)p("attention",z),P(z);for(const z of H.later)U.set(z,window.setTimeout(()=>{U.delete(z),O("done"),p("done",z),P(z)},c5))},[t,p,O,P]),M.useEffect(()=>{const H=j.current,U=S.current;return()=>{for(const z of H.values())window.clearTimeout(z);H.clear();for(const z of U.values())window.clearTimeout(z);U.clear()}},[]);const B=M.useCallback(()=>{var H,U;l(z=>{const te=!z;return kt(ym,te?"on":"off"),te}),u.current||((H=f.current)==null||H.unlock(),(U=f.current)==null||U.play("done"))},[]),$=M.useCallback(H=>{const U=jo(H);y(U),kt(bm,String(U)),f.current!==null&&(f.current.volume=U)},[]),W=M.useCallback(()=>{var H,U;u.current&&((H=f.current)==null||H.unlock(),(U=f.current)==null||U.play("done"))},[]),K=M.useCallback(()=>{if(d.current&&Co()==="granted"){w(!1),kt(Au,"off");return}T5().then(H=>{T(H),H==="granted"&&(w(!0),kt(Au,"on"))})},[]),Y={supported:b!=="unsupported",enabled:N&&b==="granted",permission:b,toggle:K},V=M.useCallback(H=>{var U;v(H),h.current=H,kt(wm,H),window.location.href=f5(H),H==="page"&&((U=f.current)==null||U.unlock(),O("done"))},[O]);return{enabled:s,toggle:B,volume:k,setVolume:$,previewVolume:W,notify:Y,phoneChime:c?{source:m,setSource:V}:null,attention:x,takeNotice:I}}function zv(t,e,s){const[l,u]=M.useState(()=>Nt(t,e,D1));M.useLayoutEffect(()=>{document.documentElement.dataset[s]=l},[s,l]);const k=M.useCallback(()=>{u(y=>{const i=Qg(y);return kt(t,i),i})},[t]);return{size:l,cycle:k}}function M5(){return zv(M1,Xg,"threadFont")}function A5(){return zv(A1,I1,"notesFont")}function I5(t,e){const[s,l]=M.useState(()=>new Map),[u,k]=M.useState(()=>new Map),y=M.useCallback((c,m,v,h)=>{l(b=>new Map(b).set(c,{requestId:m,terminalId:c,afterEventId:v,phase:"sending",queued:h,sentAt:Date.now(),deliveredAt:null}))},[]);M.useEffect(()=>{const c=t.onMessage(v=>{v.type==="agent.submitted"&&l(h=>TC(h,v,Date.now()))}),m=t.onReopen(()=>l(v=>EC(v,Date.now())));return()=>{c(),m()}},[t]);const i=M.useRef(new Map);return M.useLayoutEffect(()=>{const c=i.current;if(c===e)return;i.current=e;const m=Date.now();k(v=>xC(c,e,v,m))},[e]),{track:y,receipts:s,clocks:u}}const j5=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]);function qv({sound:t}){return o.jsxs("span",{className:"sound-control",children:[o.jsx("button",{className:`icon-button${v5(t.enabled,t.volume)?" icon-button-on":""}`,onClick:t.toggle,title:g5(t.enabled),"aria-pressed":t.enabled,children:"♪"}),t.enabled&&o.jsx("div",{className:"sound-volume",children:o.jsxs("div",{className:"sound-volume-box",children:[o.jsx("input",{className:"sound-volume-slider",type:"range",min:$v,max:wa,step:.01,value:t.volume,onChange:e=>t.setVolume(Number(e.target.value)),onPointerUp:t.previewVolume,onKeyUp:e=>{j5.has(e.key)&&t.previewVolume()},title:_("sound.volume"),"aria-label":_("sound.volume")}),o.jsxs("span",{className:"sound-volume-value",children:[y5(t.volume),"%"]})]})})]})}function Vv({notify:t}){return t.supported?o.jsx("button",{className:`icon-button${t.enabled?" icon-button-on":""}`,onClick:t.toggle,title:S5(t.enabled,t.permission),"aria-pressed":t.enabled,children:o.jsx(D5,{})}):null}function D5(){return o.jsx("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",focusable:"false",children:o.jsx("path",{d:"M4 11V7a4 4 0 0 1 8 0v4l1.2 1.5H2.8L4 11zM6.6 14a1.5 1.5 0 0 0 2.8 0",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function P5(t){const[e,s]=M.useState(null),[l,u]=M.useState(null),[k,y]=M.useState(null),[i,c]=M.useState(!1),[m,v]=M.useState(null);M.useEffect(()=>{const E=t.onMessage(x=>{switch(x.type){case"remote.status":s(x.status),x.status.pairingActive||(u(null),y(null));break;case"remote.pairing.code":u(x.pairing),y(null);break;case"remote.phone.pairing":y(x.pairing),u(null);break;case"error":if(x.code!=="remote-failed")break;v(At(x.text)),x.detail!==void 0&&console.error("[servidor]",x.detail);break}}),j=t.onReopen(()=>{u(null),y(null),c(!1)});return()=>{E(),j()}},[t]);const h=M.useCallback(E=>{v(null),t.send({type:"remote.configure",enabled:E})},[t]),b=M.useCallback(E=>{v(null),t.send({type:"remote.configure",port:E})},[t]),T=M.useCallback(()=>{v(null),t.send({type:"remote.pairing.start"})},[t]),N=M.useCallback(()=>{u(null),t.send({type:"remote.pairing.cancel"})},[t]),w=M.useCallback(()=>{v(null),c(!0),t.send({type:"remote.phone.start"})},[t]),d=M.useCallback(()=>{y(null),c(!1),t.send({type:"remote.phone.cancel"})},[t]),g=M.useCallback((E,j)=>{v(null),t.send({type:"remote.device.rename",deviceId:E,label:j})},[t]),p=M.useCallback(E=>{v(null),t.send({type:"remote.device.revoke",deviceId:E})},[t]),f=M.useCallback(()=>v(null),[]);return{status:e,pairing:l,phonePairing:k,phoneStarted:i,problem:m,setEnabled:h,setPort:b,startPairing:T,cancelPairing:N,startPhonePairing:w,cancelPhonePairing:d,renameDevice:g,revokeDevice:p,dismissProblem:f}}const O5="USER";function B5(t,e){const s=t.sshUser.length>0?t.sshUser:O5,l=/\s/.test(s)?`"${s}@${e}"`:`${s}@${e}`;return`ssh -N -L ${t.port}:127.0.0.1:${t.port} ${l}`}function Kv(t){return`http://localhost:${t}`}function F5(t,e){return`${Kv(t)}/?${Ay}=${e}`}function km(t){return t[0]??"localhost"}function lh(t,e){switch(t){case"off":return _("remote.state.off");case"active":return _("remote.state.active",{port:e});case"restart-needed":return _("remote.state.restartNeeded");case"port-busy":return _("remote.state.portBusy",{port:e})}}function H5(t){const e=t.trim();if(!/^\d{1,5}$/.test(e))return null;const s=Number(e);return jy(s)?s:null}function U5(){return _("remote.portInvalid",{min:lg,max:ag})}function Cm(t,e){return Math.max(0,Math.ceil((t-e)/1e3))}function Sm(t){return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}function $5(t,e=Date.now()){return t.connected?_("remote.device.connected"):t.lastSeenAt===null?_("remote.device.never"):_("remote.device.lastSeen",{when:Wn(t.lastSeenAt,e)})}function W5(t,e=Date.now()){return _("remote.device.paired",{when:Wn(t.createdAt,e)})}function z5(t){switch(t){case"powershell-admin":return _("remote.phone.authorize.admin");case"powershell":return _("remote.phone.authorize.powershell");case"terminal":return _("remote.phone.authorize.terminal")}}function q5(){return[{platform:"win32",label:"Windows",hint:_("remote.ssh.windows"),command:["Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0","Start-Service sshd","Set-Service -Name sshd -StartupType Automatic"].join(`
|
|
151
|
+
`)},{platform:"darwin",label:"macOS",hint:_("remote.ssh.macos"),command:null},{platform:"linux",label:"Linux",hint:_("remote.ssh.linux"),command:["sudo apt install openssh-server","sudo systemctl enable --now ssh"].join(`
|
|
152
|
+
`)}]}function V5(t){return t==="win32"||t==="darwin"?t:"linux"}function ta(t){return t!==null&&t.state==="active"}function xm(t){return t!==null&&t.state==="active"&&t.devices.length>0}const ji=function(t,e){let u=t;const k=ko[e];let y=null,i=0,c=null;const m=[],v={},h=function(R,S){i=u*4+17,y=(function(L){const I=new Array(L);for(let P=0;P<L;P+=1){I[P]=new Array(L);for(let O=0;O<L;O+=1)I[P][O]=null}return I})(i),b(0,0),b(i-7,0),b(0,i-7),w(),N(),g(R,S),u>=7&&d(R),c==null&&(c=E(u,k,m)),p(c,S)},b=function(R,S){for(let L=-1;L<=7;L+=1)if(!(R+L<=-1||i<=R+L))for(let I=-1;I<=7;I+=1)S+I<=-1||i<=S+I||(0<=L&&L<=6&&(I==0||I==6)||0<=I&&I<=6&&(L==0||L==6)||2<=L&&L<=4&&2<=I&&I<=4?y[R+L][S+I]=!0:y[R+L][S+I]=!1)},T=function(){let R=0,S=0;for(let L=0;L<8;L+=1){h(!0,L);const I=cs.getLostPoint(v);(L==0||R>I)&&(R=I,S=L)}return S},N=function(){for(let R=8;R<i-8;R+=1)y[R][6]==null&&(y[R][6]=R%2==0);for(let R=8;R<i-8;R+=1)y[6][R]==null&&(y[6][R]=R%2==0)},w=function(){const R=cs.getPatternPosition(u);for(let S=0;S<R.length;S+=1)for(let L=0;L<R.length;L+=1){const I=R[S],P=R[L];if(y[I][P]==null)for(let O=-2;O<=2;O+=1)for(let B=-2;B<=2;B+=1)O==-2||O==2||B==-2||B==2||O==0&&B==0?y[I+O][P+B]=!0:y[I+O][P+B]=!1}},d=function(R){const S=cs.getBCHTypeNumber(u);for(let L=0;L<18;L+=1){const I=!R&&(S>>L&1)==1;y[Math.floor(L/3)][L%3+i-8-3]=I}for(let L=0;L<18;L+=1){const I=!R&&(S>>L&1)==1;y[L%3+i-8-3][Math.floor(L/3)]=I}},g=function(R,S){const L=k<<3|S,I=cs.getBCHTypeInfo(L);for(let P=0;P<15;P+=1){const O=!R&&(I>>P&1)==1;P<6?y[P][8]=O:P<8?y[P+1][8]=O:y[i-15+P][8]=O}for(let P=0;P<15;P+=1){const O=!R&&(I>>P&1)==1;P<8?y[8][i-P-1]=O:P<9?y[8][15-P-1+1]=O:y[8][15-P-1]=O}y[i-8][8]=!R},p=function(R,S){let L=-1,I=i-1,P=7,O=0;const B=cs.getMaskFunction(S);for(let $=i-1;$>0;$-=2)for($==6&&($-=1);;){for(let W=0;W<2;W+=1)if(y[I][$-W]==null){let K=!1;O<R.length&&(K=(R[O]>>>P&1)==1),B(I,$-W)&&(K=!K),y[I][$-W]=K,P-=1,P==-1&&(O+=1,P=7)}if(I+=L,I<0||i<=I){I-=L,L=-L;break}}},f=function(R,S){let L=0,I=0,P=0;const O=new Array(S.length),B=new Array(S.length);for(let Y=0;Y<S.length;Y+=1){const V=S[Y].dataCount,F=S[Y].totalCount-V;I=Math.max(I,V),P=Math.max(P,F),O[Y]=new Array(V);for(let te=0;te<O[Y].length;te+=1)O[Y][te]=255&R.getBuffer()[te+L];L+=V;const H=cs.getErrorCorrectPolynomial(F),z=Ro(O[Y],H.getLength()-1).mod(H);B[Y]=new Array(H.getLength()-1);for(let te=0;te<B[Y].length;te+=1){const ie=te+z.getLength()-B[Y].length;B[Y][te]=ie>=0?z.getAt(ie):0}}let $=0;for(let Y=0;Y<S.length;Y+=1)$+=S[Y].totalCount;const W=new Array($);let K=0;for(let Y=0;Y<I;Y+=1)for(let V=0;V<S.length;V+=1)Y<O[V].length&&(W[K]=O[V][Y],K+=1);for(let Y=0;Y<P;Y+=1)for(let V=0;V<S.length;V+=1)Y<B[V].length&&(W[K]=B[V][Y],K+=1);return W},E=function(R,S,L){const I=Em.getRSBlocks(R,S),P=Tm();for(let B=0;B<L.length;B+=1){const $=L[B];P.put($.getMode(),4),P.put($.getLength(),cs.getLengthInBits($.getMode(),R)),$.write(P)}let O=0;for(let B=0;B<I.length;B+=1)O+=I[B].dataCount;if(P.getLengthInBits()>O*8)throw"code length overflow. ("+P.getLengthInBits()+">"+O*8+")";for(P.getLengthInBits()+4<=O*8&&P.put(0,4);P.getLengthInBits()%8!=0;)P.putBit(!1);for(;!(P.getLengthInBits()>=O*8||(P.put(236,8),P.getLengthInBits()>=O*8));)P.put(17,8);return f(P,I)};v.addData=function(R,S){S=S||"Byte";let L=null;switch(S){case"Numeric":L=K5(R);break;case"Alphanumeric":L=G5(R);break;case"Byte":L=Y5(R);break;case"Kanji":L=X5(R);break;default:throw"mode:"+S}m.push(L),c=null},v.isDark=function(R,S){if(R<0||i<=R||S<0||i<=S)throw R+","+S;return y[R][S]},v.getModuleCount=function(){return i},v.make=function(){if(u<1){let R=1;for(;R<40;R++){const S=Em.getRSBlocks(R,k),L=Tm();for(let P=0;P<m.length;P++){const O=m[P];L.put(O.getMode(),4),L.put(O.getLength(),cs.getLengthInBits(O.getMode(),R)),O.write(L)}let I=0;for(let P=0;P<S.length;P++)I+=S[P].dataCount;if(L.getLengthInBits()<=I*8)break}u=R}h(!1,T())},v.createTableTag=function(R,S){R=R||2,S=typeof S>"u"?R*4:S;let L="";L+='<table style="',L+=" border-width: 0px; border-style: none;",L+=" border-collapse: collapse;",L+=" padding: 0px; margin: "+S+"px;",L+='">',L+="<tbody>";for(let I=0;I<v.getModuleCount();I+=1){L+="<tr>";for(let P=0;P<v.getModuleCount();P+=1)L+='<td style="',L+=" border-width: 0px; border-style: none;",L+=" border-collapse: collapse;",L+=" padding: 0px; margin: 0px;",L+=" width: "+R+"px;",L+=" height: "+R+"px;",L+=" background-color: ",L+=v.isDark(I,P)?"#000000":"#ffffff",L+=";",L+='"/>';L+="</tr>"}return L+="</tbody>",L+="</table>",L},v.createSvgTag=function(R,S,L,I){let P={};typeof arguments[0]=="object"&&(P=arguments[0],R=P.cellSize,S=P.margin,L=P.alt,I=P.title),R=R||2,S=typeof S>"u"?R*4:S,L=typeof L=="string"?{text:L}:L||{},L.text=L.text||null,L.id=L.text?L.id||"qrcode-description":null,I=typeof I=="string"?{text:I}:I||{},I.text=I.text||null,I.id=I.text?I.id||"qrcode-title":null;const O=v.getModuleCount()*R+S*2;let B,$,W,K,Y="",V;for(V="l"+R+",0 0,"+R+" -"+R+",0 0,-"+R+"z ",Y+='<svg version="1.1" xmlns="http://www.w3.org/2000/svg"',Y+=P.scalable?"":' width="'+O+'px" height="'+O+'px"',Y+=' viewBox="0 0 '+O+" "+O+'" ',Y+=' preserveAspectRatio="xMinYMin meet"',Y+=I.text||L.text?' role="img" aria-labelledby="'+j([I.id,L.id].join(" ").trim())+'"':"",Y+=">",Y+=I.text?'<title id="'+j(I.id)+'">'+j(I.text)+"</title>":"",Y+=L.text?'<description id="'+j(L.id)+'">'+j(L.text)+"</description>":"",Y+='<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>',Y+='<path d="',W=0;W<v.getModuleCount();W+=1)for(K=W*R+S,B=0;B<v.getModuleCount();B+=1)v.isDark(W,B)&&($=B*R+S,Y+="M"+$+","+K+V);return Y+='" stroke="transparent" fill="black"/>',Y+="</svg>",Y},v.createDataURL=function(R,S){R=R||2,S=typeof S>"u"?R*4:S;const L=v.getModuleCount()*R+S*2,I=S,P=L-S;return eL(L,L,function(O,B){if(I<=O&&O<P&&I<=B&&B<P){const $=Math.floor((O-I)/R),W=Math.floor((B-I)/R);return v.isDark(W,$)?0:1}else return 1})},v.createImgTag=function(R,S,L){R=R||2,S=typeof S>"u"?R*4:S;const I=v.getModuleCount()*R+S*2;let P="";return P+="<img",P+=' src="',P+=v.createDataURL(R,S),P+='"',P+=' width="',P+=I,P+='"',P+=' height="',P+=I,P+='"',L&&(P+=' alt="',P+=j(L),P+='"'),P+="/>",P};const j=function(R){let S="";for(let L=0;L<R.length;L+=1){const I=R.charAt(L);switch(I){case"<":S+="<";break;case">":S+=">";break;case"&":S+="&";break;case'"':S+=""";break;default:S+=I;break}}return S},x=function(R){R=typeof R>"u"?2:R;const L=v.getModuleCount()*1+R*2,I=R,P=L-R;let O,B,$,W,K;const Y={"██":"█","█ ":"▀"," █":"▄"," ":" "},V={"██":"▀","█ ":"▀"," █":" "," ":" "};let F="";for(O=0;O<L;O+=2){for($=Math.floor((O-I)/1),W=Math.floor((O+1-I)/1),B=0;B<L;B+=1)K="█",I<=B&&B<P&&I<=O&&O<P&&v.isDark($,Math.floor((B-I)/1))&&(K=" "),I<=B&&B<P&&I<=O+1&&O+1<P&&v.isDark(W,Math.floor((B-I)/1))?K+=" ":K+="█",F+=R<1&&O+1>=P?V[K]:Y[K];F+=`
|
|
153
|
+
`}return L%2&&R>0?F.substring(0,F.length-L-1)+Array(L+1).join("▀"):F.substring(0,F.length-1)};return v.createASCII=function(R,S){if(R=R||1,R<2)return x(S);R-=1,S=typeof S>"u"?R*2:S;const L=v.getModuleCount()*R+S*2,I=S,P=L-S;let O,B,$,W;const K=Array(R+1).join("██"),Y=Array(R+1).join(" ");let V="",F="";for(O=0;O<L;O+=1){for($=Math.floor((O-I)/R),F="",B=0;B<L;B+=1)W=1,I<=B&&B<P&&I<=O&&O<P&&v.isDark($,Math.floor((B-I)/R))&&(W=0),F+=W?K:Y;for($=0;$<R;$+=1)V+=F+`
|
|
154
|
+
`}return V.substring(0,V.length-1)},v.renderTo2dContext=function(R,S){S=S||2;const L=v.getModuleCount();for(let I=0;I<L;I++)for(let P=0;P<L;P++)R.fillStyle=v.isDark(I,P)?"black":"white",R.fillRect(P*S,I*S,S,S)},v};ji.stringToBytes=function(t){const e=[];for(let s=0;s<t.length;s+=1){const l=t.charCodeAt(s);e.push(l&255)}return e};ji.createStringToBytes=function(t,e){const s=(function(){const u=J5(t),k=function(){const c=u.read();if(c==-1)throw"eof";return c};let y=0;const i={};for(;;){const c=u.read();if(c==-1)break;const m=k(),v=k(),h=k(),b=String.fromCharCode(c<<8|m),T=v<<8|h;i[b]=T,y+=1}if(y!=e)throw y+" != "+e;return i})(),l=63;return function(u){const k=[];for(let y=0;y<u.length;y+=1){const i=u.charCodeAt(y);if(i<128)k.push(i);else{const c=s[u.charAt(y)];typeof c=="number"?(c&255)==c?k.push(c):(k.push(c>>>8),k.push(c&255)):k.push(l)}}return k}};const hn={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},ko={L:1,M:0,Q:3,H:2},as={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},cs=(function(){const t=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],e=1335,s=7973,l=21522,u={},k=function(y){let i=0;for(;y!=0;)i+=1,y>>>=1;return i};return u.getBCHTypeInfo=function(y){let i=y<<10;for(;k(i)-k(e)>=0;)i^=e<<k(i)-k(e);return(y<<10|i)^l},u.getBCHTypeNumber=function(y){let i=y<<12;for(;k(i)-k(s)>=0;)i^=s<<k(i)-k(s);return y<<12|i},u.getPatternPosition=function(y){return t[y-1]},u.getMaskFunction=function(y){switch(y){case as.PATTERN000:return function(i,c){return(i+c)%2==0};case as.PATTERN001:return function(i,c){return i%2==0};case as.PATTERN010:return function(i,c){return c%3==0};case as.PATTERN011:return function(i,c){return(i+c)%3==0};case as.PATTERN100:return function(i,c){return(Math.floor(i/2)+Math.floor(c/3))%2==0};case as.PATTERN101:return function(i,c){return i*c%2+i*c%3==0};case as.PATTERN110:return function(i,c){return(i*c%2+i*c%3)%2==0};case as.PATTERN111:return function(i,c){return(i*c%3+(i+c)%2)%2==0};default:throw"bad maskPattern:"+y}},u.getErrorCorrectPolynomial=function(y){let i=Ro([1],0);for(let c=0;c<y;c+=1)i=i.multiply(Ro([1,hs.gexp(c)],0));return i},u.getLengthInBits=function(y,i){if(1<=i&&i<10)switch(y){case hn.MODE_NUMBER:return 10;case hn.MODE_ALPHA_NUM:return 9;case hn.MODE_8BIT_BYTE:return 8;case hn.MODE_KANJI:return 8;default:throw"mode:"+y}else if(i<27)switch(y){case hn.MODE_NUMBER:return 12;case hn.MODE_ALPHA_NUM:return 11;case hn.MODE_8BIT_BYTE:return 16;case hn.MODE_KANJI:return 10;default:throw"mode:"+y}else if(i<41)switch(y){case hn.MODE_NUMBER:return 14;case hn.MODE_ALPHA_NUM:return 13;case hn.MODE_8BIT_BYTE:return 16;case hn.MODE_KANJI:return 12;default:throw"mode:"+y}else throw"type:"+i},u.getLostPoint=function(y){const i=y.getModuleCount();let c=0;for(let h=0;h<i;h+=1)for(let b=0;b<i;b+=1){let T=0;const N=y.isDark(h,b);for(let w=-1;w<=1;w+=1)if(!(h+w<0||i<=h+w))for(let d=-1;d<=1;d+=1)b+d<0||i<=b+d||w==0&&d==0||N==y.isDark(h+w,b+d)&&(T+=1);T>5&&(c+=3+T-5)}for(let h=0;h<i-1;h+=1)for(let b=0;b<i-1;b+=1){let T=0;y.isDark(h,b)&&(T+=1),y.isDark(h+1,b)&&(T+=1),y.isDark(h,b+1)&&(T+=1),y.isDark(h+1,b+1)&&(T+=1),(T==0||T==4)&&(c+=3)}for(let h=0;h<i;h+=1)for(let b=0;b<i-6;b+=1)y.isDark(h,b)&&!y.isDark(h,b+1)&&y.isDark(h,b+2)&&y.isDark(h,b+3)&&y.isDark(h,b+4)&&!y.isDark(h,b+5)&&y.isDark(h,b+6)&&(c+=40);for(let h=0;h<i;h+=1)for(let b=0;b<i-6;b+=1)y.isDark(b,h)&&!y.isDark(b+1,h)&&y.isDark(b+2,h)&&y.isDark(b+3,h)&&y.isDark(b+4,h)&&!y.isDark(b+5,h)&&y.isDark(b+6,h)&&(c+=40);let m=0;for(let h=0;h<i;h+=1)for(let b=0;b<i;b+=1)y.isDark(b,h)&&(m+=1);const v=Math.abs(100*m/i/i-50)/5;return c+=v*10,c},u})(),hs=(function(){const t=new Array(256),e=new Array(256);for(let l=0;l<8;l+=1)t[l]=1<<l;for(let l=8;l<256;l+=1)t[l]=t[l-4]^t[l-5]^t[l-6]^t[l-8];for(let l=0;l<255;l+=1)e[t[l]]=l;const s={};return s.glog=function(l){if(l<1)throw"glog("+l+")";return e[l]},s.gexp=function(l){for(;l<0;)l+=255;for(;l>=256;)l-=255;return t[l]},s})(),Ro=function(t,e){if(typeof t.length>"u")throw t.length+"/"+e;const s=(function(){let u=0;for(;u<t.length&&t[u]==0;)u+=1;const k=new Array(t.length-u+e);for(let y=0;y<t.length-u;y+=1)k[y]=t[y+u];return k})(),l={};return l.getAt=function(u){return s[u]},l.getLength=function(){return s.length},l.multiply=function(u){const k=new Array(l.getLength()+u.getLength()-1);for(let y=0;y<l.getLength();y+=1)for(let i=0;i<u.getLength();i+=1)k[y+i]^=hs.gexp(hs.glog(l.getAt(y))+hs.glog(u.getAt(i)));return Ro(k,0)},l.mod=function(u){if(l.getLength()-u.getLength()<0)return l;const k=hs.glog(l.getAt(0))-hs.glog(u.getAt(0)),y=new Array(l.getLength());for(let i=0;i<l.getLength();i+=1)y[i]=l.getAt(i);for(let i=0;i<u.getLength();i+=1)y[i]^=hs.gexp(hs.glog(u.getAt(i))+k);return Ro(y,0).mod(u)},l},Em=(function(){const t=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12,7,37,13],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],e=function(u,k){const y={};return y.totalCount=u,y.dataCount=k,y},s={},l=function(u,k){switch(k){case ko.L:return t[(u-1)*4+0];case ko.M:return t[(u-1)*4+1];case ko.Q:return t[(u-1)*4+2];case ko.H:return t[(u-1)*4+3];default:return}};return s.getRSBlocks=function(u,k){const y=l(u,k);if(typeof y>"u")throw"bad rs block @ typeNumber:"+u+"/errorCorrectionLevel:"+k;const i=y.length/3,c=[];for(let m=0;m<i;m+=1){const v=y[m*3+0],h=y[m*3+1],b=y[m*3+2];for(let T=0;T<v;T+=1)c.push(e(h,b))}return c},s})(),Tm=function(){const t=[];let e=0;const s={};return s.getBuffer=function(){return t},s.getAt=function(l){const u=Math.floor(l/8);return(t[u]>>>7-l%8&1)==1},s.put=function(l,u){for(let k=0;k<u;k+=1)s.putBit((l>>>u-k-1&1)==1)},s.getLengthInBits=function(){return e},s.putBit=function(l){const u=Math.floor(e/8);t.length<=u&&t.push(0),l&&(t[u]|=128>>>e%8),e+=1},s},K5=function(t){const e=hn.MODE_NUMBER,s=t,l={};l.getMode=function(){return e},l.getLength=function(y){return s.length},l.write=function(y){const i=s;let c=0;for(;c+2<i.length;)y.put(u(i.substring(c,c+3)),10),c+=3;c<i.length&&(i.length-c==1?y.put(u(i.substring(c,c+1)),4):i.length-c==2&&y.put(u(i.substring(c,c+2)),7))};const u=function(y){let i=0;for(let c=0;c<y.length;c+=1)i=i*10+k(y.charAt(c));return i},k=function(y){if("0"<=y&&y<="9")return y.charCodeAt(0)-48;throw"illegal char :"+y};return l},G5=function(t){const e=hn.MODE_ALPHA_NUM,s=t,l={};l.getMode=function(){return e},l.getLength=function(k){return s.length},l.write=function(k){const y=s;let i=0;for(;i+1<y.length;)k.put(u(y.charAt(i))*45+u(y.charAt(i+1)),11),i+=2;i<y.length&&k.put(u(y.charAt(i)),6)};const u=function(k){if("0"<=k&&k<="9")return k.charCodeAt(0)-48;if("A"<=k&&k<="Z")return k.charCodeAt(0)-65+10;switch(k){case" ":return 36;case"$":return 37;case"%":return 38;case"*":return 39;case"+":return 40;case"-":return 41;case".":return 42;case"/":return 43;case":":return 44;default:throw"illegal char :"+k}};return l},Y5=function(t){const e=hn.MODE_8BIT_BYTE,s=ji.stringToBytes(t),l={};return l.getMode=function(){return e},l.getLength=function(u){return s.length},l.write=function(u){for(let k=0;k<s.length;k+=1)u.put(s[k],8)},l},X5=function(t){const e=hn.MODE_KANJI,s=ji.stringToBytes;(function(k,y){const i=s(k);if(i.length!=2||(i[0]<<8|i[1])!=y)throw"sjis not supported."})("友",38726);const l=s(t),u={};return u.getMode=function(){return e},u.getLength=function(k){return~~(l.length/2)},u.write=function(k){const y=l;let i=0;for(;i+1<y.length;){let c=(255&y[i])<<8|255&y[i+1];if(33088<=c&&c<=40956)c-=33088;else if(57408<=c&&c<=60351)c-=49472;else throw"illegal char at "+(i+1)+"/"+c;c=(c>>>8&255)*192+(c&255),k.put(c,13),i+=2}if(i<y.length)throw"illegal char at "+(i+1)},u},Gv=function(){const t=[],e={};return e.writeByte=function(s){t.push(s&255)},e.writeShort=function(s){e.writeByte(s),e.writeByte(s>>>8)},e.writeBytes=function(s,l,u){l=l||0,u=u||s.length;for(let k=0;k<u;k+=1)e.writeByte(s[k+l])},e.writeString=function(s){for(let l=0;l<s.length;l+=1)e.writeByte(s.charCodeAt(l))},e.toByteArray=function(){return t},e.toString=function(){let s="";s+="[";for(let l=0;l<t.length;l+=1)l>0&&(s+=","),s+=t[l];return s+="]",s},e},Q5=function(){let t=0,e=0,s=0,l="";const u={},k=function(i){l+=String.fromCharCode(y(i&63))},y=function(i){if(i<0)throw"n:"+i;if(i<26)return 65+i;if(i<52)return 97+(i-26);if(i<62)return 48+(i-52);if(i==62)return 43;if(i==63)return 47;throw"n:"+i};return u.writeByte=function(i){for(t=t<<8|i&255,e+=8,s+=1;e>=6;)k(t>>>e-6),e-=6},u.flush=function(){if(e>0&&(k(t<<6-e),t=0,e=0),s%3!=0){const i=3-s%3;for(let c=0;c<i;c+=1)l+="="}},u.toString=function(){return l},u},J5=function(t){const e=t;let s=0,l=0,u=0;const k={};k.read=function(){for(;u<8;){if(s>=e.length){if(u==0)return-1;throw"unexpected end of file./"+u}const c=e.charAt(s);if(s+=1,c=="=")return u=0,-1;if(c.match(/^\s$/))continue;l=l<<6|y(c.charCodeAt(0)),u+=6}const i=l>>>u-8&255;return u-=8,i};const y=function(i){if(65<=i&&i<=90)return i-65;if(97<=i&&i<=122)return i-97+26;if(48<=i&&i<=57)return i-48+52;if(i==43)return 62;if(i==47)return 63;throw"c:"+i};return k},Z5=function(t,e){const s=t,l=e,u=new Array(t*e),k={};k.setPixel=function(m,v,h){u[v*s+m]=h},k.write=function(m){m.writeString("GIF87a"),m.writeShort(s),m.writeShort(l),m.writeByte(128),m.writeByte(0),m.writeByte(0),m.writeByte(0),m.writeByte(0),m.writeByte(0),m.writeByte(255),m.writeByte(255),m.writeByte(255),m.writeString(","),m.writeShort(0),m.writeShort(0),m.writeShort(s),m.writeShort(l),m.writeByte(0);const v=2,h=i(v);m.writeByte(v);let b=0;for(;h.length-b>255;)m.writeByte(255),m.writeBytes(h,b,255),b+=255;m.writeByte(h.length-b),m.writeBytes(h,b,h.length-b),m.writeByte(0),m.writeString(";")};const y=function(m){const v=m;let h=0,b=0;const T={};return T.write=function(N,w){if(N>>>w)throw"length over";for(;h+w>=8;)v.writeByte(255&(N<<h|b)),w-=8-h,N>>>=8-h,b=0,h=0;b=N<<h|b,h=h+w},T.flush=function(){h>0&&v.writeByte(b)},T},i=function(m){const v=1<<m,h=(1<<m)+1;let b=m+1;const T=c();for(let p=0;p<v;p+=1)T.add(String.fromCharCode(p));T.add(String.fromCharCode(v)),T.add(String.fromCharCode(h));const N=Gv(),w=y(N);w.write(v,b);let d=0,g=String.fromCharCode(u[d]);for(d+=1;d<u.length;){const p=String.fromCharCode(u[d]);d+=1,T.contains(g+p)?g=g+p:(w.write(T.indexOf(g),b),T.size()<4095&&(T.size()==1<<b&&(b+=1),T.add(g+p)),g=p)}return w.write(T.indexOf(g),b),w.write(h,b),w.flush(),N.toByteArray()},c=function(){const m={};let v=0;const h={};return h.add=function(b){if(h.contains(b))throw"dup key:"+b;m[b]=v,v+=1},h.size=function(){return v},h.indexOf=function(b){return m[b]},h.contains=function(b){return typeof m[b]<"u"},h};return k},eL=function(t,e,s){const l=Z5(t,e);for(let i=0;i<e;i+=1)for(let c=0;c<t;c+=1)l.setPixel(c,i,s(c,i));const u=Gv();l.write(u);const k=Q5(),y=u.toByteArray();for(let i=0;i<y.length;i+=1)k.writeByte(y[i]);return k.flush(),"data:image/gif;base64,"+k};ji.stringToBytes;const yo=4;function tL(t){const e=ji(0,"M");e.addData(t,"Byte"),e.make();const s=e.getModuleCount();let l="";for(let u=0;u<s;u++){let k=0;for(;k<s;){if(!e.isDark(u,k)){k++;continue}const y=k;for(;k<s&&e.isDark(u,k);)k++;l+=`M${y} ${u}h${k-y}v1h-${k-y}z`}}return{size:s,path:l}}const nL=1e3,rL=4e3;function sL({status:t,pairing:e,phonePairing:s,phoneStarted:l,problem:u,platform:k,onSetEnabled:y,onSetPort:i,onStartPairing:c,onCancelPairing:m,onStartPhonePairing:v,onCancelPhonePairing:h,onRenameDevice:b,onRevokeDevice:T,onDismissProblem:N,onClose:w}){const[d,g]=M.useState(()=>km(t.hostNames)),[p,f]=M.useState(String(t.port)),[E,j]=M.useState(null),x=M.useRef(null),[R,S]=M.useState(()=>Date.now()),L=()=>{e!==null&&m(),l&&h(),w()},I=M.useRef(L);I.current=L,M.useEffect(()=>{const F=H=>{H.key==="Escape"&&(H.preventDefault(),H.stopPropagation(),I.current())};return window.addEventListener("keydown",F,!0),()=>window.removeEventListener("keydown",F,!0)},[]),M.useEffect(()=>{if(e===null&&s===null)return;S(Date.now());const F=window.setInterval(()=>S(Date.now()),1e3);return()=>window.clearInterval(F)},[e,s]),M.useEffect(()=>()=>{x.current!==null&&window.clearTimeout(x.current)},[]);const P=M.useRef(null),O=s!==null;M.useEffect(()=>{var H;if(!O)return;const F=window.matchMedia("(prefers-reduced-motion: reduce)").matches;(H=P.current)==null||H.scrollIntoView({block:"center",behavior:F?"auto":"smooth"})},[O]),M.useEffect(()=>{f(String(t.port))},[t.port]),M.useEffect(()=>{t.hostNames.includes(d)||g(km(t.hostNames))},[t.hostNames,d]);const B=(F,H)=>{navigator.clipboard.writeText(H).then(()=>{j(F),x.current!==null&&window.clearTimeout(x.current),x.current=window.setTimeout(()=>j(null),nL)}).catch(()=>j(null))},$=H5(p),W=$!==null&&$!==t.port,K=B5(t,d),Y=_("remote.title"),V=e===null?null:F5(t.port,e.code);return o.jsx("div",{className:"modal-backdrop",onClick:L,children:o.jsxs("div",{className:"modal",role:"dialog","aria-label":Y,onClick:F=>F.stopPropagation(),children:[o.jsxs("header",{className:"modal-header",children:[o.jsx("span",{className:"modal-title",children:Y}),o.jsx("button",{className:"icon-button",onClick:L,title:_("common.close"),children:"×"})]}),o.jsxs("div",{className:"modal-body",children:[o.jsx("p",{className:`status-line-state${t.state==="active"?" status-line-state-active":""}`,children:lh(t.state,t.port)}),o.jsx("p",{className:"modal-hint",children:_("remote.intro")}),o.jsx("div",{className:"vault-actions",children:t.enabled?o.jsxs(o.Fragment,{children:[o.jsx("button",{className:"link-button",onClick:()=>y(!1),children:_("remote.turnOff")}),o.jsx("span",{className:"modal-hint",children:_("remote.turnOffHint")})]}):o.jsx("button",{className:"primary-button",onClick:()=>y(!0),children:_("remote.turnOn")})}),o.jsxs("div",{className:"remote-port",children:[o.jsx("label",{className:"modal-hint",htmlFor:"remote-port-input",children:_("remote.port")}),o.jsx("input",{id:"remote-port-input",className:"remote-port-input",inputMode:"numeric",value:p,onChange:F=>f(F.target.value),onKeyDown:F=>{F.key==="Enter"&&W&&$!==null&&i($)}}),o.jsx("button",{className:"link-button",onClick:()=>$!==null&&i($),disabled:!W,children:_("remote.portSave")}),$===null&&o.jsx("span",{className:"modal-hint remote-port-invalid",children:U5()})]}),o.jsx("p",{className:"modal-hint",children:_("remote.restartHint")}),u!==null&&o.jsxs("div",{className:"vault-problem",role:"alert",children:[o.jsx("span",{children:u}),o.jsx("button",{className:"icon-button",onClick:N,title:_("common.close"),children:"×"})]}),o.jsx("h3",{className:"modal-section",children:_("remote.step.host")}),o.jsx("p",{className:"modal-hint",children:_("remote.step.hostHint")}),q5().map(F=>o.jsxs("details",{className:"remote-os",open:F.platform===V5(k),children:[o.jsx("summary",{className:"remote-os-summary",children:F.label}),o.jsx("p",{className:"modal-hint",children:F.hint}),F.command!==null&&o.jsxs("div",{className:"status-line-fragment",children:[o.jsx("pre",{className:"tool-pre",children:F.command}),o.jsx("button",{className:"link-button",onClick:()=>B("ssh",F.command??""),children:E==="ssh"?o.jsxs(o.Fragment,{children:["✓ ",_("remote.copied")]}):_("remote.copy")})]})]},F.platform)),o.jsx("h3",{className:"modal-section",children:_("remote.step.tunnel")}),o.jsx("p",{className:"modal-hint",children:_("remote.step.tunnelHint")}),t.hostNames.length>1&&o.jsxs("div",{className:"remote-port",children:[o.jsx("label",{className:"modal-hint",htmlFor:"remote-host-select",children:_("remote.address")}),o.jsx("select",{id:"remote-host-select",className:"remote-host-select",value:d,onChange:F=>g(F.target.value),children:t.hostNames.map(F=>o.jsx("option",{value:F,children:F},F))})]}),o.jsxs("div",{className:"status-line-fragment",children:[o.jsx("pre",{className:"tool-pre",children:K}),o.jsx("button",{className:"link-button",onClick:()=>B("command",K),children:E==="command"?o.jsxs(o.Fragment,{children:["✓ ",_("remote.copied")]}):_("remote.copy")})]}),o.jsxs("details",{className:"remote-os",children:[o.jsx("summary",{className:"remote-os-summary",children:_("remote.trouble")}),o.jsxs("ul",{className:"remote-trouble",children:[o.jsx("li",{className:"modal-hint",children:_("remote.trouble.network")}),o.jsx("li",{className:"modal-hint",children:_("remote.vpnHint")}),t.sshUser.length>0&&o.jsx("li",{className:"modal-hint",children:_("remote.userHint",{user:t.sshUser})})]})]}),o.jsx("h3",{className:"modal-section",children:_("remote.step.pair")}),e===null||V===null?o.jsxs("div",{className:"vault-actions",children:[o.jsx("button",{className:"primary-button",onClick:c,disabled:!ta(t),children:_("remote.pair.start")}),!ta(t)&&o.jsx("span",{className:"modal-hint",children:_("remote.pair.needsActive")})]}):o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"modal-hint",children:_("remote.pair.open")}),o.jsxs("div",{className:"status-line-fragment",children:[o.jsx("pre",{className:"tool-pre",children:V}),o.jsx("button",{className:"link-button",onClick:()=>B("pairing",V),children:E==="pairing"?o.jsxs(o.Fragment,{children:["✓ ",_("remote.copied")]}):_("remote.copy")})]}),o.jsxs("p",{className:"modal-hint",children:[_("remote.pair.expires",{time:Sm(Cm(e.expiresAt,R))})," ",_("remote.pair.after",{url:Kv(t.port)})]}),o.jsx("div",{className:"vault-actions",children:o.jsx("button",{className:"link-button",onClick:m,children:_("remote.pair.cancel")})})]}),o.jsx("h3",{className:"modal-section",children:_("remote.phone.title")}),s===null?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"modal-hint",children:_("remote.phone.hint")}),o.jsxs("div",{className:"vault-actions",children:[o.jsx("button",{className:"primary-button",onClick:v,disabled:!ta(t),children:_("remote.phone.start")}),!ta(t)&&o.jsx("span",{className:"modal-hint",children:_("remote.pair.needsActive")})]})]}):o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"modal-hint",children:z5(s.shell)}),o.jsxs("div",{className:"status-line-fragment",children:[o.jsx("pre",{className:"tool-pre remote-phone-command",children:s.authorizeCommand}),o.jsx("button",{className:"link-button",onClick:()=>B("phone",s.authorizeCommand),children:E==="phone"?o.jsxs(o.Fragment,{children:["✓ ",_("remote.copied")]}):_("remote.copy")})]}),o.jsx("p",{className:"modal-hint",children:_("remote.phone.authorizeOnce")}),o.jsx("p",{className:"modal-hint",children:_("remote.phone.scan")}),o.jsx("div",{ref:P,children:o.jsx(iL,{payload:s.payload})}),o.jsx("p",{className:"modal-hint",children:_("remote.phone.secret")}),o.jsx("p",{className:"modal-hint",children:_("remote.pair.expires",{time:Sm(Cm(s.expiresAt,R))})}),o.jsx("div",{className:"vault-actions",children:o.jsx("button",{className:"link-button",onClick:h,children:_("remote.pair.cancel")})})]}),o.jsx("h3",{className:"modal-section",children:_("remote.devices")}),t.devices.length===0?o.jsx("p",{className:"modal-hint",children:_("remote.devices.empty")}):o.jsx("ul",{className:"remote-devices",children:t.devices.map(F=>o.jsx(oL,{device:F,onRename:H=>b(F.id,H),onRevoke:()=>T(F.id)},F.id))})]})]})})}function iL({payload:t}){const e=tL(t),s=e.size+yo*2;return o.jsxs("svg",{className:"remote-phone-qr",viewBox:`${-yo} ${-yo} ${s} ${s}`,role:"img","aria-label":_("remote.phone.qrLabel"),shapeRendering:"crispEdges",children:[o.jsx("rect",{x:-yo,y:-yo,width:s,height:s,fill:"#fff"}),o.jsx("path",{d:e.path,fill:"#000"})]})}function oL({device:t,onRename:e,onRevoke:s}){const[l,u]=M.useState(!1),[k,y]=M.useState(t.label),[i,c]=M.useState(!1),m=M.useRef(null);M.useEffect(()=>()=>{m.current!==null&&window.clearTimeout(m.current)},[]);const v=()=>{u(!1);const b=k.trim();b.length>0&&b!==t.label&&e(b)},h=()=>{if(i){s();return}c(!0),m.current=window.setTimeout(()=>c(!1),rL)};return o.jsxs("li",{className:"remote-device",children:[o.jsxs("div",{className:"remote-device-main",children:[l?o.jsx("input",{className:"remote-device-input",value:k,autoFocus:!0,onChange:b=>y(b.target.value),onBlur:v,onKeyDown:b=>{b.key==="Enter"&&v()}}):o.jsx("button",{className:"remote-device-label",onClick:()=>{y(t.label),u(!0)},title:_("remote.device.rename"),children:t.label}),o.jsx("span",{className:`remote-device-seen${t.connected?" remote-device-connected":""}`,children:$5(t)}),o.jsx("span",{className:"remote-device-paired",children:W5(t)})]}),o.jsx("button",{className:`link-button${i?" remote-device-confirm":""}`,onClick:h,children:_(i?"remote.device.revokeConfirm":"remote.device.revoke")})]})}const Iu="agent-workbench.notes-open",Lm="agent-workbench.notes-active",Nm="agent-workbench.notes-height",ju=160,lL=300;function aL(t){return t.text.trim().length===0?t.images.length>0?_("notes.imageOnly"):_("notes.untitled"):py(t)}function cL({notes:t,onSendNote:e,sendTargetCwd:s,fill:l,onHide:u}){const[k,y]=M.useState(()=>Nt(Iu,!1,W=>W==="true")),i=k||l,[c,m]=M.useState(()=>Nt(Nm,lL,W=>{const K=Number.parseInt(W,10);return Number.isFinite(K)?Math.max(K,ju):null})),[v,h]=M.useState(()=>Nt(Lm,null,W=>W)),[b,T]=M.useState(null),[N,w]=M.useState(null),[d,g]=M.useState(0),p=A5(),f=M.useMemo(()=>t.notes.length===0?null:t.notes.find(W=>W.noteId===v)??t.notes[t.notes.length-1]??null,[t.notes,v]),E=M.useCallback(W=>{h(W),kt(Lm,W),T(null)},[]),j=M.useCallback(()=>{y(W=>{const K=!W;return kt(Iu,String(K)),K})},[]),x=M.useCallback(()=>{const W=t.create();E(W),i||(y(!0),kt(Iu,"true")),g(K=>K+1)},[t,i,E]),R=M.useCallback(W=>{if(W.text.trim().length===0&&W.images.length===0){t.remove(W.noteId);return}E(W.noteId),T(W.noteId)},[t,E]),S=M.useCallback(()=>{b!==null&&t.remove(b),T(null)},[b,t]),L=M.useRef(null),I=M.useCallback(W=>{const K=W.currentTarget.parentElement,Y=K===null?c:Math.round(K.getBoundingClientRect().height);L.current={startY:W.clientY,startHeight:Y},W.currentTarget.setPointerCapture(W.pointerId),W.preventDefault()},[c]),P=M.useCallback(W=>{const K=L.current;if(K===null)return;const Y=Math.max(ju,Math.floor(window.innerHeight*.8));m(Math.min(Y,Math.max(ju,K.startHeight+K.startY-W.clientY)))},[]),O=M.useCallback(W=>{L.current!==null&&(L.current=null,W.currentTarget.releasePointerCapture(W.pointerId),kt(Nm,String(c)))},[c]);M.useEffect(()=>{if(N===null)return;const W=K=>{K.key==="Escape"&&(K.stopPropagation(),w(null))};return window.addEventListener("keydown",W,!0),()=>window.removeEventListener("keydown",W,!0)},[N]);const B=N===null?void 0:t.images[N],$=t.notes.length;return o.jsxs("section",{className:`notes${i?" notes-open":""}${l?" notes-fill":""}`,style:i&&!l?{height:`${c}px`}:void 0,children:[i&&!l&&o.jsx("div",{className:"notes-resize",onPointerDown:I,onPointerMove:P,onPointerUp:O,onPointerCancel:O,title:_("notes.resize")}),i?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"notes-header",children:[o.jsxs("div",{className:"strip-tabs",role:"tablist",children:[t.notes.map(W=>{const K=W.noteId===(f==null?void 0:f.noteId),Y=aL(W);return o.jsxs("div",{className:`strip-tab${K?" is-active":""}`,role:"tab","aria-selected":K,children:[o.jsx("button",{className:"strip-tab-label",onClick:()=>E(W.noteId),title:Y,children:Y}),o.jsx("button",{className:"strip-tab-close",onClick:()=>R(W),title:_("notes.closeNote"),children:"×"})]},W.noteId)}),o.jsx("button",{className:"strip-tab-new",onClick:x,title:_("notes.new"),children:"+"})]}),o.jsx("span",{className:"strip-spacer"}),o.jsx("button",{className:"icon-button thread-font-button",onClick:p.cycle,title:ha(p.size),"aria-label":ha(p.size),children:o.jsxs("span",{"aria-hidden":"true",children:["a",o.jsx("span",{className:"thread-font-big",children:"A"})]})}),!l&&o.jsx("button",{className:"icon-button",onClick:j,title:_("notes.collapse"),children:"▾"}),u!==void 0&&o.jsx(ca,{title:_("settings.hide.notes"),onHide:u,confirmText:null})]}),o.jsx("div",{className:"notes-body",children:$===0||f===null?o.jsx("p",{className:"notes-empty",children:rn("notes.empty")}):o.jsx(dL,{note:f,notes:t,closing:b===f.noteId,focusRequest:d,onConfirmClose:S,onCancelClose:()=>T(null),onOpenImage:w,onSend:e===null?null:()=>e(f.noteId),sendTargetCwd:s},f.noteId)})]}):o.jsxs("div",{className:"strip-collapsed-row",children:[o.jsxs("button",{className:"strip-collapsed",onClick:j,title:_("notes.expand"),children:[o.jsx("span",{className:"strip-collapsed-arrow",children:"▸"}),o.jsx("span",{children:_("notes.name")}),$>0&&o.jsx("span",{className:"strip-collapsed-count",children:$})]}),u!==void 0&&o.jsx(ca,{title:_("settings.hide.notes"),onHide:u,confirmText:null})]}),N!==null&&o.jsx("div",{className:"notes-lightbox",onClick:()=>w(null),title:_("notes.lightboxClose"),children:typeof B=="string"?o.jsx("img",{src:B,alt:_("notes.imageAlt")}):o.jsx("span",{className:"notes-lightbox-missing",children:_("notes.imageUnavailable")})})]})}function uL(){return o.jsx("svg",{viewBox:"0 0 24 24",width:"15",height:"15",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:o.jsx("path",{d:"M20 11.5 11.7 19.8a5 5 0 0 1-7.1-7.1l8.6-8.6a3.4 3.4 0 0 1 4.8 4.8l-8.5 8.5a1.8 1.8 0 0 1-2.5-2.5l7.9-7.9"})})}function hL(){return o.jsxs("svg",{viewBox:"0 0 24 24",width:"15",height:"15",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M21.5 2.5 11 13"}),o.jsx("path",{d:"M21.5 2.5 15 21.5l-4-8.5-8.5-4z"})]})}function dL({note:t,notes:e,closing:s,focusRequest:l,onConfirmClose:u,onCancelClose:k,onOpenImage:y,onSend:i,sendTargetCwd:c}){const m=M.useRef(null),[v,h]=M.useState(!1),b=t.text.trim().length===0&&t.images.length===0;M.useEffect(()=>{var w;l>0&&((w=m.current)==null||w.focus())},[l]);const T=M.useCallback(w=>{const d=Array.from(w).filter(g=>g.type.startsWith("image/"));for(const g of d)e.addImage(t.noteId,g);return d.length>0},[e,t.noteId]),N=M.useCallback(w=>{w.clipboardData!==null&&T(w.clipboardData.files)&&w.preventDefault()},[T]);return o.jsxs("div",{className:`note-editor${v?" note-editor-dragging":""}`,onDragOver:w=>{Array.from(w.dataTransfer.types).includes("Files")&&(w.preventDefault(),h(!0))},onDragLeave:()=>h(!1),onDrop:w=>{w.preventDefault(),h(!1),T(w.dataTransfer.files)},children:[s&&o.jsxs("div",{className:"note-closing",children:[o.jsx("span",{children:_("notes.closeConfirm")}),o.jsx("button",{className:"link-button link-danger",onClick:u,children:_("common.close")}),o.jsx("button",{className:"link-button",onClick:k,children:_("common.cancel")})]}),e.problem!==null&&o.jsxs("div",{className:"composer-problem",children:[o.jsx("span",{children:e.problem}),o.jsx("button",{className:"icon-button",onClick:e.dismissProblem,title:_("common.close"),children:"×"})]}),o.jsx("textarea",{ref:m,className:"note-input",value:t.text,placeholder:_("notes.placeholder"),onChange:w=>e.updateText(t.noteId,w.target.value),onPaste:N,spellCheck:!1}),t.images.length>0&&o.jsx("div",{className:"note-images",children:t.images.map(w=>o.jsx(fL,{image:w,src:e.images[w.imageId],onRequest:e.requestImage,onOpen:()=>y(w.imageId),onRemove:()=>e.removeImage(t.noteId,w.imageId)},w.imageId))}),o.jsxs("div",{className:"note-footer",children:[o.jsx("span",{className:"note-meta",children:Wn(t.updatedAt)}),o.jsx("span",{className:"composer-spacer"}),o.jsx("button",{className:"icon-button",onClick:()=>i==null?void 0:i(),disabled:i===null||b,title:Jb(i!==null,c,b),children:o.jsx(hL,{})}),o.jsxs("label",{className:"icon-button note-attach",title:_("notes.attach"),children:[o.jsx(uL,{}),o.jsx("input",{type:"file",accept:"image/png,image/jpeg,image/gif,image/webp",multiple:!0,hidden:!0,onChange:w=>{w.target.files!==null&&T(w.target.files),w.target.value=""}})]})]})]})}function fL({image:t,src:e,onRequest:s,onOpen:l,onRemove:u}){return M.useEffect(()=>{e===void 0&&s(t.imageId)},[e,t.imageId,s]),o.jsxs("figure",{className:"chip chip-image note-thumb",title:fn(t.bytes),children:[typeof e=="string"?o.jsx("img",{src:e,alt:_("notes.imageAlt"),onClick:l}):o.jsx("span",{className:"note-thumb-placeholder",children:e===null?_("notes.thumbMissing"):"…"}),o.jsx("button",{className:"chip-remove",onClick:u,title:_("notes.removeImage"),children:"×"})]})}function Yv(){const t=Ao(),e=hS(),[s,l]=M.useState(null),u=M.useCallback(()=>l(null),[]),k=M.useRef(null),y=m=>{aS(m).catch(()=>{})},i=[{label:_("header.locale.auto",{name:uu[oS()]}),checked:e==="auto",onSelect:()=>y("auto")},...gh.map(m=>({label:uu[m],lang:m,checked:e===m,onSelect:()=>y(m)}))],c=uu[t];return o.jsxs(o.Fragment,{children:[o.jsx("button",{ref:k,className:"icon-button locale-button",onClick:m=>{const v=m.currentTarget.getBoundingClientRect();l(h=>h===null?{x:v.left,y:v.bottom+4}:null)},title:e==="auto"?_("header.locale.titleAuto",{name:c}):_("header.locale.title",{name:c}),"aria-haspopup":"menu","aria-expanded":s!==null,children:hb[t]}),s!==null&&o.jsx(eh,{x:s.x,y:s.y,items:i,onClose:u,anchor:k.current})]})}function pL({onKey:t}){return o.jsx("div",{className:"narrow-keys",role:"toolbar","aria-label":_("narrow.keys.label"),children:hC.map(e=>o.jsx("button",{className:"narrow-key",onPointerDown:s=>s.preventDefault(),onClick:()=>t(e.data),title:_(e.titleKey),children:e.label},e.id))})}function mL({banners:t,status:e,statusLabel:s,terminals:l,activeTerminalId:u,activity:k,agents:y,offerAgentChoice:i,newTabAgent:c,platform:m,canOpen:v,newTabBlockedTitle:h,onSelectTab:b,onCloseTab:T,onRenameTab:N,onNewTab:w,drawer:d,drawerOpen:g,onDrawerChange:p,menu:f,view:E,views:j,onViewChange:x,badges:R,chat:S,panel:L,notes:I,console:P,onTerminalKey:O}){const[B,$]=M.useState(null),W=l.find(H=>H.terminalId===u)??null,K=H=>{var U;return((U=y.find(z=>z.id===H.agent))==null?void 0:U.statusLine)??null};M.useEffect(()=>{if(!g&&B===null)return;const H=U=>{U.key==="Escape"&&(U.preventDefault(),U.stopPropagation(),B!==null?$(null):p(!1))};return window.addEventListener("keydown",H,!0),()=>window.removeEventListener("keydown",H,!0)},[g,B,p]);const Y=M.useRef({sheet:B,drawerOpen:g,view:E,onDrawerChange:p,onViewChange:x});Y.current={sheet:B,drawerOpen:g,view:E,onDrawerChange:p,onViewChange:x},M.useEffect(()=>{const H=window;return H[bp]=()=>{const U=Y.current;switch(gC({dialogOpen:document.querySelector(".modal-backdrop")!==null,sheetOpen:U.sheet!==null,drawerOpen:U.drawerOpen,view:U.view})){case"close-dialog":return window.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:!0,cancelable:!0})),!0;case"close-sheet":return $(null),!0;case"close-drawer":return U.onDrawerChange(!1),!0;case"show-chat":return U.onViewChange("chat"),!0;case null:return!1}},()=>{delete H[bp]}},[]);const V=M.useRef(null);M.useEffect(()=>{var H;(H=V.current)==null||H.scrollIntoView({block:"nearest",inline:"nearest"})},[E]);const F=H=>{const U=H==="git"?R.changes:H==="plans"?R.plans:H==="memory"?R.memory:0;return U>0?o.jsx("span",{className:"side-panel-badge",children:U}):H==="cli"&&R.cliUnseen&&E!=="cli"?o.jsx("span",{className:"narrow-view-dot",title:_("panel.cliUnseen")}):null};return o.jsxs(o.Fragment,{children:[o.jsxs("header",{className:"app-header narrow-header",children:[o.jsx("button",{className:"icon-button narrow-icon",onClick:()=>p(!0),title:_("narrow.projects"),"aria-label":_("narrow.projects"),children:"☰"}),o.jsxs("button",{className:"narrow-current",onClick:()=>$("tabs"),title:_("narrow.tabs.open"),children:[W===null?o.jsx("span",{className:"app-name",children:"Agent Workbench"}):o.jsxs(o.Fragment,{children:[o.jsx(xh,{terminal:W,activity:k.get(W.terminalId),statusLine:K(W)}),o.jsx("span",{className:"project-swatch",style:{background:Us(Fs(W))}}),o.jsx("span",{className:"narrow-current-label",children:Lo(W)})]}),o.jsx("span",{className:"narrow-caret","aria-hidden":"true",children:"▾"})]}),e!=="open"&&o.jsx("span",{className:`status status-${e}`,children:s}),o.jsx("button",{className:"icon-button narrow-icon",onClick:()=>$("menu"),title:_("narrow.more"),"aria-label":_("narrow.more"),children:"⋮"})]}),t,o.jsxs("div",{className:"narrow-body",children:[o.jsx("nav",{className:"narrow-views",role:"tablist",children:j.map(H=>o.jsxs("button",{ref:H===E?V:null,role:"tab","aria-selected":H===E,className:`narrow-view-tab${H===E?" narrow-view-active":""}`,onClick:()=>x(H),children:[o.jsx("span",{children:_(lC(H))}),F(H)]},H))}),o.jsxs("div",{className:"narrow-stack",children:[o.jsx("main",{className:`workspace narrow-pane${E==="chat"?"":" narrow-pane-veiled"}`,children:S}),L,o.jsx("div",{className:`narrow-pane${E==="notes"?"":" narrow-pane-hidden"}`,children:I}),o.jsx("div",{className:`narrow-pane${E==="console"?"":" narrow-pane-hidden"}`,children:P})]}),O!==null&&o.jsx(pL,{onKey:O})]}),g&&o.jsx("div",{className:"narrow-backdrop",onClick:()=>p(!1),children:o.jsx("div",{className:"narrow-drawer",onClick:H=>H.stopPropagation(),children:d})}),B==="tabs"&&o.jsx("div",{className:"narrow-backdrop",onClick:()=>$(null),children:o.jsxs("div",{className:"narrow-sheet",role:"dialog","aria-label":_("narrow.tabs.open"),onClick:H=>H.stopPropagation(),children:[o.jsx(gL,{terminals:l,platform:m,activeTerminalId:u,activity:k,statusLineOf:K,onSelect:H=>{b(H),$(null)},onClose:T,onRename:N}),o.jsx(kh,{className:"narrow-sheet-new",text:_("narrow.tabs.new"),title:h??_("narrow.tabs.new"),disabled:!v||h!==null,offerAgentChoice:i,agents:y,agent:c,onOpen:H=>{w(H),$(null)}})]})}),B==="menu"&&o.jsx("div",{className:"narrow-backdrop",onClick:()=>$(null),children:o.jsx("div",{className:"narrow-sheet",role:"dialog","aria-label":_("narrow.more"),onClick:H=>H.stopPropagation(),children:o.jsx(_L,{menu:f,status:e,statusLabel:s,onClose:()=>$(null)})})})]})}function gL({terminals:t,platform:e,activeTerminalId:s,activity:l,statusLineOf:u,onSelect:k,onClose:y,onRename:i}){const[c,m]=M.useState(null),[v,h]=M.useState(""),b=M.useRef(null);M.useEffect(()=>{var N;c!==null&&((N=b.current)==null||N.select())},[c]);const T=()=>{c!==null&&i(c,v.trim()),m(null)};return t.length===0?o.jsx("p",{className:"narrow-sheet-empty",children:_("narrow.tabs.none")}):o.jsx("ul",{className:"narrow-tabs",children:t.map(N=>{const w=c===N.terminalId,d=Rv(N,t,e);return o.jsxs("li",{className:`narrow-tab-row${N.terminalId===s?" narrow-tab-active":""}`,style:{"--tab-project-color":Us(Fs(N))},children:[w?o.jsx("input",{ref:b,className:"narrow-tab-input",value:v,onChange:g=>h(g.target.value),onBlur:T,onKeyDown:g=>{g.key==="Enter"&&T(),g.key==="Escape"&&(g.stopPropagation(),m(null))}}):o.jsxs("button",{className:"narrow-tab-select",onClick:()=>k(N.terminalId),children:[o.jsx(xh,{terminal:N,activity:l.get(N.terminalId),statusLine:u(N)}),N.review&&o.jsx("span",{className:"tab-review",title:_("worktree.tab.reviewTitle"),children:_("worktree.tab.review")}),d!==null&&o.jsx("span",{className:"tab-branch",children:d}),o.jsx("span",{className:"narrow-tab-label",children:Lo(N)})]}),o.jsx("button",{className:"icon-button",onClick:()=>{m(N.terminalId),h(N.label.length>0?N.label:Lo(N))},title:_("narrow.tabs.rename"),children:"✎"}),o.jsx("button",{className:"icon-button",onClick:()=>y(N.terminalId),title:_("narrow.tabs.close"),children:"×"})]},N.terminalId)})})}function vL({choice:t}){const e=[{source:"system",label:_("narrow.menu.chimeSystem")},{source:"page",label:_("narrow.menu.chimePage")}];return o.jsx("div",{className:"narrow-chime-choice",role:"group","aria-label":_("narrow.menu.sound"),children:e.map(({source:s,label:l})=>o.jsx("button",{className:`narrow-chime-option${t.source===s?" is-on":""}`,"aria-pressed":t.source===s,onClick:()=>t.setSource(s),children:l},s))})}function _L({menu:t,status:e,statusLabel:s,onClose:l}){return o.jsxs("div",{className:"narrow-menu",children:[o.jsxs("div",{className:"narrow-menu-row",children:[o.jsx("span",{className:"narrow-menu-label",children:_("narrow.menu.connection")}),o.jsx("span",{className:`status status-${e}`,children:s}),Bg(navigator.userAgent)&&o.jsxs(o.Fragment,{children:[o.jsx("a",{className:"link-button",href:mC,onClick:l,children:_("narrow.menu.phoneAppDisconnect")}),o.jsx("a",{className:"link-button",href:pC,onClick:l,children:_("narrow.menu.phoneAppSettings")})]})]}),t.cwd!==null&&o.jsxs("div",{className:"narrow-menu-row",children:[o.jsx("span",{className:"narrow-menu-label",children:_("narrow.menu.folder")}),o.jsx("span",{className:"narrow-menu-value",title:t.cwd,children:t.cwd})]}),t.cliVersion!==null&&o.jsxs("div",{className:"narrow-menu-row",children:[o.jsx("span",{className:"narrow-menu-label",children:_("narrow.menu.cli")}),o.jsx("span",{className:"narrow-menu-value",title:t.cliVersion,children:t.cliVersion})]}),t.remoteClient&&o.jsxs("div",{className:"narrow-menu-row",children:[o.jsx("span",{className:"narrow-menu-label",children:_("app.header.remoteBadge")}),o.jsx("span",{className:"narrow-menu-value narrow-menu-value-wrap",children:_("app.header.remoteBadgeTitle")})]}),o.jsxs("div",{className:"narrow-menu-row",children:[o.jsx("span",{className:"narrow-menu-label",children:_("narrow.menu.theme")}),o.jsx("button",{className:"icon-button",onClick:t.onCycleTheme,title:t.themeTitle,children:t.themeIcon})]}),o.jsxs("div",{className:"narrow-menu-row",children:[o.jsx("span",{className:"narrow-menu-label",children:_("narrow.menu.language")}),o.jsx(Yv,{})]}),o.jsxs("div",{className:"narrow-menu-row",children:[o.jsx("span",{className:"narrow-menu-label",children:_("narrow.menu.sound")}),t.sound.phoneChime===null?o.jsx(qv,{sound:t.sound}):o.jsx(vL,{choice:t.sound.phoneChime})]}),t.sound.notify.supported&&o.jsxs("div",{className:"narrow-menu-row",children:[o.jsx("span",{className:"narrow-menu-label",children:_("narrow.menu.notifications")}),o.jsx(Vv,{notify:t.sound.notify})]}),t.remote!==null&&o.jsxs("div",{className:"narrow-menu-row",children:[o.jsx("span",{className:"narrow-menu-label",children:_("app.header.remoteAccess")}),o.jsx("button",{className:`icon-button${t.remote.active?" icon-button-on":""}`,onClick:()=>{var u;l(),(u=t.remote)==null||u.onOpen()},title:t.remote.title,children:"⇄"})]}),o.jsxs("div",{className:"narrow-menu-row",children:[o.jsx("span",{className:"narrow-menu-label",children:_("narrow.menu.shortcuts")}),o.jsx("button",{className:"icon-button",onClick:()=>{l(),t.onShortcuts()},title:_("app.header.shortcuts"),children:"?"})]}),o.jsxs("div",{className:"narrow-menu-row",children:[o.jsx("span",{className:"narrow-menu-label",children:_("settings.title")}),o.jsx("button",{className:"icon-button",onClick:()=>{l(),t.onSettings()},title:_("settings.open"),"aria-label":_("settings.open"),children:"⚙"})]})]})}function wL(){const t=window.location.search,e=new URLSearchParams(t).get(Fu),s=e!==null&&e.length>0?e:null,l=cC(t);return s===null&&l===null?{token:s,tab:l}:(window.history.replaceState(null,"",`${window.location.pathname}${uC(t,[Fu,Pg])}`),{token:s,tab:l})}const Xv=wL(),Rm=Xv.token,yL=Xv.tab,Du=new Set;function bL(t){const[e,s]=M.useState(null),[l,u]=M.useState(null),[k,y]=M.useState(Du),[i,c]=M.useState(null);M.useEffect(()=>{const d=t.onMessage(p=>{switch(p.type){case"vault.status":s(p.status);break;case"vault.exported":y(f=>{if(!f.has(p.projectKey))return f;const E=new Set(f);return E.delete(p.projectKey),E}),c({projectKey:p.projectKey,sessions:p.sessions,at:Date.now()});break;case"error":if(p.code!=="vault-failed")break;u(At(p.text)),p.detail!==void 0&&console.error("[servidor]",p.detail),y(Du);break}}),g=t.onReopen(()=>y(Du));return()=>{d(),g()}},[t]);const m=M.useCallback(()=>{u(null),t.send({type:"vault.measure"})},[t]),v=M.useCallback(d=>{u(null),t.send({type:"vault.enable",enabled:d})},[t]),h=M.useCallback(d=>{u(null),t.send({type:"vault.setDir",pickerId:d})},[t]),b=M.useCallback(d=>{u(null),y(g=>new Set(g).add(d)),t.send({type:"vault.exportProject",projectKey:d})},[t]),T=M.useCallback((d,g)=>{u(null),t.send({type:"vault.openSession",agent:d,sessionId:g})},[t]),N=M.useCallback(()=>{u(null),t.send({type:"vault.reveal"})},[t]),w=M.useCallback(()=>u(null),[]);return{status:e,problem:l,exporting:k,lastExported:i,measure:m,setEnabled:v,chooseDir:h,exportProject:b,openSession:T,reveal:N,dismissProblem:w}}function kL(t){return _("summary.outdatedServer",{server:t,page:Ti})}function CL(t){const[e,...s]=t;if(e===void 0||e.missingMessage===null)return null;const l=At(e.missingMessage);return s.length===0?l:`${l}
|
|
155
|
+
${_("summary.alsoWorksWith",{names:s.map(u=>u.label).join(", ")})}`}function SL(t){const e=t.version??"?";return e.toLowerCase().includes(t.label.toLowerCase())?e:`${t.label} ${e}`}function xL(t,e,s=Ti){var y,i;if(e&&s<Ti)return{cliAvailable:!1,cliVersion:null,cliMissingMessage:kL(s),environmentNotice:null};if(e&&s>Ti)return{cliAvailable:!1,cliVersion:null,cliMissingMessage:_("summary.newerServer",{server:s,page:Ti}),environmentNotice:null};const l=t.filter(c=>c.available);let u=null;l.length===1?u=((y=l[0])==null?void 0:y.version)??null:l.length>1&&(u=l.map(SL).join(" · "));const k=e&&l.length===0;return{cliAvailable:!e||l.length>0,cliVersion:u,cliMissingMessage:k?CL(t):null,environmentNotice:((i=t.find(c=>c.environmentNotice!==null))==null?void 0:i.environmentNotice)??null}}const EL=500,TL=8e3;class LL{constructor(){$t(this,"socket",null);$t(this,"status","connecting");$t(this,"attempt",0);$t(this,"closedByUs",!1);$t(this,"hasConnectedOnce",!1);$t(this,"reconnectTimer");$t(this,"messageHandlers",new Set);$t(this,"statusHandlers",new Set);$t(this,"reopenHandlers",new Set);$t(this,"outbox",[])}getStatus(){return this.status}onMessage(e){return this.messageHandlers.add(e),()=>this.messageHandlers.delete(e)}onStatus(e){return this.statusHandlers.add(e),()=>this.statusHandlers.delete(e)}onReopen(e){return this.reopenHandlers.add(e),()=>this.reopenHandlers.delete(e)}connect(){if(this.socket!==null)return;const e=new URL(zy,window.location.href);e.protocol=window.location.protocol==="https:"?"wss:":"ws:",Rm!==null&&e.searchParams.set(Fu,Rm);const s=new WebSocket(e);this.socket=s,s.onopen=()=>{for(this.attempt=0,this.setStatus("open");this.outbox.length>0;){const l=this.outbox.shift();l!==void 0&&s.send(np(l))}if(this.hasConnectedOnce)for(const l of this.reopenHandlers)l();this.hasConnectedOnce=!0},s.onmessage=l=>{const u=Jy(l.data);if(u===null){console.warn("[conexion] mensaje del servidor no reconocido");return}for(const k of this.messageHandlers)k(u)},s.onclose=l=>{if(this.socket=null,!this.closedByUs){if(l.code===Iy){this.setStatus("revoked");return}this.setStatus("reconnecting"),this.scheduleReconnect()}},s.onerror=()=>{}}send(e){return this.socket!==null&&this.socket.readyState===WebSocket.OPEN?(this.socket.send(np(e)),!0):(e.type!=="input"&&e.type!=="resize"&&this.outbox.push(e),!1)}close(){var e;this.closedByUs=!0,window.clearTimeout(this.reconnectTimer),(e=this.socket)==null||e.close(),this.socket=null}setStatus(e){if(this.status!==e){this.status=e;for(const s of this.statusHandlers)s(e)}}scheduleReconnect(){if(this.attempt+=1,!this.hasConnectedOnce&&this.attempt>4){this.setStatus("failed");return}const e=Math.min(EL*2**(this.attempt-1),TL);window.clearTimeout(this.reconnectTimer),this.reconnectTimer=window.setTimeout(()=>this.connect(),e)}}const Qv=new Set;function NL(t){return t!==void 0&&Qv.has(t)}function $n(){const t=crypto.randomUUID();return Qv.add(t),t}function Jv(t,e){return t.reason==="requested"&&e!==null&&(t.requestId===void 0||t.requestId===e)}const Mm={rows:[],kept:[]};function RL(t,e,s){const[l,u]=M.useState(Mm);return M.useEffect(()=>{if(u(Mm),e===null)return;const k=()=>{t.send({type:"worktree.status",terminalId:e})},y=t.onMessage(c=>{c.type==="worktree.rows"&&c.terminalId===e&&u({rows:c.rows,kept:c.kept??[]}),c.type==="worktree.changed"&&k()}),i=t.onReopen(k);return()=>{y(),i()}},[t,e]),M.useEffect(()=>{e!==null&&s>0&&t.send({type:"worktree.status",terminalId:e})},[t,e,s]),l}function ML(t,e,s){const[l,u]=M.useState(null),[k,y]=M.useState(null),[i,c]=M.useState(null),m=M.useRef(null),v=M.useRef(null),h=M.useRef(null),b=M.useRef(null),T=M.useRef(null);M.useEffect(()=>t.onMessage(W=>{switch(W.type){case"worktree.inspected":if(W.requestId!==m.current)break;u(K=>K===null?null:{...K,state:{phase:"ready",inspection:W.inspection}});break;case"terminal.opened":if(W.requestId===m.current){m.current=null,u(null);const K=v.current;v.current=null,K==null||K()}break;case"worktree.removePlan":if(W.requestId!==h.current)break;y(K=>K===null?null:{...K,state:{phase:"ready",plan:W.plan}});break;case"worktree.removed":if(W.requestId!==h.current)break;h.current=null,y(K=>K===null?null:{...K,state:{phase:"done",outcome:W.outcome}});break;case"worktree.deleteBranchPlan":if(W.requestId!==T.current)break;c(K=>K===null?null:{...K,state:{phase:"ready",plan:W.plan}});break;case"worktree.branchDeleted":if(W.requestId!==T.current)break;T.current=null,c(K=>K===null?null:{...K,state:{phase:"done"}});break;case"composer.prefill":Jv(W,b.current)&&(b.current=null,s(W.terminalId));break;case"error":{const K=At(W.text);W.requestId!==void 0&&W.requestId===m.current&&(m.current=null,u(Y=>{if(Y===null)return null;const V=Y.state.phase==="loading"?null:Y.state.inspection;return{...Y,state:{phase:"failed",inspection:V,message:K}}})),W.requestId!==void 0&&W.requestId===h.current&&(h.current=null,y(Y=>{if(Y===null)return null;const V=Y.state.phase==="ready"||Y.state.phase==="removing"?Y.state.plan:null;return{...Y,state:{phase:"failed",plan:V,message:K}}})),W.requestId!==void 0&&W.requestId===T.current&&(T.current=null,c(Y=>{if(Y===null)return null;const V=Y.state.phase==="ready"||Y.state.phase==="deleting"?Y.state.plan:null;return{...Y,state:{phase:"failed",plan:V,message:K}}})),W.requestId!==void 0&&W.requestId===b.current&&(b.current=null);break}}}),[t,s]);const N=M.useCallback((W,K,Y,V)=>{const F=$n();m.current=F,v.current=V??null,u({source:W,projectCwd:K,projectName:Y,state:{phase:"loading"}}),t.send({type:"worktree.inspect",requestId:F,source:W})},[t]),w=M.useCallback(W=>{if(l===null||l.state.phase!=="ready"&&l.state.phase!=="failed")return;const{inspection:K}=l.state;if(K===null)return;const Y=$n();m.current=Y,u({...l,state:{phase:"creating",inspection:K}}),e(Y,{cwd:l.projectCwd,label:W.branch,agent:W.agent??null}),t.send({type:"worktree.create",requestId:Y,source:l.source,branch:W.branch,base:W.base,mode:W.mode,copyNotes:W.copyNotes,...W.agent!==void 0?{agent:W.agent}:{}})},[t,l,e]),d=M.useCallback(()=>{(l==null?void 0:l.state.phase)!=="creating"&&(m.current=null,v.current=null),u(null)},[l]),g=M.useCallback(W=>{const K=$n();h.current=K,t.send({type:"worktree.planRemove",requestId:K,worktreeId:W})},[t]),p=M.useCallback((W,K)=>{y({worktreeId:W,branch:K,state:{phase:"loading"},acceptedFiles:null}),g(W)},[g]),f=M.useCallback((W,K,Y,V)=>{const F=$n();h.current=F,y({...W,acceptedFiles:V,state:{phase:"removing",plan:K}});const H=Io(K,V)?V:null;t.send({type:"worktree.remove",requestId:F,worktreeId:W.worktreeId,discardConflicts:Y,...H!==null?{discardUntracked:H}:{}})},[t]),E=M.useCallback(W=>{k===null||k.state.phase!=="ready"||f(k,k.state.plan,W,k.acceptedFiles)},[k,f]),j=M.useCallback(()=>{var Y;if(k===null||k.state.phase!=="ready")return;const{plan:W}=k.state,K=((Y=W.untracked)==null?void 0:Y.stamp)??null;K!==null&&(Iv(W,K)==="remove"?f(k,W,!1,K):y({...k,acceptedFiles:K}))},[k,f]),x=M.useCallback(W=>{if(k===null)return;const K=crypto.randomUUID();b.current=K,e(K,null),t.send({type:W,requestId:K,worktreeId:k.worktreeId}),h.current=null,y(null)},[t,e,k]),R=M.useCallback(()=>x("worktree.askNotes"),[x]),S=M.useCallback(()=>x("worktree.askCommit"),[x]),L=M.useCallback(()=>{k!==null&&(y({...k,state:{phase:"loading"}}),g(k.worktreeId))},[g,k]),I=M.useCallback(()=>{h.current=null,y(null)},[]),P=M.useCallback((W,K,Y,V)=>{const F=crypto.randomUUID();e(F,{cwd:Y,label:V,agent:W}),t.send({type:"worktree.reopen",requestId:F,agent:W,sessionId:K})},[t,e]),O=M.useCallback((W,K)=>{const Y=$n();T.current=Y,c({worktreeId:W,branch:K,state:{phase:"loading"}}),t.send({type:"worktree.planDeleteBranch",requestId:Y,worktreeId:W})},[t]),B=M.useCallback(()=>{if(i===null||i.state.phase!=="ready"||i.state.plan.blocker!==null)return;const W=$n();T.current=W,c({...i,state:{phase:"deleting",plan:i.state.plan}}),t.send({type:"worktree.deleteBranch",requestId:W,worktreeId:i.worktreeId})},[t,i]),$=M.useCallback(()=>{T.current=null,c(null)},[]);return{create:l,openCreate:N,submitCreate:w,closeCreate:d,remove:k,openRemove:p,confirmRemove:E,discardFiles:j,askNotes:R,askCommit:S,retryRemove:L,closeRemove:I,reopen:P,deleteBranch:i,openDeleteBranch:O,confirmDeleteBranch:B,closeDeleteBranch:$}}function AL(t,e,s){const[l,u]=M.useState(null),[k,y]=M.useState(null),[i,c]=M.useState(null),m=M.useRef(null),v=M.useRef(null),h=M.useRef(null),b=M.useRef(null),T=M.useRef(null);M.useEffect(()=>t.onMessage(P=>{switch(P.type){case"worktree.branchChanges":if(P.requestId!==m.current)break;m.current=null,u(O=>O===null?null:{...O,state:{phase:"ready",changes:P.changes}});break;case"worktree.branchDiff":if(P.requestId!==v.current)break;v.current=null,u(O=>O===null||O.diff===null?O:{...O,diff:{...O.diff,diff:P.diff}});break;case"worktree.reviewPlan":if(P.requestId!==h.current)break;h.current=null,y(O=>O===null?null:{...O,state:{phase:"ready",plan:P.plan}});break;case"terminal.opened":P.requestId!==void 0&&P.requestId===h.current&&(h.current=null,y(null));break;case"worktree.integratePlan":if(P.requestId!==b.current)break;b.current=null,c(O=>O===null?null:{...O,state:{phase:"ready",plan:P.plan}});break;case"worktree.integrated":if(P.requestId!==b.current)break;b.current=null,c(O=>{if(O===null)return null;const B=O.state.phase==="integrating"?O.state.plan:null;return B===null?O:{...O,state:{phase:"done",plan:B,outcome:P.outcome}}});break;case"composer.prefill":Jv(P,T.current)&&(T.current=null,s(P.terminalId));break;case"error":{const{requestId:O}=P;if(O===void 0)break;const B=At(P.text);O===m.current&&(m.current=null,u($=>$===null?null:{...$,state:{phase:"failed",message:B}})),O===v.current&&(v.current=null,u($=>$===null||$.diff===null?$:{...$,diff:{...$.diff,message:B}})),O===h.current&&(h.current=null,y($=>{if($===null)return null;const W=$.state.phase==="loading"||$.state.phase==="failed"?null:$.state.plan;return{...$,state:{phase:"failed",plan:W,message:B}}})),O===b.current&&(b.current=null,c($=>{if($===null)return null;const W=$.state.phase==="ready"||$.state.phase==="integrating"?$.state.plan:null;return{...$,state:{phase:"failed",plan:W,message:B}}})),O===T.current&&(T.current=null);break}}}),[t,s]);const N=M.useCallback((P,O)=>{const B=$n();m.current=B,v.current=null,u({worktreeId:P,branch:O,state:{phase:"loading"},diff:null}),t.send({type:"worktree.changes",requestId:B,worktreeId:P})},[t]),w=M.useCallback(P=>{if(l===null)return;const O=$n();v.current=O,u({...l,diff:{path:P,diff:null,message:null}}),t.send({type:"worktree.changesDiff",requestId:O,worktreeId:l.worktreeId,path:P})},[t,l]),d=M.useCallback(()=>{v.current=null,u(P=>P===null?null:{...P,diff:null})},[]),g=M.useCallback(()=>{m.current=null,v.current=null,u(null)},[]),p=M.useCallback((P,O,B)=>{const $=$n();h.current=$,y({worktreeId:P,branch:O,projectCwd:B,state:{phase:"loading"}}),t.send({type:"worktree.planReview",requestId:$,worktreeId:P})},[t]),f=M.useCallback(P=>{if(k===null||k.state.phase!=="ready"&&k.state.phase!=="failed")return;const{plan:O}=k.state;if(O===null)return;const B=$n();h.current=B,y({...k,state:{phase:"requesting",plan:O}});const $=k.projectCwd.split(/[\\/]/).filter(W=>W.length>0).pop()??k.projectCwd;e(B,{cwd:k.projectCwd,label:$,agent:P}),t.send({type:"worktree.requestReview",requestId:B,worktreeId:k.worktreeId,agent:P})},[t,e,k]),E=M.useCallback(()=>{(k==null?void 0:k.state.phase)!=="requesting"&&(h.current=null),y(null)},[k]),j=M.useCallback((P,O)=>{const B=$n();b.current=B,c({worktreeId:P,branch:O,state:{phase:"loading"}}),t.send({type:"worktree.planIntegrate",requestId:B,worktreeId:P})},[t]),x=M.useCallback(()=>{if(i===null||i.state.phase!=="ready")return;const P=$n();b.current=P;const{plan:O}=i.state;c({...i,state:{phase:"integrating",plan:O}}),t.send({type:"worktree.integrate",requestId:P,worktreeId:i.worktreeId,...O.branchCommit!==null?{branchCommit:O.branchCommit}:{}})},[t,i]),R=M.useCallback(()=>{b.current=null,c(null)},[]),S=M.useCallback((P,O)=>{const B=crypto.randomUUID();T.current=B,e(B,null),t.send({type:P,requestId:B,worktreeId:O})},[t,e]),L=M.useCallback(P=>S("worktree.sendReview",P),[S]),I=M.useCallback(P=>S("worktree.catchUp",P),[S]);return{changes:l,openChanges:N,openChangeDiff:w,closeChangeDiff:d,closeChanges:g,review:k,openReview:p,submitReview:f,closeReview:E,integrate:i,openIntegrate:j,confirmIntegrate:x,closeIntegrate:R,sendReview:L,catchUp:I}}const ah="agent-workbench.activeTab";function IL(){try{return window.sessionStorage.getItem(ah)}catch{return null}}const jL={state:"idle",scannedFiles:0,totalFiles:0};function DL(t,e,s){const l=new Map(s?[]:t.map(u=>[u.key,u]));for(const u of e)l.set(u.key,u);return[...l.values()].sort((u,k)=>k.lastActivityAt-u.lastActivityAt)}function PL(){const t=M.useMemo(()=>new LL,[]),e=M.useMemo(()=>new zk({send:(he,Ve)=>t.send({type:"composer.draft",terminalId:he,draft:Ve}),connected:()=>t.getStatus()==="open",setTimer:(he,Ve)=>window.setTimeout(he,Ve),clearTimer:he=>window.clearTimeout(he),newId:()=>crypto.randomUUID()}),[t]),[s,l]=M.useState("connecting"),[u,k]=M.useState([]),[y,i]=M.useState(null),[c,m]=M.useState(!1),[v,h]=M.useState(Ti),[b,T]=M.useState(""),[N,w]=M.useState(""),[d,g]=M.useState(null),[p,f]=M.useState(!1),[E,j]=M.useState(!1),[x,R]=M.useState(!1),[S,L]=M.useState([]),[I,P]=M.useState([]),[O,B]=M.useState(jL),[$,W]=M.useState(IL);M.useEffect(()=>{try{$===null?window.sessionStorage.removeItem(ah):window.sessionStorage.setItem(ah,$)}catch{}},[$]);const[K,Y]=M.useState(new Set),[V,F]=M.useState(new Map),[H,U]=M.useState(new Map),z=M.useRef(new Map),te=M.useRef(new Map),[ie,we]=M.useState(new Set),[ge,X]=M.useState(null),[G,ee]=M.useState([]),[Z,ve]=M.useState(new Map),[Se,Ie]=M.useState([]),je=M.useRef(1),[Je,tt]=M.useState(new Map),Ne=M.useRef(new Set),ce=M.useRef(new Map),dt=M.useRef(new Map),se=M.useCallback(he=>{const Ve=dt.current.get(he);Ve!==void 0&&(clearTimeout(Ve),dt.current.delete(he)),ee(ut=>ut.some(be=>be.requestId===he)?ut.filter(be=>be.requestId!==he):ut)},[]),fe=M.useCallback(()=>{for(const he of dt.current.values())clearTimeout(he);dt.current.clear(),ee(he=>he.length===0?he:[])},[]);M.useEffect(()=>{const he=t.onStatus(be=>{l(be),be==="failed"&&X({message:_("workspace.connectFailed"),at:Date.now()})}),Ve=t.onMessage(be=>{switch(be.type){case"agents":k(be.agents),i(be.defaultAgent);break;case"hello":k(be.agents),i(be.defaultAgent),m(!0),h(be.protocolVersion),T(be.platform),w(be.defaultCwd),g(be.shellName),f(be.remoteClient),j(be.fileCheck),R(be.fileWrite);break;case"terminal.list":{L(be.terminals),e.retain(be.terminals.map(Ke=>Ke.terminalId));const nt=bk(te.current,be.terminals),St=nt.finished.length>0||[...nt.phases].some(([Ke,mt])=>te.current.get(Ke)!==mt);te.current=nt.phases,St&&we(new Set(nt.phases.keys())),Y(Ke=>{if(Ke.size===0)return Ke;const mt=new Set(Ke);for(const ot of Ke){if(nt.phases.has(ot))continue;const Pt=be.terminals.find(zn=>zn.terminalId===ot);(Pt===void 0||Pt.alive)&&mt.delete(ot)}return mt.size===Ke.size?Ke:mt}),U(Ke=>{if(Ke.size===0)return Ke;const mt=new Map([...Ke].filter(([ot])=>be.terminals.some(Pt=>Pt.terminalId===ot)));return mt.size===Ke.size?Ke:(z.current=mt,mt)});const pt=be.terminals.filter(Ke=>Ke.kind==="agent");W(Ke=>{var mt;return Ke!==null&&pt.some(ot=>ot.terminalId===Ke)?Ke:((mt=pt[0])==null?void 0:mt.terminalId)??null}),ve(Ke=>{if(Ke.size===0)return Ke;const mt=new Map(Ke);for(const ot of Ke.keys())be.terminals.some(Pt=>Pt.terminalId===ot)||mt.delete(ot);return mt.size===Ke.size?Ke:mt}),tt(Ke=>{if(Ke.size===0)return Ke;const mt=new Map([...Ke].filter(([ot])=>be.terminals.some(Pt=>Pt.terminalId===ot)));return mt.size===Ke.size?Ke:mt});break}case"session.continued":ve(nt=>new Map(nt).set(be.terminalId,{sourceAgent:be.source.agent,includedTurns:be.includedTurns,totalTurns:be.totalTurns,totalTurnsIsMinimum:be.totalTurnsIsMinimum,delivery:be.delivery,prefillReason:null}));break;case"composer.prefill":{const nt=je.current;je.current+=1,Ie(pt=>[...pt,{id:nt,terminalId:be.terminalId,text:be.text,pasted:be.pasted??[],focus:be.reason==="queue-edit"}]);const{reason:St}=be;if(St==="returned-by-cli"||St==="stopped-early"){tt(pt=>pt.get(be.terminalId)===St?pt:new Map(pt).set(be.terminalId,St));break}if(St==="rewound"||St==="requested"||St==="queue-edit")break;ve(pt=>{const Ke=pt.get(be.terminalId);return Ke===void 0?pt:new Map(pt).set(be.terminalId,{...Ke,delivery:"prefilled",prefillReason:St})});break}case"composer.drafts":e.restore(be.drafts);break;case"terminal.opened":{se(be.requestId),Ne.current.delete(be.requestId)&&be.terminal.kind==="agent"&&W(be.terminal.terminalId);const nt=ce.current.get(be.requestId);nt!==void 0&&(ce.current.delete(be.requestId),nt(be.terminal));break}case"terminal.activity":F(nt=>nt.get(be.terminalId)===be.activity?nt:new Map(nt).set(be.terminalId,be.activity)),U(nt=>{const St=be.offlineReason??null;if((nt.get(be.terminalId)??null)===St)return nt;const pt=new Map(nt);return St===null?pt.delete(be.terminalId):pt.set(be.terminalId,St),z.current=pt,pt});break;case"index.status":B(be.status);break;case"index.projects":P(nt=>DL(nt,be.projects,be.replace));break;case"error":if(NL(be.requestId)){be.detail!==void 0&&console.error("[servidor]",be.detail),be.requestId!==void 0&&(Ne.current.delete(be.requestId),ce.current.delete(be.requestId),se(be.requestId));break}if(XT(be.requestId)){be.detail!==void 0&&console.error("[servidor]",be.detail);break}if(be.code==="vault-failed"||be.code==="search-failed"||be.code==="remote-failed"||be.code==="settings-failed"||be.code==="rewind-failed")break;X({message:At(be.text),at:Date.now()}),Y(nt=>nt.size===0?nt:new Set),te.current.size>0&&(te.current=new Map,we(new Set)),be.detail!==void 0&&console.error("[servidor]",be.detail),be.requestId!==void 0&&(Ne.current.delete(be.requestId),ce.current.delete(be.requestId),se(be.requestId));break}}),ut=t.onReopen(()=>{fe(),Y(be=>be.size===0?be:new Set),te.current.size>0&&(te.current=new Map,we(new Set))});return t.connect(),()=>{he(),Ve(),ut(),t.close()}},[t,e,se,fe]),M.useEffect(()=>{const he=t.onReopen(()=>e.reconnected()),Ve=()=>e.flushAll(),ut=()=>{document.visibilityState==="hidden"&&e.flushAll()};return window.addEventListener("pagehide",Ve),document.addEventListener("visibilitychange",ut),()=>{he(),window.removeEventListener("pagehide",Ve),document.removeEventListener("visibilitychange",ut)}},[t,e]),M.useEffect(()=>fe,[fe]);const Ce=M.useCallback(he=>{const Ve=crypto.randomUUID();Ne.current.add(Ve),he.onOpened!==void 0&&ce.current.set(Ve,he.onOpened),ee(be=>[...be,{requestId:Ve,cwd:he.cwd,agent:he.agent??null,label:he.label??"",at:Date.now()}]);const ut=setTimeout(()=>se(Ve),hp);dt.current.set(Ve,ut),t.send({type:"terminal.open",requestId:Ve,cwd:he.cwd,...he.resumeSessionId!==void 0?{resumeSessionId:he.resumeSessionId}:{},...he.label!==void 0?{label:he.label}:{},...he.agent!==void 0?{agent:he.agent}:{}})},[t,se]),ye=M.useCallback(he=>{t.send({type:"terminal.open",requestId:crypto.randomUUID(),cwd:he,kind:"shell"})},[t]),_e=M.useCallback(he=>t.send({type:"terminal.close",terminalId:he}),[t]),Te=M.useCallback(he=>{Y(Ve=>new Set(Ve).add(he)),z.current.get(he)==="server-closed"&&(te.current=new Map(te.current).set(he,"waiting-exit"),we(new Set(te.current.keys()))),t.send({type:"terminal.wake",terminalId:he})},[t]),ue=M.useCallback((he,Ve)=>t.send({type:"terminal.rename",terminalId:he,label:Ve}),[t]),Fe=M.useCallback(he=>t.send({type:"tabs.reorder",terminalIds:he}),[t]),$e=M.useCallback((he,Ve)=>t.send({type:"session.archive",sessionIds:he,archived:Ve}),[t]),Ye=M.useCallback((he,Ve,ut)=>{const be=crypto.randomUUID();Ne.current.add(be),t.send({type:"session.continue",requestId:be,agent:he.agent,sessionId:he.sessionId,target:Ve,label:ut})},[t]),De=M.useCallback((he,Ve)=>{if(Ne.current.add(he),Ve===null)return;ee(be=>[...be,{requestId:he,...Ve,at:Date.now()}]);const ut=setTimeout(()=>se(he),hp);dt.current.set(he,ut)},[se]),He=M.useCallback(he=>{ve(Ve=>{if(!Ve.has(he))return Ve;const ut=new Map(Ve);return ut.delete(he),ut})},[]),qe=M.useCallback(he=>{tt(Ve=>{if(!Ve.has(he))return Ve;const ut=new Map(Ve);return ut.delete(he),ut})},[]),xt=M.useCallback(he=>{Ie(Ve=>Ve.some(ut=>ut.id===he)?Ve.filter(ut=>ut.id!==he):Ve)},[]),It=M.useCallback(()=>t.send({type:"index.refresh"}),[t]),jt=M.useCallback(()=>t.send({type:"agents.refresh"}),[t]),gt=M.useCallback(()=>X(null),[]),Kt=M.useMemo(()=>S.filter(he=>he.kind==="agent"),[S]),Ft=M.useMemo(()=>S.filter(he=>he.kind==="shell"),[S]),pe=Ao(),Ze=M.useMemo(()=>xL(u,c,v),[u,c,v,pe]),Qe=M.useCallback(he=>{var Ve;return(he===null||(Ve=u.find(ut=>ut.id===he))==null?void 0:Ve.capabilities)??Vm},[u]),ct=M.useMemo(()=>uh(u),[u]);return{connection:t,status:s,agents:u,defaultAgent:y,capabilitiesFor:Qe,offerAgentChoice:ct,cliAvailable:Ze.cliAvailable,cliVersion:Ze.cliVersion,cliMissingMessage:Ze.cliMissingMessage,platform:b,defaultCwd:N,environmentNotice:Ze.environmentNotice,shellName:d,remoteClient:p,fileCheck:E,fileWrite:x,terminals:Kt,shells:Ft,pendingOpens:G,activeTerminalId:$,projects:I,indexStatus:O,error:ge,dismissError:gt,setActiveTerminal:W,openTerminal:Ce,openShell:ye,closeTerminal:_e,wakeTerminal:Te,waking:K,activity:V,offlineReasons:H,relaunching:ie,renameTerminal:ue,reorderTabs:Fe,refreshIndex:It,refreshAgents:jt,archiveSessions:$e,continueSession:Ye,expectTab:De,handoffs:Z,dismissHandoff:He,returnedMessages:Je,dismissReturned:qe,prefills:Se,prefillApplied:xt,drafts:e}}function OL({dialog:t,agents:e,offerAgentChoice:s,agent:l,onSubmit:u,onClose:k}){const{state:y}=t,i=y.phase==="loading"?null:y.inspection,[c,m]=M.useState("new"),[v,h]=M.useState(""),[b,T]=M.useState(""),[N,w]=M.useState(""),[d,g]=M.useState(l),[p,f]=M.useState(!0);M.useEffect(()=>{const B=$=>{$.key==="Escape"&&($.preventDefault(),$.stopPropagation(),k())};return window.addEventListener("keydown",B,!0),()=>window.removeEventListener("keydown",B,!0)},[k]),M.useEffect(()=>{var B;i===null||N.length>0||w(i.currentBranch??((B=i.branches[0])==null?void 0:B.name)??"")},[i,N]);const E=M.useMemo(()=>(i==null?void 0:i.branches.filter(B=>!B.checkedOut).map(B=>B.name))??[],[i]);M.useEffect(()=>{b.length===0&&E[0]!==void 0&&T(E[0])},[b,E]);const j=e.filter(B=>B.available),x=c==="new"?v.trim():b,R=c==="new"?N:(i==null?void 0:i.currentBranch)??N,S=i===null?null:_E(i,x,c,R),L=y.phase==="creating",I=i!==null&&!L&&x.length>0&&S===null,P=()=>{I&&u({branch:x,base:R,mode:c,copyNotes:p,...s&&d!==null?{agent:d}:{}})},O=_("worktree.create.title");return o.jsx("div",{className:"modal-backdrop",onClick:k,children:o.jsxs("div",{className:"modal worktree-dialog",role:"dialog","aria-label":O,onClick:B=>B.stopPropagation(),children:[o.jsxs("header",{className:"modal-header",children:[o.jsx("span",{className:"modal-title",children:O}),o.jsx("button",{className:"icon-button",onClick:k,title:_("common.close"),children:"×"})]}),o.jsxs("div",{className:"modal-body",children:[o.jsx("p",{className:"modal-hint",children:_("worktree.create.intro",{project:t.projectName})}),y.phase==="loading"&&o.jsx("p",{className:"modal-hint",children:_("worktree.create.loading")}),i!==null&&o.jsxs("form",{className:"worktree-form",onSubmit:B=>{B.preventDefault(),P()},children:[o.jsxs("label",{className:"worktree-field",children:[o.jsx("span",{className:"worktree-label",children:_("worktree.create.branch")}),c==="new"?o.jsx("input",{className:"worktree-input",value:v,onChange:B=>h(B.target.value),placeholder:_("worktree.create.branchPlaceholder"),spellCheck:!1,autoFocus:!0,disabled:L}):o.jsx("select",{className:"worktree-input",value:b,onChange:B=>T(B.target.value),disabled:L||E.length===0,children:E.map(B=>o.jsx("option",{value:B,children:B},B))})]}),o.jsxs("div",{className:"worktree-modes",role:"radiogroup",children:[o.jsxs("label",{className:"worktree-mode",children:[o.jsx("input",{type:"radio",checked:c==="new",onChange:()=>m("new"),disabled:L}),o.jsx("span",{children:_("worktree.create.modeNew")}),o.jsx("select",{className:"worktree-input worktree-base",value:N,onChange:B=>w(B.target.value),disabled:L||c!=="new",children:i.branches.map(B=>o.jsx("option",{value:B.name,children:B.name},B.name))})]}),o.jsxs("label",{className:"worktree-mode",children:[o.jsx("input",{type:"radio",checked:c==="existing",onChange:()=>m("existing"),disabled:L||E.length===0}),o.jsx("span",{children:_("worktree.create.modeExisting")})]}),E.length===0&&o.jsx("p",{className:"modal-hint",children:_("worktree.create.noFreeBranch")})]}),s&&j.length>1&&o.jsxs("label",{className:"worktree-field",children:[o.jsx("span",{className:"worktree-label",children:_("worktree.create.agent")}),o.jsx("select",{className:"worktree-input",value:d??"",onChange:B=>{var $;return g((($=j.find(W=>W.id===B.target.value))==null?void 0:$.id)??null)},disabled:L,children:j.map(B=>o.jsx("option",{value:B.id,children:B.label},B.id))})]}),S!==null&&o.jsx("p",{className:"worktree-problem",children:S}),o.jsx("h3",{className:"modal-section",children:_("worktree.create.copySection")}),i.notes.files===0?o.jsx("p",{className:"modal-hint",children:_("worktree.create.copyNone")}):o.jsxs("label",{className:"worktree-check",children:[o.jsx("input",{type:"checkbox",checked:p,onChange:B=>f(B.target.checked),disabled:L}),o.jsxs("span",{children:[_("worktree.create.copyNotes"),o.jsxs("span",{className:"modal-hint",children:[" ",i.notes.overCap?_("worktree.create.overCap",{summary:ea(i.notes)}):_("worktree.create.copyList",{summary:ea(i.notes),list:pn(i.notes.sample)})]})]})]}),i.include!==null&&o.jsx("p",{className:"modal-hint",children:i.include.overCap?_("worktree.create.includeOverCap",{summary:ea(i.include)}):_("worktree.create.include",{summary:ea(i.include)})}),i.mainChanges>0&&o.jsx("p",{className:"worktree-warning",children:_("worktree.create.mainChanges",{count:i.mainChanges})}),x.length>0&&S===null&&o.jsxs(o.Fragment,{children:[o.jsx("h3",{className:"modal-section",children:_("worktree.create.folder")}),o.jsx("p",{className:"worktree-path",children:Mv(i,x)}),o.jsx("h3",{className:"modal-section",children:_("worktree.create.command")}),o.jsx("pre",{className:"tool-pre worktree-command",children:yE(i,x,R,c)})]}),y.phase==="failed"&&o.jsx("p",{className:"worktree-problem",children:y.message}),o.jsxs("div",{className:"worktree-actions",children:[o.jsx("button",{type:"button",className:"link-button",onClick:k,children:_("common.cancel")}),o.jsx("button",{type:"submit",className:"primary-button",disabled:!I,children:_(L?"worktree.create.creating":"worktree.create.submit")})]})]}),y.phase==="failed"&&i===null&&o.jsx("p",{className:"worktree-problem",children:y.message})]})]})})}function BL({dialog:t,onConfirm:e,onClose:s}){const{state:l}=t;M.useEffect(()=>{const c=m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),s())};return window.addEventListener("keydown",c,!0),()=>window.removeEventListener("keydown",c,!0)},[s]);const u=l.phase==="ready"||l.phase==="deleting"||l.phase==="failed"?l.plan:null,k=u===null?null:ME(u),y=l.phase==="deleting",i=_("worktree.deleteBranch.title",{branch:t.branch});return o.jsx("div",{className:"modal-backdrop",onClick:s,children:o.jsxs("div",{className:"modal worktree-dialog",role:"dialog","aria-label":i,onClick:c=>c.stopPropagation(),children:[o.jsxs("header",{className:"modal-header",children:[o.jsx("span",{className:"modal-title",children:i}),o.jsx("button",{className:"icon-button",onClick:s,title:_("common.close"),children:"×"})]}),o.jsxs("div",{className:"modal-body",children:[l.phase==="loading"&&o.jsx("p",{className:"modal-hint",children:_("worktree.deleteBranch.loading")}),l.phase==="done"&&o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"modal-hint",children:_("worktree.deleteBranch.done",{branch:t.branch})}),o.jsx("div",{className:"worktree-actions",children:o.jsx("button",{className:"primary-button",onClick:s,children:_("common.close")})})]}),u!==null&&o.jsxs(o.Fragment,{children:[k!==null?o.jsx("p",{className:"worktree-problem",children:k}):o.jsx("p",{className:"modal-hint",children:_("worktree.deleteBranch.intro",{base:u.base})}),o.jsx("h3",{className:"modal-section",children:_("worktree.integrate.folder")}),o.jsx("p",{className:"worktree-path",children:u.folder}),o.jsx("h3",{className:"modal-section",children:_("worktree.integrate.command")}),o.jsx("pre",{className:"tool-pre worktree-command",children:u.command}),l.phase==="failed"&&o.jsx("p",{className:"worktree-problem",children:l.message}),o.jsxs("div",{className:"worktree-actions",children:[o.jsx("button",{className:"link-button",onClick:s,children:_("common.cancel")}),o.jsx("button",{className:"primary-button",onClick:e,disabled:y||k!==null||l.phase==="failed",children:_(y?"worktree.deleteBranch.deleting":"worktree.deleteBranch.submit")})]})]}),l.phase==="failed"&&u===null&&o.jsx("p",{className:"worktree-problem",children:l.message})]})]})})}function Zv({returning:t,merging:e,resolved:s}){const[l,u]=M.useState(!1),k=s.length>0?o.jsx("p",{className:"modal-hint",children:_("worktree.notes.resolved",{count:s.length,list:pn(s)})}):null;if(t.length===0)return k;const y=new Set(e);return o.jsxs(o.Fragment,{children:[k,o.jsxs("p",{className:"modal-hint",children:[_("worktree.notes.back",{count:t.length})," ",y.size>0&&o.jsxs(o.Fragment,{children:[_("worktree.notes.merged",{count:y.size})," "]}),o.jsx("button",{className:"link-button worktree-notes-toggle",onClick:()=>u(!l),"aria-expanded":l,children:_(l?"worktree.notes.hide":"worktree.notes.show")})]}),l&&o.jsx("ul",{className:"worktree-notes-list",children:t.map(i=>o.jsxs("li",{children:[i,y.has(i)&&o.jsx("span",{className:"worktree-notes-mark",children:_("worktree.notes.mergedMark")})]},i))})]})}function FL({dialog:t,agentLabel:e,onConfirm:s,onRemove:l,onClose:u}){const{state:k}=t;M.useEffect(()=>{const v=h=>{h.key==="Escape"&&(h.preventDefault(),h.stopPropagation(),u())};return window.addEventListener("keydown",v,!0),()=>window.removeEventListener("keydown",v,!0)},[u]);const y=k.phase==="loading"?null:k.plan,i=y===null?null:TE(y),c=k.phase==="integrating",m=y===null?_("worktree.integrate.titleLoading",{branch:t.branch}):_("worktree.integrate.title",{branch:y.branch,base:y.base});return o.jsx("div",{className:"modal-backdrop",onClick:u,children:o.jsxs("div",{className:"modal worktree-dialog",role:"dialog","aria-label":m,onClick:v=>v.stopPropagation(),children:[o.jsxs("header",{className:"modal-header",children:[o.jsx("span",{className:"modal-title",children:m}),o.jsx("button",{className:"icon-button",onClick:u,title:_("common.close"),children:"×"})]}),o.jsxs("div",{className:"modal-body",children:[k.phase==="loading"&&o.jsx("p",{className:"modal-hint",children:_("worktree.integrate.loading")}),k.phase==="done"&&o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"modal-hint",children:_("worktree.integrate.done",{base:k.outcome.base,count:k.outcome.commits})}),k.outcome.notes!==void 0&&k.outcome.notes.returned>0&&o.jsx("p",{className:"modal-hint",children:_("worktree.notes.returned",{count:k.outcome.notes.returned})}),k.outcome.notes!==void 0&&k.outcome.notes.stayed.length>0&&o.jsx("p",{className:"worktree-warning",children:_("worktree.integrate.notesStayed",{list:pn(k.outcome.notes.stayed)})}),o.jsx("p",{className:"modal-hint",children:_("worktree.integrate.doneOthers",{base:k.outcome.base})}),o.jsxs("div",{className:"worktree-actions",children:[o.jsx("button",{className:"link-button",onClick:u,children:_("common.close")}),o.jsx("button",{className:"primary-button",onClick:l,title:_("worktree.integrate.removeTitle"),children:_("worktree.integrate.remove")})]})]}),y!==null&&k.phase!=="done"&&o.jsxs(o.Fragment,{children:[i!==null?o.jsx("p",{className:"worktree-problem",children:i}):o.jsx("p",{className:"modal-hint",children:_("worktree.integrate.intro",{base:y.base,count:y.ahead})}),y.fileCount>0&&o.jsx("p",{className:"modal-hint",children:_("worktree.integrate.files",{count:y.fileCount,list:`${pn(y.files)}${y.fileCount>y.files.length?"…":""}`})}),y.notes!==null&&o.jsx(Zv,{returning:y.notes.returning,merging:y.notes.merging,resolved:y.notes.resolved}),y.notes!==null&&y.notes.conflicts.length>0&&o.jsx("p",{className:"worktree-warning",children:_("worktree.integrate.notesStay",{list:pn(y.notes.conflicts)})}),o.jsx("p",{className:y.review===null||y.review.state==="done"&&y.review.verdict==="ready"&&!y.review.stale?"modal-hint":"worktree-warning",children:y.review===null?_("worktree.integrate.noReview"):Av(y.review,e(y.review.agent))}),y.tabs.length>0&&o.jsx("p",{className:"modal-hint",children:_("worktree.integrate.tabs",{list:pn(y.tabs.map(v=>v.label))})}),y.branchUncommitted>0&&o.jsx("p",{className:"worktree-warning",children:_("worktree.integrate.branchUncommitted",{count:y.branchUncommitted})}),y.command!==null&&y.baseFolder!==null&&o.jsxs(o.Fragment,{children:[o.jsx("h3",{className:"modal-section",children:_("worktree.integrate.folder")}),o.jsx("p",{className:"worktree-path",children:y.baseFolder}),o.jsx("h3",{className:"modal-section",children:_("worktree.integrate.command")}),o.jsx("pre",{className:"tool-pre worktree-command",children:y.command})]}),k.phase==="failed"&&o.jsx("p",{className:"worktree-problem",children:k.message}),o.jsxs("div",{className:"worktree-actions",children:[o.jsx("button",{className:"link-button",onClick:u,children:_("common.cancel")}),o.jsx("button",{className:"primary-button",onClick:s,disabled:c||i!==null||k.phase==="failed",children:_(c?"worktree.integrate.integrating":"worktree.integrate.submit")})]})]}),k.phase==="failed"&&y===null&&o.jsx("p",{className:"worktree-problem",children:k.message})]})]})})}function HL({dialog:t,onConfirm:e,onDiscardFiles:s,onAskNotes:l,onAskCommit:u,onRetry:k,onClose:y}){var g;const{state:i,acceptedFiles:c}=t;M.useEffect(()=>{const p=f=>{f.key==="Escape"&&(f.preventDefault(),f.stopPropagation(),y())};return window.addEventListener("keydown",p,!0),()=>window.removeEventListener("keydown",p,!0)},[y]);const m=i.phase==="ready"||i.phase==="removing"||i.phase==="failed"?i.plan:null,v=i.phase==="removing",h=i.phase==="failed",b=m===null||h?null:Iv(m,c),T=m!==null&&!h&&IE(m,c),N=m===null?null:DE(m,c),w=_("worktree.remove.title",{branch:t.branch}),d=h?{label:_("worktree.remove.retry"),hint:void 0,run:k}:b==="ask-commit"&&m!==null?{label:_("worktree.remove.askCommit",{count:((g=m.untracked)==null?void 0:g.stamp)!=null&&m.untracked.files>0?m.untracked.files:m.uncommittedCount}),hint:_("worktree.remove.askTitle"),run:u}:b==="retry"?{label:_("worktree.remove.retry"),hint:void 0,run:k}:b==="ask-notes"?{label:_("worktree.remove.askNotes"),hint:_("worktree.remove.askTitle"),run:l}:b==="remove"?{label:_("worktree.remove.submit"),hint:void 0,run:()=>e(!1)}:null;return o.jsx("div",{className:"modal-backdrop",onClick:y,children:o.jsxs("div",{className:"modal worktree-dialog",role:"dialog","aria-label":w,onClick:p=>p.stopPropagation(),children:[o.jsxs("header",{className:"modal-header",children:[o.jsx("span",{className:"modal-title",children:w}),o.jsx("button",{className:"icon-button",onClick:y,title:_("common.close"),children:"×"})]}),o.jsxs("div",{className:"modal-body",children:[i.phase==="loading"&&o.jsx("p",{className:"modal-hint",children:_("worktree.remove.loading")}),i.phase==="done"&&o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"modal-hint",children:_("worktree.remove.done")}),i.outcome.returned>0&&o.jsx("p",{className:"modal-hint",children:_("worktree.notes.returned",{count:i.outcome.returned})}),i.outcome.discarded>0&&o.jsx("p",{className:"modal-hint",children:_("worktree.remove.doneDiscarded",{count:i.outcome.discarded})}),i.outcome.discardedFiles>0&&o.jsx("p",{className:"modal-hint",children:_("worktree.remove.doneDiscardedFiles",{count:i.outcome.discardedFiles})}),i.outcome.branchDeleted&&o.jsx("p",{className:"modal-hint",children:_("worktree.remove.doneBranch")}),o.jsx("div",{className:"worktree-actions",children:o.jsx("button",{className:"primary-button",onClick:y,children:_("common.close")})})]}),m!==null&&i.phase!=="done"&&o.jsxs(o.Fragment,{children:[m.uncommittedCount>0&&o.jsxs("p",{className:Io(m,c)?"worktree-warning":"worktree-problem",children:[N??_("worktree.remove.uncommitted",{count:m.uncommittedCount})," ",o.jsx("span",{className:"worktree-files",children:OE(m)})]}),m.inUse===!0&&o.jsx("p",{className:"worktree-problem",children:PE(m)}),m.conflicts.length>0&&o.jsx("p",{className:"worktree-warning",children:_("worktree.remove.conflicts",{list:pn(m.conflicts)})}),o.jsx("p",{className:"modal-hint",children:BE(m)}),o.jsx(Zv,{returning:m.returning,merging:m.merging,resolved:m.resolved}),m.tabs.length>0&&o.jsx("p",{className:"modal-hint",children:_("worktree.remove.tabs",{list:pn(m.tabs.map(p=>p.label))})}),m.commands.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("h3",{className:"modal-section",children:_("worktree.remove.commands")}),o.jsx("pre",{className:"tool-pre worktree-command",children:m.commands.join(`
|
|
156
|
+
`)})]})]}),h&&o.jsx("p",{className:"worktree-problem",children:i.message}),i.phase!=="loading"&&i.phase!=="done"&&o.jsxs("div",{className:"worktree-actions",children:[o.jsx("button",{className:"link-button",onClick:y,children:_("common.cancel")}),T&&o.jsx("button",{className:"link-button",onClick:s,disabled:v,children:_("worktree.remove.discardFiles")}),b==="ask-notes"&&o.jsx("button",{className:"link-button",onClick:()=>e(!0),disabled:v,children:_("worktree.remove.discard")}),d!==null&&o.jsx("button",{className:"primary-button",onClick:d.run,title:d.hint,disabled:v,children:v?_("worktree.remove.removing"):d.label})]})]})]})})}function UL({dialog:t,agents:e,onSubmit:s,onClose:l}){var g;const{state:u}=t,k=u.phase==="loading"?null:u.plan,y=M.useMemo(()=>NE(e),[e]),i=k===null?null:Xw(k.author,y),[c,m]=M.useState(null),v=c??i,h=e.find(p=>p.id===v)??null,b=p=>{var f;return((f=e.find(E=>E.id===p))==null?void 0:f.label)??p};M.useEffect(()=>{const p=f=>{f.key==="Escape"&&(f.preventDefault(),f.stopPropagation(),l())};return window.addEventListener("keydown",p,!0),()=>window.removeEventListener("keydown",p,!0)},[l]);const T=u.phase==="requesting",N=k!==null&&k.ahead===0&&k.uncommitted===0,w=k!==null&&h!==null&&!T&&!N,d=_("worktree.review.title",{branch:t.branch});return o.jsx("div",{className:"modal-backdrop",onClick:l,children:o.jsxs("div",{className:"modal worktree-dialog",role:"dialog","aria-label":d,onClick:p=>p.stopPropagation(),children:[o.jsxs("header",{className:"modal-header",children:[o.jsx("span",{className:"modal-title",children:d}),o.jsx("button",{className:"icon-button",onClick:l,title:_("common.close"),children:"×"})]}),o.jsxs("div",{className:"modal-body",children:[u.phase==="loading"&&o.jsx("p",{className:"modal-hint",children:_("worktree.review.loading")}),k!==null&&o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"modal-hint",children:_("worktree.review.intro",{base:k.base})}),N?o.jsx("p",{className:"worktree-problem",children:_("worktree.review.nothing",{base:k.base})}):o.jsxs(o.Fragment,{children:[y.length>1?o.jsxs("label",{className:"worktree-field",children:[o.jsx("span",{className:"worktree-label",children:_("worktree.review.reviewer")}),o.jsx("select",{className:"worktree-input",value:v??"",onChange:p=>{var f;return m(((f=y.find(E=>E.id===p.target.value))==null?void 0:f.id)??null)},disabled:T,children:y.map(p=>o.jsx("option",{value:p.id,children:b(p.id)},p.id))})]}):h!==null&&o.jsx("p",{className:"modal-hint",children:_("worktree.review.sameCli",{agent:h.label})}),k.author!==null&&y.length>1&&o.jsx("p",{className:"modal-hint",children:_("worktree.review.author",{agent:b(k.author)})}),h!==null&&o.jsxs(o.Fragment,{children:[o.jsx("p",{className:((g=h.capabilities.readOnlyLaunch)==null?void 0:g.guard)==="cli"?"modal-hint":"worktree-warning",children:LE(h.capabilities,h.label)}),o.jsx("p",{className:"modal-hint",children:h.capabilities.readySignal?_("worktree.review.deliverySent"):_("worktree.review.deliveryPrefill")})]}),k.branchBusy&&o.jsx("p",{className:"worktree-warning",children:_("worktree.review.branchBusy")}),k.uncommitted>0&&o.jsx("p",{className:"modal-hint",children:_("worktree.review.uncommitted",{count:k.uncommitted})}),o.jsx("p",{className:"modal-hint",children:_("worktree.review.quota")}),o.jsx("h3",{className:"modal-section",children:_("worktree.review.prompt")}),o.jsx("pre",{className:"tool-pre worktree-command worktree-prompt",children:k.prompt})]}),u.phase==="failed"&&o.jsx("p",{className:"worktree-problem",children:u.message}),o.jsxs("div",{className:"worktree-actions",children:[o.jsx("button",{className:"link-button",onClick:l,children:_("common.cancel")}),o.jsx("button",{className:"primary-button",disabled:!w,onClick:()=>{w&&v!==null&&s(v)},children:_(T?"worktree.review.requesting":"worktree.review.submit")})]})]}),u.phase==="failed"&&k===null&&o.jsx("p",{className:"worktree-problem",children:u.message})]})]})})}const Th=["git","files","plans","memory","console","notes"],Am="agent-workbench.hiddenPanels";function $L(t){return Th.includes(t)}const WL=new Set(["memory"]),zL="none";function qL(t){return new Set(t.split(",").map(e=>e.trim()).filter($L))}function VL(t){const e=Th.filter(s=>t.has(s));return e.length===0?zL:e.join(",")}function KL(t,e,s){const l=new Set(t);return s?l.delete(e):l.add(e),l}function GL(){const[t,e]=M.useState(()=>Nt(Am,WL,qL)),s=M.useCallback((u,k)=>{e(y=>{const i=KL(y,u,k);return kt(Am,VL(i)),i})},[]),l=M.useCallback(u=>!t.has(u),[t]);return{hidden:t,isVisible:l,setVisible:s}}const YL={git:"panel.tab.git",files:"panel.tab.files",plans:"panel.tab.plans",memory:"panel.tab.memory",console:"console.name",notes:"notes.name"},XL={dark:"settings.terminalTheme.dark",follow:"settings.terminalTheme.follow"};function QL(t,e,s){const l=t.filter(u=>u!==e);return s?[...l,e]:l}function JL(t,e){return t.length===e.length&&t.every(s=>e.includes(s))}function ZL({onClose:t,terminalTheme:e,panels:s,consoleCount:l,onHideConsole:u,appSettings:k,agents:y,remoteClient:i,onOpenVault:c,onOpenRemote:m}){const[v,h]=M.useState(!1),b=k.status,T=b!==null&&!i,[N,w]=M.useState(null),[d,g]=M.useState(null);M.useEffect(()=>{w(null),g(null)},[b,k.problem]);const p=N??(b==null?void 0:b.consoleShell)??"auto",f=d??(b==null?void 0:b.disabledAgents)??[];M.useEffect(()=>{const S=L=>{L.key==="Escape"&&(L.preventDefault(),L.stopPropagation(),t())};return window.addEventListener("keydown",S,!0),()=>window.removeEventListener("keydown",S,!0)},[t]);const E=(S,L)=>{if(S==="console"&&!L&&l>0){h(!0);return}s.setVisible(S,L)},j=(b==null?void 0:b.consoleShells.find(S=>S.id!=="git-bash"&&S.id!=="zsh"))??null,x=b!==null&&!JL(b.disabledAgents,b.disabledAtStart),R=b===null?[]:[{id:"auto",label:j===null?_("settings.console.auto"):_("settings.console.autoWith",{shell:j.label})},...b.consoleShells];return o.jsx("div",{className:"modal-backdrop",onClick:t,children:o.jsxs("div",{className:"modal settings-dialog",role:"dialog","aria-label":_("settings.title"),onClick:S=>S.stopPropagation(),children:[o.jsxs("header",{className:"modal-header",children:[o.jsx("span",{className:"modal-title",children:_("settings.title")}),o.jsx("button",{className:"icon-button",onClick:t,title:_("common.closeEsc"),children:"×"})]}),o.jsxs("div",{className:"modal-body settings-body",children:[o.jsx("h3",{className:"modal-section",children:_("settings.section.appearance")}),o.jsxs("div",{className:"settings-row",children:[o.jsx("span",{className:"settings-label",children:_("settings.language")}),o.jsx(Yv,{})]}),o.jsxs("div",{className:"settings-row settings-row-top",children:[o.jsx("span",{className:"settings-label",children:_("settings.terminalTheme")}),o.jsxs("div",{className:"settings-choices",role:"radiogroup","aria-label":_("settings.terminalTheme"),children:[["dark","follow"].map(S=>o.jsxs("label",{className:"settings-choice",children:[o.jsx("input",{type:"radio",name:"terminal-theme",checked:e.preference===S,onChange:()=>e.setPreference(S)}),_(XL[S])]},S)),o.jsx("p",{className:"modal-hint",children:_("settings.terminalTheme.hint")})]})]}),o.jsx("h3",{className:"modal-section",children:_("settings.section.panels")}),o.jsx("div",{className:"settings-panels",children:Th.map(S=>o.jsxs("label",{className:"settings-choice",children:[o.jsx("input",{type:"checkbox",checked:s.isVisible(S),onChange:L=>E(S,L.target.checked)}),_(YL[S])]},S))}),v&&o.jsxs("div",{className:"settings-confirm",role:"alert",children:[o.jsx("span",{children:_("settings.panels.consoleConfirm",{count:l})}),o.jsx("button",{className:"link-button",onClick:()=>{h(!1),u()},children:_("settings.panels.consoleConfirmYes")}),o.jsx("button",{className:"link-button",onClick:()=>h(!1),children:_("common.cancel")})]}),o.jsx("p",{className:"modal-hint",children:_("settings.panels.cliAlways")}),b===null?o.jsx("p",{className:"modal-hint",children:_("settings.oldServer")}):o.jsxs(o.Fragment,{children:[o.jsx("h3",{className:"modal-section",children:_("settings.section.console")}),b.consoleShells.length===0?o.jsx("p",{className:"modal-hint",children:_("console.noShell")}):o.jsxs("div",{className:"settings-choices",role:"radiogroup","aria-label":_("settings.section.console"),children:[R.map(S=>o.jsxs("label",{className:"settings-choice",children:[o.jsx("input",{type:"radio",name:"console-shell",checked:p===S.id,disabled:!T,onChange:()=>{w(S.id),k.setConsoleShell(S.id)}}),S.label]},S.id)),o.jsx("p",{className:"modal-hint",children:_("settings.console.hint")})]}),o.jsx("h3",{className:"modal-section",children:_("settings.section.clis")}),o.jsx("ul",{className:"settings-clis",children:y.map(S=>{const L=f.includes(S.id),I=b.disabledAtStart.includes(S.id),P=S.available||I;return o.jsxs("li",{className:"settings-cli",children:[P?o.jsxs("label",{className:"settings-choice",children:[o.jsx("input",{type:"checkbox",checked:!L,disabled:!T,onChange:O=>{const B=QL(f,S.id,!O.target.checked);g(B),k.setDisabledAgents(B)}}),o.jsx("span",{className:"settings-cli-name",children:S.label})]}):o.jsx("span",{className:"settings-cli-name settings-cli-missing",children:S.label}),o.jsx("span",{className:"settings-cli-detail",children:S.available?S.version??"":_(I?"settings.cli.disabled":"settings.cli.notInstalled")}),!P&&o.jsx("a",{className:"link-button",href:S.installUrl,target:"_blank",rel:"noreferrer noopener",children:_("settings.cli.install")})]},S.id)})}),o.jsx("p",{className:"modal-hint",children:_("settings.cli.hint")}),x&&o.jsx("p",{className:"settings-restart",children:_("settings.cli.restart")}),i&&o.jsx("p",{className:"modal-hint",children:_("settings.hostOnly")}),k.problem!==null&&o.jsxs("p",{className:"settings-problem",role:"alert",children:[k.problem,o.jsx("button",{className:"link-button",onClick:k.dismissProblem,children:_("common.close")})]})]}),(c!==null||m!==null)&&o.jsxs(o.Fragment,{children:[o.jsx("h3",{className:"modal-section",children:_("settings.section.more")}),o.jsxs("div",{className:"settings-row settings-more",children:[c!==null&&o.jsx("button",{className:"primary-button primary-button-small",onClick:c,children:_("settings.more.open",{name:Mi()})}),m!==null&&o.jsx("button",{className:"primary-button primary-button-small",onClick:m,children:_("settings.more.open",{name:_("app.header.remoteAccess")})})]})]})]})]})})}function e2(t){const[e,s]=M.useState(null),[l,u]=M.useState(null);M.useEffect(()=>t.onMessage(c=>{switch(c.type){case"settings.status":s(c.settings),u(null);break;case"error":if(c.code!=="settings-failed")break;u(At(c.text)),c.detail!==void 0&&console.error("[servidor]",c.detail);break}}),[t]);const k=M.useCallback(c=>t.send({type:"settings.update",consoleShell:c}),[t]),y=M.useCallback(c=>t.send({type:"settings.update",disabledAgents:c}),[t]),i=M.useCallback(()=>u(null),[]);return{status:e,problem:l,setConsoleShell:k,setDisabledAgents:y,dismissProblem:i}}function t2({status:t,agents:e,indexReady:s,problem:l,covered:u,onMeasure:k,onSetEnabled:y,onChangeDir:i,onReveal:c,onDismissProblem:m,onClose:v}){return M.useEffect(()=>{if(u)return;const h=b=>{b.key==="Escape"&&(b.preventDefault(),b.stopPropagation(),v())};return window.addEventListener("keydown",h,!0),()=>window.removeEventListener("keydown",h,!0)},[u,v]),o.jsx("div",{className:"modal-backdrop",onClick:v,children:o.jsxs("div",{className:"modal vault-modal",role:"dialog","aria-label":Mi(),onClick:h=>h.stopPropagation(),children:[o.jsxs("header",{className:"modal-header",children:[o.jsx("span",{className:"modal-title",children:Mi()}),t!==null&&o.jsx("span",{className:`vault-state${t.enabled?" vault-state-on":""}`,children:jx(t)}),o.jsx("button",{className:"icon-button",onClick:v,title:_("common.closeEsc"),children:"×"})]}),o.jsxs("div",{className:"modal-body",children:[o.jsx("p",{className:"vault-lead",children:Nx()}),o.jsx("p",{className:"modal-hint",children:Rx()}),t===null?o.jsx("p",{className:"modal-hint",children:_("vault.dialog.waiting")}):o.jsx(n2,{status:t,agents:e,indexReady:s,onMeasure:k,onSetEnabled:y,onChangeDir:i,onReveal:c}),l!==null&&o.jsxs("div",{className:"vault-problem",role:"alert",children:[o.jsx("span",{children:l}),o.jsx("button",{className:"icon-button",onClick:m,title:_("common.dismissNotice"),children:"×"})]})]})]})})}function n2({status:t,agents:e,indexReady:s,onMeasure:l,onSetEnabled:u,onChangeDir:k,onReveal:y}){const i=Bx(t,s),c=Fx(t),m=Ox(t),v=t.measurement===null?null:$x(t.measurement,e),h=t.progress;return o.jsxs(o.Fragment,{children:[t.enabled&&o.jsxs(o.Fragment,{children:[o.jsx("h3",{className:"modal-section",children:_("vault.dialog.inFolder")}),o.jsxs("p",{className:"vault-summary",children:[bv(t.sessions)," · ",fn(t.bytes),t.lastPassAt!==null&&o.jsxs(o.Fragment,{children:[" · ",_("vault.dialog.lastPass",{when:Wn(t.lastPassAt)})]}),t.pending>0&&o.jsxs(o.Fragment,{children:[" · ",_("vault.dialog.pendingCalm",{count:t.pending})]})]})]}),h!==null&&h.total>0&&o.jsx("progress",{className:"vault-progress",value:h.done,max:h.total}),o.jsx("h3",{className:"modal-section",children:_("vault.dialog.sizeSection")}),o.jsxs("div",{className:"vault-actions",children:[o.jsx("button",{className:"link-button vault-measure",onClick:l,disabled:i!==null,title:i??_("vault.dialog.measureTitle"),children:t.state==="measuring"?_("vault.state.measuring"):_(v===null?"vault.dialog.measure":"vault.dialog.measureAgain")}),v!==null&&o.jsx("span",{className:"modal-hint",children:v.summary})]}),v!==null&&o.jsx("div",{className:"vault-table-wrap",children:o.jsxs("table",{className:"vault-table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{children:"CLI"}),o.jsx("th",{children:_("vault.dialog.table.sessions")}),o.jsx("th",{children:_("vault.dialog.table.size")}),o.jsx("th",{children:_("vault.dialog.table.images")}),o.jsx("th",{title:_("vault.dialog.table.archivedTitle"),children:_("vault.dialog.table.archived")})]})}),o.jsxs("tbody",{children:[v.rows.map(b=>o.jsxs("tr",{children:[o.jsxs("td",{children:[b.label,b.note!==null&&o.jsx("span",{className:"vault-table-note",children:b.note})]}),o.jsx("td",{children:b.sessions}),o.jsx("td",{children:fn(b.bytes)}),o.jsx("td",{title:b.images>0?fn(b.imageBytes):void 0,children:b.images}),o.jsx("td",{children:b.skippedArchived})]},b.agent)),o.jsxs("tr",{children:[o.jsx("td",{children:_("vault.dialog.table.memory",{count:v.memoryProjects})}),o.jsx("td",{}),o.jsx("td",{children:fn(v.memoryBytes)}),o.jsx("td",{}),o.jsx("td",{})]})]}),o.jsx("tfoot",{children:o.jsxs("tr",{children:[o.jsx("td",{children:_("vault.dialog.table.total")}),o.jsx("td",{children:v.total.sessions}),o.jsx("td",{children:fn(v.total.bytes)}),o.jsx("td",{children:v.total.images}),o.jsx("td",{children:v.total.skippedArchived})]})})]})}),o.jsxs("div",{className:"vault-actions vault-switch",children:[m==="enabled"&&o.jsxs(o.Fragment,{children:[o.jsx("button",{className:"link-button",onClick:()=>u(!1),children:_("vault.dialog.turnOff")}),o.jsx("span",{className:"modal-hint",children:_("vault.dialog.turnOffHint")})]}),(m==="measured"||m==="existing")&&o.jsxs(o.Fragment,{children:[o.jsx("button",{className:"primary-button",onClick:()=>u(!0),title:_(m==="existing"?"vault.dialog.activateExistingTitle":"vault.dialog.activateMeasuredTitle"),children:_("vault.dialog.activate")}),o.jsx("span",{className:"modal-hint",children:_(m==="existing"?"vault.dialog.activateExistingHint":"vault.dialog.activateMeasuredHint")})]}),m==="needs-measure"&&o.jsx("span",{className:"modal-hint",children:_("vault.dialog.needsMeasure",{activate:_("vault.dialog.activate")})})]}),o.jsx("h3",{className:"modal-section",children:_("vault.dialog.folderSection")}),o.jsx("p",{className:"vault-dir",title:t.dir,children:t.dir}),t.isDefaultDir&&o.jsx("p",{className:"modal-hint",children:_("vault.dialog.defaultDir")}),o.jsxs("div",{className:"vault-actions",children:[o.jsx("button",{className:"link-button",onClick:k,disabled:c!==null,title:c??_("vault.dialog.changeDirTitle"),children:_("vault.dialog.changeDir")}),y!==null&&o.jsx("button",{className:"link-button",onClick:y,title:_("vault.dialog.openFolderTitle"),children:_("vault.dialog.openFolder")})]}),t.previousDir!==null&&o.jsx("p",{className:"modal-hint",children:Hx(t.previousDir)}),t.lastError!==null&&o.jsxs(o.Fragment,{children:[o.jsx("h3",{className:"modal-section",children:_("vault.dialog.lastError")}),o.jsx("p",{className:"vault-error",children:At(t.lastError)})]})]})}function r2({preview:t,files:e,running:s,error:l,onConfirm:u,onClose:k}){M.useEffect(()=>{const i=c=>{c.key==="Escape"&&(c.preventDefault(),c.stopPropagation(),k())};return window.addEventListener("keydown",i,!0),()=>window.removeEventListener("keydown",i,!0)},[k]);const y=_("rewind.title");return o.jsx("div",{className:"modal-backdrop",onClick:k,children:o.jsxs("div",{className:"modal rewind-dialog",role:"dialog","aria-label":y,onClick:i=>i.stopPropagation(),children:[o.jsxs("header",{className:"modal-header",children:[o.jsx("span",{className:"modal-title",children:y}),o.jsx("button",{className:"icon-button",onClick:k,title:_("common.close"),children:"×"})]}),o.jsxs("div",{className:"modal-body",children:[t.length>0&&o.jsx("blockquote",{className:"rewind-quote",children:t}),o.jsx("p",{className:"modal-hint",children:_("rewind.intro")}),e.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("h3",{className:"modal-section",children:_("rewind.filesSection")}),o.jsx("ul",{className:"rewind-files",children:e.map(i=>o.jsx("li",{children:i},i))}),o.jsx("p",{className:"modal-hint",children:_("rewind.filesHint")})]}),l!==null&&o.jsx("p",{className:"rewind-error",children:l}),o.jsxs("div",{className:"rewind-actions",children:[e.length>0?o.jsxs(o.Fragment,{children:[o.jsx("button",{className:"primary-button",disabled:s,onClick:()=>u("conversation-and-code"),children:_("rewind.undoAll")}),o.jsx("button",{className:"primary-button",disabled:s,onClick:()=>u("conversation"),children:_("rewind.undoConversation")})]}):o.jsx("button",{className:"primary-button",disabled:s,onClick:()=>u("conversation"),children:_("rewind.undo")}),o.jsx("button",{className:"link-button",onClick:k,children:_("common.cancel")}),s&&o.jsx("span",{className:"modal-hint",children:_("rewind.running")})]})]})]})})}function s2(t){const[e,s]=M.useState(null),l=M.useRef(null),u=M.useRef(null),k=M.useCallback(m=>{l.current=m,s(m)},[]);M.useEffect(()=>t.onMessage(m=>{const v=u.current;if(v!==null){if(m.type==="agent.rewound"&&m.requestId===v){u.current=null,k(null);return}if(m.type==="error"&&m.requestId===v){u.current=null;const h=l.current;h!==null&&k({...h,phase:"failed",error:At(m.text)})}}}),[t,k]);const y=M.useCallback((m,v)=>{u.current=null,k({terminalId:m,eventId:v,phase:"confirm",error:null})},[k]),i=M.useCallback(m=>{const v=l.current;if(v===null||v.phase==="running")return;const h=crypto.randomUUID();u.current=h,t.send({type:"agent.rewind",terminalId:v.terminalId,eventId:v.eventId,restore:m,requestId:h}),k({...v,phase:"running",error:null})},[t,k]),c=M.useCallback(()=>{u.current=null,k(null)},[k]);return{state:e,open:y,confirm:i,close:c}}const Im={connecting:"app.status.connecting",open:"app.status.open",reconnecting:"app.status.reconnecting",failed:"app.status.failed",revoked:"app.status.revoked"},jm=320,i2=1400,o2=640,Dm=200,Pm=560,l2=270,a2=120,c2=720,u2=260,Om="agent-workbench.panel-width",Bm="agent-workbench.panel-visible",Fm="agent-workbench.panel-tab",Pu="agent-workbench.panel-expanded",Ou="agent-workbench.sidebar-visible",Hm="agent-workbench.sidebar-width",Bu="agent-workbench.console-visible",Um="agent-workbench.console-height",$m="agent-workbench.marker-notice-dismissed",Wm="agent-workbench.hidden-hint-shown";function h2(){var nl,xs;const t=Ao(),e=PL(),{connection:s,status:l,agents:u,defaultAgent:k,capabilitiesFor:y,offerAgentChoice:i,cliAvailable:c,cliVersion:m,cliMissingMessage:v,platform:h,defaultCwd:b,environmentNotice:T,shellName:N,terminals:w,archiveSessions:d,shells:g,pendingOpens:p,activeTerminalId:f,projects:E,indexStatus:j,error:x,dismissError:R,setActiveTerminal:S,openTerminal:L,openShell:I,closeTerminal:P,wakeTerminal:O,waking:B,activity:$,offlineReasons:W,relaunching:K,renameTerminal:Y,reorderTabs:V,refreshIndex:F,refreshAgents:H,continueSession:U,expectTab:z,handoffs:te,dismissHandoff:ie,returnedMessages:we,dismissReturned:ge,prefills:X,prefillApplied:G,drafts:ee,remoteClient:Z,fileCheck:ve,fileWrite:Se}=e,Ie=i5(),je=a5(Ie.resolved),Je=M.useMemo(()=>({nameOf:J=>E5(w.find(ke=>ke.terminalId===J)),activate:S}),[w,S]),tt=R5($,Je),Ne=M5(),ce=w.find(J=>J.terminalId===f)??null,dt=M.useCallback(J=>{J!==f&&R(),S(J)},[f,R,S]),se=(ce==null?void 0:ce.agent)??null,fe=y(se),Ce=(ce==null?void 0:ce.review)===!0,ye=M.useMemo(()=>Nb(fe,Ce),[fe,Ce]),_e=u.find(J=>J.id===se)??null,Te=M.useMemo(()=>{if(ce===null||se===null)return null;for(const J of E){const ke=J.sessions.find(it=>it.agent===se&&it.sessionId===ce.sessionId);if(ke!==void 0)return fr(ke.title,ke.titleSource)}return null},[ce,se,E,t]),ue=M.useMemo(()=>xb(w,E.flatMap(J=>J.sessions)),[w,E]),Fe=(_e==null?void 0:_e.statusLine)??null,$e=t5(s),Ye=M.useMemo(()=>{var J;return se===null?[]:((J=$e.find(ke=>ke.agent===se))==null?void 0:J.windows)??[]},[$e,se]),De=(_e==null?void 0:_e.planLimitsSetup)??null,He=(ce==null?void 0:ce.cwd)??b,qe=M.useMemo(()=>i?ek(w,He,h,u,k):null,[i,w,He,h,u,k]),xt=M.useMemo(()=>dp(p,He,h),[p,He,h]),It=xt?Eg():null,jt=e5(s),gt=bL(s),[Kt,Ft]=M.useState(!1),pe=P5(s),[Ze,Qe]=M.useState(!1),ct=jC(),he=GL(),[Ve,ut]=M.useState(!1),be=M.useCallback(()=>ut(!1),[]),[nt,St]=M.useState(()=>Nt(wp,"chat",rC)),pt=M.useMemo(()=>sC({hasTab:ce!==null,plansAvailable:ye.plansAvailable,hidden:he.hidden}),[ce,ye.plansAvailable,he.hidden]),Ke=iC(nt,pt),mt=M.useCallback(J=>{St(J),kt(wp,J)},[]),ot=M.useRef(yL);M.useEffect(()=>{if(ot.current!==null)return s.onMessage(J=>{if(J.type!=="terminal.list"||ot.current===null)return;const ke=ot.current;ot.current=null,J.terminals.some(it=>it.terminalId===ke&&it.kind==="agent")&&S(ke)})},[s,S]);const Pt=vT(s),zn=JS(u,gt.status),[An,_n]=M.useState(null),En=M.useRef(0),Ir=M.useCallback(J=>{_n(ke=>ke!==null&&ke.seq===J?null:ke)},[]),$s=(J,ke)=>{const it=dx(J,{projects:E,terminals:w,platform:h,canResume:wn=>lp(u,wn)}),Qt=()=>{ke.length!==0&&(En.current+=1,_n({query:ke,seq:En.current}))};switch(it.kind){case"activate":dt(it.terminalId),Qt();break;case"resume":it.session.archived&&d([it.session.sessionId],!1),L({cwd:it.cwd,resumeSessionId:it.session.sessionId,agent:it.session.agent,label:fr(it.session.title,it.session.titleSource)}),Qt();break;case"copy":gt.openSession(J.agent,J.sessionId);break}},ps=M.useMemo(()=>new Set(w.map(J=>J.sessionId).filter(J=>J.length>0)),[w]),[Gt,gr]=M.useState(()=>Nt(Bm,!0,J=>J==="true")),[ms,Ws]=M.useState(()=>Nt(Fm,"cli",J=>J==="git"||J==="files"||J==="cli"||J==="plans"||J==="memory"?J:J==="conversation"?"cli":null)),[vr,jr]=M.useState(()=>Nt(Om,o2,J=>{const ke=Number.parseInt(J,10);return Number.isFinite(ke)?Math.max(ke,jm):null})),[Dr,nr]=M.useState(()=>Nt(Pu,!1,J=>J==="true")),[Pr,zs]=M.useState(()=>Nt(Ou,!0,J=>J==="true")),[Et,Di]=M.useState(()=>Nt(Hm,l2,J=>{const ke=Number.parseInt(J,10);return Number.isFinite(ke)?Math.min(Pm,Math.max(Dm,ke)):null})),[gs,Or]=M.useState(()=>Nt(Bu,!1,J=>J==="true")),[rr,vs]=M.useState(()=>Nt(Um,u2,J=>{const ke=Number.parseInt(J,10);return Number.isFinite(ke)?ke:null})),[me,Pe]=M.useState(()=>Nt($m,!0,J=>J!=="true")),[et,wt]=M.useState(!1),lt=e2(s),[Tn,Ln]=M.useState(!1),In=lt.status!==null?lt.status.shellName:N,[_s,ws]=M.useState(null),[ys,Br]=M.useState(!1);M.useEffect(()=>{Fe===null&&Br(!1)},[Fe]);const[ya,Pi]=M.useState(!1);M.useEffect(()=>{De===null&&Pi(!1)},[De]);const[bs,_r]=M.useState(null),sr=Gt&&ce!==null,qn=Ub(ms,ye.plansAvailable,he.hidden),Do=gs&&he.isVisible("console"),ir=ce!==null?Gt||Do:Gt,vt=Dr&&ce!==null,Vn=M.useMemo(()=>ce===null?[]:g.filter(J=>J.cwd===ce.cwd),[g,ce]),[Po,qs]=M.useState(null),wr=Vn.find(J=>J.terminalId===Po)??Vn[0]??null,ks=Ke==="cli"?f:Ke==="console"?(wr==null?void 0:wr.terminalId)??null:null,Oo=M.useCallback(J=>{ks!==null&&s.send({type:"input",terminalId:ks,data:J})},[s,ks]),Tt=NS(s,f),Fr=I5(s,$),Kn=ct?ce!==null:sr,or=ct?Ke==="files":sr&&qn==="files",jn=YT(s,Kn?f:null),Hr=RL(s,(ct?Ke==="git":sr&&qn==="git")?f:null,jn.status.updatedAt),yt=ML(s,z,S),Ht=AL(s,z,S),{closeChanges:Oi}=Ht;M.useEffect(()=>Oi(),[f,Oi]);const Dn=J=>J.split(/[\\/]/).filter(ke=>ke.length>0).pop()??J,Bo=J=>{var ke;return((ke=u.find(it=>it.id===J))==null?void 0:ke.label)??J},Fo={rows:Hr.rows,kept:Hr.kept,onDeleteBranch:J=>yt.openDeleteBranch(J.id,J.branch),onNew:()=>{if(ce===null)return;const J=Fs(ce);yt.openCreate({kind:"terminal",terminalId:ce.terminalId},J,Dn(J))},onOpen:J=>{const ke=pr(J.path,h),it=w.find(Qt=>pr(Qt.cwd,h)===ke&&!Qt.review);it!==void 0?dt(it.terminalId):L({cwd:J.path})},onRemove:J=>yt.openRemove(J.id,J.branch??Dn(J.path)),changes:Ht.changes,onViewChanges:J=>Ht.openChanges(J.id,J.branch??Dn(J.path)),onOpenChangeDiff:Ht.openChangeDiff,onCloseChangeDiff:Ht.closeChangeDiff,onCloseChanges:Ht.closeChanges,onRequestReview:J=>Ht.openReview(J.id,J.branch??Dn(J.path),ce===null?J.path:Fs(ce)),onSendReview:J=>Ht.sendReview(J.id),onShowReviewer:J=>dt(J),onCatchUp:J=>Ht.catchUp(J.id),onIntegrate:J=>Ht.openIntegrate(J.id,J.branch??Dn(J.path)),agentLabel:Bo},Ks=(()=>{var Qt;const J=yt.create;if(J===null)return null;const{source:ke}=J;if(ke.kind==="terminal")return((Qt=w.find(wn=>wn.terminalId===ke.terminalId))==null?void 0:Qt.agent)??k;const it=E.find(wn=>wn.key===ke.projectKey);return it===void 0?k:ap(w,it,h,u,k)})(),Ho=gT(s,or?f:null),Uo=_T(s,f),Ur=OT(s,w,f,Se),yr=ZT(s,Kn?f:null),$r=ct?Ke==="cli":sr&&qn==="cli",Cs=Tt.usage.lastModel,$o=Tb(Tt.events,Tt.usage.lastEffort,(ce==null?void 0:ce.launchedAt)??null),Wo=Cs??Tt.defaults.model,Gs=$o??Tt.defaults.effort,Ys=Cs===null&&Wo!==null,Bi=$o===null&&Gs!==null,Fi=pT(s,f,$r),sn=f===null?null:$.get(f)??null,Xs=gk(fe,Tt.openToolCall,(_e==null?void 0:_e.label)??null,(ce==null?void 0:ce.alive)??!1,sn),Wr=vk({offlineReason:f===null?null:W.get(f)??null,alive:(ce==null?void 0:ce.alive)??!1,relaunching:f!==null&&K.has(f)}),Qs=Wr===null?null:_k((_e==null?void 0:_e.label)??null),Js=Qs??Xs??kk(fe,Tt.waitingFor,(ce==null?void 0:ce.alive)??!1),Zs=!qm(fe,sn),zo=M.useMemo(()=>Cg(u,se),[u,se]),on=ce!==null&&fk(se,ce.sessionId,fe),mn=f===null?null:te.get(f)??null,Hi=mn===null?null:{text:ok(Mo(mn.sourceAgent,u),mn.includedTurns,mn.totalTurns,mn.totalTurnsIsMinimum),status:mn.prefillReason!==null?uk(mn.prefillReason):mn.delivery==="sending"&&Tt.events.length===0?lk():null},zr=f===null?void 0:we.get(f),ba=Hi??(zr===void 0?null:{text:zr==="stopped-early"?ck():ak((_e==null?void 0:_e.label)??null),status:null}),ei=M.useCallback(J=>{ie(J),ge(J)},[ie,ge]),lr=M.useCallback(()=>{gr(J=>{const ke=!J;return kt(Bm,String(ke)),ke})},[]),qr=M.useCallback(()=>{zs(J=>{const ke=!J;return kt(Ou,String(ke)),ke})},[]),Vr=M.useCallback(()=>{ct||(zs(!1),kt(Ou,"false"))},[ct]),qo=M.useCallback(()=>{Or(J=>{const ke=!J;return kt(Bu,String(ke)),ke})},[]),Ui=M.useCallback(J=>{Ws(J),kt(Fm,J)},[]),ka=M.useCallback(()=>{nr(J=>{const ke=!J;return kt(Pu,String(ke)),ke})},[]),ti=s2(s),{open:ni}=ti,Ca=M.useCallback(J=>{f!==null&&ni(f,J)},[ni,f]),Sa=M.useCallback(J=>{f!==null&&s.send({type:"input",terminalId:f,data:`${J} `})},[s,f]),ri=M.useRef(null),xa=M.useCallback(J=>{var ke;return(ke=ri.current)==null?void 0:ke.call(ri,J,!ct)},[ct]),Vo=J=>{if(Ur.files.open({key:J,title:J.split("/").pop()??J}),ct){mt("files");return}sr||lr(),Ui("files")},$i=M.useRef(Vo);$i.current=Vo;const Ea=M.useCallback(J=>$i.current(J),[]),Ta=M.useMemo(()=>w.map(J=>J.terminalId),[w]),Ko=M.useCallback(J=>{f!==null&&s.send({type:"files.reveal",terminalId:f,path:J})},[s,f]),La=GT({connection:s,enabled:ve&&he.isVisible("files"),terminalId:f,cwd:(ce==null?void 0:ce.cwd)??"",platform:h,events:Tt.events,liveTerminalIds:Ta,onOpen:Ea,onOpenFolder:Z?null:Ko}),Ss=M.useCallback(J=>{f!==null&&s.send({type:"agent.submit",terminalId:f,text:J,images:[],keepDraft:!0})},[s,f]),si=kb(se),Na=M.useMemo(()=>{if(si===null||ce===null)return null;const J=ce.alive?sn==="busy"||sn==="waiting"?_("meter.compactBusy"):null:_("meter.compactNoCli");return{command:si,blockedReason:J,onCompact:()=>Ss(si)}},[si,ce,sn,Ss,t]),Ra=M.useCallback(()=>{Or(!0),kt(Bu,"true");const J=m1({cwd:(ce==null?void 0:ce.cwd)??null,shellCwds:g.map(ke=>ke.cwd),shellAvailable:In!==null});J!==null&&I(J)},[ce,g,In,I]),ii=M.useCallback(J=>{if(J==="console")for(const ke of g)P(ke.terminalId);he.setVisible(J,!1),!Nt(Wm,!1,ke=>ke==="true")&&(kt(Wm,"true"),ws(J))},[g,P,he]),Ma=M.useCallback(()=>{for(const J of g)P(J.terminalId);he.setVisible("console",!1)},[g,P,he]),Go=M.useRef(new Set);M.useEffect(()=>{const J=Vn.filter(it=>!Go.current.has(it.terminalId));for(const it of Vn)Go.current.add(it.terminalId);const ke=J[J.length-1];ke!==void 0&&qs(ke.terminalId)},[Vn]);const Aa=M.useCallback(()=>{ce!==null&&I(ce.cwd)},[ce,I]),Ia=ia({min:jm,max:i2,value:vr,measure:M.useCallback(J=>window.innerWidth-J.clientX,[]),onChange:jr,onCommit:M.useCallback(J=>kt(Om,String(J)),[]),onStart:M.useCallback(()=>{nr(!1),kt(Pu,"false")},[])}),ja=ia({min:Dm,max:Pm,value:Et,measure:M.useCallback(J=>J.clientX,[]),onChange:Di,onCommit:M.useCallback(J=>kt(Hm,String(J)),[])}),Yo=M.useRef(0),Da=ia({min:a2,max:c2,value:rr,measure:M.useCallback(J=>Math.round(Yo.current-J.clientY),[]),onChange:vs,onCommit:M.useCallback(J=>kt(Um,String(J)),[]),onStart:M.useCallback(J=>{const ke=J.currentTarget.nextElementSibling;Yo.current=ke===null?window.innerHeight:J.clientY+ke.getBoundingClientRect().height},[])}),Wi=M.useCallback(()=>{Pe(!1),kt($m,"true")},[]),br=M.useCallback(J=>{if(w.length===0)return;const it=(w.findIndex(wn=>wn.terminalId===f)+J+w.length)%w.length,Qt=w[it];Qt!==void 0&&dt(Qt.terminalId)},[w,f,dt]),Xo=M.useRef(null),oi=M.useRef(null);M.useEffect(()=>{f!==oi.current&&(Xo.current=oi.current,oi.current=f)},[f]);const zi=M.useCallback(()=>{const J=Xo.current;J===null||J===f||w.some(ke=>ke.terminalId===J)&&dt(J)},[f,w,dt]);M.useEffect(()=>{const J=ke=>{if(ke.key!=="Tab"||!ke.shiftKey||ke.altKey||ke.ctrlKey||ke.metaKey)return;const it=document.activeElement;it instanceof Element&&it.closest(".xterm")!==null||(ke.preventDefault(),ke.stopPropagation(),zi())};return window.addEventListener("keydown",J,!0),()=>window.removeEventListener("keydown",J,!0)},[zi]),M.useEffect(()=>{const J=ke=>{if(!ke.altKey||ke.ctrlKey||ke.metaKey)return;const it=ke.key.toLowerCase();if(it==="t"){c&&b.length>0&&!xt&&(ke.preventDefault(),ke.stopPropagation(),L({cwd:(ce==null?void 0:ce.cwd)??b}));return}if(it==="w"){f!==null&&(ke.preventDefault(),ke.stopPropagation(),P(f));return}if(it==="p"){ke.preventDefault(),ke.stopPropagation(),lr();return}if(it==="arrowright"||it==="pagedown"){ke.preventDefault(),ke.stopPropagation(),br(1);return}(it==="arrowleft"||it==="pageup")&&(ke.preventDefault(),ke.stopPropagation(),br(-1))};return window.addEventListener("keydown",J,!0),()=>window.removeEventListener("keydown",J,!0)},[ce,f,c,P,br,b,xt,L,lr]);const Qo=ce===null?_("app.panel.name"):ce.label.length>0?ce.label:ce.cwd.split(/[\\/]/).filter(J=>J.length>0).pop()??ce.cwd,qi=o.jsx(Xx,{projects:E,indexStatus:j,disabled:!c,onOpenProject:(J,ke)=>{be(),L({cwd:J,...ke!==void 0?{agent:ke}:{},onOpened:Vr})},agents:u,offerAgentChoice:i,agentForProject:J=>ap(w,J,h,u,k),onOpenSession:(J,ke)=>{be(),L({cwd:J,resumeSessionId:ke.sessionId,agent:ke.agent,label:fr(ke.title,ke.titleSource)})},canResume:J=>lp(u,J),platform:h,onRefresh:F,openSessionIds:ps,openBlocked:J=>dp(p,J,h),onArchive:d,onHide:ct?be:qr,width:Et,onNewProject:()=>{be(),_r("project")},vault:gt.status,onOpenVault:()=>{be(),Ft(!0)},onOpenVaultSession:Z?null:J=>gt.openSession(J.agent,J.sessionId),onExportProject:Z?null:gt.exportProject,exporting:gt.exporting,lastExported:gt.lastExported,onNewWorktree:J=>{be(),yt.openCreate({kind:"project",projectKey:J.key},J.cwd,Dn(J.cwd),Vr)},onReopenWorktree:(J,ke)=>{var it;be(),yt.reopen(J.agent,J.sessionId,ke.cwd,((it=J.worktree)==null?void 0:it.branch)??"")},onContinueSession:(J,ke)=>{be(),U({agent:J.agent,sessionId:J.sessionId},ke,up(fr(J.title,J.titleSource)))},globalSearch:zn?{...Pt,vaultEnabled:((nl=gt.status)==null?void 0:nl.enabled)===!0}:null,onOpenSearchHit:(J,ke)=>{be(),$s(J,ke)}}),Vi=o.jsx("div",{className:"chat-stack",children:w.length===0?o.jsxs("div",{className:"empty-state",children:[o.jsx("p",{children:_("app.empty.noTabs")}),o.jsx("p",{className:"empty-hint",children:_("app.empty.hint")}),c&&b.length>0&&o.jsx("button",{className:"primary-button",onClick:()=>L({cwd:b}),disabled:xt,title:It??void 0,children:xt?_("app.empty.opening"):_("app.empty.newSession",{cwd:b})})]}):o.jsx(BS,{view:Tt,terminalId:f,threadFont:Ne,fileLinks:La,onRewind:ye.rewind&&(ce==null?void 0:ce.alive)===!0?Ca:void 0,rewindBlocked:sn!=="idle",forceSendAvailable:ye.forceSend&&(ce==null?void 0:ce.alive)===!0,queueEditAvailable:ye.editQueue&&(ce==null?void 0:ce.alive)===!0,questionsAnswerable:ye.questionsAnswerable,contextWindowSource:ye.contextWindowSource,instructionsFile:Lb(se),onGoToCli:()=>{if(ct){mt("cli");return}sr||lr(),Ui("cli")},cliPresence:ce===null||ce.alive?"live":ce.sleeping?"sleeping":"exited",exitCode:(ce==null?void 0:ce.exitCode)??null,waking:f!==null&&B.has(f),onWakeCli:()=>{f!==null&&O(f)},discovering:on,continueTargets:zo,continueBlockedReason:ik((ce==null?void 0:ce.sessionId)??"",on,Tt.events.length>0),onContinue:ce===null||se===null?void 0:J=>U({agent:se,sessionId:ce.sessionId},J,up(Te??ce.label)),searchRequest:An,onSearchRequestApplied:Ir,toolCallNotice:Xs,serverClosed:Wr===null||Qs===null?null:{state:Wr,text:Qs},statusLineState:(Fe==null?void 0:Fe.state)??null,onConfigureStatusLine:Fe===null?void 0:()=>Br(!0),activity:sn,receipt:f===null?null:Fr.receipts.get(f)??null,clock:f===null?null:Fr.clocks.get(f)??null,takeNotice:tt.takeNotice,planWindows:Ye,planSetupState:(De==null?void 0:De.state)??null,onConfigurePlanLimits:De===null?void 0:()=>Pi(!0),compactAction:Na})}),kr=o.jsx(o.Fragment,{children:ce!==null&&o.jsx(WC,{connection:s,drafts:ee,terminalId:f,alive:ce.alive,sleeping:ce.sleeping,projectColor:Us(Fs(ce)),activity:$.get(ce.terminalId),imagesAllowed:ye.imagesAllowed,blockedReason:Js,prefills:X,onPrefillApplied:G,notice:ba,onDismissNotice:f===null?void 0:()=>ei(f),onSubmitted:(J,ke,it)=>{ei(J);const{events:Qt}=Tt,wn=J===f?Qt[Qt.length-1]:void 0;Fr.track(J,ke,(wn==null?void 0:wn.eventId)??null,it)},fontSize:Ne.size,insertRef:ri,onEditQueue:ye.editQueue&&ce.alive&&Tt.queue.length>0&&Tt.queue.every(J=>J.forced!==!0)&&Tt.waitingFor===null&&!Tt.editingQueue?Tt.editQueue:void 0,leading:ye.modeCycle===null?void 0:o.jsx(Nk,{mode:Tt.permissionMode,cycle:ye.modeCycle,disabled:!ce.alive,waitingFor:Tt.waitingFor,statusKnown:Zs,onChange:Tt.setPermissionMode}),controls:ye.models===null&&ye.efforts===null?void 0:o.jsx(Lk,{models:ye.models,efforts:ye.efforts,model:Wo,effort:Gs,modelProvisional:Ys,effortProvisional:Bi,savesChoice:Eb(se),effortCommandName:bb(se),disabled:!ce.alive,onCommand:Ss})})}),Jo=ce===null?null:o.jsx(aT,{tab:ct?yp(Ke)??qn:qn,plansAvailable:ye.plansAvailable,hiddenTabs:he.hidden,hidden:ct?yp(Ke)===null:!Gt,onTabChange:ct?mt:Ui,title:Qo,cwd:ce.cwd,colorCwd:Fs(ce),platform:h,cli:o.jsx("div",{className:"terminal-stack",children:w.map(J=>o.jsx(Kg,{terminalId:J.terminalId,connection:s,active:J.terminalId===f,theme:je.resolved,autoFocus:!1},J.terminalId))}),cliUnseen:Fi,expanded:Dr,onToggleExpanded:ka,git:jn,worktrees:Fo,files:Ho,plans:Uo,documents:Ur,memory:yr,onInsert:ye.fileMentions&&ce.alive?Sa:void 0,onInsertPath:xa,onReveal:Z?null:Ko,onHide:lr}),Zo=ce===null?null:o.jsx(p1,{connection:s,shells:Vn,activeShellId:(wr==null?void 0:wr.terminalId)??null,cwd:ce.cwd,shellName:In,theme:je.resolved,onSelect:qs,onOpen:Aa,onCloseShell:P,onCollapse:ct?()=>mt("chat"):qo,onHide:ct?void 0:()=>ii("console"),hideCount:g.length}),el=he.isVisible("notes")?o.jsx(cL,{notes:jt,fill:ct||ce===null,onHide:ct?void 0:()=>ii("notes"),onSendNote:ce===null||!ye.noteSendable?null:J=>{const ke=ce.cwd;L({cwd:ke,...ce.agent!==null?{agent:ce.agent}:{},onOpened:it=>{s.send({type:"notes.send",noteId:J,terminalId:it.terminalId}),ct&&mt("chat")}})},sendTargetCwd:(ce==null?void 0:ce.cwd)??null}):null,tl=ce===null||!he.isVisible("console")?null:o.jsx(o.Fragment,{children:Do?o.jsxs(o.Fragment,{children:[Gt&&o.jsx("div",{className:"hdivider",...Da,title:_("app.divider.consoleHeight")}),o.jsx("div",{className:"console-slot",style:Gt?{height:`${rr}px`}:{flex:"1 1 auto"},children:Zo})]}):o.jsxs("div",{className:"strip-collapsed-row",children:[o.jsxs("button",{className:"strip-collapsed",onClick:Ra,title:In===null?_("console.openAnyIn",{cwd:ce.cwd}):_("console.openIn",{shell:In,cwd:ce.cwd}),children:[o.jsx("span",{className:"strip-collapsed-arrow",children:"▸"}),o.jsx("span",{children:In??_("console.name")}),Vn.length>0&&o.jsx("span",{className:"strip-collapsed-count",children:Vn.length})]}),o.jsx(ca,{title:_("settings.hide.console"),onHide:()=>ii("console"),confirmText:g.length===0?null:_("settings.panels.consoleConfirm",{count:g.length})})]})}),Ki=o.jsxs(o.Fragment,{children:[l==="revoked"&&o.jsx("div",{className:"banner banner-error",children:_("app.banner.revoked")}),_s!==null&&o.jsxs("div",{className:"banner banner-notice",children:[o.jsx("span",{children:_("settings.hiddenHint",{name:_(_s==="console"?"console.name":"notes.name")})}),o.jsx("button",{className:"banner-close",onClick:()=>ws(null),title:_("common.gotIt"),children:"×"})]}),!c&&v!==null&&o.jsx("div",{className:"banner banner-error banner-lines",children:v}),T==="child-session-marker"&&me&&o.jsxs("div",{className:"banner banner-notice",children:[o.jsx("span",{children:rn("app.markerNotice",{variable:"CLAUDE_CODE_CHILD_SESSION"})}),o.jsx("button",{className:"banner-close",onClick:Wi,title:_("common.gotIt"),children:"×"})]}),x!==null&&o.jsxs("div",{className:"banner banner-error",children:[o.jsx("span",{children:x.message}),o.jsx("button",{className:"banner-close",onClick:R,title:_("common.close"),children:"×"})]}),gt.problem!==null&&!Kt&&o.jsxs("div",{className:"banner banner-error",children:[o.jsx("span",{children:gt.problem}),o.jsx("button",{className:"banner-close",onClick:gt.dismissProblem,title:_("common.close"),children:"×"})]}),o.jsx(bx,{})]}),Gn=ti.state,Kr=o.jsxs(o.Fragment,{children:[Gn!==null&&o.jsx(r2,{preview:DS(Tt.events.find(J=>J.eventId===Gn.eventId)),files:jS(Tt.events,Gn.eventId,(ce==null?void 0:ce.cwd)??""),running:Gn.phase==="running",error:Gn.error,onConfirm:ti.confirm,onClose:ti.close}),ys&&Fe!==null&&_e!==null&&o.jsx(Qp,{info:Fe,agentLabel:_e.label,onRefresh:H,onClose:()=>Br(!1)}),ya&&De!==null&&_e!==null&&o.jsx(Qp,{info:De,agentLabel:_e.label,purpose:"plan-limits",onRefresh:H,onClose:()=>Pi(!1)}),yt.create!==null&&o.jsx(OL,{dialog:yt.create,agents:u,offerAgentChoice:i,agent:Ks,onSubmit:yt.submitCreate,onClose:yt.closeCreate}),yt.remove!==null&&o.jsx(HL,{dialog:yt.remove,onConfirm:yt.confirmRemove,onDiscardFiles:yt.discardFiles,onAskNotes:yt.askNotes,onAskCommit:yt.askCommit,onRetry:yt.retryRemove,onClose:yt.closeRemove}),Ht.review!==null&&o.jsx(UL,{dialog:Ht.review,agents:u,onSubmit:Ht.submitReview,onClose:Ht.closeReview}),Ht.integrate!==null&&o.jsx(FL,{dialog:Ht.integrate,agentLabel:Bo,onConfirm:Ht.confirmIntegrate,onRemove:()=>{const J=Ht.integrate;Ht.closeIntegrate(),J!==null&&yt.openRemove(J.worktreeId,J.branch)},onClose:Ht.closeIntegrate}),yt.deleteBranch!==null&&o.jsx(BL,{dialog:yt.deleteBranch,onConfirm:yt.confirmDeleteBranch,onClose:yt.closeDeleteBranch}),Tn&&o.jsx(ZL,{onClose:()=>Ln(!1),terminalTheme:je,panels:he,consoleCount:ct?0:g.length,onHideConsole:Ma,appSettings:lt,agents:u,remoteClient:Z,onOpenVault:()=>{Ln(!1),Ft(!0)},onOpenRemote:pe.status!==null&&!Z?()=>{Ln(!1),Qe(!0)}:null}),et&&o.jsx(_x,{agent:$b(se,u,k),onClose:()=>wt(!1)}),bs==="project"&&o.jsx(Kp,{connection:s,title:_("app.picker.project.title"),confirmLabel:_("app.picker.project.confirm"),confirmTitle:J=>_("app.picker.project.confirmTitle",{path:J}),onChoose:(J,ke)=>{_r(null),L({cwd:ke,onOpened:Vr})},onClose:()=>_r(null)}),Kt&&o.jsx(t2,{status:gt.status,agents:u,indexReady:j.state==="ready",problem:gt.problem,covered:bs==="vault",onMeasure:gt.measure,onSetEnabled:gt.setEnabled,onChangeDir:()=>_r("vault"),onReveal:Z?null:gt.reveal,onDismissProblem:gt.dismissProblem,onClose:()=>Ft(!1)}),Ze&&pe.status!==null&&!Z&&o.jsx(sL,{status:pe.status,pairing:pe.pairing,phonePairing:pe.phonePairing,phoneStarted:pe.phoneStarted,problem:pe.problem,platform:h,onSetEnabled:pe.setEnabled,onSetPort:pe.setPort,onStartPairing:pe.startPairing,onCancelPairing:pe.cancelPairing,onStartPhonePairing:pe.startPhonePairing,onCancelPhonePairing:pe.cancelPhonePairing,onRenameDevice:pe.renameDevice,onRevokeDevice:pe.revokeDevice,onDismissProblem:pe.dismissProblem,onClose:()=>Qe(!1)}),bs==="vault"&&o.jsx(Kp,{connection:s,title:_("app.picker.vault.title"),confirmLabel:_("app.picker.vault.confirm"),confirmTitle:J=>_("app.picker.vault.confirmTitle",{path:J}),onChoose:J=>{gt.chooseDir(J),_r(null)},onClose:()=>_r(null)})]});return ct?o.jsxs("div",{className:"app app-narrow",children:[o.jsx(mL,{banners:Ki,status:l,statusLabel:_(Im[l]),terminals:w,activeTerminalId:f,activity:$,agents:u,offerAgentChoice:i,newTabAgent:qe,platform:h,canOpen:c&&b.length>0,newTabBlockedTitle:It,onSelectTab:dt,onCloseTab:P,onRenameTab:Y,onNewTab:J=>L({cwd:He,...J!==void 0?{agent:J}:{}}),drawer:qi,drawerOpen:Ve,onDrawerChange:ut,menu:{cwd:(ce==null?void 0:ce.cwd)??null,cliVersion:m,themeIcon:vm[Ie.preference],themeTitle:gm(Ie.preference),onCycleTheme:Ie.cycle,sound:tt,remote:pe.status!==null&&!Z?{title:`${_("app.header.remoteAccess")} — ${lh(pe.status.state,pe.status.port)}`,active:xm(pe.status),onOpen:()=>Qe(!0)}:null,remoteClient:Z,onShortcuts:()=>wt(!0),onSettings:()=>Ln(!0)},view:Ke,views:pt,onViewChange:mt,badges:{changes:jv(jn.status),plans:Uo.plans.length,memory:((xs=yr.status)==null?void 0:xs.installed)===!0?yr.status.notes.length:0,cliUnseen:Fi},chat:o.jsxs(o.Fragment,{children:[Vi,kr]}),panel:Jo,notes:el,console:Zo,onTerminalKey:ks===null?null:Oo}),Kr]}):o.jsxs("div",{className:"app",children:[o.jsxs("header",{className:"app-header",children:[o.jsx("span",{className:"app-name",children:"Agent Workbench"}),o.jsx("span",{className:`status status-${l}`,children:_(Im[l])}),ce!==null&&o.jsx("span",{className:"meta",title:ce.cwd,children:ce.cwd}),o.jsx("span",{className:"header-spacer"}),m!==null&&o.jsx("span",{className:"meta meta-dim",children:_("app.header.cliVersion",{version:m})}),o.jsx("button",{className:"icon-button",onClick:Ie.cycle,title:gm(Ie.preference),children:vm[Ie.preference]}),o.jsx(qv,{sound:tt}),o.jsx(Vv,{notify:tt.notify}),pe.status!==null&&!Z&&o.jsx("button",{className:`icon-button${xm(pe.status)?" icon-button-on":""}`,onClick:()=>Qe(!0),title:`${_("app.header.remoteAccess")} — ${lh(pe.status.state,pe.status.port)}`,children:"⇄"}),Z&&o.jsx("span",{className:"remote-badge",title:_("app.header.remoteBadgeTitle"),children:_("app.header.remoteBadge")}),o.jsx("button",{className:"icon-button",onClick:()=>Ln(!0),title:_("settings.open"),"aria-label":_("settings.open"),children:"⚙"}),o.jsx("button",{className:"icon-button",onClick:()=>wt(!0),title:_("app.header.shortcuts"),children:"?"})]}),Ki,o.jsxs("div",{className:"app-body",children:[!Pr&&o.jsxs("button",{className:"panel-peek panel-peek-left",onClick:qr,title:_("app.sidebar.show"),children:[o.jsx("span",{className:"panel-peek-arrow",children:"»"}),o.jsx("span",{className:"panel-peek-label",children:_("app.sidebar.name")})]}),Pr&&qi,Pr&&o.jsx("div",{className:"divider",...ja,title:_("app.divider.width")}),o.jsxs("main",{className:`workspace${vt&&ir?" workspace-narrow":""}`,children:[o.jsx(fT,{terminals:w,activeTerminalId:f,activity:$,attention:tt.attention,canOpen:c&&b.length>0,onSelect:dt,onClose:P,onRename:Y,onReorder:V,onNew:J=>L({cwd:He,...J!==void 0?{agent:J}:{}}),agents:u,offerAgentChoice:i,newTabAgent:qe,pendingOpens:p,platform:h,newTabBlockedTitle:It,sessionTitles:ue}),Vi,kr]}),o.jsxs(o.Fragment,{children:[!ir&&o.jsxs("button",{className:"panel-peek",onClick:lr,title:_("app.panel.show"),children:[o.jsx("span",{className:"panel-peek-arrow",children:"«"}),o.jsx("span",{className:"panel-peek-label",children:_("app.panel.name")})]}),ir&&o.jsx("div",{className:"divider",...Ia,title:_("app.divider.width")}),o.jsxs("div",{className:`panel-slot${ir?"":" panel-slot-collapsed"}${ir&&vt?" panel-slot-expanded":""}`,style:ir&&!vt?{width:`${vr}px`}:void 0,children:[ce!==null&&o.jsxs(o.Fragment,{children:[Jo,tl]}),el]})]})]}),Kr]})}const e_=document.getElementById("root");if(e_===null)throw new Error("Falta el contenedor #root.");const d2=cw.createRoot(e_);lS().then(()=>d2.render(o.jsx(h2,{})));export{tw as g};
|