agent-workbench 0.9.1 → 1.0.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 +58 -17
- package/dist/server.js +3005 -1209
- package/dist/web/assets/de-B1H_QM2z.js +6 -0
- package/dist/web/assets/es-DWDjzJiM.js +6 -0
- package/dist/web/assets/fr-CtJ1d2yz.js +6 -0
- package/dist/web/assets/{highlight-BdYEMg2B.js → highlight-BEETev5A.js} +1 -1
- package/dist/web/assets/index-BkANL-o7.js +165 -0
- package/dist/web/assets/index-C2SH0hlx.css +32 -0
- package/dist/web/assets/ja-Cos1eWDW.js +6 -0
- package/dist/web/assets/ko-BQ4C0HzE.js +6 -0
- package/dist/web/assets/pt-BR-Cmvs9M-D.js +6 -0
- package/dist/web/assets/ru-5xVwlwKl.js +6 -0
- package/dist/web/assets/zh-CN-B3ZlV59h.js +6 -0
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/web/assets/de-C678otZQ.js +0 -5
- package/dist/web/assets/es-CPhm39HJ.js +0 -5
- package/dist/web/assets/fr-CXsDqneg.js +0 -5
- package/dist/web/assets/index-BYaXyFep.css +0 -32
- package/dist/web/assets/index-DjQtvUDg.js +0 -163
- package/dist/web/assets/ja-DVeeRhCP.js +0 -5
- package/dist/web/assets/ko-DozzP6h6.js +0 -5
- package/dist/web/assets/pt-BR-DrTp_uEs.js +0 -5
- package/dist/web/assets/ru-CyrqdjsW.js +0 -5
- package/dist/web/assets/zh-CN-EUpCRWqV.js +0 -5
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
var rb=Object.defineProperty;var sb=(t,e,r)=>e in t?rb(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Ut=(t,e,r)=>sb(t,typeof e!="symbol"?e+"":e,r);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))l(a);new MutationObserver(a=>{for(const y of a)if(y.type==="childList")for(const v of y.addedNodes)v.tagName==="LINK"&&v.rel==="modulepreload"&&l(v)}).observe(document,{childList:!0,subtree:!0});function r(a){const y={};return a.integrity&&(y.integrity=a.integrity),a.referrerPolicy&&(y.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?y.credentials="include":a.crossOrigin==="anonymous"?y.credentials="omit":y.credentials="same-origin",y}function l(a){if(a.ep)return;a.ep=!0;const y=r(a);fetch(a.href,y)}})();function ib(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Su={exports:{}},$o={},Eu={exports:{}},bt={};/**
|
|
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 lp;function ob(){if(lp)return bt;lp=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),y=Symbol.for("react.provider"),v=Symbol.for("react.context"),o=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),w=Symbol.for("react.lazy"),d=Symbol.iterator;function k(H){return H===null||typeof H!="object"?null:(H=d&&H[d]||H["@@iterator"],typeof H=="function"?H:null)}var L={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},M=Object.assign,b={};function h(H,$,Z){this.props=H,this.context=$,this.refs=b,this.updater=Z||L}h.prototype.isReactComponent={},h.prototype.setState=function(H,$){if(typeof H!="object"&&typeof H!="function"&&H!=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,H,$,"setState")},h.prototype.forceUpdate=function(H){this.updater.enqueueForceUpdate(this,H,"forceUpdate")};function _(){}_.prototype=h.prototype;function g(H,$,Z){this.props=H,this.context=$,this.refs=b,this.updater=Z||L}var p=g.prototype=new _;p.constructor=g,M(p,h.prototype),p.isPureReactComponent=!0;var T=Array.isArray,A=Object.prototype.hasOwnProperty,E={current:null},S={key:!0,ref:!0,__self:!0,__source:!0};function x(H,$,Z){var re,we={},_e=null,Q=null;if($!=null)for(re in $.ref!==void 0&&(Q=$.ref),$.key!==void 0&&(_e=""+$.key),$)A.call($,re)&&!S.hasOwnProperty(re)&&(we[re]=$[re]);var Y=arguments.length-2;if(Y===1)we.children=Z;else if(1<Y){for(var te=Array(Y),ee=0;ee<Y;ee++)te[ee]=arguments[ee+2];we.children=te}if(H&&H.defaultProps)for(re in Y=H.defaultProps,Y)we[re]===void 0&&(we[re]=Y[re]);return{$$typeof:t,type:H,key:_e,ref:Q,props:we,_owner:E.current}}function R(H,$){return{$$typeof:t,type:H.type,key:$,ref:H.ref,props:H.props,_owner:H._owner}}function I(H){return typeof H=="object"&&H!==null&&H.$$typeof===t}function D(H){var $={"=":"=0",":":"=2"};return"$"+H.replace(/[=:]/g,function(Z){return $[Z]})}var P=/\/+/g;function F(H,$){return typeof H=="object"&&H!==null&&H.key!=null?D(""+H.key):$.toString(36)}function z(H,$,Z,re,we){var _e=typeof H;(_e==="undefined"||_e==="boolean")&&(H=null);var Q=!1;if(H===null)Q=!0;else switch(_e){case"string":case"number":Q=!0;break;case"object":switch(H.$$typeof){case t:case e:Q=!0}}if(Q)return Q=H,we=we(Q),H=re===""?"."+F(Q,0):re,T(we)?(Z="",H!=null&&(Z=H.replace(P,"$&/")+"/"),z(we,$,Z,"",function(ee){return ee})):we!=null&&(I(we)&&(we=R(we,Z+(!we.key||Q&&Q.key===we.key?"":(""+we.key).replace(P,"$&/")+"/")+H)),$.push(we)),1;if(Q=0,re=re===""?".":re+":",T(H))for(var Y=0;Y<H.length;Y++){_e=H[Y];var te=re+F(_e,Y);Q+=z(_e,$,Z,te,we)}else if(te=k(H),typeof te=="function")for(H=te.call(H),Y=0;!(_e=H.next()).done;)_e=_e.value,te=re+F(_e,Y++),Q+=z(_e,$,Z,te,we);else if(_e==="object")throw $=String(H),Error("Objects are not valid as a React child (found: "+($==="[object Object]"?"object with keys {"+Object.keys(H).join(", ")+"}":$)+"). If you meant to render a collection of children, use an array instead.");return Q}function q(H,$,Z){if(H==null)return H;var re=[],we=0;return z(H,re,"","",function(_e){return $.call(Z,_e,we++)}),re}function K(H){if(H._status===-1){var $=H._result;$=$(),$.then(function(Z){(H._status===0||H._status===-1)&&(H._status=1,H._result=Z)},function(Z){(H._status===0||H._status===-1)&&(H._status=2,H._result=Z)}),H._status===-1&&(H._status=0,H._result=$)}if(H._status===1)return H._result.default;throw H._result}var V={current:null},W={transition:null},O={ReactCurrentDispatcher:V,ReactCurrentBatchConfig:W,ReactCurrentOwner:E};function U(){throw Error("act(...) is not supported in production builds of React.")}return bt.Children={map:q,forEach:function(H,$,Z){q(H,function(){$.apply(this,arguments)},Z)},count:function(H){var $=0;return q(H,function(){$++}),$},toArray:function(H){return q(H,function($){return $})||[]},only:function(H){if(!I(H))throw Error("React.Children.only expected to receive a single React element child.");return H}},bt.Component=h,bt.Fragment=r,bt.Profiler=a,bt.PureComponent=g,bt.StrictMode=l,bt.Suspense=c,bt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=O,bt.act=U,bt.cloneElement=function(H,$,Z){if(H==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+H+".");var re=M({},H.props),we=H.key,_e=H.ref,Q=H._owner;if($!=null){if($.ref!==void 0&&(_e=$.ref,Q=E.current),$.key!==void 0&&(we=""+$.key),H.type&&H.type.defaultProps)var Y=H.type.defaultProps;for(te in $)A.call($,te)&&!S.hasOwnProperty(te)&&(re[te]=$[te]===void 0&&Y!==void 0?Y[te]:$[te])}var te=arguments.length-2;if(te===1)re.children=Z;else if(1<te){Y=Array(te);for(var ee=0;ee<te;ee++)Y[ee]=arguments[ee+2];re.children=Y}return{$$typeof:t,type:H.type,key:we,ref:_e,props:re,_owner:Q}},bt.createContext=function(H){return H={$$typeof:v,_currentValue:H,_currentValue2:H,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},H.Provider={$$typeof:y,_context:H},H.Consumer=H},bt.createElement=x,bt.createFactory=function(H){var $=x.bind(null,H);return $.type=H,$},bt.createRef=function(){return{current:null}},bt.forwardRef=function(H){return{$$typeof:o,render:H}},bt.isValidElement=I,bt.lazy=function(H){return{$$typeof:w,_payload:{_status:-1,_result:H},_init:K}},bt.memo=function(H,$){return{$$typeof:m,type:H,compare:$===void 0?null:$}},bt.startTransition=function(H){var $=W.transition;W.transition={};try{H()}finally{W.transition=$}},bt.unstable_act=U,bt.useCallback=function(H,$){return V.current.useCallback(H,$)},bt.useContext=function(H){return V.current.useContext(H)},bt.useDebugValue=function(){},bt.useDeferredValue=function(H){return V.current.useDeferredValue(H)},bt.useEffect=function(H,$){return V.current.useEffect(H,$)},bt.useId=function(){return V.current.useId()},bt.useImperativeHandle=function(H,$,Z){return V.current.useImperativeHandle(H,$,Z)},bt.useInsertionEffect=function(H,$){return V.current.useInsertionEffect(H,$)},bt.useLayoutEffect=function(H,$){return V.current.useLayoutEffect(H,$)},bt.useMemo=function(H,$){return V.current.useMemo(H,$)},bt.useReducer=function(H,$,Z){return V.current.useReducer(H,$,Z)},bt.useRef=function(H){return V.current.useRef(H)},bt.useState=function(H){return V.current.useState(H)},bt.useSyncExternalStore=function(H,$,Z){return V.current.useSyncExternalStore(H,$,Z)},bt.useTransition=function(){return V.current.useTransition()},bt.version="18.3.1",bt}var ap;function qd(){return ap||(ap=1,Eu.exports=ob()),Eu.exports}/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.production.min.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var cp;function lb(){if(cp)return $o;cp=1;var t=qd(),e=Symbol.for("react.element"),r=Symbol.for("react.fragment"),l=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,y={key:!0,ref:!0,__self:!0,__source:!0};function v(o,c,m){var w,d={},k=null,L=null;m!==void 0&&(k=""+m),c.key!==void 0&&(k=""+c.key),c.ref!==void 0&&(L=c.ref);for(w in c)l.call(c,w)&&!y.hasOwnProperty(w)&&(d[w]=c[w]);if(o&&o.defaultProps)for(w in c=o.defaultProps,c)d[w]===void 0&&(d[w]=c[w]);return{$$typeof:e,type:o,key:k,ref:L,props:d,_owner:a.current}}return $o.Fragment=r,$o.jsx=v,$o.jsxs=v,$o}var up;function ab(){return up||(up=1,Su.exports=lb()),Su.exports}var i=ab(),Sa={},Tu={exports:{}},Hn={},Lu={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 dp;function cb(){return dp||(dp=1,(function(t){function e(W,O){var U=W.length;W.push(O);e:for(;0<U;){var H=U-1>>>1,$=W[H];if(0<a($,O))W[H]=O,W[U]=$,U=H;else break e}}function r(W){return W.length===0?null:W[0]}function l(W){if(W.length===0)return null;var O=W[0],U=W.pop();if(U!==O){W[0]=U;e:for(var H=0,$=W.length,Z=$>>>1;H<Z;){var re=2*(H+1)-1,we=W[re],_e=re+1,Q=W[_e];if(0>a(we,U))_e<$&&0>a(Q,we)?(W[H]=Q,W[_e]=U,H=_e):(W[H]=we,W[re]=U,H=re);else if(_e<$&&0>a(Q,U))W[H]=Q,W[_e]=U,H=_e;else break e}}return O}function a(W,O){var U=W.sortIndex-O.sortIndex;return U!==0?U:W.id-O.id}if(typeof performance=="object"&&typeof performance.now=="function"){var y=performance;t.unstable_now=function(){return y.now()}}else{var v=Date,o=v.now();t.unstable_now=function(){return v.now()-o}}var c=[],m=[],w=1,d=null,k=3,L=!1,M=!1,b=!1,h=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,g=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function p(W){for(var O=r(m);O!==null;){if(O.callback===null)l(m);else if(O.startTime<=W)l(m),O.sortIndex=O.expirationTime,e(c,O);else break;O=r(m)}}function T(W){if(b=!1,p(W),!M)if(r(c)!==null)M=!0,K(A);else{var O=r(m);O!==null&&V(T,O.startTime-W)}}function A(W,O){M=!1,b&&(b=!1,_(x),x=-1),L=!0;var U=k;try{for(p(O),d=r(c);d!==null&&(!(d.expirationTime>O)||W&&!D());){var H=d.callback;if(typeof H=="function"){d.callback=null,k=d.priorityLevel;var $=H(d.expirationTime<=O);O=t.unstable_now(),typeof $=="function"?d.callback=$:d===r(c)&&l(c),p(O)}else l(c);d=r(c)}if(d!==null)var Z=!0;else{var re=r(m);re!==null&&V(T,re.startTime-O),Z=!1}return Z}finally{d=null,k=U,L=!1}}var E=!1,S=null,x=-1,R=5,I=-1;function D(){return!(t.unstable_now()-I<R)}function P(){if(S!==null){var W=t.unstable_now();I=W;var O=!0;try{O=S(!0,W)}finally{O?F():(E=!1,S=null)}}else E=!1}var F;if(typeof g=="function")F=function(){g(P)};else if(typeof MessageChannel<"u"){var z=new MessageChannel,q=z.port2;z.port1.onmessage=P,F=function(){q.postMessage(null)}}else F=function(){h(P,0)};function K(W){S=W,E||(E=!0,F())}function V(W,O){x=h(function(){W(t.unstable_now())},O)}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(W){W.callback=null},t.unstable_continueExecution=function(){M||L||(M=!0,K(A))},t.unstable_forceFrameRate=function(W){0>W||125<W?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<W?Math.floor(1e3/W):5},t.unstable_getCurrentPriorityLevel=function(){return k},t.unstable_getFirstCallbackNode=function(){return r(c)},t.unstable_next=function(W){switch(k){case 1:case 2:case 3:var O=3;break;default:O=k}var U=k;k=O;try{return W()}finally{k=U}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(W,O){switch(W){case 1:case 2:case 3:case 4:case 5:break;default:W=3}var U=k;k=W;try{return O()}finally{k=U}},t.unstable_scheduleCallback=function(W,O,U){var H=t.unstable_now();switch(typeof U=="object"&&U!==null?(U=U.delay,U=typeof U=="number"&&0<U?H+U:H):U=H,W){case 1:var $=-1;break;case 2:$=250;break;case 5:$=1073741823;break;case 4:$=1e4;break;default:$=5e3}return $=U+$,W={id:w++,callback:O,priorityLevel:W,startTime:U,expirationTime:$,sortIndex:-1},U>H?(W.sortIndex=U,e(m,W),r(c)===null&&W===r(m)&&(b?(_(x),x=-1):b=!0,V(T,U-H))):(W.sortIndex=$,e(c,W),M||L||(M=!0,K(A))),W},t.unstable_shouldYield=D,t.unstable_wrapCallback=function(W){var O=k;return function(){var U=k;k=O;try{return W.apply(this,arguments)}finally{k=U}}}})(Nu)),Nu}var hp;function ub(){return hp||(hp=1,Lu.exports=cb()),Lu.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 fp;function db(){if(fp)return Hn;fp=1;var t=qd(),e=ub();function r(n){for(var s="https://reactjs.org/docs/error-decoder.html?invariant="+n,u=1;u<arguments.length;u++)s+="&args[]="+encodeURIComponent(arguments[u]);return"Minified React error #"+n+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var l=new Set,a={};function y(n,s){v(n,s),v(n+"Capture",s)}function v(n,s){for(a[n]=s,n=0;n<s.length;n++)l.add(s[n])}var o=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),c=Object.prototype.hasOwnProperty,m=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,w={},d={};function k(n){return c.call(d,n)?!0:c.call(w,n)?!1:m.test(n)?d[n]=!0:(w[n]=!0,!1)}function L(n,s,u,C){if(u!==null&&u.type===0)return!1;switch(typeof s){case"function":case"symbol":return!0;case"boolean":return C?!1:u!==null?!u.acceptsBooleans:(n=n.toLowerCase().slice(0,5),n!=="data-"&&n!=="aria-");default:return!1}}function M(n,s,u,C){if(s===null||typeof s>"u"||L(n,s,u,C))return!0;if(C)return!1;if(u!==null)switch(u.type){case 3:return!s;case 4:return s===!1;case 5:return isNaN(s);case 6:return isNaN(s)||1>s}return!1}function b(n,s,u,C,j,B,G){this.acceptsBooleans=s===2||s===3||s===4,this.attributeName=C,this.attributeNamespace=j,this.mustUseProperty=u,this.propertyName=n,this.type=s,this.sanitizeURL=B,this.removeEmptyString=G}var h={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){h[n]=new b(n,0,!1,n,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var s=n[0];h[s]=new b(s,1,!1,n[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(n){h[n]=new b(n,2,!1,n.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){h[n]=new b(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){h[n]=new b(n,3,!1,n.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(n){h[n]=new b(n,3,!0,n,null,!1,!1)}),["capture","download"].forEach(function(n){h[n]=new b(n,4,!1,n,null,!1,!1)}),["cols","rows","size","span"].forEach(function(n){h[n]=new b(n,6,!1,n,null,!1,!1)}),["rowSpan","start"].forEach(function(n){h[n]=new b(n,5,!1,n.toLowerCase(),null,!1,!1)});var _=/[\-:]([a-z])/g;function g(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 s=n.replace(_,g);h[s]=new b(s,1,!1,n,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(n){var s=n.replace(_,g);h[s]=new b(s,1,!1,n,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(n){var s=n.replace(_,g);h[s]=new b(s,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(n){h[n]=new b(n,1,!1,n.toLowerCase(),null,!1,!1)}),h.xlinkHref=new b("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(n){h[n]=new b(n,1,!1,n.toLowerCase(),null,!0,!0)});function p(n,s,u,C){var j=h.hasOwnProperty(s)?h[s]:null;(j!==null?j.type!==0:C||!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(M(s,u,j,C)&&(u=null),C||j===null?k(s)&&(u===null?n.removeAttribute(s):n.setAttribute(s,""+u)):j.mustUseProperty?n[j.propertyName]=u===null?j.type===3?!1:"":u:(s=j.attributeName,C=j.attributeNamespace,u===null?n.removeAttribute(s):(j=j.type,u=j===3||j===4&&u===!0?"":""+u,C?n.setAttributeNS(C,s,u):n.setAttribute(s,u))))}var T=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,A=Symbol.for("react.element"),E=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),x=Symbol.for("react.strict_mode"),R=Symbol.for("react.profiler"),I=Symbol.for("react.provider"),D=Symbol.for("react.context"),P=Symbol.for("react.forward_ref"),F=Symbol.for("react.suspense"),z=Symbol.for("react.suspense_list"),q=Symbol.for("react.memo"),K=Symbol.for("react.lazy"),V=Symbol.for("react.offscreen"),W=Symbol.iterator;function O(n){return n===null||typeof n!="object"?null:(n=W&&n[W]||n["@@iterator"],typeof n=="function"?n:null)}var U=Object.assign,H;function $(n){if(H===void 0)try{throw Error()}catch(u){var s=u.stack.trim().match(/\n( *(at )?)/);H=s&&s[1]||""}return`
|
|
34
|
+
`+H+n}var Z=!1;function re(n,s){if(!n||Z)return"";Z=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(s)if(s=function(){throw Error()},Object.defineProperty(s.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(s,[])}catch(he){var C=he}Reflect.construct(n,[],s)}else{try{s.call()}catch(he){C=he}n.call(s.prototype)}else{try{throw Error()}catch(he){C=he}n()}}catch(he){if(he&&C&&typeof he.stack=="string"){for(var j=he.stack.split(`
|
|
35
|
+
`),B=C.stack.split(`
|
|
36
|
+
`),G=j.length-1,J=B.length-1;1<=G&&0<=J&&j[G]!==B[J];)J--;for(;1<=G&&0<=J;G--,J--)if(j[G]!==B[J]){if(G!==1||J!==1)do if(G--,J--,0>J||j[G]!==B[J]){var ne=`
|
|
37
|
+
`+j[G].replace(" at new "," at ");return n.displayName&&ne.includes("<anonymous>")&&(ne=ne.replace("<anonymous>",n.displayName)),ne}while(1<=G&&0<=J);break}}}finally{Z=!1,Error.prepareStackTrace=u}return(n=n?n.displayName||n.name:"")?$(n):""}function we(n){switch(n.tag){case 5:return $(n.type);case 16:return $("Lazy");case 13:return $("Suspense");case 19:return $("SuspenseList");case 0:case 2:case 15:return n=re(n.type,!1),n;case 11:return n=re(n.type.render,!1),n;case 1:return n=re(n.type,!0),n;default:return""}}function _e(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 S:return"Fragment";case E:return"Portal";case R:return"Profiler";case x:return"StrictMode";case F:return"Suspense";case z:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case D:return(n.displayName||"Context")+".Consumer";case I:return(n._context.displayName||"Context")+".Provider";case P:var s=n.render;return n=n.displayName,n||(n=s.displayName||s.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case q:return s=n.displayName||null,s!==null?s:_e(n.type)||"Memo";case K:s=n._payload,n=n._init;try{return _e(n(s))}catch{}}return null}function Q(n){var s=n.type;switch(n.tag){case 24:return"Cache";case 9:return(s.displayName||"Context")+".Consumer";case 10:return(s._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return n=s.render,n=n.displayName||n.name||"",s.displayName||(n!==""?"ForwardRef("+n+")":"ForwardRef");case 7:return"Fragment";case 5:return s;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return _e(s);case 8:return s===x?"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 s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s}return null}function Y(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function te(n){var s=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function ee(n){var s=te(n)?"checked":"value",u=Object.getOwnPropertyDescriptor(n.constructor.prototype,s),C=""+n[s];if(!n.hasOwnProperty(s)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var j=u.get,B=u.set;return Object.defineProperty(n,s,{configurable:!0,get:function(){return j.call(this)},set:function(G){C=""+G,B.call(this,G)}}),Object.defineProperty(n,s,{enumerable:u.enumerable}),{getValue:function(){return C},setValue:function(G){C=""+G},stopTracking:function(){n._valueTracker=null,delete n[s]}}}}function ye(n){n._valueTracker||(n._valueTracker=ee(n))}function ge(n){if(!n)return!1;var s=n._valueTracker;if(!s)return!0;var u=s.getValue(),C="";return n&&(C=te(n)?n.checked?"true":"false":n.value),n=C,n!==u?(s.setValue(n),!0):!1}function Be(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 Ue(n,s){var u=s.checked;return U({},s,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:u??n._wrapperState.initialChecked})}function ze(n,s){var u=s.defaultValue==null?"":s.defaultValue,C=s.checked!=null?s.checked:s.defaultChecked;u=Y(s.value!=null?s.value:u),n._wrapperState={initialChecked:C,initialValue:u,controlled:s.type==="checkbox"||s.type==="radio"?s.checked!=null:s.value!=null}}function gt(n,s){s=s.checked,s!=null&&p(n,"checked",s,!1)}function Fe(n,s){gt(n,s);var u=Y(s.value),C=s.type;if(u!=null)C==="number"?(u===0&&n.value===""||n.value!=u)&&(n.value=""+u):n.value!==""+u&&(n.value=""+u);else if(C==="submit"||C==="reset"){n.removeAttribute("value");return}s.hasOwnProperty("value")?yt(n,s.type,u):s.hasOwnProperty("defaultValue")&&yt(n,s.type,Y(s.defaultValue)),s.checked==null&&s.defaultChecked!=null&&(n.defaultChecked=!!s.defaultChecked)}function pt(n,s,u){if(s.hasOwnProperty("value")||s.hasOwnProperty("defaultValue")){var C=s.type;if(!(C!=="submit"&&C!=="reset"||s.value!==void 0&&s.value!==null))return;s=""+n._wrapperState.initialValue,u||s===n.value||(n.value=s),n.defaultValue=s}u=n.name,u!==""&&(n.name=""),n.defaultChecked=!!n._wrapperState.initialChecked,u!==""&&(n.name=u)}function yt(n,s,u){(s!=="number"||Be(n.ownerDocument)!==n)&&(u==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+u&&(n.defaultValue=""+u))}var oe=Array.isArray;function Ae(n,s,u,C){if(n=n.options,s){s={};for(var j=0;j<u.length;j++)s["$"+u[j]]=!0;for(u=0;u<n.length;u++)j=s.hasOwnProperty("$"+n[u].value),n[u].selected!==j&&(n[u].selected=j),j&&C&&(n[u].defaultSelected=!0)}else{for(u=""+Y(u),s=null,j=0;j<n.length;j++){if(n[j].value===u){n[j].selected=!0,C&&(n[j].defaultSelected=!0);return}s!==null||n[j].disabled||(s=n[j])}s!==null&&(s.selected=!0)}}function De(n,s){if(s.dangerouslySetInnerHTML!=null)throw Error(r(91));return U({},s,{value:void 0,defaultValue:void 0,children:""+n._wrapperState.initialValue})}function Le(n,s){var u=s.value;if(u==null){if(u=s.children,s=s.defaultValue,u!=null){if(s!=null)throw Error(r(92));if(oe(u)){if(1<u.length)throw Error(r(93));u=u[0]}s=u}s==null&&(s=""),u=s}n._wrapperState={initialValue:Y(u)}}function nt(n,s){var u=Y(s.value),C=Y(s.defaultValue);u!=null&&(u=""+u,u!==n.value&&(n.value=u),s.defaultValue==null&&n.defaultValue!==u&&(n.defaultValue=u)),C!=null&&(n.defaultValue=""+C)}function je(n){var s=n.textContent;s===n._wrapperState.initialValue&&s!==""&&s!==null&&(n.value=s)}function Ke(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 kt(n,s){return n==null||n==="http://www.w3.org/1999/xhtml"?Ke(s):n==="http://www.w3.org/2000/svg"&&s==="foreignObject"?"http://www.w3.org/1999/xhtml":n}var Lt,xt=(function(n){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(s,u,C,j){MSApp.execUnsafeLocalFunction(function(){return n(s,u,C,j)})}:n})(function(n,s){if(n.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in n)n.innerHTML=s;else{for(Lt=Lt||document.createElement("div"),Lt.innerHTML="<svg>"+s.valueOf().toString()+"</svg>",s=Lt.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;s.firstChild;)n.appendChild(s.firstChild)}});function vt(n,s){if(s){var u=n.firstChild;if(u&&u===n.lastChild&&u.nodeType===3){u.nodeValue=s;return}}n.textContent=s}var dt={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(dt).forEach(function(n){Qe.forEach(function(s){s=s+n.charAt(0).toUpperCase()+n.substring(1),dt[s]=dt[n]})});function St(n,s,u){return s==null||typeof s=="boolean"||s===""?"":u||typeof s!="number"||s===0||dt.hasOwnProperty(n)&&dt[n]?(""+s).trim():s+"px"}function Ft(n,s){n=n.style;for(var u in s)if(s.hasOwnProperty(u)){var C=u.indexOf("--")===0,j=St(u,s[u],C);u==="float"&&(u="cssFloat"),C?n.setProperty(u,j):n[u]=j}}var Gt=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 Ie(n,s){if(s){if(Gt[n]&&(s.children!=null||s.dangerouslySetInnerHTML!=null))throw Error(r(137,n));if(s.dangerouslySetInnerHTML!=null){if(s.children!=null)throw Error(r(60));if(typeof s.dangerouslySetInnerHTML!="object"||!("__html"in s.dangerouslySetInnerHTML))throw Error(r(61))}if(s.style!=null&&typeof s.style!="object")throw Error(r(62))}}function $e(n,s){if(n.indexOf("-")===-1)return typeof s.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 ue=null;function st(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var ft=null,et=null,tt=null;function de(n){if(n=To(n)){if(typeof ft!="function")throw Error(r(280));var s=n.stateNode;s&&(s=Hl(s),ft(n.stateNode,n.type,s))}}function Pe(n){et?tt?tt.push(n):tt=[n]:et=n}function Re(){if(et){var n=et,s=tt;if(tt=et=null,de(n),s)for(n=0;n<s.length;n++)de(s[n])}}function Ce(n,s){return n(s)}function fe(){}var ht=!1;function ve(n,s,u){if(ht)return n(s,u);ht=!0;try{return Ce(n,s,u)}finally{ht=!1,(et!==null||tt!==null)&&(fe(),Re())}}function rt(n,s){var u=n.stateNode;if(u===null)return null;var C=Hl(u);if(C===null)return null;u=C[s];e:switch(s){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(u&&typeof u!="function")throw Error(r(231,s,typeof u));return u}var Pt=!1;if(o)try{var Et={};Object.defineProperty(Et,"passive",{get:function(){Pt=!0}}),window.addEventListener("test",Et,Et),window.removeEventListener("test",Et,Et)}catch{Pt=!1}function Ge(n,s,u,C,j,B,G,J,ne){var he=Array.prototype.slice.call(arguments,3);try{s.apply(u,he)}catch(Se){this.onError(Se)}}var ct=!1,Tt=null,se=!1,ke=null,be={onError:function(n){ct=!0,Tt=n}};function lt(n,s,u,C,j,B,G,J,ne){ct=!1,Tt=null,Ge.apply(be,arguments)}function ut(n,s,u,C,j,B,G,J,ne){if(lt.apply(this,arguments),ct){if(ct){var he=Tt;ct=!1,Tt=null}else throw Error(r(198));se||(se=!0,ke=he)}}function wt(n){var s=n,u=n;if(n.alternate)for(;s.return;)s=s.return;else{n=s;do s=n,(s.flags&4098)!==0&&(u=s.return),n=s.return;while(n)}return s.tag===3?u:null}function Nt(n){if(n.tag===13){var s=n.memoizedState;if(s===null&&(n=n.alternate,n!==null&&(s=n.memoizedState)),s!==null)return s.dehydrated}return null}function Yt(n){if(wt(n)!==n)throw Error(r(188))}function Mn(n){var s=n.alternate;if(!s){if(s=wt(n),s===null)throw Error(r(188));return s!==n?null:n}for(var u=n,C=s;;){var j=u.return;if(j===null)break;var B=j.alternate;if(B===null){if(C=j.return,C!==null){u=C;continue}break}if(j.child===B.child){for(B=j.child;B;){if(B===u)return Yt(j),n;if(B===C)return Yt(j),s;B=B.sibling}throw Error(r(188))}if(u.return!==C.return)u=j,C=B;else{for(var G=!1,J=j.child;J;){if(J===u){G=!0,u=j,C=B;break}if(J===C){G=!0,C=j,u=B;break}J=J.sibling}if(!G){for(J=B.child;J;){if(J===u){G=!0,u=B,C=j;break}if(J===C){G=!0,C=B,u=j;break}J=J.sibling}if(!G)throw Error(r(189))}}if(u.alternate!==C)throw Error(r(190))}if(u.tag!==3)throw Error(r(188));return u.stateNode.current===u?n:s}function rr(n){return n=Mn(n),n!==null?yr(n):null}function yr(n){if(n.tag===5||n.tag===6)return n;for(n=n.child;n!==null;){var s=yr(n);if(s!==null)return s;n=n.sibling}return null}var Gr=e.unstable_scheduleCallback,sr=e.unstable_cancelCallback,ir=e.unstable_shouldYield,Yr=e.unstable_requestPaint,$t=e.unstable_now,Xr=e.unstable_getCurrentPriorityLevel,zn=e.unstable_ImmediatePriority,kr=e.unstable_UserBlockingPriority,Cr=e.unstable_NormalPriority,li=e.unstable_LowPriority,Qr=e.unstable_IdlePriority,or=null,_n=null;function Jr(n){if(_n&&typeof _n.onCommitFiberRoot=="function")try{_n.onCommitFiberRoot(or,n,void 0,(n.current.flags&128)===128)}catch{}}var wn=Math.clz32?Math.clz32:Ts,Zi=Math.log,eo=Math.LN2;function Ts(n){return n>>>=0,n===0?32:31-(Zi(n)/eo|0)|0}var lr=64,An=4194304;function ar(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 Tn(n,s){var u=n.pendingLanes;if(u===0)return 0;var C=0,j=n.suspendedLanes,B=n.pingedLanes,G=u&268435455;if(G!==0){var J=G&~j;J!==0?C=ar(J):(B&=G,B!==0&&(C=ar(B)))}else G=u&~j,G!==0?C=ar(G):B!==0&&(C=ar(B));if(C===0)return 0;if(s!==0&&s!==C&&(s&j)===0&&(j=C&-C,B=s&-s,j>=B||j===16&&(B&4194240)!==0))return s;if((C&4)!==0&&(C|=u&16),s=n.entangledLanes,s!==0)for(n=n.entanglements,s&=C;0<s;)u=31-wn(s),j=1<<u,C|=n[u],s&=~j;return C}function pe(n,s){switch(n){case 1:case 2:case 4:return s+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 s+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 He(n,s){for(var u=n.suspendedLanes,C=n.pingedLanes,j=n.expirationTimes,B=n.pendingLanes;0<B;){var G=31-wn(B),J=1<<G,ne=j[G];ne===-1?((J&u)===0||(J&C)!==0)&&(j[G]=pe(J,s)):ne<=s&&(n.expiredLanes|=J),B&=~J}}function at(n){return n=n.pendingLanes&-1073741825,n!==0?n:n&1073741824?1073741824:0}function Ot(){var n=lr;return lr<<=1,(lr&4194240)===0&&(lr=64),n}function _t(n){for(var s=[],u=0;31>u;u++)s.push(n);return s}function tn(n,s,u){n.pendingLanes|=s,s!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,s=31-wn(s),n[s]=u}function xr(n,s){var u=n.pendingLanes&~s;n.pendingLanes=s,n.suspendedLanes=0,n.pingedLanes=0,n.expiredLanes&=s,n.mutableReadLanes&=s,n.entangledLanes&=s,s=n.entanglements;var C=n.eventTimes;for(n=n.expirationTimes;0<u;){var j=31-wn(u),B=1<<j;s[j]=0,C[j]=-1,n[j]=-1,u&=~B}}function Sr(n,s){var u=n.entangledLanes|=s;for(n=n.entanglements;u;){var C=31-wn(u),j=1<<C;j&s|n[C]&s&&(n[C]|=s),u&=~j}}var Rt=0;function Ls(n){return n&=-n,1<n?4<n?(n&268435455)!==0?16:536870912:4:1}var cr,to,ai,ci,Pr,Er=!1,Tr=[],ur=null,Ln=null,Kn=null,In=new Map,Ns=new Map,dr=[],Zr="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 Rs(n,s){switch(n){case"focusin":case"focusout":ur=null;break;case"dragenter":case"dragleave":Ln=null;break;case"mouseover":case"mouseout":Kn=null;break;case"pointerover":case"pointerout":In.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ns.delete(s.pointerId)}}function Ms(n,s,u,C,j,B){return n===null||n.nativeEvent!==B?(n={blockedOn:s,domEventName:u,eventSystemFlags:C,nativeEvent:B,targetContainers:[j]},s!==null&&(s=To(s),s!==null&&to(s)),n):(n.eventSystemFlags|=C,s=n.targetContainers,j!==null&&s.indexOf(j)===-1&&s.push(j),n)}function Bt(n,s,u,C,j){switch(s){case"focusin":return ur=Ms(ur,n,s,u,C,j),!0;case"dragenter":return Ln=Ms(Ln,n,s,u,C,j),!0;case"mouseover":return Kn=Ms(Kn,n,s,u,C,j),!0;case"pointerover":var B=j.pointerId;return In.set(B,Ms(In.get(B)||null,n,s,u,C,j)),!0;case"gotpointercapture":return B=j.pointerId,Ns.set(B,Ms(Ns.get(B)||null,n,s,u,C,j)),!0}return!1}function ui(n){var s=Ws(n.target);if(s!==null){var u=wt(s);if(u!==null){if(s=u.tag,s===13){if(s=Nt(u),s!==null){n.blockedOn=s,Pr(n.priority,function(){ai(u)});return}}else if(s===3&&u.stateNode.current.memoizedState.isDehydrated){n.blockedOn=u.tag===3?u.stateNode.containerInfo:null;return}}}n.blockedOn=null}function As(n){if(n.blockedOn!==null)return!1;for(var s=n.targetContainers;0<s.length;){var u=fi(n.domEventName,n.eventSystemFlags,s[0],n.nativeEvent);if(u===null){u=n.nativeEvent;var C=new u.constructor(u.type,u);ue=C,u.target.dispatchEvent(C),ue=null}else return s=To(u),s!==null&&to(s),n.blockedOn=u,!1;s.shift()}return!0}function fl(n,s,u){As(n)&&u.delete(s)}function no(){Er=!1,ur!==null&&As(ur)&&(ur=null),Ln!==null&&As(Ln)&&(Ln=null),Kn!==null&&As(Kn)&&(Kn=null),In.forEach(fl),Ns.forEach(fl)}function di(n,s){n.blockedOn===s&&(n.blockedOn=null,Er||(Er=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,no)))}function Or(n){function s(j){return di(j,n)}if(0<Tr.length){di(Tr[0],n);for(var u=1;u<Tr.length;u++){var C=Tr[u];C.blockedOn===n&&(C.blockedOn=null)}}for(ur!==null&&di(ur,n),Ln!==null&&di(Ln,n),Kn!==null&&di(Kn,n),In.forEach(s),Ns.forEach(s),u=0;u<dr.length;u++)C=dr[u],C.blockedOn===n&&(C.blockedOn=null);for(;0<dr.length&&(u=dr[0],u.blockedOn===null);)ui(u),u.blockedOn===null&&dr.shift()}var At=T.ReactCurrentBatchConfig,zt=!0;function pl(n,s,u,C){var j=Rt,B=At.transition;At.transition=null;try{Rt=1,hi(n,s,u,C)}finally{Rt=j,At.transition=B}}function Br(n,s,u,C){var j=Rt,B=At.transition;At.transition=null;try{Rt=4,hi(n,s,u,C)}finally{Rt=j,At.transition=B}}function hi(n,s,u,C){if(zt){var j=fi(n,s,u,C);if(j===null)mc(n,s,C,Is,u),Rs(n,C);else if(Bt(j,n,s,u,C))C.stopPropagation();else if(Rs(n,C),s&4&&-1<Zr.indexOf(n)){for(;j!==null;){var B=To(j);if(B!==null&&cr(B),B=fi(n,s,u,C),B===null&&mc(n,s,C,Is,u),B===j)break;j=B}j!==null&&C.stopPropagation()}else mc(n,s,C,null,u)}}var Is=null;function fi(n,s,u,C){if(Is=null,n=st(C),n=Ws(n),n!==null)if(s=wt(n),s===null)n=null;else if(u=s.tag,u===13){if(n=Nt(s),n!==null)return n;n=null}else if(u===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;n=null}else s!==n&&(n=null);return Is=n,null}function ml(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(Xr()){case zn:return 1;case kr:return 4;case Cr:case li:return 16;case Qr:return 536870912;default:return 16}default:return 16}}var Vn=null,ro=null,pi=null;function gl(){if(pi)return pi;var n,s=ro,u=s.length,C,j="value"in Vn?Vn.value:Vn.textContent,B=j.length;for(n=0;n<u&&s[n]===j[n];n++);var G=u-n;for(C=1;C<=G&&s[u-C]===j[B-C];C++);return pi=j.slice(n,1<C?1-C:void 0)}function mi(n){var s=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&s===13&&(n=13)):n=s,n===10&&(n=13),32<=n||n===13?n:0}function js(){return!0}function so(){return!1}function pn(n){function s(u,C,j,B,G){this._reactName=u,this._targetInst=j,this.type=C,this.nativeEvent=B,this.target=G,this.currentTarget=null;for(var J in n)n.hasOwnProperty(J)&&(u=n[J],this[J]=u?u(B):B[J]);return this.isDefaultPrevented=(B.defaultPrevented!=null?B.defaultPrevented:B.returnValue===!1)?js:so,this.isPropagationStopped=so,this}return U(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var u=this.nativeEvent;u&&(u.preventDefault?u.preventDefault():typeof u.returnValue!="unknown"&&(u.returnValue=!1),this.isDefaultPrevented=js)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=js)},persist:function(){},isPersistent:js}),s}var es={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},gi=pn(es),ts=U({},es,{view:0,detail:0}),vl=pn(ts),vi,io,Ds,Ps=U({},ts,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Os,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!==Ds&&(Ds&&n.type==="mousemove"?(vi=n.screenX-Ds.screenX,io=n.screenY-Ds.screenY):io=vi=0,Ds=n),vi)},movementY:function(n){return"movementY"in n?n.movementY:io}}),Gn=pn(Ps),_l=U({},Ps,{dataTransfer:0}),oo=pn(_l),lo=U({},ts,{relatedTarget:0}),ao=pn(lo),Ja=U({},es,{animationName:0,elapsedTime:0,pseudoElement:0}),Za=pn(Ja),wl=U({},es,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),Lr=pn(wl),ec=U({},es,{data:0}),co=pn(ec),tc={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},bl={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"},ns={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function yl(n){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(n):(n=ns[n])?!!s[n]:!1}function Os(){return yl}var nc=U({},ts,{key:function(n){if(n.key){var s=tc[n.key]||n.key;if(s!=="Unidentified")return s}return n.type==="keypress"?(n=mi(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?bl[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Os,charCode:function(n){return n.type==="keypress"?mi(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?mi(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),uo=pn(nc),rc=U({},Ps,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Bs=pn(rc),kl=U({},ts,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Os}),sc=pn(kl),ic=U({},es,{propertyName:0,elapsedTime:0,pseudoElement:0}),_i=pn(ic),oc=U({},Ps,{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}),ho=pn(oc),Cl=[9,13,27,32],wi=o&&"CompositionEvent"in window,Fs=null;o&&"documentMode"in document&&(Fs=document.documentMode);var lc=o&&"TextEvent"in window&&!Fs,fo=o&&(!wi||Fs&&8<Fs&&11>=Fs),xl=" ",bi=!1;function Hs(n,s){switch(n){case"keyup":return Cl.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Sl(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var rs=!1;function po(n,s){switch(n){case"compositionend":return Sl(s);case"keypress":return s.which!==32?null:(bi=!0,xl);case"textInput":return n=s.data,n===xl&&bi?null:n;default:return null}}function ac(n,s){if(rs)return n==="compositionend"||!wi&&Hs(n,s)?(n=gl(),pi=ro=Vn=null,rs=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return fo&&s.locale!=="ko"?null:s.data;default:return null}}var El={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Tl(n){var s=n&&n.nodeName&&n.nodeName.toLowerCase();return s==="input"?!!El[n.type]:s==="textarea"}function Ll(n,s,u,C){Pe(C),s=Ol(s,"onChange"),0<s.length&&(u=new gi("onChange","change",null,u,C),n.push({event:u,listeners:s}))}var Us=null,ss=null;function cc(n){kh(n,0)}function yi(n){var s=Ni(n);if(ge(s))return n}function mo(n,s){if(n==="change")return s}var go=!1;if(o){var $s;if(o){var ki="oninput"in document;if(!ki){var Nl=document.createElement("div");Nl.setAttribute("oninput","return;"),ki=typeof Nl.oninput=="function"}$s=ki}else $s=!1;go=$s&&(!document.documentMode||9<document.documentMode)}function vo(){Us&&(Us.detachEvent("onpropertychange",_o),ss=Us=null)}function _o(n){if(n.propertyName==="value"&&yi(ss)){var s=[];Ll(s,ss,n,st(n)),ve(cc,s)}}function Rl(n,s,u){n==="focusin"?(vo(),Us=s,ss=u,Us.attachEvent("onpropertychange",_o)):n==="focusout"&&vo()}function Ml(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return yi(ss)}function Al(n,s){if(n==="click")return yi(s)}function Il(n,s){if(n==="input"||n==="change")return yi(s)}function uc(n,s){return n===s&&(n!==0||1/n===1/s)||n!==n&&s!==s}var jn=typeof Object.is=="function"?Object.is:uc;function hr(n,s){if(jn(n,s))return!0;if(typeof n!="object"||n===null||typeof s!="object"||s===null)return!1;var u=Object.keys(n),C=Object.keys(s);if(u.length!==C.length)return!1;for(C=0;C<u.length;C++){var j=u[C];if(!c.call(s,j)||!jn(n[j],s[j]))return!1}return!0}function wo(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function bo(n,s){var u=wo(n);n=0;for(var C;u;){if(u.nodeType===3){if(C=n+u.textContent.length,n<=s&&C>=s)return{node:u,offset:s-n};n=C}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=wo(u)}}function yo(n,s){return n&&s?n===s?!0:n&&n.nodeType===3?!1:s&&s.nodeType===3?yo(n,s.parentNode):"contains"in n?n.contains(s):n.compareDocumentPosition?!!(n.compareDocumentPosition(s)&16):!1:!1}function ko(){for(var n=window,s=Be();s instanceof n.HTMLIFrameElement;){try{var u=typeof s.contentWindow.location.href=="string"}catch{u=!1}if(u)n=s.contentWindow;else break;s=Be(n.document)}return s}function Ci(n){var s=n&&n.nodeName&&n.nodeName.toLowerCase();return s&&(s==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||s==="textarea"||n.contentEditable==="true")}function X(n){var s=ko(),u=n.focusedElem,C=n.selectionRange;if(s!==u&&u&&u.ownerDocument&&yo(u.ownerDocument.documentElement,u)){if(C!==null&&Ci(u)){if(s=C.start,n=C.end,n===void 0&&(n=s),"selectionStart"in u)u.selectionStart=s,u.selectionEnd=Math.min(n,u.value.length);else if(n=(s=u.ownerDocument||document)&&s.defaultView||window,n.getSelection){n=n.getSelection();var j=u.textContent.length,B=Math.min(C.start,j);C=C.end===void 0?B:Math.min(C.end,j),!n.extend&&B>C&&(j=C,C=B,B=j),j=bo(u,B);var G=bo(u,C);j&&G&&(n.rangeCount!==1||n.anchorNode!==j.node||n.anchorOffset!==j.offset||n.focusNode!==G.node||n.focusOffset!==G.offset)&&(s=s.createRange(),s.setStart(j.node,j.offset),n.removeAllRanges(),B>C?(n.addRange(s),n.extend(G.node,G.offset)):(s.setEnd(G.node,G.offset),n.addRange(s)))}}for(s=[],n=u;n=n.parentNode;)n.nodeType===1&&s.push({element:n,left:n.scrollLeft,top:n.scrollTop});for(typeof u.focus=="function"&&u.focus(),u=0;u<s.length;u++)n=s[u],n.element.scrollLeft=n.left,n.element.scrollTop=n.top}}var me=o&&"documentMode"in document&&11>=document.documentMode,qe=null,Jt=null,ln=null,xi=!1;function Si(n,s,u){var C=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;xi||qe==null||qe!==Be(C)||(C=qe,"selectionStart"in C&&Ci(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}),ln&&hr(ln,C)||(ln=C,C=Ol(Jt,"onSelect"),0<C.length&&(s=new gi("onSelect","select",null,s,u),n.push({event:s,listeners:C}),s.target=qe)))}function jl(n,s){var u={};return u[n.toLowerCase()]=s.toLowerCase(),u["Webkit"+n]="webkit"+s,u["Moz"+n]="moz"+s,u}var Ei={animationend:jl("Animation","AnimationEnd"),animationiteration:jl("Animation","AnimationIteration"),animationstart:jl("Animation","AnimationStart"),transitionend:jl("Transition","TransitionEnd")},dc={},ph={};o&&(ph=document.createElement("div").style,"AnimationEvent"in window||(delete Ei.animationend.animation,delete Ei.animationiteration.animation,delete Ei.animationstart.animation),"TransitionEvent"in window||delete Ei.transitionend.transition);function Dl(n){if(dc[n])return dc[n];if(!Ei[n])return n;var s=Ei[n],u;for(u in s)if(s.hasOwnProperty(u)&&u in ph)return dc[n]=s[u];return n}var mh=Dl("animationend"),gh=Dl("animationiteration"),vh=Dl("animationstart"),_h=Dl("transitionend"),wh=new Map,bh="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 is(n,s){wh.set(n,s),y(s,[n])}for(var hc=0;hc<bh.length;hc++){var fc=bh[hc],hw=fc.toLowerCase(),fw=fc[0].toUpperCase()+fc.slice(1);is(hw,"on"+fw)}is(mh,"onAnimationEnd"),is(gh,"onAnimationIteration"),is(vh,"onAnimationStart"),is("dblclick","onDoubleClick"),is("focusin","onFocus"),is("focusout","onBlur"),is(_h,"onTransitionEnd"),v("onMouseEnter",["mouseout","mouseover"]),v("onMouseLeave",["mouseout","mouseover"]),v("onPointerEnter",["pointerout","pointerover"]),v("onPointerLeave",["pointerout","pointerover"]),y("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),y("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),y("onBeforeInput",["compositionend","keypress","textInput","paste"]),y("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),y("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),y("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Co="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(" "),pw=new Set("cancel close invalid load scroll toggle".split(" ").concat(Co));function yh(n,s,u){var C=n.type||"unknown-event";n.currentTarget=u,ut(C,s,void 0,n),n.currentTarget=null}function kh(n,s){s=(s&4)!==0;for(var u=0;u<n.length;u++){var C=n[u],j=C.event;C=C.listeners;e:{var B=void 0;if(s)for(var G=C.length-1;0<=G;G--){var J=C[G],ne=J.instance,he=J.currentTarget;if(J=J.listener,ne!==B&&j.isPropagationStopped())break e;yh(j,J,he),B=ne}else for(G=0;G<C.length;G++){if(J=C[G],ne=J.instance,he=J.currentTarget,J=J.listener,ne!==B&&j.isPropagationStopped())break e;yh(j,J,he),B=ne}}}if(se)throw n=ke,se=!1,ke=null,n}function Kt(n,s){var u=s[yc];u===void 0&&(u=s[yc]=new Set);var C=n+"__bubble";u.has(C)||(Ch(s,n,2,!1),u.add(C))}function pc(n,s,u){var C=0;s&&(C|=4),Ch(u,n,C,s)}var Pl="_reactListening"+Math.random().toString(36).slice(2);function xo(n){if(!n[Pl]){n[Pl]=!0,l.forEach(function(u){u!=="selectionchange"&&(pw.has(u)||pc(u,!1,n),pc(u,!0,n))});var s=n.nodeType===9?n:n.ownerDocument;s===null||s[Pl]||(s[Pl]=!0,pc("selectionchange",!1,s))}}function Ch(n,s,u,C){switch(ml(s)){case 1:var j=pl;break;case 4:j=Br;break;default:j=hi}u=j.bind(null,s,u,n),j=void 0,!Pt||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(j=!0),C?j!==void 0?n.addEventListener(s,u,{capture:!0,passive:j}):n.addEventListener(s,u,!0):j!==void 0?n.addEventListener(s,u,{passive:j}):n.addEventListener(s,u,!1)}function mc(n,s,u,C,j){var B=C;if((s&1)===0&&(s&2)===0&&C!==null)e:for(;;){if(C===null)return;var G=C.tag;if(G===3||G===4){var J=C.stateNode.containerInfo;if(J===j||J.nodeType===8&&J.parentNode===j)break;if(G===4)for(G=C.return;G!==null;){var ne=G.tag;if((ne===3||ne===4)&&(ne=G.stateNode.containerInfo,ne===j||ne.nodeType===8&&ne.parentNode===j))return;G=G.return}for(;J!==null;){if(G=Ws(J),G===null)return;if(ne=G.tag,ne===5||ne===6){C=B=G;continue e}J=J.parentNode}}C=C.return}ve(function(){var he=B,Se=st(u),Ne=[];e:{var xe=wh.get(n);if(xe!==void 0){var We=gi,Ye=n;switch(n){case"keypress":if(mi(u)===0)break e;case"keydown":case"keyup":We=uo;break;case"focusin":Ye="focus",We=ao;break;case"focusout":Ye="blur",We=ao;break;case"beforeblur":case"afterblur":We=ao;break;case"click":if(u.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":We=Gn;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":We=oo;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":We=sc;break;case mh:case gh:case vh:We=Za;break;case _h:We=_i;break;case"scroll":We=vl;break;case"wheel":We=ho;break;case"copy":case"cut":case"paste":We=Lr;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":We=Bs}var Je=(s&4)!==0,rn=!Je&&n==="scroll",ae=Je?xe!==null?xe+"Capture":null:xe;Je=[];for(var le=he,ce;le!==null;){ce=le;var Me=ce.stateNode;if(ce.tag===5&&Me!==null&&(ce=Me,ae!==null&&(Me=rt(le,ae),Me!=null&&Je.push(So(le,Me,ce)))),rn)break;le=le.return}0<Je.length&&(xe=new We(xe,Ye,null,u,Se),Ne.push({event:xe,listeners:Je}))}}if((s&7)===0){e:{if(xe=n==="mouseover"||n==="pointerover",We=n==="mouseout"||n==="pointerout",xe&&u!==ue&&(Ye=u.relatedTarget||u.fromElement)&&(Ws(Ye)||Ye[Fr]))break e;if((We||xe)&&(xe=Se.window===Se?Se:(xe=Se.ownerDocument)?xe.defaultView||xe.parentWindow:window,We?(Ye=u.relatedTarget||u.toElement,We=he,Ye=Ye?Ws(Ye):null,Ye!==null&&(rn=wt(Ye),Ye!==rn||Ye.tag!==5&&Ye.tag!==6)&&(Ye=null)):(We=null,Ye=he),We!==Ye)){if(Je=Gn,Me="onMouseLeave",ae="onMouseEnter",le="mouse",(n==="pointerout"||n==="pointerover")&&(Je=Bs,Me="onPointerLeave",ae="onPointerEnter",le="pointer"),rn=We==null?xe:Ni(We),ce=Ye==null?xe:Ni(Ye),xe=new Je(Me,le+"leave",We,u,Se),xe.target=rn,xe.relatedTarget=ce,Me=null,Ws(Se)===he&&(Je=new Je(ae,le+"enter",Ye,u,Se),Je.target=ce,Je.relatedTarget=rn,Me=Je),rn=Me,We&&Ye)t:{for(Je=We,ae=Ye,le=0,ce=Je;ce;ce=Ti(ce))le++;for(ce=0,Me=ae;Me;Me=Ti(Me))ce++;for(;0<le-ce;)Je=Ti(Je),le--;for(;0<ce-le;)ae=Ti(ae),ce--;for(;le--;){if(Je===ae||ae!==null&&Je===ae.alternate)break t;Je=Ti(Je),ae=Ti(ae)}Je=null}else Je=null;We!==null&&xh(Ne,xe,We,Je,!1),Ye!==null&&rn!==null&&xh(Ne,rn,Ye,Je,!0)}}e:{if(xe=he?Ni(he):window,We=xe.nodeName&&xe.nodeName.toLowerCase(),We==="select"||We==="input"&&xe.type==="file")var Ze=mo;else if(Tl(xe))if(go)Ze=Il;else{Ze=Ml;var it=Rl}else(We=xe.nodeName)&&We.toLowerCase()==="input"&&(xe.type==="checkbox"||xe.type==="radio")&&(Ze=Al);if(Ze&&(Ze=Ze(n,he))){Ll(Ne,Ze,u,Se);break e}it&&it(n,xe,he),n==="focusout"&&(it=xe._wrapperState)&&it.controlled&&xe.type==="number"&&yt(xe,"number",xe.value)}switch(it=he?Ni(he):window,n){case"focusin":(Tl(it)||it.contentEditable==="true")&&(qe=it,Jt=he,ln=null);break;case"focusout":ln=Jt=qe=null;break;case"mousedown":xi=!0;break;case"contextmenu":case"mouseup":case"dragend":xi=!1,Si(Ne,u,Se);break;case"selectionchange":if(me)break;case"keydown":case"keyup":Si(Ne,u,Se)}var ot;if(wi)e:{switch(n){case"compositionstart":var mt="onCompositionStart";break e;case"compositionend":mt="onCompositionEnd";break e;case"compositionupdate":mt="onCompositionUpdate";break e}mt=void 0}else rs?Hs(n,u)&&(mt="onCompositionEnd"):n==="keydown"&&u.keyCode===229&&(mt="onCompositionStart");mt&&(fo&&u.locale!=="ko"&&(rs||mt!=="onCompositionStart"?mt==="onCompositionEnd"&&rs&&(ot=gl()):(Vn=Se,ro="value"in Vn?Vn.value:Vn.textContent,rs=!0)),it=Ol(he,mt),0<it.length&&(mt=new co(mt,n,null,u,Se),Ne.push({event:mt,listeners:it}),ot?mt.data=ot:(ot=Sl(u),ot!==null&&(mt.data=ot)))),(ot=lc?po(n,u):ac(n,u))&&(he=Ol(he,"onBeforeInput"),0<he.length&&(Se=new co("onBeforeInput","beforeinput",null,u,Se),Ne.push({event:Se,listeners:he}),Se.data=ot))}kh(Ne,s)})}function So(n,s,u){return{instance:n,listener:s,currentTarget:u}}function Ol(n,s){for(var u=s+"Capture",C=[];n!==null;){var j=n,B=j.stateNode;j.tag===5&&B!==null&&(j=B,B=rt(n,u),B!=null&&C.unshift(So(n,B,j)),B=rt(n,s),B!=null&&C.push(So(n,B,j))),n=n.return}return C}function Ti(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5);return n||null}function xh(n,s,u,C,j){for(var B=s._reactName,G=[];u!==null&&u!==C;){var J=u,ne=J.alternate,he=J.stateNode;if(ne!==null&&ne===C)break;J.tag===5&&he!==null&&(J=he,j?(ne=rt(u,B),ne!=null&&G.unshift(So(u,ne,J))):j||(ne=rt(u,B),ne!=null&&G.push(So(u,ne,J)))),u=u.return}G.length!==0&&n.push({event:s,listeners:G})}var mw=/\r\n?/g,gw=/\u0000|\uFFFD/g;function Sh(n){return(typeof n=="string"?n:""+n).replace(mw,`
|
|
38
|
+
`).replace(gw,"")}function Bl(n,s,u){if(s=Sh(s),Sh(n)!==s&&u)throw Error(r(425))}function Fl(){}var gc=null,vc=null;function _c(n,s){return n==="textarea"||n==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var wc=typeof setTimeout=="function"?setTimeout:void 0,vw=typeof clearTimeout=="function"?clearTimeout:void 0,Eh=typeof Promise=="function"?Promise:void 0,_w=typeof queueMicrotask=="function"?queueMicrotask:typeof Eh<"u"?function(n){return Eh.resolve(null).then(n).catch(ww)}:wc;function ww(n){setTimeout(function(){throw n})}function bc(n,s){var u=s,C=0;do{var j=u.nextSibling;if(n.removeChild(u),j&&j.nodeType===8)if(u=j.data,u==="/$"){if(C===0){n.removeChild(j),Or(s);return}C--}else u!=="$"&&u!=="$?"&&u!=="$!"||C++;u=j}while(u);Or(s)}function os(n){for(;n!=null;n=n.nextSibling){var s=n.nodeType;if(s===1||s===3)break;if(s===8){if(s=n.data,s==="$"||s==="$!"||s==="$?")break;if(s==="/$")return null}}return n}function Th(n){n=n.previousSibling;for(var s=0;n;){if(n.nodeType===8){var u=n.data;if(u==="$"||u==="$!"||u==="$?"){if(s===0)return n;s--}else u==="/$"&&s++}n=n.previousSibling}return null}var Li=Math.random().toString(36).slice(2),Nr="__reactFiber$"+Li,Eo="__reactProps$"+Li,Fr="__reactContainer$"+Li,yc="__reactEvents$"+Li,bw="__reactListeners$"+Li,yw="__reactHandles$"+Li;function Ws(n){var s=n[Nr];if(s)return s;for(var u=n.parentNode;u;){if(s=u[Fr]||u[Nr]){if(u=s.alternate,s.child!==null||u!==null&&u.child!==null)for(n=Th(n);n!==null;){if(u=n[Nr])return u;n=Th(n)}return s}n=u,u=n.parentNode}return null}function To(n){return n=n[Nr]||n[Fr],!n||n.tag!==5&&n.tag!==6&&n.tag!==13&&n.tag!==3?null:n}function Ni(n){if(n.tag===5||n.tag===6)return n.stateNode;throw Error(r(33))}function Hl(n){return n[Eo]||null}var kc=[],Ri=-1;function ls(n){return{current:n}}function Vt(n){0>Ri||(n.current=kc[Ri],kc[Ri]=null,Ri--)}function qt(n,s){Ri++,kc[Ri]=n.current,n.current=s}var as={},bn=ls(as),Dn=ls(!1),qs=as;function Mi(n,s){var u=n.type.contextTypes;if(!u)return as;var C=n.stateNode;if(C&&C.__reactInternalMemoizedUnmaskedChildContext===s)return C.__reactInternalMemoizedMaskedChildContext;var j={},B;for(B in u)j[B]=s[B];return C&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=s,n.__reactInternalMemoizedMaskedChildContext=j),j}function Pn(n){return n=n.childContextTypes,n!=null}function Ul(){Vt(Dn),Vt(bn)}function Lh(n,s,u){if(bn.current!==as)throw Error(r(168));qt(bn,s),qt(Dn,u)}function Nh(n,s,u){var C=n.stateNode;if(s=s.childContextTypes,typeof C.getChildContext!="function")return u;C=C.getChildContext();for(var j in C)if(!(j in s))throw Error(r(108,Q(n)||"Unknown",j));return U({},u,C)}function $l(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||as,qs=bn.current,qt(bn,n),qt(Dn,Dn.current),!0}function Rh(n,s,u){var C=n.stateNode;if(!C)throw Error(r(169));u?(n=Nh(n,s,qs),C.__reactInternalMemoizedMergedChildContext=n,Vt(Dn),Vt(bn),qt(bn,n)):Vt(Dn),qt(Dn,u)}var Hr=null,Wl=!1,Cc=!1;function Mh(n){Hr===null?Hr=[n]:Hr.push(n)}function kw(n){Wl=!0,Mh(n)}function cs(){if(!Cc&&Hr!==null){Cc=!0;var n=0,s=Rt;try{var u=Hr;for(Rt=1;n<u.length;n++){var C=u[n];do C=C(!0);while(C!==null)}Hr=null,Wl=!1}catch(j){throw Hr!==null&&(Hr=Hr.slice(n+1)),Gr(zn,cs),j}finally{Rt=s,Cc=!1}}return null}var Ai=[],Ii=0,ql=null,zl=0,Yn=[],Xn=0,zs=null,Ur=1,$r="";function Ks(n,s){Ai[Ii++]=zl,Ai[Ii++]=ql,ql=n,zl=s}function Ah(n,s,u){Yn[Xn++]=Ur,Yn[Xn++]=$r,Yn[Xn++]=zs,zs=n;var C=Ur;n=$r;var j=32-wn(C)-1;C&=~(1<<j),u+=1;var B=32-wn(s)+j;if(30<B){var G=j-j%5;B=(C&(1<<G)-1).toString(32),C>>=G,j-=G,Ur=1<<32-wn(s)+j|u<<j|C,$r=B+n}else Ur=1<<B|u<<j|C,$r=n}function xc(n){n.return!==null&&(Ks(n,1),Ah(n,1,0))}function Sc(n){for(;n===ql;)ql=Ai[--Ii],Ai[Ii]=null,zl=Ai[--Ii],Ai[Ii]=null;for(;n===zs;)zs=Yn[--Xn],Yn[Xn]=null,$r=Yn[--Xn],Yn[Xn]=null,Ur=Yn[--Xn],Yn[Xn]=null}var Un=null,$n=null,Xt=!1,fr=null;function Ih(n,s){var u=er(5,null,null,0);u.elementType="DELETED",u.stateNode=s,u.return=n,s=n.deletions,s===null?(n.deletions=[u],n.flags|=16):s.push(u)}function jh(n,s){switch(n.tag){case 5:var u=n.type;return s=s.nodeType!==1||u.toLowerCase()!==s.nodeName.toLowerCase()?null:s,s!==null?(n.stateNode=s,Un=n,$n=os(s.firstChild),!0):!1;case 6:return s=n.pendingProps===""||s.nodeType!==3?null:s,s!==null?(n.stateNode=s,Un=n,$n=null,!0):!1;case 13:return s=s.nodeType!==8?null:s,s!==null?(u=zs!==null?{id:Ur,overflow:$r}:null,n.memoizedState={dehydrated:s,treeContext:u,retryLane:1073741824},u=er(18,null,null,0),u.stateNode=s,u.return=n,n.child=u,Un=n,$n=null,!0):!1;default:return!1}}function Ec(n){return(n.mode&1)!==0&&(n.flags&128)===0}function Tc(n){if(Xt){var s=$n;if(s){var u=s;if(!jh(n,s)){if(Ec(n))throw Error(r(418));s=os(u.nextSibling);var C=Un;s&&jh(n,s)?Ih(C,u):(n.flags=n.flags&-4097|2,Xt=!1,Un=n)}}else{if(Ec(n))throw Error(r(418));n.flags=n.flags&-4097|2,Xt=!1,Un=n}}}function Dh(n){for(n=n.return;n!==null&&n.tag!==5&&n.tag!==3&&n.tag!==13;)n=n.return;Un=n}function Kl(n){if(n!==Un)return!1;if(!Xt)return Dh(n),Xt=!0,!1;var s;if((s=n.tag!==3)&&!(s=n.tag!==5)&&(s=n.type,s=s!=="head"&&s!=="body"&&!_c(n.type,n.memoizedProps)),s&&(s=$n)){if(Ec(n))throw Ph(),Error(r(418));for(;s;)Ih(n,s),s=os(s.nextSibling)}if(Dh(n),n.tag===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(r(317));e:{for(n=n.nextSibling,s=0;n;){if(n.nodeType===8){var u=n.data;if(u==="/$"){if(s===0){$n=os(n.nextSibling);break e}s--}else u!=="$"&&u!=="$!"&&u!=="$?"||s++}n=n.nextSibling}$n=null}}else $n=Un?os(n.stateNode.nextSibling):null;return!0}function Ph(){for(var n=$n;n;)n=os(n.nextSibling)}function ji(){$n=Un=null,Xt=!1}function Lc(n){fr===null?fr=[n]:fr.push(n)}var Cw=T.ReactCurrentBatchConfig;function Lo(n,s,u){if(n=u.ref,n!==null&&typeof n!="function"&&typeof n!="object"){if(u._owner){if(u=u._owner,u){if(u.tag!==1)throw Error(r(309));var C=u.stateNode}if(!C)throw Error(r(147,n));var j=C,B=""+n;return s!==null&&s.ref!==null&&typeof s.ref=="function"&&s.ref._stringRef===B?s.ref:(s=function(G){var J=j.refs;G===null?delete J[B]:J[B]=G},s._stringRef=B,s)}if(typeof n!="string")throw Error(r(284));if(!u._owner)throw Error(r(290,n))}return n}function Vl(n,s){throw n=Object.prototype.toString.call(s),Error(r(31,n==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":n))}function Oh(n){var s=n._init;return s(n._payload)}function Bh(n){function s(ae,le){if(n){var ce=ae.deletions;ce===null?(ae.deletions=[le],ae.flags|=16):ce.push(le)}}function u(ae,le){if(!n)return null;for(;le!==null;)s(ae,le),le=le.sibling;return null}function C(ae,le){for(ae=new Map;le!==null;)le.key!==null?ae.set(le.key,le):ae.set(le.index,le),le=le.sibling;return ae}function j(ae,le){return ae=vs(ae,le),ae.index=0,ae.sibling=null,ae}function B(ae,le,ce){return ae.index=ce,n?(ce=ae.alternate,ce!==null?(ce=ce.index,ce<le?(ae.flags|=2,le):ce):(ae.flags|=2,le)):(ae.flags|=1048576,le)}function G(ae){return n&&ae.alternate===null&&(ae.flags|=2),ae}function J(ae,le,ce,Me){return le===null||le.tag!==6?(le=wu(ce,ae.mode,Me),le.return=ae,le):(le=j(le,ce),le.return=ae,le)}function ne(ae,le,ce,Me){var Ze=ce.type;return Ze===S?Se(ae,le,ce.props.children,Me,ce.key):le!==null&&(le.elementType===Ze||typeof Ze=="object"&&Ze!==null&&Ze.$$typeof===K&&Oh(Ze)===le.type)?(Me=j(le,ce.props),Me.ref=Lo(ae,le,ce),Me.return=ae,Me):(Me=va(ce.type,ce.key,ce.props,null,ae.mode,Me),Me.ref=Lo(ae,le,ce),Me.return=ae,Me)}function he(ae,le,ce,Me){return le===null||le.tag!==4||le.stateNode.containerInfo!==ce.containerInfo||le.stateNode.implementation!==ce.implementation?(le=bu(ce,ae.mode,Me),le.return=ae,le):(le=j(le,ce.children||[]),le.return=ae,le)}function Se(ae,le,ce,Me,Ze){return le===null||le.tag!==7?(le=ei(ce,ae.mode,Me,Ze),le.return=ae,le):(le=j(le,ce),le.return=ae,le)}function Ne(ae,le,ce){if(typeof le=="string"&&le!==""||typeof le=="number")return le=wu(""+le,ae.mode,ce),le.return=ae,le;if(typeof le=="object"&&le!==null){switch(le.$$typeof){case A:return ce=va(le.type,le.key,le.props,null,ae.mode,ce),ce.ref=Lo(ae,null,le),ce.return=ae,ce;case E:return le=bu(le,ae.mode,ce),le.return=ae,le;case K:var Me=le._init;return Ne(ae,Me(le._payload),ce)}if(oe(le)||O(le))return le=ei(le,ae.mode,ce,null),le.return=ae,le;Vl(ae,le)}return null}function xe(ae,le,ce,Me){var Ze=le!==null?le.key:null;if(typeof ce=="string"&&ce!==""||typeof ce=="number")return Ze!==null?null:J(ae,le,""+ce,Me);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case A:return ce.key===Ze?ne(ae,le,ce,Me):null;case E:return ce.key===Ze?he(ae,le,ce,Me):null;case K:return Ze=ce._init,xe(ae,le,Ze(ce._payload),Me)}if(oe(ce)||O(ce))return Ze!==null?null:Se(ae,le,ce,Me,null);Vl(ae,ce)}return null}function We(ae,le,ce,Me,Ze){if(typeof Me=="string"&&Me!==""||typeof Me=="number")return ae=ae.get(ce)||null,J(le,ae,""+Me,Ze);if(typeof Me=="object"&&Me!==null){switch(Me.$$typeof){case A:return ae=ae.get(Me.key===null?ce:Me.key)||null,ne(le,ae,Me,Ze);case E:return ae=ae.get(Me.key===null?ce:Me.key)||null,he(le,ae,Me,Ze);case K:var it=Me._init;return We(ae,le,ce,it(Me._payload),Ze)}if(oe(Me)||O(Me))return ae=ae.get(ce)||null,Se(le,ae,Me,Ze,null);Vl(le,Me)}return null}function Ye(ae,le,ce,Me){for(var Ze=null,it=null,ot=le,mt=le=0,hn=null;ot!==null&&mt<ce.length;mt++){ot.index>mt?(hn=ot,ot=null):hn=ot.sibling;var It=xe(ae,ot,ce[mt],Me);if(It===null){ot===null&&(ot=hn);break}n&&ot&&It.alternate===null&&s(ae,ot),le=B(It,le,mt),it===null?Ze=It:it.sibling=It,it=It,ot=hn}if(mt===ce.length)return u(ae,ot),Xt&&Ks(ae,mt),Ze;if(ot===null){for(;mt<ce.length;mt++)ot=Ne(ae,ce[mt],Me),ot!==null&&(le=B(ot,le,mt),it===null?Ze=ot:it.sibling=ot,it=ot);return Xt&&Ks(ae,mt),Ze}for(ot=C(ae,ot);mt<ce.length;mt++)hn=We(ot,ae,mt,ce[mt],Me),hn!==null&&(n&&hn.alternate!==null&&ot.delete(hn.key===null?mt:hn.key),le=B(hn,le,mt),it===null?Ze=hn:it.sibling=hn,it=hn);return n&&ot.forEach(function(_s){return s(ae,_s)}),Xt&&Ks(ae,mt),Ze}function Je(ae,le,ce,Me){var Ze=O(ce);if(typeof Ze!="function")throw Error(r(150));if(ce=Ze.call(ce),ce==null)throw Error(r(151));for(var it=Ze=null,ot=le,mt=le=0,hn=null,It=ce.next();ot!==null&&!It.done;mt++,It=ce.next()){ot.index>mt?(hn=ot,ot=null):hn=ot.sibling;var _s=xe(ae,ot,It.value,Me);if(_s===null){ot===null&&(ot=hn);break}n&&ot&&_s.alternate===null&&s(ae,ot),le=B(_s,le,mt),it===null?Ze=_s:it.sibling=_s,it=_s,ot=hn}if(It.done)return u(ae,ot),Xt&&Ks(ae,mt),Ze;if(ot===null){for(;!It.done;mt++,It=ce.next())It=Ne(ae,It.value,Me),It!==null&&(le=B(It,le,mt),it===null?Ze=It:it.sibling=It,it=It);return Xt&&Ks(ae,mt),Ze}for(ot=C(ae,ot);!It.done;mt++,It=ce.next())It=We(ot,ae,mt,It.value,Me),It!==null&&(n&&It.alternate!==null&&ot.delete(It.key===null?mt:It.key),le=B(It,le,mt),it===null?Ze=It:it.sibling=It,it=It);return n&&ot.forEach(function(nb){return s(ae,nb)}),Xt&&Ks(ae,mt),Ze}function rn(ae,le,ce,Me){if(typeof ce=="object"&&ce!==null&&ce.type===S&&ce.key===null&&(ce=ce.props.children),typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case A:e:{for(var Ze=ce.key,it=le;it!==null;){if(it.key===Ze){if(Ze=ce.type,Ze===S){if(it.tag===7){u(ae,it.sibling),le=j(it,ce.props.children),le.return=ae,ae=le;break e}}else if(it.elementType===Ze||typeof Ze=="object"&&Ze!==null&&Ze.$$typeof===K&&Oh(Ze)===it.type){u(ae,it.sibling),le=j(it,ce.props),le.ref=Lo(ae,it,ce),le.return=ae,ae=le;break e}u(ae,it);break}else s(ae,it);it=it.sibling}ce.type===S?(le=ei(ce.props.children,ae.mode,Me,ce.key),le.return=ae,ae=le):(Me=va(ce.type,ce.key,ce.props,null,ae.mode,Me),Me.ref=Lo(ae,le,ce),Me.return=ae,ae=Me)}return G(ae);case E:e:{for(it=ce.key;le!==null;){if(le.key===it)if(le.tag===4&&le.stateNode.containerInfo===ce.containerInfo&&le.stateNode.implementation===ce.implementation){u(ae,le.sibling),le=j(le,ce.children||[]),le.return=ae,ae=le;break e}else{u(ae,le);break}else s(ae,le);le=le.sibling}le=bu(ce,ae.mode,Me),le.return=ae,ae=le}return G(ae);case K:return it=ce._init,rn(ae,le,it(ce._payload),Me)}if(oe(ce))return Ye(ae,le,ce,Me);if(O(ce))return Je(ae,le,ce,Me);Vl(ae,ce)}return typeof ce=="string"&&ce!==""||typeof ce=="number"?(ce=""+ce,le!==null&&le.tag===6?(u(ae,le.sibling),le=j(le,ce),le.return=ae,ae=le):(u(ae,le),le=wu(ce,ae.mode,Me),le.return=ae,ae=le),G(ae)):u(ae,le)}return rn}var Di=Bh(!0),Fh=Bh(!1),Gl=ls(null),Yl=null,Pi=null,Nc=null;function Rc(){Nc=Pi=Yl=null}function Mc(n){var s=Gl.current;Vt(Gl),n._currentValue=s}function Ac(n,s,u){for(;n!==null;){var C=n.alternate;if((n.childLanes&s)!==s?(n.childLanes|=s,C!==null&&(C.childLanes|=s)):C!==null&&(C.childLanes&s)!==s&&(C.childLanes|=s),n===u)break;n=n.return}}function Oi(n,s){Yl=n,Nc=Pi=null,n=n.dependencies,n!==null&&n.firstContext!==null&&((n.lanes&s)!==0&&(On=!0),n.firstContext=null)}function Qn(n){var s=n._currentValue;if(Nc!==n)if(n={context:n,memoizedValue:s,next:null},Pi===null){if(Yl===null)throw Error(r(308));Pi=n,Yl.dependencies={lanes:0,firstContext:n}}else Pi=Pi.next=n;return s}var Vs=null;function Ic(n){Vs===null?Vs=[n]:Vs.push(n)}function Hh(n,s,u,C){var j=s.interleaved;return j===null?(u.next=u,Ic(s)):(u.next=j.next,j.next=u),s.interleaved=u,Wr(n,C)}function Wr(n,s){n.lanes|=s;var u=n.alternate;for(u!==null&&(u.lanes|=s),u=n,n=n.return;n!==null;)n.childLanes|=s,u=n.alternate,u!==null&&(u.childLanes|=s),u=n,n=n.return;return u.tag===3?u.stateNode:null}var us=!1;function jc(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Uh(n,s){n=n.updateQueue,s.updateQueue===n&&(s.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,effects:n.effects})}function qr(n,s){return{eventTime:n,lane:s,tag:0,payload:null,callback:null,next:null}}function ds(n,s,u){var C=n.updateQueue;if(C===null)return null;if(C=C.shared,(Mt&2)!==0){var j=C.pending;return j===null?s.next=s:(s.next=j.next,j.next=s),C.pending=s,Wr(n,u)}return j=C.interleaved,j===null?(s.next=s,Ic(C)):(s.next=j.next,j.next=s),C.interleaved=s,Wr(n,u)}function Xl(n,s,u){if(s=s.updateQueue,s!==null&&(s=s.shared,(u&4194240)!==0)){var C=s.lanes;C&=n.pendingLanes,u|=C,s.lanes=u,Sr(n,u)}}function $h(n,s){var u=n.updateQueue,C=n.alternate;if(C!==null&&(C=C.updateQueue,u===C)){var j=null,B=null;if(u=u.firstBaseUpdate,u!==null){do{var G={eventTime:u.eventTime,lane:u.lane,tag:u.tag,payload:u.payload,callback:u.callback,next:null};B===null?j=B=G:B=B.next=G,u=u.next}while(u!==null);B===null?j=B=s:B=B.next=s}else j=B=s;u={baseState:C.baseState,firstBaseUpdate:j,lastBaseUpdate:B,shared:C.shared,effects:C.effects},n.updateQueue=u;return}n=u.lastBaseUpdate,n===null?u.firstBaseUpdate=s:n.next=s,u.lastBaseUpdate=s}function Ql(n,s,u,C){var j=n.updateQueue;us=!1;var B=j.firstBaseUpdate,G=j.lastBaseUpdate,J=j.shared.pending;if(J!==null){j.shared.pending=null;var ne=J,he=ne.next;ne.next=null,G===null?B=he:G.next=he,G=ne;var Se=n.alternate;Se!==null&&(Se=Se.updateQueue,J=Se.lastBaseUpdate,J!==G&&(J===null?Se.firstBaseUpdate=he:J.next=he,Se.lastBaseUpdate=ne))}if(B!==null){var Ne=j.baseState;G=0,Se=he=ne=null,J=B;do{var xe=J.lane,We=J.eventTime;if((C&xe)===xe){Se!==null&&(Se=Se.next={eventTime:We,lane:0,tag:J.tag,payload:J.payload,callback:J.callback,next:null});e:{var Ye=n,Je=J;switch(xe=s,We=u,Je.tag){case 1:if(Ye=Je.payload,typeof Ye=="function"){Ne=Ye.call(We,Ne,xe);break e}Ne=Ye;break e;case 3:Ye.flags=Ye.flags&-65537|128;case 0:if(Ye=Je.payload,xe=typeof Ye=="function"?Ye.call(We,Ne,xe):Ye,xe==null)break e;Ne=U({},Ne,xe);break e;case 2:us=!0}}J.callback!==null&&J.lane!==0&&(n.flags|=64,xe=j.effects,xe===null?j.effects=[J]:xe.push(J))}else We={eventTime:We,lane:xe,tag:J.tag,payload:J.payload,callback:J.callback,next:null},Se===null?(he=Se=We,ne=Ne):Se=Se.next=We,G|=xe;if(J=J.next,J===null){if(J=j.shared.pending,J===null)break;xe=J,J=xe.next,xe.next=null,j.lastBaseUpdate=xe,j.shared.pending=null}}while(!0);if(Se===null&&(ne=Ne),j.baseState=ne,j.firstBaseUpdate=he,j.lastBaseUpdate=Se,s=j.shared.interleaved,s!==null){j=s;do G|=j.lane,j=j.next;while(j!==s)}else B===null&&(j.shared.lanes=0);Xs|=G,n.lanes=G,n.memoizedState=Ne}}function Wh(n,s,u){if(n=s.effects,s.effects=null,n!==null)for(s=0;s<n.length;s++){var C=n[s],j=C.callback;if(j!==null){if(C.callback=null,C=u,typeof j!="function")throw Error(r(191,j));j.call(C)}}}var No={},Rr=ls(No),Ro=ls(No),Mo=ls(No);function Gs(n){if(n===No)throw Error(r(174));return n}function Dc(n,s){switch(qt(Mo,s),qt(Ro,n),qt(Rr,No),n=s.nodeType,n){case 9:case 11:s=(s=s.documentElement)?s.namespaceURI:kt(null,"");break;default:n=n===8?s.parentNode:s,s=n.namespaceURI||null,n=n.tagName,s=kt(s,n)}Vt(Rr),qt(Rr,s)}function Bi(){Vt(Rr),Vt(Ro),Vt(Mo)}function qh(n){Gs(Mo.current);var s=Gs(Rr.current),u=kt(s,n.type);s!==u&&(qt(Ro,n),qt(Rr,u))}function Pc(n){Ro.current===n&&(Vt(Rr),Vt(Ro))}var Zt=ls(0);function Jl(n){for(var s=n;s!==null;){if(s.tag===13){var u=s.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||u.data==="$?"||u.data==="$!"))return s}else if(s.tag===19&&s.memoizedProps.revealOrder!==void 0){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===n)break;for(;s.sibling===null;){if(s.return===null||s.return===n)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var Oc=[];function Bc(){for(var n=0;n<Oc.length;n++)Oc[n]._workInProgressVersionPrimary=null;Oc.length=0}var Zl=T.ReactCurrentDispatcher,Fc=T.ReactCurrentBatchConfig,Ys=0,en=null,an=null,un=null,ea=!1,Ao=!1,Io=0,xw=0;function yn(){throw Error(r(321))}function Hc(n,s){if(s===null)return!1;for(var u=0;u<s.length&&u<n.length;u++)if(!jn(n[u],s[u]))return!1;return!0}function Uc(n,s,u,C,j,B){if(Ys=B,en=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,Zl.current=n===null||n.memoizedState===null?Lw:Nw,n=u(C,j),Ao){B=0;do{if(Ao=!1,Io=0,25<=B)throw Error(r(301));B+=1,un=an=null,s.updateQueue=null,Zl.current=Rw,n=u(C,j)}while(Ao)}if(Zl.current=ra,s=an!==null&&an.next!==null,Ys=0,un=an=en=null,ea=!1,s)throw Error(r(300));return n}function $c(){var n=Io!==0;return Io=0,n}function Mr(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return un===null?en.memoizedState=un=n:un=un.next=n,un}function Jn(){if(an===null){var n=en.alternate;n=n!==null?n.memoizedState:null}else n=an.next;var s=un===null?en.memoizedState:un.next;if(s!==null)un=s,an=n;else{if(n===null)throw Error(r(310));an=n,n={memoizedState:an.memoizedState,baseState:an.baseState,baseQueue:an.baseQueue,queue:an.queue,next:null},un===null?en.memoizedState=un=n:un=un.next=n}return un}function jo(n,s){return typeof s=="function"?s(n):s}function Wc(n){var s=Jn(),u=s.queue;if(u===null)throw Error(r(311));u.lastRenderedReducer=n;var C=an,j=C.baseQueue,B=u.pending;if(B!==null){if(j!==null){var G=j.next;j.next=B.next,B.next=G}C.baseQueue=j=B,u.pending=null}if(j!==null){B=j.next,C=C.baseState;var J=G=null,ne=null,he=B;do{var Se=he.lane;if((Ys&Se)===Se)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 Ne={lane:Se,action:he.action,hasEagerState:he.hasEagerState,eagerState:he.eagerState,next:null};ne===null?(J=ne=Ne,G=C):ne=ne.next=Ne,en.lanes|=Se,Xs|=Se}he=he.next}while(he!==null&&he!==B);ne===null?G=C:ne.next=J,jn(C,s.memoizedState)||(On=!0),s.memoizedState=C,s.baseState=G,s.baseQueue=ne,u.lastRenderedState=C}if(n=u.interleaved,n!==null){j=n;do B=j.lane,en.lanes|=B,Xs|=B,j=j.next;while(j!==n)}else j===null&&(u.lanes=0);return[s.memoizedState,u.dispatch]}function qc(n){var s=Jn(),u=s.queue;if(u===null)throw Error(r(311));u.lastRenderedReducer=n;var C=u.dispatch,j=u.pending,B=s.memoizedState;if(j!==null){u.pending=null;var G=j=j.next;do B=n(B,G.action),G=G.next;while(G!==j);jn(B,s.memoizedState)||(On=!0),s.memoizedState=B,s.baseQueue===null&&(s.baseState=B),u.lastRenderedState=B}return[B,C]}function zh(){}function Kh(n,s){var u=en,C=Jn(),j=s(),B=!jn(C.memoizedState,j);if(B&&(C.memoizedState=j,On=!0),C=C.queue,zc(Yh.bind(null,u,C,n),[n]),C.getSnapshot!==s||B||un!==null&&un.memoizedState.tag&1){if(u.flags|=2048,Do(9,Gh.bind(null,u,C,j,s),void 0,null),dn===null)throw Error(r(349));(Ys&30)!==0||Vh(u,s,j)}return j}function Vh(n,s,u){n.flags|=16384,n={getSnapshot:s,value:u},s=en.updateQueue,s===null?(s={lastEffect:null,stores:null},en.updateQueue=s,s.stores=[n]):(u=s.stores,u===null?s.stores=[n]:u.push(n))}function Gh(n,s,u,C){s.value=u,s.getSnapshot=C,Xh(s)&&Qh(n)}function Yh(n,s,u){return u(function(){Xh(s)&&Qh(n)})}function Xh(n){var s=n.getSnapshot;n=n.value;try{var u=s();return!jn(n,u)}catch{return!0}}function Qh(n){var s=Wr(n,1);s!==null&&vr(s,n,1,-1)}function Jh(n){var s=Mr();return typeof n=="function"&&(n=n()),s.memoizedState=s.baseState=n,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:jo,lastRenderedState:n},s.queue=n,n=n.dispatch=Tw.bind(null,en,n),[s.memoizedState,n]}function Do(n,s,u,C){return n={tag:n,create:s,destroy:u,deps:C,next:null},s=en.updateQueue,s===null?(s={lastEffect:null,stores:null},en.updateQueue=s,s.lastEffect=n.next=n):(u=s.lastEffect,u===null?s.lastEffect=n.next=n:(C=u.next,u.next=n,n.next=C,s.lastEffect=n)),n}function Zh(){return Jn().memoizedState}function ta(n,s,u,C){var j=Mr();en.flags|=n,j.memoizedState=Do(1|s,u,void 0,C===void 0?null:C)}function na(n,s,u,C){var j=Jn();C=C===void 0?null:C;var B=void 0;if(an!==null){var G=an.memoizedState;if(B=G.destroy,C!==null&&Hc(C,G.deps)){j.memoizedState=Do(s,u,B,C);return}}en.flags|=n,j.memoizedState=Do(1|s,u,B,C)}function ef(n,s){return ta(8390656,8,n,s)}function zc(n,s){return na(2048,8,n,s)}function tf(n,s){return na(4,2,n,s)}function nf(n,s){return na(4,4,n,s)}function rf(n,s){if(typeof s=="function")return n=n(),s(n),function(){s(null)};if(s!=null)return n=n(),s.current=n,function(){s.current=null}}function sf(n,s,u){return u=u!=null?u.concat([n]):null,na(4,4,rf.bind(null,s,n),u)}function Kc(){}function of(n,s){var u=Jn();s=s===void 0?null:s;var C=u.memoizedState;return C!==null&&s!==null&&Hc(s,C[1])?C[0]:(u.memoizedState=[n,s],n)}function lf(n,s){var u=Jn();s=s===void 0?null:s;var C=u.memoizedState;return C!==null&&s!==null&&Hc(s,C[1])?C[0]:(n=n(),u.memoizedState=[n,s],n)}function af(n,s,u){return(Ys&21)===0?(n.baseState&&(n.baseState=!1,On=!0),n.memoizedState=u):(jn(u,s)||(u=Ot(),en.lanes|=u,Xs|=u,n.baseState=!0),s)}function Sw(n,s){var u=Rt;Rt=u!==0&&4>u?u:4,n(!0);var C=Fc.transition;Fc.transition={};try{n(!1),s()}finally{Rt=u,Fc.transition=C}}function cf(){return Jn().memoizedState}function Ew(n,s,u){var C=ms(n);if(u={lane:C,action:u,hasEagerState:!1,eagerState:null,next:null},uf(n))df(s,u);else if(u=Hh(n,s,u,C),u!==null){var j=Rn();vr(u,n,C,j),hf(u,s,C)}}function Tw(n,s,u){var C=ms(n),j={lane:C,action:u,hasEagerState:!1,eagerState:null,next:null};if(uf(n))df(s,j);else{var B=n.alternate;if(n.lanes===0&&(B===null||B.lanes===0)&&(B=s.lastRenderedReducer,B!==null))try{var G=s.lastRenderedState,J=B(G,u);if(j.hasEagerState=!0,j.eagerState=J,jn(J,G)){var ne=s.interleaved;ne===null?(j.next=j,Ic(s)):(j.next=ne.next,ne.next=j),s.interleaved=j;return}}catch{}finally{}u=Hh(n,s,j,C),u!==null&&(j=Rn(),vr(u,n,C,j),hf(u,s,C))}}function uf(n){var s=n.alternate;return n===en||s!==null&&s===en}function df(n,s){Ao=ea=!0;var u=n.pending;u===null?s.next=s:(s.next=u.next,u.next=s),n.pending=s}function hf(n,s,u){if((u&4194240)!==0){var C=s.lanes;C&=n.pendingLanes,u|=C,s.lanes=u,Sr(n,u)}}var ra={readContext:Qn,useCallback:yn,useContext:yn,useEffect:yn,useImperativeHandle:yn,useInsertionEffect:yn,useLayoutEffect:yn,useMemo:yn,useReducer:yn,useRef:yn,useState:yn,useDebugValue:yn,useDeferredValue:yn,useTransition:yn,useMutableSource:yn,useSyncExternalStore:yn,useId:yn,unstable_isNewReconciler:!1},Lw={readContext:Qn,useCallback:function(n,s){return Mr().memoizedState=[n,s===void 0?null:s],n},useContext:Qn,useEffect:ef,useImperativeHandle:function(n,s,u){return u=u!=null?u.concat([n]):null,ta(4194308,4,rf.bind(null,s,n),u)},useLayoutEffect:function(n,s){return ta(4194308,4,n,s)},useInsertionEffect:function(n,s){return ta(4,2,n,s)},useMemo:function(n,s){var u=Mr();return s=s===void 0?null:s,n=n(),u.memoizedState=[n,s],n},useReducer:function(n,s,u){var C=Mr();return s=u!==void 0?u(s):s,C.memoizedState=C.baseState=s,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:s},C.queue=n,n=n.dispatch=Ew.bind(null,en,n),[C.memoizedState,n]},useRef:function(n){var s=Mr();return n={current:n},s.memoizedState=n},useState:Jh,useDebugValue:Kc,useDeferredValue:function(n){return Mr().memoizedState=n},useTransition:function(){var n=Jh(!1),s=n[0];return n=Sw.bind(null,n[1]),Mr().memoizedState=n,[s,n]},useMutableSource:function(){},useSyncExternalStore:function(n,s,u){var C=en,j=Mr();if(Xt){if(u===void 0)throw Error(r(407));u=u()}else{if(u=s(),dn===null)throw Error(r(349));(Ys&30)!==0||Vh(C,s,u)}j.memoizedState=u;var B={value:u,getSnapshot:s};return j.queue=B,ef(Yh.bind(null,C,B,n),[n]),C.flags|=2048,Do(9,Gh.bind(null,C,B,u,s),void 0,null),u},useId:function(){var n=Mr(),s=dn.identifierPrefix;if(Xt){var u=$r,C=Ur;u=(C&~(1<<32-wn(C)-1)).toString(32)+u,s=":"+s+"R"+u,u=Io++,0<u&&(s+="H"+u.toString(32)),s+=":"}else u=xw++,s=":"+s+"r"+u.toString(32)+":";return n.memoizedState=s},unstable_isNewReconciler:!1},Nw={readContext:Qn,useCallback:of,useContext:Qn,useEffect:zc,useImperativeHandle:sf,useInsertionEffect:tf,useLayoutEffect:nf,useMemo:lf,useReducer:Wc,useRef:Zh,useState:function(){return Wc(jo)},useDebugValue:Kc,useDeferredValue:function(n){var s=Jn();return af(s,an.memoizedState,n)},useTransition:function(){var n=Wc(jo)[0],s=Jn().memoizedState;return[n,s]},useMutableSource:zh,useSyncExternalStore:Kh,useId:cf,unstable_isNewReconciler:!1},Rw={readContext:Qn,useCallback:of,useContext:Qn,useEffect:zc,useImperativeHandle:sf,useInsertionEffect:tf,useLayoutEffect:nf,useMemo:lf,useReducer:qc,useRef:Zh,useState:function(){return qc(jo)},useDebugValue:Kc,useDeferredValue:function(n){var s=Jn();return an===null?s.memoizedState=n:af(s,an.memoizedState,n)},useTransition:function(){var n=qc(jo)[0],s=Jn().memoizedState;return[n,s]},useMutableSource:zh,useSyncExternalStore:Kh,useId:cf,unstable_isNewReconciler:!1};function pr(n,s){if(n&&n.defaultProps){s=U({},s),n=n.defaultProps;for(var u in n)s[u]===void 0&&(s[u]=n[u]);return s}return s}function Vc(n,s,u,C){s=n.memoizedState,u=u(C,s),u=u==null?s:U({},s,u),n.memoizedState=u,n.lanes===0&&(n.updateQueue.baseState=u)}var sa={isMounted:function(n){return(n=n._reactInternals)?wt(n)===n:!1},enqueueSetState:function(n,s,u){n=n._reactInternals;var C=Rn(),j=ms(n),B=qr(C,j);B.payload=s,u!=null&&(B.callback=u),s=ds(n,B,j),s!==null&&(vr(s,n,j,C),Xl(s,n,j))},enqueueReplaceState:function(n,s,u){n=n._reactInternals;var C=Rn(),j=ms(n),B=qr(C,j);B.tag=1,B.payload=s,u!=null&&(B.callback=u),s=ds(n,B,j),s!==null&&(vr(s,n,j,C),Xl(s,n,j))},enqueueForceUpdate:function(n,s){n=n._reactInternals;var u=Rn(),C=ms(n),j=qr(u,C);j.tag=2,s!=null&&(j.callback=s),s=ds(n,j,C),s!==null&&(vr(s,n,C,u),Xl(s,n,C))}};function ff(n,s,u,C,j,B,G){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(C,B,G):s.prototype&&s.prototype.isPureReactComponent?!hr(u,C)||!hr(j,B):!0}function pf(n,s,u){var C=!1,j=as,B=s.contextType;return typeof B=="object"&&B!==null?B=Qn(B):(j=Pn(s)?qs:bn.current,C=s.contextTypes,B=(C=C!=null)?Mi(n,j):as),s=new s(u,B),n.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=sa,n.stateNode=s,s._reactInternals=n,C&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=j,n.__reactInternalMemoizedMaskedChildContext=B),s}function mf(n,s,u,C){n=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(u,C),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(u,C),s.state!==n&&sa.enqueueReplaceState(s,s.state,null)}function Gc(n,s,u,C){var j=n.stateNode;j.props=u,j.state=n.memoizedState,j.refs={},jc(n);var B=s.contextType;typeof B=="object"&&B!==null?j.context=Qn(B):(B=Pn(s)?qs:bn.current,j.context=Mi(n,B)),j.state=n.memoizedState,B=s.getDerivedStateFromProps,typeof B=="function"&&(Vc(n,s,B,u),j.state=n.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof j.getSnapshotBeforeUpdate=="function"||typeof j.UNSAFE_componentWillMount!="function"&&typeof j.componentWillMount!="function"||(s=j.state,typeof j.componentWillMount=="function"&&j.componentWillMount(),typeof j.UNSAFE_componentWillMount=="function"&&j.UNSAFE_componentWillMount(),s!==j.state&&sa.enqueueReplaceState(j,j.state,null),Ql(n,u,j,C),j.state=n.memoizedState),typeof j.componentDidMount=="function"&&(n.flags|=4194308)}function Fi(n,s){try{var u="",C=s;do u+=we(C),C=C.return;while(C);var j=u}catch(B){j=`
|
|
39
|
+
Error generating stack: `+B.message+`
|
|
40
|
+
`+B.stack}return{value:n,source:s,stack:j,digest:null}}function Yc(n,s,u){return{value:n,source:null,stack:u??null,digest:s??null}}function Xc(n,s){try{console.error(s.value)}catch(u){setTimeout(function(){throw u})}}var Mw=typeof WeakMap=="function"?WeakMap:Map;function gf(n,s,u){u=qr(-1,u),u.tag=3,u.payload={element:null};var C=s.value;return u.callback=function(){da||(da=!0,du=C),Xc(n,s)},u}function vf(n,s,u){u=qr(-1,u),u.tag=3;var C=n.type.getDerivedStateFromError;if(typeof C=="function"){var j=s.value;u.payload=function(){return C(j)},u.callback=function(){Xc(n,s)}}var B=n.stateNode;return B!==null&&typeof B.componentDidCatch=="function"&&(u.callback=function(){Xc(n,s),typeof C!="function"&&(fs===null?fs=new Set([this]):fs.add(this));var G=s.stack;this.componentDidCatch(s.value,{componentStack:G!==null?G:""})}),u}function _f(n,s,u){var C=n.pingCache;if(C===null){C=n.pingCache=new Mw;var j=new Set;C.set(s,j)}else j=C.get(s),j===void 0&&(j=new Set,C.set(s,j));j.has(u)||(j.add(u),n=zw.bind(null,n,s,u),s.then(n,n))}function wf(n){do{var s;if((s=n.tag===13)&&(s=n.memoizedState,s=s!==null?s.dehydrated!==null:!0),s)return n;n=n.return}while(n!==null);return null}function bf(n,s,u,C,j){return(n.mode&1)===0?(n===s?n.flags|=65536:(n.flags|=128,u.flags|=131072,u.flags&=-52805,u.tag===1&&(u.alternate===null?u.tag=17:(s=qr(-1,1),s.tag=2,ds(u,s,1))),u.lanes|=1),n):(n.flags|=65536,n.lanes=j,n)}var Aw=T.ReactCurrentOwner,On=!1;function Nn(n,s,u,C){s.child=n===null?Fh(s,null,u,C):Di(s,n.child,u,C)}function yf(n,s,u,C,j){u=u.render;var B=s.ref;return Oi(s,j),C=Uc(n,s,u,C,B,j),u=$c(),n!==null&&!On?(s.updateQueue=n.updateQueue,s.flags&=-2053,n.lanes&=~j,zr(n,s,j)):(Xt&&u&&xc(s),s.flags|=1,Nn(n,s,C,j),s.child)}function kf(n,s,u,C,j){if(n===null){var B=u.type;return typeof B=="function"&&!_u(B)&&B.defaultProps===void 0&&u.compare===null&&u.defaultProps===void 0?(s.tag=15,s.type=B,Cf(n,s,B,C,j)):(n=va(u.type,null,C,s,s.mode,j),n.ref=s.ref,n.return=s,s.child=n)}if(B=n.child,(n.lanes&j)===0){var G=B.memoizedProps;if(u=u.compare,u=u!==null?u:hr,u(G,C)&&n.ref===s.ref)return zr(n,s,j)}return s.flags|=1,n=vs(B,C),n.ref=s.ref,n.return=s,s.child=n}function Cf(n,s,u,C,j){if(n!==null){var B=n.memoizedProps;if(hr(B,C)&&n.ref===s.ref)if(On=!1,s.pendingProps=C=B,(n.lanes&j)!==0)(n.flags&131072)!==0&&(On=!0);else return s.lanes=n.lanes,zr(n,s,j)}return Qc(n,s,u,C,j)}function xf(n,s,u){var C=s.pendingProps,j=C.children,B=n!==null?n.memoizedState:null;if(C.mode==="hidden")if((s.mode&1)===0)s.memoizedState={baseLanes:0,cachePool:null,transitions:null},qt(Ui,Wn),Wn|=u;else{if((u&1073741824)===0)return n=B!==null?B.baseLanes|u:u,s.lanes=s.childLanes=1073741824,s.memoizedState={baseLanes:n,cachePool:null,transitions:null},s.updateQueue=null,qt(Ui,Wn),Wn|=n,null;s.memoizedState={baseLanes:0,cachePool:null,transitions:null},C=B!==null?B.baseLanes:u,qt(Ui,Wn),Wn|=C}else B!==null?(C=B.baseLanes|u,s.memoizedState=null):C=u,qt(Ui,Wn),Wn|=C;return Nn(n,s,j,u),s.child}function Sf(n,s){var u=s.ref;(n===null&&u!==null||n!==null&&n.ref!==u)&&(s.flags|=512,s.flags|=2097152)}function Qc(n,s,u,C,j){var B=Pn(u)?qs:bn.current;return B=Mi(s,B),Oi(s,j),u=Uc(n,s,u,C,B,j),C=$c(),n!==null&&!On?(s.updateQueue=n.updateQueue,s.flags&=-2053,n.lanes&=~j,zr(n,s,j)):(Xt&&C&&xc(s),s.flags|=1,Nn(n,s,u,j),s.child)}function Ef(n,s,u,C,j){if(Pn(u)){var B=!0;$l(s)}else B=!1;if(Oi(s,j),s.stateNode===null)oa(n,s),pf(s,u,C),Gc(s,u,C,j),C=!0;else if(n===null){var G=s.stateNode,J=s.memoizedProps;G.props=J;var ne=G.context,he=u.contextType;typeof he=="object"&&he!==null?he=Qn(he):(he=Pn(u)?qs:bn.current,he=Mi(s,he));var Se=u.getDerivedStateFromProps,Ne=typeof Se=="function"||typeof G.getSnapshotBeforeUpdate=="function";Ne||typeof G.UNSAFE_componentWillReceiveProps!="function"&&typeof G.componentWillReceiveProps!="function"||(J!==C||ne!==he)&&mf(s,G,C,he),us=!1;var xe=s.memoizedState;G.state=xe,Ql(s,C,G,j),ne=s.memoizedState,J!==C||xe!==ne||Dn.current||us?(typeof Se=="function"&&(Vc(s,u,Se,C),ne=s.memoizedState),(J=us||ff(s,u,J,C,xe,ne,he))?(Ne||typeof G.UNSAFE_componentWillMount!="function"&&typeof G.componentWillMount!="function"||(typeof G.componentWillMount=="function"&&G.componentWillMount(),typeof G.UNSAFE_componentWillMount=="function"&&G.UNSAFE_componentWillMount()),typeof G.componentDidMount=="function"&&(s.flags|=4194308)):(typeof G.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=C,s.memoizedState=ne),G.props=C,G.state=ne,G.context=he,C=J):(typeof G.componentDidMount=="function"&&(s.flags|=4194308),C=!1)}else{G=s.stateNode,Uh(n,s),J=s.memoizedProps,he=s.type===s.elementType?J:pr(s.type,J),G.props=he,Ne=s.pendingProps,xe=G.context,ne=u.contextType,typeof ne=="object"&&ne!==null?ne=Qn(ne):(ne=Pn(u)?qs:bn.current,ne=Mi(s,ne));var We=u.getDerivedStateFromProps;(Se=typeof We=="function"||typeof G.getSnapshotBeforeUpdate=="function")||typeof G.UNSAFE_componentWillReceiveProps!="function"&&typeof G.componentWillReceiveProps!="function"||(J!==Ne||xe!==ne)&&mf(s,G,C,ne),us=!1,xe=s.memoizedState,G.state=xe,Ql(s,C,G,j);var Ye=s.memoizedState;J!==Ne||xe!==Ye||Dn.current||us?(typeof We=="function"&&(Vc(s,u,We,C),Ye=s.memoizedState),(he=us||ff(s,u,he,C,xe,Ye,ne)||!1)?(Se||typeof G.UNSAFE_componentWillUpdate!="function"&&typeof G.componentWillUpdate!="function"||(typeof G.componentWillUpdate=="function"&&G.componentWillUpdate(C,Ye,ne),typeof G.UNSAFE_componentWillUpdate=="function"&&G.UNSAFE_componentWillUpdate(C,Ye,ne)),typeof G.componentDidUpdate=="function"&&(s.flags|=4),typeof G.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof G.componentDidUpdate!="function"||J===n.memoizedProps&&xe===n.memoizedState||(s.flags|=4),typeof G.getSnapshotBeforeUpdate!="function"||J===n.memoizedProps&&xe===n.memoizedState||(s.flags|=1024),s.memoizedProps=C,s.memoizedState=Ye),G.props=C,G.state=Ye,G.context=ne,C=he):(typeof G.componentDidUpdate!="function"||J===n.memoizedProps&&xe===n.memoizedState||(s.flags|=4),typeof G.getSnapshotBeforeUpdate!="function"||J===n.memoizedProps&&xe===n.memoizedState||(s.flags|=1024),C=!1)}return Jc(n,s,u,C,B,j)}function Jc(n,s,u,C,j,B){Sf(n,s);var G=(s.flags&128)!==0;if(!C&&!G)return j&&Rh(s,u,!1),zr(n,s,B);C=s.stateNode,Aw.current=s;var J=G&&typeof u.getDerivedStateFromError!="function"?null:C.render();return s.flags|=1,n!==null&&G?(s.child=Di(s,n.child,null,B),s.child=Di(s,null,J,B)):Nn(n,s,J,B),s.memoizedState=C.state,j&&Rh(s,u,!0),s.child}function Tf(n){var s=n.stateNode;s.pendingContext?Lh(n,s.pendingContext,s.pendingContext!==s.context):s.context&&Lh(n,s.context,!1),Dc(n,s.containerInfo)}function Lf(n,s,u,C,j){return ji(),Lc(j),s.flags|=256,Nn(n,s,u,C),s.child}var Zc={dehydrated:null,treeContext:null,retryLane:0};function eu(n){return{baseLanes:n,cachePool:null,transitions:null}}function Nf(n,s,u){var C=s.pendingProps,j=Zt.current,B=!1,G=(s.flags&128)!==0,J;if((J=G)||(J=n!==null&&n.memoizedState===null?!1:(j&2)!==0),J?(B=!0,s.flags&=-129):(n===null||n.memoizedState!==null)&&(j|=1),qt(Zt,j&1),n===null)return Tc(s),n=s.memoizedState,n!==null&&(n=n.dehydrated,n!==null)?((s.mode&1)===0?s.lanes=1:n.data==="$!"?s.lanes=8:s.lanes=1073741824,null):(G=C.children,n=C.fallback,B?(C=s.mode,B=s.child,G={mode:"hidden",children:G},(C&1)===0&&B!==null?(B.childLanes=0,B.pendingProps=G):B=_a(G,C,0,null),n=ei(n,C,u,null),B.return=s,n.return=s,B.sibling=n,s.child=B,s.child.memoizedState=eu(u),s.memoizedState=Zc,n):tu(s,G));if(j=n.memoizedState,j!==null&&(J=j.dehydrated,J!==null))return Iw(n,s,G,C,J,j,u);if(B){B=C.fallback,G=s.mode,j=n.child,J=j.sibling;var ne={mode:"hidden",children:C.children};return(G&1)===0&&s.child!==j?(C=s.child,C.childLanes=0,C.pendingProps=ne,s.deletions=null):(C=vs(j,ne),C.subtreeFlags=j.subtreeFlags&14680064),J!==null?B=vs(J,B):(B=ei(B,G,u,null),B.flags|=2),B.return=s,C.return=s,C.sibling=B,s.child=C,C=B,B=s.child,G=n.child.memoizedState,G=G===null?eu(u):{baseLanes:G.baseLanes|u,cachePool:null,transitions:G.transitions},B.memoizedState=G,B.childLanes=n.childLanes&~u,s.memoizedState=Zc,C}return B=n.child,n=B.sibling,C=vs(B,{mode:"visible",children:C.children}),(s.mode&1)===0&&(C.lanes=u),C.return=s,C.sibling=null,n!==null&&(u=s.deletions,u===null?(s.deletions=[n],s.flags|=16):u.push(n)),s.child=C,s.memoizedState=null,C}function tu(n,s){return s=_a({mode:"visible",children:s},n.mode,0,null),s.return=n,n.child=s}function ia(n,s,u,C){return C!==null&&Lc(C),Di(s,n.child,null,u),n=tu(s,s.pendingProps.children),n.flags|=2,s.memoizedState=null,n}function Iw(n,s,u,C,j,B,G){if(u)return s.flags&256?(s.flags&=-257,C=Yc(Error(r(422))),ia(n,s,G,C)):s.memoizedState!==null?(s.child=n.child,s.flags|=128,null):(B=C.fallback,j=s.mode,C=_a({mode:"visible",children:C.children},j,0,null),B=ei(B,j,G,null),B.flags|=2,C.return=s,B.return=s,C.sibling=B,s.child=C,(s.mode&1)!==0&&Di(s,n.child,null,G),s.child.memoizedState=eu(G),s.memoizedState=Zc,B);if((s.mode&1)===0)return ia(n,s,G,null);if(j.data==="$!"){if(C=j.nextSibling&&j.nextSibling.dataset,C)var J=C.dgst;return C=J,B=Error(r(419)),C=Yc(B,C,void 0),ia(n,s,G,C)}if(J=(G&n.childLanes)!==0,On||J){if(C=dn,C!==null){switch(G&-G){case 4:j=2;break;case 16:j=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:j=32;break;case 536870912:j=268435456;break;default:j=0}j=(j&(C.suspendedLanes|G))!==0?0:j,j!==0&&j!==B.retryLane&&(B.retryLane=j,Wr(n,j),vr(C,n,j,-1))}return vu(),C=Yc(Error(r(421))),ia(n,s,G,C)}return j.data==="$?"?(s.flags|=128,s.child=n.child,s=Kw.bind(null,n),j._reactRetry=s,null):(n=B.treeContext,$n=os(j.nextSibling),Un=s,Xt=!0,fr=null,n!==null&&(Yn[Xn++]=Ur,Yn[Xn++]=$r,Yn[Xn++]=zs,Ur=n.id,$r=n.overflow,zs=s),s=tu(s,C.children),s.flags|=4096,s)}function Rf(n,s,u){n.lanes|=s;var C=n.alternate;C!==null&&(C.lanes|=s),Ac(n.return,s,u)}function nu(n,s,u,C,j){var B=n.memoizedState;B===null?n.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:C,tail:u,tailMode:j}:(B.isBackwards=s,B.rendering=null,B.renderingStartTime=0,B.last=C,B.tail=u,B.tailMode=j)}function Mf(n,s,u){var C=s.pendingProps,j=C.revealOrder,B=C.tail;if(Nn(n,s,C.children,u),C=Zt.current,(C&2)!==0)C=C&1|2,s.flags|=128;else{if(n!==null&&(n.flags&128)!==0)e:for(n=s.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&Rf(n,u,s);else if(n.tag===19)Rf(n,u,s);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===s)break e;for(;n.sibling===null;){if(n.return===null||n.return===s)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}C&=1}if(qt(Zt,C),(s.mode&1)===0)s.memoizedState=null;else switch(j){case"forwards":for(u=s.child,j=null;u!==null;)n=u.alternate,n!==null&&Jl(n)===null&&(j=u),u=u.sibling;u=j,u===null?(j=s.child,s.child=null):(j=u.sibling,u.sibling=null),nu(s,!1,j,u,B);break;case"backwards":for(u=null,j=s.child,s.child=null;j!==null;){if(n=j.alternate,n!==null&&Jl(n)===null){s.child=j;break}n=j.sibling,j.sibling=u,u=j,j=n}nu(s,!0,u,null,B);break;case"together":nu(s,!1,null,null,void 0);break;default:s.memoizedState=null}return s.child}function oa(n,s){(s.mode&1)===0&&n!==null&&(n.alternate=null,s.alternate=null,s.flags|=2)}function zr(n,s,u){if(n!==null&&(s.dependencies=n.dependencies),Xs|=s.lanes,(u&s.childLanes)===0)return null;if(n!==null&&s.child!==n.child)throw Error(r(153));if(s.child!==null){for(n=s.child,u=vs(n,n.pendingProps),s.child=u,u.return=s;n.sibling!==null;)n=n.sibling,u=u.sibling=vs(n,n.pendingProps),u.return=s;u.sibling=null}return s.child}function jw(n,s,u){switch(s.tag){case 3:Tf(s),ji();break;case 5:qh(s);break;case 1:Pn(s.type)&&$l(s);break;case 4:Dc(s,s.stateNode.containerInfo);break;case 10:var C=s.type._context,j=s.memoizedProps.value;qt(Gl,C._currentValue),C._currentValue=j;break;case 13:if(C=s.memoizedState,C!==null)return C.dehydrated!==null?(qt(Zt,Zt.current&1),s.flags|=128,null):(u&s.child.childLanes)!==0?Nf(n,s,u):(qt(Zt,Zt.current&1),n=zr(n,s,u),n!==null?n.sibling:null);qt(Zt,Zt.current&1);break;case 19:if(C=(u&s.childLanes)!==0,(n.flags&128)!==0){if(C)return Mf(n,s,u);s.flags|=128}if(j=s.memoizedState,j!==null&&(j.rendering=null,j.tail=null,j.lastEffect=null),qt(Zt,Zt.current),C)break;return null;case 22:case 23:return s.lanes=0,xf(n,s,u)}return zr(n,s,u)}var Af,ru,If,jf;Af=function(n,s){for(var u=s.child;u!==null;){if(u.tag===5||u.tag===6)n.appendChild(u.stateNode);else if(u.tag!==4&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===s)break;for(;u.sibling===null;){if(u.return===null||u.return===s)return;u=u.return}u.sibling.return=u.return,u=u.sibling}},ru=function(){},If=function(n,s,u,C){var j=n.memoizedProps;if(j!==C){n=s.stateNode,Gs(Rr.current);var B=null;switch(u){case"input":j=Ue(n,j),C=Ue(n,C),B=[];break;case"select":j=U({},j,{value:void 0}),C=U({},C,{value:void 0}),B=[];break;case"textarea":j=De(n,j),C=De(n,C),B=[];break;default:typeof j.onClick!="function"&&typeof C.onClick=="function"&&(n.onclick=Fl)}Ie(u,C);var G;u=null;for(he in j)if(!C.hasOwnProperty(he)&&j.hasOwnProperty(he)&&j[he]!=null)if(he==="style"){var J=j[he];for(G in J)J.hasOwnProperty(G)&&(u||(u={}),u[G]="")}else he!=="dangerouslySetInnerHTML"&&he!=="children"&&he!=="suppressContentEditableWarning"&&he!=="suppressHydrationWarning"&&he!=="autoFocus"&&(a.hasOwnProperty(he)?B||(B=[]):(B=B||[]).push(he,null));for(he in C){var ne=C[he];if(J=j!=null?j[he]:void 0,C.hasOwnProperty(he)&&ne!==J&&(ne!=null||J!=null))if(he==="style")if(J){for(G in J)!J.hasOwnProperty(G)||ne&&ne.hasOwnProperty(G)||(u||(u={}),u[G]="");for(G in ne)ne.hasOwnProperty(G)&&J[G]!==ne[G]&&(u||(u={}),u[G]=ne[G])}else u||(B||(B=[]),B.push(he,u)),u=ne;else he==="dangerouslySetInnerHTML"?(ne=ne?ne.__html:void 0,J=J?J.__html:void 0,ne!=null&&J!==ne&&(B=B||[]).push(he,ne)):he==="children"?typeof ne!="string"&&typeof ne!="number"||(B=B||[]).push(he,""+ne):he!=="suppressContentEditableWarning"&&he!=="suppressHydrationWarning"&&(a.hasOwnProperty(he)?(ne!=null&&he==="onScroll"&&Kt("scroll",n),B||J===ne||(B=[])):(B=B||[]).push(he,ne))}u&&(B=B||[]).push("style",u);var he=B;(s.updateQueue=he)&&(s.flags|=4)}},jf=function(n,s,u,C){u!==C&&(s.flags|=4)};function Po(n,s){if(!Xt)switch(n.tailMode){case"hidden":s=n.tail;for(var u=null;s!==null;)s.alternate!==null&&(u=s),s=s.sibling;u===null?n.tail=null:u.sibling=null;break;case"collapsed":u=n.tail;for(var C=null;u!==null;)u.alternate!==null&&(C=u),u=u.sibling;C===null?s||n.tail===null?n.tail=null:n.tail.sibling=null:C.sibling=null}}function kn(n){var s=n.alternate!==null&&n.alternate.child===n.child,u=0,C=0;if(s)for(var j=n.child;j!==null;)u|=j.lanes|j.childLanes,C|=j.subtreeFlags&14680064,C|=j.flags&14680064,j.return=n,j=j.sibling;else for(j=n.child;j!==null;)u|=j.lanes|j.childLanes,C|=j.subtreeFlags,C|=j.flags,j.return=n,j=j.sibling;return n.subtreeFlags|=C,n.childLanes=u,s}function Dw(n,s,u){var C=s.pendingProps;switch(Sc(s),s.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return kn(s),null;case 1:return Pn(s.type)&&Ul(),kn(s),null;case 3:return C=s.stateNode,Bi(),Vt(Dn),Vt(bn),Bc(),C.pendingContext&&(C.context=C.pendingContext,C.pendingContext=null),(n===null||n.child===null)&&(Kl(s)?s.flags|=4:n===null||n.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,fr!==null&&(pu(fr),fr=null))),ru(n,s),kn(s),null;case 5:Pc(s);var j=Gs(Mo.current);if(u=s.type,n!==null&&s.stateNode!=null)If(n,s,u,C,j),n.ref!==s.ref&&(s.flags|=512,s.flags|=2097152);else{if(!C){if(s.stateNode===null)throw Error(r(166));return kn(s),null}if(n=Gs(Rr.current),Kl(s)){C=s.stateNode,u=s.type;var B=s.memoizedProps;switch(C[Nr]=s,C[Eo]=B,n=(s.mode&1)!==0,u){case"dialog":Kt("cancel",C),Kt("close",C);break;case"iframe":case"object":case"embed":Kt("load",C);break;case"video":case"audio":for(j=0;j<Co.length;j++)Kt(Co[j],C);break;case"source":Kt("error",C);break;case"img":case"image":case"link":Kt("error",C),Kt("load",C);break;case"details":Kt("toggle",C);break;case"input":ze(C,B),Kt("invalid",C);break;case"select":C._wrapperState={wasMultiple:!!B.multiple},Kt("invalid",C);break;case"textarea":Le(C,B),Kt("invalid",C)}Ie(u,B),j=null;for(var G in B)if(B.hasOwnProperty(G)){var J=B[G];G==="children"?typeof J=="string"?C.textContent!==J&&(B.suppressHydrationWarning!==!0&&Bl(C.textContent,J,n),j=["children",J]):typeof J=="number"&&C.textContent!==""+J&&(B.suppressHydrationWarning!==!0&&Bl(C.textContent,J,n),j=["children",""+J]):a.hasOwnProperty(G)&&J!=null&&G==="onScroll"&&Kt("scroll",C)}switch(u){case"input":ye(C),pt(C,B,!0);break;case"textarea":ye(C),je(C);break;case"select":case"option":break;default:typeof B.onClick=="function"&&(C.onclick=Fl)}C=j,s.updateQueue=C,C!==null&&(s.flags|=4)}else{G=j.nodeType===9?j:j.ownerDocument,n==="http://www.w3.org/1999/xhtml"&&(n=Ke(u)),n==="http://www.w3.org/1999/xhtml"?u==="script"?(n=G.createElement("div"),n.innerHTML="<script><\/script>",n=n.removeChild(n.firstChild)):typeof C.is=="string"?n=G.createElement(u,{is:C.is}):(n=G.createElement(u),u==="select"&&(G=n,C.multiple?G.multiple=!0:C.size&&(G.size=C.size))):n=G.createElementNS(n,u),n[Nr]=s,n[Eo]=C,Af(n,s,!1,!1),s.stateNode=n;e:{switch(G=$e(u,C),u){case"dialog":Kt("cancel",n),Kt("close",n),j=C;break;case"iframe":case"object":case"embed":Kt("load",n),j=C;break;case"video":case"audio":for(j=0;j<Co.length;j++)Kt(Co[j],n);j=C;break;case"source":Kt("error",n),j=C;break;case"img":case"image":case"link":Kt("error",n),Kt("load",n),j=C;break;case"details":Kt("toggle",n),j=C;break;case"input":ze(n,C),j=Ue(n,C),Kt("invalid",n);break;case"option":j=C;break;case"select":n._wrapperState={wasMultiple:!!C.multiple},j=U({},C,{value:void 0}),Kt("invalid",n);break;case"textarea":Le(n,C),j=De(n,C),Kt("invalid",n);break;default:j=C}Ie(u,j),J=j;for(B in J)if(J.hasOwnProperty(B)){var ne=J[B];B==="style"?Ft(n,ne):B==="dangerouslySetInnerHTML"?(ne=ne?ne.__html:void 0,ne!=null&&xt(n,ne)):B==="children"?typeof ne=="string"?(u!=="textarea"||ne!=="")&&vt(n,ne):typeof ne=="number"&&vt(n,""+ne):B!=="suppressContentEditableWarning"&&B!=="suppressHydrationWarning"&&B!=="autoFocus"&&(a.hasOwnProperty(B)?ne!=null&&B==="onScroll"&&Kt("scroll",n):ne!=null&&p(n,B,ne,G))}switch(u){case"input":ye(n),pt(n,C,!1);break;case"textarea":ye(n),je(n);break;case"option":C.value!=null&&n.setAttribute("value",""+Y(C.value));break;case"select":n.multiple=!!C.multiple,B=C.value,B!=null?Ae(n,!!C.multiple,B,!1):C.defaultValue!=null&&Ae(n,!!C.multiple,C.defaultValue,!0);break;default:typeof j.onClick=="function"&&(n.onclick=Fl)}switch(u){case"button":case"input":case"select":case"textarea":C=!!C.autoFocus;break e;case"img":C=!0;break e;default:C=!1}}C&&(s.flags|=4)}s.ref!==null&&(s.flags|=512,s.flags|=2097152)}return kn(s),null;case 6:if(n&&s.stateNode!=null)jf(n,s,n.memoizedProps,C);else{if(typeof C!="string"&&s.stateNode===null)throw Error(r(166));if(u=Gs(Mo.current),Gs(Rr.current),Kl(s)){if(C=s.stateNode,u=s.memoizedProps,C[Nr]=s,(B=C.nodeValue!==u)&&(n=Un,n!==null))switch(n.tag){case 3:Bl(C.nodeValue,u,(n.mode&1)!==0);break;case 5:n.memoizedProps.suppressHydrationWarning!==!0&&Bl(C.nodeValue,u,(n.mode&1)!==0)}B&&(s.flags|=4)}else C=(u.nodeType===9?u:u.ownerDocument).createTextNode(C),C[Nr]=s,s.stateNode=C}return kn(s),null;case 13:if(Vt(Zt),C=s.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(Xt&&$n!==null&&(s.mode&1)!==0&&(s.flags&128)===0)Ph(),ji(),s.flags|=98560,B=!1;else if(B=Kl(s),C!==null&&C.dehydrated!==null){if(n===null){if(!B)throw Error(r(318));if(B=s.memoizedState,B=B!==null?B.dehydrated:null,!B)throw Error(r(317));B[Nr]=s}else ji(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;kn(s),B=!1}else fr!==null&&(pu(fr),fr=null),B=!0;if(!B)return s.flags&65536?s:null}return(s.flags&128)!==0?(s.lanes=u,s):(C=C!==null,C!==(n!==null&&n.memoizedState!==null)&&C&&(s.child.flags|=8192,(s.mode&1)!==0&&(n===null||(Zt.current&1)!==0?cn===0&&(cn=3):vu())),s.updateQueue!==null&&(s.flags|=4),kn(s),null);case 4:return Bi(),ru(n,s),n===null&&xo(s.stateNode.containerInfo),kn(s),null;case 10:return Mc(s.type._context),kn(s),null;case 17:return Pn(s.type)&&Ul(),kn(s),null;case 19:if(Vt(Zt),B=s.memoizedState,B===null)return kn(s),null;if(C=(s.flags&128)!==0,G=B.rendering,G===null)if(C)Po(B,!1);else{if(cn!==0||n!==null&&(n.flags&128)!==0)for(n=s.child;n!==null;){if(G=Jl(n),G!==null){for(s.flags|=128,Po(B,!1),C=G.updateQueue,C!==null&&(s.updateQueue=C,s.flags|=4),s.subtreeFlags=0,C=u,u=s.child;u!==null;)B=u,n=C,B.flags&=14680066,G=B.alternate,G===null?(B.childLanes=0,B.lanes=n,B.child=null,B.subtreeFlags=0,B.memoizedProps=null,B.memoizedState=null,B.updateQueue=null,B.dependencies=null,B.stateNode=null):(B.childLanes=G.childLanes,B.lanes=G.lanes,B.child=G.child,B.subtreeFlags=0,B.deletions=null,B.memoizedProps=G.memoizedProps,B.memoizedState=G.memoizedState,B.updateQueue=G.updateQueue,B.type=G.type,n=G.dependencies,B.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),u=u.sibling;return qt(Zt,Zt.current&1|2),s.child}n=n.sibling}B.tail!==null&&$t()>$i&&(s.flags|=128,C=!0,Po(B,!1),s.lanes=4194304)}else{if(!C)if(n=Jl(G),n!==null){if(s.flags|=128,C=!0,u=n.updateQueue,u!==null&&(s.updateQueue=u,s.flags|=4),Po(B,!0),B.tail===null&&B.tailMode==="hidden"&&!G.alternate&&!Xt)return kn(s),null}else 2*$t()-B.renderingStartTime>$i&&u!==1073741824&&(s.flags|=128,C=!0,Po(B,!1),s.lanes=4194304);B.isBackwards?(G.sibling=s.child,s.child=G):(u=B.last,u!==null?u.sibling=G:s.child=G,B.last=G)}return B.tail!==null?(s=B.tail,B.rendering=s,B.tail=s.sibling,B.renderingStartTime=$t(),s.sibling=null,u=Zt.current,qt(Zt,C?u&1|2:u&1),s):(kn(s),null);case 22:case 23:return gu(),C=s.memoizedState!==null,n!==null&&n.memoizedState!==null!==C&&(s.flags|=8192),C&&(s.mode&1)!==0?(Wn&1073741824)!==0&&(kn(s),s.subtreeFlags&6&&(s.flags|=8192)):kn(s),null;case 24:return null;case 25:return null}throw Error(r(156,s.tag))}function Pw(n,s){switch(Sc(s),s.tag){case 1:return Pn(s.type)&&Ul(),n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 3:return Bi(),Vt(Dn),Vt(bn),Bc(),n=s.flags,(n&65536)!==0&&(n&128)===0?(s.flags=n&-65537|128,s):null;case 5:return Pc(s),null;case 13:if(Vt(Zt),n=s.memoizedState,n!==null&&n.dehydrated!==null){if(s.alternate===null)throw Error(r(340));ji()}return n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 19:return Vt(Zt),null;case 4:return Bi(),null;case 10:return Mc(s.type._context),null;case 22:case 23:return gu(),null;case 24:return null;default:return null}}var la=!1,Cn=!1,Ow=typeof WeakSet=="function"?WeakSet:Set,Ve=null;function Hi(n,s){var u=n.ref;if(u!==null)if(typeof u=="function")try{u(null)}catch(C){nn(n,s,C)}else u.current=null}function su(n,s,u){try{u()}catch(C){nn(n,s,C)}}var Df=!1;function Bw(n,s){if(gc=zt,n=ko(),Ci(n)){if("selectionStart"in n)var u={start:n.selectionStart,end:n.selectionEnd};else e:{u=(u=n.ownerDocument)&&u.defaultView||window;var C=u.getSelection&&u.getSelection();if(C&&C.rangeCount!==0){u=C.anchorNode;var j=C.anchorOffset,B=C.focusNode;C=C.focusOffset;try{u.nodeType,B.nodeType}catch{u=null;break e}var G=0,J=-1,ne=-1,he=0,Se=0,Ne=n,xe=null;t:for(;;){for(var We;Ne!==u||j!==0&&Ne.nodeType!==3||(J=G+j),Ne!==B||C!==0&&Ne.nodeType!==3||(ne=G+C),Ne.nodeType===3&&(G+=Ne.nodeValue.length),(We=Ne.firstChild)!==null;)xe=Ne,Ne=We;for(;;){if(Ne===n)break t;if(xe===u&&++he===j&&(J=G),xe===B&&++Se===C&&(ne=G),(We=Ne.nextSibling)!==null)break;Ne=xe,xe=Ne.parentNode}Ne=We}u=J===-1||ne===-1?null:{start:J,end:ne}}else u=null}u=u||{start:0,end:0}}else u=null;for(vc={focusedElem:n,selectionRange:u},zt=!1,Ve=s;Ve!==null;)if(s=Ve,n=s.child,(s.subtreeFlags&1028)!==0&&n!==null)n.return=s,Ve=n;else for(;Ve!==null;){s=Ve;try{var Ye=s.alternate;if((s.flags&1024)!==0)switch(s.tag){case 0:case 11:case 15:break;case 1:if(Ye!==null){var Je=Ye.memoizedProps,rn=Ye.memoizedState,ae=s.stateNode,le=ae.getSnapshotBeforeUpdate(s.elementType===s.type?Je:pr(s.type,Je),rn);ae.__reactInternalSnapshotBeforeUpdate=le}break;case 3:var ce=s.stateNode.containerInfo;ce.nodeType===1?ce.textContent="":ce.nodeType===9&&ce.documentElement&&ce.removeChild(ce.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(Me){nn(s,s.return,Me)}if(n=s.sibling,n!==null){n.return=s.return,Ve=n;break}Ve=s.return}return Ye=Df,Df=!1,Ye}function Oo(n,s,u){var C=s.updateQueue;if(C=C!==null?C.lastEffect:null,C!==null){var j=C=C.next;do{if((j.tag&n)===n){var B=j.destroy;j.destroy=void 0,B!==void 0&&su(s,u,B)}j=j.next}while(j!==C)}}function aa(n,s){if(s=s.updateQueue,s=s!==null?s.lastEffect:null,s!==null){var u=s=s.next;do{if((u.tag&n)===n){var C=u.create;u.destroy=C()}u=u.next}while(u!==s)}}function iu(n){var s=n.ref;if(s!==null){var u=n.stateNode;switch(n.tag){case 5:n=u;break;default:n=u}typeof s=="function"?s(n):s.current=n}}function Pf(n){var s=n.alternate;s!==null&&(n.alternate=null,Pf(s)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(s=n.stateNode,s!==null&&(delete s[Nr],delete s[Eo],delete s[yc],delete s[bw],delete s[yw])),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 Of(n){return n.tag===5||n.tag===3||n.tag===4}function Bf(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||Of(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 ou(n,s,u){var C=n.tag;if(C===5||C===6)n=n.stateNode,s?u.nodeType===8?u.parentNode.insertBefore(n,s):u.insertBefore(n,s):(u.nodeType===8?(s=u.parentNode,s.insertBefore(n,u)):(s=u,s.appendChild(n)),u=u._reactRootContainer,u!=null||s.onclick!==null||(s.onclick=Fl));else if(C!==4&&(n=n.child,n!==null))for(ou(n,s,u),n=n.sibling;n!==null;)ou(n,s,u),n=n.sibling}function lu(n,s,u){var C=n.tag;if(C===5||C===6)n=n.stateNode,s?u.insertBefore(n,s):u.appendChild(n);else if(C!==4&&(n=n.child,n!==null))for(lu(n,s,u),n=n.sibling;n!==null;)lu(n,s,u),n=n.sibling}var mn=null,mr=!1;function hs(n,s,u){for(u=u.child;u!==null;)Ff(n,s,u),u=u.sibling}function Ff(n,s,u){if(_n&&typeof _n.onCommitFiberUnmount=="function")try{_n.onCommitFiberUnmount(or,u)}catch{}switch(u.tag){case 5:Cn||Hi(u,s);case 6:var C=mn,j=mr;mn=null,hs(n,s,u),mn=C,mr=j,mn!==null&&(mr?(n=mn,u=u.stateNode,n.nodeType===8?n.parentNode.removeChild(u):n.removeChild(u)):mn.removeChild(u.stateNode));break;case 18:mn!==null&&(mr?(n=mn,u=u.stateNode,n.nodeType===8?bc(n.parentNode,u):n.nodeType===1&&bc(n,u),Or(n)):bc(mn,u.stateNode));break;case 4:C=mn,j=mr,mn=u.stateNode.containerInfo,mr=!0,hs(n,s,u),mn=C,mr=j;break;case 0:case 11:case 14:case 15:if(!Cn&&(C=u.updateQueue,C!==null&&(C=C.lastEffect,C!==null))){j=C=C.next;do{var B=j,G=B.destroy;B=B.tag,G!==void 0&&((B&2)!==0||(B&4)!==0)&&su(u,s,G),j=j.next}while(j!==C)}hs(n,s,u);break;case 1:if(!Cn&&(Hi(u,s),C=u.stateNode,typeof C.componentWillUnmount=="function"))try{C.props=u.memoizedProps,C.state=u.memoizedState,C.componentWillUnmount()}catch(J){nn(u,s,J)}hs(n,s,u);break;case 21:hs(n,s,u);break;case 22:u.mode&1?(Cn=(C=Cn)||u.memoizedState!==null,hs(n,s,u),Cn=C):hs(n,s,u);break;default:hs(n,s,u)}}function Hf(n){var s=n.updateQueue;if(s!==null){n.updateQueue=null;var u=n.stateNode;u===null&&(u=n.stateNode=new Ow),s.forEach(function(C){var j=Vw.bind(null,n,C);u.has(C)||(u.add(C),C.then(j,j))})}}function gr(n,s){var u=s.deletions;if(u!==null)for(var C=0;C<u.length;C++){var j=u[C];try{var B=n,G=s,J=G;e:for(;J!==null;){switch(J.tag){case 5:mn=J.stateNode,mr=!1;break e;case 3:mn=J.stateNode.containerInfo,mr=!0;break e;case 4:mn=J.stateNode.containerInfo,mr=!0;break e}J=J.return}if(mn===null)throw Error(r(160));Ff(B,G,j),mn=null,mr=!1;var ne=j.alternate;ne!==null&&(ne.return=null),j.return=null}catch(he){nn(j,s,he)}}if(s.subtreeFlags&12854)for(s=s.child;s!==null;)Uf(s,n),s=s.sibling}function Uf(n,s){var u=n.alternate,C=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:if(gr(s,n),Ar(n),C&4){try{Oo(3,n,n.return),aa(3,n)}catch(Je){nn(n,n.return,Je)}try{Oo(5,n,n.return)}catch(Je){nn(n,n.return,Je)}}break;case 1:gr(s,n),Ar(n),C&512&&u!==null&&Hi(u,u.return);break;case 5:if(gr(s,n),Ar(n),C&512&&u!==null&&Hi(u,u.return),n.flags&32){var j=n.stateNode;try{vt(j,"")}catch(Je){nn(n,n.return,Je)}}if(C&4&&(j=n.stateNode,j!=null)){var B=n.memoizedProps,G=u!==null?u.memoizedProps:B,J=n.type,ne=n.updateQueue;if(n.updateQueue=null,ne!==null)try{J==="input"&&B.type==="radio"&&B.name!=null&>(j,B),$e(J,G);var he=$e(J,B);for(G=0;G<ne.length;G+=2){var Se=ne[G],Ne=ne[G+1];Se==="style"?Ft(j,Ne):Se==="dangerouslySetInnerHTML"?xt(j,Ne):Se==="children"?vt(j,Ne):p(j,Se,Ne,he)}switch(J){case"input":Fe(j,B);break;case"textarea":nt(j,B);break;case"select":var xe=j._wrapperState.wasMultiple;j._wrapperState.wasMultiple=!!B.multiple;var We=B.value;We!=null?Ae(j,!!B.multiple,We,!1):xe!==!!B.multiple&&(B.defaultValue!=null?Ae(j,!!B.multiple,B.defaultValue,!0):Ae(j,!!B.multiple,B.multiple?[]:"",!1))}j[Eo]=B}catch(Je){nn(n,n.return,Je)}}break;case 6:if(gr(s,n),Ar(n),C&4){if(n.stateNode===null)throw Error(r(162));j=n.stateNode,B=n.memoizedProps;try{j.nodeValue=B}catch(Je){nn(n,n.return,Je)}}break;case 3:if(gr(s,n),Ar(n),C&4&&u!==null&&u.memoizedState.isDehydrated)try{Or(s.containerInfo)}catch(Je){nn(n,n.return,Je)}break;case 4:gr(s,n),Ar(n);break;case 13:gr(s,n),Ar(n),j=n.child,j.flags&8192&&(B=j.memoizedState!==null,j.stateNode.isHidden=B,!B||j.alternate!==null&&j.alternate.memoizedState!==null||(uu=$t())),C&4&&Hf(n);break;case 22:if(Se=u!==null&&u.memoizedState!==null,n.mode&1?(Cn=(he=Cn)||Se,gr(s,n),Cn=he):gr(s,n),Ar(n),C&8192){if(he=n.memoizedState!==null,(n.stateNode.isHidden=he)&&!Se&&(n.mode&1)!==0)for(Ve=n,Se=n.child;Se!==null;){for(Ne=Ve=Se;Ve!==null;){switch(xe=Ve,We=xe.child,xe.tag){case 0:case 11:case 14:case 15:Oo(4,xe,xe.return);break;case 1:Hi(xe,xe.return);var Ye=xe.stateNode;if(typeof Ye.componentWillUnmount=="function"){C=xe,u=xe.return;try{s=C,Ye.props=s.memoizedProps,Ye.state=s.memoizedState,Ye.componentWillUnmount()}catch(Je){nn(C,u,Je)}}break;case 5:Hi(xe,xe.return);break;case 22:if(xe.memoizedState!==null){qf(Ne);continue}}We!==null?(We.return=xe,Ve=We):qf(Ne)}Se=Se.sibling}e:for(Se=null,Ne=n;;){if(Ne.tag===5){if(Se===null){Se=Ne;try{j=Ne.stateNode,he?(B=j.style,typeof B.setProperty=="function"?B.setProperty("display","none","important"):B.display="none"):(J=Ne.stateNode,ne=Ne.memoizedProps.style,G=ne!=null&&ne.hasOwnProperty("display")?ne.display:null,J.style.display=St("display",G))}catch(Je){nn(n,n.return,Je)}}}else if(Ne.tag===6){if(Se===null)try{Ne.stateNode.nodeValue=he?"":Ne.memoizedProps}catch(Je){nn(n,n.return,Je)}}else if((Ne.tag!==22&&Ne.tag!==23||Ne.memoizedState===null||Ne===n)&&Ne.child!==null){Ne.child.return=Ne,Ne=Ne.child;continue}if(Ne===n)break e;for(;Ne.sibling===null;){if(Ne.return===null||Ne.return===n)break e;Se===Ne&&(Se=null),Ne=Ne.return}Se===Ne&&(Se=null),Ne.sibling.return=Ne.return,Ne=Ne.sibling}}break;case 19:gr(s,n),Ar(n),C&4&&Hf(n);break;case 21:break;default:gr(s,n),Ar(n)}}function Ar(n){var s=n.flags;if(s&2){try{e:{for(var u=n.return;u!==null;){if(Of(u)){var C=u;break e}u=u.return}throw Error(r(160))}switch(C.tag){case 5:var j=C.stateNode;C.flags&32&&(vt(j,""),C.flags&=-33);var B=Bf(n);lu(n,B,j);break;case 3:case 4:var G=C.stateNode.containerInfo,J=Bf(n);ou(n,J,G);break;default:throw Error(r(161))}}catch(ne){nn(n,n.return,ne)}n.flags&=-3}s&4096&&(n.flags&=-4097)}function Fw(n,s,u){Ve=n,$f(n)}function $f(n,s,u){for(var C=(n.mode&1)!==0;Ve!==null;){var j=Ve,B=j.child;if(j.tag===22&&C){var G=j.memoizedState!==null||la;if(!G){var J=j.alternate,ne=J!==null&&J.memoizedState!==null||Cn;J=la;var he=Cn;if(la=G,(Cn=ne)&&!he)for(Ve=j;Ve!==null;)G=Ve,ne=G.child,G.tag===22&&G.memoizedState!==null?zf(j):ne!==null?(ne.return=G,Ve=ne):zf(j);for(;B!==null;)Ve=B,$f(B),B=B.sibling;Ve=j,la=J,Cn=he}Wf(n)}else(j.subtreeFlags&8772)!==0&&B!==null?(B.return=j,Ve=B):Wf(n)}}function Wf(n){for(;Ve!==null;){var s=Ve;if((s.flags&8772)!==0){var u=s.alternate;try{if((s.flags&8772)!==0)switch(s.tag){case 0:case 11:case 15:Cn||aa(5,s);break;case 1:var C=s.stateNode;if(s.flags&4&&!Cn)if(u===null)C.componentDidMount();else{var j=s.elementType===s.type?u.memoizedProps:pr(s.type,u.memoizedProps);C.componentDidUpdate(j,u.memoizedState,C.__reactInternalSnapshotBeforeUpdate)}var B=s.updateQueue;B!==null&&Wh(s,B,C);break;case 3:var G=s.updateQueue;if(G!==null){if(u=null,s.child!==null)switch(s.child.tag){case 5:u=s.child.stateNode;break;case 1:u=s.child.stateNode}Wh(s,G,u)}break;case 5:var J=s.stateNode;if(u===null&&s.flags&4){u=J;var ne=s.memoizedProps;switch(s.type){case"button":case"input":case"select":case"textarea":ne.autoFocus&&u.focus();break;case"img":ne.src&&(u.src=ne.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(s.memoizedState===null){var he=s.alternate;if(he!==null){var Se=he.memoizedState;if(Se!==null){var Ne=Se.dehydrated;Ne!==null&&Or(Ne)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}Cn||s.flags&512&&iu(s)}catch(xe){nn(s,s.return,xe)}}if(s===n){Ve=null;break}if(u=s.sibling,u!==null){u.return=s.return,Ve=u;break}Ve=s.return}}function qf(n){for(;Ve!==null;){var s=Ve;if(s===n){Ve=null;break}var u=s.sibling;if(u!==null){u.return=s.return,Ve=u;break}Ve=s.return}}function zf(n){for(;Ve!==null;){var s=Ve;try{switch(s.tag){case 0:case 11:case 15:var u=s.return;try{aa(4,s)}catch(ne){nn(s,u,ne)}break;case 1:var C=s.stateNode;if(typeof C.componentDidMount=="function"){var j=s.return;try{C.componentDidMount()}catch(ne){nn(s,j,ne)}}var B=s.return;try{iu(s)}catch(ne){nn(s,B,ne)}break;case 5:var G=s.return;try{iu(s)}catch(ne){nn(s,G,ne)}}}catch(ne){nn(s,s.return,ne)}if(s===n){Ve=null;break}var J=s.sibling;if(J!==null){J.return=s.return,Ve=J;break}Ve=s.return}}var Hw=Math.ceil,ca=T.ReactCurrentDispatcher,au=T.ReactCurrentOwner,Zn=T.ReactCurrentBatchConfig,Mt=0,dn=null,on=null,gn=0,Wn=0,Ui=ls(0),cn=0,Bo=null,Xs=0,ua=0,cu=0,Fo=null,Bn=null,uu=0,$i=1/0,Kr=null,da=!1,du=null,fs=null,ha=!1,ps=null,fa=0,Ho=0,hu=null,pa=-1,ma=0;function Rn(){return(Mt&6)!==0?$t():pa!==-1?pa:pa=$t()}function ms(n){return(n.mode&1)===0?1:(Mt&2)!==0&&gn!==0?gn&-gn:Cw.transition!==null?(ma===0&&(ma=Ot()),ma):(n=Rt,n!==0||(n=window.event,n=n===void 0?16:ml(n.type)),n)}function vr(n,s,u,C){if(50<Ho)throw Ho=0,hu=null,Error(r(185));tn(n,u,C),((Mt&2)===0||n!==dn)&&(n===dn&&((Mt&2)===0&&(ua|=u),cn===4&&gs(n,gn)),Fn(n,C),u===1&&Mt===0&&(s.mode&1)===0&&($i=$t()+500,Wl&&cs()))}function Fn(n,s){var u=n.callbackNode;He(n,s);var C=Tn(n,n===dn?gn:0);if(C===0)u!==null&&sr(u),n.callbackNode=null,n.callbackPriority=0;else if(s=C&-C,n.callbackPriority!==s){if(u!=null&&sr(u),s===1)n.tag===0?kw(Vf.bind(null,n)):Mh(Vf.bind(null,n)),_w(function(){(Mt&6)===0&&cs()}),u=null;else{switch(Ls(C)){case 1:u=zn;break;case 4:u=kr;break;case 16:u=Cr;break;case 536870912:u=Qr;break;default:u=Cr}u=tp(u,Kf.bind(null,n))}n.callbackPriority=s,n.callbackNode=u}}function Kf(n,s){if(pa=-1,ma=0,(Mt&6)!==0)throw Error(r(327));var u=n.callbackNode;if(Wi()&&n.callbackNode!==u)return null;var C=Tn(n,n===dn?gn:0);if(C===0)return null;if((C&30)!==0||(C&n.expiredLanes)!==0||s)s=ga(n,C);else{s=C;var j=Mt;Mt|=2;var B=Yf();(dn!==n||gn!==s)&&(Kr=null,$i=$t()+500,Js(n,s));do try{Ww();break}catch(J){Gf(n,J)}while(!0);Rc(),ca.current=B,Mt=j,on!==null?s=0:(dn=null,gn=0,s=cn)}if(s!==0){if(s===2&&(j=at(n),j!==0&&(C=j,s=fu(n,j))),s===1)throw u=Bo,Js(n,0),gs(n,C),Fn(n,$t()),u;if(s===6)gs(n,C);else{if(j=n.current.alternate,(C&30)===0&&!Uw(j)&&(s=ga(n,C),s===2&&(B=at(n),B!==0&&(C=B,s=fu(n,B))),s===1))throw u=Bo,Js(n,0),gs(n,C),Fn(n,$t()),u;switch(n.finishedWork=j,n.finishedLanes=C,s){case 0:case 1:throw Error(r(345));case 2:Zs(n,Bn,Kr);break;case 3:if(gs(n,C),(C&130023424)===C&&(s=uu+500-$t(),10<s)){if(Tn(n,0)!==0)break;if(j=n.suspendedLanes,(j&C)!==C){Rn(),n.pingedLanes|=n.suspendedLanes&j;break}n.timeoutHandle=wc(Zs.bind(null,n,Bn,Kr),s);break}Zs(n,Bn,Kr);break;case 4:if(gs(n,C),(C&4194240)===C)break;for(s=n.eventTimes,j=-1;0<C;){var G=31-wn(C);B=1<<G,G=s[G],G>j&&(j=G),C&=~B}if(C=j,C=$t()-C,C=(120>C?120:480>C?480:1080>C?1080:1920>C?1920:3e3>C?3e3:4320>C?4320:1960*Hw(C/1960))-C,10<C){n.timeoutHandle=wc(Zs.bind(null,n,Bn,Kr),C);break}Zs(n,Bn,Kr);break;case 5:Zs(n,Bn,Kr);break;default:throw Error(r(329))}}}return Fn(n,$t()),n.callbackNode===u?Kf.bind(null,n):null}function fu(n,s){var u=Fo;return n.current.memoizedState.isDehydrated&&(Js(n,s).flags|=256),n=ga(n,s),n!==2&&(s=Bn,Bn=u,s!==null&&pu(s)),n}function pu(n){Bn===null?Bn=n:Bn.push.apply(Bn,n)}function Uw(n){for(var s=n;;){if(s.flags&16384){var u=s.updateQueue;if(u!==null&&(u=u.stores,u!==null))for(var C=0;C<u.length;C++){var j=u[C],B=j.getSnapshot;j=j.value;try{if(!jn(B(),j))return!1}catch{return!1}}}if(u=s.child,s.subtreeFlags&16384&&u!==null)u.return=s,s=u;else{if(s===n)break;for(;s.sibling===null;){if(s.return===null||s.return===n)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function gs(n,s){for(s&=~cu,s&=~ua,n.suspendedLanes|=s,n.pingedLanes&=~s,n=n.expirationTimes;0<s;){var u=31-wn(s),C=1<<u;n[u]=-1,s&=~C}}function Vf(n){if((Mt&6)!==0)throw Error(r(327));Wi();var s=Tn(n,0);if((s&1)===0)return Fn(n,$t()),null;var u=ga(n,s);if(n.tag!==0&&u===2){var C=at(n);C!==0&&(s=C,u=fu(n,C))}if(u===1)throw u=Bo,Js(n,0),gs(n,s),Fn(n,$t()),u;if(u===6)throw Error(r(345));return n.finishedWork=n.current.alternate,n.finishedLanes=s,Zs(n,Bn,Kr),Fn(n,$t()),null}function mu(n,s){var u=Mt;Mt|=1;try{return n(s)}finally{Mt=u,Mt===0&&($i=$t()+500,Wl&&cs())}}function Qs(n){ps!==null&&ps.tag===0&&(Mt&6)===0&&Wi();var s=Mt;Mt|=1;var u=Zn.transition,C=Rt;try{if(Zn.transition=null,Rt=1,n)return n()}finally{Rt=C,Zn.transition=u,Mt=s,(Mt&6)===0&&cs()}}function gu(){Wn=Ui.current,Vt(Ui)}function Js(n,s){n.finishedWork=null,n.finishedLanes=0;var u=n.timeoutHandle;if(u!==-1&&(n.timeoutHandle=-1,vw(u)),on!==null)for(u=on.return;u!==null;){var C=u;switch(Sc(C),C.tag){case 1:C=C.type.childContextTypes,C!=null&&Ul();break;case 3:Bi(),Vt(Dn),Vt(bn),Bc();break;case 5:Pc(C);break;case 4:Bi();break;case 13:Vt(Zt);break;case 19:Vt(Zt);break;case 10:Mc(C.type._context);break;case 22:case 23:gu()}u=u.return}if(dn=n,on=n=vs(n.current,null),gn=Wn=s,cn=0,Bo=null,cu=ua=Xs=0,Bn=Fo=null,Vs!==null){for(s=0;s<Vs.length;s++)if(u=Vs[s],C=u.interleaved,C!==null){u.interleaved=null;var j=C.next,B=u.pending;if(B!==null){var G=B.next;B.next=j,C.next=G}u.pending=C}Vs=null}return n}function Gf(n,s){do{var u=on;try{if(Rc(),Zl.current=ra,ea){for(var C=en.memoizedState;C!==null;){var j=C.queue;j!==null&&(j.pending=null),C=C.next}ea=!1}if(Ys=0,un=an=en=null,Ao=!1,Io=0,au.current=null,u===null||u.return===null){cn=1,Bo=s,on=null;break}e:{var B=n,G=u.return,J=u,ne=s;if(s=gn,J.flags|=32768,ne!==null&&typeof ne=="object"&&typeof ne.then=="function"){var he=ne,Se=J,Ne=Se.tag;if((Se.mode&1)===0&&(Ne===0||Ne===11||Ne===15)){var xe=Se.alternate;xe?(Se.updateQueue=xe.updateQueue,Se.memoizedState=xe.memoizedState,Se.lanes=xe.lanes):(Se.updateQueue=null,Se.memoizedState=null)}var We=wf(G);if(We!==null){We.flags&=-257,bf(We,G,J,B,s),We.mode&1&&_f(B,he,s),s=We,ne=he;var Ye=s.updateQueue;if(Ye===null){var Je=new Set;Je.add(ne),s.updateQueue=Je}else Ye.add(ne);break e}else{if((s&1)===0){_f(B,he,s),vu();break e}ne=Error(r(426))}}else if(Xt&&J.mode&1){var rn=wf(G);if(rn!==null){(rn.flags&65536)===0&&(rn.flags|=256),bf(rn,G,J,B,s),Lc(Fi(ne,J));break e}}B=ne=Fi(ne,J),cn!==4&&(cn=2),Fo===null?Fo=[B]:Fo.push(B),B=G;do{switch(B.tag){case 3:B.flags|=65536,s&=-s,B.lanes|=s;var ae=gf(B,ne,s);$h(B,ae);break e;case 1:J=ne;var le=B.type,ce=B.stateNode;if((B.flags&128)===0&&(typeof le.getDerivedStateFromError=="function"||ce!==null&&typeof ce.componentDidCatch=="function"&&(fs===null||!fs.has(ce)))){B.flags|=65536,s&=-s,B.lanes|=s;var Me=vf(B,J,s);$h(B,Me);break e}}B=B.return}while(B!==null)}Qf(u)}catch(Ze){s=Ze,on===u&&u!==null&&(on=u=u.return);continue}break}while(!0)}function Yf(){var n=ca.current;return ca.current=ra,n===null?ra:n}function vu(){(cn===0||cn===3||cn===2)&&(cn=4),dn===null||(Xs&268435455)===0&&(ua&268435455)===0||gs(dn,gn)}function ga(n,s){var u=Mt;Mt|=2;var C=Yf();(dn!==n||gn!==s)&&(Kr=null,Js(n,s));do try{$w();break}catch(j){Gf(n,j)}while(!0);if(Rc(),Mt=u,ca.current=C,on!==null)throw Error(r(261));return dn=null,gn=0,cn}function $w(){for(;on!==null;)Xf(on)}function Ww(){for(;on!==null&&!ir();)Xf(on)}function Xf(n){var s=ep(n.alternate,n,Wn);n.memoizedProps=n.pendingProps,s===null?Qf(n):on=s,au.current=null}function Qf(n){var s=n;do{var u=s.alternate;if(n=s.return,(s.flags&32768)===0){if(u=Dw(u,s,Wn),u!==null){on=u;return}}else{if(u=Pw(u,s),u!==null){u.flags&=32767,on=u;return}if(n!==null)n.flags|=32768,n.subtreeFlags=0,n.deletions=null;else{cn=6,on=null;return}}if(s=s.sibling,s!==null){on=s;return}on=s=n}while(s!==null);cn===0&&(cn=5)}function Zs(n,s,u){var C=Rt,j=Zn.transition;try{Zn.transition=null,Rt=1,qw(n,s,u,C)}finally{Zn.transition=j,Rt=C}return null}function qw(n,s,u,C){do Wi();while(ps!==null);if((Mt&6)!==0)throw Error(r(327));u=n.finishedWork;var j=n.finishedLanes;if(u===null)return null;if(n.finishedWork=null,n.finishedLanes=0,u===n.current)throw Error(r(177));n.callbackNode=null,n.callbackPriority=0;var B=u.lanes|u.childLanes;if(xr(n,B),n===dn&&(on=dn=null,gn=0),(u.subtreeFlags&2064)===0&&(u.flags&2064)===0||ha||(ha=!0,tp(Cr,function(){return Wi(),null})),B=(u.flags&15990)!==0,(u.subtreeFlags&15990)!==0||B){B=Zn.transition,Zn.transition=null;var G=Rt;Rt=1;var J=Mt;Mt|=4,au.current=null,Bw(n,u),Uf(u,n),X(vc),zt=!!gc,vc=gc=null,n.current=u,Fw(u),Yr(),Mt=J,Rt=G,Zn.transition=B}else n.current=u;if(ha&&(ha=!1,ps=n,fa=j),B=n.pendingLanes,B===0&&(fs=null),Jr(u.stateNode),Fn(n,$t()),s!==null)for(C=n.onRecoverableError,u=0;u<s.length;u++)j=s[u],C(j.value,{componentStack:j.stack,digest:j.digest});if(da)throw da=!1,n=du,du=null,n;return(fa&1)!==0&&n.tag!==0&&Wi(),B=n.pendingLanes,(B&1)!==0?n===hu?Ho++:(Ho=0,hu=n):Ho=0,cs(),null}function Wi(){if(ps!==null){var n=Ls(fa),s=Zn.transition,u=Rt;try{if(Zn.transition=null,Rt=16>n?16:n,ps===null)var C=!1;else{if(n=ps,ps=null,fa=0,(Mt&6)!==0)throw Error(r(331));var j=Mt;for(Mt|=4,Ve=n.current;Ve!==null;){var B=Ve,G=B.child;if((Ve.flags&16)!==0){var J=B.deletions;if(J!==null){for(var ne=0;ne<J.length;ne++){var he=J[ne];for(Ve=he;Ve!==null;){var Se=Ve;switch(Se.tag){case 0:case 11:case 15:Oo(8,Se,B)}var Ne=Se.child;if(Ne!==null)Ne.return=Se,Ve=Ne;else for(;Ve!==null;){Se=Ve;var xe=Se.sibling,We=Se.return;if(Pf(Se),Se===he){Ve=null;break}if(xe!==null){xe.return=We,Ve=xe;break}Ve=We}}}var Ye=B.alternate;if(Ye!==null){var Je=Ye.child;if(Je!==null){Ye.child=null;do{var rn=Je.sibling;Je.sibling=null,Je=rn}while(Je!==null)}}Ve=B}}if((B.subtreeFlags&2064)!==0&&G!==null)G.return=B,Ve=G;else e:for(;Ve!==null;){if(B=Ve,(B.flags&2048)!==0)switch(B.tag){case 0:case 11:case 15:Oo(9,B,B.return)}var ae=B.sibling;if(ae!==null){ae.return=B.return,Ve=ae;break e}Ve=B.return}}var le=n.current;for(Ve=le;Ve!==null;){G=Ve;var ce=G.child;if((G.subtreeFlags&2064)!==0&&ce!==null)ce.return=G,Ve=ce;else e:for(G=le;Ve!==null;){if(J=Ve,(J.flags&2048)!==0)try{switch(J.tag){case 0:case 11:case 15:aa(9,J)}}catch(Ze){nn(J,J.return,Ze)}if(J===G){Ve=null;break e}var Me=J.sibling;if(Me!==null){Me.return=J.return,Ve=Me;break e}Ve=J.return}}if(Mt=j,cs(),_n&&typeof _n.onPostCommitFiberRoot=="function")try{_n.onPostCommitFiberRoot(or,n)}catch{}C=!0}return C}finally{Rt=u,Zn.transition=s}}return!1}function Jf(n,s,u){s=Fi(u,s),s=gf(n,s,1),n=ds(n,s,1),s=Rn(),n!==null&&(tn(n,1,s),Fn(n,s))}function nn(n,s,u){if(n.tag===3)Jf(n,n,u);else for(;s!==null;){if(s.tag===3){Jf(s,n,u);break}else if(s.tag===1){var C=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof C.componentDidCatch=="function"&&(fs===null||!fs.has(C))){n=Fi(u,n),n=vf(s,n,1),s=ds(s,n,1),n=Rn(),s!==null&&(tn(s,1,n),Fn(s,n));break}}s=s.return}}function zw(n,s,u){var C=n.pingCache;C!==null&&C.delete(s),s=Rn(),n.pingedLanes|=n.suspendedLanes&u,dn===n&&(gn&u)===u&&(cn===4||cn===3&&(gn&130023424)===gn&&500>$t()-uu?Js(n,0):cu|=u),Fn(n,s)}function Zf(n,s){s===0&&((n.mode&1)===0?s=1:(s=An,An<<=1,(An&130023424)===0&&(An=4194304)));var u=Rn();n=Wr(n,s),n!==null&&(tn(n,s,u),Fn(n,u))}function Kw(n){var s=n.memoizedState,u=0;s!==null&&(u=s.retryLane),Zf(n,u)}function Vw(n,s){var u=0;switch(n.tag){case 13:var C=n.stateNode,j=n.memoizedState;j!==null&&(u=j.retryLane);break;case 19:C=n.stateNode;break;default:throw Error(r(314))}C!==null&&C.delete(s),Zf(n,u)}var ep;ep=function(n,s,u){if(n!==null)if(n.memoizedProps!==s.pendingProps||Dn.current)On=!0;else{if((n.lanes&u)===0&&(s.flags&128)===0)return On=!1,jw(n,s,u);On=(n.flags&131072)!==0}else On=!1,Xt&&(s.flags&1048576)!==0&&Ah(s,zl,s.index);switch(s.lanes=0,s.tag){case 2:var C=s.type;oa(n,s),n=s.pendingProps;var j=Mi(s,bn.current);Oi(s,u),j=Uc(null,s,C,n,j,u);var B=$c();return s.flags|=1,typeof j=="object"&&j!==null&&typeof j.render=="function"&&j.$$typeof===void 0?(s.tag=1,s.memoizedState=null,s.updateQueue=null,Pn(C)?(B=!0,$l(s)):B=!1,s.memoizedState=j.state!==null&&j.state!==void 0?j.state:null,jc(s),j.updater=sa,s.stateNode=j,j._reactInternals=s,Gc(s,C,n,u),s=Jc(null,s,C,!0,B,u)):(s.tag=0,Xt&&B&&xc(s),Nn(null,s,j,u),s=s.child),s;case 16:C=s.elementType;e:{switch(oa(n,s),n=s.pendingProps,j=C._init,C=j(C._payload),s.type=C,j=s.tag=Yw(C),n=pr(C,n),j){case 0:s=Qc(null,s,C,n,u);break e;case 1:s=Ef(null,s,C,n,u);break e;case 11:s=yf(null,s,C,n,u);break e;case 14:s=kf(null,s,C,pr(C.type,n),u);break e}throw Error(r(306,C,""))}return s;case 0:return C=s.type,j=s.pendingProps,j=s.elementType===C?j:pr(C,j),Qc(n,s,C,j,u);case 1:return C=s.type,j=s.pendingProps,j=s.elementType===C?j:pr(C,j),Ef(n,s,C,j,u);case 3:e:{if(Tf(s),n===null)throw Error(r(387));C=s.pendingProps,B=s.memoizedState,j=B.element,Uh(n,s),Ql(s,C,null,u);var G=s.memoizedState;if(C=G.element,B.isDehydrated)if(B={element:C,isDehydrated:!1,cache:G.cache,pendingSuspenseBoundaries:G.pendingSuspenseBoundaries,transitions:G.transitions},s.updateQueue.baseState=B,s.memoizedState=B,s.flags&256){j=Fi(Error(r(423)),s),s=Lf(n,s,C,u,j);break e}else if(C!==j){j=Fi(Error(r(424)),s),s=Lf(n,s,C,u,j);break e}else for($n=os(s.stateNode.containerInfo.firstChild),Un=s,Xt=!0,fr=null,u=Fh(s,null,C,u),s.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(ji(),C===j){s=zr(n,s,u);break e}Nn(n,s,C,u)}s=s.child}return s;case 5:return qh(s),n===null&&Tc(s),C=s.type,j=s.pendingProps,B=n!==null?n.memoizedProps:null,G=j.children,_c(C,j)?G=null:B!==null&&_c(C,B)&&(s.flags|=32),Sf(n,s),Nn(n,s,G,u),s.child;case 6:return n===null&&Tc(s),null;case 13:return Nf(n,s,u);case 4:return Dc(s,s.stateNode.containerInfo),C=s.pendingProps,n===null?s.child=Di(s,null,C,u):Nn(n,s,C,u),s.child;case 11:return C=s.type,j=s.pendingProps,j=s.elementType===C?j:pr(C,j),yf(n,s,C,j,u);case 7:return Nn(n,s,s.pendingProps,u),s.child;case 8:return Nn(n,s,s.pendingProps.children,u),s.child;case 12:return Nn(n,s,s.pendingProps.children,u),s.child;case 10:e:{if(C=s.type._context,j=s.pendingProps,B=s.memoizedProps,G=j.value,qt(Gl,C._currentValue),C._currentValue=G,B!==null)if(jn(B.value,G)){if(B.children===j.children&&!Dn.current){s=zr(n,s,u);break e}}else for(B=s.child,B!==null&&(B.return=s);B!==null;){var J=B.dependencies;if(J!==null){G=B.child;for(var ne=J.firstContext;ne!==null;){if(ne.context===C){if(B.tag===1){ne=qr(-1,u&-u),ne.tag=2;var he=B.updateQueue;if(he!==null){he=he.shared;var Se=he.pending;Se===null?ne.next=ne:(ne.next=Se.next,Se.next=ne),he.pending=ne}}B.lanes|=u,ne=B.alternate,ne!==null&&(ne.lanes|=u),Ac(B.return,u,s),J.lanes|=u;break}ne=ne.next}}else if(B.tag===10)G=B.type===s.type?null:B.child;else if(B.tag===18){if(G=B.return,G===null)throw Error(r(341));G.lanes|=u,J=G.alternate,J!==null&&(J.lanes|=u),Ac(G,u,s),G=B.sibling}else G=B.child;if(G!==null)G.return=B;else for(G=B;G!==null;){if(G===s){G=null;break}if(B=G.sibling,B!==null){B.return=G.return,G=B;break}G=G.return}B=G}Nn(n,s,j.children,u),s=s.child}return s;case 9:return j=s.type,C=s.pendingProps.children,Oi(s,u),j=Qn(j),C=C(j),s.flags|=1,Nn(n,s,C,u),s.child;case 14:return C=s.type,j=pr(C,s.pendingProps),j=pr(C.type,j),kf(n,s,C,j,u);case 15:return Cf(n,s,s.type,s.pendingProps,u);case 17:return C=s.type,j=s.pendingProps,j=s.elementType===C?j:pr(C,j),oa(n,s),s.tag=1,Pn(C)?(n=!0,$l(s)):n=!1,Oi(s,u),pf(s,C,j),Gc(s,C,j,u),Jc(null,s,C,!0,n,u);case 19:return Mf(n,s,u);case 22:return xf(n,s,u)}throw Error(r(156,s.tag))};function tp(n,s){return Gr(n,s)}function Gw(n,s,u,C){this.tag=n,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=s,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 er(n,s,u,C){return new Gw(n,s,u,C)}function _u(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Yw(n){if(typeof n=="function")return _u(n)?1:0;if(n!=null){if(n=n.$$typeof,n===P)return 11;if(n===q)return 14}return 2}function vs(n,s){var u=n.alternate;return u===null?(u=er(n.tag,s,n.key,n.mode),u.elementType=n.elementType,u.type=n.type,u.stateNode=n.stateNode,u.alternate=n,n.alternate=u):(u.pendingProps=s,u.type=n.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=n.flags&14680064,u.childLanes=n.childLanes,u.lanes=n.lanes,u.child=n.child,u.memoizedProps=n.memoizedProps,u.memoizedState=n.memoizedState,u.updateQueue=n.updateQueue,s=n.dependencies,u.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},u.sibling=n.sibling,u.index=n.index,u.ref=n.ref,u}function va(n,s,u,C,j,B){var G=2;if(C=n,typeof n=="function")_u(n)&&(G=1);else if(typeof n=="string")G=5;else e:switch(n){case S:return ei(u.children,j,B,s);case x:G=8,j|=8;break;case R:return n=er(12,u,s,j|2),n.elementType=R,n.lanes=B,n;case F:return n=er(13,u,s,j),n.elementType=F,n.lanes=B,n;case z:return n=er(19,u,s,j),n.elementType=z,n.lanes=B,n;case V:return _a(u,j,B,s);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case I:G=10;break e;case D:G=9;break e;case P:G=11;break e;case q:G=14;break e;case K:G=16,C=null;break e}throw Error(r(130,n==null?n:typeof n,""))}return s=er(G,u,s,j),s.elementType=n,s.type=C,s.lanes=B,s}function ei(n,s,u,C){return n=er(7,n,C,s),n.lanes=u,n}function _a(n,s,u,C){return n=er(22,n,C,s),n.elementType=V,n.lanes=u,n.stateNode={isHidden:!1},n}function wu(n,s,u){return n=er(6,n,null,s),n.lanes=u,n}function bu(n,s,u){return s=er(4,n.children!==null?n.children:[],n.key,s),s.lanes=u,s.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},s}function Xw(n,s,u,C,j){this.tag=s,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=_t(0),this.expirationTimes=_t(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=_t(0),this.identifierPrefix=C,this.onRecoverableError=j,this.mutableSourceEagerHydrationData=null}function yu(n,s,u,C,j,B,G,J,ne){return n=new Xw(n,s,u,J,ne),s===1?(s=1,B===!0&&(s|=8)):s=0,B=er(3,null,null,s),n.current=B,B.stateNode=n,B.memoizedState={element:C,isDehydrated:u,cache:null,transitions:null,pendingSuspenseBoundaries:null},jc(B),n}function Qw(n,s,u){var C=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:E,key:C==null?null:""+C,children:n,containerInfo:s,implementation:u}}function np(n){if(!n)return as;n=n._reactInternals;e:{if(wt(n)!==n||n.tag!==1)throw Error(r(170));var s=n;do{switch(s.tag){case 3:s=s.stateNode.context;break e;case 1:if(Pn(s.type)){s=s.stateNode.__reactInternalMemoizedMergedChildContext;break e}}s=s.return}while(s!==null);throw Error(r(171))}if(n.tag===1){var u=n.type;if(Pn(u))return Nh(n,u,s)}return s}function rp(n,s,u,C,j,B,G,J,ne){return n=yu(u,C,!0,n,j,B,G,J,ne),n.context=np(null),u=n.current,C=Rn(),j=ms(u),B=qr(C,j),B.callback=s??null,ds(u,B,j),n.current.lanes=j,tn(n,j,C),Fn(n,C),n}function wa(n,s,u,C){var j=s.current,B=Rn(),G=ms(j);return u=np(u),s.context===null?s.context=u:s.pendingContext=u,s=qr(B,G),s.payload={element:n},C=C===void 0?null:C,C!==null&&(s.callback=C),n=ds(j,s,G),n!==null&&(vr(n,j,G,B),Xl(n,j,G)),G}function ba(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 sp(n,s){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var u=n.retryLane;n.retryLane=u!==0&&u<s?u:s}}function ku(n,s){sp(n,s),(n=n.alternate)&&sp(n,s)}function Jw(){return null}var ip=typeof reportError=="function"?reportError:function(n){console.error(n)};function Cu(n){this._internalRoot=n}ya.prototype.render=Cu.prototype.render=function(n){var s=this._internalRoot;if(s===null)throw Error(r(409));wa(n,s,null,null)},ya.prototype.unmount=Cu.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var s=n.containerInfo;Qs(function(){wa(null,n,null,null)}),s[Fr]=null}};function ya(n){this._internalRoot=n}ya.prototype.unstable_scheduleHydration=function(n){if(n){var s=ci();n={blockedOn:null,target:n,priority:s};for(var u=0;u<dr.length&&s!==0&&s<dr[u].priority;u++);dr.splice(u,0,n),u===0&&ui(n)}};function xu(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function ka(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11&&(n.nodeType!==8||n.nodeValue!==" react-mount-point-unstable "))}function op(){}function Zw(n,s,u,C,j){if(j){if(typeof C=="function"){var B=C;C=function(){var he=ba(G);B.call(he)}}var G=rp(s,C,n,0,null,!1,!1,"",op);return n._reactRootContainer=G,n[Fr]=G.current,xo(n.nodeType===8?n.parentNode:n),Qs(),G}for(;j=n.lastChild;)n.removeChild(j);if(typeof C=="function"){var J=C;C=function(){var he=ba(ne);J.call(he)}}var ne=yu(n,0,!1,null,null,!1,!1,"",op);return n._reactRootContainer=ne,n[Fr]=ne.current,xo(n.nodeType===8?n.parentNode:n),Qs(function(){wa(s,ne,u,C)}),ne}function Ca(n,s,u,C,j){var B=u._reactRootContainer;if(B){var G=B;if(typeof j=="function"){var J=j;j=function(){var ne=ba(G);J.call(ne)}}wa(s,G,n,j)}else G=Zw(u,s,n,j,C);return ba(G)}cr=function(n){switch(n.tag){case 3:var s=n.stateNode;if(s.current.memoizedState.isDehydrated){var u=ar(s.pendingLanes);u!==0&&(Sr(s,u|1),Fn(s,$t()),(Mt&6)===0&&($i=$t()+500,cs()))}break;case 13:Qs(function(){var C=Wr(n,1);if(C!==null){var j=Rn();vr(C,n,1,j)}}),ku(n,1)}},to=function(n){if(n.tag===13){var s=Wr(n,134217728);if(s!==null){var u=Rn();vr(s,n,134217728,u)}ku(n,134217728)}},ai=function(n){if(n.tag===13){var s=ms(n),u=Wr(n,s);if(u!==null){var C=Rn();vr(u,n,s,C)}ku(n,s)}},ci=function(){return Rt},Pr=function(n,s){var u=Rt;try{return Rt=n,s()}finally{Rt=u}},ft=function(n,s,u){switch(s){case"input":if(Fe(n,u),s=u.name,u.type==="radio"&&s!=null){for(u=n;u.parentNode;)u=u.parentNode;for(u=u.querySelectorAll("input[name="+JSON.stringify(""+s)+'][type="radio"]'),s=0;s<u.length;s++){var C=u[s];if(C!==n&&C.form===n.form){var j=Hl(C);if(!j)throw Error(r(90));ge(C),Fe(C,j)}}}break;case"textarea":nt(n,u);break;case"select":s=u.value,s!=null&&Ae(n,!!u.multiple,s,!1)}},Ce=mu,fe=Qs;var eb={usingClientEntryPoint:!1,Events:[To,Ni,Hl,Pe,Re,mu]},Uo={findFiberByHostInstance:Ws,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},tb={bundleType:Uo.bundleType,version:Uo.version,rendererPackageName:Uo.rendererPackageName,rendererConfig:Uo.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:T.ReactCurrentDispatcher,findHostInstanceByFiber:function(n){return n=rr(n),n===null?null:n.stateNode},findFiberByHostInstance:Uo.findFiberByHostInstance||Jw,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 xa=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!xa.isDisabled&&xa.supportsFiber)try{or=xa.inject(tb),_n=xa}catch{}}return Hn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=eb,Hn.createPortal=function(n,s){var u=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!xu(s))throw Error(r(200));return Qw(n,s,null,u)},Hn.createRoot=function(n,s){if(!xu(n))throw Error(r(299));var u=!1,C="",j=ip;return s!=null&&(s.unstable_strictMode===!0&&(u=!0),s.identifierPrefix!==void 0&&(C=s.identifierPrefix),s.onRecoverableError!==void 0&&(j=s.onRecoverableError)),s=yu(n,1,!1,null,null,u,!1,C,j),n[Fr]=s.current,xo(n.nodeType===8?n.parentNode:n),new Cu(s)},Hn.findDOMNode=function(n){if(n==null)return null;if(n.nodeType===1)return n;var s=n._reactInternals;if(s===void 0)throw typeof n.render=="function"?Error(r(188)):(n=Object.keys(n).join(","),Error(r(268,n)));return n=rr(s),n=n===null?null:n.stateNode,n},Hn.flushSync=function(n){return Qs(n)},Hn.hydrate=function(n,s,u){if(!ka(s))throw Error(r(200));return Ca(null,n,s,!0,u)},Hn.hydrateRoot=function(n,s,u){if(!xu(n))throw Error(r(405));var C=u!=null&&u.hydratedSources||null,j=!1,B="",G=ip;if(u!=null&&(u.unstable_strictMode===!0&&(j=!0),u.identifierPrefix!==void 0&&(B=u.identifierPrefix),u.onRecoverableError!==void 0&&(G=u.onRecoverableError)),s=rp(s,null,n,1,u??null,j,!1,B,G),n[Fr]=s.current,xo(n),C)for(n=0;n<C.length;n++)u=C[n],j=u._getVersion,j=j(u._source),s.mutableSourceEagerHydrationData==null?s.mutableSourceEagerHydrationData=[u,j]:s.mutableSourceEagerHydrationData.push(u,j);return new ya(s)},Hn.render=function(n,s,u){if(!ka(s))throw Error(r(200));return Ca(null,n,s,!1,u)},Hn.unmountComponentAtNode=function(n){if(!ka(n))throw Error(r(40));return n._reactRootContainer?(Qs(function(){Ca(null,null,n,!1,function(){n._reactRootContainer=null,n[Fr]=null})}),!0):!1},Hn.unstable_batchedUpdates=mu,Hn.unstable_renderSubtreeIntoContainer=function(n,s,u,C){if(!ka(u))throw Error(r(200));if(n==null||n._reactInternals===void 0)throw Error(r(38));return Ca(n,s,u,!1,C)},Hn.version="18.3.1-next-f1338f8080-20240426",Hn}var pp;function jg(){if(pp)return Tu.exports;pp=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Tu.exports=db(),Tu.exports}var mp;function hb(){if(mp)return Sa;mp=1;var t=jg();return Sa.createRoot=t.createRoot,Sa.hydrateRoot=t.hydrateRoot,Sa}var fb=hb(),N=qd();const pb=ib(N);function Te(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)?t:null}function Oe(t){return typeof t=="string"?t:null}function ie(t){return typeof t=="string"&&t.length>0?t:null}function Ct(t){return typeof t=="boolean"?t:null}function Ee(t){return typeof t=="number"&&Number.isFinite(t)?t:null}function mb(t){return typeof t=="number"&&Number.isInteger(t)&&t>0?t:null}function sn(t){if(!Array.isArray(t))return null;const e=[];for(const r of t){if(typeof r!="string")return null;e.push(r)}return e}function Dt(t,e){if(!Array.isArray(t))return null;const r=[];for(const l of t){const a=e(l);if(a===null)return null;r.push(a)}return r}function Qt(t,e){if(!Array.isArray(t))return null;const r=[];for(const l of t){const a=e(l);a!==null&&r.push(a)}return r}function Xe(t,e){return typeof t=="string"&&e.includes(t)?t:null}function gb(t){try{return JSON.parse(t)}catch{return}}const vb=["auto","default","acceptEdits","plan"];function si(t){return typeof t=="string"&&vb.includes(t)}const _b={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:[],locationDestinationInvalid:["path"],locationDestinationProtected:[],locationFolderInvalid:[],locationNoFolder:[],locationNotMoved:[],locationNothingToMove:[],locationOriginExists:["path"],locationPendingMessages:["count"],locationPreviewGone:[],locationProjectGone:[],locationSameFolder:[],locationSaveFailed:["detail"],locationTabsOpen:["count"],locationsOtherVersion:[],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:[],noteCliDraft:["label"],noteCliNotStarted:[],noteEmpty:[],noteExists:[],noteGone:[],noteIdInvalid:[],noteImageFailed:[],noteImagesMax:["max"],noteFilesMax:["max"],noteImagesUnsupported:[],noteInterrupted:[],noteNoAgent:[],noteNoReadySignal:[],noteSaveFailed:[],noteTooLong:["max"],notesMax:["max"],openToolSubmit:["label"],submitUnknownActivity:["label"],submitStartupPending:["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:[],scheduleEmpty:[],scheduleGone:[],scheduleNoConversation:[],scheduleOff:[],schedulePast:[],scheduleSaveFailed:[],scheduleSending:[],scheduleTooFar:["days"],scheduleTooLong:["max"],scheduleTooMany:["max"],scheduleUnsupported:["label"],scheduledCliDraft:[],scheduledCliNotReady:[],scheduledCliOpenFailed:[],scheduledElsewhereTimeout:[],scheduledMissed:[],scheduledNoTab:[],scheduledUncertain:[],scheduledUncertainWrite:[],scheduledUnconfirmed:[],scheduledWaitAnswer:[],scheduledWaitBusy:[],scheduledWaitElsewhere:[],scheduledWaitGrace:[],scheduledWaitNoTab:[],scheduledWaitOtherInstance:[],searchFailed:[],settingsFailed:[],settingsHostOnly:[],settingsShellMissing:[],shellNotFound:[],submitCliDraft:["label"],submitCliDraftCommand:["label"],submitInterrupted:[],submitStartupDialog:["label"],submitStoppedTool:["label"],submitStoppedToolNoLabel:[],submitStoppedWaiting:["label"],submitStoppedWaitingNoLabel:[],tabClosedWhileOpening:[],tabDirGone:[],tabOpenFailed:[],terminalAsleep:[],terminalGone:[],terminalOpenFailed:[],tooManyTabs:["max"],vaultBusyMeasuring:[],vaultBusyMoving:[],vaultBusyWriting:[],vaultCannotWrite:[],vaultCurrentInsideTarget:[],vaultDiskFull:["detail"],vaultFailed:[],vaultIndexNotReady:[],vaultMeasureFirst:[],vaultMemoryFailed:["cwd","detail"],vaultMoveFailed:["detail"],vaultMoving:[],vaultNoCopyYet:[],vaultNotLoaded:[],vaultProjectGone:[],vaultReasonNewerFormat:[],vaultReasonOriginMissing:[],vaultReasonUnsafeId:[],vaultSessionFailed:["agent","detail","session"],vaultSessionMissing:[],vaultTargetCliFolder:[],vaultTargetInsideCurrent:[],vaultTargetNotAbsolute:[],waitingSubmit:["label"],worktreeBaseAdvanced:["base"],worktreeBaseMissing:["base"],worktreeBaseNotOpen:["base"],worktreeBranchExists:["branch"],worktreeBranchInUse:["branch"],worktreeBranchInvalid:["branch"],worktreeBranchMissing:["branch"],worktreeBranchMoved:["branch"],worktreeBranchNotIntegrated:["branch"],worktreeDiffEmpty:[],worktreeDiscardFailed:["detail"],worktreeFailed:[],worktreeFileNotInBranch:[],worktreeFolderExists:["folder"],worktreeGitFailed:["detail"],worktreeInUse:[],worktreeLocalChanges:["count"],worktreeMoveBusy:[],worktreeMoveCliCheckFailed:["cli","detail"],worktreeMoveCliFailed:["branch","cli","detail"],worktreeMoveCliUnsupported:["cli"],worktreeMovePending:[],worktreeMoveUnavailable:[],worktreeMoveWaiting:[],worktreeNoConflicts:[],worktreeNoReview:[],worktreeNotRepo:[],worktreeNotesConflict:["count"],worktreeNotesFailed:["detail"],worktreeNothingToCommit:[],worktreeNothingToIntegrate:[],worktreeNothingToReview:[],worktreeProjectUnknown:[],worktreeReviewUnread:[],worktreeUncommitted:["count"],worktreeUnknown:[],worktreeUntrackedChanged:[],worktreeUpToDate:["base"]};function wb(t){return Object.prototype.hasOwnProperty.call(_b,t)}function br(t,e=0){const r=Te(t);if(r===null)return null;const l=Oe(r.key);if(l===null||l.length===0)return null;const a=r.params;if(a===void 0)return{key:l};const y=Te(a);if(y===null)return null;const v={};for(const[o,c]of Object.entries(y)){if(typeof c=="string"||typeof c=="number"&&Number.isFinite(c)){v[o]=c;continue}const m=e===0?br(c,e+1):null;if(m===null)return null;v[o]=m}return{key:l,params:v}}function bb(t){if(!Array.isArray(t))return null;const e=[];for(const r of t){const l=br(r);if(l===null)return null;e.push(l)}return e}const jr=["claude-code","codex","opencode","antigravity","pi"],Ru=6e3,yb=["gemini-cli","antigravity-ide"],Ya=[...jr,...yb],kb={"gemini-cli":"Gemini CLI","antigravity-ide":"Antigravity IDE"};function Qi(t){return jr.includes(t)}const Cb=["at-quoted","bare-path-paste","quoted-path-line"],xb=["at"],Sb=["usage-with-variants","token-count","usage-with-catalog","status-line"],Eb=["child-session-marker"],Tb=["active","missing","other-command","disabled","unreadable"],Lb=["cli","tools"];function Dg(t,e=null){return!t.statusSource||e==="unknown"}const Pg={sessionIdAtLaunch:!1,resume:!1,statusSource:!1,readySignal:!1,permissionCycle:null,codexPermissions:!1,models:null,efforts:null,questionCards:!1,imagesByPath:null,fileMentions:null,rewind:!1,contextWindowSource:null,plans:!1,waitingBlocksSubmit:!1,forceSend:!1,editQueue:!1,scheduledSend:!1,codexNativeQueue:!1,moveToWorktree:!1,readOnlyLaunch:null};function Nb(t,e){var a;const r=t.permissionCycle;if(r===null)return null;const l=e?((a=t.readOnlyLaunch)==null?void 0:a.mode)??null:null;return l!==null&&r.modes.includes(l)?l:r.launchMode}function zd(t){return t.filter(e=>e.available).length>1}function Rb(t){const e=Te(t);if(e===null)return null;const r=e.modes;if(!Array.isArray(r)||r.length===0)return null;const l=[];for(const v of r){if(!si(v))return null;l.push(v)}const a=e.launchMode;if(!si(a)||!l.includes(a))return null;const y=ie(e.keyLabel);return y===null?null:{modes:l,launchMode:a,keyLabel:y,approvesPendingOnCycle:e.approvesPendingOnCycle===!0}}function Mb(t){const e=Te(t);if(e===null)return null;const r=Xe(e.guard,Lb),l=e.mode;return r===null||l!==null&&!si(l)?null:{mode:l===null?null:l,guard:r}}function gp(t){const e=Te(t);if(e===null)return null;const r=Xe(e.state,Tb),l=ie(e.settingsPath),a=ie(e.scriptPath),y=e.fragment,v=y===null?null:ie(y);return r===null||l===null||a===null||y!==null&&v===null?null:{state:r,settingsPath:l,scriptPath:a,fragment:v}}function Ab(t){const e=Te(t);if(e===null)return null;const r=ie(e.value),l=Oe(e.label),a=Oe(e.family),y=Ct(e.long),v=e.window,o=v===null?null:Ee(v);if(r===null||l===null||a===null||y===null||v!==null&&o===null)return null;const c=Dt(e.supportedEfforts,ie),m=e.defaultEffort===null?null:ie(e.defaultEffort);return{value:r,label:l,family:a,long:y,window:o,...c===null?{}:{supportedEfforts:c},...typeof e.isDefault=="boolean"?{isDefault:e.isDefault}:{},...m!==null||e.defaultEffort===null?{defaultEffort:m}:{}}}function Ib(t){const e=Te(t);if(e===null)return null;const r=ie(e.value),l=Oe(e.label);return r===null||l===null?null:{value:r,label:l}}function vp(t,e){const r=Dt(t,e);return r===null||r.length===0?null:r}function jb(t){const e=Te(t);if(e===null||!Array.isArray(e.modes)||e.modes.length===0||e.modes.length>2)return null;const r=[];for(const a of e.modes){const y=Te(a);if(y===null||y.mode!=="dictation"&&y.mode!=="live"||y.control!=="claude-hold-space"&&y.control!=="antigravity-dictation"&&y.control!=="antigravity-live"&&y.control!=="codex-live-f8")return null;r.push({mode:y.mode,control:y.control})}const l=r.map(({mode:a,control:y})=>`${a}:${y}`).join(",");return e.defaultMode==="dictation"&&l==="dictation:claude-hold-space"?{defaultMode:"dictation",modes:[{mode:"dictation",control:"claude-hold-space"}]}:e.defaultMode==="dictation"&&l==="dictation:antigravity-dictation,live:antigravity-live"?{defaultMode:"dictation",modes:[{mode:"dictation",control:"antigravity-dictation"},{mode:"live",control:"antigravity-live"}]}:e.defaultMode==="live"&&l==="live:codex-live-f8"?{defaultMode:"live",modes:[{mode:"live",control:"codex-live-f8"}]}:null}function Db(t){const e=Te(t);if(e===null)return{...Pg};const r={sessionIdAtLaunch:e.sessionIdAtLaunch===!0,resume:e.resume===!0,statusSource:e.statusSource===!0,readySignal:e.readySignal===!0,permissionCycle:Rb(e.permissionCycle),codexPermissions:e.codexPermissions===!0,models:vp(e.models,Ab),efforts:vp(e.efforts,Ib),questionCards:e.questionCards===!0,imagesByPath:Xe(e.imagesByPath,Cb),fileMentions:Xe(e.fileMentions,xb),rewind:e.rewind===!0,contextWindowSource:Xe(e.contextWindowSource,Sb),plans:e.plans===!0,waitingBlocksSubmit:e.waitingBlocksSubmit===!0,forceSend:e.forceSend===!0,editQueue:e.editQueue===!0,scheduledSend:e.scheduledSend===!0,codexNativeQueue:e.codexNativeQueue===!0,moveToWorktree:e.moveToWorktree===!0,readOnlyLaunch:Mb(e.readOnlyLaunch)},l=jb(e.nativeVoice);return l!==null&&(r.nativeVoice=l),r}function _p(t){const e=Te(t);if(e===null)return null;const r=Xe(e.id,jr),l=Oe(e.label),a=Oe(e.command),y=Oe(e.installUrl);return r===null||l===null||a===null||y===null?null:{id:r,label:l,command:a,available:e.available===!0,version:Oe(e.version),installUrl:y,missingMessage:br(e.missingMessage),capabilities:Db(e.capabilities),environmentNotice:Xe(e.environmentNotice,Eb),statusLine:gp(e.statusLine),planLimitsSetup:gp(e.planLimitsSetup)}}const Pb=["staged","unstaged","untracked","conflict"],Og=["added","modified","deleted","renamed","copied","type-changed","untracked","conflict"],Ob=["ready","not-a-repo","git-missing","error"],Ea={state:"not-a-repo",message:null,repoRoot:"",branch:null,head:null,upstream:null,ahead:0,behind:0,changes:[],worktrees:[],truncated:!1,updatedAt:0},Bb=["meta","hunk","context","added","removed"];function Fb(t){const e=Te(t);if(e===null)return null;const r=ie(e.path),l=Xe(e.kind,Og),a=Xe(e.stage,Pb);return r===null||l===null||a===null?null:{path:r,kind:l,stage:a,oldPath:Oe(e.oldPath)}}function Hb(t){const e=Te(t);if(e===null)return null;const r=ie(e.path);return r===null?null:{path:r,branch:Oe(e.branch),isCurrent:e.isCurrent===!0,isMain:e.isMain===!0}}function Ub(t){const e=Te(t);if(e===null)return null;const r=Xe(e.state,Ob),l=Oe(e.repoRoot),a=Ee(e.ahead),y=Ee(e.behind),v=Dt(e.changes,Fb),o=Dt(e.worktrees,Hb),c=Ee(e.updatedAt);return r===null||l===null||a===null||y===null||v===null||o===null||c===null?null:{state:r,message:br(e.message),repoRoot:l,branch:Oe(e.branch),head:Oe(e.head),upstream:Oe(e.upstream),ahead:a,behind:y,changes:v,worktrees:o,truncated:e.truncated===!0,updatedAt:c}}function $b(t){const e=Te(t);if(e===null)return null;const r=Xe(e.kind,Bb),l=Oe(e.text);return r===null||l===null?null:{kind:r,text:l,oldLine:Ee(e.oldLine),newLine:Ee(e.newLine)}}function wp(t){const e=Te(t);if(e===null)return null;const r=ie(e.path),l=Ct(e.staged),a=Dt(e.lines,$b);return r===null||l===null||a===null?null:{path:r,staged:l,lines:a,truncated:e.truncated===!0,binary:e.binary===!0,message:br(e.message)}}const Wb=100,qb=/^[A-Za-z0-9._/-]+$/,zb=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])$/i;function Kb(t){if(t.length===0)return"empty";if(t.length>Wb)return"too-long";if(!qb.test(t))return"characters";if(t.startsWith("-"))return"starts-with-dash";if(t.startsWith("/")||t.endsWith("/")||t.includes("//"))return"slashes";const e=t.split("/");if(t.includes("..")||t.endsWith(".")||e.some(l=>l.startsWith(".")))return"dots";if(e.some(l=>l.endsWith(".lock")))return"lock";if(t==="HEAD")return"reserved";const r=Bg(t).split(".")[0]??"";return zb.test(r)?"reserved":null}function Bg(t){return t.split("/").join("-")}function Vb(t,e){return t==="busy"?"busy":t==="waiting"?"waiting":e?"pending":null}const Gb=8,Yb=["nested-repo","too-many","copied"],Xb=2e4,Qb=["clean","conflicts"],Jb=["ready","changes","none"],Zb=["working","pending","done"],ey=["nothing","behind","no-base-folder","local-changes"],ty=["not-integrated","checked-out"];function ny(t,e){const r=v=>v==="cli"?0:v==="tools"?1:2,l=e.filter(v=>v.id!==t),a=l.length>0?l:e;let y=null;for(const v of a)(y===null||r(v.guard)<r(y.guard))&&(y=v);return(y==null?void 0:y.id)??null}function ry(t){return typeof t=="string"&&/^[0-9a-f]{40}(?:[0-9a-f]{24})?$/.test(t)?t:null}function sy(t){return typeof t=="string"&&/^[0-9a-f]{64}$/.test(t)?t:null}function iy(t){const e=Te(t);if(e===null)return null;const r=Ee(e.files),l=Ee(e.bytes);if(r===null||l===null)return null;if(e.blocked!==null&&e.blocked!==void 0){const y=Xe(e.blocked,Yb);return y===null?null:{files:r,bytes:l,stamp:null,blocked:y}}const a=sy(e.stamp);return a===null?null:{files:r,bytes:l,stamp:a,blocked:null}}function oy(t){const e=Te(t);if(e===null)return null;const r=ie(e.mainCwd),l=Ct(e.linked);return r===null||l===null?null:{mainCwd:r,branch:ie(e.branch),linked:l}}function ly(t){const e=Te(t);if(e===null)return null;const r=ie(e.branch),l=Ct(e.exists);return r===null||l===null?null:{branch:r,exists:l,reopenable:e.reopenable===!0}}function bp(t){const e=Te(t);if(e===null)return null;const r=Ee(e.files),l=Ee(e.bytes),a=sn(e.sample);return r===null||l===null||a===null?null:{files:r,bytes:l,overCap:e.overCap===!0,sample:a}}function ay(t){const e=Te(t);if(e===null)return null;const r=ie(e.name);return r===null?null:{name:r,checkedOut:e.checkedOut===!0}}function cy(t){const e=Te(t);if(e===null)return null;const r=ie(e.mainRoot),l=ie(e.parentDir),a=ie(e.separator),y=Dt(e.branches,ay),v=Ee(e.mainChanges),o=bp(e.notes),c=e.include===null?null:bp(e.include);return r===null||l===null||a===null||y===null||v===null||o===null||e.include!==null&&c===null?null:{mainRoot:r,parentDir:l,separator:a,currentBranch:ie(e.currentBranch),branches:y,mainChanges:v,sourceChanges:Ee(e.sourceChanges),include:c,notes:o}}function uy(t){const e=Te(t);if(e===null)return null;const r=ie(e.path);if(r===null)return null;const l=e.integrated;return{id:ie(e.id),path:r,branch:ie(e.branch),base:ie(e.base),isCurrent:e.isCurrent===!0,isMain:e.isMain===!0,changes:Ee(e.changes),ahead:Ee(e.ahead),integrated:typeof l=="boolean"?l:null,behind:Ee(e.behind),merge:dy(e.merge),overlaps:Qt(e.overlaps,hy)??[],review:Fg(e.review)}}function Kd(t){const e=sn(t.files),r=Ee(t.fileCount);return e===null||r===null?null:{files:e,fileCount:r}}function dy(t){const e=Te(t);if(e===null)return null;const r=Xe(e.state,Qb),l=Kd(e);return r===null||l===null?null:{state:r,...l}}function hy(t){const e=Te(t);if(e===null)return null;const r=ie(e.branch),l=Kd(e);return r===null||l===null?null:{branch:r,...l}}function Fg(t){const e=Te(t);if(e===null)return null;const r=Xe(e.agent,jr),l=Xe(e.state,Zb),a=Ee(e.requestedAt);return r===null||l===null||a===null?null:{agent:r,state:l,verdict:l==="done"?Xe(e.verdict,Jb)??"none":null,stale:e.stale===!0,requestedAt:a,terminalId:ie(e.terminalId)}}function fy(t){const e=Te(t);if(e===null)return null;const r=ie(e.sha),l=Oe(e.subject),a=Ee(e.at);return r===null||l===null||a===null?null:{sha:r,subject:l,at:a}}function py(t){const e=Te(t);if(e===null)return null;const r=ie(e.path),l=Xe(e.kind,Og);return r===null||l===null?null:{path:r,oldPath:ie(e.oldPath),kind:l}}function my(t){const e=Te(t);if(e===null)return null;const r=ie(e.id),l=ie(e.branch),a=ie(e.base),y=Dt(e.commits,fy),v=Ee(e.commitCount),o=Dt(e.files,py),c=Ee(e.fileCount),m=Ee(e.uncommitted);return r===null||l===null||a===null||y===null||v===null||o===null||c===null||m===null?null:{id:r,branch:l,base:a,commits:y,commitCount:v,files:o,fileCount:c,uncommitted:m}}function gy(t){const e=Te(t);if(e===null)return null;const r=ie(e.id),l=ie(e.branch),a=ie(e.base),y=ie(e.prompt),v=Ee(e.ahead),o=Ee(e.uncommitted),c=Ct(e.branchBusy);return r===null||l===null||a===null||y===null||v===null||o===null||c===null?null:{id:r,branch:l,base:a,author:Xe(e.author,jr),prompt:y,ahead:v,uncommitted:o,branchBusy:c}}function vy(t){const e=Te(t);if(e===null)return null;const r=ie(e.id),l=ie(e.branch),a=ie(e.base),y=Ee(e.ahead),v=Ee(e.behind),o=Kd(e),c=Dt(e.tabs,Hg),m=sn(e.localConflicts),w=Ee(e.branchUncommitted),d=e.blocker,k=d===null?null:Xe(d,ey);return r===null||l===null||a===null||y===null||v===null||o===null||c===null||m===null||w===null||d!==null&&k===null?null:{id:r,branch:l,base:a,baseFolder:ie(e.baseFolder),command:ie(e.command),branchCommit:ry(e.branchCommit),ahead:y,behind:v,...o,review:Fg(e.review),tabs:c,localConflicts:m,branchUncommitted:w,blocker:k,notes:_y(e.notes)}}function _y(t){const e=Te(t);if(e===null)return null;const r=sn(e.returning),l=sn(e.conflicts);return r===null||l===null?null:{returning:r,merging:sn(e.merging)??[],resolved:sn(e.resolved)??[],conflicts:l}}function wy(t){const e=Te(t);if(e===null)return null;const r=Ee(e.commits),l=ie(e.base);if(r===null||l===null)return null;const a=Te(e.notes),y=Ee(a==null?void 0:a.returned),v=sn(a==null?void 0:a.stayed);return y===null||v===null?{commits:r,base:l}:{commits:r,base:l,notes:{returned:y,stayed:v}}}function by(t){const e=Te(t);if(e===null)return null;const r=ie(e.id),l=ie(e.branch),a=ie(e.base);return r===null||l===null||a===null?null:{id:r,branch:l,base:a,ahead:Ee(e.ahead)}}function yy(t){const e=Te(t);if(e===null)return null;const r=ie(e.id),l=ie(e.branch),a=ie(e.base),y=ie(e.folder),v=ie(e.command),o=e.blocker,c=o===null?null:Xe(o,ty);return r===null||l===null||a===null||y===null||v===null||o!==null&&c===null?null:{id:r,branch:l,base:a,folder:y,command:v,ahead:Ee(e.ahead),blocker:c}}const ky=["agent","shell"];function Hg(t){const e=Te(t);if(e===null)return null;const r=ie(e.terminalId),l=Xe(e.kind,ky),a=Oe(e.label);return r===null||l===null||a===null?null:{terminalId:r,kind:l,label:a}}const yp=255;function Cy(t){var y;const e=Te(t);if(e===null)return null;const r=mb(e.pid),l=ie(e.name);if(r===null||l===null||l.length>yp)return null;const a=((y=Oe(e.description))==null?void 0:y.trim())??"";return{pid:r,name:l,description:a.length>0&&a.length<=yp?a:null}}function xy(t){const e=Te(t);if(e===null)return null;const r=ie(e.id),l=ie(e.branch),a=ie(e.path),y=sn(e.commands),v=sn(e.uncommitted),o=Ee(e.uncommittedCount),c=Dt(e.tabs,Hg),m=sn(e.returning),w=sn(e.conflicts),d=Ct(e.deletesBranch);if(r===null||l===null||a===null||y===null||v===null||o===null||c===null||m===null||w===null||d===null)return null;const k=typeof e.inUse=="boolean"?e.inUse:null;return{id:r,branch:l,path:a,commands:y,uncommitted:v,uncommittedCount:o,untracked:o>0?iy(e.untracked):null,tabs:c,returning:m,merging:(sn(e.merging)??[]).filter(L=>m.includes(L)),resolved:sn(e.resolved)??[],conflicts:w,inUse:k,holders:k===!0?(Qt(e.holders,Cy)??[]).slice(0,Gb):[],deletesBranch:d,branchUnused:d&&e.branchUnused===!0,createdBranch:e.createdBranch!==!1}}function Sy(t){const e=Te(t);if(e===null)return null;const r=Ct(e.branchDeleted),l=Ee(e.returned),a=Ee(e.discarded);return r===null||l===null||a===null?null:{branchDeleted:r,returned:l,discarded:a,discardedFiles:Ee(e.discardedFiles)??0}}const Ey=["custom","ai","first-message","none"],Ty=["native","vault"],Ly=["idle","scanning","ready"],Ny=["agent","shell"],Ry=["busy","idle","waiting","offline","unknown"],My=["server-closed"];function Ay(t){const e=Te(t);if(e===null)return null;const r=ie(e.sessionId),l=Oe(e.title),a=Xe(e.titleSource,Ey),y=Ee(e.updatedAt),v=Ee(e.sizeBytes);if(r===null||l===null||a===null||y===null||v===null)return null;const o=e.agent===void 0?"claude-code":Xe(e.agent,Ya);if(o===null)return null;const c=Oe(e.cwd)??"";return{agent:o,sessionId:r,cwd:c,title:l,titleSource:a,updatedAt:y,sizeBytes:v,archived:e.archived===!0,storage:Xe(e.storage,Ty)??"native",partial:e.partial===!0,worktree:ly(e.worktree),...e.relocated===!0?{relocated:!0}:{}}}function Iy(t){const e=Te(t);if(e===null)return null;const r=ie(e.from),l=ie(e.to),a=Ee(e.sessions);return r===null||l===null||a===null?null:{from:r,to:l,sessions:a,paused:e.paused===!0}}function jy(t){const e=Te(t);if(e===null)return null;const r=ie(e.previewId),l=ie(e.projectKey),a=ie(e.to),y=Qt(e.from,ie),v=Ee(e.moving),o=Ee(e.inSubfolders),c=Ee(e.inDestination),m=Ee(e.tabs),w=Ee(e.pending);return r===null||l===null||a===null||y===null||y.length===0||v===null||o===null||c===null||m===null||w===null?null:{previewId:r,projectKey:l,from:y,to:a,moving:v,inSubfolders:o,inDestination:c,tabs:m,pending:w}}function Dy(t){const e=Te(t);if(e===null)return null;const r=Oe(e.cwd),l=Ct(e.cwdExists),a=Qt(e.sessions,Ay),y=Ee(e.lastActivityAt);if(r===null||l===null||a===null||y===null)return null;const v=ie(e.key);if(v!==null){const c=Qt(e.relocations,Iy)??[];return{key:v,fallbackName:Oe(e.fallbackName)??"",cwd:r,cwdExists:l,isGitRepo:e.isGitRepo===!0,sessions:a,lastActivityAt:y,...c.length>0?{relocations:c}:{}}}const o=ie(e.slug);return o===null?null:{key:o,fallbackName:r.length===0?o:"",cwd:r,cwdExists:l,isGitRepo:!1,sessions:a,lastActivityAt:y}}function Py(t){const e=Te(t);if(e===null)return null;const r=Xe(e.state,Ly),l=Ee(e.scannedFiles),a=Ee(e.totalFiles);return r===null||l===null||a===null?null:{state:r,scannedFiles:l,totalFiles:a}}function Mu(t){const e=Te(t);if(e===null)return null;const r=ie(e.terminalId),l=Xe(e.kind,Ny)??"agent";let a=null;if(l==="agent"&&(a=e.agent===void 0?"claude-code":Xe(e.agent,jr),a===null))return null;const y=Oe(e.cwd),v=Oe(e.sessionId),o=Oe(e.label),c=Ct(e.resumed),m=Ee(e.createdAt),w=Ct(e.alive);if(r===null||y===null||v===null||o===null||c===null||m===null||w===null)return null;const d=e.exitCode;return{terminalId:r,kind:l,agent:a,cwd:y,sessionId:v,label:o,resumed:c,createdAt:m,alive:w,exitCode:typeof d=="number"?d:null,sleeping:e.sleeping===!0,launchedAt:Ee(e.launchedAt),worktree:oy(e.worktree),review:l==="agent"&&e.review===!0}}const Ug=["user","assistant"];function Ta(t){return t.replace(/[`*_]/g,"").replace(/\s+/g," ").trim().toLowerCase()}function Oy(t,e){return Ta(t.question)===Ta(e.question)&&t.multiSelect===e.multiSelect&&(t.allowWriteIn??!0)===(e.allowWriteIn??!0)&&t.options.length===e.options.length&&t.options.every((r,l)=>{var v;const a=Ta(r.label),y=Ta(((v=e.options[l])==null?void 0:v.label)??"");return a.length>0&&y.length>0&&(a.startsWith(y)||y.startsWith(a))})}function By(t,e){return t>0&&e!==null&&t<e}const $g=["content","attachment","pasted"],Fy=["compacted","interrupted","error"],Hy=["cli-plans","project","scratch","reference"],Uy=120,$y=20,Wy=20,kp=4e3,Au={lastRequestTokens:0,lastOutputTokens:0,lastModel:null,contextWindow:null,contextWindowEstimated:!1,totalInputTokens:0,totalOutputTokens:0,totalCacheReadTokens:0,assistantMessages:0},Cp=["waiting","live","unavailable","no-transcript"];function qy(t){const e=Te(t);if(e===null)return null;const r=Ee(e.inputTokens),l=Ee(e.outputTokens),a=Ee(e.cacheCreationInputTokens),y=Ee(e.cacheReadInputTokens);return r===null||l===null||a===null||y===null?null:{inputTokens:r,outputTokens:l,cacheCreationInputTokens:a,cacheReadInputTokens:y}}function zy(t){const e=Te(t);if(e===null)return null;const r=ie(e.label);return r===null?null:{label:r,description:Oe(e.description)??""}}function Ky(t){const e=Te(t);if(e===null)return null;const r=ie(e.question),l=Dt(e.options,zy);return r===null||l===null||l.length===0?null:{question:r,header:Oe(e.header)??"",multiSelect:e.multiSelect===!0,...e.allowWriteIn===!1?{allowWriteIn:!1}:{},options:l}}function Vd(t){const e=Te(t);if(e===null)return null;switch(e.kind){case"text":{const r=Oe(e.text),l=Ct(e.truncated);return r===null||l===null?null:{kind:"text",text:r,truncated:l}}case"tool-call":{const r=Oe(e.toolUseId),l=Oe(e.name),a=Oe(e.input),y=Ct(e.truncated);return r===null||l===null||a===null||y===null?null:{kind:"tool-call",toolUseId:r,name:l,input:a,truncated:y}}case"tool-result":{const r=Oe(e.toolUseId),l=Oe(e.text),a=Ct(e.isError),y=Ct(e.truncated),v=Ee(e.imageCount);return r===null||l===null||a===null||y===null||v===null?null:{kind:"tool-result",toolUseId:r,text:l,isError:a,truncated:y,imageCount:v}}case"thinking":return{kind:"thinking"};case"question":{const r=ie(e.toolUseId),l=Dt(e.questions,Ky);return r===null||l===null||l.length===0?null:{kind:"question",toolUseId:r,questions:l}}case"image":{const r=Ee(e.index),l=Oe(e.mediaType);if(r===null||l===null)return null;const a=Xe(e.source,$g)??"content";return{kind:"image",index:r,mediaType:l,source:a}}case"notice":{const r=Xe(e.notice,Fy);return r===null?null:{kind:"notice",notice:r,detail:Oe(e.detail)??""}}default:return null}}function Iu(t){const e=Te(t);if(e===null)return null;const r=ie(e.eventId),l=Xe(e.role,Ug),a=Ee(e.at),y=Dt(e.parts,Vd);return r===null||l===null||a===null||y===null?null:{eventId:r,role:l,at:a,parts:y,model:Oe(e.model),usage:qy(e.usage),effort:Oe(e.effort),durationMs:Ee(e.durationMs),queued:e.queued===!0}}function Vy(t){const e=Te(t);if(e===null)return null;const r=ie(e.toolUseId),l=Oe(e.description),a=Ee(e.startedAt);return r===null||l===null||a===null?null:{toolUseId:r,description:l.slice(0,Uy),background:e.background===!0,startedAt:a}}function Gy(t){const e=Te(t);if(e===null)return null;const r=ie(e.id),l=Oe(e.text),a=Ee(e.images),y=Ee(e.at);if(r===null||l===null||a===null||y===null)return null;const v={id:r,text:l.slice(0,kp),truncated:e.truncated===!0||l.length>kp,images:Math.max(0,Math.floor(a)),at:y},o=ie(e.eventId);return o!==null&&(v.eventId=o),e.forced===!0&&(v.forced=!0),e.sent===!0&&(v.sent=!0,e.editable===!0&&(v.editable=!0)),v}function xp(t){const e=Te(t);if(e===null)return null;const r=Ee(e.lastRequestTokens),l=Ee(e.lastOutputTokens),a=Ee(e.totalInputTokens),y=Ee(e.totalOutputTokens),v=Ee(e.totalCacheReadTokens),o=Ee(e.assistantMessages);if(r===null||l===null||a===null||y===null||v===null||o===null)return null;const c=Oe(e.lastEffort);return{lastRequestTokens:r,lastOutputTokens:l,lastModel:Oe(e.lastModel),contextWindow:Ee(e.contextWindow),contextWindowEstimated:e.contextWindowEstimated===!0,totalInputTokens:a,totalOutputTokens:y,totalCacheReadTokens:v,assistantMessages:o,...c!==null?{lastEffort:c}:{},...e.compacted===!0?{compacted:!0}:{}}}function Yy(t){const e=Te(t);if(e===null)return null;const r=ie(e.fileName),l=ie(e.title),a=Ee(e.modifiedAt),y=Ee(e.sizeBytes);if(r===null||l===null||a===null||y===null)return null;const v=e.origin,o=Hy.find(m=>m===v)??"cli-plans",c=Oe(e.path)??"";return{fileName:r,title:l,origin:o,path:c,absolutePath:Oe(e.absolutePath)??"",exists:e.exists===!0,modifiedAt:a,sizeBytes:y}}function Xy(t){const e=Te(t);if(e===null)return null;const r=ie(e.fileName),l=Oe(e.text);return r===null||l===null?null:{fileName:r,text:l,truncated:e.truncated===!0}}const Wg=[{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 Qy(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 Jy(t,e=Wg){const r=Zy(t,e);if(r===null||t===null)return null;const l=t.includes("[1m]");return e.find(a=>a.family===r&&a.long===l)??null}function Zy(t,e=Wg){var l;return t===null||t.length===0?null:((l=e.filter(a=>a.family.length>0).sort((a,y)=>y.family.length-a.family.length).find(a=>t.includes(a.family)))==null?void 0:l.family)??null}function e0(t){return`/model ${t}`}const Gd="/effort";function t0(t,e=Gd){return`${e} ${t}`}const n0=["ask-for-approval","automatic","read-only","full-access"],r0=["written","blocked","failed"],s0=["unsupported","gone","review","busy","waiting","tool-pending","not-ready","failed"];function Sp(t){const e=Te(t);if(e===null)return null;const r=v=>{const o=Oe(v);return o!==null&&o.length<=128?o:null};if("profileId"in e||"approvalPolicy"in e||"reviewer"in e||"fileSystem"in e||"network"in e)return{profileId:r(e.profileId),approvalPolicy:r(e.approvalPolicy),reviewer:r(e.reviewer),fileSystem:r(e.fileSystem),network:r(e.network)};const l=Te(e.active_permission_profile),a=Te(e.permission_profile),y=Te(a==null?void 0:a.file_system);return{profileId:r(l==null?void 0:l.id),approvalPolicy:r(e.approval_policy),reviewer:r(e.approvals_reviewer),fileSystem:r(y==null?void 0:y.type),network:r(a==null?void 0:a.network)}}function i0(t){return typeof t=="string"&&n0.includes(t)}function pd(t){return t===null?null:t.profileId===":workspace"&&t.approvalPolicy==="on-request"&&t.reviewer==="user"?"ask-for-approval":t.profileId===":workspace"&&t.approvalPolicy==="on-request"&&t.reviewer==="auto_review"?"automatic":t.reviewer!=="user"?null:t.profileId===":read-only"&&t.approvalPolicy==="on-request"?"read-only":t.profileId===":danger-full-access"&&t.approvalPolicy==="never"?"full-access":null}const o0=["dir","file"],l0=["ignored","always"];function a0(t){return typeof t=="string"&&/^[0-9a-f]{64}$/.test(t)}function qg(t){const e=Te(t);if(e===null)return null;const r=ie(e.name),l=ie(e.path),a=Xe(e.kind,o0),y=Ee(e.sizeBytes),v=Ee(e.modifiedAt);if(r===null||l===null||a===null||y===null||v===null)return null;const o=Xe(e.hidden,l0),c={name:r,path:l,kind:a,sizeBytes:y,modifiedAt:v};return o===null?c:{...c,hidden:o}}function c0(t){const e=Te(t);if(e===null)return null;const r=Oe(e.query),l=Dt(e.entries,qg);return r===null||l===null?null:{query:r,entries:l,truncated:e.truncated===!0}}function u0(t){const e=Te(t);if(e===null)return null;const r=Oe(e.path),l=Dt(e.entries,qg),a=Ee(e.hiddenCount);return r===null||l===null||a===null?null:{path:r,entries:l,truncated:e.truncated===!0,hiddenCount:a}}function Ep(t){const e=Te(t);if(e===null)return null;const r=ie(e.path),l=Oe(e.text),a=Ee(e.sizeBytes),y=Ct(e.binary);if(r===null||l===null||a===null||y===null)return null;const v={path:r,language:Oe(e.language),text:l,sizeBytes:a,truncated:e.truncated===!0,binary:y},o=e.hash;return e.editable===!0&&a0(o)?{...v,editable:!0,hash:o}:v}function d0(t){const e=Te(t);if(e===null)return null;const r=ie(e.pickerId),l=ie(e.path),a=Dt(e.entries,v=>ie(v)),y=Dt(e.roots,v=>ie(v));return r===null||l===null||a===null||y===null?null:{pickerId:r,path:l,entries:a,roots:y,canGoUp:e.canGoUp===!0,truncated:e.truncated===!0}}const zg=1e6,h0=100,f0=999999;function Kg(t){return t.pasted.reduce((e,r)=>e+r.text.length,t.text.length)}function Ba(t){return t.text.trim().length===0&&t.pasted.every(e=>e.text.trim().length===0)}function Vg(t,e){return t.text!==e.text||t.pasted.length!==e.pasted.length?!1:t.pasted.every((r,l)=>{const a=e.pasted[l];return a!==void 0&&a.number===r.number&&a.text===r.text})}function p0(t){const e=Te(t);if(e===null)return null;const r=e.number,l=Oe(e.text);return typeof r!="number"||!Number.isInteger(r)||r<1||r>f0||l===null?null:{number:r,text:l}}function m0(t){const e=Te(t);if(e===null)return null;const r=Oe(e.text),l=Dt(e.pasted,p0);return r===null||l===null||l.length>h0||new Set(l.map(a=>a.number)).size!==l.length?null:{text:r,pasted:l}}const md=720*60*60*1e3,g0=["scheduled","waiting","sending","paused","failed"];function v0(t){const e=Te(t);if(e===null)return null;const r=ie(e.id),l=Xe(e.agent,jr),a=ie(e.sessionId),y=e.terminalId,v=y===null?null:ie(y),o=Oe(e.text),c=Ee(e.sendAt),m=Ee(e.createdAt),w=Xe(e.state,g0),d=e.note,k=d==null?null:br(d);return r===null||l===null||a===null||o===null||c===null||m===null||w===null||y!==null&&v===null||d!=null&&k===null?null:{id:r,agent:l,sessionId:a,terminalId:v,text:o,sendAt:c,createdAt:m,state:w,note:k}}const Fa="MEMORY.md",Yd=["AGENTS.md","CLAUDE.md"],Gg=["claude-code","codex","antigravity","opencode","pi"],_0=["outside","encoding"],w0=["create","append-block","replace-block","append-lines","copy"];function b0(t){return{instructionFiles:[...Yd],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 y0(t){const e=Te(t);if(e===null)return null;const r=Xe(e.name,Yd),l=Ct(e.exists),a=Ct(e.hasBlock),y=Ct(e.blockCurrent),v=Ct(e.brokenBlock),o=e.problem,c=o===null?null:Xe(o,_0);return r===null||l===null||a===null||y===null||v===null||o!==null&&c===null?null:{name:r,exists:l,hasBlock:a,blockCurrent:y,brokenBlock:v,problem:c}}function k0(t){const e=Te(t);if(e===null)return null;switch(e.kind){case"not-repo":return{kind:"not-repo"};case"error":{const r=br(e.message);return r===null?null:{kind:"error",message:r}}case"repo":{const r=Ct(e.ignored);if(r===null)return null;if(e.worktree===null)return{kind:"repo",ignored:r,worktree:null};const l=Te(e.worktree);if(l===null)return null;const a=ie(l.mainPath),y=Ct(l.mainHasMemory);return a===null||y===null?null:{kind:"repo",ignored:r,worktree:{mainPath:a,mainHasMemory:y}}}default:return null}}function C0(t){const e=Te(t);if(e===null)return null;const r=Xe(e.agent,Gg),l=ie(e.label),a=Ct(e.reaches),y=br(e.via);return r===null||l===null||a===null||y===null?null:{agent:r,label:l,reaches:a,via:y}}function x0(t){const e=Te(t);if(e===null)return null;const r=ie(e.name),l=Oe(e.title),a=Oe(e.description),y=Ee(e.sizeBytes),v=Ee(e.modifiedAt);return r===null||l===null||a===null||y===null||v===null?null:{name:r,title:l,description:a,sizeBytes:y,modifiedAt:v}}const S0=["line","command","json"];function E0(t){const e=Te(t);if(e===null)return null;const r=Xe(e.agent,Gg),l=ie(e.label),a=ie(e.target),y=Xe(e.kind,S0),v=ie(e.text),o=br(e.note);return r===null||l===null||a===null||y===null||v===null||o===null?null:{agent:r,label:l,target:a,kind:y,text:v,note:o}}function T0(t){const e=Te(t);if(e===null)return null;const r=ie(e.cwd),l=Ct(e.folderExists),a=Ct(e.indexExists),y=Ct(e.installed),v=Dt(e.notes,x0),o=Dt(e.files,y0),c=k0(e.git),m=Dt(e.reach,C0),w=Te(e.native),d=w===null?null:Ee(w.available),k=w===null?null:Ee(w.pending),L=Dt(e.globalFragments,E0);return r===null||l===null||a===null||y===null||v===null||o===null||c===null||m===null||d===null||k===null||L===null?null:{cwd:r,folderExists:l,indexExists:a,installed:y,notes:v,files:o,git:c,reach:m,native:{available:d,pending:k},globalFragments:L}}function Tp(t){const e=Te(t);if(e===null)return null;const r=ie(e.file),l=Xe(e.action,w0),a=Oe(e.preview),y=Oe(e.copiedFrom);return r===null||l===null||a===null?null:{file:r,action:l,preview:a,copiedFrom:y}}function L0(t){const e=Te(t);if(e===null)return null;const r=ie(e.name),l=Oe(e.text),a=Ct(e.truncated);return r===null||l===null||a===null?null:{name:r,text:l,truncated:a}}const Lp=20,Np=20,N0=/^[a-zA-Z0-9-]{1,64}$/;function R0(t){return N0.test(t)}function M0(t,e="Nota"){var l,a;const r=t.text.split(`
|
|
41
|
+
`).map(y=>y.trim()).find(y=>y.length>0);return r===void 0?((a=(l=t.files)==null?void 0:l[0])==null?void 0:a.name)??(t.images.length>0?"Imagen":e):r.length>40?`${r.slice(0,40)}…`:r}function A0(t){const e=Te(t);if(e===null)return null;const r=ie(e.imageId),l=ie(e.mediaType),a=Ee(e.bytes);return r===null||l===null||a===null?null:{imageId:r,mediaType:l,bytes:a}}function I0(t){const e=Te(t);if(e===null)return null;const r=ie(e.fileId),l=ie(e.name),a=Ee(e.bytes);return r===null||l===null||a===null||!R0(r)||a<0||!Number.isInteger(a)?null:{fileId:r,name:l,bytes:a}}function j0(t){const e=Te(t);if(e===null)return null;const r=ie(e.noteId),l=Oe(e.text),a=Dt(e.images,A0),y=e.files===void 0?[]:Dt(e.files,I0),v=Ee(e.createdAt),o=Ee(e.updatedAt);return r===null||l===null||a===null||y===null?null:{noteId:r,text:l,images:a,files:y,createdAt:v??0,updatedAt:o??0}}const ti={fiveHours:300,day:1440,week:10080,month:43200},D0=8,P0=/^[A-Za-z0-9][A-Za-z0-9_.:-]{0,63}$/;function O0(t){const e=Te(t);if(e===null)return null;const r=e.id;if(typeof r!="string"||!P0.test(r))return null;const l=Ee(e.usedPercent),a=Ee(e.observedAt);if(l===null||l<0||a===null||a<=0)return null;const y=e.minutes,v=y===null?null:Ee(y);if(y!==null&&(v===null||v<=0))return null;const o=e.resetsAt,c=o===null?null:Ee(o);return o!==null&&(c===null||c<=0)?null:{id:r,minutes:v,usedPercent:l,resetsAt:c,observedAt:a}}function B0(t){var e;return((e=Qt(t,O0))==null?void 0:e.slice(0,D0))??null}function F0(t){const e=Te(t);if(e===null)return null;const r=Xe(e.agent,jr),l=B0(e.windows);return r===null||l===null?null:{agent:r,windows:l}}function H0(t,e){return t.filter(r=>r.resetsAt===null||r.resetsAt>e)}const Yg=3,U0=3e4,$0=["results","time"];function Gi(t){return typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}function Qo(t,e){if(t==null)return null;const r=e(t);return r===null?void 0:r}function Xg(t){const e=Te(t);if(e===null)return null;const r=Xe(e.agent,Ya),l=ie(e.sessionId),a=Qo(e.cwd,Oe),y=Oe(e.title),v=Qo(e.eventId,ie),o=Qo(e.role,k=>Xe(k,Ug)),c=Qo(e.at,Ee),m=Oe(e.snippet),w=Gi(e.matchStart),d=Gi(e.matchLength);return r===null||l===null||a===void 0||y===null||v===void 0||o===void 0||c===void 0||m===null||w===null||d===null||w+d>m.length?null:{agent:r,sessionId:l,cwd:a,title:y,eventId:v,role:o,at:c,snippet:m,matchStart:w,matchLength:d}}function W0(t){const e=Te(t);if(e===null)return null;const r=Oe(e.query),l=Qt(e.hits,Xg),a=Gi(e.sessionsScanned),y=Gi(e.sessionsTotal),v=Qo(e.truncated,o=>Xe(o,$0));return r===null||l===null||a===null||y===null||a>y||v===void 0?null:{query:r,hits:l,sessionsScanned:a,sessionsTotal:y,truncated:v}}function q0(t){const e=Te(t);if(e===null)return null;const r=Oe(e.query),l=Qt(e.hits,Xg),a=Gi(e.sessionsScanned),y=Gi(e.sessionsTotal);return r===null||l===null||a===null||y===null||a>y?null:{query:r,hits:l,sessionsScanned:a,sessionsTotal:y}}const z0=["off","idle","measuring","writing","moving"];function Sn(t){return typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}function Wo(t,e){if(t==null)return null;const r=e(t);return r===null?void 0:r}function K0(t){const e=Te(t);if(e===null)return null;const r=Xe(e.agent,Ya),l=Sn(e.sessions),a=Sn(e.eventBytes),y=Sn(e.images),v=Sn(e.imageBytes),o=Sn(e.skippedArchived),c=Sn(e.skippedEmpty),m=Sn(e.unsupported),w=Sn(e.failed),d=bb(e.failureReasons);return r===null||l===null||a===null||y===null||v===null||o===null||c===null||m===null||w===null||d===null?null:{agent:r,sessions:l,eventBytes:a,images:y,imageBytes:v,skippedArchived:o,skippedEmpty:c,unsupported:m,failed:w,failureReasons:d}}function V0(t){const e=Te(t);if(e===null)return null;const r=Ee(e.measuredAt),l=Ee(e.durationMs),a=Qt(e.byAgent,K0),y=Sn(e.memoryProjects),v=Sn(e.memoryBytes);return r===null||l===null||a===null||y===null||v===null?null:{measuredAt:r,durationMs:l,byAgent:a,memoryProjects:y,memoryBytes:v}}function G0(t){const e=Te(t);if(e===null)return null;const r=Sn(e.done),l=Sn(e.total);return r===null||l===null?null:{done:r,total:l}}function Y0(t){const e=Te(t);if(e===null)return null;const r=Ct(e.enabled),l=Oe(e.dir),a=Ct(e.isDefaultDir),y=Xe(e.state,z0),v=Sn(e.sessions),o=Sn(e.passSessions),c=Sn(e.bytes),m=Sn(e.pending),w=Wo(e.progress,G0),d=Wo(e.lastPassAt,Ee),k=Wo(e.measurement,V0),L=Wo(e.previousDir,Oe),M=Wo(e.lastError,br);return r===null||l===null||a===null||y===null||v===null||o===null||c===null||m===null||w===void 0||d===void 0||k===void 0||L===void 0||M===void 0?null:{enabled:r,dir:l,isDefaultDir:a,state:y,progress:w,sessions:v,passSessions:o,bytes:c,lastPassAt:d,pending:m,measurement:k,previousDir:L,lastError:M}}const Qg=1024,Jg=65535,X0="pair",Q0=4001;function J0(t){return typeof t=="number"&&Number.isInteger(t)&&t>=Qg&&t<=Jg}const Z0=["off","active","restart-needed","port-busy"];function ek(t){const e=Te(t);if(e===null)return null;const r=ie(e.id),l=Oe(e.label),a=Ee(e.createdAt),y=Ct(e.connected);if(r===null||l===null||a===null||y===null)return null;const v=e.lastSeenAt,o=v==null?null:Ee(v);return v!=null&&o===null?null:{id:r,label:l,createdAt:a,lastSeenAt:o,connected:y}}function tk(t){const e=Te(t);if(e===null)return null;const r=Ct(e.enabled),l=Ee(e.port),a=Xe(e.state,Z0),y=Ee(e.listeningPort),v=Oe(e.sshUser),o=sn(e.hostNames),c=Ct(e.pairingActive),m=Dt(e.devices,ek);return r===null||l===null||a===null||y===null||v===null||o===null||c===null||m===null?null:{enabled:r,port:l,state:a,listeningPort:y,sshUser:v,hostNames:o,pairingActive:c,devices:m}}function nk(t){const e=Te(t);if(e===null)return null;const r=ie(e.code),l=Ee(e.expiresAt);return r===null||l===null?null:{code:r,expiresAt:l}}const rk=["powershell-admin","powershell","terminal"];function sk(t){const e=Te(t);if(e===null)return null;const r=ie(e.payload),l=ie(e.authorizeCommand),a=Xe(e.shell,rk),y=ie(e.code),v=Ee(e.expiresAt);return r===null||l===null||a===null||y===null||v===null?null:{payload:r,authorizeCommand:l,shell:a,code:y,expiresAt:v}}const ik=["auto","pwsh","powershell","cmd","git-bash","login","bash","sh","zsh"];function Zg(t){return Xe(t,ik)}function ok(t){const e=Te(t);if(e===null)return null;const r=Zg(e.id),l=ie(e.label);return r===null||r==="auto"||l===null?null:{id:r,label:l}}function Rp(t){return Array.isArray(t)?[...new Set(t.filter(e=>typeof e=="string"&&Qi(e)))]:null}function lk(t){const e=Te(t);if(e===null)return null;const r=Zg(e.consoleShell),l=Qt(e.consoleShells,ok),a=e.shellName,y=a===null?null:ie(a),v=Rp(e.disabledAgents),o=Rp(e.disabledAtStart);if(r===null||l===null||v===null||o===null||a!==null&&y===null)return null;const c=e.scheduledMessages===!0;return{consoleShell:r,consoleShells:l,shellName:y,disabledAgents:v,disabledAtStart:o,scheduledMessages:c}}const zi=8,ak="/ws",gd="token",ni=12*1024*1024,qo=8,Ki=10*1024*1024,ri=4,Mp=100,ck=512,uk=["saved","changed"],dk=["sending","prefilled"],hk=["no-delivery","not-ready","send-failed","returned-by-cli","stopped-early","rewound","requested","queue-edit","unscheduled"],fk=["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","location-failed","continue-failed","search-failed","remote-failed","settings-failed","rewind-failed","force-send-failed","queue-edit-failed","write-failed","worktree-failed","schedule-failed","remote-refused","agent-unsupported","internal"];function Ap(t){const e={model:null,effort:null,contextWindow:null};if(typeof t!="object"||t===null)return e;const r=t;return{model:ie(r.model),effort:ie(r.effort),contextWindow:Ee(r.contextWindow)}}function pk(t){const e=Te(t);if(e===null)return null;const r=ie(e.terminalId),l=m0(e.draft);return r===null||l===null?null:{terminalId:r,draft:l}}function Ip(t){return typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}function La(t,e){const r=ie(e.requestId);return r!==null&&(t.requestId=r),t}function jp(t){var e;return((e=Qt(t,Vy))==null?void 0:e.slice(0,$y))??null}function ju(t){var e;return((e=Qt(t,Gy))==null?void 0:e.slice(0,Wy))??null}function Dp(t){const e=Vd(t);return e!==null&&e.kind==="question"?e:null}function mk(t){const e=Te(gb(t));if(e===null)return null;switch(e.type){case"hello":{const r=Ee(e.protocolVersion),l=Oe(e.platform),a=Oe(e.defaultCwd);return r===null||l===null||a===null?null:{type:"hello",protocolVersion:r,agents:Qt(e.agents,_p)??[],defaultAgent:Xe(e.defaultAgent,jr),platform:l,defaultCwd:a,shellName:ie(e.shellName),remoteClient:e.remoteClient===!0,fileCheck:e.fileCheck===!0,fileWrite:e.fileWrite===!0}}case"agents":{const r=Qt(e.agents,_p);return r===null?null:{type:"agents",agents:r,defaultAgent:Xe(e.defaultAgent,jr)}}case"terminal.list":{const r=Qt(e.terminals,Mu),l=sn(e.order);return r===null||l===null?null:{type:"terminal.list",terminals:r,order:l}}case"terminal.opened":{const r=ie(e.requestId),l=Mu(e.terminal);return r===null||l===null?null:{type:"terminal.opened",requestId:r,terminal:l}}case"terminal.output":{const r=ie(e.terminalId),l=Oe(e.data);return r===null||l===null?null:{type:"terminal.output",terminalId:r,data:l}}case"terminal.replay":{const r=ie(e.terminalId),l=Oe(e.data);return r===null||l===null?null:{type:"terminal.replay",terminalId:r,data:l,truncated:e.truncated===!0}}case"terminal.exit":{const r=ie(e.terminalId),l=Ee(e.exitCode);if(r===null||l===null)return null;const a=e.signal;return{type:"terminal.exit",terminalId:r,exitCode:l,signal:typeof a=="number"?a:null}}case"terminal.closed":{const r=ie(e.terminalId);return r===null?null:{type:"terminal.closed",terminalId:r}}case"terminal.activity":{const r=ie(e.terminalId),l=Xe(e.activity,Ry);if(r===null||l===null)return null;const a=l==="offline"?Xe(e.offlineReason,My):null;return a===null?{type:"terminal.activity",terminalId:r,activity:l}:{type:"terminal.activity",terminalId:r,activity:l,offlineReason:a}}case"index.status":{const r=Py(e.status);return r===null?null:{type:"index.status",status:r}}case"index.projects":{const r=Qt(e.projects,Dy);return r===null?null:{type:"index.projects",projects:r,replace:e.replace===!0}}case"conversation.reset":{const r=ie(e.terminalId),l=Oe(e.sessionId),a=Xe(e.state,Cp),y=Qt(e.events,Iu),v=xp(e.usage);return r===null||l===null||a===null||y===null||v===null?null:{type:"conversation.reset",terminalId:r,sessionId:l,state:a,events:y,hasMore:e.hasMore===!0,usage:v,permissionMode:si(e.permissionMode)?e.permissionMode:null,codexPermissions:e.codexPermissions===null||e.codexPermissions===void 0?null:Sp(e.codexPermissions),defaults:Ap(e.defaults),waitingFor:ie(e.waitingFor),openToolCall:e.openToolCall===!0,subagents:jp(e.subagents)??[],queue:ju(e.queue)??[],liveQuestion:Dp(e.liveQuestion)}}case"conversation.liveQuestion":{const r=ie(e.terminalId),l=e.question===null?null:Dp(e.question);return r===null||e.question!==null&&l===null?null:{type:"conversation.liveQuestion",terminalId:r,question:l}}case"conversation.subagents":{const r=ie(e.terminalId),l=jp(e.subagents);return r===null||l===null?null:{type:"conversation.subagents",terminalId:r,subagents:l}}case"conversation.queue":{const r=ie(e.terminalId),l=ju(e.queue);return r===null||l===null?null:{type:"conversation.queue",terminalId:r,queue:l}}case"agent.forceSent":{const r=ie(e.terminalId),l=ie(e.requestId),a=Ct(e.sent);return r===null||l===null||a===null?null:{type:"agent.forceSent",terminalId:r,requestId:l,sent:a}}case"agent.queueEdited":{const r=ie(e.terminalId),l=ie(e.requestId),a=Ct(e.edited);return r===null||l===null||a===null?null:{type:"agent.queueEdited",terminalId:r,requestId:l,edited:a}}case"agent.submitted":{const r=ie(e.terminalId),l=ie(e.requestId),a=Ct(e.delivered);return r===null||l===null||a===null?null:{type:"agent.submitted",terminalId:r,requestId:l,delivered:a}}case"agent.voice.status":{const r=ie(e.terminalId),l=e.mode,a=Ct(e.active);return r===null||l!=="dictation"&&l!=="live"||a===null?null:e.transcribing===!0?{type:"agent.voice.status",terminalId:r,mode:l,active:a,transcribing:!0}:{type:"agent.voice.status",terminalId:r,mode:l,active:a}}case"agent.voice.text":{const r=ie(e.terminalId),l=e.mode,a=e.outcome,y=Oe(e.text);return r===null||l!=="dictation"&&l!=="live"||a!=="text"&&a!=="empty"&&a!=="kept"||y===null?null:{type:"agent.voice.text",terminalId:r,mode:l,outcome:a,text:y}}case"agent.codexQueueResult":{const r=ie(e.terminalId),l=Oe(e.sessionId),a=ie(e.requestId),y=Xe(e.result,["queued","failed","unavailable","not-busy"]);return r===null||l===null||a===null||y===null?null:{type:"agent.codexQueueResult",terminalId:r,sessionId:l,requestId:a,result:y}}case"agent.codexPermissions.result":{const r=ie(e.terminalId),l=ie(e.requestId),a=i0(e.preset)?e.preset:null,y=Xe(e.status,r0),v=e.reason===void 0?null:Xe(e.reason,s0);return r===null||l===null||a===null||y===null||e.reason!==void 0&&v===null?null:{type:"agent.codexPermissions.result",terminalId:r,requestId:l,preset:a,status:y,...v===null?{}:{reason:v}}}case"agent.rewound":{const r=ie(e.terminalId),l=ie(e.requestId),a=Ct(e.codeRestored);return r===null||l===null||a===null?null:{type:"agent.rewound",terminalId:r,requestId:l,codeRestored:a}}case"conversation.append":{const r=ie(e.terminalId),l=Qt(e.events,Iu),a=xp(e.usage);if(r===null||l===null||a===null)return null;const y={type:"conversation.append",terminalId:r,events:l,usage:a,permissionMode:si(e.permissionMode)?e.permissionMode:null},v=ju(e.queue);return v!==null&&(y.queue=v),y}case"conversation.mode":{const r=ie(e.terminalId),l=e.mode;return r===null||!si(l)?null:{type:"conversation.mode",terminalId:r,mode:l}}case"conversation.codexPermissions":{const r=ie(e.terminalId),l=e.state===null?null:Sp(e.state);return r===null||e.state!==null&&l===null?null:{type:"conversation.codexPermissions",terminalId:r,state:l}}case"conversation.waiting":{const r=ie(e.terminalId);return r===null?null:{type:"conversation.waiting",terminalId:r,waitingFor:ie(e.waitingFor)}}case"conversation.toolCall":{const r=ie(e.terminalId),l=Ct(e.open);return r===null||l===null?null:{type:"conversation.toolCall",terminalId:r,open:l}}case"conversation.page":{const r=ie(e.terminalId),l=Qt(e.events,Iu);return r===null||l===null?null:{type:"conversation.page",terminalId:r,events:l,hasMore:e.hasMore===!0}}case"conversation.turns":{const r=ie(e.terminalId),l=Dt(e.turns,a=>{const y=Te(a);if(y===null)return null;const v=ie(y.eventId),o=Ee(y.durationMs);return v===null||o===null?null:{eventId:v,durationMs:o}});return r===null||l===null?null:{type:"conversation.turns",terminalId:r,turns:l}}case"conversation.parts":{const r=ie(e.terminalId),l=Dt(e.updates,a=>{const y=Te(a);if(y===null)return null;const v=ie(y.eventId),o=Dt(y.parts,Vd);return v===null||o===null?null:{eventId:v,parts:o}});return r===null||l===null?null:{type:"conversation.parts",terminalId:r,updates:l}}case"conversation.imageData":{const r=ie(e.terminalId),l=ie(e.eventId),a=Ee(e.index),y=Oe(e.mediaType);if(r===null||l===null||a===null||y===null)return null;const v=e.data;return{type:"conversation.imageData",terminalId:r,eventId:l,index:a,source:Xe(e.source,$g)??"content",mediaType:y,data:typeof v=="string"?v:null}}case"conversation.state":{const r=ie(e.terminalId),l=Xe(e.state,Cp);return r===null||l===null?null:{type:"conversation.state",terminalId:r,state:l}}case"git.status":{const r=ie(e.terminalId),l=Ub(e.status);return r===null||l===null?null:{type:"git.status",terminalId:r,status:l}}case"git.diff":{const r=ie(e.terminalId),l=wp(e.diff);return r===null||l===null?null:{type:"git.diff",terminalId:r,diff:l}}case"files.listing":{const r=ie(e.terminalId),l=u0(e.listing);return r===null||l===null?null:{type:"files.listing",terminalId:r,listing:l}}case"picker.listing":{const r=d0(e.listing);return r===null?null:{type:"picker.listing",listing:r}}case"files.preview":{const r=ie(e.terminalId),l=Ep(e.preview);return r===null||l===null?null:{type:"files.preview",terminalId:r,preview:l}}case"files.checked":{const r=ie(e.terminalId),l=ie(e.requestId),a=sn(e.existing),y=sn(e.directories)??[];return r===null||l===null||a===null?null:{type:"files.checked",terminalId:r,requestId:l,existing:a,directories:y}}case"files.saved":{const r=ie(e.terminalId),l=ie(e.requestId),a=ie(e.path),y=Xe(e.outcome,uk),v=e.preview===null?null:Ep(e.preview);return r===null||l===null||a===null||y===null||v===null&&(y==="saved"||e.preview!==null)?null:{type:"files.saved",terminalId:r,requestId:l,path:a,outcome:y,preview:v}}case"conversation.plans":{const r=ie(e.terminalId),l=Dt(e.plans,Yy);return r===null||l===null?null:{type:"conversation.plans",terminalId:r,plans:l}}case"conversation.defaults":{const r=ie(e.terminalId);return r===null?null:{type:"conversation.defaults",terminalId:r,defaults:Ap(e.defaults)}}case"plans.content":{const r=ie(e.terminalId),l=Xy(e.plan);return r===null||l===null?null:{type:"plans.content",terminalId:r,plan:l}}case"files.results":{const r=ie(e.terminalId),l=c0(e.result);return r===null||l===null?null:{type:"files.results",terminalId:r,result:l}}case"notes.list":{const r=Dt(e.notes,j0);return r===null?null:{type:"notes.list",notes:r}}case"notes.fileData":{const r=ie(e.fileId),l=Oe(e.name),a=e.data;return r===null||l===null||a!==null&&typeof a!="string"?null:{type:"notes.fileData",fileId:r,name:l,data:a}}case"notes.imageData":{const r=ie(e.imageId),l=Oe(e.mediaType);if(r===null||l===null)return null;const a=e.data;return{type:"notes.imageData",imageId:r,mediaType:l,data:typeof a=="string"?a:null}}case"memory.status":{const r=ie(e.terminalId),l=T0(e.status);return r===null||l===null?null:{type:"memory.status",terminalId:r,status:l}}case"memory.planned":{const r=ie(e.terminalId),l=Dt(e.changes,Tp);return r===null||l===null?null:La({type:"memory.planned",terminalId:r,changes:l},e)}case"memory.installed":{const r=ie(e.terminalId),l=Dt(e.applied,Tp);return r===null||l===null?null:La({type:"memory.installed",terminalId:r,applied:l},e)}case"memory.imported":{const r=ie(e.terminalId),l=sn(e.copied),a=sn(e.skipped);return r===null||l===null||a===null?null:La({type:"memory.imported",terminalId:r,copied:l,skipped:a},e)}case"memory.content":{const r=ie(e.terminalId),l=L0(e.note);return r===null||l===null?null:La({type:"memory.content",terminalId:r,note:l},e)}case"vault.status":{const r=Y0(e.status);return r===null?null:{type:"vault.status",status:r}}case"vault.exported":{const r=ie(e.projectKey),l=Ee(e.sessions);return r===null||l===null?null:{type:"vault.exported",projectKey:r,sessions:l}}case"location.previewed":{const r=ie(e.requestId),l=jy(e.preview);return r===null||l===null?null:{type:"location.previewed",requestId:r,preview:l}}case"location.applied":{const r=ie(e.requestId);return r===null?null:{type:"location.applied",requestId:r}}case"location.removed":{const r=ie(e.requestId);return r===null?null:{type:"location.removed",requestId:r}}case"session.continued":{const r=ie(e.requestId),l=ie(e.terminalId),a=Te(e.source),y=Xe(a==null?void 0:a.agent,Ya),v=ie(a==null?void 0:a.sessionId),o=Oe(a==null?void 0:a.title),c=Ip(e.includedTurns),m=Ip(e.totalTurns),w=Xe(e.delivery,dk);return r===null||l===null||y===null||v===null||o===null||c===null||m===null||c>m||w===null?null:{type:"session.continued",requestId:r,terminalId:l,source:{agent:y,sessionId:v,title:o},includedTurns:c,totalTurns:m,totalTurnsIsMinimum:e.totalTurnsIsMinimum===!0,delivery:w}}case"composer.prefill":{const r=ie(e.terminalId),l=ie(e.text),a=Xe(e.reason,hk);if(r===null||l===null||a===null)return null;const y={type:"composer.prefill",terminalId:r,text:l,reason:a};if(e.pasted!==void 0){const o=sn(e.pasted);if(o===null)return null;o.length>0&&(y.pasted=o)}const v=ie(e.requestId);return v!==null&&(y.requestId=v),y}case"composer.drafts":{const r=Qt(e.drafts,pk);return r===null?null:{type:"composer.drafts",drafts:r}}case"composer.suggestion":{const r=ie(e.terminalId);if(r===null)return null;if(e.text===null)return{type:"composer.suggestion",terminalId:r,text:null};const l=ie(e.text);return l===null?null:{type:"composer.suggestion",terminalId:r,text:l}}case"search.progress":{const r=ie(e.searchId),l=q0(e.progress);return r===null||l===null?null:{type:"search.progress",searchId:r,progress:l}}case"remote.status":{const r=tk(e.status);return r===null?null:{type:"remote.status",status:r}}case"settings.status":{const r=lk(e.settings);return r===null?null:{type:"settings.status",settings:r}}case"schedule.list":{const r=Qt(e.messages,v0);return r===null?null:{type:"schedule.list",messages:r}}case"schedule.created":{const r=ie(e.requestId),l=ie(e.id);return r===null||l===null?null:{type:"schedule.created",requestId:r,id:l}}case"plan.limits":{const r=Qt(e.limits,F0);return r===null?null:{type:"plan.limits",limits:r}}case"remote.pairing.code":{const r=nk(e.pairing);return r===null?null:{type:"remote.pairing.code",pairing:r}}case"remote.phone.pairing":{const r=sk(e.pairing);return r===null?null:{type:"remote.phone.pairing",pairing:r}}case"search.results":{const r=ie(e.searchId),l=W0(e.result);return r===null||l===null?null:{type:"search.results",searchId:r,result:l}}case"worktree.inspected":{const r=ie(e.requestId),l=cy(e.inspection);return r===null||l===null?null:{type:"worktree.inspected",requestId:r,inspection:l}}case"worktree.moved":{const r=ie(e.requestId),l=Mu(e.terminal);return r===null||l===null?null:{type:"worktree.moved",requestId:r,terminal:l}}case"worktree.rows":{const r=ie(e.terminalId),l=Qt(e.rows,uy);if(r===null||l===null)return null;const a=Qt(e.kept,by);return a===null?{type:"worktree.rows",terminalId:r,rows:l}:{type:"worktree.rows",terminalId:r,rows:l,kept:a}}case"worktree.removePlan":{const r=ie(e.requestId),l=xy(e.plan);return r===null||l===null?null:{type:"worktree.removePlan",requestId:r,plan:l}}case"worktree.removed":{const r=ie(e.requestId),l=ie(e.worktreeId),a=Sy(e.outcome);return r===null||l===null||a===null?null:{type:"worktree.removed",requestId:r,worktreeId:l,outcome:a}}case"worktree.changed":return{type:"worktree.changed"};case"worktree.branchChanges":{const r=ie(e.requestId),l=my(e.changes);return r===null||l===null?null:{type:"worktree.branchChanges",requestId:r,changes:l}}case"worktree.branchDiff":{const r=ie(e.requestId),l=ie(e.worktreeId),a=wp(e.diff);return r===null||l===null||a===null?null:{type:"worktree.branchDiff",requestId:r,worktreeId:l,diff:a}}case"worktree.reviewPlan":{const r=ie(e.requestId),l=gy(e.plan);return r===null||l===null?null:{type:"worktree.reviewPlan",requestId:r,plan:l}}case"worktree.integratePlan":{const r=ie(e.requestId),l=vy(e.plan);return r===null||l===null?null:{type:"worktree.integratePlan",requestId:r,plan:l}}case"worktree.integrated":{const r=ie(e.requestId),l=ie(e.worktreeId),a=wy(e.outcome);return r===null||l===null||a===null?null:{type:"worktree.integrated",requestId:r,worktreeId:l,outcome:a}}case"worktree.deleteBranchPlan":{const r=ie(e.requestId),l=yy(e.plan);return r===null||l===null?null:{type:"worktree.deleteBranchPlan",requestId:r,plan:l}}case"worktree.branchDeleted":{const r=ie(e.requestId),l=ie(e.worktreeId),a=ie(e.branch);return r===null||l===null||a===null?null:{type:"worktree.branchDeleted",requestId:r,worktreeId:l,branch:a}}case"error":{const r=br(e.text);if(r===null)return null;const a={type:"error",code:Xe(e.code,fk)??"internal",text:r},y=Oe(e.detail);y!==null&&(a.detail=y);const v=ie(e.requestId);return v!==null&&(a.requestId=v),a}default:return null}}function Pp(t){return JSON.stringify(t)}const gk=/^[A-Za-z]:\\$/;function Dr(t,e){return t.length===0?"":e==="win32"?vk(t):wk(t)}function vk(t){return _k(t).toLowerCase()}function _k(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("\\")&&!gk.test(e);)e=e.slice(0,-1);return e}function ev(t,e,r){return t.length===0||r==="win32"&&t!==e&&t.toLowerCase()===e.toLowerCase()?e:t}function wk(t){let e=t.replace(/\/+/g,"/");for(;e.length>1&&e.endsWith("/");)e=e.slice(0,-1);return e}function vd(t){var e;return((e=t.worktree)==null?void 0:e.mainCwd)??t.cwd}function bk(t,e,r,l){if(r.kind!=="agent")return t.length;const a=Dr(vd(r),l);let y=-1;for(const[v,o]of t.entries()){const c=e(o);c===void 0||c.kind!=="agent"||Dr(vd(c),l)===a&&(y=v)}return y===-1?t.length:y+1}function Xd(t){return`[Pasted text #${t}]`}function yk(t){return`[Start of pasted text #${t}]`}function kk(t){return`[End of pasted text #${t}]`}function Ck(){return/(^|\n)\[Start of pasted text #(\d{1,6})\]\n([\s\S]*?)\n\[End of pasted text #\2\](?=\n|$)/g}function xk(){return/(^|\n)\[Start of pasted text #(\d{1,6})\]\n/}function Sk(){return/\[Pasted text #(\d{1,6})\]/g}const tv="https://buymeacoffee.com/cvelasquez",Ek="modulepreload",Tk=function(t){return"/"+t},Op={},Ir=function(e,r,l){let a=Promise.resolve();if(r&&r.length>0){let v=function(m){return Promise.all(m.map(w=>Promise.resolve(w).then(d=>({status:"fulfilled",value:d}),d=>({status:"rejected",reason:d}))))};document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),c=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));a=v(r.map(m=>{if(m=Tk(m),m in Op)return;Op[m]=!0;const w=m.endsWith(".css"),d=w?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${d}`))return;const k=document.createElement("link");if(k.rel=w?"stylesheet":Ek,w||(k.as="script"),k.crossOrigin="",k.href=m,c&&k.setAttribute("nonce",c),document.head.appendChild(k),w)return new Promise((L,M)=>{k.addEventListener("load",L),k.addEventListener("error",()=>M(new Error(`Unable to preload CSS for ${m}`)))})}))}function y(v){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=v,window.dispatchEvent(o),!o.defaultPrevented)throw v}return a.then(v=>{for(const o of v||[])o.status==="rejected"&&y(o.reason);return e().catch(y)})},Lk={"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.titleCopy":"Continue this conversation in a new session","agent.continue.titleMain":"Continue this conversation in the main folder","agent.continue.titleMoved":"Continue this conversation in the project's new 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 continuation is in the message box. You can add instructions and choose the model before sending it.","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.location.confirm":"Choose this folder","app.picker.location.confirmTitle":"Point the project to {{path}}. You will see what changes before anything is saved","app.picker.location.title":"Where is this project now?","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.codexQueue.failed":"Codex did not confirm the queue. Check the session before retrying to avoid duplicates.","composer.codexQueue.label":"Queue in Codex","composer.codexQueue.notBusy":"The session is no longer working. The text was returned to the message box.","composer.codexQueue.pending":"Adding to Codex queue…","composer.codexQueue.queued":"Text added to Codex's queue.","composer.codexQueue.textOnly":"Codex's native queue accepts text only, without images or files.","composer.codexQueue.tooLong":"The message exceeds the {{max}} character limit for Codex's queue.","composer.codexQueue.unavailable":"Codex's queue isn't available for this session.","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)","composer.suggestion.key":"Tab","composer.suggestion.keyTitle":"The CLI's suggestion: Tab writes it in the box, to send it or change it","composer.suggestion.use":"Use the CLI's suggestion","composer.voice.blocked":"Resolve the open prompt in the CLI before dictating.","composer.voice.dictate":"Dictate by voice","composer.voice.hold":"Hold to dictate. Holding Space works too.","composer.voice.kept":"The dictation stayed in the CLI's box: it couldn't be moved here.","composer.voice.live":"Start live voice chat. Holding Space works too.","composer.voice.noSpeech":"No speech was detected.","composer.voice.stop":"Stop voice input","composer.voice.transcribing":"Transcribing the dictation…","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.locateFirst":"Locate the project's folder first to continue here","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":"Provisional effort: {{effort}}. The session has not 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":"Provisional model: {{model}}. The session has not confirmed it yet","controls.model.select":"Select","controls.permission.askForApproval":"Ask for approval","controls.permission.askForApprovalHint":"Ask before accessing the internet or editing outside the workspace.","controls.permission.automatic":"Approve for me","controls.permission.automaticHint":"Codex reviews approval requests and asks about potentially unsafe actions.","controls.permission.awaiting":"Request sent. If Codex asks for confirmation, answer in its tab.","controls.permission.custom":"Custom","controls.permission.error.busy":"Wait for the Codex turn to finish.","controls.permission.error.failed":"The permission change could not be sent.","controls.permission.error.gone":"The Codex tab has closed.","controls.permission.error.notReady":"The Codex composer must be empty and ready.","controls.permission.error.review":"Permissions cannot be expanded in a read-only review tab.","controls.permission.error.toolPending":"A Codex tool is still pending. Check its tab.","controls.permission.error.unsupported":"This Codex version does not support changing permissions from the app.","controls.permission.error.waiting":"Answer the pending confirmation in the Codex tab first.","controls.permission.fullAccess":"Full access","controls.permission.fullAccessHint":"Full access. Codex may ask you to confirm the expansion in its tab.","controls.permission.label":"Permissions","controls.permission.pending":"Sending permission change …","controls.permission.readOnly":"Read only","controls.permission.readOnlyHint":"Read-only access. File changes require approval.","controls.permission.unconfirmed":"Codex has not confirmed the change yet. The last observed state is kept.","controls.permission.unknown":"Unconfirmed","controls.permission.unknownHint":"Codex has not published the effective permissions for this conversation 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.updating":"Updating…","git.upstreamTitle":"Upstream branch: {{upstream}}","git.waitingTitle":"Wait for the repository's current state: this is what it showed last time.","git.worktrees.detached":"detached","header.locale.auto":"Automatic (browser: {{name}})","header.locale.title":"Language: {{name}}","header.locale.titleAuto":"Language: {{name}} (automatic, from the browser)","locate.dialog.another":"Choose another folder…","locate.dialog.inDestination":"Conversations the new folder already has","locate.dialog.inDestinationHint":"They will appear together with the ones that move, in a single project.","locate.dialog.inSubfolders":"of those, in subfolders","locate.dialog.keeps":"Nothing is copied or deleted: the conversations stay where they are, and only the project's folder changes in this app.","locate.dialog.moving":"Conversations that move","locate.dialog.now":"Now in","locate.dialog.pending":"of those, with queued or scheduled messages","locate.dialog.pendingHint":"Closing a tab drops what it had queued or scheduled.","locate.dialog.saving":"Saving…","locate.dialog.tabs":"Tabs open in the previous folder","locate.dialog.tabsHint":"Close them first. Nothing is redirected to another folder on its own.","locate.dialog.title":"Locate project","locate.dialog.use":"Use this folder","locate.dialog.useBlocked":"Close the tabs of the previous folder first","locate.dialog.waiting":"Checking the folder…","locate.dialog.was":"Was in","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.ctrl":"Ctrl+{{letter}}","narrow.keys.ctrlO":"Ctrl+O (in Claude Code, expands what is shown cut short)","narrow.keys.ctrlT":"Ctrl+T (in Codex, shows the transcript)","narrow.keys.ctrlX":"Ctrl+X","narrow.keys.delete":"Delete","narrow.keys.down":"Down arrow","narrow.keys.end":"End","narrow.keys.enter":"Enter (confirms the highlighted option)","narrow.keys.esc":"Escape","narrow.keys.home":"Home","narrow.keys.interrupt":"Ctrl+C: interrupt","narrow.keys.label":"Terminal keys","narrow.keys.left":"Left arrow","narrow.keys.number":"Key {{number}} (picks option {{number}} in a menu)","narrow.keys.pageDown":"Page Down","narrow.keys.pageUp":"Page Up","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 files","notes.closeConfirm":"Closing this note deletes it, along with its attachments.","notes.closeNote":"Close the note. It is deleted, along with its attachments","notes.collapse":"Collapse. Notes aren't lost: the × on each tab is what closes them","notes.downloadFile":"Download file","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.fileOnly":"File","notes.fileUnavailable":"The file is unavailable. The note was kept.","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.loadingFiles":"Loading files…","notes.name":"Notes","notes.new":"New note","notes.placeholder":"Jot down an idea. Files can be pasted or dragged here.","notes.readFailed":"Couldn't read the image.","notes.removeFile":"Remove file","notes.removeImage":"Remove the image","notes.resize":"Drag to change the height","notes.thumbMissing":"missing","notes.toComposer":"To message box","notes.toComposer.loading":"Loading the note's images…","notes.toComposer.needsTab":"Open a tab first: the note goes to its message box","notes.toComposer.title":"Put the note in the message box of “{{tab}}”, to add to it and send it to that conversation","notes.tooManyFiles":"Up to {{max}} files per note.","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","scheduled.close.confirm":"Close anyway","scheduled.close.keep":"Don't close","scheduled.close.title":"Close the tab","scheduled.close.warning_one":"This tab has a message scheduled for {{when}}. If you close it, it won't be sent.","scheduled.close.warning_other":"This tab has {{count}} scheduled messages, the first one for {{when}}. If you close it, none of them will be sent.","scheduled.composer.empty":"Write the message you want to schedule","scheduled.composer.label":"Schedule","scheduled.composer.onlyText":"A scheduled message can only be text: remove the images and files","scheduled.composer.title":"Schedule the message","scheduled.menu.day":"Day","scheduled.menu.inHour":"In an hour","scheduled.menu.invalid":"Pick a day and a time","scheduled.menu.past":"That time has already passed","scheduled.menu.schedule":"Schedule","scheduled.menu.time":"Time","scheduled.menu.title":"Schedule the message","scheduled.menu.tomorrow":"Tomorrow at 9 AM","scheduled.menu.tooFar":"You can schedule up to {{days}} days ahead","scheduled.state.due":"it's time: about to send it","scheduled.state.failed":"Not sent","scheduled.state.paused":"paused: scheduled messages are off in Settings ({{when}})","scheduled.state.scheduled":"scheduled for {{when}}","scheduled.state.sending":"sending…","scheduled.tab.failed_one":"A scheduled message wasn't sent","scheduled.tab.failed_other":"{{count}} scheduled messages weren't sent","scheduled.tab.next_one":"Scheduled message: {{when}}","scheduled.tab.next_other":"{{count}} scheduled messages, the next one {{when}}","scheduled.thread.cancel":"Cancel sending","scheduled.thread.cancelTitle":"Takes it off the schedule and puts the text back in the message box","scheduled.thread.sendNow":"Send now","scheduled.thread.sendNowTitle":"Sends it right away. If the agent is working, it waits for it to finish","scheduled.when.ahead":"{{when}} (in {{left}})","scheduled.worktree.cancels_one":"One of its tabs has a scheduled message: removing the branch cancels it.","scheduled.worktree.cancels_other":"Its tabs have {{count}} scheduled messages: removing the branch cancels them.","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.locationDestinationInvalid":"That isn't a folder that exists: {{path}}","server.locationDestinationProtected":"That folder belongs to a CLI and can't be used as the project's folder.","server.locationFolderInvalid":"The folder isn't valid.","server.locationNoFolder":"This project doesn't have a folder: its conversations don't say where they ran.","server.locationNotMoved":"This project doesn't have a saved location.","server.locationNothingToMove":"This project's folder exists, so there is nothing to locate.","server.locationOriginExists":"The previous folder exists again ({{path}}). A project is located when its folder is gone.","server.locationPendingMessages":"{{count}} of the tabs open in the previous folder have queued or scheduled messages. Resolve them and close those tabs first.","server.locationPreviewGone":"That preview is no longer valid. Choose the folder again.","server.locationProjectGone":"That project is no longer in the sidebar.","server.locationSameFolder":"The project already points to that folder.","server.locationSaveFailed":"The location couldn't be saved: {{detail}}","server.locationTabsOpen":"Tabs open in the previous folder: {{count}}. Close them first.","server.locationsOtherVersion":"The saved locations file is from another version of the app, so it wasn't changed.","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.noteCliDraft":"The note wasn't sent: {{label}} has something typed in its own box that couldn't be set aside, and it would have been sent together with the note. Check the CLI tab.","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.noteFilesMax":"Up to {{max}} files per note.","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.scheduleEmpty":"There's nothing to schedule.","server.scheduleGone":"That scheduled message isn't there anymore: it was sent or canceled.","server.scheduleNoConversation":"This tab has no conversation yet: send a first message before scheduling one.","server.scheduleOff":"Scheduled messages are off in Settings.","server.schedulePast":"That time has already passed: pick a later one.","server.scheduleSaveFailed":"The scheduled message couldn't be saved.","server.scheduleSending":"That message is already being sent.","server.scheduleTooFar":"You can schedule up to {{days}} days ahead.","server.scheduleTooLong":"The message is too long to schedule: the limit is {{max}} characters.","server.scheduleTooMany":"There are already {{max}} scheduled messages: send or cancel one first.","server.scheduleUnsupported":"{{label}} doesn't take scheduled messages yet.","server.scheduledCliDraft":"Not sent: the CLI had something typed in its own box that couldn't be set aside.","server.scheduledCliNotReady":"Not sent: the CLI didn't get ready to receive it.","server.scheduledCliOpenFailed":"Not sent: the CLI couldn't be opened.","server.scheduledElsewhereTimeout":"Not sent: the conversation stayed open in another program.","server.scheduledMissed":"Not sent: the app wasn't open at that time.","server.scheduledNoTab":"Not sent: no tab had this conversation.","server.scheduledUncertain":"Unknown whether it arrived: the app closed while sending it. Check the conversation.","server.scheduledUncertainWrite":"Unknown whether it arrived: it was cut off while being written. Check the conversation.","server.scheduledUnconfirmed":"Unknown whether it arrived: it didn't show up in the conversation. Check the CLI tab.","server.scheduledWaitAnswer":"It's time: waiting for you to answer what the CLI is asking.","server.scheduledWaitBusy":"It's time: waiting for the agent to finish.","server.scheduledWaitElsewhere":"It's time, but the conversation is open in another program: waiting for it to close.","server.scheduledWaitGrace":"It's time: waiting a minute in case another Agent Workbench open on this computer sends it.","server.scheduledWaitNoTab":"It's time, but no tab has this conversation.","server.scheduledWaitOtherInstance":"Another Agent Workbench open on this computer is sending it.","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.submitCliDraft":"Not sent: {{label}} has something typed in its own box that couldn't be set aside, and it would have been sent together with your message. Check the CLI tab: your message is back in the message box.","server.submitCliDraftCommand":"Not changed: {{label}} has something typed in its own box that couldn't be set aside, and it would have been sent together with the command. Check the CLI tab.","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.submitStartupPending":"{{label}} is still starting. Some content may remain in the CLI tab; check it before sending again.","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.submitUnknownActivity":"Cannot determine the state of {{label}}. Check the CLI tab before sending again.","server.tabClosedWhileOpening":"The tab closed while it was opening.","server.tabDirGone":"The tab's directory no longer exists.","server.tabOpenFailed":"The tab couldn't be opened.","server.terminalAsleep":"This tab doesn't have its CLI open. Open it to write to the agent.","server.terminalGone":"The terminal no longer exists.","server.terminalOpenFailed":"The terminal couldn't be opened.","server.tooManyTabs":"You can't open more than {{max}} tabs at once.","server.vaultBusyMeasuring":"The backup is busy measuring. Try again when it's done.","server.vaultBusyMoving":"The backup is busy moving to another folder. Try again when it's done.","server.vaultBusyWriting":"The backup is busy copying. Try again when it's done.","server.vaultCannotWrite":"That folder can't be written to.","server.vaultCurrentInsideTarget":"The current backup can't end up inside the new folder.","server.vaultDiskFull":"Disk full: the pass stopped ({{detail}})","server.vaultFailed":"The backup operation couldn't be completed.","server.vaultIndexNotReady":"The history is still being read. Measure when it's done.","server.vaultMeasureFirst":"First measure how much it would take.","server.vaultMemoryFailed":"memory of {{cwd}}: {{detail}}","server.vaultMoveFailed":"The backup couldn't be moved: {{detail}}","server.vaultMoving":"The backup is moving to another folder. Try again when it's done.","server.vaultNoCopyYet":"There's no backup yet.","server.vaultNotLoaded":"The backup isn't loaded.","server.vaultProjectGone":"That project is no longer in the sidebar.","server.vaultReasonNewerFormat":"the existing copy is in a newer format","server.vaultReasonOriginMissing":"the source wasn't found","server.vaultReasonUnsafeId":"a session id that can't be copied","server.vaultSessionFailed":"{{agent}}/{{session}}: {{detail}}","server.vaultSessionMissing":"That session isn't in the backup.","server.vaultTargetCliFolder":"That folder belongs to a CLI: the backup isn't kept there.","server.vaultTargetInsideCurrent":"The new folder can't be inside the current backup.","server.vaultTargetNotAbsolute":"The backup folder has to be an absolute path.","server.waitingSubmit":"{{label}} is waiting for an answer: answer it before sending another message.","server.worktreeBaseAdvanced":"{{base}} moved ahead: the branch has to catch up first. Nothing was merged.","server.worktreeBaseMissing":"The branch {{base}} doesn't exist in this repository.","server.worktreeBaseNotOpen":"{{base}} isn't checked out in any folder, so there's nowhere to merge it.","server.worktreeBranchExists":"The branch {{branch}} already exists.","server.worktreeBranchInUse":"The branch {{branch}} is already open in another folder.","server.worktreeBranchInvalid":"{{branch}} isn't a valid branch name.","server.worktreeBranchMissing":"The branch {{branch}} doesn't exist anymore.","server.worktreeBranchMoved":"The branch {{branch}} changed after you opened this plan: close it and open it again to see what would go in. Nothing was integrated.","server.worktreeBranchNotIntegrated":"The branch {{branch}} has unmerged commits: it wasn't deleted.","server.worktreeDiffEmpty":"This file has no line changes against the base.","server.worktreeDiscardFailed":"Couldn't delete all the new files: {{detail}}. The branch wasn't removed.","server.worktreeFailed":"The separate branch couldn't be handled.","server.worktreeFileNotInBranch":"That file isn't among the ones the branch changed.","server.worktreeFolderExists":"The folder {{folder}} already exists. Choose another branch name.","server.worktreeGitFailed":"git refused: {{detail}}","server.worktreeInUse":"Another program has the branch's folder open. Close it and try again.","server.worktreeLocalChanges":"Uncommitted files in the base folder that the branch touches: {{count}}. git would refuse, so nothing was merged.","server.worktreeMoveBusy":"The agent is working: move the conversation to a branch when it's done.","server.worktreeMoveCliCheckFailed":"Couldn't ask {{cli}} whether it can move the conversation to another folder: {{detail}}. Nothing was changed.","server.worktreeMoveCliFailed":"The branch {{branch}} was created, but {{cli}} didn't move the conversation: {{detail}}. The tab stays in its previous folder; you can remove the branch from Changes.","server.worktreeMoveCliUnsupported":"This version of {{cli}} can't move a conversation to another folder. Nothing was changed.","server.worktreeMovePending":"A message is waiting for the agent: move the conversation to a branch once the agent is done with it.","server.worktreeMoveUnavailable":"This tab's conversation can't be moved to a separate branch.","server.worktreeMoveWaiting":"The CLI is waiting for your answer: answer it, then move the conversation to a branch.","server.worktreeNoConflicts":"There are no notes left that can't be combined on their own.","server.worktreeNoReview":"That branch has no review yet.","server.worktreeNotRepo":"This folder isn't in a git repository.","server.worktreeNotesConflict":"Notes that changed on both sides and can't be combined: {{count}}. Nothing was removed.","server.worktreeNotesFailed":"The notes couldn't go back to the main folder, so nothing was removed: {{detail}}","server.worktreeNothingToCommit":"The branch has nothing uncommitted anymore.","server.worktreeNothingToIntegrate":"There's nothing to merge: the branch has no commits its base lacks.","server.worktreeNothingToReview":"There's nothing to review: the branch has no commits or changes of its own.","server.worktreeProjectUnknown":"The project's folder isn't there anymore.","server.worktreeReviewUnread":"The reviewer's answer couldn't be read: if it just finished, try again in a few seconds.","server.worktreeUncommitted":"Files with uncommitted changes: {{count}}. Nothing was removed.","server.worktreeUnknown":"That separate branch isn't in the app's list anymore.","server.worktreeUntrackedChanged":"The new files changed since you looked at them. Nothing was removed.","server.worktreeUpToDate":"The branch is already up to date with {{base}}.","session.untitled":"Untitled session","settings.cli.disabled":"Off","settings.cli.hint":"An unchecked CLI doesn't show in the menu or the sidebar, and its history isn't read.","settings.cli.install":"How to install it","settings.cli.notInstalled":"Not installed","settings.cli.restart":"Changes to the CLIs apply when you restart the app.","settings.console.auto":"Automatic","settings.console.autoWith":"Automatic ({{shell}})","settings.console.hint":"For consoles you open from now on; the open ones keep theirs.","settings.hiddenHint":"Hidden: {{name}}. You can show it again from ⚙ Settings.","settings.hide.console":"Hide the console (it comes back from ⚙ Settings)","settings.hide.notes":"Hide the notes (they come back from ⚙ Settings)","settings.hostOnly":"These settings 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.scheduled.enable":"Schedule messages","settings.scheduled.hint":"Adds a clock to the message box, so a message sends itself at the time you pick, in the same conversation. Turning it off doesn't delete what you scheduled: it stays paused.","settings.scheduled.needsStatusLine":"In {{agent}} the clock shows up once you set up its status line.","settings.section.appearance":"Appearance","settings.section.clis":"CLIs","settings.section.console":"Console","settings.section.more":"More","settings.section.panels":"Panels","settings.section.scheduled":"Scheduled messages","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.changeLocation":"Change location…","sidebar.project.changeLocationTitle":"Choose another folder for this project. Its conversations stay where they are","sidebar.project.export":"Export to Markdown","sidebar.project.folderGone":"The folder no longer exists on disk","sidebar.project.locate":"Locate folder…","sidebar.project.locateTitle":"Point this project to the folder where it is now. Its conversations are kept","sidebar.project.missing":"folder not found","sidebar.project.newSession":"New session in this project","sidebar.project.relocated":"Previous location: {{from}}","sidebar.project.relocationPaused":"Saved location paused: {{from}} exists again and its conversations are back there","sidebar.project.removeLocation":"Remove association","sidebar.project.removeLocationTitle":"Stop moving this project's conversations to the new folder. Nothing is deleted","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.relocatedTitle":`{{title}}
|
|
42
|
+
It ran in a folder that moved. Continue it in the new folder with ↪`,"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.agentPrompt":`Set up the status line of {{agent}}. In the file {{path}}, add the statusLine key from this JSON without touching the other keys; if the file doesn't exist, create it with this content:
|
|
43
|
+
|
|
44
|
+
{{fragment}}
|
|
45
|
+
|
|
46
|
+
Copy the command value exactly as it is, without adding or removing quotes or slashes. If the file already has a statusLine, don't replace it: tell me. Don't show the rest of the file or open other files in that folder.`,"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.copyPrompt":"Copy a request for your agent","statusLine.copyPromptTitle":"Copy a request so an AI agent adds the line for you","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.promptCopied":"Copied","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.moveBranch":"Branch","thread.notice.compacted":"Context compacted","thread.notice.compactedAuto":"Context compacted automatically","thread.notice.error":"The CLI returned an error: {{detail}}","thread.notice.errorNoDetail":"The CLI returned an error","thread.notice.interrupted":"Interrupted","thread.openFolder":"Open {{path}} in the system's file explorer","thread.openInFiles":"Open {{path}} in the Files tab","thread.pasted_one":"Pasted text #{{number}} · {{count}} line","thread.pasted_other":"Pasted text #{{number}} · {{count}} lines","thread.question.answerInCli":"Answer in the CLI tab","thread.question.answered":"Answered","thread.question.closed":"The CLI closed with this question open","thread.question.multi":"multiple","thread.question.noCli":"Can't answer without the CLI open","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.editSentTitle":"Stops the agent and brings your message back to the message box to fix it. Only until the agent starts answering","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.queue.sent":"sent","thread.queue.sentTitle":"The CLI already has it, and the agent hasn't started answering yet","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.tools.hide":"Hide search and buttons","thread.tools.show":"Show search and buttons","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.move.askChanges":"Ask the agent to take its own","worktree.move.askChangesHint":"It's left written in its box, unsent: you review it and send it.","worktree.move.changes_one":"The folder of this conversation has {{count}} file with uncommitted changes. It doesn't move on its own: the app doesn't know which conversation it belongs to.","worktree.move.changes_other":"The folder of this conversation has {{count}} files with uncommitted changes. They don't move on their own: the app doesn't know which conversation each one belongs to.","worktree.move.intro":"The conversation continues whole on a branch with its own folder next to {{project}}: the agent works there without touching the main folder. If its CLI is open, it closes and reopens on the branch.","worktree.move.moving":"Moving…","worktree.move.submit":"Move to the branch","worktree.move.title":"Move this conversation to a separate branch","worktree.new":"New session on a separate branch","worktree.notes.back_one":"{{count}} note goes back to the main folder.","worktree.notes.back_other":"{{count}} notes go back to the main folder.","worktree.notes.hide":"hide","worktree.notes.mergedMark":"combined","worktree.notes.merged_one":"{{count}} is combined with what changed there.","worktree.notes.merged_other":"{{count}} are combined with what changed there.","worktree.notes.resolved_one":"The branch's agent already combined {{list}}: it stays as it is in the main folder.","worktree.notes.resolved_other":"The branch's agent already combined {{list}}: they stay as they are in the main folder.","worktree.notes.returned_one":"{{count}} note went back to the main folder.","worktree.notes.returned_other":"{{count}} notes went back to the main folder.","worktree.notes.show":"show which","worktree.remove.askCommit_one":"Ask the agent to commit it","worktree.remove.askCommit_other":"Ask the agent to commit them","worktree.remove.askNotes":"Ask the agent to combine them","worktree.remove.askTitle":"Leaves the request in the branch tab's message box, without sending it","worktree.remove.commands":"Commands","worktree.remove.conflicts":"These notes changed on both sides and can't be combined on their own: {{list}}. If you remove the branch now, what it changed in them is lost.","worktree.remove.deletesBranch":"It's already merged: its folder and the branch {{branch}} are deleted. Its conversations can still be reopened from the sidebar.","worktree.remove.deletesUnusedBranch":"It has no commits of its own: its folder and the branch {{branch}} are deleted. Its conversations can still be reopened from the sidebar.","worktree.remove.discard":"Remove and lose those changes","worktree.remove.discardFiles":"Remove and lose these files","worktree.remove.done":"The separate branch was removed.","worktree.remove.doneBranch":"The branch was deleted too.","worktree.remove.doneDiscardedFiles_one":"{{count}} new file was lost, as you chose.","worktree.remove.doneDiscardedFiles_other":"{{count}} new files were lost, as you chose.","worktree.remove.doneDiscarded_one":"{{count}} note was lost, as you chose.","worktree.remove.doneDiscarded_other":"{{count}} notes were lost, as you chose.","worktree.remove.holder":"{{program}} ({{exe}}, PID {{pids}})","worktree.remove.holderExe":"{{exe}} (PID {{pids}})","worktree.remove.inUse":"Another program has the folder open (an editor, a development server). Close it and try again.","worktree.remove.inUseBy_one":"{{list}} has the folder open. Close it and try again.","worktree.remove.inUseBy_other":"{{list}} have the folder open. Close them and try again.","worktree.remove.keepsBranch":"It isn't merged yet: its folder is removed, and the branch {{branch}} stays saved in Changes, to merge it or open it again.","worktree.remove.keepsExistingBranch":"The branch {{branch}} already existed: only its folder is removed, and the branch stays.","worktree.remove.loading":"Checking what's in its folder…","worktree.remove.removing":"Removing…","worktree.remove.retry":"Try again","worktree.remove.submit":"Remove","worktree.remove.tabs":"These close: {{list}}.","worktree.remove.title":"Remove the separate branch {{branch}}","worktree.remove.uncommitted_one":"It has {{count}} uncommitted file, and a branch with uncommitted work isn't removed:","worktree.remove.uncommitted_other":"It has {{count}} uncommitted files, and a branch with uncommitted work isn't removed:","worktree.remove.untrackedAccepted":"Lost along with the branch:","worktree.remove.untrackedCopied":"It has new uncommitted files, and among them something that was copied from the main folder and that this branch doesn't ignore: that isn't lost from here. Ask the agent to commit it or delete it:","worktree.remove.untrackedNestedRepo":"It has new uncommitted files, and there's a git repository inside (it may have commits that exist nowhere else): that isn't lost from here. If it's not needed, ask the agent to delete it:","worktree.remove.untrackedTooMany":"It has more than {{max}} new uncommitted files: too many to check and lose from here. If they're not needed, ask the agent to delete them:","worktree.remove.untracked_one":"It has {{count}} new uncommitted file ({{size}}). If it's work, ask the agent to commit it; if not, you can remove the branch and lose it:","worktree.remove.untracked_other":"It has {{count}} new uncommitted files ({{size}}). If they're work, ask the agent to commit them; if not, you can remove the branch and lose them:","worktree.review.author":"{{agent}} worked on the branch: another CLI sees what it takes for granted.","worktree.review.branchBusy":"The branch's tab is working: the review may see something half done.","worktree.review.deliveryPrefill":"The request waits in its box: you send it with Enter.","worktree.review.deliverySent":"The request is sent by itself when the CLI is ready.","worktree.review.guardCli":"{{agent}} starts read-only: it can't edit the branch.","worktree.review.guardNone":"{{agent}} can edit the branch's files: the request tells it not to.","worktree.review.guardTools":"{{agent}} starts without its edit tools, but its shell could still write: the request tells it not to.","worktree.review.intro":"Another CLI reviews what the branch brings against {{base}}, in its folder, and ends with a verdict. Testing it and merging are still up to you.","worktree.review.loading":"Looking at the branch…","worktree.review.nothing":"The branch has nothing to review against {{base}}.","worktree.review.prompt":"What it receives","worktree.review.quota":"Each review uses the quota of the CLI that reviews.","worktree.review.requesting":"Opening…","worktree.review.reviewer":"Who reviews","worktree.review.sameCli":"{{agent}} reviews, in a new conversation.","worktree.review.stale":"{{text}} (of an earlier commit)","worktree.review.stateChanges":"{{agent}} review: asks for changes","worktree.review.stateNone":"{{agent}} review: no verdict","worktree.review.statePending":"{{agent}} review: no answer yet","worktree.review.stateReady":"{{agent}} review: ready to merge","worktree.review.stateWorking":"{{agent}} review: in progress","worktree.review.submit":"Ask for the review","worktree.review.title":"Ask for a review of {{branch}}","worktree.review.uncommitted_one":"The branch has {{count}} uncommitted file: the reviewer looks at it too.","worktree.review.uncommitted_other":"The branch has {{count}} uncommitted files: the reviewer looks at them too.","worktree.rows.ahead_one":"{{count}} commit ahead","worktree.rows.ahead_other":"{{count}} commits ahead","worktree.rows.behind_one":"{{base}} has {{count}} new commit","worktree.rows.behind_other":"{{base}} has {{count}} new commits","worktree.rows.changes_one":"{{count}} uncommitted","worktree.rows.changes_other":"{{count}} uncommitted","worktree.rows.clean":"no changes","worktree.rows.current":"this tab","worktree.rows.deleteBranch":"Delete branch","worktree.rows.deleteBranchTitle":"Opens the plan to delete the branch, with git branch -d","worktree.rows.heading":"Separate branches","worktree.rows.headingTitle":"The other folders of this repository, each with its branch","worktree.rows.integrated":"merged","worktree.rows.kept":"folder removed","worktree.rows.keptTitle":"The app removed its folder and the branch is still in the repository: its conversations can be reopened from the sidebar","worktree.rows.main":"main folder","worktree.rows.mergeClean":"no conflicts","worktree.rows.mergeConflicts_one":"conflicts in {{count}} file: {{list}}","worktree.rows.mergeConflicts_other":"conflicts in {{count}} files: {{list}}","worktree.rows.notIntegrated_one":"{{count}} commit not merged","worktree.rows.notIntegrated_other":"{{count}} commits not merged","worktree.rows.open":"Open","worktree.rows.openTitle":"Go to its tab, or open one in that folder","worktree.rows.overlap":"{{branch}} touches it too: {{list}}","worktree.rows.remove":"Remove","worktree.rows.removeTitle":"Remove its folder; the branch stays unless it's already merged","worktree.sidebar.branchTitle":"Worked on the separate branch {{branch}}","worktree.sidebar.removed":"removed","worktree.sidebar.removedTitle":"This conversation worked on a separate branch whose folder was removed","worktree.sidebar.reopen":"Reopen the branch","worktree.sidebar.reopenTitle":"Reopen the branch: takes it out again in the same folder (if it was deleted, it's created again at the commit where it ended) and resumes this conversation","worktree.tab.linkedTitle":"Branch {{branch}}, apart from {{main}}","worktree.tab.mainTitle":"Branch {{branch}}, in the main folder","worktree.tab.review":"review","worktree.tab.reviewTitle":"Review tab: its CLI started read-only, if it has a way to"},Qd=["en","es","de","fr","pt-BR","ru","ja","ko","zh-CN"],nv="en",Du={en:"English",es:"Español",de:"Deutsch",fr:"Français","pt-BR":"Português (Brasil)",ru:"Русский",ja:"日本語",ko:"한국어","zh-CN":"简体中文"},Nk={en:"EN",es:"ES",de:"DE",fr:"FR","pt-BR":"PT",ru:"RU",ja:"JA",ko:"KO","zh-CN":"ZH"},Jd={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"},Rk={es:()=>Ir(()=>import("./es-DWDjzJiM.js"),[]),de:()=>Ir(()=>import("./de-B1H_QM2z.js"),[]),fr:()=>Ir(()=>import("./fr-CtJ1d2yz.js"),[]),"pt-BR":()=>Ir(()=>import("./pt-BR-Cmvs9M-D.js"),[]),ru:()=>Ir(()=>import("./ru-5xVwlwKl.js"),[]),ja:()=>Ir(()=>import("./ja-Cos1eWDW.js"),[]),ko:()=>Ir(()=>import("./ko-BQ4C0HzE.js"),[]),"zh-CN":()=>Ir(()=>import("./zh-CN-B3ZlV59h.js"),[])},rv=Lk,_d=new Map([["en",rv]]),Bp=new Map,wd=new Set;let tl=nv,bd=Jd[nv],Fp=0;function sv(t){return Qd.includes(t)}function yd(){return tl}function ii(){return bd}function Mk(t){return Jd[t]}function iv(t){return wd.add(t),()=>wd.delete(t)}async function ov(t,e=Jd[t]){const r=++Fp;if(!_d.has(t)&&t!=="en"){const l=await Rk[t]();_d.set(t,l.default)}if(r===Fp&&!(tl===t&&bd===e)){tl=t,bd=e;for(const l of wd)l()}}function Ak(t,e){let r=Bp.get(t);return r===void 0&&(r=new Intl.PluralRules(t),Bp.set(t,r)),r.select(e)}function Hp(t,e,r,l){if(l!==void 0){const a=t[`${r}_${Ak(e,l)}`]??t[`${r}_other`];if(a!==void 0)return a}return t[r]}function Ik(t,e,r,l){const a=l==null?void 0:l.count,y=typeof a=="number"?a:void 0;return(t===void 0?void 0:Hp(t,e,r,y))??Hp(rv,"en",r,y)??r}function ja(t,e){return e===void 0?t:t.replace(/\{\{\s*([A-Za-z0-9_]+)\s*\}\}/g,(r,l)=>{const a=e[l];return a===void 0?r:String(a)})}function lv(t,e){return Ik(_d.get(tl),tl,t,e)}function f(t,e){return ja(lv(t,e),e)}function jk(){return[{keys:"Esc",description:f("agent.shortcuts.codex.interruptTurn")},{keys:"Esc Esc",description:f("agent.shortcuts.codex.editPrevious")},{keys:"Ctrl + C",description:f("agent.shortcuts.codex.interruptOrExit")},{keys:"Alt + , / Alt + .",description:f("agent.shortcuts.codex.effort")},{keys:"Shift + Tab",description:f("agent.shortcuts.codex.cycleMode")},{keys:"Tab",description:f("agent.shortcuts.codex.queue")},{keys:"Ctrl + T",description:f("agent.shortcuts.codex.transcript")},{keys:"Ctrl + R",description:f("agent.shortcuts.codex.searchHistory")},{keys:"@",description:f("agent.shortcuts.codex.mention")},{keys:"/",description:f("agent.shortcuts.commands")},{keys:"Ctrl + G",description:f("agent.shortcuts.codex.externalEditor")}]}function Dk(){return[{keys:"Esc Esc",description:f("agent.shortcuts.opencode.interrupt")},{keys:"Tab / Shift + Tab",description:f("agent.shortcuts.opencode.cycleAgent")},{keys:"Ctrl + P",description:f("agent.shortcuts.opencode.commandList")},{keys:f("agent.shortcuts.leaderThen",{key:"M"}),description:f("agent.shortcuts.opencode.model")},{keys:f("agent.shortcuts.leaderThen",{key:"N"}),description:f("agent.shortcuts.opencode.newSession")},{keys:"Ctrl + J",description:f("agent.shortcuts.opencode.newline")},{keys:"Ctrl + C",description:f("agent.shortcuts.opencode.clearInput")},{keys:"Ctrl + V",description:f("agent.shortcuts.opencode.paste")}]}function Pk(){return[{keys:"Esc",description:f("agent.shortcuts.antigravity.interrupt")},{keys:"Shift + Tab",description:f("agent.shortcuts.antigravity.cycleMode")},{keys:"1 … 4",description:f("agent.shortcuts.antigravity.answerPermission")},{keys:"/",description:f("agent.shortcuts.commands")},{keys:"?",description:f("agent.shortcuts.antigravity.help")}]}function Ok(){return[{keys:"Esc",description:f("agent.shortcuts.interruptCli")},{keys:"Esc Esc",description:f("agent.shortcuts.pi.tree")},{keys:"Ctrl + C",description:f("agent.shortcuts.pi.clearOrExit")},{keys:"Shift + Tab",description:f("agent.shortcuts.pi.cycleThinking")},{keys:"Ctrl + L",description:f("agent.shortcuts.pi.model")},{keys:"Ctrl + P",description:f("agent.shortcuts.pi.nextModel")},{keys:"Ctrl + O",description:f("agent.shortcuts.pi.toolOutput")},{keys:"Ctrl + J",description:f("agent.shortcuts.pi.newline")},{keys:"!",description:f("agent.shortcuts.pi.bash")},{keys:"/",description:f("agent.shortcuts.commands")}]}function Bk(){return[{keys:"Esc",description:f("agent.shortcuts.interruptCli")},{keys:"Esc Esc",description:f("agent.shortcuts.claudeCode.rewind")},{keys:"Ctrl + C",description:f("agent.shortcuts.claudeCode.cancel")},{keys:"Ctrl + R",description:f("agent.shortcuts.claudeCode.searchHistory")},{keys:"Ctrl + O",description:f("agent.shortcuts.claudeCode.fullOutput")},{keys:"Shift + Tab",description:f("agent.shortcuts.claudeCode.cycleMode")},{keys:"Alt + V",description:f("agent.shortcuts.claudeCode.pasteImage")},{keys:"Ctrl + V",description:f("agent.shortcuts.claudeCode.pasteText")}]}const Es={"claude-code":{shortLabel:"CC",get shortcuts(){return Bk()},shortcutsNote:null,instructionsFile:"CLAUDE.md",savesModelChoice:!1,compactCommand:"/compact"},codex:{shortLabel:"CX",get shortcuts(){return jk()},get shortcutsNote(){return f("agent.shortcuts.codex.note")},instructionsFile:"AGENTS.md",savesModelChoice:!1,compactCommand:"/compact"},opencode:{shortLabel:"OC",get shortcuts(){return Dk()},get shortcutsNote(){return f("agent.shortcuts.opencode.note")},instructionsFile:"AGENTS.md",savesModelChoice:!1,compactCommand:"/compact"},antigravity:{shortLabel:"AG",get shortcuts(){return Pk()},shortcutsNote:null,instructionsFile:"AGENTS.md",savesModelChoice:!0,compactCommand:"/compact"},pi:{shortLabel:"PI",get shortcuts(){return Ok()},shortcutsNote:null,instructionsFile:"AGENTS.md",savesModelChoice:!1,effortCommand:"/thinking",compactCommand:"/compact"}};function Fk(t){return(t===null?void 0:Es[t].effortCommand)??Gd}function Hk(t){return t===null?null:Es[t].compactCommand}const Uk={"gemini-cli":"GC","antigravity-ide":"AI"};function $k(t){return Qi(t)?Es[t].shortLabel:Uk[t]}function al(t,e){var r;return Qi(t)?((r=e.find(l=>l.id===t))==null?void 0:r.label)??t:kb[t]}const av="Sesion sin titulo";function wr(t,e){return e==="none"||t===av?f("session.untitled"):t}function Wk(t,e){const r=new Map;for(const a of e)a.titleSource==="none"||a.title===av||r.set(`${a.agent}\0${a.sessionId}`,a.title);const l=new Map;for(const a of t){if(a.agent===null||a.sessionId.length===0)continue;const y=r.get(`${a.agent}\0${a.sessionId}`);y!==void 0&&l.set(a.terminalId,y)}return l}function Da(t){return t.storage==="native"&&Qi(t.agent)}function qk(t){return t!==null&&Es[t].savesModelChoice}function zk(t,e,r){if(e!=null)return e;for(let l=t.length-1;l>=0;l-=1){const a=t[l];if(!(a===void 0||a.effort===null))return r===null||a.at>=r?a.effort:null}return null}function Kk(t){return t===null?null:Es[t].instructionsFile}function Up(t,e=!1){const r=t.permissionCycle,l=Nb(t,e);return{modeCycle:r===null||l===null||l===r.launchMode?r:{...r,launchMode:l},codexPermissions:t.codexPermissions,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,scheduledSend:t.scheduledSend,codexNativeQueue:t.codexNativeQueue,moveToWorktree:t.moveToWorktree}}function Vk(t,e){const r=Jy(e,t);return r===null?null:t.find(l=>l.value===r.value)??null}function Gk(t,e){return t??e.launchMode}const Yk={auto:"mode.auto.label",default:"mode.default.label",acceptEdits:"mode.acceptEdits.label",plan:"mode.plan.label"},Xk={auto:"mode.auto.hint",default:"mode.default.hint",acceptEdits:"mode.acceptEdits.hint",plan:"mode.plan.hint"};function cv(t){return f(Yk[t])}function Qk(t){return f(Xk[t])}function Jk(t,e){return f("agent.mode.title",{mode:cv(t),hint:Qk(t),key:e.keyLabel})}function uv(t,e){return t.approvesPendingOnCycle&&e!==null}function Zk(t,e,r,l){if(uv(e,l))return f("agent.mode.blocked");const a=Jk(t,e);return!e.approvesPendingOnCycle||r?a:f("agent.mode.titleBlind",{title:a})}const eC={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 tC(t){return f(eC[t])}function nC(){return f("agent.statusLine.noFragment")}function rC(t,e){return t.fragment===null?null:f("statusLine.agentPrompt",{agent:e,path:t.settingsPath,fragment:t.fragment})}function sC(t,e){return t.filter(r=>r.available&&!e.includes(r.id)&&r.statusLine!==null&&r.statusLine.state!=="active"&&!r.capabilities.scheduledSend)}function iC(t,e,r=new Set){return t.filter(l=>(e||l.id!=="plans")&&(l.id==="cli"||!r.has(l.id)))}function oC(t,e,r=new Set){return t==="plans"&&!e||t!=="cli"&&r.has(t)?"cli":t}function lC(t,e,r){const l=a=>a===null?void 0:e.find(y=>y.id===a);return l(t)??l(r)??e[0]??null}function aC(t){return[{keys:"Enter",description:f("agent.shortcuts.composer.send")},{keys:"Shift + Enter",description:f("agent.shortcuts.composer.newline")},{keys:"Ctrl + V",description:f(t?"agent.shortcuts.composer.pasteWithImages":"agent.shortcuts.composer.pasteText")},{keys:"Esc",description:f("agent.shortcuts.interruptCli")}]}function $p(){return f("agent.composer.imagesRefused")}function cC(t,e,r){return e.compacted===!0&&e.contextWindow!==null&&e.contextWindowEstimated!==!0?e.contextWindow:r??(t==="token-count"||t==="status-line"?e.contextWindow:null)}function Wp(t,e){return e.compacted===!0?!1:t==="status-line"?e.lastRequestTokens>0:e.assistantMessages>0}function uC(t,e){return t===null&&e!==null&&e.state!=="active"}function dC(t){return f(t==="other-command"?"agent.meter.setup.otherCommand":t==="disabled"?"agent.meter.setup.disabled":t==="unreadable"?"agent.meter.setup.unreadable":"agent.meter.setup.missing")}function hC(t,e){return e.contextWindowEstimated?f("agent.meter.origin.estimated"):t==="usage-with-catalog"&&e.contextWindow!==null?f("agent.meter.origin.catalog"):null}function fC(t,e=null,r=!1){return r?f("agent.meter.idle.compacted"):e==="status-line"?f("agent.meter.idle.statusLine"):t===null?f("agent.meter.idle.noFile"):f("agent.meter.idle.withFile",{file:t})}function pC(t,e=null){return t==="idle"?f("agent.dot.idle"):t==="unknown"?e===null?f("agent.dot.noStatus"):e.state==="active"?f("agent.dot.statusLinePending"):f("agent.dot.statusLineOnly"):f("agent.dot.open")}function qp(t,e){return t.length===0?!0:t.some(r=>r.id===e&&r.available&&r.capabilities.resume)}function mC(t,e,r){return t?r?f("agent.note.empty"):f("agent.note.send",{cwd:e??""}):f(e===null?"agent.note.needsTab":"agent.note.noReadySignal")}function gC(t,e,r){return t===null?f("notes.toComposer.needsTab"):e?f("agent.note.empty"):r?f("notes.toComposer.title",{tab:t}):f("notes.toComposer.loading")}function dv(t,e,r){const l=Dr(e,r);let a=null;for(const y of t)y.kind!=="agent"||y.agent===null||Dr(y.cwd,r)===l&&(a=y.agent);return a}function hv(t,e){var l;const r=e.filter(a=>a.available);for(const a of t)if(a!==null&&r.some(y=>y.id===a))return a;return((l=r[0])==null?void 0:l.id)??null}function vC(t){let e=null;for(const r of t){const l=r.agent;Qi(l)&&(e===null||r.updatedAt>e.updatedAt)&&(e={agent:l,updatedAt:r.updatedAt})}return(e==null?void 0:e.agent)??null}function _C(t,e,r,l,a){return hv([dv(t,e,r),a],l)}function zp(t,e,r,l,a){return hv([dv(t,e.cwd,r),vC(e.sessions),a],l)}function kd(t){return t.filter(e=>e.available)}function wC(t,e){const r=t.findIndex(l=>l.id===e);return r===-1?0:r}function bC(t,e,r){return r<=0?0:((t+e)%r+r)%r}function fv(t,e,r,l=4){const a=t.bottom+2,y=t.top-2-e.height,v=a+e.height+l<=r.height||y<l?Math.max(l,Math.min(a,r.height-e.height-l)):y;return{left:Math.max(l,Math.min(t.left,r.width-e.width-l)),top:v}}function pv(t,e,r){const l=t;return l===null||typeof l!="object"||typeof l.contains!="function"?!0:r!==null&&r.contains(t)?!1:l.contains(e)}function mv(t,e,r=!1,l=!1){return e===null||r?[]:l?kd(t):zd(t)?kd(t).filter(a=>a.id!==e):[]}function Zd(t=!1,e=!1,r=!1){return f(e?"agent.continue.titleMoved":t?"agent.continue.titleMain":r?"agent.continue.titleCopy":"agent.continue.title")}function yC(t){const e=t.worktree!==null&&!t.worktree.exists,r=t.relocated===!0,l=t.storage==="vault";return{sameCliToo:e||r||l,title:Zd(e,r,l)}}function kC(t){return t.cwdExists||t.cwd.length===0?null:f("continue.locateFirst")}function CC(t,e,r){return e?f("agent.continue.discovering"):t.length===0?f("agent.continue.noConversation"):r?null:f("agent.continue.noMessages")}function xC(t,e,r,l){const a=e>=r&&!l?r===1?f("agent.handoff.turns.single"):f("agent.handoff.turns.all",{count:r}):e===1?l?f("agent.handoff.turns.lastOneOfMore",{total:r}):f("agent.handoff.turns.lastOne",{total:r}):l?f("agent.handoff.turns.lastManyOfMore",{count:r,included:e}):f("agent.handoff.turns.lastMany",{count:r,included:e});return f("agent.handoff.notice",{label:t,turns:a})}const Kp=40;function Vp(t){const e=t.replace(/\s+/g," ").trim(),r=[...e],l=r.length>Kp?`${r.slice(0,Kp).join("").trimEnd()}…`:e;return l.length>0?f("agent.handoff.tabLabel",{title:l}):f("agent.handoff.tabLabelNoTitle")}function SC(){return f("agent.handoff.sending")}function EC(t){return t===null?f("agent.queueReturned.noLabel"):f("agent.queueReturned.withLabel",{label:t})}function TC(){return f("agent.stoppedEarly")}function LC(t){switch(t){case"no-delivery":return f("agent.handoff.prefill.noDelivery");case"not-ready":return f("agent.handoff.prefill.notReady");case"send-failed":return f("agent.handoff.prefill.sendFailed")}}function eh(t,e){return t.trim().length===0?e:`${e}
|
|
47
|
+
|
|
48
|
+
${t}`}function NC(t,e){return t&&e!==null}function RC(t,e,r){if(!Qi(t))return{badge:!0,unavailableTitle:null};const l=e.find(v=>v.id===t),a=e.some(v=>v.available),y=l!==void 0&&!l.available&&a;return{badge:r||y,unavailableTitle:y?f("agent.session.cliMissing",{label:l.label}):null}}function MC(t,e,r){return t!==null&&e===""&&!r.sessionIdAtLaunch}function AC(){return f("agent.thread.noTranscript")}function IC(){return f("agent.thread.discovering")}function jC(t,e,r,l,a=null){return!l||!Dg(t,a)||!e?null:r===null?f("agent.openTool.noLabel"):f("agent.openTool.withLabel",{label:r})}function gv(t,e=!1){return f(t==="permission prompt"?"agent.waiting.permission":t==="question"&&e?"agent.waiting.question":"agent.waiting.answer")}function DC(t){return t.relaunching?"relaunching":t.offlineReason==="server-closed"&&t.alive?"offer":null}function PC(t){return t===null?f("agent.serverClosed.noLabel"):f("agent.serverClosed.withLabel",{label:t})}function OC(){return f("agent.serverClosed.relaunch")}function BC(){return f("agent.serverClosed.relaunching")}function FC(t,e){const r=new Map,l=[];for(const[a,y]of t){const v=e.find(o=>o.terminalId===a);v===void 0||v.alive&&y==="exited"?l.push(a):r.set(a,v.alive?y:"exited")}return{phases:r,finished:l}}function HC(t,e,r){var l;return!r||e===null||((l=t.permissionCycle)==null?void 0:l.approvesPendingOnCycle)!==!0&&!t.waitingBlocksSubmit?null:gv(e,t.questionCards)}const Gp=2e4;function UC(t){if(t.label.length>0)return t.label;const e=t.cwd.split(/[\\/]/).filter(r=>r.length>0);return e[e.length-1]??t.cwd}function $C(t,e,r){const l=t.map(y=>({terminalId:y.terminalId,kind:y.kind,cwd:y.cwd,worktree:y.worktree??null})),a=[];for(const y of e){const v=bk(l.map(o=>o.terminalId),o=>l.find(c=>c.terminalId===o),{kind:"agent",cwd:y.cwd},r);a.push({pending:y,index:v,label:UC(y)}),l.splice(v,0,{terminalId:`pending:${y.requestId}`,kind:"agent",cwd:y.cwd})}return a}function Yp(t,e,r){const l=Dr(e,r);return t.some(a=>Dr(a.cwd,r)===l)}function vv(){return f("agent.openBlocked")}const WC={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 qC(t){const e=WC[t.value];return e===void 0?t.label:f(e)}function zC(t){return t.value==="default"?f("controls.model.default"):Qy(t)}function KC({models:t,efforts:e,model:r,effort:l,modelProvisional:a=!1,effortProvisional:y=!1,savesChoice:v=!1,effortCommandName:o=Gd,effortUsesModel:c=!1,disabled:m,onCommand:w}){const d=t===null?null:Vk(t,r),k=c&&(d!=null&&d.supportedEfforts)?(e==null?void 0:e.filter(M=>{var b;return(b=d.supportedEfforts)==null?void 0:b.includes(M.value)}))??null:e,L=d===null&&r!==null;return i.jsxs(i.Fragment,{children:[t!==null&&i.jsxs("select",{className:"agent-select",value:(d==null?void 0:d.value)??"",disabled:m,onChange:M=>{M.target.value.length>0&&w(e0(M.target.value))},title:r===null?f("controls.model.noData"):a?f("controls.model.provisional",{model:r}):v?f("controls.model.inUseSaved",{model:r}):f("controls.model.inUse",{model:r}),children:[d===null&&i.jsx("option",{value:"",children:L?r??"":f(c?"controls.model.select":"controls.model.placeholder")}),t.map(M=>i.jsx("option",{value:M.value,children:zC(M)},M.value))]}),k!==null&&i.jsxs("select",{className:"agent-select",value:l??"",disabled:m,onChange:M=>{M.target.value.length>0&&w(c?`/model --reasoning=${M.target.value}`:t0(M.target.value,o))},title:l===null?f("controls.effort.noData"):y?f("controls.effort.provisional",{effort:l}):v?f("controls.effort.inUseSaved",{effort:l,command:o}):f("controls.effort.inUse",{effort:l,command:o}),children:[l===null&&i.jsx("option",{value:"",children:f("controls.effort.placeholder")}),k.map(M=>i.jsx("option",{value:M.value,children:qC(M)},M.value))]})]})}function VC({mode:t,cycle:e,disabled:r,waitingFor:l=null,statusKnown:a=!0,onChange:y}){const v=Gk(t,e);return i.jsx("select",{className:"agent-select agent-select-mode",value:v,disabled:r||uv(e,l),onChange:o=>{si(o.target.value)&&y(o.target.value)},title:Zk(v,e,a,l),children:e.modes.map(o=>i.jsx("option",{value:o,children:cv(o)},o))})}const GC={"ask-for-approval":"controls.permission.askForApprovalHint",automatic:"controls.permission.automaticHint","read-only":"controls.permission.readOnlyHint","full-access":"controls.permission.fullAccessHint"},YC={unsupported:"controls.permission.error.unsupported",gone:"controls.permission.error.gone",review:"controls.permission.error.review",busy:"controls.permission.error.busy",waiting:"controls.permission.error.waiting","tool-pending":"controls.permission.error.toolPending","not-ready":"controls.permission.error.notReady",failed:"controls.permission.error.failed"};function XC({disabled:t,state:e,request:r,onChange:l}){const a=pd(e),y=(r==null?void 0:r.status)==="awaiting"?r.preset:a??(e===null?"__unknown":"__custom"),v=(r==null?void 0:r.status)==="writing";let o=null;return(r==null?void 0:r.status)==="writing"?o=f("controls.permission.pending"):(r==null?void 0:r.status)==="awaiting"?o=f("controls.permission.awaiting"):(r==null?void 0:r.status)==="unconfirmed"?o=f("controls.permission.unconfirmed"):(r==null?void 0:r.status)==="blocked"&&(o=f(r.reason===void 0?"controls.permission.error.failed":YC[r.reason])),i.jsxs("div",{className:"codex-permission-control",children:[i.jsxs("select",{className:"agent-select agent-select-permission",value:y,disabled:t||v,"aria-label":f("controls.permission.label"),title:o!==null?o:f(a===null?"controls.permission.unknownHint":GC[a]),onChange:c=>{const m=c.target.value;(m==="ask-for-approval"||m==="automatic"||m==="read-only"||m==="full-access")&&l(m)},children:[a===null&&i.jsx("option",{value:e===null?"__unknown":"__custom",disabled:!0,children:f(e===null?"controls.permission.unknown":"controls.permission.custom")}),i.jsx("option",{value:"ask-for-approval",children:f("controls.permission.askForApproval")}),i.jsx("option",{value:"automatic",children:f("controls.permission.automatic")}),i.jsx("option",{value:"full-access",children:f("controls.permission.fullAccess")}),i.jsx("option",{value:"read-only",children:f("controls.permission.readOnly")})]}),o!==null&&i.jsx("span",{className:"codex-permission-status",role:"status",children:o})]})}const QC=1e3;function Pu(t,e,r,l){const a=t.slice(0,e),y=t.slice(r),v=a.length>0&&!/\s$/.test(a),o=y.length>0&&!/^\s/.test(y);return`${v?" ":""}${l}${o?" ":""}`}function JC(t,e,r){const l=`${t.value.slice(0,t.start)} ${t.value.slice(t.start)}`;return e===l&&r===t.start+1?{from:t.start,to:t.start+1}:null}class ZC{constructor(e,r=QC){Ut(this,"phase","idle");Ut(this,"timer",null);Ut(this,"snapshot",null);this.hooks=e,this.holdMs=r}get holding(){return this.phase==="holding"}keyDown(e,r){return e.key!==" "?!1:e.repeat?this.phase!=="idle":(this.reset(),e.shiftKey||e.ctrlKey||e.altKey||e.metaKey||e.isComposing||r.start!==r.end||!this.hooks.canStart()||(this.snapshot={value:r.value,start:r.start},this.phase="armed",this.timer=this.hooks.schedule(()=>this.fire(),this.holdMs)),!1)}keyUp(e){if(e.key!==" ")return;const r=this.phase==="holding";this.reset(),r&&this.hooks.onRelease()}cancel(){this.reset()}fire(){this.timer=null,!(this.phase!=="armed"||this.snapshot===null)&&(this.phase="holding",this.hooks.onHold(this.snapshot))}reset(){this.timer!==null&&(this.hooks.unschedule(this.timer),this.timer=null),this.phase="idle",this.snapshot=null}}function ex(t){const e=t.activity==="busy"||t.activity==="waiting";return{showStop:t.alive&&e,showSend:t.hasSomething}}function tx(t){return 1+(t.stop?1:0)+(t.suggestion?1:0)+t.voiceButtons}function Cd(t){return t==="claude-hold-space"||t==="antigravity-dictation"}function Xp(t){var e;return((e=t.find(r=>Cd(r.control))??t[0])==null?void 0:e.mode)??null}function nl(t){const e=t.replace(/(\r?\n)+$/,"");return e.length===0?0:e.split(`
|
|
49
|
+
`).length}function nx(t,e){return e===0?f("composer.chip.pastedTextEmpty",{number:t}):f("composer.chip.pastedText",{number:t,count:e})}function _v(t){return t.length===0?1:Math.max(...t)+1}function wv(t){const e=new Set;for(const r of t.matchAll(Sk()))e.add(Number(r[1]));return[...e].sort((r,l)=>r-l)}const rx=/[^\s([{"'¿¡«]/u,sx=/[\p{L}\p{N}]/u;function ix(t,e,r,l){const{start:a,end:y,before:v,after:o}=bv(t,e,r),c=`${v!==""&&rx.test(v)?" ":""}${Xd(l)}${o!==""&&sx.test(o)?" ":""}`;return yv(t,a,y,c)}const ox=/[^\s([{¿¡«]/u,lx=/[\p{L}\p{N}"'«]/u;function Qp(t,e,r,l){const{start:a,end:y,before:v,after:o}=bv(t,e,r),c=v!==""&&ox.test(v),m=o===""||lx.test(o),w=`${c?" ":""}${l}${m?" ":""}`;return yv(t,a,y,w)}function bv(t,e,r){const l=Math.max(0,Math.min(e,t.length)),a=Math.max(l,Math.min(r,t.length));return{start:l,end:a,before:l>0?t.charAt(l-1):"",after:a<t.length?t.charAt(a):""}}function yv(t,e,r,l){return{text:`${t.slice(0,e)}${l}${t.slice(r)}`,inserted:l,caret:e+l.length}}function kv(t,e){const r=new RegExp(`( ?)${cx(Xd(e))}( ?)`,"g");return t.replace(r,(l,a,y)=>a!==""&&y!==""?" ":"")}function Jo(t,e){let r=e;const l=[];for(const a of t){const y=a.text.replace(/\r\n?/g,`
|
|
50
|
+
`).replace(/\n+$/,"");if(y.trim().length===0){r=kv(r,a.number);continue}l.push(`${yk(a.number)}
|
|
51
|
+
${y}
|
|
52
|
+
${kk(a.number)}`)}return r.trim().length>0&&l.push(r),l.join(`
|
|
53
|
+
|
|
54
|
+
`)}function ax(t,e=!1){const r=t.replace(/\r\n?/g,`
|
|
55
|
+
`),l=[],a=c=>{const m=c.replace(/^\n+|\n+$/g,"");m.trim().length>0&&l.push({kind:"text",text:m})};let y=0;for(const c of r.matchAll(Ck())){const m=c[1]??"",w=(c.index??0)+m.length;a(r.slice(y,w)),l.push({kind:"pasted",number:Number(c[2]),text:c[3]??"",complete:!0}),y=(c.index??0)+c[0].length}const v=r.slice(y),o=e?xk().exec(v):null;if(o!==null){const c=o.index+(o[1]??"").length;a(v.slice(0,c)),l.push({kind:"pasted",number:Number(o[2]),text:v.slice(o.index+o[0].length),complete:!1})}else a(v);return l.some(c=>c.kind==="pasted")?l:[{kind:"text",text:t}]}function cx(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const ux=800,Jp=256;function Pa(t){return{text:t.text,pasted:t.items.flatMap(e=>e.kind==="text"?[{number:e.number,text:e.text}]:[])}}function dx(t,e){return{text:t.text,items:t.pasted.map(r=>({id:e(),kind:"text",number:r.number,text:r.text,lines:nl(r.text)}))}}function Zp(t,e,r){const l=[...t.items.flatMap(o=>o.kind==="text"?[o.number]:[]),...wv(t.text)],a=[];for(const o of e.pasted){const c=_v([...l,...a.map(m=>m.kind==="text"?m.number:0)]);a.push({id:r(),kind:"text",number:c,text:o,lines:nl(o)})}const y=a.map(o=>o.kind==="text"?Xd(o.number):"").join(" "),v=y.length===0?e.text:`${e.text}
|
|
56
|
+
|
|
57
|
+
${y}`;return{text:eh(t.text,v),items:[...t.items,...a]}}function hx(t,e){if(e===void 0)return{start:t,end:t,direction:"forward",scrollTop:"end"};const r=y=>Math.min(Math.max(0,y),t),l=r(e.selectionStart),a=Math.max(l,r(e.selectionEnd));return{start:l,end:a,direction:e.backward?"backward":"forward",scrollTop:Math.max(0,e.scrollTop)}}function fx(t){return Kg(Pa(t))>zg}function qi(t,e){return t===void 0||Ba(t)?Ba(e):Vg(t,e)}const em={text:"",pasted:[]};function px(t,e,r){const l=dx(t,r),a=((e==null?void 0:e.items)??[]).filter(y=>y.kind!=="text");return{text:l.text,items:[...l.items,...a]}}class mx{constructor(e){Ut(this,"local",new Map);Ut(this,"sentDrafts",new Map);Ut(this,"failedPrefills",new Map);Ut(this,"views",new Map);Ut(this,"saved",new Map);Ut(this,"heard",new Map);Ut(this,"unconfirmed",new Map);Ut(this,"submitting",new Map);Ut(this,"pending",new Map);Ut(this,"listeners",new Set);Ut(this,"serverKeeps",!1);this.deps=e}get(e){return this.local.get(e)}put(e,r){this.local.set(e,r),this.schedule(e,Pa(r))}rememberView(e,r){this.views.set(e,r)}viewOf(e){return this.views.get(e)}submitted(e,r,l,a){l!==void 0&&a!==void 0&&(this.sentDrafts.set(l,{terminalId:e,draft:a,prefillSeen:!1}),this.sentDrafts.size>Jp&&this.sentDrafts.delete(this.sentDrafts.keys().next().value)),this.cancel(e),this.local.delete(e),this.views.delete(e),this.saved.delete(e),this.unconfirmed.delete(e),this.submitting.set(e,r?"sent":"queued")}submittedAck(e,r,l){const a=this.sentDrafts.get(r);if(a===void 0||a.terminalId!==e||(this.sentDrafts.delete(r),l))return;a.prefillSeen||(this.failedPrefills.set(r,e),this.failedPrefills.size>Jp&&this.failedPrefills.delete(this.failedPrefills.keys().next().value));const y=this.local.get(e);let v=a.draft;if(y!==void 0&&(y.text.length>0||y.items.length>0)){const o=a.draft.items.flatMap(m=>m.kind==="text"?[{number:m.number,text:m.text}]:[]),c=Jo(o,a.draft.text);v={text:c.length===0?y.text:eh(y.text,c),items:[...a.draft.items.filter(m=>m.kind!=="text"),...y.items]}}this.put(e,v);for(const o of this.listeners)o(e)}consumeSubmitPrefill(e,r){if(r===void 0)return!1;const l=this.sentDrafts.get(r);return(l==null?void 0:l.terminalId)===e?(l.prefillSeen=!0,!0):this.failedPrefills.get(r)!==e?!1:(this.failedPrefills.delete(r),!0)}restore(e){const r=!this.serverKeeps;this.serverKeeps=!0;const l=[];for(const{terminalId:a,draft:y}of e)this.receive(a,y,r)&&l.push(a);for(const a of l)for(const y of this.listeners)y(a);for(const[a,y]of[...this.pending])y.handle===null&&this.sendNow(a)}reconnected(){this.serverKeeps=!1;for(const[e,r]of[...this.submitting])r==="sent"?this.submitting.delete(e):this.submitting.set(e,"sent")}retain(e){const r=new Set(e);for(const[l,a]of this.sentDrafts)r.has(a.terminalId)||this.sentDrafts.delete(l);for(const[l,a]of this.failedPrefills)r.has(a)||this.failedPrefills.delete(l);for(const l of new Set([...this.local.keys(),...this.views.keys(),...this.saved.keys(),...this.heard.keys(),...this.unconfirmed.keys(),...this.submitting.keys(),...this.pending.keys()]))r.has(l)||(this.cancel(l),this.local.delete(l),this.views.delete(l),this.saved.delete(l),this.heard.delete(l),this.unconfirmed.delete(l),this.submitting.delete(l))}flushAll(){for(const e of[...this.pending.keys()])this.sendNow(e)}onRestored(e){return this.listeners.add(e),()=>this.listeners.delete(e)}receive(e,r,l){const a=this.heard.get(e);if(this.heard.set(e,r),this.submitting.has(e)){if(!Ba(r))return!1;this.submitting.delete(e)}const y=this.unconfirmed.get(e);if(y!==void 0)if(qi(y,r))this.unconfirmed.delete(e);else if(l)if(qi(a,r)){this.unconfirmed.delete(e),this.setSaved(e,r);const m=this.local.get(e);return m!==void 0&&this.schedule(e,Pa(m)),!1}else this.unconfirmed.delete(e);else return!1;const v=this.local.get(e),o=v===void 0?em:Pa(v),c=qi(this.saved.get(e),o);return this.setSaved(e,r),this.pending.has(e)||!c||qi(r,o)?!1:(this.local.set(e,px(r,v,this.deps.newId)),this.views.delete(e),!0)}setSaved(e,r){Ba(r)?this.saved.delete(e):this.saved.set(e,r)}schedule(e,r){const l=this.pending.get(e);if(l!==void 0&&Vg(l.draft,r)||(this.cancel(e),qi(this.saved.get(e),r)))return;const a=this.deps.setTimer(()=>this.sendNow(e),this.deps.delayMs??ux);this.pending.set(e,{handle:a,draft:r})}cancel(e){const r=this.pending.get(e);r!==void 0&&(r.handle!==null&&this.deps.clearTimer(r.handle),this.pending.delete(e))}sendNow(e){const r=this.pending.get(e);if(r===void 0)return;if(r.handle!==null&&this.deps.clearTimer(r.handle),!this.serverKeeps||!this.deps.connected()){this.pending.set(e,{handle:null,draft:r.draft});return}this.pending.delete(e);const l=Kg(r.draft)>zg?em:r.draft;qi(this.saved.get(e),l)||(this.deps.send(e,l),this.unconfirmed.set(e,l),this.setSaved(e,l))}}const xd=1024,Sd=xd*1024,tm=Sd*1024;function Vi(t,e=0){return new Intl.NumberFormat(ii(),{minimumFractionDigits:e,maximumFractionDigits:e,useGrouping:!1}).format(t)}function fn(t){return!Number.isFinite(t)||t<xd?f("format.bytes.b",{value:Vi(Math.max(0,Math.round(t)||0))}):t<Sd?f("format.bytes.kb",{value:Vi(Math.round(t/xd))}):t<tm?f("format.bytes.mb",{value:Vi(t/Sd,1)}):f("format.bytes.gb",{value:Vi(t/tm,2)})}function Cv(t){const e=Math.floor(t/60),r=t%60;return r===0?f("format.duration.minutes",{value:e}):f("format.duration.minutesSeconds",{minutes:e,seconds:r})}function gx(t){if(t<1e3)return f("format.duration.ms",{value:t});const e=Math.round(t/1e3);return e<60?f("format.duration.seconds",{value:e}):Cv(e)}function rl(t){if(!Number.isFinite(t)||t<1e3)return f("format.duration.underSecond");const e=Math.round(t/1e3);return e<60?f("format.duration.seconds",{value:e}):Cv(e)}function nr(t,e=Date.now()){if(t<=0)return"";const r=Math.floor((e-t)/6e4);if(r<1)return f("time.justNow");if(r<60)return f("time.minutesAgo",{count:r});const l=Math.floor(r/60);if(l<24)return f("time.hoursAgo",{count:l});const a=Math.floor(l/24);return a<30?f("time.daysAgo",{count:a}):th(t)}function th(t){return new Date(t).toLocaleDateString(ii())}function Yi(t){return new Date(t).toLocaleTimeString(ii(),{hour:"2-digit",minute:"2-digit"})}function vx(t){return new Date(t).toLocaleString(ii(),{weekday:"short",hour:"2-digit",minute:"2-digit"})}function cl(t){return new Date(t).toLocaleString(ii(),{weekday:"short",day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"})}function nh(t){const e=Math.floor(Math.max(0,t)/6e4);if(e<1)return f("format.timeLeft.underMinute");const r=Math.floor(e/1440),l=Math.floor(e%1440/60);return r>0?f("format.timeLeft.daysHours",{days:r,hours:l}):l>0?f("format.timeLeft.hoursMinutes",{hours:l,minutes:e%60}):f("format.timeLeft.minutes",{minutes:e})}function _x(t){return new Intl.NumberFormat(ii(),{style:"percent",maximumFractionDigits:0}).format(t/100)}function En(t){return new Intl.ListFormat(ii(),{type:"conjunction"}).format(t)}var rh=jg();function xv({src:t,caption:e,onClose:r}){return N.useEffect(()=>{const l=a=>{a.key==="Escape"&&(a.preventDefault(),a.stopPropagation(),r())};return window.addEventListener("keydown",l,!0),()=>window.removeEventListener("keydown",l,!0)},[r]),rh.createPortal(i.jsxs("div",{className:"viewer",onClick:r,role:"presentation",children:[i.jsx("div",{className:"viewer-frame",onClick:l=>l.stopPropagation(),children:i.jsx("img",{className:"viewer-image",src:t,alt:e})}),i.jsxs("div",{className:"viewer-bar",children:[i.jsx("span",{className:"viewer-caption",children:e}),i.jsx("button",{className:"viewer-close",onClick:r,title:f("common.closeEsc"),children:"×"})]})]}),document.body)}const wx=/^([ \t]*)(\d{1,3})([.)])([ \t]+)/,bx=/^([ \t]*)([a-zA-Z])\)([ \t]+)/,yx=/^([ \t]*)([-*•])([ \t]+)/;function nm(t){const e=wx.exec(t);if(e!==null){const[a,y="",v="",o=".",c=" "]=e;return{kind:"number",indent:y,value:Number(v),upper:!1,sep:o,space:c,length:a.length}}const r=bx.exec(t);if(r!==null){const[a,y="",v="a",o=" "]=r;return{kind:"letter",indent:y,value:v.toLowerCase().charCodeAt(0)-97,upper:v!==v.toLowerCase(),sep:")",space:o,length:a.length}}const l=yx.exec(t);if(l!==null){const[a,y="",v="-",o=" "]=l;return{kind:"bullet",indent:y,value:0,upper:!1,sep:v,space:o,length:a.length}}return null}function rm(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 r=String.fromCharCode(97+e);return`${t.indent}${t.upper?r.toUpperCase():r}${t.sep}${t.space}`}function kx(t,e){return t.kind===e.kind&&t.indent===e.indent&&t.sep===e.sep&&t.upper===e.upper}function Sv(t,e,r){if(e!==r)return null;const l=t.lastIndexOf(`
|
|
58
|
+
`,e-1)+1,a=t.indexOf(`
|
|
59
|
+
`,e),y=a===-1?t.length:a,v=t.slice(l,y),o=nm(v);if(o===null||e-l<o.length)return null;if(v.slice(o.length).trim().length===0)return{from:l,to:y,text:"",caret:l};const c=rm(o,o.value+1);if(c===null)return null;let m="",w=y;if(o.kind!=="bullet"){let d=o.value+1;for(;w<t.length;){const k=w+1,L=t.indexOf(`
|
|
60
|
+
`,k),M=L===-1?t.length:L,b=t.slice(k,M),h=nm(b);if(h===null||!kx(o,h)||h.value!==d)break;const _=rm(h,h.value+1);if(_===null)break;m+=`
|
|
61
|
+
${_}${b.slice(h.length)}`,d+=1,w=M}}return{from:e,to:w,text:`
|
|
62
|
+
${c}${t.slice(e,y)}${m}`,caret:e+1+c.length}}const Cx=768,xx=`(max-width: ${Cx}px)`,Sx="(hover: none)",sm="agent-workbench.narrow-view",Ev="tab",Tv=["chat","cli","git","files","plans","memory","notes","console"];function Ex(t){return typeof t=="string"&&Tv.includes(t)}function Tx(t){return Ex(t)?t:null}function Lx(t){const e=t.hidden??new Set,r=l=>l==="chat"||l==="cli"||!e.has(l);return t.hasTab?Tv.filter(l=>(l!=="plans"||t.plansAvailable)&&r(l)):["chat","notes"].filter(r)}function Nx(t,e){return e.includes(t)?t:"chat"}function im(t){switch(t){case"cli":case"git":case"files":case"plans":case"memory":return t;default:return null}}const Rx={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 Mx(t){return Rx[t]}const Ax=/^[A-Za-z0-9_-]{1,80}$/;function Ix(t){const e=new URLSearchParams(t).get(Ev);return e!==null&&Ax.test(e)?e:null}function jx(t,e){const r=new URLSearchParams(t);for(const a of e)r.delete(a);const l=r.toString();return l.length>0?`?${l}`:""}function tr(t){return{id:`ctrl-${t.toLowerCase()}`,label:`^${t}`,data:String.fromCharCode(t.charCodeAt(0)&31),titleKey:"narrow.keys.ctrl",titleParams:{letter:t}}}const Lv={id:"enter",label:"Enter",data:"\r",titleKey:"narrow.keys.enter",primary:!0},Dx=["1","2","3"].map(t=>({id:`option-${t}`,label:t,data:t,titleKey:"narrow.keys.number",titleParams:{number:t}})),Nv={id:"esc",label:"Esc",data:"\x1B",titleKey:"narrow.keys.esc"},Rv={id:"tab",label:"Tab",data:" ",titleKey:"narrow.keys.tab"},Mv={id:"shift-tab",label:"⇧Tab",data:"\x1B[Z",titleKey:"narrow.keys.shiftTab"},Av={id:"up",label:"↑",data:"\x1B[A",titleKey:"narrow.keys.up"},Iv={id:"down",label:"↓",data:"\x1B[B",titleKey:"narrow.keys.down"},jv={id:"left",label:"←",data:"\x1B[D",titleKey:"narrow.keys.left"},Dv={id:"right",label:"→",data:"\x1B[C",titleKey:"narrow.keys.right"},Pv={id:"interrupt",label:"^C",data:"",titleKey:"narrow.keys.interrupt"},Ov={id:"ctrl-o",label:"^O",data:"",titleKey:"narrow.keys.ctrlO"},Bv={id:"ctrl-t",label:"^T",data:"",titleKey:"narrow.keys.ctrlT"},Fv={id:"ctrl-x",label:"^X",data:"",titleKey:"narrow.keys.ctrlX"},Px={id:"home",label:"Home",data:"\x1B[H",titleKey:"narrow.keys.home"},Ox={id:"end",label:"End",data:"\x1B[F",titleKey:"narrow.keys.end"},Bx={id:"page-up",label:"PgUp",data:"\x1B[5~",titleKey:"narrow.keys.pageUp"},Fx={id:"page-down",label:"PgDn",data:"\x1B[6~",titleKey:"narrow.keys.pageDown"},Hx={id:"delete",label:"Del",data:"\x1B[3~",titleKey:"narrow.keys.delete"},Ux=[Lv,...Dx,Nv,Av,Iv,jv,Dv,Rv,Mv,Pv,Ov,Bv,Fv],$x=[[Lv,Rv,Mv,Nv,Av,Iv,jv,Dv,Px,Ox,tr("A"),tr("E"),Bx,Fx,Hx],[Pv,Ov,Fv,tr("K"),tr("U"),tr("W"),tr("R"),tr("L"),tr("D"),tr("Z"),tr("G"),Bv,tr("V"),tr("Y")]];function Wx(t){return t==="console"?$x:[Ux]}function qx(t,e){return t.shiftKey||t.altKey?!1:!e||t.ctrlKey||t.metaKey}const zx="AgentWorkbenchAndroid/",Kx="agentworkbench://settings",Vx="agentworkbench://disconnect",om="agentWorkbenchBack";function Hv(t){return t.includes(zx)}function Gx(t){return t.dialogOpen?"close-dialog":t.sheetOpen?"close-sheet":t.drawerOpen?"close-drawer":t.view!=="chat"?"show-chat":null}function Yx(t){return t.map(e=>{const r=e.data.endsWith("==")?2:e.data.endsWith("=")?1:0;return{name:e.name,base64:e.data,bytes:e.data.length/4*3-r}})}function lm(t,e){const r=e.replace(/^\s*\n/,"").trimEnd();if(r.trim().length===0)return null;const l=t.trimEnd();return{from:l.length,inserted:l.length===0?r:`
|
|
63
|
+
|
|
64
|
+
${r}`}}function Xx(t,e,r){const l=[];return t.forEach((a,y)=>{const v=e[a.imageId];if(typeof v!="string")return;const o=Jx(v);o!==null&&l.push({...o,dataUrl:v,name:r(y)})}),l}function Qx(t,e){return t.every(r=>e[r.imageId]!==void 0)}function Jx(t){const e=/^data:([^;,]+);base64,([A-Za-z0-9+/]*={0,2})$/.exec(t),r=e==null?void 0:e[1],l=e==null?void 0:e[2];if(r===void 0||l===void 0)return null;const a=l.endsWith("==")?2:l.endsWith("=")?1:0;return{mediaType:r,base64:l,bytes:l.length/4*3-a}}function Ht(t){if(!wb(t.key))return t.key;let e;if(t.params!==void 0){const r={};for(const[l,a]of Object.entries(t.params))r[l]=typeof a=="object"?Ht(a):a;e=r}return f(`server.${t.key}`,e)}const Uv=3600*1e3;function $v(t){const e=new Date(t+Uv);e.setSeconds(0,0);const r=new Date(t);return r.setDate(r.getDate()+1),r.setHours(9,0,0,0),[{id:"in-hour",at:e.getTime()},{id:"tomorrow-morning",at:r.getTime()}]}function Ha(t){return String(t).padStart(2,"0")}function Ed(t){const e=new Date(t);return`${e.getFullYear()}-${Ha(e.getMonth()+1)}-${Ha(e.getDate())}`}function Zx(t){const e=new Date(t);return`${Ha(e.getHours())}:${Ha(e.getMinutes())}`}function e1(t){var r;const e=((r=$v(t)[1])==null?void 0:r.at)??t+24*Uv;return{date:Ed(e),time:Zx(e)}}function t1(t){return{min:Ed(t),max:Ed(t+md)}}function n1(t,e){const r=/^(\d{4})-(\d{2})-(\d{2})$/.exec(t),l=/^(\d{2}):(\d{2})$/.exec(e);if(r===null||l===null)return null;const[a,y,v]=[Number(r[1]),Number(r[2]),Number(r[3])],[o,c]=[Number(l[1]),Number(l[2])];if(y<1||y>12||v<1||v>31||o>23||c>59)return null;const m=new Date(a,y-1,v,o,c,0,0);return m.getFullYear()!==a||m.getMonth()!==y-1||m.getDate()!==v?null:m.getTime()}function r1(t,e){return t===null?f("scheduled.menu.invalid"):t<=e?f("scheduled.menu.past"):t-e>md?f("scheduled.menu.tooFar",{days:Math.round(md/864e5)}):null}function s1(t,e){const r=cl(t);return t>e?f("scheduled.when.ahead",{when:r,left:nh(t-e)}):r}function i1(t,e){switch(t.state){case"scheduled":return f("scheduled.state.scheduled",{when:s1(t.sendAt,e)});case"waiting":return t.note===null?f("scheduled.state.due"):Ht(t.note);case"sending":return f("scheduled.state.sending");case"paused":return f("scheduled.state.paused",{when:cl(t.sendAt)});case"failed":return t.note===null?f("scheduled.state.failed"):Ht(t.note)}}function o1(t,e){return t===null||e===null?[]:t.filter(r=>r.terminalId===e).sort((r,l)=>r.sendAt-l.sendAt)}function Wv(t){if(t.length===0)return null;const e=t.filter(l=>l.state==="failed").length;if(e>0)return f("scheduled.tab.failed",{count:e});const r=t[0];return r===void 0?null:f("scheduled.tab.next",{count:t.length,when:cl(r.sendAt)})}function l1(t){return t.some(e=>e.state==="failed")}function a1(t){const e=t.filter(l=>l.state!=="failed"),r=e[0];return r===void 0?null:f("scheduled.close.warning",{count:e.length,when:cl(r.sendAt)})}function c1(t){return t.state!=="sending"}const u1={"in-hour":"scheduled.menu.inHour","tomorrow-morning":"scheduled.menu.tomorrow"};function d1({anchor:t,onPick:e,onClose:r}){const[l]=N.useState(()=>Date.now()),a=N.useMemo(()=>$v(l),[l]),y=N.useMemo(()=>t1(l),[l]),[v,o]=N.useState(()=>e1(l)),c=n1(v.date,v.time),m=r1(c,Date.now()),[w,d]=N.useState(null),k=N.useRef(null),L=N.useRef(null),M=N.useRef(!1),b=N.useCallback(()=>{const h=k.current;if(h===null)return;const _=t.getBoundingClientRect(),g=h.getBoundingClientRect();d(fv({left:_.left,top:_.top,bottom:_.bottom},{width:g.width,height:g.height},{width:window.innerWidth,height:window.innerHeight}))},[t]);return N.useLayoutEffect(b,[b]),N.useEffect(()=>{var h;w===null||M.current||(M.current=!0,(h=L.current)==null||h.focus())},[w]),N.useEffect(()=>{const h=T=>{T.key==="Escape"&&(T.preventDefault(),T.stopPropagation(),r(),t.focus())},_=T=>{var E;const A=T.target;A instanceof Node&&((E=k.current)!=null&&E.contains(A)||t.contains(A))||r()},g=T=>{pv(T.target,t,k.current)&&r()},p=()=>{t.isConnected?b():r()};return window.addEventListener("keydown",h,!0),document.addEventListener("pointerdown",_,!0),window.addEventListener("scroll",g,!0),window.addEventListener("resize",p),()=>{window.removeEventListener("keydown",h,!0),document.removeEventListener("pointerdown",_,!0),window.removeEventListener("scroll",g,!0),window.removeEventListener("resize",p)}},[t,r,b]),rh.createPortal(i.jsxs("div",{ref:k,className:"schedule-menu",role:"dialog","aria-label":f("scheduled.menu.title"),style:w===null?{left:0,top:0,visibility:"hidden"}:{left:`${w.left}px`,top:`${w.top}px`},children:[i.jsx("div",{className:"schedule-menu-title",children:f("scheduled.menu.title")}),a.map((h,_)=>i.jsxs("button",{ref:_===0?L:void 0,className:"schedule-menu-item",onClick:()=>e(h.at),children:[i.jsx("span",{className:"schedule-menu-label",children:f(u1[h.id])}),i.jsx("span",{className:"schedule-menu-when",children:cl(h.at)})]},h.id)),i.jsxs("div",{className:"schedule-menu-custom",children:[i.jsxs("label",{className:"schedule-menu-field",children:[i.jsx("span",{children:f("scheduled.menu.day")}),i.jsx("input",{type:"date",value:v.date,min:y.min,max:y.max,onChange:h=>o(_=>({..._,date:h.target.value}))})]}),i.jsxs("label",{className:"schedule-menu-field",children:[i.jsx("span",{children:f("scheduled.menu.time")}),i.jsx("input",{type:"time",value:v.time,onChange:h=>o(_=>({..._,time:h.target.value}))})]}),i.jsx("button",{className:"primary-button primary-button-small",disabled:m!==null||c===null,title:m??void 0,onClick:()=>{c!==null&&e(c)},children:f("scheduled.menu.schedule")})]}),m!==null&&i.jsx("p",{className:"schedule-menu-hint",children:m})]}),document.body)}const h1=6e4,f1=10*6e4,p1=15e3,m1=4e3,g1=3,qv={runStartedAt:null,busySeenAt:null};function Td(){return`submit-${typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}`}function v1(t,e){var l;let r=0;if(t!==null){const a=e.findIndex(y=>y.eventId===t);if(a===-1)return!0;r=a+1}for(let a=r;a<e.length;a+=1)if(((l=e[a])==null?void 0:l.role)==="assistant")return!0;return!1}function _1(t,e,r,l){const a=e==="busy"||t==="busy"?l:r.busySeenAt;let y=null;return e==="busy"?t==="idle"?y=l:(t==="busy"||t==="waiting")&&(y=r.runStartedAt):e==="waiting"&&(y=r.runStartedAt),{runStartedAt:y,busySeenAt:a}}function w1(t,e,r,l){const a=new Map;for(const[y,v]of e){const o=t.get(y),c=r.get(y);a.set(y,c!==void 0&&o===v?c:_1(o,v,c??qv,l))}return a}function b1(t,e){const r=new Map;for(const[l,a]of t)a.phase!=="sending"?r.set(l,a):a.queued&&r.set(l,{...a,queued:!1,sentAt:e});return r}function y1(t,e,r){const l=t.get(e.terminalId);if(l===void 0||l.requestId!==e.requestId)return t;const a=new Map(t);return e.delivered?a.set(e.terminalId,{...l,phase:"delivered",queued:!1,deliveredAt:r}):a.delete(e.terminalId),a}function k1(t){if(!t.live||t.waitingFor!==null)return null;const{receipt:e,activity:r,now:l}=t,a=t.clock??qv;if((e==null?void 0:e.phase)==="sending"&&(e.queued||l-e.sentAt<h1))return{kind:"sending"};const y=(e==null?void 0:e.phase)==="delivered"?e.deliveredAt:null;return r==="busy"?{kind:"working",since:a.runStartedAt,justDelivered:y!==null&&l-y<m1}:e===null||y===null||v1(e.afterEventId,t.events)?null:r==="unknown"?l-y<f1?{kind:"awaiting-reply",since:y}:null:r!=="idle"&&r!==null||a.busySeenAt!==null&&a.busySeenAt>=e.sentAt?null:l-y<p1?{kind:"delivered"}:null}function C1(t,e){switch(t.kind){case"sending":return f("thread.status.sending");case"delivered":return f("thread.status.delivered");case"working":{const r=t.since===null?0:e-t.since;if(r<1e3)return t.justDelivered?f("thread.status.workingDelivered"):f("thread.status.working");const l={elapsed:rl(r)};return t.justDelivered?f("thread.status.workingForDelivered",l):f("thread.status.workingFor",l)}case"awaiting-reply":{const r=e-t.since;return r<1e3?f("thread.status.delivered"):f("thread.status.awaitingReply",{elapsed:rl(r)})}}}function x1(t,e){const r=t.slice(0,g1).map(a=>f("thread.status.subagent",{name:a.description.length>0?a.description:f("thread.status.subagentUnnamed"),elapsed:rl(Math.max(0,e-a.startedAt))})),l=t.length-r.length;return l>0&&r.push(f("thread.status.subagentsMore",{count:l})),f("thread.status.subagents",{count:t.length,list:En(r)})}const S1=5,E1=1200;function zo(){return crypto.randomUUID()}function T1(t=!0){const[e,r]=N.useState([]),[l,a]=N.useState(null),y=N.useCallback(h=>{if(e.filter(g=>g.kind==="image").length>=qo){a(f("composer.problem.tooManyImages",{count:qo}));return}if(h.size>ni){const g=Math.round(h.size/1024/1024),p=ni/1024/1024;a(h.name.length>0?f("composer.problem.tooBig",{name:h.name,size:g,max:p}):f("composer.problem.imageTooBig",{size:g,max:p}));return}const _=new FileReader;_.onload=()=>{const g=_.result;if(typeof g!="string")return;const p=g.indexOf(",");p!==-1&&r(T=>T.filter(A=>A.kind==="image").length>=qo?T:[...T,{id:zo(),kind:"image",mediaType:h.type,base64:g.slice(p+1),dataUrl:g,bytes:h.size,name:h.name.length>0?h.name:f("composer.pastedImage")}])},_.onerror=()=>a(f("composer.problem.imageUnreadable")),_.readAsDataURL(h)},[e]),v=N.useCallback(h=>{if(e.filter(g=>g.kind==="file").length>=ri){a(f("composer.problem.tooManyFiles",{count:ri}));return}if(h.size===0){a(f("composer.problem.empty",{name:h.name}));return}if(h.size>Ki){a(f("composer.problem.tooBig",{name:h.name,size:Math.round(h.size/1024/1024),max:Ki/1024/1024}));return}const _=new FileReader;_.onload=()=>{const g=_.result;if(typeof g!="string")return;const p=g.indexOf(",");p!==-1&&r(T=>T.filter(A=>A.kind==="file").length>=ri?T:[...T,{id:zo(),kind:"file",name:h.name.length>0?h.name:"archivo",base64:g.slice(p+1),bytes:h.size}])},_.onerror=()=>a(f("composer.problem.unreadable",{name:h.name})),_.readAsDataURL(h)},[e]),o=N.useCallback(h=>{const _=Array.from(h),g=_.filter(T=>T.type.startsWith("image/")),p=_.filter(T=>!T.type.startsWith("image/"));if(g.length>0&&!t)a($p());else for(const T of g)y(T);for(const T of p)v(T)},[y,v,t]),c=N.useCallback((h,_=[])=>{if(h.files.length>0)return o(h.files),{consumed:!0,pastedNumber:null};const g=h.getData("text/plain");if(g.length===0)return{consumed:!1,pastedNumber:null};if(g.split(`
|
|
65
|
+
`).length<S1&&g.length<E1)return{consumed:!1,pastedNumber:null};const p=_v([...e.flatMap(T=>T.kind==="text"?[T.number]:[]),..._]);return r(T=>[...T,{id:zo(),kind:"text",number:p,text:g,lines:nl(g)}]),{consumed:!0,pastedNumber:p}},[o,e]),m=N.useCallback(h=>{if(h.length===0)return;if(!t){a($p());return}const _=qo-e.filter(A=>A.kind==="image").length,g=h.filter(A=>A.bytes<=ni),p=h.find(A=>A.bytes>ni);p!==void 0&&a(f("composer.problem.imageTooBig",{size:Math.round(p.bytes/1024/1024),max:ni/1024/1024})),g.length>_&&a(f("composer.problem.tooManyImages",{count:qo}));const T=g.slice(0,Math.max(0,_)).map(A=>({...A,id:zo(),kind:"image"}));T.length>0&&r(A=>[...A,...T])},[e,t]),w=N.useCallback(h=>{if(h.length===0)return!0;const _=ri-e.filter(g=>g.kind==="file").length;if(h.length>_)return a(f("composer.problem.tooManyFiles",{count:ri})),!1;for(const g of h){if(g.bytes===0)return a(f("composer.problem.empty",{name:g.name})),!1;if(g.bytes>Ki)return a(f("composer.problem.tooBig",{name:g.name,size:Math.round(g.bytes/1024/1024),max:Ki/1024/1024})),!1}return r(g=>[...g,...h.map(p=>({...p,id:zo(),kind:"file"}))]),!0},[e]),d=N.useCallback(h=>{r(_=>_.filter(g=>g.id!==h))},[]),k=N.useCallback((h,_)=>{r(g=>g.map(p=>p.id===h&&p.kind==="text"?{...p,text:_,lines:nl(_)}:p))},[]),L=N.useCallback(h=>{r(h),a(null)},[]),M=N.useCallback(()=>L([]),[L]),b=N.useCallback(()=>a(null),[]);return{items:e,problem:l,acceptPaste:c,acceptFiles:o,acceptImages:m,acceptStoredFiles:w,remove:d,updateText:k,replace:L,clear:M,dismissProblem:b}}const L1=3e4,N1=5e3,ws={phase:"idle",mode:null};function R1(t){const{connection:e,terminalId:r,disabled:l,nativeVoice:a,blocked:y,onDictated:v,onHeldSpace:o}=t,[c,m]=N.useState(ws),[w,d]=N.useState(null),k=N.useRef(null),L=N.useRef(ws),M=N.useCallback(D=>{L.current=D,m(D)},[]),b=N.useMemo(()=>(a==null?void 0:a.modes)??[],[a]),h=!l&&a!==null&&b.length>0,_=N.useRef({terminalId:r,disabled:l,nativeVoice:a,blocked:y,onDictated:v,onHeldSpace:o,available:h});_.current={terminalId:r,disabled:l,nativeVoice:a,blocked:y,onDictated:v,onHeldSpace:o,available:h};const g=N.useCallback((D=!1)=>{const P=k.current;P!==null&&(k.current=null,M(!D&&P.mode==="dictation"?{phase:"transcribing",mode:"dictation"}:ws),e.send({type:"agent.voice",terminalId:P.terminalId,mode:P.mode,action:D?"cancel":"stop"}))},[e,M]),p=N.useCallback((D,P=!1)=>{const{terminalId:F,disabled:z,nativeVoice:q,blocked:K}=_.current;if(D===null||F===null||z||q===null||k.current!==null||L.current.phase!=="idle")return!1;const V=q.modes.find(W=>W.mode===D);return V===void 0||D==="dictation"&&K||!e.send({type:"agent.voice",terminalId:F,mode:D,action:"start"})?!1:(k.current={terminalId:F,mode:D,hold:Cd(V.control),bySpace:P},d(null),M({phase:"listening",mode:D}),!0)},[e,M]),T=N.useCallback(D=>{const P=k.current;if(P!==null){P.mode===D&&g(!1);return}p(D)},[g,p]),A=N.useMemo(()=>new ZC({canStart:()=>{var P;const D=Xp(((P=_.current.nativeVoice)==null?void 0:P.modes)??[]);return D!==null&&_.current.available&&k.current===null&&L.current.phase==="idle"&&!(D==="dictation"&&_.current.blocked)},onHold:D=>{var P;_.current.onHeldSpace(D),p(Xp(((P=_.current.nativeVoice)==null?void 0:P.modes)??[]),!0)},onRelease:()=>{const D=k.current;D!==null&&D.bySpace&&D.hold&&g(!1)},schedule:(D,P)=>window.setTimeout(D,P),unschedule:D=>window.clearTimeout(D)}),[g,p]);N.useEffect(()=>(M(ws),d(null),()=>{A.cancel();const D=k.current;D!==null&&(k.current=null,e.send({type:"agent.voice",terminalId:D.terminalId,mode:D.mode,action:"cancel"}))}),[e,A,M,r]),N.useEffect(()=>{l&&(A.cancel(),g(!0))},[l,g,A]),N.useEffect(()=>{const D=()=>{A.cancel(),g(!0)},P=()=>{document.hidden&&D()};window.addEventListener("blur",D),document.addEventListener("visibilitychange",P);const F=e.onStatus(q=>{q!=="open"&&(A.cancel(),k.current=null,M(ws))}),z=e.onMessage(q=>{if(q.type==="agent.voice.status"){if(q.terminalId!==_.current.terminalId||q.active)return;const K=k.current;K!==null&&K.mode===q.mode&&(k.current=null),M(q.transcribing===!0?{phase:"transcribing",mode:q.mode}:ws);return}if(q.type==="agent.voice.text"){if(q.outcome==="text"&&q.text.trim().length>0&&_.current.onDictated(q.terminalId,q.text.trim()),q.terminalId!==_.current.terminalId)return;M(ws),q.outcome!=="text"&&d(q.outcome)}});return()=>{window.removeEventListener("blur",D),document.removeEventListener("visibilitychange",P),F(),z()}},[e,g,A,M]),N.useEffect(()=>{if(c.phase!=="transcribing")return;const D=window.setTimeout(()=>M(ws),L1);return()=>window.clearTimeout(D)},[M,c.phase]),N.useEffect(()=>{if(w===null)return;const D=window.setTimeout(()=>d(null),N1);return()=>window.clearTimeout(D)},[w]);const E=N.useMemo(()=>b.map(D=>{const P=D.mode,F=Cd(D.control),z=c.phase==="listening"&&c.mode===P,q=c.phase==="transcribing"&&c.mode===P,K=l||c.phase!=="idle"&&!z||P==="dictation"&&y;return{mode:P,hold:F,active:z,busy:q,disabled:!z&&K,props:{onPointerDown:W=>{F&&(W.preventDefault(),W.currentTarget.focus(),W.currentTarget.setPointerCapture(W.pointerId),p(P))},onPointerUp:()=>{var W;((W=k.current)==null?void 0:W.mode)===P&&k.current.hold&&g(!1)},onPointerCancel:()=>{var W;((W=k.current)==null?void 0:W.mode)===P&&g(!0)},onLostPointerCapture:()=>{var W;((W=k.current)==null?void 0:W.mode)===P&&k.current.hold&&g(!0)},onKeyDown:W=>{!F||W.key!==" "&&W.key!=="Enter"||(W.preventDefault(),W.repeat||p(P))},onKeyUp:W=>{var O;!F||W.key!==" "&&W.key!=="Enter"||(W.preventDefault(),((O=k.current)==null?void 0:O.mode)===P&&g(!1))},onBlur:()=>{var W;((W=k.current)==null?void 0:W.mode)===P&&k.current.hold&&g(!0)},onClick:()=>{F||T(P)}}}}),[y,l,g,b,p,c.mode,c.phase,T]),S=N.useCallback(D=>{const P=D.currentTarget;return A.keyDown({key:D.key,repeat:D.repeat,shiftKey:D.shiftKey,ctrlKey:D.ctrlKey,altKey:D.altKey,metaKey:D.metaKey,isComposing:D.nativeEvent.isComposing},{value:P.value,start:P.selectionStart,end:P.selectionEnd})},[A]),x=N.useCallback(D=>A.keyUp({key:D.key}),[A]),R=N.useCallback(()=>{A.cancel();const D=k.current;D!==null&&D.bySpace&&D.hold&&g(!1)},[g,A]),I=N.useCallback(()=>k.current===null?!1:(A.cancel(),g(!0),!0),[g,A]);return{controls:E,available:h,dictating:c.mode==="dictation"&&c.phase!=="idle",notice:w,dismissNotice:()=>d(null),textKeyDown:S,textKeyUp:x,textBlur:R,cancelListening:I}}function Oa({min:t,max:e,value:r,measure:l,onChange:a,onCommit:y,onStart:v}){const o=N.useRef(!1),c=N.useRef(r),m=N.useCallback(k=>{o.current=!0,c.current=r,v==null||v(k),k.currentTarget.setPointerCapture(k.pointerId),k.preventDefault()},[v,r]),w=N.useCallback(k=>{if(!o.current)return;const L=Math.min(e,Math.max(t,l(k)));c.current=L,a(L)},[e,t,l,a]),d=N.useCallback(k=>{o.current&&(o.current=!1,k.currentTarget.releasePointerCapture(k.pointerId),y(c.current))},[y]);return{onPointerDown:m,onPointerMove:w,onPointerUp:d,onPointerCancel:d}}function zv(t){const[e,r]=N.useState(()=>typeof window<"u"&&window.matchMedia(t).matches);return N.useEffect(()=>{const l=window.matchMedia(t),a=()=>r(l.matches);return a(),l.addEventListener("change",a),()=>l.removeEventListener("change",a)},[t]),e}function M1(){return zv(xx)}function A1(){return zv(Sx)}function I1(t){if(t.disabled||t.text.length>0||t.attachments>0)return null;const e=t.suggestion??null;return e!==null&&e.trim().length>0?e:null}function j1(t){return t.key==="Tab"&&!t.shiftKey&&!t.altKey&&!t.ctrlKey&&!t.metaKey&&!t.isComposing}function am(t,e,r){if((t.get(e)??null)===r)return t;const l=new Map(t);return r===null?l.delete(e):l.set(e,r),l}const Kv="agent_workbench_prefs",Ld="agent-workbench.",Vv=/^[a-z0-9][a-z0-9.-]{0,59}$/,Gv=200,D1=400*24*60*60,P1=3500;function O1(t){const e=new Map;for(const r of t.split(";")){const l=r.indexOf("=");if(l===-1||r.slice(0,l).trim()!==Kv)continue;let a;try{a=JSON.parse(decodeURIComponent(r.slice(l+1).trim()))}catch{return e}if(a===null||typeof a!="object"||Array.isArray(a))return e;for(const[y,v]of Object.entries(a))!Vv.test(y)||typeof v!="string"||v.length>Gv||e.set(`${Ld}${y}`,v);return e}return e}function B1(t){const e={};for(const[l,a]of t){if(!l.startsWith(Ld))continue;const y=l.slice(Ld.length);!Vv.test(y)||a.length>Gv||(e[y]=a)}const r=encodeURIComponent(JSON.stringify(e));return r.length>P1?null:r}function F1(t){return`${Kv}=${t}; Path=/; Max-Age=${D1}; SameSite=Strict`}function Yv(){try{return O1(document.cookie)}catch{return new Map}}function Xv(t,e){const r=Yv();if(r.get(t)===e)return;r.set(t,e);const l=B1(r);if(l!==null)try{document.cookie=F1(l)}catch{}}function Wt(t,e,r){const l=Yv().get(t);if(l!==void 0){const a=r(l);if(a!==null)return a}try{const a=window.localStorage.getItem(t);if(a===null)return e;const y=r(a);return y===null?e:(l===void 0&&Xv(t,a),y)}catch{return e}}function jt(t,e){Xv(t,e);try{window.localStorage.setItem(t,e)}catch{}}function H1(t,e,r){const l=Number.parseInt(t,10);return Number.isFinite(l)&&l>=e&&l<=r?l:null}const cm=90,U1=260,um=720,dm="agent-workbench.composer-height";function hm(t){return{selectionStart:t.selectionStart,selectionEnd:t.selectionEnd,backward:t.selectionDirection==="backward",scrollTop:t.scrollTop}}function $1({connection:t,drafts:e,terminalId:r,alive:l,nativeVoice:a=null,voiceBlocked:y=!1,sleeping:v=!1,projectColor:o,activity:c,controls:m,leading:w,imagesAllowed:d=!0,blockedReason:k=null,prefills:L,onPrefillApplied:M,notice:b=null,onDismissNotice:h,onSubmitted:_,fontSize:g,insertRef:p,noteInsertRef:T,onEditQueue:A,onSchedule:E,codexQueueAvailable:S=!1,codexQueueSessionId:x=null,suggestion:R=null}){const[I,D]=N.useState(""),[P,F]=N.useState(!1),[z,q]=N.useState(null),[K,V]=N.useState(()=>new Map),[W,O]=N.useState(null),U=N.useRef(new Map),H=T1(d),$=N.useRef(null),Z=A1(),re=r===null||!l,we=I1({suggestion:R,text:I,attachments:H.items.length,disabled:r===null||!l}),_e=N.useRef(we);_e.current=we;const[Q,Y]=N.useState(()=>Wt(dm,U1,se=>H1(se,cm,um))),[te,ee]=N.useState(!1),ye=N.useCallback(()=>{const se=$.current;if(se===null)return;se.style.height="auto";const ke=se.offsetHeight-se.clientHeight,be=se.value.length===0?_e.current:null;be!==null&&(se.value=be);const lt=se.scrollHeight+ke;be!==null&&(se.value="");const ut=te?Q:Math.min(lt,Q);se.style.height=`${ut}px`,se.style.overflowY=lt>ut?"auto":"hidden"},[Q,te]);N.useEffect(ye,[I,ye,g,we]);const ge=N.useRef(0),Be=N.useRef(0),Ue=Oa({min:cm,max:um,value:Q,measure:N.useCallback(se=>ge.current-se.clientY-Be.current,[]),onChange:Y,onCommit:N.useCallback(se=>{ee(!1),jt(dm,String(se))},[]),onStart:N.useCallback(se=>{const ke=$.current,be=ke==null?void 0:ke.getBoundingClientRect();ge.current=(be==null?void 0:be.bottom)??se.clientY,Be.current=((be==null?void 0:be.bottom)??se.clientY)-se.clientY-((be==null?void 0:be.height)??0),ee(!0)},[])}),ze=N.useRef(null),[gt,Fe]=N.useState(0),pt=N.useCallback(()=>Fe(se=>se+1),[]),yt=N.useRef(I);yt.current=I;const oe=N.useRef(H.items);oe.current=H.items;const{replace:Ae}=H;N.useEffect(()=>t.onMessage(se=>{if(se.type!=="agent.codexQueueResult")return;const ke=U.current.get(se.requestId);ke===void 0||ke!==se.terminalId||(U.current.delete(se.requestId),V(be=>{const lt=new Map(be);return lt.delete(se.requestId),lt}),O({terminalId:se.terminalId,result:se.result}))}),[t]),N.useEffect(()=>{const se=ze.current;se!==null&&e.put(se,{text:I,items:H.items})},[I,H.items,e]),N.useEffect(()=>{var be;const se=ze.current;if(se===r)return;if(ze.current=r,se!==null){e.put(se,{text:yt.current,items:oe.current});const lt=$.current;lt!==null&&e.rememberView(se,hm(lt))}const ke=r===null?void 0:e.get(r);D((ke==null?void 0:ke.text)??""),Ae((ke==null?void 0:ke.items)??[]),pt(),r!==null&&((be=$.current)==null||be.focus())},[r,Ae,e,pt]),N.useEffect(()=>()=>{const se=ze.current;se!==null&&e.put(se,{text:yt.current,items:oe.current})},[e]),N.useLayoutEffect(()=>()=>{const se=ze.current,ke=$.current;se!==null&&ke!==null&&e.rememberView(se,hm(ke))},[e]),N.useEffect(()=>{if(gt===0)return;const se=ze.current,ke=$.current;if(se===null||ke===null)return;const be=hx(ke.value.length,e.viewOf(se));ke.setSelectionRange(be.start,be.end,be.direction),ke.scrollTop=be.scrollTop==="end"?ke.scrollHeight:be.scrollTop},[gt,e]),N.useEffect(()=>e.onRestored(se=>{if(se!==ze.current)return;const ke=e.get(se);ke!==void 0&&(D(ke.text),Ae(ke.items),pt())}),[e,Ae,pt]);const De=N.useRef(new Set);N.useEffect(()=>{var se;if(!(L===void 0||L.length===0)){for(const ke of L)if(!De.current.has(ke.id)){if(De.current.add(ke.id),ke.terminalId===ze.current&&ke.pasted.length===0)D(be=>eh(be,ke.text)),ke.focus&&((se=$.current)==null||se.focus());else if(ke.terminalId===ze.current){const be=Zp({text:yt.current,items:oe.current},ke,()=>crypto.randomUUID());D(be.text),Ae(be.items)}else{const be=e.get(ke.terminalId);e.put(ke.terminalId,Zp({text:(be==null?void 0:be.text)??"",items:(be==null?void 0:be.items)??[]},ke,()=>crypto.randomUUID()))}M==null||M(ke.id)}}},[L,M,e,Ae]);const Le=N.useCallback((se,ke)=>{const be=$.current;if(se===ze.current&&be!==null&&!be.disabled){const wt=Pu(be.value,be.selectionStart,be.selectionEnd,ke);be.focus();let Nt=!1;try{Nt=document.execCommand("insertText",!1,wt)}catch{Nt=!1}Nt||(be.setRangeText(wt,be.selectionStart,be.selectionEnd,"end"),D(be.value));return}if(se===ze.current){D(wt=>`${wt}${Pu(wt,wt.length,wt.length,ke)}`);return}const lt=e.get(se),ut=(lt==null?void 0:lt.text)??"";e.put(se,{text:`${ut}${Pu(ut,ut.length,ut.length,ke)}`,items:(lt==null?void 0:lt.items)??[]})},[e]),nt=N.useCallback(se=>{const ke=$.current;if(ke===null)return;const be=JC(se,ke.value,ke.selectionStart);if(be===null)return;ke.setSelectionRange(be.from,be.to);let lt=!1;try{lt=document.execCommand("delete")}catch{lt=!1}lt||(ke.setRangeText("",be.from,be.to,"end"),D(ke.value))},[]),je=R1({connection:t,terminalId:r,disabled:re,nativeVoice:a,blocked:y,onDictated:Le,onHeldSpace:nt}),Ke=je.dictating,kt=N.useCallback(()=>{if(r===null||k!==null||Ke)return;const se=H.items.filter(Nt=>Nt.kind==="text").map(Nt=>({number:Nt.number,text:Nt.text})),ke=H.items.filter(Nt=>Nt.kind==="image").map(Nt=>({mediaType:Nt.mediaType,data:Nt.base64})),be=H.items.filter(Nt=>Nt.kind==="file").map(Nt=>({name:Nt.name,data:Nt.base64})),lt=Jo(se,I);if(lt.length===0&&ke.length===0&&be.length===0)return;const ut=Td(),wt=t.send({type:"agent.submit",terminalId:r,text:lt,images:ke,...be.length>0?{files:be}:{},requestId:ut});e.submitted(r,wt,ut,{text:I,items:H.items}),D(""),H.clear(),_==null||_(r,ut,!wt)},[t,e,r,I,H,k,_,Ke]),Lt=N.useCallback(()=>{if(r===null||!S||x===null||k!==null||H.items.some(ut=>ut.kind!=="text"))return;const se=H.items.filter(ut=>ut.kind==="text").map(ut=>({number:ut.number,text:ut.text})),ke=Jo(se,I);if(ke.trim().length===0||ke.length>Ru)return;const be=Td(),lt=t.send({type:"agent.codexQueue",terminalId:r,requestId:be,text:ke});U.current.set(be,r),V(ut=>new Map(ut).set(be,r)),O(null),e.submitted(r,lt,be,{text:I,items:H.items}),D(""),H.clear()},[r,S,x,k,H,I,t,e]),xt=N.useCallback(se=>{if(q(null),r===null||E===void 0||H.items.some(ut=>ut.kind!=="text"))return;const ke=H.items.filter(ut=>ut.kind==="text").map(ut=>({number:ut.number,text:ut.text})),be=Jo(ke,I);if(be.trim().length===0)return;const lt=E(r,be,se);e.submitted(r,lt),D(""),H.clear()},[r,E,H,I,e]),vt=N.useCallback(()=>q(null),[]);N.useEffect(()=>q(null),[r]);const dt=E!==void 0;N.useEffect(()=>{dt||q(null)},[dt]);const Qe=N.useCallback(()=>{r!==null&&t.send({type:"agent.interrupt",terminalId:r})},[t,r]),St=N.useCallback((se,ke)=>{se.setSelectionRange(ke.from,ke.to);let be=!1;try{be=ke.text.length>0?document.execCommand("insertText",!1,ke.text):document.execCommand("delete")}catch{be=!1}be||(se.setRangeText(ke.text,ke.from,ke.to,"end"),D(se.value)),se.setSelectionRange(ke.caret,ke.caret)},[]),Ft=N.useCallback(()=>{const se=_e.current,ke=$.current;if(se===null||ke===null)return;ke.focus();let be=!1;try{be=document.execCommand("insertText",!1,se)}catch{be=!1}be||D(se)},[]),Gt=N.useCallback(se=>{if(je.textKeyDown(se)){se.preventDefault();return}if(_e.current!==null&&j1({key:se.key,shiftKey:se.shiftKey,altKey:se.altKey,ctrlKey:se.ctrlKey,metaKey:se.metaKey,isComposing:se.nativeEvent.isComposing})){se.preventDefault(),Ft();return}if(se.key==="Enter"&&qx(se,Z)){se.preventDefault(),kt();return}if(se.key==="Enter"&&!se.nativeEvent.isComposing){const ke=se.currentTarget,be=Sv(ke.value,ke.selectionStart,ke.selectionEnd);if(be!==null){se.preventDefault(),St(ke,be);return}}if(se.key==="Escape"){if(se.preventDefault(),je.cancelListening())return;Qe();return}se.key==="ArrowUp"&&A!==void 0&&!se.shiftKey&&!se.altKey&&!se.ctrlKey&&!se.metaKey&&!se.nativeEvent.isComposing&&se.currentTarget.value.length===0&&H.items.length===0&&(se.preventDefault(),A())},[kt,Qe,Z,St,A,H.items.length,Ft,je]),Ie=N.useCallback((se,ke)=>{const{inserted:be}=ix(se.value,se.selectionStart,se.selectionEnd,ke);let lt=!1;try{lt=document.execCommand("insertText",!1,be)}catch{lt=!1}lt||(se.setRangeText(be,se.selectionStart,se.selectionEnd,"end"),D(se.value))},[]),$e=N.useCallback((se,ke)=>{const be=$.current;if(be===null||be.disabled){D(wt=>Qp(wt,wt.length,wt.length,se).text);return}const{inserted:lt}=Qp(be.value,be.selectionStart,be.selectionEnd,se);let ut=!1;if(ke){be.focus();try{ut=document.execCommand("insertText",!1,lt)}catch{ut=!1}}ut||(be.setRangeText(lt,be.selectionStart,be.selectionEnd,"end"),D(be.value))},[]);N.useEffect(()=>{if(p!==void 0)return p.current=$e,()=>{p.current===$e&&(p.current=null)}},[p,$e]);const{acceptImages:ue,acceptStoredFiles:st}=H,ft=N.useCallback((se,ke,be,lt=[])=>{if(!st(lt))return!1;const ut=$.current;if(ut===null||ut.disabled)D(wt=>{const Nt=lm(wt,se);return Nt===null?wt:wt.slice(0,Nt.from)+Nt.inserted});else{const wt=lm(ut.value,se);if(wt!==null){ut.setSelectionRange(wt.from,ut.value.length);let Nt=!1;if(be){ut.focus();try{Nt=document.execCommand("insertText",!1,wt.inserted)}catch{Nt=!1}}Nt||(ut.setRangeText(wt.inserted,wt.from,ut.value.length,"end"),D(ut.value))}}return ue(ke),!0},[ue,st]);N.useEffect(()=>{if(T!==void 0)return T.current=ft,()=>{T.current===ft&&(T.current=null)}},[T,ft]);const et=N.useCallback(se=>{if(se.clipboardData===null)return;const ke=H.acceptPaste(se.clipboardData,wv(se.currentTarget.value));ke.consumed&&(se.preventDefault(),ke.pastedNumber!==null&&Ie(se.currentTarget,ke.pastedNumber))},[H,Ie]),tt=N.useCallback(se=>{H.remove(se.id),se.kind==="text"&&D(ke=>kv(ke,se.number))},[H]),de=N.useRef(null),Pe=I.trim().length>0||H.items.some(se=>se.kind!=="text"||se.text.trim().length>0),{showStop:Re,showSend:Ce}=ex({alive:l,activity:c,hasSomething:Pe}),fe=tx({voiceButtons:je.available?je.controls.length:0,stop:Re,suggestion:we!==null}),ht=fx({text:I,items:H.items}),rt=H.items.some(se=>se.kind!=="text")?f("scheduled.composer.onlyText"):Pe?null:f("scheduled.composer.empty"),Pt=r!==null&&[...K.values()].includes(r),Et=H.items.some(se=>se.kind!=="text"),Ge=Jo(H.items.filter(se=>se.kind==="text").map(se=>({number:se.number,text:se.text})),I),ct=Et?f("composer.codexQueue.textOnly"):Ge.length>Ru?f("composer.codexQueue.tooLong",{max:Ru}):k,Tt=(W==null?void 0:W.terminalId)!==r?null:W.result==="queued"?f("composer.codexQueue.queued"):W.result==="not-busy"?f("composer.codexQueue.notBusy"):W.result==="unavailable"?f("composer.codexQueue.unavailable"):f("composer.codexQueue.failed");return i.jsxs("div",{className:`composer${P?" composer-dragging":""}`,style:o===void 0?void 0:{"--composer-accent":o},onDragOver:se=>{Array.from(se.dataTransfer.types).includes("Files")&&(se.preventDefault(),F(!0))},onDragLeave:()=>F(!1),onDrop:se=>{se.preventDefault(),F(!1),H.acceptFiles(se.dataTransfer.files)},children:[i.jsx("div",{className:"hdivider composer-divider",...Ue,title:f("composer.resizeTitle")}),b!==null&&i.jsxs("div",{className:"handoff-notice",role:"status",children:[i.jsxs("span",{className:"handoff-notice-text",children:[b.text,b.status!==null&&i.jsx("span",{className:"handoff-notice-status",children:b.status})]}),h!==void 0&&i.jsx("button",{className:"icon-button",onClick:h,title:f("common.dismissNotice"),children:"×"})]}),H.problem!==null&&i.jsxs("div",{className:"composer-problem",children:[i.jsx("span",{children:H.problem}),i.jsx("button",{className:"icon-button",onClick:H.dismissProblem,title:f("common.close"),children:"×"})]}),ht&&i.jsx("div",{className:"composer-problem",role:"status",children:i.jsx("span",{children:f("composer.problem.draftTooLong")})}),je.notice!==null&&i.jsxs("div",{className:"composer-problem",role:"status",children:[i.jsx("span",{children:je.notice==="empty"?f("composer.voice.noSpeech"):f("composer.voice.kept")}),i.jsx("button",{className:"icon-button",onClick:je.dismissNotice,title:f("common.close"),children:"×"})]}),H.items.length>0&&i.jsx("div",{className:"composer-chips",children:H.items.map(se=>i.jsx(W1,{item:se,onRemove:()=>tt(se),onEdit:ke=>H.updateText(se.id,ke),onDoneEditing:()=>{var ke;return(ke=$.current)==null?void 0:ke.focus()}},se.id))}),i.jsxs("div",{className:"composer-field",style:{"--composer-slots":fe},children:[i.jsx("textarea",{ref:$,className:"composer-input",value:I,rows:1,placeholder:we!==null?we:f(re?v?"composer.placeholder.sleeping":"composer.placeholder.ended":"composer.placeholder.ready"),disabled:re,onChange:se=>D(se.target.value),onKeyDown:Gt,onKeyUp:je.textKeyUp,onBlur:je.textBlur,onPaste:et,spellCheck:!1}),i.jsxs("div",{className:"composer-field-actions",children:[we!==null&&(Z?i.jsx("button",{className:"composer-icon composer-suggestion-use",onMouseDown:se=>se.preventDefault(),onClick:Ft,title:f("composer.suggestion.use"),"aria-label":f("composer.suggestion.use"),children:i.jsx("span",{"aria-hidden":"true",children:"↗"})}):i.jsx("kbd",{className:"composer-suggestion-key",title:f("composer.suggestion.keyTitle"),children:f("composer.suggestion.key")})),Re&&i.jsx("button",{className:"composer-icon composer-stop",onClick:Qe,disabled:re,title:f("composer.stopTitle"),"aria-label":f("composer.stop"),children:i.jsx("svg",{viewBox:"0 0 24 24",width:"14",height:"14","aria-hidden":"true",children:i.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2",fill:"currentColor"})})}),je.available&&je.controls.map(se=>i.jsx("button",{className:`composer-icon composer-voice-button${se.active?" is-active":""}${se.busy?" is-busy":""}`,disabled:se.disabled,"aria-label":se.active?f("composer.voice.stop"):se.busy?f("composer.voice.transcribing"):se.mode==="dictation"?f("composer.voice.dictate"):f("composer.voice.live"),"aria-pressed":se.active,"aria-busy":se.busy,title:se.busy?f("composer.voice.transcribing"):se.active?f("composer.voice.stop"):y&&se.mode==="dictation"?f("composer.voice.blocked"):se.hold?f("composer.voice.hold"):f("composer.voice.live"),...se.props,children:se.mode==="live"?i.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16","aria-hidden":"true",children:i.jsx("path",{d:"M5 10v4M9.5 4v16M14 7v10M18.5 10v4",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})}):i.jsxs("svg",{viewBox:"0 0 24 24",width:"16",height:"16","aria-hidden":"true",children:[i.jsx("rect",{x:"9",y:"3",width:"6",height:"12",rx:"3",fill:"none",stroke:"currentColor",strokeWidth:"2"}),i.jsx("path",{d:"M5.5 11.5v.5a6.5 6.5 0 0 0 13 0v-.5M12 18.5V22m-4 0h8",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})},se.mode)),Ce&&i.jsx("button",{className:"composer-icon composer-send",onClick:kt,disabled:re||!Pe||k!==null||Ke,title:k??f("composer.sendTitle"),"aria-label":f("composer.send"),children:i.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16","aria-hidden":"true",children:i.jsx("path",{d:"M12 19V5M5.5 11.5 12 5l6.5 6.5",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]}),i.jsxs("div",{className:"composer-bar",children:[i.jsx("input",{ref:de,type:"file",multiple:!0,hidden:!0,onChange:se=>{se.target.files!==null&&H.acceptFiles(se.target.files),se.target.value=""}}),i.jsx("button",{className:"icon-button composer-attach",onClick:()=>{var se;return(se=de.current)==null?void 0:se.click()},disabled:re,title:f("composer.attachTitle"),"aria-label":f("composer.attach"),children:i.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16","aria-hidden":"true",children:i.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"})})}),E!==void 0&&i.jsx("button",{className:`icon-button composer-schedule${z!==null?" composer-schedule-open":""}`,onClick:se=>{const ke=se.currentTarget;q(be=>be===null?ke:null)},disabled:re||rt!==null,title:rt??f("scheduled.composer.title"),"aria-label":f("scheduled.composer.label"),"aria-haspopup":"dialog","aria-expanded":z!==null,children:i.jsxs("svg",{viewBox:"0 0 24 24",width:"16",height:"16","aria-hidden":"true",children:[i.jsx("circle",{cx:"12",cy:"12",r:"8.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),i.jsx("path",{d:"M12 7.5V12l3 2",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}),S&&i.jsx("button",{className:`icon-button composer-codex-queue${Pt?" composer-codex-queue-pending":""}`,onClick:Lt,disabled:re||!Pe||ct!==null||Pt,title:Pt?f("composer.codexQueue.pending"):ct??f("composer.codexQueue.label"),"aria-label":f(Pt?"composer.codexQueue.pending":"composer.codexQueue.label"),children:Pt?"…":"↳"}),Tt!==null&&i.jsx("span",{className:"composer-codex-queue-status","aria-live":"polite",children:Tt}),z!==null&&i.jsx(d1,{anchor:z,onPick:xt,onClose:vt}),w,i.jsx("span",{className:"composer-spacer"}),m]})]})}function W1({item:t,onRemove:e,onEdit:r,onDoneEditing:l}){const[a,y]=N.useState(!1);if(t.kind==="image"){const v=`${t.name} · ${fn(t.bytes)}`;return i.jsxs("figure",{className:"chip chip-image",title:v,children:[i.jsx("img",{src:t.dataUrl,alt:t.name,onClick:()=>y(!0)}),i.jsx("button",{className:"chip-remove",onClick:e,title:f("composer.chip.remove"),children:"×"}),a&&i.jsx(xv,{src:t.dataUrl,caption:v,onClose:()=>y(!1)})]})}return t.kind==="file"?i.jsxs("div",{className:"chip chip-text chip-file",title:`${t.name} · ${fn(t.bytes)}`,children:[i.jsxs("span",{className:"chip-toggle chip-file-label",children:[i.jsx("span",{className:"chip-icon",children:"▤"}),i.jsx("span",{className:"chip-file-name",children:t.name}),i.jsx("span",{className:"chip-file-size",children:fn(t.bytes)})]}),i.jsx("button",{className:"chip-remove",onClick:e,title:f("composer.chip.remove"),children:"×"})]}):i.jsxs("div",{className:`chip chip-text${a?" chip-open":""}`,children:[i.jsxs("button",{className:"chip-toggle",onClick:()=>y(v=>!v),title:f("composer.chip.editHint"),"aria-expanded":a,children:[i.jsx("span",{className:"chip-icon",children:"¶"}),nx(t.number,t.lines),i.jsx("span",{className:"chip-chevron",children:a?"▾":"▸"})]}),i.jsx("button",{className:"chip-remove",onClick:e,title:f("composer.chip.remove"),children:"×"}),a&&i.jsx("textarea",{className:"chip-editor",value:t.text,onChange:v=>r(v.target.value),onKeyDown:v=>{v.key==="Escape"&&(v.preventDefault(),y(!1),l())},"aria-label":f("composer.chip.editorLabel",{number:t.number}),spellCheck:!1,autoFocus:!0})]})}var Ou={exports:{}},fm;function q1(){return fm||(fm=1,(function(t,e){(function(r,l){t.exports=l()})(self,(()=>(()=>{var r={};return(()=>{var l=r;Object.defineProperty(l,"__esModule",{value:!0}),l.FitAddon=void 0,l.FitAddon=class{activate(a){this._terminal=a}dispose(){}fit(){const a=this.proposeDimensions();if(!a||!this._terminal||isNaN(a.cols)||isNaN(a.rows))return;const y=this._terminal._core;this._terminal.rows===a.rows&&this._terminal.cols===a.cols||(y._renderService.clear(),this._terminal.resize(a.cols,a.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const a=this._terminal._core,y=a._renderService.dimensions;if(y.css.cell.width===0||y.css.cell.height===0)return;const v=this._terminal.options.scrollback===0?0:a.viewport.scrollBarWidth,o=window.getComputedStyle(this._terminal.element.parentElement),c=parseInt(o.getPropertyValue("height")),m=Math.max(0,parseInt(o.getPropertyValue("width"))),w=window.getComputedStyle(this._terminal.element),d=c-(parseInt(w.getPropertyValue("padding-top"))+parseInt(w.getPropertyValue("padding-bottom"))),k=m-(parseInt(w.getPropertyValue("padding-right"))+parseInt(w.getPropertyValue("padding-left")))-v;return{cols:Math.max(2,Math.floor(k/y.css.cell.width)),rows:Math.max(1,Math.floor(d/y.css.cell.height))}}}})(),r})()))})(Ou)),Ou.exports}var z1=q1(),Bu={exports:{}},pm;function K1(){return pm||(pm=1,(function(t,e){(function(r,l){t.exports=l()})(self,(()=>(()=>{var r={6:(v,o)=>{function c(w){try{const d=new URL(w),k=d.password&&d.username?`${d.protocol}//${d.username}:${d.password}@${d.host}`:d.username?`${d.protocol}//${d.username}@${d.host}`:`${d.protocol}//${d.host}`;return w.toLocaleLowerCase().startsWith(k.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(o,"__esModule",{value:!0}),o.LinkComputer=o.WebLinkProvider=void 0,o.WebLinkProvider=class{constructor(w,d,k,L={}){this._terminal=w,this._regex=d,this._handler=k,this._options=L}provideLinks(w,d){const k=m.computeLink(w,this._regex,this._terminal,this._handler);d(this._addCallbacks(k))}_addCallbacks(w){return w.map((d=>(d.leave=this._options.leave,d.hover=(k,L)=>{if(this._options.hover){const{range:M}=d;this._options.hover(k,L,M)}},d)))}};class m{static computeLink(d,k,L,M){const b=new RegExp(k.source,(k.flags||"")+"g"),[h,_]=m._getWindowedLineStrings(d-1,L),g=h.join("");let p;const T=[];for(;p=b.exec(g);){const A=p[0];if(!c(A))continue;const[E,S]=m._mapStrIdx(L,_,0,p.index),[x,R]=m._mapStrIdx(L,E,S,A.length);if(E===-1||S===-1||x===-1||R===-1)continue;const I={start:{x:S+1,y:E+1},end:{x:R,y:x+1}};T.push({range:I,text:A,activate:M})}return T}static _getWindowedLineStrings(d,k){let L,M=d,b=d,h=0,_="";const g=[];if(L=k.buffer.active.getLine(d)){const p=L.translateToString(!0);if(L.isWrapped&&p[0]!==" "){for(h=0;(L=k.buffer.active.getLine(--M))&&h<2048&&(_=L.translateToString(!0),h+=_.length,g.push(_),L.isWrapped&&_.indexOf(" ")===-1););g.reverse()}for(g.push(p),h=0;(L=k.buffer.active.getLine(++b))&&L.isWrapped&&h<2048&&(_=L.translateToString(!0),h+=_.length,g.push(_),_.indexOf(" ")===-1););}return[g,M]}static _mapStrIdx(d,k,L,M){const b=d.buffer.active,h=b.getNullCell();let _=L;for(;M;){const g=b.getLine(k);if(!g)return[-1,-1];for(let p=_;p<g.length;++p){g.getCell(p,h);const T=h.getChars();if(h.getWidth()&&(M-=T.length||1,p===g.length-1&&T==="")){const A=b.getLine(k+1);A&&A.isWrapped&&(A.getCell(0,h),h.getWidth()===2&&(M+=1))}if(M<0)return[k,p]}k++,_=0}return[k,_]}}o.LinkComputer=m}},l={};function a(v){var o=l[v];if(o!==void 0)return o.exports;var c=l[v]={exports:{}};return r[v](c,c.exports,a),c.exports}var y={};return(()=>{var v=y;Object.defineProperty(v,"__esModule",{value:!0}),v.WebLinksAddon=void 0;const o=a(6),c=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function m(w,d){const k=window.open();if(k){try{k.opener=null}catch{}k.location.href=d}else console.warn("Opening link blocked as opener could not be cleared")}v.WebLinksAddon=class{constructor(w=m,d={}){this._handler=w,this._options=d}activate(w){this._terminal=w;const d=this._options,k=d.urlRegex||c;this._linkProvider=this._terminal.registerLinkProvider(new o.WebLinkProvider(this._terminal,k,this._handler,d))}dispose(){var w;(w=this._linkProvider)==null||w.dispose()}}})(),y})()))})(Bu)),Bu.exports}var V1=K1(),Fu={exports:{}},mm;function G1(){return mm||(mm=1,(function(t,e){(function(r,l){t.exports=l()})(self,(()=>(()=>{var r={965:(v,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.GlyphRenderer=void 0;const m=c(374),w=c(509),d=c(855),k=c(859),L=c(381),M=11,b=M*Float32Array.BYTES_PER_ELEMENT;let h,_=0,g=0,p=0;class T extends k.Disposable{constructor(E,S,x,R){super(),this._terminal=E,this._gl=S,this._dimensions=x,this._optionsService=R,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};const I=this._gl;w.TextureAtlas.maxAtlasPages===void 0&&(w.TextureAtlas.maxAtlasPages=Math.min(32,(0,m.throwIfFalsy)(I.getParameter(I.MAX_TEXTURE_IMAGE_UNITS))),w.TextureAtlas.maxTextureSize=(0,m.throwIfFalsy)(I.getParameter(I.MAX_TEXTURE_SIZE))),this._program=(0,m.throwIfFalsy)((0,L.createProgram)(I,`#version 300 es
|
|
66
|
+
layout (location = 0) in vec2 a_unitquad;
|
|
67
|
+
layout (location = 1) in vec2 a_cellpos;
|
|
68
|
+
layout (location = 2) in vec2 a_offset;
|
|
69
|
+
layout (location = 3) in vec2 a_size;
|
|
70
|
+
layout (location = 4) in float a_texpage;
|
|
71
|
+
layout (location = 5) in vec2 a_texcoord;
|
|
72
|
+
layout (location = 6) in vec2 a_texsize;
|
|
73
|
+
|
|
74
|
+
uniform mat4 u_projection;
|
|
75
|
+
uniform vec2 u_resolution;
|
|
76
|
+
|
|
77
|
+
out vec2 v_texcoord;
|
|
78
|
+
flat out int v_texpage;
|
|
79
|
+
|
|
80
|
+
void main() {
|
|
81
|
+
vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
|
|
82
|
+
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
83
|
+
v_texpage = int(a_texpage);
|
|
84
|
+
v_texcoord = a_texcoord + a_unitquad * a_texsize;
|
|
85
|
+
}`,(function(K){let V="";for(let W=1;W<K;W++)V+=` else if (v_texpage == ${W}) { outColor = texture(u_texture[${W}], v_texcoord); }`;return`#version 300 es
|
|
86
|
+
precision lowp float;
|
|
87
|
+
|
|
88
|
+
in vec2 v_texcoord;
|
|
89
|
+
flat in int v_texpage;
|
|
90
|
+
|
|
91
|
+
uniform sampler2D u_texture[${K}];
|
|
92
|
+
|
|
93
|
+
out vec4 outColor;
|
|
94
|
+
|
|
95
|
+
void main() {
|
|
96
|
+
if (v_texpage == 0) {
|
|
97
|
+
outColor = texture(u_texture[0], v_texcoord);
|
|
98
|
+
} ${V}
|
|
99
|
+
}`})(w.TextureAtlas.maxAtlasPages))),this.register((0,k.toDisposable)((()=>I.deleteProgram(this._program)))),this._projectionLocation=(0,m.throwIfFalsy)(I.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=(0,m.throwIfFalsy)(I.getUniformLocation(this._program,"u_resolution")),this._textureLocation=(0,m.throwIfFalsy)(I.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=I.createVertexArray(),I.bindVertexArray(this._vertexArrayObject);const D=new Float32Array([0,0,1,0,0,1,1,1]),P=I.createBuffer();this.register((0,k.toDisposable)((()=>I.deleteBuffer(P)))),I.bindBuffer(I.ARRAY_BUFFER,P),I.bufferData(I.ARRAY_BUFFER,D,I.STATIC_DRAW),I.enableVertexAttribArray(0),I.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);const F=new Uint8Array([0,1,2,3]),z=I.createBuffer();this.register((0,k.toDisposable)((()=>I.deleteBuffer(z)))),I.bindBuffer(I.ELEMENT_ARRAY_BUFFER,z),I.bufferData(I.ELEMENT_ARRAY_BUFFER,F,I.STATIC_DRAW),this._attributesBuffer=(0,m.throwIfFalsy)(I.createBuffer()),this.register((0,k.toDisposable)((()=>I.deleteBuffer(this._attributesBuffer)))),I.bindBuffer(I.ARRAY_BUFFER,this._attributesBuffer),I.enableVertexAttribArray(2),I.vertexAttribPointer(2,2,I.FLOAT,!1,b,0),I.vertexAttribDivisor(2,1),I.enableVertexAttribArray(3),I.vertexAttribPointer(3,2,I.FLOAT,!1,b,2*Float32Array.BYTES_PER_ELEMENT),I.vertexAttribDivisor(3,1),I.enableVertexAttribArray(4),I.vertexAttribPointer(4,1,I.FLOAT,!1,b,4*Float32Array.BYTES_PER_ELEMENT),I.vertexAttribDivisor(4,1),I.enableVertexAttribArray(5),I.vertexAttribPointer(5,2,I.FLOAT,!1,b,5*Float32Array.BYTES_PER_ELEMENT),I.vertexAttribDivisor(5,1),I.enableVertexAttribArray(6),I.vertexAttribPointer(6,2,I.FLOAT,!1,b,7*Float32Array.BYTES_PER_ELEMENT),I.vertexAttribDivisor(6,1),I.enableVertexAttribArray(1),I.vertexAttribPointer(1,2,I.FLOAT,!1,b,9*Float32Array.BYTES_PER_ELEMENT),I.vertexAttribDivisor(1,1),I.useProgram(this._program);const q=new Int32Array(w.TextureAtlas.maxAtlasPages);for(let K=0;K<w.TextureAtlas.maxAtlasPages;K++)q[K]=K;I.uniform1iv(this._textureLocation,q),I.uniformMatrix4fv(this._projectionLocation,!1,L.PROJECTION_MATRIX),this._atlasTextures=[];for(let K=0;K<w.TextureAtlas.maxAtlasPages;K++){const V=new L.GLTexture((0,m.throwIfFalsy)(I.createTexture()));this.register((0,k.toDisposable)((()=>I.deleteTexture(V.texture)))),I.activeTexture(I.TEXTURE0+K),I.bindTexture(I.TEXTURE_2D,V.texture),I.texParameteri(I.TEXTURE_2D,I.TEXTURE_WRAP_S,I.CLAMP_TO_EDGE),I.texParameteri(I.TEXTURE_2D,I.TEXTURE_WRAP_T,I.CLAMP_TO_EDGE),I.texImage2D(I.TEXTURE_2D,0,I.RGBA,1,1,0,I.RGBA,I.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[K]=V}I.enable(I.BLEND),I.blendFunc(I.SRC_ALPHA,I.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return!this._atlas||this._atlas.beginFrame()}updateCell(E,S,x,R,I,D,P,F,z){this._updateCell(this._vertices.attributes,E,S,x,R,I,D,P,F,z)}_updateCell(E,S,x,R,I,D,P,F,z,q){_=(x*this._terminal.cols+S)*M,R!==d.NULL_CELL_CODE&&R!==void 0?this._atlas&&(h=F&&F.length>1?this._atlas.getRasterizedGlyphCombinedChar(F,I,D,P,!1):this._atlas.getRasterizedGlyph(R,I,D,P,!1),g=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),I!==q&&h.offset.x>g?(p=h.offset.x-g,E[_]=-(h.offset.x-p)+this._dimensions.device.char.left,E[_+1]=-h.offset.y+this._dimensions.device.char.top,E[_+2]=(h.size.x-p)/this._dimensions.device.canvas.width,E[_+3]=h.size.y/this._dimensions.device.canvas.height,E[_+4]=h.texturePage,E[_+5]=h.texturePositionClipSpace.x+p/this._atlas.pages[h.texturePage].canvas.width,E[_+6]=h.texturePositionClipSpace.y,E[_+7]=h.sizeClipSpace.x-p/this._atlas.pages[h.texturePage].canvas.width,E[_+8]=h.sizeClipSpace.y):(E[_]=-h.offset.x+this._dimensions.device.char.left,E[_+1]=-h.offset.y+this._dimensions.device.char.top,E[_+2]=h.size.x/this._dimensions.device.canvas.width,E[_+3]=h.size.y/this._dimensions.device.canvas.height,E[_+4]=h.texturePage,E[_+5]=h.texturePositionClipSpace.x,E[_+6]=h.texturePositionClipSpace.y,E[_+7]=h.sizeClipSpace.x,E[_+8]=h.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&(0,m.allowRescaling)(R,z,h.size.x,this._dimensions.device.cell.width)&&(E[_+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width)):E.fill(0,_,_+M-1-2)}clear(){const E=this._terminal,S=E.cols*E.rows*M;this._vertices.count!==S?this._vertices.attributes=new Float32Array(S):this._vertices.attributes.fill(0);let x=0;for(;x<this._vertices.attributesBuffers.length;x++)this._vertices.count!==S?this._vertices.attributesBuffers[x]=new Float32Array(S):this._vertices.attributesBuffers[x].fill(0);this._vertices.count=S,x=0;for(let R=0;R<E.rows;R++)for(let I=0;I<E.cols;I++)this._vertices.attributes[x+9]=I/E.cols,this._vertices.attributes[x+10]=R/E.rows,x+=M}handleResize(){const E=this._gl;E.useProgram(this._program),E.viewport(0,0,E.canvas.width,E.canvas.height),E.uniform2f(this._resolutionLocation,E.canvas.width,E.canvas.height),this.clear()}render(E){if(!this._atlas)return;const S=this._gl;S.useProgram(this._program),S.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;const x=this._vertices.attributesBuffers[this._activeBuffer];let R=0;for(let I=0;I<E.lineLengths.length;I++){const D=I*this._terminal.cols*M,P=this._vertices.attributes.subarray(D,D+E.lineLengths[I]*M);x.set(P,R),R+=P.length}S.bindBuffer(S.ARRAY_BUFFER,this._attributesBuffer),S.bufferData(S.ARRAY_BUFFER,x.subarray(0,R),S.STREAM_DRAW);for(let I=0;I<this._atlas.pages.length;I++)this._atlas.pages[I].version!==this._atlasTextures[I].version&&this._bindAtlasPageTexture(S,this._atlas,I);S.drawElementsInstanced(S.TRIANGLE_STRIP,4,S.UNSIGNED_BYTE,0,R/M)}setAtlas(E){this._atlas=E;for(const S of this._atlasTextures)S.version=-1}_bindAtlasPageTexture(E,S,x){E.activeTexture(E.TEXTURE0+x),E.bindTexture(E.TEXTURE_2D,this._atlasTextures[x].texture),E.texParameteri(E.TEXTURE_2D,E.TEXTURE_WRAP_S,E.CLAMP_TO_EDGE),E.texParameteri(E.TEXTURE_2D,E.TEXTURE_WRAP_T,E.CLAMP_TO_EDGE),E.texImage2D(E.TEXTURE_2D,0,E.RGBA,E.RGBA,E.UNSIGNED_BYTE,S.pages[x].canvas),E.generateMipmap(E.TEXTURE_2D),this._atlasTextures[x].version=S.pages[x].version}setDimensions(E){this._dimensions=E}}o.GlyphRenderer=T},742:(v,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.RectangleRenderer=void 0;const m=c(374),w=c(859),d=c(310),k=c(381),L=8*Float32Array.BYTES_PER_ELEMENT;class M{constructor(){this.attributes=new Float32Array(160),this.count=0}}let b=0,h=0,_=0,g=0,p=0,T=0,A=0;class E extends w.Disposable{constructor(x,R,I,D){super(),this._terminal=x,this._gl=R,this._dimensions=I,this._themeService=D,this._vertices=new M,this._verticesCursor=new M;const P=this._gl;this._program=(0,m.throwIfFalsy)((0,k.createProgram)(P,`#version 300 es
|
|
100
|
+
layout (location = 0) in vec2 a_position;
|
|
101
|
+
layout (location = 1) in vec2 a_size;
|
|
102
|
+
layout (location = 2) in vec4 a_color;
|
|
103
|
+
layout (location = 3) in vec2 a_unitquad;
|
|
104
|
+
|
|
105
|
+
uniform mat4 u_projection;
|
|
106
|
+
|
|
107
|
+
out vec4 v_color;
|
|
108
|
+
|
|
109
|
+
void main() {
|
|
110
|
+
vec2 zeroToOne = a_position + (a_unitquad * a_size);
|
|
111
|
+
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
112
|
+
v_color = a_color;
|
|
113
|
+
}`,`#version 300 es
|
|
114
|
+
precision lowp float;
|
|
115
|
+
|
|
116
|
+
in vec4 v_color;
|
|
117
|
+
|
|
118
|
+
out vec4 outColor;
|
|
119
|
+
|
|
120
|
+
void main() {
|
|
121
|
+
outColor = v_color;
|
|
122
|
+
}`)),this.register((0,w.toDisposable)((()=>P.deleteProgram(this._program)))),this._projectionLocation=(0,m.throwIfFalsy)(P.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=P.createVertexArray(),P.bindVertexArray(this._vertexArrayObject);const F=new Float32Array([0,0,1,0,0,1,1,1]),z=P.createBuffer();this.register((0,w.toDisposable)((()=>P.deleteBuffer(z)))),P.bindBuffer(P.ARRAY_BUFFER,z),P.bufferData(P.ARRAY_BUFFER,F,P.STATIC_DRAW),P.enableVertexAttribArray(3),P.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);const q=new Uint8Array([0,1,2,3]),K=P.createBuffer();this.register((0,w.toDisposable)((()=>P.deleteBuffer(K)))),P.bindBuffer(P.ELEMENT_ARRAY_BUFFER,K),P.bufferData(P.ELEMENT_ARRAY_BUFFER,q,P.STATIC_DRAW),this._attributesBuffer=(0,m.throwIfFalsy)(P.createBuffer()),this.register((0,w.toDisposable)((()=>P.deleteBuffer(this._attributesBuffer)))),P.bindBuffer(P.ARRAY_BUFFER,this._attributesBuffer),P.enableVertexAttribArray(0),P.vertexAttribPointer(0,2,P.FLOAT,!1,L,0),P.vertexAttribDivisor(0,1),P.enableVertexAttribArray(1),P.vertexAttribPointer(1,2,P.FLOAT,!1,L,2*Float32Array.BYTES_PER_ELEMENT),P.vertexAttribDivisor(1,1),P.enableVertexAttribArray(2),P.vertexAttribPointer(2,4,P.FLOAT,!1,L,4*Float32Array.BYTES_PER_ELEMENT),P.vertexAttribDivisor(2,1),this._updateCachedColors(D.colors),this.register(this._themeService.onChangeColors((V=>{this._updateCachedColors(V),this._updateViewportRectangle()})))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(x){const R=this._gl;R.useProgram(this._program),R.bindVertexArray(this._vertexArrayObject),R.uniformMatrix4fv(this._projectionLocation,!1,k.PROJECTION_MATRIX),R.bindBuffer(R.ARRAY_BUFFER,this._attributesBuffer),R.bufferData(R.ARRAY_BUFFER,x.attributes,R.DYNAMIC_DRAW),R.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,R.UNSIGNED_BYTE,0,x.count)}handleResize(){this._updateViewportRectangle()}setDimensions(x){this._dimensions=x}_updateCachedColors(x){this._bgFloat=this._colorToFloat32Array(x.background),this._cursorFloat=this._colorToFloat32Array(x.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(x){const R=this._terminal,I=this._vertices;let D,P,F,z,q,K,V,W,O,U,H,$=1;for(D=0;D<R.rows;D++){for(F=-1,z=0,q=0,K=!1,P=0;P<R.cols;P++)V=(D*R.cols+P)*d.RENDER_MODEL_INDICIES_PER_CELL,W=x.cells[V+d.RENDER_MODEL_BG_OFFSET],O=x.cells[V+d.RENDER_MODEL_FG_OFFSET],U=!!(67108864&O),(W!==z||O!==q&&(K||U))&&((z!==0||K&&q!==0)&&(H=8*$++,this._updateRectangle(I,H,q,z,F,P,D)),F=P,z=W,q=O,K=U);(z!==0||K&&q!==0)&&(H=8*$++,this._updateRectangle(I,H,q,z,F,R.cols,D))}I.count=$}updateCursor(x){const R=this._verticesCursor,I=x.cursor;if(!I||I.style==="block")return void(R.count=0);let D,P=0;I.style!=="bar"&&I.style!=="outline"||(D=8*P++,this._addRectangleFloat(R.attributes,D,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"||(D=8*P++,this._addRectangleFloat(R.attributes,D,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"&&(D=8*P++,this._addRectangleFloat(R.attributes,D,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),D=8*P++,this._addRectangleFloat(R.attributes,D,(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)),R.count=P}_updateRectangle(x,R,I,D,P,F,z){if(67108864&I)switch(50331648&I){case 16777216:case 33554432:b=this._themeService.colors.ansi[255&I].rgba;break;case 50331648:b=(16777215&I)<<8;break;default:b=this._themeService.colors.foreground.rgba}else switch(50331648&D){case 16777216:case 33554432:b=this._themeService.colors.ansi[255&D].rgba;break;case 50331648:b=(16777215&D)<<8;break;default:b=this._themeService.colors.background.rgba}x.attributes.length<R+4&&(x.attributes=(0,k.expandFloat32Array)(x.attributes,this._terminal.rows*this._terminal.cols*8)),h=P*this._dimensions.device.cell.width,_=z*this._dimensions.device.cell.height,g=(b>>24&255)/255,p=(b>>16&255)/255,T=(b>>8&255)/255,A=1,this._addRectangle(x.attributes,R,h,_,(F-P)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,g,p,T,A)}_addRectangle(x,R,I,D,P,F,z,q,K,V){x[R]=I/this._dimensions.device.canvas.width,x[R+1]=D/this._dimensions.device.canvas.height,x[R+2]=P/this._dimensions.device.canvas.width,x[R+3]=F/this._dimensions.device.canvas.height,x[R+4]=z,x[R+5]=q,x[R+6]=K,x[R+7]=V}_addRectangleFloat(x,R,I,D,P,F,z){x[R]=I/this._dimensions.device.canvas.width,x[R+1]=D/this._dimensions.device.canvas.height,x[R+2]=P/this._dimensions.device.canvas.width,x[R+3]=F/this._dimensions.device.canvas.height,x[R+4]=z[0],x[R+5]=z[1],x[R+6]=z[2],x[R+7]=z[3]}_colorToFloat32Array(x){return new Float32Array([(x.rgba>>24&255)/255,(x.rgba>>16&255)/255,(x.rgba>>8&255)/255,(255&x.rgba)/255])}}o.RectangleRenderer=E},310:(v,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.RenderModel=o.COMBINED_CHAR_BIT_MASK=o.RENDER_MODEL_EXT_OFFSET=o.RENDER_MODEL_FG_OFFSET=o.RENDER_MODEL_BG_OFFSET=o.RENDER_MODEL_INDICIES_PER_CELL=void 0;const m=c(296);o.RENDER_MODEL_INDICIES_PER_CELL=4,o.RENDER_MODEL_BG_OFFSET=1,o.RENDER_MODEL_FG_OFFSET=2,o.RENDER_MODEL_EXT_OFFSET=3,o.COMBINED_CHAR_BIT_MASK=2147483648,o.RenderModel=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=(0,m.createSelectionRenderModel)()}resize(w,d){const k=w*d*o.RENDER_MODEL_INDICIES_PER_CELL;k!==this.cells.length&&(this.cells=new Uint32Array(k),this.lineLengths=new Uint32Array(d))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}}},666:(v,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.JoinedCellData=o.WebglRenderer=void 0;const m=c(820),w=c(274),d=c(627),k=c(457),L=c(56),M=c(374),b=c(345),h=c(859),_=c(147),g=c(782),p=c(855),T=c(965),A=c(742),E=c(310),S=c(733);class x extends h.Disposable{constructor(P,F,z,q,K,V,W,O,U){super(),this._terminal=P,this._characterJoinerService=F,this._charSizeService=z,this._coreBrowserService=q,this._coreService=K,this._decorationService=V,this._optionsService=W,this._themeService=O,this._cursorBlinkStateManager=new h.MutableDisposable,this._charAtlasDisposable=this.register(new h.MutableDisposable),this._observerDisposable=this.register(new h.MutableDisposable),this._model=new E.RenderModel,this._workCell=new g.CellData,this._workCell2=new g.CellData,this._rectangleRenderer=this.register(new h.MutableDisposable),this._glyphRenderer=this.register(new h.MutableDisposable),this._onChangeTextureAtlas=this.register(new b.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new b.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new b.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this.register(new b.EventEmitter),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this.register(new b.EventEmitter),this.onContextLoss=this._onContextLoss.event,this.register(this._themeService.onChangeColors((()=>this._handleColorChange()))),this._cellColorResolver=new w.CellColorResolver(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new S.LinkRenderLayer(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,W,this._themeService)],this.dimensions=(0,M.createRenderDimensions)(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this.register(W.onOptionChange((()=>this._handleOptionsChanged()))),this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");const H={antialias:!1,depth:!1,preserveDrawingBuffer:U};if(this._gl=this._canvas.getContext("webgl2",H),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this.register((0,m.addDisposableDomListener)(this._canvas,"webglcontextlost",($=>{console.log("webglcontextlost event received"),$.preventDefault(),this._contextRestorationTimeout=setTimeout((()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire($)}),3e3)}))),this.register((0,m.addDisposableDomListener)(this._canvas,"webglcontextrestored",($=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,(0,d.removeTerminalFromCache)(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()}))),this._observerDisposable.value=(0,L.observeDevicePixelDimensions)(this._canvas,this._coreBrowserService.window,(($,Z)=>this._setCanvasDevicePixelDimensions($,Z))),this.register(this._coreBrowserService.onWindowChange(($=>{this._observerDisposable.value=(0,L.observeDevicePixelDimensions)(this._canvas,$,((Z,re)=>this._setCanvasDevicePixelDimensions(Z,re)))}))),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,h.toDisposable)((()=>{var $;for(const Z of this._renderLayers)Z.dispose();($=this._canvas.parentElement)==null||$.removeChild(this._canvas),(0,d.removeTerminalFromCache)(this._terminal)})))}get textureAtlas(){var P;return(P=this._charAtlas)==null?void 0:P.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(P,F){var z,q,K,V;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(const W of this._renderLayers)W.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`,(z=this._rectangleRenderer.value)==null||z.setDimensions(this.dimensions),(q=this._rectangleRenderer.value)==null||q.handleResize(),(K=this._glyphRenderer.value)==null||K.setDimensions(this.dimensions),(V=this._glyphRenderer.value)==null||V.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){var P;for(const F of this._renderLayers)F.handleBlur(this._terminal);(P=this._cursorBlinkStateManager.value)==null||P.pause(),this._requestRedrawViewport()}handleFocus(){var P;for(const F of this._renderLayers)F.handleFocus(this._terminal);(P=this._cursorBlinkStateManager.value)==null||P.resume(),this._requestRedrawViewport()}handleSelectionChanged(P,F,z){for(const q of this._renderLayers)q.handleSelectionChanged(this._terminal,P,F,z);this._model.selection.update(this._core,P,F,z),this._requestRedrawViewport()}handleCursorMove(){var P;for(const F of this._renderLayers)F.handleCursorMove(this._terminal);(P=this._cursorBlinkStateManager.value)==null||P.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new A.RectangleRenderer(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new T.GlyphRenderer(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){var F;if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0)return void(this._isAttached=!1);const P=(0,d.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!==P&&(this._onChangeTextureAtlas.fire(P.pages[0].canvas),this._charAtlasDisposable.value=(0,h.getDisposeArrayDisposable)([(0,b.forwardEvent)(P.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),(0,b.forwardEvent)(P.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)])),this._charAtlas=P,this._charAtlas.warmUp(),(F=this._glyphRenderer.value)==null||F.setAtlas(this._charAtlas)}_clearModel(P){var F;this._model.clear(),P&&((F=this._glyphRenderer.value)==null||F.clear())}clearTextureAtlas(){var P;(P=this._charAtlas)==null||P.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var P;this._clearModel(!0);for(const F of this._renderLayers)F.reset(this._terminal);(P=this._cursorBlinkStateManager.value)==null||P.restartBlinkAnimation(),this._updateCursorBlink()}registerCharacterJoiner(P){return-1}deregisterCharacterJoiner(P){return!1}renderRows(P,F){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 z of this._renderLayers)z.handleGridChanged(this._terminal,P,F);this._glyphRenderer.value&&this._rectangleRenderer.value&&(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(P,F),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 k.CursorBlinkStateManager((()=>{this._requestRedrawCursor()}),this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(P,F){const z=this._core;let q,K,V,W,O,U,H,$,Z,re,we,_e,Q,Y,te=this._workCell;P=I(P,z.rows-1,0),F=I(F,z.rows-1,0);const ee=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,ye=ee-z.buffer.ydisp,ge=Math.min(this._terminal.buffer.active.cursorX,z.cols-1);let Be=-1;const Ue=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let ze=!1;for(K=P;K<=F;K++)for(V=K+z.buffer.ydisp,W=z.buffer.lines.get(V),this._model.lineLengths[K]=0,O=this._characterJoinerService.getJoinedCharacters(V),Q=0;Q<z.cols;Q++)if(q=this._cellColorResolver.result.bg,W.loadCell(Q,te),Q===0&&(q=this._cellColorResolver.result.bg),U=!1,H=Q,O.length>0&&Q===O[0][0]&&(U=!0,$=O.shift(),te=new R(te,W.translateToString(!0,$[0],$[1]),$[1]-$[0]),H=$[1]-1),Z=te.getChars(),re=te.getCode(),_e=(K*z.cols+Q)*E.RENDER_MODEL_INDICIES_PER_CELL,this._cellColorResolver.resolve(te,Q,V,this.dimensions.device.cell.width),Ue&&V===ee&&(Q===ge&&(this._model.cursor={x:ge,y:ye,width:te.getWidth(),style:this._coreBrowserService.isFocused?z.options.cursorStyle||"block":z.options.cursorInactiveStyle,cursorWidth:z.options.cursorWidth,dpr:this._devicePixelRatio},Be=ge+te.getWidth()-1),Q>=ge&&Q<=Be&&(this._coreBrowserService.isFocused&&(z.options.cursorStyle||"block")==="block"||this._coreBrowserService.isFocused===!1&&z.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)),re!==p.NULL_CELL_CODE&&(this._model.lineLengths[K]=Q+1),(this._model.cells[_e]!==re||this._model.cells[_e+E.RENDER_MODEL_BG_OFFSET]!==this._cellColorResolver.result.bg||this._model.cells[_e+E.RENDER_MODEL_FG_OFFSET]!==this._cellColorResolver.result.fg||this._model.cells[_e+E.RENDER_MODEL_EXT_OFFSET]!==this._cellColorResolver.result.ext)&&(ze=!0,Z.length>1&&(re|=E.COMBINED_CHAR_BIT_MASK),this._model.cells[_e]=re,this._model.cells[_e+E.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[_e+E.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[_e+E.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext,we=te.getWidth(),this._glyphRenderer.value.updateCell(Q,K,re,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,Z,we,q),U))for(te=this._workCell,Q++;Q<H;Q++)Y=(K*z.cols+Q)*E.RENDER_MODEL_INDICIES_PER_CELL,this._glyphRenderer.value.updateCell(Q,K,p.NULL_CELL_CODE,0,0,0,p.NULL_CELL_CHAR,0,0),this._model.cells[Y]=p.NULL_CELL_CODE,this._model.cells[Y+E.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[Y+E.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[Y+E.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext;ze&&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(P,F){this._canvas.width===P&&this._canvas.height===F||(this._canvas.width=P,this._canvas.height=F,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){const P=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:P,end:P})}}o.WebglRenderer=x;class R extends _.AttributeData{constructor(P,F,z){super(),this.content=0,this.combinedData="",this.fg=P.fg,this.bg=P.bg,this.combinedData=F,this._width=z}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(P){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}function I(D,P,F=0){return Math.max(Math.min(D,P),F)}o.JoinedCellData=R},381:(v,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.GLTexture=o.expandFloat32Array=o.createShader=o.createProgram=o.PROJECTION_MATRIX=void 0;const m=c(374);function w(d,k,L){const M=(0,m.throwIfFalsy)(d.createShader(k));if(d.shaderSource(M,L),d.compileShader(M),d.getShaderParameter(M,d.COMPILE_STATUS))return M;console.error(d.getShaderInfoLog(M)),d.deleteShader(M)}o.PROJECTION_MATRIX=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]),o.createProgram=function(d,k,L){const M=(0,m.throwIfFalsy)(d.createProgram());if(d.attachShader(M,(0,m.throwIfFalsy)(w(d,d.VERTEX_SHADER,k))),d.attachShader(M,(0,m.throwIfFalsy)(w(d,d.FRAGMENT_SHADER,L))),d.linkProgram(M),d.getProgramParameter(M,d.LINK_STATUS))return M;console.error(d.getProgramInfoLog(M)),d.deleteProgram(M)},o.createShader=w,o.expandFloat32Array=function(d,k){const L=Math.min(2*d.length,k),M=new Float32Array(L);for(let b=0;b<d.length;b++)M[b]=d[b];return M},o.GLTexture=class{constructor(d){this.texture=d,this.version=-1}}},592:(v,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BaseRenderLayer=void 0;const m=c(627),w=c(237),d=c(374),k=c(859);class L extends k.Disposable{constructor(b,h,_,g,p,T,A,E){super(),this._container=h,this._alpha=p,this._coreBrowserService=T,this._optionsService=A,this._themeService=E,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-${_}-layer`),this._canvas.style.zIndex=g.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this.register(this._themeService.onChangeColors((S=>{this._refreshCharAtlas(b,S),this.reset(b)}))),this.register((0,k.toDisposable)((()=>{this._canvas.remove()})))}_initCanvas(){this._ctx=(0,d.throwIfFalsy)(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(b){}handleFocus(b){}handleCursorMove(b){}handleGridChanged(b,h,_){}handleSelectionChanged(b,h,_,g=!1){}_setTransparency(b,h){if(h===this._alpha)return;const _=this._canvas;this._alpha=h,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,_),this._refreshCharAtlas(b,this._themeService.colors),this.handleGridChanged(b,0,b.rows-1)}_refreshCharAtlas(b,h){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=(0,m.acquireTextureAtlas)(b,this._optionsService.rawOptions,h,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr),this._charAtlas.warmUp())}resize(b,h){this._deviceCellWidth=h.device.cell.width,this._deviceCellHeight=h.device.cell.height,this._deviceCharWidth=h.device.char.width,this._deviceCharHeight=h.device.char.height,this._deviceCharLeft=h.device.char.left,this._deviceCharTop=h.device.char.top,this._canvas.width=h.device.canvas.width,this._canvas.height=h.device.canvas.height,this._canvas.style.width=`${h.css.canvas.width}px`,this._canvas.style.height=`${h.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(b,this._themeService.colors)}_fillBottomLineAtCells(b,h,_=1){this._ctx.fillRect(b*this._deviceCellWidth,(h+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,_*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(b,h,_,g){this._alpha?this._ctx.clearRect(b*this._deviceCellWidth,h*this._deviceCellHeight,_*this._deviceCellWidth,g*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(b*this._deviceCellWidth,h*this._deviceCellHeight,_*this._deviceCellWidth,g*this._deviceCellHeight))}_fillCharTrueColor(b,h,_,g){this._ctx.font=this._getFont(b,!1,!1),this._ctx.textBaseline=w.TEXT_BASELINE,this._clipCell(_,g,h.getWidth()),this._ctx.fillText(h.getChars(),_*this._deviceCellWidth+this._deviceCharLeft,g*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(b,h,_){this._ctx.beginPath(),this._ctx.rect(b*this._deviceCellWidth,h*this._deviceCellHeight,_*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(b,h,_){return`${_?"italic":""} ${h?b.options.fontWeightBold:b.options.fontWeight} ${b.options.fontSize*this._coreBrowserService.dpr}px ${b.options.fontFamily}`}}o.BaseRenderLayer=L},733:(v,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.LinkRenderLayer=void 0;const m=c(197),w=c(237),d=c(592);class k extends d.BaseRenderLayer{constructor(M,b,h,_,g,p,T){super(h,M,"link",b,!0,g,p,T),this.register(_.onShowLinkUnderline((A=>this._handleShowLinkUnderline(A)))),this.register(_.onHideLinkUnderline((A=>this._handleHideLinkUnderline(A))))}resize(M,b){super.resize(M,b),this._state=void 0}reset(M){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);const M=this._state.y2-this._state.y1-1;M>0&&this._clearCells(0,this._state.y1+1,this._state.cols,M),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(M){if(M.fg===w.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._themeService.colors.background.css:M.fg!==void 0&&(0,m.is256Color)(M.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[M.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,M.y1===M.y2)this._fillBottomLineAtCells(M.x1,M.y1,M.x2-M.x1);else{this._fillBottomLineAtCells(M.x1,M.y1,M.cols-M.x1);for(let b=M.y1+1;b<M.y2;b++)this._fillBottomLineAtCells(0,b,M.cols);this._fillBottomLineAtCells(0,M.y2,M.x2)}this._state=M}_handleHideLinkUnderline(M){this._clearCurrentLink()}}o.LinkRenderLayer=k},820:(v,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.addDisposableDomListener=void 0,o.addDisposableDomListener=function(c,m,w,d){c.addEventListener(m,w,d);let k=!1;return{dispose:()=>{k||(k=!0,c.removeEventListener(m,w,d))}}}},274:(v,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CellColorResolver=void 0;const m=c(855),w=c(160),d=c(374);let k,L=0,M=0,b=!1,h=!1,_=!1,g=0;o.CellColorResolver=class{constructor(p,T,A,E,S,x){this._terminal=p,this._optionService=T,this._selectionRenderModel=A,this._decorationService=E,this._coreBrowserService=S,this._themeService=x,this.result={fg:0,bg:0,ext:0}}resolve(p,T,A,E){if(this.result.bg=p.bg,this.result.fg=p.fg,this.result.ext=268435456&p.bg?p.extended.ext:0,M=0,L=0,h=!1,b=!1,_=!1,k=this._themeService.colors,g=0,p.getCode()!==m.NULL_CELL_CODE&&p.extended.underlineStyle===4){const S=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));g=T*E%(2*Math.round(S))}if(this._decorationService.forEachDecorationAtCell(T,A,"bottom",(S=>{S.backgroundColorRGB&&(M=S.backgroundColorRGB.rgba>>8&16777215,h=!0),S.foregroundColorRGB&&(L=S.foregroundColorRGB.rgba>>8&16777215,b=!0)})),_=this._selectionRenderModel.isCellSelected(this._terminal,T,A),_){if(67108864&this.result.fg||(50331648&this.result.bg)!=0){if(67108864&this.result.fg)switch(50331648&this.result.fg){case 16777216:case 33554432:M=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:M=(16777215&this.result.fg)<<8|255;break;default:M=this._themeService.colors.foreground.rgba}else switch(50331648&this.result.bg){case 16777216:case 33554432:M=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:M=(16777215&this.result.bg)<<8|255}M=w.rgba.blend(M,4294967040&(this._coreBrowserService.isFocused?k.selectionBackgroundOpaque:k.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}else M=(this._coreBrowserService.isFocused?k.selectionBackgroundOpaque:k.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(h=!0,k.selectionForeground&&(L=k.selectionForeground.rgba>>8&16777215,b=!0),(0,d.treatGlyphAsBackgroundColor)(p.getCode())){if(67108864&this.result.fg&&(50331648&this.result.bg)==0)L=(this._coreBrowserService.isFocused?k.selectionBackgroundOpaque:k.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(67108864&this.result.fg)switch(50331648&this.result.bg){case 16777216:case 33554432:L=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:L=(16777215&this.result.bg)<<8|255}else switch(50331648&this.result.fg){case 16777216:case 33554432:L=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:L=(16777215&this.result.fg)<<8|255;break;default:L=this._themeService.colors.foreground.rgba}L=w.rgba.blend(L,4294967040&(this._coreBrowserService.isFocused?k.selectionBackgroundOpaque:k.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}b=!0}}this._decorationService.forEachDecorationAtCell(T,A,"top",(S=>{S.backgroundColorRGB&&(M=S.backgroundColorRGB.rgba>>8&16777215,h=!0),S.foregroundColorRGB&&(L=S.foregroundColorRGB.rgba>>8&16777215,b=!0)})),h&&(M=_?-16777216&p.bg&-134217729|M|50331648:-16777216&p.bg|M|50331648),b&&(L=-16777216&p.fg&-67108865|L|50331648),67108864&this.result.fg&&(h&&!b&&(L=(50331648&this.result.bg)==0?-134217728&this.result.fg|16777215&k.background.rgba>>8|50331648:-134217728&this.result.fg|67108863&this.result.bg,b=!0),!h&&b&&(M=(50331648&this.result.fg)==0?-67108864&this.result.bg|16777215&k.foreground.rgba>>8|50331648:-67108864&this.result.bg|67108863&this.result.fg,h=!0)),k=void 0,this.result.bg=h?M:this.result.bg,this.result.fg=b?L:this.result.fg,this.result.ext&=536870911,this.result.ext|=g<<29&3758096384}}},627:(v,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.removeTerminalFromCache=o.acquireTextureAtlas=void 0;const m=c(509),w=c(197),d=[];o.acquireTextureAtlas=function(k,L,M,b,h,_,g,p){const T=(0,w.generateConfig)(b,h,_,g,L,M,p);for(let S=0;S<d.length;S++){const x=d[S],R=x.ownedBy.indexOf(k);if(R>=0){if((0,w.configEquals)(x.config,T))return x.atlas;x.ownedBy.length===1?(x.atlas.dispose(),d.splice(S,1)):x.ownedBy.splice(R,1);break}}for(let S=0;S<d.length;S++){const x=d[S];if((0,w.configEquals)(x.config,T))return x.ownedBy.push(k),x.atlas}const A=k._core,E={atlas:new m.TextureAtlas(document,T,A.unicodeService),config:T,ownedBy:[k]};return d.push(E),E.atlas},o.removeTerminalFromCache=function(k){for(let L=0;L<d.length;L++){const M=d[L].ownedBy.indexOf(k);if(M!==-1){d[L].ownedBy.length===1?(d[L].atlas.dispose(),d.splice(L,1)):d[L].ownedBy.splice(M,1);break}}}},197:(v,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.is256Color=o.configEquals=o.generateConfig=void 0;const m=c(160);o.generateConfig=function(w,d,k,L,M,b,h){const _={foreground:b.foreground,background:b.background,cursor:m.NULL_COLOR,cursorAccent:m.NULL_COLOR,selectionForeground:m.NULL_COLOR,selectionBackgroundTransparent:m.NULL_COLOR,selectionBackgroundOpaque:m.NULL_COLOR,selectionInactiveBackgroundTransparent:m.NULL_COLOR,selectionInactiveBackgroundOpaque:m.NULL_COLOR,ansi:b.ansi.slice(),contrastCache:b.contrastCache,halfContrastCache:b.halfContrastCache};return{customGlyphs:M.customGlyphs,devicePixelRatio:h,letterSpacing:M.letterSpacing,lineHeight:M.lineHeight,deviceCellWidth:w,deviceCellHeight:d,deviceCharWidth:k,deviceCharHeight:L,fontFamily:M.fontFamily,fontSize:M.fontSize,fontWeight:M.fontWeight,fontWeightBold:M.fontWeightBold,allowTransparency:M.allowTransparency,drawBoldTextInBrightColors:M.drawBoldTextInBrightColors,minimumContrastRatio:M.minimumContrastRatio,colors:_}},o.configEquals=function(w,d){for(let k=0;k<w.colors.ansi.length;k++)if(w.colors.ansi[k].rgba!==d.colors.ansi[k].rgba)return!1;return w.devicePixelRatio===d.devicePixelRatio&&w.customGlyphs===d.customGlyphs&&w.lineHeight===d.lineHeight&&w.letterSpacing===d.letterSpacing&&w.fontFamily===d.fontFamily&&w.fontSize===d.fontSize&&w.fontWeight===d.fontWeight&&w.fontWeightBold===d.fontWeightBold&&w.allowTransparency===d.allowTransparency&&w.deviceCharWidth===d.deviceCharWidth&&w.deviceCharHeight===d.deviceCharHeight&&w.drawBoldTextInBrightColors===d.drawBoldTextInBrightColors&&w.minimumContrastRatio===d.minimumContrastRatio&&w.colors.foreground.rgba===d.colors.foreground.rgba&&w.colors.background.rgba===d.colors.background.rgba},o.is256Color=function(w){return(50331648&w)==16777216||(50331648&w)==33554432}},237:(v,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.TEXT_BASELINE=o.DIM_OPACITY=o.INVERTED_DEFAULT_COLOR=void 0;const m=c(399);o.INVERTED_DEFAULT_COLOR=257,o.DIM_OPACITY=.5,o.TEXT_BASELINE=m.isFirefox||m.isLegacyEdge?"bottom":"ideographic"},457:(v,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CursorBlinkStateManager=void 0,o.CursorBlinkStateManager=class{constructor(c,m){this._renderCallback=c,this._coreBrowserService=m,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0}))))}_restartInterval(c=600){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout((()=>{if(this._animationTimeRestarted){const m=600-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,m>0)return void this._restartInterval(m)}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0})),this._blinkInterval=this._coreBrowserService.window.setInterval((()=>{if(this._animationTimeRestarted){const m=600-(Date.now()-this._animationTimeRestarted);return this._animationTimeRestarted=void 0,void this._restartInterval(m)}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0}))}),600)}),c)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}}},860:(v,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.tryDrawCustomChar=o.powerlineDefinitions=o.boxDrawingDefinitions=o.blockElementDefinitions=void 0;const m=c(374);o.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 w={"░":[[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]]};o.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:(b,h)=>`M0,${.5-h} L1,${.5-h} M0,${.5+h} L1,${.5+h}`},"║":{1:(b,h)=>`M${.5-b},0 L${.5-b},1 M${.5+b},0 L${.5+b},1`},"╒":{1:(b,h)=>`M.5,1 L.5,${.5-h} L1,${.5-h} M.5,${.5+h} L1,${.5+h}`},"╓":{1:(b,h)=>`M${.5-b},1 L${.5-b},.5 L1,.5 M${.5+b},.5 L${.5+b},1`},"╔":{1:(b,h)=>`M1,${.5-h} L${.5-b},${.5-h} L${.5-b},1 M1,${.5+h} L${.5+b},${.5+h} L${.5+b},1`},"╕":{1:(b,h)=>`M0,${.5-h} L.5,${.5-h} L.5,1 M0,${.5+h} L.5,${.5+h}`},"╖":{1:(b,h)=>`M${.5+b},1 L${.5+b},.5 L0,.5 M${.5-b},.5 L${.5-b},1`},"╗":{1:(b,h)=>`M0,${.5+h} L${.5-b},${.5+h} L${.5-b},1 M0,${.5-h} L${.5+b},${.5-h} L${.5+b},1`},"╘":{1:(b,h)=>`M.5,0 L.5,${.5+h} L1,${.5+h} M.5,${.5-h} L1,${.5-h}`},"╙":{1:(b,h)=>`M1,.5 L${.5-b},.5 L${.5-b},0 M${.5+b},.5 L${.5+b},0`},"╚":{1:(b,h)=>`M1,${.5-h} L${.5+b},${.5-h} L${.5+b},0 M1,${.5+h} L${.5-b},${.5+h} L${.5-b},0`},"╛":{1:(b,h)=>`M0,${.5+h} L.5,${.5+h} L.5,0 M0,${.5-h} L.5,${.5-h}`},"╜":{1:(b,h)=>`M0,.5 L${.5+b},.5 L${.5+b},0 M${.5-b},.5 L${.5-b},0`},"╝":{1:(b,h)=>`M0,${.5-h} L${.5-b},${.5-h} L${.5-b},0 M0,${.5+h} L${.5+b},${.5+h} L${.5+b},0`},"╞":{1:(b,h)=>`M.5,0 L.5,1 M.5,${.5-h} L1,${.5-h} M.5,${.5+h} L1,${.5+h}`},"╟":{1:(b,h)=>`M${.5-b},0 L${.5-b},1 M${.5+b},0 L${.5+b},1 M${.5+b},.5 L1,.5`},"╠":{1:(b,h)=>`M${.5-b},0 L${.5-b},1 M1,${.5+h} L${.5+b},${.5+h} L${.5+b},1 M1,${.5-h} L${.5+b},${.5-h} L${.5+b},0`},"╡":{1:(b,h)=>`M.5,0 L.5,1 M0,${.5-h} L.5,${.5-h} M0,${.5+h} L.5,${.5+h}`},"╢":{1:(b,h)=>`M0,.5 L${.5-b},.5 M${.5-b},0 L${.5-b},1 M${.5+b},0 L${.5+b},1`},"╣":{1:(b,h)=>`M${.5+b},0 L${.5+b},1 M0,${.5+h} L${.5-b},${.5+h} L${.5-b},1 M0,${.5-h} L${.5-b},${.5-h} L${.5-b},0`},"╤":{1:(b,h)=>`M0,${.5-h} L1,${.5-h} M0,${.5+h} L1,${.5+h} M.5,${.5+h} L.5,1`},"╥":{1:(b,h)=>`M0,.5 L1,.5 M${.5-b},.5 L${.5-b},1 M${.5+b},.5 L${.5+b},1`},"╦":{1:(b,h)=>`M0,${.5-h} L1,${.5-h} M0,${.5+h} L${.5-b},${.5+h} L${.5-b},1 M1,${.5+h} L${.5+b},${.5+h} L${.5+b},1`},"╧":{1:(b,h)=>`M.5,0 L.5,${.5-h} M0,${.5-h} L1,${.5-h} M0,${.5+h} L1,${.5+h}`},"╨":{1:(b,h)=>`M0,.5 L1,.5 M${.5-b},.5 L${.5-b},0 M${.5+b},.5 L${.5+b},0`},"╩":{1:(b,h)=>`M0,${.5+h} L1,${.5+h} M0,${.5-h} L${.5-b},${.5-h} L${.5-b},0 M1,${.5-h} L${.5+b},${.5-h} L${.5+b},0`},"╪":{1:(b,h)=>`M.5,0 L.5,1 M0,${.5-h} L1,${.5-h} M0,${.5+h} L1,${.5+h}`},"╫":{1:(b,h)=>`M0,.5 L1,.5 M${.5-b},0 L${.5-b},1 M${.5+b},0 L${.5+b},1`},"╬":{1:(b,h)=>`M0,${.5+h} L${.5-b},${.5+h} L${.5-b},1 M1,${.5+h} L${.5+b},${.5+h} L${.5+b},1 M0,${.5-h} L${.5-b},${.5-h} L${.5-b},0 M1,${.5-h} L${.5+b},${.5-h} L${.5+b},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:(b,h)=>`M.5,1 L.5,${.5+h/.15*.5} C.5,${.5+h/.15*.5},.5,.5,1,.5`},"╮":{1:(b,h)=>`M.5,1 L.5,${.5+h/.15*.5} C.5,${.5+h/.15*.5},.5,.5,0,.5`},"╯":{1:(b,h)=>`M.5,0 L.5,${.5-h/.15*.5} C.5,${.5-h/.15*.5},.5,.5,0,.5`},"╰":{1:(b,h)=>`M.5,0 L.5,${.5-h/.15*.5} C.5,${.5-h/.15*.5},.5,.5,1,.5`}},o.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}},o.powerlineDefinitions[""]=o.powerlineDefinitions[""],o.powerlineDefinitions[""]=o.powerlineDefinitions[""],o.tryDrawCustomChar=function(b,h,_,g,p,T,A,E){const S=o.blockElementDefinitions[h];if(S)return(function(D,P,F,z,q,K){for(let V=0;V<P.length;V++){const W=P[V],O=q/8,U=K/8;D.fillRect(F+W.x*O,z+W.y*U,W.w*O,W.h*U)}})(b,S,_,g,p,T),!0;const x=w[h];if(x)return(function(D,P,F,z,q,K){let V=d.get(P);V||(V=new Map,d.set(P,V));const W=D.fillStyle;if(typeof W!="string")throw new Error(`Unexpected fillStyle type "${W}"`);let O=V.get(W);if(!O){const U=P[0].length,H=P.length,$=D.canvas.ownerDocument.createElement("canvas");$.width=U,$.height=H;const Z=(0,m.throwIfFalsy)($.getContext("2d")),re=new ImageData(U,H);let we,_e,Q,Y;if(W.startsWith("#"))we=parseInt(W.slice(1,3),16),_e=parseInt(W.slice(3,5),16),Q=parseInt(W.slice(5,7),16),Y=W.length>7&&parseInt(W.slice(7,9),16)||1;else{if(!W.startsWith("rgba"))throw new Error(`Unexpected fillStyle color format "${W}" when drawing pattern glyph`);[we,_e,Q,Y]=W.substring(5,W.length-1).split(",").map((te=>parseFloat(te)))}for(let te=0;te<H;te++)for(let ee=0;ee<U;ee++)re.data[4*(te*U+ee)]=we,re.data[4*(te*U+ee)+1]=_e,re.data[4*(te*U+ee)+2]=Q,re.data[4*(te*U+ee)+3]=P[te][ee]*(255*Y);Z.putImageData(re,0,0),O=(0,m.throwIfFalsy)(D.createPattern($,null)),V.set(W,O)}D.fillStyle=O,D.fillRect(F,z,q,K)})(b,x,_,g,p,T),!0;const R=o.boxDrawingDefinitions[h];if(R)return(function(D,P,F,z,q,K,V){D.strokeStyle=D.fillStyle;for(const[W,O]of Object.entries(P)){let U;D.beginPath(),D.lineWidth=V*Number.parseInt(W),U=typeof O=="function"?O(.15,.15/K*q):O;for(const H of U.split(" ")){const $=H[0],Z=L[$];if(!Z){console.error(`Could not find drawing instructions for "${$}"`);continue}const re=H.substring(1).split(",");re[0]&&re[1]&&Z(D,M(re,q,K,F,z,!0,V))}D.stroke(),D.closePath()}})(b,R,_,g,p,T,E),!0;const I=o.powerlineDefinitions[h];return!!I&&((function(D,P,F,z,q,K,V,W){const O=new Path2D;O.rect(F,z,q,K),D.clip(O),D.beginPath();const U=V/12;D.lineWidth=W*U;for(const H of P.d.split(" ")){const $=H[0],Z=L[$];if(!Z){console.error(`Could not find drawing instructions for "${$}"`);continue}const re=H.substring(1).split(",");re[0]&&re[1]&&Z(D,M(re,q,K,F,z,!1,W,(P.leftPadding??0)*(U/2),(P.rightPadding??0)*(U/2)))}P.type===1?(D.strokeStyle=D.fillStyle,D.stroke()):D.fill(),D.closePath()})(b,I,_,g,p,T,A,E),!0)};const d=new Map;function k(b,h,_=0){return Math.max(Math.min(b,h),_)}const L={C:(b,h)=>b.bezierCurveTo(h[0],h[1],h[2],h[3],h[4],h[5]),L:(b,h)=>b.lineTo(h[0],h[1]),M:(b,h)=>b.moveTo(h[0],h[1])};function M(b,h,_,g,p,T,A,E=0,S=0){const x=b.map((R=>parseFloat(R)||parseInt(R)));if(x.length<2)throw new Error("Too few arguments for instruction");for(let R=0;R<x.length;R+=2)x[R]*=h-E*A-S*A,T&&x[R]!==0&&(x[R]=k(Math.round(x[R]+.5)-.5,h,0)),x[R]+=g+E*A;for(let R=1;R<x.length;R+=2)x[R]*=_,T&&x[R]!==0&&(x[R]=k(Math.round(x[R]+.5)-.5,_,0)),x[R]+=p;return x}},56:(v,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.observeDevicePixelDimensions=void 0;const m=c(859);o.observeDevicePixelDimensions=function(w,d,k){let L=new d.ResizeObserver((M=>{const b=M.find((g=>g.target===w));if(!b)return;if(!("devicePixelContentBoxSize"in b))return L==null||L.disconnect(),void(L=void 0);const h=b.devicePixelContentBoxSize[0].inlineSize,_=b.devicePixelContentBoxSize[0].blockSize;h>0&&_>0&&k(h,_)}));try{L.observe(w,{box:["device-pixel-content-box"]})}catch{L.disconnect(),L=void 0}return(0,m.toDisposable)((()=>L==null?void 0:L.disconnect()))}},374:(v,o)=>{function c(w){return 57508<=w&&w<=57558}function m(w){return w>=128512&&w<=128591||w>=127744&&w<=128511||w>=128640&&w<=128767||w>=9728&&w<=9983||w>=9984&&w<=10175||w>=65024&&w<=65039||w>=129280&&w<=129535||w>=127462&&w<=127487}Object.defineProperty(o,"__esModule",{value:!0}),o.computeNextVariantOffset=o.createRenderDimensions=o.treatGlyphAsBackgroundColor=o.allowRescaling=o.isEmoji=o.isRestrictedPowerlineGlyph=o.isPowerlineGlyph=o.throwIfFalsy=void 0,o.throwIfFalsy=function(w){if(!w)throw new Error("value must not be falsy");return w},o.isPowerlineGlyph=c,o.isRestrictedPowerlineGlyph=function(w){return 57520<=w&&w<=57527},o.isEmoji=m,o.allowRescaling=function(w,d,k,L){return d===1&&k>Math.ceil(1.5*L)&&w!==void 0&&w>255&&!m(w)&&!c(w)&&!(function(M){return 57344<=M&&M<=63743})(w)},o.treatGlyphAsBackgroundColor=function(w){return c(w)||(function(d){return 9472<=d&&d<=9631})(w)},o.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}}}},o.computeNextVariantOffset=function(w,d,k=0){return(w-(2*Math.round(d)-k))%(2*Math.round(d))}},296:(v,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.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(w,d,k,L=!1){if(this.selectionStart=d,this.selectionEnd=k,!d||!k||d[0]===k[0]&&d[1]===k[1])return void this.clear();const M=w.buffers.active.ydisp,b=d[1]-M,h=k[1]-M,_=Math.max(b,0),g=Math.min(h,w.rows-1);_>=w.rows||g<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=L,this.viewportStartRow=b,this.viewportEndRow=h,this.viewportCappedStartRow=_,this.viewportCappedEndRow=g,this.startCol=d[0],this.endCol=k[0])}isCellSelected(w,d,k){return!!this.hasSelection&&(k-=w.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?d>=this.startCol&&k>=this.viewportCappedStartRow&&d<this.endCol&&k<=this.viewportCappedEndRow:d<this.startCol&&k>=this.viewportCappedStartRow&&d>=this.endCol&&k<=this.viewportCappedEndRow:k>this.viewportStartRow&&k<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&k===this.viewportStartRow&&d>=this.startCol&&d<this.endCol||this.viewportStartRow<this.viewportEndRow&&k===this.viewportEndRow&&d<this.endCol||this.viewportStartRow<this.viewportEndRow&&k===this.viewportStartRow&&d>=this.startCol)}}o.createSelectionRenderModel=function(){return new c}},509:(v,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.TextureAtlas=void 0;const m=c(237),w=c(860),d=c(374),k=c(160),L=c(345),M=c(485),b=c(385),h=c(147),_=c(855),g={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 p;class T{get pages(){return this._pages}constructor(R,I,D){this._document=R,this._config=I,this._unicodeService=D,this._didWarmUp=!1,this._cacheMap=new M.FourKeyMap,this._cacheMapCombined=new M.FourKeyMap,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new h.AttributeData,this._textureSize=512,this._onAddTextureAtlasCanvas=new L.EventEmitter,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new L.EventEmitter,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=S(R,4*this._config.deviceCellWidth+4,this._config.deviceCellHeight+4),this._tmpCtx=(0,d.throwIfFalsy)(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}dispose(){for(const R of this.pages)R.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){const R=new b.IdleTaskQueue;for(let I=33;I<126;I++)R.enqueue((()=>{if(!this._cacheMap.get(I,_.DEFAULT_COLOR,_.DEFAULT_COLOR,_.DEFAULT_EXT)){const D=this._drawToCache(I,_.DEFAULT_COLOR,_.DEFAULT_COLOR,_.DEFAULT_EXT);this._cacheMap.set(I,_.DEFAULT_COLOR,_.DEFAULT_COLOR,_.DEFAULT_EXT,D)}}))}beginFrame(){return this._requestClearModel}clearTexture(){if(this._pages[0].currentRow.x!==0||this._pages[0].currentRow.y!==0){for(const R of this._pages)R.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(T.maxAtlasPages&&this._pages.length>=Math.max(4,T.maxAtlasPages)){const I=this._pages.filter((V=>2*V.canvas.width<=(T.maxTextureSize||4096))).sort(((V,W)=>W.canvas.width!==V.canvas.width?W.canvas.width-V.canvas.width:W.percentageUsed-V.percentageUsed));let D=-1,P=0;for(let V=0;V<I.length;V++)if(I[V].canvas.width!==P)D=V,P=I[V].canvas.width;else if(V-D==3)break;const F=I.slice(D,D+4),z=F.map((V=>V.glyphs[0].texturePage)).sort(((V,W)=>V>W?1:-1)),q=this.pages.length-F.length,K=this._mergePages(F,q);K.version++;for(let V=z.length-1;V>=0;V--)this._deletePage(z[V]);this.pages.push(K),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(K.canvas)}const R=new A(this._document,this._textureSize);return this._pages.push(R),this._activePages.push(R),this._onAddTextureAtlasCanvas.fire(R.canvas),R}_mergePages(R,I){const D=2*R[0].canvas.width,P=new A(this._document,D,R);for(const[F,z]of R.entries()){const q=F*z.canvas.width%D,K=Math.floor(F/2)*z.canvas.height;P.ctx.drawImage(z.canvas,q,K);for(const W of z.glyphs)W.texturePage=I,W.sizeClipSpace.x=W.size.x/D,W.sizeClipSpace.y=W.size.y/D,W.texturePosition.x+=q,W.texturePosition.y+=K,W.texturePositionClipSpace.x=W.texturePosition.x/D,W.texturePositionClipSpace.y=W.texturePosition.y/D;this._onRemoveTextureAtlasCanvas.fire(z.canvas);const V=this._activePages.indexOf(z);V!==-1&&this._activePages.splice(V,1)}return P}_deletePage(R){this._pages.splice(R,1);for(let I=R;I<this._pages.length;I++){const D=this._pages[I];for(const P of D.glyphs)P.texturePage--;D.version++}}getRasterizedGlyphCombinedChar(R,I,D,P,F){return this._getFromCacheMap(this._cacheMapCombined,R,I,D,P,F)}getRasterizedGlyph(R,I,D,P,F){return this._getFromCacheMap(this._cacheMap,R,I,D,P,F)}_getFromCacheMap(R,I,D,P,F,z=!1){return p=R.get(I,D,P,F),p||(p=this._drawToCache(I,D,P,F,z),R.set(I,D,P,F,p)),p}_getColorFromAnsiIndex(R){if(R>=this._config.colors.ansi.length)throw new Error("No color found for idx "+R);return this._config.colors.ansi[R]}_getBackgroundColor(R,I,D,P){if(this._config.allowTransparency)return k.NULL_COLOR;let F;switch(R){case 16777216:case 33554432:F=this._getColorFromAnsiIndex(I);break;case 50331648:const z=h.AttributeData.toColorRGB(I);F=k.channels.toColor(z[0],z[1],z[2]);break;default:F=D?k.color.opaque(this._config.colors.foreground):this._config.colors.background}return F}_getForegroundColor(R,I,D,P,F,z,q,K,V,W){const O=this._getMinimumContrastColor(R,I,D,P,F,z,q,V,K,W);if(O)return O;let U;switch(F){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&V&&z<8&&(z+=8),U=this._getColorFromAnsiIndex(z);break;case 50331648:const H=h.AttributeData.toColorRGB(z);U=k.channels.toColor(H[0],H[1],H[2]);break;default:U=q?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(U=k.color.opaque(U)),K&&(U=k.color.multiplyOpacity(U,m.DIM_OPACITY)),U}_resolveBackgroundRgba(R,I,D){switch(R){case 16777216:case 33554432:return this._getColorFromAnsiIndex(I).rgba;case 50331648:return I<<8;default:return D?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(R,I,D,P){switch(R){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&P&&I<8&&(I+=8),this._getColorFromAnsiIndex(I).rgba;case 50331648:return I<<8;default:return D?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(R,I,D,P,F,z,q,K,V,W){if(this._config.minimumContrastRatio===1||W)return;const O=this._getContrastCache(V),U=O.getColor(R,P);if(U!==void 0)return U||void 0;const H=this._resolveBackgroundRgba(I,D,q),$=this._resolveForegroundRgba(F,z,q,K),Z=k.rgba.ensureContrastRatio(H,$,this._config.minimumContrastRatio/(V?2:1));if(!Z)return void O.setColor(R,P,null);const re=k.channels.toColor(Z>>24&255,Z>>16&255,Z>>8&255);return O.setColor(R,P,re),re}_getContrastCache(R){return R?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(R,I,D,P,F=!1){const z=typeof R=="number"?String.fromCharCode(R):R,q=Math.min(this._config.deviceCellWidth*Math.max(z.length,2)+4,this._textureSize);this._tmpCanvas.width<q&&(this._tmpCanvas.width=q);const K=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<K&&(this._tmpCanvas.height=K),this._tmpCtx.save(),this._workAttributeData.fg=D,this._workAttributeData.bg=I,this._workAttributeData.extended.ext=P,this._workAttributeData.isInvisible())return g;const V=!!this._workAttributeData.isBold(),W=!!this._workAttributeData.isInverse(),O=!!this._workAttributeData.isDim(),U=!!this._workAttributeData.isItalic(),H=!!this._workAttributeData.isUnderline(),$=!!this._workAttributeData.isStrikethrough(),Z=!!this._workAttributeData.isOverline();let re=this._workAttributeData.getFgColor(),we=this._workAttributeData.getFgColorMode(),_e=this._workAttributeData.getBgColor(),Q=this._workAttributeData.getBgColorMode();if(W){const Le=re;re=_e,_e=Le;const nt=we;we=Q,Q=nt}const Y=this._getBackgroundColor(Q,_e,W,O);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=Y.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";const te=V?this._config.fontWeightBold:this._config.fontWeight,ee=U?"italic":"";this._tmpCtx.font=`${ee} ${te} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=m.TEXT_BASELINE;const ye=z.length===1&&(0,d.isPowerlineGlyph)(z.charCodeAt(0)),ge=z.length===1&&(0,d.isRestrictedPowerlineGlyph)(z.charCodeAt(0)),Be=this._getForegroundColor(I,Q,_e,D,we,re,W,O,V,(0,d.treatGlyphAsBackgroundColor)(z.charCodeAt(0)));this._tmpCtx.fillStyle=Be.css;const Ue=ge?0:4;let ze=!1;this._config.customGlyphs!==!1&&(ze=(0,w.tryDrawCustomChar)(this._tmpCtx,z,Ue,Ue,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let gt,Fe=!ye;if(gt=typeof R=="number"?this._unicodeService.wcwidth(R):this._unicodeService.getStringCellWidth(R),H){this._tmpCtx.save();const Le=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),nt=Le%2==1?.5:0;if(this._tmpCtx.lineWidth=Le,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())Fe=!1,this._tmpCtx.strokeStyle=`rgb(${h.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{Fe=!1;let vt=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&vt<8&&(vt+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(vt).css}this._tmpCtx.beginPath();const je=Ue,Ke=Math.ceil(Ue+this._config.deviceCharHeight)-nt-(F?2*Le:0),kt=Ke+Le,Lt=Ke+2*Le;let xt=this._workAttributeData.getUnderlineVariantOffset();for(let vt=0;vt<gt;vt++){this._tmpCtx.save();const dt=je+vt*this._config.deviceCellWidth,Qe=je+(vt+1)*this._config.deviceCellWidth,St=dt+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(dt,Ke),this._tmpCtx.lineTo(Qe,Ke),this._tmpCtx.moveTo(dt,Lt),this._tmpCtx.lineTo(Qe,Lt);break;case 3:const Ft=Le<=1?Lt:Math.ceil(Ue+this._config.deviceCharHeight-Le/2)-nt,Gt=Le<=1?Ke:Math.ceil(Ue+this._config.deviceCharHeight+Le/2)-nt,Ie=new Path2D;Ie.rect(dt,Ke,this._config.deviceCellWidth,Lt-Ke),this._tmpCtx.clip(Ie),this._tmpCtx.moveTo(dt-this._config.deviceCellWidth/2,kt),this._tmpCtx.bezierCurveTo(dt-this._config.deviceCellWidth/2,Gt,dt,Gt,dt,kt),this._tmpCtx.bezierCurveTo(dt,Ft,St,Ft,St,kt),this._tmpCtx.bezierCurveTo(St,Gt,Qe,Gt,Qe,kt),this._tmpCtx.bezierCurveTo(Qe,Ft,Qe+this._config.deviceCellWidth/2,Ft,Qe+this._config.deviceCellWidth/2,kt);break;case 4:const $e=xt===0?0:xt>=Le?2*Le-xt:Le-xt;xt>=Le||$e===0?(this._tmpCtx.setLineDash([Math.round(Le),Math.round(Le)]),this._tmpCtx.moveTo(dt+$e,Ke),this._tmpCtx.lineTo(Qe,Ke)):(this._tmpCtx.setLineDash([Math.round(Le),Math.round(Le)]),this._tmpCtx.moveTo(dt,Ke),this._tmpCtx.lineTo(dt+$e,Ke),this._tmpCtx.moveTo(dt+$e+Le,Ke),this._tmpCtx.lineTo(Qe,Ke)),xt=(0,d.computeNextVariantOffset)(Qe-dt,Le,xt);break;case 5:const ue=.6,st=.3,ft=Qe-dt,et=Math.floor(ue*ft),tt=Math.floor(st*ft),de=ft-et-tt;this._tmpCtx.setLineDash([et,tt,de]),this._tmpCtx.moveTo(dt,Ke),this._tmpCtx.lineTo(Qe,Ke);break;default:this._tmpCtx.moveTo(dt,Ke),this._tmpCtx.lineTo(Qe,Ke)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!ze&&this._config.fontSize>=12&&!this._config.allowTransparency&&z!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";const vt=this._tmpCtx.measureText(z);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in vt&&vt.actualBoundingBoxDescent>0){this._tmpCtx.save();const dt=new Path2D;dt.rect(je,Ke-Math.ceil(Le/2),this._config.deviceCellWidth*gt,Lt-Ke+Math.ceil(Le/2)),this._tmpCtx.clip(dt),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=Y.css,this._tmpCtx.strokeText(z,Ue,Ue+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(Z){const Le=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),nt=Le%2==1?.5:0;this._tmpCtx.lineWidth=Le,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(Ue,Ue+nt),this._tmpCtx.lineTo(Ue+this._config.deviceCharWidth*gt,Ue+nt),this._tmpCtx.stroke()}if(ze||this._tmpCtx.fillText(z,Ue,Ue+this._config.deviceCharHeight),z==="_"&&!this._config.allowTransparency){let Le=E(this._tmpCtx.getImageData(Ue,Ue,this._config.deviceCellWidth,this._config.deviceCellHeight),Y,Be,Fe);if(Le)for(let nt=1;nt<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=Y.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(z,Ue,Ue+this._config.deviceCharHeight-nt),Le=E(this._tmpCtx.getImageData(Ue,Ue,this._config.deviceCellWidth,this._config.deviceCellHeight),Y,Be,Fe),Le);nt++);}if($){const Le=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),nt=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=Le,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(Ue,Ue+Math.floor(this._config.deviceCharHeight/2)-nt),this._tmpCtx.lineTo(Ue+this._config.deviceCharWidth*gt,Ue+Math.floor(this._config.deviceCharHeight/2)-nt),this._tmpCtx.stroke()}this._tmpCtx.restore();const pt=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height);let yt;if(yt=this._config.allowTransparency?(function(Le){for(let nt=0;nt<Le.data.length;nt+=4)if(Le.data[nt+3]>0)return!1;return!0})(pt):E(pt,Y,Be,Fe),yt)return g;const oe=this._findGlyphBoundingBox(pt,this._workBoundingBox,q,ge,ze,Ue);let Ae,De;for(;;){if(this._activePages.length===0){const Le=this._createNewPage();Ae=Le,De=Le.currentRow,De.height=oe.size.y;break}Ae=this._activePages[this._activePages.length-1],De=Ae.currentRow;for(const Le of this._activePages)oe.size.y<=Le.currentRow.height&&(Ae=Le,De=Le.currentRow);for(let Le=this._activePages.length-1;Le>=0;Le--)for(const nt of this._activePages[Le].fixedRows)nt.height<=De.height&&oe.size.y<=nt.height&&(Ae=this._activePages[Le],De=nt);if(De.y+oe.size.y>=Ae.canvas.height||De.height>oe.size.y+2){let Le=!1;if(Ae.currentRow.y+Ae.currentRow.height+oe.size.y>=Ae.canvas.height){let nt;for(const je of this._activePages)if(je.currentRow.y+je.currentRow.height+oe.size.y<je.canvas.height){nt=je;break}if(nt)Ae=nt;else if(T.maxAtlasPages&&this._pages.length>=T.maxAtlasPages&&De.y+oe.size.y<=Ae.canvas.height&&De.height>=oe.size.y&&De.x+oe.size.x<=Ae.canvas.width)Le=!0;else{const je=this._createNewPage();Ae=je,De=je.currentRow,De.height=oe.size.y,Le=!0}}Le||(Ae.currentRow.height>0&&Ae.fixedRows.push(Ae.currentRow),De={x:0,y:Ae.currentRow.y+Ae.currentRow.height,height:oe.size.y},Ae.fixedRows.push(De),Ae.currentRow={x:0,y:De.y+De.height,height:0})}if(De.x+oe.size.x<=Ae.canvas.width)break;De===Ae.currentRow?(De.x=0,De.y+=De.height,De.height=0):Ae.fixedRows.splice(Ae.fixedRows.indexOf(De),1)}return oe.texturePage=this._pages.indexOf(Ae),oe.texturePosition.x=De.x,oe.texturePosition.y=De.y,oe.texturePositionClipSpace.x=De.x/Ae.canvas.width,oe.texturePositionClipSpace.y=De.y/Ae.canvas.height,oe.sizeClipSpace.x/=Ae.canvas.width,oe.sizeClipSpace.y/=Ae.canvas.height,De.height=Math.max(De.height,oe.size.y),De.x+=oe.size.x,Ae.ctx.putImageData(pt,oe.texturePosition.x-this._workBoundingBox.left,oe.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,oe.size.x,oe.size.y),Ae.addGlyph(oe),Ae.version++,oe}_findGlyphBoundingBox(R,I,D,P,F,z){I.top=0;const q=P?this._config.deviceCellHeight:this._tmpCanvas.height,K=P?this._config.deviceCellWidth:D;let V=!1;for(let W=0;W<q;W++){for(let O=0;O<K;O++){const U=W*this._tmpCanvas.width*4+4*O+3;if(R.data[U]!==0){I.top=W,V=!0;break}}if(V)break}I.left=0,V=!1;for(let W=0;W<z+K;W++){for(let O=0;O<q;O++){const U=O*this._tmpCanvas.width*4+4*W+3;if(R.data[U]!==0){I.left=W,V=!0;break}}if(V)break}I.right=K,V=!1;for(let W=z+K-1;W>=z;W--){for(let O=0;O<q;O++){const U=O*this._tmpCanvas.width*4+4*W+3;if(R.data[U]!==0){I.right=W,V=!0;break}}if(V)break}I.bottom=q,V=!1;for(let W=q-1;W>=0;W--){for(let O=0;O<K;O++){const U=W*this._tmpCanvas.width*4+4*O+3;if(R.data[U]!==0){I.bottom=W,V=!0;break}}if(V)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+z+(P||F?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-I.top+z+(P||F?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}}o.TextureAtlas=T;class A{get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(R){this._glyphs.push(R),this._usedPixels+=R.size.x*R.size.y}constructor(R,I,D){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],D)for(const P of D)this._glyphs.push(...P.glyphs),this._usedPixels+=P._usedPixels;this.canvas=S(R,I,I),this.ctx=(0,d.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 E(x,R,I,D){const P=R.rgba>>>24,F=R.rgba>>>16&255,z=R.rgba>>>8&255,q=I.rgba>>>24,K=I.rgba>>>16&255,V=I.rgba>>>8&255,W=Math.floor((Math.abs(P-q)+Math.abs(F-K)+Math.abs(z-V))/12);let O=!0;for(let U=0;U<x.data.length;U+=4)x.data[U]===P&&x.data[U+1]===F&&x.data[U+2]===z||D&&Math.abs(x.data[U]-P)+Math.abs(x.data[U+1]-F)+Math.abs(x.data[U+2]-z)<W?x.data[U+3]=0:O=!1;return O}function S(x,R,I){const D=x.createElement("canvas");return D.width=R,D.height=I,D}},160:(v,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.contrastRatio=o.toPaddedHex=o.rgba=o.rgb=o.css=o.color=o.channels=o.NULL_COLOR=void 0;let c=0,m=0,w=0,d=0;var k,L,M,b,h;function _(p){const T=p.toString(16);return T.length<2?"0"+T:T}function g(p,T){return p<T?(T+.05)/(p+.05):(p+.05)/(T+.05)}o.NULL_COLOR={css:"#00000000",rgba:0},(function(p){p.toCss=function(T,A,E,S){return S!==void 0?`#${_(T)}${_(A)}${_(E)}${_(S)}`:`#${_(T)}${_(A)}${_(E)}`},p.toRgba=function(T,A,E,S=255){return(T<<24|A<<16|E<<8|S)>>>0},p.toColor=function(T,A,E,S){return{css:p.toCss(T,A,E,S),rgba:p.toRgba(T,A,E,S)}}})(k||(o.channels=k={})),(function(p){function T(A,E){return d=Math.round(255*E),[c,m,w]=h.toChannels(A.rgba),{css:k.toCss(c,m,w,d),rgba:k.toRgba(c,m,w,d)}}p.blend=function(A,E){if(d=(255&E.rgba)/255,d===1)return{css:E.css,rgba:E.rgba};const S=E.rgba>>24&255,x=E.rgba>>16&255,R=E.rgba>>8&255,I=A.rgba>>24&255,D=A.rgba>>16&255,P=A.rgba>>8&255;return c=I+Math.round((S-I)*d),m=D+Math.round((x-D)*d),w=P+Math.round((R-P)*d),{css:k.toCss(c,m,w),rgba:k.toRgba(c,m,w)}},p.isOpaque=function(A){return(255&A.rgba)==255},p.ensureContrastRatio=function(A,E,S){const x=h.ensureContrastRatio(A.rgba,E.rgba,S);if(x)return k.toColor(x>>24&255,x>>16&255,x>>8&255)},p.opaque=function(A){const E=(255|A.rgba)>>>0;return[c,m,w]=h.toChannels(E),{css:k.toCss(c,m,w),rgba:E}},p.opacity=T,p.multiplyOpacity=function(A,E){return d=255&A.rgba,T(A,d*E/255)},p.toColorRGB=function(A){return[A.rgba>>24&255,A.rgba>>16&255,A.rgba>>8&255]}})(L||(o.color=L={})),(function(p){let T,A;try{const E=document.createElement("canvas");E.width=1,E.height=1;const S=E.getContext("2d",{willReadFrequently:!0});S&&(T=S,T.globalCompositeOperation="copy",A=T.createLinearGradient(0,0,1,1))}catch{}p.toColor=function(E){if(E.match(/#[\da-f]{3,8}/i))switch(E.length){case 4:return c=parseInt(E.slice(1,2).repeat(2),16),m=parseInt(E.slice(2,3).repeat(2),16),w=parseInt(E.slice(3,4).repeat(2),16),k.toColor(c,m,w);case 5:return c=parseInt(E.slice(1,2).repeat(2),16),m=parseInt(E.slice(2,3).repeat(2),16),w=parseInt(E.slice(3,4).repeat(2),16),d=parseInt(E.slice(4,5).repeat(2),16),k.toColor(c,m,w,d);case 7:return{css:E,rgba:(parseInt(E.slice(1),16)<<8|255)>>>0};case 9:return{css:E,rgba:parseInt(E.slice(1),16)>>>0}}const S=E.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(S)return c=parseInt(S[1]),m=parseInt(S[2]),w=parseInt(S[3]),d=Math.round(255*(S[5]===void 0?1:parseFloat(S[5]))),k.toColor(c,m,w,d);if(!T||!A)throw new Error("css.toColor: Unsupported css format");if(T.fillStyle=A,T.fillStyle=E,typeof T.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(T.fillRect(0,0,1,1),[c,m,w,d]=T.getImageData(0,0,1,1).data,d!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:k.toRgba(c,m,w,d),css:E}}})(M||(o.css=M={})),(function(p){function T(A,E,S){const x=A/255,R=E/255,I=S/255;return .2126*(x<=.03928?x/12.92:Math.pow((x+.055)/1.055,2.4))+.7152*(R<=.03928?R/12.92:Math.pow((R+.055)/1.055,2.4))+.0722*(I<=.03928?I/12.92:Math.pow((I+.055)/1.055,2.4))}p.relativeLuminance=function(A){return T(A>>16&255,A>>8&255,255&A)},p.relativeLuminance2=T})(b||(o.rgb=b={})),(function(p){function T(E,S,x){const R=E>>24&255,I=E>>16&255,D=E>>8&255;let P=S>>24&255,F=S>>16&255,z=S>>8&255,q=g(b.relativeLuminance2(P,F,z),b.relativeLuminance2(R,I,D));for(;q<x&&(P>0||F>0||z>0);)P-=Math.max(0,Math.ceil(.1*P)),F-=Math.max(0,Math.ceil(.1*F)),z-=Math.max(0,Math.ceil(.1*z)),q=g(b.relativeLuminance2(P,F,z),b.relativeLuminance2(R,I,D));return(P<<24|F<<16|z<<8|255)>>>0}function A(E,S,x){const R=E>>24&255,I=E>>16&255,D=E>>8&255;let P=S>>24&255,F=S>>16&255,z=S>>8&255,q=g(b.relativeLuminance2(P,F,z),b.relativeLuminance2(R,I,D));for(;q<x&&(P<255||F<255||z<255);)P=Math.min(255,P+Math.ceil(.1*(255-P))),F=Math.min(255,F+Math.ceil(.1*(255-F))),z=Math.min(255,z+Math.ceil(.1*(255-z))),q=g(b.relativeLuminance2(P,F,z),b.relativeLuminance2(R,I,D));return(P<<24|F<<16|z<<8|255)>>>0}p.blend=function(E,S){if(d=(255&S)/255,d===1)return S;const x=S>>24&255,R=S>>16&255,I=S>>8&255,D=E>>24&255,P=E>>16&255,F=E>>8&255;return c=D+Math.round((x-D)*d),m=P+Math.round((R-P)*d),w=F+Math.round((I-F)*d),k.toRgba(c,m,w)},p.ensureContrastRatio=function(E,S,x){const R=b.relativeLuminance(E>>8),I=b.relativeLuminance(S>>8);if(g(R,I)<x){if(I<R){const F=T(E,S,x),z=g(R,b.relativeLuminance(F>>8));if(z<x){const q=A(E,S,x);return z>g(R,b.relativeLuminance(q>>8))?F:q}return F}const D=A(E,S,x),P=g(R,b.relativeLuminance(D>>8));if(P<x){const F=T(E,S,x);return P>g(R,b.relativeLuminance(F>>8))?D:F}return D}},p.reduceLuminance=T,p.increaseLuminance=A,p.toChannels=function(E){return[E>>24&255,E>>16&255,E>>8&255,255&E]}})(h||(o.rgba=h={})),o.toPaddedHex=_,o.contrastRatio=g},345:(v,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.runAndSubscribe=o.forwardEvent=o.EventEmitter=void 0,o.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=c=>(this._listeners.push(c),{dispose:()=>{if(!this._disposed){for(let m=0;m<this._listeners.length;m++)if(this._listeners[m]===c)return void this._listeners.splice(m,1)}}})),this._event}fire(c,m){const w=[];for(let d=0;d<this._listeners.length;d++)w.push(this._listeners[d]);for(let d=0;d<w.length;d++)w[d].call(void 0,c,m)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},o.forwardEvent=function(c,m){return c((w=>m.fire(w)))},o.runAndSubscribe=function(c,m){return m(void 0),c((w=>m(w)))}},859:(v,o)=>{function c(m){for(const w of m)w.dispose();m.length=0}Object.defineProperty(o,"__esModule",{value:!0}),o.getDisposeArrayDisposable=o.disposeArray=o.toDisposable=o.MutableDisposable=o.Disposable=void 0,o.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const m of this._disposables)m.dispose();this._disposables.length=0}register(m){return this._disposables.push(m),m}unregister(m){const w=this._disposables.indexOf(m);w!==-1&&this._disposables.splice(w,1)}},o.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(m){var w;this._isDisposed||m===this._value||((w=this._value)==null||w.dispose(),this._value=m)}clear(){this.value=void 0}dispose(){var m;this._isDisposed=!0,(m=this._value)==null||m.dispose(),this._value=void 0}},o.toDisposable=function(m){return{dispose:m}},o.disposeArray=c,o.getDisposeArrayDisposable=function(m){return{dispose:()=>c(m)}}},485:(v,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.FourKeyMap=o.TwoKeyMap=void 0;class c{constructor(){this._data={}}set(w,d,k){this._data[w]||(this._data[w]={}),this._data[w][d]=k}get(w,d){return this._data[w]?this._data[w][d]:void 0}clear(){this._data={}}}o.TwoKeyMap=c,o.FourKeyMap=class{constructor(){this._data=new c}set(m,w,d,k,L){this._data.get(m,w)||this._data.set(m,w,new c),this._data.get(m,w).set(d,k,L)}get(m,w,d,k){var L;return(L=this._data.get(m,w))==null?void 0:L.get(d,k)}clear(){this._data.clear()}}},399:(v,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.isChromeOS=o.isLinux=o.isWindows=o.isIphone=o.isIpad=o.isMac=o.getSafariVersion=o.isSafari=o.isLegacyEdge=o.isFirefox=o.isNode=void 0,o.isNode=typeof process<"u"&&"title"in process;const c=o.isNode?"node":navigator.userAgent,m=o.isNode?"node":navigator.platform;o.isFirefox=c.includes("Firefox"),o.isLegacyEdge=c.includes("Edge"),o.isSafari=/^((?!chrome|android).)*safari/i.test(c),o.getSafariVersion=function(){if(!o.isSafari)return 0;const w=c.match(/Version\/(\d+)/);return w===null||w.length<2?0:parseInt(w[1])},o.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(m),o.isIpad=m==="iPad",o.isIphone=m==="iPhone",o.isWindows=["Windows","Win16","Win32","WinCE"].includes(m),o.isLinux=m.indexOf("Linux")>=0,o.isChromeOS=/\bCrOS\b/.test(c)},385:(v,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DebouncedIdleTask=o.IdleTaskQueue=o.PriorityTaskQueue=void 0;const m=c(399);class w{constructor(){this._tasks=[],this._i=0}enqueue(L){this._tasks.push(L),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(L){this._idleCallback=void 0;let M=0,b=0,h=L.timeRemaining(),_=0;for(;this._i<this._tasks.length;){if(M=Date.now(),this._tasks[this._i]()||this._i++,M=Math.max(1,Date.now()-M),b=Math.max(M,b),_=L.timeRemaining(),1.5*b>_)return h-M<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(h-M))}ms`),void this._start();h=_}this.clear()}}class d extends w{_requestCallback(L){return setTimeout((()=>L(this._createDeadline(16))))}_cancelCallback(L){clearTimeout(L)}_createDeadline(L){const M=Date.now()+L;return{timeRemaining:()=>Math.max(0,M-Date.now())}}}o.PriorityTaskQueue=d,o.IdleTaskQueue=!m.isNode&&"requestIdleCallback"in window?class extends w{_requestCallback(k){return requestIdleCallback(k)}_cancelCallback(k){cancelIdleCallback(k)}}:d,o.DebouncedIdleTask=class{constructor(){this._queue=new o.IdleTaskQueue}set(k){this._queue.clear(),this._queue.enqueue(k)}flush(){this._queue.flush()}}},147:(v,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ExtendedAttrs=o.AttributeData=void 0;class c{constructor(){this.fg=0,this.bg=0,this.extended=new m}static toColorRGB(d){return[d>>>16&255,d>>>8&255,255&d]}static fromColorRGB(d){return(255&d[0])<<16|(255&d[1])<<8|255&d[2]}clone(){const d=new c;return d.fg=this.fg,d.bg=this.bg,d.extended=this.extended.clone(),d}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}}o.AttributeData=c;class m{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(d){this._ext=d}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(d){this._ext&=-469762049,this._ext|=d<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(d){this._ext&=-67108864,this._ext|=67108863&d}get urlId(){return this._urlId}set urlId(d){this._urlId=d}get underlineVariantOffset(){const d=(3758096384&this._ext)>>29;return d<0?4294967288^d:d}set underlineVariantOffset(d){this._ext&=536870911,this._ext|=d<<29&3758096384}constructor(d=0,k=0){this._ext=0,this._urlId=0,this._ext=d,this._urlId=k}clone(){return new m(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}o.ExtendedAttrs=m},782:(v,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CellData=void 0;const m=c(133),w=c(855),d=c(147);class k extends d.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new d.ExtendedAttrs,this.combinedData=""}static fromCharData(M){const b=new k;return b.setFromCharData(M),b}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,m.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(M){this.fg=M[w.CHAR_DATA_ATTR_INDEX],this.bg=0;let b=!1;if(M[w.CHAR_DATA_CHAR_INDEX].length>2)b=!0;else if(M[w.CHAR_DATA_CHAR_INDEX].length===2){const h=M[w.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=h&&h<=56319){const _=M[w.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=_&&_<=57343?this.content=1024*(h-55296)+_-56320+65536|M[w.CHAR_DATA_WIDTH_INDEX]<<22:b=!0}else b=!0}else this.content=M[w.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|M[w.CHAR_DATA_WIDTH_INDEX]<<22;b&&(this.combinedData=M[w.CHAR_DATA_CHAR_INDEX],this.content=2097152|M[w.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}o.CellData=k},855:(v,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.WHITESPACE_CELL_CODE=o.WHITESPACE_CELL_WIDTH=o.WHITESPACE_CELL_CHAR=o.NULL_CELL_CODE=o.NULL_CELL_WIDTH=o.NULL_CELL_CHAR=o.CHAR_DATA_CODE_INDEX=o.CHAR_DATA_WIDTH_INDEX=o.CHAR_DATA_CHAR_INDEX=o.CHAR_DATA_ATTR_INDEX=o.DEFAULT_EXT=o.DEFAULT_ATTR=o.DEFAULT_COLOR=void 0,o.DEFAULT_COLOR=0,o.DEFAULT_ATTR=256|o.DEFAULT_COLOR<<9,o.DEFAULT_EXT=0,o.CHAR_DATA_ATTR_INDEX=0,o.CHAR_DATA_CHAR_INDEX=1,o.CHAR_DATA_WIDTH_INDEX=2,o.CHAR_DATA_CODE_INDEX=3,o.NULL_CELL_CHAR="",o.NULL_CELL_WIDTH=1,o.NULL_CELL_CODE=0,o.WHITESPACE_CELL_CHAR=" ",o.WHITESPACE_CELL_WIDTH=1,o.WHITESPACE_CELL_CODE=32},133:(v,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Utf8ToUtf32=o.StringToUtf32=o.utf32ToString=o.stringFromCodePoint=void 0,o.stringFromCodePoint=function(c){return c>65535?(c-=65536,String.fromCharCode(55296+(c>>10))+String.fromCharCode(c%1024+56320)):String.fromCharCode(c)},o.utf32ToString=function(c,m=0,w=c.length){let d="";for(let k=m;k<w;++k){let L=c[k];L>65535?(L-=65536,d+=String.fromCharCode(55296+(L>>10))+String.fromCharCode(L%1024+56320)):d+=String.fromCharCode(L)}return d},o.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(c,m){const w=c.length;if(!w)return 0;let d=0,k=0;if(this._interim){const L=c.charCodeAt(k++);56320<=L&&L<=57343?m[d++]=1024*(this._interim-55296)+L-56320+65536:(m[d++]=this._interim,m[d++]=L),this._interim=0}for(let L=k;L<w;++L){const M=c.charCodeAt(L);if(55296<=M&&M<=56319){if(++L>=w)return this._interim=M,d;const b=c.charCodeAt(L);56320<=b&&b<=57343?m[d++]=1024*(M-55296)+b-56320+65536:(m[d++]=M,m[d++]=b)}else M!==65279&&(m[d++]=M)}return d}},o.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(c,m){const w=c.length;if(!w)return 0;let d,k,L,M,b=0,h=0,_=0;if(this.interim[0]){let T=!1,A=this.interim[0];A&=(224&A)==192?31:(240&A)==224?15:7;let E,S=0;for(;(E=63&this.interim[++S])&&S<4;)A<<=6,A|=E;const x=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,R=x-S;for(;_<R;){if(_>=w)return 0;if(E=c[_++],(192&E)!=128){_--,T=!0;break}this.interim[S++]=E,A<<=6,A|=63&E}T||(x===2?A<128?_--:m[b++]=A:x===3?A<2048||A>=55296&&A<=57343||A===65279||(m[b++]=A):A<65536||A>1114111||(m[b++]=A)),this.interim.fill(0)}const g=w-4;let p=_;for(;p<w;){for(;!(!(p<g)||128&(d=c[p])||128&(k=c[p+1])||128&(L=c[p+2])||128&(M=c[p+3]));)m[b++]=d,m[b++]=k,m[b++]=L,m[b++]=M,p+=4;if(d=c[p++],d<128)m[b++]=d;else if((224&d)==192){if(p>=w)return this.interim[0]=d,b;if(k=c[p++],(192&k)!=128){p--;continue}if(h=(31&d)<<6|63&k,h<128){p--;continue}m[b++]=h}else if((240&d)==224){if(p>=w)return this.interim[0]=d,b;if(k=c[p++],(192&k)!=128){p--;continue}if(p>=w)return this.interim[0]=d,this.interim[1]=k,b;if(L=c[p++],(192&L)!=128){p--;continue}if(h=(15&d)<<12|(63&k)<<6|63&L,h<2048||h>=55296&&h<=57343||h===65279)continue;m[b++]=h}else if((248&d)==240){if(p>=w)return this.interim[0]=d,b;if(k=c[p++],(192&k)!=128){p--;continue}if(p>=w)return this.interim[0]=d,this.interim[1]=k,b;if(L=c[p++],(192&L)!=128){p--;continue}if(p>=w)return this.interim[0]=d,this.interim[1]=k,this.interim[2]=L,b;if(M=c[p++],(192&M)!=128){p--;continue}if(h=(7&d)<<18|(63&k)<<12|(63&L)<<6|63&M,h<65536||h>1114111)continue;m[b++]=h}}return b}}},776:function(v,o,c){var m=this&&this.__decorate||function(h,_,g,p){var T,A=arguments.length,E=A<3?_:p===null?p=Object.getOwnPropertyDescriptor(_,g):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(h,_,g,p);else for(var S=h.length-1;S>=0;S--)(T=h[S])&&(E=(A<3?T(E):A>3?T(_,g,E):T(_,g))||E);return A>3&&E&&Object.defineProperty(_,g,E),E},w=this&&this.__param||function(h,_){return function(g,p){_(g,p,h)}};Object.defineProperty(o,"__esModule",{value:!0}),o.traceCall=o.setTraceLogger=o.LogService=void 0;const d=c(859),k=c(97),L={trace:k.LogLevelEnum.TRACE,debug:k.LogLevelEnum.DEBUG,info:k.LogLevelEnum.INFO,warn:k.LogLevelEnum.WARN,error:k.LogLevelEnum.ERROR,off:k.LogLevelEnum.OFF};let M,b=o.LogService=class extends d.Disposable{get logLevel(){return this._logLevel}constructor(h){super(),this._optionsService=h,this._logLevel=k.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),M=this}_updateLogLevel(){this._logLevel=L[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(h){for(let _=0;_<h.length;_++)typeof h[_]=="function"&&(h[_]=h[_]())}_log(h,_,g){this._evalLazyOptionalParams(g),h.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+_,...g)}trace(h,..._){var g;this._logLevel<=k.LogLevelEnum.TRACE&&this._log(((g=this._optionsService.options.logger)==null?void 0:g.trace.bind(this._optionsService.options.logger))??console.log,h,_)}debug(h,..._){var g;this._logLevel<=k.LogLevelEnum.DEBUG&&this._log(((g=this._optionsService.options.logger)==null?void 0:g.debug.bind(this._optionsService.options.logger))??console.log,h,_)}info(h,..._){var g;this._logLevel<=k.LogLevelEnum.INFO&&this._log(((g=this._optionsService.options.logger)==null?void 0:g.info.bind(this._optionsService.options.logger))??console.info,h,_)}warn(h,..._){var g;this._logLevel<=k.LogLevelEnum.WARN&&this._log(((g=this._optionsService.options.logger)==null?void 0:g.warn.bind(this._optionsService.options.logger))??console.warn,h,_)}error(h,..._){var g;this._logLevel<=k.LogLevelEnum.ERROR&&this._log(((g=this._optionsService.options.logger)==null?void 0:g.error.bind(this._optionsService.options.logger))??console.error,h,_)}};o.LogService=b=m([w(0,k.IOptionsService)],b),o.setTraceLogger=function(h){M=h},o.traceCall=function(h,_,g){if(typeof g.value!="function")throw new Error("not supported");const p=g.value;g.value=function(...T){if(M.logLevel!==k.LogLevelEnum.TRACE)return p.apply(this,T);M.trace(`GlyphRenderer#${p.name}(${T.map((E=>JSON.stringify(E))).join(", ")})`);const A=p.apply(this,T);return M.trace(`GlyphRenderer#${p.name} return`,A),A}}},726:(v,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.createDecorator=o.getServiceDependencies=o.serviceRegistry=void 0;const c="di$target",m="di$dependencies";o.serviceRegistry=new Map,o.getServiceDependencies=function(w){return w[m]||[]},o.createDecorator=function(w){if(o.serviceRegistry.has(w))return o.serviceRegistry.get(w);const d=function(k,L,M){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(b,h,_){h[c]===h?h[m].push({id:b,index:_}):(h[m]=[{id:b,index:_}],h[c]=h)})(d,k,M)};return d.toString=()=>w,o.serviceRegistry.set(w,d),d}},97:(v,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.IDecorationService=o.IUnicodeService=o.IOscLinkService=o.IOptionsService=o.ILogService=o.LogLevelEnum=o.IInstantiationService=o.ICharsetService=o.ICoreService=o.ICoreMouseService=o.IBufferService=void 0;const m=c(726);var w;o.IBufferService=(0,m.createDecorator)("BufferService"),o.ICoreMouseService=(0,m.createDecorator)("CoreMouseService"),o.ICoreService=(0,m.createDecorator)("CoreService"),o.ICharsetService=(0,m.createDecorator)("CharsetService"),o.IInstantiationService=(0,m.createDecorator)("InstantiationService"),(function(d){d[d.TRACE=0]="TRACE",d[d.DEBUG=1]="DEBUG",d[d.INFO=2]="INFO",d[d.WARN=3]="WARN",d[d.ERROR=4]="ERROR",d[d.OFF=5]="OFF"})(w||(o.LogLevelEnum=w={})),o.ILogService=(0,m.createDecorator)("LogService"),o.IOptionsService=(0,m.createDecorator)("OptionsService"),o.IOscLinkService=(0,m.createDecorator)("OscLinkService"),o.IUnicodeService=(0,m.createDecorator)("UnicodeService"),o.IDecorationService=(0,m.createDecorator)("DecorationService")}},l={};function a(v){var o=l[v];if(o!==void 0)return o.exports;var c=l[v]={exports:{}};return r[v].call(c.exports,c,c.exports,a),c.exports}var y={};return(()=>{var v=y;Object.defineProperty(v,"__esModule",{value:!0}),v.WebglAddon=void 0;const o=a(345),c=a(859),m=a(399),w=a(666),d=a(776);class k extends c.Disposable{constructor(M){if(m.isSafari&&(0,m.getSafariVersion)()<16){const b={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",b))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=M,this._onChangeTextureAtlas=this.register(new o.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new o.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new o.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this.register(new o.EventEmitter),this.onContextLoss=this._onContextLoss.event}activate(M){const b=M._core;if(!M.element)return void this.register(b.onWillOpen((()=>this.activate(M))));this._terminal=M;const h=b.coreService,_=b.optionsService,g=b,p=g._renderService,T=g._characterJoinerService,A=g._charSizeService,E=g._coreBrowserService,S=g._decorationService,x=g._logService,R=g._themeService;(0,d.setTraceLogger)(x),this._renderer=this.register(new w.WebglRenderer(M,T,A,E,h,S,_,R,this._preserveDrawingBuffer)),this.register((0,o.forwardEvent)(this._renderer.onContextLoss,this._onContextLoss)),this.register((0,o.forwardEvent)(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this.register((0,o.forwardEvent)(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this.register((0,o.forwardEvent)(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),p.setRenderer(this._renderer),this.register((0,c.toDisposable)((()=>{const I=this._terminal._core._renderService;I.setRenderer(this._terminal._core._createRenderer()),I.handleResize(M.cols,M.rows)})))}get textureAtlas(){var M;return(M=this._renderer)==null?void 0:M.textureAtlas}clearTextureAtlas(){var M;(M=this._renderer)==null||M.clearTextureAtlas()}}v.WebglAddon=k})(),y})()))})(Fu)),Fu.exports}var Y1=G1(),Hu={exports:{}},gm;function X1(){return gm||(gm=1,(function(t,e){(function(r,l){t.exports=l()})(globalThis,(()=>(()=>{var r={4567:function(v,o,c){var m=this&&this.__decorate||function(g,p,T,A){var E,S=arguments.length,x=S<3?p:A===null?A=Object.getOwnPropertyDescriptor(p,T):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(g,p,T,A);else for(var R=g.length-1;R>=0;R--)(E=g[R])&&(x=(S<3?E(x):S>3?E(p,T,x):E(p,T))||x);return S>3&&x&&Object.defineProperty(p,T,x),x},w=this&&this.__param||function(g,p){return function(T,A){p(T,A,g)}};Object.defineProperty(o,"__esModule",{value:!0}),o.AccessibilityManager=void 0;const d=c(9042),k=c(9924),L=c(844),M=c(4725),b=c(2585),h=c(3656);let _=o.AccessibilityManager=class extends L.Disposable{constructor(g,p,T,A){super(),this._terminal=g,this._coreBrowserService=T,this._renderService=A,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 E=0;E<this._terminal.rows;E++)this._rowElements[E]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[E]);if(this._topBoundaryFocusListener=E=>this._handleBoundaryFocus(E,0),this._bottomBoundaryFocusListener=E=>this._handleBoundaryFocus(E,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._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 k.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((E=>this._handleResize(E.rows)))),this.register(this._terminal.onRender((E=>this._refreshRows(E.start,E.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((E=>this._handleChar(E)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
|
|
123
|
+
`)))),this.register(this._terminal.onA11yTab((E=>this._handleTab(E)))),this.register(this._terminal.onKey((E=>this._handleKey(E.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,h.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,L.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(g){for(let p=0;p<g;p++)this._handleChar(" ")}_handleChar(g){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==g&&(this._charsToAnnounce+=g):this._charsToAnnounce+=g,g===`
|
|
124
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=d.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(g){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(g)||this._charsToConsume.push(g)}_refreshRows(g,p){this._liveRegionDebouncer.refresh(g,p,this._terminal.rows)}_renderRows(g,p){const T=this._terminal.buffer,A=T.lines.length.toString();for(let E=g;E<=p;E++){const S=T.lines.get(T.ydisp+E),x=[],R=(S==null?void 0:S.translateToString(!0,void 0,void 0,x))||"",I=(T.ydisp+E+1).toString(),D=this._rowElements[E];D&&(R.length===0?(D.innerText=" ",this._rowColumns.set(D,[0,1])):(D.textContent=R,this._rowColumns.set(D,x)),D.setAttribute("aria-posinset",I),D.setAttribute("aria-setsize",A))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(g,p){const T=g.target,A=this._rowElements[p===0?1:this._rowElements.length-2];if(T.getAttribute("aria-posinset")===(p===0?"1":`${this._terminal.buffer.lines.length}`)||g.relatedTarget!==A)return;let E,S;if(p===0?(E=T,S=this._rowElements.pop(),this._rowContainer.removeChild(S)):(E=this._rowElements.shift(),S=T,this._rowContainer.removeChild(E)),E.removeEventListener("focus",this._topBoundaryFocusListener),S.removeEventListener("focus",this._bottomBoundaryFocusListener),p===0){const x=this._createAccessibilityTreeNode();this._rowElements.unshift(x),this._rowContainer.insertAdjacentElement("afterbegin",x)}else{const x=this._createAccessibilityTreeNode();this._rowElements.push(x),this._rowContainer.appendChild(x)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(p===0?-1:1),this._rowElements[p===0?1:this._rowElements.length-2].focus(),g.preventDefault(),g.stopImmediatePropagation()}_handleSelectionChange(){var R;if(this._rowElements.length===0)return;const g=document.getSelection();if(!g)return;if(g.isCollapsed)return void(this._rowContainer.contains(g.anchorNode)&&this._terminal.clearSelection());if(!g.anchorNode||!g.focusNode)return void console.error("anchorNode and/or focusNode are null");let p={node:g.anchorNode,offset:g.anchorOffset},T={node:g.focusNode,offset:g.focusOffset};if((p.node.compareDocumentPosition(T.node)&Node.DOCUMENT_POSITION_PRECEDING||p.node===T.node&&p.offset>T.offset)&&([p,T]=[T,p]),p.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(p={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(p.node))return;const A=this._rowElements.slice(-1)[0];if(T.node.compareDocumentPosition(A)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(T={node:A,offset:((R=A.textContent)==null?void 0:R.length)??0}),!this._rowContainer.contains(T.node))return;const E=({node:I,offset:D})=>{const P=I instanceof Text?I.parentNode:I;let F=parseInt(P==null?void 0:P.getAttribute("aria-posinset"),10)-1;if(isNaN(F))return console.warn("row is invalid. Race condition?"),null;const z=this._rowColumns.get(P);if(!z)return console.warn("columns is null. Race condition?"),null;let q=D<z.length?z[D]:z.slice(-1)[0]+1;return q>=this._terminal.cols&&(++F,q=0),{row:F,column:q}},S=E(p),x=E(T);if(S&&x){if(S.row>x.row||S.row===x.row&&S.column>=x.column)throw new Error("invalid range");this._terminal.select(S.column,S.row,(x.row-S.row)*this._terminal.cols-S.column+x.column)}}_handleResize(g){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let p=this._rowContainer.children.length;p<this._terminal.rows;p++)this._rowElements[p]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[p]);for(;this._rowElements.length>g;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const g=this._coreBrowserService.mainDocument.createElement("div");return g.setAttribute("role","listitem"),g.tabIndex=-1,this._refreshRowDimensions(g),g}_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 g=0;g<this._terminal.rows;g++)this._refreshRowDimensions(this._rowElements[g])}}_refreshRowDimensions(g){g.style.height=`${this._renderService.dimensions.css.cell.height}px`}};o.AccessibilityManager=_=m([w(1,b.IInstantiationService),w(2,M.ICoreBrowserService),w(3,M.IRenderService)],_)},3614:(v,o)=>{function c(k){return k.replace(/\r?\n/g,"\r")}function m(k,L){return L?"\x1B[200~"+k+"\x1B[201~":k}function w(k,L,M,b){k=m(k=c(k),M.decPrivateModes.bracketedPasteMode&&b.rawOptions.ignoreBracketedPasteMode!==!0),M.triggerDataEvent(k,!0),L.value=""}function d(k,L,M){const b=M.getBoundingClientRect(),h=k.clientX-b.left-10,_=k.clientY-b.top-10;L.style.width="20px",L.style.height="20px",L.style.left=`${h}px`,L.style.top=`${_}px`,L.style.zIndex="1000",L.focus()}Object.defineProperty(o,"__esModule",{value:!0}),o.rightClickHandler=o.moveTextAreaUnderMouseCursor=o.paste=o.handlePasteEvent=o.copyHandler=o.bracketTextForPaste=o.prepareTextForTerminal=void 0,o.prepareTextForTerminal=c,o.bracketTextForPaste=m,o.copyHandler=function(k,L){k.clipboardData&&k.clipboardData.setData("text/plain",L.selectionText),k.preventDefault()},o.handlePasteEvent=function(k,L,M,b){k.stopPropagation(),k.clipboardData&&w(k.clipboardData.getData("text/plain"),L,M,b)},o.paste=w,o.moveTextAreaUnderMouseCursor=d,o.rightClickHandler=function(k,L,M,b,h){d(k,L,M),h&&b.rightClickSelect(k),L.value=b.selectionText,L.select()}},7239:(v,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ColorContrastCache=void 0;const m=c(1505);o.ColorContrastCache=class{constructor(){this._color=new m.TwoKeyMap,this._css=new m.TwoKeyMap}setCss(w,d,k){this._css.set(w,d,k)}getCss(w,d){return this._css.get(w,d)}setColor(w,d,k){this._color.set(w,d,k)}getColor(w,d){return this._color.get(w,d)}clear(){this._color.clear(),this._css.clear()}}},3656:(v,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.addDisposableDomListener=void 0,o.addDisposableDomListener=function(c,m,w,d){c.addEventListener(m,w,d);let k=!1;return{dispose:()=>{k||(k=!0,c.removeEventListener(m,w,d))}}}},3551:function(v,o,c){var m=this&&this.__decorate||function(_,g,p,T){var A,E=arguments.length,S=E<3?g:T===null?T=Object.getOwnPropertyDescriptor(g,p):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(_,g,p,T);else for(var x=_.length-1;x>=0;x--)(A=_[x])&&(S=(E<3?A(S):E>3?A(g,p,S):A(g,p))||S);return E>3&&S&&Object.defineProperty(g,p,S),S},w=this&&this.__param||function(_,g){return function(p,T){g(p,T,_)}};Object.defineProperty(o,"__esModule",{value:!0}),o.Linkifier=void 0;const d=c(3656),k=c(8460),L=c(844),M=c(2585),b=c(4725);let h=o.Linkifier=class extends L.Disposable{get currentLink(){return this._currentLink}constructor(_,g,p,T,A){super(),this._element=_,this._mouseService=g,this._renderService=p,this._bufferService=T,this._linkProviderService=A,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new k.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new k.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,L.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,L.toDisposable)((()=>{var E;this._lastMouseEvent=void 0,(E=this._activeProviderReplies)==null||E.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,d.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,d.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,d.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,d.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(_){this._lastMouseEvent=_;const g=this._positionFromMouseEvent(_,this._element,this._mouseService);if(!g)return;this._isMouseOut=!1;const p=_.composedPath();for(let T=0;T<p.length;T++){const A=p[T];if(A.classList.contains("xterm"))break;if(A.classList.contains("xterm-hover"))return}this._lastBufferCell&&g.x===this._lastBufferCell.x&&g.y===this._lastBufferCell.y||(this._handleHover(g),this._lastBufferCell=g)}_handleHover(_){if(this._activeLine!==_.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(_,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,_)||(this._clearCurrentLink(),this._askForLink(_,!0))}_askForLink(_,g){var T,A;this._activeProviderReplies&&g||((T=this._activeProviderReplies)==null||T.forEach((E=>{E==null||E.forEach((S=>{S.link.dispose&&S.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=_.y);let p=!1;for(const[E,S]of this._linkProviderService.linkProviders.entries())g?(A=this._activeProviderReplies)!=null&&A.get(E)&&(p=this._checkLinkProviderResult(E,_,p)):S.provideLinks(_.y,(x=>{var I,D;if(this._isMouseOut)return;const R=x==null?void 0:x.map((P=>({link:P})));(I=this._activeProviderReplies)==null||I.set(E,R),p=this._checkLinkProviderResult(E,_,p),((D=this._activeProviderReplies)==null?void 0:D.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(_.y,this._activeProviderReplies)}))}_removeIntersectingLinks(_,g){const p=new Set;for(let T=0;T<g.size;T++){const A=g.get(T);if(A)for(let E=0;E<A.length;E++){const S=A[E],x=S.link.range.start.y<_?0:S.link.range.start.x,R=S.link.range.end.y>_?this._bufferService.cols:S.link.range.end.x;for(let I=x;I<=R;I++){if(p.has(I)){A.splice(E--,1);break}p.add(I)}}}}_checkLinkProviderResult(_,g,p){var E;if(!this._activeProviderReplies)return p;const T=this._activeProviderReplies.get(_);let A=!1;for(let S=0;S<_;S++)this._activeProviderReplies.has(S)&&!this._activeProviderReplies.get(S)||(A=!0);if(!A&&T){const S=T.find((x=>this._linkAtPosition(x.link,g)));S&&(p=!0,this._handleNewLink(S))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!p)for(let S=0;S<this._activeProviderReplies.size;S++){const x=(E=this._activeProviderReplies.get(S))==null?void 0:E.find((R=>this._linkAtPosition(R.link,g)));if(x){p=!0,this._handleNewLink(x);break}}return p}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(_){if(!this._currentLink)return;const g=this._positionFromMouseEvent(_,this._element,this._mouseService);g&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,g)&&this._currentLink.link.activate(_,this._currentLink.link.text)}_clearCurrentLink(_,g){this._currentLink&&this._lastMouseEvent&&(!_||!g||this._currentLink.link.range.start.y>=_&&this._currentLink.link.range.end.y<=g)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,L.disposeArray)(this._linkCacheDisposables))}_handleNewLink(_){if(!this._lastMouseEvent)return;const g=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);g&&this._linkAtPosition(_.link,g)&&(this._currentLink=_,this._currentLink.state={decorations:{underline:_.link.decorations===void 0||_.link.decorations.underline,pointerCursor:_.link.decorations===void 0||_.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,_.link,this._lastMouseEvent),_.link.decorations={},Object.defineProperties(_.link.decorations,{pointerCursor:{get:()=>{var p,T;return(T=(p=this._currentLink)==null?void 0:p.state)==null?void 0:T.decorations.pointerCursor},set:p=>{var T;(T=this._currentLink)!=null&&T.state&&this._currentLink.state.decorations.pointerCursor!==p&&(this._currentLink.state.decorations.pointerCursor=p,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",p))}},underline:{get:()=>{var p,T;return(T=(p=this._currentLink)==null?void 0:p.state)==null?void 0:T.decorations.underline},set:p=>{var T,A,E;(T=this._currentLink)!=null&&T.state&&((E=(A=this._currentLink)==null?void 0:A.state)==null?void 0:E.decorations.underline)!==p&&(this._currentLink.state.decorations.underline=p,this._currentLink.state.isHovered&&this._fireUnderlineEvent(_.link,p))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((p=>{if(!this._currentLink)return;const T=p.start===0?0:p.start+1+this._bufferService.buffer.ydisp,A=this._bufferService.buffer.ydisp+1+p.end;if(this._currentLink.link.range.start.y>=T&&this._currentLink.link.range.end.y<=A&&(this._clearCurrentLink(T,A),this._lastMouseEvent)){const E=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);E&&this._askForLink(E,!1)}}))))}_linkHover(_,g,p){var T;(T=this._currentLink)!=null&&T.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(g,!0),this._currentLink.state.decorations.pointerCursor&&_.classList.add("xterm-cursor-pointer")),g.hover&&g.hover(p,g.text)}_fireUnderlineEvent(_,g){const p=_.range,T=this._bufferService.buffer.ydisp,A=this._createLinkUnderlineEvent(p.start.x-1,p.start.y-T-1,p.end.x,p.end.y-T-1,void 0);(g?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(A)}_linkLeave(_,g,p){var T;(T=this._currentLink)!=null&&T.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(g,!1),this._currentLink.state.decorations.pointerCursor&&_.classList.remove("xterm-cursor-pointer")),g.leave&&g.leave(p,g.text)}_linkAtPosition(_,g){const p=_.range.start.y*this._bufferService.cols+_.range.start.x,T=_.range.end.y*this._bufferService.cols+_.range.end.x,A=g.y*this._bufferService.cols+g.x;return p<=A&&A<=T}_positionFromMouseEvent(_,g,p){const T=p.getCoords(_,g,this._bufferService.cols,this._bufferService.rows);if(T)return{x:T[0],y:T[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(_,g,p,T,A){return{x1:_,y1:g,x2:p,y2:T,cols:this._bufferService.cols,fg:A}}};o.Linkifier=h=m([w(1,b.IMouseService),w(2,b.IRenderService),w(3,M.IBufferService),w(4,b.ILinkProviderService)],h)},9042:(v,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.tooMuchOutput=o.promptLabel=void 0,o.promptLabel="Terminal input",o.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(v,o,c){var m=this&&this.__decorate||function(b,h,_,g){var p,T=arguments.length,A=T<3?h:g===null?g=Object.getOwnPropertyDescriptor(h,_):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(b,h,_,g);else for(var E=b.length-1;E>=0;E--)(p=b[E])&&(A=(T<3?p(A):T>3?p(h,_,A):p(h,_))||A);return T>3&&A&&Object.defineProperty(h,_,A),A},w=this&&this.__param||function(b,h){return function(_,g){h(_,g,b)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OscLinkProvider=void 0;const d=c(511),k=c(2585);let L=o.OscLinkProvider=class{constructor(b,h,_){this._bufferService=b,this._optionsService=h,this._oscLinkService=_}provideLinks(b,h){var R;const _=this._bufferService.buffer.lines.get(b-1);if(!_)return void h(void 0);const g=[],p=this._optionsService.rawOptions.linkHandler,T=new d.CellData,A=_.getTrimmedLength();let E=-1,S=-1,x=!1;for(let I=0;I<A;I++)if(S!==-1||_.hasContent(I)){if(_.loadCell(I,T),T.hasExtendedAttrs()&&T.extended.urlId){if(S===-1){S=I,E=T.extended.urlId;continue}x=T.extended.urlId!==E}else S!==-1&&(x=!0);if(x||S!==-1&&I===A-1){const D=(R=this._oscLinkService.getLinkData(E))==null?void 0:R.uri;if(D){const P={start:{x:S+1,y:b},end:{x:I+(x||I!==A-1?0:1),y:b}};let F=!1;if(!(p!=null&&p.allowNonHttpProtocols))try{const z=new URL(D);["http:","https:"].includes(z.protocol)||(F=!0)}catch{F=!0}F||g.push({text:D,range:P,activate:(z,q)=>p?p.activate(z,q,P):M(0,q),hover:(z,q)=>{var K;return(K=p==null?void 0:p.hover)==null?void 0:K.call(p,z,q,P)},leave:(z,q)=>{var K;return(K=p==null?void 0:p.leave)==null?void 0:K.call(p,z,q,P)}})}x=!1,T.hasExtendedAttrs()&&T.extended.urlId?(S=I,E=T.extended.urlId):(S=-1,E=-1)}}h(g)}};function M(b,h){if(confirm(`Do you want to navigate to ${h}?
|
|
125
|
+
|
|
126
|
+
WARNING: This link could potentially be dangerous`)){const _=window.open();if(_){try{_.opener=null}catch{}_.location.href=h}else console.warn("Opening link blocked as opener could not be cleared")}}o.OscLinkProvider=L=m([w(0,k.IBufferService),w(1,k.IOptionsService),w(2,k.IOscLinkService)],L)},6193:(v,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.RenderDebouncer=void 0,o.RenderDebouncer=class{constructor(c,m){this._renderCallback=c,this._coreBrowserService=m,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(c){return this._refreshCallbacks.push(c),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(c,m,w){this._rowCount=w,c=c!==void 0?c:0,m=m!==void 0?m:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,c):c,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,m):m,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();const c=Math.max(this._rowStart,0),m=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(c,m),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const c of this._refreshCallbacks)c(0);this._refreshCallbacks=[]}}},3236:(v,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Terminal=void 0;const m=c(3614),w=c(3656),d=c(3551),k=c(9042),L=c(3730),M=c(1680),b=c(3107),h=c(5744),_=c(2950),g=c(1296),p=c(428),T=c(4269),A=c(5114),E=c(8934),S=c(3230),x=c(9312),R=c(4725),I=c(6731),D=c(8055),P=c(8969),F=c(8460),z=c(844),q=c(6114),K=c(8437),V=c(2584),W=c(7399),O=c(5941),U=c(9074),H=c(2585),$=c(5435),Z=c(4567),re=c(779);class we extends P.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(Q={}){super(Q),this.browser=q,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new z.MutableDisposable),this._onCursorMove=this.register(new F.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new F.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new F.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new F.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new F.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new F.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new F.EventEmitter),this._onBlur=this.register(new F.EventEmitter),this._onA11yCharEmitter=this.register(new F.EventEmitter),this._onA11yTabEmitter=this.register(new F.EventEmitter),this._onWillOpen=this.register(new F.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(U.DecorationService),this._instantiationService.setService(H.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(re.LinkProviderService),this._instantiationService.setService(R.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(L.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((Y,te)=>this.refresh(Y,te)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((Y=>this._reportWindowsOptions(Y)))),this.register(this._inputHandler.onColor((Y=>this._handleColorEvent(Y)))),this.register((0,F.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,F.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,F.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,F.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((Y=>this._afterResize(Y.cols,Y.rows)))),this.register((0,z.toDisposable)((()=>{var Y,te;this._customKeyEventHandler=void 0,(te=(Y=this.element)==null?void 0:Y.parentNode)==null||te.removeChild(this.element)})))}_handleColorEvent(Q){if(this._themeService)for(const Y of Q){let te,ee="";switch(Y.index){case 256:te="foreground",ee="10";break;case 257:te="background",ee="11";break;case 258:te="cursor",ee="12";break;default:te="ansi",ee="4;"+Y.index}switch(Y.type){case 0:const ye=D.color.toColorRGB(te==="ansi"?this._themeService.colors.ansi[Y.index]:this._themeService.colors[te]);this.coreService.triggerDataEvent(`${V.C0.ESC}]${ee};${(0,O.toRgbString)(ye)}${V.C1_ESCAPED.ST}`);break;case 1:if(te==="ansi")this._themeService.modifyColors((ge=>ge.ansi[Y.index]=D.channels.toColor(...Y.color)));else{const ge=te;this._themeService.modifyColors((Be=>Be[ge]=D.channels.toColor(...Y.color)))}break;case 2:this._themeService.restoreColor(Y.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(Q){Q?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Z.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(Q){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(V.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var Q;return(Q=this.textarea)==null?void 0:Q.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(V.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 Q=this.buffer.ybase+this.buffer.y,Y=this.buffer.lines.get(Q);if(!Y)return;const te=Math.min(this.buffer.x,this.cols-1),ee=this._renderService.dimensions.css.cell.height,ye=Y.getWidth(te),ge=this._renderService.dimensions.css.cell.width*ye,Be=this.buffer.y*this._renderService.dimensions.css.cell.height,Ue=te*this._renderService.dimensions.css.cell.width;this.textarea.style.left=Ue+"px",this.textarea.style.top=Be+"px",this.textarea.style.width=ge+"px",this.textarea.style.height=ee+"px",this.textarea.style.lineHeight=ee+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,w.addDisposableDomListener)(this.element,"copy",(Y=>{this.hasSelection()&&(0,m.copyHandler)(Y,this._selectionService)})));const Q=Y=>(0,m.handlePasteEvent)(Y,this.textarea,this.coreService,this.optionsService);this.register((0,w.addDisposableDomListener)(this.textarea,"paste",Q)),this.register((0,w.addDisposableDomListener)(this.element,"paste",Q)),q.isFirefox?this.register((0,w.addDisposableDomListener)(this.element,"mousedown",(Y=>{Y.button===2&&(0,m.rightClickHandler)(Y,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,w.addDisposableDomListener)(this.element,"contextmenu",(Y=>{(0,m.rightClickHandler)(Y,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),q.isLinux&&this.register((0,w.addDisposableDomListener)(this.element,"auxclick",(Y=>{Y.button===1&&(0,m.moveTextAreaUnderMouseCursor)(Y,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,w.addDisposableDomListener)(this.textarea,"keyup",(Q=>this._keyUp(Q)),!0)),this.register((0,w.addDisposableDomListener)(this.textarea,"keydown",(Q=>this._keyDown(Q)),!0)),this.register((0,w.addDisposableDomListener)(this.textarea,"keypress",(Q=>this._keyPress(Q)),!0)),this.register((0,w.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,w.addDisposableDomListener)(this.textarea,"compositionupdate",(Q=>this._compositionHelper.compositionupdate(Q)))),this.register((0,w.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,w.addDisposableDomListener)(this.textarea,"input",(Q=>this._inputEvent(Q)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(Q){var te;if(!Q)throw new Error("Terminal requires a parent element.");if(Q.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((te=this.element)==null?void 0:te.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=Q.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"),Q.appendChild(this.element);const Y=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),Y.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,w.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),Y.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",k.promptLabel),q.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(A.CoreBrowserService,this.textarea,Q.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(R.ICoreBrowserService,this._coreBrowserService),this.register((0,w.addDisposableDomListener)(this.textarea,"focus",(ee=>this._handleTextAreaFocus(ee)))),this.register((0,w.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(p.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(R.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(I.ThemeService),this._instantiationService.setService(R.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(T.CharacterJoinerService),this._instantiationService.setService(R.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(S.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(R.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(_.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(E.MouseService),this._instantiationService.setService(R.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(d.Linkifier,this.screenElement)),this.element.appendChild(Y);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(M.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(x.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(R.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,w.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(b.BufferDecorationRenderer,this.screenElement)),this.register((0,w.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(Z.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(ee=>this._handleScreenReaderModeOptionChange(ee)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(h.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(ee=>{!this._overviewRulerRenderer&&ee&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(h.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(g.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const Q=this,Y=this.element;function te(ge){const Be=Q._mouseService.getMouseReportCoords(ge,Q.screenElement);if(!Be)return!1;let Ue,ze;switch(ge.overrideType||ge.type){case"mousemove":ze=32,ge.buttons===void 0?(Ue=3,ge.button!==void 0&&(Ue=ge.button<3?ge.button:3)):Ue=1&ge.buttons?0:4&ge.buttons?1:2&ge.buttons?2:3;break;case"mouseup":ze=0,Ue=ge.button<3?ge.button:3;break;case"mousedown":ze=1,Ue=ge.button<3?ge.button:3;break;case"wheel":if(Q._customWheelEventHandler&&Q._customWheelEventHandler(ge)===!1||Q.viewport.getLinesScrolled(ge)===0)return!1;ze=ge.deltaY<0?0:1,Ue=4;break;default:return!1}return!(ze===void 0||Ue===void 0||Ue>4)&&Q.coreMouseService.triggerMouseEvent({col:Be.col,row:Be.row,x:Be.x,y:Be.y,button:Ue,action:ze,ctrl:ge.ctrlKey,alt:ge.altKey,shift:ge.shiftKey})}const ee={mouseup:null,wheel:null,mousedrag:null,mousemove:null},ye={mouseup:ge=>(te(ge),ge.buttons||(this._document.removeEventListener("mouseup",ee.mouseup),ee.mousedrag&&this._document.removeEventListener("mousemove",ee.mousedrag)),this.cancel(ge)),wheel:ge=>(te(ge),this.cancel(ge,!0)),mousedrag:ge=>{ge.buttons&&te(ge)},mousemove:ge=>{ge.buttons||te(ge)}};this.register(this.coreMouseService.onProtocolChange((ge=>{ge?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(ge)),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&ge?ee.mousemove||(Y.addEventListener("mousemove",ye.mousemove),ee.mousemove=ye.mousemove):(Y.removeEventListener("mousemove",ee.mousemove),ee.mousemove=null),16&ge?ee.wheel||(Y.addEventListener("wheel",ye.wheel,{passive:!1}),ee.wheel=ye.wheel):(Y.removeEventListener("wheel",ee.wheel),ee.wheel=null),2&ge?ee.mouseup||(ee.mouseup=ye.mouseup):(this._document.removeEventListener("mouseup",ee.mouseup),ee.mouseup=null),4&ge?ee.mousedrag||(ee.mousedrag=ye.mousedrag):(this._document.removeEventListener("mousemove",ee.mousedrag),ee.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,w.addDisposableDomListener)(Y,"mousedown",(ge=>{if(ge.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(ge))return te(ge),ee.mouseup&&this._document.addEventListener("mouseup",ee.mouseup),ee.mousedrag&&this._document.addEventListener("mousemove",ee.mousedrag),this.cancel(ge)}))),this.register((0,w.addDisposableDomListener)(Y,"wheel",(ge=>{if(!ee.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(ge)===!1)return!1;if(!this.buffer.hasScrollback){const Be=this.viewport.getLinesScrolled(ge);if(Be===0)return;const Ue=V.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(ge.deltaY<0?"A":"B");let ze="";for(let gt=0;gt<Math.abs(Be);gt++)ze+=Ue;return this.coreService.triggerDataEvent(ze,!0),this.cancel(ge,!0)}return this.viewport.handleWheel(ge)?this.cancel(ge):void 0}}),{passive:!1})),this.register((0,w.addDisposableDomListener)(Y,"touchstart",(ge=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(ge),this.cancel(ge)}),{passive:!0})),this.register((0,w.addDisposableDomListener)(Y,"touchmove",(ge=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(ge)?void 0:this.cancel(ge)}),{passive:!1}))}refresh(Q,Y){var te;(te=this._renderService)==null||te.refreshRows(Q,Y)}updateCursorStyle(Q){var Y;(Y=this._selectionService)!=null&&Y.shouldColumnSelect(Q)?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(Q,Y,te=0){var ee;te===1?(super.scrollLines(Q,Y,te),this.refresh(0,this.rows-1)):(ee=this.viewport)==null||ee.scrollLines(Q)}paste(Q){(0,m.paste)(Q,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(Q){this._customKeyEventHandler=Q}attachCustomWheelEventHandler(Q){this._customWheelEventHandler=Q}registerLinkProvider(Q){return this._linkProviderService.registerLinkProvider(Q)}registerCharacterJoiner(Q){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const Y=this._characterJoinerService.register(Q);return this.refresh(0,this.rows-1),Y}deregisterCharacterJoiner(Q){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(Q)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(Q){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+Q)}registerDecoration(Q){return this._decorationService.registerDecoration(Q)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(Q,Y,te){this._selectionService.setSelection(Q,Y,te)}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 Q;(Q=this._selectionService)==null||Q.clearSelection()}selectAll(){var Q;(Q=this._selectionService)==null||Q.selectAll()}selectLines(Q,Y){var te;(te=this._selectionService)==null||te.selectLines(Q,Y)}_keyDown(Q){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(Q)===!1)return!1;const Y=this.browser.isMac&&this.options.macOptionIsMeta&&Q.altKey;if(!Y&&!this._compositionHelper.keydown(Q))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;Y||Q.key!=="Dead"&&Q.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const te=(0,W.evaluateKeyboardEvent)(Q,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(Q),te.type===3||te.type===2){const ee=this.rows-1;return this.scrollLines(te.type===2?-ee:ee),this.cancel(Q,!0)}return te.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,Q)||(te.cancel&&this.cancel(Q,!0),!te.key||!!(Q.key&&!Q.ctrlKey&&!Q.altKey&&!Q.metaKey&&Q.key.length===1&&Q.key.charCodeAt(0)>=65&&Q.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(te.key!==V.C0.ETX&&te.key!==V.C0.CR||(this.textarea.value=""),this._onKey.fire({key:te.key,domEvent:Q}),this._showCursor(),this.coreService.triggerDataEvent(te.key,!0),!this.optionsService.rawOptions.screenReaderMode||Q.altKey||Q.ctrlKey?this.cancel(Q,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(Q,Y){const te=Q.isMac&&!this.options.macOptionIsMeta&&Y.altKey&&!Y.ctrlKey&&!Y.metaKey||Q.isWindows&&Y.altKey&&Y.ctrlKey&&!Y.metaKey||Q.isWindows&&Y.getModifierState("AltGraph");return Y.type==="keypress"?te:te&&(!Y.keyCode||Y.keyCode>47)}_keyUp(Q){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(Q)===!1||((function(Y){return Y.keyCode===16||Y.keyCode===17||Y.keyCode===18})(Q)||this.focus(),this.updateCursorStyle(Q),this._keyPressHandled=!1)}_keyPress(Q){let Y;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(Q)===!1)return!1;if(this.cancel(Q),Q.charCode)Y=Q.charCode;else if(Q.which===null||Q.which===void 0)Y=Q.keyCode;else{if(Q.which===0||Q.charCode===0)return!1;Y=Q.which}return!(!Y||(Q.altKey||Q.ctrlKey||Q.metaKey)&&!this._isThirdLevelShift(this.browser,Q)||(Y=String.fromCharCode(Y),this._onKey.fire({key:Y,domEvent:Q}),this._showCursor(),this.coreService.triggerDataEvent(Y,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(Q){if(Q.data&&Q.inputType==="insertText"&&(!Q.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const Y=Q.data;return this.coreService.triggerDataEvent(Y,!0),this.cancel(Q),!0}return!1}resize(Q,Y){Q!==this.cols||Y!==this.rows?super.resize(Q,Y):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(Q,Y){var te,ee;(te=this._charSizeService)==null||te.measure(),(ee=this.viewport)==null||ee.syncScrollArea(!0)}clear(){var Q;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 Y=1;Y<this.rows;Y++)this.buffer.lines.push(this.buffer.getBlankLine(K.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(Q=this.viewport)==null||Q.reset(),this.refresh(0,this.rows-1)}}reset(){var Y,te;this.options.rows=this.rows,this.options.cols=this.cols;const Q=this._customKeyEventHandler;this._setup(),super.reset(),(Y=this._selectionService)==null||Y.reset(),this._decorationService.reset(),(te=this.viewport)==null||te.reset(),this._customKeyEventHandler=Q,this.refresh(0,this.rows-1)}clearTextureAtlas(){var Q;(Q=this._renderService)==null||Q.clearTextureAtlas()}_reportFocus(){var Q;(Q=this.element)!=null&&Q.classList.contains("focus")?this.coreService.triggerDataEvent(V.C0.ESC+"[I"):this.coreService.triggerDataEvent(V.C0.ESC+"[O")}_reportWindowsOptions(Q){if(this._renderService)switch(Q){case $.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const Y=this._renderService.dimensions.css.canvas.width.toFixed(0),te=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${V.C0.ESC}[4;${te};${Y}t`);break;case $.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const ee=this._renderService.dimensions.css.cell.width.toFixed(0),ye=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${V.C0.ESC}[6;${ye};${ee}t`)}}cancel(Q,Y){if(this.options.cancelEvents||Y)return Q.preventDefault(),Q.stopPropagation(),!1}}o.Terminal=we},9924:(v,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.TimeBasedDebouncer=void 0,o.TimeBasedDebouncer=class{constructor(c,m=1e3){this._renderCallback=c,this._debounceThresholdMS=m,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(c,m,w){this._rowCount=w,c=c!==void 0?c:0,m=m!==void 0?m:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,c):c,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,m):m;const d=Date.now();if(d-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=d,this._innerRefresh();else if(!this._additionalRefreshRequested){const k=d-this._lastRefreshMs,L=this._debounceThresholdMS-k;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),L)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const c=Math.max(this._rowStart,0),m=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(c,m)}}},1680:function(v,o,c){var m=this&&this.__decorate||function(_,g,p,T){var A,E=arguments.length,S=E<3?g:T===null?T=Object.getOwnPropertyDescriptor(g,p):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(_,g,p,T);else for(var x=_.length-1;x>=0;x--)(A=_[x])&&(S=(E<3?A(S):E>3?A(g,p,S):A(g,p))||S);return E>3&&S&&Object.defineProperty(g,p,S),S},w=this&&this.__param||function(_,g){return function(p,T){g(p,T,_)}};Object.defineProperty(o,"__esModule",{value:!0}),o.Viewport=void 0;const d=c(3656),k=c(4725),L=c(8460),M=c(844),b=c(2585);let h=o.Viewport=class extends M.Disposable{constructor(_,g,p,T,A,E,S,x){super(),this._viewportElement=_,this._scrollArea=g,this._bufferService=p,this._optionsService=T,this._charSizeService=A,this._renderService=E,this._coreBrowserService=S,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 L.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,d.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((R=>this._activeBuffer=R.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((R=>this._renderDimensions=R))),this._handleThemeChange(x.colors),this.register(x.onChangeColors((R=>this._handleThemeChange(R)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(_){this._viewportElement.style.backgroundColor=_.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(_){if(_)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 g=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==g&&(this._lastRecordedBufferHeight=g,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const _=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==_&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=_),this._refreshAnimationFrame=null}syncScrollArea(_=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(_);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(_)}_handleScroll(_){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 g=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:g,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const _=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(_*(this._smoothScrollState.target-this._smoothScrollState.origin)),_<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(_,g){const p=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(g<0&&this._viewportElement.scrollTop!==0||g>0&&p<this._lastRecordedBufferHeight)||(_.cancelable&&_.preventDefault(),!1)}handleWheel(_){const g=this._getPixelsScrolled(_);return g!==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+g:this._smoothScrollState.target+=g,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=g,this._bubbleScroll(_,g))}scrollLines(_){if(_!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const g=_*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+g,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:_,suppressScrollEvent:!1})}_getPixelsScrolled(_){if(_.deltaY===0||_.shiftKey)return 0;let g=this._applyScrollModifier(_.deltaY,_);return _.deltaMode===WheelEvent.DOM_DELTA_LINE?g*=this._currentRowHeight:_.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(g*=this._currentRowHeight*this._bufferService.rows),g}getBufferElements(_,g){var x;let p,T="";const A=[],E=g??this._bufferService.buffer.lines.length,S=this._bufferService.buffer.lines;for(let R=_;R<E;R++){const I=S.get(R);if(!I)continue;const D=(x=S.get(R+1))==null?void 0:x.isWrapped;if(T+=I.translateToString(!D),!D||R===S.length-1){const P=document.createElement("div");P.textContent=T,A.push(P),T.length>0&&(p=P),T=""}}return{bufferElements:A,cursorElement:p}}getLinesScrolled(_){if(_.deltaY===0||_.shiftKey)return 0;let g=this._applyScrollModifier(_.deltaY,_);return _.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(g/=this._currentRowHeight+0,this._wheelPartialScroll+=g,g=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):_.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(g*=this._bufferService.rows),g}_applyScrollModifier(_,g){const p=this._optionsService.rawOptions.fastScrollModifier;return p==="alt"&&g.altKey||p==="ctrl"&&g.ctrlKey||p==="shift"&&g.shiftKey?_*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:_*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(_){this._lastTouchY=_.touches[0].pageY}handleTouchMove(_){const g=this._lastTouchY-_.touches[0].pageY;return this._lastTouchY=_.touches[0].pageY,g!==0&&(this._viewportElement.scrollTop+=g,this._bubbleScroll(_,g))}};o.Viewport=h=m([w(2,b.IBufferService),w(3,b.IOptionsService),w(4,k.ICharSizeService),w(5,k.IRenderService),w(6,k.ICoreBrowserService),w(7,k.IThemeService)],h)},3107:function(v,o,c){var m=this&&this.__decorate||function(b,h,_,g){var p,T=arguments.length,A=T<3?h:g===null?g=Object.getOwnPropertyDescriptor(h,_):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(b,h,_,g);else for(var E=b.length-1;E>=0;E--)(p=b[E])&&(A=(T<3?p(A):T>3?p(h,_,A):p(h,_))||A);return T>3&&A&&Object.defineProperty(h,_,A),A},w=this&&this.__param||function(b,h){return function(_,g){h(_,g,b)}};Object.defineProperty(o,"__esModule",{value:!0}),o.BufferDecorationRenderer=void 0;const d=c(4725),k=c(844),L=c(2585);let M=o.BufferDecorationRenderer=class extends k.Disposable{constructor(b,h,_,g,p){super(),this._screenElement=b,this._bufferService=h,this._coreBrowserService=_,this._decorationService=g,this._renderService=p,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((T=>this._removeDecoration(T)))),this.register((0,k.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 b of this._decorationService.decorations)this._renderDecoration(b);this._dimensionsChanged=!1}_renderDecoration(b){this._refreshStyle(b),this._dimensionsChanged&&this._refreshXPosition(b)}_createElement(b){var g;const h=this._coreBrowserService.mainDocument.createElement("div");h.classList.add("xterm-decoration"),h.classList.toggle("xterm-decoration-top-layer",((g=b==null?void 0:b.options)==null?void 0:g.layer)==="top"),h.style.width=`${Math.round((b.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,h.style.height=(b.options.height||1)*this._renderService.dimensions.css.cell.height+"px",h.style.top=(b.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",h.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const _=b.options.x??0;return _&&_>this._bufferService.cols&&(h.style.display="none"),this._refreshXPosition(b,h),h}_refreshStyle(b){const h=b.marker.line-this._bufferService.buffers.active.ydisp;if(h<0||h>=this._bufferService.rows)b.element&&(b.element.style.display="none",b.onRenderEmitter.fire(b.element));else{let _=this._decorationElements.get(b);_||(_=this._createElement(b),b.element=_,this._decorationElements.set(b,_),this._container.appendChild(_),b.onDispose((()=>{this._decorationElements.delete(b),_.remove()}))),_.style.top=h*this._renderService.dimensions.css.cell.height+"px",_.style.display=this._altBufferIsActive?"none":"block",b.onRenderEmitter.fire(_)}}_refreshXPosition(b,h=b.element){if(!h)return;const _=b.options.x??0;(b.options.anchor||"left")==="right"?h.style.right=_?_*this._renderService.dimensions.css.cell.width+"px":"":h.style.left=_?_*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(b){var h;(h=this._decorationElements.get(b))==null||h.remove(),this._decorationElements.delete(b),b.dispose()}};o.BufferDecorationRenderer=M=m([w(1,L.IBufferService),w(2,d.ICoreBrowserService),w(3,L.IDecorationService),w(4,d.IRenderService)],M)},5871:(v,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ColorZoneStore=void 0,o.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(c){if(c.options.overviewRulerOptions){for(const m of this._zones)if(m.color===c.options.overviewRulerOptions.color&&m.position===c.options.overviewRulerOptions.position){if(this._lineIntersectsZone(m,c.marker.line))return;if(this._lineAdjacentToZone(m,c.marker.line,c.options.overviewRulerOptions.position))return void this._addLineToZone(m,c.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=c.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=c.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=c.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=c.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:c.options.overviewRulerOptions.color,position:c.options.overviewRulerOptions.position,startBufferLine:c.marker.line,endBufferLine:c.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(c){this._linePadding=c}_lineIntersectsZone(c,m){return m>=c.startBufferLine&&m<=c.endBufferLine}_lineAdjacentToZone(c,m,w){return m>=c.startBufferLine-this._linePadding[w||"full"]&&m<=c.endBufferLine+this._linePadding[w||"full"]}_addLineToZone(c,m){c.startBufferLine=Math.min(c.startBufferLine,m),c.endBufferLine=Math.max(c.endBufferLine,m)}}},5744:function(v,o,c){var m=this&&this.__decorate||function(p,T,A,E){var S,x=arguments.length,R=x<3?T:E===null?E=Object.getOwnPropertyDescriptor(T,A):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(p,T,A,E);else for(var I=p.length-1;I>=0;I--)(S=p[I])&&(R=(x<3?S(R):x>3?S(T,A,R):S(T,A))||R);return x>3&&R&&Object.defineProperty(T,A,R),R},w=this&&this.__param||function(p,T){return function(A,E){T(A,E,p)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OverviewRulerRenderer=void 0;const d=c(5871),k=c(4725),L=c(844),M=c(2585),b={full:0,left:0,center:0,right:0},h={full:0,left:0,center:0,right:0},_={full:0,left:0,center:0,right:0};let g=o.OverviewRulerRenderer=class extends L.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(p,T,A,E,S,x,R){var D;super(),this._viewportElement=p,this._screenElement=T,this._bufferService=A,this._decorationService=E,this._renderService=S,this._optionsService=x,this._coreBrowserService=R,this._colorZoneStore=new d.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(),(D=this._viewportElement.parentElement)==null||D.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,L.toDisposable)((()=>{var P;(P=this._canvas)==null||P.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 p=Math.floor(this._canvas.width/3),T=Math.ceil(this._canvas.width/3);h.full=this._canvas.width,h.left=p,h.center=T,h.right=p,this._refreshDrawHeightConstants(),_.full=0,_.left=0,_.center=h.left,_.right=h.left+h.center}_refreshDrawHeightConstants(){b.full=Math.round(2*this._coreBrowserService.dpr);const p=this._canvas.height/this._bufferService.buffer.lines.length,T=Math.round(Math.max(Math.min(p,12),6)*this._coreBrowserService.dpr);b.left=T,b.center=T,b.right=T}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*b.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*b.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*b.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*b.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 T of this._decorationService.decorations)this._colorZoneStore.addDecoration(T);this._ctx.lineWidth=1;const p=this._colorZoneStore.zones;for(const T of p)T.position!=="full"&&this._renderColorZone(T);for(const T of p)T.position==="full"&&this._renderColorZone(T);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(p){this._ctx.fillStyle=p.color,this._ctx.fillRect(_[p.position||"full"],Math.round((this._canvas.height-1)*(p.startBufferLine/this._bufferService.buffers.active.lines.length)-b[p.position||"full"]/2),h[p.position||"full"],Math.round((this._canvas.height-1)*((p.endBufferLine-p.startBufferLine)/this._bufferService.buffers.active.lines.length)+b[p.position||"full"]))}_queueRefresh(p,T){this._shouldUpdateDimensions=p||this._shouldUpdateDimensions,this._shouldUpdateAnchor=T||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};o.OverviewRulerRenderer=g=m([w(2,M.IBufferService),w(3,M.IDecorationService),w(4,k.IRenderService),w(5,M.IOptionsService),w(6,k.ICoreBrowserService)],g)},2950:function(v,o,c){var m=this&&this.__decorate||function(b,h,_,g){var p,T=arguments.length,A=T<3?h:g===null?g=Object.getOwnPropertyDescriptor(h,_):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(b,h,_,g);else for(var E=b.length-1;E>=0;E--)(p=b[E])&&(A=(T<3?p(A):T>3?p(h,_,A):p(h,_))||A);return T>3&&A&&Object.defineProperty(h,_,A),A},w=this&&this.__param||function(b,h){return function(_,g){h(_,g,b)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CompositionHelper=void 0;const d=c(4725),k=c(2585),L=c(2584);let M=o.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(b,h,_,g,p,T){this._textarea=b,this._compositionView=h,this._bufferService=_,this._optionsService=g,this._coreService=p,this._renderService=T,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(b){this._compositionView.textContent=b.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(b){if(this._isComposing||this._isSendingComposition){if(b.keyCode===229||b.keyCode===16||b.keyCode===17||b.keyCode===18)return!1;this._finalizeComposition(!1)}return b.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(b){if(this._compositionView.classList.remove("active"),this._isComposing=!1,b){const h={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let _;this._isSendingComposition=!1,h.start+=this._dataAlreadySent.length,_=this._isComposing?this._textarea.value.substring(h.start,h.end):this._textarea.value.substring(h.start),_.length>0&&this._coreService.triggerDataEvent(_,!0)}}),0)}else{this._isSendingComposition=!1;const h=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(h,!0)}}_handleAnyTextareaChanges(){const b=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const h=this._textarea.value,_=h.replace(b,"");this._dataAlreadySent=_,h.length>b.length?this._coreService.triggerDataEvent(_,!0):h.length<b.length?this._coreService.triggerDataEvent(`${L.C0.DEL}`,!0):h.length===b.length&&h!==b&&this._coreService.triggerDataEvent(h,!0)}}),0)}updateCompositionElements(b){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const h=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),_=this._renderService.dimensions.css.cell.height,g=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,p=h*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=p+"px",this._compositionView.style.top=g+"px",this._compositionView.style.height=_+"px",this._compositionView.style.lineHeight=_+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const T=this._compositionView.getBoundingClientRect();this._textarea.style.left=p+"px",this._textarea.style.top=g+"px",this._textarea.style.width=Math.max(T.width,1)+"px",this._textarea.style.height=Math.max(T.height,1)+"px",this._textarea.style.lineHeight=T.height+"px"}b||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};o.CompositionHelper=M=m([w(2,k.IBufferService),w(3,k.IOptionsService),w(4,k.ICoreService),w(5,d.IRenderService)],M)},9806:(v,o)=>{function c(m,w,d){const k=d.getBoundingClientRect(),L=m.getComputedStyle(d),M=parseInt(L.getPropertyValue("padding-left")),b=parseInt(L.getPropertyValue("padding-top"));return[w.clientX-k.left-M,w.clientY-k.top-b]}Object.defineProperty(o,"__esModule",{value:!0}),o.getCoords=o.getCoordsRelativeToElement=void 0,o.getCoordsRelativeToElement=c,o.getCoords=function(m,w,d,k,L,M,b,h,_){if(!M)return;const g=c(m,w,d);return g?(g[0]=Math.ceil((g[0]+(_?b/2:0))/b),g[1]=Math.ceil(g[1]/h),g[0]=Math.min(Math.max(g[0],1),k+(_?1:0)),g[1]=Math.min(Math.max(g[1],1),L),g):void 0}},9504:(v,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.moveToCellSequence=void 0;const m=c(2584);function w(h,_,g,p){const T=h-d(h,g),A=_-d(_,g),E=Math.abs(T-A)-(function(S,x,R){let I=0;const D=S-d(S,R),P=x-d(x,R);for(let F=0;F<Math.abs(D-P);F++){const z=k(S,x)==="A"?-1:1,q=R.buffer.lines.get(D+z*F);q!=null&&q.isWrapped&&I++}return I})(h,_,g);return b(E,M(k(h,_),p))}function d(h,_){let g=0,p=_.buffer.lines.get(h),T=p==null?void 0:p.isWrapped;for(;T&&h>=0&&h<_.rows;)g++,p=_.buffer.lines.get(--h),T=p==null?void 0:p.isWrapped;return g}function k(h,_){return h>_?"A":"B"}function L(h,_,g,p,T,A){let E=h,S=_,x="";for(;E!==g||S!==p;)E+=T?1:-1,T&&E>A.cols-1?(x+=A.buffer.translateBufferLineToString(S,!1,h,E),E=0,h=0,S++):!T&&E<0&&(x+=A.buffer.translateBufferLineToString(S,!1,0,h+1),E=A.cols-1,h=E,S--);return x+A.buffer.translateBufferLineToString(S,!1,h,E)}function M(h,_){const g=_?"O":"[";return m.C0.ESC+g+h}function b(h,_){h=Math.floor(h);let g="";for(let p=0;p<h;p++)g+=_;return g}o.moveToCellSequence=function(h,_,g,p){const T=g.buffer.x,A=g.buffer.y;if(!g.buffer.hasScrollback)return(function(x,R,I,D,P,F){return w(R,D,P,F).length===0?"":b(L(x,R,x,R-d(R,P),!1,P).length,M("D",F))})(T,A,0,_,g,p)+w(A,_,g,p)+(function(x,R,I,D,P,F){let z;z=w(R,D,P,F).length>0?D-d(D,P):R;const q=D,K=(function(V,W,O,U,H,$){let Z;return Z=w(O,U,H,$).length>0?U-d(U,H):W,V<O&&Z<=U||V>=O&&Z<U?"C":"D"})(x,R,I,D,P,F);return b(L(x,z,I,q,K==="C",P).length,M(K,F))})(T,A,h,_,g,p);let E;if(A===_)return E=T>h?"D":"C",b(Math.abs(T-h),M(E,p));E=A>_?"D":"C";const S=Math.abs(A-_);return b((function(x,R){return R.cols-x})(A>_?h:T,g)+(S-1)*g.cols+1+((A>_?T:h)-1),M(E,p))}},1296:function(v,o,c){var m=this&&this.__decorate||function(F,z,q,K){var V,W=arguments.length,O=W<3?z:K===null?K=Object.getOwnPropertyDescriptor(z,q):K;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(F,z,q,K);else for(var U=F.length-1;U>=0;U--)(V=F[U])&&(O=(W<3?V(O):W>3?V(z,q,O):V(z,q))||O);return W>3&&O&&Object.defineProperty(z,q,O),O},w=this&&this.__param||function(F,z){return function(q,K){z(q,K,F)}};Object.defineProperty(o,"__esModule",{value:!0}),o.DomRenderer=void 0;const d=c(3787),k=c(2550),L=c(2223),M=c(6171),b=c(6052),h=c(4725),_=c(8055),g=c(8460),p=c(844),T=c(2585),A="xterm-dom-renderer-owner-",E="xterm-rows",S="xterm-fg-",x="xterm-bg-",R="xterm-focus",I="xterm-selection";let D=1,P=o.DomRenderer=class extends p.Disposable{constructor(F,z,q,K,V,W,O,U,H,$,Z,re,we){super(),this._terminal=F,this._document=z,this._element=q,this._screenElement=K,this._viewportElement=V,this._helperContainer=W,this._linkifier2=O,this._charSizeService=H,this._optionsService=$,this._bufferService=Z,this._coreBrowserService=re,this._themeService=we,this._terminalClass=D++,this._rowElements=[],this._selectionRenderModel=(0,b.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new g.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(E),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,M.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((_e=>this._injectCss(_e)))),this._injectCss(this._themeService.colors),this._rowFactory=U.createInstance(d.DomRendererRowFactory,document),this._element.classList.add(A+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((_e=>this._handleLinkHover(_e)))),this.register(this._linkifier2.onHideLinkUnderline((_e=>this._handleLinkLeave(_e)))),this.register((0,p.toDisposable)((()=>{this._element.classList.remove(A+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new k.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 F=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*F,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*F),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/F),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/F),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 q of this._rowElements)q.style.width=`${this.dimensions.css.canvas.width}px`,q.style.height=`${this.dimensions.css.cell.height}px`,q.style.lineHeight=`${this.dimensions.css.cell.height}px`,q.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const z=`${this._terminalSelector} .${E} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=z,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(F){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let z=`${this._terminalSelector} .${E} { color: ${F.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;z+=`${this._terminalSelector} .${E} .xterm-dim { color: ${_.color.multiplyOpacity(F.foreground,.5).css};}`,z+=`${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 q=`blink_underline_${this._terminalClass}`,K=`blink_bar_${this._terminalClass}`,V=`blink_block_${this._terminalClass}`;z+=`@keyframes ${q} { 50% { border-bottom-style: hidden; }}`,z+=`@keyframes ${K} { 50% { box-shadow: none; }}`,z+=`@keyframes ${V} { 0% { background-color: ${F.cursor.css}; color: ${F.cursorAccent.css}; } 50% { background-color: inherit; color: ${F.cursor.css}; }}`,z+=`${this._terminalSelector} .${E}.${R} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${q} 1s step-end infinite;}${this._terminalSelector} .${E}.${R} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${K} 1s step-end infinite;}${this._terminalSelector} .${E}.${R} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${V} 1s step-end infinite;}${this._terminalSelector} .${E} .xterm-cursor.xterm-cursor-block { background-color: ${F.cursor.css}; color: ${F.cursorAccent.css};}${this._terminalSelector} .${E} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${F.cursor.css} !important; color: ${F.cursorAccent.css} !important;}${this._terminalSelector} .${E} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${F.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${E} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${F.cursor.css} inset;}${this._terminalSelector} .${E} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${F.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,z+=`${this._terminalSelector} .${I} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${I} div { position: absolute; background-color: ${F.selectionBackgroundOpaque.css};}${this._terminalSelector} .${I} div { position: absolute; background-color: ${F.selectionInactiveBackgroundOpaque.css};}`;for(const[W,O]of F.ansi.entries())z+=`${this._terminalSelector} .${S}${W} { color: ${O.css}; }${this._terminalSelector} .${S}${W}.xterm-dim { color: ${_.color.multiplyOpacity(O,.5).css}; }${this._terminalSelector} .${x}${W} { background-color: ${O.css}; }`;z+=`${this._terminalSelector} .${S}${L.INVERTED_DEFAULT_COLOR} { color: ${_.color.opaque(F.background).css}; }${this._terminalSelector} .${S}${L.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${_.color.multiplyOpacity(_.color.opaque(F.background),.5).css}; }${this._terminalSelector} .${x}${L.INVERTED_DEFAULT_COLOR} { background-color: ${F.foreground.css}; }`,this._themeStyleElement.textContent=z}_setDefaultSpacing(){const F=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${F}px`,this._rowFactory.defaultSpacing=F}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(F,z){for(let q=this._rowElements.length;q<=z;q++){const K=this._document.createElement("div");this._rowContainer.appendChild(K),this._rowElements.push(K)}for(;this._rowElements.length>z;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(F,z){this._refreshRowElements(F,z),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(R),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(R),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(F,z,q){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(F,z,q),this.renderRows(0,this._bufferService.rows-1),!F||!z)return;this._selectionRenderModel.update(this._terminal,F,z,q);const K=this._selectionRenderModel.viewportStartRow,V=this._selectionRenderModel.viewportEndRow,W=this._selectionRenderModel.viewportCappedStartRow,O=this._selectionRenderModel.viewportCappedEndRow;if(W>=this._bufferService.rows||O<0)return;const U=this._document.createDocumentFragment();if(q){const H=F[0]>z[0];U.appendChild(this._createSelectionElement(W,H?z[0]:F[0],H?F[0]:z[0],O-W+1))}else{const H=K===W?F[0]:0,$=W===V?z[0]:this._bufferService.cols;U.appendChild(this._createSelectionElement(W,H,$));const Z=O-W-1;if(U.appendChild(this._createSelectionElement(W+1,0,this._bufferService.cols,Z)),W!==O){const re=V===O?z[0]:this._bufferService.cols;U.appendChild(this._createSelectionElement(O,0,re))}}this._selectionContainer.appendChild(U)}_createSelectionElement(F,z,q,K=1){const V=this._document.createElement("div"),W=z*this.dimensions.css.cell.width;let O=this.dimensions.css.cell.width*(q-z);return W+O>this.dimensions.css.canvas.width&&(O=this.dimensions.css.canvas.width-W),V.style.height=K*this.dimensions.css.cell.height+"px",V.style.top=F*this.dimensions.css.cell.height+"px",V.style.left=`${W}px`,V.style.width=`${O}px`,V}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 F of this._rowElements)F.replaceChildren()}renderRows(F,z){const q=this._bufferService.buffer,K=q.ybase+q.y,V=Math.min(q.x,this._bufferService.cols-1),W=this._optionsService.rawOptions.cursorBlink,O=this._optionsService.rawOptions.cursorStyle,U=this._optionsService.rawOptions.cursorInactiveStyle;for(let H=F;H<=z;H++){const $=H+q.ydisp,Z=this._rowElements[H],re=q.lines.get($);if(!Z||!re)break;Z.replaceChildren(...this._rowFactory.createRow(re,$,$===K,O,U,V,W,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${A}${this._terminalClass}`}_handleLinkHover(F){this._setCellUnderline(F.x1,F.x2,F.y1,F.y2,F.cols,!0)}_handleLinkLeave(F){this._setCellUnderline(F.x1,F.x2,F.y1,F.y2,F.cols,!1)}_setCellUnderline(F,z,q,K,V,W){q<0&&(F=0),K<0&&(z=0);const O=this._bufferService.rows-1;q=Math.max(Math.min(q,O),0),K=Math.max(Math.min(K,O),0),V=Math.min(V,this._bufferService.cols);const U=this._bufferService.buffer,H=U.ybase+U.y,$=Math.min(U.x,V-1),Z=this._optionsService.rawOptions.cursorBlink,re=this._optionsService.rawOptions.cursorStyle,we=this._optionsService.rawOptions.cursorInactiveStyle;for(let _e=q;_e<=K;++_e){const Q=_e+U.ydisp,Y=this._rowElements[_e],te=U.lines.get(Q);if(!Y||!te)break;Y.replaceChildren(...this._rowFactory.createRow(te,Q,Q===H,re,we,$,Z,this.dimensions.css.cell.width,this._widthCache,W?_e===q?F:0:-1,W?(_e===K?z:V)-1:-1))}}};o.DomRenderer=P=m([w(7,T.IInstantiationService),w(8,h.ICharSizeService),w(9,T.IOptionsService),w(10,T.IBufferService),w(11,h.ICoreBrowserService),w(12,h.IThemeService)],P)},3787:function(v,o,c){var m=this&&this.__decorate||function(E,S,x,R){var I,D=arguments.length,P=D<3?S:R===null?R=Object.getOwnPropertyDescriptor(S,x):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")P=Reflect.decorate(E,S,x,R);else for(var F=E.length-1;F>=0;F--)(I=E[F])&&(P=(D<3?I(P):D>3?I(S,x,P):I(S,x))||P);return D>3&&P&&Object.defineProperty(S,x,P),P},w=this&&this.__param||function(E,S){return function(x,R){S(x,R,E)}};Object.defineProperty(o,"__esModule",{value:!0}),o.DomRendererRowFactory=void 0;const d=c(2223),k=c(643),L=c(511),M=c(2585),b=c(8055),h=c(4725),_=c(4269),g=c(6171),p=c(3734);let T=o.DomRendererRowFactory=class{constructor(E,S,x,R,I,D,P){this._document=E,this._characterJoinerService=S,this._optionsService=x,this._coreBrowserService=R,this._coreService=I,this._decorationService=D,this._themeService=P,this._workCell=new L.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(E,S,x){this._selectionStart=E,this._selectionEnd=S,this._columnSelectMode=x}createRow(E,S,x,R,I,D,P,F,z,q,K){const V=[],W=this._characterJoinerService.getJoinedCharacters(S),O=this._themeService.colors;let U,H=E.getNoBgTrimmedLength();x&&H<D+1&&(H=D+1);let $=0,Z="",re=0,we=0,_e=0,Q=!1,Y=0,te=!1,ee=0;const ye=[],ge=q!==-1&&K!==-1;for(let Be=0;Be<H;Be++){E.loadCell(Be,this._workCell);let Ue=this._workCell.getWidth();if(Ue===0)continue;let ze=!1,gt=Be,Fe=this._workCell;if(W.length>0&&Be===W[0][0]){ze=!0;const Qe=W.shift();Fe=new _.JoinedCellData(this._workCell,E.translateToString(!0,Qe[0],Qe[1]),Qe[1]-Qe[0]),gt=Qe[1]-1,Ue=Fe.getWidth()}const pt=this._isCellInSelection(Be,S),yt=x&&Be===D,oe=ge&&Be>=q&&Be<=K;let Ae=!1;this._decorationService.forEachDecorationAtCell(Be,S,void 0,(Qe=>{Ae=!0}));let De=Fe.getChars()||k.WHITESPACE_CELL_CHAR;if(De===" "&&(Fe.isUnderline()||Fe.isOverline())&&(De=" "),ee=Ue*F-z.get(De,Fe.isBold(),Fe.isItalic()),U){if($&&(pt&&te||!pt&&!te&&Fe.bg===re)&&(pt&&te&&O.selectionForeground||Fe.fg===we)&&Fe.extended.ext===_e&&oe===Q&&ee===Y&&!yt&&!ze&&!Ae){Fe.isInvisible()?Z+=k.WHITESPACE_CELL_CHAR:Z+=De,$++;continue}$&&(U.textContent=Z),U=this._document.createElement("span"),$=0,Z=""}else U=this._document.createElement("span");if(re=Fe.bg,we=Fe.fg,_e=Fe.extended.ext,Q=oe,Y=ee,te=pt,ze&&D>=Be&&D<=gt&&(D=Be),!this._coreService.isCursorHidden&&yt&&this._coreService.isCursorInitialized){if(ye.push("xterm-cursor"),this._coreBrowserService.isFocused)P&&ye.push("xterm-cursor-blink"),ye.push(R==="bar"?"xterm-cursor-bar":R==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(I)switch(I){case"outline":ye.push("xterm-cursor-outline");break;case"block":ye.push("xterm-cursor-block");break;case"bar":ye.push("xterm-cursor-bar");break;case"underline":ye.push("xterm-cursor-underline")}}if(Fe.isBold()&&ye.push("xterm-bold"),Fe.isItalic()&&ye.push("xterm-italic"),Fe.isDim()&&ye.push("xterm-dim"),Z=Fe.isInvisible()?k.WHITESPACE_CELL_CHAR:Fe.getChars()||k.WHITESPACE_CELL_CHAR,Fe.isUnderline()&&(ye.push(`xterm-underline-${Fe.extended.underlineStyle}`),Z===" "&&(Z=" "),!Fe.isUnderlineColorDefault()))if(Fe.isUnderlineColorRGB())U.style.textDecorationColor=`rgb(${p.AttributeData.toColorRGB(Fe.getUnderlineColor()).join(",")})`;else{let Qe=Fe.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Fe.isBold()&&Qe<8&&(Qe+=8),U.style.textDecorationColor=O.ansi[Qe].css}Fe.isOverline()&&(ye.push("xterm-overline"),Z===" "&&(Z=" ")),Fe.isStrikethrough()&&ye.push("xterm-strikethrough"),oe&&(U.style.textDecoration="underline");let Le=Fe.getFgColor(),nt=Fe.getFgColorMode(),je=Fe.getBgColor(),Ke=Fe.getBgColorMode();const kt=!!Fe.isInverse();if(kt){const Qe=Le;Le=je,je=Qe;const St=nt;nt=Ke,Ke=St}let Lt,xt,vt,dt=!1;switch(this._decorationService.forEachDecorationAtCell(Be,S,void 0,(Qe=>{Qe.options.layer!=="top"&&dt||(Qe.backgroundColorRGB&&(Ke=50331648,je=Qe.backgroundColorRGB.rgba>>8&16777215,Lt=Qe.backgroundColorRGB),Qe.foregroundColorRGB&&(nt=50331648,Le=Qe.foregroundColorRGB.rgba>>8&16777215,xt=Qe.foregroundColorRGB),dt=Qe.options.layer==="top")})),!dt&&pt&&(Lt=this._coreBrowserService.isFocused?O.selectionBackgroundOpaque:O.selectionInactiveBackgroundOpaque,je=Lt.rgba>>8&16777215,Ke=50331648,dt=!0,O.selectionForeground&&(nt=50331648,Le=O.selectionForeground.rgba>>8&16777215,xt=O.selectionForeground)),dt&&ye.push("xterm-decoration-top"),Ke){case 16777216:case 33554432:vt=O.ansi[je],ye.push(`xterm-bg-${je}`);break;case 50331648:vt=b.channels.toColor(je>>16,je>>8&255,255&je),this._addStyle(U,`background-color:#${A((je>>>0).toString(16),"0",6)}`);break;default:kt?(vt=O.foreground,ye.push(`xterm-bg-${d.INVERTED_DEFAULT_COLOR}`)):vt=O.background}switch(Lt||Fe.isDim()&&(Lt=b.color.multiplyOpacity(vt,.5)),nt){case 16777216:case 33554432:Fe.isBold()&&Le<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Le+=8),this._applyMinimumContrast(U,vt,O.ansi[Le],Fe,Lt,void 0)||ye.push(`xterm-fg-${Le}`);break;case 50331648:const Qe=b.channels.toColor(Le>>16&255,Le>>8&255,255&Le);this._applyMinimumContrast(U,vt,Qe,Fe,Lt,xt)||this._addStyle(U,`color:#${A(Le.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(U,vt,O.foreground,Fe,Lt,xt)||kt&&ye.push(`xterm-fg-${d.INVERTED_DEFAULT_COLOR}`)}ye.length&&(U.className=ye.join(" "),ye.length=0),yt||ze||Ae?U.textContent=Z:$++,ee!==this.defaultSpacing&&(U.style.letterSpacing=`${ee}px`),V.push(U),Be=gt}return U&&$&&(U.textContent=Z),V}_applyMinimumContrast(E,S,x,R,I,D){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,g.treatGlyphAsBackgroundColor)(R.getCode()))return!1;const P=this._getContrastCache(R);let F;if(I||D||(F=P.getColor(S.rgba,x.rgba)),F===void 0){const z=this._optionsService.rawOptions.minimumContrastRatio/(R.isDim()?2:1);F=b.color.ensureContrastRatio(I||S,D||x,z),P.setColor((I||S).rgba,(D||x).rgba,F??null)}return!!F&&(this._addStyle(E,`color:${F.css}`),!0)}_getContrastCache(E){return E.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(E,S){E.setAttribute("style",`${E.getAttribute("style")||""}${S};`)}_isCellInSelection(E,S){const x=this._selectionStart,R=this._selectionEnd;return!(!x||!R)&&(this._columnSelectMode?x[0]<=R[0]?E>=x[0]&&S>=x[1]&&E<R[0]&&S<=R[1]:E<x[0]&&S>=x[1]&&E>=R[0]&&S<=R[1]:S>x[1]&&S<R[1]||x[1]===R[1]&&S===x[1]&&E>=x[0]&&E<R[0]||x[1]<R[1]&&S===R[1]&&E<R[0]||x[1]<R[1]&&S===x[1]&&E>=x[0])}};function A(E,S,x){for(;E.length<x;)E=S+E;return E}o.DomRendererRowFactory=T=m([w(1,h.ICharacterJoinerService),w(2,M.IOptionsService),w(3,h.ICoreBrowserService),w(4,M.ICoreService),w(5,M.IDecorationService),w(6,h.IThemeService)],T)},2550:(v,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.WidthCache=void 0,o.WidthCache=class{constructor(c,m){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=c.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const w=c.createElement("span");w.classList.add("xterm-char-measure-element");const d=c.createElement("span");d.classList.add("xterm-char-measure-element"),d.style.fontWeight="bold";const k=c.createElement("span");k.classList.add("xterm-char-measure-element"),k.style.fontStyle="italic";const L=c.createElement("span");L.classList.add("xterm-char-measure-element"),L.style.fontWeight="bold",L.style.fontStyle="italic",this._measureElements=[w,d,k,L],this._container.appendChild(w),this._container.appendChild(d),this._container.appendChild(k),this._container.appendChild(L),m.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(c,m,w,d){c===this._font&&m===this._fontSize&&w===this._weight&&d===this._weightBold||(this._font=c,this._fontSize=m,this._weight=w,this._weightBold=d,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${w}`,this._measureElements[1].style.fontWeight=`${d}`,this._measureElements[2].style.fontWeight=`${w}`,this._measureElements[3].style.fontWeight=`${d}`,this.clear())}get(c,m,w){let d=0;if(!m&&!w&&c.length===1&&(d=c.charCodeAt(0))<256){if(this._flat[d]!==-9999)return this._flat[d];const M=this._measure(c,0);return M>0&&(this._flat[d]=M),M}let k=c;m&&(k+="B"),w&&(k+="I");let L=this._holey.get(k);if(L===void 0){let M=0;m&&(M|=1),w&&(M|=2),L=this._measure(c,M),L>0&&this._holey.set(k,L)}return L}_measure(c,m){const w=this._measureElements[m];return w.textContent=c.repeat(32),w.offsetWidth/32}}},2223:(v,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.TEXT_BASELINE=o.DIM_OPACITY=o.INVERTED_DEFAULT_COLOR=void 0;const m=c(6114);o.INVERTED_DEFAULT_COLOR=257,o.DIM_OPACITY=.5,o.TEXT_BASELINE=m.isFirefox||m.isLegacyEdge?"bottom":"ideographic"},6171:(v,o)=>{function c(w){return 57508<=w&&w<=57558}function m(w){return w>=128512&&w<=128591||w>=127744&&w<=128511||w>=128640&&w<=128767||w>=9728&&w<=9983||w>=9984&&w<=10175||w>=65024&&w<=65039||w>=129280&&w<=129535||w>=127462&&w<=127487}Object.defineProperty(o,"__esModule",{value:!0}),o.computeNextVariantOffset=o.createRenderDimensions=o.treatGlyphAsBackgroundColor=o.allowRescaling=o.isEmoji=o.isRestrictedPowerlineGlyph=o.isPowerlineGlyph=o.throwIfFalsy=void 0,o.throwIfFalsy=function(w){if(!w)throw new Error("value must not be falsy");return w},o.isPowerlineGlyph=c,o.isRestrictedPowerlineGlyph=function(w){return 57520<=w&&w<=57527},o.isEmoji=m,o.allowRescaling=function(w,d,k,L){return d===1&&k>Math.ceil(1.5*L)&&w!==void 0&&w>255&&!m(w)&&!c(w)&&!(function(M){return 57344<=M&&M<=63743})(w)},o.treatGlyphAsBackgroundColor=function(w){return c(w)||(function(d){return 9472<=d&&d<=9631})(w)},o.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}}}},o.computeNextVariantOffset=function(w,d,k=0){return(w-(2*Math.round(d)-k))%(2*Math.round(d))}},6052:(v,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.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(w,d,k,L=!1){if(this.selectionStart=d,this.selectionEnd=k,!d||!k||d[0]===k[0]&&d[1]===k[1])return void this.clear();const M=w.buffers.active.ydisp,b=d[1]-M,h=k[1]-M,_=Math.max(b,0),g=Math.min(h,w.rows-1);_>=w.rows||g<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=L,this.viewportStartRow=b,this.viewportEndRow=h,this.viewportCappedStartRow=_,this.viewportCappedEndRow=g,this.startCol=d[0],this.endCol=k[0])}isCellSelected(w,d,k){return!!this.hasSelection&&(k-=w.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?d>=this.startCol&&k>=this.viewportCappedStartRow&&d<this.endCol&&k<=this.viewportCappedEndRow:d<this.startCol&&k>=this.viewportCappedStartRow&&d>=this.endCol&&k<=this.viewportCappedEndRow:k>this.viewportStartRow&&k<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&k===this.viewportStartRow&&d>=this.startCol&&d<this.endCol||this.viewportStartRow<this.viewportEndRow&&k===this.viewportEndRow&&d<this.endCol||this.viewportStartRow<this.viewportEndRow&&k===this.viewportStartRow&&d>=this.startCol)}}o.createSelectionRenderModel=function(){return new c}},456:(v,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.SelectionModel=void 0,o.SelectionModel=class{constructor(c){this._bufferService=c,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const c=this.selectionStart[0]+this.selectionStartLength;return c>this._bufferService.cols?c%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(c/this._bufferService.cols)-1]:[c%this._bufferService.cols,this.selectionStart[1]+Math.floor(c/this._bufferService.cols)]:[c,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const c=this.selectionStart[0]+this.selectionStartLength;return c>this._bufferService.cols?[c%this._bufferService.cols,this.selectionStart[1]+Math.floor(c/this._bufferService.cols)]:[Math.max(c,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const c=this.selectionStart,m=this.selectionEnd;return!(!c||!m)&&(c[1]>m[1]||c[1]===m[1]&&c[0]>m[0])}handleTrim(c){return this.selectionStart&&(this.selectionStart[1]-=c),this.selectionEnd&&(this.selectionEnd[1]-=c),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(v,o,c){var m=this&&this.__decorate||function(g,p,T,A){var E,S=arguments.length,x=S<3?p:A===null?A=Object.getOwnPropertyDescriptor(p,T):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(g,p,T,A);else for(var R=g.length-1;R>=0;R--)(E=g[R])&&(x=(S<3?E(x):S>3?E(p,T,x):E(p,T))||x);return S>3&&x&&Object.defineProperty(p,T,x),x},w=this&&this.__param||function(g,p){return function(T,A){p(T,A,g)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CharSizeService=void 0;const d=c(2585),k=c(8460),L=c(844);let M=o.CharSizeService=class extends L.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(g,p,T){super(),this._optionsService=T,this.width=0,this.height=0,this._onCharSizeChange=this.register(new k.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new _(this._optionsService))}catch{this._measureStrategy=this.register(new h(g,p,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const g=this._measureStrategy.measure();g.width===this.width&&g.height===this.height||(this.width=g.width,this.height=g.height,this._onCharSizeChange.fire())}};o.CharSizeService=M=m([w(2,d.IOptionsService)],M);class b extends L.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(p,T){p!==void 0&&p>0&&T!==void 0&&T>0&&(this._result.width=p,this._result.height=T)}}class h extends b{constructor(p,T,A){super(),this._document=p,this._parentElement=T,this._optionsService=A,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 _ extends b{constructor(p){super(),this._optionsService=p,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const T=this._ctx.measureText("W");if(!("width"in T&&"fontBoundingBoxAscent"in T&&"fontBoundingBoxDescent"in T))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const p=this._ctx.measureText("W");return this._validateAndSet(p.width,p.fontBoundingBoxAscent+p.fontBoundingBoxDescent),this._result}}},4269:function(v,o,c){var m=this&&this.__decorate||function(_,g,p,T){var A,E=arguments.length,S=E<3?g:T===null?T=Object.getOwnPropertyDescriptor(g,p):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(_,g,p,T);else for(var x=_.length-1;x>=0;x--)(A=_[x])&&(S=(E<3?A(S):E>3?A(g,p,S):A(g,p))||S);return E>3&&S&&Object.defineProperty(g,p,S),S},w=this&&this.__param||function(_,g){return function(p,T){g(p,T,_)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CharacterJoinerService=o.JoinedCellData=void 0;const d=c(3734),k=c(643),L=c(511),M=c(2585);class b extends d.AttributeData{constructor(g,p,T){super(),this.content=0,this.combinedData="",this.fg=g.fg,this.bg=g.bg,this.combinedData=p,this._width=T}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(g){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}o.JoinedCellData=b;let h=o.CharacterJoinerService=class Qv{constructor(g){this._bufferService=g,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new L.CellData}register(g){const p={id:this._nextCharacterJoinerId++,handler:g};return this._characterJoiners.push(p),p.id}deregister(g){for(let p=0;p<this._characterJoiners.length;p++)if(this._characterJoiners[p].id===g)return this._characterJoiners.splice(p,1),!0;return!1}getJoinedCharacters(g){if(this._characterJoiners.length===0)return[];const p=this._bufferService.buffer.lines.get(g);if(!p||p.length===0)return[];const T=[],A=p.translateToString(!0);let E=0,S=0,x=0,R=p.getFg(0),I=p.getBg(0);for(let D=0;D<p.getTrimmedLength();D++)if(p.loadCell(D,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==R||this._workCell.bg!==I){if(D-E>1){const P=this._getJoinedRanges(A,x,S,p,E);for(let F=0;F<P.length;F++)T.push(P[F])}E=D,x=S,R=this._workCell.fg,I=this._workCell.bg}S+=this._workCell.getChars().length||k.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-E>1){const D=this._getJoinedRanges(A,x,S,p,E);for(let P=0;P<D.length;P++)T.push(D[P])}return T}_getJoinedRanges(g,p,T,A,E){const S=g.substring(p,T);let x=[];try{x=this._characterJoiners[0].handler(S)}catch(R){console.error(R)}for(let R=1;R<this._characterJoiners.length;R++)try{const I=this._characterJoiners[R].handler(S);for(let D=0;D<I.length;D++)Qv._mergeRanges(x,I[D])}catch(I){console.error(I)}return this._stringRangesToCellRanges(x,A,E),x}_stringRangesToCellRanges(g,p,T){let A=0,E=!1,S=0,x=g[A];if(x){for(let R=T;R<this._bufferService.cols;R++){const I=p.getWidth(R),D=p.getString(R).length||k.WHITESPACE_CELL_CHAR.length;if(I!==0){if(!E&&x[0]<=S&&(x[0]=R,E=!0),x[1]<=S){if(x[1]=R,x=g[++A],!x)break;x[0]<=S?(x[0]=R,E=!0):E=!1}S+=D}}x&&(x[1]=this._bufferService.cols)}}static _mergeRanges(g,p){let T=!1;for(let A=0;A<g.length;A++){const E=g[A];if(T){if(p[1]<=E[0])return g[A-1][1]=p[1],g;if(p[1]<=E[1])return g[A-1][1]=Math.max(p[1],E[1]),g.splice(A,1),g;g.splice(A,1),A--}else{if(p[1]<=E[0])return g.splice(A,0,p),g;if(p[1]<=E[1])return E[0]=Math.min(p[0],E[0]),g;p[0]<E[1]&&(E[0]=Math.min(p[0],E[0]),T=!0)}}return T?g[g.length-1][1]=p[1]:g.push(p),g}};o.CharacterJoinerService=h=m([w(0,M.IBufferService)],h)},5114:(v,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CoreBrowserService=void 0;const m=c(844),w=c(8460),d=c(3656);class k extends m.Disposable{constructor(b,h,_){super(),this._textarea=b,this._window=h,this.mainDocument=_,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new L(this._window),this._onDprChange=this.register(new w.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new w.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((g=>this._screenDprMonitor.setWindow(g)))),this.register((0,w.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(b){this._window!==b&&(this._window=b,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}}o.CoreBrowserService=k;class L extends m.Disposable{constructor(b){super(),this._parentWindow=b,this._windowResizeListener=this.register(new m.MutableDisposable),this._onDprChange=this.register(new w.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,m.toDisposable)((()=>this.clearListener())))}setWindow(b){this._parentWindow=b,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,d.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var b;this._outerListener&&((b=this._resolutionMediaMatchList)==null||b.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:(v,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.LinkProviderService=void 0;const m=c(844);class w extends m.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,m.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(k){return this.linkProviders.push(k),{dispose:()=>{const L=this.linkProviders.indexOf(k);L!==-1&&this.linkProviders.splice(L,1)}}}}o.LinkProviderService=w},8934:function(v,o,c){var m=this&&this.__decorate||function(M,b,h,_){var g,p=arguments.length,T=p<3?b:_===null?_=Object.getOwnPropertyDescriptor(b,h):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(M,b,h,_);else for(var A=M.length-1;A>=0;A--)(g=M[A])&&(T=(p<3?g(T):p>3?g(b,h,T):g(b,h))||T);return p>3&&T&&Object.defineProperty(b,h,T),T},w=this&&this.__param||function(M,b){return function(h,_){b(h,_,M)}};Object.defineProperty(o,"__esModule",{value:!0}),o.MouseService=void 0;const d=c(4725),k=c(9806);let L=o.MouseService=class{constructor(M,b){this._renderService=M,this._charSizeService=b}getCoords(M,b,h,_,g){return(0,k.getCoords)(window,M,b,h,_,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,g)}getMouseReportCoords(M,b){const h=(0,k.getCoordsRelativeToElement)(window,M,b);if(this._charSizeService.hasValidSize)return h[0]=Math.min(Math.max(h[0],0),this._renderService.dimensions.css.canvas.width-1),h[1]=Math.min(Math.max(h[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(h[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(h[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(h[0]),y:Math.floor(h[1])}}};o.MouseService=L=m([w(0,d.IRenderService),w(1,d.ICharSizeService)],L)},3230:function(v,o,c){var m=this&&this.__decorate||function(g,p,T,A){var E,S=arguments.length,x=S<3?p:A===null?A=Object.getOwnPropertyDescriptor(p,T):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(g,p,T,A);else for(var R=g.length-1;R>=0;R--)(E=g[R])&&(x=(S<3?E(x):S>3?E(p,T,x):E(p,T))||x);return S>3&&x&&Object.defineProperty(p,T,x),x},w=this&&this.__param||function(g,p){return function(T,A){p(T,A,g)}};Object.defineProperty(o,"__esModule",{value:!0}),o.RenderService=void 0;const d=c(6193),k=c(4725),L=c(8460),M=c(844),b=c(7226),h=c(2585);let _=o.RenderService=class extends M.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(g,p,T,A,E,S,x,R){super(),this._rowCount=g,this._charSizeService=A,this._renderer=this.register(new M.MutableDisposable),this._pausedResizeTask=new b.DebouncedIdleTask,this._observerDisposable=this.register(new M.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 L.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new L.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new L.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new L.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new d.RenderDebouncer(((I,D)=>this._renderRows(I,D)),x),this.register(this._renderDebouncer),this.register(x.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(S.onResize((()=>this._fullRefresh()))),this.register(S.buffers.onBufferActivate((()=>{var I;return(I=this._renderer.value)==null?void 0:I.clear()}))),this.register(T.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(E.onDecorationRegistered((()=>this._fullRefresh()))),this.register(E.onDecorationRemoved((()=>this._fullRefresh()))),this.register(T.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(S.cols,S.rows),this._fullRefresh()}))),this.register(T.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(S.buffer.y,S.buffer.y,!0)))),this.register(R.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(x.window,p),this.register(x.onWindowChange((I=>this._registerIntersectionObserver(I,p))))}_registerIntersectionObserver(g,p){if("IntersectionObserver"in g){const T=new g.IntersectionObserver((A=>this._handleIntersectionChange(A[A.length-1])),{threshold:0});T.observe(p),this._observerDisposable.value=(0,M.toDisposable)((()=>T.disconnect()))}}_handleIntersectionChange(g){this._isPaused=g.isIntersecting===void 0?g.intersectionRatio===0:!g.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(g,p,T=!1){this._isPaused?this._needsFullRefresh=!0:(T||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(g,p,this._rowCount))}_renderRows(g,p){this._renderer.value&&(g=Math.min(g,this._rowCount-1),p=Math.min(p,this._rowCount-1),this._renderer.value.renderRows(g,p),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:g,end:p}),this._onRender.fire({start:g,end:p}),this._isNextRenderRedrawOnly=!0)}resize(g,p){this._rowCount=p,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(g){this._renderer.value=g,this._renderer.value&&(this._renderer.value.onRequestRedraw((p=>this.refreshRows(p.start,p.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(g){return this._renderDebouncer.addRefreshCallback(g)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var g,p;this._renderer.value&&((p=(g=this._renderer.value).clearTextureAtlas)==null||p.call(g),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(g,p){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var T;return(T=this._renderer.value)==null?void 0:T.handleResize(g,p)})):this._renderer.value.handleResize(g,p),this._fullRefresh())}handleCharSizeChanged(){var g;(g=this._renderer.value)==null||g.handleCharSizeChanged()}handleBlur(){var g;(g=this._renderer.value)==null||g.handleBlur()}handleFocus(){var g;(g=this._renderer.value)==null||g.handleFocus()}handleSelectionChanged(g,p,T){var A;this._selectionState.start=g,this._selectionState.end=p,this._selectionState.columnSelectMode=T,(A=this._renderer.value)==null||A.handleSelectionChanged(g,p,T)}handleCursorMove(){var g;(g=this._renderer.value)==null||g.handleCursorMove()}clear(){var g;(g=this._renderer.value)==null||g.clear()}};o.RenderService=_=m([w(2,h.IOptionsService),w(3,k.ICharSizeService),w(4,h.IDecorationService),w(5,h.IBufferService),w(6,k.ICoreBrowserService),w(7,k.IThemeService)],_)},9312:function(v,o,c){var m=this&&this.__decorate||function(x,R,I,D){var P,F=arguments.length,z=F<3?R:D===null?D=Object.getOwnPropertyDescriptor(R,I):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")z=Reflect.decorate(x,R,I,D);else for(var q=x.length-1;q>=0;q--)(P=x[q])&&(z=(F<3?P(z):F>3?P(R,I,z):P(R,I))||z);return F>3&&z&&Object.defineProperty(R,I,z),z},w=this&&this.__param||function(x,R){return function(I,D){R(I,D,x)}};Object.defineProperty(o,"__esModule",{value:!0}),o.SelectionService=void 0;const d=c(9806),k=c(9504),L=c(456),M=c(4725),b=c(8460),h=c(844),_=c(6114),g=c(4841),p=c(511),T=c(2585),A=" ",E=new RegExp(A,"g");let S=o.SelectionService=class extends h.Disposable{constructor(x,R,I,D,P,F,z,q,K){super(),this._element=x,this._screenElement=R,this._linkifier=I,this._bufferService=D,this._coreService=P,this._mouseService=F,this._optionsService=z,this._renderService=q,this._coreBrowserService=K,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new p.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new b.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new b.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new b.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new b.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=V=>this._handleMouseMove(V),this._mouseUpListener=V=>this._handleMouseUp(V),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((V=>this._handleTrim(V))),this.register(this._bufferService.buffers.onBufferActivate((V=>this._handleBufferActivate(V)))),this.enable(),this._model=new L.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,h.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 x=this._model.finalSelectionStart,R=this._model.finalSelectionEnd;return!(!x||!R||x[0]===R[0]&&x[1]===R[1])}get selectionText(){const x=this._model.finalSelectionStart,R=this._model.finalSelectionEnd;if(!x||!R)return"";const I=this._bufferService.buffer,D=[];if(this._activeSelectionMode===3){if(x[0]===R[0])return"";const P=x[0]<R[0]?x[0]:R[0],F=x[0]<R[0]?R[0]:x[0];for(let z=x[1];z<=R[1];z++){const q=I.translateBufferLineToString(z,!0,P,F);D.push(q)}}else{const P=x[1]===R[1]?R[0]:void 0;D.push(I.translateBufferLineToString(x[1],!0,x[0],P));for(let F=x[1]+1;F<=R[1]-1;F++){const z=I.lines.get(F),q=I.translateBufferLineToString(F,!0);z!=null&&z.isWrapped?D[D.length-1]+=q:D.push(q)}if(x[1]!==R[1]){const F=I.lines.get(R[1]),z=I.translateBufferLineToString(R[1],!0,0,R[0]);F&&F.isWrapped?D[D.length-1]+=z:D.push(z)}}return D.map((P=>P.replace(E," "))).join(_.isWindows?`\r
|
|
127
|
+
`:`
|
|
128
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(x){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),_.isLinux&&x&&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(x){const R=this._getMouseBufferCoords(x),I=this._model.finalSelectionStart,D=this._model.finalSelectionEnd;return!!(I&&D&&R)&&this._areCoordsInSelection(R,I,D)}isCellInSelection(x,R){const I=this._model.finalSelectionStart,D=this._model.finalSelectionEnd;return!(!I||!D)&&this._areCoordsInSelection([x,R],I,D)}_areCoordsInSelection(x,R,I){return x[1]>R[1]&&x[1]<I[1]||R[1]===I[1]&&x[1]===R[1]&&x[0]>=R[0]&&x[0]<I[0]||R[1]<I[1]&&x[1]===I[1]&&x[0]<I[0]||R[1]<I[1]&&x[1]===R[1]&&x[0]>=R[0]}_selectWordAtCursor(x,R){var P,F;const I=(F=(P=this._linkifier.currentLink)==null?void 0:P.link)==null?void 0:F.range;if(I)return this._model.selectionStart=[I.start.x-1,I.start.y-1],this._model.selectionStartLength=(0,g.getRangeLength)(I,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const D=this._getMouseBufferCoords(x);return!!D&&(this._selectWordAt(D,R),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(x,R){this._model.clearSelection(),x=Math.max(x,0),R=Math.min(R,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,x],this._model.selectionEnd=[this._bufferService.cols,R],this.refresh(),this._onSelectionChange.fire()}_handleTrim(x){this._model.handleTrim(x)&&this.refresh()}_getMouseBufferCoords(x){const R=this._mouseService.getCoords(x,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(R)return R[0]--,R[1]--,R[1]+=this._bufferService.buffer.ydisp,R}_getMouseEventScrollAmount(x){let R=(0,d.getCoordsRelativeToElement)(this._coreBrowserService.window,x,this._screenElement)[1];const I=this._renderService.dimensions.css.canvas.height;return R>=0&&R<=I?0:(R>I&&(R-=I),R=Math.min(Math.max(R,-50),50),R/=50,R/Math.abs(R)+Math.round(14*R))}shouldForceSelection(x){return _.isMac?x.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:x.shiftKey}handleMouseDown(x){if(this._mouseDownTimeStamp=x.timeStamp,(x.button!==2||!this.hasSelection)&&x.button===0){if(!this._enabled){if(!this.shouldForceSelection(x))return;x.stopPropagation()}x.preventDefault(),this._dragScrollAmount=0,this._enabled&&x.shiftKey?this._handleIncrementalClick(x):x.detail===1?this._handleSingleClick(x):x.detail===2?this._handleDoubleClick(x):x.detail===3&&this._handleTripleClick(x),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(x){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(x))}_handleSingleClick(x){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(x)?3:0,this._model.selectionStart=this._getMouseBufferCoords(x),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const R=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);R&&R.length!==this._model.selectionStart[0]&&R.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(x){this._selectWordAtCursor(x,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(x){const R=this._getMouseBufferCoords(x);R&&(this._activeSelectionMode=2,this._selectLineAt(R[1]))}shouldColumnSelect(x){return x.altKey&&!(_.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(x){if(x.stopImmediatePropagation(),!this._model.selectionStart)return;const R=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(x),!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(x),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 D=I.lines.get(this._model.selectionEnd[1]);D&&D.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}R&&R[0]===this._model.selectionEnd[0]&&R[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 x=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(x.ydisp+this._bufferService.rows,x.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=x.ydisp),this.refresh()}}_handleMouseUp(x){const R=x.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&R<500&&x.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const I=this._mouseService.getCoords(x,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(I&&I[0]!==void 0&&I[1]!==void 0){const D=(0,k.moveToCellSequence)(I[0]-1,I[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(D,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const x=this._model.finalSelectionStart,R=this._model.finalSelectionEnd,I=!(!x||!R||x[0]===R[0]&&x[1]===R[1]);I?x&&R&&(this._oldSelectionStart&&this._oldSelectionEnd&&x[0]===this._oldSelectionStart[0]&&x[1]===this._oldSelectionStart[1]&&R[0]===this._oldSelectionEnd[0]&&R[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(x,R,I)):this._oldHasSelection&&this._fireOnSelectionChange(x,R,I)}_fireOnSelectionChange(x,R,I){this._oldSelectionStart=x,this._oldSelectionEnd=R,this._oldHasSelection=I,this._onSelectionChange.fire()}_handleBufferActivate(x){this.clearSelection(),this._trimListener.dispose(),this._trimListener=x.activeBuffer.lines.onTrim((R=>this._handleTrim(R)))}_convertViewportColToCharacterIndex(x,R){let I=R;for(let D=0;R>=D;D++){const P=x.loadCell(D,this._workCell).getChars().length;this._workCell.getWidth()===0?I--:P>1&&R!==D&&(I+=P-1)}return I}setSelection(x,R,I){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[x,R],this._model.selectionStartLength=I,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(x){this._isClickInSelection(x)||(this._selectWordAtCursor(x,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(x,R,I=!0,D=!0){if(x[0]>=this._bufferService.cols)return;const P=this._bufferService.buffer,F=P.lines.get(x[1]);if(!F)return;const z=P.translateBufferLineToString(x[1],!1);let q=this._convertViewportColToCharacterIndex(F,x[0]),K=q;const V=x[0]-q;let W=0,O=0,U=0,H=0;if(z.charAt(q)===" "){for(;q>0&&z.charAt(q-1)===" ";)q--;for(;K<z.length&&z.charAt(K+1)===" ";)K++}else{let re=x[0],we=x[0];F.getWidth(re)===0&&(W++,re--),F.getWidth(we)===2&&(O++,we++);const _e=F.getString(we).length;for(_e>1&&(H+=_e-1,K+=_e-1);re>0&&q>0&&!this._isCharWordSeparator(F.loadCell(re-1,this._workCell));){F.loadCell(re-1,this._workCell);const Q=this._workCell.getChars().length;this._workCell.getWidth()===0?(W++,re--):Q>1&&(U+=Q-1,q-=Q-1),q--,re--}for(;we<F.length&&K+1<z.length&&!this._isCharWordSeparator(F.loadCell(we+1,this._workCell));){F.loadCell(we+1,this._workCell);const Q=this._workCell.getChars().length;this._workCell.getWidth()===2?(O++,we++):Q>1&&(H+=Q-1,K+=Q-1),K++,we++}}K++;let $=q+V-W+U,Z=Math.min(this._bufferService.cols,K-q+W+O-U-H);if(R||z.slice(q,K).trim()!==""){if(I&&$===0&&F.getCodePoint(0)!==32){const re=P.lines.get(x[1]-1);if(re&&F.isWrapped&&re.getCodePoint(this._bufferService.cols-1)!==32){const we=this._getWordAt([this._bufferService.cols-1,x[1]-1],!1,!0,!1);if(we){const _e=this._bufferService.cols-we.start;$-=_e,Z+=_e}}}if(D&&$+Z===this._bufferService.cols&&F.getCodePoint(this._bufferService.cols-1)!==32){const re=P.lines.get(x[1]+1);if(re!=null&&re.isWrapped&&re.getCodePoint(0)!==32){const we=this._getWordAt([0,x[1]+1],!1,!1,!0);we&&(Z+=we.length)}}return{start:$,length:Z}}}_selectWordAt(x,R){const I=this._getWordAt(x,R);if(I){for(;I.start<0;)I.start+=this._bufferService.cols,x[1]--;this._model.selectionStart=[I.start,x[1]],this._model.selectionStartLength=I.length}}_selectToWordAt(x){const R=this._getWordAt(x,!0);if(R){let I=x[1];for(;R.start<0;)R.start+=this._bufferService.cols,I--;if(!this._model.areSelectionValuesReversed())for(;R.start+R.length>this._bufferService.cols;)R.length-=this._bufferService.cols,I++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?R.start:R.start+R.length,I]}}_isCharWordSeparator(x){return x.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(x.getChars())>=0}_selectLineAt(x){const R=this._bufferService.buffer.getWrappedRangeForLine(x),I={start:{x:0,y:R.first},end:{x:this._bufferService.cols-1,y:R.last}};this._model.selectionStart=[0,R.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,g.getRangeLength)(I,this._bufferService.cols)}};o.SelectionService=S=m([w(3,T.IBufferService),w(4,T.ICoreService),w(5,M.IMouseService),w(6,T.IOptionsService),w(7,M.IRenderService),w(8,M.ICoreBrowserService)],S)},4725:(v,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ILinkProviderService=o.IThemeService=o.ICharacterJoinerService=o.ISelectionService=o.IRenderService=o.IMouseService=o.ICoreBrowserService=o.ICharSizeService=void 0;const m=c(8343);o.ICharSizeService=(0,m.createDecorator)("CharSizeService"),o.ICoreBrowserService=(0,m.createDecorator)("CoreBrowserService"),o.IMouseService=(0,m.createDecorator)("MouseService"),o.IRenderService=(0,m.createDecorator)("RenderService"),o.ISelectionService=(0,m.createDecorator)("SelectionService"),o.ICharacterJoinerService=(0,m.createDecorator)("CharacterJoinerService"),o.IThemeService=(0,m.createDecorator)("ThemeService"),o.ILinkProviderService=(0,m.createDecorator)("LinkProviderService")},6731:function(v,o,c){var m=this&&this.__decorate||function(S,x,R,I){var D,P=arguments.length,F=P<3?x:I===null?I=Object.getOwnPropertyDescriptor(x,R):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")F=Reflect.decorate(S,x,R,I);else for(var z=S.length-1;z>=0;z--)(D=S[z])&&(F=(P<3?D(F):P>3?D(x,R,F):D(x,R))||F);return P>3&&F&&Object.defineProperty(x,R,F),F},w=this&&this.__param||function(S,x){return function(R,I){x(R,I,S)}};Object.defineProperty(o,"__esModule",{value:!0}),o.ThemeService=o.DEFAULT_ANSI_COLORS=void 0;const d=c(7239),k=c(8055),L=c(8460),M=c(844),b=c(2585),h=k.css.toColor("#ffffff"),_=k.css.toColor("#000000"),g=k.css.toColor("#ffffff"),p=k.css.toColor("#000000"),T={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};o.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const S=[k.css.toColor("#2e3436"),k.css.toColor("#cc0000"),k.css.toColor("#4e9a06"),k.css.toColor("#c4a000"),k.css.toColor("#3465a4"),k.css.toColor("#75507b"),k.css.toColor("#06989a"),k.css.toColor("#d3d7cf"),k.css.toColor("#555753"),k.css.toColor("#ef2929"),k.css.toColor("#8ae234"),k.css.toColor("#fce94f"),k.css.toColor("#729fcf"),k.css.toColor("#ad7fa8"),k.css.toColor("#34e2e2"),k.css.toColor("#eeeeec")],x=[0,95,135,175,215,255];for(let R=0;R<216;R++){const I=x[R/36%6|0],D=x[R/6%6|0],P=x[R%6];S.push({css:k.channels.toCss(I,D,P),rgba:k.channels.toRgba(I,D,P)})}for(let R=0;R<24;R++){const I=8+10*R;S.push({css:k.channels.toCss(I,I,I),rgba:k.channels.toRgba(I,I,I)})}return S})());let A=o.ThemeService=class extends M.Disposable{get colors(){return this._colors}constructor(S){super(),this._optionsService=S,this._contrastCache=new d.ColorContrastCache,this._halfContrastCache=new d.ColorContrastCache,this._onChangeColors=this.register(new L.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:h,background:_,cursor:g,cursorAccent:p,selectionForeground:void 0,selectionBackgroundTransparent:T,selectionBackgroundOpaque:k.color.blend(_,T),selectionInactiveBackgroundTransparent:T,selectionInactiveBackgroundOpaque:k.color.blend(_,T),ansi:o.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(S={}){const x=this._colors;if(x.foreground=E(S.foreground,h),x.background=E(S.background,_),x.cursor=E(S.cursor,g),x.cursorAccent=E(S.cursorAccent,p),x.selectionBackgroundTransparent=E(S.selectionBackground,T),x.selectionBackgroundOpaque=k.color.blend(x.background,x.selectionBackgroundTransparent),x.selectionInactiveBackgroundTransparent=E(S.selectionInactiveBackground,x.selectionBackgroundTransparent),x.selectionInactiveBackgroundOpaque=k.color.blend(x.background,x.selectionInactiveBackgroundTransparent),x.selectionForeground=S.selectionForeground?E(S.selectionForeground,k.NULL_COLOR):void 0,x.selectionForeground===k.NULL_COLOR&&(x.selectionForeground=void 0),k.color.isOpaque(x.selectionBackgroundTransparent)&&(x.selectionBackgroundTransparent=k.color.opacity(x.selectionBackgroundTransparent,.3)),k.color.isOpaque(x.selectionInactiveBackgroundTransparent)&&(x.selectionInactiveBackgroundTransparent=k.color.opacity(x.selectionInactiveBackgroundTransparent,.3)),x.ansi=o.DEFAULT_ANSI_COLORS.slice(),x.ansi[0]=E(S.black,o.DEFAULT_ANSI_COLORS[0]),x.ansi[1]=E(S.red,o.DEFAULT_ANSI_COLORS[1]),x.ansi[2]=E(S.green,o.DEFAULT_ANSI_COLORS[2]),x.ansi[3]=E(S.yellow,o.DEFAULT_ANSI_COLORS[3]),x.ansi[4]=E(S.blue,o.DEFAULT_ANSI_COLORS[4]),x.ansi[5]=E(S.magenta,o.DEFAULT_ANSI_COLORS[5]),x.ansi[6]=E(S.cyan,o.DEFAULT_ANSI_COLORS[6]),x.ansi[7]=E(S.white,o.DEFAULT_ANSI_COLORS[7]),x.ansi[8]=E(S.brightBlack,o.DEFAULT_ANSI_COLORS[8]),x.ansi[9]=E(S.brightRed,o.DEFAULT_ANSI_COLORS[9]),x.ansi[10]=E(S.brightGreen,o.DEFAULT_ANSI_COLORS[10]),x.ansi[11]=E(S.brightYellow,o.DEFAULT_ANSI_COLORS[11]),x.ansi[12]=E(S.brightBlue,o.DEFAULT_ANSI_COLORS[12]),x.ansi[13]=E(S.brightMagenta,o.DEFAULT_ANSI_COLORS[13]),x.ansi[14]=E(S.brightCyan,o.DEFAULT_ANSI_COLORS[14]),x.ansi[15]=E(S.brightWhite,o.DEFAULT_ANSI_COLORS[15]),S.extendedAnsi){const R=Math.min(x.ansi.length-16,S.extendedAnsi.length);for(let I=0;I<R;I++)x.ansi[I+16]=E(S.extendedAnsi[I],o.DEFAULT_ANSI_COLORS[I+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(S){this._restoreColor(S),this._onChangeColors.fire(this.colors)}_restoreColor(S){if(S!==void 0)switch(S){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[S]=this._restoreColors.ansi[S]}else for(let x=0;x<this._restoreColors.ansi.length;++x)this._colors.ansi[x]=this._restoreColors.ansi[x]}modifyColors(S){S(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 E(S,x){if(S!==void 0)try{return k.css.toColor(S)}catch{}return x}o.ThemeService=A=m([w(0,b.IOptionsService)],A)},6349:(v,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CircularList=void 0;const m=c(8460),w=c(844);class d extends w.Disposable{constructor(L){super(),this._maxLength=L,this.onDeleteEmitter=this.register(new m.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new m.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new m.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(L){if(this._maxLength===L)return;const M=new Array(L);for(let b=0;b<Math.min(L,this.length);b++)M[b]=this._array[this._getCyclicIndex(b)];this._array=M,this._maxLength=L,this._startIndex=0}get length(){return this._length}set length(L){if(L>this._length)for(let M=this._length;M<L;M++)this._array[M]=void 0;this._length=L}get(L){return this._array[this._getCyclicIndex(L)]}set(L,M){this._array[this._getCyclicIndex(L)]=M}push(L){this._array[this._getCyclicIndex(this._length)]=L,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(L,M,...b){if(M){for(let h=L;h<this._length-M;h++)this._array[this._getCyclicIndex(h)]=this._array[this._getCyclicIndex(h+M)];this._length-=M,this.onDeleteEmitter.fire({index:L,amount:M})}for(let h=this._length-1;h>=L;h--)this._array[this._getCyclicIndex(h+b.length)]=this._array[this._getCyclicIndex(h)];for(let h=0;h<b.length;h++)this._array[this._getCyclicIndex(L+h)]=b[h];if(b.length&&this.onInsertEmitter.fire({index:L,amount:b.length}),this._length+b.length>this._maxLength){const h=this._length+b.length-this._maxLength;this._startIndex+=h,this._length=this._maxLength,this.onTrimEmitter.fire(h)}else this._length+=b.length}trimStart(L){L>this._length&&(L=this._length),this._startIndex+=L,this._length-=L,this.onTrimEmitter.fire(L)}shiftElements(L,M,b){if(!(M<=0)){if(L<0||L>=this._length)throw new Error("start argument out of range");if(L+b<0)throw new Error("Cannot shift elements in list beyond index 0");if(b>0){for(let _=M-1;_>=0;_--)this.set(L+_+b,this.get(L+_));const h=L+M+b-this._length;if(h>0)for(this._length+=h;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let h=0;h<M;h++)this.set(L+h+b,this.get(L+h))}}_getCyclicIndex(L){return(this._startIndex+L)%this._maxLength}}o.CircularList=d},1439:(v,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.clone=void 0,o.clone=function c(m,w=5){if(typeof m!="object")return m;const d=Array.isArray(m)?[]:{};for(const k in m)d[k]=w<=1?m[k]:m[k]&&c(m[k],w-1);return d}},8055:(v,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.contrastRatio=o.toPaddedHex=o.rgba=o.rgb=o.css=o.color=o.channels=o.NULL_COLOR=void 0;let c=0,m=0,w=0,d=0;var k,L,M,b,h;function _(p){const T=p.toString(16);return T.length<2?"0"+T:T}function g(p,T){return p<T?(T+.05)/(p+.05):(p+.05)/(T+.05)}o.NULL_COLOR={css:"#00000000",rgba:0},(function(p){p.toCss=function(T,A,E,S){return S!==void 0?`#${_(T)}${_(A)}${_(E)}${_(S)}`:`#${_(T)}${_(A)}${_(E)}`},p.toRgba=function(T,A,E,S=255){return(T<<24|A<<16|E<<8|S)>>>0},p.toColor=function(T,A,E,S){return{css:p.toCss(T,A,E,S),rgba:p.toRgba(T,A,E,S)}}})(k||(o.channels=k={})),(function(p){function T(A,E){return d=Math.round(255*E),[c,m,w]=h.toChannels(A.rgba),{css:k.toCss(c,m,w,d),rgba:k.toRgba(c,m,w,d)}}p.blend=function(A,E){if(d=(255&E.rgba)/255,d===1)return{css:E.css,rgba:E.rgba};const S=E.rgba>>24&255,x=E.rgba>>16&255,R=E.rgba>>8&255,I=A.rgba>>24&255,D=A.rgba>>16&255,P=A.rgba>>8&255;return c=I+Math.round((S-I)*d),m=D+Math.round((x-D)*d),w=P+Math.round((R-P)*d),{css:k.toCss(c,m,w),rgba:k.toRgba(c,m,w)}},p.isOpaque=function(A){return(255&A.rgba)==255},p.ensureContrastRatio=function(A,E,S){const x=h.ensureContrastRatio(A.rgba,E.rgba,S);if(x)return k.toColor(x>>24&255,x>>16&255,x>>8&255)},p.opaque=function(A){const E=(255|A.rgba)>>>0;return[c,m,w]=h.toChannels(E),{css:k.toCss(c,m,w),rgba:E}},p.opacity=T,p.multiplyOpacity=function(A,E){return d=255&A.rgba,T(A,d*E/255)},p.toColorRGB=function(A){return[A.rgba>>24&255,A.rgba>>16&255,A.rgba>>8&255]}})(L||(o.color=L={})),(function(p){let T,A;try{const E=document.createElement("canvas");E.width=1,E.height=1;const S=E.getContext("2d",{willReadFrequently:!0});S&&(T=S,T.globalCompositeOperation="copy",A=T.createLinearGradient(0,0,1,1))}catch{}p.toColor=function(E){if(E.match(/#[\da-f]{3,8}/i))switch(E.length){case 4:return c=parseInt(E.slice(1,2).repeat(2),16),m=parseInt(E.slice(2,3).repeat(2),16),w=parseInt(E.slice(3,4).repeat(2),16),k.toColor(c,m,w);case 5:return c=parseInt(E.slice(1,2).repeat(2),16),m=parseInt(E.slice(2,3).repeat(2),16),w=parseInt(E.slice(3,4).repeat(2),16),d=parseInt(E.slice(4,5).repeat(2),16),k.toColor(c,m,w,d);case 7:return{css:E,rgba:(parseInt(E.slice(1),16)<<8|255)>>>0};case 9:return{css:E,rgba:parseInt(E.slice(1),16)>>>0}}const S=E.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(S)return c=parseInt(S[1]),m=parseInt(S[2]),w=parseInt(S[3]),d=Math.round(255*(S[5]===void 0?1:parseFloat(S[5]))),k.toColor(c,m,w,d);if(!T||!A)throw new Error("css.toColor: Unsupported css format");if(T.fillStyle=A,T.fillStyle=E,typeof T.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(T.fillRect(0,0,1,1),[c,m,w,d]=T.getImageData(0,0,1,1).data,d!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:k.toRgba(c,m,w,d),css:E}}})(M||(o.css=M={})),(function(p){function T(A,E,S){const x=A/255,R=E/255,I=S/255;return .2126*(x<=.03928?x/12.92:Math.pow((x+.055)/1.055,2.4))+.7152*(R<=.03928?R/12.92:Math.pow((R+.055)/1.055,2.4))+.0722*(I<=.03928?I/12.92:Math.pow((I+.055)/1.055,2.4))}p.relativeLuminance=function(A){return T(A>>16&255,A>>8&255,255&A)},p.relativeLuminance2=T})(b||(o.rgb=b={})),(function(p){function T(E,S,x){const R=E>>24&255,I=E>>16&255,D=E>>8&255;let P=S>>24&255,F=S>>16&255,z=S>>8&255,q=g(b.relativeLuminance2(P,F,z),b.relativeLuminance2(R,I,D));for(;q<x&&(P>0||F>0||z>0);)P-=Math.max(0,Math.ceil(.1*P)),F-=Math.max(0,Math.ceil(.1*F)),z-=Math.max(0,Math.ceil(.1*z)),q=g(b.relativeLuminance2(P,F,z),b.relativeLuminance2(R,I,D));return(P<<24|F<<16|z<<8|255)>>>0}function A(E,S,x){const R=E>>24&255,I=E>>16&255,D=E>>8&255;let P=S>>24&255,F=S>>16&255,z=S>>8&255,q=g(b.relativeLuminance2(P,F,z),b.relativeLuminance2(R,I,D));for(;q<x&&(P<255||F<255||z<255);)P=Math.min(255,P+Math.ceil(.1*(255-P))),F=Math.min(255,F+Math.ceil(.1*(255-F))),z=Math.min(255,z+Math.ceil(.1*(255-z))),q=g(b.relativeLuminance2(P,F,z),b.relativeLuminance2(R,I,D));return(P<<24|F<<16|z<<8|255)>>>0}p.blend=function(E,S){if(d=(255&S)/255,d===1)return S;const x=S>>24&255,R=S>>16&255,I=S>>8&255,D=E>>24&255,P=E>>16&255,F=E>>8&255;return c=D+Math.round((x-D)*d),m=P+Math.round((R-P)*d),w=F+Math.round((I-F)*d),k.toRgba(c,m,w)},p.ensureContrastRatio=function(E,S,x){const R=b.relativeLuminance(E>>8),I=b.relativeLuminance(S>>8);if(g(R,I)<x){if(I<R){const F=T(E,S,x),z=g(R,b.relativeLuminance(F>>8));if(z<x){const q=A(E,S,x);return z>g(R,b.relativeLuminance(q>>8))?F:q}return F}const D=A(E,S,x),P=g(R,b.relativeLuminance(D>>8));if(P<x){const F=T(E,S,x);return P>g(R,b.relativeLuminance(F>>8))?D:F}return D}},p.reduceLuminance=T,p.increaseLuminance=A,p.toChannels=function(E){return[E>>24&255,E>>16&255,E>>8&255,255&E]}})(h||(o.rgba=h={})),o.toPaddedHex=_,o.contrastRatio=g},8969:(v,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CoreTerminal=void 0;const m=c(844),w=c(2585),d=c(4348),k=c(7866),L=c(744),M=c(7302),b=c(6975),h=c(8460),_=c(1753),g=c(1480),p=c(7994),T=c(9282),A=c(5435),E=c(5981),S=c(2660);let x=!1;class R extends m.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new h.EventEmitter),this._onScroll.event((D=>{var P;(P=this._onScrollApi)==null||P.fire(D.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(D){for(const P in D)this.optionsService.options[P]=D[P]}constructor(D){super(),this._windowsWrappingHeuristics=this.register(new m.MutableDisposable),this._onBinary=this.register(new h.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new h.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new h.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new h.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new h.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new h.EventEmitter),this._instantiationService=new d.InstantiationService,this.optionsService=this.register(new M.OptionsService(D)),this._instantiationService.setService(w.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(L.BufferService)),this._instantiationService.setService(w.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(k.LogService)),this._instantiationService.setService(w.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(b.CoreService)),this._instantiationService.setService(w.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(_.CoreMouseService)),this._instantiationService.setService(w.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(g.UnicodeService)),this._instantiationService.setService(w.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(p.CharsetService),this._instantiationService.setService(w.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(S.OscLinkService),this._instantiationService.setService(w.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new A.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,h.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,h.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,h.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,h.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((P=>{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((P=>{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 E.WriteBuffer(((P,F)=>this._inputHandler.parse(P,F)))),this.register((0,h.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(D,P){this._writeBuffer.write(D,P)}writeSync(D,P){this._logService.logLevel<=w.LogLevelEnum.WARN&&!x&&(this._logService.warn("writeSync is unreliable and will be removed soon."),x=!0),this._writeBuffer.writeSync(D,P)}input(D,P=!0){this.coreService.triggerDataEvent(D,P)}resize(D,P){isNaN(D)||isNaN(P)||(D=Math.max(D,L.MINIMUM_COLS),P=Math.max(P,L.MINIMUM_ROWS),this._bufferService.resize(D,P))}scroll(D,P=!1){this._bufferService.scroll(D,P)}scrollLines(D,P,F){this._bufferService.scrollLines(D,P,F)}scrollPages(D){this.scrollLines(D*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(D){const P=D-this._bufferService.buffer.ydisp;P!==0&&this.scrollLines(P)}registerEscHandler(D,P){return this._inputHandler.registerEscHandler(D,P)}registerDcsHandler(D,P){return this._inputHandler.registerDcsHandler(D,P)}registerCsiHandler(D,P){return this._inputHandler.registerCsiHandler(D,P)}registerOscHandler(D,P){return this._inputHandler.registerOscHandler(D,P)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let D=!1;const P=this.optionsService.rawOptions.windowsPty;P&&P.buildNumber!==void 0&&P.buildNumber!==void 0?D=P.backend==="conpty"&&P.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(D=!0),D?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const D=[];D.push(this.onLineFeed(T.updateWindowsModeWrappedState.bind(null,this._bufferService))),D.push(this.registerCsiHandler({final:"H"},(()=>((0,T.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,m.toDisposable)((()=>{for(const P of D)P.dispose()}))}}}o.CoreTerminal=R},8460:(v,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.runAndSubscribe=o.forwardEvent=o.EventEmitter=void 0,o.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=c=>(this._listeners.push(c),{dispose:()=>{if(!this._disposed){for(let m=0;m<this._listeners.length;m++)if(this._listeners[m]===c)return void this._listeners.splice(m,1)}}})),this._event}fire(c,m){const w=[];for(let d=0;d<this._listeners.length;d++)w.push(this._listeners[d]);for(let d=0;d<w.length;d++)w[d].call(void 0,c,m)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},o.forwardEvent=function(c,m){return c((w=>m.fire(w)))},o.runAndSubscribe=function(c,m){return m(void 0),c((w=>m(w)))}},5435:function(v,o,c){var m=this&&this.__decorate||function(W,O,U,H){var $,Z=arguments.length,re=Z<3?O:H===null?H=Object.getOwnPropertyDescriptor(O,U):H;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")re=Reflect.decorate(W,O,U,H);else for(var we=W.length-1;we>=0;we--)($=W[we])&&(re=(Z<3?$(re):Z>3?$(O,U,re):$(O,U))||re);return Z>3&&re&&Object.defineProperty(O,U,re),re},w=this&&this.__param||function(W,O){return function(U,H){O(U,H,W)}};Object.defineProperty(o,"__esModule",{value:!0}),o.InputHandler=o.WindowsOptionsReportType=void 0;const d=c(2584),k=c(7116),L=c(2015),M=c(844),b=c(482),h=c(8437),_=c(8460),g=c(643),p=c(511),T=c(3734),A=c(2585),E=c(1480),S=c(6242),x=c(6351),R=c(5941),I={"(":0,")":1,"*":2,"+":3,"-":1,".":2},D=131072;function P(W,O){if(W>24)return O.setWinLines||!1;switch(W){case 1:return!!O.restoreWin;case 2:return!!O.minimizeWin;case 3:return!!O.setWinPosition;case 4:return!!O.setWinSizePixels;case 5:return!!O.raiseWin;case 6:return!!O.lowerWin;case 7:return!!O.refreshWin;case 8:return!!O.setWinSizeChars;case 9:return!!O.maximizeWin;case 10:return!!O.fullscreenWin;case 11:return!!O.getWinState;case 13:return!!O.getWinPosition;case 14:return!!O.getWinSizePixels;case 15:return!!O.getScreenSizePixels;case 16:return!!O.getCellSizePixels;case 18:return!!O.getWinSizeChars;case 19:return!!O.getScreenSizeChars;case 20:return!!O.getIconTitle;case 21:return!!O.getWinTitle;case 22:return!!O.pushTitle;case 23:return!!O.popTitle;case 24:return!!O.setWinLines}return!1}var F;(function(W){W[W.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",W[W.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(F||(o.WindowsOptionsReportType=F={}));let z=0;class q extends M.Disposable{getAttrData(){return this._curAttrData}constructor(O,U,H,$,Z,re,we,_e,Q=new L.EscapeSequenceParser){super(),this._bufferService=O,this._charsetService=U,this._coreService=H,this._logService=$,this._optionsService=Z,this._oscLinkService=re,this._coreMouseService=we,this._unicodeService=_e,this._parser=Q,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new b.StringToUtf32,this._utf8Decoder=new b.Utf8ToUtf32,this._workCell=new p.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=h.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=h.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new _.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new _.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new _.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new _.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new _.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new _.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new _.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new _.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new _.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new _.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new _.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new _.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new _.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new K(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((Y=>this._activeBuffer=Y.activeBuffer))),this._parser.setCsiHandlerFallback(((Y,te)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(Y),params:te.toArray()})})),this._parser.setEscHandlerFallback((Y=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(Y)})})),this._parser.setExecuteHandlerFallback((Y=>{this._logService.debug("Unknown EXECUTE code: ",{code:Y})})),this._parser.setOscHandlerFallback(((Y,te,ee)=>{this._logService.debug("Unknown OSC code: ",{identifier:Y,action:te,data:ee})})),this._parser.setDcsHandlerFallback(((Y,te,ee)=>{te==="HOOK"&&(ee=ee.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(Y),action:te,payload:ee})})),this._parser.setPrintHandler(((Y,te,ee)=>this.print(Y,te,ee))),this._parser.registerCsiHandler({final:"@"},(Y=>this.insertChars(Y))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(Y=>this.scrollLeft(Y))),this._parser.registerCsiHandler({final:"A"},(Y=>this.cursorUp(Y))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(Y=>this.scrollRight(Y))),this._parser.registerCsiHandler({final:"B"},(Y=>this.cursorDown(Y))),this._parser.registerCsiHandler({final:"C"},(Y=>this.cursorForward(Y))),this._parser.registerCsiHandler({final:"D"},(Y=>this.cursorBackward(Y))),this._parser.registerCsiHandler({final:"E"},(Y=>this.cursorNextLine(Y))),this._parser.registerCsiHandler({final:"F"},(Y=>this.cursorPrecedingLine(Y))),this._parser.registerCsiHandler({final:"G"},(Y=>this.cursorCharAbsolute(Y))),this._parser.registerCsiHandler({final:"H"},(Y=>this.cursorPosition(Y))),this._parser.registerCsiHandler({final:"I"},(Y=>this.cursorForwardTab(Y))),this._parser.registerCsiHandler({final:"J"},(Y=>this.eraseInDisplay(Y,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(Y=>this.eraseInDisplay(Y,!0))),this._parser.registerCsiHandler({final:"K"},(Y=>this.eraseInLine(Y,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(Y=>this.eraseInLine(Y,!0))),this._parser.registerCsiHandler({final:"L"},(Y=>this.insertLines(Y))),this._parser.registerCsiHandler({final:"M"},(Y=>this.deleteLines(Y))),this._parser.registerCsiHandler({final:"P"},(Y=>this.deleteChars(Y))),this._parser.registerCsiHandler({final:"S"},(Y=>this.scrollUp(Y))),this._parser.registerCsiHandler({final:"T"},(Y=>this.scrollDown(Y))),this._parser.registerCsiHandler({final:"X"},(Y=>this.eraseChars(Y))),this._parser.registerCsiHandler({final:"Z"},(Y=>this.cursorBackwardTab(Y))),this._parser.registerCsiHandler({final:"`"},(Y=>this.charPosAbsolute(Y))),this._parser.registerCsiHandler({final:"a"},(Y=>this.hPositionRelative(Y))),this._parser.registerCsiHandler({final:"b"},(Y=>this.repeatPrecedingCharacter(Y))),this._parser.registerCsiHandler({final:"c"},(Y=>this.sendDeviceAttributesPrimary(Y))),this._parser.registerCsiHandler({prefix:">",final:"c"},(Y=>this.sendDeviceAttributesSecondary(Y))),this._parser.registerCsiHandler({final:"d"},(Y=>this.linePosAbsolute(Y))),this._parser.registerCsiHandler({final:"e"},(Y=>this.vPositionRelative(Y))),this._parser.registerCsiHandler({final:"f"},(Y=>this.hVPosition(Y))),this._parser.registerCsiHandler({final:"g"},(Y=>this.tabClear(Y))),this._parser.registerCsiHandler({final:"h"},(Y=>this.setMode(Y))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(Y=>this.setModePrivate(Y))),this._parser.registerCsiHandler({final:"l"},(Y=>this.resetMode(Y))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(Y=>this.resetModePrivate(Y))),this._parser.registerCsiHandler({final:"m"},(Y=>this.charAttributes(Y))),this._parser.registerCsiHandler({final:"n"},(Y=>this.deviceStatus(Y))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(Y=>this.deviceStatusPrivate(Y))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(Y=>this.softReset(Y))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(Y=>this.setCursorStyle(Y))),this._parser.registerCsiHandler({final:"r"},(Y=>this.setScrollRegion(Y))),this._parser.registerCsiHandler({final:"s"},(Y=>this.saveCursor(Y))),this._parser.registerCsiHandler({final:"t"},(Y=>this.windowOptions(Y))),this._parser.registerCsiHandler({final:"u"},(Y=>this.restoreCursor(Y))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(Y=>this.insertColumns(Y))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(Y=>this.deleteColumns(Y))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(Y=>this.selectProtected(Y))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(Y=>this.requestMode(Y,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(Y=>this.requestMode(Y,!1))),this._parser.setExecuteHandler(d.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(d.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(d.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(d.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(d.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(d.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(d.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(d.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(d.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(d.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(d.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(d.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new S.OscHandler((Y=>(this.setTitle(Y),this.setIconName(Y),!0)))),this._parser.registerOscHandler(1,new S.OscHandler((Y=>this.setIconName(Y)))),this._parser.registerOscHandler(2,new S.OscHandler((Y=>this.setTitle(Y)))),this._parser.registerOscHandler(4,new S.OscHandler((Y=>this.setOrReportIndexedColor(Y)))),this._parser.registerOscHandler(8,new S.OscHandler((Y=>this.setHyperlink(Y)))),this._parser.registerOscHandler(10,new S.OscHandler((Y=>this.setOrReportFgColor(Y)))),this._parser.registerOscHandler(11,new S.OscHandler((Y=>this.setOrReportBgColor(Y)))),this._parser.registerOscHandler(12,new S.OscHandler((Y=>this.setOrReportCursorColor(Y)))),this._parser.registerOscHandler(104,new S.OscHandler((Y=>this.restoreIndexedColor(Y)))),this._parser.registerOscHandler(110,new S.OscHandler((Y=>this.restoreFgColor(Y)))),this._parser.registerOscHandler(111,new S.OscHandler((Y=>this.restoreBgColor(Y)))),this._parser.registerOscHandler(112,new S.OscHandler((Y=>this.restoreCursorColor(Y)))),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 Y in k.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:Y},(()=>this.selectCharset("("+Y))),this._parser.registerEscHandler({intermediates:")",final:Y},(()=>this.selectCharset(")"+Y))),this._parser.registerEscHandler({intermediates:"*",final:Y},(()=>this.selectCharset("*"+Y))),this._parser.registerEscHandler({intermediates:"+",final:Y},(()=>this.selectCharset("+"+Y))),this._parser.registerEscHandler({intermediates:"-",final:Y},(()=>this.selectCharset("-"+Y))),this._parser.registerEscHandler({intermediates:".",final:Y},(()=>this.selectCharset("."+Y))),this._parser.registerEscHandler({intermediates:"/",final:Y},(()=>this.selectCharset("/"+Y)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((Y=>(this._logService.error("Parsing error: ",Y),Y))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new x.DcsHandler(((Y,te)=>this.requestStatusString(Y,te))))}_preserveStack(O,U,H,$){this._parseStack.paused=!0,this._parseStack.cursorStartX=O,this._parseStack.cursorStartY=U,this._parseStack.decodedLength=H,this._parseStack.position=$}_logSlowResolvingAsync(O){this._logService.logLevel<=A.LogLevelEnum.WARN&&Promise.race([O,new Promise(((U,H)=>setTimeout((()=>H("#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(O,U){let H,$=this._activeBuffer.x,Z=this._activeBuffer.y,re=0;const we=this._parseStack.paused;if(we){if(H=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,U))return this._logSlowResolvingAsync(H),H;$=this._parseStack.cursorStartX,Z=this._parseStack.cursorStartY,this._parseStack.paused=!1,O.length>D&&(re=this._parseStack.position+D)}if(this._logService.logLevel<=A.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof O=="string"?` "${O}"`:` "${Array.prototype.map.call(O,(Y=>String.fromCharCode(Y))).join("")}"`),typeof O=="string"?O.split("").map((Y=>Y.charCodeAt(0))):O),this._parseBuffer.length<O.length&&this._parseBuffer.length<D&&(this._parseBuffer=new Uint32Array(Math.min(O.length,D))),we||this._dirtyRowTracker.clearRange(),O.length>D)for(let Y=re;Y<O.length;Y+=D){const te=Y+D<O.length?Y+D:O.length,ee=typeof O=="string"?this._stringDecoder.decode(O.substring(Y,te),this._parseBuffer):this._utf8Decoder.decode(O.subarray(Y,te),this._parseBuffer);if(H=this._parser.parse(this._parseBuffer,ee))return this._preserveStack($,Z,ee,Y),this._logSlowResolvingAsync(H),H}else if(!we){const Y=typeof O=="string"?this._stringDecoder.decode(O,this._parseBuffer):this._utf8Decoder.decode(O,this._parseBuffer);if(H=this._parser.parse(this._parseBuffer,Y))return this._preserveStack($,Z,Y,0),this._logSlowResolvingAsync(H),H}this._activeBuffer.x===$&&this._activeBuffer.y===Z||this._onCursorMove.fire();const _e=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),Q=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);Q<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(Q,this._bufferService.rows-1),Math.min(_e,this._bufferService.rows-1))}print(O,U,H){let $,Z;const re=this._charsetService.charset,we=this._optionsService.rawOptions.screenReaderMode,_e=this._bufferService.cols,Q=this._coreService.decPrivateModes.wraparound,Y=this._coreService.modes.insertMode,te=this._curAttrData;let ee=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&H-U>0&&ee.getWidth(this._activeBuffer.x-1)===2&&ee.setCellFromCodepoint(this._activeBuffer.x-1,0,1,te);let ye=this._parser.precedingJoinState;for(let ge=U;ge<H;++ge){if($=O[ge],$<127&&re){const gt=re[String.fromCharCode($)];gt&&($=gt.charCodeAt(0))}const Be=this._unicodeService.charProperties($,ye);Z=E.UnicodeService.extractWidth(Be);const Ue=E.UnicodeService.extractShouldJoin(Be),ze=Ue?E.UnicodeService.extractWidth(ye):0;if(ye=Be,we&&this._onA11yChar.fire((0,b.stringFromCodePoint)($)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+Z-ze>_e){if(Q){const gt=ee;let Fe=this._activeBuffer.x-ze;for(this._activeBuffer.x=ze,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),ze>0&&ee instanceof h.BufferLine&&ee.copyCellsFrom(gt,Fe,0,ze,!1);Fe<_e;)gt.setCellFromCodepoint(Fe++,0,1,te)}else if(this._activeBuffer.x=_e-1,Z===2)continue}if(Ue&&this._activeBuffer.x){const gt=ee.getWidth(this._activeBuffer.x-1)?1:2;ee.addCodepointToCell(this._activeBuffer.x-gt,$,Z);for(let Fe=Z-ze;--Fe>=0;)ee.setCellFromCodepoint(this._activeBuffer.x++,0,0,te)}else if(Y&&(ee.insertCells(this._activeBuffer.x,Z-ze,this._activeBuffer.getNullCell(te)),ee.getWidth(_e-1)===2&&ee.setCellFromCodepoint(_e-1,g.NULL_CELL_CODE,g.NULL_CELL_WIDTH,te)),ee.setCellFromCodepoint(this._activeBuffer.x++,$,Z,te),Z>0)for(;--Z;)ee.setCellFromCodepoint(this._activeBuffer.x++,0,0,te)}this._parser.precedingJoinState=ye,this._activeBuffer.x<_e&&H-U>0&&ee.getWidth(this._activeBuffer.x)===0&&!ee.hasContent(this._activeBuffer.x)&&ee.setCellFromCodepoint(this._activeBuffer.x,0,1,te),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(O,U){return O.final!=="t"||O.prefix||O.intermediates?this._parser.registerCsiHandler(O,U):this._parser.registerCsiHandler(O,(H=>!P(H.params[0],this._optionsService.rawOptions.windowOptions)||U(H)))}registerDcsHandler(O,U){return this._parser.registerDcsHandler(O,new x.DcsHandler(U))}registerEscHandler(O,U){return this._parser.registerEscHandler(O,U)}registerOscHandler(O,U){return this._parser.registerOscHandler(O,new S.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 O;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&&((O=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&O.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 O=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-O),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(O=this._bufferService.cols-1){this._activeBuffer.x=Math.min(O,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(O,U){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=O,this._activeBuffer.y=this._activeBuffer.scrollTop+U):(this._activeBuffer.x=O,this._activeBuffer.y=U),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(O,U){this._restrictCursor(),this._setCursor(this._activeBuffer.x+O,this._activeBuffer.y+U)}cursorUp(O){const U=this._activeBuffer.y-this._activeBuffer.scrollTop;return U>=0?this._moveCursor(0,-Math.min(U,O.params[0]||1)):this._moveCursor(0,-(O.params[0]||1)),!0}cursorDown(O){const U=this._activeBuffer.scrollBottom-this._activeBuffer.y;return U>=0?this._moveCursor(0,Math.min(U,O.params[0]||1)):this._moveCursor(0,O.params[0]||1),!0}cursorForward(O){return this._moveCursor(O.params[0]||1,0),!0}cursorBackward(O){return this._moveCursor(-(O.params[0]||1),0),!0}cursorNextLine(O){return this.cursorDown(O),this._activeBuffer.x=0,!0}cursorPrecedingLine(O){return this.cursorUp(O),this._activeBuffer.x=0,!0}cursorCharAbsolute(O){return this._setCursor((O.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(O){return this._setCursor(O.length>=2?(O.params[1]||1)-1:0,(O.params[0]||1)-1),!0}charPosAbsolute(O){return this._setCursor((O.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(O){return this._moveCursor(O.params[0]||1,0),!0}linePosAbsolute(O){return this._setCursor(this._activeBuffer.x,(O.params[0]||1)-1),!0}vPositionRelative(O){return this._moveCursor(0,O.params[0]||1),!0}hVPosition(O){return this.cursorPosition(O),!0}tabClear(O){const U=O.params[0];return U===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:U===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(O){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let U=O.params[0]||1;for(;U--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(O){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let U=O.params[0]||1;for(;U--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(O){const U=O.params[0];return U===1&&(this._curAttrData.bg|=536870912),U!==2&&U!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(O,U,H,$=!1,Z=!1){const re=this._activeBuffer.lines.get(this._activeBuffer.ybase+O);re.replaceCells(U,H,this._activeBuffer.getNullCell(this._eraseAttrData()),Z),$&&(re.isWrapped=!1)}_resetBufferLine(O,U=!1){const H=this._activeBuffer.lines.get(this._activeBuffer.ybase+O);H&&(H.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),U),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+O),H.isWrapped=!1)}eraseInDisplay(O,U=!1){let H;switch(this._restrictCursor(this._bufferService.cols),O.params[0]){case 0:for(H=this._activeBuffer.y,this._dirtyRowTracker.markDirty(H),this._eraseInBufferLine(H++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,U);H<this._bufferService.rows;H++)this._resetBufferLine(H,U);this._dirtyRowTracker.markDirty(H);break;case 1:for(H=this._activeBuffer.y,this._dirtyRowTracker.markDirty(H),this._eraseInBufferLine(H,0,this._activeBuffer.x+1,!0,U),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(H+1).isWrapped=!1);H--;)this._resetBufferLine(H,U);this._dirtyRowTracker.markDirty(0);break;case 2:for(H=this._bufferService.rows,this._dirtyRowTracker.markDirty(H-1);H--;)this._resetBufferLine(H,U);this._dirtyRowTracker.markDirty(0);break;case 3:const $=this._activeBuffer.lines.length-this._bufferService.rows;$>0&&(this._activeBuffer.lines.trimStart($),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-$,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-$,0),this._onScroll.fire(0))}return!0}eraseInLine(O,U=!1){switch(this._restrictCursor(this._bufferService.cols),O.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(O){this._restrictCursor();let U=O.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const H=this._activeBuffer.ybase+this._activeBuffer.y,$=this._bufferService.rows-1-this._activeBuffer.scrollBottom,Z=this._bufferService.rows-1+this._activeBuffer.ybase-$+1;for(;U--;)this._activeBuffer.lines.splice(Z-1,1),this._activeBuffer.lines.splice(H,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(O){this._restrictCursor();let U=O.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const H=this._activeBuffer.ybase+this._activeBuffer.y;let $;for($=this._bufferService.rows-1-this._activeBuffer.scrollBottom,$=this._bufferService.rows-1+this._activeBuffer.ybase-$;U--;)this._activeBuffer.lines.splice(H,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}insertChars(O){this._restrictCursor();const U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return U&&(U.insertCells(this._activeBuffer.x,O.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(O){this._restrictCursor();const U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return U&&(U.deleteCells(this._activeBuffer.x,O.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(O){let U=O.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(O){let U=O.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(h.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(O){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const U=O.params[0]||1;for(let H=this._activeBuffer.scrollTop;H<=this._activeBuffer.scrollBottom;++H){const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+H);$.deleteCells(0,U,this._activeBuffer.getNullCell(this._eraseAttrData())),$.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(O){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const U=O.params[0]||1;for(let H=this._activeBuffer.scrollTop;H<=this._activeBuffer.scrollBottom;++H){const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+H);$.insertCells(0,U,this._activeBuffer.getNullCell(this._eraseAttrData())),$.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(O){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const U=O.params[0]||1;for(let H=this._activeBuffer.scrollTop;H<=this._activeBuffer.scrollBottom;++H){const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+H);$.insertCells(this._activeBuffer.x,U,this._activeBuffer.getNullCell(this._eraseAttrData())),$.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(O){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const U=O.params[0]||1;for(let H=this._activeBuffer.scrollTop;H<=this._activeBuffer.scrollBottom;++H){const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+H);$.deleteCells(this._activeBuffer.x,U,this._activeBuffer.getNullCell(this._eraseAttrData())),$.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(O){this._restrictCursor();const U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return U&&(U.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(O.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(O){const U=this._parser.precedingJoinState;if(!U)return!0;const H=O.params[0]||1,$=E.UnicodeService.extractWidth(U),Z=this._activeBuffer.x-$,re=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(Z),we=new Uint32Array(re.length*H);let _e=0;for(let Y=0;Y<re.length;){const te=re.codePointAt(Y)||0;we[_e++]=te,Y+=te>65535?2:1}let Q=_e;for(let Y=1;Y<H;++Y)we.copyWithin(Q,0,_e),Q+=_e;return this.print(we,0,Q),!0}sendDeviceAttributesPrimary(O){return O.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(d.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(d.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(O){return O.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(d.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(d.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(O.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(d.C0.ESC+"[>83;40003;0c")),!0}_is(O){return(this._optionsService.rawOptions.termName+"").indexOf(O)===0}setMode(O){for(let U=0;U<O.length;U++)switch(O.params[U]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(O){for(let U=0;U<O.length;U++)switch(O.params[U]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,k.DEFAULT_CHARSET),this._charsetService.setgCharset(1,k.DEFAULT_CHARSET),this._charsetService.setgCharset(2,k.DEFAULT_CHARSET),this._charsetService.setgCharset(3,k.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(O){for(let U=0;U<O.length;U++)switch(O.params[U]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(O){for(let U=0;U<O.length;U++)switch(O.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(),O.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(O,U){const H=this._coreService.decPrivateModes,{activeProtocol:$,activeEncoding:Z}=this._coreMouseService,re=this._coreService,{buffers:we,cols:_e}=this._bufferService,{active:Q,alt:Y}=we,te=this._optionsService.rawOptions,ee=Ue=>Ue?1:2,ye=O.params[0];return ge=ye,Be=U?ye===2?4:ye===4?ee(re.modes.insertMode):ye===12?3:ye===20?ee(te.convertEol):0:ye===1?ee(H.applicationCursorKeys):ye===3?te.windowOptions.setWinLines?_e===80?2:_e===132?1:0:0:ye===6?ee(H.origin):ye===7?ee(H.wraparound):ye===8?3:ye===9?ee($==="X10"):ye===12?ee(te.cursorBlink):ye===25?ee(!re.isCursorHidden):ye===45?ee(H.reverseWraparound):ye===66?ee(H.applicationKeypad):ye===67?4:ye===1e3?ee($==="VT200"):ye===1002?ee($==="DRAG"):ye===1003?ee($==="ANY"):ye===1004?ee(H.sendFocus):ye===1005?4:ye===1006?ee(Z==="SGR"):ye===1015?4:ye===1016?ee(Z==="SGR_PIXELS"):ye===1048?1:ye===47||ye===1047||ye===1049?ee(Q===Y):ye===2004?ee(H.bracketedPasteMode):0,re.triggerDataEvent(`${d.C0.ESC}[${U?"":"?"}${ge};${Be}$y`),!0;var ge,Be}_updateAttrColor(O,U,H,$,Z){return U===2?(O|=50331648,O&=-16777216,O|=T.AttributeData.fromColorRGB([H,$,Z])):U===5&&(O&=-50331904,O|=33554432|255&H),O}_extractColor(O,U,H){const $=[0,0,-1,0,0,0];let Z=0,re=0;do{if($[re+Z]=O.params[U+re],O.hasSubParams(U+re)){const we=O.getSubParams(U+re);let _e=0;do $[1]===5&&(Z=1),$[re+_e+1+Z]=we[_e];while(++_e<we.length&&_e+re+1+Z<$.length);break}if($[1]===5&&re+Z>=2||$[1]===2&&re+Z>=5)break;$[1]&&(Z=1)}while(++re+U<O.length&&re+Z<$.length);for(let we=2;we<$.length;++we)$[we]===-1&&($[we]=0);switch($[0]){case 38:H.fg=this._updateAttrColor(H.fg,$[1],$[3],$[4],$[5]);break;case 48:H.bg=this._updateAttrColor(H.bg,$[1],$[3],$[4],$[5]);break;case 58:H.extended=H.extended.clone(),H.extended.underlineColor=this._updateAttrColor(H.extended.underlineColor,$[1],$[3],$[4],$[5])}return re}_processUnderline(O,U){U.extended=U.extended.clone(),(!~O||O>5)&&(O=1),U.extended.underlineStyle=O,U.fg|=268435456,O===0&&(U.fg&=-268435457),U.updateExtended()}_processSGR0(O){O.fg=h.DEFAULT_ATTR_DATA.fg,O.bg=h.DEFAULT_ATTR_DATA.bg,O.extended=O.extended.clone(),O.extended.underlineStyle=0,O.extended.underlineColor&=-67108864,O.updateExtended()}charAttributes(O){if(O.length===1&&O.params[0]===0)return this._processSGR0(this._curAttrData),!0;const U=O.length;let H;const $=this._curAttrData;for(let Z=0;Z<U;Z++)H=O.params[Z],H>=30&&H<=37?($.fg&=-50331904,$.fg|=16777216|H-30):H>=40&&H<=47?($.bg&=-50331904,$.bg|=16777216|H-40):H>=90&&H<=97?($.fg&=-50331904,$.fg|=16777224|H-90):H>=100&&H<=107?($.bg&=-50331904,$.bg|=16777224|H-100):H===0?this._processSGR0($):H===1?$.fg|=134217728:H===3?$.bg|=67108864:H===4?($.fg|=268435456,this._processUnderline(O.hasSubParams(Z)?O.getSubParams(Z)[0]:1,$)):H===5?$.fg|=536870912:H===7?$.fg|=67108864:H===8?$.fg|=1073741824:H===9?$.fg|=2147483648:H===2?$.bg|=134217728:H===21?this._processUnderline(2,$):H===22?($.fg&=-134217729,$.bg&=-134217729):H===23?$.bg&=-67108865:H===24?($.fg&=-268435457,this._processUnderline(0,$)):H===25?$.fg&=-536870913:H===27?$.fg&=-67108865:H===28?$.fg&=-1073741825:H===29?$.fg&=2147483647:H===39?($.fg&=-67108864,$.fg|=16777215&h.DEFAULT_ATTR_DATA.fg):H===49?($.bg&=-67108864,$.bg|=16777215&h.DEFAULT_ATTR_DATA.bg):H===38||H===48||H===58?Z+=this._extractColor(O,Z,$):H===53?$.bg|=1073741824:H===55?$.bg&=-1073741825:H===59?($.extended=$.extended.clone(),$.extended.underlineColor=-1,$.updateExtended()):H===100?($.fg&=-67108864,$.fg|=16777215&h.DEFAULT_ATTR_DATA.fg,$.bg&=-67108864,$.bg|=16777215&h.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",H);return!0}deviceStatus(O){switch(O.params[0]){case 5:this._coreService.triggerDataEvent(`${d.C0.ESC}[0n`);break;case 6:const U=this._activeBuffer.y+1,H=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${d.C0.ESC}[${U};${H}R`)}return!0}deviceStatusPrivate(O){if(O.params[0]===6){const U=this._activeBuffer.y+1,H=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${d.C0.ESC}[?${U};${H}R`)}return!0}softReset(O){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=h.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(O){const U=O.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 H=U%2==1;return this._optionsService.options.cursorBlink=H,!0}setScrollRegion(O){const U=O.params[0]||1;let H;return(O.length<2||(H=O.params[1])>this._bufferService.rows||H===0)&&(H=this._bufferService.rows),H>U&&(this._activeBuffer.scrollTop=U-1,this._activeBuffer.scrollBottom=H-1,this._setCursor(0,0)),!0}windowOptions(O){if(!P(O.params[0],this._optionsService.rawOptions.windowOptions))return!0;const U=O.length>1?O.params[1]:0;switch(O.params[0]){case 14:U!==2&&this._onRequestWindowsOptionsReport.fire(F.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(F.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${d.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(O){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(O){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(O){return this._windowTitle=O,this._onTitleChange.fire(O),!0}setIconName(O){return this._iconName=O,!0}setOrReportIndexedColor(O){const U=[],H=O.split(";");for(;H.length>1;){const $=H.shift(),Z=H.shift();if(/^\d+$/.exec($)){const re=parseInt($);if(V(re))if(Z==="?")U.push({type:0,index:re});else{const we=(0,R.parseColor)(Z);we&&U.push({type:1,index:re,color:we})}}}return U.length&&this._onColor.fire(U),!0}setHyperlink(O){const U=O.split(";");return!(U.length<2)&&(U[1]?this._createHyperlink(U[0],U[1]):!U[0]&&this._finishHyperlink())}_createHyperlink(O,U){this._getCurrentLinkId()&&this._finishHyperlink();const H=O.split(":");let $;const Z=H.findIndex((re=>re.startsWith("id=")));return Z!==-1&&($=H[Z].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:$,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(O,U){const H=O.split(";");for(let $=0;$<H.length&&!(U>=this._specialColors.length);++$,++U)if(H[$]==="?")this._onColor.fire([{type:0,index:this._specialColors[U]}]);else{const Z=(0,R.parseColor)(H[$]);Z&&this._onColor.fire([{type:1,index:this._specialColors[U],color:Z}])}return!0}setOrReportFgColor(O){return this._setOrReportSpecialColor(O,0)}setOrReportBgColor(O){return this._setOrReportSpecialColor(O,1)}setOrReportCursorColor(O){return this._setOrReportSpecialColor(O,2)}restoreIndexedColor(O){if(!O)return this._onColor.fire([{type:2}]),!0;const U=[],H=O.split(";");for(let $=0;$<H.length;++$)if(/^\d+$/.exec(H[$])){const Z=parseInt(H[$]);V(Z)&&U.push({type:2,index:Z})}return U.length&&this._onColor.fire(U),!0}restoreFgColor(O){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(O){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(O){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,k.DEFAULT_CHARSET),!0}selectCharset(O){return O.length!==2?(this.selectDefaultCharset(),!0):(O[0]==="/"||this._charsetService.setgCharset(I[O[0]],k.CHARSETS[O[1]]||k.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 O=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,O,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=h.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=h.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(O){return this._charsetService.setgLevel(O),!0}screenAlignmentPattern(){const O=new p.CellData;O.content=4194373,O.fg=this._curAttrData.fg,O.bg=this._curAttrData.bg,this._setCursor(0,0);for(let U=0;U<this._bufferService.rows;++U){const H=this._activeBuffer.ybase+this._activeBuffer.y+U,$=this._activeBuffer.lines.get(H);$&&($.fill(O),$.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(O,U){const H=this._bufferService.buffer,$=this._optionsService.rawOptions;return(Z=>(this._coreService.triggerDataEvent(`${d.C0.ESC}${Z}${d.C0.ESC}\\`),!0))(O==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:O==='"p'?'P1$r61;1"p':O==="r"?`P1$r${H.scrollTop+1};${H.scrollBottom+1}r`:O==="m"?"P1$r0m":O===" q"?`P1$r${{block:2,underline:4,bar:6}[$.cursorStyle]-($.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(O,U){this._dirtyRowTracker.markRangeDirty(O,U)}}o.InputHandler=q;let K=class{constructor(W){this._bufferService=W,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(W){W<this.start?this.start=W:W>this.end&&(this.end=W)}markRangeDirty(W,O){W>O&&(z=W,W=O,O=z),W<this.start&&(this.start=W),O>this.end&&(this.end=O)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function V(W){return 0<=W&&W<256}K=m([w(0,A.IBufferService)],K)},844:(v,o)=>{function c(m){for(const w of m)w.dispose();m.length=0}Object.defineProperty(o,"__esModule",{value:!0}),o.getDisposeArrayDisposable=o.disposeArray=o.toDisposable=o.MutableDisposable=o.Disposable=void 0,o.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const m of this._disposables)m.dispose();this._disposables.length=0}register(m){return this._disposables.push(m),m}unregister(m){const w=this._disposables.indexOf(m);w!==-1&&this._disposables.splice(w,1)}},o.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(m){var w;this._isDisposed||m===this._value||((w=this._value)==null||w.dispose(),this._value=m)}clear(){this.value=void 0}dispose(){var m;this._isDisposed=!0,(m=this._value)==null||m.dispose(),this._value=void 0}},o.toDisposable=function(m){return{dispose:m}},o.disposeArray=c,o.getDisposeArrayDisposable=function(m){return{dispose:()=>c(m)}}},1505:(v,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.FourKeyMap=o.TwoKeyMap=void 0;class c{constructor(){this._data={}}set(w,d,k){this._data[w]||(this._data[w]={}),this._data[w][d]=k}get(w,d){return this._data[w]?this._data[w][d]:void 0}clear(){this._data={}}}o.TwoKeyMap=c,o.FourKeyMap=class{constructor(){this._data=new c}set(m,w,d,k,L){this._data.get(m,w)||this._data.set(m,w,new c),this._data.get(m,w).set(d,k,L)}get(m,w,d,k){var L;return(L=this._data.get(m,w))==null?void 0:L.get(d,k)}clear(){this._data.clear()}}},6114:(v,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.isChromeOS=o.isLinux=o.isWindows=o.isIphone=o.isIpad=o.isMac=o.getSafariVersion=o.isSafari=o.isLegacyEdge=o.isFirefox=o.isNode=void 0,o.isNode=typeof process<"u"&&"title"in process;const c=o.isNode?"node":navigator.userAgent,m=o.isNode?"node":navigator.platform;o.isFirefox=c.includes("Firefox"),o.isLegacyEdge=c.includes("Edge"),o.isSafari=/^((?!chrome|android).)*safari/i.test(c),o.getSafariVersion=function(){if(!o.isSafari)return 0;const w=c.match(/Version\/(\d+)/);return w===null||w.length<2?0:parseInt(w[1])},o.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(m),o.isIpad=m==="iPad",o.isIphone=m==="iPhone",o.isWindows=["Windows","Win16","Win32","WinCE"].includes(m),o.isLinux=m.indexOf("Linux")>=0,o.isChromeOS=/\bCrOS\b/.test(c)},6106:(v,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.SortedList=void 0;let c=0;o.SortedList=class{constructor(m){this._getKey=m,this._array=[]}clear(){this._array.length=0}insert(m){this._array.length!==0?(c=this._search(this._getKey(m)),this._array.splice(c,0,m)):this._array.push(m)}delete(m){if(this._array.length===0)return!1;const w=this._getKey(m);if(w===void 0||(c=this._search(w),c===-1)||this._getKey(this._array[c])!==w)return!1;do if(this._array[c]===m)return this._array.splice(c,1),!0;while(++c<this._array.length&&this._getKey(this._array[c])===w);return!1}*getKeyIterator(m){if(this._array.length!==0&&(c=this._search(m),!(c<0||c>=this._array.length)&&this._getKey(this._array[c])===m))do yield this._array[c];while(++c<this._array.length&&this._getKey(this._array[c])===m)}forEachByKey(m,w){if(this._array.length!==0&&(c=this._search(m),!(c<0||c>=this._array.length)&&this._getKey(this._array[c])===m))do w(this._array[c]);while(++c<this._array.length&&this._getKey(this._array[c])===m)}values(){return[...this._array].values()}_search(m){let w=0,d=this._array.length-1;for(;d>=w;){let k=w+d>>1;const L=this._getKey(this._array[k]);if(L>m)d=k-1;else{if(!(L<m)){for(;k>0&&this._getKey(this._array[k-1])===m;)k--;return k}w=k+1}}return w}}},7226:(v,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DebouncedIdleTask=o.IdleTaskQueue=o.PriorityTaskQueue=void 0;const m=c(6114);class w{constructor(){this._tasks=[],this._i=0}enqueue(L){this._tasks.push(L),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(L){this._idleCallback=void 0;let M=0,b=0,h=L.timeRemaining(),_=0;for(;this._i<this._tasks.length;){if(M=Date.now(),this._tasks[this._i]()||this._i++,M=Math.max(1,Date.now()-M),b=Math.max(M,b),_=L.timeRemaining(),1.5*b>_)return h-M<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(h-M))}ms`),void this._start();h=_}this.clear()}}class d extends w{_requestCallback(L){return setTimeout((()=>L(this._createDeadline(16))))}_cancelCallback(L){clearTimeout(L)}_createDeadline(L){const M=Date.now()+L;return{timeRemaining:()=>Math.max(0,M-Date.now())}}}o.PriorityTaskQueue=d,o.IdleTaskQueue=!m.isNode&&"requestIdleCallback"in window?class extends w{_requestCallback(k){return requestIdleCallback(k)}_cancelCallback(k){cancelIdleCallback(k)}}:d,o.DebouncedIdleTask=class{constructor(){this._queue=new o.IdleTaskQueue}set(k){this._queue.clear(),this._queue.enqueue(k)}flush(){this._queue.flush()}}},9282:(v,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.updateWindowsModeWrappedState=void 0;const m=c(643);o.updateWindowsModeWrappedState=function(w){const d=w.buffer.lines.get(w.buffer.ybase+w.buffer.y-1),k=d==null?void 0:d.get(w.cols-1),L=w.buffer.lines.get(w.buffer.ybase+w.buffer.y);L&&k&&(L.isWrapped=k[m.CHAR_DATA_CODE_INDEX]!==m.NULL_CELL_CODE&&k[m.CHAR_DATA_CODE_INDEX]!==m.WHITESPACE_CELL_CODE)}},3734:(v,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ExtendedAttrs=o.AttributeData=void 0;class c{constructor(){this.fg=0,this.bg=0,this.extended=new m}static toColorRGB(d){return[d>>>16&255,d>>>8&255,255&d]}static fromColorRGB(d){return(255&d[0])<<16|(255&d[1])<<8|255&d[2]}clone(){const d=new c;return d.fg=this.fg,d.bg=this.bg,d.extended=this.extended.clone(),d}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}}o.AttributeData=c;class m{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(d){this._ext=d}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(d){this._ext&=-469762049,this._ext|=d<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(d){this._ext&=-67108864,this._ext|=67108863&d}get urlId(){return this._urlId}set urlId(d){this._urlId=d}get underlineVariantOffset(){const d=(3758096384&this._ext)>>29;return d<0?4294967288^d:d}set underlineVariantOffset(d){this._ext&=536870911,this._ext|=d<<29&3758096384}constructor(d=0,k=0){this._ext=0,this._urlId=0,this._ext=d,this._urlId=k}clone(){return new m(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}o.ExtendedAttrs=m},9092:(v,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Buffer=o.MAX_BUFFER_SIZE=void 0;const m=c(6349),w=c(7226),d=c(3734),k=c(8437),L=c(4634),M=c(511),b=c(643),h=c(4863),_=c(7116);o.MAX_BUFFER_SIZE=4294967295,o.Buffer=class{constructor(g,p,T){this._hasScrollback=g,this._optionsService=p,this._bufferService=T,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=k.DEFAULT_ATTR_DATA.clone(),this.savedCharset=_.DEFAULT_CHARSET,this.markers=[],this._nullCell=M.CellData.fromCharData([0,b.NULL_CELL_CHAR,b.NULL_CELL_WIDTH,b.NULL_CELL_CODE]),this._whitespaceCell=M.CellData.fromCharData([0,b.WHITESPACE_CELL_CHAR,b.WHITESPACE_CELL_WIDTH,b.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new w.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new m.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(g){return g?(this._nullCell.fg=g.fg,this._nullCell.bg=g.bg,this._nullCell.extended=g.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new d.ExtendedAttrs),this._nullCell}getWhitespaceCell(g){return g?(this._whitespaceCell.fg=g.fg,this._whitespaceCell.bg=g.bg,this._whitespaceCell.extended=g.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new d.ExtendedAttrs),this._whitespaceCell}getBlankLine(g,p){return new k.BufferLine(this._bufferService.cols,this.getNullCell(g),p)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const g=this.ybase+this.y-this.ydisp;return g>=0&&g<this._rows}_getCorrectBufferLength(g){if(!this._hasScrollback)return g;const p=g+this._optionsService.rawOptions.scrollback;return p>o.MAX_BUFFER_SIZE?o.MAX_BUFFER_SIZE:p}fillViewportRows(g){if(this.lines.length===0){g===void 0&&(g=k.DEFAULT_ATTR_DATA);let p=this._rows;for(;p--;)this.lines.push(this.getBlankLine(g))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new m.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(g,p){const T=this.getNullCell(k.DEFAULT_ATTR_DATA);let A=0;const E=this._getCorrectBufferLength(p);if(E>this.lines.maxLength&&(this.lines.maxLength=E),this.lines.length>0){if(this._cols<g)for(let x=0;x<this.lines.length;x++)A+=+this.lines.get(x).resize(g,T);let S=0;if(this._rows<p)for(let x=this._rows;x<p;x++)this.lines.length<p+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new k.BufferLine(g,T)):this.ybase>0&&this.lines.length<=this.ybase+this.y+S+1?(this.ybase--,S++,this.ydisp>0&&this.ydisp--):this.lines.push(new k.BufferLine(g,T)));else for(let x=this._rows;x>p;x--)this.lines.length>p+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(E<this.lines.maxLength){const x=this.lines.length-E;x>0&&(this.lines.trimStart(x),this.ybase=Math.max(this.ybase-x,0),this.ydisp=Math.max(this.ydisp-x,0),this.savedY=Math.max(this.savedY-x,0)),this.lines.maxLength=E}this.x=Math.min(this.x,g-1),this.y=Math.min(this.y,p-1),S&&(this.y+=S),this.savedX=Math.min(this.savedX,g-1),this.scrollTop=0}if(this.scrollBottom=p-1,this._isReflowEnabled&&(this._reflow(g,p),this._cols>g))for(let S=0;S<this.lines.length;S++)A+=+this.lines.get(S).resize(g,T);this._cols=g,this._rows=p,this._memoryCleanupQueue.clear(),A>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let g=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,g=!1);let p=0;for(;this._memoryCleanupPosition<this.lines.length;)if(p+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),p>100)return!0;return g}get _isReflowEnabled(){const g=this._optionsService.rawOptions.windowsPty;return g&&g.buildNumber?this._hasScrollback&&g.backend==="conpty"&&g.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(g,p){this._cols!==g&&(g>this._cols?this._reflowLarger(g,p):this._reflowSmaller(g,p))}_reflowLarger(g,p){const T=(0,L.reflowLargerGetLinesToRemove)(this.lines,this._cols,g,this.ybase+this.y,this.getNullCell(k.DEFAULT_ATTR_DATA));if(T.length>0){const A=(0,L.reflowLargerCreateNewLayout)(this.lines,T);(0,L.reflowLargerApplyNewLayout)(this.lines,A.layout),this._reflowLargerAdjustViewport(g,p,A.countRemoved)}}_reflowLargerAdjustViewport(g,p,T){const A=this.getNullCell(k.DEFAULT_ATTR_DATA);let E=T;for(;E-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<p&&this.lines.push(new k.BufferLine(g,A))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-T,0)}_reflowSmaller(g,p){const T=this.getNullCell(k.DEFAULT_ATTR_DATA),A=[];let E=0;for(let S=this.lines.length-1;S>=0;S--){let x=this.lines.get(S);if(!x||!x.isWrapped&&x.getTrimmedLength()<=g)continue;const R=[x];for(;x.isWrapped&&S>0;)x=this.lines.get(--S),R.unshift(x);const I=this.ybase+this.y;if(I>=S&&I<S+R.length)continue;const D=R[R.length-1].getTrimmedLength(),P=(0,L.reflowSmallerGetNewLineLengths)(R,this._cols,g),F=P.length-R.length;let z;z=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+F):Math.max(0,this.lines.length-this.lines.maxLength+F);const q=[];for(let H=0;H<F;H++){const $=this.getBlankLine(k.DEFAULT_ATTR_DATA,!0);q.push($)}q.length>0&&(A.push({start:S+R.length+E,newLines:q}),E+=q.length),R.push(...q);let K=P.length-1,V=P[K];V===0&&(K--,V=P[K]);let W=R.length-F-1,O=D;for(;W>=0;){const H=Math.min(O,V);if(R[K]===void 0)break;if(R[K].copyCellsFrom(R[W],O-H,V-H,H,!0),V-=H,V===0&&(K--,V=P[K]),O-=H,O===0){W--;const $=Math.max(W,0);O=(0,L.getWrappedLineTrimmedLength)(R,$,this._cols)}}for(let H=0;H<R.length;H++)P[H]<g&&R[H].setCell(P[H],T);let U=F-z;for(;U-- >0;)this.ybase===0?this.y<p-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+E)-p&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+F,this.ybase+p-1)}if(A.length>0){const S=[],x=[];for(let K=0;K<this.lines.length;K++)x.push(this.lines.get(K));const R=this.lines.length;let I=R-1,D=0,P=A[D];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+E);let F=0;for(let K=Math.min(this.lines.maxLength-1,R+E-1);K>=0;K--)if(P&&P.start>I+F){for(let V=P.newLines.length-1;V>=0;V--)this.lines.set(K--,P.newLines[V]);K++,S.push({index:I+1,amount:P.newLines.length}),F+=P.newLines.length,P=A[++D]}else this.lines.set(K,x[I--]);let z=0;for(let K=S.length-1;K>=0;K--)S[K].index+=z,this.lines.onInsertEmitter.fire(S[K]),z+=S[K].amount;const q=Math.max(0,R+E-this.lines.maxLength);q>0&&this.lines.onTrimEmitter.fire(q)}}translateBufferLineToString(g,p,T=0,A){const E=this.lines.get(g);return E?E.translateToString(p,T,A):""}getWrappedRangeForLine(g){let p=g,T=g;for(;p>0&&this.lines.get(p).isWrapped;)p--;for(;T+1<this.lines.length&&this.lines.get(T+1).isWrapped;)T++;return{first:p,last:T}}setupTabStops(g){for(g!=null?this.tabs[g]||(g=this.prevStop(g)):(this.tabs={},g=0);g<this._cols;g+=this._optionsService.rawOptions.tabStopWidth)this.tabs[g]=!0}prevStop(g){for(g==null&&(g=this.x);!this.tabs[--g]&&g>0;);return g>=this._cols?this._cols-1:g<0?0:g}nextStop(g){for(g==null&&(g=this.x);!this.tabs[++g]&&g<this._cols;);return g>=this._cols?this._cols-1:g<0?0:g}clearMarkers(g){this._isClearing=!0;for(let p=0;p<this.markers.length;p++)this.markers[p].line===g&&(this.markers[p].dispose(),this.markers.splice(p--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let g=0;g<this.markers.length;g++)this.markers[g].dispose(),this.markers.splice(g--,1);this._isClearing=!1}addMarker(g){const p=new h.Marker(g);return this.markers.push(p),p.register(this.lines.onTrim((T=>{p.line-=T,p.line<0&&p.dispose()}))),p.register(this.lines.onInsert((T=>{p.line>=T.index&&(p.line+=T.amount)}))),p.register(this.lines.onDelete((T=>{p.line>=T.index&&p.line<T.index+T.amount&&p.dispose(),p.line>T.index&&(p.line-=T.amount)}))),p.register(p.onDispose((()=>this._removeMarker(p)))),p}_removeMarker(g){this._isClearing||this.markers.splice(this.markers.indexOf(g),1)}}},8437:(v,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferLine=o.DEFAULT_ATTR_DATA=void 0;const m=c(3734),w=c(511),d=c(643),k=c(482);o.DEFAULT_ATTR_DATA=Object.freeze(new m.AttributeData);let L=0;class M{constructor(h,_,g=!1){this.isWrapped=g,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*h);const p=_||w.CellData.fromCharData([0,d.NULL_CELL_CHAR,d.NULL_CELL_WIDTH,d.NULL_CELL_CODE]);for(let T=0;T<h;++T)this.setCell(T,p);this.length=h}get(h){const _=this._data[3*h+0],g=2097151&_;return[this._data[3*h+1],2097152&_?this._combined[h]:g?(0,k.stringFromCodePoint)(g):"",_>>22,2097152&_?this._combined[h].charCodeAt(this._combined[h].length-1):g]}set(h,_){this._data[3*h+1]=_[d.CHAR_DATA_ATTR_INDEX],_[d.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[h]=_[1],this._data[3*h+0]=2097152|h|_[d.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*h+0]=_[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|_[d.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(h){return this._data[3*h+0]>>22}hasWidth(h){return 12582912&this._data[3*h+0]}getFg(h){return this._data[3*h+1]}getBg(h){return this._data[3*h+2]}hasContent(h){return 4194303&this._data[3*h+0]}getCodePoint(h){const _=this._data[3*h+0];return 2097152&_?this._combined[h].charCodeAt(this._combined[h].length-1):2097151&_}isCombined(h){return 2097152&this._data[3*h+0]}getString(h){const _=this._data[3*h+0];return 2097152&_?this._combined[h]:2097151&_?(0,k.stringFromCodePoint)(2097151&_):""}isProtected(h){return 536870912&this._data[3*h+2]}loadCell(h,_){return L=3*h,_.content=this._data[L+0],_.fg=this._data[L+1],_.bg=this._data[L+2],2097152&_.content&&(_.combinedData=this._combined[h]),268435456&_.bg&&(_.extended=this._extendedAttrs[h]),_}setCell(h,_){2097152&_.content&&(this._combined[h]=_.combinedData),268435456&_.bg&&(this._extendedAttrs[h]=_.extended),this._data[3*h+0]=_.content,this._data[3*h+1]=_.fg,this._data[3*h+2]=_.bg}setCellFromCodepoint(h,_,g,p){268435456&p.bg&&(this._extendedAttrs[h]=p.extended),this._data[3*h+0]=_|g<<22,this._data[3*h+1]=p.fg,this._data[3*h+2]=p.bg}addCodepointToCell(h,_,g){let p=this._data[3*h+0];2097152&p?this._combined[h]+=(0,k.stringFromCodePoint)(_):2097151&p?(this._combined[h]=(0,k.stringFromCodePoint)(2097151&p)+(0,k.stringFromCodePoint)(_),p&=-2097152,p|=2097152):p=_|4194304,g&&(p&=-12582913,p|=g<<22),this._data[3*h+0]=p}insertCells(h,_,g){if((h%=this.length)&&this.getWidth(h-1)===2&&this.setCellFromCodepoint(h-1,0,1,g),_<this.length-h){const p=new w.CellData;for(let T=this.length-h-_-1;T>=0;--T)this.setCell(h+_+T,this.loadCell(h+T,p));for(let T=0;T<_;++T)this.setCell(h+T,g)}else for(let p=h;p<this.length;++p)this.setCell(p,g);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,g)}deleteCells(h,_,g){if(h%=this.length,_<this.length-h){const p=new w.CellData;for(let T=0;T<this.length-h-_;++T)this.setCell(h+T,this.loadCell(h+_+T,p));for(let T=this.length-_;T<this.length;++T)this.setCell(T,g)}else for(let p=h;p<this.length;++p)this.setCell(p,g);h&&this.getWidth(h-1)===2&&this.setCellFromCodepoint(h-1,0,1,g),this.getWidth(h)!==0||this.hasContent(h)||this.setCellFromCodepoint(h,0,1,g)}replaceCells(h,_,g,p=!1){if(p)for(h&&this.getWidth(h-1)===2&&!this.isProtected(h-1)&&this.setCellFromCodepoint(h-1,0,1,g),_<this.length&&this.getWidth(_-1)===2&&!this.isProtected(_)&&this.setCellFromCodepoint(_,0,1,g);h<_&&h<this.length;)this.isProtected(h)||this.setCell(h,g),h++;else for(h&&this.getWidth(h-1)===2&&this.setCellFromCodepoint(h-1,0,1,g),_<this.length&&this.getWidth(_-1)===2&&this.setCellFromCodepoint(_,0,1,g);h<_&&h<this.length;)this.setCell(h++,g)}resize(h,_){if(h===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const g=3*h;if(h>this.length){if(this._data.buffer.byteLength>=4*g)this._data=new Uint32Array(this._data.buffer,0,g);else{const p=new Uint32Array(g);p.set(this._data),this._data=p}for(let p=this.length;p<h;++p)this.setCell(p,_)}else{this._data=this._data.subarray(0,g);const p=Object.keys(this._combined);for(let A=0;A<p.length;A++){const E=parseInt(p[A],10);E>=h&&delete this._combined[E]}const T=Object.keys(this._extendedAttrs);for(let A=0;A<T.length;A++){const E=parseInt(T[A],10);E>=h&&delete this._extendedAttrs[E]}}return this.length=h,4*g*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const h=new Uint32Array(this._data.length);return h.set(this._data),this._data=h,1}return 0}fill(h,_=!1){if(_)for(let g=0;g<this.length;++g)this.isProtected(g)||this.setCell(g,h);else{this._combined={},this._extendedAttrs={};for(let g=0;g<this.length;++g)this.setCell(g,h)}}copyFrom(h){this.length!==h.length?this._data=new Uint32Array(h._data):this._data.set(h._data),this.length=h.length,this._combined={};for(const _ in h._combined)this._combined[_]=h._combined[_];this._extendedAttrs={};for(const _ in h._extendedAttrs)this._extendedAttrs[_]=h._extendedAttrs[_];this.isWrapped=h.isWrapped}clone(){const h=new M(0);h._data=new Uint32Array(this._data),h.length=this.length;for(const _ in this._combined)h._combined[_]=this._combined[_];for(const _ in this._extendedAttrs)h._extendedAttrs[_]=this._extendedAttrs[_];return h.isWrapped=this.isWrapped,h}getTrimmedLength(){for(let h=this.length-1;h>=0;--h)if(4194303&this._data[3*h+0])return h+(this._data[3*h+0]>>22);return 0}getNoBgTrimmedLength(){for(let h=this.length-1;h>=0;--h)if(4194303&this._data[3*h+0]||50331648&this._data[3*h+2])return h+(this._data[3*h+0]>>22);return 0}copyCellsFrom(h,_,g,p,T){const A=h._data;if(T)for(let S=p-1;S>=0;S--){for(let x=0;x<3;x++)this._data[3*(g+S)+x]=A[3*(_+S)+x];268435456&A[3*(_+S)+2]&&(this._extendedAttrs[g+S]=h._extendedAttrs[_+S])}else for(let S=0;S<p;S++){for(let x=0;x<3;x++)this._data[3*(g+S)+x]=A[3*(_+S)+x];268435456&A[3*(_+S)+2]&&(this._extendedAttrs[g+S]=h._extendedAttrs[_+S])}const E=Object.keys(h._combined);for(let S=0;S<E.length;S++){const x=parseInt(E[S],10);x>=_&&(this._combined[x-_+g]=h._combined[x])}}translateToString(h,_,g,p){_=_??0,g=g??this.length,h&&(g=Math.min(g,this.getTrimmedLength())),p&&(p.length=0);let T="";for(;_<g;){const A=this._data[3*_+0],E=2097151&A,S=2097152&A?this._combined[_]:E?(0,k.stringFromCodePoint)(E):d.WHITESPACE_CELL_CHAR;if(T+=S,p)for(let x=0;x<S.length;++x)p.push(_);_+=A>>22||1}return p&&p.push(_),T}}o.BufferLine=M},4841:(v,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.getRangeLength=void 0,o.getRangeLength=function(c,m){if(c.start.y>c.end.y)throw new Error(`Buffer range end (${c.end.x}, ${c.end.y}) cannot be before start (${c.start.x}, ${c.start.y})`);return m*(c.end.y-c.start.y)+(c.end.x-c.start.x+1)}},4634:(v,o)=>{function c(m,w,d){if(w===m.length-1)return m[w].getTrimmedLength();const k=!m[w].hasContent(d-1)&&m[w].getWidth(d-1)===1,L=m[w+1].getWidth(0)===2;return k&&L?d-1:d}Object.defineProperty(o,"__esModule",{value:!0}),o.getWrappedLineTrimmedLength=o.reflowSmallerGetNewLineLengths=o.reflowLargerApplyNewLayout=o.reflowLargerCreateNewLayout=o.reflowLargerGetLinesToRemove=void 0,o.reflowLargerGetLinesToRemove=function(m,w,d,k,L){const M=[];for(let b=0;b<m.length-1;b++){let h=b,_=m.get(++h);if(!_.isWrapped)continue;const g=[m.get(b)];for(;h<m.length&&_.isWrapped;)g.push(_),_=m.get(++h);if(k>=b&&k<h){b+=g.length-1;continue}let p=0,T=c(g,p,w),A=1,E=0;for(;A<g.length;){const x=c(g,A,w),R=x-E,I=d-T,D=Math.min(R,I);g[p].copyCellsFrom(g[A],E,T,D,!1),T+=D,T===d&&(p++,T=0),E+=D,E===x&&(A++,E=0),T===0&&p!==0&&g[p-1].getWidth(d-1)===2&&(g[p].copyCellsFrom(g[p-1],d-1,T++,1,!1),g[p-1].setCell(d-1,L))}g[p].replaceCells(T,d,L);let S=0;for(let x=g.length-1;x>0&&(x>p||g[x].getTrimmedLength()===0);x--)S++;S>0&&(M.push(b+g.length-S),M.push(S)),b+=g.length-1}return M},o.reflowLargerCreateNewLayout=function(m,w){const d=[];let k=0,L=w[k],M=0;for(let b=0;b<m.length;b++)if(L===b){const h=w[++k];m.onDeleteEmitter.fire({index:b-M,amount:h}),b+=h-1,M+=h,L=w[++k]}else d.push(b);return{layout:d,countRemoved:M}},o.reflowLargerApplyNewLayout=function(m,w){const d=[];for(let k=0;k<w.length;k++)d.push(m.get(w[k]));for(let k=0;k<d.length;k++)m.set(k,d[k]);m.length=w.length},o.reflowSmallerGetNewLineLengths=function(m,w,d){const k=[],L=m.map(((_,g)=>c(m,g,w))).reduce(((_,g)=>_+g));let M=0,b=0,h=0;for(;h<L;){if(L-h<d){k.push(L-h);break}M+=d;const _=c(m,b,w);M>_&&(M-=_,b++);const g=m[b].getWidth(M-1)===2;g&&M--;const p=g?d-1:d;k.push(p),h+=p}return k},o.getWrappedLineTrimmedLength=c},5295:(v,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferSet=void 0;const m=c(8460),w=c(844),d=c(9092);class k extends w.Disposable{constructor(M,b){super(),this._optionsService=M,this._bufferService=b,this._onBufferActivate=this.register(new m.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",(()=>this.setupTabStops())))}reset(){this._normal=new d.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new d.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(M){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(M),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(M,b){this._normal.resize(M,b),this._alt.resize(M,b),this.setupTabStops(M)}setupTabStops(M){this._normal.setupTabStops(M),this._alt.setupTabStops(M)}}o.BufferSet=k},511:(v,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CellData=void 0;const m=c(482),w=c(643),d=c(3734);class k extends d.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new d.ExtendedAttrs,this.combinedData=""}static fromCharData(M){const b=new k;return b.setFromCharData(M),b}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,m.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(M){this.fg=M[w.CHAR_DATA_ATTR_INDEX],this.bg=0;let b=!1;if(M[w.CHAR_DATA_CHAR_INDEX].length>2)b=!0;else if(M[w.CHAR_DATA_CHAR_INDEX].length===2){const h=M[w.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=h&&h<=56319){const _=M[w.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=_&&_<=57343?this.content=1024*(h-55296)+_-56320+65536|M[w.CHAR_DATA_WIDTH_INDEX]<<22:b=!0}else b=!0}else this.content=M[w.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|M[w.CHAR_DATA_WIDTH_INDEX]<<22;b&&(this.combinedData=M[w.CHAR_DATA_CHAR_INDEX],this.content=2097152|M[w.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}o.CellData=k},643:(v,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.WHITESPACE_CELL_CODE=o.WHITESPACE_CELL_WIDTH=o.WHITESPACE_CELL_CHAR=o.NULL_CELL_CODE=o.NULL_CELL_WIDTH=o.NULL_CELL_CHAR=o.CHAR_DATA_CODE_INDEX=o.CHAR_DATA_WIDTH_INDEX=o.CHAR_DATA_CHAR_INDEX=o.CHAR_DATA_ATTR_INDEX=o.DEFAULT_EXT=o.DEFAULT_ATTR=o.DEFAULT_COLOR=void 0,o.DEFAULT_COLOR=0,o.DEFAULT_ATTR=256|o.DEFAULT_COLOR<<9,o.DEFAULT_EXT=0,o.CHAR_DATA_ATTR_INDEX=0,o.CHAR_DATA_CHAR_INDEX=1,o.CHAR_DATA_WIDTH_INDEX=2,o.CHAR_DATA_CODE_INDEX=3,o.NULL_CELL_CHAR="",o.NULL_CELL_WIDTH=1,o.NULL_CELL_CODE=0,o.WHITESPACE_CELL_CHAR=" ",o.WHITESPACE_CELL_WIDTH=1,o.WHITESPACE_CELL_CODE=32},4863:(v,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Marker=void 0;const m=c(8460),w=c(844);class d{get id(){return this._id}constructor(L){this.line=L,this.isDisposed=!1,this._disposables=[],this._id=d._nextId++,this._onDispose=this.register(new m.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,w.disposeArray)(this._disposables),this._disposables.length=0)}register(L){return this._disposables.push(L),L}}o.Marker=d,d._nextId=1},7116:(v,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DEFAULT_CHARSET=o.CHARSETS=void 0,o.CHARSETS={},o.DEFAULT_CHARSET=o.CHARSETS.B,o.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:"≥","{":"π","|":"≠","}":"£","~":"·"},o.CHARSETS.A={"#":"£"},o.CHARSETS.B=void 0,o.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},o.CHARSETS.C=o.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},o.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},o.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},o.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},o.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},o.CHARSETS.E=o.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},o.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},o.CHARSETS.H=o.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},o.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(v,o)=>{var c,m,w;Object.defineProperty(o,"__esModule",{value:!0}),o.C1_ESCAPED=o.C1=o.C0=void 0,(function(d){d.NUL="\0",d.SOH="",d.STX="",d.ETX="",d.EOT="",d.ENQ="",d.ACK="",d.BEL="\x07",d.BS="\b",d.HT=" ",d.LF=`
|
|
129
|
+
`,d.VT="\v",d.FF="\f",d.CR="\r",d.SO="",d.SI="",d.DLE="",d.DC1="",d.DC2="",d.DC3="",d.DC4="",d.NAK="",d.SYN="",d.ETB="",d.CAN="",d.EM="",d.SUB="",d.ESC="\x1B",d.FS="",d.GS="",d.RS="",d.US="",d.SP=" ",d.DEL=""})(c||(o.C0=c={})),(function(d){d.PAD="",d.HOP="",d.BPH="",d.NBH="",d.IND="",d.NEL="
",d.SSA="",d.ESA="",d.HTS="",d.HTJ="",d.VTS="",d.PLD="",d.PLU="",d.RI="",d.SS2="",d.SS3="",d.DCS="",d.PU1="",d.PU2="",d.STS="",d.CCH="",d.MW="",d.SPA="",d.EPA="",d.SOS="",d.SGCI="",d.SCI="",d.CSI="",d.ST="",d.OSC="",d.PM="",d.APC=""})(m||(o.C1=m={})),(function(d){d.ST=`${c.ESC}\\`})(w||(o.C1_ESCAPED=w={}))},7399:(v,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.evaluateKeyboardEvent=void 0;const m=c(2584),w={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:["'",'"']};o.evaluateKeyboardEvent=function(d,k,L,M){const b={type:0,cancel:!1,key:void 0},h=(d.shiftKey?1:0)|(d.altKey?2:0)|(d.ctrlKey?4:0)|(d.metaKey?8:0);switch(d.keyCode){case 0:d.key==="UIKeyInputUpArrow"?b.key=k?m.C0.ESC+"OA":m.C0.ESC+"[A":d.key==="UIKeyInputLeftArrow"?b.key=k?m.C0.ESC+"OD":m.C0.ESC+"[D":d.key==="UIKeyInputRightArrow"?b.key=k?m.C0.ESC+"OC":m.C0.ESC+"[C":d.key==="UIKeyInputDownArrow"&&(b.key=k?m.C0.ESC+"OB":m.C0.ESC+"[B");break;case 8:b.key=d.ctrlKey?"\b":m.C0.DEL,d.altKey&&(b.key=m.C0.ESC+b.key);break;case 9:if(d.shiftKey){b.key=m.C0.ESC+"[Z";break}b.key=m.C0.HT,b.cancel=!0;break;case 13:b.key=d.altKey?m.C0.ESC+m.C0.CR:m.C0.CR,b.cancel=!0;break;case 27:b.key=m.C0.ESC,d.altKey&&(b.key=m.C0.ESC+m.C0.ESC),b.cancel=!0;break;case 37:if(d.metaKey)break;h?(b.key=m.C0.ESC+"[1;"+(h+1)+"D",b.key===m.C0.ESC+"[1;3D"&&(b.key=m.C0.ESC+(L?"b":"[1;5D"))):b.key=k?m.C0.ESC+"OD":m.C0.ESC+"[D";break;case 39:if(d.metaKey)break;h?(b.key=m.C0.ESC+"[1;"+(h+1)+"C",b.key===m.C0.ESC+"[1;3C"&&(b.key=m.C0.ESC+(L?"f":"[1;5C"))):b.key=k?m.C0.ESC+"OC":m.C0.ESC+"[C";break;case 38:if(d.metaKey)break;h?(b.key=m.C0.ESC+"[1;"+(h+1)+"A",L||b.key!==m.C0.ESC+"[1;3A"||(b.key=m.C0.ESC+"[1;5A")):b.key=k?m.C0.ESC+"OA":m.C0.ESC+"[A";break;case 40:if(d.metaKey)break;h?(b.key=m.C0.ESC+"[1;"+(h+1)+"B",L||b.key!==m.C0.ESC+"[1;3B"||(b.key=m.C0.ESC+"[1;5B")):b.key=k?m.C0.ESC+"OB":m.C0.ESC+"[B";break;case 45:d.shiftKey||d.ctrlKey||(b.key=m.C0.ESC+"[2~");break;case 46:b.key=h?m.C0.ESC+"[3;"+(h+1)+"~":m.C0.ESC+"[3~";break;case 36:b.key=h?m.C0.ESC+"[1;"+(h+1)+"H":k?m.C0.ESC+"OH":m.C0.ESC+"[H";break;case 35:b.key=h?m.C0.ESC+"[1;"+(h+1)+"F":k?m.C0.ESC+"OF":m.C0.ESC+"[F";break;case 33:d.shiftKey?b.type=2:d.ctrlKey?b.key=m.C0.ESC+"[5;"+(h+1)+"~":b.key=m.C0.ESC+"[5~";break;case 34:d.shiftKey?b.type=3:d.ctrlKey?b.key=m.C0.ESC+"[6;"+(h+1)+"~":b.key=m.C0.ESC+"[6~";break;case 112:b.key=h?m.C0.ESC+"[1;"+(h+1)+"P":m.C0.ESC+"OP";break;case 113:b.key=h?m.C0.ESC+"[1;"+(h+1)+"Q":m.C0.ESC+"OQ";break;case 114:b.key=h?m.C0.ESC+"[1;"+(h+1)+"R":m.C0.ESC+"OR";break;case 115:b.key=h?m.C0.ESC+"[1;"+(h+1)+"S":m.C0.ESC+"OS";break;case 116:b.key=h?m.C0.ESC+"[15;"+(h+1)+"~":m.C0.ESC+"[15~";break;case 117:b.key=h?m.C0.ESC+"[17;"+(h+1)+"~":m.C0.ESC+"[17~";break;case 118:b.key=h?m.C0.ESC+"[18;"+(h+1)+"~":m.C0.ESC+"[18~";break;case 119:b.key=h?m.C0.ESC+"[19;"+(h+1)+"~":m.C0.ESC+"[19~";break;case 120:b.key=h?m.C0.ESC+"[20;"+(h+1)+"~":m.C0.ESC+"[20~";break;case 121:b.key=h?m.C0.ESC+"[21;"+(h+1)+"~":m.C0.ESC+"[21~";break;case 122:b.key=h?m.C0.ESC+"[23;"+(h+1)+"~":m.C0.ESC+"[23~";break;case 123:b.key=h?m.C0.ESC+"[24;"+(h+1)+"~":m.C0.ESC+"[24~";break;default:if(!d.ctrlKey||d.shiftKey||d.altKey||d.metaKey)if(L&&!M||!d.altKey||d.metaKey)!L||d.altKey||d.ctrlKey||d.shiftKey||!d.metaKey?d.key&&!d.ctrlKey&&!d.altKey&&!d.metaKey&&d.keyCode>=48&&d.key.length===1?b.key=d.key:d.key&&d.ctrlKey&&(d.key==="_"&&(b.key=m.C0.US),d.key==="@"&&(b.key=m.C0.NUL)):d.keyCode===65&&(b.type=1);else{const _=w[d.keyCode],g=_==null?void 0:_[d.shiftKey?1:0];if(g)b.key=m.C0.ESC+g;else if(d.keyCode>=65&&d.keyCode<=90){const p=d.ctrlKey?d.keyCode-64:d.keyCode+32;let T=String.fromCharCode(p);d.shiftKey&&(T=T.toUpperCase()),b.key=m.C0.ESC+T}else if(d.keyCode===32)b.key=m.C0.ESC+(d.ctrlKey?m.C0.NUL:" ");else if(d.key==="Dead"&&d.code.startsWith("Key")){let p=d.code.slice(3,4);d.shiftKey||(p=p.toLowerCase()),b.key=m.C0.ESC+p,b.cancel=!0}}else d.keyCode>=65&&d.keyCode<=90?b.key=String.fromCharCode(d.keyCode-64):d.keyCode===32?b.key=m.C0.NUL:d.keyCode>=51&&d.keyCode<=55?b.key=String.fromCharCode(d.keyCode-51+27):d.keyCode===56?b.key=m.C0.DEL:d.keyCode===219?b.key=m.C0.ESC:d.keyCode===220?b.key=m.C0.FS:d.keyCode===221&&(b.key=m.C0.GS)}return b}},482:(v,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Utf8ToUtf32=o.StringToUtf32=o.utf32ToString=o.stringFromCodePoint=void 0,o.stringFromCodePoint=function(c){return c>65535?(c-=65536,String.fromCharCode(55296+(c>>10))+String.fromCharCode(c%1024+56320)):String.fromCharCode(c)},o.utf32ToString=function(c,m=0,w=c.length){let d="";for(let k=m;k<w;++k){let L=c[k];L>65535?(L-=65536,d+=String.fromCharCode(55296+(L>>10))+String.fromCharCode(L%1024+56320)):d+=String.fromCharCode(L)}return d},o.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(c,m){const w=c.length;if(!w)return 0;let d=0,k=0;if(this._interim){const L=c.charCodeAt(k++);56320<=L&&L<=57343?m[d++]=1024*(this._interim-55296)+L-56320+65536:(m[d++]=this._interim,m[d++]=L),this._interim=0}for(let L=k;L<w;++L){const M=c.charCodeAt(L);if(55296<=M&&M<=56319){if(++L>=w)return this._interim=M,d;const b=c.charCodeAt(L);56320<=b&&b<=57343?m[d++]=1024*(M-55296)+b-56320+65536:(m[d++]=M,m[d++]=b)}else M!==65279&&(m[d++]=M)}return d}},o.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(c,m){const w=c.length;if(!w)return 0;let d,k,L,M,b=0,h=0,_=0;if(this.interim[0]){let T=!1,A=this.interim[0];A&=(224&A)==192?31:(240&A)==224?15:7;let E,S=0;for(;(E=63&this.interim[++S])&&S<4;)A<<=6,A|=E;const x=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,R=x-S;for(;_<R;){if(_>=w)return 0;if(E=c[_++],(192&E)!=128){_--,T=!0;break}this.interim[S++]=E,A<<=6,A|=63&E}T||(x===2?A<128?_--:m[b++]=A:x===3?A<2048||A>=55296&&A<=57343||A===65279||(m[b++]=A):A<65536||A>1114111||(m[b++]=A)),this.interim.fill(0)}const g=w-4;let p=_;for(;p<w;){for(;!(!(p<g)||128&(d=c[p])||128&(k=c[p+1])||128&(L=c[p+2])||128&(M=c[p+3]));)m[b++]=d,m[b++]=k,m[b++]=L,m[b++]=M,p+=4;if(d=c[p++],d<128)m[b++]=d;else if((224&d)==192){if(p>=w)return this.interim[0]=d,b;if(k=c[p++],(192&k)!=128){p--;continue}if(h=(31&d)<<6|63&k,h<128){p--;continue}m[b++]=h}else if((240&d)==224){if(p>=w)return this.interim[0]=d,b;if(k=c[p++],(192&k)!=128){p--;continue}if(p>=w)return this.interim[0]=d,this.interim[1]=k,b;if(L=c[p++],(192&L)!=128){p--;continue}if(h=(15&d)<<12|(63&k)<<6|63&L,h<2048||h>=55296&&h<=57343||h===65279)continue;m[b++]=h}else if((248&d)==240){if(p>=w)return this.interim[0]=d,b;if(k=c[p++],(192&k)!=128){p--;continue}if(p>=w)return this.interim[0]=d,this.interim[1]=k,b;if(L=c[p++],(192&L)!=128){p--;continue}if(p>=w)return this.interim[0]=d,this.interim[1]=k,this.interim[2]=L,b;if(M=c[p++],(192&M)!=128){p--;continue}if(h=(7&d)<<18|(63&k)<<12|(63&L)<<6|63&M,h<65536||h>1114111)continue;m[b++]=h}}return b}}},225:(v,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeV6=void 0;const m=c(1480),w=[[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]],d=[[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 k;o.UnicodeV6=class{constructor(){if(this.version="6",!k){k=new Uint8Array(65536),k.fill(1),k[0]=0,k.fill(0,1,32),k.fill(0,127,160),k.fill(2,4352,4448),k[9001]=2,k[9002]=2,k.fill(2,11904,42192),k[12351]=1,k.fill(2,44032,55204),k.fill(2,63744,64256),k.fill(2,65040,65050),k.fill(2,65072,65136),k.fill(2,65280,65377),k.fill(2,65504,65511);for(let L=0;L<w.length;++L)k.fill(0,w[L][0],w[L][1]+1)}}wcwidth(L){return L<32?0:L<127?1:L<65536?k[L]:(function(M,b){let h,_=0,g=b.length-1;if(M<b[0][0]||M>b[g][1])return!1;for(;g>=_;)if(h=_+g>>1,M>b[h][1])_=h+1;else{if(!(M<b[h][0]))return!0;g=h-1}return!1})(L,d)?0:L>=131072&&L<=196605||L>=196608&&L<=262141?2:1}charProperties(L,M){let b=this.wcwidth(L),h=b===0&&M!==0;if(h){const _=m.UnicodeService.extractWidth(M);_===0?h=!1:_>b&&(b=_)}return m.UnicodeService.createPropertyValue(0,b,h)}}},5981:(v,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.WriteBuffer=void 0;const m=c(8460),w=c(844);class d extends w.Disposable{constructor(L){super(),this._action=L,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new m.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(L,M){if(M!==void 0&&this._syncCalls>M)return void(this._syncCalls=0);if(this._pendingData+=L.length,this._writeBuffer.push(L),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let b;for(this._isSyncWriting=!0;b=this._writeBuffer.shift();){this._action(b);const h=this._callbacks.shift();h&&h()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(L,M){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+=L.length,this._writeBuffer.push(L),this._callbacks.push(M),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=L.length,this._writeBuffer.push(L),this._callbacks.push(M)}_innerWrite(L=0,M=!0){const b=L||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const h=this._writeBuffer[this._bufferOffset],_=this._action(h,M);if(_){const p=T=>Date.now()-b>=12?setTimeout((()=>this._innerWrite(0,T))):this._innerWrite(b,T);return void _.catch((T=>(queueMicrotask((()=>{throw T})),Promise.resolve(!1)))).then(p)}const g=this._callbacks[this._bufferOffset];if(g&&g(),this._bufferOffset++,this._pendingData-=h.length,Date.now()-b>=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()}}o.WriteBuffer=d},5941:(v,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.toRgbString=o.parseColor=void 0;const c=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,m=/^[\da-f]+$/;function w(d,k){const L=d.toString(16),M=L.length<2?"0"+L:L;switch(k){case 4:return L[0];case 8:return M;case 12:return(M+M).slice(0,3);default:return M+M}}o.parseColor=function(d){if(!d)return;let k=d.toLowerCase();if(k.indexOf("rgb:")===0){k=k.slice(4);const L=c.exec(k);if(L){const M=L[1]?15:L[4]?255:L[7]?4095:65535;return[Math.round(parseInt(L[1]||L[4]||L[7]||L[10],16)/M*255),Math.round(parseInt(L[2]||L[5]||L[8]||L[11],16)/M*255),Math.round(parseInt(L[3]||L[6]||L[9]||L[12],16)/M*255)]}}else if(k.indexOf("#")===0&&(k=k.slice(1),m.exec(k)&&[3,6,9,12].includes(k.length))){const L=k.length/3,M=[0,0,0];for(let b=0;b<3;++b){const h=parseInt(k.slice(L*b,L*b+L),16);M[b]=L===1?h<<4:L===2?h:L===3?h>>4:h>>8}return M}},o.toRgbString=function(d,k=16){const[L,M,b]=d;return`rgb:${w(L,k)}/${w(M,k)}/${w(b,k)}`}},5770:(v,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.PAYLOAD_LIMIT=void 0,o.PAYLOAD_LIMIT=1e7},6351:(v,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DcsHandler=o.DcsParser=void 0;const m=c(482),w=c(8742),d=c(5770),k=[];o.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=k,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=k}registerHandler(M,b){this._handlers[M]===void 0&&(this._handlers[M]=[]);const h=this._handlers[M];return h.push(b),{dispose:()=>{const _=h.indexOf(b);_!==-1&&h.splice(_,1)}}}clearHandler(M){this._handlers[M]&&delete this._handlers[M]}setHandlerFallback(M){this._handlerFb=M}reset(){if(this._active.length)for(let M=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;M>=0;--M)this._active[M].unhook(!1);this._stack.paused=!1,this._active=k,this._ident=0}hook(M,b){if(this.reset(),this._ident=M,this._active=this._handlers[M]||k,this._active.length)for(let h=this._active.length-1;h>=0;h--)this._active[h].hook(b);else this._handlerFb(this._ident,"HOOK",b)}put(M,b,h){if(this._active.length)for(let _=this._active.length-1;_>=0;_--)this._active[_].put(M,b,h);else this._handlerFb(this._ident,"PUT",(0,m.utf32ToString)(M,b,h))}unhook(M,b=!0){if(this._active.length){let h=!1,_=this._active.length-1,g=!1;if(this._stack.paused&&(_=this._stack.loopPosition-1,h=b,g=this._stack.fallThrough,this._stack.paused=!1),!g&&h===!1){for(;_>=0&&(h=this._active[_].unhook(M),h!==!0);_--)if(h instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=_,this._stack.fallThrough=!1,h;_--}for(;_>=0;_--)if(h=this._active[_].unhook(!1),h instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=_,this._stack.fallThrough=!0,h}else this._handlerFb(this._ident,"UNHOOK",M);this._active=k,this._ident=0}};const L=new w.Params;L.addParam(0),o.DcsHandler=class{constructor(M){this._handler=M,this._data="",this._params=L,this._hitLimit=!1}hook(M){this._params=M.length>1||M.params[0]?M.clone():L,this._data="",this._hitLimit=!1}put(M,b,h){this._hitLimit||(this._data+=(0,m.utf32ToString)(M,b,h),this._data.length>d.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(M){let b=!1;if(this._hitLimit)b=!1;else if(M&&(b=this._handler(this._data,this._params),b instanceof Promise))return b.then((h=>(this._params=L,this._data="",this._hitLimit=!1,h)));return this._params=L,this._data="",this._hitLimit=!1,b}}},2015:(v,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.EscapeSequenceParser=o.VT500_TRANSITION_TABLE=o.TransitionTable=void 0;const m=c(844),w=c(8742),d=c(6242),k=c(6351);class L{constructor(_){this.table=new Uint8Array(_)}setDefault(_,g){this.table.fill(_<<4|g)}add(_,g,p,T){this.table[g<<8|_]=p<<4|T}addMany(_,g,p,T){for(let A=0;A<_.length;A++)this.table[g<<8|_[A]]=p<<4|T}}o.TransitionTable=L;const M=160;o.VT500_TRANSITION_TABLE=(function(){const h=new L(4095),_=Array.apply(null,Array(256)).map(((S,x)=>x)),g=(S,x)=>_.slice(S,x),p=g(32,127),T=g(0,24);T.push(25),T.push.apply(T,g(28,32));const A=g(0,14);let E;for(E in h.setDefault(1,0),h.addMany(p,0,2,0),A)h.addMany([24,26,153,154],E,3,0),h.addMany(g(128,144),E,3,0),h.addMany(g(144,152),E,3,0),h.add(156,E,0,0),h.add(27,E,11,1),h.add(157,E,4,8),h.addMany([152,158,159],E,0,7),h.add(155,E,11,3),h.add(144,E,11,9);return h.addMany(T,0,3,0),h.addMany(T,1,3,1),h.add(127,1,0,1),h.addMany(T,8,0,8),h.addMany(T,3,3,3),h.add(127,3,0,3),h.addMany(T,4,3,4),h.add(127,4,0,4),h.addMany(T,6,3,6),h.addMany(T,5,3,5),h.add(127,5,0,5),h.addMany(T,2,3,2),h.add(127,2,0,2),h.add(93,1,4,8),h.addMany(p,8,5,8),h.add(127,8,5,8),h.addMany([156,27,24,26,7],8,6,0),h.addMany(g(28,32),8,0,8),h.addMany([88,94,95],1,0,7),h.addMany(p,7,0,7),h.addMany(T,7,0,7),h.add(156,7,0,0),h.add(127,7,0,7),h.add(91,1,11,3),h.addMany(g(64,127),3,7,0),h.addMany(g(48,60),3,8,4),h.addMany([60,61,62,63],3,9,4),h.addMany(g(48,60),4,8,4),h.addMany(g(64,127),4,7,0),h.addMany([60,61,62,63],4,0,6),h.addMany(g(32,64),6,0,6),h.add(127,6,0,6),h.addMany(g(64,127),6,0,0),h.addMany(g(32,48),3,9,5),h.addMany(g(32,48),5,9,5),h.addMany(g(48,64),5,0,6),h.addMany(g(64,127),5,7,0),h.addMany(g(32,48),4,9,5),h.addMany(g(32,48),1,9,2),h.addMany(g(32,48),2,9,2),h.addMany(g(48,127),2,10,0),h.addMany(g(48,80),1,10,0),h.addMany(g(81,88),1,10,0),h.addMany([89,90,92],1,10,0),h.addMany(g(96,127),1,10,0),h.add(80,1,11,9),h.addMany(T,9,0,9),h.add(127,9,0,9),h.addMany(g(28,32),9,0,9),h.addMany(g(32,48),9,9,12),h.addMany(g(48,60),9,8,10),h.addMany([60,61,62,63],9,9,10),h.addMany(T,11,0,11),h.addMany(g(32,128),11,0,11),h.addMany(g(28,32),11,0,11),h.addMany(T,10,0,10),h.add(127,10,0,10),h.addMany(g(28,32),10,0,10),h.addMany(g(48,60),10,8,10),h.addMany([60,61,62,63],10,0,11),h.addMany(g(32,48),10,9,12),h.addMany(T,12,0,12),h.add(127,12,0,12),h.addMany(g(28,32),12,0,12),h.addMany(g(32,48),12,9,12),h.addMany(g(48,64),12,0,11),h.addMany(g(64,127),12,12,13),h.addMany(g(64,127),10,12,13),h.addMany(g(64,127),9,12,13),h.addMany(T,13,13,13),h.addMany(p,13,13,13),h.add(127,13,0,13),h.addMany([27,156,24,26],13,14,0),h.add(M,0,2,0),h.add(M,8,5,8),h.add(M,6,0,6),h.add(M,11,0,11),h.add(M,13,13,13),h})();class b extends m.Disposable{constructor(_=o.VT500_TRANSITION_TABLE){super(),this._transitions=_,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new w.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(g,p,T)=>{},this._executeHandlerFb=g=>{},this._csiHandlerFb=(g,p)=>{},this._escHandlerFb=g=>{},this._errorHandlerFb=g=>g,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,m.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new d.OscParser),this._dcsParser=this.register(new k.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(_,g=[64,126]){let p=0;if(_.prefix){if(_.prefix.length>1)throw new Error("only one byte as prefix supported");if(p=_.prefix.charCodeAt(0),p&&60>p||p>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(_.intermediates){if(_.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let A=0;A<_.intermediates.length;++A){const E=_.intermediates.charCodeAt(A);if(32>E||E>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");p<<=8,p|=E}}if(_.final.length!==1)throw new Error("final must be a single byte");const T=_.final.charCodeAt(0);if(g[0]>T||T>g[1])throw new Error(`final must be in range ${g[0]} .. ${g[1]}`);return p<<=8,p|=T,p}identToString(_){const g=[];for(;_;)g.push(String.fromCharCode(255&_)),_>>=8;return g.reverse().join("")}setPrintHandler(_){this._printHandler=_}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(_,g){const p=this._identifier(_,[48,126]);this._escHandlers[p]===void 0&&(this._escHandlers[p]=[]);const T=this._escHandlers[p];return T.push(g),{dispose:()=>{const A=T.indexOf(g);A!==-1&&T.splice(A,1)}}}clearEscHandler(_){this._escHandlers[this._identifier(_,[48,126])]&&delete this._escHandlers[this._identifier(_,[48,126])]}setEscHandlerFallback(_){this._escHandlerFb=_}setExecuteHandler(_,g){this._executeHandlers[_.charCodeAt(0)]=g}clearExecuteHandler(_){this._executeHandlers[_.charCodeAt(0)]&&delete this._executeHandlers[_.charCodeAt(0)]}setExecuteHandlerFallback(_){this._executeHandlerFb=_}registerCsiHandler(_,g){const p=this._identifier(_);this._csiHandlers[p]===void 0&&(this._csiHandlers[p]=[]);const T=this._csiHandlers[p];return T.push(g),{dispose:()=>{const A=T.indexOf(g);A!==-1&&T.splice(A,1)}}}clearCsiHandler(_){this._csiHandlers[this._identifier(_)]&&delete this._csiHandlers[this._identifier(_)]}setCsiHandlerFallback(_){this._csiHandlerFb=_}registerDcsHandler(_,g){return this._dcsParser.registerHandler(this._identifier(_),g)}clearDcsHandler(_){this._dcsParser.clearHandler(this._identifier(_))}setDcsHandlerFallback(_){this._dcsParser.setHandlerFallback(_)}registerOscHandler(_,g){return this._oscParser.registerHandler(_,g)}clearOscHandler(_){this._oscParser.clearHandler(_)}setOscHandlerFallback(_){this._oscParser.setHandlerFallback(_)}setErrorHandler(_){this._errorHandler=_}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(_,g,p,T,A){this._parseStack.state=_,this._parseStack.handlers=g,this._parseStack.handlerPos=p,this._parseStack.transition=T,this._parseStack.chunkPos=A}parse(_,g,p){let T,A=0,E=0,S=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,S=this._parseStack.chunkPos+1;else{if(p===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const x=this._parseStack.handlers;let R=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(p===!1&&R>-1){for(;R>=0&&(T=x[R](this._params),T!==!0);R--)if(T instanceof Promise)return this._parseStack.handlerPos=R,T}this._parseStack.handlers=[];break;case 4:if(p===!1&&R>-1){for(;R>=0&&(T=x[R](),T!==!0);R--)if(T instanceof Promise)return this._parseStack.handlerPos=R,T}this._parseStack.handlers=[];break;case 6:if(A=_[this._parseStack.chunkPos],T=this._dcsParser.unhook(A!==24&&A!==26,p),T)return T;A===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(A=_[this._parseStack.chunkPos],T=this._oscParser.end(A!==24&&A!==26,p),T)return T;A===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,S=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let x=S;x<g;++x){switch(A=_[x],E=this._transitions.table[this.currentState<<8|(A<160?A:M)],E>>4){case 2:for(let F=x+1;;++F){if(F>=g||(A=_[F])<32||A>126&&A<M){this._printHandler(_,x,F),x=F-1;break}if(++F>=g||(A=_[F])<32||A>126&&A<M){this._printHandler(_,x,F),x=F-1;break}if(++F>=g||(A=_[F])<32||A>126&&A<M){this._printHandler(_,x,F),x=F-1;break}if(++F>=g||(A=_[F])<32||A>126&&A<M){this._printHandler(_,x,F),x=F-1;break}}break;case 3:this._executeHandlers[A]?this._executeHandlers[A]():this._executeHandlerFb(A),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:x,code:A,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const R=this._csiHandlers[this._collect<<8|A];let I=R?R.length-1:-1;for(;I>=0&&(T=R[I](this._params),T!==!0);I--)if(T instanceof Promise)return this._preserveStack(3,R,I,E,x),T;I<0&&this._csiHandlerFb(this._collect<<8|A,this._params),this.precedingJoinState=0;break;case 8:do switch(A){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(A-48)}while(++x<g&&(A=_[x])>47&&A<60);x--;break;case 9:this._collect<<=8,this._collect|=A;break;case 10:const D=this._escHandlers[this._collect<<8|A];let P=D?D.length-1:-1;for(;P>=0&&(T=D[P](),T!==!0);P--)if(T instanceof Promise)return this._preserveStack(4,D,P,E,x),T;P<0&&this._escHandlerFb(this._collect<<8|A),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|A,this._params);break;case 13:for(let F=x+1;;++F)if(F>=g||(A=_[F])===24||A===26||A===27||A>127&&A<M){this._dcsParser.put(_,x,F),x=F-1;break}break;case 14:if(T=this._dcsParser.unhook(A!==24&&A!==26),T)return this._preserveStack(6,[],0,E,x),T;A===27&&(E|=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 F=x+1;;F++)if(F>=g||(A=_[F])<32||A>127&&A<M){this._oscParser.put(_,x,F),x=F-1;break}break;case 6:if(T=this._oscParser.end(A!==24&&A!==26),T)return this._preserveStack(5,[],0,E,x),T;A===27&&(E|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&E}}}o.EscapeSequenceParser=b},6242:(v,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.OscHandler=o.OscParser=void 0;const m=c(5770),w=c(482),d=[];o.OscParser=class{constructor(){this._state=0,this._active=d,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(k,L){this._handlers[k]===void 0&&(this._handlers[k]=[]);const M=this._handlers[k];return M.push(L),{dispose:()=>{const b=M.indexOf(L);b!==-1&&M.splice(b,1)}}}clearHandler(k){this._handlers[k]&&delete this._handlers[k]}setHandlerFallback(k){this._handlerFb=k}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=d}reset(){if(this._state===2)for(let k=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;k>=0;--k)this._active[k].end(!1);this._stack.paused=!1,this._active=d,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||d,this._active.length)for(let k=this._active.length-1;k>=0;k--)this._active[k].start();else this._handlerFb(this._id,"START")}_put(k,L,M){if(this._active.length)for(let b=this._active.length-1;b>=0;b--)this._active[b].put(k,L,M);else this._handlerFb(this._id,"PUT",(0,w.utf32ToString)(k,L,M))}start(){this.reset(),this._state=1}put(k,L,M){if(this._state!==3){if(this._state===1)for(;L<M;){const b=k[L++];if(b===59){this._state=2,this._start();break}if(b<48||57<b)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+b-48}this._state===2&&M-L>0&&this._put(k,L,M)}}end(k,L=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let M=!1,b=this._active.length-1,h=!1;if(this._stack.paused&&(b=this._stack.loopPosition-1,M=L,h=this._stack.fallThrough,this._stack.paused=!1),!h&&M===!1){for(;b>=0&&(M=this._active[b].end(k),M!==!0);b--)if(M instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=b,this._stack.fallThrough=!1,M;b--}for(;b>=0;b--)if(M=this._active[b].end(!1),M instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=b,this._stack.fallThrough=!0,M}else this._handlerFb(this._id,"END",k);this._active=d,this._id=-1,this._state=0}}},o.OscHandler=class{constructor(k){this._handler=k,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(k,L,M){this._hitLimit||(this._data+=(0,w.utf32ToString)(k,L,M),this._data.length>m.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(k){let L=!1;if(this._hitLimit)L=!1;else if(k&&(L=this._handler(this._data),L instanceof Promise))return L.then((M=>(this._data="",this._hitLimit=!1,M)));return this._data="",this._hitLimit=!1,L}}},8742:(v,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Params=void 0;const c=2147483647;class m{static fromArray(d){const k=new m;if(!d.length)return k;for(let L=Array.isArray(d[0])?1:0;L<d.length;++L){const M=d[L];if(Array.isArray(M))for(let b=0;b<M.length;++b)k.addSubParam(M[b]);else k.addParam(M)}return k}constructor(d=32,k=32){if(this.maxLength=d,this.maxSubParamsLength=k,k>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(d),this.length=0,this._subParams=new Int32Array(k),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(d),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const d=new m(this.maxLength,this.maxSubParamsLength);return d.params.set(this.params),d.length=this.length,d._subParams.set(this._subParams),d._subParamsLength=this._subParamsLength,d._subParamsIdx.set(this._subParamsIdx),d._rejectDigits=this._rejectDigits,d._rejectSubDigits=this._rejectSubDigits,d._digitIsSub=this._digitIsSub,d}toArray(){const d=[];for(let k=0;k<this.length;++k){d.push(this.params[k]);const L=this._subParamsIdx[k]>>8,M=255&this._subParamsIdx[k];M-L>0&&d.push(Array.prototype.slice.call(this._subParams,L,M))}return d}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(d){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(d<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=d>c?c:d}}addSubParam(d){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(d<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=d>c?c:d,this._subParamsIdx[this.length-1]++}}hasSubParams(d){return(255&this._subParamsIdx[d])-(this._subParamsIdx[d]>>8)>0}getSubParams(d){const k=this._subParamsIdx[d]>>8,L=255&this._subParamsIdx[d];return L-k>0?this._subParams.subarray(k,L):null}getSubParamsAll(){const d={};for(let k=0;k<this.length;++k){const L=this._subParamsIdx[k]>>8,M=255&this._subParamsIdx[k];M-L>0&&(d[k]=this._subParams.slice(L,M))}return d}addDigit(d){let k;if(this._rejectDigits||!(k=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const L=this._digitIsSub?this._subParams:this.params,M=L[k-1];L[k-1]=~M?Math.min(10*M+d,c):d}}o.Params=m},5741:(v,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.AddonManager=void 0,o.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let c=this._addons.length-1;c>=0;c--)this._addons[c].instance.dispose()}loadAddon(c,m){const w={instance:m,dispose:m.dispose,isDisposed:!1};this._addons.push(w),m.dispose=()=>this._wrappedAddonDispose(w),m.activate(c)}_wrappedAddonDispose(c){if(c.isDisposed)return;let m=-1;for(let w=0;w<this._addons.length;w++)if(this._addons[w]===c){m=w;break}if(m===-1)throw new Error("Could not dispose an addon that has not been loaded");c.isDisposed=!0,c.dispose.apply(c.instance),this._addons.splice(m,1)}}},8771:(v,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferApiView=void 0;const m=c(3785),w=c(511);o.BufferApiView=class{constructor(d,k){this._buffer=d,this.type=k}init(d){return this._buffer=d,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(d){const k=this._buffer.lines.get(d);if(k)return new m.BufferLineApiView(k)}getNullCell(){return new w.CellData}}},3785:(v,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferLineApiView=void 0;const m=c(511);o.BufferLineApiView=class{constructor(w){this._line=w}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(w,d){if(!(w<0||w>=this._line.length))return d?(this._line.loadCell(w,d),d):this._line.loadCell(w,new m.CellData)}translateToString(w,d,k){return this._line.translateToString(w,d,k)}}},8285:(v,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferNamespaceApi=void 0;const m=c(8771),w=c(8460),d=c(844);class k extends d.Disposable{constructor(M){super(),this._core=M,this._onBufferChange=this.register(new w.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new m.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new m.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}o.BufferNamespaceApi=k},7975:(v,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ParserApi=void 0,o.ParserApi=class{constructor(c){this._core=c}registerCsiHandler(c,m){return this._core.registerCsiHandler(c,(w=>m(w.toArray())))}addCsiHandler(c,m){return this.registerCsiHandler(c,m)}registerDcsHandler(c,m){return this._core.registerDcsHandler(c,((w,d)=>m(w,d.toArray())))}addDcsHandler(c,m){return this.registerDcsHandler(c,m)}registerEscHandler(c,m){return this._core.registerEscHandler(c,m)}addEscHandler(c,m){return this.registerEscHandler(c,m)}registerOscHandler(c,m){return this._core.registerOscHandler(c,m)}addOscHandler(c,m){return this.registerOscHandler(c,m)}}},7090:(v,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeApi=void 0,o.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(v,o,c){var m=this&&this.__decorate||function(h,_,g,p){var T,A=arguments.length,E=A<3?_:p===null?p=Object.getOwnPropertyDescriptor(_,g):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(h,_,g,p);else for(var S=h.length-1;S>=0;S--)(T=h[S])&&(E=(A<3?T(E):A>3?T(_,g,E):T(_,g))||E);return A>3&&E&&Object.defineProperty(_,g,E),E},w=this&&this.__param||function(h,_){return function(g,p){_(g,p,h)}};Object.defineProperty(o,"__esModule",{value:!0}),o.BufferService=o.MINIMUM_ROWS=o.MINIMUM_COLS=void 0;const d=c(8460),k=c(844),L=c(5295),M=c(2585);o.MINIMUM_COLS=2,o.MINIMUM_ROWS=1;let b=o.BufferService=class extends k.Disposable{get buffer(){return this.buffers.active}constructor(h){super(),this.isUserScrolling=!1,this._onResize=this.register(new d.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new d.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(h.rawOptions.cols||0,o.MINIMUM_COLS),this.rows=Math.max(h.rawOptions.rows||0,o.MINIMUM_ROWS),this.buffers=this.register(new L.BufferSet(h,this))}resize(h,_){this.cols=h,this.rows=_,this.buffers.resize(h,_),this._onResize.fire({cols:h,rows:_})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(h,_=!1){const g=this.buffer;let p;p=this._cachedBlankLine,p&&p.length===this.cols&&p.getFg(0)===h.fg&&p.getBg(0)===h.bg||(p=g.getBlankLine(h,_),this._cachedBlankLine=p),p.isWrapped=_;const T=g.ybase+g.scrollTop,A=g.ybase+g.scrollBottom;if(g.scrollTop===0){const E=g.lines.isFull;A===g.lines.length-1?E?g.lines.recycle().copyFrom(p):g.lines.push(p.clone()):g.lines.splice(A+1,0,p.clone()),E?this.isUserScrolling&&(g.ydisp=Math.max(g.ydisp-1,0)):(g.ybase++,this.isUserScrolling||g.ydisp++)}else{const E=A-T+1;g.lines.shiftElements(T+1,E-1,-1),g.lines.set(A,p.clone())}this.isUserScrolling||(g.ydisp=g.ybase),this._onScroll.fire(g.ydisp)}scrollLines(h,_,g){const p=this.buffer;if(h<0){if(p.ydisp===0)return;this.isUserScrolling=!0}else h+p.ydisp>=p.ybase&&(this.isUserScrolling=!1);const T=p.ydisp;p.ydisp=Math.max(Math.min(p.ydisp+h,p.ybase),0),T!==p.ydisp&&(_||this._onScroll.fire(p.ydisp))}};o.BufferService=b=m([w(0,M.IOptionsService)],b)},7994:(v,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CharsetService=void 0,o.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(c){this.glevel=c,this.charset=this._charsets[c]}setgCharset(c,m){this._charsets[c]=m,this.glevel===c&&(this.charset=m)}}},1753:function(v,o,c){var m=this&&this.__decorate||function(p,T,A,E){var S,x=arguments.length,R=x<3?T:E===null?E=Object.getOwnPropertyDescriptor(T,A):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(p,T,A,E);else for(var I=p.length-1;I>=0;I--)(S=p[I])&&(R=(x<3?S(R):x>3?S(T,A,R):S(T,A))||R);return x>3&&R&&Object.defineProperty(T,A,R),R},w=this&&this.__param||function(p,T){return function(A,E){T(A,E,p)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CoreMouseService=void 0;const d=c(2585),k=c(8460),L=c(844),M={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:p=>p.button!==4&&p.action===1&&(p.ctrl=!1,p.alt=!1,p.shift=!1,!0)},VT200:{events:19,restrict:p=>p.action!==32},DRAG:{events:23,restrict:p=>p.action!==32||p.button!==3},ANY:{events:31,restrict:p=>!0}};function b(p,T){let A=(p.ctrl?16:0)|(p.shift?4:0)|(p.alt?8:0);return p.button===4?(A|=64,A|=p.action):(A|=3&p.button,4&p.button&&(A|=64),8&p.button&&(A|=128),p.action===32?A|=32:p.action!==0||T||(A|=3)),A}const h=String.fromCharCode,_={DEFAULT:p=>{const T=[b(p,!1)+32,p.col+32,p.row+32];return T[0]>255||T[1]>255||T[2]>255?"":`\x1B[M${h(T[0])}${h(T[1])}${h(T[2])}`},SGR:p=>{const T=p.action===0&&p.button!==4?"m":"M";return`\x1B[<${b(p,!0)};${p.col};${p.row}${T}`},SGR_PIXELS:p=>{const T=p.action===0&&p.button!==4?"m":"M";return`\x1B[<${b(p,!0)};${p.x};${p.y}${T}`}};let g=o.CoreMouseService=class extends L.Disposable{constructor(p,T){super(),this._bufferService=p,this._coreService=T,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new k.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const A of Object.keys(M))this.addProtocol(A,M[A]);for(const A of Object.keys(_))this.addEncoding(A,_[A]);this.reset()}addProtocol(p,T){this._protocols[p]=T}addEncoding(p,T){this._encodings[p]=T}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(p){if(!this._protocols[p])throw new Error(`unknown protocol "${p}"`);this._activeProtocol=p,this._onProtocolChange.fire(this._protocols[p].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(p){if(!this._encodings[p])throw new Error(`unknown encoding "${p}"`);this._activeEncoding=p}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(p){if(p.col<0||p.col>=this._bufferService.cols||p.row<0||p.row>=this._bufferService.rows||p.button===4&&p.action===32||p.button===3&&p.action!==32||p.button!==4&&(p.action===2||p.action===3)||(p.col++,p.row++,p.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,p,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(p))return!1;const T=this._encodings[this._activeEncoding](p);return T&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(T):this._coreService.triggerDataEvent(T,!0)),this._lastEvent=p,!0}explainEvents(p){return{down:!!(1&p),up:!!(2&p),drag:!!(4&p),move:!!(8&p),wheel:!!(16&p)}}_equalEvents(p,T,A){if(A){if(p.x!==T.x||p.y!==T.y)return!1}else if(p.col!==T.col||p.row!==T.row)return!1;return p.button===T.button&&p.action===T.action&&p.ctrl===T.ctrl&&p.alt===T.alt&&p.shift===T.shift}};o.CoreMouseService=g=m([w(0,d.IBufferService),w(1,d.ICoreService)],g)},6975:function(v,o,c){var m=this&&this.__decorate||function(g,p,T,A){var E,S=arguments.length,x=S<3?p:A===null?A=Object.getOwnPropertyDescriptor(p,T):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(g,p,T,A);else for(var R=g.length-1;R>=0;R--)(E=g[R])&&(x=(S<3?E(x):S>3?E(p,T,x):E(p,T))||x);return S>3&&x&&Object.defineProperty(p,T,x),x},w=this&&this.__param||function(g,p){return function(T,A){p(T,A,g)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CoreService=void 0;const d=c(1439),k=c(8460),L=c(844),M=c(2585),b=Object.freeze({insertMode:!1}),h=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let _=o.CoreService=class extends L.Disposable{constructor(g,p,T){super(),this._bufferService=g,this._logService=p,this._optionsService=T,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new k.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new k.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new k.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new k.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,d.clone)(b),this.decPrivateModes=(0,d.clone)(h)}reset(){this.modes=(0,d.clone)(b),this.decPrivateModes=(0,d.clone)(h)}triggerDataEvent(g,p=!1){if(this._optionsService.rawOptions.disableStdin)return;const T=this._bufferService.buffer;p&&this._optionsService.rawOptions.scrollOnUserInput&&T.ybase!==T.ydisp&&this._onRequestScrollToBottom.fire(),p&&this._onUserInput.fire(),this._logService.debug(`sending data "${g}"`,(()=>g.split("").map((A=>A.charCodeAt(0))))),this._onData.fire(g)}triggerBinaryEvent(g){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${g}"`,(()=>g.split("").map((p=>p.charCodeAt(0))))),this._onBinary.fire(g))}};o.CoreService=_=m([w(0,M.IBufferService),w(1,M.ILogService),w(2,M.IOptionsService)],_)},9074:(v,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DecorationService=void 0;const m=c(8055),w=c(8460),d=c(844),k=c(6106);let L=0,M=0;class b extends d.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new k.SortedList((g=>g==null?void 0:g.marker.line)),this._onDecorationRegistered=this.register(new w.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new w.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,d.toDisposable)((()=>this.reset())))}registerDecoration(g){if(g.marker.isDisposed)return;const p=new h(g);if(p){const T=p.marker.onDispose((()=>p.dispose()));p.onDispose((()=>{p&&(this._decorations.delete(p)&&this._onDecorationRemoved.fire(p),T.dispose())})),this._decorations.insert(p),this._onDecorationRegistered.fire(p)}return p}reset(){for(const g of this._decorations.values())g.dispose();this._decorations.clear()}*getDecorationsAtCell(g,p,T){let A=0,E=0;for(const S of this._decorations.getKeyIterator(p))A=S.options.x??0,E=A+(S.options.width??1),g>=A&&g<E&&(!T||(S.options.layer??"bottom")===T)&&(yield S)}forEachDecorationAtCell(g,p,T,A){this._decorations.forEachByKey(p,(E=>{L=E.options.x??0,M=L+(E.options.width??1),g>=L&&g<M&&(!T||(E.options.layer??"bottom")===T)&&A(E)}))}}o.DecorationService=b;class h extends d.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=m.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=m.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(g){super(),this.options=g,this.onRenderEmitter=this.register(new w.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new w.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=g.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(v,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.InstantiationService=o.ServiceCollection=void 0;const m=c(2585),w=c(8343);class d{constructor(...L){this._entries=new Map;for(const[M,b]of L)this.set(M,b)}set(L,M){const b=this._entries.get(L);return this._entries.set(L,M),b}forEach(L){for(const[M,b]of this._entries.entries())L(M,b)}has(L){return this._entries.has(L)}get(L){return this._entries.get(L)}}o.ServiceCollection=d,o.InstantiationService=class{constructor(){this._services=new d,this._services.set(m.IInstantiationService,this)}setService(k,L){this._services.set(k,L)}getService(k){return this._services.get(k)}createInstance(k,...L){const M=(0,w.getServiceDependencies)(k).sort(((_,g)=>_.index-g.index)),b=[];for(const _ of M){const g=this._services.get(_.id);if(!g)throw new Error(`[createInstance] ${k.name} depends on UNKNOWN service ${_.id}.`);b.push(g)}const h=M.length>0?M[0].index:L.length;if(L.length!==h)throw new Error(`[createInstance] First service dependency of ${k.name} at position ${h+1} conflicts with ${L.length} static arguments`);return new k(...L,...b)}}},7866:function(v,o,c){var m=this&&this.__decorate||function(h,_,g,p){var T,A=arguments.length,E=A<3?_:p===null?p=Object.getOwnPropertyDescriptor(_,g):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(h,_,g,p);else for(var S=h.length-1;S>=0;S--)(T=h[S])&&(E=(A<3?T(E):A>3?T(_,g,E):T(_,g))||E);return A>3&&E&&Object.defineProperty(_,g,E),E},w=this&&this.__param||function(h,_){return function(g,p){_(g,p,h)}};Object.defineProperty(o,"__esModule",{value:!0}),o.traceCall=o.setTraceLogger=o.LogService=void 0;const d=c(844),k=c(2585),L={trace:k.LogLevelEnum.TRACE,debug:k.LogLevelEnum.DEBUG,info:k.LogLevelEnum.INFO,warn:k.LogLevelEnum.WARN,error:k.LogLevelEnum.ERROR,off:k.LogLevelEnum.OFF};let M,b=o.LogService=class extends d.Disposable{get logLevel(){return this._logLevel}constructor(h){super(),this._optionsService=h,this._logLevel=k.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),M=this}_updateLogLevel(){this._logLevel=L[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(h){for(let _=0;_<h.length;_++)typeof h[_]=="function"&&(h[_]=h[_]())}_log(h,_,g){this._evalLazyOptionalParams(g),h.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+_,...g)}trace(h,..._){var g;this._logLevel<=k.LogLevelEnum.TRACE&&this._log(((g=this._optionsService.options.logger)==null?void 0:g.trace.bind(this._optionsService.options.logger))??console.log,h,_)}debug(h,..._){var g;this._logLevel<=k.LogLevelEnum.DEBUG&&this._log(((g=this._optionsService.options.logger)==null?void 0:g.debug.bind(this._optionsService.options.logger))??console.log,h,_)}info(h,..._){var g;this._logLevel<=k.LogLevelEnum.INFO&&this._log(((g=this._optionsService.options.logger)==null?void 0:g.info.bind(this._optionsService.options.logger))??console.info,h,_)}warn(h,..._){var g;this._logLevel<=k.LogLevelEnum.WARN&&this._log(((g=this._optionsService.options.logger)==null?void 0:g.warn.bind(this._optionsService.options.logger))??console.warn,h,_)}error(h,..._){var g;this._logLevel<=k.LogLevelEnum.ERROR&&this._log(((g=this._optionsService.options.logger)==null?void 0:g.error.bind(this._optionsService.options.logger))??console.error,h,_)}};o.LogService=b=m([w(0,k.IOptionsService)],b),o.setTraceLogger=function(h){M=h},o.traceCall=function(h,_,g){if(typeof g.value!="function")throw new Error("not supported");const p=g.value;g.value=function(...T){if(M.logLevel!==k.LogLevelEnum.TRACE)return p.apply(this,T);M.trace(`GlyphRenderer#${p.name}(${T.map((E=>JSON.stringify(E))).join(", ")})`);const A=p.apply(this,T);return M.trace(`GlyphRenderer#${p.name} return`,A),A}}},7302:(v,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.OptionsService=o.DEFAULT_OPTIONS=void 0;const m=c(8460),w=c(844),d=c(6114);o.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:d.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const k=["normal","bold","100","200","300","400","500","600","700","800","900"];class L extends w.Disposable{constructor(b){super(),this._onOptionChange=this.register(new m.EventEmitter),this.onOptionChange=this._onOptionChange.event;const h={...o.DEFAULT_OPTIONS};for(const _ in b)if(_ in h)try{const g=b[_];h[_]=this._sanitizeAndValidateOption(_,g)}catch(g){console.error(g)}this.rawOptions=h,this.options={...h},this._setupOptions(),this.register((0,w.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(b,h){return this.onOptionChange((_=>{_===b&&h(this.rawOptions[b])}))}onMultipleOptionChange(b,h){return this.onOptionChange((_=>{b.indexOf(_)!==-1&&h()}))}_setupOptions(){const b=_=>{if(!(_ in o.DEFAULT_OPTIONS))throw new Error(`No option with key "${_}"`);return this.rawOptions[_]},h=(_,g)=>{if(!(_ in o.DEFAULT_OPTIONS))throw new Error(`No option with key "${_}"`);g=this._sanitizeAndValidateOption(_,g),this.rawOptions[_]!==g&&(this.rawOptions[_]=g,this._onOptionChange.fire(_))};for(const _ in this.rawOptions){const g={get:b.bind(this,_),set:h.bind(this,_)};Object.defineProperty(this.options,_,g)}}_sanitizeAndValidateOption(b,h){switch(b){case"cursorStyle":if(h||(h=o.DEFAULT_OPTIONS[b]),!(function(_){return _==="block"||_==="underline"||_==="bar"})(h))throw new Error(`"${h}" is not a valid value for ${b}`);break;case"wordSeparator":h||(h=o.DEFAULT_OPTIONS[b]);break;case"fontWeight":case"fontWeightBold":if(typeof h=="number"&&1<=h&&h<=1e3)break;h=k.includes(h)?h:o.DEFAULT_OPTIONS[b];break;case"cursorWidth":h=Math.floor(h);case"lineHeight":case"tabStopWidth":if(h<1)throw new Error(`${b} cannot be less than 1, value: ${h}`);break;case"minimumContrastRatio":h=Math.max(1,Math.min(21,Math.round(10*h)/10));break;case"scrollback":if((h=Math.min(h,4294967295))<0)throw new Error(`${b} cannot be less than 0, value: ${h}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(h<=0)throw new Error(`${b} cannot be less than or equal to 0, value: ${h}`);break;case"rows":case"cols":if(!h&&h!==0)throw new Error(`${b} must be numeric, value: ${h}`);break;case"windowsPty":h=h??{}}return h}}o.OptionsService=L},2660:function(v,o,c){var m=this&&this.__decorate||function(L,M,b,h){var _,g=arguments.length,p=g<3?M:h===null?h=Object.getOwnPropertyDescriptor(M,b):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(L,M,b,h);else for(var T=L.length-1;T>=0;T--)(_=L[T])&&(p=(g<3?_(p):g>3?_(M,b,p):_(M,b))||p);return g>3&&p&&Object.defineProperty(M,b,p),p},w=this&&this.__param||function(L,M){return function(b,h){M(b,h,L)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OscLinkService=void 0;const d=c(2585);let k=o.OscLinkService=class{constructor(L){this._bufferService=L,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(L){const M=this._bufferService.buffer;if(L.id===void 0){const T=M.addMarker(M.ybase+M.y),A={data:L,id:this._nextId++,lines:[T]};return T.onDispose((()=>this._removeMarkerFromLink(A,T))),this._dataByLinkId.set(A.id,A),A.id}const b=L,h=this._getEntryIdKey(b),_=this._entriesWithId.get(h);if(_)return this.addLineToLink(_.id,M.ybase+M.y),_.id;const g=M.addMarker(M.ybase+M.y),p={id:this._nextId++,key:this._getEntryIdKey(b),data:b,lines:[g]};return g.onDispose((()=>this._removeMarkerFromLink(p,g))),this._entriesWithId.set(p.key,p),this._dataByLinkId.set(p.id,p),p.id}addLineToLink(L,M){const b=this._dataByLinkId.get(L);if(b&&b.lines.every((h=>h.line!==M))){const h=this._bufferService.buffer.addMarker(M);b.lines.push(h),h.onDispose((()=>this._removeMarkerFromLink(b,h)))}}getLinkData(L){var M;return(M=this._dataByLinkId.get(L))==null?void 0:M.data}_getEntryIdKey(L){return`${L.id};;${L.uri}`}_removeMarkerFromLink(L,M){const b=L.lines.indexOf(M);b!==-1&&(L.lines.splice(b,1),L.lines.length===0&&(L.data.id!==void 0&&this._entriesWithId.delete(L.key),this._dataByLinkId.delete(L.id)))}};o.OscLinkService=k=m([w(0,d.IBufferService)],k)},8343:(v,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.createDecorator=o.getServiceDependencies=o.serviceRegistry=void 0;const c="di$target",m="di$dependencies";o.serviceRegistry=new Map,o.getServiceDependencies=function(w){return w[m]||[]},o.createDecorator=function(w){if(o.serviceRegistry.has(w))return o.serviceRegistry.get(w);const d=function(k,L,M){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(b,h,_){h[c]===h?h[m].push({id:b,index:_}):(h[m]=[{id:b,index:_}],h[c]=h)})(d,k,M)};return d.toString=()=>w,o.serviceRegistry.set(w,d),d}},2585:(v,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.IDecorationService=o.IUnicodeService=o.IOscLinkService=o.IOptionsService=o.ILogService=o.LogLevelEnum=o.IInstantiationService=o.ICharsetService=o.ICoreService=o.ICoreMouseService=o.IBufferService=void 0;const m=c(8343);var w;o.IBufferService=(0,m.createDecorator)("BufferService"),o.ICoreMouseService=(0,m.createDecorator)("CoreMouseService"),o.ICoreService=(0,m.createDecorator)("CoreService"),o.ICharsetService=(0,m.createDecorator)("CharsetService"),o.IInstantiationService=(0,m.createDecorator)("InstantiationService"),(function(d){d[d.TRACE=0]="TRACE",d[d.DEBUG=1]="DEBUG",d[d.INFO=2]="INFO",d[d.WARN=3]="WARN",d[d.ERROR=4]="ERROR",d[d.OFF=5]="OFF"})(w||(o.LogLevelEnum=w={})),o.ILogService=(0,m.createDecorator)("LogService"),o.IOptionsService=(0,m.createDecorator)("OptionsService"),o.IOscLinkService=(0,m.createDecorator)("OscLinkService"),o.IUnicodeService=(0,m.createDecorator)("UnicodeService"),o.IDecorationService=(0,m.createDecorator)("DecorationService")},1480:(v,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeService=void 0;const m=c(8460),w=c(225);class d{static extractShouldJoin(L){return(1&L)!=0}static extractWidth(L){return L>>1&3}static extractCharKind(L){return L>>3}static createPropertyValue(L,M,b=!1){return(16777215&L)<<3|(3&M)<<1|(b?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new m.EventEmitter,this.onChange=this._onChange.event;const L=new w.UnicodeV6;this.register(L),this._active=L.version,this._activeProvider=L}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(L){if(!this._providers[L])throw new Error(`unknown Unicode version "${L}"`);this._active=L,this._activeProvider=this._providers[L],this._onChange.fire(L)}register(L){this._providers[L.version]=L}wcwidth(L){return this._activeProvider.wcwidth(L)}getStringCellWidth(L){let M=0,b=0;const h=L.length;for(let _=0;_<h;++_){let g=L.charCodeAt(_);if(55296<=g&&g<=56319){if(++_>=h)return M+this.wcwidth(g);const A=L.charCodeAt(_);56320<=A&&A<=57343?g=1024*(g-55296)+A-56320+65536:M+=this.wcwidth(A)}const p=this.charProperties(g,b);let T=d.extractWidth(p);d.extractShouldJoin(p)&&(T-=d.extractWidth(b)),M+=T,b=p}return M}charProperties(L,M){return this._activeProvider.charProperties(L,M)}}o.UnicodeService=d}},l={};function a(v){var o=l[v];if(o!==void 0)return o.exports;var c=l[v]={exports:{}};return r[v].call(c.exports,c,c.exports,a),c.exports}var y={};return(()=>{var v=y;Object.defineProperty(v,"__esModule",{value:!0}),v.Terminal=void 0;const o=a(9042),c=a(3236),m=a(844),w=a(5741),d=a(8285),k=a(7975),L=a(7090),M=["cols","rows"];class b extends m.Disposable{constructor(_){super(),this._core=this.register(new c.Terminal(_)),this._addonManager=this.register(new w.AddonManager),this._publicOptions={...this._core.options};const g=T=>this._core.options[T],p=(T,A)=>{this._checkReadonlyOptions(T),this._core.options[T]=A};for(const T in this._core.options){const A={get:g.bind(this,T),set:p.bind(this,T)};Object.defineProperty(this._publicOptions,T,A)}}_checkReadonlyOptions(_){if(M.includes(_))throw new Error(`Option "${_}" 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 k.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new L.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 d.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const _=this._core.coreService.decPrivateModes;let g="none";switch(this._core.coreMouseService.activeProtocol){case"X10":g="x10";break;case"VT200":g="vt200";break;case"DRAG":g="drag";break;case"ANY":g="any"}return{applicationCursorKeysMode:_.applicationCursorKeys,applicationKeypadMode:_.applicationKeypad,bracketedPasteMode:_.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:g,originMode:_.origin,reverseWraparoundMode:_.reverseWraparound,sendFocusMode:_.sendFocus,wraparoundMode:_.wraparound}}get options(){return this._publicOptions}set options(_){for(const g in _)this._publicOptions[g]=_[g]}blur(){this._core.blur()}focus(){this._core.focus()}input(_,g=!0){this._core.input(_,g)}resize(_,g){this._verifyIntegers(_,g),this._core.resize(_,g)}open(_){this._core.open(_)}attachCustomKeyEventHandler(_){this._core.attachCustomKeyEventHandler(_)}attachCustomWheelEventHandler(_){this._core.attachCustomWheelEventHandler(_)}registerLinkProvider(_){return this._core.registerLinkProvider(_)}registerCharacterJoiner(_){return this._checkProposedApi(),this._core.registerCharacterJoiner(_)}deregisterCharacterJoiner(_){this._checkProposedApi(),this._core.deregisterCharacterJoiner(_)}registerMarker(_=0){return this._verifyIntegers(_),this._core.registerMarker(_)}registerDecoration(_){return this._checkProposedApi(),this._verifyPositiveIntegers(_.x??0,_.width??0,_.height??0),this._core.registerDecoration(_)}hasSelection(){return this._core.hasSelection()}select(_,g,p){this._verifyIntegers(_,g,p),this._core.select(_,g,p)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(_,g){this._verifyIntegers(_,g),this._core.selectLines(_,g)}dispose(){super.dispose()}scrollLines(_){this._verifyIntegers(_),this._core.scrollLines(_)}scrollPages(_){this._verifyIntegers(_),this._core.scrollPages(_)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(_){this._verifyIntegers(_),this._core.scrollToLine(_)}clear(){this._core.clear()}write(_,g){this._core.write(_,g)}writeln(_,g){this._core.write(_),this._core.write(`\r
|
|
130
|
+
`,g)}paste(_){this._core.paste(_)}refresh(_,g){this._verifyIntegers(_,g),this._core.refresh(_,g)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(_){this._addonManager.loadAddon(this,_)}static get strings(){return o}_verifyIntegers(..._){for(const g of _)if(g===1/0||isNaN(g)||g%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(..._){for(const g of _)if(g&&(g===1/0||isNaN(g)||g%1!=0||g<0))throw new Error("This API only accepts positive integers")}}v.Terminal=b})(),y})()))})(Hu)),Hu.exports}var Q1=X1();function J1(t){return t.toLowerCase().startsWith("win")}function Z1(t){return t.keyCode===86&&t.ctrlKey&&!t.shiftKey&&!t.altKey&&!t.metaKey}const eS=8,tS=100,nS=80,vm=6,_m=.02,rS=.95,sS=50;function iS(t,e){return Math.hypot(t,e)>eS}function oS(t,e){const r=t[t.length-1];if(r===void 0||e-r.t>nS)return 0;const l=t.filter(v=>r.t-v.t<=tS),a=l[0];if(a===void 0||l.length<2||r.t===a.t)return 0;const y=(a.y-r.y)/(r.t-a.t);return Math.max(-vm,Math.min(vm,y))}function lS(t,e){if(Math.abs(t)<_m)return{delta:0,velocity:0};const r=Math.max(0,Math.min(sS,e)),l=t*rS**(r/16);return{delta:t*r,velocity:Math.abs(l)<_m?0:l}}function aS(t){const e=Math.trunc(t);return{pixels:e,rest:t-e}}const cS=60;function uS(){return new URLSearchParams(window.location.search).get("renderer")==="webgl"?"webgl":"canvas"}const wm={dark:{background:"#12141a",foreground:"#d8dee9",cursor:"#d8dee9",selectionBackground:"#2f3542"},light:{background:"#fbfbfd",foreground:"#22262e",cursor:"#22262e",selectionBackground:"#cfd8e3"}},bm={dark:1,light:4.5};function Jv({terminalId:t,connection:e,active:r,theme:l,autoFocus:a=!0,pasteOnCtrlV:y=!1}){const v=N.useRef(null),o=N.useRef(null),c=N.useRef(null),m=N.useRef(l);return m.current=l,N.useEffect(()=>{const w=v.current;if(w===null)return;const d=new Q1.Terminal({convertEol:!1,cursorBlink:!0,fontFamily:'"Cascadia Mono", "Consolas", "Menlo", "DejaVu Sans Mono", monospace',fontSize:14,lineHeight:1.2,scrollback:1e4,allowProposedApi:!0,theme:wm[m.current],minimumContrastRatio:bm[m.current]});o.current=d;const k=new z1.FitAddon;c.current=k,d.loadAddon(k),d.loadAddon(new V1.WebLinksAddon),d.open(w);let L=!1;const M=()=>{if(!(L||uS()!=="webgl")){L=!0;try{const te=new Y1.WebglAddon;te.onContextLoss(()=>te.dispose()),d.loadAddon(te)}catch{console.info("[terminal] WebGL no disponible; se usa el renderer por defecto.")}}};let b={cols:0,rows:0},h;const _=()=>w.clientWidth>0&&w.clientHeight>0,g=te=>{const{cols:ee,rows:ye}=d;ee<=0||ye<=0||!te&&ee===b.cols&&ye===b.rows||(b={cols:ee,rows:ye},e.send({type:"resize",terminalId:t,cols:ee,rows:ye}))};let p={atBottom:!0,line:0},T=!1;const A=()=>{if(T||!_())return;const te=d.buffer.active;p={atBottom:te.viewportY>=te.baseY,line:te.viewportY}},E=()=>{const te=d.buffer.active;if(te.baseY===0)return;const ee=p.atBottom?te.baseY:Math.min(p.line,te.baseY);d.scrollToLine(ee>0?ee-1:ee+1),d.scrollToLine(ee)},S=d.onRender(A),x=d.onScroll(A);let R=_();const I=()=>{if(_()){try{k.fit()}catch{return}T&&(E(),T=!1),d.cols>0&&d.rows>0&&M(),g(!1)}},D=()=>{window.clearTimeout(h),h=window.setTimeout(I,cS)},P=new ResizeObserver(()=>{const te=_();T=!0,te&&!R&&E(),R=te,D()});P.observe(w),window.addEventListener("resize",D);let F=null,z=0,q=0;const K=(te,ee,ye)=>{const ge=d.element;if(ge===void 0)return;const Be=aS(q+te);q=Be.rest,Be.pixels!==0&&ge.dispatchEvent(new WheelEvent("wheel",{deltaY:Be.pixels,deltaMode:WheelEvent.DOM_DELTA_PIXEL,clientX:ee,clientY:ye,bubbles:!0,cancelable:!0}))},V=()=>{window.cancelAnimationFrame(z),z=0},W=(te,ee,ye)=>{let ge=te,Be=performance.now();const Ue=ze=>{if(!_()){z=0;return}const gt=lS(ge,ze-Be);Be=ze,K(gt.delta,ee,ye),ge=gt.velocity,z=ge===0?0:window.requestAnimationFrame(Ue)};z=window.requestAnimationFrame(Ue)},O=(te,ee)=>{for(let ye=0;ye<te.length;ye++){const ge=te.item(ye);if(ge!==null&&ge.identifier===ee)return ge}return null},U=te=>{V(),q=0;const ee=te.touches.length===1?te.touches.item(0):null;F=ee===null?null:{id:ee.identifier,startX:ee.clientX,startY:ee.clientY,lastX:ee.clientX,lastY:ee.clientY,moving:!1,samples:[{t:te.timeStamp,y:ee.clientY}]}},H=te=>{if(te.stopPropagation(),F===null)return;const ee=O(te.touches,F.id);if(ee===null)return;if(!F.moving){if(!iS(ee.clientX-F.startX,ee.clientY-F.startY))return;F.moving=!0}te.cancelable&&te.preventDefault();const ye=F.lastY-ee.clientY;F.lastX=ee.clientX,F.lastY=ee.clientY,F.samples.push({t:te.timeStamp,y:ee.clientY}),F.samples.length>32&&F.samples.shift(),K(ye,ee.clientX,ee.clientY)},$=te=>{if(F===null||O(te.changedTouches,F.id)===null)return;const ee=F;if(F=null,!ee.moving)return;const ye=oS(ee.samples,te.timeStamp);ye!==0&&W(ye,ee.lastX,ee.lastY)},Z=()=>{F=null};w.addEventListener("touchstart",U,{capture:!0,passive:!0}),w.addEventListener("touchmove",H,{capture:!0,passive:!1}),w.addEventListener("touchend",$,{capture:!0,passive:!0}),w.addEventListener("touchcancel",Z,{capture:!0,passive:!0});const re=()=>{if(!(document.visibilityState!=="visible"||!_())){try{k.fit()}catch{return}g(!0)}};window.addEventListener("focus",re),document.addEventListener("visibilitychange",re),y&&d.attachCustomKeyEventHandler(te=>!Z1(te));const we=d.onData(te=>{e.send({type:"input",terminalId:t,data:te})}),_e=e.onMessage(te=>{switch(te.type){case"terminal.output":te.terminalId===t&&d.write(te.data);break;case"terminal.replay":if(te.terminalId!==t)break;d.reset(),te.truncated&&d.write(`\x1B[90m-- ${f("terminal.replayTruncated")} --\x1B[0m\r
|
|
131
|
+
`),d.write(te.data);break;case"terminal.exit":if(te.terminalId!==t)break;d.write(`\r
|
|
132
|
+
\x1B[90m-- ${f("terminal.exited",{code:te.exitCode})} --\x1B[0m\r
|
|
133
|
+
`);break}}),Q=()=>{if(_())try{k.fit()}catch{}const te=d.cols>0?d.cols:80,ee=d.rows>0?d.rows:24;b={cols:te,rows:ee},e.send({type:"terminal.attach",terminalId:t,cols:te,rows:ee})};Q();const Y=e.onReopen(Q);return()=>{window.clearTimeout(h),window.removeEventListener("resize",D),window.removeEventListener("focus",re),document.removeEventListener("visibilitychange",re),P.disconnect(),V(),w.removeEventListener("touchstart",U,{capture:!0}),w.removeEventListener("touchmove",H,{capture:!0}),w.removeEventListener("touchend",$,{capture:!0}),w.removeEventListener("touchcancel",Z,{capture:!0}),S.dispose(),x.dispose(),we.dispose(),_e(),Y(),e.send({type:"terminal.detach",terminalId:t}),d.dispose(),o.current=null,c.current=null}},[t,e,y]),N.useEffect(()=>{const w=o.current;w!==null&&(w.options.theme=wm[l],w.options.minimumContrastRatio=bm[l])},[l]),N.useEffect(()=>{if(!r)return;const w=o.current,d=c.current;if(w===null||d===null)return;const k=window.setTimeout(()=>{const L=v.current;if(!(L===null||L.clientWidth===0||L.clientHeight===0)){try{d.fit()}catch{return}a&&w.focus(),w.cols>0&&w.rows>0&&e.send({type:"resize",terminalId:t,cols:w.cols,rows:w.rows})}},0);return()=>window.clearTimeout(k)},[r,a,t,e]),i.jsx("div",{className:`terminal-surface${r?"":" terminal-surface-hidden"}`,ref:v})}function dS(){return i.jsxs("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",focusable:"false",children:[i.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"}),i.jsx("circle",{cx:"8",cy:"8",r:"1.8",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"M2.5 13.5l11-11",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]})}function Ua({title:t,onHide:e,confirmText:r}){const[l,a]=N.useState(!1);return i.jsxs("span",{className:"section-hide",children:[i.jsx("button",{className:"icon-button",onClick:y=>{y.stopPropagation(),r===null?e():a(!0)},title:t,"aria-label":t,children:i.jsx(dS,{})}),l&&r!==null&&i.jsxs("span",{className:"section-hide-confirm",role:"alert",children:[i.jsx("span",{children:r}),i.jsx("button",{className:"link-button",onClick:()=>{a(!1),e()},children:f("settings.panels.consoleConfirmYes")}),i.jsx("button",{className:"link-button",onClick:()=>a(!1),children:f("common.cancel")})]})]})}const hS=typeof navigator<"u"&&J1(navigator.platform);function fS({connection:t,shells:e,activeShellId:r,cwd:l,shellName:a,theme:y,onSelect:v,onOpen:o,onCloseShell:c,onCollapse:m,onHide:w,hideCount:d=0}){const k=a??f("console.name"),L=e.find(M=>M.terminalId===r)??e[0]??null;return i.jsxs("section",{className:"console-pane",children:[i.jsxs("header",{className:"console-header",children:[i.jsxs("div",{className:"strip-tabs",children:[e.map((M,b)=>i.jsxs("div",{className:`strip-tab${M.terminalId===(L==null?void 0:L.terminalId)?" is-active":""}${M.alive?"":" is-dead"}`,children:[i.jsx("button",{className:"strip-tab-label",onClick:()=>v(M.terminalId),title:M.alive?f("console.tab.title",{shell:M.label.length>0?M.label:k,number:b+1,cwd:l}):f("console.tab.exited",{code:M.exitCode??"?"}),children:f("console.tab.label",{number:b+1})}),i.jsx("button",{className:"strip-tab-close",onClick:()=>c(M.terminalId),title:f("console.tab.close"),children:"×"})]},M.terminalId)),a!==null&&i.jsx("button",{className:"strip-tab-new",onClick:o,title:f("console.openAnother",{shell:k,cwd:l}),children:"+"})]}),i.jsx("span",{className:"strip-spacer"}),i.jsx("button",{className:"icon-button",onClick:m,title:f("console.collapse"),children:"▾"}),w!==void 0&&i.jsx(Ua,{title:f("settings.hide.console"),onHide:w,confirmText:d===0?null:f("settings.panels.consoleConfirm",{count:d})})]}),i.jsx("div",{className:"console-body",children:e.length===0?i.jsx("div",{className:"console-empty",children:a===null?i.jsx("p",{className:"panel-note",children:f("console.noShell")}):i.jsx("button",{className:"link-button",onClick:o,children:f("console.openIn",{shell:k,cwd:l})})}):i.jsx("div",{className:"terminal-stack",children:e.map(M=>i.jsx(Jv,{terminalId:M.terminalId,connection:t,active:M.terminalId===(L==null?void 0:L.terminalId),theme:y,pasteOnCtrlV:hS},M.terminalId))})})]})}function pS(t){return t.cwd===null||!t.shellAvailable||t.shellCwds.includes(t.cwd)?null:t.cwd}const mS=.75,gS=.9,ym=.7;function _r(t){if(t<1e3)return String(t);if(t<1e6){const e=t/1e3;return`${e<100?Vi(e,1):Math.round(e)}k`}return`${Vi(t/1e6,2)}M`}function vS({usage:t,source:e,instructionsFile:r,fallbackWindow:l=null,compact:a=!1,statusLineState:y=null,onConfigure:v,compactAction:o=null}){const{lastRequestTokens:c,contextWindow:m}=t,w=e!==null&&Wp(e,t)&&m!==null&&m>0?Math.min(c/m,1):null,d=a&&o!==null?i.jsx("button",{className:`icon-button meter-compact-button${w!==null&&w>=ym?"":" meter-compact-button-on-hover"}`,onClick:o.onCompact,disabled:o.blockedReason!==null,title:o.blockedReason??f("meter.compactTitle",{command:o.command}),children:f("meter.compact")}):null,k=d!==null&&(w===null||w<ym)?0:void 0;if(v!==void 0&&y!==null&&uC(e,{state:y}))return i.jsxs("div",{className:`meter meter-idle${a?" meter-compact":""}`,title:dC(y),tabIndex:k,children:[i.jsx("span",{className:"meter-label",children:f("meter.label")}),i.jsx("span",{className:`meter-bar${a?" meter-bar-inline":""}`}),i.jsx("span",{className:"meter-value",children:f("meter.unmeasured")}),i.jsx("button",{className:"link-button",onClick:v,children:f("meter.configure")}),d]});if(e===null)return i.jsxs("div",{className:`meter meter-idle${a?" meter-compact":""}`,title:f("meter.noTokensTitle"),tabIndex:k,children:[i.jsx("span",{className:"meter-label",children:f("meter.label")}),i.jsx("span",{className:`meter-bar${a?" meter-bar-inline":""}`}),i.jsx("span",{className:"meter-value",children:f("meter.noTokens")}),d]});if(!Wp(e,t)){const h=fC(r,e,t.compacted===!0),_=cC(e,t,l);return i.jsxs("div",{className:`meter meter-idle${a?" meter-compact":""}`,title:h,tabIndex:k,children:[i.jsx("span",{className:"meter-label",children:f("meter.label")}),i.jsx("span",{className:`meter-bar${a?" meter-bar-inline":""}`}),i.jsxs("span",{className:"meter-value",children:[f("meter.unmeasured"),_!==null&&i.jsxs("span",{className:"meter-dim",children:[" / ",_r(_)]})]}),d]})}const L=w===null?"unknown":w>=gS?"danger":w>=mS?"warn":"ok",M=m===null?"":` / ${_r(m)}${t.contextWindowEstimated?"+":""}`,b=hC(e,t);if(a){const h=[t.lastModel===null?null:t.lastModel,b,w===null?f("meter.unknownModelShort"):f("meter.windowPercent",{percent:Math.round(w*100)}),f("meter.output",{tokens:_r(t.lastOutputTokens)}),e==="status-line"?f("meter.responses",{count:t.assistantMessages}):f("meter.sessionTotals",{output:_r(t.totalOutputTokens),cache:_r(t.totalCacheReadTokens),count:t.assistantMessages})].filter(_=>_!==null).join(" · ");return i.jsxs("div",{className:"meter meter-compact",title:h,tabIndex:k,children:[i.jsx("span",{className:"meter-label",children:f("meter.label")}),w!==null&&i.jsx("span",{className:"meter-bar meter-bar-inline",children:i.jsx("span",{className:`meter-fill meter-fill-${L}`,style:{width:`${w*100}%`}})}),i.jsxs("span",{className:"meter-value",children:[_r(c),M.length>0&&i.jsx("span",{className:"meter-dim",children:M})]}),d]})}return i.jsxs("div",{className:"meter",children:[i.jsxs("div",{className:"meter-row",children:[i.jsx("span",{className:"meter-label",children:f("meter.label")}),i.jsxs("span",{className:"meter-value",children:[_r(c),m!==null&&i.jsxs("span",{className:"meter-dim",title:t.lastModel===null?void 0:b!==null?f("meter.modelWithOrigin",{model:t.lastModel,origin:b}):t.lastModel,children:[" ","/ ",_r(m),t.contextWindowEstimated&&"+"]})]})]}),w!==null?i.jsx("div",{className:"meter-bar",title:f("meter.windowPercent",{percent:Math.round(w*100)}),children:i.jsx("div",{className:`meter-fill meter-fill-${L}`,style:{width:`${w*100}%`}})}):i.jsx("div",{className:"meter-note",title:t.lastModel??void 0,children:f("meter.unknownModel")}),i.jsxs("div",{className:"meter-row meter-row-dim",children:[i.jsx("span",{title:f("meter.lastResponseTitle"),children:f("meter.output",{tokens:_r(t.lastOutputTokens)})}),i.jsx("span",{title:f("meter.sessionTitle"),children:f("meter.sessionTotals",{output:_r(t.totalOutputTokens),cache:_r(t.totalCacheReadTokens),count:t.assistantMessages})})]})]})}const _S=75,$a=90,wS=3e4;function bS(t){return t>=$a?"danger":t>=_S?"warn":"ok"}function Uu(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 yS(t,e){const r=H0(t,e).sort(Uu);if(r.length===0)return null;const l=new Map;for(const m of r){const w=m.minutes===null?`id:${m.id}`:`m:${m.minutes}`,d=l.get(w);(d===void 0||m.usedPercent>d.usedPercent)&&l.set(w,m)}const a=[...l.values()].sort(Uu),y=a[0];if(y===void 0)return null;const v=a.find(m=>m.usedPercent>=$a),o=y.usedPercent<$a&&v!==void 0?v:y;let c=a.slice(0,2);return c.includes(o)||(c=[y,o]),{shown:c.sort(Uu),priorityId:o.id,all:r}}function Zv(t){const{minutes:e}=t;return e===null?f("plan.window.quota"):e===ti.fiveHours?f("plan.window.fiveHours"):e===ti.day?f("plan.window.day"):e===ti.week?f("plan.window.week"):Math.abs(e-ti.month)<=ti.day?f("plan.window.month"):e%ti.day===0?f("plan.window.days",{value:e/ti.day}):f("plan.window.hours",{value:Math.max(1,Math.round(e/60))})}function e_(t){const e=t>=100?Math.round(t):Math.min(99,Math.round(t));return _x(e)}function kS(t,e){return t.resetsAt===null?null:nh(t.resetsAt-e)}function CS(t,e){return t-e<1440*60*1e3?Yi(t):t-e<10080*60*1e3?vx(t):`${th(t)} ${Yi(t)}`}function xS(t,e){const r=t.all.map(a=>{const y=f("plan.used",{percent:e_(a.usedPercent)}),v=a.resetsAt===null?f("plan.noReset"):f("plan.resetsIn",{time:nh(a.resetsAt-e),at:CS(a.resetsAt,e)});return`${Zv(a)}: ${y} · ${v}`}),l=Math.max(...t.all.map(a=>a.observedAt));return r.push(f("plan.observed",{when:nr(l,e)})),r.join(`
|
|
134
|
+
`)}const SS={missing:"plan.setup.missing","other-command":"plan.setup.otherCommand",disabled:"plan.setup.disabled",unreadable:"plan.setup.unreadable"};function ES(t){return t===null?"hidden":t==="active"?"waiting":"configure"}function TS(t){return f(t==="active"?"plan.noDataTitle":SS[t])}function LS({windows:t,setupState:e,onConfigure:r}){const[l,a]=N.useState(()=>Date.now());N.useEffect(()=>{a(Date.now());const v=window.setInterval(()=>a(Date.now()),wS);return()=>window.clearInterval(v)},[t]);const y=yS(t,l);if(y===null){const v=ES(e);return v==="hidden"||e===null||v==="configure"&&r===void 0?null:i.jsxs("div",{className:"meter meter-idle meter-compact plan-meter",title:TS(e),children:[i.jsx("span",{className:"meter-label",children:f("plan.label")}),v==="configure"?i.jsx("button",{className:"link-button",onClick:r,children:f("meter.configure")}):i.jsx("span",{className:"meter-value",children:f("plan.noData")})]})}return i.jsx("div",{className:"meter meter-compact plan-meter",title:xS(y,l),children:y.shown.map(v=>{const o=bS(v.usedPercent),c=kS(v,l),m=v.id===y.priorityId;return i.jsxs("span",{className:`plan-window ${m?"plan-window-priority":"plan-window-extra"}`,children:[i.jsx("span",{className:"meter-label plan-label",children:Zv(v)}),i.jsx("span",{className:"meter-bar meter-bar-inline plan-bar",children:i.jsx("span",{className:`meter-fill meter-fill-${o}`,style:{width:`${Math.min(v.usedPercent,100)}%`}})}),i.jsxs("span",{className:"meter-value",children:[i.jsx("span",{className:v.usedPercent>=$a?"plan-danger":void 0,children:e_(v.usedPercent)}),c!==null&&i.jsxs("span",{className:"meter-dim",children:[" · ",c]})]})]},v.id)})})}const $u=["s","m","l"],t_="m",NS="agent-workbench.thread-font",RS="agent-workbench.notes-font",MS="s",AS={s:"threadFont.size.s",m:"threadFont.size.m",l:"threadFont.size.l"};function km(t){return f(AS[t])}function n_(t){const e=$u.indexOf(t);return $u[(e+1)%$u.length]??t_}function IS(t){return t==="s"||t==="m"||t==="l"?t:null}function Wa(t){return f("threadFont.title",{current:km(t),next:km(n_(t))})}const jS=300,DS=200,PS=2,OS=jS+DS,r_=PS*OS,BS=200;function s_(t){return Math.max(BS,t)}function FS(t){return t.hasMore&&!t.loading&&t.searching!==!0&&t.scrollTop<t.previousScrollTop&&t.scrollTop<=s_(t.clientHeight)}function HS(t,e,r){return t<0&&e<=s_(r)}function US(t,e){return Math.max(0,e-t)}function $S(t,e){return t===null||e.length===0||e[0]===t?!1:e.includes(t)}const WS=52,qS=10;function zS(t){return t.filter(e=>e.role==="user"&&e.parts.some(r=>r.kind==="text"||r.kind==="image")).map(e=>e.eventId)}function KS(t,e){for(let r=t-1;r>=0;r-=1){const l=e(r);if(l!==null&&l<-8)return r}return null}function VS(t){return t.awayFromEnd&&(t.ownAbove||t.hasMore)}function Cm(t,e){return Math.max(0,t+e-WS)}function GS(t){return t.found?"jump":t.loading?"wait":!t.hasMore||t.pagesRequested>=qS?"give-up":"load"}const YS=1;function XS(t,e){for(const r of t){const l=e(r);if(!(l===null||l.bottom<=YS))return{eventId:r,offset:l.top,lastId:t[t.length-1]??null}}return null}function QS(t,e,r,l){const a=e.indexOf(t.eventId);if(a===-1)return null;for(let y=a;y<e.length;y+=1){const v=e[y],o=v===void 0?null:r(v);if(o!==null)return Math.max(0,l+o.top-(y===a?t.offset:0))}return null}function JS(t,e){if(e===null)return 0;const r=t.lastIndexOf(e);return r===-1?0:t.length-1-r}const i_=80;function ZS(t){return t.distanceFromEnd<=i_?!0:t.wasAtEnd&&t.scrollTop>=t.previousScrollTop}const xm=2,eE=4;function tE(t,e,r,l=eE){const a=e.right-e.left,y=e.bottom-e.top;if(a<=0||y<=0)return 0;const v=t.right-xm,o=v-a,c=t.top+xm,m=c+y;return v<=r.left-l||o>=r.right+l||m<=r.top-l||c>=r.bottom+l?0:Math.ceil(v-(r.left-l))}function o_(t,e){return t.questionCards?t.cliOpen?e!==null&&By(e,t.launchedAt)?"closed":null:"no-cli":"unsupported"}function nE(t,e,r){var y;const l=[...e].filter(([,v])=>v.terminalId===r),a=[];for(let v=t.length-1;v>=0&&l.length>0;v-=1)for(const o of((y=t[v])==null?void 0:y.parts)??[]){if(o.kind!=="question"||o.questions.length!==1)continue;const c=o.questions[0];if(c===void 0)continue;const m=l.findIndex(([,L])=>Oy(L.item,c)),[w]=m===-1?[]:l.splice(m,1);if(w===void 0)continue;const[d,k]=w;a.push({liveId:d,toolUseId:o.toolUseId,selections:k.selections,failure:k.failure})}return a}function l_({agents:t,preselected:e,anchor:r,label:l=f("agentMenu.openWith"),onPick:a,onClose:y}){const v=N.useMemo(()=>kd(t),[t]),[o,c]=N.useState(()=>wC(v,e)),[m,w]=N.useState(null),d=N.useRef(null),k=N.useRef([]);return N.useLayoutEffect(()=>{const L=d.current;if(L===null)return;const M=r.getBoundingClientRect(),b=L.getBoundingClientRect();w(fv({left:M.left,top:M.top,bottom:M.bottom},{width:b.width,height:b.height},{width:window.innerWidth,height:window.innerHeight}))},[r]),N.useEffect(()=>{var L;(L=k.current[o])==null||L.focus()},[o,m]),N.useEffect(()=>{const L=h=>{if(!(h.altKey||h.ctrlKey||h.metaKey)){if(h.key==="Escape"){h.preventDefault(),h.stopPropagation(),y(),r.focus();return}if(h.key==="ArrowDown"||h.key==="ArrowUp"){h.preventDefault(),h.stopPropagation(),c(_=>bC(_,h.key==="ArrowDown"?1:-1,v.length));return}if(h.key==="Enter"){h.preventDefault(),h.stopPropagation();const _=v[o];_!==void 0&&a(_.id);return}h.key==="Tab"&&y()}},M=h=>{var g;const _=h.target;_ instanceof Node&&((g=d.current)!=null&&g.contains(_)||r.contains(_))||y()},b=h=>{pv(h.target,r,d.current)&&y()};return window.addEventListener("keydown",L,!0),document.addEventListener("pointerdown",M,!0),window.addEventListener("scroll",b,!0),window.addEventListener("resize",y),()=>{window.removeEventListener("keydown",L,!0),document.removeEventListener("pointerdown",M,!0),window.removeEventListener("scroll",b,!0),window.removeEventListener("resize",y)}},[o,r,v,y,a]),rh.createPortal(i.jsx("div",{ref:d,className:"agent-menu",role:"menu","aria-label":l,style:m===null?{left:0,top:0,visibility:"hidden"}:{left:`${m.left}px`,top:`${m.top}px`},children:v.map((L,M)=>i.jsxs("button",{ref:b=>{k.current[M]=b},className:`agent-menu-item${M===o?" agent-menu-item-active":""}`,role:"menuitem",tabIndex:M===o?0:-1,onMouseEnter:()=>c(M),onClick:()=>a(L.id),children:[i.jsx("span",{className:"agent-menu-label",children:L.label}),L.version!==null&&i.jsx("span",{className:"agent-menu-version",children:L.version})]},L.id))}),document.body)}function rE(){return i.jsx("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",focusable:"false",children:i.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 a_({targets:t,className:e,text:r,label:l,blockedReason:a=null,title:y=Zd(),onPick:v}){const[o,c]=N.useState(!1),m=N.useRef(null),w=N.useCallback(()=>c(!1),[]),d=N.useCallback(k=>{c(!1),v(k)},[v]);return t.length===0?null:i.jsxs(i.Fragment,{children:[i.jsx("button",{ref:m,className:e,onClick:()=>c(k=>!k),disabled:a!==null,"aria-haspopup":"menu","aria-expanded":o,"aria-label":l,title:a??y,children:r}),o&&m.current!==null&&i.jsx(l_,{agents:t,preselected:null,anchor:m.current,label:f("continue.menuLabel"),onPick:d,onClose:w})]})}function Nd(){return i.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:[i.jsx("circle",{cx:"6",cy:"5",r:"2.2"}),i.jsx("circle",{cx:"6",cy:"19",r:"2.2"}),i.jsx("circle",{cx:"18",cy:"7",r:"2.2"}),i.jsx("path",{d:"M6 7.2v9.6"}),i.jsx("path",{d:"M18 9.2c0 4.3-5.5 4-10.4 7.8"})]})}function sh(){return i.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:[i.jsx("circle",{cx:"6",cy:"5",r:"2.2"}),i.jsx("circle",{cx:"6",cy:"19",r:"2.2"}),i.jsx("path",{d:"M6 7.2v9.6"}),i.jsx("path",{d:"M8.5 12h11"}),i.jsx("path",{d:"M16 8.5l3.5 3.5-3.5 3.5"})]})}function c_(t){switch(t.notice){case"compacted":return t.detail==="auto"?f("thread.notice.compactedAuto"):f("thread.notice.compacted");case"interrupted":return f("thread.notice.interrupted");case"error":return t.detail.length>0?f("thread.notice.error",{detail:t.detail}):f("thread.notice.errorNoDetail")}}const u_="agent-workbench.locale",d_="auto";function sE(t){return t==="auto"||sv(t)?t:null}function h_(t){const e=t.trim().replace(/_/g,"-").toLowerCase();if(e.length===0)return null;const r=Qd.find(y=>y.toLowerCase()===e);if(r!==void 0)return r;const[l="",...a]=e.split("-");return l==="zh"?a.includes("hant")||a.some(v=>v==="tw"||v==="hk"||v==="mo")?null:Wu("zh-CN"):Wu(l==="pt"?"pt-BR":l)}function Wu(t){return sv(t)?t:null}function f_(t,e){if(t!=="auto")return t;for(const r of e){const l=h_(r);if(l!==null)return l}return"en"}function p_(t,e){for(const r of e)if(h_(r)===t)try{if(Intl.DateTimeFormat.supportedLocalesOf([r]).length>0)return r}catch{}return Mk(t)}let qa=d_;const Rd=new Set;function ih(){return Array.isArray(navigator.languages)&&navigator.languages.length>0?navigator.languages:typeof navigator.language=="string"?[navigator.language]:[]}function iE(){return f_("auto",ih())}async function m_(t){const e=ih(),r=f_(t,e);await ov(r,p_(r,e))}async function oE(){qa=Wt(u_,d_,sE);try{await m_(qa)}catch{await ov("en",p_("en",ih()))}document.documentElement.lang=yd(),iv(()=>{document.documentElement.lang=yd()})}async function lE(t){await m_(t),qa=t,jt(u_,t);for(const e of Rd)e()}function aE(t){return Rd.add(t),()=>Rd.delete(t)}function cE(){return qa}function ul(){return N.useSyncExternalStore(iv,yd)}function uE(){return N.useSyncExternalStore(aE,cE)}const g_=String.raw`https?:\/\/[^\s<>"'\`]+`,dE=new RegExp([String.raw`(\`[^\`\n]+\`)`,String.raw`(\*\*[^*\n]+\*\*)`,String.raw`(__[^_\n]+__)`,String.raw`(\*[^*\n]+\*)`,String.raw`(~~[^~\n]+~~)`,String.raw`(\[[^\]\n]+\]\(<[^>\n]+>\))`,String.raw`(\[[^\]\n]+\]\([^)\s]+\))`,`(${g_})`].join("|")),hE=/^(https?:|mailto:)/i,fE=new RegExp(g_);function pE(t){const e=fE.exec(t);if(e===null||e.index===void 0)return null;const r=v_(e[0]);return{index:e.index,length:r.length,href:r}}function Na(t,e){let r=0;for(const l of t)l===e&&(r+=1);return r}function v_(t){let e=t;for(;;){const r=e.slice(-1);if(r.length===0)return e;if(".,;:!?".includes(r)){e=e.slice(0,-1);continue}if(r===")"&&Na(e,"(")<Na(e,")")){e=e.slice(0,-1);continue}if(r==="]"&&Na(e,"[")<Na(e,"]")){e=e.slice(0,-1);continue}return e}}function __(t){const e=/^\[([^\]\n]+)\]\((<[^>\n]+>|[^)\s]+)\)$/.exec(t);if(e===null)return null;const r=e[2]??"",l=r.startsWith("<")&&r.endsWith(">")?r.slice(1,-1):r;return l.length===0?null:{label:e[1]??"",href:l}}function mE(t){const e=dE.exec(t);if(e===null||e.index===void 0)return null;const r=e[0],l=e.index,a=(v,o=r.length)=>({index:l,length:o,token:v});if(r.startsWith("`"))return a({kind:"code",text:r.slice(1,-1)});if(r.startsWith("**")||r.startsWith("__"))return a({kind:"strong",text:r.slice(2,-2)});if(r.startsWith("~~"))return a({kind:"del",text:r.slice(2,-2)});if(r.startsWith("*"))return a({kind:"em",text:r.slice(1,-1)});if(r.startsWith("[")){const v=__(r);return v!==null&&hE.test(v.href)?a({kind:"link",label:v.label,href:v.href}):a({kind:"plain",text:r})}const y=v_(r);return a({kind:"link",label:y,href:y},y.length)}function Ko(t,e,r){if(e.length===0)return[t];const l=t.toLowerCase(),a=e.toLowerCase(),y=[];let v=0,o=l.indexOf(a),c=0;for(;o!==-1;)o>v&&y.push(t.slice(v,o)),y.push(i.jsx("mark",{children:t.slice(o,o+e.length)},`${r}-m${c++}`)),v=o+e.length,o=l.indexOf(a,v);return v<t.length&&y.push(t.slice(v)),y}function gE(t,e){const r=__(t);if(r===null)return null;const l=e(r.href);return l===null?null:{...r,open:l}}function Vr(t,e,r,l){const a=[];let y=t,v=0;for(;y.length>0;){const o=mE(y);if(o===null){a.push(...Ko(y,e,`${r}-${v++}`));break}o.index>0&&a.push(...Ko(y.slice(0,o.index),e,`${r}-${v++}`));const c=`${r}-i${v++}`,{token:m}=o;switch(m.kind){case"code":{const w=l.code===void 0?null:l.code(m.text);a.push(w===null?i.jsx("code",{children:m.text},c):i.jsx("code",{className:"md-file-link",role:"link",tabIndex:0,title:w.folder?f("thread.openFolder",{path:m.text}):f("thread.openInFiles",{path:m.text}),onClick:w.open,onKeyDown:d=>{d.key!=="Enter"&&d.key!==" "||(d.preventDefault(),w.open())},children:m.text},c));break}case"strong":a.push(i.jsx("strong",{children:Vr(m.text,e,c,l)},c));break;case"del":a.push(i.jsx("del",{children:Vr(m.text,e,c,l)},c));break;case"em":a.push(i.jsx("em",{children:Vr(m.text,e,c,l)},c));break;case"link":a.push(i.jsx("a",{href:m.href,target:"_blank",rel:"noreferrer noopener",children:Ko(m.label,e,c)},c));break;default:{const w=l.local===void 0?null:gE(m.text,l.local);if(w!==null){a.push(i.jsx("button",{className:"md-local-link",onClick:w.open,title:w.href,children:Ko(w.label,e,c)},c));break}a.push(i.jsx("span",{children:Ko(m.text,e,c)},c));break}}y=y.slice(o.index+o.length)}return a}function vE({code:t,language:e}){const[r,l]=N.useState(null),[a,y]=N.useState(!1),v=N.useRef(null);N.useEffect(()=>()=>{v.current!==null&&window.clearTimeout(v.current)},[]);const o=()=>{navigator.clipboard.writeText(t).then(()=>{y(!0),v.current!==null&&window.clearTimeout(v.current),v.current=window.setTimeout(()=>y(!1),1200)}).catch(()=>y(!1))};return N.useEffect(()=>{let c=!0;return Ir(async()=>{const{highlightCode:m}=await import("./highlight-BEETev5A.js");return{highlightCode:m}},[]).then(({highlightCode:m})=>{c&&l(m(t,e))}).catch(()=>{c&&l(null)}),()=>{c=!1}},[t,e]),i.jsxs("div",{className:"md-code-wrap",children:[i.jsx("pre",{className:"md-code hljs",children:r===null?i.jsx("code",{children:t}):i.jsx("code",{dangerouslySetInnerHTML:{__html:r}})}),i.jsxs("div",{className:"md-code-tools","data-search-skip":"",children:[e!==null&&i.jsx("span",{className:"md-code-lang",children:e}),i.jsx("button",{className:"md-code-copy",onClick:o,title:f(a?"common.copied":"common.copyCode"),"aria-label":f("common.copyCode"),children:a?"✓":"⧉"})]})]})}const Sm=/^(#{1,6})\s+(.*)$/,qu=/^\s{0,3}[-*+]\s+(.*)$/,Vo=/^\s{0,3}(\d{1,3})[.)]\s+(.*)$/,Ra=/^>\s?(.*)$/,zu=/^\s*```(\S*)\s*$/,Em=/^\s*(-{3,}|\*{3,}|_{3,})\s*$/,Ku=/^\s*\|.*\|\s*$/,_E=/^\s*\|[\s:|-]+\|\s*$/;function Tm(t){return t.trim().replace(/^\||\|$/g,"").split("|").map(e=>e.trim())}function oh({text:t,needle:e="",localLink:r,codeLink:l}){var c,m;const a={local:r,code:l},y=t.split(`
|
|
135
|
+
`),v=[];let o=0;for(;o<y.length;){const w=y[o]??"",d=`b${o}`,k=zu.exec(w);if(k!==null){const b=(k[1]??"").length>0?k[1]:null,h=[];for(o+=1;o<y.length&&!zu.test(y[o]??"");)h.push(y[o]??""),o+=1;o+=1,v.push({key:d,node:i.jsx(vE,{code:h.join(`
|
|
136
|
+
`),language:b},d)});continue}if(w.trim().length===0){o+=1;continue}if(Em.test(w)){v.push({key:d,node:i.jsx("hr",{className:"md-rule"},d)}),o+=1;continue}const L=Sm.exec(w);if(L!==null){const b=Math.min((L[1]??"#").length,6);v.push({key:d,node:i.jsx("p",{className:`md-heading md-h${b}`,children:Vr(L[2]??"",e,d,a)},d)}),o+=1;continue}if(Ku.test(w)&&_E.test(y[o+1]??"")){const b=Tm(w);o+=2;const h=[];for(;o<y.length&&Ku.test(y[o]??"");)h.push(Tm(y[o]??"")),o+=1;v.push({key:d,node:i.jsx("div",{className:"md-table-wrap",children:i.jsxs("table",{className:"md-table",children:[i.jsx("thead",{children:i.jsx("tr",{children:b.map((_,g)=>i.jsx("th",{children:Vr(_,e,`${d}-h${g}`,a)},g))})}),i.jsx("tbody",{children:h.map((_,g)=>i.jsx("tr",{children:_.map((p,T)=>i.jsx("td",{children:Vr(p,e,`${d}-${g}-${T}`,a)},T))},g))})]})},d)});continue}if(Ra.test(w)){const b=[];for(;o<y.length&&Ra.test(y[o]??"");)b.push(((c=Ra.exec(y[o]??""))==null?void 0:c[1])??""),o+=1;v.push({key:d,node:i.jsx("blockquote",{className:"md-quote",children:Vr(b.join(`
|
|
137
|
+
`),e,d,a)},d)});continue}if(qu.test(w)||Vo.test(w)){const b=Vo.test(w),h=b?Number(((m=Vo.exec(w))==null?void 0:m[1])??"1"):1,_=[];for(;o<y.length;){const p=y[o]??"",T=qu.exec(p),A=Vo.exec(p);if(b&&A!==null)_.push(A[2]??"");else if(!b&&T!==null)_.push(T[1]??"");else if(_.length>0&&/^\s{2,}\S/.test(p)&&T===null&&A===null)_[_.length-1]=`${_[_.length-1]??""} ${p.trim()}`;else break;o+=1}const g=_.map((p,T)=>i.jsx("li",{children:Vr(p,e,`${d}-l${T}`,a)},T));v.push({key:d,node:b?i.jsx("ol",{className:"md-list",start:h===1?void 0:h,children:g},d):i.jsx("ul",{className:"md-list",children:g},d)});continue}const M=[];for(;o<y.length;){const b=y[o]??"";if(b.trim().length===0||zu.test(b)||Sm.test(b)||qu.test(b)||Vo.test(b)||Ra.test(b)||Em.test(b)||Ku.test(b))break;M.push(b),o+=1}v.push({key:d,node:i.jsx("p",{className:"md-paragraph",children:Vr(M.join(`
|
|
138
|
+
`),e,d,a)},d)})}return i.jsx("div",{className:"md",children:v.map(w=>w.node)})}const w_=[{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 Vu(t){const e=w_.find(r=>r.names.includes(t));return e===void 0?{key:`name:${t}`,known:!1}:{key:e.key,known:!0}}function wE(t,e,r){const l=w_.find(a=>a.key===t);return l===void 0?f("tools.run.callsTo",{count:e,name:r}):f(l.run,{count:e})}const b_=2e4,Md=new Map;function bE(t,e=Date.now()){Md.set(t,e)}function yE(t,e=Date.now()){const r=Md.get(t);return Md.delete(t),r!==void 0&&e-r<=b_}const Gu={model:null,effort:null,contextWindow:null},kE=200,CE=2e4,xE={},SE={},Lm=[],Nm=[],EE=15e3,TE=2e4,LE=2e4;function Ad(t,e,r){return`${t}:${r}:${e}`}function NE(t,e){const[r,l]=N.useState([]),[a,y]=N.useState(Au),[v,o]=N.useState(Gu),[c,m]=N.useState("waiting"),[w,d]=N.useState(!1),[k,L]=N.useState(!1),[M,b]=N.useState({}),[h,_]=N.useState(null),[g,p]=N.useState(null),[T,A]=N.useState(null),E=N.useRef(null),S=N.useRef(null),[x,R]=N.useState(null),[I,D]=N.useState(!1),[P,F]=N.useState(Lm),[z,q]=N.useState(Nm),[K,V]=N.useState(null),W=N.useRef(new Map),O=N.useRef(new Map),[U,H]=N.useState(!1),$=N.useRef(null),Z=N.useRef(null),[re,we]=N.useState(!1),_e=N.useRef(null),Q=N.useRef(null),[Y,te]=N.useState(!1),ee=N.useRef(null),ye=N.useCallback(()=>{ee.current!==null&&window.clearTimeout(ee.current),ee.current=null,te(!1)},[]),ge=N.useCallback(()=>{$.current=null,Z.current!==null&&window.clearTimeout(Z.current),Z.current=null,H(!1)},[]),Be=N.useCallback(()=>{_e.current=null,Q.current!==null&&window.clearTimeout(Q.current),Q.current=null,we(!1)},[]),[Ue,ze]=N.useState({}),[gt,Fe]=N.useState({}),pt=(e===null?void 0:Ue[e])??xE,yt=(e===null?void 0:gt[e])??SE,oe=N.useRef(new Set),Ae=N.useRef(new Map),De=N.useRef(new Set),Le=N.useCallback((Ie,$e,ue)=>{Fe(st=>({...st,[Ie]:{...st[Ie]??{},[$e]:ue}}))},[]),nt=N.useCallback(Ie=>{Fe($e=>{let ue=!1;const st={};for(const[ft,et]of Object.entries($e))if(Ie in et){const tt={...et};delete tt[Ie],st[ft]=tt,ue=!0}else st[ft]=et;return ue?st:$e})},[]),je=N.useCallback((Ie,$e)=>{Fe(ue=>{const st=ue[Ie];if(st===void 0||!($e in st))return ue;const ft={...st};return delete ft[$e],{...ue,[Ie]:ft}})},[]),Ke=N.useCallback((Ie,$e,ue)=>{const st=Ae.current.get($e);st!==void 0&&window.clearTimeout(st);const ft=window.setTimeout(()=>{Ae.current.delete($e),!De.current.has($e)&&(ue&&W.current.get(Ie)!==$e||(ze(et=>{const tt=et[Ie];if(tt===void 0||!($e in tt))return et;const de={...tt};return delete de[$e],{...et,[Ie]:de}}),Le(Ie,$e,f("conversation.answerUnconfirmed"))))},CE);Ae.current.set($e,ft)},[Le]);N.useEffect(()=>{for(const Ie of r)for(const $e of Ie.parts){if($e.kind!=="tool-result")continue;De.current.add($e.toolUseId);const ue=Ae.current.get($e.toolUseId);ue!==void 0&&(window.clearTimeout(ue),Ae.current.delete($e.toolUseId)),nt($e.toolUseId)}},[r,nt]),N.useEffect(()=>{if(!(e===null||O.current.size===0))for(const{liveId:Ie,toolUseId:$e,selections:ue,failure:st}of nE(r,O.current,e))O.current.delete(Ie),ue!==null&&(ze(ft=>{const et=ft[e]??{};return $e in et?ft:{...ft,[e]:{...et,[$e]:ue}}}),De.current.has($e)||Ke(e,$e,!1)),st!==null&&Le(e,$e,st)},[r,e,Ke,Le]),N.useEffect(()=>{const Ie=Ae.current;return()=>{for(const $e of Ie.values())window.clearTimeout($e);Ie.clear()}},[]);const kt=N.useRef(null);N.useEffect(()=>{if(e===null){l([]),y(Au),o(Gu),p(null),E.current=null,A(null),S.current!==null&&window.clearTimeout(S.current),S.current=null,m("waiting"),d(!1),kt.current=null;return}l([]),y(Au),o(Gu),m("waiting"),d(!1),L(!1),b({}),_(null),p(null),E.current=null,A(null),S.current!==null&&window.clearTimeout(S.current),S.current=null,R(null),D(!1),F(Lm),q(Nm),V(null),ge(),Be(),oe.current.clear(),kt.current=null;const Ie=t.onMessage(ue=>{var st,ft,et,tt;if(ue.type==="conversation.reset"||ue.type==="conversation.liveQuestion"){const de=ue.type==="conversation.reset"?ue.liveQuestion:ue.question;de===null?W.current.delete(ue.terminalId):W.current.set(ue.terminalId,de.toolUseId)}switch(ue.type){case"conversation.reset":if(ue.terminalId!==e)break;V(ue.liveQuestion),l(ue.events),y(ue.usage),o(ue.defaults),_(ue.permissionMode),p(ue.codexPermissions),pd(ue.codexPermissions)===((st=E.current)==null?void 0:st.preset)&&(E.current=null,A(null),S.current!==null&&window.clearTimeout(S.current),S.current=null),R(ue.waitingFor),D(ue.openToolCall),F(ue.subagents),q(ue.queue),m(ue.state),d(ue.hasMore),L(!1),kt.current=((ft=ue.events[0])==null?void 0:ft.eventId)??null;break;case"conversation.defaults":if(ue.terminalId!==e)break;o(ue.defaults);break;case"conversation.codexPermissions":if(ue.terminalId!==e)break;p(ue.state),pd(ue.state)===((et=E.current)==null?void 0:et.preset)&&(E.current=null,A(null),S.current!==null&&window.clearTimeout(S.current),S.current=null);break;case"agent.codexPermissions.result":{if(ue.terminalId!==e||((tt=E.current)==null?void 0:tt.requestId)!==ue.requestId)break;const de=E.current;if(de===null)break;const Pe=ue.status==="written"?{...de,status:"awaiting"}:{...de,status:"blocked",...ue.reason===void 0?{}:{reason:ue.reason}};E.current=Pe,A(Pe),ue.status!=="written"&&S.current!==null&&(window.clearTimeout(S.current),S.current=null);break}case"conversation.append":{if(ue.terminalId!==e)break;l(de=>{var Ce;const Pe=new Set(de.map(fe=>fe.eventId)),Re=ue.events.filter(fe=>!Pe.has(fe.eventId));return Re.length===0?de:(kt.current===null&&(kt.current=((Ce=Re[0])==null?void 0:Ce.eventId)??null),[...de,...Re])}),y(ue.usage),ue.permissionMode!==null&&_(ue.permissionMode),ue.queue!==void 0&&q(ue.queue),m("live");break}case"conversation.page":{if(ue.terminalId!==e)break;l(de=>{var Ce;const Pe=new Set(de.map(fe=>fe.eventId)),Re=ue.events.filter(fe=>!Pe.has(fe.eventId));return Re.length===0?de:(kt.current=((Ce=Re[0])==null?void 0:Ce.eventId)??kt.current,[...Re,...de])}),d(ue.hasMore),L(!1);break}case"conversation.turns":{if(ue.terminalId!==e)break;const de=new Map(ue.turns.map(Pe=>[Pe.eventId,Pe.durationMs]));l(Pe=>Pe.map(Re=>{const Ce=de.get(Re.eventId);return Ce===void 0?Re:{...Re,durationMs:Ce}}));break}case"conversation.parts":{if(ue.terminalId!==e)break;const de=new Map(ue.updates.map(Pe=>[Pe.eventId,Pe.parts]));l(Pe=>Pe.map(Re=>{const Ce=de.get(Re.eventId);return Ce===void 0?Re:{...Re,parts:Ce}}));break}case"conversation.imageData":{if(ue.terminalId!==e)break;const de=Ad(ue.eventId,ue.index,ue.source);b(Pe=>({...Pe,[de]:ue.data===null?null:`data:${ue.mediaType};base64,${ue.data}`}));break}case"conversation.state":if(ue.terminalId!==e)break;m(ue.state);break;case"conversation.mode":if(ue.terminalId!==e)break;_(ue.mode);break;case"conversation.waiting":if(ue.terminalId!==e)break;R(ue.waitingFor);break;case"conversation.toolCall":if(ue.terminalId!==e)break;D(ue.open);break;case"conversation.subagents":if(ue.terminalId!==e)break;F(ue.subagents);break;case"conversation.queue":if(ue.terminalId!==e)break;q(ue.queue);break;case"conversation.liveQuestion":if(ue.terminalId!==e)break;V(ue.question);break;case"agent.forceSent":ue.requestId===$.current&&!ue.sent&&ge();break;case"agent.queueEdited":ue.requestId===_e.current&&Be();break;case"error":{if(ue.requestId!==void 0&&ue.requestId===$.current){ge();break}if(ue.requestId!==void 0&&ue.requestId===_e.current){Be();break}if(ue.code!=="answer-failed"||e===null)break;const de=Ht(ue.text);for(const[Pe,Re]of Ae.current){window.clearTimeout(Re),Ae.current.delete(Pe),ze(fe=>{const ht=fe[e];if(ht===void 0||!(Pe in ht))return fe;const ve={...ht};return delete ve[Pe],{...fe,[e]:ve}}),Le(e,Pe,de);const Ce=O.current.get(Pe);Ce!==void 0&&O.current.set(Pe,{...Ce,selections:null,failure:de})}break}}});t.send({type:"conversation.subscribe",terminalId:e});const $e=t.onReopen(()=>{t.send({type:"conversation.subscribe",terminalId:e})});return()=>{Ie(),$e(),t.send({type:"conversation.unsubscribe",terminalId:e}),S.current!==null&&window.clearTimeout(S.current),S.current=null}},[t,e,Le,ge,Be]),N.useEffect(()=>{U&&z.every(Ie=>Ie.sent===!0||Ie.forced===!0)&&ge()},[U,z,ge]),N.useEffect(()=>{Y&&!z.some(Ie=>Ie.sent===!0)&&ye()},[Y,z,ye]),N.useEffect(()=>()=>{Z.current!==null&&window.clearTimeout(Z.current),Q.current!==null&&window.clearTimeout(Q.current),ee.current!==null&&window.clearTimeout(ee.current)},[]);const Lt=N.useCallback(()=>{if(e===null||$.current!==null)return;const Ie=crypto.randomUUID();$.current=Ie,H(!0),Z.current!==null&&window.clearTimeout(Z.current),Z.current=window.setTimeout(ge,EE),t.send({type:"agent.forceSend",terminalId:e,requestId:Ie})},[t,e,ge]),xt=N.useCallback(()=>{if(e===null||_e.current!==null)return;const Ie=crypto.randomUUID();_e.current=Ie,we(!0),Q.current!==null&&window.clearTimeout(Q.current),Q.current=window.setTimeout(Be,TE),t.send({type:"agent.editQueue",terminalId:e,requestId:Ie})},[t,e,Be]),vt=N.useCallback(()=>{e===null||Y||(te(!0),ee.current!==null&&window.clearTimeout(ee.current),ee.current=window.setTimeout(ye,b_),bE(e),t.send({type:"agent.interrupt",terminalId:e}))},[t,e,Y,ye]),dt=N.useCallback(()=>{const Ie=kt.current;e===null||Ie===null||k||(L(!0),t.send({type:"conversation.loadMore",terminalId:e,beforeEventId:Ie,limit:kE}))},[t,e,k]),Qe=N.useCallback((Ie,$e,ue)=>{if(e===null)return;const st=Ad(Ie,$e,ue);oe.current.has(st)||(oe.current.add(st),t.send({type:"conversation.image",terminalId:e,eventId:Ie,index:$e,source:ue}))},[t,e]),St=N.useCallback((Ie,$e)=>{if(e===null)return;ze(st=>{const ft=st[e]??{};return Ie in ft?st:{...st,[e]:{...ft,[Ie]:$e}}}),je(e,Ie);const ue=(K==null?void 0:K.toolUseId)===Ie?K.questions[0]:void 0;ue!==void 0&&O.current.set(Ie,{terminalId:e,item:ue,selections:$e,failure:null}),t.send({type:"agent.answer",terminalId:e,toolUseId:Ie,selections:$e}),Ke(e,Ie,ue!==void 0)},[t,e,je,K,Ke]),Ft=N.useCallback(Ie=>{e!==null&&t.send({type:"agent.mode",terminalId:e,mode:Ie})},[t,e]),Gt=N.useCallback(Ie=>{var st;if(e===null||((st=E.current)==null?void 0:st.status)==="writing")return;const $e=crypto.randomUUID(),ue={requestId:$e,preset:Ie,status:"writing"};E.current=ue,A(ue),S.current!==null&&window.clearTimeout(S.current),S.current=window.setTimeout(()=>{const ft=E.current;if((ft==null?void 0:ft.requestId)!==$e||ft.status==="blocked")return;const et={...ft,status:"unconfirmed"};E.current=et,A(et),S.current=null},LE),t.send({type:"agent.codexPermissions",terminalId:e,requestId:$e,preset:Ie})},[t,e]);return{events:r,usage:a,defaults:v,state:c,permissionMode:h,codexPermissions:g,codexPermissionRequest:T,waitingFor:x,openToolCall:I,subagents:P,queue:z,forceSend:Lt,forcing:U,editQueue:xt,editingQueue:re,editSent:vt,editingSent:Y,hasMore:w,loadingMore:k,loadMore:dt,images:M,requestImage:Qe,answer:St,answered:pt,answerFailed:yt,setPermissionMode:Ft,requestCodexPermissions:Gt,liveQuestion:K}}function RE(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 ME=new Set(["Write","Edit","MultiEdit","NotebookEdit"]);function AE(t){try{const r=JSON.parse(t),l=r.file_path??r.notebook_path;if(typeof l=="string"&&l.length>0)return l}catch{}const e=/"(?:file_path|notebook_path)"\s*:\s*"((?:[^"\\]|\\.)*)"/.exec(t);if(e===null||e[1]===void 0)return null;try{return JSON.parse(`"${e[1]}"`)}catch{return null}}function IE(t,e){const r=y=>y.replace(/\\/g,"/").replace(/\/+$/,""),l=r(t),a=r(e);return l.length>0&&a.toLowerCase().startsWith(`${l.toLowerCase()}/`)?e.slice(l.length+1):e}function jE(t,e,r){const l=t.findIndex(y=>y.eventId===e);if(l===-1)return[];const a=[];for(const y of t.slice(l))for(const v of y.parts){if(v.kind!=="tool-call"||!ME.has(v.name))continue;const o=AE(v.input);if(o===null)continue;const c=IE(r,o);a.includes(c)||a.push(c)}return a}function DE(t,e=6,r=400){if(t===void 0)return"";const l=t.parts.flatMap(v=>v.kind==="text"?[v.text]:[]).join(`
|
|
139
|
+
`).trim();let y=l.split(`
|
|
140
|
+
`).slice(0,e).join(`
|
|
141
|
+
`);return y.length>r&&(y=y.slice(0,r)),y.length<l.length?`${y.trimEnd()}…`:y}function PE(){return i.jsxs("svg",{className:"archive-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[i.jsx("circle",{cx:"10.5",cy:"10.5",r:"6"}),i.jsx("path",{d:"M15 15l5 5"})]})}function Yu(t){return t.scrollHeight-t.scrollTop-t.clientHeight>i_}const Rm=5;function Ma(t){return!Array.isArray(t)}function Mm(t){const e=[];for(const r of t.parts){if(r.kind!=="tool-call")return null;e.push(r.name)}return e.length>0?e:null}function OE(t){const e=[];let r=0;for(;r<t.length;){const l=t[r];if(l===void 0)break;const a=Mm(l),y=a===null?null:Vu(a[0]??"");if(!(a!==null&&y!==null&&a.every(w=>Vu(w).key===y.key))||a===null||y===null){e.push({kind:"card",card:l}),r+=1;continue}const o=[l];let c=a.length,m=r+1;for(;m<t.length;){const w=t[m];if(w===void 0)break;const d=Mm(w);if(d===null||!d.every(k=>Vu(k).key===y.key))break;o.push(w),c+=d.length,m+=1}if(c<2){e.push({kind:"card",card:l}),r+=1;continue}e.push({kind:"tools",id:`tools-${l.event.eventId}`,summary:wE(y.key,c,a[0]??""),at:l.event.at,cards:o}),r=m}return e}function BE(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(r=>r.label).join(" ")}`).join(`
|
|
142
|
+
`);case"notice":return c_(t);case"thinking":case"image":return""}}function Am(t,e){const r=[];for(const l of t.parts)if(r.push(BE(l)),l.kind==="tool-call"){const a=e.get(l.toolUseId);a!==void 0&&r.push(a.text)}return r.join(`
|
|
143
|
+
`)}function Ss(t,e){if(e.length===0)return i.jsx(i.Fragment,{children:t});const r=t.toLowerCase(),l=e.toLowerCase(),a=[];let y=0,v=r.indexOf(l),o=0;for(;v!==-1;)v>y&&a.push(i.jsx("span",{children:t.slice(y,v)},o++)),a.push(i.jsx("mark",{children:t.slice(v,v+e.length)},o++)),y=v+e.length,v=r.indexOf(l,y);return y<t.length&&a.push(i.jsx("span",{children:t.slice(y)},o++)),i.jsx(i.Fragment,{children:a})}function y_(t,e){const r=[];let l=t,a=0;for(;l.length>0;){const y=pE(l);if(y===null){r.push(i.jsx("span",{children:Ss(l,e)},a++));break}y.index>0&&r.push(i.jsx("span",{children:Ss(l.slice(0,y.index),e)},a++)),r.push(i.jsx("a",{href:y.href,target:"_blank",rel:"noreferrer noopener",children:Ss(y.href,e)},a++)),l=l.slice(y.index+y.length)}return i.jsx(i.Fragment,{children:r})}const k_=N.createContext(null);function FE({view:t,terminalId:e,onRewind:r,rewindBlocked:l=!1,questionsAnswerable:a,contextWindowSource:y,instructionsFile:v,onGoToCli:o,cliPresence:c,cliLaunchedAt:m,exitCode:w,onWakeCli:d,waking:k,discovering:L=!1,toolCallNotice:M=null,serverClosed:b=null,statusLineState:h=null,onConfigureStatusLine:_,threadFont:g,threadTools:p,continueTargets:T=[],continueBlockedReason:A=null,onContinue:E,onMoveToBranch:S,searchRequest:x=null,onSearchRequestApplied:R,activity:I=null,receipt:D=null,clock:P=null,takeNotice:F,fileLinks:z=null,forceSendAvailable:q=!1,queueEditAvailable:K=!1,planWindows:V=[],planSetupState:W=null,onConfigurePlanLimits:O,compactAction:U=null,scheduled:H=GE,onCancelScheduled:$,onSendScheduledNow:Z}){const{events:re,usage:we,defaults:_e,state:Q,waitingFor:Y,subagents:te,queue:ee,forceSend:ye,forcing:ge,editQueue:Be,editingQueue:Ue,editSent:ze,editingSent:gt,hasMore:Fe,loadingMore:pt,loadMore:yt,images:oe,requestImage:Ae,answer:De,answered:Le,answerFailed:nt,liveQuestion:je}=t,Ke=ul(),[kt,Lt]=N.useState(""),[xt,vt]=N.useState(0),[dt,Qe]=N.useState(null),St=(p==null?void 0:p.open)??!0,Ft=p==null?void 0:p.setOpen,Gt=()=>{Ft!==void 0&&(St&&Lt(""),Ft(!St))};N.useEffect(()=>{x!==null&&(Lt(x.query),Ft==null||Ft(!0),R==null||R(x.seq))},[x,R,Ft]);const Ie=N.useRef(null),$e=N.useRef(new Map),ue=N.useRef(!0),[st,ft]=N.useState(!1),[et,tt]=N.useState(0),de=N.useRef(e),Pe=N.useRef(new Map),Re=N.useRef(null),Ce=N.useRef(F);Ce.current=F;const[fe,ht]=N.useState(!1),ve=N.useRef(null),[rt,Pt]=N.useState(!1),[Et,Ge]=N.useState(!1),ct=N.useRef(null),Tt=N.useMemo(()=>new Set(ee.flatMap(pe=>pe.eventId===void 0?[]:[pe.eventId])),[ee]),se=N.useMemo(()=>Tt.size===0?re:re.filter(pe=>!Tt.has(pe.eventId)),[re,Tt]),ke=N.useMemo(()=>zS(se),[se]),{cards:be,results:lt}=N.useMemo(()=>{const pe=new Map,He=new Set;for(const Ot of se)for(const _t of Ot.parts)_t.kind==="tool-result"?pe.set(_t.toolUseId,_t):(_t.kind==="tool-call"||_t.kind==="question")&&He.add(_t.toolUseId);const at=[];for(const Ot of se){const _t=Ot.parts.filter(tn=>tn.kind!=="thinking"&&!(tn.kind==="tool-result"&&He.has(tn.toolUseId)));_t.length!==0&&at.push({event:Ot,parts:_t})}return{cards:at,results:pe}},[se]),ut=N.useRef([]);ut.current=N.useMemo(()=>be.map(pe=>pe.event.eventId),[be]);const wt=N.useCallback(pe=>{const He=pe.getBoundingClientRect().top;return at=>{const Ot=$e.current.get(at);if(Ot===void 0)return null;const _t=Ot.getBoundingClientRect();return _t.height<=0?null:{top:_t.top-He,bottom:_t.bottom-He}}},[]),Nt=N.useMemo(()=>OE(be),[be,Ke]),Yt=kt.trim(),Mn=N.useMemo(()=>{if(Yt.length===0)return[];const pe=Yt.toLowerCase();return be.filter(He=>Am(He,lt).toLowerCase().includes(pe)).map(He=>He.event.eventId)},[be,lt,Yt,Ke]);N.useEffect(()=>{vt(0)},[Yt]);const rr=N.useMemo(()=>new Set(Mn),[Mn]),yr=Mn[xt]??null;N.useEffect(()=>{var pe;yr!==null&&((pe=$e.current.get(yr))==null||pe.scrollIntoView({block:"center"}))},[yr]);const Gr=N.useMemo(()=>({questionCards:a,cliOpen:c==="live",launchedAt:m}),[a,c,m]);N.useLayoutEffect(()=>{var at,Ot;const pe=de.current;de.current=e;const He=Ie.current;if(pe!==null&&pe!==e){if(Re.current===null){const _t=He===null||ue.current?null:XS(ut.current,wt(He));_t===null?Pe.current.delete(pe):Pe.current.set(pe,_t)}(at=Ce.current)==null||at.call(Ce,pe)}e!==null&&pe!==e&&((Ot=Ce.current)==null?void 0:Ot.call(Ce,e))===!0&&Pe.current.delete(e),Re.current=e===null?null:Pe.current.get(e)??null,ue.current=!0,ft(!1),tt(0),ct.current=null,Ge(!1),Pt(!1),ht(!1)},[e,wt]),N.useEffect(()=>()=>{ve.current!==null&&window.clearTimeout(ve.current)},[]);const sr=N.useCallback(()=>{const pe=Ie.current;if(pe===null)return;const He=Yu(pe);ft(He),He||tt(0)},[]),ir=N.useCallback(pe=>{const He=pe.getBoundingClientRect().top,at=_t=>{const tn=ke[_t],xr=tn===void 0?void 0:$e.current.get(tn);return xr===void 0?null:xr.getBoundingClientRect().top-He},Ot=KS(ke.length,at);return Ot===null?null:at(Ot)},[ke]),Yr=N.useCallback(()=>{const pe=Ie.current;pe!==null&&Pt(VS({awayFromEnd:Yu(pe),ownAbove:ir(pe)!==null,hasMore:Fe}))},[ir,Fe]),$t=N.useRef(null),Xr=N.useRef(0),zn=N.useRef(0);N.useLayoutEffect(()=>{const pe=$t.current,He=re.map(Ot=>Ot.eventId);$t.current=He[0]??null;const at=Ie.current;at===null||!$S(pe,He)||(at.scrollTop=US(Xr.current,at.scrollHeight))},[re]),N.useLayoutEffect(()=>{const pe=Ie.current,He=Re.current;if(pe!==null&&He!==null&&be.length>0){Re.current=null;const at=ut.current,Ot=Yt.length>0?null:QS(He,at,wt(pe),pe.scrollTop);Ot!==null&&(pe.scrollTop=Ot,ue.current=!Yu(pe),ue.current||(tt(JS(at,He.lastId)),ht(!0),ve.current!==null&&window.clearTimeout(ve.current),ve.current=window.setTimeout(()=>{ve.current=null,ht(!1)},r_)))}pe!==null&&ue.current&&Yt.length===0&&(pe.scrollTop=pe.scrollHeight),sr()},[be,ee.length,je==null?void 0:je.toolUseId,H.length,Yt,sr,wt]);const kr=N.useCallback(()=>{const pe=Ie.current;pe===null||!ue.current||Yt.length>0||(pe.scrollTop=pe.scrollHeight,sr())},[Yt,sr]);N.useEffect(()=>{const pe=Ie.current;if(pe===null)return;pe.addEventListener("load",kr,!0);const He=typeof ResizeObserver>"u"?null:new ResizeObserver(kr);return He==null||He.observe(pe),()=>{pe.removeEventListener("load",kr,!0),He==null||He.disconnect()}},[kr]),N.useLayoutEffect(()=>{const pe=ct.current,He=Ie.current;if(pe===null||He===null)return;const at=ir(He),Ot=GS({found:at!==null,hasMore:Fe,loading:pt,pagesRequested:pe.pages});if(Ot!=="wait"){if(Ot==="load"){pe.pages+=1,yt();return}ct.current=null,Ge(!1),at!==null&&(ue.current=!1,He.scrollTop=Cm(He.scrollTop,at))}},[be,Fe,pt,Et,ir,yt]),N.useLayoutEffect(()=>{Yr()},[be,Yr]);const Cr=N.useRef(null),li=N.useRef(null),Qr=N.useRef(new Map),or=N.useCallback(()=>{const pe=new Map;for(const He of[Cr.current,li.current]){if(He===null)continue;const at=He.getBoundingClientRect();for(const Ot of[at.top+1,(at.top+at.bottom)/2,at.bottom-1]){const _t=document.elementsFromPoint(at.left+1,Ot).map(Sr=>Sr.closest(".turn")).find(Sr=>Sr!==null),tn=(_t==null?void 0:_t.querySelector(":scope > .turn-actions"))??null;if(_t==null||tn===null)continue;const xr=tE(_t.getBoundingClientRect(),tn.getBoundingClientRect(),at);xr>0&&pe.set(_t,Math.max(pe.get(_t)??0,xr))}}for(const He of Qr.current.keys())pe.has(He)||He.style.removeProperty("--turn-actions-shift");for(const[He,at]of pe)Qr.current.get(He)!==at&&He.style.setProperty("--turn-actions-shift",`${at}px`);Qr.current=pe},[]);N.useLayoutEffect(()=>{const pe=Ie.current;pe!==null&&(Xr.current=pe.scrollHeight-pe.scrollTop,zn.current=pe.scrollTop,or())});const _n=N.useRef(null),Jr=N.useCallback(()=>{var He;const pe=((He=re[0])==null?void 0:He.eventId)??null;pe===null||_n.current===pe||(_n.current=pe,yt())},[re,yt]),wn=N.useRef(null);N.useEffect(()=>{var Ot;const pe=((Ot=be[be.length-1])==null?void 0:Ot.event.eventId)??null,He=wn.current;if(wn.current=pe,He===null||pe===He||ue.current&&Yt.length===0)return;const at=be.findIndex(_t=>_t.event.eventId===He);at!==-1&&tt(_t=>_t+(be.length-1-at))},[be,Yt]);const Zi=N.useCallback(()=>{const pe=Ie.current;if(pe===null)return;ue.current=ZS({wasAtEnd:ue.current,distanceFromEnd:pe.scrollHeight-pe.scrollTop-pe.clientHeight,scrollTop:pe.scrollTop,previousScrollTop:zn.current}),sr(),Yr(),or();const He=FS({scrollTop:pe.scrollTop,previousScrollTop:zn.current,clientHeight:pe.clientHeight,hasMore:Fe,loading:pt,searching:Yt.length>0});zn.current=pe.scrollTop,Xr.current=pe.scrollHeight-pe.scrollTop,He&&Jr()},[sr,Yr,or,Fe,pt,Jr,Yt]),eo=N.useCallback(pe=>{const He=Ie.current;He===null||!Fe||pt||Yt.length>0||HS(pe.deltaY,He.scrollTop,He.clientHeight)&&Jr()},[Fe,pt,Jr,Yt]),Ts=N.useCallback(()=>{const pe=Ie.current;pe!==null&&(pe.scrollTop=pe.scrollHeight,ue.current=!0,ft(!1),tt(0),ct.current=null,Ge(!1),Pt(!1))},[]),lr=N.useCallback(()=>{const pe=Ie.current;if(pe===null)return;const He=ir(pe);if(He!==null){ue.current=!1,pe.scrollTop=Cm(pe.scrollTop,He);return}ct.current===null&&(ct.current={pages:0},Ge(!0))},[ir]),An=N.useCallback((pe,He)=>{He===null?$e.current.delete(pe):$e.current.set(pe,He)},[]),ar=N.useCallback(pe=>{const He=Am(pe,lt);navigator.clipboard.writeText(He).then(()=>{Qe(pe.event.eventId),window.setTimeout(()=>Qe(null),1200)}).catch(()=>Qe(null))},[lt,Ke]),Tn=pe=>{Mn.length!==0&&vt(He=>(He+pe+Mn.length)%Mn.length)};return i.jsx(k_.Provider,{value:z,children:i.jsxs("div",{className:"conversation-pane",children:[i.jsxs("div",{className:`conversation-search${St?"":" thread-tools-closed"}`,children:[p!==void 0&&i.jsxs("button",{className:"icon-button thread-tools-toggle",onClick:Gt,"aria-expanded":St,title:f(St?"thread.tools.hide":"thread.tools.show"),"aria-label":f(St?"thread.tools.hide":"thread.tools.show"),children:[i.jsx(PE,{}),i.jsx("span",{className:"thread-tools-chevron","aria-hidden":"true",children:"▾"})]}),St&&i.jsx("input",{className:"conversation-search-input",type:"search",placeholder:f("thread.search.placeholder"),value:kt,onChange:pe=>Lt(pe.target.value),onKeyDown:pe=>{pe.key==="Enter"&&Tn(pe.shiftKey?-1:1),pe.stopPropagation()},spellCheck:!1}),St&&Yt.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"conversation-matches",children:Mn.length===0?f("thread.search.none"):`${xt+1}/${Mn.length}`}),i.jsx("button",{className:"icon-button",onClick:()=>Tn(-1),disabled:Mn.length===0,title:f("thread.search.previous"),children:"↑"}),i.jsx("button",{className:"icon-button",onClick:()=>Tn(1),disabled:Mn.length===0,title:f("thread.search.next"),children:"↓"})]}),i.jsx("span",{className:"conversation-spacer"}),St&&E!==void 0&&i.jsx(a_,{targets:T,className:"icon-button conversation-continue",text:i.jsxs(i.Fragment,{children:[i.jsx(rE,{}),i.jsx("span",{children:f("thread.continueCli")})]}),label:Zd(),blockedReason:A,onPick:E}),St&&S!==void 0&&i.jsxs("button",{className:"icon-button conversation-continue",onClick:S,title:f("worktree.move.title"),"aria-label":f("worktree.move.title"),children:[i.jsx(sh,{}),i.jsx("span",{children:f("thread.moveBranch")})]}),St&&g!==void 0&&i.jsx("button",{className:"icon-button thread-font-button",onClick:g.cycle,title:Wa(g.size),"aria-label":Wa(g.size),children:i.jsxs("span",{"aria-hidden":"true",children:["a",i.jsx("span",{className:"thread-font-big",children:"A"})]})}),i.jsxs("div",{className:"thread-meters",children:[i.jsx(LS,{windows:V,setupState:W,onConfigure:O}),i.jsx(vS,{usage:we,source:y,instructionsFile:v,fallbackWindow:_e.contextWindow,compact:!0,statusLineState:h,onConfigure:_,compactAction:U})]})]}),i.jsxs("div",{className:"conversation-scroll-frame",children:[i.jsxs("div",{className:"conversation-scroll",ref:Ie,onScroll:Zi,onWheel:eo,children:[Fe&&i.jsxs("button",{className:`conversation-more${pt?" conversation-more-loading":""}`,onClick:yt,disabled:pt,"aria-busy":pt,children:[pt&&i.jsx("span",{className:"conversation-more-spinner","aria-hidden":"true"}),f(pt?"thread.loadingMore":"thread.loadEarlier")]}),be.length===0&&i.jsxs("p",{className:"conversation-empty",children:[Q==="unavailable"?f("thread.empty.unavailable"):Q==="no-transcript"?AC():f(Q==="waiting"?"thread.empty.waiting":"thread.empty.noMessages"),Q==="waiting"&&L&&i.jsxs(i.Fragment,{children:[i.jsx("br",{}),IC()]})]}),Nt.map(pe=>{if(pe.kind==="card")return i.jsx(Im,{card:pe.card,results:lt,needle:Yt,isMatch:pe.card.event.eventId===yr,copied:dt===pe.card.event.eventId,images:oe,onRequestImage:Ae,onCopy:()=>ar(pe.card),onRewind:r,rewindBlocked:l,register:An,answered:Le,answerFailed:nt,questionTab:Gr,onAnswer:De},pe.card.event.eventId);const He=pe.cards.some(at=>rr.has(at.event.eventId));return i.jsx(QE,{summary:pe.summary,at:pe.at,open:He,children:pe.cards.map(at=>i.jsx(Im,{card:at,results:lt,needle:Yt,isMatch:at.event.eventId===yr,copied:dt===at.event.eventId,images:oe,onRequestImage:Ae,onCopy:()=>ar(at),onRewind:r,rewindBlocked:l,register:An,answered:Le,answerFailed:nt,questionTab:Gr,onAnswer:De},at.event.eventId))},pe.id)}),c==="live"&&je!==null&&i.jsx("article",{className:"turn turn-assistant turn-live-question",children:i.jsx(C_,{part:je,answeredAt:Le[je.toolUseId]??null,failure:nt[je.toolUseId]??null,lock:o_(Gr,null),onAnswer:De,needle:Yt})}),c==="live"&&ee.length>0&&i.jsx(VE,{queue:ee,canForce:q&&ee.some(pe=>pe.sent!==!0&&pe.forced!==!0),forceBlocked:Y!==null,forcing:ge,onForce:ye,canEdit:K&&ee.every(pe=>pe.sent===!0||pe.forced!==!0),editing:Ue,onEdit:Be,editingSent:gt,onEditSent:ze}),H.length>0&&i.jsx(XE,{messages:H,onCancel:$,onSendNow:Z})]}),st&&(rt||Et)&&i.jsx("button",{ref:Cr,className:`conversation-jump conversation-jump-own${Et?" is-seeking":""}`,onClick:lr,disabled:Et,"aria-busy":Et,title:f("thread.jumpToOwn"),"aria-label":f("thread.jumpToOwn"),children:i.jsx("span",{"aria-hidden":"true",children:"↑"})}),st&&i.jsxs("button",{ref:li,className:`conversation-jump${et>0?" has-unseen":""}${fe?" is-hinting":""}`,onClick:Ts,title:et>0?f("thread.jumpToEndNew",{count:et}):f("thread.jumpToEnd"),"aria-label":et>0?f("thread.jumpToEndNew",{count:et}):f("thread.jumpToEnd"),children:[i.jsx("span",{"aria-hidden":"true",children:"↓"}),et>0&&i.jsx("span",{className:"conversation-jump-count",children:et>99?"99+":et}),fe&&i.jsx("span",{className:"conversation-jump-tip","aria-hidden":"true",children:et>0?f("thread.jumpToEndNew",{count:et}):f("thread.jumpToEnd")})]})]}),i.jsx(UE,{live:c==="live"&&b===null,activity:I,waitingFor:Y,receipt:D,events:re,clock:P,subagents:te}),b!==null&&(b.state==="relaunching"||c==="live")?i.jsx(qE,{text:b.text,relaunching:b.state==="relaunching",onRelaunch:d}):c==="live"?Y===null&&M!==null?i.jsx(KE,{notice:M,onGoToCli:o}):i.jsx(zE,{waitingFor:Y,questionsAnswerable:a,liveQuestion:je!==null,onGoToCli:o}):i.jsx(WE,{presence:c,exitCode:w,waking:k,onWake:d})]})})}const HE=1e3;function UE({live:t,activity:e,waitingFor:r,receipt:l,events:a,clock:y,subagents:v}){const[,o]=N.useState(0),c=Date.now(),m=k1({live:t,activity:e,waitingFor:r,receipt:l,events:a,clock:y,now:c}),w=t?v:[],d=m!==null||w.length>0;return N.useEffect(()=>{if(!d)return;const k=window.setInterval(()=>o(L=>L+1),HE);return()=>window.clearInterval(k)},[d]),d?i.jsxs("div",{className:"thread-status",children:[m!==null&&i.jsxs("div",{className:`thread-status-row thread-status-${m.kind}`,children:[i.jsx($E,{kind:m.kind}),i.jsx("span",{className:"thread-status-text",children:C1(m,c)})]}),w.length>0&&i.jsxs("div",{className:"thread-status-row thread-status-subagents",children:[i.jsxs("span",{className:"tab-working thread-status-subagent-mark","aria-hidden":"true",children:[i.jsx("i",{}),i.jsx("i",{}),i.jsx("i",{})]}),i.jsx("span",{className:"thread-status-text",children:x1(w,c)})]})]}):null}function $E({kind:t}){return t==="working"?i.jsxs("span",{className:"tab-working","aria-hidden":"true",children:[i.jsx("i",{}),i.jsx("i",{}),i.jsx("i",{})]}):t==="sending"?i.jsx("span",{className:"thread-status-sending-dot","aria-hidden":"true"}):i.jsx("span",{className:"thread-status-check","aria-hidden":"true",children:"✓"})}function WE({presence:t,exitCode:e,waking:r,onWake:l}){const a=t==="sleeping"?f("thread.wake.sleeping"):e===null?f("thread.wake.exited"):f("thread.wake.exitedWithCode",{code:e});return i.jsxs("div",{className:"conversation-waiting conversation-wake",role:"status",children:[i.jsx("span",{className:"conversation-wake-dot","aria-hidden":"true"}),i.jsx("span",{children:a}),i.jsx("button",{className:"primary-button primary-button-small",onClick:l,disabled:r,children:f(r?"thread.wake.opening":"thread.wake.open")})]})}function qE({text:t,relaunching:e,onRelaunch:r}){return i.jsxs("div",{className:"conversation-waiting conversation-wake",role:"status",children:[i.jsx("span",{className:"conversation-wake-dot","aria-hidden":"true"}),i.jsx("span",{children:t}),i.jsx("button",{className:"primary-button primary-button-small",onClick:r,disabled:e,children:e?BC():OC()})]})}function zE({waitingFor:t,questionsAnswerable:e,liveQuestion:r,onGoToCli:l}){if(t===null)return null;const a=r&&e?f("agent.waiting.question"):gv(t,e);return i.jsxs("div",{className:"conversation-waiting",role:"status",children:[i.jsx("span",{className:"conversation-waiting-dot","aria-hidden":"true"}),i.jsx("span",{children:a}),i.jsx("button",{className:"link-button",onClick:l,children:f("thread.goToCli")})]})}function KE({notice:t,onGoToCli:e}){return i.jsxs("div",{className:"conversation-waiting",role:"status",children:[i.jsx("span",{className:"conversation-waiting-dot","aria-hidden":"true"}),i.jsx("span",{children:t}),i.jsx("button",{className:"link-button",onClick:e,children:f("thread.goToCli")})]})}function Im({card:t,results:e,needle:r,isMatch:l,copied:a,images:y,onRequestImage:v,onCopy:o,onRewind:c,rewindBlocked:m=!1,register:w,answered:d,answerFailed:k,questionTab:L,onAnswer:M}){const{event:b}=t,h=b.role==="user",_=o_(L,b.at),g=p=>{const T=d[p.toolUseId];return T!==void 0?T:e.has(p.toolUseId)?[]:null};return i.jsxs("article",{ref:p=>w(b.eventId,p),className:`turn turn-${b.role}${l?" turn-match":""}`,children:[i.jsxs("div",{className:"turn-actions",children:[i.jsx("button",{className:"icon-button",onClick:o,title:f("thread.copyMessage"),children:a?"✓":"⧉"}),h&&c!==void 0&&RE(b)&&i.jsx("button",{className:"icon-button",onClick:()=>c(b.eventId),disabled:m,title:f(m?"thread.rewindBusy":"thread.rewind"),children:"↩"})]}),t.parts.map((p,T)=>i.jsx(ZE,{part:p,eventId:b.eventId,mine:h,result:p.kind==="tool-call"?e.get(p.toolUseId)??null:null,needle:r,images:y,onRequestImage:v,answeredAt:p.kind==="question"?g(p):null,failure:p.kind==="question"?k[p.toolUseId]??null:null,questionLock:_,onAnswer:M},T)),i.jsx(JE,{event:b,mine:h})]})}function VE({queue:t,canForce:e,forceBlocked:r,forcing:l,onForce:a,canEdit:y,editing:v,onEdit:o,editingSent:c,onEditSent:m}){const w=d=>d.sent===!0?{label:f("thread.queue.sent"),title:f("thread.queue.sentTitle")}:d.forced===!0?{label:f("thread.queue.forced"),title:f("thread.queue.forcedTitle")}:{label:f("thread.queue.label"),title:f("thread.queue.labelTitle")};return i.jsxs("div",{className:"queued-prompts",children:[t.map(d=>i.jsxs("article",{className:`turn turn-user turn-pending${d.forced===!0?" turn-pending-forced":""}`,children:[d.text.length>0&&i.jsx(lh,{text:d.text,truncated:d.truncated,needle:""}),d.images>0&&i.jsx("div",{className:"turn-pending-images",children:f("thread.queue.images",{count:d.images})}),i.jsxs("div",{className:"turn-meta",children:[i.jsx("span",{className:"turn-who",children:f("thread.turn.you")}),d.at>0&&i.jsx("span",{children:Yi(d.at)}),i.jsx("span",{className:"turn-pending-state",title:w(d).title,children:w(d).label}),d.sent===!0&&d.editable===!0&&i.jsx("button",{className:"queued-edit",onClick:m,disabled:c||r,"aria-busy":c,title:f(r?"thread.queue.forceBlocked":"thread.queue.editSentTitle"),children:f(c?"thread.queue.editing":"thread.queue.edit")}),d.sent!==!0&&y&&i.jsx("button",{className:"queued-edit",onClick:o,disabled:v||l||r,"aria-busy":v,title:r?f("thread.queue.forceBlocked"):f("thread.queue.editTitle",{count:t.filter(k=>k.sent!==!0).length}),children:f(v?"thread.queue.editing":"thread.queue.edit")})]})]},d.id)),e&&i.jsx("div",{className:"queued-prompts-actions",children:i.jsx("button",{className:"queued-force",onClick:a,disabled:l||r||v,"aria-busy":l,title:f(r?"thread.queue.forceBlocked":"thread.queue.forceSendTitle"),children:f(l?"thread.queue.forcing":"thread.queue.forceSend")})})]})}const GE=[],YE=3e4;function XE({messages:t,onCancel:e,onSendNow:r}){const[l,a]=N.useState(()=>Date.now());return N.useEffect(()=>{const y=window.setInterval(()=>a(Date.now()),YE);return()=>window.clearInterval(y)},[]),i.jsx("div",{className:"scheduled-prompts",children:t.map(y=>{const v=y.state==="failed",o=c1(y);return i.jsxs("article",{className:`turn turn-user turn-pending turn-scheduled${v?" turn-scheduled-failed":""}`,children:[i.jsx(lh,{text:y.text,truncated:!1,needle:""}),i.jsxs("div",{className:"turn-meta",children:[i.jsx("span",{className:"turn-who",children:f("thread.turn.you")}),i.jsx("span",{className:`turn-scheduled-state${v?" is-failed":""}`,role:v?"alert":void 0,children:i1(y,l)}),i.jsxs("span",{className:"turn-scheduled-actions",children:[r!==void 0&&y.state!=="paused"&&i.jsx("button",{className:"queued-edit",onClick:()=>r(y.id),disabled:!o,title:f("scheduled.thread.sendNowTitle"),children:f("scheduled.thread.sendNow")}),e!==void 0&&i.jsx("button",{className:"queued-edit",onClick:()=>e(y.id),disabled:!o,title:f("scheduled.thread.cancelTitle"),children:f("scheduled.thread.cancel")})]})]})]},y.id)})})}function QE({summary:t,at:e,open:r,children:l}){const a=e>0?Yi(e):"";return i.jsxs("details",{className:"tool-group",open:r,children:[i.jsxs("summary",{className:"tool-group-summary",children:[i.jsx("span",{className:"tool-group-chevron","aria-hidden":"true",children:"▸"}),i.jsx("span",{className:"tool-group-count",children:t}),a.length>0&&i.jsx("span",{className:"tool-group-time",children:a})]}),i.jsx("div",{className:"tool-group-body",children:l})]})}function JE({event:t,mine:e}){const r=t.at>0?Yi(t.at):"",l=[];return t.durationMs!==null&&l.push(gx(t.durationMs)),t.effort!==null&&l.push(f("thread.turn.effort",{effort:t.effort})),i.jsxs("div",{className:"turn-meta",children:[e&&i.jsx("span",{className:"turn-who",children:f("thread.turn.you")}),r.length>0&&i.jsx("span",{children:r}),t.queued&&i.jsx("span",{className:"turn-queued",title:f("thread.turn.queuedTitle"),children:f("thread.turn.queued")}),l.map(a=>i.jsx("span",{className:"turn-meta-bit",children:a},a))]})}function ZE({part:t,eventId:e,mine:r,result:l,needle:a,images:y,onRequestImage:v,answeredAt:o,failure:c,questionLock:m,onAnswer:w}){const d=N.useContext(k_);switch(t.kind){case"text":return r?i.jsx(lh,{text:t.text,truncated:t.truncated,needle:a}):i.jsxs("div",{className:"part-text",children:[i.jsx(oh,{text:t.text,needle:a,codeLink:d==null?void 0:d.code,localLink:d==null?void 0:d.link}),t.truncated&&i.jsxs("span",{className:"part-truncated",children:[" ",f("thread.truncated")]})]});case"image":return i.jsx(tT,{eventId:e,index:t.index,source:t.source,src:y[Ad(e,t.index,t.source)],onRequest:v});case"thinking":return null;case"notice":return i.jsx("div",{className:`turn-notice turn-notice-${t.notice}`,children:Ss(c_(t),a)});case"question":return i.jsx(C_,{part:t,answeredAt:o,failure:c,lock:m,onAnswer:w,needle:a});case"tool-call":{const k=a.length>0&&`${t.name} ${t.input} ${(l==null?void 0:l.text)??""}`.toLowerCase().includes(a.toLowerCase());return i.jsxs("details",{className:"tool",open:k,children:[i.jsxs("summary",{className:"tool-summary",children:[i.jsx("span",{className:"tool-name",children:t.name}),l!==null&&l.isError&&i.jsx("span",{className:"tool-error",children:f("thread.tool.error")}),l!==null&&l.imageCount>0&&i.jsx("span",{className:"tool-images",children:f("thread.tool.images",{count:l.imageCount})})]}),i.jsxs("div",{className:"tool-block",children:[i.jsx("span",{className:"tool-label",children:f("thread.tool.input")}),i.jsxs("pre",{className:"tool-pre",children:[Ss(t.input,a),t.truncated&&i.jsxs("span",{className:"part-truncated",children:[" ",f("thread.truncated")]})]})]}),l!==null&&i.jsxs("div",{className:"tool-block",children:[i.jsx("span",{className:"tool-label",children:f("thread.tool.result")}),i.jsxs("pre",{className:`tool-pre${l.isError?" tool-pre-error":""}`,children:[l.text.length>0?Ss(l.text,a):l.imageCount>0?f("thread.tool.imagesNotSent",{count:l.imageCount}):f("thread.tool.noOutput"),l.truncated&&i.jsxs("span",{className:"part-truncated",children:[" ",f("thread.truncated")]})]})]})]})}case"tool-result":return i.jsxs("div",{className:"tool-block",children:[i.jsx("span",{className:"tool-label",children:f("thread.tool.orphanResult")}),i.jsx("pre",{className:`tool-pre${t.isError?" tool-pre-error":""}`,children:Ss(t.text,a)})]})}}function C_({part:t,answeredAt:e,failure:r,lock:l,onAnswer:a,needle:y}){var A;const[v,o]=N.useState(()=>t.questions.map(()=>[])),[c,m]=N.useState(null),[w,d]=N.useState(""),k=e!==null,L=k||l!==null,M=e??v,b=t.questions.length===1&&((A=t.questions[0])==null?void 0:A.multiSelect)===!1,h=M.every(E=>Ma(E)?E.text.trim().length>0:E.length>0),_=E=>E===void 0||Ma(E)?[]:E,g=(E,S)=>{if(L)return;const x=t.questions[E];if(x!==void 0){if(b){a(t.toolUseId,[[S]]);return}m(R=>R===E?null:R),o(R=>R.map((I,D)=>{if(D!==E)return I;const P=_(I);return x.multiSelect?P.includes(S)?P.filter(F=>F!==S):[...P,S]:[S]}))}},p=E=>{const S=w.trim();if(S.length===0||L)return;const x={kind:"free",text:S};if(b){a(t.toolUseId,[x]);return}o(R=>R.map((I,D)=>D===E?x:I)),m(null),d("")},T=E=>{var x;if(L||((x=t.questions[E])==null?void 0:x.allowWriteIn)===!1)return;const S=M[E];d(S!==void 0&&Ma(S)?S.text:""),m(E)};return i.jsxs("div",{className:`question${k?" question-done":""}`,children:[t.questions.map((E,S)=>{const x=M[S],R=x!==void 0&&Ma(x)?x.text:null;return i.jsxs("div",{className:"question-item",children:[i.jsxs("div",{className:"question-head",children:[E.header.length>0&&i.jsx("span",{className:"question-header",children:E.header}),i.jsx("span",{className:"question-text",children:Ss(E.question,y)}),E.multiSelect&&i.jsx("span",{className:"question-hint",children:f("thread.question.multi")})]}),i.jsxs("div",{className:"question-options",children:[E.options.map((I,D)=>{const P=_(x).includes(D);return i.jsxs("button",{type:"button",className:`question-option${P?" question-option-picked":""}`,disabled:L,onClick:()=>g(S,D),children:[i.jsx("span",{className:"question-option-label",children:I.label}),I.description.length>0&&i.jsx("span",{className:"question-option-desc",children:I.description})]},D)}),E.allowWriteIn===!1?null:c===S&&!L?i.jsxs("div",{className:"question-write",children:[i.jsx("textarea",{className:"question-write-input",autoFocus:!0,rows:2,value:w,placeholder:f("thread.question.placeholder"),onChange:I=>d(I.target.value),onKeyDown:I=>{I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),p(S)),I.key==="Escape"&&m(null),I.stopPropagation()}}),i.jsxs("div",{className:"question-write-actions",children:[i.jsx("button",{type:"button",className:"question-send",disabled:w.trim().length===0,onClick:()=>p(S),children:f(b?"thread.question.send":"thread.question.useText")}),i.jsx("button",{type:"button",className:"question-write-cancel",onClick:()=>m(null),children:f("common.cancel")})]})]}):i.jsxs("button",{type:"button",className:`question-option question-option-write${R!==null?" question-option-picked":""}`,disabled:L,onClick:()=>T(S),children:[i.jsx("span",{className:"question-option-label",children:R!==null?R:f("thread.question.writeOther")}),R===null&&i.jsx("span",{className:"question-option-desc",children:f("thread.question.writeOtherHint")})]})]})]},S)}),i.jsxs("div",{className:"question-foot",children:[r!==null&&l===null&&i.jsx("span",{className:"question-failed",children:r}),k?i.jsx("span",{className:"question-sent",children:f("thread.question.answered")}):l==="unsupported"?i.jsx("span",{className:"question-note",children:f("thread.question.answerInCli")}):l==="no-cli"?i.jsx("span",{className:"question-note",children:f("thread.question.noCli")}):l==="closed"?i.jsx("span",{className:"question-note",children:f("thread.question.closed")}):i.jsxs(i.Fragment,{children:[!b&&i.jsx("button",{type:"button",className:"question-send",disabled:!h,onClick:()=>a(t.toolUseId,v),children:f("thread.question.sendAnswers")}),i.jsx("span",{className:"question-note",children:f(b?"thread.question.pickOne":"thread.question.pickEach")})]})]})]})}function lh({text:t,truncated:e,needle:r}){const l=ax(t,e),a=l.length===1?l[0]:void 0;if(a!==void 0&&a.kind==="text")return i.jsx(jm,{text:t,truncated:e,needle:r});const y=l.length-1;return i.jsx("div",{className:"part-own",children:l.map((v,o)=>v.kind==="text"?i.jsx(jm,{text:v.text,truncated:e&&o===y,needle:r},o):i.jsx(eT,{number:v.number,text:v.text,complete:v.complete,needle:r},o))})}function eT({number:t,text:e,complete:r,needle:l}){const[a,y]=N.useState(!1),v=l.length>0&&e.toLowerCase().includes(l.toLowerCase()),o=a||v;return i.jsxs("div",{className:`thread-pasted${o?" thread-pasted-open":""}`,children:[i.jsxs("button",{className:"thread-pasted-toggle",onClick:()=>y(c=>!c),"aria-expanded":o,children:[i.jsx("span",{className:"chip-icon",children:"¶"}),f("thread.pasted",{number:t,count:nl(e)}),!r&&i.jsxs("span",{className:"part-truncated",children:[" ",f("thread.truncated")]}),i.jsx("span",{className:"chip-chevron",children:o?"▾":"▸"})]}),o&&i.jsx("div",{className:"thread-pasted-text part-mine",children:y_(e,l)})]})}function jm({text:t,truncated:e,needle:r}){const[l,a]=N.useState(!1),y=t.split(`
|
|
144
|
+
`),v=r.length>0&&t.toLowerCase().includes(r.toLowerCase()),o=y.length>=Rm&&!v,c=o&&!l?y.slice(0,Rm-1).join(`
|
|
145
|
+
`):t;return i.jsxs("div",{className:"part-text part-mine",children:[y_(c,r),e&&i.jsxs("span",{className:"part-truncated",children:[" ",f("thread.truncated")]}),o&&i.jsx("button",{className:"fold-toggle",onClick:()=>a(m=>!m),children:l?f("thread.fold.less"):f("thread.fold.more",{count:y.length})})]})}function tT({eventId:t,index:e,source:r,src:l,onRequest:a}){const[y,v]=N.useState(!1);return N.useEffect(()=>{l===void 0&&a(t,e,r)},[l,t,e,r,a]),l===void 0?i.jsx("div",{className:"conversation-image-placeholder",children:f("thread.image.loading")}):l===null?i.jsx("div",{className:"conversation-image-placeholder",children:f("thread.image.gone")}):i.jsxs(i.Fragment,{children:[i.jsx("img",{className:"conversation-image",src:l,alt:f("thread.image.alt"),onClick:()=>v(!0),title:f("thread.image.openTitle")}),y&&i.jsx(xv,{src:l,caption:f("thread.image.alt"),onClose:()=>v(!1)})]})}function Xu({connection:t,title:e,confirmLabel:r,confirmTitle:l,onChoose:a,onClose:y}){const[v,o]=N.useState(null),[c,m]=N.useState(null),[w,d]=N.useState(!1),[k,L]=N.useState(""),M=N.useRef(null),b=N.useRef(null);N.useEffect(()=>{const p=t.onMessage(T=>{if(T.type==="picker.listing"){M.current=T.listing.pickerId,o(T.listing),m(null),d(!1),L("");return}T.type==="error"&&T.code==="picker-failed"&&m(Ht(T.text))});return t.send({type:"picker.open"}),()=>{p();const T=M.current;T!==null&&t.send({type:"picker.close",pickerId:T})}},[t]),N.useEffect(()=>{const p=T=>{T.key==="Escape"&&(T.preventDefault(),T.stopPropagation(),y())};return window.addEventListener("keydown",p,!0),()=>window.removeEventListener("keydown",p,!0)},[y]),N.useEffect(()=>{var p;w&&((p=b.current)==null||p.focus())},[w]);const h=N.useCallback(p=>{const T=M.current;T!==null&&t.send({type:"picker.enter",pickerId:T,name:p})},[t]),_=N.useCallback(p=>{const T=M.current;T!==null&&t.send({type:"picker.root",pickerId:T,rootIndex:p})},[t]),g=N.useCallback(()=>{const p=M.current,T=k.trim();p===null||T.length===0||t.send({type:"picker.create",pickerId:p,name:T})},[t,k]);return i.jsx("div",{className:"modal-backdrop",onClick:y,children:i.jsxs("div",{className:"modal picker-modal",role:"dialog","aria-label":e,onClick:p=>p.stopPropagation(),children:[i.jsxs("header",{className:"modal-header",children:[i.jsx("span",{className:"modal-title",children:e}),i.jsx("button",{className:"icon-button",onClick:y,title:f("common.close"),children:"×"})]}),v===null?i.jsx("p",{className:"panel-note",children:f("picker.loading")}):i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"picker-roots",children:v.roots.map((p,T)=>i.jsx("button",{className:"picker-root",onClick:()=>_(T),title:f("picker.goTo",{root:p}),children:p},p))}),i.jsx("p",{className:"picker-path",title:v.path,children:v.path}),i.jsxs("div",{className:"picker-list",children:[v.canGoUp&&i.jsxs("button",{className:"picker-entry picker-up",onClick:()=>h(".."),children:["‹ ",f("picker.up")]}),v.entries.length===0&&!v.canGoUp&&i.jsx("p",{className:"panel-note",children:f("picker.empty")}),v.entries.map(p=>i.jsx("button",{className:"picker-entry",onClick:()=>h(p),children:p},p)),v.truncated&&i.jsx("p",{className:"panel-note",children:f("picker.truncated")})]}),c!==null&&i.jsx("p",{className:"picker-problem",children:c}),i.jsxs("footer",{className:"picker-footer",children:[w?i.jsxs("div",{className:"picker-create",children:[i.jsx("input",{ref:b,className:"picker-create-input",value:k,placeholder:f("picker.newFolderName"),onChange:p=>L(p.target.value),onKeyDown:p=>{p.key==="Enter"&&g(),p.key==="Escape"&&(p.stopPropagation(),d(!1)),p.stopPropagation()},spellCheck:!1}),i.jsx("button",{className:"primary-button primary-button-small",onClick:g,children:f("picker.create")}),i.jsx("button",{className:"link-button",onClick:()=>d(!1),children:f("common.cancel")})]}):i.jsx("button",{className:"primary-button primary-button-small",onClick:()=>d(!0),children:f("picker.createHere")}),i.jsx("span",{className:"composer-spacer"}),i.jsx("button",{className:"picker-open",onClick:()=>a(v.pickerId,v.path),title:l(v.path),children:r})]})]})]})})}function nT(t,e){return zd(t)&&e!==null&&e.sessions>0}function rT(){return f("search.mode.titles")}function sT(){return f("search.mode.conversations")}function iT(){return f("search.mode.conversationsTitle")}function oT(t){return f(t==="conversations"?"search.placeholder.conversations":"search.placeholder.titles")}function lT(){return f("search.tooShort",{min:Yg})}function aT(t){return[...t.trim()].length<Yg}function cT(){return f("search.off")}function uT(t){const e=new Map;for(const r of t){const l=`${r.agent}:${r.sessionId}`;let a=e.get(l);a===void 0&&(a={key:l,agent:r.agent,sessionId:r.sessionId,title:r.title,titleHit:null,hits:[],lastAt:null},e.set(l,a)),r.eventId===null?a.titleHit=r:a.hits.push(r),r.at!==null&&(a.lastAt=Math.max(a.lastAt??0,r.at))}return[...e.values()]}const dT=40;function x_(t,e=dT){const r=t.matchStart+t.matchLength;let l=t.snippet.slice(0,t.matchStart);if(l.length>e){let a=l.length-e;const y=l.charCodeAt(a);y>=56320&&y<=57343&&(a+=1),l=`…${l.slice(a)}`}return{before:l,match:t.snippet.slice(t.matchStart,r),after:t.snippet.slice(r)}}function hT(t){return t.role==="user"?f("search.role.user"):t.role==="assistant"?f("search.role.assistant"):f("search.role.title")}function S_(t){return x_(t).match.trim()}function fT(t){const e=t.hits[0]??t.titleHit;return e===null?"":S_(e)}const Id=t=>f("search.sessions",{count:t});function pT(t,e){return{query:e.query,hits:t===null?[...e.hits]:[...t.hits,...e.hits],sessionsScanned:e.sessionsScanned,sessionsTotal:e.sessionsTotal,truncated:null}}function mT(t){const{result:e}=t;if(t.searching&&t.error===null){if(e===null)return f("search.status.searching");const l={count:e.sessionsTotal,scanned:e.sessionsScanned};return e.hits.length===0?f("search.status.progress",l):f("search.status.progressFound",{...l,found:Dm(e)})}if(t.error!==null)return t.error;if(e===null)return null;const r=e.hits.length===0?f("search.status.none"):Dm(e);if(e.truncated===null&&e.hits.length===0&&e.sessionsScanned>0)return f("search.status.noneIn",{sessions:Id(e.sessionsScanned)});if(e.truncated==="results")return f("search.status.truncatedResults",{found:r});if(e.truncated==="time"){const l=Math.max(0,e.sessionsTotal-e.sessionsScanned);return f("search.status.truncatedTime",{found:r,seconds:Math.round(U0/1e3),left:Id(l)})}return f("search.status.done",{found:r})}function Dm(t){const e=new Set(t.hits.map(r=>`${r.agent}:${r.sessionId}`)).size;return f("search.found",{hits:f("search.hits",{count:t.hits.length}),sessions:Id(e)})}function gT(t,e){const r=e.terminals.find(l=>l.kind==="agent"&&l.agent===t.agent&&l.sessionId===t.sessionId);if(r!==void 0)return{kind:"activate",terminalId:r.terminalId};for(const l of e.projects){const a=l.sessions.find(y=>y.agent===t.agent&&y.sessionId===t.sessionId);if(a!==void 0)return Da(a)&&a.relocated!==!0&&l.cwdExists&&e.canResume(a.agent)?{kind:"resume",cwd:ev(a.cwd,l.cwd,e.platform),session:a}:{kind:"copy"}}return{kind:"copy"}}const vT=/<(code|kbd|b|strong|em)>([\s\S]*?)<\/\1>|<br\s*\/?>/g;function vn(t,e,r){const l=lv(t,e),a=[];let y=0;for(const v of l.matchAll(vT)){const o=v.index??0;o>y&&a.push(ja(l.slice(y,o),e));const c=v[1];if(c===void 0)a.push(N.createElement("br",{key:a.length}));else{const m=ja(v[2]??"",e);a.push(N.createElement(c,{key:a.length},m))}y=o+v[0].length}return y<l.length&&a.push(ja(l.slice(y),e)),a.length===1?a[0]:a}const Pm="1.0.0",Om="agent-workbench.support-notice",_T=3e4;function wT(t){return/^[0-9A-Za-z][0-9A-Za-z.+-]{0,39}$/.test(t)?t:null}function bT(t,e){return t!==e}function yT(){return[{keys:"Alt + T",description:f("shortcuts.app.newTab")},{keys:"Alt + W",description:f("shortcuts.app.closeTab")},{keys:"Alt + ← / →",description:f("shortcuts.app.switchTab")},{keys:"Alt + P",description:f("shortcuts.app.togglePanel")},{keys:"Shift + Tab",description:f("shortcuts.app.previousTab")}]}function kT({agent:t,onClose:e}){return N.useEffect(()=>{const r=l=>{l.key==="Escape"&&(l.preventDefault(),l.stopPropagation(),e())};return window.addEventListener("keydown",r,!0),()=>window.removeEventListener("keydown",r,!0)},[e]),i.jsx("div",{className:"modal-backdrop",onClick:e,children:i.jsxs("div",{className:"modal",role:"dialog","aria-label":f("shortcuts.ariaLabel"),onClick:r=>r.stopPropagation(),children:[i.jsxs("header",{className:"modal-header",children:[i.jsx("span",{className:"modal-title",children:f("shortcuts.title")}),i.jsx("button",{className:"icon-button",onClick:e,title:f("common.close"),children:"×"})]}),i.jsxs("div",{className:"modal-body",children:[i.jsx("h3",{className:"modal-section",children:f("shortcuts.section.app")}),i.jsx(Qu,{shortcuts:yT()}),i.jsx("h3",{className:"modal-section",children:f("shortcuts.section.composer")}),i.jsx(Qu,{shortcuts:aC(t!==null&&t.capabilities.imagesByPath!==null)}),t!==null&&i.jsxs(i.Fragment,{children:[i.jsx("h3",{className:"modal-section",children:f("shortcuts.section.cli")}),i.jsx("p",{className:"modal-hint",children:vn("shortcuts.cliHint")}),i.jsx(Qu,{shortcuts:Es[t.id].shortcuts}),Es[t.id].shortcutsNote!==null&&i.jsx("p",{className:"modal-hint",children:Es[t.id].shortcutsNote})]}),i.jsx("p",{className:"modal-hint",children:vn("shortcuts.browserReserved")}),i.jsx("p",{className:"modal-hint",children:vn("shortcuts.altNumber")}),i.jsxs("p",{className:"modal-hint support-hint",children:[i.jsx("span",{"aria-hidden":"true",children:"☕"})," ",f("support.notice")," ",i.jsx("a",{href:tv,target:"_blank",rel:"noreferrer noopener",children:f("support.link")})]})]})]})})}function Qu({shortcuts:t}){return i.jsx("dl",{className:"shortcut-list",children:t.map(e=>i.jsxs("div",{className:"shortcut-row",children:[i.jsx("dt",{children:i.jsx("kbd",{children:e.keys})}),i.jsx("dd",{children:e.description})]},e.keys))})}const CT=1e3,xT=5e3;function Bm({info:t,agentLabel:e,purpose:r="status",onRefresh:l,onClose:a}){const[y,v]=N.useState(null),[o,c]=N.useState(!1),m=N.useRef(null),w=N.useRef(null);N.useEffect(()=>{const _=g=>{g.key==="Escape"&&(g.preventDefault(),g.stopPropagation(),a())};return window.addEventListener("keydown",_,!0),()=>window.removeEventListener("keydown",_,!0)},[a]),N.useEffect(()=>{c(!1)},[t]),N.useEffect(()=>()=>{m.current!==null&&window.clearTimeout(m.current),w.current!==null&&window.clearTimeout(w.current)},[]);const d=(_,g)=>{navigator.clipboard.writeText(g).then(()=>{v(_),m.current!==null&&window.clearTimeout(m.current),m.current=window.setTimeout(()=>v(null),CT)}).catch(()=>v(null))},k=()=>{c(!0),l(),w.current!==null&&window.clearTimeout(w.current),w.current=window.setTimeout(()=>c(!1),xT)},L=t.state==="active",M=f("statusLine.title",{agent:e}),b=r==="plan-limits",h=rC(t,e);return i.jsx("div",{className:"modal-backdrop",onClick:a,children:i.jsxs("div",{className:"modal",role:"dialog","aria-label":M,onClick:_=>_.stopPropagation(),children:[i.jsxs("header",{className:"modal-header",children:[i.jsx("span",{className:"modal-title",children:M}),i.jsx("button",{className:"icon-button",onClick:a,title:f("common.close"),children:"×"})]}),i.jsxs("div",{className:"modal-body",children:[i.jsx("p",{className:`status-line-state${L?" status-line-state-active":""}`,children:tC(t.state)}),i.jsx("p",{className:"modal-hint",children:f(b?"statusLine.planBenefit":"statusLine.benefit")}),b&&i.jsx("p",{className:"modal-hint",children:f("statusLine.planReplaces")}),i.jsx("h3",{className:"modal-section",children:f("statusLine.lineSection")}),t.fragment===null?i.jsx("p",{className:"modal-hint",children:b?f("statusLine.planNoFragment"):nC()}):i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"modal-hint",children:vn("statusLine.mergeHint")}),i.jsxs("div",{className:"status-line-fragment",children:[i.jsx("pre",{className:"tool-pre",children:t.fragment}),i.jsx("button",{className:"link-button",onClick:()=>d("line",t.fragment??""),title:f("statusLine.copyTitle"),children:y==="line"?i.jsxs(i.Fragment,{children:["✓ ",f("statusLine.copied")]}):f("statusLine.copy")})]}),h!==null&&i.jsx("p",{className:"modal-hint",children:i.jsx("button",{className:"link-button",onClick:()=>d("prompt",h),title:f("statusLine.copyPromptTitle"),children:y==="prompt"?i.jsxs(i.Fragment,{children:["✓ ",f("statusLine.promptCopied")]}):f("statusLine.copyPrompt")})})]}),i.jsx("h3",{className:"modal-section",children:f("statusLine.whereSection")}),i.jsx("p",{className:"status-line-path",children:t.settingsPath}),i.jsx("p",{className:"modal-hint",children:f("statusLine.whereHint")}),i.jsx("h3",{className:"modal-section",children:f("statusLine.scriptSection")}),i.jsx("p",{className:"modal-hint",children:f(b?"statusLine.planScriptHint":"statusLine.scriptHint")}),i.jsx("p",{className:"status-line-path",children:t.scriptPath}),i.jsx("p",{className:"modal-hint",children:vn("statusLine.runsEverywhere")}),i.jsxs("div",{className:"status-line-actions",children:[i.jsx("button",{className:"primary-button",onClick:k,disabled:o,children:f(o?"statusLine.checking":"statusLine.check")}),i.jsx("span",{className:"modal-hint",children:f("statusLine.checkHint")})]})]})]})})}function ST(){const[t,e]=N.useState(()=>bT(Wt(Om,null,wT),Pm));return N.useEffect(()=>{if(!t)return;jt(Om,Pm);const r=window.setTimeout(()=>e(!1),_T);return()=>window.clearTimeout(r)},[t]),t?i.jsxs("div",{className:"banner banner-support",role:"status",children:[i.jsx("span",{children:f("support.notice")}),i.jsx("a",{className:"banner-support-link",href:tv,target:"_blank",rel:"noreferrer noopener",onClick:()=>e(!1),children:f("support.link")}),i.jsx("button",{className:"link-button banner-support-dismiss",onClick:()=>e(!1),children:f("support.dismiss")})]}):null}function jd({agent:t,agents:e}){return i.jsx("span",{className:"agent-badge",title:al(t,e),children:$k(t)})}const ET=500,Fm=10;function TT(t){const e=N.useRef(null),r=N.useRef(null),l=N.useRef(!1),a=N.useRef(t);a.current=t;const y=N.useCallback(()=>{e.current!==null&&window.clearTimeout(e.current),e.current=null,r.current=null},[]),v=N.useCallback(w=>{w.pointerType==="mouse"||w.button!==0||(y(),l.current=!1,r.current={x:w.clientX,y:w.clientY},e.current=window.setTimeout(()=>{e.current=null,l.current=!0,a.current()},ET))},[y]),o=N.useCallback(w=>{const d=r.current;d!==null&&(Math.abs(w.clientX-d.x)>Fm||Math.abs(w.clientY-d.y)>Fm)&&y()},[y]),c=N.useCallback(w=>{(l.current||e.current!==null)&&w.preventDefault()},[]),m=N.useCallback(w=>{l.current&&(l.current=!1,w.preventDefault(),w.stopPropagation())},[]);return{onPointerDown:v,onPointerMove:o,onPointerUp:y,onPointerCancel:y,onContextMenu:c,onClickCapture:m}}function LT({onLongPress:t,...e}){const r=TT(t);return i.jsx("button",{...e,...r})}function ah({className:t,text:e,title:r,disabled:l,offerAgentChoice:a,agents:y,agent:v,onOpen:o}){var M;const[c,m]=N.useState(!1),w=N.useRef(null),d=N.useCallback(()=>m(!1),[]),k=N.useCallback(b=>{m(!1),o(b)},[o]);if(!a)return i.jsx("button",{className:t,onClick:()=>o(),disabled:l,title:r,children:e});const L=((M=y.find(b=>b.id===v))==null?void 0:M.label)??null;return i.jsxs("span",{className:"split-button",children:[i.jsx("button",{className:`${t} split-button-main`,onClick:()=>o(v??void 0),disabled:l,title:L===null?r:f("agentMenu.titleWithAgent",{title:r,label:L}),children:e}),i.jsx("button",{ref:w,className:`${t} split-button-arrow`,onClick:()=>m(b=>!b),disabled:l,"aria-haspopup":"menu","aria-expanded":c,title:f("agentMenu.chooseTitle"),children:"▾"}),c&&w.current!==null&&i.jsx(l_,{agents:y,preselected:v,anchor:w.current,onPick:k,onClose:d})]})}function NT(t){const e=new Date(t);return e.setHours(0,0,0,0),e.getTime()}function E_(t,e,r,l){const a=new Set;for(const y of t)for(const v of y.sessions)v.agent===e&&(v.archived||v.updatedAt<r&&(l.has(v.sessionId)||a.add(v.sessionId)));return[...a]}function RT(t,e,r,l){const a=[];for(const o of t)for(const c of o.sessions)a.includes(c.agent)||a.push(c.agent);const y=l,v=o=>{const c=y.indexOf(o);return c===-1?l.length:c};return a.sort((o,c)=>v(o)-v(c)).map(o=>({agent:o,count:E_(t,o,e,r).length})).filter(o=>o.count>0)}function T_(t,e){const r=new Set;let l=0;for(const a of t.sessions)if(!a.archived){if(e.has(a.sessionId)){l+=1;continue}r.add(a.sessionId)}return{sessionIds:[...r],blocked:l}}function MT(t){const{sessionIds:e,blocked:r}=t;if(e.length===0)return f("archive.allBlocked",{count:r});const l=f("archive.confirm",{count:e.length});return r===0?l:f("archive.withBlocked",{confirm:l,blocked:f("archive.blockedStays",{count:r})})}const Hm=12;function AT(t){let e=2166136261;for(let r=0;r<t.length;r+=1)e^=t.charCodeAt(r),e=Math.imul(e,16777619);return e>>>0}function oi(t){const e=t.toLowerCase().replace(/[\\/]+/g,"/").replace(/\/+$/,"");return`hsl(${AT(e)%Hm*(360/Hm)} var(--project-color-s) var(--project-color-l))`}function Xi(){return f("vault.name")}function IT(){return f("vault.privacy")}function jT(){return f("vault.archived")}function DT(){return f("vault.mark.copy")}function Um(){return f("vault.mark.copyTitle")}function PT(){return f("vault.mark.partial")}function OT(){return f("vault.mark.partialTitle")}function L_(t){return f("vault.sessions",{count:t})}function ch(t){return t==="measuring"||t==="writing"||t==="moving"}function BT(t){const e=t.progress;switch(t.state){case"measuring":return e===null?f("vault.state.measuring"):f("vault.state.measuringProgress",{done:e.done,total:e.total});case"writing":return e===null?f("vault.state.writing"):f("vault.state.writingProgress",{done:e.done,total:e.total});case"moving":return f("vault.state.moving");default:return t.enabled?f("vault.state.on"):f("vault.state.off")}}function FT(t){if(t===null||!t.enabled)return null;const e=[Xi(),L_(t.sessions)];return t.state==="writing"?e.push(t.progress===null?f("vault.line.copying"):f("vault.line.copyingProgress",{done:t.progress.done,total:t.progress.total})):t.state==="moving"?e.push(f("vault.line.moving")):t.state==="measuring"?e.push(f("vault.line.measuring")):e.push(t.lastPassAt===null?f("vault.line.neverCopied"):nr(t.lastPassAt)),t.pending>0&&e.push(f("vault.line.pending",{count:t.pending})),e.join(" · ")}function HT(t){return t===null?Xi():t.enabled?f("vault.button.on"):f("vault.button.off")}function UT(t){return t.enabled?"enabled":ch(t.state)?"busy":t.measurement!==null?"measured":t.passSessions>0?"existing":"needs-measure"}function $T(t,e){return ch(t.state)?f("vault.busy"):e?null:f("vault.indexNotReady")}function WT(t){return ch(t.state)?f("vault.busy"):null}function qT(t){return f("vault.previousDir",{dir:t})}function zT(t){const e=[];return t.skippedEmpty>0&&e.push(f("vault.note.empty",{count:t.skippedEmpty})),t.unsupported>0&&e.push(f("vault.note.unsupported",{count:t.unsupported})),t.failed>0&&e.push(t.failureReasons.length>0?f("vault.note.failedWithReasons",{count:t.failed,reasons:t.failureReasons.map(Ht).join("; ")}):f("vault.note.failed",{count:t.failed})),e.length===0?null:f("vault.note.notCopied",{parts:e.join(" · ")})}function KT(t,e){const r=t.byAgent.map(y=>({agent:y.agent,label:al(y.agent,e),sessions:y.sessions,bytes:y.eventBytes+y.imageBytes,images:y.images,imageBytes:y.imageBytes,skippedArchived:y.skippedArchived,note:zT(y)})),l=r.reduce((y,v)=>({sessions:y.sessions+v.sessions,bytes:y.bytes+v.bytes,images:y.images+v.images,skippedArchived:y.skippedArchived+v.skippedArchived}),{sessions:0,bytes:t.memoryBytes,images:0,skippedArchived:0}),a=nr(t.measuredAt);return{rows:r,memoryProjects:t.memoryProjects,memoryBytes:t.memoryBytes,total:l,summary:a.length>0?f("vault.measure.summary",{when:a,duration:rl(t.durationMs)}):f("vault.measure.summaryNoWhen",{duration:rl(t.durationMs)})}}function VT(t){const e=t.storage==="vault";return{copy:e,partial:e&&t.partial}}function GT(t){switch(t){case"exporting":return f("vault.export.exporting");case"done":return f("vault.export.done");default:return f("vault.export.idle")}}const YT=1e3;function $m({hit:t}){const{before:e,match:r,after:l}=x_(t);return i.jsxs(i.Fragment,{children:[e,i.jsx("mark",{children:r}),l]})}function XT({project:t,openSessionIds:e,onConfirm:r,onCancel:l}){const a=T_(t,e);return i.jsxs("div",{className:"project-archive-confirm",role:"group",children:[i.jsx("span",{className:"archive-history-text",children:MT(a)}),a.sessionIds.length>0&&i.jsx("button",{className:"link-button",onClick:r,children:f("sidebar.action.archive")}),i.jsx("button",{className:"link-button",onClick:l,children:a.sessionIds.length>0?f("common.cancel"):f("common.close")})]})}function QT({project:t,removing:e,onChange:r,onRemove:l}){const a=t.relocations??[],y=a.filter(c=>!c.paused),v=y[0]??a[0];if(v===void 0)return null;const o=y.length>0?f("sidebar.project.relocated",{from:y.length>1?`${v.from} (+${y.length-1})`:v.from}):f("sidebar.project.relocationPaused",{from:v.from});return i.jsxs("div",{className:"project-relocation",title:a.map(c=>c.from).join(`
|
|
146
|
+
`),children:[i.jsx("span",{className:"project-relocation-text",children:o}),r!==null&&y.length>0&&i.jsx("button",{className:"link-button",onClick:()=>r(t),title:f("sidebar.project.changeLocationTitle"),children:f("sidebar.project.changeLocation")}),l!==null&&i.jsx("button",{className:"link-button",onClick:()=>l(t),disabled:e,title:f("sidebar.project.removeLocationTitle"),children:f("sidebar.project.removeLocation")})]})}function Ju(t){if(t.cwd.length===0)return t.fallbackName;const e=t.cwd.split(/[\\/]/).filter(r=>r.length>0);return e[e.length-1]??t.cwd}function Wm({out:t}){return i.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:[i.jsx("rect",{x:"2.5",y:"3.5",width:"19",height:"5",rx:"1.2"}),i.jsx("path",{d:"M4.5 8.5v10a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2v-10"}),t?i.jsx("path",{d:"M12 18.5v-6M9.2 15.3 12 12.5l2.8 2.8"}):i.jsx("path",{d:"M10 12.5h4"})]})}function JT(){return i.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:[i.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"}),i.jsx("rect",{x:"4",y:"7",width:"12",height:"14",rx:"1.5"}),i.jsx("path",{d:"M7.5 12h5M7.5 15.5h5"})]})}function ZT({done:t}){return i.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?i.jsx("path",{d:"M5 12.5l4.5 4.5L19 7.5"}):i.jsxs(i.Fragment,{children:[i.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"}),i.jsx("path",{d:"M12 10.5v6.5M9.2 14.2 12 17l2.8-2.8"})]})})}function eL({candidates:t,agents:e,onArchiveAgent:r,onClose:l,anchorRef:a}){const[y,v]=N.useState(null),o=N.useRef(null);return N.useEffect(()=>{const c=d=>{var k,L;return d instanceof Node&&(((k=o.current)==null?void 0:k.contains(d))===!0||((L=a.current)==null?void 0:L.contains(d))===!0)},m=d=>{d.key!=="Escape"||!c(document.activeElement)||(d.preventDefault(),d.stopPropagation(),l())},w=d=>{c(d.target)||l()};return window.addEventListener("keydown",m,!0),document.addEventListener("pointerdown",w,!0),()=>{window.removeEventListener("keydown",m,!0),document.removeEventListener("pointerdown",w,!0)}},[a,l]),i.jsxs("div",{ref:o,className:"archive-history",role:"region","aria-label":f("sidebar.history.region"),children:[i.jsxs("div",{className:"archive-history-header",children:[i.jsx("span",{children:f("sidebar.history.heading")}),i.jsx("button",{className:"icon-button",onClick:l,title:f("common.closeEsc"),children:"×"})]}),t.map(({agent:c,count:m})=>{const w=al(c,e);return y===c?i.jsxs("div",{className:"archive-history-row archive-history-confirm",children:[i.jsx("span",{className:"archive-history-text",children:f("sidebar.history.confirm",{count:m,label:w})}),i.jsx("button",{className:"link-button",onClick:()=>r(c),children:f("sidebar.action.archive")}),i.jsx("button",{className:"link-button",onClick:()=>v(null),children:f("common.cancel")})]},c):i.jsxs("div",{className:"archive-history-row",children:[i.jsxs("span",{className:"archive-history-text",children:[i.jsx("span",{className:"archive-history-agent",children:w}),i.jsx("span",{className:"archive-history-count",children:f("sidebar.history.count",{count:m})})]}),i.jsx("button",{className:"link-button",onClick:()=>v(c),children:f("sidebar.action.archive")})]},c)})]})}function tL({projects:t,indexStatus:e,disabled:r,openSessionIds:l,openBlocked:a,onOpenProject:y,agents:v,offerAgentChoice:o,agentForProject:c,onOpenSession:m,canResume:w,platform:d,onRefresh:k,onArchive:L,onHide:M,width:b,onNewProject:h,vault:_,onOpenVault:g,onOpenVaultSession:p,onExportProject:T,exporting:A,lastExported:E,onContinueSession:S,moveToBranchOf:x,globalSearch:R,onOpenSearchHit:I,onNewWorktree:D,onReopenWorktree:P,onLocateProject:F,onRemoveLocation:z,removingLocation:q}){const[K,V]=N.useState(new Set),[W,O]=N.useState(null);N.useEffect(()=>{const de=E===null?0:E.at+YT-Date.now();if(E===null||de<=0)return;O(E.projectKey);const Pe=window.setTimeout(()=>O(null),de);return()=>window.clearTimeout(Pe)},[E]);const U=de=>A.has(de)?"exporting":W===de?"done":"idle",H=FT(_),[$,Z]=N.useState(""),[re,we]=N.useState(!1),[_e,Q]=N.useState(new Set),[Y,te]=N.useState("titles"),ee=R===null?"titles":Y,[ye,ge]=N.useState(!1),Be=R!==null&&ee==="conversations"&&$.trim().length>0&&(ye||R.submitted!==null),Ue=(R==null?void 0:R.result)??null,ze=N.useMemo(()=>Be&&Ue!==null?uT(Ue.hits):[],[Be,Ue]),gt=de=>{te(de),ge(!1),R==null||R.clear()},Fe=()=>{if(R!==null){if(aT($)){ge(!0),R.clear();return}ge(!1),R.search($.trim(),re)}},pt=(R==null?void 0:R.submitted)??null,yt=R==null?void 0:R.search;N.useEffect(()=>{ee!=="conversations"||pt===null||yt===void 0||pt.includeArchived!==re&&yt(pt.query,re)},[ee,pt,yt,re]);const oe=N.useMemo(()=>t.reduce((de,Pe)=>de+Pe.sessions.filter(Re=>Re.archived).length,0),[t]),Ae=N.useMemo(()=>{const de=ee==="titles"?$.trim().toLowerCase():"";return t.map(Pe=>{const Re=re?Pe.sessions:Pe.sessions.filter(ht=>!ht.archived);if(Re.length===0)return null;if(de.length===0)return{...Pe,sessions:Re};if(Ju(Pe).toLowerCase().includes(de)||Pe.cwd.toLowerCase().includes(de))return{...Pe,sessions:Re};const fe=Re.filter(ht=>wr(ht.title,ht.titleSource).toLowerCase().includes(de));return fe.length>0?{...Pe,sessions:fe}:null}).filter(Pe=>Pe!==null)},[t,$,re,ee]),De=ee==="titles"&&$.trim().length>0,Le=de=>de.archived||!l.has(de.sessionId),[nt,je]=N.useState(!1),Ke=N.useRef(null),kt=NT(Date.now()),Lt=N.useMemo(()=>v.map(de=>de.id),[v]),xt=N.useMemo(()=>RT(t,kt,l,Lt),[t,kt,l,Lt]),[vt,dt]=N.useState(null);N.useEffect(()=>{xt.length===0&&je(!1)},[xt.length]);const Qe=N.useCallback(()=>je(!1),[]),St=de=>{const Pe=E_(t,de,kt,l);Pe.length>0&&(L(Pe,!0),dt({what:al(de,v),sessionIds:Pe})),je(!1)},[Ft,Gt]=N.useState(null),Ie=de=>{const Pe=T_(de,l);Pe.sessionIds.length>0&&(L(Pe.sessionIds,!0),dt({what:Ju(de),sessionIds:Pe.sessionIds})),Gt(null)},$e=()=>{vt!==null&&L(vt.sessionIds,!1),dt(null)},ue=de=>{Q(Pe=>{const Re=new Set(Pe);return Re.has(de)?Re.delete(de):Re.add(de),Re})},st=N.useMemo(()=>{const de=[];for(const Pe of Ae)for(const Re of Pe.sessions)_e.has(Re.sessionId)&&de.push(Re);return de},[Ae,_e]),ft=de=>{const Pe=st.filter(Re=>de?Le(Re):!0).map(Re=>Re.sessionId);Pe.length>0&&L(Pe,de),Q(new Set)},et=de=>{V(Pe=>{const Re=new Set(Pe);return Re.has(de)?Re.delete(de):Re.add(de),Re})},tt=e.state==="scanning";return i.jsxs("aside",{className:"sidebar",style:{width:`${b}px`},children:[i.jsxs("div",{className:"sidebar-header",children:[i.jsx("input",{className:"sidebar-filter",type:"search",placeholder:oT(ee),value:$,onChange:de=>{Z(de.target.value),ee==="conversations"&&(ge(!1),de.target.value.trim().length===0&&(R==null||R.clear()))},onKeyDown:de=>{ee!=="conversations"||de.key!=="Enter"||(de.preventDefault(),Fe())},spellCheck:!1}),i.jsx("button",{className:"icon-button",onClick:h,title:f("sidebar.newProject"),disabled:r,children:"+"}),i.jsx("button",{className:"icon-button",onClick:k,title:f("sidebar.reindex"),disabled:tt,children:"⟳"}),i.jsx("button",{className:`icon-button${(_==null?void 0:_.enabled)===!0?" icon-button-on":""}`,onClick:g,title:HT(_),"aria-label":Xi(),children:i.jsx(JT,{})}),i.jsx("button",{className:"icon-button",onClick:M,title:f("sidebar.hide"),children:"«"})]}),R!==null&&i.jsxs("div",{className:"sidebar-search-mode",role:"group","aria-label":f("sidebar.searchMode.label"),children:[i.jsx("button",{className:`sidebar-search-mode-option${ee==="titles"?" is-on":""}`,"aria-pressed":ee==="titles",onClick:()=>gt("titles"),title:f("sidebar.searchMode.titlesTitle"),children:rT()}),i.jsx("button",{className:`sidebar-search-mode-option${ee==="conversations"?" is-on":""}`,"aria-pressed":ee==="conversations",onClick:()=>gt("conversations"),title:iT(),children:sT()})]}),tt&&i.jsx("div",{className:"sidebar-progress",children:f("sidebar.indexing",{scanned:e.scannedFiles,total:e.totalFiles})}),(oe>0||xt.length>0)&&i.jsxs("div",{className:"sidebar-archive-bar",children:[oe>0&&i.jsx("button",{className:`sidebar-archived-toggle${re?" is-on":""}`,onClick:()=>we(de=>!de),title:f("sidebar.archived.toggleTitle"),children:re?f("sidebar.archived.hide",{count:oe}):f("sidebar.archived.show",{count:oe})}),xt.length>0&&i.jsx("button",{ref:Ke,className:`link-button sidebar-archive-history${nt?" is-on":""}`,onClick:()=>je(de=>!de),"aria-expanded":nt,title:f("sidebar.history.buttonTitle"),children:f("sidebar.history.button")})]}),nt&&xt.length>0&&i.jsx(eL,{candidates:xt,agents:v,onArchiveAgent:St,onClose:Qe,anchorRef:Ke}),vt!==null&&!nt&&i.jsxs("div",{className:"archive-history archive-history-undo",role:"status",children:[i.jsx("span",{className:"archive-history-text",children:f("sidebar.undo.text",{count:vt.sessionIds.length,what:vt.what})}),i.jsx("button",{className:"link-button",onClick:$e,children:f("sidebar.action.undo")}),i.jsx("button",{className:"icon-button",onClick:()=>dt(null),title:f("sidebar.undo.dismissTitle"),children:"×"})]}),H!==null&&i.jsx("button",{className:`sidebar-vault-line${(_==null?void 0:_.lastError)!=null?" is-problem":""}`,onClick:g,title:(_==null?void 0:_.lastError)!=null?f("sidebar.vaultLine.lastError",{error:Ht(_.lastError)}):f("sidebar.vaultLine.title"),children:H}),i.jsxs("div",{className:"sidebar-scroll",children:[Be&&R!==null&&i.jsxs("div",{className:"search-results",children:[!R.vaultEnabled&&i.jsx("p",{className:"search-note",children:cT()}),i.jsx("p",{className:`search-status${R.error!==null?" is-problem":""}`,role:"status",children:ye?lT():mT(R)}),!ye&&ze.map(de=>{const Pe=de.hits[0]??de.titleHit;return Pe===null?null:i.jsxs("div",{className:"search-group",children:[i.jsxs("button",{className:"search-group-title",onClick:()=>I(Pe,fT(de)),title:wr(de.title),children:[i.jsx(jd,{agent:de.agent,agents:v}),de.titleHit!==null?i.jsx($m,{hit:de.titleHit}):wr(de.title)]}),de.hits.map(Re=>i.jsxs("button",{className:"search-hit",onClick:()=>I(Re,S_(Re)),children:[i.jsx("span",{className:"search-hit-snippet",children:i.jsx($m,{hit:Re})}),i.jsxs("span",{className:"search-hit-meta",children:[hT(Re),Re.at!==null?` · ${nr(Re.at)}`:""]})]},Re.eventId??"titulo"))]},de.key)})]}),!Be&&Ae.length===0&&!tt&&i.jsx("p",{className:"sidebar-empty",children:t.length===0?f("sidebar.empty.noProjects"):f("sidebar.empty.noMatch")}),!Be&&Ae.map(de=>{const Pe=K.has(de.key)||De,Re=!r&&de.cwdExists,Ce=a(de.cwd);return i.jsxs("div",{className:"project",children:[i.jsxs("div",{className:"project-row",children:[i.jsxs("button",{className:"project-toggle",onClick:()=>et(de.key),title:de.cwd.length>0?de.cwd:de.fallbackName,children:[i.jsx("span",{className:`chevron${Pe?" chevron-open":""}`,children:"›"}),i.jsx("span",{className:"project-swatch",style:{background:oi(de.cwd)},"aria-hidden":"true"}),i.jsx("span",{className:"project-name",children:Ju(de)}),i.jsx("span",{className:"project-count",children:de.sessions.length})]}),i.jsxs("span",{className:"project-actions",children:[D!==null&&de.isGitRepo&&de.cwdExists&&i.jsx("button",{className:"icon-button project-action",onClick:()=>D(de),disabled:r,title:f("worktree.new"),"aria-label":f("worktree.new"),children:i.jsx(Nd,{})}),T!==null&&i.jsx("button",{className:`icon-button project-action${U(de.key)!=="idle"?" project-action-busy":""}`,onClick:()=>T(de.key),disabled:U(de.key)==="exporting",title:GT(U(de.key)),"aria-label":f("sidebar.project.export"),children:i.jsx(ZT,{done:U(de.key)==="done"})}),i.jsx("button",{className:`icon-button project-action${Ft===de.key?" project-action-busy":""}`,onClick:()=>Gt(fe=>fe===de.key?null:de.key),title:f("sidebar.project.archiveTitle"),"aria-label":f("sidebar.project.archive"),"aria-expanded":Ft===de.key,children:i.jsx(Wm,{out:!1})})]}),i.jsx(ah,{className:"icon-button",text:"+",title:Ce?vv():de.cwdExists?f("sidebar.project.newSession"):f("sidebar.project.folderGone"),disabled:!Re||Ce,offerAgentChoice:o,agents:v,agent:o?c(de):null,onOpen:fe=>y(de.cwd,fe)})]}),!de.cwdExists&&i.jsxs("div",{className:"project-missing",title:de.cwd,children:[f("sidebar.project.missing"),F!==null&&de.cwd.length>0&&i.jsx("button",{className:"link-button project-locate",onClick:()=>F(de),title:f("sidebar.project.locateTitle"),children:f("sidebar.project.locate")})]}),de.relocations!==void 0&&de.relocations.length>0&&i.jsx(QT,{project:de,removing:q.has(de.key),onChange:F,onRemove:z}),Ft===de.key&&i.jsx(XT,{project:de,openSessionIds:l,onConfirm:()=>Ie(de),onCancel:()=>Gt(null)}),Pe&&i.jsx("ul",{className:"session-list",children:de.sessions.map(fe=>{var be;const ht=_e.has(fe.sessionId),ve=!Le(fe),rt=RC(fe.agent,v,o),Pt=VT(fe),Et=Da(fe)&&w(fe.agent),Ge=fe.worktree!==null&&!fe.worktree.exists,ct=fe.relocated===!0,Tt=yC(fe),se=Pt.copy?p!==null:Re&&Et&&!Ge&&!ct,ke=x(fe);return i.jsxs("li",{className:`session-row${fe.archived?" session-archived":""}${ht?" session-selected":""}`,children:[i.jsxs(LT,{className:"session-item",onLongPress:()=>ue(fe.sessionId),onClick:lt=>{if(lt.ctrlKey||lt.metaKey){ue(fe.sessionId);return}if(Pt.copy){p==null||p(fe);return}Da(fe)&&(fe.archived&&L([fe.sessionId],!1),m(ev(fe.cwd,de.cwd,d),fe))},disabled:!se,title:Pt.copy?`${wr(fe.title,fe.titleSource)}
|
|
147
|
+
${p===null?f("remote.onlyOnHost"):Um()}`:ct?f("sidebar.session.relocatedTitle",{title:wr(fe.title,fe.titleSource)}):rt.unavailableTitle??wr(fe.title,fe.titleSource),children:[i.jsxs("span",{className:"session-title",children:[rt.badge&&i.jsx(jd,{agent:fe.agent,agents:v}),Pt.copy&&i.jsx("span",{className:"session-vault-mark",title:Um(),children:DT()}),Pt.partial&&i.jsx("span",{className:"session-partial-mark",title:OT(),children:PT()}),fe.worktree!==null&&i.jsxs("span",{className:`session-branch${Ge?" session-branch-gone":""}`,title:Ge?f("worktree.sidebar.removedTitle"):f("worktree.sidebar.branchTitle",{branch:fe.worktree.branch}),children:[fe.worktree.branch,Ge&&i.jsx("span",{className:"session-branch-note",children:f("worktree.sidebar.removed")})]}),wr(fe.title,fe.titleSource)]}),i.jsx("span",{className:"session-meta",children:nr(fe.updatedAt)})]}),ke!==null&&!Pt.copy&&!Ge&&i.jsx("button",{className:"icon-button session-move",onClick:ke,title:f("worktree.move.title"),"aria-label":f("worktree.move.title"),children:i.jsx(sh,{})}),i.jsx(a_,{targets:mv(v,fe.agent,fe.partial,Tt.sameCliToo),className:"icon-button session-continue",text:"↪",title:Tt.title,blockedReason:kC(de),onPick:lt=>S(fe,lt)}),Ge&&((be=fe.worktree)==null?void 0:be.reopenable)===!0&&Re&&Da(fe)&&w(fe.agent)&&i.jsx("button",{className:"icon-button session-action session-reopen",onClick:()=>P(fe,de),title:f("worktree.sidebar.reopenTitle"),"aria-label":f("worktree.sidebar.reopen"),children:i.jsx(Nd,{})}),i.jsx("button",{className:"icon-button session-action",onClick:()=>L([fe.sessionId],!fe.archived),disabled:ve,title:fe.archived?f("sidebar.session.restore"):f(ve?"sidebar.session.blocked":"sidebar.session.archive"),children:i.jsx(Wm,{out:fe.archived})})]},`${fe.agent}:${fe.sessionId}`)})})]},de.key)})]}),st.length>0&&i.jsxs("div",{className:"sidebar-selection",children:[i.jsx("span",{children:f("sidebar.selection.count",{count:st.length})}),st.some(de=>!de.archived)&&i.jsx("button",{className:"link-button",onClick:()=>ft(!0),children:f("sidebar.action.archive")}),st.some(de=>de.archived)&&i.jsx("button",{className:"link-button",onClick:()=>ft(!1),children:f("sidebar.action.restore")}),i.jsx("button",{className:"link-button",onClick:()=>Q(new Set),children:f("common.cancel")})]})]})}function Dd({x:t,y:e,items:r,onClose:l,anchor:a=null}){const y=N.useRef(null),[v,o]=N.useState({left:t,top:e});return N.useLayoutEffect(()=>{const c=y.current;if(c===null)return;const{width:m,height:w}=c.getBoundingClientRect();o({left:Math.max(4,Math.min(t,window.innerWidth-m-4)),top:Math.max(4,Math.min(e,window.innerHeight-w-4))})},[t,e]),N.useEffect(()=>{const c=w=>{w.key==="Escape"&&(w.stopPropagation(),l())},m=w=>{var k;const d=w.target;d instanceof Node&&((k=y.current)!=null&&k.contains(d)||a!=null&&a.contains(d))||l()};return window.addEventListener("keydown",c,!0),window.addEventListener("pointerdown",m,!0),window.addEventListener("scroll",l,!0),window.addEventListener("resize",l),()=>{window.removeEventListener("keydown",c,!0),window.removeEventListener("pointerdown",m,!0),window.removeEventListener("scroll",l,!0),window.removeEventListener("resize",l)}},[a,l]),i.jsx("div",{ref:y,className:"context-menu",style:{left:`${v.left}px`,top:`${v.top}px`},onPointerDown:c=>c.stopPropagation(),children:r.map(c=>i.jsxs("button",{className:"context-menu-item",lang:c.lang,role:c.checked===void 0?void 0:"menuitemradio","aria-checked":c.checked,onClick:()=>{c.onSelect(),l()},children:[c.checked!==void 0&&i.jsx("span",{className:"context-menu-check","aria-hidden":"true",children:c.checked?"✓":""}),c.label]},c.label))})}function N_({listLabel:t,docs:e,active:r,tooltipOf:l,labelOf:a=c=>c.title,onShowList:y,onSelect:v,onClose:o}){return i.jsxs("div",{className:"panel-subhead doc-strip",children:[i.jsx("button",{className:`doc-strip-list${r===null?" is-active":""}`,onClick:y,title:f("docs.backToList"),children:r===null?t:`← ${t}`}),i.jsx("div",{className:"strip-tabs doc-tabs",children:e.map(c=>i.jsxs("div",{className:`strip-tab${c.key===r?" is-active":""}`,children:[i.jsx("button",{className:"strip-tab-label",onClick:()=>v(c.key),title:l(c),children:a(c)}),i.jsx("button",{className:"strip-tab-close",onClick:()=>o(c.key),title:f("docs.tab.close"),children:"×"})]},c.key))})]})}const nL={added:"+",removed:"-",context:" ",hunk:"",meta:""};function R_({diff:t}){return t.binary?i.jsx("p",{className:"panel-note",children:f("diff.binary")}):t.lines.length===0?i.jsx("p",{className:"panel-note",children:t.message===null?f("diff.noChanges"):Ht(t.message)}):i.jsxs("div",{className:"panel-scroll",children:[i.jsx(M_,{lines:t.lines}),t.truncated&&i.jsx("p",{className:"panel-note",children:f("diff.truncated")})]})}function M_({lines:t}){return i.jsx("div",{className:"diff",children:t.map((e,r)=>i.jsxs("div",{className:`diff-line diff-line-${e.kind}`,children:[i.jsx("span",{className:"diff-num","aria-hidden":"true",children:e.oldLine??""}),i.jsx("span",{className:"diff-num","aria-hidden":"true",children:e.newLine??""}),i.jsx("span",{className:"diff-marker","aria-hidden":"true",children:nL[e.kind]}),i.jsx("span",{className:"diff-text",children:e.text})]},r))})}function qm(t){let e="";for(let r=0;r<t.length;r++){const l=t[r]??"",a=l.toLowerCase();e+=a.length===l.length?a:l}return e}function rL(t,e){if(e.length===0)return[];const r=qm(t),l=qm(e),a=[];let y=r.indexOf(l);for(;y!==-1;)a.push(y),y=r.indexOf(l,y+l.length);return a}function zm(t,e,r){for(let y=0;y<t.length;y++){const v=t[y]??0;if(r==="start"?e<v:e<=v){const o=y===0?0:t[y-1]??0;return{node:y,offset:e-o}}}const l=Math.max(0,t.length-1),a=l===0?0:t[l-1]??0;return{node:l,offset:(t[l]??0)-a}}function sL(t,e,r){return e===0?0:(t+r+e)%e}function iL(t){return/\.(md|markdown)$/i.test(t)}function oL(t,e){var y;const r=((y=e.split("#")[0])==null?void 0:y.split("?")[0])??"";if(r.length===0)return null;let l;try{l=decodeURIComponent(r)}catch{return null}if(/^[a-z][a-z0-9+.-]*:/i.test(l)||l.startsWith("/")||l.startsWith("\\"))return null;const a=t.split("/").slice(0,-1);for(const v of l.replace(/\\/g,"/").split("/")){if(v.includes(":"))return null;if(!(v===""||v===".")){if(v===".."){if(a.length===0)return null;a.pop();continue}a.push(v)}}return a.length===0?null:a.join("/")}function lL({text:t,language:e}){const[r,l]=N.useState(null);N.useEffect(()=>{if(e===null){l(null);return}let y=!1;return Ir(async()=>{const{highlightCode:v}=await import("./highlight-BEETev5A.js");return{highlightCode:v}},[]).then(({highlightCode:v})=>{y||l(v(t,e))}).catch(()=>{y||l(null)}),()=>{y=!0,l(null)}},[t,e]);const a=N.useMemo(()=>t.split(`
|
|
148
|
+
`).length,[t]);return i.jsxs("div",{className:"preview",children:[i.jsx("div",{className:"preview-gutter","aria-hidden":"true","data-search-skip":"",children:Array.from({length:a},(y,v)=>i.jsx("span",{children:v+1},v))}),r!==null?i.jsx("pre",{className:"preview-code hljs",dangerouslySetInnerHTML:{__html:r}}):i.jsx("pre",{className:"preview-code",children:t})]})}function Km({onInsert:t,onOpenWithSystem:e}){const[r,l]=N.useState(!1),a=N.useRef(null);N.useEffect(()=>()=>{a.current!==null&&window.clearTimeout(a.current)},[]);const y=()=>{t==null||t(),l(!0),a.current!==null&&window.clearTimeout(a.current),a.current=window.setTimeout(()=>l(!1),1200)};return i.jsxs("div",{className:"preview-actions",children:[t!==void 0&&i.jsx("button",{className:"primary-button primary-button-small preview-open",onClick:y,children:f(r?"files.pathInserted":"files.preview.insertPath")}),e!==null&&i.jsx("button",{className:"primary-button primary-button-small preview-open",onClick:e,children:f("files.menu.openWithSystem")})]})}const Pd="doc-search",Od="doc-search-current";function Bd(){const t=CSS.highlights,e=window.Highlight;return t===void 0||typeof e!="function"?null:t}function Vm(t){const e=window.Highlight;return new e(...t)}function Gm(){const t=Bd();t==null||t.delete(Pd),t==null||t.delete(Od)}function aL(t,e){if(e===null)return;const r=t.getBoundingClientRect(),l=e.getBoundingClientRect();(r.top<l.top+16||r.bottom>l.bottom-16)&&(e.scrollTop+=r.top-l.top-l.height/3),(r.left<l.left||r.right>l.right)&&(e.scrollLeft+=r.left-l.left-48)}function cL(t,e,r,l){const[a,y]=N.useState(0),[v,o]=N.useState(0),[c,m]=N.useState(0),w=N.useRef([]);N.useEffect(()=>{const k=t.current;if(k===null||r.length===0)return;let L=0;const M=new MutationObserver(()=>{L===0&&(L=window.requestAnimationFrame(()=>{L=0,m(b=>b+1)}))});return M.observe(k,{childList:!0,subtree:!0,characterData:!0}),()=>{M.disconnect(),L!==0&&window.cancelAnimationFrame(L)}},[t,r,l]),N.useEffect(()=>{const k=t.current;if(w.current=[],k===null||r.length===0){Gm(),y(0),o(0);return}const L=[],M=[];let b="";const h=document.createTreeWalker(k,NodeFilter.SHOW_TEXT,{acceptNode:g=>{var p;return(p=g.parentElement)!=null&&p.closest("[data-search-skip]")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}});for(let g=h.nextNode();g!==null;g=h.nextNode()){const p=g;L.push(p),b+=p.data,M.push(b.length)}w.current=rL(b,r).map(g=>{const p=zm(M,g,"start"),T=zm(M,g+r.length,"end"),A=document.createRange();return A.setStart(L[p.node],p.offset),A.setEnd(L[T.node],T.offset),A}),y(w.current.length),o(g=>g<w.current.length?g:0);const _=Bd();return _!==null&&w.current.length>0?_.set(Pd,Vm(w.current)):_==null||_.delete(Pd),Gm},[t,r,c,l]),N.useEffect(()=>{o(0)},[r]),N.useEffect(()=>{const k=w.current[v],L=Bd();if(k===void 0){L==null||L.delete(Od);return}L==null||L.set(Od,Vm([k])),aL(k,e.current)},[v,a,c,l,r,e]);const d=N.useCallback(k=>o(L=>sL(L,a,k)),[a]);return{count:a,index:v,step:d}}function A_({doc:t,content:e,readingText:r,truncatedText:l,onReload:a,onModeChange:y,onOpenWithSystem:v,onInsert:o,onOpenLink:c,initialScroll:m,onScrollChange:w,editor:d=null,insertButton:k}){const[L,M]=N.useState(""),b=N.useRef(null),h=N.useRef(null),_=(e==null?void 0:e.loaded)??null,g=_===null?"":_.kind==="file"?_.preview.text:_.plan.text,p=_!==null&&_.kind==="file"&&_.preview.binary,T=_!==null&&(_.kind==="file"?_.preview.truncated:_.plan.truncated),A=_!==null&&(_.kind==="plan"||_.preview.language==="markdown"||iL(_.preview.path)),E=A&&(t.mode??"formatted")==="formatted",S=_!==null&&_.kind==="file"?_.preview.language:"markdown",x=L.trim(),R=cL(h,b,x,`${E?"f":"s"}:${g.length}:${g.slice(0,64)}`),I=N.useRef(!1);N.useLayoutEffect(()=>{I.current||_===null||(I.current=!0,m!==void 0&&b.current!==null&&(b.current.scrollTop=m))},[_,m]);const D=c===void 0||_===null||_.kind!=="file"?void 0:K=>{const V=oL(t.key,K);return V===null?null:()=>c(V)},P=_!==null&&!p,F=(d==null?void 0:d.edit)??null;if(d!==null&&F!==null)return i.jsx(uL,{title:t.title,editor:d,insertButton:k});const z=_!==null&&_.kind==="file"&&_.preview.editable===!0,q=f(z?"docs.edit.title":T?"docs.edit.tooLarge":"docs.edit.unsafe");return i.jsxs("div",{className:"panel-body doc-viewer",children:[i.jsxs("div",{className:"doc-toolbar",children:[i.jsx("input",{className:"conversation-search-input",type:"search",placeholder:f("docs.search.placeholder"),value:L,disabled:!P,onChange:K=>M(K.target.value),onKeyDown:K=>{K.key==="Enter"&&R.step(K.shiftKey?-1:1),K.key==="Escape"&&M(""),K.stopPropagation()},spellCheck:!1}),x.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"conversation-matches",children:R.count===0?f("thread.search.none"):`${R.index+1}/${R.count}`}),i.jsx("button",{className:"icon-button",onClick:()=>R.step(-1),disabled:R.count===0,title:f("thread.search.previous"),children:"↑"}),i.jsx("button",{className:"icon-button",onClick:()=>R.step(1),disabled:R.count===0,title:f("thread.search.next"),children:"↓"})]}),A&&i.jsxs("div",{className:"doc-mode",role:"group","aria-label":f("docs.mode.label"),children:[i.jsx("button",{className:E?"is-active":"","aria-pressed":E,onClick:()=>y("formatted"),children:f("docs.mode.formatted")}),i.jsx("button",{className:E?"":"is-active","aria-pressed":!E,onClick:()=>y("source"),children:f("docs.mode.source")})]}),d!==null&&_!==null&&_.kind==="file"&&!p&&i.jsx("button",{className:"primary-button primary-button-small doc-edit-button",onClick:d.begin,disabled:!z,title:q,children:d.justSaved?f("docs.edit.saved"):f("docs.edit.button")}),k,i.jsx("button",{className:"icon-button",onClick:a,disabled:(e==null?void 0:e.loading)===!0,title:f("docs.reload"),children:"⟳"})]}),(e==null?void 0:e.failed)===!0&&_!==null&&i.jsx("p",{className:"panel-note doc-note",children:f("docs.reloadFailed")}),_===null?i.jsx("p",{className:"panel-note",children:(e==null?void 0:e.failed)===!0?f("docs.failed"):r}):p?i.jsxs("div",{className:"preview-fallback",children:[i.jsx("p",{className:"panel-note",children:f("files.preview.binary")}),i.jsx(Km,{onInsert:o,onOpenWithSystem:v})]}):i.jsxs("div",{className:"panel-scroll",ref:b,onScroll:K=>w(K.currentTarget.scrollTop),children:[i.jsx("div",{ref:h,className:E?"plan-body":"doc-source",children:E?i.jsx(oh,{text:g,localLink:D}):i.jsx(lL,{text:g,language:S})}),T&&i.jsxs("div",{className:"preview-fallback",children:[i.jsx("p",{className:"panel-note",children:l}),_.kind==="file"&&i.jsx(Km,{onInsert:o,onOpenWithSystem:v})]})]})]})}function uL({title:t,editor:e,insertButton:r}){const[l,a]=N.useState(!1),y=e.edit;if(y===null)return i.jsx(i.Fragment,{});const v=y.text!==y.opened,o=y.conflict,c=v&&!y.saving&&o===null,m=y.saving?f("docs.edit.saving"):f(v?"docs.edit.unsaved":"docs.edit.noChanges"),w=()=>{e.unsaved?a(!0):e.discard()};return i.jsxs("div",{className:"panel-body doc-viewer",children:[i.jsxs("div",{className:"doc-toolbar",children:[i.jsxs("span",{className:"doc-edit-status",title:t,children:[f("docs.edit.editing",{name:t}),i.jsxs("span",{className:"doc-edit-state",children:[" · ",m]})]}),i.jsx("button",{className:"link-button",onClick:w,disabled:y.saving,children:f("docs.edit.cancel")}),i.jsx("button",{className:"primary-button primary-button-small",onClick:e.save,disabled:!c,title:f("docs.edit.saveTitle"),children:f("docs.edit.save")}),r,i.jsx("button",{className:"icon-button",disabled:!0,title:f("docs.reload"),children:"⟳"})]}),y.closing&&i.jsxs("div",{className:"note-closing doc-edit-bar",children:[i.jsx("span",{children:f("docs.edit.closeConfirm")}),i.jsx("button",{className:"link-button link-danger",onClick:e.confirmClose,children:f("docs.edit.discardAndClose")}),i.jsx("button",{className:"link-button",onClick:e.keepEditing,children:f("docs.edit.keepEditing")})]}),l&&!y.closing&&i.jsxs("div",{className:"note-closing doc-edit-bar",children:[i.jsx("span",{children:f("docs.edit.discardConfirm")}),i.jsx("button",{className:"link-button link-danger",onClick:e.discard,children:f("docs.edit.discard")}),i.jsx("button",{className:"link-button",onClick:()=>a(!1),children:f("docs.edit.keepEditing")})]}),o!==null&&i.jsxs("div",{className:"note-closing doc-edit-bar",children:[i.jsx("span",{children:o.next===null?f("docs.edit.gone"):f("docs.edit.conflict")}),o.next!==null&&i.jsx("button",{className:"primary-button primary-button-small",onClick:e.adopt,children:f("docs.edit.adopt")}),i.jsx("button",{className:"link-button link-danger",onClick:e.discard,children:f("docs.edit.discardMine")})]}),y.failure!==null&&i.jsx("div",{className:"composer-problem doc-edit-bar",children:i.jsx("span",{children:y.failure.kind==="lost"?f("docs.edit.lost"):Ht(y.failure.text)})}),y.pending!==null&&i.jsxs("div",{className:"doc-changes",children:[i.jsxs("div",{className:"doc-changes-head",children:[i.jsx("span",{children:f("docs.edit.pending")}),i.jsx("button",{className:"link-button",onClick:e.dismissPending,children:f("docs.edit.pendingDone")})]}),i.jsx("div",{className:"doc-changes-body",children:i.jsx(M_,{lines:y.pending})})]}),i.jsx("textarea",{className:"doc-editor",value:y.text,readOnly:o!==null||y.saving,spellCheck:!1,autoFocus:!0,"aria-label":f("docs.edit.editing",{name:t}),onChange:d=>e.change(d.target.value),onKeyDown:d=>{(d.ctrlKey||d.metaKey)&&!d.altKey&&d.key.toLowerCase()==="s"&&(d.preventDefault(),c&&e.save()),d.stopPropagation()}})]})}function uh(){return i.jsx("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",focusable:"false",children:i.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 dL(){return i.jsxs("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",focusable:"false",children:[i.jsx("rect",{x:"5.5",y:"1.5",width:"9",height:"10",rx:"1.2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.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 hL({open:t}){return i.jsxs("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",focusable:"false",children:[i.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"}),i.jsx("circle",{cx:"8",cy:"8",r:"2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),!t&&i.jsx("path",{d:"M2.6 13.4L13.4 2.6",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}function fL(){return i.jsxs("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",focusable:"false",children:[i.jsx("rect",{x:"1.5",y:"10",width:"13",height:"4.5",rx:"1.2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.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 pL(){return i.jsx("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",focusable:"false",children:i.jsx("path",{d:"M3 8.5l3.2 3.2L13 4.8",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function I_({className:t,title:e,doneTitle:r,icon:l,onAction:a}){const[y,v]=N.useState(!1),o=N.useRef(null);N.useEffect(()=>()=>{o.current!==null&&window.clearTimeout(o.current)},[]);const c=m=>{m.stopPropagation(),a(),v(!0),o.current!==null&&window.clearTimeout(o.current),o.current=window.setTimeout(()=>v(!1),1200)};return i.jsx("button",{className:y?`${t} tree-action-done`:t,onClick:c,title:y?r:e,children:y?i.jsx(pL,{}):l})}function mL({className:t,title:e,onCopy:r}){return i.jsx(I_,{className:t,title:e,doneTitle:f("common.copied"),icon:i.jsx(dL,{}),onAction:r})}function sl({className:t,title:e,onInsert:r}){return i.jsx(I_,{className:t,title:e,doneTitle:f("files.pathInserted"),icon:i.jsx(fL,{}),onAction:r})}function gL({view:t,cwd:e,platform:r,onInsert:l,onInsertPath:a,onReveal:y,docs:v}){const{listings:o,loading:c,refresh:m,query:w,setQuery:d,showHidden:k,toggleHidden:L}=t,M=ul(),[b,h]=N.useState(null),_=r==="win32"?"\\":"/",g=N.useCallback(q=>{const K=q.split("/").join(_);return e.length===0?K:e.endsWith(_)?`${e}${K}`:`${e}${_}${K}`},[e,_]),p=N.useCallback(q=>{navigator.clipboard.writeText(q).catch(()=>{})},[]),T=N.useCallback(q=>a(`"${g(q)}"`),[g,a]),A=N.useCallback((q,K)=>{q.preventDefault(),q.stopPropagation(),h({x:q.clientX,y:q.clientY,items:[{label:f("files.menu.copyAbsolute"),onSelect:()=>p(g(K))},{label:f("files.menu.copyRelative"),onSelect:()=>p(K)},...l===void 0?[]:[{label:f("files.menu.insertMention"),onSelect:()=>l(`@${K}`)}],...y===null?[]:[{label:f("files.menu.openWithSystem"),onSelect:()=>y(K)}]]})},[g,p,l,y,M]),E=v.active===null?null:v.docs.find(q=>q.key===v.active)??null,S=E===null?void 0:v.content(E.key),x=E!==null&&S===void 0;N.useEffect(()=>{x&&E!==null&&v.reload(E.key)},[x,E==null?void 0:E.key]);const R=N.useCallback(q=>v.open({key:q,title:q.split("/").pop()??q}),[v]),I=N.useMemo(()=>({...t,openFile:R}),[t,R]),D=q=>{var V;const K=(V=v.content(q.key))==null?void 0:V.loaded;return(K==null?void 0:K.kind)==="file"?`${q.key} · ${fn(K.preview.sizeBytes)}`:q.key},P=v.docs.length>0?i.jsx(N_,{listLabel:f("panel.tab.files"),docs:v.docs,active:v.active,tooltipOf:D,labelOf:q=>v.unsaved(q.key)?`${q.title} •`:q.title,onShowList:v.showList,onSelect:v.select,onClose:v.requestClose}):null;if(E!==null)return i.jsxs("div",{className:"panel-body",children:[P,i.jsx(A_,{doc:E,content:S,readingText:f("files.readingFile"),truncatedText:f("files.preview.truncated"),onReload:()=>v.reload(E.key),onModeChange:q=>v.setMode(E.key,q),onOpenWithSystem:y===null?null:()=>y(E.key),onInsert:()=>T(E.key),onOpenLink:R,initialScroll:v.scrollOf(E.key),onScrollChange:q=>v.rememberScroll(E.key,q),editor:v.editorFor(E.key),insertButton:i.jsx(sl,{className:"icon-button",title:f("files.insertPath",{name:E.title}),onInsert:()=>T(E.key)})},E.key),b!==null&&i.jsx(Dd,{x:b.x,y:b.y,items:b.items,onClose:()=>h(null)})]});const F=o.get(""),z=w.trim();return i.jsxs("div",{className:"panel-body",children:[P,i.jsxs("div",{className:"panel-subhead",children:[i.jsx("span",{className:"panel-subhead-title",title:e,children:e.split(/[\\/]/).filter(q=>q.length>0).pop()??e}),i.jsx(sl,{className:"icon-button",title:f("files.insertFolderPath"),onInsert:()=>T("")}),i.jsx("button",{className:k?"icon-button icon-button-on":"icon-button",onClick:L,title:f(k?"files.hidden.hide":"files.hidden.show"),children:i.jsx(hL,{open:k})}),y!==null&&i.jsx("button",{className:"icon-button",onClick:()=>y(""),title:f("files.revealFolder"),children:i.jsx(uh,{})}),i.jsx("button",{className:"icon-button",onClick:m,title:f("files.refresh"),children:"⟳"})]}),i.jsxs("div",{className:"tree-search",children:[i.jsx("input",{className:"tree-search-input",value:w,placeholder:f("files.search.placeholder"),onChange:q=>d(q.target.value),onKeyDown:q=>{q.key==="Escape"&&w.length>0&&(q.stopPropagation(),d(""))}}),w.length>0&&i.jsx("button",{className:"tree-search-clear",onClick:()=>d(""),title:f("files.search.clear"),children:"×"})]}),i.jsx("div",{className:"panel-scroll",children:z.length>0?i.jsx(vL,{view:I,onContextMenu:A,onReveal:y,onInsertPath:T}):F===void 0?i.jsx("p",{className:"panel-note",children:c.has("")?f("files.readingDir"):f("files.readDirFailed")}):i.jsx(j_,{path:"",depth:0,view:I,onContextMenu:A,onReveal:y,onInsertPath:T})}),b!==null&&i.jsx(Dd,{x:b.x,y:b.y,items:b.items,onClose:()=>h(null)})]})}function vL({view:t,onContextMenu:e,onReveal:r,onInsertPath:l}){const{results:a,searching:y,openFile:v,toggleDirectory:o}=t;return a===null?i.jsx("p",{className:"panel-note",children:f(y?"files.search.searching":"files.search.prompt")}):a.entries.length===0?i.jsx("p",{className:"panel-note",children:f("files.search.none")}):i.jsxs("ul",{className:"tree tree-results",children:[a.entries.map(c=>i.jsx("li",{children:i.jsxs("div",{className:"tree-item",children:[i.jsxs("button",{className:`tree-row tree-row-${c.kind}${c.hidden===void 0?"":" tree-row-hidden"}`,onClick:()=>c.kind==="dir"?o(c.path):v(c.path),onContextMenu:m=>e(m,c.path,c.kind),title:c.path,children:[i.jsx("span",{className:"tree-chevron",children:c.kind==="dir"?"›":""}),i.jsxs("span",{className:"tree-result",children:[i.jsx("span",{className:"tree-name",children:c.name}),i.jsx("span",{className:"tree-result-path",children:c.path})]}),c.kind==="file"&&i.jsx("span",{className:"tree-size",children:fn(c.sizeBytes)})]}),i.jsx(sl,{className:"tree-action",title:f("files.insertPath",{name:c.name}),onInsert:()=>l(c.path)}),c.kind==="dir"&&r!==null&&i.jsx("button",{className:"tree-action",onClick:()=>r(c.path),title:f("files.reveal",{name:c.name}),children:i.jsx(uh,{})})]})},c.path)),a.truncated&&i.jsx("li",{className:"tree-hidden",title:f("files.search.moreTitle"),children:f("files.search.more")})]})}function j_({path:t,depth:e,view:r,onContextMenu:l,onReveal:a,onInsertPath:y}){const{listings:v,loading:o}=r,c=v.get(t);return c===void 0?o.has(t)?i.jsx("div",{className:"tree-loading",children:f("files.loading")}):null:i.jsxs("ul",{className:"tree",children:[c.entries.map(m=>i.jsx(_L,{entry:m,depth:e,view:r,onContextMenu:l,onReveal:a,onInsertPath:y},m.path)),c.entries.length===0&&i.jsx("li",{className:"tree-empty",style:{paddingLeft:`${e*12+8}px`},children:c.hiddenCount>0?f("files.allHidden"):f("files.empty")}),(c.truncated||c.hiddenCount>0)&&c.entries.length>0&&i.jsx("li",{className:"tree-hidden",style:{paddingLeft:`${e*12+8}px`},title:f("files.hiddenTitle"),children:c.truncated?f("files.moreEntries"):f("files.hiddenCount",{count:c.hiddenCount})})]})}function _L({entry:t,depth:e,view:r,onContextMenu:l,onReveal:a,onInsertPath:y}){const{expanded:v,toggleDirectory:o,openFile:c}=r,m=t.kind==="dir"&&v.has(t.path);return i.jsxs("li",{children:[i.jsxs("div",{className:"tree-item",children:[i.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"?o(t.path):c(t.path),onContextMenu:w=>l(w,t.path,t.kind),title:t.hidden===void 0?t.path:`${t.path}
|
|
149
|
+
${t.hidden==="ignored"?f("files.row.ignored"):f("files.row.alwaysHidden")}`,children:[i.jsx("span",{className:`tree-chevron${m?" tree-chevron-open":""}`,children:t.kind==="dir"?"›":""}),i.jsx("span",{className:"tree-name",children:t.name}),t.kind==="file"&&i.jsx("span",{className:"tree-size",children:fn(t.sizeBytes)})]}),i.jsx(sl,{className:"tree-action",title:f("files.insertPath",{name:t.name}),onInsert:()=>y(t.path)}),t.kind==="dir"&&a!==null&&i.jsx("button",{className:"tree-action",onClick:()=>a(t.path),title:f("files.reveal",{name:t.name}),children:i.jsx(uh,{})})]}),m&&i.jsx(j_,{path:t.path,depth:e+1,view:r,onContextMenu:l,onReveal:a,onInsertPath:y})]})}const D_={added:"A",modified:"M",deleted:"D",renamed:"R",copied:"C","type-changed":"T",untracked:"?",conflict:"!"},P_={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 za(t){const e=t.endsWith("/"),r=e?t.slice(0,-1):t,l=r.lastIndexOf("/"),a=l===-1?r:r.slice(l+1);return{dir:l===-1?"":r.slice(0,l+1),name:e?`${a}/`:a,isDirectory:e}}const wL=32;class O_{constructor(e=wL){Ut(this,"byTerminal",new Map);this.limit=e}enter(e,r){const l=this.byTerminal.get(e);return l===void 0?{value:r,stale:!1}:{value:l,stale:!0}}store(e,r){for(this.byTerminal.delete(e),this.byTerminal.set(e,r);this.byTerminal.size>this.limit;){const l=this.byTerminal.keys().next();if(l.done===!0)break;this.byTerminal.delete(l.value)}}forget(e){this.byTerminal.delete(e)}}function bL(t,e,r){r.state==="ready"?t.store(e,r):t.forget(e)}const yL={openDiff:!1,refresh:!1,newBranch:!0,moveBranch:!0,openBranch:!1,viewChanges:!1,showReviewer:!1,requestReview:!0,sendReview:!0,catchUp:!0,integrate:!0,remove:!0,deleteBranch:!0};function kL(t,e){return yL[t]?t==="newBranch"||t==="moveBranch"?e.statusStale:e.statusStale||e.rowsStale:!1}function CL({view:t,onBack:e,onOpenDiff:r,onCloseDiff:l,onRequestReview:a}){const{state:y}=t;if(t.diff!==null){const o=t.diff;return i.jsxs("div",{className:"panel-body",children:[i.jsxs("div",{className:"panel-subhead",children:[i.jsxs("button",{className:"link-button",onClick:l,children:["← ",t.branch]}),i.jsx("span",{className:"panel-subhead-title",title:o.path,children:za(o.path).name})]}),o.message!==null?i.jsx("p",{className:"panel-note",children:o.message}):o.diff===null?i.jsx("p",{className:"panel-note",children:f("git.readingDiff")}):i.jsx(R_,{diff:o.diff})]})}const v=y.phase==="ready"?y.changes:null;return i.jsxs("div",{className:"panel-body",children:[i.jsxs("div",{className:"panel-subhead",children:[i.jsxs("button",{className:"link-button",onClick:e,children:["← ",f("git.backToChanges")]}),i.jsx("span",{className:"panel-subhead-title",title:v===null?t.branch:f("worktree.changes.title",{branch:v.branch,base:v.base}),children:v===null?t.branch:f("worktree.changes.title",{branch:v.branch,base:v.base})}),a!==null&&v!==null&&v.commitCount>0&&i.jsx("button",{className:"link-button",onClick:a,title:f("worktree.actions.reviewTitle"),children:f("worktree.actions.review")})]}),i.jsxs("div",{className:"panel-scroll",children:[y.phase==="loading"&&i.jsx("p",{className:"panel-note",children:f("worktree.changes.loading")}),y.phase==="failed"&&i.jsx("p",{className:"panel-note",children:y.message}),v!==null&&i.jsxs(i.Fragment,{children:[v.uncommitted>0&&i.jsx("p",{className:"panel-note",children:f("worktree.changes.uncommitted",{count:v.uncommitted})}),v.commitCount===0&&v.files.length===0&&i.jsx("p",{className:"panel-note",children:f("worktree.changes.empty",{base:v.base})}),v.commits.length>0&&i.jsxs("section",{className:"git-group",children:[i.jsxs("h3",{className:"git-group-title",children:[f("worktree.changes.commits"),i.jsx("span",{className:"git-group-count",children:v.commitCount})]}),i.jsx("ul",{className:"git-list worktree-commits",children:v.commits.map(o=>i.jsxs("li",{className:"worktree-commit",title:`${th(o.at)} ${Yi(o.at)}`,children:[i.jsx("span",{className:"worktree-commit-sha",children:o.sha}),i.jsx("span",{className:"worktree-commit-subject",children:o.subject}),i.jsx("span",{className:"worktree-commit-when",children:nr(o.at)})]},o.sha))}),v.commitCount>v.commits.length&&i.jsx("p",{className:"panel-note",children:f("worktree.changes.more",{count:v.commitCount-v.commits.length})})]}),v.files.length>0&&i.jsxs("section",{className:"git-group",children:[i.jsxs("h3",{className:"git-group-title",children:[f("worktree.changes.files"),i.jsx("span",{className:"git-group-count",children:v.fileCount})]}),i.jsx("ul",{className:"git-list",children:v.files.map(o=>{const{dir:c,name:m}=za(o.path);return i.jsx("li",{children:i.jsxs("button",{className:"git-item",onClick:()=>r(o.path),title:o.oldPath!==null?`${o.oldPath} → ${o.path}`:o.path,children:[i.jsx("span",{className:`git-badge git-badge-${o.kind}`,title:f(P_[o.kind]),children:D_[o.kind]}),i.jsxs("span",{className:"git-path",children:[i.jsx("span",{className:"git-path-name",children:m}),c.length>0&&i.jsx("span",{className:"git-path-dir",children:c})]})]})},o.path)})}),v.fileCount>v.files.length&&i.jsx("p",{className:"panel-note",children:f("worktree.changes.more",{count:v.fileCount-v.files.length})})]})]})]})]})}function B_(t,e,r){const l=t.worktree;if(l===null||l.branch===null)return null;if(l.linked)return l.branch;const a=Dr(l.mainCwd,r);return e.some(v=>{var o;return v.terminalId!==t.terminalId&&((o=v.worktree)==null?void 0:o.linked)===!0&&Dr(v.worktree.mainCwd,r)===a})?l.branch:null}function xL(t,e){const r=t.worktree;return r===null||e===null?null:r.linked?f("worktree.tab.linkedTitle",{branch:e,main:r.mainCwd}):f("worktree.tab.mainTitle",{branch:e})}function xs(t){return vd(t)}const SL={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 EL(t){return f(SL[t])}function TL(t,e,r,l){if(e.length===0)return null;const a=Kb(e);if(a!==null)return EL(a);const y=t.branches.find(v=>v.name===e);return r==="new"&&y!==void 0?f("worktree.create.branchExists"):r==="existing"&&(y==null?void 0:y.checkedOut)===!0?f("worktree.create.branchInUse"):t.branches.some(v=>v.name===l)?null:f("worktree.create.baseMissing")}const LL={busy:"worktreeMoveBusy",waiting:"worktreeMoveWaiting",pending:"worktreeMovePending"};function NL(t){return t===null?null:Ht({key:LL[t]})}function F_(t,e){return t.kind==="agent"&&e&&t.sessionId.length>0&&t.worktree!==null}function RL(t,e,r){const l=t.find(a=>a.kind==="agent"&&a.agent===e.agent&&a.sessionId===e.sessionId);return l===void 0||l.agent===null?null:F_(l,r(l.agent))?l:null}function ML(t,e){var r;return e!==null&&t.branches.some(l=>l.name===e)?e:t.currentBranch??((r=t.branches[0])==null?void 0:r.name)??""}function H_(t,e){return`${t.parentDir}${t.separator}${Bg(e)}`}const AL=t=>/[\s"]/.test(t)?`"${t}"`:t;function IL(t,e,r,l){const a=AL(H_(t,e));return l==="new"?`git worktree add -b ${e} ${a} ${r}`:`git worktree add ${a} ${e}`}function Aa(t){return f("worktree.copy.summary",{count:t.files,size:fn(t.bytes)})}function jL(t){const e=[];return t.changes!==null&&t.changes>0&&e.push(f("worktree.rows.changes",{count:t.changes})),t.ahead!==null&&t.ahead>0&&e.push(f("worktree.rows.ahead",{count:t.ahead})),t.integrated===!0&&e.push(f("worktree.rows.integrated")),e.length===0&&t.changes===0&&e.push(f("worktree.rows.clean")),e}function DL(t){return[...t].sort((e,r)=>e.isMain!==r.isMain?e.isMain?-1:1:(e.branch??e.path).localeCompare(r.branch??r.path))}function Ym(t,e){const r=En(t.map(l=>l.split("/").pop()??l));return e>t.length?`${r}…`:r}function PL(t){var r,l;const e=[];if(t.behind!==null&&t.behind>0&&t.base!==null){const a=[f("worktree.rows.behind",{base:t.base,count:t.behind})];((r=t.merge)==null?void 0:r.state)==="clean"&&a.push(f("worktree.rows.mergeClean")),((l=t.merge)==null?void 0:l.state)==="conflicts"&&a.push(f("worktree.rows.mergeConflicts",{count:t.merge.fileCount,list:Ym(t.merge.files,t.merge.fileCount)})),e.push(a.join(" · "))}for(const a of t.overlaps)e.push(f("worktree.rows.overlap",{branch:a.branch,list:Ym(a.files,a.fileCount)}));return e}const Xm={working:"worktree.review.stateWorking",pending:"worktree.review.statePending",ready:"worktree.review.stateReady",changes:"worktree.review.stateChanges",none:"worktree.review.stateNone"};function U_(t,e){const r=t.state==="done"?Xm[t.verdict??"none"]:Xm[t.state],l=f(r,{agent:e});return t.stale?f("worktree.review.stale",{text:l}):l}function OL(t){return t!==null&&t.state==="done"}function BL(t){const e=t.id!==null&&!t.isMain&&t.behind!==null,r=(t.ahead??0)>0;return{viewChanges:e&&r,review:e&&(r||(t.changes??0)>0),sendReview:e&&OL(t.review),catchUp:e&&t.base!==null&&(t.behind??0)>0,integrate:e&&t.base!==null&&r}}function FL(t){return t.base===null?null:t.ahead===0?f("worktree.integrate.blockerNothing",{base:t.base}):t.behind!==null&&t.behind>0?f("worktree.integrate.blockerBehind",{base:t.base}):null}function HL(t){switch(t.blocker){case"nothing":return f("worktree.integrate.blockerNothing",{base:t.base});case"behind":return f("worktree.integrate.blockerBehind",{base:t.base});case"no-base-folder":return f("worktree.integrate.blockerNoBase",{base:t.base});case"local-changes":return f("worktree.integrate.blockerLocal",{base:t.base,count:t.localConflicts.length,list:En(t.localConflicts)});case null:return null}}function UL(t,e){var l;const r=((l=t.readOnlyLaunch)==null?void 0:l.guard)??null;return r==="cli"?f("worktree.review.guardCli",{agent:e}):r==="tools"?f("worktree.review.guardTools",{agent:e}):f("worktree.review.guardNone",{agent:e})}function $L(t){return t.filter(e=>e.available).map(e=>{var r;return{id:e.id,guard:((r=e.capabilities.readOnlyLaunch)==null?void 0:r.guard)??null}})}function WL(t){return t.ahead===null?null:t.ahead===0?f("worktree.rows.integrated"):f("worktree.rows.notIntegrated",{count:t.ahead})}function qL(t){switch(t.blocker){case"checked-out":return f("worktree.deleteBranch.checkedOut",{branch:t.branch});case"not-integrated":return t.ahead===null?f("worktree.deleteBranch.noBase",{base:t.base}):f("worktree.deleteBranch.notIntegrated",{count:t.ahead,base:t.base});case null:return null}}function dl(t,e){var r;return((r=t.untracked)==null?void 0:r.stamp)!=null&&e!==null&&t.untracked.stamp===e}function zL(t,e=null){return t.uncommittedCount>0&&!dl(t,e)?"uncommitted":t.inUse===!0?"in-use":t.conflicts.length>0?"conflicts":null}function $_(t,e=null){switch(zL(t,e)){case"uncommitted":return"ask-commit";case"in-use":return"retry";case"conflicts":return"ask-notes";case null:return"remove"}}function KL(t,e){var r;return t.uncommittedCount>0&&((r=t.untracked)==null?void 0:r.stamp)!=null&&!dl(t,e)}const VL={"nested-repo":"worktree.remove.untrackedNestedRepo","too-many":"worktree.remove.untrackedTooMany",copied:"worktree.remove.untrackedCopied"};function GL(t,e){const r=t.untracked;return t.uncommittedCount===0||r===null?null:r.blocked!==null?f(VL[r.blocked],{max:Xb}):dl(t,e)?f("worktree.remove.untrackedAccepted"):f("worktree.remove.untracked",{count:r.files,size:fn(r.bytes)})}function YL(t){if(t.holders.length===0)return f("worktree.remove.inUse");const e=[];for(const l of t.holders){const a=l.name.toLowerCase().replace(/\.exe$/,""),y=l.description!==null&&l.description.toLowerCase()!==a?l.description:null,v=e.find(o=>o.exe.toLowerCase()===l.name.toLowerCase()&&o.program===y);v!==void 0?v.pids.push(l.pid):e.push({exe:l.name,program:y,pids:[l.pid]})}const r=En(e.map(({exe:l,program:a,pids:y})=>{const v={exe:l,pids:En(y.map(String))};return a===null?f("worktree.remove.holderExe",v):f("worktree.remove.holder",{...v,program:a})}));return f("worktree.remove.inUseBy",{count:e.length,list:r})}function XL(t){return`${En(t.uncommitted)}${t.uncommittedCount>t.uncommitted.length?"…":""}`}function QL(t){const{branch:e}=t;return t.deletesBranch?t.branchUnused?f("worktree.remove.deletesUnusedBranch",{branch:e}):f("worktree.remove.deletesBranch",{branch:e}):t.createdBranch?f("worktree.remove.keepsBranch",{branch:e}):f("worktree.remove.keepsExistingBranch",{branch:e})}const JL=[{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 ZL({status:t}){return i.jsxs("div",{className:"git-headline",children:[i.jsx("span",{className:"git-branch",title:t.repoRoot,children:t.branch??(t.head!==null?f("git.detachedAt",{head:t.head}):f("git.detached"))}),t.upstream!==null&&i.jsx("span",{className:"git-upstream",title:f("git.upstreamTitle",{upstream:t.upstream}),children:t.upstream}),(t.ahead>0||t.behind>0)&&i.jsxs("span",{className:"git-ab",title:f("git.aheadBehindTitle"),children:[t.ahead>0&&i.jsxs("span",{className:"git-ahead",children:["↑",t.ahead]}),t.behind>0&&i.jsxs("span",{className:"git-behind",children:["↓",t.behind]})]})]})}function e5(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 t5({row:t,worktrees:e,waiting:r}){const l=jL(t),a=PL(t),y=t.id,v=y!==null&&!t.isMain?{...t,id:y}:null,o=BL(t),c=FL(t),m=t.review;return i.jsx("li",{children:i.jsxs("div",{className:"git-worktree",title:t.path,children:[i.jsxs("span",{className:"git-worktree-branch",children:[t.branch??f("git.worktrees.detached"),t.isMain&&i.jsx("span",{className:"git-worktree-main",children:f("worktree.rows.main")}),t.isCurrent&&i.jsx("span",{className:"git-worktree-main",children:f("worktree.rows.current")})]}),l.length>0&&i.jsx("span",{className:"git-worktree-state",children:l.join(" · ")}),a.map(w=>i.jsx("span",{className:"git-worktree-team",children:w},w)),m!==null&&i.jsxs("span",{className:`git-worktree-review${e5(t)}`,children:[U_(m,e.agentLabel(m.agent)),m.terminalId!==null&&i.jsx("button",{className:"link-button",onClick:()=>{m.terminalId!==null&&e.onShowReviewer(m.terminalId)},title:f("worktree.actions.showReviewerTitle"),children:f("worktree.actions.showReviewer")})]}),i.jsx("span",{className:"git-worktree-path",children:t.path}),i.jsxs("span",{className:"git-worktree-actions",children:[!t.isCurrent&&i.jsx("button",{className:"link-button",onClick:()=>e.onOpen(t),title:f("worktree.rows.openTitle"),children:f("worktree.rows.open")}),v!==null&&o.viewChanges&&i.jsx("button",{className:"link-button",onClick:()=>e.onViewChanges(v),title:f("worktree.actions.viewChangesTitle"),children:f("worktree.actions.viewChanges")}),v!==null&&o.review&&i.jsx("button",{className:"link-button",onClick:()=>e.onRequestReview(v),disabled:r.waits("requestReview"),title:r.title("requestReview",f("worktree.actions.reviewTitle")),children:f("worktree.actions.review")}),v!==null&&o.sendReview&&i.jsx("button",{className:"link-button",onClick:()=>e.onSendReview(v),disabled:r.waits("sendReview"),title:r.title("sendReview",f("worktree.actions.sendReviewTitle")),children:f("worktree.actions.sendReview")}),v!==null&&o.catchUp&&t.base!==null&&i.jsx("button",{className:"link-button",onClick:()=>e.onCatchUp(v),disabled:r.waits("catchUp"),title:r.title("catchUp",f("worktree.actions.catchUpTitle",{base:t.base})),children:f("worktree.actions.catchUp")}),v!==null&&o.integrate&&t.base!==null&&i.jsx("button",{className:"link-button",onClick:()=>e.onIntegrate(v),disabled:c!==null||r.waits("integrate"),title:r.title("integrate",c??f("worktree.actions.integrateTitle",{base:t.base})),children:f("worktree.actions.integrate",{base:t.base})}),v!==null&&i.jsx("button",{className:"link-button",onClick:()=>e.onRemove(v),disabled:r.waits("remove"),title:r.title("remove",f("worktree.rows.removeTitle")),children:f("worktree.rows.remove")})]})]})})}function n5({kept:t,worktrees:e,waiting:r}){const l=WL(t);return i.jsx("li",{children:i.jsxs("div",{className:"git-worktree",title:f("worktree.rows.keptTitle"),children:[i.jsxs("span",{className:"git-worktree-branch",children:[t.branch,i.jsx("span",{className:"git-worktree-main",children:f("worktree.rows.kept")})]}),l!==null&&i.jsx("span",{className:"git-worktree-state",children:l}),i.jsx("span",{className:"git-worktree-actions",children:i.jsx("button",{className:"link-button",onClick:()=>e.onDeleteBranch(t),disabled:r.waits("deleteBranch"),title:r.title("deleteBranch",f("worktree.rows.deleteBranchTitle")),children:f("worktree.rows.deleteBranch")})})]})})}function r5({view:t,worktrees:e}){const{status:r,diff:l,loadingDiff:a,openDiff:y,closeDiff:v,refresh:o}=t,c={statusStale:t.stale,rowsStale:e.rowsStale},m=L=>kL(L,c),w={waits:m,title:(L,M)=>m(L)?f("git.waitingTitle"):M};if(e.changes!==null){const L=e.changes,M=e.rows.find(b=>b.id===L.worktreeId)??null;return i.jsx(CL,{view:L,onBack:e.onCloseChanges,onOpenDiff:e.onOpenChangeDiff,onCloseDiff:e.onCloseChangeDiff,onRequestReview:M===null||M.id===null||m("requestReview")?null:()=>e.onRequestReview({...M,id:L.worktreeId})})}if(l!==null||a)return i.jsxs("div",{className:"panel-body",children:[i.jsxs("div",{className:"panel-subhead",children:[i.jsxs("button",{className:"link-button",onClick:v,children:["← ",f("git.backToChanges")]}),l!==null&&i.jsxs("span",{className:"panel-subhead-title",title:l.path,children:[za(l.path).name,l.staged&&i.jsxs("span",{className:"panel-tagline",children:[" ",f("git.stagedTag")]})]})]}),a?i.jsx("p",{className:"panel-note",children:f("git.readingDiff")}):l!==null&&i.jsx(R_,{diff:l})]});if(r.state!=="ready")return i.jsx("div",{className:"panel-body",children:i.jsx("p",{className:"panel-note",children:r.message===null?f("git.unknownState"):Ht(r.message)})});const d=DL(e.rows).filter(L=>!(L.isCurrent&&L.isMain)),k=d.some(L=>!L.isMain)||e.kept.length>0;return i.jsxs("div",{className:`panel-body${t.stale?" git-stale":""}`,"aria-busy":t.stale,children:[i.jsxs("div",{className:"panel-subhead",children:[i.jsx(ZL,{status:r}),t.stale&&i.jsx("span",{className:"git-updating",children:f("git.updating")}),i.jsx("button",{className:"icon-button",onClick:e.onNew,disabled:m("newBranch"),title:w.title("newBranch",f("worktree.new")),"aria-label":f("worktree.new"),children:i.jsx(Nd,{})}),e.onMove!==null&&i.jsx("button",{className:"icon-button",onClick:e.onMove,disabled:m("moveBranch"),title:w.title("moveBranch",f("worktree.move.title")),"aria-label":f("worktree.move.title"),children:i.jsx(sh,{})}),i.jsx("button",{className:"icon-button",onClick:o,title:f("git.refresh"),children:"⟳"})]}),i.jsxs("div",{className:"panel-scroll",children:[r.changes.length===0&&i.jsx("p",{className:"panel-note",children:f("git.clean")}),JL.map(L=>{const M=r.changes.filter(b=>b.stage===L.stage);return M.length===0?null:i.jsxs("section",{className:"git-group",children:[i.jsxs("h3",{className:"git-group-title",title:f(L.hint),children:[f(L.title),i.jsx("span",{className:"git-group-count",children:M.length})]}),i.jsx("ul",{className:"git-list",children:M.map(b=>{const{dir:h,name:_,isDirectory:g}=za(b.path),p=b.oldPath!==null?`${b.oldPath} → ${b.path}`:g?f("git.newFolderTitle",{path:b.path}):b.path,T=i.jsxs(i.Fragment,{children:[i.jsx("span",{className:`git-badge git-badge-${b.kind}`,title:f(P_[b.kind]),children:D_[b.kind]}),i.jsxs("span",{className:"git-path",children:[i.jsx("span",{className:"git-path-name",children:_}),h.length>0&&i.jsx("span",{className:"git-path-dir",children:h})]})]});return i.jsx("li",{children:g?i.jsx("div",{className:"git-item git-item-static",title:p,children:T}):i.jsx("button",{className:"git-item",onClick:()=>y(b.path,b.stage==="staged"),title:p,children:T})},`${L.stage}:${b.path}`)})})]},L.stage)}),r.truncated&&i.jsx("p",{className:"panel-note",children:vn("git.truncated")}),k&&i.jsxs("section",{className:`git-group${e.rowsStale?" git-stale-rows":""}`,children:[i.jsxs("h3",{className:"git-group-title",title:f("worktree.rows.headingTitle"),children:[f("worktree.rows.heading"),i.jsx("span",{className:"git-group-count",children:d.length+e.kept.length})]}),i.jsxs("ul",{className:"git-list",children:[d.map(L=>i.jsx(t5,{row:L,worktrees:e,waiting:w},L.path)),e.kept.map(L=>i.jsx(n5,{kept:L,worktrees:e,waiting:w},L.id))]})]})]})]})}const s5={create:"memory.action.create","append-block":"memory.action.appendBlock","replace-block":"memory.action.replaceBlock","append-lines":"memory.action.appendLines",copy:"memory.action.copy"},i5={"AGENTS.md":["Codex","Antigravity","OpenCode","Pi"],"CLAUDE.md":["Claude Code"]};function Xa(t){return t.brokenBlock||t.problem!==null}function o5(t){return t.problem==="outside"?f("memory.problem.outside"):t.problem==="encoding"?f("memory.problem.encoding"):t.brokenBlock?f("memory.problem.brokenBlock"):null}function l5(t){const e=t.files.filter(r=>!Xa(r));return t.installed?{instructionFiles:e.filter(r=>r.hasBlock||r.exists).map(r=>r.name),gitMode:t.git.kind==="error"||t.git.kind==="repo"&&!t.git.ignored?"version":"ignore",importNative:!1,copyFromMainWorktree:!1}:{...b0(t),instructionFiles:e.map(r=>r.name)}}function a5(t){const e=t.files.filter(a=>a.hasBlock&&!a.blockCurrent),r=t.files.filter(a=>a.exists&&!a.hasBlock&&!Xa(a)),l=a=>En(a.map(y=>y.name));return e.length===0?r.length===0?null:f("memory.update.missing",{files:l(r)}):r.length===0?f("memory.update.outdated",{count:e.length,files:l(e)}):f("memory.update.outdatedAndMissing",{count:e.length,outdated:l(e),missing:l(r)})}function c5(t){const e=t.replace(/^\uFEFF/,"").replace(/\r\n/g,`
|
|
150
|
+
`),r=/^---\n[\s\S]*?\n---(?:\n|$)/.exec(e);return r===null?e:e.slice(r[0].length)}function u5(t){return t.split(/`([^`]+)`/).map((e,r)=>r%2===1?i.jsx("code",{children:e},r):e)}function d5({view:t}){var h;const{status:e,open:r,loading:l,error:a,closeNote:y,openNote:v}=t,[o,c]=N.useState(null),[m,w]=N.useState(!1),d=(e==null?void 0:e.cwd)??null;N.useEffect(()=>{c(null),w(!1)},[d]),N.useEffect(()=>{t.lastResult!==null&&(c(null),w(!1))},[t.lastResult]);const k=N.useCallback(_=>{if(e===null)return null;let g=_.replace(/^\.\//,"");try{g=decodeURIComponent(g)}catch{return null}return g===Fa||e.notes.some(T=>T.name===g)?()=>v(g):null},[e,v]);if(e===null)return i.jsx("div",{className:"panel-body",children:i.jsx("p",{className:"panel-note",children:a??f("memory.loading")})});if(r!==null||l!==null){const _=(r==null?void 0:r.name)??l??"",g=_===Fa?f("memory.index"):((h=e.notes.find(p=>p.name===_))==null?void 0:h.title)??_;return i.jsxs("div",{className:"panel-body",children:[i.jsxs("div",{className:"panel-subhead",children:[i.jsx("button",{className:"link-button",onClick:y,children:f("memory.back")}),i.jsx("span",{className:"panel-subhead-title",title:_,children:g})]}),r===null?i.jsx("p",{className:"panel-note",children:f("memory.note.loading")}):i.jsxs("div",{className:"panel-scroll",children:[i.jsx("div",{className:"plan-body",children:i.jsx(oh,{text:c5(r.text),localLink:k})}),r.truncated&&i.jsx("p",{className:"panel-note",children:f("memory.note.truncated")})]})]})}const L=o??l5(e),M=e.installed?a5(e):null,b=!e.installed||m||t.planned!==null;return i.jsxs("div",{className:"panel-body",children:[i.jsx(h5,{reach:e.reach,onAdjust:e.installed&&!b&&M===null&&e.reach.some(_=>!_.reaches)?()=>w(!0):null}),i.jsxs("div",{className:"panel-scroll",children:[(a??t.lastResult)!==null&&i.jsxs("div",{className:`memory-message${a!==null?" memory-message-error":""}`,children:[i.jsx("span",{children:a??t.lastResult}),i.jsx("button",{className:"link-button",onClick:t.dismissMessage,title:f("common.dismissNotice"),children:"×"})]}),e.git.kind==="error"&&i.jsxs("div",{className:"memory-warning",children:[i.jsx("p",{className:"memory-warning-line",children:vn("memory.git.errorWarning")}),i.jsx("pre",{className:"memory-git-message",children:Ht(e.git.message)})]}),e.files.filter(Xa).map(_=>i.jsx("p",{className:"memory-warning",children:_.problem==="outside"?vn("memory.problem.outsideWarning",{file:_.name}):_.problem==="encoding"?vn("memory.problem.encodingWarning",{file:_.name}):vn("memory.problem.brokenBlockWarning",{file:_.name})},_.name)),!e.installed&&i.jsxs("div",{className:"memory-intro",children:[i.jsx("p",{children:f("memory.intro.what")}),i.jsx("p",{children:vn("memory.intro.where")})]}),e.installed&&M!==null&&!b&&i.jsxs("div",{className:"memory-callout",children:[i.jsx("span",{children:M}),i.jsx("button",{className:"primary-button primary-button-small",onClick:()=>w(!0),children:f("memory.update.button")})]}),b&&(t.planned===null?i.jsx(f5,{status:e,options:L,busy:t.busy,onChange:c,onPlan:()=>{c(L),t.requestPlan(L)},onCancel:e.installed?()=>{w(!1),c(null)}:null}):i.jsx(p5,{changes:t.planned,busy:t.busy,confirmLabel:e.installed?f("memory.plan.update"):f("memory.plan.install"),onConfirm:t.install,onCancel:t.cancelPlan})),e.installed&&e.native.pending>0&&!b&&i.jsxs("div",{className:"memory-callout",children:[i.jsx("span",{children:f("memory.native.pending",{count:e.native.pending})}),i.jsx("button",{className:"primary-button primary-button-small",disabled:t.busy!==null,onClick:t.importNative,children:t.busy==="import"?f("memory.native.importing"):f("memory.native.import",{count:e.native.pending})})]}),e.installed&&i.jsx(m5,{notes:e.notes,indexExists:e.indexExists,onOpen:v}),e.globalFragments.length>0&&i.jsx(g5,{fragments:e.globalFragments})]})]})}function h5({reach:t,onAdjust:e}){return i.jsxs("div",{className:"memory-reach",children:[t.map(r=>i.jsxs("span",{className:`memory-reach-item${r.reaches?" memory-reach-on":""}`,title:f("memory.reach.title",{label:r.label,via:Ht(r.via)}),children:[i.jsx("span",{className:"memory-reach-mark","aria-hidden":"true",children:r.reaches?"✓":"—"}),r.label,i.jsx("span",{className:"visually-hidden",children:r.reaches?f("memory.reach.reaches",{via:Ht(r.via)}):f("memory.reach.doesNotReach",{via:Ht(r.via)})})]},r.agent)),e!==null&&i.jsx("button",{className:"link-button memory-reach-adjust",onClick:e,title:f("memory.reach.adjustTitle"),children:f("memory.reach.adjust")})]})}function f5({status:t,options:e,busy:r,onChange:l,onPlan:a,onCancel:y}){const{git:v}=t,o=v.kind==="repo"?v.worktree:null,c=v.kind==="error"&&e.gitMode==="ignore",m=(w,d)=>{const k=new Set(e.instructionFiles);d?k.add(w):k.delete(w),l({...e,instructionFiles:Yd.filter(L=>k.has(L))})};return i.jsxs("div",{className:"memory-form",children:[i.jsx("p",{className:"memory-section-label",children:f("memory.form.files")}),t.files.map(w=>i.jsxs("label",{className:"memory-option",title:o5(w)??void 0,children:[i.jsx("input",{type:"checkbox",checked:e.instructionFiles.includes(w.name),disabled:Xa(w),onChange:d=>m(w.name,d.target.checked)}),i.jsx("code",{children:w.name}),i.jsx("span",{className:"memory-option-hint",children:En(i5[w.name])})]},w.name)),v.kind==="repo"&&i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"memory-section-label",children:"Git"}),i.jsxs("label",{className:"memory-option",children:[i.jsx("input",{type:"radio",name:"memory-git-mode",checked:e.gitMode==="ignore",onChange:()=>l({...e,gitMode:"ignore"})}),f("memory.git.ignore"),i.jsx("span",{className:"memory-option-hint",children:f("memory.git.ignoreHint")})]}),i.jsxs("label",{className:"memory-option",children:[i.jsx("input",{type:"radio",name:"memory-git-mode",checked:e.gitMode==="version",onChange:()=>l({...e,gitMode:"version"})}),f("memory.git.version"),i.jsx("span",{className:"memory-option-hint",children:f("memory.git.versionHint")})]}),v.ignored&&e.gitMode==="version"&&i.jsx("p",{className:"memory-warning",children:vn("memory.git.alreadyIgnored")})]}),v.kind==="error"&&i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"memory-section-label",children:"Git"}),i.jsxs("label",{className:"memory-option",children:[i.jsx("input",{type:"radio",name:"memory-git-mode",checked:e.gitMode==="version",onChange:()=>l({...e,gitMode:"version"})}),vn("memory.git.dontTouch"),i.jsx("span",{className:"memory-option-hint",children:f("memory.git.errorHint")})]})]}),(t.native.pending>0||(o==null?void 0:o.mainHasMemory)===!0)&&i.jsx("p",{className:"memory-section-label",children:f("memory.form.existingNotes")}),t.native.pending>0&&i.jsxs("label",{className:"memory-option",children:[i.jsx("input",{type:"checkbox",checked:e.importNative,onChange:w=>l({...e,importNative:w.target.checked})}),f("memory.form.importNative",{count:t.native.pending})]}),(o==null?void 0:o.mainHasMemory)===!0&&i.jsxs("label",{className:"memory-option",title:o.mainPath,children:[i.jsx("input",{type:"checkbox",checked:e.copyFromMainWorktree,onChange:w=>l({...e,copyFromMainWorktree:w.target.checked})}),f("memory.form.copyFromMain")]}),i.jsxs("div",{className:"memory-actions",children:[i.jsx("button",{className:"primary-button primary-button-small",disabled:r!==null||e.instructionFiles.length===0||c,onClick:a,title:e.instructionFiles.length===0?f("memory.form.noFiles"):c?f("memory.git.blocked"):void 0,children:f(r==="plan"?"memory.form.planning":"memory.form.preview")}),y!==null&&i.jsx("button",{className:"link-button",onClick:y,disabled:r!==null,children:f("common.cancel")})]})]})}function p5({changes:t,busy:e,confirmLabel:r,onConfirm:l,onCancel:a}){const y=e==="install";return i.jsxs("div",{className:"memory-form",children:[i.jsx("p",{className:"memory-section-label",children:f("memory.plan.changes")}),t.length===0?i.jsx("p",{className:"memory-empty",children:f("memory.plan.nothing")}):i.jsx("ul",{className:"memory-change-list",children:t.map((v,o)=>i.jsxs("li",{className:"memory-change",children:[i.jsxs("div",{className:"memory-change-head",children:[i.jsx("code",{className:"memory-change-file",children:v.file}),i.jsx("span",{className:"memory-option-hint",children:f(s5[v.action])})]}),v.copiedFrom!==null&&i.jsx("p",{className:"memory-option-hint",children:f("memory.plan.copiedFrom",{path:v.copiedFrom})}),v.preview.length>0&&i.jsx("pre",{className:"memory-preview",children:v.preview})]},`${v.file}-${o}`))}),i.jsxs("div",{className:"memory-actions",children:[t.length>0&&i.jsx("button",{className:"primary-button primary-button-small",disabled:e!==null,onClick:l,children:y?f("memory.plan.writing"):r}),i.jsx("button",{className:"link-button",onClick:a,disabled:y,children:t.length===0?f("memory.plan.back"):f("common.cancel")})]})]})}function m5({notes:t,indexExists:e,onOpen:r}){return i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"memory-section-label",children:f("memory.list.notes")}),i.jsxs("ul",{className:"plan-list",children:[e&&i.jsx("li",{children:i.jsxs("button",{className:"plan-row",onClick:()=>r(Fa),children:[i.jsx("span",{className:"plan-name",children:f("memory.index")}),i.jsx("span",{className:"plan-meta",children:Fa})]})}),t.map(l=>i.jsx("li",{children:i.jsxs("button",{className:"plan-row",onClick:()=>r(l.name),title:l.name,children:[i.jsx("span",{className:"plan-name",children:l.title}),l.description.length>0&&i.jsx("span",{className:"memory-note-description",children:l.description}),i.jsxs("span",{className:"plan-meta",children:[nr(l.modifiedAt)," · ",fn(l.sizeBytes)]})]})},l.name))]}),t.length===0&&i.jsx("p",{className:"memory-empty",children:f("memory.list.empty")})]})}function g5({fragments:t}){const e=N.useCallback(r=>{navigator.clipboard.writeText(r).catch(()=>{})},[]);return i.jsxs("details",{className:"memory-global",children:[i.jsx("summary",{className:"memory-global-summary",children:f("memory.global.title")}),i.jsx("p",{className:"memory-empty",children:vn("memory.global.intro")}),t.map(r=>i.jsxs("div",{className:"memory-fragment",children:[i.jsxs("div",{className:"memory-change-head",children:[i.jsx("span",{className:"memory-fragment-label",children:r.label}),i.jsx("code",{className:"memory-fragment-target",title:r.target,children:r.target})]}),i.jsxs("div",{className:"memory-fragment-body",children:[i.jsx("pre",{className:"memory-preview",children:r.text}),i.jsx(mL,{className:"icon-button",title:f("memory.global.copy"),onCopy:()=>e(r.text)})]}),i.jsx("p",{className:"memory-fragment-note",children:u5(Ht(r.note))})]},r.agent))]})}function v5(t){for(const e of t.split(`
|
|
151
|
+
`,40)){const r=/^#{1,3}\s+(.+)$/.exec(e.trim());if(r!==null)return(r[1]??"").trim()}return null}function _5({view:t,docs:e,onInsertPath:r}){const{plans:l}=t,a=e.active===null?null:e.docs.find(m=>m.key===e.active)??null,y=a===null?void 0:e.content(a.key),v=a!==null&&y===void 0&&t.listFor!==null&&t.listFor===e.terminalId;N.useEffect(()=>{v&&a!==null&&e.reload(a.key)},[v,a==null?void 0:a.key]),N.useEffect(()=>{if(a===null||!a.key.startsWith("codex-plan:")||t.listFor!==e.terminalId||l.some(w=>w.fileName===a.key))return;const m=l.find(w=>w.fileName.startsWith("codex-plan:"));m!==void 0&&(e.close(a.key),e.open({key:m.fileName,title:m.title}))},[a==null?void 0:a.key,t.listFor,e.terminalId,l]);const o=m=>{var d;const w=(d=e.content(m.key))==null?void 0:d.loaded;return(w==null?void 0:w.kind)==="plan"?v5(w.plan.text)??m.title:m.title},c=m=>{var d;const w=((d=l.find(k=>k.fileName===m.key))==null?void 0:d.path)??"";return w.length>0?w:o(m)};return i.jsxs("div",{className:"panel-body",children:[e.docs.length>0&&i.jsx(N_,{listLabel:f("panel.tab.plans"),docs:e.docs,active:e.active,tooltipOf:c,labelOf:o,onShowList:e.showList,onSelect:e.select,onClose:e.close}),a!==null?i.jsx(A_,{doc:a,content:y,readingText:f("plans.loading"),truncatedText:f("plans.truncated"),onReload:()=>e.reload(a.key),onModeChange:m=>e.setMode(a.key,m),onOpenWithSystem:null,initialScroll:e.scrollOf(a.key),onScrollChange:m=>e.rememberScroll(a.key,m)},a.key):i.jsx("div",{className:"panel-scroll",children:l.length===0?i.jsx("p",{className:"panel-note",children:vn("plans.empty")}):i.jsx("ul",{className:"plan-list",children:[...l].reverse().map(m=>i.jsx(w5,{plan:m,onOpen:()=>e.open({key:m.fileName,title:m.title}),onInsertPath:r},m.fileName))})})]})}function w5({plan:t,onOpen:e,onInsertPath:r}){const l=t.path.length>0?t.path:null;return t.exists?i.jsxs("li",{className:"plan-item",children:[i.jsxs("button",{className:"plan-row",onClick:e,title:l??void 0,children:[i.jsx("span",{className:"plan-name",children:t.title}),l!==null&&i.jsx("span",{className:"plan-path",children:l}),i.jsxs("span",{className:"plan-meta",children:[t.modifiedAt>0?`${nr(t.modifiedAt)} · `:"",fn(t.sizeBytes)]})]}),t.absolutePath.length>0&&i.jsx(sl,{className:"tree-action plan-action",title:f("files.insertPath",{name:t.absolutePath.split(/[\\/]/).pop()??t.title}),onInsert:()=>r(`"${t.absolutePath}"`)})]}):i.jsxs("li",{className:"plan-row plan-row-missing",title:l??f("plans.missingTitle"),children:[i.jsx("span",{className:"plan-name",children:t.title}),l!==null&&i.jsx("span",{className:"plan-path",children:l}),i.jsx("span",{className:"plan-meta",children:f("plans.missing")})]})}const b5=[{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 W_(t){return t.state!=="ready"?0:new Set(t.changes.map(e=>e.path)).size}function y5({tab:t,plansAvailable:e,hiddenTabs:r,hidden:l,onTabChange:a,title:y,cwd:v,colorCwd:o,platform:c,cli:m,cliUnseen:w,expanded:d,onToggleExpanded:k,git:L,worktrees:M,files:b,plans:h,documents:_,memory:g,onInsert:p,onInsertPath:T,onReveal:A,onHide:E}){var R;const S=W_(L.status),x=((R=g.status)==null?void 0:R.installed)===!0?g.status.notes.length:0;return i.jsxs("section",{className:`side-panel${l?" side-panel-hidden":""}`,"aria-hidden":l,children:[i.jsxs("header",{className:"side-panel-header",children:[i.jsx("button",{className:"icon-button",onClick:E,title:f("panel.hide"),children:"»"}),v.length>0&&i.jsx("span",{className:"project-swatch",style:{background:oi(o)}}),i.jsx("span",{className:"side-panel-title",title:v,children:y}),i.jsx("button",{className:"icon-button",onClick:k,title:f(d?"panel.restoreWidth":"panel.widen"),children:d?"⇥":"⇤"})]}),i.jsx("nav",{className:"side-panel-tabs",children:iC(b5,e,r).map(I=>i.jsxs("button",{className:`side-panel-tab${I.id===t?" side-panel-tab-active":""}`,onClick:()=>a(I.id),title:f(I.labelKey),children:[i.jsx("span",{className:"side-panel-tab-label",children:f(I.labelKey)}),I.id==="git"&&S>0&&i.jsx("span",{className:"side-panel-badge",children:S}),I.id==="plans"&&h.plans.length>0&&i.jsx("span",{className:"side-panel-badge",children:h.plans.length}),I.id==="memory"&&x>0&&i.jsx("span",{className:"side-panel-badge",children:x}),I.id==="cli"&&w&&t!=="cli"&&i.jsx("span",{className:"side-panel-dot",title:f("panel.cliUnseen")})]},I.id))}),i.jsxs("div",{className:"side-panel-body",children:[i.jsx("div",{className:`cli-slot${t==="cli"?"":" cli-slot-hidden"}`,children:m}),t==="git"&&i.jsx(r5,{view:L,worktrees:M}),t==="plans"&&i.jsx(_5,{view:h,docs:_.plans,onInsertPath:T}),t==="memory"&&i.jsx(d5,{view:g}),t==="files"&&i.jsx(gL,{view:b,cwd:v,platform:c,onInsert:p,onInsertPath:T,onReveal:A,docs:_.files})]})]})}function q_({messages:t}){return i.jsx("span",{className:`tab-scheduled${l1(t)?" tab-scheduled-failed":""}`,"aria-hidden":"true",children:i.jsxs("svg",{viewBox:"0 0 24 24",width:"11",height:"11",children:[i.jsx("circle",{cx:"12",cy:"12",r:"8.5",fill:"none",stroke:"currentColor",strokeWidth:"2.4"}),i.jsx("path",{d:"M12 7.5V12l3 2",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round"})]})})}function k5(t,e,r,l=null){const a=e===void 0||e.length===0?t:`${t} — ${e}`;return l===null?`${a}
|
|
152
|
+
${r}`:`${a}
|
|
153
|
+
${l}
|
|
154
|
+
${r}`}function C5(t,e){const r=[xL(t,e),t.review?f("worktree.tab.reviewTitle"):null].filter(l=>l!==null);return r.length===0?null:r.join(`
|
|
155
|
+
`)}function x5({placement:t}){return i.jsxs("div",{className:"tab tab-pending","aria-busy":"true",title:`${t.pending.cwd}
|
|
156
|
+
${f("tabs.state.opening")}`,style:{"--tab-project-color":oi(t.pending.cwd)},children:[i.jsx("span",{className:"tab-opening","aria-label":f("tabs.aria.opening"),children:i.jsx("i",{})}),i.jsx("span",{className:"tab-label",children:t.label})]})}function dh({terminal:t,activity:e,statusLine:r}){if(!t.alive){const l=t.sleeping;return i.jsx("span",{className:`tab-dot${l?" tab-dot-sleeping":" tab-dot-dead"}`,title:f(l?"tabs.dot.sleeping":"tabs.dot.exited")})}return e==="waiting"?i.jsx("span",{className:"tab-bang",title:f("tabs.dot.waiting"),children:"!"}):e==="busy"?i.jsxs("span",{className:"tab-working",title:f("tabs.dot.busy"),"aria-label":f("tabs.aria.working"),children:[i.jsx("i",{}),i.jsx("i",{}),i.jsx("i",{})]}):i.jsx("span",{className:"tab-dot",title:pC(e,r)})}function il(t){var a;if(t.label.length>0)return t.label;const e=((a=t.worktree)==null?void 0:a.linked)===!0?t.worktree.mainCwd:t.cwd,r=e.split(/[\\/]/).filter(y=>y.length>0),l=r[r.length-1]??e;return t.resumed?`${l} ↩`:l}function S5(t){return t.alive?f("tabs.state.alive"):t.sleeping?f("tabs.state.sleeping"):f("tabs.state.exited",{code:t.exitCode??"?"})}function E5({terminals:t,activeTerminalId:e,activity:r,attention:l,canOpen:a,onSelect:y,onClose:v,onRename:o,onReorder:c,onNew:m,agents:w,offerAgentChoice:d,newTabAgent:k,pendingOpens:L,platform:M,newTabBlockedTitle:b,sessionTitles:h,scheduled:_}){const[g,p]=N.useState(null),[T,A]=N.useState(""),[E,S]=N.useState(null),x=N.useRef(null);N.useEffect(()=>{var q;g!==null&&((q=x.current)==null||q.select())},[g]);const R=q=>{p(q.terminalId),A(q.label.length>0?q.label:il(q))},I=()=>{g!==null&&o(g,T.trim()),p(null)},D=q=>{if(E===null||E===q)return;const K=t.map(O=>O.terminalId),V=K.indexOf(E),W=K.indexOf(q);V===-1||W===-1||(K.splice(W,0,...K.splice(V,1)),c(K),S(null))},P=$C(t,L,M),F=new Map;for(const q of P){const K=F.get(q.index);K===void 0?F.set(q.index,[q]):K.push(q)}const z=q=>(F.get(q)??[]).map(K=>i.jsx(x5,{placement:K},`pending:${K.pending.requestId}`));return i.jsxs("div",{className:"tab-bar",children:[t.map((q,K)=>{var Z;const V=q.terminalId===e,W=q.terminalId===g,O=B_(q,t,M),U=(_==null?void 0:_.get(q.terminalId))??[],H=Wv(U),$=[C5(q,O),H].filter(re=>re!==null);return i.jsxs(pb.Fragment,{children:[z(K),i.jsx("div",{className:`tab${V?" tab-active":""}${q.alive||q.sleeping?"":" tab-dead"}${(l==null?void 0:l.has(q.terminalId))===!0?" tab-attention":""}`,draggable:!W,onDragStart:()=>S(q.terminalId),onDragOver:re=>re.preventDefault(),onDrop:()=>D(q.terminalId),onDragEnd:()=>S(null),onClick:()=>y(q.terminalId),onDoubleClick:()=>R(q),title:k5(q.cwd,h.get(q.terminalId),S5(q),$.length===0?null:$.join(`
|
|
157
|
+
`)),style:{"--tab-project-color":oi(xs(q))},children:W?i.jsx("input",{ref:x,className:"tab-input",value:T,onChange:re=>A(re.target.value),onBlur:I,onKeyDown:re=>{re.key==="Enter"&&I(),re.key==="Escape"&&p(null),re.stopPropagation()},onClick:re=>re.stopPropagation()}):i.jsxs(i.Fragment,{children:[i.jsx(dh,{terminal:q,activity:r.get(q.terminalId),statusLine:((Z=w.find(re=>re.id===q.agent))==null?void 0:Z.statusLine)??null}),i.jsxs("span",{className:"tab-label",children:[q.agent!==null&&NC(d,q.agent)&&i.jsx(jd,{agent:q.agent,agents:w}),q.review&&i.jsx("span",{className:"tab-review",children:f("worktree.tab.review")}),O!==null&&i.jsx("span",{className:"tab-branch",children:O}),U.length>0&&i.jsx(q_,{messages:U}),il(q)]}),i.jsx("button",{className:"tab-close",onClick:re=>{re.stopPropagation(),v(q.terminalId)},title:f("tabs.close"),children:"×"})]})})]},q.terminalId)}),z(t.length),i.jsx(ah,{className:"tab-new",text:"+",title:b??f("tabs.new"),disabled:!a||b!==null,offerAgentChoice:d,agents:w,agent:k,onOpen:m})]})}function T5(t,e,r){const[l,a]=N.useState(!1);return N.useEffect(()=>{if(a(!1),!(e===null||r))return t.onMessage(y=>{y.type==="terminal.output"&&y.terminalId===e&&a(!0)})},[t,e,r]),l&&!r}const L5=200,Qm="agent-workbench.files.hidden";function N5(t,e,r=null){const[l,a]=N.useState(new Map),[y,v]=N.useState(new Set),[o,c]=N.useState(new Set),[m,w]=N.useState(""),[d,k]=N.useState(null),[L,M]=N.useState(!1),[b,h]=N.useState(()=>Wt(Qm,!1,S=>S==="true"?!0:S==="false"?!1:null)),_=N.useRef(new Set),g=N.useRef(b);g.current=b;const p=N.useCallback(S=>{e===null||_.current.has(S)||(_.current.add(S),c(x=>new Set(x).add(S)),t.send({type:"files.list",terminalId:e,path:S,includeHidden:g.current}))},[t,e]);N.useEffect(()=>{if(a(new Map),v(new Set),c(new Set),w(""),k(null),M(!1),_.current=new Set,e===null)return;const S=t.onMessage(R=>{switch(R.type){case"files.listing":{if(R.terminalId!==e)break;const{listing:I}=R;_.current.delete(I.path),a(D=>new Map(D).set(I.path,I)),c(D=>{const P=new Set(D);return P.delete(I.path),P});break}case"files.results":if(R.terminalId!==e)break;k(R.result),M(!1);break;case"error":_.current=new Set,c(new Set),M(!1);break}});t.send({type:"files.list",terminalId:e,path:"",includeHidden:g.current}),_.current.add(""),c(new Set([""]));const x=t.onReopen(()=>{_.current=new Set,t.send({type:"files.list",terminalId:e,path:"",includeHidden:g.current})});return()=>{S(),x()}},[t,e,r]),N.useEffect(()=>{const S=m.trim();if(e===null||S.length===0){k(null),M(!1);return}M(!0);const x=window.setTimeout(()=>{t.send({type:"files.search",terminalId:e,query:S,includeHidden:g.current})},L5);return()=>window.clearTimeout(x)},[t,e,m,b]);const T=N.useCallback(S=>{v(x=>{const R=new Set(x);return R.has(S)?R.delete(S):(R.add(S),p(S)),R})},[p]),A=N.useCallback(()=>{if(e===null)return;_.current=new Set;const S=["",...y];for(const x of S)_.current.add(x),t.send({type:"files.list",terminalId:e,path:x,includeHidden:g.current});c(new Set(S))},[t,e,y]),E=N.useCallback(()=>{h(S=>{const x=!S;if(g.current=x,jt(Qm,String(x)),e!==null){_.current=new Set;const R=["",...y];for(const I of R)_.current.add(I),t.send({type:"files.list",terminalId:e,path:I,includeHidden:x});c(new Set(R))}return x})},[t,e,y]);return{listings:l,expanded:y,loading:o,query:m,setQuery:w,results:d,searching:L,showHidden:b,toggleHidden:E,toggleDirectory:T,refresh:A}}function R5(t){const[e,r]=N.useState(!1),[l,a]=N.useState(null),[y,v]=N.useState(null),[o,c]=N.useState(null),m=N.useRef(null);N.useEffect(()=>{const k=t.onMessage(M=>{switch(M.type){case"search.progress":if(m.current===null||M.searchId!==m.current)break;a(b=>pT(b,M.progress));break;case"search.results":if(m.current===null||M.searchId!==m.current)break;m.current=null,a(M.result),v(null),r(!1);break;case"error":if(M.code!=="search-failed"||m.current===null||M.requestId!==m.current)break;m.current=null,M.detail!==void 0&&console.error("[servidor]",M.detail),a(null),v(Ht(M.text)),r(!1);break}}),L=t.onReopen(()=>{m.current!==null&&(m.current=null,r(!1),v(f("searchHook.connectionLost")))});return()=>{k(),L()}},[t]);const w=N.useCallback((k,L)=>{const M=crypto.randomUUID();m.current=M,c({query:k,includeArchived:L}),r(!0),v(null),a(null),t.send({type:"search.global",searchId:M,query:k,includeArchived:L})},[t]),d=N.useCallback(()=>{const k=m.current;m.current=null,k!==null&&t.send({type:"search.cancel",searchId:k}),c(null),r(!1),a(null),v(null)},[t]);return{searching:e,result:l,error:y,submitted:o,search:w,clear:d}}function M5(t,e){const[r,l]=N.useState([]),[a,y]=N.useState(null);return N.useEffect(()=>{if(l([]),y(null),e!==null)return t.onMessage(v=>{switch(v.type){case"conversation.plans":if(v.terminalId!==e)break;l(v.plans),y(e);break}})},[t,e]),{plans:r,listFor:a}}const z_=8,K_=1024,A5=300,I5=["file","plan"],Ka={docs:[],active:null,recent:[]},ol={};function Va(t,e){return[...t.filter(r=>r!==e),e]}function j5(t,e,r=new Set){const l=t.docs.find(v=>v.key===e.key);if(l!==void 0)return{docs:l.title===e.title?t.docs:t.docs.map(o=>o.key===e.key?{...o,title:e.title}:o),active:e.key,recent:Va(t.recent,e.key)};let a=[...t.docs,{key:e.key,title:e.title}],y=Va(t.recent,e.key);for(;a.length>z_;){const v=y.find(o=>o!==e.key&&!r.has(o));if(v===void 0)break;a=a.filter(o=>o.key!==v),y=y.filter(o=>o!==v)}return{docs:a,active:e.key,recent:y}}function Jm(t,e){return t.docs.some(r=>r.key===e)?{...t,active:e,recent:Va(t.recent,e)}:t}function D5(t){return t.active===null?t:{...t,active:null}}function P5(t,e){const r=t.docs.findIndex(v=>v.key===e);if(r===-1)return t;const l=t.docs.filter(v=>v.key!==e),a=t.recent.filter(v=>v!==e);if(t.active!==e)return{docs:l,active:t.active,recent:a};const y=l[r]??l[r-1]??null;return{docs:l,active:y===null?null:y.key,recent:y===null?a:Va(a,y.key)}}function O5(t,e,r){return{...t,docs:t.docs.map(l=>l.key===e?{...l,mode:r}:l)}}function Zu(t,e,r){var l;return((l=t[e])==null?void 0:l[r])??Ka}function B5(t,e,r,l){const a=t[e]??{file:Ka,plan:Ka};return{...t,[e]:{...a,[r]:l}}}function F5(t,e){if(e.length===0)return t;const r=new Set(e),l=Object.keys(t).filter(y=>!r.has(y));if(l.length===0)return t;const a={...t};for(const y of l)delete a[y];return a}function ks(t,e,r){return`${t}\0${e}\0${r}`}function H5(t){const e=new Set;for(const[r,l]of Object.entries(t))for(const a of I5)for(const y of l[a].docs)e.add(ks(r,a,y.key));return e}function U5(t){return JSON.stringify(t)}function Ga(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)?t:null}function $5(t){const e=Ga(t);if(e===null)return null;const{key:r,title:l,mode:a}=e;if(typeof r!="string"||r.length===0||r.length>K_||typeof l!="string"||l.length>A5)return null;const y={key:r,title:l};return a==="formatted"||a==="source"?{...y,mode:a}:y}function Zm(t){const e=Ga(t);if(e===null||!Array.isArray(e.docs))return Ka;const r=[];for(const o of e.docs){const c=$5(o);if(c!==null&&!r.some(m=>m.key===c.key)&&r.push(c),r.length===z_)break}const l=r.map(o=>o.key),a=typeof e.active=="string"&&l.includes(e.active)?e.active:null,y=Array.isArray(e.recent)?e.recent.filter(o=>typeof o=="string"&&l.includes(o)):[],v=[...l.filter(o=>!y.includes(o)),...new Set(y)];return{docs:r,active:a,recent:v}}function W5(t){let e;try{e=JSON.parse(t)}catch{return ol}const r=Ga(e);if(r===null)return ol;const l={};for(const[a,y]of Object.entries(r)){const v=Ga(y);if(v===null||a.length===0||a.length>K_)continue;const o=Zm(v.file),c=Zm(v.plan);o.docs.length===0&&c.docs.length===0||(l[a]={file:o,plan:c})}return l}const eg=1,q5=25e4,V_={kind:"hunk",text:"…",oldLine:null,newLine:null};function Fd(t){return t.replace(/\r\n?/g,`
|
|
158
|
+
`)}function tg(t){const e=Fd(t).split(`
|
|
159
|
+
`);return e.length>0&&e[e.length-1]===""&&e.pop(),e}function z5(t,e){const r=tg(t),l=tg(e);let a=0;for(;a<r.length&&a<l.length&&r[a]===l[a];)a+=1;let y=r.length,v=l.length;for(;y>a&&v>a&&r[y-1]===l[v-1];)y-=1,v-=1;if(a===y&&a===v)return[];const o=[];for(let c=0;c<a;c+=1)o.push(Hd(r,c,c));K5(r,l,a,y,a,v,o);for(let c=y,m=v;c<r.length;c+=1,m+=1)o.push(Hd(r,c,m));return V5(o)}function Hd(t,e,r){return{kind:"context",text:t[e]??"",oldLine:e+1,newLine:r+1}}function ed(t,e){return{kind:"removed",text:t[e]??"",oldLine:e+1,newLine:null}}function td(t,e){return{kind:"added",text:t[e]??"",oldLine:null,newLine:e+1}}function K5(t,e,r,l,a,y,v){const o=l-r,c=y-a;if(o===0||c===0||o*c>q5){for(let M=r;M<l;M+=1)v.push(ed(t,M));for(let M=a;M<y;M+=1)v.push(td(e,M));return}const m=c+1,w=new Uint32Array((o+1)*m),d=(M,b)=>w[M*m+b]??0;for(let M=o-1;M>=0;M-=1)for(let b=c-1;b>=0;b-=1)w[M*m+b]=t[r+M]===e[a+b]?d(M+1,b+1)+1:Math.max(d(M+1,b),d(M,b+1));let k=0,L=0;for(;k<o&&L<c;)t[r+k]===e[a+L]?(v.push(Hd(t,r+k,a+L)),k+=1,L+=1):d(k+1,L)>=d(k,L+1)?(v.push(ed(t,r+k)),k+=1):(v.push(td(e,a+L)),L+=1);for(;k<o;k+=1)v.push(ed(t,r+k));for(;L<c;L+=1)v.push(td(e,a+L))}function V5(t){const e=t.map(a=>a.kind!=="context"),r=[];let l=-1;return t.forEach((a,y)=>{let v=!1;for(let o=-eg;o<=eg&&!v;o+=1)v=e[y+o]===!0;v&&(l!==-1&&y>l+1&&r.push(V_),r.push(a),l=y)}),r}const G_="agent-workbench.docTabs",G5=1600;function Y5(){try{const t=window.sessionStorage.getItem(G_);return t===null?ol:W5(t)}catch{return ol}}function nd(t){return t!==void 0&&(t.text!==t.opened||t.conflict!==null||t.pending!==null)}function X5(t,e,r,l){const[a,y]=N.useState(Y5),[v,o]=N.useState(new Map),[c,m]=N.useState(new Map),[w,d]=N.useState(new Set),k=N.useRef(v);k.current=v;const L=N.useRef(c);L.current=c;const M=N.useRef(new Map),b=N.useRef(new Map),h=N.useRef(new Map);N.useEffect(()=>{y(E=>F5(E,e.map(S=>S.terminalId)))},[e]),N.useEffect(()=>{const E=H5(a);for(const S of[...M.current.keys()])E.has(S)||M.current.delete(S);o(S=>{const x=[...S.keys()].filter(I=>!E.has(I));if(x.length===0)return S;const R=new Map(S);for(const I of x)R.delete(I);return R}),m(S=>{const x=[...S.keys()].filter(I=>!E.has(I));if(x.length===0)return S;const R=new Map(S);for(const I of x)R.delete(I);return R})},[a]),N.useEffect(()=>{try{window.sessionStorage.setItem(G_,U5(a))}catch{}},[a]);const _=N.useMemo(()=>[...c.values()].some(nd),[c]);N.useEffect(()=>{if(!_)return;const E=S=>{S.preventDefault(),S.returnValue=""};return window.addEventListener("beforeunload",E),()=>window.removeEventListener("beforeunload",E)},[_]),N.useEffect(()=>{const E=h.current;return()=>{for(const S of E.values())window.clearTimeout(S)}},[]);const g=N.useCallback((E,S,x)=>{const R=ks(E,S,x);o(I=>{var D;return new Map(I).set(R,{loaded:((D=I.get(R))==null?void 0:D.loaded)??null,loading:!0,failed:!1})}),S==="file"?t.send({type:"files.read",terminalId:E,path:x}):t.send({type:"plans.read",terminalId:E,fileName:x})},[t]),p=N.useCallback((E,S)=>{m(x=>{const R=x.get(E);if(R===void 0)return x;const I=new Map(x),D=S(R);return D===null?I.delete(E):I.set(E,D),I})},[]),T=N.useCallback(E=>{d(x=>new Set(x).add(E));const S=h.current.get(E);S!==void 0&&window.clearTimeout(S),h.current.set(E,window.setTimeout(()=>{h.current.delete(E),d(x=>{if(!x.has(E))return x;const R=new Set(x);return R.delete(E),R})},G5))},[]);N.useEffect(()=>{const E=(R,I)=>o(D=>D.has(R)?new Map(D).set(R,{loaded:I,loading:!1,failed:!1}):D),S=t.onMessage(R=>{switch(R.type){case"files.preview":E(ks(R.terminalId,"file",R.preview.path),{kind:"file",preview:R.preview});break;case"plans.content":E(ks(R.terminalId,"plan",R.plan.fileName),{kind:"plan",plan:R.plan});break;case"files.saved":{const I=b.current.get(R.requestId);if(I===void 0)break;b.current.delete(R.requestId);const{id:D}=I,{preview:P}=R;if(P!==null&&E(D,{kind:"file",preview:P}),R.outcome==="saved")p(D,()=>null),T(D);else{const F=P!==null&&P.editable===!0?P:null;p(D,z=>({...z,saving:!1,conflict:{next:F}}))}break}case"error":{const I=R.requestId===void 0?void 0:b.current.get(R.requestId);if(I!==void 0&&R.requestId!==void 0){b.current.delete(R.requestId),p(I.id,D=>({...D,saving:!1,failure:{kind:"server",text:R.text}}));break}o(D=>{if(![...D.values()].some(F=>F.loading))return D;const P=new Map;for(const[F,z]of D)P.set(F,z.loading?{...z,loading:!1,failed:!0}:z);return P});break}}}),x=t.onReopen(()=>{for(const[R,I]of k.current){if(!I.loading)continue;const[D,P,F]=R.split("\0");D===void 0||F===void 0||(P==="file"&&t.send({type:"files.read",terminalId:D,path:F}),P==="plan"&&t.send({type:"plans.read",terminalId:D,fileName:F}))}for(const[R,I]of b.current){if(!I.sent){I.sent=!0;continue}b.current.delete(R),p(I.id,D=>({...D,saving:!1,failure:{kind:"lost"}}))}});return()=>{S(),x()}},[t,p,T]);const A=N.useCallback(E=>{const S=r,x=S===null?Zu(ol,"",E):Zu(a,S,E),R=q=>S===null?null:ks(S,E,q),I=q=>{S!==null&&y(K=>B5(K,S,E,q(Zu(K,S,E))))},D=q=>{const K=R(q);return K!==null&&nd(c.get(K))},P=()=>new Set(x.docs.filter(q=>D(q.key)).map(q=>q.key)),F=q=>I(K=>P5(K,q)),z=q=>{const K=R(q);if(E!=="file"||!l||S===null||K===null)return null;const V=c.get(K)??null;return{edit:V,unsaved:nd(V??void 0),justSaved:w.has(K),begin:()=>{var H;const W=(H=v.get(K))==null?void 0:H.loaded;if((W==null?void 0:W.kind)!=="file"||W.preview.editable!==!0||W.preview.hash===void 0)return;const{hash:O}=W.preview,U=Fd(W.preview.text);m($=>$.has(K)?$:new Map($).set(K,{opened:U,baseHash:O,text:U,saving:!1,failure:null,conflict:null,pending:null,closing:!1}))},change:W=>p(K,O=>O.conflict!==null?O:{...O,text:W,failure:null}),save:()=>{const W=L.current.get(K);if(W===void 0||W.saving||W.conflict!==null||W.text===W.opened)return;const O=crypto.randomUUID(),U=t.send({type:"files.write",terminalId:S,requestId:O,path:q,text:W.text,baseHash:W.baseHash});b.current.set(O,{id:K,sent:U}),p(K,H=>({...H,saving:!0,failure:null}))},discard:()=>{const W=L.current.get(K);p(K,()=>null),W!==void 0&&W.conflict!==null&&W.conflict.next===null&&g(S,E,q)},adopt:()=>p(K,W=>{var Z;const O=((Z=W.conflict)==null?void 0:Z.next)??null;if(O===null||O.hash===void 0)return W;const U=z5(W.opened,W.text),H=U.length===0?W.pending:W.pending===null?U:[...W.pending,V_,...U],$=Fd(O.text);return{...W,opened:$,baseHash:O.hash,text:$,failure:null,conflict:null,pending:H,closing:!1}}),dismissPending:()=>p(K,W=>({...W,pending:null})),confirmClose:()=>{p(K,()=>null),F(q)},keepEditing:()=>p(K,W=>({...W,closing:!1}))}};return{terminalId:S,docs:x.docs,active:x.active,open:q=>{if(S===null)return;const K=P();I(V=>j5(V,q,K)),g(S,E,q.key)},select:q=>I(K=>Jm(K,q)),showList:()=>I(D5),close:F,requestClose:q=>{const K=R(q);if(K===null||!D(q)){F(q);return}I(V=>Jm(V,q)),p(K,V=>({...V,closing:!0}))},setMode:(q,K)=>I(V=>O5(V,q,K)),content:q=>S===null?void 0:v.get(ks(S,E,q)),reload:q=>{S!==null&&g(S,E,q)},rememberScroll:(q,K)=>{S!==null&&M.current.set(ks(S,E,q),K)},scrollOf:q=>S===null?void 0:M.current.get(ks(S,E,q)),editorFor:z,unsaved:D}},[r,a,v,c,w,l,t,g,p]);return N.useMemo(()=>({files:A("file"),plans:A("plan")}),[A])}const Q5=/(?::\d+(?:[:-]\d+)?|#L\d+(?:-L?\d+)?)$/,J5=/[\n\r\t*?<>|"`]/,Z5=/\.[A-Za-z0-9_-]{1,12}$/,Y_=t=>t.replace(/\\/g,"/"),e2=t=>t.replace(/\/+$/,"");function ng(t,e){const r=e2(Y_(e.cwd));return r.length===0?null:(e.platform==="win32"?t.toLowerCase().startsWith(`${r.toLowerCase()}/`):t.startsWith(`${r}/`))?t.slice(r.length+1):null}function hh(t,e){let r=t.trim();const l=/^(["'])(.*)\1$/.exec(r);if(l!==null&&(r=(l[2]??"").trim()),r.startsWith("@")&&(r=r.slice(1)),r.length===0||r.length>ck||J5.test(r)||r.includes("://")||r.startsWith("~")||r.startsWith("-")||(r=Y_(r.replace(Q5,"")).replace(/[.,;:]+$/,""),r.length===0))return null;const a=e.platform==="win32";if(a&&e.agent==="codex"&&/^\/[A-Za-z]:\//.test(r)&&(r=r.slice(1)),/^[A-Za-z]:\//.test(r)||r.startsWith("//")){const c=a?ng(r,e):null;if(c===null)return null;r=c}else if(r.startsWith("/")){const c=a?null:ng(r,e);if(c===null)return null;r=c}const y=r.endsWith("/"),v=[];for(const c of r.split("/"))if(!(c===""||c===".")){if(c===".."){if(v.length===0)return null;v.pop();continue}if(c.includes(":")||c!==c.trim())return null;v.push(c)}const o=v[v.length-1];return o===void 0||v.length===1&&!Z5.test(o)&&!y?null:v.join("/")}function X_(t,e){var y;const l=((y=(t.startsWith("<")&&t.endsWith(">")?t.slice(1,-1):t).split("#")[0])==null?void 0:y.split("?")[0])??"";if(l.length===0)return null;let a;try{a=decodeURIComponent(l)}catch{return null}return/^[a-z][a-z0-9+.-]+:/i.test(a)?null:hh(a,e)}const t2=/`([^`\n]+)`/g,n2=/\]\((<[^>\r\n]+>|[^)\s]+)\)/g;function r2(t,e){const r=new Set;for(const l of t.matchAll(t2)){const a=hh(l[1]??"",e);a!==null&&r.add(a)}for(const l of t.matchAll(n2)){const a=X_(l[1]??"",e);a!==null&&r.add(a)}return[...r]}function s2(t,e,r){return t.filter(l=>(e.get(l)??null)===null&&!r.has(l))}function i2(t,e,r,l=[]){const a=new Set(r),y=new Set(l),v=new Map(t);for(const o of e)v.set(o,a.has(o)?"file":y.has(o)?"directory":null);return v}const o2=1e3;function l2(t){const{connection:e,agent:r,enabled:l,terminalId:a,cwd:y,platform:v,events:o,liveTerminalIds:c,onOpen:m,onOpenFolder:w}=t,d=N.useRef(new Map),k=N.useRef(new Map),L=N.useRef(0),[M,b]=N.useState(0),[h,_]=N.useState(0),g=N.useMemo(()=>({cwd:y,platform:v,agent:r??void 0}),[y,v,r]);return N.useEffect(()=>{const p=e.onMessage(A=>{if(A.type!=="files.checked")return;const E=k.current.get(A.requestId);if(E===void 0)return;k.current.delete(A.requestId);const S=d.current.get(E.terminalId);if(S!==void 0){for(const x of E.paths)S.pending.delete(x);S.known=i2(S.known,E.paths,A.existing,A.directories),b(x=>x+1)}}),T=e.onReopen(()=>{k.current.clear();for(const A of d.current.values())A.pending.clear(),A.scanned=new WeakSet;_(A=>A+1)});return()=>{p(),T()}},[e]),N.useEffect(()=>{const p=new Set(c);for(const T of[...d.current.keys()])p.has(T)||d.current.delete(T)},[c]),N.useEffect(()=>{if(!l||a===null||y.length===0)return;let p=d.current.get(a);p===void 0&&(p={known:new Map,pending:new Set,scanned:new WeakSet},d.current.set(a,p));const T=new Set;for(const E of o)if(!p.scanned.has(E)&&(p.scanned.add(E),E.role==="assistant")){for(const S of E.parts)if(S.kind==="text")for(const x of r2(S.text,g))T.add(x)}const A=s2([...T],p.known,p.pending).slice(0,o2);for(let E=0;E<A.length;E+=Mp){const S=A.slice(E,E+Mp);L.current+=1;const x=`files-${L.current}`;k.current.set(x,{terminalId:a,paths:S});for(const R of S)p.pending.add(R);e.send({type:"files.check",terminalId:a,requestId:x,paths:S})}},[e,l,a,y,g,o,h]),N.useMemo(()=>{var A;if(!l||a===null)return null;const p=(A=d.current.get(a))==null?void 0:A.known,T=E=>{if(E===null)return null;const S=(p==null?void 0:p.get(E))??null;return S==="file"?{open:()=>m(E),folder:!1}:S==="directory"&&w!==null?{open:()=>w(E),folder:!0}:null};return{code:E=>T(hh(E,g)),link:E=>{var S;return((S=T(X_(E,g)))==null?void 0:S.open)??null}}},[l,a,g,m,w,M])}const rd=new O_;function a2(t,e){const[r,l]=N.useState(Ea),[a,y]=N.useState(!1),v=N.useRef(!1),o=N.useRef(null),[c,m]=N.useState(null),[w,d]=N.useState(!1);N.useEffect(()=>{const b=p=>{v.current=p,y(p)};if(e===null){l(Ea),b(!1),m(null);return}const h=rd.enter(e,Ea);l(h.value),b(h.stale),o.current=null,m(null),d(!1);const _=t.onMessage(p=>{switch(p.type){case"git.status":{if(p.terminalId!==e)break;bL(rd,e,p.status),l(p.status),b(!1);const T=o.current;if(o.current=null,T===null)break;p.status.state==="ready"?t.send({type:"git.diff",terminalId:e,path:T.path,staged:T.staged}):d(!1);break}case"git.diff":if(p.terminalId!==e)break;m(p.diff),d(!1);break;case"error":d(!1),o.current=null,p.code==="unknown-terminal"&&v.current&&(rd.forget(e),l(Ea),b(!1));break}});t.send({type:"git.subscribe",terminalId:e});const g=t.onReopen(()=>{t.send({type:"git.subscribe",terminalId:e})});return()=>{_(),g(),t.send({type:"git.unsubscribe",terminalId:e})}},[t,e]);const k=N.useCallback((b,h)=>{if(e!==null){if(d(!0),m(null),v.current){o.current={path:b,staged:h};return}t.send({type:"git.diff",terminalId:e,path:b,staged:h})}},[t,e]),L=N.useCallback(()=>{o.current=null,m(null),d(!1)},[]),M=N.useCallback(()=>{e!==null&&t.send({type:"git.refresh",terminalId:e})},[t,e]);return{status:r,stale:a,diff:c,loadingDiff:w,openDiff:k,closeDiff:L,refresh:M}}const Ud=new Set;function c2(t){return t!==void 0&&Ud.has(t)}function u2(t){return t.length===0?f("memory.result.nothingChanged"):f("memory.result.installed",{count:t.length})}function d2(t,e){const r=t.length===0?f("memory.result.nothingImported"):f("memory.result.imported",{count:t.length});return e.length===0?r:f("memory.result.withSkipped",{result:r,skipped:f("memory.result.skipped",{count:e.length,files:e.join(", ")})})}function h2(t,e,r=null){const[l,a]=N.useState(null),[y,v]=N.useState(null),[o,c]=N.useState(null),[m,w]=N.useState(null),[d,k]=N.useState(null),[L,M]=N.useState(null),[b,h]=N.useState(null),_=N.useRef(new Map),g=N.useRef(new Set),p=N.useRef(null),T=N.useRef(!1),A=N.useCallback(q=>{const K=`memory-${crypto.randomUUID()}`;return _.current.set(K,q),g.current.add(K),Ud.add(K),K},[]),E=N.useCallback(q=>{for(const[K,V]of _.current)V===q&&_.current.delete(K)},[]);N.useEffect(()=>{a(null),v(null),c(null),w(null),k(null),M(null),h(null),_.current.clear();for(const U of g.current)Ud.delete(U);if(g.current.clear(),p.current=null,T.current=!1,e===null)return;const q=(U,H)=>U===void 0||_.current.get(U)!==H?!1:(_.current.delete(U),!0),K=t.onMessage(U=>{switch(U.type){case"memory.status":if(U.terminalId!==e)break;a(U.status),T.current&&(T.current=!1,h(null));break;case"memory.planned":if(U.terminalId!==e||!q(U.requestId,"plan"))break;w(U.changes),k(null);break;case"memory.installed":if(U.terminalId!==e||!q(U.requestId,"install"))break;p.current=null,w(null),k(null),M(u2(U.applied));break;case"memory.imported":if(U.terminalId!==e||!q(U.requestId,"import"))break;k(null),M(d2(U.copied,U.skipped));break;case"memory.content":if(U.terminalId!==e||!q(U.requestId,"read"))break;v(U.note),c(null);break;case"error":{const H=U.requestId,$=H===void 0?void 0:_.current.get(H);if(H===void 0||$===void 0)break;_.current.delete(H),$==="read"?c(null):$!=="subscribe"&&k(null),h(Ht(U.text)),T.current=$==="subscribe";break}}}),V=t.onStatus(U=>{if(U!=="reconnecting"&&U!=="failed")return;const H=new Set(_.current.values());_.current.clear(),k(null),c(null),(H.has("install")||H.has("import"))&&(p.current=null,w(null),h(f("memory.error.connectionLost")))}),W=()=>{t.send({type:"memory.subscribe",terminalId:e,requestId:A("subscribe")})};W();const O=t.onReopen(W);return()=>{K(),V(),O(),t.send({type:"memory.unsubscribe",terminalId:e})}},[t,e,r,A]);const S=N.useCallback(()=>{T.current=!1,h(null),M(null)},[]),x=N.useCallback(q=>{e!==null&&(E("read"),S(),c(q),v(null),t.send({type:"memory.read",terminalId:e,name:q,requestId:A("read")}))},[t,e,S,E,A]),R=N.useCallback(()=>{E("read"),v(null),c(null)},[E]),I=N.useCallback(q=>{e!==null&&(S(),p.current=q,w(null),k("plan"),t.send({type:"memory.plan",terminalId:e,options:q,requestId:A("plan")}))},[t,e,S,A]),D=N.useCallback(()=>{const q=p.current;e===null||q===null||(S(),k("install"),t.send({type:"memory.install",terminalId:e,options:q,requestId:A("install")}))},[t,e,S,A]),P=N.useCallback(()=>{e!==null&&(S(),k("import"),t.send({type:"memory.import",terminalId:e,requestId:A("import")}))},[t,e,S,A]),F=N.useCallback(()=>{E("plan"),p.current=null,w(null)},[E]),z=N.useCallback(()=>{T.current=!1,h(null),M(null)},[]);return{status:l,open:y,loading:o,planned:m,busy:d,lastResult:L,error:b,openNote:x,closeNote:R,requestPlan:I,install:D,importNative:P,cancelPlan:F,dismissMessage:z}}function f2(t){const[e,r]=N.useState([]),[l,a]=N.useState({}),[y,v]=N.useState(null),o=N.useRef(new Set),c=N.useRef(new Map);N.useEffect(()=>{const A=t.onMessage(S=>{var x;switch(S.type){case"notes.list":r(S.notes);break;case"notes.imageData":o.current.add(S.imageId),a(R=>({...R,[S.imageId]:S.data===null?null:`data:${S.mediaType};base64,${S.data}`}));break;case"notes.fileData":(x=c.current.get(S.fileId))==null||x(S.data===null?null:{name:S.name,data:S.data});break;case"error":S.code==="notes-failed"&&v(Ht(S.text));break}}),E=t.onReopen(()=>{o.current.clear();for(const S of c.current.values())S(null)});return()=>{A(),E();for(const S of c.current.values())S(null)}},[t]);const m=N.useCallback(A=>{o.current.has(A)||(o.current.add(A),t.send({type:"notes.image",imageId:A}))},[t]),w=N.useCallback(()=>{const A=crypto.randomUUID(),E=Date.now();return r(S=>[...S,{noteId:A,text:"",images:[],createdAt:E,updatedAt:E}]),t.send({type:"notes.create",noteId:A}),A},[t]),d=N.useCallback((A,E)=>{r(S=>S.map(x=>x.noteId===A?{...x,text:E,updatedAt:Date.now()}:x)),t.send({type:"notes.update",noteId:A,text:E})},[t]),k=N.useCallback(A=>{r(E=>E.filter(S=>S.noteId!==A)),t.send({type:"notes.delete",noteId:A})},[t]),L=N.useCallback((A,E)=>{const S=e.find(R=>R.noteId===A);if(S!==void 0&&S.images.length>=Lp){v(f("notes.tooManyImages",{count:Lp}));return}if(E.size>ni){v(f("notes.imageTooBig",{name:E.name||f("notes.imageFallbackName"),size:Math.round(E.size/1024/1024),max:ni/1024/1024}));return}const x=new FileReader;x.onload=()=>{const R=x.result;if(typeof R!="string")return;const I=R.indexOf(",");I!==-1&&t.send({type:"notes.addImage",noteId:A,image:{mediaType:E.type,data:R.slice(I+1)}})},x.onerror=()=>v(f("notes.readFailed")),x.readAsDataURL(E)},[t,e]),M=N.useCallback((A,E)=>{r(S=>S.map(x=>x.noteId===A?{...x,images:x.images.filter(R=>R.imageId!==E)}:x)),t.send({type:"notes.removeImage",noteId:A,imageId:E})},[t]),b=N.useCallback((A,E)=>{t.send({type:"notes.send",noteId:A,terminalId:E})},[t]),h=N.useCallback((A,E)=>{var R;const S=e.find(I=>I.noteId===A);if((((R=S==null?void 0:S.files)==null?void 0:R.length)??0)>=Np){v(f("notes.tooManyFiles",{max:Np}));return}if(E.size===0){v(f("composer.problem.empty",{name:E.name}));return}if(E.size>Ki){v(f("composer.problem.tooBig",{name:E.name,size:Math.round(E.size/1024/1024),max:Ki/1024/1024}));return}const x=new FileReader;x.onload=()=>{if(typeof x.result!="string")return;const I=x.result.indexOf(",");I<0||t.send({type:"notes.addFile",noteId:A,file:{name:E.name,data:x.result.slice(I+1)}})},x.onerror=()=>v(f("composer.problem.unreadable",{name:E.name})),x.readAsDataURL(E)},[t,e]),_=N.useCallback((A,E)=>{r(S=>S.map(x=>x.noteId===A?{...x,files:(x.files??[]).filter(R=>R.fileId!==E)}:x)),t.send({type:"notes.removeFile",noteId:A,fileId:E})},[t]),g=N.useCallback(A=>c.current.has(A)?Promise.resolve(null):new Promise(E=>{const S=R=>{clearTimeout(x),c.current.delete(A),R===null&&v(f("notes.fileUnavailable")),E(R)},x=setTimeout(()=>S(null),6e4);c.current.set(A,S),t.send({type:"notes.file",fileId:A})}),[t]),p=N.useCallback(async A=>{var S;if((((S=A.files)==null?void 0:S.length)??0)>ri)return v(f("composer.problem.tooManyFiles",{count:ri})),null;const E=[];for(const x of A.files??[]){const R=await g(x.fileId);if(R===null)return null;E.push(R)}return E},[g]),T=N.useCallback(()=>v(null),[]);return{notes:e,images:l,problem:y,requestImage:m,create:w,updateText:d,remove:k,addImage:L,removeImage:M,addFile:h,removeFile:_,requestFile:g,filesForComposer:p,sendToAgent:b,dismissProblem:T}}function p2(t){const[e,r]=N.useState([]);return N.useEffect(()=>t.onMessage(l=>{l.type==="plan.limits"&&r(l.limits)}),[t]),e}const Q_="agent-workbench.theme",sd=["system","light","dark"],m2={system:"theme.system",light:"theme.light",dark:"theme.dark"};function rg(t){return f("theme.title",{theme:f(m2[t])})}const sg={system:"◐",light:"☀",dark:"☾"};function g2(){return Wt(Q_,"system",t=>t==="light"||t==="dark"||t==="system"?t:null)}function v2(){return window.matchMedia("(prefers-color-scheme: dark)").matches}function _2(){const[t,e]=N.useState(g2),[r,l]=N.useState(v2);N.useEffect(()=>{const v=window.matchMedia("(prefers-color-scheme: dark)"),o=c=>l(c.matches);return v.addEventListener("change",o),()=>v.removeEventListener("change",o)},[]);const a=t==="system"?r?"dark":"light":t;N.useEffect(()=>{document.documentElement.dataset.theme=a,document.documentElement.style.colorScheme=a},[a]);const y=N.useCallback(()=>{e(v=>{const o=sd[(sd.indexOf(v)+1)%sd.length]??"system";return jt(Q_,o),o})},[]);return{preference:t,resolved:a,cycle:y}}const ig="agent-workbench.terminalTheme";function w2(t){return t==="dark"||t==="follow"?t:null}function b2(t,e){return t==="follow"?e:"dark"}function y2(t){const[e,r]=N.useState(()=>Wt(ig,"dark",w2)),l=b2(e,t);N.useEffect(()=>{document.documentElement.dataset.terminalTheme=l},[l]);const a=N.useCallback(y=>{jt(ig,y),r(y)},[]);return{preference:e,resolved:l,setPreference:a}}const k2=1500;function C2(t,e){return t===void 0||t===e?null:e==="waiting"?"attention":e==="idle"&&t==="busy"?"done":null}function x2(t,e){const r={now:[],later:[],cancel:[]};for(const[l,a]of e){const y=t.get(l);if(y===a)continue;r.cancel.push(l);const v=C2(y,a);v==="attention"?r.now.push(l):v==="done"&&r.later.push(l)}for(const l of t.keys())e.has(l)||r.cancel.push(l);return r}const og="agent-workbench.phone-chime";function S2(t){return t==="system"||t==="page"?t:null}function E2(t){return`agentworkbench://chime?source=${t}`}function T2(t,e,r,l){return t?e==="page"?Qa:null:r?hl(l):null}const lg="agent-workbench.sound";function L2(t){return t==="on"?!0:t==="off"?!1:null}function N2(t){return f(t?"sound.on":"sound.off")}function R2(t,e){return t&&e>0}const M2={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}]},J_=.02,Qa=.8,Z_=.2,ag="agent-workbench.sound-volume";function hl(t){return Math.min(Qa,Math.max(J_,t))}function A2(t){if(t.trim().length===0)return null;const e=Number(t);return Number.isFinite(e)?hl(e):null}function I2(t){return Math.round(hl(t)/Qa*100)}class j2{constructor(){Ut(this,"context",null);Ut(this,"volume",Z_)}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 r=this.context;if(r===null||r.state!=="running")return;const l=r.currentTime+.01;for(const a of M2[e]){const y=r.createOscillator(),v=r.createGain();y.type="sine",y.frequency.value=a.frequency;const o=l+a.at;v.gain.setValueAtTime(1e-4,o),v.gain.exponentialRampToValueAtTime(hl(this.volume),o+.012),v.gain.exponentialRampToValueAtTime(1e-4,o+a.duration),y.connect(v),v.connect(r.destination),y.start(o),y.stop(o+a.duration+.02)}}}const id="agent-workbench.notify";function D2(t){return t==="on"?!0:t==="off"?!1:null}function P2(t,e,r){return t&&e==="granted"&&!r}function O2(t,e){return f(e==="denied"?"sound.notify.blocked":t?"sound.notify.on":"sound.notify.off")}function B2(t,e){return t==="attention"?f("notify.attention",{tab:e}):f("notify.done",{tab:e})}function cg(t){return t===void 0?"":t.label.length>0?t.label:t.cwd.split(/[\\/]/).filter(e=>e.length>0).pop()??t.cwd}function el(){return typeof window>"u"||!("Notification"in window)||!window.isSecureContext?"unsupported":Notification.permission}async function F2(){if(el()==="unsupported")return"unsupported";try{return await Notification.requestPermission()}catch{return el()}}function H2(){return document.visibilityState==="visible"&&document.hasFocus()}function U2(t){try{const e=new Notification("Agent Workbench",{body:B2(t.chime,t.tabName),tag:`agent-workbench:${t.terminalId}`});e.onclick=()=>{window.focus(),t.onClick(),e.close()}}catch{}}function $2(t,e){const[r,l]=N.useState(()=>Wt(lg,!0,L2)),a=N.useRef(r);a.current=r;const[y,v]=N.useState(()=>Wt(ag,Z_,A2)),o=N.useRef(y);o.current=y;const[c]=N.useState(()=>typeof navigator<"u"&&Hv(navigator.userAgent)),[m,w]=N.useState(()=>Wt(og,"system",S2)),d=N.useRef(m);d.current=m;const[k,L]=N.useState(()=>el()),[M,b]=N.useState(()=>Wt(id,!1,D2)),h=N.useRef(M);h.current=M;const _=N.useRef(e);_.current=e;const g=N.useCallback((U,H)=>{P2(h.current,el(),H2())&&U2({chime:U,terminalId:H,tabName:_.current.nameOf(H),onClick:()=>_.current.activate(H)})},[]),p=N.useRef(null),T=N.useRef(new Map),A=N.useRef(new Map),[E,S]=N.useState(()=>new Set),x=N.useRef(new Map),R=N.useRef(new Set),I=N.useCallback(U=>R.current.delete(U),[]),D=N.useCallback(U=>{R.current.add(U);const H=x.current,$=H.get(U);$!==void 0&&window.clearTimeout($),S(Z=>Z.has(U)?Z:new Set(Z).add(U)),H.set(U,window.setTimeout(()=>{H.delete(U),S(Z=>{if(!Z.has(U))return Z;const re=new Set(Z);return re.delete(U),re})},r_))},[]),P=N.useCallback(U=>{const H=p.current,$=T2(c,d.current,a.current,o.current);H===null||$===null||(H.volume=$,H.play(U))},[c]);N.useEffect(()=>{const U=new j2;U.volume=o.current,p.current=U;const H=()=>{U.unlock(),U.ready&&(window.removeEventListener("pointerdown",H),window.removeEventListener("keydown",H))};return window.addEventListener("pointerdown",H),window.addEventListener("keydown",H),()=>{window.removeEventListener("pointerdown",H),window.removeEventListener("keydown",H),p.current=null}},[]),N.useEffect(()=>{const U=x2(T.current,t);T.current=new Map(t);const H=A.current;for(const $ of U.cancel){const Z=H.get($);Z!==void 0&&(window.clearTimeout(Z),H.delete($))}U.now.length>0&&P("attention");for(const $ of U.now)g("attention",$),D($);for(const $ of U.later)H.set($,window.setTimeout(()=>{H.delete($),P("done"),g("done",$),D($)},k2))},[t,g,P,D]),N.useEffect(()=>{const U=A.current,H=x.current;return()=>{for(const $ of U.values())window.clearTimeout($);U.clear();for(const $ of H.values())window.clearTimeout($);H.clear()}},[]);const F=N.useCallback(()=>{var U,H;l($=>{const Z=!$;return jt(lg,Z?"on":"off"),Z}),a.current||((U=p.current)==null||U.unlock(),(H=p.current)==null||H.play("done"))},[]),z=N.useCallback(U=>{const H=hl(U);v(H),jt(ag,String(H)),p.current!==null&&(p.current.volume=H)},[]),q=N.useCallback(()=>{var U,H;a.current&&((U=p.current)==null||U.unlock(),(H=p.current)==null||H.play("done"))},[]),K=N.useCallback(()=>{if(h.current&&el()==="granted"){b(!1),jt(id,"off");return}F2().then(U=>{L(U),U==="granted"&&(b(!0),jt(id,"on"))})},[]),V={supported:k!=="unsupported",enabled:M&&k==="granted",permission:k,toggle:K},W=N.useCallback(U=>{var H;w(U),d.current=U,jt(og,U),window.location.href=E2(U),U==="page"&&((H=p.current)==null||H.unlock(),P("done"))},[P]);return{enabled:r,toggle:F,volume:y,setVolume:z,previewVolume:q,notify:V,phoneChime:c?{source:m,setSource:W}:null,attention:E,takeNotice:I}}function ew(t,e,r){const[l,a]=N.useState(()=>Wt(t,e,IS));N.useLayoutEffect(()=>{document.documentElement.dataset[r]=l},[r,l]);const y=N.useCallback(()=>{a(v=>{const o=n_(v);return jt(t,o),o})},[t]);return{size:l,cycle:y}}function W2(){return ew(NS,t_,"threadFont")}function q2(){return ew(RS,MS,"notesFont")}function z2(t,e){const[r,l]=N.useState(()=>new Map),[a,y]=N.useState(()=>new Map),v=N.useCallback((c,m,w,d)=>{l(k=>new Map(k).set(c,{requestId:m,terminalId:c,afterEventId:w,phase:"sending",queued:d,sentAt:Date.now(),deliveredAt:null}))},[]);N.useEffect(()=>{const c=t.onMessage(w=>{w.type==="agent.submitted"&&l(d=>y1(d,w,Date.now()))}),m=t.onReopen(()=>l(w=>b1(w,Date.now())));return()=>{c(),m()}},[t]);const o=N.useRef(new Map);return N.useLayoutEffect(()=>{const c=o.current;if(c===e)return;o.current=e;const m=Date.now();y(w=>w1(c,e,w,m))},[e]),{track:v,receipts:r,clocks:a}}const K2=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]);function tw({sound:t}){return i.jsxs("span",{className:"sound-control",children:[i.jsx("button",{className:`icon-button${R2(t.enabled,t.volume)?" icon-button-on":""}`,onClick:t.toggle,title:N2(t.enabled),"aria-pressed":t.enabled,children:"♪"}),t.enabled&&i.jsx("div",{className:"sound-volume",children:i.jsxs("div",{className:"sound-volume-box",children:[i.jsx("input",{className:"sound-volume-slider",type:"range",min:J_,max:Qa,step:.01,value:t.volume,onChange:e=>t.setVolume(Number(e.target.value)),onPointerUp:t.previewVolume,onKeyUp:e=>{K2.has(e.key)&&t.previewVolume()},title:f("sound.volume"),"aria-label":f("sound.volume")}),i.jsxs("span",{className:"sound-volume-value",children:[I2(t.volume),"%"]})]})})]})}function nw({notify:t}){return t.supported?i.jsx("button",{className:`icon-button${t.enabled?" icon-button-on":""}`,onClick:t.toggle,title:O2(t.enabled,t.permission),"aria-pressed":t.enabled,children:i.jsx(V2,{})}):null}function V2(){return i.jsx("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",focusable:"false",children:i.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 G2(t){const[e,r]=N.useState(null),[l,a]=N.useState(null),[y,v]=N.useState(null),[o,c]=N.useState(!1),[m,w]=N.useState(null);N.useEffect(()=>{const T=t.onMessage(E=>{switch(E.type){case"remote.status":r(E.status),E.status.pairingActive||(a(null),v(null));break;case"remote.pairing.code":a(E.pairing),v(null);break;case"remote.phone.pairing":v(E.pairing),a(null);break;case"error":if(E.code!=="remote-failed")break;w(Ht(E.text)),E.detail!==void 0&&console.error("[servidor]",E.detail);break}}),A=t.onReopen(()=>{a(null),v(null),c(!1)});return()=>{T(),A()}},[t]);const d=N.useCallback(T=>{w(null),t.send({type:"remote.configure",enabled:T})},[t]),k=N.useCallback(T=>{w(null),t.send({type:"remote.configure",port:T})},[t]),L=N.useCallback(()=>{w(null),t.send({type:"remote.pairing.start"})},[t]),M=N.useCallback(()=>{a(null),t.send({type:"remote.pairing.cancel"})},[t]),b=N.useCallback(()=>{w(null),c(!0),t.send({type:"remote.phone.start"})},[t]),h=N.useCallback(()=>{v(null),c(!1),t.send({type:"remote.phone.cancel"})},[t]),_=N.useCallback((T,A)=>{w(null),t.send({type:"remote.device.rename",deviceId:T,label:A})},[t]),g=N.useCallback(T=>{w(null),t.send({type:"remote.device.revoke",deviceId:T})},[t]),p=N.useCallback(()=>w(null),[]);return{status:e,pairing:l,phonePairing:y,phoneStarted:o,problem:m,setEnabled:d,setPort:k,startPairing:L,cancelPairing:M,startPhonePairing:b,cancelPhonePairing:h,renameDevice:_,revokeDevice:g,dismissProblem:p}}const Y2="USER";function X2(t,e){const r=t.sshUser.length>0?t.sshUser:Y2,l=/\s/.test(r)?`"${r}@${e}"`:`${r}@${e}`;return`ssh -N -L ${t.port}:127.0.0.1:${t.port} ${l}`}function rw(t){return`http://localhost:${t}`}function Q2(t,e){return`${rw(t)}/?${X0}=${e}`}function ug(t){return t[0]??"localhost"}function $d(t,e){switch(t){case"off":return f("remote.state.off");case"active":return f("remote.state.active",{port:e});case"restart-needed":return f("remote.state.restartNeeded");case"port-busy":return f("remote.state.portBusy",{port:e})}}function J2(t){const e=t.trim();if(!/^\d{1,5}$/.test(e))return null;const r=Number(e);return J0(r)?r:null}function Z2(){return f("remote.portInvalid",{min:Qg,max:Jg})}function dg(t,e){return Math.max(0,Math.ceil((t-e)/1e3))}function hg(t){return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}function eN(t,e=Date.now()){return t.connected?f("remote.device.connected"):t.lastSeenAt===null?f("remote.device.never"):f("remote.device.lastSeen",{when:nr(t.lastSeenAt,e)})}function tN(t,e=Date.now()){return f("remote.device.paired",{when:nr(t.createdAt,e)})}function nN(t){switch(t){case"powershell-admin":return f("remote.phone.authorize.admin");case"powershell":return f("remote.phone.authorize.powershell");case"terminal":return f("remote.phone.authorize.terminal")}}function rN(){return[{platform:"win32",label:"Windows",hint:f("remote.ssh.windows"),command:["Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0","Start-Service sshd","Set-Service -Name sshd -StartupType Automatic"].join(`
|
|
160
|
+
`)},{platform:"darwin",label:"macOS",hint:f("remote.ssh.macos"),command:null},{platform:"linux",label:"Linux",hint:f("remote.ssh.linux"),command:["sudo apt install openssh-server","sudo systemctl enable --now ssh"].join(`
|
|
161
|
+
`)}]}function sN(t){return t==="win32"||t==="darwin"?t:"linux"}function Ia(t){return t!==null&&t.state==="active"}function fg(t){return t!==null&&t.state==="active"&&t.devices.length>0}const Ji=function(t,e){let a=t;const y=Zo[e];let v=null,o=0,c=null;const m=[],w={},d=function(S,x){o=a*4+17,v=(function(R){const I=new Array(R);for(let D=0;D<R;D+=1){I[D]=new Array(R);for(let P=0;P<R;P+=1)I[D][P]=null}return I})(o),k(0,0),k(o-7,0),k(0,o-7),b(),M(),_(S,x),a>=7&&h(S),c==null&&(c=T(a,y,m)),g(c,x)},k=function(S,x){for(let R=-1;R<=7;R+=1)if(!(S+R<=-1||o<=S+R))for(let I=-1;I<=7;I+=1)x+I<=-1||o<=x+I||(0<=R&&R<=6&&(I==0||I==6)||0<=I&&I<=6&&(R==0||R==6)||2<=R&&R<=4&&2<=I&&I<=4?v[S+R][x+I]=!0:v[S+R][x+I]=!1)},L=function(){let S=0,x=0;for(let R=0;R<8;R+=1){d(!0,R);const I=ys.getLostPoint(w);(R==0||S>I)&&(S=I,x=R)}return x},M=function(){for(let S=8;S<o-8;S+=1)v[S][6]==null&&(v[S][6]=S%2==0);for(let S=8;S<o-8;S+=1)v[6][S]==null&&(v[6][S]=S%2==0)},b=function(){const S=ys.getPatternPosition(a);for(let x=0;x<S.length;x+=1)for(let R=0;R<S.length;R+=1){const I=S[x],D=S[R];if(v[I][D]==null)for(let P=-2;P<=2;P+=1)for(let F=-2;F<=2;F+=1)P==-2||P==2||F==-2||F==2||P==0&&F==0?v[I+P][D+F]=!0:v[I+P][D+F]=!1}},h=function(S){const x=ys.getBCHTypeNumber(a);for(let R=0;R<18;R+=1){const I=!S&&(x>>R&1)==1;v[Math.floor(R/3)][R%3+o-8-3]=I}for(let R=0;R<18;R+=1){const I=!S&&(x>>R&1)==1;v[R%3+o-8-3][Math.floor(R/3)]=I}},_=function(S,x){const R=y<<3|x,I=ys.getBCHTypeInfo(R);for(let D=0;D<15;D+=1){const P=!S&&(I>>D&1)==1;D<6?v[D][8]=P:D<8?v[D+1][8]=P:v[o-15+D][8]=P}for(let D=0;D<15;D+=1){const P=!S&&(I>>D&1)==1;D<8?v[8][o-D-1]=P:D<9?v[8][15-D-1+1]=P:v[8][15-D-1]=P}v[o-8][8]=!S},g=function(S,x){let R=-1,I=o-1,D=7,P=0;const F=ys.getMaskFunction(x);for(let z=o-1;z>0;z-=2)for(z==6&&(z-=1);;){for(let q=0;q<2;q+=1)if(v[I][z-q]==null){let K=!1;P<S.length&&(K=(S[P]>>>D&1)==1),F(I,z-q)&&(K=!K),v[I][z-q]=K,D-=1,D==-1&&(P+=1,D=7)}if(I+=R,I<0||o<=I){I-=R,R=-R;break}}},p=function(S,x){let R=0,I=0,D=0;const P=new Array(x.length),F=new Array(x.length);for(let V=0;V<x.length;V+=1){const W=x[V].dataCount,O=x[V].totalCount-W;I=Math.max(I,W),D=Math.max(D,O),P[V]=new Array(W);for(let Z=0;Z<P[V].length;Z+=1)P[V][Z]=255&S.getBuffer()[Z+R];R+=W;const U=ys.getErrorCorrectPolynomial(O),$=ll(P[V],U.getLength()-1).mod(U);F[V]=new Array(U.getLength()-1);for(let Z=0;Z<F[V].length;Z+=1){const re=Z+$.getLength()-F[V].length;F[V][Z]=re>=0?$.getAt(re):0}}let z=0;for(let V=0;V<x.length;V+=1)z+=x[V].totalCount;const q=new Array(z);let K=0;for(let V=0;V<I;V+=1)for(let W=0;W<x.length;W+=1)V<P[W].length&&(q[K]=P[W][V],K+=1);for(let V=0;V<D;V+=1)for(let W=0;W<x.length;W+=1)V<F[W].length&&(q[K]=F[W][V],K+=1);return q},T=function(S,x,R){const I=pg.getRSBlocks(S,x),D=mg();for(let F=0;F<R.length;F+=1){const z=R[F];D.put(z.getMode(),4),D.put(z.getLength(),ys.getLengthInBits(z.getMode(),S)),z.write(D)}let P=0;for(let F=0;F<I.length;F+=1)P+=I[F].dataCount;if(D.getLengthInBits()>P*8)throw"code length overflow. ("+D.getLengthInBits()+">"+P*8+")";for(D.getLengthInBits()+4<=P*8&&D.put(0,4);D.getLengthInBits()%8!=0;)D.putBit(!1);for(;!(D.getLengthInBits()>=P*8||(D.put(236,8),D.getLengthInBits()>=P*8));)D.put(17,8);return p(D,I)};w.addData=function(S,x){x=x||"Byte";let R=null;switch(x){case"Numeric":R=iN(S);break;case"Alphanumeric":R=oN(S);break;case"Byte":R=lN(S);break;case"Kanji":R=aN(S);break;default:throw"mode:"+x}m.push(R),c=null},w.isDark=function(S,x){if(S<0||o<=S||x<0||o<=x)throw S+","+x;return v[S][x]},w.getModuleCount=function(){return o},w.make=function(){if(a<1){let S=1;for(;S<40;S++){const x=pg.getRSBlocks(S,y),R=mg();for(let D=0;D<m.length;D++){const P=m[D];R.put(P.getMode(),4),R.put(P.getLength(),ys.getLengthInBits(P.getMode(),S)),P.write(R)}let I=0;for(let D=0;D<x.length;D++)I+=x[D].dataCount;if(R.getLengthInBits()<=I*8)break}a=S}d(!1,L())},w.createTableTag=function(S,x){S=S||2,x=typeof x>"u"?S*4:x;let R="";R+='<table style="',R+=" border-width: 0px; border-style: none;",R+=" border-collapse: collapse;",R+=" padding: 0px; margin: "+x+"px;",R+='">',R+="<tbody>";for(let I=0;I<w.getModuleCount();I+=1){R+="<tr>";for(let D=0;D<w.getModuleCount();D+=1)R+='<td style="',R+=" border-width: 0px; border-style: none;",R+=" border-collapse: collapse;",R+=" padding: 0px; margin: 0px;",R+=" width: "+S+"px;",R+=" height: "+S+"px;",R+=" background-color: ",R+=w.isDark(I,D)?"#000000":"#ffffff",R+=";",R+='"/>';R+="</tr>"}return R+="</tbody>",R+="</table>",R},w.createSvgTag=function(S,x,R,I){let D={};typeof arguments[0]=="object"&&(D=arguments[0],S=D.cellSize,x=D.margin,R=D.alt,I=D.title),S=S||2,x=typeof x>"u"?S*4:x,R=typeof R=="string"?{text:R}:R||{},R.text=R.text||null,R.id=R.text?R.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 P=w.getModuleCount()*S+x*2;let F,z,q,K,V="",W;for(W="l"+S+",0 0,"+S+" -"+S+",0 0,-"+S+"z ",V+='<svg version="1.1" xmlns="http://www.w3.org/2000/svg"',V+=D.scalable?"":' width="'+P+'px" height="'+P+'px"',V+=' viewBox="0 0 '+P+" "+P+'" ',V+=' preserveAspectRatio="xMinYMin meet"',V+=I.text||R.text?' role="img" aria-labelledby="'+A([I.id,R.id].join(" ").trim())+'"':"",V+=">",V+=I.text?'<title id="'+A(I.id)+'">'+A(I.text)+"</title>":"",V+=R.text?'<description id="'+A(R.id)+'">'+A(R.text)+"</description>":"",V+='<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>',V+='<path d="',q=0;q<w.getModuleCount();q+=1)for(K=q*S+x,F=0;F<w.getModuleCount();F+=1)w.isDark(q,F)&&(z=F*S+x,V+="M"+z+","+K+W);return V+='" stroke="transparent" fill="black"/>',V+="</svg>",V},w.createDataURL=function(S,x){S=S||2,x=typeof x>"u"?S*4:x;const R=w.getModuleCount()*S+x*2,I=x,D=R-x;return hN(R,R,function(P,F){if(I<=P&&P<D&&I<=F&&F<D){const z=Math.floor((P-I)/S),q=Math.floor((F-I)/S);return w.isDark(q,z)?0:1}else return 1})},w.createImgTag=function(S,x,R){S=S||2,x=typeof x>"u"?S*4:x;const I=w.getModuleCount()*S+x*2;let D="";return D+="<img",D+=' src="',D+=w.createDataURL(S,x),D+='"',D+=' width="',D+=I,D+='"',D+=' height="',D+=I,D+='"',R&&(D+=' alt="',D+=A(R),D+='"'),D+="/>",D};const A=function(S){let x="";for(let R=0;R<S.length;R+=1){const I=S.charAt(R);switch(I){case"<":x+="<";break;case">":x+=">";break;case"&":x+="&";break;case'"':x+=""";break;default:x+=I;break}}return x},E=function(S){S=typeof S>"u"?2:S;const R=w.getModuleCount()*1+S*2,I=S,D=R-S;let P,F,z,q,K;const V={"██":"█","█ ":"▀"," █":"▄"," ":" "},W={"██":"▀","█ ":"▀"," █":" "," ":" "};let O="";for(P=0;P<R;P+=2){for(z=Math.floor((P-I)/1),q=Math.floor((P+1-I)/1),F=0;F<R;F+=1)K="█",I<=F&&F<D&&I<=P&&P<D&&w.isDark(z,Math.floor((F-I)/1))&&(K=" "),I<=F&&F<D&&I<=P+1&&P+1<D&&w.isDark(q,Math.floor((F-I)/1))?K+=" ":K+="█",O+=S<1&&P+1>=D?W[K]:V[K];O+=`
|
|
162
|
+
`}return R%2&&S>0?O.substring(0,O.length-R-1)+Array(R+1).join("▀"):O.substring(0,O.length-1)};return w.createASCII=function(S,x){if(S=S||1,S<2)return E(x);S-=1,x=typeof x>"u"?S*2:x;const R=w.getModuleCount()*S+x*2,I=x,D=R-x;let P,F,z,q;const K=Array(S+1).join("██"),V=Array(S+1).join(" ");let W="",O="";for(P=0;P<R;P+=1){for(z=Math.floor((P-I)/S),O="",F=0;F<R;F+=1)q=1,I<=F&&F<D&&I<=P&&P<D&&w.isDark(z,Math.floor((F-I)/S))&&(q=0),O+=q?K:V;for(z=0;z<S;z+=1)W+=O+`
|
|
163
|
+
`}return W.substring(0,W.length-1)},w.renderTo2dContext=function(S,x){x=x||2;const R=w.getModuleCount();for(let I=0;I<R;I++)for(let D=0;D<R;D++)S.fillStyle=w.isDark(I,D)?"black":"white",S.fillRect(D*x,I*x,x,x)},w};Ji.stringToBytes=function(t){const e=[];for(let r=0;r<t.length;r+=1){const l=t.charCodeAt(r);e.push(l&255)}return e};Ji.createStringToBytes=function(t,e){const r=(function(){const a=uN(t),y=function(){const c=a.read();if(c==-1)throw"eof";return c};let v=0;const o={};for(;;){const c=a.read();if(c==-1)break;const m=y(),w=y(),d=y(),k=String.fromCharCode(c<<8|m),L=w<<8|d;o[k]=L,v+=1}if(v!=e)throw v+" != "+e;return o})(),l=63;return function(a){const y=[];for(let v=0;v<a.length;v+=1){const o=a.charCodeAt(v);if(o<128)y.push(o);else{const c=r[a.charAt(v)];typeof c=="number"?(c&255)==c?y.push(c):(y.push(c>>>8),y.push(c&255)):y.push(l)}}return y}};const xn={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},Zo={L:1,M:0,Q:3,H:2},bs={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},ys=(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,r=7973,l=21522,a={},y=function(v){let o=0;for(;v!=0;)o+=1,v>>>=1;return o};return a.getBCHTypeInfo=function(v){let o=v<<10;for(;y(o)-y(e)>=0;)o^=e<<y(o)-y(e);return(v<<10|o)^l},a.getBCHTypeNumber=function(v){let o=v<<12;for(;y(o)-y(r)>=0;)o^=r<<y(o)-y(r);return v<<12|o},a.getPatternPosition=function(v){return t[v-1]},a.getMaskFunction=function(v){switch(v){case bs.PATTERN000:return function(o,c){return(o+c)%2==0};case bs.PATTERN001:return function(o,c){return o%2==0};case bs.PATTERN010:return function(o,c){return c%3==0};case bs.PATTERN011:return function(o,c){return(o+c)%3==0};case bs.PATTERN100:return function(o,c){return(Math.floor(o/2)+Math.floor(c/3))%2==0};case bs.PATTERN101:return function(o,c){return o*c%2+o*c%3==0};case bs.PATTERN110:return function(o,c){return(o*c%2+o*c%3)%2==0};case bs.PATTERN111:return function(o,c){return(o*c%3+(o+c)%2)%2==0};default:throw"bad maskPattern:"+v}},a.getErrorCorrectPolynomial=function(v){let o=ll([1],0);for(let c=0;c<v;c+=1)o=o.multiply(ll([1,Cs.gexp(c)],0));return o},a.getLengthInBits=function(v,o){if(1<=o&&o<10)switch(v){case xn.MODE_NUMBER:return 10;case xn.MODE_ALPHA_NUM:return 9;case xn.MODE_8BIT_BYTE:return 8;case xn.MODE_KANJI:return 8;default:throw"mode:"+v}else if(o<27)switch(v){case xn.MODE_NUMBER:return 12;case xn.MODE_ALPHA_NUM:return 11;case xn.MODE_8BIT_BYTE:return 16;case xn.MODE_KANJI:return 10;default:throw"mode:"+v}else if(o<41)switch(v){case xn.MODE_NUMBER:return 14;case xn.MODE_ALPHA_NUM:return 13;case xn.MODE_8BIT_BYTE:return 16;case xn.MODE_KANJI:return 12;default:throw"mode:"+v}else throw"type:"+o},a.getLostPoint=function(v){const o=v.getModuleCount();let c=0;for(let d=0;d<o;d+=1)for(let k=0;k<o;k+=1){let L=0;const M=v.isDark(d,k);for(let b=-1;b<=1;b+=1)if(!(d+b<0||o<=d+b))for(let h=-1;h<=1;h+=1)k+h<0||o<=k+h||b==0&&h==0||M==v.isDark(d+b,k+h)&&(L+=1);L>5&&(c+=3+L-5)}for(let d=0;d<o-1;d+=1)for(let k=0;k<o-1;k+=1){let L=0;v.isDark(d,k)&&(L+=1),v.isDark(d+1,k)&&(L+=1),v.isDark(d,k+1)&&(L+=1),v.isDark(d+1,k+1)&&(L+=1),(L==0||L==4)&&(c+=3)}for(let d=0;d<o;d+=1)for(let k=0;k<o-6;k+=1)v.isDark(d,k)&&!v.isDark(d,k+1)&&v.isDark(d,k+2)&&v.isDark(d,k+3)&&v.isDark(d,k+4)&&!v.isDark(d,k+5)&&v.isDark(d,k+6)&&(c+=40);for(let d=0;d<o;d+=1)for(let k=0;k<o-6;k+=1)v.isDark(k,d)&&!v.isDark(k+1,d)&&v.isDark(k+2,d)&&v.isDark(k+3,d)&&v.isDark(k+4,d)&&!v.isDark(k+5,d)&&v.isDark(k+6,d)&&(c+=40);let m=0;for(let d=0;d<o;d+=1)for(let k=0;k<o;k+=1)v.isDark(k,d)&&(m+=1);const w=Math.abs(100*m/o/o-50)/5;return c+=w*10,c},a})(),Cs=(function(){const t=new Array(256),e=new Array(256);for(let l=0;l<8;l+=1)t[l]=1<<l;for(let l=8;l<256;l+=1)t[l]=t[l-4]^t[l-5]^t[l-6]^t[l-8];for(let l=0;l<255;l+=1)e[t[l]]=l;const r={};return r.glog=function(l){if(l<1)throw"glog("+l+")";return e[l]},r.gexp=function(l){for(;l<0;)l+=255;for(;l>=256;)l-=255;return t[l]},r})(),ll=function(t,e){if(typeof t.length>"u")throw t.length+"/"+e;const r=(function(){let a=0;for(;a<t.length&&t[a]==0;)a+=1;const y=new Array(t.length-a+e);for(let v=0;v<t.length-a;v+=1)y[v]=t[v+a];return y})(),l={};return l.getAt=function(a){return r[a]},l.getLength=function(){return r.length},l.multiply=function(a){const y=new Array(l.getLength()+a.getLength()-1);for(let v=0;v<l.getLength();v+=1)for(let o=0;o<a.getLength();o+=1)y[v+o]^=Cs.gexp(Cs.glog(l.getAt(v))+Cs.glog(a.getAt(o)));return ll(y,0)},l.mod=function(a){if(l.getLength()-a.getLength()<0)return l;const y=Cs.glog(l.getAt(0))-Cs.glog(a.getAt(0)),v=new Array(l.getLength());for(let o=0;o<l.getLength();o+=1)v[o]=l.getAt(o);for(let o=0;o<a.getLength();o+=1)v[o]^=Cs.gexp(Cs.glog(a.getAt(o))+y);return ll(v,0).mod(a)},l},pg=(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(a,y){const v={};return v.totalCount=a,v.dataCount=y,v},r={},l=function(a,y){switch(y){case Zo.L:return t[(a-1)*4+0];case Zo.M:return t[(a-1)*4+1];case Zo.Q:return t[(a-1)*4+2];case Zo.H:return t[(a-1)*4+3];default:return}};return r.getRSBlocks=function(a,y){const v=l(a,y);if(typeof v>"u")throw"bad rs block @ typeNumber:"+a+"/errorCorrectionLevel:"+y;const o=v.length/3,c=[];for(let m=0;m<o;m+=1){const w=v[m*3+0],d=v[m*3+1],k=v[m*3+2];for(let L=0;L<w;L+=1)c.push(e(d,k))}return c},r})(),mg=function(){const t=[];let e=0;const r={};return r.getBuffer=function(){return t},r.getAt=function(l){const a=Math.floor(l/8);return(t[a]>>>7-l%8&1)==1},r.put=function(l,a){for(let y=0;y<a;y+=1)r.putBit((l>>>a-y-1&1)==1)},r.getLengthInBits=function(){return e},r.putBit=function(l){const a=Math.floor(e/8);t.length<=a&&t.push(0),l&&(t[a]|=128>>>e%8),e+=1},r},iN=function(t){const e=xn.MODE_NUMBER,r=t,l={};l.getMode=function(){return e},l.getLength=function(v){return r.length},l.write=function(v){const o=r;let c=0;for(;c+2<o.length;)v.put(a(o.substring(c,c+3)),10),c+=3;c<o.length&&(o.length-c==1?v.put(a(o.substring(c,c+1)),4):o.length-c==2&&v.put(a(o.substring(c,c+2)),7))};const a=function(v){let o=0;for(let c=0;c<v.length;c+=1)o=o*10+y(v.charAt(c));return o},y=function(v){if("0"<=v&&v<="9")return v.charCodeAt(0)-48;throw"illegal char :"+v};return l},oN=function(t){const e=xn.MODE_ALPHA_NUM,r=t,l={};l.getMode=function(){return e},l.getLength=function(y){return r.length},l.write=function(y){const v=r;let o=0;for(;o+1<v.length;)y.put(a(v.charAt(o))*45+a(v.charAt(o+1)),11),o+=2;o<v.length&&y.put(a(v.charAt(o)),6)};const a=function(y){if("0"<=y&&y<="9")return y.charCodeAt(0)-48;if("A"<=y&&y<="Z")return y.charCodeAt(0)-65+10;switch(y){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 :"+y}};return l},lN=function(t){const e=xn.MODE_8BIT_BYTE,r=Ji.stringToBytes(t),l={};return l.getMode=function(){return e},l.getLength=function(a){return r.length},l.write=function(a){for(let y=0;y<r.length;y+=1)a.put(r[y],8)},l},aN=function(t){const e=xn.MODE_KANJI,r=Ji.stringToBytes;(function(y,v){const o=r(y);if(o.length!=2||(o[0]<<8|o[1])!=v)throw"sjis not supported."})("友",38726);const l=r(t),a={};return a.getMode=function(){return e},a.getLength=function(y){return~~(l.length/2)},a.write=function(y){const v=l;let o=0;for(;o+1<v.length;){let c=(255&v[o])<<8|255&v[o+1];if(33088<=c&&c<=40956)c-=33088;else if(57408<=c&&c<=60351)c-=49472;else throw"illegal char at "+(o+1)+"/"+c;c=(c>>>8&255)*192+(c&255),y.put(c,13),o+=2}if(o<v.length)throw"illegal char at "+(o+1)},a},sw=function(){const t=[],e={};return e.writeByte=function(r){t.push(r&255)},e.writeShort=function(r){e.writeByte(r),e.writeByte(r>>>8)},e.writeBytes=function(r,l,a){l=l||0,a=a||r.length;for(let y=0;y<a;y+=1)e.writeByte(r[y+l])},e.writeString=function(r){for(let l=0;l<r.length;l+=1)e.writeByte(r.charCodeAt(l))},e.toByteArray=function(){return t},e.toString=function(){let r="";r+="[";for(let l=0;l<t.length;l+=1)l>0&&(r+=","),r+=t[l];return r+="]",r},e},cN=function(){let t=0,e=0,r=0,l="";const a={},y=function(o){l+=String.fromCharCode(v(o&63))},v=function(o){if(o<0)throw"n:"+o;if(o<26)return 65+o;if(o<52)return 97+(o-26);if(o<62)return 48+(o-52);if(o==62)return 43;if(o==63)return 47;throw"n:"+o};return a.writeByte=function(o){for(t=t<<8|o&255,e+=8,r+=1;e>=6;)y(t>>>e-6),e-=6},a.flush=function(){if(e>0&&(y(t<<6-e),t=0,e=0),r%3!=0){const o=3-r%3;for(let c=0;c<o;c+=1)l+="="}},a.toString=function(){return l},a},uN=function(t){const e=t;let r=0,l=0,a=0;const y={};y.read=function(){for(;a<8;){if(r>=e.length){if(a==0)return-1;throw"unexpected end of file./"+a}const c=e.charAt(r);if(r+=1,c=="=")return a=0,-1;if(c.match(/^\s$/))continue;l=l<<6|v(c.charCodeAt(0)),a+=6}const o=l>>>a-8&255;return a-=8,o};const v=function(o){if(65<=o&&o<=90)return o-65;if(97<=o&&o<=122)return o-97+26;if(48<=o&&o<=57)return o-48+52;if(o==43)return 62;if(o==47)return 63;throw"c:"+o};return y},dN=function(t,e){const r=t,l=e,a=new Array(t*e),y={};y.setPixel=function(m,w,d){a[w*r+m]=d},y.write=function(m){m.writeString("GIF87a"),m.writeShort(r),m.writeShort(l),m.writeByte(128),m.writeByte(0),m.writeByte(0),m.writeByte(0),m.writeByte(0),m.writeByte(0),m.writeByte(255),m.writeByte(255),m.writeByte(255),m.writeString(","),m.writeShort(0),m.writeShort(0),m.writeShort(r),m.writeShort(l),m.writeByte(0);const w=2,d=o(w);m.writeByte(w);let k=0;for(;d.length-k>255;)m.writeByte(255),m.writeBytes(d,k,255),k+=255;m.writeByte(d.length-k),m.writeBytes(d,k,d.length-k),m.writeByte(0),m.writeString(";")};const v=function(m){const w=m;let d=0,k=0;const L={};return L.write=function(M,b){if(M>>>b)throw"length over";for(;d+b>=8;)w.writeByte(255&(M<<d|k)),b-=8-d,M>>>=8-d,k=0,d=0;k=M<<d|k,d=d+b},L.flush=function(){d>0&&w.writeByte(k)},L},o=function(m){const w=1<<m,d=(1<<m)+1;let k=m+1;const L=c();for(let g=0;g<w;g+=1)L.add(String.fromCharCode(g));L.add(String.fromCharCode(w)),L.add(String.fromCharCode(d));const M=sw(),b=v(M);b.write(w,k);let h=0,_=String.fromCharCode(a[h]);for(h+=1;h<a.length;){const g=String.fromCharCode(a[h]);h+=1,L.contains(_+g)?_=_+g:(b.write(L.indexOf(_),k),L.size()<4095&&(L.size()==1<<k&&(k+=1),L.add(_+g)),_=g)}return b.write(L.indexOf(_),k),b.write(d,k),b.flush(),M.toByteArray()},c=function(){const m={};let w=0;const d={};return d.add=function(k){if(d.contains(k))throw"dup key:"+k;m[k]=w,w+=1},d.size=function(){return w},d.indexOf=function(k){return m[k]},d.contains=function(k){return typeof m[k]<"u"},d};return y},hN=function(t,e,r){const l=dN(t,e);for(let o=0;o<e;o+=1)for(let c=0;c<t;c+=1)l.setPixel(c,o,r(c,o));const a=sw();l.write(a);const y=cN(),v=a.toByteArray();for(let o=0;o<v.length;o+=1)y.writeByte(v[o]);return y.flush(),"data:image/gif;base64,"+y};Ji.stringToBytes;const Go=4;function fN(t){const e=Ji(0,"M");e.addData(t,"Byte"),e.make();const r=e.getModuleCount();let l="";for(let a=0;a<r;a++){let y=0;for(;y<r;){if(!e.isDark(a,y)){y++;continue}const v=y;for(;y<r&&e.isDark(a,y);)y++;l+=`M${v} ${a}h${y-v}v1h-${y-v}z`}}return{size:r,path:l}}const pN=1e3,mN=4e3;function gN({status:t,pairing:e,phonePairing:r,phoneStarted:l,problem:a,platform:y,onSetEnabled:v,onSetPort:o,onStartPairing:c,onCancelPairing:m,onStartPhonePairing:w,onCancelPhonePairing:d,onRenameDevice:k,onRevokeDevice:L,onDismissProblem:M,onClose:b}){const[h,_]=N.useState(()=>ug(t.hostNames)),[g,p]=N.useState(String(t.port)),[T,A]=N.useState(null),E=N.useRef(null),[S,x]=N.useState(()=>Date.now()),R=()=>{e!==null&&m(),l&&d(),b()},I=N.useRef(R);I.current=R,N.useEffect(()=>{const O=U=>{U.key==="Escape"&&(U.preventDefault(),U.stopPropagation(),I.current())};return window.addEventListener("keydown",O,!0),()=>window.removeEventListener("keydown",O,!0)},[]),N.useEffect(()=>{if(e===null&&r===null)return;x(Date.now());const O=window.setInterval(()=>x(Date.now()),1e3);return()=>window.clearInterval(O)},[e,r]),N.useEffect(()=>()=>{E.current!==null&&window.clearTimeout(E.current)},[]);const D=N.useRef(null),P=r!==null;N.useEffect(()=>{var U;if(!P)return;const O=window.matchMedia("(prefers-reduced-motion: reduce)").matches;(U=D.current)==null||U.scrollIntoView({block:"center",behavior:O?"auto":"smooth"})},[P]),N.useEffect(()=>{p(String(t.port))},[t.port]),N.useEffect(()=>{t.hostNames.includes(h)||_(ug(t.hostNames))},[t.hostNames,h]);const F=(O,U)=>{navigator.clipboard.writeText(U).then(()=>{A(O),E.current!==null&&window.clearTimeout(E.current),E.current=window.setTimeout(()=>A(null),pN)}).catch(()=>A(null))},z=J2(g),q=z!==null&&z!==t.port,K=X2(t,h),V=f("remote.title"),W=e===null?null:Q2(t.port,e.code);return i.jsx("div",{className:"modal-backdrop",onClick:R,children:i.jsxs("div",{className:"modal",role:"dialog","aria-label":V,onClick:O=>O.stopPropagation(),children:[i.jsxs("header",{className:"modal-header",children:[i.jsx("span",{className:"modal-title",children:V}),i.jsx("button",{className:"icon-button",onClick:R,title:f("common.close"),children:"×"})]}),i.jsxs("div",{className:"modal-body",children:[i.jsx("p",{className:`status-line-state${t.state==="active"?" status-line-state-active":""}`,children:$d(t.state,t.port)}),i.jsx("p",{className:"modal-hint",children:f("remote.intro")}),i.jsx("div",{className:"vault-actions",children:t.enabled?i.jsxs(i.Fragment,{children:[i.jsx("button",{className:"link-button",onClick:()=>v(!1),children:f("remote.turnOff")}),i.jsx("span",{className:"modal-hint",children:f("remote.turnOffHint")})]}):i.jsx("button",{className:"primary-button",onClick:()=>v(!0),children:f("remote.turnOn")})}),i.jsxs("div",{className:"remote-port",children:[i.jsx("label",{className:"modal-hint",htmlFor:"remote-port-input",children:f("remote.port")}),i.jsx("input",{id:"remote-port-input",className:"remote-port-input",inputMode:"numeric",value:g,onChange:O=>p(O.target.value),onKeyDown:O=>{O.key==="Enter"&&q&&z!==null&&o(z)}}),i.jsx("button",{className:"link-button",onClick:()=>z!==null&&o(z),disabled:!q,children:f("remote.portSave")}),z===null&&i.jsx("span",{className:"modal-hint remote-port-invalid",children:Z2()})]}),i.jsx("p",{className:"modal-hint",children:f("remote.restartHint")}),a!==null&&i.jsxs("div",{className:"vault-problem",role:"alert",children:[i.jsx("span",{children:a}),i.jsx("button",{className:"icon-button",onClick:M,title:f("common.close"),children:"×"})]}),i.jsx("h3",{className:"modal-section",children:f("remote.step.host")}),i.jsx("p",{className:"modal-hint",children:f("remote.step.hostHint")}),rN().map(O=>i.jsxs("details",{className:"remote-os",open:O.platform===sN(y),children:[i.jsx("summary",{className:"remote-os-summary",children:O.label}),i.jsx("p",{className:"modal-hint",children:O.hint}),O.command!==null&&i.jsxs("div",{className:"status-line-fragment",children:[i.jsx("pre",{className:"tool-pre",children:O.command}),i.jsx("button",{className:"link-button",onClick:()=>F("ssh",O.command??""),children:T==="ssh"?i.jsxs(i.Fragment,{children:["✓ ",f("remote.copied")]}):f("remote.copy")})]})]},O.platform)),i.jsx("h3",{className:"modal-section",children:f("remote.step.tunnel")}),i.jsx("p",{className:"modal-hint",children:f("remote.step.tunnelHint")}),t.hostNames.length>1&&i.jsxs("div",{className:"remote-port",children:[i.jsx("label",{className:"modal-hint",htmlFor:"remote-host-select",children:f("remote.address")}),i.jsx("select",{id:"remote-host-select",className:"remote-host-select",value:h,onChange:O=>_(O.target.value),children:t.hostNames.map(O=>i.jsx("option",{value:O,children:O},O))})]}),i.jsxs("div",{className:"status-line-fragment",children:[i.jsx("pre",{className:"tool-pre",children:K}),i.jsx("button",{className:"link-button",onClick:()=>F("command",K),children:T==="command"?i.jsxs(i.Fragment,{children:["✓ ",f("remote.copied")]}):f("remote.copy")})]}),i.jsxs("details",{className:"remote-os",children:[i.jsx("summary",{className:"remote-os-summary",children:f("remote.trouble")}),i.jsxs("ul",{className:"remote-trouble",children:[i.jsx("li",{className:"modal-hint",children:f("remote.trouble.network")}),i.jsx("li",{className:"modal-hint",children:f("remote.vpnHint")}),t.sshUser.length>0&&i.jsx("li",{className:"modal-hint",children:f("remote.userHint",{user:t.sshUser})})]})]}),i.jsx("h3",{className:"modal-section",children:f("remote.step.pair")}),e===null||W===null?i.jsxs("div",{className:"vault-actions",children:[i.jsx("button",{className:"primary-button",onClick:c,disabled:!Ia(t),children:f("remote.pair.start")}),!Ia(t)&&i.jsx("span",{className:"modal-hint",children:f("remote.pair.needsActive")})]}):i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"modal-hint",children:f("remote.pair.open")}),i.jsxs("div",{className:"status-line-fragment",children:[i.jsx("pre",{className:"tool-pre",children:W}),i.jsx("button",{className:"link-button",onClick:()=>F("pairing",W),children:T==="pairing"?i.jsxs(i.Fragment,{children:["✓ ",f("remote.copied")]}):f("remote.copy")})]}),i.jsxs("p",{className:"modal-hint",children:[f("remote.pair.expires",{time:hg(dg(e.expiresAt,S))})," ",f("remote.pair.after",{url:rw(t.port)})]}),i.jsx("div",{className:"vault-actions",children:i.jsx("button",{className:"link-button",onClick:m,children:f("remote.pair.cancel")})})]}),i.jsx("h3",{className:"modal-section",children:f("remote.phone.title")}),r===null?i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"modal-hint",children:f("remote.phone.hint")}),i.jsxs("div",{className:"vault-actions",children:[i.jsx("button",{className:"primary-button",onClick:w,disabled:!Ia(t),children:f("remote.phone.start")}),!Ia(t)&&i.jsx("span",{className:"modal-hint",children:f("remote.pair.needsActive")})]})]}):i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"modal-hint",children:nN(r.shell)}),i.jsxs("div",{className:"status-line-fragment",children:[i.jsx("pre",{className:"tool-pre remote-phone-command",children:r.authorizeCommand}),i.jsx("button",{className:"link-button",onClick:()=>F("phone",r.authorizeCommand),children:T==="phone"?i.jsxs(i.Fragment,{children:["✓ ",f("remote.copied")]}):f("remote.copy")})]}),i.jsx("p",{className:"modal-hint",children:f("remote.phone.authorizeOnce")}),i.jsx("p",{className:"modal-hint",children:f("remote.phone.scan")}),i.jsx("div",{ref:D,children:i.jsx(vN,{payload:r.payload})}),i.jsx("p",{className:"modal-hint",children:f("remote.phone.secret")}),i.jsx("p",{className:"modal-hint",children:f("remote.pair.expires",{time:hg(dg(r.expiresAt,S))})}),i.jsx("div",{className:"vault-actions",children:i.jsx("button",{className:"link-button",onClick:d,children:f("remote.pair.cancel")})})]}),i.jsx("h3",{className:"modal-section",children:f("remote.devices")}),t.devices.length===0?i.jsx("p",{className:"modal-hint",children:f("remote.devices.empty")}):i.jsx("ul",{className:"remote-devices",children:t.devices.map(O=>i.jsx(_N,{device:O,onRename:U=>k(O.id,U),onRevoke:()=>L(O.id)},O.id))})]})]})})}function vN({payload:t}){const e=fN(t),r=e.size+Go*2;return i.jsxs("svg",{className:"remote-phone-qr",viewBox:`${-Go} ${-Go} ${r} ${r}`,role:"img","aria-label":f("remote.phone.qrLabel"),shapeRendering:"crispEdges",children:[i.jsx("rect",{x:-Go,y:-Go,width:r,height:r,fill:"#fff"}),i.jsx("path",{d:e.path,fill:"#000"})]})}function _N({device:t,onRename:e,onRevoke:r}){const[l,a]=N.useState(!1),[y,v]=N.useState(t.label),[o,c]=N.useState(!1),m=N.useRef(null);N.useEffect(()=>()=>{m.current!==null&&window.clearTimeout(m.current)},[]);const w=()=>{a(!1);const k=y.trim();k.length>0&&k!==t.label&&e(k)},d=()=>{if(o){r();return}c(!0),m.current=window.setTimeout(()=>c(!1),mN)};return i.jsxs("li",{className:"remote-device",children:[i.jsxs("div",{className:"remote-device-main",children:[l?i.jsx("input",{className:"remote-device-input",value:y,autoFocus:!0,onChange:k=>v(k.target.value),onBlur:w,onKeyDown:k=>{k.key==="Enter"&&w()}}):i.jsx("button",{className:"remote-device-label",onClick:()=>{v(t.label),a(!0)},title:f("remote.device.rename"),children:t.label}),i.jsx("span",{className:`remote-device-seen${t.connected?" remote-device-connected":""}`,children:eN(t)}),i.jsx("span",{className:"remote-device-paired",children:tN(t)})]}),i.jsx("button",{className:`link-button${o?" remote-device-confirm":""}`,onClick:d,children:f(o?"remote.device.revokeConfirm":"remote.device.revoke")})]})}const od="agent-workbench.notes-open",gg="agent-workbench.notes-active",vg="agent-workbench.notes-height",ld=160,wN=300;function bN(t){var e,r,l;return t.text.trim().length===0?(((e=t.files)==null?void 0:e.length)??0)>0?((l=(r=t.files)==null?void 0:r[0])==null?void 0:l.name)??f("notes.fileOnly"):t.images.length>0?f("notes.imageOnly"):f("notes.untitled"):M0(t)}function yN({notes:t,onSendNote:e,sendTargetCwd:r,onNoteToComposer:l,composerTarget:a,fill:y,onHide:v}){const[o,c]=N.useState(()=>Wt(od,!1,V=>V==="true")),m=o||y,[w,d]=N.useState(()=>Wt(vg,wN,V=>{const W=Number.parseInt(V,10);return Number.isFinite(W)?Math.max(W,ld):null})),[k,L]=N.useState(()=>Wt(gg,null,V=>V)),[M,b]=N.useState(null),[h,_]=N.useState(null),[g,p]=N.useState(0),T=q2(),A=N.useMemo(()=>t.notes.length===0?null:t.notes.find(V=>V.noteId===k)??t.notes[t.notes.length-1]??null,[t.notes,k]),E=N.useCallback(V=>{L(V),jt(gg,V),b(null)},[]),S=N.useCallback(()=>{c(V=>{const W=!V;return jt(od,String(W)),W})},[]),x=N.useCallback(()=>{const V=t.create();E(V),m||(c(!0),jt(od,"true")),p(W=>W+1)},[t,m,E]),R=N.useCallback(V=>{var W;if(V.text.trim().length===0&&V.images.length===0&&(((W=V.files)==null?void 0:W.length)??0)===0){t.remove(V.noteId);return}E(V.noteId),b(V.noteId)},[t,E]),I=N.useCallback(()=>{M!==null&&t.remove(M),b(null)},[M,t]),D=N.useRef(null),P=N.useCallback(V=>{const W=V.currentTarget.parentElement,O=W===null?w:Math.round(W.getBoundingClientRect().height);D.current={startY:V.clientY,startHeight:O},V.currentTarget.setPointerCapture(V.pointerId),V.preventDefault()},[w]),F=N.useCallback(V=>{const W=D.current;if(W===null)return;const O=Math.max(ld,Math.floor(window.innerHeight*.8));d(Math.min(O,Math.max(ld,W.startHeight+W.startY-V.clientY)))},[]),z=N.useCallback(V=>{D.current!==null&&(D.current=null,V.currentTarget.releasePointerCapture(V.pointerId),jt(vg,String(w)))},[w]);N.useEffect(()=>{if(h===null)return;const V=W=>{W.key==="Escape"&&(W.stopPropagation(),_(null))};return window.addEventListener("keydown",V,!0),()=>window.removeEventListener("keydown",V,!0)},[h]);const q=h===null?void 0:t.images[h],K=t.notes.length;return i.jsxs("section",{className:`notes${m?" notes-open":""}${y?" notes-fill":""}`,style:m&&!y?{height:`${w}px`}:void 0,children:[m&&!y&&i.jsx("div",{className:"notes-resize",onPointerDown:P,onPointerMove:F,onPointerUp:z,onPointerCancel:z,title:f("notes.resize")}),m?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"notes-header",children:[i.jsxs("div",{className:"strip-tabs",role:"tablist",children:[t.notes.map(V=>{const W=V.noteId===(A==null?void 0:A.noteId),O=bN(V);return i.jsxs("div",{className:`strip-tab${W?" is-active":""}`,role:"tab","aria-selected":W,children:[i.jsx("button",{className:"strip-tab-label",onClick:()=>E(V.noteId),title:O,children:O}),i.jsx("button",{className:"strip-tab-close",onClick:()=>R(V),title:f("notes.closeNote"),children:"×"})]},V.noteId)}),i.jsx("button",{className:"strip-tab-new",onClick:x,title:f("notes.new"),children:"+"})]}),i.jsx("span",{className:"strip-spacer"}),i.jsx("button",{className:"icon-button thread-font-button",onClick:T.cycle,title:Wa(T.size),"aria-label":Wa(T.size),children:i.jsxs("span",{"aria-hidden":"true",children:["a",i.jsx("span",{className:"thread-font-big",children:"A"})]})}),!y&&i.jsx("button",{className:"icon-button",onClick:S,title:f("notes.collapse"),children:"▾"}),v!==void 0&&i.jsx(Ua,{title:f("settings.hide.notes"),onHide:v,confirmText:null})]}),i.jsx("div",{className:"notes-body",children:K===0||A===null?i.jsx("p",{className:"notes-empty",children:vn("notes.empty")}):i.jsx(xN,{note:A,notes:t,closing:M===A.noteId,focusRequest:g,onConfirmClose:I,onCancelClose:()=>b(null),onOpenImage:_,onSend:e===null?null:()=>e(A.noteId),sendTargetCwd:r,onToComposer:l===null?null:()=>l(A.noteId),composerTarget:a},A.noteId)})]}):i.jsxs("div",{className:"strip-collapsed-row",children:[i.jsxs("button",{className:"strip-collapsed",onClick:S,title:f("notes.expand"),children:[i.jsx("span",{className:"strip-collapsed-arrow",children:"▸"}),i.jsx("span",{children:f("notes.name")}),K>0&&i.jsx("span",{className:"strip-collapsed-count",children:K})]}),v!==void 0&&i.jsx(Ua,{title:f("settings.hide.notes"),onHide:v,confirmText:null})]}),h!==null&&i.jsx("div",{className:"notes-lightbox",onClick:()=>_(null),title:f("notes.lightboxClose"),children:typeof q=="string"?i.jsx("img",{src:q,alt:f("notes.imageAlt")}):i.jsx("span",{className:"notes-lightbox-missing",children:f("notes.imageUnavailable")})})]})}function kN(){return i.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:i.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 CN(){return i.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:[i.jsx("path",{d:"M21.5 2.5 11 13"}),i.jsx("path",{d:"M21.5 2.5 15 21.5l-4-8.5-8.5-4z"})]})}function xN({note:t,notes:e,closing:r,focusRequest:l,onConfirmClose:a,onCancelClose:y,onOpenImage:v,onSend:o,sendTargetCwd:c,onToComposer:m,composerTarget:w}){var A,E;const d=N.useRef(null),[k,L]=N.useState(!1),[M,b]=N.useState(!1),h=t.text.trim().length===0&&t.images.length===0&&(((A=t.files)==null?void 0:A.length)??0)===0,_=Qx(t.images,e.images);N.useEffect(()=>{var S;l>0&&((S=d.current)==null||S.focus())},[l]);const g=N.useCallback(S=>{for(const x of Array.from(S))["image/png","image/jpeg","image/gif","image/webp"].includes(x.type)?e.addImage(t.noteId,x):e.addFile(t.noteId,x);return S.length>0},[e,t.noteId]),p=N.useCallback(S=>{S.clipboardData!==null&&g(S.clipboardData.files)&&S.preventDefault()},[g]),T=N.useCallback(S=>{if(S.key!=="Enter"||!S.shiftKey||S.nativeEvent.isComposing)return;const x=S.currentTarget,R=Sv(x.value,x.selectionStart,x.selectionEnd);if(R===null)return;S.preventDefault(),x.setSelectionRange(R.from,R.to);let I=!1;try{I=R.text.length>0?document.execCommand("insertText",!1,R.text):document.execCommand("delete")}catch{I=!1}I||(x.setRangeText(R.text,R.from,R.to,"end"),e.updateText(t.noteId,x.value)),x.setSelectionRange(R.caret,R.caret)},[e,t.noteId]);return i.jsxs("div",{className:`note-editor${k?" note-editor-dragging":""}`,onDragOver:S=>{Array.from(S.dataTransfer.types).includes("Files")&&(S.preventDefault(),L(!0))},onDragLeave:()=>L(!1),onDrop:S=>{S.preventDefault(),L(!1),g(S.dataTransfer.files)},children:[r&&i.jsxs("div",{className:"note-closing",children:[i.jsx("span",{children:f("notes.closeConfirm")}),i.jsx("button",{className:"link-button link-danger",onClick:a,children:f("common.close")}),i.jsx("button",{className:"link-button",onClick:y,children:f("common.cancel")})]}),e.problem!==null&&i.jsxs("div",{className:"composer-problem",children:[i.jsx("span",{children:e.problem}),i.jsx("button",{className:"icon-button",onClick:e.dismissProblem,title:f("common.close"),children:"×"})]}),i.jsx("textarea",{ref:d,className:"note-input",value:t.text,placeholder:f("notes.placeholder"),onChange:S=>e.updateText(t.noteId,S.target.value),onKeyDown:T,onPaste:p,spellCheck:!1}),t.images.length>0&&i.jsx("div",{className:"note-images",children:t.images.map(S=>i.jsx(SN,{image:S,src:e.images[S.imageId],onRequest:e.requestImage,onOpen:()=>v(S.imageId),onRemove:()=>e.removeImage(t.noteId,S.imageId)},S.imageId))}),(((E=t.files)==null?void 0:E.length)??0)>0&&i.jsx("div",{className:"note-images",children:(t.files??[]).map(S=>i.jsxs("div",{className:"chip chip-text chip-file",title:`${S.name} · ${fn(S.bytes)}`,children:[i.jsxs("a",{className:"chip-toggle chip-file-label",title:f("notes.downloadFile"),href:`/api/notes/files/${encodeURIComponent(S.fileId)}?name=${encodeURIComponent(S.name)}`,download:S.name,children:[i.jsx("span",{"aria-hidden":"true",children:"↓"}),i.jsx("span",{className:"chip-file-name",children:S.name}),i.jsx("span",{className:"chip-file-size",children:fn(S.bytes)})]}),i.jsx("button",{className:"chip-remove",onClick:()=>e.removeFile(t.noteId,S.fileId),title:f("notes.removeFile"),children:"×"})]},S.fileId))}),i.jsxs("div",{className:"note-footer",children:[i.jsx("span",{className:"note-meta",children:nr(t.updatedAt)}),i.jsx("span",{className:"composer-spacer"}),i.jsx("button",{className:"link-button note-to-composer",onClick:()=>{b(!0),Promise.resolve(m==null?void 0:m()).finally(()=>b(!1))},disabled:m===null||h||!_||M,title:gC(m===null?null:w??"",h,_),children:f(M?"notes.loadingFiles":"notes.toComposer")}),i.jsx("button",{className:"icon-button",onClick:()=>o==null?void 0:o(),disabled:o===null||h,title:mC(o!==null,c,h),children:i.jsx(CN,{})}),i.jsxs("label",{className:"icon-button note-attach",title:f("notes.attach"),children:[i.jsx(kN,{}),i.jsx("input",{type:"file",multiple:!0,hidden:!0,onChange:S=>{S.target.files!==null&&g(S.target.files),S.target.value=""}})]})]})]})}function SN({image:t,src:e,onRequest:r,onOpen:l,onRemove:a}){return N.useEffect(()=>{e===void 0&&r(t.imageId)},[e,t.imageId,r]),i.jsxs("figure",{className:"chip chip-image note-thumb",title:fn(t.bytes),children:[typeof e=="string"?i.jsx("img",{src:e,alt:f("notes.imageAlt"),onClick:l}):i.jsx("span",{className:"note-thumb-placeholder",children:e===null?f("notes.thumbMissing"):"…"}),i.jsx("button",{className:"chip-remove",onClick:a,title:f("notes.removeImage"),children:"×"})]})}function iw(){const t=ul(),e=uE(),[r,l]=N.useState(null),a=N.useCallback(()=>l(null),[]),y=N.useRef(null),v=m=>{lE(m).catch(()=>{})},o=[{label:f("header.locale.auto",{name:Du[iE()]}),checked:e==="auto",onSelect:()=>v("auto")},...Qd.map(m=>({label:Du[m],lang:m,checked:e===m,onSelect:()=>v(m)}))],c=Du[t];return i.jsxs(i.Fragment,{children:[i.jsx("button",{ref:y,className:"icon-button locale-button",onClick:m=>{const w=m.currentTarget.getBoundingClientRect();l(d=>d===null?{x:w.left,y:w.bottom+4}:null)},title:e==="auto"?f("header.locale.titleAuto",{name:c}):f("header.locale.title",{name:c}),"aria-haspopup":"menu","aria-expanded":r!==null,children:Nk[t]}),r!==null&&i.jsx(Dd,{x:r.x,y:r.y,items:o,onClose:a,anchor:y.current})]})}function EN({kind:t,onKey:e}){return i.jsx("div",{className:"narrow-keys",role:"toolbar","aria-label":f("narrow.keys.label"),children:i.jsx("div",{className:"narrow-keys-grid",children:Wx(t).map((r,l)=>i.jsx("div",{className:"narrow-keys-line",children:r.map(a=>i.jsx("button",{className:a.primary===!0?"narrow-key narrow-key-primary":"narrow-key",onPointerDown:y=>y.preventDefault(),onClick:()=>e(a.data),title:f(a.titleKey,a.titleParams),children:a.label},a.id))},l))})})}function TN({banners:t,status:e,statusLabel:r,terminals:l,activeTerminalId:a,activity:y,agents:v,offerAgentChoice:o,newTabAgent:c,platform:m,canOpen:w,newTabBlockedTitle:d,onSelectTab:k,onCloseTab:L,scheduled:M,onRenameTab:b,onNewTab:h,drawer:_,drawerOpen:g,onDrawerChange:p,menu:T,view:A,views:E,onViewChange:S,badges:x,chat:R,panel:I,notes:D,console:P,onTerminalKey:F}){const[z,q]=N.useState(null),K=l.find($=>$.terminalId===a)??null,V=$=>{var Z;return((Z=v.find(re=>re.id===$.agent))==null?void 0:Z.statusLine)??null};N.useEffect(()=>{if(!g&&z===null)return;const $=Z=>{Z.key==="Escape"&&(Z.preventDefault(),Z.stopPropagation(),z!==null?q(null):p(!1))};return window.addEventListener("keydown",$,!0),()=>window.removeEventListener("keydown",$,!0)},[g,z,p]);const W=N.useRef({sheet:z,drawerOpen:g,view:A,onDrawerChange:p,onViewChange:S});W.current={sheet:z,drawerOpen:g,view:A,onDrawerChange:p,onViewChange:S},N.useEffect(()=>{const $=window;return $[om]=()=>{const Z=W.current;switch(Gx({dialogOpen:document.querySelector(".modal-backdrop")!==null,sheetOpen:Z.sheet!==null,drawerOpen:Z.drawerOpen,view:Z.view})){case"close-dialog":return window.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:!0,cancelable:!0})),!0;case"close-sheet":return q(null),!0;case"close-drawer":return Z.onDrawerChange(!1),!0;case"show-chat":return Z.onViewChange("chat"),!0;case null:return!1}},()=>{delete $[om]}},[]);const O=N.useRef(null);N.useEffect(()=>{var $;($=O.current)==null||$.scrollIntoView({block:"nearest",inline:"nearest"})},[A]);const U=$=>{const Z=$==="git"?x.changes:$==="plans"?x.plans:$==="memory"?x.memory:0;return Z>0?i.jsx("span",{className:"side-panel-badge",children:Z}):$==="cli"&&x.cliUnseen&&A!=="cli"?i.jsx("span",{className:"narrow-view-dot",title:f("panel.cliUnseen")}):null},H=A==="console"?"console":"cli";return i.jsxs(i.Fragment,{children:[i.jsxs("header",{className:"app-header narrow-header",children:[i.jsx("button",{className:"icon-button narrow-icon",onClick:()=>p(!0),title:f("narrow.projects"),"aria-label":f("narrow.projects"),children:"☰"}),i.jsxs("button",{className:"narrow-current",onClick:()=>q("tabs"),title:f("narrow.tabs.open"),children:[K===null?i.jsx("span",{className:"app-name",children:"Agent Workbench"}):i.jsxs(i.Fragment,{children:[i.jsx(dh,{terminal:K,activity:y.get(K.terminalId),statusLine:V(K)}),i.jsx("span",{className:"project-swatch",style:{background:oi(xs(K))}}),i.jsx("span",{className:"narrow-current-label",children:il(K)})]}),i.jsx("span",{className:"narrow-caret","aria-hidden":"true",children:"▾"})]}),e!=="open"&&i.jsx("span",{className:`status status-${e}`,children:r}),i.jsx("button",{className:"icon-button narrow-icon",onClick:()=>q("menu"),title:f("narrow.more"),"aria-label":f("narrow.more"),children:"⋮"})]}),t,i.jsxs("div",{className:"narrow-body",children:[i.jsx("nav",{className:"narrow-views",role:"tablist",children:E.map($=>i.jsxs("button",{ref:$===A?O:null,role:"tab","aria-selected":$===A,className:`narrow-view-tab${$===A?" narrow-view-active":""}`,onClick:()=>S($),children:[i.jsx("span",{children:f(Mx($))}),U($)]},$))}),i.jsxs("div",{className:"narrow-stack",children:[i.jsx("main",{className:`workspace narrow-pane${A==="chat"?"":" narrow-pane-veiled"}`,children:R}),I,i.jsx("div",{className:`narrow-pane${A==="notes"?"":" narrow-pane-hidden"}`,children:D}),i.jsx("div",{className:`narrow-pane${A==="console"?"":" narrow-pane-hidden"}`,children:P})]}),F!==null&&i.jsx(EN,{kind:H,onKey:F},H)]}),g&&i.jsx("div",{className:"narrow-backdrop",onClick:()=>p(!1),children:i.jsx("div",{className:"narrow-drawer",onClick:$=>$.stopPropagation(),children:_})}),z==="tabs"&&i.jsx("div",{className:"narrow-backdrop",onClick:()=>q(null),children:i.jsxs("div",{className:"narrow-sheet",role:"dialog","aria-label":f("narrow.tabs.open"),onClick:$=>$.stopPropagation(),children:[i.jsx(LN,{terminals:l,platform:m,activeTerminalId:a,activity:y,statusLineOf:V,onSelect:$=>{k($),q(null)},onClose:L,onRename:b,scheduled:M}),i.jsx(ah,{className:"narrow-sheet-new",text:f("narrow.tabs.new"),title:d??f("narrow.tabs.new"),disabled:!w||d!==null,offerAgentChoice:o,agents:v,agent:c,onOpen:$=>{h($),q(null)}})]})}),z==="menu"&&i.jsx("div",{className:"narrow-backdrop",onClick:()=>q(null),children:i.jsx("div",{className:"narrow-sheet",role:"dialog","aria-label":f("narrow.more"),onClick:$=>$.stopPropagation(),children:i.jsx(RN,{menu:T,status:e,statusLabel:r,onClose:()=>q(null)})})})]})}function LN({terminals:t,platform:e,activeTerminalId:r,activity:l,statusLineOf:a,onSelect:y,onClose:v,onRename:o,scheduled:c}){const[m,w]=N.useState(null),[d,k]=N.useState(""),L=N.useRef(null);N.useEffect(()=>{var b;m!==null&&((b=L.current)==null||b.select())},[m]);const M=()=>{m!==null&&o(m,d.trim()),w(null)};return t.length===0?i.jsx("p",{className:"narrow-sheet-empty",children:f("narrow.tabs.none")}):i.jsx("ul",{className:"narrow-tabs",children:t.map(b=>{var g;const h=m===b.terminalId,_=B_(b,t,e);return i.jsxs("li",{className:`narrow-tab-row${b.terminalId===r?" narrow-tab-active":""}`,style:{"--tab-project-color":oi(xs(b))},children:[h?i.jsx("input",{ref:L,className:"narrow-tab-input",value:d,onChange:p=>k(p.target.value),onBlur:M,onKeyDown:p=>{p.key==="Enter"&&M(),p.key==="Escape"&&(p.stopPropagation(),w(null))}}):i.jsxs("button",{className:"narrow-tab-select",onClick:()=>y(b.terminalId),children:[i.jsx(dh,{terminal:b,activity:l.get(b.terminalId),statusLine:a(b)}),b.review&&i.jsx("span",{className:"tab-review",title:f("worktree.tab.reviewTitle"),children:f("worktree.tab.review")}),_!==null&&i.jsx("span",{className:"tab-branch",children:_}),(((g=c==null?void 0:c.get(b.terminalId))==null?void 0:g.length)??0)>0&&i.jsx("span",{title:Wv((c==null?void 0:c.get(b.terminalId))??[])??void 0,children:i.jsx(q_,{messages:(c==null?void 0:c.get(b.terminalId))??[]})}),i.jsx("span",{className:"narrow-tab-label",children:il(b)})]}),i.jsx("button",{className:"icon-button",onClick:()=>{w(b.terminalId),k(b.label.length>0?b.label:il(b))},title:f("narrow.tabs.rename"),children:"✎"}),i.jsx("button",{className:"icon-button",onClick:()=>v(b.terminalId),title:f("narrow.tabs.close"),children:"×"})]},b.terminalId)})})}function NN({choice:t}){const e=[{source:"system",label:f("narrow.menu.chimeSystem")},{source:"page",label:f("narrow.menu.chimePage")}];return i.jsx("div",{className:"narrow-chime-choice",role:"group","aria-label":f("narrow.menu.sound"),children:e.map(({source:r,label:l})=>i.jsx("button",{className:`narrow-chime-option${t.source===r?" is-on":""}`,"aria-pressed":t.source===r,onClick:()=>t.setSource(r),children:l},r))})}function RN({menu:t,status:e,statusLabel:r,onClose:l}){return i.jsxs("div",{className:"narrow-menu",children:[i.jsxs("div",{className:"narrow-menu-row",children:[i.jsx("span",{className:"narrow-menu-label",children:f("narrow.menu.connection")}),i.jsx("span",{className:`status status-${e}`,children:r}),Hv(navigator.userAgent)&&i.jsxs(i.Fragment,{children:[i.jsx("a",{className:"link-button",href:Vx,onClick:l,children:f("narrow.menu.phoneAppDisconnect")}),i.jsx("a",{className:"link-button",href:Kx,onClick:l,children:f("narrow.menu.phoneAppSettings")})]})]}),t.cwd!==null&&i.jsxs("div",{className:"narrow-menu-row",children:[i.jsx("span",{className:"narrow-menu-label",children:f("narrow.menu.folder")}),i.jsx("span",{className:"narrow-menu-value",title:t.cwd,children:t.cwd})]}),t.cliVersion!==null&&i.jsxs("div",{className:"narrow-menu-row",children:[i.jsx("span",{className:"narrow-menu-label",children:f("narrow.menu.cli")}),i.jsx("span",{className:"narrow-menu-value",title:t.cliVersion,children:t.cliVersion})]}),t.remoteClient&&i.jsxs("div",{className:"narrow-menu-row",children:[i.jsx("span",{className:"narrow-menu-label",children:f("app.header.remoteBadge")}),i.jsx("span",{className:"narrow-menu-value narrow-menu-value-wrap",children:f("app.header.remoteBadgeTitle")})]}),i.jsxs("div",{className:"narrow-menu-row",children:[i.jsx("span",{className:"narrow-menu-label",children:f("narrow.menu.theme")}),i.jsx("button",{className:"icon-button",onClick:t.onCycleTheme,title:t.themeTitle,children:t.themeIcon})]}),i.jsxs("div",{className:"narrow-menu-row",children:[i.jsx("span",{className:"narrow-menu-label",children:f("narrow.menu.language")}),i.jsx(iw,{})]}),i.jsxs("div",{className:"narrow-menu-row",children:[i.jsx("span",{className:"narrow-menu-label",children:f("narrow.menu.sound")}),t.sound.phoneChime===null?i.jsx(tw,{sound:t.sound}):i.jsx(NN,{choice:t.sound.phoneChime})]}),t.sound.notify.supported&&i.jsxs("div",{className:"narrow-menu-row",children:[i.jsx("span",{className:"narrow-menu-label",children:f("narrow.menu.notifications")}),i.jsx(nw,{notify:t.sound.notify})]}),t.remote!==null&&i.jsxs("div",{className:"narrow-menu-row",children:[i.jsx("span",{className:"narrow-menu-label",children:f("app.header.remoteAccess")}),i.jsx("button",{className:`icon-button${t.remote.active?" icon-button-on":""}`,onClick:()=>{var a;l(),(a=t.remote)==null||a.onOpen()},title:t.remote.title,children:"⇄"})]}),i.jsxs("div",{className:"narrow-menu-row",children:[i.jsx("span",{className:"narrow-menu-label",children:f("narrow.menu.shortcuts")}),i.jsx("button",{className:"icon-button",onClick:()=>{l(),t.onShortcuts()},title:f("app.header.shortcuts"),children:"?"})]}),i.jsxs("div",{className:"narrow-menu-row",children:[i.jsx("span",{className:"narrow-menu-label",children:f("settings.title")}),i.jsx("button",{className:"icon-button",onClick:()=>{l(),t.onSettings()},title:f("settings.open"),"aria-label":f("settings.open"),children:"⚙"})]})]})}const MN="agent-workbench.thread-tools",AN="agent-workbench.narrow-thread-tools";function ow(t){return t?AN:MN}function IN(t){return!t}function jN(t){return t?"open":"closed"}function DN(t){return t==="open"?!0:t==="closed"?!1:null}function ad(t){return Wt(ow(t),IN(t),DN)}function PN(t){const[e,r]=N.useState(()=>({narrow:t,open:ad(t)}));e.narrow!==t&&r({narrow:t,open:ad(t)});const l=e.narrow===t?e.open:ad(t),a=N.useCallback(y=>{r({narrow:t,open:y}),jt(ow(t),jN(y))},[t]);return{open:l,setOpen:a}}function ON(){const t=window.location.search,e=new URLSearchParams(t).get(gd),r=e!==null&&e.length>0?e:null,l=Ix(t);return r===null&&l===null?{token:r,tab:l}:(window.history.replaceState(null,"",`${window.location.pathname}${jx(t,[gd,Ev])}`),{token:r,tab:l})}const lw=ON(),_g=lw.token,BN=lw.tab,Yo={kind:"idle"},wg=new Set;function FN(t){const[e,r]=N.useState(Yo),[l,a]=N.useState(wg),[y,v]=N.useState(null),o=N.useRef(null),c=N.useRef(new Map),m=N.useRef(Yo);m.current=e,N.useEffect(()=>{const _=t.onMessage(p=>{switch(p.type){case"location.previewed":if(o.current!==p.requestId)break;o.current=null,r(T=>T.kind==="previewing"?{kind:"ready",project:T.project,preview:p.preview}:T);break;case"location.applied":if(o.current!==p.requestId)break;o.current=null,r(Yo);break;case"location.removed":{const T=c.current.get(p.requestId);if(T===void 0)break;c.current.delete(p.requestId),a(A=>{if(!A.has(T))return A;const E=new Set(A);return E.delete(T),E});break}case"error":{if(p.code!=="location-failed")break;p.detail!==void 0&&console.error("[servidor]",p.detail);const T=Ht(p.text);if(p.requestId!==void 0&&p.requestId===o.current){o.current=null,r(E=>E.kind==="previewing"||E.kind==="saving"?{kind:"failed",project:E.project,problem:T}:E);break}const A=p.requestId===void 0?void 0:c.current.get(p.requestId);A!==void 0&&p.requestId!==void 0&&(c.current.delete(p.requestId),a(E=>{const S=new Set(E);return S.delete(A),S}),v(T));break}}}),g=t.onReopen(()=>{o.current=null,c.current.clear(),a(wg),r(p=>p.kind==="previewing"||p.kind==="saving"||p.kind==="ready"?Yo:p)});return()=>{_(),g()}},[t]);const w=N.useCallback(_=>{v(null),o.current=null,r({kind:"choosing",project:_})},[]),d=N.useCallback(_=>{const g=m.current;if(g.kind!=="choosing")return;const p=crypto.randomUUID();o.current=p,r({kind:"previewing",project:g.project}),t.send({type:"location.preview",requestId:p,projectKey:g.project.key,pickerId:_})},[t]),k=N.useCallback(()=>{const _=m.current;if(_.kind!=="ready")return;const g=crypto.randomUUID();o.current=g,r({kind:"saving",project:_.project,preview:_.preview}),t.send({type:"location.apply",requestId:g,previewId:_.preview.previewId})},[t]),L=N.useCallback(()=>{const _=m.current;(_.kind==="ready"||_.kind==="failed")&&r({kind:"choosing",project:_.project})},[]),M=N.useCallback(()=>{o.current=null,r(Yo)},[]),b=N.useCallback(_=>{const g=crypto.randomUUID();v(null),c.current.set(g,_.key),a(p=>new Set(p).add(_.key)),t.send({type:"location.remove",requestId:g,projectKey:_.key})},[t]),h=N.useCallback(()=>v(null),[]);return{step:e,removing:l,removeProblem:y,begin:w,choose:d,confirm:k,chooseAnother:L,cancel:M,remove:b,dismissRemoveProblem:h}}const cd=new Set;function HN(t){const[e,r]=N.useState(null),[l,a]=N.useState(null),[y,v]=N.useState(cd),[o,c]=N.useState(null);N.useEffect(()=>{const h=t.onMessage(g=>{switch(g.type){case"vault.status":r(g.status);break;case"vault.exported":v(p=>{if(!p.has(g.projectKey))return p;const T=new Set(p);return T.delete(g.projectKey),T}),c({projectKey:g.projectKey,sessions:g.sessions,at:Date.now()});break;case"error":if(g.code!=="vault-failed")break;a(Ht(g.text)),g.detail!==void 0&&console.error("[servidor]",g.detail),v(cd);break}}),_=t.onReopen(()=>v(cd));return()=>{h(),_()}},[t]);const m=N.useCallback(()=>{a(null),t.send({type:"vault.measure"})},[t]),w=N.useCallback(h=>{a(null),t.send({type:"vault.enable",enabled:h})},[t]),d=N.useCallback(h=>{a(null),t.send({type:"vault.setDir",pickerId:h})},[t]),k=N.useCallback(h=>{a(null),v(_=>new Set(_).add(h)),t.send({type:"vault.exportProject",projectKey:h})},[t]),L=N.useCallback((h,_)=>{a(null),t.send({type:"vault.openSession",agent:h,sessionId:_})},[t]),M=N.useCallback(()=>{a(null),t.send({type:"vault.reveal"})},[t]),b=N.useCallback(()=>a(null),[]);return{status:e,problem:l,exporting:y,lastExported:o,measure:m,setEnabled:w,chooseDir:d,exportProject:k,openSession:L,reveal:M,dismissProblem:b}}function UN(t){return f("summary.outdatedServer",{server:t,page:zi})}function $N(t){const[e,...r]=t;if(e===void 0||e.missingMessage===null)return null;const l=Ht(e.missingMessage);return r.length===0?l:`${l}
|
|
164
|
+
${f("summary.alsoWorksWith",{names:r.map(a=>a.label).join(", ")})}`}function WN(t){const e=t.version??"?";return e.toLowerCase().includes(t.label.toLowerCase())?e:`${t.label} ${e}`}function qN(t,e,r=zi){var v,o;if(e&&r<zi)return{cliAvailable:!1,cliVersion:null,cliMissingMessage:UN(r),environmentNotice:null};if(e&&r>zi)return{cliAvailable:!1,cliVersion:null,cliMissingMessage:f("summary.newerServer",{server:r,page:zi}),environmentNotice:null};const l=t.filter(c=>c.available);let a=null;l.length===1?a=((v=l[0])==null?void 0:v.version)??null:l.length>1&&(a=l.map(WN).join(" · "));const y=e&&l.length===0;return{cliAvailable:!e||l.length>0,cliVersion:a,cliMissingMessage:y?$N(t):null,environmentNotice:((o=t.find(c=>c.environmentNotice!==null))==null?void 0:o.environmentNotice)??null}}const zN=500,KN=8e3;class VN{constructor(){Ut(this,"socket",null);Ut(this,"status","connecting");Ut(this,"attempt",0);Ut(this,"closedByUs",!1);Ut(this,"hasConnectedOnce",!1);Ut(this,"reconnectTimer");Ut(this,"messageHandlers",new Set);Ut(this,"statusHandlers",new Set);Ut(this,"reopenHandlers",new Set);Ut(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(ak,window.location.href);e.protocol=window.location.protocol==="https:"?"wss:":"ws:",_g!==null&&e.searchParams.set(gd,_g);const r=new WebSocket(e);this.socket=r,r.onopen=()=>{for(this.attempt=0,this.setStatus("open");this.outbox.length>0;){const l=this.outbox.shift();l!==void 0&&r.send(Pp(l))}if(this.hasConnectedOnce)for(const l of this.reopenHandlers)l();this.hasConnectedOnce=!0},r.onmessage=l=>{const a=mk(l.data);if(a===null){console.warn("[conexion] mensaje del servidor no reconocido");return}for(const y of this.messageHandlers)y(a)},r.onclose=l=>{if(this.socket=null,!this.closedByUs){if(l.code===Q0){this.setStatus("revoked");return}this.setStatus("reconnecting"),this.scheduleReconnect()}},r.onerror=()=>{}}send(e){return this.socket!==null&&this.socket.readyState===WebSocket.OPEN?(this.socket.send(Pp(e)),!0):(e.type!=="input"&&e.type!=="resize"&&e.type!=="agent.voice"&&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 r of this.statusHandlers)r(e)}}scheduleReconnect(){if(this.attempt+=1,!this.hasConnectedOnce&&this.attempt>4){this.setStatus("failed");return}const e=Math.min(zN*2**(this.attempt-1),KN);window.clearTimeout(this.reconnectTimer),this.reconnectTimer=window.setTimeout(()=>this.connect(),e)}}const aw=new Set;function GN(t){return t!==void 0&&aw.has(t)}function qn(){const t=crypto.randomUUID();return aw.add(t),t}function cw(t,e){return t.reason==="requested"&&e!==null&&(t.requestId===void 0||t.requestId===e)}const ud={rows:[],kept:[]},bg=new O_;function YN(t,e,r){const[l,a]=N.useState({...ud,stale:!1});return N.useEffect(()=>{if(e===null){a({...ud,stale:!1});return}const y=bg.enter(e,ud);a({...y.value,stale:y.stale});const v=()=>{t.send({type:"worktree.status",terminalId:e})},o=t.onMessage(m=>{if(m.type==="worktree.rows"&&m.terminalId===e){const w={rows:m.rows,kept:m.kept??[]};bg.store(e,w),a({...w,stale:!1})}m.type==="worktree.changed"&&v()}),c=t.onReopen(v);return()=>{o(),c()}},[t,e]),N.useEffect(()=>{e!==null&&r>0&&t.send({type:"worktree.status",terminalId:e})},[t,e,r]),l}function XN(t,e,r){const[l,a]=N.useState(null),[y,v]=N.useState(null),[o,c]=N.useState(null),m=N.useRef(null),w=N.useRef(null),d=N.useRef(null),k=N.useRef(null),L=N.useRef(null);N.useEffect(()=>t.onMessage(K=>{switch(K.type){case"worktree.inspected":if(K.requestId!==m.current)break;a(V=>V===null?null:{...V,state:{phase:"ready",inspection:K.inspection}});break;case"terminal.opened":if(K.requestId===m.current){m.current=null,a(null);const V=w.current;w.current=null,V==null||V()}break;case"worktree.moved":K.requestId===m.current&&(m.current=null,a(null));break;case"worktree.removePlan":if(K.requestId!==d.current)break;v(V=>V===null?null:{...V,state:{phase:"ready",plan:K.plan}});break;case"worktree.removed":if(K.requestId!==d.current)break;d.current=null,v(V=>V===null?null:{...V,state:{phase:"done",outcome:K.outcome}});break;case"worktree.deleteBranchPlan":if(K.requestId!==L.current)break;c(V=>V===null?null:{...V,state:{phase:"ready",plan:K.plan}});break;case"worktree.branchDeleted":if(K.requestId!==L.current)break;L.current=null,c(V=>V===null?null:{...V,state:{phase:"done"}});break;case"composer.prefill":cw(K,k.current)&&(k.current=null,r(K.terminalId));break;case"error":{const V=Ht(K.text);K.requestId!==void 0&&K.requestId===m.current&&(m.current=null,a(W=>{if(W===null)return null;const O=W.state.phase==="loading"?null:W.state.inspection;return{...W,state:{phase:"failed",inspection:O,message:V}}})),K.requestId!==void 0&&K.requestId===d.current&&(d.current=null,v(W=>{if(W===null)return null;const O=W.state.phase==="ready"||W.state.phase==="removing"?W.state.plan:null;return{...W,state:{phase:"failed",plan:O,message:V}}})),K.requestId!==void 0&&K.requestId===L.current&&(L.current=null,c(W=>{if(W===null)return null;const O=W.state.phase==="ready"||W.state.phase==="deleting"?W.state.plan:null;return{...W,state:{phase:"failed",plan:O,message:V}}})),K.requestId!==void 0&&K.requestId===k.current&&(k.current=null);break}}}),[t,r]);const M=N.useCallback((K,V,W,O)=>{const U=qn();m.current=U,w.current=O??null,a({source:K,projectCwd:V,projectName:W,state:{phase:"loading"},move:null}),t.send({type:"worktree.inspect",requestId:U,source:K})},[t]),b=N.useCallback((K,V,W)=>{const O=qn();m.current=O,w.current=null;const U={kind:"terminal",terminalId:K.terminalId};a({source:U,projectCwd:V,projectName:W,state:{phase:"loading"},move:K}),t.send({type:"worktree.inspect",requestId:O,source:U})},[t]),h=N.useCallback(K=>{if(l===null||l.state.phase!=="ready"&&l.state.phase!=="failed")return;const{inspection:V}=l.state;if(V===null)return;const W=qn();if(m.current=W,a({...l,state:{phase:"creating",inspection:V}}),l.move!==null){t.send({type:"worktree.move",requestId:W,terminalId:l.move.terminalId,branch:K.branch,base:K.base,mode:K.mode,copyNotes:K.copyNotes,askChanges:K.askChanges===!0});return}e(W,{cwd:l.projectCwd,label:K.branch,agent:K.agent??null}),t.send({type:"worktree.create",requestId:W,source:l.source,branch:K.branch,base:K.base,mode:K.mode,copyNotes:K.copyNotes,...K.agent!==void 0?{agent:K.agent}:{}})},[t,l,e]),_=N.useCallback(()=>{(l==null?void 0:l.state.phase)!=="creating"&&(m.current=null,w.current=null),a(null)},[l]),g=N.useCallback(K=>{const V=qn();d.current=V,t.send({type:"worktree.planRemove",requestId:V,worktreeId:K})},[t]),p=N.useCallback((K,V)=>{v({worktreeId:K,branch:V,state:{phase:"loading"},acceptedFiles:null}),g(K)},[g]),T=N.useCallback((K,V,W,O)=>{const U=qn();d.current=U,v({...K,acceptedFiles:O,state:{phase:"removing",plan:V}});const H=dl(V,O)?O:null;t.send({type:"worktree.remove",requestId:U,worktreeId:K.worktreeId,discardConflicts:W,...H!==null?{discardUntracked:H}:{}})},[t]),A=N.useCallback(K=>{y===null||y.state.phase!=="ready"||T(y,y.state.plan,K,y.acceptedFiles)},[y,T]),E=N.useCallback(()=>{var W;if(y===null||y.state.phase!=="ready")return;const{plan:K}=y.state,V=((W=K.untracked)==null?void 0:W.stamp)??null;V!==null&&($_(K,V)==="remove"?T(y,K,!1,V):v({...y,acceptedFiles:V}))},[y,T]),S=N.useCallback(K=>{if(y===null)return;const V=crypto.randomUUID();k.current=V,e(V,null),t.send({type:K,requestId:V,worktreeId:y.worktreeId}),d.current=null,v(null)},[t,e,y]),x=N.useCallback(()=>S("worktree.askNotes"),[S]),R=N.useCallback(()=>S("worktree.askCommit"),[S]),I=N.useCallback(()=>{y!==null&&(v({...y,state:{phase:"loading"}}),g(y.worktreeId))},[g,y]),D=N.useCallback(()=>{d.current=null,v(null)},[]),P=N.useCallback((K,V,W,O)=>{const U=crypto.randomUUID();e(U,{cwd:W,label:O,agent:K}),t.send({type:"worktree.reopen",requestId:U,agent:K,sessionId:V})},[t,e]),F=N.useCallback((K,V)=>{const W=qn();L.current=W,c({worktreeId:K,branch:V,state:{phase:"loading"}}),t.send({type:"worktree.planDeleteBranch",requestId:W,worktreeId:K})},[t]),z=N.useCallback(()=>{if(o===null||o.state.phase!=="ready"||o.state.plan.blocker!==null)return;const K=qn();L.current=K,c({...o,state:{phase:"deleting",plan:o.state.plan}}),t.send({type:"worktree.deleteBranch",requestId:K,worktreeId:o.worktreeId})},[t,o]),q=N.useCallback(()=>{L.current=null,c(null)},[]);return{create:l,openCreate:M,openMove:b,submitCreate:h,closeCreate:_,remove:y,openRemove:p,confirmRemove:A,discardFiles:E,askNotes:x,askCommit:R,retryRemove:I,closeRemove:D,reopen:P,deleteBranch:o,openDeleteBranch:F,confirmDeleteBranch:z,closeDeleteBranch:q}}function QN(t,e,r){const[l,a]=N.useState(null),[y,v]=N.useState(null),[o,c]=N.useState(null),m=N.useRef(null),w=N.useRef(null),d=N.useRef(null),k=N.useRef(null),L=N.useRef(null);N.useEffect(()=>t.onMessage(D=>{switch(D.type){case"worktree.branchChanges":if(D.requestId!==m.current)break;m.current=null,a(P=>P===null?null:{...P,state:{phase:"ready",changes:D.changes}});break;case"worktree.branchDiff":if(D.requestId!==w.current)break;w.current=null,a(P=>P===null||P.diff===null?P:{...P,diff:{...P.diff,diff:D.diff}});break;case"worktree.reviewPlan":if(D.requestId!==d.current)break;d.current=null,v(P=>P===null?null:{...P,state:{phase:"ready",plan:D.plan}});break;case"terminal.opened":D.requestId!==void 0&&D.requestId===d.current&&(d.current=null,v(null));break;case"worktree.integratePlan":if(D.requestId!==k.current)break;k.current=null,c(P=>P===null?null:{...P,state:{phase:"ready",plan:D.plan}});break;case"worktree.integrated":if(D.requestId!==k.current)break;k.current=null,c(P=>{if(P===null)return null;const F=P.state.phase==="integrating"?P.state.plan:null;return F===null?P:{...P,state:{phase:"done",plan:F,outcome:D.outcome}}});break;case"composer.prefill":cw(D,L.current)&&(L.current=null,r(D.terminalId));break;case"error":{const{requestId:P}=D;if(P===void 0)break;const F=Ht(D.text);P===m.current&&(m.current=null,a(z=>z===null?null:{...z,state:{phase:"failed",message:F}})),P===w.current&&(w.current=null,a(z=>z===null||z.diff===null?z:{...z,diff:{...z.diff,message:F}})),P===d.current&&(d.current=null,v(z=>{if(z===null)return null;const q=z.state.phase==="loading"||z.state.phase==="failed"?null:z.state.plan;return{...z,state:{phase:"failed",plan:q,message:F}}})),P===k.current&&(k.current=null,c(z=>{if(z===null)return null;const q=z.state.phase==="ready"||z.state.phase==="integrating"?z.state.plan:null;return{...z,state:{phase:"failed",plan:q,message:F}}})),P===L.current&&(L.current=null);break}}}),[t,r]);const M=N.useCallback((D,P)=>{const F=qn();m.current=F,w.current=null,a({worktreeId:D,branch:P,state:{phase:"loading"},diff:null}),t.send({type:"worktree.changes",requestId:F,worktreeId:D})},[t]),b=N.useCallback(D=>{if(l===null)return;const P=qn();w.current=P,a({...l,diff:{path:D,diff:null,message:null}}),t.send({type:"worktree.changesDiff",requestId:P,worktreeId:l.worktreeId,path:D})},[t,l]),h=N.useCallback(()=>{w.current=null,a(D=>D===null?null:{...D,diff:null})},[]),_=N.useCallback(()=>{m.current=null,w.current=null,a(null)},[]),g=N.useCallback((D,P,F)=>{const z=qn();d.current=z,v({worktreeId:D,branch:P,projectCwd:F,state:{phase:"loading"}}),t.send({type:"worktree.planReview",requestId:z,worktreeId:D})},[t]),p=N.useCallback(D=>{if(y===null||y.state.phase!=="ready"&&y.state.phase!=="failed")return;const{plan:P}=y.state;if(P===null)return;const F=qn();d.current=F,v({...y,state:{phase:"requesting",plan:P}});const z=y.projectCwd.split(/[\\/]/).filter(q=>q.length>0).pop()??y.projectCwd;e(F,{cwd:y.projectCwd,label:z,agent:D}),t.send({type:"worktree.requestReview",requestId:F,worktreeId:y.worktreeId,agent:D})},[t,e,y]),T=N.useCallback(()=>{(y==null?void 0:y.state.phase)!=="requesting"&&(d.current=null),v(null)},[y]),A=N.useCallback((D,P)=>{const F=qn();k.current=F,c({worktreeId:D,branch:P,state:{phase:"loading"}}),t.send({type:"worktree.planIntegrate",requestId:F,worktreeId:D})},[t]),E=N.useCallback(()=>{if(o===null||o.state.phase!=="ready")return;const D=qn();k.current=D;const{plan:P}=o.state;c({...o,state:{phase:"integrating",plan:P}}),t.send({type:"worktree.integrate",requestId:D,worktreeId:o.worktreeId,...P.branchCommit!==null?{branchCommit:P.branchCommit}:{}})},[t,o]),S=N.useCallback(()=>{k.current=null,c(null)},[]),x=N.useCallback((D,P)=>{const F=crypto.randomUUID();L.current=F,e(F,null),t.send({type:D,requestId:F,worktreeId:P})},[t,e]),R=N.useCallback(D=>x("worktree.sendReview",D),[x]),I=N.useCallback(D=>x("worktree.catchUp",D),[x]);return{changes:l,openChanges:M,openChangeDiff:b,closeChangeDiff:h,closeChanges:_,review:y,openReview:g,submitReview:p,closeReview:T,integrate:o,openIntegrate:A,confirmIntegrate:E,closeIntegrate:S,sendReview:R,catchUp:I}}const Wd="agent-workbench.activeTab";function JN(){try{return window.sessionStorage.getItem(Wd)}catch{return null}}const ZN={state:"idle",scannedFiles:0,totalFiles:0};function eR(t,e,r){const l=new Map(r?[]:t.map(a=>[a.key,a]));for(const a of e)l.set(a.key,a);return[...l.values()].sort((a,y)=>y.lastActivityAt-a.lastActivityAt)}function tR(){const t=N.useMemo(()=>new VN,[]),e=N.useMemo(()=>new mx({send:(Ce,fe)=>t.send({type:"composer.draft",terminalId:Ce,draft:fe}),connected:()=>t.getStatus()==="open",setTimer:(Ce,fe)=>window.setTimeout(Ce,fe),clearTimer:Ce=>window.clearTimeout(Ce),newId:()=>crypto.randomUUID()}),[t]),[r,l]=N.useState("connecting"),[a,y]=N.useState([]),[v,o]=N.useState(null),[c,m]=N.useState(!1),[w,d]=N.useState(zi),[k,L]=N.useState(""),[M,b]=N.useState(""),[h,_]=N.useState(null),[g,p]=N.useState(!1),[T,A]=N.useState(!1),[E,S]=N.useState(!1),[x,R]=N.useState([]),[I,D]=N.useState([]),[P,F]=N.useState(ZN),[z,q]=N.useState(JN);N.useEffect(()=>{try{z===null?window.sessionStorage.removeItem(Wd):window.sessionStorage.setItem(Wd,z)}catch{}},[z]);const[K,V]=N.useState(new Set),[W,O]=N.useState(new Map),[U,H]=N.useState(new Map),$=N.useRef(new Map),Z=N.useRef(new Map),[re,we]=N.useState(new Set),[_e,Q]=N.useState(null),[Y,te]=N.useState([]),[ee,ye]=N.useState(new Map),[ge,Be]=N.useState([]),Ue=N.useRef(1),[ze,gt]=N.useState(new Map),[Fe,pt]=N.useState(new Map),yt=N.useRef(new Set),oe=N.useRef(new Map),Ae=N.useRef(new Map),De=N.useCallback(Ce=>{const fe=Ae.current.get(Ce);fe!==void 0&&(clearTimeout(fe),Ae.current.delete(Ce)),te(ht=>ht.some(ve=>ve.requestId===Ce)?ht.filter(ve=>ve.requestId!==Ce):ht)},[]),Le=N.useCallback(()=>{for(const Ce of Ae.current.values())clearTimeout(Ce);Ae.current.clear(),te(Ce=>Ce.length===0?Ce:[])},[]);N.useEffect(()=>{const Ce=t.onStatus(ve=>{l(ve),ve==="failed"&&Q({message:f("workspace.connectFailed"),at:Date.now()})}),fe=t.onMessage(ve=>{switch(ve.type){case"agent.submitted":e.submittedAck(ve.terminalId,ve.requestId,ve.delivered);break;case"agent.codexQueueResult":e.submittedAck(ve.terminalId,ve.requestId,ve.result==="queued");break;case"agents":y(ve.agents),o(ve.defaultAgent);break;case"hello":pt(new Map),y(ve.agents),o(ve.defaultAgent),m(!0),d(ve.protocolVersion),L(ve.platform),b(ve.defaultCwd),_(ve.shellName),p(ve.remoteClient),A(ve.fileCheck),S(ve.fileWrite);break;case"terminal.list":{R(ve.terminals),e.retain(ve.terminals.map(Ge=>Ge.terminalId));const rt=FC(Z.current,ve.terminals),Pt=rt.finished.length>0||[...rt.phases].some(([Ge,ct])=>Z.current.get(Ge)!==ct);Z.current=rt.phases,Pt&&we(new Set(rt.phases.keys())),V(Ge=>{if(Ge.size===0)return Ge;const ct=new Set(Ge);for(const Tt of Ge){if(rt.phases.has(Tt))continue;const se=ve.terminals.find(ke=>ke.terminalId===Tt);(se===void 0||se.alive)&&ct.delete(Tt)}return ct.size===Ge.size?Ge:ct}),H(Ge=>{if(Ge.size===0)return Ge;const ct=new Map([...Ge].filter(([Tt])=>ve.terminals.some(se=>se.terminalId===Tt)));return ct.size===Ge.size?Ge:($.current=ct,ct)});const Et=ve.terminals.filter(Ge=>Ge.kind==="agent");q(Ge=>{var ct;return Ge!==null&&Et.some(Tt=>Tt.terminalId===Ge)?Ge:((ct=Et[0])==null?void 0:ct.terminalId)??null}),ye(Ge=>{if(Ge.size===0)return Ge;const ct=new Map(Ge);for(const Tt of Ge.keys())ve.terminals.some(se=>se.terminalId===Tt)||ct.delete(Tt);return ct.size===Ge.size?Ge:ct}),gt(Ge=>{if(Ge.size===0)return Ge;const ct=new Map([...Ge].filter(([Tt])=>ve.terminals.some(se=>se.terminalId===Tt)));return ct.size===Ge.size?Ge:ct});break}case"session.continued":ye(rt=>new Map(rt).set(ve.terminalId,{sourceAgent:ve.source.agent,includedTurns:ve.includedTurns,totalTurns:ve.totalTurns,totalTurnsIsMinimum:ve.totalTurnsIsMinimum,delivery:ve.delivery,prefillReason:null}));break;case"composer.prefill":{if(e.consumeSubmitPrefill(ve.terminalId,ve.requestId))break;const rt=Ue.current;Ue.current+=1;const Pt=ve.reason==="stopped-early"&&yE(ve.terminalId);Be(Ge=>[...Ge,{id:rt,terminalId:ve.terminalId,text:ve.text,pasted:ve.pasted??[],focus:ve.reason==="no-delivery"||ve.reason==="queue-edit"||ve.reason==="unscheduled"||Pt}]);const{reason:Et}=ve;if(Pt)break;if(Et==="returned-by-cli"||Et==="stopped-early"){gt(Ge=>Ge.get(ve.terminalId)===Et?Ge:new Map(Ge).set(ve.terminalId,Et));break}if(Et==="rewound"||Et==="requested"||Et==="queue-edit"||Et==="unscheduled")break;ye(Ge=>{const ct=Ge.get(ve.terminalId);return ct===void 0?Ge:new Map(Ge).set(ve.terminalId,{...ct,delivery:"prefilled",prefillReason:Et})});break}case"composer.drafts":e.restore(ve.drafts);break;case"composer.suggestion":pt(rt=>am(rt,ve.terminalId,ve.text));break;case"terminal.opened":{De(ve.requestId),yt.current.delete(ve.requestId)&&ve.terminal.kind==="agent"&&q(ve.terminal.terminalId);const rt=oe.current.get(ve.requestId);rt!==void 0&&(oe.current.delete(ve.requestId),rt(ve.terminal));break}case"terminal.activity":O(rt=>rt.get(ve.terminalId)===ve.activity?rt:new Map(rt).set(ve.terminalId,ve.activity)),H(rt=>{const Pt=ve.offlineReason??null;if((rt.get(ve.terminalId)??null)===Pt)return rt;const Et=new Map(rt);return Pt===null?Et.delete(ve.terminalId):Et.set(ve.terminalId,Pt),$.current=Et,Et});break;case"index.status":F(ve.status);break;case"index.projects":D(rt=>eR(rt,ve.projects,ve.replace));break;case"error":if(GN(ve.requestId)){ve.detail!==void 0&&console.error("[servidor]",ve.detail),ve.requestId!==void 0&&(yt.current.delete(ve.requestId),oe.current.delete(ve.requestId),De(ve.requestId));break}if(c2(ve.requestId)){ve.detail!==void 0&&console.error("[servidor]",ve.detail);break}if(ve.code==="vault-failed"||ve.code==="location-failed"||ve.code==="search-failed"||ve.code==="remote-failed"||ve.code==="settings-failed"||ve.code==="rewind-failed")break;Q({message:Ht(ve.text),at:Date.now()}),V(rt=>rt.size===0?rt:new Set),Z.current.size>0&&(Z.current=new Map,we(new Set)),ve.detail!==void 0&&console.error("[servidor]",ve.detail),ve.requestId!==void 0&&(yt.current.delete(ve.requestId),oe.current.delete(ve.requestId),De(ve.requestId));break}}),ht=t.onReopen(()=>{Le(),V(ve=>ve.size===0?ve:new Set),Z.current.size>0&&(Z.current=new Map,we(new Set))});return t.connect(),()=>{Ce(),fe(),ht(),t.close()}},[t,e,De,Le]),N.useEffect(()=>{const Ce=t.onReopen(()=>e.reconnected()),fe=()=>e.flushAll(),ht=()=>{document.visibilityState==="hidden"&&e.flushAll()};return window.addEventListener("pagehide",fe),document.addEventListener("visibilitychange",ht),()=>{Ce(),window.removeEventListener("pagehide",fe),document.removeEventListener("visibilitychange",ht)}},[t,e]),N.useEffect(()=>Le,[Le]);const nt=N.useCallback(Ce=>{const fe=crypto.randomUUID();yt.current.add(fe),Ce.onOpened!==void 0&&oe.current.set(fe,Ce.onOpened),te(ve=>[...ve,{requestId:fe,cwd:Ce.cwd,agent:Ce.agent??null,label:Ce.label??"",at:Date.now()}]);const ht=setTimeout(()=>De(fe),Gp);Ae.current.set(fe,ht),t.send({type:"terminal.open",requestId:fe,cwd:Ce.cwd,...Ce.resumeSessionId!==void 0?{resumeSessionId:Ce.resumeSessionId}:{},...Ce.label!==void 0?{label:Ce.label}:{},...Ce.agent!==void 0?{agent:Ce.agent}:{}})},[t,De]),je=N.useCallback(Ce=>{t.send({type:"terminal.open",requestId:crypto.randomUUID(),cwd:Ce,kind:"shell"})},[t]),Ke=N.useCallback(Ce=>t.send({type:"terminal.close",terminalId:Ce}),[t]),kt=N.useCallback(Ce=>{V(fe=>new Set(fe).add(Ce)),$.current.get(Ce)==="server-closed"&&(Z.current=new Map(Z.current).set(Ce,"waiting-exit"),we(new Set(Z.current.keys()))),t.send({type:"terminal.wake",terminalId:Ce})},[t]),Lt=N.useCallback((Ce,fe)=>t.send({type:"terminal.rename",terminalId:Ce,label:fe}),[t]),xt=N.useCallback(Ce=>t.send({type:"tabs.reorder",terminalIds:Ce}),[t]),vt=N.useCallback((Ce,fe)=>t.send({type:"session.archive",sessionIds:Ce,archived:fe}),[t]),dt=N.useCallback((Ce,fe,ht)=>{const ve=crypto.randomUUID();yt.current.add(ve),t.send({type:"session.continue",requestId:ve,agent:Ce.agent,sessionId:Ce.sessionId,target:fe,label:ht})},[t]),Qe=N.useCallback((Ce,fe)=>{if(yt.current.add(Ce),fe===null)return;te(ve=>[...ve,{requestId:Ce,...fe,at:Date.now()}]);const ht=setTimeout(()=>De(Ce),Gp);Ae.current.set(Ce,ht)},[De]),St=N.useCallback(Ce=>{ye(fe=>{if(!fe.has(Ce))return fe;const ht=new Map(fe);return ht.delete(Ce),ht})},[]),Ft=N.useCallback(Ce=>{gt(fe=>{if(!fe.has(Ce))return fe;const ht=new Map(fe);return ht.delete(Ce),ht})},[]),Gt=N.useCallback(Ce=>{pt(fe=>am(fe,Ce,null))},[]),Ie=N.useCallback(Ce=>{Be(fe=>fe.some(ht=>ht.id===Ce)?fe.filter(ht=>ht.id!==Ce):fe)},[]),$e=N.useCallback(()=>t.send({type:"index.refresh"}),[t]),ue=N.useCallback(()=>t.send({type:"agents.refresh"}),[t]),st=N.useCallback(()=>Q(null),[]),ft=N.useMemo(()=>x.filter(Ce=>Ce.kind==="agent"),[x]),et=N.useMemo(()=>x.filter(Ce=>Ce.kind==="shell"),[x]),tt=ul(),de=N.useMemo(()=>qN(a,c,w),[a,c,w,tt]),Pe=N.useCallback(Ce=>{var fe;return(Ce===null||(fe=a.find(ht=>ht.id===Ce))==null?void 0:fe.capabilities)??Pg},[a]),Re=N.useMemo(()=>zd(a),[a]);return{connection:t,status:r,agents:a,defaultAgent:v,capabilitiesFor:Pe,offerAgentChoice:Re,cliAvailable:de.cliAvailable,cliVersion:de.cliVersion,cliMissingMessage:de.cliMissingMessage,platform:k,defaultCwd:M,environmentNotice:de.environmentNotice,shellName:h,remoteClient:g,fileCheck:T,fileWrite:E,terminals:ft,shells:et,pendingOpens:Y,activeTerminalId:z,projects:I,indexStatus:P,error:_e,dismissError:st,setActiveTerminal:q,openTerminal:nt,openShell:je,closeTerminal:Ke,wakeTerminal:kt,waking:K,activity:W,offlineReasons:U,relaunching:re,renameTerminal:Lt,reorderTabs:xt,refreshIndex:$e,refreshAgents:ue,archiveSessions:vt,continueSession:dt,expectTab:Qe,handoffs:ee,dismissHandoff:St,returnedMessages:ze,dismissReturned:Ft,suggestions:Fe,dismissSuggestion:Gt,prefills:ge,prefillApplied:Ie,drafts:e}}function nR({dialog:t,agents:e,offerAgentChoice:r,agent:l,moveBlock:a=null,onSubmit:y,onClose:v}){const{state:o,move:c}=t,m=o.phase==="loading"?null:o.inspection,[w,d]=N.useState("new"),[k,L]=N.useState(""),[M,b]=N.useState(""),[h,_]=N.useState(""),[g,p]=N.useState(l),[T,A]=N.useState(!0),[E,S]=N.useState(!0);N.useEffect(()=>{const O=U=>{U.key==="Escape"&&(U.preventDefault(),U.stopPropagation(),v())};return window.addEventListener("keydown",O,!0),()=>window.removeEventListener("keydown",O,!0)},[v]),N.useEffect(()=>{var O;m===null||h.length>0||_(c!==null?ML(m,c.tabBranch):m.currentBranch??((O=m.branches[0])==null?void 0:O.name)??"")},[m,h,c]);const x=N.useMemo(()=>(m==null?void 0:m.branches.filter(O=>!O.checkedOut).map(O=>O.name))??[],[m]);N.useEffect(()=>{M.length===0&&x[0]!==void 0&&b(x[0])},[M,x]);const R=e.filter(O=>O.available),I=w==="new"?k.trim():M,D=w==="new"?h:(m==null?void 0:m.currentBranch)??h,P=m===null?null:TL(m,I,w,D),F=o.phase==="creating",z=c===null?null:NL(a),q=c===null||m===null?0:m.sourceChanges??m.mainChanges,K=m!==null&&!F&&I.length>0&&P===null&&z===null,V=()=>{K&&y({branch:I,base:D,mode:w,copyNotes:T,...c===null&&r&&g!==null?{agent:g}:{},...c!==null?{askChanges:E&&q>0}:{}})},W=f(c===null?"worktree.create.title":"worktree.move.title");return i.jsx("div",{className:"modal-backdrop",onClick:v,children:i.jsxs("div",{className:"modal worktree-dialog",role:"dialog","aria-label":W,onClick:O=>O.stopPropagation(),children:[i.jsxs("header",{className:"modal-header",children:[i.jsx("span",{className:"modal-title",children:W}),i.jsx("button",{className:"icon-button",onClick:v,title:f("common.close"),children:"×"})]}),i.jsxs("div",{className:"modal-body",children:[i.jsx("p",{className:"modal-hint",children:c===null?f("worktree.create.intro",{project:t.projectName}):f("worktree.move.intro",{project:t.projectName})}),o.phase==="loading"&&i.jsx("p",{className:"modal-hint",children:f("worktree.create.loading")}),m!==null&&i.jsxs("form",{className:"worktree-form",onSubmit:O=>{O.preventDefault(),V()},children:[i.jsxs("label",{className:"worktree-field",children:[i.jsx("span",{className:"worktree-label",children:f("worktree.create.branch")}),w==="new"?i.jsx("input",{className:"worktree-input",value:k,onChange:O=>L(O.target.value),placeholder:f("worktree.create.branchPlaceholder"),spellCheck:!1,autoFocus:!0,disabled:F}):i.jsx("select",{className:"worktree-input",value:M,onChange:O=>b(O.target.value),disabled:F||x.length===0,children:x.map(O=>i.jsx("option",{value:O,children:O},O))})]}),i.jsxs("div",{className:"worktree-modes",role:"radiogroup",children:[i.jsxs("label",{className:"worktree-mode",children:[i.jsx("input",{type:"radio",checked:w==="new",onChange:()=>d("new"),disabled:F}),i.jsx("span",{children:f("worktree.create.modeNew")}),i.jsx("select",{className:"worktree-input worktree-base",value:h,onChange:O=>_(O.target.value),disabled:F||w!=="new",children:m.branches.map(O=>i.jsx("option",{value:O.name,children:O.name},O.name))})]}),i.jsxs("label",{className:"worktree-mode",children:[i.jsx("input",{type:"radio",checked:w==="existing",onChange:()=>d("existing"),disabled:F||x.length===0}),i.jsx("span",{children:f("worktree.create.modeExisting")})]}),x.length===0&&i.jsx("p",{className:"modal-hint",children:f("worktree.create.noFreeBranch")})]}),c===null&&r&&R.length>1&&i.jsxs("label",{className:"worktree-field",children:[i.jsx("span",{className:"worktree-label",children:f("worktree.create.agent")}),i.jsx("select",{className:"worktree-input",value:g??"",onChange:O=>{var U;return p(((U=R.find(H=>H.id===O.target.value))==null?void 0:U.id)??null)},disabled:F,children:R.map(O=>i.jsx("option",{value:O.id,children:O.label},O.id))})]}),P!==null&&i.jsx("p",{className:"worktree-problem",children:P}),z!==null&&i.jsx("p",{className:"worktree-problem",children:z}),i.jsx("h3",{className:"modal-section",children:f("worktree.create.copySection")}),m.notes.files===0?i.jsx("p",{className:"modal-hint",children:f("worktree.create.copyNone")}):i.jsxs("label",{className:"worktree-check",children:[i.jsx("input",{type:"checkbox",checked:T,onChange:O=>A(O.target.checked),disabled:F}),i.jsxs("span",{children:[f("worktree.create.copyNotes"),i.jsxs("span",{className:"modal-hint",children:[" ",m.notes.overCap?f("worktree.create.overCap",{summary:Aa(m.notes)}):f("worktree.create.copyList",{summary:Aa(m.notes),list:En(m.notes.sample)})]})]})]}),m.include!==null&&i.jsx("p",{className:"modal-hint",children:m.include.overCap?f("worktree.create.includeOverCap",{summary:Aa(m.include)}):f("worktree.create.include",{summary:Aa(m.include)})}),c===null&&m.mainChanges>0&&i.jsx("p",{className:"worktree-warning",children:f("worktree.create.mainChanges",{count:m.mainChanges})}),c!==null&&q>0&&i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"worktree-warning",children:f("worktree.move.changes",{count:q})}),i.jsxs("label",{className:"worktree-check",children:[i.jsx("input",{type:"checkbox",checked:E,onChange:O=>S(O.target.checked),disabled:F}),i.jsxs("span",{children:[f("worktree.move.askChanges"),i.jsxs("span",{className:"modal-hint",children:[" ",f("worktree.move.askChangesHint")]})]})]})]}),I.length>0&&P===null&&i.jsxs(i.Fragment,{children:[i.jsx("h3",{className:"modal-section",children:f("worktree.create.folder")}),i.jsx("p",{className:"worktree-path",children:H_(m,I)}),i.jsx("h3",{className:"modal-section",children:f("worktree.create.command")}),i.jsx("pre",{className:"tool-pre worktree-command",children:IL(m,I,D,w)})]}),o.phase==="failed"&&i.jsx("p",{className:"worktree-problem",children:o.message}),i.jsxs("div",{className:"worktree-actions",children:[i.jsx("button",{type:"button",className:"link-button",onClick:v,children:f("common.cancel")}),i.jsx("button",{type:"submit",className:"primary-button",disabled:!K,children:f(c===null?F?"worktree.create.creating":"worktree.create.submit":F?"worktree.move.moving":"worktree.move.submit")})]})]}),o.phase==="failed"&&m===null&&i.jsx("p",{className:"worktree-problem",children:o.message})]})]})})}function rR({dialog:t,onConfirm:e,onClose:r}){const{state:l}=t;N.useEffect(()=>{const c=m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),r())};return window.addEventListener("keydown",c,!0),()=>window.removeEventListener("keydown",c,!0)},[r]);const a=l.phase==="ready"||l.phase==="deleting"||l.phase==="failed"?l.plan:null,y=a===null?null:qL(a),v=l.phase==="deleting",o=f("worktree.deleteBranch.title",{branch:t.branch});return i.jsx("div",{className:"modal-backdrop",onClick:r,children:i.jsxs("div",{className:"modal worktree-dialog",role:"dialog","aria-label":o,onClick:c=>c.stopPropagation(),children:[i.jsxs("header",{className:"modal-header",children:[i.jsx("span",{className:"modal-title",children:o}),i.jsx("button",{className:"icon-button",onClick:r,title:f("common.close"),children:"×"})]}),i.jsxs("div",{className:"modal-body",children:[l.phase==="loading"&&i.jsx("p",{className:"modal-hint",children:f("worktree.deleteBranch.loading")}),l.phase==="done"&&i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"modal-hint",children:f("worktree.deleteBranch.done",{branch:t.branch})}),i.jsx("div",{className:"worktree-actions",children:i.jsx("button",{className:"primary-button",onClick:r,children:f("common.close")})})]}),a!==null&&i.jsxs(i.Fragment,{children:[y!==null?i.jsx("p",{className:"worktree-problem",children:y}):i.jsx("p",{className:"modal-hint",children:f("worktree.deleteBranch.intro",{base:a.base})}),i.jsx("h3",{className:"modal-section",children:f("worktree.integrate.folder")}),i.jsx("p",{className:"worktree-path",children:a.folder}),i.jsx("h3",{className:"modal-section",children:f("worktree.integrate.command")}),i.jsx("pre",{className:"tool-pre worktree-command",children:a.command}),l.phase==="failed"&&i.jsx("p",{className:"worktree-problem",children:l.message}),i.jsxs("div",{className:"worktree-actions",children:[i.jsx("button",{className:"link-button",onClick:r,children:f("common.cancel")}),i.jsx("button",{className:"primary-button",onClick:e,disabled:v||y!==null||l.phase==="failed",children:f(v?"worktree.deleteBranch.deleting":"worktree.deleteBranch.submit")})]})]}),l.phase==="failed"&&a===null&&i.jsx("p",{className:"worktree-problem",children:l.message})]})]})})}function uw({returning:t,merging:e,resolved:r}){const[l,a]=N.useState(!1),y=r.length>0?i.jsx("p",{className:"modal-hint",children:f("worktree.notes.resolved",{count:r.length,list:En(r)})}):null;if(t.length===0)return y;const v=new Set(e);return i.jsxs(i.Fragment,{children:[y,i.jsxs("p",{className:"modal-hint",children:[f("worktree.notes.back",{count:t.length})," ",v.size>0&&i.jsxs(i.Fragment,{children:[f("worktree.notes.merged",{count:v.size})," "]}),i.jsx("button",{className:"link-button worktree-notes-toggle",onClick:()=>a(!l),"aria-expanded":l,children:f(l?"worktree.notes.hide":"worktree.notes.show")})]}),l&&i.jsx("ul",{className:"worktree-notes-list",children:t.map(o=>i.jsxs("li",{children:[o,v.has(o)&&i.jsx("span",{className:"worktree-notes-mark",children:f("worktree.notes.mergedMark")})]},o))})]})}function sR({dialog:t,agentLabel:e,onConfirm:r,onRemove:l,onClose:a}){const{state:y}=t;N.useEffect(()=>{const w=d=>{d.key==="Escape"&&(d.preventDefault(),d.stopPropagation(),a())};return window.addEventListener("keydown",w,!0),()=>window.removeEventListener("keydown",w,!0)},[a]);const v=y.phase==="loading"?null:y.plan,o=v===null?null:HL(v),c=y.phase==="integrating",m=v===null?f("worktree.integrate.titleLoading",{branch:t.branch}):f("worktree.integrate.title",{branch:v.branch,base:v.base});return i.jsx("div",{className:"modal-backdrop",onClick:a,children:i.jsxs("div",{className:"modal worktree-dialog",role:"dialog","aria-label":m,onClick:w=>w.stopPropagation(),children:[i.jsxs("header",{className:"modal-header",children:[i.jsx("span",{className:"modal-title",children:m}),i.jsx("button",{className:"icon-button",onClick:a,title:f("common.close"),children:"×"})]}),i.jsxs("div",{className:"modal-body",children:[y.phase==="loading"&&i.jsx("p",{className:"modal-hint",children:f("worktree.integrate.loading")}),y.phase==="done"&&i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"modal-hint",children:f("worktree.integrate.done",{base:y.outcome.base,count:y.outcome.commits})}),y.outcome.notes!==void 0&&y.outcome.notes.returned>0&&i.jsx("p",{className:"modal-hint",children:f("worktree.notes.returned",{count:y.outcome.notes.returned})}),y.outcome.notes!==void 0&&y.outcome.notes.stayed.length>0&&i.jsx("p",{className:"worktree-warning",children:f("worktree.integrate.notesStayed",{list:En(y.outcome.notes.stayed)})}),i.jsx("p",{className:"modal-hint",children:f("worktree.integrate.doneOthers",{base:y.outcome.base})}),i.jsxs("div",{className:"worktree-actions",children:[i.jsx("button",{className:"link-button",onClick:a,children:f("common.close")}),i.jsx("button",{className:"primary-button",onClick:l,title:f("worktree.integrate.removeTitle"),children:f("worktree.integrate.remove")})]})]}),v!==null&&y.phase!=="done"&&i.jsxs(i.Fragment,{children:[o!==null?i.jsx("p",{className:"worktree-problem",children:o}):i.jsx("p",{className:"modal-hint",children:f("worktree.integrate.intro",{base:v.base,count:v.ahead})}),v.fileCount>0&&i.jsx("p",{className:"modal-hint",children:f("worktree.integrate.files",{count:v.fileCount,list:`${En(v.files)}${v.fileCount>v.files.length?"…":""}`})}),v.notes!==null&&i.jsx(uw,{returning:v.notes.returning,merging:v.notes.merging,resolved:v.notes.resolved}),v.notes!==null&&v.notes.conflicts.length>0&&i.jsx("p",{className:"worktree-warning",children:f("worktree.integrate.notesStay",{list:En(v.notes.conflicts)})}),i.jsx("p",{className:v.review===null||v.review.state==="done"&&v.review.verdict==="ready"&&!v.review.stale?"modal-hint":"worktree-warning",children:v.review===null?f("worktree.integrate.noReview"):U_(v.review,e(v.review.agent))}),v.tabs.length>0&&i.jsx("p",{className:"modal-hint",children:f("worktree.integrate.tabs",{list:En(v.tabs.map(w=>w.label))})}),v.branchUncommitted>0&&i.jsx("p",{className:"worktree-warning",children:f("worktree.integrate.branchUncommitted",{count:v.branchUncommitted})}),v.command!==null&&v.baseFolder!==null&&i.jsxs(i.Fragment,{children:[i.jsx("h3",{className:"modal-section",children:f("worktree.integrate.folder")}),i.jsx("p",{className:"worktree-path",children:v.baseFolder}),i.jsx("h3",{className:"modal-section",children:f("worktree.integrate.command")}),i.jsx("pre",{className:"tool-pre worktree-command",children:v.command})]}),y.phase==="failed"&&i.jsx("p",{className:"worktree-problem",children:y.message}),i.jsxs("div",{className:"worktree-actions",children:[i.jsx("button",{className:"link-button",onClick:a,children:f("common.cancel")}),i.jsx("button",{className:"primary-button",onClick:r,disabled:c||o!==null||y.phase==="failed",children:f(c?"worktree.integrate.integrating":"worktree.integrate.submit")})]})]}),y.phase==="failed"&&v===null&&i.jsx("p",{className:"worktree-problem",children:y.message})]})]})})}function iR({dialog:t,onConfirm:e,onDiscardFiles:r,onAskNotes:l,onAskCommit:a,onRetry:y,onClose:v,scheduledCountFor:o}){var p;const{state:c,acceptedFiles:m}=t;N.useEffect(()=>{const T=A=>{A.key==="Escape"&&(A.preventDefault(),A.stopPropagation(),v())};return window.addEventListener("keydown",T,!0),()=>window.removeEventListener("keydown",T,!0)},[v]);const w=c.phase==="ready"||c.phase==="removing"||c.phase==="failed"?c.plan:null,d=c.phase==="removing",k=c.phase==="failed",L=w===null||k?null:$_(w,m),M=w!==null&&!k&&KL(w,m),b=w===null?null:GL(w,m),h=w===null||o===void 0?0:o(w.tabs.map(T=>T.terminalId)),_=f("worktree.remove.title",{branch:t.branch}),g=k?{label:f("worktree.remove.retry"),hint:void 0,run:y}:L==="ask-commit"&&w!==null?{label:f("worktree.remove.askCommit",{count:((p=w.untracked)==null?void 0:p.stamp)!=null&&w.untracked.files>0?w.untracked.files:w.uncommittedCount}),hint:f("worktree.remove.askTitle"),run:a}:L==="retry"?{label:f("worktree.remove.retry"),hint:void 0,run:y}:L==="ask-notes"?{label:f("worktree.remove.askNotes"),hint:f("worktree.remove.askTitle"),run:l}:L==="remove"?{label:f("worktree.remove.submit"),hint:void 0,run:()=>e(!1)}:null;return i.jsx("div",{className:"modal-backdrop",onClick:v,children:i.jsxs("div",{className:"modal worktree-dialog",role:"dialog","aria-label":_,onClick:T=>T.stopPropagation(),children:[i.jsxs("header",{className:"modal-header",children:[i.jsx("span",{className:"modal-title",children:_}),i.jsx("button",{className:"icon-button",onClick:v,title:f("common.close"),children:"×"})]}),i.jsxs("div",{className:"modal-body",children:[c.phase==="loading"&&i.jsx("p",{className:"modal-hint",children:f("worktree.remove.loading")}),c.phase==="done"&&i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"modal-hint",children:f("worktree.remove.done")}),c.outcome.returned>0&&i.jsx("p",{className:"modal-hint",children:f("worktree.notes.returned",{count:c.outcome.returned})}),c.outcome.discarded>0&&i.jsx("p",{className:"modal-hint",children:f("worktree.remove.doneDiscarded",{count:c.outcome.discarded})}),c.outcome.discardedFiles>0&&i.jsx("p",{className:"modal-hint",children:f("worktree.remove.doneDiscardedFiles",{count:c.outcome.discardedFiles})}),c.outcome.branchDeleted&&i.jsx("p",{className:"modal-hint",children:f("worktree.remove.doneBranch")}),i.jsx("div",{className:"worktree-actions",children:i.jsx("button",{className:"primary-button",onClick:v,children:f("common.close")})})]}),w!==null&&c.phase!=="done"&&i.jsxs(i.Fragment,{children:[w.uncommittedCount>0&&i.jsxs("p",{className:dl(w,m)?"worktree-warning":"worktree-problem",children:[b??f("worktree.remove.uncommitted",{count:w.uncommittedCount})," ",i.jsx("span",{className:"worktree-files",children:XL(w)})]}),w.inUse===!0&&i.jsx("p",{className:"worktree-problem",children:YL(w)}),w.conflicts.length>0&&i.jsx("p",{className:"worktree-warning",children:f("worktree.remove.conflicts",{list:En(w.conflicts)})}),i.jsx("p",{className:"modal-hint",children:QL(w)}),i.jsx(uw,{returning:w.returning,merging:w.merging,resolved:w.resolved}),w.tabs.length>0&&i.jsx("p",{className:"modal-hint",children:f("worktree.remove.tabs",{list:En(w.tabs.map(T=>T.label))})}),h>0&&i.jsx("p",{className:"worktree-warning",children:f("scheduled.worktree.cancels",{count:h})}),w.commands.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("h3",{className:"modal-section",children:f("worktree.remove.commands")}),i.jsx("pre",{className:"tool-pre worktree-command",children:w.commands.join(`
|
|
165
|
+
`)})]})]}),k&&i.jsx("p",{className:"worktree-problem",children:c.message}),c.phase!=="loading"&&c.phase!=="done"&&i.jsxs("div",{className:"worktree-actions",children:[i.jsx("button",{className:"link-button",onClick:v,children:f("common.cancel")}),M&&i.jsx("button",{className:"link-button",onClick:r,disabled:d,children:f("worktree.remove.discardFiles")}),L==="ask-notes"&&i.jsx("button",{className:"link-button",onClick:()=>e(!0),disabled:d,children:f("worktree.remove.discard")}),g!==null&&i.jsx("button",{className:"primary-button",onClick:g.run,title:g.hint,disabled:d,children:d?f("worktree.remove.removing"):g.label})]})]})]})})}function oR({dialog:t,agents:e,onSubmit:r,onClose:l}){var _;const{state:a}=t,y=a.phase==="loading"?null:a.plan,v=N.useMemo(()=>$L(e),[e]),o=y===null?null:ny(y.author,v),[c,m]=N.useState(null),w=c??o,d=e.find(g=>g.id===w)??null,k=g=>{var p;return((p=e.find(T=>T.id===g))==null?void 0:p.label)??g};N.useEffect(()=>{const g=p=>{p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),l())};return window.addEventListener("keydown",g,!0),()=>window.removeEventListener("keydown",g,!0)},[l]);const L=a.phase==="requesting",M=y!==null&&y.ahead===0&&y.uncommitted===0,b=y!==null&&d!==null&&!L&&!M,h=f("worktree.review.title",{branch:t.branch});return i.jsx("div",{className:"modal-backdrop",onClick:l,children:i.jsxs("div",{className:"modal worktree-dialog",role:"dialog","aria-label":h,onClick:g=>g.stopPropagation(),children:[i.jsxs("header",{className:"modal-header",children:[i.jsx("span",{className:"modal-title",children:h}),i.jsx("button",{className:"icon-button",onClick:l,title:f("common.close"),children:"×"})]}),i.jsxs("div",{className:"modal-body",children:[a.phase==="loading"&&i.jsx("p",{className:"modal-hint",children:f("worktree.review.loading")}),y!==null&&i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"modal-hint",children:f("worktree.review.intro",{base:y.base})}),M?i.jsx("p",{className:"worktree-problem",children:f("worktree.review.nothing",{base:y.base})}):i.jsxs(i.Fragment,{children:[v.length>1?i.jsxs("label",{className:"worktree-field",children:[i.jsx("span",{className:"worktree-label",children:f("worktree.review.reviewer")}),i.jsx("select",{className:"worktree-input",value:w??"",onChange:g=>{var p;return m(((p=v.find(T=>T.id===g.target.value))==null?void 0:p.id)??null)},disabled:L,children:v.map(g=>i.jsx("option",{value:g.id,children:k(g.id)},g.id))})]}):d!==null&&i.jsx("p",{className:"modal-hint",children:f("worktree.review.sameCli",{agent:d.label})}),y.author!==null&&v.length>1&&i.jsx("p",{className:"modal-hint",children:f("worktree.review.author",{agent:k(y.author)})}),d!==null&&i.jsxs(i.Fragment,{children:[i.jsx("p",{className:((_=d.capabilities.readOnlyLaunch)==null?void 0:_.guard)==="cli"?"modal-hint":"worktree-warning",children:UL(d.capabilities,d.label)}),i.jsx("p",{className:"modal-hint",children:d.capabilities.readySignal?f("worktree.review.deliverySent"):f("worktree.review.deliveryPrefill")})]}),y.branchBusy&&i.jsx("p",{className:"worktree-warning",children:f("worktree.review.branchBusy")}),y.uncommitted>0&&i.jsx("p",{className:"modal-hint",children:f("worktree.review.uncommitted",{count:y.uncommitted})}),i.jsx("p",{className:"modal-hint",children:f("worktree.review.quota")}),i.jsx("h3",{className:"modal-section",children:f("worktree.review.prompt")}),i.jsx("pre",{className:"tool-pre worktree-command worktree-prompt",children:y.prompt})]}),a.phase==="failed"&&i.jsx("p",{className:"worktree-problem",children:a.message}),i.jsxs("div",{className:"worktree-actions",children:[i.jsx("button",{className:"link-button",onClick:l,children:f("common.cancel")}),i.jsx("button",{className:"primary-button",disabled:!b,onClick:()=>{b&&w!==null&&r(w)},children:f(L?"worktree.review.requesting":"worktree.review.submit")})]})]}),a.phase==="failed"&&y===null&&i.jsx("p",{className:"worktree-problem",children:a.message})]})]})})}const fh=["git","files","plans","memory","console","notes"],yg="agent-workbench.hiddenPanels";function lR(t){return fh.includes(t)}const aR=new Set(["memory"]),cR=new Set;function kg(t,e){return t??(e?cR:aR)}const uR="none";function dR(t){return new Set(t.split(",").map(e=>e.trim()).filter(lR))}function hR(t){const e=fh.filter(r=>t.has(r));return e.length===0?uR:e.join(",")}function fR(t,e,r){const l=new Set(t);return r?l.delete(e):l.add(e),l}function pR(t){const[e,r]=N.useState(()=>Wt(yg,null,dR)),l=kg(e,t),a=N.useCallback((v,o)=>{r(c=>{const m=fR(kg(c,t),v,o);return jt(yg,hR(m)),m})},[t]),y=N.useCallback(v=>!l.has(v),[l]);return{hidden:l,isVisible:y,setVisible:a}}const mR={git:"panel.tab.git",files:"panel.tab.files",plans:"panel.tab.plans",memory:"panel.tab.memory",console:"console.name",notes:"notes.name"},gR={dark:"settings.terminalTheme.dark",follow:"settings.terminalTheme.follow"};function vR(t,e,r){const l=t.filter(a=>a!==e);return r?[...l,e]:l}function _R(t,e){return t.length===e.length&&t.every(r=>e.includes(r))}function wR({onClose:t,terminalTheme:e,panels:r,consoleCount:l,onHideConsole:a,appSettings:y,agents:v,remoteClient:o,onOpenVault:c,onOpenRemote:m,onConfigureStatusLine:w}){const[d,k]=N.useState(!1),L=y.status,M=L!==null&&!o,[b,h]=N.useState(null),[_,g]=N.useState(null),[p,T]=N.useState(null);N.useEffect(()=>{h(null),g(null),T(null)},[L,y.problem]);const A=b??(L==null?void 0:L.consoleShell)??"auto",E=_??(L==null?void 0:L.disabledAgents)??[],S=p??(L==null?void 0:L.scheduledMessages)??!1;N.useEffect(()=>{const P=F=>{F.key==="Escape"&&(F.preventDefault(),F.stopPropagation(),t())};return window.addEventListener("keydown",P,!0),()=>window.removeEventListener("keydown",P,!0)},[t]);const x=(P,F)=>{if(P==="console"&&!F&&l>0){k(!0);return}r.setVisible(P,F)},R=(L==null?void 0:L.consoleShells.find(P=>P.id!=="git-bash"&&P.id!=="zsh"))??null,I=L!==null&&!_R(L.disabledAgents,L.disabledAtStart),D=L===null?[]:[{id:"auto",label:R===null?f("settings.console.auto"):f("settings.console.autoWith",{shell:R.label})},...L.consoleShells];return i.jsx("div",{className:"modal-backdrop",onClick:t,children:i.jsxs("div",{className:"modal settings-dialog",role:"dialog","aria-label":f("settings.title"),onClick:P=>P.stopPropagation(),children:[i.jsxs("header",{className:"modal-header",children:[i.jsx("span",{className:"modal-title",children:f("settings.title")}),i.jsx("button",{className:"icon-button",onClick:t,title:f("common.closeEsc"),children:"×"})]}),i.jsxs("div",{className:"modal-body settings-body",children:[i.jsx("h3",{className:"modal-section",children:f("settings.section.appearance")}),i.jsxs("div",{className:"settings-row",children:[i.jsx("span",{className:"settings-label",children:f("settings.language")}),i.jsx(iw,{})]}),i.jsxs("div",{className:"settings-row settings-row-top",children:[i.jsx("span",{className:"settings-label",children:f("settings.terminalTheme")}),i.jsxs("div",{className:"settings-choices",role:"radiogroup","aria-label":f("settings.terminalTheme"),children:[["dark","follow"].map(P=>i.jsxs("label",{className:"settings-choice",children:[i.jsx("input",{type:"radio",name:"terminal-theme",checked:e.preference===P,onChange:()=>e.setPreference(P)}),f(gR[P])]},P)),i.jsx("p",{className:"modal-hint",children:f("settings.terminalTheme.hint")})]})]}),i.jsx("h3",{className:"modal-section",children:f("settings.section.panels")}),i.jsx("div",{className:"settings-panels",children:fh.map(P=>i.jsxs("label",{className:"settings-choice",children:[i.jsx("input",{type:"checkbox",checked:r.isVisible(P),onChange:F=>x(P,F.target.checked)}),f(mR[P])]},P))}),d&&i.jsxs("div",{className:"settings-confirm",role:"alert",children:[i.jsx("span",{children:f("settings.panels.consoleConfirm",{count:l})}),i.jsx("button",{className:"link-button",onClick:()=>{k(!1),a()},children:f("settings.panels.consoleConfirmYes")}),i.jsx("button",{className:"link-button",onClick:()=>k(!1),children:f("common.cancel")})]}),i.jsx("p",{className:"modal-hint",children:f("settings.panels.cliAlways")}),L===null?i.jsx("p",{className:"modal-hint",children:f("settings.oldServer")}):i.jsxs(i.Fragment,{children:[i.jsx("h3",{className:"modal-section",children:f("settings.section.console")}),L.consoleShells.length===0?i.jsx("p",{className:"modal-hint",children:f("console.noShell")}):i.jsxs("div",{className:"settings-choices",role:"radiogroup","aria-label":f("settings.section.console"),children:[D.map(P=>i.jsxs("label",{className:"settings-choice",children:[i.jsx("input",{type:"radio",name:"console-shell",checked:A===P.id,disabled:!M,onChange:()=>{h(P.id),y.setConsoleShell(P.id)}}),P.label]},P.id)),i.jsx("p",{className:"modal-hint",children:f("settings.console.hint")})]}),i.jsx("h3",{className:"modal-section",children:f("settings.section.clis")}),i.jsx("ul",{className:"settings-clis",children:v.map(P=>{const F=E.includes(P.id),z=L.disabledAtStart.includes(P.id),q=P.available||z;return i.jsxs("li",{className:"settings-cli",children:[q?i.jsxs("label",{className:"settings-choice",children:[i.jsx("input",{type:"checkbox",checked:!F,disabled:!M,onChange:K=>{const V=vR(E,P.id,!K.target.checked);g(V),y.setDisabledAgents(V)}}),i.jsx("span",{className:"settings-cli-name",children:P.label})]}):i.jsx("span",{className:"settings-cli-name settings-cli-missing",children:P.label}),i.jsx("span",{className:"settings-cli-detail",children:P.available?P.version??"":f(z?"settings.cli.disabled":"settings.cli.notInstalled")}),!q&&i.jsx("a",{className:"link-button",href:P.installUrl,target:"_blank",rel:"noreferrer noopener",children:f("settings.cli.install")})]},P.id)})}),i.jsx("p",{className:"modal-hint",children:f("settings.cli.hint")}),I&&i.jsx("p",{className:"settings-restart",children:f("settings.cli.restart")}),i.jsx("h3",{className:"modal-section",children:f("settings.section.scheduled")}),i.jsxs("label",{className:"settings-choice",children:[i.jsx("input",{type:"checkbox",checked:S,disabled:!M,onChange:P=>{T(P.target.checked),y.setScheduledMessages(P.target.checked)}}),f("settings.scheduled.enable")]}),i.jsx("p",{className:"modal-hint",children:f("settings.scheduled.hint")}),S&&sC(v,E).map(P=>i.jsxs("p",{className:"modal-hint",children:[f("settings.scheduled.needsStatusLine",{agent:P.label})," ",i.jsx("button",{className:"link-button",onClick:()=>w(P.id),children:f("meter.configure")})]},P.id)),o&&i.jsx("p",{className:"modal-hint",children:f("settings.hostOnly")}),y.problem!==null&&i.jsxs("p",{className:"settings-problem",role:"alert",children:[y.problem,i.jsx("button",{className:"link-button",onClick:y.dismissProblem,children:f("common.close")})]})]}),(c!==null||m!==null)&&i.jsxs(i.Fragment,{children:[i.jsx("h3",{className:"modal-section",children:f("settings.section.more")}),i.jsxs("div",{className:"settings-row settings-more",children:[c!==null&&i.jsx("button",{className:"primary-button primary-button-small",onClick:c,children:f("settings.more.open",{name:Xi()})}),m!==null&&i.jsx("button",{className:"primary-button primary-button-small",onClick:m,children:f("settings.more.open",{name:f("app.header.remoteAccess")})})]})]})]})]})})}function bR(t){const[e,r]=N.useState(null),[l,a]=N.useState(null);N.useEffect(()=>t.onMessage(m=>{switch(m.type){case"settings.status":r(m.settings),a(null);break;case"error":if(m.code!=="settings-failed")break;a(Ht(m.text)),m.detail!==void 0&&console.error("[servidor]",m.detail);break}}),[t]);const y=N.useCallback(m=>t.send({type:"settings.update",consoleShell:m}),[t]),v=N.useCallback(m=>t.send({type:"settings.update",disabledAgents:m}),[t]),o=N.useCallback(m=>t.send({type:"settings.update",scheduledMessages:m}),[t]),c=N.useCallback(()=>a(null),[]);return{status:e,problem:l,setConsoleShell:y,setDisabledAgents:v,setScheduledMessages:o,dismissProblem:c}}function yR(t){const[e,r]=N.useState(null);N.useEffect(()=>t.onMessage(v=>{v.type==="schedule.list"&&r(v.messages)}),[t]);const l=N.useCallback((v,o,c)=>t.send({type:"schedule.create",requestId:Td(),terminalId:v,text:o,sendAt:c}),[t]),a=N.useCallback(v=>void t.send({type:"schedule.cancel",id:v}),[t]),y=N.useCallback(v=>void t.send({type:"schedule.sendNow",id:v}),[t]);return{messages:e,schedule:l,cancel:a,sendNow:y}}function kR({warning:t,onConfirm:e,onClose:r}){N.useEffect(()=>{const a=y=>{y.key==="Escape"&&(y.preventDefault(),y.stopPropagation(),r())};return window.addEventListener("keydown",a,!0),()=>window.removeEventListener("keydown",a,!0)},[r]);const l=f("scheduled.close.title");return i.jsx("div",{className:"modal-backdrop",onClick:r,children:i.jsxs("div",{className:"modal worktree-dialog",role:"dialog","aria-label":l,onClick:a=>a.stopPropagation(),children:[i.jsxs("header",{className:"modal-header",children:[i.jsx("span",{className:"modal-title",children:l}),i.jsx("button",{className:"icon-button",onClick:r,title:f("common.close"),children:"×"})]}),i.jsxs("div",{className:"modal-body",children:[i.jsx("p",{className:"modal-hint",children:t}),i.jsxs("div",{className:"worktree-actions",children:[i.jsx("button",{className:"link-button",onClick:r,autoFocus:!0,children:f("scheduled.close.keep")}),i.jsx("button",{className:"primary-button",onClick:e,children:f("scheduled.close.confirm")})]})]})]})})}function Xo({label:t,count:e,sub:r=!1,warn:l=!1,hint:a}){return i.jsxs(i.Fragment,{children:[i.jsx("dt",{className:`location-fact${r?" location-fact-sub":""}${l?" location-fact-warn":""}`,children:t}),i.jsx("dd",{className:`location-count${l?" location-fact-warn":""}`,children:e}),a!==void 0&&i.jsx("dd",{className:"location-hint",children:a})]})}function CR({preview:t}){return i.jsxs(i.Fragment,{children:[i.jsxs("dl",{className:"location-folders",children:[i.jsx("dt",{children:f("locate.dialog.was")}),i.jsx("dd",{children:t.from.map(e=>i.jsx("span",{className:"location-path",title:e,children:e},e))}),i.jsx("dt",{children:f("locate.dialog.now")}),i.jsx("dd",{children:i.jsx("span",{className:"location-path",title:t.to,children:t.to})})]}),i.jsxs("dl",{className:"location-facts",children:[i.jsx(Xo,{label:f("locate.dialog.moving"),count:t.moving}),t.inSubfolders>0&&i.jsx(Xo,{label:f("locate.dialog.inSubfolders"),count:t.inSubfolders,sub:!0}),t.inDestination>0&&i.jsx(Xo,{label:f("locate.dialog.inDestination"),count:t.inDestination,hint:f("locate.dialog.inDestinationHint")}),t.tabs>0&&i.jsx(Xo,{label:f("locate.dialog.tabs"),count:t.tabs,warn:!0,hint:f("locate.dialog.tabsHint")}),t.pending>0&&i.jsx(Xo,{label:f("locate.dialog.pending"),count:t.pending,warn:!0,sub:!0,hint:f("locate.dialog.pendingHint")})]}),i.jsx("p",{className:"modal-hint",children:f("locate.dialog.keeps")})]})}function xR({step:t,onConfirm:e,onChooseAnother:r,onCancel:l}){const a=t.kind==="saving";N.useEffect(()=>{if(a)return;const o=c=>{c.key==="Escape"&&(c.preventDefault(),c.stopPropagation(),l())};return window.addEventListener("keydown",o,!0),()=>window.removeEventListener("keydown",o,!0)},[a,l]);const y=t.kind==="ready"||t.kind==="saving"?t.preview:null,v=y!==null&&y.tabs>0;return i.jsx("div",{className:"modal-backdrop",onClick:a?void 0:l,children:i.jsxs("div",{className:"modal location-modal",role:"dialog","aria-label":f("locate.dialog.title"),onClick:o=>o.stopPropagation(),children:[i.jsxs("header",{className:"modal-header",children:[i.jsx("span",{className:"modal-title",children:f("locate.dialog.title")}),i.jsx("button",{className:"icon-button",onClick:l,disabled:a,title:f("common.closeEsc"),children:"×"})]}),i.jsxs("div",{className:"modal-body",children:[t.kind==="previewing"&&i.jsx("p",{className:"modal-hint",children:f("locate.dialog.waiting")}),y!==null&&i.jsx(CR,{preview:y}),t.kind==="failed"&&i.jsx("div",{className:"vault-problem",role:"alert",children:i.jsx("span",{children:t.problem})}),i.jsxs("div",{className:"location-actions",children:[y!==null&&i.jsx("button",{className:"primary-button",onClick:e,disabled:v||a,title:v?f("locate.dialog.useBlocked"):void 0,children:f(a?"locate.dialog.saving":"locate.dialog.use")}),t.kind!=="previewing"&&i.jsx("button",{className:"link-button",onClick:r,disabled:a,children:f("locate.dialog.another")}),i.jsx("button",{className:"link-button",onClick:l,disabled:a,children:f("common.cancel")})]})]})]})})}function SR({status:t,agents:e,indexReady:r,problem:l,covered:a,onMeasure:y,onSetEnabled:v,onChangeDir:o,onReveal:c,onDismissProblem:m,onClose:w}){return N.useEffect(()=>{if(a)return;const d=k=>{k.key==="Escape"&&(k.preventDefault(),k.stopPropagation(),w())};return window.addEventListener("keydown",d,!0),()=>window.removeEventListener("keydown",d,!0)},[a,w]),i.jsx("div",{className:"modal-backdrop",onClick:w,children:i.jsxs("div",{className:"modal vault-modal",role:"dialog","aria-label":Xi(),onClick:d=>d.stopPropagation(),children:[i.jsxs("header",{className:"modal-header",children:[i.jsx("span",{className:"modal-title",children:Xi()}),t!==null&&i.jsx("span",{className:`vault-state${t.enabled?" vault-state-on":""}`,children:BT(t)}),i.jsx("button",{className:"icon-button",onClick:w,title:f("common.closeEsc"),children:"×"})]}),i.jsxs("div",{className:"modal-body",children:[i.jsx("p",{className:"vault-lead",children:IT()}),i.jsx("p",{className:"modal-hint",children:jT()}),t===null?i.jsx("p",{className:"modal-hint",children:f("vault.dialog.waiting")}):i.jsx(ER,{status:t,agents:e,indexReady:r,onMeasure:y,onSetEnabled:v,onChangeDir:o,onReveal:c}),l!==null&&i.jsxs("div",{className:"vault-problem",role:"alert",children:[i.jsx("span",{children:l}),i.jsx("button",{className:"icon-button",onClick:m,title:f("common.dismissNotice"),children:"×"})]})]})]})})}function ER({status:t,agents:e,indexReady:r,onMeasure:l,onSetEnabled:a,onChangeDir:y,onReveal:v}){const o=$T(t,r),c=WT(t),m=UT(t),w=t.measurement===null?null:KT(t.measurement,e),d=t.progress;return i.jsxs(i.Fragment,{children:[t.enabled&&i.jsxs(i.Fragment,{children:[i.jsx("h3",{className:"modal-section",children:f("vault.dialog.inFolder")}),i.jsxs("p",{className:"vault-summary",children:[L_(t.sessions)," · ",fn(t.bytes),t.lastPassAt!==null&&i.jsxs(i.Fragment,{children:[" · ",f("vault.dialog.lastPass",{when:nr(t.lastPassAt)})]}),t.pending>0&&i.jsxs(i.Fragment,{children:[" · ",f("vault.dialog.pendingCalm",{count:t.pending})]})]})]}),d!==null&&d.total>0&&i.jsx("progress",{className:"vault-progress",value:d.done,max:d.total}),i.jsx("h3",{className:"modal-section",children:f("vault.dialog.sizeSection")}),i.jsxs("div",{className:"vault-actions",children:[i.jsx("button",{className:"link-button vault-measure",onClick:l,disabled:o!==null,title:o??f("vault.dialog.measureTitle"),children:t.state==="measuring"?f("vault.state.measuring"):f(w===null?"vault.dialog.measure":"vault.dialog.measureAgain")}),w!==null&&i.jsx("span",{className:"modal-hint",children:w.summary})]}),w!==null&&i.jsx("div",{className:"vault-table-wrap",children:i.jsxs("table",{className:"vault-table",children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{children:"CLI"}),i.jsx("th",{children:f("vault.dialog.table.sessions")}),i.jsx("th",{children:f("vault.dialog.table.size")}),i.jsx("th",{children:f("vault.dialog.table.images")}),i.jsx("th",{title:f("vault.dialog.table.archivedTitle"),children:f("vault.dialog.table.archived")})]})}),i.jsxs("tbody",{children:[w.rows.map(k=>i.jsxs("tr",{children:[i.jsxs("td",{children:[k.label,k.note!==null&&i.jsx("span",{className:"vault-table-note",children:k.note})]}),i.jsx("td",{children:k.sessions}),i.jsx("td",{children:fn(k.bytes)}),i.jsx("td",{title:k.images>0?fn(k.imageBytes):void 0,children:k.images}),i.jsx("td",{children:k.skippedArchived})]},k.agent)),i.jsxs("tr",{children:[i.jsx("td",{children:f("vault.dialog.table.memory",{count:w.memoryProjects})}),i.jsx("td",{}),i.jsx("td",{children:fn(w.memoryBytes)}),i.jsx("td",{}),i.jsx("td",{})]})]}),i.jsx("tfoot",{children:i.jsxs("tr",{children:[i.jsx("td",{children:f("vault.dialog.table.total")}),i.jsx("td",{children:w.total.sessions}),i.jsx("td",{children:fn(w.total.bytes)}),i.jsx("td",{children:w.total.images}),i.jsx("td",{children:w.total.skippedArchived})]})})]})}),i.jsxs("div",{className:"vault-actions vault-switch",children:[m==="enabled"&&i.jsxs(i.Fragment,{children:[i.jsx("button",{className:"link-button",onClick:()=>a(!1),children:f("vault.dialog.turnOff")}),i.jsx("span",{className:"modal-hint",children:f("vault.dialog.turnOffHint")})]}),(m==="measured"||m==="existing")&&i.jsxs(i.Fragment,{children:[i.jsx("button",{className:"primary-button",onClick:()=>a(!0),title:f(m==="existing"?"vault.dialog.activateExistingTitle":"vault.dialog.activateMeasuredTitle"),children:f("vault.dialog.activate")}),i.jsx("span",{className:"modal-hint",children:f(m==="existing"?"vault.dialog.activateExistingHint":"vault.dialog.activateMeasuredHint")})]}),m==="needs-measure"&&i.jsx("span",{className:"modal-hint",children:f("vault.dialog.needsMeasure",{activate:f("vault.dialog.activate")})})]}),i.jsx("h3",{className:"modal-section",children:f("vault.dialog.folderSection")}),i.jsx("p",{className:"vault-dir",title:t.dir,children:t.dir}),t.isDefaultDir&&i.jsx("p",{className:"modal-hint",children:f("vault.dialog.defaultDir")}),i.jsxs("div",{className:"vault-actions",children:[i.jsx("button",{className:"link-button",onClick:y,disabled:c!==null,title:c??f("vault.dialog.changeDirTitle"),children:f("vault.dialog.changeDir")}),v!==null&&i.jsx("button",{className:"link-button",onClick:v,title:f("vault.dialog.openFolderTitle"),children:f("vault.dialog.openFolder")})]}),t.previousDir!==null&&i.jsx("p",{className:"modal-hint",children:qT(t.previousDir)}),t.lastError!==null&&i.jsxs(i.Fragment,{children:[i.jsx("h3",{className:"modal-section",children:f("vault.dialog.lastError")}),i.jsx("p",{className:"vault-error",children:Ht(t.lastError)})]})]})}function TR({preview:t,files:e,running:r,error:l,onConfirm:a,onClose:y}){N.useEffect(()=>{const o=c=>{c.key==="Escape"&&(c.preventDefault(),c.stopPropagation(),y())};return window.addEventListener("keydown",o,!0),()=>window.removeEventListener("keydown",o,!0)},[y]);const v=f("rewind.title");return i.jsx("div",{className:"modal-backdrop",onClick:y,children:i.jsxs("div",{className:"modal rewind-dialog",role:"dialog","aria-label":v,onClick:o=>o.stopPropagation(),children:[i.jsxs("header",{className:"modal-header",children:[i.jsx("span",{className:"modal-title",children:v}),i.jsx("button",{className:"icon-button",onClick:y,title:f("common.close"),children:"×"})]}),i.jsxs("div",{className:"modal-body",children:[t.length>0&&i.jsx("blockquote",{className:"rewind-quote",children:t}),i.jsx("p",{className:"modal-hint",children:f("rewind.intro")}),e.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("h3",{className:"modal-section",children:f("rewind.filesSection")}),i.jsx("ul",{className:"rewind-files",children:e.map(o=>i.jsx("li",{children:o},o))}),i.jsx("p",{className:"modal-hint",children:f("rewind.filesHint")})]}),l!==null&&i.jsx("p",{className:"rewind-error",children:l}),i.jsxs("div",{className:"rewind-actions",children:[e.length>0?i.jsxs(i.Fragment,{children:[i.jsx("button",{className:"primary-button",disabled:r,onClick:()=>a("conversation-and-code"),children:f("rewind.undoAll")}),i.jsx("button",{className:"primary-button",disabled:r,onClick:()=>a("conversation"),children:f("rewind.undoConversation")})]}):i.jsx("button",{className:"primary-button",disabled:r,onClick:()=>a("conversation"),children:f("rewind.undo")}),i.jsx("button",{className:"link-button",onClick:y,children:f("common.cancel")}),r&&i.jsx("span",{className:"modal-hint",children:f("rewind.running")})]})]})]})})}function LR(t){const[e,r]=N.useState(null),l=N.useRef(null),a=N.useRef(null),y=N.useCallback(m=>{l.current=m,r(m)},[]);N.useEffect(()=>t.onMessage(m=>{const w=a.current;if(w!==null){if(m.type==="agent.rewound"&&m.requestId===w){a.current=null,y(null);return}if(m.type==="error"&&m.requestId===w){a.current=null;const d=l.current;d!==null&&y({...d,phase:"failed",error:Ht(m.text)})}}}),[t,y]);const v=N.useCallback((m,w)=>{a.current=null,y({terminalId:m,eventId:w,phase:"confirm",error:null})},[y]),o=N.useCallback(m=>{const w=l.current;if(w===null||w.phase==="running")return;const d=crypto.randomUUID();a.current=d,t.send({type:"agent.rewind",terminalId:w.terminalId,eventId:w.eventId,restore:m,requestId:d}),y({...w,phase:"running",error:null})},[t,y]),c=N.useCallback(()=>{a.current=null,y(null)},[y]);return{state:e,open:v,confirm:o,close:c}}function NR(t){return t.focused&&t.visible?t.activeTerminalId:null}function RR(t,e,r){N.useEffect(()=>{if(!r)return;let l;const a=()=>{const y=NR({activeTerminalId:e,focused:document.hasFocus(),visible:document.visibilityState==="visible"});y!==l&&(l=y,t.send({type:"terminal.attention",terminalId:y}))};return a(),window.addEventListener("focus",a),window.addEventListener("blur",a),document.addEventListener("visibilitychange",a),()=>{window.removeEventListener("focus",a),window.removeEventListener("blur",a),document.removeEventListener("visibilitychange",a)}},[t,e,r])}const Cg={connecting:"app.status.connecting",open:"app.status.open",reconnecting:"app.status.reconnecting",failed:"app.status.failed",revoked:"app.status.revoked"},xg=320,MR=1400,AR=640,Sg=200,Eg=560,IR=270,jR=120,DR=720,PR=260,Tg="agent-workbench.panel-width",Lg="agent-workbench.panel-visible",Ng="agent-workbench.panel-tab",dd="agent-workbench.panel-expanded",hd="agent-workbench.sidebar-visible",Rg="agent-workbench.sidebar-width",fd="agent-workbench.console-visible",Mg="agent-workbench.console-height",Ag="agent-workbench.marker-notice-dismissed",Ig="agent-workbench.hidden-hint-shown";function OR(){var bo,yo,ko,Ci;const t=ul(),e=tR(),{connection:r,status:l,agents:a,defaultAgent:y,capabilitiesFor:v,offerAgentChoice:o,cliAvailable:c,cliVersion:m,cliMissingMessage:w,platform:d,defaultCwd:k,environmentNotice:L,shellName:M,terminals:b,archiveSessions:h,shells:_,pendingOpens:g,activeTerminalId:p,projects:T,indexStatus:A,error:E,dismissError:S,setActiveTerminal:x,openTerminal:R,openShell:I,closeTerminal:D,wakeTerminal:P,waking:F,activity:z,offlineReasons:q,relaunching:K,renameTerminal:V,reorderTabs:W,refreshIndex:O,refreshAgents:U,continueSession:H,expectTab:$,handoffs:Z,dismissHandoff:re,returnedMessages:we,dismissReturned:_e,suggestions:Q,dismissSuggestion:Y,prefills:te,prefillApplied:ee,drafts:ye,remoteClient:ge,fileCheck:Be,fileWrite:Ue}=e,ze=_2(),gt=y2(ze.resolved);RR(r,p,l==="open");const Fe=N.useMemo(()=>({nameOf:X=>cg(b.find(me=>me.terminalId===X)),activate:x}),[b,x]),pt=$2(z,Fe),yt=W2(),oe=b.find(X=>X.terminalId===p)??null,Ae=N.useCallback(X=>{X!==p&&S(),x(X)},[p,S,x]),De=(oe==null?void 0:oe.agent)??null,Le=v(De),nt=(oe==null?void 0:oe.review)===!0,je=N.useMemo(()=>Up(Le,nt),[Le,nt]),Ke=a.find(X=>X.id===De)??null,kt=N.useMemo(()=>{if(oe===null||De===null)return null;for(const X of T){const me=X.sessions.find(qe=>qe.agent===De&&qe.sessionId===oe.sessionId);if(me!==void 0)return wr(me.title,me.titleSource)}return null},[oe,De,T,t]),Lt=N.useMemo(()=>Wk(b,T.flatMap(X=>X.sessions)),[b,T]),xt=(Ke==null?void 0:Ke.statusLine)??null,vt=p2(r),dt=N.useMemo(()=>{var X;return De===null?[]:((X=vt.find(me=>me.agent===De))==null?void 0:X.windows)??[]},[vt,De]),Qe=(Ke==null?void 0:Ke.planLimitsSetup)??null,St=(oe==null?void 0:oe.cwd)??k,Ft=N.useMemo(()=>o?_C(b,St,d,a,y):null,[o,b,St,d,a,y]),Gt=N.useMemo(()=>Yp(g,St,d),[g,St,d]),Ie=Gt?vv():null,$e=f2(r),ue=HN(r),[st,ft]=N.useState(!1),et=FN(r),tt=G2(r),[de,Pe]=N.useState(!1),Re=M1(),Ce=PN(Re),fe=pR(o),[ht,ve]=N.useState(!1),rt=N.useCallback(()=>ve(!1),[]),[Pt,Et]=N.useState(()=>Wt(sm,"chat",Tx)),Ge=N.useMemo(()=>Lx({hasTab:oe!==null,plansAvailable:je.plansAvailable,hidden:fe.hidden}),[oe,je.plansAvailable,fe.hidden]),ct=Nx(Pt,Ge),Tt=N.useCallback(X=>{Et(X),jt(sm,X)},[]),se=N.useRef(BN);N.useEffect(()=>{if(se.current!==null)return r.onMessage(X=>{if(X.type!=="terminal.list"||se.current===null)return;const me=se.current;se.current=null,X.terminals.some(qe=>qe.terminalId===me&&qe.kind==="agent")&&x(me)})},[r,x]);const ke=R5(r),be=nT(a,ue.status),[lt,ut]=N.useState(null),wt=N.useRef(0),Nt=N.useCallback(X=>{ut(me=>me!==null&&me.seq===X?null:me)},[]),Yt=(X,me)=>{const qe=gT(X,{projects:T,terminals:b,platform:d,canResume:ln=>qp(a,ln)}),Jt=()=>{me.length!==0&&(wt.current+=1,ut({query:me,seq:wt.current}))};switch(qe.kind){case"activate":Ae(qe.terminalId),Jt();break;case"resume":qe.session.archived&&h([qe.session.sessionId],!1),R({cwd:qe.cwd,resumeSessionId:qe.session.sessionId,agent:qe.session.agent,label:wr(qe.session.title,qe.session.titleSource)}),Jt();break;case"copy":ue.openSession(X.agent,X.sessionId);break}},Mn=N.useMemo(()=>new Set(b.map(X=>X.sessionId).filter(X=>X.length>0)),[b]),[rr,yr]=N.useState(()=>Wt(Lg,!0,X=>X==="true")),[Gr,sr]=N.useState(()=>Wt(Ng,"cli",X=>X==="git"||X==="files"||X==="cli"||X==="plans"||X==="memory"?X:X==="conversation"?"cli":null)),[ir,Yr]=N.useState(()=>Wt(Tg,AR,X=>{const me=Number.parseInt(X,10);return Number.isFinite(me)?Math.max(me,xg):null})),[$t,Xr]=N.useState(()=>Wt(dd,!1,X=>X==="true")),[zn,kr]=N.useState(()=>Wt(hd,!0,X=>X==="true")),[Cr,li]=N.useState(()=>Wt(Rg,IR,X=>{const me=Number.parseInt(X,10);return Number.isFinite(me)?Math.min(Eg,Math.max(Sg,me)):null})),[Qr,or]=N.useState(()=>Wt(fd,!1,X=>X==="true")),[_n,Jr]=N.useState(()=>Wt(Mg,PR,X=>{const me=Number.parseInt(X,10);return Number.isFinite(me)?me:null})),[wn,Zi]=N.useState(()=>Wt(Ag,!0,X=>X!=="true")),[eo,Ts]=N.useState(!1),lr=bR(r),An=yR(r),ar=((bo=lr.status)==null?void 0:bo.scheduledMessages)===!0&&An.messages!==null,Tn=N.useMemo(()=>{const X=new Map;for(const me of b){const qe=o1(An.messages,me.terminalId);qe.length>0&&X.set(me.terminalId,qe)}return X},[An.messages,b]),[pe,He]=N.useState(null),at=N.useCallback(X=>{const me=a1(Tn.get(X)??[]);me===null?D(X):He({terminalId:X,warning:me})},[Tn,D]),[Ot,_t]=N.useState(!1),tn=lr.status!==null?lr.status.shellName:M,[xr,Sr]=N.useState(null),[Rt,Ls]=N.useState(null),cr=a.find(X=>X.id===Rt)??null;N.useEffect(()=>{Rt!==null&&((cr==null?void 0:cr.statusLine)??null)===null&&Ls(null)},[Rt,cr]);const[to,ai]=N.useState(!1);N.useEffect(()=>{Qe===null&&ai(!1)},[Qe]);const[ci,Pr]=N.useState(null),Er=rr&&oe!==null,Tr=oC(Gr,je.plansAvailable,fe.hidden),ur=Qr&&fe.isVisible("console"),Ln=oe!==null?rr||ur:rr,Kn=$t&&oe!==null,In=N.useMemo(()=>oe===null?[]:_.filter(X=>X.cwd===oe.cwd),[_,oe]),[Ns,dr]=N.useState(null),Zr=In.find(X=>X.terminalId===Ns)??In[0]??null,Rs=ct==="cli"?p:ct==="console"?(Zr==null?void 0:Zr.terminalId)??null:null,Ms=N.useCallback(X=>{Rs!==null&&r.send({type:"input",terminalId:Rs,data:X})},[r,Rs]),Bt=NE(r,p),ui=z2(r,z),As=Re?oe!==null:Er,fl=Re?ct==="files":Er&&Tr==="files",no=a2(r,As?p:null),Or=YN(r,(Re?ct==="git":Er&&Tr==="git")?p:null,no.status.updatedAt),At=XN(r,$,x),zt=QN(r,$,x),{closeChanges:pl}=zt;N.useEffect(()=>pl(),[p,pl]);const Br=X=>X.split(/[\\/]/).filter(me=>me.length>0).pop()??X,hi=X=>{var me;return((me=a.find(qe=>qe.id===X))==null?void 0:me.label)??X},Is=X=>{var qe;const me=xs(X);At.openMove({terminalId:X.terminalId,tabBranch:((qe=X.worktree)==null?void 0:qe.branch)??null},me,Br(me))},fi=oe===null||!F_(oe,je.moveToWorktree)?null:()=>Is(oe),ml=X=>{const me=RL(b,X,qe=>Up(v(qe)).moveToWorktree);return me===null?null:()=>{rt(),Ae(me.terminalId),Is(me)}},Vn=((yo=At.create)==null?void 0:yo.move)??null,ro=Vn===null?null:Vb(z.get(Vn.terminalId)??null,Vn.terminalId===p&&Bt.queue.length>0),pi={rows:Or.rows,kept:Or.kept,rowsStale:Or.stale,onDeleteBranch:X=>At.openDeleteBranch(X.id,X.branch),onNew:()=>{if(oe===null)return;const X=xs(oe);At.openCreate({kind:"terminal",terminalId:oe.terminalId},X,Br(X))},onMove:fi,onOpen:X=>{const me=Dr(X.path,d),qe=b.find(Jt=>Dr(Jt.cwd,d)===me&&!Jt.review);qe!==void 0?Ae(qe.terminalId):R({cwd:X.path})},onRemove:X=>At.openRemove(X.id,X.branch??Br(X.path)),changes:zt.changes,onViewChanges:X=>zt.openChanges(X.id,X.branch??Br(X.path)),onOpenChangeDiff:zt.openChangeDiff,onCloseChangeDiff:zt.closeChangeDiff,onCloseChanges:zt.closeChanges,onRequestReview:X=>zt.openReview(X.id,X.branch??Br(X.path),oe===null?X.path:xs(oe)),onSendReview:X=>zt.sendReview(X.id),onShowReviewer:X=>Ae(X),onCatchUp:X=>zt.catchUp(X.id),onIntegrate:X=>zt.openIntegrate(X.id,X.branch??Br(X.path)),agentLabel:hi},gl=(()=>{var Jt;const X=At.create;if(X===null)return null;const{source:me}=X;if(me.kind==="terminal")return((Jt=b.find(ln=>ln.terminalId===me.terminalId))==null?void 0:Jt.agent)??y;const qe=T.find(ln=>ln.key===me.projectKey);return qe===void 0?y:zp(b,qe,d,a,y)})(),mi=N5(r,fl?p:null,(oe==null?void 0:oe.cwd)??null),js=M5(r,p),so=X5(r,b,p,Ue),pn=h2(r,As?p:null,(oe==null?void 0:oe.cwd)??null),es=Re?ct==="cli":Er&&Tr==="cli",gi=Bt.usage.lastModel,ts=zk(Bt.events,Bt.usage.lastEffort,(oe==null?void 0:oe.launchedAt)??null),vl=gi??Bt.defaults.model,vi=ts??Bt.defaults.effort,io=gi===null&&vl!==null,Ds=ts===null&&vi!==null,Ps=T5(r,p,es),Gn=p===null?null:z.get(p)??null,_l=jC(Le,Bt.openToolCall,(Ke==null?void 0:Ke.label)??null,(oe==null?void 0:oe.alive)??!1,Gn),oo=DC({offlineReason:p===null?null:q.get(p)??null,alive:(oe==null?void 0:oe.alive)??!1,relaunching:p!==null&&K.has(p)}),lo=oo===null?null:PC((Ke==null?void 0:Ke.label)??null),ao=lo??_l??HC(Le,Bt.waitingFor,(oe==null?void 0:oe.alive)??!1),Ja=!Dg(Le,Gn),Za=N.useMemo(()=>mv(a,De),[a,De]),wl=oe!==null&&MC(De,oe.sessionId,Le),Lr=p===null?null:Z.get(p)??null,ec=Lr===null?null:{text:xC(al(Lr.sourceAgent,a),Lr.includedTurns,Lr.totalTurns,Lr.totalTurnsIsMinimum),status:Lr.prefillReason!==null?LC(Lr.prefillReason):Lr.delivery==="sending"&&Bt.events.length===0?SC():null},co=p===null?void 0:we.get(p),tc=ec??(co===void 0?null:{text:co==="stopped-early"?TC():EC((Ke==null?void 0:Ke.label)??null),status:null}),bl=N.useCallback(X=>{re(X),_e(X)},[re,_e]),ns=N.useCallback(()=>{yr(X=>{const me=!X;return jt(Lg,String(me)),me})},[]),yl=N.useCallback(()=>{kr(X=>{const me=!X;return jt(hd,String(me)),me})},[]),Os=N.useCallback(()=>{Re||(kr(!1),jt(hd,"false"))},[Re]),nc=N.useCallback(()=>{or(X=>{const me=!X;return jt(fd,String(me)),me})},[]),uo=N.useCallback(X=>{sr(X),jt(Ng,X)},[]),rc=N.useCallback(()=>{Xr(X=>{const me=!X;return jt(dd,String(me)),me})},[]),Bs=LR(r),{open:kl}=Bs,sc=N.useCallback(X=>{p!==null&&kl(p,X)},[kl,p]),ic=N.useCallback(X=>{p!==null&&r.send({type:"input",terminalId:p,data:`${X} `})},[r,p]),_i=N.useRef(null),oc=N.useCallback(X=>{var me;return(me=_i.current)==null?void 0:me.call(_i,X,!Re)},[Re]),ho=N.useRef(null),Cl=X=>{if(so.files.open({key:X,title:X.split("/").pop()??X}),Re){Tt("files");return}Er||ns(),uo("files")},wi=N.useRef(Cl);wi.current=Cl;const Fs=N.useCallback(X=>wi.current(X),[]),lc=N.useMemo(()=>b.map(X=>X.terminalId),[b]),fo=N.useCallback(X=>{p!==null&&r.send({type:"files.reveal",terminalId:p,path:X})},[r,p]),xl=l2({connection:r,agent:De,enabled:Be&&fe.isVisible("files"),terminalId:p,cwd:(oe==null?void 0:oe.cwd)??"",platform:d,events:Bt.events,liveTerminalIds:lc,onOpen:Fs,onOpenFolder:ge?null:fo}),bi=N.useCallback(X=>{p!==null&&r.send({type:"agent.submit",terminalId:p,text:X,images:[],keepDraft:!0})},[r,p]),Hs=Hk(De),Sl=N.useMemo(()=>{if(Hs===null||oe===null)return null;const X=oe.alive?Gn==="busy"||Gn==="waiting"?f("meter.compactBusy"):null:f("meter.compactNoCli");return{command:Hs,blockedReason:X,onCompact:()=>bi(Hs)}},[Hs,oe,Gn,bi,t]),rs=N.useCallback(()=>{or(!0),jt(fd,"true");const X=pS({cwd:(oe==null?void 0:oe.cwd)??null,shellCwds:_.map(me=>me.cwd),shellAvailable:tn!==null});X!==null&&I(X)},[oe,_,tn,I]),po=N.useCallback(X=>{if(X==="console")for(const me of _)D(me.terminalId);fe.setVisible(X,!1),!Wt(Ig,!1,me=>me==="true")&&(jt(Ig,"true"),Sr(X))},[_,D,fe]),ac=N.useCallback(()=>{for(const X of _)D(X.terminalId);fe.setVisible("console",!1)},[_,D,fe]),El=N.useRef(new Set);N.useEffect(()=>{const X=In.filter(qe=>!El.current.has(qe.terminalId));for(const qe of In)El.current.add(qe.terminalId);const me=X[X.length-1];me!==void 0&&dr(me.terminalId)},[In]);const Tl=N.useCallback(()=>{oe!==null&&I(oe.cwd)},[oe,I]),Ll=Oa({min:xg,max:MR,value:ir,measure:N.useCallback(X=>window.innerWidth-X.clientX,[]),onChange:Yr,onCommit:N.useCallback(X=>jt(Tg,String(X)),[]),onStart:N.useCallback(()=>{Xr(!1),jt(dd,"false")},[])}),Us=Oa({min:Sg,max:Eg,value:Cr,measure:N.useCallback(X=>X.clientX,[]),onChange:li,onCommit:N.useCallback(X=>jt(Rg,String(X)),[])}),ss=N.useRef(0),cc=Oa({min:jR,max:DR,value:_n,measure:N.useCallback(X=>Math.round(ss.current-X.clientY),[]),onChange:Jr,onCommit:N.useCallback(X=>jt(Mg,String(X)),[]),onStart:N.useCallback(X=>{const me=X.currentTarget.nextElementSibling;ss.current=me===null?window.innerHeight:X.clientY+me.getBoundingClientRect().height},[])}),yi=N.useCallback(()=>{Zi(!1),jt(Ag,"true")},[]),mo=N.useCallback(X=>{if(b.length===0)return;const qe=(b.findIndex(ln=>ln.terminalId===p)+X+b.length)%b.length,Jt=b[qe];Jt!==void 0&&Ae(Jt.terminalId)},[b,p,Ae]),go=N.useRef(null),$s=N.useRef(null);N.useEffect(()=>{p!==$s.current&&(go.current=$s.current,$s.current=p)},[p]);const ki=N.useCallback(()=>{const X=go.current;X===null||X===p||b.some(me=>me.terminalId===X)&&Ae(X)},[p,b,Ae]);N.useEffect(()=>{const X=me=>{if(me.key!=="Tab"||!me.shiftKey||me.altKey||me.ctrlKey||me.metaKey)return;const qe=document.activeElement;qe instanceof Element&&qe.closest(".xterm")!==null||(me.preventDefault(),me.stopPropagation(),ki())};return window.addEventListener("keydown",X,!0),()=>window.removeEventListener("keydown",X,!0)},[ki]),N.useEffect(()=>{const X=me=>{if(!me.altKey||me.ctrlKey||me.metaKey)return;const qe=me.key.toLowerCase();if(qe==="t"){c&&k.length>0&&!Gt&&(me.preventDefault(),me.stopPropagation(),R({cwd:(oe==null?void 0:oe.cwd)??k}));return}if(qe==="w"){p!==null&&(me.preventDefault(),me.stopPropagation(),at(p));return}if(qe==="p"){me.preventDefault(),me.stopPropagation(),ns();return}if(qe==="arrowright"||qe==="pagedown"){me.preventDefault(),me.stopPropagation(),mo(1);return}(qe==="arrowleft"||qe==="pageup")&&(me.preventDefault(),me.stopPropagation(),mo(-1))};return window.addEventListener("keydown",X,!0),()=>window.removeEventListener("keydown",X,!0)},[oe,p,c,at,mo,k,Gt,R,ns]);const Nl=oe===null?f("app.panel.name"):oe.label.length>0?oe.label:oe.cwd.split(/[\\/]/).filter(X=>X.length>0).pop()??oe.cwd,vo=i.jsx(tL,{projects:T,indexStatus:A,disabled:!c,onOpenProject:(X,me)=>{rt(),R({cwd:X,...me!==void 0?{agent:me}:{},onOpened:Os})},agents:a,offerAgentChoice:o,agentForProject:X=>zp(b,X,d,a,y),onOpenSession:(X,me)=>{rt(),R({cwd:X,resumeSessionId:me.sessionId,agent:me.agent,label:wr(me.title,me.titleSource)})},canResume:X=>qp(a,X),platform:d,onRefresh:O,openSessionIds:Mn,openBlocked:X=>Yp(g,X,d),onArchive:h,onHide:Re?rt:yl,width:Cr,onNewProject:()=>{rt(),Pr("project")},vault:ue.status,onOpenVault:()=>{rt(),ft(!0)},onOpenVaultSession:ge?null:X=>ue.openSession(X.agent,X.sessionId),onExportProject:ge?null:ue.exportProject,exporting:ue.exporting,lastExported:ue.lastExported,onNewWorktree:X=>{rt(),At.openCreate({kind:"project",projectKey:X.key},X.cwd,Br(X.cwd),Os)},onReopenWorktree:(X,me)=>{var qe;rt(),At.reopen(X.agent,X.sessionId,me.cwd,((qe=X.worktree)==null?void 0:qe.branch)??"")},onLocateProject:ge?null:X=>{rt(),et.begin(X)},onRemoveLocation:ge?null:et.remove,removingLocation:et.removing,moveToBranchOf:ml,onContinueSession:(X,me)=>{rt(),H({agent:X.agent,sessionId:X.sessionId},me,Vp(wr(X.title,X.titleSource)))},globalSearch:be?{...ke,vaultEnabled:((ko=ue.status)==null?void 0:ko.enabled)===!0}:null,onOpenSearchHit:(X,me)=>{rt(),Yt(X,me)}}),_o=i.jsx("div",{className:"chat-stack",children:b.length===0?i.jsxs("div",{className:"empty-state",children:[i.jsx("p",{children:f("app.empty.noTabs")}),i.jsx("p",{className:"empty-hint",children:f("app.empty.hint")}),c&&k.length>0&&i.jsx("button",{className:"primary-button",onClick:()=>R({cwd:k}),disabled:Gt,title:Ie??void 0,children:Gt?f("app.empty.opening"):f("app.empty.newSession",{cwd:k})})]}):i.jsx(FE,{view:Bt,terminalId:p,threadFont:yt,threadTools:Ce,fileLinks:xl,onRewind:je.rewind&&(oe==null?void 0:oe.alive)===!0?sc:void 0,rewindBlocked:Gn!=="idle",forceSendAvailable:je.forceSend&&(oe==null?void 0:oe.alive)===!0,queueEditAvailable:je.editQueue&&(oe==null?void 0:oe.alive)===!0,questionsAnswerable:je.questionsAnswerable,contextWindowSource:je.contextWindowSource,instructionsFile:Kk(De),onGoToCli:()=>{if(Re){Tt("cli");return}Er||ns(),uo("cli")},cliPresence:oe===null||oe.alive?"live":oe.sleeping?"sleeping":"exited",cliLaunchedAt:(oe==null?void 0:oe.launchedAt)??null,exitCode:(oe==null?void 0:oe.exitCode)??null,waking:p!==null&&F.has(p),onWakeCli:()=>{p!==null&&P(p)},discovering:wl,continueTargets:Za,continueBlockedReason:CC((oe==null?void 0:oe.sessionId)??"",wl,Bt.events.length>0),onContinue:oe===null||De===null?void 0:X=>H({agent:De,sessionId:oe.sessionId},X,Vp(kt??oe.label)),onMoveToBranch:fi??void 0,searchRequest:lt,onSearchRequestApplied:Nt,toolCallNotice:_l,serverClosed:oo===null||lo===null?null:{state:oo,text:lo},statusLineState:(xt==null?void 0:xt.state)??null,onConfigureStatusLine:xt===null||Ke===null?void 0:()=>Ls(Ke.id),activity:Gn,receipt:p===null?null:ui.receipts.get(p)??null,clock:p===null?null:ui.clocks.get(p)??null,takeNotice:pt.takeNotice,planWindows:dt,planSetupState:(Qe==null?void 0:Qe.state)??null,onConfigurePlanLimits:Qe===null?void 0:()=>ai(!0),compactAction:Sl,scheduled:p===null?void 0:Tn.get(p),onCancelScheduled:An.cancel,onSendScheduledNow:ar?An.sendNow:void 0})}),Rl=i.jsx(i.Fragment,{children:oe!==null&&i.jsx($1,{connection:r,drafts:ye,terminalId:p,alive:oe.alive,nativeVoice:ge||Re?null:Le.nativeVoice??null,voiceBlocked:Bt.waitingFor!==null,sleeping:oe.sleeping,projectColor:oi(xs(oe)),activity:z.get(oe.terminalId),imagesAllowed:je.imagesAllowed,blockedReason:ao,prefills:te,onPrefillApplied:ee,notice:tc,onDismissNotice:p===null?void 0:()=>bl(p),suggestion:p===null?null:Q.get(p)??null,onSubmitted:(X,me,qe)=>{bl(X),Y(X);const{events:Jt}=Bt,ln=X===p?Jt[Jt.length-1]:void 0;ui.track(X,me,(ln==null?void 0:ln.eventId)??null,qe)},fontSize:yt.size,insertRef:_i,noteInsertRef:ho,onEditQueue:je.editQueue&&oe.alive&&Bt.queue.some(X=>X.sent!==!0)&&Bt.queue.every(X=>X.sent===!0||X.forced!==!0)&&Bt.waitingFor===null&&!Bt.editingQueue?Bt.editQueue:void 0,onSchedule:ar&&je.scheduledSend?An.schedule:void 0,codexQueueAvailable:je.codexNativeQueue&&oe.alive&&Gn==="busy",codexQueueSessionId:oe.sessionId,leading:je.modeCycle===null&&!je.codexPermissions?void 0:i.jsxs(i.Fragment,{children:[je.codexPermissions&&i.jsx(XC,{disabled:!oe.alive||Gn==="waiting"||Bt.waitingFor!==null||nt,state:Bt.codexPermissions,request:Bt.codexPermissionRequest,onChange:Bt.requestCodexPermissions}),je.modeCycle!==null&&i.jsx(VC,{mode:Bt.permissionMode,cycle:je.modeCycle,disabled:!oe.alive,waitingFor:Bt.waitingFor,statusKnown:Ja,onChange:Bt.setPermissionMode})]}),controls:je.models===null&&je.efforts===null?void 0:i.jsx(KC,{models:je.models,efforts:je.efforts,model:vl,effort:vi,modelProvisional:io,effortProvisional:Ds,savesChoice:qk(De),effortCommandName:Fk(De),effortUsesModel:De==="codex",disabled:!oe.alive,onCommand:bi})})}),Ml=oe===null?null:i.jsx(y5,{tab:Re?im(ct)??Tr:Tr,plansAvailable:je.plansAvailable,hiddenTabs:fe.hidden,hidden:Re?im(ct)===null:!rr,onTabChange:Re?Tt:uo,title:Nl,cwd:oe.cwd,colorCwd:xs(oe),platform:d,cli:i.jsx("div",{className:"terminal-stack",children:b.map(X=>i.jsx(Jv,{terminalId:X.terminalId,connection:r,active:X.terminalId===p,theme:gt.resolved,autoFocus:!1},X.terminalId))}),cliUnseen:Ps,expanded:$t,onToggleExpanded:rc,git:no,worktrees:pi,files:mi,plans:js,documents:so,memory:pn,onInsert:je.fileMentions&&oe.alive?ic:void 0,onInsertPath:oc,onReveal:ge?null:fo,onHide:ns}),Al=oe===null?null:i.jsx(fS,{connection:r,shells:In,activeShellId:(Zr==null?void 0:Zr.terminalId)??null,cwd:oe.cwd,shellName:tn,theme:gt.resolved,onSelect:dr,onOpen:Tl,onCloseShell:D,onCollapse:Re?()=>Tt("chat"):nc,onHide:Re?void 0:()=>po("console"),hideCount:_.length}),Il=fe.isVisible("notes")?i.jsx(yN,{notes:$e,fill:Re||oe===null,onHide:Re?void 0:()=>po("notes"),onSendNote:oe===null||!je.noteSendable?null:X=>{const me=oe.cwd;R({cwd:me,...oe.agent!==null?{agent:oe.agent}:{},onOpened:qe=>{r.send({type:"notes.send",noteId:X,terminalId:qe.terminalId}),Re&&Tt("chat")}})},sendTargetCwd:(oe==null?void 0:oe.cwd)??null,onNoteToComposer:oe===null?null:async X=>{var xi;const me=$e.notes.find(Si=>Si.noteId===X);if(me===void 0)return;const qe=ho.current,Jt=(((xi=me.files)==null?void 0:xi.length)??0)>0?await $e.filesForComposer(me):[];if(Jt===null||qe===null||ho.current!==qe)return;const ln=Xx(me.images,$e.images,Si=>`${f("notes.imageOnly")} ${Si+1}`);qe(me.text,ln,!Re,Yx(Jt)),Re&&Tt("chat")},composerTarget:oe===null?null:cg(oe)}):null,uc=oe===null||!fe.isVisible("console")?null:i.jsx(i.Fragment,{children:ur?i.jsxs(i.Fragment,{children:[rr&&i.jsx("div",{className:"hdivider",...cc,title:f("app.divider.consoleHeight")}),i.jsx("div",{className:"console-slot",style:rr?{height:`${_n}px`}:{flex:"1 1 auto"},children:Al})]}):i.jsxs("div",{className:"strip-collapsed-row",children:[i.jsxs("button",{className:"strip-collapsed",onClick:rs,title:tn===null?f("console.openAnyIn",{cwd:oe.cwd}):f("console.openIn",{shell:tn,cwd:oe.cwd}),children:[i.jsx("span",{className:"strip-collapsed-arrow",children:"▸"}),i.jsx("span",{children:tn??f("console.name")}),In.length>0&&i.jsx("span",{className:"strip-collapsed-count",children:In.length})]}),i.jsx(Ua,{title:f("settings.hide.console"),onHide:()=>po("console"),confirmText:_.length===0?null:f("settings.panels.consoleConfirm",{count:_.length})})]})}),jn=i.jsxs(i.Fragment,{children:[l==="revoked"&&i.jsx("div",{className:"banner banner-error",children:f("app.banner.revoked")}),xr!==null&&i.jsxs("div",{className:"banner banner-notice",children:[i.jsx("span",{children:f("settings.hiddenHint",{name:f(xr==="console"?"console.name":"notes.name")})}),i.jsx("button",{className:"banner-close",onClick:()=>Sr(null),title:f("common.gotIt"),children:"×"})]}),!c&&w!==null&&i.jsx("div",{className:"banner banner-error banner-lines",children:w}),L==="child-session-marker"&&wn&&i.jsxs("div",{className:"banner banner-notice",children:[i.jsx("span",{children:vn("app.markerNotice",{variable:"CLAUDE_CODE_CHILD_SESSION"})}),i.jsx("button",{className:"banner-close",onClick:yi,title:f("common.gotIt"),children:"×"})]}),E!==null&&i.jsxs("div",{className:"banner banner-error",children:[i.jsx("span",{children:E.message}),i.jsx("button",{className:"banner-close",onClick:S,title:f("common.close"),children:"×"})]}),ue.problem!==null&&!st&&i.jsxs("div",{className:"banner banner-error",children:[i.jsx("span",{children:ue.problem}),i.jsx("button",{className:"banner-close",onClick:ue.dismissProblem,title:f("common.close"),children:"×"})]}),et.removeProblem!==null&&i.jsxs("div",{className:"banner banner-error",children:[i.jsx("span",{children:et.removeProblem}),i.jsx("button",{className:"banner-close",onClick:et.dismissRemoveProblem,title:f("common.close"),children:"×"})]}),i.jsx(ST,{})]}),hr=Bs.state,wo=i.jsxs(i.Fragment,{children:[hr!==null&&i.jsx(TR,{preview:DE(Bt.events.find(X=>X.eventId===hr.eventId)),files:jE(Bt.events,hr.eventId,(oe==null?void 0:oe.cwd)??""),running:hr.phase==="running",error:hr.error,onConfirm:Bs.confirm,onClose:Bs.close}),cr!==null&&cr.statusLine!==null&&i.jsx(Bm,{info:cr.statusLine,agentLabel:cr.label,onRefresh:U,onClose:()=>Ls(null)}),to&&Qe!==null&&Ke!==null&&i.jsx(Bm,{info:Qe,agentLabel:Ke.label,purpose:"plan-limits",onRefresh:U,onClose:()=>ai(!1)}),At.create!==null&&i.jsx(nR,{dialog:At.create,agents:a,offerAgentChoice:o,agent:gl,moveBlock:ro,onSubmit:At.submitCreate,onClose:At.closeCreate}),At.remove!==null&&i.jsx(iR,{dialog:At.remove,onConfirm:At.confirmRemove,onDiscardFiles:At.discardFiles,onAskNotes:At.askNotes,onAskCommit:At.askCommit,onRetry:At.retryRemove,onClose:At.closeRemove,scheduledCountFor:X=>X.reduce((me,qe)=>me+(Tn.get(qe)??[]).filter(Jt=>Jt.state!=="failed").length,0)}),pe!==null&&i.jsx(kR,{warning:pe.warning,onConfirm:()=>{D(pe.terminalId),He(null)},onClose:()=>He(null)}),zt.review!==null&&i.jsx(oR,{dialog:zt.review,agents:a,onSubmit:zt.submitReview,onClose:zt.closeReview}),zt.integrate!==null&&i.jsx(sR,{dialog:zt.integrate,agentLabel:hi,onConfirm:zt.confirmIntegrate,onRemove:()=>{const X=zt.integrate;zt.closeIntegrate(),X!==null&&At.openRemove(X.worktreeId,X.branch)},onClose:zt.closeIntegrate}),At.deleteBranch!==null&&i.jsx(rR,{dialog:At.deleteBranch,onConfirm:At.confirmDeleteBranch,onClose:At.closeDeleteBranch}),Ot&&i.jsx(wR,{onClose:()=>_t(!1),terminalTheme:gt,panels:fe,consoleCount:Re?0:_.length,onHideConsole:ac,appSettings:lr,agents:a,remoteClient:ge,onOpenVault:()=>{_t(!1),ft(!0)},onOpenRemote:tt.status!==null&&!ge?()=>{_t(!1),Pe(!0)}:null,onConfigureStatusLine:X=>{_t(!1),Ls(X)}}),eo&&i.jsx(kT,{agent:lC(De,a,y),onClose:()=>Ts(!1)}),ci==="project"&&i.jsx(Xu,{connection:r,title:f("app.picker.project.title"),confirmLabel:f("app.picker.project.confirm"),confirmTitle:X=>f("app.picker.project.confirmTitle",{path:X}),onChoose:(X,me)=>{Pr(null),R({cwd:me,onOpened:Os})},onClose:()=>Pr(null)}),st&&i.jsx(SR,{status:ue.status,agents:a,indexReady:A.state==="ready",problem:ue.problem,covered:ci==="vault",onMeasure:ue.measure,onSetEnabled:ue.setEnabled,onChangeDir:()=>Pr("vault"),onReveal:ge?null:ue.reveal,onDismissProblem:ue.dismissProblem,onClose:()=>ft(!1)}),de&&tt.status!==null&&!ge&&i.jsx(gN,{status:tt.status,pairing:tt.pairing,phonePairing:tt.phonePairing,phoneStarted:tt.phoneStarted,problem:tt.problem,platform:d,onSetEnabled:tt.setEnabled,onSetPort:tt.setPort,onStartPairing:tt.startPairing,onCancelPairing:tt.cancelPairing,onStartPhonePairing:tt.startPhonePairing,onCancelPhonePairing:tt.cancelPhonePairing,onRenameDevice:tt.renameDevice,onRevokeDevice:tt.revokeDevice,onDismissProblem:tt.dismissProblem,onClose:()=>Pe(!1)}),ci==="vault"&&i.jsx(Xu,{connection:r,title:f("app.picker.vault.title"),confirmLabel:f("app.picker.vault.confirm"),confirmTitle:X=>f("app.picker.vault.confirmTitle",{path:X}),onChoose:X=>{ue.chooseDir(X),Pr(null)},onClose:()=>Pr(null)}),et.step.kind==="choosing"&&i.jsx(Xu,{connection:r,title:f("app.picker.location.title"),confirmLabel:f("app.picker.location.confirm"),confirmTitle:X=>f("app.picker.location.confirmTitle",{path:X}),onChoose:X=>et.choose(X),onClose:et.cancel}),et.step.kind!=="idle"&&et.step.kind!=="choosing"&&i.jsx(xR,{step:et.step,onConfirm:et.confirm,onChooseAnother:et.chooseAnother,onCancel:et.cancel})]});return Re?i.jsxs("div",{className:"app app-narrow",children:[i.jsx(TN,{banners:jn,status:l,statusLabel:f(Cg[l]),terminals:b,activeTerminalId:p,activity:z,agents:a,offerAgentChoice:o,newTabAgent:Ft,platform:d,canOpen:c&&k.length>0,newTabBlockedTitle:Ie,onSelectTab:Ae,onCloseTab:at,scheduled:Tn,onRenameTab:V,onNewTab:X=>R({cwd:St,...X!==void 0?{agent:X}:{}}),drawer:vo,drawerOpen:ht,onDrawerChange:ve,menu:{cwd:(oe==null?void 0:oe.cwd)??null,cliVersion:m,themeIcon:sg[ze.preference],themeTitle:rg(ze.preference),onCycleTheme:ze.cycle,sound:pt,remote:tt.status!==null&&!ge?{title:`${f("app.header.remoteAccess")} — ${$d(tt.status.state,tt.status.port)}`,active:fg(tt.status),onOpen:()=>Pe(!0)}:null,remoteClient:ge,onShortcuts:()=>Ts(!0),onSettings:()=>_t(!0)},view:ct,views:Ge,onViewChange:Tt,badges:{changes:W_(no.status),plans:js.plans.length,memory:((Ci=pn.status)==null?void 0:Ci.installed)===!0?pn.status.notes.length:0,cliUnseen:Ps},chat:i.jsxs(i.Fragment,{children:[_o,Rl]}),panel:Ml,notes:Il,console:Al,onTerminalKey:Rs===null?null:Ms}),wo]}):i.jsxs("div",{className:"app",children:[i.jsxs("header",{className:"app-header",children:[i.jsx("span",{className:"app-name",children:"Agent Workbench"}),i.jsx("span",{className:`status status-${l}`,children:f(Cg[l])}),oe!==null&&i.jsx("span",{className:"meta",title:oe.cwd,children:oe.cwd}),i.jsx("span",{className:"header-spacer"}),m!==null&&i.jsx("span",{className:"meta meta-dim",children:f("app.header.cliVersion",{version:m})}),i.jsx("button",{className:"icon-button",onClick:ze.cycle,title:rg(ze.preference),children:sg[ze.preference]}),i.jsx(tw,{sound:pt}),i.jsx(nw,{notify:pt.notify}),tt.status!==null&&!ge&&i.jsx("button",{className:`icon-button${fg(tt.status)?" icon-button-on":""}`,onClick:()=>Pe(!0),title:`${f("app.header.remoteAccess")} — ${$d(tt.status.state,tt.status.port)}`,children:"⇄"}),ge&&i.jsx("span",{className:"remote-badge",title:f("app.header.remoteBadgeTitle"),children:f("app.header.remoteBadge")}),i.jsx("button",{className:"icon-button",onClick:()=>_t(!0),title:f("settings.open"),"aria-label":f("settings.open"),children:"⚙"}),i.jsx("button",{className:"icon-button",onClick:()=>Ts(!0),title:f("app.header.shortcuts"),children:"?"})]}),jn,i.jsxs("div",{className:"app-body",children:[!zn&&i.jsxs("button",{className:"panel-peek panel-peek-left",onClick:yl,title:f("app.sidebar.show"),children:[i.jsx("span",{className:"panel-peek-arrow",children:"»"}),i.jsx("span",{className:"panel-peek-label",children:f("app.sidebar.name")})]}),zn&&vo,zn&&i.jsx("div",{className:"divider",...Us,title:f("app.divider.width")}),i.jsxs("main",{className:`workspace${Kn&&Ln?" workspace-narrow":""}`,children:[i.jsx(E5,{terminals:b,activeTerminalId:p,activity:z,attention:pt.attention,canOpen:c&&k.length>0,onSelect:Ae,onClose:at,scheduled:Tn,onRename:V,onReorder:W,onNew:X=>R({cwd:St,...X!==void 0?{agent:X}:{}}),agents:a,offerAgentChoice:o,newTabAgent:Ft,pendingOpens:g,platform:d,newTabBlockedTitle:Ie,sessionTitles:Lt}),_o,Rl]}),i.jsxs(i.Fragment,{children:[!Ln&&i.jsxs("button",{className:"panel-peek",onClick:ns,title:f("app.panel.show"),children:[i.jsx("span",{className:"panel-peek-arrow",children:"«"}),i.jsx("span",{className:"panel-peek-label",children:f("app.panel.name")})]}),Ln&&i.jsx("div",{className:"divider",...Ll,title:f("app.divider.width")}),i.jsxs("div",{className:`panel-slot${Ln?"":" panel-slot-collapsed"}${Ln&&Kn?" panel-slot-expanded":""}`,style:Ln&&!Kn?{width:`${ir}px`}:void 0,children:[oe!==null&&i.jsxs(i.Fragment,{children:[Ml,uc]}),Il]})]})]}),wo]})}const dw=document.getElementById("root");if(dw===null)throw new Error("Falta el contenedor #root.");const BR=fb.createRoot(dw);oE().then(()=>BR.render(i.jsx(OR,{})));export{ib as g};
|