agent-workbench 0.4.1 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,139 +0,0 @@
1
- var e_=Object.defineProperty;var t_=(n,r,o)=>r in n?e_(n,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[r]=o;var Mt=(n,r,o)=>t_(n,typeof r!="symbol"?r+"":r,o);(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const w of document.querySelectorAll('link[rel="modulepreload"]'))p(w);new MutationObserver(w=>{for(const A of w)if(A.type==="childList")for(const L of A.addedNodes)L.tagName==="LINK"&&L.rel==="modulepreload"&&p(L)}).observe(document,{childList:!0,subtree:!0});function o(w){const A={};return w.integrity&&(A.integrity=w.integrity),w.referrerPolicy&&(A.referrerPolicy=w.referrerPolicy),w.crossOrigin==="use-credentials"?A.credentials="include":w.crossOrigin==="anonymous"?A.credentials="omit":A.credentials="same-origin",A}function p(w){if(w.ep)return;w.ep=!0;const A=o(w);fetch(w.href,A)}})();function n_(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Xl={exports:{}},Di={},Ql={exports:{}},et={};/**
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 fd;function r_(){if(fd)return et;fd=1;var n=Symbol.for("react.element"),r=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),p=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),A=Symbol.for("react.provider"),L=Symbol.for("react.context"),s=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),_=Symbol.for("react.lazy"),u=Symbol.iterator;function y($){return $===null||typeof $!="object"?null:($=u&&$[u]||$["@@iterator"],typeof $=="function"?$:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,g={};function a($,V,ne){this.props=$,this.context=V,this.refs=g,this.updater=ne||S}a.prototype.isReactComponent={},a.prototype.setState=function($,V){if(typeof $!="object"&&typeof $!="function"&&$!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,$,V,"setState")},a.prototype.forceUpdate=function($){this.updater.enqueueForceUpdate(this,$,"forceUpdate")};function f(){}f.prototype=a.prototype;function d($,V,ne){this.props=$,this.context=V,this.refs=g,this.updater=ne||S}var h=d.prototype=new f;h.constructor=d,E(h,a.prototype),h.isPureReactComponent=!0;var C=Array.isArray,D=Object.prototype.hasOwnProperty,x={current:null},M={key:!0,ref:!0,__self:!0,__source:!0};function b($,V,ne){var se,ce={},he=null,K=null;if(V!=null)for(se in V.ref!==void 0&&(K=V.ref),V.key!==void 0&&(he=""+V.key),V)D.call(V,se)&&!M.hasOwnProperty(se)&&(ce[se]=V[se]);var W=arguments.length-2;if(W===1)ce.children=ne;else if(1<W){for(var J=Array(W),Z=0;Z<W;Z++)J[Z]=arguments[Z+2];ce.children=J}if($&&$.defaultProps)for(se in W=$.defaultProps,W)ce[se]===void 0&&(ce[se]=W[se]);return{$$typeof:n,type:$,key:he,ref:K,props:ce,_owner:x.current}}function T($,V){return{$$typeof:n,type:$.type,key:V,ref:$.ref,props:$.props,_owner:$._owner}}function N($){return typeof $=="object"&&$!==null&&$.$$typeof===n}function F($){var V={"=":"=0",":":"=2"};return"$"+$.replace(/[=:]/g,function(ne){return V[ne]})}var P=/\/+/g;function B($,V){return typeof $=="object"&&$!==null&&$.key!=null?F(""+$.key):V.toString(36)}function H($,V,ne,se,ce){var he=typeof $;(he==="undefined"||he==="boolean")&&($=null);var K=!1;if($===null)K=!0;else switch(he){case"string":case"number":K=!0;break;case"object":switch($.$$typeof){case n:case r:K=!0}}if(K)return K=$,ce=ce(K),$=se===""?"."+B(K,0):se,C(ce)?(ne="",$!=null&&(ne=$.replace(P,"$&/")+"/"),H(ce,V,ne,"",function(Z){return Z})):ce!=null&&(N(ce)&&(ce=T(ce,ne+(!ce.key||K&&K.key===ce.key?"":(""+ce.key).replace(P,"$&/")+"/")+$)),V.push(ce)),1;if(K=0,se=se===""?".":se+":",C($))for(var W=0;W<$.length;W++){he=$[W];var J=se+B(he,W);K+=H(he,V,ne,J,ce)}else if(J=y($),typeof J=="function")for($=J.call($),W=0;!(he=$.next()).done;)he=he.value,J=se+B(he,W++),K+=H(he,V,ne,J,ce);else if(he==="object")throw V=String($),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys($).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.");return K}function q($,V,ne){if($==null)return $;var se=[],ce=0;return H($,se,"","",function(he){return V.call(ne,he,ce++)}),se}function X($){if($._status===-1){var V=$._result;V=V(),V.then(function(ne){($._status===0||$._status===-1)&&($._status=1,$._result=ne)},function(ne){($._status===0||$._status===-1)&&($._status=2,$._result=ne)}),$._status===-1&&($._status=0,$._result=V)}if($._status===1)return $._result.default;throw $._result}var G={current:null},Y={transition:null},j={ReactCurrentDispatcher:G,ReactCurrentBatchConfig:Y,ReactCurrentOwner:x};function U(){throw Error("act(...) is not supported in production builds of React.")}return et.Children={map:q,forEach:function($,V,ne){q($,function(){V.apply(this,arguments)},ne)},count:function($){var V=0;return q($,function(){V++}),V},toArray:function($){return q($,function(V){return V})||[]},only:function($){if(!N($))throw Error("React.Children.only expected to receive a single React element child.");return $}},et.Component=a,et.Fragment=o,et.Profiler=w,et.PureComponent=d,et.StrictMode=p,et.Suspense=c,et.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=j,et.act=U,et.cloneElement=function($,V,ne){if($==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+$+".");var se=E({},$.props),ce=$.key,he=$.ref,K=$._owner;if(V!=null){if(V.ref!==void 0&&(he=V.ref,K=x.current),V.key!==void 0&&(ce=""+V.key),$.type&&$.type.defaultProps)var W=$.type.defaultProps;for(J in V)D.call(V,J)&&!M.hasOwnProperty(J)&&(se[J]=V[J]===void 0&&W!==void 0?W[J]:V[J])}var J=arguments.length-2;if(J===1)se.children=ne;else if(1<J){W=Array(J);for(var Z=0;Z<J;Z++)W[Z]=arguments[Z+2];se.children=W}return{$$typeof:n,type:$.type,key:ce,ref:he,props:se,_owner:K}},et.createContext=function($){return $={$$typeof:L,_currentValue:$,_currentValue2:$,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},$.Provider={$$typeof:A,_context:$},$.Consumer=$},et.createElement=b,et.createFactory=function($){var V=b.bind(null,$);return V.type=$,V},et.createRef=function(){return{current:null}},et.forwardRef=function($){return{$$typeof:s,render:$}},et.isValidElement=N,et.lazy=function($){return{$$typeof:_,_payload:{_status:-1,_result:$},_init:X}},et.memo=function($,V){return{$$typeof:m,type:$,compare:V===void 0?null:V}},et.startTransition=function($){var V=Y.transition;Y.transition={};try{$()}finally{Y.transition=V}},et.unstable_act=U,et.useCallback=function($,V){return G.current.useCallback($,V)},et.useContext=function($){return G.current.useContext($)},et.useDebugValue=function(){},et.useDeferredValue=function($){return G.current.useDeferredValue($)},et.useEffect=function($,V){return G.current.useEffect($,V)},et.useId=function(){return G.current.useId()},et.useImperativeHandle=function($,V,ne){return G.current.useImperativeHandle($,V,ne)},et.useInsertionEffect=function($,V){return G.current.useInsertionEffect($,V)},et.useLayoutEffect=function($,V){return G.current.useLayoutEffect($,V)},et.useMemo=function($,V){return G.current.useMemo($,V)},et.useReducer=function($,V,ne){return G.current.useReducer($,V,ne)},et.useRef=function($){return G.current.useRef($)},et.useState=function($){return G.current.useState($)},et.useSyncExternalStore=function($,V,ne){return G.current.useSyncExternalStore($,V,ne)},et.useTransition=function(){return G.current.useTransition()},et.version="18.3.1",et}var pd;function zc(){return pd||(pd=1,Ql.exports=r_()),Ql.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 md;function s_(){if(md)return Di;md=1;var n=zc(),r=Symbol.for("react.element"),o=Symbol.for("react.fragment"),p=Object.prototype.hasOwnProperty,w=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,A={key:!0,ref:!0,__self:!0,__source:!0};function L(s,c,m){var _,u={},y=null,S=null;m!==void 0&&(y=""+m),c.key!==void 0&&(y=""+c.key),c.ref!==void 0&&(S=c.ref);for(_ in c)p.call(c,_)&&!A.hasOwnProperty(_)&&(u[_]=c[_]);if(s&&s.defaultProps)for(_ in c=s.defaultProps,c)u[_]===void 0&&(u[_]=c[_]);return{$$typeof:r,type:s,key:y,ref:S,props:u,_owner:w.current}}return Di.Fragment=o,Di.jsx=L,Di.jsxs=L,Di}var gd;function i_(){return gd||(gd=1,Xl.exports=s_()),Xl.exports}var l=i_(),ta={},Jl={exports:{}},tn={},Zl={exports:{}},ec={};/**
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 _d;function o_(){return _d||(_d=1,(function(n){function r(Y,j){var U=Y.length;Y.push(j);e:for(;0<U;){var $=U-1>>>1,V=Y[$];if(0<w(V,j))Y[$]=j,Y[U]=V,U=$;else break e}}function o(Y){return Y.length===0?null:Y[0]}function p(Y){if(Y.length===0)return null;var j=Y[0],U=Y.pop();if(U!==j){Y[0]=U;e:for(var $=0,V=Y.length,ne=V>>>1;$<ne;){var se=2*($+1)-1,ce=Y[se],he=se+1,K=Y[he];if(0>w(ce,U))he<V&&0>w(K,ce)?(Y[$]=K,Y[he]=U,$=he):(Y[$]=ce,Y[se]=U,$=se);else if(he<V&&0>w(K,U))Y[$]=K,Y[he]=U,$=he;else break e}}return j}function w(Y,j){var U=Y.sortIndex-j.sortIndex;return U!==0?U:Y.id-j.id}if(typeof performance=="object"&&typeof performance.now=="function"){var A=performance;n.unstable_now=function(){return A.now()}}else{var L=Date,s=L.now();n.unstable_now=function(){return L.now()-s}}var c=[],m=[],_=1,u=null,y=3,S=!1,E=!1,g=!1,a=typeof setTimeout=="function"?setTimeout:null,f=typeof clearTimeout=="function"?clearTimeout:null,d=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function h(Y){for(var j=o(m);j!==null;){if(j.callback===null)p(m);else if(j.startTime<=Y)p(m),j.sortIndex=j.expirationTime,r(c,j);else break;j=o(m)}}function C(Y){if(g=!1,h(Y),!E)if(o(c)!==null)E=!0,X(D);else{var j=o(m);j!==null&&G(C,j.startTime-Y)}}function D(Y,j){E=!1,g&&(g=!1,f(b),b=-1),S=!0;var U=y;try{for(h(j),u=o(c);u!==null&&(!(u.expirationTime>j)||Y&&!F());){var $=u.callback;if(typeof $=="function"){u.callback=null,y=u.priorityLevel;var V=$(u.expirationTime<=j);j=n.unstable_now(),typeof V=="function"?u.callback=V:u===o(c)&&p(c),h(j)}else p(c);u=o(c)}if(u!==null)var ne=!0;else{var se=o(m);se!==null&&G(C,se.startTime-j),ne=!1}return ne}finally{u=null,y=U,S=!1}}var x=!1,M=null,b=-1,T=5,N=-1;function F(){return!(n.unstable_now()-N<T)}function P(){if(M!==null){var Y=n.unstable_now();N=Y;var j=!0;try{j=M(!0,Y)}finally{j?B():(x=!1,M=null)}}else x=!1}var B;if(typeof d=="function")B=function(){d(P)};else if(typeof MessageChannel<"u"){var H=new MessageChannel,q=H.port2;H.port1.onmessage=P,B=function(){q.postMessage(null)}}else B=function(){a(P,0)};function X(Y){M=Y,x||(x=!0,B())}function G(Y,j){b=a(function(){Y(n.unstable_now())},j)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(Y){Y.callback=null},n.unstable_continueExecution=function(){E||S||(E=!0,X(D))},n.unstable_forceFrameRate=function(Y){0>Y||125<Y?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):T=0<Y?Math.floor(1e3/Y):5},n.unstable_getCurrentPriorityLevel=function(){return y},n.unstable_getFirstCallbackNode=function(){return o(c)},n.unstable_next=function(Y){switch(y){case 1:case 2:case 3:var j=3;break;default:j=y}var U=y;y=j;try{return Y()}finally{y=U}},n.unstable_pauseExecution=function(){},n.unstable_requestPaint=function(){},n.unstable_runWithPriority=function(Y,j){switch(Y){case 1:case 2:case 3:case 4:case 5:break;default:Y=3}var U=y;y=Y;try{return j()}finally{y=U}},n.unstable_scheduleCallback=function(Y,j,U){var $=n.unstable_now();switch(typeof U=="object"&&U!==null?(U=U.delay,U=typeof U=="number"&&0<U?$+U:$):U=$,Y){case 1:var V=-1;break;case 2:V=250;break;case 5:V=1073741823;break;case 4:V=1e4;break;default:V=5e3}return V=U+V,Y={id:_++,callback:j,priorityLevel:Y,startTime:U,expirationTime:V,sortIndex:-1},U>$?(Y.sortIndex=U,r(m,Y),o(c)===null&&Y===o(m)&&(g?(f(b),b=-1):g=!0,G(C,U-$))):(Y.sortIndex=V,r(c,Y),E||S||(E=!0,X(D))),Y},n.unstable_shouldYield=F,n.unstable_wrapCallback=function(Y){var j=y;return function(){var U=y;y=j;try{return Y.apply(this,arguments)}finally{y=U}}}})(ec)),ec}var vd;function a_(){return vd||(vd=1,Zl.exports=o_()),Zl.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 yd;function l_(){if(yd)return tn;yd=1;var n=zc(),r=a_();function o(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,i=1;i<arguments.length;i++)t+="&args[]="+encodeURIComponent(arguments[i]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var p=new Set,w={};function A(e,t){L(e,t),L(e+"Capture",t)}function L(e,t){for(w[e]=t,e=0;e<t.length;e++)p.add(t[e])}var s=!(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]*$/,_={},u={};function y(e){return c.call(u,e)?!0:c.call(_,e)?!1:m.test(e)?u[e]=!0:(_[e]=!0,!1)}function S(e,t,i,v){if(i!==null&&i.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return v?!1:i!==null?!i.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function E(e,t,i,v){if(t===null||typeof t>"u"||S(e,t,i,v))return!0;if(v)return!1;if(i!==null)switch(i.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function g(e,t,i,v,R,I,z){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=v,this.attributeNamespace=R,this.mustUseProperty=i,this.propertyName=e,this.type=t,this.sanitizeURL=I,this.removeEmptyString=z}var a={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){a[e]=new g(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];a[t]=new g(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){a[e]=new g(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){a[e]=new g(e,2,!1,e,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(e){a[e]=new g(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){a[e]=new g(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){a[e]=new g(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){a[e]=new g(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){a[e]=new g(e,5,!1,e.toLowerCase(),null,!1,!1)});var f=/[\-:]([a-z])/g;function d(e){return e[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(e){var t=e.replace(f,d);a[t]=new g(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(f,d);a[t]=new g(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(f,d);a[t]=new g(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){a[e]=new g(e,1,!1,e.toLowerCase(),null,!1,!1)}),a.xlinkHref=new g("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){a[e]=new g(e,1,!1,e.toLowerCase(),null,!0,!0)});function h(e,t,i,v){var R=a.hasOwnProperty(t)?a[t]:null;(R!==null?R.type!==0:v||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(E(t,i,R,v)&&(i=null),v||R===null?y(t)&&(i===null?e.removeAttribute(t):e.setAttribute(t,""+i)):R.mustUseProperty?e[R.propertyName]=i===null?R.type===3?!1:"":i:(t=R.attributeName,v=R.attributeNamespace,i===null?e.removeAttribute(t):(R=R.type,i=R===3||R===4&&i===!0?"":""+i,v?e.setAttributeNS(v,t,i):e.setAttribute(t,i))))}var C=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,D=Symbol.for("react.element"),x=Symbol.for("react.portal"),M=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),N=Symbol.for("react.provider"),F=Symbol.for("react.context"),P=Symbol.for("react.forward_ref"),B=Symbol.for("react.suspense"),H=Symbol.for("react.suspense_list"),q=Symbol.for("react.memo"),X=Symbol.for("react.lazy"),G=Symbol.for("react.offscreen"),Y=Symbol.iterator;function j(e){return e===null||typeof e!="object"?null:(e=Y&&e[Y]||e["@@iterator"],typeof e=="function"?e:null)}var U=Object.assign,$;function V(e){if($===void 0)try{throw Error()}catch(i){var t=i.stack.trim().match(/\n( *(at )?)/);$=t&&t[1]||""}return`
34
- `+$+e}var ne=!1;function se(e,t){if(!e||ne)return"";ne=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(ue){var v=ue}Reflect.construct(e,[],t)}else{try{t.call()}catch(ue){v=ue}e.call(t.prototype)}else{try{throw Error()}catch(ue){v=ue}e()}}catch(ue){if(ue&&v&&typeof ue.stack=="string"){for(var R=ue.stack.split(`
35
- `),I=v.stack.split(`
36
- `),z=R.length-1,Q=I.length-1;1<=z&&0<=Q&&R[z]!==I[Q];)Q--;for(;1<=z&&0<=Q;z--,Q--)if(R[z]!==I[Q]){if(z!==1||Q!==1)do if(z--,Q--,0>Q||R[z]!==I[Q]){var te=`
37
- `+R[z].replace(" at new "," at ");return e.displayName&&te.includes("<anonymous>")&&(te=te.replace("<anonymous>",e.displayName)),te}while(1<=z&&0<=Q);break}}}finally{ne=!1,Error.prepareStackTrace=i}return(e=e?e.displayName||e.name:"")?V(e):""}function ce(e){switch(e.tag){case 5:return V(e.type);case 16:return V("Lazy");case 13:return V("Suspense");case 19:return V("SuspenseList");case 0:case 2:case 15:return e=se(e.type,!1),e;case 11:return e=se(e.type.render,!1),e;case 1:return e=se(e.type,!0),e;default:return""}}function he(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case M:return"Fragment";case x:return"Portal";case T:return"Profiler";case b:return"StrictMode";case B:return"Suspense";case H:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case F:return(e.displayName||"Context")+".Consumer";case N:return(e._context.displayName||"Context")+".Provider";case P:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case q:return t=e.displayName||null,t!==null?t:he(e.type)||"Memo";case X:t=e._payload,e=e._init;try{return he(e(t))}catch{}}return null}function K(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return he(t);case 8:return t===b?"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 t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function W(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function J(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Z(e){var t=J(e)?"checked":"value",i=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),v=""+e[t];if(!e.hasOwnProperty(t)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var R=i.get,I=i.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return R.call(this)},set:function(z){v=""+z,I.call(this,z)}}),Object.defineProperty(e,t,{enumerable:i.enumerable}),{getValue:function(){return v},setValue:function(z){v=""+z},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function de(e){e._valueTracker||(e._valueTracker=Z(e))}function ee(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var i=t.getValue(),v="";return e&&(v=J(e)?e.checked?"true":"false":e.value),e=v,e!==i?(t.setValue(e),!0):!1}function xe(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function ke(e,t){var i=t.checked;return U({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:i??e._wrapperState.initialChecked})}function le(e,t){var i=t.defaultValue==null?"":t.defaultValue,v=t.checked!=null?t.checked:t.defaultChecked;i=W(t.value!=null?t.value:i),e._wrapperState={initialChecked:v,initialValue:i,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function we(e,t){t=t.checked,t!=null&&h(e,"checked",t,!1)}function me(e,t){we(e,t);var i=W(t.value),v=t.type;if(i!=null)v==="number"?(i===0&&e.value===""||e.value!=i)&&(e.value=""+i):e.value!==""+i&&(e.value=""+i);else if(v==="submit"||v==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?nt(e,t.type,i):t.hasOwnProperty("defaultValue")&&nt(e,t.type,W(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Qe(e,t,i){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var v=t.type;if(!(v!=="submit"&&v!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,i||t===e.value||(e.value=t),e.defaultValue=t}i=e.name,i!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,i!==""&&(e.name=i)}function nt(e,t,i){(t!=="number"||xe(e.ownerDocument)!==e)&&(i==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+i&&(e.defaultValue=""+i))}var De=Array.isArray;function Te(e,t,i,v){if(e=e.options,t){t={};for(var R=0;R<i.length;R++)t["$"+i[R]]=!0;for(i=0;i<e.length;i++)R=t.hasOwnProperty("$"+e[i].value),e[i].selected!==R&&(e[i].selected=R),R&&v&&(e[i].defaultSelected=!0)}else{for(i=""+W(i),t=null,R=0;R<e.length;R++){if(e[R].value===i){e[R].selected=!0,v&&(e[R].defaultSelected=!0);return}t!==null||e[R].disabled||(t=e[R])}t!==null&&(t.selected=!0)}}function We(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(o(91));return U({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Le(e,t){var i=t.value;if(i==null){if(i=t.children,t=t.defaultValue,i!=null){if(t!=null)throw Error(o(92));if(De(i)){if(1<i.length)throw Error(o(93));i=i[0]}t=i}t==null&&(t=""),i=t}e._wrapperState={initialValue:W(i)}}function Ke(e,t){var i=W(t.value),v=W(t.defaultValue);i!=null&&(i=""+i,i!==e.value&&(e.value=i),t.defaultValue==null&&e.defaultValue!==i&&(e.defaultValue=i)),v!=null&&(e.defaultValue=""+v)}function $e(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function tt(e){switch(e){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 St(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?tt(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var ze,ut=(function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,i,v,R){MSApp.execUnsafeLocalFunction(function(){return e(t,i,v,R)})}:e})(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(ze=ze||document.createElement("div"),ze.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=ze.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Ze(e,t){if(t){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=t;return}}e.textContent=t}var ge={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},Re=["Webkit","ms","Moz","O"];Object.keys(ge).forEach(function(e){Re.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ge[t]=ge[e]})});function rt(e,t,i){return t==null||typeof t=="boolean"||t===""?"":i||typeof t!="number"||t===0||ge.hasOwnProperty(e)&&ge[e]?(""+t).trim():t+"px"}function at(e,t){e=e.style;for(var i in t)if(t.hasOwnProperty(i)){var v=i.indexOf("--")===0,R=rt(i,t[i],v);i==="float"&&(i="cssFloat"),v?e.setProperty(i,R):e[i]=R}}var Ee=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 Ue(e,t){if(t){if(Ee[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(o(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(o(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(o(61))}if(t.style!=null&&typeof t.style!="object")throw Error(o(62))}}function fe(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var pe=null;function Me(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var lt=null,je=null,Ge=null;function ht(e){if(e=vi(e)){if(typeof lt!="function")throw Error(o(280));var t=e.stateNode;t&&(t=go(t),lt(e.stateNode,e.type,t))}}function Lt(e){je?Ge?Ge.push(e):Ge=[e]:je=e}function At(){if(je){var e=je,t=Ge;if(Ge=je=null,ht(e),t)for(e=0;e<t.length;e++)ht(t[e])}}function Zn(e,t){return e(t)}function es(){}var Mn=!1;function $n(e,t,i){if(Mn)return e(t,i);Mn=!0;try{return Zn(e,t,i)}finally{Mn=!1,(je!==null||Ge!==null)&&(es(),At())}}function Lr(e,t){var i=e.stateNode;if(i===null)return null;var v=go(i);if(v===null)return null;i=v[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(v=!v.disabled)||(e=e.type,v=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!v;break e;default:e=!1}if(e)return null;if(i&&typeof i!="function")throw Error(o(231,t,typeof i));return i}var Ks=!1;if(s)try{var Tr={};Object.defineProperty(Tr,"passive",{get:function(){Ks=!0}}),window.addEventListener("test",Tr,Tr),window.removeEventListener("test",Tr,Tr)}catch{Ks=!1}function Yi(e,t,i,v,R,I,z,Q,te){var ue=Array.prototype.slice.call(arguments,3);try{t.apply(i,ue)}catch(ve){this.onError(ve)}}var Rr=!1,Mr=null,Ar=!1,Nr=null,ya={onError:function(e){Rr=!0,Mr=e}};function Xi(e,t,i,v,R,I,z,Q,te){Rr=!1,Mr=null,Yi.apply(ya,arguments)}function wa(e,t,i,v,R,I,z,Q,te){if(Xi.apply(this,arguments),Rr){if(Rr){var ue=Mr;Rr=!1,Mr=null}else throw Error(o(198));Ar||(Ar=!0,Nr=ue)}}function un(e){var t=e,i=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(i=t.return),e=t.return;while(e)}return t.tag===3?i:null}function Qi(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function Gs(e){if(un(e)!==e)throw Error(o(188))}function ba(e){var t=e.alternate;if(!t){if(t=un(e),t===null)throw Error(o(188));return t!==e?null:e}for(var i=e,v=t;;){var R=i.return;if(R===null)break;var I=R.alternate;if(I===null){if(v=R.return,v!==null){i=v;continue}break}if(R.child===I.child){for(I=R.child;I;){if(I===i)return Gs(R),e;if(I===v)return Gs(R),t;I=I.sibling}throw Error(o(188))}if(i.return!==v.return)i=R,v=I;else{for(var z=!1,Q=R.child;Q;){if(Q===i){z=!0,i=R,v=I;break}if(Q===v){z=!0,v=R,i=I;break}Q=Q.sibling}if(!z){for(Q=I.child;Q;){if(Q===i){z=!0,i=I,v=R;break}if(Q===v){z=!0,v=I,i=R;break}Q=Q.sibling}if(!z)throw Error(o(189))}}if(i.alternate!==v)throw Error(o(190))}if(i.tag!==3)throw Error(o(188));return i.stateNode.current===i?e:t}function Ji(e){return e=ba(e),e!==null?Zi(e):null}function Zi(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Zi(e);if(t!==null)return t;e=e.sibling}return null}var eo=r.unstable_scheduleCallback,ts=r.unstable_cancelCallback,Sa=r.unstable_shouldYield,Ys=r.unstable_requestPaint,pt=r.unstable_now,er=r.unstable_getCurrentPriorityLevel,tr=r.unstable_ImmediatePriority,Dr=r.unstable_UserBlockingPriority,yn=r.unstable_NormalPriority,Xs=r.unstable_LowPriority,rn=r.unstable_IdlePriority,ns=null,sn=null;function nr(e){if(sn&&typeof sn.onCommitFiberRoot=="function")try{sn.onCommitFiberRoot(ns,e,void 0,(e.current.flags&128)===128)}catch{}}var Ft=Math.clz32?Math.clz32:Qs,Ca=Math.log,Ht=Math.LN2;function Qs(e){return e>>>=0,e===0?32:31-(Ca(e)/Ht|0)|0}var Ir=64,rs=4194304;function rr(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function ss(e,t){var i=e.pendingLanes;if(i===0)return 0;var v=0,R=e.suspendedLanes,I=e.pingedLanes,z=i&268435455;if(z!==0){var Q=z&~R;Q!==0?v=rr(Q):(I&=z,I!==0&&(v=rr(I)))}else z=i&~R,z!==0?v=rr(z):I!==0&&(v=rr(I));if(v===0)return 0;if(t!==0&&t!==v&&(t&R)===0&&(R=v&-v,I=t&-t,R>=I||R===16&&(I&4194240)!==0))return t;if((v&4)!==0&&(v|=i&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=v;0<t;)i=31-Ft(t),R=1<<i,v|=e[i],t&=~R;return v}function to(e,t){switch(e){case 1:case 2:case 4:return t+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 t+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 Js(e,t){for(var i=e.suspendedLanes,v=e.pingedLanes,R=e.expirationTimes,I=e.pendingLanes;0<I;){var z=31-Ft(I),Q=1<<z,te=R[z];te===-1?((Q&i)===0||(Q&v)!==0)&&(R[z]=to(Q,t)):te<=t&&(e.expiredLanes|=Q),I&=~Q}}function Zs(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function ei(){var e=Ir;return Ir<<=1,(Ir&4194240)===0&&(Ir=64),e}function is(e){for(var t=[],i=0;31>i;i++)t.push(e);return t}function sr(e,t,i){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ft(t),e[t]=i}function no(e,t){var i=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var v=e.eventTimes;for(e=e.expirationTimes;0<i;){var R=31-Ft(i),I=1<<R;t[R]=0,v[R]=-1,e[R]=-1,i&=~I}}function ti(e,t){var i=e.entangledLanes|=t;for(e=e.entanglements;i;){var v=31-Ft(i),R=1<<v;R&t|e[v]&t&&(e[v]|=t),i&=~R}}var ot=0;function ni(e){return e&=-e,1<e?4<e?(e&268435455)!==0?16:536870912:4:1}var os,as,ls,cs,ro,ri=!1,us=[],wn=null,Pt=null,An=null,bn=new Map,ir=new Map,Sn=[],so="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 io(e,t){switch(e){case"focusin":case"focusout":wn=null;break;case"dragenter":case"dragleave":Pt=null;break;case"mouseover":case"mouseout":An=null;break;case"pointerover":case"pointerout":bn.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ir.delete(t.pointerId)}}function Pr(e,t,i,v,R,I){return e===null||e.nativeEvent!==I?(e={blockedOn:t,domEventName:i,eventSystemFlags:v,nativeEvent:I,targetContainers:[R]},t!==null&&(t=vi(t),t!==null&&as(t)),e):(e.eventSystemFlags|=v,t=e.targetContainers,R!==null&&t.indexOf(R)===-1&&t.push(R),e)}function xa(e,t,i,v,R){switch(t){case"focusin":return wn=Pr(wn,e,t,i,v,R),!0;case"dragenter":return Pt=Pr(Pt,e,t,i,v,R),!0;case"mouseover":return An=Pr(An,e,t,i,v,R),!0;case"pointerover":var I=R.pointerId;return bn.set(I,Pr(bn.get(I)||null,e,t,i,v,R)),!0;case"gotpointercapture":return I=R.pointerId,ir.set(I,Pr(ir.get(I)||null,e,t,i,v,R)),!0}return!1}function jr(e){var t=$r(e.target);if(t!==null){var i=un(t);if(i!==null){if(t=i.tag,t===13){if(t=Qi(i),t!==null){e.blockedOn=t,ro(e.priority,function(){ls(i)});return}}else if(t===3&&i.stateNode.current.memoizedState.isDehydrated){e.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}e.blockedOn=null}function hs(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var i=Br(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(i===null){i=e.nativeEvent;var v=new i.constructor(i.type,i);pe=v,i.target.dispatchEvent(v),pe=null}else return t=vi(i),t!==null&&as(t),e.blockedOn=i,!1;t.shift()}return!0}function oo(e,t,i){hs(e)&&i.delete(t)}function ka(){ri=!1,wn!==null&&hs(wn)&&(wn=null),Pt!==null&&hs(Pt)&&(Pt=null),An!==null&&hs(An)&&(An=null),bn.forEach(oo),ir.forEach(oo)}function hn(e,t){e.blockedOn===t&&(e.blockedOn=null,ri||(ri=!0,r.unstable_scheduleCallback(r.unstable_NormalPriority,ka)))}function Or(e){function t(R){return hn(R,e)}if(0<us.length){hn(us[0],e);for(var i=1;i<us.length;i++){var v=us[i];v.blockedOn===e&&(v.blockedOn=null)}}for(wn!==null&&hn(wn,e),Pt!==null&&hn(Pt,e),An!==null&&hn(An,e),bn.forEach(t),ir.forEach(t),i=0;i<Sn.length;i++)v=Sn[i],v.blockedOn===e&&(v.blockedOn=null);for(;0<Sn.length&&(i=Sn[0],i.blockedOn===null);)jr(i),i.blockedOn===null&&Sn.shift()}var Un=C.ReactCurrentBatchConfig,ds=!0;function Ea(e,t,i,v){var R=ot,I=Un.transition;Un.transition=null;try{ot=1,si(e,t,i,v)}finally{ot=R,Un.transition=I}}function La(e,t,i,v){var R=ot,I=Un.transition;Un.transition=null;try{ot=4,si(e,t,i,v)}finally{ot=R,Un.transition=I}}function si(e,t,i,v){if(ds){var R=Br(e,t,i,v);if(R===null)Ha(e,t,v,fs,i),io(e,v);else if(xa(R,e,t,i,v))v.stopPropagation();else if(io(e,v),t&4&&-1<so.indexOf(e)){for(;R!==null;){var I=vi(R);if(I!==null&&os(I),I=Br(e,t,i,v),I===null&&Ha(e,t,v,fs,i),I===R)break;R=I}R!==null&&v.stopPropagation()}else Ha(e,t,v,null,i)}}var fs=null;function Br(e,t,i,v){if(fs=null,e=Me(v),e=$r(e),e!==null)if(t=un(e),t===null)e=null;else if(i=t.tag,i===13){if(e=Qi(t),e!==null)return e;e=null}else if(i===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return fs=e,null}function ii(e){switch(e){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(er()){case tr:return 1;case Dr:return 4;case yn:case Xs:return 16;case rn:return 536870912;default:return 16}default:return 16}}var dn=null,ps=null,ms=null;function oi(){if(ms)return ms;var e,t=ps,i=t.length,v,R="value"in dn?dn.value:dn.textContent,I=R.length;for(e=0;e<i&&t[e]===R[e];e++);var z=i-e;for(v=1;v<=z&&t[i-v]===R[I-v];v++);return ms=R.slice(e,1<v?1-v:void 0)}function Fr(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Hr(){return!0}function ai(){return!1}function $t(e){function t(i,v,R,I,z){this._reactName=i,this._targetInst=R,this.type=v,this.nativeEvent=I,this.target=z,this.currentTarget=null;for(var Q in e)e.hasOwnProperty(Q)&&(i=e[Q],this[Q]=i?i(I):I[Q]);return this.isDefaultPrevented=(I.defaultPrevented!=null?I.defaultPrevented:I.returnValue===!1)?Hr:ai,this.isPropagationStopped=ai,this}return U(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=Hr)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=Hr)},persist:function(){},isPersistent:Hr}),t}var Wn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},li=$t(Wn),or=U({},Wn,{view:0,detail:0}),ao=$t(or),gs,_s,ar,ie=U({},or,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ra,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==ar&&(ar&&e.type==="mousemove"?(gs=e.screenX-ar.screenX,_s=e.screenY-ar.screenY):_s=gs=0,ar=e),gs)},movementY:function(e){return"movementY"in e?e.movementY:_s}}),Se=$t(ie),Je=U({},ie,{dataTransfer:0}),Nn=$t(Je),zn=U({},or,{relatedTarget:0}),Ta=$t(zn),Am=U({},Wn,{animationName:0,elapsedTime:0,pseudoElement:0}),Nm=$t(Am),Dm=U({},Wn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Im=$t(Dm),Pm=U({},Wn,{data:0}),ru=$t(Pm),jm={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Om={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"},Bm={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Fm(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Bm[e])?!!t[e]:!1}function Ra(){return Fm}var Hm=U({},or,{key:function(e){if(e.key){var t=jm[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Fr(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Om[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ra,charCode:function(e){return e.type==="keypress"?Fr(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Fr(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),$m=$t(Hm),Um=U({},ie,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),su=$t(Um),Wm=U({},or,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ra}),zm=$t(Wm),Vm=U({},Wn,{propertyName:0,elapsedTime:0,pseudoElement:0}),qm=$t(Vm),Km=U({},ie,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Gm=$t(Km),Ym=[9,13,27,32],Ma=s&&"CompositionEvent"in window,ci=null;s&&"documentMode"in document&&(ci=document.documentMode);var Xm=s&&"TextEvent"in window&&!ci,iu=s&&(!Ma||ci&&8<ci&&11>=ci),ou=" ",au=!1;function lu(e,t){switch(e){case"keyup":return Ym.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function cu(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var vs=!1;function Qm(e,t){switch(e){case"compositionend":return cu(t);case"keypress":return t.which!==32?null:(au=!0,ou);case"textInput":return e=t.data,e===ou&&au?null:e;default:return null}}function Jm(e,t){if(vs)return e==="compositionend"||!Ma&&lu(e,t)?(e=oi(),ms=ps=dn=null,vs=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return iu&&t.locale!=="ko"?null:t.data;default:return null}}var Zm={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 uu(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Zm[e.type]:t==="textarea"}function hu(e,t,i,v){Lt(v),t=fo(t,"onChange"),0<t.length&&(i=new li("onChange","change",null,i,v),e.push({event:i,listeners:t}))}var ui=null,hi=null;function eg(e){Ru(e,0)}function lo(e){var t=Cs(e);if(ee(t))return e}function tg(e,t){if(e==="change")return t}var du=!1;if(s){var Aa;if(s){var Na="oninput"in document;if(!Na){var fu=document.createElement("div");fu.setAttribute("oninput","return;"),Na=typeof fu.oninput=="function"}Aa=Na}else Aa=!1;du=Aa&&(!document.documentMode||9<document.documentMode)}function pu(){ui&&(ui.detachEvent("onpropertychange",mu),hi=ui=null)}function mu(e){if(e.propertyName==="value"&&lo(hi)){var t=[];hu(t,hi,e,Me(e)),$n(eg,t)}}function ng(e,t,i){e==="focusin"?(pu(),ui=t,hi=i,ui.attachEvent("onpropertychange",mu)):e==="focusout"&&pu()}function rg(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return lo(hi)}function sg(e,t){if(e==="click")return lo(t)}function ig(e,t){if(e==="input"||e==="change")return lo(t)}function og(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Cn=typeof Object.is=="function"?Object.is:og;function di(e,t){if(Cn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var i=Object.keys(e),v=Object.keys(t);if(i.length!==v.length)return!1;for(v=0;v<i.length;v++){var R=i[v];if(!c.call(t,R)||!Cn(e[R],t[R]))return!1}return!0}function gu(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function _u(e,t){var i=gu(e);e=0;for(var v;i;){if(i.nodeType===3){if(v=e+i.textContent.length,e<=t&&v>=t)return{node:i,offset:t-e};e=v}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=gu(i)}}function vu(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?vu(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function yu(){for(var e=window,t=xe();t instanceof e.HTMLIFrameElement;){try{var i=typeof t.contentWindow.location.href=="string"}catch{i=!1}if(i)e=t.contentWindow;else break;t=xe(e.document)}return t}function Da(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function ag(e){var t=yu(),i=e.focusedElem,v=e.selectionRange;if(t!==i&&i&&i.ownerDocument&&vu(i.ownerDocument.documentElement,i)){if(v!==null&&Da(i)){if(t=v.start,e=v.end,e===void 0&&(e=t),"selectionStart"in i)i.selectionStart=t,i.selectionEnd=Math.min(e,i.value.length);else if(e=(t=i.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var R=i.textContent.length,I=Math.min(v.start,R);v=v.end===void 0?I:Math.min(v.end,R),!e.extend&&I>v&&(R=v,v=I,I=R),R=_u(i,I);var z=_u(i,v);R&&z&&(e.rangeCount!==1||e.anchorNode!==R.node||e.anchorOffset!==R.offset||e.focusNode!==z.node||e.focusOffset!==z.offset)&&(t=t.createRange(),t.setStart(R.node,R.offset),e.removeAllRanges(),I>v?(e.addRange(t),e.extend(z.node,z.offset)):(t.setEnd(z.node,z.offset),e.addRange(t)))}}for(t=[],e=i;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof i.focus=="function"&&i.focus(),i=0;i<t.length;i++)e=t[i],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var lg=s&&"documentMode"in document&&11>=document.documentMode,ys=null,Ia=null,fi=null,Pa=!1;function wu(e,t,i){var v=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;Pa||ys==null||ys!==xe(v)||(v=ys,"selectionStart"in v&&Da(v)?v={start:v.selectionStart,end:v.selectionEnd}:(v=(v.ownerDocument&&v.ownerDocument.defaultView||window).getSelection(),v={anchorNode:v.anchorNode,anchorOffset:v.anchorOffset,focusNode:v.focusNode,focusOffset:v.focusOffset}),fi&&di(fi,v)||(fi=v,v=fo(Ia,"onSelect"),0<v.length&&(t=new li("onSelect","select",null,t,i),e.push({event:t,listeners:v}),t.target=ys)))}function co(e,t){var i={};return i[e.toLowerCase()]=t.toLowerCase(),i["Webkit"+e]="webkit"+t,i["Moz"+e]="moz"+t,i}var ws={animationend:co("Animation","AnimationEnd"),animationiteration:co("Animation","AnimationIteration"),animationstart:co("Animation","AnimationStart"),transitionend:co("Transition","TransitionEnd")},ja={},bu={};s&&(bu=document.createElement("div").style,"AnimationEvent"in window||(delete ws.animationend.animation,delete ws.animationiteration.animation,delete ws.animationstart.animation),"TransitionEvent"in window||delete ws.transitionend.transition);function uo(e){if(ja[e])return ja[e];if(!ws[e])return e;var t=ws[e],i;for(i in t)if(t.hasOwnProperty(i)&&i in bu)return ja[e]=t[i];return e}var Su=uo("animationend"),Cu=uo("animationiteration"),xu=uo("animationstart"),ku=uo("transitionend"),Eu=new Map,Lu="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 lr(e,t){Eu.set(e,t),A(t,[e])}for(var Oa=0;Oa<Lu.length;Oa++){var Ba=Lu[Oa],cg=Ba.toLowerCase(),ug=Ba[0].toUpperCase()+Ba.slice(1);lr(cg,"on"+ug)}lr(Su,"onAnimationEnd"),lr(Cu,"onAnimationIteration"),lr(xu,"onAnimationStart"),lr("dblclick","onDoubleClick"),lr("focusin","onFocus"),lr("focusout","onBlur"),lr(ku,"onTransitionEnd"),L("onMouseEnter",["mouseout","mouseover"]),L("onMouseLeave",["mouseout","mouseover"]),L("onPointerEnter",["pointerout","pointerover"]),L("onPointerLeave",["pointerout","pointerover"]),A("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),A("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),A("onBeforeInput",["compositionend","keypress","textInput","paste"]),A("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),A("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),A("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var pi="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(" "),hg=new Set("cancel close invalid load scroll toggle".split(" ").concat(pi));function Tu(e,t,i){var v=e.type||"unknown-event";e.currentTarget=i,wa(v,t,void 0,e),e.currentTarget=null}function Ru(e,t){t=(t&4)!==0;for(var i=0;i<e.length;i++){var v=e[i],R=v.event;v=v.listeners;e:{var I=void 0;if(t)for(var z=v.length-1;0<=z;z--){var Q=v[z],te=Q.instance,ue=Q.currentTarget;if(Q=Q.listener,te!==I&&R.isPropagationStopped())break e;Tu(R,Q,ue),I=te}else for(z=0;z<v.length;z++){if(Q=v[z],te=Q.instance,ue=Q.currentTarget,Q=Q.listener,te!==I&&R.isPropagationStopped())break e;Tu(R,Q,ue),I=te}}}if(Ar)throw e=Nr,Ar=!1,Nr=null,e}function mt(e,t){var i=t[qa];i===void 0&&(i=t[qa]=new Set);var v=e+"__bubble";i.has(v)||(Mu(t,e,2,!1),i.add(v))}function Fa(e,t,i){var v=0;t&&(v|=4),Mu(i,e,v,t)}var ho="_reactListening"+Math.random().toString(36).slice(2);function mi(e){if(!e[ho]){e[ho]=!0,p.forEach(function(i){i!=="selectionchange"&&(hg.has(i)||Fa(i,!1,e),Fa(i,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ho]||(t[ho]=!0,Fa("selectionchange",!1,t))}}function Mu(e,t,i,v){switch(ii(t)){case 1:var R=Ea;break;case 4:R=La;break;default:R=si}i=R.bind(null,t,i,e),R=void 0,!Ks||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(R=!0),v?R!==void 0?e.addEventListener(t,i,{capture:!0,passive:R}):e.addEventListener(t,i,!0):R!==void 0?e.addEventListener(t,i,{passive:R}):e.addEventListener(t,i,!1)}function Ha(e,t,i,v,R){var I=v;if((t&1)===0&&(t&2)===0&&v!==null)e:for(;;){if(v===null)return;var z=v.tag;if(z===3||z===4){var Q=v.stateNode.containerInfo;if(Q===R||Q.nodeType===8&&Q.parentNode===R)break;if(z===4)for(z=v.return;z!==null;){var te=z.tag;if((te===3||te===4)&&(te=z.stateNode.containerInfo,te===R||te.nodeType===8&&te.parentNode===R))return;z=z.return}for(;Q!==null;){if(z=$r(Q),z===null)return;if(te=z.tag,te===5||te===6){v=I=z;continue e}Q=Q.parentNode}}v=v.return}$n(function(){var ue=I,ve=Me(i),be=[];e:{var _e=Eu.get(e);if(_e!==void 0){var Ae=li,Pe=e;switch(e){case"keypress":if(Fr(i)===0)break e;case"keydown":case"keyup":Ae=$m;break;case"focusin":Pe="focus",Ae=Ta;break;case"focusout":Pe="blur",Ae=Ta;break;case"beforeblur":case"afterblur":Ae=Ta;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Ae=Se;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ae=Nn;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ae=zm;break;case Su:case Cu:case xu:Ae=Nm;break;case ku:Ae=qm;break;case"scroll":Ae=ao;break;case"wheel":Ae=Gm;break;case"copy":case"cut":case"paste":Ae=Im;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ae=su}var Oe=(t&4)!==0,xt=!Oe&&e==="scroll",oe=Oe?_e!==null?_e+"Capture":null:_e;Oe=[];for(var re=ue,ae;re!==null;){ae=re;var Ce=ae.stateNode;if(ae.tag===5&&Ce!==null&&(ae=Ce,oe!==null&&(Ce=Lr(re,oe),Ce!=null&&Oe.push(gi(re,Ce,ae)))),xt)break;re=re.return}0<Oe.length&&(_e=new Ae(_e,Pe,null,i,ve),be.push({event:_e,listeners:Oe}))}}if((t&7)===0){e:{if(_e=e==="mouseover"||e==="pointerover",Ae=e==="mouseout"||e==="pointerout",_e&&i!==pe&&(Pe=i.relatedTarget||i.fromElement)&&($r(Pe)||Pe[Vn]))break e;if((Ae||_e)&&(_e=ve.window===ve?ve:(_e=ve.ownerDocument)?_e.defaultView||_e.parentWindow:window,Ae?(Pe=i.relatedTarget||i.toElement,Ae=ue,Pe=Pe?$r(Pe):null,Pe!==null&&(xt=un(Pe),Pe!==xt||Pe.tag!==5&&Pe.tag!==6)&&(Pe=null)):(Ae=null,Pe=ue),Ae!==Pe)){if(Oe=Se,Ce="onMouseLeave",oe="onMouseEnter",re="mouse",(e==="pointerout"||e==="pointerover")&&(Oe=su,Ce="onPointerLeave",oe="onPointerEnter",re="pointer"),xt=Ae==null?_e:Cs(Ae),ae=Pe==null?_e:Cs(Pe),_e=new Oe(Ce,re+"leave",Ae,i,ve),_e.target=xt,_e.relatedTarget=ae,Ce=null,$r(ve)===ue&&(Oe=new Oe(oe,re+"enter",Pe,i,ve),Oe.target=ae,Oe.relatedTarget=xt,Ce=Oe),xt=Ce,Ae&&Pe)t:{for(Oe=Ae,oe=Pe,re=0,ae=Oe;ae;ae=bs(ae))re++;for(ae=0,Ce=oe;Ce;Ce=bs(Ce))ae++;for(;0<re-ae;)Oe=bs(Oe),re--;for(;0<ae-re;)oe=bs(oe),ae--;for(;re--;){if(Oe===oe||oe!==null&&Oe===oe.alternate)break t;Oe=bs(Oe),oe=bs(oe)}Oe=null}else Oe=null;Ae!==null&&Au(be,_e,Ae,Oe,!1),Pe!==null&&xt!==null&&Au(be,xt,Pe,Oe,!0)}}e:{if(_e=ue?Cs(ue):window,Ae=_e.nodeName&&_e.nodeName.toLowerCase(),Ae==="select"||Ae==="input"&&_e.type==="file")var Fe=tg;else if(uu(_e))if(du)Fe=ig;else{Fe=rg;var Ve=ng}else(Ae=_e.nodeName)&&Ae.toLowerCase()==="input"&&(_e.type==="checkbox"||_e.type==="radio")&&(Fe=sg);if(Fe&&(Fe=Fe(e,ue))){hu(be,Fe,i,ve);break e}Ve&&Ve(e,_e,ue),e==="focusout"&&(Ve=_e._wrapperState)&&Ve.controlled&&_e.type==="number"&&nt(_e,"number",_e.value)}switch(Ve=ue?Cs(ue):window,e){case"focusin":(uu(Ve)||Ve.contentEditable==="true")&&(ys=Ve,Ia=ue,fi=null);break;case"focusout":fi=Ia=ys=null;break;case"mousedown":Pa=!0;break;case"contextmenu":case"mouseup":case"dragend":Pa=!1,wu(be,i,ve);break;case"selectionchange":if(lg)break;case"keydown":case"keyup":wu(be,i,ve)}var qe;if(Ma)e:{switch(e){case"compositionstart":var Ye="onCompositionStart";break e;case"compositionend":Ye="onCompositionEnd";break e;case"compositionupdate":Ye="onCompositionUpdate";break e}Ye=void 0}else vs?lu(e,i)&&(Ye="onCompositionEnd"):e==="keydown"&&i.keyCode===229&&(Ye="onCompositionStart");Ye&&(iu&&i.locale!=="ko"&&(vs||Ye!=="onCompositionStart"?Ye==="onCompositionEnd"&&vs&&(qe=oi()):(dn=ve,ps="value"in dn?dn.value:dn.textContent,vs=!0)),Ve=fo(ue,Ye),0<Ve.length&&(Ye=new ru(Ye,e,null,i,ve),be.push({event:Ye,listeners:Ve}),qe?Ye.data=qe:(qe=cu(i),qe!==null&&(Ye.data=qe)))),(qe=Xm?Qm(e,i):Jm(e,i))&&(ue=fo(ue,"onBeforeInput"),0<ue.length&&(ve=new ru("onBeforeInput","beforeinput",null,i,ve),be.push({event:ve,listeners:ue}),ve.data=qe))}Ru(be,t)})}function gi(e,t,i){return{instance:e,listener:t,currentTarget:i}}function fo(e,t){for(var i=t+"Capture",v=[];e!==null;){var R=e,I=R.stateNode;R.tag===5&&I!==null&&(R=I,I=Lr(e,i),I!=null&&v.unshift(gi(e,I,R)),I=Lr(e,t),I!=null&&v.push(gi(e,I,R))),e=e.return}return v}function bs(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Au(e,t,i,v,R){for(var I=t._reactName,z=[];i!==null&&i!==v;){var Q=i,te=Q.alternate,ue=Q.stateNode;if(te!==null&&te===v)break;Q.tag===5&&ue!==null&&(Q=ue,R?(te=Lr(i,I),te!=null&&z.unshift(gi(i,te,Q))):R||(te=Lr(i,I),te!=null&&z.push(gi(i,te,Q)))),i=i.return}z.length!==0&&e.push({event:t,listeners:z})}var dg=/\r\n?/g,fg=/\u0000|\uFFFD/g;function Nu(e){return(typeof e=="string"?e:""+e).replace(dg,`
38
- `).replace(fg,"")}function po(e,t,i){if(t=Nu(t),Nu(e)!==t&&i)throw Error(o(425))}function mo(){}var $a=null,Ua=null;function Wa(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var za=typeof setTimeout=="function"?setTimeout:void 0,pg=typeof clearTimeout=="function"?clearTimeout:void 0,Du=typeof Promise=="function"?Promise:void 0,mg=typeof queueMicrotask=="function"?queueMicrotask:typeof Du<"u"?function(e){return Du.resolve(null).then(e).catch(gg)}:za;function gg(e){setTimeout(function(){throw e})}function Va(e,t){var i=t,v=0;do{var R=i.nextSibling;if(e.removeChild(i),R&&R.nodeType===8)if(i=R.data,i==="/$"){if(v===0){e.removeChild(R),Or(t);return}v--}else i!=="$"&&i!=="$?"&&i!=="$!"||v++;i=R}while(i);Or(t)}function cr(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function Iu(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="$"||i==="$!"||i==="$?"){if(t===0)return e;t--}else i==="/$"&&t++}e=e.previousSibling}return null}var Ss=Math.random().toString(36).slice(2),Dn="__reactFiber$"+Ss,_i="__reactProps$"+Ss,Vn="__reactContainer$"+Ss,qa="__reactEvents$"+Ss,_g="__reactListeners$"+Ss,vg="__reactHandles$"+Ss;function $r(e){var t=e[Dn];if(t)return t;for(var i=e.parentNode;i;){if(t=i[Vn]||i[Dn]){if(i=t.alternate,t.child!==null||i!==null&&i.child!==null)for(e=Iu(e);e!==null;){if(i=e[Dn])return i;e=Iu(e)}return t}e=i,i=e.parentNode}return null}function vi(e){return e=e[Dn]||e[Vn],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Cs(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(o(33))}function go(e){return e[_i]||null}var Ka=[],xs=-1;function ur(e){return{current:e}}function gt(e){0>xs||(e.current=Ka[xs],Ka[xs]=null,xs--)}function dt(e,t){xs++,Ka[xs]=e.current,e.current=t}var hr={},Ut=ur(hr),Xt=ur(!1),Ur=hr;function ks(e,t){var i=e.type.contextTypes;if(!i)return hr;var v=e.stateNode;if(v&&v.__reactInternalMemoizedUnmaskedChildContext===t)return v.__reactInternalMemoizedMaskedChildContext;var R={},I;for(I in i)R[I]=t[I];return v&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=R),R}function Qt(e){return e=e.childContextTypes,e!=null}function _o(){gt(Xt),gt(Ut)}function Pu(e,t,i){if(Ut.current!==hr)throw Error(o(168));dt(Ut,t),dt(Xt,i)}function ju(e,t,i){var v=e.stateNode;if(t=t.childContextTypes,typeof v.getChildContext!="function")return i;v=v.getChildContext();for(var R in v)if(!(R in t))throw Error(o(108,K(e)||"Unknown",R));return U({},i,v)}function vo(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||hr,Ur=Ut.current,dt(Ut,e),dt(Xt,Xt.current),!0}function Ou(e,t,i){var v=e.stateNode;if(!v)throw Error(o(169));i?(e=ju(e,t,Ur),v.__reactInternalMemoizedMergedChildContext=e,gt(Xt),gt(Ut),dt(Ut,e)):gt(Xt),dt(Xt,i)}var qn=null,yo=!1,Ga=!1;function Bu(e){qn===null?qn=[e]:qn.push(e)}function yg(e){yo=!0,Bu(e)}function dr(){if(!Ga&&qn!==null){Ga=!0;var e=0,t=ot;try{var i=qn;for(ot=1;e<i.length;e++){var v=i[e];do v=v(!0);while(v!==null)}qn=null,yo=!1}catch(R){throw qn!==null&&(qn=qn.slice(e+1)),eo(tr,dr),R}finally{ot=t,Ga=!1}}return null}var Es=[],Ls=0,wo=null,bo=0,fn=[],pn=0,Wr=null,Kn=1,Gn="";function zr(e,t){Es[Ls++]=bo,Es[Ls++]=wo,wo=e,bo=t}function Fu(e,t,i){fn[pn++]=Kn,fn[pn++]=Gn,fn[pn++]=Wr,Wr=e;var v=Kn;e=Gn;var R=32-Ft(v)-1;v&=~(1<<R),i+=1;var I=32-Ft(t)+R;if(30<I){var z=R-R%5;I=(v&(1<<z)-1).toString(32),v>>=z,R-=z,Kn=1<<32-Ft(t)+R|i<<R|v,Gn=I+e}else Kn=1<<I|i<<R|v,Gn=e}function Ya(e){e.return!==null&&(zr(e,1),Fu(e,1,0))}function Xa(e){for(;e===wo;)wo=Es[--Ls],Es[Ls]=null,bo=Es[--Ls],Es[Ls]=null;for(;e===Wr;)Wr=fn[--pn],fn[pn]=null,Gn=fn[--pn],fn[pn]=null,Kn=fn[--pn],fn[pn]=null}var on=null,an=null,vt=!1,xn=null;function Hu(e,t){var i=vn(5,null,null,0);i.elementType="DELETED",i.stateNode=t,i.return=e,t=e.deletions,t===null?(e.deletions=[i],e.flags|=16):t.push(i)}function $u(e,t){switch(e.tag){case 5:var i=e.type;return t=t.nodeType!==1||i.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,on=e,an=cr(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,on=e,an=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(i=Wr!==null?{id:Kn,overflow:Gn}:null,e.memoizedState={dehydrated:t,treeContext:i,retryLane:1073741824},i=vn(18,null,null,0),i.stateNode=t,i.return=e,e.child=i,on=e,an=null,!0):!1;default:return!1}}function Qa(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Ja(e){if(vt){var t=an;if(t){var i=t;if(!$u(e,t)){if(Qa(e))throw Error(o(418));t=cr(i.nextSibling);var v=on;t&&$u(e,t)?Hu(v,i):(e.flags=e.flags&-4097|2,vt=!1,on=e)}}else{if(Qa(e))throw Error(o(418));e.flags=e.flags&-4097|2,vt=!1,on=e}}}function Uu(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;on=e}function So(e){if(e!==on)return!1;if(!vt)return Uu(e),vt=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Wa(e.type,e.memoizedProps)),t&&(t=an)){if(Qa(e))throw Wu(),Error(o(418));for(;t;)Hu(e,t),t=cr(t.nextSibling)}if(Uu(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="/$"){if(t===0){an=cr(e.nextSibling);break e}t--}else i!=="$"&&i!=="$!"&&i!=="$?"||t++}e=e.nextSibling}an=null}}else an=on?cr(e.stateNode.nextSibling):null;return!0}function Wu(){for(var e=an;e;)e=cr(e.nextSibling)}function Ts(){an=on=null,vt=!1}function Za(e){xn===null?xn=[e]:xn.push(e)}var wg=C.ReactCurrentBatchConfig;function yi(e,t,i){if(e=i.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(i._owner){if(i=i._owner,i){if(i.tag!==1)throw Error(o(309));var v=i.stateNode}if(!v)throw Error(o(147,e));var R=v,I=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===I?t.ref:(t=function(z){var Q=R.refs;z===null?delete Q[I]:Q[I]=z},t._stringRef=I,t)}if(typeof e!="string")throw Error(o(284));if(!i._owner)throw Error(o(290,e))}return e}function Co(e,t){throw e=Object.prototype.toString.call(t),Error(o(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function zu(e){var t=e._init;return t(e._payload)}function Vu(e){function t(oe,re){if(e){var ae=oe.deletions;ae===null?(oe.deletions=[re],oe.flags|=16):ae.push(re)}}function i(oe,re){if(!e)return null;for(;re!==null;)t(oe,re),re=re.sibling;return null}function v(oe,re){for(oe=new Map;re!==null;)re.key!==null?oe.set(re.key,re):oe.set(re.index,re),re=re.sibling;return oe}function R(oe,re){return oe=wr(oe,re),oe.index=0,oe.sibling=null,oe}function I(oe,re,ae){return oe.index=ae,e?(ae=oe.alternate,ae!==null?(ae=ae.index,ae<re?(oe.flags|=2,re):ae):(oe.flags|=2,re)):(oe.flags|=1048576,re)}function z(oe){return e&&oe.alternate===null&&(oe.flags|=2),oe}function Q(oe,re,ae,Ce){return re===null||re.tag!==6?(re=zl(ae,oe.mode,Ce),re.return=oe,re):(re=R(re,ae),re.return=oe,re)}function te(oe,re,ae,Ce){var Fe=ae.type;return Fe===M?ve(oe,re,ae.props.children,Ce,ae.key):re!==null&&(re.elementType===Fe||typeof Fe=="object"&&Fe!==null&&Fe.$$typeof===X&&zu(Fe)===re.type)?(Ce=R(re,ae.props),Ce.ref=yi(oe,re,ae),Ce.return=oe,Ce):(Ce=Ko(ae.type,ae.key,ae.props,null,oe.mode,Ce),Ce.ref=yi(oe,re,ae),Ce.return=oe,Ce)}function ue(oe,re,ae,Ce){return re===null||re.tag!==4||re.stateNode.containerInfo!==ae.containerInfo||re.stateNode.implementation!==ae.implementation?(re=Vl(ae,oe.mode,Ce),re.return=oe,re):(re=R(re,ae.children||[]),re.return=oe,re)}function ve(oe,re,ae,Ce,Fe){return re===null||re.tag!==7?(re=Jr(ae,oe.mode,Ce,Fe),re.return=oe,re):(re=R(re,ae),re.return=oe,re)}function be(oe,re,ae){if(typeof re=="string"&&re!==""||typeof re=="number")return re=zl(""+re,oe.mode,ae),re.return=oe,re;if(typeof re=="object"&&re!==null){switch(re.$$typeof){case D:return ae=Ko(re.type,re.key,re.props,null,oe.mode,ae),ae.ref=yi(oe,null,re),ae.return=oe,ae;case x:return re=Vl(re,oe.mode,ae),re.return=oe,re;case X:var Ce=re._init;return be(oe,Ce(re._payload),ae)}if(De(re)||j(re))return re=Jr(re,oe.mode,ae,null),re.return=oe,re;Co(oe,re)}return null}function _e(oe,re,ae,Ce){var Fe=re!==null?re.key:null;if(typeof ae=="string"&&ae!==""||typeof ae=="number")return Fe!==null?null:Q(oe,re,""+ae,Ce);if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case D:return ae.key===Fe?te(oe,re,ae,Ce):null;case x:return ae.key===Fe?ue(oe,re,ae,Ce):null;case X:return Fe=ae._init,_e(oe,re,Fe(ae._payload),Ce)}if(De(ae)||j(ae))return Fe!==null?null:ve(oe,re,ae,Ce,null);Co(oe,ae)}return null}function Ae(oe,re,ae,Ce,Fe){if(typeof Ce=="string"&&Ce!==""||typeof Ce=="number")return oe=oe.get(ae)||null,Q(re,oe,""+Ce,Fe);if(typeof Ce=="object"&&Ce!==null){switch(Ce.$$typeof){case D:return oe=oe.get(Ce.key===null?ae:Ce.key)||null,te(re,oe,Ce,Fe);case x:return oe=oe.get(Ce.key===null?ae:Ce.key)||null,ue(re,oe,Ce,Fe);case X:var Ve=Ce._init;return Ae(oe,re,ae,Ve(Ce._payload),Fe)}if(De(Ce)||j(Ce))return oe=oe.get(ae)||null,ve(re,oe,Ce,Fe,null);Co(re,Ce)}return null}function Pe(oe,re,ae,Ce){for(var Fe=null,Ve=null,qe=re,Ye=re=0,It=null;qe!==null&&Ye<ae.length;Ye++){qe.index>Ye?(It=qe,qe=null):It=qe.sibling;var it=_e(oe,qe,ae[Ye],Ce);if(it===null){qe===null&&(qe=It);break}e&&qe&&it.alternate===null&&t(oe,qe),re=I(it,re,Ye),Ve===null?Fe=it:Ve.sibling=it,Ve=it,qe=It}if(Ye===ae.length)return i(oe,qe),vt&&zr(oe,Ye),Fe;if(qe===null){for(;Ye<ae.length;Ye++)qe=be(oe,ae[Ye],Ce),qe!==null&&(re=I(qe,re,Ye),Ve===null?Fe=qe:Ve.sibling=qe,Ve=qe);return vt&&zr(oe,Ye),Fe}for(qe=v(oe,qe);Ye<ae.length;Ye++)It=Ae(qe,oe,Ye,ae[Ye],Ce),It!==null&&(e&&It.alternate!==null&&qe.delete(It.key===null?Ye:It.key),re=I(It,re,Ye),Ve===null?Fe=It:Ve.sibling=It,Ve=It);return e&&qe.forEach(function(br){return t(oe,br)}),vt&&zr(oe,Ye),Fe}function Oe(oe,re,ae,Ce){var Fe=j(ae);if(typeof Fe!="function")throw Error(o(150));if(ae=Fe.call(ae),ae==null)throw Error(o(151));for(var Ve=Fe=null,qe=re,Ye=re=0,It=null,it=ae.next();qe!==null&&!it.done;Ye++,it=ae.next()){qe.index>Ye?(It=qe,qe=null):It=qe.sibling;var br=_e(oe,qe,it.value,Ce);if(br===null){qe===null&&(qe=It);break}e&&qe&&br.alternate===null&&t(oe,qe),re=I(br,re,Ye),Ve===null?Fe=br:Ve.sibling=br,Ve=br,qe=It}if(it.done)return i(oe,qe),vt&&zr(oe,Ye),Fe;if(qe===null){for(;!it.done;Ye++,it=ae.next())it=be(oe,it.value,Ce),it!==null&&(re=I(it,re,Ye),Ve===null?Fe=it:Ve.sibling=it,Ve=it);return vt&&zr(oe,Ye),Fe}for(qe=v(oe,qe);!it.done;Ye++,it=ae.next())it=Ae(qe,oe,Ye,it.value,Ce),it!==null&&(e&&it.alternate!==null&&qe.delete(it.key===null?Ye:it.key),re=I(it,re,Ye),Ve===null?Fe=it:Ve.sibling=it,Ve=it);return e&&qe.forEach(function(Zg){return t(oe,Zg)}),vt&&zr(oe,Ye),Fe}function xt(oe,re,ae,Ce){if(typeof ae=="object"&&ae!==null&&ae.type===M&&ae.key===null&&(ae=ae.props.children),typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case D:e:{for(var Fe=ae.key,Ve=re;Ve!==null;){if(Ve.key===Fe){if(Fe=ae.type,Fe===M){if(Ve.tag===7){i(oe,Ve.sibling),re=R(Ve,ae.props.children),re.return=oe,oe=re;break e}}else if(Ve.elementType===Fe||typeof Fe=="object"&&Fe!==null&&Fe.$$typeof===X&&zu(Fe)===Ve.type){i(oe,Ve.sibling),re=R(Ve,ae.props),re.ref=yi(oe,Ve,ae),re.return=oe,oe=re;break e}i(oe,Ve);break}else t(oe,Ve);Ve=Ve.sibling}ae.type===M?(re=Jr(ae.props.children,oe.mode,Ce,ae.key),re.return=oe,oe=re):(Ce=Ko(ae.type,ae.key,ae.props,null,oe.mode,Ce),Ce.ref=yi(oe,re,ae),Ce.return=oe,oe=Ce)}return z(oe);case x:e:{for(Ve=ae.key;re!==null;){if(re.key===Ve)if(re.tag===4&&re.stateNode.containerInfo===ae.containerInfo&&re.stateNode.implementation===ae.implementation){i(oe,re.sibling),re=R(re,ae.children||[]),re.return=oe,oe=re;break e}else{i(oe,re);break}else t(oe,re);re=re.sibling}re=Vl(ae,oe.mode,Ce),re.return=oe,oe=re}return z(oe);case X:return Ve=ae._init,xt(oe,re,Ve(ae._payload),Ce)}if(De(ae))return Pe(oe,re,ae,Ce);if(j(ae))return Oe(oe,re,ae,Ce);Co(oe,ae)}return typeof ae=="string"&&ae!==""||typeof ae=="number"?(ae=""+ae,re!==null&&re.tag===6?(i(oe,re.sibling),re=R(re,ae),re.return=oe,oe=re):(i(oe,re),re=zl(ae,oe.mode,Ce),re.return=oe,oe=re),z(oe)):i(oe,re)}return xt}var Rs=Vu(!0),qu=Vu(!1),xo=ur(null),ko=null,Ms=null,el=null;function tl(){el=Ms=ko=null}function nl(e){var t=xo.current;gt(xo),e._currentValue=t}function rl(e,t,i){for(;e!==null;){var v=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,v!==null&&(v.childLanes|=t)):v!==null&&(v.childLanes&t)!==t&&(v.childLanes|=t),e===i)break;e=e.return}}function As(e,t){ko=e,el=Ms=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(Jt=!0),e.firstContext=null)}function mn(e){var t=e._currentValue;if(el!==e)if(e={context:e,memoizedValue:t,next:null},Ms===null){if(ko===null)throw Error(o(308));Ms=e,ko.dependencies={lanes:0,firstContext:e}}else Ms=Ms.next=e;return t}var Vr=null;function sl(e){Vr===null?Vr=[e]:Vr.push(e)}function Ku(e,t,i,v){var R=t.interleaved;return R===null?(i.next=i,sl(t)):(i.next=R.next,R.next=i),t.interleaved=i,Yn(e,v)}function Yn(e,t){e.lanes|=t;var i=e.alternate;for(i!==null&&(i.lanes|=t),i=e,e=e.return;e!==null;)e.childLanes|=t,i=e.alternate,i!==null&&(i.childLanes|=t),i=e,e=e.return;return i.tag===3?i.stateNode:null}var fr=!1;function il(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Gu(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Xn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function pr(e,t,i){var v=e.updateQueue;if(v===null)return null;if(v=v.shared,(st&2)!==0){var R=v.pending;return R===null?t.next=t:(t.next=R.next,R.next=t),v.pending=t,Yn(e,i)}return R=v.interleaved,R===null?(t.next=t,sl(v)):(t.next=R.next,R.next=t),v.interleaved=t,Yn(e,i)}function Eo(e,t,i){if(t=t.updateQueue,t!==null&&(t=t.shared,(i&4194240)!==0)){var v=t.lanes;v&=e.pendingLanes,i|=v,t.lanes=i,ti(e,i)}}function Yu(e,t){var i=e.updateQueue,v=e.alternate;if(v!==null&&(v=v.updateQueue,i===v)){var R=null,I=null;if(i=i.firstBaseUpdate,i!==null){do{var z={eventTime:i.eventTime,lane:i.lane,tag:i.tag,payload:i.payload,callback:i.callback,next:null};I===null?R=I=z:I=I.next=z,i=i.next}while(i!==null);I===null?R=I=t:I=I.next=t}else R=I=t;i={baseState:v.baseState,firstBaseUpdate:R,lastBaseUpdate:I,shared:v.shared,effects:v.effects},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=t:e.next=t,i.lastBaseUpdate=t}function Lo(e,t,i,v){var R=e.updateQueue;fr=!1;var I=R.firstBaseUpdate,z=R.lastBaseUpdate,Q=R.shared.pending;if(Q!==null){R.shared.pending=null;var te=Q,ue=te.next;te.next=null,z===null?I=ue:z.next=ue,z=te;var ve=e.alternate;ve!==null&&(ve=ve.updateQueue,Q=ve.lastBaseUpdate,Q!==z&&(Q===null?ve.firstBaseUpdate=ue:Q.next=ue,ve.lastBaseUpdate=te))}if(I!==null){var be=R.baseState;z=0,ve=ue=te=null,Q=I;do{var _e=Q.lane,Ae=Q.eventTime;if((v&_e)===_e){ve!==null&&(ve=ve.next={eventTime:Ae,lane:0,tag:Q.tag,payload:Q.payload,callback:Q.callback,next:null});e:{var Pe=e,Oe=Q;switch(_e=t,Ae=i,Oe.tag){case 1:if(Pe=Oe.payload,typeof Pe=="function"){be=Pe.call(Ae,be,_e);break e}be=Pe;break e;case 3:Pe.flags=Pe.flags&-65537|128;case 0:if(Pe=Oe.payload,_e=typeof Pe=="function"?Pe.call(Ae,be,_e):Pe,_e==null)break e;be=U({},be,_e);break e;case 2:fr=!0}}Q.callback!==null&&Q.lane!==0&&(e.flags|=64,_e=R.effects,_e===null?R.effects=[Q]:_e.push(Q))}else Ae={eventTime:Ae,lane:_e,tag:Q.tag,payload:Q.payload,callback:Q.callback,next:null},ve===null?(ue=ve=Ae,te=be):ve=ve.next=Ae,z|=_e;if(Q=Q.next,Q===null){if(Q=R.shared.pending,Q===null)break;_e=Q,Q=_e.next,_e.next=null,R.lastBaseUpdate=_e,R.shared.pending=null}}while(!0);if(ve===null&&(te=be),R.baseState=te,R.firstBaseUpdate=ue,R.lastBaseUpdate=ve,t=R.shared.interleaved,t!==null){R=t;do z|=R.lane,R=R.next;while(R!==t)}else I===null&&(R.shared.lanes=0);Gr|=z,e.lanes=z,e.memoizedState=be}}function Xu(e,t,i){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var v=e[t],R=v.callback;if(R!==null){if(v.callback=null,v=i,typeof R!="function")throw Error(o(191,R));R.call(v)}}}var wi={},In=ur(wi),bi=ur(wi),Si=ur(wi);function qr(e){if(e===wi)throw Error(o(174));return e}function ol(e,t){switch(dt(Si,t),dt(bi,e),dt(In,wi),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:St(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=St(t,e)}gt(In),dt(In,t)}function Ns(){gt(In),gt(bi),gt(Si)}function Qu(e){qr(Si.current);var t=qr(In.current),i=St(t,e.type);t!==i&&(dt(bi,e),dt(In,i))}function al(e){bi.current===e&&(gt(In),gt(bi))}var yt=ur(0);function To(e){for(var t=e;t!==null;){if(t.tag===13){var i=t.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||i.data==="$?"||i.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ll=[];function cl(){for(var e=0;e<ll.length;e++)ll[e]._workInProgressVersionPrimary=null;ll.length=0}var Ro=C.ReactCurrentDispatcher,ul=C.ReactCurrentBatchConfig,Kr=0,wt=null,Tt=null,Nt=null,Mo=!1,Ci=!1,xi=0,bg=0;function Wt(){throw Error(o(321))}function hl(e,t){if(t===null)return!1;for(var i=0;i<t.length&&i<e.length;i++)if(!Cn(e[i],t[i]))return!1;return!0}function dl(e,t,i,v,R,I){if(Kr=I,wt=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Ro.current=e===null||e.memoizedState===null?kg:Eg,e=i(v,R),Ci){I=0;do{if(Ci=!1,xi=0,25<=I)throw Error(o(301));I+=1,Nt=Tt=null,t.updateQueue=null,Ro.current=Lg,e=i(v,R)}while(Ci)}if(Ro.current=Do,t=Tt!==null&&Tt.next!==null,Kr=0,Nt=Tt=wt=null,Mo=!1,t)throw Error(o(300));return e}function fl(){var e=xi!==0;return xi=0,e}function Pn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Nt===null?wt.memoizedState=Nt=e:Nt=Nt.next=e,Nt}function gn(){if(Tt===null){var e=wt.alternate;e=e!==null?e.memoizedState:null}else e=Tt.next;var t=Nt===null?wt.memoizedState:Nt.next;if(t!==null)Nt=t,Tt=e;else{if(e===null)throw Error(o(310));Tt=e,e={memoizedState:Tt.memoizedState,baseState:Tt.baseState,baseQueue:Tt.baseQueue,queue:Tt.queue,next:null},Nt===null?wt.memoizedState=Nt=e:Nt=Nt.next=e}return Nt}function ki(e,t){return typeof t=="function"?t(e):t}function pl(e){var t=gn(),i=t.queue;if(i===null)throw Error(o(311));i.lastRenderedReducer=e;var v=Tt,R=v.baseQueue,I=i.pending;if(I!==null){if(R!==null){var z=R.next;R.next=I.next,I.next=z}v.baseQueue=R=I,i.pending=null}if(R!==null){I=R.next,v=v.baseState;var Q=z=null,te=null,ue=I;do{var ve=ue.lane;if((Kr&ve)===ve)te!==null&&(te=te.next={lane:0,action:ue.action,hasEagerState:ue.hasEagerState,eagerState:ue.eagerState,next:null}),v=ue.hasEagerState?ue.eagerState:e(v,ue.action);else{var be={lane:ve,action:ue.action,hasEagerState:ue.hasEagerState,eagerState:ue.eagerState,next:null};te===null?(Q=te=be,z=v):te=te.next=be,wt.lanes|=ve,Gr|=ve}ue=ue.next}while(ue!==null&&ue!==I);te===null?z=v:te.next=Q,Cn(v,t.memoizedState)||(Jt=!0),t.memoizedState=v,t.baseState=z,t.baseQueue=te,i.lastRenderedState=v}if(e=i.interleaved,e!==null){R=e;do I=R.lane,wt.lanes|=I,Gr|=I,R=R.next;while(R!==e)}else R===null&&(i.lanes=0);return[t.memoizedState,i.dispatch]}function ml(e){var t=gn(),i=t.queue;if(i===null)throw Error(o(311));i.lastRenderedReducer=e;var v=i.dispatch,R=i.pending,I=t.memoizedState;if(R!==null){i.pending=null;var z=R=R.next;do I=e(I,z.action),z=z.next;while(z!==R);Cn(I,t.memoizedState)||(Jt=!0),t.memoizedState=I,t.baseQueue===null&&(t.baseState=I),i.lastRenderedState=I}return[I,v]}function Ju(){}function Zu(e,t){var i=wt,v=gn(),R=t(),I=!Cn(v.memoizedState,R);if(I&&(v.memoizedState=R,Jt=!0),v=v.queue,gl(nh.bind(null,i,v,e),[e]),v.getSnapshot!==t||I||Nt!==null&&Nt.memoizedState.tag&1){if(i.flags|=2048,Ei(9,th.bind(null,i,v,R,t),void 0,null),Dt===null)throw Error(o(349));(Kr&30)!==0||eh(i,t,R)}return R}function eh(e,t,i){e.flags|=16384,e={getSnapshot:t,value:i},t=wt.updateQueue,t===null?(t={lastEffect:null,stores:null},wt.updateQueue=t,t.stores=[e]):(i=t.stores,i===null?t.stores=[e]:i.push(e))}function th(e,t,i,v){t.value=i,t.getSnapshot=v,rh(t)&&sh(e)}function nh(e,t,i){return i(function(){rh(t)&&sh(e)})}function rh(e){var t=e.getSnapshot;e=e.value;try{var i=t();return!Cn(e,i)}catch{return!0}}function sh(e){var t=Yn(e,1);t!==null&&Tn(t,e,1,-1)}function ih(e){var t=Pn();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ki,lastRenderedState:e},t.queue=e,e=e.dispatch=xg.bind(null,wt,e),[t.memoizedState,e]}function Ei(e,t,i,v){return e={tag:e,create:t,destroy:i,deps:v,next:null},t=wt.updateQueue,t===null?(t={lastEffect:null,stores:null},wt.updateQueue=t,t.lastEffect=e.next=e):(i=t.lastEffect,i===null?t.lastEffect=e.next=e:(v=i.next,i.next=e,e.next=v,t.lastEffect=e)),e}function oh(){return gn().memoizedState}function Ao(e,t,i,v){var R=Pn();wt.flags|=e,R.memoizedState=Ei(1|t,i,void 0,v===void 0?null:v)}function No(e,t,i,v){var R=gn();v=v===void 0?null:v;var I=void 0;if(Tt!==null){var z=Tt.memoizedState;if(I=z.destroy,v!==null&&hl(v,z.deps)){R.memoizedState=Ei(t,i,I,v);return}}wt.flags|=e,R.memoizedState=Ei(1|t,i,I,v)}function ah(e,t){return Ao(8390656,8,e,t)}function gl(e,t){return No(2048,8,e,t)}function lh(e,t){return No(4,2,e,t)}function ch(e,t){return No(4,4,e,t)}function uh(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function hh(e,t,i){return i=i!=null?i.concat([e]):null,No(4,4,uh.bind(null,t,e),i)}function _l(){}function dh(e,t){var i=gn();t=t===void 0?null:t;var v=i.memoizedState;return v!==null&&t!==null&&hl(t,v[1])?v[0]:(i.memoizedState=[e,t],e)}function fh(e,t){var i=gn();t=t===void 0?null:t;var v=i.memoizedState;return v!==null&&t!==null&&hl(t,v[1])?v[0]:(e=e(),i.memoizedState=[e,t],e)}function ph(e,t,i){return(Kr&21)===0?(e.baseState&&(e.baseState=!1,Jt=!0),e.memoizedState=i):(Cn(i,t)||(i=ei(),wt.lanes|=i,Gr|=i,e.baseState=!0),t)}function Sg(e,t){var i=ot;ot=i!==0&&4>i?i:4,e(!0);var v=ul.transition;ul.transition={};try{e(!1),t()}finally{ot=i,ul.transition=v}}function mh(){return gn().memoizedState}function Cg(e,t,i){var v=vr(e);if(i={lane:v,action:i,hasEagerState:!1,eagerState:null,next:null},gh(e))_h(t,i);else if(i=Ku(e,t,i,v),i!==null){var R=Yt();Tn(i,e,v,R),vh(i,t,v)}}function xg(e,t,i){var v=vr(e),R={lane:v,action:i,hasEagerState:!1,eagerState:null,next:null};if(gh(e))_h(t,R);else{var I=e.alternate;if(e.lanes===0&&(I===null||I.lanes===0)&&(I=t.lastRenderedReducer,I!==null))try{var z=t.lastRenderedState,Q=I(z,i);if(R.hasEagerState=!0,R.eagerState=Q,Cn(Q,z)){var te=t.interleaved;te===null?(R.next=R,sl(t)):(R.next=te.next,te.next=R),t.interleaved=R;return}}catch{}finally{}i=Ku(e,t,R,v),i!==null&&(R=Yt(),Tn(i,e,v,R),vh(i,t,v))}}function gh(e){var t=e.alternate;return e===wt||t!==null&&t===wt}function _h(e,t){Ci=Mo=!0;var i=e.pending;i===null?t.next=t:(t.next=i.next,i.next=t),e.pending=t}function vh(e,t,i){if((i&4194240)!==0){var v=t.lanes;v&=e.pendingLanes,i|=v,t.lanes=i,ti(e,i)}}var Do={readContext:mn,useCallback:Wt,useContext:Wt,useEffect:Wt,useImperativeHandle:Wt,useInsertionEffect:Wt,useLayoutEffect:Wt,useMemo:Wt,useReducer:Wt,useRef:Wt,useState:Wt,useDebugValue:Wt,useDeferredValue:Wt,useTransition:Wt,useMutableSource:Wt,useSyncExternalStore:Wt,useId:Wt,unstable_isNewReconciler:!1},kg={readContext:mn,useCallback:function(e,t){return Pn().memoizedState=[e,t===void 0?null:t],e},useContext:mn,useEffect:ah,useImperativeHandle:function(e,t,i){return i=i!=null?i.concat([e]):null,Ao(4194308,4,uh.bind(null,t,e),i)},useLayoutEffect:function(e,t){return Ao(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ao(4,2,e,t)},useMemo:function(e,t){var i=Pn();return t=t===void 0?null:t,e=e(),i.memoizedState=[e,t],e},useReducer:function(e,t,i){var v=Pn();return t=i!==void 0?i(t):t,v.memoizedState=v.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},v.queue=e,e=e.dispatch=Cg.bind(null,wt,e),[v.memoizedState,e]},useRef:function(e){var t=Pn();return e={current:e},t.memoizedState=e},useState:ih,useDebugValue:_l,useDeferredValue:function(e){return Pn().memoizedState=e},useTransition:function(){var e=ih(!1),t=e[0];return e=Sg.bind(null,e[1]),Pn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,i){var v=wt,R=Pn();if(vt){if(i===void 0)throw Error(o(407));i=i()}else{if(i=t(),Dt===null)throw Error(o(349));(Kr&30)!==0||eh(v,t,i)}R.memoizedState=i;var I={value:i,getSnapshot:t};return R.queue=I,ah(nh.bind(null,v,I,e),[e]),v.flags|=2048,Ei(9,th.bind(null,v,I,i,t),void 0,null),i},useId:function(){var e=Pn(),t=Dt.identifierPrefix;if(vt){var i=Gn,v=Kn;i=(v&~(1<<32-Ft(v)-1)).toString(32)+i,t=":"+t+"R"+i,i=xi++,0<i&&(t+="H"+i.toString(32)),t+=":"}else i=bg++,t=":"+t+"r"+i.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Eg={readContext:mn,useCallback:dh,useContext:mn,useEffect:gl,useImperativeHandle:hh,useInsertionEffect:lh,useLayoutEffect:ch,useMemo:fh,useReducer:pl,useRef:oh,useState:function(){return pl(ki)},useDebugValue:_l,useDeferredValue:function(e){var t=gn();return ph(t,Tt.memoizedState,e)},useTransition:function(){var e=pl(ki)[0],t=gn().memoizedState;return[e,t]},useMutableSource:Ju,useSyncExternalStore:Zu,useId:mh,unstable_isNewReconciler:!1},Lg={readContext:mn,useCallback:dh,useContext:mn,useEffect:gl,useImperativeHandle:hh,useInsertionEffect:lh,useLayoutEffect:ch,useMemo:fh,useReducer:ml,useRef:oh,useState:function(){return ml(ki)},useDebugValue:_l,useDeferredValue:function(e){var t=gn();return Tt===null?t.memoizedState=e:ph(t,Tt.memoizedState,e)},useTransition:function(){var e=ml(ki)[0],t=gn().memoizedState;return[e,t]},useMutableSource:Ju,useSyncExternalStore:Zu,useId:mh,unstable_isNewReconciler:!1};function kn(e,t){if(e&&e.defaultProps){t=U({},t),e=e.defaultProps;for(var i in e)t[i]===void 0&&(t[i]=e[i]);return t}return t}function vl(e,t,i,v){t=e.memoizedState,i=i(v,t),i=i==null?t:U({},t,i),e.memoizedState=i,e.lanes===0&&(e.updateQueue.baseState=i)}var Io={isMounted:function(e){return(e=e._reactInternals)?un(e)===e:!1},enqueueSetState:function(e,t,i){e=e._reactInternals;var v=Yt(),R=vr(e),I=Xn(v,R);I.payload=t,i!=null&&(I.callback=i),t=pr(e,I,R),t!==null&&(Tn(t,e,R,v),Eo(t,e,R))},enqueueReplaceState:function(e,t,i){e=e._reactInternals;var v=Yt(),R=vr(e),I=Xn(v,R);I.tag=1,I.payload=t,i!=null&&(I.callback=i),t=pr(e,I,R),t!==null&&(Tn(t,e,R,v),Eo(t,e,R))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var i=Yt(),v=vr(e),R=Xn(i,v);R.tag=2,t!=null&&(R.callback=t),t=pr(e,R,v),t!==null&&(Tn(t,e,v,i),Eo(t,e,v))}};function yh(e,t,i,v,R,I,z){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(v,I,z):t.prototype&&t.prototype.isPureReactComponent?!di(i,v)||!di(R,I):!0}function wh(e,t,i){var v=!1,R=hr,I=t.contextType;return typeof I=="object"&&I!==null?I=mn(I):(R=Qt(t)?Ur:Ut.current,v=t.contextTypes,I=(v=v!=null)?ks(e,R):hr),t=new t(i,I),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Io,e.stateNode=t,t._reactInternals=e,v&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=R,e.__reactInternalMemoizedMaskedChildContext=I),t}function bh(e,t,i,v){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(i,v),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(i,v),t.state!==e&&Io.enqueueReplaceState(t,t.state,null)}function yl(e,t,i,v){var R=e.stateNode;R.props=i,R.state=e.memoizedState,R.refs={},il(e);var I=t.contextType;typeof I=="object"&&I!==null?R.context=mn(I):(I=Qt(t)?Ur:Ut.current,R.context=ks(e,I)),R.state=e.memoizedState,I=t.getDerivedStateFromProps,typeof I=="function"&&(vl(e,t,I,i),R.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof R.getSnapshotBeforeUpdate=="function"||typeof R.UNSAFE_componentWillMount!="function"&&typeof R.componentWillMount!="function"||(t=R.state,typeof R.componentWillMount=="function"&&R.componentWillMount(),typeof R.UNSAFE_componentWillMount=="function"&&R.UNSAFE_componentWillMount(),t!==R.state&&Io.enqueueReplaceState(R,R.state,null),Lo(e,i,R,v),R.state=e.memoizedState),typeof R.componentDidMount=="function"&&(e.flags|=4194308)}function Ds(e,t){try{var i="",v=t;do i+=ce(v),v=v.return;while(v);var R=i}catch(I){R=`
39
- Error generating stack: `+I.message+`
40
- `+I.stack}return{value:e,source:t,stack:R,digest:null}}function wl(e,t,i){return{value:e,source:null,stack:i??null,digest:t??null}}function bl(e,t){try{console.error(t.value)}catch(i){setTimeout(function(){throw i})}}var Tg=typeof WeakMap=="function"?WeakMap:Map;function Sh(e,t,i){i=Xn(-1,i),i.tag=3,i.payload={element:null};var v=t.value;return i.callback=function(){$o||($o=!0,jl=v),bl(e,t)},i}function Ch(e,t,i){i=Xn(-1,i),i.tag=3;var v=e.type.getDerivedStateFromError;if(typeof v=="function"){var R=t.value;i.payload=function(){return v(R)},i.callback=function(){bl(e,t)}}var I=e.stateNode;return I!==null&&typeof I.componentDidCatch=="function"&&(i.callback=function(){bl(e,t),typeof v!="function"&&(gr===null?gr=new Set([this]):gr.add(this));var z=t.stack;this.componentDidCatch(t.value,{componentStack:z!==null?z:""})}),i}function xh(e,t,i){var v=e.pingCache;if(v===null){v=e.pingCache=new Tg;var R=new Set;v.set(t,R)}else R=v.get(t),R===void 0&&(R=new Set,v.set(t,R));R.has(i)||(R.add(i),e=Ug.bind(null,e,t,i),t.then(e,e))}function kh(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function Eh(e,t,i,v,R){return(e.mode&1)===0?(e===t?e.flags|=65536:(e.flags|=128,i.flags|=131072,i.flags&=-52805,i.tag===1&&(i.alternate===null?i.tag=17:(t=Xn(-1,1),t.tag=2,pr(i,t,1))),i.lanes|=1),e):(e.flags|=65536,e.lanes=R,e)}var Rg=C.ReactCurrentOwner,Jt=!1;function Gt(e,t,i,v){t.child=e===null?qu(t,null,i,v):Rs(t,e.child,i,v)}function Lh(e,t,i,v,R){i=i.render;var I=t.ref;return As(t,R),v=dl(e,t,i,v,I,R),i=fl(),e!==null&&!Jt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~R,Qn(e,t,R)):(vt&&i&&Ya(t),t.flags|=1,Gt(e,t,v,R),t.child)}function Th(e,t,i,v,R){if(e===null){var I=i.type;return typeof I=="function"&&!Wl(I)&&I.defaultProps===void 0&&i.compare===null&&i.defaultProps===void 0?(t.tag=15,t.type=I,Rh(e,t,I,v,R)):(e=Ko(i.type,null,v,t,t.mode,R),e.ref=t.ref,e.return=t,t.child=e)}if(I=e.child,(e.lanes&R)===0){var z=I.memoizedProps;if(i=i.compare,i=i!==null?i:di,i(z,v)&&e.ref===t.ref)return Qn(e,t,R)}return t.flags|=1,e=wr(I,v),e.ref=t.ref,e.return=t,t.child=e}function Rh(e,t,i,v,R){if(e!==null){var I=e.memoizedProps;if(di(I,v)&&e.ref===t.ref)if(Jt=!1,t.pendingProps=v=I,(e.lanes&R)!==0)(e.flags&131072)!==0&&(Jt=!0);else return t.lanes=e.lanes,Qn(e,t,R)}return Sl(e,t,i,v,R)}function Mh(e,t,i){var v=t.pendingProps,R=v.children,I=e!==null?e.memoizedState:null;if(v.mode==="hidden")if((t.mode&1)===0)t.memoizedState={baseLanes:0,cachePool:null,transitions:null},dt(Ps,ln),ln|=i;else{if((i&1073741824)===0)return e=I!==null?I.baseLanes|i:i,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,dt(Ps,ln),ln|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},v=I!==null?I.baseLanes:i,dt(Ps,ln),ln|=v}else I!==null?(v=I.baseLanes|i,t.memoizedState=null):v=i,dt(Ps,ln),ln|=v;return Gt(e,t,R,i),t.child}function Ah(e,t){var i=t.ref;(e===null&&i!==null||e!==null&&e.ref!==i)&&(t.flags|=512,t.flags|=2097152)}function Sl(e,t,i,v,R){var I=Qt(i)?Ur:Ut.current;return I=ks(t,I),As(t,R),i=dl(e,t,i,v,I,R),v=fl(),e!==null&&!Jt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~R,Qn(e,t,R)):(vt&&v&&Ya(t),t.flags|=1,Gt(e,t,i,R),t.child)}function Nh(e,t,i,v,R){if(Qt(i)){var I=!0;vo(t)}else I=!1;if(As(t,R),t.stateNode===null)jo(e,t),wh(t,i,v),yl(t,i,v,R),v=!0;else if(e===null){var z=t.stateNode,Q=t.memoizedProps;z.props=Q;var te=z.context,ue=i.contextType;typeof ue=="object"&&ue!==null?ue=mn(ue):(ue=Qt(i)?Ur:Ut.current,ue=ks(t,ue));var ve=i.getDerivedStateFromProps,be=typeof ve=="function"||typeof z.getSnapshotBeforeUpdate=="function";be||typeof z.UNSAFE_componentWillReceiveProps!="function"&&typeof z.componentWillReceiveProps!="function"||(Q!==v||te!==ue)&&bh(t,z,v,ue),fr=!1;var _e=t.memoizedState;z.state=_e,Lo(t,v,z,R),te=t.memoizedState,Q!==v||_e!==te||Xt.current||fr?(typeof ve=="function"&&(vl(t,i,ve,v),te=t.memoizedState),(Q=fr||yh(t,i,Q,v,_e,te,ue))?(be||typeof z.UNSAFE_componentWillMount!="function"&&typeof z.componentWillMount!="function"||(typeof z.componentWillMount=="function"&&z.componentWillMount(),typeof z.UNSAFE_componentWillMount=="function"&&z.UNSAFE_componentWillMount()),typeof z.componentDidMount=="function"&&(t.flags|=4194308)):(typeof z.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=v,t.memoizedState=te),z.props=v,z.state=te,z.context=ue,v=Q):(typeof z.componentDidMount=="function"&&(t.flags|=4194308),v=!1)}else{z=t.stateNode,Gu(e,t),Q=t.memoizedProps,ue=t.type===t.elementType?Q:kn(t.type,Q),z.props=ue,be=t.pendingProps,_e=z.context,te=i.contextType,typeof te=="object"&&te!==null?te=mn(te):(te=Qt(i)?Ur:Ut.current,te=ks(t,te));var Ae=i.getDerivedStateFromProps;(ve=typeof Ae=="function"||typeof z.getSnapshotBeforeUpdate=="function")||typeof z.UNSAFE_componentWillReceiveProps!="function"&&typeof z.componentWillReceiveProps!="function"||(Q!==be||_e!==te)&&bh(t,z,v,te),fr=!1,_e=t.memoizedState,z.state=_e,Lo(t,v,z,R);var Pe=t.memoizedState;Q!==be||_e!==Pe||Xt.current||fr?(typeof Ae=="function"&&(vl(t,i,Ae,v),Pe=t.memoizedState),(ue=fr||yh(t,i,ue,v,_e,Pe,te)||!1)?(ve||typeof z.UNSAFE_componentWillUpdate!="function"&&typeof z.componentWillUpdate!="function"||(typeof z.componentWillUpdate=="function"&&z.componentWillUpdate(v,Pe,te),typeof z.UNSAFE_componentWillUpdate=="function"&&z.UNSAFE_componentWillUpdate(v,Pe,te)),typeof z.componentDidUpdate=="function"&&(t.flags|=4),typeof z.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof z.componentDidUpdate!="function"||Q===e.memoizedProps&&_e===e.memoizedState||(t.flags|=4),typeof z.getSnapshotBeforeUpdate!="function"||Q===e.memoizedProps&&_e===e.memoizedState||(t.flags|=1024),t.memoizedProps=v,t.memoizedState=Pe),z.props=v,z.state=Pe,z.context=te,v=ue):(typeof z.componentDidUpdate!="function"||Q===e.memoizedProps&&_e===e.memoizedState||(t.flags|=4),typeof z.getSnapshotBeforeUpdate!="function"||Q===e.memoizedProps&&_e===e.memoizedState||(t.flags|=1024),v=!1)}return Cl(e,t,i,v,I,R)}function Cl(e,t,i,v,R,I){Ah(e,t);var z=(t.flags&128)!==0;if(!v&&!z)return R&&Ou(t,i,!1),Qn(e,t,I);v=t.stateNode,Rg.current=t;var Q=z&&typeof i.getDerivedStateFromError!="function"?null:v.render();return t.flags|=1,e!==null&&z?(t.child=Rs(t,e.child,null,I),t.child=Rs(t,null,Q,I)):Gt(e,t,Q,I),t.memoizedState=v.state,R&&Ou(t,i,!0),t.child}function Dh(e){var t=e.stateNode;t.pendingContext?Pu(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Pu(e,t.context,!1),ol(e,t.containerInfo)}function Ih(e,t,i,v,R){return Ts(),Za(R),t.flags|=256,Gt(e,t,i,v),t.child}var xl={dehydrated:null,treeContext:null,retryLane:0};function kl(e){return{baseLanes:e,cachePool:null,transitions:null}}function Ph(e,t,i){var v=t.pendingProps,R=yt.current,I=!1,z=(t.flags&128)!==0,Q;if((Q=z)||(Q=e!==null&&e.memoizedState===null?!1:(R&2)!==0),Q?(I=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(R|=1),dt(yt,R&1),e===null)return Ja(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?((t.mode&1)===0?t.lanes=1:e.data==="$!"?t.lanes=8:t.lanes=1073741824,null):(z=v.children,e=v.fallback,I?(v=t.mode,I=t.child,z={mode:"hidden",children:z},(v&1)===0&&I!==null?(I.childLanes=0,I.pendingProps=z):I=Go(z,v,0,null),e=Jr(e,v,i,null),I.return=t,e.return=t,I.sibling=e,t.child=I,t.child.memoizedState=kl(i),t.memoizedState=xl,e):El(t,z));if(R=e.memoizedState,R!==null&&(Q=R.dehydrated,Q!==null))return Mg(e,t,z,v,Q,R,i);if(I){I=v.fallback,z=t.mode,R=e.child,Q=R.sibling;var te={mode:"hidden",children:v.children};return(z&1)===0&&t.child!==R?(v=t.child,v.childLanes=0,v.pendingProps=te,t.deletions=null):(v=wr(R,te),v.subtreeFlags=R.subtreeFlags&14680064),Q!==null?I=wr(Q,I):(I=Jr(I,z,i,null),I.flags|=2),I.return=t,v.return=t,v.sibling=I,t.child=v,v=I,I=t.child,z=e.child.memoizedState,z=z===null?kl(i):{baseLanes:z.baseLanes|i,cachePool:null,transitions:z.transitions},I.memoizedState=z,I.childLanes=e.childLanes&~i,t.memoizedState=xl,v}return I=e.child,e=I.sibling,v=wr(I,{mode:"visible",children:v.children}),(t.mode&1)===0&&(v.lanes=i),v.return=t,v.sibling=null,e!==null&&(i=t.deletions,i===null?(t.deletions=[e],t.flags|=16):i.push(e)),t.child=v,t.memoizedState=null,v}function El(e,t){return t=Go({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Po(e,t,i,v){return v!==null&&Za(v),Rs(t,e.child,null,i),e=El(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Mg(e,t,i,v,R,I,z){if(i)return t.flags&256?(t.flags&=-257,v=wl(Error(o(422))),Po(e,t,z,v)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(I=v.fallback,R=t.mode,v=Go({mode:"visible",children:v.children},R,0,null),I=Jr(I,R,z,null),I.flags|=2,v.return=t,I.return=t,v.sibling=I,t.child=v,(t.mode&1)!==0&&Rs(t,e.child,null,z),t.child.memoizedState=kl(z),t.memoizedState=xl,I);if((t.mode&1)===0)return Po(e,t,z,null);if(R.data==="$!"){if(v=R.nextSibling&&R.nextSibling.dataset,v)var Q=v.dgst;return v=Q,I=Error(o(419)),v=wl(I,v,void 0),Po(e,t,z,v)}if(Q=(z&e.childLanes)!==0,Jt||Q){if(v=Dt,v!==null){switch(z&-z){case 4:R=2;break;case 16:R=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:R=32;break;case 536870912:R=268435456;break;default:R=0}R=(R&(v.suspendedLanes|z))!==0?0:R,R!==0&&R!==I.retryLane&&(I.retryLane=R,Yn(e,R),Tn(v,e,R,-1))}return Ul(),v=wl(Error(o(421))),Po(e,t,z,v)}return R.data==="$?"?(t.flags|=128,t.child=e.child,t=Wg.bind(null,e),R._reactRetry=t,null):(e=I.treeContext,an=cr(R.nextSibling),on=t,vt=!0,xn=null,e!==null&&(fn[pn++]=Kn,fn[pn++]=Gn,fn[pn++]=Wr,Kn=e.id,Gn=e.overflow,Wr=t),t=El(t,v.children),t.flags|=4096,t)}function jh(e,t,i){e.lanes|=t;var v=e.alternate;v!==null&&(v.lanes|=t),rl(e.return,t,i)}function Ll(e,t,i,v,R){var I=e.memoizedState;I===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:v,tail:i,tailMode:R}:(I.isBackwards=t,I.rendering=null,I.renderingStartTime=0,I.last=v,I.tail=i,I.tailMode=R)}function Oh(e,t,i){var v=t.pendingProps,R=v.revealOrder,I=v.tail;if(Gt(e,t,v.children,i),v=yt.current,(v&2)!==0)v=v&1|2,t.flags|=128;else{if(e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&jh(e,i,t);else if(e.tag===19)jh(e,i,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}v&=1}if(dt(yt,v),(t.mode&1)===0)t.memoizedState=null;else switch(R){case"forwards":for(i=t.child,R=null;i!==null;)e=i.alternate,e!==null&&To(e)===null&&(R=i),i=i.sibling;i=R,i===null?(R=t.child,t.child=null):(R=i.sibling,i.sibling=null),Ll(t,!1,R,i,I);break;case"backwards":for(i=null,R=t.child,t.child=null;R!==null;){if(e=R.alternate,e!==null&&To(e)===null){t.child=R;break}e=R.sibling,R.sibling=i,i=R,R=e}Ll(t,!0,i,null,I);break;case"together":Ll(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function jo(e,t){(t.mode&1)===0&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Qn(e,t,i){if(e!==null&&(t.dependencies=e.dependencies),Gr|=t.lanes,(i&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(o(153));if(t.child!==null){for(e=t.child,i=wr(e,e.pendingProps),t.child=i,i.return=t;e.sibling!==null;)e=e.sibling,i=i.sibling=wr(e,e.pendingProps),i.return=t;i.sibling=null}return t.child}function Ag(e,t,i){switch(t.tag){case 3:Dh(t),Ts();break;case 5:Qu(t);break;case 1:Qt(t.type)&&vo(t);break;case 4:ol(t,t.stateNode.containerInfo);break;case 10:var v=t.type._context,R=t.memoizedProps.value;dt(xo,v._currentValue),v._currentValue=R;break;case 13:if(v=t.memoizedState,v!==null)return v.dehydrated!==null?(dt(yt,yt.current&1),t.flags|=128,null):(i&t.child.childLanes)!==0?Ph(e,t,i):(dt(yt,yt.current&1),e=Qn(e,t,i),e!==null?e.sibling:null);dt(yt,yt.current&1);break;case 19:if(v=(i&t.childLanes)!==0,(e.flags&128)!==0){if(v)return Oh(e,t,i);t.flags|=128}if(R=t.memoizedState,R!==null&&(R.rendering=null,R.tail=null,R.lastEffect=null),dt(yt,yt.current),v)break;return null;case 22:case 23:return t.lanes=0,Mh(e,t,i)}return Qn(e,t,i)}var Bh,Tl,Fh,Hh;Bh=function(e,t){for(var i=t.child;i!==null;){if(i.tag===5||i.tag===6)e.appendChild(i.stateNode);else if(i.tag!==4&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break;for(;i.sibling===null;){if(i.return===null||i.return===t)return;i=i.return}i.sibling.return=i.return,i=i.sibling}},Tl=function(){},Fh=function(e,t,i,v){var R=e.memoizedProps;if(R!==v){e=t.stateNode,qr(In.current);var I=null;switch(i){case"input":R=ke(e,R),v=ke(e,v),I=[];break;case"select":R=U({},R,{value:void 0}),v=U({},v,{value:void 0}),I=[];break;case"textarea":R=We(e,R),v=We(e,v),I=[];break;default:typeof R.onClick!="function"&&typeof v.onClick=="function"&&(e.onclick=mo)}Ue(i,v);var z;i=null;for(ue in R)if(!v.hasOwnProperty(ue)&&R.hasOwnProperty(ue)&&R[ue]!=null)if(ue==="style"){var Q=R[ue];for(z in Q)Q.hasOwnProperty(z)&&(i||(i={}),i[z]="")}else ue!=="dangerouslySetInnerHTML"&&ue!=="children"&&ue!=="suppressContentEditableWarning"&&ue!=="suppressHydrationWarning"&&ue!=="autoFocus"&&(w.hasOwnProperty(ue)?I||(I=[]):(I=I||[]).push(ue,null));for(ue in v){var te=v[ue];if(Q=R!=null?R[ue]:void 0,v.hasOwnProperty(ue)&&te!==Q&&(te!=null||Q!=null))if(ue==="style")if(Q){for(z in Q)!Q.hasOwnProperty(z)||te&&te.hasOwnProperty(z)||(i||(i={}),i[z]="");for(z in te)te.hasOwnProperty(z)&&Q[z]!==te[z]&&(i||(i={}),i[z]=te[z])}else i||(I||(I=[]),I.push(ue,i)),i=te;else ue==="dangerouslySetInnerHTML"?(te=te?te.__html:void 0,Q=Q?Q.__html:void 0,te!=null&&Q!==te&&(I=I||[]).push(ue,te)):ue==="children"?typeof te!="string"&&typeof te!="number"||(I=I||[]).push(ue,""+te):ue!=="suppressContentEditableWarning"&&ue!=="suppressHydrationWarning"&&(w.hasOwnProperty(ue)?(te!=null&&ue==="onScroll"&&mt("scroll",e),I||Q===te||(I=[])):(I=I||[]).push(ue,te))}i&&(I=I||[]).push("style",i);var ue=I;(t.updateQueue=ue)&&(t.flags|=4)}},Hh=function(e,t,i,v){i!==v&&(t.flags|=4)};function Li(e,t){if(!vt)switch(e.tailMode){case"hidden":t=e.tail;for(var i=null;t!==null;)t.alternate!==null&&(i=t),t=t.sibling;i===null?e.tail=null:i.sibling=null;break;case"collapsed":i=e.tail;for(var v=null;i!==null;)i.alternate!==null&&(v=i),i=i.sibling;v===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:v.sibling=null}}function zt(e){var t=e.alternate!==null&&e.alternate.child===e.child,i=0,v=0;if(t)for(var R=e.child;R!==null;)i|=R.lanes|R.childLanes,v|=R.subtreeFlags&14680064,v|=R.flags&14680064,R.return=e,R=R.sibling;else for(R=e.child;R!==null;)i|=R.lanes|R.childLanes,v|=R.subtreeFlags,v|=R.flags,R.return=e,R=R.sibling;return e.subtreeFlags|=v,e.childLanes=i,t}function Ng(e,t,i){var v=t.pendingProps;switch(Xa(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return zt(t),null;case 1:return Qt(t.type)&&_o(),zt(t),null;case 3:return v=t.stateNode,Ns(),gt(Xt),gt(Ut),cl(),v.pendingContext&&(v.context=v.pendingContext,v.pendingContext=null),(e===null||e.child===null)&&(So(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,xn!==null&&(Fl(xn),xn=null))),Tl(e,t),zt(t),null;case 5:al(t);var R=qr(Si.current);if(i=t.type,e!==null&&t.stateNode!=null)Fh(e,t,i,v,R),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!v){if(t.stateNode===null)throw Error(o(166));return zt(t),null}if(e=qr(In.current),So(t)){v=t.stateNode,i=t.type;var I=t.memoizedProps;switch(v[Dn]=t,v[_i]=I,e=(t.mode&1)!==0,i){case"dialog":mt("cancel",v),mt("close",v);break;case"iframe":case"object":case"embed":mt("load",v);break;case"video":case"audio":for(R=0;R<pi.length;R++)mt(pi[R],v);break;case"source":mt("error",v);break;case"img":case"image":case"link":mt("error",v),mt("load",v);break;case"details":mt("toggle",v);break;case"input":le(v,I),mt("invalid",v);break;case"select":v._wrapperState={wasMultiple:!!I.multiple},mt("invalid",v);break;case"textarea":Le(v,I),mt("invalid",v)}Ue(i,I),R=null;for(var z in I)if(I.hasOwnProperty(z)){var Q=I[z];z==="children"?typeof Q=="string"?v.textContent!==Q&&(I.suppressHydrationWarning!==!0&&po(v.textContent,Q,e),R=["children",Q]):typeof Q=="number"&&v.textContent!==""+Q&&(I.suppressHydrationWarning!==!0&&po(v.textContent,Q,e),R=["children",""+Q]):w.hasOwnProperty(z)&&Q!=null&&z==="onScroll"&&mt("scroll",v)}switch(i){case"input":de(v),Qe(v,I,!0);break;case"textarea":de(v),$e(v);break;case"select":case"option":break;default:typeof I.onClick=="function"&&(v.onclick=mo)}v=R,t.updateQueue=v,v!==null&&(t.flags|=4)}else{z=R.nodeType===9?R:R.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=tt(i)),e==="http://www.w3.org/1999/xhtml"?i==="script"?(e=z.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof v.is=="string"?e=z.createElement(i,{is:v.is}):(e=z.createElement(i),i==="select"&&(z=e,v.multiple?z.multiple=!0:v.size&&(z.size=v.size))):e=z.createElementNS(e,i),e[Dn]=t,e[_i]=v,Bh(e,t,!1,!1),t.stateNode=e;e:{switch(z=fe(i,v),i){case"dialog":mt("cancel",e),mt("close",e),R=v;break;case"iframe":case"object":case"embed":mt("load",e),R=v;break;case"video":case"audio":for(R=0;R<pi.length;R++)mt(pi[R],e);R=v;break;case"source":mt("error",e),R=v;break;case"img":case"image":case"link":mt("error",e),mt("load",e),R=v;break;case"details":mt("toggle",e),R=v;break;case"input":le(e,v),R=ke(e,v),mt("invalid",e);break;case"option":R=v;break;case"select":e._wrapperState={wasMultiple:!!v.multiple},R=U({},v,{value:void 0}),mt("invalid",e);break;case"textarea":Le(e,v),R=We(e,v),mt("invalid",e);break;default:R=v}Ue(i,R),Q=R;for(I in Q)if(Q.hasOwnProperty(I)){var te=Q[I];I==="style"?at(e,te):I==="dangerouslySetInnerHTML"?(te=te?te.__html:void 0,te!=null&&ut(e,te)):I==="children"?typeof te=="string"?(i!=="textarea"||te!=="")&&Ze(e,te):typeof te=="number"&&Ze(e,""+te):I!=="suppressContentEditableWarning"&&I!=="suppressHydrationWarning"&&I!=="autoFocus"&&(w.hasOwnProperty(I)?te!=null&&I==="onScroll"&&mt("scroll",e):te!=null&&h(e,I,te,z))}switch(i){case"input":de(e),Qe(e,v,!1);break;case"textarea":de(e),$e(e);break;case"option":v.value!=null&&e.setAttribute("value",""+W(v.value));break;case"select":e.multiple=!!v.multiple,I=v.value,I!=null?Te(e,!!v.multiple,I,!1):v.defaultValue!=null&&Te(e,!!v.multiple,v.defaultValue,!0);break;default:typeof R.onClick=="function"&&(e.onclick=mo)}switch(i){case"button":case"input":case"select":case"textarea":v=!!v.autoFocus;break e;case"img":v=!0;break e;default:v=!1}}v&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return zt(t),null;case 6:if(e&&t.stateNode!=null)Hh(e,t,e.memoizedProps,v);else{if(typeof v!="string"&&t.stateNode===null)throw Error(o(166));if(i=qr(Si.current),qr(In.current),So(t)){if(v=t.stateNode,i=t.memoizedProps,v[Dn]=t,(I=v.nodeValue!==i)&&(e=on,e!==null))switch(e.tag){case 3:po(v.nodeValue,i,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&po(v.nodeValue,i,(e.mode&1)!==0)}I&&(t.flags|=4)}else v=(i.nodeType===9?i:i.ownerDocument).createTextNode(v),v[Dn]=t,t.stateNode=v}return zt(t),null;case 13:if(gt(yt),v=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(vt&&an!==null&&(t.mode&1)!==0&&(t.flags&128)===0)Wu(),Ts(),t.flags|=98560,I=!1;else if(I=So(t),v!==null&&v.dehydrated!==null){if(e===null){if(!I)throw Error(o(318));if(I=t.memoizedState,I=I!==null?I.dehydrated:null,!I)throw Error(o(317));I[Dn]=t}else Ts(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;zt(t),I=!1}else xn!==null&&(Fl(xn),xn=null),I=!0;if(!I)return t.flags&65536?t:null}return(t.flags&128)!==0?(t.lanes=i,t):(v=v!==null,v!==(e!==null&&e.memoizedState!==null)&&v&&(t.child.flags|=8192,(t.mode&1)!==0&&(e===null||(yt.current&1)!==0?Rt===0&&(Rt=3):Ul())),t.updateQueue!==null&&(t.flags|=4),zt(t),null);case 4:return Ns(),Tl(e,t),e===null&&mi(t.stateNode.containerInfo),zt(t),null;case 10:return nl(t.type._context),zt(t),null;case 17:return Qt(t.type)&&_o(),zt(t),null;case 19:if(gt(yt),I=t.memoizedState,I===null)return zt(t),null;if(v=(t.flags&128)!==0,z=I.rendering,z===null)if(v)Li(I,!1);else{if(Rt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(z=To(e),z!==null){for(t.flags|=128,Li(I,!1),v=z.updateQueue,v!==null&&(t.updateQueue=v,t.flags|=4),t.subtreeFlags=0,v=i,i=t.child;i!==null;)I=i,e=v,I.flags&=14680066,z=I.alternate,z===null?(I.childLanes=0,I.lanes=e,I.child=null,I.subtreeFlags=0,I.memoizedProps=null,I.memoizedState=null,I.updateQueue=null,I.dependencies=null,I.stateNode=null):(I.childLanes=z.childLanes,I.lanes=z.lanes,I.child=z.child,I.subtreeFlags=0,I.deletions=null,I.memoizedProps=z.memoizedProps,I.memoizedState=z.memoizedState,I.updateQueue=z.updateQueue,I.type=z.type,e=z.dependencies,I.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),i=i.sibling;return dt(yt,yt.current&1|2),t.child}e=e.sibling}I.tail!==null&&pt()>js&&(t.flags|=128,v=!0,Li(I,!1),t.lanes=4194304)}else{if(!v)if(e=To(z),e!==null){if(t.flags|=128,v=!0,i=e.updateQueue,i!==null&&(t.updateQueue=i,t.flags|=4),Li(I,!0),I.tail===null&&I.tailMode==="hidden"&&!z.alternate&&!vt)return zt(t),null}else 2*pt()-I.renderingStartTime>js&&i!==1073741824&&(t.flags|=128,v=!0,Li(I,!1),t.lanes=4194304);I.isBackwards?(z.sibling=t.child,t.child=z):(i=I.last,i!==null?i.sibling=z:t.child=z,I.last=z)}return I.tail!==null?(t=I.tail,I.rendering=t,I.tail=t.sibling,I.renderingStartTime=pt(),t.sibling=null,i=yt.current,dt(yt,v?i&1|2:i&1),t):(zt(t),null);case 22:case 23:return $l(),v=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==v&&(t.flags|=8192),v&&(t.mode&1)!==0?(ln&1073741824)!==0&&(zt(t),t.subtreeFlags&6&&(t.flags|=8192)):zt(t),null;case 24:return null;case 25:return null}throw Error(o(156,t.tag))}function Dg(e,t){switch(Xa(t),t.tag){case 1:return Qt(t.type)&&_o(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ns(),gt(Xt),gt(Ut),cl(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return al(t),null;case 13:if(gt(yt),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));Ts()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return gt(yt),null;case 4:return Ns(),null;case 10:return nl(t.type._context),null;case 22:case 23:return $l(),null;case 24:return null;default:return null}}var Oo=!1,Vt=!1,Ig=typeof WeakSet=="function"?WeakSet:Set,Ie=null;function Is(e,t){var i=e.ref;if(i!==null)if(typeof i=="function")try{i(null)}catch(v){Ct(e,t,v)}else i.current=null}function Rl(e,t,i){try{i()}catch(v){Ct(e,t,v)}}var $h=!1;function Pg(e,t){if($a=ds,e=yu(),Da(e)){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{i=(i=e.ownerDocument)&&i.defaultView||window;var v=i.getSelection&&i.getSelection();if(v&&v.rangeCount!==0){i=v.anchorNode;var R=v.anchorOffset,I=v.focusNode;v=v.focusOffset;try{i.nodeType,I.nodeType}catch{i=null;break e}var z=0,Q=-1,te=-1,ue=0,ve=0,be=e,_e=null;t:for(;;){for(var Ae;be!==i||R!==0&&be.nodeType!==3||(Q=z+R),be!==I||v!==0&&be.nodeType!==3||(te=z+v),be.nodeType===3&&(z+=be.nodeValue.length),(Ae=be.firstChild)!==null;)_e=be,be=Ae;for(;;){if(be===e)break t;if(_e===i&&++ue===R&&(Q=z),_e===I&&++ve===v&&(te=z),(Ae=be.nextSibling)!==null)break;be=_e,_e=be.parentNode}be=Ae}i=Q===-1||te===-1?null:{start:Q,end:te}}else i=null}i=i||{start:0,end:0}}else i=null;for(Ua={focusedElem:e,selectionRange:i},ds=!1,Ie=t;Ie!==null;)if(t=Ie,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Ie=e;else for(;Ie!==null;){t=Ie;try{var Pe=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(Pe!==null){var Oe=Pe.memoizedProps,xt=Pe.memoizedState,oe=t.stateNode,re=oe.getSnapshotBeforeUpdate(t.elementType===t.type?Oe:kn(t.type,Oe),xt);oe.__reactInternalSnapshotBeforeUpdate=re}break;case 3:var ae=t.stateNode.containerInfo;ae.nodeType===1?ae.textContent="":ae.nodeType===9&&ae.documentElement&&ae.removeChild(ae.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(o(163))}}catch(Ce){Ct(t,t.return,Ce)}if(e=t.sibling,e!==null){e.return=t.return,Ie=e;break}Ie=t.return}return Pe=$h,$h=!1,Pe}function Ti(e,t,i){var v=t.updateQueue;if(v=v!==null?v.lastEffect:null,v!==null){var R=v=v.next;do{if((R.tag&e)===e){var I=R.destroy;R.destroy=void 0,I!==void 0&&Rl(t,i,I)}R=R.next}while(R!==v)}}function Bo(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var i=t=t.next;do{if((i.tag&e)===e){var v=i.create;i.destroy=v()}i=i.next}while(i!==t)}}function Ml(e){var t=e.ref;if(t!==null){var i=e.stateNode;switch(e.tag){case 5:e=i;break;default:e=i}typeof t=="function"?t(e):t.current=e}}function Uh(e){var t=e.alternate;t!==null&&(e.alternate=null,Uh(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Dn],delete t[_i],delete t[qa],delete t[_g],delete t[vg])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Wh(e){return e.tag===5||e.tag===3||e.tag===4}function zh(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Wh(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Al(e,t,i){var v=e.tag;if(v===5||v===6)e=e.stateNode,t?i.nodeType===8?i.parentNode.insertBefore(e,t):i.insertBefore(e,t):(i.nodeType===8?(t=i.parentNode,t.insertBefore(e,i)):(t=i,t.appendChild(e)),i=i._reactRootContainer,i!=null||t.onclick!==null||(t.onclick=mo));else if(v!==4&&(e=e.child,e!==null))for(Al(e,t,i),e=e.sibling;e!==null;)Al(e,t,i),e=e.sibling}function Nl(e,t,i){var v=e.tag;if(v===5||v===6)e=e.stateNode,t?i.insertBefore(e,t):i.appendChild(e);else if(v!==4&&(e=e.child,e!==null))for(Nl(e,t,i),e=e.sibling;e!==null;)Nl(e,t,i),e=e.sibling}var jt=null,En=!1;function mr(e,t,i){for(i=i.child;i!==null;)Vh(e,t,i),i=i.sibling}function Vh(e,t,i){if(sn&&typeof sn.onCommitFiberUnmount=="function")try{sn.onCommitFiberUnmount(ns,i)}catch{}switch(i.tag){case 5:Vt||Is(i,t);case 6:var v=jt,R=En;jt=null,mr(e,t,i),jt=v,En=R,jt!==null&&(En?(e=jt,i=i.stateNode,e.nodeType===8?e.parentNode.removeChild(i):e.removeChild(i)):jt.removeChild(i.stateNode));break;case 18:jt!==null&&(En?(e=jt,i=i.stateNode,e.nodeType===8?Va(e.parentNode,i):e.nodeType===1&&Va(e,i),Or(e)):Va(jt,i.stateNode));break;case 4:v=jt,R=En,jt=i.stateNode.containerInfo,En=!0,mr(e,t,i),jt=v,En=R;break;case 0:case 11:case 14:case 15:if(!Vt&&(v=i.updateQueue,v!==null&&(v=v.lastEffect,v!==null))){R=v=v.next;do{var I=R,z=I.destroy;I=I.tag,z!==void 0&&((I&2)!==0||(I&4)!==0)&&Rl(i,t,z),R=R.next}while(R!==v)}mr(e,t,i);break;case 1:if(!Vt&&(Is(i,t),v=i.stateNode,typeof v.componentWillUnmount=="function"))try{v.props=i.memoizedProps,v.state=i.memoizedState,v.componentWillUnmount()}catch(Q){Ct(i,t,Q)}mr(e,t,i);break;case 21:mr(e,t,i);break;case 22:i.mode&1?(Vt=(v=Vt)||i.memoizedState!==null,mr(e,t,i),Vt=v):mr(e,t,i);break;default:mr(e,t,i)}}function qh(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var i=e.stateNode;i===null&&(i=e.stateNode=new Ig),t.forEach(function(v){var R=zg.bind(null,e,v);i.has(v)||(i.add(v),v.then(R,R))})}}function Ln(e,t){var i=t.deletions;if(i!==null)for(var v=0;v<i.length;v++){var R=i[v];try{var I=e,z=t,Q=z;e:for(;Q!==null;){switch(Q.tag){case 5:jt=Q.stateNode,En=!1;break e;case 3:jt=Q.stateNode.containerInfo,En=!0;break e;case 4:jt=Q.stateNode.containerInfo,En=!0;break e}Q=Q.return}if(jt===null)throw Error(o(160));Vh(I,z,R),jt=null,En=!1;var te=R.alternate;te!==null&&(te.return=null),R.return=null}catch(ue){Ct(R,t,ue)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Kh(t,e),t=t.sibling}function Kh(e,t){var i=e.alternate,v=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Ln(t,e),jn(e),v&4){try{Ti(3,e,e.return),Bo(3,e)}catch(Oe){Ct(e,e.return,Oe)}try{Ti(5,e,e.return)}catch(Oe){Ct(e,e.return,Oe)}}break;case 1:Ln(t,e),jn(e),v&512&&i!==null&&Is(i,i.return);break;case 5:if(Ln(t,e),jn(e),v&512&&i!==null&&Is(i,i.return),e.flags&32){var R=e.stateNode;try{Ze(R,"")}catch(Oe){Ct(e,e.return,Oe)}}if(v&4&&(R=e.stateNode,R!=null)){var I=e.memoizedProps,z=i!==null?i.memoizedProps:I,Q=e.type,te=e.updateQueue;if(e.updateQueue=null,te!==null)try{Q==="input"&&I.type==="radio"&&I.name!=null&&we(R,I),fe(Q,z);var ue=fe(Q,I);for(z=0;z<te.length;z+=2){var ve=te[z],be=te[z+1];ve==="style"?at(R,be):ve==="dangerouslySetInnerHTML"?ut(R,be):ve==="children"?Ze(R,be):h(R,ve,be,ue)}switch(Q){case"input":me(R,I);break;case"textarea":Ke(R,I);break;case"select":var _e=R._wrapperState.wasMultiple;R._wrapperState.wasMultiple=!!I.multiple;var Ae=I.value;Ae!=null?Te(R,!!I.multiple,Ae,!1):_e!==!!I.multiple&&(I.defaultValue!=null?Te(R,!!I.multiple,I.defaultValue,!0):Te(R,!!I.multiple,I.multiple?[]:"",!1))}R[_i]=I}catch(Oe){Ct(e,e.return,Oe)}}break;case 6:if(Ln(t,e),jn(e),v&4){if(e.stateNode===null)throw Error(o(162));R=e.stateNode,I=e.memoizedProps;try{R.nodeValue=I}catch(Oe){Ct(e,e.return,Oe)}}break;case 3:if(Ln(t,e),jn(e),v&4&&i!==null&&i.memoizedState.isDehydrated)try{Or(t.containerInfo)}catch(Oe){Ct(e,e.return,Oe)}break;case 4:Ln(t,e),jn(e);break;case 13:Ln(t,e),jn(e),R=e.child,R.flags&8192&&(I=R.memoizedState!==null,R.stateNode.isHidden=I,!I||R.alternate!==null&&R.alternate.memoizedState!==null||(Pl=pt())),v&4&&qh(e);break;case 22:if(ve=i!==null&&i.memoizedState!==null,e.mode&1?(Vt=(ue=Vt)||ve,Ln(t,e),Vt=ue):Ln(t,e),jn(e),v&8192){if(ue=e.memoizedState!==null,(e.stateNode.isHidden=ue)&&!ve&&(e.mode&1)!==0)for(Ie=e,ve=e.child;ve!==null;){for(be=Ie=ve;Ie!==null;){switch(_e=Ie,Ae=_e.child,_e.tag){case 0:case 11:case 14:case 15:Ti(4,_e,_e.return);break;case 1:Is(_e,_e.return);var Pe=_e.stateNode;if(typeof Pe.componentWillUnmount=="function"){v=_e,i=_e.return;try{t=v,Pe.props=t.memoizedProps,Pe.state=t.memoizedState,Pe.componentWillUnmount()}catch(Oe){Ct(v,i,Oe)}}break;case 5:Is(_e,_e.return);break;case 22:if(_e.memoizedState!==null){Xh(be);continue}}Ae!==null?(Ae.return=_e,Ie=Ae):Xh(be)}ve=ve.sibling}e:for(ve=null,be=e;;){if(be.tag===5){if(ve===null){ve=be;try{R=be.stateNode,ue?(I=R.style,typeof I.setProperty=="function"?I.setProperty("display","none","important"):I.display="none"):(Q=be.stateNode,te=be.memoizedProps.style,z=te!=null&&te.hasOwnProperty("display")?te.display:null,Q.style.display=rt("display",z))}catch(Oe){Ct(e,e.return,Oe)}}}else if(be.tag===6){if(ve===null)try{be.stateNode.nodeValue=ue?"":be.memoizedProps}catch(Oe){Ct(e,e.return,Oe)}}else if((be.tag!==22&&be.tag!==23||be.memoizedState===null||be===e)&&be.child!==null){be.child.return=be,be=be.child;continue}if(be===e)break e;for(;be.sibling===null;){if(be.return===null||be.return===e)break e;ve===be&&(ve=null),be=be.return}ve===be&&(ve=null),be.sibling.return=be.return,be=be.sibling}}break;case 19:Ln(t,e),jn(e),v&4&&qh(e);break;case 21:break;default:Ln(t,e),jn(e)}}function jn(e){var t=e.flags;if(t&2){try{e:{for(var i=e.return;i!==null;){if(Wh(i)){var v=i;break e}i=i.return}throw Error(o(160))}switch(v.tag){case 5:var R=v.stateNode;v.flags&32&&(Ze(R,""),v.flags&=-33);var I=zh(e);Nl(e,I,R);break;case 3:case 4:var z=v.stateNode.containerInfo,Q=zh(e);Al(e,Q,z);break;default:throw Error(o(161))}}catch(te){Ct(e,e.return,te)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function jg(e,t,i){Ie=e,Gh(e)}function Gh(e,t,i){for(var v=(e.mode&1)!==0;Ie!==null;){var R=Ie,I=R.child;if(R.tag===22&&v){var z=R.memoizedState!==null||Oo;if(!z){var Q=R.alternate,te=Q!==null&&Q.memoizedState!==null||Vt;Q=Oo;var ue=Vt;if(Oo=z,(Vt=te)&&!ue)for(Ie=R;Ie!==null;)z=Ie,te=z.child,z.tag===22&&z.memoizedState!==null?Qh(R):te!==null?(te.return=z,Ie=te):Qh(R);for(;I!==null;)Ie=I,Gh(I),I=I.sibling;Ie=R,Oo=Q,Vt=ue}Yh(e)}else(R.subtreeFlags&8772)!==0&&I!==null?(I.return=R,Ie=I):Yh(e)}}function Yh(e){for(;Ie!==null;){var t=Ie;if((t.flags&8772)!==0){var i=t.alternate;try{if((t.flags&8772)!==0)switch(t.tag){case 0:case 11:case 15:Vt||Bo(5,t);break;case 1:var v=t.stateNode;if(t.flags&4&&!Vt)if(i===null)v.componentDidMount();else{var R=t.elementType===t.type?i.memoizedProps:kn(t.type,i.memoizedProps);v.componentDidUpdate(R,i.memoizedState,v.__reactInternalSnapshotBeforeUpdate)}var I=t.updateQueue;I!==null&&Xu(t,I,v);break;case 3:var z=t.updateQueue;if(z!==null){if(i=null,t.child!==null)switch(t.child.tag){case 5:i=t.child.stateNode;break;case 1:i=t.child.stateNode}Xu(t,z,i)}break;case 5:var Q=t.stateNode;if(i===null&&t.flags&4){i=Q;var te=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":te.autoFocus&&i.focus();break;case"img":te.src&&(i.src=te.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var ue=t.alternate;if(ue!==null){var ve=ue.memoizedState;if(ve!==null){var be=ve.dehydrated;be!==null&&Or(be)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(o(163))}Vt||t.flags&512&&Ml(t)}catch(_e){Ct(t,t.return,_e)}}if(t===e){Ie=null;break}if(i=t.sibling,i!==null){i.return=t.return,Ie=i;break}Ie=t.return}}function Xh(e){for(;Ie!==null;){var t=Ie;if(t===e){Ie=null;break}var i=t.sibling;if(i!==null){i.return=t.return,Ie=i;break}Ie=t.return}}function Qh(e){for(;Ie!==null;){var t=Ie;try{switch(t.tag){case 0:case 11:case 15:var i=t.return;try{Bo(4,t)}catch(te){Ct(t,i,te)}break;case 1:var v=t.stateNode;if(typeof v.componentDidMount=="function"){var R=t.return;try{v.componentDidMount()}catch(te){Ct(t,R,te)}}var I=t.return;try{Ml(t)}catch(te){Ct(t,I,te)}break;case 5:var z=t.return;try{Ml(t)}catch(te){Ct(t,z,te)}}}catch(te){Ct(t,t.return,te)}if(t===e){Ie=null;break}var Q=t.sibling;if(Q!==null){Q.return=t.return,Ie=Q;break}Ie=t.return}}var Og=Math.ceil,Fo=C.ReactCurrentDispatcher,Dl=C.ReactCurrentOwner,_n=C.ReactCurrentBatchConfig,st=0,Dt=null,kt=null,Ot=0,ln=0,Ps=ur(0),Rt=0,Ri=null,Gr=0,Ho=0,Il=0,Mi=null,Zt=null,Pl=0,js=1/0,Jn=null,$o=!1,jl=null,gr=null,Uo=!1,_r=null,Wo=0,Ai=0,Ol=null,zo=-1,Vo=0;function Yt(){return(st&6)!==0?pt():zo!==-1?zo:zo=pt()}function vr(e){return(e.mode&1)===0?1:(st&2)!==0&&Ot!==0?Ot&-Ot:wg.transition!==null?(Vo===0&&(Vo=ei()),Vo):(e=ot,e!==0||(e=window.event,e=e===void 0?16:ii(e.type)),e)}function Tn(e,t,i,v){if(50<Ai)throw Ai=0,Ol=null,Error(o(185));sr(e,i,v),((st&2)===0||e!==Dt)&&(e===Dt&&((st&2)===0&&(Ho|=i),Rt===4&&yr(e,Ot)),en(e,v),i===1&&st===0&&(t.mode&1)===0&&(js=pt()+500,yo&&dr()))}function en(e,t){var i=e.callbackNode;Js(e,t);var v=ss(e,e===Dt?Ot:0);if(v===0)i!==null&&ts(i),e.callbackNode=null,e.callbackPriority=0;else if(t=v&-v,e.callbackPriority!==t){if(i!=null&&ts(i),t===1)e.tag===0?yg(Zh.bind(null,e)):Bu(Zh.bind(null,e)),mg(function(){(st&6)===0&&dr()}),i=null;else{switch(ni(v)){case 1:i=tr;break;case 4:i=Dr;break;case 16:i=yn;break;case 536870912:i=rn;break;default:i=yn}i=ad(i,Jh.bind(null,e))}e.callbackPriority=t,e.callbackNode=i}}function Jh(e,t){if(zo=-1,Vo=0,(st&6)!==0)throw Error(o(327));var i=e.callbackNode;if(Os()&&e.callbackNode!==i)return null;var v=ss(e,e===Dt?Ot:0);if(v===0)return null;if((v&30)!==0||(v&e.expiredLanes)!==0||t)t=qo(e,v);else{t=v;var R=st;st|=2;var I=td();(Dt!==e||Ot!==t)&&(Jn=null,js=pt()+500,Xr(e,t));do try{Hg();break}catch(Q){ed(e,Q)}while(!0);tl(),Fo.current=I,st=R,kt!==null?t=0:(Dt=null,Ot=0,t=Rt)}if(t!==0){if(t===2&&(R=Zs(e),R!==0&&(v=R,t=Bl(e,R))),t===1)throw i=Ri,Xr(e,0),yr(e,v),en(e,pt()),i;if(t===6)yr(e,v);else{if(R=e.current.alternate,(v&30)===0&&!Bg(R)&&(t=qo(e,v),t===2&&(I=Zs(e),I!==0&&(v=I,t=Bl(e,I))),t===1))throw i=Ri,Xr(e,0),yr(e,v),en(e,pt()),i;switch(e.finishedWork=R,e.finishedLanes=v,t){case 0:case 1:throw Error(o(345));case 2:Qr(e,Zt,Jn);break;case 3:if(yr(e,v),(v&130023424)===v&&(t=Pl+500-pt(),10<t)){if(ss(e,0)!==0)break;if(R=e.suspendedLanes,(R&v)!==v){Yt(),e.pingedLanes|=e.suspendedLanes&R;break}e.timeoutHandle=za(Qr.bind(null,e,Zt,Jn),t);break}Qr(e,Zt,Jn);break;case 4:if(yr(e,v),(v&4194240)===v)break;for(t=e.eventTimes,R=-1;0<v;){var z=31-Ft(v);I=1<<z,z=t[z],z>R&&(R=z),v&=~I}if(v=R,v=pt()-v,v=(120>v?120:480>v?480:1080>v?1080:1920>v?1920:3e3>v?3e3:4320>v?4320:1960*Og(v/1960))-v,10<v){e.timeoutHandle=za(Qr.bind(null,e,Zt,Jn),v);break}Qr(e,Zt,Jn);break;case 5:Qr(e,Zt,Jn);break;default:throw Error(o(329))}}}return en(e,pt()),e.callbackNode===i?Jh.bind(null,e):null}function Bl(e,t){var i=Mi;return e.current.memoizedState.isDehydrated&&(Xr(e,t).flags|=256),e=qo(e,t),e!==2&&(t=Zt,Zt=i,t!==null&&Fl(t)),e}function Fl(e){Zt===null?Zt=e:Zt.push.apply(Zt,e)}function Bg(e){for(var t=e;;){if(t.flags&16384){var i=t.updateQueue;if(i!==null&&(i=i.stores,i!==null))for(var v=0;v<i.length;v++){var R=i[v],I=R.getSnapshot;R=R.value;try{if(!Cn(I(),R))return!1}catch{return!1}}}if(i=t.child,t.subtreeFlags&16384&&i!==null)i.return=t,t=i;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function yr(e,t){for(t&=~Il,t&=~Ho,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var i=31-Ft(t),v=1<<i;e[i]=-1,t&=~v}}function Zh(e){if((st&6)!==0)throw Error(o(327));Os();var t=ss(e,0);if((t&1)===0)return en(e,pt()),null;var i=qo(e,t);if(e.tag!==0&&i===2){var v=Zs(e);v!==0&&(t=v,i=Bl(e,v))}if(i===1)throw i=Ri,Xr(e,0),yr(e,t),en(e,pt()),i;if(i===6)throw Error(o(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Qr(e,Zt,Jn),en(e,pt()),null}function Hl(e,t){var i=st;st|=1;try{return e(t)}finally{st=i,st===0&&(js=pt()+500,yo&&dr())}}function Yr(e){_r!==null&&_r.tag===0&&(st&6)===0&&Os();var t=st;st|=1;var i=_n.transition,v=ot;try{if(_n.transition=null,ot=1,e)return e()}finally{ot=v,_n.transition=i,st=t,(st&6)===0&&dr()}}function $l(){ln=Ps.current,gt(Ps)}function Xr(e,t){e.finishedWork=null,e.finishedLanes=0;var i=e.timeoutHandle;if(i!==-1&&(e.timeoutHandle=-1,pg(i)),kt!==null)for(i=kt.return;i!==null;){var v=i;switch(Xa(v),v.tag){case 1:v=v.type.childContextTypes,v!=null&&_o();break;case 3:Ns(),gt(Xt),gt(Ut),cl();break;case 5:al(v);break;case 4:Ns();break;case 13:gt(yt);break;case 19:gt(yt);break;case 10:nl(v.type._context);break;case 22:case 23:$l()}i=i.return}if(Dt=e,kt=e=wr(e.current,null),Ot=ln=t,Rt=0,Ri=null,Il=Ho=Gr=0,Zt=Mi=null,Vr!==null){for(t=0;t<Vr.length;t++)if(i=Vr[t],v=i.interleaved,v!==null){i.interleaved=null;var R=v.next,I=i.pending;if(I!==null){var z=I.next;I.next=R,v.next=z}i.pending=v}Vr=null}return e}function ed(e,t){do{var i=kt;try{if(tl(),Ro.current=Do,Mo){for(var v=wt.memoizedState;v!==null;){var R=v.queue;R!==null&&(R.pending=null),v=v.next}Mo=!1}if(Kr=0,Nt=Tt=wt=null,Ci=!1,xi=0,Dl.current=null,i===null||i.return===null){Rt=1,Ri=t,kt=null;break}e:{var I=e,z=i.return,Q=i,te=t;if(t=Ot,Q.flags|=32768,te!==null&&typeof te=="object"&&typeof te.then=="function"){var ue=te,ve=Q,be=ve.tag;if((ve.mode&1)===0&&(be===0||be===11||be===15)){var _e=ve.alternate;_e?(ve.updateQueue=_e.updateQueue,ve.memoizedState=_e.memoizedState,ve.lanes=_e.lanes):(ve.updateQueue=null,ve.memoizedState=null)}var Ae=kh(z);if(Ae!==null){Ae.flags&=-257,Eh(Ae,z,Q,I,t),Ae.mode&1&&xh(I,ue,t),t=Ae,te=ue;var Pe=t.updateQueue;if(Pe===null){var Oe=new Set;Oe.add(te),t.updateQueue=Oe}else Pe.add(te);break e}else{if((t&1)===0){xh(I,ue,t),Ul();break e}te=Error(o(426))}}else if(vt&&Q.mode&1){var xt=kh(z);if(xt!==null){(xt.flags&65536)===0&&(xt.flags|=256),Eh(xt,z,Q,I,t),Za(Ds(te,Q));break e}}I=te=Ds(te,Q),Rt!==4&&(Rt=2),Mi===null?Mi=[I]:Mi.push(I),I=z;do{switch(I.tag){case 3:I.flags|=65536,t&=-t,I.lanes|=t;var oe=Sh(I,te,t);Yu(I,oe);break e;case 1:Q=te;var re=I.type,ae=I.stateNode;if((I.flags&128)===0&&(typeof re.getDerivedStateFromError=="function"||ae!==null&&typeof ae.componentDidCatch=="function"&&(gr===null||!gr.has(ae)))){I.flags|=65536,t&=-t,I.lanes|=t;var Ce=Ch(I,Q,t);Yu(I,Ce);break e}}I=I.return}while(I!==null)}rd(i)}catch(Fe){t=Fe,kt===i&&i!==null&&(kt=i=i.return);continue}break}while(!0)}function td(){var e=Fo.current;return Fo.current=Do,e===null?Do:e}function Ul(){(Rt===0||Rt===3||Rt===2)&&(Rt=4),Dt===null||(Gr&268435455)===0&&(Ho&268435455)===0||yr(Dt,Ot)}function qo(e,t){var i=st;st|=2;var v=td();(Dt!==e||Ot!==t)&&(Jn=null,Xr(e,t));do try{Fg();break}catch(R){ed(e,R)}while(!0);if(tl(),st=i,Fo.current=v,kt!==null)throw Error(o(261));return Dt=null,Ot=0,Rt}function Fg(){for(;kt!==null;)nd(kt)}function Hg(){for(;kt!==null&&!Sa();)nd(kt)}function nd(e){var t=od(e.alternate,e,ln);e.memoizedProps=e.pendingProps,t===null?rd(e):kt=t,Dl.current=null}function rd(e){var t=e;do{var i=t.alternate;if(e=t.return,(t.flags&32768)===0){if(i=Ng(i,t,ln),i!==null){kt=i;return}}else{if(i=Dg(i,t),i!==null){i.flags&=32767,kt=i;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Rt=6,kt=null;return}}if(t=t.sibling,t!==null){kt=t;return}kt=t=e}while(t!==null);Rt===0&&(Rt=5)}function Qr(e,t,i){var v=ot,R=_n.transition;try{_n.transition=null,ot=1,$g(e,t,i,v)}finally{_n.transition=R,ot=v}return null}function $g(e,t,i,v){do Os();while(_r!==null);if((st&6)!==0)throw Error(o(327));i=e.finishedWork;var R=e.finishedLanes;if(i===null)return null;if(e.finishedWork=null,e.finishedLanes=0,i===e.current)throw Error(o(177));e.callbackNode=null,e.callbackPriority=0;var I=i.lanes|i.childLanes;if(no(e,I),e===Dt&&(kt=Dt=null,Ot=0),(i.subtreeFlags&2064)===0&&(i.flags&2064)===0||Uo||(Uo=!0,ad(yn,function(){return Os(),null})),I=(i.flags&15990)!==0,(i.subtreeFlags&15990)!==0||I){I=_n.transition,_n.transition=null;var z=ot;ot=1;var Q=st;st|=4,Dl.current=null,Pg(e,i),Kh(i,e),ag(Ua),ds=!!$a,Ua=$a=null,e.current=i,jg(i),Ys(),st=Q,ot=z,_n.transition=I}else e.current=i;if(Uo&&(Uo=!1,_r=e,Wo=R),I=e.pendingLanes,I===0&&(gr=null),nr(i.stateNode),en(e,pt()),t!==null)for(v=e.onRecoverableError,i=0;i<t.length;i++)R=t[i],v(R.value,{componentStack:R.stack,digest:R.digest});if($o)throw $o=!1,e=jl,jl=null,e;return(Wo&1)!==0&&e.tag!==0&&Os(),I=e.pendingLanes,(I&1)!==0?e===Ol?Ai++:(Ai=0,Ol=e):Ai=0,dr(),null}function Os(){if(_r!==null){var e=ni(Wo),t=_n.transition,i=ot;try{if(_n.transition=null,ot=16>e?16:e,_r===null)var v=!1;else{if(e=_r,_r=null,Wo=0,(st&6)!==0)throw Error(o(331));var R=st;for(st|=4,Ie=e.current;Ie!==null;){var I=Ie,z=I.child;if((Ie.flags&16)!==0){var Q=I.deletions;if(Q!==null){for(var te=0;te<Q.length;te++){var ue=Q[te];for(Ie=ue;Ie!==null;){var ve=Ie;switch(ve.tag){case 0:case 11:case 15:Ti(8,ve,I)}var be=ve.child;if(be!==null)be.return=ve,Ie=be;else for(;Ie!==null;){ve=Ie;var _e=ve.sibling,Ae=ve.return;if(Uh(ve),ve===ue){Ie=null;break}if(_e!==null){_e.return=Ae,Ie=_e;break}Ie=Ae}}}var Pe=I.alternate;if(Pe!==null){var Oe=Pe.child;if(Oe!==null){Pe.child=null;do{var xt=Oe.sibling;Oe.sibling=null,Oe=xt}while(Oe!==null)}}Ie=I}}if((I.subtreeFlags&2064)!==0&&z!==null)z.return=I,Ie=z;else e:for(;Ie!==null;){if(I=Ie,(I.flags&2048)!==0)switch(I.tag){case 0:case 11:case 15:Ti(9,I,I.return)}var oe=I.sibling;if(oe!==null){oe.return=I.return,Ie=oe;break e}Ie=I.return}}var re=e.current;for(Ie=re;Ie!==null;){z=Ie;var ae=z.child;if((z.subtreeFlags&2064)!==0&&ae!==null)ae.return=z,Ie=ae;else e:for(z=re;Ie!==null;){if(Q=Ie,(Q.flags&2048)!==0)try{switch(Q.tag){case 0:case 11:case 15:Bo(9,Q)}}catch(Fe){Ct(Q,Q.return,Fe)}if(Q===z){Ie=null;break e}var Ce=Q.sibling;if(Ce!==null){Ce.return=Q.return,Ie=Ce;break e}Ie=Q.return}}if(st=R,dr(),sn&&typeof sn.onPostCommitFiberRoot=="function")try{sn.onPostCommitFiberRoot(ns,e)}catch{}v=!0}return v}finally{ot=i,_n.transition=t}}return!1}function sd(e,t,i){t=Ds(i,t),t=Sh(e,t,1),e=pr(e,t,1),t=Yt(),e!==null&&(sr(e,1,t),en(e,t))}function Ct(e,t,i){if(e.tag===3)sd(e,e,i);else for(;t!==null;){if(t.tag===3){sd(t,e,i);break}else if(t.tag===1){var v=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof v.componentDidCatch=="function"&&(gr===null||!gr.has(v))){e=Ds(i,e),e=Ch(t,e,1),t=pr(t,e,1),e=Yt(),t!==null&&(sr(t,1,e),en(t,e));break}}t=t.return}}function Ug(e,t,i){var v=e.pingCache;v!==null&&v.delete(t),t=Yt(),e.pingedLanes|=e.suspendedLanes&i,Dt===e&&(Ot&i)===i&&(Rt===4||Rt===3&&(Ot&130023424)===Ot&&500>pt()-Pl?Xr(e,0):Il|=i),en(e,t)}function id(e,t){t===0&&((e.mode&1)===0?t=1:(t=rs,rs<<=1,(rs&130023424)===0&&(rs=4194304)));var i=Yt();e=Yn(e,t),e!==null&&(sr(e,t,i),en(e,i))}function Wg(e){var t=e.memoizedState,i=0;t!==null&&(i=t.retryLane),id(e,i)}function zg(e,t){var i=0;switch(e.tag){case 13:var v=e.stateNode,R=e.memoizedState;R!==null&&(i=R.retryLane);break;case 19:v=e.stateNode;break;default:throw Error(o(314))}v!==null&&v.delete(t),id(e,i)}var od;od=function(e,t,i){if(e!==null)if(e.memoizedProps!==t.pendingProps||Xt.current)Jt=!0;else{if((e.lanes&i)===0&&(t.flags&128)===0)return Jt=!1,Ag(e,t,i);Jt=(e.flags&131072)!==0}else Jt=!1,vt&&(t.flags&1048576)!==0&&Fu(t,bo,t.index);switch(t.lanes=0,t.tag){case 2:var v=t.type;jo(e,t),e=t.pendingProps;var R=ks(t,Ut.current);As(t,i),R=dl(null,t,v,e,R,i);var I=fl();return t.flags|=1,typeof R=="object"&&R!==null&&typeof R.render=="function"&&R.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Qt(v)?(I=!0,vo(t)):I=!1,t.memoizedState=R.state!==null&&R.state!==void 0?R.state:null,il(t),R.updater=Io,t.stateNode=R,R._reactInternals=t,yl(t,v,e,i),t=Cl(null,t,v,!0,I,i)):(t.tag=0,vt&&I&&Ya(t),Gt(null,t,R,i),t=t.child),t;case 16:v=t.elementType;e:{switch(jo(e,t),e=t.pendingProps,R=v._init,v=R(v._payload),t.type=v,R=t.tag=qg(v),e=kn(v,e),R){case 0:t=Sl(null,t,v,e,i);break e;case 1:t=Nh(null,t,v,e,i);break e;case 11:t=Lh(null,t,v,e,i);break e;case 14:t=Th(null,t,v,kn(v.type,e),i);break e}throw Error(o(306,v,""))}return t;case 0:return v=t.type,R=t.pendingProps,R=t.elementType===v?R:kn(v,R),Sl(e,t,v,R,i);case 1:return v=t.type,R=t.pendingProps,R=t.elementType===v?R:kn(v,R),Nh(e,t,v,R,i);case 3:e:{if(Dh(t),e===null)throw Error(o(387));v=t.pendingProps,I=t.memoizedState,R=I.element,Gu(e,t),Lo(t,v,null,i);var z=t.memoizedState;if(v=z.element,I.isDehydrated)if(I={element:v,isDehydrated:!1,cache:z.cache,pendingSuspenseBoundaries:z.pendingSuspenseBoundaries,transitions:z.transitions},t.updateQueue.baseState=I,t.memoizedState=I,t.flags&256){R=Ds(Error(o(423)),t),t=Ih(e,t,v,i,R);break e}else if(v!==R){R=Ds(Error(o(424)),t),t=Ih(e,t,v,i,R);break e}else for(an=cr(t.stateNode.containerInfo.firstChild),on=t,vt=!0,xn=null,i=qu(t,null,v,i),t.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling;else{if(Ts(),v===R){t=Qn(e,t,i);break e}Gt(e,t,v,i)}t=t.child}return t;case 5:return Qu(t),e===null&&Ja(t),v=t.type,R=t.pendingProps,I=e!==null?e.memoizedProps:null,z=R.children,Wa(v,R)?z=null:I!==null&&Wa(v,I)&&(t.flags|=32),Ah(e,t),Gt(e,t,z,i),t.child;case 6:return e===null&&Ja(t),null;case 13:return Ph(e,t,i);case 4:return ol(t,t.stateNode.containerInfo),v=t.pendingProps,e===null?t.child=Rs(t,null,v,i):Gt(e,t,v,i),t.child;case 11:return v=t.type,R=t.pendingProps,R=t.elementType===v?R:kn(v,R),Lh(e,t,v,R,i);case 7:return Gt(e,t,t.pendingProps,i),t.child;case 8:return Gt(e,t,t.pendingProps.children,i),t.child;case 12:return Gt(e,t,t.pendingProps.children,i),t.child;case 10:e:{if(v=t.type._context,R=t.pendingProps,I=t.memoizedProps,z=R.value,dt(xo,v._currentValue),v._currentValue=z,I!==null)if(Cn(I.value,z)){if(I.children===R.children&&!Xt.current){t=Qn(e,t,i);break e}}else for(I=t.child,I!==null&&(I.return=t);I!==null;){var Q=I.dependencies;if(Q!==null){z=I.child;for(var te=Q.firstContext;te!==null;){if(te.context===v){if(I.tag===1){te=Xn(-1,i&-i),te.tag=2;var ue=I.updateQueue;if(ue!==null){ue=ue.shared;var ve=ue.pending;ve===null?te.next=te:(te.next=ve.next,ve.next=te),ue.pending=te}}I.lanes|=i,te=I.alternate,te!==null&&(te.lanes|=i),rl(I.return,i,t),Q.lanes|=i;break}te=te.next}}else if(I.tag===10)z=I.type===t.type?null:I.child;else if(I.tag===18){if(z=I.return,z===null)throw Error(o(341));z.lanes|=i,Q=z.alternate,Q!==null&&(Q.lanes|=i),rl(z,i,t),z=I.sibling}else z=I.child;if(z!==null)z.return=I;else for(z=I;z!==null;){if(z===t){z=null;break}if(I=z.sibling,I!==null){I.return=z.return,z=I;break}z=z.return}I=z}Gt(e,t,R.children,i),t=t.child}return t;case 9:return R=t.type,v=t.pendingProps.children,As(t,i),R=mn(R),v=v(R),t.flags|=1,Gt(e,t,v,i),t.child;case 14:return v=t.type,R=kn(v,t.pendingProps),R=kn(v.type,R),Th(e,t,v,R,i);case 15:return Rh(e,t,t.type,t.pendingProps,i);case 17:return v=t.type,R=t.pendingProps,R=t.elementType===v?R:kn(v,R),jo(e,t),t.tag=1,Qt(v)?(e=!0,vo(t)):e=!1,As(t,i),wh(t,v,R),yl(t,v,R,i),Cl(null,t,v,!0,e,i);case 19:return Oh(e,t,i);case 22:return Mh(e,t,i)}throw Error(o(156,t.tag))};function ad(e,t){return eo(e,t)}function Vg(e,t,i,v){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=v,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function vn(e,t,i,v){return new Vg(e,t,i,v)}function Wl(e){return e=e.prototype,!(!e||!e.isReactComponent)}function qg(e){if(typeof e=="function")return Wl(e)?1:0;if(e!=null){if(e=e.$$typeof,e===P)return 11;if(e===q)return 14}return 2}function wr(e,t){var i=e.alternate;return i===null?(i=vn(e.tag,t,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=t,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=e.flags&14680064,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,t=e.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i}function Ko(e,t,i,v,R,I){var z=2;if(v=e,typeof e=="function")Wl(e)&&(z=1);else if(typeof e=="string")z=5;else e:switch(e){case M:return Jr(i.children,R,I,t);case b:z=8,R|=8;break;case T:return e=vn(12,i,t,R|2),e.elementType=T,e.lanes=I,e;case B:return e=vn(13,i,t,R),e.elementType=B,e.lanes=I,e;case H:return e=vn(19,i,t,R),e.elementType=H,e.lanes=I,e;case G:return Go(i,R,I,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case N:z=10;break e;case F:z=9;break e;case P:z=11;break e;case q:z=14;break e;case X:z=16,v=null;break e}throw Error(o(130,e==null?e:typeof e,""))}return t=vn(z,i,t,R),t.elementType=e,t.type=v,t.lanes=I,t}function Jr(e,t,i,v){return e=vn(7,e,v,t),e.lanes=i,e}function Go(e,t,i,v){return e=vn(22,e,v,t),e.elementType=G,e.lanes=i,e.stateNode={isHidden:!1},e}function zl(e,t,i){return e=vn(6,e,null,t),e.lanes=i,e}function Vl(e,t,i){return t=vn(4,e.children!==null?e.children:[],e.key,t),t.lanes=i,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Kg(e,t,i,v,R){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=is(0),this.expirationTimes=is(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=is(0),this.identifierPrefix=v,this.onRecoverableError=R,this.mutableSourceEagerHydrationData=null}function ql(e,t,i,v,R,I,z,Q,te){return e=new Kg(e,t,i,Q,te),t===1?(t=1,I===!0&&(t|=8)):t=0,I=vn(3,null,null,t),e.current=I,I.stateNode=e,I.memoizedState={element:v,isDehydrated:i,cache:null,transitions:null,pendingSuspenseBoundaries:null},il(I),e}function Gg(e,t,i){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:x,key:v==null?null:""+v,children:e,containerInfo:t,implementation:i}}function ld(e){if(!e)return hr;e=e._reactInternals;e:{if(un(e)!==e||e.tag!==1)throw Error(o(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Qt(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(o(171))}if(e.tag===1){var i=e.type;if(Qt(i))return ju(e,i,t)}return t}function cd(e,t,i,v,R,I,z,Q,te){return e=ql(i,v,!0,e,R,I,z,Q,te),e.context=ld(null),i=e.current,v=Yt(),R=vr(i),I=Xn(v,R),I.callback=t??null,pr(i,I,R),e.current.lanes=R,sr(e,R,v),en(e,v),e}function Yo(e,t,i,v){var R=t.current,I=Yt(),z=vr(R);return i=ld(i),t.context===null?t.context=i:t.pendingContext=i,t=Xn(I,z),t.payload={element:e},v=v===void 0?null:v,v!==null&&(t.callback=v),e=pr(R,t,z),e!==null&&(Tn(e,R,z,I),Eo(e,R,z)),z}function Xo(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function ud(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var i=e.retryLane;e.retryLane=i!==0&&i<t?i:t}}function Kl(e,t){ud(e,t),(e=e.alternate)&&ud(e,t)}function Yg(){return null}var hd=typeof reportError=="function"?reportError:function(e){console.error(e)};function Gl(e){this._internalRoot=e}Qo.prototype.render=Gl.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));Yo(e,t,null,null)},Qo.prototype.unmount=Gl.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Yr(function(){Yo(null,e,null,null)}),t[Vn]=null}};function Qo(e){this._internalRoot=e}Qo.prototype.unstable_scheduleHydration=function(e){if(e){var t=cs();e={blockedOn:null,target:e,priority:t};for(var i=0;i<Sn.length&&t!==0&&t<Sn[i].priority;i++);Sn.splice(i,0,e),i===0&&jr(e)}};function Yl(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Jo(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function dd(){}function Xg(e,t,i,v,R){if(R){if(typeof v=="function"){var I=v;v=function(){var ue=Xo(z);I.call(ue)}}var z=cd(t,v,e,0,null,!1,!1,"",dd);return e._reactRootContainer=z,e[Vn]=z.current,mi(e.nodeType===8?e.parentNode:e),Yr(),z}for(;R=e.lastChild;)e.removeChild(R);if(typeof v=="function"){var Q=v;v=function(){var ue=Xo(te);Q.call(ue)}}var te=ql(e,0,!1,null,null,!1,!1,"",dd);return e._reactRootContainer=te,e[Vn]=te.current,mi(e.nodeType===8?e.parentNode:e),Yr(function(){Yo(t,te,i,v)}),te}function Zo(e,t,i,v,R){var I=i._reactRootContainer;if(I){var z=I;if(typeof R=="function"){var Q=R;R=function(){var te=Xo(z);Q.call(te)}}Yo(t,z,e,R)}else z=Xg(i,t,e,R,v);return Xo(z)}os=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var i=rr(t.pendingLanes);i!==0&&(ti(t,i|1),en(t,pt()),(st&6)===0&&(js=pt()+500,dr()))}break;case 13:Yr(function(){var v=Yn(e,1);if(v!==null){var R=Yt();Tn(v,e,1,R)}}),Kl(e,1)}},as=function(e){if(e.tag===13){var t=Yn(e,134217728);if(t!==null){var i=Yt();Tn(t,e,134217728,i)}Kl(e,134217728)}},ls=function(e){if(e.tag===13){var t=vr(e),i=Yn(e,t);if(i!==null){var v=Yt();Tn(i,e,t,v)}Kl(e,t)}},cs=function(){return ot},ro=function(e,t){var i=ot;try{return ot=e,t()}finally{ot=i}},lt=function(e,t,i){switch(t){case"input":if(me(e,i),t=i.name,i.type==="radio"&&t!=null){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<i.length;t++){var v=i[t];if(v!==e&&v.form===e.form){var R=go(v);if(!R)throw Error(o(90));ee(v),me(v,R)}}}break;case"textarea":Ke(e,i);break;case"select":t=i.value,t!=null&&Te(e,!!i.multiple,t,!1)}},Zn=Hl,es=Yr;var Qg={usingClientEntryPoint:!1,Events:[vi,Cs,go,Lt,At,Hl]},Ni={findFiberByHostInstance:$r,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Jg={bundleType:Ni.bundleType,version:Ni.version,rendererPackageName:Ni.rendererPackageName,rendererConfig:Ni.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:C.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Ji(e),e===null?null:e.stateNode},findFiberByHostInstance:Ni.findFiberByHostInstance||Yg,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 ea=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ea.isDisabled&&ea.supportsFiber)try{ns=ea.inject(Jg),sn=ea}catch{}}return tn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Qg,tn.createPortal=function(e,t){var i=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Yl(t))throw Error(o(200));return Gg(e,t,null,i)},tn.createRoot=function(e,t){if(!Yl(e))throw Error(o(299));var i=!1,v="",R=hd;return t!=null&&(t.unstable_strictMode===!0&&(i=!0),t.identifierPrefix!==void 0&&(v=t.identifierPrefix),t.onRecoverableError!==void 0&&(R=t.onRecoverableError)),t=ql(e,1,!1,null,null,i,!1,v,R),e[Vn]=t.current,mi(e.nodeType===8?e.parentNode:e),new Gl(t)},tn.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(o(188)):(e=Object.keys(e).join(","),Error(o(268,e)));return e=Ji(t),e=e===null?null:e.stateNode,e},tn.flushSync=function(e){return Yr(e)},tn.hydrate=function(e,t,i){if(!Jo(t))throw Error(o(200));return Zo(null,e,t,!0,i)},tn.hydrateRoot=function(e,t,i){if(!Yl(e))throw Error(o(405));var v=i!=null&&i.hydratedSources||null,R=!1,I="",z=hd;if(i!=null&&(i.unstable_strictMode===!0&&(R=!0),i.identifierPrefix!==void 0&&(I=i.identifierPrefix),i.onRecoverableError!==void 0&&(z=i.onRecoverableError)),t=cd(t,null,e,1,i??null,R,!1,I,z),e[Vn]=t.current,mi(e),v)for(e=0;e<v.length;e++)i=v[e],R=i._getVersion,R=R(i._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[i,R]:t.mutableSourceEagerHydrationData.push(i,R);return new Qo(t)},tn.render=function(e,t,i){if(!Jo(t))throw Error(o(200));return Zo(null,e,t,!1,i)},tn.unmountComponentAtNode=function(e){if(!Jo(e))throw Error(o(40));return e._reactRootContainer?(Yr(function(){Zo(null,null,e,!1,function(){e._reactRootContainer=null,e[Vn]=null})}),!0):!1},tn.unstable_batchedUpdates=Hl,tn.unstable_renderSubtreeIntoContainer=function(e,t,i,v){if(!Jo(i))throw Error(o(200));if(e==null||e._reactInternals===void 0)throw Error(o(38));return Zo(e,t,i,!1,v)},tn.version="18.3.1-next-f1338f8080-20240426",tn}var wd;function Zf(){if(wd)return Jl.exports;wd=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(r){console.error(r)}}return n(),Jl.exports=l_(),Jl.exports}var bd;function c_(){if(bd)return ta;bd=1;var n=Zf();return ta.createRoot=n.createRoot,ta.hydrateRoot=n.hydrateRoot,ta}var u_=c_(),O=zc();const h_=n_(O);function Be(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)?n:null}function Ne(n){return typeof n=="string"?n:null}function ye(n){return typeof n=="string"&&n.length>0?n:null}function ct(n){return typeof n=="boolean"?n:null}function He(n){return typeof n=="number"&&Number.isFinite(n)?n:null}function aa(n){if(!Array.isArray(n))return null;const r=[];for(const o of n){if(typeof o!="string")return null;r.push(o)}return r}function _t(n,r){if(!Array.isArray(n))return null;const o=[];for(const p of n){const w=r(p);if(w===null)return null;o.push(w)}return o}function cn(n,r){if(!Array.isArray(n))return null;const o=[];for(const p of n){const w=r(p);w!==null&&o.push(w)}return o}function Xe(n,r){return typeof n=="string"&&r.includes(n)?n:null}function d_(n){try{return JSON.parse(n)}catch{return}}const f_=["auto","default","acceptEdits","plan"];function $s(n){return typeof n=="string"&&f_.includes(n)}const p_={agentUnknown:[],answerInterrupted:[],answerInvalid:[],answerNoFreeText:[],answerNotPending:[],answerSendFailed:[],answersUnsupported:[],archiveOpenTab:[],attachmentEmpty:["name"],attachmentExecutable:["name"],attachmentSaveFailed:[],attachmentTooLarge:["max","name","size"],badMessage:[],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:[],filesPerMessage:["max"],gitCommandFailed:["command"],gitMissing:[],gitNotFound:[],gitNotRepo:[],gitRunFailed:[],gitStatusUnknown:[],gitUnexpected:["command"],handoffEmpty:[],handoffNoTranscript:[],imageEmpty:[],imageTooLarge:["max","size"],imageTypeUnsupported:["type"],imageUnknownFormat:[],imagesPerMessage:["max"],imagesUnsupported:[],memoryAppeared:["file"],memoryBrokenBlock:["file"],memoryChooseFile:[],memoryGitFailed:["detail"],memoryHardLinks:["file"],memoryLinkOutside:["path"],memoryNotAFile:["label"],memoryNotInstalled:[],memoryNotUtf8:["file"],memoryNoteClaude:[],memoryNoteGone:[],memoryNoteHardLink:["path"],memoryNoteHardLinkCmd:["path"],memoryNoteName:[],memoryNoteOpenCode:[],memorySameFile:["file","other"],memoryViaEncoding:["file"],memoryViaFallback:[],memoryViaFile:["file"],memoryViaNoBlock:["file"],memoryViaNoBlockEither:[],memoryViaNoFolder:[],memoryViaNoIndex:[],memoryViaOutside:["file"],modePendingConfirmation:[],modeUnreachable:["key"],modesUnsupported:[],noteCliNotStarted:[],noteEmpty:[],noteExists:[],noteGone:[],noteIdInvalid:[],noteImageFailed:[],noteImagesMax:["max"],noteImagesUnsupported:[],noteInterrupted:[],noteNoAgent:[],noteNoReadySignal:[],noteSaveFailed:[],noteTooLong:["max"],notesMax:["max"],openToolSubmit:["label"],operationFailed:["detail"],pasteImageFailed:[],pathMissing:[],pathNotRelative:[],pathNullByte:[],pathOpenFailed:[],pathOutside:[],pendingSubmitAnswer:["label"],pendingSubmitPermission:["label"],pickerCliFolder:[],pickerClosed:[],pickerCreateFailed:[],pickerFolderExists:[],pickerListFailed:[],pickerNameChars:[],pickerNameInvalid:[],pickerNoProjectsHere:[],pickerNotListed:[],pickerRootMissing:[],pickerTooMany:[],planReadFailed:[],raw:["text"],relaunchCloseFailed:[],remoteDeviceGone:[],remoteFailed:[],remoteHostOnly:[],remoteNotActive:[],remoteOpensOnHost:[],remotePortInvalid:["max","min"],remoteTooManyDevices:["max"],searchFailed:[],shellNotFound:[],submitInterrupted:[],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"]};function m_(n){return Object.prototype.hasOwnProperty.call(p_,n)}function Hn(n,r=0){const o=Be(n);if(o===null)return null;const p=Ne(o.key);if(p===null||p.length===0)return null;const w=o.params;if(w===void 0)return{key:p};const A=Be(w);if(A===null)return null;const L={};for(const[s,c]of Object.entries(A)){if(typeof c=="string"||typeof c=="number"&&Number.isFinite(c)){L[s]=c;continue}const m=r===0?Hn(c,r+1):null;if(m===null)return null;L[s]=m}return{key:p,params:L}}function g_(n){if(!Array.isArray(n))return null;const r=[];for(const o of n){const p=Hn(o);if(p===null)return null;r.push(p)}return r}const Ws=["claude-code","codex","opencode","antigravity"],__=["gemini-cli","antigravity-ide"],ma=[...Ws,...__],v_={"gemini-cli":"Gemini CLI","antigravity-ide":"Antigravity IDE"};function Vi(n){return Ws.includes(n)}const y_=["at-quoted","bare-path-paste"],w_=["at"],b_=["usage-with-variants","token-count","usage-with-catalog","status-line"],S_=["child-session-marker"],C_=["active","missing","other-command","disabled","unreadable"];function ep(n,r=null){return!n.statusSource||r==="unknown"}const tp={sessionIdAtLaunch:!1,resume:!1,statusSource:!1,readySignal:!1,permissionCycle:null,models:null,efforts:null,questionCards:!1,imagesByPath:null,fileMentions:null,rewind:!1,contextWindowSource:null,plans:!1,waitingBlocksSubmit:!1};function Vc(n){return n.filter(r=>r.available).length>1}function x_(n){const r=Be(n);if(r===null)return null;const o=r.modes;if(!Array.isArray(o)||o.length===0)return null;const p=[];for(const L of o){if(!$s(L))return null;p.push(L)}const w=r.launchMode;if(!$s(w)||!p.includes(w))return null;const A=ye(r.keyLabel);return A===null?null:{modes:p,launchMode:w,keyLabel:A,approvesPendingOnCycle:r.approvesPendingOnCycle===!0}}function k_(n){const r=Be(n);if(r===null)return null;const o=Xe(r.state,C_),p=ye(r.settingsPath),w=ye(r.scriptPath),A=r.fragment,L=A===null?null:ye(A);return o===null||p===null||w===null||A!==null&&L===null?null:{state:o,settingsPath:p,scriptPath:w,fragment:L}}function E_(n){const r=Be(n);if(r===null)return null;const o=ye(r.value),p=Ne(r.label),w=Ne(r.family),A=ct(r.long),L=r.window,s=L===null?null:He(L);return o===null||p===null||w===null||A===null||L!==null&&s===null?null:{value:o,label:p,family:w,long:A,window:s}}function L_(n){const r=Be(n);if(r===null)return null;const o=ye(r.value),p=Ne(r.label);return o===null||p===null?null:{value:o,label:p}}function Sd(n,r){const o=_t(n,r);return o===null||o.length===0?null:o}function T_(n){const r=Be(n);return r===null?{...tp}:{sessionIdAtLaunch:r.sessionIdAtLaunch===!0,resume:r.resume===!0,statusSource:r.statusSource===!0,readySignal:r.readySignal===!0,permissionCycle:x_(r.permissionCycle),models:Sd(r.models,E_),efforts:Sd(r.efforts,L_),questionCards:r.questionCards===!0,imagesByPath:Xe(r.imagesByPath,y_),fileMentions:Xe(r.fileMentions,w_),rewind:r.rewind===!0,contextWindowSource:Xe(r.contextWindowSource,b_),plans:r.plans===!0,waitingBlocksSubmit:r.waitingBlocksSubmit===!0}}function Cd(n){const r=Be(n);if(r===null)return null;const o=Xe(r.id,Ws),p=Ne(r.label),w=Ne(r.command),A=Ne(r.installUrl);return o===null||p===null||w===null||A===null?null:{id:o,label:p,command:w,available:r.available===!0,version:Ne(r.version),installUrl:A,missingMessage:Hn(r.missingMessage),capabilities:T_(r.capabilities),environmentNotice:Xe(r.environmentNotice,S_),statusLine:k_(r.statusLine)}}const R_=["custom","ai","first-message","none"],M_=["native","vault"],A_=["idle","scanning","ready"],N_=["agent","shell"],D_=["busy","idle","waiting","offline","unknown"],I_=["server-closed"];function P_(n){const r=Be(n);if(r===null)return null;const o=ye(r.sessionId),p=Ne(r.title),w=Xe(r.titleSource,R_),A=He(r.updatedAt),L=He(r.sizeBytes);if(o===null||p===null||w===null||A===null||L===null)return null;const s=r.agent===void 0?"claude-code":Xe(r.agent,ma);if(s===null)return null;const c=Ne(r.cwd)??"";return{agent:s,sessionId:o,cwd:c,title:p,titleSource:w,updatedAt:A,sizeBytes:L,archived:r.archived===!0,storage:Xe(r.storage,M_)??"native",partial:r.partial===!0}}function j_(n){const r=Be(n);if(r===null)return null;const o=Ne(r.cwd),p=ct(r.cwdExists),w=cn(r.sessions,P_),A=He(r.lastActivityAt);if(o===null||p===null||w===null||A===null)return null;const L=ye(r.key);if(L!==null)return{key:L,fallbackName:Ne(r.fallbackName)??"",cwd:o,cwdExists:p,sessions:w,lastActivityAt:A};const s=ye(r.slug);return s===null?null:{key:s,fallbackName:o.length===0?s:"",cwd:o,cwdExists:p,sessions:w,lastActivityAt:A}}function O_(n){const r=Be(n);if(r===null)return null;const o=Xe(r.state,A_),p=He(r.scannedFiles),w=He(r.totalFiles);return o===null||p===null||w===null?null:{state:o,scannedFiles:p,totalFiles:w}}function xd(n){const r=Be(n);if(r===null)return null;const o=ye(r.terminalId),p=Xe(r.kind,N_)??"agent";let w=null;if(p==="agent"&&(w=r.agent===void 0?"claude-code":Xe(r.agent,Ws),w===null))return null;const A=Ne(r.cwd),L=Ne(r.sessionId),s=Ne(r.label),c=ct(r.resumed),m=He(r.createdAt),_=ct(r.alive);if(o===null||A===null||L===null||s===null||c===null||m===null||_===null)return null;const u=r.exitCode;return{terminalId:o,kind:p,agent:w,cwd:A,sessionId:L,label:s,resumed:c,createdAt:m,alive:_,exitCode:typeof u=="number"?u:null,sleeping:r.sleeping===!0}}const np=["user","assistant"],B_=["content","attachment"],F_=["compacted","interrupted","error"],H_=["cli-plans","project","scratch"],$_=120,U_=20,tc={lastRequestTokens:0,lastOutputTokens:0,lastModel:null,contextWindow:null,contextWindowEstimated:!1,totalInputTokens:0,totalOutputTokens:0,totalCacheReadTokens:0,assistantMessages:0},kd=["waiting","live","unavailable","no-transcript"];function W_(n){const r=Be(n);if(r===null)return null;const o=He(r.inputTokens),p=He(r.outputTokens),w=He(r.cacheCreationInputTokens),A=He(r.cacheReadInputTokens);return o===null||p===null||w===null||A===null?null:{inputTokens:o,outputTokens:p,cacheCreationInputTokens:w,cacheReadInputTokens:A}}function z_(n){const r=Be(n);if(r===null)return null;const o=ye(r.label);return o===null?null:{label:o,description:Ne(r.description)??""}}function V_(n){const r=Be(n);if(r===null)return null;const o=ye(r.question),p=_t(r.options,z_);return o===null||p===null||p.length===0?null:{question:o,header:Ne(r.header)??"",multiSelect:r.multiSelect===!0,options:p}}function rp(n){const r=Be(n);if(r===null)return null;switch(r.kind){case"text":{const o=Ne(r.text),p=ct(r.truncated);return o===null||p===null?null:{kind:"text",text:o,truncated:p}}case"tool-call":{const o=Ne(r.toolUseId),p=Ne(r.name),w=Ne(r.input),A=ct(r.truncated);return o===null||p===null||w===null||A===null?null:{kind:"tool-call",toolUseId:o,name:p,input:w,truncated:A}}case"tool-result":{const o=Ne(r.toolUseId),p=Ne(r.text),w=ct(r.isError),A=ct(r.truncated),L=He(r.imageCount);return o===null||p===null||w===null||A===null||L===null?null:{kind:"tool-result",toolUseId:o,text:p,isError:w,truncated:A,imageCount:L}}case"thinking":return{kind:"thinking"};case"question":{const o=ye(r.toolUseId),p=_t(r.questions,V_);return o===null||p===null||p.length===0?null:{kind:"question",toolUseId:o,questions:p}}case"image":{const o=He(r.index),p=Ne(r.mediaType);if(o===null||p===null)return null;const w=r.source==="attachment"?"attachment":"content";return{kind:"image",index:o,mediaType:p,source:w}}case"notice":{const o=Xe(r.notice,F_);return o===null?null:{kind:"notice",notice:o,detail:Ne(r.detail)??""}}default:return null}}function nc(n){const r=Be(n);if(r===null)return null;const o=ye(r.eventId),p=Xe(r.role,np),w=He(r.at),A=_t(r.parts,rp);return o===null||p===null||w===null||A===null?null:{eventId:o,role:p,at:w,parts:A,model:Ne(r.model),usage:W_(r.usage),effort:Ne(r.effort),durationMs:He(r.durationMs),queued:r.queued===!0}}function q_(n){const r=Be(n);if(r===null)return null;const o=ye(r.toolUseId),p=Ne(r.description),w=He(r.startedAt);return o===null||p===null||w===null?null:{toolUseId:o,description:p.slice(0,$_),background:r.background===!0,startedAt:w}}function Ed(n){const r=Be(n);if(r===null)return null;const o=He(r.lastRequestTokens),p=He(r.lastOutputTokens),w=He(r.totalInputTokens),A=He(r.totalOutputTokens),L=He(r.totalCacheReadTokens),s=He(r.assistantMessages);if(o===null||p===null||w===null||A===null||L===null||s===null)return null;const c=Ne(r.lastEffort);return{lastRequestTokens:o,lastOutputTokens:p,lastModel:Ne(r.lastModel),contextWindow:He(r.contextWindow),contextWindowEstimated:r.contextWindowEstimated===!0,totalInputTokens:w,totalOutputTokens:A,totalCacheReadTokens:L,assistantMessages:s,...c!==null?{lastEffort:c}:{}}}function K_(n){const r=Be(n);if(r===null)return null;const o=ye(r.fileName),p=ye(r.title),w=He(r.modifiedAt),A=He(r.sizeBytes);if(o===null||p===null||w===null||A===null)return null;const L=r.origin,s=H_.find(m=>m===L)??"cli-plans",c=Ne(r.path)??"";return{fileName:o,title:p,origin:s,path:c,exists:r.exists===!0,modifiedAt:w,sizeBytes:A}}function G_(n){const r=Be(n);if(r===null)return null;const o=ye(r.fileName),p=Ne(r.text);return o===null||p===null?null:{fileName:o,text:p,truncated:r.truncated===!0}}const sp=[{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 Y_(n){if(n.window===null)return n.label;const r=n.window>=1e6?`${Math.round(n.window/1e6)}M`:`${Math.round(n.window/1e3)}k`;return`${n.label} · ${r}`}function X_(n,r=sp){const o=Q_(n,r);if(o===null||n===null)return null;const p=n.includes("[1m]");return r.find(w=>w.family===o&&w.long===p)??null}function Q_(n,r=sp){var p;return n===null||n.length===0?null:((p=r.filter(w=>w.family.length>0).sort((w,A)=>A.family.length-w.family.length).find(w=>n.includes(w.family)))==null?void 0:p.family)??null}function J_(n){return`/model ${n}`}function Z_(n){return`/effort ${n}`}const ev=["staged","unstaged","untracked","conflict"],tv=["added","modified","deleted","renamed","copied","type-changed","untracked","conflict"],nv=["ready","not-a-repo","git-missing","error"],rc={state:"not-a-repo",message:null,repoRoot:"",branch:null,head:null,upstream:null,ahead:0,behind:0,changes:[],worktrees:[],truncated:!1,updatedAt:0},rv=["meta","hunk","context","added","removed"];function sv(n){const r=Be(n);if(r===null)return null;const o=ye(r.path),p=Xe(r.kind,tv),w=Xe(r.stage,ev);return o===null||p===null||w===null?null:{path:o,kind:p,stage:w,oldPath:Ne(r.oldPath)}}function iv(n){const r=Be(n);if(r===null)return null;const o=ye(r.path);return o===null?null:{path:o,branch:Ne(r.branch),isCurrent:r.isCurrent===!0}}function ov(n){const r=Be(n);if(r===null)return null;const o=Xe(r.state,nv),p=Ne(r.repoRoot),w=He(r.ahead),A=He(r.behind),L=_t(r.changes,sv),s=_t(r.worktrees,iv),c=He(r.updatedAt);return o===null||p===null||w===null||A===null||L===null||s===null||c===null?null:{state:o,message:Hn(r.message),repoRoot:p,branch:Ne(r.branch),head:Ne(r.head),upstream:Ne(r.upstream),ahead:w,behind:A,changes:L,worktrees:s,truncated:r.truncated===!0,updatedAt:c}}function av(n){const r=Be(n);if(r===null)return null;const o=Xe(r.kind,rv),p=Ne(r.text);return o===null||p===null?null:{kind:o,text:p,oldLine:He(r.oldLine),newLine:He(r.newLine)}}function lv(n){const r=Be(n);if(r===null)return null;const o=ye(r.path),p=ct(r.staged),w=_t(r.lines,av);return o===null||p===null||w===null?null:{path:o,staged:p,lines:w,truncated:r.truncated===!0,binary:r.binary===!0,message:Hn(r.message)}}const cv=["dir","file"],uv=["ignored","always"];function ip(n){const r=Be(n);if(r===null)return null;const o=ye(r.name),p=ye(r.path),w=Xe(r.kind,cv),A=He(r.sizeBytes),L=He(r.modifiedAt);if(o===null||p===null||w===null||A===null||L===null)return null;const s=Xe(r.hidden,uv),c={name:o,path:p,kind:w,sizeBytes:A,modifiedAt:L};return s===null?c:{...c,hidden:s}}function hv(n){const r=Be(n);if(r===null)return null;const o=Ne(r.query),p=_t(r.entries,ip);return o===null||p===null?null:{query:o,entries:p,truncated:r.truncated===!0}}function dv(n){const r=Be(n);if(r===null)return null;const o=Ne(r.path),p=_t(r.entries,ip),w=He(r.hiddenCount);return o===null||p===null||w===null?null:{path:o,entries:p,truncated:r.truncated===!0,hiddenCount:w}}function fv(n){const r=Be(n);if(r===null)return null;const o=ye(r.path),p=Ne(r.text),w=He(r.sizeBytes),A=ct(r.binary);return o===null||p===null||w===null||A===null?null:{path:o,language:Ne(r.language),text:p,sizeBytes:w,truncated:r.truncated===!0,binary:A}}function pv(n){const r=Be(n);if(r===null)return null;const o=ye(r.pickerId),p=ye(r.path),w=_t(r.entries,L=>ye(L)),A=_t(r.roots,L=>ye(L));return o===null||p===null||w===null||A===null?null:{pickerId:o,path:p,entries:w,roots:A,canGoUp:r.canGoUp===!0,truncated:r.truncated===!0}}const op=1e6,mv=100,gv=999999;function ap(n){return n.pasted.reduce((r,o)=>r+o.text.length,n.text.length)}function Lc(n){return n.text.trim().length===0&&n.pasted.every(r=>r.text.trim().length===0)}function lp(n,r){return n.text!==r.text||n.pasted.length!==r.pasted.length?!1:n.pasted.every((o,p)=>{const w=r.pasted[p];return w!==void 0&&w.number===o.number&&w.text===o.text})}function _v(n){const r=Be(n);if(r===null)return null;const o=r.number,p=Ne(r.text);return typeof o!="number"||!Number.isInteger(o)||o<1||o>gv||p===null?null:{number:o,text:p}}function vv(n){const r=Be(n);if(r===null)return null;const o=Ne(r.text),p=_t(r.pasted,_v);return o===null||p===null||p.length>mv||new Set(p.map(w=>w.number)).size!==p.length?null:{text:o,pasted:p}}const ua="MEMORY.md",qc=["AGENTS.md","CLAUDE.md"],cp=["claude-code","codex","antigravity","opencode"],yv=["outside","encoding"],wv=["create","append-block","replace-block","append-lines","copy"];function bv(n){return{instructionFiles:[...qc],gitMode:n!==null&&n.git.kind==="error"?"version":"ignore",importNative:n!==null&&n.native.pending>0,copyFromMainWorktree:n!==null&&n.git.kind==="repo"&&n.git.worktree!==null&&n.git.worktree.mainHasMemory}}function Sv(n){const r=Be(n);if(r===null)return null;const o=Xe(r.name,qc),p=ct(r.exists),w=ct(r.hasBlock),A=ct(r.blockCurrent),L=ct(r.brokenBlock),s=r.problem,c=s===null?null:Xe(s,yv);return o===null||p===null||w===null||A===null||L===null||s!==null&&c===null?null:{name:o,exists:p,hasBlock:w,blockCurrent:A,brokenBlock:L,problem:c}}function Cv(n){const r=Be(n);if(r===null)return null;switch(r.kind){case"not-repo":return{kind:"not-repo"};case"error":{const o=Hn(r.message);return o===null?null:{kind:"error",message:o}}case"repo":{const o=ct(r.ignored);if(o===null)return null;if(r.worktree===null)return{kind:"repo",ignored:o,worktree:null};const p=Be(r.worktree);if(p===null)return null;const w=ye(p.mainPath),A=ct(p.mainHasMemory);return w===null||A===null?null:{kind:"repo",ignored:o,worktree:{mainPath:w,mainHasMemory:A}}}default:return null}}function xv(n){const r=Be(n);if(r===null)return null;const o=Xe(r.agent,cp),p=ye(r.label),w=ct(r.reaches),A=Hn(r.via);return o===null||p===null||w===null||A===null?null:{agent:o,label:p,reaches:w,via:A}}function kv(n){const r=Be(n);if(r===null)return null;const o=ye(r.name),p=Ne(r.title),w=Ne(r.description),A=He(r.sizeBytes),L=He(r.modifiedAt);return o===null||p===null||w===null||A===null||L===null?null:{name:o,title:p,description:w,sizeBytes:A,modifiedAt:L}}const Ev=["line","command","json"];function Lv(n){const r=Be(n);if(r===null)return null;const o=Xe(r.agent,cp),p=ye(r.label),w=ye(r.target),A=Xe(r.kind,Ev),L=ye(r.text),s=Hn(r.note);return o===null||p===null||w===null||A===null||L===null||s===null?null:{agent:o,label:p,target:w,kind:A,text:L,note:s}}function Tv(n){const r=Be(n);if(r===null)return null;const o=ye(r.cwd),p=ct(r.folderExists),w=ct(r.indexExists),A=ct(r.installed),L=_t(r.notes,kv),s=_t(r.files,Sv),c=Cv(r.git),m=_t(r.reach,xv),_=Be(r.native),u=_===null?null:He(_.available),y=_===null?null:He(_.pending),S=_t(r.globalFragments,Lv);return o===null||p===null||w===null||A===null||L===null||s===null||c===null||m===null||u===null||y===null||S===null?null:{cwd:o,folderExists:p,indexExists:w,installed:A,notes:L,files:s,git:c,reach:m,native:{available:u,pending:y},globalFragments:S}}function Ld(n){const r=Be(n);if(r===null)return null;const o=ye(r.file),p=Xe(r.action,wv),w=Ne(r.preview),A=Ne(r.copiedFrom);return o===null||p===null||w===null?null:{file:o,action:p,preview:w,copiedFrom:A}}function Rv(n){const r=Be(n);if(r===null)return null;const o=ye(r.name),p=Ne(r.text),w=ct(r.truncated);return o===null||p===null||w===null?null:{name:o,text:p,truncated:w}}const Td=20;function Mv(n,r="Nota"){const o=n.text.split(`
41
- `).map(p=>p.trim()).find(p=>p.length>0);return o===void 0?n.images.length>0?"Imagen":r:o.length>40?`${o.slice(0,40)}…`:o}function Av(n){const r=Be(n);if(r===null)return null;const o=ye(r.imageId),p=ye(r.mediaType),w=He(r.bytes);return o===null||p===null||w===null?null:{imageId:o,mediaType:p,bytes:w}}function Nv(n){const r=Be(n);if(r===null)return null;const o=ye(r.noteId),p=Ne(r.text),w=_t(r.images,Av),A=He(r.createdAt),L=He(r.updatedAt);return o===null||p===null||w===null?null:{noteId:o,text:p,images:w,createdAt:A??0,updatedAt:L??0}}const up=3,Dv=3e4,Iv=["results","time"];function zs(n){return typeof n=="number"&&Number.isInteger(n)&&n>=0?n:null}function Oi(n,r){if(n==null)return null;const o=r(n);return o===null?void 0:o}function hp(n){const r=Be(n);if(r===null)return null;const o=Xe(r.agent,ma),p=ye(r.sessionId),w=Oi(r.cwd,Ne),A=Ne(r.title),L=Oi(r.eventId,ye),s=Oi(r.role,y=>Xe(y,np)),c=Oi(r.at,He),m=Ne(r.snippet),_=zs(r.matchStart),u=zs(r.matchLength);return o===null||p===null||w===void 0||A===null||L===void 0||s===void 0||c===void 0||m===null||_===null||u===null||_+u>m.length?null:{agent:o,sessionId:p,cwd:w,title:A,eventId:L,role:s,at:c,snippet:m,matchStart:_,matchLength:u}}function Pv(n){const r=Be(n);if(r===null)return null;const o=Ne(r.query),p=cn(r.hits,hp),w=zs(r.sessionsScanned),A=zs(r.sessionsTotal),L=Oi(r.truncated,s=>Xe(s,Iv));return o===null||p===null||w===null||A===null||w>A||L===void 0?null:{query:o,hits:p,sessionsScanned:w,sessionsTotal:A,truncated:L}}function jv(n){const r=Be(n);if(r===null)return null;const o=Ne(r.query),p=cn(r.hits,hp),w=zs(r.sessionsScanned),A=zs(r.sessionsTotal);return o===null||p===null||w===null||A===null||w>A?null:{query:o,hits:p,sessionsScanned:w,sessionsTotal:A}}const Ov=["off","idle","measuring","writing","moving"];function Kt(n){return typeof n=="number"&&Number.isInteger(n)&&n>=0?n:null}function Ii(n,r){if(n==null)return null;const o=r(n);return o===null?void 0:o}function Bv(n){const r=Be(n);if(r===null)return null;const o=Xe(r.agent,ma),p=Kt(r.sessions),w=Kt(r.eventBytes),A=Kt(r.images),L=Kt(r.imageBytes),s=Kt(r.skippedArchived),c=Kt(r.skippedEmpty),m=Kt(r.unsupported),_=Kt(r.failed),u=g_(r.failureReasons);return o===null||p===null||w===null||A===null||L===null||s===null||c===null||m===null||_===null||u===null?null:{agent:o,sessions:p,eventBytes:w,images:A,imageBytes:L,skippedArchived:s,skippedEmpty:c,unsupported:m,failed:_,failureReasons:u}}function Fv(n){const r=Be(n);if(r===null)return null;const o=He(r.measuredAt),p=He(r.durationMs),w=cn(r.byAgent,Bv),A=Kt(r.memoryProjects),L=Kt(r.memoryBytes);return o===null||p===null||w===null||A===null||L===null?null:{measuredAt:o,durationMs:p,byAgent:w,memoryProjects:A,memoryBytes:L}}function Hv(n){const r=Be(n);if(r===null)return null;const o=Kt(r.done),p=Kt(r.total);return o===null||p===null?null:{done:o,total:p}}function $v(n){const r=Be(n);if(r===null)return null;const o=ct(r.enabled),p=Ne(r.dir),w=ct(r.isDefaultDir),A=Xe(r.state,Ov),L=Kt(r.sessions),s=Kt(r.passSessions),c=Kt(r.bytes),m=Kt(r.pending),_=Ii(r.progress,Hv),u=Ii(r.lastPassAt,He),y=Ii(r.measurement,Fv),S=Ii(r.previousDir,Ne),E=Ii(r.lastError,Hn);return o===null||p===null||w===null||A===null||L===null||s===null||c===null||m===null||_===void 0||u===void 0||y===void 0||S===void 0||E===void 0?null:{enabled:o,dir:p,isDefaultDir:w,state:A,progress:_,sessions:L,passSessions:s,bytes:c,lastPassAt:u,pending:m,measurement:y,previousDir:S,lastError:E}}const dp=1024,fp=65535,Uv="pair",Wv=4001;function zv(n){return typeof n=="number"&&Number.isInteger(n)&&n>=dp&&n<=fp}const Vv=["off","active","restart-needed","port-busy"];function qv(n){const r=Be(n);if(r===null)return null;const o=ye(r.id),p=Ne(r.label),w=He(r.createdAt),A=ct(r.connected);if(o===null||p===null||w===null||A===null)return null;const L=r.lastSeenAt,s=L==null?null:He(L);return L!=null&&s===null?null:{id:o,label:p,createdAt:w,lastSeenAt:s,connected:A}}function Kv(n){const r=Be(n);if(r===null)return null;const o=ct(r.enabled),p=He(r.port),w=Xe(r.state,Vv),A=He(r.listeningPort),L=Ne(r.sshUser),s=aa(r.hostNames),c=ct(r.pairingActive),m=_t(r.devices,qv);return o===null||p===null||w===null||A===null||L===null||s===null||c===null||m===null?null:{enabled:o,port:p,state:w,listeningPort:A,sshUser:L,hostNames:s,pairingActive:c,devices:m}}function Gv(n){const r=Be(n);if(r===null)return null;const o=ye(r.code),p=He(r.expiresAt);return o===null||p===null?null:{code:o,expiresAt:p}}const Yv=["powershell-admin","powershell","terminal"];function Xv(n){const r=Be(n);if(r===null)return null;const o=ye(r.payload),p=ye(r.authorizeCommand),w=Xe(r.shell,Yv),A=ye(r.code),L=He(r.expiresAt);return o===null||p===null||w===null||A===null||L===null?null:{payload:o,authorizeCommand:p,shell:w,code:A,expiresAt:L}}const Fs=8,Qv="/ws",Tc="token",ha=12*1024*1024,sc=8,Rd=10*1024*1024,ic=4,Jv=["sending","prefilled"],Zv=["no-delivery","not-ready","send-failed"],e0=["cli-not-found","shell-not-found","spawn-failed","bad-message","unknown-terminal","terminal-asleep","invalid-cwd","too-many-terminals","invalid-path","read-failed","submit-failed","answer-failed","mode-failed","archive-failed","notes-failed","picker-failed","memory-failed","vault-failed","continue-failed","search-failed","remote-failed","remote-refused","agent-unsupported","internal"];function t0(n){const r={model:null,effort:null,contextWindow:null};if(typeof n!="object"||n===null)return r;const o=n;return{model:ye(o.model),effort:ye(o.effort),contextWindow:He(o.contextWindow)}}function n0(n){const r=Be(n);if(r===null)return null;const o=ye(r.terminalId),p=vv(r.draft);return o===null||p===null?null:{terminalId:o,draft:p}}function Md(n){return typeof n=="number"&&Number.isInteger(n)&&n>=0?n:null}function na(n,r){const o=ye(r.requestId);return o!==null&&(n.requestId=o),n}function Ad(n){var r;return((r=cn(n,q_))==null?void 0:r.slice(0,U_))??null}function r0(n){const r=Be(d_(n));if(r===null)return null;switch(r.type){case"hello":{const o=He(r.protocolVersion),p=Ne(r.platform),w=Ne(r.defaultCwd);return o===null||p===null||w===null?null:{type:"hello",protocolVersion:o,agents:cn(r.agents,Cd)??[],defaultAgent:Xe(r.defaultAgent,Ws),platform:p,defaultCwd:w,shellName:ye(r.shellName),remoteClient:r.remoteClient===!0}}case"agents":{const o=cn(r.agents,Cd);return o===null?null:{type:"agents",agents:o,defaultAgent:Xe(r.defaultAgent,Ws)}}case"terminal.list":{const o=cn(r.terminals,xd),p=aa(r.order);return o===null||p===null?null:{type:"terminal.list",terminals:o,order:p}}case"terminal.opened":{const o=ye(r.requestId),p=xd(r.terminal);return o===null||p===null?null:{type:"terminal.opened",requestId:o,terminal:p}}case"terminal.output":{const o=ye(r.terminalId),p=Ne(r.data);return o===null||p===null?null:{type:"terminal.output",terminalId:o,data:p}}case"terminal.replay":{const o=ye(r.terminalId),p=Ne(r.data);return o===null||p===null?null:{type:"terminal.replay",terminalId:o,data:p,truncated:r.truncated===!0}}case"terminal.exit":{const o=ye(r.terminalId),p=He(r.exitCode);if(o===null||p===null)return null;const w=r.signal;return{type:"terminal.exit",terminalId:o,exitCode:p,signal:typeof w=="number"?w:null}}case"terminal.closed":{const o=ye(r.terminalId);return o===null?null:{type:"terminal.closed",terminalId:o}}case"terminal.activity":{const o=ye(r.terminalId),p=Xe(r.activity,D_);if(o===null||p===null)return null;const w=p==="offline"?Xe(r.offlineReason,I_):null;return w===null?{type:"terminal.activity",terminalId:o,activity:p}:{type:"terminal.activity",terminalId:o,activity:p,offlineReason:w}}case"index.status":{const o=O_(r.status);return o===null?null:{type:"index.status",status:o}}case"index.projects":{const o=cn(r.projects,j_);return o===null?null:{type:"index.projects",projects:o,replace:r.replace===!0}}case"conversation.reset":{const o=ye(r.terminalId),p=Ne(r.sessionId),w=Xe(r.state,kd),A=cn(r.events,nc),L=Ed(r.usage);return o===null||p===null||w===null||A===null||L===null?null:{type:"conversation.reset",terminalId:o,sessionId:p,state:w,events:A,hasMore:r.hasMore===!0,usage:L,permissionMode:$s(r.permissionMode)?r.permissionMode:null,defaults:t0(r.defaults),waitingFor:ye(r.waitingFor),openToolCall:r.openToolCall===!0,subagents:Ad(r.subagents)??[]}}case"conversation.subagents":{const o=ye(r.terminalId),p=Ad(r.subagents);return o===null||p===null?null:{type:"conversation.subagents",terminalId:o,subagents:p}}case"agent.submitted":{const o=ye(r.terminalId),p=ye(r.requestId),w=ct(r.delivered);return o===null||p===null||w===null?null:{type:"agent.submitted",terminalId:o,requestId:p,delivered:w}}case"conversation.append":{const o=ye(r.terminalId),p=cn(r.events,nc),w=Ed(r.usage);return o===null||p===null||w===null?null:{type:"conversation.append",terminalId:o,events:p,usage:w,permissionMode:$s(r.permissionMode)?r.permissionMode:null}}case"conversation.mode":{const o=ye(r.terminalId),p=r.mode;return o===null||!$s(p)?null:{type:"conversation.mode",terminalId:o,mode:p}}case"conversation.waiting":{const o=ye(r.terminalId);return o===null?null:{type:"conversation.waiting",terminalId:o,waitingFor:ye(r.waitingFor)}}case"conversation.toolCall":{const o=ye(r.terminalId),p=ct(r.open);return o===null||p===null?null:{type:"conversation.toolCall",terminalId:o,open:p}}case"conversation.page":{const o=ye(r.terminalId),p=cn(r.events,nc);return o===null||p===null?null:{type:"conversation.page",terminalId:o,events:p,hasMore:r.hasMore===!0}}case"conversation.turns":{const o=ye(r.terminalId),p=_t(r.turns,w=>{const A=Be(w);if(A===null)return null;const L=ye(A.eventId),s=He(A.durationMs);return L===null||s===null?null:{eventId:L,durationMs:s}});return o===null||p===null?null:{type:"conversation.turns",terminalId:o,turns:p}}case"conversation.parts":{const o=ye(r.terminalId),p=_t(r.updates,w=>{const A=Be(w);if(A===null)return null;const L=ye(A.eventId),s=_t(A.parts,rp);return L===null||s===null?null:{eventId:L,parts:s}});return o===null||p===null?null:{type:"conversation.parts",terminalId:o,updates:p}}case"conversation.imageData":{const o=ye(r.terminalId),p=ye(r.eventId),w=He(r.index),A=Ne(r.mediaType);if(o===null||p===null||w===null||A===null)return null;const L=r.data;return{type:"conversation.imageData",terminalId:o,eventId:p,index:w,source:Xe(r.source,B_)??"content",mediaType:A,data:typeof L=="string"?L:null}}case"conversation.state":{const o=ye(r.terminalId),p=Xe(r.state,kd);return o===null||p===null?null:{type:"conversation.state",terminalId:o,state:p}}case"git.status":{const o=ye(r.terminalId),p=ov(r.status);return o===null||p===null?null:{type:"git.status",terminalId:o,status:p}}case"git.diff":{const o=ye(r.terminalId),p=lv(r.diff);return o===null||p===null?null:{type:"git.diff",terminalId:o,diff:p}}case"files.listing":{const o=ye(r.terminalId),p=dv(r.listing);return o===null||p===null?null:{type:"files.listing",terminalId:o,listing:p}}case"picker.listing":{const o=pv(r.listing);return o===null?null:{type:"picker.listing",listing:o}}case"files.preview":{const o=ye(r.terminalId),p=fv(r.preview);return o===null||p===null?null:{type:"files.preview",terminalId:o,preview:p}}case"conversation.plans":{const o=ye(r.terminalId),p=_t(r.plans,K_);return o===null||p===null?null:{type:"conversation.plans",terminalId:o,plans:p}}case"plans.content":{const o=ye(r.terminalId),p=G_(r.plan);return o===null||p===null?null:{type:"plans.content",terminalId:o,plan:p}}case"files.results":{const o=ye(r.terminalId),p=hv(r.result);return o===null||p===null?null:{type:"files.results",terminalId:o,result:p}}case"notes.list":{const o=_t(r.notes,Nv);return o===null?null:{type:"notes.list",notes:o}}case"notes.imageData":{const o=ye(r.imageId),p=Ne(r.mediaType);if(o===null||p===null)return null;const w=r.data;return{type:"notes.imageData",imageId:o,mediaType:p,data:typeof w=="string"?w:null}}case"memory.status":{const o=ye(r.terminalId),p=Tv(r.status);return o===null||p===null?null:{type:"memory.status",terminalId:o,status:p}}case"memory.planned":{const o=ye(r.terminalId),p=_t(r.changes,Ld);return o===null||p===null?null:na({type:"memory.planned",terminalId:o,changes:p},r)}case"memory.installed":{const o=ye(r.terminalId),p=_t(r.applied,Ld);return o===null||p===null?null:na({type:"memory.installed",terminalId:o,applied:p},r)}case"memory.imported":{const o=ye(r.terminalId),p=aa(r.copied),w=aa(r.skipped);return o===null||p===null||w===null?null:na({type:"memory.imported",terminalId:o,copied:p,skipped:w},r)}case"memory.content":{const o=ye(r.terminalId),p=Rv(r.note);return o===null||p===null?null:na({type:"memory.content",terminalId:o,note:p},r)}case"vault.status":{const o=$v(r.status);return o===null?null:{type:"vault.status",status:o}}case"vault.exported":{const o=ye(r.projectKey),p=He(r.sessions);return o===null||p===null?null:{type:"vault.exported",projectKey:o,sessions:p}}case"session.continued":{const o=ye(r.requestId),p=ye(r.terminalId),w=Be(r.source),A=Xe(w==null?void 0:w.agent,ma),L=ye(w==null?void 0:w.sessionId),s=Ne(w==null?void 0:w.title),c=Md(r.includedTurns),m=Md(r.totalTurns),_=Xe(r.delivery,Jv);return o===null||p===null||A===null||L===null||s===null||c===null||m===null||c>m||_===null?null:{type:"session.continued",requestId:o,terminalId:p,source:{agent:A,sessionId:L,title:s},includedTurns:c,totalTurns:m,totalTurnsIsMinimum:r.totalTurnsIsMinimum===!0,delivery:_}}case"composer.prefill":{const o=ye(r.terminalId),p=ye(r.text),w=Xe(r.reason,Zv);return o===null||p===null||w===null?null:{type:"composer.prefill",terminalId:o,text:p,reason:w}}case"composer.drafts":{const o=cn(r.drafts,n0);return o===null?null:{type:"composer.drafts",drafts:o}}case"search.progress":{const o=ye(r.searchId),p=jv(r.progress);return o===null||p===null?null:{type:"search.progress",searchId:o,progress:p}}case"remote.status":{const o=Kv(r.status);return o===null?null:{type:"remote.status",status:o}}case"remote.pairing.code":{const o=Gv(r.pairing);return o===null?null:{type:"remote.pairing.code",pairing:o}}case"remote.phone.pairing":{const o=Xv(r.pairing);return o===null?null:{type:"remote.phone.pairing",pairing:o}}case"search.results":{const o=ye(r.searchId),p=Pv(r.result);return o===null||p===null?null:{type:"search.results",searchId:o,result:p}}case"error":{const o=Hn(r.text);if(o===null)return null;const w={type:"error",code:Xe(r.code,e0)??"internal",text:o},A=Ne(r.detail);A!==null&&(w.detail=A);const L=ye(r.requestId);return L!==null&&(w.requestId=L),w}default:return null}}function Nd(n){return JSON.stringify(n)}const s0=/^[A-Za-z]:\\$/;function Vs(n,r){return n.length===0?"":r==="win32"?i0(n):o0(n)}function i0(n){let r=n.replace(/\//g,"\\");for(r.startsWith("\\\\?\\UNC\\")?r=`\\\\${r.slice(8)}`:r.startsWith("\\\\?\\")&&(r=r.slice(4)),r=r.startsWith("\\\\")?`\\\\${r.slice(2).replace(/\\+/g,"\\")}`:r.replace(/\\+/g,"\\");r.endsWith("\\")&&!s0.test(r);)r=r.slice(0,-1);return r.toLowerCase()}function pp(n,r,o){return n.length===0||o==="win32"&&n!==r&&n.toLowerCase()===r.toLowerCase()?r:n}function o0(n){let r=n.replace(/\/+/g,"/");for(;r.length>1&&r.endsWith("/");)r=r.slice(0,-1);return r}function a0(n,r,o,p){const w=Vs(o.cwd,p);let A=-1;for(const[L,s]of n.entries()){const c=r(s);c===void 0||c.kind!=="agent"||Vs(c.cwd,p)===w&&(A=L)}return A===-1?n.length:A+1}function mp(n){return`[Pasted text #${n}]`}function l0(n){return`[Start of pasted text #${n}]`}function c0(n){return`[End of pasted text #${n}]`}function u0(){return/(^|\n)\[Start of pasted text #(\d{1,6})\]\n([\s\S]*?)\n\[End of pasted text #\2\](?=\n|$)/g}function h0(){return/(^|\n)\[Start of pasted text #(\d{1,6})\]\n/}function d0(){return/\[Pasted text #(\d{1,6})\]/g}const gp="https://buymeacoffee.com/cvelasquez",f0="modulepreload",p0=function(n){return"/"+n},Dd={},On=function(r,o,p){let w=Promise.resolve();if(o&&o.length>0){let L=function(m){return Promise.all(m.map(_=>Promise.resolve(_).then(u=>({status:"fulfilled",value:u}),u=>({status:"rejected",reason:u}))))};document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),c=(s==null?void 0:s.nonce)||(s==null?void 0:s.getAttribute("nonce"));w=L(o.map(m=>{if(m=p0(m),m in Dd)return;Dd[m]=!0;const _=m.endsWith(".css"),u=_?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${u}`))return;const y=document.createElement("link");if(y.rel=_?"stylesheet":f0,_||(y.as="script"),y.crossOrigin="",y.href=m,c&&y.setAttribute("nonce",c),document.head.appendChild(y),_)return new Promise((S,E)=>{y.addEventListener("load",S),y.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${m}`)))})}))}function A(L){const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=L,window.dispatchEvent(s),!s.defaultPrevented)throw L}return w.then(L=>{for(const s of L||[])s.status==="rejected"&&A(s.reason);return r().catch(A)})},m0={"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.dot.idle":"Ready, nothing in progress","agent.dot.noStatus":"This CLI doesn't publish its status","agent.dot.open":"CLI open","agent.dot.statusLineOnly":"This CLI only publishes its status with the status line configured","agent.dot.statusLinePending":"The status line hasn't published this conversation's status yet","agent.handoff.notice":"Continued from {{label}}: the agent starts from a transcript of {{turns}}, not from the context it had. Tool results are trimmed and images don't carry over.","agent.handoff.prefill.noDelivery":"The message is in the message box: check it and send it with Enter.","agent.handoff.prefill.notReady":"The CLI wasn't ready in time: the message is in the message box for you to send.","agent.handoff.prefill.sendFailed":"It couldn't be sent automatically: the message is in the message box for you to send.","agent.handoff.sending":"Sending the continuation…","agent.handoff.tabLabel":"Continued: {{title}}","agent.handoff.tabLabelNoTitle":"Continued","agent.handoff.turns.all_one":"the {{count}} turn","agent.handoff.turns.all_other":"the {{count}} turns","agent.handoff.turns.lastManyOfMore_one":"the last {{included}} of more than {{count}} turn","agent.handoff.turns.lastManyOfMore_other":"the last {{included}} of more than {{count}} turns","agent.handoff.turns.lastMany_one":"the last {{included}} of {{count}} turn","agent.handoff.turns.lastMany_other":"the last {{included}} of {{count}} turns","agent.handoff.turns.lastOne":"the last turn of {{total}}","agent.handoff.turns.lastOneOfMore":"the last turn of more than {{total}}","agent.handoff.turns.single":"the only turn","agent.meter.idle.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.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.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.thread.discovering":"The session shows up in the history with the first message.","agent.thread.noTranscript":"This conversation comes from a CLI version that didn't leave a readable transcript. It can be resumed from the sidebar, but there's nothing to show here.","agent.waiting.answer":"The CLI is waiting for an answer from you.","agent.waiting.permission":"The CLI is waiting for you to authorize a tool.","agent.waiting.question":"The agent asked you a question: answer it in the thread.","agentMenu.chooseTitle":"Choose which CLI to open with","agentMenu.openWith":"Open with","agentMenu.titleWithAgent":"{{title}} — with {{label}}","app.banner.revoked":"This device's access was revoked, or remote access was turned off. To come back, pair it again from the computer running Agent Workbench.","app.divider.consoleHeight":"Drag to change the console's height","app.divider.width":"Drag to change the width","app.empty.hint":"Pick a project on the left, or open a session from the history to resume it.","app.empty.newSession":"New session in {{cwd}}","app.empty.noTabs":"No open tabs.","app.empty.opening":"Opening…","app.header.cliVersion":"CLI {{version}}","app.header.remoteAccess":"Remote access","app.header.remoteBadge":"Remote","app.header.remoteBadgeTitle":"This window is connected from a paired device. Managing remote access, and anything that opens a file with the apps of the computer running Agent Workbench, is only available on that computer.","app.header.shortcuts":"Show keyboard shortcuts","app.markerNotice":"This server was started from inside a CLI session. The <code>{{variable}}</code> variable was removed from the tabs' environment: it turns off history saving, and without that there would be no conversation or context meter. The rest of the environment is left untouched.","app.panel.name":"Panel","app.panel.show":"Show the right panel (Alt+P)","app.picker.project.confirm":"Open here","app.picker.project.confirmTitle":"Open an agent tab in {{path}}","app.picker.project.title":"New project","app.picker.vault.confirm":"Use this folder","app.picker.vault.confirmTitle":"Move the local copy to {{path}}. The current folder stays untouched","app.picker.vault.title":"Local copy folder","app.sidebar.name":"Projects","app.sidebar.show":"Show the project list","app.status.connecting":"Connecting","app.status.failed":"No connection","app.status.open":"Connected","app.status.reconnecting":"Reconnecting","app.status.revoked":"Access revoked","archive.allBlocked_one":"Its only conversation has an open tab. Close it first.","archive.allBlocked_other":"Its {{count}} conversations have an open tab. Close them first.","archive.blockedStays_one":"Another one has an open tab and stays.","archive.blockedStays_other":"{{count}} others have an open tab and stay.","archive.confirm_one":"Archive {{count}} conversation?","archive.confirm_other":"Archive the {{count}} conversations?","archive.withBlocked":"{{confirm}} {{blocked}}","common.cancel":"Cancel","common.close":"Close","common.closeEsc":"Close (Esc)","common.copied":"Copied","common.copyCode":"Copy code","common.dismissNotice":"Dismiss the notice","common.gotIt":"Got it","composer.attach":"Attach a file","composer.attachTitle":"Attach a file: a log, a PDF, a document or an image","composer.chip.editHint":"Show and edit the pasted text","composer.chip.editorLabel":"Edit pasted text #{{number}}","composer.chip.pastedTextEmpty":"#{{number}} · Pasted text · empty, won't be sent","composer.chip.pastedText_one":"#{{number}} · Pasted text · {{count}} line","composer.chip.pastedText_other":"#{{number}} · Pasted text · {{count}} lines","composer.chip.remove":"Remove","composer.pastedImage":"pasted image","composer.placeholder.ended":"This tab's session has ended.","composer.placeholder.ready":"Type your message.","composer.placeholder.sleeping":"This tab doesn't have the CLI open yet.","composer.problem.draftTooLong":"This message is too long to keep as a draft: if you close Agent Workbench before sending it, it will be lost.","composer.problem.empty":'"{{name}}" is empty.',"composer.problem.imageTooBig":"The image is {{size}} MB; the maximum is {{max}} MB.","composer.problem.imageUnreadable":"Couldn't read the image from the clipboard.","composer.problem.tooBig":'"{{name}}" is {{size}} MB; the maximum is {{max}} MB.',"composer.problem.tooManyFiles_one":"Up to {{count}} file per message.","composer.problem.tooManyFiles_other":"Up to {{count}} files per message.","composer.problem.tooManyImages_one":"Up to {{count}} image per message.","composer.problem.tooManyImages_other":"Up to {{count}} images per message.","composer.problem.unreadable":`Couldn't read "{{name}}".`,"composer.resizeTitle":"Drag to resize the message box","composer.send":"Send","composer.sendTitle":"Send (Enter)","composer.stop":"Stop","composer.stopTitle":"Interrupt whatever the CLI is doing (Esc)","console.collapse":"Collapse. The processes keep running: to end them, use each terminal's ×","console.name":"Console","console.noShell":"No system console was found to open.","console.openAnother":"Open another {{shell}} in {{cwd}}","console.openAnyIn":"Open a console in {{cwd}}","console.openIn":"Open {{shell}} in {{cwd}}","console.tab.close":"Close this terminal and end its process","console.tab.exited":"Exited with code {{code}}","console.tab.label":"Terminal {{number}}","console.tab.title":"{{shell}} {{number}} in {{cwd}}","continue.menuLabel":"Continue with","controls.effort.high":"High","controls.effort.inUse":"Effort in use: {{effort}}. Changing it sends /effort to the CLI tab","controls.effort.inUseSaved":"Effort in use: {{effort}}. Changing it sends /effort 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.noData":"Effort: no data. Not every model has levels — with haiku, /effort leaves no trace","controls.effort.placeholder":"effort — no data","controls.effort.provisional":"Effort from your configuration: {{effort}}. No response has confirmed it yet","controls.effort.xhigh":"Very high","controls.model.default":"Default","controls.model.inUse":"Model in use: {{model}}. Changing it sends /model to the CLI tab","controls.model.inUseSaved":"Model in use: {{model}}. Changing it sends /model to the CLI tab, and the CLI saves it as the default for the next tabs","controls.model.noData":"Model: there hasn't been any response in this session yet","controls.model.placeholder":"model — no data","controls.model.provisional":"Model from your configuration: {{model}}. No response has confirmed it yet","conversation.answerUnconfirmed":"The CLI didn't confirm this answer. Try again, or answer in the CLI tab.","diff.binary":"Binary file: there's no diff to show.","diff.noChanges":"No changes.","diff.truncated":"The diff was cut off because of its size. The full file is easier to read outside this panel.","files.allHidden":"everything in it is hidden","files.back":"← Files","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.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","git.aheadBehindTitle":"Commits ahead of and behind the upstream branch","git.backToChanges":"Changes","git.clean":"The working tree is clean.","git.detached":"Detached HEAD","git.detachedAt":"Detached HEAD @ {{head}}","git.group.conflict":"Conflicted","git.group.conflictHint":"They need to be resolved before going on","git.group.staged":"Staged","git.group.stagedHint":"Already added with git add","git.group.unstaged":"Unstaged","git.group.unstagedHint":"Modified in the working tree","git.group.untracked":"Untracked","git.group.untrackedHint":"New files git doesn't know about","git.kind.added":"added","git.kind.conflict":"conflicted","git.kind.copied":"copied","git.kind.deleted":"deleted","git.kind.modified":"modified","git.kind.renamed":"renamed","git.kind.typeChanged":"type changed","git.kind.untracked":"untracked","git.newFolderTitle":"{{path}} — new folder; its contents show up in Files","git.readingDiff":"Reading the diff…","git.refresh":"Refresh the status now","git.stagedTag":"staged","git.truncated":"There are more changes than shown. It usually means a rule is missing from <code>.gitignore</code>.","git.unknownState":"The repository's status isn't known yet.","git.upstreamTitle":"Upstream branch: {{upstream}}","git.worktrees.detached":"detached","git.worktrees.heading":"Other worktrees","git.worktrees.headingTitle":"Other working trees of this repository","header.locale.auto":"Automatic (browser: {{name}})","header.locale.title":"Language: {{name}}","header.locale.titleAuto":"Language: {{name}} (automatic, from the browser)","memory.action.appendBlock":"the block will be added at the end","memory.action.appendLines":"lines will be added at the end","memory.action.copy":"will be copied","memory.action.create":"will be created","memory.action.replaceBlock":"the block will be replaced","memory.back":"← Memory","memory.error.connectionLost":"The connection dropped before the response. Once it reconnects, the status shows what got written.","memory.form.copyFromMain":"Copy the notes from the main worktree","memory.form.existingNotes":"Existing notes","memory.form.files":"Instruction files","memory.form.importNative_one":"Import {{count}} note from Claude Code's memory","memory.form.importNative_other":"Import {{count}} notes from Claude Code's memory","memory.form.noFiles":"Choose at least one instruction file","memory.form.planning":"Calculating…","memory.form.preview":"Preview changes","memory.git.alreadyIgnored":"This repo already ignores <code>.agents/memory/</code>. To track it, that rule has to be removed from <code>.gitignore</code> by hand.","memory.git.blocked":"With git returning an error, it can only be installed without touching .gitignore","memory.git.dontTouch":"Don't touch <code>.gitignore</code>","memory.git.errorHint":"git returned an error","memory.git.errorWarning":"git returned an error, so there's no telling whether the memory is ignored. It can be installed without touching <code>.gitignore</code>.","memory.git.ignore":"Ignore the memory","memory.git.ignoreHint":"recommended","memory.git.version":"Track it","memory.git.versionHint":"for private repos","memory.global.copy":"Copy the snippet","memory.global.intro":"What applies to all your projects goes in <code>~/.agents/global.md</code>. The app doesn't write it: each CLI reads it once you add its snippet.","memory.global.title":"Global memory","memory.index":"Index","memory.intro.what":"Shared memory keeps what the agents learn about this project —decisions, constraints, pitfalls they already ran into— for the next session.","memory.intro.where":"It lives in <code>.agents/memory/</code>: one note per file and an index, <code>MEMORY.md</code>. The four CLIs read it through a marked block in their instructions file. Nothing is written until you confirm the changes.","memory.list.empty":"No notes yet. The agents save them here when they learn something that's useful in another session.","memory.list.notes":"Notes","memory.loading":"Reading the memory…","memory.native.import_one":"Import {{count}} note","memory.native.import_other":"Import {{count}} notes","memory.native.importing":"Importing…","memory.native.pending_one":"Claude Code's own memory has {{count}} note that isn't here.","memory.native.pending_other":"Claude Code's own memory has {{count}} notes that aren't here.","memory.note.loading":"Reading the note…","memory.note.truncated":"The note was cut off because of its size.","memory.plan.back":"Back","memory.plan.changes":"Changes","memory.plan.copiedFrom":"Copy of {{path}}","memory.plan.install":"Install","memory.plan.nothing":"There's nothing to change: the bridge is already up to date.","memory.plan.update":"Update","memory.plan.writing":"Writing…","memory.problem.brokenBlock":"Its block markers are malformed","memory.problem.brokenBlockWarning":"<code>{{file}}</code> has malformed memory block markers: one without its pair, or the block repeated. The app won't touch it until you fix it by hand.","memory.problem.encoding":"It isn't in UTF-8","memory.problem.encodingWarning":"<code>{{file}}</code> isn't in UTF-8 (it looks like UTF-16, which is what <code>></code> writes in Windows PowerShell 5.1). Save it as UTF-8: the app won't touch it until then.","memory.problem.outside":"It's a link that points outside the project","memory.problem.outsideWarning":"<code>{{file}}</code> is a link that points outside the project: the app doesn't read or write it.","memory.reach.adjust":"Adjust","memory.reach.adjustTitle":"Choose the bridge's instruction files again","memory.reach.doesNotReach":": doesn't reach the memory, {{via}}","memory.reach.reaches":": reaches the memory through {{via}}","memory.reach.title":"{{label}}: {{via}}","memory.result.imported_one":"Imported {{count}} note.","memory.result.imported_other":"Imported {{count}} notes.","memory.result.installed_one":"Done: {{count}} file changed.","memory.result.installed_other":"Done: {{count}} files changed.","memory.result.nothingChanged":"There was nothing to change: the bridge was already up to date.","memory.result.nothingImported":"There were no new notes to import.","memory.result.skipped_one":"Not overwritten because it already existed with different content: {{files}}.","memory.result.skipped_other":"Not overwritten because they already existed with different content: {{files}}.","memory.result.withSkipped":"{{result}} {{skipped}}","memory.update.button":"Update the bridge","memory.update.missing":"The block is missing from {{files}}.","memory.update.outdatedAndMissing_one":"{{outdated}} has an outdated block; the block is missing from {{missing}}.","memory.update.outdatedAndMissing_other":"{{outdated}} have an outdated block; the block is missing from {{missing}}.","memory.update.outdated_one":"{{files}} has an outdated block.","memory.update.outdated_other":"{{files}} have an outdated block.","meter.configure":"Configure","meter.label":"Context","meter.lastResponseTitle":"The model's last response","meter.modelWithOrigin":"{{model}} — {{origin}}","meter.noTokens":"this CLI doesn't publish tokens","meter.noTokensTitle":"This CLI doesn't publish how many tokens each response uses, so there's nothing to measure.","meter.output":"output {{tokens}}","meter.responses_one":"{{count}} response","meter.responses_other":"{{count}} responses","meter.sessionTitle":"Total for the whole session","meter.sessionTotals_one":"session {{output}} out · {{cache}} cache · {{count}} response","meter.sessionTotals_other":"session {{output}} out · {{cache}} cache · {{count}} responses","meter.unknownModel":"unrecognized model: showing the tokens, not the window size","meter.unknownModelShort":"unrecognized model: no window size","meter.unmeasured":"not measured","meter.windowPercent":"{{percent}}% of the window","mode.acceptEdits.hint":"Accepts file edits without asking","mode.acceptEdits.label":"Accept edits","mode.auto.hint":"The CLI decides on its own which tools to use, without asking","mode.auto.label":"Auto","mode.default.hint":"Asks before each tool that isn't allowed","mode.default.label":"Manual","mode.plan.hint":"Researches and proposes a plan, without touching anything until you approve it","mode.plan.label":"Plan","narrow.keys.ctrlO":"Ctrl+O (in Claude Code, expands what is shown cut short)","narrow.keys.ctrlX":"Ctrl+X","narrow.keys.down":"Down arrow","narrow.keys.esc":"Escape","narrow.keys.interrupt":"Ctrl+C: interrupt","narrow.keys.label":"Terminal keys","narrow.keys.left":"Left arrow","narrow.keys.right":"Right arrow","narrow.keys.shiftTab":"Shift+Tab (in Claude Code, cycles the permission mode)","narrow.keys.tab":"Tab","narrow.keys.up":"Up arrow","narrow.menu.chimePage":"This page","narrow.menu.chimeSystem":"System","narrow.menu.cli":"CLI","narrow.menu.connection":"Connection","narrow.menu.folder":"Folder","narrow.menu.language":"Language","narrow.menu.notifications":"System notifications","narrow.menu.phoneAppDisconnect":"Disconnect","narrow.menu.phoneAppSettings":"Settings","narrow.menu.shortcuts":"Keyboard shortcuts","narrow.menu.sound":"Notification sound","narrow.menu.theme":"Theme","narrow.more":"More","narrow.projects":"Projects","narrow.tabs.close":"Close tab","narrow.tabs.new":"New tab","narrow.tabs.none":"No tabs open.","narrow.tabs.open":"Tabs","narrow.tabs.rename":"Rename","narrow.view.chat":"Chat","notes.attach":"Attach an image from a file","notes.closeConfirm":"Closing this note deletes it, along with its images.","notes.closeNote":"Close the note. It's deleted, along with its images","notes.collapse":"Collapse. Notes aren't lost: the × on each tab is what closes them","notes.empty":"No notes. The <b>+</b> opens one; they're for jotting down an idea without leaving what you're doing.","notes.expand":"Expand the notes","notes.imageAlt":"note image","notes.imageFallbackName":"the image","notes.imageOnly":"Image","notes.imageTooBig":'"{{name}}" is {{size}} MB; the maximum is {{max}} MB.',"notes.imageUnavailable":"the image isn't available","notes.lightboxClose":"Click to close","notes.name":"Notes","notes.new":"New note","notes.placeholder":"Jot down an idea. Images can be pasted or dragged here.","notes.readFailed":"Couldn't read the image.","notes.removeImage":"Remove the image","notes.resize":"Drag to change the height","notes.thumbMissing":"missing","notes.tooManyImages_one":"Up to {{count}} image per note.","notes.tooManyImages_other":"Up to {{count}} images per note.","notes.untitled":"Note","notify.attention":"“{{tab}}” is waiting for you","notify.done":"“{{tab}}” finished","panel.cliUnseen":"The CLI wrote something","panel.hide":"Hide the panel (Alt+P)","panel.restoreWidth":"Restore the column's width","panel.tab.cli":"CLI","panel.tab.files":"Files","panel.tab.git":"Changes","panel.tab.memory":"Memory","panel.tab.plans":"Plans","panel.widen":"Widen the column — the CLI's interface needs room to draw diffs and tables","picker.create":"Create","picker.createHere":"Create a folder here","picker.empty":"There are no subfolders here.","picker.goTo":"Go to {{root}}","picker.loading":"Reading the disk...","picker.newFolderName":"Folder name","picker.truncated":"There are more subfolders than fit in the list. Open one to narrow it down.","picker.up":"parent folder","plans.backToList":"Plans","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.","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 local copy, ignoring case and accents","search.mode.titles":"In titles","search.off":"The local copy 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.answerInterrupted":"The answer wasn't fully sent: the interruption cut it off.","server.answerInvalid":"The answer doesn't match the question.","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.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.filesPerMessage":"You can attach up to {{max}} files per message.","server.gitCommandFailed":"git {{command}} failed.","server.gitMissing":"git wasn't found in the PATH. The Changes panel needs git installed; the rest of the app works the same.","server.gitNotFound":"git wasn't found in the PATH.","server.gitNotRepo":"This folder isn't inside a git repository.","server.gitRunFailed":"git couldn't be run to read the repository's status.","server.gitStatusUnknown":"The repository's status isn't known yet.","server.gitUnexpected":"Unexpected answer from git {{command}}.","server.handoffEmpty":"That conversation has no messages to continue.","server.handoffNoTranscript":"That conversation has no messages to continue: that CLI didn't leave a readable transcript.","server.imageEmpty":"The image arrived empty.","server.imageTooLarge":"The image is {{size}} MB; the maximum is {{max}} MB.","server.imageTypeUnsupported":"Image type not supported: {{type}}","server.imageUnknownFormat":"The content isn't an image in a known format.","server.imagesPerMessage":"You can attach up to {{max}} images per message.","server.imagesUnsupported":"This CLI doesn't take images from the message box.","server.memoryAppeared":"{{file}} appeared during the installation. Review the changes again.","server.memoryBrokenBlock":"{{file}} has malformed memory block markers (one without its pair, or the block repeated). Fix it by hand: the app won't touch that file in the meantime.","server.memoryChooseFile":"Choose at least one instructions file.","server.memoryGitFailed":"git couldn't be queried ({{detail}}). Without that, there's no telling whether .gitignore needs changes.","server.memoryHardLinks":"{{file}} has hard links: the app doesn't modify it, because writing it would break the link. Add the block by hand.","server.memoryLinkOutside":"{{path}} points outside the project (a link or a junction): the app doesn't write there.","server.memoryNotAFile":"{{label}} exists but isn't a file.","server.memoryNotInstalled":"Install the bridge first: the .agents/memory folder is missing.","server.memoryNotUtf8":"{{file}} isn't UTF-8 (it looks like UTF-16, which is what `>` leaves in Windows PowerShell 5.1). Save it as UTF-8: the app won't touch it in the meantime.","server.memoryNoteClaude":"Add this line at the end. Claude Code imports the file at startup.","server.memoryNoteGone":"That note no longer exists.","server.memoryNoteHardLink":"Hard link. `~/{{path}}` has to exist first, and the CLI's file must not: if it exists, move what it has into `global.md` and delete it. If your editor saves by replacing the file, the link breaks: in that case copy the content.","server.memoryNoteHardLinkCmd":"Hard link, in cmd. `~/{{path}}` has to exist first, and the CLI's file must not: if it exists, move what it has into `global.md` and delete it. If your editor saves by replacing the file, the link breaks: in that case copy the content.","server.memoryNoteName":"That name isn't a memory note.","server.memoryNoteOpenCode":"Inside the root object. Absolute path: OpenCode doesn't expand `~` in this key (unverified).","server.memorySameFile":"{{other}} and {{file}} are the same file (a link). Choose just one.","server.memoryViaEncoding":"{{file}} isn't UTF-8","server.memoryViaFallback":"CLAUDE.md (fallback)","server.memoryViaFile":"{{file}}","server.memoryViaNoBlock":"the block is missing in {{file}}","server.memoryViaNoBlockEither":"the block is missing in AGENTS.md or CLAUDE.md","server.memoryViaNoFolder":"the .agents/memory folder is missing","server.memoryViaNoIndex":".agents/memory/MEMORY.md is missing","server.memoryViaOutside":"{{file}} points outside the project","server.modePendingConfirmation":"There's a confirmation pending in the CLI: changing the mode now would approve it. Answer it in the CLI tab.","server.modeUnreachable":"That mode can't be reached from the current one. Change it with {{key}} in the CLI tab.","server.modesUnsupported":"This CLI has no permission modes to change from here.","server.noteCliNotStarted":"That tab's CLI didn't manage to start; the note wasn't sent.","server.noteEmpty":"The note is empty.","server.noteExists":"That note already exists.","server.noteGone":"The note no longer exists.","server.noteIdInvalid":"The note's id isn't valid.","server.noteImageFailed":"An image from the note couldn't be attached.","server.noteImagesMax":"Up to {{max}} images per note.","server.noteImagesUnsupported":"This CLI doesn't take images; the note wasn't sent.","server.noteInterrupted":"The note wasn't fully sent: the interruption cut it off.","server.noteNoAgent":"That tab has no agent to send the note to.","server.noteNoReadySignal":"This CLI doesn't say when it's ready; the note wasn't sent.","server.noteSaveFailed":"The note couldn't be saved.","server.noteTooLong":"A note holds up to {{max}} characters.","server.notesMax":"Up to {{max}} open notes. Close one first.","server.openToolSubmit":"{{label}} has a tool without a result: it may be asking for approval. Answer it in the CLI tab.","server.operationFailed":"The operation couldn't be completed: {{detail}}","server.pasteImageFailed":"The pasted image couldn't be saved.","server.pathMissing":"The path doesn't exist.","server.pathNotRelative":"Only paths relative to the tab's directory are accepted.","server.pathNullByte":"The path contains a null byte.","server.pathOpenFailed":"The path couldn't be opened.","server.pathOutside":"The path goes outside the tab's directory.","server.pendingSubmitAnswer":"{{label}} is waiting for an answer: the message's Enter would answer it. Answer it in the CLI tab.","server.pendingSubmitPermission":"{{label}} is waiting for you to authorize a tool: the message's Enter would approve it. Answer it in the CLI tab.","server.pickerCliFolder":"That folder belongs to the CLI and can't be opened from here.","server.pickerClosed":"That folder picker is no longer open.","server.pickerCreateFailed":"The folder couldn't be created there.","server.pickerFolderExists":"There's already a folder with that name.","server.pickerListFailed":"That folder couldn't be listed.","server.pickerNameChars":"The name has characters that can't be used.","server.pickerNameInvalid":"The folder name isn't valid.","server.pickerNoProjectsHere":"Projects aren't created there: it's the CLI's folder.","server.pickerNotListed":"That folder isn't in the current listing.","server.pickerRootMissing":"That root doesn't exist.","server.pickerTooMany":"Too many folder pickers are open.","server.planReadFailed":"The plan couldn't be read.","server.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.searchFailed":"The local copy couldn't be searched.","server.shellNotFound":"No system console was found to open.","server.submitInterrupted":"The message wasn't fully sent: the interruption cut it off.","server.submitStoppedTool":"The message wasn't fully sent: {{label}} opened a tool while it was being typed and may be asking for approval. Check the CLI tab.","server.submitStoppedToolNoLabel":"The message wasn't fully sent: the CLI opened a tool while it was being typed and may be asking for approval. Check the CLI tab.","server.submitStoppedWaiting":"The message wasn't fully sent: {{label}} started waiting for an answer while it was being typed. Answer it before sending another message.","server.submitStoppedWaitingNoLabel":"The message wasn't fully sent: the CLI started waiting for an answer while it was being typed. Answer it before sending another message.","server.tabClosedWhileOpening":"The tab closed while it was opening.","server.tabDirGone":"The tab's directory no longer exists.","server.tabOpenFailed":"The tab couldn't be opened.","server.terminalAsleep":"This tab doesn't have its CLI open. Open it to write to the agent.","server.terminalGone":"The terminal no longer exists.","server.terminalOpenFailed":"The terminal couldn't be opened.","server.tooManyTabs":"You can't open more than {{max}} tabs at once.","server.vaultBusyMeasuring":"The local copy is busy measuring. Try again when it's done.","server.vaultBusyMoving":"The local copy is busy moving to another folder. Try again when it's done.","server.vaultBusyWriting":"The local copy is busy copying. Try again when it's done.","server.vaultCannotWrite":"That folder can't be written to.","server.vaultCurrentInsideTarget":"The current copy can't end up inside the new folder.","server.vaultDiskFull":"Disk full: the pass stopped ({{detail}})","server.vaultFailed":"The local copy 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 local copy couldn't be moved: {{detail}}","server.vaultMoving":"The local copy is moving to another folder. Try again when it's done.","server.vaultNoCopyYet":"There's no local copy yet.","server.vaultNotLoaded":"The local copy 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 local copy.","server.vaultTargetCliFolder":"That folder belongs to a CLI: the local copy isn't kept there.","server.vaultTargetInsideCurrent":"The new folder can't be inside the current copy.","server.vaultTargetNotAbsolute":"The local copy folder has to be an absolute path.","server.waitingSubmit":"{{label}} is waiting for an answer: answer it before sending another message.","session.untitled":"Untitled session","shortcuts.altNumber":"<strong>Alt + number</strong> isn't used either, on purpose: on Windows, Alt with the numeric keypad is how you type characters that aren't on the keyboard (<kbd>Alt + 164</kbd> = ñ). Intercepting it breaks typing accented characters. To switch tabs there are <kbd>Alt + ←</kbd> and <kbd>Alt + →</kbd>.","shortcuts.app.closeTab":"Close the active tab","shortcuts.app.newTab":"New tab in the current tab's directory","shortcuts.app.previousTab":"Go back to the previous tab (outside the terminal: inside, it goes to the CLI)","shortcuts.app.switchTab":"Previous / next tab (also Alt + PgUp / PgDn)","shortcuts.app.togglePanel":"Show or hide the right panel","shortcuts.ariaLabel":"Keyboard shortcuts","shortcuts.browserReserved":"<strong>Ctrl+T</strong>, <strong>Ctrl+W</strong> and <strong>Ctrl+Tab</strong> can't be used: the browser keeps them for its own tabs and the event never reaches the page.","shortcuts.cliHint":"The CLI handles these. The app doesn't intercept them: they reach it as they are. In the terminal, a new line is still <kbd>Ctrl + J</kbd> and images are pasted with <kbd>Alt + V</kbd>; the message box is the one with the keys above.","shortcuts.section.app":"Application","shortcuts.section.cli":"CLI, inside the terminal","shortcuts.section.composer":"In the message box","shortcuts.title":"Shortcuts","sidebar.action.archive":"Archive","sidebar.action.restore":"Restore","sidebar.action.undo":"Undo","sidebar.archived.hide_one":"Hide {{count}} archived","sidebar.archived.hide_other":"Hide {{count}} archived","sidebar.archived.show_one":"Show {{count}} archived","sidebar.archived.show_other":"Show {{count}} archived","sidebar.archived.toggleTitle":"Archived sessions stay on disk; this only shows or hides them","sidebar.empty.noMatch":"Nothing matches the filter.","sidebar.empty.noProjects":"No projects found in the history.","sidebar.hide":"Hide the projects","sidebar.history.button":"Archive history…","sidebar.history.buttonTitle":"Hide a CLI's sessions from before today in one go. Nothing is deleted","sidebar.history.confirm_one":"{{count}} {{label}} session will be hidden; nothing is deleted","sidebar.history.confirm_other":"{{count}} {{label}} sessions will be hidden; nothing is deleted","sidebar.history.count_one":"{{count}} session from before today","sidebar.history.count_other":"{{count}} sessions from before today","sidebar.history.heading":"Archive everything before today","sidebar.history.region":"Archive history","sidebar.indexing":"Indexing {{scanned}} / {{total}}","sidebar.newProject":"New project: choose or create a folder","sidebar.project.archive":"Archive project","sidebar.project.archiveTitle":"Archive the project: hides its conversations from the sidebar. Nothing is deleted","sidebar.project.export":"Export to Markdown","sidebar.project.folderGone":"The folder no longer exists on disk","sidebar.project.missing":"folder not found","sidebar.project.newSession":"New session in this project","sidebar.reindex":"Reindex the history","sidebar.searchMode.label":"Where to search","sidebar.searchMode.titlesTitle":"Filters the list by project name and session title","sidebar.selection.count_one":"{{count}} selected","sidebar.selection.count_other":"{{count}} selected","sidebar.session.archive":"Archive — hides it from the list, nothing is deleted","sidebar.session.blocked":"It has an open tab. Close it first.","sidebar.session.restore":"Restore to the list","sidebar.undo.dismissTitle":"Dismiss the notice; the sessions stay archived","sidebar.undo.text_one":"Archived {{count}} session from {{what}}","sidebar.undo.text_other":"Archived {{count}} sessions from {{what}}","sidebar.vaultLine.lastError":"Last error: {{error}}","sidebar.vaultLine.title":"See the local copy's status and folder","sound.notify.blocked":"The browser is blocking this page's notifications. Allow them in the site's settings and click again.","sound.notify.off":"System notifications off — click to turn them on","sound.notify.on":"System notifications on — click to turn them off. They only show when this window isn't in view.","sound.off":"Notification sound muted — click to turn it on","sound.on":"Notification sound on — click to mute","sound.volume":"Notification sound volume","statusLine.benefit":"With the status line configured, this CLI's tabs show their status, the “waiting” bar when it asks for permission to use a tool, and the context meter with the exact window. Without it there's no way to know: the CLI doesn't leave it in any other file.","statusLine.check":"Check","statusLine.checkHint":"The app also notices on its own within a couple of seconds.","statusLine.checking":"Checking…","statusLine.copied":"Copied","statusLine.copy":"Copy","statusLine.copyTitle":"Copy the line to the clipboard","statusLine.lineSection":"The line","statusLine.mergeHint":"Merge it with what the file below already has, without replacing it: if it already has braces, add only the <kbd>statusLine</kbd> key.","statusLine.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, in the app's folder. It doesn't save your email, your quota 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.continueWith":"↪ Continue with…","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.loadEarlier":"Load earlier messages","thread.loadingMore":"Loading...","thread.notice.compacted":"Context compacted","thread.notice.compactedAuto":"Context compacted automatically","thread.notice.error":"The CLI returned an error: {{detail}}","thread.notice.errorNoDetail":"The CLI returned an error","thread.notice.interrupted":"Interrupted","thread.pasted_one":"Pasted text #{{number}} · {{count}} line","thread.pasted_other":"Pasted text #{{number}} · {{count}} lines","thread.question.answerInCli":"Answer in the CLI tab","thread.question.answered":"Answered","thread.question.multi":"multiple","thread.question.pickEach":"Pick an option in each question · you can also answer in the CLI tab","thread.question.pickOne":"Pick an option · you can also answer in the CLI tab","thread.question.placeholder":"Write your answer","thread.question.send":"Send","thread.question.sendAnswers":"Send answers","thread.question.useText":"Use this text","thread.question.writeOther":"Write another answer…","thread.question.writeOtherHint":"To suggest an alternative, or give more context","thread.rewind":"Go back here — opens the CLI's rewind menu in the CLI tab (Esc Esc)","thread.search.next":"Next","thread.search.none":"no results","thread.search.placeholder":"Search the conversation","thread.search.previous":"Previous","thread.status.awaitingReply":"Delivered to the CLI · no reply yet · {{elapsed}}","thread.status.delivered":"Delivered to the CLI","thread.status.sending":"Sending to the CLI…","thread.status.subagent":"{{name}} ({{elapsed}})","thread.status.subagentUnnamed":"unnamed","thread.status.subagentsMore_one":"{{count}} more","thread.status.subagentsMore_other":"{{count}} more","thread.status.subagents_one":"{{count}} subagent still working: {{list}}","thread.status.subagents_other":"{{count}} subagents still working: {{list}}","thread.status.working":"The agent is working…","thread.status.workingDelivered":"The agent is working · message delivered","thread.status.workingFor":"The agent is working · {{elapsed}}","thread.status.workingForDelivered":"The agent is working · {{elapsed}} · message delivered","thread.tool.error":"error","thread.tool.imagesNotSent_one":"({{count}} image: not sent to the panel)","thread.tool.imagesNotSent_other":"({{count}} images: not sent to the panel)","thread.tool.images_one":"{{count}} image","thread.tool.images_other":"{{count}} images","thread.tool.input":"input","thread.tool.noOutput":"(no output)","thread.tool.orphanResult":"orphan result","thread.tool.result":"result","thread.truncated":"… (truncated)","thread.turn.effort":"effort {{effort}}","thread.turn.queued":"sent while it was working","thread.turn.queuedTitle":"You wrote it while the agent was working: it went into the turn already in progress","thread.turn.you":"You","thread.wake.exited":"This tab's CLI closed.","thread.wake.exitedWithCode":"This tab's CLI closed (exit code {{code}}).","thread.wake.open":"Open CLI","thread.wake.opening":"Opening…","thread.wake.sleeping":"You're reading this conversation without the CLI open. Open it to write to the agent.","threadFont.size.l":"large","threadFont.size.m":"normal","threadFont.size.s":"small","threadFont.title":"Font size: {{current}} (click: {{next}})","time.daysAgo":"{{count}} d ago","time.hoursAgo":"{{count}} h ago","time.justNow":"just now","time.minutesAgo":"{{count}} min ago","tools.run.agent_one":"{{count}} subagent","tools.run.agent_other":"{{count}} subagents","tools.run.callsTo_one":"{{count}} call to {{name}}","tools.run.callsTo_other":"{{count}} calls to {{name}}","tools.run.edit_one":"{{count}} edit","tools.run.edit_other":"{{count}} edits","tools.run.find_one":"{{count}} project search","tools.run.find_other":"{{count}} project searches","tools.run.read_one":"{{count}} file read","tools.run.read_other":"{{count}} files read","tools.run.shell_one":"{{count}} console command","tools.run.shell_other":"{{count}} console commands","tools.run.todo_one":"{{count}} to-do list","tools.run.todo_other":"{{count}} to-do lists","tools.run.web_one":"{{count}} search","tools.run.web_other":"{{count}} searches","vault.archived":"Archived sessions aren't copied, and archiving one that was already copied doesn't delete its copy. The app never deletes anything from this folder.","vault.busy":"A local copy operation is in progress. Wait for it to finish.","vault.button.off":"Local copy: off. Set it up","vault.button.on":"Local copy: on. See the status and the folder","vault.dialog.activate":"Turn on","vault.dialog.activateExistingHint":"The folder already has a copy. Once on, it completes it and keeps it up to date.","vault.dialog.activateExistingTitle":"The folder already has a copy: 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":"copy","vault.mark.copyTitle":"The CLI's history no longer has this session. The local copy 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":"Local copy","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."},Kc=["en","es","de","fr","pt-BR","ru","ja","ko","zh-CN"],_p="en",oc={en:"English",es:"Español",de:"Deutsch",fr:"Français","pt-BR":"Português (Brasil)",ru:"Русский",ja:"日本語",ko:"한국어","zh-CN":"简体中文"},g0={en:"EN",es:"ES",de:"DE",fr:"FR","pt-BR":"PT",ru:"RU",ja:"JA",ko:"KO","zh-CN":"ZH"},Gc={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"},_0={es:()=>On(()=>import("./es-BrWQ_4kO.js"),[]),de:()=>On(()=>import("./de-CXvJ7uwt.js"),[]),fr:()=>On(()=>import("./fr-Cv_qM9E8.js"),[]),"pt-BR":()=>On(()=>import("./pt-BR-BAHKndFr.js"),[]),ru:()=>On(()=>import("./ru-D1S49VN_.js"),[]),ja:()=>On(()=>import("./ja-h9u8sCMK.js"),[]),ko:()=>On(()=>import("./ko-m0EzMLN6.js"),[]),"zh-CN":()=>On(()=>import("./zh-CN-CH6r3KGh.js"),[])},vp=m0,Rc=new Map([["en",vp]]),Id=new Map,Mc=new Set;let Hi=_p,Ac=Gc[_p],Pd=0;function yp(n){return Kc.includes(n)}function Nc(){return Hi}function ga(){return Ac}function v0(n){return Gc[n]}function wp(n){return Mc.add(n),()=>Mc.delete(n)}async function bp(n,r=Gc[n]){const o=++Pd;if(!Rc.has(n)&&n!=="en"){const p=await _0[n]();Rc.set(n,p.default)}if(o===Pd&&!(Hi===n&&Ac===r)){Hi=n,Ac=r;for(const p of Mc)p()}}function y0(n,r){let o=Id.get(n);return o===void 0&&(o=new Intl.PluralRules(n),Id.set(n,o)),o.select(r)}function jd(n,r,o,p){if(p!==void 0){const w=n[`${o}_${y0(r,p)}`]??n[`${o}_other`];if(w!==void 0)return w}return n[o]}function w0(n,r,o,p){const w=p==null?void 0:p.count,A=typeof w=="number"?w:void 0;return(n===void 0?void 0:jd(n,r,o,A))??jd(vp,"en",o,A)??o}function la(n,r){return r===void 0?n:n.replace(/\{\{\s*([A-Za-z0-9_]+)\s*\}\}/g,(o,p)=>{const w=r[p];return w===void 0?o:String(w)})}function Sp(n,r){return w0(Rc.get(Hi),Hi,n,r)}function k(n,r){return la(Sp(n,r),r)}function b0(){return[{keys:"Esc",description:k("agent.shortcuts.codex.interruptTurn")},{keys:"Esc Esc",description:k("agent.shortcuts.codex.editPrevious")},{keys:"Ctrl + C",description:k("agent.shortcuts.codex.interruptOrExit")},{keys:"Alt + , / Alt + .",description:k("agent.shortcuts.codex.effort")},{keys:"Shift + Tab",description:k("agent.shortcuts.codex.cycleMode")},{keys:"Tab",description:k("agent.shortcuts.codex.queue")},{keys:"Ctrl + T",description:k("agent.shortcuts.codex.transcript")},{keys:"Ctrl + R",description:k("agent.shortcuts.codex.searchHistory")},{keys:"@",description:k("agent.shortcuts.codex.mention")},{keys:"/",description:k("agent.shortcuts.commands")},{keys:"Ctrl + G",description:k("agent.shortcuts.codex.externalEditor")}]}function S0(){return[{keys:"Esc Esc",description:k("agent.shortcuts.opencode.interrupt")},{keys:"Tab / Shift + Tab",description:k("agent.shortcuts.opencode.cycleAgent")},{keys:"Ctrl + P",description:k("agent.shortcuts.opencode.commandList")},{keys:k("agent.shortcuts.leaderThen",{key:"M"}),description:k("agent.shortcuts.opencode.model")},{keys:k("agent.shortcuts.leaderThen",{key:"N"}),description:k("agent.shortcuts.opencode.newSession")},{keys:"Ctrl + J",description:k("agent.shortcuts.opencode.newline")},{keys:"Ctrl + C",description:k("agent.shortcuts.opencode.clearInput")},{keys:"Ctrl + V",description:k("agent.shortcuts.opencode.paste")}]}function C0(){return[{keys:"Esc",description:k("agent.shortcuts.antigravity.interrupt")},{keys:"Shift + Tab",description:k("agent.shortcuts.antigravity.cycleMode")},{keys:"1 … 4",description:k("agent.shortcuts.antigravity.answerPermission")},{keys:"/",description:k("agent.shortcuts.commands")},{keys:"?",description:k("agent.shortcuts.antigravity.help")}]}function x0(){return[{keys:"Esc",description:k("agent.shortcuts.interruptCli")},{keys:"Esc Esc",description:k("agent.shortcuts.claudeCode.rewind")},{keys:"Ctrl + C",description:k("agent.shortcuts.claudeCode.cancel")},{keys:"Ctrl + R",description:k("agent.shortcuts.claudeCode.searchHistory")},{keys:"Ctrl + O",description:k("agent.shortcuts.claudeCode.fullOutput")},{keys:"Shift + Tab",description:k("agent.shortcuts.claudeCode.cycleMode")},{keys:"Alt + V",description:k("agent.shortcuts.claudeCode.pasteImage")},{keys:"Ctrl + V",description:k("agent.shortcuts.claudeCode.pasteText")}]}const Us={"claude-code":{shortLabel:"CC",get shortcuts(){return x0()},shortcutsNote:null,instructionsFile:"CLAUDE.md",savesModelChoice:!1},codex:{shortLabel:"CX",get shortcuts(){return b0()},get shortcutsNote(){return k("agent.shortcuts.codex.note")},instructionsFile:"AGENTS.md",savesModelChoice:!1},opencode:{shortLabel:"OC",get shortcuts(){return S0()},get shortcutsNote(){return k("agent.shortcuts.opencode.note")},instructionsFile:"AGENTS.md",savesModelChoice:!1},antigravity:{shortLabel:"AG",get shortcuts(){return C0()},shortcutsNote:null,instructionsFile:"AGENTS.md",savesModelChoice:!0}},k0={"gemini-cli":"GC","antigravity-ide":"AI"};function E0(n){return Vi(n)?Us[n].shortLabel:k0[n]}function qi(n,r){var o;return Vi(n)?((o=r.find(p=>p.id===n))==null?void 0:o.label)??n:v_[n]}const L0="Sesion sin titulo";function Bn(n,r){return r==="none"||n===L0?k("session.untitled"):n}function Dc(n){return n.storage==="native"&&Vi(n.agent)}function T0(n){return n!==null&&Us[n].savesModelChoice}function R0(n){return n===null?null:Us[n].instructionsFile}function M0(n){return{modeCycle:n.permissionCycle,models:n.models,efforts:n.efforts,imagesAllowed:n.imagesByPath!==null,rewind:n.rewind,questionsAnswerable:n.questionCards,fileMentions:n.fileMentions!==null,plansAvailable:n.plans,contextWindowSource:n.contextWindowSource,noteSendable:n.readySignal}}function A0(n,r){const o=X_(r,n);return o===null?null:n.find(p=>p.value===o.value)??null}function N0(n,r){return n??r.launchMode}const D0={auto:"mode.auto.label",default:"mode.default.label",acceptEdits:"mode.acceptEdits.label",plan:"mode.plan.label"},I0={auto:"mode.auto.hint",default:"mode.default.hint",acceptEdits:"mode.acceptEdits.hint",plan:"mode.plan.hint"};function Cp(n){return k(D0[n])}function P0(n){return k(I0[n])}function j0(n,r){return k("agent.mode.title",{mode:Cp(n),hint:P0(n),key:r.keyLabel})}function xp(n,r){return n.approvesPendingOnCycle&&r!==null}function O0(n,r,o,p){if(xp(r,p))return k("agent.mode.blocked");const w=j0(n,r);return!r.approvesPendingOnCycle||o?w:k("agent.mode.titleBlind",{title:w})}const B0={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 F0(n){return k(B0[n])}function H0(){return k("agent.statusLine.noFragment")}function $0(n,r){return n.filter(o=>r||o.id!=="plans")}function U0(n,r){return n==="plans"&&!r?"cli":n}function W0(n,r,o){const p=w=>w===null?void 0:r.find(A=>A.id===w);return p(n)??p(o)??r[0]??null}function z0(n){return[{keys:"Enter",description:k("agent.shortcuts.composer.send")},{keys:"Shift + Enter",description:k("agent.shortcuts.composer.newline")},{keys:"Ctrl + V",description:k(n?"agent.shortcuts.composer.pasteWithImages":"agent.shortcuts.composer.pasteText")},{keys:"Esc",description:k("agent.shortcuts.interruptCli")}]}function V0(){return k("agent.composer.imagesRefused")}function q0(n,r,o){return o??(n==="token-count"||n==="status-line"?r.contextWindow:null)}function K0(n,r){return n==="status-line"?r.lastRequestTokens>0:r.assistantMessages>0}function G0(n,r){return n===null&&r!==null&&r.state!=="active"}function Y0(n){return k(n==="other-command"?"agent.meter.setup.otherCommand":n==="disabled"?"agent.meter.setup.disabled":n==="unreadable"?"agent.meter.setup.unreadable":"agent.meter.setup.missing")}function X0(n,r){return r.contextWindowEstimated?k("agent.meter.origin.estimated"):n==="usage-with-catalog"&&r.contextWindow!==null?k("agent.meter.origin.catalog"):null}function Q0(n,r=null){return r==="status-line"?k("agent.meter.idle.statusLine"):n===null?k("agent.meter.idle.noFile"):k("agent.meter.idle.withFile",{file:n})}function J0(n,r=null){return n==="idle"?k("agent.dot.idle"):n==="unknown"?r===null?k("agent.dot.noStatus"):r.state==="active"?k("agent.dot.statusLinePending"):k("agent.dot.statusLineOnly"):k("agent.dot.open")}function Od(n,r){return n.length===0?!0:n.some(o=>o.id===r&&o.available&&o.capabilities.resume)}function Z0(n,r,o){return n?o?k("agent.note.empty"):k("agent.note.send",{cwd:r??""}):k(r===null?"agent.note.needsTab":"agent.note.noReadySignal")}function kp(n,r,o){const p=Vs(r,o);let w=null;for(const A of n)A.kind!=="agent"||A.agent===null||Vs(A.cwd,o)===p&&(w=A.agent);return w}function Ep(n,r){var p;const o=r.filter(w=>w.available);for(const w of n)if(w!==null&&o.some(A=>A.id===w))return w;return((p=o[0])==null?void 0:p.id)??null}function ey(n){let r=null;for(const o of n){const p=o.agent;Vi(p)&&(r===null||o.updatedAt>r.updatedAt)&&(r={agent:p,updatedAt:o.updatedAt})}return(r==null?void 0:r.agent)??null}function ty(n,r,o,p,w){return Ep([kp(n,r,o),w],p)}function ny(n,r,o,p,w){return Ep([kp(n,r.cwd,o),ey(r.sessions),w],p)}function Lp(n){return n.filter(r=>r.available)}function ry(n,r){const o=n.findIndex(p=>p.id===r);return o===-1?0:o}function sy(n,r,o){return o<=0?0:((n+r)%o+o)%o}function iy(n,r,o,p=4){const w=n.bottom+2,A=n.top-2-r.height,L=w+r.height+p<=o.height||A<p?Math.max(p,Math.min(w,o.height-r.height-p)):A;return{left:Math.max(p,Math.min(n.left,o.width-r.width-p)),top:L}}function oy(n,r,o){const p=n;return p===null||typeof p!="object"||typeof p.contains!="function"?!0:o!==null&&o.contains(n)?!1:p.contains(r)}function Tp(n,r,o=!1){return r===null||o||!Vc(n)?[]:Lp(n).filter(p=>p.id!==r)}function ay(){return k("agent.continue.title")}function ly(n,r,o){return r?k("agent.continue.discovering"):n.length===0?k("agent.continue.noConversation"):o?null:k("agent.continue.noMessages")}function cy(n,r,o,p){const w=r>=o&&!p?o===1?k("agent.handoff.turns.single"):k("agent.handoff.turns.all",{count:o}):r===1?p?k("agent.handoff.turns.lastOneOfMore",{total:o}):k("agent.handoff.turns.lastOne",{total:o}):p?k("agent.handoff.turns.lastManyOfMore",{count:o,included:r}):k("agent.handoff.turns.lastMany",{count:o,included:r});return k("agent.handoff.notice",{label:n,turns:w})}const Bd=40;function Fd(n){const r=n.replace(/\s+/g," ").trim(),o=[...r],p=o.length>Bd?`${o.slice(0,Bd).join("").trimEnd()}…`:r;return p.length>0?k("agent.handoff.tabLabel",{title:p}):k("agent.handoff.tabLabelNoTitle")}function uy(){return k("agent.handoff.sending")}function hy(n){switch(n){case"no-delivery":return k("agent.handoff.prefill.noDelivery");case"not-ready":return k("agent.handoff.prefill.notReady");case"send-failed":return k("agent.handoff.prefill.sendFailed")}}function Hd(n,r){return n.trim().length===0?r:`${r}
42
-
43
- ${n}`}function dy(n,r){return n&&r!==null}function fy(n,r,o){if(!Vi(n))return{badge:!0,unavailableTitle:null};const p=r.find(L=>L.id===n),w=r.some(L=>L.available),A=p!==void 0&&!p.available&&w;return{badge:o||A,unavailableTitle:A?k("agent.session.cliMissing",{label:p.label}):null}}function py(n,r,o){return n!==null&&r===""&&!o.sessionIdAtLaunch}function my(){return k("agent.thread.noTranscript")}function gy(){return k("agent.thread.discovering")}function _y(n,r,o,p,w=null){return!p||!ep(n,w)||!r?null:o===null?k("agent.openTool.noLabel"):k("agent.openTool.withLabel",{label:o})}function Rp(n,r=!1){return k(n==="permission prompt"?"agent.waiting.permission":n==="question"&&r?"agent.waiting.question":"agent.waiting.answer")}function vy(n){return n.relaunching?"relaunching":n.offlineReason==="server-closed"&&n.alive?"offer":null}function yy(n){return n===null?k("agent.serverClosed.noLabel"):k("agent.serverClosed.withLabel",{label:n})}function wy(){return k("agent.serverClosed.relaunch")}function by(){return k("agent.serverClosed.relaunching")}function Sy(n,r){const o=new Map,p=[];for(const[w,A]of n){const L=r.find(s=>s.terminalId===w);L===void 0||L.alive&&A==="exited"?p.push(w):o.set(w,L.alive?A:"exited")}return{phases:o,finished:p}}function Cy(n,r,o){var p;return!o||r===null||((p=n.permissionCycle)==null?void 0:p.approvesPendingOnCycle)!==!0&&!n.waitingBlocksSubmit?null:Rp(r,n.questionCards)}const xy=2e4;function ky(n){if(n.label.length>0)return n.label;const r=n.cwd.split(/[\\/]/).filter(o=>o.length>0);return r[r.length-1]??n.cwd}function Ey(n,r,o){const p=n.map(A=>({terminalId:A.terminalId,kind:A.kind,cwd:A.cwd})),w=[];for(const A of r){const L=a0(p.map(s=>s.terminalId),s=>p.find(c=>c.terminalId===s),{cwd:A.cwd},o);w.push({pending:A,index:L,label:ky(A)}),p.splice(L,0,{terminalId:`pending:${A.requestId}`,kind:"agent",cwd:A.cwd})}return w}function $d(n,r,o){const p=Vs(r,o);return n.some(w=>Vs(w.cwd,o)===p)}function Mp(){return k("agent.openBlocked")}const Ly={low:"controls.effort.low",medium:"controls.effort.medium",high:"controls.effort.high",xhigh:"controls.effort.xhigh",max:"controls.effort.max"};function Ty(n){const r=Ly[n.value];return r===void 0?n.label:k(r)}function Ry(n){return n.value==="default"?k("controls.model.default"):Y_(n)}function My({models:n,efforts:r,model:o,effort:p,modelProvisional:w=!1,effortProvisional:A=!1,savesChoice:L=!1,disabled:s,onCommand:c}){const m=n===null?null:A0(n,o),_=m===null&&o!==null;return l.jsxs(l.Fragment,{children:[n!==null&&l.jsxs("select",{className:"agent-select",value:(m==null?void 0:m.value)??"",disabled:s,onChange:u=>{u.target.value.length>0&&c(J_(u.target.value))},title:o===null?k("controls.model.noData"):w?k("controls.model.provisional",{model:o}):L?k("controls.model.inUseSaved",{model:o}):k("controls.model.inUse",{model:o}),children:[m===null&&l.jsx("option",{value:"",children:_?o??"":k("controls.model.placeholder")}),n.map(u=>l.jsx("option",{value:u.value,children:Ry(u)},u.value))]}),r!==null&&l.jsxs("select",{className:"agent-select",value:p??"",disabled:s,onChange:u=>{u.target.value.length>0&&c(Z_(u.target.value))},title:p===null?k("controls.effort.noData"):A?k("controls.effort.provisional",{effort:p}):L?k("controls.effort.inUseSaved",{effort:p}):k("controls.effort.inUse",{effort:p}),children:[p===null&&l.jsx("option",{value:"",children:k("controls.effort.placeholder")}),r.map(u=>l.jsx("option",{value:u.value,children:Ty(u)},u.value))]})]})}function Ay({mode:n,cycle:r,disabled:o,waitingFor:p=null,statusKnown:w=!0,onChange:A}){const L=N0(n,r);return l.jsx("select",{className:"agent-select agent-select-mode",value:L,disabled:o||xp(r,p),onChange:s=>{$s(s.target.value)&&A(s.target.value)},title:O0(L,r,w,p),children:r.modes.map(s=>l.jsx("option",{value:s,children:Cp(s)},s))})}function da(n){const r=n.replace(/(\r?\n)+$/,"");return r.length===0?0:r.split(`
44
- `).length}function Ny(n,r){return r===0?k("composer.chip.pastedTextEmpty",{number:n}):k("composer.chip.pastedText",{number:n,count:r})}function Dy(n){return n.length===0?1:Math.max(...n)+1}function Iy(n){const r=new Set;for(const o of n.matchAll(d0()))r.add(Number(o[1]));return[...r].sort((o,p)=>o-p)}const Py=/[^\s([{"'¿¡«]/u,jy=/[\p{L}\p{N}]/u;function Oy(n,r,o,p){const{start:w,end:A,before:L,after:s}=Ap(n,r,o),c=`${L!==""&&Py.test(L)?" ":""}${mp(p)}${s!==""&&jy.test(s)?" ":""}`;return Np(n,w,A,c)}const By=/[^\s([{¿¡«]/u,Fy=/[\p{L}\p{N}"'«]/u;function Ud(n,r,o,p){const{start:w,end:A,before:L,after:s}=Ap(n,r,o),c=L!==""&&By.test(L),m=s===""||Fy.test(s),_=`${c?" ":""}${p}${m?" ":""}`;return Np(n,w,A,_)}function Ap(n,r,o){const p=Math.max(0,Math.min(r,n.length)),w=Math.max(p,Math.min(o,n.length));return{start:p,end:w,before:p>0?n.charAt(p-1):"",after:w<n.length?n.charAt(w):""}}function Np(n,r,o,p){return{text:`${n.slice(0,r)}${p}${n.slice(o)}`,inserted:p,caret:r+p.length}}function Dp(n,r){const o=new RegExp(`( ?)${Uy(mp(r))}( ?)`,"g");return n.replace(o,(p,w,A)=>w!==""&&A!==""?" ":"")}function Hy(n,r){let o=r;const p=[];for(const w of n){const A=w.text.replace(/\r\n?/g,`
45
- `).replace(/\n+$/,"");if(A.trim().length===0){o=Dp(o,w.number);continue}p.push(`${l0(w.number)}
46
- ${A}
47
- ${c0(w.number)}`)}return o.trim().length>0&&p.push(o),p.join(`
48
-
49
- `)}function $y(n,r=!1){const o=n.replace(/\r\n?/g,`
50
- `),p=[],w=c=>{const m=c.replace(/^\n+|\n+$/g,"");m.trim().length>0&&p.push({kind:"text",text:m})};let A=0;for(const c of o.matchAll(u0())){const m=c[1]??"",_=(c.index??0)+m.length;w(o.slice(A,_)),p.push({kind:"pasted",number:Number(c[2]),text:c[3]??"",complete:!0}),A=(c.index??0)+c[0].length}const L=o.slice(A),s=r?h0().exec(L):null;if(s!==null){const c=s.index+(s[1]??"").length;w(L.slice(0,c)),p.push({kind:"pasted",number:Number(s[2]),text:L.slice(s.index+s[0].length),complete:!1})}else w(L);return p.some(c=>c.kind==="pasted")?p:[{kind:"text",text:n}]}function Uy(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const Wy=800;function Ip(n){return{text:n.text,pasted:n.items.flatMap(r=>r.kind==="text"?[{number:r.number,text:r.text}]:[])}}function zy(n,r){return{text:n.text,items:n.pasted.map(o=>({id:r(),kind:"text",number:o.number,text:o.text,lines:da(o.text)}))}}function Vy(n){return ap(Ip(n))>op}function Wd(n,r){return n===void 0||Lc(n)?Lc(r):lp(n,r)}function qy(n){return n===void 0||n.text.trim().length===0&&n.items.length===0}const Ky={text:"",pasted:[]};class Gy{constructor(r){Mt(this,"local",new Map);Mt(this,"saved",new Map);Mt(this,"touched",new Set);Mt(this,"pending",new Map);Mt(this,"listeners",new Set);Mt(this,"serverKeeps",!1);this.deps=r}get(r){return this.local.get(r)}put(r,o){this.local.set(r,o),this.schedule(r,Ip(o))}submitted(r){this.cancel(r),this.local.delete(r),this.saved.delete(r),this.touched.add(r)}restore(r){this.serverKeeps=!0;const o=[];for(const{terminalId:p,draft:w}of r)this.touched.has(p)||(this.saved.set(p,w),qy(this.local.get(p))&&(this.local.set(p,zy(w,this.deps.newId)),o.push(p)));for(const p of o)for(const w of this.listeners)w(p);for(const[p,w]of[...this.pending])w.handle===null&&this.sendNow(p)}reconnected(){this.serverKeeps=!1}retain(r){const o=new Set(r);for(const p of new Set([...this.local.keys(),...this.saved.keys(),...this.touched,...this.pending.keys()]))o.has(p)||(this.cancel(p),this.local.delete(p),this.saved.delete(p),this.touched.delete(p))}flushAll(){for(const r of[...this.pending.keys()])this.sendNow(r)}onRestored(r){return this.listeners.add(r),()=>this.listeners.delete(r)}schedule(r,o){const p=this.pending.get(r);if(p!==void 0&&lp(p.draft,o)||(this.cancel(r),Wd(this.saved.get(r),o)))return;this.touched.add(r);const w=this.deps.setTimer(()=>this.sendNow(r),this.deps.delayMs??Wy);this.pending.set(r,{handle:w,draft:o})}cancel(r){const o=this.pending.get(r);o!==void 0&&(o.handle!==null&&this.deps.clearTimer(o.handle),this.pending.delete(r))}sendNow(r){const o=this.pending.get(r);if(o===void 0)return;if(o.handle!==null&&this.deps.clearTimer(o.handle),!this.serverKeeps||!this.deps.connected()){this.pending.set(r,{handle:null,draft:o.draft});return}this.pending.delete(r);const p=ap(o.draft)>op?Ky:o.draft;Wd(this.saved.get(r),p)||(this.deps.send(r,p),Lc(p)?this.saved.delete(r):this.saved.set(r,p))}}const Ic=1024,Pc=Ic*1024,zd=Pc*1024;function Hs(n,r=0){return new Intl.NumberFormat(ga(),{minimumFractionDigits:r,maximumFractionDigits:r,useGrouping:!1}).format(n)}function nn(n){return!Number.isFinite(n)||n<Ic?k("format.bytes.b",{value:Hs(Math.max(0,Math.round(n)||0))}):n<Pc?k("format.bytes.kb",{value:Hs(Math.round(n/Ic))}):n<zd?k("format.bytes.mb",{value:Hs(n/Pc,1)}):k("format.bytes.gb",{value:Hs(n/zd,2)})}function Pp(n){const r=Math.floor(n/60),o=n%60;return o===0?k("format.duration.minutes",{value:r}):k("format.duration.minutesSeconds",{minutes:r,seconds:o})}function Yy(n){if(n<1e3)return k("format.duration.ms",{value:n});const r=Math.round(n/1e3);return r<60?k("format.duration.seconds",{value:r}):Pp(r)}function $i(n){if(!Number.isFinite(n)||n<1e3)return k("format.duration.underSecond");const r=Math.round(n/1e3);return r<60?k("format.duration.seconds",{value:r}):Pp(r)}function Fn(n,r=Date.now()){if(n<=0)return"";const o=Math.floor((r-n)/6e4);if(o<1)return k("time.justNow");if(o<60)return k("time.minutesAgo",{count:o});const p=Math.floor(o/60);if(p<24)return k("time.hoursAgo",{count:p});const w=Math.floor(p/24);return w<30?k("time.daysAgo",{count:w}):Xy(n)}function Xy(n){return new Date(n).toLocaleDateString(ga())}function jp(n){return new Date(n).toLocaleTimeString(ga(),{hour:"2-digit",minute:"2-digit"})}function Yc(n){return new Intl.ListFormat(ga(),{type:"conjunction"}).format(n)}var Op=Zf();function Bp({src:n,caption:r,onClose:o}){return O.useEffect(()=>{const p=w=>{w.key==="Escape"&&(w.preventDefault(),w.stopPropagation(),o())};return window.addEventListener("keydown",p,!0),()=>window.removeEventListener("keydown",p,!0)},[o]),Op.createPortal(l.jsxs("div",{className:"viewer",onClick:o,role:"presentation",children:[l.jsx("div",{className:"viewer-frame",onClick:p=>p.stopPropagation(),children:l.jsx("img",{className:"viewer-image",src:n,alt:r})}),l.jsxs("div",{className:"viewer-bar",children:[l.jsx("span",{className:"viewer-caption",children:r}),l.jsx("button",{className:"viewer-close",onClick:o,title:k("common.closeEsc"),children:"×"})]})]}),document.body)}const Qy=768,Jy=`(max-width: ${Qy}px)`,Zy="(hover: none)",Vd="agent-workbench.narrow-view",Fp="tab",Hp=["chat","cli","git","files","plans","memory","notes","console"];function ew(n){return typeof n=="string"&&Hp.includes(n)}function tw(n){return ew(n)?n:null}function nw(n){return n.hasTab?Hp.filter(r=>r!=="plans"||n.plansAvailable):["chat","notes"]}function rw(n,r){return r.includes(n)?n:"chat"}function qd(n){switch(n){case"cli":case"git":case"files":case"plans":case"memory":return n;default:return null}}const sw={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 iw(n){return sw[n]}const ow=/^[A-Za-z0-9_-]{1,80}$/;function aw(n){const r=new URLSearchParams(n).get(Fp);return r!==null&&ow.test(r)?r:null}function lw(n,r){const o=new URLSearchParams(n);for(const w of r)o.delete(w);const p=o.toString();return p.length>0?`?${p}`:""}const cw=[{id:"esc",label:"Esc",data:"\x1B",titleKey:"narrow.keys.esc"},{id:"tab",label:"Tab",data:" ",titleKey:"narrow.keys.tab"},{id:"shift-tab",label:"⇧Tab",data:"\x1B[Z",titleKey:"narrow.keys.shiftTab"},{id:"up",label:"↑",data:"\x1B[A",titleKey:"narrow.keys.up"},{id:"down",label:"↓",data:"\x1B[B",titleKey:"narrow.keys.down"},{id:"left",label:"←",data:"\x1B[D",titleKey:"narrow.keys.left"},{id:"right",label:"→",data:"\x1B[C",titleKey:"narrow.keys.right"},{id:"interrupt",label:"^C",data:"",titleKey:"narrow.keys.interrupt"},{id:"ctrl-o",label:"^O",data:"",titleKey:"narrow.keys.ctrlO"},{id:"ctrl-x",label:"^X",data:"",titleKey:"narrow.keys.ctrlX"}];function uw(n,r){return n.shiftKey||n.altKey?!1:!r||n.ctrlKey||n.metaKey}const hw="AgentWorkbenchAndroid/",dw="agentworkbench://settings",fw="agentworkbench://disconnect",Kd="agentWorkbenchBack";function $p(n){return n.includes(hw)}function pw(n){return n.dialogOpen?"close-dialog":n.sheetOpen?"close-sheet":n.drawerOpen?"close-drawer":n.view!=="chat"?"show-chat":null}const mw=6e4,gw=10*6e4,_w=15e3,vw=4e3,yw=3,Up={runStartedAt:null,busySeenAt:null};function ww(){return`submit-${typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}`}function bw(n,r){var p;let o=0;if(n!==null){const w=r.findIndex(A=>A.eventId===n);if(w===-1)return!0;o=w+1}for(let w=o;w<r.length;w+=1)if(((p=r[w])==null?void 0:p.role)==="assistant")return!0;return!1}function Sw(n,r,o,p){const w=r==="busy"||n==="busy"?p:o.busySeenAt;let A=null;return r==="busy"?n==="idle"?A=p:(n==="busy"||n==="waiting")&&(A=o.runStartedAt):r==="waiting"&&(A=o.runStartedAt),{runStartedAt:A,busySeenAt:w}}function Cw(n,r,o,p){const w=new Map;for(const[A,L]of r){const s=n.get(A),c=o.get(A);w.set(A,c!==void 0&&s===L?c:Sw(s,L,c??Up,p))}return w}function xw(n,r){const o=new Map;for(const[p,w]of n)w.phase!=="sending"?o.set(p,w):w.queued&&o.set(p,{...w,queued:!1,sentAt:r});return o}function kw(n,r,o){const p=n.get(r.terminalId);if(p===void 0||p.requestId!==r.requestId)return n;const w=new Map(n);return r.delivered?w.set(r.terminalId,{...p,phase:"delivered",queued:!1,deliveredAt:o}):w.delete(r.terminalId),w}function Ew(n){if(!n.live||n.waitingFor!==null)return null;const{receipt:r,activity:o,now:p}=n,w=n.clock??Up;if((r==null?void 0:r.phase)==="sending"&&(r.queued||p-r.sentAt<mw))return{kind:"sending"};const A=(r==null?void 0:r.phase)==="delivered"?r.deliveredAt:null;return o==="busy"?{kind:"working",since:w.runStartedAt,justDelivered:A!==null&&p-A<vw}:r===null||A===null||bw(r.afterEventId,n.events)?null:o==="unknown"?p-A<gw?{kind:"awaiting-reply",since:A}:null:o!=="idle"&&o!==null||w.busySeenAt!==null&&w.busySeenAt>=r.sentAt?null:p-A<_w?{kind:"delivered"}:null}function Lw(n,r){switch(n.kind){case"sending":return k("thread.status.sending");case"delivered":return k("thread.status.delivered");case"working":{const o=n.since===null?0:r-n.since;if(o<1e3)return n.justDelivered?k("thread.status.workingDelivered"):k("thread.status.working");const p={elapsed:$i(o)};return n.justDelivered?k("thread.status.workingForDelivered",p):k("thread.status.workingFor",p)}case"awaiting-reply":{const o=r-n.since;return o<1e3?k("thread.status.delivered"):k("thread.status.awaitingReply",{elapsed:$i(o)})}}}function Tw(n,r){const o=n.slice(0,yw).map(w=>k("thread.status.subagent",{name:w.description.length>0?w.description:k("thread.status.subagentUnnamed"),elapsed:$i(Math.max(0,r-w.startedAt))})),p=n.length-o.length;return p>0&&o.push(k("thread.status.subagentsMore",{count:p})),k("thread.status.subagents",{count:n.length,list:Yc(o)})}const Rw=5,Mw=1200;function ac(){return crypto.randomUUID()}function Aw(n=!0){const[r,o]=O.useState([]),[p,w]=O.useState(null),A=O.useCallback(E=>{if(r.filter(a=>a.kind==="image").length>=sc){w(k("composer.problem.tooManyImages",{count:sc}));return}if(E.size>ha){const a=Math.round(E.size/1024/1024),f=ha/1024/1024;w(E.name.length>0?k("composer.problem.tooBig",{name:E.name,size:a,max:f}):k("composer.problem.imageTooBig",{size:a,max:f}));return}const g=new FileReader;g.onload=()=>{const a=g.result;if(typeof a!="string")return;const f=a.indexOf(",");f!==-1&&o(d=>d.filter(h=>h.kind==="image").length>=sc?d:[...d,{id:ac(),kind:"image",mediaType:E.type,base64:a.slice(f+1),dataUrl:a,bytes:E.size,name:E.name.length>0?E.name:k("composer.pastedImage")}])},g.onerror=()=>w(k("composer.problem.imageUnreadable")),g.readAsDataURL(E)},[r]),L=O.useCallback(E=>{if(r.filter(a=>a.kind==="file").length>=ic){w(k("composer.problem.tooManyFiles",{count:ic}));return}if(E.size===0){w(k("composer.problem.empty",{name:E.name}));return}if(E.size>Rd){w(k("composer.problem.tooBig",{name:E.name,size:Math.round(E.size/1024/1024),max:Rd/1024/1024}));return}const g=new FileReader;g.onload=()=>{const a=g.result;if(typeof a!="string")return;const f=a.indexOf(",");f!==-1&&o(d=>d.filter(h=>h.kind==="file").length>=ic?d:[...d,{id:ac(),kind:"file",name:E.name.length>0?E.name:"archivo",base64:a.slice(f+1),bytes:E.size}])},g.onerror=()=>w(k("composer.problem.unreadable",{name:E.name})),g.readAsDataURL(E)},[r]),s=O.useCallback(E=>{const g=Array.from(E),a=g.filter(d=>d.type.startsWith("image/")),f=g.filter(d=>!d.type.startsWith("image/"));if(a.length>0&&!n)w(V0());else for(const d of a)A(d);for(const d of f)L(d)},[A,L,n]),c=O.useCallback((E,g=[])=>{if(E.files.length>0)return s(E.files),{consumed:!0,pastedNumber:null};const a=E.getData("text/plain");if(a.length===0)return{consumed:!1,pastedNumber:null};if(a.split(`
51
- `).length<Rw&&a.length<Mw)return{consumed:!1,pastedNumber:null};const f=Dy([...r.flatMap(d=>d.kind==="text"?[d.number]:[]),...g]);return o(d=>[...d,{id:ac(),kind:"text",number:f,text:a,lines:da(a)}]),{consumed:!0,pastedNumber:f}},[s,r]),m=O.useCallback(E=>{o(g=>g.filter(a=>a.id!==E))},[]),_=O.useCallback((E,g)=>{o(a=>a.map(f=>f.id===E&&f.kind==="text"?{...f,text:g,lines:da(g)}:f))},[]),u=O.useCallback(E=>{o(E),w(null)},[]),y=O.useCallback(()=>u([]),[u]),S=O.useCallback(()=>w(null),[]);return{items:r,problem:p,acceptPaste:c,acceptFiles:s,remove:m,updateText:_,replace:u,clear:y,dismissProblem:S}}function ca({min:n,max:r,value:o,measure:p,onChange:w,onCommit:A,onStart:L}){const s=O.useRef(!1),c=O.useRef(o),m=O.useCallback(y=>{s.current=!0,c.current=o,L==null||L(y),y.currentTarget.setPointerCapture(y.pointerId),y.preventDefault()},[L,o]),_=O.useCallback(y=>{if(!s.current)return;const S=Math.min(r,Math.max(n,p(y)));c.current=S,w(S)},[r,n,p,w]),u=O.useCallback(y=>{s.current&&(s.current=!1,y.currentTarget.releasePointerCapture(y.pointerId),A(c.current))},[A]);return{onPointerDown:m,onPointerMove:_,onPointerUp:u,onPointerCancel:u}}function Wp(n){const[r,o]=O.useState(()=>typeof window<"u"&&window.matchMedia(n).matches);return O.useEffect(()=>{const p=window.matchMedia(n),w=()=>o(p.matches);return w(),p.addEventListener("change",w),()=>p.removeEventListener("change",w)},[n]),r}function Nw(){return Wp(Jy)}function Dw(){return Wp(Zy)}const zp="agent_workbench_prefs",jc="agent-workbench.",Vp=/^[a-z0-9][a-z0-9.-]{0,59}$/,qp=200,Iw=400*24*60*60,Pw=3500;function jw(n){const r=new Map;for(const o of n.split(";")){const p=o.indexOf("=");if(p===-1||o.slice(0,p).trim()!==zp)continue;let w;try{w=JSON.parse(decodeURIComponent(o.slice(p+1).trim()))}catch{return r}if(w===null||typeof w!="object"||Array.isArray(w))return r;for(const[A,L]of Object.entries(w))!Vp.test(A)||typeof L!="string"||L.length>qp||r.set(`${jc}${A}`,L);return r}return r}function Ow(n){const r={};for(const[p,w]of n){if(!p.startsWith(jc))continue;const A=p.slice(jc.length);!Vp.test(A)||w.length>qp||(r[A]=w)}const o=encodeURIComponent(JSON.stringify(r));return o.length>Pw?null:o}function Bw(n){return`${zp}=${n}; Path=/; Max-Age=${Iw}; SameSite=Strict`}function Kp(){try{return jw(document.cookie)}catch{return new Map}}function Gp(n,r){const o=Kp();if(o.get(n)===r)return;o.set(n,r);const p=Ow(o);if(p!==null)try{document.cookie=Bw(p)}catch{}}function bt(n,r,o){const p=Kp().get(n);if(p!==void 0){const w=o(p);if(w!==null)return w}try{const w=window.localStorage.getItem(n);if(w===null)return r;const A=o(w);return A===null?r:(p===void 0&&Gp(n,w),A)}catch{return r}}function ft(n,r){Gp(n,r);try{window.localStorage.setItem(n,r)}catch{}}function Fw(n,r,o){const p=Number.parseInt(n,10);return Number.isFinite(p)&&p>=r&&p<=o?p:null}const Gd=90,Hw=260,Yd=720,Xd="agent-workbench.composer-height";function $w({connection:n,drafts:r,terminalId:o,alive:p,sleeping:w=!1,projectColor:A,activity:L,controls:s,leading:c,imagesAllowed:m=!0,blockedReason:_=null,prefills:u,onPrefillApplied:y,notice:S=null,onDismissNotice:E,onSubmitted:g,fontSize:a,insertRef:f}){const[d,h]=O.useState(""),[C,D]=O.useState(!1),x=Aw(m),M=O.useRef(null),b=Dw(),[T,N]=O.useState(()=>bt(Xd,Hw,le=>Fw(le,Gd,Yd))),[F,P]=O.useState(!1),B=O.useCallback(()=>{const le=M.current;if(le===null)return;le.style.height="auto";const we=le.offsetHeight-le.clientHeight,me=le.scrollHeight+we,Qe=F?T:Math.min(me,T);le.style.height=`${Qe}px`,le.style.overflowY=me>Qe?"auto":"hidden"},[T,F]);O.useEffect(B,[d,B,a]);const H=O.useRef(0),q=O.useRef(0),X=ca({min:Gd,max:Yd,value:T,measure:O.useCallback(le=>H.current-le.clientY-q.current,[]),onChange:N,onCommit:O.useCallback(le=>{P(!1),ft(Xd,String(le))},[]),onStart:O.useCallback(le=>{const we=M.current,me=we==null?void 0:we.getBoundingClientRect();H.current=(me==null?void 0:me.bottom)??le.clientY,q.current=((me==null?void 0:me.bottom)??le.clientY)-le.clientY-((me==null?void 0:me.height)??0),P(!0)},[])}),G=O.useRef(null),Y=O.useRef(d);Y.current=d;const j=O.useRef(x.items);j.current=x.items;const{replace:U}=x;O.useEffect(()=>{const le=G.current;le!==null&&r.put(le,{text:d,items:x.items})},[d,x.items,r]),O.useEffect(()=>{var me;const le=G.current;if(le===o)return;G.current=o,le!==null&&r.put(le,{text:Y.current,items:j.current});const we=o===null?void 0:r.get(o);h((we==null?void 0:we.text)??""),U((we==null?void 0:we.items)??[]),o!==null&&((me=M.current)==null||me.focus())},[o,U,r]),O.useEffect(()=>()=>{const le=G.current;le!==null&&r.put(le,{text:Y.current,items:j.current})},[r]),O.useEffect(()=>r.onRestored(le=>{if(le!==G.current)return;const we=r.get(le);we!==void 0&&(h(we.text),U(we.items))}),[r,U]);const $=O.useRef(new Set);O.useEffect(()=>{if(!(u===void 0||u.length===0)){for(const le of u)if(!$.current.has(le.id)){if($.current.add(le.id),le.terminalId===G.current)h(we=>Hd(we,le.text));else{const we=r.get(le.terminalId);r.put(le.terminalId,{text:Hd((we==null?void 0:we.text)??"",le.text),items:(we==null?void 0:we.items)??[]})}y==null||y(le.id)}}},[u,y,r]);const V=O.useCallback(()=>{if(o===null||_!==null)return;const le=x.items.filter(Te=>Te.kind==="text").map(Te=>({number:Te.number,text:Te.text})),we=x.items.filter(Te=>Te.kind==="image").map(Te=>({mediaType:Te.mediaType,data:Te.base64})),me=x.items.filter(Te=>Te.kind==="file").map(Te=>({name:Te.name,data:Te.base64})),Qe=Hy(le,d);if(Qe.length===0&&we.length===0&&me.length===0)return;const nt=ww(),De=n.send({type:"agent.submit",terminalId:o,text:Qe,images:we,...me.length>0?{files:me}:{},requestId:nt});r.submitted(o),h(""),x.clear(),g==null||g(o,nt,!De)},[n,r,o,d,x,_,g]),ne=O.useCallback(()=>{o!==null&&n.send({type:"agent.interrupt",terminalId:o})},[n,o]),se=O.useCallback(le=>{if(le.key==="Enter"&&uw(le,b)){le.preventDefault(),V();return}le.key==="Escape"&&(le.preventDefault(),ne())},[V,ne,b]),ce=O.useCallback((le,we)=>{const{inserted:me}=Oy(le.value,le.selectionStart,le.selectionEnd,we);let Qe=!1;try{Qe=document.execCommand("insertText",!1,me)}catch{Qe=!1}Qe||(le.setRangeText(me,le.selectionStart,le.selectionEnd,"end"),h(le.value))},[]),he=O.useCallback((le,we)=>{const me=M.current;if(me===null||me.disabled){h(De=>Ud(De,De.length,De.length,le).text);return}const{inserted:Qe}=Ud(me.value,me.selectionStart,me.selectionEnd,le);let nt=!1;if(we){me.focus();try{nt=document.execCommand("insertText",!1,Qe)}catch{nt=!1}}nt||(me.setRangeText(Qe,me.selectionStart,me.selectionEnd,"end"),h(me.value))},[]);O.useEffect(()=>{if(f!==void 0)return f.current=he,()=>{f.current===he&&(f.current=null)}},[f,he]);const K=O.useCallback(le=>{if(le.clipboardData===null)return;const we=x.acceptPaste(le.clipboardData,Iy(le.currentTarget.value));we.consumed&&(le.preventDefault(),we.pastedNumber!==null&&ce(le.currentTarget,we.pastedNumber))},[x,ce]),W=O.useCallback(le=>{x.remove(le.id),le.kind==="text"&&h(we=>Dp(we,le.number))},[x]),J=O.useRef(null),Z=o===null||!p,de=d.trim().length>0||x.items.some(le=>le.kind!=="text"||le.text.trim().length>0),ee=p&&L!=="idle",xe=de||!ee,ke=Vy({text:d,items:x.items});return l.jsxs("div",{className:`composer${C?" composer-dragging":""}`,style:A===void 0?void 0:{"--composer-accent":A},onDragOver:le=>{Array.from(le.dataTransfer.types).includes("Files")&&(le.preventDefault(),D(!0))},onDragLeave:()=>D(!1),onDrop:le=>{le.preventDefault(),D(!1),x.acceptFiles(le.dataTransfer.files)},children:[l.jsx("div",{className:"hdivider composer-divider",...X,title:k("composer.resizeTitle")}),S!==null&&l.jsxs("div",{className:"handoff-notice",role:"status",children:[l.jsxs("span",{className:"handoff-notice-text",children:[S.text,S.status!==null&&l.jsx("span",{className:"handoff-notice-status",children:S.status})]}),E!==void 0&&l.jsx("button",{className:"icon-button",onClick:E,title:k("common.dismissNotice"),children:"×"})]}),x.problem!==null&&l.jsxs("div",{className:"composer-problem",children:[l.jsx("span",{children:x.problem}),l.jsx("button",{className:"icon-button",onClick:x.dismissProblem,title:k("common.close"),children:"×"})]}),ke&&l.jsx("div",{className:"composer-problem",role:"status",children:l.jsx("span",{children:k("composer.problem.draftTooLong")})}),x.items.length>0&&l.jsx("div",{className:"composer-chips",children:x.items.map(le=>l.jsx(Uw,{item:le,onRemove:()=>W(le),onEdit:we=>x.updateText(le.id,we),onDoneEditing:()=>{var we;return(we=M.current)==null?void 0:we.focus()}},le.id))}),l.jsxs("div",{className:`composer-field${ee&&xe?" composer-field-two":""}`,children:[l.jsx("textarea",{ref:M,className:"composer-input",value:d,rows:1,placeholder:k(Z?w?"composer.placeholder.sleeping":"composer.placeholder.ended":"composer.placeholder.ready"),disabled:Z,onChange:le=>h(le.target.value),onKeyDown:se,onPaste:K,spellCheck:!1}),l.jsxs("div",{className:"composer-field-actions",children:[ee&&l.jsx("button",{className:"composer-icon composer-stop",onClick:ne,disabled:Z,title:k("composer.stopTitle"),"aria-label":k("composer.stop"),children:l.jsx("svg",{viewBox:"0 0 24 24",width:"14",height:"14","aria-hidden":"true",children:l.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2",fill:"currentColor"})})}),xe&&l.jsx("button",{className:"composer-icon composer-send",onClick:V,disabled:Z||!de||_!==null,title:_??k("composer.sendTitle"),"aria-label":k("composer.send"),children:l.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16","aria-hidden":"true",children:l.jsx("path",{d:"M12 19V5M5.5 11.5 12 5l6.5 6.5",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]}),l.jsxs("div",{className:"composer-bar",children:[l.jsx("input",{ref:J,type:"file",multiple:!0,hidden:!0,onChange:le=>{le.target.files!==null&&x.acceptFiles(le.target.files),le.target.value=""}}),l.jsx("button",{className:"icon-button composer-attach",onClick:()=>{var le;return(le=J.current)==null?void 0:le.click()},disabled:Z,title:k("composer.attachTitle"),"aria-label":k("composer.attach"),children:l.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16","aria-hidden":"true",children:l.jsx("path",{d:"M21.4 11.1 12.3 20.2a6 6 0 0 1-8.5-8.5l9.2-9.2a4 4 0 0 1 5.7 5.7l-9.2 9.2a2 2 0 0 1-2.8-2.8l8.5-8.5",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),c,l.jsx("span",{className:"composer-spacer"}),s]})]})}function Uw({item:n,onRemove:r,onEdit:o,onDoneEditing:p}){const[w,A]=O.useState(!1);if(n.kind==="image"){const L=`${n.name} · ${nn(n.bytes)}`;return l.jsxs("figure",{className:"chip chip-image",title:L,children:[l.jsx("img",{src:n.dataUrl,alt:n.name,onClick:()=>A(!0)}),l.jsx("button",{className:"chip-remove",onClick:r,title:k("composer.chip.remove"),children:"×"}),w&&l.jsx(Bp,{src:n.dataUrl,caption:L,onClose:()=>A(!1)})]})}return n.kind==="file"?l.jsxs("div",{className:"chip chip-text chip-file",title:`${n.name} · ${nn(n.bytes)}`,children:[l.jsxs("span",{className:"chip-toggle chip-file-label",children:[l.jsx("span",{className:"chip-icon",children:"▤"}),l.jsx("span",{className:"chip-file-name",children:n.name}),l.jsx("span",{className:"chip-file-size",children:nn(n.bytes)})]}),l.jsx("button",{className:"chip-remove",onClick:r,title:k("composer.chip.remove"),children:"×"})]}):l.jsxs("div",{className:`chip chip-text${w?" chip-open":""}`,children:[l.jsxs("button",{className:"chip-toggle",onClick:()=>A(L=>!L),title:k("composer.chip.editHint"),"aria-expanded":w,children:[l.jsx("span",{className:"chip-icon",children:"¶"}),Ny(n.number,n.lines),l.jsx("span",{className:"chip-chevron",children:w?"▾":"▸"})]}),l.jsx("button",{className:"chip-remove",onClick:r,title:k("composer.chip.remove"),children:"×"}),w&&l.jsx("textarea",{className:"chip-editor",value:n.text,onChange:L=>o(L.target.value),onKeyDown:L=>{L.key==="Escape"&&(L.preventDefault(),A(!1),p())},"aria-label":k("composer.chip.editorLabel",{number:n.number}),spellCheck:!1,autoFocus:!0})]})}var lc={exports:{}},Qd;function Ww(){return Qd||(Qd=1,(function(n,r){(function(o,p){n.exports=p()})(self,(()=>(()=>{var o={};return(()=>{var p=o;Object.defineProperty(p,"__esModule",{value:!0}),p.FitAddon=void 0,p.FitAddon=class{activate(w){this._terminal=w}dispose(){}fit(){const w=this.proposeDimensions();if(!w||!this._terminal||isNaN(w.cols)||isNaN(w.rows))return;const A=this._terminal._core;this._terminal.rows===w.rows&&this._terminal.cols===w.cols||(A._renderService.clear(),this._terminal.resize(w.cols,w.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const w=this._terminal._core,A=w._renderService.dimensions;if(A.css.cell.width===0||A.css.cell.height===0)return;const L=this._terminal.options.scrollback===0?0:w.viewport.scrollBarWidth,s=window.getComputedStyle(this._terminal.element.parentElement),c=parseInt(s.getPropertyValue("height")),m=Math.max(0,parseInt(s.getPropertyValue("width"))),_=window.getComputedStyle(this._terminal.element),u=c-(parseInt(_.getPropertyValue("padding-top"))+parseInt(_.getPropertyValue("padding-bottom"))),y=m-(parseInt(_.getPropertyValue("padding-right"))+parseInt(_.getPropertyValue("padding-left")))-L;return{cols:Math.max(2,Math.floor(y/A.css.cell.width)),rows:Math.max(1,Math.floor(u/A.css.cell.height))}}}})(),o})()))})(lc)),lc.exports}var zw=Ww(),cc={exports:{}},Jd;function Vw(){return Jd||(Jd=1,(function(n,r){(function(o,p){n.exports=p()})(self,(()=>(()=>{var o={6:(L,s)=>{function c(_){try{const u=new URL(_),y=u.password&&u.username?`${u.protocol}//${u.username}:${u.password}@${u.host}`:u.username?`${u.protocol}//${u.username}@${u.host}`:`${u.protocol}//${u.host}`;return _.toLocaleLowerCase().startsWith(y.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(s,"__esModule",{value:!0}),s.LinkComputer=s.WebLinkProvider=void 0,s.WebLinkProvider=class{constructor(_,u,y,S={}){this._terminal=_,this._regex=u,this._handler=y,this._options=S}provideLinks(_,u){const y=m.computeLink(_,this._regex,this._terminal,this._handler);u(this._addCallbacks(y))}_addCallbacks(_){return _.map((u=>(u.leave=this._options.leave,u.hover=(y,S)=>{if(this._options.hover){const{range:E}=u;this._options.hover(y,S,E)}},u)))}};class m{static computeLink(u,y,S,E){const g=new RegExp(y.source,(y.flags||"")+"g"),[a,f]=m._getWindowedLineStrings(u-1,S),d=a.join("");let h;const C=[];for(;h=g.exec(d);){const D=h[0];if(!c(D))continue;const[x,M]=m._mapStrIdx(S,f,0,h.index),[b,T]=m._mapStrIdx(S,x,M,D.length);if(x===-1||M===-1||b===-1||T===-1)continue;const N={start:{x:M+1,y:x+1},end:{x:T,y:b+1}};C.push({range:N,text:D,activate:E})}return C}static _getWindowedLineStrings(u,y){let S,E=u,g=u,a=0,f="";const d=[];if(S=y.buffer.active.getLine(u)){const h=S.translateToString(!0);if(S.isWrapped&&h[0]!==" "){for(a=0;(S=y.buffer.active.getLine(--E))&&a<2048&&(f=S.translateToString(!0),a+=f.length,d.push(f),S.isWrapped&&f.indexOf(" ")===-1););d.reverse()}for(d.push(h),a=0;(S=y.buffer.active.getLine(++g))&&S.isWrapped&&a<2048&&(f=S.translateToString(!0),a+=f.length,d.push(f),f.indexOf(" ")===-1););}return[d,E]}static _mapStrIdx(u,y,S,E){const g=u.buffer.active,a=g.getNullCell();let f=S;for(;E;){const d=g.getLine(y);if(!d)return[-1,-1];for(let h=f;h<d.length;++h){d.getCell(h,a);const C=a.getChars();if(a.getWidth()&&(E-=C.length||1,h===d.length-1&&C==="")){const D=g.getLine(y+1);D&&D.isWrapped&&(D.getCell(0,a),a.getWidth()===2&&(E+=1))}if(E<0)return[y,h]}y++,f=0}return[y,f]}}s.LinkComputer=m}},p={};function w(L){var s=p[L];if(s!==void 0)return s.exports;var c=p[L]={exports:{}};return o[L](c,c.exports,w),c.exports}var A={};return(()=>{var L=A;Object.defineProperty(L,"__esModule",{value:!0}),L.WebLinksAddon=void 0;const s=w(6),c=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function m(_,u){const y=window.open();if(y){try{y.opener=null}catch{}y.location.href=u}else console.warn("Opening link blocked as opener could not be cleared")}L.WebLinksAddon=class{constructor(_=m,u={}){this._handler=_,this._options=u}activate(_){this._terminal=_;const u=this._options,y=u.urlRegex||c;this._linkProvider=this._terminal.registerLinkProvider(new s.WebLinkProvider(this._terminal,y,this._handler,u))}dispose(){var _;(_=this._linkProvider)==null||_.dispose()}}})(),A})()))})(cc)),cc.exports}var qw=Vw(),uc={exports:{}},Zd;function Kw(){return Zd||(Zd=1,(function(n,r){(function(o,p){n.exports=p()})(self,(()=>(()=>{var o={965:(L,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.GlyphRenderer=void 0;const m=c(374),_=c(509),u=c(855),y=c(859),S=c(381),E=11,g=E*Float32Array.BYTES_PER_ELEMENT;let a,f=0,d=0,h=0;class C extends y.Disposable{constructor(x,M,b,T){super(),this._terminal=x,this._gl=M,this._dimensions=b,this._optionsService=T,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};const N=this._gl;_.TextureAtlas.maxAtlasPages===void 0&&(_.TextureAtlas.maxAtlasPages=Math.min(32,(0,m.throwIfFalsy)(N.getParameter(N.MAX_TEXTURE_IMAGE_UNITS))),_.TextureAtlas.maxTextureSize=(0,m.throwIfFalsy)(N.getParameter(N.MAX_TEXTURE_SIZE))),this._program=(0,m.throwIfFalsy)((0,S.createProgram)(N,`#version 300 es
52
- layout (location = 0) in vec2 a_unitquad;
53
- layout (location = 1) in vec2 a_cellpos;
54
- layout (location = 2) in vec2 a_offset;
55
- layout (location = 3) in vec2 a_size;
56
- layout (location = 4) in float a_texpage;
57
- layout (location = 5) in vec2 a_texcoord;
58
- layout (location = 6) in vec2 a_texsize;
59
-
60
- uniform mat4 u_projection;
61
- uniform vec2 u_resolution;
62
-
63
- out vec2 v_texcoord;
64
- flat out int v_texpage;
65
-
66
- void main() {
67
- vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
68
- gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
69
- v_texpage = int(a_texpage);
70
- v_texcoord = a_texcoord + a_unitquad * a_texsize;
71
- }`,(function(X){let G="";for(let Y=1;Y<X;Y++)G+=` else if (v_texpage == ${Y}) { outColor = texture(u_texture[${Y}], v_texcoord); }`;return`#version 300 es
72
- precision lowp float;
73
-
74
- in vec2 v_texcoord;
75
- flat in int v_texpage;
76
-
77
- uniform sampler2D u_texture[${X}];
78
-
79
- out vec4 outColor;
80
-
81
- void main() {
82
- if (v_texpage == 0) {
83
- outColor = texture(u_texture[0], v_texcoord);
84
- } ${G}
85
- }`})(_.TextureAtlas.maxAtlasPages))),this.register((0,y.toDisposable)((()=>N.deleteProgram(this._program)))),this._projectionLocation=(0,m.throwIfFalsy)(N.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=(0,m.throwIfFalsy)(N.getUniformLocation(this._program,"u_resolution")),this._textureLocation=(0,m.throwIfFalsy)(N.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=N.createVertexArray(),N.bindVertexArray(this._vertexArrayObject);const F=new Float32Array([0,0,1,0,0,1,1,1]),P=N.createBuffer();this.register((0,y.toDisposable)((()=>N.deleteBuffer(P)))),N.bindBuffer(N.ARRAY_BUFFER,P),N.bufferData(N.ARRAY_BUFFER,F,N.STATIC_DRAW),N.enableVertexAttribArray(0),N.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);const B=new Uint8Array([0,1,2,3]),H=N.createBuffer();this.register((0,y.toDisposable)((()=>N.deleteBuffer(H)))),N.bindBuffer(N.ELEMENT_ARRAY_BUFFER,H),N.bufferData(N.ELEMENT_ARRAY_BUFFER,B,N.STATIC_DRAW),this._attributesBuffer=(0,m.throwIfFalsy)(N.createBuffer()),this.register((0,y.toDisposable)((()=>N.deleteBuffer(this._attributesBuffer)))),N.bindBuffer(N.ARRAY_BUFFER,this._attributesBuffer),N.enableVertexAttribArray(2),N.vertexAttribPointer(2,2,N.FLOAT,!1,g,0),N.vertexAttribDivisor(2,1),N.enableVertexAttribArray(3),N.vertexAttribPointer(3,2,N.FLOAT,!1,g,2*Float32Array.BYTES_PER_ELEMENT),N.vertexAttribDivisor(3,1),N.enableVertexAttribArray(4),N.vertexAttribPointer(4,1,N.FLOAT,!1,g,4*Float32Array.BYTES_PER_ELEMENT),N.vertexAttribDivisor(4,1),N.enableVertexAttribArray(5),N.vertexAttribPointer(5,2,N.FLOAT,!1,g,5*Float32Array.BYTES_PER_ELEMENT),N.vertexAttribDivisor(5,1),N.enableVertexAttribArray(6),N.vertexAttribPointer(6,2,N.FLOAT,!1,g,7*Float32Array.BYTES_PER_ELEMENT),N.vertexAttribDivisor(6,1),N.enableVertexAttribArray(1),N.vertexAttribPointer(1,2,N.FLOAT,!1,g,9*Float32Array.BYTES_PER_ELEMENT),N.vertexAttribDivisor(1,1),N.useProgram(this._program);const q=new Int32Array(_.TextureAtlas.maxAtlasPages);for(let X=0;X<_.TextureAtlas.maxAtlasPages;X++)q[X]=X;N.uniform1iv(this._textureLocation,q),N.uniformMatrix4fv(this._projectionLocation,!1,S.PROJECTION_MATRIX),this._atlasTextures=[];for(let X=0;X<_.TextureAtlas.maxAtlasPages;X++){const G=new S.GLTexture((0,m.throwIfFalsy)(N.createTexture()));this.register((0,y.toDisposable)((()=>N.deleteTexture(G.texture)))),N.activeTexture(N.TEXTURE0+X),N.bindTexture(N.TEXTURE_2D,G.texture),N.texParameteri(N.TEXTURE_2D,N.TEXTURE_WRAP_S,N.CLAMP_TO_EDGE),N.texParameteri(N.TEXTURE_2D,N.TEXTURE_WRAP_T,N.CLAMP_TO_EDGE),N.texImage2D(N.TEXTURE_2D,0,N.RGBA,1,1,0,N.RGBA,N.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[X]=G}N.enable(N.BLEND),N.blendFunc(N.SRC_ALPHA,N.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return!this._atlas||this._atlas.beginFrame()}updateCell(x,M,b,T,N,F,P,B,H){this._updateCell(this._vertices.attributes,x,M,b,T,N,F,P,B,H)}_updateCell(x,M,b,T,N,F,P,B,H,q){f=(b*this._terminal.cols+M)*E,T!==u.NULL_CELL_CODE&&T!==void 0?this._atlas&&(a=B&&B.length>1?this._atlas.getRasterizedGlyphCombinedChar(B,N,F,P,!1):this._atlas.getRasterizedGlyph(T,N,F,P,!1),d=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),N!==q&&a.offset.x>d?(h=a.offset.x-d,x[f]=-(a.offset.x-h)+this._dimensions.device.char.left,x[f+1]=-a.offset.y+this._dimensions.device.char.top,x[f+2]=(a.size.x-h)/this._dimensions.device.canvas.width,x[f+3]=a.size.y/this._dimensions.device.canvas.height,x[f+4]=a.texturePage,x[f+5]=a.texturePositionClipSpace.x+h/this._atlas.pages[a.texturePage].canvas.width,x[f+6]=a.texturePositionClipSpace.y,x[f+7]=a.sizeClipSpace.x-h/this._atlas.pages[a.texturePage].canvas.width,x[f+8]=a.sizeClipSpace.y):(x[f]=-a.offset.x+this._dimensions.device.char.left,x[f+1]=-a.offset.y+this._dimensions.device.char.top,x[f+2]=a.size.x/this._dimensions.device.canvas.width,x[f+3]=a.size.y/this._dimensions.device.canvas.height,x[f+4]=a.texturePage,x[f+5]=a.texturePositionClipSpace.x,x[f+6]=a.texturePositionClipSpace.y,x[f+7]=a.sizeClipSpace.x,x[f+8]=a.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&(0,m.allowRescaling)(T,H,a.size.x,this._dimensions.device.cell.width)&&(x[f+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width)):x.fill(0,f,f+E-1-2)}clear(){const x=this._terminal,M=x.cols*x.rows*E;this._vertices.count!==M?this._vertices.attributes=new Float32Array(M):this._vertices.attributes.fill(0);let b=0;for(;b<this._vertices.attributesBuffers.length;b++)this._vertices.count!==M?this._vertices.attributesBuffers[b]=new Float32Array(M):this._vertices.attributesBuffers[b].fill(0);this._vertices.count=M,b=0;for(let T=0;T<x.rows;T++)for(let N=0;N<x.cols;N++)this._vertices.attributes[b+9]=N/x.cols,this._vertices.attributes[b+10]=T/x.rows,b+=E}handleResize(){const x=this._gl;x.useProgram(this._program),x.viewport(0,0,x.canvas.width,x.canvas.height),x.uniform2f(this._resolutionLocation,x.canvas.width,x.canvas.height),this.clear()}render(x){if(!this._atlas)return;const M=this._gl;M.useProgram(this._program),M.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;const b=this._vertices.attributesBuffers[this._activeBuffer];let T=0;for(let N=0;N<x.lineLengths.length;N++){const F=N*this._terminal.cols*E,P=this._vertices.attributes.subarray(F,F+x.lineLengths[N]*E);b.set(P,T),T+=P.length}M.bindBuffer(M.ARRAY_BUFFER,this._attributesBuffer),M.bufferData(M.ARRAY_BUFFER,b.subarray(0,T),M.STREAM_DRAW);for(let N=0;N<this._atlas.pages.length;N++)this._atlas.pages[N].version!==this._atlasTextures[N].version&&this._bindAtlasPageTexture(M,this._atlas,N);M.drawElementsInstanced(M.TRIANGLE_STRIP,4,M.UNSIGNED_BYTE,0,T/E)}setAtlas(x){this._atlas=x;for(const M of this._atlasTextures)M.version=-1}_bindAtlasPageTexture(x,M,b){x.activeTexture(x.TEXTURE0+b),x.bindTexture(x.TEXTURE_2D,this._atlasTextures[b].texture),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_S,x.CLAMP_TO_EDGE),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_T,x.CLAMP_TO_EDGE),x.texImage2D(x.TEXTURE_2D,0,x.RGBA,x.RGBA,x.UNSIGNED_BYTE,M.pages[b].canvas),x.generateMipmap(x.TEXTURE_2D),this._atlasTextures[b].version=M.pages[b].version}setDimensions(x){this._dimensions=x}}s.GlyphRenderer=C},742:(L,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.RectangleRenderer=void 0;const m=c(374),_=c(859),u=c(310),y=c(381),S=8*Float32Array.BYTES_PER_ELEMENT;class E{constructor(){this.attributes=new Float32Array(160),this.count=0}}let g=0,a=0,f=0,d=0,h=0,C=0,D=0;class x extends _.Disposable{constructor(b,T,N,F){super(),this._terminal=b,this._gl=T,this._dimensions=N,this._themeService=F,this._vertices=new E,this._verticesCursor=new E;const P=this._gl;this._program=(0,m.throwIfFalsy)((0,y.createProgram)(P,`#version 300 es
86
- layout (location = 0) in vec2 a_position;
87
- layout (location = 1) in vec2 a_size;
88
- layout (location = 2) in vec4 a_color;
89
- layout (location = 3) in vec2 a_unitquad;
90
-
91
- uniform mat4 u_projection;
92
-
93
- out vec4 v_color;
94
-
95
- void main() {
96
- vec2 zeroToOne = a_position + (a_unitquad * a_size);
97
- gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
98
- v_color = a_color;
99
- }`,`#version 300 es
100
- precision lowp float;
101
-
102
- in vec4 v_color;
103
-
104
- out vec4 outColor;
105
-
106
- void main() {
107
- outColor = v_color;
108
- }`)),this.register((0,_.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 B=new Float32Array([0,0,1,0,0,1,1,1]),H=P.createBuffer();this.register((0,_.toDisposable)((()=>P.deleteBuffer(H)))),P.bindBuffer(P.ARRAY_BUFFER,H),P.bufferData(P.ARRAY_BUFFER,B,P.STATIC_DRAW),P.enableVertexAttribArray(3),P.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);const q=new Uint8Array([0,1,2,3]),X=P.createBuffer();this.register((0,_.toDisposable)((()=>P.deleteBuffer(X)))),P.bindBuffer(P.ELEMENT_ARRAY_BUFFER,X),P.bufferData(P.ELEMENT_ARRAY_BUFFER,q,P.STATIC_DRAW),this._attributesBuffer=(0,m.throwIfFalsy)(P.createBuffer()),this.register((0,_.toDisposable)((()=>P.deleteBuffer(this._attributesBuffer)))),P.bindBuffer(P.ARRAY_BUFFER,this._attributesBuffer),P.enableVertexAttribArray(0),P.vertexAttribPointer(0,2,P.FLOAT,!1,S,0),P.vertexAttribDivisor(0,1),P.enableVertexAttribArray(1),P.vertexAttribPointer(1,2,P.FLOAT,!1,S,2*Float32Array.BYTES_PER_ELEMENT),P.vertexAttribDivisor(1,1),P.enableVertexAttribArray(2),P.vertexAttribPointer(2,4,P.FLOAT,!1,S,4*Float32Array.BYTES_PER_ELEMENT),P.vertexAttribDivisor(2,1),this._updateCachedColors(F.colors),this.register(this._themeService.onChangeColors((G=>{this._updateCachedColors(G),this._updateViewportRectangle()})))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(b){const T=this._gl;T.useProgram(this._program),T.bindVertexArray(this._vertexArrayObject),T.uniformMatrix4fv(this._projectionLocation,!1,y.PROJECTION_MATRIX),T.bindBuffer(T.ARRAY_BUFFER,this._attributesBuffer),T.bufferData(T.ARRAY_BUFFER,b.attributes,T.DYNAMIC_DRAW),T.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,T.UNSIGNED_BYTE,0,b.count)}handleResize(){this._updateViewportRectangle()}setDimensions(b){this._dimensions=b}_updateCachedColors(b){this._bgFloat=this._colorToFloat32Array(b.background),this._cursorFloat=this._colorToFloat32Array(b.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(b){const T=this._terminal,N=this._vertices;let F,P,B,H,q,X,G,Y,j,U,$,V=1;for(F=0;F<T.rows;F++){for(B=-1,H=0,q=0,X=!1,P=0;P<T.cols;P++)G=(F*T.cols+P)*u.RENDER_MODEL_INDICIES_PER_CELL,Y=b.cells[G+u.RENDER_MODEL_BG_OFFSET],j=b.cells[G+u.RENDER_MODEL_FG_OFFSET],U=!!(67108864&j),(Y!==H||j!==q&&(X||U))&&((H!==0||X&&q!==0)&&($=8*V++,this._updateRectangle(N,$,q,H,B,P,F)),B=P,H=Y,q=j,X=U);(H!==0||X&&q!==0)&&($=8*V++,this._updateRectangle(N,$,q,H,B,T.cols,F))}N.count=V}updateCursor(b){const T=this._verticesCursor,N=b.cursor;if(!N||N.style==="block")return void(T.count=0);let F,P=0;N.style!=="bar"&&N.style!=="outline"||(F=8*P++,this._addRectangleFloat(T.attributes,F,N.x*this._dimensions.device.cell.width,N.y*this._dimensions.device.cell.height,N.style==="bar"?N.dpr*N.cursorWidth:N.dpr,this._dimensions.device.cell.height,this._cursorFloat)),N.style!=="underline"&&N.style!=="outline"||(F=8*P++,this._addRectangleFloat(T.attributes,F,N.x*this._dimensions.device.cell.width,(N.y+1)*this._dimensions.device.cell.height-N.dpr,N.width*this._dimensions.device.cell.width,N.dpr,this._cursorFloat)),N.style==="outline"&&(F=8*P++,this._addRectangleFloat(T.attributes,F,N.x*this._dimensions.device.cell.width,N.y*this._dimensions.device.cell.height,N.width*this._dimensions.device.cell.width,N.dpr,this._cursorFloat),F=8*P++,this._addRectangleFloat(T.attributes,F,(N.x+N.width)*this._dimensions.device.cell.width-N.dpr,N.y*this._dimensions.device.cell.height,N.dpr,this._dimensions.device.cell.height,this._cursorFloat)),T.count=P}_updateRectangle(b,T,N,F,P,B,H){if(67108864&N)switch(50331648&N){case 16777216:case 33554432:g=this._themeService.colors.ansi[255&N].rgba;break;case 50331648:g=(16777215&N)<<8;break;default:g=this._themeService.colors.foreground.rgba}else switch(50331648&F){case 16777216:case 33554432:g=this._themeService.colors.ansi[255&F].rgba;break;case 50331648:g=(16777215&F)<<8;break;default:g=this._themeService.colors.background.rgba}b.attributes.length<T+4&&(b.attributes=(0,y.expandFloat32Array)(b.attributes,this._terminal.rows*this._terminal.cols*8)),a=P*this._dimensions.device.cell.width,f=H*this._dimensions.device.cell.height,d=(g>>24&255)/255,h=(g>>16&255)/255,C=(g>>8&255)/255,D=1,this._addRectangle(b.attributes,T,a,f,(B-P)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,d,h,C,D)}_addRectangle(b,T,N,F,P,B,H,q,X,G){b[T]=N/this._dimensions.device.canvas.width,b[T+1]=F/this._dimensions.device.canvas.height,b[T+2]=P/this._dimensions.device.canvas.width,b[T+3]=B/this._dimensions.device.canvas.height,b[T+4]=H,b[T+5]=q,b[T+6]=X,b[T+7]=G}_addRectangleFloat(b,T,N,F,P,B,H){b[T]=N/this._dimensions.device.canvas.width,b[T+1]=F/this._dimensions.device.canvas.height,b[T+2]=P/this._dimensions.device.canvas.width,b[T+3]=B/this._dimensions.device.canvas.height,b[T+4]=H[0],b[T+5]=H[1],b[T+6]=H[2],b[T+7]=H[3]}_colorToFloat32Array(b){return new Float32Array([(b.rgba>>24&255)/255,(b.rgba>>16&255)/255,(b.rgba>>8&255)/255,(255&b.rgba)/255])}}s.RectangleRenderer=x},310:(L,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.RenderModel=s.COMBINED_CHAR_BIT_MASK=s.RENDER_MODEL_EXT_OFFSET=s.RENDER_MODEL_FG_OFFSET=s.RENDER_MODEL_BG_OFFSET=s.RENDER_MODEL_INDICIES_PER_CELL=void 0;const m=c(296);s.RENDER_MODEL_INDICIES_PER_CELL=4,s.RENDER_MODEL_BG_OFFSET=1,s.RENDER_MODEL_FG_OFFSET=2,s.RENDER_MODEL_EXT_OFFSET=3,s.COMBINED_CHAR_BIT_MASK=2147483648,s.RenderModel=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=(0,m.createSelectionRenderModel)()}resize(_,u){const y=_*u*s.RENDER_MODEL_INDICIES_PER_CELL;y!==this.cells.length&&(this.cells=new Uint32Array(y),this.lineLengths=new Uint32Array(u))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}}},666:(L,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.JoinedCellData=s.WebglRenderer=void 0;const m=c(820),_=c(274),u=c(627),y=c(457),S=c(56),E=c(374),g=c(345),a=c(859),f=c(147),d=c(782),h=c(855),C=c(965),D=c(742),x=c(310),M=c(733);class b extends a.Disposable{constructor(P,B,H,q,X,G,Y,j,U){super(),this._terminal=P,this._characterJoinerService=B,this._charSizeService=H,this._coreBrowserService=q,this._coreService=X,this._decorationService=G,this._optionsService=Y,this._themeService=j,this._cursorBlinkStateManager=new a.MutableDisposable,this._charAtlasDisposable=this.register(new a.MutableDisposable),this._observerDisposable=this.register(new a.MutableDisposable),this._model=new x.RenderModel,this._workCell=new d.CellData,this._workCell2=new d.CellData,this._rectangleRenderer=this.register(new a.MutableDisposable),this._glyphRenderer=this.register(new a.MutableDisposable),this._onChangeTextureAtlas=this.register(new g.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new g.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new g.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this.register(new g.EventEmitter),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this.register(new g.EventEmitter),this.onContextLoss=this._onContextLoss.event,this.register(this._themeService.onChangeColors((()=>this._handleColorChange()))),this._cellColorResolver=new _.CellColorResolver(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new M.LinkRenderLayer(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,Y,this._themeService)],this.dimensions=(0,E.createRenderDimensions)(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this.register(Y.onOptionChange((()=>this._handleOptionsChanged()))),this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");const $={antialias:!1,depth:!1,preserveDrawingBuffer:U};if(this._gl=this._canvas.getContext("webgl2",$),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this.register((0,m.addDisposableDomListener)(this._canvas,"webglcontextlost",(V=>{console.log("webglcontextlost event received"),V.preventDefault(),this._contextRestorationTimeout=setTimeout((()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(V)}),3e3)}))),this.register((0,m.addDisposableDomListener)(this._canvas,"webglcontextrestored",(V=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,(0,u.removeTerminalFromCache)(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()}))),this._observerDisposable.value=(0,S.observeDevicePixelDimensions)(this._canvas,this._coreBrowserService.window,((V,ne)=>this._setCanvasDevicePixelDimensions(V,ne))),this.register(this._coreBrowserService.onWindowChange((V=>{this._observerDisposable.value=(0,S.observeDevicePixelDimensions)(this._canvas,V,((ne,se)=>this._setCanvasDevicePixelDimensions(ne,se)))}))),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,a.toDisposable)((()=>{var V;for(const ne of this._renderLayers)ne.dispose();(V=this._canvas.parentElement)==null||V.removeChild(this._canvas),(0,u.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,B){var H,q,X,G;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(const Y of this._renderLayers)Y.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,(H=this._rectangleRenderer.value)==null||H.setDimensions(this.dimensions),(q=this._rectangleRenderer.value)==null||q.handleResize(),(X=this._glyphRenderer.value)==null||X.setDimensions(this.dimensions),(G=this._glyphRenderer.value)==null||G.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){var P;for(const B of this._renderLayers)B.handleBlur(this._terminal);(P=this._cursorBlinkStateManager.value)==null||P.pause(),this._requestRedrawViewport()}handleFocus(){var P;for(const B of this._renderLayers)B.handleFocus(this._terminal);(P=this._cursorBlinkStateManager.value)==null||P.resume(),this._requestRedrawViewport()}handleSelectionChanged(P,B,H){for(const q of this._renderLayers)q.handleSelectionChanged(this._terminal,P,B,H);this._model.selection.update(this._core,P,B,H),this._requestRedrawViewport()}handleCursorMove(){var P;for(const B of this._renderLayers)B.handleCursorMove(this._terminal);(P=this._cursorBlinkStateManager.value)==null||P.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new D.RectangleRenderer(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new C.GlyphRenderer(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){var B;if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0)return void(this._isAttached=!1);const P=(0,u.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,a.getDisposeArrayDisposable)([(0,g.forwardEvent)(P.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),(0,g.forwardEvent)(P.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)])),this._charAtlas=P,this._charAtlas.warmUp(),(B=this._glyphRenderer.value)==null||B.setAtlas(this._charAtlas)}_clearModel(P){var B;this._model.clear(),P&&((B=this._glyphRenderer.value)==null||B.clear())}clearTextureAtlas(){var P;(P=this._charAtlas)==null||P.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var P;this._clearModel(!0);for(const B of this._renderLayers)B.reset(this._terminal);(P=this._cursorBlinkStateManager.value)==null||P.restartBlinkAnimation(),this._updateCursorBlink()}registerCharacterJoiner(P){return-1}deregisterCharacterJoiner(P){return!1}renderRows(P,B){if(!this._isAttached){if(!(this._coreBrowserService.window.document.body.contains(this._core.screenElement)&&this._charSizeService.width&&this._charSizeService.height))return;this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0}for(const H of this._renderLayers)H.handleGridChanged(this._terminal,P,B);this._glyphRenderer.value&&this._rectangleRenderer.value&&(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(P,B),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),this._cursorBlinkStateManager.value&&!this._cursorBlinkStateManager.value.isCursorVisible||this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new y.CursorBlinkStateManager((()=>{this._requestRedrawCursor()}),this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(P,B){const H=this._core;let q,X,G,Y,j,U,$,V,ne,se,ce,he,K,W,J=this._workCell;P=N(P,H.rows-1,0),B=N(B,H.rows-1,0);const Z=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,de=Z-H.buffer.ydisp,ee=Math.min(this._terminal.buffer.active.cursorX,H.cols-1);let xe=-1;const ke=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let le=!1;for(X=P;X<=B;X++)for(G=X+H.buffer.ydisp,Y=H.buffer.lines.get(G),this._model.lineLengths[X]=0,j=this._characterJoinerService.getJoinedCharacters(G),K=0;K<H.cols;K++)if(q=this._cellColorResolver.result.bg,Y.loadCell(K,J),K===0&&(q=this._cellColorResolver.result.bg),U=!1,$=K,j.length>0&&K===j[0][0]&&(U=!0,V=j.shift(),J=new T(J,Y.translateToString(!0,V[0],V[1]),V[1]-V[0]),$=V[1]-1),ne=J.getChars(),se=J.getCode(),he=(X*H.cols+K)*x.RENDER_MODEL_INDICIES_PER_CELL,this._cellColorResolver.resolve(J,K,G,this.dimensions.device.cell.width),ke&&G===Z&&(K===ee&&(this._model.cursor={x:ee,y:de,width:J.getWidth(),style:this._coreBrowserService.isFocused?H.options.cursorStyle||"block":H.options.cursorInactiveStyle,cursorWidth:H.options.cursorWidth,dpr:this._devicePixelRatio},xe=ee+J.getWidth()-1),K>=ee&&K<=xe&&(this._coreBrowserService.isFocused&&(H.options.cursorStyle||"block")==="block"||this._coreBrowserService.isFocused===!1&&H.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),se!==h.NULL_CELL_CODE&&(this._model.lineLengths[X]=K+1),(this._model.cells[he]!==se||this._model.cells[he+x.RENDER_MODEL_BG_OFFSET]!==this._cellColorResolver.result.bg||this._model.cells[he+x.RENDER_MODEL_FG_OFFSET]!==this._cellColorResolver.result.fg||this._model.cells[he+x.RENDER_MODEL_EXT_OFFSET]!==this._cellColorResolver.result.ext)&&(le=!0,ne.length>1&&(se|=x.COMBINED_CHAR_BIT_MASK),this._model.cells[he]=se,this._model.cells[he+x.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[he+x.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[he+x.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext,ce=J.getWidth(),this._glyphRenderer.value.updateCell(K,X,se,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,ne,ce,q),U))for(J=this._workCell,K++;K<$;K++)W=(X*H.cols+K)*x.RENDER_MODEL_INDICIES_PER_CELL,this._glyphRenderer.value.updateCell(K,X,h.NULL_CELL_CODE,0,0,0,h.NULL_CELL_CHAR,0,0),this._model.cells[W]=h.NULL_CELL_CODE,this._model.cells[W+x.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[W+x.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[W+x.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext;le&&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,B){this._canvas.width===P&&this._canvas.height===B||(this._canvas.width=P,this._canvas.height=B,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})}}s.WebglRenderer=b;class T extends f.AttributeData{constructor(P,B,H){super(),this.content=0,this.combinedData="",this.fg=P.fg,this.bg=P.bg,this.combinedData=B,this._width=H}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 N(F,P,B=0){return Math.max(Math.min(F,P),B)}s.JoinedCellData=T},381:(L,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.GLTexture=s.expandFloat32Array=s.createShader=s.createProgram=s.PROJECTION_MATRIX=void 0;const m=c(374);function _(u,y,S){const E=(0,m.throwIfFalsy)(u.createShader(y));if(u.shaderSource(E,S),u.compileShader(E),u.getShaderParameter(E,u.COMPILE_STATUS))return E;console.error(u.getShaderInfoLog(E)),u.deleteShader(E)}s.PROJECTION_MATRIX=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]),s.createProgram=function(u,y,S){const E=(0,m.throwIfFalsy)(u.createProgram());if(u.attachShader(E,(0,m.throwIfFalsy)(_(u,u.VERTEX_SHADER,y))),u.attachShader(E,(0,m.throwIfFalsy)(_(u,u.FRAGMENT_SHADER,S))),u.linkProgram(E),u.getProgramParameter(E,u.LINK_STATUS))return E;console.error(u.getProgramInfoLog(E)),u.deleteProgram(E)},s.createShader=_,s.expandFloat32Array=function(u,y){const S=Math.min(2*u.length,y),E=new Float32Array(S);for(let g=0;g<u.length;g++)E[g]=u[g];return E},s.GLTexture=class{constructor(u){this.texture=u,this.version=-1}}},592:(L,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BaseRenderLayer=void 0;const m=c(627),_=c(237),u=c(374),y=c(859);class S extends y.Disposable{constructor(g,a,f,d,h,C,D,x){super(),this._container=a,this._alpha=h,this._coreBrowserService=C,this._optionsService=D,this._themeService=x,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${f}-layer`),this._canvas.style.zIndex=d.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this.register(this._themeService.onChangeColors((M=>{this._refreshCharAtlas(g,M),this.reset(g)}))),this.register((0,y.toDisposable)((()=>{this._canvas.remove()})))}_initCanvas(){this._ctx=(0,u.throwIfFalsy)(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(g){}handleFocus(g){}handleCursorMove(g){}handleGridChanged(g,a,f){}handleSelectionChanged(g,a,f,d=!1){}_setTransparency(g,a){if(a===this._alpha)return;const f=this._canvas;this._alpha=a,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,f),this._refreshCharAtlas(g,this._themeService.colors),this.handleGridChanged(g,0,g.rows-1)}_refreshCharAtlas(g,a){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=(0,m.acquireTextureAtlas)(g,this._optionsService.rawOptions,a,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr),this._charAtlas.warmUp())}resize(g,a){this._deviceCellWidth=a.device.cell.width,this._deviceCellHeight=a.device.cell.height,this._deviceCharWidth=a.device.char.width,this._deviceCharHeight=a.device.char.height,this._deviceCharLeft=a.device.char.left,this._deviceCharTop=a.device.char.top,this._canvas.width=a.device.canvas.width,this._canvas.height=a.device.canvas.height,this._canvas.style.width=`${a.css.canvas.width}px`,this._canvas.style.height=`${a.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(g,this._themeService.colors)}_fillBottomLineAtCells(g,a,f=1){this._ctx.fillRect(g*this._deviceCellWidth,(a+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,f*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(g,a,f,d){this._alpha?this._ctx.clearRect(g*this._deviceCellWidth,a*this._deviceCellHeight,f*this._deviceCellWidth,d*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(g*this._deviceCellWidth,a*this._deviceCellHeight,f*this._deviceCellWidth,d*this._deviceCellHeight))}_fillCharTrueColor(g,a,f,d){this._ctx.font=this._getFont(g,!1,!1),this._ctx.textBaseline=_.TEXT_BASELINE,this._clipCell(f,d,a.getWidth()),this._ctx.fillText(a.getChars(),f*this._deviceCellWidth+this._deviceCharLeft,d*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(g,a,f){this._ctx.beginPath(),this._ctx.rect(g*this._deviceCellWidth,a*this._deviceCellHeight,f*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(g,a,f){return`${f?"italic":""} ${a?g.options.fontWeightBold:g.options.fontWeight} ${g.options.fontSize*this._coreBrowserService.dpr}px ${g.options.fontFamily}`}}s.BaseRenderLayer=S},733:(L,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.LinkRenderLayer=void 0;const m=c(197),_=c(237),u=c(592);class y extends u.BaseRenderLayer{constructor(E,g,a,f,d,h,C){super(a,E,"link",g,!0,d,h,C),this.register(f.onShowLinkUnderline((D=>this._handleShowLinkUnderline(D)))),this.register(f.onHideLinkUnderline((D=>this._handleHideLinkUnderline(D))))}resize(E,g){super.resize(E,g),this._state=void 0}reset(E){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);const E=this._state.y2-this._state.y1-1;E>0&&this._clearCells(0,this._state.y1+1,this._state.cols,E),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(E){if(E.fg===_.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._themeService.colors.background.css:E.fg!==void 0&&(0,m.is256Color)(E.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[E.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,E.y1===E.y2)this._fillBottomLineAtCells(E.x1,E.y1,E.x2-E.x1);else{this._fillBottomLineAtCells(E.x1,E.y1,E.cols-E.x1);for(let g=E.y1+1;g<E.y2;g++)this._fillBottomLineAtCells(0,g,E.cols);this._fillBottomLineAtCells(0,E.y2,E.x2)}this._state=E}_handleHideLinkUnderline(E){this._clearCurrentLink()}}s.LinkRenderLayer=y},820:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.addDisposableDomListener=void 0,s.addDisposableDomListener=function(c,m,_,u){c.addEventListener(m,_,u);let y=!1;return{dispose:()=>{y||(y=!0,c.removeEventListener(m,_,u))}}}},274:(L,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CellColorResolver=void 0;const m=c(855),_=c(160),u=c(374);let y,S=0,E=0,g=!1,a=!1,f=!1,d=0;s.CellColorResolver=class{constructor(h,C,D,x,M,b){this._terminal=h,this._optionService=C,this._selectionRenderModel=D,this._decorationService=x,this._coreBrowserService=M,this._themeService=b,this.result={fg:0,bg:0,ext:0}}resolve(h,C,D,x){if(this.result.bg=h.bg,this.result.fg=h.fg,this.result.ext=268435456&h.bg?h.extended.ext:0,E=0,S=0,a=!1,g=!1,f=!1,y=this._themeService.colors,d=0,h.getCode()!==m.NULL_CELL_CODE&&h.extended.underlineStyle===4){const M=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));d=C*x%(2*Math.round(M))}if(this._decorationService.forEachDecorationAtCell(C,D,"bottom",(M=>{M.backgroundColorRGB&&(E=M.backgroundColorRGB.rgba>>8&16777215,a=!0),M.foregroundColorRGB&&(S=M.foregroundColorRGB.rgba>>8&16777215,g=!0)})),f=this._selectionRenderModel.isCellSelected(this._terminal,C,D),f){if(67108864&this.result.fg||(50331648&this.result.bg)!=0){if(67108864&this.result.fg)switch(50331648&this.result.fg){case 16777216:case 33554432:E=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:E=(16777215&this.result.fg)<<8|255;break;default:E=this._themeService.colors.foreground.rgba}else switch(50331648&this.result.bg){case 16777216:case 33554432:E=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:E=(16777215&this.result.bg)<<8|255}E=_.rgba.blend(E,4294967040&(this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}else E=(this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(a=!0,y.selectionForeground&&(S=y.selectionForeground.rgba>>8&16777215,g=!0),(0,u.treatGlyphAsBackgroundColor)(h.getCode())){if(67108864&this.result.fg&&(50331648&this.result.bg)==0)S=(this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(67108864&this.result.fg)switch(50331648&this.result.bg){case 16777216:case 33554432:S=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:S=(16777215&this.result.bg)<<8|255}else switch(50331648&this.result.fg){case 16777216:case 33554432:S=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:S=(16777215&this.result.fg)<<8|255;break;default:S=this._themeService.colors.foreground.rgba}S=_.rgba.blend(S,4294967040&(this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}g=!0}}this._decorationService.forEachDecorationAtCell(C,D,"top",(M=>{M.backgroundColorRGB&&(E=M.backgroundColorRGB.rgba>>8&16777215,a=!0),M.foregroundColorRGB&&(S=M.foregroundColorRGB.rgba>>8&16777215,g=!0)})),a&&(E=f?-16777216&h.bg&-134217729|E|50331648:-16777216&h.bg|E|50331648),g&&(S=-16777216&h.fg&-67108865|S|50331648),67108864&this.result.fg&&(a&&!g&&(S=(50331648&this.result.bg)==0?-134217728&this.result.fg|16777215&y.background.rgba>>8|50331648:-134217728&this.result.fg|67108863&this.result.bg,g=!0),!a&&g&&(E=(50331648&this.result.fg)==0?-67108864&this.result.bg|16777215&y.foreground.rgba>>8|50331648:-67108864&this.result.bg|67108863&this.result.fg,a=!0)),y=void 0,this.result.bg=a?E:this.result.bg,this.result.fg=g?S:this.result.fg,this.result.ext&=536870911,this.result.ext|=d<<29&3758096384}}},627:(L,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.removeTerminalFromCache=s.acquireTextureAtlas=void 0;const m=c(509),_=c(197),u=[];s.acquireTextureAtlas=function(y,S,E,g,a,f,d,h){const C=(0,_.generateConfig)(g,a,f,d,S,E,h);for(let M=0;M<u.length;M++){const b=u[M],T=b.ownedBy.indexOf(y);if(T>=0){if((0,_.configEquals)(b.config,C))return b.atlas;b.ownedBy.length===1?(b.atlas.dispose(),u.splice(M,1)):b.ownedBy.splice(T,1);break}}for(let M=0;M<u.length;M++){const b=u[M];if((0,_.configEquals)(b.config,C))return b.ownedBy.push(y),b.atlas}const D=y._core,x={atlas:new m.TextureAtlas(document,C,D.unicodeService),config:C,ownedBy:[y]};return u.push(x),x.atlas},s.removeTerminalFromCache=function(y){for(let S=0;S<u.length;S++){const E=u[S].ownedBy.indexOf(y);if(E!==-1){u[S].ownedBy.length===1?(u[S].atlas.dispose(),u.splice(S,1)):u[S].ownedBy.splice(E,1);break}}}},197:(L,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.is256Color=s.configEquals=s.generateConfig=void 0;const m=c(160);s.generateConfig=function(_,u,y,S,E,g,a){const f={foreground:g.foreground,background:g.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:g.ansi.slice(),contrastCache:g.contrastCache,halfContrastCache:g.halfContrastCache};return{customGlyphs:E.customGlyphs,devicePixelRatio:a,letterSpacing:E.letterSpacing,lineHeight:E.lineHeight,deviceCellWidth:_,deviceCellHeight:u,deviceCharWidth:y,deviceCharHeight:S,fontFamily:E.fontFamily,fontSize:E.fontSize,fontWeight:E.fontWeight,fontWeightBold:E.fontWeightBold,allowTransparency:E.allowTransparency,drawBoldTextInBrightColors:E.drawBoldTextInBrightColors,minimumContrastRatio:E.minimumContrastRatio,colors:f}},s.configEquals=function(_,u){for(let y=0;y<_.colors.ansi.length;y++)if(_.colors.ansi[y].rgba!==u.colors.ansi[y].rgba)return!1;return _.devicePixelRatio===u.devicePixelRatio&&_.customGlyphs===u.customGlyphs&&_.lineHeight===u.lineHeight&&_.letterSpacing===u.letterSpacing&&_.fontFamily===u.fontFamily&&_.fontSize===u.fontSize&&_.fontWeight===u.fontWeight&&_.fontWeightBold===u.fontWeightBold&&_.allowTransparency===u.allowTransparency&&_.deviceCharWidth===u.deviceCharWidth&&_.deviceCharHeight===u.deviceCharHeight&&_.drawBoldTextInBrightColors===u.drawBoldTextInBrightColors&&_.minimumContrastRatio===u.minimumContrastRatio&&_.colors.foreground.rgba===u.colors.foreground.rgba&&_.colors.background.rgba===u.colors.background.rgba},s.is256Color=function(_){return(50331648&_)==16777216||(50331648&_)==33554432}},237:(L,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TEXT_BASELINE=s.DIM_OPACITY=s.INVERTED_DEFAULT_COLOR=void 0;const m=c(399);s.INVERTED_DEFAULT_COLOR=257,s.DIM_OPACITY=.5,s.TEXT_BASELINE=m.isFirefox||m.isLegacyEdge?"bottom":"ideographic"},457:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CursorBlinkStateManager=void 0,s.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:(L,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.tryDrawCustomChar=s.powerlineDefinitions=s.boxDrawingDefinitions=s.blockElementDefinitions=void 0;const m=c(374);s.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 _={"░":[[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]]};s.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:(g,a)=>`M0,${.5-a} L1,${.5-a} M0,${.5+a} L1,${.5+a}`},"║":{1:(g,a)=>`M${.5-g},0 L${.5-g},1 M${.5+g},0 L${.5+g},1`},"╒":{1:(g,a)=>`M.5,1 L.5,${.5-a} L1,${.5-a} M.5,${.5+a} L1,${.5+a}`},"╓":{1:(g,a)=>`M${.5-g},1 L${.5-g},.5 L1,.5 M${.5+g},.5 L${.5+g},1`},"╔":{1:(g,a)=>`M1,${.5-a} L${.5-g},${.5-a} L${.5-g},1 M1,${.5+a} L${.5+g},${.5+a} L${.5+g},1`},"╕":{1:(g,a)=>`M0,${.5-a} L.5,${.5-a} L.5,1 M0,${.5+a} L.5,${.5+a}`},"╖":{1:(g,a)=>`M${.5+g},1 L${.5+g},.5 L0,.5 M${.5-g},.5 L${.5-g},1`},"╗":{1:(g,a)=>`M0,${.5+a} L${.5-g},${.5+a} L${.5-g},1 M0,${.5-a} L${.5+g},${.5-a} L${.5+g},1`},"╘":{1:(g,a)=>`M.5,0 L.5,${.5+a} L1,${.5+a} M.5,${.5-a} L1,${.5-a}`},"╙":{1:(g,a)=>`M1,.5 L${.5-g},.5 L${.5-g},0 M${.5+g},.5 L${.5+g},0`},"╚":{1:(g,a)=>`M1,${.5-a} L${.5+g},${.5-a} L${.5+g},0 M1,${.5+a} L${.5-g},${.5+a} L${.5-g},0`},"╛":{1:(g,a)=>`M0,${.5+a} L.5,${.5+a} L.5,0 M0,${.5-a} L.5,${.5-a}`},"╜":{1:(g,a)=>`M0,.5 L${.5+g},.5 L${.5+g},0 M${.5-g},.5 L${.5-g},0`},"╝":{1:(g,a)=>`M0,${.5-a} L${.5-g},${.5-a} L${.5-g},0 M0,${.5+a} L${.5+g},${.5+a} L${.5+g},0`},"╞":{1:(g,a)=>`M.5,0 L.5,1 M.5,${.5-a} L1,${.5-a} M.5,${.5+a} L1,${.5+a}`},"╟":{1:(g,a)=>`M${.5-g},0 L${.5-g},1 M${.5+g},0 L${.5+g},1 M${.5+g},.5 L1,.5`},"╠":{1:(g,a)=>`M${.5-g},0 L${.5-g},1 M1,${.5+a} L${.5+g},${.5+a} L${.5+g},1 M1,${.5-a} L${.5+g},${.5-a} L${.5+g},0`},"╡":{1:(g,a)=>`M.5,0 L.5,1 M0,${.5-a} L.5,${.5-a} M0,${.5+a} L.5,${.5+a}`},"╢":{1:(g,a)=>`M0,.5 L${.5-g},.5 M${.5-g},0 L${.5-g},1 M${.5+g},0 L${.5+g},1`},"╣":{1:(g,a)=>`M${.5+g},0 L${.5+g},1 M0,${.5+a} L${.5-g},${.5+a} L${.5-g},1 M0,${.5-a} L${.5-g},${.5-a} L${.5-g},0`},"╤":{1:(g,a)=>`M0,${.5-a} L1,${.5-a} M0,${.5+a} L1,${.5+a} M.5,${.5+a} L.5,1`},"╥":{1:(g,a)=>`M0,.5 L1,.5 M${.5-g},.5 L${.5-g},1 M${.5+g},.5 L${.5+g},1`},"╦":{1:(g,a)=>`M0,${.5-a} L1,${.5-a} M0,${.5+a} L${.5-g},${.5+a} L${.5-g},1 M1,${.5+a} L${.5+g},${.5+a} L${.5+g},1`},"╧":{1:(g,a)=>`M.5,0 L.5,${.5-a} M0,${.5-a} L1,${.5-a} M0,${.5+a} L1,${.5+a}`},"╨":{1:(g,a)=>`M0,.5 L1,.5 M${.5-g},.5 L${.5-g},0 M${.5+g},.5 L${.5+g},0`},"╩":{1:(g,a)=>`M0,${.5+a} L1,${.5+a} M0,${.5-a} L${.5-g},${.5-a} L${.5-g},0 M1,${.5-a} L${.5+g},${.5-a} L${.5+g},0`},"╪":{1:(g,a)=>`M.5,0 L.5,1 M0,${.5-a} L1,${.5-a} M0,${.5+a} L1,${.5+a}`},"╫":{1:(g,a)=>`M0,.5 L1,.5 M${.5-g},0 L${.5-g},1 M${.5+g},0 L${.5+g},1`},"╬":{1:(g,a)=>`M0,${.5+a} L${.5-g},${.5+a} L${.5-g},1 M1,${.5+a} L${.5+g},${.5+a} L${.5+g},1 M0,${.5-a} L${.5-g},${.5-a} L${.5-g},0 M1,${.5-a} L${.5+g},${.5-a} L${.5+g},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:(g,a)=>`M.5,1 L.5,${.5+a/.15*.5} C.5,${.5+a/.15*.5},.5,.5,1,.5`},"╮":{1:(g,a)=>`M.5,1 L.5,${.5+a/.15*.5} C.5,${.5+a/.15*.5},.5,.5,0,.5`},"╯":{1:(g,a)=>`M.5,0 L.5,${.5-a/.15*.5} C.5,${.5-a/.15*.5},.5,.5,0,.5`},"╰":{1:(g,a)=>`M.5,0 L.5,${.5-a/.15*.5} C.5,${.5-a/.15*.5},.5,.5,1,.5`}},s.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}},s.powerlineDefinitions[""]=s.powerlineDefinitions[""],s.powerlineDefinitions[""]=s.powerlineDefinitions[""],s.tryDrawCustomChar=function(g,a,f,d,h,C,D,x){const M=s.blockElementDefinitions[a];if(M)return(function(F,P,B,H,q,X){for(let G=0;G<P.length;G++){const Y=P[G],j=q/8,U=X/8;F.fillRect(B+Y.x*j,H+Y.y*U,Y.w*j,Y.h*U)}})(g,M,f,d,h,C),!0;const b=_[a];if(b)return(function(F,P,B,H,q,X){let G=u.get(P);G||(G=new Map,u.set(P,G));const Y=F.fillStyle;if(typeof Y!="string")throw new Error(`Unexpected fillStyle type "${Y}"`);let j=G.get(Y);if(!j){const U=P[0].length,$=P.length,V=F.canvas.ownerDocument.createElement("canvas");V.width=U,V.height=$;const ne=(0,m.throwIfFalsy)(V.getContext("2d")),se=new ImageData(U,$);let ce,he,K,W;if(Y.startsWith("#"))ce=parseInt(Y.slice(1,3),16),he=parseInt(Y.slice(3,5),16),K=parseInt(Y.slice(5,7),16),W=Y.length>7&&parseInt(Y.slice(7,9),16)||1;else{if(!Y.startsWith("rgba"))throw new Error(`Unexpected fillStyle color format "${Y}" when drawing pattern glyph`);[ce,he,K,W]=Y.substring(5,Y.length-1).split(",").map((J=>parseFloat(J)))}for(let J=0;J<$;J++)for(let Z=0;Z<U;Z++)se.data[4*(J*U+Z)]=ce,se.data[4*(J*U+Z)+1]=he,se.data[4*(J*U+Z)+2]=K,se.data[4*(J*U+Z)+3]=P[J][Z]*(255*W);ne.putImageData(se,0,0),j=(0,m.throwIfFalsy)(F.createPattern(V,null)),G.set(Y,j)}F.fillStyle=j,F.fillRect(B,H,q,X)})(g,b,f,d,h,C),!0;const T=s.boxDrawingDefinitions[a];if(T)return(function(F,P,B,H,q,X,G){F.strokeStyle=F.fillStyle;for(const[Y,j]of Object.entries(P)){let U;F.beginPath(),F.lineWidth=G*Number.parseInt(Y),U=typeof j=="function"?j(.15,.15/X*q):j;for(const $ of U.split(" ")){const V=$[0],ne=S[V];if(!ne){console.error(`Could not find drawing instructions for "${V}"`);continue}const se=$.substring(1).split(",");se[0]&&se[1]&&ne(F,E(se,q,X,B,H,!0,G))}F.stroke(),F.closePath()}})(g,T,f,d,h,C,x),!0;const N=s.powerlineDefinitions[a];return!!N&&((function(F,P,B,H,q,X,G,Y){const j=new Path2D;j.rect(B,H,q,X),F.clip(j),F.beginPath();const U=G/12;F.lineWidth=Y*U;for(const $ of P.d.split(" ")){const V=$[0],ne=S[V];if(!ne){console.error(`Could not find drawing instructions for "${V}"`);continue}const se=$.substring(1).split(",");se[0]&&se[1]&&ne(F,E(se,q,X,B,H,!1,Y,(P.leftPadding??0)*(U/2),(P.rightPadding??0)*(U/2)))}P.type===1?(F.strokeStyle=F.fillStyle,F.stroke()):F.fill(),F.closePath()})(g,N,f,d,h,C,D,x),!0)};const u=new Map;function y(g,a,f=0){return Math.max(Math.min(g,a),f)}const S={C:(g,a)=>g.bezierCurveTo(a[0],a[1],a[2],a[3],a[4],a[5]),L:(g,a)=>g.lineTo(a[0],a[1]),M:(g,a)=>g.moveTo(a[0],a[1])};function E(g,a,f,d,h,C,D,x=0,M=0){const b=g.map((T=>parseFloat(T)||parseInt(T)));if(b.length<2)throw new Error("Too few arguments for instruction");for(let T=0;T<b.length;T+=2)b[T]*=a-x*D-M*D,C&&b[T]!==0&&(b[T]=y(Math.round(b[T]+.5)-.5,a,0)),b[T]+=d+x*D;for(let T=1;T<b.length;T+=2)b[T]*=f,C&&b[T]!==0&&(b[T]=y(Math.round(b[T]+.5)-.5,f,0)),b[T]+=h;return b}},56:(L,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.observeDevicePixelDimensions=void 0;const m=c(859);s.observeDevicePixelDimensions=function(_,u,y){let S=new u.ResizeObserver((E=>{const g=E.find((d=>d.target===_));if(!g)return;if(!("devicePixelContentBoxSize"in g))return S==null||S.disconnect(),void(S=void 0);const a=g.devicePixelContentBoxSize[0].inlineSize,f=g.devicePixelContentBoxSize[0].blockSize;a>0&&f>0&&y(a,f)}));try{S.observe(_,{box:["device-pixel-content-box"]})}catch{S.disconnect(),S=void 0}return(0,m.toDisposable)((()=>S==null?void 0:S.disconnect()))}},374:(L,s)=>{function c(_){return 57508<=_&&_<=57558}function m(_){return _>=128512&&_<=128591||_>=127744&&_<=128511||_>=128640&&_<=128767||_>=9728&&_<=9983||_>=9984&&_<=10175||_>=65024&&_<=65039||_>=129280&&_<=129535||_>=127462&&_<=127487}Object.defineProperty(s,"__esModule",{value:!0}),s.computeNextVariantOffset=s.createRenderDimensions=s.treatGlyphAsBackgroundColor=s.allowRescaling=s.isEmoji=s.isRestrictedPowerlineGlyph=s.isPowerlineGlyph=s.throwIfFalsy=void 0,s.throwIfFalsy=function(_){if(!_)throw new Error("value must not be falsy");return _},s.isPowerlineGlyph=c,s.isRestrictedPowerlineGlyph=function(_){return 57520<=_&&_<=57527},s.isEmoji=m,s.allowRescaling=function(_,u,y,S){return u===1&&y>Math.ceil(1.5*S)&&_!==void 0&&_>255&&!m(_)&&!c(_)&&!(function(E){return 57344<=E&&E<=63743})(_)},s.treatGlyphAsBackgroundColor=function(_){return c(_)||(function(u){return 9472<=u&&u<=9631})(_)},s.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}}}},s.computeNextVariantOffset=function(_,u,y=0){return(_-(2*Math.round(u)-y))%(2*Math.round(u))}},296:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.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(_,u,y,S=!1){if(this.selectionStart=u,this.selectionEnd=y,!u||!y||u[0]===y[0]&&u[1]===y[1])return void this.clear();const E=_.buffers.active.ydisp,g=u[1]-E,a=y[1]-E,f=Math.max(g,0),d=Math.min(a,_.rows-1);f>=_.rows||d<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=S,this.viewportStartRow=g,this.viewportEndRow=a,this.viewportCappedStartRow=f,this.viewportCappedEndRow=d,this.startCol=u[0],this.endCol=y[0])}isCellSelected(_,u,y){return!!this.hasSelection&&(y-=_.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?u>=this.startCol&&y>=this.viewportCappedStartRow&&u<this.endCol&&y<=this.viewportCappedEndRow:u<this.startCol&&y>=this.viewportCappedStartRow&&u>=this.endCol&&y<=this.viewportCappedEndRow:y>this.viewportStartRow&&y<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&y===this.viewportStartRow&&u>=this.startCol&&u<this.endCol||this.viewportStartRow<this.viewportEndRow&&y===this.viewportEndRow&&u<this.endCol||this.viewportStartRow<this.viewportEndRow&&y===this.viewportStartRow&&u>=this.startCol)}}s.createSelectionRenderModel=function(){return new c}},509:(L,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TextureAtlas=void 0;const m=c(237),_=c(860),u=c(374),y=c(160),S=c(345),E=c(485),g=c(385),a=c(147),f=c(855),d={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 h;class C{get pages(){return this._pages}constructor(T,N,F){this._document=T,this._config=N,this._unicodeService=F,this._didWarmUp=!1,this._cacheMap=new E.FourKeyMap,this._cacheMapCombined=new E.FourKeyMap,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new a.AttributeData,this._textureSize=512,this._onAddTextureAtlasCanvas=new S.EventEmitter,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new S.EventEmitter,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=M(T,4*this._config.deviceCellWidth+4,this._config.deviceCellHeight+4),this._tmpCtx=(0,u.throwIfFalsy)(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}dispose(){for(const T of this.pages)T.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){const T=new g.IdleTaskQueue;for(let N=33;N<126;N++)T.enqueue((()=>{if(!this._cacheMap.get(N,f.DEFAULT_COLOR,f.DEFAULT_COLOR,f.DEFAULT_EXT)){const F=this._drawToCache(N,f.DEFAULT_COLOR,f.DEFAULT_COLOR,f.DEFAULT_EXT);this._cacheMap.set(N,f.DEFAULT_COLOR,f.DEFAULT_COLOR,f.DEFAULT_EXT,F)}}))}beginFrame(){return this._requestClearModel}clearTexture(){if(this._pages[0].currentRow.x!==0||this._pages[0].currentRow.y!==0){for(const T of this._pages)T.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(C.maxAtlasPages&&this._pages.length>=Math.max(4,C.maxAtlasPages)){const N=this._pages.filter((G=>2*G.canvas.width<=(C.maxTextureSize||4096))).sort(((G,Y)=>Y.canvas.width!==G.canvas.width?Y.canvas.width-G.canvas.width:Y.percentageUsed-G.percentageUsed));let F=-1,P=0;for(let G=0;G<N.length;G++)if(N[G].canvas.width!==P)F=G,P=N[G].canvas.width;else if(G-F==3)break;const B=N.slice(F,F+4),H=B.map((G=>G.glyphs[0].texturePage)).sort(((G,Y)=>G>Y?1:-1)),q=this.pages.length-B.length,X=this._mergePages(B,q);X.version++;for(let G=H.length-1;G>=0;G--)this._deletePage(H[G]);this.pages.push(X),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(X.canvas)}const T=new D(this._document,this._textureSize);return this._pages.push(T),this._activePages.push(T),this._onAddTextureAtlasCanvas.fire(T.canvas),T}_mergePages(T,N){const F=2*T[0].canvas.width,P=new D(this._document,F,T);for(const[B,H]of T.entries()){const q=B*H.canvas.width%F,X=Math.floor(B/2)*H.canvas.height;P.ctx.drawImage(H.canvas,q,X);for(const Y of H.glyphs)Y.texturePage=N,Y.sizeClipSpace.x=Y.size.x/F,Y.sizeClipSpace.y=Y.size.y/F,Y.texturePosition.x+=q,Y.texturePosition.y+=X,Y.texturePositionClipSpace.x=Y.texturePosition.x/F,Y.texturePositionClipSpace.y=Y.texturePosition.y/F;this._onRemoveTextureAtlasCanvas.fire(H.canvas);const G=this._activePages.indexOf(H);G!==-1&&this._activePages.splice(G,1)}return P}_deletePage(T){this._pages.splice(T,1);for(let N=T;N<this._pages.length;N++){const F=this._pages[N];for(const P of F.glyphs)P.texturePage--;F.version++}}getRasterizedGlyphCombinedChar(T,N,F,P,B){return this._getFromCacheMap(this._cacheMapCombined,T,N,F,P,B)}getRasterizedGlyph(T,N,F,P,B){return this._getFromCacheMap(this._cacheMap,T,N,F,P,B)}_getFromCacheMap(T,N,F,P,B,H=!1){return h=T.get(N,F,P,B),h||(h=this._drawToCache(N,F,P,B,H),T.set(N,F,P,B,h)),h}_getColorFromAnsiIndex(T){if(T>=this._config.colors.ansi.length)throw new Error("No color found for idx "+T);return this._config.colors.ansi[T]}_getBackgroundColor(T,N,F,P){if(this._config.allowTransparency)return y.NULL_COLOR;let B;switch(T){case 16777216:case 33554432:B=this._getColorFromAnsiIndex(N);break;case 50331648:const H=a.AttributeData.toColorRGB(N);B=y.channels.toColor(H[0],H[1],H[2]);break;default:B=F?y.color.opaque(this._config.colors.foreground):this._config.colors.background}return B}_getForegroundColor(T,N,F,P,B,H,q,X,G,Y){const j=this._getMinimumContrastColor(T,N,F,P,B,H,q,G,X,Y);if(j)return j;let U;switch(B){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&G&&H<8&&(H+=8),U=this._getColorFromAnsiIndex(H);break;case 50331648:const $=a.AttributeData.toColorRGB(H);U=y.channels.toColor($[0],$[1],$[2]);break;default:U=q?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(U=y.color.opaque(U)),X&&(U=y.color.multiplyOpacity(U,m.DIM_OPACITY)),U}_resolveBackgroundRgba(T,N,F){switch(T){case 16777216:case 33554432:return this._getColorFromAnsiIndex(N).rgba;case 50331648:return N<<8;default:return F?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(T,N,F,P){switch(T){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&P&&N<8&&(N+=8),this._getColorFromAnsiIndex(N).rgba;case 50331648:return N<<8;default:return F?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(T,N,F,P,B,H,q,X,G,Y){if(this._config.minimumContrastRatio===1||Y)return;const j=this._getContrastCache(G),U=j.getColor(T,P);if(U!==void 0)return U||void 0;const $=this._resolveBackgroundRgba(N,F,q),V=this._resolveForegroundRgba(B,H,q,X),ne=y.rgba.ensureContrastRatio($,V,this._config.minimumContrastRatio/(G?2:1));if(!ne)return void j.setColor(T,P,null);const se=y.channels.toColor(ne>>24&255,ne>>16&255,ne>>8&255);return j.setColor(T,P,se),se}_getContrastCache(T){return T?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(T,N,F,P,B=!1){const H=typeof T=="number"?String.fromCharCode(T):T,q=Math.min(this._config.deviceCellWidth*Math.max(H.length,2)+4,this._textureSize);this._tmpCanvas.width<q&&(this._tmpCanvas.width=q);const X=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<X&&(this._tmpCanvas.height=X),this._tmpCtx.save(),this._workAttributeData.fg=F,this._workAttributeData.bg=N,this._workAttributeData.extended.ext=P,this._workAttributeData.isInvisible())return d;const G=!!this._workAttributeData.isBold(),Y=!!this._workAttributeData.isInverse(),j=!!this._workAttributeData.isDim(),U=!!this._workAttributeData.isItalic(),$=!!this._workAttributeData.isUnderline(),V=!!this._workAttributeData.isStrikethrough(),ne=!!this._workAttributeData.isOverline();let se=this._workAttributeData.getFgColor(),ce=this._workAttributeData.getFgColorMode(),he=this._workAttributeData.getBgColor(),K=this._workAttributeData.getBgColorMode();if(Y){const Le=se;se=he,he=Le;const Ke=ce;ce=K,K=Ke}const W=this._getBackgroundColor(K,he,Y,j);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=W.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";const J=G?this._config.fontWeightBold:this._config.fontWeight,Z=U?"italic":"";this._tmpCtx.font=`${Z} ${J} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=m.TEXT_BASELINE;const de=H.length===1&&(0,u.isPowerlineGlyph)(H.charCodeAt(0)),ee=H.length===1&&(0,u.isRestrictedPowerlineGlyph)(H.charCodeAt(0)),xe=this._getForegroundColor(N,K,he,F,ce,se,Y,j,G,(0,u.treatGlyphAsBackgroundColor)(H.charCodeAt(0)));this._tmpCtx.fillStyle=xe.css;const ke=ee?0:4;let le=!1;this._config.customGlyphs!==!1&&(le=(0,_.tryDrawCustomChar)(this._tmpCtx,H,ke,ke,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let we,me=!de;if(we=typeof T=="number"?this._unicodeService.wcwidth(T):this._unicodeService.getStringCellWidth(T),$){this._tmpCtx.save();const Le=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),Ke=Le%2==1?.5:0;if(this._tmpCtx.lineWidth=Le,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())me=!1,this._tmpCtx.strokeStyle=`rgb(${a.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{me=!1;let Ze=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&Ze<8&&(Ze+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(Ze).css}this._tmpCtx.beginPath();const $e=ke,tt=Math.ceil(ke+this._config.deviceCharHeight)-Ke-(B?2*Le:0),St=tt+Le,ze=tt+2*Le;let ut=this._workAttributeData.getUnderlineVariantOffset();for(let Ze=0;Ze<we;Ze++){this._tmpCtx.save();const ge=$e+Ze*this._config.deviceCellWidth,Re=$e+(Ze+1)*this._config.deviceCellWidth,rt=ge+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(ge,tt),this._tmpCtx.lineTo(Re,tt),this._tmpCtx.moveTo(ge,ze),this._tmpCtx.lineTo(Re,ze);break;case 3:const at=Le<=1?ze:Math.ceil(ke+this._config.deviceCharHeight-Le/2)-Ke,Ee=Le<=1?tt:Math.ceil(ke+this._config.deviceCharHeight+Le/2)-Ke,Ue=new Path2D;Ue.rect(ge,tt,this._config.deviceCellWidth,ze-tt),this._tmpCtx.clip(Ue),this._tmpCtx.moveTo(ge-this._config.deviceCellWidth/2,St),this._tmpCtx.bezierCurveTo(ge-this._config.deviceCellWidth/2,Ee,ge,Ee,ge,St),this._tmpCtx.bezierCurveTo(ge,at,rt,at,rt,St),this._tmpCtx.bezierCurveTo(rt,Ee,Re,Ee,Re,St),this._tmpCtx.bezierCurveTo(Re,at,Re+this._config.deviceCellWidth/2,at,Re+this._config.deviceCellWidth/2,St);break;case 4:const fe=ut===0?0:ut>=Le?2*Le-ut:Le-ut;ut>=Le||fe===0?(this._tmpCtx.setLineDash([Math.round(Le),Math.round(Le)]),this._tmpCtx.moveTo(ge+fe,tt),this._tmpCtx.lineTo(Re,tt)):(this._tmpCtx.setLineDash([Math.round(Le),Math.round(Le)]),this._tmpCtx.moveTo(ge,tt),this._tmpCtx.lineTo(ge+fe,tt),this._tmpCtx.moveTo(ge+fe+Le,tt),this._tmpCtx.lineTo(Re,tt)),ut=(0,u.computeNextVariantOffset)(Re-ge,Le,ut);break;case 5:const pe=.6,Me=.3,lt=Re-ge,je=Math.floor(pe*lt),Ge=Math.floor(Me*lt),ht=lt-je-Ge;this._tmpCtx.setLineDash([je,Ge,ht]),this._tmpCtx.moveTo(ge,tt),this._tmpCtx.lineTo(Re,tt);break;default:this._tmpCtx.moveTo(ge,tt),this._tmpCtx.lineTo(Re,tt)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!le&&this._config.fontSize>=12&&!this._config.allowTransparency&&H!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";const Ze=this._tmpCtx.measureText(H);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in Ze&&Ze.actualBoundingBoxDescent>0){this._tmpCtx.save();const ge=new Path2D;ge.rect($e,tt-Math.ceil(Le/2),this._config.deviceCellWidth*we,ze-tt+Math.ceil(Le/2)),this._tmpCtx.clip(ge),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=W.css,this._tmpCtx.strokeText(H,ke,ke+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(ne){const Le=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),Ke=Le%2==1?.5:0;this._tmpCtx.lineWidth=Le,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(ke,ke+Ke),this._tmpCtx.lineTo(ke+this._config.deviceCharWidth*we,ke+Ke),this._tmpCtx.stroke()}if(le||this._tmpCtx.fillText(H,ke,ke+this._config.deviceCharHeight),H==="_"&&!this._config.allowTransparency){let Le=x(this._tmpCtx.getImageData(ke,ke,this._config.deviceCellWidth,this._config.deviceCellHeight),W,xe,me);if(Le)for(let Ke=1;Ke<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=W.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(H,ke,ke+this._config.deviceCharHeight-Ke),Le=x(this._tmpCtx.getImageData(ke,ke,this._config.deviceCellWidth,this._config.deviceCellHeight),W,xe,me),Le);Ke++);}if(V){const Le=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),Ke=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=Le,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(ke,ke+Math.floor(this._config.deviceCharHeight/2)-Ke),this._tmpCtx.lineTo(ke+this._config.deviceCharWidth*we,ke+Math.floor(this._config.deviceCharHeight/2)-Ke),this._tmpCtx.stroke()}this._tmpCtx.restore();const Qe=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height);let nt;if(nt=this._config.allowTransparency?(function(Le){for(let Ke=0;Ke<Le.data.length;Ke+=4)if(Le.data[Ke+3]>0)return!1;return!0})(Qe):x(Qe,W,xe,me),nt)return d;const De=this._findGlyphBoundingBox(Qe,this._workBoundingBox,q,ee,le,ke);let Te,We;for(;;){if(this._activePages.length===0){const Le=this._createNewPage();Te=Le,We=Le.currentRow,We.height=De.size.y;break}Te=this._activePages[this._activePages.length-1],We=Te.currentRow;for(const Le of this._activePages)De.size.y<=Le.currentRow.height&&(Te=Le,We=Le.currentRow);for(let Le=this._activePages.length-1;Le>=0;Le--)for(const Ke of this._activePages[Le].fixedRows)Ke.height<=We.height&&De.size.y<=Ke.height&&(Te=this._activePages[Le],We=Ke);if(We.y+De.size.y>=Te.canvas.height||We.height>De.size.y+2){let Le=!1;if(Te.currentRow.y+Te.currentRow.height+De.size.y>=Te.canvas.height){let Ke;for(const $e of this._activePages)if($e.currentRow.y+$e.currentRow.height+De.size.y<$e.canvas.height){Ke=$e;break}if(Ke)Te=Ke;else if(C.maxAtlasPages&&this._pages.length>=C.maxAtlasPages&&We.y+De.size.y<=Te.canvas.height&&We.height>=De.size.y&&We.x+De.size.x<=Te.canvas.width)Le=!0;else{const $e=this._createNewPage();Te=$e,We=$e.currentRow,We.height=De.size.y,Le=!0}}Le||(Te.currentRow.height>0&&Te.fixedRows.push(Te.currentRow),We={x:0,y:Te.currentRow.y+Te.currentRow.height,height:De.size.y},Te.fixedRows.push(We),Te.currentRow={x:0,y:We.y+We.height,height:0})}if(We.x+De.size.x<=Te.canvas.width)break;We===Te.currentRow?(We.x=0,We.y+=We.height,We.height=0):Te.fixedRows.splice(Te.fixedRows.indexOf(We),1)}return De.texturePage=this._pages.indexOf(Te),De.texturePosition.x=We.x,De.texturePosition.y=We.y,De.texturePositionClipSpace.x=We.x/Te.canvas.width,De.texturePositionClipSpace.y=We.y/Te.canvas.height,De.sizeClipSpace.x/=Te.canvas.width,De.sizeClipSpace.y/=Te.canvas.height,We.height=Math.max(We.height,De.size.y),We.x+=De.size.x,Te.ctx.putImageData(Qe,De.texturePosition.x-this._workBoundingBox.left,De.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,De.size.x,De.size.y),Te.addGlyph(De),Te.version++,De}_findGlyphBoundingBox(T,N,F,P,B,H){N.top=0;const q=P?this._config.deviceCellHeight:this._tmpCanvas.height,X=P?this._config.deviceCellWidth:F;let G=!1;for(let Y=0;Y<q;Y++){for(let j=0;j<X;j++){const U=Y*this._tmpCanvas.width*4+4*j+3;if(T.data[U]!==0){N.top=Y,G=!0;break}}if(G)break}N.left=0,G=!1;for(let Y=0;Y<H+X;Y++){for(let j=0;j<q;j++){const U=j*this._tmpCanvas.width*4+4*Y+3;if(T.data[U]!==0){N.left=Y,G=!0;break}}if(G)break}N.right=X,G=!1;for(let Y=H+X-1;Y>=H;Y--){for(let j=0;j<q;j++){const U=j*this._tmpCanvas.width*4+4*Y+3;if(T.data[U]!==0){N.right=Y,G=!0;break}}if(G)break}N.bottom=q,G=!1;for(let Y=q-1;Y>=0;Y--){for(let j=0;j<X;j++){const U=Y*this._tmpCanvas.width*4+4*j+3;if(T.data[U]!==0){N.bottom=Y,G=!0;break}}if(G)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:N.right-N.left+1,y:N.bottom-N.top+1},sizeClipSpace:{x:N.right-N.left+1,y:N.bottom-N.top+1},offset:{x:-N.left+H+(P||B?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-N.top+H+(P||B?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}}s.TextureAtlas=C;class D{get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(T){this._glyphs.push(T),this._usedPixels+=T.size.x*T.size.y}constructor(T,N,F){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],F)for(const P of F)this._glyphs.push(...P.glyphs),this._usedPixels+=P._usedPixels;this.canvas=M(T,N,N),this.ctx=(0,u.throwIfFalsy)(this.canvas.getContext("2d",{alpha:!0}))}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}}function x(b,T,N,F){const P=T.rgba>>>24,B=T.rgba>>>16&255,H=T.rgba>>>8&255,q=N.rgba>>>24,X=N.rgba>>>16&255,G=N.rgba>>>8&255,Y=Math.floor((Math.abs(P-q)+Math.abs(B-X)+Math.abs(H-G))/12);let j=!0;for(let U=0;U<b.data.length;U+=4)b.data[U]===P&&b.data[U+1]===B&&b.data[U+2]===H||F&&Math.abs(b.data[U]-P)+Math.abs(b.data[U+1]-B)+Math.abs(b.data[U+2]-H)<Y?b.data[U+3]=0:j=!1;return j}function M(b,T,N){const F=b.createElement("canvas");return F.width=T,F.height=N,F}},160:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.contrastRatio=s.toPaddedHex=s.rgba=s.rgb=s.css=s.color=s.channels=s.NULL_COLOR=void 0;let c=0,m=0,_=0,u=0;var y,S,E,g,a;function f(h){const C=h.toString(16);return C.length<2?"0"+C:C}function d(h,C){return h<C?(C+.05)/(h+.05):(h+.05)/(C+.05)}s.NULL_COLOR={css:"#00000000",rgba:0},(function(h){h.toCss=function(C,D,x,M){return M!==void 0?`#${f(C)}${f(D)}${f(x)}${f(M)}`:`#${f(C)}${f(D)}${f(x)}`},h.toRgba=function(C,D,x,M=255){return(C<<24|D<<16|x<<8|M)>>>0},h.toColor=function(C,D,x,M){return{css:h.toCss(C,D,x,M),rgba:h.toRgba(C,D,x,M)}}})(y||(s.channels=y={})),(function(h){function C(D,x){return u=Math.round(255*x),[c,m,_]=a.toChannels(D.rgba),{css:y.toCss(c,m,_,u),rgba:y.toRgba(c,m,_,u)}}h.blend=function(D,x){if(u=(255&x.rgba)/255,u===1)return{css:x.css,rgba:x.rgba};const M=x.rgba>>24&255,b=x.rgba>>16&255,T=x.rgba>>8&255,N=D.rgba>>24&255,F=D.rgba>>16&255,P=D.rgba>>8&255;return c=N+Math.round((M-N)*u),m=F+Math.round((b-F)*u),_=P+Math.round((T-P)*u),{css:y.toCss(c,m,_),rgba:y.toRgba(c,m,_)}},h.isOpaque=function(D){return(255&D.rgba)==255},h.ensureContrastRatio=function(D,x,M){const b=a.ensureContrastRatio(D.rgba,x.rgba,M);if(b)return y.toColor(b>>24&255,b>>16&255,b>>8&255)},h.opaque=function(D){const x=(255|D.rgba)>>>0;return[c,m,_]=a.toChannels(x),{css:y.toCss(c,m,_),rgba:x}},h.opacity=C,h.multiplyOpacity=function(D,x){return u=255&D.rgba,C(D,u*x/255)},h.toColorRGB=function(D){return[D.rgba>>24&255,D.rgba>>16&255,D.rgba>>8&255]}})(S||(s.color=S={})),(function(h){let C,D;try{const x=document.createElement("canvas");x.width=1,x.height=1;const M=x.getContext("2d",{willReadFrequently:!0});M&&(C=M,C.globalCompositeOperation="copy",D=C.createLinearGradient(0,0,1,1))}catch{}h.toColor=function(x){if(x.match(/#[\da-f]{3,8}/i))switch(x.length){case 4:return c=parseInt(x.slice(1,2).repeat(2),16),m=parseInt(x.slice(2,3).repeat(2),16),_=parseInt(x.slice(3,4).repeat(2),16),y.toColor(c,m,_);case 5:return c=parseInt(x.slice(1,2).repeat(2),16),m=parseInt(x.slice(2,3).repeat(2),16),_=parseInt(x.slice(3,4).repeat(2),16),u=parseInt(x.slice(4,5).repeat(2),16),y.toColor(c,m,_,u);case 7:return{css:x,rgba:(parseInt(x.slice(1),16)<<8|255)>>>0};case 9:return{css:x,rgba:parseInt(x.slice(1),16)>>>0}}const M=x.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(M)return c=parseInt(M[1]),m=parseInt(M[2]),_=parseInt(M[3]),u=Math.round(255*(M[5]===void 0?1:parseFloat(M[5]))),y.toColor(c,m,_,u);if(!C||!D)throw new Error("css.toColor: Unsupported css format");if(C.fillStyle=D,C.fillStyle=x,typeof C.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(C.fillRect(0,0,1,1),[c,m,_,u]=C.getImageData(0,0,1,1).data,u!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:y.toRgba(c,m,_,u),css:x}}})(E||(s.css=E={})),(function(h){function C(D,x,M){const b=D/255,T=x/255,N=M/255;return .2126*(b<=.03928?b/12.92:Math.pow((b+.055)/1.055,2.4))+.7152*(T<=.03928?T/12.92:Math.pow((T+.055)/1.055,2.4))+.0722*(N<=.03928?N/12.92:Math.pow((N+.055)/1.055,2.4))}h.relativeLuminance=function(D){return C(D>>16&255,D>>8&255,255&D)},h.relativeLuminance2=C})(g||(s.rgb=g={})),(function(h){function C(x,M,b){const T=x>>24&255,N=x>>16&255,F=x>>8&255;let P=M>>24&255,B=M>>16&255,H=M>>8&255,q=d(g.relativeLuminance2(P,B,H),g.relativeLuminance2(T,N,F));for(;q<b&&(P>0||B>0||H>0);)P-=Math.max(0,Math.ceil(.1*P)),B-=Math.max(0,Math.ceil(.1*B)),H-=Math.max(0,Math.ceil(.1*H)),q=d(g.relativeLuminance2(P,B,H),g.relativeLuminance2(T,N,F));return(P<<24|B<<16|H<<8|255)>>>0}function D(x,M,b){const T=x>>24&255,N=x>>16&255,F=x>>8&255;let P=M>>24&255,B=M>>16&255,H=M>>8&255,q=d(g.relativeLuminance2(P,B,H),g.relativeLuminance2(T,N,F));for(;q<b&&(P<255||B<255||H<255);)P=Math.min(255,P+Math.ceil(.1*(255-P))),B=Math.min(255,B+Math.ceil(.1*(255-B))),H=Math.min(255,H+Math.ceil(.1*(255-H))),q=d(g.relativeLuminance2(P,B,H),g.relativeLuminance2(T,N,F));return(P<<24|B<<16|H<<8|255)>>>0}h.blend=function(x,M){if(u=(255&M)/255,u===1)return M;const b=M>>24&255,T=M>>16&255,N=M>>8&255,F=x>>24&255,P=x>>16&255,B=x>>8&255;return c=F+Math.round((b-F)*u),m=P+Math.round((T-P)*u),_=B+Math.round((N-B)*u),y.toRgba(c,m,_)},h.ensureContrastRatio=function(x,M,b){const T=g.relativeLuminance(x>>8),N=g.relativeLuminance(M>>8);if(d(T,N)<b){if(N<T){const B=C(x,M,b),H=d(T,g.relativeLuminance(B>>8));if(H<b){const q=D(x,M,b);return H>d(T,g.relativeLuminance(q>>8))?B:q}return B}const F=D(x,M,b),P=d(T,g.relativeLuminance(F>>8));if(P<b){const B=C(x,M,b);return P>d(T,g.relativeLuminance(B>>8))?F:B}return F}},h.reduceLuminance=C,h.increaseLuminance=D,h.toChannels=function(x){return[x>>24&255,x>>16&255,x>>8&255,255&x]}})(a||(s.rgba=a={})),s.toPaddedHex=f,s.contrastRatio=d},345:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.runAndSubscribe=s.forwardEvent=s.EventEmitter=void 0,s.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 _=[];for(let u=0;u<this._listeners.length;u++)_.push(this._listeners[u]);for(let u=0;u<_.length;u++)_[u].call(void 0,c,m)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},s.forwardEvent=function(c,m){return c((_=>m.fire(_)))},s.runAndSubscribe=function(c,m){return m(void 0),c((_=>m(_)))}},859:(L,s)=>{function c(m){for(const _ of m)_.dispose();m.length=0}Object.defineProperty(s,"__esModule",{value:!0}),s.getDisposeArrayDisposable=s.disposeArray=s.toDisposable=s.MutableDisposable=s.Disposable=void 0,s.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 _=this._disposables.indexOf(m);_!==-1&&this._disposables.splice(_,1)}},s.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(m){var _;this._isDisposed||m===this._value||((_=this._value)==null||_.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}},s.toDisposable=function(m){return{dispose:m}},s.disposeArray=c,s.getDisposeArrayDisposable=function(m){return{dispose:()=>c(m)}}},485:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.FourKeyMap=s.TwoKeyMap=void 0;class c{constructor(){this._data={}}set(_,u,y){this._data[_]||(this._data[_]={}),this._data[_][u]=y}get(_,u){return this._data[_]?this._data[_][u]:void 0}clear(){this._data={}}}s.TwoKeyMap=c,s.FourKeyMap=class{constructor(){this._data=new c}set(m,_,u,y,S){this._data.get(m,_)||this._data.set(m,_,new c),this._data.get(m,_).set(u,y,S)}get(m,_,u,y){var S;return(S=this._data.get(m,_))==null?void 0:S.get(u,y)}clear(){this._data.clear()}}},399:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.isChromeOS=s.isLinux=s.isWindows=s.isIphone=s.isIpad=s.isMac=s.getSafariVersion=s.isSafari=s.isLegacyEdge=s.isFirefox=s.isNode=void 0,s.isNode=typeof process<"u"&&"title"in process;const c=s.isNode?"node":navigator.userAgent,m=s.isNode?"node":navigator.platform;s.isFirefox=c.includes("Firefox"),s.isLegacyEdge=c.includes("Edge"),s.isSafari=/^((?!chrome|android).)*safari/i.test(c),s.getSafariVersion=function(){if(!s.isSafari)return 0;const _=c.match(/Version\/(\d+)/);return _===null||_.length<2?0:parseInt(_[1])},s.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(m),s.isIpad=m==="iPad",s.isIphone=m==="iPhone",s.isWindows=["Windows","Win16","Win32","WinCE"].includes(m),s.isLinux=m.indexOf("Linux")>=0,s.isChromeOS=/\bCrOS\b/.test(c)},385:(L,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DebouncedIdleTask=s.IdleTaskQueue=s.PriorityTaskQueue=void 0;const m=c(399);class _{constructor(){this._tasks=[],this._i=0}enqueue(S){this._tasks.push(S),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(S){this._idleCallback=void 0;let E=0,g=0,a=S.timeRemaining(),f=0;for(;this._i<this._tasks.length;){if(E=Date.now(),this._tasks[this._i]()||this._i++,E=Math.max(1,Date.now()-E),g=Math.max(E,g),f=S.timeRemaining(),1.5*g>f)return a-E<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(a-E))}ms`),void this._start();a=f}this.clear()}}class u extends _{_requestCallback(S){return setTimeout((()=>S(this._createDeadline(16))))}_cancelCallback(S){clearTimeout(S)}_createDeadline(S){const E=Date.now()+S;return{timeRemaining:()=>Math.max(0,E-Date.now())}}}s.PriorityTaskQueue=u,s.IdleTaskQueue=!m.isNode&&"requestIdleCallback"in window?class extends _{_requestCallback(y){return requestIdleCallback(y)}_cancelCallback(y){cancelIdleCallback(y)}}:u,s.DebouncedIdleTask=class{constructor(){this._queue=new s.IdleTaskQueue}set(y){this._queue.clear(),this._queue.enqueue(y)}flush(){this._queue.flush()}}},147:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ExtendedAttrs=s.AttributeData=void 0;class c{constructor(){this.fg=0,this.bg=0,this.extended=new m}static toColorRGB(u){return[u>>>16&255,u>>>8&255,255&u]}static fromColorRGB(u){return(255&u[0])<<16|(255&u[1])<<8|255&u[2]}clone(){const u=new c;return u.fg=this.fg,u.bg=this.bg,u.extended=this.extended.clone(),u}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}}s.AttributeData=c;class m{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(u){this._ext=u}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(u){this._ext&=-469762049,this._ext|=u<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(u){this._ext&=-67108864,this._ext|=67108863&u}get urlId(){return this._urlId}set urlId(u){this._urlId=u}get underlineVariantOffset(){const u=(3758096384&this._ext)>>29;return u<0?4294967288^u:u}set underlineVariantOffset(u){this._ext&=536870911,this._ext|=u<<29&3758096384}constructor(u=0,y=0){this._ext=0,this._urlId=0,this._ext=u,this._urlId=y}clone(){return new m(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}s.ExtendedAttrs=m},782:(L,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CellData=void 0;const m=c(133),_=c(855),u=c(147);class y extends u.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new u.ExtendedAttrs,this.combinedData=""}static fromCharData(E){const g=new y;return g.setFromCharData(E),g}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(E){this.fg=E[_.CHAR_DATA_ATTR_INDEX],this.bg=0;let g=!1;if(E[_.CHAR_DATA_CHAR_INDEX].length>2)g=!0;else if(E[_.CHAR_DATA_CHAR_INDEX].length===2){const a=E[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=a&&a<=56319){const f=E[_.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=f&&f<=57343?this.content=1024*(a-55296)+f-56320+65536|E[_.CHAR_DATA_WIDTH_INDEX]<<22:g=!0}else g=!0}else this.content=E[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|E[_.CHAR_DATA_WIDTH_INDEX]<<22;g&&(this.combinedData=E[_.CHAR_DATA_CHAR_INDEX],this.content=2097152|E[_.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}s.CellData=y},855:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WHITESPACE_CELL_CODE=s.WHITESPACE_CELL_WIDTH=s.WHITESPACE_CELL_CHAR=s.NULL_CELL_CODE=s.NULL_CELL_WIDTH=s.NULL_CELL_CHAR=s.CHAR_DATA_CODE_INDEX=s.CHAR_DATA_WIDTH_INDEX=s.CHAR_DATA_CHAR_INDEX=s.CHAR_DATA_ATTR_INDEX=s.DEFAULT_EXT=s.DEFAULT_ATTR=s.DEFAULT_COLOR=void 0,s.DEFAULT_COLOR=0,s.DEFAULT_ATTR=256|s.DEFAULT_COLOR<<9,s.DEFAULT_EXT=0,s.CHAR_DATA_ATTR_INDEX=0,s.CHAR_DATA_CHAR_INDEX=1,s.CHAR_DATA_WIDTH_INDEX=2,s.CHAR_DATA_CODE_INDEX=3,s.NULL_CELL_CHAR="",s.NULL_CELL_WIDTH=1,s.NULL_CELL_CODE=0,s.WHITESPACE_CELL_CHAR=" ",s.WHITESPACE_CELL_WIDTH=1,s.WHITESPACE_CELL_CODE=32},133:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Utf8ToUtf32=s.StringToUtf32=s.utf32ToString=s.stringFromCodePoint=void 0,s.stringFromCodePoint=function(c){return c>65535?(c-=65536,String.fromCharCode(55296+(c>>10))+String.fromCharCode(c%1024+56320)):String.fromCharCode(c)},s.utf32ToString=function(c,m=0,_=c.length){let u="";for(let y=m;y<_;++y){let S=c[y];S>65535?(S-=65536,u+=String.fromCharCode(55296+(S>>10))+String.fromCharCode(S%1024+56320)):u+=String.fromCharCode(S)}return u},s.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(c,m){const _=c.length;if(!_)return 0;let u=0,y=0;if(this._interim){const S=c.charCodeAt(y++);56320<=S&&S<=57343?m[u++]=1024*(this._interim-55296)+S-56320+65536:(m[u++]=this._interim,m[u++]=S),this._interim=0}for(let S=y;S<_;++S){const E=c.charCodeAt(S);if(55296<=E&&E<=56319){if(++S>=_)return this._interim=E,u;const g=c.charCodeAt(S);56320<=g&&g<=57343?m[u++]=1024*(E-55296)+g-56320+65536:(m[u++]=E,m[u++]=g)}else E!==65279&&(m[u++]=E)}return u}},s.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(c,m){const _=c.length;if(!_)return 0;let u,y,S,E,g=0,a=0,f=0;if(this.interim[0]){let C=!1,D=this.interim[0];D&=(224&D)==192?31:(240&D)==224?15:7;let x,M=0;for(;(x=63&this.interim[++M])&&M<4;)D<<=6,D|=x;const b=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,T=b-M;for(;f<T;){if(f>=_)return 0;if(x=c[f++],(192&x)!=128){f--,C=!0;break}this.interim[M++]=x,D<<=6,D|=63&x}C||(b===2?D<128?f--:m[g++]=D:b===3?D<2048||D>=55296&&D<=57343||D===65279||(m[g++]=D):D<65536||D>1114111||(m[g++]=D)),this.interim.fill(0)}const d=_-4;let h=f;for(;h<_;){for(;!(!(h<d)||128&(u=c[h])||128&(y=c[h+1])||128&(S=c[h+2])||128&(E=c[h+3]));)m[g++]=u,m[g++]=y,m[g++]=S,m[g++]=E,h+=4;if(u=c[h++],u<128)m[g++]=u;else if((224&u)==192){if(h>=_)return this.interim[0]=u,g;if(y=c[h++],(192&y)!=128){h--;continue}if(a=(31&u)<<6|63&y,a<128){h--;continue}m[g++]=a}else if((240&u)==224){if(h>=_)return this.interim[0]=u,g;if(y=c[h++],(192&y)!=128){h--;continue}if(h>=_)return this.interim[0]=u,this.interim[1]=y,g;if(S=c[h++],(192&S)!=128){h--;continue}if(a=(15&u)<<12|(63&y)<<6|63&S,a<2048||a>=55296&&a<=57343||a===65279)continue;m[g++]=a}else if((248&u)==240){if(h>=_)return this.interim[0]=u,g;if(y=c[h++],(192&y)!=128){h--;continue}if(h>=_)return this.interim[0]=u,this.interim[1]=y,g;if(S=c[h++],(192&S)!=128){h--;continue}if(h>=_)return this.interim[0]=u,this.interim[1]=y,this.interim[2]=S,g;if(E=c[h++],(192&E)!=128){h--;continue}if(a=(7&u)<<18|(63&y)<<12|(63&S)<<6|63&E,a<65536||a>1114111)continue;m[g++]=a}}return g}}},776:function(L,s,c){var m=this&&this.__decorate||function(a,f,d,h){var C,D=arguments.length,x=D<3?f:h===null?h=Object.getOwnPropertyDescriptor(f,d):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(a,f,d,h);else for(var M=a.length-1;M>=0;M--)(C=a[M])&&(x=(D<3?C(x):D>3?C(f,d,x):C(f,d))||x);return D>3&&x&&Object.defineProperty(f,d,x),x},_=this&&this.__param||function(a,f){return function(d,h){f(d,h,a)}};Object.defineProperty(s,"__esModule",{value:!0}),s.traceCall=s.setTraceLogger=s.LogService=void 0;const u=c(859),y=c(97),S={trace:y.LogLevelEnum.TRACE,debug:y.LogLevelEnum.DEBUG,info:y.LogLevelEnum.INFO,warn:y.LogLevelEnum.WARN,error:y.LogLevelEnum.ERROR,off:y.LogLevelEnum.OFF};let E,g=s.LogService=class extends u.Disposable{get logLevel(){return this._logLevel}constructor(a){super(),this._optionsService=a,this._logLevel=y.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),E=this}_updateLogLevel(){this._logLevel=S[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(a){for(let f=0;f<a.length;f++)typeof a[f]=="function"&&(a[f]=a[f]())}_log(a,f,d){this._evalLazyOptionalParams(d),a.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+f,...d)}trace(a,...f){var d;this._logLevel<=y.LogLevelEnum.TRACE&&this._log(((d=this._optionsService.options.logger)==null?void 0:d.trace.bind(this._optionsService.options.logger))??console.log,a,f)}debug(a,...f){var d;this._logLevel<=y.LogLevelEnum.DEBUG&&this._log(((d=this._optionsService.options.logger)==null?void 0:d.debug.bind(this._optionsService.options.logger))??console.log,a,f)}info(a,...f){var d;this._logLevel<=y.LogLevelEnum.INFO&&this._log(((d=this._optionsService.options.logger)==null?void 0:d.info.bind(this._optionsService.options.logger))??console.info,a,f)}warn(a,...f){var d;this._logLevel<=y.LogLevelEnum.WARN&&this._log(((d=this._optionsService.options.logger)==null?void 0:d.warn.bind(this._optionsService.options.logger))??console.warn,a,f)}error(a,...f){var d;this._logLevel<=y.LogLevelEnum.ERROR&&this._log(((d=this._optionsService.options.logger)==null?void 0:d.error.bind(this._optionsService.options.logger))??console.error,a,f)}};s.LogService=g=m([_(0,y.IOptionsService)],g),s.setTraceLogger=function(a){E=a},s.traceCall=function(a,f,d){if(typeof d.value!="function")throw new Error("not supported");const h=d.value;d.value=function(...C){if(E.logLevel!==y.LogLevelEnum.TRACE)return h.apply(this,C);E.trace(`GlyphRenderer#${h.name}(${C.map((x=>JSON.stringify(x))).join(", ")})`);const D=h.apply(this,C);return E.trace(`GlyphRenderer#${h.name} return`,D),D}}},726:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.createDecorator=s.getServiceDependencies=s.serviceRegistry=void 0;const c="di$target",m="di$dependencies";s.serviceRegistry=new Map,s.getServiceDependencies=function(_){return _[m]||[]},s.createDecorator=function(_){if(s.serviceRegistry.has(_))return s.serviceRegistry.get(_);const u=function(y,S,E){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(g,a,f){a[c]===a?a[m].push({id:g,index:f}):(a[m]=[{id:g,index:f}],a[c]=a)})(u,y,E)};return u.toString=()=>_,s.serviceRegistry.set(_,u),u}},97:(L,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.IDecorationService=s.IUnicodeService=s.IOscLinkService=s.IOptionsService=s.ILogService=s.LogLevelEnum=s.IInstantiationService=s.ICharsetService=s.ICoreService=s.ICoreMouseService=s.IBufferService=void 0;const m=c(726);var _;s.IBufferService=(0,m.createDecorator)("BufferService"),s.ICoreMouseService=(0,m.createDecorator)("CoreMouseService"),s.ICoreService=(0,m.createDecorator)("CoreService"),s.ICharsetService=(0,m.createDecorator)("CharsetService"),s.IInstantiationService=(0,m.createDecorator)("InstantiationService"),(function(u){u[u.TRACE=0]="TRACE",u[u.DEBUG=1]="DEBUG",u[u.INFO=2]="INFO",u[u.WARN=3]="WARN",u[u.ERROR=4]="ERROR",u[u.OFF=5]="OFF"})(_||(s.LogLevelEnum=_={})),s.ILogService=(0,m.createDecorator)("LogService"),s.IOptionsService=(0,m.createDecorator)("OptionsService"),s.IOscLinkService=(0,m.createDecorator)("OscLinkService"),s.IUnicodeService=(0,m.createDecorator)("UnicodeService"),s.IDecorationService=(0,m.createDecorator)("DecorationService")}},p={};function w(L){var s=p[L];if(s!==void 0)return s.exports;var c=p[L]={exports:{}};return o[L].call(c.exports,c,c.exports,w),c.exports}var A={};return(()=>{var L=A;Object.defineProperty(L,"__esModule",{value:!0}),L.WebglAddon=void 0;const s=w(345),c=w(859),m=w(399),_=w(666),u=w(776);class y extends c.Disposable{constructor(E){if(m.isSafari&&(0,m.getSafariVersion)()<16){const g={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",g))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=E,this._onChangeTextureAtlas=this.register(new s.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new s.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new s.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this.register(new s.EventEmitter),this.onContextLoss=this._onContextLoss.event}activate(E){const g=E._core;if(!E.element)return void this.register(g.onWillOpen((()=>this.activate(E))));this._terminal=E;const a=g.coreService,f=g.optionsService,d=g,h=d._renderService,C=d._characterJoinerService,D=d._charSizeService,x=d._coreBrowserService,M=d._decorationService,b=d._logService,T=d._themeService;(0,u.setTraceLogger)(b),this._renderer=this.register(new _.WebglRenderer(E,C,D,x,a,M,f,T,this._preserveDrawingBuffer)),this.register((0,s.forwardEvent)(this._renderer.onContextLoss,this._onContextLoss)),this.register((0,s.forwardEvent)(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this.register((0,s.forwardEvent)(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this.register((0,s.forwardEvent)(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),h.setRenderer(this._renderer),this.register((0,c.toDisposable)((()=>{const N=this._terminal._core._renderService;N.setRenderer(this._terminal._core._createRenderer()),N.handleResize(E.cols,E.rows)})))}get textureAtlas(){var E;return(E=this._renderer)==null?void 0:E.textureAtlas}clearTextureAtlas(){var E;(E=this._renderer)==null||E.clearTextureAtlas()}}L.WebglAddon=y})(),A})()))})(uc)),uc.exports}var Gw=Kw(),hc={exports:{}},ef;function Yw(){return ef||(ef=1,(function(n,r){(function(o,p){n.exports=p()})(globalThis,(()=>(()=>{var o={4567:function(L,s,c){var m=this&&this.__decorate||function(d,h,C,D){var x,M=arguments.length,b=M<3?h:D===null?D=Object.getOwnPropertyDescriptor(h,C):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(d,h,C,D);else for(var T=d.length-1;T>=0;T--)(x=d[T])&&(b=(M<3?x(b):M>3?x(h,C,b):x(h,C))||b);return M>3&&b&&Object.defineProperty(h,C,b),b},_=this&&this.__param||function(d,h){return function(C,D){h(C,D,d)}};Object.defineProperty(s,"__esModule",{value:!0}),s.AccessibilityManager=void 0;const u=c(9042),y=c(9924),S=c(844),E=c(4725),g=c(2585),a=c(3656);let f=s.AccessibilityManager=class extends S.Disposable{constructor(d,h,C,D){super(),this._terminal=d,this._coreBrowserService=C,this._renderService=D,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let x=0;x<this._terminal.rows;x++)this._rowElements[x]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[x]);if(this._topBoundaryFocusListener=x=>this._handleBoundaryFocus(x,0),this._bottomBoundaryFocusListener=x=>this._handleBoundaryFocus(x,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new y.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((x=>this._handleResize(x.rows)))),this.register(this._terminal.onRender((x=>this._refreshRows(x.start,x.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((x=>this._handleChar(x)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
109
- `)))),this.register(this._terminal.onA11yTab((x=>this._handleTab(x)))),this.register(this._terminal.onKey((x=>this._handleKey(x.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,a.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,S.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(d){for(let h=0;h<d;h++)this._handleChar(" ")}_handleChar(d){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==d&&(this._charsToAnnounce+=d):this._charsToAnnounce+=d,d===`
110
- `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=u.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(d){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(d)||this._charsToConsume.push(d)}_refreshRows(d,h){this._liveRegionDebouncer.refresh(d,h,this._terminal.rows)}_renderRows(d,h){const C=this._terminal.buffer,D=C.lines.length.toString();for(let x=d;x<=h;x++){const M=C.lines.get(C.ydisp+x),b=[],T=(M==null?void 0:M.translateToString(!0,void 0,void 0,b))||"",N=(C.ydisp+x+1).toString(),F=this._rowElements[x];F&&(T.length===0?(F.innerText=" ",this._rowColumns.set(F,[0,1])):(F.textContent=T,this._rowColumns.set(F,b)),F.setAttribute("aria-posinset",N),F.setAttribute("aria-setsize",D))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(d,h){const C=d.target,D=this._rowElements[h===0?1:this._rowElements.length-2];if(C.getAttribute("aria-posinset")===(h===0?"1":`${this._terminal.buffer.lines.length}`)||d.relatedTarget!==D)return;let x,M;if(h===0?(x=C,M=this._rowElements.pop(),this._rowContainer.removeChild(M)):(x=this._rowElements.shift(),M=C,this._rowContainer.removeChild(x)),x.removeEventListener("focus",this._topBoundaryFocusListener),M.removeEventListener("focus",this._bottomBoundaryFocusListener),h===0){const b=this._createAccessibilityTreeNode();this._rowElements.unshift(b),this._rowContainer.insertAdjacentElement("afterbegin",b)}else{const b=this._createAccessibilityTreeNode();this._rowElements.push(b),this._rowContainer.appendChild(b)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(h===0?-1:1),this._rowElements[h===0?1:this._rowElements.length-2].focus(),d.preventDefault(),d.stopImmediatePropagation()}_handleSelectionChange(){var T;if(this._rowElements.length===0)return;const d=document.getSelection();if(!d)return;if(d.isCollapsed)return void(this._rowContainer.contains(d.anchorNode)&&this._terminal.clearSelection());if(!d.anchorNode||!d.focusNode)return void console.error("anchorNode and/or focusNode are null");let h={node:d.anchorNode,offset:d.anchorOffset},C={node:d.focusNode,offset:d.focusOffset};if((h.node.compareDocumentPosition(C.node)&Node.DOCUMENT_POSITION_PRECEDING||h.node===C.node&&h.offset>C.offset)&&([h,C]=[C,h]),h.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(h={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(h.node))return;const D=this._rowElements.slice(-1)[0];if(C.node.compareDocumentPosition(D)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(C={node:D,offset:((T=D.textContent)==null?void 0:T.length)??0}),!this._rowContainer.contains(C.node))return;const x=({node:N,offset:F})=>{const P=N instanceof Text?N.parentNode:N;let B=parseInt(P==null?void 0:P.getAttribute("aria-posinset"),10)-1;if(isNaN(B))return console.warn("row is invalid. Race condition?"),null;const H=this._rowColumns.get(P);if(!H)return console.warn("columns is null. Race condition?"),null;let q=F<H.length?H[F]:H.slice(-1)[0]+1;return q>=this._terminal.cols&&(++B,q=0),{row:B,column:q}},M=x(h),b=x(C);if(M&&b){if(M.row>b.row||M.row===b.row&&M.column>=b.column)throw new Error("invalid range");this._terminal.select(M.column,M.row,(b.row-M.row)*this._terminal.cols-M.column+b.column)}}_handleResize(d){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let h=this._rowContainer.children.length;h<this._terminal.rows;h++)this._rowElements[h]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[h]);for(;this._rowElements.length>d;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const d=this._coreBrowserService.mainDocument.createElement("div");return d.setAttribute("role","listitem"),d.tabIndex=-1,this._refreshRowDimensions(d),d}_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 d=0;d<this._terminal.rows;d++)this._refreshRowDimensions(this._rowElements[d])}}_refreshRowDimensions(d){d.style.height=`${this._renderService.dimensions.css.cell.height}px`}};s.AccessibilityManager=f=m([_(1,g.IInstantiationService),_(2,E.ICoreBrowserService),_(3,E.IRenderService)],f)},3614:(L,s)=>{function c(y){return y.replace(/\r?\n/g,"\r")}function m(y,S){return S?"\x1B[200~"+y+"\x1B[201~":y}function _(y,S,E,g){y=m(y=c(y),E.decPrivateModes.bracketedPasteMode&&g.rawOptions.ignoreBracketedPasteMode!==!0),E.triggerDataEvent(y,!0),S.value=""}function u(y,S,E){const g=E.getBoundingClientRect(),a=y.clientX-g.left-10,f=y.clientY-g.top-10;S.style.width="20px",S.style.height="20px",S.style.left=`${a}px`,S.style.top=`${f}px`,S.style.zIndex="1000",S.focus()}Object.defineProperty(s,"__esModule",{value:!0}),s.rightClickHandler=s.moveTextAreaUnderMouseCursor=s.paste=s.handlePasteEvent=s.copyHandler=s.bracketTextForPaste=s.prepareTextForTerminal=void 0,s.prepareTextForTerminal=c,s.bracketTextForPaste=m,s.copyHandler=function(y,S){y.clipboardData&&y.clipboardData.setData("text/plain",S.selectionText),y.preventDefault()},s.handlePasteEvent=function(y,S,E,g){y.stopPropagation(),y.clipboardData&&_(y.clipboardData.getData("text/plain"),S,E,g)},s.paste=_,s.moveTextAreaUnderMouseCursor=u,s.rightClickHandler=function(y,S,E,g,a){u(y,S,E),a&&g.rightClickSelect(y),S.value=g.selectionText,S.select()}},7239:(L,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ColorContrastCache=void 0;const m=c(1505);s.ColorContrastCache=class{constructor(){this._color=new m.TwoKeyMap,this._css=new m.TwoKeyMap}setCss(_,u,y){this._css.set(_,u,y)}getCss(_,u){return this._css.get(_,u)}setColor(_,u,y){this._color.set(_,u,y)}getColor(_,u){return this._color.get(_,u)}clear(){this._color.clear(),this._css.clear()}}},3656:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.addDisposableDomListener=void 0,s.addDisposableDomListener=function(c,m,_,u){c.addEventListener(m,_,u);let y=!1;return{dispose:()=>{y||(y=!0,c.removeEventListener(m,_,u))}}}},3551:function(L,s,c){var m=this&&this.__decorate||function(f,d,h,C){var D,x=arguments.length,M=x<3?d:C===null?C=Object.getOwnPropertyDescriptor(d,h):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(f,d,h,C);else for(var b=f.length-1;b>=0;b--)(D=f[b])&&(M=(x<3?D(M):x>3?D(d,h,M):D(d,h))||M);return x>3&&M&&Object.defineProperty(d,h,M),M},_=this&&this.__param||function(f,d){return function(h,C){d(h,C,f)}};Object.defineProperty(s,"__esModule",{value:!0}),s.Linkifier=void 0;const u=c(3656),y=c(8460),S=c(844),E=c(2585),g=c(4725);let a=s.Linkifier=class extends S.Disposable{get currentLink(){return this._currentLink}constructor(f,d,h,C,D){super(),this._element=f,this._mouseService=d,this._renderService=h,this._bufferService=C,this._linkProviderService=D,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new y.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new y.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,S.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,S.toDisposable)((()=>{var x;this._lastMouseEvent=void 0,(x=this._activeProviderReplies)==null||x.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,u.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,u.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,u.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,u.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(f){this._lastMouseEvent=f;const d=this._positionFromMouseEvent(f,this._element,this._mouseService);if(!d)return;this._isMouseOut=!1;const h=f.composedPath();for(let C=0;C<h.length;C++){const D=h[C];if(D.classList.contains("xterm"))break;if(D.classList.contains("xterm-hover"))return}this._lastBufferCell&&d.x===this._lastBufferCell.x&&d.y===this._lastBufferCell.y||(this._handleHover(d),this._lastBufferCell=d)}_handleHover(f){if(this._activeLine!==f.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(f,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,f)||(this._clearCurrentLink(),this._askForLink(f,!0))}_askForLink(f,d){var C,D;this._activeProviderReplies&&d||((C=this._activeProviderReplies)==null||C.forEach((x=>{x==null||x.forEach((M=>{M.link.dispose&&M.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=f.y);let h=!1;for(const[x,M]of this._linkProviderService.linkProviders.entries())d?(D=this._activeProviderReplies)!=null&&D.get(x)&&(h=this._checkLinkProviderResult(x,f,h)):M.provideLinks(f.y,(b=>{var N,F;if(this._isMouseOut)return;const T=b==null?void 0:b.map((P=>({link:P})));(N=this._activeProviderReplies)==null||N.set(x,T),h=this._checkLinkProviderResult(x,f,h),((F=this._activeProviderReplies)==null?void 0:F.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(f.y,this._activeProviderReplies)}))}_removeIntersectingLinks(f,d){const h=new Set;for(let C=0;C<d.size;C++){const D=d.get(C);if(D)for(let x=0;x<D.length;x++){const M=D[x],b=M.link.range.start.y<f?0:M.link.range.start.x,T=M.link.range.end.y>f?this._bufferService.cols:M.link.range.end.x;for(let N=b;N<=T;N++){if(h.has(N)){D.splice(x--,1);break}h.add(N)}}}}_checkLinkProviderResult(f,d,h){var x;if(!this._activeProviderReplies)return h;const C=this._activeProviderReplies.get(f);let D=!1;for(let M=0;M<f;M++)this._activeProviderReplies.has(M)&&!this._activeProviderReplies.get(M)||(D=!0);if(!D&&C){const M=C.find((b=>this._linkAtPosition(b.link,d)));M&&(h=!0,this._handleNewLink(M))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!h)for(let M=0;M<this._activeProviderReplies.size;M++){const b=(x=this._activeProviderReplies.get(M))==null?void 0:x.find((T=>this._linkAtPosition(T.link,d)));if(b){h=!0,this._handleNewLink(b);break}}return h}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(f){if(!this._currentLink)return;const d=this._positionFromMouseEvent(f,this._element,this._mouseService);d&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,d)&&this._currentLink.link.activate(f,this._currentLink.link.text)}_clearCurrentLink(f,d){this._currentLink&&this._lastMouseEvent&&(!f||!d||this._currentLink.link.range.start.y>=f&&this._currentLink.link.range.end.y<=d)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,S.disposeArray)(this._linkCacheDisposables))}_handleNewLink(f){if(!this._lastMouseEvent)return;const d=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);d&&this._linkAtPosition(f.link,d)&&(this._currentLink=f,this._currentLink.state={decorations:{underline:f.link.decorations===void 0||f.link.decorations.underline,pointerCursor:f.link.decorations===void 0||f.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,f.link,this._lastMouseEvent),f.link.decorations={},Object.defineProperties(f.link.decorations,{pointerCursor:{get:()=>{var h,C;return(C=(h=this._currentLink)==null?void 0:h.state)==null?void 0:C.decorations.pointerCursor},set:h=>{var C;(C=this._currentLink)!=null&&C.state&&this._currentLink.state.decorations.pointerCursor!==h&&(this._currentLink.state.decorations.pointerCursor=h,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",h))}},underline:{get:()=>{var h,C;return(C=(h=this._currentLink)==null?void 0:h.state)==null?void 0:C.decorations.underline},set:h=>{var C,D,x;(C=this._currentLink)!=null&&C.state&&((x=(D=this._currentLink)==null?void 0:D.state)==null?void 0:x.decorations.underline)!==h&&(this._currentLink.state.decorations.underline=h,this._currentLink.state.isHovered&&this._fireUnderlineEvent(f.link,h))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((h=>{if(!this._currentLink)return;const C=h.start===0?0:h.start+1+this._bufferService.buffer.ydisp,D=this._bufferService.buffer.ydisp+1+h.end;if(this._currentLink.link.range.start.y>=C&&this._currentLink.link.range.end.y<=D&&(this._clearCurrentLink(C,D),this._lastMouseEvent)){const x=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);x&&this._askForLink(x,!1)}}))))}_linkHover(f,d,h){var C;(C=this._currentLink)!=null&&C.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(d,!0),this._currentLink.state.decorations.pointerCursor&&f.classList.add("xterm-cursor-pointer")),d.hover&&d.hover(h,d.text)}_fireUnderlineEvent(f,d){const h=f.range,C=this._bufferService.buffer.ydisp,D=this._createLinkUnderlineEvent(h.start.x-1,h.start.y-C-1,h.end.x,h.end.y-C-1,void 0);(d?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(D)}_linkLeave(f,d,h){var C;(C=this._currentLink)!=null&&C.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(d,!1),this._currentLink.state.decorations.pointerCursor&&f.classList.remove("xterm-cursor-pointer")),d.leave&&d.leave(h,d.text)}_linkAtPosition(f,d){const h=f.range.start.y*this._bufferService.cols+f.range.start.x,C=f.range.end.y*this._bufferService.cols+f.range.end.x,D=d.y*this._bufferService.cols+d.x;return h<=D&&D<=C}_positionFromMouseEvent(f,d,h){const C=h.getCoords(f,d,this._bufferService.cols,this._bufferService.rows);if(C)return{x:C[0],y:C[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(f,d,h,C,D){return{x1:f,y1:d,x2:h,y2:C,cols:this._bufferService.cols,fg:D}}};s.Linkifier=a=m([_(1,g.IMouseService),_(2,g.IRenderService),_(3,E.IBufferService),_(4,g.ILinkProviderService)],a)},9042:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.tooMuchOutput=s.promptLabel=void 0,s.promptLabel="Terminal input",s.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(L,s,c){var m=this&&this.__decorate||function(g,a,f,d){var h,C=arguments.length,D=C<3?a:d===null?d=Object.getOwnPropertyDescriptor(a,f):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(g,a,f,d);else for(var x=g.length-1;x>=0;x--)(h=g[x])&&(D=(C<3?h(D):C>3?h(a,f,D):h(a,f))||D);return C>3&&D&&Object.defineProperty(a,f,D),D},_=this&&this.__param||function(g,a){return function(f,d){a(f,d,g)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OscLinkProvider=void 0;const u=c(511),y=c(2585);let S=s.OscLinkProvider=class{constructor(g,a,f){this._bufferService=g,this._optionsService=a,this._oscLinkService=f}provideLinks(g,a){var T;const f=this._bufferService.buffer.lines.get(g-1);if(!f)return void a(void 0);const d=[],h=this._optionsService.rawOptions.linkHandler,C=new u.CellData,D=f.getTrimmedLength();let x=-1,M=-1,b=!1;for(let N=0;N<D;N++)if(M!==-1||f.hasContent(N)){if(f.loadCell(N,C),C.hasExtendedAttrs()&&C.extended.urlId){if(M===-1){M=N,x=C.extended.urlId;continue}b=C.extended.urlId!==x}else M!==-1&&(b=!0);if(b||M!==-1&&N===D-1){const F=(T=this._oscLinkService.getLinkData(x))==null?void 0:T.uri;if(F){const P={start:{x:M+1,y:g},end:{x:N+(b||N!==D-1?0:1),y:g}};let B=!1;if(!(h!=null&&h.allowNonHttpProtocols))try{const H=new URL(F);["http:","https:"].includes(H.protocol)||(B=!0)}catch{B=!0}B||d.push({text:F,range:P,activate:(H,q)=>h?h.activate(H,q,P):E(0,q),hover:(H,q)=>{var X;return(X=h==null?void 0:h.hover)==null?void 0:X.call(h,H,q,P)},leave:(H,q)=>{var X;return(X=h==null?void 0:h.leave)==null?void 0:X.call(h,H,q,P)}})}b=!1,C.hasExtendedAttrs()&&C.extended.urlId?(M=N,x=C.extended.urlId):(M=-1,x=-1)}}a(d)}};function E(g,a){if(confirm(`Do you want to navigate to ${a}?
111
-
112
- WARNING: This link could potentially be dangerous`)){const f=window.open();if(f){try{f.opener=null}catch{}f.location.href=a}else console.warn("Opening link blocked as opener could not be cleared")}}s.OscLinkProvider=S=m([_(0,y.IBufferService),_(1,y.IOptionsService),_(2,y.IOscLinkService)],S)},6193:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.RenderDebouncer=void 0,s.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,_){this._rowCount=_,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:(L,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Terminal=void 0;const m=c(3614),_=c(3656),u=c(3551),y=c(9042),S=c(3730),E=c(1680),g=c(3107),a=c(5744),f=c(2950),d=c(1296),h=c(428),C=c(4269),D=c(5114),x=c(8934),M=c(3230),b=c(9312),T=c(4725),N=c(6731),F=c(8055),P=c(8969),B=c(8460),H=c(844),q=c(6114),X=c(8437),G=c(2584),Y=c(7399),j=c(5941),U=c(9074),$=c(2585),V=c(5435),ne=c(4567),se=c(779);class ce 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(K={}){super(K),this.browser=q,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new H.MutableDisposable),this._onCursorMove=this.register(new B.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new B.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new B.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new B.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new B.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new B.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new B.EventEmitter),this._onBlur=this.register(new B.EventEmitter),this._onA11yCharEmitter=this.register(new B.EventEmitter),this._onA11yTabEmitter=this.register(new B.EventEmitter),this._onWillOpen=this.register(new B.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(U.DecorationService),this._instantiationService.setService($.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(se.LinkProviderService),this._instantiationService.setService(T.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(S.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((W,J)=>this.refresh(W,J)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((W=>this._reportWindowsOptions(W)))),this.register(this._inputHandler.onColor((W=>this._handleColorEvent(W)))),this.register((0,B.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,B.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,B.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,B.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((W=>this._afterResize(W.cols,W.rows)))),this.register((0,H.toDisposable)((()=>{var W,J;this._customKeyEventHandler=void 0,(J=(W=this.element)==null?void 0:W.parentNode)==null||J.removeChild(this.element)})))}_handleColorEvent(K){if(this._themeService)for(const W of K){let J,Z="";switch(W.index){case 256:J="foreground",Z="10";break;case 257:J="background",Z="11";break;case 258:J="cursor",Z="12";break;default:J="ansi",Z="4;"+W.index}switch(W.type){case 0:const de=F.color.toColorRGB(J==="ansi"?this._themeService.colors.ansi[W.index]:this._themeService.colors[J]);this.coreService.triggerDataEvent(`${G.C0.ESC}]${Z};${(0,j.toRgbString)(de)}${G.C1_ESCAPED.ST}`);break;case 1:if(J==="ansi")this._themeService.modifyColors((ee=>ee.ansi[W.index]=F.channels.toColor(...W.color)));else{const ee=J;this._themeService.modifyColors((xe=>xe[ee]=F.channels.toColor(...W.color)))}break;case 2:this._themeService.restoreColor(W.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(K){K?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(ne.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(K){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(G.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var K;return(K=this.textarea)==null?void 0:K.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(G.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 K=this.buffer.ybase+this.buffer.y,W=this.buffer.lines.get(K);if(!W)return;const J=Math.min(this.buffer.x,this.cols-1),Z=this._renderService.dimensions.css.cell.height,de=W.getWidth(J),ee=this._renderService.dimensions.css.cell.width*de,xe=this.buffer.y*this._renderService.dimensions.css.cell.height,ke=J*this._renderService.dimensions.css.cell.width;this.textarea.style.left=ke+"px",this.textarea.style.top=xe+"px",this.textarea.style.width=ee+"px",this.textarea.style.height=Z+"px",this.textarea.style.lineHeight=Z+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,_.addDisposableDomListener)(this.element,"copy",(W=>{this.hasSelection()&&(0,m.copyHandler)(W,this._selectionService)})));const K=W=>(0,m.handlePasteEvent)(W,this.textarea,this.coreService,this.optionsService);this.register((0,_.addDisposableDomListener)(this.textarea,"paste",K)),this.register((0,_.addDisposableDomListener)(this.element,"paste",K)),q.isFirefox?this.register((0,_.addDisposableDomListener)(this.element,"mousedown",(W=>{W.button===2&&(0,m.rightClickHandler)(W,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,_.addDisposableDomListener)(this.element,"contextmenu",(W=>{(0,m.rightClickHandler)(W,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),q.isLinux&&this.register((0,_.addDisposableDomListener)(this.element,"auxclick",(W=>{W.button===1&&(0,m.moveTextAreaUnderMouseCursor)(W,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,_.addDisposableDomListener)(this.textarea,"keyup",(K=>this._keyUp(K)),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"keydown",(K=>this._keyDown(K)),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"keypress",(K=>this._keyPress(K)),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionupdate",(K=>this._compositionHelper.compositionupdate(K)))),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,_.addDisposableDomListener)(this.textarea,"input",(K=>this._inputEvent(K)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(K){var J;if(!K)throw new Error("Terminal requires a parent element.");if(K.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((J=this.element)==null?void 0:J.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=K.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"),K.appendChild(this.element);const W=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),W.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,_.addDisposableDomListener)(this.screenElement,"mousemove",(Z=>this.updateCursorStyle(Z)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),W.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",y.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(D.CoreBrowserService,this.textarea,K.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(T.ICoreBrowserService,this._coreBrowserService),this.register((0,_.addDisposableDomListener)(this.textarea,"focus",(Z=>this._handleTextAreaFocus(Z)))),this.register((0,_.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(h.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(T.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(N.ThemeService),this._instantiationService.setService(T.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(C.CharacterJoinerService),this._instantiationService.setService(T.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(M.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(T.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((Z=>this._onRender.fire(Z)))),this.onResize((Z=>this._renderService.resize(Z.cols,Z.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(f.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(x.MouseService),this._instantiationService.setService(T.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(u.Linkifier,this.screenElement)),this.element.appendChild(W);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(E.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((Z=>this.scrollLines(Z.amount,Z.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(b.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(T.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((Z=>this.scrollLines(Z.amount,Z.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((Z=>this._renderService.handleSelectionChanged(Z.start,Z.end,Z.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((Z=>{this.textarea.value=Z,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((Z=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,_.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(g.BufferDecorationRenderer,this.screenElement)),this.register((0,_.addDisposableDomListener)(this.element,"mousedown",(Z=>this._selectionService.handleMouseDown(Z)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(ne.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(Z=>this._handleScreenReaderModeOptionChange(Z)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(a.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(Z=>{!this._overviewRulerRenderer&&Z&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(a.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(d.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const K=this,W=this.element;function J(ee){const xe=K._mouseService.getMouseReportCoords(ee,K.screenElement);if(!xe)return!1;let ke,le;switch(ee.overrideType||ee.type){case"mousemove":le=32,ee.buttons===void 0?(ke=3,ee.button!==void 0&&(ke=ee.button<3?ee.button:3)):ke=1&ee.buttons?0:4&ee.buttons?1:2&ee.buttons?2:3;break;case"mouseup":le=0,ke=ee.button<3?ee.button:3;break;case"mousedown":le=1,ke=ee.button<3?ee.button:3;break;case"wheel":if(K._customWheelEventHandler&&K._customWheelEventHandler(ee)===!1||K.viewport.getLinesScrolled(ee)===0)return!1;le=ee.deltaY<0?0:1,ke=4;break;default:return!1}return!(le===void 0||ke===void 0||ke>4)&&K.coreMouseService.triggerMouseEvent({col:xe.col,row:xe.row,x:xe.x,y:xe.y,button:ke,action:le,ctrl:ee.ctrlKey,alt:ee.altKey,shift:ee.shiftKey})}const Z={mouseup:null,wheel:null,mousedrag:null,mousemove:null},de={mouseup:ee=>(J(ee),ee.buttons||(this._document.removeEventListener("mouseup",Z.mouseup),Z.mousedrag&&this._document.removeEventListener("mousemove",Z.mousedrag)),this.cancel(ee)),wheel:ee=>(J(ee),this.cancel(ee,!0)),mousedrag:ee=>{ee.buttons&&J(ee)},mousemove:ee=>{ee.buttons||J(ee)}};this.register(this.coreMouseService.onProtocolChange((ee=>{ee?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(ee)),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&ee?Z.mousemove||(W.addEventListener("mousemove",de.mousemove),Z.mousemove=de.mousemove):(W.removeEventListener("mousemove",Z.mousemove),Z.mousemove=null),16&ee?Z.wheel||(W.addEventListener("wheel",de.wheel,{passive:!1}),Z.wheel=de.wheel):(W.removeEventListener("wheel",Z.wheel),Z.wheel=null),2&ee?Z.mouseup||(Z.mouseup=de.mouseup):(this._document.removeEventListener("mouseup",Z.mouseup),Z.mouseup=null),4&ee?Z.mousedrag||(Z.mousedrag=de.mousedrag):(this._document.removeEventListener("mousemove",Z.mousedrag),Z.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,_.addDisposableDomListener)(W,"mousedown",(ee=>{if(ee.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(ee))return J(ee),Z.mouseup&&this._document.addEventListener("mouseup",Z.mouseup),Z.mousedrag&&this._document.addEventListener("mousemove",Z.mousedrag),this.cancel(ee)}))),this.register((0,_.addDisposableDomListener)(W,"wheel",(ee=>{if(!Z.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(ee)===!1)return!1;if(!this.buffer.hasScrollback){const xe=this.viewport.getLinesScrolled(ee);if(xe===0)return;const ke=G.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(ee.deltaY<0?"A":"B");let le="";for(let we=0;we<Math.abs(xe);we++)le+=ke;return this.coreService.triggerDataEvent(le,!0),this.cancel(ee,!0)}return this.viewport.handleWheel(ee)?this.cancel(ee):void 0}}),{passive:!1})),this.register((0,_.addDisposableDomListener)(W,"touchstart",(ee=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(ee),this.cancel(ee)}),{passive:!0})),this.register((0,_.addDisposableDomListener)(W,"touchmove",(ee=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(ee)?void 0:this.cancel(ee)}),{passive:!1}))}refresh(K,W){var J;(J=this._renderService)==null||J.refreshRows(K,W)}updateCursorStyle(K){var W;(W=this._selectionService)!=null&&W.shouldColumnSelect(K)?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(K,W,J=0){var Z;J===1?(super.scrollLines(K,W,J),this.refresh(0,this.rows-1)):(Z=this.viewport)==null||Z.scrollLines(K)}paste(K){(0,m.paste)(K,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(K){this._customKeyEventHandler=K}attachCustomWheelEventHandler(K){this._customWheelEventHandler=K}registerLinkProvider(K){return this._linkProviderService.registerLinkProvider(K)}registerCharacterJoiner(K){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const W=this._characterJoinerService.register(K);return this.refresh(0,this.rows-1),W}deregisterCharacterJoiner(K){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(K)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(K){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+K)}registerDecoration(K){return this._decorationService.registerDecoration(K)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(K,W,J){this._selectionService.setSelection(K,W,J)}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 K;(K=this._selectionService)==null||K.clearSelection()}selectAll(){var K;(K=this._selectionService)==null||K.selectAll()}selectLines(K,W){var J;(J=this._selectionService)==null||J.selectLines(K,W)}_keyDown(K){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(K)===!1)return!1;const W=this.browser.isMac&&this.options.macOptionIsMeta&&K.altKey;if(!W&&!this._compositionHelper.keydown(K))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;W||K.key!=="Dead"&&K.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const J=(0,Y.evaluateKeyboardEvent)(K,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(K),J.type===3||J.type===2){const Z=this.rows-1;return this.scrollLines(J.type===2?-Z:Z),this.cancel(K,!0)}return J.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,K)||(J.cancel&&this.cancel(K,!0),!J.key||!!(K.key&&!K.ctrlKey&&!K.altKey&&!K.metaKey&&K.key.length===1&&K.key.charCodeAt(0)>=65&&K.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(J.key!==G.C0.ETX&&J.key!==G.C0.CR||(this.textarea.value=""),this._onKey.fire({key:J.key,domEvent:K}),this._showCursor(),this.coreService.triggerDataEvent(J.key,!0),!this.optionsService.rawOptions.screenReaderMode||K.altKey||K.ctrlKey?this.cancel(K,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(K,W){const J=K.isMac&&!this.options.macOptionIsMeta&&W.altKey&&!W.ctrlKey&&!W.metaKey||K.isWindows&&W.altKey&&W.ctrlKey&&!W.metaKey||K.isWindows&&W.getModifierState("AltGraph");return W.type==="keypress"?J:J&&(!W.keyCode||W.keyCode>47)}_keyUp(K){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(K)===!1||((function(W){return W.keyCode===16||W.keyCode===17||W.keyCode===18})(K)||this.focus(),this.updateCursorStyle(K),this._keyPressHandled=!1)}_keyPress(K){let W;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(K)===!1)return!1;if(this.cancel(K),K.charCode)W=K.charCode;else if(K.which===null||K.which===void 0)W=K.keyCode;else{if(K.which===0||K.charCode===0)return!1;W=K.which}return!(!W||(K.altKey||K.ctrlKey||K.metaKey)&&!this._isThirdLevelShift(this.browser,K)||(W=String.fromCharCode(W),this._onKey.fire({key:W,domEvent:K}),this._showCursor(),this.coreService.triggerDataEvent(W,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(K){if(K.data&&K.inputType==="insertText"&&(!K.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const W=K.data;return this.coreService.triggerDataEvent(W,!0),this.cancel(K),!0}return!1}resize(K,W){K!==this.cols||W!==this.rows?super.resize(K,W):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(K,W){var J,Z;(J=this._charSizeService)==null||J.measure(),(Z=this.viewport)==null||Z.syncScrollArea(!0)}clear(){var K;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 W=1;W<this.rows;W++)this.buffer.lines.push(this.buffer.getBlankLine(X.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(K=this.viewport)==null||K.reset(),this.refresh(0,this.rows-1)}}reset(){var W,J;this.options.rows=this.rows,this.options.cols=this.cols;const K=this._customKeyEventHandler;this._setup(),super.reset(),(W=this._selectionService)==null||W.reset(),this._decorationService.reset(),(J=this.viewport)==null||J.reset(),this._customKeyEventHandler=K,this.refresh(0,this.rows-1)}clearTextureAtlas(){var K;(K=this._renderService)==null||K.clearTextureAtlas()}_reportFocus(){var K;(K=this.element)!=null&&K.classList.contains("focus")?this.coreService.triggerDataEvent(G.C0.ESC+"[I"):this.coreService.triggerDataEvent(G.C0.ESC+"[O")}_reportWindowsOptions(K){if(this._renderService)switch(K){case V.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const W=this._renderService.dimensions.css.canvas.width.toFixed(0),J=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${G.C0.ESC}[4;${J};${W}t`);break;case V.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const Z=this._renderService.dimensions.css.cell.width.toFixed(0),de=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${G.C0.ESC}[6;${de};${Z}t`)}}cancel(K,W){if(this.options.cancelEvents||W)return K.preventDefault(),K.stopPropagation(),!1}}s.Terminal=ce},9924:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TimeBasedDebouncer=void 0,s.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,_){this._rowCount=_,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 u=Date.now();if(u-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=u,this._innerRefresh();else if(!this._additionalRefreshRequested){const y=u-this._lastRefreshMs,S=this._debounceThresholdMS-y;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),S)}}_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(L,s,c){var m=this&&this.__decorate||function(f,d,h,C){var D,x=arguments.length,M=x<3?d:C===null?C=Object.getOwnPropertyDescriptor(d,h):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(f,d,h,C);else for(var b=f.length-1;b>=0;b--)(D=f[b])&&(M=(x<3?D(M):x>3?D(d,h,M):D(d,h))||M);return x>3&&M&&Object.defineProperty(d,h,M),M},_=this&&this.__param||function(f,d){return function(h,C){d(h,C,f)}};Object.defineProperty(s,"__esModule",{value:!0}),s.Viewport=void 0;const u=c(3656),y=c(4725),S=c(8460),E=c(844),g=c(2585);let a=s.Viewport=class extends E.Disposable{constructor(f,d,h,C,D,x,M,b){super(),this._viewportElement=f,this._scrollArea=d,this._bufferService=h,this._optionsService=C,this._charSizeService=D,this._renderService=x,this._coreBrowserService=M,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 S.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,u.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((T=>this._activeBuffer=T.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((T=>this._renderDimensions=T))),this._handleThemeChange(b.colors),this.register(b.onChangeColors((T=>this._handleThemeChange(T)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(f){this._viewportElement.style.backgroundColor=f.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(f){if(f)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 d=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==d&&(this._lastRecordedBufferHeight=d,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const f=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==f&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=f),this._refreshAnimationFrame=null}syncScrollArea(f=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(f);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(f)}_handleScroll(f){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 d=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:d,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const f=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(f*(this._smoothScrollState.target-this._smoothScrollState.origin)),f<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(f,d){const h=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(d<0&&this._viewportElement.scrollTop!==0||d>0&&h<this._lastRecordedBufferHeight)||(f.cancelable&&f.preventDefault(),!1)}handleWheel(f){const d=this._getPixelsScrolled(f);return d!==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+d:this._smoothScrollState.target+=d,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=d,this._bubbleScroll(f,d))}scrollLines(f){if(f!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const d=f*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+d,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:f,suppressScrollEvent:!1})}_getPixelsScrolled(f){if(f.deltaY===0||f.shiftKey)return 0;let d=this._applyScrollModifier(f.deltaY,f);return f.deltaMode===WheelEvent.DOM_DELTA_LINE?d*=this._currentRowHeight:f.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(d*=this._currentRowHeight*this._bufferService.rows),d}getBufferElements(f,d){var b;let h,C="";const D=[],x=d??this._bufferService.buffer.lines.length,M=this._bufferService.buffer.lines;for(let T=f;T<x;T++){const N=M.get(T);if(!N)continue;const F=(b=M.get(T+1))==null?void 0:b.isWrapped;if(C+=N.translateToString(!F),!F||T===M.length-1){const P=document.createElement("div");P.textContent=C,D.push(P),C.length>0&&(h=P),C=""}}return{bufferElements:D,cursorElement:h}}getLinesScrolled(f){if(f.deltaY===0||f.shiftKey)return 0;let d=this._applyScrollModifier(f.deltaY,f);return f.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(d/=this._currentRowHeight+0,this._wheelPartialScroll+=d,d=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):f.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(d*=this._bufferService.rows),d}_applyScrollModifier(f,d){const h=this._optionsService.rawOptions.fastScrollModifier;return h==="alt"&&d.altKey||h==="ctrl"&&d.ctrlKey||h==="shift"&&d.shiftKey?f*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:f*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(f){this._lastTouchY=f.touches[0].pageY}handleTouchMove(f){const d=this._lastTouchY-f.touches[0].pageY;return this._lastTouchY=f.touches[0].pageY,d!==0&&(this._viewportElement.scrollTop+=d,this._bubbleScroll(f,d))}};s.Viewport=a=m([_(2,g.IBufferService),_(3,g.IOptionsService),_(4,y.ICharSizeService),_(5,y.IRenderService),_(6,y.ICoreBrowserService),_(7,y.IThemeService)],a)},3107:function(L,s,c){var m=this&&this.__decorate||function(g,a,f,d){var h,C=arguments.length,D=C<3?a:d===null?d=Object.getOwnPropertyDescriptor(a,f):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(g,a,f,d);else for(var x=g.length-1;x>=0;x--)(h=g[x])&&(D=(C<3?h(D):C>3?h(a,f,D):h(a,f))||D);return C>3&&D&&Object.defineProperty(a,f,D),D},_=this&&this.__param||function(g,a){return function(f,d){a(f,d,g)}};Object.defineProperty(s,"__esModule",{value:!0}),s.BufferDecorationRenderer=void 0;const u=c(4725),y=c(844),S=c(2585);let E=s.BufferDecorationRenderer=class extends y.Disposable{constructor(g,a,f,d,h){super(),this._screenElement=g,this._bufferService=a,this._coreBrowserService=f,this._decorationService=d,this._renderService=h,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((C=>this._removeDecoration(C)))),this.register((0,y.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 g of this._decorationService.decorations)this._renderDecoration(g);this._dimensionsChanged=!1}_renderDecoration(g){this._refreshStyle(g),this._dimensionsChanged&&this._refreshXPosition(g)}_createElement(g){var d;const a=this._coreBrowserService.mainDocument.createElement("div");a.classList.add("xterm-decoration"),a.classList.toggle("xterm-decoration-top-layer",((d=g==null?void 0:g.options)==null?void 0:d.layer)==="top"),a.style.width=`${Math.round((g.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,a.style.height=(g.options.height||1)*this._renderService.dimensions.css.cell.height+"px",a.style.top=(g.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",a.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const f=g.options.x??0;return f&&f>this._bufferService.cols&&(a.style.display="none"),this._refreshXPosition(g,a),a}_refreshStyle(g){const a=g.marker.line-this._bufferService.buffers.active.ydisp;if(a<0||a>=this._bufferService.rows)g.element&&(g.element.style.display="none",g.onRenderEmitter.fire(g.element));else{let f=this._decorationElements.get(g);f||(f=this._createElement(g),g.element=f,this._decorationElements.set(g,f),this._container.appendChild(f),g.onDispose((()=>{this._decorationElements.delete(g),f.remove()}))),f.style.top=a*this._renderService.dimensions.css.cell.height+"px",f.style.display=this._altBufferIsActive?"none":"block",g.onRenderEmitter.fire(f)}}_refreshXPosition(g,a=g.element){if(!a)return;const f=g.options.x??0;(g.options.anchor||"left")==="right"?a.style.right=f?f*this._renderService.dimensions.css.cell.width+"px":"":a.style.left=f?f*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(g){var a;(a=this._decorationElements.get(g))==null||a.remove(),this._decorationElements.delete(g),g.dispose()}};s.BufferDecorationRenderer=E=m([_(1,S.IBufferService),_(2,u.ICoreBrowserService),_(3,S.IDecorationService),_(4,u.IRenderService)],E)},5871:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ColorZoneStore=void 0,s.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,_){return m>=c.startBufferLine-this._linePadding[_||"full"]&&m<=c.endBufferLine+this._linePadding[_||"full"]}_addLineToZone(c,m){c.startBufferLine=Math.min(c.startBufferLine,m),c.endBufferLine=Math.max(c.endBufferLine,m)}}},5744:function(L,s,c){var m=this&&this.__decorate||function(h,C,D,x){var M,b=arguments.length,T=b<3?C:x===null?x=Object.getOwnPropertyDescriptor(C,D):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(h,C,D,x);else for(var N=h.length-1;N>=0;N--)(M=h[N])&&(T=(b<3?M(T):b>3?M(C,D,T):M(C,D))||T);return b>3&&T&&Object.defineProperty(C,D,T),T},_=this&&this.__param||function(h,C){return function(D,x){C(D,x,h)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OverviewRulerRenderer=void 0;const u=c(5871),y=c(4725),S=c(844),E=c(2585),g={full:0,left:0,center:0,right:0},a={full:0,left:0,center:0,right:0},f={full:0,left:0,center:0,right:0};let d=s.OverviewRulerRenderer=class extends S.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(h,C,D,x,M,b,T){var F;super(),this._viewportElement=h,this._screenElement=C,this._bufferService=D,this._decorationService=x,this._renderService=M,this._optionsService=b,this._coreBrowserService=T,this._colorZoneStore=new u.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(),(F=this._viewportElement.parentElement)==null||F.insertBefore(this._canvas,this._viewportElement);const N=this._canvas.getContext("2d");if(!N)throw new Error("Ctx cannot be null");this._ctx=N,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,S.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 h=Math.floor(this._canvas.width/3),C=Math.ceil(this._canvas.width/3);a.full=this._canvas.width,a.left=h,a.center=C,a.right=h,this._refreshDrawHeightConstants(),f.full=0,f.left=0,f.center=a.left,f.right=a.left+a.center}_refreshDrawHeightConstants(){g.full=Math.round(2*this._coreBrowserService.dpr);const h=this._canvas.height/this._bufferService.buffer.lines.length,C=Math.round(Math.max(Math.min(h,12),6)*this._coreBrowserService.dpr);g.left=C,g.center=C,g.right=C}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*g.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*g.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*g.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*g.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 C of this._decorationService.decorations)this._colorZoneStore.addDecoration(C);this._ctx.lineWidth=1;const h=this._colorZoneStore.zones;for(const C of h)C.position!=="full"&&this._renderColorZone(C);for(const C of h)C.position==="full"&&this._renderColorZone(C);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(h){this._ctx.fillStyle=h.color,this._ctx.fillRect(f[h.position||"full"],Math.round((this._canvas.height-1)*(h.startBufferLine/this._bufferService.buffers.active.lines.length)-g[h.position||"full"]/2),a[h.position||"full"],Math.round((this._canvas.height-1)*((h.endBufferLine-h.startBufferLine)/this._bufferService.buffers.active.lines.length)+g[h.position||"full"]))}_queueRefresh(h,C){this._shouldUpdateDimensions=h||this._shouldUpdateDimensions,this._shouldUpdateAnchor=C||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};s.OverviewRulerRenderer=d=m([_(2,E.IBufferService),_(3,E.IDecorationService),_(4,y.IRenderService),_(5,E.IOptionsService),_(6,y.ICoreBrowserService)],d)},2950:function(L,s,c){var m=this&&this.__decorate||function(g,a,f,d){var h,C=arguments.length,D=C<3?a:d===null?d=Object.getOwnPropertyDescriptor(a,f):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(g,a,f,d);else for(var x=g.length-1;x>=0;x--)(h=g[x])&&(D=(C<3?h(D):C>3?h(a,f,D):h(a,f))||D);return C>3&&D&&Object.defineProperty(a,f,D),D},_=this&&this.__param||function(g,a){return function(f,d){a(f,d,g)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CompositionHelper=void 0;const u=c(4725),y=c(2585),S=c(2584);let E=s.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(g,a,f,d,h,C){this._textarea=g,this._compositionView=a,this._bufferService=f,this._optionsService=d,this._coreService=h,this._renderService=C,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(g){this._compositionView.textContent=g.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(g){if(this._isComposing||this._isSendingComposition){if(g.keyCode===229||g.keyCode===16||g.keyCode===17||g.keyCode===18)return!1;this._finalizeComposition(!1)}return g.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(g){if(this._compositionView.classList.remove("active"),this._isComposing=!1,g){const a={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let f;this._isSendingComposition=!1,a.start+=this._dataAlreadySent.length,f=this._isComposing?this._textarea.value.substring(a.start,a.end):this._textarea.value.substring(a.start),f.length>0&&this._coreService.triggerDataEvent(f,!0)}}),0)}else{this._isSendingComposition=!1;const a=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(a,!0)}}_handleAnyTextareaChanges(){const g=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const a=this._textarea.value,f=a.replace(g,"");this._dataAlreadySent=f,a.length>g.length?this._coreService.triggerDataEvent(f,!0):a.length<g.length?this._coreService.triggerDataEvent(`${S.C0.DEL}`,!0):a.length===g.length&&a!==g&&this._coreService.triggerDataEvent(a,!0)}}),0)}updateCompositionElements(g){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const a=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),f=this._renderService.dimensions.css.cell.height,d=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,h=a*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=h+"px",this._compositionView.style.top=d+"px",this._compositionView.style.height=f+"px",this._compositionView.style.lineHeight=f+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const C=this._compositionView.getBoundingClientRect();this._textarea.style.left=h+"px",this._textarea.style.top=d+"px",this._textarea.style.width=Math.max(C.width,1)+"px",this._textarea.style.height=Math.max(C.height,1)+"px",this._textarea.style.lineHeight=C.height+"px"}g||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};s.CompositionHelper=E=m([_(2,y.IBufferService),_(3,y.IOptionsService),_(4,y.ICoreService),_(5,u.IRenderService)],E)},9806:(L,s)=>{function c(m,_,u){const y=u.getBoundingClientRect(),S=m.getComputedStyle(u),E=parseInt(S.getPropertyValue("padding-left")),g=parseInt(S.getPropertyValue("padding-top"));return[_.clientX-y.left-E,_.clientY-y.top-g]}Object.defineProperty(s,"__esModule",{value:!0}),s.getCoords=s.getCoordsRelativeToElement=void 0,s.getCoordsRelativeToElement=c,s.getCoords=function(m,_,u,y,S,E,g,a,f){if(!E)return;const d=c(m,_,u);return d?(d[0]=Math.ceil((d[0]+(f?g/2:0))/g),d[1]=Math.ceil(d[1]/a),d[0]=Math.min(Math.max(d[0],1),y+(f?1:0)),d[1]=Math.min(Math.max(d[1],1),S),d):void 0}},9504:(L,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.moveToCellSequence=void 0;const m=c(2584);function _(a,f,d,h){const C=a-u(a,d),D=f-u(f,d),x=Math.abs(C-D)-(function(M,b,T){let N=0;const F=M-u(M,T),P=b-u(b,T);for(let B=0;B<Math.abs(F-P);B++){const H=y(M,b)==="A"?-1:1,q=T.buffer.lines.get(F+H*B);q!=null&&q.isWrapped&&N++}return N})(a,f,d);return g(x,E(y(a,f),h))}function u(a,f){let d=0,h=f.buffer.lines.get(a),C=h==null?void 0:h.isWrapped;for(;C&&a>=0&&a<f.rows;)d++,h=f.buffer.lines.get(--a),C=h==null?void 0:h.isWrapped;return d}function y(a,f){return a>f?"A":"B"}function S(a,f,d,h,C,D){let x=a,M=f,b="";for(;x!==d||M!==h;)x+=C?1:-1,C&&x>D.cols-1?(b+=D.buffer.translateBufferLineToString(M,!1,a,x),x=0,a=0,M++):!C&&x<0&&(b+=D.buffer.translateBufferLineToString(M,!1,0,a+1),x=D.cols-1,a=x,M--);return b+D.buffer.translateBufferLineToString(M,!1,a,x)}function E(a,f){const d=f?"O":"[";return m.C0.ESC+d+a}function g(a,f){a=Math.floor(a);let d="";for(let h=0;h<a;h++)d+=f;return d}s.moveToCellSequence=function(a,f,d,h){const C=d.buffer.x,D=d.buffer.y;if(!d.buffer.hasScrollback)return(function(b,T,N,F,P,B){return _(T,F,P,B).length===0?"":g(S(b,T,b,T-u(T,P),!1,P).length,E("D",B))})(C,D,0,f,d,h)+_(D,f,d,h)+(function(b,T,N,F,P,B){let H;H=_(T,F,P,B).length>0?F-u(F,P):T;const q=F,X=(function(G,Y,j,U,$,V){let ne;return ne=_(j,U,$,V).length>0?U-u(U,$):Y,G<j&&ne<=U||G>=j&&ne<U?"C":"D"})(b,T,N,F,P,B);return g(S(b,H,N,q,X==="C",P).length,E(X,B))})(C,D,a,f,d,h);let x;if(D===f)return x=C>a?"D":"C",g(Math.abs(C-a),E(x,h));x=D>f?"D":"C";const M=Math.abs(D-f);return g((function(b,T){return T.cols-b})(D>f?a:C,d)+(M-1)*d.cols+1+((D>f?C:a)-1),E(x,h))}},1296:function(L,s,c){var m=this&&this.__decorate||function(B,H,q,X){var G,Y=arguments.length,j=Y<3?H:X===null?X=Object.getOwnPropertyDescriptor(H,q):X;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(B,H,q,X);else for(var U=B.length-1;U>=0;U--)(G=B[U])&&(j=(Y<3?G(j):Y>3?G(H,q,j):G(H,q))||j);return Y>3&&j&&Object.defineProperty(H,q,j),j},_=this&&this.__param||function(B,H){return function(q,X){H(q,X,B)}};Object.defineProperty(s,"__esModule",{value:!0}),s.DomRenderer=void 0;const u=c(3787),y=c(2550),S=c(2223),E=c(6171),g=c(6052),a=c(4725),f=c(8055),d=c(8460),h=c(844),C=c(2585),D="xterm-dom-renderer-owner-",x="xterm-rows",M="xterm-fg-",b="xterm-bg-",T="xterm-focus",N="xterm-selection";let F=1,P=s.DomRenderer=class extends h.Disposable{constructor(B,H,q,X,G,Y,j,U,$,V,ne,se,ce){super(),this._terminal=B,this._document=H,this._element=q,this._screenElement=X,this._viewportElement=G,this._helperContainer=Y,this._linkifier2=j,this._charSizeService=$,this._optionsService=V,this._bufferService=ne,this._coreBrowserService=se,this._themeService=ce,this._terminalClass=F++,this._rowElements=[],this._selectionRenderModel=(0,g.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new d.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(x),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(N),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,E.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((he=>this._injectCss(he)))),this._injectCss(this._themeService.colors),this._rowFactory=U.createInstance(u.DomRendererRowFactory,document),this._element.classList.add(D+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((he=>this._handleLinkHover(he)))),this.register(this._linkifier2.onHideLinkUnderline((he=>this._handleLinkLeave(he)))),this.register((0,h.toDisposable)((()=>{this._element.classList.remove(D+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new y.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const B=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*B,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*B),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/B),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/B),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(const 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 H=`${this._terminalSelector} .${x} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=H,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(B){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let H=`${this._terminalSelector} .${x} { color: ${B.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;H+=`${this._terminalSelector} .${x} .xterm-dim { color: ${f.color.multiplyOpacity(B.foreground,.5).css};}`,H+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;const q=`blink_underline_${this._terminalClass}`,X=`blink_bar_${this._terminalClass}`,G=`blink_block_${this._terminalClass}`;H+=`@keyframes ${q} { 50% { border-bottom-style: hidden; }}`,H+=`@keyframes ${X} { 50% { box-shadow: none; }}`,H+=`@keyframes ${G} { 0% { background-color: ${B.cursor.css}; color: ${B.cursorAccent.css}; } 50% { background-color: inherit; color: ${B.cursor.css}; }}`,H+=`${this._terminalSelector} .${x}.${T} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${q} 1s step-end infinite;}${this._terminalSelector} .${x}.${T} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${X} 1s step-end infinite;}${this._terminalSelector} .${x}.${T} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${G} 1s step-end infinite;}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-block { background-color: ${B.cursor.css}; color: ${B.cursorAccent.css};}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${B.cursor.css} !important; color: ${B.cursorAccent.css} !important;}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${B.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${B.cursor.css} inset;}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${B.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,H+=`${this._terminalSelector} .${N} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${N} div { position: absolute; background-color: ${B.selectionBackgroundOpaque.css};}${this._terminalSelector} .${N} div { position: absolute; background-color: ${B.selectionInactiveBackgroundOpaque.css};}`;for(const[Y,j]of B.ansi.entries())H+=`${this._terminalSelector} .${M}${Y} { color: ${j.css}; }${this._terminalSelector} .${M}${Y}.xterm-dim { color: ${f.color.multiplyOpacity(j,.5).css}; }${this._terminalSelector} .${b}${Y} { background-color: ${j.css}; }`;H+=`${this._terminalSelector} .${M}${S.INVERTED_DEFAULT_COLOR} { color: ${f.color.opaque(B.background).css}; }${this._terminalSelector} .${M}${S.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${f.color.multiplyOpacity(f.color.opaque(B.background),.5).css}; }${this._terminalSelector} .${b}${S.INVERTED_DEFAULT_COLOR} { background-color: ${B.foreground.css}; }`,this._themeStyleElement.textContent=H}_setDefaultSpacing(){const B=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${B}px`,this._rowFactory.defaultSpacing=B}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(B,H){for(let q=this._rowElements.length;q<=H;q++){const X=this._document.createElement("div");this._rowContainer.appendChild(X),this._rowElements.push(X)}for(;this._rowElements.length>H;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(B,H){this._refreshRowElements(B,H),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(T),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(T),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(B,H,q){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(B,H,q),this.renderRows(0,this._bufferService.rows-1),!B||!H)return;this._selectionRenderModel.update(this._terminal,B,H,q);const X=this._selectionRenderModel.viewportStartRow,G=this._selectionRenderModel.viewportEndRow,Y=this._selectionRenderModel.viewportCappedStartRow,j=this._selectionRenderModel.viewportCappedEndRow;if(Y>=this._bufferService.rows||j<0)return;const U=this._document.createDocumentFragment();if(q){const $=B[0]>H[0];U.appendChild(this._createSelectionElement(Y,$?H[0]:B[0],$?B[0]:H[0],j-Y+1))}else{const $=X===Y?B[0]:0,V=Y===G?H[0]:this._bufferService.cols;U.appendChild(this._createSelectionElement(Y,$,V));const ne=j-Y-1;if(U.appendChild(this._createSelectionElement(Y+1,0,this._bufferService.cols,ne)),Y!==j){const se=G===j?H[0]:this._bufferService.cols;U.appendChild(this._createSelectionElement(j,0,se))}}this._selectionContainer.appendChild(U)}_createSelectionElement(B,H,q,X=1){const G=this._document.createElement("div"),Y=H*this.dimensions.css.cell.width;let j=this.dimensions.css.cell.width*(q-H);return Y+j>this.dimensions.css.canvas.width&&(j=this.dimensions.css.canvas.width-Y),G.style.height=X*this.dimensions.css.cell.height+"px",G.style.top=B*this.dimensions.css.cell.height+"px",G.style.left=`${Y}px`,G.style.width=`${j}px`,G}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(const B of this._rowElements)B.replaceChildren()}renderRows(B,H){const q=this._bufferService.buffer,X=q.ybase+q.y,G=Math.min(q.x,this._bufferService.cols-1),Y=this._optionsService.rawOptions.cursorBlink,j=this._optionsService.rawOptions.cursorStyle,U=this._optionsService.rawOptions.cursorInactiveStyle;for(let $=B;$<=H;$++){const V=$+q.ydisp,ne=this._rowElements[$],se=q.lines.get(V);if(!ne||!se)break;ne.replaceChildren(...this._rowFactory.createRow(se,V,V===X,j,U,G,Y,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${D}${this._terminalClass}`}_handleLinkHover(B){this._setCellUnderline(B.x1,B.x2,B.y1,B.y2,B.cols,!0)}_handleLinkLeave(B){this._setCellUnderline(B.x1,B.x2,B.y1,B.y2,B.cols,!1)}_setCellUnderline(B,H,q,X,G,Y){q<0&&(B=0),X<0&&(H=0);const j=this._bufferService.rows-1;q=Math.max(Math.min(q,j),0),X=Math.max(Math.min(X,j),0),G=Math.min(G,this._bufferService.cols);const U=this._bufferService.buffer,$=U.ybase+U.y,V=Math.min(U.x,G-1),ne=this._optionsService.rawOptions.cursorBlink,se=this._optionsService.rawOptions.cursorStyle,ce=this._optionsService.rawOptions.cursorInactiveStyle;for(let he=q;he<=X;++he){const K=he+U.ydisp,W=this._rowElements[he],J=U.lines.get(K);if(!W||!J)break;W.replaceChildren(...this._rowFactory.createRow(J,K,K===$,se,ce,V,ne,this.dimensions.css.cell.width,this._widthCache,Y?he===q?B:0:-1,Y?(he===X?H:G)-1:-1))}}};s.DomRenderer=P=m([_(7,C.IInstantiationService),_(8,a.ICharSizeService),_(9,C.IOptionsService),_(10,C.IBufferService),_(11,a.ICoreBrowserService),_(12,a.IThemeService)],P)},3787:function(L,s,c){var m=this&&this.__decorate||function(x,M,b,T){var N,F=arguments.length,P=F<3?M:T===null?T=Object.getOwnPropertyDescriptor(M,b):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")P=Reflect.decorate(x,M,b,T);else for(var B=x.length-1;B>=0;B--)(N=x[B])&&(P=(F<3?N(P):F>3?N(M,b,P):N(M,b))||P);return F>3&&P&&Object.defineProperty(M,b,P),P},_=this&&this.__param||function(x,M){return function(b,T){M(b,T,x)}};Object.defineProperty(s,"__esModule",{value:!0}),s.DomRendererRowFactory=void 0;const u=c(2223),y=c(643),S=c(511),E=c(2585),g=c(8055),a=c(4725),f=c(4269),d=c(6171),h=c(3734);let C=s.DomRendererRowFactory=class{constructor(x,M,b,T,N,F,P){this._document=x,this._characterJoinerService=M,this._optionsService=b,this._coreBrowserService=T,this._coreService=N,this._decorationService=F,this._themeService=P,this._workCell=new S.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(x,M,b){this._selectionStart=x,this._selectionEnd=M,this._columnSelectMode=b}createRow(x,M,b,T,N,F,P,B,H,q,X){const G=[],Y=this._characterJoinerService.getJoinedCharacters(M),j=this._themeService.colors;let U,$=x.getNoBgTrimmedLength();b&&$<F+1&&($=F+1);let V=0,ne="",se=0,ce=0,he=0,K=!1,W=0,J=!1,Z=0;const de=[],ee=q!==-1&&X!==-1;for(let xe=0;xe<$;xe++){x.loadCell(xe,this._workCell);let ke=this._workCell.getWidth();if(ke===0)continue;let le=!1,we=xe,me=this._workCell;if(Y.length>0&&xe===Y[0][0]){le=!0;const Re=Y.shift();me=new f.JoinedCellData(this._workCell,x.translateToString(!0,Re[0],Re[1]),Re[1]-Re[0]),we=Re[1]-1,ke=me.getWidth()}const Qe=this._isCellInSelection(xe,M),nt=b&&xe===F,De=ee&&xe>=q&&xe<=X;let Te=!1;this._decorationService.forEachDecorationAtCell(xe,M,void 0,(Re=>{Te=!0}));let We=me.getChars()||y.WHITESPACE_CELL_CHAR;if(We===" "&&(me.isUnderline()||me.isOverline())&&(We=" "),Z=ke*B-H.get(We,me.isBold(),me.isItalic()),U){if(V&&(Qe&&J||!Qe&&!J&&me.bg===se)&&(Qe&&J&&j.selectionForeground||me.fg===ce)&&me.extended.ext===he&&De===K&&Z===W&&!nt&&!le&&!Te){me.isInvisible()?ne+=y.WHITESPACE_CELL_CHAR:ne+=We,V++;continue}V&&(U.textContent=ne),U=this._document.createElement("span"),V=0,ne=""}else U=this._document.createElement("span");if(se=me.bg,ce=me.fg,he=me.extended.ext,K=De,W=Z,J=Qe,le&&F>=xe&&F<=we&&(F=xe),!this._coreService.isCursorHidden&&nt&&this._coreService.isCursorInitialized){if(de.push("xterm-cursor"),this._coreBrowserService.isFocused)P&&de.push("xterm-cursor-blink"),de.push(T==="bar"?"xterm-cursor-bar":T==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(N)switch(N){case"outline":de.push("xterm-cursor-outline");break;case"block":de.push("xterm-cursor-block");break;case"bar":de.push("xterm-cursor-bar");break;case"underline":de.push("xterm-cursor-underline")}}if(me.isBold()&&de.push("xterm-bold"),me.isItalic()&&de.push("xterm-italic"),me.isDim()&&de.push("xterm-dim"),ne=me.isInvisible()?y.WHITESPACE_CELL_CHAR:me.getChars()||y.WHITESPACE_CELL_CHAR,me.isUnderline()&&(de.push(`xterm-underline-${me.extended.underlineStyle}`),ne===" "&&(ne=" "),!me.isUnderlineColorDefault()))if(me.isUnderlineColorRGB())U.style.textDecorationColor=`rgb(${h.AttributeData.toColorRGB(me.getUnderlineColor()).join(",")})`;else{let Re=me.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&me.isBold()&&Re<8&&(Re+=8),U.style.textDecorationColor=j.ansi[Re].css}me.isOverline()&&(de.push("xterm-overline"),ne===" "&&(ne=" ")),me.isStrikethrough()&&de.push("xterm-strikethrough"),De&&(U.style.textDecoration="underline");let Le=me.getFgColor(),Ke=me.getFgColorMode(),$e=me.getBgColor(),tt=me.getBgColorMode();const St=!!me.isInverse();if(St){const Re=Le;Le=$e,$e=Re;const rt=Ke;Ke=tt,tt=rt}let ze,ut,Ze,ge=!1;switch(this._decorationService.forEachDecorationAtCell(xe,M,void 0,(Re=>{Re.options.layer!=="top"&&ge||(Re.backgroundColorRGB&&(tt=50331648,$e=Re.backgroundColorRGB.rgba>>8&16777215,ze=Re.backgroundColorRGB),Re.foregroundColorRGB&&(Ke=50331648,Le=Re.foregroundColorRGB.rgba>>8&16777215,ut=Re.foregroundColorRGB),ge=Re.options.layer==="top")})),!ge&&Qe&&(ze=this._coreBrowserService.isFocused?j.selectionBackgroundOpaque:j.selectionInactiveBackgroundOpaque,$e=ze.rgba>>8&16777215,tt=50331648,ge=!0,j.selectionForeground&&(Ke=50331648,Le=j.selectionForeground.rgba>>8&16777215,ut=j.selectionForeground)),ge&&de.push("xterm-decoration-top"),tt){case 16777216:case 33554432:Ze=j.ansi[$e],de.push(`xterm-bg-${$e}`);break;case 50331648:Ze=g.channels.toColor($e>>16,$e>>8&255,255&$e),this._addStyle(U,`background-color:#${D(($e>>>0).toString(16),"0",6)}`);break;default:St?(Ze=j.foreground,de.push(`xterm-bg-${u.INVERTED_DEFAULT_COLOR}`)):Ze=j.background}switch(ze||me.isDim()&&(ze=g.color.multiplyOpacity(Ze,.5)),Ke){case 16777216:case 33554432:me.isBold()&&Le<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Le+=8),this._applyMinimumContrast(U,Ze,j.ansi[Le],me,ze,void 0)||de.push(`xterm-fg-${Le}`);break;case 50331648:const Re=g.channels.toColor(Le>>16&255,Le>>8&255,255&Le);this._applyMinimumContrast(U,Ze,Re,me,ze,ut)||this._addStyle(U,`color:#${D(Le.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(U,Ze,j.foreground,me,ze,ut)||St&&de.push(`xterm-fg-${u.INVERTED_DEFAULT_COLOR}`)}de.length&&(U.className=de.join(" "),de.length=0),nt||le||Te?U.textContent=ne:V++,Z!==this.defaultSpacing&&(U.style.letterSpacing=`${Z}px`),G.push(U),xe=we}return U&&V&&(U.textContent=ne),G}_applyMinimumContrast(x,M,b,T,N,F){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,d.treatGlyphAsBackgroundColor)(T.getCode()))return!1;const P=this._getContrastCache(T);let B;if(N||F||(B=P.getColor(M.rgba,b.rgba)),B===void 0){const H=this._optionsService.rawOptions.minimumContrastRatio/(T.isDim()?2:1);B=g.color.ensureContrastRatio(N||M,F||b,H),P.setColor((N||M).rgba,(F||b).rgba,B??null)}return!!B&&(this._addStyle(x,`color:${B.css}`),!0)}_getContrastCache(x){return x.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(x,M){x.setAttribute("style",`${x.getAttribute("style")||""}${M};`)}_isCellInSelection(x,M){const b=this._selectionStart,T=this._selectionEnd;return!(!b||!T)&&(this._columnSelectMode?b[0]<=T[0]?x>=b[0]&&M>=b[1]&&x<T[0]&&M<=T[1]:x<b[0]&&M>=b[1]&&x>=T[0]&&M<=T[1]:M>b[1]&&M<T[1]||b[1]===T[1]&&M===b[1]&&x>=b[0]&&x<T[0]||b[1]<T[1]&&M===T[1]&&x<T[0]||b[1]<T[1]&&M===b[1]&&x>=b[0])}};function D(x,M,b){for(;x.length<b;)x=M+x;return x}s.DomRendererRowFactory=C=m([_(1,a.ICharacterJoinerService),_(2,E.IOptionsService),_(3,a.ICoreBrowserService),_(4,E.ICoreService),_(5,E.IDecorationService),_(6,a.IThemeService)],C)},2550:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WidthCache=void 0,s.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 _=c.createElement("span");_.classList.add("xterm-char-measure-element");const u=c.createElement("span");u.classList.add("xterm-char-measure-element"),u.style.fontWeight="bold";const y=c.createElement("span");y.classList.add("xterm-char-measure-element"),y.style.fontStyle="italic";const S=c.createElement("span");S.classList.add("xterm-char-measure-element"),S.style.fontWeight="bold",S.style.fontStyle="italic",this._measureElements=[_,u,y,S],this._container.appendChild(_),this._container.appendChild(u),this._container.appendChild(y),this._container.appendChild(S),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,_,u){c===this._font&&m===this._fontSize&&_===this._weight&&u===this._weightBold||(this._font=c,this._fontSize=m,this._weight=_,this._weightBold=u,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${_}`,this._measureElements[1].style.fontWeight=`${u}`,this._measureElements[2].style.fontWeight=`${_}`,this._measureElements[3].style.fontWeight=`${u}`,this.clear())}get(c,m,_){let u=0;if(!m&&!_&&c.length===1&&(u=c.charCodeAt(0))<256){if(this._flat[u]!==-9999)return this._flat[u];const E=this._measure(c,0);return E>0&&(this._flat[u]=E),E}let y=c;m&&(y+="B"),_&&(y+="I");let S=this._holey.get(y);if(S===void 0){let E=0;m&&(E|=1),_&&(E|=2),S=this._measure(c,E),S>0&&this._holey.set(y,S)}return S}_measure(c,m){const _=this._measureElements[m];return _.textContent=c.repeat(32),_.offsetWidth/32}}},2223:(L,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TEXT_BASELINE=s.DIM_OPACITY=s.INVERTED_DEFAULT_COLOR=void 0;const m=c(6114);s.INVERTED_DEFAULT_COLOR=257,s.DIM_OPACITY=.5,s.TEXT_BASELINE=m.isFirefox||m.isLegacyEdge?"bottom":"ideographic"},6171:(L,s)=>{function c(_){return 57508<=_&&_<=57558}function m(_){return _>=128512&&_<=128591||_>=127744&&_<=128511||_>=128640&&_<=128767||_>=9728&&_<=9983||_>=9984&&_<=10175||_>=65024&&_<=65039||_>=129280&&_<=129535||_>=127462&&_<=127487}Object.defineProperty(s,"__esModule",{value:!0}),s.computeNextVariantOffset=s.createRenderDimensions=s.treatGlyphAsBackgroundColor=s.allowRescaling=s.isEmoji=s.isRestrictedPowerlineGlyph=s.isPowerlineGlyph=s.throwIfFalsy=void 0,s.throwIfFalsy=function(_){if(!_)throw new Error("value must not be falsy");return _},s.isPowerlineGlyph=c,s.isRestrictedPowerlineGlyph=function(_){return 57520<=_&&_<=57527},s.isEmoji=m,s.allowRescaling=function(_,u,y,S){return u===1&&y>Math.ceil(1.5*S)&&_!==void 0&&_>255&&!m(_)&&!c(_)&&!(function(E){return 57344<=E&&E<=63743})(_)},s.treatGlyphAsBackgroundColor=function(_){return c(_)||(function(u){return 9472<=u&&u<=9631})(_)},s.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}}}},s.computeNextVariantOffset=function(_,u,y=0){return(_-(2*Math.round(u)-y))%(2*Math.round(u))}},6052:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.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(_,u,y,S=!1){if(this.selectionStart=u,this.selectionEnd=y,!u||!y||u[0]===y[0]&&u[1]===y[1])return void this.clear();const E=_.buffers.active.ydisp,g=u[1]-E,a=y[1]-E,f=Math.max(g,0),d=Math.min(a,_.rows-1);f>=_.rows||d<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=S,this.viewportStartRow=g,this.viewportEndRow=a,this.viewportCappedStartRow=f,this.viewportCappedEndRow=d,this.startCol=u[0],this.endCol=y[0])}isCellSelected(_,u,y){return!!this.hasSelection&&(y-=_.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?u>=this.startCol&&y>=this.viewportCappedStartRow&&u<this.endCol&&y<=this.viewportCappedEndRow:u<this.startCol&&y>=this.viewportCappedStartRow&&u>=this.endCol&&y<=this.viewportCappedEndRow:y>this.viewportStartRow&&y<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&y===this.viewportStartRow&&u>=this.startCol&&u<this.endCol||this.viewportStartRow<this.viewportEndRow&&y===this.viewportEndRow&&u<this.endCol||this.viewportStartRow<this.viewportEndRow&&y===this.viewportStartRow&&u>=this.startCol)}}s.createSelectionRenderModel=function(){return new c}},456:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.SelectionModel=void 0,s.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(L,s,c){var m=this&&this.__decorate||function(d,h,C,D){var x,M=arguments.length,b=M<3?h:D===null?D=Object.getOwnPropertyDescriptor(h,C):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(d,h,C,D);else for(var T=d.length-1;T>=0;T--)(x=d[T])&&(b=(M<3?x(b):M>3?x(h,C,b):x(h,C))||b);return M>3&&b&&Object.defineProperty(h,C,b),b},_=this&&this.__param||function(d,h){return function(C,D){h(C,D,d)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CharSizeService=void 0;const u=c(2585),y=c(8460),S=c(844);let E=s.CharSizeService=class extends S.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(d,h,C){super(),this._optionsService=C,this.width=0,this.height=0,this._onCharSizeChange=this.register(new y.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new f(this._optionsService))}catch{this._measureStrategy=this.register(new a(d,h,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const d=this._measureStrategy.measure();d.width===this.width&&d.height===this.height||(this.width=d.width,this.height=d.height,this._onCharSizeChange.fire())}};s.CharSizeService=E=m([_(2,u.IOptionsService)],E);class g extends S.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(h,C){h!==void 0&&h>0&&C!==void 0&&C>0&&(this._result.width=h,this._result.height=C)}}class a extends g{constructor(h,C,D){super(),this._document=h,this._parentElement=C,this._optionsService=D,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 f extends g{constructor(h){super(),this._optionsService=h,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const C=this._ctx.measureText("W");if(!("width"in C&&"fontBoundingBoxAscent"in C&&"fontBoundingBoxDescent"in C))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const h=this._ctx.measureText("W");return this._validateAndSet(h.width,h.fontBoundingBoxAscent+h.fontBoundingBoxDescent),this._result}}},4269:function(L,s,c){var m=this&&this.__decorate||function(f,d,h,C){var D,x=arguments.length,M=x<3?d:C===null?C=Object.getOwnPropertyDescriptor(d,h):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(f,d,h,C);else for(var b=f.length-1;b>=0;b--)(D=f[b])&&(M=(x<3?D(M):x>3?D(d,h,M):D(d,h))||M);return x>3&&M&&Object.defineProperty(d,h,M),M},_=this&&this.__param||function(f,d){return function(h,C){d(h,C,f)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CharacterJoinerService=s.JoinedCellData=void 0;const u=c(3734),y=c(643),S=c(511),E=c(2585);class g extends u.AttributeData{constructor(d,h,C){super(),this.content=0,this.combinedData="",this.fg=d.fg,this.bg=d.bg,this.combinedData=h,this._width=C}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(d){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}s.JoinedCellData=g;let a=s.CharacterJoinerService=class Yp{constructor(d){this._bufferService=d,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new S.CellData}register(d){const h={id:this._nextCharacterJoinerId++,handler:d};return this._characterJoiners.push(h),h.id}deregister(d){for(let h=0;h<this._characterJoiners.length;h++)if(this._characterJoiners[h].id===d)return this._characterJoiners.splice(h,1),!0;return!1}getJoinedCharacters(d){if(this._characterJoiners.length===0)return[];const h=this._bufferService.buffer.lines.get(d);if(!h||h.length===0)return[];const C=[],D=h.translateToString(!0);let x=0,M=0,b=0,T=h.getFg(0),N=h.getBg(0);for(let F=0;F<h.getTrimmedLength();F++)if(h.loadCell(F,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==T||this._workCell.bg!==N){if(F-x>1){const P=this._getJoinedRanges(D,b,M,h,x);for(let B=0;B<P.length;B++)C.push(P[B])}x=F,b=M,T=this._workCell.fg,N=this._workCell.bg}M+=this._workCell.getChars().length||y.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-x>1){const F=this._getJoinedRanges(D,b,M,h,x);for(let P=0;P<F.length;P++)C.push(F[P])}return C}_getJoinedRanges(d,h,C,D,x){const M=d.substring(h,C);let b=[];try{b=this._characterJoiners[0].handler(M)}catch(T){console.error(T)}for(let T=1;T<this._characterJoiners.length;T++)try{const N=this._characterJoiners[T].handler(M);for(let F=0;F<N.length;F++)Yp._mergeRanges(b,N[F])}catch(N){console.error(N)}return this._stringRangesToCellRanges(b,D,x),b}_stringRangesToCellRanges(d,h,C){let D=0,x=!1,M=0,b=d[D];if(b){for(let T=C;T<this._bufferService.cols;T++){const N=h.getWidth(T),F=h.getString(T).length||y.WHITESPACE_CELL_CHAR.length;if(N!==0){if(!x&&b[0]<=M&&(b[0]=T,x=!0),b[1]<=M){if(b[1]=T,b=d[++D],!b)break;b[0]<=M?(b[0]=T,x=!0):x=!1}M+=F}}b&&(b[1]=this._bufferService.cols)}}static _mergeRanges(d,h){let C=!1;for(let D=0;D<d.length;D++){const x=d[D];if(C){if(h[1]<=x[0])return d[D-1][1]=h[1],d;if(h[1]<=x[1])return d[D-1][1]=Math.max(h[1],x[1]),d.splice(D,1),d;d.splice(D,1),D--}else{if(h[1]<=x[0])return d.splice(D,0,h),d;if(h[1]<=x[1])return x[0]=Math.min(h[0],x[0]),d;h[0]<x[1]&&(x[0]=Math.min(h[0],x[0]),C=!0)}}return C?d[d.length-1][1]=h[1]:d.push(h),d}};s.CharacterJoinerService=a=m([_(0,E.IBufferService)],a)},5114:(L,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CoreBrowserService=void 0;const m=c(844),_=c(8460),u=c(3656);class y extends m.Disposable{constructor(g,a,f){super(),this._textarea=g,this._window=a,this.mainDocument=f,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new S(this._window),this._onDprChange=this.register(new _.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new _.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((d=>this._screenDprMonitor.setWindow(d)))),this.register((0,_.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(g){this._window!==g&&(this._window=g,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}}s.CoreBrowserService=y;class S extends m.Disposable{constructor(g){super(),this._parentWindow=g,this._windowResizeListener=this.register(new m.MutableDisposable),this._onDprChange=this.register(new _.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(g){this._parentWindow=g,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,u.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var g;this._outerListener&&((g=this._resolutionMediaMatchList)==null||g.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:(L,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.LinkProviderService=void 0;const m=c(844);class _ extends m.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,m.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(y){return this.linkProviders.push(y),{dispose:()=>{const S=this.linkProviders.indexOf(y);S!==-1&&this.linkProviders.splice(S,1)}}}}s.LinkProviderService=_},8934:function(L,s,c){var m=this&&this.__decorate||function(E,g,a,f){var d,h=arguments.length,C=h<3?g:f===null?f=Object.getOwnPropertyDescriptor(g,a):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(E,g,a,f);else for(var D=E.length-1;D>=0;D--)(d=E[D])&&(C=(h<3?d(C):h>3?d(g,a,C):d(g,a))||C);return h>3&&C&&Object.defineProperty(g,a,C),C},_=this&&this.__param||function(E,g){return function(a,f){g(a,f,E)}};Object.defineProperty(s,"__esModule",{value:!0}),s.MouseService=void 0;const u=c(4725),y=c(9806);let S=s.MouseService=class{constructor(E,g){this._renderService=E,this._charSizeService=g}getCoords(E,g,a,f,d){return(0,y.getCoords)(window,E,g,a,f,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,d)}getMouseReportCoords(E,g){const a=(0,y.getCoordsRelativeToElement)(window,E,g);if(this._charSizeService.hasValidSize)return a[0]=Math.min(Math.max(a[0],0),this._renderService.dimensions.css.canvas.width-1),a[1]=Math.min(Math.max(a[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(a[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(a[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(a[0]),y:Math.floor(a[1])}}};s.MouseService=S=m([_(0,u.IRenderService),_(1,u.ICharSizeService)],S)},3230:function(L,s,c){var m=this&&this.__decorate||function(d,h,C,D){var x,M=arguments.length,b=M<3?h:D===null?D=Object.getOwnPropertyDescriptor(h,C):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(d,h,C,D);else for(var T=d.length-1;T>=0;T--)(x=d[T])&&(b=(M<3?x(b):M>3?x(h,C,b):x(h,C))||b);return M>3&&b&&Object.defineProperty(h,C,b),b},_=this&&this.__param||function(d,h){return function(C,D){h(C,D,d)}};Object.defineProperty(s,"__esModule",{value:!0}),s.RenderService=void 0;const u=c(6193),y=c(4725),S=c(8460),E=c(844),g=c(7226),a=c(2585);let f=s.RenderService=class extends E.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(d,h,C,D,x,M,b,T){super(),this._rowCount=d,this._charSizeService=D,this._renderer=this.register(new E.MutableDisposable),this._pausedResizeTask=new g.DebouncedIdleTask,this._observerDisposable=this.register(new E.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 S.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new S.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new S.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new S.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new u.RenderDebouncer(((N,F)=>this._renderRows(N,F)),b),this.register(this._renderDebouncer),this.register(b.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(M.onResize((()=>this._fullRefresh()))),this.register(M.buffers.onBufferActivate((()=>{var N;return(N=this._renderer.value)==null?void 0:N.clear()}))),this.register(C.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(x.onDecorationRegistered((()=>this._fullRefresh()))),this.register(x.onDecorationRemoved((()=>this._fullRefresh()))),this.register(C.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(M.cols,M.rows),this._fullRefresh()}))),this.register(C.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(M.buffer.y,M.buffer.y,!0)))),this.register(T.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(b.window,h),this.register(b.onWindowChange((N=>this._registerIntersectionObserver(N,h))))}_registerIntersectionObserver(d,h){if("IntersectionObserver"in d){const C=new d.IntersectionObserver((D=>this._handleIntersectionChange(D[D.length-1])),{threshold:0});C.observe(h),this._observerDisposable.value=(0,E.toDisposable)((()=>C.disconnect()))}}_handleIntersectionChange(d){this._isPaused=d.isIntersecting===void 0?d.intersectionRatio===0:!d.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(d,h,C=!1){this._isPaused?this._needsFullRefresh=!0:(C||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(d,h,this._rowCount))}_renderRows(d,h){this._renderer.value&&(d=Math.min(d,this._rowCount-1),h=Math.min(h,this._rowCount-1),this._renderer.value.renderRows(d,h),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:d,end:h}),this._onRender.fire({start:d,end:h}),this._isNextRenderRedrawOnly=!0)}resize(d,h){this._rowCount=h,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(d){this._renderer.value=d,this._renderer.value&&(this._renderer.value.onRequestRedraw((h=>this.refreshRows(h.start,h.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(d){return this._renderDebouncer.addRefreshCallback(d)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var d,h;this._renderer.value&&((h=(d=this._renderer.value).clearTextureAtlas)==null||h.call(d),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(d,h){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var C;return(C=this._renderer.value)==null?void 0:C.handleResize(d,h)})):this._renderer.value.handleResize(d,h),this._fullRefresh())}handleCharSizeChanged(){var d;(d=this._renderer.value)==null||d.handleCharSizeChanged()}handleBlur(){var d;(d=this._renderer.value)==null||d.handleBlur()}handleFocus(){var d;(d=this._renderer.value)==null||d.handleFocus()}handleSelectionChanged(d,h,C){var D;this._selectionState.start=d,this._selectionState.end=h,this._selectionState.columnSelectMode=C,(D=this._renderer.value)==null||D.handleSelectionChanged(d,h,C)}handleCursorMove(){var d;(d=this._renderer.value)==null||d.handleCursorMove()}clear(){var d;(d=this._renderer.value)==null||d.clear()}};s.RenderService=f=m([_(2,a.IOptionsService),_(3,y.ICharSizeService),_(4,a.IDecorationService),_(5,a.IBufferService),_(6,y.ICoreBrowserService),_(7,y.IThemeService)],f)},9312:function(L,s,c){var m=this&&this.__decorate||function(b,T,N,F){var P,B=arguments.length,H=B<3?T:F===null?F=Object.getOwnPropertyDescriptor(T,N):F;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")H=Reflect.decorate(b,T,N,F);else for(var q=b.length-1;q>=0;q--)(P=b[q])&&(H=(B<3?P(H):B>3?P(T,N,H):P(T,N))||H);return B>3&&H&&Object.defineProperty(T,N,H),H},_=this&&this.__param||function(b,T){return function(N,F){T(N,F,b)}};Object.defineProperty(s,"__esModule",{value:!0}),s.SelectionService=void 0;const u=c(9806),y=c(9504),S=c(456),E=c(4725),g=c(8460),a=c(844),f=c(6114),d=c(4841),h=c(511),C=c(2585),D=" ",x=new RegExp(D,"g");let M=s.SelectionService=class extends a.Disposable{constructor(b,T,N,F,P,B,H,q,X){super(),this._element=b,this._screenElement=T,this._linkifier=N,this._bufferService=F,this._coreService=P,this._mouseService=B,this._optionsService=H,this._renderService=q,this._coreBrowserService=X,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new h.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new g.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new g.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new g.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new g.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=G=>this._handleMouseMove(G),this._mouseUpListener=G=>this._handleMouseUp(G),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((G=>this._handleTrim(G))),this.register(this._bufferService.buffers.onBufferActivate((G=>this._handleBufferActivate(G)))),this.enable(),this._model=new S.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,a.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 b=this._model.finalSelectionStart,T=this._model.finalSelectionEnd;return!(!b||!T||b[0]===T[0]&&b[1]===T[1])}get selectionText(){const b=this._model.finalSelectionStart,T=this._model.finalSelectionEnd;if(!b||!T)return"";const N=this._bufferService.buffer,F=[];if(this._activeSelectionMode===3){if(b[0]===T[0])return"";const P=b[0]<T[0]?b[0]:T[0],B=b[0]<T[0]?T[0]:b[0];for(let H=b[1];H<=T[1];H++){const q=N.translateBufferLineToString(H,!0,P,B);F.push(q)}}else{const P=b[1]===T[1]?T[0]:void 0;F.push(N.translateBufferLineToString(b[1],!0,b[0],P));for(let B=b[1]+1;B<=T[1]-1;B++){const H=N.lines.get(B),q=N.translateBufferLineToString(B,!0);H!=null&&H.isWrapped?F[F.length-1]+=q:F.push(q)}if(b[1]!==T[1]){const B=N.lines.get(T[1]),H=N.translateBufferLineToString(T[1],!0,0,T[0]);B&&B.isWrapped?F[F.length-1]+=H:F.push(H)}}return F.map((P=>P.replace(x," "))).join(f.isWindows?`\r
113
- `:`
114
- `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(b){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),f.isLinux&&b&&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(b){const T=this._getMouseBufferCoords(b),N=this._model.finalSelectionStart,F=this._model.finalSelectionEnd;return!!(N&&F&&T)&&this._areCoordsInSelection(T,N,F)}isCellInSelection(b,T){const N=this._model.finalSelectionStart,F=this._model.finalSelectionEnd;return!(!N||!F)&&this._areCoordsInSelection([b,T],N,F)}_areCoordsInSelection(b,T,N){return b[1]>T[1]&&b[1]<N[1]||T[1]===N[1]&&b[1]===T[1]&&b[0]>=T[0]&&b[0]<N[0]||T[1]<N[1]&&b[1]===N[1]&&b[0]<N[0]||T[1]<N[1]&&b[1]===T[1]&&b[0]>=T[0]}_selectWordAtCursor(b,T){var P,B;const N=(B=(P=this._linkifier.currentLink)==null?void 0:P.link)==null?void 0:B.range;if(N)return this._model.selectionStart=[N.start.x-1,N.start.y-1],this._model.selectionStartLength=(0,d.getRangeLength)(N,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const F=this._getMouseBufferCoords(b);return!!F&&(this._selectWordAt(F,T),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(b,T){this._model.clearSelection(),b=Math.max(b,0),T=Math.min(T,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,b],this._model.selectionEnd=[this._bufferService.cols,T],this.refresh(),this._onSelectionChange.fire()}_handleTrim(b){this._model.handleTrim(b)&&this.refresh()}_getMouseBufferCoords(b){const T=this._mouseService.getCoords(b,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(T)return T[0]--,T[1]--,T[1]+=this._bufferService.buffer.ydisp,T}_getMouseEventScrollAmount(b){let T=(0,u.getCoordsRelativeToElement)(this._coreBrowserService.window,b,this._screenElement)[1];const N=this._renderService.dimensions.css.canvas.height;return T>=0&&T<=N?0:(T>N&&(T-=N),T=Math.min(Math.max(T,-50),50),T/=50,T/Math.abs(T)+Math.round(14*T))}shouldForceSelection(b){return f.isMac?b.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:b.shiftKey}handleMouseDown(b){if(this._mouseDownTimeStamp=b.timeStamp,(b.button!==2||!this.hasSelection)&&b.button===0){if(!this._enabled){if(!this.shouldForceSelection(b))return;b.stopPropagation()}b.preventDefault(),this._dragScrollAmount=0,this._enabled&&b.shiftKey?this._handleIncrementalClick(b):b.detail===1?this._handleSingleClick(b):b.detail===2?this._handleDoubleClick(b):b.detail===3&&this._handleTripleClick(b),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(b){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(b))}_handleSingleClick(b){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(b)?3:0,this._model.selectionStart=this._getMouseBufferCoords(b),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const T=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);T&&T.length!==this._model.selectionStart[0]&&T.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(b){this._selectWordAtCursor(b,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(b){const T=this._getMouseBufferCoords(b);T&&(this._activeSelectionMode=2,this._selectLineAt(T[1]))}shouldColumnSelect(b){return b.altKey&&!(f.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(b){if(b.stopImmediatePropagation(),!this._model.selectionStart)return;const T=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(b),!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(b),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const N=this._bufferService.buffer;if(this._model.selectionEnd[1]<N.lines.length){const F=N.lines.get(this._model.selectionEnd[1]);F&&F.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}T&&T[0]===this._model.selectionEnd[0]&&T[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});const b=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(b.ydisp+this._bufferService.rows,b.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=b.ydisp),this.refresh()}}_handleMouseUp(b){const T=b.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&T<500&&b.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const N=this._mouseService.getCoords(b,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(N&&N[0]!==void 0&&N[1]!==void 0){const F=(0,y.moveToCellSequence)(N[0]-1,N[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(F,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const b=this._model.finalSelectionStart,T=this._model.finalSelectionEnd,N=!(!b||!T||b[0]===T[0]&&b[1]===T[1]);N?b&&T&&(this._oldSelectionStart&&this._oldSelectionEnd&&b[0]===this._oldSelectionStart[0]&&b[1]===this._oldSelectionStart[1]&&T[0]===this._oldSelectionEnd[0]&&T[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(b,T,N)):this._oldHasSelection&&this._fireOnSelectionChange(b,T,N)}_fireOnSelectionChange(b,T,N){this._oldSelectionStart=b,this._oldSelectionEnd=T,this._oldHasSelection=N,this._onSelectionChange.fire()}_handleBufferActivate(b){this.clearSelection(),this._trimListener.dispose(),this._trimListener=b.activeBuffer.lines.onTrim((T=>this._handleTrim(T)))}_convertViewportColToCharacterIndex(b,T){let N=T;for(let F=0;T>=F;F++){const P=b.loadCell(F,this._workCell).getChars().length;this._workCell.getWidth()===0?N--:P>1&&T!==F&&(N+=P-1)}return N}setSelection(b,T,N){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[b,T],this._model.selectionStartLength=N,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(b){this._isClickInSelection(b)||(this._selectWordAtCursor(b,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(b,T,N=!0,F=!0){if(b[0]>=this._bufferService.cols)return;const P=this._bufferService.buffer,B=P.lines.get(b[1]);if(!B)return;const H=P.translateBufferLineToString(b[1],!1);let q=this._convertViewportColToCharacterIndex(B,b[0]),X=q;const G=b[0]-q;let Y=0,j=0,U=0,$=0;if(H.charAt(q)===" "){for(;q>0&&H.charAt(q-1)===" ";)q--;for(;X<H.length&&H.charAt(X+1)===" ";)X++}else{let se=b[0],ce=b[0];B.getWidth(se)===0&&(Y++,se--),B.getWidth(ce)===2&&(j++,ce++);const he=B.getString(ce).length;for(he>1&&($+=he-1,X+=he-1);se>0&&q>0&&!this._isCharWordSeparator(B.loadCell(se-1,this._workCell));){B.loadCell(se-1,this._workCell);const K=this._workCell.getChars().length;this._workCell.getWidth()===0?(Y++,se--):K>1&&(U+=K-1,q-=K-1),q--,se--}for(;ce<B.length&&X+1<H.length&&!this._isCharWordSeparator(B.loadCell(ce+1,this._workCell));){B.loadCell(ce+1,this._workCell);const K=this._workCell.getChars().length;this._workCell.getWidth()===2?(j++,ce++):K>1&&($+=K-1,X+=K-1),X++,ce++}}X++;let V=q+G-Y+U,ne=Math.min(this._bufferService.cols,X-q+Y+j-U-$);if(T||H.slice(q,X).trim()!==""){if(N&&V===0&&B.getCodePoint(0)!==32){const se=P.lines.get(b[1]-1);if(se&&B.isWrapped&&se.getCodePoint(this._bufferService.cols-1)!==32){const ce=this._getWordAt([this._bufferService.cols-1,b[1]-1],!1,!0,!1);if(ce){const he=this._bufferService.cols-ce.start;V-=he,ne+=he}}}if(F&&V+ne===this._bufferService.cols&&B.getCodePoint(this._bufferService.cols-1)!==32){const se=P.lines.get(b[1]+1);if(se!=null&&se.isWrapped&&se.getCodePoint(0)!==32){const ce=this._getWordAt([0,b[1]+1],!1,!1,!0);ce&&(ne+=ce.length)}}return{start:V,length:ne}}}_selectWordAt(b,T){const N=this._getWordAt(b,T);if(N){for(;N.start<0;)N.start+=this._bufferService.cols,b[1]--;this._model.selectionStart=[N.start,b[1]],this._model.selectionStartLength=N.length}}_selectToWordAt(b){const T=this._getWordAt(b,!0);if(T){let N=b[1];for(;T.start<0;)T.start+=this._bufferService.cols,N--;if(!this._model.areSelectionValuesReversed())for(;T.start+T.length>this._bufferService.cols;)T.length-=this._bufferService.cols,N++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?T.start:T.start+T.length,N]}}_isCharWordSeparator(b){return b.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(b.getChars())>=0}_selectLineAt(b){const T=this._bufferService.buffer.getWrappedRangeForLine(b),N={start:{x:0,y:T.first},end:{x:this._bufferService.cols-1,y:T.last}};this._model.selectionStart=[0,T.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,d.getRangeLength)(N,this._bufferService.cols)}};s.SelectionService=M=m([_(3,C.IBufferService),_(4,C.ICoreService),_(5,E.IMouseService),_(6,C.IOptionsService),_(7,E.IRenderService),_(8,E.ICoreBrowserService)],M)},4725:(L,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ILinkProviderService=s.IThemeService=s.ICharacterJoinerService=s.ISelectionService=s.IRenderService=s.IMouseService=s.ICoreBrowserService=s.ICharSizeService=void 0;const m=c(8343);s.ICharSizeService=(0,m.createDecorator)("CharSizeService"),s.ICoreBrowserService=(0,m.createDecorator)("CoreBrowserService"),s.IMouseService=(0,m.createDecorator)("MouseService"),s.IRenderService=(0,m.createDecorator)("RenderService"),s.ISelectionService=(0,m.createDecorator)("SelectionService"),s.ICharacterJoinerService=(0,m.createDecorator)("CharacterJoinerService"),s.IThemeService=(0,m.createDecorator)("ThemeService"),s.ILinkProviderService=(0,m.createDecorator)("LinkProviderService")},6731:function(L,s,c){var m=this&&this.__decorate||function(M,b,T,N){var F,P=arguments.length,B=P<3?b:N===null?N=Object.getOwnPropertyDescriptor(b,T):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(M,b,T,N);else for(var H=M.length-1;H>=0;H--)(F=M[H])&&(B=(P<3?F(B):P>3?F(b,T,B):F(b,T))||B);return P>3&&B&&Object.defineProperty(b,T,B),B},_=this&&this.__param||function(M,b){return function(T,N){b(T,N,M)}};Object.defineProperty(s,"__esModule",{value:!0}),s.ThemeService=s.DEFAULT_ANSI_COLORS=void 0;const u=c(7239),y=c(8055),S=c(8460),E=c(844),g=c(2585),a=y.css.toColor("#ffffff"),f=y.css.toColor("#000000"),d=y.css.toColor("#ffffff"),h=y.css.toColor("#000000"),C={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};s.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const M=[y.css.toColor("#2e3436"),y.css.toColor("#cc0000"),y.css.toColor("#4e9a06"),y.css.toColor("#c4a000"),y.css.toColor("#3465a4"),y.css.toColor("#75507b"),y.css.toColor("#06989a"),y.css.toColor("#d3d7cf"),y.css.toColor("#555753"),y.css.toColor("#ef2929"),y.css.toColor("#8ae234"),y.css.toColor("#fce94f"),y.css.toColor("#729fcf"),y.css.toColor("#ad7fa8"),y.css.toColor("#34e2e2"),y.css.toColor("#eeeeec")],b=[0,95,135,175,215,255];for(let T=0;T<216;T++){const N=b[T/36%6|0],F=b[T/6%6|0],P=b[T%6];M.push({css:y.channels.toCss(N,F,P),rgba:y.channels.toRgba(N,F,P)})}for(let T=0;T<24;T++){const N=8+10*T;M.push({css:y.channels.toCss(N,N,N),rgba:y.channels.toRgba(N,N,N)})}return M})());let D=s.ThemeService=class extends E.Disposable{get colors(){return this._colors}constructor(M){super(),this._optionsService=M,this._contrastCache=new u.ColorContrastCache,this._halfContrastCache=new u.ColorContrastCache,this._onChangeColors=this.register(new S.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:a,background:f,cursor:d,cursorAccent:h,selectionForeground:void 0,selectionBackgroundTransparent:C,selectionBackgroundOpaque:y.color.blend(f,C),selectionInactiveBackgroundTransparent:C,selectionInactiveBackgroundOpaque:y.color.blend(f,C),ansi:s.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(M={}){const b=this._colors;if(b.foreground=x(M.foreground,a),b.background=x(M.background,f),b.cursor=x(M.cursor,d),b.cursorAccent=x(M.cursorAccent,h),b.selectionBackgroundTransparent=x(M.selectionBackground,C),b.selectionBackgroundOpaque=y.color.blend(b.background,b.selectionBackgroundTransparent),b.selectionInactiveBackgroundTransparent=x(M.selectionInactiveBackground,b.selectionBackgroundTransparent),b.selectionInactiveBackgroundOpaque=y.color.blend(b.background,b.selectionInactiveBackgroundTransparent),b.selectionForeground=M.selectionForeground?x(M.selectionForeground,y.NULL_COLOR):void 0,b.selectionForeground===y.NULL_COLOR&&(b.selectionForeground=void 0),y.color.isOpaque(b.selectionBackgroundTransparent)&&(b.selectionBackgroundTransparent=y.color.opacity(b.selectionBackgroundTransparent,.3)),y.color.isOpaque(b.selectionInactiveBackgroundTransparent)&&(b.selectionInactiveBackgroundTransparent=y.color.opacity(b.selectionInactiveBackgroundTransparent,.3)),b.ansi=s.DEFAULT_ANSI_COLORS.slice(),b.ansi[0]=x(M.black,s.DEFAULT_ANSI_COLORS[0]),b.ansi[1]=x(M.red,s.DEFAULT_ANSI_COLORS[1]),b.ansi[2]=x(M.green,s.DEFAULT_ANSI_COLORS[2]),b.ansi[3]=x(M.yellow,s.DEFAULT_ANSI_COLORS[3]),b.ansi[4]=x(M.blue,s.DEFAULT_ANSI_COLORS[4]),b.ansi[5]=x(M.magenta,s.DEFAULT_ANSI_COLORS[5]),b.ansi[6]=x(M.cyan,s.DEFAULT_ANSI_COLORS[6]),b.ansi[7]=x(M.white,s.DEFAULT_ANSI_COLORS[7]),b.ansi[8]=x(M.brightBlack,s.DEFAULT_ANSI_COLORS[8]),b.ansi[9]=x(M.brightRed,s.DEFAULT_ANSI_COLORS[9]),b.ansi[10]=x(M.brightGreen,s.DEFAULT_ANSI_COLORS[10]),b.ansi[11]=x(M.brightYellow,s.DEFAULT_ANSI_COLORS[11]),b.ansi[12]=x(M.brightBlue,s.DEFAULT_ANSI_COLORS[12]),b.ansi[13]=x(M.brightMagenta,s.DEFAULT_ANSI_COLORS[13]),b.ansi[14]=x(M.brightCyan,s.DEFAULT_ANSI_COLORS[14]),b.ansi[15]=x(M.brightWhite,s.DEFAULT_ANSI_COLORS[15]),M.extendedAnsi){const T=Math.min(b.ansi.length-16,M.extendedAnsi.length);for(let N=0;N<T;N++)b.ansi[N+16]=x(M.extendedAnsi[N],s.DEFAULT_ANSI_COLORS[N+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(M){this._restoreColor(M),this._onChangeColors.fire(this.colors)}_restoreColor(M){if(M!==void 0)switch(M){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[M]=this._restoreColors.ansi[M]}else for(let b=0;b<this._restoreColors.ansi.length;++b)this._colors.ansi[b]=this._restoreColors.ansi[b]}modifyColors(M){M(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function x(M,b){if(M!==void 0)try{return y.css.toColor(M)}catch{}return b}s.ThemeService=D=m([_(0,g.IOptionsService)],D)},6349:(L,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CircularList=void 0;const m=c(8460),_=c(844);class u extends _.Disposable{constructor(S){super(),this._maxLength=S,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(S){if(this._maxLength===S)return;const E=new Array(S);for(let g=0;g<Math.min(S,this.length);g++)E[g]=this._array[this._getCyclicIndex(g)];this._array=E,this._maxLength=S,this._startIndex=0}get length(){return this._length}set length(S){if(S>this._length)for(let E=this._length;E<S;E++)this._array[E]=void 0;this._length=S}get(S){return this._array[this._getCyclicIndex(S)]}set(S,E){this._array[this._getCyclicIndex(S)]=E}push(S){this._array[this._getCyclicIndex(this._length)]=S,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(S,E,...g){if(E){for(let a=S;a<this._length-E;a++)this._array[this._getCyclicIndex(a)]=this._array[this._getCyclicIndex(a+E)];this._length-=E,this.onDeleteEmitter.fire({index:S,amount:E})}for(let a=this._length-1;a>=S;a--)this._array[this._getCyclicIndex(a+g.length)]=this._array[this._getCyclicIndex(a)];for(let a=0;a<g.length;a++)this._array[this._getCyclicIndex(S+a)]=g[a];if(g.length&&this.onInsertEmitter.fire({index:S,amount:g.length}),this._length+g.length>this._maxLength){const a=this._length+g.length-this._maxLength;this._startIndex+=a,this._length=this._maxLength,this.onTrimEmitter.fire(a)}else this._length+=g.length}trimStart(S){S>this._length&&(S=this._length),this._startIndex+=S,this._length-=S,this.onTrimEmitter.fire(S)}shiftElements(S,E,g){if(!(E<=0)){if(S<0||S>=this._length)throw new Error("start argument out of range");if(S+g<0)throw new Error("Cannot shift elements in list beyond index 0");if(g>0){for(let f=E-1;f>=0;f--)this.set(S+f+g,this.get(S+f));const a=S+E+g-this._length;if(a>0)for(this._length+=a;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let a=0;a<E;a++)this.set(S+a+g,this.get(S+a))}}_getCyclicIndex(S){return(this._startIndex+S)%this._maxLength}}s.CircularList=u},1439:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.clone=void 0,s.clone=function c(m,_=5){if(typeof m!="object")return m;const u=Array.isArray(m)?[]:{};for(const y in m)u[y]=_<=1?m[y]:m[y]&&c(m[y],_-1);return u}},8055:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.contrastRatio=s.toPaddedHex=s.rgba=s.rgb=s.css=s.color=s.channels=s.NULL_COLOR=void 0;let c=0,m=0,_=0,u=0;var y,S,E,g,a;function f(h){const C=h.toString(16);return C.length<2?"0"+C:C}function d(h,C){return h<C?(C+.05)/(h+.05):(h+.05)/(C+.05)}s.NULL_COLOR={css:"#00000000",rgba:0},(function(h){h.toCss=function(C,D,x,M){return M!==void 0?`#${f(C)}${f(D)}${f(x)}${f(M)}`:`#${f(C)}${f(D)}${f(x)}`},h.toRgba=function(C,D,x,M=255){return(C<<24|D<<16|x<<8|M)>>>0},h.toColor=function(C,D,x,M){return{css:h.toCss(C,D,x,M),rgba:h.toRgba(C,D,x,M)}}})(y||(s.channels=y={})),(function(h){function C(D,x){return u=Math.round(255*x),[c,m,_]=a.toChannels(D.rgba),{css:y.toCss(c,m,_,u),rgba:y.toRgba(c,m,_,u)}}h.blend=function(D,x){if(u=(255&x.rgba)/255,u===1)return{css:x.css,rgba:x.rgba};const M=x.rgba>>24&255,b=x.rgba>>16&255,T=x.rgba>>8&255,N=D.rgba>>24&255,F=D.rgba>>16&255,P=D.rgba>>8&255;return c=N+Math.round((M-N)*u),m=F+Math.round((b-F)*u),_=P+Math.round((T-P)*u),{css:y.toCss(c,m,_),rgba:y.toRgba(c,m,_)}},h.isOpaque=function(D){return(255&D.rgba)==255},h.ensureContrastRatio=function(D,x,M){const b=a.ensureContrastRatio(D.rgba,x.rgba,M);if(b)return y.toColor(b>>24&255,b>>16&255,b>>8&255)},h.opaque=function(D){const x=(255|D.rgba)>>>0;return[c,m,_]=a.toChannels(x),{css:y.toCss(c,m,_),rgba:x}},h.opacity=C,h.multiplyOpacity=function(D,x){return u=255&D.rgba,C(D,u*x/255)},h.toColorRGB=function(D){return[D.rgba>>24&255,D.rgba>>16&255,D.rgba>>8&255]}})(S||(s.color=S={})),(function(h){let C,D;try{const x=document.createElement("canvas");x.width=1,x.height=1;const M=x.getContext("2d",{willReadFrequently:!0});M&&(C=M,C.globalCompositeOperation="copy",D=C.createLinearGradient(0,0,1,1))}catch{}h.toColor=function(x){if(x.match(/#[\da-f]{3,8}/i))switch(x.length){case 4:return c=parseInt(x.slice(1,2).repeat(2),16),m=parseInt(x.slice(2,3).repeat(2),16),_=parseInt(x.slice(3,4).repeat(2),16),y.toColor(c,m,_);case 5:return c=parseInt(x.slice(1,2).repeat(2),16),m=parseInt(x.slice(2,3).repeat(2),16),_=parseInt(x.slice(3,4).repeat(2),16),u=parseInt(x.slice(4,5).repeat(2),16),y.toColor(c,m,_,u);case 7:return{css:x,rgba:(parseInt(x.slice(1),16)<<8|255)>>>0};case 9:return{css:x,rgba:parseInt(x.slice(1),16)>>>0}}const M=x.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(M)return c=parseInt(M[1]),m=parseInt(M[2]),_=parseInt(M[3]),u=Math.round(255*(M[5]===void 0?1:parseFloat(M[5]))),y.toColor(c,m,_,u);if(!C||!D)throw new Error("css.toColor: Unsupported css format");if(C.fillStyle=D,C.fillStyle=x,typeof C.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(C.fillRect(0,0,1,1),[c,m,_,u]=C.getImageData(0,0,1,1).data,u!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:y.toRgba(c,m,_,u),css:x}}})(E||(s.css=E={})),(function(h){function C(D,x,M){const b=D/255,T=x/255,N=M/255;return .2126*(b<=.03928?b/12.92:Math.pow((b+.055)/1.055,2.4))+.7152*(T<=.03928?T/12.92:Math.pow((T+.055)/1.055,2.4))+.0722*(N<=.03928?N/12.92:Math.pow((N+.055)/1.055,2.4))}h.relativeLuminance=function(D){return C(D>>16&255,D>>8&255,255&D)},h.relativeLuminance2=C})(g||(s.rgb=g={})),(function(h){function C(x,M,b){const T=x>>24&255,N=x>>16&255,F=x>>8&255;let P=M>>24&255,B=M>>16&255,H=M>>8&255,q=d(g.relativeLuminance2(P,B,H),g.relativeLuminance2(T,N,F));for(;q<b&&(P>0||B>0||H>0);)P-=Math.max(0,Math.ceil(.1*P)),B-=Math.max(0,Math.ceil(.1*B)),H-=Math.max(0,Math.ceil(.1*H)),q=d(g.relativeLuminance2(P,B,H),g.relativeLuminance2(T,N,F));return(P<<24|B<<16|H<<8|255)>>>0}function D(x,M,b){const T=x>>24&255,N=x>>16&255,F=x>>8&255;let P=M>>24&255,B=M>>16&255,H=M>>8&255,q=d(g.relativeLuminance2(P,B,H),g.relativeLuminance2(T,N,F));for(;q<b&&(P<255||B<255||H<255);)P=Math.min(255,P+Math.ceil(.1*(255-P))),B=Math.min(255,B+Math.ceil(.1*(255-B))),H=Math.min(255,H+Math.ceil(.1*(255-H))),q=d(g.relativeLuminance2(P,B,H),g.relativeLuminance2(T,N,F));return(P<<24|B<<16|H<<8|255)>>>0}h.blend=function(x,M){if(u=(255&M)/255,u===1)return M;const b=M>>24&255,T=M>>16&255,N=M>>8&255,F=x>>24&255,P=x>>16&255,B=x>>8&255;return c=F+Math.round((b-F)*u),m=P+Math.round((T-P)*u),_=B+Math.round((N-B)*u),y.toRgba(c,m,_)},h.ensureContrastRatio=function(x,M,b){const T=g.relativeLuminance(x>>8),N=g.relativeLuminance(M>>8);if(d(T,N)<b){if(N<T){const B=C(x,M,b),H=d(T,g.relativeLuminance(B>>8));if(H<b){const q=D(x,M,b);return H>d(T,g.relativeLuminance(q>>8))?B:q}return B}const F=D(x,M,b),P=d(T,g.relativeLuminance(F>>8));if(P<b){const B=C(x,M,b);return P>d(T,g.relativeLuminance(B>>8))?F:B}return F}},h.reduceLuminance=C,h.increaseLuminance=D,h.toChannels=function(x){return[x>>24&255,x>>16&255,x>>8&255,255&x]}})(a||(s.rgba=a={})),s.toPaddedHex=f,s.contrastRatio=d},8969:(L,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CoreTerminal=void 0;const m=c(844),_=c(2585),u=c(4348),y=c(7866),S=c(744),E=c(7302),g=c(6975),a=c(8460),f=c(1753),d=c(1480),h=c(7994),C=c(9282),D=c(5435),x=c(5981),M=c(2660);let b=!1;class T extends m.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new a.EventEmitter),this._onScroll.event((F=>{var P;(P=this._onScrollApi)==null||P.fire(F.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(F){for(const P in F)this.optionsService.options[P]=F[P]}constructor(F){super(),this._windowsWrappingHeuristics=this.register(new m.MutableDisposable),this._onBinary=this.register(new a.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new a.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new a.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new a.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new a.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new a.EventEmitter),this._instantiationService=new u.InstantiationService,this.optionsService=this.register(new E.OptionsService(F)),this._instantiationService.setService(_.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(S.BufferService)),this._instantiationService.setService(_.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(y.LogService)),this._instantiationService.setService(_.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(g.CoreService)),this._instantiationService.setService(_.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(f.CoreMouseService)),this._instantiationService.setService(_.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(d.UnicodeService)),this._instantiationService.setService(_.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(h.CharsetService),this._instantiationService.setService(_.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(M.OscLinkService),this._instantiationService.setService(_.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new D.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,a.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,a.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,a.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,a.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 x.WriteBuffer(((P,B)=>this._inputHandler.parse(P,B)))),this.register((0,a.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(F,P){this._writeBuffer.write(F,P)}writeSync(F,P){this._logService.logLevel<=_.LogLevelEnum.WARN&&!b&&(this._logService.warn("writeSync is unreliable and will be removed soon."),b=!0),this._writeBuffer.writeSync(F,P)}input(F,P=!0){this.coreService.triggerDataEvent(F,P)}resize(F,P){isNaN(F)||isNaN(P)||(F=Math.max(F,S.MINIMUM_COLS),P=Math.max(P,S.MINIMUM_ROWS),this._bufferService.resize(F,P))}scroll(F,P=!1){this._bufferService.scroll(F,P)}scrollLines(F,P,B){this._bufferService.scrollLines(F,P,B)}scrollPages(F){this.scrollLines(F*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(F){const P=F-this._bufferService.buffer.ydisp;P!==0&&this.scrollLines(P)}registerEscHandler(F,P){return this._inputHandler.registerEscHandler(F,P)}registerDcsHandler(F,P){return this._inputHandler.registerDcsHandler(F,P)}registerCsiHandler(F,P){return this._inputHandler.registerCsiHandler(F,P)}registerOscHandler(F,P){return this._inputHandler.registerOscHandler(F,P)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let F=!1;const P=this.optionsService.rawOptions.windowsPty;P&&P.buildNumber!==void 0&&P.buildNumber!==void 0?F=P.backend==="conpty"&&P.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(F=!0),F?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const F=[];F.push(this.onLineFeed(C.updateWindowsModeWrappedState.bind(null,this._bufferService))),F.push(this.registerCsiHandler({final:"H"},(()=>((0,C.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,m.toDisposable)((()=>{for(const P of F)P.dispose()}))}}}s.CoreTerminal=T},8460:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.runAndSubscribe=s.forwardEvent=s.EventEmitter=void 0,s.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 _=[];for(let u=0;u<this._listeners.length;u++)_.push(this._listeners[u]);for(let u=0;u<_.length;u++)_[u].call(void 0,c,m)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},s.forwardEvent=function(c,m){return c((_=>m.fire(_)))},s.runAndSubscribe=function(c,m){return m(void 0),c((_=>m(_)))}},5435:function(L,s,c){var m=this&&this.__decorate||function(Y,j,U,$){var V,ne=arguments.length,se=ne<3?j:$===null?$=Object.getOwnPropertyDescriptor(j,U):$;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")se=Reflect.decorate(Y,j,U,$);else for(var ce=Y.length-1;ce>=0;ce--)(V=Y[ce])&&(se=(ne<3?V(se):ne>3?V(j,U,se):V(j,U))||se);return ne>3&&se&&Object.defineProperty(j,U,se),se},_=this&&this.__param||function(Y,j){return function(U,$){j(U,$,Y)}};Object.defineProperty(s,"__esModule",{value:!0}),s.InputHandler=s.WindowsOptionsReportType=void 0;const u=c(2584),y=c(7116),S=c(2015),E=c(844),g=c(482),a=c(8437),f=c(8460),d=c(643),h=c(511),C=c(3734),D=c(2585),x=c(1480),M=c(6242),b=c(6351),T=c(5941),N={"(":0,")":1,"*":2,"+":3,"-":1,".":2},F=131072;function P(Y,j){if(Y>24)return j.setWinLines||!1;switch(Y){case 1:return!!j.restoreWin;case 2:return!!j.minimizeWin;case 3:return!!j.setWinPosition;case 4:return!!j.setWinSizePixels;case 5:return!!j.raiseWin;case 6:return!!j.lowerWin;case 7:return!!j.refreshWin;case 8:return!!j.setWinSizeChars;case 9:return!!j.maximizeWin;case 10:return!!j.fullscreenWin;case 11:return!!j.getWinState;case 13:return!!j.getWinPosition;case 14:return!!j.getWinSizePixels;case 15:return!!j.getScreenSizePixels;case 16:return!!j.getCellSizePixels;case 18:return!!j.getWinSizeChars;case 19:return!!j.getScreenSizeChars;case 20:return!!j.getIconTitle;case 21:return!!j.getWinTitle;case 22:return!!j.pushTitle;case 23:return!!j.popTitle;case 24:return!!j.setWinLines}return!1}var B;(function(Y){Y[Y.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",Y[Y.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(B||(s.WindowsOptionsReportType=B={}));let H=0;class q extends E.Disposable{getAttrData(){return this._curAttrData}constructor(j,U,$,V,ne,se,ce,he,K=new S.EscapeSequenceParser){super(),this._bufferService=j,this._charsetService=U,this._coreService=$,this._logService=V,this._optionsService=ne,this._oscLinkService=se,this._coreMouseService=ce,this._unicodeService=he,this._parser=K,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new g.StringToUtf32,this._utf8Decoder=new g.Utf8ToUtf32,this._workCell=new h.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=a.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=a.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new f.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new f.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new f.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new f.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new f.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new f.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new f.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new f.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new f.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new f.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new f.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new f.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new f.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 X(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((W=>this._activeBuffer=W.activeBuffer))),this._parser.setCsiHandlerFallback(((W,J)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(W),params:J.toArray()})})),this._parser.setEscHandlerFallback((W=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(W)})})),this._parser.setExecuteHandlerFallback((W=>{this._logService.debug("Unknown EXECUTE code: ",{code:W})})),this._parser.setOscHandlerFallback(((W,J,Z)=>{this._logService.debug("Unknown OSC code: ",{identifier:W,action:J,data:Z})})),this._parser.setDcsHandlerFallback(((W,J,Z)=>{J==="HOOK"&&(Z=Z.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(W),action:J,payload:Z})})),this._parser.setPrintHandler(((W,J,Z)=>this.print(W,J,Z))),this._parser.registerCsiHandler({final:"@"},(W=>this.insertChars(W))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(W=>this.scrollLeft(W))),this._parser.registerCsiHandler({final:"A"},(W=>this.cursorUp(W))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(W=>this.scrollRight(W))),this._parser.registerCsiHandler({final:"B"},(W=>this.cursorDown(W))),this._parser.registerCsiHandler({final:"C"},(W=>this.cursorForward(W))),this._parser.registerCsiHandler({final:"D"},(W=>this.cursorBackward(W))),this._parser.registerCsiHandler({final:"E"},(W=>this.cursorNextLine(W))),this._parser.registerCsiHandler({final:"F"},(W=>this.cursorPrecedingLine(W))),this._parser.registerCsiHandler({final:"G"},(W=>this.cursorCharAbsolute(W))),this._parser.registerCsiHandler({final:"H"},(W=>this.cursorPosition(W))),this._parser.registerCsiHandler({final:"I"},(W=>this.cursorForwardTab(W))),this._parser.registerCsiHandler({final:"J"},(W=>this.eraseInDisplay(W,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(W=>this.eraseInDisplay(W,!0))),this._parser.registerCsiHandler({final:"K"},(W=>this.eraseInLine(W,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(W=>this.eraseInLine(W,!0))),this._parser.registerCsiHandler({final:"L"},(W=>this.insertLines(W))),this._parser.registerCsiHandler({final:"M"},(W=>this.deleteLines(W))),this._parser.registerCsiHandler({final:"P"},(W=>this.deleteChars(W))),this._parser.registerCsiHandler({final:"S"},(W=>this.scrollUp(W))),this._parser.registerCsiHandler({final:"T"},(W=>this.scrollDown(W))),this._parser.registerCsiHandler({final:"X"},(W=>this.eraseChars(W))),this._parser.registerCsiHandler({final:"Z"},(W=>this.cursorBackwardTab(W))),this._parser.registerCsiHandler({final:"`"},(W=>this.charPosAbsolute(W))),this._parser.registerCsiHandler({final:"a"},(W=>this.hPositionRelative(W))),this._parser.registerCsiHandler({final:"b"},(W=>this.repeatPrecedingCharacter(W))),this._parser.registerCsiHandler({final:"c"},(W=>this.sendDeviceAttributesPrimary(W))),this._parser.registerCsiHandler({prefix:">",final:"c"},(W=>this.sendDeviceAttributesSecondary(W))),this._parser.registerCsiHandler({final:"d"},(W=>this.linePosAbsolute(W))),this._parser.registerCsiHandler({final:"e"},(W=>this.vPositionRelative(W))),this._parser.registerCsiHandler({final:"f"},(W=>this.hVPosition(W))),this._parser.registerCsiHandler({final:"g"},(W=>this.tabClear(W))),this._parser.registerCsiHandler({final:"h"},(W=>this.setMode(W))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(W=>this.setModePrivate(W))),this._parser.registerCsiHandler({final:"l"},(W=>this.resetMode(W))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(W=>this.resetModePrivate(W))),this._parser.registerCsiHandler({final:"m"},(W=>this.charAttributes(W))),this._parser.registerCsiHandler({final:"n"},(W=>this.deviceStatus(W))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(W=>this.deviceStatusPrivate(W))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(W=>this.softReset(W))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(W=>this.setCursorStyle(W))),this._parser.registerCsiHandler({final:"r"},(W=>this.setScrollRegion(W))),this._parser.registerCsiHandler({final:"s"},(W=>this.saveCursor(W))),this._parser.registerCsiHandler({final:"t"},(W=>this.windowOptions(W))),this._parser.registerCsiHandler({final:"u"},(W=>this.restoreCursor(W))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(W=>this.insertColumns(W))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(W=>this.deleteColumns(W))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(W=>this.selectProtected(W))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(W=>this.requestMode(W,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(W=>this.requestMode(W,!1))),this._parser.setExecuteHandler(u.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(u.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(u.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(u.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(u.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(u.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(u.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(u.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(u.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(u.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(u.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(u.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new M.OscHandler((W=>(this.setTitle(W),this.setIconName(W),!0)))),this._parser.registerOscHandler(1,new M.OscHandler((W=>this.setIconName(W)))),this._parser.registerOscHandler(2,new M.OscHandler((W=>this.setTitle(W)))),this._parser.registerOscHandler(4,new M.OscHandler((W=>this.setOrReportIndexedColor(W)))),this._parser.registerOscHandler(8,new M.OscHandler((W=>this.setHyperlink(W)))),this._parser.registerOscHandler(10,new M.OscHandler((W=>this.setOrReportFgColor(W)))),this._parser.registerOscHandler(11,new M.OscHandler((W=>this.setOrReportBgColor(W)))),this._parser.registerOscHandler(12,new M.OscHandler((W=>this.setOrReportCursorColor(W)))),this._parser.registerOscHandler(104,new M.OscHandler((W=>this.restoreIndexedColor(W)))),this._parser.registerOscHandler(110,new M.OscHandler((W=>this.restoreFgColor(W)))),this._parser.registerOscHandler(111,new M.OscHandler((W=>this.restoreBgColor(W)))),this._parser.registerOscHandler(112,new M.OscHandler((W=>this.restoreCursorColor(W)))),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 W in y.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:W},(()=>this.selectCharset("("+W))),this._parser.registerEscHandler({intermediates:")",final:W},(()=>this.selectCharset(")"+W))),this._parser.registerEscHandler({intermediates:"*",final:W},(()=>this.selectCharset("*"+W))),this._parser.registerEscHandler({intermediates:"+",final:W},(()=>this.selectCharset("+"+W))),this._parser.registerEscHandler({intermediates:"-",final:W},(()=>this.selectCharset("-"+W))),this._parser.registerEscHandler({intermediates:".",final:W},(()=>this.selectCharset("."+W))),this._parser.registerEscHandler({intermediates:"/",final:W},(()=>this.selectCharset("/"+W)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((W=>(this._logService.error("Parsing error: ",W),W))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new b.DcsHandler(((W,J)=>this.requestStatusString(W,J))))}_preserveStack(j,U,$,V){this._parseStack.paused=!0,this._parseStack.cursorStartX=j,this._parseStack.cursorStartY=U,this._parseStack.decodedLength=$,this._parseStack.position=V}_logSlowResolvingAsync(j){this._logService.logLevel<=D.LogLevelEnum.WARN&&Promise.race([j,new Promise(((U,$)=>setTimeout((()=>$("#SLOW_TIMEOUT")),5e3)))]).catch((U=>{if(U!=="#SLOW_TIMEOUT")throw U;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(j,U){let $,V=this._activeBuffer.x,ne=this._activeBuffer.y,se=0;const ce=this._parseStack.paused;if(ce){if($=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,U))return this._logSlowResolvingAsync($),$;V=this._parseStack.cursorStartX,ne=this._parseStack.cursorStartY,this._parseStack.paused=!1,j.length>F&&(se=this._parseStack.position+F)}if(this._logService.logLevel<=D.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof j=="string"?` "${j}"`:` "${Array.prototype.map.call(j,(W=>String.fromCharCode(W))).join("")}"`),typeof j=="string"?j.split("").map((W=>W.charCodeAt(0))):j),this._parseBuffer.length<j.length&&this._parseBuffer.length<F&&(this._parseBuffer=new Uint32Array(Math.min(j.length,F))),ce||this._dirtyRowTracker.clearRange(),j.length>F)for(let W=se;W<j.length;W+=F){const J=W+F<j.length?W+F:j.length,Z=typeof j=="string"?this._stringDecoder.decode(j.substring(W,J),this._parseBuffer):this._utf8Decoder.decode(j.subarray(W,J),this._parseBuffer);if($=this._parser.parse(this._parseBuffer,Z))return this._preserveStack(V,ne,Z,W),this._logSlowResolvingAsync($),$}else if(!ce){const W=typeof j=="string"?this._stringDecoder.decode(j,this._parseBuffer):this._utf8Decoder.decode(j,this._parseBuffer);if($=this._parser.parse(this._parseBuffer,W))return this._preserveStack(V,ne,W,0),this._logSlowResolvingAsync($),$}this._activeBuffer.x===V&&this._activeBuffer.y===ne||this._onCursorMove.fire();const he=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),K=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);K<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(K,this._bufferService.rows-1),Math.min(he,this._bufferService.rows-1))}print(j,U,$){let V,ne;const se=this._charsetService.charset,ce=this._optionsService.rawOptions.screenReaderMode,he=this._bufferService.cols,K=this._coreService.decPrivateModes.wraparound,W=this._coreService.modes.insertMode,J=this._curAttrData;let Z=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&$-U>0&&Z.getWidth(this._activeBuffer.x-1)===2&&Z.setCellFromCodepoint(this._activeBuffer.x-1,0,1,J);let de=this._parser.precedingJoinState;for(let ee=U;ee<$;++ee){if(V=j[ee],V<127&&se){const we=se[String.fromCharCode(V)];we&&(V=we.charCodeAt(0))}const xe=this._unicodeService.charProperties(V,de);ne=x.UnicodeService.extractWidth(xe);const ke=x.UnicodeService.extractShouldJoin(xe),le=ke?x.UnicodeService.extractWidth(de):0;if(de=xe,ce&&this._onA11yChar.fire((0,g.stringFromCodePoint)(V)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+ne-le>he){if(K){const we=Z;let me=this._activeBuffer.x-le;for(this._activeBuffer.x=le,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),Z=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),le>0&&Z instanceof a.BufferLine&&Z.copyCellsFrom(we,me,0,le,!1);me<he;)we.setCellFromCodepoint(me++,0,1,J)}else if(this._activeBuffer.x=he-1,ne===2)continue}if(ke&&this._activeBuffer.x){const we=Z.getWidth(this._activeBuffer.x-1)?1:2;Z.addCodepointToCell(this._activeBuffer.x-we,V,ne);for(let me=ne-le;--me>=0;)Z.setCellFromCodepoint(this._activeBuffer.x++,0,0,J)}else if(W&&(Z.insertCells(this._activeBuffer.x,ne-le,this._activeBuffer.getNullCell(J)),Z.getWidth(he-1)===2&&Z.setCellFromCodepoint(he-1,d.NULL_CELL_CODE,d.NULL_CELL_WIDTH,J)),Z.setCellFromCodepoint(this._activeBuffer.x++,V,ne,J),ne>0)for(;--ne;)Z.setCellFromCodepoint(this._activeBuffer.x++,0,0,J)}this._parser.precedingJoinState=de,this._activeBuffer.x<he&&$-U>0&&Z.getWidth(this._activeBuffer.x)===0&&!Z.hasContent(this._activeBuffer.x)&&Z.setCellFromCodepoint(this._activeBuffer.x,0,1,J),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(j,U){return j.final!=="t"||j.prefix||j.intermediates?this._parser.registerCsiHandler(j,U):this._parser.registerCsiHandler(j,($=>!P($.params[0],this._optionsService.rawOptions.windowOptions)||U($)))}registerDcsHandler(j,U){return this._parser.registerDcsHandler(j,new b.DcsHandler(U))}registerEscHandler(j,U){return this._parser.registerEscHandler(j,U)}registerOscHandler(j,U){return this._parser.registerOscHandler(j,new M.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 j;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&&((j=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&j.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 j=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-j),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(j=this._bufferService.cols-1){this._activeBuffer.x=Math.min(j,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(j,U){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=j,this._activeBuffer.y=this._activeBuffer.scrollTop+U):(this._activeBuffer.x=j,this._activeBuffer.y=U),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(j,U){this._restrictCursor(),this._setCursor(this._activeBuffer.x+j,this._activeBuffer.y+U)}cursorUp(j){const U=this._activeBuffer.y-this._activeBuffer.scrollTop;return U>=0?this._moveCursor(0,-Math.min(U,j.params[0]||1)):this._moveCursor(0,-(j.params[0]||1)),!0}cursorDown(j){const U=this._activeBuffer.scrollBottom-this._activeBuffer.y;return U>=0?this._moveCursor(0,Math.min(U,j.params[0]||1)):this._moveCursor(0,j.params[0]||1),!0}cursorForward(j){return this._moveCursor(j.params[0]||1,0),!0}cursorBackward(j){return this._moveCursor(-(j.params[0]||1),0),!0}cursorNextLine(j){return this.cursorDown(j),this._activeBuffer.x=0,!0}cursorPrecedingLine(j){return this.cursorUp(j),this._activeBuffer.x=0,!0}cursorCharAbsolute(j){return this._setCursor((j.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(j){return this._setCursor(j.length>=2?(j.params[1]||1)-1:0,(j.params[0]||1)-1),!0}charPosAbsolute(j){return this._setCursor((j.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(j){return this._moveCursor(j.params[0]||1,0),!0}linePosAbsolute(j){return this._setCursor(this._activeBuffer.x,(j.params[0]||1)-1),!0}vPositionRelative(j){return this._moveCursor(0,j.params[0]||1),!0}hVPosition(j){return this.cursorPosition(j),!0}tabClear(j){const U=j.params[0];return U===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:U===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(j){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let U=j.params[0]||1;for(;U--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(j){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let U=j.params[0]||1;for(;U--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(j){const U=j.params[0];return U===1&&(this._curAttrData.bg|=536870912),U!==2&&U!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(j,U,$,V=!1,ne=!1){const se=this._activeBuffer.lines.get(this._activeBuffer.ybase+j);se.replaceCells(U,$,this._activeBuffer.getNullCell(this._eraseAttrData()),ne),V&&(se.isWrapped=!1)}_resetBufferLine(j,U=!1){const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+j);$&&($.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),U),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+j),$.isWrapped=!1)}eraseInDisplay(j,U=!1){let $;switch(this._restrictCursor(this._bufferService.cols),j.params[0]){case 0:for($=this._activeBuffer.y,this._dirtyRowTracker.markDirty($),this._eraseInBufferLine($++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,U);$<this._bufferService.rows;$++)this._resetBufferLine($,U);this._dirtyRowTracker.markDirty($);break;case 1:for($=this._activeBuffer.y,this._dirtyRowTracker.markDirty($),this._eraseInBufferLine($,0,this._activeBuffer.x+1,!0,U),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get($+1).isWrapped=!1);$--;)this._resetBufferLine($,U);this._dirtyRowTracker.markDirty(0);break;case 2:for($=this._bufferService.rows,this._dirtyRowTracker.markDirty($-1);$--;)this._resetBufferLine($,U);this._dirtyRowTracker.markDirty(0);break;case 3:const V=this._activeBuffer.lines.length-this._bufferService.rows;V>0&&(this._activeBuffer.lines.trimStart(V),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-V,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-V,0),this._onScroll.fire(0))}return!0}eraseInLine(j,U=!1){switch(this._restrictCursor(this._bufferService.cols),j.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(j){this._restrictCursor();let U=j.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const $=this._activeBuffer.ybase+this._activeBuffer.y,V=this._bufferService.rows-1-this._activeBuffer.scrollBottom,ne=this._bufferService.rows-1+this._activeBuffer.ybase-V+1;for(;U--;)this._activeBuffer.lines.splice(ne-1,1),this._activeBuffer.lines.splice($,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(j){this._restrictCursor();let U=j.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const $=this._activeBuffer.ybase+this._activeBuffer.y;let V;for(V=this._bufferService.rows-1-this._activeBuffer.scrollBottom,V=this._bufferService.rows-1+this._activeBuffer.ybase-V;U--;)this._activeBuffer.lines.splice($,1),this._activeBuffer.lines.splice(V,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(j){this._restrictCursor();const U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return U&&(U.insertCells(this._activeBuffer.x,j.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(j){this._restrictCursor();const U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return U&&(U.deleteCells(this._activeBuffer.x,j.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(j){let U=j.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(j){let U=j.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(a.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(j){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const U=j.params[0]||1;for(let $=this._activeBuffer.scrollTop;$<=this._activeBuffer.scrollBottom;++$){const V=this._activeBuffer.lines.get(this._activeBuffer.ybase+$);V.deleteCells(0,U,this._activeBuffer.getNullCell(this._eraseAttrData())),V.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(j){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const U=j.params[0]||1;for(let $=this._activeBuffer.scrollTop;$<=this._activeBuffer.scrollBottom;++$){const V=this._activeBuffer.lines.get(this._activeBuffer.ybase+$);V.insertCells(0,U,this._activeBuffer.getNullCell(this._eraseAttrData())),V.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(j){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const U=j.params[0]||1;for(let $=this._activeBuffer.scrollTop;$<=this._activeBuffer.scrollBottom;++$){const V=this._activeBuffer.lines.get(this._activeBuffer.ybase+$);V.insertCells(this._activeBuffer.x,U,this._activeBuffer.getNullCell(this._eraseAttrData())),V.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(j){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const U=j.params[0]||1;for(let $=this._activeBuffer.scrollTop;$<=this._activeBuffer.scrollBottom;++$){const V=this._activeBuffer.lines.get(this._activeBuffer.ybase+$);V.deleteCells(this._activeBuffer.x,U,this._activeBuffer.getNullCell(this._eraseAttrData())),V.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(j){this._restrictCursor();const U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return U&&(U.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(j.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(j){const U=this._parser.precedingJoinState;if(!U)return!0;const $=j.params[0]||1,V=x.UnicodeService.extractWidth(U),ne=this._activeBuffer.x-V,se=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(ne),ce=new Uint32Array(se.length*$);let he=0;for(let W=0;W<se.length;){const J=se.codePointAt(W)||0;ce[he++]=J,W+=J>65535?2:1}let K=he;for(let W=1;W<$;++W)ce.copyWithin(K,0,he),K+=he;return this.print(ce,0,K),!0}sendDeviceAttributesPrimary(j){return j.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(u.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(u.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(j){return j.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(u.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(u.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(j.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(u.C0.ESC+"[>83;40003;0c")),!0}_is(j){return(this._optionsService.rawOptions.termName+"").indexOf(j)===0}setMode(j){for(let U=0;U<j.length;U++)switch(j.params[U]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(j){for(let U=0;U<j.length;U++)switch(j.params[U]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,y.DEFAULT_CHARSET),this._charsetService.setgCharset(1,y.DEFAULT_CHARSET),this._charsetService.setgCharset(2,y.DEFAULT_CHARSET),this._charsetService.setgCharset(3,y.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(j){for(let U=0;U<j.length;U++)switch(j.params[U]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(j){for(let U=0;U<j.length;U++)switch(j.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(),j.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(j,U){const $=this._coreService.decPrivateModes,{activeProtocol:V,activeEncoding:ne}=this._coreMouseService,se=this._coreService,{buffers:ce,cols:he}=this._bufferService,{active:K,alt:W}=ce,J=this._optionsService.rawOptions,Z=ke=>ke?1:2,de=j.params[0];return ee=de,xe=U?de===2?4:de===4?Z(se.modes.insertMode):de===12?3:de===20?Z(J.convertEol):0:de===1?Z($.applicationCursorKeys):de===3?J.windowOptions.setWinLines?he===80?2:he===132?1:0:0:de===6?Z($.origin):de===7?Z($.wraparound):de===8?3:de===9?Z(V==="X10"):de===12?Z(J.cursorBlink):de===25?Z(!se.isCursorHidden):de===45?Z($.reverseWraparound):de===66?Z($.applicationKeypad):de===67?4:de===1e3?Z(V==="VT200"):de===1002?Z(V==="DRAG"):de===1003?Z(V==="ANY"):de===1004?Z($.sendFocus):de===1005?4:de===1006?Z(ne==="SGR"):de===1015?4:de===1016?Z(ne==="SGR_PIXELS"):de===1048?1:de===47||de===1047||de===1049?Z(K===W):de===2004?Z($.bracketedPasteMode):0,se.triggerDataEvent(`${u.C0.ESC}[${U?"":"?"}${ee};${xe}$y`),!0;var ee,xe}_updateAttrColor(j,U,$,V,ne){return U===2?(j|=50331648,j&=-16777216,j|=C.AttributeData.fromColorRGB([$,V,ne])):U===5&&(j&=-50331904,j|=33554432|255&$),j}_extractColor(j,U,$){const V=[0,0,-1,0,0,0];let ne=0,se=0;do{if(V[se+ne]=j.params[U+se],j.hasSubParams(U+se)){const ce=j.getSubParams(U+se);let he=0;do V[1]===5&&(ne=1),V[se+he+1+ne]=ce[he];while(++he<ce.length&&he+se+1+ne<V.length);break}if(V[1]===5&&se+ne>=2||V[1]===2&&se+ne>=5)break;V[1]&&(ne=1)}while(++se+U<j.length&&se+ne<V.length);for(let ce=2;ce<V.length;++ce)V[ce]===-1&&(V[ce]=0);switch(V[0]){case 38:$.fg=this._updateAttrColor($.fg,V[1],V[3],V[4],V[5]);break;case 48:$.bg=this._updateAttrColor($.bg,V[1],V[3],V[4],V[5]);break;case 58:$.extended=$.extended.clone(),$.extended.underlineColor=this._updateAttrColor($.extended.underlineColor,V[1],V[3],V[4],V[5])}return se}_processUnderline(j,U){U.extended=U.extended.clone(),(!~j||j>5)&&(j=1),U.extended.underlineStyle=j,U.fg|=268435456,j===0&&(U.fg&=-268435457),U.updateExtended()}_processSGR0(j){j.fg=a.DEFAULT_ATTR_DATA.fg,j.bg=a.DEFAULT_ATTR_DATA.bg,j.extended=j.extended.clone(),j.extended.underlineStyle=0,j.extended.underlineColor&=-67108864,j.updateExtended()}charAttributes(j){if(j.length===1&&j.params[0]===0)return this._processSGR0(this._curAttrData),!0;const U=j.length;let $;const V=this._curAttrData;for(let ne=0;ne<U;ne++)$=j.params[ne],$>=30&&$<=37?(V.fg&=-50331904,V.fg|=16777216|$-30):$>=40&&$<=47?(V.bg&=-50331904,V.bg|=16777216|$-40):$>=90&&$<=97?(V.fg&=-50331904,V.fg|=16777224|$-90):$>=100&&$<=107?(V.bg&=-50331904,V.bg|=16777224|$-100):$===0?this._processSGR0(V):$===1?V.fg|=134217728:$===3?V.bg|=67108864:$===4?(V.fg|=268435456,this._processUnderline(j.hasSubParams(ne)?j.getSubParams(ne)[0]:1,V)):$===5?V.fg|=536870912:$===7?V.fg|=67108864:$===8?V.fg|=1073741824:$===9?V.fg|=2147483648:$===2?V.bg|=134217728:$===21?this._processUnderline(2,V):$===22?(V.fg&=-134217729,V.bg&=-134217729):$===23?V.bg&=-67108865:$===24?(V.fg&=-268435457,this._processUnderline(0,V)):$===25?V.fg&=-536870913:$===27?V.fg&=-67108865:$===28?V.fg&=-1073741825:$===29?V.fg&=2147483647:$===39?(V.fg&=-67108864,V.fg|=16777215&a.DEFAULT_ATTR_DATA.fg):$===49?(V.bg&=-67108864,V.bg|=16777215&a.DEFAULT_ATTR_DATA.bg):$===38||$===48||$===58?ne+=this._extractColor(j,ne,V):$===53?V.bg|=1073741824:$===55?V.bg&=-1073741825:$===59?(V.extended=V.extended.clone(),V.extended.underlineColor=-1,V.updateExtended()):$===100?(V.fg&=-67108864,V.fg|=16777215&a.DEFAULT_ATTR_DATA.fg,V.bg&=-67108864,V.bg|=16777215&a.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",$);return!0}deviceStatus(j){switch(j.params[0]){case 5:this._coreService.triggerDataEvent(`${u.C0.ESC}[0n`);break;case 6:const U=this._activeBuffer.y+1,$=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${u.C0.ESC}[${U};${$}R`)}return!0}deviceStatusPrivate(j){if(j.params[0]===6){const U=this._activeBuffer.y+1,$=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${u.C0.ESC}[?${U};${$}R`)}return!0}softReset(j){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=a.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(j){const U=j.params[0]||1;switch(U){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const $=U%2==1;return this._optionsService.options.cursorBlink=$,!0}setScrollRegion(j){const U=j.params[0]||1;let $;return(j.length<2||($=j.params[1])>this._bufferService.rows||$===0)&&($=this._bufferService.rows),$>U&&(this._activeBuffer.scrollTop=U-1,this._activeBuffer.scrollBottom=$-1,this._setCursor(0,0)),!0}windowOptions(j){if(!P(j.params[0],this._optionsService.rawOptions.windowOptions))return!0;const U=j.length>1?j.params[1]:0;switch(j.params[0]){case 14:U!==2&&this._onRequestWindowsOptionsReport.fire(B.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(B.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${u.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(j){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(j){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(j){return this._windowTitle=j,this._onTitleChange.fire(j),!0}setIconName(j){return this._iconName=j,!0}setOrReportIndexedColor(j){const U=[],$=j.split(";");for(;$.length>1;){const V=$.shift(),ne=$.shift();if(/^\d+$/.exec(V)){const se=parseInt(V);if(G(se))if(ne==="?")U.push({type:0,index:se});else{const ce=(0,T.parseColor)(ne);ce&&U.push({type:1,index:se,color:ce})}}}return U.length&&this._onColor.fire(U),!0}setHyperlink(j){const U=j.split(";");return!(U.length<2)&&(U[1]?this._createHyperlink(U[0],U[1]):!U[0]&&this._finishHyperlink())}_createHyperlink(j,U){this._getCurrentLinkId()&&this._finishHyperlink();const $=j.split(":");let V;const ne=$.findIndex((se=>se.startsWith("id=")));return ne!==-1&&(V=$[ne].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:V,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(j,U){const $=j.split(";");for(let V=0;V<$.length&&!(U>=this._specialColors.length);++V,++U)if($[V]==="?")this._onColor.fire([{type:0,index:this._specialColors[U]}]);else{const ne=(0,T.parseColor)($[V]);ne&&this._onColor.fire([{type:1,index:this._specialColors[U],color:ne}])}return!0}setOrReportFgColor(j){return this._setOrReportSpecialColor(j,0)}setOrReportBgColor(j){return this._setOrReportSpecialColor(j,1)}setOrReportCursorColor(j){return this._setOrReportSpecialColor(j,2)}restoreIndexedColor(j){if(!j)return this._onColor.fire([{type:2}]),!0;const U=[],$=j.split(";");for(let V=0;V<$.length;++V)if(/^\d+$/.exec($[V])){const ne=parseInt($[V]);G(ne)&&U.push({type:2,index:ne})}return U.length&&this._onColor.fire(U),!0}restoreFgColor(j){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(j){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(j){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,y.DEFAULT_CHARSET),!0}selectCharset(j){return j.length!==2?(this.selectDefaultCharset(),!0):(j[0]==="/"||this._charsetService.setgCharset(N[j[0]],y.CHARSETS[j[1]]||y.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 j=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,j,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=a.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=a.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(j){return this._charsetService.setgLevel(j),!0}screenAlignmentPattern(){const j=new h.CellData;j.content=4194373,j.fg=this._curAttrData.fg,j.bg=this._curAttrData.bg,this._setCursor(0,0);for(let U=0;U<this._bufferService.rows;++U){const $=this._activeBuffer.ybase+this._activeBuffer.y+U,V=this._activeBuffer.lines.get($);V&&(V.fill(j),V.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(j,U){const $=this._bufferService.buffer,V=this._optionsService.rawOptions;return(ne=>(this._coreService.triggerDataEvent(`${u.C0.ESC}${ne}${u.C0.ESC}\\`),!0))(j==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:j==='"p'?'P1$r61;1"p':j==="r"?`P1$r${$.scrollTop+1};${$.scrollBottom+1}r`:j==="m"?"P1$r0m":j===" q"?`P1$r${{block:2,underline:4,bar:6}[V.cursorStyle]-(V.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(j,U){this._dirtyRowTracker.markRangeDirty(j,U)}}s.InputHandler=q;let X=class{constructor(Y){this._bufferService=Y,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(Y){Y<this.start?this.start=Y:Y>this.end&&(this.end=Y)}markRangeDirty(Y,j){Y>j&&(H=Y,Y=j,j=H),Y<this.start&&(this.start=Y),j>this.end&&(this.end=j)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function G(Y){return 0<=Y&&Y<256}X=m([_(0,D.IBufferService)],X)},844:(L,s)=>{function c(m){for(const _ of m)_.dispose();m.length=0}Object.defineProperty(s,"__esModule",{value:!0}),s.getDisposeArrayDisposable=s.disposeArray=s.toDisposable=s.MutableDisposable=s.Disposable=void 0,s.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 _=this._disposables.indexOf(m);_!==-1&&this._disposables.splice(_,1)}},s.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(m){var _;this._isDisposed||m===this._value||((_=this._value)==null||_.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}},s.toDisposable=function(m){return{dispose:m}},s.disposeArray=c,s.getDisposeArrayDisposable=function(m){return{dispose:()=>c(m)}}},1505:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.FourKeyMap=s.TwoKeyMap=void 0;class c{constructor(){this._data={}}set(_,u,y){this._data[_]||(this._data[_]={}),this._data[_][u]=y}get(_,u){return this._data[_]?this._data[_][u]:void 0}clear(){this._data={}}}s.TwoKeyMap=c,s.FourKeyMap=class{constructor(){this._data=new c}set(m,_,u,y,S){this._data.get(m,_)||this._data.set(m,_,new c),this._data.get(m,_).set(u,y,S)}get(m,_,u,y){var S;return(S=this._data.get(m,_))==null?void 0:S.get(u,y)}clear(){this._data.clear()}}},6114:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.isChromeOS=s.isLinux=s.isWindows=s.isIphone=s.isIpad=s.isMac=s.getSafariVersion=s.isSafari=s.isLegacyEdge=s.isFirefox=s.isNode=void 0,s.isNode=typeof process<"u"&&"title"in process;const c=s.isNode?"node":navigator.userAgent,m=s.isNode?"node":navigator.platform;s.isFirefox=c.includes("Firefox"),s.isLegacyEdge=c.includes("Edge"),s.isSafari=/^((?!chrome|android).)*safari/i.test(c),s.getSafariVersion=function(){if(!s.isSafari)return 0;const _=c.match(/Version\/(\d+)/);return _===null||_.length<2?0:parseInt(_[1])},s.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(m),s.isIpad=m==="iPad",s.isIphone=m==="iPhone",s.isWindows=["Windows","Win16","Win32","WinCE"].includes(m),s.isLinux=m.indexOf("Linux")>=0,s.isChromeOS=/\bCrOS\b/.test(c)},6106:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.SortedList=void 0;let c=0;s.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 _=this._getKey(m);if(_===void 0||(c=this._search(_),c===-1)||this._getKey(this._array[c])!==_)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])===_);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,_){if(this._array.length!==0&&(c=this._search(m),!(c<0||c>=this._array.length)&&this._getKey(this._array[c])===m))do _(this._array[c]);while(++c<this._array.length&&this._getKey(this._array[c])===m)}values(){return[...this._array].values()}_search(m){let _=0,u=this._array.length-1;for(;u>=_;){let y=_+u>>1;const S=this._getKey(this._array[y]);if(S>m)u=y-1;else{if(!(S<m)){for(;y>0&&this._getKey(this._array[y-1])===m;)y--;return y}_=y+1}}return _}}},7226:(L,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DebouncedIdleTask=s.IdleTaskQueue=s.PriorityTaskQueue=void 0;const m=c(6114);class _{constructor(){this._tasks=[],this._i=0}enqueue(S){this._tasks.push(S),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(S){this._idleCallback=void 0;let E=0,g=0,a=S.timeRemaining(),f=0;for(;this._i<this._tasks.length;){if(E=Date.now(),this._tasks[this._i]()||this._i++,E=Math.max(1,Date.now()-E),g=Math.max(E,g),f=S.timeRemaining(),1.5*g>f)return a-E<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(a-E))}ms`),void this._start();a=f}this.clear()}}class u extends _{_requestCallback(S){return setTimeout((()=>S(this._createDeadline(16))))}_cancelCallback(S){clearTimeout(S)}_createDeadline(S){const E=Date.now()+S;return{timeRemaining:()=>Math.max(0,E-Date.now())}}}s.PriorityTaskQueue=u,s.IdleTaskQueue=!m.isNode&&"requestIdleCallback"in window?class extends _{_requestCallback(y){return requestIdleCallback(y)}_cancelCallback(y){cancelIdleCallback(y)}}:u,s.DebouncedIdleTask=class{constructor(){this._queue=new s.IdleTaskQueue}set(y){this._queue.clear(),this._queue.enqueue(y)}flush(){this._queue.flush()}}},9282:(L,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.updateWindowsModeWrappedState=void 0;const m=c(643);s.updateWindowsModeWrappedState=function(_){const u=_.buffer.lines.get(_.buffer.ybase+_.buffer.y-1),y=u==null?void 0:u.get(_.cols-1),S=_.buffer.lines.get(_.buffer.ybase+_.buffer.y);S&&y&&(S.isWrapped=y[m.CHAR_DATA_CODE_INDEX]!==m.NULL_CELL_CODE&&y[m.CHAR_DATA_CODE_INDEX]!==m.WHITESPACE_CELL_CODE)}},3734:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ExtendedAttrs=s.AttributeData=void 0;class c{constructor(){this.fg=0,this.bg=0,this.extended=new m}static toColorRGB(u){return[u>>>16&255,u>>>8&255,255&u]}static fromColorRGB(u){return(255&u[0])<<16|(255&u[1])<<8|255&u[2]}clone(){const u=new c;return u.fg=this.fg,u.bg=this.bg,u.extended=this.extended.clone(),u}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}}s.AttributeData=c;class m{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(u){this._ext=u}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(u){this._ext&=-469762049,this._ext|=u<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(u){this._ext&=-67108864,this._ext|=67108863&u}get urlId(){return this._urlId}set urlId(u){this._urlId=u}get underlineVariantOffset(){const u=(3758096384&this._ext)>>29;return u<0?4294967288^u:u}set underlineVariantOffset(u){this._ext&=536870911,this._ext|=u<<29&3758096384}constructor(u=0,y=0){this._ext=0,this._urlId=0,this._ext=u,this._urlId=y}clone(){return new m(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}s.ExtendedAttrs=m},9092:(L,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Buffer=s.MAX_BUFFER_SIZE=void 0;const m=c(6349),_=c(7226),u=c(3734),y=c(8437),S=c(4634),E=c(511),g=c(643),a=c(4863),f=c(7116);s.MAX_BUFFER_SIZE=4294967295,s.Buffer=class{constructor(d,h,C){this._hasScrollback=d,this._optionsService=h,this._bufferService=C,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=y.DEFAULT_ATTR_DATA.clone(),this.savedCharset=f.DEFAULT_CHARSET,this.markers=[],this._nullCell=E.CellData.fromCharData([0,g.NULL_CELL_CHAR,g.NULL_CELL_WIDTH,g.NULL_CELL_CODE]),this._whitespaceCell=E.CellData.fromCharData([0,g.WHITESPACE_CELL_CHAR,g.WHITESPACE_CELL_WIDTH,g.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new _.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(d){return d?(this._nullCell.fg=d.fg,this._nullCell.bg=d.bg,this._nullCell.extended=d.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new u.ExtendedAttrs),this._nullCell}getWhitespaceCell(d){return d?(this._whitespaceCell.fg=d.fg,this._whitespaceCell.bg=d.bg,this._whitespaceCell.extended=d.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new u.ExtendedAttrs),this._whitespaceCell}getBlankLine(d,h){return new y.BufferLine(this._bufferService.cols,this.getNullCell(d),h)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const d=this.ybase+this.y-this.ydisp;return d>=0&&d<this._rows}_getCorrectBufferLength(d){if(!this._hasScrollback)return d;const h=d+this._optionsService.rawOptions.scrollback;return h>s.MAX_BUFFER_SIZE?s.MAX_BUFFER_SIZE:h}fillViewportRows(d){if(this.lines.length===0){d===void 0&&(d=y.DEFAULT_ATTR_DATA);let h=this._rows;for(;h--;)this.lines.push(this.getBlankLine(d))}}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(d,h){const C=this.getNullCell(y.DEFAULT_ATTR_DATA);let D=0;const x=this._getCorrectBufferLength(h);if(x>this.lines.maxLength&&(this.lines.maxLength=x),this.lines.length>0){if(this._cols<d)for(let b=0;b<this.lines.length;b++)D+=+this.lines.get(b).resize(d,C);let M=0;if(this._rows<h)for(let b=this._rows;b<h;b++)this.lines.length<h+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new y.BufferLine(d,C)):this.ybase>0&&this.lines.length<=this.ybase+this.y+M+1?(this.ybase--,M++,this.ydisp>0&&this.ydisp--):this.lines.push(new y.BufferLine(d,C)));else for(let b=this._rows;b>h;b--)this.lines.length>h+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(x<this.lines.maxLength){const b=this.lines.length-x;b>0&&(this.lines.trimStart(b),this.ybase=Math.max(this.ybase-b,0),this.ydisp=Math.max(this.ydisp-b,0),this.savedY=Math.max(this.savedY-b,0)),this.lines.maxLength=x}this.x=Math.min(this.x,d-1),this.y=Math.min(this.y,h-1),M&&(this.y+=M),this.savedX=Math.min(this.savedX,d-1),this.scrollTop=0}if(this.scrollBottom=h-1,this._isReflowEnabled&&(this._reflow(d,h),this._cols>d))for(let M=0;M<this.lines.length;M++)D+=+this.lines.get(M).resize(d,C);this._cols=d,this._rows=h,this._memoryCleanupQueue.clear(),D>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let d=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,d=!1);let h=0;for(;this._memoryCleanupPosition<this.lines.length;)if(h+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),h>100)return!0;return d}get _isReflowEnabled(){const d=this._optionsService.rawOptions.windowsPty;return d&&d.buildNumber?this._hasScrollback&&d.backend==="conpty"&&d.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(d,h){this._cols!==d&&(d>this._cols?this._reflowLarger(d,h):this._reflowSmaller(d,h))}_reflowLarger(d,h){const C=(0,S.reflowLargerGetLinesToRemove)(this.lines,this._cols,d,this.ybase+this.y,this.getNullCell(y.DEFAULT_ATTR_DATA));if(C.length>0){const D=(0,S.reflowLargerCreateNewLayout)(this.lines,C);(0,S.reflowLargerApplyNewLayout)(this.lines,D.layout),this._reflowLargerAdjustViewport(d,h,D.countRemoved)}}_reflowLargerAdjustViewport(d,h,C){const D=this.getNullCell(y.DEFAULT_ATTR_DATA);let x=C;for(;x-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<h&&this.lines.push(new y.BufferLine(d,D))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-C,0)}_reflowSmaller(d,h){const C=this.getNullCell(y.DEFAULT_ATTR_DATA),D=[];let x=0;for(let M=this.lines.length-1;M>=0;M--){let b=this.lines.get(M);if(!b||!b.isWrapped&&b.getTrimmedLength()<=d)continue;const T=[b];for(;b.isWrapped&&M>0;)b=this.lines.get(--M),T.unshift(b);const N=this.ybase+this.y;if(N>=M&&N<M+T.length)continue;const F=T[T.length-1].getTrimmedLength(),P=(0,S.reflowSmallerGetNewLineLengths)(T,this._cols,d),B=P.length-T.length;let H;H=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+B):Math.max(0,this.lines.length-this.lines.maxLength+B);const q=[];for(let $=0;$<B;$++){const V=this.getBlankLine(y.DEFAULT_ATTR_DATA,!0);q.push(V)}q.length>0&&(D.push({start:M+T.length+x,newLines:q}),x+=q.length),T.push(...q);let X=P.length-1,G=P[X];G===0&&(X--,G=P[X]);let Y=T.length-B-1,j=F;for(;Y>=0;){const $=Math.min(j,G);if(T[X]===void 0)break;if(T[X].copyCellsFrom(T[Y],j-$,G-$,$,!0),G-=$,G===0&&(X--,G=P[X]),j-=$,j===0){Y--;const V=Math.max(Y,0);j=(0,S.getWrappedLineTrimmedLength)(T,V,this._cols)}}for(let $=0;$<T.length;$++)P[$]<d&&T[$].setCell(P[$],C);let U=B-H;for(;U-- >0;)this.ybase===0?this.y<h-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+x)-h&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+B,this.ybase+h-1)}if(D.length>0){const M=[],b=[];for(let X=0;X<this.lines.length;X++)b.push(this.lines.get(X));const T=this.lines.length;let N=T-1,F=0,P=D[F];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+x);let B=0;for(let X=Math.min(this.lines.maxLength-1,T+x-1);X>=0;X--)if(P&&P.start>N+B){for(let G=P.newLines.length-1;G>=0;G--)this.lines.set(X--,P.newLines[G]);X++,M.push({index:N+1,amount:P.newLines.length}),B+=P.newLines.length,P=D[++F]}else this.lines.set(X,b[N--]);let H=0;for(let X=M.length-1;X>=0;X--)M[X].index+=H,this.lines.onInsertEmitter.fire(M[X]),H+=M[X].amount;const q=Math.max(0,T+x-this.lines.maxLength);q>0&&this.lines.onTrimEmitter.fire(q)}}translateBufferLineToString(d,h,C=0,D){const x=this.lines.get(d);return x?x.translateToString(h,C,D):""}getWrappedRangeForLine(d){let h=d,C=d;for(;h>0&&this.lines.get(h).isWrapped;)h--;for(;C+1<this.lines.length&&this.lines.get(C+1).isWrapped;)C++;return{first:h,last:C}}setupTabStops(d){for(d!=null?this.tabs[d]||(d=this.prevStop(d)):(this.tabs={},d=0);d<this._cols;d+=this._optionsService.rawOptions.tabStopWidth)this.tabs[d]=!0}prevStop(d){for(d==null&&(d=this.x);!this.tabs[--d]&&d>0;);return d>=this._cols?this._cols-1:d<0?0:d}nextStop(d){for(d==null&&(d=this.x);!this.tabs[++d]&&d<this._cols;);return d>=this._cols?this._cols-1:d<0?0:d}clearMarkers(d){this._isClearing=!0;for(let h=0;h<this.markers.length;h++)this.markers[h].line===d&&(this.markers[h].dispose(),this.markers.splice(h--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let d=0;d<this.markers.length;d++)this.markers[d].dispose(),this.markers.splice(d--,1);this._isClearing=!1}addMarker(d){const h=new a.Marker(d);return this.markers.push(h),h.register(this.lines.onTrim((C=>{h.line-=C,h.line<0&&h.dispose()}))),h.register(this.lines.onInsert((C=>{h.line>=C.index&&(h.line+=C.amount)}))),h.register(this.lines.onDelete((C=>{h.line>=C.index&&h.line<C.index+C.amount&&h.dispose(),h.line>C.index&&(h.line-=C.amount)}))),h.register(h.onDispose((()=>this._removeMarker(h)))),h}_removeMarker(d){this._isClearing||this.markers.splice(this.markers.indexOf(d),1)}}},8437:(L,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferLine=s.DEFAULT_ATTR_DATA=void 0;const m=c(3734),_=c(511),u=c(643),y=c(482);s.DEFAULT_ATTR_DATA=Object.freeze(new m.AttributeData);let S=0;class E{constructor(a,f,d=!1){this.isWrapped=d,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*a);const h=f||_.CellData.fromCharData([0,u.NULL_CELL_CHAR,u.NULL_CELL_WIDTH,u.NULL_CELL_CODE]);for(let C=0;C<a;++C)this.setCell(C,h);this.length=a}get(a){const f=this._data[3*a+0],d=2097151&f;return[this._data[3*a+1],2097152&f?this._combined[a]:d?(0,y.stringFromCodePoint)(d):"",f>>22,2097152&f?this._combined[a].charCodeAt(this._combined[a].length-1):d]}set(a,f){this._data[3*a+1]=f[u.CHAR_DATA_ATTR_INDEX],f[u.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[a]=f[1],this._data[3*a+0]=2097152|a|f[u.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*a+0]=f[u.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|f[u.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(a){return this._data[3*a+0]>>22}hasWidth(a){return 12582912&this._data[3*a+0]}getFg(a){return this._data[3*a+1]}getBg(a){return this._data[3*a+2]}hasContent(a){return 4194303&this._data[3*a+0]}getCodePoint(a){const f=this._data[3*a+0];return 2097152&f?this._combined[a].charCodeAt(this._combined[a].length-1):2097151&f}isCombined(a){return 2097152&this._data[3*a+0]}getString(a){const f=this._data[3*a+0];return 2097152&f?this._combined[a]:2097151&f?(0,y.stringFromCodePoint)(2097151&f):""}isProtected(a){return 536870912&this._data[3*a+2]}loadCell(a,f){return S=3*a,f.content=this._data[S+0],f.fg=this._data[S+1],f.bg=this._data[S+2],2097152&f.content&&(f.combinedData=this._combined[a]),268435456&f.bg&&(f.extended=this._extendedAttrs[a]),f}setCell(a,f){2097152&f.content&&(this._combined[a]=f.combinedData),268435456&f.bg&&(this._extendedAttrs[a]=f.extended),this._data[3*a+0]=f.content,this._data[3*a+1]=f.fg,this._data[3*a+2]=f.bg}setCellFromCodepoint(a,f,d,h){268435456&h.bg&&(this._extendedAttrs[a]=h.extended),this._data[3*a+0]=f|d<<22,this._data[3*a+1]=h.fg,this._data[3*a+2]=h.bg}addCodepointToCell(a,f,d){let h=this._data[3*a+0];2097152&h?this._combined[a]+=(0,y.stringFromCodePoint)(f):2097151&h?(this._combined[a]=(0,y.stringFromCodePoint)(2097151&h)+(0,y.stringFromCodePoint)(f),h&=-2097152,h|=2097152):h=f|4194304,d&&(h&=-12582913,h|=d<<22),this._data[3*a+0]=h}insertCells(a,f,d){if((a%=this.length)&&this.getWidth(a-1)===2&&this.setCellFromCodepoint(a-1,0,1,d),f<this.length-a){const h=new _.CellData;for(let C=this.length-a-f-1;C>=0;--C)this.setCell(a+f+C,this.loadCell(a+C,h));for(let C=0;C<f;++C)this.setCell(a+C,d)}else for(let h=a;h<this.length;++h)this.setCell(h,d);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,d)}deleteCells(a,f,d){if(a%=this.length,f<this.length-a){const h=new _.CellData;for(let C=0;C<this.length-a-f;++C)this.setCell(a+C,this.loadCell(a+f+C,h));for(let C=this.length-f;C<this.length;++C)this.setCell(C,d)}else for(let h=a;h<this.length;++h)this.setCell(h,d);a&&this.getWidth(a-1)===2&&this.setCellFromCodepoint(a-1,0,1,d),this.getWidth(a)!==0||this.hasContent(a)||this.setCellFromCodepoint(a,0,1,d)}replaceCells(a,f,d,h=!1){if(h)for(a&&this.getWidth(a-1)===2&&!this.isProtected(a-1)&&this.setCellFromCodepoint(a-1,0,1,d),f<this.length&&this.getWidth(f-1)===2&&!this.isProtected(f)&&this.setCellFromCodepoint(f,0,1,d);a<f&&a<this.length;)this.isProtected(a)||this.setCell(a,d),a++;else for(a&&this.getWidth(a-1)===2&&this.setCellFromCodepoint(a-1,0,1,d),f<this.length&&this.getWidth(f-1)===2&&this.setCellFromCodepoint(f,0,1,d);a<f&&a<this.length;)this.setCell(a++,d)}resize(a,f){if(a===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const d=3*a;if(a>this.length){if(this._data.buffer.byteLength>=4*d)this._data=new Uint32Array(this._data.buffer,0,d);else{const h=new Uint32Array(d);h.set(this._data),this._data=h}for(let h=this.length;h<a;++h)this.setCell(h,f)}else{this._data=this._data.subarray(0,d);const h=Object.keys(this._combined);for(let D=0;D<h.length;D++){const x=parseInt(h[D],10);x>=a&&delete this._combined[x]}const C=Object.keys(this._extendedAttrs);for(let D=0;D<C.length;D++){const x=parseInt(C[D],10);x>=a&&delete this._extendedAttrs[x]}}return this.length=a,4*d*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const a=new Uint32Array(this._data.length);return a.set(this._data),this._data=a,1}return 0}fill(a,f=!1){if(f)for(let d=0;d<this.length;++d)this.isProtected(d)||this.setCell(d,a);else{this._combined={},this._extendedAttrs={};for(let d=0;d<this.length;++d)this.setCell(d,a)}}copyFrom(a){this.length!==a.length?this._data=new Uint32Array(a._data):this._data.set(a._data),this.length=a.length,this._combined={};for(const f in a._combined)this._combined[f]=a._combined[f];this._extendedAttrs={};for(const f in a._extendedAttrs)this._extendedAttrs[f]=a._extendedAttrs[f];this.isWrapped=a.isWrapped}clone(){const a=new E(0);a._data=new Uint32Array(this._data),a.length=this.length;for(const f in this._combined)a._combined[f]=this._combined[f];for(const f in this._extendedAttrs)a._extendedAttrs[f]=this._extendedAttrs[f];return a.isWrapped=this.isWrapped,a}getTrimmedLength(){for(let a=this.length-1;a>=0;--a)if(4194303&this._data[3*a+0])return a+(this._data[3*a+0]>>22);return 0}getNoBgTrimmedLength(){for(let a=this.length-1;a>=0;--a)if(4194303&this._data[3*a+0]||50331648&this._data[3*a+2])return a+(this._data[3*a+0]>>22);return 0}copyCellsFrom(a,f,d,h,C){const D=a._data;if(C)for(let M=h-1;M>=0;M--){for(let b=0;b<3;b++)this._data[3*(d+M)+b]=D[3*(f+M)+b];268435456&D[3*(f+M)+2]&&(this._extendedAttrs[d+M]=a._extendedAttrs[f+M])}else for(let M=0;M<h;M++){for(let b=0;b<3;b++)this._data[3*(d+M)+b]=D[3*(f+M)+b];268435456&D[3*(f+M)+2]&&(this._extendedAttrs[d+M]=a._extendedAttrs[f+M])}const x=Object.keys(a._combined);for(let M=0;M<x.length;M++){const b=parseInt(x[M],10);b>=f&&(this._combined[b-f+d]=a._combined[b])}}translateToString(a,f,d,h){f=f??0,d=d??this.length,a&&(d=Math.min(d,this.getTrimmedLength())),h&&(h.length=0);let C="";for(;f<d;){const D=this._data[3*f+0],x=2097151&D,M=2097152&D?this._combined[f]:x?(0,y.stringFromCodePoint)(x):u.WHITESPACE_CELL_CHAR;if(C+=M,h)for(let b=0;b<M.length;++b)h.push(f);f+=D>>22||1}return h&&h.push(f),C}}s.BufferLine=E},4841:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.getRangeLength=void 0,s.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:(L,s)=>{function c(m,_,u){if(_===m.length-1)return m[_].getTrimmedLength();const y=!m[_].hasContent(u-1)&&m[_].getWidth(u-1)===1,S=m[_+1].getWidth(0)===2;return y&&S?u-1:u}Object.defineProperty(s,"__esModule",{value:!0}),s.getWrappedLineTrimmedLength=s.reflowSmallerGetNewLineLengths=s.reflowLargerApplyNewLayout=s.reflowLargerCreateNewLayout=s.reflowLargerGetLinesToRemove=void 0,s.reflowLargerGetLinesToRemove=function(m,_,u,y,S){const E=[];for(let g=0;g<m.length-1;g++){let a=g,f=m.get(++a);if(!f.isWrapped)continue;const d=[m.get(g)];for(;a<m.length&&f.isWrapped;)d.push(f),f=m.get(++a);if(y>=g&&y<a){g+=d.length-1;continue}let h=0,C=c(d,h,_),D=1,x=0;for(;D<d.length;){const b=c(d,D,_),T=b-x,N=u-C,F=Math.min(T,N);d[h].copyCellsFrom(d[D],x,C,F,!1),C+=F,C===u&&(h++,C=0),x+=F,x===b&&(D++,x=0),C===0&&h!==0&&d[h-1].getWidth(u-1)===2&&(d[h].copyCellsFrom(d[h-1],u-1,C++,1,!1),d[h-1].setCell(u-1,S))}d[h].replaceCells(C,u,S);let M=0;for(let b=d.length-1;b>0&&(b>h||d[b].getTrimmedLength()===0);b--)M++;M>0&&(E.push(g+d.length-M),E.push(M)),g+=d.length-1}return E},s.reflowLargerCreateNewLayout=function(m,_){const u=[];let y=0,S=_[y],E=0;for(let g=0;g<m.length;g++)if(S===g){const a=_[++y];m.onDeleteEmitter.fire({index:g-E,amount:a}),g+=a-1,E+=a,S=_[++y]}else u.push(g);return{layout:u,countRemoved:E}},s.reflowLargerApplyNewLayout=function(m,_){const u=[];for(let y=0;y<_.length;y++)u.push(m.get(_[y]));for(let y=0;y<u.length;y++)m.set(y,u[y]);m.length=_.length},s.reflowSmallerGetNewLineLengths=function(m,_,u){const y=[],S=m.map(((f,d)=>c(m,d,_))).reduce(((f,d)=>f+d));let E=0,g=0,a=0;for(;a<S;){if(S-a<u){y.push(S-a);break}E+=u;const f=c(m,g,_);E>f&&(E-=f,g++);const d=m[g].getWidth(E-1)===2;d&&E--;const h=d?u-1:u;y.push(h),a+=h}return y},s.getWrappedLineTrimmedLength=c},5295:(L,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferSet=void 0;const m=c(8460),_=c(844),u=c(9092);class y extends _.Disposable{constructor(E,g){super(),this._optionsService=E,this._bufferService=g,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 u.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new u.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(E){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(E),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(E,g){this._normal.resize(E,g),this._alt.resize(E,g),this.setupTabStops(E)}setupTabStops(E){this._normal.setupTabStops(E),this._alt.setupTabStops(E)}}s.BufferSet=y},511:(L,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CellData=void 0;const m=c(482),_=c(643),u=c(3734);class y extends u.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new u.ExtendedAttrs,this.combinedData=""}static fromCharData(E){const g=new y;return g.setFromCharData(E),g}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(E){this.fg=E[_.CHAR_DATA_ATTR_INDEX],this.bg=0;let g=!1;if(E[_.CHAR_DATA_CHAR_INDEX].length>2)g=!0;else if(E[_.CHAR_DATA_CHAR_INDEX].length===2){const a=E[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=a&&a<=56319){const f=E[_.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=f&&f<=57343?this.content=1024*(a-55296)+f-56320+65536|E[_.CHAR_DATA_WIDTH_INDEX]<<22:g=!0}else g=!0}else this.content=E[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|E[_.CHAR_DATA_WIDTH_INDEX]<<22;g&&(this.combinedData=E[_.CHAR_DATA_CHAR_INDEX],this.content=2097152|E[_.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}s.CellData=y},643:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WHITESPACE_CELL_CODE=s.WHITESPACE_CELL_WIDTH=s.WHITESPACE_CELL_CHAR=s.NULL_CELL_CODE=s.NULL_CELL_WIDTH=s.NULL_CELL_CHAR=s.CHAR_DATA_CODE_INDEX=s.CHAR_DATA_WIDTH_INDEX=s.CHAR_DATA_CHAR_INDEX=s.CHAR_DATA_ATTR_INDEX=s.DEFAULT_EXT=s.DEFAULT_ATTR=s.DEFAULT_COLOR=void 0,s.DEFAULT_COLOR=0,s.DEFAULT_ATTR=256|s.DEFAULT_COLOR<<9,s.DEFAULT_EXT=0,s.CHAR_DATA_ATTR_INDEX=0,s.CHAR_DATA_CHAR_INDEX=1,s.CHAR_DATA_WIDTH_INDEX=2,s.CHAR_DATA_CODE_INDEX=3,s.NULL_CELL_CHAR="",s.NULL_CELL_WIDTH=1,s.NULL_CELL_CODE=0,s.WHITESPACE_CELL_CHAR=" ",s.WHITESPACE_CELL_WIDTH=1,s.WHITESPACE_CELL_CODE=32},4863:(L,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Marker=void 0;const m=c(8460),_=c(844);class u{get id(){return this._id}constructor(S){this.line=S,this.isDisposed=!1,this._disposables=[],this._id=u._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,_.disposeArray)(this._disposables),this._disposables.length=0)}register(S){return this._disposables.push(S),S}}s.Marker=u,u._nextId=1},7116:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DEFAULT_CHARSET=s.CHARSETS=void 0,s.CHARSETS={},s.DEFAULT_CHARSET=s.CHARSETS.B,s.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:"≥","{":"π","|":"≠","}":"£","~":"·"},s.CHARSETS.A={"#":"£"},s.CHARSETS.B=void 0,s.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},s.CHARSETS.C=s.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},s.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},s.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},s.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},s.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},s.CHARSETS.E=s.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},s.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},s.CHARSETS.H=s.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},s.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(L,s)=>{var c,m,_;Object.defineProperty(s,"__esModule",{value:!0}),s.C1_ESCAPED=s.C1=s.C0=void 0,(function(u){u.NUL="\0",u.SOH="",u.STX="",u.ETX="",u.EOT="",u.ENQ="",u.ACK="",u.BEL="\x07",u.BS="\b",u.HT=" ",u.LF=`
115
- `,u.VT="\v",u.FF="\f",u.CR="\r",u.SO="",u.SI="",u.DLE="",u.DC1="",u.DC2="",u.DC3="",u.DC4="",u.NAK="",u.SYN="",u.ETB="",u.CAN="",u.EM="",u.SUB="",u.ESC="\x1B",u.FS="",u.GS="",u.RS="",u.US="",u.SP=" ",u.DEL=""})(c||(s.C0=c={})),(function(u){u.PAD="€",u.HOP="",u.BPH="‚",u.NBH="ƒ",u.IND="„",u.NEL="…",u.SSA="†",u.ESA="‡",u.HTS="ˆ",u.HTJ="‰",u.VTS="Š",u.PLD="‹",u.PLU="Œ",u.RI="",u.SS2="Ž",u.SS3="",u.DCS="",u.PU1="‘",u.PU2="’",u.STS="“",u.CCH="”",u.MW="•",u.SPA="–",u.EPA="—",u.SOS="˜",u.SGCI="™",u.SCI="š",u.CSI="›",u.ST="œ",u.OSC="",u.PM="ž",u.APC="Ÿ"})(m||(s.C1=m={})),(function(u){u.ST=`${c.ESC}\\`})(_||(s.C1_ESCAPED=_={}))},7399:(L,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.evaluateKeyboardEvent=void 0;const m=c(2584),_={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:["'",'"']};s.evaluateKeyboardEvent=function(u,y,S,E){const g={type:0,cancel:!1,key:void 0},a=(u.shiftKey?1:0)|(u.altKey?2:0)|(u.ctrlKey?4:0)|(u.metaKey?8:0);switch(u.keyCode){case 0:u.key==="UIKeyInputUpArrow"?g.key=y?m.C0.ESC+"OA":m.C0.ESC+"[A":u.key==="UIKeyInputLeftArrow"?g.key=y?m.C0.ESC+"OD":m.C0.ESC+"[D":u.key==="UIKeyInputRightArrow"?g.key=y?m.C0.ESC+"OC":m.C0.ESC+"[C":u.key==="UIKeyInputDownArrow"&&(g.key=y?m.C0.ESC+"OB":m.C0.ESC+"[B");break;case 8:g.key=u.ctrlKey?"\b":m.C0.DEL,u.altKey&&(g.key=m.C0.ESC+g.key);break;case 9:if(u.shiftKey){g.key=m.C0.ESC+"[Z";break}g.key=m.C0.HT,g.cancel=!0;break;case 13:g.key=u.altKey?m.C0.ESC+m.C0.CR:m.C0.CR,g.cancel=!0;break;case 27:g.key=m.C0.ESC,u.altKey&&(g.key=m.C0.ESC+m.C0.ESC),g.cancel=!0;break;case 37:if(u.metaKey)break;a?(g.key=m.C0.ESC+"[1;"+(a+1)+"D",g.key===m.C0.ESC+"[1;3D"&&(g.key=m.C0.ESC+(S?"b":"[1;5D"))):g.key=y?m.C0.ESC+"OD":m.C0.ESC+"[D";break;case 39:if(u.metaKey)break;a?(g.key=m.C0.ESC+"[1;"+(a+1)+"C",g.key===m.C0.ESC+"[1;3C"&&(g.key=m.C0.ESC+(S?"f":"[1;5C"))):g.key=y?m.C0.ESC+"OC":m.C0.ESC+"[C";break;case 38:if(u.metaKey)break;a?(g.key=m.C0.ESC+"[1;"+(a+1)+"A",S||g.key!==m.C0.ESC+"[1;3A"||(g.key=m.C0.ESC+"[1;5A")):g.key=y?m.C0.ESC+"OA":m.C0.ESC+"[A";break;case 40:if(u.metaKey)break;a?(g.key=m.C0.ESC+"[1;"+(a+1)+"B",S||g.key!==m.C0.ESC+"[1;3B"||(g.key=m.C0.ESC+"[1;5B")):g.key=y?m.C0.ESC+"OB":m.C0.ESC+"[B";break;case 45:u.shiftKey||u.ctrlKey||(g.key=m.C0.ESC+"[2~");break;case 46:g.key=a?m.C0.ESC+"[3;"+(a+1)+"~":m.C0.ESC+"[3~";break;case 36:g.key=a?m.C0.ESC+"[1;"+(a+1)+"H":y?m.C0.ESC+"OH":m.C0.ESC+"[H";break;case 35:g.key=a?m.C0.ESC+"[1;"+(a+1)+"F":y?m.C0.ESC+"OF":m.C0.ESC+"[F";break;case 33:u.shiftKey?g.type=2:u.ctrlKey?g.key=m.C0.ESC+"[5;"+(a+1)+"~":g.key=m.C0.ESC+"[5~";break;case 34:u.shiftKey?g.type=3:u.ctrlKey?g.key=m.C0.ESC+"[6;"+(a+1)+"~":g.key=m.C0.ESC+"[6~";break;case 112:g.key=a?m.C0.ESC+"[1;"+(a+1)+"P":m.C0.ESC+"OP";break;case 113:g.key=a?m.C0.ESC+"[1;"+(a+1)+"Q":m.C0.ESC+"OQ";break;case 114:g.key=a?m.C0.ESC+"[1;"+(a+1)+"R":m.C0.ESC+"OR";break;case 115:g.key=a?m.C0.ESC+"[1;"+(a+1)+"S":m.C0.ESC+"OS";break;case 116:g.key=a?m.C0.ESC+"[15;"+(a+1)+"~":m.C0.ESC+"[15~";break;case 117:g.key=a?m.C0.ESC+"[17;"+(a+1)+"~":m.C0.ESC+"[17~";break;case 118:g.key=a?m.C0.ESC+"[18;"+(a+1)+"~":m.C0.ESC+"[18~";break;case 119:g.key=a?m.C0.ESC+"[19;"+(a+1)+"~":m.C0.ESC+"[19~";break;case 120:g.key=a?m.C0.ESC+"[20;"+(a+1)+"~":m.C0.ESC+"[20~";break;case 121:g.key=a?m.C0.ESC+"[21;"+(a+1)+"~":m.C0.ESC+"[21~";break;case 122:g.key=a?m.C0.ESC+"[23;"+(a+1)+"~":m.C0.ESC+"[23~";break;case 123:g.key=a?m.C0.ESC+"[24;"+(a+1)+"~":m.C0.ESC+"[24~";break;default:if(!u.ctrlKey||u.shiftKey||u.altKey||u.metaKey)if(S&&!E||!u.altKey||u.metaKey)!S||u.altKey||u.ctrlKey||u.shiftKey||!u.metaKey?u.key&&!u.ctrlKey&&!u.altKey&&!u.metaKey&&u.keyCode>=48&&u.key.length===1?g.key=u.key:u.key&&u.ctrlKey&&(u.key==="_"&&(g.key=m.C0.US),u.key==="@"&&(g.key=m.C0.NUL)):u.keyCode===65&&(g.type=1);else{const f=_[u.keyCode],d=f==null?void 0:f[u.shiftKey?1:0];if(d)g.key=m.C0.ESC+d;else if(u.keyCode>=65&&u.keyCode<=90){const h=u.ctrlKey?u.keyCode-64:u.keyCode+32;let C=String.fromCharCode(h);u.shiftKey&&(C=C.toUpperCase()),g.key=m.C0.ESC+C}else if(u.keyCode===32)g.key=m.C0.ESC+(u.ctrlKey?m.C0.NUL:" ");else if(u.key==="Dead"&&u.code.startsWith("Key")){let h=u.code.slice(3,4);u.shiftKey||(h=h.toLowerCase()),g.key=m.C0.ESC+h,g.cancel=!0}}else u.keyCode>=65&&u.keyCode<=90?g.key=String.fromCharCode(u.keyCode-64):u.keyCode===32?g.key=m.C0.NUL:u.keyCode>=51&&u.keyCode<=55?g.key=String.fromCharCode(u.keyCode-51+27):u.keyCode===56?g.key=m.C0.DEL:u.keyCode===219?g.key=m.C0.ESC:u.keyCode===220?g.key=m.C0.FS:u.keyCode===221&&(g.key=m.C0.GS)}return g}},482:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Utf8ToUtf32=s.StringToUtf32=s.utf32ToString=s.stringFromCodePoint=void 0,s.stringFromCodePoint=function(c){return c>65535?(c-=65536,String.fromCharCode(55296+(c>>10))+String.fromCharCode(c%1024+56320)):String.fromCharCode(c)},s.utf32ToString=function(c,m=0,_=c.length){let u="";for(let y=m;y<_;++y){let S=c[y];S>65535?(S-=65536,u+=String.fromCharCode(55296+(S>>10))+String.fromCharCode(S%1024+56320)):u+=String.fromCharCode(S)}return u},s.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(c,m){const _=c.length;if(!_)return 0;let u=0,y=0;if(this._interim){const S=c.charCodeAt(y++);56320<=S&&S<=57343?m[u++]=1024*(this._interim-55296)+S-56320+65536:(m[u++]=this._interim,m[u++]=S),this._interim=0}for(let S=y;S<_;++S){const E=c.charCodeAt(S);if(55296<=E&&E<=56319){if(++S>=_)return this._interim=E,u;const g=c.charCodeAt(S);56320<=g&&g<=57343?m[u++]=1024*(E-55296)+g-56320+65536:(m[u++]=E,m[u++]=g)}else E!==65279&&(m[u++]=E)}return u}},s.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(c,m){const _=c.length;if(!_)return 0;let u,y,S,E,g=0,a=0,f=0;if(this.interim[0]){let C=!1,D=this.interim[0];D&=(224&D)==192?31:(240&D)==224?15:7;let x,M=0;for(;(x=63&this.interim[++M])&&M<4;)D<<=6,D|=x;const b=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,T=b-M;for(;f<T;){if(f>=_)return 0;if(x=c[f++],(192&x)!=128){f--,C=!0;break}this.interim[M++]=x,D<<=6,D|=63&x}C||(b===2?D<128?f--:m[g++]=D:b===3?D<2048||D>=55296&&D<=57343||D===65279||(m[g++]=D):D<65536||D>1114111||(m[g++]=D)),this.interim.fill(0)}const d=_-4;let h=f;for(;h<_;){for(;!(!(h<d)||128&(u=c[h])||128&(y=c[h+1])||128&(S=c[h+2])||128&(E=c[h+3]));)m[g++]=u,m[g++]=y,m[g++]=S,m[g++]=E,h+=4;if(u=c[h++],u<128)m[g++]=u;else if((224&u)==192){if(h>=_)return this.interim[0]=u,g;if(y=c[h++],(192&y)!=128){h--;continue}if(a=(31&u)<<6|63&y,a<128){h--;continue}m[g++]=a}else if((240&u)==224){if(h>=_)return this.interim[0]=u,g;if(y=c[h++],(192&y)!=128){h--;continue}if(h>=_)return this.interim[0]=u,this.interim[1]=y,g;if(S=c[h++],(192&S)!=128){h--;continue}if(a=(15&u)<<12|(63&y)<<6|63&S,a<2048||a>=55296&&a<=57343||a===65279)continue;m[g++]=a}else if((248&u)==240){if(h>=_)return this.interim[0]=u,g;if(y=c[h++],(192&y)!=128){h--;continue}if(h>=_)return this.interim[0]=u,this.interim[1]=y,g;if(S=c[h++],(192&S)!=128){h--;continue}if(h>=_)return this.interim[0]=u,this.interim[1]=y,this.interim[2]=S,g;if(E=c[h++],(192&E)!=128){h--;continue}if(a=(7&u)<<18|(63&y)<<12|(63&S)<<6|63&E,a<65536||a>1114111)continue;m[g++]=a}}return g}}},225:(L,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeV6=void 0;const m=c(1480),_=[[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]],u=[[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 y;s.UnicodeV6=class{constructor(){if(this.version="6",!y){y=new Uint8Array(65536),y.fill(1),y[0]=0,y.fill(0,1,32),y.fill(0,127,160),y.fill(2,4352,4448),y[9001]=2,y[9002]=2,y.fill(2,11904,42192),y[12351]=1,y.fill(2,44032,55204),y.fill(2,63744,64256),y.fill(2,65040,65050),y.fill(2,65072,65136),y.fill(2,65280,65377),y.fill(2,65504,65511);for(let S=0;S<_.length;++S)y.fill(0,_[S][0],_[S][1]+1)}}wcwidth(S){return S<32?0:S<127?1:S<65536?y[S]:(function(E,g){let a,f=0,d=g.length-1;if(E<g[0][0]||E>g[d][1])return!1;for(;d>=f;)if(a=f+d>>1,E>g[a][1])f=a+1;else{if(!(E<g[a][0]))return!0;d=a-1}return!1})(S,u)?0:S>=131072&&S<=196605||S>=196608&&S<=262141?2:1}charProperties(S,E){let g=this.wcwidth(S),a=g===0&&E!==0;if(a){const f=m.UnicodeService.extractWidth(E);f===0?a=!1:f>g&&(g=f)}return m.UnicodeService.createPropertyValue(0,g,a)}}},5981:(L,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WriteBuffer=void 0;const m=c(8460),_=c(844);class u extends _.Disposable{constructor(S){super(),this._action=S,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(S,E){if(E!==void 0&&this._syncCalls>E)return void(this._syncCalls=0);if(this._pendingData+=S.length,this._writeBuffer.push(S),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let g;for(this._isSyncWriting=!0;g=this._writeBuffer.shift();){this._action(g);const a=this._callbacks.shift();a&&a()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(S,E){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+=S.length,this._writeBuffer.push(S),this._callbacks.push(E),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=S.length,this._writeBuffer.push(S),this._callbacks.push(E)}_innerWrite(S=0,E=!0){const g=S||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const a=this._writeBuffer[this._bufferOffset],f=this._action(a,E);if(f){const h=C=>Date.now()-g>=12?setTimeout((()=>this._innerWrite(0,C))):this._innerWrite(g,C);return void f.catch((C=>(queueMicrotask((()=>{throw C})),Promise.resolve(!1)))).then(h)}const d=this._callbacks[this._bufferOffset];if(d&&d(),this._bufferOffset++,this._pendingData-=a.length,Date.now()-g>=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()}}s.WriteBuffer=u},5941:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.toRgbString=s.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 _(u,y){const S=u.toString(16),E=S.length<2?"0"+S:S;switch(y){case 4:return S[0];case 8:return E;case 12:return(E+E).slice(0,3);default:return E+E}}s.parseColor=function(u){if(!u)return;let y=u.toLowerCase();if(y.indexOf("rgb:")===0){y=y.slice(4);const S=c.exec(y);if(S){const E=S[1]?15:S[4]?255:S[7]?4095:65535;return[Math.round(parseInt(S[1]||S[4]||S[7]||S[10],16)/E*255),Math.round(parseInt(S[2]||S[5]||S[8]||S[11],16)/E*255),Math.round(parseInt(S[3]||S[6]||S[9]||S[12],16)/E*255)]}}else if(y.indexOf("#")===0&&(y=y.slice(1),m.exec(y)&&[3,6,9,12].includes(y.length))){const S=y.length/3,E=[0,0,0];for(let g=0;g<3;++g){const a=parseInt(y.slice(S*g,S*g+S),16);E[g]=S===1?a<<4:S===2?a:S===3?a>>4:a>>8}return E}},s.toRgbString=function(u,y=16){const[S,E,g]=u;return`rgb:${_(S,y)}/${_(E,y)}/${_(g,y)}`}},5770:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.PAYLOAD_LIMIT=void 0,s.PAYLOAD_LIMIT=1e7},6351:(L,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DcsHandler=s.DcsParser=void 0;const m=c(482),_=c(8742),u=c(5770),y=[];s.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=y,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=y}registerHandler(E,g){this._handlers[E]===void 0&&(this._handlers[E]=[]);const a=this._handlers[E];return a.push(g),{dispose:()=>{const f=a.indexOf(g);f!==-1&&a.splice(f,1)}}}clearHandler(E){this._handlers[E]&&delete this._handlers[E]}setHandlerFallback(E){this._handlerFb=E}reset(){if(this._active.length)for(let E=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;E>=0;--E)this._active[E].unhook(!1);this._stack.paused=!1,this._active=y,this._ident=0}hook(E,g){if(this.reset(),this._ident=E,this._active=this._handlers[E]||y,this._active.length)for(let a=this._active.length-1;a>=0;a--)this._active[a].hook(g);else this._handlerFb(this._ident,"HOOK",g)}put(E,g,a){if(this._active.length)for(let f=this._active.length-1;f>=0;f--)this._active[f].put(E,g,a);else this._handlerFb(this._ident,"PUT",(0,m.utf32ToString)(E,g,a))}unhook(E,g=!0){if(this._active.length){let a=!1,f=this._active.length-1,d=!1;if(this._stack.paused&&(f=this._stack.loopPosition-1,a=g,d=this._stack.fallThrough,this._stack.paused=!1),!d&&a===!1){for(;f>=0&&(a=this._active[f].unhook(E),a!==!0);f--)if(a instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=f,this._stack.fallThrough=!1,a;f--}for(;f>=0;f--)if(a=this._active[f].unhook(!1),a instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=f,this._stack.fallThrough=!0,a}else this._handlerFb(this._ident,"UNHOOK",E);this._active=y,this._ident=0}};const S=new _.Params;S.addParam(0),s.DcsHandler=class{constructor(E){this._handler=E,this._data="",this._params=S,this._hitLimit=!1}hook(E){this._params=E.length>1||E.params[0]?E.clone():S,this._data="",this._hitLimit=!1}put(E,g,a){this._hitLimit||(this._data+=(0,m.utf32ToString)(E,g,a),this._data.length>u.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(E){let g=!1;if(this._hitLimit)g=!1;else if(E&&(g=this._handler(this._data,this._params),g instanceof Promise))return g.then((a=>(this._params=S,this._data="",this._hitLimit=!1,a)));return this._params=S,this._data="",this._hitLimit=!1,g}}},2015:(L,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.EscapeSequenceParser=s.VT500_TRANSITION_TABLE=s.TransitionTable=void 0;const m=c(844),_=c(8742),u=c(6242),y=c(6351);class S{constructor(f){this.table=new Uint8Array(f)}setDefault(f,d){this.table.fill(f<<4|d)}add(f,d,h,C){this.table[d<<8|f]=h<<4|C}addMany(f,d,h,C){for(let D=0;D<f.length;D++)this.table[d<<8|f[D]]=h<<4|C}}s.TransitionTable=S;const E=160;s.VT500_TRANSITION_TABLE=(function(){const a=new S(4095),f=Array.apply(null,Array(256)).map(((M,b)=>b)),d=(M,b)=>f.slice(M,b),h=d(32,127),C=d(0,24);C.push(25),C.push.apply(C,d(28,32));const D=d(0,14);let x;for(x in a.setDefault(1,0),a.addMany(h,0,2,0),D)a.addMany([24,26,153,154],x,3,0),a.addMany(d(128,144),x,3,0),a.addMany(d(144,152),x,3,0),a.add(156,x,0,0),a.add(27,x,11,1),a.add(157,x,4,8),a.addMany([152,158,159],x,0,7),a.add(155,x,11,3),a.add(144,x,11,9);return a.addMany(C,0,3,0),a.addMany(C,1,3,1),a.add(127,1,0,1),a.addMany(C,8,0,8),a.addMany(C,3,3,3),a.add(127,3,0,3),a.addMany(C,4,3,4),a.add(127,4,0,4),a.addMany(C,6,3,6),a.addMany(C,5,3,5),a.add(127,5,0,5),a.addMany(C,2,3,2),a.add(127,2,0,2),a.add(93,1,4,8),a.addMany(h,8,5,8),a.add(127,8,5,8),a.addMany([156,27,24,26,7],8,6,0),a.addMany(d(28,32),8,0,8),a.addMany([88,94,95],1,0,7),a.addMany(h,7,0,7),a.addMany(C,7,0,7),a.add(156,7,0,0),a.add(127,7,0,7),a.add(91,1,11,3),a.addMany(d(64,127),3,7,0),a.addMany(d(48,60),3,8,4),a.addMany([60,61,62,63],3,9,4),a.addMany(d(48,60),4,8,4),a.addMany(d(64,127),4,7,0),a.addMany([60,61,62,63],4,0,6),a.addMany(d(32,64),6,0,6),a.add(127,6,0,6),a.addMany(d(64,127),6,0,0),a.addMany(d(32,48),3,9,5),a.addMany(d(32,48),5,9,5),a.addMany(d(48,64),5,0,6),a.addMany(d(64,127),5,7,0),a.addMany(d(32,48),4,9,5),a.addMany(d(32,48),1,9,2),a.addMany(d(32,48),2,9,2),a.addMany(d(48,127),2,10,0),a.addMany(d(48,80),1,10,0),a.addMany(d(81,88),1,10,0),a.addMany([89,90,92],1,10,0),a.addMany(d(96,127),1,10,0),a.add(80,1,11,9),a.addMany(C,9,0,9),a.add(127,9,0,9),a.addMany(d(28,32),9,0,9),a.addMany(d(32,48),9,9,12),a.addMany(d(48,60),9,8,10),a.addMany([60,61,62,63],9,9,10),a.addMany(C,11,0,11),a.addMany(d(32,128),11,0,11),a.addMany(d(28,32),11,0,11),a.addMany(C,10,0,10),a.add(127,10,0,10),a.addMany(d(28,32),10,0,10),a.addMany(d(48,60),10,8,10),a.addMany([60,61,62,63],10,0,11),a.addMany(d(32,48),10,9,12),a.addMany(C,12,0,12),a.add(127,12,0,12),a.addMany(d(28,32),12,0,12),a.addMany(d(32,48),12,9,12),a.addMany(d(48,64),12,0,11),a.addMany(d(64,127),12,12,13),a.addMany(d(64,127),10,12,13),a.addMany(d(64,127),9,12,13),a.addMany(C,13,13,13),a.addMany(h,13,13,13),a.add(127,13,0,13),a.addMany([27,156,24,26],13,14,0),a.add(E,0,2,0),a.add(E,8,5,8),a.add(E,6,0,6),a.add(E,11,0,11),a.add(E,13,13,13),a})();class g extends m.Disposable{constructor(f=s.VT500_TRANSITION_TABLE){super(),this._transitions=f,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new _.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(d,h,C)=>{},this._executeHandlerFb=d=>{},this._csiHandlerFb=(d,h)=>{},this._escHandlerFb=d=>{},this._errorHandlerFb=d=>d,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 u.OscParser),this._dcsParser=this.register(new y.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(f,d=[64,126]){let h=0;if(f.prefix){if(f.prefix.length>1)throw new Error("only one byte as prefix supported");if(h=f.prefix.charCodeAt(0),h&&60>h||h>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(f.intermediates){if(f.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let D=0;D<f.intermediates.length;++D){const x=f.intermediates.charCodeAt(D);if(32>x||x>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");h<<=8,h|=x}}if(f.final.length!==1)throw new Error("final must be a single byte");const C=f.final.charCodeAt(0);if(d[0]>C||C>d[1])throw new Error(`final must be in range ${d[0]} .. ${d[1]}`);return h<<=8,h|=C,h}identToString(f){const d=[];for(;f;)d.push(String.fromCharCode(255&f)),f>>=8;return d.reverse().join("")}setPrintHandler(f){this._printHandler=f}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(f,d){const h=this._identifier(f,[48,126]);this._escHandlers[h]===void 0&&(this._escHandlers[h]=[]);const C=this._escHandlers[h];return C.push(d),{dispose:()=>{const D=C.indexOf(d);D!==-1&&C.splice(D,1)}}}clearEscHandler(f){this._escHandlers[this._identifier(f,[48,126])]&&delete this._escHandlers[this._identifier(f,[48,126])]}setEscHandlerFallback(f){this._escHandlerFb=f}setExecuteHandler(f,d){this._executeHandlers[f.charCodeAt(0)]=d}clearExecuteHandler(f){this._executeHandlers[f.charCodeAt(0)]&&delete this._executeHandlers[f.charCodeAt(0)]}setExecuteHandlerFallback(f){this._executeHandlerFb=f}registerCsiHandler(f,d){const h=this._identifier(f);this._csiHandlers[h]===void 0&&(this._csiHandlers[h]=[]);const C=this._csiHandlers[h];return C.push(d),{dispose:()=>{const D=C.indexOf(d);D!==-1&&C.splice(D,1)}}}clearCsiHandler(f){this._csiHandlers[this._identifier(f)]&&delete this._csiHandlers[this._identifier(f)]}setCsiHandlerFallback(f){this._csiHandlerFb=f}registerDcsHandler(f,d){return this._dcsParser.registerHandler(this._identifier(f),d)}clearDcsHandler(f){this._dcsParser.clearHandler(this._identifier(f))}setDcsHandlerFallback(f){this._dcsParser.setHandlerFallback(f)}registerOscHandler(f,d){return this._oscParser.registerHandler(f,d)}clearOscHandler(f){this._oscParser.clearHandler(f)}setOscHandlerFallback(f){this._oscParser.setHandlerFallback(f)}setErrorHandler(f){this._errorHandler=f}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(f,d,h,C,D){this._parseStack.state=f,this._parseStack.handlers=d,this._parseStack.handlerPos=h,this._parseStack.transition=C,this._parseStack.chunkPos=D}parse(f,d,h){let C,D=0,x=0,M=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,M=this._parseStack.chunkPos+1;else{if(h===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const b=this._parseStack.handlers;let T=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(h===!1&&T>-1){for(;T>=0&&(C=b[T](this._params),C!==!0);T--)if(C instanceof Promise)return this._parseStack.handlerPos=T,C}this._parseStack.handlers=[];break;case 4:if(h===!1&&T>-1){for(;T>=0&&(C=b[T](),C!==!0);T--)if(C instanceof Promise)return this._parseStack.handlerPos=T,C}this._parseStack.handlers=[];break;case 6:if(D=f[this._parseStack.chunkPos],C=this._dcsParser.unhook(D!==24&&D!==26,h),C)return C;D===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(D=f[this._parseStack.chunkPos],C=this._oscParser.end(D!==24&&D!==26,h),C)return C;D===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,M=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let b=M;b<d;++b){switch(D=f[b],x=this._transitions.table[this.currentState<<8|(D<160?D:E)],x>>4){case 2:for(let B=b+1;;++B){if(B>=d||(D=f[B])<32||D>126&&D<E){this._printHandler(f,b,B),b=B-1;break}if(++B>=d||(D=f[B])<32||D>126&&D<E){this._printHandler(f,b,B),b=B-1;break}if(++B>=d||(D=f[B])<32||D>126&&D<E){this._printHandler(f,b,B),b=B-1;break}if(++B>=d||(D=f[B])<32||D>126&&D<E){this._printHandler(f,b,B),b=B-1;break}}break;case 3:this._executeHandlers[D]?this._executeHandlers[D]():this._executeHandlerFb(D),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:b,code:D,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const T=this._csiHandlers[this._collect<<8|D];let N=T?T.length-1:-1;for(;N>=0&&(C=T[N](this._params),C!==!0);N--)if(C instanceof Promise)return this._preserveStack(3,T,N,x,b),C;N<0&&this._csiHandlerFb(this._collect<<8|D,this._params),this.precedingJoinState=0;break;case 8:do switch(D){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(D-48)}while(++b<d&&(D=f[b])>47&&D<60);b--;break;case 9:this._collect<<=8,this._collect|=D;break;case 10:const F=this._escHandlers[this._collect<<8|D];let P=F?F.length-1:-1;for(;P>=0&&(C=F[P](),C!==!0);P--)if(C instanceof Promise)return this._preserveStack(4,F,P,x,b),C;P<0&&this._escHandlerFb(this._collect<<8|D),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|D,this._params);break;case 13:for(let B=b+1;;++B)if(B>=d||(D=f[B])===24||D===26||D===27||D>127&&D<E){this._dcsParser.put(f,b,B),b=B-1;break}break;case 14:if(C=this._dcsParser.unhook(D!==24&&D!==26),C)return this._preserveStack(6,[],0,x,b),C;D===27&&(x|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let B=b+1;;B++)if(B>=d||(D=f[B])<32||D>127&&D<E){this._oscParser.put(f,b,B),b=B-1;break}break;case 6:if(C=this._oscParser.end(D!==24&&D!==26),C)return this._preserveStack(5,[],0,x,b),C;D===27&&(x|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&x}}}s.EscapeSequenceParser=g},6242:(L,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.OscHandler=s.OscParser=void 0;const m=c(5770),_=c(482),u=[];s.OscParser=class{constructor(){this._state=0,this._active=u,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(y,S){this._handlers[y]===void 0&&(this._handlers[y]=[]);const E=this._handlers[y];return E.push(S),{dispose:()=>{const g=E.indexOf(S);g!==-1&&E.splice(g,1)}}}clearHandler(y){this._handlers[y]&&delete this._handlers[y]}setHandlerFallback(y){this._handlerFb=y}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=u}reset(){if(this._state===2)for(let y=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;y>=0;--y)this._active[y].end(!1);this._stack.paused=!1,this._active=u,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||u,this._active.length)for(let y=this._active.length-1;y>=0;y--)this._active[y].start();else this._handlerFb(this._id,"START")}_put(y,S,E){if(this._active.length)for(let g=this._active.length-1;g>=0;g--)this._active[g].put(y,S,E);else this._handlerFb(this._id,"PUT",(0,_.utf32ToString)(y,S,E))}start(){this.reset(),this._state=1}put(y,S,E){if(this._state!==3){if(this._state===1)for(;S<E;){const g=y[S++];if(g===59){this._state=2,this._start();break}if(g<48||57<g)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+g-48}this._state===2&&E-S>0&&this._put(y,S,E)}}end(y,S=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let E=!1,g=this._active.length-1,a=!1;if(this._stack.paused&&(g=this._stack.loopPosition-1,E=S,a=this._stack.fallThrough,this._stack.paused=!1),!a&&E===!1){for(;g>=0&&(E=this._active[g].end(y),E!==!0);g--)if(E instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=g,this._stack.fallThrough=!1,E;g--}for(;g>=0;g--)if(E=this._active[g].end(!1),E instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=g,this._stack.fallThrough=!0,E}else this._handlerFb(this._id,"END",y);this._active=u,this._id=-1,this._state=0}}},s.OscHandler=class{constructor(y){this._handler=y,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(y,S,E){this._hitLimit||(this._data+=(0,_.utf32ToString)(y,S,E),this._data.length>m.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(y){let S=!1;if(this._hitLimit)S=!1;else if(y&&(S=this._handler(this._data),S instanceof Promise))return S.then((E=>(this._data="",this._hitLimit=!1,E)));return this._data="",this._hitLimit=!1,S}}},8742:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Params=void 0;const c=2147483647;class m{static fromArray(u){const y=new m;if(!u.length)return y;for(let S=Array.isArray(u[0])?1:0;S<u.length;++S){const E=u[S];if(Array.isArray(E))for(let g=0;g<E.length;++g)y.addSubParam(E[g]);else y.addParam(E)}return y}constructor(u=32,y=32){if(this.maxLength=u,this.maxSubParamsLength=y,y>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(u),this.length=0,this._subParams=new Int32Array(y),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(u),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const u=new m(this.maxLength,this.maxSubParamsLength);return u.params.set(this.params),u.length=this.length,u._subParams.set(this._subParams),u._subParamsLength=this._subParamsLength,u._subParamsIdx.set(this._subParamsIdx),u._rejectDigits=this._rejectDigits,u._rejectSubDigits=this._rejectSubDigits,u._digitIsSub=this._digitIsSub,u}toArray(){const u=[];for(let y=0;y<this.length;++y){u.push(this.params[y]);const S=this._subParamsIdx[y]>>8,E=255&this._subParamsIdx[y];E-S>0&&u.push(Array.prototype.slice.call(this._subParams,S,E))}return u}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(u){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(u<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=u>c?c:u}}addSubParam(u){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(u<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=u>c?c:u,this._subParamsIdx[this.length-1]++}}hasSubParams(u){return(255&this._subParamsIdx[u])-(this._subParamsIdx[u]>>8)>0}getSubParams(u){const y=this._subParamsIdx[u]>>8,S=255&this._subParamsIdx[u];return S-y>0?this._subParams.subarray(y,S):null}getSubParamsAll(){const u={};for(let y=0;y<this.length;++y){const S=this._subParamsIdx[y]>>8,E=255&this._subParamsIdx[y];E-S>0&&(u[y]=this._subParams.slice(S,E))}return u}addDigit(u){let y;if(this._rejectDigits||!(y=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const S=this._digitIsSub?this._subParams:this.params,E=S[y-1];S[y-1]=~E?Math.min(10*E+u,c):u}}s.Params=m},5741:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.AddonManager=void 0,s.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 _={instance:m,dispose:m.dispose,isDisposed:!1};this._addons.push(_),m.dispose=()=>this._wrappedAddonDispose(_),m.activate(c)}_wrappedAddonDispose(c){if(c.isDisposed)return;let m=-1;for(let _=0;_<this._addons.length;_++)if(this._addons[_]===c){m=_;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:(L,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferApiView=void 0;const m=c(3785),_=c(511);s.BufferApiView=class{constructor(u,y){this._buffer=u,this.type=y}init(u){return this._buffer=u,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(u){const y=this._buffer.lines.get(u);if(y)return new m.BufferLineApiView(y)}getNullCell(){return new _.CellData}}},3785:(L,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferLineApiView=void 0;const m=c(511);s.BufferLineApiView=class{constructor(_){this._line=_}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(_,u){if(!(_<0||_>=this._line.length))return u?(this._line.loadCell(_,u),u):this._line.loadCell(_,new m.CellData)}translateToString(_,u,y){return this._line.translateToString(_,u,y)}}},8285:(L,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferNamespaceApi=void 0;const m=c(8771),_=c(8460),u=c(844);class y extends u.Disposable{constructor(E){super(),this._core=E,this._onBufferChange=this.register(new _.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)}}s.BufferNamespaceApi=y},7975:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ParserApi=void 0,s.ParserApi=class{constructor(c){this._core=c}registerCsiHandler(c,m){return this._core.registerCsiHandler(c,(_=>m(_.toArray())))}addCsiHandler(c,m){return this.registerCsiHandler(c,m)}registerDcsHandler(c,m){return this._core.registerDcsHandler(c,((_,u)=>m(_,u.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:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeApi=void 0,s.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(L,s,c){var m=this&&this.__decorate||function(a,f,d,h){var C,D=arguments.length,x=D<3?f:h===null?h=Object.getOwnPropertyDescriptor(f,d):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(a,f,d,h);else for(var M=a.length-1;M>=0;M--)(C=a[M])&&(x=(D<3?C(x):D>3?C(f,d,x):C(f,d))||x);return D>3&&x&&Object.defineProperty(f,d,x),x},_=this&&this.__param||function(a,f){return function(d,h){f(d,h,a)}};Object.defineProperty(s,"__esModule",{value:!0}),s.BufferService=s.MINIMUM_ROWS=s.MINIMUM_COLS=void 0;const u=c(8460),y=c(844),S=c(5295),E=c(2585);s.MINIMUM_COLS=2,s.MINIMUM_ROWS=1;let g=s.BufferService=class extends y.Disposable{get buffer(){return this.buffers.active}constructor(a){super(),this.isUserScrolling=!1,this._onResize=this.register(new u.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new u.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(a.rawOptions.cols||0,s.MINIMUM_COLS),this.rows=Math.max(a.rawOptions.rows||0,s.MINIMUM_ROWS),this.buffers=this.register(new S.BufferSet(a,this))}resize(a,f){this.cols=a,this.rows=f,this.buffers.resize(a,f),this._onResize.fire({cols:a,rows:f})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(a,f=!1){const d=this.buffer;let h;h=this._cachedBlankLine,h&&h.length===this.cols&&h.getFg(0)===a.fg&&h.getBg(0)===a.bg||(h=d.getBlankLine(a,f),this._cachedBlankLine=h),h.isWrapped=f;const C=d.ybase+d.scrollTop,D=d.ybase+d.scrollBottom;if(d.scrollTop===0){const x=d.lines.isFull;D===d.lines.length-1?x?d.lines.recycle().copyFrom(h):d.lines.push(h.clone()):d.lines.splice(D+1,0,h.clone()),x?this.isUserScrolling&&(d.ydisp=Math.max(d.ydisp-1,0)):(d.ybase++,this.isUserScrolling||d.ydisp++)}else{const x=D-C+1;d.lines.shiftElements(C+1,x-1,-1),d.lines.set(D,h.clone())}this.isUserScrolling||(d.ydisp=d.ybase),this._onScroll.fire(d.ydisp)}scrollLines(a,f,d){const h=this.buffer;if(a<0){if(h.ydisp===0)return;this.isUserScrolling=!0}else a+h.ydisp>=h.ybase&&(this.isUserScrolling=!1);const C=h.ydisp;h.ydisp=Math.max(Math.min(h.ydisp+a,h.ybase),0),C!==h.ydisp&&(f||this._onScroll.fire(h.ydisp))}};s.BufferService=g=m([_(0,E.IOptionsService)],g)},7994:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CharsetService=void 0,s.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(L,s,c){var m=this&&this.__decorate||function(h,C,D,x){var M,b=arguments.length,T=b<3?C:x===null?x=Object.getOwnPropertyDescriptor(C,D):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(h,C,D,x);else for(var N=h.length-1;N>=0;N--)(M=h[N])&&(T=(b<3?M(T):b>3?M(C,D,T):M(C,D))||T);return b>3&&T&&Object.defineProperty(C,D,T),T},_=this&&this.__param||function(h,C){return function(D,x){C(D,x,h)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CoreMouseService=void 0;const u=c(2585),y=c(8460),S=c(844),E={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:h=>h.button!==4&&h.action===1&&(h.ctrl=!1,h.alt=!1,h.shift=!1,!0)},VT200:{events:19,restrict:h=>h.action!==32},DRAG:{events:23,restrict:h=>h.action!==32||h.button!==3},ANY:{events:31,restrict:h=>!0}};function g(h,C){let D=(h.ctrl?16:0)|(h.shift?4:0)|(h.alt?8:0);return h.button===4?(D|=64,D|=h.action):(D|=3&h.button,4&h.button&&(D|=64),8&h.button&&(D|=128),h.action===32?D|=32:h.action!==0||C||(D|=3)),D}const a=String.fromCharCode,f={DEFAULT:h=>{const C=[g(h,!1)+32,h.col+32,h.row+32];return C[0]>255||C[1]>255||C[2]>255?"":`\x1B[M${a(C[0])}${a(C[1])}${a(C[2])}`},SGR:h=>{const C=h.action===0&&h.button!==4?"m":"M";return`\x1B[<${g(h,!0)};${h.col};${h.row}${C}`},SGR_PIXELS:h=>{const C=h.action===0&&h.button!==4?"m":"M";return`\x1B[<${g(h,!0)};${h.x};${h.y}${C}`}};let d=s.CoreMouseService=class extends S.Disposable{constructor(h,C){super(),this._bufferService=h,this._coreService=C,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new y.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const D of Object.keys(E))this.addProtocol(D,E[D]);for(const D of Object.keys(f))this.addEncoding(D,f[D]);this.reset()}addProtocol(h,C){this._protocols[h]=C}addEncoding(h,C){this._encodings[h]=C}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(h){if(!this._protocols[h])throw new Error(`unknown protocol "${h}"`);this._activeProtocol=h,this._onProtocolChange.fire(this._protocols[h].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(h){if(!this._encodings[h])throw new Error(`unknown encoding "${h}"`);this._activeEncoding=h}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(h){if(h.col<0||h.col>=this._bufferService.cols||h.row<0||h.row>=this._bufferService.rows||h.button===4&&h.action===32||h.button===3&&h.action!==32||h.button!==4&&(h.action===2||h.action===3)||(h.col++,h.row++,h.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,h,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(h))return!1;const C=this._encodings[this._activeEncoding](h);return C&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(C):this._coreService.triggerDataEvent(C,!0)),this._lastEvent=h,!0}explainEvents(h){return{down:!!(1&h),up:!!(2&h),drag:!!(4&h),move:!!(8&h),wheel:!!(16&h)}}_equalEvents(h,C,D){if(D){if(h.x!==C.x||h.y!==C.y)return!1}else if(h.col!==C.col||h.row!==C.row)return!1;return h.button===C.button&&h.action===C.action&&h.ctrl===C.ctrl&&h.alt===C.alt&&h.shift===C.shift}};s.CoreMouseService=d=m([_(0,u.IBufferService),_(1,u.ICoreService)],d)},6975:function(L,s,c){var m=this&&this.__decorate||function(d,h,C,D){var x,M=arguments.length,b=M<3?h:D===null?D=Object.getOwnPropertyDescriptor(h,C):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(d,h,C,D);else for(var T=d.length-1;T>=0;T--)(x=d[T])&&(b=(M<3?x(b):M>3?x(h,C,b):x(h,C))||b);return M>3&&b&&Object.defineProperty(h,C,b),b},_=this&&this.__param||function(d,h){return function(C,D){h(C,D,d)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CoreService=void 0;const u=c(1439),y=c(8460),S=c(844),E=c(2585),g=Object.freeze({insertMode:!1}),a=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let f=s.CoreService=class extends S.Disposable{constructor(d,h,C){super(),this._bufferService=d,this._logService=h,this._optionsService=C,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new y.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new y.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new y.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new y.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,u.clone)(g),this.decPrivateModes=(0,u.clone)(a)}reset(){this.modes=(0,u.clone)(g),this.decPrivateModes=(0,u.clone)(a)}triggerDataEvent(d,h=!1){if(this._optionsService.rawOptions.disableStdin)return;const C=this._bufferService.buffer;h&&this._optionsService.rawOptions.scrollOnUserInput&&C.ybase!==C.ydisp&&this._onRequestScrollToBottom.fire(),h&&this._onUserInput.fire(),this._logService.debug(`sending data "${d}"`,(()=>d.split("").map((D=>D.charCodeAt(0))))),this._onData.fire(d)}triggerBinaryEvent(d){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${d}"`,(()=>d.split("").map((h=>h.charCodeAt(0))))),this._onBinary.fire(d))}};s.CoreService=f=m([_(0,E.IBufferService),_(1,E.ILogService),_(2,E.IOptionsService)],f)},9074:(L,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DecorationService=void 0;const m=c(8055),_=c(8460),u=c(844),y=c(6106);let S=0,E=0;class g extends u.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new y.SortedList((d=>d==null?void 0:d.marker.line)),this._onDecorationRegistered=this.register(new _.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new _.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,u.toDisposable)((()=>this.reset())))}registerDecoration(d){if(d.marker.isDisposed)return;const h=new a(d);if(h){const C=h.marker.onDispose((()=>h.dispose()));h.onDispose((()=>{h&&(this._decorations.delete(h)&&this._onDecorationRemoved.fire(h),C.dispose())})),this._decorations.insert(h),this._onDecorationRegistered.fire(h)}return h}reset(){for(const d of this._decorations.values())d.dispose();this._decorations.clear()}*getDecorationsAtCell(d,h,C){let D=0,x=0;for(const M of this._decorations.getKeyIterator(h))D=M.options.x??0,x=D+(M.options.width??1),d>=D&&d<x&&(!C||(M.options.layer??"bottom")===C)&&(yield M)}forEachDecorationAtCell(d,h,C,D){this._decorations.forEachByKey(h,(x=>{S=x.options.x??0,E=S+(x.options.width??1),d>=S&&d<E&&(!C||(x.options.layer??"bottom")===C)&&D(x)}))}}s.DecorationService=g;class a extends u.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(d){super(),this.options=d,this.onRenderEmitter=this.register(new _.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new _.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=d.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(L,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.InstantiationService=s.ServiceCollection=void 0;const m=c(2585),_=c(8343);class u{constructor(...S){this._entries=new Map;for(const[E,g]of S)this.set(E,g)}set(S,E){const g=this._entries.get(S);return this._entries.set(S,E),g}forEach(S){for(const[E,g]of this._entries.entries())S(E,g)}has(S){return this._entries.has(S)}get(S){return this._entries.get(S)}}s.ServiceCollection=u,s.InstantiationService=class{constructor(){this._services=new u,this._services.set(m.IInstantiationService,this)}setService(y,S){this._services.set(y,S)}getService(y){return this._services.get(y)}createInstance(y,...S){const E=(0,_.getServiceDependencies)(y).sort(((f,d)=>f.index-d.index)),g=[];for(const f of E){const d=this._services.get(f.id);if(!d)throw new Error(`[createInstance] ${y.name} depends on UNKNOWN service ${f.id}.`);g.push(d)}const a=E.length>0?E[0].index:S.length;if(S.length!==a)throw new Error(`[createInstance] First service dependency of ${y.name} at position ${a+1} conflicts with ${S.length} static arguments`);return new y(...S,...g)}}},7866:function(L,s,c){var m=this&&this.__decorate||function(a,f,d,h){var C,D=arguments.length,x=D<3?f:h===null?h=Object.getOwnPropertyDescriptor(f,d):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(a,f,d,h);else for(var M=a.length-1;M>=0;M--)(C=a[M])&&(x=(D<3?C(x):D>3?C(f,d,x):C(f,d))||x);return D>3&&x&&Object.defineProperty(f,d,x),x},_=this&&this.__param||function(a,f){return function(d,h){f(d,h,a)}};Object.defineProperty(s,"__esModule",{value:!0}),s.traceCall=s.setTraceLogger=s.LogService=void 0;const u=c(844),y=c(2585),S={trace:y.LogLevelEnum.TRACE,debug:y.LogLevelEnum.DEBUG,info:y.LogLevelEnum.INFO,warn:y.LogLevelEnum.WARN,error:y.LogLevelEnum.ERROR,off:y.LogLevelEnum.OFF};let E,g=s.LogService=class extends u.Disposable{get logLevel(){return this._logLevel}constructor(a){super(),this._optionsService=a,this._logLevel=y.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),E=this}_updateLogLevel(){this._logLevel=S[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(a){for(let f=0;f<a.length;f++)typeof a[f]=="function"&&(a[f]=a[f]())}_log(a,f,d){this._evalLazyOptionalParams(d),a.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+f,...d)}trace(a,...f){var d;this._logLevel<=y.LogLevelEnum.TRACE&&this._log(((d=this._optionsService.options.logger)==null?void 0:d.trace.bind(this._optionsService.options.logger))??console.log,a,f)}debug(a,...f){var d;this._logLevel<=y.LogLevelEnum.DEBUG&&this._log(((d=this._optionsService.options.logger)==null?void 0:d.debug.bind(this._optionsService.options.logger))??console.log,a,f)}info(a,...f){var d;this._logLevel<=y.LogLevelEnum.INFO&&this._log(((d=this._optionsService.options.logger)==null?void 0:d.info.bind(this._optionsService.options.logger))??console.info,a,f)}warn(a,...f){var d;this._logLevel<=y.LogLevelEnum.WARN&&this._log(((d=this._optionsService.options.logger)==null?void 0:d.warn.bind(this._optionsService.options.logger))??console.warn,a,f)}error(a,...f){var d;this._logLevel<=y.LogLevelEnum.ERROR&&this._log(((d=this._optionsService.options.logger)==null?void 0:d.error.bind(this._optionsService.options.logger))??console.error,a,f)}};s.LogService=g=m([_(0,y.IOptionsService)],g),s.setTraceLogger=function(a){E=a},s.traceCall=function(a,f,d){if(typeof d.value!="function")throw new Error("not supported");const h=d.value;d.value=function(...C){if(E.logLevel!==y.LogLevelEnum.TRACE)return h.apply(this,C);E.trace(`GlyphRenderer#${h.name}(${C.map((x=>JSON.stringify(x))).join(", ")})`);const D=h.apply(this,C);return E.trace(`GlyphRenderer#${h.name} return`,D),D}}},7302:(L,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.OptionsService=s.DEFAULT_OPTIONS=void 0;const m=c(8460),_=c(844),u=c(6114);s.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:u.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const y=["normal","bold","100","200","300","400","500","600","700","800","900"];class S extends _.Disposable{constructor(g){super(),this._onOptionChange=this.register(new m.EventEmitter),this.onOptionChange=this._onOptionChange.event;const a={...s.DEFAULT_OPTIONS};for(const f in g)if(f in a)try{const d=g[f];a[f]=this._sanitizeAndValidateOption(f,d)}catch(d){console.error(d)}this.rawOptions=a,this.options={...a},this._setupOptions(),this.register((0,_.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(g,a){return this.onOptionChange((f=>{f===g&&a(this.rawOptions[g])}))}onMultipleOptionChange(g,a){return this.onOptionChange((f=>{g.indexOf(f)!==-1&&a()}))}_setupOptions(){const g=f=>{if(!(f in s.DEFAULT_OPTIONS))throw new Error(`No option with key "${f}"`);return this.rawOptions[f]},a=(f,d)=>{if(!(f in s.DEFAULT_OPTIONS))throw new Error(`No option with key "${f}"`);d=this._sanitizeAndValidateOption(f,d),this.rawOptions[f]!==d&&(this.rawOptions[f]=d,this._onOptionChange.fire(f))};for(const f in this.rawOptions){const d={get:g.bind(this,f),set:a.bind(this,f)};Object.defineProperty(this.options,f,d)}}_sanitizeAndValidateOption(g,a){switch(g){case"cursorStyle":if(a||(a=s.DEFAULT_OPTIONS[g]),!(function(f){return f==="block"||f==="underline"||f==="bar"})(a))throw new Error(`"${a}" is not a valid value for ${g}`);break;case"wordSeparator":a||(a=s.DEFAULT_OPTIONS[g]);break;case"fontWeight":case"fontWeightBold":if(typeof a=="number"&&1<=a&&a<=1e3)break;a=y.includes(a)?a:s.DEFAULT_OPTIONS[g];break;case"cursorWidth":a=Math.floor(a);case"lineHeight":case"tabStopWidth":if(a<1)throw new Error(`${g} cannot be less than 1, value: ${a}`);break;case"minimumContrastRatio":a=Math.max(1,Math.min(21,Math.round(10*a)/10));break;case"scrollback":if((a=Math.min(a,4294967295))<0)throw new Error(`${g} cannot be less than 0, value: ${a}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(a<=0)throw new Error(`${g} cannot be less than or equal to 0, value: ${a}`);break;case"rows":case"cols":if(!a&&a!==0)throw new Error(`${g} must be numeric, value: ${a}`);break;case"windowsPty":a=a??{}}return a}}s.OptionsService=S},2660:function(L,s,c){var m=this&&this.__decorate||function(S,E,g,a){var f,d=arguments.length,h=d<3?E:a===null?a=Object.getOwnPropertyDescriptor(E,g):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")h=Reflect.decorate(S,E,g,a);else for(var C=S.length-1;C>=0;C--)(f=S[C])&&(h=(d<3?f(h):d>3?f(E,g,h):f(E,g))||h);return d>3&&h&&Object.defineProperty(E,g,h),h},_=this&&this.__param||function(S,E){return function(g,a){E(g,a,S)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OscLinkService=void 0;const u=c(2585);let y=s.OscLinkService=class{constructor(S){this._bufferService=S,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(S){const E=this._bufferService.buffer;if(S.id===void 0){const C=E.addMarker(E.ybase+E.y),D={data:S,id:this._nextId++,lines:[C]};return C.onDispose((()=>this._removeMarkerFromLink(D,C))),this._dataByLinkId.set(D.id,D),D.id}const g=S,a=this._getEntryIdKey(g),f=this._entriesWithId.get(a);if(f)return this.addLineToLink(f.id,E.ybase+E.y),f.id;const d=E.addMarker(E.ybase+E.y),h={id:this._nextId++,key:this._getEntryIdKey(g),data:g,lines:[d]};return d.onDispose((()=>this._removeMarkerFromLink(h,d))),this._entriesWithId.set(h.key,h),this._dataByLinkId.set(h.id,h),h.id}addLineToLink(S,E){const g=this._dataByLinkId.get(S);if(g&&g.lines.every((a=>a.line!==E))){const a=this._bufferService.buffer.addMarker(E);g.lines.push(a),a.onDispose((()=>this._removeMarkerFromLink(g,a)))}}getLinkData(S){var E;return(E=this._dataByLinkId.get(S))==null?void 0:E.data}_getEntryIdKey(S){return`${S.id};;${S.uri}`}_removeMarkerFromLink(S,E){const g=S.lines.indexOf(E);g!==-1&&(S.lines.splice(g,1),S.lines.length===0&&(S.data.id!==void 0&&this._entriesWithId.delete(S.key),this._dataByLinkId.delete(S.id)))}};s.OscLinkService=y=m([_(0,u.IBufferService)],y)},8343:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.createDecorator=s.getServiceDependencies=s.serviceRegistry=void 0;const c="di$target",m="di$dependencies";s.serviceRegistry=new Map,s.getServiceDependencies=function(_){return _[m]||[]},s.createDecorator=function(_){if(s.serviceRegistry.has(_))return s.serviceRegistry.get(_);const u=function(y,S,E){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(g,a,f){a[c]===a?a[m].push({id:g,index:f}):(a[m]=[{id:g,index:f}],a[c]=a)})(u,y,E)};return u.toString=()=>_,s.serviceRegistry.set(_,u),u}},2585:(L,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.IDecorationService=s.IUnicodeService=s.IOscLinkService=s.IOptionsService=s.ILogService=s.LogLevelEnum=s.IInstantiationService=s.ICharsetService=s.ICoreService=s.ICoreMouseService=s.IBufferService=void 0;const m=c(8343);var _;s.IBufferService=(0,m.createDecorator)("BufferService"),s.ICoreMouseService=(0,m.createDecorator)("CoreMouseService"),s.ICoreService=(0,m.createDecorator)("CoreService"),s.ICharsetService=(0,m.createDecorator)("CharsetService"),s.IInstantiationService=(0,m.createDecorator)("InstantiationService"),(function(u){u[u.TRACE=0]="TRACE",u[u.DEBUG=1]="DEBUG",u[u.INFO=2]="INFO",u[u.WARN=3]="WARN",u[u.ERROR=4]="ERROR",u[u.OFF=5]="OFF"})(_||(s.LogLevelEnum=_={})),s.ILogService=(0,m.createDecorator)("LogService"),s.IOptionsService=(0,m.createDecorator)("OptionsService"),s.IOscLinkService=(0,m.createDecorator)("OscLinkService"),s.IUnicodeService=(0,m.createDecorator)("UnicodeService"),s.IDecorationService=(0,m.createDecorator)("DecorationService")},1480:(L,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeService=void 0;const m=c(8460),_=c(225);class u{static extractShouldJoin(S){return(1&S)!=0}static extractWidth(S){return S>>1&3}static extractCharKind(S){return S>>3}static createPropertyValue(S,E,g=!1){return(16777215&S)<<3|(3&E)<<1|(g?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new m.EventEmitter,this.onChange=this._onChange.event;const S=new _.UnicodeV6;this.register(S),this._active=S.version,this._activeProvider=S}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(S){if(!this._providers[S])throw new Error(`unknown Unicode version "${S}"`);this._active=S,this._activeProvider=this._providers[S],this._onChange.fire(S)}register(S){this._providers[S.version]=S}wcwidth(S){return this._activeProvider.wcwidth(S)}getStringCellWidth(S){let E=0,g=0;const a=S.length;for(let f=0;f<a;++f){let d=S.charCodeAt(f);if(55296<=d&&d<=56319){if(++f>=a)return E+this.wcwidth(d);const D=S.charCodeAt(f);56320<=D&&D<=57343?d=1024*(d-55296)+D-56320+65536:E+=this.wcwidth(D)}const h=this.charProperties(d,g);let C=u.extractWidth(h);u.extractShouldJoin(h)&&(C-=u.extractWidth(g)),E+=C,g=h}return E}charProperties(S,E){return this._activeProvider.charProperties(S,E)}}s.UnicodeService=u}},p={};function w(L){var s=p[L];if(s!==void 0)return s.exports;var c=p[L]={exports:{}};return o[L].call(c.exports,c,c.exports,w),c.exports}var A={};return(()=>{var L=A;Object.defineProperty(L,"__esModule",{value:!0}),L.Terminal=void 0;const s=w(9042),c=w(3236),m=w(844),_=w(5741),u=w(8285),y=w(7975),S=w(7090),E=["cols","rows"];class g extends m.Disposable{constructor(f){super(),this._core=this.register(new c.Terminal(f)),this._addonManager=this.register(new _.AddonManager),this._publicOptions={...this._core.options};const d=C=>this._core.options[C],h=(C,D)=>{this._checkReadonlyOptions(C),this._core.options[C]=D};for(const C in this._core.options){const D={get:d.bind(this,C),set:h.bind(this,C)};Object.defineProperty(this._publicOptions,C,D)}}_checkReadonlyOptions(f){if(E.includes(f))throw new Error(`Option "${f}" 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 y.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new S.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 u.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const f=this._core.coreService.decPrivateModes;let d="none";switch(this._core.coreMouseService.activeProtocol){case"X10":d="x10";break;case"VT200":d="vt200";break;case"DRAG":d="drag";break;case"ANY":d="any"}return{applicationCursorKeysMode:f.applicationCursorKeys,applicationKeypadMode:f.applicationKeypad,bracketedPasteMode:f.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:d,originMode:f.origin,reverseWraparoundMode:f.reverseWraparound,sendFocusMode:f.sendFocus,wraparoundMode:f.wraparound}}get options(){return this._publicOptions}set options(f){for(const d in f)this._publicOptions[d]=f[d]}blur(){this._core.blur()}focus(){this._core.focus()}input(f,d=!0){this._core.input(f,d)}resize(f,d){this._verifyIntegers(f,d),this._core.resize(f,d)}open(f){this._core.open(f)}attachCustomKeyEventHandler(f){this._core.attachCustomKeyEventHandler(f)}attachCustomWheelEventHandler(f){this._core.attachCustomWheelEventHandler(f)}registerLinkProvider(f){return this._core.registerLinkProvider(f)}registerCharacterJoiner(f){return this._checkProposedApi(),this._core.registerCharacterJoiner(f)}deregisterCharacterJoiner(f){this._checkProposedApi(),this._core.deregisterCharacterJoiner(f)}registerMarker(f=0){return this._verifyIntegers(f),this._core.registerMarker(f)}registerDecoration(f){return this._checkProposedApi(),this._verifyPositiveIntegers(f.x??0,f.width??0,f.height??0),this._core.registerDecoration(f)}hasSelection(){return this._core.hasSelection()}select(f,d,h){this._verifyIntegers(f,d,h),this._core.select(f,d,h)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(f,d){this._verifyIntegers(f,d),this._core.selectLines(f,d)}dispose(){super.dispose()}scrollLines(f){this._verifyIntegers(f),this._core.scrollLines(f)}scrollPages(f){this._verifyIntegers(f),this._core.scrollPages(f)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(f){this._verifyIntegers(f),this._core.scrollToLine(f)}clear(){this._core.clear()}write(f,d){this._core.write(f,d)}writeln(f,d){this._core.write(f),this._core.write(`\r
116
- `,d)}paste(f){this._core.paste(f)}refresh(f,d){this._verifyIntegers(f,d),this._core.refresh(f,d)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(f){this._addonManager.loadAddon(this,f)}static get strings(){return s}_verifyIntegers(...f){for(const d of f)if(d===1/0||isNaN(d)||d%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...f){for(const d of f)if(d&&(d===1/0||isNaN(d)||d%1!=0||d<0))throw new Error("This API only accepts positive integers")}}L.Terminal=g})(),A})()))})(hc)),hc.exports}var Xw=Yw();function Qw(n){return n.toLowerCase().startsWith("win")}function Jw(n){return n.keyCode===86&&n.ctrlKey&&!n.shiftKey&&!n.altKey&&!n.metaKey}const Zw=8,e1=100,t1=80,tf=6,nf=.02,n1=.95,r1=50;function s1(n,r){return Math.hypot(n,r)>Zw}function i1(n,r){const o=n[n.length-1];if(o===void 0||r-o.t>t1)return 0;const p=n.filter(L=>o.t-L.t<=e1),w=p[0];if(w===void 0||p.length<2||o.t===w.t)return 0;const A=(w.y-o.y)/(o.t-w.t);return Math.max(-tf,Math.min(tf,A))}function o1(n,r){if(Math.abs(n)<nf)return{delta:0,velocity:0};const o=Math.max(0,Math.min(r1,r)),p=n*n1**(o/16);return{delta:n*o,velocity:Math.abs(p)<nf?0:p}}function a1(n){const r=Math.trunc(n);return{pixels:r,rest:n-r}}const l1=60;function c1(){return new URLSearchParams(window.location.search).get("renderer")==="webgl"?"webgl":"canvas"}const rf={dark:{background:"#12141a",foreground:"#d8dee9",cursor:"#d8dee9",selectionBackground:"#2f3542"},light:{background:"#fbfbfd",foreground:"#22262e",cursor:"#22262e",selectionBackground:"#cfd8e3"}};function Xp({terminalId:n,connection:r,active:o,theme:p,autoFocus:w=!0,pasteOnCtrlV:A=!1}){const L=O.useRef(null),s=O.useRef(null),c=O.useRef(null),m=O.useRef(p);return m.current=p,O.useEffect(()=>{const _=L.current;if(_===null)return;const u=new Xw.Terminal({convertEol:!1,cursorBlink:!0,fontFamily:'"Cascadia Mono", "Consolas", "Menlo", "DejaVu Sans Mono", monospace',fontSize:14,lineHeight:1.2,scrollback:1e4,allowProposedApi:!0,theme:rf[m.current]});s.current=u;const y=new zw.FitAddon;c.current=y,u.loadAddon(y),u.loadAddon(new qw.WebLinksAddon),u.open(_);let S=!1;const E=()=>{if(!(S||c1()!=="webgl")){S=!0;try{const J=new Gw.WebglAddon;J.onContextLoss(()=>J.dispose()),u.loadAddon(J)}catch{console.info("[terminal] WebGL no disponible; se usa el renderer por defecto.")}}};let g={cols:0,rows:0},a;const f=()=>_.clientWidth>0&&_.clientHeight>0,d=J=>{const{cols:Z,rows:de}=u;Z<=0||de<=0||!J&&Z===g.cols&&de===g.rows||(g={cols:Z,rows:de},r.send({type:"resize",terminalId:n,cols:Z,rows:de}))};let h={atBottom:!0,line:0},C=!1;const D=()=>{if(C||!f())return;const J=u.buffer.active;h={atBottom:J.viewportY>=J.baseY,line:J.viewportY}},x=()=>{const J=u.buffer.active;if(J.baseY===0)return;const Z=h.atBottom?J.baseY:Math.min(h.line,J.baseY);u.scrollToLine(Z>0?Z-1:Z+1),u.scrollToLine(Z)},M=u.onRender(D),b=u.onScroll(D);let T=f();const N=()=>{if(f()){try{y.fit()}catch{return}C&&(x(),C=!1),u.cols>0&&u.rows>0&&E(),d(!1)}},F=()=>{window.clearTimeout(a),a=window.setTimeout(N,l1)},P=new ResizeObserver(()=>{const J=f();C=!0,J&&!T&&x(),T=J,F()});P.observe(_),window.addEventListener("resize",F);let B=null,H=0,q=0;const X=(J,Z,de)=>{const ee=u.element;if(ee===void 0)return;const xe=a1(q+J);q=xe.rest,xe.pixels!==0&&ee.dispatchEvent(new WheelEvent("wheel",{deltaY:xe.pixels,deltaMode:WheelEvent.DOM_DELTA_PIXEL,clientX:Z,clientY:de,bubbles:!0,cancelable:!0}))},G=()=>{window.cancelAnimationFrame(H),H=0},Y=(J,Z,de)=>{let ee=J,xe=performance.now();const ke=le=>{if(!f()){H=0;return}const we=o1(ee,le-xe);xe=le,X(we.delta,Z,de),ee=we.velocity,H=ee===0?0:window.requestAnimationFrame(ke)};H=window.requestAnimationFrame(ke)},j=(J,Z)=>{for(let de=0;de<J.length;de++){const ee=J.item(de);if(ee!==null&&ee.identifier===Z)return ee}return null},U=J=>{G(),q=0;const Z=J.touches.length===1?J.touches.item(0):null;B=Z===null?null:{id:Z.identifier,startX:Z.clientX,startY:Z.clientY,lastX:Z.clientX,lastY:Z.clientY,moving:!1,samples:[{t:J.timeStamp,y:Z.clientY}]}},$=J=>{if(J.stopPropagation(),B===null)return;const Z=j(J.touches,B.id);if(Z===null)return;if(!B.moving){if(!s1(Z.clientX-B.startX,Z.clientY-B.startY))return;B.moving=!0}J.cancelable&&J.preventDefault();const de=B.lastY-Z.clientY;B.lastX=Z.clientX,B.lastY=Z.clientY,B.samples.push({t:J.timeStamp,y:Z.clientY}),B.samples.length>32&&B.samples.shift(),X(de,Z.clientX,Z.clientY)},V=J=>{if(B===null||j(J.changedTouches,B.id)===null)return;const Z=B;if(B=null,!Z.moving)return;const de=i1(Z.samples,J.timeStamp);de!==0&&Y(de,Z.lastX,Z.lastY)},ne=()=>{B=null};_.addEventListener("touchstart",U,{capture:!0,passive:!0}),_.addEventListener("touchmove",$,{capture:!0,passive:!1}),_.addEventListener("touchend",V,{capture:!0,passive:!0}),_.addEventListener("touchcancel",ne,{capture:!0,passive:!0});const se=()=>{if(!(document.visibilityState!=="visible"||!f())){try{y.fit()}catch{return}d(!0)}};window.addEventListener("focus",se),document.addEventListener("visibilitychange",se),A&&u.attachCustomKeyEventHandler(J=>!Jw(J));const ce=u.onData(J=>{r.send({type:"input",terminalId:n,data:J})}),he=r.onMessage(J=>{switch(J.type){case"terminal.output":J.terminalId===n&&u.write(J.data);break;case"terminal.replay":if(J.terminalId!==n)break;u.reset(),J.truncated&&u.write(`\x1B[90m-- ${k("terminal.replayTruncated")} --\x1B[0m\r
117
- `),u.write(J.data);break;case"terminal.exit":if(J.terminalId!==n)break;u.write(`\r
118
- \x1B[90m-- ${k("terminal.exited",{code:J.exitCode})} --\x1B[0m\r
119
- `);break}}),K=()=>{if(f())try{y.fit()}catch{}const J=u.cols>0?u.cols:80,Z=u.rows>0?u.rows:24;g={cols:J,rows:Z},r.send({type:"terminal.attach",terminalId:n,cols:J,rows:Z})};K();const W=r.onReopen(K);return()=>{window.clearTimeout(a),window.removeEventListener("resize",F),window.removeEventListener("focus",se),document.removeEventListener("visibilitychange",se),P.disconnect(),G(),_.removeEventListener("touchstart",U,{capture:!0}),_.removeEventListener("touchmove",$,{capture:!0}),_.removeEventListener("touchend",V,{capture:!0}),_.removeEventListener("touchcancel",ne,{capture:!0}),M.dispose(),b.dispose(),ce.dispose(),he(),W(),r.send({type:"terminal.detach",terminalId:n}),u.dispose(),s.current=null,c.current=null}},[n,r,A]),O.useEffect(()=>{const _=s.current;_!==null&&(_.options.theme=rf[p])},[p]),O.useEffect(()=>{if(!o)return;const _=s.current,u=c.current;if(_===null||u===null)return;const y=window.setTimeout(()=>{const S=L.current;if(!(S===null||S.clientWidth===0||S.clientHeight===0)){try{u.fit()}catch{return}w&&_.focus(),_.cols>0&&_.rows>0&&r.send({type:"resize",terminalId:n,cols:_.cols,rows:_.rows})}},0);return()=>window.clearTimeout(y)},[o,w,n,r]),l.jsx("div",{className:`terminal-surface${o?"":" terminal-surface-hidden"}`,ref:L})}const u1=typeof navigator<"u"&&Qw(navigator.platform);function h1({connection:n,shells:r,activeShellId:o,cwd:p,shellName:w,theme:A,onSelect:L,onOpen:s,onCloseShell:c,onCollapse:m}){const _=w??k("console.name"),u=r.find(y=>y.terminalId===o)??r[0]??null;return l.jsxs("section",{className:"console-pane",children:[l.jsxs("header",{className:"console-header",children:[l.jsxs("div",{className:"strip-tabs",children:[r.map((y,S)=>l.jsxs("div",{className:`strip-tab${y.terminalId===(u==null?void 0:u.terminalId)?" is-active":""}${y.alive?"":" is-dead"}`,children:[l.jsx("button",{className:"strip-tab-label",onClick:()=>L(y.terminalId),title:y.alive?k("console.tab.title",{shell:_,number:S+1,cwd:p}):k("console.tab.exited",{code:y.exitCode??"?"}),children:k("console.tab.label",{number:S+1})}),l.jsx("button",{className:"strip-tab-close",onClick:()=>c(y.terminalId),title:k("console.tab.close"),children:"×"})]},y.terminalId)),w!==null&&l.jsx("button",{className:"strip-tab-new",onClick:s,title:k("console.openAnother",{shell:_,cwd:p}),children:"+"})]}),l.jsx("span",{className:"strip-spacer"}),l.jsx("button",{className:"icon-button",onClick:m,title:k("console.collapse"),children:"▾"})]}),l.jsx("div",{className:"console-body",children:r.length===0?l.jsx("div",{className:"console-empty",children:w===null?l.jsx("p",{className:"panel-note",children:k("console.noShell")}):l.jsx("button",{className:"link-button",onClick:s,children:k("console.openIn",{shell:_,cwd:p})})}):l.jsx("div",{className:"terminal-stack",children:r.map(y=>l.jsx(Xp,{terminalId:y.terminalId,connection:n,active:y.terminalId===(u==null?void 0:u.terminalId),theme:A,pasteOnCtrlV:u1},y.terminalId))})})]})}const d1=.75,f1=.9;function Rn(n){if(n<1e3)return String(n);if(n<1e6){const r=n/1e3;return`${r<100?Hs(r,1):Math.round(r)}k`}return`${Hs(n/1e6,2)}M`}function p1({usage:n,source:r,instructionsFile:o,fallbackWindow:p=null,compact:w=!1,statusLineState:A=null,onConfigure:L}){const{lastRequestTokens:s,contextWindow:c}=n;if(L!==void 0&&A!==null&&G0(r,{state:A}))return l.jsxs("div",{className:`meter meter-idle${w?" meter-compact":""}`,title:Y0(A),children:[l.jsx("span",{className:"meter-label",children:k("meter.label")}),l.jsx("span",{className:`meter-bar${w?" meter-bar-inline":""}`}),l.jsx("span",{className:"meter-value",children:k("meter.unmeasured")}),l.jsx("button",{className:"link-button",onClick:L,children:k("meter.configure")})]});if(r===null)return l.jsxs("div",{className:`meter meter-idle${w?" meter-compact":""}`,title:k("meter.noTokensTitle"),children:[l.jsx("span",{className:"meter-label",children:k("meter.label")}),l.jsx("span",{className:`meter-bar${w?" meter-bar-inline":""}`}),l.jsx("span",{className:"meter-value",children:k("meter.noTokens")})]});if(!K0(r,n)){const S=Q0(o,r),E=q0(r,n,p);return l.jsxs("div",{className:`meter meter-idle${w?" meter-compact":""}`,title:S,children:[l.jsx("span",{className:"meter-label",children:k("meter.label")}),l.jsx("span",{className:`meter-bar${w?" meter-bar-inline":""}`}),l.jsxs("span",{className:"meter-value",children:[k("meter.unmeasured"),E!==null&&l.jsxs("span",{className:"meter-dim",children:[" / ",Rn(E)]})]})]})}const m=c!==null&&c>0?Math.min(s/c,1):null,_=m===null?"unknown":m>=f1?"danger":m>=d1?"warn":"ok",u=c===null?"":` / ${Rn(c)}${n.contextWindowEstimated?"+":""}`,y=X0(r,n);if(w){const S=[n.lastModel===null?null:n.lastModel,y,m===null?k("meter.unknownModelShort"):k("meter.windowPercent",{percent:Math.round(m*100)}),k("meter.output",{tokens:Rn(n.lastOutputTokens)}),r==="status-line"?k("meter.responses",{count:n.assistantMessages}):k("meter.sessionTotals",{output:Rn(n.totalOutputTokens),cache:Rn(n.totalCacheReadTokens),count:n.assistantMessages})].filter(E=>E!==null).join(" · ");return l.jsxs("div",{className:"meter meter-compact",title:S,children:[l.jsx("span",{className:"meter-label",children:k("meter.label")}),m!==null&&l.jsx("span",{className:"meter-bar meter-bar-inline",children:l.jsx("span",{className:`meter-fill meter-fill-${_}`,style:{width:`${m*100}%`}})}),l.jsxs("span",{className:"meter-value",children:[Rn(s),u.length>0&&l.jsx("span",{className:"meter-dim",children:u})]})]})}return l.jsxs("div",{className:"meter",children:[l.jsxs("div",{className:"meter-row",children:[l.jsx("span",{className:"meter-label",children:k("meter.label")}),l.jsxs("span",{className:"meter-value",children:[Rn(s),c!==null&&l.jsxs("span",{className:"meter-dim",title:n.lastModel===null?void 0:y!==null?k("meter.modelWithOrigin",{model:n.lastModel,origin:y}):n.lastModel,children:[" ","/ ",Rn(c),n.contextWindowEstimated&&"+"]})]})]}),m!==null?l.jsx("div",{className:"meter-bar",title:k("meter.windowPercent",{percent:Math.round(m*100)}),children:l.jsx("div",{className:`meter-fill meter-fill-${_}`,style:{width:`${m*100}%`}})}):l.jsx("div",{className:"meter-note",title:n.lastModel??void 0,children:k("meter.unknownModel")}),l.jsxs("div",{className:"meter-row meter-row-dim",children:[l.jsx("span",{title:k("meter.lastResponseTitle"),children:k("meter.output",{tokens:Rn(n.lastOutputTokens)})}),l.jsx("span",{title:k("meter.sessionTitle"),children:k("meter.sessionTotals",{output:Rn(n.totalOutputTokens),cache:Rn(n.totalCacheReadTokens),count:n.assistantMessages})})]})]})}const dc=["s","m","l"],Qp="m",m1="agent-workbench.thread-font",g1="agent-workbench.notes-font",_1="s",v1={s:"threadFont.size.s",m:"threadFont.size.m",l:"threadFont.size.l"};function sf(n){return k(v1[n])}function Jp(n){const r=dc.indexOf(n);return dc[(r+1)%dc.length]??Qp}function y1(n){return n==="s"||n==="m"||n==="l"?n:null}function fa(n){return k("threadFont.title",{current:sf(n),next:sf(Jp(n))})}function Zp({agents:n,preselected:r,anchor:o,label:p=k("agentMenu.openWith"),onPick:w,onClose:A}){const L=O.useMemo(()=>Lp(n),[n]),[s,c]=O.useState(()=>ry(L,r)),[m,_]=O.useState(null),u=O.useRef(null),y=O.useRef([]);return O.useLayoutEffect(()=>{const S=u.current;if(S===null)return;const E=o.getBoundingClientRect(),g=S.getBoundingClientRect();_(iy({left:E.left,top:E.top,bottom:E.bottom},{width:g.width,height:g.height},{width:window.innerWidth,height:window.innerHeight}))},[o]),O.useEffect(()=>{var S;(S=y.current[s])==null||S.focus()},[s,m]),O.useEffect(()=>{const S=a=>{if(!(a.altKey||a.ctrlKey||a.metaKey)){if(a.key==="Escape"){a.preventDefault(),a.stopPropagation(),A(),o.focus();return}if(a.key==="ArrowDown"||a.key==="ArrowUp"){a.preventDefault(),a.stopPropagation(),c(f=>sy(f,a.key==="ArrowDown"?1:-1,L.length));return}if(a.key==="Enter"){a.preventDefault(),a.stopPropagation();const f=L[s];f!==void 0&&w(f.id);return}a.key==="Tab"&&A()}},E=a=>{var d;const f=a.target;f instanceof Node&&((d=u.current)!=null&&d.contains(f)||o.contains(f))||A()},g=a=>{oy(a.target,o,u.current)&&A()};return window.addEventListener("keydown",S,!0),document.addEventListener("pointerdown",E,!0),window.addEventListener("scroll",g,!0),window.addEventListener("resize",A),()=>{window.removeEventListener("keydown",S,!0),document.removeEventListener("pointerdown",E,!0),window.removeEventListener("scroll",g,!0),window.removeEventListener("resize",A)}},[s,o,L,A,w]),Op.createPortal(l.jsx("div",{ref:u,className:"agent-menu",role:"menu","aria-label":p,style:m===null?{left:0,top:0,visibility:"hidden"}:{left:`${m.left}px`,top:`${m.top}px`},children:L.map((S,E)=>l.jsxs("button",{ref:g=>{y.current[E]=g},className:`agent-menu-item${E===s?" agent-menu-item-active":""}`,role:"menuitem",tabIndex:E===s?0:-1,onMouseEnter:()=>c(E),onClick:()=>w(S.id),children:[l.jsx("span",{className:"agent-menu-label",children:S.label}),S.version!==null&&l.jsx("span",{className:"agent-menu-version",children:S.version})]},S.id))}),document.body)}function em({targets:n,className:r,text:o,blockedReason:p=null,onPick:w}){const[A,L]=O.useState(!1),s=O.useRef(null),c=O.useCallback(()=>L(!1),[]),m=O.useCallback(_=>{L(!1),w(_)},[w]);return n.length===0?null:l.jsxs(l.Fragment,{children:[l.jsx("button",{ref:s,className:r,onClick:()=>L(_=>!_),disabled:p!==null,"aria-haspopup":"menu","aria-expanded":A,title:p??ay(),children:o}),A&&s.current!==null&&l.jsx(Zp,{agents:n,preselected:null,anchor:s.current,label:k("continue.menuLabel"),onPick:m,onClose:c})]})}function tm(n){switch(n.notice){case"compacted":return n.detail==="auto"?k("thread.notice.compactedAuto"):k("thread.notice.compacted");case"interrupted":return k("thread.notice.interrupted");case"error":return n.detail.length>0?k("thread.notice.error",{detail:n.detail}):k("thread.notice.errorNoDetail")}}const nm="agent-workbench.locale",rm="auto";function w1(n){return n==="auto"||yp(n)?n:null}function sm(n){const r=n.trim().replace(/_/g,"-").toLowerCase();if(r.length===0)return null;const o=Kc.find(A=>A.toLowerCase()===r);if(o!==void 0)return o;const[p="",...w]=r.split("-");return p==="zh"?w.includes("hant")||w.some(L=>L==="tw"||L==="hk"||L==="mo")?null:fc("zh-CN"):fc(p==="pt"?"pt-BR":p)}function fc(n){return yp(n)?n:null}function im(n,r){if(n!=="auto")return n;for(const o of r){const p=sm(o);if(p!==null)return p}return"en"}function om(n,r){for(const o of r)if(sm(o)===n)try{if(Intl.DateTimeFormat.supportedLocalesOf([o]).length>0)return o}catch{}return v0(n)}let pa=rm;const Oc=new Set;function Xc(){return Array.isArray(navigator.languages)&&navigator.languages.length>0?navigator.languages:typeof navigator.language=="string"?[navigator.language]:[]}function b1(){return im("auto",Xc())}async function am(n){const r=Xc(),o=im(n,r);await bp(o,om(o,r))}async function S1(){pa=bt(nm,rm,w1);try{await am(pa)}catch{await bp("en",om("en",Xc()))}document.documentElement.lang=Nc(),wp(()=>{document.documentElement.lang=Nc()})}async function C1(n){await am(n),pa=n,ft(nm,n);for(const r of Oc)r()}function x1(n){return Oc.add(n),()=>Oc.delete(n)}function k1(){return pa}function Ki(){return O.useSyncExternalStore(wp,Nc)}function E1(){return O.useSyncExternalStore(x1,k1)}const lm=String.raw`https?:\/\/[^\s<>"'\`]+`,L1=new RegExp([String.raw`(\`[^\`\n]+\`)`,String.raw`(\*\*[^*\n]+\*\*)`,String.raw`(__[^_\n]+__)`,String.raw`(\*[^*\n]+\*)`,String.raw`(~~[^~\n]+~~)`,String.raw`(\[[^\]\n]+\]\([^)\s]+\))`,`(${lm})`].join("|")),T1=/^(https?:|mailto:)/i,R1=new RegExp(lm);function M1(n){const r=R1.exec(n);if(r===null||r.index===void 0)return null;const o=cm(r[0]);return{index:r.index,length:o.length,href:o}}function ra(n,r){let o=0;for(const p of n)p===r&&(o+=1);return o}function cm(n){let r=n;for(;;){const o=r.slice(-1);if(o.length===0)return r;if(".,;:!?".includes(o)){r=r.slice(0,-1);continue}if(o===")"&&ra(r,"(")<ra(r,")")){r=r.slice(0,-1);continue}if(o==="]"&&ra(r,"[")<ra(r,"]")){r=r.slice(0,-1);continue}return r}}function A1(n){const r=L1.exec(n);if(r===null||r.index===void 0)return null;const o=r[0],p=r.index,w=(L,s=o.length)=>({index:p,length:s,token:L});if(o.startsWith("`"))return w({kind:"code",text:o.slice(1,-1)});if(o.startsWith("**")||o.startsWith("__"))return w({kind:"strong",text:o.slice(2,-2)});if(o.startsWith("~~"))return w({kind:"del",text:o.slice(2,-2)});if(o.startsWith("*"))return w({kind:"em",text:o.slice(1,-1)});if(o.startsWith("[")){const L=o.indexOf("]("),s=o.slice(1,L),c=o.slice(L+2,-1);return T1.test(c)?w({kind:"link",label:s,href:c}):w({kind:"plain",text:o})}const A=cm(o);return w({kind:"link",label:A,href:A},A.length)}function Sr(n,r,o){if(r.length===0)return[n];const p=n.toLowerCase(),w=r.toLowerCase(),A=[];let L=0,s=p.indexOf(w),c=0;for(;s!==-1;)s>L&&A.push(n.slice(L,s)),A.push(l.jsx("mark",{children:n.slice(s,s+r.length)},`${o}-m${c++}`)),L=s+r.length,s=p.indexOf(w,L);return L<n.length&&A.push(n.slice(L)),A}const N1=/^\[([^\]\n]+)\]\(([^)\s]+)\)$/;function D1(n,r){const o=N1.exec(n);if(o===null)return null;const p=o[2]??"",w=r(p);return w===null?null:{label:o[1]??"",href:p,open:w}}function Bs(n,r,o,p){const w=[];let A=n,L=0;for(;A.length>0;){const s=A1(A);if(s===null){w.push(...Sr(A,r,`${o}-${L++}`));break}s.index>0&&w.push(...Sr(A.slice(0,s.index),r,`${o}-${L++}`));const c=`${o}-i${L++}`,{token:m}=s;switch(m.kind){case"code":w.push(l.jsx("code",{children:m.text},c));break;case"strong":w.push(l.jsx("strong",{children:Sr(m.text,r,c)},c));break;case"del":w.push(l.jsx("del",{children:Sr(m.text,r,c)},c));break;case"em":w.push(l.jsx("em",{children:Sr(m.text,r,c)},c));break;case"link":w.push(l.jsx("a",{href:m.href,target:"_blank",rel:"noreferrer noopener",children:Sr(m.label,r,c)},c));break;default:{const _=p===void 0?null:D1(m.text,p);if(_!==null){w.push(l.jsx("button",{className:"md-local-link",onClick:_.open,title:_.href,children:Sr(_.label,r,c)},c));break}w.push(l.jsx("span",{children:Sr(m.text,r,c)},c));break}}A=A.slice(s.index+s.length)}return w}function I1({code:n,language:r}){const[o,p]=O.useState(null),[w,A]=O.useState(!1),L=O.useRef(null);O.useEffect(()=>()=>{L.current!==null&&window.clearTimeout(L.current)},[]);const s=()=>{navigator.clipboard.writeText(n).then(()=>{A(!0),L.current!==null&&window.clearTimeout(L.current),L.current=window.setTimeout(()=>A(!1),1200)}).catch(()=>A(!1))};return O.useEffect(()=>{let c=!0;return On(async()=>{const{highlightCode:m}=await import("./highlight-nRm-DNTr.js");return{highlightCode:m}},[]).then(({highlightCode:m})=>{c&&p(m(n,r))}).catch(()=>{c&&p(null)}),()=>{c=!1}},[n,r]),l.jsxs("div",{className:"md-code-wrap",children:[l.jsx("pre",{className:"md-code hljs",children:o===null?l.jsx("code",{children:n}):l.jsx("code",{dangerouslySetInnerHTML:{__html:o}})}),l.jsxs("div",{className:"md-code-tools",children:[r!==null&&l.jsx("span",{className:"md-code-lang",children:r}),l.jsx("button",{className:"md-code-copy",onClick:s,title:k(w?"common.copied":"common.copyCode"),"aria-label":k("common.copyCode"),children:w?"✓":"⧉"})]})]})}const of=/^(#{1,6})\s+(.*)$/,pc=/^\s{0,3}[-*+]\s+(.*)$/,Pi=/^\s{0,3}(\d{1,3})[.)]\s+(.*)$/,sa=/^>\s?(.*)$/,mc=/^\s*```(\S*)\s*$/,af=/^\s*(-{3,}|\*{3,}|_{3,})\s*$/,gc=/^\s*\|.*\|\s*$/,P1=/^\s*\|[\s:|-]+\|\s*$/;function lf(n){return n.trim().replace(/^\||\|$/g,"").split("|").map(r=>r.trim())}function Qc({text:n,needle:r="",localLink:o}){var L,s;const p=n.split(`
120
- `),w=[];let A=0;for(;A<p.length;){const c=p[A]??"",m=`b${A}`,_=mc.exec(c);if(_!==null){const S=(_[1]??"").length>0?_[1]:null,E=[];for(A+=1;A<p.length&&!mc.test(p[A]??"");)E.push(p[A]??""),A+=1;A+=1,w.push({key:m,node:l.jsx(I1,{code:E.join(`
121
- `),language:S},m)});continue}if(c.trim().length===0){A+=1;continue}if(af.test(c)){w.push({key:m,node:l.jsx("hr",{className:"md-rule"},m)}),A+=1;continue}const u=of.exec(c);if(u!==null){const S=Math.min((u[1]??"#").length,6);w.push({key:m,node:l.jsx("p",{className:`md-heading md-h${S}`,children:Bs(u[2]??"",r,m,o)},m)}),A+=1;continue}if(gc.test(c)&&P1.test(p[A+1]??"")){const S=lf(c);A+=2;const E=[];for(;A<p.length&&gc.test(p[A]??"");)E.push(lf(p[A]??"")),A+=1;w.push({key:m,node:l.jsx("div",{className:"md-table-wrap",children:l.jsxs("table",{className:"md-table",children:[l.jsx("thead",{children:l.jsx("tr",{children:S.map((g,a)=>l.jsx("th",{children:Bs(g,r,`${m}-h${a}`,o)},a))})}),l.jsx("tbody",{children:E.map((g,a)=>l.jsx("tr",{children:g.map((f,d)=>l.jsx("td",{children:Bs(f,r,`${m}-${a}-${d}`,o)},d))},a))})]})},m)});continue}if(sa.test(c)){const S=[];for(;A<p.length&&sa.test(p[A]??"");)S.push(((L=sa.exec(p[A]??""))==null?void 0:L[1])??""),A+=1;w.push({key:m,node:l.jsx("blockquote",{className:"md-quote",children:Bs(S.join(`
122
- `),r,m,o)},m)});continue}if(pc.test(c)||Pi.test(c)){const S=Pi.test(c),E=S?Number(((s=Pi.exec(c))==null?void 0:s[1])??"1"):1,g=[];for(;A<p.length;){const f=p[A]??"",d=pc.exec(f),h=Pi.exec(f);if(S&&h!==null)g.push(h[2]??"");else if(!S&&d!==null)g.push(d[1]??"");else if(g.length>0&&/^\s{2,}\S/.test(f)&&d===null&&h===null)g[g.length-1]=`${g[g.length-1]??""} ${f.trim()}`;else break;A+=1}const a=g.map((f,d)=>l.jsx("li",{children:Bs(f,r,`${m}-l${d}`,o)},d));w.push({key:m,node:S?l.jsx("ol",{className:"md-list",start:E===1?void 0:E,children:a},m):l.jsx("ul",{className:"md-list",children:a},m)});continue}const y=[];for(;A<p.length;){const S=p[A]??"";if(S.trim().length===0||mc.test(S)||of.test(S)||pc.test(S)||Pi.test(S)||sa.test(S)||af.test(S)||gc.test(S))break;y.push(S),A+=1}w.push({key:m,node:l.jsx("p",{className:"md-paragraph",children:Bs(y.join(`
123
- `),r,m,o)},m)})}return l.jsx("div",{className:"md",children:w.map(c=>c.node)})}const um=[{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 _c(n){const r=um.find(o=>o.names.includes(n));return r===void 0?{key:`name:${n}`,known:!1}:{key:r.key,known:!0}}function j1(n,r,o){const p=um.find(w=>w.key===n);return p===void 0?k("tools.run.callsTo",{count:r,name:o}):k(p.run,{count:r})}function Et(n){if(!m_(n.key))return n.key;let r;if(n.params!==void 0){const o={};for(const[p,w]of Object.entries(n.params))o[p]=typeof w=="object"?Et(w):w;r=o}return k(`server.${n.key}`,r)}const vc={model:null,effort:null,contextWindow:null},O1=200,B1=2e4,F1={},H1={},cf=[];function Bc(n,r,o){return`${n}:${o}:${r}`}function $1(n,r){const[o,p]=O.useState([]),[w,A]=O.useState(tc),[L,s]=O.useState(vc),[c,m]=O.useState("waiting"),[_,u]=O.useState(!1),[y,S]=O.useState(!1),[E,g]=O.useState({}),[a,f]=O.useState(null),[d,h]=O.useState(null),[C,D]=O.useState(!1),[x,M]=O.useState(cf),[b,T]=O.useState({}),[N,F]=O.useState({}),P=(r===null?void 0:b[r])??F1,B=(r===null?void 0:N[r])??H1,H=O.useRef(new Set),q=O.useRef(new Map),X=O.useRef(new Set),G=O.useCallback((ce,he,K)=>{F(W=>({...W,[ce]:{...W[ce]??{},[he]:K}}))},[]),Y=O.useCallback(ce=>{F(he=>{let K=!1;const W={};for(const[J,Z]of Object.entries(he))if(ce in Z){const de={...Z};delete de[ce],W[J]=de,K=!0}else W[J]=Z;return K?W:he})},[]),j=O.useCallback((ce,he)=>{F(K=>{const W=K[ce];if(W===void 0||!(he in W))return K;const J={...W};return delete J[he],{...K,[ce]:J}})},[]);O.useEffect(()=>{for(const ce of o)for(const he of ce.parts){if(he.kind!=="tool-result")continue;X.current.add(he.toolUseId);const K=q.current.get(he.toolUseId);K!==void 0&&(window.clearTimeout(K),q.current.delete(he.toolUseId)),Y(he.toolUseId)}},[o,Y]),O.useEffect(()=>{const ce=q.current;return()=>{for(const he of ce.values())window.clearTimeout(he);ce.clear()}},[]);const U=O.useRef(null);O.useEffect(()=>{if(r===null){p([]),A(tc),s(vc),m("waiting"),u(!1),U.current=null;return}p([]),A(tc),s(vc),m("waiting"),u(!1),S(!1),g({}),f(null),h(null),D(!1),M(cf),H.current.clear(),U.current=null;const ce=n.onMessage(K=>{var W;switch(K.type){case"conversation.reset":if(K.terminalId!==r)break;p(K.events),A(K.usage),s(K.defaults),f(K.permissionMode),h(K.waitingFor),D(K.openToolCall),M(K.subagents),m(K.state),u(K.hasMore),S(!1),U.current=((W=K.events[0])==null?void 0:W.eventId)??null;break;case"conversation.append":{if(K.terminalId!==r)break;p(J=>{var ee;const Z=new Set(J.map(xe=>xe.eventId)),de=K.events.filter(xe=>!Z.has(xe.eventId));return de.length===0?J:(U.current===null&&(U.current=((ee=de[0])==null?void 0:ee.eventId)??null),[...J,...de])}),A(K.usage),K.permissionMode!==null&&f(K.permissionMode),m("live");break}case"conversation.page":{if(K.terminalId!==r)break;p(J=>{var ee;const Z=new Set(J.map(xe=>xe.eventId)),de=K.events.filter(xe=>!Z.has(xe.eventId));return de.length===0?J:(U.current=((ee=de[0])==null?void 0:ee.eventId)??U.current,[...de,...J])}),u(K.hasMore),S(!1);break}case"conversation.turns":{if(K.terminalId!==r)break;const J=new Map(K.turns.map(Z=>[Z.eventId,Z.durationMs]));p(Z=>Z.map(de=>{const ee=J.get(de.eventId);return ee===void 0?de:{...de,durationMs:ee}}));break}case"conversation.parts":{if(K.terminalId!==r)break;const J=new Map(K.updates.map(Z=>[Z.eventId,Z.parts]));p(Z=>Z.map(de=>{const ee=J.get(de.eventId);return ee===void 0?de:{...de,parts:ee}}));break}case"conversation.imageData":{if(K.terminalId!==r)break;const J=Bc(K.eventId,K.index,K.source);g(Z=>({...Z,[J]:K.data===null?null:`data:${K.mediaType};base64,${K.data}`}));break}case"conversation.state":if(K.terminalId!==r)break;m(K.state);break;case"conversation.mode":if(K.terminalId!==r)break;f(K.mode);break;case"conversation.waiting":if(K.terminalId!==r)break;h(K.waitingFor);break;case"conversation.toolCall":if(K.terminalId!==r)break;D(K.open);break;case"conversation.subagents":if(K.terminalId!==r)break;M(K.subagents);break;case"error":{if(K.code!=="answer-failed"||r===null)break;for(const[J,Z]of q.current)window.clearTimeout(Z),q.current.delete(J),T(de=>{const ee=de[r];if(ee===void 0||!(J in ee))return de;const xe={...ee};return delete xe[J],{...de,[r]:xe}}),G(r,J,Et(K.text));break}}});n.send({type:"conversation.subscribe",terminalId:r});const he=n.onReopen(()=>{n.send({type:"conversation.subscribe",terminalId:r})});return()=>{ce(),he(),n.send({type:"conversation.unsubscribe",terminalId:r})}},[n,r,G]);const $=O.useCallback(()=>{const ce=U.current;r===null||ce===null||y||(S(!0),n.send({type:"conversation.loadMore",terminalId:r,beforeEventId:ce,limit:O1}))},[n,r,y]),V=O.useCallback((ce,he,K)=>{if(r===null)return;const W=Bc(ce,he,K);H.current.has(W)||(H.current.add(W),n.send({type:"conversation.image",terminalId:r,eventId:ce,index:he,source:K}))},[n,r]),ne=O.useCallback((ce,he)=>{if(r===null)return;T(W=>{const J=W[r]??{};return ce in J?W:{...W,[r]:{...J,[ce]:he}}}),j(r,ce),n.send({type:"agent.answer",terminalId:r,toolUseId:ce,selections:he});const K=window.setTimeout(()=>{X.current.has(ce)||(T(W=>{const J=W[r];if(J===void 0||!(ce in J))return W;const Z={...J};return delete Z[ce],{...W,[r]:Z}}),G(r,ce,k("conversation.answerUnconfirmed")))},B1);q.current.set(ce,K)},[n,r,G,j]),se=O.useCallback(ce=>{r!==null&&n.send({type:"agent.mode",terminalId:r,mode:ce})},[n,r]);return{events:o,usage:w,defaults:L,state:c,permissionMode:a,waitingFor:d,openToolCall:C,subagents:x,hasMore:_,loadingMore:y,loadMore:$,images:E,requestImage:V,answer:ne,answered:P,answerFailed:B,setPermissionMode:se}}const uf=80,hf=5;function ia(n){return!Array.isArray(n)}function df(n){const r=[];for(const o of n.parts){if(o.kind!=="tool-call")return null;r.push(o.name)}return r.length>0?r:null}function U1(n){const r=[];let o=0;for(;o<n.length;){const p=n[o];if(p===void 0)break;const w=df(p),A=w===null?null:_c(w[0]??"");if(!(w!==null&&A!==null&&w.every(_=>_c(_).key===A.key))||w===null||A===null){r.push({kind:"card",card:p}),o+=1;continue}const s=[p];let c=w.length,m=o+1;for(;m<n.length;){const _=n[m];if(_===void 0)break;const u=df(_);if(u===null||!u.every(y=>_c(y).key===A.key))break;s.push(_),c+=u.length,m+=1}if(c<2){r.push({kind:"card",card:p}),o+=1;continue}r.push({kind:"tools",id:`tools-${p.event.eventId}`,summary:j1(A.key,c,w[0]??""),at:p.event.at,cards:s}),o=m}return r}function W1(n){switch(n.kind){case"text":return n.text;case"tool-call":return`${n.name} ${n.input}`;case"tool-result":return n.text;case"question":return n.questions.map(r=>`${r.question} ${r.options.map(o=>o.label).join(" ")}`).join(`
124
- `);case"notice":return tm(n);case"thinking":case"image":return""}}function ff(n,r){const o=[];for(const p of n.parts)if(o.push(W1(p)),p.kind==="tool-call"){const w=r.get(p.toolUseId);w!==void 0&&o.push(w.text)}return o.join(`
125
- `)}function Er(n,r){if(r.length===0)return l.jsx(l.Fragment,{children:n});const o=n.toLowerCase(),p=r.toLowerCase(),w=[];let A=0,L=o.indexOf(p),s=0;for(;L!==-1;)L>A&&w.push(l.jsx("span",{children:n.slice(A,L)},s++)),w.push(l.jsx("mark",{children:n.slice(L,L+r.length)},s++)),A=L+r.length,L=o.indexOf(p,A);return A<n.length&&w.push(l.jsx("span",{children:n.slice(A)},s++)),l.jsx(l.Fragment,{children:w})}function hm(n,r){const o=[];let p=n,w=0;for(;p.length>0;){const A=M1(p);if(A===null){o.push(l.jsx("span",{children:Er(p,r)},w++));break}A.index>0&&o.push(l.jsx("span",{children:Er(p.slice(0,A.index),r)},w++)),o.push(l.jsx("a",{href:A.href,target:"_blank",rel:"noreferrer noopener",children:Er(A.href,r)},w++)),p=p.slice(A.index+A.length)}return l.jsx(l.Fragment,{children:o})}function z1({view:n,terminalId:r,onRewind:o,questionsAnswerable:p,contextWindowSource:w,instructionsFile:A,onGoToCli:L,cliPresence:s,exitCode:c,onWakeCli:m,waking:_,discovering:u=!1,toolCallNotice:y=null,serverClosed:S=null,statusLineState:E=null,onConfigureStatusLine:g,threadFont:a,continueTargets:f=[],continueBlockedReason:d=null,onContinue:h,searchRequest:C=null,onSearchRequestApplied:D,activity:x=null,receipt:M=null,clock:b=null}){const{events:T,usage:N,defaults:F,state:P,waitingFor:B,subagents:H,hasMore:q,loadingMore:X,loadMore:G,images:Y,requestImage:j,answer:U,answered:$,answerFailed:V}=n,ne=Ki(),[se,ce]=O.useState(""),[he,K]=O.useState(0),[W,J]=O.useState(null);O.useEffect(()=>{C!==null&&(ce(C.query),D==null||D(C.seq))},[C,D]);const Z=O.useRef(null),de=O.useRef(new Map),ee=O.useRef(!0),[xe,ke]=O.useState(!1),[le,we]=O.useState(0),{cards:me,results:Qe}=O.useMemo(()=>{const ge=new Map,Re=new Set;for(const at of T)for(const Ee of at.parts)Ee.kind==="tool-result"?ge.set(Ee.toolUseId,Ee):(Ee.kind==="tool-call"||Ee.kind==="question")&&Re.add(Ee.toolUseId);const rt=[];for(const at of T){const Ee=at.parts.filter(Ue=>Ue.kind!=="thinking"&&!(Ue.kind==="tool-result"&&Re.has(Ue.toolUseId)));Ee.length!==0&&rt.push({event:at,parts:Ee})}return{cards:rt,results:ge}},[T]),nt=O.useMemo(()=>U1(me),[me,ne]),De=se.trim(),Te=O.useMemo(()=>{if(De.length===0)return[];const ge=De.toLowerCase();return me.filter(Re=>ff(Re,Qe).toLowerCase().includes(ge)).map(Re=>Re.event.eventId)},[me,Qe,De,ne]);O.useEffect(()=>{K(0)},[De]);const We=O.useMemo(()=>new Set(Te),[Te]),Le=Te[he]??null;O.useEffect(()=>{var ge;Le!==null&&((ge=de.current.get(Le))==null||ge.scrollIntoView({block:"center"}))},[Le]),O.useLayoutEffect(()=>{ee.current=!0,ke(!1),we(0)},[r]);const Ke=O.useCallback(()=>{const ge=Z.current;if(ge===null)return;const Re=ge.scrollHeight-ge.scrollTop-ge.clientHeight>uf;ke(Re),Re||we(0)},[]);O.useLayoutEffect(()=>{const ge=Z.current;ge!==null&&ee.current&&De.length===0&&(ge.scrollTop=ge.scrollHeight),Ke()},[me.length,De,Ke]);const $e=O.useRef(null);O.useEffect(()=>{var at;const ge=((at=me[me.length-1])==null?void 0:at.event.eventId)??null,Re=$e.current;if($e.current=ge,Re===null||ge===Re||ee.current&&De.length===0)return;const rt=me.findIndex(Ee=>Ee.event.eventId===Re);rt!==-1&&we(Ee=>Ee+(me.length-1-rt))},[me,De]);const tt=O.useCallback(()=>{const ge=Z.current;if(ge===null)return;const Re=ge.scrollHeight-ge.scrollTop-ge.clientHeight;ee.current=Re<=uf,Ke()},[Ke]),St=O.useCallback(()=>{const ge=Z.current;ge!==null&&(ge.scrollTop=ge.scrollHeight,ee.current=!0,ke(!1),we(0))},[]),ze=O.useCallback((ge,Re)=>{Re===null?de.current.delete(ge):de.current.set(ge,Re)},[]),ut=O.useCallback(ge=>{const Re=ff(ge,Qe);navigator.clipboard.writeText(Re).then(()=>{J(ge.event.eventId),window.setTimeout(()=>J(null),1200)}).catch(()=>J(null))},[Qe,ne]),Ze=ge=>{Te.length!==0&&K(Re=>(Re+ge+Te.length)%Te.length)};return l.jsxs("div",{className:"conversation-pane",children:[l.jsxs("div",{className:"conversation-search",children:[l.jsx("input",{className:"conversation-search-input",type:"search",placeholder:k("thread.search.placeholder"),value:se,onChange:ge=>ce(ge.target.value),onKeyDown:ge=>{ge.key==="Enter"&&Ze(ge.shiftKey?-1:1),ge.stopPropagation()},spellCheck:!1}),De.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"conversation-matches",children:Te.length===0?k("thread.search.none"):`${he+1}/${Te.length}`}),l.jsx("button",{className:"icon-button",onClick:()=>Ze(-1),disabled:Te.length===0,title:k("thread.search.previous"),children:"↑"}),l.jsx("button",{className:"icon-button",onClick:()=>Ze(1),disabled:Te.length===0,title:k("thread.search.next"),children:"↓"})]}),l.jsx("span",{className:"conversation-spacer"}),h!==void 0&&l.jsx(em,{targets:f,className:"icon-button conversation-continue",text:k("thread.continueWith"),blockedReason:d,onPick:h}),a!==void 0&&l.jsx("button",{className:"icon-button thread-font-button",onClick:a.cycle,title:fa(a.size),"aria-label":fa(a.size),children:l.jsxs("span",{"aria-hidden":"true",children:["a",l.jsx("span",{className:"thread-font-big",children:"A"})]})}),l.jsx(p1,{usage:N,source:w,instructionsFile:A,fallbackWindow:F.contextWindow,compact:!0,statusLineState:E,onConfigure:g})]}),l.jsxs("div",{className:"conversation-scroll-frame",children:[l.jsxs("div",{className:"conversation-scroll",ref:Z,onScroll:tt,children:[q&&l.jsx("button",{className:"conversation-more",onClick:G,disabled:X,children:k(X?"thread.loadingMore":"thread.loadEarlier")}),me.length===0&&l.jsxs("p",{className:"conversation-empty",children:[P==="unavailable"?k("thread.empty.unavailable"):P==="no-transcript"?my():k(P==="waiting"?"thread.empty.waiting":"thread.empty.noMessages"),P==="waiting"&&u&&l.jsxs(l.Fragment,{children:[l.jsx("br",{}),gy()]})]}),nt.map(ge=>{if(ge.kind==="card")return l.jsx(pf,{card:ge.card,results:Qe,needle:De,isMatch:ge.card.event.eventId===Le,copied:W===ge.card.event.eventId,images:Y,onRequestImage:j,onCopy:()=>ut(ge.card),onRewind:o,register:ze,answered:$,answerFailed:V,answerable:p,onAnswer:U},ge.card.event.eventId);const Re=ge.cards.some(rt=>We.has(rt.event.eventId));return l.jsx(J1,{summary:ge.summary,at:ge.at,open:Re,children:ge.cards.map(rt=>l.jsx(pf,{card:rt,results:Qe,needle:De,isMatch:rt.event.eventId===Le,copied:W===rt.event.eventId,images:Y,onRequestImage:j,onCopy:()=>ut(rt),onRewind:o,register:ze,answered:$,answerFailed:V,answerable:p,onAnswer:U},rt.event.eventId))},ge.id)})]}),xe&&l.jsxs("button",{className:`conversation-jump${le>0?" has-unseen":""}`,onClick:St,title:le>0?k("thread.jumpToEndNew",{count:le}):k("thread.jumpToEnd"),"aria-label":le>0?k("thread.jumpToEndNew",{count:le}):k("thread.jumpToEnd"),children:[l.jsx("span",{"aria-hidden":"true",children:"↓"}),le>0&&l.jsx("span",{className:"conversation-jump-count",children:le>99?"99+":le})]})]}),l.jsx(q1,{live:s==="live"&&S===null,activity:x,waitingFor:B,receipt:M,events:T,clock:b,subagents:H}),S!==null&&(S.state==="relaunching"||s==="live")?l.jsx(Y1,{text:S.text,relaunching:S.state==="relaunching",onRelaunch:m}):s==="live"?B===null&&y!==null?l.jsx(Q1,{notice:y,onGoToCli:L}):l.jsx(X1,{waitingFor:B,questionsAnswerable:p,onGoToCli:L}):l.jsx(G1,{presence:s,exitCode:c,waking:_,onWake:m})]})}const V1=1e3;function q1({live:n,activity:r,waitingFor:o,receipt:p,events:w,clock:A,subagents:L}){const[,s]=O.useState(0),c=Date.now(),m=Ew({live:n,activity:r,waitingFor:o,receipt:p,events:w,clock:A,now:c}),_=n?L:[],u=m!==null||_.length>0;return O.useEffect(()=>{if(!u)return;const y=window.setInterval(()=>s(S=>S+1),V1);return()=>window.clearInterval(y)},[u]),u?l.jsxs("div",{className:"thread-status",children:[m!==null&&l.jsxs("div",{className:`thread-status-row thread-status-${m.kind}`,children:[l.jsx(K1,{kind:m.kind}),l.jsx("span",{className:"thread-status-text",children:Lw(m,c)})]}),_.length>0&&l.jsxs("div",{className:"thread-status-row thread-status-subagents",children:[l.jsxs("span",{className:"tab-working thread-status-subagent-mark","aria-hidden":"true",children:[l.jsx("i",{}),l.jsx("i",{}),l.jsx("i",{})]}),l.jsx("span",{className:"thread-status-text",children:Tw(_,c)})]})]}):null}function K1({kind:n}){return n==="working"?l.jsxs("span",{className:"tab-working","aria-hidden":"true",children:[l.jsx("i",{}),l.jsx("i",{}),l.jsx("i",{})]}):n==="sending"?l.jsx("span",{className:"thread-status-sending-dot","aria-hidden":"true"}):l.jsx("span",{className:"thread-status-check","aria-hidden":"true",children:"✓"})}function G1({presence:n,exitCode:r,waking:o,onWake:p}){const w=n==="sleeping"?k("thread.wake.sleeping"):r===null?k("thread.wake.exited"):k("thread.wake.exitedWithCode",{code:r});return l.jsxs("div",{className:"conversation-waiting conversation-wake",role:"status",children:[l.jsx("span",{className:"conversation-wake-dot","aria-hidden":"true"}),l.jsx("span",{children:w}),l.jsx("button",{className:"primary-button primary-button-small",onClick:p,disabled:o,children:k(o?"thread.wake.opening":"thread.wake.open")})]})}function Y1({text:n,relaunching:r,onRelaunch:o}){return l.jsxs("div",{className:"conversation-waiting conversation-wake",role:"status",children:[l.jsx("span",{className:"conversation-wake-dot","aria-hidden":"true"}),l.jsx("span",{children:n}),l.jsx("button",{className:"primary-button primary-button-small",onClick:o,disabled:r,children:r?by():wy()})]})}function X1({waitingFor:n,questionsAnswerable:r,onGoToCli:o}){if(n===null)return null;const p=Rp(n,r);return l.jsxs("div",{className:"conversation-waiting",role:"status",children:[l.jsx("span",{className:"conversation-waiting-dot","aria-hidden":"true"}),l.jsx("span",{children:p}),l.jsx("button",{className:"link-button",onClick:o,children:k("thread.goToCli")})]})}function Q1({notice:n,onGoToCli:r}){return l.jsxs("div",{className:"conversation-waiting",role:"status",children:[l.jsx("span",{className:"conversation-waiting-dot","aria-hidden":"true"}),l.jsx("span",{children:n}),l.jsx("button",{className:"link-button",onClick:r,children:k("thread.goToCli")})]})}function pf({card:n,results:r,needle:o,isMatch:p,copied:w,images:A,onRequestImage:L,onCopy:s,onRewind:c,register:m,answered:_,answerFailed:u,answerable:y,onAnswer:S}){const{event:E}=n,g=E.role==="user",a=f=>{const d=_[f.toolUseId];return d!==void 0?d:r.has(f.toolUseId)?[]:null};return l.jsxs("article",{ref:f=>m(E.eventId,f),className:`turn turn-${E.role}${p?" turn-match":""}`,children:[l.jsxs("div",{className:"turn-actions",children:[l.jsx("button",{className:"icon-button",onClick:s,title:k("thread.copyMessage"),children:w?"✓":"⧉"}),g&&c!==void 0&&l.jsx("button",{className:"icon-button",onClick:c,title:k("thread.rewind"),children:"↩"})]}),n.parts.map((f,d)=>l.jsx(eb,{part:f,eventId:E.eventId,mine:g,result:f.kind==="tool-call"?r.get(f.toolUseId)??null:null,needle:o,images:A,onRequestImage:L,answeredAt:f.kind==="question"?a(f):null,failure:f.kind==="question"?u[f.toolUseId]??null:null,answerable:y,onAnswer:S},d)),l.jsx(Z1,{event:E,mine:g})]})}function J1({summary:n,at:r,open:o,children:p}){const w=r>0?jp(r):"";return l.jsxs("details",{className:"tool-group",open:o,children:[l.jsxs("summary",{className:"tool-group-summary",children:[l.jsx("span",{className:"tool-group-chevron","aria-hidden":"true",children:"▸"}),l.jsx("span",{className:"tool-group-count",children:n}),w.length>0&&l.jsx("span",{className:"tool-group-time",children:w})]}),l.jsx("div",{className:"tool-group-body",children:p})]})}function Z1({event:n,mine:r}){const o=n.at>0?jp(n.at):"",p=[];return n.durationMs!==null&&p.push(Yy(n.durationMs)),n.effort!==null&&p.push(k("thread.turn.effort",{effort:n.effort})),l.jsxs("div",{className:"turn-meta",children:[r&&l.jsx("span",{className:"turn-who",children:k("thread.turn.you")}),o.length>0&&l.jsx("span",{children:o}),n.queued&&l.jsx("span",{className:"turn-queued",title:k("thread.turn.queuedTitle"),children:k("thread.turn.queued")}),p.map(w=>l.jsx("span",{className:"turn-meta-bit",children:w},w))]})}function eb({part:n,eventId:r,mine:o,result:p,needle:w,images:A,onRequestImage:L,answeredAt:s,failure:c,answerable:m,onAnswer:_}){switch(n.kind){case"text":return o?l.jsx(nb,{text:n.text,truncated:n.truncated,needle:w}):l.jsxs("div",{className:"part-text",children:[l.jsx(Qc,{text:n.text,needle:w}),n.truncated&&l.jsxs("span",{className:"part-truncated",children:[" ",k("thread.truncated")]})]});case"image":return l.jsx(sb,{eventId:r,index:n.index,source:n.source,src:A[Bc(r,n.index,n.source)],onRequest:L});case"thinking":return null;case"notice":return l.jsx("div",{className:`turn-notice turn-notice-${n.notice}`,children:Er(tm(n),w)});case"question":return l.jsx(tb,{part:n,answeredAt:s,failure:c,answerable:m,onAnswer:_,needle:w});case"tool-call":{const u=w.length>0&&`${n.name} ${n.input} ${(p==null?void 0:p.text)??""}`.toLowerCase().includes(w.toLowerCase());return l.jsxs("details",{className:"tool",open:u,children:[l.jsxs("summary",{className:"tool-summary",children:[l.jsx("span",{className:"tool-name",children:n.name}),p!==null&&p.isError&&l.jsx("span",{className:"tool-error",children:k("thread.tool.error")}),p!==null&&p.imageCount>0&&l.jsx("span",{className:"tool-images",children:k("thread.tool.images",{count:p.imageCount})})]}),l.jsxs("div",{className:"tool-block",children:[l.jsx("span",{className:"tool-label",children:k("thread.tool.input")}),l.jsxs("pre",{className:"tool-pre",children:[Er(n.input,w),n.truncated&&l.jsxs("span",{className:"part-truncated",children:[" ",k("thread.truncated")]})]})]}),p!==null&&l.jsxs("div",{className:"tool-block",children:[l.jsx("span",{className:"tool-label",children:k("thread.tool.result")}),l.jsxs("pre",{className:`tool-pre${p.isError?" tool-pre-error":""}`,children:[p.text.length>0?Er(p.text,w):p.imageCount>0?k("thread.tool.imagesNotSent",{count:p.imageCount}):k("thread.tool.noOutput"),p.truncated&&l.jsxs("span",{className:"part-truncated",children:[" ",k("thread.truncated")]})]})]})]})}case"tool-result":return l.jsxs("div",{className:"tool-block",children:[l.jsx("span",{className:"tool-label",children:k("thread.tool.orphanResult")}),l.jsx("pre",{className:`tool-pre${n.isError?" tool-pre-error":""}`,children:Er(n.text,w)})]})}}function tb({part:n,answeredAt:r,failure:o,answerable:p,onAnswer:w,needle:A}){var D;const[L,s]=O.useState(()=>n.questions.map(()=>[])),[c,m]=O.useState(null),[_,u]=O.useState(""),y=r!==null,S=y||!p,E=r??L,g=n.questions.length===1&&((D=n.questions[0])==null?void 0:D.multiSelect)===!1,a=E.every(x=>ia(x)?x.text.trim().length>0:x.length>0),f=x=>x===void 0||ia(x)?[]:x,d=(x,M)=>{if(S)return;const b=n.questions[x];if(b!==void 0){if(g){w(n.toolUseId,[[M]]);return}m(T=>T===x?null:T),s(T=>T.map((N,F)=>{if(F!==x)return N;const P=f(N);return b.multiSelect?P.includes(M)?P.filter(B=>B!==M):[...P,M]:[M]}))}},h=x=>{const M=_.trim();if(M.length===0||S)return;const b={kind:"free",text:M};if(g){w(n.toolUseId,[b]);return}s(T=>T.map((N,F)=>F===x?b:N)),m(null),u("")},C=x=>{if(S)return;const M=E[x];u(M!==void 0&&ia(M)?M.text:""),m(x)};return l.jsxs("div",{className:`question${y?" question-done":""}`,children:[n.questions.map((x,M)=>{const b=E[M],T=b!==void 0&&ia(b)?b.text:null;return l.jsxs("div",{className:"question-item",children:[l.jsxs("div",{className:"question-head",children:[x.header.length>0&&l.jsx("span",{className:"question-header",children:x.header}),l.jsx("span",{className:"question-text",children:Er(x.question,A)}),x.multiSelect&&l.jsx("span",{className:"question-hint",children:k("thread.question.multi")})]}),l.jsxs("div",{className:"question-options",children:[x.options.map((N,F)=>{const P=f(b).includes(F);return l.jsxs("button",{type:"button",className:`question-option${P?" question-option-picked":""}`,disabled:S,onClick:()=>d(M,F),children:[l.jsx("span",{className:"question-option-label",children:N.label}),N.description.length>0&&l.jsx("span",{className:"question-option-desc",children:N.description})]},F)}),c===M&&!S?l.jsxs("div",{className:"question-write",children:[l.jsx("textarea",{className:"question-write-input",autoFocus:!0,rows:2,value:_,placeholder:k("thread.question.placeholder"),onChange:N=>u(N.target.value),onKeyDown:N=>{N.key==="Enter"&&!N.shiftKey&&(N.preventDefault(),h(M)),N.key==="Escape"&&m(null),N.stopPropagation()}}),l.jsxs("div",{className:"question-write-actions",children:[l.jsx("button",{type:"button",className:"question-send",disabled:_.trim().length===0,onClick:()=>h(M),children:k(g?"thread.question.send":"thread.question.useText")}),l.jsx("button",{type:"button",className:"question-write-cancel",onClick:()=>m(null),children:k("common.cancel")})]})]}):l.jsxs("button",{type:"button",className:`question-option question-option-write${T!==null?" question-option-picked":""}`,disabled:S,onClick:()=>C(M),children:[l.jsx("span",{className:"question-option-label",children:T!==null?T:k("thread.question.writeOther")}),T===null&&l.jsx("span",{className:"question-option-desc",children:k("thread.question.writeOtherHint")})]})]})]},M)}),l.jsxs("div",{className:"question-foot",children:[o!==null&&l.jsx("span",{className:"question-failed",children:o}),y?l.jsx("span",{className:"question-sent",children:k("thread.question.answered")}):p?l.jsxs(l.Fragment,{children:[!g&&l.jsx("button",{type:"button",className:"question-send",disabled:!a,onClick:()=>w(n.toolUseId,L),children:k("thread.question.sendAnswers")}),l.jsx("span",{className:"question-note",children:k(g?"thread.question.pickOne":"thread.question.pickEach")})]}):l.jsx("span",{className:"question-note",children:k("thread.question.answerInCli")})]})]})}function nb({text:n,truncated:r,needle:o}){const p=$y(n,r),w=p.length===1?p[0]:void 0;if(w!==void 0&&w.kind==="text")return l.jsx(mf,{text:n,truncated:r,needle:o});const A=p.length-1;return l.jsx("div",{className:"part-own",children:p.map((L,s)=>L.kind==="text"?l.jsx(mf,{text:L.text,truncated:r&&s===A,needle:o},s):l.jsx(rb,{number:L.number,text:L.text,complete:L.complete,needle:o},s))})}function rb({number:n,text:r,complete:o,needle:p}){const[w,A]=O.useState(!1),L=p.length>0&&r.toLowerCase().includes(p.toLowerCase()),s=w||L;return l.jsxs("div",{className:`thread-pasted${s?" thread-pasted-open":""}`,children:[l.jsxs("button",{className:"thread-pasted-toggle",onClick:()=>A(c=>!c),"aria-expanded":s,children:[l.jsx("span",{className:"chip-icon",children:"¶"}),k("thread.pasted",{number:n,count:da(r)}),!o&&l.jsxs("span",{className:"part-truncated",children:[" ",k("thread.truncated")]}),l.jsx("span",{className:"chip-chevron",children:s?"▾":"▸"})]}),s&&l.jsx("div",{className:"thread-pasted-text part-mine",children:hm(r,p)})]})}function mf({text:n,truncated:r,needle:o}){const[p,w]=O.useState(!1),A=n.split(`
126
- `),L=o.length>0&&n.toLowerCase().includes(o.toLowerCase()),s=A.length>=hf&&!L,c=s&&!p?A.slice(0,hf-1).join(`
127
- `):n;return l.jsxs("div",{className:"part-text part-mine",children:[hm(c,o),r&&l.jsxs("span",{className:"part-truncated",children:[" ",k("thread.truncated")]}),s&&l.jsx("button",{className:"fold-toggle",onClick:()=>w(m=>!m),children:p?k("thread.fold.less"):k("thread.fold.more",{count:A.length})})]})}function sb({eventId:n,index:r,source:o,src:p,onRequest:w}){const[A,L]=O.useState(!1);return O.useEffect(()=>{p===void 0&&w(n,r,o)},[p,n,r,o,w]),p===void 0?l.jsx("div",{className:"conversation-image-placeholder",children:k("thread.image.loading")}):p===null?l.jsx("div",{className:"conversation-image-placeholder",children:k("thread.image.gone")}):l.jsxs(l.Fragment,{children:[l.jsx("img",{className:"conversation-image",src:p,alt:k("thread.image.alt"),onClick:()=>L(!0),title:k("thread.image.openTitle")}),A&&l.jsx(Bp,{src:p,caption:k("thread.image.alt"),onClose:()=>L(!1)})]})}function gf({connection:n,title:r,confirmLabel:o,confirmTitle:p,onChoose:w,onClose:A}){const[L,s]=O.useState(null),[c,m]=O.useState(null),[_,u]=O.useState(!1),[y,S]=O.useState(""),E=O.useRef(null),g=O.useRef(null);O.useEffect(()=>{const h=n.onMessage(C=>{if(C.type==="picker.listing"){E.current=C.listing.pickerId,s(C.listing),m(null),u(!1),S("");return}C.type==="error"&&C.code==="picker-failed"&&m(Et(C.text))});return n.send({type:"picker.open"}),()=>{h();const C=E.current;C!==null&&n.send({type:"picker.close",pickerId:C})}},[n]),O.useEffect(()=>{const h=C=>{C.key==="Escape"&&(C.preventDefault(),C.stopPropagation(),A())};return window.addEventListener("keydown",h,!0),()=>window.removeEventListener("keydown",h,!0)},[A]),O.useEffect(()=>{var h;_&&((h=g.current)==null||h.focus())},[_]);const a=O.useCallback(h=>{const C=E.current;C!==null&&n.send({type:"picker.enter",pickerId:C,name:h})},[n]),f=O.useCallback(h=>{const C=E.current;C!==null&&n.send({type:"picker.root",pickerId:C,rootIndex:h})},[n]),d=O.useCallback(()=>{const h=E.current,C=y.trim();h===null||C.length===0||n.send({type:"picker.create",pickerId:h,name:C})},[n,y]);return l.jsx("div",{className:"modal-backdrop",onClick:A,children:l.jsxs("div",{className:"modal picker-modal",role:"dialog","aria-label":r,onClick:h=>h.stopPropagation(),children:[l.jsxs("header",{className:"modal-header",children:[l.jsx("span",{className:"modal-title",children:r}),l.jsx("button",{className:"icon-button",onClick:A,title:k("common.close"),children:"×"})]}),L===null?l.jsx("p",{className:"panel-note",children:k("picker.loading")}):l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"picker-roots",children:L.roots.map((h,C)=>l.jsx("button",{className:"picker-root",onClick:()=>f(C),title:k("picker.goTo",{root:h}),children:h},h))}),l.jsx("p",{className:"picker-path",title:L.path,children:L.path}),l.jsxs("div",{className:"picker-list",children:[L.canGoUp&&l.jsxs("button",{className:"picker-entry picker-up",onClick:()=>a(".."),children:["‹ ",k("picker.up")]}),L.entries.length===0&&!L.canGoUp&&l.jsx("p",{className:"panel-note",children:k("picker.empty")}),L.entries.map(h=>l.jsx("button",{className:"picker-entry",onClick:()=>a(h),children:h},h)),L.truncated&&l.jsx("p",{className:"panel-note",children:k("picker.truncated")})]}),c!==null&&l.jsx("p",{className:"picker-problem",children:c}),l.jsxs("footer",{className:"picker-footer",children:[_?l.jsxs("div",{className:"picker-create",children:[l.jsx("input",{ref:g,className:"picker-create-input",value:y,placeholder:k("picker.newFolderName"),onChange:h=>S(h.target.value),onKeyDown:h=>{h.key==="Enter"&&d(),h.key==="Escape"&&(h.stopPropagation(),u(!1)),h.stopPropagation()},spellCheck:!1}),l.jsx("button",{className:"link-button",onClick:d,children:k("picker.create")}),l.jsx("button",{className:"link-button",onClick:()=>u(!1),children:k("common.cancel")})]}):l.jsx("button",{className:"link-button",onClick:()=>u(!0),children:k("picker.createHere")}),l.jsx("span",{className:"composer-spacer"}),l.jsx("button",{className:"picker-open",onClick:()=>w(L.pickerId,L.path),title:p(L.path),children:o})]})]})]})})}function ib(n,r){return Vc(n)&&r!==null&&r.sessions>0}function ob(){return k("search.mode.titles")}function ab(){return k("search.mode.conversations")}function lb(){return k("search.mode.conversationsTitle")}function cb(n){return k(n==="conversations"?"search.placeholder.conversations":"search.placeholder.titles")}function ub(){return k("search.tooShort",{min:up})}function hb(n){return[...n.trim()].length<up}function db(){return k("search.off")}function fb(n){const r=new Map;for(const o of n){const p=`${o.agent}:${o.sessionId}`;let w=r.get(p);w===void 0&&(w={key:p,agent:o.agent,sessionId:o.sessionId,title:o.title,titleHit:null,hits:[],lastAt:null},r.set(p,w)),o.eventId===null?w.titleHit=o:w.hits.push(o),o.at!==null&&(w.lastAt=Math.max(w.lastAt??0,o.at))}return[...r.values()]}const pb=40;function dm(n,r=pb){const o=n.matchStart+n.matchLength;let p=n.snippet.slice(0,n.matchStart);if(p.length>r){let w=p.length-r;const A=p.charCodeAt(w);A>=56320&&A<=57343&&(w+=1),p=`…${p.slice(w)}`}return{before:p,match:n.snippet.slice(n.matchStart,o),after:n.snippet.slice(o)}}function mb(n){return n.role==="user"?k("search.role.user"):n.role==="assistant"?k("search.role.assistant"):k("search.role.title")}function fm(n){return dm(n).match.trim()}function gb(n){const r=n.hits[0]??n.titleHit;return r===null?"":fm(r)}const Fc=n=>k("search.sessions",{count:n});function _b(n,r){return{query:r.query,hits:n===null?[...r.hits]:[...n.hits,...r.hits],sessionsScanned:r.sessionsScanned,sessionsTotal:r.sessionsTotal,truncated:null}}function vb(n){const{result:r}=n;if(n.searching&&n.error===null){if(r===null)return k("search.status.searching");const p={count:r.sessionsTotal,scanned:r.sessionsScanned};return r.hits.length===0?k("search.status.progress",p):k("search.status.progressFound",{...p,found:_f(r)})}if(n.error!==null)return n.error;if(r===null)return null;const o=r.hits.length===0?k("search.status.none"):_f(r);if(r.truncated===null&&r.hits.length===0&&r.sessionsScanned>0)return k("search.status.noneIn",{sessions:Fc(r.sessionsScanned)});if(r.truncated==="results")return k("search.status.truncatedResults",{found:o});if(r.truncated==="time"){const p=Math.max(0,r.sessionsTotal-r.sessionsScanned);return k("search.status.truncatedTime",{found:o,seconds:Math.round(Dv/1e3),left:Fc(p)})}return k("search.status.done",{found:o})}function _f(n){const r=new Set(n.hits.map(o=>`${o.agent}:${o.sessionId}`)).size;return k("search.found",{hits:k("search.hits",{count:n.hits.length}),sessions:Fc(r)})}function yb(n,r){const o=r.terminals.find(p=>p.kind==="agent"&&p.agent===n.agent&&p.sessionId===n.sessionId);if(o!==void 0)return{kind:"activate",terminalId:o.terminalId};for(const p of r.projects){const w=p.sessions.find(A=>A.agent===n.agent&&A.sessionId===n.sessionId);if(w!==void 0)return Dc(w)&&p.cwdExists&&r.canResume(w.agent)?{kind:"resume",cwd:pp(w.cwd,p.cwd,r.platform),session:w}:{kind:"copy"}}return{kind:"copy"}}const wb=/<(code|kbd|b|strong|em)>([\s\S]*?)<\/\1>|<br\s*\/?>/g;function Bt(n,r,o){const p=Sp(n,r),w=[];let A=0;for(const L of p.matchAll(wb)){const s=L.index??0;s>A&&w.push(la(p.slice(A,s),r));const c=L[1];if(c===void 0)w.push(O.createElement("br",{key:w.length}));else{const m=la(L[2]??"",r);w.push(O.createElement(c,{key:w.length},m))}A=s+L[0].length}return A<p.length&&w.push(la(p.slice(A),r)),w.length===1?w[0]:w}const vf="0.4.1",yf="agent-workbench.support-notice",bb=3e4;function Sb(n){return/^[0-9A-Za-z][0-9A-Za-z.+-]{0,39}$/.test(n)?n:null}function Cb(n,r){return n!==r}function xb(){return[{keys:"Alt + T",description:k("shortcuts.app.newTab")},{keys:"Alt + W",description:k("shortcuts.app.closeTab")},{keys:"Alt + ← / →",description:k("shortcuts.app.switchTab")},{keys:"Alt + P",description:k("shortcuts.app.togglePanel")},{keys:"Shift + Tab",description:k("shortcuts.app.previousTab")}]}function kb({agent:n,onClose:r}){return O.useEffect(()=>{const o=p=>{p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),r())};return window.addEventListener("keydown",o,!0),()=>window.removeEventListener("keydown",o,!0)},[r]),l.jsx("div",{className:"modal-backdrop",onClick:r,children:l.jsxs("div",{className:"modal",role:"dialog","aria-label":k("shortcuts.ariaLabel"),onClick:o=>o.stopPropagation(),children:[l.jsxs("header",{className:"modal-header",children:[l.jsx("span",{className:"modal-title",children:k("shortcuts.title")}),l.jsx("button",{className:"icon-button",onClick:r,title:k("common.close"),children:"×"})]}),l.jsxs("div",{className:"modal-body",children:[l.jsx("h3",{className:"modal-section",children:k("shortcuts.section.app")}),l.jsx(yc,{shortcuts:xb()}),l.jsx("h3",{className:"modal-section",children:k("shortcuts.section.composer")}),l.jsx(yc,{shortcuts:z0(n!==null&&n.capabilities.imagesByPath!==null)}),n!==null&&l.jsxs(l.Fragment,{children:[l.jsx("h3",{className:"modal-section",children:k("shortcuts.section.cli")}),l.jsx("p",{className:"modal-hint",children:Bt("shortcuts.cliHint")}),l.jsx(yc,{shortcuts:Us[n.id].shortcuts}),Us[n.id].shortcutsNote!==null&&l.jsx("p",{className:"modal-hint",children:Us[n.id].shortcutsNote})]}),l.jsx("p",{className:"modal-hint",children:Bt("shortcuts.browserReserved")}),l.jsx("p",{className:"modal-hint",children:Bt("shortcuts.altNumber")}),l.jsxs("p",{className:"modal-hint support-hint",children:[l.jsx("span",{"aria-hidden":"true",children:"☕"})," ",k("support.notice")," ",l.jsx("a",{href:gp,target:"_blank",rel:"noreferrer noopener",children:k("support.link")})]})]})]})})}function yc({shortcuts:n}){return l.jsx("dl",{className:"shortcut-list",children:n.map(r=>l.jsxs("div",{className:"shortcut-row",children:[l.jsx("dt",{children:l.jsx("kbd",{children:r.keys})}),l.jsx("dd",{children:r.description})]},r.keys))})}const Eb=1e3,Lb=5e3;function Tb({info:n,agentLabel:r,onRefresh:o,onClose:p}){const[w,A]=O.useState(!1),[L,s]=O.useState(!1),c=O.useRef(null),m=O.useRef(null);O.useEffect(()=>{const E=g=>{g.key==="Escape"&&(g.preventDefault(),g.stopPropagation(),p())};return window.addEventListener("keydown",E,!0),()=>window.removeEventListener("keydown",E,!0)},[p]),O.useEffect(()=>{s(!1)},[n]),O.useEffect(()=>()=>{c.current!==null&&window.clearTimeout(c.current),m.current!==null&&window.clearTimeout(m.current)},[]);const _=E=>{navigator.clipboard.writeText(E).then(()=>{A(!0),c.current!==null&&window.clearTimeout(c.current),c.current=window.setTimeout(()=>A(!1),Eb)}).catch(()=>A(!1))},u=()=>{s(!0),o(),m.current!==null&&window.clearTimeout(m.current),m.current=window.setTimeout(()=>s(!1),Lb)},y=n.state==="active",S=k("statusLine.title",{agent:r});return l.jsx("div",{className:"modal-backdrop",onClick:p,children:l.jsxs("div",{className:"modal",role:"dialog","aria-label":S,onClick:E=>E.stopPropagation(),children:[l.jsxs("header",{className:"modal-header",children:[l.jsx("span",{className:"modal-title",children:S}),l.jsx("button",{className:"icon-button",onClick:p,title:k("common.close"),children:"×"})]}),l.jsxs("div",{className:"modal-body",children:[l.jsx("p",{className:`status-line-state${y?" status-line-state-active":""}`,children:F0(n.state)}),l.jsx("p",{className:"modal-hint",children:k("statusLine.benefit")}),l.jsx("h3",{className:"modal-section",children:k("statusLine.lineSection")}),n.fragment===null?l.jsx("p",{className:"modal-hint",children:H0()}):l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"modal-hint",children:Bt("statusLine.mergeHint")}),l.jsxs("div",{className:"status-line-fragment",children:[l.jsx("pre",{className:"tool-pre",children:n.fragment}),l.jsx("button",{className:"link-button",onClick:()=>_(n.fragment??""),title:k("statusLine.copyTitle"),children:w?l.jsxs(l.Fragment,{children:["✓ ",k("statusLine.copied")]}):k("statusLine.copy")})]})]}),l.jsx("h3",{className:"modal-section",children:k("statusLine.whereSection")}),l.jsx("p",{className:"status-line-path",children:n.settingsPath}),l.jsx("p",{className:"modal-hint",children:k("statusLine.whereHint")}),l.jsx("h3",{className:"modal-section",children:k("statusLine.scriptSection")}),l.jsx("p",{className:"modal-hint",children:k("statusLine.scriptHint")}),l.jsx("p",{className:"status-line-path",children:n.scriptPath}),l.jsx("p",{className:"modal-hint",children:Bt("statusLine.runsEverywhere")}),l.jsxs("div",{className:"status-line-actions",children:[l.jsx("button",{className:"primary-button",onClick:u,disabled:L,children:k(L?"statusLine.checking":"statusLine.check")}),l.jsx("span",{className:"modal-hint",children:k("statusLine.checkHint")})]})]})]})})}function Rb(){const[n,r]=O.useState(()=>Cb(bt(yf,null,Sb),vf));return O.useEffect(()=>{if(!n)return;ft(yf,vf);const o=window.setTimeout(()=>r(!1),bb);return()=>window.clearTimeout(o)},[n]),n?l.jsxs("div",{className:"banner banner-support",role:"status",children:[l.jsx("span",{children:k("support.notice")}),l.jsx("a",{className:"banner-support-link",href:gp,target:"_blank",rel:"noreferrer noopener",onClick:()=>r(!1),children:k("support.link")}),l.jsx("button",{className:"link-button banner-support-dismiss",onClick:()=>r(!1),children:k("support.dismiss")})]}):null}function Hc({agent:n,agents:r}){return l.jsx("span",{className:"agent-badge",title:qi(n,r),children:E0(n)})}const Mb=500,wf=10;function Ab(n){const r=O.useRef(null),o=O.useRef(null),p=O.useRef(!1),w=O.useRef(n);w.current=n;const A=O.useCallback(()=>{r.current!==null&&window.clearTimeout(r.current),r.current=null,o.current=null},[]),L=O.useCallback(_=>{_.pointerType==="mouse"||_.button!==0||(A(),p.current=!1,o.current={x:_.clientX,y:_.clientY},r.current=window.setTimeout(()=>{r.current=null,p.current=!0,w.current()},Mb))},[A]),s=O.useCallback(_=>{const u=o.current;u!==null&&(Math.abs(_.clientX-u.x)>wf||Math.abs(_.clientY-u.y)>wf)&&A()},[A]),c=O.useCallback(_=>{(p.current||r.current!==null)&&_.preventDefault()},[]),m=O.useCallback(_=>{p.current&&(p.current=!1,_.preventDefault(),_.stopPropagation())},[]);return{onPointerDown:L,onPointerMove:s,onPointerUp:A,onPointerCancel:A,onContextMenu:c,onClickCapture:m}}function Nb({onLongPress:n,...r}){const o=Ab(n);return l.jsx("button",{...r,...o})}function Jc({className:n,text:r,title:o,disabled:p,offerAgentChoice:w,agents:A,agent:L,onOpen:s}){var E;const[c,m]=O.useState(!1),_=O.useRef(null),u=O.useCallback(()=>m(!1),[]),y=O.useCallback(g=>{m(!1),s(g)},[s]);if(!w)return l.jsx("button",{className:n,onClick:()=>s(),disabled:p,title:o,children:r});const S=((E=A.find(g=>g.id===L))==null?void 0:E.label)??null;return l.jsxs("span",{className:"split-button",children:[l.jsx("button",{className:`${n} split-button-main`,onClick:()=>s(L??void 0),disabled:p,title:S===null?o:k("agentMenu.titleWithAgent",{title:o,label:S}),children:r}),l.jsx("button",{ref:_,className:`${n} split-button-arrow`,onClick:()=>m(g=>!g),disabled:p,"aria-haspopup":"menu","aria-expanded":c,title:k("agentMenu.chooseTitle"),children:"▾"}),c&&_.current!==null&&l.jsx(Zp,{agents:A,preselected:L,anchor:_.current,onPick:y,onClose:u})]})}function Db(n){const r=new Date(n);return r.setHours(0,0,0,0),r.getTime()}function pm(n,r,o,p){const w=new Set;for(const A of n)for(const L of A.sessions)L.agent===r&&(L.archived||L.updatedAt<o&&(p.has(L.sessionId)||w.add(L.sessionId)));return[...w]}function Ib(n,r,o,p){const w=[];for(const s of n)for(const c of s.sessions)w.includes(c.agent)||w.push(c.agent);const A=p,L=s=>{const c=A.indexOf(s);return c===-1?p.length:c};return w.sort((s,c)=>L(s)-L(c)).map(s=>({agent:s,count:pm(n,s,r,o).length})).filter(s=>s.count>0)}function mm(n,r){const o=new Set;let p=0;for(const w of n.sessions)if(!w.archived){if(r.has(w.sessionId)){p+=1;continue}o.add(w.sessionId)}return{sessionIds:[...o],blocked:p}}function Pb(n){const{sessionIds:r,blocked:o}=n;if(r.length===0)return k("archive.allBlocked",{count:o});const p=k("archive.confirm",{count:r.length});return o===0?p:k("archive.withBlocked",{confirm:p,blocked:k("archive.blockedStays",{count:o})})}const bf=12;function jb(n){let r=2166136261;for(let o=0;o<n.length;o+=1)r^=n.charCodeAt(o),r=Math.imul(r,16777619);return r>>>0}function Zr(n){const r=n.toLowerCase().replace(/[\\/]+/g,"/").replace(/\/+$/,"");return`hsl(${jb(r)%bf*(360/bf)} var(--project-color-s) var(--project-color-l))`}function Ui(){return k("vault.name")}function Ob(){return k("vault.privacy")}function Bb(){return k("vault.archived")}function Fb(){return k("vault.mark.copy")}function Sf(){return k("vault.mark.copyTitle")}function Hb(){return k("vault.mark.partial")}function $b(){return k("vault.mark.partialTitle")}function gm(n){return k("vault.sessions",{count:n})}function Zc(n){return n==="measuring"||n==="writing"||n==="moving"}function Ub(n){const r=n.progress;switch(n.state){case"measuring":return r===null?k("vault.state.measuring"):k("vault.state.measuringProgress",{done:r.done,total:r.total});case"writing":return r===null?k("vault.state.writing"):k("vault.state.writingProgress",{done:r.done,total:r.total});case"moving":return k("vault.state.moving");default:return n.enabled?k("vault.state.on"):k("vault.state.off")}}function Wb(n){if(n===null||!n.enabled)return null;const r=[Ui(),gm(n.sessions)];return n.state==="writing"?r.push(n.progress===null?k("vault.line.copying"):k("vault.line.copyingProgress",{done:n.progress.done,total:n.progress.total})):n.state==="moving"?r.push(k("vault.line.moving")):n.state==="measuring"?r.push(k("vault.line.measuring")):r.push(n.lastPassAt===null?k("vault.line.neverCopied"):Fn(n.lastPassAt)),n.pending>0&&r.push(k("vault.line.pending",{count:n.pending})),r.join(" · ")}function zb(n){return n===null?Ui():n.enabled?k("vault.button.on"):k("vault.button.off")}function Vb(n){return n.enabled?"enabled":Zc(n.state)?"busy":n.measurement!==null?"measured":n.passSessions>0?"existing":"needs-measure"}function qb(n,r){return Zc(n.state)?k("vault.busy"):r?null:k("vault.indexNotReady")}function Kb(n){return Zc(n.state)?k("vault.busy"):null}function Gb(n){return k("vault.previousDir",{dir:n})}function Yb(n){const r=[];return n.skippedEmpty>0&&r.push(k("vault.note.empty",{count:n.skippedEmpty})),n.unsupported>0&&r.push(k("vault.note.unsupported",{count:n.unsupported})),n.failed>0&&r.push(n.failureReasons.length>0?k("vault.note.failedWithReasons",{count:n.failed,reasons:n.failureReasons.map(Et).join("; ")}):k("vault.note.failed",{count:n.failed})),r.length===0?null:k("vault.note.notCopied",{parts:r.join(" · ")})}function Xb(n,r){const o=n.byAgent.map(A=>({agent:A.agent,label:qi(A.agent,r),sessions:A.sessions,bytes:A.eventBytes+A.imageBytes,images:A.images,imageBytes:A.imageBytes,skippedArchived:A.skippedArchived,note:Yb(A)})),p=o.reduce((A,L)=>({sessions:A.sessions+L.sessions,bytes:A.bytes+L.bytes,images:A.images+L.images,skippedArchived:A.skippedArchived+L.skippedArchived}),{sessions:0,bytes:n.memoryBytes,images:0,skippedArchived:0}),w=Fn(n.measuredAt);return{rows:o,memoryProjects:n.memoryProjects,memoryBytes:n.memoryBytes,total:p,summary:w.length>0?k("vault.measure.summary",{when:w,duration:$i(n.durationMs)}):k("vault.measure.summaryNoWhen",{duration:$i(n.durationMs)})}}function Qb(n){const r=n.storage==="vault";return{copy:r,partial:r&&n.partial}}function Jb(n){switch(n){case"exporting":return k("vault.export.exporting");case"done":return k("vault.export.done");default:return k("vault.export.idle")}}const Zb=1e3;function Cf({hit:n}){const{before:r,match:o,after:p}=dm(n);return l.jsxs(l.Fragment,{children:[r,l.jsx("mark",{children:o}),p]})}function eS({project:n,openSessionIds:r,onConfirm:o,onCancel:p}){const w=mm(n,r);return l.jsxs("div",{className:"project-archive-confirm",role:"group",children:[l.jsx("span",{className:"archive-history-text",children:Pb(w)}),w.sessionIds.length>0&&l.jsx("button",{className:"link-button",onClick:o,children:k("sidebar.action.archive")}),l.jsx("button",{className:"link-button",onClick:p,children:w.sessionIds.length>0?k("common.cancel"):k("common.close")})]})}function wc(n){if(n.cwd.length===0)return n.fallbackName;const r=n.cwd.split(/[\\/]/).filter(o=>o.length>0);return r[r.length-1]??n.cwd}function xf({out:n}){return l.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:[l.jsx("rect",{x:"2.5",y:"3.5",width:"19",height:"5",rx:"1.2"}),l.jsx("path",{d:"M4.5 8.5v10a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2v-10"}),n?l.jsx("path",{d:"M12 18.5v-6M9.2 15.3 12 12.5l2.8 2.8"}):l.jsx("path",{d:"M10 12.5h4"})]})}function tS(){return l.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:[l.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"}),l.jsx("rect",{x:"4",y:"7",width:"12",height:"14",rx:"1.5"}),l.jsx("path",{d:"M7.5 12h5M7.5 15.5h5"})]})}function nS({done:n}){return l.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:n?l.jsx("path",{d:"M5 12.5l4.5 4.5L19 7.5"}):l.jsxs(l.Fragment,{children:[l.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"}),l.jsx("path",{d:"M12 10.5v6.5M9.2 14.2 12 17l2.8-2.8"})]})})}function rS({candidates:n,agents:r,onArchiveAgent:o,onClose:p,anchorRef:w}){const[A,L]=O.useState(null),s=O.useRef(null);return O.useEffect(()=>{const c=u=>{var y,S;return u instanceof Node&&(((y=s.current)==null?void 0:y.contains(u))===!0||((S=w.current)==null?void 0:S.contains(u))===!0)},m=u=>{u.key!=="Escape"||!c(document.activeElement)||(u.preventDefault(),u.stopPropagation(),p())},_=u=>{c(u.target)||p()};return window.addEventListener("keydown",m,!0),document.addEventListener("pointerdown",_,!0),()=>{window.removeEventListener("keydown",m,!0),document.removeEventListener("pointerdown",_,!0)}},[w,p]),l.jsxs("div",{ref:s,className:"archive-history",role:"region","aria-label":k("sidebar.history.region"),children:[l.jsxs("div",{className:"archive-history-header",children:[l.jsx("span",{children:k("sidebar.history.heading")}),l.jsx("button",{className:"icon-button",onClick:p,title:k("common.closeEsc"),children:"×"})]}),n.map(({agent:c,count:m})=>{const _=qi(c,r);return A===c?l.jsxs("div",{className:"archive-history-row archive-history-confirm",children:[l.jsx("span",{className:"archive-history-text",children:k("sidebar.history.confirm",{count:m,label:_})}),l.jsx("button",{className:"link-button",onClick:()=>o(c),children:k("sidebar.action.archive")}),l.jsx("button",{className:"link-button",onClick:()=>L(null),children:k("common.cancel")})]},c):l.jsxs("div",{className:"archive-history-row",children:[l.jsxs("span",{className:"archive-history-text",children:[l.jsx("span",{className:"archive-history-agent",children:_}),l.jsx("span",{className:"archive-history-count",children:k("sidebar.history.count",{count:m})})]}),l.jsx("button",{className:"link-button",onClick:()=>L(c),children:k("sidebar.action.archive")})]},c)})]})}function sS({projects:n,indexStatus:r,disabled:o,openSessionIds:p,openBlocked:w,onOpenProject:A,agents:L,offerAgentChoice:s,agentForProject:c,onOpenSession:m,canResume:_,platform:u,onRefresh:y,onArchive:S,onHide:E,width:g,onNewProject:a,vault:f,onOpenVault:d,onOpenVaultSession:h,onExportProject:C,exporting:D,lastExported:x,onContinueSession:M,globalSearch:b,onOpenSearchHit:T}){const[N,F]=O.useState(new Set),[P,B]=O.useState(null);O.useEffect(()=>{const fe=x===null?0:x.at+Zb-Date.now();if(x===null||fe<=0)return;B(x.projectKey);const pe=window.setTimeout(()=>B(null),fe);return()=>window.clearTimeout(pe)},[x]);const H=fe=>D.has(fe)?"exporting":P===fe?"done":"idle",q=Wb(f),[X,G]=O.useState(""),[Y,j]=O.useState(!1),[U,$]=O.useState(new Set),[V,ne]=O.useState("titles"),se=b===null?"titles":V,[ce,he]=O.useState(!1),K=b!==null&&se==="conversations"&&X.trim().length>0&&(ce||b.submitted!==null),W=(b==null?void 0:b.result)??null,J=O.useMemo(()=>K&&W!==null?fb(W.hits):[],[K,W]),Z=fe=>{ne(fe),he(!1),b==null||b.clear()},de=()=>{if(b!==null){if(hb(X)){he(!0),b.clear();return}he(!1),b.search(X.trim(),Y)}},ee=(b==null?void 0:b.submitted)??null,xe=b==null?void 0:b.search;O.useEffect(()=>{se!=="conversations"||ee===null||xe===void 0||ee.includeArchived!==Y&&xe(ee.query,Y)},[se,ee,xe,Y]);const ke=O.useMemo(()=>n.reduce((fe,pe)=>fe+pe.sessions.filter(Me=>Me.archived).length,0),[n]),le=O.useMemo(()=>{const fe=se==="titles"?X.trim().toLowerCase():"";return n.map(pe=>{const Me=Y?pe.sessions:pe.sessions.filter(Ge=>!Ge.archived);if(Me.length===0)return null;if(fe.length===0)return{...pe,sessions:Me};if(wc(pe).toLowerCase().includes(fe)||pe.cwd.toLowerCase().includes(fe))return{...pe,sessions:Me};const je=Me.filter(Ge=>Bn(Ge.title,Ge.titleSource).toLowerCase().includes(fe));return je.length>0?{...pe,sessions:je}:null}).filter(pe=>pe!==null)},[n,X,Y,se]),we=se==="titles"&&X.trim().length>0,me=fe=>fe.archived||!p.has(fe.sessionId),[Qe,nt]=O.useState(!1),De=O.useRef(null),Te=Db(Date.now()),We=O.useMemo(()=>L.map(fe=>fe.id),[L]),Le=O.useMemo(()=>Ib(n,Te,p,We),[n,Te,p,We]),[Ke,$e]=O.useState(null);O.useEffect(()=>{Le.length===0&&nt(!1)},[Le.length]);const tt=O.useCallback(()=>nt(!1),[]),St=fe=>{const pe=pm(n,fe,Te,p);pe.length>0&&(S(pe,!0),$e({what:qi(fe,L),sessionIds:pe})),nt(!1)},[ze,ut]=O.useState(null),Ze=fe=>{const pe=mm(fe,p);pe.sessionIds.length>0&&(S(pe.sessionIds,!0),$e({what:wc(fe),sessionIds:pe.sessionIds})),ut(null)},ge=()=>{Ke!==null&&S(Ke.sessionIds,!1),$e(null)},Re=fe=>{$(pe=>{const Me=new Set(pe);return Me.has(fe)?Me.delete(fe):Me.add(fe),Me})},rt=O.useMemo(()=>{const fe=[];for(const pe of le)for(const Me of pe.sessions)U.has(Me.sessionId)&&fe.push(Me);return fe},[le,U]),at=fe=>{const pe=rt.filter(Me=>fe?me(Me):!0).map(Me=>Me.sessionId);pe.length>0&&S(pe,fe),$(new Set)},Ee=fe=>{F(pe=>{const Me=new Set(pe);return Me.has(fe)?Me.delete(fe):Me.add(fe),Me})},Ue=r.state==="scanning";return l.jsxs("aside",{className:"sidebar",style:{width:`${g}px`},children:[l.jsxs("div",{className:"sidebar-header",children:[l.jsx("input",{className:"sidebar-filter",type:"search",placeholder:cb(se),value:X,onChange:fe=>{G(fe.target.value),se==="conversations"&&(he(!1),fe.target.value.trim().length===0&&(b==null||b.clear()))},onKeyDown:fe=>{se!=="conversations"||fe.key!=="Enter"||(fe.preventDefault(),de())},spellCheck:!1}),l.jsx("button",{className:"icon-button",onClick:a,title:k("sidebar.newProject"),disabled:o,children:"+"}),l.jsx("button",{className:"icon-button",onClick:y,title:k("sidebar.reindex"),disabled:Ue,children:"⟳"}),l.jsx("button",{className:`icon-button${(f==null?void 0:f.enabled)===!0?" icon-button-on":""}`,onClick:d,title:zb(f),"aria-label":Ui(),children:l.jsx(tS,{})}),l.jsx("button",{className:"icon-button",onClick:E,title:k("sidebar.hide"),children:"«"})]}),b!==null&&l.jsxs("div",{className:"sidebar-search-mode",role:"group","aria-label":k("sidebar.searchMode.label"),children:[l.jsx("button",{className:`sidebar-search-mode-option${se==="titles"?" is-on":""}`,"aria-pressed":se==="titles",onClick:()=>Z("titles"),title:k("sidebar.searchMode.titlesTitle"),children:ob()}),l.jsx("button",{className:`sidebar-search-mode-option${se==="conversations"?" is-on":""}`,"aria-pressed":se==="conversations",onClick:()=>Z("conversations"),title:lb(),children:ab()})]}),Ue&&l.jsx("div",{className:"sidebar-progress",children:k("sidebar.indexing",{scanned:r.scannedFiles,total:r.totalFiles})}),(ke>0||Le.length>0)&&l.jsxs("div",{className:"sidebar-archive-bar",children:[ke>0&&l.jsx("button",{className:`sidebar-archived-toggle${Y?" is-on":""}`,onClick:()=>j(fe=>!fe),title:k("sidebar.archived.toggleTitle"),children:Y?k("sidebar.archived.hide",{count:ke}):k("sidebar.archived.show",{count:ke})}),Le.length>0&&l.jsx("button",{ref:De,className:`link-button sidebar-archive-history${Qe?" is-on":""}`,onClick:()=>nt(fe=>!fe),"aria-expanded":Qe,title:k("sidebar.history.buttonTitle"),children:k("sidebar.history.button")})]}),Qe&&Le.length>0&&l.jsx(rS,{candidates:Le,agents:L,onArchiveAgent:St,onClose:tt,anchorRef:De}),Ke!==null&&!Qe&&l.jsxs("div",{className:"archive-history archive-history-undo",role:"status",children:[l.jsx("span",{className:"archive-history-text",children:k("sidebar.undo.text",{count:Ke.sessionIds.length,what:Ke.what})}),l.jsx("button",{className:"link-button",onClick:ge,children:k("sidebar.action.undo")}),l.jsx("button",{className:"icon-button",onClick:()=>$e(null),title:k("sidebar.undo.dismissTitle"),children:"×"})]}),q!==null&&l.jsx("button",{className:`sidebar-vault-line${(f==null?void 0:f.lastError)!=null?" is-problem":""}`,onClick:d,title:(f==null?void 0:f.lastError)!=null?k("sidebar.vaultLine.lastError",{error:Et(f.lastError)}):k("sidebar.vaultLine.title"),children:q}),l.jsxs("div",{className:"sidebar-scroll",children:[K&&b!==null&&l.jsxs("div",{className:"search-results",children:[!b.vaultEnabled&&l.jsx("p",{className:"search-note",children:db()}),l.jsx("p",{className:`search-status${b.error!==null?" is-problem":""}`,role:"status",children:ce?ub():vb(b)}),!ce&&J.map(fe=>{const pe=fe.hits[0]??fe.titleHit;return pe===null?null:l.jsxs("div",{className:"search-group",children:[l.jsxs("button",{className:"search-group-title",onClick:()=>T(pe,gb(fe)),title:Bn(fe.title),children:[l.jsx(Hc,{agent:fe.agent,agents:L}),fe.titleHit!==null?l.jsx(Cf,{hit:fe.titleHit}):Bn(fe.title)]}),fe.hits.map(Me=>l.jsxs("button",{className:"search-hit",onClick:()=>T(Me,fm(Me)),children:[l.jsx("span",{className:"search-hit-snippet",children:l.jsx(Cf,{hit:Me})}),l.jsxs("span",{className:"search-hit-meta",children:[mb(Me),Me.at!==null?` · ${Fn(Me.at)}`:""]})]},Me.eventId??"titulo"))]},fe.key)})]}),!K&&le.length===0&&!Ue&&l.jsx("p",{className:"sidebar-empty",children:n.length===0?k("sidebar.empty.noProjects"):k("sidebar.empty.noMatch")}),!K&&le.map(fe=>{const pe=N.has(fe.key)||we,Me=!o&&fe.cwdExists,lt=w(fe.cwd);return l.jsxs("div",{className:"project",children:[l.jsxs("div",{className:"project-row",children:[l.jsxs("button",{className:"project-toggle",onClick:()=>Ee(fe.key),title:fe.cwd.length>0?fe.cwd:fe.fallbackName,children:[l.jsx("span",{className:`chevron${pe?" chevron-open":""}`,children:"›"}),l.jsx("span",{className:"project-swatch",style:{background:Zr(fe.cwd)},"aria-hidden":"true"}),l.jsx("span",{className:"project-name",children:wc(fe)}),l.jsx("span",{className:"project-count",children:fe.sessions.length})]}),l.jsxs("span",{className:"project-actions",children:[C!==null&&l.jsx("button",{className:`icon-button project-action${H(fe.key)!=="idle"?" project-action-busy":""}`,onClick:()=>C(fe.key),disabled:H(fe.key)==="exporting",title:Jb(H(fe.key)),"aria-label":k("sidebar.project.export"),children:l.jsx(nS,{done:H(fe.key)==="done"})}),l.jsx("button",{className:`icon-button project-action${ze===fe.key?" project-action-busy":""}`,onClick:()=>ut(je=>je===fe.key?null:fe.key),title:k("sidebar.project.archiveTitle"),"aria-label":k("sidebar.project.archive"),"aria-expanded":ze===fe.key,children:l.jsx(xf,{out:!1})})]}),l.jsx(Jc,{className:"icon-button",text:"+",title:lt?Mp():fe.cwdExists?k("sidebar.project.newSession"):k("sidebar.project.folderGone"),disabled:!Me||lt,offerAgentChoice:s,agents:L,agent:s?c(fe):null,onOpen:je=>A(fe.cwd,je)})]}),!fe.cwdExists&&l.jsx("div",{className:"project-missing",title:fe.cwd,children:k("sidebar.project.missing")}),ze===fe.key&&l.jsx(eS,{project:fe,openSessionIds:p,onConfirm:()=>Ze(fe),onCancel:()=>ut(null)}),pe&&l.jsx("ul",{className:"session-list",children:fe.sessions.map(je=>{const Ge=U.has(je.sessionId),ht=!me(je),Lt=fy(je.agent,L,s),At=Qb(je),Zn=Dc(je)&&_(je.agent),es=At.copy?h!==null:Me&&Zn;return l.jsxs("li",{className:`session-row${je.archived?" session-archived":""}${Ge?" session-selected":""}`,children:[l.jsxs(Nb,{className:"session-item",onLongPress:()=>Re(je.sessionId),onClick:Mn=>{if(Mn.ctrlKey||Mn.metaKey){Re(je.sessionId);return}if(At.copy){h==null||h(je);return}Dc(je)&&(je.archived&&S([je.sessionId],!1),m(pp(je.cwd,fe.cwd,u),je))},disabled:!es,title:At.copy?`${Bn(je.title,je.titleSource)}
128
- ${h===null?k("remote.onlyOnHost"):Sf()}`:Lt.unavailableTitle??Bn(je.title,je.titleSource),children:[l.jsxs("span",{className:"session-title",children:[Lt.badge&&l.jsx(Hc,{agent:je.agent,agents:L}),At.copy&&l.jsx("span",{className:"session-vault-mark",title:Sf(),children:Fb()}),At.partial&&l.jsx("span",{className:"session-partial-mark",title:$b(),children:Hb()}),Bn(je.title,je.titleSource)]}),l.jsx("span",{className:"session-meta",children:Fn(je.updatedAt)})]}),l.jsx(em,{targets:Tp(L,je.agent,je.partial),className:"icon-button session-continue",text:"↪",onPick:Mn=>M(je,Mn)}),l.jsx("button",{className:"icon-button session-action",onClick:()=>S([je.sessionId],!je.archived),disabled:ht,title:je.archived?k("sidebar.session.restore"):k(ht?"sidebar.session.blocked":"sidebar.session.archive"),children:l.jsx(xf,{out:je.archived})})]},`${je.agent}:${je.sessionId}`)})})]},fe.key)})]}),rt.length>0&&l.jsxs("div",{className:"sidebar-selection",children:[l.jsx("span",{children:k("sidebar.selection.count",{count:rt.length})}),rt.some(fe=>!fe.archived)&&l.jsx("button",{className:"link-button",onClick:()=>at(!0),children:k("sidebar.action.archive")}),rt.some(fe=>fe.archived)&&l.jsx("button",{className:"link-button",onClick:()=>at(!1),children:k("sidebar.action.restore")}),l.jsx("button",{className:"link-button",onClick:()=>$(new Set),children:k("common.cancel")})]})]})}function $c({x:n,y:r,items:o,onClose:p,anchor:w=null}){const A=O.useRef(null),[L,s]=O.useState({left:n,top:r});return O.useLayoutEffect(()=>{const c=A.current;if(c===null)return;const{width:m,height:_}=c.getBoundingClientRect();s({left:Math.max(4,Math.min(n,window.innerWidth-m-4)),top:Math.max(4,Math.min(r,window.innerHeight-_-4))})},[n,r]),O.useEffect(()=>{const c=_=>{_.key==="Escape"&&(_.stopPropagation(),p())},m=_=>{var y;const u=_.target;u instanceof Node&&((y=A.current)!=null&&y.contains(u)||w!=null&&w.contains(u))||p()};return window.addEventListener("keydown",c,!0),window.addEventListener("pointerdown",m,!0),window.addEventListener("scroll",p,!0),window.addEventListener("resize",p),()=>{window.removeEventListener("keydown",c,!0),window.removeEventListener("pointerdown",m,!0),window.removeEventListener("scroll",p,!0),window.removeEventListener("resize",p)}},[w,p]),l.jsx("div",{ref:A,className:"context-menu",style:{left:`${L.left}px`,top:`${L.top}px`},onPointerDown:c=>c.stopPropagation(),children:o.map(c=>l.jsxs("button",{className:"context-menu-item",lang:c.lang,role:c.checked===void 0?void 0:"menuitemradio","aria-checked":c.checked,onClick:()=>{c.onSelect(),p()},children:[c.checked!==void 0&&l.jsx("span",{className:"context-menu-check","aria-hidden":"true",children:c.checked?"✓":""}),c.label]},c.label))})}function iS({preview:n,onOpenWithSystem:r,onInsert:o}){const[p,w]=O.useState(null);O.useEffect(()=>{if(n.binary||n.language===null){w(null);return}let s=!1;return On(async()=>{const{highlightCode:c}=await import("./highlight-nRm-DNTr.js");return{highlightCode:c}},[]).then(({highlightCode:c})=>{s||w(c(n.text,n.language))}).catch(()=>{s||w(null)}),()=>{s=!0,w(null)}},[n.text,n.language,n.binary]);const A=O.useMemo(()=>n.binary?0:n.text.split(`
129
- `).length,[n.text,n.binary]),L=l.jsxs("div",{className:"preview-actions",children:[o!==void 0&&l.jsx("button",{className:"primary-button primary-button-small preview-open",onClick:o,children:k("files.menu.insertMention")}),r!==null&&l.jsx("button",{className:"primary-button primary-button-small preview-open",onClick:r,children:k("files.menu.openWithSystem")})]});return n.binary?l.jsxs("div",{className:"preview-fallback",children:[l.jsx("p",{className:"panel-note",children:k("files.preview.binary")}),L]}):l.jsxs("div",{className:"panel-scroll",children:[l.jsxs("div",{className:"preview",children:[l.jsx("div",{className:"preview-gutter","aria-hidden":"true",children:Array.from({length:A},(s,c)=>l.jsx("span",{children:c+1},c))}),p!==null?l.jsx("pre",{className:"preview-code hljs",dangerouslySetInnerHTML:{__html:p}}):l.jsx("pre",{className:"preview-code",children:n.text})]}),n.truncated&&l.jsxs("div",{className:"preview-fallback",children:[l.jsx("p",{className:"panel-note",children:k("files.preview.truncated")}),L]})]})}function eu(){return l.jsx("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",focusable:"false",children:l.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 oS(){return l.jsxs("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",focusable:"false",children:[l.jsx("rect",{x:"5.5",y:"1.5",width:"9",height:"10",rx:"1.2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),l.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 aS({open:n}){return l.jsxs("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",focusable:"false",children:[l.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"}),l.jsx("circle",{cx:"8",cy:"8",r:"2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),!n&&l.jsx("path",{d:"M2.6 13.4L13.4 2.6",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}function lS(){return l.jsxs("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",focusable:"false",children:[l.jsx("rect",{x:"1.5",y:"10",width:"13",height:"4.5",rx:"1.2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),l.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 cS(){return l.jsx("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",focusable:"false",children:l.jsx("path",{d:"M3 8.5l3.2 3.2L13 4.8",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function _m({className:n,title:r,doneTitle:o,icon:p,onAction:w}){const[A,L]=O.useState(!1),s=O.useRef(null);O.useEffect(()=>()=>{s.current!==null&&window.clearTimeout(s.current)},[]);const c=m=>{m.stopPropagation(),w(),L(!0),s.current!==null&&window.clearTimeout(s.current),s.current=window.setTimeout(()=>L(!1),1200)};return l.jsx("button",{className:A?`${n} tree-action-done`:n,onClick:c,title:A?o:r,children:A?l.jsx(cS,{}):p})}function uS({className:n,title:r,onCopy:o}){return l.jsx(_m,{className:n,title:r,doneTitle:k("common.copied"),icon:l.jsx(oS,{}),onAction:o})}function tu({className:n,title:r,onInsert:o}){return l.jsx(_m,{className:n,title:r,doneTitle:k("files.pathInserted"),icon:l.jsx(lS,{}),onAction:o})}function hS({view:n,cwd:r,platform:o,onInsert:p,onInsertPath:w,onReveal:A}){const{listings:L,loading:s,preview:c,loadingPreview:m,closePreview:_,refresh:u,query:y,setQuery:S,showHidden:E,toggleHidden:g}=n,a=Ki(),[f,d]=O.useState(null),h=o==="win32"?"\\":"/",C=O.useCallback(N=>{const F=N.split("/").join(h);return r.length===0?F:r.endsWith(h)?`${r}${F}`:`${r}${h}${F}`},[r,h]),D=O.useCallback(N=>{navigator.clipboard.writeText(N).catch(()=>{})},[]),x=O.useCallback(N=>w(`"${C(N)}"`),[C,w]),M=O.useCallback((N,F)=>{N.preventDefault(),N.stopPropagation(),d({x:N.clientX,y:N.clientY,items:[{label:k("files.menu.copyAbsolute"),onSelect:()=>D(C(F))},{label:k("files.menu.copyRelative"),onSelect:()=>D(F)},...p===void 0?[]:[{label:k("files.menu.insertMention"),onSelect:()=>p(`@${F}`)}],...A===null?[]:[{label:k("files.menu.openWithSystem"),onSelect:()=>A(F)}]]})},[C,D,p,A,a]);if(c!==null||m)return l.jsxs("div",{className:"panel-body",children:[l.jsxs("div",{className:"panel-subhead",children:[l.jsx("button",{className:"link-button",onClick:_,children:k("files.back")}),c!==null&&l.jsxs("span",{className:"panel-subhead-title",title:c.path,children:[c.path.split("/").pop(),l.jsxs("span",{className:"panel-tagline",children:[" ",nn(c.sizeBytes)]})]})]}),m?l.jsx("p",{className:"panel-note",children:k("files.readingFile")}):c!==null&&l.jsx(iS,{preview:c,onOpenWithSystem:A===null?null:()=>A(c.path),onInsert:p===void 0?void 0:()=>p(`@${c.path}`)}),f!==null&&l.jsx($c,{x:f.x,y:f.y,items:f.items,onClose:()=>d(null)})]});const b=L.get(""),T=y.trim();return l.jsxs("div",{className:"panel-body",children:[l.jsxs("div",{className:"panel-subhead",children:[l.jsx("span",{className:"panel-subhead-title",title:r,children:r.split(/[\\/]/).filter(N=>N.length>0).pop()??r}),l.jsx(tu,{className:"icon-button",title:k("files.insertFolderPath"),onInsert:()=>x("")}),l.jsx("button",{className:E?"icon-button icon-button-on":"icon-button",onClick:g,title:k(E?"files.hidden.hide":"files.hidden.show"),children:l.jsx(aS,{open:E})}),A!==null&&l.jsx("button",{className:"icon-button",onClick:()=>A(""),title:k("files.revealFolder"),children:l.jsx(eu,{})}),l.jsx("button",{className:"icon-button",onClick:u,title:k("files.refresh"),children:"⟳"})]}),l.jsxs("div",{className:"tree-search",children:[l.jsx("input",{className:"tree-search-input",value:y,placeholder:k("files.search.placeholder"),onChange:N=>S(N.target.value),onKeyDown:N=>{N.key==="Escape"&&y.length>0&&(N.stopPropagation(),S(""))}}),y.length>0&&l.jsx("button",{className:"tree-search-clear",onClick:()=>S(""),title:k("files.search.clear"),children:"×"})]}),l.jsx("div",{className:"panel-scroll",children:T.length>0?l.jsx(dS,{view:n,onContextMenu:M,onReveal:A,onInsertPath:x}):b===void 0?l.jsx("p",{className:"panel-note",children:s.has("")?k("files.readingDir"):k("files.readDirFailed")}):l.jsx(vm,{path:"",depth:0,view:n,onContextMenu:M,onReveal:A,onInsertPath:x})}),f!==null&&l.jsx($c,{x:f.x,y:f.y,items:f.items,onClose:()=>d(null)})]})}function dS({view:n,onContextMenu:r,onReveal:o,onInsertPath:p}){const{results:w,searching:A,openFile:L,toggleDirectory:s}=n;return w===null?l.jsx("p",{className:"panel-note",children:k(A?"files.search.searching":"files.search.prompt")}):w.entries.length===0?l.jsx("p",{className:"panel-note",children:k("files.search.none")}):l.jsxs("ul",{className:"tree tree-results",children:[w.entries.map(c=>l.jsx("li",{children:l.jsxs("div",{className:"tree-item",children:[l.jsxs("button",{className:`tree-row tree-row-${c.kind}${c.hidden===void 0?"":" tree-row-hidden"}`,onClick:()=>c.kind==="dir"?s(c.path):L(c.path),onContextMenu:m=>r(m,c.path,c.kind),title:c.path,children:[l.jsx("span",{className:"tree-chevron",children:c.kind==="dir"?"›":""}),l.jsxs("span",{className:"tree-result",children:[l.jsx("span",{className:"tree-name",children:c.name}),l.jsx("span",{className:"tree-result-path",children:c.path})]}),c.kind==="file"&&l.jsx("span",{className:"tree-size",children:nn(c.sizeBytes)})]}),l.jsx(tu,{className:"tree-action",title:k("files.insertPath",{name:c.name}),onInsert:()=>p(c.path)}),c.kind==="dir"&&o!==null&&l.jsx("button",{className:"tree-action",onClick:()=>o(c.path),title:k("files.reveal",{name:c.name}),children:l.jsx(eu,{})})]})},c.path)),w.truncated&&l.jsx("li",{className:"tree-hidden",title:k("files.search.moreTitle"),children:k("files.search.more")})]})}function vm({path:n,depth:r,view:o,onContextMenu:p,onReveal:w,onInsertPath:A}){const{listings:L,loading:s}=o,c=L.get(n);return c===void 0?s.has(n)?l.jsx("div",{className:"tree-loading",children:k("files.loading")}):null:l.jsxs("ul",{className:"tree",children:[c.entries.map(m=>l.jsx(fS,{entry:m,depth:r,view:o,onContextMenu:p,onReveal:w,onInsertPath:A},m.path)),c.entries.length===0&&l.jsx("li",{className:"tree-empty",style:{paddingLeft:`${r*12+8}px`},children:c.hiddenCount>0?k("files.allHidden"):k("files.empty")}),(c.truncated||c.hiddenCount>0)&&c.entries.length>0&&l.jsx("li",{className:"tree-hidden",style:{paddingLeft:`${r*12+8}px`},title:k("files.hiddenTitle"),children:c.truncated?k("files.moreEntries"):k("files.hiddenCount",{count:c.hiddenCount})})]})}function fS({entry:n,depth:r,view:o,onContextMenu:p,onReveal:w,onInsertPath:A}){const{expanded:L,toggleDirectory:s,openFile:c}=o,m=n.kind==="dir"&&L.has(n.path);return l.jsxs("li",{children:[l.jsxs("div",{className:"tree-item",children:[l.jsxs("button",{className:`tree-row tree-row-${n.kind}${n.hidden===void 0?"":" tree-row-hidden"}`,style:{paddingLeft:`${r*12+6}px`},onClick:()=>n.kind==="dir"?s(n.path):c(n.path),onContextMenu:_=>p(_,n.path,n.kind),title:n.hidden===void 0?n.path:`${n.path}
130
- ${n.hidden==="ignored"?k("files.row.ignored"):k("files.row.alwaysHidden")}`,children:[l.jsx("span",{className:`tree-chevron${m?" tree-chevron-open":""}`,children:n.kind==="dir"?"›":""}),l.jsx("span",{className:"tree-name",children:n.name}),n.kind==="file"&&l.jsx("span",{className:"tree-size",children:nn(n.sizeBytes)})]}),l.jsx(tu,{className:"tree-action",title:k("files.insertPath",{name:n.name}),onInsert:()=>A(n.path)}),n.kind==="dir"&&w!==null&&l.jsx("button",{className:"tree-action",onClick:()=>w(n.path),title:k("files.reveal",{name:n.name}),children:l.jsx(eu,{})})]}),m&&l.jsx(vm,{path:n.path,depth:r+1,view:o,onContextMenu:p,onReveal:w,onInsertPath:A})]})}const pS={added:"+",removed:"-",context:" ",hunk:"",meta:""};function mS({diff:n}){return n.binary?l.jsx("p",{className:"panel-note",children:k("diff.binary")}):n.lines.length===0?l.jsx("p",{className:"panel-note",children:n.message===null?k("diff.noChanges"):Et(n.message)}):l.jsxs("div",{className:"panel-scroll",children:[l.jsx("div",{className:"diff",children:n.lines.map((r,o)=>l.jsxs("div",{className:`diff-line diff-line-${r.kind}`,children:[l.jsx("span",{className:"diff-num","aria-hidden":"true",children:r.oldLine??""}),l.jsx("span",{className:"diff-num","aria-hidden":"true",children:r.newLine??""}),l.jsx("span",{className:"diff-marker","aria-hidden":"true",children:pS[r.kind]}),l.jsx("span",{className:"diff-text",children:r.text})]},o))}),n.truncated&&l.jsx("p",{className:"panel-note",children:k("diff.truncated")})]})}const gS={added:"A",modified:"M",deleted:"D",renamed:"R",copied:"C","type-changed":"T",untracked:"?",conflict:"!"},_S={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"},vS=[{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 kf(n){const r=n.endsWith("/"),o=r?n.slice(0,-1):n,p=o.lastIndexOf("/"),w=p===-1?o:o.slice(p+1);return{dir:p===-1?"":o.slice(0,p+1),name:r?`${w}/`:w,isDirectory:r}}function yS({status:n}){return l.jsxs("div",{className:"git-headline",children:[l.jsx("span",{className:"git-branch",title:n.repoRoot,children:n.branch??(n.head!==null?k("git.detachedAt",{head:n.head}):k("git.detached"))}),n.upstream!==null&&l.jsx("span",{className:"git-upstream",title:k("git.upstreamTitle",{upstream:n.upstream}),children:n.upstream}),(n.ahead>0||n.behind>0)&&l.jsxs("span",{className:"git-ab",title:k("git.aheadBehindTitle"),children:[n.ahead>0&&l.jsxs("span",{className:"git-ahead",children:["↑",n.ahead]}),n.behind>0&&l.jsxs("span",{className:"git-behind",children:["↓",n.behind]})]})]})}function wS({view:n}){const{status:r,diff:o,loadingDiff:p,openDiff:w,closeDiff:A,refresh:L}=n;if(o!==null||p)return l.jsxs("div",{className:"panel-body",children:[l.jsxs("div",{className:"panel-subhead",children:[l.jsxs("button",{className:"link-button",onClick:A,children:["← ",k("git.backToChanges")]}),o!==null&&l.jsxs("span",{className:"panel-subhead-title",title:o.path,children:[kf(o.path).name,o.staged&&l.jsxs("span",{className:"panel-tagline",children:[" ",k("git.stagedTag")]})]})]}),p?l.jsx("p",{className:"panel-note",children:k("git.readingDiff")}):o!==null&&l.jsx(mS,{diff:o})]});if(r.state!=="ready")return l.jsx("div",{className:"panel-body",children:l.jsx("p",{className:"panel-note",children:r.message===null?k("git.unknownState"):Et(r.message)})});const s=r.worktrees.filter(c=>!c.isCurrent);return l.jsxs("div",{className:"panel-body",children:[l.jsxs("div",{className:"panel-subhead",children:[l.jsx(yS,{status:r}),l.jsx("button",{className:"icon-button",onClick:L,title:k("git.refresh"),children:"⟳"})]}),l.jsxs("div",{className:"panel-scroll",children:[r.changes.length===0&&l.jsx("p",{className:"panel-note",children:k("git.clean")}),vS.map(c=>{const m=r.changes.filter(_=>_.stage===c.stage);return m.length===0?null:l.jsxs("section",{className:"git-group",children:[l.jsxs("h3",{className:"git-group-title",title:k(c.hint),children:[k(c.title),l.jsx("span",{className:"git-group-count",children:m.length})]}),l.jsx("ul",{className:"git-list",children:m.map(_=>{const{dir:u,name:y,isDirectory:S}=kf(_.path),E=_.oldPath!==null?`${_.oldPath} → ${_.path}`:S?k("git.newFolderTitle",{path:_.path}):_.path,g=l.jsxs(l.Fragment,{children:[l.jsx("span",{className:`git-badge git-badge-${_.kind}`,title:k(_S[_.kind]),children:gS[_.kind]}),l.jsxs("span",{className:"git-path",children:[l.jsx("span",{className:"git-path-name",children:y}),u.length>0&&l.jsx("span",{className:"git-path-dir",children:u})]})]});return l.jsx("li",{children:S?l.jsx("div",{className:"git-item git-item-static",title:E,children:g}):l.jsx("button",{className:"git-item",onClick:()=>w(_.path,_.stage==="staged"),title:E,children:g})},`${c.stage}:${_.path}`)})})]},c.stage)}),r.truncated&&l.jsx("p",{className:"panel-note",children:Bt("git.truncated")}),s.length>0&&l.jsxs("section",{className:"git-group",children:[l.jsxs("h3",{className:"git-group-title",title:k("git.worktrees.headingTitle"),children:[k("git.worktrees.heading"),l.jsx("span",{className:"git-group-count",children:s.length})]}),l.jsx("ul",{className:"git-list",children:s.map(c=>l.jsx("li",{children:l.jsxs("div",{className:"git-worktree",title:c.path,children:[l.jsx("span",{className:"git-worktree-branch",children:c.branch??k("git.worktrees.detached")}),l.jsx("span",{className:"git-worktree-path",children:c.path})]})},c.path))})]})]})]})}const bS={create:"memory.action.create","append-block":"memory.action.appendBlock","replace-block":"memory.action.replaceBlock","append-lines":"memory.action.appendLines",copy:"memory.action.copy"},SS={"AGENTS.md":["Codex","Antigravity","OpenCode"],"CLAUDE.md":["Claude Code"]};function _a(n){return n.brokenBlock||n.problem!==null}function CS(n){return n.problem==="outside"?k("memory.problem.outside"):n.problem==="encoding"?k("memory.problem.encoding"):n.brokenBlock?k("memory.problem.brokenBlock"):null}function xS(n){const r=n.files.filter(o=>!_a(o));return n.installed?{instructionFiles:r.filter(o=>o.hasBlock||o.exists).map(o=>o.name),gitMode:n.git.kind==="error"||n.git.kind==="repo"&&!n.git.ignored?"version":"ignore",importNative:!1,copyFromMainWorktree:!1}:{...bv(n),instructionFiles:r.map(o=>o.name)}}function kS(n){const r=n.files.filter(w=>w.hasBlock&&!w.blockCurrent),o=n.files.filter(w=>w.exists&&!w.hasBlock&&!_a(w)),p=w=>Yc(w.map(A=>A.name));return r.length===0?o.length===0?null:k("memory.update.missing",{files:p(o)}):o.length===0?k("memory.update.outdated",{count:r.length,files:p(r)}):k("memory.update.outdatedAndMissing",{count:r.length,outdated:p(r),missing:p(o)})}function ES(n){const r=n.replace(/^\uFEFF/,"").replace(/\r\n/g,`
131
- `),o=/^---\n[\s\S]*?\n---(?:\n|$)/.exec(r);return o===null?r:r.slice(o[0].length)}function LS(n){return n.split(/`([^`]+)`/).map((r,o)=>o%2===1?l.jsx("code",{children:r},o):r)}function TS({view:n}){var a;const{status:r,open:o,loading:p,error:w,closeNote:A,openNote:L}=n,[s,c]=O.useState(null),[m,_]=O.useState(!1),u=(r==null?void 0:r.cwd)??null;O.useEffect(()=>{c(null),_(!1)},[u]),O.useEffect(()=>{n.lastResult!==null&&(c(null),_(!1))},[n.lastResult]);const y=O.useCallback(f=>{if(r===null)return null;let d=f.replace(/^\.\//,"");try{d=decodeURIComponent(d)}catch{return null}return d===ua||r.notes.some(C=>C.name===d)?()=>L(d):null},[r,L]);if(r===null)return l.jsx("div",{className:"panel-body",children:l.jsx("p",{className:"panel-note",children:w??k("memory.loading")})});if(o!==null||p!==null){const f=(o==null?void 0:o.name)??p??"",d=f===ua?k("memory.index"):((a=r.notes.find(h=>h.name===f))==null?void 0:a.title)??f;return l.jsxs("div",{className:"panel-body",children:[l.jsxs("div",{className:"panel-subhead",children:[l.jsx("button",{className:"link-button",onClick:A,children:k("memory.back")}),l.jsx("span",{className:"panel-subhead-title",title:f,children:d})]}),o===null?l.jsx("p",{className:"panel-note",children:k("memory.note.loading")}):l.jsxs("div",{className:"panel-scroll",children:[l.jsx("div",{className:"plan-body",children:l.jsx(Qc,{text:ES(o.text),localLink:y})}),o.truncated&&l.jsx("p",{className:"panel-note",children:k("memory.note.truncated")})]})]})}const S=s??xS(r),E=r.installed?kS(r):null,g=!r.installed||m||n.planned!==null;return l.jsxs("div",{className:"panel-body",children:[l.jsx(RS,{reach:r.reach,onAdjust:r.installed&&!g&&E===null&&r.reach.some(f=>!f.reaches)?()=>_(!0):null}),l.jsxs("div",{className:"panel-scroll",children:[(w??n.lastResult)!==null&&l.jsxs("div",{className:`memory-message${w!==null?" memory-message-error":""}`,children:[l.jsx("span",{children:w??n.lastResult}),l.jsx("button",{className:"link-button",onClick:n.dismissMessage,title:k("common.dismissNotice"),children:"×"})]}),r.git.kind==="error"&&l.jsxs("div",{className:"memory-warning",children:[l.jsx("p",{className:"memory-warning-line",children:Bt("memory.git.errorWarning")}),l.jsx("pre",{className:"memory-git-message",children:Et(r.git.message)})]}),r.files.filter(_a).map(f=>l.jsx("p",{className:"memory-warning",children:f.problem==="outside"?Bt("memory.problem.outsideWarning",{file:f.name}):f.problem==="encoding"?Bt("memory.problem.encodingWarning",{file:f.name}):Bt("memory.problem.brokenBlockWarning",{file:f.name})},f.name)),!r.installed&&l.jsxs("div",{className:"memory-intro",children:[l.jsx("p",{children:k("memory.intro.what")}),l.jsx("p",{children:Bt("memory.intro.where")})]}),r.installed&&E!==null&&!g&&l.jsxs("div",{className:"memory-callout",children:[l.jsx("span",{children:E}),l.jsx("button",{className:"primary-button primary-button-small",onClick:()=>_(!0),children:k("memory.update.button")})]}),g&&(n.planned===null?l.jsx(MS,{status:r,options:S,busy:n.busy,onChange:c,onPlan:()=>{c(S),n.requestPlan(S)},onCancel:r.installed?()=>{_(!1),c(null)}:null}):l.jsx(AS,{changes:n.planned,busy:n.busy,confirmLabel:r.installed?k("memory.plan.update"):k("memory.plan.install"),onConfirm:n.install,onCancel:n.cancelPlan})),r.installed&&r.native.pending>0&&!g&&l.jsxs("div",{className:"memory-callout",children:[l.jsx("span",{children:k("memory.native.pending",{count:r.native.pending})}),l.jsx("button",{className:"primary-button primary-button-small",disabled:n.busy!==null,onClick:n.importNative,children:n.busy==="import"?k("memory.native.importing"):k("memory.native.import",{count:r.native.pending})})]}),r.installed&&l.jsx(NS,{notes:r.notes,indexExists:r.indexExists,onOpen:L}),r.globalFragments.length>0&&l.jsx(DS,{fragments:r.globalFragments})]})]})}function RS({reach:n,onAdjust:r}){return l.jsxs("div",{className:"memory-reach",children:[n.map(o=>l.jsxs("span",{className:`memory-reach-item${o.reaches?" memory-reach-on":""}`,title:k("memory.reach.title",{label:o.label,via:Et(o.via)}),children:[l.jsx("span",{className:"memory-reach-mark","aria-hidden":"true",children:o.reaches?"✓":"—"}),o.label,l.jsx("span",{className:"visually-hidden",children:o.reaches?k("memory.reach.reaches",{via:Et(o.via)}):k("memory.reach.doesNotReach",{via:Et(o.via)})})]},o.agent)),r!==null&&l.jsx("button",{className:"link-button memory-reach-adjust",onClick:r,title:k("memory.reach.adjustTitle"),children:k("memory.reach.adjust")})]})}function MS({status:n,options:r,busy:o,onChange:p,onPlan:w,onCancel:A}){const{git:L}=n,s=L.kind==="repo"?L.worktree:null,c=L.kind==="error"&&r.gitMode==="ignore",m=(_,u)=>{const y=new Set(r.instructionFiles);u?y.add(_):y.delete(_),p({...r,instructionFiles:qc.filter(S=>y.has(S))})};return l.jsxs("div",{className:"memory-form",children:[l.jsx("p",{className:"memory-section-label",children:k("memory.form.files")}),n.files.map(_=>l.jsxs("label",{className:"memory-option",title:CS(_)??void 0,children:[l.jsx("input",{type:"checkbox",checked:r.instructionFiles.includes(_.name),disabled:_a(_),onChange:u=>m(_.name,u.target.checked)}),l.jsx("code",{children:_.name}),l.jsx("span",{className:"memory-option-hint",children:Yc(SS[_.name])})]},_.name)),L.kind==="repo"&&l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"memory-section-label",children:"Git"}),l.jsxs("label",{className:"memory-option",children:[l.jsx("input",{type:"radio",name:"memory-git-mode",checked:r.gitMode==="ignore",onChange:()=>p({...r,gitMode:"ignore"})}),k("memory.git.ignore"),l.jsx("span",{className:"memory-option-hint",children:k("memory.git.ignoreHint")})]}),l.jsxs("label",{className:"memory-option",children:[l.jsx("input",{type:"radio",name:"memory-git-mode",checked:r.gitMode==="version",onChange:()=>p({...r,gitMode:"version"})}),k("memory.git.version"),l.jsx("span",{className:"memory-option-hint",children:k("memory.git.versionHint")})]}),L.ignored&&r.gitMode==="version"&&l.jsx("p",{className:"memory-warning",children:Bt("memory.git.alreadyIgnored")})]}),L.kind==="error"&&l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"memory-section-label",children:"Git"}),l.jsxs("label",{className:"memory-option",children:[l.jsx("input",{type:"radio",name:"memory-git-mode",checked:r.gitMode==="version",onChange:()=>p({...r,gitMode:"version"})}),Bt("memory.git.dontTouch"),l.jsx("span",{className:"memory-option-hint",children:k("memory.git.errorHint")})]})]}),(n.native.pending>0||(s==null?void 0:s.mainHasMemory)===!0)&&l.jsx("p",{className:"memory-section-label",children:k("memory.form.existingNotes")}),n.native.pending>0&&l.jsxs("label",{className:"memory-option",children:[l.jsx("input",{type:"checkbox",checked:r.importNative,onChange:_=>p({...r,importNative:_.target.checked})}),k("memory.form.importNative",{count:n.native.pending})]}),(s==null?void 0:s.mainHasMemory)===!0&&l.jsxs("label",{className:"memory-option",title:s.mainPath,children:[l.jsx("input",{type:"checkbox",checked:r.copyFromMainWorktree,onChange:_=>p({...r,copyFromMainWorktree:_.target.checked})}),k("memory.form.copyFromMain")]}),l.jsxs("div",{className:"memory-actions",children:[l.jsx("button",{className:"primary-button primary-button-small",disabled:o!==null||r.instructionFiles.length===0||c,onClick:w,title:r.instructionFiles.length===0?k("memory.form.noFiles"):c?k("memory.git.blocked"):void 0,children:k(o==="plan"?"memory.form.planning":"memory.form.preview")}),A!==null&&l.jsx("button",{className:"link-button",onClick:A,disabled:o!==null,children:k("common.cancel")})]})]})}function AS({changes:n,busy:r,confirmLabel:o,onConfirm:p,onCancel:w}){const A=r==="install";return l.jsxs("div",{className:"memory-form",children:[l.jsx("p",{className:"memory-section-label",children:k("memory.plan.changes")}),n.length===0?l.jsx("p",{className:"memory-empty",children:k("memory.plan.nothing")}):l.jsx("ul",{className:"memory-change-list",children:n.map((L,s)=>l.jsxs("li",{className:"memory-change",children:[l.jsxs("div",{className:"memory-change-head",children:[l.jsx("code",{className:"memory-change-file",children:L.file}),l.jsx("span",{className:"memory-option-hint",children:k(bS[L.action])})]}),L.copiedFrom!==null&&l.jsx("p",{className:"memory-option-hint",children:k("memory.plan.copiedFrom",{path:L.copiedFrom})}),L.preview.length>0&&l.jsx("pre",{className:"memory-preview",children:L.preview})]},`${L.file}-${s}`))}),l.jsxs("div",{className:"memory-actions",children:[n.length>0&&l.jsx("button",{className:"primary-button primary-button-small",disabled:r!==null,onClick:p,children:A?k("memory.plan.writing"):o}),l.jsx("button",{className:"link-button",onClick:w,disabled:A,children:n.length===0?k("memory.plan.back"):k("common.cancel")})]})]})}function NS({notes:n,indexExists:r,onOpen:o}){return l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"memory-section-label",children:k("memory.list.notes")}),l.jsxs("ul",{className:"plan-list",children:[r&&l.jsx("li",{children:l.jsxs("button",{className:"plan-row",onClick:()=>o(ua),children:[l.jsx("span",{className:"plan-name",children:k("memory.index")}),l.jsx("span",{className:"plan-meta",children:ua})]})}),n.map(p=>l.jsx("li",{children:l.jsxs("button",{className:"plan-row",onClick:()=>o(p.name),title:p.name,children:[l.jsx("span",{className:"plan-name",children:p.title}),p.description.length>0&&l.jsx("span",{className:"memory-note-description",children:p.description}),l.jsxs("span",{className:"plan-meta",children:[Fn(p.modifiedAt)," · ",nn(p.sizeBytes)]})]})},p.name))]}),n.length===0&&l.jsx("p",{className:"memory-empty",children:k("memory.list.empty")})]})}function DS({fragments:n}){const r=O.useCallback(o=>{navigator.clipboard.writeText(o).catch(()=>{})},[]);return l.jsxs("details",{className:"memory-global",children:[l.jsx("summary",{className:"memory-global-summary",children:k("memory.global.title")}),l.jsx("p",{className:"memory-empty",children:Bt("memory.global.intro")}),n.map(o=>l.jsxs("div",{className:"memory-fragment",children:[l.jsxs("div",{className:"memory-change-head",children:[l.jsx("span",{className:"memory-fragment-label",children:o.label}),l.jsx("code",{className:"memory-fragment-target",title:o.target,children:o.target})]}),l.jsxs("div",{className:"memory-fragment-body",children:[l.jsx("pre",{className:"memory-preview",children:o.text}),l.jsx(uS,{className:"icon-button",title:k("memory.global.copy"),onCopy:()=>r(o.text)})]}),l.jsx("p",{className:"memory-fragment-note",children:LS(Et(o.note))})]},o.agent))]})}function IS(n){for(const r of n.split(`
132
- `,40)){const o=/^#{1,3}\s+(.+)$/.exec(r.trim());if(o!==null)return(o[1]??"").trim()}return null}function PS({view:n}){var L,s;const{plans:r,open:o,loading:p,openPlan:w,closePlan:A}=n;if(o!==null||p!==null){const c=((L=r.find(u=>u.fileName===(o==null?void 0:o.fileName)))==null?void 0:L.path)??null,m=((s=r.find(u=>u.fileName===(o==null?void 0:o.fileName)))==null?void 0:s.title)??null,_=o===null?p:IS(o.text)??m??p;return l.jsxs("div",{className:"panel-body",children:[l.jsxs("div",{className:"panel-subhead",children:[l.jsxs("button",{className:"link-button",onClick:A,children:["← ",k("plans.backToList")]}),l.jsx("span",{className:"panel-subhead-title",title:c??void 0,children:_})]}),o===null?l.jsx("p",{className:"panel-note",children:k("plans.loading")}):l.jsxs("div",{className:"panel-scroll",children:[l.jsx("div",{className:"plan-body",children:l.jsx(Qc,{text:o.text})}),o.truncated&&l.jsx("p",{className:"panel-note",children:k("plans.truncated")})]})]})}return l.jsx("div",{className:"panel-body",children:l.jsx("div",{className:"panel-scroll",children:r.length===0?l.jsx("p",{className:"panel-note",children:Bt("plans.empty")}):l.jsx("ul",{className:"plan-list",children:[...r].reverse().map(c=>l.jsx(jS,{plan:c,onOpen:()=>w(c)},c.fileName))})})})}function jS({plan:n,onOpen:r}){const o=n.path.length>0?n.path:null;return n.exists?l.jsx("li",{children:l.jsxs("button",{className:"plan-row",onClick:r,title:o??void 0,children:[l.jsx("span",{className:"plan-name",children:n.title}),o!==null&&l.jsx("span",{className:"plan-path",children:o}),l.jsxs("span",{className:"plan-meta",children:[Fn(n.modifiedAt)," · ",nn(n.sizeBytes)]})]})}):l.jsxs("li",{className:"plan-row plan-row-missing",title:o??k("plans.missingTitle"),children:[l.jsx("span",{className:"plan-name",children:n.title}),o!==null&&l.jsx("span",{className:"plan-path",children:o}),l.jsx("span",{className:"plan-meta",children:k("plans.missing")})]})}const OS=[{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 ym(n){return n.state!=="ready"?0:new Set(n.changes.map(r=>r.path)).size}function BS({tab:n,plansAvailable:r,hidden:o,onTabChange:p,title:w,cwd:A,platform:L,cli:s,cliUnseen:c,expanded:m,onToggleExpanded:_,git:u,files:y,plans:S,memory:E,onInsert:g,onInsertPath:a,onReveal:f,onHide:d}){var D;const h=ym(u.status),C=((D=E.status)==null?void 0:D.installed)===!0?E.status.notes.length:0;return l.jsxs("section",{className:`side-panel${o?" side-panel-hidden":""}`,"aria-hidden":o,children:[l.jsxs("header",{className:"side-panel-header",children:[l.jsx("button",{className:"icon-button",onClick:d,title:k("panel.hide"),children:"»"}),A.length>0&&l.jsx("span",{className:"project-swatch",style:{background:Zr(A)}}),l.jsx("span",{className:"side-panel-title",title:A,children:w}),l.jsx("button",{className:"icon-button",onClick:_,title:k(m?"panel.restoreWidth":"panel.widen"),children:m?"⇥":"⇤"})]}),l.jsx("nav",{className:"side-panel-tabs",children:$0(OS,r).map(x=>l.jsxs("button",{className:`side-panel-tab${x.id===n?" side-panel-tab-active":""}`,onClick:()=>p(x.id),title:k(x.labelKey),children:[l.jsx("span",{className:"side-panel-tab-label",children:k(x.labelKey)}),x.id==="git"&&h>0&&l.jsx("span",{className:"side-panel-badge",children:h}),x.id==="plans"&&S.plans.length>0&&l.jsx("span",{className:"side-panel-badge",children:S.plans.length}),x.id==="memory"&&C>0&&l.jsx("span",{className:"side-panel-badge",children:C}),x.id==="cli"&&c&&n!=="cli"&&l.jsx("span",{className:"side-panel-dot",title:k("panel.cliUnseen")})]},x.id))}),l.jsxs("div",{className:"side-panel-body",children:[l.jsx("div",{className:`cli-slot${n==="cli"?"":" cli-slot-hidden"}`,children:s}),n==="git"&&l.jsx(wS,{view:u}),n==="plans"&&l.jsx(PS,{view:S}),n==="memory"&&l.jsx(TS,{view:E}),n==="files"&&l.jsx(hS,{view:y,cwd:A,platform:L,onInsert:g,onInsertPath:a,onReveal:f})]})]})}function FS({placement:n}){return l.jsxs("div",{className:"tab tab-pending","aria-busy":"true",title:`${n.pending.cwd}
133
- ${k("tabs.state.opening")}`,style:{"--tab-project-color":Zr(n.pending.cwd)},children:[l.jsx("span",{className:"tab-opening","aria-label":k("tabs.aria.opening"),children:l.jsx("i",{})}),l.jsx("span",{className:"tab-label",children:n.label})]})}function nu({terminal:n,activity:r,statusLine:o}){if(!n.alive){const p=n.sleeping;return l.jsx("span",{className:`tab-dot${p?" tab-dot-sleeping":" tab-dot-dead"}`,title:k(p?"tabs.dot.sleeping":"tabs.dot.exited")})}return r==="waiting"?l.jsx("span",{className:"tab-bang",title:k("tabs.dot.waiting"),children:"!"}):r==="busy"?l.jsxs("span",{className:"tab-working",title:k("tabs.dot.busy"),"aria-label":k("tabs.aria.working"),children:[l.jsx("i",{}),l.jsx("i",{}),l.jsx("i",{})]}):l.jsx("span",{className:"tab-dot",title:J0(r,o)})}function Wi(n){if(n.label.length>0)return n.label;const r=n.cwd.split(/[\\/]/).filter(p=>p.length>0),o=r[r.length-1]??n.cwd;return n.resumed?`${o} ↩`:o}function HS(n){return n.alive?k("tabs.state.alive"):n.sleeping?k("tabs.state.sleeping"):k("tabs.state.exited",{code:n.exitCode??"?"})}function $S({terminals:n,activeTerminalId:r,activity:o,canOpen:p,onSelect:w,onClose:A,onRename:L,onReorder:s,onNew:c,agents:m,offerAgentChoice:_,newTabAgent:u,pendingOpens:y,platform:S,newTabBlockedTitle:E}){const[g,a]=O.useState(null),[f,d]=O.useState(""),[h,C]=O.useState(null),D=O.useRef(null);O.useEffect(()=>{var P;g!==null&&((P=D.current)==null||P.select())},[g]);const x=P=>{a(P.terminalId),d(P.label.length>0?P.label:Wi(P))},M=()=>{g!==null&&L(g,f.trim()),a(null)},b=P=>{if(h===null||h===P)return;const B=n.map(X=>X.terminalId),H=B.indexOf(h),q=B.indexOf(P);H===-1||q===-1||(B.splice(q,0,...B.splice(H,1)),s(B),C(null))},T=Ey(n,y,S),N=new Map;for(const P of T){const B=N.get(P.index);B===void 0?N.set(P.index,[P]):B.push(P)}const F=P=>(N.get(P)??[]).map(B=>l.jsx(FS,{placement:B},`pending:${B.pending.requestId}`));return l.jsxs("div",{className:"tab-bar",children:[n.map((P,B)=>{var X;const H=P.terminalId===r,q=P.terminalId===g;return l.jsxs(h_.Fragment,{children:[F(B),l.jsx("div",{className:`tab${H?" tab-active":""}${P.alive||P.sleeping?"":" tab-dead"}`,draggable:!q,onDragStart:()=>C(P.terminalId),onDragOver:G=>G.preventDefault(),onDrop:()=>b(P.terminalId),onDragEnd:()=>C(null),onClick:()=>w(P.terminalId),onDoubleClick:()=>x(P),title:`${P.cwd}
134
- ${HS(P)}`,style:{"--tab-project-color":Zr(P.cwd)},children:q?l.jsx("input",{ref:D,className:"tab-input",value:f,onChange:G=>d(G.target.value),onBlur:M,onKeyDown:G=>{G.key==="Enter"&&M(),G.key==="Escape"&&a(null),G.stopPropagation()},onClick:G=>G.stopPropagation()}):l.jsxs(l.Fragment,{children:[l.jsx(nu,{terminal:P,activity:o.get(P.terminalId),statusLine:((X=m.find(G=>G.id===P.agent))==null?void 0:X.statusLine)??null}),l.jsxs("span",{className:"tab-label",children:[P.agent!==null&&dy(_,P.agent)&&l.jsx(Hc,{agent:P.agent,agents:m}),Wi(P)]}),l.jsx("button",{className:"tab-close",onClick:G=>{G.stopPropagation(),A(P.terminalId)},title:k("tabs.close"),children:"×"})]})})]},P.terminalId)}),F(n.length),l.jsx(Jc,{className:"tab-new",text:"+",title:E??k("tabs.new"),disabled:!p||E!==null,offerAgentChoice:_,agents:m,agent:u,onOpen:c})]})}function US(n,r,o){const[p,w]=O.useState(!1);return O.useEffect(()=>{if(w(!1),!(r===null||o))return n.onMessage(A=>{A.type==="terminal.output"&&A.terminalId===r&&w(!0)})},[n,r,o]),p&&!o}const WS=200,Ef="agent-workbench.files.hidden";function zS(n,r){const[o,p]=O.useState(new Map),[w,A]=O.useState(new Set),[L,s]=O.useState(new Set),[c,m]=O.useState(null),[_,u]=O.useState(!1),[y,S]=O.useState(""),[E,g]=O.useState(null),[a,f]=O.useState(!1),[d,h]=O.useState(()=>bt(Ef,!1,P=>P==="true"?!0:P==="false"?!1:null)),C=O.useRef(new Set),D=O.useRef(d);D.current=d;const x=O.useCallback(P=>{r===null||C.current.has(P)||(C.current.add(P),s(B=>new Set(B).add(P)),n.send({type:"files.list",terminalId:r,path:P,includeHidden:D.current}))},[n,r]);O.useEffect(()=>{if(p(new Map),A(new Set),s(new Set),m(null),u(!1),S(""),g(null),f(!1),C.current=new Set,r===null)return;const P=n.onMessage(H=>{switch(H.type){case"files.listing":{if(H.terminalId!==r)break;const{listing:q}=H;C.current.delete(q.path),p(X=>new Map(X).set(q.path,q)),s(X=>{const G=new Set(X);return G.delete(q.path),G});break}case"files.results":if(H.terminalId!==r)break;g(H.result),f(!1);break;case"files.preview":if(H.terminalId!==r)break;m(H.preview),u(!1);break;case"error":C.current=new Set,s(new Set),u(!1),f(!1);break}});n.send({type:"files.list",terminalId:r,path:"",includeHidden:D.current}),C.current.add(""),s(new Set([""]));const B=n.onReopen(()=>{C.current=new Set,n.send({type:"files.list",terminalId:r,path:"",includeHidden:D.current})});return()=>{P(),B()}},[n,r]),O.useEffect(()=>{const P=y.trim();if(r===null||P.length===0){g(null),f(!1);return}f(!0);const B=window.setTimeout(()=>{n.send({type:"files.search",terminalId:r,query:P,includeHidden:D.current})},WS);return()=>window.clearTimeout(B)},[n,r,y,d]);const M=O.useCallback(P=>{A(B=>{const H=new Set(B);return H.has(P)?H.delete(P):(H.add(P),x(P)),H})},[x]),b=O.useCallback(P=>{r!==null&&(u(!0),m(null),n.send({type:"files.read",terminalId:r,path:P}))},[n,r]),T=O.useCallback(()=>{m(null),u(!1)},[]),N=O.useCallback(()=>{if(r===null)return;C.current=new Set;const P=["",...w];for(const B of P)C.current.add(B),n.send({type:"files.list",terminalId:r,path:B,includeHidden:D.current});s(new Set(P))},[n,r,w]),F=O.useCallback(()=>{h(P=>{const B=!P;if(D.current=B,ft(Ef,String(B)),r!==null){C.current=new Set;const H=["",...w];for(const q of H)C.current.add(q),n.send({type:"files.list",terminalId:r,path:q,includeHidden:B});s(new Set(H))}return B})},[n,r,w]);return{listings:o,expanded:w,loading:L,preview:c,loadingPreview:_,query:y,setQuery:S,results:E,searching:a,showHidden:d,toggleHidden:F,toggleDirectory:M,openFile:b,closePreview:T,refresh:N}}function VS(n){const[r,o]=O.useState(!1),[p,w]=O.useState(null),[A,L]=O.useState(null),[s,c]=O.useState(null),m=O.useRef(null);O.useEffect(()=>{const y=n.onMessage(E=>{switch(E.type){case"search.progress":if(m.current===null||E.searchId!==m.current)break;w(g=>_b(g,E.progress));break;case"search.results":if(m.current===null||E.searchId!==m.current)break;m.current=null,w(E.result),L(null),o(!1);break;case"error":if(E.code!=="search-failed"||m.current===null||E.requestId!==m.current)break;m.current=null,E.detail!==void 0&&console.error("[servidor]",E.detail),w(null),L(Et(E.text)),o(!1);break}}),S=n.onReopen(()=>{m.current!==null&&(m.current=null,o(!1),L(k("searchHook.connectionLost")))});return()=>{y(),S()}},[n]);const _=O.useCallback((y,S)=>{const E=crypto.randomUUID();m.current=E,c({query:y,includeArchived:S}),o(!0),L(null),w(null),n.send({type:"search.global",searchId:E,query:y,includeArchived:S})},[n]),u=O.useCallback(()=>{const y=m.current;m.current=null,y!==null&&n.send({type:"search.cancel",searchId:y}),c(null),o(!1),w(null),L(null)},[n]);return{searching:r,result:p,error:A,submitted:s,search:_,clear:u}}function qS(n,r){const[o,p]=O.useState([]),[w,A]=O.useState(null),[L,s]=O.useState(null);O.useEffect(()=>{if(p([]),A(null),s(null),r!==null)return n.onMessage(_=>{switch(_.type){case"conversation.plans":if(_.terminalId!==r)break;p(_.plans);break;case"plans.content":if(_.terminalId!==r)break;A(_.plan),s(null);break;case"error":s(null);break}})},[n,r]);const c=O.useCallback(_=>{r!==null&&(s(_.title),A(null),n.send({type:"plans.read",terminalId:r,fileName:_.fileName}))},[n,r]),m=O.useCallback(()=>{A(null),s(null)},[]);return{plans:o,open:w,loading:L,openPlan:c,closePlan:m}}function KS(n,r){const[o,p]=O.useState(rc),[w,A]=O.useState(null),[L,s]=O.useState(!1);O.useEffect(()=>{if(r===null){p(rc),A(null);return}p(rc),A(null),s(!1);const u=n.onMessage(S=>{switch(S.type){case"git.status":S.terminalId===r&&p(S.status);break;case"git.diff":if(S.terminalId!==r)break;A(S.diff),s(!1);break;case"error":s(!1);break}});n.send({type:"git.subscribe",terminalId:r});const y=n.onReopen(()=>{n.send({type:"git.subscribe",terminalId:r})});return()=>{u(),y(),n.send({type:"git.unsubscribe",terminalId:r})}},[n,r]);const c=O.useCallback((u,y)=>{r!==null&&(s(!0),A(null),n.send({type:"git.diff",terminalId:r,path:u,staged:y}))},[n,r]),m=O.useCallback(()=>{A(null),s(!1)},[]),_=O.useCallback(()=>{r!==null&&n.send({type:"git.refresh",terminalId:r})},[n,r]);return{status:o,diff:w,loadingDiff:L,openDiff:c,closeDiff:m,refresh:_}}const Uc=new Set;function GS(n){return n!==void 0&&Uc.has(n)}function YS(n){return n.length===0?k("memory.result.nothingChanged"):k("memory.result.installed",{count:n.length})}function XS(n,r){const o=n.length===0?k("memory.result.nothingImported"):k("memory.result.imported",{count:n.length});return r.length===0?o:k("memory.result.withSkipped",{result:o,skipped:k("memory.result.skipped",{count:r.length,files:r.join(", ")})})}function QS(n,r){const[o,p]=O.useState(null),[w,A]=O.useState(null),[L,s]=O.useState(null),[c,m]=O.useState(null),[_,u]=O.useState(null),[y,S]=O.useState(null),[E,g]=O.useState(null),a=O.useRef(new Map),f=O.useRef(new Set),d=O.useRef(null),h=O.useRef(!1),C=O.useCallback(H=>{const q=`memory-${crypto.randomUUID()}`;return a.current.set(q,H),f.current.add(q),Uc.add(q),q},[]),D=O.useCallback(H=>{for(const[q,X]of a.current)X===H&&a.current.delete(q)},[]);O.useEffect(()=>{p(null),A(null),s(null),m(null),u(null),S(null),g(null),a.current.clear();for(const j of f.current)Uc.delete(j);if(f.current.clear(),d.current=null,h.current=!1,r===null)return;const H=(j,U)=>j===void 0||a.current.get(j)!==U?!1:(a.current.delete(j),!0),q=n.onMessage(j=>{switch(j.type){case"memory.status":if(j.terminalId!==r)break;p(j.status),h.current&&(h.current=!1,g(null));break;case"memory.planned":if(j.terminalId!==r||!H(j.requestId,"plan"))break;m(j.changes),u(null);break;case"memory.installed":if(j.terminalId!==r||!H(j.requestId,"install"))break;d.current=null,m(null),u(null),S(YS(j.applied));break;case"memory.imported":if(j.terminalId!==r||!H(j.requestId,"import"))break;u(null),S(XS(j.copied,j.skipped));break;case"memory.content":if(j.terminalId!==r||!H(j.requestId,"read"))break;A(j.note),s(null);break;case"error":{const U=j.requestId,$=U===void 0?void 0:a.current.get(U);if(U===void 0||$===void 0)break;a.current.delete(U),$==="read"?s(null):$!=="subscribe"&&u(null),g(Et(j.text)),h.current=$==="subscribe";break}}}),X=n.onStatus(j=>{if(j!=="reconnecting"&&j!=="failed")return;const U=new Set(a.current.values());a.current.clear(),u(null),s(null),(U.has("install")||U.has("import"))&&(d.current=null,m(null),g(k("memory.error.connectionLost")))}),G=()=>{n.send({type:"memory.subscribe",terminalId:r,requestId:C("subscribe")})};G();const Y=n.onReopen(G);return()=>{q(),X(),Y(),n.send({type:"memory.unsubscribe",terminalId:r})}},[n,r,C]);const x=O.useCallback(()=>{h.current=!1,g(null),S(null)},[]),M=O.useCallback(H=>{r!==null&&(D("read"),x(),s(H),A(null),n.send({type:"memory.read",terminalId:r,name:H,requestId:C("read")}))},[n,r,x,D,C]),b=O.useCallback(()=>{D("read"),A(null),s(null)},[D]),T=O.useCallback(H=>{r!==null&&(x(),d.current=H,m(null),u("plan"),n.send({type:"memory.plan",terminalId:r,options:H,requestId:C("plan")}))},[n,r,x,C]),N=O.useCallback(()=>{const H=d.current;r===null||H===null||(x(),u("install"),n.send({type:"memory.install",terminalId:r,options:H,requestId:C("install")}))},[n,r,x,C]),F=O.useCallback(()=>{r!==null&&(x(),u("import"),n.send({type:"memory.import",terminalId:r,requestId:C("import")}))},[n,r,x,C]),P=O.useCallback(()=>{D("plan"),d.current=null,m(null)},[D]),B=O.useCallback(()=>{h.current=!1,g(null),S(null)},[]);return{status:o,open:w,loading:L,planned:c,busy:_,lastResult:y,error:E,openNote:M,closeNote:b,requestPlan:T,install:N,importNative:F,cancelPlan:P,dismissMessage:B}}function JS(n){const[r,o]=O.useState([]),[p,w]=O.useState({}),[A,L]=O.useState(null),s=O.useRef(new Set);O.useEffect(()=>{const a=n.onMessage(d=>{switch(d.type){case"notes.list":o(d.notes);break;case"notes.imageData":s.current.add(d.imageId),w(h=>({...h,[d.imageId]:d.data===null?null:`data:${d.mediaType};base64,${d.data}`}));break;case"error":d.code==="notes-failed"&&L(Et(d.text));break}}),f=n.onReopen(()=>{s.current.clear()});return()=>{a(),f()}},[n]);const c=O.useCallback(a=>{s.current.has(a)||(s.current.add(a),n.send({type:"notes.image",imageId:a}))},[n]),m=O.useCallback(()=>{const a=crypto.randomUUID(),f=Date.now();return o(d=>[...d,{noteId:a,text:"",images:[],createdAt:f,updatedAt:f}]),n.send({type:"notes.create",noteId:a}),a},[n]),_=O.useCallback((a,f)=>{o(d=>d.map(h=>h.noteId===a?{...h,text:f,updatedAt:Date.now()}:h)),n.send({type:"notes.update",noteId:a,text:f})},[n]),u=O.useCallback(a=>{o(f=>f.filter(d=>d.noteId!==a)),n.send({type:"notes.delete",noteId:a})},[n]),y=O.useCallback((a,f)=>{const d=r.find(C=>C.noteId===a);if(d!==void 0&&d.images.length>=Td){L(k("notes.tooManyImages",{count:Td}));return}if(f.size>ha){L(k("notes.imageTooBig",{name:f.name||k("notes.imageFallbackName"),size:Math.round(f.size/1024/1024),max:ha/1024/1024}));return}const h=new FileReader;h.onload=()=>{const C=h.result;if(typeof C!="string")return;const D=C.indexOf(",");D!==-1&&n.send({type:"notes.addImage",noteId:a,image:{mediaType:f.type,data:C.slice(D+1)}})},h.onerror=()=>L(k("notes.readFailed")),h.readAsDataURL(f)},[n,r]),S=O.useCallback((a,f)=>{o(d=>d.map(h=>h.noteId===a?{...h,images:h.images.filter(C=>C.imageId!==f)}:h)),n.send({type:"notes.removeImage",noteId:a,imageId:f})},[n]),E=O.useCallback((a,f)=>{n.send({type:"notes.send",noteId:a,terminalId:f})},[n]),g=O.useCallback(()=>L(null),[]);return{notes:r,images:p,problem:A,requestImage:c,create:m,updateText:_,remove:u,addImage:y,removeImage:S,sendToAgent:E,dismissProblem:g}}const wm="agent-workbench.theme",bc=["system","light","dark"],ZS={system:"theme.system",light:"theme.light",dark:"theme.dark"};function Lf(n){return k("theme.title",{theme:k(ZS[n])})}const Tf={system:"◐",light:"☀",dark:"☾"};function eC(){return bt(wm,"system",n=>n==="light"||n==="dark"||n==="system"?n:null)}function tC(){return window.matchMedia("(prefers-color-scheme: dark)").matches}function nC(){const[n,r]=O.useState(eC),[o,p]=O.useState(tC);O.useEffect(()=>{const L=window.matchMedia("(prefers-color-scheme: dark)"),s=c=>p(c.matches);return L.addEventListener("change",s),()=>L.removeEventListener("change",s)},[]);const w=n==="system"?o?"dark":"light":n;O.useEffect(()=>{document.documentElement.dataset.theme=w,document.documentElement.style.colorScheme=w},[w]);const A=O.useCallback(()=>{r(L=>{const s=bc[(bc.indexOf(L)+1)%bc.length]??"system";return ft(wm,s),s})},[]);return{preference:n,resolved:w,cycle:A}}const rC=1500;function sC(n,r){return n===void 0||n===r?null:r==="waiting"?"attention":r==="idle"&&n==="busy"?"done":null}function iC(n,r){const o={now:[],later:[],cancel:[]};for(const[p,w]of r){const A=n.get(p);if(A===w)continue;o.cancel.push(p);const L=sC(A,w);L==="attention"?o.now.push(p):L==="done"&&o.later.push(p)}for(const p of n.keys())r.has(p)||o.cancel.push(p);return o}const Rf="agent-workbench.phone-chime";function oC(n){return n==="system"||n==="page"?n:null}function aC(n){return`agentworkbench://chime?source=${n}`}function lC(n,r,o,p){return n?r==="page"?va:null:o?Gi(p):null}const Mf="agent-workbench.sound";function cC(n){return n==="on"?!0:n==="off"?!1:null}function uC(n){return k(n?"sound.on":"sound.off")}function hC(n,r){return n&&r>0}const dC={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}]},bm=.02,va=.8,Sm=.2,Af="agent-workbench.sound-volume";function Gi(n){return Math.min(va,Math.max(bm,n))}function fC(n){if(n.trim().length===0)return null;const r=Number(n);return Number.isFinite(r)?Gi(r):null}function pC(n){return Math.round(Gi(n)/va*100)}class mC{constructor(){Mt(this,"context",null);Mt(this,"volume",Sm)}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 r;return((r=this.context)==null?void 0:r.state)==="running"}play(r){const o=this.context;if(o===null||o.state!=="running")return;const p=o.currentTime+.01;for(const w of dC[r]){const A=o.createOscillator(),L=o.createGain();A.type="sine",A.frequency.value=w.frequency;const s=p+w.at;L.gain.setValueAtTime(1e-4,s),L.gain.exponentialRampToValueAtTime(Gi(this.volume),s+.012),L.gain.exponentialRampToValueAtTime(1e-4,s+w.duration),A.connect(L),L.connect(o.destination),A.start(s),A.stop(s+w.duration+.02)}}}const Sc="agent-workbench.notify";function gC(n){return n==="on"?!0:n==="off"?!1:null}function _C(n,r,o){return n&&r==="granted"&&!o}function vC(n,r){return k(r==="denied"?"sound.notify.blocked":n?"sound.notify.on":"sound.notify.off")}function yC(n,r){return n==="attention"?k("notify.attention",{tab:r}):k("notify.done",{tab:r})}function wC(n){return n===void 0?"":n.label.length>0?n.label:n.cwd.split(/[\\/]/).filter(r=>r.length>0).pop()??n.cwd}function Fi(){return typeof window>"u"||!("Notification"in window)||!window.isSecureContext?"unsupported":Notification.permission}async function bC(){if(Fi()==="unsupported")return"unsupported";try{return await Notification.requestPermission()}catch{return Fi()}}function SC(){return document.visibilityState==="visible"&&document.hasFocus()}function CC(n){try{const r=new Notification("Agent Workbench",{body:yC(n.chime,n.tabName),tag:`agent-workbench:${n.terminalId}`});r.onclick=()=>{window.focus(),n.onClick(),r.close()}}catch{}}function xC(n,r){const[o,p]=O.useState(()=>bt(Mf,!0,cC)),w=O.useRef(o);w.current=o;const[A,L]=O.useState(()=>bt(Af,Sm,fC)),s=O.useRef(A);s.current=A;const[c]=O.useState(()=>typeof navigator<"u"&&$p(navigator.userAgent)),[m,_]=O.useState(()=>bt(Rf,"system",oC)),u=O.useRef(m);u.current=m;const[y,S]=O.useState(()=>Fi()),[E,g]=O.useState(()=>bt(Sc,!1,gC)),a=O.useRef(E);a.current=E;const f=O.useRef(r);f.current=r;const d=O.useCallback((H,q)=>{_C(a.current,Fi(),SC())&&CC({chime:H,terminalId:q,tabName:f.current.nameOf(q),onClick:()=>f.current.activate(q)})},[]),h=O.useRef(null),C=O.useRef(new Map),D=O.useRef(new Map),x=O.useCallback(H=>{const q=h.current,X=lC(c,u.current,w.current,s.current);q===null||X===null||(q.volume=X,q.play(H))},[c]);O.useEffect(()=>{const H=new mC;H.volume=s.current,h.current=H;const q=()=>{H.unlock(),H.ready&&(window.removeEventListener("pointerdown",q),window.removeEventListener("keydown",q))};return window.addEventListener("pointerdown",q),window.addEventListener("keydown",q),()=>{window.removeEventListener("pointerdown",q),window.removeEventListener("keydown",q),h.current=null}},[]),O.useEffect(()=>{const H=iC(C.current,n);C.current=new Map(n);const q=D.current;for(const X of H.cancel){const G=q.get(X);G!==void 0&&(window.clearTimeout(G),q.delete(X))}H.now.length>0&&x("attention");for(const X of H.now)d("attention",X);for(const X of H.later)q.set(X,window.setTimeout(()=>{q.delete(X),x("done"),d("done",X)},rC))},[n,d,x]),O.useEffect(()=>{const H=D.current;return()=>{for(const q of H.values())window.clearTimeout(q);H.clear()}},[]);const M=O.useCallback(()=>{var H,q;p(X=>{const G=!X;return ft(Mf,G?"on":"off"),G}),w.current||((H=h.current)==null||H.unlock(),(q=h.current)==null||q.play("done"))},[]),b=O.useCallback(H=>{const q=Gi(H);L(q),ft(Af,String(q)),h.current!==null&&(h.current.volume=q)},[]),T=O.useCallback(()=>{var H,q;w.current&&((H=h.current)==null||H.unlock(),(q=h.current)==null||q.play("done"))},[]),N=O.useCallback(()=>{if(a.current&&Fi()==="granted"){g(!1),ft(Sc,"off");return}bC().then(H=>{S(H),H==="granted"&&(g(!0),ft(Sc,"on"))})},[]),F={supported:y!=="unsupported",enabled:E&&y==="granted",permission:y,toggle:N},P=O.useCallback(H=>{var q;_(H),u.current=H,ft(Rf,H),window.location.href=aC(H),H==="page"&&((q=h.current)==null||q.unlock(),x("done"))},[x]);return{enabled:o,toggle:M,volume:A,setVolume:b,previewVolume:T,notify:F,phoneChime:c?{source:m,setSource:P}:null}}function Cm(n,r,o){const[p,w]=O.useState(()=>bt(n,r,y1));O.useLayoutEffect(()=>{document.documentElement.dataset[o]=p},[o,p]);const A=O.useCallback(()=>{w(L=>{const s=Jp(L);return ft(n,s),s})},[n]);return{size:p,cycle:A}}function kC(){return Cm(m1,Qp,"threadFont")}function EC(){return Cm(g1,_1,"notesFont")}function LC(n,r){const[o,p]=O.useState(()=>new Map),[w,A]=O.useState(()=>new Map),L=O.useCallback((c,m,_,u)=>{p(y=>new Map(y).set(c,{requestId:m,terminalId:c,afterEventId:_,phase:"sending",queued:u,sentAt:Date.now(),deliveredAt:null}))},[]);O.useEffect(()=>{const c=n.onMessage(_=>{_.type==="agent.submitted"&&p(u=>kw(u,_,Date.now()))}),m=n.onReopen(()=>p(_=>xw(_,Date.now())));return()=>{c(),m()}},[n]);const s=O.useRef(new Map);return O.useLayoutEffect(()=>{const c=s.current;if(c===r)return;s.current=r;const m=Date.now();A(_=>Cw(c,r,_,m))},[r]),{track:L,receipts:o,clocks:w}}const TC=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]);function xm({sound:n}){return l.jsxs("span",{className:"sound-control",children:[l.jsx("button",{className:`icon-button${hC(n.enabled,n.volume)?" icon-button-on":""}`,onClick:n.toggle,title:uC(n.enabled),"aria-pressed":n.enabled,children:"♪"}),n.enabled&&l.jsx("div",{className:"sound-volume",children:l.jsxs("div",{className:"sound-volume-box",children:[l.jsx("input",{className:"sound-volume-slider",type:"range",min:bm,max:va,step:.01,value:n.volume,onChange:r=>n.setVolume(Number(r.target.value)),onPointerUp:n.previewVolume,onKeyUp:r=>{TC.has(r.key)&&n.previewVolume()},title:k("sound.volume"),"aria-label":k("sound.volume")}),l.jsxs("span",{className:"sound-volume-value",children:[pC(n.volume),"%"]})]})})]})}function km({notify:n}){return n.supported?l.jsx("button",{className:`icon-button${n.enabled?" icon-button-on":""}`,onClick:n.toggle,title:vC(n.enabled,n.permission),"aria-pressed":n.enabled,children:l.jsx(RC,{})}):null}function RC(){return l.jsx("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",focusable:"false",children:l.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 MC(n){const[r,o]=O.useState(null),[p,w]=O.useState(null),[A,L]=O.useState(null),[s,c]=O.useState(!1),[m,_]=O.useState(null);O.useEffect(()=>{const C=n.onMessage(x=>{switch(x.type){case"remote.status":o(x.status),x.status.pairingActive||(w(null),L(null));break;case"remote.pairing.code":w(x.pairing),L(null);break;case"remote.phone.pairing":L(x.pairing),w(null);break;case"error":if(x.code!=="remote-failed")break;_(Et(x.text)),x.detail!==void 0&&console.error("[servidor]",x.detail);break}}),D=n.onReopen(()=>{w(null),L(null),c(!1)});return()=>{C(),D()}},[n]);const u=O.useCallback(C=>{_(null),n.send({type:"remote.configure",enabled:C})},[n]),y=O.useCallback(C=>{_(null),n.send({type:"remote.configure",port:C})},[n]),S=O.useCallback(()=>{_(null),n.send({type:"remote.pairing.start"})},[n]),E=O.useCallback(()=>{w(null),n.send({type:"remote.pairing.cancel"})},[n]),g=O.useCallback(()=>{_(null),c(!0),n.send({type:"remote.phone.start"})},[n]),a=O.useCallback(()=>{L(null),c(!1),n.send({type:"remote.phone.cancel"})},[n]),f=O.useCallback((C,D)=>{_(null),n.send({type:"remote.device.rename",deviceId:C,label:D})},[n]),d=O.useCallback(C=>{_(null),n.send({type:"remote.device.revoke",deviceId:C})},[n]),h=O.useCallback(()=>_(null),[]);return{status:r,pairing:p,phonePairing:A,phoneStarted:s,problem:m,setEnabled:u,setPort:y,startPairing:S,cancelPairing:E,startPhonePairing:g,cancelPhonePairing:a,renameDevice:f,revokeDevice:d,dismissProblem:h}}const AC="USER";function NC(n,r){const o=n.sshUser.length>0?n.sshUser:AC,p=/\s/.test(o)?`"${o}@${r}"`:`${o}@${r}`;return`ssh -N -L ${n.port}:127.0.0.1:${n.port} ${p}`}function Em(n){return`http://localhost:${n}`}function DC(n,r){return`${Em(n)}/?${Uv}=${r}`}function Nf(n){return n[0]??"localhost"}function Wc(n,r){switch(n){case"off":return k("remote.state.off");case"active":return k("remote.state.active",{port:r});case"restart-needed":return k("remote.state.restartNeeded");case"port-busy":return k("remote.state.portBusy",{port:r})}}function IC(n){const r=n.trim();if(!/^\d{1,5}$/.test(r))return null;const o=Number(r);return zv(o)?o:null}function PC(){return k("remote.portInvalid",{min:dp,max:fp})}function Df(n,r){return Math.max(0,Math.ceil((n-r)/1e3))}function If(n){return`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`}function jC(n,r=Date.now()){return n.connected?k("remote.device.connected"):n.lastSeenAt===null?k("remote.device.never"):k("remote.device.lastSeen",{when:Fn(n.lastSeenAt,r)})}function OC(n,r=Date.now()){return k("remote.device.paired",{when:Fn(n.createdAt,r)})}function BC(n){switch(n){case"powershell-admin":return k("remote.phone.authorize.admin");case"powershell":return k("remote.phone.authorize.powershell");case"terminal":return k("remote.phone.authorize.terminal")}}function FC(){return[{platform:"win32",label:"Windows",hint:k("remote.ssh.windows"),command:["Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0","Start-Service sshd","Set-Service -Name sshd -StartupType Automatic"].join(`
135
- `)},{platform:"darwin",label:"macOS",hint:k("remote.ssh.macos"),command:null},{platform:"linux",label:"Linux",hint:k("remote.ssh.linux"),command:["sudo apt install openssh-server","sudo systemctl enable --now ssh"].join(`
136
- `)}]}function HC(n){return n==="win32"||n==="darwin"?n:"linux"}function oa(n){return n!==null&&n.state==="active"}function Pf(n){return n!==null&&n.state==="active"&&n.devices.length>0}const qs=function(n,r){let w=n;const A=Bi[r];let L=null,s=0,c=null;const m=[],_={},u=function(M,b){s=w*4+17,L=(function(T){const N=new Array(T);for(let F=0;F<T;F+=1){N[F]=new Array(T);for(let P=0;P<T;P+=1)N[F][P]=null}return N})(s),y(0,0),y(s-7,0),y(0,s-7),g(),E(),f(M,b),w>=7&&a(M),c==null&&(c=C(w,A,m)),d(c,b)},y=function(M,b){for(let T=-1;T<=7;T+=1)if(!(M+T<=-1||s<=M+T))for(let N=-1;N<=7;N+=1)b+N<=-1||s<=b+N||(0<=T&&T<=6&&(N==0||N==6)||0<=N&&N<=6&&(T==0||T==6)||2<=T&&T<=4&&2<=N&&N<=4?L[M+T][b+N]=!0:L[M+T][b+N]=!1)},S=function(){let M=0,b=0;for(let T=0;T<8;T+=1){u(!0,T);const N=xr.getLostPoint(_);(T==0||M>N)&&(M=N,b=T)}return b},E=function(){for(let M=8;M<s-8;M+=1)L[M][6]==null&&(L[M][6]=M%2==0);for(let M=8;M<s-8;M+=1)L[6][M]==null&&(L[6][M]=M%2==0)},g=function(){const M=xr.getPatternPosition(w);for(let b=0;b<M.length;b+=1)for(let T=0;T<M.length;T+=1){const N=M[b],F=M[T];if(L[N][F]==null)for(let P=-2;P<=2;P+=1)for(let B=-2;B<=2;B+=1)P==-2||P==2||B==-2||B==2||P==0&&B==0?L[N+P][F+B]=!0:L[N+P][F+B]=!1}},a=function(M){const b=xr.getBCHTypeNumber(w);for(let T=0;T<18;T+=1){const N=!M&&(b>>T&1)==1;L[Math.floor(T/3)][T%3+s-8-3]=N}for(let T=0;T<18;T+=1){const N=!M&&(b>>T&1)==1;L[T%3+s-8-3][Math.floor(T/3)]=N}},f=function(M,b){const T=A<<3|b,N=xr.getBCHTypeInfo(T);for(let F=0;F<15;F+=1){const P=!M&&(N>>F&1)==1;F<6?L[F][8]=P:F<8?L[F+1][8]=P:L[s-15+F][8]=P}for(let F=0;F<15;F+=1){const P=!M&&(N>>F&1)==1;F<8?L[8][s-F-1]=P:F<9?L[8][15-F-1+1]=P:L[8][15-F-1]=P}L[s-8][8]=!M},d=function(M,b){let T=-1,N=s-1,F=7,P=0;const B=xr.getMaskFunction(b);for(let H=s-1;H>0;H-=2)for(H==6&&(H-=1);;){for(let q=0;q<2;q+=1)if(L[N][H-q]==null){let X=!1;P<M.length&&(X=(M[P]>>>F&1)==1),B(N,H-q)&&(X=!X),L[N][H-q]=X,F-=1,F==-1&&(P+=1,F=7)}if(N+=T,N<0||s<=N){N-=T,T=-T;break}}},h=function(M,b){let T=0,N=0,F=0;const P=new Array(b.length),B=new Array(b.length);for(let G=0;G<b.length;G+=1){const Y=b[G].dataCount,j=b[G].totalCount-Y;N=Math.max(N,Y),F=Math.max(F,j),P[G]=new Array(Y);for(let ne=0;ne<P[G].length;ne+=1)P[G][ne]=255&M.getBuffer()[ne+T];T+=Y;const U=xr.getErrorCorrectPolynomial(j),V=zi(P[G],U.getLength()-1).mod(U);B[G]=new Array(U.getLength()-1);for(let ne=0;ne<B[G].length;ne+=1){const se=ne+V.getLength()-B[G].length;B[G][ne]=se>=0?V.getAt(se):0}}let H=0;for(let G=0;G<b.length;G+=1)H+=b[G].totalCount;const q=new Array(H);let X=0;for(let G=0;G<N;G+=1)for(let Y=0;Y<b.length;Y+=1)G<P[Y].length&&(q[X]=P[Y][G],X+=1);for(let G=0;G<F;G+=1)for(let Y=0;Y<b.length;Y+=1)G<B[Y].length&&(q[X]=B[Y][G],X+=1);return q},C=function(M,b,T){const N=jf.getRSBlocks(M,b),F=Of();for(let B=0;B<T.length;B+=1){const H=T[B];F.put(H.getMode(),4),F.put(H.getLength(),xr.getLengthInBits(H.getMode(),M)),H.write(F)}let P=0;for(let B=0;B<N.length;B+=1)P+=N[B].dataCount;if(F.getLengthInBits()>P*8)throw"code length overflow. ("+F.getLengthInBits()+">"+P*8+")";for(F.getLengthInBits()+4<=P*8&&F.put(0,4);F.getLengthInBits()%8!=0;)F.putBit(!1);for(;!(F.getLengthInBits()>=P*8||(F.put(236,8),F.getLengthInBits()>=P*8));)F.put(17,8);return h(F,N)};_.addData=function(M,b){b=b||"Byte";let T=null;switch(b){case"Numeric":T=$C(M);break;case"Alphanumeric":T=UC(M);break;case"Byte":T=WC(M);break;case"Kanji":T=zC(M);break;default:throw"mode:"+b}m.push(T),c=null},_.isDark=function(M,b){if(M<0||s<=M||b<0||s<=b)throw M+","+b;return L[M][b]},_.getModuleCount=function(){return s},_.make=function(){if(w<1){let M=1;for(;M<40;M++){const b=jf.getRSBlocks(M,A),T=Of();for(let F=0;F<m.length;F++){const P=m[F];T.put(P.getMode(),4),T.put(P.getLength(),xr.getLengthInBits(P.getMode(),M)),P.write(T)}let N=0;for(let F=0;F<b.length;F++)N+=b[F].dataCount;if(T.getLengthInBits()<=N*8)break}w=M}u(!1,S())},_.createTableTag=function(M,b){M=M||2,b=typeof b>"u"?M*4:b;let T="";T+='<table style="',T+=" border-width: 0px; border-style: none;",T+=" border-collapse: collapse;",T+=" padding: 0px; margin: "+b+"px;",T+='">',T+="<tbody>";for(let N=0;N<_.getModuleCount();N+=1){T+="<tr>";for(let F=0;F<_.getModuleCount();F+=1)T+='<td style="',T+=" border-width: 0px; border-style: none;",T+=" border-collapse: collapse;",T+=" padding: 0px; margin: 0px;",T+=" width: "+M+"px;",T+=" height: "+M+"px;",T+=" background-color: ",T+=_.isDark(N,F)?"#000000":"#ffffff",T+=";",T+='"/>';T+="</tr>"}return T+="</tbody>",T+="</table>",T},_.createSvgTag=function(M,b,T,N){let F={};typeof arguments[0]=="object"&&(F=arguments[0],M=F.cellSize,b=F.margin,T=F.alt,N=F.title),M=M||2,b=typeof b>"u"?M*4:b,T=typeof T=="string"?{text:T}:T||{},T.text=T.text||null,T.id=T.text?T.id||"qrcode-description":null,N=typeof N=="string"?{text:N}:N||{},N.text=N.text||null,N.id=N.text?N.id||"qrcode-title":null;const P=_.getModuleCount()*M+b*2;let B,H,q,X,G="",Y;for(Y="l"+M+",0 0,"+M+" -"+M+",0 0,-"+M+"z ",G+='<svg version="1.1" xmlns="http://www.w3.org/2000/svg"',G+=F.scalable?"":' width="'+P+'px" height="'+P+'px"',G+=' viewBox="0 0 '+P+" "+P+'" ',G+=' preserveAspectRatio="xMinYMin meet"',G+=N.text||T.text?' role="img" aria-labelledby="'+D([N.id,T.id].join(" ").trim())+'"':"",G+=">",G+=N.text?'<title id="'+D(N.id)+'">'+D(N.text)+"</title>":"",G+=T.text?'<description id="'+D(T.id)+'">'+D(T.text)+"</description>":"",G+='<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>',G+='<path d="',q=0;q<_.getModuleCount();q+=1)for(X=q*M+b,B=0;B<_.getModuleCount();B+=1)_.isDark(q,B)&&(H=B*M+b,G+="M"+H+","+X+Y);return G+='" stroke="transparent" fill="black"/>',G+="</svg>",G},_.createDataURL=function(M,b){M=M||2,b=typeof b>"u"?M*4:b;const T=_.getModuleCount()*M+b*2,N=b,F=T-b;return GC(T,T,function(P,B){if(N<=P&&P<F&&N<=B&&B<F){const H=Math.floor((P-N)/M),q=Math.floor((B-N)/M);return _.isDark(q,H)?0:1}else return 1})},_.createImgTag=function(M,b,T){M=M||2,b=typeof b>"u"?M*4:b;const N=_.getModuleCount()*M+b*2;let F="";return F+="<img",F+=' src="',F+=_.createDataURL(M,b),F+='"',F+=' width="',F+=N,F+='"',F+=' height="',F+=N,F+='"',T&&(F+=' alt="',F+=D(T),F+='"'),F+="/>",F};const D=function(M){let b="";for(let T=0;T<M.length;T+=1){const N=M.charAt(T);switch(N){case"<":b+="&lt;";break;case">":b+="&gt;";break;case"&":b+="&amp;";break;case'"':b+="&quot;";break;default:b+=N;break}}return b},x=function(M){M=typeof M>"u"?2:M;const T=_.getModuleCount()*1+M*2,N=M,F=T-M;let P,B,H,q,X;const G={"██":"█","█ ":"▀"," █":"▄"," ":" "},Y={"██":"▀","█ ":"▀"," █":" "," ":" "};let j="";for(P=0;P<T;P+=2){for(H=Math.floor((P-N)/1),q=Math.floor((P+1-N)/1),B=0;B<T;B+=1)X="█",N<=B&&B<F&&N<=P&&P<F&&_.isDark(H,Math.floor((B-N)/1))&&(X=" "),N<=B&&B<F&&N<=P+1&&P+1<F&&_.isDark(q,Math.floor((B-N)/1))?X+=" ":X+="█",j+=M<1&&P+1>=F?Y[X]:G[X];j+=`
137
- `}return T%2&&M>0?j.substring(0,j.length-T-1)+Array(T+1).join("▀"):j.substring(0,j.length-1)};return _.createASCII=function(M,b){if(M=M||1,M<2)return x(b);M-=1,b=typeof b>"u"?M*2:b;const T=_.getModuleCount()*M+b*2,N=b,F=T-b;let P,B,H,q;const X=Array(M+1).join("██"),G=Array(M+1).join(" ");let Y="",j="";for(P=0;P<T;P+=1){for(H=Math.floor((P-N)/M),j="",B=0;B<T;B+=1)q=1,N<=B&&B<F&&N<=P&&P<F&&_.isDark(H,Math.floor((B-N)/M))&&(q=0),j+=q?X:G;for(H=0;H<M;H+=1)Y+=j+`
138
- `}return Y.substring(0,Y.length-1)},_.renderTo2dContext=function(M,b){b=b||2;const T=_.getModuleCount();for(let N=0;N<T;N++)for(let F=0;F<T;F++)M.fillStyle=_.isDark(N,F)?"black":"white",M.fillRect(F*b,N*b,b,b)},_};qs.stringToBytes=function(n){const r=[];for(let o=0;o<n.length;o+=1){const p=n.charCodeAt(o);r.push(p&255)}return r};qs.createStringToBytes=function(n,r){const o=(function(){const w=qC(n),A=function(){const c=w.read();if(c==-1)throw"eof";return c};let L=0;const s={};for(;;){const c=w.read();if(c==-1)break;const m=A(),_=A(),u=A(),y=String.fromCharCode(c<<8|m),S=_<<8|u;s[y]=S,L+=1}if(L!=r)throw L+" != "+r;return s})(),p=63;return function(w){const A=[];for(let L=0;L<w.length;L+=1){const s=w.charCodeAt(L);if(s<128)A.push(s);else{const c=o[w.charAt(L)];typeof c=="number"?(c&255)==c?A.push(c):(A.push(c>>>8),A.push(c&255)):A.push(p)}}return A}};const qt={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},Bi={L:1,M:0,Q:3,H:2},Cr={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},xr=(function(){const n=[[],[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]],r=1335,o=7973,p=21522,w={},A=function(L){let s=0;for(;L!=0;)s+=1,L>>>=1;return s};return w.getBCHTypeInfo=function(L){let s=L<<10;for(;A(s)-A(r)>=0;)s^=r<<A(s)-A(r);return(L<<10|s)^p},w.getBCHTypeNumber=function(L){let s=L<<12;for(;A(s)-A(o)>=0;)s^=o<<A(s)-A(o);return L<<12|s},w.getPatternPosition=function(L){return n[L-1]},w.getMaskFunction=function(L){switch(L){case Cr.PATTERN000:return function(s,c){return(s+c)%2==0};case Cr.PATTERN001:return function(s,c){return s%2==0};case Cr.PATTERN010:return function(s,c){return c%3==0};case Cr.PATTERN011:return function(s,c){return(s+c)%3==0};case Cr.PATTERN100:return function(s,c){return(Math.floor(s/2)+Math.floor(c/3))%2==0};case Cr.PATTERN101:return function(s,c){return s*c%2+s*c%3==0};case Cr.PATTERN110:return function(s,c){return(s*c%2+s*c%3)%2==0};case Cr.PATTERN111:return function(s,c){return(s*c%3+(s+c)%2)%2==0};default:throw"bad maskPattern:"+L}},w.getErrorCorrectPolynomial=function(L){let s=zi([1],0);for(let c=0;c<L;c+=1)s=s.multiply(zi([1,kr.gexp(c)],0));return s},w.getLengthInBits=function(L,s){if(1<=s&&s<10)switch(L){case qt.MODE_NUMBER:return 10;case qt.MODE_ALPHA_NUM:return 9;case qt.MODE_8BIT_BYTE:return 8;case qt.MODE_KANJI:return 8;default:throw"mode:"+L}else if(s<27)switch(L){case qt.MODE_NUMBER:return 12;case qt.MODE_ALPHA_NUM:return 11;case qt.MODE_8BIT_BYTE:return 16;case qt.MODE_KANJI:return 10;default:throw"mode:"+L}else if(s<41)switch(L){case qt.MODE_NUMBER:return 14;case qt.MODE_ALPHA_NUM:return 13;case qt.MODE_8BIT_BYTE:return 16;case qt.MODE_KANJI:return 12;default:throw"mode:"+L}else throw"type:"+s},w.getLostPoint=function(L){const s=L.getModuleCount();let c=0;for(let u=0;u<s;u+=1)for(let y=0;y<s;y+=1){let S=0;const E=L.isDark(u,y);for(let g=-1;g<=1;g+=1)if(!(u+g<0||s<=u+g))for(let a=-1;a<=1;a+=1)y+a<0||s<=y+a||g==0&&a==0||E==L.isDark(u+g,y+a)&&(S+=1);S>5&&(c+=3+S-5)}for(let u=0;u<s-1;u+=1)for(let y=0;y<s-1;y+=1){let S=0;L.isDark(u,y)&&(S+=1),L.isDark(u+1,y)&&(S+=1),L.isDark(u,y+1)&&(S+=1),L.isDark(u+1,y+1)&&(S+=1),(S==0||S==4)&&(c+=3)}for(let u=0;u<s;u+=1)for(let y=0;y<s-6;y+=1)L.isDark(u,y)&&!L.isDark(u,y+1)&&L.isDark(u,y+2)&&L.isDark(u,y+3)&&L.isDark(u,y+4)&&!L.isDark(u,y+5)&&L.isDark(u,y+6)&&(c+=40);for(let u=0;u<s;u+=1)for(let y=0;y<s-6;y+=1)L.isDark(y,u)&&!L.isDark(y+1,u)&&L.isDark(y+2,u)&&L.isDark(y+3,u)&&L.isDark(y+4,u)&&!L.isDark(y+5,u)&&L.isDark(y+6,u)&&(c+=40);let m=0;for(let u=0;u<s;u+=1)for(let y=0;y<s;y+=1)L.isDark(y,u)&&(m+=1);const _=Math.abs(100*m/s/s-50)/5;return c+=_*10,c},w})(),kr=(function(){const n=new Array(256),r=new Array(256);for(let p=0;p<8;p+=1)n[p]=1<<p;for(let p=8;p<256;p+=1)n[p]=n[p-4]^n[p-5]^n[p-6]^n[p-8];for(let p=0;p<255;p+=1)r[n[p]]=p;const o={};return o.glog=function(p){if(p<1)throw"glog("+p+")";return r[p]},o.gexp=function(p){for(;p<0;)p+=255;for(;p>=256;)p-=255;return n[p]},o})(),zi=function(n,r){if(typeof n.length>"u")throw n.length+"/"+r;const o=(function(){let w=0;for(;w<n.length&&n[w]==0;)w+=1;const A=new Array(n.length-w+r);for(let L=0;L<n.length-w;L+=1)A[L]=n[L+w];return A})(),p={};return p.getAt=function(w){return o[w]},p.getLength=function(){return o.length},p.multiply=function(w){const A=new Array(p.getLength()+w.getLength()-1);for(let L=0;L<p.getLength();L+=1)for(let s=0;s<w.getLength();s+=1)A[L+s]^=kr.gexp(kr.glog(p.getAt(L))+kr.glog(w.getAt(s)));return zi(A,0)},p.mod=function(w){if(p.getLength()-w.getLength()<0)return p;const A=kr.glog(p.getAt(0))-kr.glog(w.getAt(0)),L=new Array(p.getLength());for(let s=0;s<p.getLength();s+=1)L[s]=p.getAt(s);for(let s=0;s<w.getLength();s+=1)L[s]^=kr.gexp(kr.glog(w.getAt(s))+A);return zi(L,0).mod(w)},p},jf=(function(){const n=[[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]],r=function(w,A){const L={};return L.totalCount=w,L.dataCount=A,L},o={},p=function(w,A){switch(A){case Bi.L:return n[(w-1)*4+0];case Bi.M:return n[(w-1)*4+1];case Bi.Q:return n[(w-1)*4+2];case Bi.H:return n[(w-1)*4+3];default:return}};return o.getRSBlocks=function(w,A){const L=p(w,A);if(typeof L>"u")throw"bad rs block @ typeNumber:"+w+"/errorCorrectionLevel:"+A;const s=L.length/3,c=[];for(let m=0;m<s;m+=1){const _=L[m*3+0],u=L[m*3+1],y=L[m*3+2];for(let S=0;S<_;S+=1)c.push(r(u,y))}return c},o})(),Of=function(){const n=[];let r=0;const o={};return o.getBuffer=function(){return n},o.getAt=function(p){const w=Math.floor(p/8);return(n[w]>>>7-p%8&1)==1},o.put=function(p,w){for(let A=0;A<w;A+=1)o.putBit((p>>>w-A-1&1)==1)},o.getLengthInBits=function(){return r},o.putBit=function(p){const w=Math.floor(r/8);n.length<=w&&n.push(0),p&&(n[w]|=128>>>r%8),r+=1},o},$C=function(n){const r=qt.MODE_NUMBER,o=n,p={};p.getMode=function(){return r},p.getLength=function(L){return o.length},p.write=function(L){const s=o;let c=0;for(;c+2<s.length;)L.put(w(s.substring(c,c+3)),10),c+=3;c<s.length&&(s.length-c==1?L.put(w(s.substring(c,c+1)),4):s.length-c==2&&L.put(w(s.substring(c,c+2)),7))};const w=function(L){let s=0;for(let c=0;c<L.length;c+=1)s=s*10+A(L.charAt(c));return s},A=function(L){if("0"<=L&&L<="9")return L.charCodeAt(0)-48;throw"illegal char :"+L};return p},UC=function(n){const r=qt.MODE_ALPHA_NUM,o=n,p={};p.getMode=function(){return r},p.getLength=function(A){return o.length},p.write=function(A){const L=o;let s=0;for(;s+1<L.length;)A.put(w(L.charAt(s))*45+w(L.charAt(s+1)),11),s+=2;s<L.length&&A.put(w(L.charAt(s)),6)};const w=function(A){if("0"<=A&&A<="9")return A.charCodeAt(0)-48;if("A"<=A&&A<="Z")return A.charCodeAt(0)-65+10;switch(A){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 :"+A}};return p},WC=function(n){const r=qt.MODE_8BIT_BYTE,o=qs.stringToBytes(n),p={};return p.getMode=function(){return r},p.getLength=function(w){return o.length},p.write=function(w){for(let A=0;A<o.length;A+=1)w.put(o[A],8)},p},zC=function(n){const r=qt.MODE_KANJI,o=qs.stringToBytes;(function(A,L){const s=o(A);if(s.length!=2||(s[0]<<8|s[1])!=L)throw"sjis not supported."})("友",38726);const p=o(n),w={};return w.getMode=function(){return r},w.getLength=function(A){return~~(p.length/2)},w.write=function(A){const L=p;let s=0;for(;s+1<L.length;){let c=(255&L[s])<<8|255&L[s+1];if(33088<=c&&c<=40956)c-=33088;else if(57408<=c&&c<=60351)c-=49472;else throw"illegal char at "+(s+1)+"/"+c;c=(c>>>8&255)*192+(c&255),A.put(c,13),s+=2}if(s<L.length)throw"illegal char at "+(s+1)},w},Lm=function(){const n=[],r={};return r.writeByte=function(o){n.push(o&255)},r.writeShort=function(o){r.writeByte(o),r.writeByte(o>>>8)},r.writeBytes=function(o,p,w){p=p||0,w=w||o.length;for(let A=0;A<w;A+=1)r.writeByte(o[A+p])},r.writeString=function(o){for(let p=0;p<o.length;p+=1)r.writeByte(o.charCodeAt(p))},r.toByteArray=function(){return n},r.toString=function(){let o="";o+="[";for(let p=0;p<n.length;p+=1)p>0&&(o+=","),o+=n[p];return o+="]",o},r},VC=function(){let n=0,r=0,o=0,p="";const w={},A=function(s){p+=String.fromCharCode(L(s&63))},L=function(s){if(s<0)throw"n:"+s;if(s<26)return 65+s;if(s<52)return 97+(s-26);if(s<62)return 48+(s-52);if(s==62)return 43;if(s==63)return 47;throw"n:"+s};return w.writeByte=function(s){for(n=n<<8|s&255,r+=8,o+=1;r>=6;)A(n>>>r-6),r-=6},w.flush=function(){if(r>0&&(A(n<<6-r),n=0,r=0),o%3!=0){const s=3-o%3;for(let c=0;c<s;c+=1)p+="="}},w.toString=function(){return p},w},qC=function(n){const r=n;let o=0,p=0,w=0;const A={};A.read=function(){for(;w<8;){if(o>=r.length){if(w==0)return-1;throw"unexpected end of file./"+w}const c=r.charAt(o);if(o+=1,c=="=")return w=0,-1;if(c.match(/^\s$/))continue;p=p<<6|L(c.charCodeAt(0)),w+=6}const s=p>>>w-8&255;return w-=8,s};const L=function(s){if(65<=s&&s<=90)return s-65;if(97<=s&&s<=122)return s-97+26;if(48<=s&&s<=57)return s-48+52;if(s==43)return 62;if(s==47)return 63;throw"c:"+s};return A},KC=function(n,r){const o=n,p=r,w=new Array(n*r),A={};A.setPixel=function(m,_,u){w[_*o+m]=u},A.write=function(m){m.writeString("GIF87a"),m.writeShort(o),m.writeShort(p),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(o),m.writeShort(p),m.writeByte(0);const _=2,u=s(_);m.writeByte(_);let y=0;for(;u.length-y>255;)m.writeByte(255),m.writeBytes(u,y,255),y+=255;m.writeByte(u.length-y),m.writeBytes(u,y,u.length-y),m.writeByte(0),m.writeString(";")};const L=function(m){const _=m;let u=0,y=0;const S={};return S.write=function(E,g){if(E>>>g)throw"length over";for(;u+g>=8;)_.writeByte(255&(E<<u|y)),g-=8-u,E>>>=8-u,y=0,u=0;y=E<<u|y,u=u+g},S.flush=function(){u>0&&_.writeByte(y)},S},s=function(m){const _=1<<m,u=(1<<m)+1;let y=m+1;const S=c();for(let d=0;d<_;d+=1)S.add(String.fromCharCode(d));S.add(String.fromCharCode(_)),S.add(String.fromCharCode(u));const E=Lm(),g=L(E);g.write(_,y);let a=0,f=String.fromCharCode(w[a]);for(a+=1;a<w.length;){const d=String.fromCharCode(w[a]);a+=1,S.contains(f+d)?f=f+d:(g.write(S.indexOf(f),y),S.size()<4095&&(S.size()==1<<y&&(y+=1),S.add(f+d)),f=d)}return g.write(S.indexOf(f),y),g.write(u,y),g.flush(),E.toByteArray()},c=function(){const m={};let _=0;const u={};return u.add=function(y){if(u.contains(y))throw"dup key:"+y;m[y]=_,_+=1},u.size=function(){return _},u.indexOf=function(y){return m[y]},u.contains=function(y){return typeof m[y]<"u"},u};return A},GC=function(n,r,o){const p=KC(n,r);for(let s=0;s<r;s+=1)for(let c=0;c<n;c+=1)p.setPixel(c,s,o(c,s));const w=Lm();p.write(w);const A=VC(),L=w.toByteArray();for(let s=0;s<L.length;s+=1)A.writeByte(L[s]);return A.flush(),"data:image/gif;base64,"+A};qs.stringToBytes;const ji=4;function YC(n){const r=qs(0,"M");r.addData(n,"Byte"),r.make();const o=r.getModuleCount();let p="";for(let w=0;w<o;w++){let A=0;for(;A<o;){if(!r.isDark(w,A)){A++;continue}const L=A;for(;A<o&&r.isDark(w,A);)A++;p+=`M${L} ${w}h${A-L}v1h-${A-L}z`}}return{size:o,path:p}}const XC=1e3,QC=4e3;function JC({status:n,pairing:r,phonePairing:o,phoneStarted:p,problem:w,platform:A,onSetEnabled:L,onSetPort:s,onStartPairing:c,onCancelPairing:m,onStartPhonePairing:_,onCancelPhonePairing:u,onRenameDevice:y,onRevokeDevice:S,onDismissProblem:E,onClose:g}){const[a,f]=O.useState(()=>Nf(n.hostNames)),[d,h]=O.useState(String(n.port)),[C,D]=O.useState(null),x=O.useRef(null),[M,b]=O.useState(()=>Date.now()),T=()=>{r!==null&&m(),p&&u(),g()},N=O.useRef(T);N.current=T,O.useEffect(()=>{const G=Y=>{Y.key==="Escape"&&(Y.preventDefault(),Y.stopPropagation(),N.current())};return window.addEventListener("keydown",G,!0),()=>window.removeEventListener("keydown",G,!0)},[]),O.useEffect(()=>{if(r===null&&o===null)return;b(Date.now());const G=window.setInterval(()=>b(Date.now()),1e3);return()=>window.clearInterval(G)},[r,o]),O.useEffect(()=>()=>{x.current!==null&&window.clearTimeout(x.current)},[]),O.useEffect(()=>{h(String(n.port))},[n.port]),O.useEffect(()=>{n.hostNames.includes(a)||f(Nf(n.hostNames))},[n.hostNames,a]);const F=(G,Y)=>{navigator.clipboard.writeText(Y).then(()=>{D(G),x.current!==null&&window.clearTimeout(x.current),x.current=window.setTimeout(()=>D(null),XC)}).catch(()=>D(null))},P=IC(d),B=P!==null&&P!==n.port,H=NC(n,a),q=k("remote.title"),X=r===null?null:DC(n.port,r.code);return l.jsx("div",{className:"modal-backdrop",onClick:T,children:l.jsxs("div",{className:"modal",role:"dialog","aria-label":q,onClick:G=>G.stopPropagation(),children:[l.jsxs("header",{className:"modal-header",children:[l.jsx("span",{className:"modal-title",children:q}),l.jsx("button",{className:"icon-button",onClick:T,title:k("common.close"),children:"×"})]}),l.jsxs("div",{className:"modal-body",children:[l.jsx("p",{className:`status-line-state${n.state==="active"?" status-line-state-active":""}`,children:Wc(n.state,n.port)}),l.jsx("p",{className:"modal-hint",children:k("remote.intro")}),l.jsx("div",{className:"vault-actions",children:n.enabled?l.jsxs(l.Fragment,{children:[l.jsx("button",{className:"link-button",onClick:()=>L(!1),children:k("remote.turnOff")}),l.jsx("span",{className:"modal-hint",children:k("remote.turnOffHint")})]}):l.jsx("button",{className:"primary-button",onClick:()=>L(!0),children:k("remote.turnOn")})}),l.jsxs("div",{className:"remote-port",children:[l.jsx("label",{className:"modal-hint",htmlFor:"remote-port-input",children:k("remote.port")}),l.jsx("input",{id:"remote-port-input",className:"remote-port-input",inputMode:"numeric",value:d,onChange:G=>h(G.target.value),onKeyDown:G=>{G.key==="Enter"&&B&&P!==null&&s(P)}}),l.jsx("button",{className:"link-button",onClick:()=>P!==null&&s(P),disabled:!B,children:k("remote.portSave")}),P===null&&l.jsx("span",{className:"modal-hint remote-port-invalid",children:PC()})]}),l.jsx("p",{className:"modal-hint",children:k("remote.restartHint")}),w!==null&&l.jsxs("div",{className:"vault-problem",role:"alert",children:[l.jsx("span",{children:w}),l.jsx("button",{className:"icon-button",onClick:E,title:k("common.close"),children:"×"})]}),l.jsx("h3",{className:"modal-section",children:k("remote.step.host")}),l.jsx("p",{className:"modal-hint",children:k("remote.step.hostHint")}),FC().map(G=>l.jsxs("details",{className:"remote-os",open:G.platform===HC(A),children:[l.jsx("summary",{className:"remote-os-summary",children:G.label}),l.jsx("p",{className:"modal-hint",children:G.hint}),G.command!==null&&l.jsxs("div",{className:"status-line-fragment",children:[l.jsx("pre",{className:"tool-pre",children:G.command}),l.jsx("button",{className:"link-button",onClick:()=>F("ssh",G.command??""),children:C==="ssh"?l.jsxs(l.Fragment,{children:["✓ ",k("remote.copied")]}):k("remote.copy")})]})]},G.platform)),l.jsx("h3",{className:"modal-section",children:k("remote.step.tunnel")}),l.jsx("p",{className:"modal-hint",children:k("remote.step.tunnelHint")}),n.hostNames.length>1&&l.jsxs("div",{className:"remote-port",children:[l.jsx("label",{className:"modal-hint",htmlFor:"remote-host-select",children:k("remote.address")}),l.jsx("select",{id:"remote-host-select",className:"remote-host-select",value:a,onChange:G=>f(G.target.value),children:n.hostNames.map(G=>l.jsx("option",{value:G,children:G},G))})]}),l.jsxs("div",{className:"status-line-fragment",children:[l.jsx("pre",{className:"tool-pre",children:H}),l.jsx("button",{className:"link-button",onClick:()=>F("command",H),children:C==="command"?l.jsxs(l.Fragment,{children:["✓ ",k("remote.copied")]}):k("remote.copy")})]}),l.jsxs("details",{className:"remote-os",children:[l.jsx("summary",{className:"remote-os-summary",children:k("remote.trouble")}),l.jsxs("ul",{className:"remote-trouble",children:[l.jsx("li",{className:"modal-hint",children:k("remote.trouble.network")}),l.jsx("li",{className:"modal-hint",children:k("remote.vpnHint")}),n.sshUser.length>0&&l.jsx("li",{className:"modal-hint",children:k("remote.userHint",{user:n.sshUser})})]})]}),l.jsx("h3",{className:"modal-section",children:k("remote.step.pair")}),r===null||X===null?l.jsxs("div",{className:"vault-actions",children:[l.jsx("button",{className:"primary-button",onClick:c,disabled:!oa(n),children:k("remote.pair.start")}),!oa(n)&&l.jsx("span",{className:"modal-hint",children:k("remote.pair.needsActive")})]}):l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"modal-hint",children:k("remote.pair.open")}),l.jsxs("div",{className:"status-line-fragment",children:[l.jsx("pre",{className:"tool-pre",children:X}),l.jsx("button",{className:"link-button",onClick:()=>F("pairing",X),children:C==="pairing"?l.jsxs(l.Fragment,{children:["✓ ",k("remote.copied")]}):k("remote.copy")})]}),l.jsxs("p",{className:"modal-hint",children:[k("remote.pair.expires",{time:If(Df(r.expiresAt,M))})," ",k("remote.pair.after",{url:Em(n.port)})]}),l.jsx("div",{className:"vault-actions",children:l.jsx("button",{className:"link-button",onClick:m,children:k("remote.pair.cancel")})})]}),l.jsx("h3",{className:"modal-section",children:k("remote.phone.title")}),o===null?l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"modal-hint",children:k("remote.phone.hint")}),l.jsxs("div",{className:"vault-actions",children:[l.jsx("button",{className:"primary-button",onClick:_,disabled:!oa(n),children:k("remote.phone.start")}),!oa(n)&&l.jsx("span",{className:"modal-hint",children:k("remote.pair.needsActive")})]})]}):l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"modal-hint",children:BC(o.shell)}),l.jsxs("div",{className:"status-line-fragment",children:[l.jsx("pre",{className:"tool-pre remote-phone-command",children:o.authorizeCommand}),l.jsx("button",{className:"link-button",onClick:()=>F("phone",o.authorizeCommand),children:C==="phone"?l.jsxs(l.Fragment,{children:["✓ ",k("remote.copied")]}):k("remote.copy")})]}),l.jsx("p",{className:"modal-hint",children:k("remote.phone.authorizeOnce")}),l.jsx("p",{className:"modal-hint",children:k("remote.phone.scan")}),l.jsx(ZC,{payload:o.payload}),l.jsx("p",{className:"modal-hint",children:k("remote.phone.secret")}),l.jsx("p",{className:"modal-hint",children:k("remote.pair.expires",{time:If(Df(o.expiresAt,M))})}),l.jsx("div",{className:"vault-actions",children:l.jsx("button",{className:"link-button",onClick:u,children:k("remote.pair.cancel")})})]}),l.jsx("h3",{className:"modal-section",children:k("remote.devices")}),n.devices.length===0?l.jsx("p",{className:"modal-hint",children:k("remote.devices.empty")}):l.jsx("ul",{className:"remote-devices",children:n.devices.map(G=>l.jsx(ex,{device:G,onRename:Y=>y(G.id,Y),onRevoke:()=>S(G.id)},G.id))})]})]})})}function ZC({payload:n}){const r=YC(n),o=r.size+ji*2;return l.jsxs("svg",{className:"remote-phone-qr",viewBox:`${-ji} ${-ji} ${o} ${o}`,role:"img","aria-label":k("remote.phone.qrLabel"),shapeRendering:"crispEdges",children:[l.jsx("rect",{x:-ji,y:-ji,width:o,height:o,fill:"#fff"}),l.jsx("path",{d:r.path,fill:"#000"})]})}function ex({device:n,onRename:r,onRevoke:o}){const[p,w]=O.useState(!1),[A,L]=O.useState(n.label),[s,c]=O.useState(!1),m=O.useRef(null);O.useEffect(()=>()=>{m.current!==null&&window.clearTimeout(m.current)},[]);const _=()=>{w(!1);const y=A.trim();y.length>0&&y!==n.label&&r(y)},u=()=>{if(s){o();return}c(!0),m.current=window.setTimeout(()=>c(!1),QC)};return l.jsxs("li",{className:"remote-device",children:[l.jsxs("div",{className:"remote-device-main",children:[p?l.jsx("input",{className:"remote-device-input",value:A,autoFocus:!0,onChange:y=>L(y.target.value),onBlur:_,onKeyDown:y=>{y.key==="Enter"&&_()}}):l.jsx("button",{className:"remote-device-label",onClick:()=>{L(n.label),w(!0)},title:k("remote.device.rename"),children:n.label}),l.jsx("span",{className:`remote-device-seen${n.connected?" remote-device-connected":""}`,children:jC(n)}),l.jsx("span",{className:"remote-device-paired",children:OC(n)})]}),l.jsx("button",{className:`link-button${s?" remote-device-confirm":""}`,onClick:u,children:k(s?"remote.device.revokeConfirm":"remote.device.revoke")})]})}const Cc="agent-workbench.notes-open",Bf="agent-workbench.notes-active",Ff="agent-workbench.notes-height",xc=160,tx=300;function nx(n){return n.text.trim().length===0?n.images.length>0?k("notes.imageOnly"):k("notes.untitled"):Mv(n)}function rx({notes:n,onSendNote:r,sendTargetCwd:o,fill:p}){const[w,A]=O.useState(()=>bt(Cc,!1,H=>H==="true")),L=w||p,[s,c]=O.useState(()=>bt(Ff,tx,H=>{const q=Number.parseInt(H,10);return Number.isFinite(q)?Math.max(q,xc):null})),[m,_]=O.useState(()=>bt(Bf,null,H=>H)),[u,y]=O.useState(null),[S,E]=O.useState(null),[g,a]=O.useState(0),f=EC(),d=O.useMemo(()=>n.notes.length===0?null:n.notes.find(H=>H.noteId===m)??n.notes[n.notes.length-1]??null,[n.notes,m]),h=O.useCallback(H=>{_(H),ft(Bf,H),y(null)},[]),C=O.useCallback(()=>{A(H=>{const q=!H;return ft(Cc,String(q)),q})},[]),D=O.useCallback(()=>{const H=n.create();h(H),L||(A(!0),ft(Cc,"true")),a(q=>q+1)},[n,L,h]),x=O.useCallback(H=>{if(H.text.trim().length===0&&H.images.length===0){n.remove(H.noteId);return}h(H.noteId),y(H.noteId)},[n,h]),M=O.useCallback(()=>{u!==null&&n.remove(u),y(null)},[u,n]),b=O.useRef(null),T=O.useCallback(H=>{b.current={startY:H.clientY,startHeight:s},H.currentTarget.setPointerCapture(H.pointerId),H.preventDefault()},[s]),N=O.useCallback(H=>{const q=b.current;if(q===null)return;const X=Math.max(xc,Math.floor(window.innerHeight*.8));c(Math.min(X,Math.max(xc,q.startHeight+q.startY-H.clientY)))},[]),F=O.useCallback(H=>{b.current!==null&&(b.current=null,H.currentTarget.releasePointerCapture(H.pointerId),ft(Ff,String(s)))},[s]);O.useEffect(()=>{if(S===null)return;const H=q=>{q.key==="Escape"&&(q.stopPropagation(),E(null))};return window.addEventListener("keydown",H,!0),()=>window.removeEventListener("keydown",H,!0)},[S]);const P=S===null?void 0:n.images[S],B=n.notes.length;return l.jsxs("section",{className:`notes${L?" notes-open":""}${p?" notes-fill":""}`,style:L&&!p?{height:`${s}px`}:void 0,children:[L&&!p&&l.jsx("div",{className:"notes-resize",onPointerDown:T,onPointerMove:N,onPointerUp:F,onPointerCancel:F,title:k("notes.resize")}),L?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"notes-header",children:[l.jsxs("div",{className:"strip-tabs",role:"tablist",children:[n.notes.map(H=>{const q=H.noteId===(d==null?void 0:d.noteId),X=nx(H);return l.jsxs("div",{className:`strip-tab${q?" is-active":""}`,role:"tab","aria-selected":q,children:[l.jsx("button",{className:"strip-tab-label",onClick:()=>h(H.noteId),title:X,children:X}),l.jsx("button",{className:"strip-tab-close",onClick:()=>x(H),title:k("notes.closeNote"),children:"×"})]},H.noteId)}),l.jsx("button",{className:"strip-tab-new",onClick:D,title:k("notes.new"),children:"+"})]}),l.jsx("span",{className:"strip-spacer"}),l.jsx("button",{className:"icon-button thread-font-button",onClick:f.cycle,title:fa(f.size),"aria-label":fa(f.size),children:l.jsxs("span",{"aria-hidden":"true",children:["a",l.jsx("span",{className:"thread-font-big",children:"A"})]})}),!p&&l.jsx("button",{className:"icon-button",onClick:C,title:k("notes.collapse"),children:"▾"})]}),l.jsx("div",{className:"notes-body",children:B===0||d===null?l.jsx("p",{className:"notes-empty",children:Bt("notes.empty")}):l.jsx(ox,{note:d,notes:n,closing:u===d.noteId,focusRequest:g,onConfirmClose:M,onCancelClose:()=>y(null),onOpenImage:E,onSend:r===null?null:()=>r(d.noteId),sendTargetCwd:o},d.noteId)})]}):l.jsxs("button",{className:"strip-collapsed",onClick:C,title:k("notes.expand"),children:[l.jsx("span",{className:"strip-collapsed-arrow",children:"▸"}),l.jsx("span",{children:k("notes.name")}),B>0&&l.jsx("span",{className:"strip-collapsed-count",children:B})]}),S!==null&&l.jsx("div",{className:"notes-lightbox",onClick:()=>E(null),title:k("notes.lightboxClose"),children:typeof P=="string"?l.jsx("img",{src:P,alt:k("notes.imageAlt")}):l.jsx("span",{className:"notes-lightbox-missing",children:k("notes.imageUnavailable")})})]})}function sx(){return l.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:l.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 ix(){return l.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:[l.jsx("path",{d:"M21.5 2.5 11 13"}),l.jsx("path",{d:"M21.5 2.5 15 21.5l-4-8.5-8.5-4z"})]})}function ox({note:n,notes:r,closing:o,focusRequest:p,onConfirmClose:w,onCancelClose:A,onOpenImage:L,onSend:s,sendTargetCwd:c}){const m=O.useRef(null),[_,u]=O.useState(!1),y=n.text.trim().length===0&&n.images.length===0;O.useEffect(()=>{var g;p>0&&((g=m.current)==null||g.focus())},[p]);const S=O.useCallback(g=>{const a=Array.from(g).filter(f=>f.type.startsWith("image/"));for(const f of a)r.addImage(n.noteId,f);return a.length>0},[r,n.noteId]),E=O.useCallback(g=>{g.clipboardData!==null&&S(g.clipboardData.files)&&g.preventDefault()},[S]);return l.jsxs("div",{className:`note-editor${_?" note-editor-dragging":""}`,onDragOver:g=>{Array.from(g.dataTransfer.types).includes("Files")&&(g.preventDefault(),u(!0))},onDragLeave:()=>u(!1),onDrop:g=>{g.preventDefault(),u(!1),S(g.dataTransfer.files)},children:[o&&l.jsxs("div",{className:"note-closing",children:[l.jsx("span",{children:k("notes.closeConfirm")}),l.jsx("button",{className:"link-button link-danger",onClick:w,children:k("common.close")}),l.jsx("button",{className:"link-button",onClick:A,children:k("common.cancel")})]}),r.problem!==null&&l.jsxs("div",{className:"composer-problem",children:[l.jsx("span",{children:r.problem}),l.jsx("button",{className:"icon-button",onClick:r.dismissProblem,title:k("common.close"),children:"×"})]}),l.jsx("textarea",{ref:m,className:"note-input",value:n.text,placeholder:k("notes.placeholder"),onChange:g=>r.updateText(n.noteId,g.target.value),onPaste:E,spellCheck:!1}),n.images.length>0&&l.jsx("div",{className:"note-images",children:n.images.map(g=>l.jsx(ax,{image:g,src:r.images[g.imageId],onRequest:r.requestImage,onOpen:()=>L(g.imageId),onRemove:()=>r.removeImage(n.noteId,g.imageId)},g.imageId))}),l.jsxs("div",{className:"note-footer",children:[l.jsx("span",{className:"note-meta",children:Fn(n.updatedAt)}),l.jsx("span",{className:"composer-spacer"}),l.jsx("button",{className:"icon-button",onClick:()=>s==null?void 0:s(),disabled:s===null||y,title:Z0(s!==null,c,y),children:l.jsx(ix,{})}),l.jsxs("label",{className:"icon-button note-attach",title:k("notes.attach"),children:[l.jsx(sx,{}),l.jsx("input",{type:"file",accept:"image/png,image/jpeg,image/gif,image/webp",multiple:!0,hidden:!0,onChange:g=>{g.target.files!==null&&S(g.target.files),g.target.value=""}})]})]})]})}function ax({image:n,src:r,onRequest:o,onOpen:p,onRemove:w}){return O.useEffect(()=>{r===void 0&&o(n.imageId)},[r,n.imageId,o]),l.jsxs("figure",{className:"chip chip-image note-thumb",title:nn(n.bytes),children:[typeof r=="string"?l.jsx("img",{src:r,alt:k("notes.imageAlt"),onClick:p}):l.jsx("span",{className:"note-thumb-placeholder",children:r===null?k("notes.thumbMissing"):"…"}),l.jsx("button",{className:"chip-remove",onClick:w,title:k("notes.removeImage"),children:"×"})]})}function Tm(){const n=Ki(),r=E1(),[o,p]=O.useState(null),w=O.useCallback(()=>p(null),[]),A=O.useRef(null),L=m=>{C1(m).catch(()=>{})},s=[{label:k("header.locale.auto",{name:oc[b1()]}),checked:r==="auto",onSelect:()=>L("auto")},...Kc.map(m=>({label:oc[m],lang:m,checked:r===m,onSelect:()=>L(m)}))],c=oc[n];return l.jsxs(l.Fragment,{children:[l.jsx("button",{ref:A,className:"icon-button locale-button",onClick:m=>{const _=m.currentTarget.getBoundingClientRect();p(u=>u===null?{x:_.left,y:_.bottom+4}:null)},title:r==="auto"?k("header.locale.titleAuto",{name:c}):k("header.locale.title",{name:c}),"aria-haspopup":"menu","aria-expanded":o!==null,children:g0[n]}),o!==null&&l.jsx($c,{x:o.x,y:o.y,items:s,onClose:w,anchor:A.current})]})}function lx({onKey:n}){return l.jsx("div",{className:"narrow-keys",role:"toolbar","aria-label":k("narrow.keys.label"),children:cw.map(r=>l.jsx("button",{className:"narrow-key",onPointerDown:o=>o.preventDefault(),onClick:()=>n(r.data),title:k(r.titleKey),children:r.label},r.id))})}function cx({banners:n,status:r,statusLabel:o,terminals:p,activeTerminalId:w,activity:A,agents:L,offerAgentChoice:s,newTabAgent:c,canOpen:m,newTabBlockedTitle:_,onSelectTab:u,onCloseTab:y,onRenameTab:S,onNewTab:E,drawer:g,drawerOpen:a,onDrawerChange:f,menu:d,view:h,views:C,onViewChange:D,badges:x,chat:M,panel:b,notes:T,console:N,onTerminalKey:F}){const[P,B]=O.useState(null),H=p.find(j=>j.terminalId===w)??null,q=j=>{var U;return((U=L.find($=>$.id===j.agent))==null?void 0:U.statusLine)??null};O.useEffect(()=>{if(!a&&P===null)return;const j=U=>{U.key==="Escape"&&(U.preventDefault(),U.stopPropagation(),P!==null?B(null):f(!1))};return window.addEventListener("keydown",j,!0),()=>window.removeEventListener("keydown",j,!0)},[a,P,f]);const X=O.useRef({sheet:P,drawerOpen:a,view:h,onDrawerChange:f,onViewChange:D});X.current={sheet:P,drawerOpen:a,view:h,onDrawerChange:f,onViewChange:D},O.useEffect(()=>{const j=window;return j[Kd]=()=>{const U=X.current;switch(pw({dialogOpen:document.querySelector(".modal-backdrop")!==null,sheetOpen:U.sheet!==null,drawerOpen:U.drawerOpen,view:U.view})){case"close-dialog":return window.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:!0,cancelable:!0})),!0;case"close-sheet":return B(null),!0;case"close-drawer":return U.onDrawerChange(!1),!0;case"show-chat":return U.onViewChange("chat"),!0;case null:return!1}},()=>{delete j[Kd]}},[]);const G=O.useRef(null);O.useEffect(()=>{var j;(j=G.current)==null||j.scrollIntoView({block:"nearest",inline:"nearest"})},[h]);const Y=j=>{const U=j==="git"?x.changes:j==="plans"?x.plans:j==="memory"?x.memory:0;return U>0?l.jsx("span",{className:"side-panel-badge",children:U}):j==="cli"&&x.cliUnseen&&h!=="cli"?l.jsx("span",{className:"narrow-view-dot",title:k("panel.cliUnseen")}):null};return l.jsxs(l.Fragment,{children:[l.jsxs("header",{className:"app-header narrow-header",children:[l.jsx("button",{className:"icon-button narrow-icon",onClick:()=>f(!0),title:k("narrow.projects"),"aria-label":k("narrow.projects"),children:"☰"}),l.jsxs("button",{className:"narrow-current",onClick:()=>B("tabs"),title:k("narrow.tabs.open"),children:[H===null?l.jsx("span",{className:"app-name",children:"Agent Workbench"}):l.jsxs(l.Fragment,{children:[l.jsx(nu,{terminal:H,activity:A.get(H.terminalId),statusLine:q(H)}),l.jsx("span",{className:"project-swatch",style:{background:Zr(H.cwd)}}),l.jsx("span",{className:"narrow-current-label",children:Wi(H)})]}),l.jsx("span",{className:"narrow-caret","aria-hidden":"true",children:"▾"})]}),r!=="open"&&l.jsx("span",{className:`status status-${r}`,children:o}),l.jsx("button",{className:"icon-button narrow-icon",onClick:()=>B("menu"),title:k("narrow.more"),"aria-label":k("narrow.more"),children:"⋮"})]}),n,l.jsxs("div",{className:"narrow-body",children:[l.jsx("nav",{className:"narrow-views",role:"tablist",children:C.map(j=>l.jsxs("button",{ref:j===h?G:null,role:"tab","aria-selected":j===h,className:`narrow-view-tab${j===h?" narrow-view-active":""}`,onClick:()=>D(j),children:[l.jsx("span",{children:k(iw(j))}),Y(j)]},j))}),l.jsxs("div",{className:"narrow-stack",children:[l.jsx("main",{className:`workspace narrow-pane${h==="chat"?"":" narrow-pane-veiled"}`,children:M}),b,l.jsx("div",{className:`narrow-pane${h==="notes"?"":" narrow-pane-hidden"}`,children:T}),l.jsx("div",{className:`narrow-pane${h==="console"?"":" narrow-pane-hidden"}`,children:N})]}),F!==null&&l.jsx(lx,{onKey:F})]}),a&&l.jsx("div",{className:"narrow-backdrop",onClick:()=>f(!1),children:l.jsx("div",{className:"narrow-drawer",onClick:j=>j.stopPropagation(),children:g})}),P==="tabs"&&l.jsx("div",{className:"narrow-backdrop",onClick:()=>B(null),children:l.jsxs("div",{className:"narrow-sheet",role:"dialog","aria-label":k("narrow.tabs.open"),onClick:j=>j.stopPropagation(),children:[l.jsx(ux,{terminals:p,activeTerminalId:w,activity:A,statusLineOf:q,onSelect:j=>{u(j),B(null)},onClose:y,onRename:S}),l.jsx(Jc,{className:"narrow-sheet-new",text:k("narrow.tabs.new"),title:_??k("narrow.tabs.new"),disabled:!m||_!==null,offerAgentChoice:s,agents:L,agent:c,onOpen:j=>{E(j),B(null)}})]})}),P==="menu"&&l.jsx("div",{className:"narrow-backdrop",onClick:()=>B(null),children:l.jsx("div",{className:"narrow-sheet",role:"dialog","aria-label":k("narrow.more"),onClick:j=>j.stopPropagation(),children:l.jsx(dx,{menu:d,status:r,statusLabel:o,onClose:()=>B(null)})})})]})}function ux({terminals:n,activeTerminalId:r,activity:o,statusLineOf:p,onSelect:w,onClose:A,onRename:L}){const[s,c]=O.useState(null),[m,_]=O.useState(""),u=O.useRef(null);O.useEffect(()=>{var S;s!==null&&((S=u.current)==null||S.select())},[s]);const y=()=>{s!==null&&L(s,m.trim()),c(null)};return n.length===0?l.jsx("p",{className:"narrow-sheet-empty",children:k("narrow.tabs.none")}):l.jsx("ul",{className:"narrow-tabs",children:n.map(S=>{const E=s===S.terminalId;return l.jsxs("li",{className:`narrow-tab-row${S.terminalId===r?" narrow-tab-active":""}`,style:{"--tab-project-color":Zr(S.cwd)},children:[E?l.jsx("input",{ref:u,className:"narrow-tab-input",value:m,onChange:g=>_(g.target.value),onBlur:y,onKeyDown:g=>{g.key==="Enter"&&y(),g.key==="Escape"&&(g.stopPropagation(),c(null))}}):l.jsxs("button",{className:"narrow-tab-select",onClick:()=>w(S.terminalId),children:[l.jsx(nu,{terminal:S,activity:o.get(S.terminalId),statusLine:p(S)}),l.jsx("span",{className:"narrow-tab-label",children:Wi(S)})]}),l.jsx("button",{className:"icon-button",onClick:()=>{c(S.terminalId),_(S.label.length>0?S.label:Wi(S))},title:k("narrow.tabs.rename"),children:"✎"}),l.jsx("button",{className:"icon-button",onClick:()=>A(S.terminalId),title:k("narrow.tabs.close"),children:"×"})]},S.terminalId)})})}function hx({choice:n}){const r=[{source:"system",label:k("narrow.menu.chimeSystem")},{source:"page",label:k("narrow.menu.chimePage")}];return l.jsx("div",{className:"narrow-chime-choice",role:"group","aria-label":k("narrow.menu.sound"),children:r.map(({source:o,label:p})=>l.jsx("button",{className:`narrow-chime-option${n.source===o?" is-on":""}`,"aria-pressed":n.source===o,onClick:()=>n.setSource(o),children:p},o))})}function dx({menu:n,status:r,statusLabel:o,onClose:p}){return l.jsxs("div",{className:"narrow-menu",children:[l.jsxs("div",{className:"narrow-menu-row",children:[l.jsx("span",{className:"narrow-menu-label",children:k("narrow.menu.connection")}),l.jsx("span",{className:`status status-${r}`,children:o}),$p(navigator.userAgent)&&l.jsxs(l.Fragment,{children:[l.jsx("a",{className:"link-button",href:fw,onClick:p,children:k("narrow.menu.phoneAppDisconnect")}),l.jsx("a",{className:"link-button",href:dw,onClick:p,children:k("narrow.menu.phoneAppSettings")})]})]}),n.cwd!==null&&l.jsxs("div",{className:"narrow-menu-row",children:[l.jsx("span",{className:"narrow-menu-label",children:k("narrow.menu.folder")}),l.jsx("span",{className:"narrow-menu-value",title:n.cwd,children:n.cwd})]}),n.cliVersion!==null&&l.jsxs("div",{className:"narrow-menu-row",children:[l.jsx("span",{className:"narrow-menu-label",children:k("narrow.menu.cli")}),l.jsx("span",{className:"narrow-menu-value",title:n.cliVersion,children:n.cliVersion})]}),n.remoteClient&&l.jsxs("div",{className:"narrow-menu-row",children:[l.jsx("span",{className:"narrow-menu-label",children:k("app.header.remoteBadge")}),l.jsx("span",{className:"narrow-menu-value narrow-menu-value-wrap",children:k("app.header.remoteBadgeTitle")})]}),l.jsxs("div",{className:"narrow-menu-row",children:[l.jsx("span",{className:"narrow-menu-label",children:k("narrow.menu.theme")}),l.jsx("button",{className:"icon-button",onClick:n.onCycleTheme,title:n.themeTitle,children:n.themeIcon})]}),l.jsxs("div",{className:"narrow-menu-row",children:[l.jsx("span",{className:"narrow-menu-label",children:k("narrow.menu.language")}),l.jsx(Tm,{})]}),l.jsxs("div",{className:"narrow-menu-row",children:[l.jsx("span",{className:"narrow-menu-label",children:k("narrow.menu.sound")}),n.sound.phoneChime===null?l.jsx(xm,{sound:n.sound}):l.jsx(hx,{choice:n.sound.phoneChime})]}),n.sound.notify.supported&&l.jsxs("div",{className:"narrow-menu-row",children:[l.jsx("span",{className:"narrow-menu-label",children:k("narrow.menu.notifications")}),l.jsx(km,{notify:n.sound.notify})]}),n.remote!==null&&l.jsxs("div",{className:"narrow-menu-row",children:[l.jsx("span",{className:"narrow-menu-label",children:k("app.header.remoteAccess")}),l.jsx("button",{className:`icon-button${n.remote.active?" icon-button-on":""}`,onClick:()=>{var w;p(),(w=n.remote)==null||w.onOpen()},title:n.remote.title,children:"⇄"})]}),l.jsxs("div",{className:"narrow-menu-row",children:[l.jsx("span",{className:"narrow-menu-label",children:k("narrow.menu.shortcuts")}),l.jsx("button",{className:"icon-button",onClick:()=>{p(),n.onShortcuts()},title:k("app.header.shortcuts"),children:"?"})]})]})}function fx(){const n=window.location.search,r=new URLSearchParams(n).get(Tc),o=r!==null&&r.length>0?r:null,p=aw(n);return o===null&&p===null?{token:o,tab:p}:(window.history.replaceState(null,"",`${window.location.pathname}${lw(n,[Tc,Fp])}`),{token:o,tab:p})}const Rm=fx(),Hf=Rm.token,px=Rm.tab,kc=new Set;function mx(n){const[r,o]=O.useState(null),[p,w]=O.useState(null),[A,L]=O.useState(kc),[s,c]=O.useState(null);O.useEffect(()=>{const a=n.onMessage(d=>{switch(d.type){case"vault.status":o(d.status);break;case"vault.exported":L(h=>{if(!h.has(d.projectKey))return h;const C=new Set(h);return C.delete(d.projectKey),C}),c({projectKey:d.projectKey,sessions:d.sessions,at:Date.now()});break;case"error":if(d.code!=="vault-failed")break;w(Et(d.text)),d.detail!==void 0&&console.error("[servidor]",d.detail),L(kc);break}}),f=n.onReopen(()=>L(kc));return()=>{a(),f()}},[n]);const m=O.useCallback(()=>{w(null),n.send({type:"vault.measure"})},[n]),_=O.useCallback(a=>{w(null),n.send({type:"vault.enable",enabled:a})},[n]),u=O.useCallback(a=>{w(null),n.send({type:"vault.setDir",pickerId:a})},[n]),y=O.useCallback(a=>{w(null),L(f=>new Set(f).add(a)),n.send({type:"vault.exportProject",projectKey:a})},[n]),S=O.useCallback((a,f)=>{w(null),n.send({type:"vault.openSession",agent:a,sessionId:f})},[n]),E=O.useCallback(()=>{w(null),n.send({type:"vault.reveal"})},[n]),g=O.useCallback(()=>w(null),[]);return{status:r,problem:p,exporting:A,lastExported:s,measure:m,setEnabled:_,chooseDir:u,exportProject:y,openSession:S,reveal:E,dismissProblem:g}}function gx(n){return k("summary.outdatedServer",{server:n,page:Fs})}function _x(n){const[r,...o]=n;if(r===void 0||r.missingMessage===null)return null;const p=Et(r.missingMessage);return o.length===0?p:`${p}
139
- ${k("summary.alsoWorksWith",{names:o.map(w=>w.label).join(", ")})}`}function vx(n){const r=n.version??"?";return r.toLowerCase().includes(n.label.toLowerCase())?r:`${n.label} ${r}`}function yx(n,r,o=Fs){var L,s;if(r&&o<Fs)return{cliAvailable:!1,cliVersion:null,cliMissingMessage:gx(o),environmentNotice:null};if(r&&o>Fs)return{cliAvailable:!1,cliVersion:null,cliMissingMessage:k("summary.newerServer",{server:o,page:Fs}),environmentNotice:null};const p=n.filter(c=>c.available);let w=null;p.length===1?w=((L=p[0])==null?void 0:L.version)??null:p.length>1&&(w=p.map(vx).join(" · "));const A=r&&p.length===0;return{cliAvailable:!r||p.length>0,cliVersion:w,cliMissingMessage:A?_x(n):null,environmentNotice:((s=n.find(c=>c.environmentNotice!==null))==null?void 0:s.environmentNotice)??null}}const wx=500,bx=8e3;class Sx{constructor(){Mt(this,"socket",null);Mt(this,"status","connecting");Mt(this,"attempt",0);Mt(this,"closedByUs",!1);Mt(this,"hasConnectedOnce",!1);Mt(this,"reconnectTimer");Mt(this,"messageHandlers",new Set);Mt(this,"statusHandlers",new Set);Mt(this,"reopenHandlers",new Set);Mt(this,"outbox",[])}getStatus(){return this.status}onMessage(r){return this.messageHandlers.add(r),()=>this.messageHandlers.delete(r)}onStatus(r){return this.statusHandlers.add(r),()=>this.statusHandlers.delete(r)}onReopen(r){return this.reopenHandlers.add(r),()=>this.reopenHandlers.delete(r)}connect(){if(this.socket!==null)return;const r=new URL(Qv,window.location.href);r.protocol=window.location.protocol==="https:"?"wss:":"ws:",Hf!==null&&r.searchParams.set(Tc,Hf);const o=new WebSocket(r);this.socket=o,o.onopen=()=>{for(this.attempt=0,this.setStatus("open");this.outbox.length>0;){const p=this.outbox.shift();p!==void 0&&o.send(Nd(p))}if(this.hasConnectedOnce)for(const p of this.reopenHandlers)p();this.hasConnectedOnce=!0},o.onmessage=p=>{const w=r0(p.data);if(w===null){console.warn("[conexion] mensaje del servidor no reconocido");return}for(const A of this.messageHandlers)A(w)},o.onclose=p=>{if(this.socket=null,!this.closedByUs){if(p.code===Wv){this.setStatus("revoked");return}this.setStatus("reconnecting"),this.scheduleReconnect()}},o.onerror=()=>{}}send(r){return this.socket!==null&&this.socket.readyState===WebSocket.OPEN?(this.socket.send(Nd(r)),!0):(r.type!=="input"&&r.type!=="resize"&&this.outbox.push(r),!1)}close(){var r;this.closedByUs=!0,window.clearTimeout(this.reconnectTimer),(r=this.socket)==null||r.close(),this.socket=null}setStatus(r){if(this.status!==r){this.status=r;for(const o of this.statusHandlers)o(r)}}scheduleReconnect(){if(this.attempt+=1,!this.hasConnectedOnce&&this.attempt>4){this.setStatus("failed");return}const r=Math.min(wx*2**(this.attempt-1),bx);window.clearTimeout(this.reconnectTimer),this.reconnectTimer=window.setTimeout(()=>this.connect(),r)}}const Cx={state:"idle",scannedFiles:0,totalFiles:0};function xx(n,r,o){const p=new Map(o?[]:n.map(w=>[w.key,w]));for(const w of r)p.set(w.key,w);return[...p.values()].sort((w,A)=>A.lastActivityAt-w.lastActivityAt)}function kx(){const n=O.useMemo(()=>new Sx,[]),r=O.useMemo(()=>new Gy({send:(Ee,Ue)=>n.send({type:"composer.draft",terminalId:Ee,draft:Ue}),connected:()=>n.getStatus()==="open",setTimer:(Ee,Ue)=>window.setTimeout(Ee,Ue),clearTimer:Ee=>window.clearTimeout(Ee),newId:()=>crypto.randomUUID()}),[n]),[o,p]=O.useState("connecting"),[w,A]=O.useState([]),[L,s]=O.useState(null),[c,m]=O.useState(!1),[_,u]=O.useState(Fs),[y,S]=O.useState(""),[E,g]=O.useState(""),[a,f]=O.useState(null),[d,h]=O.useState(!1),[C,D]=O.useState([]),[x,M]=O.useState([]),[b,T]=O.useState(Cx),[N,F]=O.useState(null),[P,B]=O.useState(new Set),[H,q]=O.useState(new Map),[X,G]=O.useState(new Map),Y=O.useRef(new Map),j=O.useRef(new Map),[U,$]=O.useState(new Set),[V,ne]=O.useState(null),[se,ce]=O.useState([]),[he,K]=O.useState(new Map),[W,J]=O.useState([]),Z=O.useRef(1),de=O.useRef(new Set),ee=O.useRef(new Map),xe=O.useRef(new Map),ke=O.useCallback(Ee=>{const Ue=xe.current.get(Ee);Ue!==void 0&&(clearTimeout(Ue),xe.current.delete(Ee)),ce(fe=>fe.some(pe=>pe.requestId===Ee)?fe.filter(pe=>pe.requestId!==Ee):fe)},[]),le=O.useCallback(()=>{for(const Ee of xe.current.values())clearTimeout(Ee);xe.current.clear(),ce(Ee=>Ee.length===0?Ee:[])},[]);O.useEffect(()=>{const Ee=n.onStatus(pe=>{p(pe),pe==="failed"&&ne({message:k("workspace.connectFailed"),at:Date.now()})}),Ue=n.onMessage(pe=>{switch(pe.type){case"agents":A(pe.agents),s(pe.defaultAgent);break;case"hello":A(pe.agents),s(pe.defaultAgent),m(!0),u(pe.protocolVersion),S(pe.platform),g(pe.defaultCwd),f(pe.shellName),h(pe.remoteClient);break;case"terminal.list":{D(pe.terminals),r.retain(pe.terminals.map(Ge=>Ge.terminalId));const Me=Sy(j.current,pe.terminals),lt=Me.finished.length>0||[...Me.phases].some(([Ge,ht])=>j.current.get(Ge)!==ht);j.current=Me.phases,lt&&$(new Set(Me.phases.keys())),B(Ge=>{if(Ge.size===0)return Ge;const ht=new Set(Ge);for(const Lt of Ge){if(Me.phases.has(Lt))continue;const At=pe.terminals.find(Zn=>Zn.terminalId===Lt);(At===void 0||At.alive)&&ht.delete(Lt)}return ht.size===Ge.size?Ge:ht}),G(Ge=>{if(Ge.size===0)return Ge;const ht=new Map([...Ge].filter(([Lt])=>pe.terminals.some(At=>At.terminalId===Lt)));return ht.size===Ge.size?Ge:(Y.current=ht,ht)});const je=pe.terminals.filter(Ge=>Ge.kind==="agent");F(Ge=>{var ht;return Ge!==null&&je.some(Lt=>Lt.terminalId===Ge)?Ge:((ht=je[0])==null?void 0:ht.terminalId)??null}),K(Ge=>{if(Ge.size===0)return Ge;const ht=new Map(Ge);for(const Lt of Ge.keys())pe.terminals.some(At=>At.terminalId===Lt)||ht.delete(Lt);return ht.size===Ge.size?Ge:ht});break}case"session.continued":K(Me=>new Map(Me).set(pe.terminalId,{sourceAgent:pe.source.agent,includedTurns:pe.includedTurns,totalTurns:pe.totalTurns,totalTurnsIsMinimum:pe.totalTurnsIsMinimum,delivery:pe.delivery,prefillReason:null}));break;case"composer.prefill":{const Me=Z.current;Z.current+=1,J(lt=>[...lt,{id:Me,terminalId:pe.terminalId,text:pe.text}]),K(lt=>{const je=lt.get(pe.terminalId);return je===void 0?lt:new Map(lt).set(pe.terminalId,{...je,delivery:"prefilled",prefillReason:pe.reason})});break}case"composer.drafts":r.restore(pe.drafts);break;case"terminal.opened":{ke(pe.requestId),de.current.delete(pe.requestId)&&pe.terminal.kind==="agent"&&F(pe.terminal.terminalId);const Me=ee.current.get(pe.requestId);Me!==void 0&&(ee.current.delete(pe.requestId),Me(pe.terminal));break}case"terminal.activity":q(Me=>Me.get(pe.terminalId)===pe.activity?Me:new Map(Me).set(pe.terminalId,pe.activity)),G(Me=>{const lt=pe.offlineReason??null;if((Me.get(pe.terminalId)??null)===lt)return Me;const je=new Map(Me);return lt===null?je.delete(pe.terminalId):je.set(pe.terminalId,lt),Y.current=je,je});break;case"index.status":T(pe.status);break;case"index.projects":M(Me=>xx(Me,pe.projects,pe.replace));break;case"error":if(GS(pe.requestId)){pe.detail!==void 0&&console.error("[servidor]",pe.detail);break}if(pe.code==="vault-failed"||pe.code==="search-failed"||pe.code==="remote-failed")break;ne({message:Et(pe.text),at:Date.now()}),B(Me=>Me.size===0?Me:new Set),j.current.size>0&&(j.current=new Map,$(new Set)),pe.detail!==void 0&&console.error("[servidor]",pe.detail),pe.requestId!==void 0&&(de.current.delete(pe.requestId),ee.current.delete(pe.requestId),ke(pe.requestId));break}}),fe=n.onReopen(()=>{le(),B(pe=>pe.size===0?pe:new Set),j.current.size>0&&(j.current=new Map,$(new Set))});return n.connect(),()=>{Ee(),Ue(),fe(),n.close()}},[n,r,ke,le]),O.useEffect(()=>{const Ee=n.onReopen(()=>r.reconnected()),Ue=()=>r.flushAll(),fe=()=>{document.visibilityState==="hidden"&&r.flushAll()};return window.addEventListener("pagehide",Ue),document.addEventListener("visibilitychange",fe),()=>{Ee(),window.removeEventListener("pagehide",Ue),document.removeEventListener("visibilitychange",fe)}},[n,r]),O.useEffect(()=>le,[le]);const we=O.useCallback(Ee=>{const Ue=crypto.randomUUID();de.current.add(Ue),Ee.onOpened!==void 0&&ee.current.set(Ue,Ee.onOpened),ce(pe=>[...pe,{requestId:Ue,cwd:Ee.cwd,agent:Ee.agent??null,label:Ee.label??"",at:Date.now()}]);const fe=setTimeout(()=>ke(Ue),xy);xe.current.set(Ue,fe),n.send({type:"terminal.open",requestId:Ue,cwd:Ee.cwd,...Ee.resumeSessionId!==void 0?{resumeSessionId:Ee.resumeSessionId}:{},...Ee.label!==void 0?{label:Ee.label}:{},...Ee.agent!==void 0?{agent:Ee.agent}:{}})},[n,ke]),me=O.useCallback(Ee=>{n.send({type:"terminal.open",requestId:crypto.randomUUID(),cwd:Ee,kind:"shell"})},[n]),Qe=O.useCallback(Ee=>n.send({type:"terminal.close",terminalId:Ee}),[n]),nt=O.useCallback(Ee=>{B(Ue=>new Set(Ue).add(Ee)),Y.current.get(Ee)==="server-closed"&&(j.current=new Map(j.current).set(Ee,"waiting-exit"),$(new Set(j.current.keys()))),n.send({type:"terminal.wake",terminalId:Ee})},[n]),De=O.useCallback((Ee,Ue)=>n.send({type:"terminal.rename",terminalId:Ee,label:Ue}),[n]),Te=O.useCallback(Ee=>n.send({type:"tabs.reorder",terminalIds:Ee}),[n]),We=O.useCallback((Ee,Ue)=>n.send({type:"session.archive",sessionIds:Ee,archived:Ue}),[n]),Le=O.useCallback((Ee,Ue,fe)=>{const pe=crypto.randomUUID();de.current.add(pe),n.send({type:"session.continue",requestId:pe,agent:Ee.agent,sessionId:Ee.sessionId,target:Ue,label:fe})},[n]),Ke=O.useCallback(Ee=>{K(Ue=>{if(!Ue.has(Ee))return Ue;const fe=new Map(Ue);return fe.delete(Ee),fe})},[]),$e=O.useCallback(Ee=>{J(Ue=>Ue.some(fe=>fe.id===Ee)?Ue.filter(fe=>fe.id!==Ee):Ue)},[]),tt=O.useCallback(()=>n.send({type:"index.refresh"}),[n]),St=O.useCallback(()=>n.send({type:"agents.refresh"}),[n]),ze=O.useCallback(()=>ne(null),[]),ut=O.useMemo(()=>C.filter(Ee=>Ee.kind==="agent"),[C]),Ze=O.useMemo(()=>C.filter(Ee=>Ee.kind==="shell"),[C]),ge=Ki(),Re=O.useMemo(()=>yx(w,c,_),[w,c,_,ge]),rt=O.useCallback(Ee=>{var Ue;return(Ee===null||(Ue=w.find(fe=>fe.id===Ee))==null?void 0:Ue.capabilities)??tp},[w]),at=O.useMemo(()=>Vc(w),[w]);return{connection:n,status:o,agents:w,defaultAgent:L,capabilitiesFor:rt,offerAgentChoice:at,cliAvailable:Re.cliAvailable,cliVersion:Re.cliVersion,cliMissingMessage:Re.cliMissingMessage,platform:y,defaultCwd:E,environmentNotice:Re.environmentNotice,shellName:a,remoteClient:d,terminals:ut,shells:Ze,pendingOpens:se,activeTerminalId:N,projects:x,indexStatus:b,error:V,dismissError:ze,setActiveTerminal:F,openTerminal:we,openShell:me,closeTerminal:Qe,wakeTerminal:nt,waking:P,activity:H,offlineReasons:X,relaunching:U,renameTerminal:De,reorderTabs:Te,refreshIndex:tt,refreshAgents:St,archiveSessions:We,continueSession:Le,handoffs:he,dismissHandoff:Ke,prefills:W,prefillApplied:$e,drafts:r}}function Ex({status:n,agents:r,indexReady:o,problem:p,covered:w,onMeasure:A,onSetEnabled:L,onChangeDir:s,onReveal:c,onDismissProblem:m,onClose:_}){return O.useEffect(()=>{if(w)return;const u=y=>{y.key==="Escape"&&(y.preventDefault(),y.stopPropagation(),_())};return window.addEventListener("keydown",u,!0),()=>window.removeEventListener("keydown",u,!0)},[w,_]),l.jsx("div",{className:"modal-backdrop",onClick:_,children:l.jsxs("div",{className:"modal vault-modal",role:"dialog","aria-label":Ui(),onClick:u=>u.stopPropagation(),children:[l.jsxs("header",{className:"modal-header",children:[l.jsx("span",{className:"modal-title",children:Ui()}),n!==null&&l.jsx("span",{className:`vault-state${n.enabled?" vault-state-on":""}`,children:Ub(n)}),l.jsx("button",{className:"icon-button",onClick:_,title:k("common.closeEsc"),children:"×"})]}),l.jsxs("div",{className:"modal-body",children:[l.jsx("p",{className:"vault-lead",children:Ob()}),l.jsx("p",{className:"modal-hint",children:Bb()}),n===null?l.jsx("p",{className:"modal-hint",children:k("vault.dialog.waiting")}):l.jsx(Lx,{status:n,agents:r,indexReady:o,onMeasure:A,onSetEnabled:L,onChangeDir:s,onReveal:c}),p!==null&&l.jsxs("div",{className:"vault-problem",role:"alert",children:[l.jsx("span",{children:p}),l.jsx("button",{className:"icon-button",onClick:m,title:k("common.dismissNotice"),children:"×"})]})]})]})})}function Lx({status:n,agents:r,indexReady:o,onMeasure:p,onSetEnabled:w,onChangeDir:A,onReveal:L}){const s=qb(n,o),c=Kb(n),m=Vb(n),_=n.measurement===null?null:Xb(n.measurement,r),u=n.progress;return l.jsxs(l.Fragment,{children:[n.enabled&&l.jsxs(l.Fragment,{children:[l.jsx("h3",{className:"modal-section",children:k("vault.dialog.inFolder")}),l.jsxs("p",{className:"vault-summary",children:[gm(n.sessions)," · ",nn(n.bytes),n.lastPassAt!==null&&l.jsxs(l.Fragment,{children:[" · ",k("vault.dialog.lastPass",{when:Fn(n.lastPassAt)})]}),n.pending>0&&l.jsxs(l.Fragment,{children:[" · ",k("vault.dialog.pendingCalm",{count:n.pending})]})]})]}),u!==null&&u.total>0&&l.jsx("progress",{className:"vault-progress",value:u.done,max:u.total}),l.jsx("h3",{className:"modal-section",children:k("vault.dialog.sizeSection")}),l.jsxs("div",{className:"vault-actions",children:[l.jsx("button",{className:"link-button vault-measure",onClick:p,disabled:s!==null,title:s??k("vault.dialog.measureTitle"),children:n.state==="measuring"?k("vault.state.measuring"):k(_===null?"vault.dialog.measure":"vault.dialog.measureAgain")}),_!==null&&l.jsx("span",{className:"modal-hint",children:_.summary})]}),_!==null&&l.jsx("div",{className:"vault-table-wrap",children:l.jsxs("table",{className:"vault-table",children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{children:"CLI"}),l.jsx("th",{children:k("vault.dialog.table.sessions")}),l.jsx("th",{children:k("vault.dialog.table.size")}),l.jsx("th",{children:k("vault.dialog.table.images")}),l.jsx("th",{title:k("vault.dialog.table.archivedTitle"),children:k("vault.dialog.table.archived")})]})}),l.jsxs("tbody",{children:[_.rows.map(y=>l.jsxs("tr",{children:[l.jsxs("td",{children:[y.label,y.note!==null&&l.jsx("span",{className:"vault-table-note",children:y.note})]}),l.jsx("td",{children:y.sessions}),l.jsx("td",{children:nn(y.bytes)}),l.jsx("td",{title:y.images>0?nn(y.imageBytes):void 0,children:y.images}),l.jsx("td",{children:y.skippedArchived})]},y.agent)),l.jsxs("tr",{children:[l.jsx("td",{children:k("vault.dialog.table.memory",{count:_.memoryProjects})}),l.jsx("td",{}),l.jsx("td",{children:nn(_.memoryBytes)}),l.jsx("td",{}),l.jsx("td",{})]})]}),l.jsx("tfoot",{children:l.jsxs("tr",{children:[l.jsx("td",{children:k("vault.dialog.table.total")}),l.jsx("td",{children:_.total.sessions}),l.jsx("td",{children:nn(_.total.bytes)}),l.jsx("td",{children:_.total.images}),l.jsx("td",{children:_.total.skippedArchived})]})})]})}),l.jsxs("div",{className:"vault-actions vault-switch",children:[m==="enabled"&&l.jsxs(l.Fragment,{children:[l.jsx("button",{className:"link-button",onClick:()=>w(!1),children:k("vault.dialog.turnOff")}),l.jsx("span",{className:"modal-hint",children:k("vault.dialog.turnOffHint")})]}),(m==="measured"||m==="existing")&&l.jsxs(l.Fragment,{children:[l.jsx("button",{className:"primary-button",onClick:()=>w(!0),title:k(m==="existing"?"vault.dialog.activateExistingTitle":"vault.dialog.activateMeasuredTitle"),children:k("vault.dialog.activate")}),l.jsx("span",{className:"modal-hint",children:k(m==="existing"?"vault.dialog.activateExistingHint":"vault.dialog.activateMeasuredHint")})]}),m==="needs-measure"&&l.jsx("span",{className:"modal-hint",children:k("vault.dialog.needsMeasure",{activate:k("vault.dialog.activate")})})]}),l.jsx("h3",{className:"modal-section",children:k("vault.dialog.folderSection")}),l.jsx("p",{className:"vault-dir",title:n.dir,children:n.dir}),n.isDefaultDir&&l.jsx("p",{className:"modal-hint",children:k("vault.dialog.defaultDir")}),l.jsxs("div",{className:"vault-actions",children:[l.jsx("button",{className:"link-button",onClick:A,disabled:c!==null,title:c??k("vault.dialog.changeDirTitle"),children:k("vault.dialog.changeDir")}),L!==null&&l.jsx("button",{className:"link-button",onClick:L,title:k("vault.dialog.openFolderTitle"),children:k("vault.dialog.openFolder")})]}),n.previousDir!==null&&l.jsx("p",{className:"modal-hint",children:Gb(n.previousDir)}),n.lastError!==null&&l.jsxs(l.Fragment,{children:[l.jsx("h3",{className:"modal-section",children:k("vault.dialog.lastError")}),l.jsx("p",{className:"vault-error",children:Et(n.lastError)})]})]})}const $f={connecting:"app.status.connecting",open:"app.status.open",reconnecting:"app.status.reconnecting",failed:"app.status.failed",revoked:"app.status.revoked"},Uf=320,Tx=1400,Rx=640,Wf=200,zf=560,Mx=270,Ax=120,Nx=720,Dx=260,Vf="agent-workbench.panel-width",qf="agent-workbench.panel-visible",Kf="agent-workbench.panel-tab",Ec="agent-workbench.panel-expanded",Gf="agent-workbench.sidebar-visible",Yf="agent-workbench.sidebar-width",Xf="agent-workbench.console-visible",Qf="agent-workbench.console-height",Jf="agent-workbench.marker-notice-dismissed";function Ix(){var gs,_s,ar;const n=Ki(),r=kx(),{connection:o,status:p,agents:w,defaultAgent:A,capabilitiesFor:L,offerAgentChoice:s,cliAvailable:c,cliVersion:m,cliMissingMessage:_,platform:u,defaultCwd:y,environmentNotice:S,shellName:E,terminals:g,archiveSessions:a,shells:f,pendingOpens:d,activeTerminalId:h,projects:C,indexStatus:D,error:x,dismissError:M,setActiveTerminal:b,openTerminal:T,openShell:N,closeTerminal:F,wakeTerminal:P,waking:B,activity:H,offlineReasons:q,relaunching:X,renameTerminal:G,reorderTabs:Y,refreshIndex:j,refreshAgents:U,continueSession:$,handoffs:V,dismissHandoff:ne,prefills:se,prefillApplied:ce,drafts:he,remoteClient:K}=r,W=nC(),J=O.useMemo(()=>({nameOf:ie=>wC(g.find(Se=>Se.terminalId===ie)),activate:b}),[g,b]),Z=xC(H,J),de=kC(),ee=g.find(ie=>ie.terminalId===h)??null,xe=O.useCallback(ie=>{ie!==h&&M(),b(ie)},[h,M,b]),ke=(ee==null?void 0:ee.agent)??null,le=L(ke),we=O.useMemo(()=>M0(le),[le]),me=w.find(ie=>ie.id===ke)??null,Qe=O.useMemo(()=>{if(ee===null||ke===null)return null;for(const ie of C){const Se=ie.sessions.find(Je=>Je.agent===ke&&Je.sessionId===ee.sessionId);if(Se!==void 0)return Bn(Se.title,Se.titleSource)}return null},[ee,ke,C,n]),nt=(me==null?void 0:me.statusLine)??null,De=(ee==null?void 0:ee.cwd)??y,Te=O.useMemo(()=>s?ty(g,De,u,w,A):null,[s,g,De,u,w,A]),We=O.useMemo(()=>$d(d,De,u),[d,De,u]),Le=We?Mp():null,Ke=JS(o),$e=mx(o),[tt,St]=O.useState(!1),ze=MC(o),[ut,Ze]=O.useState(!1),ge=Nw(),[Re,rt]=O.useState(!1),at=O.useCallback(()=>rt(!1),[]),[Ee,Ue]=O.useState(()=>bt(Vd,"chat",tw)),fe=O.useMemo(()=>nw({hasTab:ee!==null,plansAvailable:we.plansAvailable}),[ee,we.plansAvailable]),pe=rw(Ee,fe),Me=O.useCallback(ie=>{Ue(ie),ft(Vd,ie)},[]),lt=O.useRef(px);O.useEffect(()=>{if(lt.current!==null)return o.onMessage(ie=>{if(ie.type!=="terminal.list"||lt.current===null)return;const Se=lt.current;lt.current=null,ie.terminals.some(Je=>Je.terminalId===Se&&Je.kind==="agent")&&b(Se)})},[o,b]);const je=VS(o),Ge=ib(w,$e.status),[ht,Lt]=O.useState(null),At=O.useRef(0),Zn=O.useCallback(ie=>{Lt(Se=>Se!==null&&Se.seq===ie?null:Se)},[]),es=(ie,Se)=>{const Je=yb(ie,{projects:C,terminals:g,platform:u,canResume:zn=>Od(w,zn)}),Nn=()=>{Se.length!==0&&(At.current+=1,Lt({query:Se,seq:At.current}))};switch(Je.kind){case"activate":xe(Je.terminalId),Nn();break;case"resume":Je.session.archived&&a([Je.session.sessionId],!1),T({cwd:Je.cwd,resumeSessionId:Je.session.sessionId,agent:Je.session.agent,label:Bn(Je.session.title,Je.session.titleSource)}),Nn();break;case"copy":$e.openSession(ie.agent,ie.sessionId);break}},Mn=O.useMemo(()=>new Set(g.map(ie=>ie.sessionId).filter(ie=>ie.length>0)),[g]),[$n,Lr]=O.useState(()=>bt(qf,!0,ie=>ie==="true")),[Ks,Tr]=O.useState(()=>bt(Kf,"cli",ie=>ie==="git"||ie==="files"||ie==="cli"||ie==="plans"||ie==="memory"?ie:ie==="conversation"?"cli":null)),[Yi,Rr]=O.useState(()=>bt(Vf,Rx,ie=>{const Se=Number.parseInt(ie,10);return Number.isFinite(Se)?Math.max(Se,Uf):null})),[Mr,Ar]=O.useState(()=>bt(Ec,!1,ie=>ie==="true")),[Nr,ya]=O.useState(()=>bt(Gf,!0,ie=>ie==="true")),[Xi,wa]=O.useState(()=>bt(Yf,Mx,ie=>{const Se=Number.parseInt(ie,10);return Number.isFinite(Se)?Math.min(zf,Math.max(Wf,Se)):null})),[un,Qi]=O.useState(()=>bt(Xf,!1,ie=>ie==="true")),[Gs,ba]=O.useState(()=>bt(Qf,Dx,ie=>{const Se=Number.parseInt(ie,10);return Number.isFinite(Se)?Se:null})),[Ji,Zi]=O.useState(()=>bt(Jf,!0,ie=>ie!=="true")),[eo,ts]=O.useState(!1),[Sa,Ys]=O.useState(!1);O.useEffect(()=>{nt===null&&Ys(!1)},[nt]);const[pt,er]=O.useState(null),tr=$n&&ee!==null,Dr=U0(Ks,we.plansAvailable),yn=ee!==null?$n||un:$n,Xs=Mr&&ee!==null,rn=O.useMemo(()=>ee===null?[]:f.filter(ie=>ie.cwd===ee.cwd),[f,ee]),[ns,sn]=O.useState(null),nr=rn.find(ie=>ie.terminalId===ns)??rn[0]??null,Ft=pe==="cli"?h:pe==="console"?(nr==null?void 0:nr.terminalId)??null:null,Ca=O.useCallback(ie=>{Ft!==null&&o.send({type:"input",terminalId:Ft,data:ie})},[o,Ft]),Ht=$1(o,h),Qs=LC(o,H),Ir=ge?ee!==null:tr,rs=ge?pe==="files":tr&&Dr==="files",rr=KS(o,Ir?h:null),ss=zS(o,rs?h:null),to=qS(o,h),Js=QS(o,Ir?h:null),Zs=ge?pe==="cli":tr&&Dr==="cli",ei=Ht.usage.lastModel,is=Ht.usage.lastEffort??((gs=[...Ht.events].reverse().find(ie=>ie.effort!==null))==null?void 0:gs.effort)??null,sr=ei??Ht.defaults.model,no=is??Ht.defaults.effort,ti=ei===null&&sr!==null,ot=is===null&&no!==null,ni=US(o,h,Zs),os=h===null?null:H.get(h)??null,as=_y(le,Ht.openToolCall,(me==null?void 0:me.label)??null,(ee==null?void 0:ee.alive)??!1,os),ls=vy({offlineReason:h===null?null:q.get(h)??null,alive:(ee==null?void 0:ee.alive)??!1,relaunching:h!==null&&X.has(h)}),cs=ls===null?null:yy((me==null?void 0:me.label)??null),ro=cs??as??Cy(le,Ht.waitingFor,(ee==null?void 0:ee.alive)??!1),ri=!ep(le,os),us=O.useMemo(()=>Tp(w,ke),[w,ke]),wn=ee!==null&&py(ke,ee.sessionId,le),Pt=h===null?null:V.get(h)??null,An=Pt===null?null:{text:cy(qi(Pt.sourceAgent,w),Pt.includedTurns,Pt.totalTurns,Pt.totalTurnsIsMinimum),status:Pt.prefillReason!==null?hy(Pt.prefillReason):Pt.delivery==="sending"&&Ht.events.length===0?uy():null},bn=O.useCallback(()=>{Lr(ie=>{const Se=!ie;return ft(qf,String(Se)),Se})},[]),ir=O.useCallback(()=>{ya(ie=>{const Se=!ie;return ft(Gf,String(Se)),Se})},[]),Sn=O.useCallback(()=>{Qi(ie=>{const Se=!ie;return ft(Xf,String(Se)),Se})},[]),so=O.useCallback(ie=>{Tr(ie),ft(Kf,ie)},[]),io=O.useCallback(()=>{Ar(ie=>{const Se=!ie;return ft(Ec,String(Se)),Se})},[]),Pr=O.useCallback(()=>{h!==null&&o.send({type:"input",terminalId:h,data:"\x1B\x1B"})},[o,h]),xa=O.useCallback(ie=>{h!==null&&o.send({type:"input",terminalId:h,data:`${ie} `})},[o,h]),jr=O.useRef(null),hs=O.useCallback(ie=>{var Se;return(Se=jr.current)==null?void 0:Se.call(jr,ie,!ge)},[ge]),oo=O.useCallback(ie=>{h!==null&&o.send({type:"agent.submit",terminalId:h,text:ie,images:[]})},[o,h]),ka=O.useCallback(ie=>{h!==null&&o.send({type:"files.reveal",terminalId:h,path:ie})},[o,h]),hn=O.useRef(new Set);O.useEffect(()=>{if(!un){hn.current.clear();return}if(ee===null)return;const{cwd:ie}=ee;if(f.some(Se=>Se.cwd===ie)){hn.current.delete(ie);return}hn.current.has(ie)||(hn.current.add(ie),N(ie))},[un,ee,f,N]);const Or=O.useCallback(ie=>{const Se=rn.find(Je=>Je.terminalId===ie);Se!==void 0&&hn.current.delete(Se.cwd),F(ie)},[rn,F]),Un=O.useRef(new Set);O.useEffect(()=>{const ie=rn.filter(Je=>!Un.current.has(Je.terminalId));for(const Je of rn)Un.current.add(Je.terminalId);const Se=ie[ie.length-1];Se!==void 0&&sn(Se.terminalId)},[rn]);const ds=O.useCallback(()=>{ee!==null&&(hn.current.add(ee.cwd),N(ee.cwd))},[ee,N]),Ea=ca({min:Uf,max:Tx,value:Yi,measure:O.useCallback(ie=>window.innerWidth-ie.clientX,[]),onChange:Rr,onCommit:O.useCallback(ie=>ft(Vf,String(ie)),[]),onStart:O.useCallback(()=>{Ar(!1),ft(Ec,"false")},[])}),La=ca({min:Wf,max:zf,value:Xi,measure:O.useCallback(ie=>ie.clientX,[]),onChange:wa,onCommit:O.useCallback(ie=>ft(Yf,String(ie)),[])}),si=ca({min:Ax,max:Nx,value:Gs,measure:O.useCallback(ie=>window.innerHeight-ie.clientY,[]),onChange:ba,onCommit:O.useCallback(ie=>ft(Qf,String(ie)),[])}),fs=O.useCallback(()=>{Zi(!1),ft(Jf,"true")},[]),Br=O.useCallback(ie=>{if(g.length===0)return;const Je=(g.findIndex(zn=>zn.terminalId===h)+ie+g.length)%g.length,Nn=g[Je];Nn!==void 0&&xe(Nn.terminalId)},[g,h,xe]),ii=O.useRef(null),dn=O.useRef(null);O.useEffect(()=>{h!==dn.current&&(ii.current=dn.current,dn.current=h)},[h]);const ps=O.useCallback(()=>{const ie=ii.current;ie===null||ie===h||g.some(Se=>Se.terminalId===ie)&&xe(ie)},[h,g,xe]);O.useEffect(()=>{const ie=Se=>{if(Se.key!=="Tab"||!Se.shiftKey||Se.altKey||Se.ctrlKey||Se.metaKey)return;const Je=document.activeElement;Je instanceof Element&&Je.closest(".xterm")!==null||(Se.preventDefault(),Se.stopPropagation(),ps())};return window.addEventListener("keydown",ie,!0),()=>window.removeEventListener("keydown",ie,!0)},[ps]),O.useEffect(()=>{const ie=Se=>{if(!Se.altKey||Se.ctrlKey||Se.metaKey)return;const Je=Se.key.toLowerCase();if(Je==="t"){c&&y.length>0&&!We&&(Se.preventDefault(),Se.stopPropagation(),T({cwd:(ee==null?void 0:ee.cwd)??y}));return}if(Je==="w"){h!==null&&(Se.preventDefault(),Se.stopPropagation(),F(h));return}if(Je==="p"){Se.preventDefault(),Se.stopPropagation(),bn();return}if(Je==="arrowright"||Je==="pagedown"){Se.preventDefault(),Se.stopPropagation(),Br(1);return}(Je==="arrowleft"||Je==="pageup")&&(Se.preventDefault(),Se.stopPropagation(),Br(-1))};return window.addEventListener("keydown",ie,!0),()=>window.removeEventListener("keydown",ie,!0)},[ee,h,c,F,Br,y,We,T,bn]);const ms=ee===null?k("app.panel.name"):ee.label.length>0?ee.label:ee.cwd.split(/[\\/]/).filter(ie=>ie.length>0).pop()??ee.cwd,oi=l.jsx(sS,{projects:C,indexStatus:D,disabled:!c,onOpenProject:(ie,Se)=>{at(),T({cwd:ie,...Se!==void 0?{agent:Se}:{}})},agents:w,offerAgentChoice:s,agentForProject:ie=>ny(g,ie,u,w,A),onOpenSession:(ie,Se)=>{at(),T({cwd:ie,resumeSessionId:Se.sessionId,agent:Se.agent,label:Bn(Se.title,Se.titleSource)})},canResume:ie=>Od(w,ie),platform:u,onRefresh:j,openSessionIds:Mn,openBlocked:ie=>$d(d,ie,u),onArchive:a,onHide:ge?at:ir,width:Xi,onNewProject:()=>{at(),er("project")},vault:$e.status,onOpenVault:()=>{at(),St(!0)},onOpenVaultSession:K?null:ie=>$e.openSession(ie.agent,ie.sessionId),onExportProject:K?null:$e.exportProject,exporting:$e.exporting,lastExported:$e.lastExported,onContinueSession:(ie,Se)=>{at(),$({agent:ie.agent,sessionId:ie.sessionId},Se,Fd(Bn(ie.title,ie.titleSource)))},globalSearch:Ge?{...je,vaultEnabled:((_s=$e.status)==null?void 0:_s.enabled)===!0}:null,onOpenSearchHit:(ie,Se)=>{at(),es(ie,Se)}}),Fr=l.jsx("div",{className:"chat-stack",children:g.length===0?l.jsxs("div",{className:"empty-state",children:[l.jsx("p",{children:k("app.empty.noTabs")}),l.jsx("p",{className:"empty-hint",children:k("app.empty.hint")}),c&&y.length>0&&l.jsx("button",{className:"primary-button",onClick:()=>T({cwd:y}),disabled:We,title:Le??void 0,children:We?k("app.empty.opening"):k("app.empty.newSession",{cwd:y})})]}):l.jsx(z1,{view:Ht,terminalId:h,threadFont:de,onRewind:we.rewind&&(ee==null?void 0:ee.alive)===!0?Pr:void 0,questionsAnswerable:we.questionsAnswerable,contextWindowSource:we.contextWindowSource,instructionsFile:R0(ke),onGoToCli:()=>{if(ge){Me("cli");return}tr||bn(),so("cli")},cliPresence:ee===null||ee.alive?"live":ee.sleeping?"sleeping":"exited",exitCode:(ee==null?void 0:ee.exitCode)??null,waking:h!==null&&B.has(h),onWakeCli:()=>{h!==null&&P(h)},discovering:wn,continueTargets:us,continueBlockedReason:ly((ee==null?void 0:ee.sessionId)??"",wn,Ht.events.length>0),onContinue:ee===null||ke===null?void 0:ie=>$({agent:ke,sessionId:ee.sessionId},ie,Fd(Qe??ee.label)),searchRequest:ht,onSearchRequestApplied:Zn,toolCallNotice:as,serverClosed:ls===null||cs===null?null:{state:ls,text:cs},statusLineState:(nt==null?void 0:nt.state)??null,onConfigureStatusLine:nt===null?void 0:()=>Ys(!0),activity:os,receipt:h===null?null:Qs.receipts.get(h)??null,clock:h===null?null:Qs.clocks.get(h)??null})}),Hr=l.jsx(l.Fragment,{children:ee!==null&&l.jsx($w,{connection:o,drafts:he,terminalId:h,alive:ee.alive,sleeping:ee.sleeping,projectColor:Zr(ee.cwd),activity:H.get(ee.terminalId),imagesAllowed:we.imagesAllowed,blockedReason:ro,prefills:se,onPrefillApplied:ce,notice:An,onDismissNotice:h===null?void 0:()=>ne(h),onSubmitted:(ie,Se,Je)=>{ne(ie);const{events:Nn}=Ht,zn=ie===h?Nn[Nn.length-1]:void 0;Qs.track(ie,Se,(zn==null?void 0:zn.eventId)??null,Je)},fontSize:de.size,insertRef:jr,leading:we.modeCycle===null?void 0:l.jsx(Ay,{mode:Ht.permissionMode,cycle:we.modeCycle,disabled:!ee.alive,waitingFor:Ht.waitingFor,statusKnown:ri,onChange:Ht.setPermissionMode}),controls:we.models===null&&we.efforts===null?void 0:l.jsx(My,{models:we.models,efforts:we.efforts,model:sr,effort:no,modelProvisional:ti,effortProvisional:ot,savesChoice:T0(ke),disabled:!ee.alive,onCommand:oo})})}),ai=ee===null?null:l.jsx(BS,{tab:ge?qd(pe)??Dr:Dr,plansAvailable:we.plansAvailable,hidden:ge?qd(pe)===null:!$n,onTabChange:ge?Me:so,title:ms,cwd:ee.cwd,platform:u,cli:l.jsx("div",{className:"terminal-stack",children:g.map(ie=>l.jsx(Xp,{terminalId:ie.terminalId,connection:o,active:ie.terminalId===h,theme:W.resolved,autoFocus:!1},ie.terminalId))}),cliUnseen:ni,expanded:Mr,onToggleExpanded:io,git:rr,files:ss,plans:to,memory:Js,onInsert:we.fileMentions&&ee.alive?xa:void 0,onInsertPath:hs,onReveal:K?null:ka,onHide:bn}),$t=ee===null?null:l.jsx(h1,{connection:o,shells:rn,activeShellId:(nr==null?void 0:nr.terminalId)??null,cwd:ee.cwd,shellName:E,theme:W.resolved,onSelect:sn,onOpen:ds,onCloseShell:Or,onCollapse:ge?()=>Me("chat"):Sn}),Wn=l.jsx(rx,{notes:Ke,fill:ge||ee===null,onSendNote:ee===null||!we.noteSendable?null:ie=>{const Se=ee.cwd;T({cwd:Se,...ee.agent!==null?{agent:ee.agent}:{},onOpened:Je=>{o.send({type:"notes.send",noteId:ie,terminalId:Je.terminalId}),ge&&Me("chat")}})},sendTargetCwd:(ee==null?void 0:ee.cwd)??null}),li=ee===null?null:l.jsx(l.Fragment,{children:un?l.jsxs(l.Fragment,{children:[$n&&l.jsx("div",{className:"hdivider",...si,title:k("app.divider.consoleHeight")}),l.jsx("div",{className:"console-slot",style:$n?{height:`${Gs}px`}:{flex:"1 1 auto"},children:$t})]}):l.jsxs("button",{className:"strip-collapsed",onClick:Sn,title:E===null?k("console.openAnyIn",{cwd:ee.cwd}):k("console.openIn",{shell:E,cwd:ee.cwd}),children:[l.jsx("span",{className:"strip-collapsed-arrow",children:"▸"}),l.jsx("span",{children:E??k("console.name")}),rn.length>0&&l.jsx("span",{className:"strip-collapsed-count",children:rn.length})]})}),or=l.jsxs(l.Fragment,{children:[p==="revoked"&&l.jsx("div",{className:"banner banner-error",children:k("app.banner.revoked")}),!c&&_!==null&&l.jsx("div",{className:"banner banner-error banner-lines",children:_}),S==="child-session-marker"&&Ji&&l.jsxs("div",{className:"banner banner-notice",children:[l.jsx("span",{children:Bt("app.markerNotice",{variable:"CLAUDE_CODE_CHILD_SESSION"})}),l.jsx("button",{className:"banner-close",onClick:fs,title:k("common.gotIt"),children:"×"})]}),x!==null&&l.jsxs("div",{className:"banner banner-error",children:[l.jsx("span",{children:x.message}),l.jsx("button",{className:"banner-close",onClick:M,title:k("common.close"),children:"×"})]}),$e.problem!==null&&!tt&&l.jsxs("div",{className:"banner banner-error",children:[l.jsx("span",{children:$e.problem}),l.jsx("button",{className:"banner-close",onClick:$e.dismissProblem,title:k("common.close"),children:"×"})]}),l.jsx(Rb,{})]}),ao=l.jsxs(l.Fragment,{children:[Sa&&nt!==null&&me!==null&&l.jsx(Tb,{info:nt,agentLabel:me.label,onRefresh:U,onClose:()=>Ys(!1)}),eo&&l.jsx(kb,{agent:W0(ke,w,A),onClose:()=>ts(!1)}),pt==="project"&&l.jsx(gf,{connection:o,title:k("app.picker.project.title"),confirmLabel:k("app.picker.project.confirm"),confirmTitle:ie=>k("app.picker.project.confirmTitle",{path:ie}),onChoose:(ie,Se)=>{er(null),T({cwd:Se})},onClose:()=>er(null)}),tt&&l.jsx(Ex,{status:$e.status,agents:w,indexReady:D.state==="ready",problem:$e.problem,covered:pt==="vault",onMeasure:$e.measure,onSetEnabled:$e.setEnabled,onChangeDir:()=>er("vault"),onReveal:K?null:$e.reveal,onDismissProblem:$e.dismissProblem,onClose:()=>St(!1)}),ut&&ze.status!==null&&!K&&l.jsx(JC,{status:ze.status,pairing:ze.pairing,phonePairing:ze.phonePairing,phoneStarted:ze.phoneStarted,problem:ze.problem,platform:u,onSetEnabled:ze.setEnabled,onSetPort:ze.setPort,onStartPairing:ze.startPairing,onCancelPairing:ze.cancelPairing,onStartPhonePairing:ze.startPhonePairing,onCancelPhonePairing:ze.cancelPhonePairing,onRenameDevice:ze.renameDevice,onRevokeDevice:ze.revokeDevice,onDismissProblem:ze.dismissProblem,onClose:()=>Ze(!1)}),pt==="vault"&&l.jsx(gf,{connection:o,title:k("app.picker.vault.title"),confirmLabel:k("app.picker.vault.confirm"),confirmTitle:ie=>k("app.picker.vault.confirmTitle",{path:ie}),onChoose:ie=>{$e.chooseDir(ie),er(null)},onClose:()=>er(null)})]});return ge?l.jsxs("div",{className:"app app-narrow",children:[l.jsx(cx,{banners:or,status:p,statusLabel:k($f[p]),terminals:g,activeTerminalId:h,activity:H,agents:w,offerAgentChoice:s,newTabAgent:Te,canOpen:c&&y.length>0,newTabBlockedTitle:Le,onSelectTab:xe,onCloseTab:F,onRenameTab:G,onNewTab:ie=>T({cwd:De,...ie!==void 0?{agent:ie}:{}}),drawer:oi,drawerOpen:Re,onDrawerChange:rt,menu:{cwd:(ee==null?void 0:ee.cwd)??null,cliVersion:m,themeIcon:Tf[W.preference],themeTitle:Lf(W.preference),onCycleTheme:W.cycle,sound:Z,remote:ze.status!==null&&!K?{title:`${k("app.header.remoteAccess")} — ${Wc(ze.status.state,ze.status.port)}`,active:Pf(ze.status),onOpen:()=>Ze(!0)}:null,remoteClient:K,onShortcuts:()=>ts(!0)},view:pe,views:fe,onViewChange:Me,badges:{changes:ym(rr.status),plans:to.plans.length,memory:((ar=Js.status)==null?void 0:ar.installed)===!0?Js.status.notes.length:0,cliUnseen:ni},chat:l.jsxs(l.Fragment,{children:[Fr,Hr]}),panel:ai,notes:Wn,console:$t,onTerminalKey:Ft===null?null:Ca}),ao]}):l.jsxs("div",{className:"app",children:[l.jsxs("header",{className:"app-header",children:[l.jsx("span",{className:"app-name",children:"Agent Workbench"}),l.jsx("span",{className:`status status-${p}`,children:k($f[p])}),ee!==null&&l.jsx("span",{className:"meta",title:ee.cwd,children:ee.cwd}),l.jsx("span",{className:"header-spacer"}),m!==null&&l.jsx("span",{className:"meta meta-dim",children:k("app.header.cliVersion",{version:m})}),l.jsx("button",{className:"icon-button",onClick:W.cycle,title:Lf(W.preference),children:Tf[W.preference]}),l.jsx(Tm,{}),l.jsx(xm,{sound:Z}),l.jsx(km,{notify:Z.notify}),ze.status!==null&&!K&&l.jsx("button",{className:`icon-button${Pf(ze.status)?" icon-button-on":""}`,onClick:()=>Ze(!0),title:`${k("app.header.remoteAccess")} — ${Wc(ze.status.state,ze.status.port)}`,children:"⇄"}),K&&l.jsx("span",{className:"remote-badge",title:k("app.header.remoteBadgeTitle"),children:k("app.header.remoteBadge")}),l.jsx("button",{className:"icon-button",onClick:()=>ts(!0),title:k("app.header.shortcuts"),children:"?"})]}),or,l.jsxs("div",{className:"app-body",children:[!Nr&&l.jsxs("button",{className:"panel-peek panel-peek-left",onClick:ir,title:k("app.sidebar.show"),children:[l.jsx("span",{className:"panel-peek-arrow",children:"»"}),l.jsx("span",{className:"panel-peek-label",children:k("app.sidebar.name")})]}),Nr&&oi,Nr&&l.jsx("div",{className:"divider",...La,title:k("app.divider.width")}),l.jsxs("main",{className:`workspace${Xs&&yn?" workspace-narrow":""}`,children:[l.jsx($S,{terminals:g,activeTerminalId:h,activity:H,canOpen:c&&y.length>0,onSelect:xe,onClose:F,onRename:G,onReorder:Y,onNew:ie=>T({cwd:De,...ie!==void 0?{agent:ie}:{}}),agents:w,offerAgentChoice:s,newTabAgent:Te,pendingOpens:d,platform:u,newTabBlockedTitle:Le}),Fr,Hr]}),l.jsxs(l.Fragment,{children:[!yn&&l.jsxs("button",{className:"panel-peek",onClick:bn,title:k("app.panel.show"),children:[l.jsx("span",{className:"panel-peek-arrow",children:"«"}),l.jsx("span",{className:"panel-peek-label",children:k("app.panel.name")})]}),yn&&l.jsx("div",{className:"divider",...Ea,title:k("app.divider.width")}),l.jsxs("div",{className:`panel-slot${yn?"":" panel-slot-collapsed"}${yn&&Xs?" panel-slot-expanded":""}`,style:yn&&!Xs?{width:`${Yi}px`}:void 0,children:[ee!==null&&l.jsxs(l.Fragment,{children:[ai,li]}),Wn]})]})]}),ao]})}const Mm=document.getElementById("root");if(Mm===null)throw new Error("Falta el contenedor #root.");const Px=u_.createRoot(Mm);S1().then(()=>Px.render(l.jsx(Ix,{})));export{n_ as g};