agent-workbench 0.8.0 → 0.9.0
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 +22 -9
- package/dist/server.js +2382 -415
- package/dist/web/assets/de-5zSaN2t-.js +5 -0
- package/dist/web/assets/es-CFiCJcc8.js +5 -0
- package/dist/web/assets/fr-C7R68L38.js +5 -0
- package/dist/web/assets/{highlight-BVnJ3VdZ.js → highlight-BsYn5BK8.js} +1 -1
- package/dist/web/assets/index-fLdlIaV_.js +163 -0
- package/dist/web/assets/index-vwOssvpV.css +32 -0
- package/dist/web/assets/ja-CsWmKRl-.js +5 -0
- package/dist/web/assets/ko-DakWHUDB.js +5 -0
- package/dist/web/assets/pt-BR-CULiM_-O.js +5 -0
- package/dist/web/assets/ru-D8gI2TvJ.js +5 -0
- package/dist/web/assets/zh-CN-BYr9GmHu.js +5 -0
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/web/assets/de-CsDV7Kuv.js +0 -1
- package/dist/web/assets/es-1bnGoSgS.js +0 -1
- package/dist/web/assets/fr-BqyJYy32.js +0 -1
- package/dist/web/assets/index-B0Pd_BkE.css +0 -32
- package/dist/web/assets/index-DOfNPF9Z.js +0 -156
- package/dist/web/assets/ja-xHkS6kKf.js +0 -1
- package/dist/web/assets/ko-CC_KhzvE.js +0 -1
- package/dist/web/assets/pt-BR-Dctf7Mfd.js +0 -1
- package/dist/web/assets/ru-B7OPQhs_.js +0 -1
- package/dist/web/assets/zh-CN-Llsx2Xa1.js +0 -1
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
var X_=Object.defineProperty;var Q_=(t,e,s)=>e in t?X_(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var Ht=(t,e,s)=>Q_(t,typeof e!="symbol"?e+"":e,s);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))a(d);new MutationObserver(d=>{for(const k of d)if(k.type==="childList")for(const y of k.addedNodes)y.tagName==="LINK"&&y.rel==="modulepreload"&&a(y)}).observe(document,{childList:!0,subtree:!0});function s(d){const k={};return d.integrity&&(k.integrity=d.integrity),d.referrerPolicy&&(k.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?k.credentials="include":d.crossOrigin==="anonymous"?k.credentials="omit":k.credentials="same-origin",k}function a(d){if(d.ep)return;d.ep=!0;const k=s(d);fetch(d.href,k)}})();function J_(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Jc={exports:{}},mo={},Zc={exports:{}},ut={};/**
|
|
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 Tf;function Z_(){if(Tf)return ut;Tf=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),d=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"),g=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),h=Symbol.iterator;function b($){return $===null||typeof $!="object"?null:($=h&&$[h]||$["@@iterator"],typeof $=="function"?$:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,_={};function u($,K,te){this.props=$,this.context=K,this.refs=_,this.updater=te||E}u.prototype.isReactComponent={},u.prototype.setState=function($,K){if(typeof $!="object"&&typeof $!="function"&&$!=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,$,K,"setState")},u.prototype.forceUpdate=function($){this.updater.enqueueForceUpdate(this,$,"forceUpdate")};function p(){}p.prototype=u.prototype;function m($,K,te){this.props=$,this.context=K,this.refs=_,this.updater=te||E}var f=m.prototype=new p;f.constructor=m,N(f,u.prototype),f.isPureReactComponent=!0;var x=Array.isArray,j=Object.prototype.hasOwnProperty,T={current:null},R={key:!0,ref:!0,__self:!0,__source:!0};function S($,K,te){var oe,we={},me=null,X=null;if(K!=null)for(oe in K.ref!==void 0&&(X=K.ref),K.key!==void 0&&(me=""+K.key),K)j.call(K,oe)&&!R.hasOwnProperty(oe)&&(we[oe]=K[oe]);var V=arguments.length-2;if(V===1)we.children=te;else if(1<V){for(var Z=Array(V),ee=0;ee<V;ee++)Z[ee]=arguments[ee+2];we.children=Z}if($&&$.defaultProps)for(oe in V=$.defaultProps,V)we[oe]===void 0&&(we[oe]=V[oe]);return{$$typeof:t,type:$,key:me,ref:X,props:we,_owner:T.current}}function L($,K){return{$$typeof:t,type:$.type,key:K,ref:$.ref,props:$.props,_owner:$._owner}}function I($){return typeof $=="object"&&$!==null&&$.$$typeof===t}function B($){var K={"=":"=0",":":"=2"};return"$"+$.replace(/[=:]/g,function(te){return K[te]})}var F=/\/+/g;function D($,K){return typeof $=="object"&&$!==null&&$.key!=null?B(""+$.key):K.toString(36)}function H($,K,te,oe,we){var me=typeof $;(me==="undefined"||me==="boolean")&&($=null);var X=!1;if($===null)X=!0;else switch(me){case"string":case"number":X=!0;break;case"object":switch($.$$typeof){case t:case e:X=!0}}if(X)return X=$,we=we(X),$=oe===""?"."+D(X,0):oe,x(we)?(te="",$!=null&&(te=$.replace(F,"$&/")+"/"),H(we,K,te,"",function(ee){return ee})):we!=null&&(I(we)&&(we=L(we,te+(!we.key||X&&X.key===we.key?"":(""+we.key).replace(F,"$&/")+"/")+$)),K.push(we)),1;if(X=0,oe=oe===""?".":oe+":",x($))for(var V=0;V<$.length;V++){me=$[V];var Z=oe+D(me,V);X+=H(me,K,te,Z,we)}else if(Z=b($),typeof Z=="function")for($=Z.call($),V=0;!(me=$.next()).done;)me=me.value,Z=oe+D(me,V++),X+=H(me,K,te,Z,we);else if(me==="object")throw K=String($),Error("Objects are not valid as a React child (found: "+(K==="[object Object]"?"object with keys {"+Object.keys($).join(", ")+"}":K)+"). If you meant to render a collection of children, use an array instead.");return X}function W($,K,te){if($==null)return $;var oe=[],we=0;return H($,oe,"","",function(me){return K.call(te,me,we++)}),oe}function G($){if($._status===-1){var K=$._result;K=K(),K.then(function(te){($._status===0||$._status===-1)&&($._status=1,$._result=te)},function(te){($._status===0||$._status===-1)&&($._status=2,$._result=te)}),$._status===-1&&($._status=0,$._result=K)}if($._status===1)return $._result.default;throw $._result}var Y={current:null},z={transition:null},P={ReactCurrentDispatcher:Y,ReactCurrentBatchConfig:z,ReactCurrentOwner:T};function U(){throw Error("act(...) is not supported in production builds of React.")}return ut.Children={map:W,forEach:function($,K,te){W($,function(){K.apply(this,arguments)},te)},count:function($){var K=0;return W($,function(){K++}),K},toArray:function($){return W($,function(K){return K})||[]},only:function($){if(!I($))throw Error("React.Children.only expected to receive a single React element child.");return $}},ut.Component=u,ut.Fragment=s,ut.Profiler=d,ut.PureComponent=m,ut.StrictMode=a,ut.Suspense=c,ut.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=P,ut.act=U,ut.cloneElement=function($,K,te){if($==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+$+".");var oe=N({},$.props),we=$.key,me=$.ref,X=$._owner;if(K!=null){if(K.ref!==void 0&&(me=K.ref,X=T.current),K.key!==void 0&&(we=""+K.key),$.type&&$.type.defaultProps)var V=$.type.defaultProps;for(Z in K)j.call(K,Z)&&!R.hasOwnProperty(Z)&&(oe[Z]=K[Z]===void 0&&V!==void 0?V[Z]:K[Z])}var Z=arguments.length-2;if(Z===1)oe.children=te;else if(1<Z){V=Array(Z);for(var ee=0;ee<Z;ee++)V[ee]=arguments[ee+2];oe.children=V}return{$$typeof:t,type:$.type,key:we,ref:me,props:oe,_owner:X}},ut.createContext=function($){return $={$$typeof:y,_currentValue:$,_currentValue2:$,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},$.Provider={$$typeof:k,_context:$},$.Consumer=$},ut.createElement=S,ut.createFactory=function($){var K=S.bind(null,$);return K.type=$,K},ut.createRef=function(){return{current:null}},ut.forwardRef=function($){return{$$typeof:i,render:$}},ut.isValidElement=I,ut.lazy=function($){return{$$typeof:v,_payload:{_status:-1,_result:$},_init:G}},ut.memo=function($,K){return{$$typeof:g,type:$,compare:K===void 0?null:K}},ut.startTransition=function($){var K=z.transition;z.transition={};try{$()}finally{z.transition=K}},ut.unstable_act=U,ut.useCallback=function($,K){return Y.current.useCallback($,K)},ut.useContext=function($){return Y.current.useContext($)},ut.useDebugValue=function(){},ut.useDeferredValue=function($){return Y.current.useDeferredValue($)},ut.useEffect=function($,K){return Y.current.useEffect($,K)},ut.useId=function(){return Y.current.useId()},ut.useImperativeHandle=function($,K,te){return Y.current.useImperativeHandle($,K,te)},ut.useInsertionEffect=function($,K){return Y.current.useInsertionEffect($,K)},ut.useLayoutEffect=function($,K){return Y.current.useLayoutEffect($,K)},ut.useMemo=function($,K){return Y.current.useMemo($,K)},ut.useReducer=function($,K,te){return Y.current.useReducer($,K,te)},ut.useRef=function($){return Y.current.useRef($)},ut.useState=function($){return Y.current.useState($)},ut.useSyncExternalStore=function($,K,te){return Y.current.useSyncExternalStore($,K,te)},ut.useTransition=function(){return Y.current.useTransition()},ut.version="18.3.1",ut}var Lf;function lh(){return Lf||(Lf=1,Zc.exports=Z_()),Zc.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 Nf;function ew(){if(Nf)return mo;Nf=1;var t=lh(),e=Symbol.for("react.element"),s=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,d=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,g){var v,h={},b=null,E=null;g!==void 0&&(b=""+g),c.key!==void 0&&(b=""+c.key),c.ref!==void 0&&(E=c.ref);for(v in c)a.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:E,props:h,_owner:d.current}}return mo.Fragment=s,mo.jsx=y,mo.jsxs=y,mo}var Rf;function tw(){return Rf||(Rf=1,Jc.exports=ew()),Jc.exports}var o=tw(),qa={},eu={exports:{}},En={},tu={exports:{}},nu={};/**
|
|
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 Mf;function nw(){return Mf||(Mf=1,(function(t){function e(z,P){var U=z.length;z.push(P);e:for(;0<U;){var $=U-1>>>1,K=z[$];if(0<d(K,P))z[$]=P,z[U]=K,U=$;else break e}}function s(z){return z.length===0?null:z[0]}function a(z){if(z.length===0)return null;var P=z[0],U=z.pop();if(U!==P){z[0]=U;e:for(var $=0,K=z.length,te=K>>>1;$<te;){var oe=2*($+1)-1,we=z[oe],me=oe+1,X=z[me];if(0>d(we,U))me<K&&0>d(X,we)?(z[$]=X,z[me]=U,$=me):(z[$]=we,z[oe]=U,$=oe);else if(me<K&&0>d(X,U))z[$]=X,z[me]=U,$=me;else break e}}return P}function d(z,P){var U=z.sortIndex-P.sortIndex;return U!==0?U:z.id-P.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=[],g=[],v=1,h=null,b=3,E=!1,N=!1,_=!1,u=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,m=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(z){for(var P=s(g);P!==null;){if(P.callback===null)a(g);else if(P.startTime<=z)a(g),P.sortIndex=P.expirationTime,e(c,P);else break;P=s(g)}}function x(z){if(_=!1,f(z),!N)if(s(c)!==null)N=!0,G(j);else{var P=s(g);P!==null&&Y(x,P.startTime-z)}}function j(z,P){N=!1,_&&(_=!1,p(S),S=-1),E=!0;var U=b;try{for(f(P),h=s(c);h!==null&&(!(h.expirationTime>P)||z&&!B());){var $=h.callback;if(typeof $=="function"){h.callback=null,b=h.priorityLevel;var K=$(h.expirationTime<=P);P=t.unstable_now(),typeof K=="function"?h.callback=K:h===s(c)&&a(c),f(P)}else a(c);h=s(c)}if(h!==null)var te=!0;else{var oe=s(g);oe!==null&&Y(x,oe.startTime-P),te=!1}return te}finally{h=null,b=U,E=!1}}var T=!1,R=null,S=-1,L=5,I=-1;function B(){return!(t.unstable_now()-I<L)}function F(){if(R!==null){var z=t.unstable_now();I=z;var P=!0;try{P=R(!0,z)}finally{P?D():(T=!1,R=null)}}else T=!1}var D;if(typeof m=="function")D=function(){m(F)};else if(typeof MessageChannel<"u"){var H=new MessageChannel,W=H.port2;H.port1.onmessage=F,D=function(){W.postMessage(null)}}else D=function(){u(F,0)};function G(z){R=z,T||(T=!0,D())}function Y(z,P){S=u(function(){z(t.unstable_now())},P)}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(z){z.callback=null},t.unstable_continueExecution=function(){N||E||(N=!0,G(j))},t.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):L=0<z?Math.floor(1e3/z):5},t.unstable_getCurrentPriorityLevel=function(){return b},t.unstable_getFirstCallbackNode=function(){return s(c)},t.unstable_next=function(z){switch(b){case 1:case 2:case 3:var P=3;break;default:P=b}var U=b;b=P;try{return z()}finally{b=U}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(z,P){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var U=b;b=z;try{return P()}finally{b=U}},t.unstable_scheduleCallback=function(z,P,U){var $=t.unstable_now();switch(typeof U=="object"&&U!==null?(U=U.delay,U=typeof U=="number"&&0<U?$+U:$):U=$,z){case 1:var K=-1;break;case 2:K=250;break;case 5:K=1073741823;break;case 4:K=1e4;break;default:K=5e3}return K=U+K,z={id:v++,callback:P,priorityLevel:z,startTime:U,expirationTime:K,sortIndex:-1},U>$?(z.sortIndex=U,e(g,z),s(c)===null&&z===s(g)&&(_?(p(S),S=-1):_=!0,Y(x,U-$))):(z.sortIndex=K,e(c,z),N||E||(N=!0,G(j))),z},t.unstable_shouldYield=B,t.unstable_wrapCallback=function(z){var P=b;return function(){var U=b;b=P;try{return z.apply(this,arguments)}finally{b=U}}}})(nu)),nu}var Af;function rw(){return Af||(Af=1,tu.exports=nw()),tu.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 If;function sw(){if(If)return En;If=1;var t=lh(),e=rw();function s(n){for(var r="https://reactjs.org/docs/error-decoder.html?invariant="+n,l=1;l<arguments.length;l++)r+="&args[]="+encodeURIComponent(arguments[l]);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 a=new Set,d={};function k(n,r){y(n,r),y(n+"Capture",r)}function y(n,r){for(d[n]=r,n=0;n<r.length;n++)a.add(r[n])}var i=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),c=Object.prototype.hasOwnProperty,g=/^[: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:g.test(n)?h[n]=!0:(v[n]=!0,!1)}function E(n,r,l,C){if(l!==null&&l.type===0)return!1;switch(typeof r){case"function":case"symbol":return!0;case"boolean":return C?!1:l!==null?!l.acceptsBooleans:(n=n.toLowerCase().slice(0,5),n!=="data-"&&n!=="aria-");default:return!1}}function N(n,r,l,C){if(r===null||typeof r>"u"||E(n,r,l,C))return!0;if(C)return!1;if(l!==null)switch(l.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 _(n,r,l,C,A,O,q){this.acceptsBooleans=r===2||r===3||r===4,this.attributeName=C,this.attributeNamespace=A,this.mustUseProperty=l,this.propertyName=n,this.type=r,this.sanitizeURL=O,this.removeEmptyString=q}var u={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){u[n]=new _(n,0,!1,n,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var r=n[0];u[r]=new _(r,1,!1,n[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(n){u[n]=new _(n,2,!1,n.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){u[n]=new _(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){u[n]=new _(n,3,!1,n.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(n){u[n]=new _(n,3,!0,n,null,!1,!1)}),["capture","download"].forEach(function(n){u[n]=new _(n,4,!1,n,null,!1,!1)}),["cols","rows","size","span"].forEach(function(n){u[n]=new _(n,6,!1,n,null,!1,!1)}),["rowSpan","start"].forEach(function(n){u[n]=new _(n,5,!1,n.toLowerCase(),null,!1,!1)});var p=/[\-:]([a-z])/g;function m(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(p,m);u[r]=new _(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(p,m);u[r]=new _(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(p,m);u[r]=new _(r,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(n){u[n]=new _(n,1,!1,n.toLowerCase(),null,!1,!1)}),u.xlinkHref=new _("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(n){u[n]=new _(n,1,!1,n.toLowerCase(),null,!0,!0)});function f(n,r,l,C){var A=u.hasOwnProperty(r)?u[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,l,A,C)&&(l=null),C||A===null?b(r)&&(l===null?n.removeAttribute(r):n.setAttribute(r,""+l)):A.mustUseProperty?n[A.propertyName]=l===null?A.type===3?!1:"":l:(r=A.attributeName,C=A.attributeNamespace,l===null?n.removeAttribute(r):(A=A.type,l=A===3||A===4&&l===!0?"":""+l,C?n.setAttributeNS(C,r,l):n.setAttribute(r,l))))}var x=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,j=Symbol.for("react.element"),T=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"),B=Symbol.for("react.context"),F=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),H=Symbol.for("react.suspense_list"),W=Symbol.for("react.memo"),G=Symbol.for("react.lazy"),Y=Symbol.for("react.offscreen"),z=Symbol.iterator;function P(n){return n===null||typeof n!="object"?null:(n=z&&n[z]||n["@@iterator"],typeof n=="function"?n:null)}var U=Object.assign,$;function K(n){if($===void 0)try{throw Error()}catch(l){var r=l.stack.trim().match(/\n( *(at )?)/);$=r&&r[1]||""}return`
|
|
34
|
-
`+$+n}var te=!1;function oe(n,r){if(!n||te)return"";te=!0;var l=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(he){var C=he}Reflect.construct(n,[],r)}else{try{r.call()}catch(he){C=he}n.call(r.prototype)}else{try{throw Error()}catch(he){C=he}n()}}catch(he){if(he&&C&&typeof he.stack=="string"){for(var A=he.stack.split(`
|
|
35
|
-
`),O=C.stack.split(`
|
|
36
|
-
`),q=A.length-1,Q=O.length-1;1<=q&&0<=Q&&A[q]!==O[Q];)Q--;for(;1<=q&&0<=Q;q--,Q--)if(A[q]!==O[Q]){if(q!==1||Q!==1)do if(q--,Q--,0>Q||A[q]!==O[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=l}return(n=n?n.displayName||n.name:"")?K(n):""}function we(n){switch(n.tag){case 5:return K(n.type);case 16:return K("Lazy");case 13:return K("Suspense");case 19:return K("SuspenseList");case 0:case 2:case 15:return n=oe(n.type,!1),n;case 11:return n=oe(n.type.render,!1),n;case 1:return n=oe(n.type,!0),n;default:return""}}function me(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 T:return"Portal";case L:return"Profiler";case S:return"StrictMode";case D:return"Suspense";case H:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case B:return(n.displayName||"Context")+".Consumer";case I:return(n._context.displayName||"Context")+".Provider";case F: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:me(n.type)||"Memo";case G:r=n._payload,n=n._init;try{return me(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 me(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 V(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function Z(n){var r=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function ee(n){var r=Z(n)?"checked":"value",l=Object.getOwnPropertyDescriptor(n.constructor.prototype,r),C=""+n[r];if(!n.hasOwnProperty(r)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var A=l.get,O=l.set;return Object.defineProperty(n,r,{configurable:!0,get:function(){return A.call(this)},set:function(q){C=""+q,O.call(this,q)}}),Object.defineProperty(n,r,{enumerable:l.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=ee(n))}function Se(n){if(!n)return!1;var r=n._valueTracker;if(!r)return!0;var l=r.getValue(),C="";return n&&(C=Z(n)?n.checked?"true":"false":n.value),n=C,n!==l?(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 l=r.checked;return U({},r,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:l??n._wrapperState.initialChecked})}function Je(n,r){var l=r.defaultValue==null?"":r.defaultValue,C=r.checked!=null?r.checked:r.defaultChecked;l=V(r.value!=null?r.value:l),n._wrapperState={initialChecked:C,initialValue:l,controlled:r.type==="checkbox"||r.type==="radio"?r.checked!=null:r.value!=null}}function Ze(n,r){r=r.checked,r!=null&&f(n,"checked",r,!1)}function Ae(n,r){Ze(n,r);var l=V(r.value),C=r.type;if(l!=null)C==="number"?(l===0&&n.value===""||n.value!=l)&&(n.value=""+l):n.value!==""+l&&(n.value=""+l);else if(C==="submit"||C==="reset"){n.removeAttribute("value");return}r.hasOwnProperty("value")?ht(n,r.type,l):r.hasOwnProperty("defaultValue")&&ht(n,r.type,V(r.defaultValue)),r.checked==null&&r.defaultChecked!=null&&(n.defaultChecked=!!r.defaultChecked)}function ue(n,r,l){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,l||r===n.value||(n.value=r),n.defaultValue=r}l=n.name,l!==""&&(n.name=""),n.defaultChecked=!!n._wrapperState.initialChecked,l!==""&&(n.name=l)}function ht(n,r,l){(r!=="number"||Ie(n.ownerDocument)!==n)&&(l==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+l&&(n.defaultValue=""+l))}var se=Array.isArray;function pe(n,r,l,C){if(n=n.options,r){r={};for(var A=0;A<l.length;A++)r["$"+l[A]]=!0;for(l=0;l<n.length;l++)A=r.hasOwnProperty("$"+n[l].value),n[l].selected!==A&&(n[l].selected=A),A&&C&&(n[l].defaultSelected=!0)}else{for(l=""+V(l),r=null,A=0;A<n.length;A++){if(n[A].value===l){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 U({},r,{value:void 0,defaultValue:void 0,children:""+n._wrapperState.initialValue})}function be(n,r){var l=r.value;if(l==null){if(l=r.children,r=r.defaultValue,l!=null){if(r!=null)throw Error(s(92));if(se(l)){if(1<l.length)throw Error(s(93));l=l[0]}r=l}r==null&&(r=""),l=r}n._wrapperState={initialValue:V(l)}}function ge(n,r){var l=V(r.value),C=V(r.defaultValue);l!=null&&(l=""+l,l!==n.value&&(n.value=l),r.defaultValue==null&&n.defaultValue!==l&&(n.defaultValue=l)),C!=null&&(n.defaultValue=""+C)}function Le(n){var r=n.textContent;r===n._wrapperState.initialValue&&r!==""&&r!==null&&(n.value=r)}function ce(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 Ye(n,r){return n==null||n==="http://www.w3.org/1999/xhtml"?ce(r):n==="http://www.w3.org/2000/svg"&&r==="foreignObject"?"http://www.w3.org/1999/xhtml":n}var We,He=(function(n){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(r,l,C,A){MSApp.execUnsafeLocalFunction(function(){return n(r,l,C,A)})}:n})(function(n,r){if(n.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in n)n.innerHTML=r;else{for(We=We||document.createElement("div"),We.innerHTML="<svg>"+r.valueOf().toString()+"</svg>",r=We.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;r.firstChild;)n.appendChild(r.firstChild)}});function Oe(n,r){if(r){var l=n.firstChild;if(l&&l===n.lastChild&&l.nodeType===3){l.nodeValue=r;return}}n.textContent=r}var Ue={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(Ue).forEach(function(n){qe.forEach(function(r){r=r+n.charAt(0).toUpperCase()+n.substring(1),Ue[r]=Ue[n]})});function St(n,r,l){return r==null||typeof r=="boolean"||r===""?"":l||typeof r!="number"||r===0||Ue.hasOwnProperty(n)&&Ue[n]?(""+r).trim():r+"px"}function Pt(n,r){n=n.style;for(var l in r)if(r.hasOwnProperty(l)){var C=l.indexOf("--")===0,A=St(l,r[l],C);l==="float"&&(l="cssFloat"),C?n.setProperty(l,A):n[l]=A}}var $t=U({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 dt(n,r){if(r){if($t[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 tn(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 Vt=null;function fe(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var et=null,Xe=null,lt=null;function de(n){if(n=Zi(n)){if(typeof et!="function")throw Error(s(280));var r=n.stateNode;r&&(r=oa(r),et(n.stateNode,n.type,r))}}function Ke(n){Xe?lt?lt.push(n):lt=[n]:Xe=n}function tt(){if(Xe){var n=Xe,r=lt;if(lt=Xe=null,de(n),r)for(n=0;n<r.length;n++)de(r[n])}}function ye(n,r){return n(r)}function ct(){}var xt=!1;function mt(n,r,l){if(xt)return n(r,l);xt=!0;try{return ye(n,r,l)}finally{xt=!1,(Xe!==null||lt!==null)&&(ct(),tt())}}function De(n,r){var l=n.stateNode;if(l===null)return null;var C=oa(l);if(C===null)return null;l=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(l&&typeof l!="function")throw Error(s(231,r,typeof l));return l}var at=!1;if(i)try{var bt={};Object.defineProperty(bt,"passive",{get:function(){at=!0}}),window.addEventListener("test",bt,bt),window.removeEventListener("test",bt,bt)}catch{at=!1}function Xt(n,r,l,C,A,O,q,Q,ne){var he=Array.prototype.slice.call(arguments,3);try{r.apply(l,he)}catch(Ee){this.onError(Ee)}}var wn=!1,Ln=null,An=!1,pr=null,hs={onError:function(n){wn=!0,Ln=n}};function ds(n,r,l,C,A,O,q,Q,ne){wn=!1,Ln=null,Xt.apply(hs,arguments)}function Us(n,r,l,C,A,O,q,Q,ne){if(ds.apply(this,arguments),wn){if(wn){var he=Ln;wn=!1,Ln=null}else throw Error(s(198));An||(An=!0,pr=he)}}function nn(n){var r=n,l=n;if(n.alternate)for(;r.return;)r=r.return;else{n=r;do r=n,(r.flags&4098)!==0&&(l=r.return),n=r.return;while(n)}return r.tag===3?l:null}function Mr(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 Ar(n){if(nn(n)!==n)throw Error(s(188))}function $s(n){var r=n.alternate;if(!r){if(r=nn(n),r===null)throw Error(s(188));return r!==n?null:n}for(var l=n,C=r;;){var A=l.return;if(A===null)break;var O=A.alternate;if(O===null){if(C=A.return,C!==null){l=C;continue}break}if(A.child===O.child){for(O=A.child;O;){if(O===l)return Ar(A),n;if(O===C)return Ar(A),r;O=O.sibling}throw Error(s(188))}if(l.return!==C.return)l=A,C=O;else{for(var q=!1,Q=A.child;Q;){if(Q===l){q=!0,l=A,C=O;break}if(Q===C){q=!0,C=A,l=O;break}Q=Q.sibling}if(!q){for(Q=O.child;Q;){if(Q===l){q=!0,l=O,C=A;break}if(Q===C){q=!0,C=O,l=A;break}Q=Q.sibling}if(!q)throw Error(s(189))}}if(l.alternate!==C)throw Error(s(190))}if(l.tag!==3)throw Error(s(188));return l.stateNode.current===l?n:r}function tr(n){return n=$s(n),n!==null?fs(n):null}function fs(n){if(n.tag===5||n.tag===6)return n;for(n=n.child;n!==null;){var r=fs(n);if(r!==null)return r;n=n.sibling}return null}var ps=e.unstable_scheduleCallback,ms=e.unstable_cancelCallback,gs=e.unstable_shouldYield,Ws=e.unstable_requestPaint,Et=e.unstable_now,zs=e.unstable_getCurrentPriorityLevel,mr=e.unstable_ImmediatePriority,_e=e.unstable_UserBlockingPriority,Be=e.unstable_NormalPriority,it=e.unstable_LowPriority,Ct=e.unstable_IdlePriority,pt=null,Ot=null;function Wn(n){if(Ot&&typeof Ot.onCommitFiberRoot=="function")try{Ot.onCommitFiberRoot(pt,n,void 0,(n.current.flags&128)===128)}catch{}}var Kt=Math.clz32?Math.clz32:Ir,vl=Math.log,vs=Math.LN2;function Ir(n){return n>>>=0,n===0?32:31-(vl(n)/vs|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 jr(n,r){var l=n.pendingLanes;if(l===0)return 0;var C=0,A=n.suspendedLanes,O=n.pingedLanes,q=l&268435455;if(q!==0){var Q=q&~A;Q!==0?C=ys(Q):(O&=q,O!==0&&(C=ys(O)))}else q=l&~A,q!==0?C=ys(q):O!==0&&(C=ys(O));if(C===0)return 0;if(r!==0&&r!==C&&(r&A)===0&&(A=C&-C,O=r&-r,A>=O||A===16&&(O&4194240)!==0))return r;if((C&4)!==0&&(C|=l&16),r=n.entangledLanes,r!==0)for(n=n.entanglements,r&=C;0<r;)l=31-Kt(r),A=1<<l,C|=n[l],r&=~A;return C}function _l(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 ji(n,r){for(var l=n.suspendedLanes,C=n.pingedLanes,A=n.expirationTimes,O=n.pendingLanes;0<O;){var q=31-Kt(O),Q=1<<q,ne=A[q];ne===-1?((Q&l)===0||(Q&C)!==0)&&(A[q]=_l(Q,r)):ne<=r&&(n.expiredLanes|=Q),O&=~Q}}function bs(n){return n=n.pendingLanes&-1073741825,n!==0?n:n&1073741824?1073741824:0}function gr(){var n=_s;return _s<<=1,(_s&4194240)===0&&(_s=64),n}function nr(n){for(var r=[],l=0;31>l;l++)r.push(n);return r}function zn(n,r,l){n.pendingLanes|=r,r!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,r=31-Kt(r),n[r]=l}function Io(n,r){var l=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<l;){var A=31-Kt(l),O=1<<A;r[A]=0,C[A]=-1,n[A]=-1,l&=~O}}function rr(n,r){var l=n.entangledLanes|=r;for(n=n.entanglements;l;){var C=31-Kt(l),A=1<<C;A&r|n[C]&r&&(n[C]|=r),l&=~A}}var gt=0;function qn(n){return n&=-n,1<n?4<n?(n&268435455)!==0?16:536870912:4:1}var jo,qs,vr,ks,Do,Tt=!1,Dr=[],Vn=null,sr=null,In=null,Vs=new Map,Pr=new Map,wt=[],Bt="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 Di(n,r){switch(n){case"focusin":case"focusout":Vn=null;break;case"dragenter":case"dragleave":sr=null;break;case"mouseover":case"mouseout":In=null;break;case"pointerover":case"pointerout":Vs.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":Pr.delete(r.pointerId)}}function jn(n,r,l,C,A,O){return n===null||n.nativeEvent!==O?(n={blockedOn:r,domEventName:l,eventSystemFlags:C,nativeEvent:O,targetContainers:[A]},r!==null&&(r=Zi(r),r!==null&&qs(r)),n):(n.eventSystemFlags|=C,r=n.targetContainers,A!==null&&r.indexOf(A)===-1&&r.push(A),n)}function Po(n,r,l,C,A){switch(r){case"focusin":return Vn=jn(Vn,n,r,l,C,A),!0;case"dragenter":return sr=jn(sr,n,r,l,C,A),!0;case"mouseover":return In=jn(In,n,r,l,C,A),!0;case"pointerover":var O=A.pointerId;return Vs.set(O,jn(Vs.get(O)||null,n,r,l,C,A)),!0;case"gotpointercapture":return O=A.pointerId,Pr.set(O,jn(Pr.get(O)||null,n,r,l,C,A)),!0}return!1}function Oo(n){var r=xs(n.target);if(r!==null){var l=nn(r);if(l!==null){if(r=l.tag,r===13){if(r=Mr(l),r!==null){n.blockedOn=r,Do(n.priority,function(){vr(l)});return}}else if(r===3&&l.stateNode.current.memoizedState.isDehydrated){n.blockedOn=l.tag===3?l.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 l=Pi(n.domEventName,n.eventSystemFlags,r[0],n.nativeEvent);if(l===null){l=n.nativeEvent;var C=new l.constructor(l.type,l);Vt=C,l.target.dispatchEvent(C),Vt=null}else return r=Zi(l),r!==null&&qs(r),n.blockedOn=l,!1;r.shift()}return!0}function Bo(n,r,l){Ks(n)&&l.delete(r)}function Fo(){Tt=!1,Vn!==null&&Ks(Vn)&&(Vn=null),sr!==null&&Ks(sr)&&(sr=null),In!==null&&Ks(In)&&(In=null),Vs.forEach(Bo),Pr.forEach(Bo)}function Or(n,r){n.blockedOn===r&&(n.blockedOn=null,Tt||(Tt=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Fo)))}function _r(n){function r(A){return Or(A,n)}if(0<Dr.length){Or(Dr[0],n);for(var l=1;l<Dr.length;l++){var C=Dr[l];C.blockedOn===n&&(C.blockedOn=null)}}for(Vn!==null&&Or(Vn,n),sr!==null&&Or(sr,n),In!==null&&Or(In,n),Vs.forEach(r),Pr.forEach(r),l=0;l<wt.length;l++)C=wt[l],C.blockedOn===n&&(C.blockedOn=null);for(;0<wt.length&&(l=wt[0],l.blockedOn===null);)Oo(l),l.blockedOn===null&&wt.shift()}var Br=x.ReactCurrentBatchConfig,Cs=!0;function Ho(n,r,l,C){var A=gt,O=Br.transition;Br.transition=null;try{gt=1,Gs(n,r,l,C)}finally{gt=A,Br.transition=O}}function Uo(n,r,l,C){var A=gt,O=Br.transition;Br.transition=null;try{gt=4,Gs(n,r,l,C)}finally{gt=A,Br.transition=O}}function Gs(n,r,l,C){if(Cs){var A=Pi(n,r,l,C);if(A===null)$l(n,r,C,Ys,l),Di(n,C);else if(Po(A,n,r,l,C))C.stopPropagation();else if(Di(n,C),r&4&&-1<Bt.indexOf(n)){for(;A!==null;){var O=Zi(A);if(O!==null&&jo(O),O=Pi(n,r,l,C),O===null&&$l(n,r,C,Ys,l),O===A)break;A=O}A!==null&&C.stopPropagation()}else $l(n,r,C,null,l)}}var Ys=null;function Pi(n,r,l,C){if(Ys=null,n=fe(C),n=xs(n),n!==null)if(r=nn(n),r===null)n=null;else if(l=r.tag,l===13){if(n=Mr(r),n!==null)return n;n=null}else if(l===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 Oi(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(zs()){case mr:return 1;case _e:return 4;case Be:case it:return 16;case Ct:return 536870912;default:return 16}default:return 16}}var an=null,Xs=null,Fr=null;function Qs(){if(Fr)return Fr;var n,r=Xs,l=r.length,C,A="value"in an?an.value:an.textContent,O=A.length;for(n=0;n<l&&r[n]===A[n];n++);var q=l-n;for(C=1;C<=q&&r[l-C]===A[O-C];C++);return Fr=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 $o(){return!1}function ln(n){function r(l,C,A,O,q){this._reactName=l,this._targetInst=A,this.type=C,this.nativeEvent=O,this.target=q,this.currentTarget=null;for(var Q in n)n.hasOwnProperty(Q)&&(l=n[Q],this[Q]=l?l(O):O[Q]);return this.isDefaultPrevented=(O.defaultPrevented!=null?O.defaultPrevented:O.returnValue===!1)?Zs:$o,this.isPropagationStopped=$o,this}return U(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=Zs)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.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},Bi=ln(mn),Hr=U({},mn,{view:0,detail:0}),wl=ln(Hr),ei,ir,Ur,$r=U({},Hr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Wr,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!==Ur&&(Ur&&n.type==="mousemove"?(ei=n.screenX-Ur.screenX,ir=n.screenY-Ur.screenY):ir=ei=0,Ur=n),ei)},movementY:function(n){return"movementY"in n?n.movementY:ir}}),Wo=ln($r),Fi=U({},$r,{dataTransfer:0}),yl=ln(Fi),ti=U({},Hr,{relatedTarget:0}),ni=ln(ti),bl=U({},mn,{animationName:0,elapsedTime:0,pseudoElement:0}),kl=ln(bl),ri=U({},mn,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),Cl=ln(ri),zo=U({},mn,{data:0}),Hi=ln(zo),Sl={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},xl={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"},El={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Ui(n){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(n):(n=El[n])?!!r[n]:!1}function Wr(){return Ui}var Tl=U({},Hr,{key:function(n){if(n.key){var r=Sl[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"?xl[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Wr,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}}),Ll=ln(Tl),Nl=U({},$r,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),si=ln(Nl),Rl=U({},Hr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Wr}),qo=ln(Rl),Ml=U({},mn,{propertyName:0,elapsedTime:0,pseudoElement:0}),Al=ln(Ml),Il=U({},$r,{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}),Vo=ln(Il),jl=[9,13,27,32],$i=i&&"CompositionEvent"in window,wr=null;i&&"documentMode"in document&&(wr=document.documentMode);var Ko=i&&"TextEvent"in window&&!wr,ii=i&&(!$i||wr&&8<wr&&11>=wr),Wi=" ",Go=!1;function zi(n,r){switch(n){case"keyup":return jl.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function qi(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var yr=!1;function Yo(n,r){switch(n){case"compositionend":return qi(r);case"keypress":return r.which!==32?null:(Go=!0,Wi);case"textInput":return n=r.data,n===Wi&&Go?null:n;default:return null}}function Xo(n,r){if(yr)return n==="compositionend"||!$i&&zi(n,r)?(n=Qs(),Fr=Xs=an=null,yr=!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 ii&&r.locale!=="ko"?null:r.data;default:return null}}var Qo={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 Jo(n){var r=n&&n.nodeName&&n.nodeName.toLowerCase();return r==="input"?!!Qo[n.type]:r==="textarea"}function Vi(n,r,l,C){Ke(C),r=ra(r,"onChange"),0<r.length&&(l=new Bi("onChange","change",null,l,C),n.push({event:l,listeners:r}))}var Kn=null,zr=null;function Zo(n){$h(n,0)}function Ss(n){var r=ui(n);if(Se(r))return n}function J(n,r){if(n==="change")return r}var ke=!1;if(i){var st;if(i){var Qt="oninput"in document;if(!Qt){var yn=document.createElement("div");yn.setAttribute("oninput","return;"),Qt=typeof yn.oninput=="function"}st=Qt}else st=!1;ke=st&&(!document.documentMode||9<document.documentMode)}function Th(){Kn&&(Kn.detachEvent("onpropertychange",Lh),zr=Kn=null)}function Lh(n){if(n.propertyName==="value"&&Ss(zr)){var r=[];Vi(r,zr,n,fe(n)),mt(Zo,r)}}function Jv(n,r,l){n==="focusin"?(Th(),Kn=r,zr=l,Kn.attachEvent("onpropertychange",Lh)):n==="focusout"&&Th()}function Zv(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return Ss(zr)}function e_(n,r){if(n==="click")return Ss(r)}function t_(n,r){if(n==="input"||n==="change")return Ss(r)}function n_(n,r){return n===r&&(n!==0||1/n===1/r)||n!==n&&r!==r}var Gn=typeof Object.is=="function"?Object.is:n_;function Ki(n,r){if(Gn(n,r))return!0;if(typeof n!="object"||n===null||typeof r!="object"||r===null)return!1;var l=Object.keys(n),C=Object.keys(r);if(l.length!==C.length)return!1;for(C=0;C<l.length;C++){var A=l[C];if(!c.call(r,A)||!Gn(n[A],r[A]))return!1}return!0}function Nh(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function Rh(n,r){var l=Nh(n);n=0;for(var C;l;){if(l.nodeType===3){if(C=n+l.textContent.length,n<=r&&C>=r)return{node:l,offset:r-n};n=C}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=Nh(l)}}function Mh(n,r){return n&&r?n===r?!0:n&&n.nodeType===3?!1:r&&r.nodeType===3?Mh(n,r.parentNode):"contains"in n?n.contains(r):n.compareDocumentPosition?!!(n.compareDocumentPosition(r)&16):!1:!1}function Ah(){for(var n=window,r=Ie();r instanceof n.HTMLIFrameElement;){try{var l=typeof r.contentWindow.location.href=="string"}catch{l=!1}if(l)n=r.contentWindow;else break;r=Ie(n.document)}return r}function Dl(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 r_(n){var r=Ah(),l=n.focusedElem,C=n.selectionRange;if(r!==l&&l&&l.ownerDocument&&Mh(l.ownerDocument.documentElement,l)){if(C!==null&&Dl(l)){if(r=C.start,n=C.end,n===void 0&&(n=r),"selectionStart"in l)l.selectionStart=r,l.selectionEnd=Math.min(n,l.value.length);else if(n=(r=l.ownerDocument||document)&&r.defaultView||window,n.getSelection){n=n.getSelection();var A=l.textContent.length,O=Math.min(C.start,A);C=C.end===void 0?O:Math.min(C.end,A),!n.extend&&O>C&&(A=C,C=O,O=A),A=Rh(l,O);var q=Rh(l,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(),O>C?(n.addRange(r),n.extend(q.node,q.offset)):(r.setEnd(q.node,q.offset),n.addRange(r)))}}for(r=[],n=l;n=n.parentNode;)n.nodeType===1&&r.push({element:n,left:n.scrollLeft,top:n.scrollTop});for(typeof l.focus=="function"&&l.focus(),l=0;l<r.length;l++)n=r[l],n.element.scrollLeft=n.left,n.element.scrollTop=n.top}}var s_=i&&"documentMode"in document&&11>=document.documentMode,oi=null,Pl=null,Gi=null,Ol=!1;function Ih(n,r,l){var C=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Ol||oi==null||oi!==Ie(C)||(C=oi,"selectionStart"in C&&Dl(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}),Gi&&Ki(Gi,C)||(Gi=C,C=ra(Pl,"onSelect"),0<C.length&&(r=new Bi("onSelect","select",null,r,l),n.push({event:r,listeners:C}),r.target=oi)))}function ea(n,r){var l={};return l[n.toLowerCase()]=r.toLowerCase(),l["Webkit"+n]="webkit"+r,l["Moz"+n]="moz"+r,l}var ai={animationend:ea("Animation","AnimationEnd"),animationiteration:ea("Animation","AnimationIteration"),animationstart:ea("Animation","AnimationStart"),transitionend:ea("Transition","TransitionEnd")},Bl={},jh={};i&&(jh=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 ta(n){if(Bl[n])return Bl[n];if(!ai[n])return n;var r=ai[n],l;for(l in r)if(r.hasOwnProperty(l)&&l in jh)return Bl[n]=r[l];return n}var Dh=ta("animationend"),Ph=ta("animationiteration"),Oh=ta("animationstart"),Bh=ta("transitionend"),Fh=new Map,Hh="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 qr(n,r){Fh.set(n,r),k(r,[n])}for(var Fl=0;Fl<Hh.length;Fl++){var Hl=Hh[Fl],i_=Hl.toLowerCase(),o_=Hl[0].toUpperCase()+Hl.slice(1);qr(i_,"on"+o_)}qr(Dh,"onAnimationEnd"),qr(Ph,"onAnimationIteration"),qr(Oh,"onAnimationStart"),qr("dblclick","onDoubleClick"),qr("focusin","onFocus"),qr("focusout","onBlur"),qr(Bh,"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 Yi="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(" "),a_=new Set("cancel close invalid load scroll toggle".split(" ").concat(Yi));function Uh(n,r,l){var C=n.type||"unknown-event";n.currentTarget=l,Us(C,r,void 0,n),n.currentTarget=null}function $h(n,r){r=(r&4)!==0;for(var l=0;l<n.length;l++){var C=n[l],A=C.event;C=C.listeners;e:{var O=void 0;if(r)for(var q=C.length-1;0<=q;q--){var Q=C[q],ne=Q.instance,he=Q.currentTarget;if(Q=Q.listener,ne!==O&&A.isPropagationStopped())break e;Uh(A,Q,he),O=ne}else for(q=0;q<C.length;q++){if(Q=C[q],ne=Q.instance,he=Q.currentTarget,Q=Q.listener,ne!==O&&A.isPropagationStopped())break e;Uh(A,Q,he),O=ne}}}if(An)throw n=pr,An=!1,pr=null,n}function Rt(n,r){var l=r[Gl];l===void 0&&(l=r[Gl]=new Set);var C=n+"__bubble";l.has(C)||(Wh(r,n,2,!1),l.add(C))}function Ul(n,r,l){var C=0;r&&(C|=4),Wh(l,n,C,r)}var na="_reactListening"+Math.random().toString(36).slice(2);function Xi(n){if(!n[na]){n[na]=!0,a.forEach(function(l){l!=="selectionchange"&&(a_.has(l)||Ul(l,!1,n),Ul(l,!0,n))});var r=n.nodeType===9?n:n.ownerDocument;r===null||r[na]||(r[na]=!0,Ul("selectionchange",!1,r))}}function Wh(n,r,l,C){switch(Oi(r)){case 1:var A=Ho;break;case 4:A=Uo;break;default:A=Gs}l=A.bind(null,r,l,n),A=void 0,!at||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(A=!0),C?A!==void 0?n.addEventListener(r,l,{capture:!0,passive:A}):n.addEventListener(r,l,!0):A!==void 0?n.addEventListener(r,l,{passive:A}):n.addEventListener(r,l,!1)}function $l(n,r,l,C,A){var O=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=xs(Q),q===null)return;if(ne=q.tag,ne===5||ne===6){C=O=q;continue e}Q=Q.parentNode}}C=C.return}mt(function(){var he=O,Ee=fe(l),Te=[];e:{var xe=Fh.get(n);if(xe!==void 0){var Fe=Bi,ze=n;switch(n){case"keypress":if(Js(l)===0)break e;case"keydown":case"keyup":Fe=Ll;break;case"focusin":ze="focus",Fe=ni;break;case"focusout":ze="blur",Fe=ni;break;case"beforeblur":case"afterblur":Fe=ni;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Fe=Wo;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Fe=yl;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Fe=qo;break;case Dh:case Ph:case Oh:Fe=kl;break;case Bh:Fe=Al;break;case"scroll":Fe=wl;break;case"wheel":Fe=Vo;break;case"copy":case"cut":case"paste":Fe=Cl;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Fe=si}var Ve=(r&4)!==0,Ut=!Ve&&n==="scroll",ae=Ve?xe!==null?xe+"Capture":null:xe;Ve=[];for(var re=he,le;re!==null;){le=re;var Ne=le.stateNode;if(le.tag===5&&Ne!==null&&(le=Ne,ae!==null&&(Ne=De(re,ae),Ne!=null&&Ve.push(Qi(re,Ne,le)))),Ut)break;re=re.return}0<Ve.length&&(xe=new Fe(xe,ze,null,l,Ee),Te.push({event:xe,listeners:Ve}))}}if((r&7)===0){e:{if(xe=n==="mouseover"||n==="pointerover",Fe=n==="mouseout"||n==="pointerout",xe&&l!==Vt&&(ze=l.relatedTarget||l.fromElement)&&(xs(ze)||ze[br]))break e;if((Fe||xe)&&(xe=Ee.window===Ee?Ee:(xe=Ee.ownerDocument)?xe.defaultView||xe.parentWindow:window,Fe?(ze=l.relatedTarget||l.toElement,Fe=he,ze=ze?xs(ze):null,ze!==null&&(Ut=nn(ze),ze!==Ut||ze.tag!==5&&ze.tag!==6)&&(ze=null)):(Fe=null,ze=he),Fe!==ze)){if(Ve=Wo,Ne="onMouseLeave",ae="onMouseEnter",re="mouse",(n==="pointerout"||n==="pointerover")&&(Ve=si,Ne="onPointerLeave",ae="onPointerEnter",re="pointer"),Ut=Fe==null?xe:ui(Fe),le=ze==null?xe:ui(ze),xe=new Ve(Ne,re+"leave",Fe,l,Ee),xe.target=Ut,xe.relatedTarget=le,Ne=null,xs(Ee)===he&&(Ve=new Ve(ae,re+"enter",ze,l,Ee),Ve.target=le,Ve.relatedTarget=Ut,Ne=Ve),Ut=Ne,Fe&&ze)t:{for(Ve=Fe,ae=ze,re=0,le=Ve;le;le=li(le))re++;for(le=0,Ne=ae;Ne;Ne=li(Ne))le++;for(;0<re-le;)Ve=li(Ve),re--;for(;0<le-re;)ae=li(ae),le--;for(;re--;){if(Ve===ae||ae!==null&&Ve===ae.alternate)break t;Ve=li(Ve),ae=li(ae)}Ve=null}else Ve=null;Fe!==null&&zh(Te,xe,Fe,Ve,!1),ze!==null&&Ut!==null&&zh(Te,Ut,ze,Ve,!0)}}e:{if(xe=he?ui(he):window,Fe=xe.nodeName&&xe.nodeName.toLowerCase(),Fe==="select"||Fe==="input"&&xe.type==="file")var Ge=J;else if(Jo(xe))if(ke)Ge=t_;else{Ge=Zv;var nt=Jv}else(Fe=xe.nodeName)&&Fe.toLowerCase()==="input"&&(xe.type==="checkbox"||xe.type==="radio")&&(Ge=e_);if(Ge&&(Ge=Ge(n,he))){Vi(Te,Ge,l,Ee);break e}nt&&nt(n,xe,he),n==="focusout"&&(nt=xe._wrapperState)&&nt.controlled&&xe.type==="number"&&ht(xe,"number",xe.value)}switch(nt=he?ui(he):window,n){case"focusin":(Jo(nt)||nt.contentEditable==="true")&&(oi=nt,Pl=he,Gi=null);break;case"focusout":Gi=Pl=oi=null;break;case"mousedown":Ol=!0;break;case"contextmenu":case"mouseup":case"dragend":Ol=!1,Ih(Te,l,Ee);break;case"selectionchange":if(s_)break;case"keydown":case"keyup":Ih(Te,l,Ee)}var rt;if($i)e:{switch(n){case"compositionstart":var ot="onCompositionStart";break e;case"compositionend":ot="onCompositionEnd";break e;case"compositionupdate":ot="onCompositionUpdate";break e}ot=void 0}else yr?zi(n,l)&&(ot="onCompositionEnd"):n==="keydown"&&l.keyCode===229&&(ot="onCompositionStart");ot&&(ii&&l.locale!=="ko"&&(yr||ot!=="onCompositionStart"?ot==="onCompositionEnd"&&yr&&(rt=Qs()):(an=Ee,Xs="value"in an?an.value:an.textContent,yr=!0)),nt=ra(he,ot),0<nt.length&&(ot=new Hi(ot,n,null,l,Ee),Te.push({event:ot,listeners:nt}),rt?ot.data=rt:(rt=qi(l),rt!==null&&(ot.data=rt)))),(rt=Ko?Yo(n,l):Xo(n,l))&&(he=ra(he,"onBeforeInput"),0<he.length&&(Ee=new Hi("onBeforeInput","beforeinput",null,l,Ee),Te.push({event:Ee,listeners:he}),Ee.data=rt))}$h(Te,r)})}function Qi(n,r,l){return{instance:n,listener:r,currentTarget:l}}function ra(n,r){for(var l=r+"Capture",C=[];n!==null;){var A=n,O=A.stateNode;A.tag===5&&O!==null&&(A=O,O=De(n,l),O!=null&&C.unshift(Qi(n,O,A)),O=De(n,r),O!=null&&C.push(Qi(n,O,A))),n=n.return}return C}function li(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5);return n||null}function zh(n,r,l,C,A){for(var O=r._reactName,q=[];l!==null&&l!==C;){var Q=l,ne=Q.alternate,he=Q.stateNode;if(ne!==null&&ne===C)break;Q.tag===5&&he!==null&&(Q=he,A?(ne=De(l,O),ne!=null&&q.unshift(Qi(l,ne,Q))):A||(ne=De(l,O),ne!=null&&q.push(Qi(l,ne,Q)))),l=l.return}q.length!==0&&n.push({event:r,listeners:q})}var l_=/\r\n?/g,c_=/\u0000|\uFFFD/g;function qh(n){return(typeof n=="string"?n:""+n).replace(l_,`
|
|
38
|
-
`).replace(c_,"")}function sa(n,r,l){if(r=qh(r),qh(n)!==r&&l)throw Error(s(425))}function ia(){}var Wl=null,zl=null;function ql(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 Vl=typeof setTimeout=="function"?setTimeout:void 0,u_=typeof clearTimeout=="function"?clearTimeout:void 0,Vh=typeof Promise=="function"?Promise:void 0,h_=typeof queueMicrotask=="function"?queueMicrotask:typeof Vh<"u"?function(n){return Vh.resolve(null).then(n).catch(d_)}:Vl;function d_(n){setTimeout(function(){throw n})}function Kl(n,r){var l=r,C=0;do{var A=l.nextSibling;if(n.removeChild(l),A&&A.nodeType===8)if(l=A.data,l==="/$"){if(C===0){n.removeChild(A),_r(r);return}C--}else l!=="$"&&l!=="$?"&&l!=="$!"||C++;l=A}while(l);_r(r)}function Vr(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 Kh(n){n=n.previousSibling;for(var r=0;n;){if(n.nodeType===8){var l=n.data;if(l==="$"||l==="$!"||l==="$?"){if(r===0)return n;r--}else l==="/$"&&r++}n=n.previousSibling}return null}var ci=Math.random().toString(36).slice(2),or="__reactFiber$"+ci,Ji="__reactProps$"+ci,br="__reactContainer$"+ci,Gl="__reactEvents$"+ci,f_="__reactListeners$"+ci,p_="__reactHandles$"+ci;function xs(n){var r=n[or];if(r)return r;for(var l=n.parentNode;l;){if(r=l[br]||l[or]){if(l=r.alternate,r.child!==null||l!==null&&l.child!==null)for(n=Kh(n);n!==null;){if(l=n[or])return l;n=Kh(n)}return r}n=l,l=n.parentNode}return null}function Zi(n){return n=n[or]||n[br],!n||n.tag!==5&&n.tag!==6&&n.tag!==13&&n.tag!==3?null:n}function ui(n){if(n.tag===5||n.tag===6)return n.stateNode;throw Error(s(33))}function oa(n){return n[Ji]||null}var Yl=[],hi=-1;function Kr(n){return{current:n}}function Mt(n){0>hi||(n.current=Yl[hi],Yl[hi]=null,hi--)}function Lt(n,r){hi++,Yl[hi]=n.current,n.current=r}var Gr={},cn=Kr(Gr),bn=Kr(!1),Es=Gr;function di(n,r){var l=n.type.contextTypes;if(!l)return Gr;var C=n.stateNode;if(C&&C.__reactInternalMemoizedUnmaskedChildContext===r)return C.__reactInternalMemoizedMaskedChildContext;var A={},O;for(O in l)A[O]=r[O];return C&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=r,n.__reactInternalMemoizedMaskedChildContext=A),A}function kn(n){return n=n.childContextTypes,n!=null}function aa(){Mt(bn),Mt(cn)}function Gh(n,r,l){if(cn.current!==Gr)throw Error(s(168));Lt(cn,r),Lt(bn,l)}function Yh(n,r,l){var C=n.stateNode;if(r=r.childContextTypes,typeof C.getChildContext!="function")return l;C=C.getChildContext();for(var A in C)if(!(A in r))throw Error(s(108,X(n)||"Unknown",A));return U({},l,C)}function la(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||Gr,Es=cn.current,Lt(cn,n),Lt(bn,bn.current),!0}function Xh(n,r,l){var C=n.stateNode;if(!C)throw Error(s(169));l?(n=Yh(n,r,Es),C.__reactInternalMemoizedMergedChildContext=n,Mt(bn),Mt(cn),Lt(cn,n)):Mt(bn),Lt(bn,l)}var kr=null,ca=!1,Xl=!1;function Qh(n){kr===null?kr=[n]:kr.push(n)}function m_(n){ca=!0,Qh(n)}function Yr(){if(!Xl&&kr!==null){Xl=!0;var n=0,r=gt;try{var l=kr;for(gt=1;n<l.length;n++){var C=l[n];do C=C(!0);while(C!==null)}kr=null,ca=!1}catch(A){throw kr!==null&&(kr=kr.slice(n+1)),ps(mr,Yr),A}finally{gt=r,Xl=!1}}return null}var fi=[],pi=0,ua=null,ha=0,Dn=[],Pn=0,Ts=null,Cr=1,Sr="";function Ls(n,r){fi[pi++]=ha,fi[pi++]=ua,ua=n,ha=r}function Jh(n,r,l){Dn[Pn++]=Cr,Dn[Pn++]=Sr,Dn[Pn++]=Ts,Ts=n;var C=Cr;n=Sr;var A=32-Kt(C)-1;C&=~(1<<A),l+=1;var O=32-Kt(r)+A;if(30<O){var q=A-A%5;O=(C&(1<<q)-1).toString(32),C>>=q,A-=q,Cr=1<<32-Kt(r)+A|l<<A|C,Sr=O+n}else Cr=1<<O|l<<A|C,Sr=n}function Ql(n){n.return!==null&&(Ls(n,1),Jh(n,1,0))}function Jl(n){for(;n===ua;)ua=fi[--pi],fi[pi]=null,ha=fi[--pi],fi[pi]=null;for(;n===Ts;)Ts=Dn[--Pn],Dn[Pn]=null,Sr=Dn[--Pn],Dn[Pn]=null,Cr=Dn[--Pn],Dn[Pn]=null}var Nn=null,Rn=null,It=!1,Yn=null;function Zh(n,r){var l=Hn(5,null,null,0);l.elementType="DELETED",l.stateNode=r,l.return=n,r=n.deletions,r===null?(n.deletions=[l],n.flags|=16):r.push(l)}function ed(n,r){switch(n.tag){case 5:var l=n.type;return r=r.nodeType!==1||l.toLowerCase()!==r.nodeName.toLowerCase()?null:r,r!==null?(n.stateNode=r,Nn=n,Rn=Vr(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?(l=Ts!==null?{id:Cr,overflow:Sr}:null,n.memoizedState={dehydrated:r,treeContext:l,retryLane:1073741824},l=Hn(18,null,null,0),l.stateNode=r,l.return=n,n.child=l,Nn=n,Rn=null,!0):!1;default:return!1}}function Zl(n){return(n.mode&1)!==0&&(n.flags&128)===0}function ec(n){if(It){var r=Rn;if(r){var l=r;if(!ed(n,r)){if(Zl(n))throw Error(s(418));r=Vr(l.nextSibling);var C=Nn;r&&ed(n,r)?Zh(C,l):(n.flags=n.flags&-4097|2,It=!1,Nn=n)}}else{if(Zl(n))throw Error(s(418));n.flags=n.flags&-4097|2,It=!1,Nn=n}}}function td(n){for(n=n.return;n!==null&&n.tag!==5&&n.tag!==3&&n.tag!==13;)n=n.return;Nn=n}function da(n){if(n!==Nn)return!1;if(!It)return td(n),It=!0,!1;var r;if((r=n.tag!==3)&&!(r=n.tag!==5)&&(r=n.type,r=r!=="head"&&r!=="body"&&!ql(n.type,n.memoizedProps)),r&&(r=Rn)){if(Zl(n))throw nd(),Error(s(418));for(;r;)Zh(n,r),r=Vr(r.nextSibling)}if(td(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 l=n.data;if(l==="/$"){if(r===0){Rn=Vr(n.nextSibling);break e}r--}else l!=="$"&&l!=="$!"&&l!=="$?"||r++}n=n.nextSibling}Rn=null}}else Rn=Nn?Vr(n.stateNode.nextSibling):null;return!0}function nd(){for(var n=Rn;n;)n=Vr(n.nextSibling)}function mi(){Rn=Nn=null,It=!1}function tc(n){Yn===null?Yn=[n]:Yn.push(n)}var g_=x.ReactCurrentBatchConfig;function eo(n,r,l){if(n=l.ref,n!==null&&typeof n!="function"&&typeof n!="object"){if(l._owner){if(l=l._owner,l){if(l.tag!==1)throw Error(s(309));var C=l.stateNode}if(!C)throw Error(s(147,n));var A=C,O=""+n;return r!==null&&r.ref!==null&&typeof r.ref=="function"&&r.ref._stringRef===O?r.ref:(r=function(q){var Q=A.refs;q===null?delete Q[O]:Q[O]=q},r._stringRef=O,r)}if(typeof n!="string")throw Error(s(284));if(!l._owner)throw Error(s(290,n))}return n}function fa(n,r){throw n=Object.prototype.toString.call(r),Error(s(31,n==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":n))}function rd(n){var r=n._init;return r(n._payload)}function sd(n){function r(ae,re){if(n){var le=ae.deletions;le===null?(ae.deletions=[re],ae.flags|=16):le.push(re)}}function l(ae,re){if(!n)return null;for(;re!==null;)r(ae,re),re=re.sibling;return null}function C(ae,re){for(ae=new Map;re!==null;)re.key!==null?ae.set(re.key,re):ae.set(re.index,re),re=re.sibling;return ae}function A(ae,re){return ae=rs(ae,re),ae.index=0,ae.sibling=null,ae}function O(ae,re,le){return ae.index=le,n?(le=ae.alternate,le!==null?(le=le.index,le<re?(ae.flags|=2,re):le):(ae.flags|=2,re)):(ae.flags|=1048576,re)}function q(ae){return n&&ae.alternate===null&&(ae.flags|=2),ae}function Q(ae,re,le,Ne){return re===null||re.tag!==6?(re=Vc(le,ae.mode,Ne),re.return=ae,re):(re=A(re,le),re.return=ae,re)}function ne(ae,re,le,Ne){var Ge=le.type;return Ge===R?Ee(ae,re,le.props.children,Ne,le.key):re!==null&&(re.elementType===Ge||typeof Ge=="object"&&Ge!==null&&Ge.$$typeof===G&&rd(Ge)===re.type)?(Ne=A(re,le.props),Ne.ref=eo(ae,re,le),Ne.return=ae,Ne):(Ne=Oa(le.type,le.key,le.props,null,ae.mode,Ne),Ne.ref=eo(ae,re,le),Ne.return=ae,Ne)}function he(ae,re,le,Ne){return re===null||re.tag!==4||re.stateNode.containerInfo!==le.containerInfo||re.stateNode.implementation!==le.implementation?(re=Kc(le,ae.mode,Ne),re.return=ae,re):(re=A(re,le.children||[]),re.return=ae,re)}function Ee(ae,re,le,Ne,Ge){return re===null||re.tag!==7?(re=Ps(le,ae.mode,Ne,Ge),re.return=ae,re):(re=A(re,le),re.return=ae,re)}function Te(ae,re,le){if(typeof re=="string"&&re!==""||typeof re=="number")return re=Vc(""+re,ae.mode,le),re.return=ae,re;if(typeof re=="object"&&re!==null){switch(re.$$typeof){case j:return le=Oa(re.type,re.key,re.props,null,ae.mode,le),le.ref=eo(ae,null,re),le.return=ae,le;case T:return re=Kc(re,ae.mode,le),re.return=ae,re;case G:var Ne=re._init;return Te(ae,Ne(re._payload),le)}if(se(re)||P(re))return re=Ps(re,ae.mode,le,null),re.return=ae,re;fa(ae,re)}return null}function xe(ae,re,le,Ne){var Ge=re!==null?re.key:null;if(typeof le=="string"&&le!==""||typeof le=="number")return Ge!==null?null:Q(ae,re,""+le,Ne);if(typeof le=="object"&&le!==null){switch(le.$$typeof){case j:return le.key===Ge?ne(ae,re,le,Ne):null;case T:return le.key===Ge?he(ae,re,le,Ne):null;case G:return Ge=le._init,xe(ae,re,Ge(le._payload),Ne)}if(se(le)||P(le))return Ge!==null?null:Ee(ae,re,le,Ne,null);fa(ae,le)}return null}function Fe(ae,re,le,Ne,Ge){if(typeof Ne=="string"&&Ne!==""||typeof Ne=="number")return ae=ae.get(le)||null,Q(re,ae,""+Ne,Ge);if(typeof Ne=="object"&&Ne!==null){switch(Ne.$$typeof){case j:return ae=ae.get(Ne.key===null?le:Ne.key)||null,ne(re,ae,Ne,Ge);case T:return ae=ae.get(Ne.key===null?le:Ne.key)||null,he(re,ae,Ne,Ge);case G:var nt=Ne._init;return Fe(ae,re,le,nt(Ne._payload),Ge)}if(se(Ne)||P(Ne))return ae=ae.get(le)||null,Ee(re,ae,Ne,Ge,null);fa(re,Ne)}return null}function ze(ae,re,le,Ne){for(var Ge=null,nt=null,rt=re,ot=re=0,en=null;rt!==null&&ot<le.length;ot++){rt.index>ot?(en=rt,rt=null):en=rt.sibling;var _t=xe(ae,rt,le[ot],Ne);if(_t===null){rt===null&&(rt=en);break}n&&rt&&_t.alternate===null&&r(ae,rt),re=O(_t,re,ot),nt===null?Ge=_t:nt.sibling=_t,nt=_t,rt=en}if(ot===le.length)return l(ae,rt),It&&Ls(ae,ot),Ge;if(rt===null){for(;ot<le.length;ot++)rt=Te(ae,le[ot],Ne),rt!==null&&(re=O(rt,re,ot),nt===null?Ge=rt:nt.sibling=rt,nt=rt);return It&&Ls(ae,ot),Ge}for(rt=C(ae,rt);ot<le.length;ot++)en=Fe(rt,ae,ot,le[ot],Ne),en!==null&&(n&&en.alternate!==null&&rt.delete(en.key===null?ot:en.key),re=O(en,re,ot),nt===null?Ge=en:nt.sibling=en,nt=en);return n&&rt.forEach(function(ss){return r(ae,ss)}),It&&Ls(ae,ot),Ge}function Ve(ae,re,le,Ne){var Ge=P(le);if(typeof Ge!="function")throw Error(s(150));if(le=Ge.call(le),le==null)throw Error(s(151));for(var nt=Ge=null,rt=re,ot=re=0,en=null,_t=le.next();rt!==null&&!_t.done;ot++,_t=le.next()){rt.index>ot?(en=rt,rt=null):en=rt.sibling;var ss=xe(ae,rt,_t.value,Ne);if(ss===null){rt===null&&(rt=en);break}n&&rt&&ss.alternate===null&&r(ae,rt),re=O(ss,re,ot),nt===null?Ge=ss:nt.sibling=ss,nt=ss,rt=en}if(_t.done)return l(ae,rt),It&&Ls(ae,ot),Ge;if(rt===null){for(;!_t.done;ot++,_t=le.next())_t=Te(ae,_t.value,Ne),_t!==null&&(re=O(_t,re,ot),nt===null?Ge=_t:nt.sibling=_t,nt=_t);return It&&Ls(ae,ot),Ge}for(rt=C(ae,rt);!_t.done;ot++,_t=le.next())_t=Fe(rt,ae,ot,_t.value,Ne),_t!==null&&(n&&_t.alternate!==null&&rt.delete(_t.key===null?ot:_t.key),re=O(_t,re,ot),nt===null?Ge=_t:nt.sibling=_t,nt=_t);return n&&rt.forEach(function(Y_){return r(ae,Y_)}),It&&Ls(ae,ot),Ge}function Ut(ae,re,le,Ne){if(typeof le=="object"&&le!==null&&le.type===R&&le.key===null&&(le=le.props.children),typeof le=="object"&&le!==null){switch(le.$$typeof){case j:e:{for(var Ge=le.key,nt=re;nt!==null;){if(nt.key===Ge){if(Ge=le.type,Ge===R){if(nt.tag===7){l(ae,nt.sibling),re=A(nt,le.props.children),re.return=ae,ae=re;break e}}else if(nt.elementType===Ge||typeof Ge=="object"&&Ge!==null&&Ge.$$typeof===G&&rd(Ge)===nt.type){l(ae,nt.sibling),re=A(nt,le.props),re.ref=eo(ae,nt,le),re.return=ae,ae=re;break e}l(ae,nt);break}else r(ae,nt);nt=nt.sibling}le.type===R?(re=Ps(le.props.children,ae.mode,Ne,le.key),re.return=ae,ae=re):(Ne=Oa(le.type,le.key,le.props,null,ae.mode,Ne),Ne.ref=eo(ae,re,le),Ne.return=ae,ae=Ne)}return q(ae);case T:e:{for(nt=le.key;re!==null;){if(re.key===nt)if(re.tag===4&&re.stateNode.containerInfo===le.containerInfo&&re.stateNode.implementation===le.implementation){l(ae,re.sibling),re=A(re,le.children||[]),re.return=ae,ae=re;break e}else{l(ae,re);break}else r(ae,re);re=re.sibling}re=Kc(le,ae.mode,Ne),re.return=ae,ae=re}return q(ae);case G:return nt=le._init,Ut(ae,re,nt(le._payload),Ne)}if(se(le))return ze(ae,re,le,Ne);if(P(le))return Ve(ae,re,le,Ne);fa(ae,le)}return typeof le=="string"&&le!==""||typeof le=="number"?(le=""+le,re!==null&&re.tag===6?(l(ae,re.sibling),re=A(re,le),re.return=ae,ae=re):(l(ae,re),re=Vc(le,ae.mode,Ne),re.return=ae,ae=re),q(ae)):l(ae,re)}return Ut}var gi=sd(!0),id=sd(!1),pa=Kr(null),ma=null,vi=null,nc=null;function rc(){nc=vi=ma=null}function sc(n){var r=pa.current;Mt(pa),n._currentValue=r}function ic(n,r,l){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===l)break;n=n.return}}function _i(n,r){ma=n,nc=vi=null,n=n.dependencies,n!==null&&n.firstContext!==null&&((n.lanes&r)!==0&&(Cn=!0),n.firstContext=null)}function On(n){var r=n._currentValue;if(nc!==n)if(n={context:n,memoizedValue:r,next:null},vi===null){if(ma===null)throw Error(s(308));vi=n,ma.dependencies={lanes:0,firstContext:n}}else vi=vi.next=n;return r}var Ns=null;function oc(n){Ns===null?Ns=[n]:Ns.push(n)}function od(n,r,l,C){var A=r.interleaved;return A===null?(l.next=l,oc(r)):(l.next=A.next,A.next=l),r.interleaved=l,xr(n,C)}function xr(n,r){n.lanes|=r;var l=n.alternate;for(l!==null&&(l.lanes|=r),l=n,n=n.return;n!==null;)n.childLanes|=r,l=n.alternate,l!==null&&(l.childLanes|=r),l=n,n=n.return;return l.tag===3?l.stateNode:null}var Xr=!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 Er(n,r){return{eventTime:n,lane:r,tag:0,payload:null,callback:null,next:null}}function Qr(n,r,l){var C=n.updateQueue;if(C===null)return null;if(C=C.shared,(vt&2)!==0){var A=C.pending;return A===null?r.next=r:(r.next=A.next,A.next=r),C.pending=r,xr(n,l)}return A=C.interleaved,A===null?(r.next=r,oc(C)):(r.next=A.next,A.next=r),C.interleaved=r,xr(n,l)}function ga(n,r,l){if(r=r.updateQueue,r!==null&&(r=r.shared,(l&4194240)!==0)){var C=r.lanes;C&=n.pendingLanes,l|=C,r.lanes=l,rr(n,l)}}function ld(n,r){var l=n.updateQueue,C=n.alternate;if(C!==null&&(C=C.updateQueue,l===C)){var A=null,O=null;if(l=l.firstBaseUpdate,l!==null){do{var q={eventTime:l.eventTime,lane:l.lane,tag:l.tag,payload:l.payload,callback:l.callback,next:null};O===null?A=O=q:O=O.next=q,l=l.next}while(l!==null);O===null?A=O=r:O=O.next=r}else A=O=r;l={baseState:C.baseState,firstBaseUpdate:A,lastBaseUpdate:O,shared:C.shared,effects:C.effects},n.updateQueue=l;return}n=l.lastBaseUpdate,n===null?l.firstBaseUpdate=r:n.next=r,l.lastBaseUpdate=r}function va(n,r,l,C){var A=n.updateQueue;Xr=!1;var O=A.firstBaseUpdate,q=A.lastBaseUpdate,Q=A.shared.pending;if(Q!==null){A.shared.pending=null;var ne=Q,he=ne.next;ne.next=null,q===null?O=he:q.next=he,q=ne;var Ee=n.alternate;Ee!==null&&(Ee=Ee.updateQueue,Q=Ee.lastBaseUpdate,Q!==q&&(Q===null?Ee.firstBaseUpdate=he:Q.next=he,Ee.lastBaseUpdate=ne))}if(O!==null){var Te=A.baseState;q=0,Ee=he=ne=null,Q=O;do{var xe=Q.lane,Fe=Q.eventTime;if((C&xe)===xe){Ee!==null&&(Ee=Ee.next={eventTime:Fe,lane:0,tag:Q.tag,payload:Q.payload,callback:Q.callback,next:null});e:{var ze=n,Ve=Q;switch(xe=r,Fe=l,Ve.tag){case 1:if(ze=Ve.payload,typeof ze=="function"){Te=ze.call(Fe,Te,xe);break e}Te=ze;break e;case 3:ze.flags=ze.flags&-65537|128;case 0:if(ze=Ve.payload,xe=typeof ze=="function"?ze.call(Fe,Te,xe):ze,xe==null)break e;Te=U({},Te,xe);break e;case 2:Xr=!0}}Q.callback!==null&&Q.lane!==0&&(n.flags|=64,xe=A.effects,xe===null?A.effects=[Q]:xe.push(Q))}else Fe={eventTime:Fe,lane:xe,tag:Q.tag,payload:Q.payload,callback:Q.callback,next:null},Ee===null?(he=Ee=Fe,ne=Te):Ee=Ee.next=Fe,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=Te),A.baseState=ne,A.firstBaseUpdate=he,A.lastBaseUpdate=Ee,r=A.shared.interleaved,r!==null){A=r;do q|=A.lane,A=A.next;while(A!==r)}else O===null&&(A.shared.lanes=0);As|=q,n.lanes=q,n.memoizedState=Te}}function cd(n,r,l){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=l,typeof A!="function")throw Error(s(191,A));A.call(C)}}}var to={},ar=Kr(to),no=Kr(to),ro=Kr(to);function Rs(n){if(n===to)throw Error(s(174));return n}function lc(n,r){switch(Lt(ro,r),Lt(no,n),Lt(ar,to),n=r.nodeType,n){case 9:case 11:r=(r=r.documentElement)?r.namespaceURI:Ye(null,"");break;default:n=n===8?r.parentNode:r,r=n.namespaceURI||null,n=n.tagName,r=Ye(r,n)}Mt(ar),Lt(ar,r)}function wi(){Mt(ar),Mt(no),Mt(ro)}function ud(n){Rs(ro.current);var r=Rs(ar.current),l=Ye(r,n.type);r!==l&&(Lt(no,n),Lt(ar,l))}function cc(n){no.current===n&&(Mt(ar),Mt(no))}var jt=Kr(0);function _a(n){for(var r=n;r!==null;){if(r.tag===13){var l=r.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||l.data==="$?"||l.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 uc=[];function hc(){for(var n=0;n<uc.length;n++)uc[n]._workInProgressVersionPrimary=null;uc.length=0}var wa=x.ReactCurrentDispatcher,dc=x.ReactCurrentBatchConfig,Ms=0,Dt=null,Gt=null,Jt=null,ya=!1,so=!1,io=0,v_=0;function un(){throw Error(s(321))}function fc(n,r){if(r===null)return!1;for(var l=0;l<r.length&&l<n.length;l++)if(!Gn(n[l],r[l]))return!1;return!0}function pc(n,r,l,C,A,O){if(Ms=O,Dt=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,wa.current=n===null||n.memoizedState===null?b_:k_,n=l(C,A),so){O=0;do{if(so=!1,io=0,25<=O)throw Error(s(301));O+=1,Jt=Gt=null,r.updateQueue=null,wa.current=C_,n=l(C,A)}while(so)}if(wa.current=Ca,r=Gt!==null&&Gt.next!==null,Ms=0,Jt=Gt=Dt=null,ya=!1,r)throw Error(s(300));return n}function mc(){var n=io!==0;return io=0,n}function lr(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Jt===null?Dt.memoizedState=Jt=n:Jt=Jt.next=n,Jt}function Bn(){if(Gt===null){var n=Dt.alternate;n=n!==null?n.memoizedState:null}else n=Gt.next;var r=Jt===null?Dt.memoizedState:Jt.next;if(r!==null)Jt=r,Gt=n;else{if(n===null)throw Error(s(310));Gt=n,n={memoizedState:Gt.memoizedState,baseState:Gt.baseState,baseQueue:Gt.baseQueue,queue:Gt.queue,next:null},Jt===null?Dt.memoizedState=Jt=n:Jt=Jt.next=n}return Jt}function oo(n,r){return typeof r=="function"?r(n):r}function gc(n){var r=Bn(),l=r.queue;if(l===null)throw Error(s(311));l.lastRenderedReducer=n;var C=Gt,A=C.baseQueue,O=l.pending;if(O!==null){if(A!==null){var q=A.next;A.next=O.next,O.next=q}C.baseQueue=A=O,l.pending=null}if(A!==null){O=A.next,C=C.baseState;var Q=q=null,ne=null,he=O;do{var Ee=he.lane;if((Ms&Ee)===Ee)ne!==null&&(ne=ne.next={lane:0,action:he.action,hasEagerState:he.hasEagerState,eagerState:he.eagerState,next:null}),C=he.hasEagerState?he.eagerState:n(C,he.action);else{var Te={lane:Ee,action:he.action,hasEagerState:he.hasEagerState,eagerState:he.eagerState,next:null};ne===null?(Q=ne=Te,q=C):ne=ne.next=Te,Dt.lanes|=Ee,As|=Ee}he=he.next}while(he!==null&&he!==O);ne===null?q=C:ne.next=Q,Gn(C,r.memoizedState)||(Cn=!0),r.memoizedState=C,r.baseState=q,r.baseQueue=ne,l.lastRenderedState=C}if(n=l.interleaved,n!==null){A=n;do O=A.lane,Dt.lanes|=O,As|=O,A=A.next;while(A!==n)}else A===null&&(l.lanes=0);return[r.memoizedState,l.dispatch]}function vc(n){var r=Bn(),l=r.queue;if(l===null)throw Error(s(311));l.lastRenderedReducer=n;var C=l.dispatch,A=l.pending,O=r.memoizedState;if(A!==null){l.pending=null;var q=A=A.next;do O=n(O,q.action),q=q.next;while(q!==A);Gn(O,r.memoizedState)||(Cn=!0),r.memoizedState=O,r.baseQueue===null&&(r.baseState=O),l.lastRenderedState=O}return[O,C]}function hd(){}function dd(n,r){var l=Dt,C=Bn(),A=r(),O=!Gn(C.memoizedState,A);if(O&&(C.memoizedState=A,Cn=!0),C=C.queue,_c(md.bind(null,l,C,n),[n]),C.getSnapshot!==r||O||Jt!==null&&Jt.memoizedState.tag&1){if(l.flags|=2048,ao(9,pd.bind(null,l,C,A,r),void 0,null),Zt===null)throw Error(s(349));(Ms&30)!==0||fd(l,r,A)}return A}function fd(n,r,l){n.flags|=16384,n={getSnapshot:r,value:l},r=Dt.updateQueue,r===null?(r={lastEffect:null,stores:null},Dt.updateQueue=r,r.stores=[n]):(l=r.stores,l===null?r.stores=[n]:l.push(n))}function pd(n,r,l,C){r.value=l,r.getSnapshot=C,gd(r)&&vd(n)}function md(n,r,l){return l(function(){gd(r)&&vd(n)})}function gd(n){var r=n.getSnapshot;n=n.value;try{var l=r();return!Gn(n,l)}catch{return!0}}function vd(n){var r=xr(n,1);r!==null&&Zn(r,n,1,-1)}function _d(n){var r=lr();return typeof n=="function"&&(n=n()),r.memoizedState=r.baseState=n,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:oo,lastRenderedState:n},r.queue=n,n=n.dispatch=y_.bind(null,Dt,n),[r.memoizedState,n]}function ao(n,r,l,C){return n={tag:n,create:r,destroy:l,deps:C,next:null},r=Dt.updateQueue,r===null?(r={lastEffect:null,stores:null},Dt.updateQueue=r,r.lastEffect=n.next=n):(l=r.lastEffect,l===null?r.lastEffect=n.next=n:(C=l.next,l.next=n,n.next=C,r.lastEffect=n)),n}function wd(){return Bn().memoizedState}function ba(n,r,l,C){var A=lr();Dt.flags|=n,A.memoizedState=ao(1|r,l,void 0,C===void 0?null:C)}function ka(n,r,l,C){var A=Bn();C=C===void 0?null:C;var O=void 0;if(Gt!==null){var q=Gt.memoizedState;if(O=q.destroy,C!==null&&fc(C,q.deps)){A.memoizedState=ao(r,l,O,C);return}}Dt.flags|=n,A.memoizedState=ao(1|r,l,O,C)}function yd(n,r){return ba(8390656,8,n,r)}function _c(n,r){return ka(2048,8,n,r)}function bd(n,r){return ka(4,2,n,r)}function kd(n,r){return ka(4,4,n,r)}function Cd(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 Sd(n,r,l){return l=l!=null?l.concat([n]):null,ka(4,4,Cd.bind(null,r,n),l)}function wc(){}function xd(n,r){var l=Bn();r=r===void 0?null:r;var C=l.memoizedState;return C!==null&&r!==null&&fc(r,C[1])?C[0]:(l.memoizedState=[n,r],n)}function Ed(n,r){var l=Bn();r=r===void 0?null:r;var C=l.memoizedState;return C!==null&&r!==null&&fc(r,C[1])?C[0]:(n=n(),l.memoizedState=[n,r],n)}function Td(n,r,l){return(Ms&21)===0?(n.baseState&&(n.baseState=!1,Cn=!0),n.memoizedState=l):(Gn(l,r)||(l=gr(),Dt.lanes|=l,As|=l,n.baseState=!0),r)}function __(n,r){var l=gt;gt=l!==0&&4>l?l:4,n(!0);var C=dc.transition;dc.transition={};try{n(!1),r()}finally{gt=l,dc.transition=C}}function Ld(){return Bn().memoizedState}function w_(n,r,l){var C=ts(n);if(l={lane:C,action:l,hasEagerState:!1,eagerState:null,next:null},Nd(n))Rd(r,l);else if(l=od(n,r,l,C),l!==null){var A=vn();Zn(l,n,C,A),Md(l,r,C)}}function y_(n,r,l){var C=ts(n),A={lane:C,action:l,hasEagerState:!1,eagerState:null,next:null};if(Nd(n))Rd(r,A);else{var O=n.alternate;if(n.lanes===0&&(O===null||O.lanes===0)&&(O=r.lastRenderedReducer,O!==null))try{var q=r.lastRenderedState,Q=O(q,l);if(A.hasEagerState=!0,A.eagerState=Q,Gn(Q,q)){var ne=r.interleaved;ne===null?(A.next=A,oc(r)):(A.next=ne.next,ne.next=A),r.interleaved=A;return}}catch{}finally{}l=od(n,r,A,C),l!==null&&(A=vn(),Zn(l,n,C,A),Md(l,r,C))}}function Nd(n){var r=n.alternate;return n===Dt||r!==null&&r===Dt}function Rd(n,r){so=ya=!0;var l=n.pending;l===null?r.next=r:(r.next=l.next,l.next=r),n.pending=r}function Md(n,r,l){if((l&4194240)!==0){var C=r.lanes;C&=n.pendingLanes,l|=C,r.lanes=l,rr(n,l)}}var Ca={readContext:On,useCallback:un,useContext:un,useEffect:un,useImperativeHandle:un,useInsertionEffect:un,useLayoutEffect:un,useMemo:un,useReducer:un,useRef:un,useState:un,useDebugValue:un,useDeferredValue:un,useTransition:un,useMutableSource:un,useSyncExternalStore:un,useId:un,unstable_isNewReconciler:!1},b_={readContext:On,useCallback:function(n,r){return lr().memoizedState=[n,r===void 0?null:r],n},useContext:On,useEffect:yd,useImperativeHandle:function(n,r,l){return l=l!=null?l.concat([n]):null,ba(4194308,4,Cd.bind(null,r,n),l)},useLayoutEffect:function(n,r){return ba(4194308,4,n,r)},useInsertionEffect:function(n,r){return ba(4,2,n,r)},useMemo:function(n,r){var l=lr();return r=r===void 0?null:r,n=n(),l.memoizedState=[n,r],n},useReducer:function(n,r,l){var C=lr();return r=l!==void 0?l(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=w_.bind(null,Dt,n),[C.memoizedState,n]},useRef:function(n){var r=lr();return n={current:n},r.memoizedState=n},useState:_d,useDebugValue:wc,useDeferredValue:function(n){return lr().memoizedState=n},useTransition:function(){var n=_d(!1),r=n[0];return n=__.bind(null,n[1]),lr().memoizedState=n,[r,n]},useMutableSource:function(){},useSyncExternalStore:function(n,r,l){var C=Dt,A=lr();if(It){if(l===void 0)throw Error(s(407));l=l()}else{if(l=r(),Zt===null)throw Error(s(349));(Ms&30)!==0||fd(C,r,l)}A.memoizedState=l;var O={value:l,getSnapshot:r};return A.queue=O,yd(md.bind(null,C,O,n),[n]),C.flags|=2048,ao(9,pd.bind(null,C,O,l,r),void 0,null),l},useId:function(){var n=lr(),r=Zt.identifierPrefix;if(It){var l=Sr,C=Cr;l=(C&~(1<<32-Kt(C)-1)).toString(32)+l,r=":"+r+"R"+l,l=io++,0<l&&(r+="H"+l.toString(32)),r+=":"}else l=v_++,r=":"+r+"r"+l.toString(32)+":";return n.memoizedState=r},unstable_isNewReconciler:!1},k_={readContext:On,useCallback:xd,useContext:On,useEffect:_c,useImperativeHandle:Sd,useInsertionEffect:bd,useLayoutEffect:kd,useMemo:Ed,useReducer:gc,useRef:wd,useState:function(){return gc(oo)},useDebugValue:wc,useDeferredValue:function(n){var r=Bn();return Td(r,Gt.memoizedState,n)},useTransition:function(){var n=gc(oo)[0],r=Bn().memoizedState;return[n,r]},useMutableSource:hd,useSyncExternalStore:dd,useId:Ld,unstable_isNewReconciler:!1},C_={readContext:On,useCallback:xd,useContext:On,useEffect:_c,useImperativeHandle:Sd,useInsertionEffect:bd,useLayoutEffect:kd,useMemo:Ed,useReducer:vc,useRef:wd,useState:function(){return vc(oo)},useDebugValue:wc,useDeferredValue:function(n){var r=Bn();return Gt===null?r.memoizedState=n:Td(r,Gt.memoizedState,n)},useTransition:function(){var n=vc(oo)[0],r=Bn().memoizedState;return[n,r]},useMutableSource:hd,useSyncExternalStore:dd,useId:Ld,unstable_isNewReconciler:!1};function Xn(n,r){if(n&&n.defaultProps){r=U({},r),n=n.defaultProps;for(var l in n)r[l]===void 0&&(r[l]=n[l]);return r}return r}function yc(n,r,l,C){r=n.memoizedState,l=l(C,r),l=l==null?r:U({},r,l),n.memoizedState=l,n.lanes===0&&(n.updateQueue.baseState=l)}var Sa={isMounted:function(n){return(n=n._reactInternals)?nn(n)===n:!1},enqueueSetState:function(n,r,l){n=n._reactInternals;var C=vn(),A=ts(n),O=Er(C,A);O.payload=r,l!=null&&(O.callback=l),r=Qr(n,O,A),r!==null&&(Zn(r,n,A,C),ga(r,n,A))},enqueueReplaceState:function(n,r,l){n=n._reactInternals;var C=vn(),A=ts(n),O=Er(C,A);O.tag=1,O.payload=r,l!=null&&(O.callback=l),r=Qr(n,O,A),r!==null&&(Zn(r,n,A,C),ga(r,n,A))},enqueueForceUpdate:function(n,r){n=n._reactInternals;var l=vn(),C=ts(n),A=Er(l,C);A.tag=2,r!=null&&(A.callback=r),r=Qr(n,A,C),r!==null&&(Zn(r,n,C,l),ga(r,n,C))}};function Ad(n,r,l,C,A,O,q){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(C,O,q):r.prototype&&r.prototype.isPureReactComponent?!Ki(l,C)||!Ki(A,O):!0}function Id(n,r,l){var C=!1,A=Gr,O=r.contextType;return typeof O=="object"&&O!==null?O=On(O):(A=kn(r)?Es:cn.current,C=r.contextTypes,O=(C=C!=null)?di(n,A):Gr),r=new r(l,O),n.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,r.updater=Sa,n.stateNode=r,r._reactInternals=n,C&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=A,n.__reactInternalMemoizedMaskedChildContext=O),r}function jd(n,r,l,C){n=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(l,C),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(l,C),r.state!==n&&Sa.enqueueReplaceState(r,r.state,null)}function bc(n,r,l,C){var A=n.stateNode;A.props=l,A.state=n.memoizedState,A.refs={},ac(n);var O=r.contextType;typeof O=="object"&&O!==null?A.context=On(O):(O=kn(r)?Es:cn.current,A.context=di(n,O)),A.state=n.memoizedState,O=r.getDerivedStateFromProps,typeof O=="function"&&(yc(n,r,O,l),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&&Sa.enqueueReplaceState(A,A.state,null),va(n,l,A,C),A.state=n.memoizedState),typeof A.componentDidMount=="function"&&(n.flags|=4194308)}function yi(n,r){try{var l="",C=r;do l+=we(C),C=C.return;while(C);var A=l}catch(O){A=`
|
|
39
|
-
Error generating stack: `+O.message+`
|
|
40
|
-
`+O.stack}return{value:n,source:r,stack:A,digest:null}}function kc(n,r,l){return{value:n,source:null,stack:l??null,digest:r??null}}function Cc(n,r){try{console.error(r.value)}catch(l){setTimeout(function(){throw l})}}var S_=typeof WeakMap=="function"?WeakMap:Map;function Dd(n,r,l){l=Er(-1,l),l.tag=3,l.payload={element:null};var C=r.value;return l.callback=function(){Ma||(Ma=!0,Bc=C),Cc(n,r)},l}function Pd(n,r,l){l=Er(-1,l),l.tag=3;var C=n.type.getDerivedStateFromError;if(typeof C=="function"){var A=r.value;l.payload=function(){return C(A)},l.callback=function(){Cc(n,r)}}var O=n.stateNode;return O!==null&&typeof O.componentDidCatch=="function"&&(l.callback=function(){Cc(n,r),typeof C!="function"&&(Zr===null?Zr=new Set([this]):Zr.add(this));var q=r.stack;this.componentDidCatch(r.value,{componentStack:q!==null?q:""})}),l}function Od(n,r,l){var C=n.pingCache;if(C===null){C=n.pingCache=new S_;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(l)||(A.add(l),n=B_.bind(null,n,r,l),r.then(n,n))}function Bd(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 Fd(n,r,l,C,A){return(n.mode&1)===0?(n===r?n.flags|=65536:(n.flags|=128,l.flags|=131072,l.flags&=-52805,l.tag===1&&(l.alternate===null?l.tag=17:(r=Er(-1,1),r.tag=2,Qr(l,r,1))),l.lanes|=1),n):(n.flags|=65536,n.lanes=A,n)}var x_=x.ReactCurrentOwner,Cn=!1;function gn(n,r,l,C){r.child=n===null?id(r,null,l,C):gi(r,n.child,l,C)}function Hd(n,r,l,C,A){l=l.render;var O=r.ref;return _i(r,A),C=pc(n,r,l,C,O,A),l=mc(),n!==null&&!Cn?(r.updateQueue=n.updateQueue,r.flags&=-2053,n.lanes&=~A,Tr(n,r,A)):(It&&l&&Ql(r),r.flags|=1,gn(n,r,C,A),r.child)}function Ud(n,r,l,C,A){if(n===null){var O=l.type;return typeof O=="function"&&!qc(O)&&O.defaultProps===void 0&&l.compare===null&&l.defaultProps===void 0?(r.tag=15,r.type=O,$d(n,r,O,C,A)):(n=Oa(l.type,null,C,r,r.mode,A),n.ref=r.ref,n.return=r,r.child=n)}if(O=n.child,(n.lanes&A)===0){var q=O.memoizedProps;if(l=l.compare,l=l!==null?l:Ki,l(q,C)&&n.ref===r.ref)return Tr(n,r,A)}return r.flags|=1,n=rs(O,C),n.ref=r.ref,n.return=r,r.child=n}function $d(n,r,l,C,A){if(n!==null){var O=n.memoizedProps;if(Ki(O,C)&&n.ref===r.ref)if(Cn=!1,r.pendingProps=C=O,(n.lanes&A)!==0)(n.flags&131072)!==0&&(Cn=!0);else return r.lanes=n.lanes,Tr(n,r,A)}return Sc(n,r,l,C,A)}function Wd(n,r,l){var C=r.pendingProps,A=C.children,O=n!==null?n.memoizedState:null;if(C.mode==="hidden")if((r.mode&1)===0)r.memoizedState={baseLanes:0,cachePool:null,transitions:null},Lt(ki,Mn),Mn|=l;else{if((l&1073741824)===0)return n=O!==null?O.baseLanes|l:l,r.lanes=r.childLanes=1073741824,r.memoizedState={baseLanes:n,cachePool:null,transitions:null},r.updateQueue=null,Lt(ki,Mn),Mn|=n,null;r.memoizedState={baseLanes:0,cachePool:null,transitions:null},C=O!==null?O.baseLanes:l,Lt(ki,Mn),Mn|=C}else O!==null?(C=O.baseLanes|l,r.memoizedState=null):C=l,Lt(ki,Mn),Mn|=C;return gn(n,r,A,l),r.child}function zd(n,r){var l=r.ref;(n===null&&l!==null||n!==null&&n.ref!==l)&&(r.flags|=512,r.flags|=2097152)}function Sc(n,r,l,C,A){var O=kn(l)?Es:cn.current;return O=di(r,O),_i(r,A),l=pc(n,r,l,C,O,A),C=mc(),n!==null&&!Cn?(r.updateQueue=n.updateQueue,r.flags&=-2053,n.lanes&=~A,Tr(n,r,A)):(It&&C&&Ql(r),r.flags|=1,gn(n,r,l,A),r.child)}function qd(n,r,l,C,A){if(kn(l)){var O=!0;la(r)}else O=!1;if(_i(r,A),r.stateNode===null)Ea(n,r),Id(r,l,C),bc(r,l,C,A),C=!0;else if(n===null){var q=r.stateNode,Q=r.memoizedProps;q.props=Q;var ne=q.context,he=l.contextType;typeof he=="object"&&he!==null?he=On(he):(he=kn(l)?Es:cn.current,he=di(r,he));var Ee=l.getDerivedStateFromProps,Te=typeof Ee=="function"||typeof q.getSnapshotBeforeUpdate=="function";Te||typeof q.UNSAFE_componentWillReceiveProps!="function"&&typeof q.componentWillReceiveProps!="function"||(Q!==C||ne!==he)&&jd(r,q,C,he),Xr=!1;var xe=r.memoizedState;q.state=xe,va(r,C,q,A),ne=r.memoizedState,Q!==C||xe!==ne||bn.current||Xr?(typeof Ee=="function"&&(yc(r,l,Ee,C),ne=r.memoizedState),(Q=Xr||Ad(r,l,Q,C,xe,ne,he))?(Te||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=he,C=Q):(typeof q.componentDidMount=="function"&&(r.flags|=4194308),C=!1)}else{q=r.stateNode,ad(n,r),Q=r.memoizedProps,he=r.type===r.elementType?Q:Xn(r.type,Q),q.props=he,Te=r.pendingProps,xe=q.context,ne=l.contextType,typeof ne=="object"&&ne!==null?ne=On(ne):(ne=kn(l)?Es:cn.current,ne=di(r,ne));var Fe=l.getDerivedStateFromProps;(Ee=typeof Fe=="function"||typeof q.getSnapshotBeforeUpdate=="function")||typeof q.UNSAFE_componentWillReceiveProps!="function"&&typeof q.componentWillReceiveProps!="function"||(Q!==Te||xe!==ne)&&jd(r,q,C,ne),Xr=!1,xe=r.memoizedState,q.state=xe,va(r,C,q,A);var ze=r.memoizedState;Q!==Te||xe!==ze||bn.current||Xr?(typeof Fe=="function"&&(yc(r,l,Fe,C),ze=r.memoizedState),(he=Xr||Ad(r,l,he,C,xe,ze,ne)||!1)?(Ee||typeof q.UNSAFE_componentWillUpdate!="function"&&typeof q.componentWillUpdate!="function"||(typeof q.componentWillUpdate=="function"&&q.componentWillUpdate(C,ze,ne),typeof q.UNSAFE_componentWillUpdate=="function"&&q.UNSAFE_componentWillUpdate(C,ze,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=ze),q.props=C,q.state=ze,q.context=ne,C=he):(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 xc(n,r,l,C,O,A)}function xc(n,r,l,C,A,O){zd(n,r);var q=(r.flags&128)!==0;if(!C&&!q)return A&&Xh(r,l,!1),Tr(n,r,O);C=r.stateNode,x_.current=r;var Q=q&&typeof l.getDerivedStateFromError!="function"?null:C.render();return r.flags|=1,n!==null&&q?(r.child=gi(r,n.child,null,O),r.child=gi(r,null,Q,O)):gn(n,r,Q,O),r.memoizedState=C.state,A&&Xh(r,l,!0),r.child}function Vd(n){var r=n.stateNode;r.pendingContext?Gh(n,r.pendingContext,r.pendingContext!==r.context):r.context&&Gh(n,r.context,!1),lc(n,r.containerInfo)}function Kd(n,r,l,C,A){return mi(),tc(A),r.flags|=256,gn(n,r,l,C),r.child}var Ec={dehydrated:null,treeContext:null,retryLane:0};function Tc(n){return{baseLanes:n,cachePool:null,transitions:null}}function Gd(n,r,l){var C=r.pendingProps,A=jt.current,O=!1,q=(r.flags&128)!==0,Q;if((Q=q)||(Q=n!==null&&n.memoizedState===null?!1:(A&2)!==0),Q?(O=!0,r.flags&=-129):(n===null||n.memoizedState!==null)&&(A|=1),Lt(jt,A&1),n===null)return ec(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,O?(C=r.mode,O=r.child,q={mode:"hidden",children:q},(C&1)===0&&O!==null?(O.childLanes=0,O.pendingProps=q):O=Ba(q,C,0,null),n=Ps(n,C,l,null),O.return=r,n.return=r,O.sibling=n,r.child=O,r.child.memoizedState=Tc(l),r.memoizedState=Ec,n):Lc(r,q));if(A=n.memoizedState,A!==null&&(Q=A.dehydrated,Q!==null))return E_(n,r,q,C,Q,A,l);if(O){O=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=rs(A,ne),C.subtreeFlags=A.subtreeFlags&14680064),Q!==null?O=rs(Q,O):(O=Ps(O,q,l,null),O.flags|=2),O.return=r,C.return=r,C.sibling=O,r.child=C,C=O,O=r.child,q=n.child.memoizedState,q=q===null?Tc(l):{baseLanes:q.baseLanes|l,cachePool:null,transitions:q.transitions},O.memoizedState=q,O.childLanes=n.childLanes&~l,r.memoizedState=Ec,C}return O=n.child,n=O.sibling,C=rs(O,{mode:"visible",children:C.children}),(r.mode&1)===0&&(C.lanes=l),C.return=r,C.sibling=null,n!==null&&(l=r.deletions,l===null?(r.deletions=[n],r.flags|=16):l.push(n)),r.child=C,r.memoizedState=null,C}function Lc(n,r){return r=Ba({mode:"visible",children:r},n.mode,0,null),r.return=n,n.child=r}function xa(n,r,l,C){return C!==null&&tc(C),gi(r,n.child,null,l),n=Lc(r,r.pendingProps.children),n.flags|=2,r.memoizedState=null,n}function E_(n,r,l,C,A,O,q){if(l)return r.flags&256?(r.flags&=-257,C=kc(Error(s(422))),xa(n,r,q,C)):r.memoizedState!==null?(r.child=n.child,r.flags|=128,null):(O=C.fallback,A=r.mode,C=Ba({mode:"visible",children:C.children},A,0,null),O=Ps(O,A,q,null),O.flags|=2,C.return=r,O.return=r,C.sibling=O,r.child=C,(r.mode&1)!==0&&gi(r,n.child,null,q),r.child.memoizedState=Tc(q),r.memoizedState=Ec,O);if((r.mode&1)===0)return xa(n,r,q,null);if(A.data==="$!"){if(C=A.nextSibling&&A.nextSibling.dataset,C)var Q=C.dgst;return C=Q,O=Error(s(419)),C=kc(O,C,void 0),xa(n,r,q,C)}if(Q=(q&n.childLanes)!==0,Cn||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!==O.retryLane&&(O.retryLane=A,xr(n,A),Zn(C,n,A,-1))}return zc(),C=kc(Error(s(421))),xa(n,r,q,C)}return A.data==="$?"?(r.flags|=128,r.child=n.child,r=F_.bind(null,n),A._reactRetry=r,null):(n=O.treeContext,Rn=Vr(A.nextSibling),Nn=r,It=!0,Yn=null,n!==null&&(Dn[Pn++]=Cr,Dn[Pn++]=Sr,Dn[Pn++]=Ts,Cr=n.id,Sr=n.overflow,Ts=r),r=Lc(r,C.children),r.flags|=4096,r)}function Yd(n,r,l){n.lanes|=r;var C=n.alternate;C!==null&&(C.lanes|=r),ic(n.return,r,l)}function Nc(n,r,l,C,A){var O=n.memoizedState;O===null?n.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:C,tail:l,tailMode:A}:(O.isBackwards=r,O.rendering=null,O.renderingStartTime=0,O.last=C,O.tail=l,O.tailMode=A)}function Xd(n,r,l){var C=r.pendingProps,A=C.revealOrder,O=C.tail;if(gn(n,r,C.children,l),C=jt.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&&Yd(n,l,r);else if(n.tag===19)Yd(n,l,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(jt,C),(r.mode&1)===0)r.memoizedState=null;else switch(A){case"forwards":for(l=r.child,A=null;l!==null;)n=l.alternate,n!==null&&_a(n)===null&&(A=l),l=l.sibling;l=A,l===null?(A=r.child,r.child=null):(A=l.sibling,l.sibling=null),Nc(r,!1,A,l,O);break;case"backwards":for(l=null,A=r.child,r.child=null;A!==null;){if(n=A.alternate,n!==null&&_a(n)===null){r.child=A;break}n=A.sibling,A.sibling=l,l=A,A=n}Nc(r,!0,l,null,O);break;case"together":Nc(r,!1,null,null,void 0);break;default:r.memoizedState=null}return r.child}function Ea(n,r){(r.mode&1)===0&&n!==null&&(n.alternate=null,r.alternate=null,r.flags|=2)}function Tr(n,r,l){if(n!==null&&(r.dependencies=n.dependencies),As|=r.lanes,(l&r.childLanes)===0)return null;if(n!==null&&r.child!==n.child)throw Error(s(153));if(r.child!==null){for(n=r.child,l=rs(n,n.pendingProps),r.child=l,l.return=r;n.sibling!==null;)n=n.sibling,l=l.sibling=rs(n,n.pendingProps),l.return=r;l.sibling=null}return r.child}function T_(n,r,l){switch(r.tag){case 3:Vd(r),mi();break;case 5:ud(r);break;case 1:kn(r.type)&&la(r);break;case 4:lc(r,r.stateNode.containerInfo);break;case 10:var C=r.type._context,A=r.memoizedProps.value;Lt(pa,C._currentValue),C._currentValue=A;break;case 13:if(C=r.memoizedState,C!==null)return C.dehydrated!==null?(Lt(jt,jt.current&1),r.flags|=128,null):(l&r.child.childLanes)!==0?Gd(n,r,l):(Lt(jt,jt.current&1),n=Tr(n,r,l),n!==null?n.sibling:null);Lt(jt,jt.current&1);break;case 19:if(C=(l&r.childLanes)!==0,(n.flags&128)!==0){if(C)return Xd(n,r,l);r.flags|=128}if(A=r.memoizedState,A!==null&&(A.rendering=null,A.tail=null,A.lastEffect=null),Lt(jt,jt.current),C)break;return null;case 22:case 23:return r.lanes=0,Wd(n,r,l)}return Tr(n,r,l)}var Qd,Rc,Jd,Zd;Qd=function(n,r){for(var l=r.child;l!==null;){if(l.tag===5||l.tag===6)n.appendChild(l.stateNode);else if(l.tag!==4&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===r)break;for(;l.sibling===null;){if(l.return===null||l.return===r)return;l=l.return}l.sibling.return=l.return,l=l.sibling}},Rc=function(){},Jd=function(n,r,l,C){var A=n.memoizedProps;if(A!==C){n=r.stateNode,Rs(ar.current);var O=null;switch(l){case"input":A=je(n,A),C=je(n,C),O=[];break;case"select":A=U({},A,{value:void 0}),C=U({},C,{value:void 0}),O=[];break;case"textarea":A=Ce(n,A),C=Ce(n,C),O=[];break;default:typeof A.onClick!="function"&&typeof C.onClick=="function"&&(n.onclick=ia)}dt(l,C);var q;l=null;for(he in A)if(!C.hasOwnProperty(he)&&A.hasOwnProperty(he)&&A[he]!=null)if(he==="style"){var Q=A[he];for(q in Q)Q.hasOwnProperty(q)&&(l||(l={}),l[q]="")}else he!=="dangerouslySetInnerHTML"&&he!=="children"&&he!=="suppressContentEditableWarning"&&he!=="suppressHydrationWarning"&&he!=="autoFocus"&&(d.hasOwnProperty(he)?O||(O=[]):(O=O||[]).push(he,null));for(he in C){var ne=C[he];if(Q=A!=null?A[he]:void 0,C.hasOwnProperty(he)&&ne!==Q&&(ne!=null||Q!=null))if(he==="style")if(Q){for(q in Q)!Q.hasOwnProperty(q)||ne&&ne.hasOwnProperty(q)||(l||(l={}),l[q]="");for(q in ne)ne.hasOwnProperty(q)&&Q[q]!==ne[q]&&(l||(l={}),l[q]=ne[q])}else l||(O||(O=[]),O.push(he,l)),l=ne;else he==="dangerouslySetInnerHTML"?(ne=ne?ne.__html:void 0,Q=Q?Q.__html:void 0,ne!=null&&Q!==ne&&(O=O||[]).push(he,ne)):he==="children"?typeof ne!="string"&&typeof ne!="number"||(O=O||[]).push(he,""+ne):he!=="suppressContentEditableWarning"&&he!=="suppressHydrationWarning"&&(d.hasOwnProperty(he)?(ne!=null&&he==="onScroll"&&Rt("scroll",n),O||Q===ne||(O=[])):(O=O||[]).push(he,ne))}l&&(O=O||[]).push("style",l);var he=O;(r.updateQueue=he)&&(r.flags|=4)}},Zd=function(n,r,l,C){l!==C&&(r.flags|=4)};function lo(n,r){if(!It)switch(n.tailMode){case"hidden":r=n.tail;for(var l=null;r!==null;)r.alternate!==null&&(l=r),r=r.sibling;l===null?n.tail=null:l.sibling=null;break;case"collapsed":l=n.tail;for(var C=null;l!==null;)l.alternate!==null&&(C=l),l=l.sibling;C===null?r||n.tail===null?n.tail=null:n.tail.sibling=null:C.sibling=null}}function hn(n){var r=n.alternate!==null&&n.alternate.child===n.child,l=0,C=0;if(r)for(var A=n.child;A!==null;)l|=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;)l|=A.lanes|A.childLanes,C|=A.subtreeFlags,C|=A.flags,A.return=n,A=A.sibling;return n.subtreeFlags|=C,n.childLanes=l,r}function L_(n,r,l){var C=r.pendingProps;switch(Jl(r),r.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return hn(r),null;case 1:return kn(r.type)&&aa(),hn(r),null;case 3:return C=r.stateNode,wi(),Mt(bn),Mt(cn),hc(),C.pendingContext&&(C.context=C.pendingContext,C.pendingContext=null),(n===null||n.child===null)&&(da(r)?r.flags|=4:n===null||n.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,Yn!==null&&(Uc(Yn),Yn=null))),Rc(n,r),hn(r),null;case 5:cc(r);var A=Rs(ro.current);if(l=r.type,n!==null&&r.stateNode!=null)Jd(n,r,l,C,A),n.ref!==r.ref&&(r.flags|=512,r.flags|=2097152);else{if(!C){if(r.stateNode===null)throw Error(s(166));return hn(r),null}if(n=Rs(ar.current),da(r)){C=r.stateNode,l=r.type;var O=r.memoizedProps;switch(C[or]=r,C[Ji]=O,n=(r.mode&1)!==0,l){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<Yi.length;A++)Rt(Yi[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,O),Rt("invalid",C);break;case"select":C._wrapperState={wasMultiple:!!O.multiple},Rt("invalid",C);break;case"textarea":be(C,O),Rt("invalid",C)}dt(l,O),A=null;for(var q in O)if(O.hasOwnProperty(q)){var Q=O[q];q==="children"?typeof Q=="string"?C.textContent!==Q&&(O.suppressHydrationWarning!==!0&&sa(C.textContent,Q,n),A=["children",Q]):typeof Q=="number"&&C.textContent!==""+Q&&(O.suppressHydrationWarning!==!0&&sa(C.textContent,Q,n),A=["children",""+Q]):d.hasOwnProperty(q)&&Q!=null&&q==="onScroll"&&Rt("scroll",C)}switch(l){case"input":ve(C),ue(C,O,!0);break;case"textarea":ve(C),Le(C);break;case"select":case"option":break;default:typeof O.onClick=="function"&&(C.onclick=ia)}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=ce(l)),n==="http://www.w3.org/1999/xhtml"?l==="script"?(n=q.createElement("div"),n.innerHTML="<script><\/script>",n=n.removeChild(n.firstChild)):typeof C.is=="string"?n=q.createElement(l,{is:C.is}):(n=q.createElement(l),l==="select"&&(q=n,C.multiple?q.multiple=!0:C.size&&(q.size=C.size))):n=q.createElementNS(n,l),n[or]=r,n[Ji]=C,Qd(n,r,!1,!1),r.stateNode=n;e:{switch(q=tn(l,C),l){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<Yi.length;A++)Rt(Yi[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=U({},C,{value:void 0}),Rt("invalid",n);break;case"textarea":be(n,C),A=Ce(n,C),Rt("invalid",n);break;default:A=C}dt(l,A),Q=A;for(O in Q)if(Q.hasOwnProperty(O)){var ne=Q[O];O==="style"?Pt(n,ne):O==="dangerouslySetInnerHTML"?(ne=ne?ne.__html:void 0,ne!=null&&He(n,ne)):O==="children"?typeof ne=="string"?(l!=="textarea"||ne!=="")&&Oe(n,ne):typeof ne=="number"&&Oe(n,""+ne):O!=="suppressContentEditableWarning"&&O!=="suppressHydrationWarning"&&O!=="autoFocus"&&(d.hasOwnProperty(O)?ne!=null&&O==="onScroll"&&Rt("scroll",n):ne!=null&&f(n,O,ne,q))}switch(l){case"input":ve(n),ue(n,C,!1);break;case"textarea":ve(n),Le(n);break;case"option":C.value!=null&&n.setAttribute("value",""+V(C.value));break;case"select":n.multiple=!!C.multiple,O=C.value,O!=null?pe(n,!!C.multiple,O,!1):C.defaultValue!=null&&pe(n,!!C.multiple,C.defaultValue,!0);break;default:typeof A.onClick=="function"&&(n.onclick=ia)}switch(l){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 hn(r),null;case 6:if(n&&r.stateNode!=null)Zd(n,r,n.memoizedProps,C);else{if(typeof C!="string"&&r.stateNode===null)throw Error(s(166));if(l=Rs(ro.current),Rs(ar.current),da(r)){if(C=r.stateNode,l=r.memoizedProps,C[or]=r,(O=C.nodeValue!==l)&&(n=Nn,n!==null))switch(n.tag){case 3:sa(C.nodeValue,l,(n.mode&1)!==0);break;case 5:n.memoizedProps.suppressHydrationWarning!==!0&&sa(C.nodeValue,l,(n.mode&1)!==0)}O&&(r.flags|=4)}else C=(l.nodeType===9?l:l.ownerDocument).createTextNode(C),C[or]=r,r.stateNode=C}return hn(r),null;case 13:if(Mt(jt),C=r.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(It&&Rn!==null&&(r.mode&1)!==0&&(r.flags&128)===0)nd(),mi(),r.flags|=98560,O=!1;else if(O=da(r),C!==null&&C.dehydrated!==null){if(n===null){if(!O)throw Error(s(318));if(O=r.memoizedState,O=O!==null?O.dehydrated:null,!O)throw Error(s(317));O[or]=r}else mi(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;hn(r),O=!1}else Yn!==null&&(Uc(Yn),Yn=null),O=!0;if(!O)return r.flags&65536?r:null}return(r.flags&128)!==0?(r.lanes=l,r):(C=C!==null,C!==(n!==null&&n.memoizedState!==null)&&C&&(r.child.flags|=8192,(r.mode&1)!==0&&(n===null||(jt.current&1)!==0?Yt===0&&(Yt=3):zc())),r.updateQueue!==null&&(r.flags|=4),hn(r),null);case 4:return wi(),Rc(n,r),n===null&&Xi(r.stateNode.containerInfo),hn(r),null;case 10:return sc(r.type._context),hn(r),null;case 17:return kn(r.type)&&aa(),hn(r),null;case 19:if(Mt(jt),O=r.memoizedState,O===null)return hn(r),null;if(C=(r.flags&128)!==0,q=O.rendering,q===null)if(C)lo(O,!1);else{if(Yt!==0||n!==null&&(n.flags&128)!==0)for(n=r.child;n!==null;){if(q=_a(n),q!==null){for(r.flags|=128,lo(O,!1),C=q.updateQueue,C!==null&&(r.updateQueue=C,r.flags|=4),r.subtreeFlags=0,C=l,l=r.child;l!==null;)O=l,n=C,O.flags&=14680066,q=O.alternate,q===null?(O.childLanes=0,O.lanes=n,O.child=null,O.subtreeFlags=0,O.memoizedProps=null,O.memoizedState=null,O.updateQueue=null,O.dependencies=null,O.stateNode=null):(O.childLanes=q.childLanes,O.lanes=q.lanes,O.child=q.child,O.subtreeFlags=0,O.deletions=null,O.memoizedProps=q.memoizedProps,O.memoizedState=q.memoizedState,O.updateQueue=q.updateQueue,O.type=q.type,n=q.dependencies,O.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),l=l.sibling;return Lt(jt,jt.current&1|2),r.child}n=n.sibling}O.tail!==null&&Et()>Ci&&(r.flags|=128,C=!0,lo(O,!1),r.lanes=4194304)}else{if(!C)if(n=_a(q),n!==null){if(r.flags|=128,C=!0,l=n.updateQueue,l!==null&&(r.updateQueue=l,r.flags|=4),lo(O,!0),O.tail===null&&O.tailMode==="hidden"&&!q.alternate&&!It)return hn(r),null}else 2*Et()-O.renderingStartTime>Ci&&l!==1073741824&&(r.flags|=128,C=!0,lo(O,!1),r.lanes=4194304);O.isBackwards?(q.sibling=r.child,r.child=q):(l=O.last,l!==null?l.sibling=q:r.child=q,O.last=q)}return O.tail!==null?(r=O.tail,O.rendering=r,O.tail=r.sibling,O.renderingStartTime=Et(),r.sibling=null,l=jt.current,Lt(jt,C?l&1|2:l&1),r):(hn(r),null);case 22:case 23:return Wc(),C=r.memoizedState!==null,n!==null&&n.memoizedState!==null!==C&&(r.flags|=8192),C&&(r.mode&1)!==0?(Mn&1073741824)!==0&&(hn(r),r.subtreeFlags&6&&(r.flags|=8192)):hn(r),null;case 24:return null;case 25:return null}throw Error(s(156,r.tag))}function N_(n,r){switch(Jl(r),r.tag){case 1:return kn(r.type)&&aa(),n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 3:return wi(),Mt(bn),Mt(cn),hc(),n=r.flags,(n&65536)!==0&&(n&128)===0?(r.flags=n&-65537|128,r):null;case 5:return cc(r),null;case 13:if(Mt(jt),n=r.memoizedState,n!==null&&n.dehydrated!==null){if(r.alternate===null)throw Error(s(340));mi()}return n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 19:return Mt(jt),null;case 4:return wi(),null;case 10:return sc(r.type._context),null;case 22:case 23:return Wc(),null;case 24:return null;default:return null}}var Ta=!1,dn=!1,R_=typeof WeakSet=="function"?WeakSet:Set,$e=null;function bi(n,r){var l=n.ref;if(l!==null)if(typeof l=="function")try{l(null)}catch(C){Ft(n,r,C)}else l.current=null}function Mc(n,r,l){try{l()}catch(C){Ft(n,r,C)}}var ef=!1;function M_(n,r){if(Wl=Cs,n=Ah(),Dl(n)){if("selectionStart"in n)var l={start:n.selectionStart,end:n.selectionEnd};else e:{l=(l=n.ownerDocument)&&l.defaultView||window;var C=l.getSelection&&l.getSelection();if(C&&C.rangeCount!==0){l=C.anchorNode;var A=C.anchorOffset,O=C.focusNode;C=C.focusOffset;try{l.nodeType,O.nodeType}catch{l=null;break e}var q=0,Q=-1,ne=-1,he=0,Ee=0,Te=n,xe=null;t:for(;;){for(var Fe;Te!==l||A!==0&&Te.nodeType!==3||(Q=q+A),Te!==O||C!==0&&Te.nodeType!==3||(ne=q+C),Te.nodeType===3&&(q+=Te.nodeValue.length),(Fe=Te.firstChild)!==null;)xe=Te,Te=Fe;for(;;){if(Te===n)break t;if(xe===l&&++he===A&&(Q=q),xe===O&&++Ee===C&&(ne=q),(Fe=Te.nextSibling)!==null)break;Te=xe,xe=Te.parentNode}Te=Fe}l=Q===-1||ne===-1?null:{start:Q,end:ne}}else l=null}l=l||{start:0,end:0}}else l=null;for(zl={focusedElem:n,selectionRange:l},Cs=!1,$e=r;$e!==null;)if(r=$e,n=r.child,(r.subtreeFlags&1028)!==0&&n!==null)n.return=r,$e=n;else for(;$e!==null;){r=$e;try{var ze=r.alternate;if((r.flags&1024)!==0)switch(r.tag){case 0:case 11:case 15:break;case 1:if(ze!==null){var Ve=ze.memoizedProps,Ut=ze.memoizedState,ae=r.stateNode,re=ae.getSnapshotBeforeUpdate(r.elementType===r.type?Ve:Xn(r.type,Ve),Ut);ae.__reactInternalSnapshotBeforeUpdate=re}break;case 3:var le=r.stateNode.containerInfo;le.nodeType===1?le.textContent="":le.nodeType===9&&le.documentElement&&le.removeChild(le.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(s(163))}}catch(Ne){Ft(r,r.return,Ne)}if(n=r.sibling,n!==null){n.return=r.return,$e=n;break}$e=r.return}return ze=ef,ef=!1,ze}function co(n,r,l){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 O=A.destroy;A.destroy=void 0,O!==void 0&&Mc(r,l,O)}A=A.next}while(A!==C)}}function La(n,r){if(r=r.updateQueue,r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&n)===n){var C=l.create;l.destroy=C()}l=l.next}while(l!==r)}}function Ac(n){var r=n.ref;if(r!==null){var l=n.stateNode;switch(n.tag){case 5:n=l;break;default:n=l}typeof r=="function"?r(n):r.current=n}}function tf(n){var r=n.alternate;r!==null&&(n.alternate=null,tf(r)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(r=n.stateNode,r!==null&&(delete r[or],delete r[Ji],delete r[Gl],delete r[f_],delete r[p_])),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 nf(n){return n.tag===5||n.tag===3||n.tag===4}function rf(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||nf(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 Ic(n,r,l){var C=n.tag;if(C===5||C===6)n=n.stateNode,r?l.nodeType===8?l.parentNode.insertBefore(n,r):l.insertBefore(n,r):(l.nodeType===8?(r=l.parentNode,r.insertBefore(n,l)):(r=l,r.appendChild(n)),l=l._reactRootContainer,l!=null||r.onclick!==null||(r.onclick=ia));else if(C!==4&&(n=n.child,n!==null))for(Ic(n,r,l),n=n.sibling;n!==null;)Ic(n,r,l),n=n.sibling}function jc(n,r,l){var C=n.tag;if(C===5||C===6)n=n.stateNode,r?l.insertBefore(n,r):l.appendChild(n);else if(C!==4&&(n=n.child,n!==null))for(jc(n,r,l),n=n.sibling;n!==null;)jc(n,r,l),n=n.sibling}var rn=null,Qn=!1;function Jr(n,r,l){for(l=l.child;l!==null;)sf(n,r,l),l=l.sibling}function sf(n,r,l){if(Ot&&typeof Ot.onCommitFiberUnmount=="function")try{Ot.onCommitFiberUnmount(pt,l)}catch{}switch(l.tag){case 5:dn||bi(l,r);case 6:var C=rn,A=Qn;rn=null,Jr(n,r,l),rn=C,Qn=A,rn!==null&&(Qn?(n=rn,l=l.stateNode,n.nodeType===8?n.parentNode.removeChild(l):n.removeChild(l)):rn.removeChild(l.stateNode));break;case 18:rn!==null&&(Qn?(n=rn,l=l.stateNode,n.nodeType===8?Kl(n.parentNode,l):n.nodeType===1&&Kl(n,l),_r(n)):Kl(rn,l.stateNode));break;case 4:C=rn,A=Qn,rn=l.stateNode.containerInfo,Qn=!0,Jr(n,r,l),rn=C,Qn=A;break;case 0:case 11:case 14:case 15:if(!dn&&(C=l.updateQueue,C!==null&&(C=C.lastEffect,C!==null))){A=C=C.next;do{var O=A,q=O.destroy;O=O.tag,q!==void 0&&((O&2)!==0||(O&4)!==0)&&Mc(l,r,q),A=A.next}while(A!==C)}Jr(n,r,l);break;case 1:if(!dn&&(bi(l,r),C=l.stateNode,typeof C.componentWillUnmount=="function"))try{C.props=l.memoizedProps,C.state=l.memoizedState,C.componentWillUnmount()}catch(Q){Ft(l,r,Q)}Jr(n,r,l);break;case 21:Jr(n,r,l);break;case 22:l.mode&1?(dn=(C=dn)||l.memoizedState!==null,Jr(n,r,l),dn=C):Jr(n,r,l);break;default:Jr(n,r,l)}}function of(n){var r=n.updateQueue;if(r!==null){n.updateQueue=null;var l=n.stateNode;l===null&&(l=n.stateNode=new R_),r.forEach(function(C){var A=H_.bind(null,n,C);l.has(C)||(l.add(C),C.then(A,A))})}}function Jn(n,r){var l=r.deletions;if(l!==null)for(var C=0;C<l.length;C++){var A=l[C];try{var O=n,q=r,Q=q;e:for(;Q!==null;){switch(Q.tag){case 5:rn=Q.stateNode,Qn=!1;break e;case 3:rn=Q.stateNode.containerInfo,Qn=!0;break e;case 4:rn=Q.stateNode.containerInfo,Qn=!0;break e}Q=Q.return}if(rn===null)throw Error(s(160));sf(O,q,A),rn=null,Qn=!1;var ne=A.alternate;ne!==null&&(ne.return=null),A.return=null}catch(he){Ft(A,r,he)}}if(r.subtreeFlags&12854)for(r=r.child;r!==null;)af(r,n),r=r.sibling}function af(n,r){var l=n.alternate,C=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:if(Jn(r,n),cr(n),C&4){try{co(3,n,n.return),La(3,n)}catch(Ve){Ft(n,n.return,Ve)}try{co(5,n,n.return)}catch(Ve){Ft(n,n.return,Ve)}}break;case 1:Jn(r,n),cr(n),C&512&&l!==null&&bi(l,l.return);break;case 5:if(Jn(r,n),cr(n),C&512&&l!==null&&bi(l,l.return),n.flags&32){var A=n.stateNode;try{Oe(A,"")}catch(Ve){Ft(n,n.return,Ve)}}if(C&4&&(A=n.stateNode,A!=null)){var O=n.memoizedProps,q=l!==null?l.memoizedProps:O,Q=n.type,ne=n.updateQueue;if(n.updateQueue=null,ne!==null)try{Q==="input"&&O.type==="radio"&&O.name!=null&&Ze(A,O),tn(Q,q);var he=tn(Q,O);for(q=0;q<ne.length;q+=2){var Ee=ne[q],Te=ne[q+1];Ee==="style"?Pt(A,Te):Ee==="dangerouslySetInnerHTML"?He(A,Te):Ee==="children"?Oe(A,Te):f(A,Ee,Te,he)}switch(Q){case"input":Ae(A,O);break;case"textarea":ge(A,O);break;case"select":var xe=A._wrapperState.wasMultiple;A._wrapperState.wasMultiple=!!O.multiple;var Fe=O.value;Fe!=null?pe(A,!!O.multiple,Fe,!1):xe!==!!O.multiple&&(O.defaultValue!=null?pe(A,!!O.multiple,O.defaultValue,!0):pe(A,!!O.multiple,O.multiple?[]:"",!1))}A[Ji]=O}catch(Ve){Ft(n,n.return,Ve)}}break;case 6:if(Jn(r,n),cr(n),C&4){if(n.stateNode===null)throw Error(s(162));A=n.stateNode,O=n.memoizedProps;try{A.nodeValue=O}catch(Ve){Ft(n,n.return,Ve)}}break;case 3:if(Jn(r,n),cr(n),C&4&&l!==null&&l.memoizedState.isDehydrated)try{_r(r.containerInfo)}catch(Ve){Ft(n,n.return,Ve)}break;case 4:Jn(r,n),cr(n);break;case 13:Jn(r,n),cr(n),A=n.child,A.flags&8192&&(O=A.memoizedState!==null,A.stateNode.isHidden=O,!O||A.alternate!==null&&A.alternate.memoizedState!==null||(Oc=Et())),C&4&&of(n);break;case 22:if(Ee=l!==null&&l.memoizedState!==null,n.mode&1?(dn=(he=dn)||Ee,Jn(r,n),dn=he):Jn(r,n),cr(n),C&8192){if(he=n.memoizedState!==null,(n.stateNode.isHidden=he)&&!Ee&&(n.mode&1)!==0)for($e=n,Ee=n.child;Ee!==null;){for(Te=$e=Ee;$e!==null;){switch(xe=$e,Fe=xe.child,xe.tag){case 0:case 11:case 14:case 15:co(4,xe,xe.return);break;case 1:bi(xe,xe.return);var ze=xe.stateNode;if(typeof ze.componentWillUnmount=="function"){C=xe,l=xe.return;try{r=C,ze.props=r.memoizedProps,ze.state=r.memoizedState,ze.componentWillUnmount()}catch(Ve){Ft(C,l,Ve)}}break;case 5:bi(xe,xe.return);break;case 22:if(xe.memoizedState!==null){uf(Te);continue}}Fe!==null?(Fe.return=xe,$e=Fe):uf(Te)}Ee=Ee.sibling}e:for(Ee=null,Te=n;;){if(Te.tag===5){if(Ee===null){Ee=Te;try{A=Te.stateNode,he?(O=A.style,typeof O.setProperty=="function"?O.setProperty("display","none","important"):O.display="none"):(Q=Te.stateNode,ne=Te.memoizedProps.style,q=ne!=null&&ne.hasOwnProperty("display")?ne.display:null,Q.style.display=St("display",q))}catch(Ve){Ft(n,n.return,Ve)}}}else if(Te.tag===6){if(Ee===null)try{Te.stateNode.nodeValue=he?"":Te.memoizedProps}catch(Ve){Ft(n,n.return,Ve)}}else if((Te.tag!==22&&Te.tag!==23||Te.memoizedState===null||Te===n)&&Te.child!==null){Te.child.return=Te,Te=Te.child;continue}if(Te===n)break e;for(;Te.sibling===null;){if(Te.return===null||Te.return===n)break e;Ee===Te&&(Ee=null),Te=Te.return}Ee===Te&&(Ee=null),Te.sibling.return=Te.return,Te=Te.sibling}}break;case 19:Jn(r,n),cr(n),C&4&&of(n);break;case 21:break;default:Jn(r,n),cr(n)}}function cr(n){var r=n.flags;if(r&2){try{e:{for(var l=n.return;l!==null;){if(nf(l)){var C=l;break e}l=l.return}throw Error(s(160))}switch(C.tag){case 5:var A=C.stateNode;C.flags&32&&(Oe(A,""),C.flags&=-33);var O=rf(n);jc(n,O,A);break;case 3:case 4:var q=C.stateNode.containerInfo,Q=rf(n);Ic(n,Q,q);break;default:throw Error(s(161))}}catch(ne){Ft(n,n.return,ne)}n.flags&=-3}r&4096&&(n.flags&=-4097)}function A_(n,r,l){$e=n,lf(n)}function lf(n,r,l){for(var C=(n.mode&1)!==0;$e!==null;){var A=$e,O=A.child;if(A.tag===22&&C){var q=A.memoizedState!==null||Ta;if(!q){var Q=A.alternate,ne=Q!==null&&Q.memoizedState!==null||dn;Q=Ta;var he=dn;if(Ta=q,(dn=ne)&&!he)for($e=A;$e!==null;)q=$e,ne=q.child,q.tag===22&&q.memoizedState!==null?hf(A):ne!==null?(ne.return=q,$e=ne):hf(A);for(;O!==null;)$e=O,lf(O),O=O.sibling;$e=A,Ta=Q,dn=he}cf(n)}else(A.subtreeFlags&8772)!==0&&O!==null?(O.return=A,$e=O):cf(n)}}function cf(n){for(;$e!==null;){var r=$e;if((r.flags&8772)!==0){var l=r.alternate;try{if((r.flags&8772)!==0)switch(r.tag){case 0:case 11:case 15:dn||La(5,r);break;case 1:var C=r.stateNode;if(r.flags&4&&!dn)if(l===null)C.componentDidMount();else{var A=r.elementType===r.type?l.memoizedProps:Xn(r.type,l.memoizedProps);C.componentDidUpdate(A,l.memoizedState,C.__reactInternalSnapshotBeforeUpdate)}var O=r.updateQueue;O!==null&&cd(r,O,C);break;case 3:var q=r.updateQueue;if(q!==null){if(l=null,r.child!==null)switch(r.child.tag){case 5:l=r.child.stateNode;break;case 1:l=r.child.stateNode}cd(r,q,l)}break;case 5:var Q=r.stateNode;if(l===null&&r.flags&4){l=Q;var ne=r.memoizedProps;switch(r.type){case"button":case"input":case"select":case"textarea":ne.autoFocus&&l.focus();break;case"img":ne.src&&(l.src=ne.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(r.memoizedState===null){var he=r.alternate;if(he!==null){var Ee=he.memoizedState;if(Ee!==null){var Te=Ee.dehydrated;Te!==null&&_r(Te)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(s(163))}dn||r.flags&512&&Ac(r)}catch(xe){Ft(r,r.return,xe)}}if(r===n){$e=null;break}if(l=r.sibling,l!==null){l.return=r.return,$e=l;break}$e=r.return}}function uf(n){for(;$e!==null;){var r=$e;if(r===n){$e=null;break}var l=r.sibling;if(l!==null){l.return=r.return,$e=l;break}$e=r.return}}function hf(n){for(;$e!==null;){var r=$e;try{switch(r.tag){case 0:case 11:case 15:var l=r.return;try{La(4,r)}catch(ne){Ft(r,l,ne)}break;case 1:var C=r.stateNode;if(typeof C.componentDidMount=="function"){var A=r.return;try{C.componentDidMount()}catch(ne){Ft(r,A,ne)}}var O=r.return;try{Ac(r)}catch(ne){Ft(r,O,ne)}break;case 5:var q=r.return;try{Ac(r)}catch(ne){Ft(r,q,ne)}}}catch(ne){Ft(r,r.return,ne)}if(r===n){$e=null;break}var Q=r.sibling;if(Q!==null){Q.return=r.return,$e=Q;break}$e=r.return}}var I_=Math.ceil,Na=x.ReactCurrentDispatcher,Dc=x.ReactCurrentOwner,Fn=x.ReactCurrentBatchConfig,vt=0,Zt=null,Wt=null,sn=0,Mn=0,ki=Kr(0),Yt=0,uo=null,As=0,Ra=0,Pc=0,ho=null,Sn=null,Oc=0,Ci=1/0,Lr=null,Ma=!1,Bc=null,Zr=null,Aa=!1,es=null,Ia=0,fo=0,Fc=null,ja=-1,Da=0;function vn(){return(vt&6)!==0?Et():ja!==-1?ja:ja=Et()}function ts(n){return(n.mode&1)===0?1:(vt&2)!==0&&sn!==0?sn&-sn:g_.transition!==null?(Da===0&&(Da=gr()),Da):(n=gt,n!==0||(n=window.event,n=n===void 0?16:Oi(n.type)),n)}function Zn(n,r,l,C){if(50<fo)throw fo=0,Fc=null,Error(s(185));zn(n,l,C),((vt&2)===0||n!==Zt)&&(n===Zt&&((vt&2)===0&&(Ra|=l),Yt===4&&ns(n,sn)),xn(n,C),l===1&&vt===0&&(r.mode&1)===0&&(Ci=Et()+500,ca&&Yr()))}function xn(n,r){var l=n.callbackNode;ji(n,r);var C=jr(n,n===Zt?sn:0);if(C===0)l!==null&&ms(l),n.callbackNode=null,n.callbackPriority=0;else if(r=C&-C,n.callbackPriority!==r){if(l!=null&&ms(l),r===1)n.tag===0?m_(ff.bind(null,n)):Qh(ff.bind(null,n)),h_(function(){(vt&6)===0&&Yr()}),l=null;else{switch(qn(C)){case 1:l=mr;break;case 4:l=_e;break;case 16:l=Be;break;case 536870912:l=Ct;break;default:l=Be}l=bf(l,df.bind(null,n))}n.callbackPriority=r,n.callbackNode=l}}function df(n,r){if(ja=-1,Da=0,(vt&6)!==0)throw Error(s(327));var l=n.callbackNode;if(Si()&&n.callbackNode!==l)return null;var C=jr(n,n===Zt?sn:0);if(C===0)return null;if((C&30)!==0||(C&n.expiredLanes)!==0||r)r=Pa(n,C);else{r=C;var A=vt;vt|=2;var O=mf();(Zt!==n||sn!==r)&&(Lr=null,Ci=Et()+500,js(n,r));do try{P_();break}catch(Q){pf(n,Q)}while(!0);rc(),Na.current=O,vt=A,Wt!==null?r=0:(Zt=null,sn=0,r=Yt)}if(r!==0){if(r===2&&(A=bs(n),A!==0&&(C=A,r=Hc(n,A))),r===1)throw l=uo,js(n,0),ns(n,C),xn(n,Et()),l;if(r===6)ns(n,C);else{if(A=n.current.alternate,(C&30)===0&&!j_(A)&&(r=Pa(n,C),r===2&&(O=bs(n),O!==0&&(C=O,r=Hc(n,O))),r===1))throw l=uo,js(n,0),ns(n,C),xn(n,Et()),l;switch(n.finishedWork=A,n.finishedLanes=C,r){case 0:case 1:throw Error(s(345));case 2:Ds(n,Sn,Lr);break;case 3:if(ns(n,C),(C&130023424)===C&&(r=Oc+500-Et(),10<r)){if(jr(n,0)!==0)break;if(A=n.suspendedLanes,(A&C)!==C){vn(),n.pingedLanes|=n.suspendedLanes&A;break}n.timeoutHandle=Vl(Ds.bind(null,n,Sn,Lr),r);break}Ds(n,Sn,Lr);break;case 4:if(ns(n,C),(C&4194240)===C)break;for(r=n.eventTimes,A=-1;0<C;){var q=31-Kt(C);O=1<<q,q=r[q],q>A&&(A=q),C&=~O}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*I_(C/1960))-C,10<C){n.timeoutHandle=Vl(Ds.bind(null,n,Sn,Lr),C);break}Ds(n,Sn,Lr);break;case 5:Ds(n,Sn,Lr);break;default:throw Error(s(329))}}}return xn(n,Et()),n.callbackNode===l?df.bind(null,n):null}function Hc(n,r){var l=ho;return n.current.memoizedState.isDehydrated&&(js(n,r).flags|=256),n=Pa(n,r),n!==2&&(r=Sn,Sn=l,r!==null&&Uc(r)),n}function Uc(n){Sn===null?Sn=n:Sn.push.apply(Sn,n)}function j_(n){for(var r=n;;){if(r.flags&16384){var l=r.updateQueue;if(l!==null&&(l=l.stores,l!==null))for(var C=0;C<l.length;C++){var A=l[C],O=A.getSnapshot;A=A.value;try{if(!Gn(O(),A))return!1}catch{return!1}}}if(l=r.child,r.subtreeFlags&16384&&l!==null)l.return=r,r=l;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 ns(n,r){for(r&=~Pc,r&=~Ra,n.suspendedLanes|=r,n.pingedLanes&=~r,n=n.expirationTimes;0<r;){var l=31-Kt(r),C=1<<l;n[l]=-1,r&=~C}}function ff(n){if((vt&6)!==0)throw Error(s(327));Si();var r=jr(n,0);if((r&1)===0)return xn(n,Et()),null;var l=Pa(n,r);if(n.tag!==0&&l===2){var C=bs(n);C!==0&&(r=C,l=Hc(n,C))}if(l===1)throw l=uo,js(n,0),ns(n,r),xn(n,Et()),l;if(l===6)throw Error(s(345));return n.finishedWork=n.current.alternate,n.finishedLanes=r,Ds(n,Sn,Lr),xn(n,Et()),null}function $c(n,r){var l=vt;vt|=1;try{return n(r)}finally{vt=l,vt===0&&(Ci=Et()+500,ca&&Yr())}}function Is(n){es!==null&&es.tag===0&&(vt&6)===0&&Si();var r=vt;vt|=1;var l=Fn.transition,C=gt;try{if(Fn.transition=null,gt=1,n)return n()}finally{gt=C,Fn.transition=l,vt=r,(vt&6)===0&&Yr()}}function Wc(){Mn=ki.current,Mt(ki)}function js(n,r){n.finishedWork=null,n.finishedLanes=0;var l=n.timeoutHandle;if(l!==-1&&(n.timeoutHandle=-1,u_(l)),Wt!==null)for(l=Wt.return;l!==null;){var C=l;switch(Jl(C),C.tag){case 1:C=C.type.childContextTypes,C!=null&&aa();break;case 3:wi(),Mt(bn),Mt(cn),hc();break;case 5:cc(C);break;case 4:wi();break;case 13:Mt(jt);break;case 19:Mt(jt);break;case 10:sc(C.type._context);break;case 22:case 23:Wc()}l=l.return}if(Zt=n,Wt=n=rs(n.current,null),sn=Mn=r,Yt=0,uo=null,Pc=Ra=As=0,Sn=ho=null,Ns!==null){for(r=0;r<Ns.length;r++)if(l=Ns[r],C=l.interleaved,C!==null){l.interleaved=null;var A=C.next,O=l.pending;if(O!==null){var q=O.next;O.next=A,C.next=q}l.pending=C}Ns=null}return n}function pf(n,r){do{var l=Wt;try{if(rc(),wa.current=Ca,ya){for(var C=Dt.memoizedState;C!==null;){var A=C.queue;A!==null&&(A.pending=null),C=C.next}ya=!1}if(Ms=0,Jt=Gt=Dt=null,so=!1,io=0,Dc.current=null,l===null||l.return===null){Yt=1,uo=r,Wt=null;break}e:{var O=n,q=l.return,Q=l,ne=r;if(r=sn,Q.flags|=32768,ne!==null&&typeof ne=="object"&&typeof ne.then=="function"){var he=ne,Ee=Q,Te=Ee.tag;if((Ee.mode&1)===0&&(Te===0||Te===11||Te===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 Fe=Bd(q);if(Fe!==null){Fe.flags&=-257,Fd(Fe,q,Q,O,r),Fe.mode&1&&Od(O,he,r),r=Fe,ne=he;var ze=r.updateQueue;if(ze===null){var Ve=new Set;Ve.add(ne),r.updateQueue=Ve}else ze.add(ne);break e}else{if((r&1)===0){Od(O,he,r),zc();break e}ne=Error(s(426))}}else if(It&&Q.mode&1){var Ut=Bd(q);if(Ut!==null){(Ut.flags&65536)===0&&(Ut.flags|=256),Fd(Ut,q,Q,O,r),tc(yi(ne,Q));break e}}O=ne=yi(ne,Q),Yt!==4&&(Yt=2),ho===null?ho=[O]:ho.push(O),O=q;do{switch(O.tag){case 3:O.flags|=65536,r&=-r,O.lanes|=r;var ae=Dd(O,ne,r);ld(O,ae);break e;case 1:Q=ne;var re=O.type,le=O.stateNode;if((O.flags&128)===0&&(typeof re.getDerivedStateFromError=="function"||le!==null&&typeof le.componentDidCatch=="function"&&(Zr===null||!Zr.has(le)))){O.flags|=65536,r&=-r,O.lanes|=r;var Ne=Pd(O,Q,r);ld(O,Ne);break e}}O=O.return}while(O!==null)}vf(l)}catch(Ge){r=Ge,Wt===l&&l!==null&&(Wt=l=l.return);continue}break}while(!0)}function mf(){var n=Na.current;return Na.current=Ca,n===null?Ca:n}function zc(){(Yt===0||Yt===3||Yt===2)&&(Yt=4),Zt===null||(As&268435455)===0&&(Ra&268435455)===0||ns(Zt,sn)}function Pa(n,r){var l=vt;vt|=2;var C=mf();(Zt!==n||sn!==r)&&(Lr=null,js(n,r));do try{D_();break}catch(A){pf(n,A)}while(!0);if(rc(),vt=l,Na.current=C,Wt!==null)throw Error(s(261));return Zt=null,sn=0,Yt}function D_(){for(;Wt!==null;)gf(Wt)}function P_(){for(;Wt!==null&&!gs();)gf(Wt)}function gf(n){var r=yf(n.alternate,n,Mn);n.memoizedProps=n.pendingProps,r===null?vf(n):Wt=r,Dc.current=null}function vf(n){var r=n;do{var l=r.alternate;if(n=r.return,(r.flags&32768)===0){if(l=L_(l,r,Mn),l!==null){Wt=l;return}}else{if(l=N_(l,r),l!==null){l.flags&=32767,Wt=l;return}if(n!==null)n.flags|=32768,n.subtreeFlags=0,n.deletions=null;else{Yt=6,Wt=null;return}}if(r=r.sibling,r!==null){Wt=r;return}Wt=r=n}while(r!==null);Yt===0&&(Yt=5)}function Ds(n,r,l){var C=gt,A=Fn.transition;try{Fn.transition=null,gt=1,O_(n,r,l,C)}finally{Fn.transition=A,gt=C}return null}function O_(n,r,l,C){do Si();while(es!==null);if((vt&6)!==0)throw Error(s(327));l=n.finishedWork;var A=n.finishedLanes;if(l===null)return null;if(n.finishedWork=null,n.finishedLanes=0,l===n.current)throw Error(s(177));n.callbackNode=null,n.callbackPriority=0;var O=l.lanes|l.childLanes;if(Io(n,O),n===Zt&&(Wt=Zt=null,sn=0),(l.subtreeFlags&2064)===0&&(l.flags&2064)===0||Aa||(Aa=!0,bf(Be,function(){return Si(),null})),O=(l.flags&15990)!==0,(l.subtreeFlags&15990)!==0||O){O=Fn.transition,Fn.transition=null;var q=gt;gt=1;var Q=vt;vt|=4,Dc.current=null,M_(n,l),af(l,n),r_(zl),Cs=!!Wl,zl=Wl=null,n.current=l,A_(l),Ws(),vt=Q,gt=q,Fn.transition=O}else n.current=l;if(Aa&&(Aa=!1,es=n,Ia=A),O=n.pendingLanes,O===0&&(Zr=null),Wn(l.stateNode),xn(n,Et()),r!==null)for(C=n.onRecoverableError,l=0;l<r.length;l++)A=r[l],C(A.value,{componentStack:A.stack,digest:A.digest});if(Ma)throw Ma=!1,n=Bc,Bc=null,n;return(Ia&1)!==0&&n.tag!==0&&Si(),O=n.pendingLanes,(O&1)!==0?n===Fc?fo++:(fo=0,Fc=n):fo=0,Yr(),null}function Si(){if(es!==null){var n=qn(Ia),r=Fn.transition,l=gt;try{if(Fn.transition=null,gt=16>n?16:n,es===null)var C=!1;else{if(n=es,es=null,Ia=0,(vt&6)!==0)throw Error(s(331));var A=vt;for(vt|=4,$e=n.current;$e!==null;){var O=$e,q=O.child;if(($e.flags&16)!==0){var Q=O.deletions;if(Q!==null){for(var ne=0;ne<Q.length;ne++){var he=Q[ne];for($e=he;$e!==null;){var Ee=$e;switch(Ee.tag){case 0:case 11:case 15:co(8,Ee,O)}var Te=Ee.child;if(Te!==null)Te.return=Ee,$e=Te;else for(;$e!==null;){Ee=$e;var xe=Ee.sibling,Fe=Ee.return;if(tf(Ee),Ee===he){$e=null;break}if(xe!==null){xe.return=Fe,$e=xe;break}$e=Fe}}}var ze=O.alternate;if(ze!==null){var Ve=ze.child;if(Ve!==null){ze.child=null;do{var Ut=Ve.sibling;Ve.sibling=null,Ve=Ut}while(Ve!==null)}}$e=O}}if((O.subtreeFlags&2064)!==0&&q!==null)q.return=O,$e=q;else e:for(;$e!==null;){if(O=$e,(O.flags&2048)!==0)switch(O.tag){case 0:case 11:case 15:co(9,O,O.return)}var ae=O.sibling;if(ae!==null){ae.return=O.return,$e=ae;break e}$e=O.return}}var re=n.current;for($e=re;$e!==null;){q=$e;var le=q.child;if((q.subtreeFlags&2064)!==0&&le!==null)le.return=q,$e=le;else e:for(q=re;$e!==null;){if(Q=$e,(Q.flags&2048)!==0)try{switch(Q.tag){case 0:case 11:case 15:La(9,Q)}}catch(Ge){Ft(Q,Q.return,Ge)}if(Q===q){$e=null;break e}var Ne=Q.sibling;if(Ne!==null){Ne.return=Q.return,$e=Ne;break e}$e=Q.return}}if(vt=A,Yr(),Ot&&typeof Ot.onPostCommitFiberRoot=="function")try{Ot.onPostCommitFiberRoot(pt,n)}catch{}C=!0}return C}finally{gt=l,Fn.transition=r}}return!1}function _f(n,r,l){r=yi(l,r),r=Dd(n,r,1),n=Qr(n,r,1),r=vn(),n!==null&&(zn(n,1,r),xn(n,r))}function Ft(n,r,l){if(n.tag===3)_f(n,n,l);else for(;r!==null;){if(r.tag===3){_f(r,n,l);break}else if(r.tag===1){var C=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof C.componentDidCatch=="function"&&(Zr===null||!Zr.has(C))){n=yi(l,n),n=Pd(r,n,1),r=Qr(r,n,1),n=vn(),r!==null&&(zn(r,1,n),xn(r,n));break}}r=r.return}}function B_(n,r,l){var C=n.pingCache;C!==null&&C.delete(r),r=vn(),n.pingedLanes|=n.suspendedLanes&l,Zt===n&&(sn&l)===l&&(Yt===4||Yt===3&&(sn&130023424)===sn&&500>Et()-Oc?js(n,0):Pc|=l),xn(n,r)}function wf(n,r){r===0&&((n.mode&1)===0?r=1:(r=ws,ws<<=1,(ws&130023424)===0&&(ws=4194304)));var l=vn();n=xr(n,r),n!==null&&(zn(n,r,l),xn(n,l))}function F_(n){var r=n.memoizedState,l=0;r!==null&&(l=r.retryLane),wf(n,l)}function H_(n,r){var l=0;switch(n.tag){case 13:var C=n.stateNode,A=n.memoizedState;A!==null&&(l=A.retryLane);break;case 19:C=n.stateNode;break;default:throw Error(s(314))}C!==null&&C.delete(r),wf(n,l)}var yf;yf=function(n,r,l){if(n!==null)if(n.memoizedProps!==r.pendingProps||bn.current)Cn=!0;else{if((n.lanes&l)===0&&(r.flags&128)===0)return Cn=!1,T_(n,r,l);Cn=(n.flags&131072)!==0}else Cn=!1,It&&(r.flags&1048576)!==0&&Jh(r,ha,r.index);switch(r.lanes=0,r.tag){case 2:var C=r.type;Ea(n,r),n=r.pendingProps;var A=di(r,cn.current);_i(r,l),A=pc(null,r,C,n,A,l);var O=mc();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,kn(C)?(O=!0,la(r)):O=!1,r.memoizedState=A.state!==null&&A.state!==void 0?A.state:null,ac(r),A.updater=Sa,r.stateNode=A,A._reactInternals=r,bc(r,C,n,l),r=xc(null,r,C,!0,O,l)):(r.tag=0,It&&O&&Ql(r),gn(null,r,A,l),r=r.child),r;case 16:C=r.elementType;e:{switch(Ea(n,r),n=r.pendingProps,A=C._init,C=A(C._payload),r.type=C,A=r.tag=$_(C),n=Xn(C,n),A){case 0:r=Sc(null,r,C,n,l);break e;case 1:r=qd(null,r,C,n,l);break e;case 11:r=Hd(null,r,C,n,l);break e;case 14:r=Ud(null,r,C,Xn(C.type,n),l);break e}throw Error(s(306,C,""))}return r;case 0:return C=r.type,A=r.pendingProps,A=r.elementType===C?A:Xn(C,A),Sc(n,r,C,A,l);case 1:return C=r.type,A=r.pendingProps,A=r.elementType===C?A:Xn(C,A),qd(n,r,C,A,l);case 3:e:{if(Vd(r),n===null)throw Error(s(387));C=r.pendingProps,O=r.memoizedState,A=O.element,ad(n,r),va(r,C,null,l);var q=r.memoizedState;if(C=q.element,O.isDehydrated)if(O={element:C,isDehydrated:!1,cache:q.cache,pendingSuspenseBoundaries:q.pendingSuspenseBoundaries,transitions:q.transitions},r.updateQueue.baseState=O,r.memoizedState=O,r.flags&256){A=yi(Error(s(423)),r),r=Kd(n,r,C,l,A);break e}else if(C!==A){A=yi(Error(s(424)),r),r=Kd(n,r,C,l,A);break e}else for(Rn=Vr(r.stateNode.containerInfo.firstChild),Nn=r,It=!0,Yn=null,l=id(r,null,C,l),r.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling;else{if(mi(),C===A){r=Tr(n,r,l);break e}gn(n,r,C,l)}r=r.child}return r;case 5:return ud(r),n===null&&ec(r),C=r.type,A=r.pendingProps,O=n!==null?n.memoizedProps:null,q=A.children,ql(C,A)?q=null:O!==null&&ql(C,O)&&(r.flags|=32),zd(n,r),gn(n,r,q,l),r.child;case 6:return n===null&&ec(r),null;case 13:return Gd(n,r,l);case 4:return lc(r,r.stateNode.containerInfo),C=r.pendingProps,n===null?r.child=gi(r,null,C,l):gn(n,r,C,l),r.child;case 11:return C=r.type,A=r.pendingProps,A=r.elementType===C?A:Xn(C,A),Hd(n,r,C,A,l);case 7:return gn(n,r,r.pendingProps,l),r.child;case 8:return gn(n,r,r.pendingProps.children,l),r.child;case 12:return gn(n,r,r.pendingProps.children,l),r.child;case 10:e:{if(C=r.type._context,A=r.pendingProps,O=r.memoizedProps,q=A.value,Lt(pa,C._currentValue),C._currentValue=q,O!==null)if(Gn(O.value,q)){if(O.children===A.children&&!bn.current){r=Tr(n,r,l);break e}}else for(O=r.child,O!==null&&(O.return=r);O!==null;){var Q=O.dependencies;if(Q!==null){q=O.child;for(var ne=Q.firstContext;ne!==null;){if(ne.context===C){if(O.tag===1){ne=Er(-1,l&-l),ne.tag=2;var he=O.updateQueue;if(he!==null){he=he.shared;var Ee=he.pending;Ee===null?ne.next=ne:(ne.next=Ee.next,Ee.next=ne),he.pending=ne}}O.lanes|=l,ne=O.alternate,ne!==null&&(ne.lanes|=l),ic(O.return,l,r),Q.lanes|=l;break}ne=ne.next}}else if(O.tag===10)q=O.type===r.type?null:O.child;else if(O.tag===18){if(q=O.return,q===null)throw Error(s(341));q.lanes|=l,Q=q.alternate,Q!==null&&(Q.lanes|=l),ic(q,l,r),q=O.sibling}else q=O.child;if(q!==null)q.return=O;else for(q=O;q!==null;){if(q===r){q=null;break}if(O=q.sibling,O!==null){O.return=q.return,q=O;break}q=q.return}O=q}gn(n,r,A.children,l),r=r.child}return r;case 9:return A=r.type,C=r.pendingProps.children,_i(r,l),A=On(A),C=C(A),r.flags|=1,gn(n,r,C,l),r.child;case 14:return C=r.type,A=Xn(C,r.pendingProps),A=Xn(C.type,A),Ud(n,r,C,A,l);case 15:return $d(n,r,r.type,r.pendingProps,l);case 17:return C=r.type,A=r.pendingProps,A=r.elementType===C?A:Xn(C,A),Ea(n,r),r.tag=1,kn(C)?(n=!0,la(r)):n=!1,_i(r,l),Id(r,C,A),bc(r,C,A,l),xc(null,r,C,!0,n,l);case 19:return Xd(n,r,l);case 22:return Wd(n,r,l)}throw Error(s(156,r.tag))};function bf(n,r){return ps(n,r)}function U_(n,r,l,C){this.tag=n,this.key=l,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 Hn(n,r,l,C){return new U_(n,r,l,C)}function qc(n){return n=n.prototype,!(!n||!n.isReactComponent)}function $_(n){if(typeof n=="function")return qc(n)?1:0;if(n!=null){if(n=n.$$typeof,n===F)return 11;if(n===W)return 14}return 2}function rs(n,r){var l=n.alternate;return l===null?(l=Hn(n.tag,r,n.key,n.mode),l.elementType=n.elementType,l.type=n.type,l.stateNode=n.stateNode,l.alternate=n,n.alternate=l):(l.pendingProps=r,l.type=n.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=n.flags&14680064,l.childLanes=n.childLanes,l.lanes=n.lanes,l.child=n.child,l.memoizedProps=n.memoizedProps,l.memoizedState=n.memoizedState,l.updateQueue=n.updateQueue,r=n.dependencies,l.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},l.sibling=n.sibling,l.index=n.index,l.ref=n.ref,l}function Oa(n,r,l,C,A,O){var q=2;if(C=n,typeof n=="function")qc(n)&&(q=1);else if(typeof n=="string")q=5;else e:switch(n){case R:return Ps(l.children,A,O,r);case S:q=8,A|=8;break;case L:return n=Hn(12,l,r,A|2),n.elementType=L,n.lanes=O,n;case D:return n=Hn(13,l,r,A),n.elementType=D,n.lanes=O,n;case H:return n=Hn(19,l,r,A),n.elementType=H,n.lanes=O,n;case Y:return Ba(l,A,O,r);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case I:q=10;break e;case B:q=9;break e;case F:q=11;break e;case W:q=14;break e;case G:q=16,C=null;break e}throw Error(s(130,n==null?n:typeof n,""))}return r=Hn(q,l,r,A),r.elementType=n,r.type=C,r.lanes=O,r}function Ps(n,r,l,C){return n=Hn(7,n,C,r),n.lanes=l,n}function Ba(n,r,l,C){return n=Hn(22,n,C,r),n.elementType=Y,n.lanes=l,n.stateNode={isHidden:!1},n}function Vc(n,r,l){return n=Hn(6,n,null,r),n.lanes=l,n}function Kc(n,r,l){return r=Hn(4,n.children!==null?n.children:[],n.key,r),r.lanes=l,r.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},r}function W_(n,r,l,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=nr(0),this.expirationTimes=nr(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=nr(0),this.identifierPrefix=C,this.onRecoverableError=A,this.mutableSourceEagerHydrationData=null}function Gc(n,r,l,C,A,O,q,Q,ne){return n=new W_(n,r,l,Q,ne),r===1?(r=1,O===!0&&(r|=8)):r=0,O=Hn(3,null,null,r),n.current=O,O.stateNode=n,O.memoizedState={element:C,isDehydrated:l,cache:null,transitions:null,pendingSuspenseBoundaries:null},ac(O),n}function z_(n,r,l){var C=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:T,key:C==null?null:""+C,children:n,containerInfo:r,implementation:l}}function kf(n){if(!n)return Gr;n=n._reactInternals;e:{if(nn(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(kn(r.type)){r=r.stateNode.__reactInternalMemoizedMergedChildContext;break e}}r=r.return}while(r!==null);throw Error(s(171))}if(n.tag===1){var l=n.type;if(kn(l))return Yh(n,l,r)}return r}function Cf(n,r,l,C,A,O,q,Q,ne){return n=Gc(l,C,!0,n,A,O,q,Q,ne),n.context=kf(null),l=n.current,C=vn(),A=ts(l),O=Er(C,A),O.callback=r??null,Qr(l,O,A),n.current.lanes=A,zn(n,A,C),xn(n,C),n}function Fa(n,r,l,C){var A=r.current,O=vn(),q=ts(A);return l=kf(l),r.context===null?r.context=l:r.pendingContext=l,r=Er(O,q),r.payload={element:n},C=C===void 0?null:C,C!==null&&(r.callback=C),n=Qr(A,r,q),n!==null&&(Zn(n,A,q,O),ga(n,A,q)),q}function Ha(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 Sf(n,r){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var l=n.retryLane;n.retryLane=l!==0&&l<r?l:r}}function Yc(n,r){Sf(n,r),(n=n.alternate)&&Sf(n,r)}function q_(){return null}var xf=typeof reportError=="function"?reportError:function(n){console.error(n)};function Xc(n){this._internalRoot=n}Ua.prototype.render=Xc.prototype.render=function(n){var r=this._internalRoot;if(r===null)throw Error(s(409));Fa(n,r,null,null)},Ua.prototype.unmount=Xc.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var r=n.containerInfo;Is(function(){Fa(null,n,null,null)}),r[br]=null}};function Ua(n){this._internalRoot=n}Ua.prototype.unstable_scheduleHydration=function(n){if(n){var r=ks();n={blockedOn:null,target:n,priority:r};for(var l=0;l<wt.length&&r!==0&&r<wt[l].priority;l++);wt.splice(l,0,n),l===0&&Oo(n)}};function Qc(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function $a(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11&&(n.nodeType!==8||n.nodeValue!==" react-mount-point-unstable "))}function Ef(){}function V_(n,r,l,C,A){if(A){if(typeof C=="function"){var O=C;C=function(){var he=Ha(q);O.call(he)}}var q=Cf(r,C,n,0,null,!1,!1,"",Ef);return n._reactRootContainer=q,n[br]=q.current,Xi(n.nodeType===8?n.parentNode:n),Is(),q}for(;A=n.lastChild;)n.removeChild(A);if(typeof C=="function"){var Q=C;C=function(){var he=Ha(ne);Q.call(he)}}var ne=Gc(n,0,!1,null,null,!1,!1,"",Ef);return n._reactRootContainer=ne,n[br]=ne.current,Xi(n.nodeType===8?n.parentNode:n),Is(function(){Fa(r,ne,l,C)}),ne}function Wa(n,r,l,C,A){var O=l._reactRootContainer;if(O){var q=O;if(typeof A=="function"){var Q=A;A=function(){var ne=Ha(q);Q.call(ne)}}Fa(r,q,n,A)}else q=V_(l,r,n,A,C);return Ha(q)}jo=function(n){switch(n.tag){case 3:var r=n.stateNode;if(r.current.memoizedState.isDehydrated){var l=ys(r.pendingLanes);l!==0&&(rr(r,l|1),xn(r,Et()),(vt&6)===0&&(Ci=Et()+500,Yr()))}break;case 13:Is(function(){var C=xr(n,1);if(C!==null){var A=vn();Zn(C,n,1,A)}}),Yc(n,1)}},qs=function(n){if(n.tag===13){var r=xr(n,134217728);if(r!==null){var l=vn();Zn(r,n,134217728,l)}Yc(n,134217728)}},vr=function(n){if(n.tag===13){var r=ts(n),l=xr(n,r);if(l!==null){var C=vn();Zn(l,n,r,C)}Yc(n,r)}},ks=function(){return gt},Do=function(n,r){var l=gt;try{return gt=n,r()}finally{gt=l}},et=function(n,r,l){switch(r){case"input":if(Ae(n,l),r=l.name,l.type==="radio"&&r!=null){for(l=n;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll("input[name="+JSON.stringify(""+r)+'][type="radio"]'),r=0;r<l.length;r++){var C=l[r];if(C!==n&&C.form===n.form){var A=oa(C);if(!A)throw Error(s(90));Se(C),Ae(C,A)}}}break;case"textarea":ge(n,l);break;case"select":r=l.value,r!=null&&pe(n,!!l.multiple,r,!1)}},ye=$c,ct=Is;var K_={usingClientEntryPoint:!1,Events:[Zi,ui,oa,Ke,tt,$c]},po={findFiberByHostInstance:xs,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},G_={bundleType:po.bundleType,version:po.version,rendererPackageName:po.rendererPackageName,rendererConfig:po.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:x.ReactCurrentDispatcher,findHostInstanceByFiber:function(n){return n=tr(n),n===null?null:n.stateNode},findFiberByHostInstance:po.findFiberByHostInstance||q_,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 za=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!za.isDisabled&&za.supportsFiber)try{pt=za.inject(G_),Ot=za}catch{}}return En.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=K_,En.createPortal=function(n,r){var l=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Qc(r))throw Error(s(200));return z_(n,r,null,l)},En.createRoot=function(n,r){if(!Qc(n))throw Error(s(299));var l=!1,C="",A=xf;return r!=null&&(r.unstable_strictMode===!0&&(l=!0),r.identifierPrefix!==void 0&&(C=r.identifierPrefix),r.onRecoverableError!==void 0&&(A=r.onRecoverableError)),r=Gc(n,1,!1,null,null,l,!1,C,A),n[br]=r.current,Xi(n.nodeType===8?n.parentNode:n),new Xc(r)},En.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=tr(r),n=n===null?null:n.stateNode,n},En.flushSync=function(n){return Is(n)},En.hydrate=function(n,r,l){if(!$a(r))throw Error(s(200));return Wa(null,n,r,!0,l)},En.hydrateRoot=function(n,r,l){if(!Qc(n))throw Error(s(405));var C=l!=null&&l.hydratedSources||null,A=!1,O="",q=xf;if(l!=null&&(l.unstable_strictMode===!0&&(A=!0),l.identifierPrefix!==void 0&&(O=l.identifierPrefix),l.onRecoverableError!==void 0&&(q=l.onRecoverableError)),r=Cf(r,null,n,1,l??null,A,!1,O,q),n[br]=r.current,Xi(n),C)for(n=0;n<C.length;n++)l=C[n],A=l._getVersion,A=A(l._source),r.mutableSourceEagerHydrationData==null?r.mutableSourceEagerHydrationData=[l,A]:r.mutableSourceEagerHydrationData.push(l,A);return new Ua(r)},En.render=function(n,r,l){if(!$a(r))throw Error(s(200));return Wa(null,n,r,!1,l)},En.unmountComponentAtNode=function(n){if(!$a(n))throw Error(s(40));return n._reactRootContainer?(Is(function(){Wa(null,null,n,!1,function(){n._reactRootContainer=null,n[br]=null})}),!0):!1},En.unstable_batchedUpdates=$c,En.unstable_renderSubtreeIntoContainer=function(n,r,l,C){if(!$a(l))throw Error(s(200));if(n==null||n._reactInternals===void 0)throw Error(s(38));return Wa(n,r,l,!1,C)},En.version="18.3.1-next-f1338f8080-20240426",En}var jf;function $m(){if(jf)return eu.exports;jf=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(),eu.exports=sw(),eu.exports}var Df;function iw(){if(Df)return qa;Df=1;var t=$m();return qa.createRoot=t.createRoot,qa.hydrateRoot=t.hydrateRoot,qa}var ow=iw(),M=lh();const aw=J_(M);function Re(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)?t:null}function Pe(t){return typeof t=="string"?t:null}function ie(t){return typeof t=="string"&&t.length>0?t:null}function ft(t){return typeof t=="boolean"?t:null}function Me(t){return typeof t=="number"&&Number.isFinite(t)?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 kt(t,e){if(!Array.isArray(t))return null;const s=[];for(const a of t){const d=e(a);if(d===null)return null;s.push(d)}return s}function zt(t,e){if(!Array.isArray(t))return null;const s=[];for(const a of t){const d=e(a);d!==null&&s.push(d)}return s}function Qe(t,e){return typeof t=="string"&&e.includes(t)?t:null}function lw(t){try{return JSON.parse(t)}catch{return}}const cw=["auto","default","acceptEdits","plan"];function Fs(t){return typeof t=="string"&&cw.includes(t)}const uw={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:[],worktreeFailed:[],worktreeFileNotInBranch:[],worktreeFolderExists:["folder"],worktreeGitFailed:["detail"],worktreeInUse:[],worktreeLocalChanges:["count"],worktreeNoConflicts:[],worktreeNoReview:[],worktreeNotRepo:[],worktreeNotesConflict:["count"],worktreeNotesFailed:["detail"],worktreeNothingToCommit:[],worktreeNothingToIntegrate:[],worktreeNothingToReview:[],worktreeProjectUnknown:[],worktreeReviewUnread:[],worktreeUncommitted:["count"],worktreeUnknown:[],worktreeUpToDate:["base"]};function hw(t){return Object.prototype.hasOwnProperty.call(uw,t)}function fr(t,e=0){const s=Re(t);if(s===null)return null;const a=Pe(s.key);if(a===null||a.length===0)return null;const d=s.params;if(d===void 0)return{key:a};const k=Re(d);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 g=e===0?fr(c,e+1):null;if(g===null)return null;y[i]=g}return{key:a,params:y}}function dw(t){if(!Array.isArray(t))return null;const e=[];for(const s of t){const a=fr(s);if(a===null)return null;e.push(a)}return e}const Rr=["claude-code","codex","opencode","antigravity","pi"],fw=["gemini-cli","antigravity-ide"],pl=[...Rr,...fw],pw={"gemini-cli":"Gemini CLI","antigravity-ide":"Antigravity IDE"};function Mi(t){return Rr.includes(t)}const mw=["at-quoted","bare-path-paste","quoted-path-line"],gw=["at"],vw=["usage-with-variants","token-count","usage-with-catalog","status-line"],_w=["child-session-marker"],ww=["active","missing","other-command","disabled","unreadable"],yw=["cli","tools"];function Wm(t,e=null){return!t.statusSource||e==="unknown"}const zm={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 bw(t,e){var d;const s=t.permissionCycle;if(s===null)return null;const a=e?((d=t.readOnlyLaunch)==null?void 0:d.mode)??null:null;return a!==null&&s.modes.includes(a)?a:s.launchMode}function ch(t){return t.filter(e=>e.available).length>1}function kw(t){const e=Re(t);if(e===null)return null;const s=e.modes;if(!Array.isArray(s)||s.length===0)return null;const a=[];for(const y of s){if(!Fs(y))return null;a.push(y)}const d=e.launchMode;if(!Fs(d)||!a.includes(d))return null;const k=ie(e.keyLabel);return k===null?null:{modes:a,launchMode:d,keyLabel:k,approvesPendingOnCycle:e.approvesPendingOnCycle===!0}}function Cw(t){const e=Re(t);if(e===null)return null;const s=Qe(e.guard,yw),a=e.mode;return s===null||a!==null&&!Fs(a)?null:{mode:a===null?null:a,guard:s}}function Pf(t){const e=Re(t);if(e===null)return null;const s=Qe(e.state,ww),a=ie(e.settingsPath),d=ie(e.scriptPath),k=e.fragment,y=k===null?null:ie(k);return s===null||a===null||d===null||k!==null&&y===null?null:{state:s,settingsPath:a,scriptPath:d,fragment:y}}function Sw(t){const e=Re(t);if(e===null)return null;const s=ie(e.value),a=Pe(e.label),d=Pe(e.family),k=ft(e.long),y=e.window,i=y===null?null:Me(y);return s===null||a===null||d===null||k===null||y!==null&&i===null?null:{value:s,label:a,family:d,long:k,window:i}}function xw(t){const e=Re(t);if(e===null)return null;const s=ie(e.value),a=Pe(e.label);return s===null||a===null?null:{value:s,label:a}}function Of(t,e){const s=kt(t,e);return s===null||s.length===0?null:s}function Ew(t){const e=Re(t);return e===null?{...zm}:{sessionIdAtLaunch:e.sessionIdAtLaunch===!0,resume:e.resume===!0,statusSource:e.statusSource===!0,readySignal:e.readySignal===!0,permissionCycle:kw(e.permissionCycle),models:Of(e.models,Sw),efforts:Of(e.efforts,xw),questionCards:e.questionCards===!0,imagesByPath:Qe(e.imagesByPath,mw),fileMentions:Qe(e.fileMentions,gw),rewind:e.rewind===!0,contextWindowSource:Qe(e.contextWindowSource,vw),plans:e.plans===!0,waitingBlocksSubmit:e.waitingBlocksSubmit===!0,forceSend:e.forceSend===!0,editQueue:e.editQueue===!0,readOnlyLaunch:Cw(e.readOnlyLaunch)}}function Bf(t){const e=Re(t);if(e===null)return null;const s=Qe(e.id,Rr),a=Pe(e.label),d=Pe(e.command),k=Pe(e.installUrl);return s===null||a===null||d===null||k===null?null:{id:s,label:a,command:d,available:e.available===!0,version:Pe(e.version),installUrl:k,missingMessage:fr(e.missingMessage),capabilities:Ew(e.capabilities),environmentNotice:Qe(e.environmentNotice,_w),statusLine:Pf(e.statusLine),planLimitsSetup:Pf(e.planLimitsSetup)}}const Tw=["staged","unstaged","untracked","conflict"],qm=["added","modified","deleted","renamed","copied","type-changed","untracked","conflict"],Lw=["ready","not-a-repo","git-missing","error"],ru={state:"not-a-repo",message:null,repoRoot:"",branch:null,head:null,upstream:null,ahead:0,behind:0,changes:[],worktrees:[],truncated:!1,updatedAt:0},Nw=["meta","hunk","context","added","removed"];function Rw(t){const e=Re(t);if(e===null)return null;const s=ie(e.path),a=Qe(e.kind,qm),d=Qe(e.stage,Tw);return s===null||a===null||d===null?null:{path:s,kind:a,stage:d,oldPath:Pe(e.oldPath)}}function Mw(t){const e=Re(t);if(e===null)return null;const s=ie(e.path);return s===null?null:{path:s,branch:Pe(e.branch),isCurrent:e.isCurrent===!0,isMain:e.isMain===!0}}function Aw(t){const e=Re(t);if(e===null)return null;const s=Qe(e.state,Lw),a=Pe(e.repoRoot),d=Me(e.ahead),k=Me(e.behind),y=kt(e.changes,Rw),i=kt(e.worktrees,Mw),c=Me(e.updatedAt);return s===null||a===null||d===null||k===null||y===null||i===null||c===null?null:{state:s,message:fr(e.message),repoRoot:a,branch:Pe(e.branch),head:Pe(e.head),upstream:Pe(e.upstream),ahead:d,behind:k,changes:y,worktrees:i,truncated:e.truncated===!0,updatedAt:c}}function Iw(t){const e=Re(t);if(e===null)return null;const s=Qe(e.kind,Nw),a=Pe(e.text);return s===null||a===null?null:{kind:s,text:a,oldLine:Me(e.oldLine),newLine:Me(e.newLine)}}function Ff(t){const e=Re(t);if(e===null)return null;const s=ie(e.path),a=ft(e.staged),d=kt(e.lines,Iw);return s===null||a===null||d===null?null:{path:s,staged:a,lines:d,truncated:e.truncated===!0,binary:e.binary===!0,message:fr(e.message)}}const jw=100,Dw=/^[A-Za-z0-9._/-]+$/,Pw=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])$/i;function Ow(t){if(t.length===0)return"empty";if(t.length>jw)return"too-long";if(!Dw.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(a=>a.startsWith(".")))return"dots";if(e.some(a=>a.endsWith(".lock")))return"lock";if(t==="HEAD")return"reserved";const s=Vm(t).split(".")[0]??"";return Pw.test(s)?"reserved":null}function Vm(t){return t.split("/").join("-")}const Bw=["clean","conflicts"],Fw=["ready","changes","none"],Hw=["working","pending","done"],Uw=["nothing","behind","no-base-folder","local-changes"],$w=["not-integrated","checked-out"];function Ww(t,e){const s=y=>y==="cli"?0:y==="tools"?1:2,a=e.filter(y=>y.id!==t),d=a.length>0?a:e;let k=null;for(const y of d)(k===null||s(y.guard)<s(k.guard))&&(k=y);return(k==null?void 0:k.id)??null}function zw(t){return typeof t=="string"&&/^[0-9a-f]{40}(?:[0-9a-f]{24})?$/.test(t)?t:null}function qw(t){const e=Re(t);if(e===null)return null;const s=ie(e.mainCwd),a=ft(e.linked);return s===null||a===null?null:{mainCwd:s,branch:ie(e.branch),linked:a}}function Vw(t){const e=Re(t);if(e===null)return null;const s=ie(e.branch),a=ft(e.exists);return s===null||a===null?null:{branch:s,exists:a,reopenable:e.reopenable===!0}}function Hf(t){const e=Re(t);if(e===null)return null;const s=Me(e.files),a=Me(e.bytes),d=qt(e.sample);return s===null||a===null||d===null?null:{files:s,bytes:a,overCap:e.overCap===!0,sample:d}}function Kw(t){const e=Re(t);if(e===null)return null;const s=ie(e.name);return s===null?null:{name:s,checkedOut:e.checkedOut===!0}}function Gw(t){const e=Re(t);if(e===null)return null;const s=ie(e.mainRoot),a=ie(e.parentDir),d=ie(e.separator),k=kt(e.branches,Kw),y=Me(e.mainChanges),i=Hf(e.notes),c=e.include===null?null:Hf(e.include);return s===null||a===null||d===null||k===null||y===null||i===null||e.include!==null&&c===null?null:{mainRoot:s,parentDir:a,separator:d,currentBranch:ie(e.currentBranch),branches:k,mainChanges:y,include:c,notes:i}}function Yw(t){const e=Re(t);if(e===null)return null;const s=ie(e.path);if(s===null)return null;const a=e.integrated;return{id:ie(e.id),path:s,branch:ie(e.branch),base:ie(e.base),isCurrent:e.isCurrent===!0,isMain:e.isMain===!0,changes:Me(e.changes),ahead:Me(e.ahead),integrated:typeof a=="boolean"?a:null,behind:Me(e.behind),merge:Xw(e.merge),overlaps:zt(e.overlaps,Qw)??[],review:Km(e.review)}}function uh(t){const e=qt(t.files),s=Me(t.fileCount);return e===null||s===null?null:{files:e,fileCount:s}}function Xw(t){const e=Re(t);if(e===null)return null;const s=Qe(e.state,Bw),a=uh(e);return s===null||a===null?null:{state:s,...a}}function Qw(t){const e=Re(t);if(e===null)return null;const s=ie(e.branch),a=uh(e);return s===null||a===null?null:{branch:s,...a}}function Km(t){const e=Re(t);if(e===null)return null;const s=Qe(e.agent,Rr),a=Qe(e.state,Hw),d=Me(e.requestedAt);return s===null||a===null||d===null?null:{agent:s,state:a,verdict:a==="done"?Qe(e.verdict,Fw)??"none":null,stale:e.stale===!0,requestedAt:d,terminalId:ie(e.terminalId)}}function Jw(t){const e=Re(t);if(e===null)return null;const s=ie(e.sha),a=Pe(e.subject),d=Me(e.at);return s===null||a===null||d===null?null:{sha:s,subject:a,at:d}}function Zw(t){const e=Re(t);if(e===null)return null;const s=ie(e.path),a=Qe(e.kind,qm);return s===null||a===null?null:{path:s,oldPath:ie(e.oldPath),kind:a}}function e0(t){const e=Re(t);if(e===null)return null;const s=ie(e.id),a=ie(e.branch),d=ie(e.base),k=kt(e.commits,Jw),y=Me(e.commitCount),i=kt(e.files,Zw),c=Me(e.fileCount),g=Me(e.uncommitted);return s===null||a===null||d===null||k===null||y===null||i===null||c===null||g===null?null:{id:s,branch:a,base:d,commits:k,commitCount:y,files:i,fileCount:c,uncommitted:g}}function t0(t){const e=Re(t);if(e===null)return null;const s=ie(e.id),a=ie(e.branch),d=ie(e.base),k=ie(e.prompt),y=Me(e.ahead),i=Me(e.uncommitted),c=ft(e.branchBusy);return s===null||a===null||d===null||k===null||y===null||i===null||c===null?null:{id:s,branch:a,base:d,author:Qe(e.author,Rr),prompt:k,ahead:y,uncommitted:i,branchBusy:c}}function n0(t){const e=Re(t);if(e===null)return null;const s=ie(e.id),a=ie(e.branch),d=ie(e.base),k=Me(e.ahead),y=Me(e.behind),i=uh(e),c=kt(e.tabs,Gm),g=qt(e.localConflicts),v=Me(e.branchUncommitted),h=e.blocker,b=h===null?null:Qe(h,Uw);return s===null||a===null||d===null||k===null||y===null||i===null||c===null||g===null||v===null||h!==null&&b===null?null:{id:s,branch:a,base:d,baseFolder:ie(e.baseFolder),command:ie(e.command),branchCommit:zw(e.branchCommit),ahead:k,behind:y,...i,review:Km(e.review),tabs:c,localConflicts:g,branchUncommitted:v,blocker:b,notes:r0(e.notes)}}function r0(t){const e=Re(t);if(e===null)return null;const s=qt(e.returning),a=qt(e.conflicts);return s===null||a===null?null:{returning:s,merging:qt(e.merging)??[],resolved:qt(e.resolved)??[],conflicts:a}}function s0(t){const e=Re(t);if(e===null)return null;const s=Me(e.commits),a=ie(e.base);if(s===null||a===null)return null;const d=Re(e.notes),k=Me(d==null?void 0:d.returned),y=qt(d==null?void 0:d.stayed);return k===null||y===null?{commits:s,base:a}:{commits:s,base:a,notes:{returned:k,stayed:y}}}function i0(t){const e=Re(t);if(e===null)return null;const s=ie(e.id),a=ie(e.branch),d=ie(e.base);return s===null||a===null||d===null?null:{id:s,branch:a,base:d,ahead:Me(e.ahead)}}function o0(t){const e=Re(t);if(e===null)return null;const s=ie(e.id),a=ie(e.branch),d=ie(e.base),k=ie(e.folder),y=ie(e.command),i=e.blocker,c=i===null?null:Qe(i,$w);return s===null||a===null||d===null||k===null||y===null||i!==null&&c===null?null:{id:s,branch:a,base:d,folder:k,command:y,ahead:Me(e.ahead),blocker:c}}const a0=["agent","shell"];function Gm(t){const e=Re(t);if(e===null)return null;const s=ie(e.terminalId),a=Qe(e.kind,a0),d=Pe(e.label);return s===null||a===null||d===null?null:{terminalId:s,kind:a,label:d}}function l0(t){const e=Re(t);if(e===null)return null;const s=ie(e.id),a=ie(e.branch),d=ie(e.path),k=qt(e.commands),y=qt(e.uncommitted),i=Me(e.uncommittedCount),c=kt(e.tabs,Gm),g=qt(e.returning),v=qt(e.conflicts),h=ft(e.deletesBranch);if(s===null||a===null||d===null||k===null||y===null||i===null||c===null||g===null||v===null||h===null)return null;const b=e.inUse;return{id:s,branch:a,path:d,commands:k,uncommitted:y,uncommittedCount:i,tabs:c,returning:g,merging:(qt(e.merging)??[]).filter(E=>g.includes(E)),resolved:qt(e.resolved)??[],conflicts:v,inUse:typeof b=="boolean"?b:null,deletesBranch:h,branchUnused:h&&e.branchUnused===!0,createdBranch:e.createdBranch!==!1}}function c0(t){const e=Re(t);if(e===null)return null;const s=ft(e.branchDeleted),a=Me(e.returned),d=Me(e.discarded);return s===null||a===null||d===null?null:{branchDeleted:s,returned:a,discarded:d}}const u0=["custom","ai","first-message","none"],h0=["native","vault"],d0=["idle","scanning","ready"],f0=["agent","shell"],p0=["busy","idle","waiting","offline","unknown"],m0=["server-closed"];function g0(t){const e=Re(t);if(e===null)return null;const s=ie(e.sessionId),a=Pe(e.title),d=Qe(e.titleSource,u0),k=Me(e.updatedAt),y=Me(e.sizeBytes);if(s===null||a===null||d===null||k===null||y===null)return null;const i=e.agent===void 0?"claude-code":Qe(e.agent,pl);if(i===null)return null;const c=Pe(e.cwd)??"";return{agent:i,sessionId:s,cwd:c,title:a,titleSource:d,updatedAt:k,sizeBytes:y,archived:e.archived===!0,storage:Qe(e.storage,h0)??"native",partial:e.partial===!0,worktree:Vw(e.worktree)}}function v0(t){const e=Re(t);if(e===null)return null;const s=Pe(e.cwd),a=ft(e.cwdExists),d=zt(e.sessions,g0),k=Me(e.lastActivityAt);if(s===null||a===null||d===null||k===null)return null;const y=ie(e.key);if(y!==null)return{key:y,fallbackName:Pe(e.fallbackName)??"",cwd:s,cwdExists:a,isGitRepo:e.isGitRepo===!0,sessions:d,lastActivityAt:k};const i=ie(e.slug);return i===null?null:{key:i,fallbackName:s.length===0?i:"",cwd:s,cwdExists:a,isGitRepo:!1,sessions:d,lastActivityAt:k}}function _0(t){const e=Re(t);if(e===null)return null;const s=Qe(e.state,d0),a=Me(e.scannedFiles),d=Me(e.totalFiles);return s===null||a===null||d===null?null:{state:s,scannedFiles:a,totalFiles:d}}function Uf(t){const e=Re(t);if(e===null)return null;const s=ie(e.terminalId),a=Qe(e.kind,f0)??"agent";let d=null;if(a==="agent"&&(d=e.agent===void 0?"claude-code":Qe(e.agent,Rr),d===null))return null;const k=Pe(e.cwd),y=Pe(e.sessionId),i=Pe(e.label),c=ft(e.resumed),g=Me(e.createdAt),v=ft(e.alive);if(s===null||k===null||y===null||i===null||c===null||g===null||v===null)return null;const h=e.exitCode;return{terminalId:s,kind:a,agent:d,cwd:k,sessionId:y,label:i,resumed:c,createdAt:g,alive:v,exitCode:typeof h=="number"?h:null,sleeping:e.sleeping===!0,launchedAt:Me(e.launchedAt),worktree:qw(e.worktree),review:a==="agent"&&e.review===!0}}const Ym=["user","assistant"];function Va(t){return t.replace(/[`*_]/g,"").replace(/\s+/g," ").trim().toLowerCase()}function w0(t,e){return Va(t.question)===Va(e.question)&&t.multiSelect===e.multiSelect&&t.options.length===e.options.length&&t.options.every((s,a)=>{var y;const d=Va(s.label),k=Va(((y=e.options[a])==null?void 0:y.label)??"");return d.length>0&&k.length>0&&(d.startsWith(k)||k.startsWith(d))})}const Xm=["content","attachment","pasted"],y0=["compacted","interrupted","error"],b0=["cli-plans","project","scratch"],k0=120,C0=20,S0=20,$f=4e3,su={lastRequestTokens:0,lastOutputTokens:0,lastModel:null,contextWindow:null,contextWindowEstimated:!1,totalInputTokens:0,totalOutputTokens:0,totalCacheReadTokens:0,assistantMessages:0},Wf=["waiting","live","unavailable","no-transcript"];function x0(t){const e=Re(t);if(e===null)return null;const s=Me(e.inputTokens),a=Me(e.outputTokens),d=Me(e.cacheCreationInputTokens),k=Me(e.cacheReadInputTokens);return s===null||a===null||d===null||k===null?null:{inputTokens:s,outputTokens:a,cacheCreationInputTokens:d,cacheReadInputTokens:k}}function E0(t){const e=Re(t);if(e===null)return null;const s=ie(e.label);return s===null?null:{label:s,description:Pe(e.description)??""}}function T0(t){const e=Re(t);if(e===null)return null;const s=ie(e.question),a=kt(e.options,E0);return s===null||a===null||a.length===0?null:{question:s,header:Pe(e.header)??"",multiSelect:e.multiSelect===!0,options:a}}function hh(t){const e=Re(t);if(e===null)return null;switch(e.kind){case"text":{const s=Pe(e.text),a=ft(e.truncated);return s===null||a===null?null:{kind:"text",text:s,truncated:a}}case"tool-call":{const s=Pe(e.toolUseId),a=Pe(e.name),d=Pe(e.input),k=ft(e.truncated);return s===null||a===null||d===null||k===null?null:{kind:"tool-call",toolUseId:s,name:a,input:d,truncated:k}}case"tool-result":{const s=Pe(e.toolUseId),a=Pe(e.text),d=ft(e.isError),k=ft(e.truncated),y=Me(e.imageCount);return s===null||a===null||d===null||k===null||y===null?null:{kind:"tool-result",toolUseId:s,text:a,isError:d,truncated:k,imageCount:y}}case"thinking":return{kind:"thinking"};case"question":{const s=ie(e.toolUseId),a=kt(e.questions,T0);return s===null||a===null||a.length===0?null:{kind:"question",toolUseId:s,questions:a}}case"image":{const s=Me(e.index),a=Pe(e.mediaType);if(s===null||a===null)return null;const d=Qe(e.source,Xm)??"content";return{kind:"image",index:s,mediaType:a,source:d}}case"notice":{const s=Qe(e.notice,y0);return s===null?null:{kind:"notice",notice:s,detail:Pe(e.detail)??""}}default:return null}}function iu(t){const e=Re(t);if(e===null)return null;const s=ie(e.eventId),a=Qe(e.role,Ym),d=Me(e.at),k=kt(e.parts,hh);return s===null||a===null||d===null||k===null?null:{eventId:s,role:a,at:d,parts:k,model:Pe(e.model),usage:x0(e.usage),effort:Pe(e.effort),durationMs:Me(e.durationMs),queued:e.queued===!0}}function L0(t){const e=Re(t);if(e===null)return null;const s=ie(e.toolUseId),a=Pe(e.description),d=Me(e.startedAt);return s===null||a===null||d===null?null:{toolUseId:s,description:a.slice(0,k0),background:e.background===!0,startedAt:d}}function N0(t){const e=Re(t);if(e===null)return null;const s=ie(e.id),a=Pe(e.text),d=Me(e.images),k=Me(e.at);if(s===null||a===null||d===null||k===null)return null;const y={id:s,text:a.slice(0,$f),truncated:e.truncated===!0||a.length>$f,images:Math.max(0,Math.floor(d)),at:k},i=ie(e.eventId);return i!==null&&(y.eventId=i),e.forced===!0&&(y.forced=!0),y}function zf(t){const e=Re(t);if(e===null)return null;const s=Me(e.lastRequestTokens),a=Me(e.lastOutputTokens),d=Me(e.totalInputTokens),k=Me(e.totalOutputTokens),y=Me(e.totalCacheReadTokens),i=Me(e.assistantMessages);if(s===null||a===null||d===null||k===null||y===null||i===null)return null;const c=Pe(e.lastEffort);return{lastRequestTokens:s,lastOutputTokens:a,lastModel:Pe(e.lastModel),contextWindow:Me(e.contextWindow),contextWindowEstimated:e.contextWindowEstimated===!0,totalInputTokens:d,totalOutputTokens:k,totalCacheReadTokens:y,assistantMessages:i,...c!==null?{lastEffort:c}:{},...e.compacted===!0?{compacted:!0}:{}}}function R0(t){const e=Re(t);if(e===null)return null;const s=ie(e.fileName),a=ie(e.title),d=Me(e.modifiedAt),k=Me(e.sizeBytes);if(s===null||a===null||d===null||k===null)return null;const y=e.origin,i=b0.find(g=>g===y)??"cli-plans",c=Pe(e.path)??"";return{fileName:s,title:a,origin:i,path:c,absolutePath:Pe(e.absolutePath)??"",exists:e.exists===!0,modifiedAt:d,sizeBytes:k}}function M0(t){const e=Re(t);if(e===null)return null;const s=ie(e.fileName),a=Pe(e.text);return s===null||a===null?null:{fileName:s,text:a,truncated:e.truncated===!0}}const Qm=[{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 A0(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 I0(t,e=Qm){const s=j0(t,e);if(s===null||t===null)return null;const a=t.includes("[1m]");return e.find(d=>d.family===s&&d.long===a)??null}function j0(t,e=Qm){var a;return t===null||t.length===0?null:((a=e.filter(d=>d.family.length>0).sort((d,k)=>k.family.length-d.family.length).find(d=>t.includes(d.family)))==null?void 0:a.family)??null}function D0(t){return`/model ${t}`}const dh="/effort";function P0(t,e=dh){return`${e} ${t}`}const O0=["dir","file"],B0=["ignored","always"];function F0(t){return typeof t=="string"&&/^[0-9a-f]{64}$/.test(t)}function Jm(t){const e=Re(t);if(e===null)return null;const s=ie(e.name),a=ie(e.path),d=Qe(e.kind,O0),k=Me(e.sizeBytes),y=Me(e.modifiedAt);if(s===null||a===null||d===null||k===null||y===null)return null;const i=Qe(e.hidden,B0),c={name:s,path:a,kind:d,sizeBytes:k,modifiedAt:y};return i===null?c:{...c,hidden:i}}function H0(t){const e=Re(t);if(e===null)return null;const s=Pe(e.query),a=kt(e.entries,Jm);return s===null||a===null?null:{query:s,entries:a,truncated:e.truncated===!0}}function U0(t){const e=Re(t);if(e===null)return null;const s=Pe(e.path),a=kt(e.entries,Jm),d=Me(e.hiddenCount);return s===null||a===null||d===null?null:{path:s,entries:a,truncated:e.truncated===!0,hiddenCount:d}}function qf(t){const e=Re(t);if(e===null)return null;const s=ie(e.path),a=Pe(e.text),d=Me(e.sizeBytes),k=ft(e.binary);if(s===null||a===null||d===null||k===null)return null;const y={path:s,language:Pe(e.language),text:a,sizeBytes:d,truncated:e.truncated===!0,binary:k},i=e.hash;return e.editable===!0&&F0(i)?{...y,editable:!0,hash:i}:y}function $0(t){const e=Re(t);if(e===null)return null;const s=ie(e.pickerId),a=ie(e.path),d=kt(e.entries,y=>ie(y)),k=kt(e.roots,y=>ie(y));return s===null||a===null||d===null||k===null?null:{pickerId:s,path:a,entries:d,roots:k,canGoUp:e.canGoUp===!0,truncated:e.truncated===!0}}const Zm=1e6,W0=100,z0=999999;function eg(t){return t.pasted.reduce((e,s)=>e+s.text.length,t.text.length)}function rl(t){return t.text.trim().length===0&&t.pasted.every(e=>e.text.trim().length===0)}function tg(t,e){return t.text!==e.text||t.pasted.length!==e.pasted.length?!1:t.pasted.every((s,a)=>{const d=e.pasted[a];return d!==void 0&&d.number===s.number&&d.text===s.text})}function q0(t){const e=Re(t);if(e===null)return null;const s=e.number,a=Pe(e.text);return typeof s!="number"||!Number.isInteger(s)||s<1||s>z0||a===null?null:{number:s,text:a}}function V0(t){const e=Re(t);if(e===null)return null;const s=Pe(e.text),a=kt(e.pasted,q0);return s===null||a===null||a.length>W0||new Set(a.map(d=>d.number)).size!==a.length?null:{text:s,pasted:a}}const sl="MEMORY.md",fh=["AGENTS.md","CLAUDE.md"],ng=["claude-code","codex","antigravity","opencode","pi"],K0=["outside","encoding"],G0=["create","append-block","replace-block","append-lines","copy"];function Y0(t){return{instructionFiles:[...fh],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 X0(t){const e=Re(t);if(e===null)return null;const s=Qe(e.name,fh),a=ft(e.exists),d=ft(e.hasBlock),k=ft(e.blockCurrent),y=ft(e.brokenBlock),i=e.problem,c=i===null?null:Qe(i,K0);return s===null||a===null||d===null||k===null||y===null||i!==null&&c===null?null:{name:s,exists:a,hasBlock:d,blockCurrent:k,brokenBlock:y,problem:c}}function Q0(t){const e=Re(t);if(e===null)return null;switch(e.kind){case"not-repo":return{kind:"not-repo"};case"error":{const s=fr(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 a=Re(e.worktree);if(a===null)return null;const d=ie(a.mainPath),k=ft(a.mainHasMemory);return d===null||k===null?null:{kind:"repo",ignored:s,worktree:{mainPath:d,mainHasMemory:k}}}default:return null}}function J0(t){const e=Re(t);if(e===null)return null;const s=Qe(e.agent,ng),a=ie(e.label),d=ft(e.reaches),k=fr(e.via);return s===null||a===null||d===null||k===null?null:{agent:s,label:a,reaches:d,via:k}}function Z0(t){const e=Re(t);if(e===null)return null;const s=ie(e.name),a=Pe(e.title),d=Pe(e.description),k=Me(e.sizeBytes),y=Me(e.modifiedAt);return s===null||a===null||d===null||k===null||y===null?null:{name:s,title:a,description:d,sizeBytes:k,modifiedAt:y}}const ey=["line","command","json"];function ty(t){const e=Re(t);if(e===null)return null;const s=Qe(e.agent,ng),a=ie(e.label),d=ie(e.target),k=Qe(e.kind,ey),y=ie(e.text),i=fr(e.note);return s===null||a===null||d===null||k===null||y===null||i===null?null:{agent:s,label:a,target:d,kind:k,text:y,note:i}}function ny(t){const e=Re(t);if(e===null)return null;const s=ie(e.cwd),a=ft(e.folderExists),d=ft(e.indexExists),k=ft(e.installed),y=kt(e.notes,Z0),i=kt(e.files,X0),c=Q0(e.git),g=kt(e.reach,J0),v=Re(e.native),h=v===null?null:Me(v.available),b=v===null?null:Me(v.pending),E=kt(e.globalFragments,ty);return s===null||a===null||d===null||k===null||y===null||i===null||c===null||g===null||h===null||b===null||E===null?null:{cwd:s,folderExists:a,indexExists:d,installed:k,notes:y,files:i,git:c,reach:g,native:{available:h,pending:b},globalFragments:E}}function Vf(t){const e=Re(t);if(e===null)return null;const s=ie(e.file),a=Qe(e.action,G0),d=Pe(e.preview),k=Pe(e.copiedFrom);return s===null||a===null||d===null?null:{file:s,action:a,preview:d,copiedFrom:k}}function ry(t){const e=Re(t);if(e===null)return null;const s=ie(e.name),a=Pe(e.text),d=ft(e.truncated);return s===null||a===null||d===null?null:{name:s,text:a,truncated:d}}const Kf=20;function sy(t,e="Nota"){const s=t.text.split(`
|
|
41
|
-
`).map(a=>a.trim()).find(a=>a.length>0);return s===void 0?t.images.length>0?"Imagen":e:s.length>40?`${s.slice(0,40)}…`:s}function iy(t){const e=Re(t);if(e===null)return null;const s=ie(e.imageId),a=ie(e.mediaType),d=Me(e.bytes);return s===null||a===null||d===null?null:{imageId:s,mediaType:a,bytes:d}}function oy(t){const e=Re(t);if(e===null)return null;const s=ie(e.noteId),a=Pe(e.text),d=kt(e.images,iy),k=Me(e.createdAt),y=Me(e.updatedAt);return s===null||a===null||d===null?null:{noteId:s,text:a,images:d,createdAt:k??0,updatedAt:y??0}}const Os={fiveHours:300,day:1440,week:10080,month:43200},ay=8,ly=/^[A-Za-z0-9][A-Za-z0-9_.:-]{0,63}$/;function cy(t){const e=Re(t);if(e===null)return null;const s=e.id;if(typeof s!="string"||!ly.test(s))return null;const a=Me(e.usedPercent),d=Me(e.observedAt);if(a===null||a<0||d===null||d<=0)return null;const k=e.minutes,y=k===null?null:Me(k);if(k!==null&&(y===null||y<=0))return null;const i=e.resetsAt,c=i===null?null:Me(i);return i!==null&&(c===null||c<=0)?null:{id:s,minutes:y,usedPercent:a,resetsAt:c,observedAt:d}}function uy(t){var e;return((e=zt(t,cy))==null?void 0:e.slice(0,ay))??null}function hy(t){const e=Re(t);if(e===null)return null;const s=Qe(e.agent,Rr),a=uy(e.windows);return s===null||a===null?null:{agent:s,windows:a}}function dy(t,e){return t.filter(s=>s.resetsAt===null||s.resetsAt>e)}const rg=3,fy=3e4,py=["results","time"];function Li(t){return typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}function yo(t,e){if(t==null)return null;const s=e(t);return s===null?void 0:s}function sg(t){const e=Re(t);if(e===null)return null;const s=Qe(e.agent,pl),a=ie(e.sessionId),d=yo(e.cwd,Pe),k=Pe(e.title),y=yo(e.eventId,ie),i=yo(e.role,b=>Qe(b,Ym)),c=yo(e.at,Me),g=Pe(e.snippet),v=Li(e.matchStart),h=Li(e.matchLength);return s===null||a===null||d===void 0||k===null||y===void 0||i===void 0||c===void 0||g===null||v===null||h===null||v+h>g.length?null:{agent:s,sessionId:a,cwd:d,title:k,eventId:y,role:i,at:c,snippet:g,matchStart:v,matchLength:h}}function my(t){const e=Re(t);if(e===null)return null;const s=Pe(e.query),a=zt(e.hits,sg),d=Li(e.sessionsScanned),k=Li(e.sessionsTotal),y=yo(e.truncated,i=>Qe(i,py));return s===null||a===null||d===null||k===null||d>k||y===void 0?null:{query:s,hits:a,sessionsScanned:d,sessionsTotal:k,truncated:y}}function gy(t){const e=Re(t);if(e===null)return null;const s=Pe(e.query),a=zt(e.hits,sg),d=Li(e.sessionsScanned),k=Li(e.sessionsTotal);return s===null||a===null||d===null||k===null||d>k?null:{query:s,hits:a,sessionsScanned:d,sessionsTotal:k}}const vy=["off","idle","measuring","writing","moving"];function pn(t){return typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}function go(t,e){if(t==null)return null;const s=e(t);return s===null?void 0:s}function _y(t){const e=Re(t);if(e===null)return null;const s=Qe(e.agent,pl),a=pn(e.sessions),d=pn(e.eventBytes),k=pn(e.images),y=pn(e.imageBytes),i=pn(e.skippedArchived),c=pn(e.skippedEmpty),g=pn(e.unsupported),v=pn(e.failed),h=dw(e.failureReasons);return s===null||a===null||d===null||k===null||y===null||i===null||c===null||g===null||v===null||h===null?null:{agent:s,sessions:a,eventBytes:d,images:k,imageBytes:y,skippedArchived:i,skippedEmpty:c,unsupported:g,failed:v,failureReasons:h}}function wy(t){const e=Re(t);if(e===null)return null;const s=Me(e.measuredAt),a=Me(e.durationMs),d=zt(e.byAgent,_y),k=pn(e.memoryProjects),y=pn(e.memoryBytes);return s===null||a===null||d===null||k===null||y===null?null:{measuredAt:s,durationMs:a,byAgent:d,memoryProjects:k,memoryBytes:y}}function yy(t){const e=Re(t);if(e===null)return null;const s=pn(e.done),a=pn(e.total);return s===null||a===null?null:{done:s,total:a}}function by(t){const e=Re(t);if(e===null)return null;const s=ft(e.enabled),a=Pe(e.dir),d=ft(e.isDefaultDir),k=Qe(e.state,vy),y=pn(e.sessions),i=pn(e.passSessions),c=pn(e.bytes),g=pn(e.pending),v=go(e.progress,yy),h=go(e.lastPassAt,Me),b=go(e.measurement,wy),E=go(e.previousDir,Pe),N=go(e.lastError,fr);return s===null||a===null||d===null||k===null||y===null||i===null||c===null||g===null||v===void 0||h===void 0||b===void 0||E===void 0||N===void 0?null:{enabled:s,dir:a,isDefaultDir:d,state:k,progress:v,sessions:y,passSessions:i,bytes:c,lastPassAt:h,pending:g,measurement:b,previousDir:E,lastError:N}}const ig=1024,og=65535,ky="pair",Cy=4001;function Sy(t){return typeof t=="number"&&Number.isInteger(t)&&t>=ig&&t<=og}const xy=["off","active","restart-needed","port-busy"];function Ey(t){const e=Re(t);if(e===null)return null;const s=ie(e.id),a=Pe(e.label),d=Me(e.createdAt),k=ft(e.connected);if(s===null||a===null||d===null||k===null)return null;const y=e.lastSeenAt,i=y==null?null:Me(y);return y!=null&&i===null?null:{id:s,label:a,createdAt:d,lastSeenAt:i,connected:k}}function Ty(t){const e=Re(t);if(e===null)return null;const s=ft(e.enabled),a=Me(e.port),d=Qe(e.state,xy),k=Me(e.listeningPort),y=Pe(e.sshUser),i=qt(e.hostNames),c=ft(e.pairingActive),g=kt(e.devices,Ey);return s===null||a===null||d===null||k===null||y===null||i===null||c===null||g===null?null:{enabled:s,port:a,state:d,listeningPort:k,sshUser:y,hostNames:i,pairingActive:c,devices:g}}function Ly(t){const e=Re(t);if(e===null)return null;const s=ie(e.code),a=Me(e.expiresAt);return s===null||a===null?null:{code:s,expiresAt:a}}const Ny=["powershell-admin","powershell","terminal"];function Ry(t){const e=Re(t);if(e===null)return null;const s=ie(e.payload),a=ie(e.authorizeCommand),d=Qe(e.shell,Ny),k=ie(e.code),y=Me(e.expiresAt);return s===null||a===null||d===null||k===null||y===null?null:{payload:s,authorizeCommand:a,shell:d,code:k,expiresAt:y}}const My=["auto","pwsh","powershell","cmd","git-bash","login","bash","sh","zsh"];function ag(t){return Qe(t,My)}function Ay(t){const e=Re(t);if(e===null)return null;const s=ag(e.id),a=ie(e.label);return s===null||s==="auto"||a===null?null:{id:s,label:a}}function Gf(t){return Array.isArray(t)?[...new Set(t.filter(e=>typeof e=="string"&&Mi(e)))]:null}function Iy(t){const e=Re(t);if(e===null)return null;const s=ag(e.consoleShell),a=zt(e.consoleShells,Ay),d=e.shellName,k=d===null?null:ie(d),y=Gf(e.disabledAgents),i=Gf(e.disabledAtStart);return s===null||a===null||y===null||i===null||d!==null&&k===null?null:{consoleShell:s,consoleShells:a,shellName:k,disabledAgents:y,disabledAtStart:i}}const Ei=8,jy="/ws",Bu="token",il=12*1024*1024,ou=8,Yf=10*1024*1024,au=4,Xf=100,Dy=512,Py=["saved","changed"],Oy=["sending","prefilled"],By=["no-delivery","not-ready","send-failed","returned-by-cli","stopped-early","rewound","requested","queue-edit"],Fy=["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 Hy(t){const e={model:null,effort:null,contextWindow:null};if(typeof t!="object"||t===null)return e;const s=t;return{model:ie(s.model),effort:ie(s.effort),contextWindow:Me(s.contextWindow)}}function Uy(t){const e=Re(t);if(e===null)return null;const s=ie(e.terminalId),a=V0(e.draft);return s===null||a===null?null:{terminalId:s,draft:a}}function Qf(t){return typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}function Ka(t,e){const s=ie(e.requestId);return s!==null&&(t.requestId=s),t}function Jf(t){var e;return((e=zt(t,L0))==null?void 0:e.slice(0,C0))??null}function lu(t){var e;return((e=zt(t,N0))==null?void 0:e.slice(0,S0))??null}function Zf(t){const e=hh(t);return e!==null&&e.kind==="question"?e:null}function $y(t){const e=Re(lw(t));if(e===null)return null;switch(e.type){case"hello":{const s=Me(e.protocolVersion),a=Pe(e.platform),d=Pe(e.defaultCwd);return s===null||a===null||d===null?null:{type:"hello",protocolVersion:s,agents:zt(e.agents,Bf)??[],defaultAgent:Qe(e.defaultAgent,Rr),platform:a,defaultCwd:d,shellName:ie(e.shellName),remoteClient:e.remoteClient===!0,fileCheck:e.fileCheck===!0,fileWrite:e.fileWrite===!0}}case"agents":{const s=zt(e.agents,Bf);return s===null?null:{type:"agents",agents:s,defaultAgent:Qe(e.defaultAgent,Rr)}}case"terminal.list":{const s=zt(e.terminals,Uf),a=qt(e.order);return s===null||a===null?null:{type:"terminal.list",terminals:s,order:a}}case"terminal.opened":{const s=ie(e.requestId),a=Uf(e.terminal);return s===null||a===null?null:{type:"terminal.opened",requestId:s,terminal:a}}case"terminal.output":{const s=ie(e.terminalId),a=Pe(e.data);return s===null||a===null?null:{type:"terminal.output",terminalId:s,data:a}}case"terminal.replay":{const s=ie(e.terminalId),a=Pe(e.data);return s===null||a===null?null:{type:"terminal.replay",terminalId:s,data:a,truncated:e.truncated===!0}}case"terminal.exit":{const s=ie(e.terminalId),a=Me(e.exitCode);if(s===null||a===null)return null;const d=e.signal;return{type:"terminal.exit",terminalId:s,exitCode:a,signal:typeof d=="number"?d:null}}case"terminal.closed":{const s=ie(e.terminalId);return s===null?null:{type:"terminal.closed",terminalId:s}}case"terminal.activity":{const s=ie(e.terminalId),a=Qe(e.activity,p0);if(s===null||a===null)return null;const d=a==="offline"?Qe(e.offlineReason,m0):null;return d===null?{type:"terminal.activity",terminalId:s,activity:a}:{type:"terminal.activity",terminalId:s,activity:a,offlineReason:d}}case"index.status":{const s=_0(e.status);return s===null?null:{type:"index.status",status:s}}case"index.projects":{const s=zt(e.projects,v0);return s===null?null:{type:"index.projects",projects:s,replace:e.replace===!0}}case"conversation.reset":{const s=ie(e.terminalId),a=Pe(e.sessionId),d=Qe(e.state,Wf),k=zt(e.events,iu),y=zf(e.usage);return s===null||a===null||d===null||k===null||y===null?null:{type:"conversation.reset",terminalId:s,sessionId:a,state:d,events:k,hasMore:e.hasMore===!0,usage:y,permissionMode:Fs(e.permissionMode)?e.permissionMode:null,defaults:Hy(e.defaults),waitingFor:ie(e.waitingFor),openToolCall:e.openToolCall===!0,subagents:Jf(e.subagents)??[],queue:lu(e.queue)??[],liveQuestion:Zf(e.liveQuestion)}}case"conversation.liveQuestion":{const s=ie(e.terminalId),a=e.question===null?null:Zf(e.question);return s===null||e.question!==null&&a===null?null:{type:"conversation.liveQuestion",terminalId:s,question:a}}case"conversation.subagents":{const s=ie(e.terminalId),a=Jf(e.subagents);return s===null||a===null?null:{type:"conversation.subagents",terminalId:s,subagents:a}}case"conversation.queue":{const s=ie(e.terminalId),a=lu(e.queue);return s===null||a===null?null:{type:"conversation.queue",terminalId:s,queue:a}}case"agent.forceSent":{const s=ie(e.terminalId),a=ie(e.requestId),d=ft(e.sent);return s===null||a===null||d===null?null:{type:"agent.forceSent",terminalId:s,requestId:a,sent:d}}case"agent.queueEdited":{const s=ie(e.terminalId),a=ie(e.requestId),d=ft(e.edited);return s===null||a===null||d===null?null:{type:"agent.queueEdited",terminalId:s,requestId:a,edited:d}}case"agent.submitted":{const s=ie(e.terminalId),a=ie(e.requestId),d=ft(e.delivered);return s===null||a===null||d===null?null:{type:"agent.submitted",terminalId:s,requestId:a,delivered:d}}case"agent.rewound":{const s=ie(e.terminalId),a=ie(e.requestId),d=ft(e.codeRestored);return s===null||a===null||d===null?null:{type:"agent.rewound",terminalId:s,requestId:a,codeRestored:d}}case"conversation.append":{const s=ie(e.terminalId),a=zt(e.events,iu),d=zf(e.usage);if(s===null||a===null||d===null)return null;const k={type:"conversation.append",terminalId:s,events:a,usage:d,permissionMode:Fs(e.permissionMode)?e.permissionMode:null},y=lu(e.queue);return y!==null&&(k.queue=y),k}case"conversation.mode":{const s=ie(e.terminalId),a=e.mode;return s===null||!Fs(a)?null:{type:"conversation.mode",terminalId:s,mode:a}}case"conversation.waiting":{const s=ie(e.terminalId);return s===null?null:{type:"conversation.waiting",terminalId:s,waitingFor:ie(e.waitingFor)}}case"conversation.toolCall":{const s=ie(e.terminalId),a=ft(e.open);return s===null||a===null?null:{type:"conversation.toolCall",terminalId:s,open:a}}case"conversation.page":{const s=ie(e.terminalId),a=zt(e.events,iu);return s===null||a===null?null:{type:"conversation.page",terminalId:s,events:a,hasMore:e.hasMore===!0}}case"conversation.turns":{const s=ie(e.terminalId),a=kt(e.turns,d=>{const k=Re(d);if(k===null)return null;const y=ie(k.eventId),i=Me(k.durationMs);return y===null||i===null?null:{eventId:y,durationMs:i}});return s===null||a===null?null:{type:"conversation.turns",terminalId:s,turns:a}}case"conversation.parts":{const s=ie(e.terminalId),a=kt(e.updates,d=>{const k=Re(d);if(k===null)return null;const y=ie(k.eventId),i=kt(k.parts,hh);return y===null||i===null?null:{eventId:y,parts:i}});return s===null||a===null?null:{type:"conversation.parts",terminalId:s,updates:a}}case"conversation.imageData":{const s=ie(e.terminalId),a=ie(e.eventId),d=Me(e.index),k=Pe(e.mediaType);if(s===null||a===null||d===null||k===null)return null;const y=e.data;return{type:"conversation.imageData",terminalId:s,eventId:a,index:d,source:Qe(e.source,Xm)??"content",mediaType:k,data:typeof y=="string"?y:null}}case"conversation.state":{const s=ie(e.terminalId),a=Qe(e.state,Wf);return s===null||a===null?null:{type:"conversation.state",terminalId:s,state:a}}case"git.status":{const s=ie(e.terminalId),a=Aw(e.status);return s===null||a===null?null:{type:"git.status",terminalId:s,status:a}}case"git.diff":{const s=ie(e.terminalId),a=Ff(e.diff);return s===null||a===null?null:{type:"git.diff",terminalId:s,diff:a}}case"files.listing":{const s=ie(e.terminalId),a=U0(e.listing);return s===null||a===null?null:{type:"files.listing",terminalId:s,listing:a}}case"picker.listing":{const s=$0(e.listing);return s===null?null:{type:"picker.listing",listing:s}}case"files.preview":{const s=ie(e.terminalId),a=qf(e.preview);return s===null||a===null?null:{type:"files.preview",terminalId:s,preview:a}}case"files.checked":{const s=ie(e.terminalId),a=ie(e.requestId),d=qt(e.existing);return s===null||a===null||d===null?null:{type:"files.checked",terminalId:s,requestId:a,existing:d}}case"files.saved":{const s=ie(e.terminalId),a=ie(e.requestId),d=ie(e.path),k=Qe(e.outcome,Py),y=e.preview===null?null:qf(e.preview);return s===null||a===null||d===null||k===null||y===null&&(k==="saved"||e.preview!==null)?null:{type:"files.saved",terminalId:s,requestId:a,path:d,outcome:k,preview:y}}case"conversation.plans":{const s=ie(e.terminalId),a=kt(e.plans,R0);return s===null||a===null?null:{type:"conversation.plans",terminalId:s,plans:a}}case"plans.content":{const s=ie(e.terminalId),a=M0(e.plan);return s===null||a===null?null:{type:"plans.content",terminalId:s,plan:a}}case"files.results":{const s=ie(e.terminalId),a=H0(e.result);return s===null||a===null?null:{type:"files.results",terminalId:s,result:a}}case"notes.list":{const s=kt(e.notes,oy);return s===null?null:{type:"notes.list",notes:s}}case"notes.imageData":{const s=ie(e.imageId),a=Pe(e.mediaType);if(s===null||a===null)return null;const d=e.data;return{type:"notes.imageData",imageId:s,mediaType:a,data:typeof d=="string"?d:null}}case"memory.status":{const s=ie(e.terminalId),a=ny(e.status);return s===null||a===null?null:{type:"memory.status",terminalId:s,status:a}}case"memory.planned":{const s=ie(e.terminalId),a=kt(e.changes,Vf);return s===null||a===null?null:Ka({type:"memory.planned",terminalId:s,changes:a},e)}case"memory.installed":{const s=ie(e.terminalId),a=kt(e.applied,Vf);return s===null||a===null?null:Ka({type:"memory.installed",terminalId:s,applied:a},e)}case"memory.imported":{const s=ie(e.terminalId),a=qt(e.copied),d=qt(e.skipped);return s===null||a===null||d===null?null:Ka({type:"memory.imported",terminalId:s,copied:a,skipped:d},e)}case"memory.content":{const s=ie(e.terminalId),a=ry(e.note);return s===null||a===null?null:Ka({type:"memory.content",terminalId:s,note:a},e)}case"vault.status":{const s=by(e.status);return s===null?null:{type:"vault.status",status:s}}case"vault.exported":{const s=ie(e.projectKey),a=Me(e.sessions);return s===null||a===null?null:{type:"vault.exported",projectKey:s,sessions:a}}case"session.continued":{const s=ie(e.requestId),a=ie(e.terminalId),d=Re(e.source),k=Qe(d==null?void 0:d.agent,pl),y=ie(d==null?void 0:d.sessionId),i=Pe(d==null?void 0:d.title),c=Qf(e.includedTurns),g=Qf(e.totalTurns),v=Qe(e.delivery,Oy);return s===null||a===null||k===null||y===null||i===null||c===null||g===null||c>g||v===null?null:{type:"session.continued",requestId:s,terminalId:a,source:{agent:k,sessionId:y,title:i},includedTurns:c,totalTurns:g,totalTurnsIsMinimum:e.totalTurnsIsMinimum===!0,delivery:v}}case"composer.prefill":{const s=ie(e.terminalId),a=ie(e.text),d=Qe(e.reason,By);if(s===null||a===null||d===null)return null;const k={type:"composer.prefill",terminalId:s,text:a,reason:d};if(e.pasted!==void 0){const i=qt(e.pasted);if(i===null)return null;i.length>0&&(k.pasted=i)}const y=ie(e.requestId);return y!==null&&(k.requestId=y),k}case"composer.drafts":{const s=zt(e.drafts,Uy);return s===null?null:{type:"composer.drafts",drafts:s}}case"search.progress":{const s=ie(e.searchId),a=gy(e.progress);return s===null||a===null?null:{type:"search.progress",searchId:s,progress:a}}case"remote.status":{const s=Ty(e.status);return s===null?null:{type:"remote.status",status:s}}case"settings.status":{const s=Iy(e.settings);return s===null?null:{type:"settings.status",settings:s}}case"plan.limits":{const s=zt(e.limits,hy);return s===null?null:{type:"plan.limits",limits:s}}case"remote.pairing.code":{const s=Ly(e.pairing);return s===null?null:{type:"remote.pairing.code",pairing:s}}case"remote.phone.pairing":{const s=Ry(e.pairing);return s===null?null:{type:"remote.phone.pairing",pairing:s}}case"search.results":{const s=ie(e.searchId),a=my(e.result);return s===null||a===null?null:{type:"search.results",searchId:s,result:a}}case"worktree.inspected":{const s=ie(e.requestId),a=Gw(e.inspection);return s===null||a===null?null:{type:"worktree.inspected",requestId:s,inspection:a}}case"worktree.rows":{const s=ie(e.terminalId),a=zt(e.rows,Yw);if(s===null||a===null)return null;const d=zt(e.kept,i0);return d===null?{type:"worktree.rows",terminalId:s,rows:a}:{type:"worktree.rows",terminalId:s,rows:a,kept:d}}case"worktree.removePlan":{const s=ie(e.requestId),a=l0(e.plan);return s===null||a===null?null:{type:"worktree.removePlan",requestId:s,plan:a}}case"worktree.removed":{const s=ie(e.requestId),a=ie(e.worktreeId),d=c0(e.outcome);return s===null||a===null||d===null?null:{type:"worktree.removed",requestId:s,worktreeId:a,outcome:d}}case"worktree.changed":return{type:"worktree.changed"};case"worktree.branchChanges":{const s=ie(e.requestId),a=e0(e.changes);return s===null||a===null?null:{type:"worktree.branchChanges",requestId:s,changes:a}}case"worktree.branchDiff":{const s=ie(e.requestId),a=ie(e.worktreeId),d=Ff(e.diff);return s===null||a===null||d===null?null:{type:"worktree.branchDiff",requestId:s,worktreeId:a,diff:d}}case"worktree.reviewPlan":{const s=ie(e.requestId),a=t0(e.plan);return s===null||a===null?null:{type:"worktree.reviewPlan",requestId:s,plan:a}}case"worktree.integratePlan":{const s=ie(e.requestId),a=n0(e.plan);return s===null||a===null?null:{type:"worktree.integratePlan",requestId:s,plan:a}}case"worktree.integrated":{const s=ie(e.requestId),a=ie(e.worktreeId),d=s0(e.outcome);return s===null||a===null||d===null?null:{type:"worktree.integrated",requestId:s,worktreeId:a,outcome:d}}case"worktree.deleteBranchPlan":{const s=ie(e.requestId),a=o0(e.plan);return s===null||a===null?null:{type:"worktree.deleteBranchPlan",requestId:s,plan:a}}case"worktree.branchDeleted":{const s=ie(e.requestId),a=ie(e.worktreeId),d=ie(e.branch);return s===null||a===null||d===null?null:{type:"worktree.branchDeleted",requestId:s,worktreeId:a,branch:d}}case"error":{const s=fr(e.text);if(s===null)return null;const d={type:"error",code:Qe(e.code,Fy)??"internal",text:s},k=Pe(e.detail);k!==null&&(d.detail=k);const y=ie(e.requestId);return y!==null&&(d.requestId=y),d}default:return null}}function ep(t){return JSON.stringify(t)}const Wy=/^[A-Za-z]:\\$/;function dr(t,e){return t.length===0?"":e==="win32"?zy(t):qy(t)}function zy(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("\\")&&!Wy.test(e);)e=e.slice(0,-1);return e.toLowerCase()}function lg(t,e,s){return t.length===0||s==="win32"&&t!==e&&t.toLowerCase()===e.toLowerCase()?e:t}function qy(t){let e=t.replace(/\/+/g,"/");for(;e.length>1&&e.endsWith("/");)e=e.slice(0,-1);return e}function Fu(t){var e;return((e=t.worktree)==null?void 0:e.mainCwd)??t.cwd}function Vy(t,e,s,a){if(s.kind!=="agent")return t.length;const d=dr(Fu(s),a);let k=-1;for(const[y,i]of t.entries()){const c=e(i);c===void 0||c.kind!=="agent"||dr(Fu(c),a)===d&&(k=y)}return k===-1?t.length:k+1}function ph(t){return`[Pasted text #${t}]`}function Ky(t){return`[Start of pasted text #${t}]`}function Gy(t){return`[End of pasted text #${t}]`}function Yy(){return/(^|\n)\[Start of pasted text #(\d{1,6})\]\n([\s\S]*?)\n\[End of pasted text #\2\](?=\n|$)/g}function Xy(){return/(^|\n)\[Start of pasted text #(\d{1,6})\]\n/}function Qy(){return/\[Pasted text #(\d{1,6})\]/g}const cg="https://buymeacoffee.com/cvelasquez",Jy="modulepreload",Zy=function(t){return"/"+t},tp={},ur=function(e,s,a){let d=Promise.resolve();if(s&&s.length>0){let y=function(g){return Promise.all(g.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"));d=y(s.map(g=>{if(g=Zy(g),g in tp)return;tp[g]=!0;const v=g.endsWith(".css"),h=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${h}`))return;const b=document.createElement("link");if(b.rel=v?"stylesheet":Jy,v||(b.as="script"),b.crossOrigin="",b.href=g,c&&b.setAttribute("nonce",c),document.head.appendChild(b),v)return new Promise((E,N)=>{b.addEventListener("load",E),b.addEventListener("error",()=>N(new Error(`Unable to preload CSS for ${g}`)))})}))}function k(y){const i=new Event("vite:preloadError",{cancelable:!0});if(i.payload=y,window.dispatchEvent(i),!i.defaultPrevented)throw y}return d.then(y=>{for(const i of y||[])i.status==="rejected"&&k(i.reason);return e().catch(k)})},eb={"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.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.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.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.done":"The separate branch was removed.","worktree.remove.doneBranch":"The branch was deleted too.","worktree.remove.doneDiscarded_one":"{{count}} note was lost, as you chose.","worktree.remove.doneDiscarded_other":"{{count}} notes were lost, as you chose.","worktree.remove.inUse":"Another program has the folder open (an editor, a development server). Close it 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.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"},mh=["en","es","de","fr","pt-BR","ru","ja","ko","zh-CN"],ug="en",cu={en:"English",es:"Español",de:"Deutsch",fr:"Français","pt-BR":"Português (Brasil)",ru:"Русский",ja:"日本語",ko:"한국어","zh-CN":"简体中文"},tb={en:"EN",es:"ES",de:"DE",fr:"FR","pt-BR":"PT",ru:"RU",ja:"JA",ko:"KO","zh-CN":"ZH"},gh={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"},nb={es:()=>ur(()=>import("./es-1bnGoSgS.js"),[]),de:()=>ur(()=>import("./de-CsDV7Kuv.js"),[]),fr:()=>ur(()=>import("./fr-BqyJYy32.js"),[]),"pt-BR":()=>ur(()=>import("./pt-BR-Dctf7Mfd.js"),[]),ru:()=>ur(()=>import("./ru-B7OPQhs_.js"),[]),ja:()=>ur(()=>import("./ja-xHkS6kKf.js"),[]),ko:()=>ur(()=>import("./ko-CC_KhzvE.js"),[]),"zh-CN":()=>ur(()=>import("./zh-CN-Llsx2Xa1.js"),[])},hg=eb,Hu=new Map([["en",hg]]),np=new Map,Uu=new Set;let Co=ug,$u=gh[ug],rp=0;function dg(t){return mh.includes(t)}function Wu(){return Co}function Ai(){return $u}function rb(t){return gh[t]}function fg(t){return Uu.add(t),()=>Uu.delete(t)}async function pg(t,e=gh[t]){const s=++rp;if(!Hu.has(t)&&t!=="en"){const a=await nb[t]();Hu.set(t,a.default)}if(s===rp&&!(Co===t&&$u===e)){Co=t,$u=e;for(const a of Uu)a()}}function sb(t,e){let s=np.get(t);return s===void 0&&(s=new Intl.PluralRules(t),np.set(t,s)),s.select(e)}function sp(t,e,s,a){if(a!==void 0){const d=t[`${s}_${sb(e,a)}`]??t[`${s}_other`];if(d!==void 0)return d}return t[s]}function ib(t,e,s,a){const d=a==null?void 0:a.count,k=typeof d=="number"?d:void 0;return(t===void 0?void 0:sp(t,e,s,k))??sp(hg,"en",s,k)??s}function Za(t,e){return e===void 0?t:t.replace(/\{\{\s*([A-Za-z0-9_]+)\s*\}\}/g,(s,a)=>{const d=e[a];return d===void 0?s:String(d)})}function mg(t,e){return ib(Hu.get(Co),Co,t,e)}function w(t,e){return Za(mg(t,e),e)}function ob(){return[{keys:"Esc",description:w("agent.shortcuts.codex.interruptTurn")},{keys:"Esc Esc",description:w("agent.shortcuts.codex.editPrevious")},{keys:"Ctrl + C",description:w("agent.shortcuts.codex.interruptOrExit")},{keys:"Alt + , / Alt + .",description:w("agent.shortcuts.codex.effort")},{keys:"Shift + Tab",description:w("agent.shortcuts.codex.cycleMode")},{keys:"Tab",description:w("agent.shortcuts.codex.queue")},{keys:"Ctrl + T",description:w("agent.shortcuts.codex.transcript")},{keys:"Ctrl + R",description:w("agent.shortcuts.codex.searchHistory")},{keys:"@",description:w("agent.shortcuts.codex.mention")},{keys:"/",description:w("agent.shortcuts.commands")},{keys:"Ctrl + G",description:w("agent.shortcuts.codex.externalEditor")}]}function ab(){return[{keys:"Esc Esc",description:w("agent.shortcuts.opencode.interrupt")},{keys:"Tab / Shift + Tab",description:w("agent.shortcuts.opencode.cycleAgent")},{keys:"Ctrl + P",description:w("agent.shortcuts.opencode.commandList")},{keys:w("agent.shortcuts.leaderThen",{key:"M"}),description:w("agent.shortcuts.opencode.model")},{keys:w("agent.shortcuts.leaderThen",{key:"N"}),description:w("agent.shortcuts.opencode.newSession")},{keys:"Ctrl + J",description:w("agent.shortcuts.opencode.newline")},{keys:"Ctrl + C",description:w("agent.shortcuts.opencode.clearInput")},{keys:"Ctrl + V",description:w("agent.shortcuts.opencode.paste")}]}function lb(){return[{keys:"Esc",description:w("agent.shortcuts.antigravity.interrupt")},{keys:"Shift + Tab",description:w("agent.shortcuts.antigravity.cycleMode")},{keys:"1 … 4",description:w("agent.shortcuts.antigravity.answerPermission")},{keys:"/",description:w("agent.shortcuts.commands")},{keys:"?",description:w("agent.shortcuts.antigravity.help")}]}function cb(){return[{keys:"Esc",description:w("agent.shortcuts.interruptCli")},{keys:"Esc Esc",description:w("agent.shortcuts.pi.tree")},{keys:"Ctrl + C",description:w("agent.shortcuts.pi.clearOrExit")},{keys:"Shift + Tab",description:w("agent.shortcuts.pi.cycleThinking")},{keys:"Ctrl + L",description:w("agent.shortcuts.pi.model")},{keys:"Ctrl + P",description:w("agent.shortcuts.pi.nextModel")},{keys:"Ctrl + O",description:w("agent.shortcuts.pi.toolOutput")},{keys:"Ctrl + J",description:w("agent.shortcuts.pi.newline")},{keys:"!",description:w("agent.shortcuts.pi.bash")},{keys:"/",description:w("agent.shortcuts.commands")}]}function ub(){return[{keys:"Esc",description:w("agent.shortcuts.interruptCli")},{keys:"Esc Esc",description:w("agent.shortcuts.claudeCode.rewind")},{keys:"Ctrl + C",description:w("agent.shortcuts.claudeCode.cancel")},{keys:"Ctrl + R",description:w("agent.shortcuts.claudeCode.searchHistory")},{keys:"Ctrl + O",description:w("agent.shortcuts.claudeCode.fullOutput")},{keys:"Shift + Tab",description:w("agent.shortcuts.claudeCode.cycleMode")},{keys:"Alt + V",description:w("agent.shortcuts.claudeCode.pasteImage")},{keys:"Ctrl + V",description:w("agent.shortcuts.claudeCode.pasteText")}]}const us={"claude-code":{shortLabel:"CC",get shortcuts(){return ub()},shortcutsNote:null,instructionsFile:"CLAUDE.md",savesModelChoice:!1,compactCommand:"/compact"},codex:{shortLabel:"CX",get shortcuts(){return ob()},get shortcutsNote(){return w("agent.shortcuts.codex.note")},instructionsFile:"AGENTS.md",savesModelChoice:!1,compactCommand:"/compact"},opencode:{shortLabel:"OC",get shortcuts(){return ab()},get shortcutsNote(){return w("agent.shortcuts.opencode.note")},instructionsFile:"AGENTS.md",savesModelChoice:!1,compactCommand:"/compact"},antigravity:{shortLabel:"AG",get shortcuts(){return lb()},shortcutsNote:null,instructionsFile:"AGENTS.md",savesModelChoice:!0,compactCommand:"/compact"},pi:{shortLabel:"PI",get shortcuts(){return cb()},shortcutsNote:null,instructionsFile:"AGENTS.md",savesModelChoice:!1,effortCommand:"/thinking",compactCommand:"/compact"}};function hb(t){return(t===null?void 0:us[t].effortCommand)??dh}function db(t){return t===null?null:us[t].compactCommand}const fb={"gemini-cli":"GC","antigravity-ide":"AI"};function pb(t){return Mi(t)?us[t].shortLabel:fb[t]}function Ro(t,e){var s;return Mi(t)?((s=e.find(a=>a.id===t))==null?void 0:s.label)??t:pw[t]}const gg="Sesion sin titulo";function hr(t,e){return e==="none"||t===gg?w("session.untitled"):t}function mb(t,e){const s=new Map;for(const d of e)d.titleSource==="none"||d.title===gg||s.set(`${d.agent}\0${d.sessionId}`,d.title);const a=new Map;for(const d of t){if(d.agent===null||d.sessionId.length===0)continue;const k=s.get(`${d.agent}\0${d.sessionId}`);k!==void 0&&a.set(d.terminalId,k)}return a}function el(t){return t.storage==="native"&&Mi(t.agent)}function gb(t){return t!==null&&us[t].savesModelChoice}function vb(t,e,s){if(e!=null)return e;for(let a=t.length-1;a>=0;a-=1){const d=t[a];if(!(d===void 0||d.effort===null))return s===null||d.at>=s?d.effort:null}return null}function _b(t){return t===null?null:us[t].instructionsFile}function wb(t,e=!1){const s=t.permissionCycle,a=bw(t,e);return{modeCycle:s===null||a===null||a===s.launchMode?s:{...s,launchMode:a},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 yb(t,e){const s=I0(e,t);return s===null?null:t.find(a=>a.value===s.value)??null}function bb(t,e){return t??e.launchMode}const kb={auto:"mode.auto.label",default:"mode.default.label",acceptEdits:"mode.acceptEdits.label",plan:"mode.plan.label"},Cb={auto:"mode.auto.hint",default:"mode.default.hint",acceptEdits:"mode.acceptEdits.hint",plan:"mode.plan.hint"};function vg(t){return w(kb[t])}function Sb(t){return w(Cb[t])}function xb(t,e){return w("agent.mode.title",{mode:vg(t),hint:Sb(t),key:e.keyLabel})}function _g(t,e){return t.approvesPendingOnCycle&&e!==null}function Eb(t,e,s,a){if(_g(e,a))return w("agent.mode.blocked");const d=xb(t,e);return!e.approvesPendingOnCycle||s?d:w("agent.mode.titleBlind",{title:d})}const Tb={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 Lb(t){return w(Tb[t])}function Nb(){return w("agent.statusLine.noFragment")}function Rb(t,e,s=new Set){return t.filter(a=>(e||a.id!=="plans")&&(a.id==="cli"||!s.has(a.id)))}function Mb(t,e,s=new Set){return t==="plans"&&!e||t!=="cli"&&s.has(t)?"cli":t}function Ab(t,e,s){const a=d=>d===null?void 0:e.find(k=>k.id===d);return a(t)??a(s)??e[0]??null}function Ib(t){return[{keys:"Enter",description:w("agent.shortcuts.composer.send")},{keys:"Shift + Enter",description:w("agent.shortcuts.composer.newline")},{keys:"Ctrl + V",description:w(t?"agent.shortcuts.composer.pasteWithImages":"agent.shortcuts.composer.pasteText")},{keys:"Esc",description:w("agent.shortcuts.interruptCli")}]}function jb(){return w("agent.composer.imagesRefused")}function Db(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 Pb(t,e){return e.compacted===!0?!1:t==="status-line"?e.lastRequestTokens>0:e.assistantMessages>0}function Ob(t,e){return t===null&&e!==null&&e.state!=="active"}function Bb(t){return w(t==="other-command"?"agent.meter.setup.otherCommand":t==="disabled"?"agent.meter.setup.disabled":t==="unreadable"?"agent.meter.setup.unreadable":"agent.meter.setup.missing")}function Fb(t,e){return e.contextWindowEstimated?w("agent.meter.origin.estimated"):t==="usage-with-catalog"&&e.contextWindow!==null?w("agent.meter.origin.catalog"):null}function Hb(t,e=null,s=!1){return s?w("agent.meter.idle.compacted"):e==="status-line"?w("agent.meter.idle.statusLine"):t===null?w("agent.meter.idle.noFile"):w("agent.meter.idle.withFile",{file:t})}function Ub(t,e=null){return t==="idle"?w("agent.dot.idle"):t==="unknown"?e===null?w("agent.dot.noStatus"):e.state==="active"?w("agent.dot.statusLinePending"):w("agent.dot.statusLineOnly"):w("agent.dot.open")}function ip(t,e){return t.length===0?!0:t.some(s=>s.id===e&&s.available&&s.capabilities.resume)}function $b(t,e,s){return t?s?w("agent.note.empty"):w("agent.note.send",{cwd:e??""}):w(e===null?"agent.note.needsTab":"agent.note.noReadySignal")}function wg(t,e,s){const a=dr(e,s);let d=null;for(const k of t)k.kind!=="agent"||k.agent===null||dr(k.cwd,s)===a&&(d=k.agent);return d}function yg(t,e){var a;const s=e.filter(d=>d.available);for(const d of t)if(d!==null&&s.some(k=>k.id===d))return d;return((a=s[0])==null?void 0:a.id)??null}function Wb(t){let e=null;for(const s of t){const a=s.agent;Mi(a)&&(e===null||s.updatedAt>e.updatedAt)&&(e={agent:a,updatedAt:s.updatedAt})}return(e==null?void 0:e.agent)??null}function zb(t,e,s,a,d){return yg([wg(t,e,s),d],a)}function op(t,e,s,a,d){return yg([wg(t,e.cwd,s),Wb(e.sessions),d],a)}function zu(t){return t.filter(e=>e.available)}function qb(t,e){const s=t.findIndex(a=>a.id===e);return s===-1?0:s}function Vb(t,e,s){return s<=0?0:((t+e)%s+s)%s}function Kb(t,e,s,a=4){const d=t.bottom+2,k=t.top-2-e.height,y=d+e.height+a<=s.height||k<a?Math.max(a,Math.min(d,s.height-e.height-a)):k;return{left:Math.max(a,Math.min(t.left,s.width-e.width-a)),top:y}}function Gb(t,e,s){const a=t;return a===null||typeof a!="object"||typeof a.contains!="function"?!0:s!==null&&s.contains(t)?!1:a.contains(e)}function bg(t,e,s=!1,a=!1){return e===null||s?[]:a?zu(t):ch(t)?zu(t).filter(d=>d.id!==e):[]}function vh(t=!1){return w(t?"agent.continue.titleMain":"agent.continue.title")}function Yb(t,e,s){return e?w("agent.continue.discovering"):t.length===0?w("agent.continue.noConversation"):s?null:w("agent.continue.noMessages")}function Xb(t,e,s,a){const d=e>=s&&!a?s===1?w("agent.handoff.turns.single"):w("agent.handoff.turns.all",{count:s}):e===1?a?w("agent.handoff.turns.lastOneOfMore",{total:s}):w("agent.handoff.turns.lastOne",{total:s}):a?w("agent.handoff.turns.lastManyOfMore",{count:s,included:e}):w("agent.handoff.turns.lastMany",{count:s,included:e});return w("agent.handoff.notice",{label:t,turns:d})}const ap=40;function lp(t){const e=t.replace(/\s+/g," ").trim(),s=[...e],a=s.length>ap?`${s.slice(0,ap).join("").trimEnd()}…`:e;return a.length>0?w("agent.handoff.tabLabel",{title:a}):w("agent.handoff.tabLabelNoTitle")}function Qb(){return w("agent.handoff.sending")}function Jb(t){return t===null?w("agent.queueReturned.noLabel"):w("agent.queueReturned.withLabel",{label:t})}function Zb(){return w("agent.stoppedEarly")}function ek(t){switch(t){case"no-delivery":return w("agent.handoff.prefill.noDelivery");case"not-ready":return w("agent.handoff.prefill.notReady");case"send-failed":return w("agent.handoff.prefill.sendFailed")}}function kg(t,e){return t.trim().length===0?e:`${e}
|
|
42
|
-
|
|
43
|
-
${t}`}function tk(t,e){return t&&e!==null}function nk(t,e,s){if(!Mi(t))return{badge:!0,unavailableTitle:null};const a=e.find(y=>y.id===t),d=e.some(y=>y.available),k=a!==void 0&&!a.available&&d;return{badge:s||k,unavailableTitle:k?w("agent.session.cliMissing",{label:a.label}):null}}function rk(t,e,s){return t!==null&&e===""&&!s.sessionIdAtLaunch}function sk(){return w("agent.thread.noTranscript")}function ik(){return w("agent.thread.discovering")}function ok(t,e,s,a,d=null){return!a||!Wm(t,d)||!e?null:s===null?w("agent.openTool.noLabel"):w("agent.openTool.withLabel",{label:s})}function Cg(t,e=!1){return w(t==="permission prompt"?"agent.waiting.permission":t==="question"&&e?"agent.waiting.question":"agent.waiting.answer")}function ak(t){return t.relaunching?"relaunching":t.offlineReason==="server-closed"&&t.alive?"offer":null}function lk(t){return t===null?w("agent.serverClosed.noLabel"):w("agent.serverClosed.withLabel",{label:t})}function ck(){return w("agent.serverClosed.relaunch")}function uk(){return w("agent.serverClosed.relaunching")}function hk(t,e){const s=new Map,a=[];for(const[d,k]of t){const y=e.find(i=>i.terminalId===d);y===void 0||y.alive&&k==="exited"?a.push(d):s.set(d,y.alive?k:"exited")}return{phases:s,finished:a}}function dk(t,e,s){var a;return!s||e===null||((a=t.permissionCycle)==null?void 0:a.approvesPendingOnCycle)!==!0&&!t.waitingBlocksSubmit?null:Cg(e,t.questionCards)}const cp=2e4;function fk(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 pk(t,e,s){const a=t.map(k=>({terminalId:k.terminalId,kind:k.kind,cwd:k.cwd,worktree:k.worktree??null})),d=[];for(const k of e){const y=Vy(a.map(i=>i.terminalId),i=>a.find(c=>c.terminalId===i),{kind:"agent",cwd:k.cwd},s);d.push({pending:k,index:y,label:fk(k)}),a.splice(y,0,{terminalId:`pending:${k.requestId}`,kind:"agent",cwd:k.cwd})}return d}function up(t,e,s){const a=dr(e,s);return t.some(d=>dr(d.cwd,s)===a)}function Sg(){return w("agent.openBlocked")}const mk={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 gk(t){const e=mk[t.value];return e===void 0?t.label:w(e)}function vk(t){return t.value==="default"?w("controls.model.default"):A0(t)}function _k({models:t,efforts:e,model:s,effort:a,modelProvisional:d=!1,effortProvisional:k=!1,savesChoice:y=!1,effortCommandName:i=dh,disabled:c,onCommand:g}){const v=t===null?null:yb(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&&g(D0(b.target.value))},title:s===null?w("controls.model.noData"):d?w("controls.model.provisional",{model:s}):y?w("controls.model.inUseSaved",{model:s}):w("controls.model.inUse",{model:s}),children:[v===null&&o.jsx("option",{value:"",children:h?s??"":w("controls.model.placeholder")}),t.map(b=>o.jsx("option",{value:b.value,children:vk(b)},b.value))]}),e!==null&&o.jsxs("select",{className:"agent-select",value:a??"",disabled:c,onChange:b=>{b.target.value.length>0&&g(P0(b.target.value,i))},title:a===null?w("controls.effort.noData"):k?w("controls.effort.provisional",{effort:a}):y?w("controls.effort.inUseSaved",{effort:a,command:i}):w("controls.effort.inUse",{effort:a,command:i}),children:[a===null&&o.jsx("option",{value:"",children:w("controls.effort.placeholder")}),e.map(b=>o.jsx("option",{value:b.value,children:gk(b)},b.value))]})]})}function wk({mode:t,cycle:e,disabled:s,waitingFor:a=null,statusKnown:d=!0,onChange:k}){const y=bb(t,e);return o.jsx("select",{className:"agent-select agent-select-mode",value:y,disabled:s||_g(e,a),onChange:i=>{Fs(i.target.value)&&k(i.target.value)},title:Eb(y,e,d,a),children:e.modes.map(i=>o.jsx("option",{value:i,children:vg(i)},i))})}function So(t){const e=t.replace(/(\r?\n)+$/,"");return e.length===0?0:e.split(`
|
|
44
|
-
`).length}function yk(t,e){return e===0?w("composer.chip.pastedTextEmpty",{number:t}):w("composer.chip.pastedText",{number:t,count:e})}function xg(t){return t.length===0?1:Math.max(...t)+1}function Eg(t){const e=new Set;for(const s of t.matchAll(Qy()))e.add(Number(s[1]));return[...e].sort((s,a)=>s-a)}const bk=/[^\s([{"'¿¡«]/u,kk=/[\p{L}\p{N}]/u;function Ck(t,e,s,a){const{start:d,end:k,before:y,after:i}=Tg(t,e,s),c=`${y!==""&&bk.test(y)?" ":""}${ph(a)}${i!==""&&kk.test(i)?" ":""}`;return Lg(t,d,k,c)}const Sk=/[^\s([{¿¡«]/u,xk=/[\p{L}\p{N}"'«]/u;function hp(t,e,s,a){const{start:d,end:k,before:y,after:i}=Tg(t,e,s),c=y!==""&&Sk.test(y),g=i===""||xk.test(i),v=`${c?" ":""}${a}${g?" ":""}`;return Lg(t,d,k,v)}function Tg(t,e,s){const a=Math.max(0,Math.min(e,t.length)),d=Math.max(a,Math.min(s,t.length));return{start:a,end:d,before:a>0?t.charAt(a-1):"",after:d<t.length?t.charAt(d):""}}function Lg(t,e,s,a){return{text:`${t.slice(0,e)}${a}${t.slice(s)}`,inserted:a,caret:e+a.length}}function Ng(t,e){const s=new RegExp(`( ?)${Lk(ph(e))}( ?)`,"g");return t.replace(s,(a,d,k)=>d!==""&&k!==""?" ":"")}function Ek(t,e){let s=e;const a=[];for(const d of t){const k=d.text.replace(/\r\n?/g,`
|
|
45
|
-
`).replace(/\n+$/,"");if(k.trim().length===0){s=Ng(s,d.number);continue}a.push(`${Ky(d.number)}
|
|
46
|
-
${k}
|
|
47
|
-
${Gy(d.number)}`)}return s.trim().length>0&&a.push(s),a.join(`
|
|
48
|
-
|
|
49
|
-
`)}function Tk(t,e=!1){const s=t.replace(/\r\n?/g,`
|
|
50
|
-
`),a=[],d=c=>{const g=c.replace(/^\n+|\n+$/g,"");g.trim().length>0&&a.push({kind:"text",text:g})};let k=0;for(const c of s.matchAll(Yy())){const g=c[1]??"",v=(c.index??0)+g.length;d(s.slice(k,v)),a.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?Xy().exec(y):null;if(i!==null){const c=i.index+(i[1]??"").length;d(y.slice(0,c)),a.push({kind:"pasted",number:Number(i[2]),text:y.slice(i.index+i[0].length),complete:!1})}else d(y);return a.some(c=>c.kind==="pasted")?a:[{kind:"text",text:t}]}function Lk(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const Nk=800;function tl(t){return{text:t.text,pasted:t.items.flatMap(e=>e.kind==="text"?[{number:e.number,text:e.text}]:[])}}function Rk(t,e){return{text:t.text,items:t.pasted.map(s=>({id:e(),kind:"text",number:s.number,text:s.text,lines:So(s.text)}))}}function dp(t,e,s){const a=[...t.items.flatMap(i=>i.kind==="text"?[i.number]:[]),...Eg(t.text)],d=[];for(const i of e.pasted){const c=xg([...a,...d.map(g=>g.kind==="text"?g.number:0)]);d.push({id:s(),kind:"text",number:c,text:i,lines:So(i)})}const k=d.map(i=>i.kind==="text"?ph(i.number):"").join(" "),y=k.length===0?e.text:`${e.text}
|
|
51
|
-
|
|
52
|
-
${k}`;return{text:kg(t.text,y),items:[...t.items,...d]}}function Mk(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),a=s(e.selectionStart),d=Math.max(a,s(e.selectionEnd));return{start:a,end:d,direction:e.backward?"backward":"forward",scrollTop:Math.max(0,e.scrollTop)}}function Ak(t){return eg(tl(t))>Zm}function xi(t,e){return t===void 0||rl(t)?rl(e):tg(t,e)}const fp={text:"",pasted:[]};function Ik(t,e,s){const a=Rk(t,s),d=((e==null?void 0:e.items)??[]).filter(k=>k.kind!=="text");return{text:a.text,items:[...a.items,...d]}}class jk{constructor(e){Ht(this,"local",new Map);Ht(this,"views",new Map);Ht(this,"saved",new Map);Ht(this,"heard",new Map);Ht(this,"unconfirmed",new Map);Ht(this,"submitting",new Map);Ht(this,"pending",new Map);Ht(this,"listeners",new Set);Ht(this,"serverKeeps",!1);this.deps=e}get(e){return this.local.get(e)}put(e,s){this.local.set(e,s),this.schedule(e,tl(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 a=[];for(const{terminalId:d,draft:k}of e)this.receive(d,k,s)&&a.push(d);for(const d of a)for(const k of this.listeners)k(d);for(const[d,k]of[...this.pending])k.handle===null&&this.sendNow(d)}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 a 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(a)||(this.cancel(a),this.local.delete(a),this.views.delete(a),this.saved.delete(a),this.heard.delete(a),this.unconfirmed.delete(a),this.submitting.delete(a))}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,a){const d=this.heard.get(e);if(this.heard.set(e,s),this.submitting.has(e)){if(!rl(s))return!1;this.submitting.delete(e)}const k=this.unconfirmed.get(e);if(k!==void 0)if(xi(k,s))this.unconfirmed.delete(e);else if(a)if(xi(d,s)){this.unconfirmed.delete(e),this.setSaved(e,s);const g=this.local.get(e);return g!==void 0&&this.schedule(e,tl(g)),!1}else this.unconfirmed.delete(e);else return!1;const y=this.local.get(e),i=y===void 0?fp:tl(y),c=xi(this.saved.get(e),i);return this.setSaved(e,s),this.pending.has(e)||!c||xi(s,i)?!1:(this.local.set(e,Ik(s,y,this.deps.newId)),this.views.delete(e),!0)}setSaved(e,s){rl(s)?this.saved.delete(e):this.saved.set(e,s)}schedule(e,s){const a=this.pending.get(e);if(a!==void 0&&tg(a.draft,s)||(this.cancel(e),xi(this.saved.get(e),s)))return;const d=this.deps.setTimer(()=>this.sendNow(e),this.deps.delayMs??Nk);this.pending.set(e,{handle:d,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 a=eg(s.draft)>Zm?fp:s.draft;xi(this.saved.get(e),a)||(this.deps.send(e,a),this.unconfirmed.set(e,a),this.setSaved(e,a))}}const qu=1024,Vu=qu*1024,pp=Vu*1024;function Ti(t,e=0){return new Intl.NumberFormat(Ai(),{minimumFractionDigits:e,maximumFractionDigits:e,useGrouping:!1}).format(t)}function _n(t){return!Number.isFinite(t)||t<qu?w("format.bytes.b",{value:Ti(Math.max(0,Math.round(t)||0))}):t<Vu?w("format.bytes.kb",{value:Ti(Math.round(t/qu))}):t<pp?w("format.bytes.mb",{value:Ti(t/Vu,1)}):w("format.bytes.gb",{value:Ti(t/pp,2)})}function Rg(t){const e=Math.floor(t/60),s=t%60;return s===0?w("format.duration.minutes",{value:e}):w("format.duration.minutesSeconds",{minutes:e,seconds:s})}function Dk(t){if(t<1e3)return w("format.duration.ms",{value:t});const e=Math.round(t/1e3);return e<60?w("format.duration.seconds",{value:e}):Rg(e)}function xo(t){if(!Number.isFinite(t)||t<1e3)return w("format.duration.underSecond");const e=Math.round(t/1e3);return e<60?w("format.duration.seconds",{value:e}):Rg(e)}function $n(t,e=Date.now()){if(t<=0)return"";const s=Math.floor((e-t)/6e4);if(s<1)return w("time.justNow");if(s<60)return w("time.minutesAgo",{count:s});const a=Math.floor(s/60);if(a<24)return w("time.hoursAgo",{count:a});const d=Math.floor(a/24);return d<30?w("time.daysAgo",{count:d}):_h(t)}function _h(t){return new Date(t).toLocaleDateString(Ai())}function Ni(t){return new Date(t).toLocaleTimeString(Ai(),{hour:"2-digit",minute:"2-digit"})}function Pk(t){return new Date(t).toLocaleString(Ai(),{weekday:"short",hour:"2-digit",minute:"2-digit"})}function Mg(t){const e=Math.floor(Math.max(0,t)/6e4);if(e<1)return w("format.timeLeft.underMinute");const s=Math.floor(e/1440),a=Math.floor(e%1440/60);return s>0?w("format.timeLeft.daysHours",{days:s,hours:a}):a>0?w("format.timeLeft.hoursMinutes",{hours:a,minutes:e%60}):w("format.timeLeft.minutes",{minutes:e})}function Ok(t){return new Intl.NumberFormat(Ai(),{style:"percent",maximumFractionDigits:0}).format(t/100)}function Tn(t){return new Intl.ListFormat(Ai(),{type:"conjunction"}).format(t)}var Ag=$m();function Ig({src:t,caption:e,onClose:s}){return M.useEffect(()=>{const a=d=>{d.key==="Escape"&&(d.preventDefault(),d.stopPropagation(),s())};return window.addEventListener("keydown",a,!0),()=>window.removeEventListener("keydown",a,!0)},[s]),Ag.createPortal(o.jsxs("div",{className:"viewer",onClick:s,role:"presentation",children:[o.jsx("div",{className:"viewer-frame",onClick:a=>a.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:w("common.closeEsc"),children:"×"})]})]}),document.body)}const Bk=/^([ \t]*)(\d{1,3})([.)])([ \t]+)/,Fk=/^([ \t]*)([a-zA-Z])\)([ \t]+)/,Hk=/^([ \t]*)([-*•])([ \t]+)/;function mp(t){const e=Bk.exec(t);if(e!==null){const[d,k="",y="",i=".",c=" "]=e;return{kind:"number",indent:k,value:Number(y),upper:!1,sep:i,space:c,length:d.length}}const s=Fk.exec(t);if(s!==null){const[d,k="",y="a",i=" "]=s;return{kind:"letter",indent:k,value:y.toLowerCase().charCodeAt(0)-97,upper:y!==y.toLowerCase(),sep:")",space:i,length:d.length}}const a=Hk.exec(t);if(a!==null){const[d,k="",y="-",i=" "]=a;return{kind:"bullet",indent:k,value:0,upper:!1,sep:y,space:i,length:d.length}}return null}function gp(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 Uk(t,e){return t.kind===e.kind&&t.indent===e.indent&&t.sep===e.sep&&t.upper===e.upper}function $k(t,e,s){if(e!==s)return null;const a=t.lastIndexOf(`
|
|
53
|
-
`,e-1)+1,d=t.indexOf(`
|
|
54
|
-
`,e),k=d===-1?t.length:d,y=t.slice(a,k),i=mp(y);if(i===null||e-a<i.length)return null;if(y.slice(i.length).trim().length===0)return{from:a,to:k,text:"",caret:a};const c=gp(i,i.value+1);if(c===null)return null;let g="",v=k;if(i.kind!=="bullet"){let h=i.value+1;for(;v<t.length;){const b=v+1,E=t.indexOf(`
|
|
55
|
-
`,b),N=E===-1?t.length:E,_=t.slice(b,N),u=mp(_);if(u===null||!Uk(i,u)||u.value!==h)break;const p=gp(u,u.value+1);if(p===null)break;g+=`
|
|
56
|
-
${p}${_.slice(u.length)}`,h+=1,v=N}}return{from:e,to:v,text:`
|
|
57
|
-
${c}${t.slice(e,k)}${g}`,caret:e+1+c.length}}const Wk=768,zk=`(max-width: ${Wk}px)`,qk="(hover: none)",vp="agent-workbench.narrow-view",jg="tab",Dg=["chat","cli","git","files","plans","memory","notes","console"];function Vk(t){return typeof t=="string"&&Dg.includes(t)}function Kk(t){return Vk(t)?t:null}function Gk(t){const e=t.hidden??new Set,s=a=>a==="chat"||a==="cli"||!e.has(a);return t.hasTab?Dg.filter(a=>(a!=="plans"||t.plansAvailable)&&s(a)):["chat","notes"].filter(s)}function Yk(t,e){return e.includes(t)?t:"chat"}function _p(t){switch(t){case"cli":case"git":case"files":case"plans":case"memory":return t;default:return null}}const Xk={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 Qk(t){return Xk[t]}const Jk=/^[A-Za-z0-9_-]{1,80}$/;function Zk(t){const e=new URLSearchParams(t).get(jg);return e!==null&&Jk.test(e)?e:null}function eC(t,e){const s=new URLSearchParams(t);for(const d of e)s.delete(d);const a=s.toString();return a.length>0?`?${a}`:""}const tC=[{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 nC(t,e){return t.shiftKey||t.altKey?!1:!e||t.ctrlKey||t.metaKey}const rC="AgentWorkbenchAndroid/",sC="agentworkbench://settings",iC="agentworkbench://disconnect",wp="agentWorkbenchBack";function Pg(t){return t.includes(rC)}function oC(t){return t.dialogOpen?"close-dialog":t.sheetOpen?"close-sheet":t.drawerOpen?"close-drawer":t.view!=="chat"?"show-chat":null}const aC=6e4,lC=10*6e4,cC=15e3,uC=4e3,hC=3,Og={runStartedAt:null,busySeenAt:null};function dC(){return`submit-${typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}`}function fC(t,e){var a;let s=0;if(t!==null){const d=e.findIndex(k=>k.eventId===t);if(d===-1)return!0;s=d+1}for(let d=s;d<e.length;d+=1)if(((a=e[d])==null?void 0:a.role)==="assistant")return!0;return!1}function pC(t,e,s,a){const d=e==="busy"||t==="busy"?a:s.busySeenAt;let k=null;return e==="busy"?t==="idle"?k=a:(t==="busy"||t==="waiting")&&(k=s.runStartedAt):e==="waiting"&&(k=s.runStartedAt),{runStartedAt:k,busySeenAt:d}}function mC(t,e,s,a){const d=new Map;for(const[k,y]of e){const i=t.get(k),c=s.get(k);d.set(k,c!==void 0&&i===y?c:pC(i,y,c??Og,a))}return d}function gC(t,e){const s=new Map;for(const[a,d]of t)d.phase!=="sending"?s.set(a,d):d.queued&&s.set(a,{...d,queued:!1,sentAt:e});return s}function vC(t,e,s){const a=t.get(e.terminalId);if(a===void 0||a.requestId!==e.requestId)return t;const d=new Map(t);return e.delivered?d.set(e.terminalId,{...a,phase:"delivered",queued:!1,deliveredAt:s}):d.delete(e.terminalId),d}function _C(t){if(!t.live||t.waitingFor!==null)return null;const{receipt:e,activity:s,now:a}=t,d=t.clock??Og;if((e==null?void 0:e.phase)==="sending"&&(e.queued||a-e.sentAt<aC))return{kind:"sending"};const k=(e==null?void 0:e.phase)==="delivered"?e.deliveredAt:null;return s==="busy"?{kind:"working",since:d.runStartedAt,justDelivered:k!==null&&a-k<uC}:e===null||k===null||fC(e.afterEventId,t.events)?null:s==="unknown"?a-k<lC?{kind:"awaiting-reply",since:k}:null:s!=="idle"&&s!==null||d.busySeenAt!==null&&d.busySeenAt>=e.sentAt?null:a-k<cC?{kind:"delivered"}:null}function wC(t,e){switch(t.kind){case"sending":return w("thread.status.sending");case"delivered":return w("thread.status.delivered");case"working":{const s=t.since===null?0:e-t.since;if(s<1e3)return t.justDelivered?w("thread.status.workingDelivered"):w("thread.status.working");const a={elapsed:xo(s)};return t.justDelivered?w("thread.status.workingForDelivered",a):w("thread.status.workingFor",a)}case"awaiting-reply":{const s=e-t.since;return s<1e3?w("thread.status.delivered"):w("thread.status.awaitingReply",{elapsed:xo(s)})}}}function yC(t,e){const s=t.slice(0,hC).map(d=>w("thread.status.subagent",{name:d.description.length>0?d.description:w("thread.status.subagentUnnamed"),elapsed:xo(Math.max(0,e-d.startedAt))})),a=t.length-s.length;return a>0&&s.push(w("thread.status.subagentsMore",{count:a})),w("thread.status.subagents",{count:t.length,list:Tn(s)})}const bC=5,kC=1200;function uu(){return crypto.randomUUID()}function CC(t=!0){const[e,s]=M.useState([]),[a,d]=M.useState(null),k=M.useCallback(N=>{if(e.filter(u=>u.kind==="image").length>=ou){d(w("composer.problem.tooManyImages",{count:ou}));return}if(N.size>il){const u=Math.round(N.size/1024/1024),p=il/1024/1024;d(N.name.length>0?w("composer.problem.tooBig",{name:N.name,size:u,max:p}):w("composer.problem.imageTooBig",{size:u,max:p}));return}const _=new FileReader;_.onload=()=>{const u=_.result;if(typeof u!="string")return;const p=u.indexOf(",");p!==-1&&s(m=>m.filter(f=>f.kind==="image").length>=ou?m:[...m,{id:uu(),kind:"image",mediaType:N.type,base64:u.slice(p+1),dataUrl:u,bytes:N.size,name:N.name.length>0?N.name:w("composer.pastedImage")}])},_.onerror=()=>d(w("composer.problem.imageUnreadable")),_.readAsDataURL(N)},[e]),y=M.useCallback(N=>{if(e.filter(u=>u.kind==="file").length>=au){d(w("composer.problem.tooManyFiles",{count:au}));return}if(N.size===0){d(w("composer.problem.empty",{name:N.name}));return}if(N.size>Yf){d(w("composer.problem.tooBig",{name:N.name,size:Math.round(N.size/1024/1024),max:Yf/1024/1024}));return}const _=new FileReader;_.onload=()=>{const u=_.result;if(typeof u!="string")return;const p=u.indexOf(",");p!==-1&&s(m=>m.filter(f=>f.kind==="file").length>=au?m:[...m,{id:uu(),kind:"file",name:N.name.length>0?N.name:"archivo",base64:u.slice(p+1),bytes:N.size}])},_.onerror=()=>d(w("composer.problem.unreadable",{name:N.name})),_.readAsDataURL(N)},[e]),i=M.useCallback(N=>{const _=Array.from(N),u=_.filter(m=>m.type.startsWith("image/")),p=_.filter(m=>!m.type.startsWith("image/"));if(u.length>0&&!t)d(jb());else for(const m of u)k(m);for(const m of p)y(m)},[k,y,t]),c=M.useCallback((N,_=[])=>{if(N.files.length>0)return i(N.files),{consumed:!0,pastedNumber:null};const u=N.getData("text/plain");if(u.length===0)return{consumed:!1,pastedNumber:null};if(u.split(`
|
|
58
|
-
`).length<bC&&u.length<kC)return{consumed:!1,pastedNumber:null};const p=xg([...e.flatMap(m=>m.kind==="text"?[m.number]:[]),..._]);return s(m=>[...m,{id:uu(),kind:"text",number:p,text:u,lines:So(u)}]),{consumed:!0,pastedNumber:p}},[i,e]),g=M.useCallback(N=>{s(_=>_.filter(u=>u.id!==N))},[]),v=M.useCallback((N,_)=>{s(u=>u.map(p=>p.id===N&&p.kind==="text"?{...p,text:_,lines:So(_)}:p))},[]),h=M.useCallback(N=>{s(N),d(null)},[]),b=M.useCallback(()=>h([]),[h]),E=M.useCallback(()=>d(null),[]);return{items:e,problem:a,acceptPaste:c,acceptFiles:i,remove:g,updateText:v,replace:h,clear:b,dismissProblem:E}}function nl({min:t,max:e,value:s,measure:a,onChange:d,onCommit:k,onStart:y}){const i=M.useRef(!1),c=M.useRef(s),g=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 E=Math.min(e,Math.max(t,a(b)));c.current=E,d(E)},[e,t,a,d]),h=M.useCallback(b=>{i.current&&(i.current=!1,b.currentTarget.releasePointerCapture(b.pointerId),k(c.current))},[k]);return{onPointerDown:g,onPointerMove:v,onPointerUp:h,onPointerCancel:h}}function Bg(t){const[e,s]=M.useState(()=>typeof window<"u"&&window.matchMedia(t).matches);return M.useEffect(()=>{const a=window.matchMedia(t),d=()=>s(a.matches);return d(),a.addEventListener("change",d),()=>a.removeEventListener("change",d)},[t]),e}function SC(){return Bg(zk)}function xC(){return Bg(qk)}const Fg="agent_workbench_prefs",Ku="agent-workbench.",Hg=/^[a-z0-9][a-z0-9.-]{0,59}$/,Ug=200,EC=400*24*60*60,TC=3500;function LC(t){const e=new Map;for(const s of t.split(";")){const a=s.indexOf("=");if(a===-1||s.slice(0,a).trim()!==Fg)continue;let d;try{d=JSON.parse(decodeURIComponent(s.slice(a+1).trim()))}catch{return e}if(d===null||typeof d!="object"||Array.isArray(d))return e;for(const[k,y]of Object.entries(d))!Hg.test(k)||typeof y!="string"||y.length>Ug||e.set(`${Ku}${k}`,y);return e}return e}function NC(t){const e={};for(const[a,d]of t){if(!a.startsWith(Ku))continue;const k=a.slice(Ku.length);!Hg.test(k)||d.length>Ug||(e[k]=d)}const s=encodeURIComponent(JSON.stringify(e));return s.length>TC?null:s}function RC(t){return`${Fg}=${t}; Path=/; Max-Age=${EC}; SameSite=Strict`}function $g(){try{return LC(document.cookie)}catch{return new Map}}function Wg(t,e){const s=$g();if(s.get(t)===e)return;s.set(t,e);const a=NC(s);if(a!==null)try{document.cookie=RC(a)}catch{}}function Nt(t,e,s){const a=$g().get(t);if(a!==void 0){const d=s(a);if(d!==null)return d}try{const d=window.localStorage.getItem(t);if(d===null)return e;const k=s(d);return k===null?e:(a===void 0&&Wg(t,d),k)}catch{return e}}function yt(t,e){Wg(t,e);try{window.localStorage.setItem(t,e)}catch{}}function MC(t,e,s){const a=Number.parseInt(t,10);return Number.isFinite(a)&&a>=e&&a<=s?a:null}const yp=90,AC=260,bp=720,kp="agent-workbench.composer-height";function Cp(t){return{selectionStart:t.selectionStart,selectionEnd:t.selectionEnd,backward:t.selectionDirection==="backward",scrollTop:t.scrollTop}}function IC({connection:t,drafts:e,terminalId:s,alive:a,sleeping:d=!1,projectColor:k,activity:y,controls:i,leading:c,imagesAllowed:g=!0,blockedReason:v=null,prefills:h,onPrefillApplied:b,notice:E=null,onDismissNotice:N,onSubmitted:_,fontSize:u,insertRef:p,onEditQueue:m}){const[f,x]=M.useState(""),[j,T]=M.useState(!1),R=CC(g),S=M.useRef(null),L=xC(),[I,B]=M.useState(()=>Nt(kp,AC,se=>MC(se,yp,bp))),[F,D]=M.useState(!1),H=M.useCallback(()=>{const se=S.current;if(se===null)return;se.style.height="auto";const pe=se.offsetHeight-se.clientHeight,Ce=se.scrollHeight+pe,be=F?I:Math.min(Ce,I);se.style.height=`${be}px`,se.style.overflowY=Ce>be?"auto":"hidden"},[I,F]);M.useEffect(H,[f,H,u]);const W=M.useRef(0),G=M.useRef(0),Y=nl({min:yp,max:bp,value:I,measure:M.useCallback(se=>W.current-se.clientY-G.current,[]),onChange:B,onCommit:M.useCallback(se=>{D(!1),yt(kp,String(se))},[]),onStart:M.useCallback(se=>{const pe=S.current,Ce=pe==null?void 0:pe.getBoundingClientRect();W.current=(Ce==null?void 0:Ce.bottom)??se.clientY,G.current=((Ce==null?void 0:Ce.bottom)??se.clientY)-se.clientY-((Ce==null?void 0:Ce.height)??0),D(!0)},[])}),z=M.useRef(null),[P,U]=M.useState(0),$=M.useCallback(()=>U(se=>se+1),[]),K=M.useRef(f);K.current=f;const te=M.useRef(R.items);te.current=R.items;const{replace:oe}=R;M.useEffect(()=>{const se=z.current;se!==null&&e.put(se,{text:f,items:R.items})},[f,R.items,e]),M.useEffect(()=>{var Ce;const se=z.current;if(se===s)return;if(z.current=s,se!==null){e.put(se,{text:K.current,items:te.current});const be=S.current;be!==null&&e.rememberView(se,Cp(be))}const pe=s===null?void 0:e.get(s);x((pe==null?void 0:pe.text)??""),oe((pe==null?void 0:pe.items)??[]),$(),s!==null&&((Ce=S.current)==null||Ce.focus())},[s,oe,e,$]),M.useEffect(()=>()=>{const se=z.current;se!==null&&e.put(se,{text:K.current,items:te.current})},[e]),M.useLayoutEffect(()=>()=>{const se=z.current,pe=S.current;se!==null&&pe!==null&&e.rememberView(se,Cp(pe))},[e]),M.useEffect(()=>{if(P===0)return;const se=z.current,pe=S.current;if(se===null||pe===null)return;const Ce=Mk(pe.value.length,e.viewOf(se));pe.setSelectionRange(Ce.start,Ce.end,Ce.direction),pe.scrollTop=Ce.scrollTop==="end"?pe.scrollHeight:Ce.scrollTop},[P,e]),M.useEffect(()=>e.onRestored(se=>{if(se!==z.current)return;const pe=e.get(se);pe!==void 0&&(x(pe.text),oe(pe.items),$())}),[e,oe,$]);const we=M.useRef(new Set);M.useEffect(()=>{var se;if(!(h===void 0||h.length===0)){for(const pe of h)if(!we.current.has(pe.id)){if(we.current.add(pe.id),pe.terminalId===z.current&&pe.pasted.length===0)x(Ce=>kg(Ce,pe.text)),pe.focus&&((se=S.current)==null||se.focus());else if(pe.terminalId===z.current){const Ce=dp({text:K.current,items:te.current},pe,()=>crypto.randomUUID());x(Ce.text),oe(Ce.items)}else{const Ce=e.get(pe.terminalId);e.put(pe.terminalId,dp({text:(Ce==null?void 0:Ce.text)??"",items:(Ce==null?void 0:Ce.items)??[]},pe,()=>crypto.randomUUID()))}b==null||b(pe.id)}}},[h,b,e,oe]);const me=M.useCallback(()=>{if(s===null||v!==null)return;const se=R.items.filter(ce=>ce.kind==="text").map(ce=>({number:ce.number,text:ce.text})),pe=R.items.filter(ce=>ce.kind==="image").map(ce=>({mediaType:ce.mediaType,data:ce.base64})),Ce=R.items.filter(ce=>ce.kind==="file").map(ce=>({name:ce.name,data:ce.base64})),be=Ek(se,f);if(be.length===0&&pe.length===0&&Ce.length===0)return;const ge=dC(),Le=t.send({type:"agent.submit",terminalId:s,text:be,images:pe,...Ce.length>0?{files:Ce}:{},requestId:ge});e.submitted(s,Le),x(""),R.clear(),_==null||_(s,ge,!Le)},[t,e,s,f,R,v,_]),X=M.useCallback(()=>{s!==null&&t.send({type:"agent.interrupt",terminalId:s})},[t,s]),V=M.useCallback((se,pe)=>{se.setSelectionRange(pe.from,pe.to);let Ce=!1;try{Ce=pe.text.length>0?document.execCommand("insertText",!1,pe.text):document.execCommand("delete")}catch{Ce=!1}Ce||(se.setRangeText(pe.text,pe.from,pe.to,"end"),x(se.value)),se.setSelectionRange(pe.caret,pe.caret)},[]),Z=M.useCallback(se=>{if(se.key==="Enter"&&nC(se,L)){se.preventDefault(),me();return}if(se.key==="Enter"&&!se.nativeEvent.isComposing){const pe=se.currentTarget,Ce=$k(pe.value,pe.selectionStart,pe.selectionEnd);if(Ce!==null){se.preventDefault(),V(pe,Ce);return}}if(se.key==="Escape"){se.preventDefault(),X();return}se.key==="ArrowUp"&&m!==void 0&&!se.shiftKey&&!se.altKey&&!se.ctrlKey&&!se.metaKey&&!se.nativeEvent.isComposing&&se.currentTarget.value.length===0&&R.items.length===0&&(se.preventDefault(),m())},[me,X,L,V,m,R.items.length]),ee=M.useCallback((se,pe)=>{const{inserted:Ce}=Ck(se.value,se.selectionStart,se.selectionEnd,pe);let be=!1;try{be=document.execCommand("insertText",!1,Ce)}catch{be=!1}be||(se.setRangeText(Ce,se.selectionStart,se.selectionEnd,"end"),x(se.value))},[]),ve=M.useCallback((se,pe)=>{const Ce=S.current;if(Ce===null||Ce.disabled){x(Le=>hp(Le,Le.length,Le.length,se).text);return}const{inserted:be}=hp(Ce.value,Ce.selectionStart,Ce.selectionEnd,se);let ge=!1;if(pe){Ce.focus();try{ge=document.execCommand("insertText",!1,be)}catch{ge=!1}}ge||(Ce.setRangeText(be,Ce.selectionStart,Ce.selectionEnd,"end"),x(Ce.value))},[]);M.useEffect(()=>{if(p!==void 0)return p.current=ve,()=>{p.current===ve&&(p.current=null)}},[p,ve]);const Se=M.useCallback(se=>{if(se.clipboardData===null)return;const pe=R.acceptPaste(se.clipboardData,Eg(se.currentTarget.value));pe.consumed&&(se.preventDefault(),pe.pastedNumber!==null&&ee(se.currentTarget,pe.pastedNumber))},[R,ee]),Ie=M.useCallback(se=>{R.remove(se.id),se.kind==="text"&&x(pe=>Ng(pe,se.number))},[R]),je=M.useRef(null),Je=s===null||!a,Ze=f.trim().length>0||R.items.some(se=>se.kind!=="text"||se.text.trim().length>0),Ae=a&&y!=="idle",ue=Ze||!Ae,ht=Ak({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(),T(!0))},onDragLeave:()=>T(!1),onDrop:se=>{se.preventDefault(),T(!1),R.acceptFiles(se.dataTransfer.files)},children:[o.jsx("div",{className:"hdivider composer-divider",...Y,title:w("composer.resizeTitle")}),E!==null&&o.jsxs("div",{className:"handoff-notice",role:"status",children:[o.jsxs("span",{className:"handoff-notice-text",children:[E.text,E.status!==null&&o.jsx("span",{className:"handoff-notice-status",children:E.status})]}),N!==void 0&&o.jsx("button",{className:"icon-button",onClick:N,title:w("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:w("common.close"),children:"×"})]}),ht&&o.jsx("div",{className:"composer-problem",role:"status",children:o.jsx("span",{children:w("composer.problem.draftTooLong")})}),R.items.length>0&&o.jsx("div",{className:"composer-chips",children:R.items.map(se=>o.jsx(jC,{item:se,onRemove:()=>Ie(se),onEdit:pe=>R.updateText(se.id,pe),onDoneEditing:()=>{var pe;return(pe=S.current)==null?void 0:pe.focus()}},se.id))}),o.jsxs("div",{className:`composer-field${Ae&&ue?" composer-field-two":""}`,children:[o.jsx("textarea",{ref:S,className:"composer-input",value:f,rows:1,placeholder:w(Je?d?"composer.placeholder.sleeping":"composer.placeholder.ended":"composer.placeholder.ready"),disabled:Je,onChange:se=>x(se.target.value),onKeyDown:Z,onPaste:Se,spellCheck:!1}),o.jsxs("div",{className:"composer-field-actions",children:[Ae&&o.jsx("button",{className:"composer-icon composer-stop",onClick:X,disabled:Je,title:w("composer.stopTitle"),"aria-label":w("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"})})}),ue&&o.jsx("button",{className:"composer-icon composer-send",onClick:me,disabled:Je||!Ze||v!==null,title:v??w("composer.sendTitle"),"aria-label":w("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:w("composer.attachTitle"),"aria-label":w("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 jC({item:t,onRemove:e,onEdit:s,onDoneEditing:a}){const[d,k]=M.useState(!1);if(t.kind==="image"){const y=`${t.name} · ${_n(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:w("composer.chip.remove"),children:"×"}),d&&o.jsx(Ig,{src:t.dataUrl,caption:y,onClose:()=>k(!1)})]})}return t.kind==="file"?o.jsxs("div",{className:"chip chip-text chip-file",title:`${t.name} · ${_n(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:_n(t.bytes)})]}),o.jsx("button",{className:"chip-remove",onClick:e,title:w("composer.chip.remove"),children:"×"})]}):o.jsxs("div",{className:`chip chip-text${d?" chip-open":""}`,children:[o.jsxs("button",{className:"chip-toggle",onClick:()=>k(y=>!y),title:w("composer.chip.editHint"),"aria-expanded":d,children:[o.jsx("span",{className:"chip-icon",children:"¶"}),yk(t.number,t.lines),o.jsx("span",{className:"chip-chevron",children:d?"▾":"▸"})]}),o.jsx("button",{className:"chip-remove",onClick:e,title:w("composer.chip.remove"),children:"×"}),d&&o.jsx("textarea",{className:"chip-editor",value:t.text,onChange:y=>s(y.target.value),onKeyDown:y=>{y.key==="Escape"&&(y.preventDefault(),k(!1),a())},"aria-label":w("composer.chip.editorLabel",{number:t.number}),spellCheck:!1,autoFocus:!0})]})}var hu={exports:{}},Sp;function DC(){return Sp||(Sp=1,(function(t,e){(function(s,a){t.exports=a()})(self,(()=>(()=>{var s={};return(()=>{var a=s;Object.defineProperty(a,"__esModule",{value:!0}),a.FitAddon=void 0,a.FitAddon=class{activate(d){this._terminal=d}dispose(){}fit(){const d=this.proposeDimensions();if(!d||!this._terminal||isNaN(d.cols)||isNaN(d.rows))return;const k=this._terminal._core;this._terminal.rows===d.rows&&this._terminal.cols===d.cols||(k._renderService.clear(),this._terminal.resize(d.cols,d.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const d=this._terminal._core,k=d._renderService.dimensions;if(k.css.cell.width===0||k.css.cell.height===0)return;const y=this._terminal.options.scrollback===0?0:d.viewport.scrollBarWidth,i=window.getComputedStyle(this._terminal.element.parentElement),c=parseInt(i.getPropertyValue("height")),g=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=g-(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})()))})(hu)),hu.exports}var PC=DC(),du={exports:{}},xp;function OC(){return xp||(xp=1,(function(t,e){(function(s,a){t.exports=a()})(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,E={}){this._terminal=v,this._regex=h,this._handler=b,this._options=E}provideLinks(v,h){const b=g.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,E)=>{if(this._options.hover){const{range:N}=h;this._options.hover(b,E,N)}},h)))}};class g{static computeLink(h,b,E,N){const _=new RegExp(b.source,(b.flags||"")+"g"),[u,p]=g._getWindowedLineStrings(h-1,E),m=u.join("");let f;const x=[];for(;f=_.exec(m);){const j=f[0];if(!c(j))continue;const[T,R]=g._mapStrIdx(E,p,0,f.index),[S,L]=g._mapStrIdx(E,T,R,j.length);if(T===-1||R===-1||S===-1||L===-1)continue;const I={start:{x:R+1,y:T+1},end:{x:L,y:S+1}};x.push({range:I,text:j,activate:N})}return x}static _getWindowedLineStrings(h,b){let E,N=h,_=h,u=0,p="";const m=[];if(E=b.buffer.active.getLine(h)){const f=E.translateToString(!0);if(E.isWrapped&&f[0]!==" "){for(u=0;(E=b.buffer.active.getLine(--N))&&u<2048&&(p=E.translateToString(!0),u+=p.length,m.push(p),E.isWrapped&&p.indexOf(" ")===-1););m.reverse()}for(m.push(f),u=0;(E=b.buffer.active.getLine(++_))&&E.isWrapped&&u<2048&&(p=E.translateToString(!0),u+=p.length,m.push(p),p.indexOf(" ")===-1););}return[m,N]}static _mapStrIdx(h,b,E,N){const _=h.buffer.active,u=_.getNullCell();let p=E;for(;N;){const m=_.getLine(b);if(!m)return[-1,-1];for(let f=p;f<m.length;++f){m.getCell(f,u);const x=u.getChars();if(u.getWidth()&&(N-=x.length||1,f===m.length-1&&x==="")){const j=_.getLine(b+1);j&&j.isWrapped&&(j.getCell(0,u),u.getWidth()===2&&(N+=1))}if(N<0)return[b,f]}b++,p=0}return[b,p]}}i.LinkComputer=g}},a={};function d(y){var i=a[y];if(i!==void 0)return i.exports;var c=a[y]={exports:{}};return s[y](c,c.exports,d),c.exports}var k={};return(()=>{var y=k;Object.defineProperty(y,"__esModule",{value:!0}),y.WebLinksAddon=void 0;const i=d(6),c=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function g(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=g,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})()))})(du)),du.exports}var BC=OC(),fu={exports:{}},Ep;function FC(){return Ep||(Ep=1,(function(t,e){(function(s,a){t.exports=a()})(self,(()=>(()=>{var s={965:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.GlyphRenderer=void 0;const g=c(374),v=c(509),h=c(855),b=c(859),E=c(381),N=11,_=N*Float32Array.BYTES_PER_ELEMENT;let u,p=0,m=0,f=0;class x extends b.Disposable{constructor(T,R,S,L){super(),this._terminal=T,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,g.throwIfFalsy)(I.getParameter(I.MAX_TEXTURE_IMAGE_UNITS))),v.TextureAtlas.maxTextureSize=(0,g.throwIfFalsy)(I.getParameter(I.MAX_TEXTURE_SIZE))),this._program=(0,g.throwIfFalsy)((0,E.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(G){let Y="";for(let z=1;z<G;z++)Y+=` else if (v_texpage == ${z}) { outColor = texture(u_texture[${z}], 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[${G}];
|
|
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,g.throwIfFalsy)(I.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=(0,g.throwIfFalsy)(I.getUniformLocation(this._program,"u_resolution")),this._textureLocation=(0,g.throwIfFalsy)(I.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=I.createVertexArray(),I.bindVertexArray(this._vertexArrayObject);const B=new Float32Array([0,0,1,0,0,1,1,1]),F=I.createBuffer();this.register((0,b.toDisposable)((()=>I.deleteBuffer(F)))),I.bindBuffer(I.ARRAY_BUFFER,F),I.bufferData(I.ARRAY_BUFFER,B,I.STATIC_DRAW),I.enableVertexAttribArray(0),I.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);const D=new Uint8Array([0,1,2,3]),H=I.createBuffer();this.register((0,b.toDisposable)((()=>I.deleteBuffer(H)))),I.bindBuffer(I.ELEMENT_ARRAY_BUFFER,H),I.bufferData(I.ELEMENT_ARRAY_BUFFER,D,I.STATIC_DRAW),this._attributesBuffer=(0,g.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,_,0),I.vertexAttribDivisor(2,1),I.enableVertexAttribArray(3),I.vertexAttribPointer(3,2,I.FLOAT,!1,_,2*Float32Array.BYTES_PER_ELEMENT),I.vertexAttribDivisor(3,1),I.enableVertexAttribArray(4),I.vertexAttribPointer(4,1,I.FLOAT,!1,_,4*Float32Array.BYTES_PER_ELEMENT),I.vertexAttribDivisor(4,1),I.enableVertexAttribArray(5),I.vertexAttribPointer(5,2,I.FLOAT,!1,_,5*Float32Array.BYTES_PER_ELEMENT),I.vertexAttribDivisor(5,1),I.enableVertexAttribArray(6),I.vertexAttribPointer(6,2,I.FLOAT,!1,_,7*Float32Array.BYTES_PER_ELEMENT),I.vertexAttribDivisor(6,1),I.enableVertexAttribArray(1),I.vertexAttribPointer(1,2,I.FLOAT,!1,_,9*Float32Array.BYTES_PER_ELEMENT),I.vertexAttribDivisor(1,1),I.useProgram(this._program);const W=new Int32Array(v.TextureAtlas.maxAtlasPages);for(let G=0;G<v.TextureAtlas.maxAtlasPages;G++)W[G]=G;I.uniform1iv(this._textureLocation,W),I.uniformMatrix4fv(this._projectionLocation,!1,E.PROJECTION_MATRIX),this._atlasTextures=[];for(let G=0;G<v.TextureAtlas.maxAtlasPages;G++){const Y=new E.GLTexture((0,g.throwIfFalsy)(I.createTexture()));this.register((0,b.toDisposable)((()=>I.deleteTexture(Y.texture)))),I.activeTexture(I.TEXTURE0+G),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[G]=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(T,R,S,L,I,B,F,D,H){this._updateCell(this._vertices.attributes,T,R,S,L,I,B,F,D,H)}_updateCell(T,R,S,L,I,B,F,D,H,W){p=(S*this._terminal.cols+R)*N,L!==h.NULL_CELL_CODE&&L!==void 0?this._atlas&&(u=D&&D.length>1?this._atlas.getRasterizedGlyphCombinedChar(D,I,B,F,!1):this._atlas.getRasterizedGlyph(L,I,B,F,!1),m=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),I!==W&&u.offset.x>m?(f=u.offset.x-m,T[p]=-(u.offset.x-f)+this._dimensions.device.char.left,T[p+1]=-u.offset.y+this._dimensions.device.char.top,T[p+2]=(u.size.x-f)/this._dimensions.device.canvas.width,T[p+3]=u.size.y/this._dimensions.device.canvas.height,T[p+4]=u.texturePage,T[p+5]=u.texturePositionClipSpace.x+f/this._atlas.pages[u.texturePage].canvas.width,T[p+6]=u.texturePositionClipSpace.y,T[p+7]=u.sizeClipSpace.x-f/this._atlas.pages[u.texturePage].canvas.width,T[p+8]=u.sizeClipSpace.y):(T[p]=-u.offset.x+this._dimensions.device.char.left,T[p+1]=-u.offset.y+this._dimensions.device.char.top,T[p+2]=u.size.x/this._dimensions.device.canvas.width,T[p+3]=u.size.y/this._dimensions.device.canvas.height,T[p+4]=u.texturePage,T[p+5]=u.texturePositionClipSpace.x,T[p+6]=u.texturePositionClipSpace.y,T[p+7]=u.sizeClipSpace.x,T[p+8]=u.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&(0,g.allowRescaling)(L,H,u.size.x,this._dimensions.device.cell.width)&&(T[p+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width)):T.fill(0,p,p+N-1-2)}clear(){const T=this._terminal,R=T.cols*T.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<T.rows;L++)for(let I=0;I<T.cols;I++)this._vertices.attributes[S+9]=I/T.cols,this._vertices.attributes[S+10]=L/T.rows,S+=N}handleResize(){const T=this._gl;T.useProgram(this._program),T.viewport(0,0,T.canvas.width,T.canvas.height),T.uniform2f(this._resolutionLocation,T.canvas.width,T.canvas.height),this.clear()}render(T){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<T.lineLengths.length;I++){const B=I*this._terminal.cols*N,F=this._vertices.attributes.subarray(B,B+T.lineLengths[I]*N);S.set(F,L),L+=F.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(T){this._atlas=T;for(const R of this._atlasTextures)R.version=-1}_bindAtlasPageTexture(T,R,S){T.activeTexture(T.TEXTURE0+S),T.bindTexture(T.TEXTURE_2D,this._atlasTextures[S].texture),T.texParameteri(T.TEXTURE_2D,T.TEXTURE_WRAP_S,T.CLAMP_TO_EDGE),T.texParameteri(T.TEXTURE_2D,T.TEXTURE_WRAP_T,T.CLAMP_TO_EDGE),T.texImage2D(T.TEXTURE_2D,0,T.RGBA,T.RGBA,T.UNSIGNED_BYTE,R.pages[S].canvas),T.generateMipmap(T.TEXTURE_2D),this._atlasTextures[S].version=R.pages[S].version}setDimensions(T){this._dimensions=T}}i.GlyphRenderer=x},742:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.RectangleRenderer=void 0;const g=c(374),v=c(859),h=c(310),b=c(381),E=8*Float32Array.BYTES_PER_ELEMENT;class N{constructor(){this.attributes=new Float32Array(160),this.count=0}}let _=0,u=0,p=0,m=0,f=0,x=0,j=0;class T extends v.Disposable{constructor(S,L,I,B){super(),this._terminal=S,this._gl=L,this._dimensions=I,this._themeService=B,this._vertices=new N,this._verticesCursor=new N;const F=this._gl;this._program=(0,g.throwIfFalsy)((0,b.createProgram)(F,`#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)((()=>F.deleteProgram(this._program)))),this._projectionLocation=(0,g.throwIfFalsy)(F.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=F.createVertexArray(),F.bindVertexArray(this._vertexArrayObject);const D=new Float32Array([0,0,1,0,0,1,1,1]),H=F.createBuffer();this.register((0,v.toDisposable)((()=>F.deleteBuffer(H)))),F.bindBuffer(F.ARRAY_BUFFER,H),F.bufferData(F.ARRAY_BUFFER,D,F.STATIC_DRAW),F.enableVertexAttribArray(3),F.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);const W=new Uint8Array([0,1,2,3]),G=F.createBuffer();this.register((0,v.toDisposable)((()=>F.deleteBuffer(G)))),F.bindBuffer(F.ELEMENT_ARRAY_BUFFER,G),F.bufferData(F.ELEMENT_ARRAY_BUFFER,W,F.STATIC_DRAW),this._attributesBuffer=(0,g.throwIfFalsy)(F.createBuffer()),this.register((0,v.toDisposable)((()=>F.deleteBuffer(this._attributesBuffer)))),F.bindBuffer(F.ARRAY_BUFFER,this._attributesBuffer),F.enableVertexAttribArray(0),F.vertexAttribPointer(0,2,F.FLOAT,!1,E,0),F.vertexAttribDivisor(0,1),F.enableVertexAttribArray(1),F.vertexAttribPointer(1,2,F.FLOAT,!1,E,2*Float32Array.BYTES_PER_ELEMENT),F.vertexAttribDivisor(1,1),F.enableVertexAttribArray(2),F.vertexAttribPointer(2,4,F.FLOAT,!1,E,4*Float32Array.BYTES_PER_ELEMENT),F.vertexAttribDivisor(2,1),this._updateCachedColors(B.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 B,F,D,H,W,G,Y,z,P,U,$,K=1;for(B=0;B<L.rows;B++){for(D=-1,H=0,W=0,G=!1,F=0;F<L.cols;F++)Y=(B*L.cols+F)*h.RENDER_MODEL_INDICIES_PER_CELL,z=S.cells[Y+h.RENDER_MODEL_BG_OFFSET],P=S.cells[Y+h.RENDER_MODEL_FG_OFFSET],U=!!(67108864&P),(z!==H||P!==W&&(G||U))&&((H!==0||G&&W!==0)&&($=8*K++,this._updateRectangle(I,$,W,H,D,F,B)),D=F,H=z,W=P,G=U);(H!==0||G&&W!==0)&&($=8*K++,this._updateRectangle(I,$,W,H,D,L.cols,B))}I.count=K}updateCursor(S){const L=this._verticesCursor,I=S.cursor;if(!I||I.style==="block")return void(L.count=0);let B,F=0;I.style!=="bar"&&I.style!=="outline"||(B=8*F++,this._addRectangleFloat(L.attributes,B,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"||(B=8*F++,this._addRectangleFloat(L.attributes,B,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"&&(B=8*F++,this._addRectangleFloat(L.attributes,B,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),B=8*F++,this._addRectangleFloat(L.attributes,B,(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=F}_updateRectangle(S,L,I,B,F,D,H){if(67108864&I)switch(50331648&I){case 16777216:case 33554432:_=this._themeService.colors.ansi[255&I].rgba;break;case 50331648:_=(16777215&I)<<8;break;default:_=this._themeService.colors.foreground.rgba}else switch(50331648&B){case 16777216:case 33554432:_=this._themeService.colors.ansi[255&B].rgba;break;case 50331648:_=(16777215&B)<<8;break;default:_=this._themeService.colors.background.rgba}S.attributes.length<L+4&&(S.attributes=(0,b.expandFloat32Array)(S.attributes,this._terminal.rows*this._terminal.cols*8)),u=F*this._dimensions.device.cell.width,p=H*this._dimensions.device.cell.height,m=(_>>24&255)/255,f=(_>>16&255)/255,x=(_>>8&255)/255,j=1,this._addRectangle(S.attributes,L,u,p,(D-F)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,m,f,x,j)}_addRectangle(S,L,I,B,F,D,H,W,G,Y){S[L]=I/this._dimensions.device.canvas.width,S[L+1]=B/this._dimensions.device.canvas.height,S[L+2]=F/this._dimensions.device.canvas.width,S[L+3]=D/this._dimensions.device.canvas.height,S[L+4]=H,S[L+5]=W,S[L+6]=G,S[L+7]=Y}_addRectangleFloat(S,L,I,B,F,D,H){S[L]=I/this._dimensions.device.canvas.width,S[L+1]=B/this._dimensions.device.canvas.height,S[L+2]=F/this._dimensions.device.canvas.width,S[L+3]=D/this._dimensions.device.canvas.height,S[L+4]=H[0],S[L+5]=H[1],S[L+6]=H[2],S[L+7]=H[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=T},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 g=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,g.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 g=c(820),v=c(274),h=c(627),b=c(457),E=c(56),N=c(374),_=c(345),u=c(859),p=c(147),m=c(782),f=c(855),x=c(965),j=c(742),T=c(310),R=c(733);class S extends u.Disposable{constructor(F,D,H,W,G,Y,z,P,U){super(),this._terminal=F,this._characterJoinerService=D,this._charSizeService=H,this._coreBrowserService=W,this._coreService=G,this._decorationService=Y,this._optionsService=z,this._themeService=P,this._cursorBlinkStateManager=new u.MutableDisposable,this._charAtlasDisposable=this.register(new u.MutableDisposable),this._observerDisposable=this.register(new u.MutableDisposable),this._model=new T.RenderModel,this._workCell=new m.CellData,this._workCell2=new m.CellData,this._rectangleRenderer=this.register(new u.MutableDisposable),this._glyphRenderer=this.register(new u.MutableDisposable),this._onChangeTextureAtlas=this.register(new _.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new _.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new _.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this.register(new _.EventEmitter),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this.register(new _.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,z,this._themeService)],this.dimensions=(0,N.createRenderDimensions)(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this.register(z.onOptionChange((()=>this._handleOptionsChanged()))),this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");const $={antialias:!1,depth:!1,preserveDrawingBuffer:U};if(this._gl=this._canvas.getContext("webgl2",$),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this.register((0,g.addDisposableDomListener)(this._canvas,"webglcontextlost",(K=>{console.log("webglcontextlost event received"),K.preventDefault(),this._contextRestorationTimeout=setTimeout((()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(K)}),3e3)}))),this.register((0,g.addDisposableDomListener)(this._canvas,"webglcontextrestored",(K=>{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,E.observeDevicePixelDimensions)(this._canvas,this._coreBrowserService.window,((K,te)=>this._setCanvasDevicePixelDimensions(K,te))),this.register(this._coreBrowserService.onWindowChange((K=>{this._observerDisposable.value=(0,E.observeDevicePixelDimensions)(this._canvas,K,((te,oe)=>this._setCanvasDevicePixelDimensions(te,oe)))}))),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,u.toDisposable)((()=>{var K;for(const te of this._renderLayers)te.dispose();(K=this._canvas.parentElement)==null||K.removeChild(this._canvas),(0,h.removeTerminalFromCache)(this._terminal)})))}get textureAtlas(){var F;return(F=this._charAtlas)==null?void 0:F.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(F,D){var H,W,G,Y;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(const z of this._renderLayers)z.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`,(H=this._rectangleRenderer.value)==null||H.setDimensions(this.dimensions),(W=this._rectangleRenderer.value)==null||W.handleResize(),(G=this._glyphRenderer.value)==null||G.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 F;for(const D of this._renderLayers)D.handleBlur(this._terminal);(F=this._cursorBlinkStateManager.value)==null||F.pause(),this._requestRedrawViewport()}handleFocus(){var F;for(const D of this._renderLayers)D.handleFocus(this._terminal);(F=this._cursorBlinkStateManager.value)==null||F.resume(),this._requestRedrawViewport()}handleSelectionChanged(F,D,H){for(const W of this._renderLayers)W.handleSelectionChanged(this._terminal,F,D,H);this._model.selection.update(this._core,F,D,H),this._requestRedrawViewport()}handleCursorMove(){var F;for(const D of this._renderLayers)D.handleCursorMove(this._terminal);(F=this._cursorBlinkStateManager.value)==null||F.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 x.GlyphRenderer(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){var D;if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0)return void(this._isAttached=!1);const F=(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!==F&&(this._onChangeTextureAtlas.fire(F.pages[0].canvas),this._charAtlasDisposable.value=(0,u.getDisposeArrayDisposable)([(0,_.forwardEvent)(F.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),(0,_.forwardEvent)(F.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)])),this._charAtlas=F,this._charAtlas.warmUp(),(D=this._glyphRenderer.value)==null||D.setAtlas(this._charAtlas)}_clearModel(F){var D;this._model.clear(),F&&((D=this._glyphRenderer.value)==null||D.clear())}clearTextureAtlas(){var F;(F=this._charAtlas)==null||F.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var F;this._clearModel(!0);for(const D of this._renderLayers)D.reset(this._terminal);(F=this._cursorBlinkStateManager.value)==null||F.restartBlinkAnimation(),this._updateCursorBlink()}registerCharacterJoiner(F){return-1}deregisterCharacterJoiner(F){return!1}renderRows(F,D){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 H of this._renderLayers)H.handleGridChanged(this._terminal,F,D);this._glyphRenderer.value&&this._rectangleRenderer.value&&(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(F,D),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(F,D){const H=this._core;let W,G,Y,z,P,U,$,K,te,oe,we,me,X,V,Z=this._workCell;F=I(F,H.rows-1,0),D=I(D,H.rows-1,0);const ee=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,ve=ee-H.buffer.ydisp,Se=Math.min(this._terminal.buffer.active.cursorX,H.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(G=F;G<=D;G++)for(Y=G+H.buffer.ydisp,z=H.buffer.lines.get(Y),this._model.lineLengths[G]=0,P=this._characterJoinerService.getJoinedCharacters(Y),X=0;X<H.cols;X++)if(W=this._cellColorResolver.result.bg,z.loadCell(X,Z),X===0&&(W=this._cellColorResolver.result.bg),U=!1,$=X,P.length>0&&X===P[0][0]&&(U=!0,K=P.shift(),Z=new L(Z,z.translateToString(!0,K[0],K[1]),K[1]-K[0]),$=K[1]-1),te=Z.getChars(),oe=Z.getCode(),me=(G*H.cols+X)*T.RENDER_MODEL_INDICIES_PER_CELL,this._cellColorResolver.resolve(Z,X,Y,this.dimensions.device.cell.width),je&&Y===ee&&(X===Se&&(this._model.cursor={x:Se,y:ve,width:Z.getWidth(),style:this._coreBrowserService.isFocused?H.options.cursorStyle||"block":H.options.cursorInactiveStyle,cursorWidth:H.options.cursorWidth,dpr:this._devicePixelRatio},Ie=Se+Z.getWidth()-1),X>=Se&&X<=Ie&&(this._coreBrowserService.isFocused&&(H.options.cursorStyle||"block")==="block"||this._coreBrowserService.isFocused===!1&&H.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)),oe!==f.NULL_CELL_CODE&&(this._model.lineLengths[G]=X+1),(this._model.cells[me]!==oe||this._model.cells[me+T.RENDER_MODEL_BG_OFFSET]!==this._cellColorResolver.result.bg||this._model.cells[me+T.RENDER_MODEL_FG_OFFSET]!==this._cellColorResolver.result.fg||this._model.cells[me+T.RENDER_MODEL_EXT_OFFSET]!==this._cellColorResolver.result.ext)&&(Je=!0,te.length>1&&(oe|=T.COMBINED_CHAR_BIT_MASK),this._model.cells[me]=oe,this._model.cells[me+T.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[me+T.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[me+T.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext,we=Z.getWidth(),this._glyphRenderer.value.updateCell(X,G,oe,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,te,we,W),U))for(Z=this._workCell,X++;X<$;X++)V=(G*H.cols+X)*T.RENDER_MODEL_INDICIES_PER_CELL,this._glyphRenderer.value.updateCell(X,G,f.NULL_CELL_CODE,0,0,0,f.NULL_CELL_CHAR,0,0),this._model.cells[V]=f.NULL_CELL_CODE,this._model.cells[V+T.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[V+T.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[V+T.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(F,D){this._canvas.width===F&&this._canvas.height===D||(this._canvas.width=F,this._canvas.height=D,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){const F=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:F,end:F})}}i.WebglRenderer=S;class L extends p.AttributeData{constructor(F,D,H){super(),this.content=0,this.combinedData="",this.fg=F.fg,this.bg=F.bg,this.combinedData=D,this._width=H}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(F){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}function I(B,F,D=0){return Math.max(Math.min(B,F),D)}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 g=c(374);function v(h,b,E){const N=(0,g.throwIfFalsy)(h.createShader(b));if(h.shaderSource(N,E),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,E){const N=(0,g.throwIfFalsy)(h.createProgram());if(h.attachShader(N,(0,g.throwIfFalsy)(v(h,h.VERTEX_SHADER,b))),h.attachShader(N,(0,g.throwIfFalsy)(v(h,h.FRAGMENT_SHADER,E))),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 E=Math.min(2*h.length,b),N=new Float32Array(E);for(let _=0;_<h.length;_++)N[_]=h[_];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 g=c(627),v=c(237),h=c(374),b=c(859);class E extends b.Disposable{constructor(_,u,p,m,f,x,j,T){super(),this._container=u,this._alpha=f,this._coreBrowserService=x,this._optionsService=j,this._themeService=T,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-${p}-layer`),this._canvas.style.zIndex=m.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this.register(this._themeService.onChangeColors((R=>{this._refreshCharAtlas(_,R),this.reset(_)}))),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(_){}handleFocus(_){}handleCursorMove(_){}handleGridChanged(_,u,p){}handleSelectionChanged(_,u,p,m=!1){}_setTransparency(_,u){if(u===this._alpha)return;const p=this._canvas;this._alpha=u,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,p),this._refreshCharAtlas(_,this._themeService.colors),this.handleGridChanged(_,0,_.rows-1)}_refreshCharAtlas(_,u){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=(0,g.acquireTextureAtlas)(_,this._optionsService.rawOptions,u,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr),this._charAtlas.warmUp())}resize(_,u){this._deviceCellWidth=u.device.cell.width,this._deviceCellHeight=u.device.cell.height,this._deviceCharWidth=u.device.char.width,this._deviceCharHeight=u.device.char.height,this._deviceCharLeft=u.device.char.left,this._deviceCharTop=u.device.char.top,this._canvas.width=u.device.canvas.width,this._canvas.height=u.device.canvas.height,this._canvas.style.width=`${u.css.canvas.width}px`,this._canvas.style.height=`${u.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(_,this._themeService.colors)}_fillBottomLineAtCells(_,u,p=1){this._ctx.fillRect(_*this._deviceCellWidth,(u+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,p*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(_,u,p,m){this._alpha?this._ctx.clearRect(_*this._deviceCellWidth,u*this._deviceCellHeight,p*this._deviceCellWidth,m*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(_*this._deviceCellWidth,u*this._deviceCellHeight,p*this._deviceCellWidth,m*this._deviceCellHeight))}_fillCharTrueColor(_,u,p,m){this._ctx.font=this._getFont(_,!1,!1),this._ctx.textBaseline=v.TEXT_BASELINE,this._clipCell(p,m,u.getWidth()),this._ctx.fillText(u.getChars(),p*this._deviceCellWidth+this._deviceCharLeft,m*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(_,u,p){this._ctx.beginPath(),this._ctx.rect(_*this._deviceCellWidth,u*this._deviceCellHeight,p*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(_,u,p){return`${p?"italic":""} ${u?_.options.fontWeightBold:_.options.fontWeight} ${_.options.fontSize*this._coreBrowserService.dpr}px ${_.options.fontFamily}`}}i.BaseRenderLayer=E},733:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.LinkRenderLayer=void 0;const g=c(197),v=c(237),h=c(592);class b extends h.BaseRenderLayer{constructor(N,_,u,p,m,f,x){super(u,N,"link",_,!0,m,f,x),this.register(p.onShowLinkUnderline((j=>this._handleShowLinkUnderline(j)))),this.register(p.onHideLinkUnderline((j=>this._handleHideLinkUnderline(j))))}resize(N,_){super.resize(N,_),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,g.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 _=N.y1+1;_<N.y2;_++)this._fillBottomLineAtCells(0,_,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,g,v,h){c.addEventListener(g,v,h);let b=!1;return{dispose:()=>{b||(b=!0,c.removeEventListener(g,v,h))}}}},274:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CellColorResolver=void 0;const g=c(855),v=c(160),h=c(374);let b,E=0,N=0,_=!1,u=!1,p=!1,m=0;i.CellColorResolver=class{constructor(f,x,j,T,R,S){this._terminal=f,this._optionService=x,this._selectionRenderModel=j,this._decorationService=T,this._coreBrowserService=R,this._themeService=S,this.result={fg:0,bg:0,ext:0}}resolve(f,x,j,T){if(this.result.bg=f.bg,this.result.fg=f.fg,this.result.ext=268435456&f.bg?f.extended.ext:0,N=0,E=0,u=!1,_=!1,p=!1,b=this._themeService.colors,m=0,f.getCode()!==g.NULL_CELL_CODE&&f.extended.underlineStyle===4){const R=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));m=x*T%(2*Math.round(R))}if(this._decorationService.forEachDecorationAtCell(x,j,"bottom",(R=>{R.backgroundColorRGB&&(N=R.backgroundColorRGB.rgba>>8&16777215,u=!0),R.foregroundColorRGB&&(E=R.foregroundColorRGB.rgba>>8&16777215,_=!0)})),p=this._selectionRenderModel.isCellSelected(this._terminal,x,j),p){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(u=!0,b.selectionForeground&&(E=b.selectionForeground.rgba>>8&16777215,_=!0),(0,h.treatGlyphAsBackgroundColor)(f.getCode())){if(67108864&this.result.fg&&(50331648&this.result.bg)==0)E=(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:E=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:E=(16777215&this.result.bg)<<8|255}else switch(50331648&this.result.fg){case 16777216:case 33554432:E=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:E=(16777215&this.result.fg)<<8|255;break;default:E=this._themeService.colors.foreground.rgba}E=v.rgba.blend(E,4294967040&(this._coreBrowserService.isFocused?b.selectionBackgroundOpaque:b.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}_=!0}}this._decorationService.forEachDecorationAtCell(x,j,"top",(R=>{R.backgroundColorRGB&&(N=R.backgroundColorRGB.rgba>>8&16777215,u=!0),R.foregroundColorRGB&&(E=R.foregroundColorRGB.rgba>>8&16777215,_=!0)})),u&&(N=p?-16777216&f.bg&-134217729|N|50331648:-16777216&f.bg|N|50331648),_&&(E=-16777216&f.fg&-67108865|E|50331648),67108864&this.result.fg&&(u&&!_&&(E=(50331648&this.result.bg)==0?-134217728&this.result.fg|16777215&b.background.rgba>>8|50331648:-134217728&this.result.fg|67108863&this.result.bg,_=!0),!u&&_&&(N=(50331648&this.result.fg)==0?-67108864&this.result.bg|16777215&b.foreground.rgba>>8|50331648:-67108864&this.result.bg|67108863&this.result.fg,u=!0)),b=void 0,this.result.bg=u?N:this.result.bg,this.result.fg=_?E:this.result.fg,this.result.ext&=536870911,this.result.ext|=m<<29&3758096384}}},627:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.removeTerminalFromCache=i.acquireTextureAtlas=void 0;const g=c(509),v=c(197),h=[];i.acquireTextureAtlas=function(b,E,N,_,u,p,m,f){const x=(0,v.generateConfig)(_,u,p,m,E,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,x))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,x))return S.ownedBy.push(b),S.atlas}const j=b._core,T={atlas:new g.TextureAtlas(document,x,j.unicodeService),config:x,ownedBy:[b]};return h.push(T),T.atlas},i.removeTerminalFromCache=function(b){for(let E=0;E<h.length;E++){const N=h[E].ownedBy.indexOf(b);if(N!==-1){h[E].ownedBy.length===1?(h[E].atlas.dispose(),h.splice(E,1)):h[E].ownedBy.splice(N,1);break}}}},197:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.is256Color=i.configEquals=i.generateConfig=void 0;const g=c(160);i.generateConfig=function(v,h,b,E,N,_,u){const p={foreground:_.foreground,background:_.background,cursor:g.NULL_COLOR,cursorAccent:g.NULL_COLOR,selectionForeground:g.NULL_COLOR,selectionBackgroundTransparent:g.NULL_COLOR,selectionBackgroundOpaque:g.NULL_COLOR,selectionInactiveBackgroundTransparent:g.NULL_COLOR,selectionInactiveBackgroundOpaque:g.NULL_COLOR,ansi:_.ansi.slice(),contrastCache:_.contrastCache,halfContrastCache:_.halfContrastCache};return{customGlyphs:N.customGlyphs,devicePixelRatio:u,letterSpacing:N.letterSpacing,lineHeight:N.lineHeight,deviceCellWidth:v,deviceCellHeight:h,deviceCharWidth:b,deviceCharHeight:E,fontFamily:N.fontFamily,fontSize:N.fontSize,fontWeight:N.fontWeight,fontWeightBold:N.fontWeightBold,allowTransparency:N.allowTransparency,drawBoldTextInBrightColors:N.drawBoldTextInBrightColors,minimumContrastRatio:N.minimumContrastRatio,colors:p}},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 g=c(399);i.INVERTED_DEFAULT_COLOR=257,i.DIM_OPACITY=.5,i.TEXT_BASELINE=g.isFirefox||g.isLegacyEdge?"bottom":"ideographic"},457:(y,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CursorBlinkStateManager=void 0,i.CursorBlinkStateManager=class{constructor(c,g){this._renderCallback=c,this._coreBrowserService=g,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 g=600-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,g>0)return void this._restartInterval(g)}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 g=600-(Date.now()-this._animationTimeRestarted);return this._animationTimeRestarted=void 0,void this._restartInterval(g)}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 g=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:(_,u)=>`M0,${.5-u} L1,${.5-u} M0,${.5+u} L1,${.5+u}`},"║":{1:(_,u)=>`M${.5-_},0 L${.5-_},1 M${.5+_},0 L${.5+_},1`},"╒":{1:(_,u)=>`M.5,1 L.5,${.5-u} L1,${.5-u} M.5,${.5+u} L1,${.5+u}`},"╓":{1:(_,u)=>`M${.5-_},1 L${.5-_},.5 L1,.5 M${.5+_},.5 L${.5+_},1`},"╔":{1:(_,u)=>`M1,${.5-u} L${.5-_},${.5-u} L${.5-_},1 M1,${.5+u} L${.5+_},${.5+u} L${.5+_},1`},"╕":{1:(_,u)=>`M0,${.5-u} L.5,${.5-u} L.5,1 M0,${.5+u} L.5,${.5+u}`},"╖":{1:(_,u)=>`M${.5+_},1 L${.5+_},.5 L0,.5 M${.5-_},.5 L${.5-_},1`},"╗":{1:(_,u)=>`M0,${.5+u} L${.5-_},${.5+u} L${.5-_},1 M0,${.5-u} L${.5+_},${.5-u} L${.5+_},1`},"╘":{1:(_,u)=>`M.5,0 L.5,${.5+u} L1,${.5+u} M.5,${.5-u} L1,${.5-u}`},"╙":{1:(_,u)=>`M1,.5 L${.5-_},.5 L${.5-_},0 M${.5+_},.5 L${.5+_},0`},"╚":{1:(_,u)=>`M1,${.5-u} L${.5+_},${.5-u} L${.5+_},0 M1,${.5+u} L${.5-_},${.5+u} L${.5-_},0`},"╛":{1:(_,u)=>`M0,${.5+u} L.5,${.5+u} L.5,0 M0,${.5-u} L.5,${.5-u}`},"╜":{1:(_,u)=>`M0,.5 L${.5+_},.5 L${.5+_},0 M${.5-_},.5 L${.5-_},0`},"╝":{1:(_,u)=>`M0,${.5-u} L${.5-_},${.5-u} L${.5-_},0 M0,${.5+u} L${.5+_},${.5+u} L${.5+_},0`},"╞":{1:(_,u)=>`M.5,0 L.5,1 M.5,${.5-u} L1,${.5-u} M.5,${.5+u} L1,${.5+u}`},"╟":{1:(_,u)=>`M${.5-_},0 L${.5-_},1 M${.5+_},0 L${.5+_},1 M${.5+_},.5 L1,.5`},"╠":{1:(_,u)=>`M${.5-_},0 L${.5-_},1 M1,${.5+u} L${.5+_},${.5+u} L${.5+_},1 M1,${.5-u} L${.5+_},${.5-u} L${.5+_},0`},"╡":{1:(_,u)=>`M.5,0 L.5,1 M0,${.5-u} L.5,${.5-u} M0,${.5+u} L.5,${.5+u}`},"╢":{1:(_,u)=>`M0,.5 L${.5-_},.5 M${.5-_},0 L${.5-_},1 M${.5+_},0 L${.5+_},1`},"╣":{1:(_,u)=>`M${.5+_},0 L${.5+_},1 M0,${.5+u} L${.5-_},${.5+u} L${.5-_},1 M0,${.5-u} L${.5-_},${.5-u} L${.5-_},0`},"╤":{1:(_,u)=>`M0,${.5-u} L1,${.5-u} M0,${.5+u} L1,${.5+u} M.5,${.5+u} L.5,1`},"╥":{1:(_,u)=>`M0,.5 L1,.5 M${.5-_},.5 L${.5-_},1 M${.5+_},.5 L${.5+_},1`},"╦":{1:(_,u)=>`M0,${.5-u} L1,${.5-u} M0,${.5+u} L${.5-_},${.5+u} L${.5-_},1 M1,${.5+u} L${.5+_},${.5+u} L${.5+_},1`},"╧":{1:(_,u)=>`M.5,0 L.5,${.5-u} M0,${.5-u} L1,${.5-u} M0,${.5+u} L1,${.5+u}`},"╨":{1:(_,u)=>`M0,.5 L1,.5 M${.5-_},.5 L${.5-_},0 M${.5+_},.5 L${.5+_},0`},"╩":{1:(_,u)=>`M0,${.5+u} L1,${.5+u} M0,${.5-u} L${.5-_},${.5-u} L${.5-_},0 M1,${.5-u} L${.5+_},${.5-u} L${.5+_},0`},"╪":{1:(_,u)=>`M.5,0 L.5,1 M0,${.5-u} L1,${.5-u} M0,${.5+u} L1,${.5+u}`},"╫":{1:(_,u)=>`M0,.5 L1,.5 M${.5-_},0 L${.5-_},1 M${.5+_},0 L${.5+_},1`},"╬":{1:(_,u)=>`M0,${.5+u} L${.5-_},${.5+u} L${.5-_},1 M1,${.5+u} L${.5+_},${.5+u} L${.5+_},1 M0,${.5-u} L${.5-_},${.5-u} L${.5-_},0 M1,${.5-u} L${.5+_},${.5-u} L${.5+_},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:(_,u)=>`M.5,1 L.5,${.5+u/.15*.5} C.5,${.5+u/.15*.5},.5,.5,1,.5`},"╮":{1:(_,u)=>`M.5,1 L.5,${.5+u/.15*.5} C.5,${.5+u/.15*.5},.5,.5,0,.5`},"╯":{1:(_,u)=>`M.5,0 L.5,${.5-u/.15*.5} C.5,${.5-u/.15*.5},.5,.5,0,.5`},"╰":{1:(_,u)=>`M.5,0 L.5,${.5-u/.15*.5} C.5,${.5-u/.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(_,u,p,m,f,x,j,T){const R=i.blockElementDefinitions[u];if(R)return(function(B,F,D,H,W,G){for(let Y=0;Y<F.length;Y++){const z=F[Y],P=W/8,U=G/8;B.fillRect(D+z.x*P,H+z.y*U,z.w*P,z.h*U)}})(_,R,p,m,f,x),!0;const S=v[u];if(S)return(function(B,F,D,H,W,G){let Y=h.get(F);Y||(Y=new Map,h.set(F,Y));const z=B.fillStyle;if(typeof z!="string")throw new Error(`Unexpected fillStyle type "${z}"`);let P=Y.get(z);if(!P){const U=F[0].length,$=F.length,K=B.canvas.ownerDocument.createElement("canvas");K.width=U,K.height=$;const te=(0,g.throwIfFalsy)(K.getContext("2d")),oe=new ImageData(U,$);let we,me,X,V;if(z.startsWith("#"))we=parseInt(z.slice(1,3),16),me=parseInt(z.slice(3,5),16),X=parseInt(z.slice(5,7),16),V=z.length>7&&parseInt(z.slice(7,9),16)||1;else{if(!z.startsWith("rgba"))throw new Error(`Unexpected fillStyle color format "${z}" when drawing pattern glyph`);[we,me,X,V]=z.substring(5,z.length-1).split(",").map((Z=>parseFloat(Z)))}for(let Z=0;Z<$;Z++)for(let ee=0;ee<U;ee++)oe.data[4*(Z*U+ee)]=we,oe.data[4*(Z*U+ee)+1]=me,oe.data[4*(Z*U+ee)+2]=X,oe.data[4*(Z*U+ee)+3]=F[Z][ee]*(255*V);te.putImageData(oe,0,0),P=(0,g.throwIfFalsy)(B.createPattern(K,null)),Y.set(z,P)}B.fillStyle=P,B.fillRect(D,H,W,G)})(_,S,p,m,f,x),!0;const L=i.boxDrawingDefinitions[u];if(L)return(function(B,F,D,H,W,G,Y){B.strokeStyle=B.fillStyle;for(const[z,P]of Object.entries(F)){let U;B.beginPath(),B.lineWidth=Y*Number.parseInt(z),U=typeof P=="function"?P(.15,.15/G*W):P;for(const $ of U.split(" ")){const K=$[0],te=E[K];if(!te){console.error(`Could not find drawing instructions for "${K}"`);continue}const oe=$.substring(1).split(",");oe[0]&&oe[1]&&te(B,N(oe,W,G,D,H,!0,Y))}B.stroke(),B.closePath()}})(_,L,p,m,f,x,T),!0;const I=i.powerlineDefinitions[u];return!!I&&((function(B,F,D,H,W,G,Y,z){const P=new Path2D;P.rect(D,H,W,G),B.clip(P),B.beginPath();const U=Y/12;B.lineWidth=z*U;for(const $ of F.d.split(" ")){const K=$[0],te=E[K];if(!te){console.error(`Could not find drawing instructions for "${K}"`);continue}const oe=$.substring(1).split(",");oe[0]&&oe[1]&&te(B,N(oe,W,G,D,H,!1,z,(F.leftPadding??0)*(U/2),(F.rightPadding??0)*(U/2)))}F.type===1?(B.strokeStyle=B.fillStyle,B.stroke()):B.fill(),B.closePath()})(_,I,p,m,f,x,j,T),!0)};const h=new Map;function b(_,u,p=0){return Math.max(Math.min(_,u),p)}const E={C:(_,u)=>_.bezierCurveTo(u[0],u[1],u[2],u[3],u[4],u[5]),L:(_,u)=>_.lineTo(u[0],u[1]),M:(_,u)=>_.moveTo(u[0],u[1])};function N(_,u,p,m,f,x,j,T=0,R=0){const S=_.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]*=u-T*j-R*j,x&&S[L]!==0&&(S[L]=b(Math.round(S[L]+.5)-.5,u,0)),S[L]+=m+T*j;for(let L=1;L<S.length;L+=2)S[L]*=p,x&&S[L]!==0&&(S[L]=b(Math.round(S[L]+.5)-.5,p,0)),S[L]+=f;return S}},56:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.observeDevicePixelDimensions=void 0;const g=c(859);i.observeDevicePixelDimensions=function(v,h,b){let E=new h.ResizeObserver((N=>{const _=N.find((m=>m.target===v));if(!_)return;if(!("devicePixelContentBoxSize"in _))return E==null||E.disconnect(),void(E=void 0);const u=_.devicePixelContentBoxSize[0].inlineSize,p=_.devicePixelContentBoxSize[0].blockSize;u>0&&p>0&&b(u,p)}));try{E.observe(v,{box:["device-pixel-content-box"]})}catch{E.disconnect(),E=void 0}return(0,g.toDisposable)((()=>E==null?void 0:E.disconnect()))}},374:(y,i)=>{function c(v){return 57508<=v&&v<=57558}function g(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=g,i.allowRescaling=function(v,h,b,E){return h===1&&b>Math.ceil(1.5*E)&&v!==void 0&&v>255&&!g(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,E=!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,_=h[1]-N,u=b[1]-N,p=Math.max(_,0),m=Math.min(u,v.rows-1);p>=v.rows||m<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=E,this.viewportStartRow=_,this.viewportEndRow=u,this.viewportCappedStartRow=p,this.viewportCappedEndRow=m,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 g=c(237),v=c(860),h=c(374),b=c(160),E=c(345),N=c(485),_=c(385),u=c(147),p=c(855),m={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 x{get pages(){return this._pages}constructor(L,I,B){this._document=L,this._config=I,this._unicodeService=B,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 u.AttributeData,this._textureSize=512,this._onAddTextureAtlasCanvas=new E.EventEmitter,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new E.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 _.IdleTaskQueue;for(let I=33;I<126;I++)L.enqueue((()=>{if(!this._cacheMap.get(I,p.DEFAULT_COLOR,p.DEFAULT_COLOR,p.DEFAULT_EXT)){const B=this._drawToCache(I,p.DEFAULT_COLOR,p.DEFAULT_COLOR,p.DEFAULT_EXT);this._cacheMap.set(I,p.DEFAULT_COLOR,p.DEFAULT_COLOR,p.DEFAULT_EXT,B)}}))}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(x.maxAtlasPages&&this._pages.length>=Math.max(4,x.maxAtlasPages)){const I=this._pages.filter((Y=>2*Y.canvas.width<=(x.maxTextureSize||4096))).sort(((Y,z)=>z.canvas.width!==Y.canvas.width?z.canvas.width-Y.canvas.width:z.percentageUsed-Y.percentageUsed));let B=-1,F=0;for(let Y=0;Y<I.length;Y++)if(I[Y].canvas.width!==F)B=Y,F=I[Y].canvas.width;else if(Y-B==3)break;const D=I.slice(B,B+4),H=D.map((Y=>Y.glyphs[0].texturePage)).sort(((Y,z)=>Y>z?1:-1)),W=this.pages.length-D.length,G=this._mergePages(D,W);G.version++;for(let Y=H.length-1;Y>=0;Y--)this._deletePage(H[Y]);this.pages.push(G),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(G.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 B=2*L[0].canvas.width,F=new j(this._document,B,L);for(const[D,H]of L.entries()){const W=D*H.canvas.width%B,G=Math.floor(D/2)*H.canvas.height;F.ctx.drawImage(H.canvas,W,G);for(const z of H.glyphs)z.texturePage=I,z.sizeClipSpace.x=z.size.x/B,z.sizeClipSpace.y=z.size.y/B,z.texturePosition.x+=W,z.texturePosition.y+=G,z.texturePositionClipSpace.x=z.texturePosition.x/B,z.texturePositionClipSpace.y=z.texturePosition.y/B;this._onRemoveTextureAtlasCanvas.fire(H.canvas);const Y=this._activePages.indexOf(H);Y!==-1&&this._activePages.splice(Y,1)}return F}_deletePage(L){this._pages.splice(L,1);for(let I=L;I<this._pages.length;I++){const B=this._pages[I];for(const F of B.glyphs)F.texturePage--;B.version++}}getRasterizedGlyphCombinedChar(L,I,B,F,D){return this._getFromCacheMap(this._cacheMapCombined,L,I,B,F,D)}getRasterizedGlyph(L,I,B,F,D){return this._getFromCacheMap(this._cacheMap,L,I,B,F,D)}_getFromCacheMap(L,I,B,F,D,H=!1){return f=L.get(I,B,F,D),f||(f=this._drawToCache(I,B,F,D,H),L.set(I,B,F,D,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,B,F){if(this._config.allowTransparency)return b.NULL_COLOR;let D;switch(L){case 16777216:case 33554432:D=this._getColorFromAnsiIndex(I);break;case 50331648:const H=u.AttributeData.toColorRGB(I);D=b.channels.toColor(H[0],H[1],H[2]);break;default:D=B?b.color.opaque(this._config.colors.foreground):this._config.colors.background}return D}_getForegroundColor(L,I,B,F,D,H,W,G,Y,z){const P=this._getMinimumContrastColor(L,I,B,F,D,H,W,Y,G,z);if(P)return P;let U;switch(D){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&Y&&H<8&&(H+=8),U=this._getColorFromAnsiIndex(H);break;case 50331648:const $=u.AttributeData.toColorRGB(H);U=b.channels.toColor($[0],$[1],$[2]);break;default:U=W?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(U=b.color.opaque(U)),G&&(U=b.color.multiplyOpacity(U,g.DIM_OPACITY)),U}_resolveBackgroundRgba(L,I,B){switch(L){case 16777216:case 33554432:return this._getColorFromAnsiIndex(I).rgba;case 50331648:return I<<8;default:return B?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(L,I,B,F){switch(L){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&F&&I<8&&(I+=8),this._getColorFromAnsiIndex(I).rgba;case 50331648:return I<<8;default:return B?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(L,I,B,F,D,H,W,G,Y,z){if(this._config.minimumContrastRatio===1||z)return;const P=this._getContrastCache(Y),U=P.getColor(L,F);if(U!==void 0)return U||void 0;const $=this._resolveBackgroundRgba(I,B,W),K=this._resolveForegroundRgba(D,H,W,G),te=b.rgba.ensureContrastRatio($,K,this._config.minimumContrastRatio/(Y?2:1));if(!te)return void P.setColor(L,F,null);const oe=b.channels.toColor(te>>24&255,te>>16&255,te>>8&255);return P.setColor(L,F,oe),oe}_getContrastCache(L){return L?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(L,I,B,F,D=!1){const H=typeof L=="number"?String.fromCharCode(L):L,W=Math.min(this._config.deviceCellWidth*Math.max(H.length,2)+4,this._textureSize);this._tmpCanvas.width<W&&(this._tmpCanvas.width=W);const G=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<G&&(this._tmpCanvas.height=G),this._tmpCtx.save(),this._workAttributeData.fg=B,this._workAttributeData.bg=I,this._workAttributeData.extended.ext=F,this._workAttributeData.isInvisible())return m;const Y=!!this._workAttributeData.isBold(),z=!!this._workAttributeData.isInverse(),P=!!this._workAttributeData.isDim(),U=!!this._workAttributeData.isItalic(),$=!!this._workAttributeData.isUnderline(),K=!!this._workAttributeData.isStrikethrough(),te=!!this._workAttributeData.isOverline();let oe=this._workAttributeData.getFgColor(),we=this._workAttributeData.getFgColorMode(),me=this._workAttributeData.getBgColor(),X=this._workAttributeData.getBgColorMode();if(z){const be=oe;oe=me,me=be;const ge=we;we=X,X=ge}const V=this._getBackgroundColor(X,me,z,P);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=V.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";const Z=Y?this._config.fontWeightBold:this._config.fontWeight,ee=U?"italic":"";this._tmpCtx.font=`${ee} ${Z} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=g.TEXT_BASELINE;const ve=H.length===1&&(0,h.isPowerlineGlyph)(H.charCodeAt(0)),Se=H.length===1&&(0,h.isRestrictedPowerlineGlyph)(H.charCodeAt(0)),Ie=this._getForegroundColor(I,X,me,B,we,oe,z,P,Y,(0,h.treatGlyphAsBackgroundColor)(H.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,H,je,je,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let Ze,Ae=!ve;if(Ze=typeof L=="number"?this._unicodeService.wcwidth(L):this._unicodeService.getStringCellWidth(L),$){this._tmpCtx.save();const be=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),ge=be%2==1?.5:0;if(this._tmpCtx.lineWidth=be,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())Ae=!1,this._tmpCtx.strokeStyle=`rgb(${u.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{Ae=!1;let Oe=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&Oe<8&&(Oe+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(Oe).css}this._tmpCtx.beginPath();const Le=je,ce=Math.ceil(je+this._config.deviceCharHeight)-ge-(D?2*be:0),Ye=ce+be,We=ce+2*be;let He=this._workAttributeData.getUnderlineVariantOffset();for(let Oe=0;Oe<Ze;Oe++){this._tmpCtx.save();const Ue=Le+Oe*this._config.deviceCellWidth,qe=Le+(Oe+1)*this._config.deviceCellWidth,St=Ue+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(Ue,ce),this._tmpCtx.lineTo(qe,ce),this._tmpCtx.moveTo(Ue,We),this._tmpCtx.lineTo(qe,We);break;case 3:const Pt=be<=1?We:Math.ceil(je+this._config.deviceCharHeight-be/2)-ge,$t=be<=1?ce:Math.ceil(je+this._config.deviceCharHeight+be/2)-ge,dt=new Path2D;dt.rect(Ue,ce,this._config.deviceCellWidth,We-ce),this._tmpCtx.clip(dt),this._tmpCtx.moveTo(Ue-this._config.deviceCellWidth/2,Ye),this._tmpCtx.bezierCurveTo(Ue-this._config.deviceCellWidth/2,$t,Ue,$t,Ue,Ye),this._tmpCtx.bezierCurveTo(Ue,Pt,St,Pt,St,Ye),this._tmpCtx.bezierCurveTo(St,$t,qe,$t,qe,Ye),this._tmpCtx.bezierCurveTo(qe,Pt,qe+this._config.deviceCellWidth/2,Pt,qe+this._config.deviceCellWidth/2,Ye);break;case 4:const tn=He===0?0:He>=be?2*be-He:be-He;He>=be||tn===0?(this._tmpCtx.setLineDash([Math.round(be),Math.round(be)]),this._tmpCtx.moveTo(Ue+tn,ce),this._tmpCtx.lineTo(qe,ce)):(this._tmpCtx.setLineDash([Math.round(be),Math.round(be)]),this._tmpCtx.moveTo(Ue,ce),this._tmpCtx.lineTo(Ue+tn,ce),this._tmpCtx.moveTo(Ue+tn+be,ce),this._tmpCtx.lineTo(qe,ce)),He=(0,h.computeNextVariantOffset)(qe-Ue,be,He);break;case 5:const Vt=.6,fe=.3,et=qe-Ue,Xe=Math.floor(Vt*et),lt=Math.floor(fe*et),de=et-Xe-lt;this._tmpCtx.setLineDash([Xe,lt,de]),this._tmpCtx.moveTo(Ue,ce),this._tmpCtx.lineTo(qe,ce);break;default:this._tmpCtx.moveTo(Ue,ce),this._tmpCtx.lineTo(qe,ce)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!Je&&this._config.fontSize>=12&&!this._config.allowTransparency&&H!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";const Oe=this._tmpCtx.measureText(H);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in Oe&&Oe.actualBoundingBoxDescent>0){this._tmpCtx.save();const Ue=new Path2D;Ue.rect(Le,ce-Math.ceil(be/2),this._config.deviceCellWidth*Ze,We-ce+Math.ceil(be/2)),this._tmpCtx.clip(Ue),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=V.css,this._tmpCtx.strokeText(H,je,je+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(te){const be=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),ge=be%2==1?.5:0;this._tmpCtx.lineWidth=be,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(je,je+ge),this._tmpCtx.lineTo(je+this._config.deviceCharWidth*Ze,je+ge),this._tmpCtx.stroke()}if(Je||this._tmpCtx.fillText(H,je,je+this._config.deviceCharHeight),H==="_"&&!this._config.allowTransparency){let be=T(this._tmpCtx.getImageData(je,je,this._config.deviceCellWidth,this._config.deviceCellHeight),V,Ie,Ae);if(be)for(let ge=1;ge<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=V.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(H,je,je+this._config.deviceCharHeight-ge),be=T(this._tmpCtx.getImageData(je,je,this._config.deviceCellWidth,this._config.deviceCellHeight),V,Ie,Ae),be);ge++);}if(K){const be=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),ge=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=be,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(je,je+Math.floor(this._config.deviceCharHeight/2)-ge),this._tmpCtx.lineTo(je+this._config.deviceCharWidth*Ze,je+Math.floor(this._config.deviceCharHeight/2)-ge),this._tmpCtx.stroke()}this._tmpCtx.restore();const ue=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height);let ht;if(ht=this._config.allowTransparency?(function(be){for(let ge=0;ge<be.data.length;ge+=4)if(be.data[ge+3]>0)return!1;return!0})(ue):T(ue,V,Ie,Ae),ht)return m;const se=this._findGlyphBoundingBox(ue,this._workBoundingBox,W,Se,Je,je);let pe,Ce;for(;;){if(this._activePages.length===0){const be=this._createNewPage();pe=be,Ce=be.currentRow,Ce.height=se.size.y;break}pe=this._activePages[this._activePages.length-1],Ce=pe.currentRow;for(const be of this._activePages)se.size.y<=be.currentRow.height&&(pe=be,Ce=be.currentRow);for(let be=this._activePages.length-1;be>=0;be--)for(const ge of this._activePages[be].fixedRows)ge.height<=Ce.height&&se.size.y<=ge.height&&(pe=this._activePages[be],Ce=ge);if(Ce.y+se.size.y>=pe.canvas.height||Ce.height>se.size.y+2){let be=!1;if(pe.currentRow.y+pe.currentRow.height+se.size.y>=pe.canvas.height){let ge;for(const Le of this._activePages)if(Le.currentRow.y+Le.currentRow.height+se.size.y<Le.canvas.height){ge=Le;break}if(ge)pe=ge;else if(x.maxAtlasPages&&this._pages.length>=x.maxAtlasPages&&Ce.y+se.size.y<=pe.canvas.height&&Ce.height>=se.size.y&&Ce.x+se.size.x<=pe.canvas.width)be=!0;else{const Le=this._createNewPage();pe=Le,Ce=Le.currentRow,Ce.height=se.size.y,be=!0}}be||(pe.currentRow.height>0&&pe.fixedRows.push(pe.currentRow),Ce={x:0,y:pe.currentRow.y+pe.currentRow.height,height:se.size.y},pe.fixedRows.push(Ce),pe.currentRow={x:0,y:Ce.y+Ce.height,height:0})}if(Ce.x+se.size.x<=pe.canvas.width)break;Ce===pe.currentRow?(Ce.x=0,Ce.y+=Ce.height,Ce.height=0):pe.fixedRows.splice(pe.fixedRows.indexOf(Ce),1)}return se.texturePage=this._pages.indexOf(pe),se.texturePosition.x=Ce.x,se.texturePosition.y=Ce.y,se.texturePositionClipSpace.x=Ce.x/pe.canvas.width,se.texturePositionClipSpace.y=Ce.y/pe.canvas.height,se.sizeClipSpace.x/=pe.canvas.width,se.sizeClipSpace.y/=pe.canvas.height,Ce.height=Math.max(Ce.height,se.size.y),Ce.x+=se.size.x,pe.ctx.putImageData(ue,se.texturePosition.x-this._workBoundingBox.left,se.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,se.size.x,se.size.y),pe.addGlyph(se),pe.version++,se}_findGlyphBoundingBox(L,I,B,F,D,H){I.top=0;const W=F?this._config.deviceCellHeight:this._tmpCanvas.height,G=F?this._config.deviceCellWidth:B;let Y=!1;for(let z=0;z<W;z++){for(let P=0;P<G;P++){const U=z*this._tmpCanvas.width*4+4*P+3;if(L.data[U]!==0){I.top=z,Y=!0;break}}if(Y)break}I.left=0,Y=!1;for(let z=0;z<H+G;z++){for(let P=0;P<W;P++){const U=P*this._tmpCanvas.width*4+4*z+3;if(L.data[U]!==0){I.left=z,Y=!0;break}}if(Y)break}I.right=G,Y=!1;for(let z=H+G-1;z>=H;z--){for(let P=0;P<W;P++){const U=P*this._tmpCanvas.width*4+4*z+3;if(L.data[U]!==0){I.right=z,Y=!0;break}}if(Y)break}I.bottom=W,Y=!1;for(let z=W-1;z>=0;z--){for(let P=0;P<G;P++){const U=z*this._tmpCanvas.width*4+4*P+3;if(L.data[U]!==0){I.bottom=z,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+H+(F||D?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-I.top+H+(F||D?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}}i.TextureAtlas=x;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,B){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],B)for(const F of B)this._glyphs.push(...F.glyphs),this._usedPixels+=F._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 T(S,L,I,B){const F=L.rgba>>>24,D=L.rgba>>>16&255,H=L.rgba>>>8&255,W=I.rgba>>>24,G=I.rgba>>>16&255,Y=I.rgba>>>8&255,z=Math.floor((Math.abs(F-W)+Math.abs(D-G)+Math.abs(H-Y))/12);let P=!0;for(let U=0;U<S.data.length;U+=4)S.data[U]===F&&S.data[U+1]===D&&S.data[U+2]===H||B&&Math.abs(S.data[U]-F)+Math.abs(S.data[U+1]-D)+Math.abs(S.data[U+2]-H)<z?S.data[U+3]=0:P=!1;return P}function R(S,L,I){const B=S.createElement("canvas");return B.width=L,B.height=I,B}},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,g=0,v=0,h=0;var b,E,N,_,u;function p(f){const x=f.toString(16);return x.length<2?"0"+x:x}function m(f,x){return f<x?(x+.05)/(f+.05):(f+.05)/(x+.05)}i.NULL_COLOR={css:"#00000000",rgba:0},(function(f){f.toCss=function(x,j,T,R){return R!==void 0?`#${p(x)}${p(j)}${p(T)}${p(R)}`:`#${p(x)}${p(j)}${p(T)}`},f.toRgba=function(x,j,T,R=255){return(x<<24|j<<16|T<<8|R)>>>0},f.toColor=function(x,j,T,R){return{css:f.toCss(x,j,T,R),rgba:f.toRgba(x,j,T,R)}}})(b||(i.channels=b={})),(function(f){function x(j,T){return h=Math.round(255*T),[c,g,v]=u.toChannels(j.rgba),{css:b.toCss(c,g,v,h),rgba:b.toRgba(c,g,v,h)}}f.blend=function(j,T){if(h=(255&T.rgba)/255,h===1)return{css:T.css,rgba:T.rgba};const R=T.rgba>>24&255,S=T.rgba>>16&255,L=T.rgba>>8&255,I=j.rgba>>24&255,B=j.rgba>>16&255,F=j.rgba>>8&255;return c=I+Math.round((R-I)*h),g=B+Math.round((S-B)*h),v=F+Math.round((L-F)*h),{css:b.toCss(c,g,v),rgba:b.toRgba(c,g,v)}},f.isOpaque=function(j){return(255&j.rgba)==255},f.ensureContrastRatio=function(j,T,R){const S=u.ensureContrastRatio(j.rgba,T.rgba,R);if(S)return b.toColor(S>>24&255,S>>16&255,S>>8&255)},f.opaque=function(j){const T=(255|j.rgba)>>>0;return[c,g,v]=u.toChannels(T),{css:b.toCss(c,g,v),rgba:T}},f.opacity=x,f.multiplyOpacity=function(j,T){return h=255&j.rgba,x(j,h*T/255)},f.toColorRGB=function(j){return[j.rgba>>24&255,j.rgba>>16&255,j.rgba>>8&255]}})(E||(i.color=E={})),(function(f){let x,j;try{const T=document.createElement("canvas");T.width=1,T.height=1;const R=T.getContext("2d",{willReadFrequently:!0});R&&(x=R,x.globalCompositeOperation="copy",j=x.createLinearGradient(0,0,1,1))}catch{}f.toColor=function(T){if(T.match(/#[\da-f]{3,8}/i))switch(T.length){case 4:return c=parseInt(T.slice(1,2).repeat(2),16),g=parseInt(T.slice(2,3).repeat(2),16),v=parseInt(T.slice(3,4).repeat(2),16),b.toColor(c,g,v);case 5:return c=parseInt(T.slice(1,2).repeat(2),16),g=parseInt(T.slice(2,3).repeat(2),16),v=parseInt(T.slice(3,4).repeat(2),16),h=parseInt(T.slice(4,5).repeat(2),16),b.toColor(c,g,v,h);case 7:return{css:T,rgba:(parseInt(T.slice(1),16)<<8|255)>>>0};case 9:return{css:T,rgba:parseInt(T.slice(1),16)>>>0}}const R=T.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]),g=parseInt(R[2]),v=parseInt(R[3]),h=Math.round(255*(R[5]===void 0?1:parseFloat(R[5]))),b.toColor(c,g,v,h);if(!x||!j)throw new Error("css.toColor: Unsupported css format");if(x.fillStyle=j,x.fillStyle=T,typeof x.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(x.fillRect(0,0,1,1),[c,g,v,h]=x.getImageData(0,0,1,1).data,h!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:b.toRgba(c,g,v,h),css:T}}})(N||(i.css=N={})),(function(f){function x(j,T,R){const S=j/255,L=T/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 x(j>>16&255,j>>8&255,255&j)},f.relativeLuminance2=x})(_||(i.rgb=_={})),(function(f){function x(T,R,S){const L=T>>24&255,I=T>>16&255,B=T>>8&255;let F=R>>24&255,D=R>>16&255,H=R>>8&255,W=m(_.relativeLuminance2(F,D,H),_.relativeLuminance2(L,I,B));for(;W<S&&(F>0||D>0||H>0);)F-=Math.max(0,Math.ceil(.1*F)),D-=Math.max(0,Math.ceil(.1*D)),H-=Math.max(0,Math.ceil(.1*H)),W=m(_.relativeLuminance2(F,D,H),_.relativeLuminance2(L,I,B));return(F<<24|D<<16|H<<8|255)>>>0}function j(T,R,S){const L=T>>24&255,I=T>>16&255,B=T>>8&255;let F=R>>24&255,D=R>>16&255,H=R>>8&255,W=m(_.relativeLuminance2(F,D,H),_.relativeLuminance2(L,I,B));for(;W<S&&(F<255||D<255||H<255);)F=Math.min(255,F+Math.ceil(.1*(255-F))),D=Math.min(255,D+Math.ceil(.1*(255-D))),H=Math.min(255,H+Math.ceil(.1*(255-H))),W=m(_.relativeLuminance2(F,D,H),_.relativeLuminance2(L,I,B));return(F<<24|D<<16|H<<8|255)>>>0}f.blend=function(T,R){if(h=(255&R)/255,h===1)return R;const S=R>>24&255,L=R>>16&255,I=R>>8&255,B=T>>24&255,F=T>>16&255,D=T>>8&255;return c=B+Math.round((S-B)*h),g=F+Math.round((L-F)*h),v=D+Math.round((I-D)*h),b.toRgba(c,g,v)},f.ensureContrastRatio=function(T,R,S){const L=_.relativeLuminance(T>>8),I=_.relativeLuminance(R>>8);if(m(L,I)<S){if(I<L){const D=x(T,R,S),H=m(L,_.relativeLuminance(D>>8));if(H<S){const W=j(T,R,S);return H>m(L,_.relativeLuminance(W>>8))?D:W}return D}const B=j(T,R,S),F=m(L,_.relativeLuminance(B>>8));if(F<S){const D=x(T,R,S);return F>m(L,_.relativeLuminance(D>>8))?B:D}return B}},f.reduceLuminance=x,f.increaseLuminance=j,f.toChannels=function(T){return[T>>24&255,T>>16&255,T>>8&255,255&T]}})(u||(i.rgba=u={})),i.toPaddedHex=p,i.contrastRatio=m},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 g=0;g<this._listeners.length;g++)if(this._listeners[g]===c)return void this._listeners.splice(g,1)}}})),this._event}fire(c,g){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,g)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},i.forwardEvent=function(c,g){return c((v=>g.fire(v)))},i.runAndSubscribe=function(c,g){return g(void 0),c((v=>g(v)))}},859:(y,i)=>{function c(g){for(const v of g)v.dispose();g.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 g of this._disposables)g.dispose();this._disposables.length=0}register(g){return this._disposables.push(g),g}unregister(g){const v=this._disposables.indexOf(g);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(g){var v;this._isDisposed||g===this._value||((v=this._value)==null||v.dispose(),this._value=g)}clear(){this.value=void 0}dispose(){var g;this._isDisposed=!0,(g=this._value)==null||g.dispose(),this._value=void 0}},i.toDisposable=function(g){return{dispose:g}},i.disposeArray=c,i.getDisposeArrayDisposable=function(g){return{dispose:()=>c(g)}}},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(g,v,h,b,E){this._data.get(g,v)||this._data.set(g,v,new c),this._data.get(g,v).set(h,b,E)}get(g,v,h,b){var E;return(E=this._data.get(g,v))==null?void 0:E.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,g=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(g),i.isIpad=g==="iPad",i.isIphone=g==="iPhone",i.isWindows=["Windows","Win16","Win32","WinCE"].includes(g),i.isLinux=g.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 g=c(399);class v{constructor(){this._tasks=[],this._i=0}enqueue(E){this._tasks.push(E),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(E){this._idleCallback=void 0;let N=0,_=0,u=E.timeRemaining(),p=0;for(;this._i<this._tasks.length;){if(N=Date.now(),this._tasks[this._i]()||this._i++,N=Math.max(1,Date.now()-N),_=Math.max(N,_),p=E.timeRemaining(),1.5*_>p)return u-N<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(u-N))}ms`),void this._start();u=p}this.clear()}}class h extends v{_requestCallback(E){return setTimeout((()=>E(this._createDeadline(16))))}_cancelCallback(E){clearTimeout(E)}_createDeadline(E){const N=Date.now()+E;return{timeRemaining:()=>Math.max(0,N-Date.now())}}}i.PriorityTaskQueue=h,i.IdleTaskQueue=!g.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 g}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 g{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 g(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}i.ExtendedAttrs=g},782:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CellData=void 0;const g=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 _=new b;return _.setFromCharData(N),_}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,g.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 _=!1;if(N[v.CHAR_DATA_CHAR_INDEX].length>2)_=!0;else if(N[v.CHAR_DATA_CHAR_INDEX].length===2){const u=N[v.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=u&&u<=56319){const p=N[v.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=p&&p<=57343?this.content=1024*(u-55296)+p-56320+65536|N[v.CHAR_DATA_WIDTH_INDEX]<<22:_=!0}else _=!0}else this.content=N[v.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|N[v.CHAR_DATA_WIDTH_INDEX]<<22;_&&(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,g=0,v=c.length){let h="";for(let b=g;b<v;++b){let E=c[b];E>65535?(E-=65536,h+=String.fromCharCode(55296+(E>>10))+String.fromCharCode(E%1024+56320)):h+=String.fromCharCode(E)}return h},i.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(c,g){const v=c.length;if(!v)return 0;let h=0,b=0;if(this._interim){const E=c.charCodeAt(b++);56320<=E&&E<=57343?g[h++]=1024*(this._interim-55296)+E-56320+65536:(g[h++]=this._interim,g[h++]=E),this._interim=0}for(let E=b;E<v;++E){const N=c.charCodeAt(E);if(55296<=N&&N<=56319){if(++E>=v)return this._interim=N,h;const _=c.charCodeAt(E);56320<=_&&_<=57343?g[h++]=1024*(N-55296)+_-56320+65536:(g[h++]=N,g[h++]=_)}else N!==65279&&(g[h++]=N)}return h}},i.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(c,g){const v=c.length;if(!v)return 0;let h,b,E,N,_=0,u=0,p=0;if(this.interim[0]){let x=!1,j=this.interim[0];j&=(224&j)==192?31:(240&j)==224?15:7;let T,R=0;for(;(T=63&this.interim[++R])&&R<4;)j<<=6,j|=T;const S=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,L=S-R;for(;p<L;){if(p>=v)return 0;if(T=c[p++],(192&T)!=128){p--,x=!0;break}this.interim[R++]=T,j<<=6,j|=63&T}x||(S===2?j<128?p--:g[_++]=j:S===3?j<2048||j>=55296&&j<=57343||j===65279||(g[_++]=j):j<65536||j>1114111||(g[_++]=j)),this.interim.fill(0)}const m=v-4;let f=p;for(;f<v;){for(;!(!(f<m)||128&(h=c[f])||128&(b=c[f+1])||128&(E=c[f+2])||128&(N=c[f+3]));)g[_++]=h,g[_++]=b,g[_++]=E,g[_++]=N,f+=4;if(h=c[f++],h<128)g[_++]=h;else if((224&h)==192){if(f>=v)return this.interim[0]=h,_;if(b=c[f++],(192&b)!=128){f--;continue}if(u=(31&h)<<6|63&b,u<128){f--;continue}g[_++]=u}else if((240&h)==224){if(f>=v)return this.interim[0]=h,_;if(b=c[f++],(192&b)!=128){f--;continue}if(f>=v)return this.interim[0]=h,this.interim[1]=b,_;if(E=c[f++],(192&E)!=128){f--;continue}if(u=(15&h)<<12|(63&b)<<6|63&E,u<2048||u>=55296&&u<=57343||u===65279)continue;g[_++]=u}else if((248&h)==240){if(f>=v)return this.interim[0]=h,_;if(b=c[f++],(192&b)!=128){f--;continue}if(f>=v)return this.interim[0]=h,this.interim[1]=b,_;if(E=c[f++],(192&E)!=128){f--;continue}if(f>=v)return this.interim[0]=h,this.interim[1]=b,this.interim[2]=E,_;if(N=c[f++],(192&N)!=128){f--;continue}if(u=(7&h)<<18|(63&b)<<12|(63&E)<<6|63&N,u<65536||u>1114111)continue;g[_++]=u}}return _}}},776:function(y,i,c){var g=this&&this.__decorate||function(u,p,m,f){var x,j=arguments.length,T=j<3?p:f===null?f=Object.getOwnPropertyDescriptor(p,m):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(u,p,m,f);else for(var R=u.length-1;R>=0;R--)(x=u[R])&&(T=(j<3?x(T):j>3?x(p,m,T):x(p,m))||T);return j>3&&T&&Object.defineProperty(p,m,T),T},v=this&&this.__param||function(u,p){return function(m,f){p(m,f,u)}};Object.defineProperty(i,"__esModule",{value:!0}),i.traceCall=i.setTraceLogger=i.LogService=void 0;const h=c(859),b=c(97),E={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,_=i.LogService=class extends h.Disposable{get logLevel(){return this._logLevel}constructor(u){super(),this._optionsService=u,this._logLevel=b.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),N=this}_updateLogLevel(){this._logLevel=E[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(u){for(let p=0;p<u.length;p++)typeof u[p]=="function"&&(u[p]=u[p]())}_log(u,p,m){this._evalLazyOptionalParams(m),u.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+p,...m)}trace(u,...p){var m;this._logLevel<=b.LogLevelEnum.TRACE&&this._log(((m=this._optionsService.options.logger)==null?void 0:m.trace.bind(this._optionsService.options.logger))??console.log,u,p)}debug(u,...p){var m;this._logLevel<=b.LogLevelEnum.DEBUG&&this._log(((m=this._optionsService.options.logger)==null?void 0:m.debug.bind(this._optionsService.options.logger))??console.log,u,p)}info(u,...p){var m;this._logLevel<=b.LogLevelEnum.INFO&&this._log(((m=this._optionsService.options.logger)==null?void 0:m.info.bind(this._optionsService.options.logger))??console.info,u,p)}warn(u,...p){var m;this._logLevel<=b.LogLevelEnum.WARN&&this._log(((m=this._optionsService.options.logger)==null?void 0:m.warn.bind(this._optionsService.options.logger))??console.warn,u,p)}error(u,...p){var m;this._logLevel<=b.LogLevelEnum.ERROR&&this._log(((m=this._optionsService.options.logger)==null?void 0:m.error.bind(this._optionsService.options.logger))??console.error,u,p)}};i.LogService=_=g([v(0,b.IOptionsService)],_),i.setTraceLogger=function(u){N=u},i.traceCall=function(u,p,m){if(typeof m.value!="function")throw new Error("not supported");const f=m.value;m.value=function(...x){if(N.logLevel!==b.LogLevelEnum.TRACE)return f.apply(this,x);N.trace(`GlyphRenderer#${f.name}(${x.map((T=>JSON.stringify(T))).join(", ")})`);const j=f.apply(this,x);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",g="di$dependencies";i.serviceRegistry=new Map,i.getServiceDependencies=function(v){return v[g]||[]},i.createDecorator=function(v){if(i.serviceRegistry.has(v))return i.serviceRegistry.get(v);const h=function(b,E,N){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(_,u,p){u[c]===u?u[g].push({id:_,index:p}):(u[g]=[{id:_,index:p}],u[c]=u)})(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 g=c(726);var v;i.IBufferService=(0,g.createDecorator)("BufferService"),i.ICoreMouseService=(0,g.createDecorator)("CoreMouseService"),i.ICoreService=(0,g.createDecorator)("CoreService"),i.ICharsetService=(0,g.createDecorator)("CharsetService"),i.IInstantiationService=(0,g.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,g.createDecorator)("LogService"),i.IOptionsService=(0,g.createDecorator)("OptionsService"),i.IOscLinkService=(0,g.createDecorator)("OscLinkService"),i.IUnicodeService=(0,g.createDecorator)("UnicodeService"),i.IDecorationService=(0,g.createDecorator)("DecorationService")}},a={};function d(y){var i=a[y];if(i!==void 0)return i.exports;var c=a[y]={exports:{}};return s[y].call(c.exports,c,c.exports,d),c.exports}var k={};return(()=>{var y=k;Object.defineProperty(y,"__esModule",{value:!0}),y.WebglAddon=void 0;const i=d(345),c=d(859),g=d(399),v=d(666),h=d(776);class b extends c.Disposable{constructor(N){if(g.isSafari&&(0,g.getSafariVersion)()<16){const _={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",_))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 _=N._core;if(!N.element)return void this.register(_.onWillOpen((()=>this.activate(N))));this._terminal=N;const u=_.coreService,p=_.optionsService,m=_,f=m._renderService,x=m._characterJoinerService,j=m._charSizeService,T=m._coreBrowserService,R=m._decorationService,S=m._logService,L=m._themeService;(0,h.setTraceLogger)(S),this._renderer=this.register(new v.WebglRenderer(N,x,j,T,u,R,p,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})()))})(fu)),fu.exports}var HC=FC(),pu={exports:{}},Tp;function UC(){return Tp||(Tp=1,(function(t,e){(function(s,a){t.exports=a()})(globalThis,(()=>(()=>{var s={4567:function(y,i,c){var g=this&&this.__decorate||function(m,f,x,j){var T,R=arguments.length,S=R<3?f:j===null?j=Object.getOwnPropertyDescriptor(f,x):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(m,f,x,j);else for(var L=m.length-1;L>=0;L--)(T=m[L])&&(S=(R<3?T(S):R>3?T(f,x,S):T(f,x))||S);return R>3&&S&&Object.defineProperty(f,x,S),S},v=this&&this.__param||function(m,f){return function(x,j){f(x,j,m)}};Object.defineProperty(i,"__esModule",{value:!0}),i.AccessibilityManager=void 0;const h=c(9042),b=c(9924),E=c(844),N=c(4725),_=c(2585),u=c(3656);let p=i.AccessibilityManager=class extends E.Disposable{constructor(m,f,x,j){super(),this._terminal=m,this._coreBrowserService=x,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 T=0;T<this._terminal.rows;T++)this._rowElements[T]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[T]);if(this._topBoundaryFocusListener=T=>this._handleBoundaryFocus(T,0),this._bottomBoundaryFocusListener=T=>this._handleBoundaryFocus(T,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((T=>this._handleResize(T.rows)))),this.register(this._terminal.onRender((T=>this._refreshRows(T.start,T.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((T=>this._handleChar(T)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
|
|
116
|
-
`)))),this.register(this._terminal.onA11yTab((T=>this._handleTab(T)))),this.register(this._terminal.onKey((T=>this._handleKey(T.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,u.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,E.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(m){for(let f=0;f<m;f++)this._handleChar(" ")}_handleChar(m){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==m&&(this._charsToAnnounce+=m):this._charsToAnnounce+=m,m===`
|
|
117
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=h.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(m){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(m)||this._charsToConsume.push(m)}_refreshRows(m,f){this._liveRegionDebouncer.refresh(m,f,this._terminal.rows)}_renderRows(m,f){const x=this._terminal.buffer,j=x.lines.length.toString();for(let T=m;T<=f;T++){const R=x.lines.get(x.ydisp+T),S=[],L=(R==null?void 0:R.translateToString(!0,void 0,void 0,S))||"",I=(x.ydisp+T+1).toString(),B=this._rowElements[T];B&&(L.length===0?(B.innerText=" ",this._rowColumns.set(B,[0,1])):(B.textContent=L,this._rowColumns.set(B,S)),B.setAttribute("aria-posinset",I),B.setAttribute("aria-setsize",j))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(m,f){const x=m.target,j=this._rowElements[f===0?1:this._rowElements.length-2];if(x.getAttribute("aria-posinset")===(f===0?"1":`${this._terminal.buffer.lines.length}`)||m.relatedTarget!==j)return;let T,R;if(f===0?(T=x,R=this._rowElements.pop(),this._rowContainer.removeChild(R)):(T=this._rowElements.shift(),R=x,this._rowContainer.removeChild(T)),T.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(),m.preventDefault(),m.stopImmediatePropagation()}_handleSelectionChange(){var L;if(this._rowElements.length===0)return;const m=document.getSelection();if(!m)return;if(m.isCollapsed)return void(this._rowContainer.contains(m.anchorNode)&&this._terminal.clearSelection());if(!m.anchorNode||!m.focusNode)return void console.error("anchorNode and/or focusNode are null");let f={node:m.anchorNode,offset:m.anchorOffset},x={node:m.focusNode,offset:m.focusOffset};if((f.node.compareDocumentPosition(x.node)&Node.DOCUMENT_POSITION_PRECEDING||f.node===x.node&&f.offset>x.offset)&&([f,x]=[x,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(x.node.compareDocumentPosition(j)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(x={node:j,offset:((L=j.textContent)==null?void 0:L.length)??0}),!this._rowContainer.contains(x.node))return;const T=({node:I,offset:B})=>{const F=I instanceof Text?I.parentNode:I;let D=parseInt(F==null?void 0:F.getAttribute("aria-posinset"),10)-1;if(isNaN(D))return console.warn("row is invalid. Race condition?"),null;const H=this._rowColumns.get(F);if(!H)return console.warn("columns is null. Race condition?"),null;let W=B<H.length?H[B]:H.slice(-1)[0]+1;return W>=this._terminal.cols&&(++D,W=0),{row:D,column:W}},R=T(f),S=T(x);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(m){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>m;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const m=this._coreBrowserService.mainDocument.createElement("div");return m.setAttribute("role","listitem"),m.tabIndex=-1,this._refreshRowDimensions(m),m}_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 m=0;m<this._terminal.rows;m++)this._refreshRowDimensions(this._rowElements[m])}}_refreshRowDimensions(m){m.style.height=`${this._renderService.dimensions.css.cell.height}px`}};i.AccessibilityManager=p=g([v(1,_.IInstantiationService),v(2,N.ICoreBrowserService),v(3,N.IRenderService)],p)},3614:(y,i)=>{function c(b){return b.replace(/\r?\n/g,"\r")}function g(b,E){return E?"\x1B[200~"+b+"\x1B[201~":b}function v(b,E,N,_){b=g(b=c(b),N.decPrivateModes.bracketedPasteMode&&_.rawOptions.ignoreBracketedPasteMode!==!0),N.triggerDataEvent(b,!0),E.value=""}function h(b,E,N){const _=N.getBoundingClientRect(),u=b.clientX-_.left-10,p=b.clientY-_.top-10;E.style.width="20px",E.style.height="20px",E.style.left=`${u}px`,E.style.top=`${p}px`,E.style.zIndex="1000",E.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=g,i.copyHandler=function(b,E){b.clipboardData&&b.clipboardData.setData("text/plain",E.selectionText),b.preventDefault()},i.handlePasteEvent=function(b,E,N,_){b.stopPropagation(),b.clipboardData&&v(b.clipboardData.getData("text/plain"),E,N,_)},i.paste=v,i.moveTextAreaUnderMouseCursor=h,i.rightClickHandler=function(b,E,N,_,u){h(b,E,N),u&&_.rightClickSelect(b),E.value=_.selectionText,E.select()}},7239:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ColorContrastCache=void 0;const g=c(1505);i.ColorContrastCache=class{constructor(){this._color=new g.TwoKeyMap,this._css=new g.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,g,v,h){c.addEventListener(g,v,h);let b=!1;return{dispose:()=>{b||(b=!0,c.removeEventListener(g,v,h))}}}},3551:function(y,i,c){var g=this&&this.__decorate||function(p,m,f,x){var j,T=arguments.length,R=T<3?m:x===null?x=Object.getOwnPropertyDescriptor(m,f):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(p,m,f,x);else for(var S=p.length-1;S>=0;S--)(j=p[S])&&(R=(T<3?j(R):T>3?j(m,f,R):j(m,f))||R);return T>3&&R&&Object.defineProperty(m,f,R),R},v=this&&this.__param||function(p,m){return function(f,x){m(f,x,p)}};Object.defineProperty(i,"__esModule",{value:!0}),i.Linkifier=void 0;const h=c(3656),b=c(8460),E=c(844),N=c(2585),_=c(4725);let u=i.Linkifier=class extends E.Disposable{get currentLink(){return this._currentLink}constructor(p,m,f,x,j){super(),this._element=p,this._mouseService=m,this._renderService=f,this._bufferService=x,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,E.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,E.toDisposable)((()=>{var T;this._lastMouseEvent=void 0,(T=this._activeProviderReplies)==null||T.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(p){this._lastMouseEvent=p;const m=this._positionFromMouseEvent(p,this._element,this._mouseService);if(!m)return;this._isMouseOut=!1;const f=p.composedPath();for(let x=0;x<f.length;x++){const j=f[x];if(j.classList.contains("xterm"))break;if(j.classList.contains("xterm-hover"))return}this._lastBufferCell&&m.x===this._lastBufferCell.x&&m.y===this._lastBufferCell.y||(this._handleHover(m),this._lastBufferCell=m)}_handleHover(p){if(this._activeLine!==p.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(p,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,p)||(this._clearCurrentLink(),this._askForLink(p,!0))}_askForLink(p,m){var x,j;this._activeProviderReplies&&m||((x=this._activeProviderReplies)==null||x.forEach((T=>{T==null||T.forEach((R=>{R.link.dispose&&R.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=p.y);let f=!1;for(const[T,R]of this._linkProviderService.linkProviders.entries())m?(j=this._activeProviderReplies)!=null&&j.get(T)&&(f=this._checkLinkProviderResult(T,p,f)):R.provideLinks(p.y,(S=>{var I,B;if(this._isMouseOut)return;const L=S==null?void 0:S.map((F=>({link:F})));(I=this._activeProviderReplies)==null||I.set(T,L),f=this._checkLinkProviderResult(T,p,f),((B=this._activeProviderReplies)==null?void 0:B.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(p.y,this._activeProviderReplies)}))}_removeIntersectingLinks(p,m){const f=new Set;for(let x=0;x<m.size;x++){const j=m.get(x);if(j)for(let T=0;T<j.length;T++){const R=j[T],S=R.link.range.start.y<p?0:R.link.range.start.x,L=R.link.range.end.y>p?this._bufferService.cols:R.link.range.end.x;for(let I=S;I<=L;I++){if(f.has(I)){j.splice(T--,1);break}f.add(I)}}}}_checkLinkProviderResult(p,m,f){var T;if(!this._activeProviderReplies)return f;const x=this._activeProviderReplies.get(p);let j=!1;for(let R=0;R<p;R++)this._activeProviderReplies.has(R)&&!this._activeProviderReplies.get(R)||(j=!0);if(!j&&x){const R=x.find((S=>this._linkAtPosition(S.link,m)));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=(T=this._activeProviderReplies.get(R))==null?void 0:T.find((L=>this._linkAtPosition(L.link,m)));if(S){f=!0,this._handleNewLink(S);break}}return f}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(p){if(!this._currentLink)return;const m=this._positionFromMouseEvent(p,this._element,this._mouseService);m&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,m)&&this._currentLink.link.activate(p,this._currentLink.link.text)}_clearCurrentLink(p,m){this._currentLink&&this._lastMouseEvent&&(!p||!m||this._currentLink.link.range.start.y>=p&&this._currentLink.link.range.end.y<=m)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,E.disposeArray)(this._linkCacheDisposables))}_handleNewLink(p){if(!this._lastMouseEvent)return;const m=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);m&&this._linkAtPosition(p.link,m)&&(this._currentLink=p,this._currentLink.state={decorations:{underline:p.link.decorations===void 0||p.link.decorations.underline,pointerCursor:p.link.decorations===void 0||p.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,p.link,this._lastMouseEvent),p.link.decorations={},Object.defineProperties(p.link.decorations,{pointerCursor:{get:()=>{var f,x;return(x=(f=this._currentLink)==null?void 0:f.state)==null?void 0:x.decorations.pointerCursor},set:f=>{var x;(x=this._currentLink)!=null&&x.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,x;return(x=(f=this._currentLink)==null?void 0:f.state)==null?void 0:x.decorations.underline},set:f=>{var x,j,T;(x=this._currentLink)!=null&&x.state&&((T=(j=this._currentLink)==null?void 0:j.state)==null?void 0:T.decorations.underline)!==f&&(this._currentLink.state.decorations.underline=f,this._currentLink.state.isHovered&&this._fireUnderlineEvent(p.link,f))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((f=>{if(!this._currentLink)return;const x=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>=x&&this._currentLink.link.range.end.y<=j&&(this._clearCurrentLink(x,j),this._lastMouseEvent)){const T=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);T&&this._askForLink(T,!1)}}))))}_linkHover(p,m,f){var x;(x=this._currentLink)!=null&&x.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(m,!0),this._currentLink.state.decorations.pointerCursor&&p.classList.add("xterm-cursor-pointer")),m.hover&&m.hover(f,m.text)}_fireUnderlineEvent(p,m){const f=p.range,x=this._bufferService.buffer.ydisp,j=this._createLinkUnderlineEvent(f.start.x-1,f.start.y-x-1,f.end.x,f.end.y-x-1,void 0);(m?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(j)}_linkLeave(p,m,f){var x;(x=this._currentLink)!=null&&x.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(m,!1),this._currentLink.state.decorations.pointerCursor&&p.classList.remove("xterm-cursor-pointer")),m.leave&&m.leave(f,m.text)}_linkAtPosition(p,m){const f=p.range.start.y*this._bufferService.cols+p.range.start.x,x=p.range.end.y*this._bufferService.cols+p.range.end.x,j=m.y*this._bufferService.cols+m.x;return f<=j&&j<=x}_positionFromMouseEvent(p,m,f){const x=f.getCoords(p,m,this._bufferService.cols,this._bufferService.rows);if(x)return{x:x[0],y:x[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(p,m,f,x,j){return{x1:p,y1:m,x2:f,y2:x,cols:this._bufferService.cols,fg:j}}};i.Linkifier=u=g([v(1,_.IMouseService),v(2,_.IRenderService),v(3,N.IBufferService),v(4,_.ILinkProviderService)],u)},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 g=this&&this.__decorate||function(_,u,p,m){var f,x=arguments.length,j=x<3?u:m===null?m=Object.getOwnPropertyDescriptor(u,p):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(_,u,p,m);else for(var T=_.length-1;T>=0;T--)(f=_[T])&&(j=(x<3?f(j):x>3?f(u,p,j):f(u,p))||j);return x>3&&j&&Object.defineProperty(u,p,j),j},v=this&&this.__param||function(_,u){return function(p,m){u(p,m,_)}};Object.defineProperty(i,"__esModule",{value:!0}),i.OscLinkProvider=void 0;const h=c(511),b=c(2585);let E=i.OscLinkProvider=class{constructor(_,u,p){this._bufferService=_,this._optionsService=u,this._oscLinkService=p}provideLinks(_,u){var L;const p=this._bufferService.buffer.lines.get(_-1);if(!p)return void u(void 0);const m=[],f=this._optionsService.rawOptions.linkHandler,x=new h.CellData,j=p.getTrimmedLength();let T=-1,R=-1,S=!1;for(let I=0;I<j;I++)if(R!==-1||p.hasContent(I)){if(p.loadCell(I,x),x.hasExtendedAttrs()&&x.extended.urlId){if(R===-1){R=I,T=x.extended.urlId;continue}S=x.extended.urlId!==T}else R!==-1&&(S=!0);if(S||R!==-1&&I===j-1){const B=(L=this._oscLinkService.getLinkData(T))==null?void 0:L.uri;if(B){const F={start:{x:R+1,y:_},end:{x:I+(S||I!==j-1?0:1),y:_}};let D=!1;if(!(f!=null&&f.allowNonHttpProtocols))try{const H=new URL(B);["http:","https:"].includes(H.protocol)||(D=!0)}catch{D=!0}D||m.push({text:B,range:F,activate:(H,W)=>f?f.activate(H,W,F):N(0,W),hover:(H,W)=>{var G;return(G=f==null?void 0:f.hover)==null?void 0:G.call(f,H,W,F)},leave:(H,W)=>{var G;return(G=f==null?void 0:f.leave)==null?void 0:G.call(f,H,W,F)}})}S=!1,x.hasExtendedAttrs()&&x.extended.urlId?(R=I,T=x.extended.urlId):(R=-1,T=-1)}}u(m)}};function N(_,u){if(confirm(`Do you want to navigate to ${u}?
|
|
118
|
-
|
|
119
|
-
WARNING: This link could potentially be dangerous`)){const p=window.open();if(p){try{p.opener=null}catch{}p.location.href=u}else console.warn("Opening link blocked as opener could not be cleared")}}i.OscLinkProvider=E=g([v(0,b.IBufferService),v(1,b.IOptionsService),v(2,b.IOscLinkService)],E)},6193:(y,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.RenderDebouncer=void 0,i.RenderDebouncer=class{constructor(c,g){this._renderCallback=c,this._coreBrowserService=g,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,g,v){this._rowCount=v,c=c!==void 0?c:0,g=g!==void 0?g: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,g):g,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),g=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(c,g),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 g=c(3614),v=c(3656),h=c(3551),b=c(9042),E=c(3730),N=c(1680),_=c(3107),u=c(5744),p=c(2950),m=c(1296),f=c(428),x=c(4269),j=c(5114),T=c(8934),R=c(3230),S=c(9312),L=c(4725),I=c(6731),B=c(8055),F=c(8969),D=c(8460),H=c(844),W=c(6114),G=c(8437),Y=c(2584),z=c(7399),P=c(5941),U=c(9074),$=c(2585),K=c(5435),te=c(4567),oe=c(779);class we extends F.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 H.MutableDisposable),this._onCursorMove=this.register(new D.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new D.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new D.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new D.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new D.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new D.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new D.EventEmitter),this._onBlur=this.register(new D.EventEmitter),this._onA11yCharEmitter=this.register(new D.EventEmitter),this._onA11yTabEmitter=this.register(new D.EventEmitter),this._onWillOpen=this.register(new D.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(U.DecorationService),this._instantiationService.setService($.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(oe.LinkProviderService),this._instantiationService.setService(L.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(E.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((V,Z)=>this.refresh(V,Z)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((V=>this._reportWindowsOptions(V)))),this.register(this._inputHandler.onColor((V=>this._handleColorEvent(V)))),this.register((0,D.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,D.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,D.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,D.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((V=>this._afterResize(V.cols,V.rows)))),this.register((0,H.toDisposable)((()=>{var V,Z;this._customKeyEventHandler=void 0,(Z=(V=this.element)==null?void 0:V.parentNode)==null||Z.removeChild(this.element)})))}_handleColorEvent(X){if(this._themeService)for(const V of X){let Z,ee="";switch(V.index){case 256:Z="foreground",ee="10";break;case 257:Z="background",ee="11";break;case 258:Z="cursor",ee="12";break;default:Z="ansi",ee="4;"+V.index}switch(V.type){case 0:const ve=B.color.toColorRGB(Z==="ansi"?this._themeService.colors.ansi[V.index]:this._themeService.colors[Z]);this.coreService.triggerDataEvent(`${Y.C0.ESC}]${ee};${(0,P.toRgbString)(ve)}${Y.C1_ESCAPED.ST}`);break;case 1:if(Z==="ansi")this._themeService.modifyColors((Se=>Se.ansi[V.index]=B.channels.toColor(...V.color)));else{const Se=Z;this._themeService.modifyColors((Ie=>Ie[Se]=B.channels.toColor(...V.color)))}break;case 2:this._themeService.restoreColor(V.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,V=this.buffer.lines.get(X);if(!V)return;const Z=Math.min(this.buffer.x,this.cols-1),ee=this._renderService.dimensions.css.cell.height,ve=V.getWidth(Z),Se=this._renderService.dimensions.css.cell.width*ve,Ie=this.buffer.y*this._renderService.dimensions.css.cell.height,je=Z*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=ee+"px",this.textarea.style.lineHeight=ee+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,v.addDisposableDomListener)(this.element,"copy",(V=>{this.hasSelection()&&(0,g.copyHandler)(V,this._selectionService)})));const X=V=>(0,g.handlePasteEvent)(V,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",(V=>{V.button===2&&(0,g.rightClickHandler)(V,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,v.addDisposableDomListener)(this.element,"contextmenu",(V=>{(0,g.rightClickHandler)(V,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),W.isLinux&&this.register((0,v.addDisposableDomListener)(this.element,"auxclick",(V=>{V.button===1&&(0,g.moveTextAreaUnderMouseCursor)(V,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 Z;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"),((Z=this.element)==null?void 0:Z.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 V=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),V.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",(ee=>this.updateCursorStyle(ee)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),V.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",(ee=>this._handleTextAreaFocus(ee)))),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(x.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((ee=>this._onRender.fire(ee)))),this.onResize((ee=>this._renderService.resize(ee.cols,ee.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(p.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(T.MouseService),this._instantiationService.setService(L.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(h.Linkifier,this.screenElement)),this.element.appendChild(V);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((ee=>this.scrollLines(ee.amount,ee.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((ee=>this.scrollLines(ee.amount,ee.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((ee=>this._renderService.handleSelectionChanged(ee.start,ee.end,ee.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((ee=>{this.textarea.value=ee,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((ee=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,v.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(_.BufferDecorationRenderer,this.screenElement)),this.register((0,v.addDisposableDomListener)(this.element,"mousedown",(ee=>this._selectionService.handleMouseDown(ee)))),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",(ee=>this._handleScreenReaderModeOptionChange(ee)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(u.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(ee=>{!this._overviewRulerRenderer&&ee&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(u.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(m.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const X=this,V=this.element;function Z(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 ee={mouseup:null,wheel:null,mousedrag:null,mousemove:null},ve={mouseup:Se=>(Z(Se),Se.buttons||(this._document.removeEventListener("mouseup",ee.mouseup),ee.mousedrag&&this._document.removeEventListener("mousemove",ee.mousedrag)),this.cancel(Se)),wheel:Se=>(Z(Se),this.cancel(Se,!0)),mousedrag:Se=>{Se.buttons&&Z(Se)},mousemove:Se=>{Se.buttons||Z(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?ee.mousemove||(V.addEventListener("mousemove",ve.mousemove),ee.mousemove=ve.mousemove):(V.removeEventListener("mousemove",ee.mousemove),ee.mousemove=null),16&Se?ee.wheel||(V.addEventListener("wheel",ve.wheel,{passive:!1}),ee.wheel=ve.wheel):(V.removeEventListener("wheel",ee.wheel),ee.wheel=null),2&Se?ee.mouseup||(ee.mouseup=ve.mouseup):(this._document.removeEventListener("mouseup",ee.mouseup),ee.mouseup=null),4&Se?ee.mousedrag||(ee.mousedrag=ve.mousedrag):(this._document.removeEventListener("mousemove",ee.mousedrag),ee.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,v.addDisposableDomListener)(V,"mousedown",(Se=>{if(Se.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(Se))return Z(Se),ee.mouseup&&this._document.addEventListener("mouseup",ee.mouseup),ee.mousedrag&&this._document.addEventListener("mousemove",ee.mousedrag),this.cancel(Se)}))),this.register((0,v.addDisposableDomListener)(V,"wheel",(Se=>{if(!ee.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 Ze=0;Ze<Math.abs(Ie);Ze++)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)(V,"touchstart",(Se=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(Se),this.cancel(Se)}),{passive:!0})),this.register((0,v.addDisposableDomListener)(V,"touchmove",(Se=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(Se)?void 0:this.cancel(Se)}),{passive:!1}))}refresh(X,V){var Z;(Z=this._renderService)==null||Z.refreshRows(X,V)}updateCursorStyle(X){var V;(V=this._selectionService)!=null&&V.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,V,Z=0){var ee;Z===1?(super.scrollLines(X,V,Z),this.refresh(0,this.rows-1)):(ee=this.viewport)==null||ee.scrollLines(X)}paste(X){(0,g.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 V=this._characterJoinerService.register(X);return this.refresh(0,this.rows-1),V}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,V,Z){this._selectionService.setSelection(X,V,Z)}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,V){var Z;(Z=this._selectionService)==null||Z.selectLines(X,V)}_keyDown(X){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1)return!1;const V=this.browser.isMac&&this.options.macOptionIsMeta&&X.altKey;if(!V&&!this._compositionHelper.keydown(X))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;V||X.key!=="Dead"&&X.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const Z=(0,z.evaluateKeyboardEvent)(X,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(X),Z.type===3||Z.type===2){const ee=this.rows-1;return this.scrollLines(Z.type===2?-ee:ee),this.cancel(X,!0)}return Z.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,X)||(Z.cancel&&this.cancel(X,!0),!Z.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):(Z.key!==Y.C0.ETX&&Z.key!==Y.C0.CR||(this.textarea.value=""),this._onKey.fire({key:Z.key,domEvent:X}),this._showCursor(),this.coreService.triggerDataEvent(Z.key,!0),!this.optionsService.rawOptions.screenReaderMode||X.altKey||X.ctrlKey?this.cancel(X,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(X,V){const Z=X.isMac&&!this.options.macOptionIsMeta&&V.altKey&&!V.ctrlKey&&!V.metaKey||X.isWindows&&V.altKey&&V.ctrlKey&&!V.metaKey||X.isWindows&&V.getModifierState("AltGraph");return V.type==="keypress"?Z:Z&&(!V.keyCode||V.keyCode>47)}_keyUp(X){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1||((function(V){return V.keyCode===16||V.keyCode===17||V.keyCode===18})(X)||this.focus(),this.updateCursorStyle(X),this._keyPressHandled=!1)}_keyPress(X){let V;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1)return!1;if(this.cancel(X),X.charCode)V=X.charCode;else if(X.which===null||X.which===void 0)V=X.keyCode;else{if(X.which===0||X.charCode===0)return!1;V=X.which}return!(!V||(X.altKey||X.ctrlKey||X.metaKey)&&!this._isThirdLevelShift(this.browser,X)||(V=String.fromCharCode(V),this._onKey.fire({key:V,domEvent:X}),this._showCursor(),this.coreService.triggerDataEvent(V,!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 V=X.data;return this.coreService.triggerDataEvent(V,!0),this.cancel(X),!0}return!1}resize(X,V){X!==this.cols||V!==this.rows?super.resize(X,V):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(X,V){var Z,ee;(Z=this._charSizeService)==null||Z.measure(),(ee=this.viewport)==null||ee.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 V=1;V<this.rows;V++)this.buffer.lines.push(this.buffer.getBlankLine(G.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 V,Z;this.options.rows=this.rows,this.options.cols=this.cols;const X=this._customKeyEventHandler;this._setup(),super.reset(),(V=this._selectionService)==null||V.reset(),this._decorationService.reset(),(Z=this.viewport)==null||Z.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 K.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const V=this._renderService.dimensions.css.canvas.width.toFixed(0),Z=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${Y.C0.ESC}[4;${Z};${V}t`);break;case K.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const ee=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};${ee}t`)}}cancel(X,V){if(this.options.cancelEvents||V)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,g=1e3){this._renderCallback=c,this._debounceThresholdMS=g,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(c,g,v){this._rowCount=v,c=c!==void 0?c:0,g=g!==void 0?g: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,g):g;const h=Date.now();if(h-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=h,this._innerRefresh();else if(!this._additionalRefreshRequested){const b=h-this._lastRefreshMs,E=this._debounceThresholdMS-b;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),E)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const c=Math.max(this._rowStart,0),g=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(c,g)}}},1680:function(y,i,c){var g=this&&this.__decorate||function(p,m,f,x){var j,T=arguments.length,R=T<3?m:x===null?x=Object.getOwnPropertyDescriptor(m,f):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(p,m,f,x);else for(var S=p.length-1;S>=0;S--)(j=p[S])&&(R=(T<3?j(R):T>3?j(m,f,R):j(m,f))||R);return T>3&&R&&Object.defineProperty(m,f,R),R},v=this&&this.__param||function(p,m){return function(f,x){m(f,x,p)}};Object.defineProperty(i,"__esModule",{value:!0}),i.Viewport=void 0;const h=c(3656),b=c(4725),E=c(8460),N=c(844),_=c(2585);let u=i.Viewport=class extends N.Disposable{constructor(p,m,f,x,j,T,R,S){super(),this._viewportElement=p,this._scrollArea=m,this._bufferService=f,this._optionsService=x,this._charSizeService=j,this._renderService=T,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 E.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(p){this._viewportElement.style.backgroundColor=p.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(p){if(p)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 m=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==m&&(this._lastRecordedBufferHeight=m,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const p=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==p&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=p),this._refreshAnimationFrame=null}syncScrollArea(p=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(p);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(p)}_handleScroll(p){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 m=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:m,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const p=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(p*(this._smoothScrollState.target-this._smoothScrollState.origin)),p<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(p,m){const f=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(m<0&&this._viewportElement.scrollTop!==0||m>0&&f<this._lastRecordedBufferHeight)||(p.cancelable&&p.preventDefault(),!1)}handleWheel(p){const m=this._getPixelsScrolled(p);return m!==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+m:this._smoothScrollState.target+=m,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=m,this._bubbleScroll(p,m))}scrollLines(p){if(p!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const m=p*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+m,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:p,suppressScrollEvent:!1})}_getPixelsScrolled(p){if(p.deltaY===0||p.shiftKey)return 0;let m=this._applyScrollModifier(p.deltaY,p);return p.deltaMode===WheelEvent.DOM_DELTA_LINE?m*=this._currentRowHeight:p.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(m*=this._currentRowHeight*this._bufferService.rows),m}getBufferElements(p,m){var S;let f,x="";const j=[],T=m??this._bufferService.buffer.lines.length,R=this._bufferService.buffer.lines;for(let L=p;L<T;L++){const I=R.get(L);if(!I)continue;const B=(S=R.get(L+1))==null?void 0:S.isWrapped;if(x+=I.translateToString(!B),!B||L===R.length-1){const F=document.createElement("div");F.textContent=x,j.push(F),x.length>0&&(f=F),x=""}}return{bufferElements:j,cursorElement:f}}getLinesScrolled(p){if(p.deltaY===0||p.shiftKey)return 0;let m=this._applyScrollModifier(p.deltaY,p);return p.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(m/=this._currentRowHeight+0,this._wheelPartialScroll+=m,m=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):p.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(m*=this._bufferService.rows),m}_applyScrollModifier(p,m){const f=this._optionsService.rawOptions.fastScrollModifier;return f==="alt"&&m.altKey||f==="ctrl"&&m.ctrlKey||f==="shift"&&m.shiftKey?p*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:p*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(p){this._lastTouchY=p.touches[0].pageY}handleTouchMove(p){const m=this._lastTouchY-p.touches[0].pageY;return this._lastTouchY=p.touches[0].pageY,m!==0&&(this._viewportElement.scrollTop+=m,this._bubbleScroll(p,m))}};i.Viewport=u=g([v(2,_.IBufferService),v(3,_.IOptionsService),v(4,b.ICharSizeService),v(5,b.IRenderService),v(6,b.ICoreBrowserService),v(7,b.IThemeService)],u)},3107:function(y,i,c){var g=this&&this.__decorate||function(_,u,p,m){var f,x=arguments.length,j=x<3?u:m===null?m=Object.getOwnPropertyDescriptor(u,p):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(_,u,p,m);else for(var T=_.length-1;T>=0;T--)(f=_[T])&&(j=(x<3?f(j):x>3?f(u,p,j):f(u,p))||j);return x>3&&j&&Object.defineProperty(u,p,j),j},v=this&&this.__param||function(_,u){return function(p,m){u(p,m,_)}};Object.defineProperty(i,"__esModule",{value:!0}),i.BufferDecorationRenderer=void 0;const h=c(4725),b=c(844),E=c(2585);let N=i.BufferDecorationRenderer=class extends b.Disposable{constructor(_,u,p,m,f){super(),this._screenElement=_,this._bufferService=u,this._coreBrowserService=p,this._decorationService=m,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((x=>this._removeDecoration(x)))),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 _ of this._decorationService.decorations)this._renderDecoration(_);this._dimensionsChanged=!1}_renderDecoration(_){this._refreshStyle(_),this._dimensionsChanged&&this._refreshXPosition(_)}_createElement(_){var m;const u=this._coreBrowserService.mainDocument.createElement("div");u.classList.add("xterm-decoration"),u.classList.toggle("xterm-decoration-top-layer",((m=_==null?void 0:_.options)==null?void 0:m.layer)==="top"),u.style.width=`${Math.round((_.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,u.style.height=(_.options.height||1)*this._renderService.dimensions.css.cell.height+"px",u.style.top=(_.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",u.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const p=_.options.x??0;return p&&p>this._bufferService.cols&&(u.style.display="none"),this._refreshXPosition(_,u),u}_refreshStyle(_){const u=_.marker.line-this._bufferService.buffers.active.ydisp;if(u<0||u>=this._bufferService.rows)_.element&&(_.element.style.display="none",_.onRenderEmitter.fire(_.element));else{let p=this._decorationElements.get(_);p||(p=this._createElement(_),_.element=p,this._decorationElements.set(_,p),this._container.appendChild(p),_.onDispose((()=>{this._decorationElements.delete(_),p.remove()}))),p.style.top=u*this._renderService.dimensions.css.cell.height+"px",p.style.display=this._altBufferIsActive?"none":"block",_.onRenderEmitter.fire(p)}}_refreshXPosition(_,u=_.element){if(!u)return;const p=_.options.x??0;(_.options.anchor||"left")==="right"?u.style.right=p?p*this._renderService.dimensions.css.cell.width+"px":"":u.style.left=p?p*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(_){var u;(u=this._decorationElements.get(_))==null||u.remove(),this._decorationElements.delete(_),_.dispose()}};i.BufferDecorationRenderer=N=g([v(1,E.IBufferService),v(2,h.ICoreBrowserService),v(3,E.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 g of this._zones)if(g.color===c.options.overviewRulerOptions.color&&g.position===c.options.overviewRulerOptions.position){if(this._lineIntersectsZone(g,c.marker.line))return;if(this._lineAdjacentToZone(g,c.marker.line,c.options.overviewRulerOptions.position))return void this._addLineToZone(g,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,g){return g>=c.startBufferLine&&g<=c.endBufferLine}_lineAdjacentToZone(c,g,v){return g>=c.startBufferLine-this._linePadding[v||"full"]&&g<=c.endBufferLine+this._linePadding[v||"full"]}_addLineToZone(c,g){c.startBufferLine=Math.min(c.startBufferLine,g),c.endBufferLine=Math.max(c.endBufferLine,g)}}},5744:function(y,i,c){var g=this&&this.__decorate||function(f,x,j,T){var R,S=arguments.length,L=S<3?x:T===null?T=Object.getOwnPropertyDescriptor(x,j):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(f,x,j,T);else for(var I=f.length-1;I>=0;I--)(R=f[I])&&(L=(S<3?R(L):S>3?R(x,j,L):R(x,j))||L);return S>3&&L&&Object.defineProperty(x,j,L),L},v=this&&this.__param||function(f,x){return function(j,T){x(j,T,f)}};Object.defineProperty(i,"__esModule",{value:!0}),i.OverviewRulerRenderer=void 0;const h=c(5871),b=c(4725),E=c(844),N=c(2585),_={full:0,left:0,center:0,right:0},u={full:0,left:0,center:0,right:0},p={full:0,left:0,center:0,right:0};let m=i.OverviewRulerRenderer=class extends E.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(f,x,j,T,R,S,L){var B;super(),this._viewportElement=f,this._screenElement=x,this._bufferService=j,this._decorationService=T,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(),(B=this._viewportElement.parentElement)==null||B.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,E.toDisposable)((()=>{var F;(F=this._canvas)==null||F.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),x=Math.ceil(this._canvas.width/3);u.full=this._canvas.width,u.left=f,u.center=x,u.right=f,this._refreshDrawHeightConstants(),p.full=0,p.left=0,p.center=u.left,p.right=u.left+u.center}_refreshDrawHeightConstants(){_.full=Math.round(2*this._coreBrowserService.dpr);const f=this._canvas.height/this._bufferService.buffer.lines.length,x=Math.round(Math.max(Math.min(f,12),6)*this._coreBrowserService.dpr);_.left=x,_.center=x,_.right=x}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_.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 x of this._decorationService.decorations)this._colorZoneStore.addDecoration(x);this._ctx.lineWidth=1;const f=this._colorZoneStore.zones;for(const x of f)x.position!=="full"&&this._renderColorZone(x);for(const x of f)x.position==="full"&&this._renderColorZone(x);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(f){this._ctx.fillStyle=f.color,this._ctx.fillRect(p[f.position||"full"],Math.round((this._canvas.height-1)*(f.startBufferLine/this._bufferService.buffers.active.lines.length)-_[f.position||"full"]/2),u[f.position||"full"],Math.round((this._canvas.height-1)*((f.endBufferLine-f.startBufferLine)/this._bufferService.buffers.active.lines.length)+_[f.position||"full"]))}_queueRefresh(f,x){this._shouldUpdateDimensions=f||this._shouldUpdateDimensions,this._shouldUpdateAnchor=x||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};i.OverviewRulerRenderer=m=g([v(2,N.IBufferService),v(3,N.IDecorationService),v(4,b.IRenderService),v(5,N.IOptionsService),v(6,b.ICoreBrowserService)],m)},2950:function(y,i,c){var g=this&&this.__decorate||function(_,u,p,m){var f,x=arguments.length,j=x<3?u:m===null?m=Object.getOwnPropertyDescriptor(u,p):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(_,u,p,m);else for(var T=_.length-1;T>=0;T--)(f=_[T])&&(j=(x<3?f(j):x>3?f(u,p,j):f(u,p))||j);return x>3&&j&&Object.defineProperty(u,p,j),j},v=this&&this.__param||function(_,u){return function(p,m){u(p,m,_)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CompositionHelper=void 0;const h=c(4725),b=c(2585),E=c(2584);let N=i.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(_,u,p,m,f,x){this._textarea=_,this._compositionView=u,this._bufferService=p,this._optionsService=m,this._coreService=f,this._renderService=x,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(_){this._compositionView.textContent=_.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(_){if(this._isComposing||this._isSendingComposition){if(_.keyCode===229||_.keyCode===16||_.keyCode===17||_.keyCode===18)return!1;this._finalizeComposition(!1)}return _.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(_){if(this._compositionView.classList.remove("active"),this._isComposing=!1,_){const u={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let p;this._isSendingComposition=!1,u.start+=this._dataAlreadySent.length,p=this._isComposing?this._textarea.value.substring(u.start,u.end):this._textarea.value.substring(u.start),p.length>0&&this._coreService.triggerDataEvent(p,!0)}}),0)}else{this._isSendingComposition=!1;const u=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(u,!0)}}_handleAnyTextareaChanges(){const _=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const u=this._textarea.value,p=u.replace(_,"");this._dataAlreadySent=p,u.length>_.length?this._coreService.triggerDataEvent(p,!0):u.length<_.length?this._coreService.triggerDataEvent(`${E.C0.DEL}`,!0):u.length===_.length&&u!==_&&this._coreService.triggerDataEvent(u,!0)}}),0)}updateCompositionElements(_){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const u=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),p=this._renderService.dimensions.css.cell.height,m=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,f=u*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=f+"px",this._compositionView.style.top=m+"px",this._compositionView.style.height=p+"px",this._compositionView.style.lineHeight=p+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const x=this._compositionView.getBoundingClientRect();this._textarea.style.left=f+"px",this._textarea.style.top=m+"px",this._textarea.style.width=Math.max(x.width,1)+"px",this._textarea.style.height=Math.max(x.height,1)+"px",this._textarea.style.lineHeight=x.height+"px"}_||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};i.CompositionHelper=N=g([v(2,b.IBufferService),v(3,b.IOptionsService),v(4,b.ICoreService),v(5,h.IRenderService)],N)},9806:(y,i)=>{function c(g,v,h){const b=h.getBoundingClientRect(),E=g.getComputedStyle(h),N=parseInt(E.getPropertyValue("padding-left")),_=parseInt(E.getPropertyValue("padding-top"));return[v.clientX-b.left-N,v.clientY-b.top-_]}Object.defineProperty(i,"__esModule",{value:!0}),i.getCoords=i.getCoordsRelativeToElement=void 0,i.getCoordsRelativeToElement=c,i.getCoords=function(g,v,h,b,E,N,_,u,p){if(!N)return;const m=c(g,v,h);return m?(m[0]=Math.ceil((m[0]+(p?_/2:0))/_),m[1]=Math.ceil(m[1]/u),m[0]=Math.min(Math.max(m[0],1),b+(p?1:0)),m[1]=Math.min(Math.max(m[1],1),E),m):void 0}},9504:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.moveToCellSequence=void 0;const g=c(2584);function v(u,p,m,f){const x=u-h(u,m),j=p-h(p,m),T=Math.abs(x-j)-(function(R,S,L){let I=0;const B=R-h(R,L),F=S-h(S,L);for(let D=0;D<Math.abs(B-F);D++){const H=b(R,S)==="A"?-1:1,W=L.buffer.lines.get(B+H*D);W!=null&&W.isWrapped&&I++}return I})(u,p,m);return _(T,N(b(u,p),f))}function h(u,p){let m=0,f=p.buffer.lines.get(u),x=f==null?void 0:f.isWrapped;for(;x&&u>=0&&u<p.rows;)m++,f=p.buffer.lines.get(--u),x=f==null?void 0:f.isWrapped;return m}function b(u,p){return u>p?"A":"B"}function E(u,p,m,f,x,j){let T=u,R=p,S="";for(;T!==m||R!==f;)T+=x?1:-1,x&&T>j.cols-1?(S+=j.buffer.translateBufferLineToString(R,!1,u,T),T=0,u=0,R++):!x&&T<0&&(S+=j.buffer.translateBufferLineToString(R,!1,0,u+1),T=j.cols-1,u=T,R--);return S+j.buffer.translateBufferLineToString(R,!1,u,T)}function N(u,p){const m=p?"O":"[";return g.C0.ESC+m+u}function _(u,p){u=Math.floor(u);let m="";for(let f=0;f<u;f++)m+=p;return m}i.moveToCellSequence=function(u,p,m,f){const x=m.buffer.x,j=m.buffer.y;if(!m.buffer.hasScrollback)return(function(S,L,I,B,F,D){return v(L,B,F,D).length===0?"":_(E(S,L,S,L-h(L,F),!1,F).length,N("D",D))})(x,j,0,p,m,f)+v(j,p,m,f)+(function(S,L,I,B,F,D){let H;H=v(L,B,F,D).length>0?B-h(B,F):L;const W=B,G=(function(Y,z,P,U,$,K){let te;return te=v(P,U,$,K).length>0?U-h(U,$):z,Y<P&&te<=U||Y>=P&&te<U?"C":"D"})(S,L,I,B,F,D);return _(E(S,H,I,W,G==="C",F).length,N(G,D))})(x,j,u,p,m,f);let T;if(j===p)return T=x>u?"D":"C",_(Math.abs(x-u),N(T,f));T=j>p?"D":"C";const R=Math.abs(j-p);return _((function(S,L){return L.cols-S})(j>p?u:x,m)+(R-1)*m.cols+1+((j>p?x:u)-1),N(T,f))}},1296:function(y,i,c){var g=this&&this.__decorate||function(D,H,W,G){var Y,z=arguments.length,P=z<3?H:G===null?G=Object.getOwnPropertyDescriptor(H,W):G;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")P=Reflect.decorate(D,H,W,G);else for(var U=D.length-1;U>=0;U--)(Y=D[U])&&(P=(z<3?Y(P):z>3?Y(H,W,P):Y(H,W))||P);return z>3&&P&&Object.defineProperty(H,W,P),P},v=this&&this.__param||function(D,H){return function(W,G){H(W,G,D)}};Object.defineProperty(i,"__esModule",{value:!0}),i.DomRenderer=void 0;const h=c(3787),b=c(2550),E=c(2223),N=c(6171),_=c(6052),u=c(4725),p=c(8055),m=c(8460),f=c(844),x=c(2585),j="xterm-dom-renderer-owner-",T="xterm-rows",R="xterm-fg-",S="xterm-bg-",L="xterm-focus",I="xterm-selection";let B=1,F=i.DomRenderer=class extends f.Disposable{constructor(D,H,W,G,Y,z,P,U,$,K,te,oe,we){super(),this._terminal=D,this._document=H,this._element=W,this._screenElement=G,this._viewportElement=Y,this._helperContainer=z,this._linkifier2=P,this._charSizeService=$,this._optionsService=K,this._bufferService=te,this._coreBrowserService=oe,this._themeService=we,this._terminalClass=B++,this._rowElements=[],this._selectionRenderModel=(0,_.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new m.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(T),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((me=>this._injectCss(me)))),this._injectCss(this._themeService.colors),this._rowFactory=U.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((me=>this._handleLinkHover(me)))),this.register(this._linkifier2.onHideLinkUnderline((me=>this._handleLinkLeave(me)))),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 D=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*D,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*D),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/D),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/D),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 H=`${this._terminalSelector} .${T} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=H,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(D){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let H=`${this._terminalSelector} .${T} { color: ${D.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;H+=`${this._terminalSelector} .${T} .xterm-dim { color: ${p.color.multiplyOpacity(D.foreground,.5).css};}`,H+=`${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}`,G=`blink_bar_${this._terminalClass}`,Y=`blink_block_${this._terminalClass}`;H+=`@keyframes ${W} { 50% { border-bottom-style: hidden; }}`,H+=`@keyframes ${G} { 50% { box-shadow: none; }}`,H+=`@keyframes ${Y} { 0% { background-color: ${D.cursor.css}; color: ${D.cursorAccent.css}; } 50% { background-color: inherit; color: ${D.cursor.css}; }}`,H+=`${this._terminalSelector} .${T}.${L} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${W} 1s step-end infinite;}${this._terminalSelector} .${T}.${L} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${G} 1s step-end infinite;}${this._terminalSelector} .${T}.${L} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${Y} 1s step-end infinite;}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-block { background-color: ${D.cursor.css}; color: ${D.cursorAccent.css};}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${D.cursor.css} !important; color: ${D.cursorAccent.css} !important;}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${D.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${D.cursor.css} inset;}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${D.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,H+=`${this._terminalSelector} .${I} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${I} div { position: absolute; background-color: ${D.selectionBackgroundOpaque.css};}${this._terminalSelector} .${I} div { position: absolute; background-color: ${D.selectionInactiveBackgroundOpaque.css};}`;for(const[z,P]of D.ansi.entries())H+=`${this._terminalSelector} .${R}${z} { color: ${P.css}; }${this._terminalSelector} .${R}${z}.xterm-dim { color: ${p.color.multiplyOpacity(P,.5).css}; }${this._terminalSelector} .${S}${z} { background-color: ${P.css}; }`;H+=`${this._terminalSelector} .${R}${E.INVERTED_DEFAULT_COLOR} { color: ${p.color.opaque(D.background).css}; }${this._terminalSelector} .${R}${E.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${p.color.multiplyOpacity(p.color.opaque(D.background),.5).css}; }${this._terminalSelector} .${S}${E.INVERTED_DEFAULT_COLOR} { background-color: ${D.foreground.css}; }`,this._themeStyleElement.textContent=H}_setDefaultSpacing(){const D=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${D}px`,this._rowFactory.defaultSpacing=D}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(D,H){for(let W=this._rowElements.length;W<=H;W++){const G=this._document.createElement("div");this._rowContainer.appendChild(G),this._rowElements.push(G)}for(;this._rowElements.length>H;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(D,H){this._refreshRowElements(D,H),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(D,H,W){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(D,H,W),this.renderRows(0,this._bufferService.rows-1),!D||!H)return;this._selectionRenderModel.update(this._terminal,D,H,W);const G=this._selectionRenderModel.viewportStartRow,Y=this._selectionRenderModel.viewportEndRow,z=this._selectionRenderModel.viewportCappedStartRow,P=this._selectionRenderModel.viewportCappedEndRow;if(z>=this._bufferService.rows||P<0)return;const U=this._document.createDocumentFragment();if(W){const $=D[0]>H[0];U.appendChild(this._createSelectionElement(z,$?H[0]:D[0],$?D[0]:H[0],P-z+1))}else{const $=G===z?D[0]:0,K=z===Y?H[0]:this._bufferService.cols;U.appendChild(this._createSelectionElement(z,$,K));const te=P-z-1;if(U.appendChild(this._createSelectionElement(z+1,0,this._bufferService.cols,te)),z!==P){const oe=Y===P?H[0]:this._bufferService.cols;U.appendChild(this._createSelectionElement(P,0,oe))}}this._selectionContainer.appendChild(U)}_createSelectionElement(D,H,W,G=1){const Y=this._document.createElement("div"),z=H*this.dimensions.css.cell.width;let P=this.dimensions.css.cell.width*(W-H);return z+P>this.dimensions.css.canvas.width&&(P=this.dimensions.css.canvas.width-z),Y.style.height=G*this.dimensions.css.cell.height+"px",Y.style.top=D*this.dimensions.css.cell.height+"px",Y.style.left=`${z}px`,Y.style.width=`${P}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 D of this._rowElements)D.replaceChildren()}renderRows(D,H){const W=this._bufferService.buffer,G=W.ybase+W.y,Y=Math.min(W.x,this._bufferService.cols-1),z=this._optionsService.rawOptions.cursorBlink,P=this._optionsService.rawOptions.cursorStyle,U=this._optionsService.rawOptions.cursorInactiveStyle;for(let $=D;$<=H;$++){const K=$+W.ydisp,te=this._rowElements[$],oe=W.lines.get(K);if(!te||!oe)break;te.replaceChildren(...this._rowFactory.createRow(oe,K,K===G,P,U,Y,z,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${j}${this._terminalClass}`}_handleLinkHover(D){this._setCellUnderline(D.x1,D.x2,D.y1,D.y2,D.cols,!0)}_handleLinkLeave(D){this._setCellUnderline(D.x1,D.x2,D.y1,D.y2,D.cols,!1)}_setCellUnderline(D,H,W,G,Y,z){W<0&&(D=0),G<0&&(H=0);const P=this._bufferService.rows-1;W=Math.max(Math.min(W,P),0),G=Math.max(Math.min(G,P),0),Y=Math.min(Y,this._bufferService.cols);const U=this._bufferService.buffer,$=U.ybase+U.y,K=Math.min(U.x,Y-1),te=this._optionsService.rawOptions.cursorBlink,oe=this._optionsService.rawOptions.cursorStyle,we=this._optionsService.rawOptions.cursorInactiveStyle;for(let me=W;me<=G;++me){const X=me+U.ydisp,V=this._rowElements[me],Z=U.lines.get(X);if(!V||!Z)break;V.replaceChildren(...this._rowFactory.createRow(Z,X,X===$,oe,we,K,te,this.dimensions.css.cell.width,this._widthCache,z?me===W?D:0:-1,z?(me===G?H:Y)-1:-1))}}};i.DomRenderer=F=g([v(7,x.IInstantiationService),v(8,u.ICharSizeService),v(9,x.IOptionsService),v(10,x.IBufferService),v(11,u.ICoreBrowserService),v(12,u.IThemeService)],F)},3787:function(y,i,c){var g=this&&this.__decorate||function(T,R,S,L){var I,B=arguments.length,F=B<3?R:L===null?L=Object.getOwnPropertyDescriptor(R,S):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")F=Reflect.decorate(T,R,S,L);else for(var D=T.length-1;D>=0;D--)(I=T[D])&&(F=(B<3?I(F):B>3?I(R,S,F):I(R,S))||F);return B>3&&F&&Object.defineProperty(R,S,F),F},v=this&&this.__param||function(T,R){return function(S,L){R(S,L,T)}};Object.defineProperty(i,"__esModule",{value:!0}),i.DomRendererRowFactory=void 0;const h=c(2223),b=c(643),E=c(511),N=c(2585),_=c(8055),u=c(4725),p=c(4269),m=c(6171),f=c(3734);let x=i.DomRendererRowFactory=class{constructor(T,R,S,L,I,B,F){this._document=T,this._characterJoinerService=R,this._optionsService=S,this._coreBrowserService=L,this._coreService=I,this._decorationService=B,this._themeService=F,this._workCell=new E.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(T,R,S){this._selectionStart=T,this._selectionEnd=R,this._columnSelectMode=S}createRow(T,R,S,L,I,B,F,D,H,W,G){const Y=[],z=this._characterJoinerService.getJoinedCharacters(R),P=this._themeService.colors;let U,$=T.getNoBgTrimmedLength();S&&$<B+1&&($=B+1);let K=0,te="",oe=0,we=0,me=0,X=!1,V=0,Z=!1,ee=0;const ve=[],Se=W!==-1&&G!==-1;for(let Ie=0;Ie<$;Ie++){T.loadCell(Ie,this._workCell);let je=this._workCell.getWidth();if(je===0)continue;let Je=!1,Ze=Ie,Ae=this._workCell;if(z.length>0&&Ie===z[0][0]){Je=!0;const qe=z.shift();Ae=new p.JoinedCellData(this._workCell,T.translateToString(!0,qe[0],qe[1]),qe[1]-qe[0]),Ze=qe[1]-1,je=Ae.getWidth()}const ue=this._isCellInSelection(Ie,R),ht=S&&Ie===B,se=Se&&Ie>=W&&Ie<=G;let pe=!1;this._decorationService.forEachDecorationAtCell(Ie,R,void 0,(qe=>{pe=!0}));let Ce=Ae.getChars()||b.WHITESPACE_CELL_CHAR;if(Ce===" "&&(Ae.isUnderline()||Ae.isOverline())&&(Ce=" "),ee=je*D-H.get(Ce,Ae.isBold(),Ae.isItalic()),U){if(K&&(ue&&Z||!ue&&!Z&&Ae.bg===oe)&&(ue&&Z&&P.selectionForeground||Ae.fg===we)&&Ae.extended.ext===me&&se===X&&ee===V&&!ht&&!Je&&!pe){Ae.isInvisible()?te+=b.WHITESPACE_CELL_CHAR:te+=Ce,K++;continue}K&&(U.textContent=te),U=this._document.createElement("span"),K=0,te=""}else U=this._document.createElement("span");if(oe=Ae.bg,we=Ae.fg,me=Ae.extended.ext,X=se,V=ee,Z=ue,Je&&B>=Ie&&B<=Ze&&(B=Ie),!this._coreService.isCursorHidden&&ht&&this._coreService.isCursorInitialized){if(ve.push("xterm-cursor"),this._coreBrowserService.isFocused)F&&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(Ae.isBold()&&ve.push("xterm-bold"),Ae.isItalic()&&ve.push("xterm-italic"),Ae.isDim()&&ve.push("xterm-dim"),te=Ae.isInvisible()?b.WHITESPACE_CELL_CHAR:Ae.getChars()||b.WHITESPACE_CELL_CHAR,Ae.isUnderline()&&(ve.push(`xterm-underline-${Ae.extended.underlineStyle}`),te===" "&&(te=" "),!Ae.isUnderlineColorDefault()))if(Ae.isUnderlineColorRGB())U.style.textDecorationColor=`rgb(${f.AttributeData.toColorRGB(Ae.getUnderlineColor()).join(",")})`;else{let qe=Ae.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Ae.isBold()&&qe<8&&(qe+=8),U.style.textDecorationColor=P.ansi[qe].css}Ae.isOverline()&&(ve.push("xterm-overline"),te===" "&&(te=" ")),Ae.isStrikethrough()&&ve.push("xterm-strikethrough"),se&&(U.style.textDecoration="underline");let be=Ae.getFgColor(),ge=Ae.getFgColorMode(),Le=Ae.getBgColor(),ce=Ae.getBgColorMode();const Ye=!!Ae.isInverse();if(Ye){const qe=be;be=Le,Le=qe;const St=ge;ge=ce,ce=St}let We,He,Oe,Ue=!1;switch(this._decorationService.forEachDecorationAtCell(Ie,R,void 0,(qe=>{qe.options.layer!=="top"&&Ue||(qe.backgroundColorRGB&&(ce=50331648,Le=qe.backgroundColorRGB.rgba>>8&16777215,We=qe.backgroundColorRGB),qe.foregroundColorRGB&&(ge=50331648,be=qe.foregroundColorRGB.rgba>>8&16777215,He=qe.foregroundColorRGB),Ue=qe.options.layer==="top")})),!Ue&&ue&&(We=this._coreBrowserService.isFocused?P.selectionBackgroundOpaque:P.selectionInactiveBackgroundOpaque,Le=We.rgba>>8&16777215,ce=50331648,Ue=!0,P.selectionForeground&&(ge=50331648,be=P.selectionForeground.rgba>>8&16777215,He=P.selectionForeground)),Ue&&ve.push("xterm-decoration-top"),ce){case 16777216:case 33554432:Oe=P.ansi[Le],ve.push(`xterm-bg-${Le}`);break;case 50331648:Oe=_.channels.toColor(Le>>16,Le>>8&255,255&Le),this._addStyle(U,`background-color:#${j((Le>>>0).toString(16),"0",6)}`);break;default:Ye?(Oe=P.foreground,ve.push(`xterm-bg-${h.INVERTED_DEFAULT_COLOR}`)):Oe=P.background}switch(We||Ae.isDim()&&(We=_.color.multiplyOpacity(Oe,.5)),ge){case 16777216:case 33554432:Ae.isBold()&&be<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(be+=8),this._applyMinimumContrast(U,Oe,P.ansi[be],Ae,We,void 0)||ve.push(`xterm-fg-${be}`);break;case 50331648:const qe=_.channels.toColor(be>>16&255,be>>8&255,255&be);this._applyMinimumContrast(U,Oe,qe,Ae,We,He)||this._addStyle(U,`color:#${j(be.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(U,Oe,P.foreground,Ae,We,He)||Ye&&ve.push(`xterm-fg-${h.INVERTED_DEFAULT_COLOR}`)}ve.length&&(U.className=ve.join(" "),ve.length=0),ht||Je||pe?U.textContent=te:K++,ee!==this.defaultSpacing&&(U.style.letterSpacing=`${ee}px`),Y.push(U),Ie=Ze}return U&&K&&(U.textContent=te),Y}_applyMinimumContrast(T,R,S,L,I,B){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,m.treatGlyphAsBackgroundColor)(L.getCode()))return!1;const F=this._getContrastCache(L);let D;if(I||B||(D=F.getColor(R.rgba,S.rgba)),D===void 0){const H=this._optionsService.rawOptions.minimumContrastRatio/(L.isDim()?2:1);D=_.color.ensureContrastRatio(I||R,B||S,H),F.setColor((I||R).rgba,(B||S).rgba,D??null)}return!!D&&(this._addStyle(T,`color:${D.css}`),!0)}_getContrastCache(T){return T.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(T,R){T.setAttribute("style",`${T.getAttribute("style")||""}${R};`)}_isCellInSelection(T,R){const S=this._selectionStart,L=this._selectionEnd;return!(!S||!L)&&(this._columnSelectMode?S[0]<=L[0]?T>=S[0]&&R>=S[1]&&T<L[0]&&R<=L[1]:T<S[0]&&R>=S[1]&&T>=L[0]&&R<=L[1]:R>S[1]&&R<L[1]||S[1]===L[1]&&R===S[1]&&T>=S[0]&&T<L[0]||S[1]<L[1]&&R===L[1]&&T<L[0]||S[1]<L[1]&&R===S[1]&&T>=S[0])}};function j(T,R,S){for(;T.length<S;)T=R+T;return T}i.DomRendererRowFactory=x=g([v(1,u.ICharacterJoinerService),v(2,N.IOptionsService),v(3,u.ICoreBrowserService),v(4,N.ICoreService),v(5,N.IDecorationService),v(6,u.IThemeService)],x)},2550:(y,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.WidthCache=void 0,i.WidthCache=class{constructor(c,g){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 E=c.createElement("span");E.classList.add("xterm-char-measure-element"),E.style.fontWeight="bold",E.style.fontStyle="italic",this._measureElements=[v,h,b,E],this._container.appendChild(v),this._container.appendChild(h),this._container.appendChild(b),this._container.appendChild(E),g.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,g,v,h){c===this._font&&g===this._fontSize&&v===this._weight&&h===this._weightBold||(this._font=c,this._fontSize=g,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,g,v){let h=0;if(!g&&!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;g&&(b+="B"),v&&(b+="I");let E=this._holey.get(b);if(E===void 0){let N=0;g&&(N|=1),v&&(N|=2),E=this._measure(c,N),E>0&&this._holey.set(b,E)}return E}_measure(c,g){const v=this._measureElements[g];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 g=c(6114);i.INVERTED_DEFAULT_COLOR=257,i.DIM_OPACITY=.5,i.TEXT_BASELINE=g.isFirefox||g.isLegacyEdge?"bottom":"ideographic"},6171:(y,i)=>{function c(v){return 57508<=v&&v<=57558}function g(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=g,i.allowRescaling=function(v,h,b,E){return h===1&&b>Math.ceil(1.5*E)&&v!==void 0&&v>255&&!g(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,E=!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,_=h[1]-N,u=b[1]-N,p=Math.max(_,0),m=Math.min(u,v.rows-1);p>=v.rows||m<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=E,this.viewportStartRow=_,this.viewportEndRow=u,this.viewportCappedStartRow=p,this.viewportCappedEndRow=m,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,g=this.selectionEnd;return!(!c||!g)&&(c[1]>g[1]||c[1]===g[1]&&c[0]>g[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 g=this&&this.__decorate||function(m,f,x,j){var T,R=arguments.length,S=R<3?f:j===null?j=Object.getOwnPropertyDescriptor(f,x):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(m,f,x,j);else for(var L=m.length-1;L>=0;L--)(T=m[L])&&(S=(R<3?T(S):R>3?T(f,x,S):T(f,x))||S);return R>3&&S&&Object.defineProperty(f,x,S),S},v=this&&this.__param||function(m,f){return function(x,j){f(x,j,m)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CharSizeService=void 0;const h=c(2585),b=c(8460),E=c(844);let N=i.CharSizeService=class extends E.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(m,f,x){super(),this._optionsService=x,this.width=0,this.height=0,this._onCharSizeChange=this.register(new b.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new p(this._optionsService))}catch{this._measureStrategy=this.register(new u(m,f,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const m=this._measureStrategy.measure();m.width===this.width&&m.height===this.height||(this.width=m.width,this.height=m.height,this._onCharSizeChange.fire())}};i.CharSizeService=N=g([v(2,h.IOptionsService)],N);class _ extends E.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(f,x){f!==void 0&&f>0&&x!==void 0&&x>0&&(this._result.width=f,this._result.height=x)}}class u extends _{constructor(f,x,j){super(),this._document=f,this._parentElement=x,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 p extends _{constructor(f){super(),this._optionsService=f,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const x=this._ctx.measureText("W");if(!("width"in x&&"fontBoundingBoxAscent"in x&&"fontBoundingBoxDescent"in x))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 g=this&&this.__decorate||function(p,m,f,x){var j,T=arguments.length,R=T<3?m:x===null?x=Object.getOwnPropertyDescriptor(m,f):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(p,m,f,x);else for(var S=p.length-1;S>=0;S--)(j=p[S])&&(R=(T<3?j(R):T>3?j(m,f,R):j(m,f))||R);return T>3&&R&&Object.defineProperty(m,f,R),R},v=this&&this.__param||function(p,m){return function(f,x){m(f,x,p)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CharacterJoinerService=i.JoinedCellData=void 0;const h=c(3734),b=c(643),E=c(511),N=c(2585);class _ extends h.AttributeData{constructor(m,f,x){super(),this.content=0,this.combinedData="",this.fg=m.fg,this.bg=m.bg,this.combinedData=f,this._width=x}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(m){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}i.JoinedCellData=_;let u=i.CharacterJoinerService=class zg{constructor(m){this._bufferService=m,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new E.CellData}register(m){const f={id:this._nextCharacterJoinerId++,handler:m};return this._characterJoiners.push(f),f.id}deregister(m){for(let f=0;f<this._characterJoiners.length;f++)if(this._characterJoiners[f].id===m)return this._characterJoiners.splice(f,1),!0;return!1}getJoinedCharacters(m){if(this._characterJoiners.length===0)return[];const f=this._bufferService.buffer.lines.get(m);if(!f||f.length===0)return[];const x=[],j=f.translateToString(!0);let T=0,R=0,S=0,L=f.getFg(0),I=f.getBg(0);for(let B=0;B<f.getTrimmedLength();B++)if(f.loadCell(B,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==L||this._workCell.bg!==I){if(B-T>1){const F=this._getJoinedRanges(j,S,R,f,T);for(let D=0;D<F.length;D++)x.push(F[D])}T=B,S=R,L=this._workCell.fg,I=this._workCell.bg}R+=this._workCell.getChars().length||b.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-T>1){const B=this._getJoinedRanges(j,S,R,f,T);for(let F=0;F<B.length;F++)x.push(B[F])}return x}_getJoinedRanges(m,f,x,j,T){const R=m.substring(f,x);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 B=0;B<I.length;B++)zg._mergeRanges(S,I[B])}catch(I){console.error(I)}return this._stringRangesToCellRanges(S,j,T),S}_stringRangesToCellRanges(m,f,x){let j=0,T=!1,R=0,S=m[j];if(S){for(let L=x;L<this._bufferService.cols;L++){const I=f.getWidth(L),B=f.getString(L).length||b.WHITESPACE_CELL_CHAR.length;if(I!==0){if(!T&&S[0]<=R&&(S[0]=L,T=!0),S[1]<=R){if(S[1]=L,S=m[++j],!S)break;S[0]<=R?(S[0]=L,T=!0):T=!1}R+=B}}S&&(S[1]=this._bufferService.cols)}}static _mergeRanges(m,f){let x=!1;for(let j=0;j<m.length;j++){const T=m[j];if(x){if(f[1]<=T[0])return m[j-1][1]=f[1],m;if(f[1]<=T[1])return m[j-1][1]=Math.max(f[1],T[1]),m.splice(j,1),m;m.splice(j,1),j--}else{if(f[1]<=T[0])return m.splice(j,0,f),m;if(f[1]<=T[1])return T[0]=Math.min(f[0],T[0]),m;f[0]<T[1]&&(T[0]=Math.min(f[0],T[0]),x=!0)}}return x?m[m.length-1][1]=f[1]:m.push(f),m}};i.CharacterJoinerService=u=g([v(0,N.IBufferService)],u)},5114:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CoreBrowserService=void 0;const g=c(844),v=c(8460),h=c(3656);class b extends g.Disposable{constructor(_,u,p){super(),this._textarea=_,this._window=u,this.mainDocument=p,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new E(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((m=>this._screenDprMonitor.setWindow(m)))),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(_){this._window!==_&&(this._window=_,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 E extends g.Disposable{constructor(_){super(),this._parentWindow=_,this._windowResizeListener=this.register(new g.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,g.toDisposable)((()=>this.clearListener())))}setWindow(_){this._parentWindow=_,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 _;this._outerListener&&((_=this._resolutionMediaMatchList)==null||_.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 g=c(844);class v extends g.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,g.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(b){return this.linkProviders.push(b),{dispose:()=>{const E=this.linkProviders.indexOf(b);E!==-1&&this.linkProviders.splice(E,1)}}}}i.LinkProviderService=v},8934:function(y,i,c){var g=this&&this.__decorate||function(N,_,u,p){var m,f=arguments.length,x=f<3?_:p===null?p=Object.getOwnPropertyDescriptor(_,u):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(N,_,u,p);else for(var j=N.length-1;j>=0;j--)(m=N[j])&&(x=(f<3?m(x):f>3?m(_,u,x):m(_,u))||x);return f>3&&x&&Object.defineProperty(_,u,x),x},v=this&&this.__param||function(N,_){return function(u,p){_(u,p,N)}};Object.defineProperty(i,"__esModule",{value:!0}),i.MouseService=void 0;const h=c(4725),b=c(9806);let E=i.MouseService=class{constructor(N,_){this._renderService=N,this._charSizeService=_}getCoords(N,_,u,p,m){return(0,b.getCoords)(window,N,_,u,p,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,m)}getMouseReportCoords(N,_){const u=(0,b.getCoordsRelativeToElement)(window,N,_);if(this._charSizeService.hasValidSize)return u[0]=Math.min(Math.max(u[0],0),this._renderService.dimensions.css.canvas.width-1),u[1]=Math.min(Math.max(u[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(u[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(u[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(u[0]),y:Math.floor(u[1])}}};i.MouseService=E=g([v(0,h.IRenderService),v(1,h.ICharSizeService)],E)},3230:function(y,i,c){var g=this&&this.__decorate||function(m,f,x,j){var T,R=arguments.length,S=R<3?f:j===null?j=Object.getOwnPropertyDescriptor(f,x):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(m,f,x,j);else for(var L=m.length-1;L>=0;L--)(T=m[L])&&(S=(R<3?T(S):R>3?T(f,x,S):T(f,x))||S);return R>3&&S&&Object.defineProperty(f,x,S),S},v=this&&this.__param||function(m,f){return function(x,j){f(x,j,m)}};Object.defineProperty(i,"__esModule",{value:!0}),i.RenderService=void 0;const h=c(6193),b=c(4725),E=c(8460),N=c(844),_=c(7226),u=c(2585);let p=i.RenderService=class extends N.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(m,f,x,j,T,R,S,L){super(),this._rowCount=m,this._charSizeService=j,this._renderer=this.register(new N.MutableDisposable),this._pausedResizeTask=new _.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 E.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new E.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new E.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new E.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new h.RenderDebouncer(((I,B)=>this._renderRows(I,B)),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(x.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(T.onDecorationRegistered((()=>this._fullRefresh()))),this.register(T.onDecorationRemoved((()=>this._fullRefresh()))),this.register(x.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(R.cols,R.rows),this._fullRefresh()}))),this.register(x.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(m,f){if("IntersectionObserver"in m){const x=new m.IntersectionObserver((j=>this._handleIntersectionChange(j[j.length-1])),{threshold:0});x.observe(f),this._observerDisposable.value=(0,N.toDisposable)((()=>x.disconnect()))}}_handleIntersectionChange(m){this._isPaused=m.isIntersecting===void 0?m.intersectionRatio===0:!m.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(m,f,x=!1){this._isPaused?this._needsFullRefresh=!0:(x||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(m,f,this._rowCount))}_renderRows(m,f){this._renderer.value&&(m=Math.min(m,this._rowCount-1),f=Math.min(f,this._rowCount-1),this._renderer.value.renderRows(m,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:m,end:f}),this._onRender.fire({start:m,end:f}),this._isNextRenderRedrawOnly=!0)}resize(m,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(m){this._renderer.value=m,this._renderer.value&&(this._renderer.value.onRequestRedraw((f=>this.refreshRows(f.start,f.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(m){return this._renderDebouncer.addRefreshCallback(m)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var m,f;this._renderer.value&&((f=(m=this._renderer.value).clearTextureAtlas)==null||f.call(m),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(m,f){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var x;return(x=this._renderer.value)==null?void 0:x.handleResize(m,f)})):this._renderer.value.handleResize(m,f),this._fullRefresh())}handleCharSizeChanged(){var m;(m=this._renderer.value)==null||m.handleCharSizeChanged()}handleBlur(){var m;(m=this._renderer.value)==null||m.handleBlur()}handleFocus(){var m;(m=this._renderer.value)==null||m.handleFocus()}handleSelectionChanged(m,f,x){var j;this._selectionState.start=m,this._selectionState.end=f,this._selectionState.columnSelectMode=x,(j=this._renderer.value)==null||j.handleSelectionChanged(m,f,x)}handleCursorMove(){var m;(m=this._renderer.value)==null||m.handleCursorMove()}clear(){var m;(m=this._renderer.value)==null||m.clear()}};i.RenderService=p=g([v(2,u.IOptionsService),v(3,b.ICharSizeService),v(4,u.IDecorationService),v(5,u.IBufferService),v(6,b.ICoreBrowserService),v(7,b.IThemeService)],p)},9312:function(y,i,c){var g=this&&this.__decorate||function(S,L,I,B){var F,D=arguments.length,H=D<3?L:B===null?B=Object.getOwnPropertyDescriptor(L,I):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")H=Reflect.decorate(S,L,I,B);else for(var W=S.length-1;W>=0;W--)(F=S[W])&&(H=(D<3?F(H):D>3?F(L,I,H):F(L,I))||H);return D>3&&H&&Object.defineProperty(L,I,H),H},v=this&&this.__param||function(S,L){return function(I,B){L(I,B,S)}};Object.defineProperty(i,"__esModule",{value:!0}),i.SelectionService=void 0;const h=c(9806),b=c(9504),E=c(456),N=c(4725),_=c(8460),u=c(844),p=c(6114),m=c(4841),f=c(511),x=c(2585),j=" ",T=new RegExp(j,"g");let R=i.SelectionService=class extends u.Disposable{constructor(S,L,I,B,F,D,H,W,G){super(),this._element=S,this._screenElement=L,this._linkifier=I,this._bufferService=B,this._coreService=F,this._mouseService=D,this._optionsService=H,this._renderService=W,this._coreBrowserService=G,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 _.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new _.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new _.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new _.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 E.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,u.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,B=[];if(this._activeSelectionMode===3){if(S[0]===L[0])return"";const F=S[0]<L[0]?S[0]:L[0],D=S[0]<L[0]?L[0]:S[0];for(let H=S[1];H<=L[1];H++){const W=I.translateBufferLineToString(H,!0,F,D);B.push(W)}}else{const F=S[1]===L[1]?L[0]:void 0;B.push(I.translateBufferLineToString(S[1],!0,S[0],F));for(let D=S[1]+1;D<=L[1]-1;D++){const H=I.lines.get(D),W=I.translateBufferLineToString(D,!0);H!=null&&H.isWrapped?B[B.length-1]+=W:B.push(W)}if(S[1]!==L[1]){const D=I.lines.get(L[1]),H=I.translateBufferLineToString(L[1],!0,0,L[0]);D&&D.isWrapped?B[B.length-1]+=H:B.push(H)}}return B.map((F=>F.replace(T," "))).join(p.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()))),p.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,B=this._model.finalSelectionEnd;return!!(I&&B&&L)&&this._areCoordsInSelection(L,I,B)}isCellInSelection(S,L){const I=this._model.finalSelectionStart,B=this._model.finalSelectionEnd;return!(!I||!B)&&this._areCoordsInSelection([S,L],I,B)}_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 F,D;const I=(D=(F=this._linkifier.currentLink)==null?void 0:F.link)==null?void 0:D.range;if(I)return this._model.selectionStart=[I.start.x-1,I.start.y-1],this._model.selectionStartLength=(0,m.getRangeLength)(I,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const B=this._getMouseBufferCoords(S);return!!B&&(this._selectWordAt(B,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 p.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&&!(p.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 B=I.lines.get(this._model.selectionEnd[1]);B&&B.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 B=(0,b.moveToCellSequence)(I[0]-1,I[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(B,!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 B=0;L>=B;B++){const F=S.loadCell(B,this._workCell).getChars().length;this._workCell.getWidth()===0?I--:F>1&&L!==B&&(I+=F-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,B=!0){if(S[0]>=this._bufferService.cols)return;const F=this._bufferService.buffer,D=F.lines.get(S[1]);if(!D)return;const H=F.translateBufferLineToString(S[1],!1);let W=this._convertViewportColToCharacterIndex(D,S[0]),G=W;const Y=S[0]-W;let z=0,P=0,U=0,$=0;if(H.charAt(W)===" "){for(;W>0&&H.charAt(W-1)===" ";)W--;for(;G<H.length&&H.charAt(G+1)===" ";)G++}else{let oe=S[0],we=S[0];D.getWidth(oe)===0&&(z++,oe--),D.getWidth(we)===2&&(P++,we++);const me=D.getString(we).length;for(me>1&&($+=me-1,G+=me-1);oe>0&&W>0&&!this._isCharWordSeparator(D.loadCell(oe-1,this._workCell));){D.loadCell(oe-1,this._workCell);const X=this._workCell.getChars().length;this._workCell.getWidth()===0?(z++,oe--):X>1&&(U+=X-1,W-=X-1),W--,oe--}for(;we<D.length&&G+1<H.length&&!this._isCharWordSeparator(D.loadCell(we+1,this._workCell));){D.loadCell(we+1,this._workCell);const X=this._workCell.getChars().length;this._workCell.getWidth()===2?(P++,we++):X>1&&($+=X-1,G+=X-1),G++,we++}}G++;let K=W+Y-z+U,te=Math.min(this._bufferService.cols,G-W+z+P-U-$);if(L||H.slice(W,G).trim()!==""){if(I&&K===0&&D.getCodePoint(0)!==32){const oe=F.lines.get(S[1]-1);if(oe&&D.isWrapped&&oe.getCodePoint(this._bufferService.cols-1)!==32){const we=this._getWordAt([this._bufferService.cols-1,S[1]-1],!1,!0,!1);if(we){const me=this._bufferService.cols-we.start;K-=me,te+=me}}}if(B&&K+te===this._bufferService.cols&&D.getCodePoint(this._bufferService.cols-1)!==32){const oe=F.lines.get(S[1]+1);if(oe!=null&&oe.isWrapped&&oe.getCodePoint(0)!==32){const we=this._getWordAt([0,S[1]+1],!1,!1,!0);we&&(te+=we.length)}}return{start:K,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,m.getRangeLength)(I,this._bufferService.cols)}};i.SelectionService=R=g([v(3,x.IBufferService),v(4,x.ICoreService),v(5,N.IMouseService),v(6,x.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 g=c(8343);i.ICharSizeService=(0,g.createDecorator)("CharSizeService"),i.ICoreBrowserService=(0,g.createDecorator)("CoreBrowserService"),i.IMouseService=(0,g.createDecorator)("MouseService"),i.IRenderService=(0,g.createDecorator)("RenderService"),i.ISelectionService=(0,g.createDecorator)("SelectionService"),i.ICharacterJoinerService=(0,g.createDecorator)("CharacterJoinerService"),i.IThemeService=(0,g.createDecorator)("ThemeService"),i.ILinkProviderService=(0,g.createDecorator)("LinkProviderService")},6731:function(y,i,c){var g=this&&this.__decorate||function(R,S,L,I){var B,F=arguments.length,D=F<3?S:I===null?I=Object.getOwnPropertyDescriptor(S,L):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(R,S,L,I);else for(var H=R.length-1;H>=0;H--)(B=R[H])&&(D=(F<3?B(D):F>3?B(S,L,D):B(S,L))||D);return F>3&&D&&Object.defineProperty(S,L,D),D},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),E=c(8460),N=c(844),_=c(2585),u=b.css.toColor("#ffffff"),p=b.css.toColor("#000000"),m=b.css.toColor("#ffffff"),f=b.css.toColor("#000000"),x={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],B=S[L/6%6|0],F=S[L%6];R.push({css:b.channels.toCss(I,B,F),rgba:b.channels.toRgba(I,B,F)})}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 E.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:u,background:p,cursor:m,cursorAccent:f,selectionForeground:void 0,selectionBackgroundTransparent:x,selectionBackgroundOpaque:b.color.blend(p,x),selectionInactiveBackgroundTransparent:x,selectionInactiveBackgroundOpaque:b.color.blend(p,x),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=T(R.foreground,u),S.background=T(R.background,p),S.cursor=T(R.cursor,m),S.cursorAccent=T(R.cursorAccent,f),S.selectionBackgroundTransparent=T(R.selectionBackground,x),S.selectionBackgroundOpaque=b.color.blend(S.background,S.selectionBackgroundTransparent),S.selectionInactiveBackgroundTransparent=T(R.selectionInactiveBackground,S.selectionBackgroundTransparent),S.selectionInactiveBackgroundOpaque=b.color.blend(S.background,S.selectionInactiveBackgroundTransparent),S.selectionForeground=R.selectionForeground?T(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]=T(R.black,i.DEFAULT_ANSI_COLORS[0]),S.ansi[1]=T(R.red,i.DEFAULT_ANSI_COLORS[1]),S.ansi[2]=T(R.green,i.DEFAULT_ANSI_COLORS[2]),S.ansi[3]=T(R.yellow,i.DEFAULT_ANSI_COLORS[3]),S.ansi[4]=T(R.blue,i.DEFAULT_ANSI_COLORS[4]),S.ansi[5]=T(R.magenta,i.DEFAULT_ANSI_COLORS[5]),S.ansi[6]=T(R.cyan,i.DEFAULT_ANSI_COLORS[6]),S.ansi[7]=T(R.white,i.DEFAULT_ANSI_COLORS[7]),S.ansi[8]=T(R.brightBlack,i.DEFAULT_ANSI_COLORS[8]),S.ansi[9]=T(R.brightRed,i.DEFAULT_ANSI_COLORS[9]),S.ansi[10]=T(R.brightGreen,i.DEFAULT_ANSI_COLORS[10]),S.ansi[11]=T(R.brightYellow,i.DEFAULT_ANSI_COLORS[11]),S.ansi[12]=T(R.brightBlue,i.DEFAULT_ANSI_COLORS[12]),S.ansi[13]=T(R.brightMagenta,i.DEFAULT_ANSI_COLORS[13]),S.ansi[14]=T(R.brightCyan,i.DEFAULT_ANSI_COLORS[14]),S.ansi[15]=T(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]=T(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 T(R,S){if(R!==void 0)try{return b.css.toColor(R)}catch{}return S}i.ThemeService=j=g([v(0,_.IOptionsService)],j)},6349:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CircularList=void 0;const g=c(8460),v=c(844);class h extends v.Disposable{constructor(E){super(),this._maxLength=E,this.onDeleteEmitter=this.register(new g.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new g.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new g.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(E){if(this._maxLength===E)return;const N=new Array(E);for(let _=0;_<Math.min(E,this.length);_++)N[_]=this._array[this._getCyclicIndex(_)];this._array=N,this._maxLength=E,this._startIndex=0}get length(){return this._length}set length(E){if(E>this._length)for(let N=this._length;N<E;N++)this._array[N]=void 0;this._length=E}get(E){return this._array[this._getCyclicIndex(E)]}set(E,N){this._array[this._getCyclicIndex(E)]=N}push(E){this._array[this._getCyclicIndex(this._length)]=E,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw 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(E,N,..._){if(N){for(let u=E;u<this._length-N;u++)this._array[this._getCyclicIndex(u)]=this._array[this._getCyclicIndex(u+N)];this._length-=N,this.onDeleteEmitter.fire({index:E,amount:N})}for(let u=this._length-1;u>=E;u--)this._array[this._getCyclicIndex(u+_.length)]=this._array[this._getCyclicIndex(u)];for(let u=0;u<_.length;u++)this._array[this._getCyclicIndex(E+u)]=_[u];if(_.length&&this.onInsertEmitter.fire({index:E,amount:_.length}),this._length+_.length>this._maxLength){const u=this._length+_.length-this._maxLength;this._startIndex+=u,this._length=this._maxLength,this.onTrimEmitter.fire(u)}else this._length+=_.length}trimStart(E){E>this._length&&(E=this._length),this._startIndex+=E,this._length-=E,this.onTrimEmitter.fire(E)}shiftElements(E,N,_){if(!(N<=0)){if(E<0||E>=this._length)throw new Error("start argument out of range");if(E+_<0)throw new Error("Cannot shift elements in list beyond index 0");if(_>0){for(let p=N-1;p>=0;p--)this.set(E+p+_,this.get(E+p));const u=E+N+_-this._length;if(u>0)for(this._length+=u;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let u=0;u<N;u++)this.set(E+u+_,this.get(E+u))}}_getCyclicIndex(E){return(this._startIndex+E)%this._maxLength}}i.CircularList=h},1439:(y,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.clone=void 0,i.clone=function c(g,v=5){if(typeof g!="object")return g;const h=Array.isArray(g)?[]:{};for(const b in g)h[b]=v<=1?g[b]:g[b]&&c(g[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,g=0,v=0,h=0;var b,E,N,_,u;function p(f){const x=f.toString(16);return x.length<2?"0"+x:x}function m(f,x){return f<x?(x+.05)/(f+.05):(f+.05)/(x+.05)}i.NULL_COLOR={css:"#00000000",rgba:0},(function(f){f.toCss=function(x,j,T,R){return R!==void 0?`#${p(x)}${p(j)}${p(T)}${p(R)}`:`#${p(x)}${p(j)}${p(T)}`},f.toRgba=function(x,j,T,R=255){return(x<<24|j<<16|T<<8|R)>>>0},f.toColor=function(x,j,T,R){return{css:f.toCss(x,j,T,R),rgba:f.toRgba(x,j,T,R)}}})(b||(i.channels=b={})),(function(f){function x(j,T){return h=Math.round(255*T),[c,g,v]=u.toChannels(j.rgba),{css:b.toCss(c,g,v,h),rgba:b.toRgba(c,g,v,h)}}f.blend=function(j,T){if(h=(255&T.rgba)/255,h===1)return{css:T.css,rgba:T.rgba};const R=T.rgba>>24&255,S=T.rgba>>16&255,L=T.rgba>>8&255,I=j.rgba>>24&255,B=j.rgba>>16&255,F=j.rgba>>8&255;return c=I+Math.round((R-I)*h),g=B+Math.round((S-B)*h),v=F+Math.round((L-F)*h),{css:b.toCss(c,g,v),rgba:b.toRgba(c,g,v)}},f.isOpaque=function(j){return(255&j.rgba)==255},f.ensureContrastRatio=function(j,T,R){const S=u.ensureContrastRatio(j.rgba,T.rgba,R);if(S)return b.toColor(S>>24&255,S>>16&255,S>>8&255)},f.opaque=function(j){const T=(255|j.rgba)>>>0;return[c,g,v]=u.toChannels(T),{css:b.toCss(c,g,v),rgba:T}},f.opacity=x,f.multiplyOpacity=function(j,T){return h=255&j.rgba,x(j,h*T/255)},f.toColorRGB=function(j){return[j.rgba>>24&255,j.rgba>>16&255,j.rgba>>8&255]}})(E||(i.color=E={})),(function(f){let x,j;try{const T=document.createElement("canvas");T.width=1,T.height=1;const R=T.getContext("2d",{willReadFrequently:!0});R&&(x=R,x.globalCompositeOperation="copy",j=x.createLinearGradient(0,0,1,1))}catch{}f.toColor=function(T){if(T.match(/#[\da-f]{3,8}/i))switch(T.length){case 4:return c=parseInt(T.slice(1,2).repeat(2),16),g=parseInt(T.slice(2,3).repeat(2),16),v=parseInt(T.slice(3,4).repeat(2),16),b.toColor(c,g,v);case 5:return c=parseInt(T.slice(1,2).repeat(2),16),g=parseInt(T.slice(2,3).repeat(2),16),v=parseInt(T.slice(3,4).repeat(2),16),h=parseInt(T.slice(4,5).repeat(2),16),b.toColor(c,g,v,h);case 7:return{css:T,rgba:(parseInt(T.slice(1),16)<<8|255)>>>0};case 9:return{css:T,rgba:parseInt(T.slice(1),16)>>>0}}const R=T.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]),g=parseInt(R[2]),v=parseInt(R[3]),h=Math.round(255*(R[5]===void 0?1:parseFloat(R[5]))),b.toColor(c,g,v,h);if(!x||!j)throw new Error("css.toColor: Unsupported css format");if(x.fillStyle=j,x.fillStyle=T,typeof x.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(x.fillRect(0,0,1,1),[c,g,v,h]=x.getImageData(0,0,1,1).data,h!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:b.toRgba(c,g,v,h),css:T}}})(N||(i.css=N={})),(function(f){function x(j,T,R){const S=j/255,L=T/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 x(j>>16&255,j>>8&255,255&j)},f.relativeLuminance2=x})(_||(i.rgb=_={})),(function(f){function x(T,R,S){const L=T>>24&255,I=T>>16&255,B=T>>8&255;let F=R>>24&255,D=R>>16&255,H=R>>8&255,W=m(_.relativeLuminance2(F,D,H),_.relativeLuminance2(L,I,B));for(;W<S&&(F>0||D>0||H>0);)F-=Math.max(0,Math.ceil(.1*F)),D-=Math.max(0,Math.ceil(.1*D)),H-=Math.max(0,Math.ceil(.1*H)),W=m(_.relativeLuminance2(F,D,H),_.relativeLuminance2(L,I,B));return(F<<24|D<<16|H<<8|255)>>>0}function j(T,R,S){const L=T>>24&255,I=T>>16&255,B=T>>8&255;let F=R>>24&255,D=R>>16&255,H=R>>8&255,W=m(_.relativeLuminance2(F,D,H),_.relativeLuminance2(L,I,B));for(;W<S&&(F<255||D<255||H<255);)F=Math.min(255,F+Math.ceil(.1*(255-F))),D=Math.min(255,D+Math.ceil(.1*(255-D))),H=Math.min(255,H+Math.ceil(.1*(255-H))),W=m(_.relativeLuminance2(F,D,H),_.relativeLuminance2(L,I,B));return(F<<24|D<<16|H<<8|255)>>>0}f.blend=function(T,R){if(h=(255&R)/255,h===1)return R;const S=R>>24&255,L=R>>16&255,I=R>>8&255,B=T>>24&255,F=T>>16&255,D=T>>8&255;return c=B+Math.round((S-B)*h),g=F+Math.round((L-F)*h),v=D+Math.round((I-D)*h),b.toRgba(c,g,v)},f.ensureContrastRatio=function(T,R,S){const L=_.relativeLuminance(T>>8),I=_.relativeLuminance(R>>8);if(m(L,I)<S){if(I<L){const D=x(T,R,S),H=m(L,_.relativeLuminance(D>>8));if(H<S){const W=j(T,R,S);return H>m(L,_.relativeLuminance(W>>8))?D:W}return D}const B=j(T,R,S),F=m(L,_.relativeLuminance(B>>8));if(F<S){const D=x(T,R,S);return F>m(L,_.relativeLuminance(D>>8))?B:D}return B}},f.reduceLuminance=x,f.increaseLuminance=j,f.toChannels=function(T){return[T>>24&255,T>>16&255,T>>8&255,255&T]}})(u||(i.rgba=u={})),i.toPaddedHex=p,i.contrastRatio=m},8969:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CoreTerminal=void 0;const g=c(844),v=c(2585),h=c(4348),b=c(7866),E=c(744),N=c(7302),_=c(6975),u=c(8460),p=c(1753),m=c(1480),f=c(7994),x=c(9282),j=c(5435),T=c(5981),R=c(2660);let S=!1;class L extends g.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new u.EventEmitter),this._onScroll.event((B=>{var F;(F=this._onScrollApi)==null||F.fire(B.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(B){for(const F in B)this.optionsService.options[F]=B[F]}constructor(B){super(),this._windowsWrappingHeuristics=this.register(new g.MutableDisposable),this._onBinary=this.register(new u.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new u.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new u.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new u.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new u.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new u.EventEmitter),this._instantiationService=new h.InstantiationService,this.optionsService=this.register(new N.OptionsService(B)),this._instantiationService.setService(v.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(E.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(_.CoreService)),this._instantiationService.setService(v.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(p.CoreMouseService)),this._instantiationService.setService(v.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(m.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,u.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,u.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,u.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,u.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((F=>{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((F=>{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 T.WriteBuffer(((F,D)=>this._inputHandler.parse(F,D)))),this.register((0,u.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(B,F){this._writeBuffer.write(B,F)}writeSync(B,F){this._logService.logLevel<=v.LogLevelEnum.WARN&&!S&&(this._logService.warn("writeSync is unreliable and will be removed soon."),S=!0),this._writeBuffer.writeSync(B,F)}input(B,F=!0){this.coreService.triggerDataEvent(B,F)}resize(B,F){isNaN(B)||isNaN(F)||(B=Math.max(B,E.MINIMUM_COLS),F=Math.max(F,E.MINIMUM_ROWS),this._bufferService.resize(B,F))}scroll(B,F=!1){this._bufferService.scroll(B,F)}scrollLines(B,F,D){this._bufferService.scrollLines(B,F,D)}scrollPages(B){this.scrollLines(B*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(B){const F=B-this._bufferService.buffer.ydisp;F!==0&&this.scrollLines(F)}registerEscHandler(B,F){return this._inputHandler.registerEscHandler(B,F)}registerDcsHandler(B,F){return this._inputHandler.registerDcsHandler(B,F)}registerCsiHandler(B,F){return this._inputHandler.registerCsiHandler(B,F)}registerOscHandler(B,F){return this._inputHandler.registerOscHandler(B,F)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let B=!1;const F=this.optionsService.rawOptions.windowsPty;F&&F.buildNumber!==void 0&&F.buildNumber!==void 0?B=F.backend==="conpty"&&F.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(B=!0),B?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const B=[];B.push(this.onLineFeed(x.updateWindowsModeWrappedState.bind(null,this._bufferService))),B.push(this.registerCsiHandler({final:"H"},(()=>((0,x.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,g.toDisposable)((()=>{for(const F of B)F.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 g=0;g<this._listeners.length;g++)if(this._listeners[g]===c)return void this._listeners.splice(g,1)}}})),this._event}fire(c,g){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,g)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},i.forwardEvent=function(c,g){return c((v=>g.fire(v)))},i.runAndSubscribe=function(c,g){return g(void 0),c((v=>g(v)))}},5435:function(y,i,c){var g=this&&this.__decorate||function(z,P,U,$){var K,te=arguments.length,oe=te<3?P:$===null?$=Object.getOwnPropertyDescriptor(P,U):$;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")oe=Reflect.decorate(z,P,U,$);else for(var we=z.length-1;we>=0;we--)(K=z[we])&&(oe=(te<3?K(oe):te>3?K(P,U,oe):K(P,U))||oe);return te>3&&oe&&Object.defineProperty(P,U,oe),oe},v=this&&this.__param||function(z,P){return function(U,$){P(U,$,z)}};Object.defineProperty(i,"__esModule",{value:!0}),i.InputHandler=i.WindowsOptionsReportType=void 0;const h=c(2584),b=c(7116),E=c(2015),N=c(844),_=c(482),u=c(8437),p=c(8460),m=c(643),f=c(511),x=c(3734),j=c(2585),T=c(1480),R=c(6242),S=c(6351),L=c(5941),I={"(":0,")":1,"*":2,"+":3,"-":1,".":2},B=131072;function F(z,P){if(z>24)return P.setWinLines||!1;switch(z){case 1:return!!P.restoreWin;case 2:return!!P.minimizeWin;case 3:return!!P.setWinPosition;case 4:return!!P.setWinSizePixels;case 5:return!!P.raiseWin;case 6:return!!P.lowerWin;case 7:return!!P.refreshWin;case 8:return!!P.setWinSizeChars;case 9:return!!P.maximizeWin;case 10:return!!P.fullscreenWin;case 11:return!!P.getWinState;case 13:return!!P.getWinPosition;case 14:return!!P.getWinSizePixels;case 15:return!!P.getScreenSizePixels;case 16:return!!P.getCellSizePixels;case 18:return!!P.getWinSizeChars;case 19:return!!P.getScreenSizeChars;case 20:return!!P.getIconTitle;case 21:return!!P.getWinTitle;case 22:return!!P.pushTitle;case 23:return!!P.popTitle;case 24:return!!P.setWinLines}return!1}var D;(function(z){z[z.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",z[z.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(D||(i.WindowsOptionsReportType=D={}));let H=0;class W extends N.Disposable{getAttrData(){return this._curAttrData}constructor(P,U,$,K,te,oe,we,me,X=new E.EscapeSequenceParser){super(),this._bufferService=P,this._charsetService=U,this._coreService=$,this._logService=K,this._optionsService=te,this._oscLinkService=oe,this._coreMouseService=we,this._unicodeService=me,this._parser=X,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new _.StringToUtf32,this._utf8Decoder=new _.Utf8ToUtf32,this._workCell=new f.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=u.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=u.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new p.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new p.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new p.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new p.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new p.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new p.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new p.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new p.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new p.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new p.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new p.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new p.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new p.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 G(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((V=>this._activeBuffer=V.activeBuffer))),this._parser.setCsiHandlerFallback(((V,Z)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(V),params:Z.toArray()})})),this._parser.setEscHandlerFallback((V=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(V)})})),this._parser.setExecuteHandlerFallback((V=>{this._logService.debug("Unknown EXECUTE code: ",{code:V})})),this._parser.setOscHandlerFallback(((V,Z,ee)=>{this._logService.debug("Unknown OSC code: ",{identifier:V,action:Z,data:ee})})),this._parser.setDcsHandlerFallback(((V,Z,ee)=>{Z==="HOOK"&&(ee=ee.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(V),action:Z,payload:ee})})),this._parser.setPrintHandler(((V,Z,ee)=>this.print(V,Z,ee))),this._parser.registerCsiHandler({final:"@"},(V=>this.insertChars(V))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(V=>this.scrollLeft(V))),this._parser.registerCsiHandler({final:"A"},(V=>this.cursorUp(V))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(V=>this.scrollRight(V))),this._parser.registerCsiHandler({final:"B"},(V=>this.cursorDown(V))),this._parser.registerCsiHandler({final:"C"},(V=>this.cursorForward(V))),this._parser.registerCsiHandler({final:"D"},(V=>this.cursorBackward(V))),this._parser.registerCsiHandler({final:"E"},(V=>this.cursorNextLine(V))),this._parser.registerCsiHandler({final:"F"},(V=>this.cursorPrecedingLine(V))),this._parser.registerCsiHandler({final:"G"},(V=>this.cursorCharAbsolute(V))),this._parser.registerCsiHandler({final:"H"},(V=>this.cursorPosition(V))),this._parser.registerCsiHandler({final:"I"},(V=>this.cursorForwardTab(V))),this._parser.registerCsiHandler({final:"J"},(V=>this.eraseInDisplay(V,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(V=>this.eraseInDisplay(V,!0))),this._parser.registerCsiHandler({final:"K"},(V=>this.eraseInLine(V,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(V=>this.eraseInLine(V,!0))),this._parser.registerCsiHandler({final:"L"},(V=>this.insertLines(V))),this._parser.registerCsiHandler({final:"M"},(V=>this.deleteLines(V))),this._parser.registerCsiHandler({final:"P"},(V=>this.deleteChars(V))),this._parser.registerCsiHandler({final:"S"},(V=>this.scrollUp(V))),this._parser.registerCsiHandler({final:"T"},(V=>this.scrollDown(V))),this._parser.registerCsiHandler({final:"X"},(V=>this.eraseChars(V))),this._parser.registerCsiHandler({final:"Z"},(V=>this.cursorBackwardTab(V))),this._parser.registerCsiHandler({final:"`"},(V=>this.charPosAbsolute(V))),this._parser.registerCsiHandler({final:"a"},(V=>this.hPositionRelative(V))),this._parser.registerCsiHandler({final:"b"},(V=>this.repeatPrecedingCharacter(V))),this._parser.registerCsiHandler({final:"c"},(V=>this.sendDeviceAttributesPrimary(V))),this._parser.registerCsiHandler({prefix:">",final:"c"},(V=>this.sendDeviceAttributesSecondary(V))),this._parser.registerCsiHandler({final:"d"},(V=>this.linePosAbsolute(V))),this._parser.registerCsiHandler({final:"e"},(V=>this.vPositionRelative(V))),this._parser.registerCsiHandler({final:"f"},(V=>this.hVPosition(V))),this._parser.registerCsiHandler({final:"g"},(V=>this.tabClear(V))),this._parser.registerCsiHandler({final:"h"},(V=>this.setMode(V))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(V=>this.setModePrivate(V))),this._parser.registerCsiHandler({final:"l"},(V=>this.resetMode(V))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(V=>this.resetModePrivate(V))),this._parser.registerCsiHandler({final:"m"},(V=>this.charAttributes(V))),this._parser.registerCsiHandler({final:"n"},(V=>this.deviceStatus(V))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(V=>this.deviceStatusPrivate(V))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(V=>this.softReset(V))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(V=>this.setCursorStyle(V))),this._parser.registerCsiHandler({final:"r"},(V=>this.setScrollRegion(V))),this._parser.registerCsiHandler({final:"s"},(V=>this.saveCursor(V))),this._parser.registerCsiHandler({final:"t"},(V=>this.windowOptions(V))),this._parser.registerCsiHandler({final:"u"},(V=>this.restoreCursor(V))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(V=>this.insertColumns(V))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(V=>this.deleteColumns(V))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(V=>this.selectProtected(V))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(V=>this.requestMode(V,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(V=>this.requestMode(V,!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((V=>(this.setTitle(V),this.setIconName(V),!0)))),this._parser.registerOscHandler(1,new R.OscHandler((V=>this.setIconName(V)))),this._parser.registerOscHandler(2,new R.OscHandler((V=>this.setTitle(V)))),this._parser.registerOscHandler(4,new R.OscHandler((V=>this.setOrReportIndexedColor(V)))),this._parser.registerOscHandler(8,new R.OscHandler((V=>this.setHyperlink(V)))),this._parser.registerOscHandler(10,new R.OscHandler((V=>this.setOrReportFgColor(V)))),this._parser.registerOscHandler(11,new R.OscHandler((V=>this.setOrReportBgColor(V)))),this._parser.registerOscHandler(12,new R.OscHandler((V=>this.setOrReportCursorColor(V)))),this._parser.registerOscHandler(104,new R.OscHandler((V=>this.restoreIndexedColor(V)))),this._parser.registerOscHandler(110,new R.OscHandler((V=>this.restoreFgColor(V)))),this._parser.registerOscHandler(111,new R.OscHandler((V=>this.restoreBgColor(V)))),this._parser.registerOscHandler(112,new R.OscHandler((V=>this.restoreCursorColor(V)))),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 V in b.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:V},(()=>this.selectCharset("("+V))),this._parser.registerEscHandler({intermediates:")",final:V},(()=>this.selectCharset(")"+V))),this._parser.registerEscHandler({intermediates:"*",final:V},(()=>this.selectCharset("*"+V))),this._parser.registerEscHandler({intermediates:"+",final:V},(()=>this.selectCharset("+"+V))),this._parser.registerEscHandler({intermediates:"-",final:V},(()=>this.selectCharset("-"+V))),this._parser.registerEscHandler({intermediates:".",final:V},(()=>this.selectCharset("."+V))),this._parser.registerEscHandler({intermediates:"/",final:V},(()=>this.selectCharset("/"+V)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((V=>(this._logService.error("Parsing error: ",V),V))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new S.DcsHandler(((V,Z)=>this.requestStatusString(V,Z))))}_preserveStack(P,U,$,K){this._parseStack.paused=!0,this._parseStack.cursorStartX=P,this._parseStack.cursorStartY=U,this._parseStack.decodedLength=$,this._parseStack.position=K}_logSlowResolvingAsync(P){this._logService.logLevel<=j.LogLevelEnum.WARN&&Promise.race([P,new Promise(((U,$)=>setTimeout((()=>$("#SLOW_TIMEOUT")),5e3)))]).catch((U=>{if(U!=="#SLOW_TIMEOUT")throw U;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(P,U){let $,K=this._activeBuffer.x,te=this._activeBuffer.y,oe=0;const we=this._parseStack.paused;if(we){if($=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,U))return this._logSlowResolvingAsync($),$;K=this._parseStack.cursorStartX,te=this._parseStack.cursorStartY,this._parseStack.paused=!1,P.length>B&&(oe=this._parseStack.position+B)}if(this._logService.logLevel<=j.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof P=="string"?` "${P}"`:` "${Array.prototype.map.call(P,(V=>String.fromCharCode(V))).join("")}"`),typeof P=="string"?P.split("").map((V=>V.charCodeAt(0))):P),this._parseBuffer.length<P.length&&this._parseBuffer.length<B&&(this._parseBuffer=new Uint32Array(Math.min(P.length,B))),we||this._dirtyRowTracker.clearRange(),P.length>B)for(let V=oe;V<P.length;V+=B){const Z=V+B<P.length?V+B:P.length,ee=typeof P=="string"?this._stringDecoder.decode(P.substring(V,Z),this._parseBuffer):this._utf8Decoder.decode(P.subarray(V,Z),this._parseBuffer);if($=this._parser.parse(this._parseBuffer,ee))return this._preserveStack(K,te,ee,V),this._logSlowResolvingAsync($),$}else if(!we){const V=typeof P=="string"?this._stringDecoder.decode(P,this._parseBuffer):this._utf8Decoder.decode(P,this._parseBuffer);if($=this._parser.parse(this._parseBuffer,V))return this._preserveStack(K,te,V,0),this._logSlowResolvingAsync($),$}this._activeBuffer.x===K&&this._activeBuffer.y===te||this._onCursorMove.fire();const me=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(me,this._bufferService.rows-1))}print(P,U,$){let K,te;const oe=this._charsetService.charset,we=this._optionsService.rawOptions.screenReaderMode,me=this._bufferService.cols,X=this._coreService.decPrivateModes.wraparound,V=this._coreService.modes.insertMode,Z=this._curAttrData;let ee=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&$-U>0&&ee.getWidth(this._activeBuffer.x-1)===2&&ee.setCellFromCodepoint(this._activeBuffer.x-1,0,1,Z);let ve=this._parser.precedingJoinState;for(let Se=U;Se<$;++Se){if(K=P[Se],K<127&&oe){const Ze=oe[String.fromCharCode(K)];Ze&&(K=Ze.charCodeAt(0))}const Ie=this._unicodeService.charProperties(K,ve);te=T.UnicodeService.extractWidth(Ie);const je=T.UnicodeService.extractShouldJoin(Ie),Je=je?T.UnicodeService.extractWidth(ve):0;if(ve=Ie,we&&this._onA11yChar.fire((0,_.stringFromCodePoint)(K)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+te-Je>me){if(X){const Ze=ee;let Ae=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),ee=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),Je>0&&ee instanceof u.BufferLine&&ee.copyCellsFrom(Ze,Ae,0,Je,!1);Ae<me;)Ze.setCellFromCodepoint(Ae++,0,1,Z)}else if(this._activeBuffer.x=me-1,te===2)continue}if(je&&this._activeBuffer.x){const Ze=ee.getWidth(this._activeBuffer.x-1)?1:2;ee.addCodepointToCell(this._activeBuffer.x-Ze,K,te);for(let Ae=te-Je;--Ae>=0;)ee.setCellFromCodepoint(this._activeBuffer.x++,0,0,Z)}else if(V&&(ee.insertCells(this._activeBuffer.x,te-Je,this._activeBuffer.getNullCell(Z)),ee.getWidth(me-1)===2&&ee.setCellFromCodepoint(me-1,m.NULL_CELL_CODE,m.NULL_CELL_WIDTH,Z)),ee.setCellFromCodepoint(this._activeBuffer.x++,K,te,Z),te>0)for(;--te;)ee.setCellFromCodepoint(this._activeBuffer.x++,0,0,Z)}this._parser.precedingJoinState=ve,this._activeBuffer.x<me&&$-U>0&&ee.getWidth(this._activeBuffer.x)===0&&!ee.hasContent(this._activeBuffer.x)&&ee.setCellFromCodepoint(this._activeBuffer.x,0,1,Z),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(P,U){return P.final!=="t"||P.prefix||P.intermediates?this._parser.registerCsiHandler(P,U):this._parser.registerCsiHandler(P,($=>!F($.params[0],this._optionsService.rawOptions.windowOptions)||U($)))}registerDcsHandler(P,U){return this._parser.registerDcsHandler(P,new S.DcsHandler(U))}registerEscHandler(P,U){return this._parser.registerEscHandler(P,U)}registerOscHandler(P,U){return this._parser.registerOscHandler(P,new R.OscHandler(U))}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 P;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&&((P=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&P.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);U.hasWidth(this._activeBuffer.x)&&!U.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const P=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-P),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(P=this._bufferService.cols-1){this._activeBuffer.x=Math.min(P,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(P,U){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=P,this._activeBuffer.y=this._activeBuffer.scrollTop+U):(this._activeBuffer.x=P,this._activeBuffer.y=U),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(P,U){this._restrictCursor(),this._setCursor(this._activeBuffer.x+P,this._activeBuffer.y+U)}cursorUp(P){const U=this._activeBuffer.y-this._activeBuffer.scrollTop;return U>=0?this._moveCursor(0,-Math.min(U,P.params[0]||1)):this._moveCursor(0,-(P.params[0]||1)),!0}cursorDown(P){const U=this._activeBuffer.scrollBottom-this._activeBuffer.y;return U>=0?this._moveCursor(0,Math.min(U,P.params[0]||1)):this._moveCursor(0,P.params[0]||1),!0}cursorForward(P){return this._moveCursor(P.params[0]||1,0),!0}cursorBackward(P){return this._moveCursor(-(P.params[0]||1),0),!0}cursorNextLine(P){return this.cursorDown(P),this._activeBuffer.x=0,!0}cursorPrecedingLine(P){return this.cursorUp(P),this._activeBuffer.x=0,!0}cursorCharAbsolute(P){return this._setCursor((P.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(P){return this._setCursor(P.length>=2?(P.params[1]||1)-1:0,(P.params[0]||1)-1),!0}charPosAbsolute(P){return this._setCursor((P.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(P){return this._moveCursor(P.params[0]||1,0),!0}linePosAbsolute(P){return this._setCursor(this._activeBuffer.x,(P.params[0]||1)-1),!0}vPositionRelative(P){return this._moveCursor(0,P.params[0]||1),!0}hVPosition(P){return this.cursorPosition(P),!0}tabClear(P){const U=P.params[0];return U===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:U===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(P){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let U=P.params[0]||1;for(;U--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(P){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let U=P.params[0]||1;for(;U--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(P){const U=P.params[0];return U===1&&(this._curAttrData.bg|=536870912),U!==2&&U!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(P,U,$,K=!1,te=!1){const oe=this._activeBuffer.lines.get(this._activeBuffer.ybase+P);oe.replaceCells(U,$,this._activeBuffer.getNullCell(this._eraseAttrData()),te),K&&(oe.isWrapped=!1)}_resetBufferLine(P,U=!1){const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+P);$&&($.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),U),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+P),$.isWrapped=!1)}eraseInDisplay(P,U=!1){let $;switch(this._restrictCursor(this._bufferService.cols),P.params[0]){case 0:for($=this._activeBuffer.y,this._dirtyRowTracker.markDirty($),this._eraseInBufferLine($++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,U);$<this._bufferService.rows;$++)this._resetBufferLine($,U);this._dirtyRowTracker.markDirty($);break;case 1:for($=this._activeBuffer.y,this._dirtyRowTracker.markDirty($),this._eraseInBufferLine($,0,this._activeBuffer.x+1,!0,U),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get($+1).isWrapped=!1);$--;)this._resetBufferLine($,U);this._dirtyRowTracker.markDirty(0);break;case 2:for($=this._bufferService.rows,this._dirtyRowTracker.markDirty($-1);$--;)this._resetBufferLine($,U);this._dirtyRowTracker.markDirty(0);break;case 3:const K=this._activeBuffer.lines.length-this._bufferService.rows;K>0&&(this._activeBuffer.lines.trimStart(K),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-K,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-K,0),this._onScroll.fire(0))}return!0}eraseInLine(P,U=!1){switch(this._restrictCursor(this._bufferService.cols),P.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,U);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,U);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,U)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(P){this._restrictCursor();let U=P.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const $=this._activeBuffer.ybase+this._activeBuffer.y,K=this._bufferService.rows-1-this._activeBuffer.scrollBottom,te=this._bufferService.rows-1+this._activeBuffer.ybase-K+1;for(;U--;)this._activeBuffer.lines.splice(te-1,1),this._activeBuffer.lines.splice($,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(P){this._restrictCursor();let U=P.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const $=this._activeBuffer.ybase+this._activeBuffer.y;let K;for(K=this._bufferService.rows-1-this._activeBuffer.scrollBottom,K=this._bufferService.rows-1+this._activeBuffer.ybase-K;U--;)this._activeBuffer.lines.splice($,1),this._activeBuffer.lines.splice(K,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(P){this._restrictCursor();const U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return U&&(U.insertCells(this._activeBuffer.x,P.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(P){this._restrictCursor();const U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return U&&(U.deleteCells(this._activeBuffer.x,P.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(P){let U=P.params[0]||1;for(;U--;)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(P){let U=P.params[0]||1;for(;U--;)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(u.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(P){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const U=P.params[0]||1;for(let $=this._activeBuffer.scrollTop;$<=this._activeBuffer.scrollBottom;++$){const K=this._activeBuffer.lines.get(this._activeBuffer.ybase+$);K.deleteCells(0,U,this._activeBuffer.getNullCell(this._eraseAttrData())),K.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(P){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const U=P.params[0]||1;for(let $=this._activeBuffer.scrollTop;$<=this._activeBuffer.scrollBottom;++$){const K=this._activeBuffer.lines.get(this._activeBuffer.ybase+$);K.insertCells(0,U,this._activeBuffer.getNullCell(this._eraseAttrData())),K.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(P){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const U=P.params[0]||1;for(let $=this._activeBuffer.scrollTop;$<=this._activeBuffer.scrollBottom;++$){const K=this._activeBuffer.lines.get(this._activeBuffer.ybase+$);K.insertCells(this._activeBuffer.x,U,this._activeBuffer.getNullCell(this._eraseAttrData())),K.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(P){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const U=P.params[0]||1;for(let $=this._activeBuffer.scrollTop;$<=this._activeBuffer.scrollBottom;++$){const K=this._activeBuffer.lines.get(this._activeBuffer.ybase+$);K.deleteCells(this._activeBuffer.x,U,this._activeBuffer.getNullCell(this._eraseAttrData())),K.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(P){this._restrictCursor();const U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return U&&(U.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(P.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(P){const U=this._parser.precedingJoinState;if(!U)return!0;const $=P.params[0]||1,K=T.UnicodeService.extractWidth(U),te=this._activeBuffer.x-K,oe=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(te),we=new Uint32Array(oe.length*$);let me=0;for(let V=0;V<oe.length;){const Z=oe.codePointAt(V)||0;we[me++]=Z,V+=Z>65535?2:1}let X=me;for(let V=1;V<$;++V)we.copyWithin(X,0,me),X+=me;return this.print(we,0,X),!0}sendDeviceAttributesPrimary(P){return P.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(P){return P.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(P.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(h.C0.ESC+"[>83;40003;0c")),!0}_is(P){return(this._optionsService.rawOptions.termName+"").indexOf(P)===0}setMode(P){for(let U=0;U<P.length;U++)switch(P.params[U]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(P){for(let U=0;U<P.length;U++)switch(P.params[U]){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(P){for(let U=0;U<P.length;U++)switch(P.params[U]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(P){for(let U=0;U<P.length;U++)switch(P.params[U]){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(),P.params[U]===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(P,U){const $=this._coreService.decPrivateModes,{activeProtocol:K,activeEncoding:te}=this._coreMouseService,oe=this._coreService,{buffers:we,cols:me}=this._bufferService,{active:X,alt:V}=we,Z=this._optionsService.rawOptions,ee=je=>je?1:2,ve=P.params[0];return Se=ve,Ie=U?ve===2?4:ve===4?ee(oe.modes.insertMode):ve===12?3:ve===20?ee(Z.convertEol):0:ve===1?ee($.applicationCursorKeys):ve===3?Z.windowOptions.setWinLines?me===80?2:me===132?1:0:0:ve===6?ee($.origin):ve===7?ee($.wraparound):ve===8?3:ve===9?ee(K==="X10"):ve===12?ee(Z.cursorBlink):ve===25?ee(!oe.isCursorHidden):ve===45?ee($.reverseWraparound):ve===66?ee($.applicationKeypad):ve===67?4:ve===1e3?ee(K==="VT200"):ve===1002?ee(K==="DRAG"):ve===1003?ee(K==="ANY"):ve===1004?ee($.sendFocus):ve===1005?4:ve===1006?ee(te==="SGR"):ve===1015?4:ve===1016?ee(te==="SGR_PIXELS"):ve===1048?1:ve===47||ve===1047||ve===1049?ee(X===V):ve===2004?ee($.bracketedPasteMode):0,oe.triggerDataEvent(`${h.C0.ESC}[${U?"":"?"}${Se};${Ie}$y`),!0;var Se,Ie}_updateAttrColor(P,U,$,K,te){return U===2?(P|=50331648,P&=-16777216,P|=x.AttributeData.fromColorRGB([$,K,te])):U===5&&(P&=-50331904,P|=33554432|255&$),P}_extractColor(P,U,$){const K=[0,0,-1,0,0,0];let te=0,oe=0;do{if(K[oe+te]=P.params[U+oe],P.hasSubParams(U+oe)){const we=P.getSubParams(U+oe);let me=0;do K[1]===5&&(te=1),K[oe+me+1+te]=we[me];while(++me<we.length&&me+oe+1+te<K.length);break}if(K[1]===5&&oe+te>=2||K[1]===2&&oe+te>=5)break;K[1]&&(te=1)}while(++oe+U<P.length&&oe+te<K.length);for(let we=2;we<K.length;++we)K[we]===-1&&(K[we]=0);switch(K[0]){case 38:$.fg=this._updateAttrColor($.fg,K[1],K[3],K[4],K[5]);break;case 48:$.bg=this._updateAttrColor($.bg,K[1],K[3],K[4],K[5]);break;case 58:$.extended=$.extended.clone(),$.extended.underlineColor=this._updateAttrColor($.extended.underlineColor,K[1],K[3],K[4],K[5])}return oe}_processUnderline(P,U){U.extended=U.extended.clone(),(!~P||P>5)&&(P=1),U.extended.underlineStyle=P,U.fg|=268435456,P===0&&(U.fg&=-268435457),U.updateExtended()}_processSGR0(P){P.fg=u.DEFAULT_ATTR_DATA.fg,P.bg=u.DEFAULT_ATTR_DATA.bg,P.extended=P.extended.clone(),P.extended.underlineStyle=0,P.extended.underlineColor&=-67108864,P.updateExtended()}charAttributes(P){if(P.length===1&&P.params[0]===0)return this._processSGR0(this._curAttrData),!0;const U=P.length;let $;const K=this._curAttrData;for(let te=0;te<U;te++)$=P.params[te],$>=30&&$<=37?(K.fg&=-50331904,K.fg|=16777216|$-30):$>=40&&$<=47?(K.bg&=-50331904,K.bg|=16777216|$-40):$>=90&&$<=97?(K.fg&=-50331904,K.fg|=16777224|$-90):$>=100&&$<=107?(K.bg&=-50331904,K.bg|=16777224|$-100):$===0?this._processSGR0(K):$===1?K.fg|=134217728:$===3?K.bg|=67108864:$===4?(K.fg|=268435456,this._processUnderline(P.hasSubParams(te)?P.getSubParams(te)[0]:1,K)):$===5?K.fg|=536870912:$===7?K.fg|=67108864:$===8?K.fg|=1073741824:$===9?K.fg|=2147483648:$===2?K.bg|=134217728:$===21?this._processUnderline(2,K):$===22?(K.fg&=-134217729,K.bg&=-134217729):$===23?K.bg&=-67108865:$===24?(K.fg&=-268435457,this._processUnderline(0,K)):$===25?K.fg&=-536870913:$===27?K.fg&=-67108865:$===28?K.fg&=-1073741825:$===29?K.fg&=2147483647:$===39?(K.fg&=-67108864,K.fg|=16777215&u.DEFAULT_ATTR_DATA.fg):$===49?(K.bg&=-67108864,K.bg|=16777215&u.DEFAULT_ATTR_DATA.bg):$===38||$===48||$===58?te+=this._extractColor(P,te,K):$===53?K.bg|=1073741824:$===55?K.bg&=-1073741825:$===59?(K.extended=K.extended.clone(),K.extended.underlineColor=-1,K.updateExtended()):$===100?(K.fg&=-67108864,K.fg|=16777215&u.DEFAULT_ATTR_DATA.fg,K.bg&=-67108864,K.bg|=16777215&u.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",$);return!0}deviceStatus(P){switch(P.params[0]){case 5:this._coreService.triggerDataEvent(`${h.C0.ESC}[0n`);break;case 6:const U=this._activeBuffer.y+1,$=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${h.C0.ESC}[${U};${$}R`)}return!0}deviceStatusPrivate(P){if(P.params[0]===6){const U=this._activeBuffer.y+1,$=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${h.C0.ESC}[?${U};${$}R`)}return!0}softReset(P){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=u.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(P){const U=P.params[0]||1;switch(U){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%2==1;return this._optionsService.options.cursorBlink=$,!0}setScrollRegion(P){const U=P.params[0]||1;let $;return(P.length<2||($=P.params[1])>this._bufferService.rows||$===0)&&($=this._bufferService.rows),$>U&&(this._activeBuffer.scrollTop=U-1,this._activeBuffer.scrollBottom=$-1,this._setCursor(0,0)),!0}windowOptions(P){if(!F(P.params[0],this._optionsService.rawOptions.windowOptions))return!0;const U=P.length>1?P.params[1]:0;switch(P.params[0]){case 14:U!==2&&this._onRequestWindowsOptionsReport.fire(D.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(D.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:U!==0&&U!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),U!==0&&U!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:U!==0&&U!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),U!==0&&U!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(P){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(P){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(P){return this._windowTitle=P,this._onTitleChange.fire(P),!0}setIconName(P){return this._iconName=P,!0}setOrReportIndexedColor(P){const U=[],$=P.split(";");for(;$.length>1;){const K=$.shift(),te=$.shift();if(/^\d+$/.exec(K)){const oe=parseInt(K);if(Y(oe))if(te==="?")U.push({type:0,index:oe});else{const we=(0,L.parseColor)(te);we&&U.push({type:1,index:oe,color:we})}}}return U.length&&this._onColor.fire(U),!0}setHyperlink(P){const U=P.split(";");return!(U.length<2)&&(U[1]?this._createHyperlink(U[0],U[1]):!U[0]&&this._finishHyperlink())}_createHyperlink(P,U){this._getCurrentLinkId()&&this._finishHyperlink();const $=P.split(":");let K;const te=$.findIndex((oe=>oe.startsWith("id=")));return te!==-1&&(K=$[te].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:K,uri:U}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(P,U){const $=P.split(";");for(let K=0;K<$.length&&!(U>=this._specialColors.length);++K,++U)if($[K]==="?")this._onColor.fire([{type:0,index:this._specialColors[U]}]);else{const te=(0,L.parseColor)($[K]);te&&this._onColor.fire([{type:1,index:this._specialColors[U],color:te}])}return!0}setOrReportFgColor(P){return this._setOrReportSpecialColor(P,0)}setOrReportBgColor(P){return this._setOrReportSpecialColor(P,1)}setOrReportCursorColor(P){return this._setOrReportSpecialColor(P,2)}restoreIndexedColor(P){if(!P)return this._onColor.fire([{type:2}]),!0;const U=[],$=P.split(";");for(let K=0;K<$.length;++K)if(/^\d+$/.exec($[K])){const te=parseInt($[K]);Y(te)&&U.push({type:2,index:te})}return U.length&&this._onColor.fire(U),!0}restoreFgColor(P){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(P){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(P){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(P){return P.length!==2?(this.selectDefaultCharset(),!0):(P[0]==="/"||this._charsetService.setgCharset(I[P[0]],b.CHARSETS[P[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 P=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,P,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=u.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=u.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(P){return this._charsetService.setgLevel(P),!0}screenAlignmentPattern(){const P=new f.CellData;P.content=4194373,P.fg=this._curAttrData.fg,P.bg=this._curAttrData.bg,this._setCursor(0,0);for(let U=0;U<this._bufferService.rows;++U){const $=this._activeBuffer.ybase+this._activeBuffer.y+U,K=this._activeBuffer.lines.get($);K&&(K.fill(P),K.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(P,U){const $=this._bufferService.buffer,K=this._optionsService.rawOptions;return(te=>(this._coreService.triggerDataEvent(`${h.C0.ESC}${te}${h.C0.ESC}\\`),!0))(P==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:P==='"p'?'P1$r61;1"p':P==="r"?`P1$r${$.scrollTop+1};${$.scrollBottom+1}r`:P==="m"?"P1$r0m":P===" q"?`P1$r${{block:2,underline:4,bar:6}[K.cursorStyle]-(K.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(P,U){this._dirtyRowTracker.markRangeDirty(P,U)}}i.InputHandler=W;let G=class{constructor(z){this._bufferService=z,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(z){z<this.start?this.start=z:z>this.end&&(this.end=z)}markRangeDirty(z,P){z>P&&(H=z,z=P,P=H),z<this.start&&(this.start=z),P>this.end&&(this.end=P)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function Y(z){return 0<=z&&z<256}G=g([v(0,j.IBufferService)],G)},844:(y,i)=>{function c(g){for(const v of g)v.dispose();g.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 g of this._disposables)g.dispose();this._disposables.length=0}register(g){return this._disposables.push(g),g}unregister(g){const v=this._disposables.indexOf(g);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(g){var v;this._isDisposed||g===this._value||((v=this._value)==null||v.dispose(),this._value=g)}clear(){this.value=void 0}dispose(){var g;this._isDisposed=!0,(g=this._value)==null||g.dispose(),this._value=void 0}},i.toDisposable=function(g){return{dispose:g}},i.disposeArray=c,i.getDisposeArrayDisposable=function(g){return{dispose:()=>c(g)}}},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(g,v,h,b,E){this._data.get(g,v)||this._data.set(g,v,new c),this._data.get(g,v).set(h,b,E)}get(g,v,h,b){var E;return(E=this._data.get(g,v))==null?void 0:E.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,g=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(g),i.isIpad=g==="iPad",i.isIphone=g==="iPhone",i.isWindows=["Windows","Win16","Win32","WinCE"].includes(g),i.isLinux=g.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(g){this._getKey=g,this._array=[]}clear(){this._array.length=0}insert(g){this._array.length!==0?(c=this._search(this._getKey(g)),this._array.splice(c,0,g)):this._array.push(g)}delete(g){if(this._array.length===0)return!1;const v=this._getKey(g);if(v===void 0||(c=this._search(v),c===-1)||this._getKey(this._array[c])!==v)return!1;do if(this._array[c]===g)return this._array.splice(c,1),!0;while(++c<this._array.length&&this._getKey(this._array[c])===v);return!1}*getKeyIterator(g){if(this._array.length!==0&&(c=this._search(g),!(c<0||c>=this._array.length)&&this._getKey(this._array[c])===g))do yield this._array[c];while(++c<this._array.length&&this._getKey(this._array[c])===g)}forEachByKey(g,v){if(this._array.length!==0&&(c=this._search(g),!(c<0||c>=this._array.length)&&this._getKey(this._array[c])===g))do v(this._array[c]);while(++c<this._array.length&&this._getKey(this._array[c])===g)}values(){return[...this._array].values()}_search(g){let v=0,h=this._array.length-1;for(;h>=v;){let b=v+h>>1;const E=this._getKey(this._array[b]);if(E>g)h=b-1;else{if(!(E<g)){for(;b>0&&this._getKey(this._array[b-1])===g;)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 g=c(6114);class v{constructor(){this._tasks=[],this._i=0}enqueue(E){this._tasks.push(E),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(E){this._idleCallback=void 0;let N=0,_=0,u=E.timeRemaining(),p=0;for(;this._i<this._tasks.length;){if(N=Date.now(),this._tasks[this._i]()||this._i++,N=Math.max(1,Date.now()-N),_=Math.max(N,_),p=E.timeRemaining(),1.5*_>p)return u-N<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(u-N))}ms`),void this._start();u=p}this.clear()}}class h extends v{_requestCallback(E){return setTimeout((()=>E(this._createDeadline(16))))}_cancelCallback(E){clearTimeout(E)}_createDeadline(E){const N=Date.now()+E;return{timeRemaining:()=>Math.max(0,N-Date.now())}}}i.PriorityTaskQueue=h,i.IdleTaskQueue=!g.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 g=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),E=v.buffer.lines.get(v.buffer.ybase+v.buffer.y);E&&b&&(E.isWrapped=b[g.CHAR_DATA_CODE_INDEX]!==g.NULL_CELL_CODE&&b[g.CHAR_DATA_CODE_INDEX]!==g.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 g}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 g{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 g(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}i.ExtendedAttrs=g},9092:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Buffer=i.MAX_BUFFER_SIZE=void 0;const g=c(6349),v=c(7226),h=c(3734),b=c(8437),E=c(4634),N=c(511),_=c(643),u=c(4863),p=c(7116);i.MAX_BUFFER_SIZE=4294967295,i.Buffer=class{constructor(m,f,x){this._hasScrollback=m,this._optionsService=f,this._bufferService=x,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=p.DEFAULT_CHARSET,this.markers=[],this._nullCell=N.CellData.fromCharData([0,_.NULL_CELL_CHAR,_.NULL_CELL_WIDTH,_.NULL_CELL_CODE]),this._whitespaceCell=N.CellData.fromCharData([0,_.WHITESPACE_CELL_CHAR,_.WHITESPACE_CELL_WIDTH,_.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 g.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(m){return m?(this._nullCell.fg=m.fg,this._nullCell.bg=m.bg,this._nullCell.extended=m.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new h.ExtendedAttrs),this._nullCell}getWhitespaceCell(m){return m?(this._whitespaceCell.fg=m.fg,this._whitespaceCell.bg=m.bg,this._whitespaceCell.extended=m.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new h.ExtendedAttrs),this._whitespaceCell}getBlankLine(m,f){return new b.BufferLine(this._bufferService.cols,this.getNullCell(m),f)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const m=this.ybase+this.y-this.ydisp;return m>=0&&m<this._rows}_getCorrectBufferLength(m){if(!this._hasScrollback)return m;const f=m+this._optionsService.rawOptions.scrollback;return f>i.MAX_BUFFER_SIZE?i.MAX_BUFFER_SIZE:f}fillViewportRows(m){if(this.lines.length===0){m===void 0&&(m=b.DEFAULT_ATTR_DATA);let f=this._rows;for(;f--;)this.lines.push(this.getBlankLine(m))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new g.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(m,f){const x=this.getNullCell(b.DEFAULT_ATTR_DATA);let j=0;const T=this._getCorrectBufferLength(f);if(T>this.lines.maxLength&&(this.lines.maxLength=T),this.lines.length>0){if(this._cols<m)for(let S=0;S<this.lines.length;S++)j+=+this.lines.get(S).resize(m,x);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(m,x)):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(m,x)));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(T<this.lines.maxLength){const S=this.lines.length-T;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=T}this.x=Math.min(this.x,m-1),this.y=Math.min(this.y,f-1),R&&(this.y+=R),this.savedX=Math.min(this.savedX,m-1),this.scrollTop=0}if(this.scrollBottom=f-1,this._isReflowEnabled&&(this._reflow(m,f),this._cols>m))for(let R=0;R<this.lines.length;R++)j+=+this.lines.get(R).resize(m,x);this._cols=m,this._rows=f,this._memoryCleanupQueue.clear(),j>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let m=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,m=!1);let f=0;for(;this._memoryCleanupPosition<this.lines.length;)if(f+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),f>100)return!0;return m}get _isReflowEnabled(){const m=this._optionsService.rawOptions.windowsPty;return m&&m.buildNumber?this._hasScrollback&&m.backend==="conpty"&&m.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(m,f){this._cols!==m&&(m>this._cols?this._reflowLarger(m,f):this._reflowSmaller(m,f))}_reflowLarger(m,f){const x=(0,E.reflowLargerGetLinesToRemove)(this.lines,this._cols,m,this.ybase+this.y,this.getNullCell(b.DEFAULT_ATTR_DATA));if(x.length>0){const j=(0,E.reflowLargerCreateNewLayout)(this.lines,x);(0,E.reflowLargerApplyNewLayout)(this.lines,j.layout),this._reflowLargerAdjustViewport(m,f,j.countRemoved)}}_reflowLargerAdjustViewport(m,f,x){const j=this.getNullCell(b.DEFAULT_ATTR_DATA);let T=x;for(;T-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<f&&this.lines.push(new b.BufferLine(m,j))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-x,0)}_reflowSmaller(m,f){const x=this.getNullCell(b.DEFAULT_ATTR_DATA),j=[];let T=0;for(let R=this.lines.length-1;R>=0;R--){let S=this.lines.get(R);if(!S||!S.isWrapped&&S.getTrimmedLength()<=m)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 B=L[L.length-1].getTrimmedLength(),F=(0,E.reflowSmallerGetNewLineLengths)(L,this._cols,m),D=F.length-L.length;let H;H=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+D):Math.max(0,this.lines.length-this.lines.maxLength+D);const W=[];for(let $=0;$<D;$++){const K=this.getBlankLine(b.DEFAULT_ATTR_DATA,!0);W.push(K)}W.length>0&&(j.push({start:R+L.length+T,newLines:W}),T+=W.length),L.push(...W);let G=F.length-1,Y=F[G];Y===0&&(G--,Y=F[G]);let z=L.length-D-1,P=B;for(;z>=0;){const $=Math.min(P,Y);if(L[G]===void 0)break;if(L[G].copyCellsFrom(L[z],P-$,Y-$,$,!0),Y-=$,Y===0&&(G--,Y=F[G]),P-=$,P===0){z--;const K=Math.max(z,0);P=(0,E.getWrappedLineTrimmedLength)(L,K,this._cols)}}for(let $=0;$<L.length;$++)F[$]<m&&L[$].setCell(F[$],x);let U=D-H;for(;U-- >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+T)-f&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+D,this.ybase+f-1)}if(j.length>0){const R=[],S=[];for(let G=0;G<this.lines.length;G++)S.push(this.lines.get(G));const L=this.lines.length;let I=L-1,B=0,F=j[B];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+T);let D=0;for(let G=Math.min(this.lines.maxLength-1,L+T-1);G>=0;G--)if(F&&F.start>I+D){for(let Y=F.newLines.length-1;Y>=0;Y--)this.lines.set(G--,F.newLines[Y]);G++,R.push({index:I+1,amount:F.newLines.length}),D+=F.newLines.length,F=j[++B]}else this.lines.set(G,S[I--]);let H=0;for(let G=R.length-1;G>=0;G--)R[G].index+=H,this.lines.onInsertEmitter.fire(R[G]),H+=R[G].amount;const W=Math.max(0,L+T-this.lines.maxLength);W>0&&this.lines.onTrimEmitter.fire(W)}}translateBufferLineToString(m,f,x=0,j){const T=this.lines.get(m);return T?T.translateToString(f,x,j):""}getWrappedRangeForLine(m){let f=m,x=m;for(;f>0&&this.lines.get(f).isWrapped;)f--;for(;x+1<this.lines.length&&this.lines.get(x+1).isWrapped;)x++;return{first:f,last:x}}setupTabStops(m){for(m!=null?this.tabs[m]||(m=this.prevStop(m)):(this.tabs={},m=0);m<this._cols;m+=this._optionsService.rawOptions.tabStopWidth)this.tabs[m]=!0}prevStop(m){for(m==null&&(m=this.x);!this.tabs[--m]&&m>0;);return m>=this._cols?this._cols-1:m<0?0:m}nextStop(m){for(m==null&&(m=this.x);!this.tabs[++m]&&m<this._cols;);return m>=this._cols?this._cols-1:m<0?0:m}clearMarkers(m){this._isClearing=!0;for(let f=0;f<this.markers.length;f++)this.markers[f].line===m&&(this.markers[f].dispose(),this.markers.splice(f--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let m=0;m<this.markers.length;m++)this.markers[m].dispose(),this.markers.splice(m--,1);this._isClearing=!1}addMarker(m){const f=new u.Marker(m);return this.markers.push(f),f.register(this.lines.onTrim((x=>{f.line-=x,f.line<0&&f.dispose()}))),f.register(this.lines.onInsert((x=>{f.line>=x.index&&(f.line+=x.amount)}))),f.register(this.lines.onDelete((x=>{f.line>=x.index&&f.line<x.index+x.amount&&f.dispose(),f.line>x.index&&(f.line-=x.amount)}))),f.register(f.onDispose((()=>this._removeMarker(f)))),f}_removeMarker(m){this._isClearing||this.markers.splice(this.markers.indexOf(m),1)}}},8437:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferLine=i.DEFAULT_ATTR_DATA=void 0;const g=c(3734),v=c(511),h=c(643),b=c(482);i.DEFAULT_ATTR_DATA=Object.freeze(new g.AttributeData);let E=0;class N{constructor(u,p,m=!1){this.isWrapped=m,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*u);const f=p||v.CellData.fromCharData([0,h.NULL_CELL_CHAR,h.NULL_CELL_WIDTH,h.NULL_CELL_CODE]);for(let x=0;x<u;++x)this.setCell(x,f);this.length=u}get(u){const p=this._data[3*u+0],m=2097151&p;return[this._data[3*u+1],2097152&p?this._combined[u]:m?(0,b.stringFromCodePoint)(m):"",p>>22,2097152&p?this._combined[u].charCodeAt(this._combined[u].length-1):m]}set(u,p){this._data[3*u+1]=p[h.CHAR_DATA_ATTR_INDEX],p[h.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[u]=p[1],this._data[3*u+0]=2097152|u|p[h.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*u+0]=p[h.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|p[h.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(u){return this._data[3*u+0]>>22}hasWidth(u){return 12582912&this._data[3*u+0]}getFg(u){return this._data[3*u+1]}getBg(u){return this._data[3*u+2]}hasContent(u){return 4194303&this._data[3*u+0]}getCodePoint(u){const p=this._data[3*u+0];return 2097152&p?this._combined[u].charCodeAt(this._combined[u].length-1):2097151&p}isCombined(u){return 2097152&this._data[3*u+0]}getString(u){const p=this._data[3*u+0];return 2097152&p?this._combined[u]:2097151&p?(0,b.stringFromCodePoint)(2097151&p):""}isProtected(u){return 536870912&this._data[3*u+2]}loadCell(u,p){return E=3*u,p.content=this._data[E+0],p.fg=this._data[E+1],p.bg=this._data[E+2],2097152&p.content&&(p.combinedData=this._combined[u]),268435456&p.bg&&(p.extended=this._extendedAttrs[u]),p}setCell(u,p){2097152&p.content&&(this._combined[u]=p.combinedData),268435456&p.bg&&(this._extendedAttrs[u]=p.extended),this._data[3*u+0]=p.content,this._data[3*u+1]=p.fg,this._data[3*u+2]=p.bg}setCellFromCodepoint(u,p,m,f){268435456&f.bg&&(this._extendedAttrs[u]=f.extended),this._data[3*u+0]=p|m<<22,this._data[3*u+1]=f.fg,this._data[3*u+2]=f.bg}addCodepointToCell(u,p,m){let f=this._data[3*u+0];2097152&f?this._combined[u]+=(0,b.stringFromCodePoint)(p):2097151&f?(this._combined[u]=(0,b.stringFromCodePoint)(2097151&f)+(0,b.stringFromCodePoint)(p),f&=-2097152,f|=2097152):f=p|4194304,m&&(f&=-12582913,f|=m<<22),this._data[3*u+0]=f}insertCells(u,p,m){if((u%=this.length)&&this.getWidth(u-1)===2&&this.setCellFromCodepoint(u-1,0,1,m),p<this.length-u){const f=new v.CellData;for(let x=this.length-u-p-1;x>=0;--x)this.setCell(u+p+x,this.loadCell(u+x,f));for(let x=0;x<p;++x)this.setCell(u+x,m)}else for(let f=u;f<this.length;++f)this.setCell(f,m);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,m)}deleteCells(u,p,m){if(u%=this.length,p<this.length-u){const f=new v.CellData;for(let x=0;x<this.length-u-p;++x)this.setCell(u+x,this.loadCell(u+p+x,f));for(let x=this.length-p;x<this.length;++x)this.setCell(x,m)}else for(let f=u;f<this.length;++f)this.setCell(f,m);u&&this.getWidth(u-1)===2&&this.setCellFromCodepoint(u-1,0,1,m),this.getWidth(u)!==0||this.hasContent(u)||this.setCellFromCodepoint(u,0,1,m)}replaceCells(u,p,m,f=!1){if(f)for(u&&this.getWidth(u-1)===2&&!this.isProtected(u-1)&&this.setCellFromCodepoint(u-1,0,1,m),p<this.length&&this.getWidth(p-1)===2&&!this.isProtected(p)&&this.setCellFromCodepoint(p,0,1,m);u<p&&u<this.length;)this.isProtected(u)||this.setCell(u,m),u++;else for(u&&this.getWidth(u-1)===2&&this.setCellFromCodepoint(u-1,0,1,m),p<this.length&&this.getWidth(p-1)===2&&this.setCellFromCodepoint(p,0,1,m);u<p&&u<this.length;)this.setCell(u++,m)}resize(u,p){if(u===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const m=3*u;if(u>this.length){if(this._data.buffer.byteLength>=4*m)this._data=new Uint32Array(this._data.buffer,0,m);else{const f=new Uint32Array(m);f.set(this._data),this._data=f}for(let f=this.length;f<u;++f)this.setCell(f,p)}else{this._data=this._data.subarray(0,m);const f=Object.keys(this._combined);for(let j=0;j<f.length;j++){const T=parseInt(f[j],10);T>=u&&delete this._combined[T]}const x=Object.keys(this._extendedAttrs);for(let j=0;j<x.length;j++){const T=parseInt(x[j],10);T>=u&&delete this._extendedAttrs[T]}}return this.length=u,4*m*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const u=new Uint32Array(this._data.length);return u.set(this._data),this._data=u,1}return 0}fill(u,p=!1){if(p)for(let m=0;m<this.length;++m)this.isProtected(m)||this.setCell(m,u);else{this._combined={},this._extendedAttrs={};for(let m=0;m<this.length;++m)this.setCell(m,u)}}copyFrom(u){this.length!==u.length?this._data=new Uint32Array(u._data):this._data.set(u._data),this.length=u.length,this._combined={};for(const p in u._combined)this._combined[p]=u._combined[p];this._extendedAttrs={};for(const p in u._extendedAttrs)this._extendedAttrs[p]=u._extendedAttrs[p];this.isWrapped=u.isWrapped}clone(){const u=new N(0);u._data=new Uint32Array(this._data),u.length=this.length;for(const p in this._combined)u._combined[p]=this._combined[p];for(const p in this._extendedAttrs)u._extendedAttrs[p]=this._extendedAttrs[p];return u.isWrapped=this.isWrapped,u}getTrimmedLength(){for(let u=this.length-1;u>=0;--u)if(4194303&this._data[3*u+0])return u+(this._data[3*u+0]>>22);return 0}getNoBgTrimmedLength(){for(let u=this.length-1;u>=0;--u)if(4194303&this._data[3*u+0]||50331648&this._data[3*u+2])return u+(this._data[3*u+0]>>22);return 0}copyCellsFrom(u,p,m,f,x){const j=u._data;if(x)for(let R=f-1;R>=0;R--){for(let S=0;S<3;S++)this._data[3*(m+R)+S]=j[3*(p+R)+S];268435456&j[3*(p+R)+2]&&(this._extendedAttrs[m+R]=u._extendedAttrs[p+R])}else for(let R=0;R<f;R++){for(let S=0;S<3;S++)this._data[3*(m+R)+S]=j[3*(p+R)+S];268435456&j[3*(p+R)+2]&&(this._extendedAttrs[m+R]=u._extendedAttrs[p+R])}const T=Object.keys(u._combined);for(let R=0;R<T.length;R++){const S=parseInt(T[R],10);S>=p&&(this._combined[S-p+m]=u._combined[S])}}translateToString(u,p,m,f){p=p??0,m=m??this.length,u&&(m=Math.min(m,this.getTrimmedLength())),f&&(f.length=0);let x="";for(;p<m;){const j=this._data[3*p+0],T=2097151&j,R=2097152&j?this._combined[p]:T?(0,b.stringFromCodePoint)(T):h.WHITESPACE_CELL_CHAR;if(x+=R,f)for(let S=0;S<R.length;++S)f.push(p);p+=j>>22||1}return f&&f.push(p),x}}i.BufferLine=N},4841:(y,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.getRangeLength=void 0,i.getRangeLength=function(c,g){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 g*(c.end.y-c.start.y)+(c.end.x-c.start.x+1)}},4634:(y,i)=>{function c(g,v,h){if(v===g.length-1)return g[v].getTrimmedLength();const b=!g[v].hasContent(h-1)&&g[v].getWidth(h-1)===1,E=g[v+1].getWidth(0)===2;return b&&E?h-1:h}Object.defineProperty(i,"__esModule",{value:!0}),i.getWrappedLineTrimmedLength=i.reflowSmallerGetNewLineLengths=i.reflowLargerApplyNewLayout=i.reflowLargerCreateNewLayout=i.reflowLargerGetLinesToRemove=void 0,i.reflowLargerGetLinesToRemove=function(g,v,h,b,E){const N=[];for(let _=0;_<g.length-1;_++){let u=_,p=g.get(++u);if(!p.isWrapped)continue;const m=[g.get(_)];for(;u<g.length&&p.isWrapped;)m.push(p),p=g.get(++u);if(b>=_&&b<u){_+=m.length-1;continue}let f=0,x=c(m,f,v),j=1,T=0;for(;j<m.length;){const S=c(m,j,v),L=S-T,I=h-x,B=Math.min(L,I);m[f].copyCellsFrom(m[j],T,x,B,!1),x+=B,x===h&&(f++,x=0),T+=B,T===S&&(j++,T=0),x===0&&f!==0&&m[f-1].getWidth(h-1)===2&&(m[f].copyCellsFrom(m[f-1],h-1,x++,1,!1),m[f-1].setCell(h-1,E))}m[f].replaceCells(x,h,E);let R=0;for(let S=m.length-1;S>0&&(S>f||m[S].getTrimmedLength()===0);S--)R++;R>0&&(N.push(_+m.length-R),N.push(R)),_+=m.length-1}return N},i.reflowLargerCreateNewLayout=function(g,v){const h=[];let b=0,E=v[b],N=0;for(let _=0;_<g.length;_++)if(E===_){const u=v[++b];g.onDeleteEmitter.fire({index:_-N,amount:u}),_+=u-1,N+=u,E=v[++b]}else h.push(_);return{layout:h,countRemoved:N}},i.reflowLargerApplyNewLayout=function(g,v){const h=[];for(let b=0;b<v.length;b++)h.push(g.get(v[b]));for(let b=0;b<h.length;b++)g.set(b,h[b]);g.length=v.length},i.reflowSmallerGetNewLineLengths=function(g,v,h){const b=[],E=g.map(((p,m)=>c(g,m,v))).reduce(((p,m)=>p+m));let N=0,_=0,u=0;for(;u<E;){if(E-u<h){b.push(E-u);break}N+=h;const p=c(g,_,v);N>p&&(N-=p,_++);const m=g[_].getWidth(N-1)===2;m&&N--;const f=m?h-1:h;b.push(f),u+=f}return b},i.getWrappedLineTrimmedLength=c},5295:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferSet=void 0;const g=c(8460),v=c(844),h=c(9092);class b extends v.Disposable{constructor(N,_){super(),this._optionsService=N,this._bufferService=_,this._onBufferActivate=this.register(new g.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,_){this._normal.resize(N,_),this._alt.resize(N,_),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 g=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 _=new b;return _.setFromCharData(N),_}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,g.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 _=!1;if(N[v.CHAR_DATA_CHAR_INDEX].length>2)_=!0;else if(N[v.CHAR_DATA_CHAR_INDEX].length===2){const u=N[v.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=u&&u<=56319){const p=N[v.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=p&&p<=57343?this.content=1024*(u-55296)+p-56320+65536|N[v.CHAR_DATA_WIDTH_INDEX]<<22:_=!0}else _=!0}else this.content=N[v.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|N[v.CHAR_DATA_WIDTH_INDEX]<<22;_&&(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 g=c(8460),v=c(844);class h{get id(){return this._id}constructor(E){this.line=E,this.isDisposed=!1,this._disposables=[],this._id=h._nextId++,this._onDispose=this.register(new g.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(E){return this._disposables.push(E),E}}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,g,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=""})(g||(i.C1=g={})),(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 g=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,E,N){const _={type:0,cancel:!1,key:void 0},u=(h.shiftKey?1:0)|(h.altKey?2:0)|(h.ctrlKey?4:0)|(h.metaKey?8:0);switch(h.keyCode){case 0:h.key==="UIKeyInputUpArrow"?_.key=b?g.C0.ESC+"OA":g.C0.ESC+"[A":h.key==="UIKeyInputLeftArrow"?_.key=b?g.C0.ESC+"OD":g.C0.ESC+"[D":h.key==="UIKeyInputRightArrow"?_.key=b?g.C0.ESC+"OC":g.C0.ESC+"[C":h.key==="UIKeyInputDownArrow"&&(_.key=b?g.C0.ESC+"OB":g.C0.ESC+"[B");break;case 8:_.key=h.ctrlKey?"\b":g.C0.DEL,h.altKey&&(_.key=g.C0.ESC+_.key);break;case 9:if(h.shiftKey){_.key=g.C0.ESC+"[Z";break}_.key=g.C0.HT,_.cancel=!0;break;case 13:_.key=h.altKey?g.C0.ESC+g.C0.CR:g.C0.CR,_.cancel=!0;break;case 27:_.key=g.C0.ESC,h.altKey&&(_.key=g.C0.ESC+g.C0.ESC),_.cancel=!0;break;case 37:if(h.metaKey)break;u?(_.key=g.C0.ESC+"[1;"+(u+1)+"D",_.key===g.C0.ESC+"[1;3D"&&(_.key=g.C0.ESC+(E?"b":"[1;5D"))):_.key=b?g.C0.ESC+"OD":g.C0.ESC+"[D";break;case 39:if(h.metaKey)break;u?(_.key=g.C0.ESC+"[1;"+(u+1)+"C",_.key===g.C0.ESC+"[1;3C"&&(_.key=g.C0.ESC+(E?"f":"[1;5C"))):_.key=b?g.C0.ESC+"OC":g.C0.ESC+"[C";break;case 38:if(h.metaKey)break;u?(_.key=g.C0.ESC+"[1;"+(u+1)+"A",E||_.key!==g.C0.ESC+"[1;3A"||(_.key=g.C0.ESC+"[1;5A")):_.key=b?g.C0.ESC+"OA":g.C0.ESC+"[A";break;case 40:if(h.metaKey)break;u?(_.key=g.C0.ESC+"[1;"+(u+1)+"B",E||_.key!==g.C0.ESC+"[1;3B"||(_.key=g.C0.ESC+"[1;5B")):_.key=b?g.C0.ESC+"OB":g.C0.ESC+"[B";break;case 45:h.shiftKey||h.ctrlKey||(_.key=g.C0.ESC+"[2~");break;case 46:_.key=u?g.C0.ESC+"[3;"+(u+1)+"~":g.C0.ESC+"[3~";break;case 36:_.key=u?g.C0.ESC+"[1;"+(u+1)+"H":b?g.C0.ESC+"OH":g.C0.ESC+"[H";break;case 35:_.key=u?g.C0.ESC+"[1;"+(u+1)+"F":b?g.C0.ESC+"OF":g.C0.ESC+"[F";break;case 33:h.shiftKey?_.type=2:h.ctrlKey?_.key=g.C0.ESC+"[5;"+(u+1)+"~":_.key=g.C0.ESC+"[5~";break;case 34:h.shiftKey?_.type=3:h.ctrlKey?_.key=g.C0.ESC+"[6;"+(u+1)+"~":_.key=g.C0.ESC+"[6~";break;case 112:_.key=u?g.C0.ESC+"[1;"+(u+1)+"P":g.C0.ESC+"OP";break;case 113:_.key=u?g.C0.ESC+"[1;"+(u+1)+"Q":g.C0.ESC+"OQ";break;case 114:_.key=u?g.C0.ESC+"[1;"+(u+1)+"R":g.C0.ESC+"OR";break;case 115:_.key=u?g.C0.ESC+"[1;"+(u+1)+"S":g.C0.ESC+"OS";break;case 116:_.key=u?g.C0.ESC+"[15;"+(u+1)+"~":g.C0.ESC+"[15~";break;case 117:_.key=u?g.C0.ESC+"[17;"+(u+1)+"~":g.C0.ESC+"[17~";break;case 118:_.key=u?g.C0.ESC+"[18;"+(u+1)+"~":g.C0.ESC+"[18~";break;case 119:_.key=u?g.C0.ESC+"[19;"+(u+1)+"~":g.C0.ESC+"[19~";break;case 120:_.key=u?g.C0.ESC+"[20;"+(u+1)+"~":g.C0.ESC+"[20~";break;case 121:_.key=u?g.C0.ESC+"[21;"+(u+1)+"~":g.C0.ESC+"[21~";break;case 122:_.key=u?g.C0.ESC+"[23;"+(u+1)+"~":g.C0.ESC+"[23~";break;case 123:_.key=u?g.C0.ESC+"[24;"+(u+1)+"~":g.C0.ESC+"[24~";break;default:if(!h.ctrlKey||h.shiftKey||h.altKey||h.metaKey)if(E&&!N||!h.altKey||h.metaKey)!E||h.altKey||h.ctrlKey||h.shiftKey||!h.metaKey?h.key&&!h.ctrlKey&&!h.altKey&&!h.metaKey&&h.keyCode>=48&&h.key.length===1?_.key=h.key:h.key&&h.ctrlKey&&(h.key==="_"&&(_.key=g.C0.US),h.key==="@"&&(_.key=g.C0.NUL)):h.keyCode===65&&(_.type=1);else{const p=v[h.keyCode],m=p==null?void 0:p[h.shiftKey?1:0];if(m)_.key=g.C0.ESC+m;else if(h.keyCode>=65&&h.keyCode<=90){const f=h.ctrlKey?h.keyCode-64:h.keyCode+32;let x=String.fromCharCode(f);h.shiftKey&&(x=x.toUpperCase()),_.key=g.C0.ESC+x}else if(h.keyCode===32)_.key=g.C0.ESC+(h.ctrlKey?g.C0.NUL:" ");else if(h.key==="Dead"&&h.code.startsWith("Key")){let f=h.code.slice(3,4);h.shiftKey||(f=f.toLowerCase()),_.key=g.C0.ESC+f,_.cancel=!0}}else h.keyCode>=65&&h.keyCode<=90?_.key=String.fromCharCode(h.keyCode-64):h.keyCode===32?_.key=g.C0.NUL:h.keyCode>=51&&h.keyCode<=55?_.key=String.fromCharCode(h.keyCode-51+27):h.keyCode===56?_.key=g.C0.DEL:h.keyCode===219?_.key=g.C0.ESC:h.keyCode===220?_.key=g.C0.FS:h.keyCode===221&&(_.key=g.C0.GS)}return _}},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,g=0,v=c.length){let h="";for(let b=g;b<v;++b){let E=c[b];E>65535?(E-=65536,h+=String.fromCharCode(55296+(E>>10))+String.fromCharCode(E%1024+56320)):h+=String.fromCharCode(E)}return h},i.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(c,g){const v=c.length;if(!v)return 0;let h=0,b=0;if(this._interim){const E=c.charCodeAt(b++);56320<=E&&E<=57343?g[h++]=1024*(this._interim-55296)+E-56320+65536:(g[h++]=this._interim,g[h++]=E),this._interim=0}for(let E=b;E<v;++E){const N=c.charCodeAt(E);if(55296<=N&&N<=56319){if(++E>=v)return this._interim=N,h;const _=c.charCodeAt(E);56320<=_&&_<=57343?g[h++]=1024*(N-55296)+_-56320+65536:(g[h++]=N,g[h++]=_)}else N!==65279&&(g[h++]=N)}return h}},i.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(c,g){const v=c.length;if(!v)return 0;let h,b,E,N,_=0,u=0,p=0;if(this.interim[0]){let x=!1,j=this.interim[0];j&=(224&j)==192?31:(240&j)==224?15:7;let T,R=0;for(;(T=63&this.interim[++R])&&R<4;)j<<=6,j|=T;const S=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,L=S-R;for(;p<L;){if(p>=v)return 0;if(T=c[p++],(192&T)!=128){p--,x=!0;break}this.interim[R++]=T,j<<=6,j|=63&T}x||(S===2?j<128?p--:g[_++]=j:S===3?j<2048||j>=55296&&j<=57343||j===65279||(g[_++]=j):j<65536||j>1114111||(g[_++]=j)),this.interim.fill(0)}const m=v-4;let f=p;for(;f<v;){for(;!(!(f<m)||128&(h=c[f])||128&(b=c[f+1])||128&(E=c[f+2])||128&(N=c[f+3]));)g[_++]=h,g[_++]=b,g[_++]=E,g[_++]=N,f+=4;if(h=c[f++],h<128)g[_++]=h;else if((224&h)==192){if(f>=v)return this.interim[0]=h,_;if(b=c[f++],(192&b)!=128){f--;continue}if(u=(31&h)<<6|63&b,u<128){f--;continue}g[_++]=u}else if((240&h)==224){if(f>=v)return this.interim[0]=h,_;if(b=c[f++],(192&b)!=128){f--;continue}if(f>=v)return this.interim[0]=h,this.interim[1]=b,_;if(E=c[f++],(192&E)!=128){f--;continue}if(u=(15&h)<<12|(63&b)<<6|63&E,u<2048||u>=55296&&u<=57343||u===65279)continue;g[_++]=u}else if((248&h)==240){if(f>=v)return this.interim[0]=h,_;if(b=c[f++],(192&b)!=128){f--;continue}if(f>=v)return this.interim[0]=h,this.interim[1]=b,_;if(E=c[f++],(192&E)!=128){f--;continue}if(f>=v)return this.interim[0]=h,this.interim[1]=b,this.interim[2]=E,_;if(N=c[f++],(192&N)!=128){f--;continue}if(u=(7&h)<<18|(63&b)<<12|(63&E)<<6|63&N,u<65536||u>1114111)continue;g[_++]=u}}return _}}},225:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.UnicodeV6=void 0;const g=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 E=0;E<v.length;++E)b.fill(0,v[E][0],v[E][1]+1)}}wcwidth(E){return E<32?0:E<127?1:E<65536?b[E]:(function(N,_){let u,p=0,m=_.length-1;if(N<_[0][0]||N>_[m][1])return!1;for(;m>=p;)if(u=p+m>>1,N>_[u][1])p=u+1;else{if(!(N<_[u][0]))return!0;m=u-1}return!1})(E,h)?0:E>=131072&&E<=196605||E>=196608&&E<=262141?2:1}charProperties(E,N){let _=this.wcwidth(E),u=_===0&&N!==0;if(u){const p=g.UnicodeService.extractWidth(N);p===0?u=!1:p>_&&(_=p)}return g.UnicodeService.createPropertyValue(0,_,u)}}},5981:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.WriteBuffer=void 0;const g=c(8460),v=c(844);class h extends v.Disposable{constructor(E){super(),this._action=E,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new g.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(E,N){if(N!==void 0&&this._syncCalls>N)return void(this._syncCalls=0);if(this._pendingData+=E.length,this._writeBuffer.push(E),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let _;for(this._isSyncWriting=!0;_=this._writeBuffer.shift();){this._action(_);const u=this._callbacks.shift();u&&u()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(E,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+=E.length,this._writeBuffer.push(E),this._callbacks.push(N),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=E.length,this._writeBuffer.push(E),this._callbacks.push(N)}_innerWrite(E=0,N=!0){const _=E||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const u=this._writeBuffer[this._bufferOffset],p=this._action(u,N);if(p){const f=x=>Date.now()-_>=12?setTimeout((()=>this._innerWrite(0,x))):this._innerWrite(_,x);return void p.catch((x=>(queueMicrotask((()=>{throw x})),Promise.resolve(!1)))).then(f)}const m=this._callbacks[this._bufferOffset];if(m&&m(),this._bufferOffset++,this._pendingData-=u.length,Date.now()-_>=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})$/,g=/^[\da-f]+$/;function v(h,b){const E=h.toString(16),N=E.length<2?"0"+E:E;switch(b){case 4:return E[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 E=c.exec(b);if(E){const N=E[1]?15:E[4]?255:E[7]?4095:65535;return[Math.round(parseInt(E[1]||E[4]||E[7]||E[10],16)/N*255),Math.round(parseInt(E[2]||E[5]||E[8]||E[11],16)/N*255),Math.round(parseInt(E[3]||E[6]||E[9]||E[12],16)/N*255)]}}else if(b.indexOf("#")===0&&(b=b.slice(1),g.exec(b)&&[3,6,9,12].includes(b.length))){const E=b.length/3,N=[0,0,0];for(let _=0;_<3;++_){const u=parseInt(b.slice(E*_,E*_+E),16);N[_]=E===1?u<<4:E===2?u:E===3?u>>4:u>>8}return N}},i.toRgbString=function(h,b=16){const[E,N,_]=h;return`rgb:${v(E,b)}/${v(N,b)}/${v(_,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 g=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,_){this._handlers[N]===void 0&&(this._handlers[N]=[]);const u=this._handlers[N];return u.push(_),{dispose:()=>{const p=u.indexOf(_);p!==-1&&u.splice(p,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,_){if(this.reset(),this._ident=N,this._active=this._handlers[N]||b,this._active.length)for(let u=this._active.length-1;u>=0;u--)this._active[u].hook(_);else this._handlerFb(this._ident,"HOOK",_)}put(N,_,u){if(this._active.length)for(let p=this._active.length-1;p>=0;p--)this._active[p].put(N,_,u);else this._handlerFb(this._ident,"PUT",(0,g.utf32ToString)(N,_,u))}unhook(N,_=!0){if(this._active.length){let u=!1,p=this._active.length-1,m=!1;if(this._stack.paused&&(p=this._stack.loopPosition-1,u=_,m=this._stack.fallThrough,this._stack.paused=!1),!m&&u===!1){for(;p>=0&&(u=this._active[p].unhook(N),u!==!0);p--)if(u instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=p,this._stack.fallThrough=!1,u;p--}for(;p>=0;p--)if(u=this._active[p].unhook(!1),u instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=p,this._stack.fallThrough=!0,u}else this._handlerFb(this._ident,"UNHOOK",N);this._active=b,this._ident=0}};const E=new v.Params;E.addParam(0),i.DcsHandler=class{constructor(N){this._handler=N,this._data="",this._params=E,this._hitLimit=!1}hook(N){this._params=N.length>1||N.params[0]?N.clone():E,this._data="",this._hitLimit=!1}put(N,_,u){this._hitLimit||(this._data+=(0,g.utf32ToString)(N,_,u),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(N){let _=!1;if(this._hitLimit)_=!1;else if(N&&(_=this._handler(this._data,this._params),_ instanceof Promise))return _.then((u=>(this._params=E,this._data="",this._hitLimit=!1,u)));return this._params=E,this._data="",this._hitLimit=!1,_}}},2015:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.EscapeSequenceParser=i.VT500_TRANSITION_TABLE=i.TransitionTable=void 0;const g=c(844),v=c(8742),h=c(6242),b=c(6351);class E{constructor(p){this.table=new Uint8Array(p)}setDefault(p,m){this.table.fill(p<<4|m)}add(p,m,f,x){this.table[m<<8|p]=f<<4|x}addMany(p,m,f,x){for(let j=0;j<p.length;j++)this.table[m<<8|p[j]]=f<<4|x}}i.TransitionTable=E;const N=160;i.VT500_TRANSITION_TABLE=(function(){const u=new E(4095),p=Array.apply(null,Array(256)).map(((R,S)=>S)),m=(R,S)=>p.slice(R,S),f=m(32,127),x=m(0,24);x.push(25),x.push.apply(x,m(28,32));const j=m(0,14);let T;for(T in u.setDefault(1,0),u.addMany(f,0,2,0),j)u.addMany([24,26,153,154],T,3,0),u.addMany(m(128,144),T,3,0),u.addMany(m(144,152),T,3,0),u.add(156,T,0,0),u.add(27,T,11,1),u.add(157,T,4,8),u.addMany([152,158,159],T,0,7),u.add(155,T,11,3),u.add(144,T,11,9);return u.addMany(x,0,3,0),u.addMany(x,1,3,1),u.add(127,1,0,1),u.addMany(x,8,0,8),u.addMany(x,3,3,3),u.add(127,3,0,3),u.addMany(x,4,3,4),u.add(127,4,0,4),u.addMany(x,6,3,6),u.addMany(x,5,3,5),u.add(127,5,0,5),u.addMany(x,2,3,2),u.add(127,2,0,2),u.add(93,1,4,8),u.addMany(f,8,5,8),u.add(127,8,5,8),u.addMany([156,27,24,26,7],8,6,0),u.addMany(m(28,32),8,0,8),u.addMany([88,94,95],1,0,7),u.addMany(f,7,0,7),u.addMany(x,7,0,7),u.add(156,7,0,0),u.add(127,7,0,7),u.add(91,1,11,3),u.addMany(m(64,127),3,7,0),u.addMany(m(48,60),3,8,4),u.addMany([60,61,62,63],3,9,4),u.addMany(m(48,60),4,8,4),u.addMany(m(64,127),4,7,0),u.addMany([60,61,62,63],4,0,6),u.addMany(m(32,64),6,0,6),u.add(127,6,0,6),u.addMany(m(64,127),6,0,0),u.addMany(m(32,48),3,9,5),u.addMany(m(32,48),5,9,5),u.addMany(m(48,64),5,0,6),u.addMany(m(64,127),5,7,0),u.addMany(m(32,48),4,9,5),u.addMany(m(32,48),1,9,2),u.addMany(m(32,48),2,9,2),u.addMany(m(48,127),2,10,0),u.addMany(m(48,80),1,10,0),u.addMany(m(81,88),1,10,0),u.addMany([89,90,92],1,10,0),u.addMany(m(96,127),1,10,0),u.add(80,1,11,9),u.addMany(x,9,0,9),u.add(127,9,0,9),u.addMany(m(28,32),9,0,9),u.addMany(m(32,48),9,9,12),u.addMany(m(48,60),9,8,10),u.addMany([60,61,62,63],9,9,10),u.addMany(x,11,0,11),u.addMany(m(32,128),11,0,11),u.addMany(m(28,32),11,0,11),u.addMany(x,10,0,10),u.add(127,10,0,10),u.addMany(m(28,32),10,0,10),u.addMany(m(48,60),10,8,10),u.addMany([60,61,62,63],10,0,11),u.addMany(m(32,48),10,9,12),u.addMany(x,12,0,12),u.add(127,12,0,12),u.addMany(m(28,32),12,0,12),u.addMany(m(32,48),12,9,12),u.addMany(m(48,64),12,0,11),u.addMany(m(64,127),12,12,13),u.addMany(m(64,127),10,12,13),u.addMany(m(64,127),9,12,13),u.addMany(x,13,13,13),u.addMany(f,13,13,13),u.add(127,13,0,13),u.addMany([27,156,24,26],13,14,0),u.add(N,0,2,0),u.add(N,8,5,8),u.add(N,6,0,6),u.add(N,11,0,11),u.add(N,13,13,13),u})();class _ extends g.Disposable{constructor(p=i.VT500_TRANSITION_TABLE){super(),this._transitions=p,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=(m,f,x)=>{},this._executeHandlerFb=m=>{},this._csiHandlerFb=(m,f)=>{},this._escHandlerFb=m=>{},this._errorHandlerFb=m=>m,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,g.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(p,m=[64,126]){let f=0;if(p.prefix){if(p.prefix.length>1)throw new Error("only one byte as prefix supported");if(f=p.prefix.charCodeAt(0),f&&60>f||f>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(p.intermediates){if(p.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let j=0;j<p.intermediates.length;++j){const T=p.intermediates.charCodeAt(j);if(32>T||T>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");f<<=8,f|=T}}if(p.final.length!==1)throw new Error("final must be a single byte");const x=p.final.charCodeAt(0);if(m[0]>x||x>m[1])throw new Error(`final must be in range ${m[0]} .. ${m[1]}`);return f<<=8,f|=x,f}identToString(p){const m=[];for(;p;)m.push(String.fromCharCode(255&p)),p>>=8;return m.reverse().join("")}setPrintHandler(p){this._printHandler=p}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(p,m){const f=this._identifier(p,[48,126]);this._escHandlers[f]===void 0&&(this._escHandlers[f]=[]);const x=this._escHandlers[f];return x.push(m),{dispose:()=>{const j=x.indexOf(m);j!==-1&&x.splice(j,1)}}}clearEscHandler(p){this._escHandlers[this._identifier(p,[48,126])]&&delete this._escHandlers[this._identifier(p,[48,126])]}setEscHandlerFallback(p){this._escHandlerFb=p}setExecuteHandler(p,m){this._executeHandlers[p.charCodeAt(0)]=m}clearExecuteHandler(p){this._executeHandlers[p.charCodeAt(0)]&&delete this._executeHandlers[p.charCodeAt(0)]}setExecuteHandlerFallback(p){this._executeHandlerFb=p}registerCsiHandler(p,m){const f=this._identifier(p);this._csiHandlers[f]===void 0&&(this._csiHandlers[f]=[]);const x=this._csiHandlers[f];return x.push(m),{dispose:()=>{const j=x.indexOf(m);j!==-1&&x.splice(j,1)}}}clearCsiHandler(p){this._csiHandlers[this._identifier(p)]&&delete this._csiHandlers[this._identifier(p)]}setCsiHandlerFallback(p){this._csiHandlerFb=p}registerDcsHandler(p,m){return this._dcsParser.registerHandler(this._identifier(p),m)}clearDcsHandler(p){this._dcsParser.clearHandler(this._identifier(p))}setDcsHandlerFallback(p){this._dcsParser.setHandlerFallback(p)}registerOscHandler(p,m){return this._oscParser.registerHandler(p,m)}clearOscHandler(p){this._oscParser.clearHandler(p)}setOscHandlerFallback(p){this._oscParser.setHandlerFallback(p)}setErrorHandler(p){this._errorHandler=p}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(p,m,f,x,j){this._parseStack.state=p,this._parseStack.handlers=m,this._parseStack.handlerPos=f,this._parseStack.transition=x,this._parseStack.chunkPos=j}parse(p,m,f){let x,j=0,T=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&&(x=S[L](this._params),x!==!0);L--)if(x instanceof Promise)return this._parseStack.handlerPos=L,x}this._parseStack.handlers=[];break;case 4:if(f===!1&&L>-1){for(;L>=0&&(x=S[L](),x!==!0);L--)if(x instanceof Promise)return this._parseStack.handlerPos=L,x}this._parseStack.handlers=[];break;case 6:if(j=p[this._parseStack.chunkPos],x=this._dcsParser.unhook(j!==24&&j!==26,f),x)return x;j===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(j=p[this._parseStack.chunkPos],x=this._oscParser.end(j!==24&&j!==26,f),x)return x;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<m;++S){switch(j=p[S],T=this._transitions.table[this.currentState<<8|(j<160?j:N)],T>>4){case 2:for(let D=S+1;;++D){if(D>=m||(j=p[D])<32||j>126&&j<N){this._printHandler(p,S,D),S=D-1;break}if(++D>=m||(j=p[D])<32||j>126&&j<N){this._printHandler(p,S,D),S=D-1;break}if(++D>=m||(j=p[D])<32||j>126&&j<N){this._printHandler(p,S,D),S=D-1;break}if(++D>=m||(j=p[D])<32||j>126&&j<N){this._printHandler(p,S,D),S=D-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&&(x=L[I](this._params),x!==!0);I--)if(x instanceof Promise)return this._preserveStack(3,L,I,T,S),x;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<m&&(j=p[S])>47&&j<60);S--;break;case 9:this._collect<<=8,this._collect|=j;break;case 10:const B=this._escHandlers[this._collect<<8|j];let F=B?B.length-1:-1;for(;F>=0&&(x=B[F](),x!==!0);F--)if(x instanceof Promise)return this._preserveStack(4,B,F,T,S),x;F<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 D=S+1;;++D)if(D>=m||(j=p[D])===24||j===26||j===27||j>127&&j<N){this._dcsParser.put(p,S,D),S=D-1;break}break;case 14:if(x=this._dcsParser.unhook(j!==24&&j!==26),x)return this._preserveStack(6,[],0,T,S),x;j===27&&(T|=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 D=S+1;;D++)if(D>=m||(j=p[D])<32||j>127&&j<N){this._oscParser.put(p,S,D),S=D-1;break}break;case 6:if(x=this._oscParser.end(j!==24&&j!==26),x)return this._preserveStack(5,[],0,T,S),x;j===27&&(T|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&T}}}i.EscapeSequenceParser=_},6242:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.OscHandler=i.OscParser=void 0;const g=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,E){this._handlers[b]===void 0&&(this._handlers[b]=[]);const N=this._handlers[b];return N.push(E),{dispose:()=>{const _=N.indexOf(E);_!==-1&&N.splice(_,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,E,N){if(this._active.length)for(let _=this._active.length-1;_>=0;_--)this._active[_].put(b,E,N);else this._handlerFb(this._id,"PUT",(0,v.utf32ToString)(b,E,N))}start(){this.reset(),this._state=1}put(b,E,N){if(this._state!==3){if(this._state===1)for(;E<N;){const _=b[E++];if(_===59){this._state=2,this._start();break}if(_<48||57<_)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+_-48}this._state===2&&N-E>0&&this._put(b,E,N)}}end(b,E=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let N=!1,_=this._active.length-1,u=!1;if(this._stack.paused&&(_=this._stack.loopPosition-1,N=E,u=this._stack.fallThrough,this._stack.paused=!1),!u&&N===!1){for(;_>=0&&(N=this._active[_].end(b),N!==!0);_--)if(N instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=_,this._stack.fallThrough=!1,N;_--}for(;_>=0;_--)if(N=this._active[_].end(!1),N instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=_,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,E,N){this._hitLimit||(this._data+=(0,v.utf32ToString)(b,E,N),this._data.length>g.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(b){let E=!1;if(this._hitLimit)E=!1;else if(b&&(E=this._handler(this._data),E instanceof Promise))return E.then((N=>(this._data="",this._hitLimit=!1,N)));return this._data="",this._hitLimit=!1,E}}},8742:(y,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Params=void 0;const c=2147483647;class g{static fromArray(h){const b=new g;if(!h.length)return b;for(let E=Array.isArray(h[0])?1:0;E<h.length;++E){const N=h[E];if(Array.isArray(N))for(let _=0;_<N.length;++_)b.addSubParam(N[_]);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 g(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 E=this._subParamsIdx[b]>>8,N=255&this._subParamsIdx[b];N-E>0&&h.push(Array.prototype.slice.call(this._subParams,E,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,E=255&this._subParamsIdx[h];return E-b>0?this._subParams.subarray(b,E):null}getSubParamsAll(){const h={};for(let b=0;b<this.length;++b){const E=this._subParamsIdx[b]>>8,N=255&this._subParamsIdx[b];N-E>0&&(h[b]=this._subParams.slice(E,N))}return h}addDigit(h){let b;if(this._rejectDigits||!(b=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const E=this._digitIsSub?this._subParams:this.params,N=E[b-1];E[b-1]=~N?Math.min(10*N+h,c):h}}i.Params=g},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,g){const v={instance:g,dispose:g.dispose,isDisposed:!1};this._addons.push(v),g.dispose=()=>this._wrappedAddonDispose(v),g.activate(c)}_wrappedAddonDispose(c){if(c.isDisposed)return;let g=-1;for(let v=0;v<this._addons.length;v++)if(this._addons[v]===c){g=v;break}if(g===-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(g,1)}}},8771:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferApiView=void 0;const g=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 g.BufferLineApiView(b)}getNullCell(){return new v.CellData}}},3785:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferLineApiView=void 0;const g=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 g.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 g=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 g.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new g.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,g){return this._core.registerCsiHandler(c,(v=>g(v.toArray())))}addCsiHandler(c,g){return this.registerCsiHandler(c,g)}registerDcsHandler(c,g){return this._core.registerDcsHandler(c,((v,h)=>g(v,h.toArray())))}addDcsHandler(c,g){return this.registerDcsHandler(c,g)}registerEscHandler(c,g){return this._core.registerEscHandler(c,g)}addEscHandler(c,g){return this.registerEscHandler(c,g)}registerOscHandler(c,g){return this._core.registerOscHandler(c,g)}addOscHandler(c,g){return this.registerOscHandler(c,g)}}},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 g=this&&this.__decorate||function(u,p,m,f){var x,j=arguments.length,T=j<3?p:f===null?f=Object.getOwnPropertyDescriptor(p,m):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(u,p,m,f);else for(var R=u.length-1;R>=0;R--)(x=u[R])&&(T=(j<3?x(T):j>3?x(p,m,T):x(p,m))||T);return j>3&&T&&Object.defineProperty(p,m,T),T},v=this&&this.__param||function(u,p){return function(m,f){p(m,f,u)}};Object.defineProperty(i,"__esModule",{value:!0}),i.BufferService=i.MINIMUM_ROWS=i.MINIMUM_COLS=void 0;const h=c(8460),b=c(844),E=c(5295),N=c(2585);i.MINIMUM_COLS=2,i.MINIMUM_ROWS=1;let _=i.BufferService=class extends b.Disposable{get buffer(){return this.buffers.active}constructor(u){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(u.rawOptions.cols||0,i.MINIMUM_COLS),this.rows=Math.max(u.rawOptions.rows||0,i.MINIMUM_ROWS),this.buffers=this.register(new E.BufferSet(u,this))}resize(u,p){this.cols=u,this.rows=p,this.buffers.resize(u,p),this._onResize.fire({cols:u,rows:p})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(u,p=!1){const m=this.buffer;let f;f=this._cachedBlankLine,f&&f.length===this.cols&&f.getFg(0)===u.fg&&f.getBg(0)===u.bg||(f=m.getBlankLine(u,p),this._cachedBlankLine=f),f.isWrapped=p;const x=m.ybase+m.scrollTop,j=m.ybase+m.scrollBottom;if(m.scrollTop===0){const T=m.lines.isFull;j===m.lines.length-1?T?m.lines.recycle().copyFrom(f):m.lines.push(f.clone()):m.lines.splice(j+1,0,f.clone()),T?this.isUserScrolling&&(m.ydisp=Math.max(m.ydisp-1,0)):(m.ybase++,this.isUserScrolling||m.ydisp++)}else{const T=j-x+1;m.lines.shiftElements(x+1,T-1,-1),m.lines.set(j,f.clone())}this.isUserScrolling||(m.ydisp=m.ybase),this._onScroll.fire(m.ydisp)}scrollLines(u,p,m){const f=this.buffer;if(u<0){if(f.ydisp===0)return;this.isUserScrolling=!0}else u+f.ydisp>=f.ybase&&(this.isUserScrolling=!1);const x=f.ydisp;f.ydisp=Math.max(Math.min(f.ydisp+u,f.ybase),0),x!==f.ydisp&&(p||this._onScroll.fire(f.ydisp))}};i.BufferService=_=g([v(0,N.IOptionsService)],_)},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,g){this._charsets[c]=g,this.glevel===c&&(this.charset=g)}}},1753:function(y,i,c){var g=this&&this.__decorate||function(f,x,j,T){var R,S=arguments.length,L=S<3?x:T===null?T=Object.getOwnPropertyDescriptor(x,j):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(f,x,j,T);else for(var I=f.length-1;I>=0;I--)(R=f[I])&&(L=(S<3?R(L):S>3?R(x,j,L):R(x,j))||L);return S>3&&L&&Object.defineProperty(x,j,L),L},v=this&&this.__param||function(f,x){return function(j,T){x(j,T,f)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CoreMouseService=void 0;const h=c(2585),b=c(8460),E=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 _(f,x){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||x||(j|=3)),j}const u=String.fromCharCode,p={DEFAULT:f=>{const x=[_(f,!1)+32,f.col+32,f.row+32];return x[0]>255||x[1]>255||x[2]>255?"":`\x1B[M${u(x[0])}${u(x[1])}${u(x[2])}`},SGR:f=>{const x=f.action===0&&f.button!==4?"m":"M";return`\x1B[<${_(f,!0)};${f.col};${f.row}${x}`},SGR_PIXELS:f=>{const x=f.action===0&&f.button!==4?"m":"M";return`\x1B[<${_(f,!0)};${f.x};${f.y}${x}`}};let m=i.CoreMouseService=class extends E.Disposable{constructor(f,x){super(),this._bufferService=f,this._coreService=x,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(p))this.addEncoding(j,p[j]);this.reset()}addProtocol(f,x){this._protocols[f]=x}addEncoding(f,x){this._encodings[f]=x}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 x=this._encodings[this._activeEncoding](f);return x&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(x):this._coreService.triggerDataEvent(x,!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,x,j){if(j){if(f.x!==x.x||f.y!==x.y)return!1}else if(f.col!==x.col||f.row!==x.row)return!1;return f.button===x.button&&f.action===x.action&&f.ctrl===x.ctrl&&f.alt===x.alt&&f.shift===x.shift}};i.CoreMouseService=m=g([v(0,h.IBufferService),v(1,h.ICoreService)],m)},6975:function(y,i,c){var g=this&&this.__decorate||function(m,f,x,j){var T,R=arguments.length,S=R<3?f:j===null?j=Object.getOwnPropertyDescriptor(f,x):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(m,f,x,j);else for(var L=m.length-1;L>=0;L--)(T=m[L])&&(S=(R<3?T(S):R>3?T(f,x,S):T(f,x))||S);return R>3&&S&&Object.defineProperty(f,x,S),S},v=this&&this.__param||function(m,f){return function(x,j){f(x,j,m)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CoreService=void 0;const h=c(1439),b=c(8460),E=c(844),N=c(2585),_=Object.freeze({insertMode:!1}),u=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let p=i.CoreService=class extends E.Disposable{constructor(m,f,x){super(),this._bufferService=m,this._logService=f,this._optionsService=x,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)(_),this.decPrivateModes=(0,h.clone)(u)}reset(){this.modes=(0,h.clone)(_),this.decPrivateModes=(0,h.clone)(u)}triggerDataEvent(m,f=!1){if(this._optionsService.rawOptions.disableStdin)return;const x=this._bufferService.buffer;f&&this._optionsService.rawOptions.scrollOnUserInput&&x.ybase!==x.ydisp&&this._onRequestScrollToBottom.fire(),f&&this._onUserInput.fire(),this._logService.debug(`sending data "${m}"`,(()=>m.split("").map((j=>j.charCodeAt(0))))),this._onData.fire(m)}triggerBinaryEvent(m){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${m}"`,(()=>m.split("").map((f=>f.charCodeAt(0))))),this._onBinary.fire(m))}};i.CoreService=p=g([v(0,N.IBufferService),v(1,N.ILogService),v(2,N.IOptionsService)],p)},9074:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.DecorationService=void 0;const g=c(8055),v=c(8460),h=c(844),b=c(6106);let E=0,N=0;class _ extends h.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new b.SortedList((m=>m==null?void 0:m.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(m){if(m.marker.isDisposed)return;const f=new u(m);if(f){const x=f.marker.onDispose((()=>f.dispose()));f.onDispose((()=>{f&&(this._decorations.delete(f)&&this._onDecorationRemoved.fire(f),x.dispose())})),this._decorations.insert(f),this._onDecorationRegistered.fire(f)}return f}reset(){for(const m of this._decorations.values())m.dispose();this._decorations.clear()}*getDecorationsAtCell(m,f,x){let j=0,T=0;for(const R of this._decorations.getKeyIterator(f))j=R.options.x??0,T=j+(R.options.width??1),m>=j&&m<T&&(!x||(R.options.layer??"bottom")===x)&&(yield R)}forEachDecorationAtCell(m,f,x,j){this._decorations.forEachByKey(f,(T=>{E=T.options.x??0,N=E+(T.options.width??1),m>=E&&m<N&&(!x||(T.options.layer??"bottom")===x)&&j(T)}))}}i.DecorationService=_;class u extends h.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=g.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=g.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(m){super(),this.options=m,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=m.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 g=c(2585),v=c(8343);class h{constructor(...E){this._entries=new Map;for(const[N,_]of E)this.set(N,_)}set(E,N){const _=this._entries.get(E);return this._entries.set(E,N),_}forEach(E){for(const[N,_]of this._entries.entries())E(N,_)}has(E){return this._entries.has(E)}get(E){return this._entries.get(E)}}i.ServiceCollection=h,i.InstantiationService=class{constructor(){this._services=new h,this._services.set(g.IInstantiationService,this)}setService(b,E){this._services.set(b,E)}getService(b){return this._services.get(b)}createInstance(b,...E){const N=(0,v.getServiceDependencies)(b).sort(((p,m)=>p.index-m.index)),_=[];for(const p of N){const m=this._services.get(p.id);if(!m)throw new Error(`[createInstance] ${b.name} depends on UNKNOWN service ${p.id}.`);_.push(m)}const u=N.length>0?N[0].index:E.length;if(E.length!==u)throw new Error(`[createInstance] First service dependency of ${b.name} at position ${u+1} conflicts with ${E.length} static arguments`);return new b(...E,..._)}}},7866:function(y,i,c){var g=this&&this.__decorate||function(u,p,m,f){var x,j=arguments.length,T=j<3?p:f===null?f=Object.getOwnPropertyDescriptor(p,m):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(u,p,m,f);else for(var R=u.length-1;R>=0;R--)(x=u[R])&&(T=(j<3?x(T):j>3?x(p,m,T):x(p,m))||T);return j>3&&T&&Object.defineProperty(p,m,T),T},v=this&&this.__param||function(u,p){return function(m,f){p(m,f,u)}};Object.defineProperty(i,"__esModule",{value:!0}),i.traceCall=i.setTraceLogger=i.LogService=void 0;const h=c(844),b=c(2585),E={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,_=i.LogService=class extends h.Disposable{get logLevel(){return this._logLevel}constructor(u){super(),this._optionsService=u,this._logLevel=b.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),N=this}_updateLogLevel(){this._logLevel=E[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(u){for(let p=0;p<u.length;p++)typeof u[p]=="function"&&(u[p]=u[p]())}_log(u,p,m){this._evalLazyOptionalParams(m),u.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+p,...m)}trace(u,...p){var m;this._logLevel<=b.LogLevelEnum.TRACE&&this._log(((m=this._optionsService.options.logger)==null?void 0:m.trace.bind(this._optionsService.options.logger))??console.log,u,p)}debug(u,...p){var m;this._logLevel<=b.LogLevelEnum.DEBUG&&this._log(((m=this._optionsService.options.logger)==null?void 0:m.debug.bind(this._optionsService.options.logger))??console.log,u,p)}info(u,...p){var m;this._logLevel<=b.LogLevelEnum.INFO&&this._log(((m=this._optionsService.options.logger)==null?void 0:m.info.bind(this._optionsService.options.logger))??console.info,u,p)}warn(u,...p){var m;this._logLevel<=b.LogLevelEnum.WARN&&this._log(((m=this._optionsService.options.logger)==null?void 0:m.warn.bind(this._optionsService.options.logger))??console.warn,u,p)}error(u,...p){var m;this._logLevel<=b.LogLevelEnum.ERROR&&this._log(((m=this._optionsService.options.logger)==null?void 0:m.error.bind(this._optionsService.options.logger))??console.error,u,p)}};i.LogService=_=g([v(0,b.IOptionsService)],_),i.setTraceLogger=function(u){N=u},i.traceCall=function(u,p,m){if(typeof m.value!="function")throw new Error("not supported");const f=m.value;m.value=function(...x){if(N.logLevel!==b.LogLevelEnum.TRACE)return f.apply(this,x);N.trace(`GlyphRenderer#${f.name}(${x.map((T=>JSON.stringify(T))).join(", ")})`);const j=f.apply(this,x);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 g=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 E extends v.Disposable{constructor(_){super(),this._onOptionChange=this.register(new g.EventEmitter),this.onOptionChange=this._onOptionChange.event;const u={...i.DEFAULT_OPTIONS};for(const p in _)if(p in u)try{const m=_[p];u[p]=this._sanitizeAndValidateOption(p,m)}catch(m){console.error(m)}this.rawOptions=u,this.options={...u},this._setupOptions(),this.register((0,v.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(_,u){return this.onOptionChange((p=>{p===_&&u(this.rawOptions[_])}))}onMultipleOptionChange(_,u){return this.onOptionChange((p=>{_.indexOf(p)!==-1&&u()}))}_setupOptions(){const _=p=>{if(!(p in i.DEFAULT_OPTIONS))throw new Error(`No option with key "${p}"`);return this.rawOptions[p]},u=(p,m)=>{if(!(p in i.DEFAULT_OPTIONS))throw new Error(`No option with key "${p}"`);m=this._sanitizeAndValidateOption(p,m),this.rawOptions[p]!==m&&(this.rawOptions[p]=m,this._onOptionChange.fire(p))};for(const p in this.rawOptions){const m={get:_.bind(this,p),set:u.bind(this,p)};Object.defineProperty(this.options,p,m)}}_sanitizeAndValidateOption(_,u){switch(_){case"cursorStyle":if(u||(u=i.DEFAULT_OPTIONS[_]),!(function(p){return p==="block"||p==="underline"||p==="bar"})(u))throw new Error(`"${u}" is not a valid value for ${_}`);break;case"wordSeparator":u||(u=i.DEFAULT_OPTIONS[_]);break;case"fontWeight":case"fontWeightBold":if(typeof u=="number"&&1<=u&&u<=1e3)break;u=b.includes(u)?u:i.DEFAULT_OPTIONS[_];break;case"cursorWidth":u=Math.floor(u);case"lineHeight":case"tabStopWidth":if(u<1)throw new Error(`${_} cannot be less than 1, value: ${u}`);break;case"minimumContrastRatio":u=Math.max(1,Math.min(21,Math.round(10*u)/10));break;case"scrollback":if((u=Math.min(u,4294967295))<0)throw new Error(`${_} cannot be less than 0, value: ${u}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(u<=0)throw new Error(`${_} cannot be less than or equal to 0, value: ${u}`);break;case"rows":case"cols":if(!u&&u!==0)throw new Error(`${_} must be numeric, value: ${u}`);break;case"windowsPty":u=u??{}}return u}}i.OptionsService=E},2660:function(y,i,c){var g=this&&this.__decorate||function(E,N,_,u){var p,m=arguments.length,f=m<3?N:u===null?u=Object.getOwnPropertyDescriptor(N,_):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(E,N,_,u);else for(var x=E.length-1;x>=0;x--)(p=E[x])&&(f=(m<3?p(f):m>3?p(N,_,f):p(N,_))||f);return m>3&&f&&Object.defineProperty(N,_,f),f},v=this&&this.__param||function(E,N){return function(_,u){N(_,u,E)}};Object.defineProperty(i,"__esModule",{value:!0}),i.OscLinkService=void 0;const h=c(2585);let b=i.OscLinkService=class{constructor(E){this._bufferService=E,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(E){const N=this._bufferService.buffer;if(E.id===void 0){const x=N.addMarker(N.ybase+N.y),j={data:E,id:this._nextId++,lines:[x]};return x.onDispose((()=>this._removeMarkerFromLink(j,x))),this._dataByLinkId.set(j.id,j),j.id}const _=E,u=this._getEntryIdKey(_),p=this._entriesWithId.get(u);if(p)return this.addLineToLink(p.id,N.ybase+N.y),p.id;const m=N.addMarker(N.ybase+N.y),f={id:this._nextId++,key:this._getEntryIdKey(_),data:_,lines:[m]};return m.onDispose((()=>this._removeMarkerFromLink(f,m))),this._entriesWithId.set(f.key,f),this._dataByLinkId.set(f.id,f),f.id}addLineToLink(E,N){const _=this._dataByLinkId.get(E);if(_&&_.lines.every((u=>u.line!==N))){const u=this._bufferService.buffer.addMarker(N);_.lines.push(u),u.onDispose((()=>this._removeMarkerFromLink(_,u)))}}getLinkData(E){var N;return(N=this._dataByLinkId.get(E))==null?void 0:N.data}_getEntryIdKey(E){return`${E.id};;${E.uri}`}_removeMarkerFromLink(E,N){const _=E.lines.indexOf(N);_!==-1&&(E.lines.splice(_,1),E.lines.length===0&&(E.data.id!==void 0&&this._entriesWithId.delete(E.key),this._dataByLinkId.delete(E.id)))}};i.OscLinkService=b=g([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",g="di$dependencies";i.serviceRegistry=new Map,i.getServiceDependencies=function(v){return v[g]||[]},i.createDecorator=function(v){if(i.serviceRegistry.has(v))return i.serviceRegistry.get(v);const h=function(b,E,N){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(_,u,p){u[c]===u?u[g].push({id:_,index:p}):(u[g]=[{id:_,index:p}],u[c]=u)})(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 g=c(8343);var v;i.IBufferService=(0,g.createDecorator)("BufferService"),i.ICoreMouseService=(0,g.createDecorator)("CoreMouseService"),i.ICoreService=(0,g.createDecorator)("CoreService"),i.ICharsetService=(0,g.createDecorator)("CharsetService"),i.IInstantiationService=(0,g.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,g.createDecorator)("LogService"),i.IOptionsService=(0,g.createDecorator)("OptionsService"),i.IOscLinkService=(0,g.createDecorator)("OscLinkService"),i.IUnicodeService=(0,g.createDecorator)("UnicodeService"),i.IDecorationService=(0,g.createDecorator)("DecorationService")},1480:(y,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.UnicodeService=void 0;const g=c(8460),v=c(225);class h{static extractShouldJoin(E){return(1&E)!=0}static extractWidth(E){return E>>1&3}static extractCharKind(E){return E>>3}static createPropertyValue(E,N,_=!1){return(16777215&E)<<3|(3&N)<<1|(_?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new g.EventEmitter,this.onChange=this._onChange.event;const E=new v.UnicodeV6;this.register(E),this._active=E.version,this._activeProvider=E}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(E){if(!this._providers[E])throw new Error(`unknown Unicode version "${E}"`);this._active=E,this._activeProvider=this._providers[E],this._onChange.fire(E)}register(E){this._providers[E.version]=E}wcwidth(E){return this._activeProvider.wcwidth(E)}getStringCellWidth(E){let N=0,_=0;const u=E.length;for(let p=0;p<u;++p){let m=E.charCodeAt(p);if(55296<=m&&m<=56319){if(++p>=u)return N+this.wcwidth(m);const j=E.charCodeAt(p);56320<=j&&j<=57343?m=1024*(m-55296)+j-56320+65536:N+=this.wcwidth(j)}const f=this.charProperties(m,_);let x=h.extractWidth(f);h.extractShouldJoin(f)&&(x-=h.extractWidth(_)),N+=x,_=f}return N}charProperties(E,N){return this._activeProvider.charProperties(E,N)}}i.UnicodeService=h}},a={};function d(y){var i=a[y];if(i!==void 0)return i.exports;var c=a[y]={exports:{}};return s[y].call(c.exports,c,c.exports,d),c.exports}var k={};return(()=>{var y=k;Object.defineProperty(y,"__esModule",{value:!0}),y.Terminal=void 0;const i=d(9042),c=d(3236),g=d(844),v=d(5741),h=d(8285),b=d(7975),E=d(7090),N=["cols","rows"];class _ extends g.Disposable{constructor(p){super(),this._core=this.register(new c.Terminal(p)),this._addonManager=this.register(new v.AddonManager),this._publicOptions={...this._core.options};const m=x=>this._core.options[x],f=(x,j)=>{this._checkReadonlyOptions(x),this._core.options[x]=j};for(const x in this._core.options){const j={get:m.bind(this,x),set:f.bind(this,x)};Object.defineProperty(this._publicOptions,x,j)}}_checkReadonlyOptions(p){if(N.includes(p))throw new Error(`Option "${p}" 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 E.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 p=this._core.coreService.decPrivateModes;let m="none";switch(this._core.coreMouseService.activeProtocol){case"X10":m="x10";break;case"VT200":m="vt200";break;case"DRAG":m="drag";break;case"ANY":m="any"}return{applicationCursorKeysMode:p.applicationCursorKeys,applicationKeypadMode:p.applicationKeypad,bracketedPasteMode:p.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:m,originMode:p.origin,reverseWraparoundMode:p.reverseWraparound,sendFocusMode:p.sendFocus,wraparoundMode:p.wraparound}}get options(){return this._publicOptions}set options(p){for(const m in p)this._publicOptions[m]=p[m]}blur(){this._core.blur()}focus(){this._core.focus()}input(p,m=!0){this._core.input(p,m)}resize(p,m){this._verifyIntegers(p,m),this._core.resize(p,m)}open(p){this._core.open(p)}attachCustomKeyEventHandler(p){this._core.attachCustomKeyEventHandler(p)}attachCustomWheelEventHandler(p){this._core.attachCustomWheelEventHandler(p)}registerLinkProvider(p){return this._core.registerLinkProvider(p)}registerCharacterJoiner(p){return this._checkProposedApi(),this._core.registerCharacterJoiner(p)}deregisterCharacterJoiner(p){this._checkProposedApi(),this._core.deregisterCharacterJoiner(p)}registerMarker(p=0){return this._verifyIntegers(p),this._core.registerMarker(p)}registerDecoration(p){return this._checkProposedApi(),this._verifyPositiveIntegers(p.x??0,p.width??0,p.height??0),this._core.registerDecoration(p)}hasSelection(){return this._core.hasSelection()}select(p,m,f){this._verifyIntegers(p,m,f),this._core.select(p,m,f)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(p,m){this._verifyIntegers(p,m),this._core.selectLines(p,m)}dispose(){super.dispose()}scrollLines(p){this._verifyIntegers(p),this._core.scrollLines(p)}scrollPages(p){this._verifyIntegers(p),this._core.scrollPages(p)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(p){this._verifyIntegers(p),this._core.scrollToLine(p)}clear(){this._core.clear()}write(p,m){this._core.write(p,m)}writeln(p,m){this._core.write(p),this._core.write(`\r
|
|
123
|
-
`,m)}paste(p){this._core.paste(p)}refresh(p,m){this._verifyIntegers(p,m),this._core.refresh(p,m)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(p){this._addonManager.loadAddon(this,p)}static get strings(){return i}_verifyIntegers(...p){for(const m of p)if(m===1/0||isNaN(m)||m%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...p){for(const m of p)if(m&&(m===1/0||isNaN(m)||m%1!=0||m<0))throw new Error("This API only accepts positive integers")}}y.Terminal=_})(),k})()))})(pu)),pu.exports}var $C=UC();function WC(t){return t.toLowerCase().startsWith("win")}function zC(t){return t.keyCode===86&&t.ctrlKey&&!t.shiftKey&&!t.altKey&&!t.metaKey}const qC=8,VC=100,KC=80,Lp=6,Np=.02,GC=.95,YC=50;function XC(t,e){return Math.hypot(t,e)>qC}function QC(t,e){const s=t[t.length-1];if(s===void 0||e-s.t>KC)return 0;const a=t.filter(y=>s.t-y.t<=VC),d=a[0];if(d===void 0||a.length<2||s.t===d.t)return 0;const k=(d.y-s.y)/(s.t-d.t);return Math.max(-Lp,Math.min(Lp,k))}function JC(t,e){if(Math.abs(t)<Np)return{delta:0,velocity:0};const s=Math.max(0,Math.min(YC,e)),a=t*GC**(s/16);return{delta:t*s,velocity:Math.abs(a)<Np?0:a}}function ZC(t){const e=Math.trunc(t);return{pixels:e,rest:t-e}}const e1=60;function t1(){return new URLSearchParams(window.location.search).get("renderer")==="webgl"?"webgl":"canvas"}const Rp={dark:{background:"#12141a",foreground:"#d8dee9",cursor:"#d8dee9",selectionBackground:"#2f3542"},light:{background:"#fbfbfd",foreground:"#22262e",cursor:"#22262e",selectionBackground:"#cfd8e3"}},Mp={dark:1,light:4.5};function qg({terminalId:t,connection:e,active:s,theme:a,autoFocus:d=!0,pasteOnCtrlV:k=!1}){const y=M.useRef(null),i=M.useRef(null),c=M.useRef(null),g=M.useRef(a);return g.current=a,M.useEffect(()=>{const v=y.current;if(v===null)return;const h=new $C.Terminal({convertEol:!1,cursorBlink:!0,fontFamily:'"Cascadia Mono", "Consolas", "Menlo", "DejaVu Sans Mono", monospace',fontSize:14,lineHeight:1.2,scrollback:1e4,allowProposedApi:!0,theme:Rp[g.current],minimumContrastRatio:Mp[g.current]});i.current=h;const b=new PC.FitAddon;c.current=b,h.loadAddon(b),h.loadAddon(new BC.WebLinksAddon),h.open(v);let E=!1;const N=()=>{if(!(E||t1()!=="webgl")){E=!0;try{const Z=new HC.WebglAddon;Z.onContextLoss(()=>Z.dispose()),h.loadAddon(Z)}catch{console.info("[terminal] WebGL no disponible; se usa el renderer por defecto.")}}};let _={cols:0,rows:0},u;const p=()=>v.clientWidth>0&&v.clientHeight>0,m=Z=>{const{cols:ee,rows:ve}=h;ee<=0||ve<=0||!Z&&ee===_.cols&&ve===_.rows||(_={cols:ee,rows:ve},e.send({type:"resize",terminalId:t,cols:ee,rows:ve}))};let f={atBottom:!0,line:0},x=!1;const j=()=>{if(x||!p())return;const Z=h.buffer.active;f={atBottom:Z.viewportY>=Z.baseY,line:Z.viewportY}},T=()=>{const Z=h.buffer.active;if(Z.baseY===0)return;const ee=f.atBottom?Z.baseY:Math.min(f.line,Z.baseY);h.scrollToLine(ee>0?ee-1:ee+1),h.scrollToLine(ee)},R=h.onRender(j),S=h.onScroll(j);let L=p();const I=()=>{if(p()){try{b.fit()}catch{return}x&&(T(),x=!1),h.cols>0&&h.rows>0&&N(),m(!1)}},B=()=>{window.clearTimeout(u),u=window.setTimeout(I,e1)},F=new ResizeObserver(()=>{const Z=p();x=!0,Z&&!L&&T(),L=Z,B()});F.observe(v),window.addEventListener("resize",B);let D=null,H=0,W=0;const G=(Z,ee,ve)=>{const Se=h.element;if(Se===void 0)return;const Ie=ZC(W+Z);W=Ie.rest,Ie.pixels!==0&&Se.dispatchEvent(new WheelEvent("wheel",{deltaY:Ie.pixels,deltaMode:WheelEvent.DOM_DELTA_PIXEL,clientX:ee,clientY:ve,bubbles:!0,cancelable:!0}))},Y=()=>{window.cancelAnimationFrame(H),H=0},z=(Z,ee,ve)=>{let Se=Z,Ie=performance.now();const je=Je=>{if(!p()){H=0;return}const Ze=JC(Se,Je-Ie);Ie=Je,G(Ze.delta,ee,ve),Se=Ze.velocity,H=Se===0?0:window.requestAnimationFrame(je)};H=window.requestAnimationFrame(je)},P=(Z,ee)=>{for(let ve=0;ve<Z.length;ve++){const Se=Z.item(ve);if(Se!==null&&Se.identifier===ee)return Se}return null},U=Z=>{Y(),W=0;const ee=Z.touches.length===1?Z.touches.item(0):null;D=ee===null?null:{id:ee.identifier,startX:ee.clientX,startY:ee.clientY,lastX:ee.clientX,lastY:ee.clientY,moving:!1,samples:[{t:Z.timeStamp,y:ee.clientY}]}},$=Z=>{if(Z.stopPropagation(),D===null)return;const ee=P(Z.touches,D.id);if(ee===null)return;if(!D.moving){if(!XC(ee.clientX-D.startX,ee.clientY-D.startY))return;D.moving=!0}Z.cancelable&&Z.preventDefault();const ve=D.lastY-ee.clientY;D.lastX=ee.clientX,D.lastY=ee.clientY,D.samples.push({t:Z.timeStamp,y:ee.clientY}),D.samples.length>32&&D.samples.shift(),G(ve,ee.clientX,ee.clientY)},K=Z=>{if(D===null||P(Z.changedTouches,D.id)===null)return;const ee=D;if(D=null,!ee.moving)return;const ve=QC(ee.samples,Z.timeStamp);ve!==0&&z(ve,ee.lastX,ee.lastY)},te=()=>{D=null};v.addEventListener("touchstart",U,{capture:!0,passive:!0}),v.addEventListener("touchmove",$,{capture:!0,passive:!1}),v.addEventListener("touchend",K,{capture:!0,passive:!0}),v.addEventListener("touchcancel",te,{capture:!0,passive:!0});const oe=()=>{if(!(document.visibilityState!=="visible"||!p())){try{b.fit()}catch{return}m(!0)}};window.addEventListener("focus",oe),document.addEventListener("visibilitychange",oe),k&&h.attachCustomKeyEventHandler(Z=>!zC(Z));const we=h.onData(Z=>{e.send({type:"input",terminalId:t,data:Z})}),me=e.onMessage(Z=>{switch(Z.type){case"terminal.output":Z.terminalId===t&&h.write(Z.data);break;case"terminal.replay":if(Z.terminalId!==t)break;h.reset(),Z.truncated&&h.write(`\x1B[90m-- ${w("terminal.replayTruncated")} --\x1B[0m\r
|
|
124
|
-
`),h.write(Z.data);break;case"terminal.exit":if(Z.terminalId!==t)break;h.write(`\r
|
|
125
|
-
\x1B[90m-- ${w("terminal.exited",{code:Z.exitCode})} --\x1B[0m\r
|
|
126
|
-
`);break}}),X=()=>{if(p())try{b.fit()}catch{}const Z=h.cols>0?h.cols:80,ee=h.rows>0?h.rows:24;_={cols:Z,rows:ee},e.send({type:"terminal.attach",terminalId:t,cols:Z,rows:ee})};X();const V=e.onReopen(X);return()=>{window.clearTimeout(u),window.removeEventListener("resize",B),window.removeEventListener("focus",oe),document.removeEventListener("visibilitychange",oe),F.disconnect(),Y(),v.removeEventListener("touchstart",U,{capture:!0}),v.removeEventListener("touchmove",$,{capture:!0}),v.removeEventListener("touchend",K,{capture:!0}),v.removeEventListener("touchcancel",te,{capture:!0}),R.dispose(),S.dispose(),we.dispose(),me(),V(),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=Rp[a],v.options.minimumContrastRatio=Mp[a])},[a]),M.useEffect(()=>{if(!s)return;const v=i.current,h=c.current;if(v===null||h===null)return;const b=window.setTimeout(()=>{const E=y.current;if(!(E===null||E.clientWidth===0||E.clientHeight===0)){try{h.fit()}catch{return}d&&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,d,t,e]),o.jsx("div",{className:`terminal-surface${s?"":" terminal-surface-hidden"}`,ref:y})}function n1(){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 ol({title:t,onHide:e,confirmText:s}){const[a,d]=M.useState(!1);return o.jsxs("span",{className:"section-hide",children:[o.jsx("button",{className:"icon-button",onClick:k=>{k.stopPropagation(),s===null?e():d(!0)},title:t,"aria-label":t,children:o.jsx(n1,{})}),a&&s!==null&&o.jsxs("span",{className:"section-hide-confirm",role:"alert",children:[o.jsx("span",{children:s}),o.jsx("button",{className:"link-button",onClick:()=>{d(!1),e()},children:w("settings.panels.consoleConfirmYes")}),o.jsx("button",{className:"link-button",onClick:()=>d(!1),children:w("common.cancel")})]})]})}const r1=typeof navigator<"u"&&WC(navigator.platform);function s1({connection:t,shells:e,activeShellId:s,cwd:a,shellName:d,theme:k,onSelect:y,onOpen:i,onCloseShell:c,onCollapse:g,onHide:v,hideCount:h=0}){const b=d??w("console.name"),E=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,_)=>o.jsxs("div",{className:`strip-tab${N.terminalId===(E==null?void 0:E.terminalId)?" is-active":""}${N.alive?"":" is-dead"}`,children:[o.jsx("button",{className:"strip-tab-label",onClick:()=>y(N.terminalId),title:N.alive?w("console.tab.title",{shell:N.label.length>0?N.label:b,number:_+1,cwd:a}):w("console.tab.exited",{code:N.exitCode??"?"}),children:w("console.tab.label",{number:_+1})}),o.jsx("button",{className:"strip-tab-close",onClick:()=>c(N.terminalId),title:w("console.tab.close"),children:"×"})]},N.terminalId)),d!==null&&o.jsx("button",{className:"strip-tab-new",onClick:i,title:w("console.openAnother",{shell:b,cwd:a}),children:"+"})]}),o.jsx("span",{className:"strip-spacer"}),o.jsx("button",{className:"icon-button",onClick:g,title:w("console.collapse"),children:"▾"}),v!==void 0&&o.jsx(ol,{title:w("settings.hide.console"),onHide:v,confirmText:h===0?null:w("settings.panels.consoleConfirm",{count:h})})]}),o.jsx("div",{className:"console-body",children:e.length===0?o.jsx("div",{className:"console-empty",children:d===null?o.jsx("p",{className:"panel-note",children:w("console.noShell")}):o.jsx("button",{className:"link-button",onClick:i,children:w("console.openIn",{shell:b,cwd:a})})}):o.jsx("div",{className:"terminal-stack",children:e.map(N=>o.jsx(qg,{terminalId:N.terminalId,connection:t,active:N.terminalId===(E==null?void 0:E.terminalId),theme:k,pasteOnCtrlV:r1},N.terminalId))})})]})}function i1(t){return t.cwd===null||!t.shellAvailable||t.shellCwds.includes(t.cwd)?null:t.cwd}const o1=.75,a1=.9,l1=.7;function er(t){if(t<1e3)return String(t);if(t<1e6){const e=t/1e3;return`${e<100?Ti(e,1):Math.round(e)}k`}return`${Ti(t/1e6,2)}M`}function c1({usage:t,source:e,instructionsFile:s,fallbackWindow:a=null,compact:d=!1,statusLineState:k=null,onConfigure:y,compactAction:i=null}){const{lastRequestTokens:c,contextWindow:g}=t;if(y!==void 0&&k!==null&&Ob(e,{state:k}))return o.jsxs("div",{className:`meter meter-idle${d?" meter-compact":""}`,title:Bb(k),children:[o.jsx("span",{className:"meter-label",children:w("meter.label")}),o.jsx("span",{className:`meter-bar${d?" meter-bar-inline":""}`}),o.jsx("span",{className:"meter-value",children:w("meter.unmeasured")}),o.jsx("button",{className:"link-button",onClick:y,children:w("meter.configure")})]});if(e===null)return o.jsxs("div",{className:`meter meter-idle${d?" meter-compact":""}`,title:w("meter.noTokensTitle"),children:[o.jsx("span",{className:"meter-label",children:w("meter.label")}),o.jsx("span",{className:`meter-bar${d?" meter-bar-inline":""}`}),o.jsx("span",{className:"meter-value",children:w("meter.noTokens")})]});if(!Pb(e,t)){const N=Hb(s,e,t.compacted===!0),_=Db(e,t,a);return o.jsxs("div",{className:`meter meter-idle${d?" meter-compact":""}`,title:N,children:[o.jsx("span",{className:"meter-label",children:w("meter.label")}),o.jsx("span",{className:`meter-bar${d?" meter-bar-inline":""}`}),o.jsxs("span",{className:"meter-value",children:[w("meter.unmeasured"),_!==null&&o.jsxs("span",{className:"meter-dim",children:[" / ",er(_)]})]})]})}const v=g!==null&&g>0?Math.min(c/g,1):null,h=v===null?"unknown":v>=a1?"danger":v>=o1?"warn":"ok",b=g===null?"":` / ${er(g)}${t.contextWindowEstimated?"+":""}`,E=Fb(e,t);if(d){const N=[t.lastModel===null?null:t.lastModel,E,v===null?w("meter.unknownModelShort"):w("meter.windowPercent",{percent:Math.round(v*100)}),w("meter.output",{tokens:er(t.lastOutputTokens)}),e==="status-line"?w("meter.responses",{count:t.assistantMessages}):w("meter.sessionTotals",{output:er(t.totalOutputTokens),cache:er(t.totalCacheReadTokens),count:t.assistantMessages})].filter(u=>u!==null).join(" · "),_=i!==null&&v!==null&&v>=l1;return o.jsxs("div",{className:"meter meter-compact",title:N,children:[o.jsx("span",{className:"meter-label",children:w("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:[er(c),b.length>0&&o.jsx("span",{className:"meter-dim",children:b})]}),_&&i!==null&&o.jsx("button",{className:"icon-button meter-compact-button",onClick:i.onCompact,disabled:i.blockedReason!==null,title:i.blockedReason??w("meter.compactTitle",{command:i.command}),children:w("meter.compact")})]})}return o.jsxs("div",{className:"meter",children:[o.jsxs("div",{className:"meter-row",children:[o.jsx("span",{className:"meter-label",children:w("meter.label")}),o.jsxs("span",{className:"meter-value",children:[er(c),g!==null&&o.jsxs("span",{className:"meter-dim",title:t.lastModel===null?void 0:E!==null?w("meter.modelWithOrigin",{model:t.lastModel,origin:E}):t.lastModel,children:[" ","/ ",er(g),t.contextWindowEstimated&&"+"]})]})]}),v!==null?o.jsx("div",{className:"meter-bar",title:w("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:w("meter.unknownModel")}),o.jsxs("div",{className:"meter-row meter-row-dim",children:[o.jsx("span",{title:w("meter.lastResponseTitle"),children:w("meter.output",{tokens:er(t.lastOutputTokens)})}),o.jsx("span",{title:w("meter.sessionTitle"),children:w("meter.sessionTotals",{output:er(t.totalOutputTokens),cache:er(t.totalCacheReadTokens),count:t.assistantMessages})})]})]})}const u1=75,al=90,h1=3e4;function d1(t){return t>=al?"danger":t>=u1?"warn":"ok"}function mu(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 f1(t,e){const s=dy(t,e).sort(mu);if(s.length===0)return null;const a=new Map;for(const g of s){const v=g.minutes===null?`id:${g.id}`:`m:${g.minutes}`,h=a.get(v);(h===void 0||g.usedPercent>h.usedPercent)&&a.set(v,g)}const d=[...a.values()].sort(mu),k=d[0];if(k===void 0)return null;const y=d.find(g=>g.usedPercent>=al),i=k.usedPercent<al&&y!==void 0?y:k;let c=d.slice(0,2);return c.includes(i)||(c=[k,i]),{shown:c.sort(mu),priorityId:i.id,all:s}}function Vg(t){const{minutes:e}=t;return e===null?w("plan.window.quota"):e===Os.fiveHours?w("plan.window.fiveHours"):e===Os.day?w("plan.window.day"):e===Os.week?w("plan.window.week"):Math.abs(e-Os.month)<=Os.day?w("plan.window.month"):e%Os.day===0?w("plan.window.days",{value:e/Os.day}):w("plan.window.hours",{value:Math.max(1,Math.round(e/60))})}function Kg(t){const e=t>=100?Math.round(t):Math.min(99,Math.round(t));return Ok(e)}function p1(t,e){return t.resetsAt===null?null:Mg(t.resetsAt-e)}function m1(t,e){return t-e<1440*60*1e3?Ni(t):t-e<10080*60*1e3?Pk(t):`${_h(t)} ${Ni(t)}`}function g1(t,e){const s=t.all.map(d=>{const k=w("plan.used",{percent:Kg(d.usedPercent)}),y=d.resetsAt===null?w("plan.noReset"):w("plan.resetsIn",{time:Mg(d.resetsAt-e),at:m1(d.resetsAt,e)});return`${Vg(d)}: ${k} · ${y}`}),a=Math.max(...t.all.map(d=>d.observedAt));return s.push(w("plan.observed",{when:$n(a,e)})),s.join(`
|
|
127
|
-
`)}const v1={missing:"plan.setup.missing","other-command":"plan.setup.otherCommand",disabled:"plan.setup.disabled",unreadable:"plan.setup.unreadable"};function _1(t){return t===null?"hidden":t==="active"?"waiting":"configure"}function w1(t){return w(t==="active"?"plan.noDataTitle":v1[t])}function y1({windows:t,setupState:e,onConfigure:s}){const[a,d]=M.useState(()=>Date.now());M.useEffect(()=>{d(Date.now());const y=window.setInterval(()=>d(Date.now()),h1);return()=>window.clearInterval(y)},[t]);const k=f1(t,a);if(k===null){const y=_1(e);return y==="hidden"||e===null||y==="configure"&&s===void 0?null:o.jsxs("div",{className:"meter meter-idle meter-compact plan-meter",title:w1(e),children:[o.jsx("span",{className:"meter-label",children:w("plan.label")}),y==="configure"?o.jsx("button",{className:"link-button",onClick:s,children:w("meter.configure")}):o.jsx("span",{className:"meter-value",children:w("plan.noData")})]})}return o.jsx("div",{className:"meter meter-compact plan-meter",title:g1(k,a),children:k.shown.map(y=>{const i=d1(y.usedPercent),c=p1(y,a),g=y.id===k.priorityId;return o.jsxs("span",{className:`plan-window ${g?"plan-window-priority":"plan-window-extra"}`,children:[o.jsx("span",{className:"meter-label plan-label",children:Vg(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>=al?"plan-danger":void 0,children:Kg(y.usedPercent)}),c!==null&&o.jsxs("span",{className:"meter-dim",children:[" · ",c]})]})]},y.id)})})}const gu=["s","m","l"],Gg="m",b1="agent-workbench.thread-font",k1="agent-workbench.notes-font",C1="s",S1={s:"threadFont.size.s",m:"threadFont.size.m",l:"threadFont.size.l"};function Ap(t){return w(S1[t])}function Yg(t){const e=gu.indexOf(t);return gu[(e+1)%gu.length]??Gg}function x1(t){return t==="s"||t==="m"||t==="l"?t:null}function ll(t){return w("threadFont.title",{current:Ap(t),next:Ap(Yg(t))})}const E1=300,T1=200,L1=2,N1=E1+T1,Xg=L1*N1,R1=200;function Qg(t){return Math.max(R1,t)}function M1(t){return t.hasMore&&!t.loading&&t.searching!==!0&&t.scrollTop<t.previousScrollTop&&t.scrollTop<=Qg(t.clientHeight)}function A1(t,e,s){return t<0&&e<=Qg(s)}function I1(t,e){return Math.max(0,e-t)}function j1(t,e){return t===null||e.length===0||e[0]===t?!1:e.includes(t)}const D1=52,P1=10;function O1(t){return t.filter(e=>e.role==="user"&&e.parts.some(s=>s.kind==="text"||s.kind==="image")).map(e=>e.eventId)}function B1(t,e){for(let s=t-1;s>=0;s-=1){const a=e(s);if(a!==null&&a<-8)return s}return null}function F1(t){return t.awayFromEnd&&(t.ownAbove||t.hasMore)}function Ip(t,e){return Math.max(0,t+e-D1)}function H1(t){return t.found?"jump":t.loading?"wait":!t.hasMore||t.pagesRequested>=P1?"give-up":"load"}const U1=1;function $1(t,e){for(const s of t){const a=e(s);if(!(a===null||a.bottom<=U1))return{eventId:s,offset:a.top,lastId:t[t.length-1]??null}}return null}function W1(t,e,s,a){const d=e.indexOf(t.eventId);if(d===-1)return null;for(let k=d;k<e.length;k+=1){const y=e[k],i=y===void 0?null:s(y);if(i!==null)return Math.max(0,a+i.top-(k===d?t.offset:0))}return null}function z1(t,e){if(e===null)return 0;const s=t.lastIndexOf(e);return s===-1?0:t.length-1-s}const jp=2,q1=4;function V1(t,e,s,a=q1){const d=e.right-e.left,k=e.bottom-e.top;if(d<=0||k<=0)return 0;const y=t.right-jp,i=y-d,c=t.top+jp,g=c+k;return y<=s.left-a||i>=s.right+a||g<=s.top-a||c>=s.bottom+a?0:Math.ceil(y-(s.left-a))}function Jg({agents:t,preselected:e,anchor:s,label:a=w("agentMenu.openWith"),onPick:d,onClose:k}){const y=M.useMemo(()=>zu(t),[t]),[i,c]=M.useState(()=>qb(y,e)),[g,v]=M.useState(null),h=M.useRef(null),b=M.useRef([]);return M.useLayoutEffect(()=>{const E=h.current;if(E===null)return;const N=s.getBoundingClientRect(),_=E.getBoundingClientRect();v(Kb({left:N.left,top:N.top,bottom:N.bottom},{width:_.width,height:_.height},{width:window.innerWidth,height:window.innerHeight}))},[s]),M.useEffect(()=>{var E;(E=b.current[i])==null||E.focus()},[i,g]),M.useEffect(()=>{const E=u=>{if(!(u.altKey||u.ctrlKey||u.metaKey)){if(u.key==="Escape"){u.preventDefault(),u.stopPropagation(),k(),s.focus();return}if(u.key==="ArrowDown"||u.key==="ArrowUp"){u.preventDefault(),u.stopPropagation(),c(p=>Vb(p,u.key==="ArrowDown"?1:-1,y.length));return}if(u.key==="Enter"){u.preventDefault(),u.stopPropagation();const p=y[i];p!==void 0&&d(p.id);return}u.key==="Tab"&&k()}},N=u=>{var m;const p=u.target;p instanceof Node&&((m=h.current)!=null&&m.contains(p)||s.contains(p))||k()},_=u=>{Gb(u.target,s,h.current)&&k()};return window.addEventListener("keydown",E,!0),document.addEventListener("pointerdown",N,!0),window.addEventListener("scroll",_,!0),window.addEventListener("resize",k),()=>{window.removeEventListener("keydown",E,!0),document.removeEventListener("pointerdown",N,!0),window.removeEventListener("scroll",_,!0),window.removeEventListener("resize",k)}},[i,s,y,k,d]),Ag.createPortal(o.jsx("div",{ref:h,className:"agent-menu",role:"menu","aria-label":a,style:g===null?{left:0,top:0,visibility:"hidden"}:{left:`${g.left}px`,top:`${g.top}px`},children:y.map((E,N)=>o.jsxs("button",{ref:_=>{b.current[N]=_},className:`agent-menu-item${N===i?" agent-menu-item-active":""}`,role:"menuitem",tabIndex:N===i?0:-1,onMouseEnter:()=>c(N),onClick:()=>d(E.id),children:[o.jsx("span",{className:"agent-menu-label",children:E.label}),E.version!==null&&o.jsx("span",{className:"agent-menu-version",children:E.version})]},E.id))}),document.body)}function K1(){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 Zg({targets:t,className:e,text:s,label:a,blockedReason:d=null,title:k=vh(),onPick:y}){const[i,c]=M.useState(!1),g=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:g,className:e,onClick:()=>c(b=>!b),disabled:d!==null,"aria-haspopup":"menu","aria-expanded":i,"aria-label":a,title:d??k,children:s}),i&&g.current!==null&&o.jsx(Jg,{agents:t,preselected:null,anchor:g.current,label:w("continue.menuLabel"),onPick:h,onClose:v})]})}function ev(t){switch(t.notice){case"compacted":return t.detail==="auto"?w("thread.notice.compactedAuto"):w("thread.notice.compacted");case"interrupted":return w("thread.notice.interrupted");case"error":return t.detail.length>0?w("thread.notice.error",{detail:t.detail}):w("thread.notice.errorNoDetail")}}const tv="agent-workbench.locale",nv="auto";function G1(t){return t==="auto"||dg(t)?t:null}function rv(t){const e=t.trim().replace(/_/g,"-").toLowerCase();if(e.length===0)return null;const s=mh.find(k=>k.toLowerCase()===e);if(s!==void 0)return s;const[a="",...d]=e.split("-");return a==="zh"?d.includes("hant")||d.some(y=>y==="tw"||y==="hk"||y==="mo")?null:vu("zh-CN"):vu(a==="pt"?"pt-BR":a)}function vu(t){return dg(t)?t:null}function sv(t,e){if(t!=="auto")return t;for(const s of e){const a=rv(s);if(a!==null)return a}return"en"}function iv(t,e){for(const s of e)if(rv(s)===t)try{if(Intl.DateTimeFormat.supportedLocalesOf([s]).length>0)return s}catch{}return rb(t)}let cl=nv;const Gu=new Set;function wh(){return Array.isArray(navigator.languages)&&navigator.languages.length>0?navigator.languages:typeof navigator.language=="string"?[navigator.language]:[]}function Y1(){return sv("auto",wh())}async function ov(t){const e=wh(),s=sv(t,e);await pg(s,iv(s,e))}async function X1(){cl=Nt(tv,nv,G1);try{await ov(cl)}catch{await pg("en",iv("en",wh()))}document.documentElement.lang=Wu(),fg(()=>{document.documentElement.lang=Wu()})}async function Q1(t){await ov(t),cl=t,yt(tv,t);for(const e of Gu)e()}function J1(t){return Gu.add(t),()=>Gu.delete(t)}function Z1(){return cl}function Mo(){return M.useSyncExternalStore(fg,Wu)}function eS(){return M.useSyncExternalStore(J1,Z1)}const av=String.raw`https?:\/\/[^\s<>"'\`]+`,tS=new RegExp([String.raw`(\`[^\`\n]+\`)`,String.raw`(\*\*[^*\n]+\*\*)`,String.raw`(__[^_\n]+__)`,String.raw`(\*[^*\n]+\*)`,String.raw`(~~[^~\n]+~~)`,String.raw`(\[[^\]\n]+\]\([^)\s]+\))`,`(${av})`].join("|")),nS=/^(https?:|mailto:)/i,rS=new RegExp(av);function sS(t){const e=rS.exec(t);if(e===null||e.index===void 0)return null;const s=lv(e[0]);return{index:e.index,length:s.length,href:s}}function Ga(t,e){let s=0;for(const a of t)a===e&&(s+=1);return s}function lv(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===")"&&Ga(e,"(")<Ga(e,")")){e=e.slice(0,-1);continue}if(s==="]"&&Ga(e,"[")<Ga(e,"]")){e=e.slice(0,-1);continue}return e}}function iS(t){const e=tS.exec(t);if(e===null||e.index===void 0)return null;const s=e[0],a=e.index,d=(y,i=s.length)=>({index:a,length:i,token:y});if(s.startsWith("`"))return d({kind:"code",text:s.slice(1,-1)});if(s.startsWith("**")||s.startsWith("__"))return d({kind:"strong",text:s.slice(2,-2)});if(s.startsWith("~~"))return d({kind:"del",text:s.slice(2,-2)});if(s.startsWith("*"))return d({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 nS.test(c)?d({kind:"link",label:i,href:c}):d({kind:"plain",text:s})}const k=lv(s);return d({kind:"link",label:k,href:k},k.length)}function vo(t,e,s){if(e.length===0)return[t];const a=t.toLowerCase(),d=e.toLowerCase(),k=[];let y=0,i=a.indexOf(d),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=a.indexOf(d,y);return y<t.length&&k.push(t.slice(y)),k}const oS=/^\[([^\]\n]+)\]\(([^)\s]+)\)$/;function aS(t,e){const s=oS.exec(t);if(s===null)return null;const a=s[2]??"",d=e(a);return d===null?null:{label:s[1]??"",href:a,open:d}}function Nr(t,e,s,a){const d=[];let k=t,y=0;for(;k.length>0;){const i=iS(k);if(i===null){d.push(...vo(k,e,`${s}-${y++}`));break}i.index>0&&d.push(...vo(k.slice(0,i.index),e,`${s}-${y++}`));const c=`${s}-i${y++}`,{token:g}=i;switch(g.kind){case"code":{const v=a.code===void 0?null:a.code(g.text);d.push(v===null?o.jsx("code",{children:g.text},c):o.jsx("code",{className:"md-file-link",role:"link",tabIndex:0,title:w("thread.openInFiles",{path:g.text}),onClick:v,onKeyDown:h=>{h.key!=="Enter"&&h.key!==" "||(h.preventDefault(),v())},children:g.text},c));break}case"strong":d.push(o.jsx("strong",{children:Nr(g.text,e,c,a)},c));break;case"del":d.push(o.jsx("del",{children:Nr(g.text,e,c,a)},c));break;case"em":d.push(o.jsx("em",{children:Nr(g.text,e,c,a)},c));break;case"link":d.push(o.jsx("a",{href:g.href,target:"_blank",rel:"noreferrer noopener",children:vo(g.label,e,c)},c));break;default:{const v=a.local===void 0?null:aS(g.text,a.local);if(v!==null){d.push(o.jsx("button",{className:"md-local-link",onClick:v.open,title:v.href,children:vo(v.label,e,c)},c));break}d.push(o.jsx("span",{children:vo(g.text,e,c)},c));break}}k=k.slice(i.index+i.length)}return d}function lS({code:t,language:e}){const[s,a]=M.useState(null),[d,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 ur(async()=>{const{highlightCode:g}=await import("./highlight-BVnJ3VdZ.js");return{highlightCode:g}},[]).then(({highlightCode:g})=>{c&&a(g(t,e))}).catch(()=>{c&&a(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:w(d?"common.copied":"common.copyCode"),"aria-label":w("common.copyCode"),children:d?"✓":"⧉"})]})]})}const Dp=/^(#{1,6})\s+(.*)$/,_u=/^\s{0,3}[-*+]\s+(.*)$/,_o=/^\s{0,3}(\d{1,3})[.)]\s+(.*)$/,Ya=/^>\s?(.*)$/,wu=/^\s*```(\S*)\s*$/,Pp=/^\s*(-{3,}|\*{3,}|_{3,})\s*$/,yu=/^\s*\|.*\|\s*$/,cS=/^\s*\|[\s:|-]+\|\s*$/;function Op(t){return t.trim().replace(/^\||\|$/g,"").split("|").map(e=>e.trim())}function yh({text:t,needle:e="",localLink:s,codeLink:a}){var c,g;const d={local:s,code:a},k=t.split(`
|
|
128
|
-
`),y=[];let i=0;for(;i<k.length;){const v=k[i]??"",h=`b${i}`,b=wu.exec(v);if(b!==null){const _=(b[1]??"").length>0?b[1]:null,u=[];for(i+=1;i<k.length&&!wu.test(k[i]??"");)u.push(k[i]??""),i+=1;i+=1,y.push({key:h,node:o.jsx(lS,{code:u.join(`
|
|
129
|
-
`),language:_},h)});continue}if(v.trim().length===0){i+=1;continue}if(Pp.test(v)){y.push({key:h,node:o.jsx("hr",{className:"md-rule"},h)}),i+=1;continue}const E=Dp.exec(v);if(E!==null){const _=Math.min((E[1]??"#").length,6);y.push({key:h,node:o.jsx("p",{className:`md-heading md-h${_}`,children:Nr(E[2]??"",e,h,d)},h)}),i+=1;continue}if(yu.test(v)&&cS.test(k[i+1]??"")){const _=Op(v);i+=2;const u=[];for(;i<k.length&&yu.test(k[i]??"");)u.push(Op(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:_.map((p,m)=>o.jsx("th",{children:Nr(p,e,`${h}-h${m}`,d)},m))})}),o.jsx("tbody",{children:u.map((p,m)=>o.jsx("tr",{children:p.map((f,x)=>o.jsx("td",{children:Nr(f,e,`${h}-${m}-${x}`,d)},x))},m))})]})},h)});continue}if(Ya.test(v)){const _=[];for(;i<k.length&&Ya.test(k[i]??"");)_.push(((c=Ya.exec(k[i]??""))==null?void 0:c[1])??""),i+=1;y.push({key:h,node:o.jsx("blockquote",{className:"md-quote",children:Nr(_.join(`
|
|
130
|
-
`),e,h,d)},h)});continue}if(_u.test(v)||_o.test(v)){const _=_o.test(v),u=_?Number(((g=_o.exec(v))==null?void 0:g[1])??"1"):1,p=[];for(;i<k.length;){const f=k[i]??"",x=_u.exec(f),j=_o.exec(f);if(_&&j!==null)p.push(j[2]??"");else if(!_&&x!==null)p.push(x[1]??"");else if(p.length>0&&/^\s{2,}\S/.test(f)&&x===null&&j===null)p[p.length-1]=`${p[p.length-1]??""} ${f.trim()}`;else break;i+=1}const m=p.map((f,x)=>o.jsx("li",{children:Nr(f,e,`${h}-l${x}`,d)},x));y.push({key:h,node:_?o.jsx("ol",{className:"md-list",start:u===1?void 0:u,children:m},h):o.jsx("ul",{className:"md-list",children:m},h)});continue}const N=[];for(;i<k.length;){const _=k[i]??"";if(_.trim().length===0||wu.test(_)||Dp.test(_)||_u.test(_)||_o.test(_)||Ya.test(_)||Pp.test(_)||yu.test(_))break;N.push(_),i+=1}y.push({key:h,node:o.jsx("p",{className:"md-paragraph",children:Nr(N.join(`
|
|
131
|
-
`),e,h,d)},h)})}return o.jsx("div",{className:"md",children:y.map(v=>v.node)})}const cv=[{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 bu(t){const e=cv.find(s=>s.names.includes(t));return e===void 0?{key:`name:${t}`,known:!1}:{key:e.key,known:!0}}function uS(t,e,s){const a=cv.find(d=>d.key===t);return a===void 0?w("tools.run.callsTo",{count:e,name:s}):w(a.run,{count:e})}function At(t){if(!hw(t.key))return t.key;let e;if(t.params!==void 0){const s={};for(const[a,d]of Object.entries(t.params))s[a]=typeof d=="object"?At(d):d;e=s}return w(`server.${t.key}`,e)}function hS(t,e,s){var k;const a=[...e].filter(([,y])=>y.terminalId===s),d=[];for(let y=t.length-1;y>=0&&a.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 g=a.findIndex(([,E])=>w0(E.item,c)),[v]=g===-1?[]:a.splice(g,1);if(v===void 0)continue;const[h,b]=v;d.push({liveId:h,toolUseId:i.toolUseId,selections:b.selections,failure:b.failure})}return d}const ku={model:null,effort:null,contextWindow:null},dS=200,fS=2e4,pS={},mS={},Bp=[],Fp=[],gS=15e3,vS=2e4;function Yu(t,e,s){return`${t}:${s}:${e}`}function _S(t,e){const[s,a]=M.useState([]),[d,k]=M.useState(su),[y,i]=M.useState(ku),[c,g]=M.useState("waiting"),[v,h]=M.useState(!1),[b,E]=M.useState(!1),[N,_]=M.useState({}),[u,p]=M.useState(null),[m,f]=M.useState(null),[x,j]=M.useState(!1),[T,R]=M.useState(Bp),[S,L]=M.useState(Fp),[I,B]=M.useState(null),F=M.useRef(new Map),D=M.useRef(new Map),[H,W]=M.useState(!1),G=M.useRef(null),Y=M.useRef(null),[z,P]=M.useState(!1),U=M.useRef(null),$=M.useRef(null),K=M.useCallback(()=>{G.current=null,Y.current!==null&&window.clearTimeout(Y.current),Y.current=null,W(!1)},[]),te=M.useCallback(()=>{U.current=null,$.current!==null&&window.clearTimeout($.current),$.current=null,P(!1)},[]),[oe,we]=M.useState({}),[me,X]=M.useState({}),V=(e===null?void 0:oe[e])??pS,Z=(e===null?void 0:me[e])??mS,ee=M.useRef(new Set),ve=M.useRef(new Map),Se=M.useRef(new Set),Ie=M.useCallback((ge,Le,ce)=>{X(Ye=>({...Ye,[ge]:{...Ye[ge]??{},[Le]:ce}}))},[]),je=M.useCallback(ge=>{X(Le=>{let ce=!1;const Ye={};for(const[We,He]of Object.entries(Le))if(ge in He){const Oe={...He};delete Oe[ge],Ye[We]=Oe,ce=!0}else Ye[We]=He;return ce?Ye:Le})},[]),Je=M.useCallback((ge,Le)=>{X(ce=>{const Ye=ce[ge];if(Ye===void 0||!(Le in Ye))return ce;const We={...Ye};return delete We[Le],{...ce,[ge]:We}})},[]),Ze=M.useCallback((ge,Le,ce)=>{const Ye=ve.current.get(Le);Ye!==void 0&&window.clearTimeout(Ye);const We=window.setTimeout(()=>{ve.current.delete(Le),!Se.current.has(Le)&&(ce&&F.current.get(ge)!==Le||(we(He=>{const Oe=He[ge];if(Oe===void 0||!(Le in Oe))return He;const Ue={...Oe};return delete Ue[Le],{...He,[ge]:Ue}}),Ie(ge,Le,w("conversation.answerUnconfirmed"))))},fS);ve.current.set(Le,We)},[Ie]);M.useEffect(()=>{for(const ge of s)for(const Le of ge.parts){if(Le.kind!=="tool-result")continue;Se.current.add(Le.toolUseId);const ce=ve.current.get(Le.toolUseId);ce!==void 0&&(window.clearTimeout(ce),ve.current.delete(Le.toolUseId)),je(Le.toolUseId)}},[s,je]),M.useEffect(()=>{if(!(e===null||D.current.size===0))for(const{liveId:ge,toolUseId:Le,selections:ce,failure:Ye}of hS(s,D.current,e))D.current.delete(ge),ce!==null&&(we(We=>{const He=We[e]??{};return Le in He?We:{...We,[e]:{...He,[Le]:ce}}}),Se.current.has(Le)||Ze(e,Le,!1)),Ye!==null&&Ie(e,Le,Ye)},[s,e,Ze,Ie]),M.useEffect(()=>{const ge=ve.current;return()=>{for(const Le of ge.values())window.clearTimeout(Le);ge.clear()}},[]);const Ae=M.useRef(null);M.useEffect(()=>{if(e===null){a([]),k(su),i(ku),g("waiting"),h(!1),Ae.current=null;return}a([]),k(su),i(ku),g("waiting"),h(!1),E(!1),_({}),p(null),f(null),j(!1),R(Bp),L(Fp),B(null),K(),te(),ee.current.clear(),Ae.current=null;const ge=t.onMessage(ce=>{var Ye;if(ce.type==="conversation.reset"||ce.type==="conversation.liveQuestion"){const We=ce.type==="conversation.reset"?ce.liveQuestion:ce.question;We===null?F.current.delete(ce.terminalId):F.current.set(ce.terminalId,We.toolUseId)}switch(ce.type){case"conversation.reset":if(ce.terminalId!==e)break;B(ce.liveQuestion),a(ce.events),k(ce.usage),i(ce.defaults),p(ce.permissionMode),f(ce.waitingFor),j(ce.openToolCall),R(ce.subagents),L(ce.queue),g(ce.state),h(ce.hasMore),E(!1),Ae.current=((Ye=ce.events[0])==null?void 0:Ye.eventId)??null;break;case"conversation.append":{if(ce.terminalId!==e)break;a(We=>{var Ue;const He=new Set(We.map(qe=>qe.eventId)),Oe=ce.events.filter(qe=>!He.has(qe.eventId));return Oe.length===0?We:(Ae.current===null&&(Ae.current=((Ue=Oe[0])==null?void 0:Ue.eventId)??null),[...We,...Oe])}),k(ce.usage),ce.permissionMode!==null&&p(ce.permissionMode),ce.queue!==void 0&&L(ce.queue),g("live");break}case"conversation.page":{if(ce.terminalId!==e)break;a(We=>{var Ue;const He=new Set(We.map(qe=>qe.eventId)),Oe=ce.events.filter(qe=>!He.has(qe.eventId));return Oe.length===0?We:(Ae.current=((Ue=Oe[0])==null?void 0:Ue.eventId)??Ae.current,[...Oe,...We])}),h(ce.hasMore),E(!1);break}case"conversation.turns":{if(ce.terminalId!==e)break;const We=new Map(ce.turns.map(He=>[He.eventId,He.durationMs]));a(He=>He.map(Oe=>{const Ue=We.get(Oe.eventId);return Ue===void 0?Oe:{...Oe,durationMs:Ue}}));break}case"conversation.parts":{if(ce.terminalId!==e)break;const We=new Map(ce.updates.map(He=>[He.eventId,He.parts]));a(He=>He.map(Oe=>{const Ue=We.get(Oe.eventId);return Ue===void 0?Oe:{...Oe,parts:Ue}}));break}case"conversation.imageData":{if(ce.terminalId!==e)break;const We=Yu(ce.eventId,ce.index,ce.source);_(He=>({...He,[We]:ce.data===null?null:`data:${ce.mediaType};base64,${ce.data}`}));break}case"conversation.state":if(ce.terminalId!==e)break;g(ce.state);break;case"conversation.mode":if(ce.terminalId!==e)break;p(ce.mode);break;case"conversation.waiting":if(ce.terminalId!==e)break;f(ce.waitingFor);break;case"conversation.toolCall":if(ce.terminalId!==e)break;j(ce.open);break;case"conversation.subagents":if(ce.terminalId!==e)break;R(ce.subagents);break;case"conversation.queue":if(ce.terminalId!==e)break;L(ce.queue);break;case"conversation.liveQuestion":if(ce.terminalId!==e)break;B(ce.question);break;case"agent.forceSent":ce.requestId===G.current&&!ce.sent&&K();break;case"agent.queueEdited":ce.requestId===U.current&&te();break;case"error":{if(ce.requestId!==void 0&&ce.requestId===G.current){K();break}if(ce.requestId!==void 0&&ce.requestId===U.current){te();break}if(ce.code!=="answer-failed"||e===null)break;const We=At(ce.text);for(const[He,Oe]of ve.current){window.clearTimeout(Oe),ve.current.delete(He),we(qe=>{const St=qe[e];if(St===void 0||!(He in St))return qe;const Pt={...St};return delete Pt[He],{...qe,[e]:Pt}}),Ie(e,He,We);const Ue=D.current.get(He);Ue!==void 0&&D.current.set(He,{...Ue,selections:null,failure:We})}break}}});t.send({type:"conversation.subscribe",terminalId:e});const Le=t.onReopen(()=>{t.send({type:"conversation.subscribe",terminalId:e})});return()=>{ge(),Le(),t.send({type:"conversation.unsubscribe",terminalId:e})}},[t,e,Ie,K,te]),M.useEffect(()=>{H&&S.every(ge=>ge.forced===!0)&&K()},[H,S,K]),M.useEffect(()=>()=>{Y.current!==null&&window.clearTimeout(Y.current),$.current!==null&&window.clearTimeout($.current)},[]);const ue=M.useCallback(()=>{if(e===null||G.current!==null)return;const ge=crypto.randomUUID();G.current=ge,W(!0),Y.current!==null&&window.clearTimeout(Y.current),Y.current=window.setTimeout(K,gS),t.send({type:"agent.forceSend",terminalId:e,requestId:ge})},[t,e,K]),ht=M.useCallback(()=>{if(e===null||U.current!==null)return;const ge=crypto.randomUUID();U.current=ge,P(!0),$.current!==null&&window.clearTimeout($.current),$.current=window.setTimeout(te,vS),t.send({type:"agent.editQueue",terminalId:e,requestId:ge})},[t,e,te]),se=M.useCallback(()=>{const ge=Ae.current;e===null||ge===null||b||(E(!0),t.send({type:"conversation.loadMore",terminalId:e,beforeEventId:ge,limit:dS}))},[t,e,b]),pe=M.useCallback((ge,Le,ce)=>{if(e===null)return;const Ye=Yu(ge,Le,ce);ee.current.has(Ye)||(ee.current.add(Ye),t.send({type:"conversation.image",terminalId:e,eventId:ge,index:Le,source:ce}))},[t,e]),Ce=M.useCallback((ge,Le)=>{if(e===null)return;we(Ye=>{const We=Ye[e]??{};return ge in We?Ye:{...Ye,[e]:{...We,[ge]:Le}}}),Je(e,ge);const ce=(I==null?void 0:I.toolUseId)===ge?I.questions[0]:void 0;ce!==void 0&&D.current.set(ge,{terminalId:e,item:ce,selections:Le,failure:null}),t.send({type:"agent.answer",terminalId:e,toolUseId:ge,selections:Le}),Ze(e,ge,ce!==void 0)},[t,e,Je,I,Ze]),be=M.useCallback(ge=>{e!==null&&t.send({type:"agent.mode",terminalId:e,mode:ge})},[t,e]);return{events:s,usage:d,defaults:y,state:c,permissionMode:u,waitingFor:m,openToolCall:x,subagents:T,queue:S,forceSend:ue,forcing:H,editQueue:ht,editingQueue:z,hasMore:v,loadingMore:b,loadMore:se,images:N,requestImage:pe,answer:Ce,answered:V,answerFailed:Z,setPermissionMode:be,liveQuestion:I}}function wS(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 yS=new Set(["Write","Edit","MultiEdit","NotebookEdit"]);function bS(t){try{const s=JSON.parse(t),a=s.file_path??s.notebook_path;if(typeof a=="string"&&a.length>0)return a}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 kS(t,e){const s=k=>k.replace(/\\/g,"/").replace(/\/+$/,""),a=s(t),d=s(e);return a.length>0&&d.toLowerCase().startsWith(`${a.toLowerCase()}/`)?e.slice(a.length+1):e}function CS(t,e,s){const a=t.findIndex(k=>k.eventId===e);if(a===-1)return[];const d=[];for(const k of t.slice(a))for(const y of k.parts){if(y.kind!=="tool-call"||!yS.has(y.name))continue;const i=bS(y.input);if(i===null)continue;const c=kS(s,i);d.includes(c)||d.push(c)}return d}function SS(t,e=6,s=400){if(t===void 0)return"";const a=t.parts.flatMap(y=>y.kind==="text"?[y.text]:[]).join(`
|
|
132
|
-
`).trim();let k=a.split(`
|
|
133
|
-
`).slice(0,e).join(`
|
|
134
|
-
`);return k.length>s&&(k=k.slice(0,s)),k.length<a.length?`${k.trimEnd()}…`:k}const uv=80;function Cu(t){return t.scrollHeight-t.scrollTop-t.clientHeight>uv}const Hp=5;function Xa(t){return!Array.isArray(t)}function Up(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 xS(t){const e=[];let s=0;for(;s<t.length;){const a=t[s];if(a===void 0)break;const d=Up(a),k=d===null?null:bu(d[0]??"");if(!(d!==null&&k!==null&&d.every(v=>bu(v).key===k.key))||d===null||k===null){e.push({kind:"card",card:a}),s+=1;continue}const i=[a];let c=d.length,g=s+1;for(;g<t.length;){const v=t[g];if(v===void 0)break;const h=Up(v);if(h===null||!h.every(b=>bu(b).key===k.key))break;i.push(v),c+=h.length,g+=1}if(c<2){e.push({kind:"card",card:a}),s+=1;continue}e.push({kind:"tools",id:`tools-${a.event.eventId}`,summary:uS(k.key,c,d[0]??""),at:a.event.at,cards:i}),s=g}return e}function ES(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 ev(t);case"thinking":case"image":return""}}function $p(t,e){const s=[];for(const a of t.parts)if(s.push(ES(a)),a.kind==="tool-call"){const d=e.get(a.toolUseId);d!==void 0&&s.push(d.text)}return s.join(`
|
|
136
|
-
`)}function cs(t,e){if(e.length===0)return o.jsx(o.Fragment,{children:t});const s=t.toLowerCase(),a=e.toLowerCase(),d=[];let k=0,y=s.indexOf(a),i=0;for(;y!==-1;)y>k&&d.push(o.jsx("span",{children:t.slice(k,y)},i++)),d.push(o.jsx("mark",{children:t.slice(y,y+e.length)},i++)),k=y+e.length,y=s.indexOf(a,k);return k<t.length&&d.push(o.jsx("span",{children:t.slice(k)},i++)),o.jsx(o.Fragment,{children:d})}function hv(t,e){const s=[];let a=t,d=0;for(;a.length>0;){const k=sS(a);if(k===null){s.push(o.jsx("span",{children:cs(a,e)},d++));break}k.index>0&&s.push(o.jsx("span",{children:cs(a.slice(0,k.index),e)},d++)),s.push(o.jsx("a",{href:k.href,target:"_blank",rel:"noreferrer noopener",children:cs(k.href,e)},d++)),a=a.slice(k.index+k.length)}return o.jsx(o.Fragment,{children:s})}const dv=M.createContext(null);function TS({view:t,terminalId:e,onRewind:s,rewindBlocked:a=!1,questionsAnswerable:d,contextWindowSource:k,instructionsFile:y,onGoToCli:i,cliPresence:c,exitCode:g,onWakeCli:v,waking:h,discovering:b=!1,toolCallNotice:E=null,serverClosed:N=null,statusLineState:_=null,onConfigureStatusLine:u,threadFont:p,continueTargets:m=[],continueBlockedReason:f=null,onContinue:x,searchRequest:j=null,onSearchRequestApplied:T,activity:R=null,receipt:S=null,clock:L=null,fileLinks:I=null,forceSendAvailable:B=!1,queueEditAvailable:F=!1,planWindows:D=[],planSetupState:H=null,onConfigurePlanLimits:W,compactAction:G=null}){const{events:Y,usage:z,defaults:P,state:U,waitingFor:$,subagents:K,queue:te,forceSend:oe,forcing:we,editQueue:me,editingQueue:X,hasMore:V,loadingMore:Z,loadMore:ee,images:ve,requestImage:Se,answer:Ie,answered:je,answerFailed:Je,liveQuestion:Ze}=t,Ae=Mo(),[ue,ht]=M.useState(""),[se,pe]=M.useState(0),[Ce,be]=M.useState(null);M.useEffect(()=>{j!==null&&(ht(j.query),T==null||T(j.seq))},[j,T]);const ge=M.useRef(null),Le=M.useRef(new Map),ce=M.useRef(!0),[Ye,We]=M.useState(!1),[He,Oe]=M.useState(0),Ue=M.useRef(e),qe=M.useRef(new Map),St=M.useRef(null),[Pt,$t]=M.useState(!1),dt=M.useRef(null),[tn,Vt]=M.useState(!1),[fe,et]=M.useState(!1),Xe=M.useRef(null),lt=M.useMemo(()=>new Set(te.flatMap(_e=>_e.eventId===void 0?[]:[_e.eventId])),[te]),de=M.useMemo(()=>lt.size===0?Y:Y.filter(_e=>!lt.has(_e.eventId)),[Y,lt]),Ke=M.useMemo(()=>O1(de),[de]),{cards:tt,results:ye}=M.useMemo(()=>{const _e=new Map,Be=new Set;for(const Ct of de)for(const pt of Ct.parts)pt.kind==="tool-result"?_e.set(pt.toolUseId,pt):(pt.kind==="tool-call"||pt.kind==="question")&&Be.add(pt.toolUseId);const it=[];for(const Ct of de){const pt=Ct.parts.filter(Ot=>Ot.kind!=="thinking"&&!(Ot.kind==="tool-result"&&Be.has(Ot.toolUseId)));pt.length!==0&&it.push({event:Ct,parts:pt})}return{cards:it,results:_e}},[de]),ct=M.useRef([]);ct.current=M.useMemo(()=>tt.map(_e=>_e.event.eventId),[tt]);const xt=M.useCallback(_e=>{const Be=_e.getBoundingClientRect().top;return it=>{const Ct=Le.current.get(it);if(Ct===void 0)return null;const pt=Ct.getBoundingClientRect();return pt.height<=0?null:{top:pt.top-Be,bottom:pt.bottom-Be}}},[]),mt=M.useMemo(()=>xS(tt),[tt,Ae]),De=ue.trim(),at=M.useMemo(()=>{if(De.length===0)return[];const _e=De.toLowerCase();return tt.filter(Be=>$p(Be,ye).toLowerCase().includes(_e)).map(Be=>Be.event.eventId)},[tt,ye,De,Ae]);M.useEffect(()=>{pe(0)},[De]);const bt=M.useMemo(()=>new Set(at),[at]),Xt=at[se]??null;M.useEffect(()=>{var _e;Xt!==null&&((_e=Le.current.get(Xt))==null||_e.scrollIntoView({block:"center"}))},[Xt]),M.useLayoutEffect(()=>{const _e=Ue.current;Ue.current=e;const Be=ge.current;if(_e!==null&&_e!==e&&St.current===null){const it=Be===null||ce.current?null:$1(ct.current,xt(Be));it===null?qe.current.delete(_e):qe.current.set(_e,it)}St.current=e===null?null:qe.current.get(e)??null,ce.current=!0,We(!1),Oe(0),Xe.current=null,et(!1),Vt(!1),$t(!1)},[e,xt]),M.useEffect(()=>()=>{dt.current!==null&&window.clearTimeout(dt.current)},[]);const wn=M.useCallback(()=>{const _e=ge.current;if(_e===null)return;const Be=Cu(_e);We(Be),Be||Oe(0)},[]),Ln=M.useCallback(_e=>{const Be=_e.getBoundingClientRect().top,it=pt=>{const Ot=Ke[pt],Wn=Ot===void 0?void 0:Le.current.get(Ot);return Wn===void 0?null:Wn.getBoundingClientRect().top-Be},Ct=B1(Ke.length,it);return Ct===null?null:it(Ct)},[Ke]),An=M.useCallback(()=>{const _e=ge.current;_e!==null&&Vt(F1({awayFromEnd:Cu(_e),ownAbove:Ln(_e)!==null,hasMore:V}))},[Ln,V]),pr=M.useRef(null),hs=M.useRef(0),ds=M.useRef(0);M.useLayoutEffect(()=>{const _e=pr.current,Be=Y.map(Ct=>Ct.eventId);pr.current=Be[0]??null;const it=ge.current;it===null||!j1(_e,Be)||(it.scrollTop=I1(hs.current,it.scrollHeight))},[Y]),M.useLayoutEffect(()=>{const _e=ge.current,Be=St.current;if(_e!==null&&Be!==null&&tt.length>0){St.current=null;const it=ct.current,Ct=De.length>0?null:W1(Be,it,xt(_e),_e.scrollTop);Ct!==null&&(_e.scrollTop=Ct,ce.current=!Cu(_e),ce.current||(Oe(z1(it,Be.lastId)),$t(!0),dt.current!==null&&window.clearTimeout(dt.current),dt.current=window.setTimeout(()=>{dt.current=null,$t(!1)},Xg)))}_e!==null&&ce.current&&De.length===0&&(_e.scrollTop=_e.scrollHeight),wn()},[tt.length,te.length,Ze==null?void 0:Ze.toolUseId,De,wn,xt]),M.useLayoutEffect(()=>{const _e=Xe.current,Be=ge.current;if(_e===null||Be===null)return;const it=Ln(Be),Ct=H1({found:it!==null,hasMore:V,loading:Z,pagesRequested:_e.pages});if(Ct!=="wait"){if(Ct==="load"){_e.pages+=1,ee();return}Xe.current=null,et(!1),it!==null&&(ce.current=!1,Be.scrollTop=Ip(Be.scrollTop,it))}},[tt,V,Z,fe,Ln,ee]),M.useLayoutEffect(()=>{An()},[tt,An]);const Us=M.useRef(null),nn=M.useRef(null),Mr=M.useRef(new Map),Ar=M.useCallback(()=>{const _e=new Map;for(const Be of[Us.current,nn.current]){if(Be===null)continue;const it=Be.getBoundingClientRect();for(const Ct of[it.top+1,(it.top+it.bottom)/2,it.bottom-1]){const pt=document.elementsFromPoint(it.left+1,Ct).map(Kt=>Kt.closest(".turn")).find(Kt=>Kt!==null),Ot=(pt==null?void 0:pt.querySelector(":scope > .turn-actions"))??null;if(pt==null||Ot===null)continue;const Wn=V1(pt.getBoundingClientRect(),Ot.getBoundingClientRect(),it);Wn>0&&_e.set(pt,Math.max(_e.get(pt)??0,Wn))}}for(const Be of Mr.current.keys())_e.has(Be)||Be.style.removeProperty("--turn-actions-shift");for(const[Be,it]of _e)Mr.current.get(Be)!==it&&Be.style.setProperty("--turn-actions-shift",`${it}px`);Mr.current=_e},[]);M.useLayoutEffect(()=>{const _e=ge.current;_e!==null&&(hs.current=_e.scrollHeight-_e.scrollTop,ds.current=_e.scrollTop,Ar())});const $s=M.useRef(null),tr=M.useCallback(()=>{var Be;const _e=((Be=Y[0])==null?void 0:Be.eventId)??null;_e===null||$s.current===_e||($s.current=_e,ee())},[Y,ee]),fs=M.useRef(null);M.useEffect(()=>{var Ct;const _e=((Ct=tt[tt.length-1])==null?void 0:Ct.event.eventId)??null,Be=fs.current;if(fs.current=_e,Be===null||_e===Be||ce.current&&De.length===0)return;const it=tt.findIndex(pt=>pt.event.eventId===Be);it!==-1&&Oe(pt=>pt+(tt.length-1-it))},[tt,De]);const ps=M.useCallback(()=>{const _e=ge.current;if(_e===null)return;const Be=_e.scrollHeight-_e.scrollTop-_e.clientHeight;ce.current=Be<=uv,wn(),An(),Ar();const it=M1({scrollTop:_e.scrollTop,previousScrollTop:ds.current,clientHeight:_e.clientHeight,hasMore:V,loading:Z,searching:De.length>0});ds.current=_e.scrollTop,hs.current=_e.scrollHeight-_e.scrollTop,it&&tr()},[wn,An,Ar,V,Z,tr,De]),ms=M.useCallback(_e=>{const Be=ge.current;Be===null||!V||Z||De.length>0||A1(_e.deltaY,Be.scrollTop,Be.clientHeight)&&tr()},[V,Z,tr,De]),gs=M.useCallback(()=>{const _e=ge.current;_e!==null&&(_e.scrollTop=_e.scrollHeight,ce.current=!0,We(!1),Oe(0),Xe.current=null,et(!1),Vt(!1))},[]),Ws=M.useCallback(()=>{const _e=ge.current;if(_e===null)return;const Be=Ln(_e);if(Be!==null){ce.current=!1,_e.scrollTop=Ip(_e.scrollTop,Be);return}Xe.current===null&&(Xe.current={pages:0},et(!0))},[Ln]),Et=M.useCallback((_e,Be)=>{Be===null?Le.current.delete(_e):Le.current.set(_e,Be)},[]),zs=M.useCallback(_e=>{const Be=$p(_e,ye);navigator.clipboard.writeText(Be).then(()=>{be(_e.event.eventId),window.setTimeout(()=>be(null),1200)}).catch(()=>be(null))},[ye,Ae]),mr=_e=>{at.length!==0&&pe(Be=>(Be+_e+at.length)%at.length)};return o.jsx(dv.Provider,{value:I,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:w("thread.search.placeholder"),value:ue,onChange:_e=>ht(_e.target.value),onKeyDown:_e=>{_e.key==="Enter"&&mr(_e.shiftKey?-1:1),_e.stopPropagation()},spellCheck:!1}),De.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"conversation-matches",children:at.length===0?w("thread.search.none"):`${se+1}/${at.length}`}),o.jsx("button",{className:"icon-button",onClick:()=>mr(-1),disabled:at.length===0,title:w("thread.search.previous"),children:"↑"}),o.jsx("button",{className:"icon-button",onClick:()=>mr(1),disabled:at.length===0,title:w("thread.search.next"),children:"↓"})]}),o.jsx("span",{className:"conversation-spacer"}),x!==void 0&&o.jsx(Zg,{targets:m,className:"icon-button conversation-continue",text:o.jsxs(o.Fragment,{children:[o.jsx(K1,{}),o.jsx("span",{children:w("thread.continueCli")})]}),label:vh(),blockedReason:f,onPick:x}),p!==void 0&&o.jsx("button",{className:"icon-button thread-font-button",onClick:p.cycle,title:ll(p.size),"aria-label":ll(p.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(y1,{windows:D,setupState:H,onConfigure:W}),o.jsx(c1,{usage:z,source:k,instructionsFile:y,fallbackWindow:P.contextWindow,compact:!0,statusLineState:_,onConfigure:u,compactAction:G})]})]}),o.jsxs("div",{className:"conversation-scroll-frame",children:[o.jsxs("div",{className:"conversation-scroll",ref:ge,onScroll:ps,onWheel:ms,children:[V&&o.jsxs("button",{className:`conversation-more${Z?" conversation-more-loading":""}`,onClick:ee,disabled:Z,"aria-busy":Z,children:[Z&&o.jsx("span",{className:"conversation-more-spinner","aria-hidden":"true"}),w(Z?"thread.loadingMore":"thread.loadEarlier")]}),tt.length===0&&o.jsxs("p",{className:"conversation-empty",children:[U==="unavailable"?w("thread.empty.unavailable"):U==="no-transcript"?sk():w(U==="waiting"?"thread.empty.waiting":"thread.empty.noMessages"),U==="waiting"&&b&&o.jsxs(o.Fragment,{children:[o.jsx("br",{}),ik()]})]}),mt.map(_e=>{if(_e.kind==="card")return o.jsx(Wp,{card:_e.card,results:ye,needle:De,isMatch:_e.card.event.eventId===Xt,copied:Ce===_e.card.event.eventId,images:ve,onRequestImage:Se,onCopy:()=>zs(_e.card),onRewind:s,rewindBlocked:a,register:Et,answered:je,answerFailed:Je,answerable:d,onAnswer:Ie},_e.card.event.eventId);const Be=_e.cards.some(it=>bt.has(it.event.eventId));return o.jsx(PS,{summary:_e.summary,at:_e.at,open:Be,children:_e.cards.map(it=>o.jsx(Wp,{card:it,results:ye,needle:De,isMatch:it.event.eventId===Xt,copied:Ce===it.event.eventId,images:ve,onRequestImage:Se,onCopy:()=>zs(it),onRewind:s,rewindBlocked:a,register:Et,answered:je,answerFailed:Je,answerable:d,onAnswer:Ie},it.event.eventId))},_e.id)}),c==="live"&&Ze!==null&&o.jsx("article",{className:"turn turn-assistant turn-live-question",children:o.jsx(fv,{part:Ze,answeredAt:je[Ze.toolUseId]??null,failure:Je[Ze.toolUseId]??null,answerable:d,onAnswer:Ie,needle:De})}),c==="live"&&te.length>0&&o.jsx(DS,{queue:te,canForce:B&&te.some(_e=>_e.forced!==!0),forceBlocked:$!==null,forcing:we,onForce:oe,canEdit:F&&te.every(_e=>_e.forced!==!0),editing:X,onEdit:me})]}),Ye&&(tn||fe)&&o.jsx("button",{ref:Us,className:`conversation-jump conversation-jump-own${fe?" is-seeking":""}`,onClick:Ws,disabled:fe,"aria-busy":fe,title:w("thread.jumpToOwn"),"aria-label":w("thread.jumpToOwn"),children:o.jsx("span",{"aria-hidden":"true",children:"↑"})}),Ye&&o.jsxs("button",{ref:nn,className:`conversation-jump${He>0?" has-unseen":""}${Pt?" is-hinting":""}`,onClick:gs,title:He>0?w("thread.jumpToEndNew",{count:He}):w("thread.jumpToEnd"),"aria-label":He>0?w("thread.jumpToEndNew",{count:He}):w("thread.jumpToEnd"),children:[o.jsx("span",{"aria-hidden":"true",children:"↓"}),He>0&&o.jsx("span",{className:"conversation-jump-count",children:He>99?"99+":He}),Pt&&o.jsx("span",{className:"conversation-jump-tip","aria-hidden":"true",children:He>0?w("thread.jumpToEndNew",{count:He}):w("thread.jumpToEnd")})]})]}),o.jsx(NS,{live:c==="live"&&N===null,activity:R,waitingFor:$,receipt:S,events:Y,clock:L,subagents:K}),N!==null&&(N.state==="relaunching"||c==="live")?o.jsx(AS,{text:N.text,relaunching:N.state==="relaunching",onRelaunch:v}):c==="live"?$===null&&E!==null?o.jsx(jS,{notice:E,onGoToCli:i}):o.jsx(IS,{waitingFor:$,questionsAnswerable:d,liveQuestion:Ze!==null,onGoToCli:i}):o.jsx(MS,{presence:c,exitCode:g,waking:h,onWake:v})]})})}const LS=1e3;function NS({live:t,activity:e,waitingFor:s,receipt:a,events:d,clock:k,subagents:y}){const[,i]=M.useState(0),c=Date.now(),g=_C({live:t,activity:e,waitingFor:s,receipt:a,events:d,clock:k,now:c}),v=t?y:[],h=g!==null||v.length>0;return M.useEffect(()=>{if(!h)return;const b=window.setInterval(()=>i(E=>E+1),LS);return()=>window.clearInterval(b)},[h]),h?o.jsxs("div",{className:"thread-status",children:[g!==null&&o.jsxs("div",{className:`thread-status-row thread-status-${g.kind}`,children:[o.jsx(RS,{kind:g.kind}),o.jsx("span",{className:"thread-status-text",children:wC(g,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:yC(v,c)})]})]}):null}function RS({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 MS({presence:t,exitCode:e,waking:s,onWake:a}){const d=t==="sleeping"?w("thread.wake.sleeping"):e===null?w("thread.wake.exited"):w("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:d}),o.jsx("button",{className:"primary-button primary-button-small",onClick:a,disabled:s,children:w(s?"thread.wake.opening":"thread.wake.open")})]})}function AS({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?uk():ck()})]})}function IS({waitingFor:t,questionsAnswerable:e,liveQuestion:s,onGoToCli:a}){if(t===null)return null;const d=s&&e?w("agent.waiting.question"):Cg(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:d}),o.jsx("button",{className:"link-button",onClick:a,children:w("thread.goToCli")})]})}function jS({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:w("thread.goToCli")})]})}function Wp({card:t,results:e,needle:s,isMatch:a,copied:d,images:k,onRequestImage:y,onCopy:i,onRewind:c,rewindBlocked:g=!1,register:v,answered:h,answerFailed:b,answerable:E,onAnswer:N}){const{event:_}=t,u=_.role==="user",p=m=>{const f=h[m.toolUseId];return f!==void 0?f:e.has(m.toolUseId)?[]:null};return o.jsxs("article",{ref:m=>v(_.eventId,m),className:`turn turn-${_.role}${a?" turn-match":""}`,children:[o.jsxs("div",{className:"turn-actions",children:[o.jsx("button",{className:"icon-button",onClick:i,title:w("thread.copyMessage"),children:d?"✓":"⧉"}),u&&c!==void 0&&wS(_)&&o.jsx("button",{className:"icon-button",onClick:()=>c(_.eventId),disabled:g,title:w(g?"thread.rewindBusy":"thread.rewind"),children:"↩"})]}),t.parts.map((m,f)=>o.jsx(BS,{part:m,eventId:_.eventId,mine:u,result:m.kind==="tool-call"?e.get(m.toolUseId)??null:null,needle:s,images:k,onRequestImage:y,answeredAt:m.kind==="question"?p(m):null,failure:m.kind==="question"?b[m.toolUseId]??null:null,answerable:E,onAnswer:N},f)),o.jsx(OS,{event:_,mine:u})]})}function DS({queue:t,canForce:e,forceBlocked:s,forcing:a,onForce:d,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(pv,{text:c.text,truncated:c.truncated,needle:""}),c.images>0&&o.jsx("div",{className:"turn-pending-images",children:w("thread.queue.images",{count:c.images})}),o.jsxs("div",{className:"turn-meta",children:[o.jsx("span",{className:"turn-who",children:w("thread.turn.you")}),c.at>0&&o.jsx("span",{children:Ni(c.at)}),o.jsx("span",{className:"turn-pending-state",title:c.forced===!0?w("thread.queue.forcedTitle"):w("thread.queue.labelTitle"),children:c.forced===!0?w("thread.queue.forced"):w("thread.queue.label")}),k&&o.jsx("button",{className:"queued-edit",onClick:i,disabled:y||a||s,"aria-busy":y,title:s?w("thread.queue.forceBlocked"):w("thread.queue.editTitle",{count:t.length}),children:w(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:d,disabled:a||s||y,"aria-busy":a,title:w(s?"thread.queue.forceBlocked":"thread.queue.forceSendTitle"),children:w(a?"thread.queue.forcing":"thread.queue.forceSend")})})]})}function PS({summary:t,at:e,open:s,children:a}){const d=e>0?Ni(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}),d.length>0&&o.jsx("span",{className:"tool-group-time",children:d})]}),o.jsx("div",{className:"tool-group-body",children:a})]})}function OS({event:t,mine:e}){const s=t.at>0?Ni(t.at):"",a=[];return t.durationMs!==null&&a.push(Dk(t.durationMs)),t.effort!==null&&a.push(w("thread.turn.effort",{effort:t.effort})),o.jsxs("div",{className:"turn-meta",children:[e&&o.jsx("span",{className:"turn-who",children:w("thread.turn.you")}),s.length>0&&o.jsx("span",{children:s}),t.queued&&o.jsx("span",{className:"turn-queued",title:w("thread.turn.queuedTitle"),children:w("thread.turn.queued")}),a.map(d=>o.jsx("span",{className:"turn-meta-bit",children:d},d))]})}function BS({part:t,eventId:e,mine:s,result:a,needle:d,images:k,onRequestImage:y,answeredAt:i,failure:c,answerable:g,onAnswer:v}){const h=M.useContext(dv);switch(t.kind){case"text":return s?o.jsx(pv,{text:t.text,truncated:t.truncated,needle:d}):o.jsxs("div",{className:"part-text",children:[o.jsx(yh,{text:t.text,needle:d,codeLink:h==null?void 0:h.code,localLink:h==null?void 0:h.link}),t.truncated&&o.jsxs("span",{className:"part-truncated",children:[" ",w("thread.truncated")]})]});case"image":return o.jsx(HS,{eventId:e,index:t.index,source:t.source,src:k[Yu(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:cs(ev(t),d)});case"question":return o.jsx(fv,{part:t,answeredAt:i,failure:c,answerable:g,onAnswer:v,needle:d});case"tool-call":{const b=d.length>0&&`${t.name} ${t.input} ${(a==null?void 0:a.text)??""}`.toLowerCase().includes(d.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}),a!==null&&a.isError&&o.jsx("span",{className:"tool-error",children:w("thread.tool.error")}),a!==null&&a.imageCount>0&&o.jsx("span",{className:"tool-images",children:w("thread.tool.images",{count:a.imageCount})})]}),o.jsxs("div",{className:"tool-block",children:[o.jsx("span",{className:"tool-label",children:w("thread.tool.input")}),o.jsxs("pre",{className:"tool-pre",children:[cs(t.input,d),t.truncated&&o.jsxs("span",{className:"part-truncated",children:[" ",w("thread.truncated")]})]})]}),a!==null&&o.jsxs("div",{className:"tool-block",children:[o.jsx("span",{className:"tool-label",children:w("thread.tool.result")}),o.jsxs("pre",{className:`tool-pre${a.isError?" tool-pre-error":""}`,children:[a.text.length>0?cs(a.text,d):a.imageCount>0?w("thread.tool.imagesNotSent",{count:a.imageCount}):w("thread.tool.noOutput"),a.truncated&&o.jsxs("span",{className:"part-truncated",children:[" ",w("thread.truncated")]})]})]})]})}case"tool-result":return o.jsxs("div",{className:"tool-block",children:[o.jsx("span",{className:"tool-label",children:w("thread.tool.orphanResult")}),o.jsx("pre",{className:`tool-pre${t.isError?" tool-pre-error":""}`,children:cs(t.text,d)})]})}}function fv({part:t,answeredAt:e,failure:s,answerable:a,onAnswer:d,needle:k}){var j;const[y,i]=M.useState(()=>t.questions.map(()=>[])),[c,g]=M.useState(null),[v,h]=M.useState(""),b=e!==null,E=b||!a,N=e??y,_=t.questions.length===1&&((j=t.questions[0])==null?void 0:j.multiSelect)===!1,u=N.every(T=>Xa(T)?T.text.trim().length>0:T.length>0),p=T=>T===void 0||Xa(T)?[]:T,m=(T,R)=>{if(E)return;const S=t.questions[T];if(S!==void 0){if(_){d(t.toolUseId,[[R]]);return}g(L=>L===T?null:L),i(L=>L.map((I,B)=>{if(B!==T)return I;const F=p(I);return S.multiSelect?F.includes(R)?F.filter(D=>D!==R):[...F,R]:[R]}))}},f=T=>{const R=v.trim();if(R.length===0||E)return;const S={kind:"free",text:R};if(_){d(t.toolUseId,[S]);return}i(L=>L.map((I,B)=>B===T?S:I)),g(null),h("")},x=T=>{if(E)return;const R=N[T];h(R!==void 0&&Xa(R)?R.text:""),g(T)};return o.jsxs("div",{className:`question${b?" question-done":""}`,children:[t.questions.map((T,R)=>{const S=N[R],L=S!==void 0&&Xa(S)?S.text:null;return o.jsxs("div",{className:"question-item",children:[o.jsxs("div",{className:"question-head",children:[T.header.length>0&&o.jsx("span",{className:"question-header",children:T.header}),o.jsx("span",{className:"question-text",children:cs(T.question,k)}),T.multiSelect&&o.jsx("span",{className:"question-hint",children:w("thread.question.multi")})]}),o.jsxs("div",{className:"question-options",children:[T.options.map((I,B)=>{const F=p(S).includes(B);return o.jsxs("button",{type:"button",className:`question-option${F?" question-option-picked":""}`,disabled:E,onClick:()=>m(R,B),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})]},B)}),c===R&&!E?o.jsxs("div",{className:"question-write",children:[o.jsx("textarea",{className:"question-write-input",autoFocus:!0,rows:2,value:v,placeholder:w("thread.question.placeholder"),onChange:I=>h(I.target.value),onKeyDown:I=>{I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),f(R)),I.key==="Escape"&&g(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:()=>g(null),children:w("common.cancel")})]})]}):o.jsxs("button",{type:"button",className:`question-option question-option-write${L!==null?" question-option-picked":""}`,disabled:E,onClick:()=>x(R),children:[o.jsx("span",{className:"question-option-label",children:L!==null?L:w("thread.question.writeOther")}),L===null&&o.jsx("span",{className:"question-option-desc",children:w("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:w("thread.question.answered")}):a?o.jsxs(o.Fragment,{children:[!_&&o.jsx("button",{type:"button",className:"question-send",disabled:!u,onClick:()=>d(t.toolUseId,y),children:w("thread.question.sendAnswers")}),o.jsx("span",{className:"question-note",children:w(_?"thread.question.pickOne":"thread.question.pickEach")})]}):o.jsx("span",{className:"question-note",children:w("thread.question.answerInCli")})]})]})}function pv({text:t,truncated:e,needle:s}){const a=Tk(t,e),d=a.length===1?a[0]:void 0;if(d!==void 0&&d.kind==="text")return o.jsx(zp,{text:t,truncated:e,needle:s});const k=a.length-1;return o.jsx("div",{className:"part-own",children:a.map((y,i)=>y.kind==="text"?o.jsx(zp,{text:y.text,truncated:e&&i===k,needle:s},i):o.jsx(FS,{number:y.number,text:y.text,complete:y.complete,needle:s},i))})}function FS({number:t,text:e,complete:s,needle:a}){const[d,k]=M.useState(!1),y=a.length>0&&e.toLowerCase().includes(a.toLowerCase()),i=d||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:"¶"}),w("thread.pasted",{number:t,count:So(e)}),!s&&o.jsxs("span",{className:"part-truncated",children:[" ",w("thread.truncated")]}),o.jsx("span",{className:"chip-chevron",children:i?"▾":"▸"})]}),i&&o.jsx("div",{className:"thread-pasted-text part-mine",children:hv(e,a)})]})}function zp({text:t,truncated:e,needle:s}){const[a,d]=M.useState(!1),k=t.split(`
|
|
137
|
-
`),y=s.length>0&&t.toLowerCase().includes(s.toLowerCase()),i=k.length>=Hp&&!y,c=i&&!a?k.slice(0,Hp-1).join(`
|
|
138
|
-
`):t;return o.jsxs("div",{className:"part-text part-mine",children:[hv(c,s),e&&o.jsxs("span",{className:"part-truncated",children:[" ",w("thread.truncated")]}),i&&o.jsx("button",{className:"fold-toggle",onClick:()=>d(g=>!g),children:a?w("thread.fold.less"):w("thread.fold.more",{count:k.length})})]})}function HS({eventId:t,index:e,source:s,src:a,onRequest:d}){const[k,y]=M.useState(!1);return M.useEffect(()=>{a===void 0&&d(t,e,s)},[a,t,e,s,d]),a===void 0?o.jsx("div",{className:"conversation-image-placeholder",children:w("thread.image.loading")}):a===null?o.jsx("div",{className:"conversation-image-placeholder",children:w("thread.image.gone")}):o.jsxs(o.Fragment,{children:[o.jsx("img",{className:"conversation-image",src:a,alt:w("thread.image.alt"),onClick:()=>y(!0),title:w("thread.image.openTitle")}),k&&o.jsx(Ig,{src:a,caption:w("thread.image.alt"),onClose:()=>y(!1)})]})}function qp({connection:t,title:e,confirmLabel:s,confirmTitle:a,onChoose:d,onClose:k}){const[y,i]=M.useState(null),[c,g]=M.useState(null),[v,h]=M.useState(!1),[b,E]=M.useState(""),N=M.useRef(null),_=M.useRef(null);M.useEffect(()=>{const f=t.onMessage(x=>{if(x.type==="picker.listing"){N.current=x.listing.pickerId,i(x.listing),g(null),h(!1),E("");return}x.type==="error"&&x.code==="picker-failed"&&g(At(x.text))});return t.send({type:"picker.open"}),()=>{f();const x=N.current;x!==null&&t.send({type:"picker.close",pickerId:x})}},[t]),M.useEffect(()=>{const f=x=>{x.key==="Escape"&&(x.preventDefault(),x.stopPropagation(),k())};return window.addEventListener("keydown",f,!0),()=>window.removeEventListener("keydown",f,!0)},[k]),M.useEffect(()=>{var f;v&&((f=_.current)==null||f.focus())},[v]);const u=M.useCallback(f=>{const x=N.current;x!==null&&t.send({type:"picker.enter",pickerId:x,name:f})},[t]),p=M.useCallback(f=>{const x=N.current;x!==null&&t.send({type:"picker.root",pickerId:x,rootIndex:f})},[t]),m=M.useCallback(()=>{const f=N.current,x=b.trim();f===null||x.length===0||t.send({type:"picker.create",pickerId:f,name:x})},[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:w("common.close"),children:"×"})]}),y===null?o.jsx("p",{className:"panel-note",children:w("picker.loading")}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"picker-roots",children:y.roots.map((f,x)=>o.jsx("button",{className:"picker-root",onClick:()=>p(x),title:w("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:()=>u(".."),children:["‹ ",w("picker.up")]}),y.entries.length===0&&!y.canGoUp&&o.jsx("p",{className:"panel-note",children:w("picker.empty")}),y.entries.map(f=>o.jsx("button",{className:"picker-entry",onClick:()=>u(f),children:f},f)),y.truncated&&o.jsx("p",{className:"panel-note",children:w("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:_,className:"picker-create-input",value:b,placeholder:w("picker.newFolderName"),onChange:f=>E(f.target.value),onKeyDown:f=>{f.key==="Enter"&&m(),f.key==="Escape"&&(f.stopPropagation(),h(!1)),f.stopPropagation()},spellCheck:!1}),o.jsx("button",{className:"primary-button primary-button-small",onClick:m,children:w("picker.create")}),o.jsx("button",{className:"link-button",onClick:()=>h(!1),children:w("common.cancel")})]}):o.jsx("button",{className:"primary-button primary-button-small",onClick:()=>h(!0),children:w("picker.createHere")}),o.jsx("span",{className:"composer-spacer"}),o.jsx("button",{className:"picker-open",onClick:()=>d(y.pickerId,y.path),title:a(y.path),children:s})]})]})]})})}function US(t,e){return ch(t)&&e!==null&&e.sessions>0}function $S(){return w("search.mode.titles")}function WS(){return w("search.mode.conversations")}function zS(){return w("search.mode.conversationsTitle")}function qS(t){return w(t==="conversations"?"search.placeholder.conversations":"search.placeholder.titles")}function VS(){return w("search.tooShort",{min:rg})}function KS(t){return[...t.trim()].length<rg}function GS(){return w("search.off")}function YS(t){const e=new Map;for(const s of t){const a=`${s.agent}:${s.sessionId}`;let d=e.get(a);d===void 0&&(d={key:a,agent:s.agent,sessionId:s.sessionId,title:s.title,titleHit:null,hits:[],lastAt:null},e.set(a,d)),s.eventId===null?d.titleHit=s:d.hits.push(s),s.at!==null&&(d.lastAt=Math.max(d.lastAt??0,s.at))}return[...e.values()]}const XS=40;function mv(t,e=XS){const s=t.matchStart+t.matchLength;let a=t.snippet.slice(0,t.matchStart);if(a.length>e){let d=a.length-e;const k=a.charCodeAt(d);k>=56320&&k<=57343&&(d+=1),a=`…${a.slice(d)}`}return{before:a,match:t.snippet.slice(t.matchStart,s),after:t.snippet.slice(s)}}function QS(t){return t.role==="user"?w("search.role.user"):t.role==="assistant"?w("search.role.assistant"):w("search.role.title")}function gv(t){return mv(t).match.trim()}function JS(t){const e=t.hits[0]??t.titleHit;return e===null?"":gv(e)}const Xu=t=>w("search.sessions",{count:t});function ZS(t,e){return{query:e.query,hits:t===null?[...e.hits]:[...t.hits,...e.hits],sessionsScanned:e.sessionsScanned,sessionsTotal:e.sessionsTotal,truncated:null}}function ex(t){const{result:e}=t;if(t.searching&&t.error===null){if(e===null)return w("search.status.searching");const a={count:e.sessionsTotal,scanned:e.sessionsScanned};return e.hits.length===0?w("search.status.progress",a):w("search.status.progressFound",{...a,found:Vp(e)})}if(t.error!==null)return t.error;if(e===null)return null;const s=e.hits.length===0?w("search.status.none"):Vp(e);if(e.truncated===null&&e.hits.length===0&&e.sessionsScanned>0)return w("search.status.noneIn",{sessions:Xu(e.sessionsScanned)});if(e.truncated==="results")return w("search.status.truncatedResults",{found:s});if(e.truncated==="time"){const a=Math.max(0,e.sessionsTotal-e.sessionsScanned);return w("search.status.truncatedTime",{found:s,seconds:Math.round(fy/1e3),left:Xu(a)})}return w("search.status.done",{found:s})}function Vp(t){const e=new Set(t.hits.map(s=>`${s.agent}:${s.sessionId}`)).size;return w("search.found",{hits:w("search.hits",{count:t.hits.length}),sessions:Xu(e)})}function tx(t,e){const s=e.terminals.find(a=>a.kind==="agent"&&a.agent===t.agent&&a.sessionId===t.sessionId);if(s!==void 0)return{kind:"activate",terminalId:s.terminalId};for(const a of e.projects){const d=a.sessions.find(k=>k.agent===t.agent&&k.sessionId===t.sessionId);if(d!==void 0)return el(d)&&a.cwdExists&&e.canResume(d.agent)?{kind:"resume",cwd:lg(d.cwd,a.cwd,e.platform),session:d}:{kind:"copy"}}return{kind:"copy"}}const nx=/<(code|kbd|b|strong|em)>([\s\S]*?)<\/\1>|<br\s*\/?>/g;function on(t,e,s){const a=mg(t,e),d=[];let k=0;for(const y of a.matchAll(nx)){const i=y.index??0;i>k&&d.push(Za(a.slice(k,i),e));const c=y[1];if(c===void 0)d.push(M.createElement("br",{key:d.length}));else{const g=Za(y[2]??"",e);d.push(M.createElement(c,{key:d.length},g))}k=i+y[0].length}return k<a.length&&d.push(Za(a.slice(k),e)),d.length===1?d[0]:d}const Kp="0.8.0",Gp="agent-workbench.support-notice",rx=3e4;function sx(t){return/^[0-9A-Za-z][0-9A-Za-z.+-]{0,39}$/.test(t)?t:null}function ix(t,e){return t!==e}function ox(){return[{keys:"Alt + T",description:w("shortcuts.app.newTab")},{keys:"Alt + W",description:w("shortcuts.app.closeTab")},{keys:"Alt + ← / →",description:w("shortcuts.app.switchTab")},{keys:"Alt + P",description:w("shortcuts.app.togglePanel")},{keys:"Shift + Tab",description:w("shortcuts.app.previousTab")}]}function ax({agent:t,onClose:e}){return M.useEffect(()=>{const s=a=>{a.key==="Escape"&&(a.preventDefault(),a.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":w("shortcuts.ariaLabel"),onClick:s=>s.stopPropagation(),children:[o.jsxs("header",{className:"modal-header",children:[o.jsx("span",{className:"modal-title",children:w("shortcuts.title")}),o.jsx("button",{className:"icon-button",onClick:e,title:w("common.close"),children:"×"})]}),o.jsxs("div",{className:"modal-body",children:[o.jsx("h3",{className:"modal-section",children:w("shortcuts.section.app")}),o.jsx(Su,{shortcuts:ox()}),o.jsx("h3",{className:"modal-section",children:w("shortcuts.section.composer")}),o.jsx(Su,{shortcuts:Ib(t!==null&&t.capabilities.imagesByPath!==null)}),t!==null&&o.jsxs(o.Fragment,{children:[o.jsx("h3",{className:"modal-section",children:w("shortcuts.section.cli")}),o.jsx("p",{className:"modal-hint",children:on("shortcuts.cliHint")}),o.jsx(Su,{shortcuts:us[t.id].shortcuts}),us[t.id].shortcutsNote!==null&&o.jsx("p",{className:"modal-hint",children:us[t.id].shortcutsNote})]}),o.jsx("p",{className:"modal-hint",children:on("shortcuts.browserReserved")}),o.jsx("p",{className:"modal-hint",children:on("shortcuts.altNumber")}),o.jsxs("p",{className:"modal-hint support-hint",children:[o.jsx("span",{"aria-hidden":"true",children:"☕"})," ",w("support.notice")," ",o.jsx("a",{href:cg,target:"_blank",rel:"noreferrer noopener",children:w("support.link")})]})]})]})})}function Su({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 lx=1e3,cx=5e3;function Yp({info:t,agentLabel:e,purpose:s="status",onRefresh:a,onClose:d}){const[k,y]=M.useState(!1),[i,c]=M.useState(!1),g=M.useRef(null),v=M.useRef(null);M.useEffect(()=>{const u=p=>{p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),d())};return window.addEventListener("keydown",u,!0),()=>window.removeEventListener("keydown",u,!0)},[d]),M.useEffect(()=>{c(!1)},[t]),M.useEffect(()=>()=>{g.current!==null&&window.clearTimeout(g.current),v.current!==null&&window.clearTimeout(v.current)},[]);const h=u=>{navigator.clipboard.writeText(u).then(()=>{y(!0),g.current!==null&&window.clearTimeout(g.current),g.current=window.setTimeout(()=>y(!1),lx)}).catch(()=>y(!1))},b=()=>{c(!0),a(),v.current!==null&&window.clearTimeout(v.current),v.current=window.setTimeout(()=>c(!1),cx)},E=t.state==="active",N=w("statusLine.title",{agent:e}),_=s==="plan-limits";return o.jsx("div",{className:"modal-backdrop",onClick:d,children:o.jsxs("div",{className:"modal",role:"dialog","aria-label":N,onClick:u=>u.stopPropagation(),children:[o.jsxs("header",{className:"modal-header",children:[o.jsx("span",{className:"modal-title",children:N}),o.jsx("button",{className:"icon-button",onClick:d,title:w("common.close"),children:"×"})]}),o.jsxs("div",{className:"modal-body",children:[o.jsx("p",{className:`status-line-state${E?" status-line-state-active":""}`,children:Lb(t.state)}),o.jsx("p",{className:"modal-hint",children:w(_?"statusLine.planBenefit":"statusLine.benefit")}),_&&o.jsx("p",{className:"modal-hint",children:w("statusLine.planReplaces")}),o.jsx("h3",{className:"modal-section",children:w("statusLine.lineSection")}),t.fragment===null?o.jsx("p",{className:"modal-hint",children:_?w("statusLine.planNoFragment"):Nb()}):o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"modal-hint",children:on("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:w("statusLine.copyTitle"),children:k?o.jsxs(o.Fragment,{children:["✓ ",w("statusLine.copied")]}):w("statusLine.copy")})]})]}),o.jsx("h3",{className:"modal-section",children:w("statusLine.whereSection")}),o.jsx("p",{className:"status-line-path",children:t.settingsPath}),o.jsx("p",{className:"modal-hint",children:w("statusLine.whereHint")}),o.jsx("h3",{className:"modal-section",children:w("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:on("statusLine.runsEverywhere")}),o.jsxs("div",{className:"status-line-actions",children:[o.jsx("button",{className:"primary-button",onClick:b,disabled:i,children:w(i?"statusLine.checking":"statusLine.check")}),o.jsx("span",{className:"modal-hint",children:w("statusLine.checkHint")})]})]})]})})}function ux(){const[t,e]=M.useState(()=>ix(Nt(Gp,null,sx),Kp));return M.useEffect(()=>{if(!t)return;yt(Gp,Kp);const s=window.setTimeout(()=>e(!1),rx);return()=>window.clearTimeout(s)},[t]),t?o.jsxs("div",{className:"banner banner-support",role:"status",children:[o.jsx("span",{children:w("support.notice")}),o.jsx("a",{className:"banner-support-link",href:cg,target:"_blank",rel:"noreferrer noopener",onClick:()=>e(!1),children:w("support.link")}),o.jsx("button",{className:"link-button banner-support-dismiss",onClick:()=>e(!1),children:w("support.dismiss")})]}):null}function Qu({agent:t,agents:e}){return o.jsx("span",{className:"agent-badge",title:Ro(t,e),children:pb(t)})}function Ju(){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 hx=500,Xp=10;function dx(t){const e=M.useRef(null),s=M.useRef(null),a=M.useRef(!1),d=M.useRef(t);d.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(),a.current=!1,s.current={x:v.clientX,y:v.clientY},e.current=window.setTimeout(()=>{e.current=null,a.current=!0,d.current()},hx))},[k]),i=M.useCallback(v=>{const h=s.current;h!==null&&(Math.abs(v.clientX-h.x)>Xp||Math.abs(v.clientY-h.y)>Xp)&&k()},[k]),c=M.useCallback(v=>{(a.current||e.current!==null)&&v.preventDefault()},[]),g=M.useCallback(v=>{a.current&&(a.current=!1,v.preventDefault(),v.stopPropagation())},[]);return{onPointerDown:y,onPointerMove:i,onPointerUp:k,onPointerCancel:k,onContextMenu:c,onClickCapture:g}}function fx({onLongPress:t,...e}){const s=dx(t);return o.jsx("button",{...e,...s})}function bh({className:t,text:e,title:s,disabled:a,offerAgentChoice:d,agents:k,agent:y,onOpen:i}){var N;const[c,g]=M.useState(!1),v=M.useRef(null),h=M.useCallback(()=>g(!1),[]),b=M.useCallback(_=>{g(!1),i(_)},[i]);if(!d)return o.jsx("button",{className:t,onClick:()=>i(),disabled:a,title:s,children:e});const E=((N=k.find(_=>_.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:a,title:E===null?s:w("agentMenu.titleWithAgent",{title:s,label:E}),children:e}),o.jsx("button",{ref:v,className:`${t} split-button-arrow`,onClick:()=>g(_=>!_),disabled:a,"aria-haspopup":"menu","aria-expanded":c,title:w("agentMenu.chooseTitle"),children:"▾"}),c&&v.current!==null&&o.jsx(Jg,{agents:k,preselected:y,anchor:v.current,onPick:b,onClose:h})]})}function px(t){const e=new Date(t);return e.setHours(0,0,0,0),e.getTime()}function vv(t,e,s,a){const d=new Set;for(const k of t)for(const y of k.sessions)y.agent===e&&(y.archived||y.updatedAt<s&&(a.has(y.sessionId)||d.add(y.sessionId)));return[...d]}function mx(t,e,s,a){const d=[];for(const i of t)for(const c of i.sessions)d.includes(c.agent)||d.push(c.agent);const k=a,y=i=>{const c=k.indexOf(i);return c===-1?a.length:c};return d.sort((i,c)=>y(i)-y(c)).map(i=>({agent:i,count:vv(t,i,e,s).length})).filter(i=>i.count>0)}function _v(t,e){const s=new Set;let a=0;for(const d of t.sessions)if(!d.archived){if(e.has(d.sessionId)){a+=1;continue}s.add(d.sessionId)}return{sessionIds:[...s],blocked:a}}function gx(t){const{sessionIds:e,blocked:s}=t;if(e.length===0)return w("archive.allBlocked",{count:s});const a=w("archive.confirm",{count:e.length});return s===0?a:w("archive.withBlocked",{confirm:a,blocked:w("archive.blockedStays",{count:s})})}const Qp=12;function vx(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 Hs(t){const e=t.toLowerCase().replace(/[\\/]+/g,"/").replace(/\/+$/,"");return`hsl(${vx(e)%Qp*(360/Qp)} var(--project-color-s) var(--project-color-l))`}function Ri(){return w("vault.name")}function _x(){return w("vault.privacy")}function wx(){return w("vault.archived")}function yx(){return w("vault.mark.copy")}function Jp(){return w("vault.mark.copyTitle")}function bx(){return w("vault.mark.partial")}function kx(){return w("vault.mark.partialTitle")}function wv(t){return w("vault.sessions",{count:t})}function kh(t){return t==="measuring"||t==="writing"||t==="moving"}function Cx(t){const e=t.progress;switch(t.state){case"measuring":return e===null?w("vault.state.measuring"):w("vault.state.measuringProgress",{done:e.done,total:e.total});case"writing":return e===null?w("vault.state.writing"):w("vault.state.writingProgress",{done:e.done,total:e.total});case"moving":return w("vault.state.moving");default:return t.enabled?w("vault.state.on"):w("vault.state.off")}}function Sx(t){if(t===null||!t.enabled)return null;const e=[Ri(),wv(t.sessions)];return t.state==="writing"?e.push(t.progress===null?w("vault.line.copying"):w("vault.line.copyingProgress",{done:t.progress.done,total:t.progress.total})):t.state==="moving"?e.push(w("vault.line.moving")):t.state==="measuring"?e.push(w("vault.line.measuring")):e.push(t.lastPassAt===null?w("vault.line.neverCopied"):$n(t.lastPassAt)),t.pending>0&&e.push(w("vault.line.pending",{count:t.pending})),e.join(" · ")}function xx(t){return t===null?Ri():t.enabled?w("vault.button.on"):w("vault.button.off")}function Ex(t){return t.enabled?"enabled":kh(t.state)?"busy":t.measurement!==null?"measured":t.passSessions>0?"existing":"needs-measure"}function Tx(t,e){return kh(t.state)?w("vault.busy"):e?null:w("vault.indexNotReady")}function Lx(t){return kh(t.state)?w("vault.busy"):null}function Nx(t){return w("vault.previousDir",{dir:t})}function Rx(t){const e=[];return t.skippedEmpty>0&&e.push(w("vault.note.empty",{count:t.skippedEmpty})),t.unsupported>0&&e.push(w("vault.note.unsupported",{count:t.unsupported})),t.failed>0&&e.push(t.failureReasons.length>0?w("vault.note.failedWithReasons",{count:t.failed,reasons:t.failureReasons.map(At).join("; ")}):w("vault.note.failed",{count:t.failed})),e.length===0?null:w("vault.note.notCopied",{parts:e.join(" · ")})}function Mx(t,e){const s=t.byAgent.map(k=>({agent:k.agent,label:Ro(k.agent,e),sessions:k.sessions,bytes:k.eventBytes+k.imageBytes,images:k.images,imageBytes:k.imageBytes,skippedArchived:k.skippedArchived,note:Rx(k)})),a=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}),d=$n(t.measuredAt);return{rows:s,memoryProjects:t.memoryProjects,memoryBytes:t.memoryBytes,total:a,summary:d.length>0?w("vault.measure.summary",{when:d,duration:xo(t.durationMs)}):w("vault.measure.summaryNoWhen",{duration:xo(t.durationMs)})}}function Ax(t){const e=t.storage==="vault";return{copy:e,partial:e&&t.partial}}function Ix(t){switch(t){case"exporting":return w("vault.export.exporting");case"done":return w("vault.export.done");default:return w("vault.export.idle")}}const jx=1e3;function Zp({hit:t}){const{before:e,match:s,after:a}=mv(t);return o.jsxs(o.Fragment,{children:[e,o.jsx("mark",{children:s}),a]})}function Dx({project:t,openSessionIds:e,onConfirm:s,onCancel:a}){const d=_v(t,e);return o.jsxs("div",{className:"project-archive-confirm",role:"group",children:[o.jsx("span",{className:"archive-history-text",children:gx(d)}),d.sessionIds.length>0&&o.jsx("button",{className:"link-button",onClick:s,children:w("sidebar.action.archive")}),o.jsx("button",{className:"link-button",onClick:a,children:d.sessionIds.length>0?w("common.cancel"):w("common.close")})]})}function xu(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 em({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 Px(){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 Ox({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 Bx({candidates:t,agents:e,onArchiveAgent:s,onClose:a,anchorRef:d}){const[k,y]=M.useState(null),i=M.useRef(null);return M.useEffect(()=>{const c=h=>{var b,E;return h instanceof Node&&(((b=i.current)==null?void 0:b.contains(h))===!0||((E=d.current)==null?void 0:E.contains(h))===!0)},g=h=>{h.key!=="Escape"||!c(document.activeElement)||(h.preventDefault(),h.stopPropagation(),a())},v=h=>{c(h.target)||a()};return window.addEventListener("keydown",g,!0),document.addEventListener("pointerdown",v,!0),()=>{window.removeEventListener("keydown",g,!0),document.removeEventListener("pointerdown",v,!0)}},[d,a]),o.jsxs("div",{ref:i,className:"archive-history",role:"region","aria-label":w("sidebar.history.region"),children:[o.jsxs("div",{className:"archive-history-header",children:[o.jsx("span",{children:w("sidebar.history.heading")}),o.jsx("button",{className:"icon-button",onClick:a,title:w("common.closeEsc"),children:"×"})]}),t.map(({agent:c,count:g})=>{const v=Ro(c,e);return k===c?o.jsxs("div",{className:"archive-history-row archive-history-confirm",children:[o.jsx("span",{className:"archive-history-text",children:w("sidebar.history.confirm",{count:g,label:v})}),o.jsx("button",{className:"link-button",onClick:()=>s(c),children:w("sidebar.action.archive")}),o.jsx("button",{className:"link-button",onClick:()=>y(null),children:w("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:w("sidebar.history.count",{count:g})})]}),o.jsx("button",{className:"link-button",onClick:()=>y(c),children:w("sidebar.action.archive")})]},c)})]})}function Fx({projects:t,indexStatus:e,disabled:s,openSessionIds:a,openBlocked:d,onOpenProject:k,agents:y,offerAgentChoice:i,agentForProject:c,onOpenSession:g,canResume:v,platform:h,onRefresh:b,onArchive:E,onHide:N,width:_,onNewProject:u,vault:p,onOpenVault:m,onOpenVaultSession:f,onExportProject:x,exporting:j,lastExported:T,onContinueSession:R,globalSearch:S,onOpenSearchHit:L,onNewWorktree:I,onReopenWorktree:B}){const[F,D]=M.useState(new Set),[H,W]=M.useState(null);M.useEffect(()=>{const fe=T===null?0:T.at+jx-Date.now();if(T===null||fe<=0)return;W(T.projectKey);const et=window.setTimeout(()=>W(null),fe);return()=>window.clearTimeout(et)},[T]);const G=fe=>j.has(fe)?"exporting":H===fe?"done":"idle",Y=Sx(p),[z,P]=M.useState(""),[U,$]=M.useState(!1),[K,te]=M.useState(new Set),[oe,we]=M.useState("titles"),me=S===null?"titles":oe,[X,V]=M.useState(!1),Z=S!==null&&me==="conversations"&&z.trim().length>0&&(X||S.submitted!==null),ee=(S==null?void 0:S.result)??null,ve=M.useMemo(()=>Z&&ee!==null?YS(ee.hits):[],[Z,ee]),Se=fe=>{we(fe),V(!1),S==null||S.clear()},Ie=()=>{if(S!==null){if(KS(z)){V(!0),S.clear();return}V(!1),S.search(z.trim(),U)}},je=(S==null?void 0:S.submitted)??null,Je=S==null?void 0:S.search;M.useEffect(()=>{me!=="conversations"||je===null||Je===void 0||je.includeArchived!==U&&Je(je.query,U)},[me,je,Je,U]);const Ze=M.useMemo(()=>t.reduce((fe,et)=>fe+et.sessions.filter(Xe=>Xe.archived).length,0),[t]),Ae=M.useMemo(()=>{const fe=me==="titles"?z.trim().toLowerCase():"";return t.map(et=>{const Xe=U?et.sessions:et.sessions.filter(Ke=>!Ke.archived);if(Xe.length===0)return null;if(fe.length===0)return{...et,sessions:Xe};if(xu(et).toLowerCase().includes(fe)||et.cwd.toLowerCase().includes(fe))return{...et,sessions:Xe};const de=Xe.filter(Ke=>hr(Ke.title,Ke.titleSource).toLowerCase().includes(fe));return de.length>0?{...et,sessions:de}:null}).filter(et=>et!==null)},[t,z,U,me]),ue=me==="titles"&&z.trim().length>0,ht=fe=>fe.archived||!a.has(fe.sessionId),[se,pe]=M.useState(!1),Ce=M.useRef(null),be=px(Date.now()),ge=M.useMemo(()=>y.map(fe=>fe.id),[y]),Le=M.useMemo(()=>mx(t,be,a,ge),[t,be,a,ge]),[ce,Ye]=M.useState(null);M.useEffect(()=>{Le.length===0&&pe(!1)},[Le.length]);const We=M.useCallback(()=>pe(!1),[]),He=fe=>{const et=vv(t,fe,be,a);et.length>0&&(E(et,!0),Ye({what:Ro(fe,y),sessionIds:et})),pe(!1)},[Oe,Ue]=M.useState(null),qe=fe=>{const et=_v(fe,a);et.sessionIds.length>0&&(E(et.sessionIds,!0),Ye({what:xu(fe),sessionIds:et.sessionIds})),Ue(null)},St=()=>{ce!==null&&E(ce.sessionIds,!1),Ye(null)},Pt=fe=>{te(et=>{const Xe=new Set(et);return Xe.has(fe)?Xe.delete(fe):Xe.add(fe),Xe})},$t=M.useMemo(()=>{const fe=[];for(const et of Ae)for(const Xe of et.sessions)K.has(Xe.sessionId)&&fe.push(Xe);return fe},[Ae,K]),dt=fe=>{const et=$t.filter(Xe=>fe?ht(Xe):!0).map(Xe=>Xe.sessionId);et.length>0&&E(et,fe),te(new Set)},tn=fe=>{D(et=>{const Xe=new Set(et);return Xe.has(fe)?Xe.delete(fe):Xe.add(fe),Xe})},Vt=e.state==="scanning";return o.jsxs("aside",{className:"sidebar",style:{width:`${_}px`},children:[o.jsxs("div",{className:"sidebar-header",children:[o.jsx("input",{className:"sidebar-filter",type:"search",placeholder:qS(me),value:z,onChange:fe=>{P(fe.target.value),me==="conversations"&&(V(!1),fe.target.value.trim().length===0&&(S==null||S.clear()))},onKeyDown:fe=>{me!=="conversations"||fe.key!=="Enter"||(fe.preventDefault(),Ie())},spellCheck:!1}),o.jsx("button",{className:"icon-button",onClick:u,title:w("sidebar.newProject"),disabled:s,children:"+"}),o.jsx("button",{className:"icon-button",onClick:b,title:w("sidebar.reindex"),disabled:Vt,children:"⟳"}),o.jsx("button",{className:`icon-button${(p==null?void 0:p.enabled)===!0?" icon-button-on":""}`,onClick:m,title:xx(p),"aria-label":Ri(),children:o.jsx(Px,{})}),o.jsx("button",{className:"icon-button",onClick:N,title:w("sidebar.hide"),children:"«"})]}),S!==null&&o.jsxs("div",{className:"sidebar-search-mode",role:"group","aria-label":w("sidebar.searchMode.label"),children:[o.jsx("button",{className:`sidebar-search-mode-option${me==="titles"?" is-on":""}`,"aria-pressed":me==="titles",onClick:()=>Se("titles"),title:w("sidebar.searchMode.titlesTitle"),children:$S()}),o.jsx("button",{className:`sidebar-search-mode-option${me==="conversations"?" is-on":""}`,"aria-pressed":me==="conversations",onClick:()=>Se("conversations"),title:zS(),children:WS()})]}),Vt&&o.jsx("div",{className:"sidebar-progress",children:w("sidebar.indexing",{scanned:e.scannedFiles,total:e.totalFiles})}),(Ze>0||Le.length>0)&&o.jsxs("div",{className:"sidebar-archive-bar",children:[Ze>0&&o.jsx("button",{className:`sidebar-archived-toggle${U?" is-on":""}`,onClick:()=>$(fe=>!fe),title:w("sidebar.archived.toggleTitle"),children:U?w("sidebar.archived.hide",{count:Ze}):w("sidebar.archived.show",{count:Ze})}),Le.length>0&&o.jsx("button",{ref:Ce,className:`link-button sidebar-archive-history${se?" is-on":""}`,onClick:()=>pe(fe=>!fe),"aria-expanded":se,title:w("sidebar.history.buttonTitle"),children:w("sidebar.history.button")})]}),se&&Le.length>0&&o.jsx(Bx,{candidates:Le,agents:y,onArchiveAgent:He,onClose:We,anchorRef:Ce}),ce!==null&&!se&&o.jsxs("div",{className:"archive-history archive-history-undo",role:"status",children:[o.jsx("span",{className:"archive-history-text",children:w("sidebar.undo.text",{count:ce.sessionIds.length,what:ce.what})}),o.jsx("button",{className:"link-button",onClick:St,children:w("sidebar.action.undo")}),o.jsx("button",{className:"icon-button",onClick:()=>Ye(null),title:w("sidebar.undo.dismissTitle"),children:"×"})]}),Y!==null&&o.jsx("button",{className:`sidebar-vault-line${(p==null?void 0:p.lastError)!=null?" is-problem":""}`,onClick:m,title:(p==null?void 0:p.lastError)!=null?w("sidebar.vaultLine.lastError",{error:At(p.lastError)}):w("sidebar.vaultLine.title"),children:Y}),o.jsxs("div",{className:"sidebar-scroll",children:[Z&&S!==null&&o.jsxs("div",{className:"search-results",children:[!S.vaultEnabled&&o.jsx("p",{className:"search-note",children:GS()}),o.jsx("p",{className:`search-status${S.error!==null?" is-problem":""}`,role:"status",children:X?VS():ex(S)}),!X&&ve.map(fe=>{const et=fe.hits[0]??fe.titleHit;return et===null?null:o.jsxs("div",{className:"search-group",children:[o.jsxs("button",{className:"search-group-title",onClick:()=>L(et,JS(fe)),title:hr(fe.title),children:[o.jsx(Qu,{agent:fe.agent,agents:y}),fe.titleHit!==null?o.jsx(Zp,{hit:fe.titleHit}):hr(fe.title)]}),fe.hits.map(Xe=>o.jsxs("button",{className:"search-hit",onClick:()=>L(Xe,gv(Xe)),children:[o.jsx("span",{className:"search-hit-snippet",children:o.jsx(Zp,{hit:Xe})}),o.jsxs("span",{className:"search-hit-meta",children:[QS(Xe),Xe.at!==null?` · ${$n(Xe.at)}`:""]})]},Xe.eventId??"titulo"))]},fe.key)})]}),!Z&&Ae.length===0&&!Vt&&o.jsx("p",{className:"sidebar-empty",children:t.length===0?w("sidebar.empty.noProjects"):w("sidebar.empty.noMatch")}),!Z&&Ae.map(fe=>{const et=F.has(fe.key)||ue,Xe=!s&&fe.cwdExists,lt=d(fe.cwd);return o.jsxs("div",{className:"project",children:[o.jsxs("div",{className:"project-row",children:[o.jsxs("button",{className:"project-toggle",onClick:()=>tn(fe.key),title:fe.cwd.length>0?fe.cwd:fe.fallbackName,children:[o.jsx("span",{className:`chevron${et?" chevron-open":""}`,children:"›"}),o.jsx("span",{className:"project-swatch",style:{background:Hs(fe.cwd)},"aria-hidden":"true"}),o.jsx("span",{className:"project-name",children:xu(fe)}),o.jsx("span",{className:"project-count",children:fe.sessions.length})]}),o.jsxs("span",{className:"project-actions",children:[I!==null&&fe.isGitRepo&&fe.cwdExists&&o.jsx("button",{className:"icon-button project-action",onClick:()=>I(fe),disabled:s,title:w("worktree.new"),"aria-label":w("worktree.new"),children:o.jsx(Ju,{})}),x!==null&&o.jsx("button",{className:`icon-button project-action${G(fe.key)!=="idle"?" project-action-busy":""}`,onClick:()=>x(fe.key),disabled:G(fe.key)==="exporting",title:Ix(G(fe.key)),"aria-label":w("sidebar.project.export"),children:o.jsx(Ox,{done:G(fe.key)==="done"})}),o.jsx("button",{className:`icon-button project-action${Oe===fe.key?" project-action-busy":""}`,onClick:()=>Ue(de=>de===fe.key?null:fe.key),title:w("sidebar.project.archiveTitle"),"aria-label":w("sidebar.project.archive"),"aria-expanded":Oe===fe.key,children:o.jsx(em,{out:!1})})]}),o.jsx(bh,{className:"icon-button",text:"+",title:lt?Sg():fe.cwdExists?w("sidebar.project.newSession"):w("sidebar.project.folderGone"),disabled:!Xe||lt,offerAgentChoice:i,agents:y,agent:i?c(fe):null,onOpen:de=>k(fe.cwd,de)})]}),!fe.cwdExists&&o.jsx("div",{className:"project-missing",title:fe.cwd,children:w("sidebar.project.missing")}),Oe===fe.key&&o.jsx(Dx,{project:fe,openSessionIds:a,onConfirm:()=>qe(fe),onCancel:()=>Ue(null)}),et&&o.jsx("ul",{className:"session-list",children:fe.sessions.map(de=>{var at;const Ke=K.has(de.sessionId),tt=!ht(de),ye=nk(de.agent,y,i),ct=Ax(de),xt=el(de)&&v(de.agent),mt=de.worktree!==null&&!de.worktree.exists,De=ct.copy?f!==null:Xe&&xt&&!mt;return o.jsxs("li",{className:`session-row${de.archived?" session-archived":""}${Ke?" session-selected":""}`,children:[o.jsxs(fx,{className:"session-item",onLongPress:()=>Pt(de.sessionId),onClick:bt=>{if(bt.ctrlKey||bt.metaKey){Pt(de.sessionId);return}if(ct.copy){f==null||f(de);return}el(de)&&(de.archived&&E([de.sessionId],!1),g(lg(de.cwd,fe.cwd,h),de))},disabled:!De,title:ct.copy?`${hr(de.title,de.titleSource)}
|
|
139
|
-
${f===null?w("remote.onlyOnHost"):Jp()}`:ye.unavailableTitle??hr(de.title,de.titleSource),children:[o.jsxs("span",{className:"session-title",children:[ye.badge&&o.jsx(Qu,{agent:de.agent,agents:y}),ct.copy&&o.jsx("span",{className:"session-vault-mark",title:Jp(),children:yx()}),ct.partial&&o.jsx("span",{className:"session-partial-mark",title:kx(),children:bx()}),de.worktree!==null&&o.jsxs("span",{className:`session-branch${mt?" session-branch-gone":""}`,title:mt?w("worktree.sidebar.removedTitle"):w("worktree.sidebar.branchTitle",{branch:de.worktree.branch}),children:[de.worktree.branch,mt&&o.jsx("span",{className:"session-branch-note",children:w("worktree.sidebar.removed")})]}),hr(de.title,de.titleSource)]}),o.jsx("span",{className:"session-meta",children:$n(de.updatedAt)})]}),o.jsx(Zg,{targets:bg(y,de.agent,de.partial,mt),className:"icon-button session-continue",text:"↪",title:vh(mt),onPick:bt=>R(de,bt)}),mt&&((at=de.worktree)==null?void 0:at.reopenable)===!0&&Xe&&el(de)&&v(de.agent)&&o.jsx("button",{className:"icon-button session-action session-reopen",onClick:()=>B(de,fe),title:w("worktree.sidebar.reopenTitle"),"aria-label":w("worktree.sidebar.reopen"),children:o.jsx(Ju,{})}),o.jsx("button",{className:"icon-button session-action",onClick:()=>E([de.sessionId],!de.archived),disabled:tt,title:de.archived?w("sidebar.session.restore"):w(tt?"sidebar.session.blocked":"sidebar.session.archive"),children:o.jsx(em,{out:de.archived})})]},`${de.agent}:${de.sessionId}`)})})]},fe.key)})]}),$t.length>0&&o.jsxs("div",{className:"sidebar-selection",children:[o.jsx("span",{children:w("sidebar.selection.count",{count:$t.length})}),$t.some(fe=>!fe.archived)&&o.jsx("button",{className:"link-button",onClick:()=>dt(!0),children:w("sidebar.action.archive")}),$t.some(fe=>fe.archived)&&o.jsx("button",{className:"link-button",onClick:()=>dt(!1),children:w("sidebar.action.restore")}),o.jsx("button",{className:"link-button",onClick:()=>te(new Set),children:w("common.cancel")})]})]})}function Zu({x:t,y:e,items:s,onClose:a,anchor:d=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:g,height:v}=c.getBoundingClientRect();i({left:Math.max(4,Math.min(t,window.innerWidth-g-4)),top:Math.max(4,Math.min(e,window.innerHeight-v-4))})},[t,e]),M.useEffect(()=>{const c=v=>{v.key==="Escape"&&(v.stopPropagation(),a())},g=v=>{var b;const h=v.target;h instanceof Node&&((b=k.current)!=null&&b.contains(h)||d!=null&&d.contains(h))||a()};return window.addEventListener("keydown",c,!0),window.addEventListener("pointerdown",g,!0),window.addEventListener("scroll",a,!0),window.addEventListener("resize",a),()=>{window.removeEventListener("keydown",c,!0),window.removeEventListener("pointerdown",g,!0),window.removeEventListener("scroll",a,!0),window.removeEventListener("resize",a)}},[d,a]),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(),a()},children:[c.checked!==void 0&&o.jsx("span",{className:"context-menu-check","aria-hidden":"true",children:c.checked?"✓":""}),c.label]},c.label))})}function yv({listLabel:t,docs:e,active:s,tooltipOf:a,labelOf:d=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:w("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:a(c),children:d(c)}),o.jsx("button",{className:"strip-tab-close",onClick:()=>i(c.key),title:w("docs.tab.close"),children:"×"})]},c.key))})]})}const Hx={added:"+",removed:"-",context:" ",hunk:"",meta:""};function bv({diff:t}){return t.binary?o.jsx("p",{className:"panel-note",children:w("diff.binary")}):t.lines.length===0?o.jsx("p",{className:"panel-note",children:t.message===null?w("diff.noChanges"):At(t.message)}):o.jsxs("div",{className:"panel-scroll",children:[o.jsx(kv,{lines:t.lines}),t.truncated&&o.jsx("p",{className:"panel-note",children:w("diff.truncated")})]})}function kv({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:Hx[e.kind]}),o.jsx("span",{className:"diff-text",children:e.text})]},s))})}function tm(t){let e="";for(let s=0;s<t.length;s++){const a=t[s]??"",d=a.toLowerCase();e+=d.length===a.length?d:a}return e}function Ux(t,e){if(e.length===0)return[];const s=tm(t),a=tm(e),d=[];let k=s.indexOf(a);for(;k!==-1;)d.push(k),k=s.indexOf(a,k+a.length);return d}function nm(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 a=Math.max(0,t.length-1),d=a===0?0:t[a-1]??0;return{node:a,offset:(t[a]??0)-d}}function $x(t,e,s){return e===0?0:(t+s+e)%e}function Wx(t){return/\.(md|markdown)$/i.test(t)}function zx(t,e){var k;const s=((k=e.split("#")[0])==null?void 0:k.split("?")[0])??"";if(s.length===0)return null;let a;try{a=decodeURIComponent(s)}catch{return null}if(/^[a-z][a-z0-9+.-]*:/i.test(a)||a.startsWith("/")||a.startsWith("\\"))return null;const d=t.split("/").slice(0,-1);for(const y of a.replace(/\\/g,"/").split("/")){if(y.includes(":"))return null;if(!(y===""||y===".")){if(y===".."){if(d.length===0)return null;d.pop();continue}d.push(y)}}return d.length===0?null:d.join("/")}function qx({text:t,language:e}){const[s,a]=M.useState(null);M.useEffect(()=>{if(e===null){a(null);return}let k=!1;return ur(async()=>{const{highlightCode:y}=await import("./highlight-BVnJ3VdZ.js");return{highlightCode:y}},[]).then(({highlightCode:y})=>{k||a(y(t,e))}).catch(()=>{k||a(null)}),()=>{k=!0,a(null)}},[t,e]);const d=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:d},(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 rm({onInsert:t,onOpenWithSystem:e}){const[s,a]=M.useState(!1),d=M.useRef(null);M.useEffect(()=>()=>{d.current!==null&&window.clearTimeout(d.current)},[]);const k=()=>{t==null||t(),a(!0),d.current!==null&&window.clearTimeout(d.current),d.current=window.setTimeout(()=>a(!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:w(s?"files.pathInserted":"files.preview.insertPath")}),e!==null&&o.jsx("button",{className:"primary-button primary-button-small preview-open",onClick:e,children:w("files.menu.openWithSystem")})]})}const eh="doc-search",th="doc-search-current";function nh(){const t=CSS.highlights,e=window.Highlight;return t===void 0||typeof e!="function"?null:t}function sm(t){const e=window.Highlight;return new e(...t)}function im(){const t=nh();t==null||t.delete(eh),t==null||t.delete(th)}function Vx(t,e){if(e===null)return;const s=t.getBoundingClientRect(),a=e.getBoundingClientRect();(s.top<a.top+16||s.bottom>a.bottom-16)&&(e.scrollTop+=s.top-a.top-a.height/3),(s.left<a.left||s.right>a.right)&&(e.scrollLeft+=s.left-a.left-48)}function Kx(t,e,s,a){const[d,k]=M.useState(0),[y,i]=M.useState(0),[c,g]=M.useState(0),v=M.useRef([]);M.useEffect(()=>{const b=t.current;if(b===null||s.length===0)return;let E=0;const N=new MutationObserver(()=>{E===0&&(E=window.requestAnimationFrame(()=>{E=0,g(_=>_+1)}))});return N.observe(b,{childList:!0,subtree:!0,characterData:!0}),()=>{N.disconnect(),E!==0&&window.cancelAnimationFrame(E)}},[t,s,a]),M.useEffect(()=>{const b=t.current;if(v.current=[],b===null||s.length===0){im(),k(0),i(0);return}const E=[],N=[];let _="";const u=document.createTreeWalker(b,NodeFilter.SHOW_TEXT,{acceptNode:m=>{var f;return(f=m.parentElement)!=null&&f.closest("[data-search-skip]")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}});for(let m=u.nextNode();m!==null;m=u.nextNode()){const f=m;E.push(f),_+=f.data,N.push(_.length)}v.current=Ux(_,s).map(m=>{const f=nm(N,m,"start"),x=nm(N,m+s.length,"end"),j=document.createRange();return j.setStart(E[f.node],f.offset),j.setEnd(E[x.node],x.offset),j}),k(v.current.length),i(m=>m<v.current.length?m:0);const p=nh();return p!==null&&v.current.length>0?p.set(eh,sm(v.current)):p==null||p.delete(eh),im},[t,s,c,a]),M.useEffect(()=>{i(0)},[s]),M.useEffect(()=>{const b=v.current[y],E=nh();if(b===void 0){E==null||E.delete(th);return}E==null||E.set(th,sm([b])),Vx(b,e.current)},[y,d,c,a,s,e]);const h=M.useCallback(b=>i(E=>$x(E,d,b)),[d]);return{count:d,index:y,step:h}}function Cv({doc:t,content:e,readingText:s,truncatedText:a,onReload:d,onModeChange:k,onOpenWithSystem:y,onInsert:i,onOpenLink:c,initialScroll:g,onScrollChange:v,editor:h=null,insertButton:b}){const[E,N]=M.useState(""),_=M.useRef(null),u=M.useRef(null),p=(e==null?void 0:e.loaded)??null,m=p===null?"":p.kind==="file"?p.preview.text:p.plan.text,f=p!==null&&p.kind==="file"&&p.preview.binary,x=p!==null&&(p.kind==="file"?p.preview.truncated:p.plan.truncated),j=p!==null&&(p.kind==="plan"||p.preview.language==="markdown"||Wx(p.preview.path)),T=j&&(t.mode??"formatted")==="formatted",R=p!==null&&p.kind==="file"?p.preview.language:"markdown",S=E.trim(),L=Kx(u,_,S,`${T?"f":"s"}:${m.length}:${m.slice(0,64)}`),I=M.useRef(!1);M.useLayoutEffect(()=>{I.current||p===null||(I.current=!0,g!==void 0&&_.current!==null&&(_.current.scrollTop=g))},[p,g]);const B=c===void 0||p===null||p.kind!=="file"?void 0:G=>{const Y=zx(t.key,G);return Y===null?null:()=>c(Y)},F=p!==null&&!f,D=(h==null?void 0:h.edit)??null;if(h!==null&&D!==null)return o.jsx(Gx,{title:t.title,editor:h,insertButton:b});const H=p!==null&&p.kind==="file"&&p.preview.editable===!0,W=w(H?"docs.edit.title":x?"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:w("docs.search.placeholder"),value:E,disabled:!F,onChange:G=>N(G.target.value),onKeyDown:G=>{G.key==="Enter"&&L.step(G.shiftKey?-1:1),G.key==="Escape"&&N(""),G.stopPropagation()},spellCheck:!1}),S.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"conversation-matches",children:L.count===0?w("thread.search.none"):`${L.index+1}/${L.count}`}),o.jsx("button",{className:"icon-button",onClick:()=>L.step(-1),disabled:L.count===0,title:w("thread.search.previous"),children:"↑"}),o.jsx("button",{className:"icon-button",onClick:()=>L.step(1),disabled:L.count===0,title:w("thread.search.next"),children:"↓"})]}),j&&o.jsxs("div",{className:"doc-mode",role:"group","aria-label":w("docs.mode.label"),children:[o.jsx("button",{className:T?"is-active":"","aria-pressed":T,onClick:()=>k("formatted"),children:w("docs.mode.formatted")}),o.jsx("button",{className:T?"":"is-active","aria-pressed":!T,onClick:()=>k("source"),children:w("docs.mode.source")})]}),h!==null&&p!==null&&p.kind==="file"&&!f&&o.jsx("button",{className:"primary-button primary-button-small doc-edit-button",onClick:h.begin,disabled:!H,title:W,children:h.justSaved?w("docs.edit.saved"):w("docs.edit.button")}),b,o.jsx("button",{className:"icon-button",onClick:d,disabled:(e==null?void 0:e.loading)===!0,title:w("docs.reload"),children:"⟳"})]}),(e==null?void 0:e.failed)===!0&&p!==null&&o.jsx("p",{className:"panel-note doc-note",children:w("docs.reloadFailed")}),p===null?o.jsx("p",{className:"panel-note",children:(e==null?void 0:e.failed)===!0?w("docs.failed"):s}):f?o.jsxs("div",{className:"preview-fallback",children:[o.jsx("p",{className:"panel-note",children:w("files.preview.binary")}),o.jsx(rm,{onInsert:i,onOpenWithSystem:y})]}):o.jsxs("div",{className:"panel-scroll",ref:_,onScroll:G=>v(G.currentTarget.scrollTop),children:[o.jsx("div",{ref:u,className:T?"plan-body":"doc-source",children:T?o.jsx(yh,{text:m,localLink:B}):o.jsx(qx,{text:m,language:R})}),x&&o.jsxs("div",{className:"preview-fallback",children:[o.jsx("p",{className:"panel-note",children:a}),p.kind==="file"&&o.jsx(rm,{onInsert:i,onOpenWithSystem:y})]})]})]})}function Gx({title:t,editor:e,insertButton:s}){const[a,d]=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,g=k.saving?w("docs.edit.saving"):w(y?"docs.edit.unsaved":"docs.edit.noChanges"),v=()=>{e.unsaved?d(!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:[w("docs.edit.editing",{name:t}),o.jsxs("span",{className:"doc-edit-state",children:[" · ",g]})]}),o.jsx("button",{className:"link-button",onClick:v,disabled:k.saving,children:w("docs.edit.cancel")}),o.jsx("button",{className:"primary-button primary-button-small",onClick:e.save,disabled:!c,title:w("docs.edit.saveTitle"),children:w("docs.edit.save")}),s,o.jsx("button",{className:"icon-button",disabled:!0,title:w("docs.reload"),children:"⟳"})]}),k.closing&&o.jsxs("div",{className:"note-closing doc-edit-bar",children:[o.jsx("span",{children:w("docs.edit.closeConfirm")}),o.jsx("button",{className:"link-button link-danger",onClick:e.confirmClose,children:w("docs.edit.discardAndClose")}),o.jsx("button",{className:"link-button",onClick:e.keepEditing,children:w("docs.edit.keepEditing")})]}),a&&!k.closing&&o.jsxs("div",{className:"note-closing doc-edit-bar",children:[o.jsx("span",{children:w("docs.edit.discardConfirm")}),o.jsx("button",{className:"link-button link-danger",onClick:e.discard,children:w("docs.edit.discard")}),o.jsx("button",{className:"link-button",onClick:()=>d(!1),children:w("docs.edit.keepEditing")})]}),i!==null&&o.jsxs("div",{className:"note-closing doc-edit-bar",children:[o.jsx("span",{children:i.next===null?w("docs.edit.gone"):w("docs.edit.conflict")}),i.next!==null&&o.jsx("button",{className:"primary-button primary-button-small",onClick:e.adopt,children:w("docs.edit.adopt")}),o.jsx("button",{className:"link-button link-danger",onClick:e.discard,children:w("docs.edit.discardMine")})]}),k.failure!==null&&o.jsx("div",{className:"composer-problem doc-edit-bar",children:o.jsx("span",{children:k.failure.kind==="lost"?w("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:w("docs.edit.pending")}),o.jsx("button",{className:"link-button",onClick:e.dismissPending,children:w("docs.edit.pendingDone")})]}),o.jsx("div",{className:"doc-changes-body",children:o.jsx(kv,{lines:k.pending})})]}),o.jsx("textarea",{className:"doc-editor",value:k.text,readOnly:i!==null||k.saving,spellCheck:!1,autoFocus:!0,"aria-label":w("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 Ch(){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 Yx(){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 Xx({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 Qx(){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 Jx(){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 Sv({className:t,title:e,doneTitle:s,icon:a,onAction:d}){const[k,y]=M.useState(!1),i=M.useRef(null);M.useEffect(()=>()=>{i.current!==null&&window.clearTimeout(i.current)},[]);const c=g=>{g.stopPropagation(),d(),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(Jx,{}):a})}function Zx({className:t,title:e,onCopy:s}){return o.jsx(Sv,{className:t,title:e,doneTitle:w("common.copied"),icon:o.jsx(Yx,{}),onAction:s})}function Eo({className:t,title:e,onInsert:s}){return o.jsx(Sv,{className:t,title:e,doneTitle:w("files.pathInserted"),icon:o.jsx(Qx,{}),onAction:s})}function eE({view:t,cwd:e,platform:s,onInsert:a,onInsertPath:d,onReveal:k,docs:y}){const{listings:i,loading:c,refresh:g,query:v,setQuery:h,showHidden:b,toggleHidden:E}=t,N=Mo(),[_,u]=M.useState(null),p=s==="win32"?"\\":"/",m=M.useCallback(W=>{const G=W.split("/").join(p);return e.length===0?G:e.endsWith(p)?`${e}${G}`:`${e}${p}${G}`},[e,p]),f=M.useCallback(W=>{navigator.clipboard.writeText(W).catch(()=>{})},[]),x=M.useCallback(W=>d(`"${m(W)}"`),[m,d]),j=M.useCallback((W,G)=>{W.preventDefault(),W.stopPropagation(),u({x:W.clientX,y:W.clientY,items:[{label:w("files.menu.copyAbsolute"),onSelect:()=>f(m(G))},{label:w("files.menu.copyRelative"),onSelect:()=>f(G)},...a===void 0?[]:[{label:w("files.menu.insertMention"),onSelect:()=>a(`@${G}`)}],...k===null?[]:[{label:w("files.menu.openWithSystem"),onSelect:()=>k(G)}]]})},[m,f,a,k,N]),T=y.active===null?null:y.docs.find(W=>W.key===y.active)??null,R=T===null?void 0:y.content(T.key),S=T!==null&&R===void 0;M.useEffect(()=>{S&&T!==null&&y.reload(T.key)},[S,T==null?void 0:T.key]);const L=M.useCallback(W=>y.open({key:W,title:W.split("/").pop()??W}),[y]),I=M.useMemo(()=>({...t,openFile:L}),[t,L]),B=W=>{var Y;const G=(Y=y.content(W.key))==null?void 0:Y.loaded;return(G==null?void 0:G.kind)==="file"?`${W.key} · ${_n(G.preview.sizeBytes)}`:W.key},F=y.docs.length>0?o.jsx(yv,{listLabel:w("panel.tab.files"),docs:y.docs,active:y.active,tooltipOf:B,labelOf:W=>y.unsaved(W.key)?`${W.title} •`:W.title,onShowList:y.showList,onSelect:y.select,onClose:y.requestClose}):null;if(T!==null)return o.jsxs("div",{className:"panel-body",children:[F,o.jsx(Cv,{doc:T,content:R,readingText:w("files.readingFile"),truncatedText:w("files.preview.truncated"),onReload:()=>y.reload(T.key),onModeChange:W=>y.setMode(T.key,W),onOpenWithSystem:k===null?null:()=>k(T.key),onInsert:()=>x(T.key),onOpenLink:L,initialScroll:y.scrollOf(T.key),onScrollChange:W=>y.rememberScroll(T.key,W),editor:y.editorFor(T.key),insertButton:o.jsx(Eo,{className:"icon-button",title:w("files.insertPath",{name:T.title}),onInsert:()=>x(T.key)})},T.key),_!==null&&o.jsx(Zu,{x:_.x,y:_.y,items:_.items,onClose:()=>u(null)})]});const D=i.get(""),H=v.trim();return o.jsxs("div",{className:"panel-body",children:[F,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(Eo,{className:"icon-button",title:w("files.insertFolderPath"),onInsert:()=>x("")}),o.jsx("button",{className:b?"icon-button icon-button-on":"icon-button",onClick:E,title:w(b?"files.hidden.hide":"files.hidden.show"),children:o.jsx(Xx,{open:b})}),k!==null&&o.jsx("button",{className:"icon-button",onClick:()=>k(""),title:w("files.revealFolder"),children:o.jsx(Ch,{})}),o.jsx("button",{className:"icon-button",onClick:g,title:w("files.refresh"),children:"⟳"})]}),o.jsxs("div",{className:"tree-search",children:[o.jsx("input",{className:"tree-search-input",value:v,placeholder:w("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:w("files.search.clear"),children:"×"})]}),o.jsx("div",{className:"panel-scroll",children:H.length>0?o.jsx(tE,{view:I,onContextMenu:j,onReveal:k,onInsertPath:x}):D===void 0?o.jsx("p",{className:"panel-note",children:c.has("")?w("files.readingDir"):w("files.readDirFailed")}):o.jsx(xv,{path:"",depth:0,view:I,onContextMenu:j,onReveal:k,onInsertPath:x})}),_!==null&&o.jsx(Zu,{x:_.x,y:_.y,items:_.items,onClose:()=>u(null)})]})}function tE({view:t,onContextMenu:e,onReveal:s,onInsertPath:a}){const{results:d,searching:k,openFile:y,toggleDirectory:i}=t;return d===null?o.jsx("p",{className:"panel-note",children:w(k?"files.search.searching":"files.search.prompt")}):d.entries.length===0?o.jsx("p",{className:"panel-note",children:w("files.search.none")}):o.jsxs("ul",{className:"tree tree-results",children:[d.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:g=>e(g,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:_n(c.sizeBytes)})]}),o.jsx(Eo,{className:"tree-action",title:w("files.insertPath",{name:c.name}),onInsert:()=>a(c.path)}),c.kind==="dir"&&s!==null&&o.jsx("button",{className:"tree-action",onClick:()=>s(c.path),title:w("files.reveal",{name:c.name}),children:o.jsx(Ch,{})})]})},c.path)),d.truncated&&o.jsx("li",{className:"tree-hidden",title:w("files.search.moreTitle"),children:w("files.search.more")})]})}function xv({path:t,depth:e,view:s,onContextMenu:a,onReveal:d,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:w("files.loading")}):null:o.jsxs("ul",{className:"tree",children:[c.entries.map(g=>o.jsx(nE,{entry:g,depth:e,view:s,onContextMenu:a,onReveal:d,onInsertPath:k},g.path)),c.entries.length===0&&o.jsx("li",{className:"tree-empty",style:{paddingLeft:`${e*12+8}px`},children:c.hiddenCount>0?w("files.allHidden"):w("files.empty")}),(c.truncated||c.hiddenCount>0)&&c.entries.length>0&&o.jsx("li",{className:"tree-hidden",style:{paddingLeft:`${e*12+8}px`},title:w("files.hiddenTitle"),children:c.truncated?w("files.moreEntries"):w("files.hiddenCount",{count:c.hiddenCount})})]})}function nE({entry:t,depth:e,view:s,onContextMenu:a,onReveal:d,onInsertPath:k}){const{expanded:y,toggleDirectory:i,openFile:c}=s,g=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=>a(v,t.path,t.kind),title:t.hidden===void 0?t.path:`${t.path}
|
|
141
|
-
${t.hidden==="ignored"?w("files.row.ignored"):w("files.row.alwaysHidden")}`,children:[o.jsx("span",{className:`tree-chevron${g?" 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:_n(t.sizeBytes)})]}),o.jsx(Eo,{className:"tree-action",title:w("files.insertPath",{name:t.name}),onInsert:()=>k(t.path)}),t.kind==="dir"&&d!==null&&o.jsx("button",{className:"tree-action",onClick:()=>d(t.path),title:w("files.reveal",{name:t.name}),children:o.jsx(Ch,{})})]}),g&&o.jsx(xv,{path:t.path,depth:e+1,view:s,onContextMenu:a,onReveal:d,onInsertPath:k})]})}const Ev={added:"A",modified:"M",deleted:"D",renamed:"R",copied:"C","type-changed":"T",untracked:"?",conflict:"!"},Tv={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 ul(t){const e=t.endsWith("/"),s=e?t.slice(0,-1):t,a=s.lastIndexOf("/"),d=a===-1?s:s.slice(a+1);return{dir:a===-1?"":s.slice(0,a+1),name:e?`${d}/`:d,isDirectory:e}}function rE({view:t,onBack:e,onOpenDiff:s,onCloseDiff:a,onRequestReview:d}){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:a,children:["← ",t.branch]}),o.jsx("span",{className:"panel-subhead-title",title:i.path,children:ul(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:w("git.readingDiff")}):o.jsx(bv,{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:["← ",w("git.backToChanges")]}),o.jsx("span",{className:"panel-subhead-title",title:y===null?t.branch:w("worktree.changes.title",{branch:y.branch,base:y.base}),children:y===null?t.branch:w("worktree.changes.title",{branch:y.branch,base:y.base})}),d!==null&&y!==null&&y.commitCount>0&&o.jsx("button",{className:"link-button",onClick:d,title:w("worktree.actions.reviewTitle"),children:w("worktree.actions.review")})]}),o.jsxs("div",{className:"panel-scroll",children:[k.phase==="loading"&&o.jsx("p",{className:"panel-note",children:w("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:w("worktree.changes.uncommitted",{count:y.uncommitted})}),y.commitCount===0&&y.files.length===0&&o.jsx("p",{className:"panel-note",children:w("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:[w("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:`${_h(i.at)} ${Ni(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:$n(i.at)})]},i.sha))}),y.commitCount>y.commits.length&&o.jsx("p",{className:"panel-note",children:w("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:[w("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:g}=ul(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:w(Tv[i.kind]),children:Ev[i.kind]}),o.jsxs("span",{className:"git-path",children:[o.jsx("span",{className:"git-path-name",children:g}),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:w("worktree.changes.more",{count:y.fileCount-y.files.length})})]})]})]})]})}function Lv(t,e,s){const a=t.worktree;if(a===null||a.branch===null)return null;if(a.linked)return a.branch;const d=dr(a.mainCwd,s);return e.some(y=>{var i;return y.terminalId!==t.terminalId&&((i=y.worktree)==null?void 0:i.linked)===!0&&dr(y.worktree.mainCwd,s)===d})?a.branch:null}function sE(t,e){const s=t.worktree;return s===null||e===null?null:s.linked?w("worktree.tab.linkedTitle",{branch:e,main:s.mainCwd}):w("worktree.tab.mainTitle",{branch:e})}function Bs(t){return Fu(t)}const iE={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 oE(t){return w(iE[t])}function aE(t,e,s,a){if(e.length===0)return null;const d=Ow(e);if(d!==null)return oE(d);const k=t.branches.find(y=>y.name===e);return s==="new"&&k!==void 0?w("worktree.create.branchExists"):s==="existing"&&(k==null?void 0:k.checkedOut)===!0?w("worktree.create.branchInUse"):t.branches.some(y=>y.name===a)?null:w("worktree.create.baseMissing")}function Nv(t,e){return`${t.parentDir}${t.separator}${Vm(e)}`}const lE=t=>/[\s"]/.test(t)?`"${t}"`:t;function cE(t,e,s,a){const d=lE(Nv(t,e));return a==="new"?`git worktree add -b ${e} ${d} ${s}`:`git worktree add ${d} ${e}`}function Qa(t){return w("worktree.copy.summary",{count:t.files,size:_n(t.bytes)})}function uE(t){const e=[];return t.changes!==null&&t.changes>0&&e.push(w("worktree.rows.changes",{count:t.changes})),t.ahead!==null&&t.ahead>0&&e.push(w("worktree.rows.ahead",{count:t.ahead})),t.integrated===!0&&e.push(w("worktree.rows.integrated")),e.length===0&&t.changes===0&&e.push(w("worktree.rows.clean")),e}function hE(t){return[...t].sort((e,s)=>e.isMain!==s.isMain?e.isMain?-1:1:(e.branch??e.path).localeCompare(s.branch??s.path))}function om(t,e){const s=Tn(t.map(a=>a.split("/").pop()??a));return e>t.length?`${s}…`:s}function dE(t){var s,a;const e=[];if(t.behind!==null&&t.behind>0&&t.base!==null){const d=[w("worktree.rows.behind",{base:t.base,count:t.behind})];((s=t.merge)==null?void 0:s.state)==="clean"&&d.push(w("worktree.rows.mergeClean")),((a=t.merge)==null?void 0:a.state)==="conflicts"&&d.push(w("worktree.rows.mergeConflicts",{count:t.merge.fileCount,list:om(t.merge.files,t.merge.fileCount)})),e.push(d.join(" · "))}for(const d of t.overlaps)e.push(w("worktree.rows.overlap",{branch:d.branch,list:om(d.files,d.fileCount)}));return e}const am={working:"worktree.review.stateWorking",pending:"worktree.review.statePending",ready:"worktree.review.stateReady",changes:"worktree.review.stateChanges",none:"worktree.review.stateNone"};function Rv(t,e){const s=t.state==="done"?am[t.verdict??"none"]:am[t.state],a=w(s,{agent:e});return t.stale?w("worktree.review.stale",{text:a}):a}function fE(t){return t!==null&&t.state==="done"}function pE(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&&fE(t.review),catchUp:e&&t.base!==null&&(t.behind??0)>0,integrate:e&&t.base!==null&&s}}function mE(t){return t.base===null?null:t.ahead===0?w("worktree.integrate.blockerNothing",{base:t.base}):t.behind!==null&&t.behind>0?w("worktree.integrate.blockerBehind",{base:t.base}):null}function gE(t){switch(t.blocker){case"nothing":return w("worktree.integrate.blockerNothing",{base:t.base});case"behind":return w("worktree.integrate.blockerBehind",{base:t.base});case"no-base-folder":return w("worktree.integrate.blockerNoBase",{base:t.base});case"local-changes":return w("worktree.integrate.blockerLocal",{base:t.base,count:t.localConflicts.length,list:Tn(t.localConflicts)});case null:return null}}function vE(t,e){var a;const s=((a=t.readOnlyLaunch)==null?void 0:a.guard)??null;return s==="cli"?w("worktree.review.guardCli",{agent:e}):s==="tools"?w("worktree.review.guardTools",{agent:e}):w("worktree.review.guardNone",{agent:e})}function _E(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 wE(t){return t.ahead===null?null:t.ahead===0?w("worktree.rows.integrated"):w("worktree.rows.notIntegrated",{count:t.ahead})}function yE(t){switch(t.blocker){case"checked-out":return w("worktree.deleteBranch.checkedOut",{branch:t.branch});case"not-integrated":return t.ahead===null?w("worktree.deleteBranch.noBase",{base:t.base}):w("worktree.deleteBranch.notIntegrated",{count:t.ahead,base:t.base});case null:return null}}function bE(t){return t.uncommittedCount>0?"uncommitted":t.inUse===!0?"in-use":t.conflicts.length>0?"conflicts":null}function kE(t){switch(bE(t)){case"uncommitted":return"ask-commit";case"in-use":return"retry";case"conflicts":return"ask-notes";case null:return"remove"}}function CE(t){const{branch:e}=t;return t.deletesBranch?t.branchUnused?w("worktree.remove.deletesUnusedBranch",{branch:e}):w("worktree.remove.deletesBranch",{branch:e}):t.createdBranch?w("worktree.remove.keepsBranch",{branch:e}):w("worktree.remove.keepsExistingBranch",{branch:e})}const SE=[{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 xE({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?w("git.detachedAt",{head:t.head}):w("git.detached"))}),t.upstream!==null&&o.jsx("span",{className:"git-upstream",title:w("git.upstreamTitle",{upstream:t.upstream}),children:t.upstream}),(t.ahead>0||t.behind>0)&&o.jsxs("span",{className:"git-ab",title:w("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 EE(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 TE({row:t,worktrees:e}){const s=uE(t),a=dE(t),d=t.id,k=d!==null&&!t.isMain?{...t,id:d}:null,y=pE(t),i=mE(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??w("git.worktrees.detached"),t.isMain&&o.jsx("span",{className:"git-worktree-main",children:w("worktree.rows.main")}),t.isCurrent&&o.jsx("span",{className:"git-worktree-main",children:w("worktree.rows.current")})]}),s.length>0&&o.jsx("span",{className:"git-worktree-state",children:s.join(" · ")}),a.map(g=>o.jsx("span",{className:"git-worktree-team",children:g},g)),c!==null&&o.jsxs("span",{className:`git-worktree-review${EE(t)}`,children:[Rv(c,e.agentLabel(c.agent)),c.terminalId!==null&&o.jsx("button",{className:"link-button",onClick:()=>{c.terminalId!==null&&e.onShowReviewer(c.terminalId)},title:w("worktree.actions.showReviewerTitle"),children:w("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:w("worktree.rows.openTitle"),children:w("worktree.rows.open")}),k!==null&&y.viewChanges&&o.jsx("button",{className:"link-button",onClick:()=>e.onViewChanges(k),title:w("worktree.actions.viewChangesTitle"),children:w("worktree.actions.viewChanges")}),k!==null&&y.review&&o.jsx("button",{className:"link-button",onClick:()=>e.onRequestReview(k),title:w("worktree.actions.reviewTitle"),children:w("worktree.actions.review")}),k!==null&&y.sendReview&&o.jsx("button",{className:"link-button",onClick:()=>e.onSendReview(k),title:w("worktree.actions.sendReviewTitle"),children:w("worktree.actions.sendReview")}),k!==null&&y.catchUp&&t.base!==null&&o.jsx("button",{className:"link-button",onClick:()=>e.onCatchUp(k),title:w("worktree.actions.catchUpTitle",{base:t.base}),children:w("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??w("worktree.actions.integrateTitle",{base:t.base}),children:w("worktree.actions.integrate",{base:t.base})}),k!==null&&o.jsx("button",{className:"link-button",onClick:()=>e.onRemove(k),title:w("worktree.rows.removeTitle"),children:w("worktree.rows.remove")})]})]})})}function LE({kept:t,worktrees:e}){const s=wE(t);return o.jsx("li",{children:o.jsxs("div",{className:"git-worktree",title:w("worktree.rows.keptTitle"),children:[o.jsxs("span",{className:"git-worktree-branch",children:[t.branch,o.jsx("span",{className:"git-worktree-main",children:w("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:w("worktree.rows.deleteBranchTitle"),children:w("worktree.rows.deleteBranch")})})]})})}function NE({view:t,worktrees:e}){const{status:s,diff:a,loadingDiff:d,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(rE,{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(a!==null||d)return o.jsxs("div",{className:"panel-body",children:[o.jsxs("div",{className:"panel-subhead",children:[o.jsxs("button",{className:"link-button",onClick:y,children:["← ",w("git.backToChanges")]}),a!==null&&o.jsxs("span",{className:"panel-subhead-title",title:a.path,children:[ul(a.path).name,a.staged&&o.jsxs("span",{className:"panel-tagline",children:[" ",w("git.stagedTag")]})]})]}),d?o.jsx("p",{className:"panel-note",children:w("git.readingDiff")}):a!==null&&o.jsx(bv,{diff:a})]});if(s.state!=="ready")return o.jsx("div",{className:"panel-body",children:o.jsx("p",{className:"panel-note",children:s.message===null?w("git.unknownState"):At(s.message)})});const c=hE(e.rows).filter(v=>!(v.isCurrent&&v.isMain)),g=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(xE,{status:s}),o.jsx("button",{className:"icon-button",onClick:e.onNew,title:w("worktree.new"),"aria-label":w("worktree.new"),children:o.jsx(Ju,{})}),o.jsx("button",{className:"icon-button",onClick:i,title:w("git.refresh"),children:"⟳"})]}),o.jsxs("div",{className:"panel-scroll",children:[s.changes.length===0&&o.jsx("p",{className:"panel-note",children:w("git.clean")}),SE.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:w(v.hint),children:[w(v.title),o.jsx("span",{className:"git-group-count",children:h.length})]}),o.jsx("ul",{className:"git-list",children:h.map(b=>{const{dir:E,name:N,isDirectory:_}=ul(b.path),u=b.oldPath!==null?`${b.oldPath} → ${b.path}`:_?w("git.newFolderTitle",{path:b.path}):b.path,p=o.jsxs(o.Fragment,{children:[o.jsx("span",{className:`git-badge git-badge-${b.kind}`,title:w(Tv[b.kind]),children:Ev[b.kind]}),o.jsxs("span",{className:"git-path",children:[o.jsx("span",{className:"git-path-name",children:N}),E.length>0&&o.jsx("span",{className:"git-path-dir",children:E})]})]});return o.jsx("li",{children:_?o.jsx("div",{className:"git-item git-item-static",title:u,children:p}):o.jsx("button",{className:"git-item",onClick:()=>k(b.path,b.stage==="staged"),title:u,children:p})},`${v.stage}:${b.path}`)})})]},v.stage)}),s.truncated&&o.jsx("p",{className:"panel-note",children:on("git.truncated")}),g&&o.jsxs("section",{className:"git-group",children:[o.jsxs("h3",{className:"git-group-title",title:w("worktree.rows.headingTitle"),children:[w("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(TE,{row:v,worktrees:e},v.path)),e.kept.map(v=>o.jsx(LE,{kept:v,worktrees:e},v.id))]})]})]})]})}const RE={create:"memory.action.create","append-block":"memory.action.appendBlock","replace-block":"memory.action.replaceBlock","append-lines":"memory.action.appendLines",copy:"memory.action.copy"},ME={"AGENTS.md":["Codex","Antigravity","OpenCode","Pi"],"CLAUDE.md":["Claude Code"]};function ml(t){return t.brokenBlock||t.problem!==null}function AE(t){return t.problem==="outside"?w("memory.problem.outside"):t.problem==="encoding"?w("memory.problem.encoding"):t.brokenBlock?w("memory.problem.brokenBlock"):null}function IE(t){const e=t.files.filter(s=>!ml(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}:{...Y0(t),instructionFiles:e.map(s=>s.name)}}function jE(t){const e=t.files.filter(d=>d.hasBlock&&!d.blockCurrent),s=t.files.filter(d=>d.exists&&!d.hasBlock&&!ml(d)),a=d=>Tn(d.map(k=>k.name));return e.length===0?s.length===0?null:w("memory.update.missing",{files:a(s)}):s.length===0?w("memory.update.outdated",{count:e.length,files:a(e)}):w("memory.update.outdatedAndMissing",{count:e.length,outdated:a(e),missing:a(s)})}function DE(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 PE(t){return t.split(/`([^`]+)`/).map((e,s)=>s%2===1?o.jsx("code",{children:e},s):e)}function OE({view:t}){var u;const{status:e,open:s,loading:a,error:d,closeNote:k,openNote:y}=t,[i,c]=M.useState(null),[g,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(p=>{if(e===null)return null;let m=p.replace(/^\.\//,"");try{m=decodeURIComponent(m)}catch{return null}return m===sl||e.notes.some(x=>x.name===m)?()=>y(m):null},[e,y]);if(e===null)return o.jsx("div",{className:"panel-body",children:o.jsx("p",{className:"panel-note",children:d??w("memory.loading")})});if(s!==null||a!==null){const p=(s==null?void 0:s.name)??a??"",m=p===sl?w("memory.index"):((u=e.notes.find(f=>f.name===p))==null?void 0:u.title)??p;return o.jsxs("div",{className:"panel-body",children:[o.jsxs("div",{className:"panel-subhead",children:[o.jsx("button",{className:"link-button",onClick:k,children:w("memory.back")}),o.jsx("span",{className:"panel-subhead-title",title:p,children:m})]}),s===null?o.jsx("p",{className:"panel-note",children:w("memory.note.loading")}):o.jsxs("div",{className:"panel-scroll",children:[o.jsx("div",{className:"plan-body",children:o.jsx(yh,{text:DE(s.text),localLink:b})}),s.truncated&&o.jsx("p",{className:"panel-note",children:w("memory.note.truncated")})]})]})}const E=i??IE(e),N=e.installed?jE(e):null,_=!e.installed||g||t.planned!==null;return o.jsxs("div",{className:"panel-body",children:[o.jsx(BE,{reach:e.reach,onAdjust:e.installed&&!_&&N===null&&e.reach.some(p=>!p.reaches)?()=>v(!0):null}),o.jsxs("div",{className:"panel-scroll",children:[(d??t.lastResult)!==null&&o.jsxs("div",{className:`memory-message${d!==null?" memory-message-error":""}`,children:[o.jsx("span",{children:d??t.lastResult}),o.jsx("button",{className:"link-button",onClick:t.dismissMessage,title:w("common.dismissNotice"),children:"×"})]}),e.git.kind==="error"&&o.jsxs("div",{className:"memory-warning",children:[o.jsx("p",{className:"memory-warning-line",children:on("memory.git.errorWarning")}),o.jsx("pre",{className:"memory-git-message",children:At(e.git.message)})]}),e.files.filter(ml).map(p=>o.jsx("p",{className:"memory-warning",children:p.problem==="outside"?on("memory.problem.outsideWarning",{file:p.name}):p.problem==="encoding"?on("memory.problem.encodingWarning",{file:p.name}):on("memory.problem.brokenBlockWarning",{file:p.name})},p.name)),!e.installed&&o.jsxs("div",{className:"memory-intro",children:[o.jsx("p",{children:w("memory.intro.what")}),o.jsx("p",{children:on("memory.intro.where")})]}),e.installed&&N!==null&&!_&&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:w("memory.update.button")})]}),_&&(t.planned===null?o.jsx(FE,{status:e,options:E,busy:t.busy,onChange:c,onPlan:()=>{c(E),t.requestPlan(E)},onCancel:e.installed?()=>{v(!1),c(null)}:null}):o.jsx(HE,{changes:t.planned,busy:t.busy,confirmLabel:e.installed?w("memory.plan.update"):w("memory.plan.install"),onConfirm:t.install,onCancel:t.cancelPlan})),e.installed&&e.native.pending>0&&!_&&o.jsxs("div",{className:"memory-callout",children:[o.jsx("span",{children:w("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"?w("memory.native.importing"):w("memory.native.import",{count:e.native.pending})})]}),e.installed&&o.jsx(UE,{notes:e.notes,indexExists:e.indexExists,onOpen:y}),e.globalFragments.length>0&&o.jsx($E,{fragments:e.globalFragments})]})]})}function BE({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:w("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?w("memory.reach.reaches",{via:At(s.via)}):w("memory.reach.doesNotReach",{via:At(s.via)})})]},s.agent)),e!==null&&o.jsx("button",{className:"link-button memory-reach-adjust",onClick:e,title:w("memory.reach.adjustTitle"),children:w("memory.reach.adjust")})]})}function FE({status:t,options:e,busy:s,onChange:a,onPlan:d,onCancel:k}){const{git:y}=t,i=y.kind==="repo"?y.worktree:null,c=y.kind==="error"&&e.gitMode==="ignore",g=(v,h)=>{const b=new Set(e.instructionFiles);h?b.add(v):b.delete(v),a({...e,instructionFiles:fh.filter(E=>b.has(E))})};return o.jsxs("div",{className:"memory-form",children:[o.jsx("p",{className:"memory-section-label",children:w("memory.form.files")}),t.files.map(v=>o.jsxs("label",{className:"memory-option",title:AE(v)??void 0,children:[o.jsx("input",{type:"checkbox",checked:e.instructionFiles.includes(v.name),disabled:ml(v),onChange:h=>g(v.name,h.target.checked)}),o.jsx("code",{children:v.name}),o.jsx("span",{className:"memory-option-hint",children:Tn(ME[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:()=>a({...e,gitMode:"ignore"})}),w("memory.git.ignore"),o.jsx("span",{className:"memory-option-hint",children:w("memory.git.ignoreHint")})]}),o.jsxs("label",{className:"memory-option",children:[o.jsx("input",{type:"radio",name:"memory-git-mode",checked:e.gitMode==="version",onChange:()=>a({...e,gitMode:"version"})}),w("memory.git.version"),o.jsx("span",{className:"memory-option-hint",children:w("memory.git.versionHint")})]}),y.ignored&&e.gitMode==="version"&&o.jsx("p",{className:"memory-warning",children:on("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:()=>a({...e,gitMode:"version"})}),on("memory.git.dontTouch"),o.jsx("span",{className:"memory-option-hint",children:w("memory.git.errorHint")})]})]}),(t.native.pending>0||(i==null?void 0:i.mainHasMemory)===!0)&&o.jsx("p",{className:"memory-section-label",children:w("memory.form.existingNotes")}),t.native.pending>0&&o.jsxs("label",{className:"memory-option",children:[o.jsx("input",{type:"checkbox",checked:e.importNative,onChange:v=>a({...e,importNative:v.target.checked})}),w("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=>a({...e,copyFromMainWorktree:v.target.checked})}),w("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:d,title:e.instructionFiles.length===0?w("memory.form.noFiles"):c?w("memory.git.blocked"):void 0,children:w(s==="plan"?"memory.form.planning":"memory.form.preview")}),k!==null&&o.jsx("button",{className:"link-button",onClick:k,disabled:s!==null,children:w("common.cancel")})]})]})}function HE({changes:t,busy:e,confirmLabel:s,onConfirm:a,onCancel:d}){const k=e==="install";return o.jsxs("div",{className:"memory-form",children:[o.jsx("p",{className:"memory-section-label",children:w("memory.plan.changes")}),t.length===0?o.jsx("p",{className:"memory-empty",children:w("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:w(RE[y.action])})]}),y.copiedFrom!==null&&o.jsx("p",{className:"memory-option-hint",children:w("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:a,children:k?w("memory.plan.writing"):s}),o.jsx("button",{className:"link-button",onClick:d,disabled:k,children:t.length===0?w("memory.plan.back"):w("common.cancel")})]})]})}function UE({notes:t,indexExists:e,onOpen:s}){return o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"memory-section-label",children:w("memory.list.notes")}),o.jsxs("ul",{className:"plan-list",children:[e&&o.jsx("li",{children:o.jsxs("button",{className:"plan-row",onClick:()=>s(sl),children:[o.jsx("span",{className:"plan-name",children:w("memory.index")}),o.jsx("span",{className:"plan-meta",children:sl})]})}),t.map(a=>o.jsx("li",{children:o.jsxs("button",{className:"plan-row",onClick:()=>s(a.name),title:a.name,children:[o.jsx("span",{className:"plan-name",children:a.title}),a.description.length>0&&o.jsx("span",{className:"memory-note-description",children:a.description}),o.jsxs("span",{className:"plan-meta",children:[$n(a.modifiedAt)," · ",_n(a.sizeBytes)]})]})},a.name))]}),t.length===0&&o.jsx("p",{className:"memory-empty",children:w("memory.list.empty")})]})}function $E({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:w("memory.global.title")}),o.jsx("p",{className:"memory-empty",children:on("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(Zx,{className:"icon-button",title:w("memory.global.copy"),onCopy:()=>e(s.text)})]}),o.jsx("p",{className:"memory-fragment-note",children:PE(At(s.note))})]},s.agent))]})}function WE(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 zE({view:t,docs:e,onInsertPath:s}){const{plans:a}=t,d=e.active===null?null:e.docs.find(g=>g.key===e.active)??null,k=d===null?void 0:e.content(d.key),y=d!==null&&k===void 0&&t.listFor!==null&&t.listFor===e.terminalId;M.useEffect(()=>{y&&d!==null&&e.reload(d.key)},[y,d==null?void 0:d.key]);const i=g=>{var h;const v=(h=e.content(g.key))==null?void 0:h.loaded;return(v==null?void 0:v.kind)==="plan"?WE(v.plan.text)??g.title:g.title},c=g=>{var h;const v=((h=a.find(b=>b.fileName===g.key))==null?void 0:h.path)??"";return v.length>0?v:i(g)};return o.jsxs("div",{className:"panel-body",children:[e.docs.length>0&&o.jsx(yv,{listLabel:w("panel.tab.plans"),docs:e.docs,active:e.active,tooltipOf:c,labelOf:i,onShowList:e.showList,onSelect:e.select,onClose:e.close}),d!==null?o.jsx(Cv,{doc:d,content:k,readingText:w("plans.loading"),truncatedText:w("plans.truncated"),onReload:()=>e.reload(d.key),onModeChange:g=>e.setMode(d.key,g),onOpenWithSystem:null,initialScroll:e.scrollOf(d.key),onScrollChange:g=>e.rememberScroll(d.key,g)},d.key):o.jsx("div",{className:"panel-scroll",children:a.length===0?o.jsx("p",{className:"panel-note",children:on("plans.empty")}):o.jsx("ul",{className:"plan-list",children:[...a].reverse().map(g=>o.jsx(qE,{plan:g,onOpen:()=>e.open({key:g.fileName,title:g.title}),onInsertPath:s},g.fileName))})})]})}function qE({plan:t,onOpen:e,onInsertPath:s}){const a=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:a??void 0,children:[o.jsx("span",{className:"plan-name",children:t.title}),a!==null&&o.jsx("span",{className:"plan-path",children:a}),o.jsxs("span",{className:"plan-meta",children:[$n(t.modifiedAt)," · ",_n(t.sizeBytes)]})]}),t.absolutePath.length>0&&o.jsx(Eo,{className:"tree-action plan-action",title:w("files.insertPath",{name:t.absolutePath.split(/[\\/]/).pop()??t.title}),onInsert:()=>s(`"${t.absolutePath}"`)})]}):o.jsxs("li",{className:"plan-row plan-row-missing",title:a??w("plans.missingTitle"),children:[o.jsx("span",{className:"plan-name",children:t.title}),a!==null&&o.jsx("span",{className:"plan-path",children:a}),o.jsx("span",{className:"plan-meta",children:w("plans.missing")})]})}const VE=[{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 Mv(t){return t.state!=="ready"?0:new Set(t.changes.map(e=>e.path)).size}function KE({tab:t,plansAvailable:e,hiddenTabs:s,hidden:a,onTabChange:d,title:k,cwd:y,colorCwd:i,platform:c,cli:g,cliUnseen:v,expanded:h,onToggleExpanded:b,git:E,worktrees:N,files:_,plans:u,documents:p,memory:m,onInsert:f,onInsertPath:x,onReveal:j,onHide:T}){var L;const R=Mv(E.status),S=((L=m.status)==null?void 0:L.installed)===!0?m.status.notes.length:0;return o.jsxs("section",{className:`side-panel${a?" side-panel-hidden":""}`,"aria-hidden":a,children:[o.jsxs("header",{className:"side-panel-header",children:[o.jsx("button",{className:"icon-button",onClick:T,title:w("panel.hide"),children:"»"}),y.length>0&&o.jsx("span",{className:"project-swatch",style:{background:Hs(i)}}),o.jsx("span",{className:"side-panel-title",title:y,children:k}),o.jsx("button",{className:"icon-button",onClick:b,title:w(h?"panel.restoreWidth":"panel.widen"),children:h?"⇥":"⇤"})]}),o.jsx("nav",{className:"side-panel-tabs",children:Rb(VE,e,s).map(I=>o.jsxs("button",{className:`side-panel-tab${I.id===t?" side-panel-tab-active":""}`,onClick:()=>d(I.id),title:w(I.labelKey),children:[o.jsx("span",{className:"side-panel-tab-label",children:w(I.labelKey)}),I.id==="git"&&R>0&&o.jsx("span",{className:"side-panel-badge",children:R}),I.id==="plans"&&u.plans.length>0&&o.jsx("span",{className:"side-panel-badge",children:u.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:w("panel.cliUnseen")})]},I.id))}),o.jsxs("div",{className:"side-panel-body",children:[o.jsx("div",{className:`cli-slot${t==="cli"?"":" cli-slot-hidden"}`,children:g}),t==="git"&&o.jsx(NE,{view:E,worktrees:N}),t==="plans"&&o.jsx(zE,{view:u,docs:p.plans,onInsertPath:x}),t==="memory"&&o.jsx(OE,{view:m}),t==="files"&&o.jsx(eE,{view:_,cwd:y,platform:c,onInsert:f,onInsertPath:x,onReveal:j,docs:p.files})]})]})}function GE(t,e,s,a=null){const d=e===void 0||e.length===0?t:`${t} — ${e}`;return a===null?`${d}
|
|
144
|
-
${s}`:`${d}
|
|
145
|
-
${a}
|
|
146
|
-
${s}`}function YE(t,e){const s=[sE(t,e),t.review?w("worktree.tab.reviewTitle"):null].filter(a=>a!==null);return s.length===0?null:s.join(`
|
|
147
|
-
`)}function XE({placement:t}){return o.jsxs("div",{className:"tab tab-pending","aria-busy":"true",title:`${t.pending.cwd}
|
|
148
|
-
${w("tabs.state.opening")}`,style:{"--tab-project-color":Hs(t.pending.cwd)},children:[o.jsx("span",{className:"tab-opening","aria-label":w("tabs.aria.opening"),children:o.jsx("i",{})}),o.jsx("span",{className:"tab-label",children:t.label})]})}function Sh({terminal:t,activity:e,statusLine:s}){if(!t.alive){const a=t.sleeping;return o.jsx("span",{className:`tab-dot${a?" tab-dot-sleeping":" tab-dot-dead"}`,title:w(a?"tabs.dot.sleeping":"tabs.dot.exited")})}return e==="waiting"?o.jsx("span",{className:"tab-bang",title:w("tabs.dot.waiting"),children:"!"}):e==="busy"?o.jsxs("span",{className:"tab-working",title:w("tabs.dot.busy"),"aria-label":w("tabs.aria.working"),children:[o.jsx("i",{}),o.jsx("i",{}),o.jsx("i",{})]}):o.jsx("span",{className:"tab-dot",title:Ub(e,s)})}function To(t){var d;if(t.label.length>0)return t.label;const e=((d=t.worktree)==null?void 0:d.linked)===!0?t.worktree.mainCwd:t.cwd,s=e.split(/[\\/]/).filter(k=>k.length>0),a=s[s.length-1]??e;return t.resumed?`${a} ↩`:a}function QE(t){return t.alive?w("tabs.state.alive"):t.sleeping?w("tabs.state.sleeping"):w("tabs.state.exited",{code:t.exitCode??"?"})}function JE({terminals:t,activeTerminalId:e,activity:s,attention:a,canOpen:d,onSelect:k,onClose:y,onRename:i,onReorder:c,onNew:g,agents:v,offerAgentChoice:h,newTabAgent:b,pendingOpens:E,platform:N,newTabBlockedTitle:_,sessionTitles:u}){const[p,m]=M.useState(null),[f,x]=M.useState(""),[j,T]=M.useState(null),R=M.useRef(null);M.useEffect(()=>{var H;p!==null&&((H=R.current)==null||H.select())},[p]);const S=H=>{m(H.terminalId),x(H.label.length>0?H.label:To(H))},L=()=>{p!==null&&i(p,f.trim()),m(null)},I=H=>{if(j===null||j===H)return;const W=t.map(z=>z.terminalId),G=W.indexOf(j),Y=W.indexOf(H);G===-1||Y===-1||(W.splice(Y,0,...W.splice(G,1)),c(W),T(null))},B=pk(t,E,N),F=new Map;for(const H of B){const W=F.get(H.index);W===void 0?F.set(H.index,[H]):W.push(H)}const D=H=>(F.get(H)??[]).map(W=>o.jsx(XE,{placement:W},`pending:${W.pending.requestId}`));return o.jsxs("div",{className:"tab-bar",children:[t.map((H,W)=>{var P;const G=H.terminalId===e,Y=H.terminalId===p,z=Lv(H,t,N);return o.jsxs(aw.Fragment,{children:[D(W),o.jsx("div",{className:`tab${G?" tab-active":""}${H.alive||H.sleeping?"":" tab-dead"}${(a==null?void 0:a.has(H.terminalId))===!0?" tab-attention":""}`,draggable:!Y,onDragStart:()=>T(H.terminalId),onDragOver:U=>U.preventDefault(),onDrop:()=>I(H.terminalId),onDragEnd:()=>T(null),onClick:()=>k(H.terminalId),onDoubleClick:()=>S(H),title:GE(H.cwd,u.get(H.terminalId),QE(H),YE(H,z)),style:{"--tab-project-color":Hs(Bs(H))},children:Y?o.jsx("input",{ref:R,className:"tab-input",value:f,onChange:U=>x(U.target.value),onBlur:L,onKeyDown:U=>{U.key==="Enter"&&L(),U.key==="Escape"&&m(null),U.stopPropagation()},onClick:U=>U.stopPropagation()}):o.jsxs(o.Fragment,{children:[o.jsx(Sh,{terminal:H,activity:s.get(H.terminalId),statusLine:((P=v.find(U=>U.id===H.agent))==null?void 0:P.statusLine)??null}),o.jsxs("span",{className:"tab-label",children:[H.agent!==null&&tk(h,H.agent)&&o.jsx(Qu,{agent:H.agent,agents:v}),H.review&&o.jsx("span",{className:"tab-review",children:w("worktree.tab.review")}),z!==null&&o.jsx("span",{className:"tab-branch",children:z}),To(H)]}),o.jsx("button",{className:"tab-close",onClick:U=>{U.stopPropagation(),y(H.terminalId)},title:w("tabs.close"),children:"×"})]})})]},H.terminalId)}),D(t.length),o.jsx(bh,{className:"tab-new",text:"+",title:_??w("tabs.new"),disabled:!d||_!==null,offerAgentChoice:h,agents:v,agent:b,onOpen:g})]})}function ZE(t,e,s){const[a,d]=M.useState(!1);return M.useEffect(()=>{if(d(!1),!(e===null||s))return t.onMessage(k=>{k.type==="terminal.output"&&k.terminalId===e&&d(!0)})},[t,e,s]),a&&!s}const e5=200,lm="agent-workbench.files.hidden";function t5(t,e){const[s,a]=M.useState(new Map),[d,k]=M.useState(new Set),[y,i]=M.useState(new Set),[c,g]=M.useState(""),[v,h]=M.useState(null),[b,E]=M.useState(!1),[N,_]=M.useState(()=>Nt(lm,!1,T=>T==="true"?!0:T==="false"?!1:null)),u=M.useRef(new Set),p=M.useRef(N);p.current=N;const m=M.useCallback(T=>{e===null||u.current.has(T)||(u.current.add(T),i(R=>new Set(R).add(T)),t.send({type:"files.list",terminalId:e,path:T,includeHidden:p.current}))},[t,e]);M.useEffect(()=>{if(a(new Map),k(new Set),i(new Set),g(""),h(null),E(!1),u.current=new Set,e===null)return;const T=t.onMessage(S=>{switch(S.type){case"files.listing":{if(S.terminalId!==e)break;const{listing:L}=S;u.current.delete(L.path),a(I=>new Map(I).set(L.path,L)),i(I=>{const B=new Set(I);return B.delete(L.path),B});break}case"files.results":if(S.terminalId!==e)break;h(S.result),E(!1);break;case"error":u.current=new Set,i(new Set),E(!1);break}});t.send({type:"files.list",terminalId:e,path:"",includeHidden:p.current}),u.current.add(""),i(new Set([""]));const R=t.onReopen(()=>{u.current=new Set,t.send({type:"files.list",terminalId:e,path:"",includeHidden:p.current})});return()=>{T(),R()}},[t,e]),M.useEffect(()=>{const T=c.trim();if(e===null||T.length===0){h(null),E(!1);return}E(!0);const R=window.setTimeout(()=>{t.send({type:"files.search",terminalId:e,query:T,includeHidden:p.current})},e5);return()=>window.clearTimeout(R)},[t,e,c,N]);const f=M.useCallback(T=>{k(R=>{const S=new Set(R);return S.has(T)?S.delete(T):(S.add(T),m(T)),S})},[m]),x=M.useCallback(()=>{if(e===null)return;u.current=new Set;const T=["",...d];for(const R of T)u.current.add(R),t.send({type:"files.list",terminalId:e,path:R,includeHidden:p.current});i(new Set(T))},[t,e,d]),j=M.useCallback(()=>{_(T=>{const R=!T;if(p.current=R,yt(lm,String(R)),e!==null){u.current=new Set;const S=["",...d];for(const L of S)u.current.add(L),t.send({type:"files.list",terminalId:e,path:L,includeHidden:R});i(new Set(S))}return R})},[t,e,d]);return{listings:s,expanded:d,loading:y,query:c,setQuery:g,results:v,searching:b,showHidden:N,toggleHidden:j,toggleDirectory:f,refresh:x}}function n5(t){const[e,s]=M.useState(!1),[a,d]=M.useState(null),[k,y]=M.useState(null),[i,c]=M.useState(null),g=M.useRef(null);M.useEffect(()=>{const b=t.onMessage(N=>{switch(N.type){case"search.progress":if(g.current===null||N.searchId!==g.current)break;d(_=>ZS(_,N.progress));break;case"search.results":if(g.current===null||N.searchId!==g.current)break;g.current=null,d(N.result),y(null),s(!1);break;case"error":if(N.code!=="search-failed"||g.current===null||N.requestId!==g.current)break;g.current=null,N.detail!==void 0&&console.error("[servidor]",N.detail),d(null),y(At(N.text)),s(!1);break}}),E=t.onReopen(()=>{g.current!==null&&(g.current=null,s(!1),y(w("searchHook.connectionLost")))});return()=>{b(),E()}},[t]);const v=M.useCallback((b,E)=>{const N=crypto.randomUUID();g.current=N,c({query:b,includeArchived:E}),s(!0),y(null),d(null),t.send({type:"search.global",searchId:N,query:b,includeArchived:E})},[t]),h=M.useCallback(()=>{const b=g.current;g.current=null,b!==null&&t.send({type:"search.cancel",searchId:b}),c(null),s(!1),d(null),y(null)},[t]);return{searching:e,result:a,error:k,submitted:i,search:v,clear:h}}function r5(t,e){const[s,a]=M.useState([]),[d,k]=M.useState(null);return M.useEffect(()=>{if(a([]),k(null),e!==null)return t.onMessage(y=>{switch(y.type){case"conversation.plans":if(y.terminalId!==e)break;a(y.plans),k(e);break}})},[t,e]),{plans:s,listFor:d}}const Av=8,Iv=1024,s5=300,i5=["file","plan"],hl={docs:[],active:null,recent:[]},Lo={};function dl(t,e){return[...t.filter(s=>s!==e),e]}function o5(t,e,s=new Set){const a=t.docs.find(y=>y.key===e.key);if(a!==void 0)return{docs:a.title===e.title?t.docs:t.docs.map(i=>i.key===e.key?{...i,title:e.title}:i),active:e.key,recent:dl(t.recent,e.key)};let d=[...t.docs,{key:e.key,title:e.title}],k=dl(t.recent,e.key);for(;d.length>Av;){const y=k.find(i=>i!==e.key&&!s.has(i));if(y===void 0)break;d=d.filter(i=>i.key!==y),k=k.filter(i=>i!==y)}return{docs:d,active:e.key,recent:k}}function cm(t,e){return t.docs.some(s=>s.key===e)?{...t,active:e,recent:dl(t.recent,e)}:t}function a5(t){return t.active===null?t:{...t,active:null}}function l5(t,e){const s=t.docs.findIndex(y=>y.key===e);if(s===-1)return t;const a=t.docs.filter(y=>y.key!==e),d=t.recent.filter(y=>y!==e);if(t.active!==e)return{docs:a,active:t.active,recent:d};const k=a[s]??a[s-1]??null;return{docs:a,active:k===null?null:k.key,recent:k===null?d:dl(d,k.key)}}function c5(t,e,s){return{...t,docs:t.docs.map(a=>a.key===e?{...a,mode:s}:a)}}function Eu(t,e,s){var a;return((a=t[e])==null?void 0:a[s])??hl}function u5(t,e,s,a){const d=t[e]??{file:hl,plan:hl};return{...t,[e]:{...d,[s]:a}}}function h5(t,e){if(e.length===0)return t;const s=new Set(e),a=Object.keys(t).filter(k=>!s.has(k));if(a.length===0)return t;const d={...t};for(const k of a)delete d[k];return d}function as(t,e,s){return`${t}\0${e}\0${s}`}function d5(t){const e=new Set;for(const[s,a]of Object.entries(t))for(const d of i5)for(const k of a[d].docs)e.add(as(s,d,k.key));return e}function f5(t){return JSON.stringify(t)}function fl(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)?t:null}function p5(t){const e=fl(t);if(e===null)return null;const{key:s,title:a,mode:d}=e;if(typeof s!="string"||s.length===0||s.length>Iv||typeof a!="string"||a.length>s5)return null;const k={key:s,title:a};return d==="formatted"||d==="source"?{...k,mode:d}:k}function um(t){const e=fl(t);if(e===null||!Array.isArray(e.docs))return hl;const s=[];for(const i of e.docs){const c=p5(i);if(c!==null&&!s.some(g=>g.key===c.key)&&s.push(c),s.length===Av)break}const a=s.map(i=>i.key),d=typeof e.active=="string"&&a.includes(e.active)?e.active:null,k=Array.isArray(e.recent)?e.recent.filter(i=>typeof i=="string"&&a.includes(i)):[],y=[...a.filter(i=>!k.includes(i)),...new Set(k)];return{docs:s,active:d,recent:y}}function m5(t){let e;try{e=JSON.parse(t)}catch{return Lo}const s=fl(e);if(s===null)return Lo;const a={};for(const[d,k]of Object.entries(s)){const y=fl(k);if(y===null||d.length===0||d.length>Iv)continue;const i=um(y.file),c=um(y.plan);i.docs.length===0&&c.docs.length===0||(a[d]={file:i,plan:c})}return a}const hm=1,g5=25e4,jv={kind:"hunk",text:"…",oldLine:null,newLine:null};function rh(t){return t.replace(/\r\n?/g,`
|
|
149
|
-
`)}function dm(t){const e=rh(t).split(`
|
|
150
|
-
`);return e.length>0&&e[e.length-1]===""&&e.pop(),e}function v5(t,e){const s=dm(t),a=dm(e);let d=0;for(;d<s.length&&d<a.length&&s[d]===a[d];)d+=1;let k=s.length,y=a.length;for(;k>d&&y>d&&s[k-1]===a[y-1];)k-=1,y-=1;if(d===k&&d===y)return[];const i=[];for(let c=0;c<d;c+=1)i.push(sh(s,c,c));_5(s,a,d,k,d,y,i);for(let c=k,g=y;c<s.length;c+=1,g+=1)i.push(sh(s,c,g));return w5(i)}function sh(t,e,s){return{kind:"context",text:t[e]??"",oldLine:e+1,newLine:s+1}}function Tu(t,e){return{kind:"removed",text:t[e]??"",oldLine:e+1,newLine:null}}function Lu(t,e){return{kind:"added",text:t[e]??"",oldLine:null,newLine:e+1}}function _5(t,e,s,a,d,k,y){const i=a-s,c=k-d;if(i===0||c===0||i*c>g5){for(let N=s;N<a;N+=1)y.push(Tu(t,N));for(let N=d;N<k;N+=1)y.push(Lu(e,N));return}const g=c+1,v=new Uint32Array((i+1)*g),h=(N,_)=>v[N*g+_]??0;for(let N=i-1;N>=0;N-=1)for(let _=c-1;_>=0;_-=1)v[N*g+_]=t[s+N]===e[d+_]?h(N+1,_+1)+1:Math.max(h(N+1,_),h(N,_+1));let b=0,E=0;for(;b<i&&E<c;)t[s+b]===e[d+E]?(y.push(sh(t,s+b,d+E)),b+=1,E+=1):h(b+1,E)>=h(b,E+1)?(y.push(Tu(t,s+b)),b+=1):(y.push(Lu(e,d+E)),E+=1);for(;b<i;b+=1)y.push(Tu(t,s+b));for(;E<c;E+=1)y.push(Lu(e,d+E))}function w5(t){const e=t.map(d=>d.kind!=="context"),s=[];let a=-1;return t.forEach((d,k)=>{let y=!1;for(let i=-hm;i<=hm&&!y;i+=1)y=e[k+i]===!0;y&&(a!==-1&&k>a+1&&s.push(jv),s.push(d),a=k)}),s}const Dv="agent-workbench.docTabs",y5=1600;function b5(){try{const t=window.sessionStorage.getItem(Dv);return t===null?Lo:m5(t)}catch{return Lo}}function Nu(t){return t!==void 0&&(t.text!==t.opened||t.conflict!==null||t.pending!==null)}function k5(t,e,s,a){const[d,k]=M.useState(b5),[y,i]=M.useState(new Map),[c,g]=M.useState(new Map),[v,h]=M.useState(new Set),b=M.useRef(y);b.current=y;const E=M.useRef(c);E.current=c;const N=M.useRef(new Map),_=M.useRef(new Map),u=M.useRef(new Map);M.useEffect(()=>{k(T=>h5(T,e.map(R=>R.terminalId)))},[e]),M.useEffect(()=>{const T=d5(d);for(const R of[...N.current.keys()])T.has(R)||N.current.delete(R);i(R=>{const S=[...R.keys()].filter(I=>!T.has(I));if(S.length===0)return R;const L=new Map(R);for(const I of S)L.delete(I);return L}),g(R=>{const S=[...R.keys()].filter(I=>!T.has(I));if(S.length===0)return R;const L=new Map(R);for(const I of S)L.delete(I);return L})},[d]),M.useEffect(()=>{try{window.sessionStorage.setItem(Dv,f5(d))}catch{}},[d]);const p=M.useMemo(()=>[...c.values()].some(Nu),[c]);M.useEffect(()=>{if(!p)return;const T=R=>{R.preventDefault(),R.returnValue=""};return window.addEventListener("beforeunload",T),()=>window.removeEventListener("beforeunload",T)},[p]),M.useEffect(()=>{const T=u.current;return()=>{for(const R of T.values())window.clearTimeout(R)}},[]);const m=M.useCallback((T,R,S)=>{const L=as(T,R,S);i(I=>{var B;return new Map(I).set(L,{loaded:((B=I.get(L))==null?void 0:B.loaded)??null,loading:!0,failed:!1})}),R==="file"?t.send({type:"files.read",terminalId:T,path:S}):t.send({type:"plans.read",terminalId:T,fileName:S})},[t]),f=M.useCallback((T,R)=>{g(S=>{const L=S.get(T);if(L===void 0)return S;const I=new Map(S),B=R(L);return B===null?I.delete(T):I.set(T,B),I})},[]),x=M.useCallback(T=>{h(S=>new Set(S).add(T));const R=u.current.get(T);R!==void 0&&window.clearTimeout(R),u.current.set(T,window.setTimeout(()=>{u.current.delete(T),h(S=>{if(!S.has(T))return S;const L=new Set(S);return L.delete(T),L})},y5))},[]);M.useEffect(()=>{const T=(L,I)=>i(B=>B.has(L)?new Map(B).set(L,{loaded:I,loading:!1,failed:!1}):B),R=t.onMessage(L=>{switch(L.type){case"files.preview":T(as(L.terminalId,"file",L.preview.path),{kind:"file",preview:L.preview});break;case"plans.content":T(as(L.terminalId,"plan",L.plan.fileName),{kind:"plan",plan:L.plan});break;case"files.saved":{const I=_.current.get(L.requestId);if(I===void 0)break;_.current.delete(L.requestId);const{id:B}=I,{preview:F}=L;if(F!==null&&T(B,{kind:"file",preview:F}),L.outcome==="saved")f(B,()=>null),x(B);else{const D=F!==null&&F.editable===!0?F:null;f(B,H=>({...H,saving:!1,conflict:{next:D}}))}break}case"error":{const I=L.requestId===void 0?void 0:_.current.get(L.requestId);if(I!==void 0&&L.requestId!==void 0){_.current.delete(L.requestId),f(I.id,B=>({...B,saving:!1,failure:{kind:"server",text:L.text}}));break}i(B=>{if(![...B.values()].some(D=>D.loading))return B;const F=new Map;for(const[D,H]of B)F.set(D,H.loading?{...H,loading:!1,failed:!0}:H);return F});break}}}),S=t.onReopen(()=>{for(const[L,I]of b.current){if(!I.loading)continue;const[B,F,D]=L.split("\0");B===void 0||D===void 0||(F==="file"&&t.send({type:"files.read",terminalId:B,path:D}),F==="plan"&&t.send({type:"plans.read",terminalId:B,fileName:D}))}for(const[L,I]of _.current){if(!I.sent){I.sent=!0;continue}_.current.delete(L),f(I.id,B=>({...B,saving:!1,failure:{kind:"lost"}}))}});return()=>{R(),S()}},[t,f,x]);const j=M.useCallback(T=>{const R=s,S=R===null?Eu(Lo,"",T):Eu(d,R,T),L=W=>R===null?null:as(R,T,W),I=W=>{R!==null&&k(G=>u5(G,R,T,W(Eu(G,R,T))))},B=W=>{const G=L(W);return G!==null&&Nu(c.get(G))},F=()=>new Set(S.docs.filter(W=>B(W.key)).map(W=>W.key)),D=W=>I(G=>l5(G,W)),H=W=>{const G=L(W);if(T!=="file"||!a||R===null||G===null)return null;const Y=c.get(G)??null;return{edit:Y,unsaved:Nu(Y??void 0),justSaved:v.has(G),begin:()=>{var $;const z=($=y.get(G))==null?void 0:$.loaded;if((z==null?void 0:z.kind)!=="file"||z.preview.editable!==!0||z.preview.hash===void 0)return;const{hash:P}=z.preview,U=rh(z.preview.text);g(K=>K.has(G)?K:new Map(K).set(G,{opened:U,baseHash:P,text:U,saving:!1,failure:null,conflict:null,pending:null,closing:!1}))},change:z=>f(G,P=>P.conflict!==null?P:{...P,text:z,failure:null}),save:()=>{const z=E.current.get(G);if(z===void 0||z.saving||z.conflict!==null||z.text===z.opened)return;const P=crypto.randomUUID(),U=t.send({type:"files.write",terminalId:R,requestId:P,path:W,text:z.text,baseHash:z.baseHash});_.current.set(P,{id:G,sent:U}),f(G,$=>({...$,saving:!0,failure:null}))},discard:()=>{const z=E.current.get(G);f(G,()=>null),z!==void 0&&z.conflict!==null&&z.conflict.next===null&&m(R,T,W)},adopt:()=>f(G,z=>{var te;const P=((te=z.conflict)==null?void 0:te.next)??null;if(P===null||P.hash===void 0)return z;const U=v5(z.opened,z.text),$=U.length===0?z.pending:z.pending===null?U:[...z.pending,jv,...U],K=rh(P.text);return{...z,opened:K,baseHash:P.hash,text:K,failure:null,conflict:null,pending:$,closing:!1}}),dismissPending:()=>f(G,z=>({...z,pending:null})),confirmClose:()=>{f(G,()=>null),D(W)},keepEditing:()=>f(G,z=>({...z,closing:!1}))}};return{terminalId:R,docs:S.docs,active:S.active,open:W=>{if(R===null)return;const G=F();I(Y=>o5(Y,W,G)),m(R,T,W.key)},select:W=>I(G=>cm(G,W)),showList:()=>I(a5),close:D,requestClose:W=>{const G=L(W);if(G===null||!B(W)){D(W);return}I(Y=>cm(Y,W)),f(G,Y=>({...Y,closing:!0}))},setMode:(W,G)=>I(Y=>c5(Y,W,G)),content:W=>R===null?void 0:y.get(as(R,T,W)),reload:W=>{R!==null&&m(R,T,W)},rememberScroll:(W,G)=>{R!==null&&N.current.set(as(R,T,W),G)},scrollOf:W=>R===null?void 0:N.current.get(as(R,T,W)),editorFor:H,unsaved:B}},[s,d,y,c,v,a,t,m,f]);return M.useMemo(()=>({files:j("file"),plans:j("plan")}),[j])}const C5=/(?::\d+(?:[:-]\d+)?|#L\d+(?:-L?\d+)?)$/,S5=/[\n\r\t*?<>|"`]/,x5=/\.[A-Za-z0-9_-]{1,12}$/,Pv=t=>t.replace(/\\/g,"/"),E5=t=>t.replace(/\/+$/,"");function fm(t,e){const s=E5(Pv(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 xh(t,e){let s=t.trim();const a=/^(["'])(.*)\1$/.exec(s);if(a!==null&&(s=(a[2]??"").trim()),s.startsWith("@")&&(s=s.slice(1)),s.length===0||s.length>Dy||S5.test(s)||s.includes("://")||s.startsWith("~")||s.startsWith("-")||(s=Pv(s.replace(C5,"")).replace(/[.,;:]+$/,""),s.length===0))return null;const d=e.platform==="win32";if(/^[A-Za-z]:\//.test(s)||s.startsWith("//")){const i=d?fm(s,e):null;if(i===null)return null;s=i}else if(s.startsWith("/")){const i=d?null:fm(s,e);if(i===null)return null;s=i}const k=[];for(const i of s.split("/"))if(!(i===""||i===".")){if(i===".."){if(k.length===0)return null;k.pop();continue}if(i.includes(":")||i!==i.trim())return null;k.push(i)}const y=k[k.length-1];return y===void 0||k.length===1&&!x5.test(y)?null:k.join("/")}function Ov(t,e){var d;const s=((d=t.split("#")[0])==null?void 0:d.split("?")[0])??"";if(s.length===0)return null;let a;try{a=decodeURIComponent(s)}catch{return null}return/^[a-z][a-z0-9+.-]+:/i.test(a)?null:xh(a,e)}const T5=/`([^`\n]+)`/g,L5=/\]\(([^)\s]+)\)/g;function N5(t,e){const s=new Set;for(const a of t.matchAll(T5)){const d=xh(a[1]??"",e);d!==null&&s.add(d)}for(const a of t.matchAll(L5)){const d=Ov(a[1]??"",e);d!==null&&s.add(d)}return[...s]}function R5(t,e,s){return t.filter(a=>e.get(a)!==!0&&!s.has(a))}function M5(t,e,s){const a=new Set(s),d=new Map(t);for(const k of e)d.set(k,a.has(k));return d}const A5=1e3;function I5(t){const{connection:e,enabled:s,terminalId:a,cwd:d,platform:k,events:y,liveTerminalIds:i,onOpen:c}=t,g=M.useRef(new Map),v=M.useRef(new Map),h=M.useRef(0),[b,E]=M.useState(0),[N,_]=M.useState(0),u=M.useMemo(()=>({cwd:d,platform:k}),[d,k]);return M.useEffect(()=>{const p=e.onMessage(f=>{if(f.type!=="files.checked")return;const x=v.current.get(f.requestId);if(x===void 0)return;v.current.delete(f.requestId);const j=g.current.get(x.terminalId);if(j!==void 0){for(const T of x.paths)j.pending.delete(T);j.known=M5(j.known,x.paths,f.existing),E(T=>T+1)}}),m=e.onReopen(()=>{v.current.clear();for(const f of g.current.values())f.pending.clear(),f.scanned=new WeakSet;_(f=>f+1)});return()=>{p(),m()}},[e]),M.useEffect(()=>{const p=new Set(i);for(const m of[...g.current.keys()])p.has(m)||g.current.delete(m)},[i]),M.useEffect(()=>{if(!s||a===null||d.length===0)return;let p=g.current.get(a);p===void 0&&(p={known:new Map,pending:new Set,scanned:new WeakSet},g.current.set(a,p));const m=new Set;for(const x of y)if(!p.scanned.has(x)&&(p.scanned.add(x),x.role==="assistant")){for(const j of x.parts)if(j.kind==="text")for(const T of N5(j.text,u))m.add(T)}const f=R5([...m],p.known,p.pending).slice(0,A5);for(let x=0;x<f.length;x+=Xf){const j=f.slice(x,x+Xf);h.current+=1;const T=`files-${h.current}`;v.current.set(T,{terminalId:a,paths:j});for(const R of j)p.pending.add(R);e.send({type:"files.check",terminalId:a,requestId:T,paths:j})}},[e,s,a,d,u,y,N]),M.useMemo(()=>{var f;if(!s||a===null)return null;const p=(f=g.current.get(a))==null?void 0:f.known,m=x=>x!==null&&(p==null?void 0:p.get(x))===!0?()=>c(x):null;return{code:x=>m(xh(x,u)),link:x=>m(Ov(x,u))}},[s,a,u,c,b])}function j5(t,e){const[s,a]=M.useState(ru),[d,k]=M.useState(null),[y,i]=M.useState(!1);M.useEffect(()=>{if(e===null){a(ru),k(null);return}a(ru),k(null),i(!1);const h=t.onMessage(E=>{switch(E.type){case"git.status":E.terminalId===e&&a(E.status);break;case"git.diff":if(E.terminalId!==e)break;k(E.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]),g=M.useCallback(()=>{k(null),i(!1)},[]),v=M.useCallback(()=>{e!==null&&t.send({type:"git.refresh",terminalId:e})},[t,e]);return{status:s,diff:d,loadingDiff:y,openDiff:c,closeDiff:g,refresh:v}}const ih=new Set;function D5(t){return t!==void 0&&ih.has(t)}function P5(t){return t.length===0?w("memory.result.nothingChanged"):w("memory.result.installed",{count:t.length})}function O5(t,e){const s=t.length===0?w("memory.result.nothingImported"):w("memory.result.imported",{count:t.length});return e.length===0?s:w("memory.result.withSkipped",{result:s,skipped:w("memory.result.skipped",{count:e.length,files:e.join(", ")})})}function B5(t,e){const[s,a]=M.useState(null),[d,k]=M.useState(null),[y,i]=M.useState(null),[c,g]=M.useState(null),[v,h]=M.useState(null),[b,E]=M.useState(null),[N,_]=M.useState(null),u=M.useRef(new Map),p=M.useRef(new Set),m=M.useRef(null),f=M.useRef(!1),x=M.useCallback(H=>{const W=`memory-${crypto.randomUUID()}`;return u.current.set(W,H),p.current.add(W),ih.add(W),W},[]),j=M.useCallback(H=>{for(const[W,G]of u.current)G===H&&u.current.delete(W)},[]);M.useEffect(()=>{a(null),k(null),i(null),g(null),h(null),E(null),_(null),u.current.clear();for(const P of p.current)ih.delete(P);if(p.current.clear(),m.current=null,f.current=!1,e===null)return;const H=(P,U)=>P===void 0||u.current.get(P)!==U?!1:(u.current.delete(P),!0),W=t.onMessage(P=>{switch(P.type){case"memory.status":if(P.terminalId!==e)break;a(P.status),f.current&&(f.current=!1,_(null));break;case"memory.planned":if(P.terminalId!==e||!H(P.requestId,"plan"))break;g(P.changes),h(null);break;case"memory.installed":if(P.terminalId!==e||!H(P.requestId,"install"))break;m.current=null,g(null),h(null),E(P5(P.applied));break;case"memory.imported":if(P.terminalId!==e||!H(P.requestId,"import"))break;h(null),E(O5(P.copied,P.skipped));break;case"memory.content":if(P.terminalId!==e||!H(P.requestId,"read"))break;k(P.note),i(null);break;case"error":{const U=P.requestId,$=U===void 0?void 0:u.current.get(U);if(U===void 0||$===void 0)break;u.current.delete(U),$==="read"?i(null):$!=="subscribe"&&h(null),_(At(P.text)),f.current=$==="subscribe";break}}}),G=t.onStatus(P=>{if(P!=="reconnecting"&&P!=="failed")return;const U=new Set(u.current.values());u.current.clear(),h(null),i(null),(U.has("install")||U.has("import"))&&(m.current=null,g(null),_(w("memory.error.connectionLost")))}),Y=()=>{t.send({type:"memory.subscribe",terminalId:e,requestId:x("subscribe")})};Y();const z=t.onReopen(Y);return()=>{W(),G(),z(),t.send({type:"memory.unsubscribe",terminalId:e})}},[t,e,x]);const T=M.useCallback(()=>{f.current=!1,_(null),E(null)},[]),R=M.useCallback(H=>{e!==null&&(j("read"),T(),i(H),k(null),t.send({type:"memory.read",terminalId:e,name:H,requestId:x("read")}))},[t,e,T,j,x]),S=M.useCallback(()=>{j("read"),k(null),i(null)},[j]),L=M.useCallback(H=>{e!==null&&(T(),m.current=H,g(null),h("plan"),t.send({type:"memory.plan",terminalId:e,options:H,requestId:x("plan")}))},[t,e,T,x]),I=M.useCallback(()=>{const H=m.current;e===null||H===null||(T(),h("install"),t.send({type:"memory.install",terminalId:e,options:H,requestId:x("install")}))},[t,e,T,x]),B=M.useCallback(()=>{e!==null&&(T(),h("import"),t.send({type:"memory.import",terminalId:e,requestId:x("import")}))},[t,e,T,x]),F=M.useCallback(()=>{j("plan"),m.current=null,g(null)},[j]),D=M.useCallback(()=>{f.current=!1,_(null),E(null)},[]);return{status:s,open:d,loading:y,planned:c,busy:v,lastResult:b,error:N,openNote:R,closeNote:S,requestPlan:L,install:I,importNative:B,cancelPlan:F,dismissMessage:D}}function F5(t){const[e,s]=M.useState([]),[a,d]=M.useState({}),[k,y]=M.useState(null),i=M.useRef(new Set);M.useEffect(()=>{const u=t.onMessage(m=>{switch(m.type){case"notes.list":s(m.notes);break;case"notes.imageData":i.current.add(m.imageId),d(f=>({...f,[m.imageId]:m.data===null?null:`data:${m.mediaType};base64,${m.data}`}));break;case"error":m.code==="notes-failed"&&y(At(m.text));break}}),p=t.onReopen(()=>{i.current.clear()});return()=>{u(),p()}},[t]);const c=M.useCallback(u=>{i.current.has(u)||(i.current.add(u),t.send({type:"notes.image",imageId:u}))},[t]),g=M.useCallback(()=>{const u=crypto.randomUUID(),p=Date.now();return s(m=>[...m,{noteId:u,text:"",images:[],createdAt:p,updatedAt:p}]),t.send({type:"notes.create",noteId:u}),u},[t]),v=M.useCallback((u,p)=>{s(m=>m.map(f=>f.noteId===u?{...f,text:p,updatedAt:Date.now()}:f)),t.send({type:"notes.update",noteId:u,text:p})},[t]),h=M.useCallback(u=>{s(p=>p.filter(m=>m.noteId!==u)),t.send({type:"notes.delete",noteId:u})},[t]),b=M.useCallback((u,p)=>{const m=e.find(x=>x.noteId===u);if(m!==void 0&&m.images.length>=Kf){y(w("notes.tooManyImages",{count:Kf}));return}if(p.size>il){y(w("notes.imageTooBig",{name:p.name||w("notes.imageFallbackName"),size:Math.round(p.size/1024/1024),max:il/1024/1024}));return}const f=new FileReader;f.onload=()=>{const x=f.result;if(typeof x!="string")return;const j=x.indexOf(",");j!==-1&&t.send({type:"notes.addImage",noteId:u,image:{mediaType:p.type,data:x.slice(j+1)}})},f.onerror=()=>y(w("notes.readFailed")),f.readAsDataURL(p)},[t,e]),E=M.useCallback((u,p)=>{s(m=>m.map(f=>f.noteId===u?{...f,images:f.images.filter(x=>x.imageId!==p)}:f)),t.send({type:"notes.removeImage",noteId:u,imageId:p})},[t]),N=M.useCallback((u,p)=>{t.send({type:"notes.send",noteId:u,terminalId:p})},[t]),_=M.useCallback(()=>y(null),[]);return{notes:e,images:a,problem:k,requestImage:c,create:g,updateText:v,remove:h,addImage:b,removeImage:E,sendToAgent:N,dismissProblem:_}}function H5(t){const[e,s]=M.useState([]);return M.useEffect(()=>t.onMessage(a=>{a.type==="plan.limits"&&s(a.limits)}),[t]),e}const Bv="agent-workbench.theme",Ru=["system","light","dark"],U5={system:"theme.system",light:"theme.light",dark:"theme.dark"};function pm(t){return w("theme.title",{theme:w(U5[t])})}const mm={system:"◐",light:"☀",dark:"☾"};function $5(){return Nt(Bv,"system",t=>t==="light"||t==="dark"||t==="system"?t:null)}function W5(){return window.matchMedia("(prefers-color-scheme: dark)").matches}function z5(){const[t,e]=M.useState($5),[s,a]=M.useState(W5);M.useEffect(()=>{const y=window.matchMedia("(prefers-color-scheme: dark)"),i=c=>a(c.matches);return y.addEventListener("change",i),()=>y.removeEventListener("change",i)},[]);const d=t==="system"?s?"dark":"light":t;M.useEffect(()=>{document.documentElement.dataset.theme=d,document.documentElement.style.colorScheme=d},[d]);const k=M.useCallback(()=>{e(y=>{const i=Ru[(Ru.indexOf(y)+1)%Ru.length]??"system";return yt(Bv,i),i})},[]);return{preference:t,resolved:d,cycle:k}}const gm="agent-workbench.terminalTheme";function q5(t){return t==="dark"||t==="follow"?t:null}function V5(t,e){return t==="follow"?e:"dark"}function K5(t){const[e,s]=M.useState(()=>Nt(gm,"dark",q5)),a=V5(e,t);M.useEffect(()=>{document.documentElement.dataset.terminalTheme=a},[a]);const d=M.useCallback(k=>{yt(gm,k),s(k)},[]);return{preference:e,resolved:a,setPreference:d}}const G5=1500;function Y5(t,e){return t===void 0||t===e?null:e==="waiting"?"attention":e==="idle"&&t==="busy"?"done":null}function X5(t,e){const s={now:[],later:[],cancel:[]};for(const[a,d]of e){const k=t.get(a);if(k===d)continue;s.cancel.push(a);const y=Y5(k,d);y==="attention"?s.now.push(a):y==="done"&&s.later.push(a)}for(const a of t.keys())e.has(a)||s.cancel.push(a);return s}const vm="agent-workbench.phone-chime";function Q5(t){return t==="system"||t==="page"?t:null}function J5(t){return`agentworkbench://chime?source=${t}`}function Z5(t,e,s,a){return t?e==="page"?gl:null:s?Ao(a):null}const _m="agent-workbench.sound";function eT(t){return t==="on"?!0:t==="off"?!1:null}function tT(t){return w(t?"sound.on":"sound.off")}function nT(t,e){return t&&e>0}const rT={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}]},Fv=.02,gl=.8,Hv=.2,wm="agent-workbench.sound-volume";function Ao(t){return Math.min(gl,Math.max(Fv,t))}function sT(t){if(t.trim().length===0)return null;const e=Number(t);return Number.isFinite(e)?Ao(e):null}function iT(t){return Math.round(Ao(t)/gl*100)}class oT{constructor(){Ht(this,"context",null);Ht(this,"volume",Hv)}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 a=s.currentTime+.01;for(const d of rT[e]){const k=s.createOscillator(),y=s.createGain();k.type="sine",k.frequency.value=d.frequency;const i=a+d.at;y.gain.setValueAtTime(1e-4,i),y.gain.exponentialRampToValueAtTime(Ao(this.volume),i+.012),y.gain.exponentialRampToValueAtTime(1e-4,i+d.duration),k.connect(y),y.connect(s.destination),k.start(i),k.stop(i+d.duration+.02)}}}const Mu="agent-workbench.notify";function aT(t){return t==="on"?!0:t==="off"?!1:null}function lT(t,e,s){return t&&e==="granted"&&!s}function cT(t,e){return w(e==="denied"?"sound.notify.blocked":t?"sound.notify.on":"sound.notify.off")}function uT(t,e){return t==="attention"?w("notify.attention",{tab:e}):w("notify.done",{tab:e})}function hT(t){return t===void 0?"":t.label.length>0?t.label:t.cwd.split(/[\\/]/).filter(e=>e.length>0).pop()??t.cwd}function ko(){return typeof window>"u"||!("Notification"in window)||!window.isSecureContext?"unsupported":Notification.permission}async function dT(){if(ko()==="unsupported")return"unsupported";try{return await Notification.requestPermission()}catch{return ko()}}function fT(){return document.visibilityState==="visible"&&document.hasFocus()}function pT(t){try{const e=new Notification("Agent Workbench",{body:uT(t.chime,t.tabName),tag:`agent-workbench:${t.terminalId}`});e.onclick=()=>{window.focus(),t.onClick(),e.close()}}catch{}}function mT(t,e){const[s,a]=M.useState(()=>Nt(_m,!0,eT)),d=M.useRef(s);d.current=s;const[k,y]=M.useState(()=>Nt(wm,Hv,sT)),i=M.useRef(k);i.current=k;const[c]=M.useState(()=>typeof navigator<"u"&&Pg(navigator.userAgent)),[g,v]=M.useState(()=>Nt(vm,"system",Q5)),h=M.useRef(g);h.current=g;const[b,E]=M.useState(()=>ko()),[N,_]=M.useState(()=>Nt(Mu,!1,aT)),u=M.useRef(N);u.current=N;const p=M.useRef(e);p.current=e;const m=M.useCallback((z,P)=>{lT(u.current,ko(),fT())&&pT({chime:z,terminalId:P,tabName:p.current.nameOf(P),onClick:()=>p.current.activate(P)})},[]),f=M.useRef(null),x=M.useRef(new Map),j=M.useRef(new Map),[T,R]=M.useState(()=>new Set),S=M.useRef(new Map),L=M.useCallback(z=>{const P=S.current,U=P.get(z);U!==void 0&&window.clearTimeout(U),R($=>$.has(z)?$:new Set($).add(z)),P.set(z,window.setTimeout(()=>{P.delete(z),R($=>{if(!$.has(z))return $;const K=new Set($);return K.delete(z),K})},Xg))},[]),I=M.useCallback(z=>{const P=f.current,U=Z5(c,h.current,d.current,i.current);P===null||U===null||(P.volume=U,P.play(z))},[c]);M.useEffect(()=>{const z=new oT;z.volume=i.current,f.current=z;const P=()=>{z.unlock(),z.ready&&(window.removeEventListener("pointerdown",P),window.removeEventListener("keydown",P))};return window.addEventListener("pointerdown",P),window.addEventListener("keydown",P),()=>{window.removeEventListener("pointerdown",P),window.removeEventListener("keydown",P),f.current=null}},[]),M.useEffect(()=>{const z=X5(x.current,t);x.current=new Map(t);const P=j.current;for(const U of z.cancel){const $=P.get(U);$!==void 0&&(window.clearTimeout($),P.delete(U))}z.now.length>0&&I("attention");for(const U of z.now)m("attention",U),L(U);for(const U of z.later)P.set(U,window.setTimeout(()=>{P.delete(U),I("done"),m("done",U),L(U)},G5))},[t,m,I,L]),M.useEffect(()=>{const z=j.current,P=S.current;return()=>{for(const U of z.values())window.clearTimeout(U);z.clear();for(const U of P.values())window.clearTimeout(U);P.clear()}},[]);const B=M.useCallback(()=>{var z,P;a(U=>{const $=!U;return yt(_m,$?"on":"off"),$}),d.current||((z=f.current)==null||z.unlock(),(P=f.current)==null||P.play("done"))},[]),F=M.useCallback(z=>{const P=Ao(z);y(P),yt(wm,String(P)),f.current!==null&&(f.current.volume=P)},[]),D=M.useCallback(()=>{var z,P;d.current&&((z=f.current)==null||z.unlock(),(P=f.current)==null||P.play("done"))},[]),H=M.useCallback(()=>{if(u.current&&ko()==="granted"){_(!1),yt(Mu,"off");return}dT().then(z=>{E(z),z==="granted"&&(_(!0),yt(Mu,"on"))})},[]),W={supported:b!=="unsupported",enabled:N&&b==="granted",permission:b,toggle:H},G=M.useCallback(z=>{var P;v(z),h.current=z,yt(vm,z),window.location.href=J5(z),z==="page"&&((P=f.current)==null||P.unlock(),I("done"))},[I]);return{enabled:s,toggle:B,volume:k,setVolume:F,previewVolume:D,notify:W,phoneChime:c?{source:g,setSource:G}:null,attention:T}}function Uv(t,e,s){const[a,d]=M.useState(()=>Nt(t,e,x1));M.useLayoutEffect(()=>{document.documentElement.dataset[s]=a},[s,a]);const k=M.useCallback(()=>{d(y=>{const i=Yg(y);return yt(t,i),i})},[t]);return{size:a,cycle:k}}function gT(){return Uv(b1,Gg,"threadFont")}function vT(){return Uv(k1,C1,"notesFont")}function _T(t,e){const[s,a]=M.useState(()=>new Map),[d,k]=M.useState(()=>new Map),y=M.useCallback((c,g,v,h)=>{a(b=>new Map(b).set(c,{requestId:g,terminalId:c,afterEventId:v,phase:"sending",queued:h,sentAt:Date.now(),deliveredAt:null}))},[]);M.useEffect(()=>{const c=t.onMessage(v=>{v.type==="agent.submitted"&&a(h=>vC(h,v,Date.now()))}),g=t.onReopen(()=>a(v=>gC(v,Date.now())));return()=>{c(),g()}},[t]);const i=M.useRef(new Map);return M.useLayoutEffect(()=>{const c=i.current;if(c===e)return;i.current=e;const g=Date.now();k(v=>mC(c,e,v,g))},[e]),{track:y,receipts:s,clocks:d}}const wT=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]);function $v({sound:t}){return o.jsxs("span",{className:"sound-control",children:[o.jsx("button",{className:`icon-button${nT(t.enabled,t.volume)?" icon-button-on":""}`,onClick:t.toggle,title:tT(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:Fv,max:gl,step:.01,value:t.volume,onChange:e=>t.setVolume(Number(e.target.value)),onPointerUp:t.previewVolume,onKeyUp:e=>{wT.has(e.key)&&t.previewVolume()},title:w("sound.volume"),"aria-label":w("sound.volume")}),o.jsxs("span",{className:"sound-volume-value",children:[iT(t.volume),"%"]})]})})]})}function Wv({notify:t}){return t.supported?o.jsx("button",{className:`icon-button${t.enabled?" icon-button-on":""}`,onClick:t.toggle,title:cT(t.enabled,t.permission),"aria-pressed":t.enabled,children:o.jsx(yT,{})}):null}function yT(){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 bT(t){const[e,s]=M.useState(null),[a,d]=M.useState(null),[k,y]=M.useState(null),[i,c]=M.useState(!1),[g,v]=M.useState(null);M.useEffect(()=>{const x=t.onMessage(T=>{switch(T.type){case"remote.status":s(T.status),T.status.pairingActive||(d(null),y(null));break;case"remote.pairing.code":d(T.pairing),y(null);break;case"remote.phone.pairing":y(T.pairing),d(null);break;case"error":if(T.code!=="remote-failed")break;v(At(T.text)),T.detail!==void 0&&console.error("[servidor]",T.detail);break}}),j=t.onReopen(()=>{d(null),y(null),c(!1)});return()=>{x(),j()}},[t]);const h=M.useCallback(x=>{v(null),t.send({type:"remote.configure",enabled:x})},[t]),b=M.useCallback(x=>{v(null),t.send({type:"remote.configure",port:x})},[t]),E=M.useCallback(()=>{v(null),t.send({type:"remote.pairing.start"})},[t]),N=M.useCallback(()=>{d(null),t.send({type:"remote.pairing.cancel"})},[t]),_=M.useCallback(()=>{v(null),c(!0),t.send({type:"remote.phone.start"})},[t]),u=M.useCallback(()=>{y(null),c(!1),t.send({type:"remote.phone.cancel"})},[t]),p=M.useCallback((x,j)=>{v(null),t.send({type:"remote.device.rename",deviceId:x,label:j})},[t]),m=M.useCallback(x=>{v(null),t.send({type:"remote.device.revoke",deviceId:x})},[t]),f=M.useCallback(()=>v(null),[]);return{status:e,pairing:a,phonePairing:k,phoneStarted:i,problem:g,setEnabled:h,setPort:b,startPairing:E,cancelPairing:N,startPhonePairing:_,cancelPhonePairing:u,renameDevice:p,revokeDevice:m,dismissProblem:f}}const kT="USER";function CT(t,e){const s=t.sshUser.length>0?t.sshUser:kT,a=/\s/.test(s)?`"${s}@${e}"`:`${s}@${e}`;return`ssh -N -L ${t.port}:127.0.0.1:${t.port} ${a}`}function zv(t){return`http://localhost:${t}`}function ST(t,e){return`${zv(t)}/?${ky}=${e}`}function ym(t){return t[0]??"localhost"}function oh(t,e){switch(t){case"off":return w("remote.state.off");case"active":return w("remote.state.active",{port:e});case"restart-needed":return w("remote.state.restartNeeded");case"port-busy":return w("remote.state.portBusy",{port:e})}}function xT(t){const e=t.trim();if(!/^\d{1,5}$/.test(e))return null;const s=Number(e);return Sy(s)?s:null}function ET(){return w("remote.portInvalid",{min:ig,max:og})}function bm(t,e){return Math.max(0,Math.ceil((t-e)/1e3))}function km(t){return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}function TT(t,e=Date.now()){return t.connected?w("remote.device.connected"):t.lastSeenAt===null?w("remote.device.never"):w("remote.device.lastSeen",{when:$n(t.lastSeenAt,e)})}function LT(t,e=Date.now()){return w("remote.device.paired",{when:$n(t.createdAt,e)})}function NT(t){switch(t){case"powershell-admin":return w("remote.phone.authorize.admin");case"powershell":return w("remote.phone.authorize.powershell");case"terminal":return w("remote.phone.authorize.terminal")}}function RT(){return[{platform:"win32",label:"Windows",hint:w("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:w("remote.ssh.macos"),command:null},{platform:"linux",label:"Linux",hint:w("remote.ssh.linux"),command:["sudo apt install openssh-server","sudo systemctl enable --now ssh"].join(`
|
|
152
|
-
`)}]}function MT(t){return t==="win32"||t==="darwin"?t:"linux"}function Ja(t){return t!==null&&t.state==="active"}function Cm(t){return t!==null&&t.state==="active"&&t.devices.length>0}const Ii=function(t,e){let d=t;const k=bo[e];let y=null,i=0,c=null;const g=[],v={},h=function(R,S){i=d*4+17,y=(function(L){const I=new Array(L);for(let B=0;B<L;B+=1){I[B]=new Array(L);for(let F=0;F<L;F+=1)I[B][F]=null}return I})(i),b(0,0),b(i-7,0),b(0,i-7),_(),N(),p(R,S),d>=7&&u(R),c==null&&(c=x(d,k,g)),m(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)},E=function(){let R=0,S=0;for(let L=0;L<8;L+=1){h(!0,L);const I=os.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)},_=function(){const R=os.getPatternPosition(d);for(let S=0;S<R.length;S+=1)for(let L=0;L<R.length;L+=1){const I=R[S],B=R[L];if(y[I][B]==null)for(let F=-2;F<=2;F+=1)for(let D=-2;D<=2;D+=1)F==-2||F==2||D==-2||D==2||F==0&&D==0?y[I+F][B+D]=!0:y[I+F][B+D]=!1}},u=function(R){const S=os.getBCHTypeNumber(d);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}},p=function(R,S){const L=k<<3|S,I=os.getBCHTypeInfo(L);for(let B=0;B<15;B+=1){const F=!R&&(I>>B&1)==1;B<6?y[B][8]=F:B<8?y[B+1][8]=F:y[i-15+B][8]=F}for(let B=0;B<15;B+=1){const F=!R&&(I>>B&1)==1;B<8?y[8][i-B-1]=F:B<9?y[8][15-B-1+1]=F:y[8][15-B-1]=F}y[i-8][8]=!R},m=function(R,S){let L=-1,I=i-1,B=7,F=0;const D=os.getMaskFunction(S);for(let H=i-1;H>0;H-=2)for(H==6&&(H-=1);;){for(let W=0;W<2;W+=1)if(y[I][H-W]==null){let G=!1;F<R.length&&(G=(R[F]>>>B&1)==1),D(I,H-W)&&(G=!G),y[I][H-W]=G,B-=1,B==-1&&(F+=1,B=7)}if(I+=L,I<0||i<=I){I-=L,L=-L;break}}},f=function(R,S){let L=0,I=0,B=0;const F=new Array(S.length),D=new Array(S.length);for(let Y=0;Y<S.length;Y+=1){const z=S[Y].dataCount,P=S[Y].totalCount-z;I=Math.max(I,z),B=Math.max(B,P),F[Y]=new Array(z);for(let te=0;te<F[Y].length;te+=1)F[Y][te]=255&R.getBuffer()[te+L];L+=z;const U=os.getErrorCorrectPolynomial(P),K=No(F[Y],U.getLength()-1).mod(U);D[Y]=new Array(U.getLength()-1);for(let te=0;te<D[Y].length;te+=1){const oe=te+K.getLength()-D[Y].length;D[Y][te]=oe>=0?K.getAt(oe):0}}let H=0;for(let Y=0;Y<S.length;Y+=1)H+=S[Y].totalCount;const W=new Array(H);let G=0;for(let Y=0;Y<I;Y+=1)for(let z=0;z<S.length;z+=1)Y<F[z].length&&(W[G]=F[z][Y],G+=1);for(let Y=0;Y<B;Y+=1)for(let z=0;z<S.length;z+=1)Y<D[z].length&&(W[G]=D[z][Y],G+=1);return W},x=function(R,S,L){const I=Sm.getRSBlocks(R,S),B=xm();for(let D=0;D<L.length;D+=1){const H=L[D];B.put(H.getMode(),4),B.put(H.getLength(),os.getLengthInBits(H.getMode(),R)),H.write(B)}let F=0;for(let D=0;D<I.length;D+=1)F+=I[D].dataCount;if(B.getLengthInBits()>F*8)throw"code length overflow. ("+B.getLengthInBits()+">"+F*8+")";for(B.getLengthInBits()+4<=F*8&&B.put(0,4);B.getLengthInBits()%8!=0;)B.putBit(!1);for(;!(B.getLengthInBits()>=F*8||(B.put(236,8),B.getLengthInBits()>=F*8));)B.put(17,8);return f(B,I)};v.addData=function(R,S){S=S||"Byte";let L=null;switch(S){case"Numeric":L=AT(R);break;case"Alphanumeric":L=IT(R);break;case"Byte":L=jT(R);break;case"Kanji":L=DT(R);break;default:throw"mode:"+S}g.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(d<1){let R=1;for(;R<40;R++){const S=Sm.getRSBlocks(R,k),L=xm();for(let B=0;B<g.length;B++){const F=g[B];L.put(F.getMode(),4),L.put(F.getLength(),os.getLengthInBits(F.getMode(),R)),F.write(L)}let I=0;for(let B=0;B<S.length;B++)I+=S[B].dataCount;if(L.getLengthInBits()<=I*8)break}d=R}h(!1,E())},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 B=0;B<v.getModuleCount();B+=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,B)?"#000000":"#ffffff",L+=";",L+='"/>';L+="</tr>"}return L+="</tbody>",L+="</table>",L},v.createSvgTag=function(R,S,L,I){let B={};typeof arguments[0]=="object"&&(B=arguments[0],R=B.cellSize,S=B.margin,L=B.alt,I=B.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 F=v.getModuleCount()*R+S*2;let D,H,W,G,Y="",z;for(z="l"+R+",0 0,"+R+" -"+R+",0 0,-"+R+"z ",Y+='<svg version="1.1" xmlns="http://www.w3.org/2000/svg"',Y+=B.scalable?"":' width="'+F+'px" height="'+F+'px"',Y+=' viewBox="0 0 '+F+" "+F+'" ',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(G=W*R+S,D=0;D<v.getModuleCount();D+=1)v.isDark(W,D)&&(H=D*R+S,Y+="M"+H+","+G+z);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,B=L-S;return FT(L,L,function(F,D){if(I<=F&&F<B&&I<=D&&D<B){const H=Math.floor((F-I)/R),W=Math.floor((D-I)/R);return v.isDark(W,H)?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 B="";return B+="<img",B+=' src="',B+=v.createDataURL(R,S),B+='"',B+=' width="',B+=I,B+='"',B+=' height="',B+=I,B+='"',L&&(B+=' alt="',B+=j(L),B+='"'),B+="/>",B};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},T=function(R){R=typeof R>"u"?2:R;const L=v.getModuleCount()*1+R*2,I=R,B=L-R;let F,D,H,W,G;const Y={"██":"█","█ ":"▀"," █":"▄"," ":" "},z={"██":"▀","█ ":"▀"," █":" "," ":" "};let P="";for(F=0;F<L;F+=2){for(H=Math.floor((F-I)/1),W=Math.floor((F+1-I)/1),D=0;D<L;D+=1)G="█",I<=D&&D<B&&I<=F&&F<B&&v.isDark(H,Math.floor((D-I)/1))&&(G=" "),I<=D&&D<B&&I<=F+1&&F+1<B&&v.isDark(W,Math.floor((D-I)/1))?G+=" ":G+="█",P+=R<1&&F+1>=B?z[G]:Y[G];P+=`
|
|
153
|
-
`}return L%2&&R>0?P.substring(0,P.length-L-1)+Array(L+1).join("▀"):P.substring(0,P.length-1)};return v.createASCII=function(R,S){if(R=R||1,R<2)return T(S);R-=1,S=typeof S>"u"?R*2:S;const L=v.getModuleCount()*R+S*2,I=S,B=L-S;let F,D,H,W;const G=Array(R+1).join("██"),Y=Array(R+1).join(" ");let z="",P="";for(F=0;F<L;F+=1){for(H=Math.floor((F-I)/R),P="",D=0;D<L;D+=1)W=1,I<=D&&D<B&&I<=F&&F<B&&v.isDark(H,Math.floor((D-I)/R))&&(W=0),P+=W?G:Y;for(H=0;H<R;H+=1)z+=P+`
|
|
154
|
-
`}return z.substring(0,z.length-1)},v.renderTo2dContext=function(R,S){S=S||2;const L=v.getModuleCount();for(let I=0;I<L;I++)for(let B=0;B<L;B++)R.fillStyle=v.isDark(I,B)?"black":"white",R.fillRect(B*S,I*S,S,S)},v};Ii.stringToBytes=function(t){const e=[];for(let s=0;s<t.length;s+=1){const a=t.charCodeAt(s);e.push(a&255)}return e};Ii.createStringToBytes=function(t,e){const s=(function(){const d=OT(t),k=function(){const c=d.read();if(c==-1)throw"eof";return c};let y=0;const i={};for(;;){const c=d.read();if(c==-1)break;const g=k(),v=k(),h=k(),b=String.fromCharCode(c<<8|g),E=v<<8|h;i[b]=E,y+=1}if(y!=e)throw y+" != "+e;return i})(),a=63;return function(d){const k=[];for(let y=0;y<d.length;y+=1){const i=d.charCodeAt(y);if(i<128)k.push(i);else{const c=s[d.charAt(y)];typeof c=="number"?(c&255)==c?k.push(c):(k.push(c>>>8),k.push(c&255)):k.push(a)}}return k}};const fn={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},bo={L:1,M:0,Q:3,H:2},is={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},os=(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,a=21522,d={},k=function(y){let i=0;for(;y!=0;)i+=1,y>>>=1;return i};return d.getBCHTypeInfo=function(y){let i=y<<10;for(;k(i)-k(e)>=0;)i^=e<<k(i)-k(e);return(y<<10|i)^a},d.getBCHTypeNumber=function(y){let i=y<<12;for(;k(i)-k(s)>=0;)i^=s<<k(i)-k(s);return y<<12|i},d.getPatternPosition=function(y){return t[y-1]},d.getMaskFunction=function(y){switch(y){case is.PATTERN000:return function(i,c){return(i+c)%2==0};case is.PATTERN001:return function(i,c){return i%2==0};case is.PATTERN010:return function(i,c){return c%3==0};case is.PATTERN011:return function(i,c){return(i+c)%3==0};case is.PATTERN100:return function(i,c){return(Math.floor(i/2)+Math.floor(c/3))%2==0};case is.PATTERN101:return function(i,c){return i*c%2+i*c%3==0};case is.PATTERN110:return function(i,c){return(i*c%2+i*c%3)%2==0};case is.PATTERN111:return function(i,c){return(i*c%3+(i+c)%2)%2==0};default:throw"bad maskPattern:"+y}},d.getErrorCorrectPolynomial=function(y){let i=No([1],0);for(let c=0;c<y;c+=1)i=i.multiply(No([1,ls.gexp(c)],0));return i},d.getLengthInBits=function(y,i){if(1<=i&&i<10)switch(y){case fn.MODE_NUMBER:return 10;case fn.MODE_ALPHA_NUM:return 9;case fn.MODE_8BIT_BYTE:return 8;case fn.MODE_KANJI:return 8;default:throw"mode:"+y}else if(i<27)switch(y){case fn.MODE_NUMBER:return 12;case fn.MODE_ALPHA_NUM:return 11;case fn.MODE_8BIT_BYTE:return 16;case fn.MODE_KANJI:return 10;default:throw"mode:"+y}else if(i<41)switch(y){case fn.MODE_NUMBER:return 14;case fn.MODE_ALPHA_NUM:return 13;case fn.MODE_8BIT_BYTE:return 16;case fn.MODE_KANJI:return 12;default:throw"mode:"+y}else throw"type:"+i},d.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 E=0;const N=y.isDark(h,b);for(let _=-1;_<=1;_+=1)if(!(h+_<0||i<=h+_))for(let u=-1;u<=1;u+=1)b+u<0||i<=b+u||_==0&&u==0||N==y.isDark(h+_,b+u)&&(E+=1);E>5&&(c+=3+E-5)}for(let h=0;h<i-1;h+=1)for(let b=0;b<i-1;b+=1){let E=0;y.isDark(h,b)&&(E+=1),y.isDark(h+1,b)&&(E+=1),y.isDark(h,b+1)&&(E+=1),y.isDark(h+1,b+1)&&(E+=1),(E==0||E==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 g=0;for(let h=0;h<i;h+=1)for(let b=0;b<i;b+=1)y.isDark(b,h)&&(g+=1);const v=Math.abs(100*g/i/i-50)/5;return c+=v*10,c},d})(),ls=(function(){const t=new Array(256),e=new Array(256);for(let a=0;a<8;a+=1)t[a]=1<<a;for(let a=8;a<256;a+=1)t[a]=t[a-4]^t[a-5]^t[a-6]^t[a-8];for(let a=0;a<255;a+=1)e[t[a]]=a;const s={};return s.glog=function(a){if(a<1)throw"glog("+a+")";return e[a]},s.gexp=function(a){for(;a<0;)a+=255;for(;a>=256;)a-=255;return t[a]},s})(),No=function(t,e){if(typeof t.length>"u")throw t.length+"/"+e;const s=(function(){let d=0;for(;d<t.length&&t[d]==0;)d+=1;const k=new Array(t.length-d+e);for(let y=0;y<t.length-d;y+=1)k[y]=t[y+d];return k})(),a={};return a.getAt=function(d){return s[d]},a.getLength=function(){return s.length},a.multiply=function(d){const k=new Array(a.getLength()+d.getLength()-1);for(let y=0;y<a.getLength();y+=1)for(let i=0;i<d.getLength();i+=1)k[y+i]^=ls.gexp(ls.glog(a.getAt(y))+ls.glog(d.getAt(i)));return No(k,0)},a.mod=function(d){if(a.getLength()-d.getLength()<0)return a;const k=ls.glog(a.getAt(0))-ls.glog(d.getAt(0)),y=new Array(a.getLength());for(let i=0;i<a.getLength();i+=1)y[i]=a.getAt(i);for(let i=0;i<d.getLength();i+=1)y[i]^=ls.gexp(ls.glog(d.getAt(i))+k);return No(y,0).mod(d)},a},Sm=(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(d,k){const y={};return y.totalCount=d,y.dataCount=k,y},s={},a=function(d,k){switch(k){case bo.L:return t[(d-1)*4+0];case bo.M:return t[(d-1)*4+1];case bo.Q:return t[(d-1)*4+2];case bo.H:return t[(d-1)*4+3];default:return}};return s.getRSBlocks=function(d,k){const y=a(d,k);if(typeof y>"u")throw"bad rs block @ typeNumber:"+d+"/errorCorrectionLevel:"+k;const i=y.length/3,c=[];for(let g=0;g<i;g+=1){const v=y[g*3+0],h=y[g*3+1],b=y[g*3+2];for(let E=0;E<v;E+=1)c.push(e(h,b))}return c},s})(),xm=function(){const t=[];let e=0;const s={};return s.getBuffer=function(){return t},s.getAt=function(a){const d=Math.floor(a/8);return(t[d]>>>7-a%8&1)==1},s.put=function(a,d){for(let k=0;k<d;k+=1)s.putBit((a>>>d-k-1&1)==1)},s.getLengthInBits=function(){return e},s.putBit=function(a){const d=Math.floor(e/8);t.length<=d&&t.push(0),a&&(t[d]|=128>>>e%8),e+=1},s},AT=function(t){const e=fn.MODE_NUMBER,s=t,a={};a.getMode=function(){return e},a.getLength=function(y){return s.length},a.write=function(y){const i=s;let c=0;for(;c+2<i.length;)y.put(d(i.substring(c,c+3)),10),c+=3;c<i.length&&(i.length-c==1?y.put(d(i.substring(c,c+1)),4):i.length-c==2&&y.put(d(i.substring(c,c+2)),7))};const d=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 a},IT=function(t){const e=fn.MODE_ALPHA_NUM,s=t,a={};a.getMode=function(){return e},a.getLength=function(k){return s.length},a.write=function(k){const y=s;let i=0;for(;i+1<y.length;)k.put(d(y.charAt(i))*45+d(y.charAt(i+1)),11),i+=2;i<y.length&&k.put(d(y.charAt(i)),6)};const d=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 a},jT=function(t){const e=fn.MODE_8BIT_BYTE,s=Ii.stringToBytes(t),a={};return a.getMode=function(){return e},a.getLength=function(d){return s.length},a.write=function(d){for(let k=0;k<s.length;k+=1)d.put(s[k],8)},a},DT=function(t){const e=fn.MODE_KANJI,s=Ii.stringToBytes;(function(k,y){const i=s(k);if(i.length!=2||(i[0]<<8|i[1])!=y)throw"sjis not supported."})("友",38726);const a=s(t),d={};return d.getMode=function(){return e},d.getLength=function(k){return~~(a.length/2)},d.write=function(k){const y=a;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)},d},qv=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,a,d){a=a||0,d=d||s.length;for(let k=0;k<d;k+=1)e.writeByte(s[k+a])},e.writeString=function(s){for(let a=0;a<s.length;a+=1)e.writeByte(s.charCodeAt(a))},e.toByteArray=function(){return t},e.toString=function(){let s="";s+="[";for(let a=0;a<t.length;a+=1)a>0&&(s+=","),s+=t[a];return s+="]",s},e},PT=function(){let t=0,e=0,s=0,a="";const d={},k=function(i){a+=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 d.writeByte=function(i){for(t=t<<8|i&255,e+=8,s+=1;e>=6;)k(t>>>e-6),e-=6},d.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)a+="="}},d.toString=function(){return a},d},OT=function(t){const e=t;let s=0,a=0,d=0;const k={};k.read=function(){for(;d<8;){if(s>=e.length){if(d==0)return-1;throw"unexpected end of file./"+d}const c=e.charAt(s);if(s+=1,c=="=")return d=0,-1;if(c.match(/^\s$/))continue;a=a<<6|y(c.charCodeAt(0)),d+=6}const i=a>>>d-8&255;return d-=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},BT=function(t,e){const s=t,a=e,d=new Array(t*e),k={};k.setPixel=function(g,v,h){d[v*s+g]=h},k.write=function(g){g.writeString("GIF87a"),g.writeShort(s),g.writeShort(a),g.writeByte(128),g.writeByte(0),g.writeByte(0),g.writeByte(0),g.writeByte(0),g.writeByte(0),g.writeByte(255),g.writeByte(255),g.writeByte(255),g.writeString(","),g.writeShort(0),g.writeShort(0),g.writeShort(s),g.writeShort(a),g.writeByte(0);const v=2,h=i(v);g.writeByte(v);let b=0;for(;h.length-b>255;)g.writeByte(255),g.writeBytes(h,b,255),b+=255;g.writeByte(h.length-b),g.writeBytes(h,b,h.length-b),g.writeByte(0),g.writeString(";")};const y=function(g){const v=g;let h=0,b=0;const E={};return E.write=function(N,_){if(N>>>_)throw"length over";for(;h+_>=8;)v.writeByte(255&(N<<h|b)),_-=8-h,N>>>=8-h,b=0,h=0;b=N<<h|b,h=h+_},E.flush=function(){h>0&&v.writeByte(b)},E},i=function(g){const v=1<<g,h=(1<<g)+1;let b=g+1;const E=c();for(let m=0;m<v;m+=1)E.add(String.fromCharCode(m));E.add(String.fromCharCode(v)),E.add(String.fromCharCode(h));const N=qv(),_=y(N);_.write(v,b);let u=0,p=String.fromCharCode(d[u]);for(u+=1;u<d.length;){const m=String.fromCharCode(d[u]);u+=1,E.contains(p+m)?p=p+m:(_.write(E.indexOf(p),b),E.size()<4095&&(E.size()==1<<b&&(b+=1),E.add(p+m)),p=m)}return _.write(E.indexOf(p),b),_.write(h,b),_.flush(),N.toByteArray()},c=function(){const g={};let v=0;const h={};return h.add=function(b){if(h.contains(b))throw"dup key:"+b;g[b]=v,v+=1},h.size=function(){return v},h.indexOf=function(b){return g[b]},h.contains=function(b){return typeof g[b]<"u"},h};return k},FT=function(t,e,s){const a=BT(t,e);for(let i=0;i<e;i+=1)for(let c=0;c<t;c+=1)a.setPixel(c,i,s(c,i));const d=qv();a.write(d);const k=PT(),y=d.toByteArray();for(let i=0;i<y.length;i+=1)k.writeByte(y[i]);return k.flush(),"data:image/gif;base64,"+k};Ii.stringToBytes;const wo=4;function HT(t){const e=Ii(0,"M");e.addData(t,"Byte"),e.make();const s=e.getModuleCount();let a="";for(let d=0;d<s;d++){let k=0;for(;k<s;){if(!e.isDark(d,k)){k++;continue}const y=k;for(;k<s&&e.isDark(d,k);)k++;a+=`M${y} ${d}h${k-y}v1h-${k-y}z`}}return{size:s,path:a}}const UT=1e3,$T=4e3;function WT({status:t,pairing:e,phonePairing:s,phoneStarted:a,problem:d,platform:k,onSetEnabled:y,onSetPort:i,onStartPairing:c,onCancelPairing:g,onStartPhonePairing:v,onCancelPhonePairing:h,onRenameDevice:b,onRevokeDevice:E,onDismissProblem:N,onClose:_}){const[u,p]=M.useState(()=>ym(t.hostNames)),[m,f]=M.useState(String(t.port)),[x,j]=M.useState(null),T=M.useRef(null),[R,S]=M.useState(()=>Date.now()),L=()=>{e!==null&&g(),a&&h(),_()},I=M.useRef(L);I.current=L,M.useEffect(()=>{const P=U=>{U.key==="Escape"&&(U.preventDefault(),U.stopPropagation(),I.current())};return window.addEventListener("keydown",P,!0),()=>window.removeEventListener("keydown",P,!0)},[]),M.useEffect(()=>{if(e===null&&s===null)return;S(Date.now());const P=window.setInterval(()=>S(Date.now()),1e3);return()=>window.clearInterval(P)},[e,s]),M.useEffect(()=>()=>{T.current!==null&&window.clearTimeout(T.current)},[]);const B=M.useRef(null),F=s!==null;M.useEffect(()=>{var U;if(!F)return;const P=window.matchMedia("(prefers-reduced-motion: reduce)").matches;(U=B.current)==null||U.scrollIntoView({block:"center",behavior:P?"auto":"smooth"})},[F]),M.useEffect(()=>{f(String(t.port))},[t.port]),M.useEffect(()=>{t.hostNames.includes(u)||p(ym(t.hostNames))},[t.hostNames,u]);const D=(P,U)=>{navigator.clipboard.writeText(U).then(()=>{j(P),T.current!==null&&window.clearTimeout(T.current),T.current=window.setTimeout(()=>j(null),UT)}).catch(()=>j(null))},H=xT(m),W=H!==null&&H!==t.port,G=CT(t,u),Y=w("remote.title"),z=e===null?null:ST(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:P=>P.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:w("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:oh(t.state,t.port)}),o.jsx("p",{className:"modal-hint",children:w("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:w("remote.turnOff")}),o.jsx("span",{className:"modal-hint",children:w("remote.turnOffHint")})]}):o.jsx("button",{className:"primary-button",onClick:()=>y(!0),children:w("remote.turnOn")})}),o.jsxs("div",{className:"remote-port",children:[o.jsx("label",{className:"modal-hint",htmlFor:"remote-port-input",children:w("remote.port")}),o.jsx("input",{id:"remote-port-input",className:"remote-port-input",inputMode:"numeric",value:m,onChange:P=>f(P.target.value),onKeyDown:P=>{P.key==="Enter"&&W&&H!==null&&i(H)}}),o.jsx("button",{className:"link-button",onClick:()=>H!==null&&i(H),disabled:!W,children:w("remote.portSave")}),H===null&&o.jsx("span",{className:"modal-hint remote-port-invalid",children:ET()})]}),o.jsx("p",{className:"modal-hint",children:w("remote.restartHint")}),d!==null&&o.jsxs("div",{className:"vault-problem",role:"alert",children:[o.jsx("span",{children:d}),o.jsx("button",{className:"icon-button",onClick:N,title:w("common.close"),children:"×"})]}),o.jsx("h3",{className:"modal-section",children:w("remote.step.host")}),o.jsx("p",{className:"modal-hint",children:w("remote.step.hostHint")}),RT().map(P=>o.jsxs("details",{className:"remote-os",open:P.platform===MT(k),children:[o.jsx("summary",{className:"remote-os-summary",children:P.label}),o.jsx("p",{className:"modal-hint",children:P.hint}),P.command!==null&&o.jsxs("div",{className:"status-line-fragment",children:[o.jsx("pre",{className:"tool-pre",children:P.command}),o.jsx("button",{className:"link-button",onClick:()=>D("ssh",P.command??""),children:x==="ssh"?o.jsxs(o.Fragment,{children:["✓ ",w("remote.copied")]}):w("remote.copy")})]})]},P.platform)),o.jsx("h3",{className:"modal-section",children:w("remote.step.tunnel")}),o.jsx("p",{className:"modal-hint",children:w("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:w("remote.address")}),o.jsx("select",{id:"remote-host-select",className:"remote-host-select",value:u,onChange:P=>p(P.target.value),children:t.hostNames.map(P=>o.jsx("option",{value:P,children:P},P))})]}),o.jsxs("div",{className:"status-line-fragment",children:[o.jsx("pre",{className:"tool-pre",children:G}),o.jsx("button",{className:"link-button",onClick:()=>D("command",G),children:x==="command"?o.jsxs(o.Fragment,{children:["✓ ",w("remote.copied")]}):w("remote.copy")})]}),o.jsxs("details",{className:"remote-os",children:[o.jsx("summary",{className:"remote-os-summary",children:w("remote.trouble")}),o.jsxs("ul",{className:"remote-trouble",children:[o.jsx("li",{className:"modal-hint",children:w("remote.trouble.network")}),o.jsx("li",{className:"modal-hint",children:w("remote.vpnHint")}),t.sshUser.length>0&&o.jsx("li",{className:"modal-hint",children:w("remote.userHint",{user:t.sshUser})})]})]}),o.jsx("h3",{className:"modal-section",children:w("remote.step.pair")}),e===null||z===null?o.jsxs("div",{className:"vault-actions",children:[o.jsx("button",{className:"primary-button",onClick:c,disabled:!Ja(t),children:w("remote.pair.start")}),!Ja(t)&&o.jsx("span",{className:"modal-hint",children:w("remote.pair.needsActive")})]}):o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"modal-hint",children:w("remote.pair.open")}),o.jsxs("div",{className:"status-line-fragment",children:[o.jsx("pre",{className:"tool-pre",children:z}),o.jsx("button",{className:"link-button",onClick:()=>D("pairing",z),children:x==="pairing"?o.jsxs(o.Fragment,{children:["✓ ",w("remote.copied")]}):w("remote.copy")})]}),o.jsxs("p",{className:"modal-hint",children:[w("remote.pair.expires",{time:km(bm(e.expiresAt,R))})," ",w("remote.pair.after",{url:zv(t.port)})]}),o.jsx("div",{className:"vault-actions",children:o.jsx("button",{className:"link-button",onClick:g,children:w("remote.pair.cancel")})})]}),o.jsx("h3",{className:"modal-section",children:w("remote.phone.title")}),s===null?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"modal-hint",children:w("remote.phone.hint")}),o.jsxs("div",{className:"vault-actions",children:[o.jsx("button",{className:"primary-button",onClick:v,disabled:!Ja(t),children:w("remote.phone.start")}),!Ja(t)&&o.jsx("span",{className:"modal-hint",children:w("remote.pair.needsActive")})]})]}):o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"modal-hint",children:NT(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:()=>D("phone",s.authorizeCommand),children:x==="phone"?o.jsxs(o.Fragment,{children:["✓ ",w("remote.copied")]}):w("remote.copy")})]}),o.jsx("p",{className:"modal-hint",children:w("remote.phone.authorizeOnce")}),o.jsx("p",{className:"modal-hint",children:w("remote.phone.scan")}),o.jsx("div",{ref:B,children:o.jsx(zT,{payload:s.payload})}),o.jsx("p",{className:"modal-hint",children:w("remote.phone.secret")}),o.jsx("p",{className:"modal-hint",children:w("remote.pair.expires",{time:km(bm(s.expiresAt,R))})}),o.jsx("div",{className:"vault-actions",children:o.jsx("button",{className:"link-button",onClick:h,children:w("remote.pair.cancel")})})]}),o.jsx("h3",{className:"modal-section",children:w("remote.devices")}),t.devices.length===0?o.jsx("p",{className:"modal-hint",children:w("remote.devices.empty")}):o.jsx("ul",{className:"remote-devices",children:t.devices.map(P=>o.jsx(qT,{device:P,onRename:U=>b(P.id,U),onRevoke:()=>E(P.id)},P.id))})]})]})})}function zT({payload:t}){const e=HT(t),s=e.size+wo*2;return o.jsxs("svg",{className:"remote-phone-qr",viewBox:`${-wo} ${-wo} ${s} ${s}`,role:"img","aria-label":w("remote.phone.qrLabel"),shapeRendering:"crispEdges",children:[o.jsx("rect",{x:-wo,y:-wo,width:s,height:s,fill:"#fff"}),o.jsx("path",{d:e.path,fill:"#000"})]})}function qT({device:t,onRename:e,onRevoke:s}){const[a,d]=M.useState(!1),[k,y]=M.useState(t.label),[i,c]=M.useState(!1),g=M.useRef(null);M.useEffect(()=>()=>{g.current!==null&&window.clearTimeout(g.current)},[]);const v=()=>{d(!1);const b=k.trim();b.length>0&&b!==t.label&&e(b)},h=()=>{if(i){s();return}c(!0),g.current=window.setTimeout(()=>c(!1),$T)};return o.jsxs("li",{className:"remote-device",children:[o.jsxs("div",{className:"remote-device-main",children:[a?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),d(!0)},title:w("remote.device.rename"),children:t.label}),o.jsx("span",{className:`remote-device-seen${t.connected?" remote-device-connected":""}`,children:TT(t)}),o.jsx("span",{className:"remote-device-paired",children:LT(t)})]}),o.jsx("button",{className:`link-button${i?" remote-device-confirm":""}`,onClick:h,children:w(i?"remote.device.revokeConfirm":"remote.device.revoke")})]})}const Au="agent-workbench.notes-open",Em="agent-workbench.notes-active",Tm="agent-workbench.notes-height",Iu=160,VT=300;function KT(t){return t.text.trim().length===0?t.images.length>0?w("notes.imageOnly"):w("notes.untitled"):sy(t)}function GT({notes:t,onSendNote:e,sendTargetCwd:s,fill:a,onHide:d}){const[k,y]=M.useState(()=>Nt(Au,!1,W=>W==="true")),i=k||a,[c,g]=M.useState(()=>Nt(Tm,VT,W=>{const G=Number.parseInt(W,10);return Number.isFinite(G)?Math.max(G,Iu):null})),[v,h]=M.useState(()=>Nt(Em,null,W=>W)),[b,E]=M.useState(null),[N,_]=M.useState(null),[u,p]=M.useState(0),m=vT(),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]),x=M.useCallback(W=>{h(W),yt(Em,W),E(null)},[]),j=M.useCallback(()=>{y(W=>{const G=!W;return yt(Au,String(G)),G})},[]),T=M.useCallback(()=>{const W=t.create();x(W),i||(y(!0),yt(Au,"true")),p(G=>G+1)},[t,i,x]),R=M.useCallback(W=>{if(W.text.trim().length===0&&W.images.length===0){t.remove(W.noteId);return}x(W.noteId),E(W.noteId)},[t,x]),S=M.useCallback(()=>{b!==null&&t.remove(b),E(null)},[b,t]),L=M.useRef(null),I=M.useCallback(W=>{const G=W.currentTarget.parentElement,Y=G===null?c:Math.round(G.getBoundingClientRect().height);L.current={startY:W.clientY,startHeight:Y},W.currentTarget.setPointerCapture(W.pointerId),W.preventDefault()},[c]),B=M.useCallback(W=>{const G=L.current;if(G===null)return;const Y=Math.max(Iu,Math.floor(window.innerHeight*.8));g(Math.min(Y,Math.max(Iu,G.startHeight+G.startY-W.clientY)))},[]),F=M.useCallback(W=>{L.current!==null&&(L.current=null,W.currentTarget.releasePointerCapture(W.pointerId),yt(Tm,String(c)))},[c]);M.useEffect(()=>{if(N===null)return;const W=G=>{G.key==="Escape"&&(G.stopPropagation(),_(null))};return window.addEventListener("keydown",W,!0),()=>window.removeEventListener("keydown",W,!0)},[N]);const D=N===null?void 0:t.images[N],H=t.notes.length;return o.jsxs("section",{className:`notes${i?" notes-open":""}${a?" notes-fill":""}`,style:i&&!a?{height:`${c}px`}:void 0,children:[i&&!a&&o.jsx("div",{className:"notes-resize",onPointerDown:I,onPointerMove:B,onPointerUp:F,onPointerCancel:F,title:w("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 G=W.noteId===(f==null?void 0:f.noteId),Y=KT(W);return o.jsxs("div",{className:`strip-tab${G?" is-active":""}`,role:"tab","aria-selected":G,children:[o.jsx("button",{className:"strip-tab-label",onClick:()=>x(W.noteId),title:Y,children:Y}),o.jsx("button",{className:"strip-tab-close",onClick:()=>R(W),title:w("notes.closeNote"),children:"×"})]},W.noteId)}),o.jsx("button",{className:"strip-tab-new",onClick:T,title:w("notes.new"),children:"+"})]}),o.jsx("span",{className:"strip-spacer"}),o.jsx("button",{className:"icon-button thread-font-button",onClick:m.cycle,title:ll(m.size),"aria-label":ll(m.size),children:o.jsxs("span",{"aria-hidden":"true",children:["a",o.jsx("span",{className:"thread-font-big",children:"A"})]})}),!a&&o.jsx("button",{className:"icon-button",onClick:j,title:w("notes.collapse"),children:"▾"}),d!==void 0&&o.jsx(ol,{title:w("settings.hide.notes"),onHide:d,confirmText:null})]}),o.jsx("div",{className:"notes-body",children:H===0||f===null?o.jsx("p",{className:"notes-empty",children:on("notes.empty")}):o.jsx(QT,{note:f,notes:t,closing:b===f.noteId,focusRequest:u,onConfirmClose:S,onCancelClose:()=>E(null),onOpenImage:_,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:w("notes.expand"),children:[o.jsx("span",{className:"strip-collapsed-arrow",children:"▸"}),o.jsx("span",{children:w("notes.name")}),H>0&&o.jsx("span",{className:"strip-collapsed-count",children:H})]}),d!==void 0&&o.jsx(ol,{title:w("settings.hide.notes"),onHide:d,confirmText:null})]}),N!==null&&o.jsx("div",{className:"notes-lightbox",onClick:()=>_(null),title:w("notes.lightboxClose"),children:typeof D=="string"?o.jsx("img",{src:D,alt:w("notes.imageAlt")}):o.jsx("span",{className:"notes-lightbox-missing",children:w("notes.imageUnavailable")})})]})}function YT(){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 XT(){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 QT({note:t,notes:e,closing:s,focusRequest:a,onConfirmClose:d,onCancelClose:k,onOpenImage:y,onSend:i,sendTargetCwd:c}){const g=M.useRef(null),[v,h]=M.useState(!1),b=t.text.trim().length===0&&t.images.length===0;M.useEffect(()=>{var _;a>0&&((_=g.current)==null||_.focus())},[a]);const E=M.useCallback(_=>{const u=Array.from(_).filter(p=>p.type.startsWith("image/"));for(const p of u)e.addImage(t.noteId,p);return u.length>0},[e,t.noteId]),N=M.useCallback(_=>{_.clipboardData!==null&&E(_.clipboardData.files)&&_.preventDefault()},[E]);return o.jsxs("div",{className:`note-editor${v?" note-editor-dragging":""}`,onDragOver:_=>{Array.from(_.dataTransfer.types).includes("Files")&&(_.preventDefault(),h(!0))},onDragLeave:()=>h(!1),onDrop:_=>{_.preventDefault(),h(!1),E(_.dataTransfer.files)},children:[s&&o.jsxs("div",{className:"note-closing",children:[o.jsx("span",{children:w("notes.closeConfirm")}),o.jsx("button",{className:"link-button link-danger",onClick:d,children:w("common.close")}),o.jsx("button",{className:"link-button",onClick:k,children:w("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:w("common.close"),children:"×"})]}),o.jsx("textarea",{ref:g,className:"note-input",value:t.text,placeholder:w("notes.placeholder"),onChange:_=>e.updateText(t.noteId,_.target.value),onPaste:N,spellCheck:!1}),t.images.length>0&&o.jsx("div",{className:"note-images",children:t.images.map(_=>o.jsx(JT,{image:_,src:e.images[_.imageId],onRequest:e.requestImage,onOpen:()=>y(_.imageId),onRemove:()=>e.removeImage(t.noteId,_.imageId)},_.imageId))}),o.jsxs("div",{className:"note-footer",children:[o.jsx("span",{className:"note-meta",children:$n(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:$b(i!==null,c,b),children:o.jsx(XT,{})}),o.jsxs("label",{className:"icon-button note-attach",title:w("notes.attach"),children:[o.jsx(YT,{}),o.jsx("input",{type:"file",accept:"image/png,image/jpeg,image/gif,image/webp",multiple:!0,hidden:!0,onChange:_=>{_.target.files!==null&&E(_.target.files),_.target.value=""}})]})]})]})}function JT({image:t,src:e,onRequest:s,onOpen:a,onRemove:d}){return M.useEffect(()=>{e===void 0&&s(t.imageId)},[e,t.imageId,s]),o.jsxs("figure",{className:"chip chip-image note-thumb",title:_n(t.bytes),children:[typeof e=="string"?o.jsx("img",{src:e,alt:w("notes.imageAlt"),onClick:a}):o.jsx("span",{className:"note-thumb-placeholder",children:e===null?w("notes.thumbMissing"):"…"}),o.jsx("button",{className:"chip-remove",onClick:d,title:w("notes.removeImage"),children:"×"})]})}function Vv(){const t=Mo(),e=eS(),[s,a]=M.useState(null),d=M.useCallback(()=>a(null),[]),k=M.useRef(null),y=g=>{Q1(g).catch(()=>{})},i=[{label:w("header.locale.auto",{name:cu[Y1()]}),checked:e==="auto",onSelect:()=>y("auto")},...mh.map(g=>({label:cu[g],lang:g,checked:e===g,onSelect:()=>y(g)}))],c=cu[t];return o.jsxs(o.Fragment,{children:[o.jsx("button",{ref:k,className:"icon-button locale-button",onClick:g=>{const v=g.currentTarget.getBoundingClientRect();a(h=>h===null?{x:v.left,y:v.bottom+4}:null)},title:e==="auto"?w("header.locale.titleAuto",{name:c}):w("header.locale.title",{name:c}),"aria-haspopup":"menu","aria-expanded":s!==null,children:tb[t]}),s!==null&&o.jsx(Zu,{x:s.x,y:s.y,items:i,onClose:d,anchor:k.current})]})}function ZT({onKey:t}){return o.jsx("div",{className:"narrow-keys",role:"toolbar","aria-label":w("narrow.keys.label"),children:tC.map(e=>o.jsx("button",{className:"narrow-key",onPointerDown:s=>s.preventDefault(),onClick:()=>t(e.data),title:w(e.titleKey),children:e.label},e.id))})}function eL({banners:t,status:e,statusLabel:s,terminals:a,activeTerminalId:d,activity:k,agents:y,offerAgentChoice:i,newTabAgent:c,platform:g,canOpen:v,newTabBlockedTitle:h,onSelectTab:b,onCloseTab:E,onRenameTab:N,onNewTab:_,drawer:u,drawerOpen:p,onDrawerChange:m,menu:f,view:x,views:j,onViewChange:T,badges:R,chat:S,panel:L,notes:I,console:B,onTerminalKey:F}){const[D,H]=M.useState(null),W=a.find(U=>U.terminalId===d)??null,G=U=>{var $;return(($=y.find(K=>K.id===U.agent))==null?void 0:$.statusLine)??null};M.useEffect(()=>{if(!p&&D===null)return;const U=$=>{$.key==="Escape"&&($.preventDefault(),$.stopPropagation(),D!==null?H(null):m(!1))};return window.addEventListener("keydown",U,!0),()=>window.removeEventListener("keydown",U,!0)},[p,D,m]);const Y=M.useRef({sheet:D,drawerOpen:p,view:x,onDrawerChange:m,onViewChange:T});Y.current={sheet:D,drawerOpen:p,view:x,onDrawerChange:m,onViewChange:T},M.useEffect(()=>{const U=window;return U[wp]=()=>{const $=Y.current;switch(oC({dialogOpen:document.querySelector(".modal-backdrop")!==null,sheetOpen:$.sheet!==null,drawerOpen:$.drawerOpen,view:$.view})){case"close-dialog":return window.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:!0,cancelable:!0})),!0;case"close-sheet":return H(null),!0;case"close-drawer":return $.onDrawerChange(!1),!0;case"show-chat":return $.onViewChange("chat"),!0;case null:return!1}},()=>{delete U[wp]}},[]);const z=M.useRef(null);M.useEffect(()=>{var U;(U=z.current)==null||U.scrollIntoView({block:"nearest",inline:"nearest"})},[x]);const P=U=>{const $=U==="git"?R.changes:U==="plans"?R.plans:U==="memory"?R.memory:0;return $>0?o.jsx("span",{className:"side-panel-badge",children:$}):U==="cli"&&R.cliUnseen&&x!=="cli"?o.jsx("span",{className:"narrow-view-dot",title:w("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:()=>m(!0),title:w("narrow.projects"),"aria-label":w("narrow.projects"),children:"☰"}),o.jsxs("button",{className:"narrow-current",onClick:()=>H("tabs"),title:w("narrow.tabs.open"),children:[W===null?o.jsx("span",{className:"app-name",children:"Agent Workbench"}):o.jsxs(o.Fragment,{children:[o.jsx(Sh,{terminal:W,activity:k.get(W.terminalId),statusLine:G(W)}),o.jsx("span",{className:"project-swatch",style:{background:Hs(Bs(W))}}),o.jsx("span",{className:"narrow-current-label",children:To(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:()=>H("menu"),title:w("narrow.more"),"aria-label":w("narrow.more"),children:"⋮"})]}),t,o.jsxs("div",{className:"narrow-body",children:[o.jsx("nav",{className:"narrow-views",role:"tablist",children:j.map(U=>o.jsxs("button",{ref:U===x?z:null,role:"tab","aria-selected":U===x,className:`narrow-view-tab${U===x?" narrow-view-active":""}`,onClick:()=>T(U),children:[o.jsx("span",{children:w(Qk(U))}),P(U)]},U))}),o.jsxs("div",{className:"narrow-stack",children:[o.jsx("main",{className:`workspace narrow-pane${x==="chat"?"":" narrow-pane-veiled"}`,children:S}),L,o.jsx("div",{className:`narrow-pane${x==="notes"?"":" narrow-pane-hidden"}`,children:I}),o.jsx("div",{className:`narrow-pane${x==="console"?"":" narrow-pane-hidden"}`,children:B})]}),F!==null&&o.jsx(ZT,{onKey:F})]}),p&&o.jsx("div",{className:"narrow-backdrop",onClick:()=>m(!1),children:o.jsx("div",{className:"narrow-drawer",onClick:U=>U.stopPropagation(),children:u})}),D==="tabs"&&o.jsx("div",{className:"narrow-backdrop",onClick:()=>H(null),children:o.jsxs("div",{className:"narrow-sheet",role:"dialog","aria-label":w("narrow.tabs.open"),onClick:U=>U.stopPropagation(),children:[o.jsx(tL,{terminals:a,platform:g,activeTerminalId:d,activity:k,statusLineOf:G,onSelect:U=>{b(U),H(null)},onClose:E,onRename:N}),o.jsx(bh,{className:"narrow-sheet-new",text:w("narrow.tabs.new"),title:h??w("narrow.tabs.new"),disabled:!v||h!==null,offerAgentChoice:i,agents:y,agent:c,onOpen:U=>{_(U),H(null)}})]})}),D==="menu"&&o.jsx("div",{className:"narrow-backdrop",onClick:()=>H(null),children:o.jsx("div",{className:"narrow-sheet",role:"dialog","aria-label":w("narrow.more"),onClick:U=>U.stopPropagation(),children:o.jsx(rL,{menu:f,status:e,statusLabel:s,onClose:()=>H(null)})})})]})}function tL({terminals:t,platform:e,activeTerminalId:s,activity:a,statusLineOf:d,onSelect:k,onClose:y,onRename:i}){const[c,g]=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 E=()=>{c!==null&&i(c,v.trim()),g(null)};return t.length===0?o.jsx("p",{className:"narrow-sheet-empty",children:w("narrow.tabs.none")}):o.jsx("ul",{className:"narrow-tabs",children:t.map(N=>{const _=c===N.terminalId,u=Lv(N,t,e);return o.jsxs("li",{className:`narrow-tab-row${N.terminalId===s?" narrow-tab-active":""}`,style:{"--tab-project-color":Hs(Bs(N))},children:[_?o.jsx("input",{ref:b,className:"narrow-tab-input",value:v,onChange:p=>h(p.target.value),onBlur:E,onKeyDown:p=>{p.key==="Enter"&&E(),p.key==="Escape"&&(p.stopPropagation(),g(null))}}):o.jsxs("button",{className:"narrow-tab-select",onClick:()=>k(N.terminalId),children:[o.jsx(Sh,{terminal:N,activity:a.get(N.terminalId),statusLine:d(N)}),N.review&&o.jsx("span",{className:"tab-review",title:w("worktree.tab.reviewTitle"),children:w("worktree.tab.review")}),u!==null&&o.jsx("span",{className:"tab-branch",children:u}),o.jsx("span",{className:"narrow-tab-label",children:To(N)})]}),o.jsx("button",{className:"icon-button",onClick:()=>{g(N.terminalId),h(N.label.length>0?N.label:To(N))},title:w("narrow.tabs.rename"),children:"✎"}),o.jsx("button",{className:"icon-button",onClick:()=>y(N.terminalId),title:w("narrow.tabs.close"),children:"×"})]},N.terminalId)})})}function nL({choice:t}){const e=[{source:"system",label:w("narrow.menu.chimeSystem")},{source:"page",label:w("narrow.menu.chimePage")}];return o.jsx("div",{className:"narrow-chime-choice",role:"group","aria-label":w("narrow.menu.sound"),children:e.map(({source:s,label:a})=>o.jsx("button",{className:`narrow-chime-option${t.source===s?" is-on":""}`,"aria-pressed":t.source===s,onClick:()=>t.setSource(s),children:a},s))})}function rL({menu:t,status:e,statusLabel:s,onClose:a}){return o.jsxs("div",{className:"narrow-menu",children:[o.jsxs("div",{className:"narrow-menu-row",children:[o.jsx("span",{className:"narrow-menu-label",children:w("narrow.menu.connection")}),o.jsx("span",{className:`status status-${e}`,children:s}),Pg(navigator.userAgent)&&o.jsxs(o.Fragment,{children:[o.jsx("a",{className:"link-button",href:iC,onClick:a,children:w("narrow.menu.phoneAppDisconnect")}),o.jsx("a",{className:"link-button",href:sC,onClick:a,children:w("narrow.menu.phoneAppSettings")})]})]}),t.cwd!==null&&o.jsxs("div",{className:"narrow-menu-row",children:[o.jsx("span",{className:"narrow-menu-label",children:w("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:w("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:w("app.header.remoteBadge")}),o.jsx("span",{className:"narrow-menu-value narrow-menu-value-wrap",children:w("app.header.remoteBadgeTitle")})]}),o.jsxs("div",{className:"narrow-menu-row",children:[o.jsx("span",{className:"narrow-menu-label",children:w("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:w("narrow.menu.language")}),o.jsx(Vv,{})]}),o.jsxs("div",{className:"narrow-menu-row",children:[o.jsx("span",{className:"narrow-menu-label",children:w("narrow.menu.sound")}),t.sound.phoneChime===null?o.jsx($v,{sound:t.sound}):o.jsx(nL,{choice:t.sound.phoneChime})]}),t.sound.notify.supported&&o.jsxs("div",{className:"narrow-menu-row",children:[o.jsx("span",{className:"narrow-menu-label",children:w("narrow.menu.notifications")}),o.jsx(Wv,{notify:t.sound.notify})]}),t.remote!==null&&o.jsxs("div",{className:"narrow-menu-row",children:[o.jsx("span",{className:"narrow-menu-label",children:w("app.header.remoteAccess")}),o.jsx("button",{className:`icon-button${t.remote.active?" icon-button-on":""}`,onClick:()=>{var d;a(),(d=t.remote)==null||d.onOpen()},title:t.remote.title,children:"⇄"})]}),o.jsxs("div",{className:"narrow-menu-row",children:[o.jsx("span",{className:"narrow-menu-label",children:w("narrow.menu.shortcuts")}),o.jsx("button",{className:"icon-button",onClick:()=>{a(),t.onShortcuts()},title:w("app.header.shortcuts"),children:"?"})]}),o.jsxs("div",{className:"narrow-menu-row",children:[o.jsx("span",{className:"narrow-menu-label",children:w("settings.title")}),o.jsx("button",{className:"icon-button",onClick:()=>{a(),t.onSettings()},title:w("settings.open"),"aria-label":w("settings.open"),children:"⚙"})]})]})}function sL(){const t=window.location.search,e=new URLSearchParams(t).get(Bu),s=e!==null&&e.length>0?e:null,a=Zk(t);return s===null&&a===null?{token:s,tab:a}:(window.history.replaceState(null,"",`${window.location.pathname}${eC(t,[Bu,jg])}`),{token:s,tab:a})}const Kv=sL(),Lm=Kv.token,iL=Kv.tab,ju=new Set;function oL(t){const[e,s]=M.useState(null),[a,d]=M.useState(null),[k,y]=M.useState(ju),[i,c]=M.useState(null);M.useEffect(()=>{const u=t.onMessage(m=>{switch(m.type){case"vault.status":s(m.status);break;case"vault.exported":y(f=>{if(!f.has(m.projectKey))return f;const x=new Set(f);return x.delete(m.projectKey),x}),c({projectKey:m.projectKey,sessions:m.sessions,at:Date.now()});break;case"error":if(m.code!=="vault-failed")break;d(At(m.text)),m.detail!==void 0&&console.error("[servidor]",m.detail),y(ju);break}}),p=t.onReopen(()=>y(ju));return()=>{u(),p()}},[t]);const g=M.useCallback(()=>{d(null),t.send({type:"vault.measure"})},[t]),v=M.useCallback(u=>{d(null),t.send({type:"vault.enable",enabled:u})},[t]),h=M.useCallback(u=>{d(null),t.send({type:"vault.setDir",pickerId:u})},[t]),b=M.useCallback(u=>{d(null),y(p=>new Set(p).add(u)),t.send({type:"vault.exportProject",projectKey:u})},[t]),E=M.useCallback((u,p)=>{d(null),t.send({type:"vault.openSession",agent:u,sessionId:p})},[t]),N=M.useCallback(()=>{d(null),t.send({type:"vault.reveal"})},[t]),_=M.useCallback(()=>d(null),[]);return{status:e,problem:a,exporting:k,lastExported:i,measure:g,setEnabled:v,chooseDir:h,exportProject:b,openSession:E,reveal:N,dismissProblem:_}}function aL(t){return w("summary.outdatedServer",{server:t,page:Ei})}function lL(t){const[e,...s]=t;if(e===void 0||e.missingMessage===null)return null;const a=At(e.missingMessage);return s.length===0?a:`${a}
|
|
155
|
-
${w("summary.alsoWorksWith",{names:s.map(d=>d.label).join(", ")})}`}function cL(t){const e=t.version??"?";return e.toLowerCase().includes(t.label.toLowerCase())?e:`${t.label} ${e}`}function uL(t,e,s=Ei){var y,i;if(e&&s<Ei)return{cliAvailable:!1,cliVersion:null,cliMissingMessage:aL(s),environmentNotice:null};if(e&&s>Ei)return{cliAvailable:!1,cliVersion:null,cliMissingMessage:w("summary.newerServer",{server:s,page:Ei}),environmentNotice:null};const a=t.filter(c=>c.available);let d=null;a.length===1?d=((y=a[0])==null?void 0:y.version)??null:a.length>1&&(d=a.map(cL).join(" · "));const k=e&&a.length===0;return{cliAvailable:!e||a.length>0,cliVersion:d,cliMissingMessage:k?lL(t):null,environmentNotice:((i=t.find(c=>c.environmentNotice!==null))==null?void 0:i.environmentNotice)??null}}const hL=500,dL=8e3;class fL{constructor(){Ht(this,"socket",null);Ht(this,"status","connecting");Ht(this,"attempt",0);Ht(this,"closedByUs",!1);Ht(this,"hasConnectedOnce",!1);Ht(this,"reconnectTimer");Ht(this,"messageHandlers",new Set);Ht(this,"statusHandlers",new Set);Ht(this,"reopenHandlers",new Set);Ht(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(jy,window.location.href);e.protocol=window.location.protocol==="https:"?"wss:":"ws:",Lm!==null&&e.searchParams.set(Bu,Lm);const s=new WebSocket(e);this.socket=s,s.onopen=()=>{for(this.attempt=0,this.setStatus("open");this.outbox.length>0;){const a=this.outbox.shift();a!==void 0&&s.send(ep(a))}if(this.hasConnectedOnce)for(const a of this.reopenHandlers)a();this.hasConnectedOnce=!0},s.onmessage=a=>{const d=$y(a.data);if(d===null){console.warn("[conexion] mensaje del servidor no reconocido");return}for(const k of this.messageHandlers)k(d)},s.onclose=a=>{if(this.socket=null,!this.closedByUs){if(a.code===Cy){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(ep(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(hL*2**(this.attempt-1),dL);window.clearTimeout(this.reconnectTimer),this.reconnectTimer=window.setTimeout(()=>this.connect(),e)}}const Gv=new Set;function pL(t){return t!==void 0&&Gv.has(t)}function Un(){const t=crypto.randomUUID();return Gv.add(t),t}function Yv(t,e){return t.reason==="requested"&&e!==null&&(t.requestId===void 0||t.requestId===e)}const Nm={rows:[],kept:[]};function mL(t,e,s){const[a,d]=M.useState(Nm);return M.useEffect(()=>{if(d(Nm),e===null)return;const k=()=>{t.send({type:"worktree.status",terminalId:e})},y=t.onMessage(c=>{c.type==="worktree.rows"&&c.terminalId===e&&d({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]),a}function gL(t,e,s){const[a,d]=M.useState(null),[k,y]=M.useState(null),[i,c]=M.useState(null),g=M.useRef(null),v=M.useRef(null),h=M.useRef(null),b=M.useRef(null),E=M.useRef(null);M.useEffect(()=>t.onMessage(D=>{switch(D.type){case"worktree.inspected":if(D.requestId!==g.current)break;d(H=>H===null?null:{...H,state:{phase:"ready",inspection:D.inspection}});break;case"terminal.opened":if(D.requestId===g.current){g.current=null,d(null);const H=v.current;v.current=null,H==null||H()}break;case"worktree.removePlan":if(D.requestId!==h.current)break;y(H=>H===null?null:{...H,state:{phase:"ready",plan:D.plan}});break;case"worktree.removed":if(D.requestId!==h.current)break;h.current=null,y(H=>H===null?null:{...H,state:{phase:"done",outcome:D.outcome}});break;case"worktree.deleteBranchPlan":if(D.requestId!==E.current)break;c(H=>H===null?null:{...H,state:{phase:"ready",plan:D.plan}});break;case"worktree.branchDeleted":if(D.requestId!==E.current)break;E.current=null,c(H=>H===null?null:{...H,state:{phase:"done"}});break;case"composer.prefill":Yv(D,b.current)&&(b.current=null,s(D.terminalId));break;case"error":{const H=At(D.text);D.requestId!==void 0&&D.requestId===g.current&&(g.current=null,d(W=>{if(W===null)return null;const G=W.state.phase==="loading"?null:W.state.inspection;return{...W,state:{phase:"failed",inspection:G,message:H}}})),D.requestId!==void 0&&D.requestId===h.current&&(h.current=null,y(W=>{if(W===null)return null;const G=W.state.phase==="ready"||W.state.phase==="removing"?W.state.plan:null;return{...W,state:{phase:"failed",plan:G,message:H}}})),D.requestId!==void 0&&D.requestId===E.current&&(E.current=null,c(W=>{if(W===null)return null;const G=W.state.phase==="ready"||W.state.phase==="deleting"?W.state.plan:null;return{...W,state:{phase:"failed",plan:G,message:H}}})),D.requestId!==void 0&&D.requestId===b.current&&(b.current=null);break}}}),[t,s]);const N=M.useCallback((D,H,W,G)=>{const Y=Un();g.current=Y,v.current=G??null,d({source:D,projectCwd:H,projectName:W,state:{phase:"loading"}}),t.send({type:"worktree.inspect",requestId:Y,source:D})},[t]),_=M.useCallback(D=>{if(a===null||a.state.phase!=="ready"&&a.state.phase!=="failed")return;const{inspection:H}=a.state;if(H===null)return;const W=Un();g.current=W,d({...a,state:{phase:"creating",inspection:H}}),e(W,{cwd:a.projectCwd,label:D.branch,agent:D.agent??null}),t.send({type:"worktree.create",requestId:W,source:a.source,branch:D.branch,base:D.base,mode:D.mode,copyNotes:D.copyNotes,...D.agent!==void 0?{agent:D.agent}:{}})},[t,a,e]),u=M.useCallback(()=>{(a==null?void 0:a.state.phase)!=="creating"&&(g.current=null,v.current=null),d(null)},[a]),p=M.useCallback(D=>{const H=Un();h.current=H,t.send({type:"worktree.planRemove",requestId:H,worktreeId:D})},[t]),m=M.useCallback((D,H)=>{y({worktreeId:D,branch:H,state:{phase:"loading"}}),p(D)},[p]),f=M.useCallback(D=>{if(k===null||k.state.phase!=="ready")return;const H=Un();h.current=H,y({...k,state:{phase:"removing",plan:k.state.plan}}),t.send({type:"worktree.remove",requestId:H,worktreeId:k.worktreeId,discardConflicts:D})},[t,k]),x=M.useCallback(D=>{if(k===null)return;const H=crypto.randomUUID();b.current=H,e(H,null),t.send({type:D,requestId:H,worktreeId:k.worktreeId}),h.current=null,y(null)},[t,e,k]),j=M.useCallback(()=>x("worktree.askNotes"),[x]),T=M.useCallback(()=>x("worktree.askCommit"),[x]),R=M.useCallback(()=>{k!==null&&m(k.worktreeId,k.branch)},[m,k]),S=M.useCallback(()=>{h.current=null,y(null)},[]),L=M.useCallback((D,H,W,G)=>{const Y=crypto.randomUUID();e(Y,{cwd:W,label:G,agent:D}),t.send({type:"worktree.reopen",requestId:Y,agent:D,sessionId:H})},[t,e]),I=M.useCallback((D,H)=>{const W=Un();E.current=W,c({worktreeId:D,branch:H,state:{phase:"loading"}}),t.send({type:"worktree.planDeleteBranch",requestId:W,worktreeId:D})},[t]),B=M.useCallback(()=>{if(i===null||i.state.phase!=="ready"||i.state.plan.blocker!==null)return;const D=Un();E.current=D,c({...i,state:{phase:"deleting",plan:i.state.plan}}),t.send({type:"worktree.deleteBranch",requestId:D,worktreeId:i.worktreeId})},[t,i]),F=M.useCallback(()=>{E.current=null,c(null)},[]);return{create:a,openCreate:N,submitCreate:_,closeCreate:u,remove:k,openRemove:m,confirmRemove:f,askNotes:j,askCommit:T,retryRemove:R,closeRemove:S,reopen:L,deleteBranch:i,openDeleteBranch:I,confirmDeleteBranch:B,closeDeleteBranch:F}}function vL(t,e,s){const[a,d]=M.useState(null),[k,y]=M.useState(null),[i,c]=M.useState(null),g=M.useRef(null),v=M.useRef(null),h=M.useRef(null),b=M.useRef(null),E=M.useRef(null);M.useEffect(()=>t.onMessage(B=>{switch(B.type){case"worktree.branchChanges":if(B.requestId!==g.current)break;g.current=null,d(F=>F===null?null:{...F,state:{phase:"ready",changes:B.changes}});break;case"worktree.branchDiff":if(B.requestId!==v.current)break;v.current=null,d(F=>F===null||F.diff===null?F:{...F,diff:{...F.diff,diff:B.diff}});break;case"worktree.reviewPlan":if(B.requestId!==h.current)break;h.current=null,y(F=>F===null?null:{...F,state:{phase:"ready",plan:B.plan}});break;case"terminal.opened":B.requestId!==void 0&&B.requestId===h.current&&(h.current=null,y(null));break;case"worktree.integratePlan":if(B.requestId!==b.current)break;b.current=null,c(F=>F===null?null:{...F,state:{phase:"ready",plan:B.plan}});break;case"worktree.integrated":if(B.requestId!==b.current)break;b.current=null,c(F=>{if(F===null)return null;const D=F.state.phase==="integrating"?F.state.plan:null;return D===null?F:{...F,state:{phase:"done",plan:D,outcome:B.outcome}}});break;case"composer.prefill":Yv(B,E.current)&&(E.current=null,s(B.terminalId));break;case"error":{const{requestId:F}=B;if(F===void 0)break;const D=At(B.text);F===g.current&&(g.current=null,d(H=>H===null?null:{...H,state:{phase:"failed",message:D}})),F===v.current&&(v.current=null,d(H=>H===null||H.diff===null?H:{...H,diff:{...H.diff,message:D}})),F===h.current&&(h.current=null,y(H=>{if(H===null)return null;const W=H.state.phase==="loading"||H.state.phase==="failed"?null:H.state.plan;return{...H,state:{phase:"failed",plan:W,message:D}}})),F===b.current&&(b.current=null,c(H=>{if(H===null)return null;const W=H.state.phase==="ready"||H.state.phase==="integrating"?H.state.plan:null;return{...H,state:{phase:"failed",plan:W,message:D}}})),F===E.current&&(E.current=null);break}}}),[t,s]);const N=M.useCallback((B,F)=>{const D=Un();g.current=D,v.current=null,d({worktreeId:B,branch:F,state:{phase:"loading"},diff:null}),t.send({type:"worktree.changes",requestId:D,worktreeId:B})},[t]),_=M.useCallback(B=>{if(a===null)return;const F=Un();v.current=F,d({...a,diff:{path:B,diff:null,message:null}}),t.send({type:"worktree.changesDiff",requestId:F,worktreeId:a.worktreeId,path:B})},[t,a]),u=M.useCallback(()=>{v.current=null,d(B=>B===null?null:{...B,diff:null})},[]),p=M.useCallback(()=>{g.current=null,v.current=null,d(null)},[]),m=M.useCallback((B,F,D)=>{const H=Un();h.current=H,y({worktreeId:B,branch:F,projectCwd:D,state:{phase:"loading"}}),t.send({type:"worktree.planReview",requestId:H,worktreeId:B})},[t]),f=M.useCallback(B=>{if(k===null||k.state.phase!=="ready"&&k.state.phase!=="failed")return;const{plan:F}=k.state;if(F===null)return;const D=Un();h.current=D,y({...k,state:{phase:"requesting",plan:F}});const H=k.projectCwd.split(/[\\/]/).filter(W=>W.length>0).pop()??k.projectCwd;e(D,{cwd:k.projectCwd,label:H,agent:B}),t.send({type:"worktree.requestReview",requestId:D,worktreeId:k.worktreeId,agent:B})},[t,e,k]),x=M.useCallback(()=>{(k==null?void 0:k.state.phase)!=="requesting"&&(h.current=null),y(null)},[k]),j=M.useCallback((B,F)=>{const D=Un();b.current=D,c({worktreeId:B,branch:F,state:{phase:"loading"}}),t.send({type:"worktree.planIntegrate",requestId:D,worktreeId:B})},[t]),T=M.useCallback(()=>{if(i===null||i.state.phase!=="ready")return;const B=Un();b.current=B;const{plan:F}=i.state;c({...i,state:{phase:"integrating",plan:F}}),t.send({type:"worktree.integrate",requestId:B,worktreeId:i.worktreeId,...F.branchCommit!==null?{branchCommit:F.branchCommit}:{}})},[t,i]),R=M.useCallback(()=>{b.current=null,c(null)},[]),S=M.useCallback((B,F)=>{const D=crypto.randomUUID();E.current=D,e(D,null),t.send({type:B,requestId:D,worktreeId:F})},[t,e]),L=M.useCallback(B=>S("worktree.sendReview",B),[S]),I=M.useCallback(B=>S("worktree.catchUp",B),[S]);return{changes:a,openChanges:N,openChangeDiff:_,closeChangeDiff:u,closeChanges:p,review:k,openReview:m,submitReview:f,closeReview:x,integrate:i,openIntegrate:j,confirmIntegrate:T,closeIntegrate:R,sendReview:L,catchUp:I}}const ah="agent-workbench.activeTab";function _L(){try{return window.sessionStorage.getItem(ah)}catch{return null}}const wL={state:"idle",scannedFiles:0,totalFiles:0};function yL(t,e,s){const a=new Map(s?[]:t.map(d=>[d.key,d]));for(const d of e)a.set(d.key,d);return[...a.values()].sort((d,k)=>k.lastActivityAt-d.lastActivityAt)}function bL(){const t=M.useMemo(()=>new fL,[]),e=M.useMemo(()=>new jk({send:(de,Ke)=>t.send({type:"composer.draft",terminalId:de,draft:Ke}),connected:()=>t.getStatus()==="open",setTimer:(de,Ke)=>window.setTimeout(de,Ke),clearTimer:de=>window.clearTimeout(de),newId:()=>crypto.randomUUID()}),[t]),[s,a]=M.useState("connecting"),[d,k]=M.useState([]),[y,i]=M.useState(null),[c,g]=M.useState(!1),[v,h]=M.useState(Ei),[b,E]=M.useState(""),[N,_]=M.useState(""),[u,p]=M.useState(null),[m,f]=M.useState(!1),[x,j]=M.useState(!1),[T,R]=M.useState(!1),[S,L]=M.useState([]),[I,B]=M.useState([]),[F,D]=M.useState(wL),[H,W]=M.useState(_L);M.useEffect(()=>{try{H===null?window.sessionStorage.removeItem(ah):window.sessionStorage.setItem(ah,H)}catch{}},[H]);const[G,Y]=M.useState(new Set),[z,P]=M.useState(new Map),[U,$]=M.useState(new Map),K=M.useRef(new Map),te=M.useRef(new Map),[oe,we]=M.useState(new Set),[me,X]=M.useState(null),[V,Z]=M.useState([]),[ee,ve]=M.useState(new Map),[Se,Ie]=M.useState([]),je=M.useRef(1),[Je,Ze]=M.useState(new Map),Ae=M.useRef(new Set),ue=M.useRef(new Map),ht=M.useRef(new Map),se=M.useCallback(de=>{const Ke=ht.current.get(de);Ke!==void 0&&(clearTimeout(Ke),ht.current.delete(de)),Z(tt=>tt.some(ye=>ye.requestId===de)?tt.filter(ye=>ye.requestId!==de):tt)},[]),pe=M.useCallback(()=>{for(const de of ht.current.values())clearTimeout(de);ht.current.clear(),Z(de=>de.length===0?de:[])},[]);M.useEffect(()=>{const de=t.onStatus(ye=>{a(ye),ye==="failed"&&X({message:w("workspace.connectFailed"),at:Date.now()})}),Ke=t.onMessage(ye=>{switch(ye.type){case"agents":k(ye.agents),i(ye.defaultAgent);break;case"hello":k(ye.agents),i(ye.defaultAgent),g(!0),h(ye.protocolVersion),E(ye.platform),_(ye.defaultCwd),p(ye.shellName),f(ye.remoteClient),j(ye.fileCheck),R(ye.fileWrite);break;case"terminal.list":{L(ye.terminals),e.retain(ye.terminals.map(De=>De.terminalId));const ct=hk(te.current,ye.terminals),xt=ct.finished.length>0||[...ct.phases].some(([De,at])=>te.current.get(De)!==at);te.current=ct.phases,xt&&we(new Set(ct.phases.keys())),Y(De=>{if(De.size===0)return De;const at=new Set(De);for(const bt of De){if(ct.phases.has(bt))continue;const Xt=ye.terminals.find(wn=>wn.terminalId===bt);(Xt===void 0||Xt.alive)&&at.delete(bt)}return at.size===De.size?De:at}),$(De=>{if(De.size===0)return De;const at=new Map([...De].filter(([bt])=>ye.terminals.some(Xt=>Xt.terminalId===bt)));return at.size===De.size?De:(K.current=at,at)});const mt=ye.terminals.filter(De=>De.kind==="agent");W(De=>{var at;return De!==null&&mt.some(bt=>bt.terminalId===De)?De:((at=mt[0])==null?void 0:at.terminalId)??null}),ve(De=>{if(De.size===0)return De;const at=new Map(De);for(const bt of De.keys())ye.terminals.some(Xt=>Xt.terminalId===bt)||at.delete(bt);return at.size===De.size?De:at}),Ze(De=>{if(De.size===0)return De;const at=new Map([...De].filter(([bt])=>ye.terminals.some(Xt=>Xt.terminalId===bt)));return at.size===De.size?De:at});break}case"session.continued":ve(ct=>new Map(ct).set(ye.terminalId,{sourceAgent:ye.source.agent,includedTurns:ye.includedTurns,totalTurns:ye.totalTurns,totalTurnsIsMinimum:ye.totalTurnsIsMinimum,delivery:ye.delivery,prefillReason:null}));break;case"composer.prefill":{const ct=je.current;je.current+=1,Ie(mt=>[...mt,{id:ct,terminalId:ye.terminalId,text:ye.text,pasted:ye.pasted??[],focus:ye.reason==="queue-edit"}]);const{reason:xt}=ye;if(xt==="returned-by-cli"||xt==="stopped-early"){Ze(mt=>mt.get(ye.terminalId)===xt?mt:new Map(mt).set(ye.terminalId,xt));break}if(xt==="rewound"||xt==="requested"||xt==="queue-edit")break;ve(mt=>{const De=mt.get(ye.terminalId);return De===void 0?mt:new Map(mt).set(ye.terminalId,{...De,delivery:"prefilled",prefillReason:xt})});break}case"composer.drafts":e.restore(ye.drafts);break;case"terminal.opened":{se(ye.requestId),Ae.current.delete(ye.requestId)&&ye.terminal.kind==="agent"&&W(ye.terminal.terminalId);const ct=ue.current.get(ye.requestId);ct!==void 0&&(ue.current.delete(ye.requestId),ct(ye.terminal));break}case"terminal.activity":P(ct=>ct.get(ye.terminalId)===ye.activity?ct:new Map(ct).set(ye.terminalId,ye.activity)),$(ct=>{const xt=ye.offlineReason??null;if((ct.get(ye.terminalId)??null)===xt)return ct;const mt=new Map(ct);return xt===null?mt.delete(ye.terminalId):mt.set(ye.terminalId,xt),K.current=mt,mt});break;case"index.status":D(ye.status);break;case"index.projects":B(ct=>yL(ct,ye.projects,ye.replace));break;case"error":if(pL(ye.requestId)){ye.detail!==void 0&&console.error("[servidor]",ye.detail),ye.requestId!==void 0&&(Ae.current.delete(ye.requestId),ue.current.delete(ye.requestId),se(ye.requestId));break}if(D5(ye.requestId)){ye.detail!==void 0&&console.error("[servidor]",ye.detail);break}if(ye.code==="vault-failed"||ye.code==="search-failed"||ye.code==="remote-failed"||ye.code==="settings-failed"||ye.code==="rewind-failed")break;X({message:At(ye.text),at:Date.now()}),Y(ct=>ct.size===0?ct:new Set),te.current.size>0&&(te.current=new Map,we(new Set)),ye.detail!==void 0&&console.error("[servidor]",ye.detail),ye.requestId!==void 0&&(Ae.current.delete(ye.requestId),ue.current.delete(ye.requestId),se(ye.requestId));break}}),tt=t.onReopen(()=>{pe(),Y(ye=>ye.size===0?ye:new Set),te.current.size>0&&(te.current=new Map,we(new Set))});return t.connect(),()=>{de(),Ke(),tt(),t.close()}},[t,e,se,pe]),M.useEffect(()=>{const de=t.onReopen(()=>e.reconnected()),Ke=()=>e.flushAll(),tt=()=>{document.visibilityState==="hidden"&&e.flushAll()};return window.addEventListener("pagehide",Ke),document.addEventListener("visibilitychange",tt),()=>{de(),window.removeEventListener("pagehide",Ke),document.removeEventListener("visibilitychange",tt)}},[t,e]),M.useEffect(()=>pe,[pe]);const Ce=M.useCallback(de=>{const Ke=crypto.randomUUID();Ae.current.add(Ke),de.onOpened!==void 0&&ue.current.set(Ke,de.onOpened),Z(ye=>[...ye,{requestId:Ke,cwd:de.cwd,agent:de.agent??null,label:de.label??"",at:Date.now()}]);const tt=setTimeout(()=>se(Ke),cp);ht.current.set(Ke,tt),t.send({type:"terminal.open",requestId:Ke,cwd:de.cwd,...de.resumeSessionId!==void 0?{resumeSessionId:de.resumeSessionId}:{},...de.label!==void 0?{label:de.label}:{},...de.agent!==void 0?{agent:de.agent}:{}})},[t,se]),be=M.useCallback(de=>{t.send({type:"terminal.open",requestId:crypto.randomUUID(),cwd:de,kind:"shell"})},[t]),ge=M.useCallback(de=>t.send({type:"terminal.close",terminalId:de}),[t]),Le=M.useCallback(de=>{Y(Ke=>new Set(Ke).add(de)),K.current.get(de)==="server-closed"&&(te.current=new Map(te.current).set(de,"waiting-exit"),we(new Set(te.current.keys()))),t.send({type:"terminal.wake",terminalId:de})},[t]),ce=M.useCallback((de,Ke)=>t.send({type:"terminal.rename",terminalId:de,label:Ke}),[t]),Ye=M.useCallback(de=>t.send({type:"tabs.reorder",terminalIds:de}),[t]),We=M.useCallback((de,Ke)=>t.send({type:"session.archive",sessionIds:de,archived:Ke}),[t]),He=M.useCallback((de,Ke,tt)=>{const ye=crypto.randomUUID();Ae.current.add(ye),t.send({type:"session.continue",requestId:ye,agent:de.agent,sessionId:de.sessionId,target:Ke,label:tt})},[t]),Oe=M.useCallback((de,Ke)=>{if(Ae.current.add(de),Ke===null)return;Z(ye=>[...ye,{requestId:de,...Ke,at:Date.now()}]);const tt=setTimeout(()=>se(de),cp);ht.current.set(de,tt)},[se]),Ue=M.useCallback(de=>{ve(Ke=>{if(!Ke.has(de))return Ke;const tt=new Map(Ke);return tt.delete(de),tt})},[]),qe=M.useCallback(de=>{Ze(Ke=>{if(!Ke.has(de))return Ke;const tt=new Map(Ke);return tt.delete(de),tt})},[]),St=M.useCallback(de=>{Ie(Ke=>Ke.some(tt=>tt.id===de)?Ke.filter(tt=>tt.id!==de):Ke)},[]),Pt=M.useCallback(()=>t.send({type:"index.refresh"}),[t]),$t=M.useCallback(()=>t.send({type:"agents.refresh"}),[t]),dt=M.useCallback(()=>X(null),[]),tn=M.useMemo(()=>S.filter(de=>de.kind==="agent"),[S]),Vt=M.useMemo(()=>S.filter(de=>de.kind==="shell"),[S]),fe=Mo(),et=M.useMemo(()=>uL(d,c,v),[d,c,v,fe]),Xe=M.useCallback(de=>{var Ke;return(de===null||(Ke=d.find(tt=>tt.id===de))==null?void 0:Ke.capabilities)??zm},[d]),lt=M.useMemo(()=>ch(d),[d]);return{connection:t,status:s,agents:d,defaultAgent:y,capabilitiesFor:Xe,offerAgentChoice:lt,cliAvailable:et.cliAvailable,cliVersion:et.cliVersion,cliMissingMessage:et.cliMissingMessage,platform:b,defaultCwd:N,environmentNotice:et.environmentNotice,shellName:u,remoteClient:m,fileCheck:x,fileWrite:T,terminals:tn,shells:Vt,pendingOpens:V,activeTerminalId:H,projects:I,indexStatus:F,error:me,dismissError:dt,setActiveTerminal:W,openTerminal:Ce,openShell:be,closeTerminal:ge,wakeTerminal:Le,waking:G,activity:z,offlineReasons:U,relaunching:oe,renameTerminal:ce,reorderTabs:Ye,refreshIndex:Pt,refreshAgents:$t,archiveSessions:We,continueSession:He,expectTab:Oe,handoffs:ee,dismissHandoff:Ue,returnedMessages:Je,dismissReturned:qe,prefills:Se,prefillApplied:St,drafts:e}}function kL({dialog:t,agents:e,offerAgentChoice:s,agent:a,onSubmit:d,onClose:k}){const{state:y}=t,i=y.phase==="loading"?null:y.inspection,[c,g]=M.useState("new"),[v,h]=M.useState(""),[b,E]=M.useState(""),[N,_]=M.useState(""),[u,p]=M.useState(a),[m,f]=M.useState(!0);M.useEffect(()=>{const D=H=>{H.key==="Escape"&&(H.preventDefault(),H.stopPropagation(),k())};return window.addEventListener("keydown",D,!0),()=>window.removeEventListener("keydown",D,!0)},[k]),M.useEffect(()=>{var D;i===null||N.length>0||_(i.currentBranch??((D=i.branches[0])==null?void 0:D.name)??"")},[i,N]);const x=M.useMemo(()=>(i==null?void 0:i.branches.filter(D=>!D.checkedOut).map(D=>D.name))??[],[i]);M.useEffect(()=>{b.length===0&&x[0]!==void 0&&E(x[0])},[b,x]);const j=e.filter(D=>D.available),T=c==="new"?v.trim():b,R=c==="new"?N:(i==null?void 0:i.currentBranch)??N,S=i===null?null:aE(i,T,c,R),L=y.phase==="creating",I=i!==null&&!L&&T.length>0&&S===null,B=()=>{I&&d({branch:T,base:R,mode:c,copyNotes:m,...s&&u!==null?{agent:u}:{}})},F=w("worktree.create.title");return o.jsx("div",{className:"modal-backdrop",onClick:k,children:o.jsxs("div",{className:"modal worktree-dialog",role:"dialog","aria-label":F,onClick:D=>D.stopPropagation(),children:[o.jsxs("header",{className:"modal-header",children:[o.jsx("span",{className:"modal-title",children:F}),o.jsx("button",{className:"icon-button",onClick:k,title:w("common.close"),children:"×"})]}),o.jsxs("div",{className:"modal-body",children:[o.jsx("p",{className:"modal-hint",children:w("worktree.create.intro",{project:t.projectName})}),y.phase==="loading"&&o.jsx("p",{className:"modal-hint",children:w("worktree.create.loading")}),i!==null&&o.jsxs("form",{className:"worktree-form",onSubmit:D=>{D.preventDefault(),B()},children:[o.jsxs("label",{className:"worktree-field",children:[o.jsx("span",{className:"worktree-label",children:w("worktree.create.branch")}),c==="new"?o.jsx("input",{className:"worktree-input",value:v,onChange:D=>h(D.target.value),placeholder:w("worktree.create.branchPlaceholder"),spellCheck:!1,autoFocus:!0,disabled:L}):o.jsx("select",{className:"worktree-input",value:b,onChange:D=>E(D.target.value),disabled:L||x.length===0,children:x.map(D=>o.jsx("option",{value:D,children:D},D))})]}),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:()=>g("new"),disabled:L}),o.jsx("span",{children:w("worktree.create.modeNew")}),o.jsx("select",{className:"worktree-input worktree-base",value:N,onChange:D=>_(D.target.value),disabled:L||c!=="new",children:i.branches.map(D=>o.jsx("option",{value:D.name,children:D.name},D.name))})]}),o.jsxs("label",{className:"worktree-mode",children:[o.jsx("input",{type:"radio",checked:c==="existing",onChange:()=>g("existing"),disabled:L||x.length===0}),o.jsx("span",{children:w("worktree.create.modeExisting")})]}),x.length===0&&o.jsx("p",{className:"modal-hint",children:w("worktree.create.noFreeBranch")})]}),s&&j.length>1&&o.jsxs("label",{className:"worktree-field",children:[o.jsx("span",{className:"worktree-label",children:w("worktree.create.agent")}),o.jsx("select",{className:"worktree-input",value:u??"",onChange:D=>{var H;return p(((H=j.find(W=>W.id===D.target.value))==null?void 0:H.id)??null)},disabled:L,children:j.map(D=>o.jsx("option",{value:D.id,children:D.label},D.id))})]}),S!==null&&o.jsx("p",{className:"worktree-problem",children:S}),o.jsx("h3",{className:"modal-section",children:w("worktree.create.copySection")}),i.notes.files===0?o.jsx("p",{className:"modal-hint",children:w("worktree.create.copyNone")}):o.jsxs("label",{className:"worktree-check",children:[o.jsx("input",{type:"checkbox",checked:m,onChange:D=>f(D.target.checked),disabled:L}),o.jsxs("span",{children:[w("worktree.create.copyNotes"),o.jsxs("span",{className:"modal-hint",children:[" ",i.notes.overCap?w("worktree.create.overCap",{summary:Qa(i.notes)}):w("worktree.create.copyList",{summary:Qa(i.notes),list:Tn(i.notes.sample)})]})]})]}),i.include!==null&&o.jsx("p",{className:"modal-hint",children:i.include.overCap?w("worktree.create.includeOverCap",{summary:Qa(i.include)}):w("worktree.create.include",{summary:Qa(i.include)})}),i.mainChanges>0&&o.jsx("p",{className:"worktree-warning",children:w("worktree.create.mainChanges",{count:i.mainChanges})}),T.length>0&&S===null&&o.jsxs(o.Fragment,{children:[o.jsx("h3",{className:"modal-section",children:w("worktree.create.folder")}),o.jsx("p",{className:"worktree-path",children:Nv(i,T)}),o.jsx("h3",{className:"modal-section",children:w("worktree.create.command")}),o.jsx("pre",{className:"tool-pre worktree-command",children:cE(i,T,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:w("common.cancel")}),o.jsx("button",{type:"submit",className:"primary-button",disabled:!I,children:w(L?"worktree.create.creating":"worktree.create.submit")})]})]}),y.phase==="failed"&&i===null&&o.jsx("p",{className:"worktree-problem",children:y.message})]})]})})}function CL({dialog:t,onConfirm:e,onClose:s}){const{state:a}=t;M.useEffect(()=>{const c=g=>{g.key==="Escape"&&(g.preventDefault(),g.stopPropagation(),s())};return window.addEventListener("keydown",c,!0),()=>window.removeEventListener("keydown",c,!0)},[s]);const d=a.phase==="ready"||a.phase==="deleting"||a.phase==="failed"?a.plan:null,k=d===null?null:yE(d),y=a.phase==="deleting",i=w("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:w("common.close"),children:"×"})]}),o.jsxs("div",{className:"modal-body",children:[a.phase==="loading"&&o.jsx("p",{className:"modal-hint",children:w("worktree.deleteBranch.loading")}),a.phase==="done"&&o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"modal-hint",children:w("worktree.deleteBranch.done",{branch:t.branch})}),o.jsx("div",{className:"worktree-actions",children:o.jsx("button",{className:"primary-button",onClick:s,children:w("common.close")})})]}),d!==null&&o.jsxs(o.Fragment,{children:[k!==null?o.jsx("p",{className:"worktree-problem",children:k}):o.jsx("p",{className:"modal-hint",children:w("worktree.deleteBranch.intro",{base:d.base})}),o.jsx("h3",{className:"modal-section",children:w("worktree.integrate.folder")}),o.jsx("p",{className:"worktree-path",children:d.folder}),o.jsx("h3",{className:"modal-section",children:w("worktree.integrate.command")}),o.jsx("pre",{className:"tool-pre worktree-command",children:d.command}),a.phase==="failed"&&o.jsx("p",{className:"worktree-problem",children:a.message}),o.jsxs("div",{className:"worktree-actions",children:[o.jsx("button",{className:"link-button",onClick:s,children:w("common.cancel")}),o.jsx("button",{className:"primary-button",onClick:e,disabled:y||k!==null||a.phase==="failed",children:w(y?"worktree.deleteBranch.deleting":"worktree.deleteBranch.submit")})]})]}),a.phase==="failed"&&d===null&&o.jsx("p",{className:"worktree-problem",children:a.message})]})]})})}function Xv({returning:t,merging:e,resolved:s}){const[a,d]=M.useState(!1),k=s.length>0?o.jsx("p",{className:"modal-hint",children:w("worktree.notes.resolved",{count:s.length,list:Tn(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:[w("worktree.notes.back",{count:t.length})," ",y.size>0&&o.jsxs(o.Fragment,{children:[w("worktree.notes.merged",{count:y.size})," "]}),o.jsx("button",{className:"link-button worktree-notes-toggle",onClick:()=>d(!a),"aria-expanded":a,children:w(a?"worktree.notes.hide":"worktree.notes.show")})]}),a&&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:w("worktree.notes.mergedMark")})]},i))})]})}function SL({dialog:t,agentLabel:e,onConfirm:s,onRemove:a,onClose:d}){const{state:k}=t;M.useEffect(()=>{const v=h=>{h.key==="Escape"&&(h.preventDefault(),h.stopPropagation(),d())};return window.addEventListener("keydown",v,!0),()=>window.removeEventListener("keydown",v,!0)},[d]);const y=k.phase==="loading"?null:k.plan,i=y===null?null:gE(y),c=k.phase==="integrating",g=y===null?w("worktree.integrate.titleLoading",{branch:t.branch}):w("worktree.integrate.title",{branch:y.branch,base:y.base});return o.jsx("div",{className:"modal-backdrop",onClick:d,children:o.jsxs("div",{className:"modal worktree-dialog",role:"dialog","aria-label":g,onClick:v=>v.stopPropagation(),children:[o.jsxs("header",{className:"modal-header",children:[o.jsx("span",{className:"modal-title",children:g}),o.jsx("button",{className:"icon-button",onClick:d,title:w("common.close"),children:"×"})]}),o.jsxs("div",{className:"modal-body",children:[k.phase==="loading"&&o.jsx("p",{className:"modal-hint",children:w("worktree.integrate.loading")}),k.phase==="done"&&o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"modal-hint",children:w("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:w("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:w("worktree.integrate.notesStayed",{list:Tn(k.outcome.notes.stayed)})}),o.jsx("p",{className:"modal-hint",children:w("worktree.integrate.doneOthers",{base:k.outcome.base})}),o.jsxs("div",{className:"worktree-actions",children:[o.jsx("button",{className:"link-button",onClick:d,children:w("common.close")}),o.jsx("button",{className:"primary-button",onClick:a,title:w("worktree.integrate.removeTitle"),children:w("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:w("worktree.integrate.intro",{base:y.base,count:y.ahead})}),y.fileCount>0&&o.jsx("p",{className:"modal-hint",children:w("worktree.integrate.files",{count:y.fileCount,list:`${Tn(y.files)}${y.fileCount>y.files.length?"…":""}`})}),y.notes!==null&&o.jsx(Xv,{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:w("worktree.integrate.notesStay",{list:Tn(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?w("worktree.integrate.noReview"):Rv(y.review,e(y.review.agent))}),y.tabs.length>0&&o.jsx("p",{className:"modal-hint",children:w("worktree.integrate.tabs",{list:Tn(y.tabs.map(v=>v.label))})}),y.branchUncommitted>0&&o.jsx("p",{className:"worktree-warning",children:w("worktree.integrate.branchUncommitted",{count:y.branchUncommitted})}),y.command!==null&&y.baseFolder!==null&&o.jsxs(o.Fragment,{children:[o.jsx("h3",{className:"modal-section",children:w("worktree.integrate.folder")}),o.jsx("p",{className:"worktree-path",children:y.baseFolder}),o.jsx("h3",{className:"modal-section",children:w("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:d,children:w("common.cancel")}),o.jsx("button",{className:"primary-button",onClick:s,disabled:c||i!==null||k.phase==="failed",children:w(c?"worktree.integrate.integrating":"worktree.integrate.submit")})]})]}),k.phase==="failed"&&y===null&&o.jsx("p",{className:"worktree-problem",children:k.message})]})]})})}function xL({dialog:t,onConfirm:e,onAskNotes:s,onAskCommit:a,onRetry:d,onClose:k}){const{state:y}=t;M.useEffect(()=>{const E=N=>{N.key==="Escape"&&(N.preventDefault(),N.stopPropagation(),k())};return window.addEventListener("keydown",E,!0),()=>window.removeEventListener("keydown",E,!0)},[k]);const i=y.phase==="ready"||y.phase==="removing"||y.phase==="failed"?y.plan:null,c=y.phase==="removing",g=y.phase==="failed",v=i===null||g?null:kE(i),h=w("worktree.remove.title",{branch:t.branch}),b=g?{label:w("worktree.remove.retry"),hint:void 0,run:d}:v==="ask-commit"&&i!==null?{label:w("worktree.remove.askCommit",{count:i.uncommittedCount}),hint:w("worktree.remove.askTitle"),run:a}:v==="retry"?{label:w("worktree.remove.retry"),hint:void 0,run:d}:v==="ask-notes"?{label:w("worktree.remove.askNotes"),hint:w("worktree.remove.askTitle"),run:s}:v==="remove"?{label:w("worktree.remove.submit"),hint:void 0,run:()=>e(!1)}:null;return o.jsx("div",{className:"modal-backdrop",onClick:k,children:o.jsxs("div",{className:"modal worktree-dialog",role:"dialog","aria-label":h,onClick:E=>E.stopPropagation(),children:[o.jsxs("header",{className:"modal-header",children:[o.jsx("span",{className:"modal-title",children:h}),o.jsx("button",{className:"icon-button",onClick:k,title:w("common.close"),children:"×"})]}),o.jsxs("div",{className:"modal-body",children:[y.phase==="loading"&&o.jsx("p",{className:"modal-hint",children:w("worktree.remove.loading")}),y.phase==="done"&&o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"modal-hint",children:w("worktree.remove.done")}),y.outcome.returned>0&&o.jsx("p",{className:"modal-hint",children:w("worktree.notes.returned",{count:y.outcome.returned})}),y.outcome.discarded>0&&o.jsx("p",{className:"modal-hint",children:w("worktree.remove.doneDiscarded",{count:y.outcome.discarded})}),y.outcome.branchDeleted&&o.jsx("p",{className:"modal-hint",children:w("worktree.remove.doneBranch")}),o.jsx("div",{className:"worktree-actions",children:o.jsx("button",{className:"primary-button",onClick:k,children:w("common.close")})})]}),i!==null&&y.phase!=="done"&&o.jsxs(o.Fragment,{children:[i.uncommittedCount>0&&o.jsxs("p",{className:"worktree-problem",children:[w("worktree.remove.uncommitted",{count:i.uncommittedCount})," ",o.jsx("span",{className:"worktree-files",children:`${Tn(i.uncommitted)}${i.uncommittedCount>i.uncommitted.length?"…":""}`})]}),i.inUse===!0&&o.jsx("p",{className:"worktree-problem",children:w("worktree.remove.inUse")}),i.conflicts.length>0&&o.jsx("p",{className:"worktree-warning",children:w("worktree.remove.conflicts",{list:Tn(i.conflicts)})}),o.jsx("p",{className:"modal-hint",children:CE(i)}),o.jsx(Xv,{returning:i.returning,merging:i.merging,resolved:i.resolved}),i.tabs.length>0&&o.jsx("p",{className:"modal-hint",children:w("worktree.remove.tabs",{list:Tn(i.tabs.map(E=>E.label))})}),i.commands.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("h3",{className:"modal-section",children:w("worktree.remove.commands")}),o.jsx("pre",{className:"tool-pre worktree-command",children:i.commands.join(`
|
|
156
|
-
`)})]})]}),g&&o.jsx("p",{className:"worktree-problem",children:y.message}),y.phase!=="loading"&&y.phase!=="done"&&o.jsxs("div",{className:"worktree-actions",children:[o.jsx("button",{className:"link-button",onClick:k,children:w("common.cancel")}),v==="ask-notes"&&o.jsx("button",{className:"link-button",onClick:()=>e(!0),disabled:c,children:w("worktree.remove.discard")}),b!==null&&o.jsx("button",{className:"primary-button",onClick:b.run,title:b.hint,disabled:c,children:c?w("worktree.remove.removing"):b.label})]})]})]})})}function EL({dialog:t,agents:e,onSubmit:s,onClose:a}){var p;const{state:d}=t,k=d.phase==="loading"?null:d.plan,y=M.useMemo(()=>_E(e),[e]),i=k===null?null:Ww(k.author,y),[c,g]=M.useState(null),v=c??i,h=e.find(m=>m.id===v)??null,b=m=>{var f;return((f=e.find(x=>x.id===m))==null?void 0:f.label)??m};M.useEffect(()=>{const m=f=>{f.key==="Escape"&&(f.preventDefault(),f.stopPropagation(),a())};return window.addEventListener("keydown",m,!0),()=>window.removeEventListener("keydown",m,!0)},[a]);const E=d.phase==="requesting",N=k!==null&&k.ahead===0&&k.uncommitted===0,_=k!==null&&h!==null&&!E&&!N,u=w("worktree.review.title",{branch:t.branch});return o.jsx("div",{className:"modal-backdrop",onClick:a,children:o.jsxs("div",{className:"modal worktree-dialog",role:"dialog","aria-label":u,onClick:m=>m.stopPropagation(),children:[o.jsxs("header",{className:"modal-header",children:[o.jsx("span",{className:"modal-title",children:u}),o.jsx("button",{className:"icon-button",onClick:a,title:w("common.close"),children:"×"})]}),o.jsxs("div",{className:"modal-body",children:[d.phase==="loading"&&o.jsx("p",{className:"modal-hint",children:w("worktree.review.loading")}),k!==null&&o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"modal-hint",children:w("worktree.review.intro",{base:k.base})}),N?o.jsx("p",{className:"worktree-problem",children:w("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:w("worktree.review.reviewer")}),o.jsx("select",{className:"worktree-input",value:v??"",onChange:m=>{var f;return g(((f=y.find(x=>x.id===m.target.value))==null?void 0:f.id)??null)},disabled:E,children:y.map(m=>o.jsx("option",{value:m.id,children:b(m.id)},m.id))})]}):h!==null&&o.jsx("p",{className:"modal-hint",children:w("worktree.review.sameCli",{agent:h.label})}),k.author!==null&&y.length>1&&o.jsx("p",{className:"modal-hint",children:w("worktree.review.author",{agent:b(k.author)})}),h!==null&&o.jsxs(o.Fragment,{children:[o.jsx("p",{className:((p=h.capabilities.readOnlyLaunch)==null?void 0:p.guard)==="cli"?"modal-hint":"worktree-warning",children:vE(h.capabilities,h.label)}),o.jsx("p",{className:"modal-hint",children:h.capabilities.readySignal?w("worktree.review.deliverySent"):w("worktree.review.deliveryPrefill")})]}),k.branchBusy&&o.jsx("p",{className:"worktree-warning",children:w("worktree.review.branchBusy")}),k.uncommitted>0&&o.jsx("p",{className:"modal-hint",children:w("worktree.review.uncommitted",{count:k.uncommitted})}),o.jsx("p",{className:"modal-hint",children:w("worktree.review.quota")}),o.jsx("h3",{className:"modal-section",children:w("worktree.review.prompt")}),o.jsx("pre",{className:"tool-pre worktree-command worktree-prompt",children:k.prompt})]}),d.phase==="failed"&&o.jsx("p",{className:"worktree-problem",children:d.message}),o.jsxs("div",{className:"worktree-actions",children:[o.jsx("button",{className:"link-button",onClick:a,children:w("common.cancel")}),o.jsx("button",{className:"primary-button",disabled:!_,onClick:()=>{_&&v!==null&&s(v)},children:w(E?"worktree.review.requesting":"worktree.review.submit")})]})]}),d.phase==="failed"&&k===null&&o.jsx("p",{className:"worktree-problem",children:d.message})]})]})})}const Eh=["git","files","plans","memory","console","notes"],Rm="agent-workbench.hiddenPanels";function TL(t){return Eh.includes(t)}const LL=new Set(["memory"]),NL="none";function RL(t){return new Set(t.split(",").map(e=>e.trim()).filter(TL))}function ML(t){const e=Eh.filter(s=>t.has(s));return e.length===0?NL:e.join(",")}function AL(t,e,s){const a=new Set(t);return s?a.delete(e):a.add(e),a}function IL(){const[t,e]=M.useState(()=>Nt(Rm,LL,RL)),s=M.useCallback((d,k)=>{e(y=>{const i=AL(y,d,k);return yt(Rm,ML(i)),i})},[]),a=M.useCallback(d=>!t.has(d),[t]);return{hidden:t,isVisible:a,setVisible:s}}const jL={git:"panel.tab.git",files:"panel.tab.files",plans:"panel.tab.plans",memory:"panel.tab.memory",console:"console.name",notes:"notes.name"},DL={dark:"settings.terminalTheme.dark",follow:"settings.terminalTheme.follow"};function PL(t,e,s){const a=t.filter(d=>d!==e);return s?[...a,e]:a}function OL(t,e){return t.length===e.length&&t.every(s=>e.includes(s))}function BL({onClose:t,terminalTheme:e,panels:s,consoleCount:a,onHideConsole:d,appSettings:k,agents:y,remoteClient:i,onOpenVault:c,onOpenRemote:g}){const[v,h]=M.useState(!1),b=k.status,E=b!==null&&!i,[N,_]=M.useState(null),[u,p]=M.useState(null);M.useEffect(()=>{_(null),p(null)},[b,k.problem]);const m=N??(b==null?void 0:b.consoleShell)??"auto",f=u??(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 x=(S,L)=>{if(S==="console"&&!L&&a>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,T=b!==null&&!OL(b.disabledAgents,b.disabledAtStart),R=b===null?[]:[{id:"auto",label:j===null?w("settings.console.auto"):w("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":w("settings.title"),onClick:S=>S.stopPropagation(),children:[o.jsxs("header",{className:"modal-header",children:[o.jsx("span",{className:"modal-title",children:w("settings.title")}),o.jsx("button",{className:"icon-button",onClick:t,title:w("common.closeEsc"),children:"×"})]}),o.jsxs("div",{className:"modal-body settings-body",children:[o.jsx("h3",{className:"modal-section",children:w("settings.section.appearance")}),o.jsxs("div",{className:"settings-row",children:[o.jsx("span",{className:"settings-label",children:w("settings.language")}),o.jsx(Vv,{})]}),o.jsxs("div",{className:"settings-row settings-row-top",children:[o.jsx("span",{className:"settings-label",children:w("settings.terminalTheme")}),o.jsxs("div",{className:"settings-choices",role:"radiogroup","aria-label":w("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)}),w(DL[S])]},S)),o.jsx("p",{className:"modal-hint",children:w("settings.terminalTheme.hint")})]})]}),o.jsx("h3",{className:"modal-section",children:w("settings.section.panels")}),o.jsx("div",{className:"settings-panels",children:Eh.map(S=>o.jsxs("label",{className:"settings-choice",children:[o.jsx("input",{type:"checkbox",checked:s.isVisible(S),onChange:L=>x(S,L.target.checked)}),w(jL[S])]},S))}),v&&o.jsxs("div",{className:"settings-confirm",role:"alert",children:[o.jsx("span",{children:w("settings.panels.consoleConfirm",{count:a})}),o.jsx("button",{className:"link-button",onClick:()=>{h(!1),d()},children:w("settings.panels.consoleConfirmYes")}),o.jsx("button",{className:"link-button",onClick:()=>h(!1),children:w("common.cancel")})]}),o.jsx("p",{className:"modal-hint",children:w("settings.panels.cliAlways")}),b===null?o.jsx("p",{className:"modal-hint",children:w("settings.oldServer")}):o.jsxs(o.Fragment,{children:[o.jsx("h3",{className:"modal-section",children:w("settings.section.console")}),b.consoleShells.length===0?o.jsx("p",{className:"modal-hint",children:w("console.noShell")}):o.jsxs("div",{className:"settings-choices",role:"radiogroup","aria-label":w("settings.section.console"),children:[R.map(S=>o.jsxs("label",{className:"settings-choice",children:[o.jsx("input",{type:"radio",name:"console-shell",checked:m===S.id,disabled:!E,onChange:()=>{_(S.id),k.setConsoleShell(S.id)}}),S.label]},S.id)),o.jsx("p",{className:"modal-hint",children:w("settings.console.hint")})]}),o.jsx("h3",{className:"modal-section",children:w("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),B=S.available||I;return o.jsxs("li",{className:"settings-cli",children:[B?o.jsxs("label",{className:"settings-choice",children:[o.jsx("input",{type:"checkbox",checked:!L,disabled:!E,onChange:F=>{const D=PL(f,S.id,!F.target.checked);p(D),k.setDisabledAgents(D)}}),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??"":w(I?"settings.cli.disabled":"settings.cli.notInstalled")}),!B&&o.jsx("a",{className:"link-button",href:S.installUrl,target:"_blank",rel:"noreferrer noopener",children:w("settings.cli.install")})]},S.id)})}),o.jsx("p",{className:"modal-hint",children:w("settings.cli.hint")}),T&&o.jsx("p",{className:"settings-restart",children:w("settings.cli.restart")}),i&&o.jsx("p",{className:"modal-hint",children:w("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:w("common.close")})]})]}),(c!==null||g!==null)&&o.jsxs(o.Fragment,{children:[o.jsx("h3",{className:"modal-section",children:w("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:w("settings.more.open",{name:Ri()})}),g!==null&&o.jsx("button",{className:"primary-button primary-button-small",onClick:g,children:w("settings.more.open",{name:w("app.header.remoteAccess")})})]})]})]})]})})}function FL(t){const[e,s]=M.useState(null),[a,d]=M.useState(null);M.useEffect(()=>t.onMessage(c=>{switch(c.type){case"settings.status":s(c.settings),d(null);break;case"error":if(c.code!=="settings-failed")break;d(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(()=>d(null),[]);return{status:e,problem:a,setConsoleShell:k,setDisabledAgents:y,dismissProblem:i}}function HL({status:t,agents:e,indexReady:s,problem:a,covered:d,onMeasure:k,onSetEnabled:y,onChangeDir:i,onReveal:c,onDismissProblem:g,onClose:v}){return M.useEffect(()=>{if(d)return;const h=b=>{b.key==="Escape"&&(b.preventDefault(),b.stopPropagation(),v())};return window.addEventListener("keydown",h,!0),()=>window.removeEventListener("keydown",h,!0)},[d,v]),o.jsx("div",{className:"modal-backdrop",onClick:v,children:o.jsxs("div",{className:"modal vault-modal",role:"dialog","aria-label":Ri(),onClick:h=>h.stopPropagation(),children:[o.jsxs("header",{className:"modal-header",children:[o.jsx("span",{className:"modal-title",children:Ri()}),t!==null&&o.jsx("span",{className:`vault-state${t.enabled?" vault-state-on":""}`,children:Cx(t)}),o.jsx("button",{className:"icon-button",onClick:v,title:w("common.closeEsc"),children:"×"})]}),o.jsxs("div",{className:"modal-body",children:[o.jsx("p",{className:"vault-lead",children:_x()}),o.jsx("p",{className:"modal-hint",children:wx()}),t===null?o.jsx("p",{className:"modal-hint",children:w("vault.dialog.waiting")}):o.jsx(UL,{status:t,agents:e,indexReady:s,onMeasure:k,onSetEnabled:y,onChangeDir:i,onReveal:c}),a!==null&&o.jsxs("div",{className:"vault-problem",role:"alert",children:[o.jsx("span",{children:a}),o.jsx("button",{className:"icon-button",onClick:g,title:w("common.dismissNotice"),children:"×"})]})]})]})})}function UL({status:t,agents:e,indexReady:s,onMeasure:a,onSetEnabled:d,onChangeDir:k,onReveal:y}){const i=Tx(t,s),c=Lx(t),g=Ex(t),v=t.measurement===null?null:Mx(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:w("vault.dialog.inFolder")}),o.jsxs("p",{className:"vault-summary",children:[wv(t.sessions)," · ",_n(t.bytes),t.lastPassAt!==null&&o.jsxs(o.Fragment,{children:[" · ",w("vault.dialog.lastPass",{when:$n(t.lastPassAt)})]}),t.pending>0&&o.jsxs(o.Fragment,{children:[" · ",w("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:w("vault.dialog.sizeSection")}),o.jsxs("div",{className:"vault-actions",children:[o.jsx("button",{className:"link-button vault-measure",onClick:a,disabled:i!==null,title:i??w("vault.dialog.measureTitle"),children:t.state==="measuring"?w("vault.state.measuring"):w(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:w("vault.dialog.table.sessions")}),o.jsx("th",{children:w("vault.dialog.table.size")}),o.jsx("th",{children:w("vault.dialog.table.images")}),o.jsx("th",{title:w("vault.dialog.table.archivedTitle"),children:w("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:_n(b.bytes)}),o.jsx("td",{title:b.images>0?_n(b.imageBytes):void 0,children:b.images}),o.jsx("td",{children:b.skippedArchived})]},b.agent)),o.jsxs("tr",{children:[o.jsx("td",{children:w("vault.dialog.table.memory",{count:v.memoryProjects})}),o.jsx("td",{}),o.jsx("td",{children:_n(v.memoryBytes)}),o.jsx("td",{}),o.jsx("td",{})]})]}),o.jsx("tfoot",{children:o.jsxs("tr",{children:[o.jsx("td",{children:w("vault.dialog.table.total")}),o.jsx("td",{children:v.total.sessions}),o.jsx("td",{children:_n(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:[g==="enabled"&&o.jsxs(o.Fragment,{children:[o.jsx("button",{className:"link-button",onClick:()=>d(!1),children:w("vault.dialog.turnOff")}),o.jsx("span",{className:"modal-hint",children:w("vault.dialog.turnOffHint")})]}),(g==="measured"||g==="existing")&&o.jsxs(o.Fragment,{children:[o.jsx("button",{className:"primary-button",onClick:()=>d(!0),title:w(g==="existing"?"vault.dialog.activateExistingTitle":"vault.dialog.activateMeasuredTitle"),children:w("vault.dialog.activate")}),o.jsx("span",{className:"modal-hint",children:w(g==="existing"?"vault.dialog.activateExistingHint":"vault.dialog.activateMeasuredHint")})]}),g==="needs-measure"&&o.jsx("span",{className:"modal-hint",children:w("vault.dialog.needsMeasure",{activate:w("vault.dialog.activate")})})]}),o.jsx("h3",{className:"modal-section",children:w("vault.dialog.folderSection")}),o.jsx("p",{className:"vault-dir",title:t.dir,children:t.dir}),t.isDefaultDir&&o.jsx("p",{className:"modal-hint",children:w("vault.dialog.defaultDir")}),o.jsxs("div",{className:"vault-actions",children:[o.jsx("button",{className:"link-button",onClick:k,disabled:c!==null,title:c??w("vault.dialog.changeDirTitle"),children:w("vault.dialog.changeDir")}),y!==null&&o.jsx("button",{className:"link-button",onClick:y,title:w("vault.dialog.openFolderTitle"),children:w("vault.dialog.openFolder")})]}),t.previousDir!==null&&o.jsx("p",{className:"modal-hint",children:Nx(t.previousDir)}),t.lastError!==null&&o.jsxs(o.Fragment,{children:[o.jsx("h3",{className:"modal-section",children:w("vault.dialog.lastError")}),o.jsx("p",{className:"vault-error",children:At(t.lastError)})]})]})}function $L({preview:t,files:e,running:s,error:a,onConfirm:d,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=w("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:w("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:w("rewind.intro")}),e.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("h3",{className:"modal-section",children:w("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:w("rewind.filesHint")})]}),a!==null&&o.jsx("p",{className:"rewind-error",children:a}),o.jsxs("div",{className:"rewind-actions",children:[e.length>0?o.jsxs(o.Fragment,{children:[o.jsx("button",{className:"primary-button",disabled:s,onClick:()=>d("conversation-and-code"),children:w("rewind.undoAll")}),o.jsx("button",{className:"primary-button",disabled:s,onClick:()=>d("conversation"),children:w("rewind.undoConversation")})]}):o.jsx("button",{className:"primary-button",disabled:s,onClick:()=>d("conversation"),children:w("rewind.undo")}),o.jsx("button",{className:"link-button",onClick:k,children:w("common.cancel")}),s&&o.jsx("span",{className:"modal-hint",children:w("rewind.running")})]})]})]})})}function WL(t){const[e,s]=M.useState(null),a=M.useRef(null),d=M.useRef(null),k=M.useCallback(g=>{a.current=g,s(g)},[]);M.useEffect(()=>t.onMessage(g=>{const v=d.current;if(v!==null){if(g.type==="agent.rewound"&&g.requestId===v){d.current=null,k(null);return}if(g.type==="error"&&g.requestId===v){d.current=null;const h=a.current;h!==null&&k({...h,phase:"failed",error:At(g.text)})}}}),[t,k]);const y=M.useCallback((g,v)=>{d.current=null,k({terminalId:g,eventId:v,phase:"confirm",error:null})},[k]),i=M.useCallback(g=>{const v=a.current;if(v===null||v.phase==="running")return;const h=crypto.randomUUID();d.current=h,t.send({type:"agent.rewind",terminalId:v.terminalId,eventId:v.eventId,restore:g,requestId:h}),k({...v,phase:"running",error:null})},[t,k]),c=M.useCallback(()=>{d.current=null,k(null)},[k]);return{state:e,open:y,confirm:i,close:c}}const Mm={connecting:"app.status.connecting",open:"app.status.open",reconnecting:"app.status.reconnecting",failed:"app.status.failed",revoked:"app.status.revoked"},Am=320,zL=1400,qL=640,Im=200,jm=560,VL=270,KL=120,GL=720,YL=260,Dm="agent-workbench.panel-width",Pm="agent-workbench.panel-visible",Om="agent-workbench.panel-tab",Du="agent-workbench.panel-expanded",Pu="agent-workbench.sidebar-visible",Bm="agent-workbench.sidebar-width",Ou="agent-workbench.console-visible",Fm="agent-workbench.console-height",Hm="agent-workbench.marker-notice-dismissed",Um="agent-workbench.hidden-hint-shown";function XL(){var Zo,Ss;const t=Mo(),e=bL(),{connection:s,status:a,agents:d,defaultAgent:k,capabilitiesFor:y,offerAgentChoice:i,cliAvailable:c,cliVersion:g,cliMissingMessage:v,platform:h,defaultCwd:b,environmentNotice:E,shellName:N,terminals:_,archiveSessions:u,shells:p,pendingOpens:m,activeTerminalId:f,projects:x,indexStatus:j,error:T,dismissError:R,setActiveTerminal:S,openTerminal:L,openShell:I,closeTerminal:B,wakeTerminal:F,waking:D,activity:H,offlineReasons:W,relaunching:G,renameTerminal:Y,reorderTabs:z,refreshIndex:P,refreshAgents:U,continueSession:$,expectTab:K,handoffs:te,dismissHandoff:oe,returnedMessages:we,dismissReturned:me,prefills:X,prefillApplied:V,drafts:Z,remoteClient:ee,fileCheck:ve,fileWrite:Se}=e,Ie=z5(),je=K5(Ie.resolved),Je=M.useMemo(()=>({nameOf:J=>hT(_.find(ke=>ke.terminalId===J)),activate:S}),[_,S]),Ze=mT(H,Je),Ae=gT(),ue=_.find(J=>J.terminalId===f)??null,ht=M.useCallback(J=>{J!==f&&R(),S(J)},[f,R,S]),se=(ue==null?void 0:ue.agent)??null,pe=y(se),Ce=(ue==null?void 0:ue.review)===!0,be=M.useMemo(()=>wb(pe,Ce),[pe,Ce]),ge=d.find(J=>J.id===se)??null,Le=M.useMemo(()=>{if(ue===null||se===null)return null;for(const J of x){const ke=J.sessions.find(st=>st.agent===se&&st.sessionId===ue.sessionId);if(ke!==void 0)return hr(ke.title,ke.titleSource)}return null},[ue,se,x,t]),ce=M.useMemo(()=>mb(_,x.flatMap(J=>J.sessions)),[_,x]),Ye=(ge==null?void 0:ge.statusLine)??null,We=H5(s),He=M.useMemo(()=>{var J;return se===null?[]:((J=We.find(ke=>ke.agent===se))==null?void 0:J.windows)??[]},[We,se]),Oe=(ge==null?void 0:ge.planLimitsSetup)??null,Ue=(ue==null?void 0:ue.cwd)??b,qe=M.useMemo(()=>i?zb(_,Ue,h,d,k):null,[i,_,Ue,h,d,k]),St=M.useMemo(()=>up(m,Ue,h),[m,Ue,h]),Pt=St?Sg():null,$t=F5(s),dt=oL(s),[tn,Vt]=M.useState(!1),fe=bT(s),[et,Xe]=M.useState(!1),lt=SC(),de=IL(),[Ke,tt]=M.useState(!1),ye=M.useCallback(()=>tt(!1),[]),[ct,xt]=M.useState(()=>Nt(vp,"chat",Kk)),mt=M.useMemo(()=>Gk({hasTab:ue!==null,plansAvailable:be.plansAvailable,hidden:de.hidden}),[ue,be.plansAvailable,de.hidden]),De=Yk(ct,mt),at=M.useCallback(J=>{xt(J),yt(vp,J)},[]),bt=M.useRef(iL);M.useEffect(()=>{if(bt.current!==null)return s.onMessage(J=>{if(J.type!=="terminal.list"||bt.current===null)return;const ke=bt.current;bt.current=null,J.terminals.some(st=>st.terminalId===ke&&st.kind==="agent")&&S(ke)})},[s,S]);const Xt=n5(s),wn=US(d,dt.status),[Ln,An]=M.useState(null),pr=M.useRef(0),hs=M.useCallback(J=>{An(ke=>ke!==null&&ke.seq===J?null:ke)},[]),ds=(J,ke)=>{const st=tx(J,{projects:x,terminals:_,platform:h,canResume:yn=>ip(d,yn)}),Qt=()=>{ke.length!==0&&(pr.current+=1,An({query:ke,seq:pr.current}))};switch(st.kind){case"activate":ht(st.terminalId),Qt();break;case"resume":st.session.archived&&u([st.session.sessionId],!1),L({cwd:st.cwd,resumeSessionId:st.session.sessionId,agent:st.session.agent,label:hr(st.session.title,st.session.titleSource)}),Qt();break;case"copy":dt.openSession(J.agent,J.sessionId);break}},Us=M.useMemo(()=>new Set(_.map(J=>J.sessionId).filter(J=>J.length>0)),[_]),[nn,Mr]=M.useState(()=>Nt(Pm,!0,J=>J==="true")),[Ar,$s]=M.useState(()=>Nt(Om,"cli",J=>J==="git"||J==="files"||J==="cli"||J==="plans"||J==="memory"?J:J==="conversation"?"cli":null)),[tr,fs]=M.useState(()=>Nt(Dm,qL,J=>{const ke=Number.parseInt(J,10);return Number.isFinite(ke)?Math.max(ke,Am):null})),[ps,ms]=M.useState(()=>Nt(Du,!1,J=>J==="true")),[gs,Ws]=M.useState(()=>Nt(Pu,!0,J=>J==="true")),[Et,zs]=M.useState(()=>Nt(Bm,VL,J=>{const ke=Number.parseInt(J,10);return Number.isFinite(ke)?Math.min(jm,Math.max(Im,ke)):null})),[mr,_e]=M.useState(()=>Nt(Ou,!1,J=>J==="true")),[Be,it]=M.useState(()=>Nt(Fm,YL,J=>{const ke=Number.parseInt(J,10);return Number.isFinite(ke)?ke:null})),[Ct,pt]=M.useState(()=>Nt(Hm,!0,J=>J!=="true")),[Ot,Wn]=M.useState(!1),Kt=FL(s),[vl,vs]=M.useState(!1),Ir=Kt.status!==null?Kt.status.shellName:N,[_s,ws]=M.useState(null),[ys,jr]=M.useState(!1);M.useEffect(()=>{Ye===null&&jr(!1)},[Ye]);const[_l,ji]=M.useState(!1);M.useEffect(()=>{Oe===null&&ji(!1)},[Oe]);const[bs,gr]=M.useState(null),nr=nn&&ue!==null,zn=Mb(Ar,be.plansAvailable,de.hidden),Io=mr&&de.isVisible("console"),rr=ue!==null?nn||Io:nn,gt=ps&&ue!==null,qn=M.useMemo(()=>ue===null?[]:p.filter(J=>J.cwd===ue.cwd),[p,ue]),[jo,qs]=M.useState(null),vr=qn.find(J=>J.terminalId===jo)??qn[0]??null,ks=De==="cli"?f:De==="console"?(vr==null?void 0:vr.terminalId)??null:null,Do=M.useCallback(J=>{ks!==null&&s.send({type:"input",terminalId:ks,data:J})},[s,ks]),Tt=_S(s,f),Dr=_T(s,H),Vn=lt?ue!==null:nr,sr=lt?De==="files":nr&&zn==="files",In=j5(s,Vn?f:null),Pr=mL(s,(lt?De==="git":nr&&zn==="git")?f:null,In.status.updatedAt),wt=gL(s,K,S),Bt=vL(s,K,S),{closeChanges:Di}=Bt;M.useEffect(()=>Di(),[f,Di]);const jn=J=>J.split(/[\\/]/).filter(ke=>ke.length>0).pop()??J,Po=J=>{var ke;return((ke=d.find(st=>st.id===J))==null?void 0:ke.label)??J},Oo={rows:Pr.rows,kept:Pr.kept,onDeleteBranch:J=>wt.openDeleteBranch(J.id,J.branch),onNew:()=>{if(ue===null)return;const J=Bs(ue);wt.openCreate({kind:"terminal",terminalId:ue.terminalId},J,jn(J))},onOpen:J=>{const ke=dr(J.path,h),st=_.find(Qt=>dr(Qt.cwd,h)===ke&&!Qt.review);st!==void 0?ht(st.terminalId):L({cwd:J.path})},onRemove:J=>wt.openRemove(J.id,J.branch??jn(J.path)),changes:Bt.changes,onViewChanges:J=>Bt.openChanges(J.id,J.branch??jn(J.path)),onOpenChangeDiff:Bt.openChangeDiff,onCloseChangeDiff:Bt.closeChangeDiff,onCloseChanges:Bt.closeChanges,onRequestReview:J=>Bt.openReview(J.id,J.branch??jn(J.path),ue===null?J.path:Bs(ue)),onSendReview:J=>Bt.sendReview(J.id),onShowReviewer:J=>ht(J),onCatchUp:J=>Bt.catchUp(J.id),onIntegrate:J=>Bt.openIntegrate(J.id,J.branch??jn(J.path)),agentLabel:Po},Ks=(()=>{var Qt;const J=wt.create;if(J===null)return null;const{source:ke}=J;if(ke.kind==="terminal")return((Qt=_.find(yn=>yn.terminalId===ke.terminalId))==null?void 0:Qt.agent)??k;const st=x.find(yn=>yn.key===ke.projectKey);return st===void 0?k:op(_,st,h,d,k)})(),Bo=t5(s,sr?f:null),Fo=r5(s,f),Or=k5(s,_,f,Se),_r=B5(s,Vn?f:null),Br=lt?De==="cli":nr&&zn==="cli",Cs=Tt.usage.lastModel,Ho=vb(Tt.events,Tt.usage.lastEffort,(ue==null?void 0:ue.launchedAt)??null),Uo=Cs??Tt.defaults.model,Gs=Ho??Tt.defaults.effort,Ys=Cs===null&&Uo!==null,Pi=Ho===null&&Gs!==null,Oi=ZE(s,f,Br),an=f===null?null:H.get(f)??null,Xs=ok(pe,Tt.openToolCall,(ge==null?void 0:ge.label)??null,(ue==null?void 0:ue.alive)??!1,an),Fr=ak({offlineReason:f===null?null:W.get(f)??null,alive:(ue==null?void 0:ue.alive)??!1,relaunching:f!==null&&G.has(f)}),Qs=Fr===null?null:lk((ge==null?void 0:ge.label)??null),Js=Qs??Xs??dk(pe,Tt.waitingFor,(ue==null?void 0:ue.alive)??!1),Zs=!Wm(pe,an),$o=M.useMemo(()=>bg(d,se),[d,se]),ln=ue!==null&&rk(se,ue.sessionId,pe),mn=f===null?null:te.get(f)??null,Bi=mn===null?null:{text:Xb(Ro(mn.sourceAgent,d),mn.includedTurns,mn.totalTurns,mn.totalTurnsIsMinimum),status:mn.prefillReason!==null?ek(mn.prefillReason):mn.delivery==="sending"&&Tt.events.length===0?Qb():null},Hr=f===null?void 0:we.get(f),wl=Bi??(Hr===void 0?null:{text:Hr==="stopped-early"?Zb():Jb((ge==null?void 0:ge.label)??null),status:null}),ei=M.useCallback(J=>{oe(J),me(J)},[oe,me]),ir=M.useCallback(()=>{Mr(J=>{const ke=!J;return yt(Pm,String(ke)),ke})},[]),Ur=M.useCallback(()=>{Ws(J=>{const ke=!J;return yt(Pu,String(ke)),ke})},[]),$r=M.useCallback(()=>{lt||(Ws(!1),yt(Pu,"false"))},[lt]),Wo=M.useCallback(()=>{_e(J=>{const ke=!J;return yt(Ou,String(ke)),ke})},[]),Fi=M.useCallback(J=>{$s(J),yt(Om,J)},[]),yl=M.useCallback(()=>{ms(J=>{const ke=!J;return yt(Du,String(ke)),ke})},[]),ti=WL(s),{open:ni}=ti,bl=M.useCallback(J=>{f!==null&&ni(f,J)},[ni,f]),kl=M.useCallback(J=>{f!==null&&s.send({type:"input",terminalId:f,data:`${J} `})},[s,f]),ri=M.useRef(null),Cl=M.useCallback(J=>{var ke;return(ke=ri.current)==null?void 0:ke.call(ri,J,!lt)},[lt]),zo=J=>{if(Or.files.open({key:J,title:J.split("/").pop()??J}),lt){at("files");return}nr||ir(),Fi("files")},Hi=M.useRef(zo);Hi.current=zo;const Sl=M.useCallback(J=>Hi.current(J),[]),xl=M.useMemo(()=>_.map(J=>J.terminalId),[_]),El=I5({connection:s,enabled:ve&&de.isVisible("files"),terminalId:f,cwd:(ue==null?void 0:ue.cwd)??"",platform:h,events:Tt.events,liveTerminalIds:xl,onOpen:Sl}),Ui=M.useCallback(J=>{f!==null&&s.send({type:"agent.submit",terminalId:f,text:J,images:[],keepDraft:!0})},[s,f]),Wr=db(se),Tl=M.useMemo(()=>{if(Wr===null||ue===null)return null;const J=ue.alive?an==="busy"||an==="waiting"?w("meter.compactBusy"):null:w("meter.compactNoCli");return{command:Wr,blockedReason:J,onCompact:()=>Ui(Wr)}},[Wr,ue,an,Ui,t]),Ll=M.useCallback(J=>{f!==null&&s.send({type:"files.reveal",terminalId:f,path:J})},[s,f]),Nl=M.useCallback(()=>{_e(!0),yt(Ou,"true");const J=i1({cwd:(ue==null?void 0:ue.cwd)??null,shellCwds:p.map(ke=>ke.cwd),shellAvailable:Ir!==null});J!==null&&I(J)},[ue,p,Ir,I]),si=M.useCallback(J=>{if(J==="console")for(const ke of p)B(ke.terminalId);de.setVisible(J,!1),!Nt(Um,!1,ke=>ke==="true")&&(yt(Um,"true"),ws(J))},[p,B,de]),Rl=M.useCallback(()=>{for(const J of p)B(J.terminalId);de.setVisible("console",!1)},[p,B,de]),qo=M.useRef(new Set);M.useEffect(()=>{const J=qn.filter(st=>!qo.current.has(st.terminalId));for(const st of qn)qo.current.add(st.terminalId);const ke=J[J.length-1];ke!==void 0&&qs(ke.terminalId)},[qn]);const Ml=M.useCallback(()=>{ue!==null&&I(ue.cwd)},[ue,I]),Al=nl({min:Am,max:zL,value:tr,measure:M.useCallback(J=>window.innerWidth-J.clientX,[]),onChange:fs,onCommit:M.useCallback(J=>yt(Dm,String(J)),[]),onStart:M.useCallback(()=>{ms(!1),yt(Du,"false")},[])}),Il=nl({min:Im,max:jm,value:Et,measure:M.useCallback(J=>J.clientX,[]),onChange:zs,onCommit:M.useCallback(J=>yt(Bm,String(J)),[])}),Vo=M.useRef(0),jl=nl({min:KL,max:GL,value:Be,measure:M.useCallback(J=>Math.round(Vo.current-J.clientY),[]),onChange:it,onCommit:M.useCallback(J=>yt(Fm,String(J)),[]),onStart:M.useCallback(J=>{const ke=J.currentTarget.nextElementSibling;Vo.current=ke===null?window.innerHeight:J.clientY+ke.getBoundingClientRect().height},[])}),$i=M.useCallback(()=>{pt(!1),yt(Hm,"true")},[]),wr=M.useCallback(J=>{if(_.length===0)return;const st=(_.findIndex(yn=>yn.terminalId===f)+J+_.length)%_.length,Qt=_[st];Qt!==void 0&&ht(Qt.terminalId)},[_,f,ht]),Ko=M.useRef(null),ii=M.useRef(null);M.useEffect(()=>{f!==ii.current&&(Ko.current=ii.current,ii.current=f)},[f]);const Wi=M.useCallback(()=>{const J=Ko.current;J===null||J===f||_.some(ke=>ke.terminalId===J)&&ht(J)},[f,_,ht]);M.useEffect(()=>{const J=ke=>{if(ke.key!=="Tab"||!ke.shiftKey||ke.altKey||ke.ctrlKey||ke.metaKey)return;const st=document.activeElement;st instanceof Element&&st.closest(".xterm")!==null||(ke.preventDefault(),ke.stopPropagation(),Wi())};return window.addEventListener("keydown",J,!0),()=>window.removeEventListener("keydown",J,!0)},[Wi]),M.useEffect(()=>{const J=ke=>{if(!ke.altKey||ke.ctrlKey||ke.metaKey)return;const st=ke.key.toLowerCase();if(st==="t"){c&&b.length>0&&!St&&(ke.preventDefault(),ke.stopPropagation(),L({cwd:(ue==null?void 0:ue.cwd)??b}));return}if(st==="w"){f!==null&&(ke.preventDefault(),ke.stopPropagation(),B(f));return}if(st==="p"){ke.preventDefault(),ke.stopPropagation(),ir();return}if(st==="arrowright"||st==="pagedown"){ke.preventDefault(),ke.stopPropagation(),wr(1);return}(st==="arrowleft"||st==="pageup")&&(ke.preventDefault(),ke.stopPropagation(),wr(-1))};return window.addEventListener("keydown",J,!0),()=>window.removeEventListener("keydown",J,!0)},[ue,f,c,B,wr,b,St,L,ir]);const Go=ue===null?w("app.panel.name"):ue.label.length>0?ue.label:ue.cwd.split(/[\\/]/).filter(J=>J.length>0).pop()??ue.cwd,zi=o.jsx(Fx,{projects:x,indexStatus:j,disabled:!c,onOpenProject:(J,ke)=>{ye(),L({cwd:J,...ke!==void 0?{agent:ke}:{},onOpened:$r})},agents:d,offerAgentChoice:i,agentForProject:J=>op(_,J,h,d,k),onOpenSession:(J,ke)=>{ye(),L({cwd:J,resumeSessionId:ke.sessionId,agent:ke.agent,label:hr(ke.title,ke.titleSource)})},canResume:J=>ip(d,J),platform:h,onRefresh:P,openSessionIds:Us,openBlocked:J=>up(m,J,h),onArchive:u,onHide:lt?ye:Ur,width:Et,onNewProject:()=>{ye(),gr("project")},vault:dt.status,onOpenVault:()=>{ye(),Vt(!0)},onOpenVaultSession:ee?null:J=>dt.openSession(J.agent,J.sessionId),onExportProject:ee?null:dt.exportProject,exporting:dt.exporting,lastExported:dt.lastExported,onNewWorktree:J=>{ye(),wt.openCreate({kind:"project",projectKey:J.key},J.cwd,jn(J.cwd),$r)},onReopenWorktree:(J,ke)=>{var st;ye(),wt.reopen(J.agent,J.sessionId,ke.cwd,((st=J.worktree)==null?void 0:st.branch)??"")},onContinueSession:(J,ke)=>{ye(),$({agent:J.agent,sessionId:J.sessionId},ke,lp(hr(J.title,J.titleSource)))},globalSearch:wn?{...Xt,vaultEnabled:((Zo=dt.status)==null?void 0:Zo.enabled)===!0}:null,onOpenSearchHit:(J,ke)=>{ye(),ds(J,ke)}}),qi=o.jsx("div",{className:"chat-stack",children:_.length===0?o.jsxs("div",{className:"empty-state",children:[o.jsx("p",{children:w("app.empty.noTabs")}),o.jsx("p",{className:"empty-hint",children:w("app.empty.hint")}),c&&b.length>0&&o.jsx("button",{className:"primary-button",onClick:()=>L({cwd:b}),disabled:St,title:Pt??void 0,children:St?w("app.empty.opening"):w("app.empty.newSession",{cwd:b})})]}):o.jsx(TS,{view:Tt,terminalId:f,threadFont:Ae,fileLinks:El,onRewind:be.rewind&&(ue==null?void 0:ue.alive)===!0?bl:void 0,rewindBlocked:an!=="idle",forceSendAvailable:be.forceSend&&(ue==null?void 0:ue.alive)===!0,queueEditAvailable:be.editQueue&&(ue==null?void 0:ue.alive)===!0,questionsAnswerable:be.questionsAnswerable,contextWindowSource:be.contextWindowSource,instructionsFile:_b(se),onGoToCli:()=>{if(lt){at("cli");return}nr||ir(),Fi("cli")},cliPresence:ue===null||ue.alive?"live":ue.sleeping?"sleeping":"exited",exitCode:(ue==null?void 0:ue.exitCode)??null,waking:f!==null&&D.has(f),onWakeCli:()=>{f!==null&&F(f)},discovering:ln,continueTargets:$o,continueBlockedReason:Yb((ue==null?void 0:ue.sessionId)??"",ln,Tt.events.length>0),onContinue:ue===null||se===null?void 0:J=>$({agent:se,sessionId:ue.sessionId},J,lp(Le??ue.label)),searchRequest:Ln,onSearchRequestApplied:hs,toolCallNotice:Xs,serverClosed:Fr===null||Qs===null?null:{state:Fr,text:Qs},statusLineState:(Ye==null?void 0:Ye.state)??null,onConfigureStatusLine:Ye===null?void 0:()=>jr(!0),activity:an,receipt:f===null?null:Dr.receipts.get(f)??null,clock:f===null?null:Dr.clocks.get(f)??null,planWindows:He,planSetupState:(Oe==null?void 0:Oe.state)??null,onConfigurePlanLimits:Oe===null?void 0:()=>ji(!0),compactAction:Tl})}),yr=o.jsx(o.Fragment,{children:ue!==null&&o.jsx(IC,{connection:s,drafts:Z,terminalId:f,alive:ue.alive,sleeping:ue.sleeping,projectColor:Hs(Bs(ue)),activity:H.get(ue.terminalId),imagesAllowed:be.imagesAllowed,blockedReason:Js,prefills:X,onPrefillApplied:V,notice:wl,onDismissNotice:f===null?void 0:()=>ei(f),onSubmitted:(J,ke,st)=>{ei(J);const{events:Qt}=Tt,yn=J===f?Qt[Qt.length-1]:void 0;Dr.track(J,ke,(yn==null?void 0:yn.eventId)??null,st)},fontSize:Ae.size,insertRef:ri,onEditQueue:be.editQueue&&ue.alive&&Tt.queue.length>0&&Tt.queue.every(J=>J.forced!==!0)&&Tt.waitingFor===null&&!Tt.editingQueue?Tt.editQueue:void 0,leading:be.modeCycle===null?void 0:o.jsx(wk,{mode:Tt.permissionMode,cycle:be.modeCycle,disabled:!ue.alive,waitingFor:Tt.waitingFor,statusKnown:Zs,onChange:Tt.setPermissionMode}),controls:be.models===null&&be.efforts===null?void 0:o.jsx(_k,{models:be.models,efforts:be.efforts,model:Uo,effort:Gs,modelProvisional:Ys,effortProvisional:Pi,savesChoice:gb(se),effortCommandName:hb(se),disabled:!ue.alive,onCommand:Ui})})}),Yo=ue===null?null:o.jsx(KE,{tab:lt?_p(De)??zn:zn,plansAvailable:be.plansAvailable,hiddenTabs:de.hidden,hidden:lt?_p(De)===null:!nn,onTabChange:lt?at:Fi,title:Go,cwd:ue.cwd,colorCwd:Bs(ue),platform:h,cli:o.jsx("div",{className:"terminal-stack",children:_.map(J=>o.jsx(qg,{terminalId:J.terminalId,connection:s,active:J.terminalId===f,theme:je.resolved,autoFocus:!1},J.terminalId))}),cliUnseen:Oi,expanded:ps,onToggleExpanded:yl,git:In,worktrees:Oo,files:Bo,plans:Fo,documents:Or,memory:_r,onInsert:be.fileMentions&&ue.alive?kl:void 0,onInsertPath:Cl,onReveal:ee?null:Ll,onHide:ir}),Xo=ue===null?null:o.jsx(s1,{connection:s,shells:qn,activeShellId:(vr==null?void 0:vr.terminalId)??null,cwd:ue.cwd,shellName:Ir,theme:je.resolved,onSelect:qs,onOpen:Ml,onCloseShell:B,onCollapse:lt?()=>at("chat"):Wo,onHide:lt?void 0:()=>si("console"),hideCount:p.length}),Qo=de.isVisible("notes")?o.jsx(GT,{notes:$t,fill:lt||ue===null,onHide:lt?void 0:()=>si("notes"),onSendNote:ue===null||!be.noteSendable?null:J=>{const ke=ue.cwd;L({cwd:ke,...ue.agent!==null?{agent:ue.agent}:{},onOpened:st=>{s.send({type:"notes.send",noteId:J,terminalId:st.terminalId}),lt&&at("chat")}})},sendTargetCwd:(ue==null?void 0:ue.cwd)??null}):null,Jo=ue===null||!de.isVisible("console")?null:o.jsx(o.Fragment,{children:Io?o.jsxs(o.Fragment,{children:[nn&&o.jsx("div",{className:"hdivider",...jl,title:w("app.divider.consoleHeight")}),o.jsx("div",{className:"console-slot",style:nn?{height:`${Be}px`}:{flex:"1 1 auto"},children:Xo})]}):o.jsxs("div",{className:"strip-collapsed-row",children:[o.jsxs("button",{className:"strip-collapsed",onClick:Nl,title:Ir===null?w("console.openAnyIn",{cwd:ue.cwd}):w("console.openIn",{shell:Ir,cwd:ue.cwd}),children:[o.jsx("span",{className:"strip-collapsed-arrow",children:"▸"}),o.jsx("span",{children:Ir??w("console.name")}),qn.length>0&&o.jsx("span",{className:"strip-collapsed-count",children:qn.length})]}),o.jsx(ol,{title:w("settings.hide.console"),onHide:()=>si("console"),confirmText:p.length===0?null:w("settings.panels.consoleConfirm",{count:p.length})})]})}),Vi=o.jsxs(o.Fragment,{children:[a==="revoked"&&o.jsx("div",{className:"banner banner-error",children:w("app.banner.revoked")}),_s!==null&&o.jsxs("div",{className:"banner banner-notice",children:[o.jsx("span",{children:w("settings.hiddenHint",{name:w(_s==="console"?"console.name":"notes.name")})}),o.jsx("button",{className:"banner-close",onClick:()=>ws(null),title:w("common.gotIt"),children:"×"})]}),!c&&v!==null&&o.jsx("div",{className:"banner banner-error banner-lines",children:v}),E==="child-session-marker"&&Ct&&o.jsxs("div",{className:"banner banner-notice",children:[o.jsx("span",{children:on("app.markerNotice",{variable:"CLAUDE_CODE_CHILD_SESSION"})}),o.jsx("button",{className:"banner-close",onClick:$i,title:w("common.gotIt"),children:"×"})]}),T!==null&&o.jsxs("div",{className:"banner banner-error",children:[o.jsx("span",{children:T.message}),o.jsx("button",{className:"banner-close",onClick:R,title:w("common.close"),children:"×"})]}),dt.problem!==null&&!tn&&o.jsxs("div",{className:"banner banner-error",children:[o.jsx("span",{children:dt.problem}),o.jsx("button",{className:"banner-close",onClick:dt.dismissProblem,title:w("common.close"),children:"×"})]}),o.jsx(ux,{})]}),Kn=ti.state,zr=o.jsxs(o.Fragment,{children:[Kn!==null&&o.jsx($L,{preview:SS(Tt.events.find(J=>J.eventId===Kn.eventId)),files:CS(Tt.events,Kn.eventId,(ue==null?void 0:ue.cwd)??""),running:Kn.phase==="running",error:Kn.error,onConfirm:ti.confirm,onClose:ti.close}),ys&&Ye!==null&&ge!==null&&o.jsx(Yp,{info:Ye,agentLabel:ge.label,onRefresh:U,onClose:()=>jr(!1)}),_l&&Oe!==null&&ge!==null&&o.jsx(Yp,{info:Oe,agentLabel:ge.label,purpose:"plan-limits",onRefresh:U,onClose:()=>ji(!1)}),wt.create!==null&&o.jsx(kL,{dialog:wt.create,agents:d,offerAgentChoice:i,agent:Ks,onSubmit:wt.submitCreate,onClose:wt.closeCreate}),wt.remove!==null&&o.jsx(xL,{dialog:wt.remove,onConfirm:wt.confirmRemove,onAskNotes:wt.askNotes,onAskCommit:wt.askCommit,onRetry:wt.retryRemove,onClose:wt.closeRemove}),Bt.review!==null&&o.jsx(EL,{dialog:Bt.review,agents:d,onSubmit:Bt.submitReview,onClose:Bt.closeReview}),Bt.integrate!==null&&o.jsx(SL,{dialog:Bt.integrate,agentLabel:Po,onConfirm:Bt.confirmIntegrate,onRemove:()=>{const J=Bt.integrate;Bt.closeIntegrate(),J!==null&&wt.openRemove(J.worktreeId,J.branch)},onClose:Bt.closeIntegrate}),wt.deleteBranch!==null&&o.jsx(CL,{dialog:wt.deleteBranch,onConfirm:wt.confirmDeleteBranch,onClose:wt.closeDeleteBranch}),vl&&o.jsx(BL,{onClose:()=>vs(!1),terminalTheme:je,panels:de,consoleCount:lt?0:p.length,onHideConsole:Rl,appSettings:Kt,agents:d,remoteClient:ee,onOpenVault:()=>{vs(!1),Vt(!0)},onOpenRemote:fe.status!==null&&!ee?()=>{vs(!1),Xe(!0)}:null}),Ot&&o.jsx(ax,{agent:Ab(se,d,k),onClose:()=>Wn(!1)}),bs==="project"&&o.jsx(qp,{connection:s,title:w("app.picker.project.title"),confirmLabel:w("app.picker.project.confirm"),confirmTitle:J=>w("app.picker.project.confirmTitle",{path:J}),onChoose:(J,ke)=>{gr(null),L({cwd:ke,onOpened:$r})},onClose:()=>gr(null)}),tn&&o.jsx(HL,{status:dt.status,agents:d,indexReady:j.state==="ready",problem:dt.problem,covered:bs==="vault",onMeasure:dt.measure,onSetEnabled:dt.setEnabled,onChangeDir:()=>gr("vault"),onReveal:ee?null:dt.reveal,onDismissProblem:dt.dismissProblem,onClose:()=>Vt(!1)}),et&&fe.status!==null&&!ee&&o.jsx(WT,{status:fe.status,pairing:fe.pairing,phonePairing:fe.phonePairing,phoneStarted:fe.phoneStarted,problem:fe.problem,platform:h,onSetEnabled:fe.setEnabled,onSetPort:fe.setPort,onStartPairing:fe.startPairing,onCancelPairing:fe.cancelPairing,onStartPhonePairing:fe.startPhonePairing,onCancelPhonePairing:fe.cancelPhonePairing,onRenameDevice:fe.renameDevice,onRevokeDevice:fe.revokeDevice,onDismissProblem:fe.dismissProblem,onClose:()=>Xe(!1)}),bs==="vault"&&o.jsx(qp,{connection:s,title:w("app.picker.vault.title"),confirmLabel:w("app.picker.vault.confirm"),confirmTitle:J=>w("app.picker.vault.confirmTitle",{path:J}),onChoose:J=>{dt.chooseDir(J),gr(null)},onClose:()=>gr(null)})]});return lt?o.jsxs("div",{className:"app app-narrow",children:[o.jsx(eL,{banners:Vi,status:a,statusLabel:w(Mm[a]),terminals:_,activeTerminalId:f,activity:H,agents:d,offerAgentChoice:i,newTabAgent:qe,platform:h,canOpen:c&&b.length>0,newTabBlockedTitle:Pt,onSelectTab:ht,onCloseTab:B,onRenameTab:Y,onNewTab:J=>L({cwd:Ue,...J!==void 0?{agent:J}:{}}),drawer:zi,drawerOpen:Ke,onDrawerChange:tt,menu:{cwd:(ue==null?void 0:ue.cwd)??null,cliVersion:g,themeIcon:mm[Ie.preference],themeTitle:pm(Ie.preference),onCycleTheme:Ie.cycle,sound:Ze,remote:fe.status!==null&&!ee?{title:`${w("app.header.remoteAccess")} — ${oh(fe.status.state,fe.status.port)}`,active:Cm(fe.status),onOpen:()=>Xe(!0)}:null,remoteClient:ee,onShortcuts:()=>Wn(!0),onSettings:()=>vs(!0)},view:De,views:mt,onViewChange:at,badges:{changes:Mv(In.status),plans:Fo.plans.length,memory:((Ss=_r.status)==null?void 0:Ss.installed)===!0?_r.status.notes.length:0,cliUnseen:Oi},chat:o.jsxs(o.Fragment,{children:[qi,yr]}),panel:Yo,notes:Qo,console:Xo,onTerminalKey:ks===null?null:Do}),zr]}):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-${a}`,children:w(Mm[a])}),ue!==null&&o.jsx("span",{className:"meta",title:ue.cwd,children:ue.cwd}),o.jsx("span",{className:"header-spacer"}),g!==null&&o.jsx("span",{className:"meta meta-dim",children:w("app.header.cliVersion",{version:g})}),o.jsx("button",{className:"icon-button",onClick:Ie.cycle,title:pm(Ie.preference),children:mm[Ie.preference]}),o.jsx($v,{sound:Ze}),o.jsx(Wv,{notify:Ze.notify}),fe.status!==null&&!ee&&o.jsx("button",{className:`icon-button${Cm(fe.status)?" icon-button-on":""}`,onClick:()=>Xe(!0),title:`${w("app.header.remoteAccess")} — ${oh(fe.status.state,fe.status.port)}`,children:"⇄"}),ee&&o.jsx("span",{className:"remote-badge",title:w("app.header.remoteBadgeTitle"),children:w("app.header.remoteBadge")}),o.jsx("button",{className:"icon-button",onClick:()=>vs(!0),title:w("settings.open"),"aria-label":w("settings.open"),children:"⚙"}),o.jsx("button",{className:"icon-button",onClick:()=>Wn(!0),title:w("app.header.shortcuts"),children:"?"})]}),Vi,o.jsxs("div",{className:"app-body",children:[!gs&&o.jsxs("button",{className:"panel-peek panel-peek-left",onClick:Ur,title:w("app.sidebar.show"),children:[o.jsx("span",{className:"panel-peek-arrow",children:"»"}),o.jsx("span",{className:"panel-peek-label",children:w("app.sidebar.name")})]}),gs&&zi,gs&&o.jsx("div",{className:"divider",...Il,title:w("app.divider.width")}),o.jsxs("main",{className:`workspace${gt&&rr?" workspace-narrow":""}`,children:[o.jsx(JE,{terminals:_,activeTerminalId:f,activity:H,attention:Ze.attention,canOpen:c&&b.length>0,onSelect:ht,onClose:B,onRename:Y,onReorder:z,onNew:J=>L({cwd:Ue,...J!==void 0?{agent:J}:{}}),agents:d,offerAgentChoice:i,newTabAgent:qe,pendingOpens:m,platform:h,newTabBlockedTitle:Pt,sessionTitles:ce}),qi,yr]}),o.jsxs(o.Fragment,{children:[!rr&&o.jsxs("button",{className:"panel-peek",onClick:ir,title:w("app.panel.show"),children:[o.jsx("span",{className:"panel-peek-arrow",children:"«"}),o.jsx("span",{className:"panel-peek-label",children:w("app.panel.name")})]}),rr&&o.jsx("div",{className:"divider",...Al,title:w("app.divider.width")}),o.jsxs("div",{className:`panel-slot${rr?"":" panel-slot-collapsed"}${rr&>?" panel-slot-expanded":""}`,style:rr&&!gt?{width:`${tr}px`}:void 0,children:[ue!==null&&o.jsxs(o.Fragment,{children:[Yo,Jo]}),Qo]})]})]}),zr]})}const Qv=document.getElementById("root");if(Qv===null)throw new Error("Falta el contenedor #root.");const QL=ow.createRoot(Qv);X1().then(()=>QL.render(o.jsx(XL,{})));export{J_ as g};
|